fela-monolithic
Advanced tools
Comparing version 5.0.8 to 5.0.9
@@ -5,3 +5,3 @@ | ||
import { isObject, isMediaQuery, isNestedSelector, isUndefinedValue, objectReduce, normalizeNestedProperty, processStyleWithPlugins, generateMonolithicClassName, generateCombinedMediaQuery, generateCSSSelector, generateCSSRule, RULE_TYPE } from 'fela-utils'; | ||
import { isObject, isSupport, isMediaQuery, isNestedSelector, isUndefinedValue, objectReduce, normalizeNestedProperty, processStyleWithPlugins, generateMonolithicClassName, generateCombinedMediaQuery, generateCSSSelector, generateCSSRule, RULE_TYPE } from 'fela-utils'; | ||
@@ -13,5 +13,9 @@ function useMonolithicRenderer(renderer) { | ||
// monolithic output can not be rehydrated | ||
renderer.enableRehydration = false; | ||
renderer._renderStyleToCache = function (className, style) { | ||
var pseudo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; | ||
var media = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ''; | ||
var support = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : ''; | ||
@@ -21,7 +25,10 @@ var ruleSet = objectReduce(style, function (ruleset, value, property) { | ||
if (isNestedSelector(property)) { | ||
renderer._renderStyleToCache(className, value, pseudo + normalizeNestedProperty(property), media); | ||
renderer._renderStyleToCache(className, value, pseudo + normalizeNestedProperty(property), media, support); | ||
} else if (isMediaQuery(property)) { | ||
var combinedMediaQuery = generateCombinedMediaQuery(media, property.slice(6).trim()); | ||
renderer._renderStyleToCache(className, value, pseudo, combinedMediaQuery); | ||
renderer._renderStyleToCache(className, value, pseudo, combinedMediaQuery, support); | ||
} else if (isSupport(property)) { | ||
var combinedSupport = generateCombinedMediaQuery(support, property.slice(9).trim()); | ||
renderer._renderStyleToCache(className, value, pseudo, media, combinedSupport); | ||
} else { | ||
@@ -49,3 +56,3 @@ // TODO: warning | ||
var declarationReference = selector + media; | ||
var declarationReference = selector + media + support; | ||
renderer.cache[declarationReference] = change; | ||
@@ -52,0 +59,0 @@ renderer._emitChange(change); |
@@ -22,5 +22,9 @@ 'use strict'; | ||
// monolithic output can not be rehydrated | ||
renderer.enableRehydration = false; | ||
renderer._renderStyleToCache = function (className, style) { | ||
var pseudo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; | ||
var media = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ''; | ||
var support = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : ''; | ||
@@ -30,7 +34,10 @@ var ruleSet = (0, _felaUtils.objectReduce)(style, function (ruleset, value, property) { | ||
if ((0, _felaUtils.isNestedSelector)(property)) { | ||
renderer._renderStyleToCache(className, value, pseudo + (0, _felaUtils.normalizeNestedProperty)(property), media); | ||
renderer._renderStyleToCache(className, value, pseudo + (0, _felaUtils.normalizeNestedProperty)(property), media, support); | ||
} else if ((0, _felaUtils.isMediaQuery)(property)) { | ||
var combinedMediaQuery = (0, _felaUtils.generateCombinedMediaQuery)(media, property.slice(6).trim()); | ||
renderer._renderStyleToCache(className, value, pseudo, combinedMediaQuery); | ||
renderer._renderStyleToCache(className, value, pseudo, combinedMediaQuery, support); | ||
} else if ((0, _felaUtils.isSupport)(property)) { | ||
var combinedSupport = (0, _felaUtils.generateCombinedMediaQuery)(support, property.slice(9).trim()); | ||
renderer._renderStyleToCache(className, value, pseudo, media, combinedSupport); | ||
} else { | ||
@@ -58,3 +65,3 @@ // TODO: warning | ||
var declarationReference = selector + media; | ||
var declarationReference = selector + media + support; | ||
renderer.cache[declarationReference] = change; | ||
@@ -61,0 +68,0 @@ renderer._emitChange(change); |
{ | ||
"name": "fela-monolithic", | ||
"version": "5.0.8", | ||
"version": "5.0.9", | ||
"description": "Fela enhancer for having monolithic classnames", | ||
@@ -27,8 +27,8 @@ "main": "lib/index.js", | ||
"css-in-js-utils": "^2.0.0", | ||
"fela-utils": "^7.0.0" | ||
"fela-utils": "^7.0.1" | ||
}, | ||
"devDependencies": { | ||
"fela": "^6.0.0", | ||
"fela-tools": "^5.0.8" | ||
"fela": "^6.0.1", | ||
"fela-tools": "^5.0.9" | ||
} | ||
} |
11904
145
Updatedfela-utils@^7.0.1