Comparing version 1.0.26 to 1.0.27
{ | ||
"name": "void-css", | ||
"version": "1.0.26", | ||
"version": "1.0.27", | ||
"description": "A JIT & statically compiled CSS processor", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -13,2 +13,20 @@ const initialState = { | ||
function styler(...args) { | ||
return args.join(";"); | ||
} | ||
function log(...args) { | ||
const debug = !!window.__voidCSSDebugEnabled; | ||
if (debug) { | ||
return void console.log( | ||
"« %cVoid %cCSS » [%cDebug%c]", | ||
styler("color: #ad83fc", "font-weight: bold", "font-size: 16px"), | ||
styler("color: #fff", "font-size: 16px"), | ||
styler("color: lightgreen"), | ||
styler(""), | ||
...args, | ||
); | ||
} | ||
} | ||
const handler = { | ||
@@ -48,4 +66,5 @@ get: function (target, prop) { | ||
} | ||
this.destroy = function () { | ||
void log("Stylesheet destroyed, state reset and styles removed. (for dev) hmr issue may occur, refresh the page"); | ||
for (const element of state.usedStyleElements) { | ||
@@ -63,2 +82,3 @@ try { | ||
function init() { | ||
void log("Initiated styles"); | ||
const rID = resolveID("static", id); | ||
@@ -95,2 +115,3 @@ const style = document.getElementById(rID) || createStyleElement(rID); | ||
function voidCSSAssembler(input) { | ||
void log("Assembler called", input); | ||
@@ -155,6 +176,13 @@ if (!state.initiated) { | ||
function updateGenericDynamicStyle(rule, input) { | ||
void log("Updating generic dynamic rule: ", rule, "input: ", input); | ||
// Ensures that rule is only updated if new styles are available | ||
if (!input || !rule.dependencies.some(dependency => input.hasOwnProperty(dependency.slice(1)))) { | ||
return void log("Did not update generic dynamic rule because it has no new styles to consume."); | ||
} | ||
const localID = resolveID("dynamic-generic", rule.hash, id); | ||
const css = interpolateDynamicStyles(rule, input); | ||
const style = document.getElementById(localID) || createStyleElement(localID); | ||
void log("New generic dynamic styles: ", css); | ||
style.innerHTML = css; | ||
@@ -161,0 +189,0 @@ } |
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
209805
4390