@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.
Files changed (180) hide show
  1. package/dist/automated-config/dist/generated/autoVariants.cjs +9 -4
  2. package/dist/automated-config/dist/generated/autoVariants.d.cts +2 -1
  3. package/dist/automated-config/dist/generated/autoVariants.d.ts +2 -1
  4. package/dist/automated-config/dist/generated/autoVariants.js +9 -4
  5. package/dist/automated-config/dist/generated/generatedConfigs.cjs +3078 -3089
  6. package/dist/automated-config/dist/generated/generatedConfigs.d.cts +158 -141
  7. package/dist/automated-config/dist/generated/generatedConfigs.d.ts +158 -141
  8. package/dist/automated-config/dist/generated/generatedConfigs.js +3078 -3089
  9. package/dist/automated-config/dist/generated/universalTokensConfigAuto.cjs +1217 -491
  10. package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.cts +4 -1
  11. package/dist/automated-config/dist/generated/universalTokensConfigAuto.d.ts +4 -1
  12. package/dist/automated-config/dist/generated/universalTokensConfigAuto.js +1217 -491
  13. package/dist/automated-config/dist/properties.cjs +9 -2
  14. package/dist/automated-config/dist/properties.d.cts +23 -0
  15. package/dist/automated-config/dist/properties.d.ts +23 -0
  16. package/dist/automated-config/dist/properties.js +9 -2
  17. package/dist/automated-config/dist/types/ComponentConfig.d.cts +77 -4
  18. package/dist/automated-config/dist/types/ComponentConfig.d.ts +77 -4
  19. package/dist/automated-config/dist/types/ConfigSchema.d.cts +14 -2
  20. package/dist/automated-config/dist/types/ConfigSchema.d.ts +14 -2
  21. package/dist/automated-config/dist/types/StateAxis.cjs +90 -0
  22. package/dist/automated-config/dist/types/StateAxis.d.cts +70 -0
  23. package/dist/automated-config/dist/types/StateAxis.d.ts +70 -0
  24. package/dist/automated-config/dist/types/StateAxis.js +84 -0
  25. package/dist/automated-config/dist/utils/buildConfigSchema.cjs +105 -82
  26. package/dist/automated-config/dist/utils/buildConfigSchema.d.cts +41 -12
  27. package/dist/automated-config/dist/utils/buildConfigSchema.d.ts +41 -12
  28. package/dist/automated-config/dist/utils/buildConfigSchema.js +106 -83
  29. package/dist/automated-config/dist/utils/canonicalizeStateKey.cjs +32 -0
  30. package/dist/automated-config/dist/utils/canonicalizeStateKey.d.cts +48 -0
  31. package/dist/automated-config/dist/utils/canonicalizeStateKey.d.ts +48 -0
  32. package/dist/automated-config/dist/utils/canonicalizeStateKey.js +31 -0
  33. package/dist/automated-config/dist/utils/getButtonControlHeight.cjs +129 -0
  34. package/dist/automated-config/dist/utils/getButtonControlHeight.d.cts +133 -0
  35. package/dist/automated-config/dist/utils/getButtonControlHeight.d.ts +133 -0
  36. package/dist/automated-config/dist/utils/getButtonControlHeight.js +122 -0
  37. package/dist/automated-config/dist/utils/getButtonControlHeightPx.cjs +114 -0
  38. package/dist/automated-config/dist/utils/getButtonControlHeightPx.d.cts +78 -0
  39. package/dist/automated-config/dist/utils/getButtonControlHeightPx.d.ts +78 -0
  40. package/dist/automated-config/dist/utils/getButtonControlHeightPx.js +108 -0
  41. package/dist/automated-config/dist/utils/getConfigComponentVariant.d.cts +8 -0
  42. package/dist/automated-config/dist/utils/getConfigComponentVariant.d.ts +8 -0
  43. package/dist/automated-config/dist/utils/getConfigVariantProperties.d.cts +3 -3
  44. package/dist/automated-config/dist/utils/getConfigVariantProperties.d.ts +3 -3
  45. package/dist/automated-config/dist/utils/getConfigVariantPseudoStates.cjs +12 -5
  46. package/dist/automated-config/dist/utils/getConfigVariantPseudoStates.d.cts +8 -1
  47. package/dist/automated-config/dist/utils/getConfigVariantPseudoStates.d.ts +8 -1
  48. package/dist/automated-config/dist/utils/getConfigVariantPseudoStates.js +12 -5
  49. package/dist/automated-config/dist/utils/iconButtonMatchButtonHeight.cjs +110 -0
  50. package/dist/automated-config/dist/utils/iconButtonMatchButtonHeight.d.cts +19 -0
  51. package/dist/automated-config/dist/utils/iconButtonMatchButtonHeight.d.ts +19 -0
  52. package/dist/automated-config/dist/utils/iconButtonMatchButtonHeight.js +108 -0
  53. package/dist/automated-config/dist/utils/index.cjs +478 -111
  54. package/dist/automated-config/dist/utils/index.d.cts +76 -15
  55. package/dist/automated-config/dist/utils/index.d.ts +76 -15
  56. package/dist/automated-config/dist/utils/index.js +479 -113
  57. package/dist/automated-config/dist/utils/isConfiguratorPropertyVisible.cjs +15 -0
  58. package/dist/automated-config/dist/utils/isConfiguratorPropertyVisible.d.cts +20 -0
  59. package/dist/automated-config/dist/utils/isConfiguratorPropertyVisible.d.ts +20 -0
  60. package/dist/automated-config/dist/utils/isConfiguratorPropertyVisible.js +15 -0
  61. package/dist/automated-config/dist/utils/pseudoStateSelectors.cjs +122 -0
  62. package/dist/automated-config/dist/utils/pseudoStateSelectors.d.cts +80 -0
  63. package/dist/automated-config/dist/utils/pseudoStateSelectors.d.ts +80 -0
  64. package/dist/automated-config/dist/utils/pseudoStateSelectors.js +120 -0
  65. package/dist/automated-config/dist/utils/resolvePropertyStates.cjs +131 -0
  66. package/dist/automated-config/dist/utils/resolvePropertyStates.d.cts +49 -0
  67. package/dist/automated-config/dist/utils/resolvePropertyStates.d.ts +49 -0
  68. package/dist/automated-config/dist/utils/resolvePropertyStates.js +130 -0
  69. package/dist/automated-config/dist/utils/resolveSlotByCascade.cjs +118 -0
  70. package/dist/automated-config/dist/utils/resolveSlotByCascade.d.cts +68 -0
  71. package/dist/automated-config/dist/utils/resolveSlotByCascade.d.ts +68 -0
  72. package/dist/automated-config/dist/utils/resolveSlotByCascade.js +117 -0
  73. package/dist/automated-config/dist/utils/variantConfigGuards.d.cts +13 -0
  74. package/dist/automated-config/dist/utils/variantConfigGuards.d.ts +13 -0
  75. package/dist/components/client/Button.cjs +3 -3
  76. package/dist/components/client/Button.js +3 -3
  77. package/dist/components/client/Input/Input.cjs +42 -6
  78. package/dist/components/client/Input/Input.d.cts +13 -0
  79. package/dist/components/client/Input/Input.d.ts +13 -0
  80. package/dist/components/client/Input/Input.js +42 -6
  81. package/dist/components/client/Menu/Menu.ItemCheckbox.d.cts +1 -1
  82. package/dist/components/client/Menu/Menu.ItemCheckbox.d.ts +1 -1
  83. package/dist/config/dist/index.cjs +224 -553
  84. package/dist/config/dist/index.js +224 -553
  85. package/dist/css/dist/commands/css.cjs +1 -0
  86. package/dist/css/dist/commands/css.helpers.cjs +6 -0
  87. package/dist/css/dist/commands/css.helpers.js +6 -0
  88. package/dist/css/dist/commands/css.js +1 -0
  89. package/dist/css/dist/css/generate.cjs +4 -2
  90. package/dist/css/dist/css/generate.d.cts +28 -0
  91. package/dist/css/dist/css/generate.d.ts +28 -0
  92. package/dist/css/dist/css/generate.helpers.cjs +5 -1
  93. package/dist/css/dist/css/generate.helpers.js +6 -2
  94. package/dist/css/dist/css/generate.js +4 -2
  95. package/dist/css/dist/css/postcss.cjs +81 -0
  96. package/dist/css/dist/css/postcss.helpers.cjs +60 -0
  97. package/dist/css/dist/css/postcss.helpers.js +59 -1
  98. package/dist/css/dist/css/postcss.js +82 -2
  99. package/dist/css/dist/css/runner.cjs +12 -2
  100. package/dist/css/dist/css/runner.js +12 -2
  101. package/dist/css/dist/css/theme.d.cts +6 -0
  102. package/dist/css/dist/css/theme.d.ts +6 -0
  103. package/dist/css/dist/packages/automated-config/dist/properties.cjs +9 -2
  104. package/dist/css/dist/packages/automated-config/dist/properties.js +9 -2
  105. package/dist/css/dist/packages/automated-config/dist/utils/index.d.cts +6 -0
  106. package/dist/css/dist/packages/automated-config/dist/utils/index.d.ts +6 -0
  107. package/dist/css/dist/packages/config/dist/index.cjs +224 -553
  108. package/dist/css/dist/packages/config/dist/index.js +224 -553
  109. package/dist/css/dist/utils/optimizeCSS.cjs +59 -0
  110. package/dist/css/dist/utils/optimizeCSS.js +59 -0
  111. package/dist/css-tokens/dist/index.cjs +2 -0
  112. package/dist/css-tokens/dist/index.d.cts +2 -1
  113. package/dist/css-tokens/dist/index.d.ts +2 -1
  114. package/dist/css-tokens/dist/index.js +2 -1
  115. package/dist/index.cjs +48 -0
  116. package/dist/index.d.cts +15 -4
  117. package/dist/index.d.ts +15 -4
  118. package/dist/index.js +14 -3
  119. package/dist/styles/styler.d.cts +8 -7
  120. package/dist/styles/styler.d.ts +8 -7
  121. package/dist/styles/variants.d.cts +9 -4
  122. package/dist/styles/variants.d.ts +9 -4
  123. package/dist/tailwind-internal/dist/packages/automated-config/dist/generated/generatedConfigs.cjs +3078 -3089
  124. package/dist/tailwind-internal/dist/packages/automated-config/dist/generated/generatedConfigs.js +3078 -3089
  125. package/dist/tailwind-internal/dist/packages/automated-config/dist/properties.cjs +9 -2
  126. package/dist/tailwind-internal/dist/packages/automated-config/dist/properties.js +9 -2
  127. package/dist/tailwind-internal/dist/packages/automated-config/dist/types/StateAxis.cjs +81 -0
  128. package/dist/tailwind-internal/dist/packages/automated-config/dist/types/StateAxis.js +76 -0
  129. package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/canonicalizeStateKey.cjs +33 -0
  130. package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/canonicalizeStateKey.js +32 -0
  131. package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/componentStatePseudoStates.cjs +0 -7
  132. package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/componentStatePseudoStates.js +1 -7
  133. package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/getButtonControlHeight.cjs +126 -0
  134. package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/getButtonControlHeight.js +123 -0
  135. package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/iconButtonMatchButtonHeight.cjs +20 -0
  136. package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/iconButtonMatchButtonHeight.js +20 -0
  137. package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/index.cjs +422 -111
  138. package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/index.d.cts +6 -0
  139. package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/index.d.ts +6 -0
  140. package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/index.js +423 -112
  141. package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/pseudoStateSelectors.cjs +122 -0
  142. package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/pseudoStateSelectors.js +121 -0
  143. package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/resolvePropertyStates.cjs +132 -0
  144. package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/resolvePropertyStates.js +131 -0
  145. package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/resolveSlotByCascade.cjs +95 -0
  146. package/dist/tailwind-internal/dist/packages/automated-config/dist/utils/resolveSlotByCascade.js +95 -0
  147. package/dist/tailwind-internal/dist/packages/config/dist/index.cjs +224 -553
  148. package/dist/tailwind-internal/dist/packages/config/dist/index.js +224 -553
  149. package/dist/tailwind-internal/dist/packages/css-tokens/dist/index.cjs +2 -0
  150. package/dist/tailwind-internal/dist/packages/css-tokens/dist/index.js +2 -1
  151. package/dist/tailwind-internal/dist/plugins/components.cjs +28 -24
  152. package/dist/tailwind-internal/dist/plugins/components.js +28 -24
  153. package/dist/tailwind-internal/dist/utils/composeTailwindPlugins.d.cts +3 -0
  154. package/dist/tailwind-internal/dist/utils/composeTailwindPlugins.d.ts +3 -0
  155. package/dist/tailwind-internal/dist/utils/getShadowStyles.d.cts +2 -2
  156. package/dist/tailwind-internal/dist/utils/getShadowStyles.d.ts +2 -2
  157. package/dist/tokens/automation/index.cjs +47 -0
  158. package/dist/tokens/automation/index.d.cts +13 -2
  159. package/dist/tokens/automation/index.d.ts +13 -2
  160. package/dist/tokens/automation/index.js +13 -2
  161. package/dist/tokens/consts/cssTokens.cjs +1 -0
  162. package/dist/tokens/consts/cssTokens.d.cts +2 -2
  163. package/dist/tokens/consts/cssTokens.d.ts +2 -2
  164. package/dist/tokens/consts/cssTokens.js +2 -2
  165. package/dist/tokens/index.cjs +48 -0
  166. package/dist/tokens/index.d.cts +15 -4
  167. package/dist/tokens/index.d.ts +15 -4
  168. package/dist/tokens/index.js +14 -3
  169. package/dist/tokens/types.d.cts +1 -1
  170. package/dist/tokens/types.d.ts +1 -1
  171. package/dist/uds/generated/componentData.cjs +2177 -2172
  172. package/dist/uds/generated/componentData.js +2177 -2172
  173. package/dist/uds/generated/migrationSchemaVersion.cjs +1 -1
  174. package/dist/uds/generated/migrationSchemaVersion.js +1 -1
  175. package/dist/uds/generated/tailwindPurge.cjs +79 -78
  176. package/dist/uds/generated/tailwindPurge.js +79 -78
  177. package/generated/componentData.json +2718 -2713
  178. package/generated/migrationSchemaVersion.ts +1 -1
  179. package/generated/tailwindPurge.ts +2 -2
  180. package/package.json +1 -1
