Comparing version 6.0.0 to 6.0.1
var _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; }; | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
@@ -12,7 +14,20 @@ | ||
var rehydrationHandlers = _defineProperty({}, RULE_TYPE, function (renderer, css, media) { | ||
var _rehydrateSupportRule = rehydrateSupportRules(renderer, css, media), | ||
// try to read the uniqueRuleIdentifier | ||
if (media.length === 0 && css.indexOf('#*/') !== -1) { | ||
var _css$split = css.split('#*/'), | ||
_css$split2 = _slicedToArray(_css$split, 2), | ||
left = _css$split2[0], | ||
right = _css$split2[1]; | ||
renderer.uniqueRuleIdentifier = parseInt(left.split('::')[1]); | ||
// it's ok to mutate | ||
css = right; | ||
} | ||
var _rehydrateSupportRule = rehydrateSupportRules(css, media), | ||
ruleCss = _rehydrateSupportRule.ruleCss, | ||
supportCache = _rehydrateSupportRule.supportCache; | ||
rehydrateRules(renderer, renderer.cache, ruleCss, media); | ||
rehydrateRules(renderer.cache, ruleCss, media); | ||
@@ -25,13 +40,15 @@ renderer.cache = _extends({}, renderer.cache, supportCache); | ||
export default function rehydrateCache(renderer) { | ||
return arrayEach(document.querySelectorAll('[data-fela-type]'), function (node) { | ||
var type = node.getAttribute('data-fela-type') || ''; | ||
var media = node.getAttribute('media') || ''; | ||
var css = node.textContent; | ||
if (renderer.enableRehydration) { | ||
arrayEach(document.querySelectorAll('[data-fela-type]'), function (node) { | ||
var type = node.getAttribute('data-fela-type') || ''; | ||
var media = node.getAttribute('media') || ''; | ||
var css = node.textContent; | ||
var handler = rehydrationHandlers[type]; | ||
var handler = rehydrationHandlers[type]; | ||
if (handler) { | ||
handler(renderer, css, media); | ||
} | ||
}); | ||
if (handler) { | ||
handler(renderer, css, media); | ||
} | ||
}); | ||
} | ||
} |
@@ -9,5 +9,5 @@ var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
export default function rehydrateRules(renderer, cache, css) { | ||
var media = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ''; | ||
var support = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : ''; | ||
export default function rehydrateRules(cache, css) { | ||
var media = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; | ||
var support = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ''; | ||
@@ -36,4 +36,2 @@ var decl = void 0; | ||
renderer.getNextRuleIdentifier(); | ||
var declarationReference = support + media + pseudo + camelCaseProperty(property) + value; | ||
@@ -40,0 +38,0 @@ cache[declarationReference] = { |
@@ -9,4 +9,4 @@ var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
export default function rehydrateSupportRules(renderer, css) { | ||
var media = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; | ||
export default function rehydrateSupportRules(css) { | ||
var media = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; | ||
@@ -27,6 +27,9 @@ var supportCache = {}; | ||
rehydrateRules(renderer, supportCache, rules, media, support); | ||
rehydrateRules(supportCache, rules, media, support); | ||
} | ||
return { ruleCss: ruleCss, supportCache: supportCache }; | ||
return { | ||
ruleCss: ruleCss, | ||
supportCache: supportCache | ||
}; | ||
} |
@@ -11,3 +11,3 @@ import { createStyleTagMarkup, objectReduce, clusterCache, RULE_TYPE, KEYFRAME_TYPE, FONT_TYPE, STATIC_TYPE } from 'fela-utils'; | ||
export default function renderToMarkup(renderer) { | ||
var cacheCluster = clusterCache(renderer.cache, renderer.mediaQueryOrder); | ||
var cacheCluster = clusterCache(renderer.cache, renderer.mediaQueryOrder, renderer.uniqueRuleIdentifier); | ||
@@ -14,0 +14,0 @@ var basicMarkup = objectReduce(sheetMap, function (markup, type, key) { |
@@ -10,5 +10,4 @@ import { clusterCache, objectReduce, RULE_TYPE, KEYFRAME_TYPE, FONT_TYPE, STATIC_TYPE } from 'fela-utils'; | ||
export default function renderToSheetList(renderer) { | ||
var cacheCluster = clusterCache(renderer.cache, renderer.mediaQueryOrder); | ||
var cacheCluster = clusterCache(renderer.cache, renderer.mediaQueryOrder, renderer.uniqueRuleIdentifier); | ||
@@ -15,0 +14,0 @@ var sheetList = objectReduce(sheetMap, function (list, type, key) { |
@@ -9,2 +9,4 @@ 'use strict'; | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
exports.default = rehydrateCache; | ||
@@ -31,7 +33,20 @@ | ||
var rehydrationHandlers = _defineProperty({}, _felaUtils.RULE_TYPE, function (renderer, css, media) { | ||
var _rehydrateSupportRule = (0, _rehydrateSupportRules2.default)(renderer, css, media), | ||
// try to read the uniqueRuleIdentifier | ||
if (media.length === 0 && css.indexOf('#*/') !== -1) { | ||
var _css$split = css.split('#*/'), | ||
_css$split2 = _slicedToArray(_css$split, 2), | ||
left = _css$split2[0], | ||
right = _css$split2[1]; | ||
renderer.uniqueRuleIdentifier = parseInt(left.split('::')[1]); | ||
// it's ok to mutate | ||
css = right; | ||
} | ||
var _rehydrateSupportRule = (0, _rehydrateSupportRules2.default)(css, media), | ||
ruleCss = _rehydrateSupportRule.ruleCss, | ||
supportCache = _rehydrateSupportRule.supportCache; | ||
(0, _rehydrateRules2.default)(renderer, renderer.cache, ruleCss, media); | ||
(0, _rehydrateRules2.default)(renderer.cache, ruleCss, media); | ||
@@ -44,13 +59,15 @@ renderer.cache = _extends({}, renderer.cache, supportCache); | ||
function rehydrateCache(renderer) { | ||
return (0, _felaUtils.arrayEach)(document.querySelectorAll('[data-fela-type]'), function (node) { | ||
var type = node.getAttribute('data-fela-type') || ''; | ||
var media = node.getAttribute('media') || ''; | ||
var css = node.textContent; | ||
if (renderer.enableRehydration) { | ||
(0, _felaUtils.arrayEach)(document.querySelectorAll('[data-fela-type]'), function (node) { | ||
var type = node.getAttribute('data-fela-type') || ''; | ||
var media = node.getAttribute('media') || ''; | ||
var css = node.textContent; | ||
var handler = rehydrationHandlers[type]; | ||
var handler = rehydrationHandlers[type]; | ||
if (handler) { | ||
handler(renderer, css, media); | ||
} | ||
}); | ||
if (handler) { | ||
handler(renderer, css, media); | ||
} | ||
}); | ||
} | ||
} |
@@ -22,5 +22,5 @@ 'use strict'; | ||
function rehydrateRules(renderer, cache, css) { | ||
var media = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ''; | ||
var support = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : ''; | ||
function rehydrateRules(cache, css) { | ||
var media = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; | ||
var support = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ''; | ||
@@ -49,4 +49,2 @@ var decl = void 0; | ||
renderer.getNextRuleIdentifier(); | ||
var declarationReference = support + media + pseudo + (0, _camelCaseProperty2.default)(property) + value; | ||
@@ -53,0 +51,0 @@ cache[declarationReference] = { |
@@ -21,4 +21,4 @@ 'use strict'; | ||
function rehydrateSupportRules(renderer, css) { | ||
var media = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; | ||
function rehydrateSupportRules(css) { | ||
var media = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; | ||
@@ -39,6 +39,9 @@ var supportCache = {}; | ||
(0, _rehydrateRules2.default)(renderer, supportCache, rules, media, support); | ||
(0, _rehydrateRules2.default)(supportCache, rules, media, support); | ||
} | ||
return { ruleCss: ruleCss, supportCache: supportCache }; | ||
return { | ||
ruleCss: ruleCss, | ||
supportCache: supportCache | ||
}; | ||
} |
@@ -17,3 +17,3 @@ 'use strict'; | ||
function renderToMarkup(renderer) { | ||
var cacheCluster = (0, _felaUtils.clusterCache)(renderer.cache, renderer.mediaQueryOrder); | ||
var cacheCluster = (0, _felaUtils.clusterCache)(renderer.cache, renderer.mediaQueryOrder, renderer.uniqueRuleIdentifier); | ||
@@ -20,0 +20,0 @@ var basicMarkup = (0, _felaUtils.objectReduce)(sheetMap, function (markup, type, key) { |
@@ -17,3 +17,3 @@ 'use strict'; | ||
function renderToSheetList(renderer) { | ||
var cacheCluster = (0, _felaUtils.clusterCache)(renderer.cache, renderer.mediaQueryOrder); | ||
var cacheCluster = (0, _felaUtils.clusterCache)(renderer.cache, renderer.mediaQueryOrder, renderer.uniqueRuleIdentifier); | ||
@@ -20,0 +20,0 @@ var sheetList = (0, _felaUtils.objectReduce)(sheetMap, function (list, type, key) { |
{ | ||
"name": "fela-dom", | ||
"version": "6.0.0", | ||
"version": "6.0.1", | ||
"description": "Fela package for working with the DOM", | ||
@@ -27,8 +27,8 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"fela-tools": "^5.0.8", | ||
"fela-utils": "^7.0.0" | ||
"fela-tools": "^5.0.9", | ||
"fela-utils": "^7.0.1" | ||
}, | ||
"devDependencies": { | ||
"fela": "^6.0.0" | ||
"fela": "^6.0.1" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
34233
31
702
0
Updatedfela-tools@^5.0.9
Updatedfela-utils@^7.0.1