jss-plugin-rule-value-observable
Advanced tools
Comparing version 10.0.0 to 10.0.1
@@ -484,2 +484,3 @@ function symbolObservablePonyfill(root) { | ||
this.key = void 0; | ||
this.query = void 0; | ||
this.rules = void 0; | ||
@@ -489,3 +490,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); | ||
@@ -547,7 +550,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}" : ''; | ||
}; | ||
@@ -902,2 +905,3 @@ | ||
this.index = []; | ||
this.counter = 0; | ||
this.options = void 0; | ||
@@ -919,3 +923,3 @@ this.classes = void 0; | ||
_proto.add = function add(key, decl, ruleOptions) { | ||
_proto.add = function add(name, decl, ruleOptions) { | ||
var _this$options = this.options, | ||
@@ -936,4 +940,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. | ||
@@ -945,3 +959,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]); | ||
@@ -973,3 +987,3 @@ } | ||
delete this.raw[rule.key]; | ||
this.index.splice(this.indexOf(rule), 1); | ||
this.index.splice(this.index.indexOf(rule), 1); | ||
} | ||
@@ -996,3 +1010,3 @@ /** | ||
/** | ||
* Register a rule in `.map` and `.classes` maps. | ||
* Register a rule in `.map`, `.classes` and `.keyframes` maps. | ||
*/ | ||
@@ -1050,6 +1064,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); | ||
} | ||
@@ -1063,3 +1077,3 @@ } | ||
_proto.onUpdate = function onUpdate(data, rule, options) { | ||
_proto.updateOne = function updateOne(rule, data, options) { | ||
if (options === void 0) { | ||
@@ -1145,2 +1159,4 @@ options = defaultUpdateOptions; | ||
this.queue = void 0; | ||
this.update = void 0; | ||
this.updateOne = void 0; | ||
this.attached = false; | ||
@@ -1162,2 +1178,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); | ||
@@ -1273,3 +1291,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; | ||
@@ -1303,14 +1321,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. | ||
@@ -2062,3 +2068,3 @@ */ | ||
this.id = instanceCounter++; | ||
this.version = "10.0.0"; | ||
this.version = "10.0.1"; | ||
this.plugins = new PluginsRegistry(); | ||
@@ -2160,2 +2166,3 @@ this.options = { | ||
* Create a rule without a Style Sheet. | ||
* [Deprecated] will be removed in the next major version. | ||
*/ | ||
@@ -2179,2 +2186,3 @@ ; | ||
var ruleOptions = _extends({}, options, { | ||
name: name, | ||
jss: this, | ||
@@ -2181,0 +2189,0 @@ Renderer: this.options.Renderer |
{ | ||
"name": "jss-plugin-rule-value-observable", | ||
"description": "JSS plugin for TC39 Observables support", | ||
"version": "10.0.0", | ||
"version": "10.0.1", | ||
"license": "MIT", | ||
@@ -44,6 +44,6 @@ "homepage": "https://cssinjs.org/", | ||
"@babel/runtime": "^7.3.1", | ||
"jss": "10.0.0", | ||
"jss": "10.0.1", | ||
"symbol-observable": "^1.2.0" | ||
}, | ||
"gitHead": "9562e1d1ba2a137fbc459ed83cd3a61cb894cdb2" | ||
"gitHead": "caaa314acc24deda0c8a6b11afe9c15787598741" | ||
} |
@@ -12,3 +12,3 @@ # jss-plugin-rule-value-observable | ||
See our website [jss-plugin-rule-value-observable](https://cssinjs.org/jss-plugin-rule-value-observable?v=v10.0.0) for more information. | ||
See our website [jss-plugin-rule-value-observable](https://cssinjs.org/jss-plugin-rule-value-observable?v=v10.0.1) for more information. | ||
@@ -15,0 +15,0 @@ ## Install |
83684
2435
+ Addedjss@10.0.1(transitive)
- Removedjss@10.0.0(transitive)
Updatedjss@10.0.1