@@ -0,0 +1,70 @@
1
+
2
+ //#region ../automated-config/dist/types/StateAxis.d.ts
3
+ //#region src/types/StateAxis.d.ts
4
+ /**
5
+ * Atomic-state taxonomy.
6
+ *
7
+ * Every interactive component reacts to a fixed set of "atomic" states, each
8
+ * belonging to one axis:
9
+ *
10
+ * - `interactive` — pointer/keyboard focus signals. At runtime at most one of
11
+ * these is meaningfully "active" at a time on a given element (you can't
12
+ * simultaneously hover and press distinctly enough to style separately, etc.).
13
+ *
14
+ * - `modifier` — semantic flags that can stack independently of each other and
15
+ * of the interactive state. An input can be `invalid` AND `readonly` at the
16
+ * same time, optionally also `hover`ed.
17
+ *
18
+ * Compound states (`'invalid&hover'`, `'invalid&readonly&hover'`, etc.) are
19
+ * built by listing 0..N modifiers followed by 0..1 interactive. The
20
+ * `canonicalizeStateKey` helper enforces this ordering so that, e.g.,
21
+ * `['hover', 'invalid']` and `['invalid', 'hover']` resolve to the same key.
22
+ */
23
+ /**
24
+ * Interactive atomics:
25
+ *
26
+ * - `hover`/`pressed` for pointer interaction.
27
+ * - `focus-within` for containers that wrap a focusable child (e.g. an input
28
+ * wrapper).
29
+ * - `focus-visible` for keyboard-only focus rings on focusable elements.
30
+ */
31
+ declare const INTERACTIVE_ATOMICS: readonly ["hover", "pressed", "focus-within", "focus-visible"];
32
+ declare const MODIFIER_ATOMICS: readonly ["invalid", "readonly", "placeholder-shown", "autofill", "visited"];
33
+ type InteractiveAtomic = (typeof INTERACTIVE_ATOMICS)[number];
34
+ type ModifierAtomic = (typeof MODIFIER_ATOMICS)[number];
35
+ type AtomicState = InteractiveAtomic | ModifierAtomic;
36
+ declare function isInteractiveAtomic(state: string): state is InteractiveAtomic;
37
+ declare function isModifierAtomic(state: string): state is ModifierAtomic;
38
+ declare function isAtomicState(state: string): state is AtomicState;
39
+ /**
40
+ * Maximum number of modifiers that may appear in a single compound state.
41
+ * The resolver enumerates compounds up to `M^MAX_MODIFIERS_PER_COMPOUND × I`
42
+ * (with the interactive slot optional), the docs-class enumeration matches,
43
+ * and the StateBuilder picker prevents users from selecting more than this
44
+ * many modifier checkboxes. Keeping all three in lock-step means there's
45
+ * exactly one compound depth supported end-to-end.
46
+ */
47
+ declare const MAX_MODIFIERS_PER_COMPOUND = 3;
48
+ /**
49
+ * Global emission priority for the atomic taxonomy.
50
+ *
51
+ * Every atom selector contributes a uniform (0,1,0) of specificity (see
52
+ * `pseudoStateSelectors`), so a 2-atom compound at (0,3,0) strictly beats a
53
+ * 1-atom rule at (0,2,0) — cross-rank cascade is encoded in class-count
54
+ * specificity. Within a rank (e.g. two atoms simultaneously matching the
55
+ * same element) source order arbitrates: the resolver sorts a layer's
56
+ * `atomicStates` by index in this array, then emits in that order — meaning
57
+ * **later in the array = emits later = wins when multiple atoms match the
58
+ * same element**.
59
+ *
60
+ * The ordering is weakest → strongest. To bump an atom's priority, move it
61
+ * later in this array. Compound-state emission order is derived from this
62
+ * priority too (subset enumeration follows the modifier ordering here), so
63
+ * compound winners follow the same intuition.
64
+ *
65
+ * Legacy atoms (`focused`, `focused-keyboard`, `disabled`) are not in this
66
+ * list because they aren't part of `AtomicState`; their emission order is
67
+ * whatever a config's per-property `pseudoStates` array specifies.
68
+ */
69
+ //#endregion
70
+ export { type AtomicState, INTERACTIVE_ATOMICS, type InteractiveAtomic, MAX_MODIFIERS_PER_COMPOUND, MODIFIER_ATOMICS, type ModifierAtomic, isAtomicState, isInteractiveAtomic, isModifierAtomic };
@@ -0,0 +1,84 @@
1
+ /*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
2
+ //#region ../automated-config/dist/types/StateAxis.js
3
+ /*! © 2026 Yahoo, Inc. UDS Default Config v0.0.0-development */
4
+ /**
5
+ * Atomic-state taxonomy.
6
+ *
7
+ * Every interactive component reacts to a fixed set of "atomic" states, each
8
+ * belonging to one axis:
9
+ *
10
+ * - `interactive` — pointer/keyboard focus signals. At runtime at most one of
11
+ * these is meaningfully "active" at a time on a given element (you can't
12
+ * simultaneously hover and press distinctly enough to style separately, etc.).
13
+ *
14
+ * - `modifier` — semantic flags that can stack independently of each other and
15
+ * of the interactive state. An input can be `invalid` AND `readonly` at the
16
+ * same time, optionally also `hover`ed.
17
+ *
18
+ * Compound states (`'invalid&hover'`, `'invalid&readonly&hover'`, etc.) are
19
+ * built by listing 0..N modifiers followed by 0..1 interactive. The
20
+ * `canonicalizeStateKey` helper enforces this ordering so that, e.g.,
21
+ * `['hover', 'invalid']` and `['invalid', 'hover']` resolve to the same key.
22
+ */
23
+ /**
24
+ * Interactive atomics:
25
+ *
26
+ * - `hover`/`pressed` for pointer interaction.
27
+ * - `focus-within` for containers that wrap a focusable child (e.g. an input
28
+ * wrapper).
29
+ * - `focus-visible` for keyboard-only focus rings on focusable elements.
30
+ */
31
+ const INTERACTIVE_ATOMICS = [
32
+ "hover",
33
+ "pressed",
34
+ "focus-within",
35
+ "focus-visible"
36
+ ];
37
+ const MODIFIER_ATOMICS = [
38
+ "invalid",
39
+ "readonly",
40
+ "placeholder-shown",
41
+ "autofill",
42
+ "visited"
43
+ ];
44
+ const INTERACTIVE_ATOMIC_SET = new Set(INTERACTIVE_ATOMICS);
45
+ const MODIFIER_ATOMIC_SET = new Set(MODIFIER_ATOMICS);
46
+ function isInteractiveAtomic(state) {
47
+ return INTERACTIVE_ATOMIC_SET.has(state);
48
+ }
49
+ function isModifierAtomic(state) {
50
+ return MODIFIER_ATOMIC_SET.has(state);
51
+ }
52
+ function isAtomicState(state) {
53
+ return isInteractiveAtomic(state) || isModifierAtomic(state);
54
+ }
55
+ /**
56
+ * Maximum number of modifiers that may appear in a single compound state.
57
+ * The resolver enumerates compounds up to `M^MAX_MODIFIERS_PER_COMPOUND × I`
58
+ * (with the interactive slot optional), the docs-class enumeration matches,
59
+ * and the StateBuilder picker prevents users from selecting more than this
60
+ * many modifier checkboxes. Keeping all three in lock-step means there's
61
+ * exactly one compound depth supported end-to-end.
62
+ */
63
+ const MAX_MODIFIERS_PER_COMPOUND = 3;
64
+ const STATE_PRIORITY_INDEX = new Map([
65
+ "visited",
66
+ "placeholder-shown",
67
+ "autofill",
68
+ "focus-within",
69
+ "focus-visible",
70
+ "hover",
71
+ "pressed",
72
+ "invalid",
73
+ "readonly"
74
+ ].map((atom, i) => [atom, i]));
75
+ /**
76
+ * Comparator usable with `Array.prototype.sort`. Atoms not in `STATE_PRIORITY`
77
+ * sort to the front (weakest) — this only triggers for unknown strings; every
78
+ * known `AtomicState` is in the priority array.
79
+ */
80
+ function comparePriority(a, b) {
81
+ return (STATE_PRIORITY_INDEX.get(a) ?? -1) - (STATE_PRIORITY_INDEX.get(b) ?? -1);
82
+ }
83
+ //#endregion
84
+ export { INTERACTIVE_ATOMICS, MAX_MODIFIERS_PER_COMPOUND, MODIFIER_ATOMICS, comparePriority, isAtomicState, isInteractiveAtomic, isModifierAtomic };
@@ -1,10 +1,78 @@
1
1
  /*! © 2026 Yahoo, Inc. UDS v0.0.0-development */
