vue-emotion
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -8,21 +8,2 @@ 'use strict'; | ||
function getThemeValues(name, values, ctx) { | ||
var key = ctx.injections.theme[name]; | ||
return values[key] | ||
} | ||
function theme(name, values) { | ||
return function (props, ctx) { | ||
return getThemeValues(name, values, ctx) | ||
} | ||
} | ||
// eslint-disable-next-line no-multi-assign | ||
theme.variants = theme.withProp = function (prop, name, values) { | ||
return function (props, ctx) { | ||
var actualValues = values(props[prop]); | ||
return getThemeValues(name, actualValues, ctx) | ||
} | ||
}; | ||
var push = function (obj, items) { return Array.prototype.push.apply(obj, items); }; | ||
@@ -47,4 +28,2 @@ | ||
inject: ['theme'], | ||
render: function render(h, ctx) { | ||
@@ -121,2 +100,1 @@ var props = ctx.props; | ||
exports['default'] = index; | ||
exports.theme = theme; |
import { css } from 'emotion'; | ||
import { assign, map, reduce } from 'emotion-utils'; | ||
function getThemeValues(name, values, ctx) { | ||
var key = ctx.injections.theme[name]; | ||
return values[key] | ||
} | ||
function theme(name, values) { | ||
return function (props, ctx) { | ||
return getThemeValues(name, values, ctx) | ||
} | ||
} | ||
// eslint-disable-next-line no-multi-assign | ||
theme.variants = theme.withProp = function (prop, name, values) { | ||
return function (props, ctx) { | ||
var actualValues = values(props[prop]); | ||
return getThemeValues(name, actualValues, ctx) | ||
} | ||
}; | ||
var push = function (obj, items) { return Array.prototype.push.apply(obj, items); }; | ||
@@ -42,4 +23,2 @@ | ||
inject: ['theme'], | ||
render: function render(h, ctx) { | ||
@@ -115,2 +94,2 @@ var props = ctx.props; | ||
export { theme };export default index; | ||
export default index; |
@@ -1106,21 +1106,2 @@ (function (global, factory) { | ||
function getThemeValues(name, values, ctx) { | ||
var key = ctx.injections.theme[name]; | ||
return values[key] | ||
} | ||
function theme(name, values) { | ||
return function (props, ctx) { | ||
return getThemeValues(name, values, ctx) | ||
} | ||
} | ||
// eslint-disable-next-line no-multi-assign | ||
theme.variants = theme.withProp = function (prop, name, values) { | ||
return function (props, ctx) { | ||
var actualValues = values(props[prop]); | ||
return getThemeValues(name, actualValues, ctx) | ||
} | ||
}; | ||
var push = function (obj, items) { return Array.prototype.push.apply(obj, items); }; | ||
@@ -1145,4 +1126,2 @@ | ||
inject: ['theme'], | ||
render: function render(h, ctx) { | ||
@@ -1219,3 +1198,2 @@ var props = ctx.props; | ||
exports['default'] = index; | ||
exports.theme = theme; | ||
@@ -1222,0 +1200,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.emotionVue={})}(this,function(e){"use strict";function t(){for(var e=arguments,t="",r=arguments.length,o=Array(r),i=0;i<r;i++)o[i]=e[i];for(var s=0;s<o.length;s++)t+=JSON.stringify(o[s]);return n(t)}function n(e){return r(e,e.length).toString(36)}function r(e,t){for(var n=1540483477,r=t^e.length,u=e.length,c=0;u>=4;){var a=o(e,c);a=s(a,n),a=s(a^=a>>>24,n),r=s(r,n),r^=a,c+=4,u-=4}switch(u){case 3:r^=i(e,c),r=s(r^=e.charCodeAt(c+2)<<16,n);break;case 2:r=s(r^=i(e,c),n);break;case 1:r=s(r^=e.charCodeAt(c),n)}return r^=r>>>13,r=s(r,n),(r^=r>>>15)>>>0}function o(e,t){return e.charCodeAt(t++)+(e.charCodeAt(t++)<<8)+(e.charCodeAt(t++)<<16)+(e.charCodeAt(t)<<24)}function i(e,t){return e.charCodeAt(t++)+(e.charCodeAt(t++)<<8)}function s(e,t){return(65535&(e|=0))*(t|=0)+(((e>>>16)*t&65535)<<16)|0}function u(e){return null===e||void 0===e||!1===e||"object"===(void 0===e?"undefined":$(e))&&0===h(e).length}function c(e){if(u(e))return null;if("object"!==(void 0===e?"undefined":$(e)))return e;var t={},n=!1;return y(h(e),function(e){var r=l(e);null!==r&&r===e||(n=!0),null!==r&&(t[e]=r)}),0===h(t).length?null:n?t:e}function a(e){var t=!1,n=[];return y(e,function(e){var r=l(e);null!==r&&r===e||(t=!0),null!==r&&n.push(r)}),0===n.length?null:t?n:e}function l(e){return"string"==typeof e?e.trim():Array.isArray(e)?a(e):c(e)}function f(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}function p(e,t){return null==t||"boolean"==typeof t||""===t?"":isNaN(t)||0===t||1===F[e]?""+t:("string"==typeof t&&(t=t.trim()),t+"px")}function d(e){var t="";for(var n in e){var r=0===n.indexOf("--");if(e.hasOwnProperty(n)){var o=e[n];"production"===process.env.NODE_ENV||r||ae(n,o),null!=o&&(r?t+=n+":"+o+";":(t+=J(n)+":",t+=p(n,o)+";"))}}return t||null}function h(e){var t=void 0,n=[];for(t in e)n.push(t);return n}function y(e,t){for(var n=0,r=e.length;n<r;n++)t(e[n],n,e)}function m(e,t){if(null==e)return[];for(var n=0,r=e.length,o=new Array(r);n<r;n++)o[n]=t(e[n],n,e);return o}function v(e,t,n){if(null==e)return[];var r=0,o=e.length,i=n;for(void 0===i&&(i=e[0],r=1);r<o;r++)i=t(i,e[r],r,e);return i}function g(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b(e){return e[e.length-1]}function w(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}function x(){var e=document.createElement("style");return e.type="text/css",e.setAttribute("data-emotion",""),e.appendChild(document.createTextNode("")),(document.head||document.getElementsByTagName("head")[0]).appendChild(e),e}function O(e){be[e.id]||(be[e.id]=e)}function _(e){if(j(e)){var t=be[A(e)];if(null==t)throw new Error("[emotion] an unexpected rule cache miss occurred. This is probably a sign of multiple glamor instances in your app. See https://github.com/threepointone/glamor/issues/79");return t}return e}function N(e){var t="",n=[];return y(e,function(e){if("string"==typeof e){var r=xe.exec(e);null!==r&&void 0!==_e[r[1]]?n.push(_e[r[1]]):(t&&(t+=" "),t+=e)}else n.push(e)}),{computedClassName:t,objectStyles:n}}function E(e,t,n){Array.isArray(e)||(e=[e]);var r=N(n?e.concat(n.apply(null,t)):e),o=r.computedClassName,i=void 0===o?"":o,s=r.objectStyles,u=void 0===s?[]:s;return u.length&&(i+=" "+S.apply(null,u).toString()),i.trim()}function S(){for(var e=arguments,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=e[r];return(n=l(n))?we(n):Ne}function C(e){var n={};return B(n,{src:e}),M({id:t(n),style:n,type:"css"})}function j(e){var t=h(e);return 1===t.length&&!!xe.exec(t[0])}function A(e){var t=h(e);if(1!==t.length)throw new Error("not a rule");var n=xe.exec(t[0]);if(!n)throw new Error("not a rule");return n[1]}function k(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return e?t?m(t.split(","),function(t){return t.indexOf("&")>=0?t.replace(Oe,e):e+t}).join(","):e:t.replace(Oe,"")}function D(e){var t=void 0,n=void 0,r=void 0,o=void 0;return y(h(e),function(i){i.indexOf("&")>=0?(n=n||{})[i]=D(e[i]).plain:0===i.indexOf("@media")?(r=r||{})[i]=D(e[i]):0===i.indexOf("@supports")?(o=o||{})[i]=D(e[i]):(t=t||{})[i]=e[i]}),{plain:t,selects:n,medias:r,supports:o}}function R(e,t){var n=t.plain,r=t.selects,o=t.medias,i=t.supports,s=[];return n&&s.push(k(e)+"{"+d(n)+"}"),r&&y(h(r),function(t){return s.push(k(e,t)+"{"+d(r[t])+"}")}),o&&y(h(o),function(t){return s.push(t+"{"+R(e,o[t]).join("")+"}")}),i&&y(h(i),function(t){return s.push(t+"{"+R(e,i[t]).join("")+"}")}),s}function V(e){if(!ge[e.id]){ge[e.id]=!0;var t=D(e.style);m(R(".css-"+e.id,t),function(e){return ve.insert(e)})}}function M(e){var t;if(O(e),V(e),_e[e.id])return _e[e.id];var n=(t={},t["css-"+e.id]="",t);return Object.defineProperty(n,"toString",{enumerable:!1,value:function(){return"css-"+e.id}}),_e[e.id]=n,n}function P(e){return 0===e.indexOf("$")}function T(e){return"object"===(void 0===e?"undefined":me(e))}function W(e,t){var n=m(e.split(","),function(e){return e.indexOf("&")>=0?e:"&"+e});return v(m(t.split(","),function(e){return e.indexOf("&")>=0?e:"&"+e}),function(e,t){return e.concat(m(n,function(e){return t.replace(Oe,e)}))},[]).join(",")}function q(e,t){return e?"@media "+e.substring(6)+" and "+t.substring(6):t}function z(e){return 0===e.indexOf("@media")}function I(e){return 0===e.indexOf("@supports")}function L(e,t){return e?"@supports "+e.substring(9)+" and "+t.substring(9):t}function U(e){var t=[];return y(e,function(e){t=Array.isArray(e)?t.concat(U(e)):t.concat(e)}),t}function B(e,t){var n=t.selector,r=void 0===n?"":n,o=t.mq,i=void 0===o?"":o,s=t.supp,u=void 0===s?"":s,c=t.src,a=void 0===c?[{}]:c;Array.isArray(a)||(a=[a]),y(a=U(a),function(t){if(j(t)){var n=_(t);if("css"!==n.type)throw new Error("cannot merge this rule");t=n.style}(t=l(t))&&t.composes&&B(e,{selector:r,mq:i,supp:u,src:t.composes}),y(h(t||{}),function(n){if(P(n)){var o=t[n];if("string"==typeof o){var s=xe.exec(o);if(null!==s&&be[s[1]]){var c=be[s[1]];if("css"!==c.type)throw new Error("cannot merge this rule");B(e,{selector:r,mq:i,supp:u,src:c.style})}}else B(e,{selector:r,mq:i,supp:u,src:o})}else if(z(n))B(e,{selector:r,mq:q(i,n),supp:u,src:t[n]});else if(I(n))B(e,{selector:r,mq:i,supp:L(u,n),src:t[n]});else if("composes"===n);else if(T(t[n]))B(e,{selector:W(r,n),mq:i,supp:u,src:t[n]});else{var a=e;u&&(a[u]=a[u]||{},a=a[u]),i&&(a[i]=a[i]||{},a=a[i]),r&&(a[r]=a[r]||{},a=a[r]),a[n]=t[n]}})})}function G(e,t,n){return t[n.injections.theme[e]]}function Z(e,t){return function(n,r){return G(e,t,r)}}var $="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},F={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,fontWeight:1,lineClamp:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},H=["Webkit","ms","Moz","O"];y(h(F),function(e){y(H,function(t){F[f(t,e)]=1})});var Y=/[A-Z]|^ms/g,J=function(e){var t={};return function(n){return t.hasOwnProperty(n)||(t[n]=e.call(this,n)),t[n]}}(function(e){return e.replace(Y,"-$&").toLowerCase()});if("production"!==process.env.NODE_ENV)var K=require("fbjs/lib/warning"),Q=require("fbjs/lib/camelizeStyleName"),X=/^(?:webkit|moz|o)[A-Z]/,ee=/;\s*$/,te={},ne={},re=!1,oe=function(e,t){te.hasOwnProperty(e)&&te[e]||(te[e]=!0,"production"!==process.env.NODE_ENV&&K(!1,"Unsupported style property %s. Did you mean %s?%s",e,Q(e),ce(t)))},ie=function(e,t){te.hasOwnProperty(e)&&te[e]||(te[e]=!0,"production"!==process.env.NODE_ENV&&K(!1,"Unsupported vendor-prefixed style property %s. Did you mean %s?%s",e,e.charAt(0).toUpperCase()+e.slice(1),ce(t)))},se=function(e,t,n){ne.hasOwnProperty(t)&&ne[t]||(ne[t]=!0,"production"!==process.env.NODE_ENV&&K(!1,'Style property values shouldn\'t contain a semicolon.%s Try "%s: %s" instead.',ce(n),e,t.replace(ee,"")))},ue=function(e,t,n){re||(re=!0,"production"!==process.env.NODE_ENV&&K(!1,"`NaN` is an invalid value for the `%s` css style property.%s",e,ce(n)))},ce=function(e){if(e){var t=e.getName();if(t)return" Check the render method of `"+t+"`."}return""},ae=function(e,t,n){var r=void 0;n&&(r=n._currentElement._owner),e.indexOf("-")>-1?oe(e,r):X.test(e)?ie(e,r):ee.test(t)&&se(e,t,r),"number"==typeof t&&isNaN(t)&&ue(e,0,r)};var le=Object.assign||function(e){for(var t=arguments,n=1,r=arguments.length;n<r;n++){var o=t[n];for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(e[i]=o[i])}return e},fe="undefined"!=typeof window,pe="development"===process.env.NODE_ENV||!process.env.NODE_ENV,de="test"===process.env.NODE_ENV,he=function(){if(fe){var e=document.createElement("div");return e.innerHTML="\x3c!--[if lt IE 10]><i></i><![endif]--\x3e",1===e.getElementsByTagName("i").length}}(),ye=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.speedy,r=void 0===n?!pe&&!de:n,o=t.maxLength,i=void 0===o?fe&&he?4e3:65e3:o;g(this,e),this.isSpeedy=r,this.sheet=void 0,this.tags=[],this.maxLength=i,this.ctr=0}return e.prototype.getSheet=function(){return w(b(this.tags))},e.prototype.inject=function(){var e=this;if(this.injected)throw new Error("already injected!");fe?this.tags[0]=x():this.sheet={cssRules:[],insertRule:function(t){e.sheet.cssRules.push({cssText:t})}},this.injected=!0},e.prototype.speedy=function(e){if(0!==this.ctr)throw new Error("cannot change speedy now");this.isSpeedy=!!e},e.prototype._insert=function(e){try{var t=this.getSheet();t.insertRule(e,-1!==e.indexOf("@import")?0:t.cssRules.length)}catch(t){pe&&console.warn("illegal rule",e)}},e.prototype.insert=function(e){if(fe)if(this.isSpeedy&&this.getSheet().insertRule)this._insert(e);else if(-1!==e.indexOf("@import")){var t=b(this.tags);t.insertBefore(document.createTextNode(e),t.firstChild)}else b(this.tags).appendChild(document.createTextNode(e));else this.sheet.insertRule(e,-1!==e.indexOf("@import")?0:this.sheet.cssRules.length);return this.ctr++,fe&&this.ctr%this.maxLength==0&&this.tags.push(x()),this.ctr-1},e.prototype.delete=function(e){return this.replace(e,"")},e.prototype.flush=function(){fe?(y(this.tags,function(e){return e.parentNode.removeChild(e)}),this.tags=[],this.sheet=null,this.ctr=0):this.sheet.cssRules=[],this.injected=!1},e.prototype.rules=function(){if(!fe)return this.sheet.cssRules;var e=[];return y(this.tags,function(t){return e.splice.apply(e,[e.length,0].concat(Array.from(w(t).cssRules)))}),e},e}(),me="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ve=new ye;ve.inject();var ge={},be=ve.registered={},we="undefined"!=typeof WeakMap?function(e){return function(t){if(Ee[t.length]){for(var n=Ee[t.length],r=0;r<t.length-1;)n.has(t[r])||n.set(t[r],new WeakMap),n=n.get(t[r]),r++;if(n.has(t[t.length-1])){var o=n.get(t[r]);if(be[o.toString().substring(4)])return o}}var i=e(t);if(Ee[t.length]){for(var s=0,u=Ee[t.length];s<t.length-1;)u=u.get(t[s]),s++;try{u.set(t[s],i)}catch(e){if(!("development"!==process.env.NODE_ENV&&process.env.NODE_ENV||Se)){var c;Se=!0,(c=console).warn.apply(c,["failed setting the WeakMap cache for args:"].concat(t)),console.warn("this should NOT happen, please file a bug on the github repo.")}}}return i}}(C):C,xe=/^css-([a-zA-Z0-9]+)/,Oe=/&/gm,_e={},Ne={};Object.defineProperty(Ne,"toString",{enumerable:!1,value:function(){return"css-nil"}});var Ee="undefined"!=typeof WeakMap?[Ne,new WeakMap,new WeakMap,new WeakMap]:[Ne],Se=!1;Z.variants=Z.withProp=function(e,t,n){return function(r,o){var i=n(r[e]);return G(t,i,o)}};var Ce=function(e,t){return Array.prototype.push.apply(e,t)};e.default=function(e,t,n,r,o){if(void 0===r&&(r=[]),!e)throw new Error("You are trying to create a styled element with an undefined component.\nYou may have forgotten to import it.");var i={name:"styled-"+(e.name||"Component"),functional:!0,inject:["theme"],render:function(i,s){var u=s.props,c=function(e){return e&&"function"==typeof e?e.__emotion_class?"& ."+e.__emotion_class:e(u,s):e},a=e,l=[];e.__emotion_spec&&(Ce(l,v(e.__emotion_spec,function(e,t){return Ce(e,t.objs),t.content&&Ce(e,t.content.apply(null,m(t.vars,c))),e.push(t.cls),e},[])),a=e.__emotion_spec[0].tag),Ce(l,n),l.push(t),o&&Ce(l,o.apply(null,m(r,c)));var f=E(m(l,c));return i(a,le({},s.data,{class:[s.data.class,f]}),s.children)}},s={vars:r,content:o,objs:n,tag:e,cls:t};return i.__emotion_spec=e.__emotion_spec?e.__emotion_spec.concat(s):[s],i.__emotion_class=t,i},e.theme=Z,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.emotionVue={})}(this,function(e){"use strict";function t(){for(var e=arguments,t="",r=arguments.length,o=Array(r),i=0;i<r;i++)o[i]=e[i];for(var s=0;s<o.length;s++)t+=JSON.stringify(o[s]);return n(t)}function n(e){return r(e,e.length).toString(36)}function r(e,t){for(var n=1540483477,r=t^e.length,u=e.length,c=0;u>=4;){var a=o(e,c);a=s(a,n),a=s(a^=a>>>24,n),r=s(r,n),r^=a,c+=4,u-=4}switch(u){case 3:r^=i(e,c),r=s(r^=e.charCodeAt(c+2)<<16,n);break;case 2:r=s(r^=i(e,c),n);break;case 1:r=s(r^=e.charCodeAt(c),n)}return r^=r>>>13,r=s(r,n),(r^=r>>>15)>>>0}function o(e,t){return e.charCodeAt(t++)+(e.charCodeAt(t++)<<8)+(e.charCodeAt(t++)<<16)+(e.charCodeAt(t)<<24)}function i(e,t){return e.charCodeAt(t++)+(e.charCodeAt(t++)<<8)}function s(e,t){return(65535&(e|=0))*(t|=0)+(((e>>>16)*t&65535)<<16)|0}function u(e){return null===e||void 0===e||!1===e||"object"===(void 0===e?"undefined":G(e))&&0===h(e).length}function c(e){if(u(e))return null;if("object"!==(void 0===e?"undefined":G(e)))return e;var t={},n=!1;return y(h(e),function(e){var r=l(e);null!==r&&r===e||(n=!0),null!==r&&(t[e]=r)}),0===h(t).length?null:n?t:e}function a(e){var t=!1,n=[];return y(e,function(e){var r=l(e);null!==r&&r===e||(t=!0),null!==r&&n.push(r)}),0===n.length?null:t?n:e}function l(e){return"string"==typeof e?e.trim():Array.isArray(e)?a(e):c(e)}function f(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}function p(e,t){return null==t||"boolean"==typeof t||""===t?"":isNaN(t)||0===t||1===Z[e]?""+t:("string"==typeof t&&(t=t.trim()),t+"px")}function d(e){var t="";for(var n in e){var r=0===n.indexOf("--");if(e.hasOwnProperty(n)){var o=e[n];"production"===process.env.NODE_ENV||r||ue(n,o),null!=o&&(r?t+=n+":"+o+";":(t+=H(n)+":",t+=p(n,o)+";"))}}return t||null}function h(e){var t=void 0,n=[];for(t in e)n.push(t);return n}function y(e,t){for(var n=0,r=e.length;n<r;n++)t(e[n],n,e)}function m(e,t){if(null==e)return[];for(var n=0,r=e.length,o=new Array(r);n<r;n++)o[n]=t(e[n],n,e);return o}function v(e,t,n){if(null==e)return[];var r=0,o=e.length,i=n;for(void 0===i&&(i=e[0],r=1);r<o;r++)i=t(i,e[r],r,e);return i}function g(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b(e){return e[e.length-1]}function w(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}function x(){var e=document.createElement("style");return e.type="text/css",e.setAttribute("data-emotion",""),e.appendChild(document.createTextNode("")),(document.head||document.getElementsByTagName("head")[0]).appendChild(e),e}function O(e){ve[e.id]||(ve[e.id]=e)}function _(e){if(A(e)){var t=ve[j(e)];if(null==t)throw new Error("[emotion] an unexpected rule cache miss occurred. This is probably a sign of multiple glamor instances in your app. See https://github.com/threepointone/glamor/issues/79");return t}return e}function N(e){var t="",n=[];return y(e,function(e){if("string"==typeof e){var r=be.exec(e);null!==r&&void 0!==xe[r[1]]?n.push(xe[r[1]]):(t&&(t+=" "),t+=e)}else n.push(e)}),{computedClassName:t,objectStyles:n}}function E(e,t,n){Array.isArray(e)||(e=[e]);var r=N(n?e.concat(n.apply(null,t)):e),o=r.computedClassName,i=void 0===o?"":o,s=r.objectStyles,u=void 0===s?[]:s;return u.length&&(i+=" "+S.apply(null,u).toString()),i.trim()}function S(){for(var e=arguments,t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=e[r];return(n=l(n))?ge(n):Oe}function C(e){var n={};return B(n,{src:e}),M({id:t(n),style:n,type:"css"})}function A(e){var t=h(e);return 1===t.length&&!!be.exec(t[0])}function j(e){var t=h(e);if(1!==t.length)throw new Error("not a rule");var n=be.exec(t[0]);if(!n)throw new Error("not a rule");return n[1]}function k(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return e?t?m(t.split(","),function(t){return t.indexOf("&")>=0?t.replace(we,e):e+t}).join(","):e:t.replace(we,"")}function D(e){var t=void 0,n=void 0,r=void 0,o=void 0;return y(h(e),function(i){i.indexOf("&")>=0?(n=n||{})[i]=D(e[i]).plain:0===i.indexOf("@media")?(r=r||{})[i]=D(e[i]):0===i.indexOf("@supports")?(o=o||{})[i]=D(e[i]):(t=t||{})[i]=e[i]}),{plain:t,selects:n,medias:r,supports:o}}function R(e,t){var n=t.plain,r=t.selects,o=t.medias,i=t.supports,s=[];return n&&s.push(k(e)+"{"+d(n)+"}"),r&&y(h(r),function(t){return s.push(k(e,t)+"{"+d(r[t])+"}")}),o&&y(h(o),function(t){return s.push(t+"{"+R(e,o[t]).join("")+"}")}),i&&y(h(i),function(t){return s.push(t+"{"+R(e,i[t]).join("")+"}")}),s}function V(e){if(!me[e.id]){me[e.id]=!0;var t=D(e.style);m(R(".css-"+e.id,t),function(e){return ye.insert(e)})}}function M(e){var t;if(O(e),V(e),xe[e.id])return xe[e.id];var n=(t={},t["css-"+e.id]="",t);return Object.defineProperty(n,"toString",{enumerable:!1,value:function(){return"css-"+e.id}}),xe[e.id]=n,n}function T(e){return 0===e.indexOf("$")}function W(e){return"object"===(void 0===e?"undefined":he(e))}function P(e,t){var n=m(e.split(","),function(e){return e.indexOf("&")>=0?e:"&"+e});return v(m(t.split(","),function(e){return e.indexOf("&")>=0?e:"&"+e}),function(e,t){return e.concat(m(n,function(e){return t.replace(we,e)}))},[]).join(",")}function q(e,t){return e?"@media "+e.substring(6)+" and "+t.substring(6):t}function z(e){return 0===e.indexOf("@media")}function I(e){return 0===e.indexOf("@supports")}function L(e,t){return e?"@supports "+e.substring(9)+" and "+t.substring(9):t}function U(e){var t=[];return y(e,function(e){t=Array.isArray(e)?t.concat(U(e)):t.concat(e)}),t}function B(e,t){var n=t.selector,r=void 0===n?"":n,o=t.mq,i=void 0===o?"":o,s=t.supp,u=void 0===s?"":s,c=t.src,a=void 0===c?[{}]:c;Array.isArray(a)||(a=[a]),y(a=U(a),function(t){if(A(t)){var n=_(t);if("css"!==n.type)throw new Error("cannot merge this rule");t=n.style}(t=l(t))&&t.composes&&B(e,{selector:r,mq:i,supp:u,src:t.composes}),y(h(t||{}),function(n){if(T(n)){var o=t[n];if("string"==typeof o){var s=be.exec(o);if(null!==s&&ve[s[1]]){var c=ve[s[1]];if("css"!==c.type)throw new Error("cannot merge this rule");B(e,{selector:r,mq:i,supp:u,src:c.style})}}else B(e,{selector:r,mq:i,supp:u,src:o})}else if(z(n))B(e,{selector:r,mq:q(i,n),supp:u,src:t[n]});else if(I(n))B(e,{selector:r,mq:i,supp:L(u,n),src:t[n]});else if("composes"===n);else if(W(t[n]))B(e,{selector:P(r,n),mq:i,supp:u,src:t[n]});else{var a=e;u&&(a[u]=a[u]||{},a=a[u]),i&&(a[i]=a[i]||{},a=a[i]),r&&(a[r]=a[r]||{},a=a[r]),a[n]=t[n]}})})}var G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Z={animationIterationCount:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,fontWeight:1,lineClamp:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},$=["Webkit","ms","Moz","O"];y(h(Z),function(e){y($,function(t){Z[f(t,e)]=1})});var F=/[A-Z]|^ms/g,H=function(e){var t={};return function(n){return t.hasOwnProperty(n)||(t[n]=e.call(this,n)),t[n]}}(function(e){return e.replace(F,"-$&").toLowerCase()});if("production"!==process.env.NODE_ENV)var Y=require("fbjs/lib/warning"),J=require("fbjs/lib/camelizeStyleName"),K=/^(?:webkit|moz|o)[A-Z]/,Q=/;\s*$/,X={},ee={},te=!1,ne=function(e,t){X.hasOwnProperty(e)&&X[e]||(X[e]=!0,"production"!==process.env.NODE_ENV&&Y(!1,"Unsupported style property %s. Did you mean %s?%s",e,J(e),se(t)))},re=function(e,t){X.hasOwnProperty(e)&&X[e]||(X[e]=!0,"production"!==process.env.NODE_ENV&&Y(!1,"Unsupported vendor-prefixed style property %s. Did you mean %s?%s",e,e.charAt(0).toUpperCase()+e.slice(1),se(t)))},oe=function(e,t,n){ee.hasOwnProperty(t)&&ee[t]||(ee[t]=!0,"production"!==process.env.NODE_ENV&&Y(!1,'Style property values shouldn\'t contain a semicolon.%s Try "%s: %s" instead.',se(n),e,t.replace(Q,"")))},ie=function(e,t,n){te||(te=!0,"production"!==process.env.NODE_ENV&&Y(!1,"`NaN` is an invalid value for the `%s` css style property.%s",e,se(n)))},se=function(e){if(e){var t=e.getName();if(t)return" Check the render method of `"+t+"`."}return""},ue=function(e,t,n){var r=void 0;n&&(r=n._currentElement._owner),e.indexOf("-")>-1?ne(e,r):K.test(e)?re(e,r):Q.test(t)&&oe(e,t,r),"number"==typeof t&&isNaN(t)&&ie(e,0,r)};var ce=Object.assign||function(e){for(var t=arguments,n=1,r=arguments.length;n<r;n++){var o=t[n];for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(e[i]=o[i])}return e},ae="undefined"!=typeof window,le="development"===process.env.NODE_ENV||!process.env.NODE_ENV,fe="test"===process.env.NODE_ENV,pe=function(){if(ae){var e=document.createElement("div");return e.innerHTML="\x3c!--[if lt IE 10]><i></i><![endif]--\x3e",1===e.getElementsByTagName("i").length}}(),de=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.speedy,r=void 0===n?!le&&!fe:n,o=t.maxLength,i=void 0===o?ae&&pe?4e3:65e3:o;g(this,e),this.isSpeedy=r,this.sheet=void 0,this.tags=[],this.maxLength=i,this.ctr=0}return e.prototype.getSheet=function(){return w(b(this.tags))},e.prototype.inject=function(){var e=this;if(this.injected)throw new Error("already injected!");ae?this.tags[0]=x():this.sheet={cssRules:[],insertRule:function(t){e.sheet.cssRules.push({cssText:t})}},this.injected=!0},e.prototype.speedy=function(e){if(0!==this.ctr)throw new Error("cannot change speedy now");this.isSpeedy=!!e},e.prototype._insert=function(e){try{var t=this.getSheet();t.insertRule(e,-1!==e.indexOf("@import")?0:t.cssRules.length)}catch(t){le&&console.warn("illegal rule",e)}},e.prototype.insert=function(e){if(ae)if(this.isSpeedy&&this.getSheet().insertRule)this._insert(e);else if(-1!==e.indexOf("@import")){var t=b(this.tags);t.insertBefore(document.createTextNode(e),t.firstChild)}else b(this.tags).appendChild(document.createTextNode(e));else this.sheet.insertRule(e,-1!==e.indexOf("@import")?0:this.sheet.cssRules.length);return this.ctr++,ae&&this.ctr%this.maxLength==0&&this.tags.push(x()),this.ctr-1},e.prototype.delete=function(e){return this.replace(e,"")},e.prototype.flush=function(){ae?(y(this.tags,function(e){return e.parentNode.removeChild(e)}),this.tags=[],this.sheet=null,this.ctr=0):this.sheet.cssRules=[],this.injected=!1},e.prototype.rules=function(){if(!ae)return this.sheet.cssRules;var e=[];return y(this.tags,function(t){return e.splice.apply(e,[e.length,0].concat(Array.from(w(t).cssRules)))}),e},e}(),he="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ye=new de;ye.inject();var me={},ve=ye.registered={},ge="undefined"!=typeof WeakMap?function(e){return function(t){if(_e[t.length]){for(var n=_e[t.length],r=0;r<t.length-1;)n.has(t[r])||n.set(t[r],new WeakMap),n=n.get(t[r]),r++;if(n.has(t[t.length-1])){var o=n.get(t[r]);if(ve[o.toString().substring(4)])return o}}var i=e(t);if(_e[t.length]){for(var s=0,u=_e[t.length];s<t.length-1;)u=u.get(t[s]),s++;try{u.set(t[s],i)}catch(e){if(!("development"!==process.env.NODE_ENV&&process.env.NODE_ENV||Ne)){var c;Ne=!0,(c=console).warn.apply(c,["failed setting the WeakMap cache for args:"].concat(t)),console.warn("this should NOT happen, please file a bug on the github repo.")}}}return i}}(C):C,be=/^css-([a-zA-Z0-9]+)/,we=/&/gm,xe={},Oe={};Object.defineProperty(Oe,"toString",{enumerable:!1,value:function(){return"css-nil"}});var _e="undefined"!=typeof WeakMap?[Oe,new WeakMap,new WeakMap,new WeakMap]:[Oe],Ne=!1,Ee=function(e,t){return Array.prototype.push.apply(e,t)};e.default=function(e,t,n,r,o){if(void 0===r&&(r=[]),!e)throw new Error("You are trying to create a styled element with an undefined component.\nYou may have forgotten to import it.");var i={name:"styled-"+(e.name||"Component"),functional:!0,render:function(i,s){var u=s.props,c=function(e){return e&&"function"==typeof e?e.__emotion_class?"& ."+e.__emotion_class:e(u,s):e},a=e,l=[];e.__emotion_spec&&(Ee(l,v(e.__emotion_spec,function(e,t){return Ee(e,t.objs),t.content&&Ee(e,t.content.apply(null,m(t.vars,c))),e.push(t.cls),e},[])),a=e.__emotion_spec[0].tag),Ee(l,n),l.push(t),o&&Ee(l,o.apply(null,m(r,c)));var f=E(m(l,c));return i(a,ce({},s.data,{class:[s.data.class,f]}),s.children)}},s={vars:r,content:o,objs:n,tag:e,cls:t};return i.__emotion_spec=e.__emotion_spec?e.__emotion_spec.concat(s):[s],i.__emotion_class=t,i},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=vue-emotion.min.js.map |
{ | ||
"name": "vue-emotion", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Seamlessly use emotion (CSS-in-JS) with Vue.js", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -18,3 +18,2 @@ # vue-emotion | ||
- [Usage](#usage) | ||
* [Theming](#theming) | ||
* [Server-side rendering](#server-side-rendering) | ||
@@ -65,45 +64,2 @@ - [Contributing](#contributing) | ||
### Theming | ||
Basically it works like [styled-theming](https://github.com/thejameskyle/styled-theming): | ||
```js | ||
import styled, { theme } from 'vue-emotion' | ||
const color = theme('mode', { | ||
light: 'black', | ||
dark: 'white' | ||
}) | ||
const backgroundColor = theme('mode', { | ||
light: 'white', | ||
dark: 'black' | ||
}) | ||
const Button = styled('button')` | ||
color: ${color}; | ||
background-color: ${backgroundColor}; | ||
border: 1px solid ${color}; | ||
padding: 10px 20px; | ||
` | ||
new Vue({ | ||
data: { | ||
theme: { | ||
mode: 'light' | ||
} | ||
}, | ||
provide() { | ||
return { | ||
theme: this.theme | ||
} | ||
}, | ||
render() { | ||
return <Button>hi</Button> | ||
} | ||
}) | ||
``` | ||
### Server-side rendering | ||
@@ -110,0 +66,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55287
1220
120