jss-plugin-global
Advanced tools
Comparing version 10.0.0 to 10.0.1
@@ -448,2 +448,3 @@ function _extends() { | ||
this.key = void 0; | ||
this.query = void 0; | ||
this.rules = void 0; | ||
@@ -453,3 +454,5 @@ this.options = void 0; | ||
this.renderable = void 0; | ||
this.key = key; | ||
this.key = key; // Key might contain a unique suffix in case the `name` passed by user was duplicate. | ||
this.query = options.name; | ||
var atMatch = key.match(atRegExp); | ||
@@ -511,7 +514,7 @@ this.at = atMatch ? atMatch[1] : 'unknown'; | ||
if (options.children === false) { | ||
return this.key + " {}"; | ||
return this.query + " {}"; | ||
} | ||
var children = this.rules.toString(options); | ||
return children ? this.key + " {\n" + children + "\n}" : ''; | ||
return children ? this.query + " {\n" + children + "\n}" : ''; | ||
}; | ||
@@ -866,2 +869,3 @@ | ||
this.index = []; | ||
this.counter = 0; | ||
this.options = void 0; | ||
@@ -883,3 +887,3 @@ this.classes = void 0; | ||
_proto.add = function add(key, decl, ruleOptions) { | ||
_proto.add = function add(name, decl, ruleOptions) { | ||
var _this$options = this.options, | ||
@@ -900,4 +904,14 @@ parent = _this$options.parent, | ||
generateId: generateId, | ||
scoped: scoped | ||
}, ruleOptions); // We need to save the original decl before creating the rule | ||
scoped: scoped, | ||
name: name | ||
}, ruleOptions); // When user uses .createStyleSheet(), duplicate names are not possible, but | ||
// `sheet.addRule()` opens the door for any duplicate rule name. When this happens | ||
// we need to make the key unique within this RuleList instance scope. | ||
var key = name; | ||
if (name in this.raw) { | ||
key = name + "-d" + this.counter++; | ||
} // We need to save the original decl before creating the rule | ||
// because cache plugin needs to use it as a key to return a cached rule. | ||
@@ -909,3 +923,3 @@ | ||
if (key in this.classes) { | ||
// For e.g. rules inside of @media container | ||
// E.g. rules inside of @media container | ||
options.selector = "." + escape(this.classes[key]); | ||
@@ -937,3 +951,3 @@ } | ||
delete this.raw[rule.key]; | ||
this.index.splice(this.indexOf(rule), 1); | ||
this.index.splice(this.index.indexOf(rule), 1); | ||
} | ||
@@ -960,3 +974,3 @@ /** | ||
/** | ||
* Register a rule in `.map` and `.classes` maps. | ||
* Register a rule in `.map`, `.classes` and `.keyframes` maps. | ||
*/ | ||
@@ -1014,6 +1028,6 @@ ; | ||
if (name) { | ||
this.onUpdate(data, this.get(name), options); | ||
this.updateOne(this.map[name], data, options); | ||
} else { | ||
for (var index = 0; index < this.index.length; index++) { | ||
this.onUpdate(data, this.index[index], options); | ||
this.updateOne(this.index[index], data, options); | ||
} | ||
@@ -1027,3 +1041,3 @@ } | ||
_proto.onUpdate = function onUpdate(data, rule, options) { | ||
_proto.updateOne = function updateOne(rule, data, options) { | ||
if (options === void 0) { | ||
@@ -1109,2 +1123,4 @@ options = defaultUpdateOptions; | ||
this.queue = void 0; | ||
this.update = void 0; | ||
this.updateOne = void 0; | ||
this.attached = false; | ||
@@ -1126,2 +1142,4 @@ this.deployed = false; | ||
this.rules = new RuleList(this.options); | ||
this.update = this.rules.update.bind(this.rules); | ||
this.updateOne = this.rules.updateOne.bind(this.rules); | ||
@@ -1237,3 +1255,3 @@ for (var name in styles) { | ||
_proto.deleteRule = function deleteRule(name) { | ||
var rule = this.rules.get(name); | ||
var rule = typeof name === 'object' ? name : this.rules.get(name); | ||
if (!rule) return false; | ||
@@ -1267,14 +1285,2 @@ this.rules.remove(rule); | ||
/** | ||
* Update the function values with a new data. | ||
*/ | ||
; | ||
_proto.update = function update() { | ||
var _this$rules; | ||
(_this$rules = this.rules).update.apply(_this$rules, arguments); | ||
return this; | ||
} | ||
/** | ||
* Convert rules to a CSS string. | ||
@@ -2026,3 +2032,3 @@ */ | ||
this.id = instanceCounter++; | ||
this.version = "10.0.0"; | ||
this.version = "10.0.1"; | ||
this.plugins = new PluginsRegistry(); | ||
@@ -2124,2 +2130,3 @@ this.options = { | ||
* Create a rule without a Style Sheet. | ||
* [Deprecated] will be removed in the next major version. | ||
*/ | ||
@@ -2143,2 +2150,3 @@ ; | ||
var ruleOptions = _extends({}, options, { | ||
name: name, | ||
jss: this, | ||
@@ -2145,0 +2153,0 @@ Renderer: this.options.Renderer |
{ | ||
"name": "jss-plugin-global", | ||
"description": "Global styles for JSS", | ||
"version": "10.0.0", | ||
"version": "10.0.1", | ||
"license": "MIT", | ||
@@ -38,9 +38,9 @@ "homepage": "https://cssinjs.org/jss-global", | ||
"devDependencies": { | ||
"jss-plugin-nested": "10.0.0" | ||
"jss-plugin-nested": "10.0.1" | ||
}, | ||
"dependencies": { | ||
"@babel/runtime": "^7.3.1", | ||
"jss": "10.0.0" | ||
"jss": "10.0.1" | ||
}, | ||
"gitHead": "9562e1d1ba2a137fbc459ed83cd3a61cb894cdb2" | ||
"gitHead": "caaa314acc24deda0c8a6b11afe9c15787598741" | ||
} |
@@ -12,3 +12,3 @@ # jss-plugin-global | ||
See our website [jss-plugin-global](https://cssinjs.org/jss-plugin-global?v=v10.0.0) for more information. | ||
See our website [jss-plugin-global](https://cssinjs.org/jss-plugin-global?v=v10.0.1) for more information. | ||
@@ -15,0 +15,0 @@ ## Install |
101862
2973
+ Addedjss@10.0.1(transitive)
- Removedjss@10.0.0(transitive)
Updatedjss@10.0.1