2
2
  const require_componentStatePseudoStates = require("./componentStatePseudoStates.cjs");
3
3
  const require_generateSchemaKey = require("./generateSchemaKey.cjs");
4
+ const require_resolvePropertyStates = require("./resolvePropertyStates.cjs");
4
5
  const require_variantConfigGuards = require("./variantConfigGuards.cjs");
5
6
  const require_util = require("../../../fixtures/src/util.cjs");
6
7
  //#region ../automated-config/dist/utils/buildConfigSchema.js
7
8
  /*! © 2026 Yahoo, Inc. UDS Default Config v0.0.0-development */
9
+ /**
10
+ * Builds the per-state schema entries for one property on one variant option.
11
+ * Each state slot (rest, hover, invalid&hover, ...) gets the property's
12
+ * default value as a starting point so the Configurator UI has something to
13
+ * render before users tweak.
14
+ *
15
+ * Per-state CSS emission depends on the emit mode (`exhaustive` by default,
16
+ * `selective` opt-in) and on the `isEnabled` flag this builder writes:
17
+ * - `rest` always emits in both modes (no flag needed; CSS gen treats rest
18
+ * as enabled).
19
+ * - Under EXHAUSTIVE (the default) on `atomicStates` layers, every declared
20
+ * non-rest state emits a rule regardless of `isEnabled`; its value is
21
+ * cascade-resolved (see `resolveSlotByCascade`), so there are no gaps.
22
+ * `isEnabled` there only selects which value a state resolves to, not
23
+ * whether it emits.
24
+ * - Under SELECTIVE (and legacy `pseudoStates`) emission, non-rest slots
25
+ * emit only when `isEnabled === true`.
26
+ * - `skipRestState` properties have no rest fallback, so every populated
27
+ * state slot must emit; we set `isEnabled: true` on each.
28
+ * - Otherwise, auto-populated non-rest slots ship with no flag — under
29
+ * selective they're off until a designer enables them via the
30
+ * configurator's per-property checkbox (which sets or clears this flag
31
+ * through the setter); under exhaustive they still emit via the cascade.
32
+ */
33
+ function buildPropertyStateMap(layer, property, variantOption, excludedStates = []) {
34
+ const stateMap = {};
35
+ const excluded = new Set(excludedStates);
36
+ const states = require_resolvePropertyStates.resolvePropertyStates(layer, property);
37
+ const fixtureType = findFixtureType(property, variantOption);
38
+ const value = property.defaults[variantOption];
39
+ const skipRestState = property.skipRestState === true;
40
+ const isTextVariant = propertyVariesOnlyAtRest(property);
41
+ for (const state of states) {
42
+ if (excluded.has(state)) continue;
43
+ if (isTextVariant && state !== "rest") continue;
44
+ stateMap[state] = skipRestState ? {
45
+ type: fixtureType,
46
+ valueType: "alias",
47
+ value,
48
+ isEnabled: true
49
+ } : {
50
+ type: fixtureType,
51
+ valueType: "alias",
52
+ value
53
+ };
54
+ }
55
+ return stateMap;
56
+ }
57
+ /**
58
+ * Whether a property's non-rest slots are stored SPARSELY — never pre-populated
59
+ * by the schema builder, only persisted when a designer authors an explicit
60
+ * per-state override (resolved via the cascade otherwise). `textVariant` is the
61
+ * only such property today: its non-rest "Emphasized" overrides are created
62
+ * lazily in the configurator rather than seeded for every state.
63
+ *
64
+ * Consulted by the schema builder ({@link buildPropertyStateMap}) to keep the
65
+ * stored config compact. CSS emission does NOT special-case these properties:
66
+ * exhaustive emission walks every declared state and resolves each through the
67
+ * cascade (`resolveSlotByCascade`), so an authored non-rest override emits a
68
+ * rule that renders while unauthored states resolve back to rest.
69
+ */
70
+ function propertyVariesOnlyAtRest(property) {
71
+ return property.name === "textVariant";
72
+ }
73
+ function isOptionalInDefaultSchema(property) {
74
+ return property.optionalInDefaultSchema === true;
75
+ }
8
76
  /** Resolves the fixture type by finding which value set contains the given value */
