@fower/css-object-processor
Advanced tools
Comparing version 1.27.0 to 1.28.0
@@ -76,2 +76,22 @@ 'use strict'; | ||
} | ||
function toRule(rule, wrapperSelector) { | ||
if (wrapperSelector === void 0) { | ||
wrapperSelector = ''; | ||
} | ||
var selector = rule.selector, | ||
selectorType = rule.selectorType, | ||
style = rule.style; | ||
var ruleContent = toRuleContent(style); // not nested style | ||
if (selectorType === 'void') { | ||
var atomicClassName = utils.objectToClassName(style) || wrapperSelector; | ||
return "." + atomicClassName + " {" + ruleContent + "}"; | ||
} | ||
var connector = selectorType === 'pseudo' ? '' : ' '; | ||
var finalSelector = wrapperSelector + connector + selector; | ||
return finalSelector + " {" + ruleContent + "}"; | ||
} | ||
/** | ||
@@ -89,16 +109,4 @@ * to rules can insertRule | ||
var parsed = parse(cssObj); | ||
var rules = parsed.map(function (_ref2) { | ||
var selector = _ref2.selector, | ||
selectorType = _ref2.selectorType, | ||
style = _ref2.style; | ||
var ruleContent = toRuleContent(style); // not nested style | ||
if (selectorType === 'void') { | ||
var atomicClassName = utils.objectToClassName(style) || wrapperSelector; | ||
return "." + atomicClassName + " {" + ruleContent + "}"; | ||
} | ||
var connector = selectorType === 'pseudo' ? '' : ' '; | ||
var finalSelector = wrapperSelector + connector + selector; | ||
return finalSelector + " {" + ruleContent + "}"; | ||
var rules = parsed.map(function (rule) { | ||
return toRule(rule, wrapperSelector); | ||
}); | ||
@@ -105,0 +113,0 @@ return rules; |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@fower/utils");function r(e){return/^::?.+/.test(e)}function t(e){return e?"object"!=typeof e||Array.isArray(e)?e:Object.keys(e).reduce((function(r,n){var o,c=t(e[n]);return Array.isArray(c)?c.reduce((function(e,r){return[].concat(e,[[n].concat(r)])}),r):[].concat(r,[[(o={},o[n]=c,o)]])}),[]):e}function n(e){return t(e).reduce((function(e,t){var n=t.pop(),o=t.reduce((function(e,t){return r(t)?""+e+t:e+" "+t}),""),c="child";return r(o)&&(c="pseudo"),""===o&&(c="void"),[].concat(e,[{selector:o,style:n,selectorType:c}])}),[])}exports.flatten=t,exports.parse=n,exports.toRules=function(r,t){var o=t?"."+t:"";return n(r).map((function(r){var t=r.selector,n=r.selectorType,c=r.style,u=function(r){for(var t="",n=0,o=Object.entries(r);n<o.length;n++){var c=o[n],u=c[1];t+=e.jsKeyToCssKey(c[0])+": "+u}return t}(c);return"void"===n?"."+(e.objectToClassName(c)||o)+" {"+u+"}":o+("pseudo"===n?"":" ")+t+" {"+u+"}"}))}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@fower/utils");function r(e){return/^::?.+/.test(e)}function t(e){return e?"object"!=typeof e||Array.isArray(e)?e:Object.keys(e).reduce((function(r,n){var o,c=t(e[n]);return Array.isArray(c)?c.reduce((function(e,r){return[].concat(e,[[n].concat(r)])}),r):[].concat(r,[[(o={},o[n]=c,o)]])}),[]):e}function n(e){return t(e).reduce((function(e,t){var n=t.pop(),o=t.reduce((function(e,t){return r(t)?""+e+t:e+" "+t}),""),c="child";return r(o)&&(c="pseudo"),""===o&&(c="void"),[].concat(e,[{selector:o,style:n,selectorType:c}])}),[])}exports.flatten=t,exports.parse=n,exports.toRules=function(r,t){var o=t?"."+t:"";return n(r).map((function(r){return function(r,t){void 0===t&&(t="");var n=r.selector,o=r.selectorType,c=r.style,u=function(r){for(var t="",n=0,o=Object.entries(r);n<o.length;n++){var c=o[n],u=c[1];t+=e.jsKeyToCssKey(c[0])+": "+u}return t}(c);return"void"===o?"."+(e.objectToClassName(c)||t)+" {"+u+"}":t+("pseudo"===o?"":" ")+n+" {"+u+"}"}(r,o)}))}; | ||
//# sourceMappingURL=css-object-processor.cjs.production.min.js.map |
@@ -72,2 +72,22 @@ import { objectToClassName, jsKeyToCssKey } from '@fower/utils'; | ||
} | ||
function toRule(rule, wrapperSelector) { | ||
if (wrapperSelector === void 0) { | ||
wrapperSelector = ''; | ||
} | ||
var selector = rule.selector, | ||
selectorType = rule.selectorType, | ||
style = rule.style; | ||
var ruleContent = toRuleContent(style); // not nested style | ||
if (selectorType === 'void') { | ||
var atomicClassName = objectToClassName(style) || wrapperSelector; | ||
return "." + atomicClassName + " {" + ruleContent + "}"; | ||
} | ||
var connector = selectorType === 'pseudo' ? '' : ' '; | ||
var finalSelector = wrapperSelector + connector + selector; | ||
return finalSelector + " {" + ruleContent + "}"; | ||
} | ||
/** | ||
@@ -85,16 +105,4 @@ * to rules can insertRule | ||
var parsed = parse(cssObj); | ||
var rules = parsed.map(function (_ref2) { | ||
var selector = _ref2.selector, | ||
selectorType = _ref2.selectorType, | ||
style = _ref2.style; | ||
var ruleContent = toRuleContent(style); // not nested style | ||
if (selectorType === 'void') { | ||
var atomicClassName = objectToClassName(style) || wrapperSelector; | ||
return "." + atomicClassName + " {" + ruleContent + "}"; | ||
} | ||
var connector = selectorType === 'pseudo' ? '' : ' '; | ||
var finalSelector = wrapperSelector + connector + selector; | ||
return finalSelector + " {" + ruleContent + "}"; | ||
var rules = parsed.map(function (rule) { | ||
return toRule(rule, wrapperSelector); | ||
}); | ||
@@ -101,0 +109,0 @@ return rules; |
{ | ||
"name": "@fower/css-object-processor", | ||
"version": "1.27.0", | ||
"version": "1.28.0", | ||
"license": "MIT", | ||
@@ -24,6 +24,6 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@fower/utils": "^1.27.0", | ||
"@fower/utils": "^1.28.0", | ||
"csstype": "^3.0.8" | ||
}, | ||
"gitHead": "ed8b71692d5c1a6f23279c0f6b4bb47cf18adacf" | ||
"gitHead": "5bf8d61bd49f8a82aebd6492ed162584430fdf21" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
26916
225
Updated@fower/utils@^1.28.0