@yahoo/uds 3.156.2 → 3.157.1
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/dist/automated-config/dist/generated/autoVariants.cjs +9 -4
- package/dist/automated-config/dist/generated/autoVariants.d.cts +2 -1
- package/dist/automated-config/dist/generated/autoVariants.d.ts +2 -1
- package/dist/automated-config/dist/generated/autoVariants.js +9 -4
- package/dist/automated-config/dist/generated/generatedConfigs.cjs +3078 -3089
- package/dist/automated-config/dist/generated/generatedConfigs.d.cts +158 -141
- package/dist/automated-config/dist/generated/generatedConfigs.d.ts +158 -141
- package/dist/automated-config/dist/generated/generatedConfigs.js +3078 -3089
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.cjs +1217 -491
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.cts +4 -1
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.ts +4 -1
- package/dist/automated-config/dist/generated/universalTokensConfigAuto.js +1217 -491
- package/dist/automated-config/dist/properties.cjs +9 -2
- package/dist/automated-config/dist/properties.d.cts +23 -0
- package/dist/automated-config/dist/properties.d.ts +23 -0
- package/dist/automated-config/dist/properties.js +9 -2
- package/dist/automated-config/dist/types/ComponentConfig.d.cts +77 -4
- package/dist/automated-config/dist/types/ComponentConfig.d.ts +77 -4
- package/dist/automated-config/dist/types/ConfigSchema.d.cts +14 -2
- package/dist/automated-config/dist/types/ConfigSchema.d.ts +14 -2
- package/dist/automated-config/dist/types/StateAxis.cjs +90 -0
- package/dist/automated-config/dist/types/StateAxis.d.cts +70 -0
- package/dist/automated-config/dist/types/StateAxis.d.ts +70 -0
- package/dist/automated-config/dist/types/StateAxis.js +84 -0
- package/dist/automated-config/dist/utils/buildConfigSchema.cjs +105 -82
- package/dist/automated-config/dist/utils/buildConfigSchema.d.cts +41 -12
- package/dist/automated-config/dist/utils/buildConfigSchema.d.ts +41 -12
- package/dist/automated-config/dist/utils/buildConfigSchema.js +106 -83
- package/dist/automated-config/dist/utils/canonicalizeStateKey.cjs +32 -0
- package/dist/automated-config/dist/utils/canonicalizeStateKey.d.cts +48 -0
- package/dist/automated-config/dist/utils/canonicalizeStateKey.d.ts +48 -0
- package/dist/automated-config/dist/utils/canonicalizeStateKey.js +31 -0
- package/dist/automated-config/dist/utils/getButtonControlHeight.cjs +129 -0
- package/dist/automated-config/dist/utils/getButtonControlHeight.d.cts +133 -0
- package/dist/automated-config/dist/utils/getButtonControlHeight.d.ts +133 -0
- package/dist/automated-config/dist/utils/getButtonControlHeight.js +122 -0
- package/dist/automated-config/dist/utils/getButtonControlHeightPx.cjs +114 -0
- package/dist/automated-config/dist/utils/getButtonControlHeightPx.d.cts +78 -0
- package/dist/automated-config/dist/utils/getButtonControlHeightPx.d.ts +78 -0
- package/dist/automated-config/dist/utils/getButtonControlHeightPx.js +108 -0
- package/dist/automated-config/dist/utils/getConfigComponentVariant.d.cts +8 -0
- package/dist/automated-config/dist/utils/getConfigComponentVariant.d.ts +8 -0
- package/dist/automated-config/dist/utils/getConfigVariantProperties.d.cts +3 -3
- package/dist/automated-config/dist/utils/getConfigVariantProperties.d.ts +3 -3
- package/dist/automated-config/dist/utils/getConfigVariantPseudoStates.cjs +12 -5
- package/dist/automated-config/dist/utils/getConfigVariantPseudoStates.d.cts +8 -1
- package/dist/automated-config/dist/utils/getConfigVariantPseudoStates.d.ts +8 -1
- package/dist/automated-config/dist/utils/getConfigVariantPseudoStates.js +12 -5
- package/dist/automated-config/dist/utils/iconButtonMatchButtonHeight.cjs +110 -0
- package/dist/automated-config/dist/utils/iconButtonMatchButtonHeight.d.cts +19 -0
- package/dist/automated-config/dist/utils/iconButtonMatchButtonHeight.d.ts +19 -0
- package/dist/automated-config/dist/utils/iconButtonMatchButtonHeight.js +108 -0
- package/dist/automated-config/dist/utils/index.cjs +478 -111
- package/dist/automated-config/dist/utils/index.d.cts +76 -15
- package/dist/automated-config/dist/utils/index.d.ts +76 -15
- package/dist/automated-config/dist/utils/index.js +479 -113
- package/dist/automated-config/dist/utils/isConfiguratorPropertyVisible.cjs +15 -0
- package/dist/automated-config/dist/utils/isConfiguratorPropertyVisible.d.cts +20 -0
- package/dist/automated-config/dist/utils/isConfiguratorPropertyVisible.d.ts +20 -0
- package/dist/automated-config/dist/utils/isConfiguratorPropertyVisible.js +15 -0
- package/dist/automated-config/dist/utils/pseudoStateSelectors.cjs +122 -0
- package/dist/automated-config/dist/utils/pseudoStateSelectors.d.cts +80 -0
- package/dist/automated-config/dist/utils/pseudoStateSelectors.d.ts +80 -0
- package/dist/automated-config/dist/utils/pseudoStateSelectors.js +120 -0
- package/dist/automated-config/dist/utils/resolvePropertyStates.cjs +131 -0
- package/dist/automated-config/dist/utils/resolvePropertyStates.d.cts +49 -0
- package/dist/automated-config/dist/utils/resolvePropertyStates.d.ts +49 -0
- package/dist/automated-config/dist/utils/resolvePropertyStates.js +130 -0
- package/dist/automated-config/dist/utils/resolveSlotByCascade.cjs +118 -0
- package/dist/automated-config/dist/utils/resolveSlotByCascade.d.cts +68 -0
- package/dist/automated-config/dist/utils/resolveSlotByCascade.d.ts +68 -0
- package/dist/automated-config/dist/utils/resolveSlotByCascade.js +117 -0
- package/dist/automated-config/dist/utils/variantConfigGuards.d.cts +13 -0
- package/dist/automated-config/dist/utils/variantConfigGuards.d.ts +13 -0
- package/dist/components/client/Button.cjs +3 -3
- package/dist/components/client/Button.js +3 -3
- package/dist/components/client/Input/Input.cjs +42 -6
- package/dist/components/client/Input/Input.d.cts +13 -0
- package/dist/components/client/Input/Input.d.ts +13 -0
- package/dist/components/client/Input/Input.js +42 -6
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.cts +1 -1
- package/dist/components/client/Menu/Menu.ItemCheckbox.d.ts +1 -1
- package/dist/config/dist/index.cjs +224 -553
- package/dist/config/dist/index.js +224 -553
- package/dist/css/dist/commands/css.cjs +1 -0
- package/dist/css/dist/commands/css.helpers.cjs +6 -0
- package/dist/css/dist/commands/css.helpers.js +6 -0
- package/dist/css/dist/commands/css.js +1 -0
- package/dist/css/dist/css/generate.cjs +4 -2
- package/dist/css/dist/css/generate.d.cts +28 -0
- package/dist/css/dist/css/generate.d.ts +28 -0
- package/dist/css/dist/css/generate.helpers.cjs +5 -1
- package/dist/css/dist/css/generate.helpers.js +6 -2
- package/dist/css/dist/css/generate.js +4 -2
- package/dist/css/dist/css/postcss.cjs +81 -0
- package/dist/css/dist/css/postcss.helpers.cjs +60 -0
- package/dist/css/dist/css/postcss.helpers.js +59 -1
- package/dist/css/dist/css/postcss.js +82 -2
- package/dist/css/dist/css/runner.cjs +12 -2
- package/dist/css/dist/css/runner.js +12 -2
- package/dist/css/dist/css/theme.d.cts +6 -0
- package/dist/css/dist/css/theme.d.ts +6 -0
- package/dist/css/dist/packages/automated-config/dist/properties.cjs +9 -2
- package/dist/css/dist/packages/automated-config/dist/properties.js +9 -2
- package/dist/css/dist/packages/automated-config/dist/utils/index.d.cts +6 -0
- package/dist/css/dist/packages/automated-config/dist/utils/index.d.ts +6 -0
- package/dist/css/dist/packages/config/dist/index.cjs +224 -553
- package/dist/css/dist/packages/config/dist/index.js +224 -553
- package/dist/css/dist/utils/optimizeCSS.cjs +59 -0
- package/dist/css/dist/utils/optimizeCSS.js +59 -0
- package/dist/css-tokens/dist/index.cjs +2 -0
- package/dist/css-tokens/dist/index.d.cts +2 -1
- package/dist/css-tokens/dist/index.d.ts +2 -1
- package/dist/css-tokens/dist/index.js +2 -1
- package/dist/index.cjs +48 -0
- package/dist/index.d.cts +15 -4
- package/dist/index.d.ts +15 -4
- package/dist/index.js +14 -3
- package/dist/styles/styler.d.cts +8 -7
- package/dist/styles/styler.d.ts +8 -7
- package/dist/styles/variants.d.cts +9 -4
- package/dist/styles/variants.d.ts +9 -4
- package/dist/tailwind-internal/dist/packages/automated-config/dist/generated/generatedConfigs.cjs +3078 -3089
- package/dist/tailwind-internal/dist/packages/automated-config/dist/generated/generatedConfigs.js +3078 -3089
- package/dist/tailwind-internal/dist/packages/automated-config/dist/properties.cjs +9 -2
- package/dist/tailwind-internal/dist/packages/automated-config/dist/properties.js +9 -2
- package/dist/tailwind-internal/dist/packages/automated-config/dist/types/StateAxis.cjs +81 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/types/StateAxis.js +76 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/canonicalizeStateKey.cjs +33 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/canonicalizeStateKey.js +32 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/componentStatePseudoStates.cjs +0 -7
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/componentStatePseudoStates.js +1 -7
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/getButtonControlHeight.cjs +126 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/getButtonControlHeight.js +123 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/iconButtonMatchButtonHeight.cjs +20 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/iconButtonMatchButtonHeight.js +20 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/index.cjs +422 -111
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/index.d.cts +6 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/index.d.ts +6 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/index.js +423 -112
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/pseudoStateSelectors.cjs +122 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/pseudoStateSelectors.js +121 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/resolvePropertyStates.cjs +132 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/resolvePropertyStates.js +131 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/resolveSlotByCascade.cjs +95 -0
- package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/resolveSlotByCascade.js +95 -0
- package/dist/tailwind-internal/dist/packages/config/dist/index.cjs +224 -553
- package/dist/tailwind-internal/dist/packages/config/dist/index.js +224 -553
- package/dist/tailwind-internal/dist/packages/css-tokens/dist/index.cjs +2 -0
- package/dist/tailwind-internal/dist/packages/css-tokens/dist/index.js +2 -1
- package/dist/tailwind-internal/dist/plugins/components.cjs +28 -24
- package/dist/tailwind-internal/dist/plugins/components.js +28 -24
- package/dist/tailwind-internal/dist/utils/composeTailwindPlugins.d.cts +3 -0
- package/dist/tailwind-internal/dist/utils/composeTailwindPlugins.d.ts +3 -0
- package/dist/tailwind-internal/dist/utils/getShadowStyles.d.cts +2 -2
- package/dist/tailwind-internal/dist/utils/getShadowStyles.d.ts +2 -2
- package/dist/tokens/automation/index.cjs +47 -0
- package/dist/tokens/automation/index.d.cts +13 -2
- package/dist/tokens/automation/index.d.ts +13 -2
- package/dist/tokens/automation/index.js +13 -2
- package/dist/tokens/consts/cssTokens.cjs +1 -0
- package/dist/tokens/consts/cssTokens.d.cts +2 -2
- package/dist/tokens/consts/cssTokens.d.ts +2 -2
- package/dist/tokens/consts/cssTokens.js +2 -2
- package/dist/tokens/index.cjs +48 -0
- package/dist/tokens/index.d.cts +15 -4
- package/dist/tokens/index.d.ts +15 -4
- package/dist/tokens/index.js +14 -3
- package/dist/tokens/types.d.cts +1 -1
- package/dist/tokens/types.d.ts +1 -1
- package/dist/uds/generated/componentData.cjs +2177 -2172
- package/dist/uds/generated/componentData.js +2177 -2172
- package/dist/uds/generated/migrationSchemaVersion.cjs +1 -1
- package/dist/uds/generated/migrationSchemaVersion.js +1 -1
- package/dist/uds/generated/tailwindPurge.cjs +79 -78
- package/dist/uds/generated/tailwindPurge.js +79 -78
- package/generated/componentData.json +2718 -2713
- package/generated/migrationSchemaVersion.ts +1 -1
- package/generated/tailwindPurge.ts +2 -2
- package/package.json +1 -1
|
@@ -3,11 +3,16 @@ require("../../../../../../_virtual/_rolldown/runtime.cjs");
|
|
|
3
3
|
const require_index = require("../../../css-tokens/dist/index.cjs");
|
|
4
4
|
const require_mapTextVariantFixtureToValue = require("../mapTextVariantFixtureToValue.cjs");
|
|
5
5
|
const require_properties = require("../properties.cjs");
|
|
6
|
+
const require_StateAxis = require("../types/StateAxis.cjs");
|
|
6
7
|
const require_componentStatePseudoStates = require("./componentStatePseudoStates.cjs");
|
|
7
8
|
const require_generateSchemaKey = require("./generateSchemaKey.cjs");
|
|
9
|
+
const require_resolvePropertyStates = require("./resolvePropertyStates.cjs");
|
|
8
10
|
const require_variantConfigGuards = require("./variantConfigGuards.cjs");
|
|
9
11
|
const require_buildConfigSchema = require("./buildConfigSchema.cjs");
|
|
10
12
|
const require_generateDefaultClassName = require("./generateDefaultClassName.cjs");
|
|
13
|
+
const require_getButtonControlHeight = require("./getButtonControlHeight.cjs");
|
|
14
|
+
const require_pseudoStateSelectors = require("./pseudoStateSelectors.cjs");
|
|
15
|
+
const require_resolveSlotByCascade = require("./resolveSlotByCascade.cjs");
|
|
11
16
|
let lodash_es = require("lodash-es");
|
|
12
17
|
//#region ../tailwind-internal/dist/packages/automated-config/dist/utils/index.js
|
|
13
18
|
/*! © 2026 Yahoo, Inc. UDS Tailwind Internal v0.0.0-development */
|
|
@@ -62,47 +67,59 @@ const COMPONENTS_WITH_SHADOW_BORDERS = [
|
|
|
62
67
|
}
|
|
63
68
|
];
|
|
64
69
|
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
70
|
+
* Legacy state keys still used by unmigrated component configs via per-property
|
|
71
|
+
* `pseudoStates` arrays. They aren't in the new `StateAxis` taxonomy (so the
|
|
72
|
+
* resolver/StateBuilder don't auto-compose them) but they must remain in
|
|
73
|
+
* `KNOWN_STATE_KEYS` so the docs-mode map / configurator safelist still cover
|
|
74
|
+
* configs that emit them. Drop entries from this list as components migrate.
|
|
67
75
|
*/
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
visited: ":visited",
|
|
74
|
-
focused: ":focus",
|
|
75
|
-
"focus-within": ":focus-within",
|
|
76
|
-
"focused-keyboard": ":focus-visible",
|
|
77
|
-
readonly: ":has(input:read-only)",
|
|
78
|
-
invalid: ":has(input[aria-invalid=\"true\"])",
|
|
79
|
-
"invalid&hover": ":has(input[aria-invalid=\"true\"]):hover:not(:active, :disabled, :has(:disabled))",
|
|
80
|
-
"invalid&pressed": ":has(input[aria-invalid=\"true\"]):active:not(:disabled, :has(:disabled))"
|
|
81
|
-
};
|
|
82
|
-
const statePseudoMapDocsMode = {
|
|
83
|
-
rest: "",
|
|
84
|
-
hover: "hover",
|
|
85
|
-
pressed: "active",
|
|
86
|
-
disabled: "has-disabled",
|
|
87
|
-
visited: "visited",
|
|
88
|
-
focused: "focus",
|
|
89
|
-
"focus-within": "focus-within",
|
|
90
|
-
"focused-keyboard": "focus-visible",
|
|
91
|
-
readonly: "input-readonly",
|
|
92
|
-
invalid: "has-input-invalid",
|
|
93
|
-
"invalid&hover": "has-input-invalid-and-hover",
|
|
94
|
-
"invalid&pressed": "has-input-invalid-and-active"
|
|
95
|
-
};
|
|
76
|
+
const LEGACY_STATE_KEYS = [
|
|
77
|
+
"disabled",
|
|
78
|
+
"focused",
|
|
79
|
+
"focused-keyboard"
|
|
80
|
+
];
|
|
96
81
|
/**
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
82
|
+
* Enumerates every canonical state key the system supports: rest, every atom,
|
|
83
|
+
* every modifier-subset (up to {@link MAX_MODIFIERS_PER_COMPOUND}) on its own
|
|
84
|
+
* and combined with each interactive, plus any legacy keys still in use.
|
|
85
|
+
*
|
|
86
|
+
* Mirrors `resolvePropertyStates` exactly so what the resolver pre-emits in
|
|
87
|
+
* the schema, what the StateBuilder lets users compose, and what the docs
|
|
88
|
+
* map / configurator safelist preserve are all the same set.
|
|
100
89
|
*/
|
|
101
|
-
function
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
90
|
+
function enumerateAllStateKeys() {
|
|
91
|
+
const states = ["rest"];
|
|
92
|
+
const atoms = [...require_StateAxis.INTERACTIVE_ATOMICS, ...require_StateAxis.MODIFIER_ATOMICS].sort(require_StateAxis.comparePriority);
|
|
93
|
+
for (const stateKey of require_resolvePropertyStates.atomicAndCompoundStateKeys(atoms)) states.push(stateKey);
|
|
94
|
+
for (const legacy of LEGACY_STATE_KEYS) states.push(legacy);
|
|
95
|
+
return states;
|
|
105
96
|
}
|
|
97
|
+
const KNOWN_STATE_KEYS = enumerateAllStateKeys();
|
|
98
|
+
/**
|
|
99
|
+
* Lookup of every known state key to its index in `KNOWN_STATE_KEYS` — i.e. the
|
|
100
|
+
* resolver's emission order. The CSS generator iterates property-state maps
|
|
101
|
+
* in this order (instead of the alphabetical insertion order produced by
|
|
102
|
+
* `syncYosConfig`'s `normalizeConfig`), so cascade tie-breaking under the
|
|
103
|
+
* uniform per-atom specificity actually follows the priority chain. Unknown
|
|
104
|
+
* keys sort to the end.
|
|
105
|
+
*/
|
|
106
|
+
const KNOWN_STATE_RANK = new Map(KNOWN_STATE_KEYS.map((key, index) => [key, index]));
|
|
107
|
+
function compareStateKeys(a, b) {
|
|
108
|
+
const ra = KNOWN_STATE_RANK.get(a) ?? Number.POSITIVE_INFINITY;
|
|
109
|
+
const rb = KNOWN_STATE_RANK.get(b) ?? Number.POSITIVE_INFINITY;
|
|
110
|
+
if (ra === rb) return a < b ? -1 : a > b ? 1 : 0;
|
|
111
|
+
return ra - rb;
|
|
112
|
+
}
|
|
113
|
+
function buildStateRecord(transform) {
|
|
114
|
+
const record = {};
|
|
115
|
+
for (const key of KNOWN_STATE_KEYS) record[key] = transform(key);
|
|
116
|
+
return record;
|
|
117
|
+
}
|
|
118
|
+
buildStateRecord(require_pseudoStateSelectors.getStateDocsClass);
|
|
119
|
+
/**
|
|
120
|
+
* Layout line-height for button root: icon size only (not textVariant line-height).
|
|
121
|
+
* @see getButtonContentLineHeight
|
|
122
|
+
*/
|
|
106
123
|
/**
|
|
107
124
|
* Shared pagination control content size: max(icon size, text line-height).
|
|
108
125
|
* Keeps page numbers and prev/next icons vertically centered when typography exceeds icon height.
|
|
@@ -235,7 +252,65 @@ const getTheCssPropertyValue = (schema, theme, propertyName, schemaStateValue, e
|
|
|
235
252
|
if (propertyConfig.concatenate && existingValue) return `${existingValue}${propertyConfig.concatenationDelimiter || ", "}${newValue}`;
|
|
236
253
|
return newValue;
|
|
237
254
|
};
|
|
238
|
-
|
|
255
|
+
/**
|
|
256
|
+
* Builds the per-state resolution map for a per-componentState OVERRIDE in
|
|
257
|
+
* exhaustive mode: the universal layer's state map with the override's ENABLED
|
|
258
|
+
* (and `rest`) slots layered on top. An unset or disabled override slot defers
|
|
259
|
+
* to the universal layer's value, so `resolveSlotByCascade` picks the
|
|
260
|
+
* most-specific *enabled* slot across both layers (override winning ties) rather
|
|
261
|
+
* than collapsing every unset state to the override's own `rest`.
|
|
262
|
+
*/
|
|
263
|
+
function mergeUniversalUnderOverride(universal, override) {
|
|
264
|
+
const merged = { ...universal };
|
|
265
|
+
const overrideRecord = override;
|
|
266
|
+
for (const state of Object.keys(overrideRecord)) {
|
|
267
|
+
const slot = overrideRecord[state];
|
|
268
|
+
if (state === "rest" && slot?.isEnabled !== false || slot?.isEnabled === true) merged[state] = slot;
|
|
269
|
+
}
|
|
270
|
+
return merged;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Replays SELECTIVE emission for a STANDALONE atomicStates layer (no universal
|
|
274
|
+
* fallback) and returns the sparse set of slots it would emit: `rest`, every
|
|
275
|
+
* explicitly-enabled state, and every cascade-correction. Mirrors the inline
|
|
276
|
+
* selective decision in `generateDeclaration` — keep the two in lock-step.
|
|
277
|
+
*
|
|
278
|
+
* The override path seeds its own correction accumulator with this for the
|
|
279
|
+
* UNIVERSAL layer. Universal layers are emitted in a separate pass at the SAME
|
|
280
|
+
* specificity tier as their per-option overrides (see `bumpRootSpecificity`), so
|
|
281
|
+
* at runtime a universal rule wins wherever the override emits nothing. Without
|
|
282
|
+
* this seed, an override that flattens a state to `rest` (e.g. a `filled` help
|
|
283
|
+
* text that's `muted` everywhere) silently inherits the universal's brighter
|
|
284
|
+
* rule for that state in selective mode — a divergence from exhaustive, where
|
|
285
|
+
* the override emits every state explicitly. Seeding makes the override emit a
|
|
286
|
+
* correction whenever the universal would otherwise render a different value.
|
|
287
|
+
*/
|
|
288
|
+
function selectiveEmittedStates(stateMap, orderedStateKeys, emittableStates) {
|
|
289
|
+
const emitted = { rest: stateMap.rest };
|
|
290
|
+
for (const stateKey of orderedStateKeys) {
|
|
291
|
+
if (stateKey === "rest" || !emittableStates.has(stateKey)) continue;
|
|
292
|
+
const value = require_resolveSlotByCascade.resolveSlotByCascade(stateKey, stateMap);
|
|
293
|
+
if (!value) continue;
|
|
294
|
+
if (!(stateMap[stateKey]?.isEnabled === true)) {
|
|
295
|
+
if (require_resolveSlotByCascade.resolveSlotByCascade(stateKey, emitted)?.value === value.value) continue;
|
|
296
|
+
}
|
|
297
|
+
emitted[stateKey] = {
|
|
298
|
+
...value,
|
|
299
|
+
isEnabled: true
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
return emitted;
|
|
303
|
+
}
|
|
304
|
+
function generateDeclaration({ componentName, subComponentName, variantKey, variantValue, layer, layerOptionalPseudoSelector, componentStateKey, componentStateValue, schema, propertyKey, originalPropertyDefinition, declaredStates, layerUsesAtomicStates, theme, currentStyles, previewOptions, excludedPseudoStates = [], emit, fallbackStateMap, bumpRootSpecificity, buttonHeightReferenceSchema }) {
|
|
305
|
+
const shouldUseExhaustive = (emit ?? "exhaustive") === "exhaustive" && layerUsesAtomicStates;
|
|
306
|
+
const { cssProperties: configuredCssProperties, extendedProperties: configuredExtendedGetter } = require_properties.configurableProperties[originalPropertyDefinition.name];
|
|
307
|
+
const configuredExtendedProperties = (0, lodash_es.isFunction)(configuredExtendedGetter) ? configuredExtendedGetter({
|
|
308
|
+
componentName,
|
|
309
|
+
subComponentName,
|
|
310
|
+
layer,
|
|
311
|
+
propertyKey
|
|
312
|
+
}) : configuredExtendedGetter;
|
|
313
|
+
if (!(typeof configuredCssProperties === "string" && configuredCssProperties.length > 0 || Array.isArray(configuredCssProperties) && configuredCssProperties.length > 0 || Array.isArray(configuredExtendedProperties) && configuredExtendedProperties.length > 0)) return {};
|
|
239
314
|
const schemaKey = require_generateSchemaKey.generateSchemaKey({
|
|
240
315
|
variantKey,
|
|
241
316
|
variantValue,
|
|
@@ -256,14 +331,29 @@ function generateDeclaration({ componentName, subComponentName, variantKey, vari
|
|
|
256
331
|
const propertyStateMap = schema.variables?.[schemaKey]?.[propertyKey];
|
|
257
332
|
if (!propertyStateMap) throw new Error(`Prop definition (${componentName} - ${schemaKey} - ${propertyKey}) not found, this is not expected, please report the bug to the UDS team`);
|
|
258
333
|
const styles = {};
|
|
259
|
-
const
|
|
260
|
-
const
|
|
261
|
-
const
|
|
262
|
-
|
|
263
|
-
|
|
334
|
+
const excludedStateSet = new Set(excludedPseudoStates);
|
|
335
|
+
const emittableStates = new Set([...declaredStates].filter((state) => !excludedStateSet.has(state)));
|
|
336
|
+
const orderedStateKeys = (shouldUseExhaustive || layerUsesAtomicStates ? [...emittableStates] : Object.keys(propertyStateMap)).sort(compareStateKeys);
|
|
337
|
+
const resolutionStates = fallbackStateMap ? mergeUniversalUnderOverride(fallbackStateMap, propertyStateMap) : propertyStateMap;
|
|
338
|
+
const emittedForSelective = layerUsesAtomicStates && !shouldUseExhaustive ? fallbackStateMap ? selectiveEmittedStates(fallbackStateMap, orderedStateKeys, emittableStates) : { rest: resolutionStates.rest } : {};
|
|
339
|
+
for (const propStateStr of orderedStateKeys) {
|
|
340
|
+
if (!emittableStates.has(propStateStr)) continue;
|
|
264
341
|
const propertyState = propStateStr;
|
|
265
|
-
const propertyStateSelector =
|
|
266
|
-
const schemaValueForState = propertyStateMap[propertyState];
|
|
342
|
+
const propertyStateSelector = require_pseudoStateSelectors.getStateSelector(propertyState);
|
|
343
|
+
const schemaValueForState = shouldUseExhaustive || layerUsesAtomicStates ? require_resolveSlotByCascade.resolveSlotByCascade(propStateStr, resolutionStates) : propertyStateMap[propertyState];
|
|
344
|
+
if (!schemaValueForState) continue;
|
|
345
|
+
if (!shouldUseExhaustive) {
|
|
346
|
+
if (layerUsesAtomicStates) {
|
|
347
|
+
const isExplicitlyEnabled = propertyStateMap[propertyState]?.isEnabled === true;
|
|
348
|
+
if (propStateStr !== "rest" && !isExplicitlyEnabled) {
|
|
349
|
+
if (require_resolveSlotByCascade.resolveSlotByCascade(propStateStr, emittedForSelective)?.value === schemaValueForState.value) continue;
|
|
350
|
+
}
|
|
351
|
+
emittedForSelective[propStateStr] = {
|
|
352
|
+
...schemaValueForState,
|
|
353
|
+
isEnabled: true
|
|
354
|
+
};
|
|
355
|
+
} else if (schemaValueForState.isEnabled === false) continue;
|
|
356
|
+
}
|
|
267
357
|
let fullClassName = ``;
|
|
268
358
|
if (layer === "root") if (componentStateKey && componentStateValue) {
|
|
269
359
|
const rootVariantClass = generateClassName({
|
|
@@ -282,7 +372,7 @@ function generateDeclaration({ componentName, subComponentName, variantKey, vari
|
|
|
282
372
|
componentStateValue
|
|
283
373
|
});
|
|
284
374
|
fullClassName = `.${rootVariantClass}${propertyStateSelector}.${className}`;
|
|
285
|
-
} else fullClassName = `.${className}${propertyStateSelector}`;
|
|
375
|
+
} else fullClassName = bumpRootSpecificity ? `.${className}.${className}${propertyStateSelector}` : `.${className}${propertyStateSelector}`;
|
|
286
376
|
else {
|
|
287
377
|
const rootVariantClassName = generateClassName({
|
|
288
378
|
componentName,
|
|
@@ -309,7 +399,17 @@ function generateDeclaration({ componentName, subComponentName, variantKey, vari
|
|
|
309
399
|
subComponentName
|
|
310
400
|
});
|
|
311
401
|
fullClassName = `.${rootVariantClassName}${propertyStateSelector}.${rootVariantClassNameWithComponentState} .${className}`;
|
|
312
|
-
} else
|
|
402
|
+
} else {
|
|
403
|
+
className = generateClassName({
|
|
404
|
+
componentName,
|
|
405
|
+
variantKey,
|
|
406
|
+
variantValue,
|
|
407
|
+
layer,
|
|
408
|
+
layerOptionalPseudoSelector,
|
|
409
|
+
subComponentName
|
|
410
|
+
});
|
|
411
|
+
fullClassName = bumpRootSpecificity ? `.${rootVariantClassName}.${rootVariantClassName}${propertyStateSelector} .${className}` : `.${rootVariantClassName}${propertyStateSelector} .${className}`;
|
|
412
|
+
}
|
|
313
413
|
}
|
|
314
414
|
const { cssProperties, extendedProperties: extendedPropertiesGetter } = require_properties.configurableProperties[originalPropertyDefinition.name];
|
|
315
415
|
const cssDeclarations = {};
|
|
@@ -345,6 +445,28 @@ function generateDeclaration({ componentName, subComponentName, variantKey, vari
|
|
|
345
445
|
*/
|
|
346
446
|
if (componentName === "button" && layer === "root") {
|
|
347
447
|
if (propertyKey === CSS_GAP) cssDeclarations[require_index.BUTTON_GAP_VAR] = cssDeclarations[CSS_GAP];
|
|
448
|
+
if (propertyKey === "spacingVertical") {
|
|
449
|
+
const paddingVertical = cssDeclarations["padding-top"];
|
|
450
|
+
if (paddingVertical) require_getButtonControlHeight.applyButtonControlHeightDeclarations({
|
|
451
|
+
cssDeclarations,
|
|
452
|
+
paddingVertical,
|
|
453
|
+
schema,
|
|
454
|
+
rootLayerKey: require_generateSchemaKey.generateSchemaKey({
|
|
455
|
+
variantKey,
|
|
456
|
+
variantValue,
|
|
457
|
+
layer: "root",
|
|
458
|
+
subComponentName
|
|
459
|
+
}),
|
|
460
|
+
iconLayerKey: require_generateSchemaKey.generateSchemaKey({
|
|
461
|
+
variantKey,
|
|
462
|
+
variantValue,
|
|
463
|
+
layer: "icon",
|
|
464
|
+
subComponentName
|
|
465
|
+
}),
|
|
466
|
+
state: propertyState,
|
|
467
|
+
theme
|
|
468
|
+
});
|
|
469
|
+
}
|
|
348
470
|
if (propertyKey === "scaleEffect" && propertyState === "hover") {
|
|
349
471
|
const rootClassName = `.${className}`;
|
|
350
472
|
const renderValue = (schemaValue) => require_properties.configurableProperties.scaleEffect.customValueRenderer?.(schemaValue, schema, () => "") ?? "1";
|
|
@@ -353,17 +475,39 @@ function generateDeclaration({ componentName, subComponentName, variantKey, vari
|
|
|
353
475
|
if (propertyStateMap.hover) styles[rootClassName][require_index.BUTTON_SCALE_EFFECT_HOVER] = renderValue(propertyStateMap.hover);
|
|
354
476
|
if (propertyStateMap.pressed) styles[rootClassName][require_index.BUTTON_SCALE_EFFECT_PRESSED] = renderValue(propertyStateMap.pressed);
|
|
355
477
|
}
|
|
356
|
-
if (cssDeclarations[CSS_LINE_HEIGHT]) {
|
|
357
|
-
|
|
478
|
+
if (cssDeclarations[CSS_LINE_HEIGHT]) cssDeclarations[CSS_LINE_HEIGHT] = require_getButtonControlHeight.getButtonContentLineHeight({
|
|
479
|
+
schema,
|
|
480
|
+
rootLayerKey: require_generateSchemaKey.generateSchemaKey({
|
|
481
|
+
variantKey,
|
|
482
|
+
variantValue,
|
|
483
|
+
layer: "root",
|
|
484
|
+
subComponentName
|
|
485
|
+
}),
|
|
486
|
+
iconLayerKey: require_generateSchemaKey.generateSchemaKey({
|
|
358
487
|
variantKey,
|
|
359
488
|
variantValue,
|
|
360
489
|
layer: "icon",
|
|
361
490
|
subComponentName
|
|
362
|
-
})
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
491
|
+
}),
|
|
492
|
+
state: propertyState,
|
|
493
|
+
theme
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
if (componentName === "iconbutton" && layer === "root") {
|
|
497
|
+
if (propertyKey === "spacing") {
|
|
498
|
+
const paddingVertical = cssDeclarations[CSS_PADDING];
|
|
499
|
+
if (paddingVertical) require_getButtonControlHeight.applyIconButtonControlHeightDeclarations({
|
|
500
|
+
cssDeclarations,
|
|
501
|
+
paddingVertical,
|
|
502
|
+
iconButtonSchema: schema,
|
|
503
|
+
buttonHeightReferenceSchema,
|
|
504
|
+
variantValue,
|
|
505
|
+
iconLayerKey: require_generateSchemaKey.generateSchemaKey({
|
|
506
|
+
variantKey,
|
|
507
|
+
variantValue,
|
|
508
|
+
layer: "icon",
|
|
509
|
+
subComponentName
|
|
510
|
+
}),
|
|
367
511
|
state: propertyState,
|
|
368
512
|
theme
|
|
369
513
|
});
|
|
@@ -451,7 +595,7 @@ function generateDeclaration({ componentName, subComponentName, variantKey, vari
|
|
|
451
595
|
...styles[fullClassName]
|
|
452
596
|
};
|
|
453
597
|
if (previewOptions?.generatePseudoStateClassModifier) {
|
|
454
|
-
const pseudoPrefixClass =
|
|
598
|
+
const pseudoPrefixClass = require_pseudoStateSelectors.getStateDocsClass(propertyState);
|
|
455
599
|
if (pseudoPrefixClass.length) {
|
|
456
600
|
const importantCssDeclarations = Object.fromEntries(Object.entries(cssDeclarations).map(([prop, value]) => {
|
|
457
601
|
const strValue = String(value).trimEnd().replace(/;$/, "");
|
|
@@ -467,12 +611,139 @@ function generateDeclaration({ componentName, subComponentName, variantKey, vari
|
|
|
467
611
|
}
|
|
468
612
|
return styles;
|
|
469
613
|
}
|
|
470
|
-
|
|
614
|
+
/**
|
|
615
|
+
* Emit CSS for per-state schema entries that target a variant's universal
|
|
616
|
+
* layers — the "override" path. Per-state schema entries can be authored by
|
|
617
|
+
* the Configurator (via `setConfigPseudoStateVariable`) or written by data
|
|
618
|
+
* migrations; they aren't declared in source configs.
|
|
619
|
+
*
|
|
620
|
+
* Iterates the cartesian product of `componentStates.X.options × universal
|
|
621
|
+
* layers × universal properties`. For each combination, calls
|
|
622
|
+
* `generateDeclaration` with the universal property's metadata plus the
|
|
623
|
+
* componentState key/value — the existing schema lookup inside
|
|
624
|
+
* `generateDeclaration` picks up the override slot if one exists and skips
|
|
625
|
+
* the property otherwise.
|
|
626
|
+
*/
|
|
627
|
+
function emitSchemaOverrideStyles({ componentName, subComponentName, variantKey, variantOption, variantConfig, schema, theme, previewOptions, emit, currentStyles }) {
|
|
628
|
+
let styles = currentStyles;
|
|
629
|
+
const universalLayers = variantConfig.layers;
|
|
630
|
+
const componentStates = variantConfig.componentStates;
|
|
631
|
+
if (!universalLayers || !componentStates) return styles;
|
|
632
|
+
const variables = schema.variables;
|
|
633
|
+
if (!variables) return styles;
|
|
634
|
+
for (const componentStateKey in componentStates) {
|
|
635
|
+
const componentState = componentStates[componentStateKey];
|
|
636
|
+
for (const componentStateOption of componentState.options) for (const layerKey in universalLayers) {
|
|
637
|
+
const universalLayer = universalLayers[layerKey];
|
|
638
|
+
const schemaEntry = variables[require_generateSchemaKey.generateSchemaKey({
|
|
639
|
+
variantKey,
|
|
640
|
+
variantValue: variantOption,
|
|
641
|
+
componentStateKey,
|
|
642
|
+
componentStateValue: componentStateOption,
|
|
643
|
+
layer: layerKey,
|
|
644
|
+
subComponentName
|
|
645
|
+
})];
|
|
646
|
+
if (!schemaEntry) continue;
|
|
647
|
+
for (const propertyKey in universalLayer.properties) {
|
|
648
|
+
if (!schemaEntry[propertyKey]) continue;
|
|
649
|
+
const originalPropertyDefinition = universalLayer.properties[propertyKey];
|
|
650
|
+
const fallbackStateMap = variables[require_generateSchemaKey.generateSchemaKey({
|
|
651
|
+
variantKey,
|
|
652
|
+
variantValue: variantOption,
|
|
653
|
+
layer: layerKey,
|
|
654
|
+
subComponentName
|
|
655
|
+
})]?.[propertyKey];
|
|
656
|
+
const declarations = generateDeclaration({
|
|
657
|
+
componentName,
|
|
658
|
+
subComponentName,
|
|
659
|
+
variantKey,
|
|
660
|
+
variantValue: variantOption,
|
|
661
|
+
componentStateKey,
|
|
662
|
+
componentStateValue: componentStateOption,
|
|
663
|
+
layer: layerKey,
|
|
664
|
+
layerOptionalPseudoSelector: universalLayer.pseudoSelector,
|
|
665
|
+
propertyKey,
|
|
666
|
+
originalPropertyDefinition,
|
|
667
|
+
declaredStates: new Set(require_resolvePropertyStates.resolvePropertyStates(universalLayer, originalPropertyDefinition)),
|
|
668
|
+
layerUsesAtomicStates: (universalLayer.atomicStates?.length ?? 0) > 0,
|
|
669
|
+
theme,
|
|
670
|
+
schema,
|
|
671
|
+
currentStyles: styles,
|
|
672
|
+
previewOptions,
|
|
673
|
+
emit,
|
|
674
|
+
fallbackStateMap
|
|
675
|
+
});
|
|
676
|
+
styles = deepMerge(styles, declarations);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
return styles;
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* Emit CSS for a set of layers without a component-state segment in the
|
|
684
|
+
* selector. Used by both `VariantConfigWithProperties` (where layers are the
|
|
685
|
+
* only source of styles) and `VariantConfigWithComponentStates` (where these
|
|
686
|
+
* layers express the variant's universal baseline, with per-state overrides
|
|
687
|
+
* winning via class-compound specificity).
|
|
688
|
+
*/
|
|
689
|
+
function emitUniversalLayers({ componentName, subComponentName, variantKey, variantOption, layers, schema, theme, previewOptions, emit, currentStyles, bumpRootSpecificity, buttonHeightReferenceSchema }) {
|
|
690
|
+
let styles = currentStyles;
|
|
691
|
+
const variables = schema.variables;
|
|
692
|
+
for (const layerKey in layers) {
|
|
693
|
+
const layer = layers[layerKey];
|
|
694
|
+
const schemaKey = require_generateSchemaKey.generateSchemaKey({
|
|
695
|
+
variantKey,
|
|
696
|
+
variantValue: variantOption,
|
|
697
|
+
layer: layerKey,
|
|
698
|
+
subComponentName
|
|
699
|
+
});
|
|
700
|
+
const schemaEntry = variables?.[schemaKey];
|
|
701
|
+
for (const propertyKey in layer.properties) {
|
|
702
|
+
if (!schemaEntry || !schemaEntry[propertyKey]) continue;
|
|
703
|
+
const originalPropertyDefinition = layer.properties[propertyKey];
|
|
704
|
+
const declarations = generateDeclaration({
|
|
705
|
+
componentName,
|
|
706
|
+
subComponentName,
|
|
707
|
+
variantKey,
|
|
708
|
+
variantValue: variantOption,
|
|
709
|
+
layer: layerKey,
|
|
710
|
+
layerOptionalPseudoSelector: layer.pseudoSelector,
|
|
711
|
+
propertyKey,
|
|
712
|
+
originalPropertyDefinition,
|
|
713
|
+
declaredStates: new Set(require_resolvePropertyStates.resolvePropertyStates(layer, originalPropertyDefinition)),
|
|
714
|
+
layerUsesAtomicStates: (layer.atomicStates?.length ?? 0) > 0,
|
|
715
|
+
theme,
|
|
716
|
+
schema,
|
|
717
|
+
currentStyles: styles,
|
|
718
|
+
previewOptions,
|
|
719
|
+
emit,
|
|
720
|
+
bumpRootSpecificity,
|
|
721
|
+
buttonHeightReferenceSchema
|
|
722
|
+
});
|
|
723
|
+
styles = deepMerge(styles, declarations);
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
return styles;
|
|
727
|
+
}
|
|
728
|
+
function generateConfigStyles(config, schema, theme, previewOptions, emit, generateStylesContext) {
|
|
471
729
|
const componentName = config.label.toLowerCase();
|
|
472
730
|
let styles = {};
|
|
473
731
|
for (const variantKey in config.variants) {
|
|
474
732
|
const variantConfig = config.variants[variantKey];
|
|
475
733
|
for (const variantOption of variantConfig.options) if (require_variantConfigGuards.isVariantConfigWithComponentStates(variantConfig)) {
|
|
734
|
+
if (variantConfig.layers) styles = emitUniversalLayers({
|
|
735
|
+
componentName,
|
|
736
|
+
variantKey,
|
|
737
|
+
variantOption,
|
|
738
|
+
layers: variantConfig.layers,
|
|
739
|
+
schema,
|
|
740
|
+
theme,
|
|
741
|
+
previewOptions,
|
|
742
|
+
emit,
|
|
743
|
+
currentStyles: styles,
|
|
744
|
+
bumpRootSpecificity: true,
|
|
745
|
+
buttonHeightReferenceSchema: generateStylesContext?.buttonHeightReferenceSchema
|
|
746
|
+
});
|
|
476
747
|
const componentStates = variantConfig.componentStates;
|
|
477
748
|
for (const componentStateKey in componentStates) {
|
|
478
749
|
const componentState = componentStates[componentStateKey];
|
|
@@ -492,46 +763,64 @@ function generateConfigStyles(config, schema, theme, previewOptions) {
|
|
|
492
763
|
layerOptionalPseudoSelector: layer.pseudoSelector,
|
|
493
764
|
propertyKey,
|
|
494
765
|
originalPropertyDefinition,
|
|
766
|
+
declaredStates: new Set(require_resolvePropertyStates.resolvePropertyStates(layer, originalPropertyDefinition)),
|
|
767
|
+
layerUsesAtomicStates: (layer.atomicStates?.length ?? 0) > 0,
|
|
495
768
|
theme,
|
|
496
769
|
schema,
|
|
497
770
|
currentStyles: styles,
|
|
498
771
|
previewOptions,
|
|
499
|
-
excludedPseudoStates
|
|
772
|
+
excludedPseudoStates,
|
|
773
|
+
emit,
|
|
774
|
+
buttonHeightReferenceSchema: generateStylesContext?.buttonHeightReferenceSchema
|
|
500
775
|
});
|
|
501
776
|
styles = deepMerge(styles, declarations);
|
|
502
777
|
}
|
|
503
778
|
}
|
|
504
779
|
}
|
|
505
780
|
}
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
}
|
|
781
|
+
styles = emitSchemaOverrideStyles({
|
|
782
|
+
componentName,
|
|
783
|
+
variantKey,
|
|
784
|
+
variantOption,
|
|
785
|
+
variantConfig,
|
|
786
|
+
schema,
|
|
787
|
+
theme,
|
|
788
|
+
previewOptions,
|
|
789
|
+
emit,
|
|
790
|
+
currentStyles: styles
|
|
791
|
+
});
|
|
792
|
+
} else if (require_variantConfigGuards.isVariantConfigWithProperties(variantConfig)) styles = emitUniversalLayers({
|
|
793
|
+
componentName,
|
|
794
|
+
variantKey,
|
|
795
|
+
variantOption,
|
|
796
|
+
layers: variantConfig.layers,
|
|
797
|
+
schema,
|
|
798
|
+
theme,
|
|
799
|
+
previewOptions,
|
|
800
|
+
emit,
|
|
801
|
+
currentStyles: styles,
|
|
802
|
+
buttonHeightReferenceSchema: generateStylesContext?.buttonHeightReferenceSchema
|
|
803
|
+
});
|
|
529
804
|
}
|
|
530
805
|
if (config.subComponents) {
|
|
531
806
|
const { subComponents } = config;
|
|
532
807
|
for (const subComponentKey in subComponents) for (const variantKey in subComponents[subComponentKey].variants) {
|
|
533
808
|
const variantConfig = subComponents[subComponentKey].variants[variantKey];
|
|
534
809
|
for (const variantOption of variantConfig.options) if (require_variantConfigGuards.isVariantConfigWithComponentStates(variantConfig)) {
|
|
810
|
+
if (variantConfig.layers) styles = emitUniversalLayers({
|
|
811
|
+
componentName,
|
|
812
|
+
subComponentName: subComponentKey,
|
|
813
|
+
variantKey,
|
|
814
|
+
variantOption,
|
|
815
|
+
layers: variantConfig.layers,
|
|
816
|
+
schema,
|
|
817
|
+
theme,
|
|
818
|
+
previewOptions,
|
|
819
|
+
emit,
|
|
820
|
+
currentStyles: styles,
|
|
821
|
+
bumpRootSpecificity: true,
|
|
822
|
+
buttonHeightReferenceSchema: generateStylesContext?.buttonHeightReferenceSchema
|
|
823
|
+
});
|
|
535
824
|
const componentStates = variantConfig.componentStates;
|
|
536
825
|
for (const componentStateKey in componentStates) {
|
|
537
826
|
const componentState = componentStates[componentStateKey];
|
|
@@ -552,41 +841,46 @@ function generateConfigStyles(config, schema, theme, previewOptions) {
|
|
|
552
841
|
layerOptionalPseudoSelector: layer.pseudoSelector,
|
|
553
842
|
propertyKey,
|
|
554
843
|
originalPropertyDefinition,
|
|
844
|
+
declaredStates: new Set(require_resolvePropertyStates.resolvePropertyStates(layer, originalPropertyDefinition)),
|
|
845
|
+
layerUsesAtomicStates: (layer.atomicStates?.length ?? 0) > 0,
|
|
555
846
|
theme,
|
|
556
847
|
schema,
|
|
557
848
|
currentStyles: styles,
|
|
558
849
|
previewOptions,
|
|
559
|
-
excludedPseudoStates
|
|
850
|
+
excludedPseudoStates,
|
|
851
|
+
emit,
|
|
852
|
+
buttonHeightReferenceSchema: generateStylesContext?.buttonHeightReferenceSchema
|
|
560
853
|
});
|
|
561
854
|
styles = deepMerge(styles, declarations);
|
|
562
855
|
}
|
|
563
856
|
}
|
|
564
857
|
}
|
|
565
858
|
}
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
859
|
+
styles = emitSchemaOverrideStyles({
|
|
860
|
+
componentName,
|
|
861
|
+
subComponentName: subComponentKey,
|
|
862
|
+
variantKey,
|
|
863
|
+
variantOption,
|
|
864
|
+
variantConfig,
|
|
865
|
+
schema,
|
|
866
|
+
theme,
|
|
867
|
+
previewOptions,
|
|
868
|
+
emit,
|
|
869
|
+
currentStyles: styles
|
|
870
|
+
});
|
|
871
|
+
} else if (require_variantConfigGuards.isVariantConfigWithProperties(variantConfig)) styles = emitUniversalLayers({
|
|
872
|
+
componentName,
|
|
873
|
+
subComponentName: subComponentKey,
|
|
874
|
+
variantKey,
|
|
875
|
+
variantOption,
|
|
876
|
+
layers: variantConfig.layers,
|
|
877
|
+
schema,
|
|
878
|
+
theme,
|
|
879
|
+
previewOptions,
|
|
880
|
+
emit,
|
|
881
|
+
currentStyles: styles,
|
|
882
|
+
buttonHeightReferenceSchema: generateStylesContext?.buttonHeightReferenceSchema
|
|
883
|
+
});
|
|
590
884
|
}
|
|
591
885
|
}
|
|
592
886
|
/**
|
|
@@ -619,8 +913,8 @@ function generateConfigStyles(config, schema, theme, previewOptions) {
|
|
|
619
913
|
* @param previewOptions - Options for generating preview mode class modifiers
|
|
620
914
|
* @returns CSS styles object with grouped selectors for default aliases
|
|
621
915
|
*/
|
|
622
|
-
const
|
|
623
|
-
const styles = generateConfigStyles(config, schema, theme, previewOptions);
|
|
916
|
+
const generateStylesInner = (config, schema, theme, previewOptions, generateStylesContext) => {
|
|
917
|
+
const styles = generateConfigStyles(config, schema, theme, previewOptions, previewOptions.emit ?? "exhaustive", generateStylesContext);
|
|
624
918
|
if (!config.variants && !config.subComponents) return styles;
|
|
625
919
|
const componentName = config.label.toLowerCase();
|
|
626
920
|
if (componentName !== "button" && componentName !== "iconbutton") return styles;
|
|
@@ -628,14 +922,15 @@ const generateStyles = (config, schema, theme, previewOptions) => {
|
|
|
628
922
|
/**
|
|
629
923
|
* Helper: Extract all layer keys from a variant configuration
|
|
630
924
|
* Handles both simple variants (with direct layers) and variants with component states
|
|
925
|
+
* (which may additionally declare top-level universal layers).
|
|
631
926
|
*/
|
|
632
927
|
const getLayerKeys = (variantConfig) => {
|
|
633
|
-
if (require_variantConfigGuards.
|
|
634
|
-
else if (require_variantConfigGuards.isVariantConfigWithComponentStates(variantConfig)) {
|
|
928
|
+
if (require_variantConfigGuards.isVariantConfigWithComponentStates(variantConfig)) {
|
|
635
929
|
const layerKeysSet = /* @__PURE__ */ new Set();
|
|
636
|
-
for (const componentStateConfig of Object.values(variantConfig.componentStates)) Object.keys(componentStateConfig.layers).forEach((key) => layerKeysSet.add(key));
|
|
930
|
+
for (const componentStateConfig of Object.values(variantConfig.componentStates)) Object.keys(componentStateConfig.layers ?? {}).forEach((key) => layerKeysSet.add(key));
|
|
931
|
+
if (variantConfig.layers) Object.keys(variantConfig.layers).forEach((key) => layerKeysSet.add(key));
|
|
637
932
|
return Array.from(layerKeysSet);
|
|
638
|
-
}
|
|
933
|
+
} else if (require_variantConfigGuards.isVariantConfigWithProperties(variantConfig)) return Object.keys(variantConfig.layers);
|
|
639
934
|
return [];
|
|
640
935
|
};
|
|
641
936
|
/**
|
|
@@ -685,5 +980,21 @@ const generateStyles = (config, schema, theme, previewOptions) => {
|
|
|
685
980
|
}
|
|
686
981
|
return finalStyles;
|
|
687
982
|
};
|
|
983
|
+
/**
|
|
984
|
+
* Public entry point. Generates a component's CSS, emitting each declared state
|
|
985
|
+
* as its own rule (one selector per rule) so the cascade is carried entirely by
|
|
986
|
+
* per-rule specificity — which CSS minifiers preserve.
|
|
987
|
+
*
|
|
988
|
+
* An earlier optimization merged rules sharing a declaration block into a single
|
|
989
|
+
* comma-separated selector list (to avoid repeating invariant declarations per
|
|
990
|
+
* state). It was removed: a minifier's forgiving-`:is()` rewrite — applied to a
|
|
991
|
+
* comma-separated list that contains `:has()` when targeting browsers without
|
|
992
|
+
* native `:has()` support — collapses the list to its single highest
|
|
993
|
+
* specificity, inflating the weakest selector (`rest`) above genuinely
|
|
994
|
+
* customized states and corrupting the cascade. Separate rules never form such a
|
|
995
|
+
* list, so minifiers leave their specificity intact. (gzip already collapses the
|
|
996
|
+
* repeated declaration blocks, so the shipped-size cost is minimal.)
|
|
997
|
+
*/
|
|
998
|
+
const generateStyles = (config, schema, theme, previewOptions, generateStylesContext) => generateStylesInner(config, schema, theme, previewOptions, generateStylesContext);
|
|
688
999
|
//#endregion
|
|
689
1000
|
exports.generateStyles = generateStyles;
|