9
77
  function findFixtureTypeForValue(property, value) {
10
78
  const index = property.values.findIndex((arr) => arr.includes(value));
@@ -17,13 +85,30 @@ function findFixtureTypeForValue(property, value) {
17
85
  function findFixtureType(property, variantKey) {
18
86
  return findFixtureTypeForValue(property, property.defaults[variantKey]);
19
87
  }
20
- function appendPseudoStateVariables(variableObject, propertyKey, property, variantOption, excludedPseudoStates = []) {
21
- if (!property.pseudoStates) return;
22
- for (const pseudoState of require_componentStatePseudoStates.filterPseudoStatesByExclusion(property.pseudoStates, excludedPseudoStates)) variableObject[propertyKey][pseudoState] = {
23
- type: findFixtureType(property, variantOption),
24
- valueType: "alias",
25
- value: property.defaults[variantOption]
26
- };
88
+ /**
89
+ * Walk a set of layers and emit schema entries keyed by layer (no
90
+ * component-state segment). Shared between `VariantConfigWithProperties` and
91
+ * the optional top-level `layers` field on `VariantConfigWithComponentStates`.
92
+ */
93
+ function emitUniversalLayerSchema(result, layers, variantKey, variantOption, subComponentName) {
94
+ for (const layerKey in layers) {
95
+ const layer = layers[layerKey];
96
+ const schemaKey = require_generateSchemaKey.generateSchemaKey({
97
+ variantKey,
98
+ variantValue: variantOption,
99
+ layer: layerKey,
100
+ subComponentName
101
+ });
102
+ result.variables[schemaKey] = {};
103
+ for (const propertyKey in layer.properties) {
104
+ const property = layer.properties[propertyKey];
105
+ if (isOptionalInDefaultSchema(property)) continue;
106
+ result.variables[schemaKey] = {
107
+ ...result.variables[schemaKey],
108
+ [propertyKey]: buildPropertyStateMap(layer, property, variantOption)
109
+ };
110
+ }
111
+ }
27
112
  }
28
113
  /** Builds component schema from ComponentConfig at runtime */
29
114
  function buildConfigSchema(config) {
@@ -35,6 +120,7 @@ function buildConfigSchema(config) {
35
120
  for (const variantKey in config.variants) {
36
121
  const variantConfig = config.variants[variantKey];
37
122
  for (const variantOption of variantConfig.options) if (require_variantConfigGuards.isVariantConfigWithComponentStates(variantConfig)) {
123
+ if (variantConfig.layers) emitUniversalLayerSchema(result, variantConfig.layers, variantKey, variantOption);
38
124
  const componentStates = variantConfig.componentStates;
39
125
  for (const componentStateKey in componentStates) {
40
126
  const componentState = componentStates[componentStateKey];
@@ -50,16 +136,10 @@ function buildConfigSchema(config) {
50
136
  result.variables[schemaKey] = {};
51
137
  for (const propertyKey in layer.properties) {
52
138
  const property = layer.properties[propertyKey];
53
- const variableObject = { [propertyKey]: {} };
54
- if (property?.skipRestState !== true) variableObject[propertyKey] = { rest: {
55
- type: findFixtureType(property, variantOption),
56
- valueType: "alias",
57
- value: property.defaults[variantOption]
58
- } };
59
- appendPseudoStateVariables(variableObject, propertyKey, property, variantOption, require_componentStatePseudoStates.getExcludedPseudoStatesForComponentStateOption(componentState, componentStateOption));
139
+ if (isOptionalInDefaultSchema(property)) continue;
60
140
  result.variables[schemaKey] = {
61
141
  ...result.variables[schemaKey],
62
- ...variableObject
142
+ [propertyKey]: buildPropertyStateMap(layer, property, variantOption, require_componentStatePseudoStates.getExcludedPseudoStatesForComponentStateOption(componentState, componentStateOption))
63
143
  };
64
144
  }
65
145
  }
@@ -70,43 +150,17 @@ function buildConfigSchema(config) {
70
150
  result.variables[variantSchemaKey] = result.variables[variantSchemaKey] ?? {};
71
151
  for (const propertyKey in variantConfig.variantProperties) {
72
152
  const property = variantConfig.variantProperties[propertyKey];
73
- const variableObject = { [propertyKey]: {} };
74
- if (property?.skipRestState !== true) variableObject[propertyKey] = { rest: {
75
- type: findFixtureType(property, variantOption),
76
- valueType: "alias",
77
- value: property.defaults[variantOption]
78
- } };
79
- appendPseudoStateVariables(variableObject, propertyKey, property, variantOption);
153
+ if (isOptionalInDefaultSchema(property)) continue;
80
154
  result.variables[variantSchemaKey] = {
81
155
  ...result.variables[variantSchemaKey],
82
- ...variableObject
83
- };
84
- }
85
- }
86
- const layers = variantConfig.layers;
87
- for (const layerKey in layers) {
88
- const layer = layers[layerKey];
89
- const schemaKey = require_generateSchemaKey.generateSchemaKey({
90
- variantKey,
91
- variantValue: variantOption,
92
- layer: layerKey
93
- });
94
- result.variables[schemaKey] = {};
95
- for (const propertyKey in layer.properties) {
96
- const property = layer.properties[propertyKey];
97
- const variableObject = { [propertyKey]: {} };
98
- if (property?.skipRestState !== true) variableObject[propertyKey] = { rest: {
99
- type: findFixtureType(property, variantOption),
100
- valueType: "alias",
101
- value: property.defaults[variantOption]
102
- } };
103
- appendPseudoStateVariables(variableObject, propertyKey, property, variantOption);
104
- result.variables[schemaKey] = {
105
- ...result.variables[schemaKey],
106
- ...variableObject
156
+ [propertyKey]: buildPropertyStateMap({
157
+ label: "",
158
+ properties: {}
159
+ }, property, variantOption)
107
160
  };
108
161
  }
109
162
  }
163
+ emitUniversalLayerSchema(result, variantConfig.layers, variantKey, variantOption);
110
164
  }
111
165
  }
112
166
  if (config.subComponents) {
@@ -115,6 +169,7 @@ function buildConfigSchema(config) {
115
169
  const variantConfig = subComponents[subComponentKey].variants[variantKey];
116
170
  result.defaults[variantKey] = variantConfig.default;
117
171
  for (const variantOption of variantConfig.options) if (require_variantConfigGuards.isVariantConfigWithComponentStates(variantConfig)) {
172
+ if (variantConfig.layers) emitUniversalLayerSchema(result, variantConfig.layers, variantKey, variantOption, subComponentKey);
118
173
  const componentStates = variantConfig.componentStates;
119
174
  for (const componentStateKey in componentStates) {
120
175
  const componentState = componentStates[componentStateKey];
@@ -131,47 +186,15 @@ function buildConfigSchema(config) {
131
186
  result.variables[schemaKey] = {};
132
187
  for (const propertyKey in layer.properties) {
133
188
  const property = layer.properties[propertyKey];
134
- const variableObject = { [propertyKey]: {} };
135
- if (property?.skipRestState !== true) variableObject[propertyKey] = { rest: {
136
- type: findFixtureType(property, variantOption),
137
- valueType: "alias",
138
- value: property.defaults[variantOption]
139
- } };
140
- appendPseudoStateVariables(variableObject, propertyKey, property, variantOption, require_componentStatePseudoStates.getExcludedPseudoStatesForComponentStateOption(componentState, componentStateOption));
189
+ if (isOptionalInDefaultSchema(property)) continue;
141
190
  result.variables[schemaKey] = {
142
191
  ...result.variables[schemaKey],
143
- ...variableObject
192
+ [propertyKey]: buildPropertyStateMap(layer, property, variantOption, require_componentStatePseudoStates.getExcludedPseudoStatesForComponentStateOption(componentState, componentStateOption))
144
193
  };
145
194
  }
146
195
  }
147
196
  }
148
- } else if (require_variantConfigGuards.isVariantConfigWithProperties(variantConfig)) {
149
- const layers = variantConfig.layers;
150
- for (const layerKey in layers) {
151
- const layer = layers[layerKey];
152
- const schemaKey = require_generateSchemaKey.generateSchemaKey({
153
- variantKey,
154
- variantValue: variantOption,
155
- layer: layerKey,
156
- subComponentName: subComponentKey
157
- });
158
- result.variables[schemaKey] = {};
159
- for (const propertyKey in layer.properties) {
160
- const property = layer.properties[propertyKey];
161
- const variableObject = { [propertyKey]: {} };
162
- if (property?.skipRestState !== true) variableObject[propertyKey] = { rest: {
163
- type: findFixtureType(property, variantOption),
164
- valueType: "alias",
165
- value: property.defaults[variantOption]
166
- } };
167
- appendPseudoStateVariables(variableObject, propertyKey, property, variantOption);
168
- result.variables[schemaKey] = {
169
- ...result.variables[schemaKey],
170
- ...variableObject
171
- };
172
- }
173
- }
174
- }
197
+ } else if (require_variantConfigGuards.isVariantConfigWithProperties(variantConfig)) emitUniversalLayerSchema(result, variantConfig.layers, variantKey, variantOption, subComponentKey);
175
198
  }
176
199
  }
177
200
  return result;
@@ -1,27 +1,54 @@
1
1
 
2
+ import { AtomicState } from "../types/StateAxis.cjs";
2
3
  import { BannerInnerShadowOption, ElevationAlias, ShadowVariant, ShadowVariantConfig, ShadowVariantWithInvert } from "../../../types/dist/index.cjs";
3
4
  import { ArbitraryFixtures, InferArbitraryType } from "../../../fixtures/dist/index.cjs";
5
+ import { ConfigurablePropertiesName, SelectedConfigurableProperty } from "../properties.cjs";
4
6
  import { AllPossibleProperties, ComponentConfig, ComponentStateConfig, LayerConfig, PossibleStates, VariantConfig, VariantConfigWithComponentStates, VariantConfigWithProperties } from "../types/ComponentConfig.cjs";
5
7
  import { SchemaStateValue } from "../types/ConfigSchema.cjs";
6
- import { ConfigurablePropertiesName, SelectedConfigurableProperty } from "../properties.cjs";
7
8
  import { OmitIndexSignature, SimplifyDeep, UnionToIntersection, WritableDeep } from "type-fest";
8
9
 
9
10
  //#region ../automated-config/dist/utils/buildConfigSchema.d.ts
10
- //#region src/utils/buildConfigSchema.d.ts
11
+ type OptionalInDefaultSchemaPropKeys<Props extends Record<string, SelectedConfigurableProperty<ConfigurablePropertiesName, string>>> = { [K in keyof Props]: Props[K] extends {
12
+ optionalInDefaultSchema: true;
13
+ } ? K : never }[keyof Props];
14
+ type RequiredInDefaultSchemaPropKeys<Props extends Record<string, SelectedConfigurableProperty<ConfigurablePropertiesName, string>>> = { [K in keyof Props]: Props[K] extends {
15
+ optionalInDefaultSchema: true;
16
+ } ? never : K }[keyof Props];
17
+ type InferredLayerPropertyMap<Props extends Record<string, SelectedConfigurableProperty<ConfigurablePropertiesName, string>>, Layer> = { [PropKey in RequiredInDefaultSchemaPropKeys<Props>]: InferredPropertyStates<Props[PropKey], Layer> } & { [PropKey in OptionalInDefaultSchemaPropKeys<Props>]?: InferredPropertyStates<Props[PropKey], Layer> };
11
18
  /** Infers default option values from all component variants */
12
19
  type InferredDefaults<C extends ComponentConfig> = (C['variants'] extends NonNullable<ComponentConfig['variants']> ? { [VarKey in keyof C['variants']]: C['variants'][VarKey]['options'][number] } : {}) & (C['subComponents'] extends NonNullable<ComponentConfig['subComponents']> ? UnionToIntersection<{ [SubCompKey in keyof C['subComponents']]: { [VarKey in keyof C['subComponents'][SubCompKey]['variants']]: C['subComponents'][SubCompKey]['variants'][VarKey]['options'][number] } }[keyof C['subComponents']]> : {});
13
20
  /** Infers type-safe schema value structure for a configurable property */
14
21
  type InferredPropertySchema<Prop extends SelectedConfigurableProperty<ConfigurablePropertiesName, string>> = {
15
22
  type: Prop['typeOfFixture'][number];
16
- valueType: 'alias' | 'custom';
23
+ valueType: 'alias' | 'custom'; /** See SchemaStateValue.isEnabled — opt-in flag for non-rest CSS emission. */
24
+ isEnabled?: boolean;
17
25
  value: Prop['name'] extends 'shadow' ? ShadowVariant | ShadowVariantConfig | ElevationAlias : Prop['name'] extends 'insetShadow' ? ShadowVariantWithInvert | ShadowVariantConfig : Prop['name'] extends 'bannerInnerShadow' ? BannerInnerShadowOption : Prop['values'][number][number] | (Extract<Prop['typeOfFixture'][number], ArbitraryFixtures> extends never ? never : InferArbitraryType<Extract<Prop['typeOfFixture'][number], ArbitraryFixtures>>);
18
26
  };
19
- /** Infers state-to-schema mappings for a property (rest, hover, pressed, focus, etc.) */
20
- type InferredPropertyStates<Prop extends SelectedConfigurableProperty<ConfigurablePropertiesName, string>> = (Prop['skipRestState'] extends true ? {} : {
27
+ /**
28
+ * Infers state-to-schema mappings for a property: rest plus every state the
29
+ * resolver will produce. Sources are additive:
30
+ *
31
+ * - Per-property `pseudoStates` (legacy).
32
+ * - Per-layer `atomicStates` (new). Each declared atom yields a required
33
+ * entry; auto-generated compounds (modifier × interactive, modifier ×
34
+ * modifier × interactive, etc.) yield optional entries because the resolver
35
+ * skips incompatible pairs. Marking compounds optional lets the data —
36
+ * which contains exactly the canonical, non-skipped subset — satisfy the
37
+ * wider type.
38
+ *
39
+ * `textVariant` is special-cased: only `rest` is required. Non-rest slots are
40
+ * optional because the configurator only stores them when the designer
41
+ * explicitly enables a per-state override; otherwise they're absent and the
42
+ * value resolves via the CSS cascade. See `buildPropertyStateMap` for the
43
+ * runtime mirror of this typing.
44
+ */
45
+ type InferredPropertyStates<Prop extends SelectedConfigurableProperty<ConfigurablePropertiesName, string>, Layer = unknown> = (Prop['skipRestState'] extends true ? {} : {
21
46
  rest: InferredPropertySchema<Prop>;
22
- }) & (Prop extends {
47
+ }) & (Layer extends {
48
+ atomicStates: infer AS extends readonly AtomicState[];
49
+ } ? { [K in AS[number]]?: InferredPropertySchema<Prop> } & { [K in `${string}&${string}`]?: InferredPropertySchema<Prop> } : Prop extends {
23
50
  pseudoStates: infer PS extends PossibleStates[];
24
- } ? { [K in PS[number]]: InferredPropertySchema<Prop> } : {});
51
+ } ? Prop['name'] extends 'textVariant' ? { [K in PS[number]]?: InferredPropertySchema<Prop> } : { [K in PS[number]]: InferredPropertySchema<Prop> } : {});
25
52
  type GetExcludedPseudoStatesForOption<StateConfig extends ComponentStateConfig, StateOption extends string> = StateConfig extends {
26
53
  excludePseudoStatesForOptions?: infer Exclusions extends Partial<Record<string, readonly PossibleStates[]>>;
27
54
  } ? StateOption extends keyof Exclusions ? Exclusions[StateOption] : undefined : undefined;
@@ -30,22 +57,24 @@ type InferredPropertyStatesForOption<Prop extends SelectedConfigurableProperty<C
30
57
  rest: InferredPropertySchema<Prop>;
31
58
  }) & (Prop extends {
32
59
  pseudoStates: infer PS extends PossibleStates[];
33
- } ? { [K in Exclude<PS[number], ExcludedPseudoStates extends readonly PossibleStates[] ? ExcludedPseudoStates[number] : never>]: InferredPropertySchema<Prop> } : {});
60
+ } ? Prop['name'] extends 'textVariant' ? { [K in Exclude<PS[number], ExcludedPseudoStates extends readonly PossibleStates[] ? ExcludedPseudoStates[number] : never>]?: InferredPropertySchema<Prop> } : { [K in Exclude<PS[number], ExcludedPseudoStates extends readonly PossibleStates[] ? ExcludedPseudoStates[number] : never>]: InferredPropertySchema<Prop> } : {});
34
61
  /** Infers property-to-states mappings for a layer's properties */
35
62
  type InferredLayerProperties<Layer> = Layer extends LayerConfig ? Layer extends {
36
63
  properties: infer Props extends LayerConfig['properties'];
37
- } ? { [PropKey in keyof Props]: InferredPropertyStates<Props[PropKey]> } : {} : {};
64
+ } ? InferredLayerPropertyMap<Props, Layer> : {} : {};
38
65
  type InferredLayerPropertiesForOption<Layer, ExcludedPseudoStates extends readonly PossibleStates[] | undefined> = Layer extends LayerConfig ? Layer extends {
39
66
  properties: infer Props extends LayerConfig['properties'];
40
- } ? { [PropKey in keyof Props]: InferredPropertyStatesForOption<Props[PropKey], ExcludedPseudoStates> } : {} : {};
67
+ } ? { [PropKey in RequiredInDefaultSchemaPropKeys<Props>]: InferredPropertyStatesForOption<Props[PropKey], ExcludedPseudoStates> } & { [PropKey in OptionalInDefaultSchemaPropKeys<Props>]?: InferredPropertyStatesForOption<Props[PropKey], ExcludedPseudoStates> } : {} : {};
41
68
  /** Generates schema key → properties mappings for a variant's layers or component states */
