jss-plugin-global
Advanced tools
Comparing version 10.0.0-alpha.16 to 10.0.0-alpha.17
@@ -236,5 +236,5 @@ function _extends() { | ||
var escapeRegex = /([[\].#*$><+~=|^:(),"'`\s])/g; | ||
var nativeEscape = typeof CSS !== 'undefined' && CSS.escape; | ||
var escape = function escape(str) { | ||
var nativeEscape = typeof CSS !== 'undefined' && CSS.escape; | ||
return nativeEscape ? nativeEscape(str) : str.replace(escapeRegex, '\\$1'); | ||
@@ -548,3 +548,3 @@ }; | ||
generateId = options.generateId; | ||
this.id = scoped === false ? this.name : generateId(this, sheet); | ||
this.id = scoped === false ? this.name : escape(generateId(this, sheet)); | ||
this.rules = new RuleList(_extends({}, options, { | ||
@@ -1296,5 +1296,4 @@ parent: this | ||
this.registry.onProcessRule[i](rule, sheet); | ||
} // $FlowFixMe | ||
} | ||
if (rule.style) this.onProcessStyle(rule.style, rule, sheet); | ||
@@ -1491,5 +1490,9 @@ rule.isProcessed = true; | ||
var createGenerateIdDefault = function createGenerateIdDefault() { | ||
var createGenerateId = function createGenerateId(options) { | ||
if (options === void 0) { | ||
options = {}; | ||
} | ||
var ruleCounter = 0; | ||
var defaultPrefix = ''; | ||
var defaultPrefix = options.minify ? 'c' : ''; | ||
return function (rule, sheet) { | ||
@@ -1510,2 +1513,6 @@ ruleCounter += 1; | ||
if (options.minify) { | ||
return "" + prefix + moduleId + jssId + ruleCounter; | ||
} | ||
return prefix + rule.key + "-" + moduleId + (jssId && "-" + jssId) + "-" + ruleCounter; | ||
@@ -1960,10 +1967,15 @@ }; | ||
this.id = instanceCounter++; | ||
this.version = "10.0.0-alpha.16"; | ||
this.version = "10.0.0-alpha.17"; | ||
this.plugins = new PluginsRegistry(); | ||
this.options = { | ||
createGenerateId: createGenerateIdDefault, | ||
id: { | ||
minify: false | ||
}, | ||
createGenerateId: createGenerateId, | ||
Renderer: isBrowser ? DomRenderer : null, | ||
plugins: [] | ||
}; | ||
this.generateId = createGenerateIdDefault(); | ||
this.generateId = createGenerateId({ | ||
minify: false | ||
}); | ||
@@ -1992,10 +2004,14 @@ for (var i = 0; i < plugins.length; i++) { | ||
var _options = options, | ||
createGenerateId = _options.createGenerateId; | ||
if (options.createGenerateId) { | ||
this.options.createGenerateId = options.createGenerateId; | ||
} | ||
if (createGenerateId) { | ||
this.options.createGenerateId = createGenerateId; | ||
this.generateId = createGenerateId(); | ||
if (options.id) { | ||
this.options.id = _extends({}, this.options.id, options.id); | ||
} | ||
if (options.createGenerateId || options.id) { | ||
this.generateId = this.options.createGenerateId(this.options.id); | ||
} | ||
if (options.insertionPoint != null) this.options.insertionPoint = options.insertionPoint; | ||
@@ -2021,4 +2037,4 @@ | ||
var _options2 = options, | ||
index = _options2.index; | ||
var _options = options, | ||
index = _options.index; | ||
@@ -2025,0 +2041,0 @@ if (typeof index !== 'number') { |
{ | ||
"name": "jss-plugin-global", | ||
"description": "Global styles for JSS", | ||
"version": "10.0.0-alpha.16", | ||
"version": "10.0.0-alpha.17", | ||
"license": "MIT", | ||
@@ -41,9 +41,9 @@ "homepage": "https://cssinjs.org/jss-global", | ||
"devDependencies": { | ||
"jss-plugin-nested": "10.0.0-alpha.16" | ||
"jss-plugin-nested": "10.0.0-alpha.17" | ||
}, | ||
"dependencies": { | ||
"@babel/runtime": "^7.3.1", | ||
"jss": "10.0.0-alpha.16" | ||
"jss": "10.0.0-alpha.17" | ||
}, | ||
"gitHead": "9984cccd0aad34010aa1c05ed35b2deed0353706" | ||
"gitHead": "dae1bf2b42e46270f3625b5d1dabaccea2aeda17" | ||
} |
@@ -12,3 +12,3 @@ # jss-plugin-global | ||
See our website [jss-plugin-global](https://cssinjs.org/jss-plugin-global?v=v10.0.0-alpha.16) for more information. | ||
See our website [jss-plugin-global](https://cssinjs.org/jss-plugin-global?v=v10.0.0-alpha.17) for more information. | ||
@@ -15,0 +15,0 @@ ## Install |
99880
2932
+ Addedjss@10.0.0-alpha.17(transitive)
- Removedjss@10.0.0-alpha.16(transitive)
Updatedjss@10.0.0-alpha.17