Comparing version 1.0.12 to 1.0.13
@@ -6,3 +6,4 @@ import { extend, map, range, times } from 'lodash'; | ||
window.sheetjs = { StyleSheet }; | ||
const s = (new StyleSheet()).stylesForSelector; | ||
const styleSheet = new StyleSheet(); | ||
const s = styleSheet.stylesForSelector; | ||
@@ -21,6 +22,8 @@ // state | ||
function init() { | ||
s('html, body').margin = '0px'; | ||
s('.button-bank').margin = '20px' | ||
s('.button-bank > *').margin = '0 14px 14px 0'; | ||
s('.demo-el-container').margin = '20px'; | ||
styleSheet.setStylesForSelectors({ | ||
'html, body': { margin: '0px' }, | ||
'.button-bank': { margin: '20px' }, | ||
'.button-bank > *': { margin: '0 14px 14px 0' }, | ||
'.demo-el-container': { margin: '20px' } | ||
}); | ||
@@ -78,10 +81,11 @@ updateDemoElStyles(); | ||
function updateDemoElStyles() { | ||
var demoElStyles = s('.' + demoElClass); | ||
extend(demoElStyles, { | ||
'float': 'left', | ||
'margin': '2px', | ||
'border': '1px solid black', | ||
'height': '10px', | ||
'width': '10px', | ||
'backgroundColor': isToggled ? toggleColor2 : toggleColor1, | ||
styleSheet.setStylesForSelectors({ | ||
['.' + demoElClass]: { | ||
'float': 'left', | ||
'margin': '2px', | ||
'border': '1px solid black', | ||
'height': '10px', | ||
'width': '10px', | ||
'backgroundColor': isToggled ? toggleColor2 : toggleColor1, | ||
} | ||
}); | ||
@@ -88,0 +92,0 @@ } |
@@ -57,3 +57,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
module.exports = __webpack_require__(46); | ||
module.exports = __webpack_require__(49); | ||
@@ -65,16 +65,2 @@ | ||
// // CSSStyleSheet: | ||
// { | ||
// // CSSRuleList | ||
// rules: [ | ||
// // CSSStyleRule: | ||
// { | ||
// // CSSStyleDeclaration: | ||
// style: { | ||
// backgroundColor: 'red' | ||
// } | ||
// } | ||
// ] | ||
// } | ||
'use strict'; | ||
@@ -90,5 +76,12 @@ | ||
var _interopRequireDefault = __webpack_require__(46)['default']; | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
var _utilsBindAll = __webpack_require__(47); | ||
var _utilsBindAll2 = _interopRequireDefault(_utilsBindAll); | ||
var instanceCount = 0; | ||
@@ -100,12 +93,9 @@ | ||
this._instance = instanceCount++; | ||
this._styleSheet = null; | ||
this._instance = ++instanceCount; | ||
this._element = null; | ||
this._sheet = null; | ||
this._rules = null; | ||
this._deleteRule = null; | ||
// bind context of public methods | ||
var self = this; | ||
['setStylesForSelectors', 'setStylesForSelector', 'stylesForSelector', 'createStylesForSelector', 'getStylesForSelector', 'deleteStylesForSelector', 'disable', 'enable'].forEach(function (method) { | ||
return self[method] = self[method].bind(self); | ||
}); | ||
(0, _utilsBindAll2['default'])(this); | ||
@@ -117,2 +107,19 @@ if (stylesBySelector) { | ||
// 'style' dom element property reference | ||
// { | ||
// // CSSStyleSheet | ||
// sheet: { | ||
// // CSSRuleList | ||
// rules: [ | ||
// // CSSStyleRule | ||
// { | ||
// // CSSStyleDeclaration | ||
// style: { | ||
// backgroundColor: 'red' | ||
// } | ||
// } | ||
// ] | ||
// } | ||
// } | ||
_createClass(StyleSheet, [{ | ||
@@ -163,7 +170,6 @@ key: 'setStylesForSelectors', | ||
value: function deleteStylesForSelector(selector) { | ||
var sheet = this._getSheet(); | ||
var deleteRule = sheet.removeRule || sheet.deleteRule; | ||
var deleteRule = this._getDeleteRule(); | ||
var ruleIndex = this._getRuleIndex(selector); | ||
return ruleIndex === -1 ? false : deleteRule.call(sheet, ruleIndex); | ||
return ruleIndex === -1 ? false : deleteRule(ruleIndex); | ||
} | ||
@@ -183,2 +189,10 @@ }, { | ||
}, { | ||
key: '_getDeleteRule', | ||
value: function _getDeleteRule() { | ||
return this._deleteRule || (function () { | ||
var sheet = this._getSheet(); | ||
return this._deleteRule = (sheet.removeRule || sheet.deleteRule).bind(sheet); | ||
}).call(this); | ||
} | ||
}, { | ||
key: '_getRuleIndex', | ||
@@ -207,9 +221,2 @@ value: function _getRuleIndex(selector) { | ||
}, { | ||
key: '_getSheet', | ||
value: function _getSheet() { | ||
return this._sheet || (function () { | ||
return this._sheet = this._getStylesForSelectorsheet().sheet; | ||
}).call(this); | ||
} | ||
}, { | ||
key: '_getRules', | ||
@@ -223,11 +230,18 @@ value: function _getRules() { | ||
}, { | ||
key: '_getStylesForSelectorsheet', | ||
value: function _getStylesForSelectorsheet() { | ||
return this._styleSheet || (function () { | ||
var style = document.createElement('style'); | ||
key: '_getSheet', | ||
value: function _getSheet() { | ||
return this._sheet || (function () { | ||
return this._sheet = this._getElement().sheet; | ||
}).call(this); | ||
} | ||
}, { | ||
key: '_getElement', | ||
value: function _getElement() { | ||
return this._element || (function () { | ||
var styleSheet = document.createElement('style'); | ||
var head = document.head || document.getElementsByTagName('head')[0]; | ||
style.type = 'text/css'; | ||
style.setAttribute('id', 'sheetjs-' + this._instance); | ||
head.appendChild(style); | ||
return this._styleSheet = style; | ||
styleSheet.type = 'text/css'; | ||
styleSheet.setAttribute('id', 'sheetjs-' + this._instance); | ||
head.appendChild(styleSheet); | ||
return this._element = styleSheet; | ||
}).call(this); | ||
@@ -1103,2 +1117,16 @@ } | ||
/* 46 */ | ||
/***/ function(module, exports) { | ||
"use strict"; | ||
exports["default"] = function (obj) { | ||
return obj && obj.__esModule ? obj : { | ||
"default": obj | ||
}; | ||
}; | ||
exports.__esModule = true; | ||
/***/ }, | ||
/* 47 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -1108,17 +1136,27 @@ | ||
var _interopRequireDefault = __webpack_require__(47)['default']; | ||
var _Object$getOwnPropertyNames = __webpack_require__(38)['default']; | ||
var _interopRequireDefault = __webpack_require__(46)['default']; | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
exports['default'] = bindAll; | ||
var _StyleSheet = __webpack_require__(1); | ||
var _isFunction = __webpack_require__(48); | ||
var _StyleSheet2 = _interopRequireDefault(_StyleSheet); | ||
var _isFunction2 = _interopRequireDefault(_isFunction); | ||
exports['default'] = { StyleSheet: _StyleSheet2['default'] }; | ||
function bindAll(obj) { | ||
_Object$getOwnPropertyNames(Object.getPrototypeOf(obj)).filter(function (key) { | ||
return (0, _isFunction2['default'])(obj[key]); | ||
}).forEach(function (method) { | ||
return obj[method] = obj[method].bind(obj); | ||
}); | ||
} | ||
module.exports = exports['default']; | ||
/***/ }, | ||
/* 47 */ | ||
/* 48 */ | ||
/***/ function(module, exports) { | ||
@@ -1128,10 +1166,32 @@ | ||
exports["default"] = function (obj) { | ||
return obj && obj.__esModule ? obj : { | ||
"default": obj | ||
}; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = isFunction; | ||
exports.__esModule = true; | ||
function isFunction(obj) { | ||
return !!(obj && obj.constructor && obj.call && obj.apply); | ||
} | ||
module.exports = exports["default"]; | ||
/***/ }, | ||
/* 49 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
'use strict'; | ||
var _interopRequireDefault = __webpack_require__(46)['default']; | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
var _StyleSheet = __webpack_require__(1); | ||
var _StyleSheet2 = _interopRequireDefault(_StyleSheet); | ||
exports['default'] = { StyleSheet: _StyleSheet2['default'] }; | ||
module.exports = exports['default']; | ||
/***/ } | ||
@@ -1138,0 +1198,0 @@ /******/ ]) |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.sheetjs=e():t.sheetjs=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){t.exports=r(46)},function(t,e,r){"use strict";var n=r(2)["default"],o=r(6)["default"],u=r(7)["default"],s=r(17)["default"];Object.defineProperty(e,"__esModule",{value:!0});var i=0,c=function(){function t(e){o(this,t),this._instance=i++,this._styleSheet=null,this._sheet=null,this._rules=null;var r=this;["setStylesForSelectors","setStylesForSelector","stylesForSelector","createStylesForSelector","getStylesForSelector","deleteStylesForSelector","disable","enable"].forEach(function(t){return r[t]=r[t].bind(r)}),e&&this.setStylesForSelectors(e)}return n(t,[{key:"setStylesForSelectors",value:function(t){var e=this;return u(t).forEach(function(r){return e.setStylesForSelector(r,t[r])}),this}},{key:"setStylesForSelector",value:function(t,e){return s(this.stylesForSelector(t),e),this}},{key:"stylesForSelector",value:function(t){return this.getStylesForSelector(t)||this.createStylesForSelector(t)}},{key:"createStylesForSelector",value:function(t){var e=this._getSheet(),r=this._getRules(),n=r.length,o=t+" { }";return e.insertRule(o,n),r.item(n).style}},{key:"getStylesForSelector",value:function(t){var e=this._getRule(t);return e?e.style:void 0}},{key:"deleteStylesForSelector",value:function(t){var e=this._getSheet(),r=e.removeRule||e.deleteRule,n=this._getRuleIndex(t);return-1===n?!1:r.call(e,n)}},{key:"disable",value:function(){return this._getSheet().disabled=!0,this}},{key:"enable",value:function(){return this._getSheet().disabled=!1,this}},{key:"_getRuleIndex",value:function(t){var e=this._getRules(),r=this._getRule(t);return Array.prototype.indexOf.call(e,r)}},{key:"_getRule",value:function(t){for(var e=this._getRules(),r=e.length,n=0;r>n;n++)if(e[n].selectorText===t)return e[n];return void 0}},{key:"_getSheet",value:function(){return this._sheet||function(){return this._sheet=this._getStylesForSelectorsheet().sheet}.call(this)}},{key:"_getRules",value:function(){return this._rules||function(){var t=this._getSheet();return this._rules=t.cssRules||t.rules}.call(this)}},{key:"_getStylesForSelectorsheet",value:function(){return this._styleSheet||function(){var t=document.createElement("style"),e=document.head||document.getElementsByTagName("head")[0];return t.type="text/css",t.setAttribute("id","sheetjs-"+this._instance),e.appendChild(t),this._styleSheet=t}.call(this)}}]),t}();e["default"]=c,t.exports=e["default"]},function(t,e,r){"use strict";var n=r(3)["default"];e["default"]=function(){function t(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),n(t,o.key,o)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),e.__esModule=!0},function(t,e,r){"use strict";t.exports={"default":r(4),__esModule:!0}},function(t,e,r){"use strict";var n=r(5);t.exports=function(t,e,r){return n.setDesc(t,e,r)}},function(t){"use strict";var e=Object;t.exports={create:e.create,getProto:e.getPrototypeOf,isEnum:{}.propertyIsEnumerable,getDesc:e.getOwnPropertyDescriptor,setDesc:e.defineProperty,setDescs:e.defineProperties,getKeys:e.keys,getNames:e.getOwnPropertyNames,getSymbols:e.getOwnPropertySymbols,each:[].forEach}},function(t,e){"use strict";e["default"]=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},e.__esModule=!0},function(t,e,r){"use strict";t.exports={"default":r(8),__esModule:!0}},function(t,e,r){"use strict";r(9),t.exports=r(15).Object.keys},function(t,e,r){"use strict";var n=r(10);r(12)("keys",function(t){return function(e){return t(n(e))}})},function(t,e,r){"use strict";var n=r(11);t.exports=function(t){return Object(n(t))}},function(t){"use strict";t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,r){"use strict";t.exports=function(t,e){var n=r(13),o=(r(15).Object||{})[t]||Object[t],u={};u[t]=e(o),n(n.S+n.F*r(16)(function(){o(1)}),"Object",u)}},function(t,e,r){"use strict";var n=r(14),o=r(15),u="prototype",s=function(t,e){return function(){return t.apply(e,arguments)}},i=function c(t,e,r){var i,l,f,a,p=t&c.G,y=t&c.P,h=p?n:t&c.S?n[e]:(n[e]||{})[u],d=p?o:o[e]||(o[e]={});p&&(r=e);for(i in r)l=!(t&c.F)&&h&&i in h,l&&i in d||(f=l?h[i]:r[i],p&&"function"!=typeof h[i]?a=r[i]:t&c.B&&l?a=s(f,n):t&c.W&&h[i]==f?!function(t){a=function(e){return this instanceof t?new t(e):t(e)},a[u]=t[u]}(f):a=y&&"function"==typeof f?s(Function.call,f):f,d[i]=a,y&&((d[u]||(d[u]={}))[i]=f))};i.F=1,i.G=2,i.S=4,i.P=8,i.B=16,i.W=32,t.exports=i},function(t){"use strict";var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)},function(t){"use strict";var e=t.exports={version:"1.2.2"};"number"==typeof __e&&(__e=e)},function(t){"use strict";t.exports=function(t){try{return!!t()}catch(e){return!0}}},function(t,e,r){"use strict";t.exports={"default":r(18),__esModule:!0}},function(t,e,r){"use strict";r(19),t.exports=r(15).Object.assign},function(t,e,r){"use strict";var n=r(13);n(n.S+n.F,"Object",{assign:r(20)})},function(t,e,r){"use strict";var n=r(17)["default"],o=r(21)["default"],u=r(7)["default"],s=r(5),i=r(10),c=r(35);t.exports=r(16)(function(){var t=n,e={},r={},s=o(),i="abcdefghijklmnopqrst";return e[s]=7,i.split("").forEach(function(t){r[t]=t}),7!=t({},e)[s]||u(t({},r)).join("")!=i})?function(t){for(var e=i(t),r=arguments,n=r.length,o=1,u=s.getKeys,l=s.getSymbols,f=s.isEnum;n>o;)for(var a,p=c(r[o++]),y=l?u(p).concat(l(p)):u(p),h=y.length,d=0;h>d;)f.call(p,a=y[d++])&&(e[a]=p[a]);return e}:n},function(t,e,r){"use strict";t.exports={"default":r(22),__esModule:!0}},function(t,e,r){"use strict";r(23),t.exports=r(15).Symbol},function(t,e,r){"use strict";var n=r(5),o=r(14),u=r(24),s=r(25),i=r(13),c=r(26),l=r(16),f=r(29),a=r(30),p=r(32),y=r(31),h=r(33),d=r(37),v=r(41),g=r(42),S=r(43),b=r(34),_=r(28),m=n.getDesc,x=n.setDesc,O=n.create,j=d.get,w=o.Symbol,F=o.JSON,k=F&&F.stringify,P=!1,M=y("_hidden"),E=n.isEnum,D=f("symbol-registry"),R=f("symbols"),N="function"==typeof w,T=Object.prototype,A=s&&l(function(){return 7!=O(x({},"a",{get:function(){return x(this,"a",{value:7}).a}})).a})?function(t,e,r){var n=m(T,e);n&&delete T[e],x(t,e,r),n&&t!==T&&x(T,e,n)}:x,I=function(t){var e=R[t]=O(w.prototype);return e._k=t,s&&P&&A(T,t,{configurable:!0,set:function(e){u(this,M)&&u(this[M],t)&&(this[M][t]=!1),A(this,t,_(1,e))}}),e},C=function(t){return"symbol"==typeof t},J=function(t,e,r){return r&&u(R,e)?(r.enumerable?(u(t,M)&&t[M][e]&&(t[M][e]=!1),r=O(r,{enumerable:_(0,!1)})):(u(t,M)||x(t,M,_(1,{})),t[M][e]=!0),A(t,e,r)):x(t,e,r)},K=function(t,e){S(t);for(var r,n=v(e=b(e)),o=0,u=n.length;u>o;)J(t,r=n[o++],e[r]);return t},W=function(t,e){return void 0===e?O(t):K(O(t),e)},B=function(t){var e=E.call(this,t);return e||!u(this,t)||!u(R,t)||u(this,M)&&this[M][t]?e:!0},G=function(t,e){var r=m(t=b(t),e);return!r||!u(R,e)||u(t,M)&&t[M][e]||(r.enumerable=!0),r},q=function(t){for(var e,r=j(b(t)),n=[],o=0;r.length>o;)u(R,e=r[o++])||e==M||n.push(e);return n},z=function(t){for(var e,r=j(b(t)),n=[],o=0;r.length>o;)u(R,e=r[o++])&&n.push(R[e]);return n},H=function(t){for(var e,r,n=[t],o=1,u=arguments;u.length>o;)n.push(u[o++]);return e=n[1],"function"==typeof e&&(r=e),(r||!g(e))&&(e=function(t,e){return r&&(e=r.call(this,t,e)),C(e)?void 0:e}),n[1]=e,k.apply(F,n)},L=l(function(){var t=w();return"[null]"!=k([t])||"{}"!=k({a:t})||"{}"!=k(Object(t))});N||(w=function(){if(C(this))throw TypeError("Symbol is not a constructor");return I(p(arguments.length>0?arguments[0]:void 0))},c(w.prototype,"toString",function(){return this._k}),C=function(t){return t instanceof w},n.create=W,n.isEnum=B,n.getDesc=G,n.setDesc=J,n.setDescs=K,n.getNames=d.get=q,n.getSymbols=z,s&&!r(45)&&c(T,"propertyIsEnumerable",B,!0));var Q={"for":function(t){return u(D,t+="")?D[t]:D[t]=w(t)},keyFor:function(t){return h(D,t)},useSetter:function(){P=!0},useSimple:function(){P=!1}};n.each.call("hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),function(t){var e=y(t);Q[t]=N?e:I(e)}),P=!0,i(i.G+i.W,{Symbol:w}),i(i.S,"Symbol",Q),i(i.S+i.F*!N,"Object",{create:W,defineProperty:J,defineProperties:K,getOwnPropertyDescriptor:G,getOwnPropertyNames:q,getOwnPropertySymbols:z}),F&&i(i.S+i.F*(!N||L),"JSON",{stringify:H}),a(w,"Symbol"),a(Math,"Math",!0),a(o.JSON,"JSON",!0)},function(t){"use strict";var e={}.hasOwnProperty;t.exports=function(t,r){return e.call(t,r)}},function(t,e,r){"use strict";t.exports=!r(16)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e,r){"use strict";t.exports=r(27)},function(t,e,r){"use strict";var n=r(5),o=r(28);t.exports=r(25)?function(t,e,r){return n.setDesc(t,e,o(1,r))}:function(t,e,r){return t[e]=r,t}},function(t){"use strict";t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,r){"use strict";var n=r(14),o="__core-js_shared__",u=n[o]||(n[o]={});t.exports=function(t){return u[t]||(u[t]={})}},function(t,e,r){"use strict";var n=r(5).setDesc,o=r(24),u=r(31)("toStringTag");t.exports=function(t,e,r){t&&!o(t=r?t:t.prototype,u)&&n(t,u,{configurable:!0,value:e})}},function(t,e,r){"use strict";var n=r(29)("wks"),o=r(14).Symbol;t.exports=function(t){return n[t]||(n[t]=o&&o[t]||(o||r(32))("Symbol."+t))}},function(t){"use strict";var e=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++e+r).toString(36))}},function(t,e,r){"use strict";var n=r(5),o=r(34);t.exports=function(t,e){for(var r,u=o(t),s=n.getKeys(u),i=s.length,c=0;i>c;)if(u[r=s[c++]]===e)return r}},function(t,e,r){"use strict";var n=r(35),o=r(11);t.exports=function(t){return n(o(t))}},function(t,e,r){"use strict";var n=r(36);t.exports=0 in Object("z")?Object:function(t){return"String"==n(t)?t.split(""):Object(t)}},function(t){"use strict";var e={}.toString;t.exports=function(t){return e.call(t).slice(8,-1)}},function(t,e,r){"use strict";var n=r(38)["default"],o={}.toString,u=r(34),s=r(5).getNames,i="object"==typeof window&&n?n(window):[],c=function(t){try{return s(t)}catch(e){return i.slice()}};t.exports.get=function(t){return i&&"[object Window]"==o.call(t)?c(t):s(u(t))}},function(t,e,r){"use strict";t.exports={"default":r(39),__esModule:!0}},function(t,e,r){"use strict";var n=r(5);r(40),t.exports=function(t){return n.getNames(t)}},function(t,e,r){"use strict";r(12)("getOwnPropertyNames",function(){return r(37).get})},function(t,e,r){"use strict";var n=r(5);t.exports=function(t){var e=n.getKeys(t),r=n.getSymbols;if(r)for(var o,u=r(t),s=n.isEnum,i=0;u.length>i;)s.call(t,o=u[i++])&&e.push(o);return e}},function(t,e,r){"use strict";var n=r(36);t.exports=Array.isArray||function(t){return"Array"==n(t)}},function(t,e,r){"use strict";var n=r(44);t.exports=function(t){if(!n(t))throw TypeError(t+" is not an object!");return t}},function(t){"use strict";t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t){"use strict";t.exports=!0},function(t,e,r){"use strict";var n=r(47)["default"];Object.defineProperty(e,"__esModule",{value:!0});var o=r(1),u=n(o);e["default"]={StyleSheet:u["default"]},t.exports=e["default"]},function(t,e){"use strict";e["default"]=function(t){return t&&t.__esModule?t:{"default":t}},e.__esModule=!0}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.sheetjs=e():t.sheetjs=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var u=n[r]={exports:{},id:r,loaded:!1};return t[r].call(u.exports,u,u.exports,e),u.loaded=!0,u.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){t.exports=n(46)},function(t,e,n){"use strict";function r(t){return!!(t&&t.constructor&&t.call&&t.apply)}function u(t){f(Object.getPrototypeOf(t)).filter(function(e){return r(t[e])}).forEach(function(e){return t[e]=t[e].bind(t)})}var o=n(2)["default"],s=n(6)["default"],i=n(7)["default"],c=n(17)["default"],f=n(38)["default"];Object.defineProperty(e,"__esModule",{value:!0});var a=0,l=function(){function t(e){s(this,t),this._instance=++a,this._styleSheet=null,this._sheet=null,this._rules=null,u(this),e&&this.setStylesForSelectors(e)}return o(t,[{key:"setStylesForSelectors",value:function(t){var e=this;return i(t).forEach(function(n){return e.setStylesForSelector(n,t[n])}),this}},{key:"setStylesForSelector",value:function(t,e){return c(this.stylesForSelector(t),e),this}},{key:"stylesForSelector",value:function(t){return this.getStylesForSelector(t)||this.createStylesForSelector(t)}},{key:"createStylesForSelector",value:function(t){var e=this._getSheet(),n=this._getRules(),r=n.length,u=t+" { }";return e.insertRule(u,r),n.item(r).style}},{key:"getStylesForSelector",value:function(t){var e=this._getRule(t);return e?e.style:void 0}},{key:"deleteStylesForSelector",value:function(t){var e=this._getSheet(),n=e.removeRule||e.deleteRule,r=this._getRuleIndex(t);return-1===r?!1:n.call(e,r)}},{key:"disable",value:function(){return this._getSheet().disabled=!0,this}},{key:"enable",value:function(){return this._getSheet().disabled=!1,this}},{key:"_getRuleIndex",value:function(t){var e=this._getRules(),n=this._getRule(t);return Array.prototype.indexOf.call(e,n)}},{key:"_getRule",value:function(t){for(var e=this._getRules(),n=e.length,r=0;n>r;r++)if(e[r].selectorText===t)return e[r];return void 0}},{key:"_getSheet",value:function(){return this._sheet||function(){return this._sheet=this._getStyleSheet().sheet}.call(this)}},{key:"_getRules",value:function(){return this._rules||function(){var t=this._getSheet();return this._rules=t.cssRules||t.rules}.call(this)}},{key:"_getStyleSheet",value:function(){return this._styleSheet||function(){var t=document.createElement("style"),e=document.head||document.getElementsByTagName("head")[0];return t.type="text/css",t.setAttribute("id","sheetjs-"+this._instance),e.appendChild(t),this._styleSheet=t}.call(this)}}]),t}();e["default"]=l,t.exports=e["default"]},function(t,e,n){"use strict";var r=n(3)["default"];e["default"]=function(){function t(t,e){for(var n=0;n<e.length;n++){var u=e[n];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),r(t,u.key,u)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),e.__esModule=!0},function(t,e,n){"use strict";t.exports={"default":n(4),__esModule:!0}},function(t,e,n){"use strict";var r=n(5);t.exports=function(t,e,n){return r.setDesc(t,e,n)}},function(t){"use strict";var e=Object;t.exports={create:e.create,getProto:e.getPrototypeOf,isEnum:{}.propertyIsEnumerable,getDesc:e.getOwnPropertyDescriptor,setDesc:e.defineProperty,setDescs:e.defineProperties,getKeys:e.keys,getNames:e.getOwnPropertyNames,getSymbols:e.getOwnPropertySymbols,each:[].forEach}},function(t,e){"use strict";e["default"]=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},e.__esModule=!0},function(t,e,n){"use strict";t.exports={"default":n(8),__esModule:!0}},function(t,e,n){"use strict";n(9),t.exports=n(15).Object.keys},function(t,e,n){"use strict";var r=n(10);n(12)("keys",function(t){return function(e){return t(r(e))}})},function(t,e,n){"use strict";var r=n(11);t.exports=function(t){return Object(r(t))}},function(t){"use strict";t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,n){"use strict";t.exports=function(t,e){var r=n(13),u=(n(15).Object||{})[t]||Object[t],o={};o[t]=e(u),r(r.S+r.F*n(16)(function(){u(1)}),"Object",o)}},function(t,e,n){"use strict";var r=n(14),u=n(15),o="prototype",s=function(t,e){return function(){return t.apply(e,arguments)}},i=function c(t,e,n){var i,f,a,l,p=t&c.G,y=t&c.P,h=p?r:t&c.S?r[e]:(r[e]||{})[o],d=p?u:u[e]||(u[e]={});p&&(n=e);for(i in n)f=!(t&c.F)&&h&&i in h,f&&i in d||(a=f?h[i]:n[i],p&&"function"!=typeof h[i]?l=n[i]:t&c.B&&f?l=s(a,r):t&c.W&&h[i]==a?!function(t){l=function(e){return this instanceof t?new t(e):t(e)},l[o]=t[o]}(a):l=y&&"function"==typeof a?s(Function.call,a):a,d[i]=l,y&&((d[o]||(d[o]={}))[i]=a))};i.F=1,i.G=2,i.S=4,i.P=8,i.B=16,i.W=32,t.exports=i},function(t){"use strict";var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)},function(t){"use strict";var e=t.exports={version:"1.2.2"};"number"==typeof __e&&(__e=e)},function(t){"use strict";t.exports=function(t){try{return!!t()}catch(e){return!0}}},function(t,e,n){"use strict";t.exports={"default":n(18),__esModule:!0}},function(t,e,n){"use strict";n(19),t.exports=n(15).Object.assign},function(t,e,n){"use strict";var r=n(13);r(r.S+r.F,"Object",{assign:n(20)})},function(t,e,n){"use strict";var r=n(17)["default"],u=n(21)["default"],o=n(7)["default"],s=n(5),i=n(10),c=n(35);t.exports=n(16)(function(){var t=r,e={},n={},s=u(),i="abcdefghijklmnopqrst";return e[s]=7,i.split("").forEach(function(t){n[t]=t}),7!=t({},e)[s]||o(t({},n)).join("")!=i})?function(t){for(var e=i(t),n=arguments,r=n.length,u=1,o=s.getKeys,f=s.getSymbols,a=s.isEnum;r>u;)for(var l,p=c(n[u++]),y=f?o(p).concat(f(p)):o(p),h=y.length,d=0;h>d;)a.call(p,l=y[d++])&&(e[l]=p[l]);return e}:r},function(t,e,n){"use strict";t.exports={"default":n(22),__esModule:!0}},function(t,e,n){"use strict";n(23),t.exports=n(15).Symbol},function(t,e,n){"use strict";var r=n(5),u=n(14),o=n(24),s=n(25),i=n(13),c=n(26),f=n(16),a=n(29),l=n(30),p=n(32),y=n(31),h=n(33),d=n(37),g=n(41),v=n(42),S=n(43),b=n(34),_=n(28),m=r.getDesc,x=r.setDesc,O=r.create,j=d.get,w=u.Symbol,k=u.JSON,P=k&&k.stringify,F=!1,M=y("_hidden"),E=r.isEnum,D=a("symbol-registry"),R=a("symbols"),N="function"==typeof w,T=Object.prototype,A=s&&f(function(){return 7!=O(x({},"a",{get:function(){return x(this,"a",{value:7}).a}})).a})?function(t,e,n){var r=m(T,e);r&&delete T[e],x(t,e,n),r&&t!==T&&x(T,e,r)}:x,I=function(t){var e=R[t]=O(w.prototype);return e._k=t,s&&F&&A(T,t,{configurable:!0,set:function(e){o(this,M)&&o(this[M],t)&&(this[M][t]=!1),A(this,t,_(1,e))}}),e},C=function(t){return"symbol"==typeof t},J=function(t,e,n){return n&&o(R,e)?(n.enumerable?(o(t,M)&&t[M][e]&&(t[M][e]=!1),n=O(n,{enumerable:_(0,!1)})):(o(t,M)||x(t,M,_(1,{})),t[M][e]=!0),A(t,e,n)):x(t,e,n)},K=function(t,e){S(t);for(var n,r=g(e=b(e)),u=0,o=r.length;o>u;)J(t,n=r[u++],e[n]);return t},W=function(t,e){return void 0===e?O(t):K(O(t),e)},B=function(t){var e=E.call(this,t);return e||!o(this,t)||!o(R,t)||o(this,M)&&this[M][t]?e:!0},G=function(t,e){var n=m(t=b(t),e);return!n||!o(R,e)||o(t,M)&&t[M][e]||(n.enumerable=!0),n},q=function(t){for(var e,n=j(b(t)),r=[],u=0;n.length>u;)o(R,e=n[u++])||e==M||r.push(e);return r},z=function(t){for(var e,n=j(b(t)),r=[],u=0;n.length>u;)o(R,e=n[u++])&&r.push(R[e]);return r},H=function(t){for(var e,n,r=[t],u=1,o=arguments;o.length>u;)r.push(o[u++]);return e=r[1],"function"==typeof e&&(n=e),(n||!v(e))&&(e=function(t,e){return n&&(e=n.call(this,t,e)),C(e)?void 0:e}),r[1]=e,P.apply(k,r)},L=f(function(){var t=w();return"[null]"!=P([t])||"{}"!=P({a:t})||"{}"!=P(Object(t))});N||(w=function(){if(C(this))throw TypeError("Symbol is not a constructor");return I(p(arguments.length>0?arguments[0]:void 0))},c(w.prototype,"toString",function(){return this._k}),C=function(t){return t instanceof w},r.create=W,r.isEnum=B,r.getDesc=G,r.setDesc=J,r.setDescs=K,r.getNames=d.get=q,r.getSymbols=z,s&&!n(45)&&c(T,"propertyIsEnumerable",B,!0));var Q={"for":function(t){return o(D,t+="")?D[t]:D[t]=w(t)},keyFor:function(t){return h(D,t)},useSetter:function(){F=!0},useSimple:function(){F=!1}};r.each.call("hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),function(t){var e=y(t);Q[t]=N?e:I(e)}),F=!0,i(i.G+i.W,{Symbol:w}),i(i.S,"Symbol",Q),i(i.S+i.F*!N,"Object",{create:W,defineProperty:J,defineProperties:K,getOwnPropertyDescriptor:G,getOwnPropertyNames:q,getOwnPropertySymbols:z}),k&&i(i.S+i.F*(!N||L),"JSON",{stringify:H}),l(w,"Symbol"),l(Math,"Math",!0),l(u.JSON,"JSON",!0)},function(t){"use strict";var e={}.hasOwnProperty;t.exports=function(t,n){return e.call(t,n)}},function(t,e,n){"use strict";t.exports=!n(16)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e,n){"use strict";t.exports=n(27)},function(t,e,n){"use strict";var r=n(5),u=n(28);t.exports=n(25)?function(t,e,n){return r.setDesc(t,e,u(1,n))}:function(t,e,n){return t[e]=n,t}},function(t){"use strict";t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,n){"use strict";var r=n(14),u="__core-js_shared__",o=r[u]||(r[u]={});t.exports=function(t){return o[t]||(o[t]={})}},function(t,e,n){"use strict";var r=n(5).setDesc,u=n(24),o=n(31)("toStringTag");t.exports=function(t,e,n){t&&!u(t=n?t:t.prototype,o)&&r(t,o,{configurable:!0,value:e})}},function(t,e,n){"use strict";var r=n(29)("wks"),u=n(14).Symbol;t.exports=function(t){return r[t]||(r[t]=u&&u[t]||(u||n(32))("Symbol."+t))}},function(t){"use strict";var e=0,n=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++e+n).toString(36))}},function(t,e,n){"use strict";var r=n(5),u=n(34);t.exports=function(t,e){for(var n,o=u(t),s=r.getKeys(o),i=s.length,c=0;i>c;)if(o[n=s[c++]]===e)return n}},function(t,e,n){"use strict";var r=n(35),u=n(11);t.exports=function(t){return r(u(t))}},function(t,e,n){"use strict";var r=n(36);t.exports=0 in Object("z")?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},function(t){"use strict";var e={}.toString;t.exports=function(t){return e.call(t).slice(8,-1)}},function(t,e,n){"use strict";var r=n(38)["default"],u={}.toString,o=n(34),s=n(5).getNames,i="object"==typeof window&&r?r(window):[],c=function(t){try{return s(t)}catch(e){return i.slice()}};t.exports.get=function(t){return i&&"[object Window]"==u.call(t)?c(t):s(o(t))}},function(t,e,n){"use strict";t.exports={"default":n(39),__esModule:!0}},function(t,e,n){"use strict";var r=n(5);n(40),t.exports=function(t){return r.getNames(t)}},function(t,e,n){"use strict";n(12)("getOwnPropertyNames",function(){return n(37).get})},function(t,e,n){"use strict";var r=n(5);t.exports=function(t){var e=r.getKeys(t),n=r.getSymbols;if(n)for(var u,o=n(t),s=r.isEnum,i=0;o.length>i;)s.call(t,u=o[i++])&&e.push(u);return e}},function(t,e,n){"use strict";var r=n(36);t.exports=Array.isArray||function(t){return"Array"==r(t)}},function(t,e,n){"use strict";var r=n(44);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t){"use strict";t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t){"use strict";t.exports=!0},function(t,e,n){"use strict";var r=n(47)["default"];Object.defineProperty(e,"__esModule",{value:!0});var u=n(1),o=r(u);e["default"]={StyleSheet:o["default"]},t.exports=e["default"]},function(t,e){"use strict";e["default"]=function(t){return t&&t.__esModule?t:{"default":t}},e.__esModule=!0}])}); |
@@ -64,16 +64,2 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
// // CSSStyleSheet: | ||
// { | ||
// // CSSRuleList | ||
// rules: [ | ||
// // CSSStyleRule: | ||
// { | ||
// // CSSStyleDeclaration: | ||
// style: { | ||
// backgroundColor: 'red' | ||
// } | ||
// } | ||
// ] | ||
// } | ||
'use strict'; | ||
@@ -89,5 +75,12 @@ | ||
var _interopRequireDefault = __webpack_require__(46)['default']; | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
var _utilsBindAll = __webpack_require__(47); | ||
var _utilsBindAll2 = _interopRequireDefault(_utilsBindAll); | ||
var instanceCount = 0; | ||
@@ -99,12 +92,9 @@ | ||
this._instance = instanceCount++; | ||
this._styleSheet = null; | ||
this._instance = ++instanceCount; | ||
this._element = null; | ||
this._sheet = null; | ||
this._rules = null; | ||
this._deleteRule = null; | ||
// bind context of public methods | ||
var self = this; | ||
['setStylesForSelectors', 'setStylesForSelector', 'stylesForSelector', 'createStylesForSelector', 'getStylesForSelector', 'deleteStylesForSelector', 'disable', 'enable'].forEach(function (method) { | ||
return self[method] = self[method].bind(self); | ||
}); | ||
(0, _utilsBindAll2['default'])(this); | ||
@@ -116,2 +106,19 @@ if (stylesBySelector) { | ||
// 'style' dom element property reference | ||
// { | ||
// // CSSStyleSheet | ||
// sheet: { | ||
// // CSSRuleList | ||
// rules: [ | ||
// // CSSStyleRule | ||
// { | ||
// // CSSStyleDeclaration | ||
// style: { | ||
// backgroundColor: 'red' | ||
// } | ||
// } | ||
// ] | ||
// } | ||
// } | ||
_createClass(StyleSheet, [{ | ||
@@ -162,7 +169,6 @@ key: 'setStylesForSelectors', | ||
value: function deleteStylesForSelector(selector) { | ||
var sheet = this._getSheet(); | ||
var deleteRule = sheet.removeRule || sheet.deleteRule; | ||
var deleteRule = this._getDeleteRule(); | ||
var ruleIndex = this._getRuleIndex(selector); | ||
return ruleIndex === -1 ? false : deleteRule.call(sheet, ruleIndex); | ||
return ruleIndex === -1 ? false : deleteRule(ruleIndex); | ||
} | ||
@@ -182,2 +188,10 @@ }, { | ||
}, { | ||
key: '_getDeleteRule', | ||
value: function _getDeleteRule() { | ||
return this._deleteRule || (function () { | ||
var sheet = this._getSheet(); | ||
return this._deleteRule = (sheet.removeRule || sheet.deleteRule).bind(sheet); | ||
}).call(this); | ||
} | ||
}, { | ||
key: '_getRuleIndex', | ||
@@ -206,9 +220,2 @@ value: function _getRuleIndex(selector) { | ||
}, { | ||
key: '_getSheet', | ||
value: function _getSheet() { | ||
return this._sheet || (function () { | ||
return this._sheet = this._getStylesForSelectorsheet().sheet; | ||
}).call(this); | ||
} | ||
}, { | ||
key: '_getRules', | ||
@@ -222,11 +229,18 @@ value: function _getRules() { | ||
}, { | ||
key: '_getStylesForSelectorsheet', | ||
value: function _getStylesForSelectorsheet() { | ||
return this._styleSheet || (function () { | ||
var style = document.createElement('style'); | ||
key: '_getSheet', | ||
value: function _getSheet() { | ||
return this._sheet || (function () { | ||
return this._sheet = this._getElement().sheet; | ||
}).call(this); | ||
} | ||
}, { | ||
key: '_getElement', | ||
value: function _getElement() { | ||
return this._element || (function () { | ||
var styleSheet = document.createElement('style'); | ||
var head = document.head || document.getElementsByTagName('head')[0]; | ||
style.type = 'text/css'; | ||
style.setAttribute('id', 'sheetjs-' + this._instance); | ||
head.appendChild(style); | ||
return this._styleSheet = style; | ||
styleSheet.type = 'text/css'; | ||
styleSheet.setAttribute('id', 'sheetjs-' + this._instance); | ||
head.appendChild(styleSheet); | ||
return this._element = styleSheet; | ||
}).call(this); | ||
@@ -1100,2 +1114,62 @@ } | ||
/***/ }, | ||
/* 46 */ | ||
/***/ function(module, exports) { | ||
"use strict"; | ||
exports["default"] = function (obj) { | ||
return obj && obj.__esModule ? obj : { | ||
"default": obj | ||
}; | ||
}; | ||
exports.__esModule = true; | ||
/***/ }, | ||
/* 47 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
'use strict'; | ||
var _Object$getOwnPropertyNames = __webpack_require__(38)['default']; | ||
var _interopRequireDefault = __webpack_require__(46)['default']; | ||
Object.defineProperty(exports, '__esModule', { | ||
value: true | ||
}); | ||
exports['default'] = bindAll; | ||
var _isFunction = __webpack_require__(48); | ||
var _isFunction2 = _interopRequireDefault(_isFunction); | ||
function bindAll(obj) { | ||
_Object$getOwnPropertyNames(Object.getPrototypeOf(obj)).filter(function (key) { | ||
return (0, _isFunction2['default'])(obj[key]); | ||
}).forEach(function (method) { | ||
return obj[method] = obj[method].bind(obj); | ||
}); | ||
} | ||
module.exports = exports['default']; | ||
/***/ }, | ||
/* 48 */ | ||
/***/ function(module, exports) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = isFunction; | ||
function isFunction(obj) { | ||
return !!(obj && obj.constructor && obj.call && obj.apply); | ||
} | ||
module.exports = exports["default"]; | ||
/***/ } | ||
@@ -1102,0 +1176,0 @@ /******/ ]) |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.StyleSheet=e():t.StyleSheet=e()}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){t.exports=r(1)},function(t,e,r){"use strict";var n=r(2)["default"],o=r(6)["default"],u=r(7)["default"],s=r(17)["default"];Object.defineProperty(e,"__esModule",{value:!0});var i=0,c=function(){function t(e){o(this,t),this._instance=i++,this._styleSheet=null,this._sheet=null,this._rules=null;var r=this;["setStylesForSelectors","setStylesForSelector","stylesForSelector","createStylesForSelector","getStylesForSelector","deleteStylesForSelector","disable","enable"].forEach(function(t){return r[t]=r[t].bind(r)}),e&&this.setStylesForSelectors(e)}return n(t,[{key:"setStylesForSelectors",value:function(t){var e=this;return u(t).forEach(function(r){return e.setStylesForSelector(r,t[r])}),this}},{key:"setStylesForSelector",value:function(t,e){return s(this.stylesForSelector(t),e),this}},{key:"stylesForSelector",value:function(t){return this.getStylesForSelector(t)||this.createStylesForSelector(t)}},{key:"createStylesForSelector",value:function(t){var e=this._getSheet(),r=this._getRules(),n=r.length,o=t+" { }";return e.insertRule(o,n),r.item(n).style}},{key:"getStylesForSelector",value:function(t){var e=this._getRule(t);return e?e.style:void 0}},{key:"deleteStylesForSelector",value:function(t){var e=this._getSheet(),r=e.removeRule||e.deleteRule,n=this._getRuleIndex(t);return-1===n?!1:r.call(e,n)}},{key:"disable",value:function(){return this._getSheet().disabled=!0,this}},{key:"enable",value:function(){return this._getSheet().disabled=!1,this}},{key:"_getRuleIndex",value:function(t){var e=this._getRules(),r=this._getRule(t);return Array.prototype.indexOf.call(e,r)}},{key:"_getRule",value:function(t){for(var e=this._getRules(),r=e.length,n=0;r>n;n++)if(e[n].selectorText===t)return e[n];return void 0}},{key:"_getSheet",value:function(){return this._sheet||function(){return this._sheet=this._getStylesForSelectorsheet().sheet}.call(this)}},{key:"_getRules",value:function(){return this._rules||function(){var t=this._getSheet();return this._rules=t.cssRules||t.rules}.call(this)}},{key:"_getStylesForSelectorsheet",value:function(){return this._styleSheet||function(){var t=document.createElement("style"),e=document.head||document.getElementsByTagName("head")[0];return t.type="text/css",t.setAttribute("id","sheetjs-"+this._instance),e.appendChild(t),this._styleSheet=t}.call(this)}}]),t}();e["default"]=c,t.exports=e["default"]},function(t,e,r){"use strict";var n=r(3)["default"];e["default"]=function(){function t(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),n(t,o.key,o)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),e.__esModule=!0},function(t,e,r){"use strict";t.exports={"default":r(4),__esModule:!0}},function(t,e,r){"use strict";var n=r(5);t.exports=function(t,e,r){return n.setDesc(t,e,r)}},function(t){"use strict";var e=Object;t.exports={create:e.create,getProto:e.getPrototypeOf,isEnum:{}.propertyIsEnumerable,getDesc:e.getOwnPropertyDescriptor,setDesc:e.defineProperty,setDescs:e.defineProperties,getKeys:e.keys,getNames:e.getOwnPropertyNames,getSymbols:e.getOwnPropertySymbols,each:[].forEach}},function(t,e){"use strict";e["default"]=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},e.__esModule=!0},function(t,e,r){"use strict";t.exports={"default":r(8),__esModule:!0}},function(t,e,r){"use strict";r(9),t.exports=r(15).Object.keys},function(t,e,r){"use strict";var n=r(10);r(12)("keys",function(t){return function(e){return t(n(e))}})},function(t,e,r){"use strict";var n=r(11);t.exports=function(t){return Object(n(t))}},function(t){"use strict";t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,r){"use strict";t.exports=function(t,e){var n=r(13),o=(r(15).Object||{})[t]||Object[t],u={};u[t]=e(o),n(n.S+n.F*r(16)(function(){o(1)}),"Object",u)}},function(t,e,r){"use strict";var n=r(14),o=r(15),u="prototype",s=function(t,e){return function(){return t.apply(e,arguments)}},i=function c(t,e,r){var i,l,f,a,p=t&c.G,y=t&c.P,h=p?n:t&c.S?n[e]:(n[e]||{})[u],g=p?o:o[e]||(o[e]={});p&&(r=e);for(i in r)l=!(t&c.F)&&h&&i in h,l&&i in g||(f=l?h[i]:r[i],p&&"function"!=typeof h[i]?a=r[i]:t&c.B&&l?a=s(f,n):t&c.W&&h[i]==f?!function(t){a=function(e){return this instanceof t?new t(e):t(e)},a[u]=t[u]}(f):a=y&&"function"==typeof f?s(Function.call,f):f,g[i]=a,y&&((g[u]||(g[u]={}))[i]=f))};i.F=1,i.G=2,i.S=4,i.P=8,i.B=16,i.W=32,t.exports=i},function(t){"use strict";var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)},function(t){"use strict";var e=t.exports={version:"1.2.2"};"number"==typeof __e&&(__e=e)},function(t){"use strict";t.exports=function(t){try{return!!t()}catch(e){return!0}}},function(t,e,r){"use strict";t.exports={"default":r(18),__esModule:!0}},function(t,e,r){"use strict";r(19),t.exports=r(15).Object.assign},function(t,e,r){"use strict";var n=r(13);n(n.S+n.F,"Object",{assign:r(20)})},function(t,e,r){"use strict";var n=r(17)["default"],o=r(21)["default"],u=r(7)["default"],s=r(5),i=r(10),c=r(35);t.exports=r(16)(function(){var t=n,e={},r={},s=o(),i="abcdefghijklmnopqrst";return e[s]=7,i.split("").forEach(function(t){r[t]=t}),7!=t({},e)[s]||u(t({},r)).join("")!=i})?function(t){for(var e=i(t),r=arguments,n=r.length,o=1,u=s.getKeys,l=s.getSymbols,f=s.isEnum;n>o;)for(var a,p=c(r[o++]),y=l?u(p).concat(l(p)):u(p),h=y.length,g=0;h>g;)f.call(p,a=y[g++])&&(e[a]=p[a]);return e}:n},function(t,e,r){"use strict";t.exports={"default":r(22),__esModule:!0}},function(t,e,r){"use strict";r(23),t.exports=r(15).Symbol},function(t,e,r){"use strict";var n=r(5),o=r(14),u=r(24),s=r(25),i=r(13),c=r(26),l=r(16),f=r(29),a=r(30),p=r(32),y=r(31),h=r(33),g=r(37),d=r(41),v=r(42),S=r(43),b=r(34),m=r(28),_=n.getDesc,x=n.setDesc,O=n.create,w=g.get,F=o.Symbol,j=o.JSON,k=j&&j.stringify,P=!1,E=y("_hidden"),M=n.isEnum,D=f("symbol-registry"),R=f("symbols"),N="function"==typeof F,T=Object.prototype,A=s&&l(function(){return 7!=O(x({},"a",{get:function(){return x(this,"a",{value:7}).a}})).a})?function(t,e,r){var n=_(T,e);n&&delete T[e],x(t,e,r),n&&t!==T&&x(T,e,n)}:x,I=function(t){var e=R[t]=O(F.prototype);return e._k=t,s&&P&&A(T,t,{configurable:!0,set:function(e){u(this,E)&&u(this[E],t)&&(this[E][t]=!1),A(this,t,m(1,e))}}),e},C=function(t){return"symbol"==typeof t},J=function(t,e,r){return r&&u(R,e)?(r.enumerable?(u(t,E)&&t[E][e]&&(t[E][e]=!1),r=O(r,{enumerable:m(0,!1)})):(u(t,E)||x(t,E,m(1,{})),t[E][e]=!0),A(t,e,r)):x(t,e,r)},K=function(t,e){S(t);for(var r,n=d(e=b(e)),o=0,u=n.length;u>o;)J(t,r=n[o++],e[r]);return t},W=function(t,e){return void 0===e?O(t):K(O(t),e)},B=function(t){var e=M.call(this,t);return e||!u(this,t)||!u(R,t)||u(this,E)&&this[E][t]?e:!0},G=function(t,e){var r=_(t=b(t),e);return!r||!u(R,e)||u(t,E)&&t[E][e]||(r.enumerable=!0),r},q=function(t){for(var e,r=w(b(t)),n=[],o=0;r.length>o;)u(R,e=r[o++])||e==E||n.push(e);return n},z=function(t){for(var e,r=w(b(t)),n=[],o=0;r.length>o;)u(R,e=r[o++])&&n.push(R[e]);return n},H=function(t){for(var e,r,n=[t],o=1,u=arguments;u.length>o;)n.push(u[o++]);return e=n[1],"function"==typeof e&&(r=e),(r||!v(e))&&(e=function(t,e){return r&&(e=r.call(this,t,e)),C(e)?void 0:e}),n[1]=e,k.apply(j,n)},L=l(function(){var t=F();return"[null]"!=k([t])||"{}"!=k({a:t})||"{}"!=k(Object(t))});N||(F=function(){if(C(this))throw TypeError("Symbol is not a constructor");return I(p(arguments.length>0?arguments[0]:void 0))},c(F.prototype,"toString",function(){return this._k}),C=function(t){return t instanceof F},n.create=W,n.isEnum=B,n.getDesc=G,n.setDesc=J,n.setDescs=K,n.getNames=g.get=q,n.getSymbols=z,s&&!r(45)&&c(T,"propertyIsEnumerable",B,!0));var Q={"for":function(t){return u(D,t+="")?D[t]:D[t]=F(t)},keyFor:function(t){return h(D,t)},useSetter:function(){P=!0},useSimple:function(){P=!1}};n.each.call("hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),function(t){var e=y(t);Q[t]=N?e:I(e)}),P=!0,i(i.G+i.W,{Symbol:F}),i(i.S,"Symbol",Q),i(i.S+i.F*!N,"Object",{create:W,defineProperty:J,defineProperties:K,getOwnPropertyDescriptor:G,getOwnPropertyNames:q,getOwnPropertySymbols:z}),j&&i(i.S+i.F*(!N||L),"JSON",{stringify:H}),a(F,"Symbol"),a(Math,"Math",!0),a(o.JSON,"JSON",!0)},function(t){"use strict";var e={}.hasOwnProperty;t.exports=function(t,r){return e.call(t,r)}},function(t,e,r){"use strict";t.exports=!r(16)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e,r){"use strict";t.exports=r(27)},function(t,e,r){"use strict";var n=r(5),o=r(28);t.exports=r(25)?function(t,e,r){return n.setDesc(t,e,o(1,r))}:function(t,e,r){return t[e]=r,t}},function(t){"use strict";t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,r){"use strict";var n=r(14),o="__core-js_shared__",u=n[o]||(n[o]={});t.exports=function(t){return u[t]||(u[t]={})}},function(t,e,r){"use strict";var n=r(5).setDesc,o=r(24),u=r(31)("toStringTag");t.exports=function(t,e,r){t&&!o(t=r?t:t.prototype,u)&&n(t,u,{configurable:!0,value:e})}},function(t,e,r){"use strict";var n=r(29)("wks"),o=r(14).Symbol;t.exports=function(t){return n[t]||(n[t]=o&&o[t]||(o||r(32))("Symbol."+t))}},function(t){"use strict";var e=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++e+r).toString(36))}},function(t,e,r){"use strict";var n=r(5),o=r(34);t.exports=function(t,e){for(var r,u=o(t),s=n.getKeys(u),i=s.length,c=0;i>c;)if(u[r=s[c++]]===e)return r}},function(t,e,r){"use strict";var n=r(35),o=r(11);t.exports=function(t){return n(o(t))}},function(t,e,r){"use strict";var n=r(36);t.exports=0 in Object("z")?Object:function(t){return"String"==n(t)?t.split(""):Object(t)}},function(t){"use strict";var e={}.toString;t.exports=function(t){return e.call(t).slice(8,-1)}},function(t,e,r){"use strict";var n=r(38)["default"],o={}.toString,u=r(34),s=r(5).getNames,i="object"==typeof window&&n?n(window):[],c=function(t){try{return s(t)}catch(e){return i.slice()}};t.exports.get=function(t){return i&&"[object Window]"==o.call(t)?c(t):s(u(t))}},function(t,e,r){"use strict";t.exports={"default":r(39),__esModule:!0}},function(t,e,r){"use strict";var n=r(5);r(40),t.exports=function(t){return n.getNames(t)}},function(t,e,r){"use strict";r(12)("getOwnPropertyNames",function(){return r(37).get})},function(t,e,r){"use strict";var n=r(5);t.exports=function(t){var e=n.getKeys(t),r=n.getSymbols;if(r)for(var o,u=r(t),s=n.isEnum,i=0;u.length>i;)s.call(t,o=u[i++])&&e.push(o);return e}},function(t,e,r){"use strict";var n=r(36);t.exports=Array.isArray||function(t){return"Array"==n(t)}},function(t,e,r){"use strict";var n=r(44);t.exports=function(t){if(!n(t))throw TypeError(t+" is not an object!");return t}},function(t){"use strict";t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t){"use strict";t.exports=!0}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.StyleSheet=e():t.StyleSheet=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){t.exports=n(1)},function(t,e,n){"use strict";function r(t){return!!(t&&t.constructor&&t.call&&t.apply)}function o(t){f(Object.getPrototypeOf(t)).filter(function(e){return r(t[e])}).forEach(function(e){return t[e]=t[e].bind(t)})}var u=n(2)["default"],s=n(6)["default"],i=n(7)["default"],c=n(17)["default"],f=n(38)["default"];Object.defineProperty(e,"__esModule",{value:!0});var a=0,l=function(){function t(e){s(this,t),this._instance=++a,this._styleSheet=null,this._sheet=null,this._rules=null,o(this),e&&this.setStylesForSelectors(e)}return u(t,[{key:"setStylesForSelectors",value:function(t){var e=this;return i(t).forEach(function(n){return e.setStylesForSelector(n,t[n])}),this}},{key:"setStylesForSelector",value:function(t,e){return c(this.stylesForSelector(t),e),this}},{key:"stylesForSelector",value:function(t){return this.getStylesForSelector(t)||this.createStylesForSelector(t)}},{key:"createStylesForSelector",value:function(t){var e=this._getSheet(),n=this._getRules(),r=n.length,o=t+" { }";return e.insertRule(o,r),n.item(r).style}},{key:"getStylesForSelector",value:function(t){var e=this._getRule(t);return e?e.style:void 0}},{key:"deleteStylesForSelector",value:function(t){var e=this._getSheet(),n=e.removeRule||e.deleteRule,r=this._getRuleIndex(t);return-1===r?!1:n.call(e,r)}},{key:"disable",value:function(){return this._getSheet().disabled=!0,this}},{key:"enable",value:function(){return this._getSheet().disabled=!1,this}},{key:"_getRuleIndex",value:function(t){var e=this._getRules(),n=this._getRule(t);return Array.prototype.indexOf.call(e,n)}},{key:"_getRule",value:function(t){for(var e=this._getRules(),n=e.length,r=0;n>r;r++)if(e[r].selectorText===t)return e[r];return void 0}},{key:"_getSheet",value:function(){return this._sheet||function(){return this._sheet=this._getStyleSheet().sheet}.call(this)}},{key:"_getRules",value:function(){return this._rules||function(){var t=this._getSheet();return this._rules=t.cssRules||t.rules}.call(this)}},{key:"_getStyleSheet",value:function(){return this._styleSheet||function(){var t=document.createElement("style"),e=document.head||document.getElementsByTagName("head")[0];return t.type="text/css",t.setAttribute("id","sheetjs-"+this._instance),e.appendChild(t),this._styleSheet=t}.call(this)}}]),t}();e["default"]=l,t.exports=e["default"]},function(t,e,n){"use strict";var r=n(3)["default"];e["default"]=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),r(t,o.key,o)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),e.__esModule=!0},function(t,e,n){"use strict";t.exports={"default":n(4),__esModule:!0}},function(t,e,n){"use strict";var r=n(5);t.exports=function(t,e,n){return r.setDesc(t,e,n)}},function(t){"use strict";var e=Object;t.exports={create:e.create,getProto:e.getPrototypeOf,isEnum:{}.propertyIsEnumerable,getDesc:e.getOwnPropertyDescriptor,setDesc:e.defineProperty,setDescs:e.defineProperties,getKeys:e.keys,getNames:e.getOwnPropertyNames,getSymbols:e.getOwnPropertySymbols,each:[].forEach}},function(t,e){"use strict";e["default"]=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},e.__esModule=!0},function(t,e,n){"use strict";t.exports={"default":n(8),__esModule:!0}},function(t,e,n){"use strict";n(9),t.exports=n(15).Object.keys},function(t,e,n){"use strict";var r=n(10);n(12)("keys",function(t){return function(e){return t(r(e))}})},function(t,e,n){"use strict";var r=n(11);t.exports=function(t){return Object(r(t))}},function(t){"use strict";t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,n){"use strict";t.exports=function(t,e){var r=n(13),o=(n(15).Object||{})[t]||Object[t],u={};u[t]=e(o),r(r.S+r.F*n(16)(function(){o(1)}),"Object",u)}},function(t,e,n){"use strict";var r=n(14),o=n(15),u="prototype",s=function(t,e){return function(){return t.apply(e,arguments)}},i=function c(t,e,n){var i,f,a,l,p=t&c.G,y=t&c.P,h=p?r:t&c.S?r[e]:(r[e]||{})[u],g=p?o:o[e]||(o[e]={});p&&(n=e);for(i in n)f=!(t&c.F)&&h&&i in h,f&&i in g||(a=f?h[i]:n[i],p&&"function"!=typeof h[i]?l=n[i]:t&c.B&&f?l=s(a,r):t&c.W&&h[i]==a?!function(t){l=function(e){return this instanceof t?new t(e):t(e)},l[u]=t[u]}(a):l=y&&"function"==typeof a?s(Function.call,a):a,g[i]=l,y&&((g[u]||(g[u]={}))[i]=a))};i.F=1,i.G=2,i.S=4,i.P=8,i.B=16,i.W=32,t.exports=i},function(t){"use strict";var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)},function(t){"use strict";var e=t.exports={version:"1.2.2"};"number"==typeof __e&&(__e=e)},function(t){"use strict";t.exports=function(t){try{return!!t()}catch(e){return!0}}},function(t,e,n){"use strict";t.exports={"default":n(18),__esModule:!0}},function(t,e,n){"use strict";n(19),t.exports=n(15).Object.assign},function(t,e,n){"use strict";var r=n(13);r(r.S+r.F,"Object",{assign:n(20)})},function(t,e,n){"use strict";var r=n(17)["default"],o=n(21)["default"],u=n(7)["default"],s=n(5),i=n(10),c=n(35);t.exports=n(16)(function(){var t=r,e={},n={},s=o(),i="abcdefghijklmnopqrst";return e[s]=7,i.split("").forEach(function(t){n[t]=t}),7!=t({},e)[s]||u(t({},n)).join("")!=i})?function(t){for(var e=i(t),n=arguments,r=n.length,o=1,u=s.getKeys,f=s.getSymbols,a=s.isEnum;r>o;)for(var l,p=c(n[o++]),y=f?u(p).concat(f(p)):u(p),h=y.length,g=0;h>g;)a.call(p,l=y[g++])&&(e[l]=p[l]);return e}:r},function(t,e,n){"use strict";t.exports={"default":n(22),__esModule:!0}},function(t,e,n){"use strict";n(23),t.exports=n(15).Symbol},function(t,e,n){"use strict";var r=n(5),o=n(14),u=n(24),s=n(25),i=n(13),c=n(26),f=n(16),a=n(29),l=n(30),p=n(32),y=n(31),h=n(33),g=n(37),d=n(41),v=n(42),S=n(43),b=n(34),m=n(28),_=r.getDesc,x=r.setDesc,O=r.create,j=g.get,w=o.Symbol,k=o.JSON,F=k&&k.stringify,P=!1,E=y("_hidden"),M=r.isEnum,D=a("symbol-registry"),R=a("symbols"),N="function"==typeof w,T=Object.prototype,A=s&&f(function(){return 7!=O(x({},"a",{get:function(){return x(this,"a",{value:7}).a}})).a})?function(t,e,n){var r=_(T,e);r&&delete T[e],x(t,e,n),r&&t!==T&&x(T,e,r)}:x,I=function(t){var e=R[t]=O(w.prototype);return e._k=t,s&&P&&A(T,t,{configurable:!0,set:function(e){u(this,E)&&u(this[E],t)&&(this[E][t]=!1),A(this,t,m(1,e))}}),e},C=function(t){return"symbol"==typeof t},J=function(t,e,n){return n&&u(R,e)?(n.enumerable?(u(t,E)&&t[E][e]&&(t[E][e]=!1),n=O(n,{enumerable:m(0,!1)})):(u(t,E)||x(t,E,m(1,{})),t[E][e]=!0),A(t,e,n)):x(t,e,n)},K=function(t,e){S(t);for(var n,r=d(e=b(e)),o=0,u=r.length;u>o;)J(t,n=r[o++],e[n]);return t},W=function(t,e){return void 0===e?O(t):K(O(t),e)},B=function(t){var e=M.call(this,t);return e||!u(this,t)||!u(R,t)||u(this,E)&&this[E][t]?e:!0},G=function(t,e){var n=_(t=b(t),e);return!n||!u(R,e)||u(t,E)&&t[E][e]||(n.enumerable=!0),n},q=function(t){for(var e,n=j(b(t)),r=[],o=0;n.length>o;)u(R,e=n[o++])||e==E||r.push(e);return r},z=function(t){for(var e,n=j(b(t)),r=[],o=0;n.length>o;)u(R,e=n[o++])&&r.push(R[e]);return r},H=function(t){for(var e,n,r=[t],o=1,u=arguments;u.length>o;)r.push(u[o++]);return e=r[1],"function"==typeof e&&(n=e),(n||!v(e))&&(e=function(t,e){return n&&(e=n.call(this,t,e)),C(e)?void 0:e}),r[1]=e,F.apply(k,r)},L=f(function(){var t=w();return"[null]"!=F([t])||"{}"!=F({a:t})||"{}"!=F(Object(t))});N||(w=function(){if(C(this))throw TypeError("Symbol is not a constructor");return I(p(arguments.length>0?arguments[0]:void 0))},c(w.prototype,"toString",function(){return this._k}),C=function(t){return t instanceof w},r.create=W,r.isEnum=B,r.getDesc=G,r.setDesc=J,r.setDescs=K,r.getNames=g.get=q,r.getSymbols=z,s&&!n(45)&&c(T,"propertyIsEnumerable",B,!0));var Q={"for":function(t){return u(D,t+="")?D[t]:D[t]=w(t)},keyFor:function(t){return h(D,t)},useSetter:function(){P=!0},useSimple:function(){P=!1}};r.each.call("hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),function(t){var e=y(t);Q[t]=N?e:I(e)}),P=!0,i(i.G+i.W,{Symbol:w}),i(i.S,"Symbol",Q),i(i.S+i.F*!N,"Object",{create:W,defineProperty:J,defineProperties:K,getOwnPropertyDescriptor:G,getOwnPropertyNames:q,getOwnPropertySymbols:z}),k&&i(i.S+i.F*(!N||L),"JSON",{stringify:H}),l(w,"Symbol"),l(Math,"Math",!0),l(o.JSON,"JSON",!0)},function(t){"use strict";var e={}.hasOwnProperty;t.exports=function(t,n){return e.call(t,n)}},function(t,e,n){"use strict";t.exports=!n(16)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,e,n){"use strict";t.exports=n(27)},function(t,e,n){"use strict";var r=n(5),o=n(28);t.exports=n(25)?function(t,e,n){return r.setDesc(t,e,o(1,n))}:function(t,e,n){return t[e]=n,t}},function(t){"use strict";t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},function(t,e,n){"use strict";var r=n(14),o="__core-js_shared__",u=r[o]||(r[o]={});t.exports=function(t){return u[t]||(u[t]={})}},function(t,e,n){"use strict";var r=n(5).setDesc,o=n(24),u=n(31)("toStringTag");t.exports=function(t,e,n){t&&!o(t=n?t:t.prototype,u)&&r(t,u,{configurable:!0,value:e})}},function(t,e,n){"use strict";var r=n(29)("wks"),o=n(14).Symbol;t.exports=function(t){return r[t]||(r[t]=o&&o[t]||(o||n(32))("Symbol."+t))}},function(t){"use strict";var e=0,n=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++e+n).toString(36))}},function(t,e,n){"use strict";var r=n(5),o=n(34);t.exports=function(t,e){for(var n,u=o(t),s=r.getKeys(u),i=s.length,c=0;i>c;)if(u[n=s[c++]]===e)return n}},function(t,e,n){"use strict";var r=n(35),o=n(11);t.exports=function(t){return r(o(t))}},function(t,e,n){"use strict";var r=n(36);t.exports=0 in Object("z")?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},function(t){"use strict";var e={}.toString;t.exports=function(t){return e.call(t).slice(8,-1)}},function(t,e,n){"use strict";var r=n(38)["default"],o={}.toString,u=n(34),s=n(5).getNames,i="object"==typeof window&&r?r(window):[],c=function(t){try{return s(t)}catch(e){return i.slice()}};t.exports.get=function(t){return i&&"[object Window]"==o.call(t)?c(t):s(u(t))}},function(t,e,n){"use strict";t.exports={"default":n(39),__esModule:!0}},function(t,e,n){"use strict";var r=n(5);n(40),t.exports=function(t){return r.getNames(t)}},function(t,e,n){"use strict";n(12)("getOwnPropertyNames",function(){return n(37).get})},function(t,e,n){"use strict";var r=n(5);t.exports=function(t){var e=r.getKeys(t),n=r.getSymbols;if(n)for(var o,u=n(t),s=r.isEnum,i=0;u.length>i;)s.call(t,o=u[i++])&&e.push(o);return e}},function(t,e,n){"use strict";var r=n(36);t.exports=Array.isArray||function(t){return"Array"==r(t)}},function(t,e,n){"use strict";var r=n(44);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t){"use strict";t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t){"use strict";t.exports=!0}])}); |
{ | ||
"name": "sheetjs", | ||
"description": "Easily create and manipulate CSSStyleDeclarations with javascript.", | ||
"version": "1.0.12", | ||
"version": "1.0.13", | ||
"keywords": [ | ||
@@ -23,6 +23,9 @@ "CSSStyleDeclaration", | ||
"babel-runtime": "^5.8.25", | ||
"color": "^0.10.1", | ||
"eslint": "^1.7.1", | ||
"eslint-loader": "^1.1.0", | ||
"jquery": "^2.1.4", | ||
"json-loader": "^0.5.3", | ||
"lodash": "^3.10.1", | ||
"material-colors": "^1.0.0", | ||
"mocha": "^2.3.3", | ||
@@ -29,0 +32,0 @@ "mocha-loader": "^0.7.1", |
@@ -1,2 +0,2 @@ | ||
# SheetJS | ||
# SheetJS [![NPM version][npm-image]][npm-url] [![Build status][travis-image]][travis-url] | ||
@@ -100,1 +100,6 @@ Easily create and manipulate `CSSStyleDeclarations` with javascript: | ||
MIT | ||
[npm-image]: https://badge.fury.io/js/sheetjs.svg | ||
[npm-url]: https://npmjs.org/package/sheetjs | ||
[travis-image]: https://travis-ci.org/jshanson7/sheetjs.svg | ||
[travis-url]: https://travis-ci.org/jshanson7/sheetjs |
@@ -1,14 +0,2 @@ | ||
// // CSSStyleSheet: | ||
// { | ||
// // CSSRuleList | ||
// rules: [ | ||
// // CSSStyleRule: | ||
// { | ||
// // CSSStyleDeclaration: | ||
// style: { | ||
// backgroundColor: 'red' | ||
// } | ||
// } | ||
// ] | ||
// } | ||
import bindAll from './utils/bindAll'; | ||
@@ -18,15 +6,10 @@ let instanceCount = 0; | ||
export default class StyleSheet { | ||
_instance = ++instanceCount | ||
_element = null | ||
_sheet = null | ||
_rules = null | ||
_deleteRule = null | ||
constructor(stylesBySelector) { | ||
// bind context of public methods | ||
const self = this; | ||
[ | ||
'setStylesForSelectors', | ||
'setStylesForSelector', | ||
'stylesForSelector', | ||
'createStylesForSelector', | ||
'getStylesForSelector', | ||
'deleteStylesForSelector', | ||
'disable', | ||
'enable' | ||
].forEach(method => self[method] = self[method].bind(self)); | ||
bindAll(this); | ||
@@ -38,7 +21,2 @@ if (stylesBySelector) { | ||
_instance = instanceCount++ | ||
_styleSheet = null | ||
_sheet = null | ||
_rules = null | ||
setStylesForSelectors(stylesBySelector) { | ||
@@ -80,4 +58,3 @@ Object.keys(stylesBySelector).forEach(selector => | ||
deleteStylesForSelector(selector) { | ||
const sheet = this._getSheet(); | ||
const deleteRule = sheet.removeRule || sheet.deleteRule; | ||
const deleteRule = this._getDeleteRule(); | ||
const ruleIndex = this._getRuleIndex(selector); | ||
@@ -87,3 +64,3 @@ | ||
false : | ||
deleteRule.call(sheet, ruleIndex); | ||
deleteRule(ruleIndex); | ||
} | ||
@@ -101,2 +78,9 @@ | ||
_getDeleteRule() { | ||
return this._deleteRule || (function () { | ||
const sheet = this._getSheet(); | ||
return this._deleteRule = (sheet.removeRule || sheet.deleteRule).bind(sheet); | ||
}).call(this); | ||
} | ||
_getRuleIndex(selector) { | ||
@@ -123,8 +107,2 @@ const rules = this._getRules(); | ||
_getSheet() { | ||
return this._sheet || (function () { | ||
return this._sheet = this._getStylesForSelectorsheet().sheet; | ||
}).call(this); | ||
} | ||
_getRules() { | ||
@@ -137,12 +115,35 @@ return this._rules || (function () { | ||
_getStylesForSelectorsheet() { | ||
return this._styleSheet || (function () { | ||
const style = document.createElement('style'); | ||
_getSheet() { | ||
return this._sheet || (function () { | ||
return this._sheet = this._getElement().sheet; | ||
}).call(this); | ||
} | ||
_getElement() { | ||
return this._element || (function () { | ||
const styleSheet = document.createElement('style'); | ||
const head = document.head || document.getElementsByTagName('head')[0]; | ||
style.type = 'text/css'; | ||
style.setAttribute('id', 'sheetjs-' + this._instance); | ||
(head).appendChild(style); | ||
return this._styleSheet = style; | ||
styleSheet.type = 'text/css'; | ||
styleSheet.setAttribute('id', 'sheetjs-' + this._instance); | ||
(head).appendChild(styleSheet); | ||
return this._element = styleSheet; | ||
}).call(this); | ||
} | ||
} | ||
// 'style' dom element property reference | ||
// { | ||
// // CSSStyleSheet | ||
// sheet: { | ||
// // CSSRuleList | ||
// rules: [ | ||
// // CSSStyleRule | ||
// { | ||
// // CSSStyleDeclaration | ||
// style: { | ||
// backgroundColor: 'red' | ||
// } | ||
// } | ||
// ] | ||
// } | ||
// } |
import assert from 'assert'; | ||
import { range, isFunction, omit, sample } from 'lodash'; | ||
import $ from 'jquery'; | ||
import Color from 'color'; | ||
import colors from 'material-colors'; | ||
import sheetjs from '../'; | ||
import StyleSheet from '../StyleSheet'; | ||
assert(StyleSheet === StyleSheet); | ||
const isBrowser = process.browser === true; | ||
const testCount = 100; | ||
const $testEls = isBrowser ? range(testCount).map(() => $('<ul/>', { class: `test-element` }) ) : null; | ||
const $testElements = isBrowser ? $('<ul/>', { class: 'test-elements' }) : null; | ||
if (isBrowser) { $testElements.html($testEls).prependTo('#mocha'); } | ||
describe('mocha', () => it('is working', () => assert(true))); | ||
describe('sheetjs', () => { | ||
describe('#createStyle()', () => | ||
it('should be true', () => | ||
assert(true) | ||
) | ||
); | ||
it('has .StyleSheet', () => assert(isFunction(isBrowser ? window.sheetjs.StyleSheet : sheetjs.StyleSheet))); | ||
if (isBrowser) { | ||
it('is availaible on window', () => assert(window.sheetjs !== undefined)); | ||
} | ||
}); | ||
describe('StyleSheet', () => { | ||
const styleSheet = new StyleSheet(); | ||
if (isBrowser) { | ||
describe('#setStylesForSelectors()', () => { | ||
styleSheet.setStylesForSelectors({ | ||
'.test-elements': { display: 'flex', flexWrap: 'wrap' }, | ||
'.test-element': { height: 20, width: 20 } | ||
}); | ||
it('should style the test elements', () => | ||
assert($('.test-elements').css('display') === 'flex') | ||
); | ||
it('should set backgroundColor', () => { | ||
$testEls.forEach(($el, i) => { | ||
const color = randomColor(); | ||
styleSheet.setStylesForSelectors({ | ||
[`.test-element:nth-child(${i + 1})`]: { backgroundColor: color } | ||
}); | ||
assert($el.css('backgroundColor') === color); | ||
}); | ||
}); | ||
}); | ||
} | ||
}); | ||
function randomColor() { | ||
return new Color(sample(omit(colors, 'white', 'black'))['200']).rgbString(); | ||
} |
@@ -26,2 +26,6 @@ const path = require('path'); | ||
loader: 'babel' | ||
}, | ||
{ | ||
test: /\.json$/, | ||
loader: 'json' | ||
} | ||
@@ -28,0 +32,0 @@ ] |
@@ -15,2 +15,6 @@ const path = require('path'); | ||
loader: 'babel' | ||
}, | ||
{ | ||
test: /\.json$/, | ||
loader: 'json' | ||
} | ||
@@ -17,0 +21,0 @@ ] |
@@ -15,2 +15,6 @@ const path = require('path'); | ||
loader: 'babel' | ||
}, | ||
{ | ||
test: /\.json$/, | ||
loader: 'json' | ||
} | ||
@@ -17,0 +21,0 @@ ] |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
1486772
25
26489
104
17