42
69
  type InferredSchemaMap<VarKey extends string, VarConfig extends VariantConfig, LayersOrStates extends NonNullable<VariantConfigWithComponentStates['componentStates']> | NonNullable<VariantConfigWithProperties['layers']>, Prefix extends string = ''> = LayersOrStates extends NonNullable<VariantConfigWithComponentStates['componentStates']> ? UnionToIntersection<{ [StateKey in keyof OmitIndexSignature<LayersOrStates>]: UnionToIntersection<{ [StateOption in LayersOrStates[StateKey]['options'][number]]: { [LayerKey in keyof OmitIndexSignature<LayersOrStates[StateKey]['layers']> as `${Prefix}${VarKey}/${VarConfig['options'][number]}/${StateKey & string}/${StateOption}/${LayerKey & string}`]: InferredLayerPropertiesForOption<LayersOrStates[StateKey]['layers'][LayerKey], GetExcludedPseudoStatesForOption<LayersOrStates[StateKey], StateOption>> } }[LayersOrStates[StateKey]['options'][number]]> }[keyof OmitIndexSignature<LayersOrStates>]> : { [LayerKey in keyof OmitIndexSignature<LayersOrStates> as `${Prefix}${VarKey}/${VarConfig['options'][number]}/${LayerKey & string}`]: InferredLayerProperties<LayersOrStates[LayerKey]> };
