Comparing version 10.0.0-alpha.12 to 10.0.0-alpha.13
@@ -251,3 +251,3 @@ function _extends() { | ||
this.style = style; | ||
this.renderer = sheet ? sheet.renderer : new Renderer(); | ||
if (sheet) this.renderer = sheet.renderer;else if (Renderer) this.renderer = new Renderer(); | ||
} | ||
@@ -281,3 +281,3 @@ /** | ||
if (this.renderable) { | ||
if (this.renderable && this.renderer) { | ||
if (remove) this.renderer.removeProperty(this.renderable, name);else this.renderer.setProperty(this.renderable, name, newValue); | ||
@@ -337,6 +337,10 @@ return this; | ||
_proto2.applyTo = function applyTo(renderable) { | ||
var json = this.toJSON(); | ||
var renderer = this.renderer; | ||
for (var prop in json) { | ||
this.renderer.setProperty(renderable, prop, json[prop]); | ||
if (renderer) { | ||
var json = this.toJSON(); | ||
for (var prop in json) { | ||
renderer.setProperty(renderable, prop, json[prop]); | ||
} | ||
} | ||
@@ -382,7 +386,9 @@ | ||
this.selectorText = selector; | ||
if (!this.renderable) return; | ||
var hasChanged = this.renderer.setSelector(this.renderable, selector); // If selector setter is not implemented, rerender the rule. | ||
var renderer = this.renderer, | ||
renderable = this.renderable; | ||
if (!renderable || !renderer) return; | ||
var hasChanged = renderer.setSelector(renderable, selector); // If selector setter is not implemented, rerender the rule. | ||
if (!hasChanged) { | ||
this.renderer.replaceRule(this.renderable, this); | ||
renderer.replaceRule(renderable, this); | ||
} | ||
@@ -1078,3 +1084,7 @@ } | ||
}); | ||
this.renderer = new options.Renderer(this); | ||
if (options.Renderer) { | ||
this.renderer = new options.Renderer(this); | ||
} | ||
this.rules = new RuleList(this.options); | ||
@@ -1096,3 +1106,3 @@ | ||
_proto.attach = function attach() { | ||
if (this.attached) return this; | ||
if (this.attached || !this.renderer) return this; | ||
this.renderer.attach(); | ||
@@ -1110,3 +1120,3 @@ this.attached = true; // Order is important, because we can't use insertRule API if style element is not attached. | ||
_proto.detach = function detach() { | ||
if (!this.attached) return this; | ||
if (!this.attached || !this.renderer) return this; | ||
this.renderer.detach(); | ||
@@ -1158,3 +1168,5 @@ this.attached = false; | ||
_proto.insertRule = function insertRule(rule) { | ||
this.renderer.insertRule(rule); | ||
if (this.renderer) { | ||
this.renderer.insertRule(rule); | ||
} | ||
} | ||
@@ -1196,3 +1208,3 @@ /** | ||
if (this.attached && rule.renderable) { | ||
if (this.attached && rule.renderable && this.renderer) { | ||
return this.renderer.deleteRule(rule.renderable); | ||
@@ -1217,4 +1229,7 @@ } | ||
_proto.deploy = function deploy() { | ||
this.renderer.deploy(); | ||
this.deployed = true; | ||
if (this.renderer) { | ||
this.renderer.deploy(); | ||
this.deployed = true; | ||
} | ||
return this; | ||
@@ -1519,4 +1534,3 @@ } | ||
// Support CSSTOM. | ||
if ('attributeStyleMap' in cssRule) { | ||
// $FlowFixMe | ||
if (cssRule.attributeStyleMap) { | ||
return cssRule.attributeStyleMap.get(prop); | ||
@@ -1550,4 +1564,3 @@ } | ||
if ('attributeStyleMap' in cssRule) { | ||
// $FlowFixMe | ||
if (cssRule.attributeStyleMap) { | ||
cssRule.attributeStyleMap.set(prop, cssValue); | ||
@@ -1572,4 +1585,3 @@ } else { | ||
// Support CSSTOM. | ||
if ('attributeStyleMap' in cssRule) { | ||
// $FlowFixMe | ||
if (cssRule.attributeStyleMap) { | ||
cssRule.attributeStyleMap.delete(prop); | ||
@@ -1663,3 +1675,3 @@ } else { | ||
if (sheet) { | ||
if (sheet && sheet.renderer) { | ||
return { | ||
@@ -1674,3 +1686,3 @@ parent: sheet.renderer.element.parentNode, | ||
if (sheet) { | ||
if (sheet && sheet.renderer) { | ||
return { | ||
@@ -1945,55 +1957,2 @@ parent: sheet.renderer.element.parentNode, | ||
/* eslint-disable class-methods-use-this */ | ||
/** | ||
* Rendering backend to do nothing in nodejs. | ||
*/ | ||
var VirtualRenderer = | ||
/*#__PURE__*/ | ||
function () { | ||
function VirtualRenderer() {} | ||
var _proto = VirtualRenderer.prototype; | ||
_proto.setProperty = function setProperty() { | ||
return true; | ||
}; | ||
_proto.getPropertyValue = function getPropertyValue() { | ||
return ''; | ||
}; | ||
_proto.removeProperty = function removeProperty() {}; | ||
_proto.setSelector = function setSelector() { | ||
return true; | ||
}; | ||
_proto.attach = function attach() {}; | ||
_proto.detach = function detach() {}; | ||
_proto.deploy = function deploy() {}; | ||
_proto.insertRule = function insertRule() { | ||
return false; | ||
}; | ||
_proto.deleteRule = function deleteRule() { | ||
return true; | ||
}; | ||
_proto.replaceRule = function replaceRule() { | ||
return false; | ||
}; | ||
_proto.getRules = function getRules() {}; | ||
_proto.indexOf = function indexOf() { | ||
return -1; | ||
}; | ||
return VirtualRenderer; | ||
}(); | ||
var instanceCounter = 0; | ||
@@ -2006,7 +1965,7 @@ | ||
this.id = instanceCounter++; | ||
this.version = "10.0.0-alpha.12"; | ||
this.version = "10.0.0-alpha.13"; | ||
this.plugins = new PluginsRegistry(); | ||
this.options = { | ||
createGenerateId: createGenerateIdDefault, | ||
Renderer: isBrowser ? DomRenderer : VirtualRenderer, | ||
Renderer: isBrowser ? DomRenderer : null, | ||
plugins: [] | ||
@@ -2038,6 +1997,8 @@ }; | ||
if (options.createGenerateId) { | ||
this.options.createGenerateId = options.createGenerateId; // $FlowFixMe | ||
var _options = options, | ||
createGenerateId = _options.createGenerateId; | ||
this.generateId = options.createGenerateId(); | ||
if (createGenerateId) { | ||
this.options.createGenerateId = createGenerateId; | ||
this.generateId = createGenerateId(); | ||
} | ||
@@ -2047,4 +2008,4 @@ | ||
if (options.virtual || options.Renderer) { | ||
this.options.Renderer = options.Renderer || (options.virtual ? VirtualRenderer : DomRenderer); | ||
if ('Renderer' in options) { | ||
this.options.Renderer = options.Renderer; | ||
} // eslint-disable-next-line prefer-spread | ||
@@ -2066,4 +2027,4 @@ | ||
var _options = options, | ||
index = _options.index; | ||
var _options2 = options, | ||
index = _options2.index; | ||
@@ -2070,0 +2031,0 @@ if (typeof index !== 'number') { |
@@ -197,3 +197,3 @@ 'use strict'; | ||
this.style = style; | ||
this.renderer = sheet ? sheet.renderer : new Renderer(); | ||
if (sheet) this.renderer = sheet.renderer;else if (Renderer) this.renderer = new Renderer(); | ||
} | ||
@@ -227,3 +227,3 @@ /** | ||
if (this.renderable) { | ||
if (this.renderable && this.renderer) { | ||
if (remove) this.renderer.removeProperty(this.renderable, name);else this.renderer.setProperty(this.renderable, name, newValue); | ||
@@ -283,6 +283,10 @@ return this; | ||
_proto2.applyTo = function applyTo(renderable) { | ||
var json = this.toJSON(); | ||
var renderer = this.renderer; | ||
for (var prop in json) { | ||
this.renderer.setProperty(renderable, prop, json[prop]); | ||
if (renderer) { | ||
var json = this.toJSON(); | ||
for (var prop in json) { | ||
renderer.setProperty(renderable, prop, json[prop]); | ||
} | ||
} | ||
@@ -328,7 +332,9 @@ | ||
this.selectorText = selector; | ||
if (!this.renderable) return; | ||
var hasChanged = this.renderer.setSelector(this.renderable, selector); // If selector setter is not implemented, rerender the rule. | ||
var renderer = this.renderer, | ||
renderable = this.renderable; | ||
if (!renderable || !renderer) return; | ||
var hasChanged = renderer.setSelector(renderable, selector); // If selector setter is not implemented, rerender the rule. | ||
if (!hasChanged) { | ||
this.renderer.replaceRule(this.renderable, this); | ||
renderer.replaceRule(renderable, this); | ||
} | ||
@@ -1024,3 +1030,7 @@ } | ||
}); | ||
this.renderer = new options.Renderer(this); | ||
if (options.Renderer) { | ||
this.renderer = new options.Renderer(this); | ||
} | ||
this.rules = new RuleList(this.options); | ||
@@ -1042,3 +1052,3 @@ | ||
_proto.attach = function attach() { | ||
if (this.attached) return this; | ||
if (this.attached || !this.renderer) return this; | ||
this.renderer.attach(); | ||
@@ -1056,3 +1066,3 @@ this.attached = true; // Order is important, because we can't use insertRule API if style element is not attached. | ||
_proto.detach = function detach() { | ||
if (!this.attached) return this; | ||
if (!this.attached || !this.renderer) return this; | ||
this.renderer.detach(); | ||
@@ -1104,3 +1114,5 @@ this.attached = false; | ||
_proto.insertRule = function insertRule(rule) { | ||
this.renderer.insertRule(rule); | ||
if (this.renderer) { | ||
this.renderer.insertRule(rule); | ||
} | ||
} | ||
@@ -1142,3 +1154,3 @@ /** | ||
if (this.attached && rule.renderable) { | ||
if (this.attached && rule.renderable && this.renderer) { | ||
return this.renderer.deleteRule(rule.renderable); | ||
@@ -1163,4 +1175,7 @@ } | ||
_proto.deploy = function deploy() { | ||
this.renderer.deploy(); | ||
this.deployed = true; | ||
if (this.renderer) { | ||
this.renderer.deploy(); | ||
this.deployed = true; | ||
} | ||
return this; | ||
@@ -1470,4 +1485,3 @@ } | ||
// Support CSSTOM. | ||
if ('attributeStyleMap' in cssRule) { | ||
// $FlowFixMe | ||
if (cssRule.attributeStyleMap) { | ||
return cssRule.attributeStyleMap.get(prop); | ||
@@ -1501,4 +1515,3 @@ } | ||
if ('attributeStyleMap' in cssRule) { | ||
// $FlowFixMe | ||
if (cssRule.attributeStyleMap) { | ||
cssRule.attributeStyleMap.set(prop, cssValue); | ||
@@ -1523,4 +1536,3 @@ } else { | ||
// Support CSSTOM. | ||
if ('attributeStyleMap' in cssRule) { | ||
// $FlowFixMe | ||
if (cssRule.attributeStyleMap) { | ||
cssRule.attributeStyleMap.delete(prop); | ||
@@ -1614,3 +1626,3 @@ } else { | ||
if (sheet) { | ||
if (sheet && sheet.renderer) { | ||
return { | ||
@@ -1625,3 +1637,3 @@ parent: sheet.renderer.element.parentNode, | ||
if (sheet) { | ||
if (sheet && sheet.renderer) { | ||
return { | ||
@@ -1896,55 +1908,2 @@ parent: sheet.renderer.element.parentNode, | ||
/* eslint-disable class-methods-use-this */ | ||
/** | ||
* Rendering backend to do nothing in nodejs. | ||
*/ | ||
var VirtualRenderer = | ||
/*#__PURE__*/ | ||
function () { | ||
function VirtualRenderer() {} | ||
var _proto = VirtualRenderer.prototype; | ||
_proto.setProperty = function setProperty() { | ||
return true; | ||
}; | ||
_proto.getPropertyValue = function getPropertyValue() { | ||
return ''; | ||
}; | ||
_proto.removeProperty = function removeProperty() {}; | ||
_proto.setSelector = function setSelector() { | ||
return true; | ||
}; | ||
_proto.attach = function attach() {}; | ||
_proto.detach = function detach() {}; | ||
_proto.deploy = function deploy() {}; | ||
_proto.insertRule = function insertRule() { | ||
return false; | ||
}; | ||
_proto.deleteRule = function deleteRule() { | ||
return true; | ||
}; | ||
_proto.replaceRule = function replaceRule() { | ||
return false; | ||
}; | ||
_proto.getRules = function getRules() {}; | ||
_proto.indexOf = function indexOf() { | ||
return -1; | ||
}; | ||
return VirtualRenderer; | ||
}(); | ||
var instanceCounter = 0; | ||
@@ -1957,7 +1916,7 @@ | ||
this.id = instanceCounter++; | ||
this.version = "10.0.0-alpha.12"; | ||
this.version = "10.0.0-alpha.13"; | ||
this.plugins = new PluginsRegistry(); | ||
this.options = { | ||
createGenerateId: createGenerateIdDefault, | ||
Renderer: isInBrowser ? DomRenderer : VirtualRenderer, | ||
Renderer: isInBrowser ? DomRenderer : null, | ||
plugins: [] | ||
@@ -1989,6 +1948,8 @@ }; | ||
if (options.createGenerateId) { | ||
this.options.createGenerateId = options.createGenerateId; // $FlowFixMe | ||
var _options = options, | ||
createGenerateId = _options.createGenerateId; | ||
this.generateId = options.createGenerateId(); | ||
if (createGenerateId) { | ||
this.options.createGenerateId = createGenerateId; | ||
this.generateId = createGenerateId(); | ||
} | ||
@@ -1998,4 +1959,4 @@ | ||
if (options.virtual || options.Renderer) { | ||
this.options.Renderer = options.Renderer || (options.virtual ? VirtualRenderer : DomRenderer); | ||
if ('Renderer' in options) { | ||
this.options.Renderer = options.Renderer; | ||
} // eslint-disable-next-line prefer-spread | ||
@@ -2017,4 +1978,4 @@ | ||
var _options = options, | ||
index = _options.index; | ||
var _options2 = options, | ||
index = _options2.index; | ||
@@ -2021,0 +1982,0 @@ if (typeof index !== 'number') { |
@@ -191,3 +191,3 @@ import _extends from '@babel/runtime/helpers/esm/extends'; | ||
this.style = style; | ||
this.renderer = sheet ? sheet.renderer : new Renderer(); | ||
if (sheet) this.renderer = sheet.renderer;else if (Renderer) this.renderer = new Renderer(); | ||
} | ||
@@ -221,3 +221,3 @@ /** | ||
if (this.renderable) { | ||
if (this.renderable && this.renderer) { | ||
if (remove) this.renderer.removeProperty(this.renderable, name);else this.renderer.setProperty(this.renderable, name, newValue); | ||
@@ -277,6 +277,10 @@ return this; | ||
_proto2.applyTo = function applyTo(renderable) { | ||
var json = this.toJSON(); | ||
var renderer = this.renderer; | ||
for (var prop in json) { | ||
this.renderer.setProperty(renderable, prop, json[prop]); | ||
if (renderer) { | ||
var json = this.toJSON(); | ||
for (var prop in json) { | ||
renderer.setProperty(renderable, prop, json[prop]); | ||
} | ||
} | ||
@@ -322,7 +326,9 @@ | ||
this.selectorText = selector; | ||
if (!this.renderable) return; | ||
var hasChanged = this.renderer.setSelector(this.renderable, selector); // If selector setter is not implemented, rerender the rule. | ||
var renderer = this.renderer, | ||
renderable = this.renderable; | ||
if (!renderable || !renderer) return; | ||
var hasChanged = renderer.setSelector(renderable, selector); // If selector setter is not implemented, rerender the rule. | ||
if (!hasChanged) { | ||
this.renderer.replaceRule(this.renderable, this); | ||
renderer.replaceRule(renderable, this); | ||
} | ||
@@ -1018,3 +1024,7 @@ } | ||
}); | ||
this.renderer = new options.Renderer(this); | ||
if (options.Renderer) { | ||
this.renderer = new options.Renderer(this); | ||
} | ||
this.rules = new RuleList(this.options); | ||
@@ -1036,3 +1046,3 @@ | ||
_proto.attach = function attach() { | ||
if (this.attached) return this; | ||
if (this.attached || !this.renderer) return this; | ||
this.renderer.attach(); | ||
@@ -1050,3 +1060,3 @@ this.attached = true; // Order is important, because we can't use insertRule API if style element is not attached. | ||
_proto.detach = function detach() { | ||
if (!this.attached) return this; | ||
if (!this.attached || !this.renderer) return this; | ||
this.renderer.detach(); | ||
@@ -1098,3 +1108,5 @@ this.attached = false; | ||
_proto.insertRule = function insertRule(rule) { | ||
this.renderer.insertRule(rule); | ||
if (this.renderer) { | ||
this.renderer.insertRule(rule); | ||
} | ||
} | ||
@@ -1136,3 +1148,3 @@ /** | ||
if (this.attached && rule.renderable) { | ||
if (this.attached && rule.renderable && this.renderer) { | ||
return this.renderer.deleteRule(rule.renderable); | ||
@@ -1157,4 +1169,7 @@ } | ||
_proto.deploy = function deploy() { | ||
this.renderer.deploy(); | ||
this.deployed = true; | ||
if (this.renderer) { | ||
this.renderer.deploy(); | ||
this.deployed = true; | ||
} | ||
return this; | ||
@@ -1464,4 +1479,3 @@ } | ||
// Support CSSTOM. | ||
if ('attributeStyleMap' in cssRule) { | ||
// $FlowFixMe | ||
if (cssRule.attributeStyleMap) { | ||
return cssRule.attributeStyleMap.get(prop); | ||
@@ -1495,4 +1509,3 @@ } | ||
if ('attributeStyleMap' in cssRule) { | ||
// $FlowFixMe | ||
if (cssRule.attributeStyleMap) { | ||
cssRule.attributeStyleMap.set(prop, cssValue); | ||
@@ -1517,4 +1530,3 @@ } else { | ||
// Support CSSTOM. | ||
if ('attributeStyleMap' in cssRule) { | ||
// $FlowFixMe | ||
if (cssRule.attributeStyleMap) { | ||
cssRule.attributeStyleMap.delete(prop); | ||
@@ -1608,3 +1620,3 @@ } else { | ||
if (sheet) { | ||
if (sheet && sheet.renderer) { | ||
return { | ||
@@ -1619,3 +1631,3 @@ parent: sheet.renderer.element.parentNode, | ||
if (sheet) { | ||
if (sheet && sheet.renderer) { | ||
return { | ||
@@ -1890,55 +1902,2 @@ parent: sheet.renderer.element.parentNode, | ||
/* eslint-disable class-methods-use-this */ | ||
/** | ||
* Rendering backend to do nothing in nodejs. | ||
*/ | ||
var VirtualRenderer = | ||
/*#__PURE__*/ | ||
function () { | ||
function VirtualRenderer() {} | ||
var _proto = VirtualRenderer.prototype; | ||
_proto.setProperty = function setProperty() { | ||
return true; | ||
}; | ||
_proto.getPropertyValue = function getPropertyValue() { | ||
return ''; | ||
}; | ||
_proto.removeProperty = function removeProperty() {}; | ||
_proto.setSelector = function setSelector() { | ||
return true; | ||
}; | ||
_proto.attach = function attach() {}; | ||
_proto.detach = function detach() {}; | ||
_proto.deploy = function deploy() {}; | ||
_proto.insertRule = function insertRule() { | ||
return false; | ||
}; | ||
_proto.deleteRule = function deleteRule() { | ||
return true; | ||
}; | ||
_proto.replaceRule = function replaceRule() { | ||
return false; | ||
}; | ||
_proto.getRules = function getRules() {}; | ||
_proto.indexOf = function indexOf() { | ||
return -1; | ||
}; | ||
return VirtualRenderer; | ||
}(); | ||
var instanceCounter = 0; | ||
@@ -1951,7 +1910,7 @@ | ||
this.id = instanceCounter++; | ||
this.version = "10.0.0-alpha.12"; | ||
this.version = "10.0.0-alpha.13"; | ||
this.plugins = new PluginsRegistry(); | ||
this.options = { | ||
createGenerateId: createGenerateIdDefault, | ||
Renderer: isInBrowser ? DomRenderer : VirtualRenderer, | ||
Renderer: isInBrowser ? DomRenderer : null, | ||
plugins: [] | ||
@@ -1983,6 +1942,8 @@ }; | ||
if (options.createGenerateId) { | ||
this.options.createGenerateId = options.createGenerateId; // $FlowFixMe | ||
var _options = options, | ||
createGenerateId = _options.createGenerateId; | ||
this.generateId = options.createGenerateId(); | ||
if (createGenerateId) { | ||
this.options.createGenerateId = createGenerateId; | ||
this.generateId = createGenerateId(); | ||
} | ||
@@ -1992,4 +1953,4 @@ | ||
if (options.virtual || options.Renderer) { | ||
this.options.Renderer = options.Renderer || (options.virtual ? VirtualRenderer : DomRenderer); | ||
if ('Renderer' in options) { | ||
this.options.Renderer = options.Renderer; | ||
} // eslint-disable-next-line prefer-spread | ||
@@ -2011,4 +1972,4 @@ | ||
var _options = options, | ||
index = _options.index; | ||
var _options2 = options, | ||
index = _options2.index; | ||
@@ -2015,0 +1976,0 @@ if (typeof index !== 'number') { |
131
dist/jss.js
@@ -257,3 +257,3 @@ (function (global, factory) { | ||
this.style = style; | ||
this.renderer = sheet ? sheet.renderer : new Renderer(); | ||
if (sheet) this.renderer = sheet.renderer;else if (Renderer) this.renderer = new Renderer(); | ||
} | ||
@@ -287,3 +287,3 @@ /** | ||
if (this.renderable) { | ||
if (this.renderable && this.renderer) { | ||
if (remove) this.renderer.removeProperty(this.renderable, name);else this.renderer.setProperty(this.renderable, name, newValue); | ||
@@ -343,6 +343,10 @@ return this; | ||
_proto2.applyTo = function applyTo(renderable) { | ||
var json = this.toJSON(); | ||
var renderer = this.renderer; | ||
for (var prop in json) { | ||
this.renderer.setProperty(renderable, prop, json[prop]); | ||
if (renderer) { | ||
var json = this.toJSON(); | ||
for (var prop in json) { | ||
renderer.setProperty(renderable, prop, json[prop]); | ||
} | ||
} | ||
@@ -388,7 +392,9 @@ | ||
this.selectorText = selector; | ||
if (!this.renderable) return; | ||
var hasChanged = this.renderer.setSelector(this.renderable, selector); // If selector setter is not implemented, rerender the rule. | ||
var renderer = this.renderer, | ||
renderable = this.renderable; | ||
if (!renderable || !renderer) return; | ||
var hasChanged = renderer.setSelector(renderable, selector); // If selector setter is not implemented, rerender the rule. | ||
if (!hasChanged) { | ||
this.renderer.replaceRule(this.renderable, this); | ||
renderer.replaceRule(renderable, this); | ||
} | ||
@@ -1084,3 +1090,7 @@ } | ||
}); | ||
this.renderer = new options.Renderer(this); | ||
if (options.Renderer) { | ||
this.renderer = new options.Renderer(this); | ||
} | ||
this.rules = new RuleList(this.options); | ||
@@ -1102,3 +1112,3 @@ | ||
_proto.attach = function attach() { | ||
if (this.attached) return this; | ||
if (this.attached || !this.renderer) return this; | ||
this.renderer.attach(); | ||
@@ -1116,3 +1126,3 @@ this.attached = true; // Order is important, because we can't use insertRule API if style element is not attached. | ||
_proto.detach = function detach() { | ||
if (!this.attached) return this; | ||
if (!this.attached || !this.renderer) return this; | ||
this.renderer.detach(); | ||
@@ -1164,3 +1174,5 @@ this.attached = false; | ||
_proto.insertRule = function insertRule(rule) { | ||
this.renderer.insertRule(rule); | ||
if (this.renderer) { | ||
this.renderer.insertRule(rule); | ||
} | ||
} | ||
@@ -1202,3 +1214,3 @@ /** | ||
if (this.attached && rule.renderable) { | ||
if (this.attached && rule.renderable && this.renderer) { | ||
return this.renderer.deleteRule(rule.renderable); | ||
@@ -1223,4 +1235,7 @@ } | ||
_proto.deploy = function deploy() { | ||
this.renderer.deploy(); | ||
this.deployed = true; | ||
if (this.renderer) { | ||
this.renderer.deploy(); | ||
this.deployed = true; | ||
} | ||
return this; | ||
@@ -1525,4 +1540,3 @@ } | ||
// Support CSSTOM. | ||
if ('attributeStyleMap' in cssRule) { | ||
// $FlowFixMe | ||
if (cssRule.attributeStyleMap) { | ||
return cssRule.attributeStyleMap.get(prop); | ||
@@ -1556,4 +1570,3 @@ } | ||
if ('attributeStyleMap' in cssRule) { | ||
// $FlowFixMe | ||
if (cssRule.attributeStyleMap) { | ||
cssRule.attributeStyleMap.set(prop, cssValue); | ||
@@ -1578,4 +1591,3 @@ } else { | ||
// Support CSSTOM. | ||
if ('attributeStyleMap' in cssRule) { | ||
// $FlowFixMe | ||
if (cssRule.attributeStyleMap) { | ||
cssRule.attributeStyleMap.delete(prop); | ||
@@ -1669,3 +1681,3 @@ } else { | ||
if (sheet) { | ||
if (sheet && sheet.renderer) { | ||
return { | ||
@@ -1680,3 +1692,3 @@ parent: sheet.renderer.element.parentNode, | ||
if (sheet) { | ||
if (sheet && sheet.renderer) { | ||
return { | ||
@@ -1951,55 +1963,2 @@ parent: sheet.renderer.element.parentNode, | ||
/* eslint-disable class-methods-use-this */ | ||
/** | ||
* Rendering backend to do nothing in nodejs. | ||
*/ | ||
var VirtualRenderer = | ||
/*#__PURE__*/ | ||
function () { | ||
function VirtualRenderer() {} | ||
var _proto = VirtualRenderer.prototype; | ||
_proto.setProperty = function setProperty() { | ||
return true; | ||
}; | ||
_proto.getPropertyValue = function getPropertyValue() { | ||
return ''; | ||
}; | ||
_proto.removeProperty = function removeProperty() {}; | ||
_proto.setSelector = function setSelector() { | ||
return true; | ||
}; | ||
_proto.attach = function attach() {}; | ||
_proto.detach = function detach() {}; | ||
_proto.deploy = function deploy() {}; | ||
_proto.insertRule = function insertRule() { | ||
return false; | ||
}; | ||
_proto.deleteRule = function deleteRule() { | ||
return true; | ||
}; | ||
_proto.replaceRule = function replaceRule() { | ||
return false; | ||
}; | ||
_proto.getRules = function getRules() {}; | ||
_proto.indexOf = function indexOf() { | ||
return -1; | ||
}; | ||
return VirtualRenderer; | ||
}(); | ||
var instanceCounter = 0; | ||
@@ -2012,7 +1971,7 @@ | ||
this.id = instanceCounter++; | ||
this.version = "10.0.0-alpha.12"; | ||
this.version = "10.0.0-alpha.13"; | ||
this.plugins = new PluginsRegistry(); | ||
this.options = { | ||
createGenerateId: createGenerateIdDefault, | ||
Renderer: isBrowser ? DomRenderer : VirtualRenderer, | ||
Renderer: isBrowser ? DomRenderer : null, | ||
plugins: [] | ||
@@ -2044,6 +2003,8 @@ }; | ||
if (options.createGenerateId) { | ||
this.options.createGenerateId = options.createGenerateId; // $FlowFixMe | ||
var _options = options, | ||
createGenerateId = _options.createGenerateId; | ||
this.generateId = options.createGenerateId(); | ||
if (createGenerateId) { | ||
this.options.createGenerateId = createGenerateId; | ||
this.generateId = createGenerateId(); | ||
} | ||
@@ -2053,4 +2014,4 @@ | ||
if (options.virtual || options.Renderer) { | ||
this.options.Renderer = options.Renderer || (options.virtual ? VirtualRenderer : DomRenderer); | ||
if ('Renderer' in options) { | ||
this.options.Renderer = options.Renderer; | ||
} // eslint-disable-next-line prefer-spread | ||
@@ -2072,4 +2033,4 @@ | ||
var _options = options, | ||
index = _options.index; | ||
var _options2 = options, | ||
index = _options2.index; | ||
@@ -2076,0 +2037,0 @@ if (typeof index !== 'number') { |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).jss={})}(this,function(e){"use strict";function t(){return(t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var n="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},r="object"===("undefined"==typeof window?"undefined":n(window))&&"object"===("undefined"==typeof document?"undefined":n(document))&&9===document.nodeType,i={}.constructor;function s(e){if(null==e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(s);if(e.constructor!==i)return e;var t={};for(var n in e)t[n]=s(e[n]);return t}function o(e,t,n){void 0===e&&(e="unnamed");var r=n.jss,i=s(t),o=r.plugins.onCreateRule(e,i,n);return o||(e[0],null)}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t,n){return t&&u(e.prototype,t),n&&u(e,n),e}function h(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var c=function(e,t){for(var n="",r=0;r<e.length&&"!important"!==e[r];r++)n&&(n+=t),n+=e[r];return n};function d(e,t){if(void 0===t&&(t=!1),!Array.isArray(e))return e;var n="";if(Array.isArray(e[0]))for(var r=0;r<e.length&&"!important"!==e[r];r++)n&&(n+=", "),n+=c(e[r]," ");else n=c(e,", ");return t||"!important"!==e[e.length-1]||(n+=" !important"),n}function f(e,t){for(var n="",r=0;r<t;r++)n+=" ";return n+e}function p(e,t,n){void 0===n&&(n={});var r="";if(!t)return r;var i=n.indent,s=void 0===i?0:i,o=t.fallbacks;if(e&&s++,o)if(Array.isArray(o))for(var u=0;u<o.length;u++){var a=o[u];for(var h in a){var l=a[h];null!=l&&(r&&(r+="\n"),r+=""+f(h+": "+d(l)+";",s))}}else for(var c in o){var p=o[c];null!=p&&(r&&(r+="\n"),r+=""+f(c+": "+d(p)+";",s))}for(var y in t){var v=t[y];null!=v&&"fallbacks"!==y&&(r&&(r+="\n"),r+=""+f(y+": "+d(v)+";",s))}return(r||n.allowEmpty)&&e?(r&&(r="\n"+r+"\n"),f(e+" {"+r,--s)+f("}",s)):r}var y=function(e){return e},v=function(){function e(e,t,n){this.type="style",this.key=void 0,this.isProcessed=!1,this.style=void 0,this.renderer=void 0,this.renderable=void 0,this.options=void 0;var r=n.sheet,i=n.Renderer;this.key=e,this.options=n,this.style=t,this.renderer=r?r.renderer:new i}return e.prototype.prop=function(e,t,n){if(void 0===t)return this.style[e];var r=!!n&&n.force;if(!r&&this.style[e]===t)return this;var i=t;n&&!1===n.process||(i=this.options.jss.plugins.onChangeValue(t,e,this));var s=null==i||!1===i,o=e in this.style;if(s&&!o&&!r)return this;var u=s&&o;if(u?delete this.style[e]:this.style[e]=i,this.renderable)return u?this.renderer.removeProperty(this.renderable,e):this.renderer.setProperty(this.renderable,e,i),this;var a=this.options.sheet;return a&&a.attached,this},e}(),g=function(e){function n(t,n,r){var i;(i=e.call(this,t,n,r)||this).selectorText=void 0,i.id=void 0,i.renderable=void 0;var s=r.selector,o=r.scoped,u=r.sheet,a=r.generateId;return s?i.selectorText=s:!1!==o&&(i.id=a(l(l(i)),u),i.selectorText="."+y(i.id)),i}h(n,e);var r=n.prototype;return r.applyTo=function(e){var t=this.toJSON();for(var n in t)this.renderer.setProperty(e,n,t[n]);return this},r.toJSON=function(){var e={};for(var t in this.style){var n=this.style[t];"object"!=typeof n?e[t]=n:Array.isArray(n)&&(e[t]=d(n))}return e},r.toString=function(e){var n=this.options.sheet,r=!!n&&n.options.link?t({},e,{allowEmpty:!0}):e;return p(this.selectorText,this.style,r)},a(n,[{key:"selector",set:function(e){e!==this.selectorText&&(this.selectorText=e,this.renderable&&(this.renderer.setSelector(this.renderable,e)||this.renderer.replaceRule(this.renderable,this)))},get:function(){return this.selectorText}}]),n}(v),m={onCreateRule:function(e,t,n){return"@"===e[0]||n.parent&&"keyframes"===n.parent.type?null:new g(e,t,n)}},R={indent:1,children:!0},S=/@([\w-]+)/,b=function(){function e(e,n,r){this.type="conditional",this.at=void 0,this.key=void 0,this.rules=void 0,this.options=void 0,this.isProcessed=!1,this.renderable=void 0,this.key=e;var i=e.match(S);for(var s in this.at=i?i[1]:"unknown",this.options=r,this.rules=new D(t({},r,{parent:this})),n)this.rules.add(s,n[s]);this.rules.process()}var n=e.prototype;return n.getRule=function(e){return this.rules.get(e)},n.indexOf=function(e){return this.rules.indexOf(e)},n.addRule=function(e,t,n){var r=this.rules.add(e,t,n);return r?(this.options.jss.plugins.onProcessRule(r),r):null},n.toString=function(e){if(void 0===e&&(e=R),!1===e.children)return this.key+" {}";var t=this.rules.toString(e);return t?this.key+" {\n"+t+"\n}":""},e}(),x=/@media|@supports\s+/,k={onCreateRule:function(e,t,n){return x.test(e)?new b(e,t,n):null}},P={indent:1,children:!0},w=/@keyframes\s+([\w-]+)/,j=function(){function e(e,n,r){this.type="keyframes",this.at="@keyframes",this.key=void 0,this.name=void 0,this.id=void 0,this.rules=void 0,this.options=void 0,this.isProcessed=!1,this.renderable=void 0;var i=e.match(w);i&&i[1]?this.name=i[1]:this.name="noname",this.key=this.type+"-"+this.name,this.options=r;var s=r.scoped,o=r.sheet,u=r.generateId;for(var a in this.id=!1===s?this.name:u(this,o),this.rules=new D(t({},r,{parent:this})),n)this.rules.add(a,n[a],t({},r,{parent:this}));this.rules.process()}return e.prototype.toString=function(e){if(void 0===e&&(e=P),!1===e.children)return this.at+" "+this.id+" {}";var t=this.rules.toString(e);return t&&(t="\n"+t+"\n"),this.at+" "+this.id+" {"+t+"}"},e}(),C=/@keyframes\s+/,A=/\$([\w-]+)/,O=function(e,t){if("string"==typeof e){var n=A.exec(e);if(!n)return e;if(n[1]in t)return e.replace(n[0],t[n[1]])}return e},I=function(e,t,n){var r=e[t],i=O(r,n);i!==r&&(e[t]=i)},T={onCreateRule:function(e,t,n){return"string"==typeof e&&C.test(e)?new j(e,t,n):null},onProcessStyle:function(e,t,n){return"style"===t.type&&n?("animation-name"in e&&I(e,"animation-name",n.keyframes),"animation"in e&&I(e,"animation",n.keyframes),e):e},onChangeValue:function(e,t,n){var r=n.options.sheet;if(!r)return e;switch(t){case"animation":case"animation-name":return O(e,r.keyframes);default:return e}}},q=function(e){function n(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).renderable=void 0,t}return h(n,e),n.prototype.toString=function(e){var n=this.options.sheet,r=!!n&&n.options.link?t({},e,{allowEmpty:!0}):e;return p(this.key,this.style,r)},n}(v),N={onCreateRule:function(e,t,n){return n.parent&&"keyframes"===n.parent.type?new q(e,t,n):null}},V=function(){function e(e,t,n){this.type="font-face",this.at="@font-face",this.key=void 0,this.style=void 0,this.options=void 0,this.isProcessed=!1,this.renderable=void 0,this.key=e,this.style=t,this.options=n}return e.prototype.toString=function(e){if(Array.isArray(this.style)){for(var t="",n=0;n<this.style.length;n++)t+=p(this.key,this.style[n]),this.style[n+1]&&(t+="\n");return t}return p(this.key,this.style,e)},e}(),M={onCreateRule:function(e,t,n){return"@font-face"===e?new V(e,t,n):null}},E=function(){function e(e,t,n){this.type="viewport",this.at="@viewport",this.key=void 0,this.style=void 0,this.options=void 0,this.isProcessed=!1,this.renderable=void 0,this.key=e,this.style=t,this.options=n}return e.prototype.toString=function(e){return p(this.key,this.style,e)},e}(),U={onCreateRule:function(e,t,n){return"@viewport"===e||"@-ms-viewport"===e?new E(e,t,n):null}},G=function(){function e(e,t,n){this.type="simple",this.key=void 0,this.value=void 0,this.options=void 0,this.isProcessed=!1,this.renderable=void 0,this.key=e,this.value=t,this.options=n}return e.prototype.toString=function(e){if(Array.isArray(this.value)){for(var t="",n=0;n<this.value.length;n++)t+=this.key+" "+this.value[n]+";",this.value[n+1]&&(t+="\n");return t}return this.key+" "+this.value+";"},e}(),_={"@charset":!0,"@import":!0,"@namespace":!0},B=[m,k,T,N,M,U,{onCreateRule:function(e,t,n){return e in _?new G(e,t,n):null}}],J={process:!0},z={force:!0,process:!0},D=function(){function e(e){this.map={},this.raw={},this.index=[],this.options=void 0,this.classes=void 0,this.keyframes=void 0,this.options=e,this.classes=e.classes,this.keyframes=e.keyframes}var n=e.prototype;return n.add=function(e,n,r){var i=this.options,s=i.parent,u=i.sheet,a=i.jss,h=i.Renderer,l=i.generateId,c=i.scoped,d=t({classes:this.classes,parent:s,sheet:u,jss:a,Renderer:h,generateId:l,scoped:c},r);this.raw[e]=n,e in this.classes&&(d.selector="."+y(this.classes[e]));var f=o(e,n,d);if(!f)return null;this.register(f);var p=void 0===d.index?this.index.length:d.index;return this.index.splice(p,0,f),f},n.get=function(e){return this.map[e]},n.remove=function(e){this.unregister(e),delete this.raw[e.key],this.index.splice(this.indexOf(e),1)},n.indexOf=function(e){return this.index.indexOf(e)},n.process=function(){var e=this.options.jss.plugins;this.index.slice(0).forEach(e.onProcessRule,e)},n.register=function(e){this.map[e.key]=e,e instanceof g?(this.map[e.selector]=e,e.id&&(this.classes[e.key]=e.id)):e instanceof j&&this.keyframes&&(this.keyframes[e.name]=e.id)},n.unregister=function(e){delete this.map[e.key],e instanceof g?(delete this.map[e.selector],delete this.classes[e.key]):e instanceof j&&delete this.keyframes[e.name]},n.update=function(){var e,t,n;if("string"==typeof(arguments.length<=0?void 0:arguments[0])?(e=arguments.length<=0?void 0:arguments[0],t=arguments.length<=1?void 0:arguments[1],n=arguments.length<=2?void 0:arguments[2]):(t=arguments.length<=0?void 0:arguments[0],n=arguments.length<=1?void 0:arguments[1],e=null),e)this.onUpdate(t,this.get(e),n);else for(var r=0;r<this.index.length;r++)this.onUpdate(t,this.index[r],n)},n.onUpdate=function(t,n,r){void 0===r&&(r=J);var i=this.options,s=i.jss.plugins,o=i.sheet;if(n.rules instanceof e)n.rules.update(t,r);else{var u=n,a=u.style;if(s.onUpdate(t,n,o,r),r.process&&a&&a!==u.style){for(var h in s.onProcessStyle(u.style,u,o),u.style){var l=u.style[h];l!==a[h]&&u.prop(h,l,z)}for(var c in a){var d=u.style[c],f=a[c];null==d&&d!==f&&u.prop(c,null,z)}}}},n.toString=function(e){for(var t="",n=this.options.sheet,r=!!n&&n.options.link,i=0;i<this.index.length;i++){var s=this.index[i].toString(e);(s||r)&&(t&&(t+="\n"),t+=s)}return t},e}(),L=function(){function e(e,n){for(var r in this.options=void 0,this.deployed=void 0,this.attached=void 0,this.rules=void 0,this.renderer=void 0,this.classes=void 0,this.keyframes=void 0,this.queue=void 0,this.attached=!1,this.deployed=!1,this.classes={},this.keyframes={},this.options=t({},n,{sheet:this,parent:this,classes:this.classes,keyframes:this.keyframes}),this.renderer=new n.Renderer(this),this.rules=new D(this.options),e)this.rules.add(r,e[r]);this.rules.process()}var n=e.prototype;return n.attach=function(){return this.attached?this:(this.renderer.attach(),this.attached=!0,this.deployed||this.deploy(),this)},n.detach=function(){return this.attached?(this.renderer.detach(),this.attached=!1,this):this},n.addRule=function(e,t,n){var r=this.queue;this.attached&&!r&&(this.queue=[]);var i=this.rules.add(e,t,n);return i?(this.options.jss.plugins.onProcessRule(i),this.attached?this.deployed?(r?r.push(i):(this.insertRule(i),this.queue&&(this.queue.forEach(this.insertRule,this),this.queue=void 0)),i):i:(this.deployed=!1,i)):null},n.insertRule=function(e){this.renderer.insertRule(e)},n.addRules=function(e,t){var n=[];for(var r in e){var i=this.addRule(r,e[r],t);i&&n.push(i)}return n},n.getRule=function(e){return this.rules.get(e)},n.deleteRule=function(e){var t=this.rules.get(e);return!!t&&(this.rules.remove(t),!this.attached||!t.renderable||this.renderer.deleteRule(t.renderable))},n.indexOf=function(e){return this.rules.indexOf(e)},n.deploy=function(){return this.renderer.deploy(),this.deployed=!0,this},n.update=function(){var e;return(e=this.rules).update.apply(e,arguments),this},n.toString=function(e){return this.rules.toString(e)},e}(),W=function(){function e(){this.plugins={internal:[],external:[]},this.registry=void 0}var t=e.prototype;return t.onCreateRule=function(e,t,n){for(var r=0;r<this.registry.onCreateRule.length;r++){var i=this.registry.onCreateRule[r](e,t,n);if(i)return i}return null},t.onProcessRule=function(e){if(!e.isProcessed){for(var t=e.options.sheet,n=0;n<this.registry.onProcessRule.length;n++)this.registry.onProcessRule[n](e,t);e.style&&this.onProcessStyle(e.style,e,t),e.isProcessed=!0}},t.onProcessStyle=function(e,t,n){for(var r=0;r<this.registry.onProcessStyle.length;r++)t.style=this.registry.onProcessStyle[r](t.style,t,n)},t.onProcessSheet=function(e){for(var t=0;t<this.registry.onProcessSheet.length;t++)this.registry.onProcessSheet[t](e)},t.onUpdate=function(e,t,n,r){for(var i=0;i<this.registry.onUpdate.length;i++)this.registry.onUpdate[i](e,t,n,r)},t.onChangeValue=function(e,t,n){for(var r=e,i=0;i<this.registry.onChangeValue.length;i++)r=this.registry.onChangeValue[i](r,t,n);return r},t.use=function(e,t){void 0===t&&(t={queue:"external"});var n=this.plugins[t.queue];-1===n.indexOf(e)&&(n.push(e),this.registry=[].concat(this.plugins.external,this.plugins.internal).reduce(function(e,t){for(var n in t)n in e&&e[n].push(t[n]);return e},{onCreateRule:[],onProcessRule:[],onProcessStyle:[],onProcessSheet:[],onChangeValue:[],onUpdate:[]}))},e}(),$=function(){function e(){this.registry=[]}var t=e.prototype;return t.add=function(e){var t=this.registry,n=e.options.index;if(-1===t.indexOf(e))if(0===t.length||n>=this.index)t.push(e);else for(var r=0;r<t.length;r++)if(t[r].options.index>n)return void t.splice(r,0,e)},t.reset=function(){this.registry=[]},t.remove=function(e){var t=this.registry.indexOf(e);this.registry.splice(t,1)},t.toString=function(e){return this.registry.filter(function(e){return e.attached}).map(function(t){return t.toString(e)}).join("\n")},a(e,[{key:"index",get:function(){return 0===this.registry.length?0:this.registry[this.registry.length-1].options.index}}]),e}(),F=new $,H="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},K="2f1acc6c3a606b082e5eef5e54414ffb";null==H[K]&&(H[K]=0);var Q=H[K]++,X=function(){var e=0;return function(t,n){e+=1;var r="c",i="";return n&&(r=n.options.classNamePrefix||"c",null!=n.options.jss.id&&(i+=n.options.jss.id)),""+r+Q+i+e}},Y=function(e){var t;return function(){return t||(t=e()),t}};function Z(e,t){try{return"attributeStyleMap"in e?e.attributeStyleMap.get(t):e.style.getPropertyValue(t)}catch(e){return""}}function ee(e,t,n){try{var r=n;if(Array.isArray(n)&&(r=d(n,!0),"!important"===n[n.length-1]))return e.style.setProperty(t,r,"important"),!0;"attributeStyleMap"in e?e.attributeStyleMap.set(t,r):e.style.setProperty(t,r)}catch(e){return!1}return!0}function te(e,t){try{"attributeStyleMap"in e?e.attributeStyleMap.delete(t):e.style.removeProperty(t)}catch(e){}}function ne(e,t){return e.selectorText=t,e.selectorText===t}var re=Y(function(){return document.querySelector("head")});function ie(e){var t=F.registry;if(t.length>0){var n=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(r.attached&&r.options.index>t.index&&r.options.insertionPoint===t.insertionPoint)return r}return null}(t,e);if(n)return{parent:n.renderer.element.parentNode,node:n.renderer.element};if(n=function(e,t){for(var n=e.length-1;n>=0;n--){var r=e[n];if(r.attached&&r.options.insertionPoint===t.insertionPoint)return r}return null}(t,e))return{parent:n.renderer.element.parentNode,node:n.renderer.element.nextSibling}}var r=e.insertionPoint;if(r&&"string"==typeof r){var i=function(e){for(var t=re(),n=0;n<t.childNodes.length;n++){var r=t.childNodes[n];if(8===r.nodeType&&r.nodeValue.trim()===e)return r}return null}(r);if(i)return{parent:i.parentNode,node:i.nextSibling}}return!1}var se=Y(function(){var e=document.querySelector('meta[property="csp-nonce"]');return e?e.getAttribute("content"):null}),oe=function(e,t,n){void 0===n&&(n=e.cssRules.length);try{if("insertRule"in e)e.insertRule(t,n);else if("appendRule"in e){e.appendRule(t)}}catch(e){return!1}return e.cssRules[n]},ue=function(){var e=document.createElement("style");return e.textContent="\n",e},ae=function(){function e(e){this.getPropertyValue=Z,this.setProperty=ee,this.removeProperty=te,this.setSelector=ne,this.element=void 0,this.sheet=void 0,this.hasInsertedRules=!1,e&&F.add(e),this.sheet=e;var t=this.sheet?this.sheet.options:{},n=t.media,r=t.meta,i=t.element;this.element=i||ue(),this.element.setAttribute("data-jss",""),n&&this.element.setAttribute("media",n),r&&this.element.setAttribute("data-meta",r);var s=se();s&&this.element.setAttribute("nonce",s)}var t=e.prototype;return t.attach=function(){!this.element.parentNode&&this.sheet&&(!function(e,t){var n=t.insertionPoint,r=ie(t);if(!1!==r&&r.parent)r.parent.insertBefore(e,r.node);else if(n&&"number"==typeof n.nodeType){var i=n,s=i.parentNode;s&&s.insertBefore(e,i.nextSibling)}else re().appendChild(e)}(this.element,this.sheet.options),this.hasInsertedRules&&(this.hasInsertedRules=!1,this.deploy()))},t.detach=function(){this.element.parentNode.removeChild(this.element)},t.deploy=function(){var e=this.sheet;e&&(e.options.link?this.insertRules(e.rules):this.element.textContent="\n"+e.toString()+"\n")},t.insertRules=function(e,t){for(var n=0;n<e.index.length;n++)this.insertRule(e.index[n],n,t)},t.insertRule=function(e,t,n){if(void 0===n&&(n=this.element.sheet),e.rules){var r=e,i=n;return("conditional"!==e.type&&"keyframes"!==e.type||!1!==(i=oe(n,r.toString({children:!1}),t)))&&(this.insertRules(r.rules,i),i)}var s=e.toString();if(!s)return!1;var o=oe(n,s,t);return!1!==o&&(this.hasInsertedRules=!0,e.renderable=o,o)},t.deleteRule=function(e){var t=this.element.sheet,n=this.indexOf(e);return-1!==n&&(t.deleteRule(n),!0)},t.indexOf=function(e){for(var t=this.element.sheet.cssRules,n=0;n<t.length;n++)if(e===t[n])return n;return-1},t.replaceRule=function(e,t){var n=this.indexOf(e);return-1!==n&&(this.element.sheet.deleteRule(n),this.insertRule(t,n))},t.getRules=function(){return this.element.sheet.cssRules},e}(),he=function(){function e(){}var t=e.prototype;return t.setProperty=function(){return!0},t.getPropertyValue=function(){return""},t.removeProperty=function(){},t.setSelector=function(){return!0},t.attach=function(){},t.detach=function(){},t.deploy=function(){},t.insertRule=function(){return!1},t.deleteRule=function(){return!0},t.replaceRule=function(){return!1},t.getRules=function(){},t.indexOf=function(){return-1},e}(),le=0,ce=function(){function e(e){this.id=le++,this.version="10.0.0-alpha.12",this.plugins=new W,this.options={createGenerateId:X,Renderer:r?ae:he,plugins:[]},this.generateId=X();for(var t=0;t<B.length;t++)this.plugins.use(B[t],{queue:"internal"});this.setup(e)}var n=e.prototype;return n.setup=function(e){return void 0===e&&(e={}),e.createGenerateId&&(this.options.createGenerateId=e.createGenerateId,this.generateId=e.createGenerateId()),null!=e.insertionPoint&&(this.options.insertionPoint=e.insertionPoint),(e.virtual||e.Renderer)&&(this.options.Renderer=e.Renderer||(e.virtual?he:ae)),e.plugins&&this.use.apply(this,e.plugins),this},n.createStyleSheet=function(e,n){void 0===n&&(n={});var r=n.index;"number"!=typeof r&&(r=0===F.index?0:F.index+1);var i=new L(e,t({},n,{jss:this,generateId:n.generateId||this.generateId,insertionPoint:this.options.insertionPoint,Renderer:this.options.Renderer,index:r}));return this.plugins.onProcessSheet(i),i},n.removeStyleSheet=function(e){return e.detach(),F.remove(e),this},n.createRule=function(e,n,r){if(void 0===n&&(n={}),void 0===r&&(r={}),"object"==typeof e)return this.createRule(void 0,e,n);var i=t({},r,{jss:this,Renderer:this.options.Renderer});i.generateId||(i.generateId=this.generateId),i.classes||(i.classes={}),i.keyframes||(i.keyframes={});var s=o(e,n,i);return s&&this.plugins.onProcessRule(s),s},n.use=function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return n.forEach(function(t){e.plugins.use(t)}),this},e}();var de=function(){function e(){this.length=0,this.sheets=new WeakMap}var t=e.prototype;return t.get=function(e){var t=this.sheets.get(e);return t&&t.sheet},t.add=function(e,t){this.sheets.has(e)||(this.length++,this.sheets.set(e,{sheet:t,refs:0}))},t.manage=function(e){var t=this.sheets.get(e);if(t)return 0===t.refs&&t.sheet.attach(),t.refs++,t.sheet},t.unmanage=function(e){var t=this.sheets.get(e);t&&t.refs>0&&(t.refs--,0===t.refs&&t.sheet.detach())},a(e,[{key:"size",get:function(){return this.length}}]),e}(),fe="undefined"!=typeof CSS&&CSS&&"number"in CSS,pe=function(e){return new ce(e)},ye=pe();e.hasCSSTOMSupport=fe,e.create=pe,e.default=ye,e.getDynamicStyles=function e(t){var n=null;for(var r in t){var i=t[r],s=typeof i;if("function"===s)n||(n={}),n[r]=i;else if("object"===s&&null!==i&&!Array.isArray(i)){var o=e(i);o&&(n||(n={}),n[r]=o)}}return n},e.toCssValue=d,e.createRule=o,e.SheetsRegistry=$,e.SheetsManager=de,e.RuleList=D,e.sheets=F,e.createGenerateId=X,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=e||self).jss={})}(this,function(e){"use strict";function t(){return(t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var n="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},r="object"===("undefined"==typeof window?"undefined":n(window))&&"object"===("undefined"==typeof document?"undefined":n(document))&&9===document.nodeType,i={}.constructor;function s(e){if(null==e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(s);if(e.constructor!==i)return e;var t={};for(var n in e)t[n]=s(e[n]);return t}function o(e,t,n){void 0===e&&(e="unnamed");var r=n.jss,i=s(t),o=r.plugins.onCreateRule(e,i,n);return o||(e[0],null)}function u(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e,t,n){return t&&u(e.prototype,t),n&&u(e,n),e}function h(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var d=function(e,t){for(var n="",r=0;r<e.length&&"!important"!==e[r];r++)n&&(n+=t),n+=e[r];return n};function c(e,t){if(void 0===t&&(t=!1),!Array.isArray(e))return e;var n="";if(Array.isArray(e[0]))for(var r=0;r<e.length&&"!important"!==e[r];r++)n&&(n+=", "),n+=d(e[r]," ");else n=d(e,", ");return t||"!important"!==e[e.length-1]||(n+=" !important"),n}function f(e,t){for(var n="",r=0;r<t;r++)n+=" ";return n+e}function p(e,t,n){void 0===n&&(n={});var r="";if(!t)return r;var i=n.indent,s=void 0===i?0:i,o=t.fallbacks;if(e&&s++,o)if(Array.isArray(o))for(var u=0;u<o.length;u++){var a=o[u];for(var h in a){var l=a[h];null!=l&&(r&&(r+="\n"),r+=""+f(h+": "+c(l)+";",s))}}else for(var d in o){var p=o[d];null!=p&&(r&&(r+="\n"),r+=""+f(d+": "+c(p)+";",s))}for(var y in t){var v=t[y];null!=v&&"fallbacks"!==y&&(r&&(r+="\n"),r+=""+f(y+": "+c(v)+";",s))}return(r||n.allowEmpty)&&e?(r&&(r="\n"+r+"\n"),f(e+" {"+r,--s)+f("}",s)):r}var y=function(e){return e},v=function(){function e(e,t,n){this.type="style",this.key=void 0,this.isProcessed=!1,this.style=void 0,this.renderer=void 0,this.renderable=void 0,this.options=void 0;var r=n.sheet,i=n.Renderer;this.key=e,this.options=n,this.style=t,r?this.renderer=r.renderer:i&&(this.renderer=new i)}return e.prototype.prop=function(e,t,n){if(void 0===t)return this.style[e];var r=!!n&&n.force;if(!r&&this.style[e]===t)return this;var i=t;n&&!1===n.process||(i=this.options.jss.plugins.onChangeValue(t,e,this));var s=null==i||!1===i,o=e in this.style;if(s&&!o&&!r)return this;var u=s&&o;if(u?delete this.style[e]:this.style[e]=i,this.renderable&&this.renderer)return u?this.renderer.removeProperty(this.renderable,e):this.renderer.setProperty(this.renderable,e,i),this;var a=this.options.sheet;return a&&a.attached,this},e}(),g=function(e){function n(t,n,r){var i;(i=e.call(this,t,n,r)||this).selectorText=void 0,i.id=void 0,i.renderable=void 0;var s=r.selector,o=r.scoped,u=r.sheet,a=r.generateId;return s?i.selectorText=s:!1!==o&&(i.id=a(l(l(i)),u),i.selectorText="."+y(i.id)),i}h(n,e);var r=n.prototype;return r.applyTo=function(e){var t=this.renderer;if(t){var n=this.toJSON();for(var r in n)t.setProperty(e,r,n[r])}return this},r.toJSON=function(){var e={};for(var t in this.style){var n=this.style[t];"object"!=typeof n?e[t]=n:Array.isArray(n)&&(e[t]=c(n))}return e},r.toString=function(e){var n=this.options.sheet,r=!!n&&n.options.link?t({},e,{allowEmpty:!0}):e;return p(this.selectorText,this.style,r)},a(n,[{key:"selector",set:function(e){if(e!==this.selectorText){this.selectorText=e;var t=this.renderer,n=this.renderable;if(n&&t)t.setSelector(n,e)||t.replaceRule(n,this)}},get:function(){return this.selectorText}}]),n}(v),m={onCreateRule:function(e,t,n){return"@"===e[0]||n.parent&&"keyframes"===n.parent.type?null:new g(e,t,n)}},R={indent:1,children:!0},S=/@([\w-]+)/,b=function(){function e(e,n,r){this.type="conditional",this.at=void 0,this.key=void 0,this.rules=void 0,this.options=void 0,this.isProcessed=!1,this.renderable=void 0,this.key=e;var i=e.match(S);for(var s in this.at=i?i[1]:"unknown",this.options=r,this.rules=new D(t({},r,{parent:this})),n)this.rules.add(s,n[s]);this.rules.process()}var n=e.prototype;return n.getRule=function(e){return this.rules.get(e)},n.indexOf=function(e){return this.rules.indexOf(e)},n.addRule=function(e,t,n){var r=this.rules.add(e,t,n);return r?(this.options.jss.plugins.onProcessRule(r),r):null},n.toString=function(e){if(void 0===e&&(e=R),!1===e.children)return this.key+" {}";var t=this.rules.toString(e);return t?this.key+" {\n"+t+"\n}":""},e}(),x=/@media|@supports\s+/,k={onCreateRule:function(e,t,n){return x.test(e)?new b(e,t,n):null}},P={indent:1,children:!0},w=/@keyframes\s+([\w-]+)/,j=function(){function e(e,n,r){this.type="keyframes",this.at="@keyframes",this.key=void 0,this.name=void 0,this.id=void 0,this.rules=void 0,this.options=void 0,this.isProcessed=!1,this.renderable=void 0;var i=e.match(w);i&&i[1]?this.name=i[1]:this.name="noname",this.key=this.type+"-"+this.name,this.options=r;var s=r.scoped,o=r.sheet,u=r.generateId;for(var a in this.id=!1===s?this.name:u(this,o),this.rules=new D(t({},r,{parent:this})),n)this.rules.add(a,n[a],t({},r,{parent:this}));this.rules.process()}return e.prototype.toString=function(e){if(void 0===e&&(e=P),!1===e.children)return this.at+" "+this.id+" {}";var t=this.rules.toString(e);return t&&(t="\n"+t+"\n"),this.at+" "+this.id+" {"+t+"}"},e}(),C=/@keyframes\s+/,A=/\$([\w-]+)/,O=function(e,t){if("string"==typeof e){var n=A.exec(e);if(!n)return e;if(n[1]in t)return e.replace(n[0],t[n[1]])}return e},I=function(e,t,n){var r=e[t],i=O(r,n);i!==r&&(e[t]=i)},T={onCreateRule:function(e,t,n){return"string"==typeof e&&C.test(e)?new j(e,t,n):null},onProcessStyle:function(e,t,n){return"style"===t.type&&n?("animation-name"in e&&I(e,"animation-name",n.keyframes),"animation"in e&&I(e,"animation",n.keyframes),e):e},onChangeValue:function(e,t,n){var r=n.options.sheet;if(!r)return e;switch(t){case"animation":case"animation-name":return O(e,r.keyframes);default:return e}}},q=function(e){function n(){for(var t,n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return(t=e.call.apply(e,[this].concat(r))||this).renderable=void 0,t}return h(n,e),n.prototype.toString=function(e){var n=this.options.sheet,r=!!n&&n.options.link?t({},e,{allowEmpty:!0}):e;return p(this.key,this.style,r)},n}(v),N={onCreateRule:function(e,t,n){return n.parent&&"keyframes"===n.parent.type?new q(e,t,n):null}},M=function(){function e(e,t,n){this.type="font-face",this.at="@font-face",this.key=void 0,this.style=void 0,this.options=void 0,this.isProcessed=!1,this.renderable=void 0,this.key=e,this.style=t,this.options=n}return e.prototype.toString=function(e){if(Array.isArray(this.style)){for(var t="",n=0;n<this.style.length;n++)t+=p(this.key,this.style[n]),this.style[n+1]&&(t+="\n");return t}return p(this.key,this.style,e)},e}(),V={onCreateRule:function(e,t,n){return"@font-face"===e?new M(e,t,n):null}},E=function(){function e(e,t,n){this.type="viewport",this.at="@viewport",this.key=void 0,this.style=void 0,this.options=void 0,this.isProcessed=!1,this.renderable=void 0,this.key=e,this.style=t,this.options=n}return e.prototype.toString=function(e){return p(this.key,this.style,e)},e}(),U={onCreateRule:function(e,t,n){return"@viewport"===e||"@-ms-viewport"===e?new E(e,t,n):null}},_=function(){function e(e,t,n){this.type="simple",this.key=void 0,this.value=void 0,this.options=void 0,this.isProcessed=!1,this.renderable=void 0,this.key=e,this.value=t,this.options=n}return e.prototype.toString=function(e){if(Array.isArray(this.value)){for(var t="",n=0;n<this.value.length;n++)t+=this.key+" "+this.value[n]+";",this.value[n+1]&&(t+="\n");return t}return this.key+" "+this.value+";"},e}(),G={"@charset":!0,"@import":!0,"@namespace":!0},B=[m,k,T,N,V,U,{onCreateRule:function(e,t,n){return e in G?new _(e,t,n):null}}],J={process:!0},z={force:!0,process:!0},D=function(){function e(e){this.map={},this.raw={},this.index=[],this.options=void 0,this.classes=void 0,this.keyframes=void 0,this.options=e,this.classes=e.classes,this.keyframes=e.keyframes}var n=e.prototype;return n.add=function(e,n,r){var i=this.options,s=i.parent,u=i.sheet,a=i.jss,h=i.Renderer,l=i.generateId,d=i.scoped,c=t({classes:this.classes,parent:s,sheet:u,jss:a,Renderer:h,generateId:l,scoped:d},r);this.raw[e]=n,e in this.classes&&(c.selector="."+y(this.classes[e]));var f=o(e,n,c);if(!f)return null;this.register(f);var p=void 0===c.index?this.index.length:c.index;return this.index.splice(p,0,f),f},n.get=function(e){return this.map[e]},n.remove=function(e){this.unregister(e),delete this.raw[e.key],this.index.splice(this.indexOf(e),1)},n.indexOf=function(e){return this.index.indexOf(e)},n.process=function(){var e=this.options.jss.plugins;this.index.slice(0).forEach(e.onProcessRule,e)},n.register=function(e){this.map[e.key]=e,e instanceof g?(this.map[e.selector]=e,e.id&&(this.classes[e.key]=e.id)):e instanceof j&&this.keyframes&&(this.keyframes[e.name]=e.id)},n.unregister=function(e){delete this.map[e.key],e instanceof g?(delete this.map[e.selector],delete this.classes[e.key]):e instanceof j&&delete this.keyframes[e.name]},n.update=function(){var e,t,n;if("string"==typeof(arguments.length<=0?void 0:arguments[0])?(e=arguments.length<=0?void 0:arguments[0],t=arguments.length<=1?void 0:arguments[1],n=arguments.length<=2?void 0:arguments[2]):(t=arguments.length<=0?void 0:arguments[0],n=arguments.length<=1?void 0:arguments[1],e=null),e)this.onUpdate(t,this.get(e),n);else for(var r=0;r<this.index.length;r++)this.onUpdate(t,this.index[r],n)},n.onUpdate=function(t,n,r){void 0===r&&(r=J);var i=this.options,s=i.jss.plugins,o=i.sheet;if(n.rules instanceof e)n.rules.update(t,r);else{var u=n,a=u.style;if(s.onUpdate(t,n,o,r),r.process&&a&&a!==u.style){for(var h in s.onProcessStyle(u.style,u,o),u.style){var l=u.style[h];l!==a[h]&&u.prop(h,l,z)}for(var d in a){var c=u.style[d],f=a[d];null==c&&c!==f&&u.prop(d,null,z)}}}},n.toString=function(e){for(var t="",n=this.options.sheet,r=!!n&&n.options.link,i=0;i<this.index.length;i++){var s=this.index[i].toString(e);(s||r)&&(t&&(t+="\n"),t+=s)}return t},e}(),L=function(){function e(e,n){for(var r in this.options=void 0,this.deployed=void 0,this.attached=void 0,this.rules=void 0,this.renderer=void 0,this.classes=void 0,this.keyframes=void 0,this.queue=void 0,this.attached=!1,this.deployed=!1,this.classes={},this.keyframes={},this.options=t({},n,{sheet:this,parent:this,classes:this.classes,keyframes:this.keyframes}),n.Renderer&&(this.renderer=new n.Renderer(this)),this.rules=new D(this.options),e)this.rules.add(r,e[r]);this.rules.process()}var n=e.prototype;return n.attach=function(){return this.attached||!this.renderer?this:(this.renderer.attach(),this.attached=!0,this.deployed||this.deploy(),this)},n.detach=function(){return this.attached&&this.renderer?(this.renderer.detach(),this.attached=!1,this):this},n.addRule=function(e,t,n){var r=this.queue;this.attached&&!r&&(this.queue=[]);var i=this.rules.add(e,t,n);return i?(this.options.jss.plugins.onProcessRule(i),this.attached?this.deployed?(r?r.push(i):(this.insertRule(i),this.queue&&(this.queue.forEach(this.insertRule,this),this.queue=void 0)),i):i:(this.deployed=!1,i)):null},n.insertRule=function(e){this.renderer&&this.renderer.insertRule(e)},n.addRules=function(e,t){var n=[];for(var r in e){var i=this.addRule(r,e[r],t);i&&n.push(i)}return n},n.getRule=function(e){return this.rules.get(e)},n.deleteRule=function(e){var t=this.rules.get(e);return!!t&&(this.rules.remove(t),!(this.attached&&t.renderable&&this.renderer)||this.renderer.deleteRule(t.renderable))},n.indexOf=function(e){return this.rules.indexOf(e)},n.deploy=function(){return this.renderer&&(this.renderer.deploy(),this.deployed=!0),this},n.update=function(){var e;return(e=this.rules).update.apply(e,arguments),this},n.toString=function(e){return this.rules.toString(e)},e}(),W=function(){function e(){this.plugins={internal:[],external:[]},this.registry=void 0}var t=e.prototype;return t.onCreateRule=function(e,t,n){for(var r=0;r<this.registry.onCreateRule.length;r++){var i=this.registry.onCreateRule[r](e,t,n);if(i)return i}return null},t.onProcessRule=function(e){if(!e.isProcessed){for(var t=e.options.sheet,n=0;n<this.registry.onProcessRule.length;n++)this.registry.onProcessRule[n](e,t);e.style&&this.onProcessStyle(e.style,e,t),e.isProcessed=!0}},t.onProcessStyle=function(e,t,n){for(var r=0;r<this.registry.onProcessStyle.length;r++)t.style=this.registry.onProcessStyle[r](t.style,t,n)},t.onProcessSheet=function(e){for(var t=0;t<this.registry.onProcessSheet.length;t++)this.registry.onProcessSheet[t](e)},t.onUpdate=function(e,t,n,r){for(var i=0;i<this.registry.onUpdate.length;i++)this.registry.onUpdate[i](e,t,n,r)},t.onChangeValue=function(e,t,n){for(var r=e,i=0;i<this.registry.onChangeValue.length;i++)r=this.registry.onChangeValue[i](r,t,n);return r},t.use=function(e,t){void 0===t&&(t={queue:"external"});var n=this.plugins[t.queue];-1===n.indexOf(e)&&(n.push(e),this.registry=[].concat(this.plugins.external,this.plugins.internal).reduce(function(e,t){for(var n in t)n in e&&e[n].push(t[n]);return e},{onCreateRule:[],onProcessRule:[],onProcessStyle:[],onProcessSheet:[],onChangeValue:[],onUpdate:[]}))},e}(),$=function(){function e(){this.registry=[]}var t=e.prototype;return t.add=function(e){var t=this.registry,n=e.options.index;if(-1===t.indexOf(e))if(0===t.length||n>=this.index)t.push(e);else for(var r=0;r<t.length;r++)if(t[r].options.index>n)return void t.splice(r,0,e)},t.reset=function(){this.registry=[]},t.remove=function(e){var t=this.registry.indexOf(e);this.registry.splice(t,1)},t.toString=function(e){return this.registry.filter(function(e){return e.attached}).map(function(t){return t.toString(e)}).join("\n")},a(e,[{key:"index",get:function(){return 0===this.registry.length?0:this.registry[this.registry.length-1].options.index}}]),e}(),F=new $,H="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},K="2f1acc6c3a606b082e5eef5e54414ffb";null==H[K]&&(H[K]=0);var Q=H[K]++,X=function(){var e=0;return function(t,n){e+=1;var r="c",i="";return n&&(r=n.options.classNamePrefix||"c",null!=n.options.jss.id&&(i+=n.options.jss.id)),""+r+Q+i+e}},Y=function(e){var t;return function(){return t||(t=e()),t}};function Z(e,t){try{return e.attributeStyleMap?e.attributeStyleMap.get(t):e.style.getPropertyValue(t)}catch(e){return""}}function ee(e,t,n){try{var r=n;if(Array.isArray(n)&&(r=c(n,!0),"!important"===n[n.length-1]))return e.style.setProperty(t,r,"important"),!0;e.attributeStyleMap?e.attributeStyleMap.set(t,r):e.style.setProperty(t,r)}catch(e){return!1}return!0}function te(e,t){try{e.attributeStyleMap?e.attributeStyleMap.delete(t):e.style.removeProperty(t)}catch(e){}}function ne(e,t){return e.selectorText=t,e.selectorText===t}var re=Y(function(){return document.querySelector("head")});function ie(e){var t=F.registry;if(t.length>0){var n=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(r.attached&&r.options.index>t.index&&r.options.insertionPoint===t.insertionPoint)return r}return null}(t,e);if(n&&n.renderer)return{parent:n.renderer.element.parentNode,node:n.renderer.element};if((n=function(e,t){for(var n=e.length-1;n>=0;n--){var r=e[n];if(r.attached&&r.options.insertionPoint===t.insertionPoint)return r}return null}(t,e))&&n.renderer)return{parent:n.renderer.element.parentNode,node:n.renderer.element.nextSibling}}var r=e.insertionPoint;if(r&&"string"==typeof r){var i=function(e){for(var t=re(),n=0;n<t.childNodes.length;n++){var r=t.childNodes[n];if(8===r.nodeType&&r.nodeValue.trim()===e)return r}return null}(r);if(i)return{parent:i.parentNode,node:i.nextSibling}}return!1}var se=Y(function(){var e=document.querySelector('meta[property="csp-nonce"]');return e?e.getAttribute("content"):null}),oe=function(e,t,n){void 0===n&&(n=e.cssRules.length);try{if("insertRule"in e)e.insertRule(t,n);else if("appendRule"in e){e.appendRule(t)}}catch(e){return!1}return e.cssRules[n]},ue=function(){var e=document.createElement("style");return e.textContent="\n",e},ae=function(){function e(e){this.getPropertyValue=Z,this.setProperty=ee,this.removeProperty=te,this.setSelector=ne,this.element=void 0,this.sheet=void 0,this.hasInsertedRules=!1,e&&F.add(e),this.sheet=e;var t=this.sheet?this.sheet.options:{},n=t.media,r=t.meta,i=t.element;this.element=i||ue(),this.element.setAttribute("data-jss",""),n&&this.element.setAttribute("media",n),r&&this.element.setAttribute("data-meta",r);var s=se();s&&this.element.setAttribute("nonce",s)}var t=e.prototype;return t.attach=function(){!this.element.parentNode&&this.sheet&&(!function(e,t){var n=t.insertionPoint,r=ie(t);if(!1!==r&&r.parent)r.parent.insertBefore(e,r.node);else if(n&&"number"==typeof n.nodeType){var i=n,s=i.parentNode;s&&s.insertBefore(e,i.nextSibling)}else re().appendChild(e)}(this.element,this.sheet.options),this.hasInsertedRules&&(this.hasInsertedRules=!1,this.deploy()))},t.detach=function(){this.element.parentNode.removeChild(this.element)},t.deploy=function(){var e=this.sheet;e&&(e.options.link?this.insertRules(e.rules):this.element.textContent="\n"+e.toString()+"\n")},t.insertRules=function(e,t){for(var n=0;n<e.index.length;n++)this.insertRule(e.index[n],n,t)},t.insertRule=function(e,t,n){if(void 0===n&&(n=this.element.sheet),e.rules){var r=e,i=n;return("conditional"!==e.type&&"keyframes"!==e.type||!1!==(i=oe(n,r.toString({children:!1}),t)))&&(this.insertRules(r.rules,i),i)}var s=e.toString();if(!s)return!1;var o=oe(n,s,t);return!1!==o&&(this.hasInsertedRules=!0,e.renderable=o,o)},t.deleteRule=function(e){var t=this.element.sheet,n=this.indexOf(e);return-1!==n&&(t.deleteRule(n),!0)},t.indexOf=function(e){for(var t=this.element.sheet.cssRules,n=0;n<t.length;n++)if(e===t[n])return n;return-1},t.replaceRule=function(e,t){var n=this.indexOf(e);return-1!==n&&(this.element.sheet.deleteRule(n),this.insertRule(t,n))},t.getRules=function(){return this.element.sheet.cssRules},e}(),he=0,le=function(){function e(e){this.id=he++,this.version="10.0.0-alpha.13",this.plugins=new W,this.options={createGenerateId:X,Renderer:r?ae:null,plugins:[]},this.generateId=X();for(var t=0;t<B.length;t++)this.plugins.use(B[t],{queue:"internal"});this.setup(e)}var n=e.prototype;return n.setup=function(e){void 0===e&&(e={});var t=e.createGenerateId;return t&&(this.options.createGenerateId=t,this.generateId=t()),null!=e.insertionPoint&&(this.options.insertionPoint=e.insertionPoint),"Renderer"in e&&(this.options.Renderer=e.Renderer),e.plugins&&this.use.apply(this,e.plugins),this},n.createStyleSheet=function(e,n){void 0===n&&(n={});var r=n.index;"number"!=typeof r&&(r=0===F.index?0:F.index+1);var i=new L(e,t({},n,{jss:this,generateId:n.generateId||this.generateId,insertionPoint:this.options.insertionPoint,Renderer:this.options.Renderer,index:r}));return this.plugins.onProcessSheet(i),i},n.removeStyleSheet=function(e){return e.detach(),F.remove(e),this},n.createRule=function(e,n,r){if(void 0===n&&(n={}),void 0===r&&(r={}),"object"==typeof e)return this.createRule(void 0,e,n);var i=t({},r,{jss:this,Renderer:this.options.Renderer});i.generateId||(i.generateId=this.generateId),i.classes||(i.classes={}),i.keyframes||(i.keyframes={});var s=o(e,n,i);return s&&this.plugins.onProcessRule(s),s},n.use=function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return n.forEach(function(t){e.plugins.use(t)}),this},e}();var de=function(){function e(){this.length=0,this.sheets=new WeakMap}var t=e.prototype;return t.get=function(e){var t=this.sheets.get(e);return t&&t.sheet},t.add=function(e,t){this.sheets.has(e)||(this.length++,this.sheets.set(e,{sheet:t,refs:0}))},t.manage=function(e){var t=this.sheets.get(e);if(t)return 0===t.refs&&t.sheet.attach(),t.refs++,t.sheet},t.unmanage=function(e){var t=this.sheets.get(e);t&&t.refs>0&&(t.refs--,0===t.refs&&t.sheet.detach())},a(e,[{key:"size",get:function(){return this.length}}]),e}(),ce="undefined"!=typeof CSS&&CSS&&"number"in CSS,fe=function(e){return new le(e)},pe=fe();e.hasCSSTOMSupport=ce,e.create=fe,e.default=pe,e.getDynamicStyles=function e(t){var n=null;for(var r in t){var i=t[r],s=typeof i;if("function"===s)n||(n={}),n[r]=i;else if("object"===s&&null!==i&&!Array.isArray(i)){var o=e(i);o&&(n||(n={}),n[r]=o)}}return n},e.toCssValue=c,e.createRule=o,e.SheetsRegistry=$,e.SheetsManager=de,e.RuleList=D,e.sheets=F,e.createGenerateId=X,Object.defineProperty(e,"__esModule",{value:!0})}); |
{ | ||
"name": "jss", | ||
"description": "A lib for generating Style Sheets with JavaScript.", | ||
"version": "10.0.0-alpha.12", | ||
"version": "10.0.0-alpha.13", | ||
"license": "MIT", | ||
@@ -47,3 +47,3 @@ "homepage": "https://cssinjs.org/", | ||
}, | ||
"gitHead": "e6bf06abb8440633e1a0b332632d6d382522e20e" | ||
"gitHead": "37f000839b1970298782bf85f929c828060ffe3a" | ||
} |
@@ -12,3 +12,3 @@ # jss | ||
See our website [jss](https://cssinjs.org/setup?v=v10.0.0-alpha.12) for more information. | ||
See our website [jss](https://cssinjs.org/setup?v=v10.0.0-alpha.13) for more information. | ||
@@ -15,0 +15,0 @@ ## Install |
@@ -203,4 +203,3 @@ export type Style = {[key: string]: Style | any} | ||
plugins: ReadonlyArray<Plugin> | ||
virtual: boolean | ||
Renderer?: Renderer | ||
Renderer?: Renderer | null | ||
insertionPoint: InsertionPoint | ||
@@ -207,0 +206,0 @@ } |
@@ -9,4 +9,3 @@ /* @flow */ | ||
import createRule from './utils/createRule' | ||
import DomRenderer from './renderers/DomRenderer' | ||
import VirtualRenderer from './renderers/VirtualRenderer' | ||
import DomRenderer from './DomRenderer' | ||
import type { | ||
@@ -35,3 +34,3 @@ Rule, | ||
createGenerateId: createGenerateIdDefault, | ||
Renderer: isInBrowser ? DomRenderer : VirtualRenderer, | ||
Renderer: isInBrowser ? DomRenderer : null, | ||
plugins: [] | ||
@@ -55,11 +54,11 @@ } | ||
setup(options?: JssOptions = {}): this { | ||
if (options.createGenerateId) { | ||
this.options.createGenerateId = options.createGenerateId | ||
// $FlowFixMe | ||
this.generateId = options.createGenerateId() | ||
const {createGenerateId} = options | ||
if (createGenerateId) { | ||
this.options.createGenerateId = createGenerateId | ||
this.generateId = createGenerateId() | ||
} | ||
if (options.insertionPoint != null) this.options.insertionPoint = options.insertionPoint | ||
if (options.virtual || options.Renderer) { | ||
this.options.Renderer = options.Renderer || (options.virtual ? VirtualRenderer : DomRenderer) | ||
if ('Renderer' in options) { | ||
this.options.Renderer = options.Renderer | ||
} | ||
@@ -66,0 +65,0 @@ |
/* @flow */ | ||
import type {CSSSimpleRule, RuleOptions, JssStyle, ToCssOptions, BaseRule} from '../types' | ||
import type { | ||
CSSCharsetRule, | ||
CSSImportRule, | ||
CSSNamespaceRule, | ||
RuleOptions, | ||
JssStyle, | ||
ToCssOptions, | ||
BaseRule | ||
} from '../types' | ||
@@ -15,3 +23,3 @@ export class SimpleRule implements BaseRule { | ||
renderable: ?CSSSimpleRule | ||
renderable: ?CSSCharsetRule | CSSImportRule | CSSNamespaceRule | ||
@@ -18,0 +26,0 @@ constructor(key: string, value: string, options: RuleOptions) { |
@@ -8,2 +8,3 @@ /* @flow */ | ||
CSSStyleRule, | ||
HTMLElementWithStyleMap, | ||
ToCssOptions, | ||
@@ -27,3 +28,3 @@ RuleOptions, | ||
renderer: RendererInterface | ||
renderer: RendererInterface | null | ||
@@ -39,3 +40,4 @@ renderable: ?Object | ||
this.style = style | ||
this.renderer = sheet ? sheet.renderer : new Renderer() | ||
if (sheet) this.renderer = sheet.renderer | ||
else if (Renderer) this.renderer = new Renderer() | ||
} | ||
@@ -72,3 +74,3 @@ | ||
// Renderable is defined if StyleSheet option `link` is true. | ||
if (this.renderable) { | ||
if (this.renderable && this.renderer) { | ||
if (remove) this.renderer.removeProperty(this.renderable, name) | ||
@@ -115,9 +117,11 @@ else this.renderer.setProperty(this.renderable, name, newValue) | ||
if (!this.renderable) return | ||
const {renderer, renderable} = this | ||
const hasChanged = this.renderer.setSelector(this.renderable, selector) | ||
if (!renderable || !renderer) return | ||
const hasChanged = renderer.setSelector(renderable, selector) | ||
// If selector setter is not implemented, rerender the rule. | ||
if (!hasChanged) { | ||
this.renderer.replaceRule(((this.renderable: any): CSSRule), this) | ||
renderer.replaceRule(renderable, this) | ||
} | ||
@@ -136,5 +140,10 @@ } | ||
*/ | ||
applyTo(renderable: HTMLElement): this { | ||
const json = this.toJSON() | ||
for (const prop in json) this.renderer.setProperty(renderable, prop, json[prop]) | ||
applyTo(renderable: HTMLElementWithStyleMap): this { | ||
const {renderer} = this | ||
if (renderer) { | ||
const json = this.toJSON() | ||
for (const prop in json) { | ||
renderer.setProperty(renderable, prop, json[prop]) | ||
} | ||
} | ||
return this | ||
@@ -141,0 +150,0 @@ } |
@@ -12,3 +12,5 @@ /* @flow */ | ||
Classes, | ||
KeyframesMap | ||
KeyframesMap, | ||
JssStyles, | ||
Renderer | ||
} from './types' | ||
@@ -25,3 +27,3 @@ | ||
renderer: Object | ||
renderer: Renderer | null | ||
@@ -34,3 +36,3 @@ classes: Classes | ||
constructor(styles: Object, options: StyleSheetOptions) { | ||
constructor(styles: JssStyles, options: StyleSheetOptions) { | ||
this.attached = false | ||
@@ -47,3 +49,5 @@ this.deployed = false | ||
} | ||
this.renderer = new options.Renderer(this) | ||
if (options.Renderer) { | ||
this.renderer = new options.Renderer(this) | ||
} | ||
this.rules = new RuleList(this.options) | ||
@@ -62,3 +66,3 @@ | ||
attach(): this { | ||
if (this.attached) return this | ||
if (this.attached || !this.renderer) return this | ||
this.renderer.attach() | ||
@@ -75,3 +79,3 @@ this.attached = true | ||
detach(): this { | ||
if (!this.attached) return this | ||
if (!this.attached || !this.renderer) return this | ||
this.renderer.detach() | ||
@@ -126,3 +130,5 @@ this.attached = false | ||
insertRule(rule: Rule) { | ||
this.renderer.insertRule(rule) | ||
if (this.renderer) { | ||
this.renderer.insertRule(rule) | ||
} | ||
} | ||
@@ -134,3 +140,3 @@ | ||
*/ | ||
addRules(styles: Object, options?: RuleOptions): Array<Rule> { | ||
addRules(styles: JssStyles, options?: RuleOptions): Array<Rule> { | ||
const added = [] | ||
@@ -162,3 +168,3 @@ for (const name in styles) { | ||
if (this.attached && rule.renderable) { | ||
if (this.attached && rule.renderable && this.renderer) { | ||
return this.renderer.deleteRule(rule.renderable) | ||
@@ -181,4 +187,6 @@ } | ||
deploy(): this { | ||
this.renderer.deploy() | ||
this.deployed = true | ||
if (this.renderer) { | ||
this.renderer.deploy() | ||
this.deployed = true | ||
} | ||
return this | ||
@@ -185,0 +193,0 @@ } |
// @flow | ||
export type DOMString = string | ||
import type {DOMString} from './dom' | ||
export interface StylePropertyMap { | ||
get(property: DOMString): DOMString; | ||
set(property: DOMString, value: DOMString): DOMString; | ||
delete(property: DOMString): void; | ||
} | ||
export interface CSSRuleBase<T> { | ||
@@ -10,2 +16,3 @@ +type: $PropertyType<T, 'type'>; | ||
cssText: DOMString; | ||
attributeStyleMap: StylePropertyMap; | ||
} | ||
@@ -84,2 +91,10 @@ | ||
export type CSSSimpleRule = CSSCharsetRule | CSSImportRule | CSSNamespaceRule | ||
export type AnyCSSRule = | ||
| CSSMediaRule | ||
| CSSFontFaceRule | ||
| CSSKeyframesRule | ||
| CSSCharsetRule | ||
| CSSImportRule | ||
| CSSNamespaceRule | ||
| CSSStyleRule | ||
| CSSViewportRule |
// @flow | ||
export * from './cssom.js' | ||
export * from './jss.js' | ||
export * from './cssom' | ||
export * from './dom' | ||
export * from './jss' |
@@ -10,3 +10,4 @@ /* @flow */ | ||
import type {FontFaceRule} from '../plugins/fontFaceRule' | ||
import type {CSSStyleRule, CSSMediaRule, CSSKeyframesRule} from './cssom' | ||
import type {CSSStyleRule, AnyCSSRule} from './cssom' | ||
import type {HTMLElementWithStyleMap} from './dom' | ||
import type RuleList from '../RuleList' | ||
@@ -64,2 +65,4 @@ | ||
export type JssStyles = {[string]: JssStyle} | ||
export type JssValue = | ||
@@ -75,16 +78,19 @@ | string | ||
constructor(sheet?: StyleSheet): void; | ||
setProperty(cssRule: HTMLElement | CSSStyleRule, prop: string, value: JssValue): boolean; | ||
getPropertyValue(cssRule: HTMLElement | CSSStyleRule, prop: string): string; | ||
removeProperty(cssRule: HTMLElement | CSSStyleRule, prop: string): void; | ||
// HTMLStyleElement needs fixing https://github.com/facebook/flow/issues/2696 | ||
element: any; | ||
setProperty( | ||
cssRule: HTMLElementWithStyleMap | CSSStyleRule, | ||
prop: string, | ||
value: JssValue | ||
): boolean; | ||
getPropertyValue(cssRule: HTMLElementWithStyleMap | CSSStyleRule, prop: string): string; | ||
removeProperty(cssRule: HTMLElementWithStyleMap | CSSStyleRule, prop: string): void; | ||
setSelector(cssRule: CSSStyleRule, selectorText: string): boolean; | ||
attach(): void; | ||
detach(): void; | ||
deploy(sheet: StyleSheet): void; | ||
insertRule(rule: Rule): false | CSSStyleSheet | CSSMediaRule | CSSKeyframesRule | CSSRule; | ||
deleteRule(cssRule: CSSRule): boolean; | ||
replaceRule( | ||
cssRule: CSSRule, | ||
rule: Rule | ||
): false | CSSStyleSheet | CSSMediaRule | CSSKeyframesRule | CSSRule; | ||
indexOf(cssRule: CSSRule): number; | ||
deploy(): void; | ||
insertRule(rule: Rule): false | CSSStyleSheet | AnyCSSRule; | ||
deleteRule(cssRule: AnyCSSRule): boolean; | ||
replaceRule(cssRule: AnyCSSRule, rule: Rule): false | CSSStyleSheet | AnyCSSRule; | ||
indexOf(cssRule: AnyCSSRule): number; | ||
getRules(): CSSRuleList | void; | ||
@@ -101,3 +107,3 @@ } | ||
generateId?: GenerateId, | ||
Renderer?: Class<Renderer> | ||
Renderer?: Class<Renderer> | null | ||
} | ||
@@ -120,3 +126,3 @@ | ||
generateId: GenerateId, | ||
Renderer: Class<Renderer> | ||
Renderer?: Class<Renderer> | null | ||
} | ||
@@ -129,3 +135,3 @@ | ||
generateId: GenerateId, | ||
Renderer: Class<Renderer>, | ||
Renderer?: Class<Renderer> | null, | ||
jss: Jss, | ||
@@ -143,3 +149,3 @@ sheet: StyleSheet, | ||
export type Plugin = { | ||
export type Plugin = {| | ||
onCreateRule?: OnCreateRule, | ||
@@ -151,5 +157,5 @@ onProcessRule?: OnProcessRule, | ||
onUpdate?: OnUpdate | ||
} | ||
|} | ||
export type InsertionPoint = string | HTMLElement | ||
export type InsertionPoint = string | HTMLElementWithStyleMap | ||
@@ -162,12 +168,11 @@ type CreateGenerateId = () => GenerateId | ||
insertionPoint?: InsertionPoint, | ||
Renderer?: Class<Renderer>, | ||
virtual?: Boolean | ||
Renderer?: Class<Renderer> | null | ||
} | ||
export type InternalJssOptions = { | ||
export type InternalJssOptions = {| | ||
createGenerateId: CreateGenerateId, | ||
plugins: Array<Plugin>, | ||
insertionPoint?: InsertionPoint, | ||
Renderer: Class<Renderer> | ||
} | ||
Renderer?: Class<Renderer> | null | ||
|} | ||
@@ -184,3 +189,3 @@ export type StyleSheetFactoryOptions = { | ||
export type StyleSheetOptions = { | ||
export type StyleSheetOptions = {| | ||
media?: string, | ||
@@ -193,8 +198,8 @@ meta?: string, | ||
classNamePrefix?: string, | ||
Renderer: Class<Renderer>, | ||
Renderer?: Class<Renderer> | null, | ||
insertionPoint?: InsertionPoint, | ||
jss: Jss | ||
} | ||
|} | ||
export type InternalStyleSheetOptions = { | ||
export type InternalStyleSheetOptions = {| | ||
media?: string, | ||
@@ -206,3 +211,3 @@ meta?: string, | ||
insertionPoint?: InsertionPoint, | ||
Renderer: Class<Renderer>, | ||
Renderer?: Class<Renderer> | null, | ||
generateId: GenerateId, | ||
@@ -213,3 +218,4 @@ classNamePrefix?: string, | ||
parent: ConditionalRule | KeyframesRule | StyleSheet, | ||
classes: Classes | ||
} | ||
classes: Classes, | ||
keyframes: KeyframesMap | ||
|} |
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
428530
9659