tailwind-styled-v4 5.0.35 → 5.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +458 -339
- package/dist/cli.js +9 -6
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +9 -6
- package/dist/cli.mjs.map +1 -1
- package/dist/index.browser.mjs +689 -508
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.js +38 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -20
- package/dist/index.mjs.map +1 -1
- package/dist/next.js +240 -170
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +240 -170
- package/dist/next.mjs.map +1 -1
- package/dist/svelte.js +4 -4
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +4 -4
- package/dist/svelte.mjs.map +1 -1
- package/dist/tw.js +9 -6
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +9 -6
- package/dist/tw.mjs.map +1 -1
- package/dist/vue.js +4 -4
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +4 -4
- package/dist/vue.mjs.map +1 -1
- package/native/tailwind-styled-native.linux-x64-gnu.node +0 -0
- package/native/tailwind-styled-native.node +0 -0
- package/package.json +7 -5
package/dist/index.mjs
CHANGED
|
@@ -5203,17 +5203,12 @@ function hashState(tag, state) {
|
|
|
5203
5203
|
_hashStateCache.set(sortedKey, id);
|
|
5204
5204
|
return id;
|
|
5205
5205
|
}
|
|
5206
|
-
|
|
5207
|
-
function twClassesToCss(classes) {
|
|
5208
|
-
const cached = _twClassesToCssCache.get(classes);
|
|
5209
|
-
if (cached !== void 0) return cached;
|
|
5206
|
+
function generateStateRules(id, state) {
|
|
5210
5207
|
const native = getNativeBinding();
|
|
5211
|
-
if (!native?.
|
|
5212
|
-
throw new Error("FATAL: Native binding '
|
|
5208
|
+
if (!native?.generateRuntimeStateCss) {
|
|
5209
|
+
throw new Error("FATAL: Native binding 'generateRuntimeStateCss' is required but not available.");
|
|
5213
5210
|
}
|
|
5214
|
-
|
|
5215
|
-
_twClassesToCssCache.set(classes, result);
|
|
5216
|
-
return result;
|
|
5211
|
+
return native.generateRuntimeStateCss(id, JSON.stringify(state), null).map((rule) => rule.cssRule);
|
|
5217
5212
|
}
|
|
5218
5213
|
var _staticCssDetected = /* @__PURE__ */ new Set();
|
|
5219
5214
|
var _batchedInjectFn = null;
|
|
@@ -5245,10 +5240,7 @@ function injectStateStyles(id, state) {
|
|
|
5245
5240
|
}
|
|
5246
5241
|
}
|
|
5247
5242
|
}
|
|
5248
|
-
const rules =
|
|
5249
|
-
const css = twClassesToCss(classes);
|
|
5250
|
-
return css ? `.${id}[data-${stateName}="true"]{${css}}` : null;
|
|
5251
|
-
}).filter(Boolean);
|
|
5243
|
+
const rules = generateStateRules(id, state);
|
|
5252
5244
|
if (rules.length === 0) return;
|
|
5253
5245
|
if (_batchedInjectFn) {
|
|
5254
5246
|
for (const rule of rules) _batchedInjectFn(rule);
|
|
@@ -5278,11 +5270,7 @@ function processState(tag, state, precomputedHash) {
|
|
|
5278
5270
|
}
|
|
5279
5271
|
function generateStateCss(tag, state) {
|
|
5280
5272
|
const id = hashState(tag, state);
|
|
5281
|
-
|
|
5282
|
-
const css = twClassesToCss(classes);
|
|
5283
|
-
return css ? `.${id}[data-${stateName}="true"]{${css}}` : null;
|
|
5284
|
-
}).filter(Boolean);
|
|
5285
|
-
return rules.join("\n");
|
|
5273
|
+
return generateStateRules(id, state).join("\n");
|
|
5286
5274
|
}
|
|
5287
5275
|
function getStateRegistry() {
|
|
5288
5276
|
return stateRegistry;
|
|
@@ -5687,7 +5675,13 @@ function lookupGenerated(componentId, props, defaultVariants, variantKeys) {
|
|
|
5687
5675
|
}
|
|
5688
5676
|
const binding = getNativeBinding();
|
|
5689
5677
|
if (!binding?.buildVariantLookupKey) {
|
|
5690
|
-
|
|
5678
|
+
const parts = [];
|
|
5679
|
+
for (const k of sortedKeys) {
|
|
5680
|
+
const v = props[k] ?? defaultVariants?.[k];
|
|
5681
|
+
if (v != null) parts.push(`${k}:${String(v)}`);
|
|
5682
|
+
}
|
|
5683
|
+
const key2 = parts.join("|");
|
|
5684
|
+
return table[key2];
|
|
5691
5685
|
}
|
|
5692
5686
|
const relevantDefaults = {};
|
|
5693
5687
|
const relevantProps = {};
|
|
@@ -5730,7 +5724,31 @@ function resolveVariantsNative(config, props) {
|
|
|
5730
5724
|
const { variants = {}, defaultVariants = {} } = config;
|
|
5731
5725
|
const binding = getNativeBinding();
|
|
5732
5726
|
if (!binding?.resolveVariants) {
|
|
5733
|
-
|
|
5727
|
+
const variantKeys2 = Object.keys(variants);
|
|
5728
|
+
const classes = [];
|
|
5729
|
+
for (const key of variantKeys2) {
|
|
5730
|
+
const value = props[key] ?? defaultVariants[key];
|
|
5731
|
+
if (value != null) {
|
|
5732
|
+
const variantClass = variants[key]?.[String(value)];
|
|
5733
|
+
if (variantClass) classes.push(variantClass);
|
|
5734
|
+
}
|
|
5735
|
+
}
|
|
5736
|
+
if (config.compoundVariants) {
|
|
5737
|
+
for (const compound of config.compoundVariants) {
|
|
5738
|
+
const { class: compoundClass, ...conditions } = compound;
|
|
5739
|
+
const resolved = {};
|
|
5740
|
+
for (const key of variantKeys2) {
|
|
5741
|
+
resolved[key] = String(
|
|
5742
|
+
props[key] ?? defaultVariants[key] ?? ""
|
|
5743
|
+
);
|
|
5744
|
+
}
|
|
5745
|
+
const matches = Object.entries(conditions).every(
|
|
5746
|
+
([k, v]) => resolved[k] === v
|
|
5747
|
+
);
|
|
5748
|
+
if (matches) classes.push(compoundClass);
|
|
5749
|
+
}
|
|
5750
|
+
}
|
|
5751
|
+
return classes.join(" ");
|
|
5734
5752
|
}
|
|
5735
5753
|
const variantKeys = Object.keys(variants);
|
|
5736
5754
|
const configJson = _getConfigJson(config);
|