43
- type InferredVariantLevelProperties<Props extends Record<string, SelectedConfigurableProperty<ConfigurablePropertiesName, string>>> = { [PropKey in keyof Props]: InferredPropertyStates<Props[PropKey]> };
70
+ type InferredVariantLevelProperties<Props extends Record<string, SelectedConfigurableProperty<ConfigurablePropertiesName, string>>> = { [PropKey in RequiredInDefaultSchemaPropKeys<Props>]: InferredPropertyStates<Props[PropKey]> } & { [PropKey in OptionalInDefaultSchemaPropKeys<Props>]?: InferredPropertyStates<Props[PropKey]> };
44
71
  type InferredVariantPropertiesMap<VarKey extends string, VarConfig extends VariantConfigWithProperties, Prefix extends string = ''> = VarConfig extends {
45
72
  variantProperties: infer Props extends Record<string, SelectedConfigurableProperty<ConfigurablePropertiesName, string>>;
46
73
  } ? { [Option in VarConfig['options'][number] as `${Prefix}${VarKey}/${Option}`]: InferredVariantLevelProperties<Props> } : {};
47
74
  /** Routes to appropriate schema map generator based on variant configuration type */
48
- type InferredVariablesFilter<VarKey extends string, VarConfig extends VariantConfig, Prefix extends string = ''> = VarConfig extends VariantConfigWithComponentStates ? InferredSchemaMap<VarKey, VarConfig, VarConfig['componentStates'], Prefix> : VarConfig extends VariantConfigWithProperties ? InferredSchemaMap<VarKey, VarConfig, VarConfig['layers'], Prefix> & InferredVariantPropertiesMap<VarKey, VarConfig, Prefix> : {};
75
+ type InferredVariablesFilter<VarKey extends string, VarConfig extends VariantConfig, Prefix extends string = ''> = VarConfig extends VariantConfigWithComponentStates ? InferredSchemaMap<VarKey, VarConfig, VarConfig['componentStates'], Prefix> & (VarConfig extends {
76
+ layers: infer L;
77
+ } ? L extends NonNullable<VariantConfigWithProperties['layers']> ? InferredSchemaMap<VarKey, VarConfig, L, Prefix> : {} : {}) : VarConfig extends VariantConfigWithProperties ? InferredSchemaMap<VarKey, VarConfig, VarConfig['layers'], Prefix> & InferredVariantPropertiesMap<VarKey, VarConfig, Prefix> : {};
49
78
  /** Collects all schema mappings from component variants and subComponents */
