jss-plugin-rule-value-observable
Advanced tools
Comparing version 10.0.0-alpha.10 to 10.0.0-alpha.11
@@ -39,2 +39,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) { | ||
@@ -58,20 +80,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) { | ||
@@ -107,6 +111,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; | ||
@@ -387,3 +387,3 @@ | ||
return this; | ||
}; | ||
} | ||
/** | ||
@@ -394,4 +394,4 @@ * Returns JSON representation of the rule. | ||
*/ | ||
; | ||
_proto2.toJSON = function toJSON() { | ||
@@ -406,8 +406,8 @@ var json = {}; | ||
return json; | ||
}; | ||
} | ||
/** | ||
* Generates a CSS string. | ||
*/ | ||
; | ||
_proto2.toString = function toString(options) { | ||
@@ -498,16 +498,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) { | ||
@@ -518,8 +518,8 @@ var rule = this.rules.add(name, style, options); | ||
return rule; | ||
}; | ||
} | ||
/** | ||
* Generates a CSS string. | ||
*/ | ||
; | ||
_proto.toString = function toString(options) { | ||
@@ -904,16 +904,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) { | ||
@@ -923,16 +923,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() { | ||
@@ -943,8 +943,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) { | ||
@@ -959,8 +959,8 @@ this.map[rule.key] = rule; | ||
} | ||
}; | ||
} | ||
/** | ||
* Unregister a rule. | ||
*/ | ||
; | ||
_proto.unregister = function unregister(rule) { | ||
@@ -975,8 +975,8 @@ delete this.map[rule.key]; | ||
} | ||
}; | ||
} | ||
/** | ||
* Update the function values with a new data. | ||
*/ | ||
; | ||
_proto.update = function update() { | ||
@@ -1007,8 +1007,8 @@ var name; | ||
} | ||
}; | ||
} | ||
/** | ||
* Execute plugins, update rule props. | ||
*/ | ||
; | ||
_proto.onUpdate = function onUpdate(data, rule, options) { | ||
@@ -1048,8 +1048,8 @@ if (options === void 0) { | ||
} | ||
}; | ||
} | ||
/** | ||
* Convert rules to a CSS string. | ||
*/ | ||
; | ||
_proto.toString = function toString(options) { | ||
@@ -1120,8 +1120,8 @@ var str = ''; | ||
return this; | ||
}; | ||
} | ||
/** | ||
* Remove renderable from render tree. | ||
*/ | ||
; | ||
_proto.detach = function detach() { | ||
@@ -1132,3 +1132,3 @@ if (!this.attached) return this; | ||
return this; | ||
}; | ||
} | ||
/** | ||
@@ -1138,4 +1138,4 @@ * Add a rule to the current stylesheet. | ||
*/ | ||
; | ||
_proto.addRule = function addRule(name, decl, options) { | ||
@@ -1170,11 +1170,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); | ||
}; | ||
} | ||
/** | ||
@@ -1184,4 +1184,4 @@ * Create and add rules. | ||
*/ | ||
; | ||
_proto.addRules = function addRules(styles, options) { | ||
@@ -1196,11 +1196,11 @@ var added = []; | ||
return added; | ||
}; | ||
} | ||
/** | ||
* Get a rule by name. | ||
*/ | ||
; | ||
_proto.getRule = function getRule(name) { | ||
return this.rules.get(name); | ||
}; | ||
} | ||
/** | ||
@@ -1210,4 +1210,4 @@ * Delete a rule by name. | ||
*/ | ||
; | ||
_proto.deleteRule = function deleteRule(name) { | ||
@@ -1223,16 +1223,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() { | ||
@@ -1242,8 +1242,8 @@ this.renderer.deploy(); | ||
return this; | ||
}; | ||
} | ||
/** | ||
* Update the function values with a new data. | ||
*/ | ||
; | ||
_proto.update = function update() { | ||
@@ -1255,8 +1255,8 @@ var _this$rules; | ||
return this; | ||
}; | ||
} | ||
/** | ||
* Convert rules to a CSS string. | ||
*/ | ||
; | ||
_proto.toString = function toString(options) { | ||
@@ -1292,8 +1292,8 @@ return this.rules.toString(options); | ||
return null; | ||
}; | ||
} | ||
/** | ||
* Call `onProcessRule` hooks. | ||
*/ | ||
; | ||
_proto.onProcessRule = function onProcessRule(rule) { | ||
@@ -1310,8 +1310,8 @@ if (rule.isProcessed) return; | ||
rule.isProcessed = true; | ||
}; | ||
} | ||
/** | ||
* Call `onProcessStyle` hooks. | ||
*/ | ||
; | ||
_proto.onProcessStyle = function onProcessStyle(style, rule, sheet) { | ||
@@ -1322,8 +1322,8 @@ for (var i = 0; i < this.registry.onProcessStyle.length; i++) { | ||
} | ||
}; | ||
} | ||
/** | ||
* Call `onProcessSheet` hooks. | ||
*/ | ||
; | ||
_proto.onProcessSheet = function onProcessSheet(sheet) { | ||
@@ -1333,8 +1333,8 @@ for (var i = 0; i < this.registry.onProcessSheet.length; i++) { | ||
} | ||
}; | ||
} | ||
/** | ||
* Call `onUpdate` hooks. | ||
*/ | ||
; | ||
_proto.onUpdate = function onUpdate(data, rule, sheet, options) { | ||
@@ -1344,8 +1344,8 @@ for (var i = 0; i < this.registry.onUpdate.length; i++) { | ||
} | ||
}; | ||
} | ||
/** | ||
* Call `onChangeValue` hooks. | ||
*/ | ||
; | ||
_proto.onChangeValue = function onChangeValue(value, prop, rule) { | ||
@@ -1359,8 +1359,8 @@ var processedValue = value; | ||
return processedValue; | ||
}; | ||
} | ||
/** | ||
* Register a plugin. | ||
*/ | ||
; | ||
_proto.use = function use(newPlugin, options) { | ||
@@ -1380,3 +1380,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) { | ||
@@ -1437,25 +1437,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) { | ||
@@ -1841,16 +1841,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() { | ||
@@ -1861,3 +1861,3 @@ var sheet = this.sheet; | ||
if (sheet.options.link) { | ||
sheet.rules.index.forEach(this.insertRule, this); | ||
this.insertRules(sheet.rules); | ||
return; | ||
@@ -1867,28 +1867,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; | ||
} | ||
@@ -1899,5 +1911,5 @@ | ||
var cssRule = _insertRule(sheet, ruleStr, index); | ||
var nativeRule = _insertRule(nativeParent, ruleStr, index); | ||
if (cssRule === false) { | ||
if (nativeRule === false) { | ||
return false; | ||
@@ -1907,10 +1919,10 @@ } | ||
this.hasInsertedRules = true; | ||
rule.renderable = cssRule; | ||
return cssRule; | ||
}; | ||
rule.renderable = nativeRule; | ||
return nativeRule; | ||
} | ||
/** | ||
* Delete a rule. | ||
*/ | ||
; | ||
_proto.deleteRule = function deleteRule(cssRule) { | ||
@@ -1922,8 +1934,8 @@ var sheet = this.element.sheet; | ||
return true; | ||
}; | ||
} | ||
/** | ||
* Get index of a CSS Rule. | ||
*/ | ||
; | ||
_proto.indexOf = function indexOf(cssRule) { | ||
@@ -1937,3 +1949,3 @@ var cssRules = this.element.sheet.cssRules; | ||
return -1; | ||
}; | ||
} | ||
/** | ||
@@ -1944,4 +1956,4 @@ * Generate a new CSS rule and replace the existing one. | ||
*/ | ||
; | ||
_proto.replaceRule = function replaceRule(cssRule, rule) { | ||
@@ -1952,8 +1964,8 @@ var index = this.indexOf(cssRule); | ||
return this.insertRule(rule, index); | ||
}; | ||
} | ||
/** | ||
* Get all rules elements. | ||
*/ | ||
; | ||
_proto.getRules = function getRules() { | ||
@@ -2027,3 +2039,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(); | ||
@@ -2074,8 +2086,8 @@ this.options = { | ||
return this; | ||
}; | ||
} | ||
/** | ||
* Create a Style Sheet. | ||
*/ | ||
; | ||
_proto.createStyleSheet = function createStyleSheet(styles, options) { | ||
@@ -2102,8 +2114,8 @@ if (options === void 0) { | ||
return sheet; | ||
}; | ||
} | ||
/** | ||
* Detach the Style Sheet and remove it from the registry. | ||
*/ | ||
; | ||
_proto.removeStyleSheet = function removeStyleSheet(sheet) { | ||
@@ -2113,8 +2125,8 @@ sheet.detach(); | ||
return this; | ||
}; | ||
} | ||
/** | ||
* Create a rule without a Style Sheet. | ||
*/ | ||
; | ||
_proto.createRule = function createRule$$1(name, style, options) { | ||
@@ -2145,8 +2157,8 @@ if (style === void 0) { | ||
return rule; | ||
}; | ||
} | ||
/** | ||
* Register plugin. Passed function will be invoked with a rule instance. | ||
*/ | ||
; | ||
_proto.use = function use() { | ||
@@ -2153,0 +2165,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.jssPluginRuleValueObservable = {}),global.jss)); | ||
}(this, (function (exports,jss) { 'use strict'; | ||
(global = global || self, factory(global.jssPluginRuleValueObservable = {}, global.jss)); | ||
}(this, function (exports, jss) { 'use strict'; | ||
@@ -95,3 +95,3 @@ var global$1 = (typeof global !== "undefined" ? global : | ||
}))); | ||
})); | ||
//# sourceMappingURL=jss-plugin-rule-value-observable.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.jssPluginRuleValueObservable={},e.jss)}(this,function(e,r){"use strict";var n,o="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};n="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==o?o:"undefined"!=typeof module?module:Function("return this")();var t,u,f=("function"==typeof(u=n.Symbol)?u.observable?t=u.observable:(t=u("observable"),u.observable=t):t="@@observable",t),i=function(e){return e&&e[f]&&e===e[f]()};e.default=function(f){return{onCreateRule:function(e,n,o){if(!i(n))return null;var t=n,u=r.createRule(e,{},o);return t.subscribe(function(e){for(var n in e)u.prop(n,e[n],f)}),u},onProcessRule:function(e){if(!e||"style"===e.type){var o=e,t=o.style,n=function(n){var e=t[n];if(!i(e))return"continue";delete t[n],e.subscribe({next:function(e){o.prop(n,e,f)}})};for(var u in t)n(u)}}}},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).jssPluginRuleValueObservable={},e.jss)}(this,function(e,n){"use strict";var o="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};var t=function(e){var n,o=e.Symbol;return"function"==typeof o?o.observable?n=o.observable:(n=o("observable"),o.observable=n):n="@@observable",n}("undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==o?o:"undefined"!=typeof module?module:Function("return this")()),r=function(e){return e&&e[t]&&e===e[t]()};e.default=function(e){return{onCreateRule:function(o,t,u){if(!r(t))return null;var f=t,i=n.createRule(o,{},u);return f.subscribe(function(n){for(var o in n)i.prop(o,n[o],e)}),i},onProcessRule:function(n){if(!n||"style"===n.type){var o=n,t=o.style,u=function(n){var u=t[n];if(!r(u))return"continue";delete t[n],u.subscribe({next:function(t){o.prop(n,t,e)}})};for(var f in t)u(f)}}}},Object.defineProperty(e,"__esModule",{value:!0})}); |
{ | ||
"name": "jss-plugin-rule-value-observable", | ||
"description": "JSS plugin for TC39 Observables support", | ||
"version": "10.0.0-alpha.10", | ||
"version": "10.0.0-alpha.11", | ||
"license": "MIT", | ||
@@ -46,7 +46,7 @@ "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", | ||
"symbol-observable": "^1.2.0" | ||
}, | ||
"gitHead": "953234ad4e69b2f3d00fb9d683fba24865d2c4dd" | ||
"gitHead": "79343bda7df92609218aea1c9907297051cfc6ed" | ||
} |
@@ -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-alpha.10) for more information. | ||
See our website [jss-plugin-rule-value-observable](https://cssinjs.org/jss-plugin-rule-value-observable?v=v10.0.0-alpha.11) for more information. | ||
@@ -15,0 +15,0 @@ ## Install |
82310
2384
+ 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