Comparing version 11.7.0 to 12.0.0-rc.0
@@ -1,2 +0,2 @@ | ||
import { RULE_TYPE } from '../../../../fela-utils/src/styleTypes'; | ||
import { RULE_TYPE } from 'fela-utils'; | ||
@@ -12,3 +12,2 @@ function getRules(cssRules) { | ||
if (conditionText) { | ||
@@ -35,4 +34,2 @@ rules[conditionText] = getRules(rule.cssRules); | ||
textContent = node.textContent; | ||
var type = node.getAttribute('data-fela-type'); | ||
@@ -42,8 +39,15 @@ var support = node.getAttribute('data-fela-support') || false; | ||
if (type !== RULE_TYPE) { | ||
return { _type: type, style: textContent }; | ||
return { | ||
_type: type, | ||
style: textContent | ||
}; | ||
} | ||
var rules = getRules(sheet.cssRules); | ||
return { _type: type, _media: media, _support: support, style: rules }; | ||
return { | ||
_type: type, | ||
_media: media, | ||
_support: support, | ||
style: rules | ||
}; | ||
} |
@@ -1,14 +0,21 @@ | ||
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; }; | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
import objectReduce from 'fast-loops/lib/objectReduce'; | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
import { objectReduce } from 'fast-loops'; | ||
import getNodeSibling from './getNodeSibling'; | ||
export default function createNode(attributes) { | ||
var targetDocument = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document; | ||
var sortMediaQuery = arguments[2]; | ||
var styleNodeAttributes = arguments[3]; | ||
var sortMediaQuery = arguments.length > 2 ? arguments[2] : undefined; | ||
var styleNodeAttributes = arguments.length > 3 ? arguments[3] : undefined; | ||
var head = targetDocument.head || {}; | ||
@@ -18,4 +25,2 @@ var type = attributes.type, | ||
support = attributes.support; | ||
var node = targetDocument.createElement('style'); | ||
@@ -31,11 +36,11 @@ node.setAttribute('data-fela-type', type); | ||
node.media = media; | ||
} | ||
} // applying custom style tag attributes | ||
// applying custom style tag attributes | ||
for (var attribute in styleNodeAttributes) { | ||
node.setAttribute(attribute, styleNodeAttributes[attribute]); | ||
} | ||
} // also apply attributes set globally with window.FelaConfig | ||
// also apply attributes set globally with window.FelaConfig | ||
if ((typeof window === 'undefined' ? 'undefined' : _typeof(window)) !== undefined && window.FelaConfig) { | ||
if ((typeof window === "undefined" ? "undefined" : _typeof(window)) !== undefined && window.FelaConfig) { | ||
for (var _attribute in window.FelaConfig.styleNodeAttributes) { | ||
@@ -47,3 +52,3 @@ node.setAttribute(_attribute, window.FelaConfig.styleNodeAttributes[_attribute]); | ||
var nodes = head.querySelectorAll('[data-fela-type]'); | ||
var sibling = getNodeSibling([].concat(_toConsumableArray(nodes)), attributes, sortMediaQuery); | ||
var sibling = getNodeSibling(_toConsumableArray(nodes), attributes, sortMediaQuery); | ||
@@ -50,0 +55,0 @@ if (sibling) { |
@@ -1,12 +0,8 @@ | ||
/* eslint-disable consistent-return */ | ||
import objectEach from 'fast-loops/lib/objectEach'; | ||
import { objectEach } from 'fast-loops'; | ||
import { RULE_TYPE, KEYFRAME_TYPE, FONT_TYPE, STATIC_TYPE, CLEAR_TYPE, generateCSSRule } from 'fela-utils'; | ||
import getNodeFromCache from './getNodeFromCache'; | ||
import insertRule from './insertRule'; | ||
export default function createSubscription(renderer) { | ||
var targetDocument = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document; | ||
return function (change) { | ||
@@ -17,3 +13,2 @@ if (change.type === CLEAR_TYPE) { | ||
}); | ||
renderer.nodes = {}; | ||
@@ -31,3 +26,5 @@ renderer.scoreIndex = {}; | ||
} | ||
break; | ||
case FONT_TYPE: | ||
@@ -37,3 +34,5 @@ if (node.textContent.indexOf(change.fontFace) === -1) { | ||
} | ||
break; | ||
case STATIC_TYPE: | ||
@@ -45,6 +44,9 @@ var css = change.selector ? generateCSSRule(change.selector, change.css) : change.css; | ||
} | ||
break; | ||
case RULE_TYPE: | ||
insertRule(change, renderer, node); | ||
break; | ||
default: | ||
@@ -51,0 +53,0 @@ // TODO: warning |
@@ -7,6 +7,5 @@ import queryNode from './queryNode'; | ||
_ref$media = _ref.media, | ||
media = _ref$media === undefined ? '' : _ref$media, | ||
media = _ref$media === void 0 ? '' : _ref$media, | ||
_ref$support = _ref.support, | ||
support = _ref$support === undefined ? '' : _ref$support; | ||
support = _ref$support === void 0 ? '' : _ref$support; | ||
return type + media + support; | ||
@@ -17,3 +16,2 @@ } | ||
var targetDocument = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : document; | ||
var reference = getReference(attributes); | ||
@@ -23,3 +21,2 @@ | ||
var node = queryNode(attributes, targetDocument) || createNode(attributes, targetDocument, renderer.sortMediaQuery, renderer.styleNodeAttributes); | ||
renderer.nodes[reference] = node; | ||
@@ -26,0 +23,0 @@ } |
@@ -1,5 +0,14 @@ | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
import { FONT_TYPE, STATIC_TYPE, KEYFRAME_TYPE, RULE_TYPE } from 'fela-utils'; | ||
export default function getNodeSibling(nodes, _ref, sortMediaQuery) { | ||
@@ -15,2 +24,3 @@ var type = _ref.type, | ||
return nodes[0]; | ||
case RULE_TYPE: | ||
@@ -36,2 +46,3 @@ var mediaNodes = nodes.map(function (node) { | ||
} | ||
return nodes.find(function (el) { | ||
@@ -43,2 +54,3 @@ return el.media === insertMedia; | ||
var _sorted = filteredNodes.sort(sortMediaQuery); | ||
var _insertMedia = _sorted[0]; | ||
@@ -64,3 +76,4 @@ | ||
} | ||
} | ||
} |
import { generateCSSRule, generateCSSSupportRule, getRuleScore } from 'fela-utils'; | ||
export default function insertRule(_ref, renderer, node) { | ||
@@ -9,3 +8,2 @@ var selector = _ref.selector, | ||
pseudo = _ref.pseudo; | ||
var nodeReference = media + support; | ||
@@ -16,8 +14,5 @@ | ||
var cssRules = node.sheet.cssRules; | ||
var index = cssRules.length; // This heavily optimises the amount of rule iterations we need | ||
// due to most rules having a score=0 anyways | ||
var index = cssRules.length; | ||
// This heavily optimises the amount of rule iterations we need | ||
// due to most rules having a score=0 anyways | ||
if (score === 0) { | ||
@@ -56,4 +51,3 @@ if (renderer.scoreIndex[nodeReference] === undefined) { | ||
cssRules[index].score = score; | ||
} catch (e) { | ||
// We're disabled these warnings due to false-positive errors with browser prefixes | ||
} catch (e) {// We're disabled these warnings due to false-positive errors with browser prefixes | ||
// See https://github.com/robinweser/fela/issues/634 | ||
@@ -60,0 +54,0 @@ // console.warn( |
@@ -1,3 +0,1 @@ | ||
export default function queryNode(_ref) { | ||
@@ -8,7 +6,5 @@ var type = _ref.type, | ||
var targetDocument = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document; | ||
var mediaQuery = media ? '[media="' + media + '"]' : ':not([media])'; | ||
var mediaQuery = media ? "[media=\"".concat(media, "\"]") : ':not([media])'; | ||
var supportQuery = support ? '[data-fela-support="true"]' : ':not([data-fela-support="true"])'; | ||
return targetDocument.querySelector('[data-fela-type="' + type + '"]' + supportQuery + mediaQuery); | ||
return targetDocument.querySelector("[data-fela-type=\"".concat(type, "\"]").concat(supportQuery).concat(mediaQuery)); | ||
} |
@@ -1,25 +0,17 @@ | ||
import arrayEach from 'fast-loops/lib/arrayEach'; | ||
import { arrayEach } from 'fast-loops'; | ||
import { RULE_TYPE, KEYFRAME_TYPE, getRuleScore } from 'fela-utils'; | ||
import rehydrateSupportRules from './rehydration/rehydrateSupportRules'; | ||
import rehydrateRules from './rehydration/rehydrateRules'; | ||
import render from './render'; | ||
import rehydrateKeyframes from './rehydration/rehydrateKeyframes'; | ||
var CLASSNAME_REGEX = /[.][a-z0-9_-]*/gi; // TODO: static, font | ||
var CLASSNAME_REGEX = /[.][a-z0-9_-]*/gi; | ||
// TODO: static, font | ||
export default function rehydrate(renderer) { | ||
var targetDocument = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document; | ||
render(renderer, targetDocument); | ||
arrayEach(targetDocument.querySelectorAll('[data-fela-type]'), function (node) { | ||
var rehydrationAttribute = node.getAttribute('data-fela-rehydration') || -1; | ||
var rehydrationIndex = renderer.uniqueRuleIdentifier || parseInt(rehydrationAttribute, 10); | ||
var rehydrationIndex = renderer.uniqueRuleIdentifier || parseInt(rehydrationAttribute, 10); // skip rehydration if no rehydration index is set | ||
// this index is set to -1 if something blocks rehydration | ||
// skip rehydration if no rehydration index is set | ||
// this index is set to -1 if something blocks rehydration | ||
if (rehydrationIndex !== -1) { | ||
@@ -30,5 +22,3 @@ var type = node.getAttribute('data-fela-type') || ''; | ||
var css = node.textContent; | ||
renderer.uniqueRuleIdentifier = rehydrationIndex; | ||
var reference = type + media + support; | ||
@@ -42,13 +32,11 @@ renderer.nodes[reference] = node; | ||
rehydrateRules(css, media, '', renderer.cache, renderer.specificityPrefix); | ||
} | ||
// On Safari, style sheets with IE-specific media queries | ||
} // On Safari, style sheets with IE-specific media queries | ||
// can yield null for node.sheet | ||
// https://github.com/robinweser/fela/issues/431#issuecomment-423239591 | ||
if (node.sheet && node.sheet.cssRules) { | ||
var nodeReference = media + support; | ||
arrayEach(node.sheet.cssRules, function (rule, index) { | ||
var selectorText = rule.conditionText ? rule.cssRules[0].selectorText : rule.selectorText; | ||
var score = getRuleScore(renderer.ruleOrder, selectorText.split(CLASSNAME_REGEX)[1]); | ||
@@ -55,0 +43,0 @@ |
import { generateCSSSelector } from 'fela-utils'; | ||
export default function generateCacheEntry(type, className, property, value) { | ||
@@ -8,3 +7,2 @@ var pseudo = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : ''; | ||
var specificityPrefix = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : ''; | ||
return { | ||
@@ -11,0 +9,0 @@ type: type, |
@@ -1,12 +0,19 @@ | ||
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
import { KEYFRAME_TYPE, generateDeclarationReference } from 'fela-utils'; | ||
var RE = /@(-webkit-|-moz-)?keyframes ([a-z_][a-z0-9-_]*)(\{.*?(?=}})}})/gi; | ||
export default function rehydrateKeyframes(css) { | ||
var cache = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var decl; | ||
var decl = void 0; | ||
while (decl = RE.exec(css)) { | ||
@@ -13,0 +20,0 @@ var _decl = decl, |
@@ -1,18 +0,27 @@ | ||
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
import { RULE_TYPE, generateDeclarationReference } from 'fela-utils'; | ||
import { camelCaseProperty } from 'css-in-js-utils'; | ||
import generateCacheEntry from './generateCacheEntry'; // Escaping for RegExp taken from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Escaping | ||
import generateCacheEntry from './generateCacheEntry'; | ||
// Escaping for RegExp taken from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Escaping | ||
function escapeRegExp(string) { | ||
return string.replace(/[.*+\-?^${}()|[\]\\]/g, '\\$&'); | ||
} | ||
} // we reuse regexes for improved performance | ||
// we reuse regexes for improved performance | ||
var regexMap = {}; | ||
function getRegex(specificityPrefix) { | ||
if (!regexMap[specificityPrefix]) { | ||
regexMap[specificityPrefix] = new RegExp(escapeRegExp(specificityPrefix) + '[.]([0-9a-z_-]+)([.][0-9a-z_-]+){0,}([^{]+)?{([^:]+):([^}]+)}', 'gi'); | ||
regexMap[specificityPrefix] = new RegExp("".concat(escapeRegExp(specificityPrefix), "[.]([0-9a-z_-]+)([.][0-9a-z_-]+){0,}([^{]+)?{([^:]+):([^}]+)}"), 'gi'); | ||
} | ||
@@ -28,9 +37,8 @@ | ||
var specificityPrefix = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : ''; | ||
var decl; | ||
var DECL_REGEX = getRegex(specificityPrefix); // This excellent parsing implementation was originally taken from Styletron and modified to fit Fela | ||
// https://github.com/rtsao/styletron/blob/master/packages/styletron-client/src/index.js#L47 | ||
var decl = void 0; | ||
var DECL_REGEX = getRegex(specificityPrefix); | ||
/* eslint-disable no-unused-vars,no-cond-assign */ | ||
// This excellent parsing implementation was originally taken from Styletron and modified to fit Fela | ||
// https://github.com/rtsao/styletron/blob/master/packages/styletron-client/src/index.js#L47 | ||
/* eslint-disable no-unused-vars,no-cond-assign */ | ||
while (decl = DECL_REGEX.exec(css)) { | ||
@@ -48,6 +56,5 @@ // $FlowFixMe | ||
var declarationReference = generateDeclarationReference( | ||
// keep css custom properties as lower-cased props | ||
var declarationReference = generateDeclarationReference( // keep css custom properties as lower-cased props | ||
property.indexOf('--') === 0 ? property : camelCaseProperty(property), value, pseudo, media, support); | ||
cache[declarationReference] = generateCacheEntry(RULE_TYPE, className, property, value, pseudo, media, support, specificityPrefix); | ||
@@ -54,0 +61,0 @@ } |
@@ -1,8 +0,16 @@ | ||
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
import extractSupportQuery from './extractSupportQuery'; | ||
import rehydrateRules from './rehydrateRules'; | ||
var SUPPORT_REGEX = /@supports[^{]+\{([\s\S]+?})\s*}/gi; | ||
export default function rehydrateSupportRules(css) { | ||
@@ -12,6 +20,4 @@ var media = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; | ||
var specificityPrefix = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ''; | ||
var decl; // eslint-disable-next-line no-cond-assign | ||
var decl = void 0; | ||
// eslint-disable-next-line no-cond-assign | ||
while (decl = SUPPORT_REGEX.exec(css)) { | ||
@@ -18,0 +24,0 @@ var _decl = decl, |
@@ -1,5 +0,3 @@ | ||
import objectEach from 'fast-loops/lib/objectEach'; | ||
import { objectEach } from 'fast-loops'; | ||
import createSubscription from './connection/createSubscription'; | ||
export default function render(renderer, targetDocument) { | ||
@@ -9,10 +7,8 @@ if (!renderer.updateSubscription) { | ||
renderer.nodes = {}; | ||
renderer.updateSubscription = createSubscription(renderer, targetDocument); | ||
renderer.subscribe(renderer.updateSubscription); | ||
renderer.subscribe(renderer.updateSubscription); // simulate rendering to ensure all styles rendered prior to | ||
// calling FelaDOM.render are correctly injected as well | ||
// simulate rendering to ensure all styles rendered prior to | ||
// calling FelaDOM.render are correctly injected as well | ||
objectEach(renderer.cache, renderer._emitChange); | ||
} | ||
} |
import render from './dom/render'; | ||
import rehydrate from './dom/rehydrate'; | ||
import renderToMarkup from './server/renderToMarkup'; | ||
import renderToSheetList from './server/renderToSheetList'; | ||
export { render, rehydrate, renderToMarkup, renderToSheetList }; |
@@ -1,3 +0,2 @@ | ||
import objectReduce from 'fast-loops/lib/objectReduce'; | ||
import { objectReduce } from 'fast-loops'; | ||
export default function createStyleTagMarkup(css, type) { | ||
@@ -8,4 +7,3 @@ var media = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; | ||
var styleNodeAttributes = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {}; | ||
var mediaAttribute = media.length > 0 ? ' media="' + media + '"' : ''; | ||
var mediaAttribute = media.length > 0 ? " media=\"".concat(media, "\"") : ''; | ||
var supportAttribute = support ? ' data-fela-support="true"' : ''; | ||
@@ -15,4 +13,3 @@ var userAttributes = objectReduce(styleNodeAttributes, function (attributes, value, attribute) { | ||
}, ''); | ||
return '<style type="text/css" data-fela-rehydration="' + rehydrationIndex + '" data-fela-type="' + type + '"' + supportAttribute + mediaAttribute + userAttributes + '>' + css + '</style>'; | ||
return "<style type=\"text/css\" data-fela-rehydration=\"".concat(rehydrationIndex, "\" data-fela-type=\"").concat(type, "\"").concat(supportAttribute).concat(mediaAttribute).concat(userAttributes, ">").concat(css, "</style>"); | ||
} |
@@ -1,6 +0,2 @@ | ||
var SELECTOR_PREFIX_REGEXP = /^[a-z0-9_-]*$/gi; | ||
export default function getRehydrationIndex(renderer) { | ||
@@ -7,0 +3,0 @@ if (renderer.selectorPrefix.length === 0 || renderer.selectorPrefix.match(SELECTOR_PREFIX_REGEXP) !== null) { |
@@ -1,15 +0,14 @@ | ||
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; }; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } | ||
import arrayReduce from 'fast-loops/lib/arrayReduce'; | ||
import objectReduce from 'fast-loops/lib/objectReduce'; | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } | ||
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; } | ||
import { arrayReduce, objectReduce } from 'fast-loops'; | ||
import { clusterCache, cssifySupportRules, sheetMap, RULE_TYPE } from 'fela-utils'; | ||
import createStyleTagMarkup from './createStyleTagMarkup'; | ||
import getRehydrationIndex from './getRehydrationIndex'; | ||
export default function renderToMarkup(renderer) { | ||
var cacheCluster = clusterCache(renderer.cache, renderer.ruleOrder); | ||
var rehydrationIndex = getRehydrationIndex(renderer); | ||
var styleMarkup = objectReduce(sheetMap, function (markup, type, key) { | ||
@@ -22,3 +21,2 @@ if (cacheCluster[key].length > 0) { | ||
}, ''); | ||
var support = cssifySupportRules(cacheCluster.supportRules); | ||
@@ -30,4 +28,3 @@ | ||
var mediaKeys = Object.keys(_extends({}, cacheCluster.supportMediaRules, cacheCluster.mediaRules)).sort(renderer.sortMediaQuery); | ||
var mediaKeys = Object.keys(_objectSpread(_objectSpread({}, cacheCluster.supportMediaRules), cacheCluster.mediaRules)).sort(renderer.sortMediaQuery); | ||
return arrayReduce(mediaKeys, function (markup, media) { | ||
@@ -37,5 +34,5 @@ // basic media query rules | ||
markup += createStyleTagMarkup(cacheCluster.mediaRules[media], RULE_TYPE, media, rehydrationIndex, false, renderer.styleNodeAttributes); | ||
} | ||
} // support media rules | ||
// support media rules | ||
if (cacheCluster.supportMediaRules[media]) { | ||
@@ -42,0 +39,0 @@ var mediaSupport = cssifySupportRules(cacheCluster.supportMediaRules[media]); |
@@ -1,14 +0,13 @@ | ||
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; }; | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } | ||
import arrayReduce from 'fast-loops/lib/arrayReduce'; | ||
import objectReduce from 'fast-loops/lib/objectReduce'; | ||
import { clusterCache, cssifySupportRules, sheetMap, RULE_TYPE, KEYFRAME_TYPE, FONT_TYPE, STATIC_TYPE } from 'fela-utils'; | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } | ||
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; } | ||
import { arrayReduce, objectReduce } from 'fast-loops'; | ||
import { clusterCache, cssifySupportRules, sheetMap, RULE_TYPE } from 'fela-utils'; | ||
import getRehydrationIndex from './getRehydrationIndex'; | ||
export default function renderToSheetList(renderer) { | ||
var cacheCluster = clusterCache(renderer.cache, renderer.ruleOrder); | ||
var rehydrationIndex = getRehydrationIndex(renderer); | ||
var sheetList = objectReduce(sheetMap, function (list, type, key) { | ||
@@ -26,3 +25,2 @@ if (cacheCluster[key].length > 0) { | ||
}, []); | ||
var support = cssifySupportRules(cacheCluster.supportRules); | ||
@@ -40,4 +38,3 @@ | ||
var mediaKeys = Object.keys(_extends({}, cacheCluster.supportMediaRules, cacheCluster.mediaRules)).sort(renderer.sortMediaQuery); | ||
var mediaKeys = Object.keys(_objectSpread(_objectSpread({}, cacheCluster.supportMediaRules), cacheCluster.mediaRules)).sort(renderer.sortMediaQuery); | ||
return arrayReduce(mediaKeys, function (list, media) { | ||
@@ -53,5 +50,5 @@ // basic media query rules | ||
}); | ||
} | ||
} // support media rules | ||
// support media rules | ||
if (cacheCluster.supportMediaRules[media]) { | ||
@@ -58,0 +55,0 @@ var mediaSupport = cssifySupportRules(cacheCluster.supportMediaRules[media]); |
@@ -6,3 +6,4 @@ "use strict"; | ||
}); | ||
exports.default = cleanHead; | ||
exports["default"] = cleanHead; | ||
function cleanHead() { | ||
@@ -9,0 +10,0 @@ var _document = document, |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,5 +6,5 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.default = getStyleSheetStyle; | ||
exports["default"] = getStyleSheetStyle; | ||
var _styleTypes = require('../../../../fela-utils/src/styleTypes'); | ||
var _felaUtils = require("fela-utils"); | ||
@@ -20,3 +20,2 @@ function getRules(cssRules) { | ||
if (conditionText) { | ||
@@ -43,14 +42,19 @@ rules[conditionText] = getRules(rule.cssRules); | ||
textContent = node.textContent; | ||
var type = node.getAttribute('data-fela-type'); | ||
var support = node.getAttribute('data-fela-support') || false; | ||
if (type !== _styleTypes.RULE_TYPE) { | ||
return { _type: type, style: textContent }; | ||
if (type !== _felaUtils.RULE_TYPE) { | ||
return { | ||
_type: type, | ||
style: textContent | ||
}; | ||
} | ||
var rules = getRules(sheet.cssRules); | ||
return { _type: type, _media: media, _support: support, style: rules }; | ||
return { | ||
_type: type, | ||
_media: media, | ||
_support: support, | ||
style: rules | ||
}; | ||
} |
@@ -6,3 +6,4 @@ "use strict"; | ||
}); | ||
exports.default = sortObject; | ||
exports["default"] = sortObject; | ||
function sortObject(obj) { | ||
@@ -9,0 +10,0 @@ return Object.keys(obj).sort().reduce(function (newObj, key) { |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,24 +6,28 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports["default"] = createNode; | ||
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 _fastLoops = require("fast-loops"); | ||
exports.default = createNode; | ||
var _getNodeSibling = _interopRequireDefault(require("./getNodeSibling")); | ||
var _objectReduce = require('fast-loops/lib/objectReduce'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _objectReduce2 = _interopRequireDefault(_objectReduce); | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
var _getNodeSibling = require('./getNodeSibling'); | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
var _getNodeSibling2 = _interopRequireDefault(_getNodeSibling); | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
function createNode(attributes) { | ||
var targetDocument = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document; | ||
var sortMediaQuery = arguments[2]; | ||
var styleNodeAttributes = arguments[3]; | ||
var sortMediaQuery = arguments.length > 2 ? arguments[2] : undefined; | ||
var styleNodeAttributes = arguments.length > 3 ? arguments[3] : undefined; | ||
var head = targetDocument.head || {}; | ||
@@ -33,4 +37,2 @@ var type = attributes.type, | ||
support = attributes.support; | ||
var node = targetDocument.createElement('style'); | ||
@@ -46,11 +48,11 @@ node.setAttribute('data-fela-type', type); | ||
node.media = media; | ||
} | ||
} // applying custom style tag attributes | ||
// applying custom style tag attributes | ||
for (var attribute in styleNodeAttributes) { | ||
node.setAttribute(attribute, styleNodeAttributes[attribute]); | ||
} | ||
} // also apply attributes set globally with window.FelaConfig | ||
// also apply attributes set globally with window.FelaConfig | ||
if ((typeof window === 'undefined' ? 'undefined' : _typeof(window)) !== undefined && window.FelaConfig) { | ||
if ((typeof window === "undefined" ? "undefined" : _typeof(window)) !== undefined && window.FelaConfig) { | ||
for (var _attribute in window.FelaConfig.styleNodeAttributes) { | ||
@@ -62,3 +64,3 @@ node.setAttribute(_attribute, window.FelaConfig.styleNodeAttributes[_attribute]); | ||
var nodes = head.querySelectorAll('[data-fela-type]'); | ||
var sibling = (0, _getNodeSibling2.default)([].concat(_toConsumableArray(nodes)), attributes, sortMediaQuery); | ||
var sibling = (0, _getNodeSibling["default"])(_toConsumableArray(nodes), attributes, sortMediaQuery); | ||
@@ -65,0 +67,0 @@ if (sibling) { |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,30 +6,22 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.default = createSubscription; | ||
exports["default"] = createSubscription; | ||
var _objectEach = require('fast-loops/lib/objectEach'); | ||
var _fastLoops = require("fast-loops"); | ||
var _objectEach2 = _interopRequireDefault(_objectEach); | ||
var _felaUtils = require("fela-utils"); | ||
var _felaUtils = require('fela-utils'); | ||
var _getNodeFromCache = _interopRequireDefault(require("./getNodeFromCache")); | ||
var _getNodeFromCache = require('./getNodeFromCache'); | ||
var _insertRule = _interopRequireDefault(require("./insertRule")); | ||
var _getNodeFromCache2 = _interopRequireDefault(_getNodeFromCache); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _insertRule = require('./insertRule'); | ||
var _insertRule2 = _interopRequireDefault(_insertRule); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/* eslint-disable consistent-return */ | ||
function createSubscription(renderer) { | ||
var targetDocument = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document; | ||
return function (change) { | ||
if (change.type === _felaUtils.CLEAR_TYPE) { | ||
(0, _objectEach2.default)(renderer.nodes, function (node) { | ||
(0, _fastLoops.objectEach)(renderer.nodes, function (node) { | ||
return node.parentNode.removeChild(node); | ||
}); | ||
renderer.nodes = {}; | ||
@@ -40,3 +32,3 @@ renderer.scoreIndex = {}; | ||
var node = (0, _getNodeFromCache2.default)(change, renderer, targetDocument); | ||
var node = (0, _getNodeFromCache["default"])(change, renderer, targetDocument); | ||
@@ -48,3 +40,5 @@ switch (change.type) { | ||
} | ||
break; | ||
case _felaUtils.FONT_TYPE: | ||
@@ -54,3 +48,5 @@ if (node.textContent.indexOf(change.fontFace) === -1) { | ||
} | ||
break; | ||
case _felaUtils.STATIC_TYPE: | ||
@@ -62,6 +58,9 @@ var css = change.selector ? (0, _felaUtils.generateCSSRule)(change.selector, change.css) : change.css; | ||
} | ||
break; | ||
case _felaUtils.RULE_TYPE: | ||
(0, _insertRule2.default)(change, renderer, node); | ||
(0, _insertRule["default"])(change, renderer, node); | ||
break; | ||
default: | ||
@@ -68,0 +67,0 @@ // TODO: warning |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,21 +6,16 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.default = getNodeFromCache; | ||
exports["default"] = getNodeFromCache; | ||
var _queryNode = require('./queryNode'); | ||
var _queryNode = _interopRequireDefault(require("./queryNode")); | ||
var _queryNode2 = _interopRequireDefault(_queryNode); | ||
var _createNode = _interopRequireDefault(require("./createNode")); | ||
var _createNode = require('./createNode'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _createNode2 = _interopRequireDefault(_createNode); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function getReference(_ref) { | ||
var type = _ref.type, | ||
_ref$media = _ref.media, | ||
media = _ref$media === undefined ? '' : _ref$media, | ||
media = _ref$media === void 0 ? '' : _ref$media, | ||
_ref$support = _ref.support, | ||
support = _ref$support === undefined ? '' : _ref$support; | ||
support = _ref$support === void 0 ? '' : _ref$support; | ||
return type + media + support; | ||
@@ -31,8 +26,6 @@ } | ||
var targetDocument = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : document; | ||
var reference = getReference(attributes); | ||
if (!renderer.nodes[reference]) { | ||
var node = (0, _queryNode2.default)(attributes, targetDocument) || (0, _createNode2.default)(attributes, targetDocument, renderer.sortMediaQuery, renderer.styleNodeAttributes); | ||
var node = (0, _queryNode["default"])(attributes, targetDocument) || (0, _createNode["default"])(attributes, targetDocument, renderer.sortMediaQuery, renderer.styleNodeAttributes); | ||
renderer.nodes[reference] = node; | ||
@@ -39,0 +32,0 @@ } |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,8 +6,18 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.default = getNodeSibling; | ||
exports["default"] = getNodeSibling; | ||
var _felaUtils = require('fela-utils'); | ||
var _felaUtils = require("fela-utils"); | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function getNodeSibling(nodes, _ref, sortMediaQuery) { | ||
@@ -23,2 +33,3 @@ var type = _ref.type, | ||
return nodes[0]; | ||
case _felaUtils.RULE_TYPE: | ||
@@ -44,2 +55,3 @@ var mediaNodes = nodes.map(function (node) { | ||
} | ||
return nodes.find(function (el) { | ||
@@ -51,2 +63,3 @@ return el.media === insertMedia; | ||
var _sorted = filteredNodes.sort(sortMediaQuery); | ||
var _insertMedia = _sorted[0]; | ||
@@ -72,3 +85,4 @@ | ||
} | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,5 +6,5 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.default = insertRule; | ||
exports["default"] = insertRule; | ||
var _felaUtils = require('fela-utils'); | ||
var _felaUtils = require("fela-utils"); | ||
@@ -17,3 +17,2 @@ function insertRule(_ref, renderer, node) { | ||
pseudo = _ref.pseudo; | ||
var nodeReference = media + support; | ||
@@ -24,8 +23,5 @@ | ||
var cssRules = node.sheet.cssRules; | ||
var index = cssRules.length; // This heavily optimises the amount of rule iterations we need | ||
// due to most rules having a score=0 anyways | ||
var index = cssRules.length; | ||
// This heavily optimises the amount of rule iterations we need | ||
// due to most rules having a score=0 anyways | ||
if (score === 0) { | ||
@@ -64,4 +60,3 @@ if (renderer.scoreIndex[nodeReference] === undefined) { | ||
cssRules[index].score = score; | ||
} catch (e) { | ||
// We're disabled these warnings due to false-positive errors with browser prefixes | ||
} catch (e) {// We're disabled these warnings due to false-positive errors with browser prefixes | ||
// See https://github.com/robinweser/fela/issues/634 | ||
@@ -68,0 +63,0 @@ // console.warn( |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,3 +6,4 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.default = queryNode; | ||
exports["default"] = queryNode; | ||
function queryNode(_ref) { | ||
@@ -13,7 +14,5 @@ var type = _ref.type, | ||
var targetDocument = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document; | ||
var mediaQuery = media ? '[media="' + media + '"]' : ':not([media])'; | ||
var mediaQuery = media ? "[media=\"".concat(media, "\"]") : ':not([media])'; | ||
var supportQuery = support ? '[data-fela-support="true"]' : ':not([data-fela-support="true"])'; | ||
return targetDocument.querySelector('[data-fela-type="' + type + '"]' + supportQuery + mediaQuery); | ||
return targetDocument.querySelector("[data-fela-type=\"".concat(type, "\"]").concat(supportQuery).concat(mediaQuery)); | ||
} |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,42 +6,28 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.default = rehydrate; | ||
exports["default"] = rehydrate; | ||
var _arrayEach = require('fast-loops/lib/arrayEach'); | ||
var _fastLoops = require("fast-loops"); | ||
var _arrayEach2 = _interopRequireDefault(_arrayEach); | ||
var _felaUtils = require("fela-utils"); | ||
var _felaUtils = require('fela-utils'); | ||
var _rehydrateSupportRules = _interopRequireDefault(require("./rehydration/rehydrateSupportRules")); | ||
var _rehydrateSupportRules = require('./rehydration/rehydrateSupportRules'); | ||
var _rehydrateRules = _interopRequireDefault(require("./rehydration/rehydrateRules")); | ||
var _rehydrateSupportRules2 = _interopRequireDefault(_rehydrateSupportRules); | ||
var _render = _interopRequireDefault(require("./render")); | ||
var _rehydrateRules = require('./rehydration/rehydrateRules'); | ||
var _rehydrateKeyframes = _interopRequireDefault(require("./rehydration/rehydrateKeyframes")); | ||
var _rehydrateRules2 = _interopRequireDefault(_rehydrateRules); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _render = require('./render'); | ||
var CLASSNAME_REGEX = /[.][a-z0-9_-]*/gi; // TODO: static, font | ||
var _render2 = _interopRequireDefault(_render); | ||
var _rehydrateKeyframes = require('./rehydration/rehydrateKeyframes'); | ||
var _rehydrateKeyframes2 = _interopRequireDefault(_rehydrateKeyframes); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var CLASSNAME_REGEX = /[.][a-z0-9_-]*/gi; | ||
// TODO: static, font | ||
function rehydrate(renderer) { | ||
var targetDocument = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document; | ||
(0, _render2.default)(renderer, targetDocument); | ||
(0, _arrayEach2.default)(targetDocument.querySelectorAll('[data-fela-type]'), function (node) { | ||
(0, _render["default"])(renderer, targetDocument); | ||
(0, _fastLoops.arrayEach)(targetDocument.querySelectorAll('[data-fela-type]'), function (node) { | ||
var rehydrationAttribute = node.getAttribute('data-fela-rehydration') || -1; | ||
var rehydrationIndex = renderer.uniqueRuleIdentifier || parseInt(rehydrationAttribute, 10); | ||
var rehydrationIndex = renderer.uniqueRuleIdentifier || parseInt(rehydrationAttribute, 10); // skip rehydration if no rehydration index is set | ||
// this index is set to -1 if something blocks rehydration | ||
// skip rehydration if no rehydration index is set | ||
// this index is set to -1 if something blocks rehydration | ||
if (rehydrationIndex !== -1) { | ||
@@ -52,5 +38,3 @@ var type = node.getAttribute('data-fela-type') || ''; | ||
var css = node.textContent; | ||
renderer.uniqueRuleIdentifier = rehydrationIndex; | ||
var reference = type + media + support; | ||
@@ -61,16 +45,14 @@ renderer.nodes[reference] = node; | ||
if (support) { | ||
(0, _rehydrateSupportRules2.default)(css, media, renderer.cache, renderer.specificityPrefix); | ||
(0, _rehydrateSupportRules["default"])(css, media, renderer.cache, renderer.specificityPrefix); | ||
} else { | ||
(0, _rehydrateRules2.default)(css, media, '', renderer.cache, renderer.specificityPrefix); | ||
} | ||
// On Safari, style sheets with IE-specific media queries | ||
(0, _rehydrateRules["default"])(css, media, '', renderer.cache, renderer.specificityPrefix); | ||
} // On Safari, style sheets with IE-specific media queries | ||
// can yield null for node.sheet | ||
// https://github.com/robinweser/fela/issues/431#issuecomment-423239591 | ||
if (node.sheet && node.sheet.cssRules) { | ||
var nodeReference = media + support; | ||
(0, _arrayEach2.default)(node.sheet.cssRules, function (rule, index) { | ||
(0, _fastLoops.arrayEach)(node.sheet.cssRules, function (rule, index) { | ||
var selectorText = rule.conditionText ? rule.cssRules[0].selectorText : rule.selectorText; | ||
var score = (0, _felaUtils.getRuleScore)(renderer.ruleOrder, selectorText.split(CLASSNAME_REGEX)[1]); | ||
@@ -86,3 +68,3 @@ | ||
} else if (type === _felaUtils.KEYFRAME_TYPE) { | ||
(0, _rehydrateKeyframes2.default)(css, renderer.cache); | ||
(0, _rehydrateKeyframes["default"])(css, renderer.cache); | ||
} | ||
@@ -89,0 +71,0 @@ } |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,5 +6,6 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.default = extractSupportQuery; | ||
exports["default"] = extractSupportQuery; | ||
function extractSupportQuery(ruleSet) { | ||
return ruleSet.split('{')[0].slice(9).trim(); | ||
} |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,5 +6,5 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.default = generateCacheEntry; | ||
exports["default"] = generateCacheEntry; | ||
var _felaUtils = require('fela-utils'); | ||
var _felaUtils = require("fela-utils"); | ||
@@ -16,3 +16,2 @@ function generateCacheEntry(type, className, property, value) { | ||
var specificityPrefix = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : ''; | ||
return { | ||
@@ -19,0 +18,0 @@ type: type, |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,9 +6,18 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports["default"] = rehydrateKeyframes; | ||
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"); } }; }(); | ||
var _felaUtils = require("fela-utils"); | ||
exports.default = rehydrateKeyframes; | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | ||
var _felaUtils = require('fela-utils'); | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
var RE = /@(-webkit-|-moz-)?keyframes ([a-z_][a-z0-9-_]*)(\{.*?(?=}})}})/gi; | ||
@@ -18,5 +27,4 @@ | ||
var cache = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var decl; | ||
var decl = void 0; | ||
while (decl = RE.exec(css)) { | ||
@@ -23,0 +31,0 @@ var _decl = decl, |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,27 +6,35 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports["default"] = rehydrateRules; | ||
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"); } }; }(); | ||
var _felaUtils = require("fela-utils"); | ||
exports.default = rehydrateRules; | ||
var _cssInJsUtils = require("css-in-js-utils"); | ||
var _felaUtils = require('fela-utils'); | ||
var _generateCacheEntry = _interopRequireDefault(require("./generateCacheEntry")); | ||
var _cssInJsUtils = require('css-in-js-utils'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _generateCacheEntry = require('./generateCacheEntry'); | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | ||
var _generateCacheEntry2 = _interopRequireDefault(_generateCacheEntry); | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
// Escaping for RegExp taken from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Escaping | ||
function escapeRegExp(string) { | ||
return string.replace(/[.*+\-?^${}()|[\]\\]/g, '\\$&'); | ||
} | ||
} // we reuse regexes for improved performance | ||
// we reuse regexes for improved performance | ||
var regexMap = {}; | ||
function getRegex(specificityPrefix) { | ||
if (!regexMap[specificityPrefix]) { | ||
regexMap[specificityPrefix] = new RegExp(escapeRegExp(specificityPrefix) + '[.]([0-9a-z_-]+)([.][0-9a-z_-]+){0,}([^{]+)?{([^:]+):([^}]+)}', 'gi'); | ||
regexMap[specificityPrefix] = new RegExp("".concat(escapeRegExp(specificityPrefix), "[.]([0-9a-z_-]+)([.][0-9a-z_-]+){0,}([^{]+)?{([^:]+):([^}]+)}"), 'gi'); | ||
} | ||
@@ -42,9 +50,8 @@ | ||
var specificityPrefix = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : ''; | ||
var decl; | ||
var DECL_REGEX = getRegex(specificityPrefix); // This excellent parsing implementation was originally taken from Styletron and modified to fit Fela | ||
// https://github.com/rtsao/styletron/blob/master/packages/styletron-client/src/index.js#L47 | ||
var decl = void 0; | ||
var DECL_REGEX = getRegex(specificityPrefix); | ||
/* eslint-disable no-unused-vars,no-cond-assign */ | ||
// This excellent parsing implementation was originally taken from Styletron and modified to fit Fela | ||
// https://github.com/rtsao/styletron/blob/master/packages/styletron-client/src/index.js#L47 | ||
/* eslint-disable no-unused-vars,no-cond-assign */ | ||
while (decl = DECL_REGEX.exec(css)) { | ||
@@ -62,7 +69,6 @@ // $FlowFixMe | ||
var declarationReference = (0, _felaUtils.generateDeclarationReference)( | ||
// keep css custom properties as lower-cased props | ||
var declarationReference = (0, _felaUtils.generateDeclarationReference)( // keep css custom properties as lower-cased props | ||
property.indexOf('--') === 0 ? property : (0, _cssInJsUtils.camelCaseProperty)(property), value, pseudo, media, support); | ||
cache[declarationReference] = (0, _generateCacheEntry2.default)(_felaUtils.RULE_TYPE, className, property, value, pseudo, media, support, specificityPrefix); | ||
cache[declarationReference] = (0, _generateCacheEntry["default"])(_felaUtils.RULE_TYPE, className, property, value, pseudo, media, support, specificityPrefix); | ||
} | ||
@@ -69,0 +75,0 @@ |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,17 +6,22 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports["default"] = rehydrateSupportRules; | ||
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"); } }; }(); | ||
var _extractSupportQuery = _interopRequireDefault(require("./extractSupportQuery")); | ||
exports.default = rehydrateSupportRules; | ||
var _rehydrateRules = _interopRequireDefault(require("./rehydrateRules")); | ||
var _extractSupportQuery = require('./extractSupportQuery'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _extractSupportQuery2 = _interopRequireDefault(_extractSupportQuery); | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | ||
var _rehydrateRules = require('./rehydrateRules'); | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } | ||
var _rehydrateRules2 = _interopRequireDefault(_rehydrateRules); | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
var SUPPORT_REGEX = /@supports[^{]+\{([\s\S]+?})\s*}/gi; | ||
@@ -28,6 +33,4 @@ | ||
var specificityPrefix = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ''; | ||
var decl; // eslint-disable-next-line no-cond-assign | ||
var decl = void 0; | ||
// eslint-disable-next-line no-cond-assign | ||
while (decl = SUPPORT_REGEX.exec(css)) { | ||
@@ -39,4 +42,4 @@ var _decl = decl, | ||
var supportQuery = (0, _extractSupportQuery2.default)(ruleSet); | ||
(0, _rehydrateRules2.default)(cssRules, media, supportQuery, cache, specificityPrefix); | ||
var supportQuery = (0, _extractSupportQuery["default"])(ruleSet); | ||
(0, _rehydrateRules["default"])(cssRules, media, supportQuery, cache, specificityPrefix); | ||
} | ||
@@ -43,0 +46,0 @@ |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,14 +6,10 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.default = render; | ||
exports["default"] = render; | ||
var _objectEach = require('fast-loops/lib/objectEach'); | ||
var _fastLoops = require("fast-loops"); | ||
var _objectEach2 = _interopRequireDefault(_objectEach); | ||
var _createSubscription = _interopRequireDefault(require("./connection/createSubscription")); | ||
var _createSubscription = require('./connection/createSubscription'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _createSubscription2 = _interopRequireDefault(_createSubscription); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function render(renderer, targetDocument) { | ||
@@ -23,10 +19,8 @@ if (!renderer.updateSubscription) { | ||
renderer.nodes = {}; | ||
renderer.updateSubscription = (0, _createSubscription["default"])(renderer, targetDocument); | ||
renderer.subscribe(renderer.updateSubscription); // simulate rendering to ensure all styles rendered prior to | ||
// calling FelaDOM.render are correctly injected as well | ||
renderer.updateSubscription = (0, _createSubscription2.default)(renderer, targetDocument); | ||
renderer.subscribe(renderer.updateSubscription); | ||
// simulate rendering to ensure all styles rendered prior to | ||
// calling FelaDOM.render are correctly injected as well | ||
(0, _objectEach2.default)(renderer.cache, renderer._emitChange); | ||
(0, _fastLoops.objectEach)(renderer.cache, renderer._emitChange); | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,25 +6,35 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.renderToSheetList = exports.renderToMarkup = exports.rehydrate = exports.render = undefined; | ||
Object.defineProperty(exports, "rehydrate", { | ||
enumerable: true, | ||
get: function get() { | ||
return _rehydrate["default"]; | ||
} | ||
}); | ||
Object.defineProperty(exports, "render", { | ||
enumerable: true, | ||
get: function get() { | ||
return _render["default"]; | ||
} | ||
}); | ||
Object.defineProperty(exports, "renderToMarkup", { | ||
enumerable: true, | ||
get: function get() { | ||
return _renderToMarkup["default"]; | ||
} | ||
}); | ||
Object.defineProperty(exports, "renderToSheetList", { | ||
enumerable: true, | ||
get: function get() { | ||
return _renderToSheetList["default"]; | ||
} | ||
}); | ||
var _render = require('./dom/render'); | ||
var _render = _interopRequireDefault(require("./dom/render")); | ||
var _render2 = _interopRequireDefault(_render); | ||
var _rehydrate = _interopRequireDefault(require("./dom/rehydrate")); | ||
var _rehydrate = require('./dom/rehydrate'); | ||
var _renderToMarkup = _interopRequireDefault(require("./server/renderToMarkup")); | ||
var _rehydrate2 = _interopRequireDefault(_rehydrate); | ||
var _renderToSheetList = _interopRequireDefault(require("./server/renderToSheetList")); | ||
var _renderToMarkup = require('./server/renderToMarkup'); | ||
var _renderToMarkup2 = _interopRequireDefault(_renderToMarkup); | ||
var _renderToSheetList = require('./server/renderToSheetList'); | ||
var _renderToSheetList2 = _interopRequireDefault(_renderToSheetList); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.render = _render2.default; | ||
exports.rehydrate = _rehydrate2.default; | ||
exports.renderToMarkup = _renderToMarkup2.default; | ||
exports.renderToSheetList = _renderToSheetList2.default; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,10 +6,6 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.default = createStyleTagMarkup; | ||
exports["default"] = createStyleTagMarkup; | ||
var _objectReduce = require('fast-loops/lib/objectReduce'); | ||
var _fastLoops = require("fast-loops"); | ||
var _objectReduce2 = _interopRequireDefault(_objectReduce); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function createStyleTagMarkup(css, type) { | ||
@@ -20,10 +16,8 @@ var media = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; | ||
var styleNodeAttributes = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {}; | ||
var mediaAttribute = media.length > 0 ? ' media="' + media + '"' : ''; | ||
var mediaAttribute = media.length > 0 ? " media=\"".concat(media, "\"") : ''; | ||
var supportAttribute = support ? ' data-fela-support="true"' : ''; | ||
var userAttributes = (0, _objectReduce2.default)(styleNodeAttributes, function (attributes, value, attribute) { | ||
var userAttributes = (0, _fastLoops.objectReduce)(styleNodeAttributes, function (attributes, value, attribute) { | ||
return attributes + ' ' + attribute + '="' + value + '"'; | ||
}, ''); | ||
return '<style type="text/css" data-fela-rehydration="' + rehydrationIndex + '" data-fela-type="' + type + '"' + supportAttribute + mediaAttribute + userAttributes + '>' + css + '</style>'; | ||
return "<style type=\"text/css\" data-fela-rehydration=\"".concat(rehydrationIndex, "\" data-fela-type=\"").concat(type, "\"").concat(supportAttribute).concat(mediaAttribute).concat(userAttributes, ">").concat(css, "</style>"); | ||
} |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,6 +6,5 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.default = getRehydrationIndex; | ||
exports["default"] = getRehydrationIndex; | ||
var SELECTOR_PREFIX_REGEXP = /^[a-z0-9_-]*$/gi; | ||
var SELECTOR_PREFIX_REGEXP = /^[a-z0-9_-]*$/gi; | ||
function getRehydrationIndex(renderer) { | ||
@@ -12,0 +11,0 @@ if (renderer.selectorPrefix.length === 0 || renderer.selectorPrefix.match(SELECTOR_PREFIX_REGEXP) !== null) { |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,35 +6,26 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports["default"] = renderToMarkup; | ||
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 _fastLoops = require("fast-loops"); | ||
exports.default = renderToMarkup; | ||
var _felaUtils = require("fela-utils"); | ||
var _arrayReduce = require('fast-loops/lib/arrayReduce'); | ||
var _createStyleTagMarkup = _interopRequireDefault(require("./createStyleTagMarkup")); | ||
var _arrayReduce2 = _interopRequireDefault(_arrayReduce); | ||
var _getRehydrationIndex = _interopRequireDefault(require("./getRehydrationIndex")); | ||
var _objectReduce = require('fast-loops/lib/objectReduce'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _objectReduce2 = _interopRequireDefault(_objectReduce); | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } | ||
var _felaUtils = require('fela-utils'); | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } | ||
var _createStyleTagMarkup = require('./createStyleTagMarkup'); | ||
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; } | ||
var _createStyleTagMarkup2 = _interopRequireDefault(_createStyleTagMarkup); | ||
var _getRehydrationIndex = require('./getRehydrationIndex'); | ||
var _getRehydrationIndex2 = _interopRequireDefault(_getRehydrationIndex); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function renderToMarkup(renderer) { | ||
var cacheCluster = (0, _felaUtils.clusterCache)(renderer.cache, renderer.ruleOrder); | ||
var rehydrationIndex = (0, _getRehydrationIndex2.default)(renderer); | ||
var styleMarkup = (0, _objectReduce2.default)(_felaUtils.sheetMap, function (markup, type, key) { | ||
var rehydrationIndex = (0, _getRehydrationIndex["default"])(renderer); | ||
var styleMarkup = (0, _fastLoops.objectReduce)(_felaUtils.sheetMap, function (markup, type, key) { | ||
if (cacheCluster[key].length > 0) { | ||
markup += (0, _createStyleTagMarkup2.default)(cacheCluster[key], type, '', rehydrationIndex, false, renderer.styleNodeAttributes); | ||
markup += (0, _createStyleTagMarkup["default"])(cacheCluster[key], type, '', rehydrationIndex, false, renderer.styleNodeAttributes); | ||
} | ||
@@ -44,18 +35,16 @@ | ||
}, ''); | ||
var support = (0, _felaUtils.cssifySupportRules)(cacheCluster.supportRules); | ||
if (support) { | ||
styleMarkup += (0, _createStyleTagMarkup2.default)(support, _felaUtils.RULE_TYPE, '', rehydrationIndex, true, renderer.styleNodeAttributes); | ||
styleMarkup += (0, _createStyleTagMarkup["default"])(support, _felaUtils.RULE_TYPE, '', rehydrationIndex, true, renderer.styleNodeAttributes); | ||
} | ||
var mediaKeys = Object.keys(_extends({}, cacheCluster.supportMediaRules, cacheCluster.mediaRules)).sort(renderer.sortMediaQuery); | ||
return (0, _arrayReduce2.default)(mediaKeys, function (markup, media) { | ||
var mediaKeys = Object.keys(_objectSpread(_objectSpread({}, cacheCluster.supportMediaRules), cacheCluster.mediaRules)).sort(renderer.sortMediaQuery); | ||
return (0, _fastLoops.arrayReduce)(mediaKeys, function (markup, media) { | ||
// basic media query rules | ||
if (cacheCluster.mediaRules[media] && cacheCluster.mediaRules[media].length > 0) { | ||
markup += (0, _createStyleTagMarkup2.default)(cacheCluster.mediaRules[media], _felaUtils.RULE_TYPE, media, rehydrationIndex, false, renderer.styleNodeAttributes); | ||
} | ||
markup += (0, _createStyleTagMarkup["default"])(cacheCluster.mediaRules[media], _felaUtils.RULE_TYPE, media, rehydrationIndex, false, renderer.styleNodeAttributes); | ||
} // support media rules | ||
// support media rules | ||
if (cacheCluster.supportMediaRules[media]) { | ||
@@ -65,3 +54,3 @@ var mediaSupport = (0, _felaUtils.cssifySupportRules)(cacheCluster.supportMediaRules[media]); | ||
if (mediaSupport.length > 0) { | ||
markup += (0, _createStyleTagMarkup2.default)(mediaSupport, _felaUtils.RULE_TYPE, media, rehydrationIndex, true, renderer.styleNodeAttributes); | ||
markup += (0, _createStyleTagMarkup["default"])(mediaSupport, _felaUtils.RULE_TYPE, media, rehydrationIndex, true, renderer.styleNodeAttributes); | ||
} | ||
@@ -68,0 +57,0 @@ } |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,29 +6,22 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports["default"] = renderToSheetList; | ||
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 _fastLoops = require("fast-loops"); | ||
exports.default = renderToSheetList; | ||
var _felaUtils = require("fela-utils"); | ||
var _arrayReduce = require('fast-loops/lib/arrayReduce'); | ||
var _getRehydrationIndex = _interopRequireDefault(require("./getRehydrationIndex")); | ||
var _arrayReduce2 = _interopRequireDefault(_arrayReduce); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var _objectReduce = require('fast-loops/lib/objectReduce'); | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } | ||
var _objectReduce2 = _interopRequireDefault(_objectReduce); | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } | ||
var _felaUtils = require('fela-utils'); | ||
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; } | ||
var _getRehydrationIndex = require('./getRehydrationIndex'); | ||
var _getRehydrationIndex2 = _interopRequireDefault(_getRehydrationIndex); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function renderToSheetList(renderer) { | ||
var cacheCluster = (0, _felaUtils.clusterCache)(renderer.cache, renderer.ruleOrder); | ||
var rehydrationIndex = (0, _getRehydrationIndex2.default)(renderer); | ||
var sheetList = (0, _objectReduce2.default)(_felaUtils.sheetMap, function (list, type, key) { | ||
var rehydrationIndex = (0, _getRehydrationIndex["default"])(renderer); | ||
var sheetList = (0, _fastLoops.objectReduce)(_felaUtils.sheetMap, function (list, type, key) { | ||
if (cacheCluster[key].length > 0) { | ||
@@ -45,3 +38,2 @@ list.push({ | ||
}, []); | ||
var support = (0, _felaUtils.cssifySupportRules)(cacheCluster.supportRules); | ||
@@ -59,5 +51,4 @@ | ||
var mediaKeys = Object.keys(_extends({}, cacheCluster.supportMediaRules, cacheCluster.mediaRules)).sort(renderer.sortMediaQuery); | ||
return (0, _arrayReduce2.default)(mediaKeys, function (list, media) { | ||
var mediaKeys = Object.keys(_objectSpread(_objectSpread({}, cacheCluster.supportMediaRules), cacheCluster.mediaRules)).sort(renderer.sortMediaQuery); | ||
return (0, _fastLoops.arrayReduce)(mediaKeys, function (list, media) { | ||
// basic media query rules | ||
@@ -72,5 +63,5 @@ if (cacheCluster.mediaRules[media] && cacheCluster.mediaRules[media].length > 0) { | ||
}); | ||
} | ||
} // support media rules | ||
// support media rules | ||
if (cacheCluster.supportMediaRules[media]) { | ||
@@ -77,0 +68,0 @@ var mediaSupport = (0, _felaUtils.cssifySupportRules)(cacheCluster.supportMediaRules[media]); |
{ | ||
"name": "fela-dom", | ||
"version": "11.7.0", | ||
"version": "12.0.0-rc.0", | ||
"description": "Fela package for working with the DOM", | ||
@@ -9,5 +9,2 @@ "main": "lib/index.js", | ||
"sideEffects": false, | ||
"scripts": { | ||
"build:umd": "webpack --config webpack.config.js" | ||
}, | ||
"files": [ | ||
@@ -20,2 +17,15 @@ "LICENSE", | ||
], | ||
"scripts": { | ||
"setup": "yarn build", | ||
"clean": "rimraf lib es coverage", | ||
"build": "yarn clean && yarn build:es && yarn build:lib", | ||
"build:es": "babel src --out-dir es --ignore **/__tests__", | ||
"build:lib": "cross-env BABEL_ENV=commonjs babel src --out-dir lib --ignore **/__tests__", | ||
"build:umd": "webpack --config webpack.config.js", | ||
"watch": "npm run watch:lib & npm run watch:es", | ||
"watch:lib": "BABEL_ENV=commonjs babel src -d lib -w", | ||
"watch:es": "babel src -d es -w", | ||
"test": "jest --config=jest.config.js", | ||
"coverage": "yarn test --coverage" | ||
}, | ||
"repository": "https://github.com/robinweser/fela/", | ||
@@ -35,11 +45,28 @@ "keywords": [ | ||
"fast-loops": "^1.0.1", | ||
"fela-utils": "^11.7.0", | ||
"fela-utils": "^12.0.0-rc.0", | ||
"sort-css-media-queries": "^1.4.3" | ||
}, | ||
"devDependencies": { | ||
"fela": "^11.7.0", | ||
"fela-preset-web": "^11.7.0", | ||
"fela-tools": "^11.7.0" | ||
"@babel/cli": "^7.2.0", | ||
"@babel/core": "^7.2.2", | ||
"@babel/node": "^7.13.0", | ||
"@babel/plugin-transform-modules-commonjs": "^7.5.0", | ||
"@babel/polyfill": "^7.7.0", | ||
"@babel/preset-env": "^7.5.5", | ||
"babel-core": "7.0.0-bridge.0", | ||
"babel-jest": "^26.6.0", | ||
"babel-loader": "^8.2.3", | ||
"clean-webpack-plugin": "^3.0.0", | ||
"cross-env": "^6.0.3", | ||
"fela": "^12.0.0-rc.0", | ||
"fela-preset-web": "^12.0.0-rc.0", | ||
"fela-tools": "^12.0.0-rc.0", | ||
"jest": "^26.6.0", | ||
"js-beautify": "^1.14.0", | ||
"jsdom": "^16.6.0", | ||
"rimraf": "^3.0.0", | ||
"webpack": "^4.41.6", | ||
"webpack-cli": "^3.3.10" | ||
}, | ||
"gitHead": "e067b284984d3dbfc259fcbffde9bb50679fda9b" | ||
"gitHead": "00f02f410f17a7693479ea3349bb3a9f223359af" | ||
} |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("FelaDOM",[],t):"object"==typeof exports?exports.FelaDOM=t():e.FelaDOM=t()}(window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=5)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){for(var n in e)r=t(r,e[n],n,e);return r}},,function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){for(var n=0,o=e.length;n<o;++n)r=t(r,e[n],n,o,e);return r}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){for(var r in e)t(e[r],r,e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){for(var r=0,n=e.length;r<n;++r)t(e[r],r,n,e)}},function(e,t,r){"use strict";r.r(t),r.d(t,"render",(function(){return l})),r.d(t,"rehydrate",(function(){return _})),r.d(t,"renderToMarkup",(function(){return Y})),r.d(t,"renderToSheetList",(function(){return D}));var n=r(3),o=r.n(n);function u(e,t){return e+"{"+t+"}"}function s(e,t,r=document){const n=function({type:e,media:t="",support:r=""}){return e+t+r}(e);if(!t.nodes[n]){const o=function({type:e,media:t,support:r},n=document){const o=t?`[media="${t}"]`:":not([media])",u=r?'[data-fela-support="true"]':':not([data-fela-support="true"])';return n.querySelector(`[data-fela-type="${e}"]${u}${o}`)}(e,r)||function(e,t=document,r,n){const o=t.head||{},{type:u,media:s,support:i}=e,a=t.createElement("style");a.setAttribute("data-fela-type",u),a.type="text/css",i&&a.setAttribute("data-fela-support","true"),s&&(a.media=s);for(let e in n)a.setAttribute(e,n[e]);if(void 0!==typeof window&&window.FelaConfig)for(let e in window.FelaConfig.styleNodeAttributes)a.setAttribute(e,window.FelaConfig.styleNodeAttributes[e]);const c=function(e,{type:t,media:r,support:n},o){switch(t){case"FONT":case"STATIC":case"KEYFRAME":return e[0];case"RULE":const t=e.map(e=>e.media).filter(e=>0!==e.length);if(r){const u=[...t,r].sort(o),s=u.indexOf(r)+1,i=u[s];if(i)return i===r&&n?e.find(e=>e.media===u[u.indexOf(r)+2]):e.find(e=>e.media===i)}else{const r=t.sort(o)[0];if(!n){const t=e.find(e=>void 0!==e.getAttribute("data-fela-support")&&""===e.media&&"RULE"===e.getAttribute("data-fela-type"));if(t)return t}if(r)return e.find(e=>e.media===r)}}}([...o.querySelectorAll("[data-fela-type]")],e,r);return c?o.insertBefore(a,c):o.appendChild(a),a}(e,r,t.sortMediaQuery,t.styleNodeAttributes);t.nodes[n]=o}return t.nodes[n]}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return 0===e.length||0===t.length?0:e.indexOf(e.find((function(e){return null!==t.match(e)})))+1}function a(e,t){return"@supports "+e+"{"+t+"}"}function c(e,t=document){return r=>{if("CLEAR"===r.type)return o()(e.nodes,e=>e.parentNode.removeChild(e)),e.nodes={},void(e.scoreIndex={});const n=s(r,e,t);switch(r.type){case"KEYFRAME":-1===n.textContent.indexOf(r.keyframe)&&(n.textContent+=r.keyframe);break;case"FONT":-1===n.textContent.indexOf(r.fontFace)&&(n.textContent+=r.fontFace);break;case"STATIC":let t=r.selector?u(r.selector,r.css):r.css;-1===n.textContent.indexOf(t)&&(n.textContent+=t);break;case"RULE":!function({selector:e,declaration:t,support:r,media:n,pseudo:o},s,c){const l=n+r;try{const n=i(s.ruleOrder,o),{cssRules:f}=c.sheet;let d=f.length;if(0===n)d=void 0===s.scoreIndex[l]?0:s.scoreIndex[l]+1;else{for(let e=s.scoreIndex[l]||0,t=f.length;e<t;++e)if(f[e].score>n){d=e;break}}const p=u(e,t);if(r.length>0){const e=a(r,p);c.sheet.insertRule(e,d)}else c.sheet.insertRule(p,d);0===n&&(s.scoreIndex[l]=d),f[d].score=n}catch(e){}}(r,e,n)}}}function l(e,t){e.updateSubscription||(e.scoreIndex={},e.nodes={},e.updateSubscription=c(e,t),e.subscribe(e.updateSubscription),o()(e.cache,e._emitChange))}var f=r(4),d=r.n(f);function p(e){return e.split("{")[0].slice(9).trim()}function y(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"";return o+n+r+e+t}var m=/-([a-z])/g,h=/^Ms/g,b={};function R(e){return e[1].toUpperCase()}function g(e){if(b.hasOwnProperty(e))return b[e];var t=e.replace(m,R).replace(h,"ms");return b[e]=t,t}function v(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=("."+e).repeat(n);return""+r+o+t}function x(e,t,r,n,o="",u="",s="",i=""){return{type:e,className:t,selector:v(t,o,i),declaration:r+":"+n,pseudo:o,media:u,support:s}}const A={};function M(e,t="",r="",n={},o=""){let u;const s=function(e){return A[e]||(A[e]=new RegExp(e.replace(/[.*+\-?^${}()|[\]\\]/g,"\\$&")+"[.]([0-9a-z_-]+)([.][0-9a-z_-]+){0,}([^{]+)?{([^:]+):([^}]+)}","gi")),A[e]}(o);for(;u=s.exec(e);){const[e,s,i,a,c,l]=u;n[y(0===c.indexOf("--")?c:g(c),l,a,t,r)]=x("RULE",s,c,l,a,t,r,o)}return n}const O=/@supports[^{]+\{([\s\S]+?})\s*}/gi;const E=/@(-webkit-|-moz-)?keyframes ([a-z_][a-z0-9-_]*)(\{.*?(?=}})}})/gi;const F=/[.][a-z0-9_-]*/gi;function _(e,t=document){l(e,t),d()(t.querySelectorAll("[data-fela-type]"),t=>{const r=t.getAttribute("data-fela-rehydration")||-1,n=e.uniqueRuleIdentifier||parseInt(r,10);if(-1!==n){const r=t.getAttribute("data-fela-type")||"",o=t.getAttribute("media")||"",u=t.getAttribute("data-fela-support")||"",s=t.textContent;e.uniqueRuleIdentifier=n;const a=r+o+u;if(e.nodes[a]=t,"RULE"===r){if(u?function(e,t="",r={},n=""){let o;for(;o=O.exec(e);){const[e,u]=o;M(u,t,p(e),r,n)}}(s,o,e.cache,e.specificityPrefix):M(s,o,"",e.cache,e.specificityPrefix),t.sheet&&t.sheet.cssRules){const r=o+u;d()(t.sheet.cssRules,(t,n)=>{const o=t.conditionText?t.cssRules[0].selectorText:t.selectorText,u=i(e.ruleOrder,o.split(F)[1]);0===u&&(e.scoreIndex[r]=n),t.score=u})}}else"KEYFRAME"===r&&function(e,t={}){let r;for(;r=E.exec(e);){const[e,n,o,u]=r;t[u]?t[u].keyframe+=e:t[u]={type:"KEYFRAME",keyframe:e,name:o}}}(s,e.cache)}})}var C,T=r(2),k=r.n(T),j=r(0),w=r.n(j);function N(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function S(e,t){var r=w()(e,(function(r,n,o){var u=function(e,t){for(var r=-1,n=0;n<e.length;n++)if(t(e[n])){r=n;break}return r}(r,(function(r){return t(e[r],r)>t(n,o)}));return-1!==u?function(e,t,r){return[].concat(N(e.slice(0,r)),[t],N(e.slice(r,e.length)))}(r,o,u):[].concat(function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}(r),[o])}),[]);return k()(r,(function(t,r){return t[r]=e[r],t}),{})}function I(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var L=(I(C={},"RULE",(function(e,t){var r=t.selector,n=t.declaration,o=t.support,s=t.media,i=u(r,n);o?s?(e.supportMediaRules[s]||(e.supportMediaRules[s]={}),e.supportMediaRules[s][o]||(e.supportMediaRules[s][o]=""),e.supportMediaRules[s][o]+=i):(e.supportRules[o]||(e.supportRules[o]=""),e.supportRules[o]+=i):s?(e.mediaRules[s]||(e.mediaRules[s]=""),e.mediaRules[s]+=i):e.rules+=i})),I(C,"FONT",(function(e,t){var r=t.fontFace;e.fontFaces+=r})),I(C,"KEYFRAME",(function(e,t){var r=t.keyframe;e.keyframes+=r})),I(C,"STATIC",(function(e,t){var r=t.css,n=t.selector;e.statics+=n?u(n,r):r})),C);function P(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=S(e,(function(e){return i(t,e.pseudo)}));return w()(r,(function(e,t){var r=L[t.type];return r&&r(e,t),e}),{mediaRules:{},supportRules:{},supportMediaRules:{},fontFaces:"",statics:"",keyframes:"",rules:""})}var U={fontFaces:"FONT",statics:"STATIC",keyframes:"KEYFRAME",rules:"RULE"};function $(e){return w()(e,(function(e,t,r){return t.length>0&&(e+=a(r,t)),e}),"")}function z(e,t,r="",n=-1,o=!1,u={}){return`<style type="text/css" data-fela-rehydration="${n}" data-fela-type="${t}"${o?' data-fela-support="true"':""}${r.length>0?` media="${r}"`:""}${w()(u,(e,t,r)=>e+" "+r+'="'+t+'"',"")}>${e}</style>`}const q=/^[a-z0-9_-]*$/gi;function K(e){return 0===e.selectorPrefix.length||null!==e.selectorPrefix.match(q)?e.uniqueRuleIdentifier:-1}function Y(e){const t=P(e.cache,e.ruleOrder),r=K(e);let n=w()(U,(n,o,u)=>(t[u].length>0&&(n+=z(t[u],o,"",r,!1,e.styleNodeAttributes)),n),"");const o=$(t.supportRules);o&&(n+=z(o,"RULE","",r,!0,e.styleNodeAttributes));const u=Object.keys({...t.supportMediaRules,...t.mediaRules}).sort(e.sortMediaQuery);return k()(u,(n,o)=>{if(t.mediaRules[o]&&t.mediaRules[o].length>0&&(n+=z(t.mediaRules[o],"RULE",o,r,!1,e.styleNodeAttributes)),t.supportMediaRules[o]){const u=$(t.supportMediaRules[o]);u.length>0&&(n+=z(u,"RULE",o,r,!0,e.styleNodeAttributes))}return n},n)}function D(e){const t=P(e.cache,e.ruleOrder),r=K(e),n=w()(U,(n,o,u)=>(t[u].length>0&&n.push({css:t[u],rehydration:r,attributes:e.styleNodeAttributes,type:o}),n),[]),o=$(t.supportRules);o&&n.push({css:o,type:"RULE",rehydration:r,attributes:e.styleNodeAttributes,support:!0});const u=Object.keys({...t.supportMediaRules,...t.mediaRules}).sort(e.sortMediaQuery);return k()(u,(n,o)=>{if(t.mediaRules[o]&&t.mediaRules[o].length>0&&n.push({css:t.mediaRules[o],type:"RULE",rehydration:r,attributes:e.styleNodeAttributes,media:o}),t.supportMediaRules[o]){const u=$(t.supportMediaRules[o]);u.length>0&&n.push({css:u,type:"RULE",rehydration:r,attributes:e.styleNodeAttributes,support:!0,media:o})}return n},n)}}])})); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("FelaDom",[],e):"object"==typeof exports?exports.FelaDom=e():t.FelaDom=e()}(window,(function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=2)}({2:function(t,e,r){"use strict";function n(t,e){for(var r in t)e(t[r],r,t)}r.r(e),r.d(e,"render",(function(){return h})),r.d(e,"rehydrate",(function(){return Y})),r.d(e,"renderToMarkup",(function(){return lt})),r.d(e,"renderToSheetList",(function(){return pt}));function o(t,e){return"".concat(t,"{").concat(e,"}")}function i(t){var e=t.type,r=t.media,n=t.support,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document,i=r?'[media="'.concat(r,'"]'):":not([media])",u=n?'[data-fela-support="true"]':':not([data-fela-support="true"])';return o.querySelector('[data-fela-type="'.concat(e,'"]').concat(u).concat(i))}function u(t){return function(t){if(Array.isArray(t))return a(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return a(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return a(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function c(t,e,r){var n=e.type,o=e.media,i=e.support;switch(n){case"FONT":case"STATIC":case"KEYFRAME":return t[0];case"RULE":var a=t.map((function(t){return t.media})).filter((function(t){return 0!==t.length}));if(o){var c=[].concat(u(a),[o]).sort(r),l=c.indexOf(o)+1,f=c[l];if(f)return f===o&&i?t.find((function(t){return t.media===c[c.indexOf(o)+2]})):t.find((function(t){return t.media===f}))}else{var s=a.sort(r)[0];if(!i){var d=t.find((function(t){return void 0!==t.getAttribute("data-fela-support")&&""===t.media&&"RULE"===t.getAttribute("data-fela-type")}));if(d)return d}if(s)return t.find((function(t){return t.media===s}))}}}function l(t){return function(t){if(Array.isArray(t))return f(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return f(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return f(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function d(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document,r=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0,o=e.head||{},i=t.type,u=t.media,a=t.support,f=e.createElement("style");for(var d in f.setAttribute("data-fela-type",i),f.type="text/css",a&&f.setAttribute("data-fela-support","true"),u&&(f.media=u),n)f.setAttribute(d,n[d]);if(void 0!==("undefined"==typeof window?"undefined":s(window))&&window.FelaConfig)for(var p in window.FelaConfig.styleNodeAttributes)f.setAttribute(p,window.FelaConfig.styleNodeAttributes[p]);var y=o.querySelectorAll("[data-fela-type]"),b=c(l(y),t,r);return b?o.insertBefore(f,b):o.appendChild(f),f}function p(t){var e=t.type,r=t.media,n=void 0===r?"":r,o=t.support;return e+n+(void 0===o?"":o)}function y(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:document,n=p(t);if(!e.nodes[n]){var o=i(t,r)||d(t,r,e.sortMediaQuery,e.styleNodeAttributes);e.nodes[n]=o}return e.nodes[n]}function b(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return 0===t.length||0===e.length?0:t.indexOf(t.find((function(t){return null!==e.match(t)})))+1}function m(t,e){return"@supports ".concat(t,"{").concat(e,"}")}function v(t,e,r){var n=t.selector,i=t.declaration,u=t.support,a=t.media,c=t.pseudo,l=a+u;try{var f=b(e.ruleOrder,c),s=r.sheet.cssRules,d=s.length;if(0===f)d=void 0===e.scoreIndex[l]?0:e.scoreIndex[l]+1;else for(var p=e.scoreIndex[l]||0,y=s.length;p<y;++p)if(s[p].score>f){d=p;break}var v=o(n,i);if(u.length>0){var h=m(u,v);r.sheet.insertRule(h,d)}else r.sheet.insertRule(v,d);0===f&&(e.scoreIndex[l]=d),s[d].score=f}catch(t){}}function h(t,e){t.updateSubscription||(t.scoreIndex={},t.nodes={},t.updateSubscription=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return function(r){if("CLEAR"===r.type)return n(t.nodes,(function(t){return t.parentNode.removeChild(t)})),t.nodes={},void(t.scoreIndex={});var i=y(r,t,e);switch(r.type){case"KEYFRAME":-1===i.textContent.indexOf(r.keyframe)&&(i.textContent+=r.keyframe);break;case"FONT":-1===i.textContent.indexOf(r.fontFace)&&(i.textContent+=r.fontFace);break;case"STATIC":var u=r.selector?o(r.selector,r.css):r.css;-1===i.textContent.indexOf(u)&&(i.textContent+=u);break;case"RULE":v(r,t,i)}}}(t,e),t.subscribe(t.updateSubscription),n(t.cache,t._emitChange))}function g(t,e){for(var r=0,n=t.length;r<n;++r)e(t[r],r,n,t)}function A(t){return t.split("{")[0].slice(9).trim()}function O(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"";return o+n+r+t+e}var S=/-([a-z])/g,R=/^Ms/g,j={};function w(t){return t[1].toUpperCase()}function x(t){if(j.hasOwnProperty(t))return j[t];var e=t.replace(S,w).replace(R,"ms");return j[t]=e,e}function E(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,o=".".concat(t).repeat(n);return"".concat(r).concat(o).concat(e)}function I(t,e,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"",u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"",a=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"";return{type:t,className:e,selector:E(e,o,a),declaration:r+":"+n,pseudo:o,media:i,support:u}}function M(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,o,i=[],u=!0,a=!1;try{for(r=r.call(t);!(u=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==r.return||r.return()}finally{if(a)throw o}}return i}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return P(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return P(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function P(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var C={};function T(t){return C[t]||(C[t]=new RegExp("".concat(t.replace(/[.*+\-?^${}()|[\]\\]/g,"\\$&"),"[.]([0-9a-z_-]+)([.][0-9a-z_-]+){0,}([^{]+)?{([^:]+):([^}]+)}"),"gi")),C[t]}function F(t){for(var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",u=T(i);e=u.exec(t);){var a=e,c=M(a,6),l=(c[0],c[1]),f=(c[2],c[3]),s=c[4],d=c[5],p=O(0===s.indexOf("--")?s:x(s),d,f,r,n);o[p]=I("RULE",l,s,d,f,r,n,i)}return o}function U(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,o,i=[],u=!0,a=!1;try{for(r=r.call(t);!(u=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==r.return||r.return()}finally{if(a)throw o}}return i}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return k(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return k(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function k(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var N=/@supports[^{]+\{([\s\S]+?})\s*}/gi;function L(t){for(var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";e=N.exec(t);){var i=e,u=U(i,2),a=u[0],c=u[1],l=A(a);F(c,r,l,n,o)}return n}function _(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==r)return;var n,o,i=[],u=!0,a=!1;try{for(r=r.call(t);!(u=(n=r.next()).done)&&(i.push(n.value),!e||i.length!==e);u=!0);}catch(t){a=!0,o=t}finally{try{u||null==r.return||r.return()}finally{if(a)throw o}}return i}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return D(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return D(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function D(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var $=/@(-webkit-|-moz-)?keyframes ([a-z_][a-z0-9-_]*)(\{.*?(?=}})}})/gi;function z(t){for(var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e=$.exec(t);){var n=e,o=_(n,4),i=o[0],u=(o[1],o[2]),a=o[3];r[a]?r[a].keyframe+=i:r[a]={type:"KEYFRAME",keyframe:i,name:u}}return r}var q,K=/[.][a-z0-9_-]*/gi;function Y(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;h(t,e),g(e.querySelectorAll("[data-fela-type]"),(function(e){var r=e.getAttribute("data-fela-rehydration")||-1,n=t.uniqueRuleIdentifier||parseInt(r,10);if(-1!==n){var o=e.getAttribute("data-fela-type")||"",i=e.getAttribute("media")||"",u=e.getAttribute("data-fela-support")||"",a=e.textContent;t.uniqueRuleIdentifier=n;var c=o+i+u;if(t.nodes[c]=e,"RULE"===o){if(u?L(a,i,t.cache,t.specificityPrefix):F(a,i,"",t.cache,t.specificityPrefix),e.sheet&&e.sheet.cssRules){var l=i+u;g(e.sheet.cssRules,(function(e,r){var n=e.conditionText?e.cssRules[0].selectorText:e.selectorText,o=b(t.ruleOrder,n.split(K)[1]);0===o&&(t.scoreIndex[l]=r),e.score=o}))}}else"KEYFRAME"===o&&z(a,t.cache)}}))}function Q(t,e,r){for(var n in t)r=e(r,t[n],n,t);return r}function B(t,e,r){for(var n=0,o=t.length;n<o;++n)r=e(r,t[n],n,o,t);return r}function G(t){return function(t){if(Array.isArray(t))return H(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return H(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return H(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function H(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function J(t){return function(t){if(Array.isArray(t))return V(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return V(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return V(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function V(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function W(t,e){return B(Q(t,(function(r,n,o){var i=function(t,e){for(var r=-1,n=0;n<t.length;n++)if(e(t[n])){r=n;break}return r}(r,(function(r){return e(t[r],r)>e(n,o)}));return-1!==i?function(t,e,r){return[].concat(G(t.slice(0,r)),[e],G(t.slice(r,t.length)))}(r,o,i):[].concat(J(r),[o])}),[]),(function(e,r){return e[r]=t[r],e}),{})}function X(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Z=(X(q={},"RULE",(function(t,e){var r=e.selector,n=e.declaration,i=e.support,u=e.media,a=o(r,n);i?u?(t.supportMediaRules[u]||(t.supportMediaRules[u]={}),t.supportMediaRules[u][i]||(t.supportMediaRules[u][i]=""),t.supportMediaRules[u][i]+=a):(t.supportRules[i]||(t.supportRules[i]=""),t.supportRules[i]+=a):u?(t.mediaRules[u]||(t.mediaRules[u]=""),t.mediaRules[u]+=a):t.rules+=a})),X(q,"FONT",(function(t,e){var r=e.fontFace;t.fontFaces+=r})),X(q,"KEYFRAME",(function(t,e){var r=e.keyframe;t.keyframes+=r})),X(q,"STATIC",(function(t,e){var r=e.css,n=e.selector;t.statics+=n?o(n,r):r})),q);function tt(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=W(t,(function(t){return b(e,t.pseudo)}));return Q(r,(function(t,e){var r=Z[e.type];return r&&r(t,e),t}),{mediaRules:{},supportRules:{},supportMediaRules:{},fontFaces:"",statics:"",keyframes:"",rules:""})}var et={fontFaces:"FONT",statics:"STATIC",keyframes:"KEYFRAME",rules:"RULE"};function rt(t){return Q(t,(function(t,e,r){return e.length>0&&(t+=m(r,e)),t}),"")}function nt(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,o=arguments.length>4&&void 0!==arguments[4]&&arguments[4],i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},u=r.length>0?' media="'.concat(r,'"'):"",a=o?' data-fela-support="true"':"",c=Q(i,(function(t,e,r){return t+" "+r+'="'+e+'"'}),"");return'<style type="text/css" data-fela-rehydration="'.concat(n,'" data-fela-type="').concat(e,'"').concat(a).concat(u).concat(c,">").concat(t,"</style>")}var ot=/^[a-z0-9_-]*$/gi;function it(t){return 0===t.selectorPrefix.length||null!==t.selectorPrefix.match(ot)?t.uniqueRuleIdentifier:-1}function ut(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function at(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ut(Object(r),!0).forEach((function(e){ct(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ut(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function ct(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function lt(t){var e=tt(t.cache,t.ruleOrder),r=it(t),n=Q(et,(function(n,o,i){return e[i].length>0&&(n+=nt(e[i],o,"",r,!1,t.styleNodeAttributes)),n}),""),o=rt(e.supportRules);return o&&(n+=nt(o,"RULE","",r,!0,t.styleNodeAttributes)),B(Object.keys(at(at({},e.supportMediaRules),e.mediaRules)).sort(t.sortMediaQuery),(function(n,o){if(e.mediaRules[o]&&e.mediaRules[o].length>0&&(n+=nt(e.mediaRules[o],"RULE",o,r,!1,t.styleNodeAttributes)),e.supportMediaRules[o]){var i=rt(e.supportMediaRules[o]);i.length>0&&(n+=nt(i,"RULE",o,r,!0,t.styleNodeAttributes))}return n}),n)}function ft(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function st(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ft(Object(r),!0).forEach((function(e){dt(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ft(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function dt(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function pt(t){var e=tt(t.cache,t.ruleOrder),r=it(t),n=Q(et,(function(n,o,i){return e[i].length>0&&n.push({css:e[i],rehydration:r,attributes:t.styleNodeAttributes,type:o}),n}),[]),o=rt(e.supportRules);return o&&n.push({css:o,type:"RULE",rehydration:r,attributes:t.styleNodeAttributes,support:!0}),B(Object.keys(st(st({},e.supportMediaRules),e.mediaRules)).sort(t.sortMediaQuery),(function(n,o){if(e.mediaRules[o]&&e.mediaRules[o].length>0&&n.push({css:e.mediaRules[o],type:"RULE",rehydration:r,attributes:t.styleNodeAttributes,media:o}),e.supportMediaRules[o]){var i=rt(e.supportMediaRules[o]);i.length>0&&n.push({css:i,type:"RULE",rehydration:r,attributes:t.styleNodeAttributes,support:!0,media:o})}return n}),n)}}})})); |
Sorry, the diff of this file is not supported yet
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
91166
1266
20
46
2
+ Addedfela-utils@12.2.1(transitive)
- Removedfela-utils@11.7.0(transitive)
Updatedfela-utils@^12.0.0-rc.0