50
79
  type InferredVariables<C extends ComponentConfig> = (C['variants'] extends NonNullable<ComponentConfig['variants']> ? UnionToIntersection<{ [VarKey in keyof C['variants']]: InferredVariablesFilter<VarKey & string, C['variants'][VarKey]> }[keyof C['variants']]> : {}) & (C['subComponents'] extends NonNullable<ComponentConfig['subComponents']> ? UnionToIntersection<{ [SubCompKey in keyof C['subComponents']]: UnionToIntersection<{ [VarKey in keyof C['subComponents'][SubCompKey]['variants']]: InferredVariablesFilter<VarKey & string, C['subComponents'][SubCompKey]['variants'][VarKey], `${SubCompKey & string}/`> }[keyof C['subComponents'][SubCompKey]['variants']]> }[keyof C['subComponents']]> : {});
51
80
  /** Component schema with inferred defaults and variable schema mappings */
@@ -1,27 +1,54 @@
1
1
 
2
+ import { AtomicState } from "../types/StateAxis.js";
2
3
  import { BannerInnerShadowOption, ElevationAlias, ShadowVariant, ShadowVariantConfig, ShadowVariantWithInvert } from "../../../types/dist/index.js";
3
4
  import { ArbitraryFixtures, InferArbitraryType } from "../../../fixtures/dist/index.js";
5
+ import { ConfigurablePropertiesName, SelectedConfigurableProperty } from "../properties.js";
4
6
  import { AllPossibleProperties, ComponentConfig, ComponentStateConfig, LayerConfig, PossibleStates, VariantConfig, VariantConfigWithComponentStates, VariantConfigWithProperties } from "../types/ComponentConfig.js";
5
7
  import { SchemaStateValue } from "../types/ConfigSchema.js";
6
- import { ConfigurablePropertiesName, SelectedConfigurableProperty } from "../properties.js";
7
8
  import { OmitIndexSignature, SimplifyDeep, UnionToIntersection, WritableDeep } from "type-fest";
8
9
 
9
10
  //#region ../automated-config/dist/utils/buildConfigSchema.d.ts
10
- //#region src/utils/buildConfigSchema.d.ts
11
+ type OptionalInDefaultSchemaPropKeys<Props extends Record<string, SelectedConfigurableProperty<ConfigurablePropertiesName, string>>> = { [K in keyof Props]: Props[K] extends {
12
+ optionalInDefaultSchema: true;
13
+ } ? K : never }[keyof Props];
14
+ type RequiredInDefaultSchemaPropKeys<Props extends Record<string, SelectedConfigurableProperty<ConfigurablePropertiesName, string>>> = { [K in keyof Props]: Props[K] extends {
15
+ optionalInDefaultSchema: true;
16
+ } ? never : K }[keyof Props];
17
+ type InferredLayerPropertyMap<Props extends Record<string, SelectedConfigurableProperty<ConfigurablePropertiesName, string>>, Layer> = { [PropKey in RequiredInDefaultSchemaPropKeys<Props>]: InferredPropertyStates<Props[PropKey], Layer> } & { [PropKey in OptionalInDefaultSchemaPropKeys<Props>]?: InferredPropertyStates<Props[PropKey], Layer> };
11
18
  /** Infers default option values from all component variants */
12
19
  type InferredDefaults<C extends ComponentConfig> = (C['variants'] extends NonNullable<ComponentConfig['variants']> ? { [VarKey in keyof C['variants']]: C['variants'][VarKey]['options'][number] } : {}) & (C['subComponents'] extends NonNullable<ComponentConfig['subComponents']> ? UnionToIntersection<{ [SubCompKey in keyof C['subComponents']]: { [VarKey in keyof C['subComponents'][SubCompKey]['variants']]: C['subComponents'][SubCompKey]['variants'][VarKey]['options'][number] } }[keyof C['subComponents']]> : {});
13
20
  /** Infers type-safe schema value structure for a configurable property */
14
21
  type InferredPropertySchema<Prop extends SelectedConfigurableProperty<ConfigurablePropertiesName, string>> = {
15
22
  type: Prop['typeOfFixture'][number];
16
- valueType: 'alias' | 'custom';
23
+ valueType: 'alias' | 'custom'; /** See SchemaStateValue.isEnabled — opt-in flag for non-rest CSS emission. */
24
+ isEnabled?: boolean;
17
25
  value: Prop['name'] extends 'shadow' ? ShadowVariant | ShadowVariantConfig | ElevationAlias : Prop['name'] extends 'insetShadow' ? ShadowVariantWithInvert | ShadowVariantConfig : Prop['name'] extends 'bannerInnerShadow' ? BannerInnerShadowOption : Prop['values'][number][number] | (Extract<Prop['typeOfFixture'][number], ArbitraryFixtures> extends never ? never : InferArbitraryType<Extract<Prop['typeOfFixture'][number], ArbitraryFixtures>>);
18
26
  };
19
- /** Infers state-to-schema mappings for a property (rest, hover, pressed, focus, etc.) */
20
- type InferredPropertyStates<Prop extends SelectedConfigurableProperty<ConfigurablePropertiesName, string>> = (Prop['skipRestState'] extends true ? {} : {
27
+ /**
28
+ * Infers state-to-schema mappings for a property: rest plus every state the
29
+ * resolver will produce. Sources are additive:
30
+ *
31
+ * - Per-property `pseudoStates` (legacy).
32
+ * - Per-layer `atomicStates` (new). Each declared atom yields a required
33
+ * entry; auto-generated compounds (modifier × interactive, modifier ×
34
+ * modifier × interactive, etc.) yield optional entries because the resolver
35
+ * skips incompatible pairs. Marking compounds optional lets the data —
36
+ * which contains exactly the canonical, non-skipped subset — satisfy the
37
+ * wider type.
38
+ *
39
+ * `textVariant` is special-cased: only `rest` is required. Non-rest slots are
40
+ * optional because the configurator only stores them when the designer
41
+ * explicitly enables a per-state override; otherwise they're absent and the
42
+ * value resolves via the CSS cascade. See `buildPropertyStateMap` for the
43
+ * runtime mirror of this typing.
44
+ */
45
+ type InferredPropertyStates<Prop extends SelectedConfigurableProperty<ConfigurablePropertiesName, string>, Layer = unknown> = (Prop['skipRestState'] extends true ? {} : {
21
46
  rest: InferredPropertySchema<Prop>;
22
- }) & (Prop extends {
47
+ }) & (Layer extends {
48
+ atomicStates: infer AS extends readonly AtomicState[];
49
+ } ? { [K in AS[number]]?: InferredPropertySchema<Prop> } & { [K in `${string}&${string}`]?: InferredPropertySchema<Prop> } : Prop extends {
23
50
  pseudoStates: infer PS extends PossibleStates[];
24
- } ? { [K in PS[number]]: InferredPropertySchema<Prop> } : {});
51
+ } ? Prop['name'] extends 'textVariant' ? { [K in PS[number]]?: InferredPropertySchema<Prop> } : { [K in PS[number]]: InferredPropertySchema<Prop> } : {});
25
52
  type GetExcludedPseudoStatesForOption<StateConfig extends ComponentStateConfig, StateOption extends string> = StateConfig extends {
26
53
  excludePseudoStatesForOptions?: infer Exclusions extends Partial<Record<string, readonly PossibleStates[]>>;
27
54
  } ? StateOption extends keyof Exclusions ? Exclusions[StateOption] : undefined : undefined;
