jss-plugin-rule-value-function
Advanced tools
Comparing version 10.0.0-alpha.10 to 10.0.0-alpha.11
@@ -5,2 +5,24 @@ var global$1 = (typeof global !== "undefined" ? global : | ||
function _extends() { | ||
_extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
} | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
var isBrowser = (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" && (typeof document === "undefined" ? "undefined" : _typeof(document)) === 'object' && document.nodeType === 9; | ||
function warning(condition, message) { | ||
@@ -24,20 +46,2 @@ { | ||
function _extends() { | ||
_extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
return _extends.apply(this, arguments); | ||
} | ||
function _defineProperties(target, props) { | ||
@@ -73,6 +77,2 @@ for (var i = 0; i < props.length; i++) { | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
var isBrowser = (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" && (typeof document === "undefined" ? "undefined" : _typeof(document)) === 'object' && document.nodeType === 9; | ||
var plainObjectConstrurctor = {}.constructor; | ||
@@ -353,3 +353,3 @@ | ||
return this; | ||
}; | ||
} | ||
/** | ||
@@ -360,4 +360,4 @@ * Returns JSON representation of the rule. | ||
*/ | ||
; | ||
_proto2.toJSON = function toJSON() { | ||
@@ -372,8 +372,8 @@ var json = {}; | ||
return json; | ||
}; | ||
} | ||
/** | ||
* Generates a CSS string. | ||
*/ | ||
; | ||
_proto2.toString = function toString(options) { | ||
@@ -464,16 +464,16 @@ var sheet = this.options.sheet; | ||
return this.rules.get(name); | ||
}; | ||
} | ||
/** | ||
* Get index of a rule. | ||
*/ | ||
; | ||
_proto.indexOf = function indexOf(rule) { | ||
return this.rules.indexOf(rule); | ||
}; | ||
} | ||
/** | ||
* Create and register rule, run plugins. | ||
*/ | ||
; | ||
_proto.addRule = function addRule(name, style, options) { | ||
@@ -484,8 +484,8 @@ var rule = this.rules.add(name, style, options); | ||
return rule; | ||
}; | ||
} | ||
/** | ||
* Generates a CSS string. | ||
*/ | ||
; | ||
_proto.toString = function toString(options) { | ||
@@ -870,16 +870,16 @@ if (options === void 0) { | ||
return rule; | ||
}; | ||
} | ||
/** | ||
* Get a rule. | ||
*/ | ||
; | ||
_proto.get = function get(name) { | ||
return this.map[name]; | ||
}; | ||
} | ||
/** | ||
* Delete a rule. | ||
*/ | ||
; | ||
_proto.remove = function remove(rule) { | ||
@@ -889,16 +889,16 @@ this.unregister(rule); | ||
this.index.splice(this.indexOf(rule), 1); | ||
}; | ||
} | ||
/** | ||
* Get index of a rule. | ||
*/ | ||
; | ||
_proto.indexOf = function indexOf(rule) { | ||
return this.index.indexOf(rule); | ||
}; | ||
} | ||
/** | ||
* Run `onProcessRule()` plugins on every rule. | ||
*/ | ||
; | ||
_proto.process = function process() { | ||
@@ -909,8 +909,8 @@ var plugins$$1 = this.options.jss.plugins; // We need to clone array because if we modify the index somewhere else during a loop | ||
this.index.slice(0).forEach(plugins$$1.onProcessRule, plugins$$1); | ||
}; | ||
} | ||
/** | ||
* Register a rule in `.map` and `.classes` maps. | ||
*/ | ||
; | ||
_proto.register = function register(rule) { | ||
@@ -925,8 +925,8 @@ this.map[rule.key] = rule; | ||
} | ||
}; | ||
} | ||
/** | ||
* Unregister a rule. | ||
*/ | ||
; | ||
_proto.unregister = function unregister(rule) { | ||
@@ -941,8 +941,8 @@ delete this.map[rule.key]; | ||
} | ||
}; | ||
} | ||
/** | ||
* Update the function values with a new data. | ||
*/ | ||
; | ||
_proto.update = function update() { | ||
@@ -973,8 +973,8 @@ var name; | ||
} | ||
}; | ||
} | ||
/** | ||
* Execute plugins, update rule props. | ||
*/ | ||
; | ||
_proto.onUpdate = function onUpdate(data, rule, options) { | ||
@@ -1014,8 +1014,8 @@ if (options === void 0) { | ||
} | ||
}; | ||
} | ||
/** | ||
* Convert rules to a CSS string. | ||
*/ | ||
; | ||
_proto.toString = function toString(options) { | ||
@@ -1086,8 +1086,8 @@ var str = ''; | ||
return this; | ||
}; | ||
} | ||
/** | ||
* Remove renderable from render tree. | ||
*/ | ||
; | ||
_proto.detach = function detach() { | ||
@@ -1098,3 +1098,3 @@ if (!this.attached) return this; | ||
return this; | ||
}; | ||
} | ||
/** | ||
@@ -1104,4 +1104,4 @@ * Add a rule to the current stylesheet. | ||
*/ | ||
; | ||
_proto.addRule = function addRule(name, decl, options) { | ||
@@ -1136,11 +1136,11 @@ var queue = this.queue; // Plugins can create rules. | ||
return rule; | ||
}; | ||
} | ||
/** | ||
* Insert rule into the StyleSheet | ||
*/ | ||
; | ||
_proto.insertRule = function insertRule(rule) { | ||
this.renderer.insertRule(rule); | ||
}; | ||
} | ||
/** | ||
@@ -1150,4 +1150,4 @@ * Create and add rules. | ||
*/ | ||
; | ||
_proto.addRules = function addRules(styles, options) { | ||
@@ -1162,11 +1162,11 @@ var added = []; | ||
return added; | ||
}; | ||
} | ||
/** | ||
* Get a rule by name. | ||
*/ | ||
; | ||
_proto.getRule = function getRule(name) { | ||
return this.rules.get(name); | ||
}; | ||
} | ||
/** | ||
@@ -1176,4 +1176,4 @@ * Delete a rule by name. | ||
*/ | ||
; | ||
_proto.deleteRule = function deleteRule(name) { | ||
@@ -1189,16 +1189,16 @@ var rule = this.rules.get(name); | ||
return true; | ||
}; | ||
} | ||
/** | ||
* Get index of a rule. | ||
*/ | ||
; | ||
_proto.indexOf = function indexOf(rule) { | ||
return this.rules.indexOf(rule); | ||
}; | ||
} | ||
/** | ||
* Deploy pure CSS string to a renderable. | ||
*/ | ||
; | ||
_proto.deploy = function deploy() { | ||
@@ -1208,8 +1208,8 @@ this.renderer.deploy(); | ||
return this; | ||
}; | ||
} | ||
/** | ||
* Update the function values with a new data. | ||
*/ | ||
; | ||
_proto.update = function update() { | ||
@@ -1221,8 +1221,8 @@ var _this$rules; | ||
return this; | ||
}; | ||
} | ||
/** | ||
* Convert rules to a CSS string. | ||
*/ | ||
; | ||
_proto.toString = function toString(options) { | ||
@@ -1258,8 +1258,8 @@ return this.rules.toString(options); | ||
return null; | ||
}; | ||
} | ||
/** | ||
* Call `onProcessRule` hooks. | ||
*/ | ||
; | ||
_proto.onProcessRule = function onProcessRule(rule) { | ||
@@ -1276,8 +1276,8 @@ if (rule.isProcessed) return; | ||
rule.isProcessed = true; | ||
}; | ||
} | ||
/** | ||
* Call `onProcessStyle` hooks. | ||
*/ | ||
; | ||
_proto.onProcessStyle = function onProcessStyle(style, rule, sheet) { | ||
@@ -1288,8 +1288,8 @@ for (var i = 0; i < this.registry.onProcessStyle.length; i++) { | ||
} | ||
}; | ||
} | ||
/** | ||
* Call `onProcessSheet` hooks. | ||
*/ | ||
; | ||
_proto.onProcessSheet = function onProcessSheet(sheet) { | ||
@@ -1299,8 +1299,8 @@ for (var i = 0; i < this.registry.onProcessSheet.length; i++) { | ||
} | ||
}; | ||
} | ||
/** | ||
* Call `onUpdate` hooks. | ||
*/ | ||
; | ||
_proto.onUpdate = function onUpdate(data, rule, sheet, options) { | ||
@@ -1310,8 +1310,8 @@ for (var i = 0; i < this.registry.onUpdate.length; i++) { | ||
} | ||
}; | ||
} | ||
/** | ||
* Call `onChangeValue` hooks. | ||
*/ | ||
; | ||
_proto.onChangeValue = function onChangeValue(value, prop, rule) { | ||
@@ -1325,8 +1325,8 @@ var processedValue = value; | ||
return processedValue; | ||
}; | ||
} | ||
/** | ||
* Register a plugin. | ||
*/ | ||
; | ||
_proto.use = function use(newPlugin, options) { | ||
@@ -1346,3 +1346,3 @@ if (options === void 0) { | ||
plugins.push(newPlugin); | ||
this.registry = this.plugins.external.concat(this.plugins.internal).reduce(function (registry, plugin) { | ||
this.registry = [].concat(this.plugins.external, this.plugins.internal).reduce(function (registry, plugin) { | ||
for (var name in plugin) { | ||
@@ -1403,25 +1403,25 @@ if (name in registry) { | ||
} | ||
}; | ||
} | ||
/** | ||
* Reset the registry. | ||
*/ | ||
; | ||
_proto.reset = function reset() { | ||
this.registry = []; | ||
}; | ||
} | ||
/** | ||
* Remove a Style Sheet. | ||
*/ | ||
; | ||
_proto.remove = function remove(sheet) { | ||
var index = this.registry.indexOf(sheet); | ||
this.registry.splice(index, 1); | ||
}; | ||
} | ||
/** | ||
* Convert all attached sheets to a CSS string. | ||
*/ | ||
; | ||
_proto.toString = function toString(options) { | ||
@@ -1807,16 +1807,16 @@ return this.registry.filter(function (sheet) { | ||
} | ||
}; | ||
} | ||
/** | ||
* Remove style element from render tree. | ||
*/ | ||
; | ||
_proto.detach = function detach() { | ||
this.element.parentNode.removeChild(this.element); | ||
}; | ||
} | ||
/** | ||
* Inject CSS string into element. | ||
*/ | ||
; | ||
_proto.deploy = function deploy() { | ||
@@ -1827,3 +1827,3 @@ var sheet = this.sheet; | ||
if (sheet.options.link) { | ||
sheet.rules.index.forEach(this.insertRule, this); | ||
this.insertRules(sheet.rules); | ||
return; | ||
@@ -1833,28 +1833,40 @@ } | ||
this.element.textContent = "\n" + sheet.toString() + "\n"; | ||
}; | ||
} | ||
/** | ||
* Insert RuleList into an element. | ||
*/ | ||
; | ||
_proto.insertRules = function insertRules(rules, nativeParent) { | ||
for (var i = 0; i < rules.index.length; i++) { | ||
this.insertRule(rules.index[i], i, nativeParent); | ||
} | ||
} | ||
/** | ||
* Insert a rule into element. | ||
*/ | ||
; | ||
_proto.insertRule = function insertRule(rule, index, nativeParent) { | ||
if (nativeParent === void 0) { | ||
nativeParent = this.element.sheet; | ||
} | ||
_proto.insertRule = function insertRule(rule, index) { | ||
var sheet = this.element.sheet; | ||
if (rule.rules) { | ||
var parent = rule; | ||
var latestNativeParent = nativeParent; | ||
if (rule.type === 'conditional' || rule.type === 'keyframes') { | ||
var containerRule = rule; // We need to render the container without children first. | ||
if (rule.type === 'conditional' || rule.type === 'keyframes') { | ||
// We need to render the container without children first. | ||
latestNativeParent = _insertRule(nativeParent, parent.toString({ | ||
children: false | ||
}), index); | ||
var _cssRule = _insertRule(sheet, containerRule.toString({ | ||
children: false | ||
}), index); | ||
if (_cssRule === false) { | ||
return false; | ||
if (latestNativeParent === false) { | ||
return false; | ||
} | ||
} | ||
containerRule.rules.index.forEach(function (childRule, childIndex) { | ||
var cssChildRule = _insertRule(_cssRule, childRule.toString(), childIndex); | ||
if (cssChildRule !== false) childRule.renderable = cssChildRule; | ||
}); | ||
return _cssRule; | ||
this.insertRules(parent.rules, latestNativeParent); | ||
return latestNativeParent; | ||
} | ||
@@ -1865,5 +1877,5 @@ | ||
var cssRule = _insertRule(sheet, ruleStr, index); | ||
var nativeRule = _insertRule(nativeParent, ruleStr, index); | ||
if (cssRule === false) { | ||
if (nativeRule === false) { | ||
return false; | ||
@@ -1873,10 +1885,10 @@ } | ||
this.hasInsertedRules = true; | ||
rule.renderable = cssRule; | ||
return cssRule; | ||
}; | ||
rule.renderable = nativeRule; | ||
return nativeRule; | ||
} | ||
/** | ||
* Delete a rule. | ||
*/ | ||
; | ||
_proto.deleteRule = function deleteRule(cssRule) { | ||
@@ -1888,8 +1900,8 @@ var sheet = this.element.sheet; | ||
return true; | ||
}; | ||
} | ||
/** | ||
* Get index of a CSS Rule. | ||
*/ | ||
; | ||
_proto.indexOf = function indexOf(cssRule) { | ||
@@ -1903,3 +1915,3 @@ var cssRules = this.element.sheet.cssRules; | ||
return -1; | ||
}; | ||
} | ||
/** | ||
@@ -1910,4 +1922,4 @@ * Generate a new CSS rule and replace the existing one. | ||
*/ | ||
; | ||
_proto.replaceRule = function replaceRule(cssRule, rule) { | ||
@@ -1918,8 +1930,8 @@ var index = this.indexOf(cssRule); | ||
return this.insertRule(rule, index); | ||
}; | ||
} | ||
/** | ||
* Get all rules elements. | ||
*/ | ||
; | ||
_proto.getRules = function getRules() { | ||
@@ -1993,3 +2005,3 @@ return this.element.sheet.cssRules; | ||
this.id = instanceCounter++; | ||
this.version = "10.0.0-alpha.10"; | ||
this.version = "10.0.0-alpha.11"; | ||
this.plugins = new PluginsRegistry(); | ||
@@ -2040,8 +2052,8 @@ this.options = { | ||
return this; | ||
}; | ||
} | ||
/** | ||
* Create a Style Sheet. | ||
*/ | ||
; | ||
_proto.createStyleSheet = function createStyleSheet(styles, options) { | ||
@@ -2068,8 +2080,8 @@ if (options === void 0) { | ||
return sheet; | ||
}; | ||
} | ||
/** | ||
* Detach the Style Sheet and remove it from the registry. | ||
*/ | ||
; | ||
_proto.removeStyleSheet = function removeStyleSheet(sheet) { | ||
@@ -2079,8 +2091,8 @@ sheet.detach(); | ||
return this; | ||
}; | ||
} | ||
/** | ||
* Create a rule without a Style Sheet. | ||
*/ | ||
; | ||
_proto.createRule = function createRule$$1(name, style, options) { | ||
@@ -2111,8 +2123,8 @@ if (style === void 0) { | ||
return rule; | ||
}; | ||
} | ||
/** | ||
* Register plugin. Passed function will be invoked with a rule instance. | ||
*/ | ||
; | ||
_proto.use = function use() { | ||
@@ -2119,0 +2131,0 @@ var _this = this; |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('jss')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'jss'], factory) : | ||
(factory((global.jssPluginRuleValueFunction = {}),global.jss)); | ||
}(this, (function (exports,jss) { 'use strict'; | ||
(global = global || self, factory(global.jssPluginRuleValueFunction = {}, global.jss)); | ||
}(this, function (exports, jss) { 'use strict'; | ||
@@ -60,3 +60,3 @@ var now = Date.now(); | ||
}))); | ||
})); | ||
//# sourceMappingURL=jss-plugin-rule-value-function.js.map |
@@ -1,1 +0,1 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("jss")):"function"==typeof define&&define.amd?define(["exports","jss"],n):n(e.jssPluginRuleValueFunction={},e.jss)}(this,function(e,o){"use strict";var n=Date.now(),s="fnValues"+n,a="fnStyle"+ ++n;e.default=function(){return{onCreateRule:function(e,n,t){if("function"!=typeof n)return null;var r=o.createRule(e,{},t);return r[a]=n,r},onProcessStyle:function(e,n){if(s in n)return e;var t={};for(var r in e){var o=e[r];"function"==typeof o&&(delete e[r],t[r]=o)}return n[s]=t,e},onUpdate:function(e,n,t,r){var o=n,u=o[a];u&&(o.style=u(e));var f=o[s];if(f)for(var i in f)o.prop(i,f[i](e),r)}}},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("jss")):"function"==typeof define&&define.amd?define(["exports","jss"],n):n((e=e||self).jssPluginRuleValueFunction={},e.jss)}(this,function(e,n){"use strict";var t=Date.now(),r="fnValues"+t,o="fnStyle"+ ++t;e.default=function(){return{onCreateRule:function(e,t,r){if("function"!=typeof t)return null;var u=n.createRule(e,{},r);return u[o]=t,u},onProcessStyle:function(e,n){if(r in n)return e;var t={};for(var o in e){var u=e[o];"function"==typeof u&&(delete e[o],t[o]=u)}return n[r]=t,e},onUpdate:function(e,n,t,u){var f=n,i=f[o];i&&(f.style=i(e));var s=f[r];if(s)for(var a in s)f.prop(a,s[a](e),u)}}},Object.defineProperty(e,"__esModule",{value:!0})}); |
{ | ||
"name": "jss-plugin-rule-value-function", | ||
"description": "JSS plugin for function value and rule syntax", | ||
"version": "10.0.0-alpha.10", | ||
"version": "10.0.0-alpha.11", | ||
"license": "MIT", | ||
@@ -47,6 +47,6 @@ "homepage": "https://cssinjs.org/", | ||
"dependencies": { | ||
"@babel/runtime": "^7.0.0", | ||
"jss": "10.0.0-alpha.10" | ||
"@babel/runtime": "^7.3.1", | ||
"jss": "10.0.0-alpha.11" | ||
}, | ||
"gitHead": "953234ad4e69b2f3d00fb9d683fba24865d2c4dd" | ||
"gitHead": "79343bda7df92609218aea1c9907297051cfc6ed" | ||
} |
@@ -12,3 +12,3 @@ # jss-plugin-rule-value-function | ||
See our website [jss-plugin-rule-value-function](https://cssinjs.org/jss-plugin-rule-value-function?v=v10.0.0-alpha.10) for more information. | ||
See our website [jss-plugin-rule-value-function](https://cssinjs.org/jss-plugin-rule-value-function?v=v10.0.0-alpha.11) for more information. | ||
@@ -15,0 +15,0 @@ ## Install |
93515
2981
+ Addedjss@10.0.0-alpha.11(transitive)
- Removedjss@10.0.0-alpha.10(transitive)
Updated@babel/runtime@^7.3.1
Updatedjss@10.0.0-alpha.11