@apicart/vue-components
Version:
Apicart Vue.Js components for simple e-commerce platform development
170 lines (151 loc) • 7.17 kB
JavaScript
/**
* @apicart/vue-components v1.0.0-alpha7
* (c) 2018-2020 Apicart Company
* Released under the MIT License.
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, global.ApicartButton = factory());
}(this, (function () { 'use strict';
var script = {
name: 'apicart-button',
props: {
tag: {
type: String,
default: 'a'
},
type: {
type: String,
default: 'text'
}
}
};
function styleInject(css, ref) {
if ( ref === void 0 ) ref = {};
var insertAt = ref.insertAt;
if (!css || typeof document === 'undefined') { return; }
var head = document.head || document.getElementsByTagName('head')[0];
var style = document.createElement('style');
style.type = 'text/css';
if (insertAt === 'top') {
if (head.firstChild) {
head.insertBefore(style, head.firstChild);
} else {
head.appendChild(style);
}
} else {
head.appendChild(style);
}
if (style.styleSheet) {
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
}
}
var css_248z = ".apicart-button{font-family:-apple-system,\"Segoe UI\",Roboto,Oxygen,Ubuntu,Cantarell,\"Helvetica Neue\",Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\";-webkit-font-smoothing:antialiased;box-sizing:border-box;outline:0}.apicart-button *{box-sizing:border-box;outline:0}.apicart-button{font-size:14px;border:0;background:0;border-radius:0;font-weight:700;text-align:center;white-space:nowrap;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;border-radius:2px;transition:background .8s,box-shadow 280ms cubic-bezier(.4,0,.2,1) 0s,transform .25s cubic-bezier(.25,.46,.45,.94) 0s;text-decoration:none;padding:12px 18px;text-transform:uppercase;background-position:center;color:#121212;outline:0;user-select:none;-webkit-tap-highlight-color:none}.apicart-button:hover{background:#e6e6e7 radial-gradient(circle,transparent 1%,#e6e6e7 1%) center/15000%}.apicart-button:active{background-color:#e6e6e7;background-size:100%;transition:background 0s}.apicart-button--solid{box-shadow:0 0 4px #999;color:#fff;background-color:#121212}.apicart-button--solid:hover{background:#121212 radial-gradient(circle,transparent 1%,#121212 1%) center/15000%}.apicart-button--solid:active{background-color:#666;background-size:100%;transition:background 0s}.apicart-button--outlined{border:1px solid #121212}.apicart-button--outlined:hover{background:#fff radial-gradient(circle,transparent 1%,#fff 1%) center/15000%}.apicart-button--outlined:active{background-color:#e6e6e7;background-size:100%;transition:background 0s}";
styleInject(css_248z);
function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
if (typeof shadowMode !== 'boolean') {
createInjectorSSR = createInjector;
createInjector = shadowMode;
shadowMode = false;
}
// Vue.extend constructor export interop.
const options = typeof script === 'function' ? script.options : script;
// render functions
if (template && template.render) {
options.render = template.render;
options.staticRenderFns = template.staticRenderFns;
options._compiled = true;
// functional template
if (isFunctionalTemplate) {
options.functional = true;
}
}
// scopedId
if (scopeId) {
options._scopeId = scopeId;
}
let hook;
if (moduleIdentifier) {
// server build
hook = function (context) {
// 2.3 injection
context =
context || // cached call
(this.$vnode && this.$vnode.ssrContext) || // stateful
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext); // functional
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__;
}
// inject component styles
if (style) {
style.call(this, createInjectorSSR(context));
}
// register component module identifier for async chunk inference
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier);
}
};
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook;
}
else if (style) {
hook = shadowMode
? function (context) {
style.call(this, createInjectorShadow(context, this.$root.$options.shadowRoot));
}
: function (context) {
style.call(this, createInjector(context));
};
}
if (hook) {
if (options.functional) {
// register for functional component in vue file
const originalRender = options.render;
options.render = function renderWithStyleInjection(h, context) {
hook.call(context);
return originalRender(h, context);
};
}
else {
// inject component registration as beforeCreate hook
const existing = options.beforeCreate;
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
}
}
return script;
}
/* script */
const __vue_script__ = script;
/* template */
var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return (_vm.tag === 'a')?_c('a',{class:'apicart-button apicart-button--' + _vm.type},[_vm._t("default")],2):(_vm.tag === 'button')?_c('button',{class:'apicart-button apicart-button--' + _vm.type},[_vm._t("default")],2):(_vm.tag === 'input')?_c('input',{class:'apicart-button apicart-button--' + _vm.type,attrs:{"type":"submit"}}):_vm._e()};
var __vue_staticRenderFns__ = [];
/* style */
const __vue_inject_styles__ = undefined;
/* scoped */
const __vue_scope_id__ = undefined;
/* module identifier */
const __vue_module_identifier__ = undefined;
/* functional template */
const __vue_is_functional_template__ = false;
/* style inject */
/* style inject SSR */
/* style inject shadow dom */
const __vue_component__ = normalizeComponent(
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
__vue_inject_styles__,
__vue_script__,
__vue_scope_id__,
__vue_is_functional_template__,
__vue_module_identifier__,
false,
undefined,
undefined,
undefined
);
return __vue_component__;
})));