@stylable/module-utils
Advanced tools
Comparing version
@@ -10,5 +10,2 @@ "use strict"; | ||
for (const [stateName, stateDef] of Object.entries(stStates)) { | ||
if (typeof stateDef === 'string') { | ||
continue; | ||
} | ||
if (!stateEntries.has(stateName)) { | ||
@@ -34,3 +31,7 @@ stateEntries.set(stateName, stateDef); | ||
for (const [stateName, stateDef] of stateEntries.entries()) { | ||
stateEntriesString += `${asString(stateName)}?: ${getStateTSType(stateDef)}; `; | ||
const booleanState = !stateDef; | ||
const mappedState = (stateDef === null || stateDef === void 0 ? void 0 : stateDef.type) === 'template' || typeof stateDef === 'string'; | ||
if (booleanState || !mappedState) { | ||
stateEntriesString += `${asString(stateName)}?: ${getStateTSType(stateDef)}; `; | ||
} | ||
} | ||
@@ -37,0 +38,0 @@ return stateEntriesString; |
@@ -12,2 +12,6 @@ import type { StylableExports } from '@stylable/core/dist/index-internal'; | ||
/** | ||
* code to generate the css string to inject | ||
*/ | ||
cssCode?: string; | ||
/** | ||
* calculated style depth | ||
@@ -14,0 +18,0 @@ */ |
@@ -56,7 +56,7 @@ "use strict"; | ||
} | ||
const { id, css, depthCode, depth, runtimeId } = injectOptions; | ||
const { id, css, cssCode, depthCode, depth, runtimeId } = injectOptions; | ||
let out = 'injectCSS('; | ||
out += id ? JSON.stringify(id) : moduleType === 'esm' ? 'import.meta.url' : 'module.id'; | ||
out += ', '; | ||
out += JSON.stringify(css); | ||
out += cssCode || JSON.stringify(css); | ||
out += ', '; | ||
@@ -63,0 +63,0 @@ out += depthCode || JSON.stringify(depth) || '-1'; |
{ | ||
"name": "@stylable/module-utils", | ||
"version": "5.4.1-rc.1", | ||
"version": "5.5.0", | ||
"description": "Stylable module creation utilities", | ||
@@ -10,3 +10,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@stylable/core": "5.4.1-rc.1", | ||
"@stylable/core": "^5.5.0", | ||
"@tokey/core": "^1.3.0", | ||
@@ -13,0 +13,0 @@ "vlq": "^2.0.4" |
@@ -12,3 +12,3 @@ import type { ClassSymbol, StylableMeta, StylableResults, StylableSymbol } from '@stylable/core'; | ||
function addStatesEntries( | ||
stateEntries: Map<string, StateParsedValue | string | null>, | ||
stateEntries: Map<string, MappedStates[string]>, | ||
stStates: MappedStates | undefined | ||
@@ -18,6 +18,2 @@ ) { | ||
for (const [stateName, stateDef] of Object.entries(stStates)) { | ||
if (typeof stateDef === 'string') { | ||
continue; | ||
} | ||
if (!stateEntries.has(stateName)) { | ||
@@ -49,3 +45,7 @@ stateEntries.set(stateName, stateDef); | ||
for (const [stateName, stateDef] of stateEntries.entries()) { | ||
stateEntriesString += `${asString(stateName)}?: ${getStateTSType(stateDef)}; `; | ||
const booleanState = !stateDef; | ||
const mappedState = stateDef?.type === 'template' || typeof stateDef === 'string'; | ||
if (booleanState || !mappedState) { | ||
stateEntriesString += `${asString(stateName)}?: ${getStateTSType(stateDef)}; `; | ||
} | ||
} | ||
@@ -52,0 +52,0 @@ |
@@ -13,2 +13,6 @@ import type { StylableExports } from '@stylable/core/dist/index-internal'; | ||
/** | ||
* code to generate the css string to inject | ||
*/ | ||
cssCode?: string; | ||
/** | ||
* calculated style depth | ||
@@ -138,3 +142,3 @@ */ | ||
} | ||
const { id, css, depthCode, depth, runtimeId } = injectOptions; | ||
const { id, css, cssCode, depthCode, depth, runtimeId } = injectOptions; | ||
@@ -144,3 +148,3 @@ let out = 'injectCSS('; | ||
out += ', '; | ||
out += JSON.stringify(css); | ||
out += cssCode || JSON.stringify(css); | ||
out += ', '; | ||
@@ -147,0 +151,0 @@ out += depthCode || JSON.stringify(depth) || '-1'; |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
111650
0.57%1996
0.5%1
-50%+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
Updated