@@ -30,22 +57,24 @@ type InferredPropertyStatesForOption<Prop extends SelectedConfigurableProperty<C
30
57
  rest: InferredPropertySchema<Prop>;
31
58
  }) & (Prop extends {
32
59
  pseudoStates: infer PS extends PossibleStates[];
33
- } ? { [K in Exclude<PS[number], ExcludedPseudoStates extends readonly PossibleStates[] ? ExcludedPseudoStates[number] : never>]: InferredPropertySchema<Prop> } : {});
60
+ } ? Prop['name'] extends 'textVariant' ? { [K in Exclude<PS[number], ExcludedPseudoStates extends readonly PossibleStates[] ? ExcludedPseudoStates[number] : never>]?: InferredPropertySchema<Prop> } : { [K in Exclude<PS[number], ExcludedPseudoStates extends readonly PossibleStates[] ? ExcludedPseudoStates[number] : never>]: InferredPropertySchema<Prop> } : {});
34
61
  /** Infers property-to-states mappings for a layer's properties */
35
62
  type InferredLayerProperties<Layer> = Layer extends LayerConfig ? Layer extends {
36
63
  properties: infer Props extends LayerConfig['properties'];
37
- } ? { [PropKey in keyof Props]: InferredPropertyStates<Props[PropKey]> } : {} : {};
64
+ } ? InferredLayerPropertyMap<Props, Layer> : {} : {};
38
65
  type InferredLayerPropertiesForOption<Layer, ExcludedPseudoStates extends readonly PossibleStates[] | undefined> = Layer extends LayerConfig ? Layer extends {
39
66
  properties: infer Props extends LayerConfig['properties'];
40
- } ? { [PropKey in keyof Props]: InferredPropertyStatesForOption<Props[PropKey], ExcludedPseudoStates> } : {} : {};
67
+ } ? { [PropKey in RequiredInDefaultSchemaPropKeys<Props>]: InferredPropertyStatesForOption<Props[PropKey], ExcludedPseudoStates> } & { [PropKey in OptionalInDefaultSchemaPropKeys<Props>]?: InferredPropertyStatesForOption<Props[PropKey], ExcludedPseudoStates> } : {} : {};
41
68
  /** Generates schema key → properties mappings for a variant's layers or component states */
42
69
  type InferredSchemaMap<VarKey extends string, VarConfig extends VariantConfig, LayersOrStates extends NonNullable<VariantConfigWithComponentStates['componentStates']> | NonNullable<VariantConfigWithProperties['layers']>, Prefix extends string = ''> = LayersOrStates extends NonNullable<VariantConfigWithComponentStates['componentStates']> ? UnionToIntersection<{ [StateKey in keyof OmitIndexSignature<LayersOrStates>]: UnionToIntersection<{ [StateOption in LayersOrStates[StateKey]['options'][number]]: { [LayerKey in keyof OmitIndexSignature<LayersOrStates[StateKey]['layers']> as `${Prefix}${VarKey}/${VarConfig['options'][number]}/${StateKey & string}/${StateOption}/${LayerKey & string}`]: InferredLayerPropertiesForOption<LayersOrStates[StateKey]['layers'][LayerKey], GetExcludedPseudoStatesForOption<LayersOrStates[StateKey], StateOption>> } }[LayersOrStates[StateKey]['options'][number]]> }[keyof OmitIndexSignature<LayersOrStates>]> : { [LayerKey in keyof OmitIndexSignature<LayersOrStates> as `${Prefix}${VarKey}/${VarConfig['options'][number]}/${LayerKey & string}`]: InferredLayerProperties<LayersOrStates[LayerKey]> };
43
- type InferredVariantLevelProperties<Props extends Record<string, SelectedConfigurableProperty<ConfigurablePropertiesName, string>>> = { [PropKey in keyof Props]: InferredPropertyStates<Props[PropKey]> };
70
+ type InferredVariantLevelProperties<Props extends Record<string, SelectedConfigurableProperty<ConfigurablePropertiesName, string>>> = { [PropKey in RequiredInDefaultSchemaPropKeys<Props>]: InferredPropertyStates<Props[PropKey]> } & { [PropKey in OptionalInDefaultSchemaPropKeys<Props>]?: InferredPropertyStates<Props[PropKey]> };
44
71
  type InferredVariantPropertiesMap<VarKey extends string, VarConfig extends VariantConfigWithProperties, Prefix extends string = ''> = VarConfig extends {
45
72
  variantProperties: infer Props extends Record<string, SelectedConfigurableProperty<ConfigurablePropertiesName, string>>;
46
73
  } ? { [Option in VarConfig['options'][number] as `${Prefix}${VarKey}/${Option}`]: InferredVariantLevelProperties<Props> } : {};
47
74
  /** Routes to appropriate schema map generator based on variant configuration type */
48
- type InferredVariablesFilter<VarKey extends string, VarConfig extends VariantConfig, Prefix extends string = ''> = VarConfig extends VariantConfigWithComponentStates ? InferredSchemaMap<VarKey, VarConfig, VarConfig['componentStates'], Prefix> : VarConfig extends VariantConfigWithProperties ? InferredSchemaMap<VarKey, VarConfig, VarConfig['layers'], Prefix> & InferredVariantPropertiesMap<VarKey, VarConfig, Prefix> : {};
75
+ type InferredVariablesFilter<VarKey extends string, VarConfig extends VariantConfig, Prefix extends string = ''> = VarConfig extends VariantConfigWithComponentStates ? InferredSchemaMap<VarKey, VarConfig, VarConfig['componentStates'], Prefix> & (VarConfig extends {
76
+ layers: infer L;
77
+ } ? L extends NonNullable<VariantConfigWithProperties['layers']> ? InferredSchemaMap<VarKey, VarConfig, L, Prefix> : {} : {}) : VarConfig extends VariantConfigWithProperties ? InferredSchemaMap<VarKey, VarConfig, VarConfig['layers'], Prefix> & InferredVariantPropertiesMap<VarKey, VarConfig, Prefix> : {};
49
78
  /** Collects all schema mappings from component variants and subComponents */
50
79
  type InferredVariables<C extends ComponentConfig> = (C['variants'] extends NonNullable<ComponentConfig['variants']> ? UnionToIntersection<{ [VarKey in keyof C['variants']]: InferredVariablesFilter<VarKey & string, C['variants'][VarKey]> }[keyof C['variants']]> : {}) & (C['subComponents'] extends NonNullable<ComponentConfig['subComponents']> ? UnionToIntersection<{ [SubCompKey in keyof C['subComponents']]: UnionToIntersection<{ [VarKey in keyof C['subComponents'][SubCompKey]['variants']]: InferredVariablesFilter<VarKey & string, C['subComponents'][SubCompKey]['variants'][VarKey], `${SubCompKey & string}/`> }[keyof C['subComponents'][SubCompKey]['variants']]> }[keyof C['subComponents']]> : {});
51
80
  /** Component schema with inferred defaults and variable schema mappings */