@yahoo/uds-create-config 1.1.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 (130) hide show
  1. package/dist/AssetGroup.d.ts +77 -0
  2. package/dist/AssetGroup.js +125 -0
  3. package/dist/Component.d.ts +308 -0
  4. package/dist/Component.js +896 -0
  5. package/dist/ComponentGroup.d.ts +20 -0
  6. package/dist/ComponentGroup.js +46 -0
  7. package/dist/CompositeStyle.d.ts +27 -0
  8. package/dist/CompositeStyle.js +52 -0
  9. package/dist/Config.d.ts +423 -0
  10. package/dist/Config.js +1429 -0
  11. package/dist/Mode.d.ts +41 -0
  12. package/dist/Mode.js +81 -0
  13. package/dist/Modifier.d.ts +51 -0
  14. package/dist/Modifier.js +97 -0
  15. package/dist/MotionDef.d.ts +49 -0
  16. package/dist/MotionDef.js +97 -0
  17. package/dist/Props.d.ts +317 -0
  18. package/dist/Props.js +35 -0
  19. package/dist/Provider.d.ts +20 -0
  20. package/dist/Provider.js +14 -0
  21. package/dist/StyleProp.d.ts +112 -0
  22. package/dist/StyleProp.js +197 -0
  23. package/dist/Token.d.ts +55 -0
  24. package/dist/Token.js +112 -0
  25. package/dist/TokenGroup.d.ts +32 -0
  26. package/dist/TokenGroup.js +68 -0
  27. package/dist/asset-kind.d.ts +55 -0
  28. package/dist/asset-kind.js +29 -0
  29. package/dist/brands.d.ts +30 -0
  30. package/dist/brands.js +20 -0
  31. package/dist/captureCallerPath.d.ts +48 -0
  32. package/dist/captureCallerPath.js +95 -0
  33. package/dist/colorExpressions.d.ts +131 -0
  34. package/dist/colorExpressions.js +148 -0
  35. package/dist/defineAssetGroup.d.ts +166 -0
  36. package/dist/defineAssetGroup.js +264 -0
  37. package/dist/defineProvider.d.ts +29 -0
  38. package/dist/defineProvider.js +60 -0
  39. package/dist/element-marker.d.ts +54 -0
  40. package/dist/element-marker.js +113 -0
  41. package/dist/entity-utils.d.ts +56 -0
  42. package/dist/entity-utils.js +105 -0
  43. package/dist/factories.d.ts +707 -0
  44. package/dist/factories.js +393 -0
  45. package/dist/foreign-component-name.d.ts +21 -0
  46. package/dist/foreign-component-name.js +42 -0
  47. package/dist/index.d.ts +32 -0
  48. package/dist/index.js +28 -0
  49. package/dist/interpolate.d.ts +20 -0
  50. package/dist/interpolate.js +10 -0
  51. package/dist/jsx/__fixtures__/cross-component-preview.d.ts +3 -0
  52. package/dist/jsx/__fixtures__/cross-component-preview.js +15 -0
  53. package/dist/jsx/jsx-dev-runtime.d.ts +15 -0
  54. package/dist/jsx/jsx-dev-runtime.js +11 -0
  55. package/dist/jsx/jsx-runtime.d.ts +48 -0
  56. package/dist/jsx/jsx-runtime.js +305 -0
  57. package/dist/markers.d.ts +217 -0
  58. package/dist/markers.js +67 -0
  59. package/dist/refs.d.ts +158 -0
  60. package/dist/refs.js +104 -0
  61. package/dist/renderer/RendererErrorBoundary.d.ts +26 -0
  62. package/dist/renderer/RendererErrorBoundary.js +30 -0
  63. package/dist/renderer/UdsRenderer.d.ts +80 -0
  64. package/dist/renderer/UdsRenderer.js +33 -0
  65. package/dist/renderer/assetRenderable.d.ts +13 -0
  66. package/dist/renderer/assetRenderable.js +13 -0
  67. package/dist/renderer/index.d.ts +14 -0
  68. package/dist/renderer/index.js +14 -0
  69. package/dist/renderer/makeRegistry.d.ts +34 -0
  70. package/dist/renderer/makeRegistry.js +52 -0
  71. package/dist/renderer/makeUdsRenderer.d.ts +29 -0
  72. package/dist/renderer/makeUdsRenderer.js +35 -0
  73. package/dist/renderer/primitives/FragmentRenderer.d.ts +12 -0
  74. package/dist/renderer/primitives/FragmentRenderer.js +11 -0
  75. package/dist/renderer/primitives/SlotRenderer.d.ts +21 -0
  76. package/dist/renderer/primitives/SlotRenderer.js +20 -0
  77. package/dist/renderer/wrapRegistry.d.ts +64 -0
  78. package/dist/renderer/wrapRegistry.js +39 -0
  79. package/dist/renderer/wrappers/component-slots.d.ts +41 -0
  80. package/dist/renderer/wrappers/component-slots.js +66 -0
  81. package/dist/renderer/wrappers/event-bridge.d.ts +20 -0
  82. package/dist/renderer/wrappers/event-bridge.js +78 -0
  83. package/dist/renderer/wrappers/hex-normalize.d.ts +14 -0
  84. package/dist/renderer/wrappers/hex-normalize.js +35 -0
  85. package/dist/renderer/wrappers/html-aliases.d.ts +24 -0
  86. package/dist/renderer/wrappers/html-aliases.js +62 -0
  87. package/dist/renderer/wrappers/inline-styles.d.ts +16 -0
  88. package/dist/renderer/wrappers/inline-styles.js +104 -0
  89. package/dist/renderer/wrappers/slot-resolution.d.ts +25 -0
  90. package/dist/renderer/wrappers/slot-resolution.js +68 -0
  91. package/dist/renderer/wrappers/void-elements.d.ts +23 -0
  92. package/dist/renderer/wrappers/void-elements.js +28 -0
  93. package/dist/spec/apply-forced-modifiers.d.ts +19 -0
  94. package/dist/spec/apply-forced-modifiers.js +49 -0
  95. package/dist/spec/asset-jsx.d.ts +48 -0
  96. package/dist/spec/asset-jsx.js +48 -0
  97. package/dist/spec/collapse-text-labels.d.ts +44 -0
  98. package/dist/spec/collapse-text-labels.js +107 -0
  99. package/dist/spec/empty-node-slots.d.ts +51 -0
  100. package/dist/spec/empty-node-slots.js +141 -0
  101. package/dist/spec/index.d.ts +10 -0
  102. package/dist/spec/index.js +10 -0
  103. package/dist/spec/jsxToSpec.d.ts +48 -0
  104. package/dist/spec/jsxToSpec.js +506 -0
  105. package/dist/spec/layer-props.d.ts +52 -0
  106. package/dist/spec/layer-props.js +149 -0
  107. package/dist/spec/preview-controls.d.ts +44 -0
  108. package/dist/spec/preview-controls.js +139 -0
  109. package/dist/spec/slot-refs.d.ts +39 -0
  110. package/dist/spec/slot-refs.js +56 -0
  111. package/dist/spec/specToJsx.d.ts +35 -0
  112. package/dist/spec/specToJsx.js +127 -0
  113. package/dist/token-override-rows.d.ts +66 -0
  114. package/dist/token-override-rows.js +223 -0
  115. package/dist/tokenValueType.d.ts +34 -0
  116. package/dist/tokenValueType.js +138 -0
  117. package/dist/tsconfig.tsbuildinfo +1 -0
  118. package/dist/types/css-properties.d.ts +232 -0
  119. package/dist/types/css-properties.js +14 -0
  120. package/dist/types/css-property-keywords.d.ts +156 -0
  121. package/dist/types/css-property-keywords.js +616 -0
  122. package/dist/types/css-values.d.ts +63 -0
  123. package/dist/types/css-values.js +16 -0
  124. package/dist/types.d.ts +708 -0
  125. package/dist/types.js +12 -0
  126. package/dist/units.d.ts +14 -0
  127. package/dist/units.js +16 -0
  128. package/dist/utils/index.d.ts +4 -0
  129. package/dist/utils/index.js +4 -0
  130. package/package.json +81 -0
package/dist/Mode.d.ts ADDED
@@ -0,0 +1,41 @@
1
+ import { ModeDefinition, ModeOptionDefinition, TokenModifierKey } from "./types.js";
2
+
3
+ //#region src/Mode.d.ts
4
+ declare class ModeOption {
5
+ readonly name: string;
6
+ readonly modifier: TokenModifierKey;
7
+ readonly label?: string;
8
+ readonly description?: string;
9
+ readonly css?: string;
10
+ readonly media?: string;
11
+ constructor(args: {
12
+ name: string;
13
+ definition: ModeOptionDefinition;
14
+ });
15
+ /**
16
+ * Human description for when this option surfaces as a style modifier
17
+ * (`_dark`, `_lg`). Distinguishes appearance/theme modes ("in dark mode")
18
+ * from responsive breakpoints ("at the lg breakpoint"), inferred from
19
+ * whether the option activates via `css` or `media`. Prefers the authored
20
+ * `label`, falling back to the option `name`.
21
+ */
22
+ describeAsModifier(): string;
23
+ toJSON(): ModeOptionDefinition & {
24
+ name: string;
25
+ };
26
+ }
27
+ declare class Mode {
28
+ readonly name: string;
29
+ readonly options: ReadonlyMap<string, ModeOption>;
30
+ private _derived?;
31
+ constructor(args: {
32
+ name: string;
33
+ definition: ModeDefinition;
34
+ });
35
+ get derived(): {
36
+ readonly modifierNames: readonly TokenModifierKey[];
37
+ };
38
+ toJSON(): ModeDefinition;
39
+ }
40
+ //#endregion
41
+ export { Mode, ModeOption };
package/dist/Mode.js ADDED
@@ -0,0 +1,81 @@
1
+ import { compact } from "./entity-utils.js";
2
+ //#region src/Mode.ts
3
+ /**
4
+ * `Mode` — a set of mutually-exclusive options each contributing a
5
+ * modifier (`colorMode: { light, dark }` → `_light`, `_dark`).
6
+ *
7
+ * Owns its options and exposes the derived modifier names produced by
8
+ * the option set.
9
+ */
10
+ var ModeOption = class {
11
+ name;
12
+ modifier;
13
+ label;
14
+ description;
15
+ css;
16
+ media;
17
+ constructor(args) {
18
+ this.name = args.name;
19
+ this.modifier = args.definition.modifier ?? `_${args.name}`;
20
+ this.label = args.definition.label;
21
+ this.description = args.definition.description;
22
+ this.css = args.definition.css;
23
+ this.media = args.definition.media;
24
+ }
25
+ /**
26
+ * Human description for when this option surfaces as a style modifier
27
+ * (`_dark`, `_lg`). Distinguishes appearance/theme modes ("in dark mode")
28
+ * from responsive breakpoints ("at the lg breakpoint"), inferred from
29
+ * whether the option activates via `css` or `media`. Prefers the authored
30
+ * `label`, falling back to the option `name`.
31
+ */
32
+ describeAsModifier() {
33
+ const display = this.label ?? this.name;
34
+ if (this.media) return `Conditionally apply styles at the ${display} breakpoint`;
35
+ return `Conditionally apply styles in ${display} mode`;
36
+ }
37
+ toJSON() {
38
+ return {
39
+ name: this.name,
40
+ modifier: this.modifier,
41
+ ...compact({
42
+ label: this.label,
43
+ description: this.description,
44
+ css: this.css,
45
+ media: this.media
46
+ })
47
+ };
48
+ }
49
+ };
50
+ var Mode = class {
51
+ name;
52
+ options;
53
+ _derived;
54
+ constructor(args) {
55
+ this.name = args.name;
56
+ const options = /* @__PURE__ */ new Map();
57
+ for (const [optName, optDef] of Object.entries(args.definition)) options.set(optName, new ModeOption({
58
+ name: optName,
59
+ definition: optDef
60
+ }));
61
+ this.options = options;
62
+ }
63
+ get derived() {
64
+ if (!this._derived) {
65
+ const modifierNames = [];
66
+ for (const option of this.options.values()) modifierNames.push(option.modifier);
67
+ this._derived = { modifierNames };
68
+ }
69
+ return this._derived;
70
+ }
71
+ toJSON() {
72
+ const out = {};
73
+ for (const [name, option] of this.options) {
74
+ const { name: _omit, ...rest } = option.toJSON();
75
+ out[name] = rest;
76
+ }
77
+ return out;
78
+ }
79
+ };
80
+ //#endregion
81
+ export { Mode, ModeOption };
@@ -0,0 +1,51 @@
1
+ import { CompositeRef, ModeRef } from "./refs.js";
2
+ import { ModifierDefinition, TokenModifierKey } from "./types.js";
3
+ import { CssSelector } from "./brands.js";
4
+
5
+ //#region src/Modifier.d.ts
6
+ type CompositeSelectorLookup = (ref: string) => string | undefined;
7
+ type ModeSelectorLookup = (ref: string) => string | undefined;
8
+ declare class Modifier {
9
+ #private;
10
+ readonly name: TokenModifierKey;
11
+ readonly selector?: string | CompositeRef | ModeRef;
12
+ readonly media?: string;
13
+ readonly description?: string;
14
+ /**
15
+ * Tailwind variant prefix a modifier name maps to. Strip the leading
16
+ * underscore, kebab-case the remainder, append `:`. `_focusVisible` →
17
+ * `focus-visible:`, `_hover` → `hover:`. Static so callers that only
18
+ * have the modifier name string (codegen `prepareModifierProps`,
19
+ * className builders) can derive it without spinning up a Modifier.
20
+ *
21
+ * Loader and runtime must agree byte-for-byte on this output — the
22
+ * single source of truth lives here.
23
+ */
24
+ static tailwindPrefix(modifierName: string): string;
25
+ /**
26
+ * Auto-generate a human-readable description from a modifier name —
27
+ * strip the leading `_`, split on camelCase boundaries and digit
28
+ * groups, lowercase. `_onElevation1` → `on elevation 1`. Static so
29
+ * callers with just the name string (and no `Modifier` instance) can
30
+ * reach the same wording; the instance getter
31
+ * `derived.description` uses it as the fallback when the authored
32
+ * `description` is missing.
33
+ */
34
+ static autoDescription(modifierName: string): string;
35
+ constructor(args: {
36
+ name: TokenModifierKey;
37
+ definition: ModifierDefinition;
38
+ compositeLookup: CompositeSelectorLookup;
39
+ modeLookup: ModeSelectorLookup;
40
+ });
41
+ get derived(): {
42
+ readonly cssSelector: CssSelector;
43
+ readonly tailwindPrefix: string;
44
+ readonly description: string;
45
+ };
46
+ toJSON(): ModifierDefinition & {
47
+ name: TokenModifierKey;
48
+ };
49
+ }
50
+ //#endregion
51
+ export { Modifier };
@@ -0,0 +1,97 @@
1
+ import { cssSelector } from "./brands.js";
2
+ import { compact, kebabCase } from "./entity-utils.js";
3
+ import { isCompositeRef, isModeRef } from "./refs.js";
4
+ //#region src/Modifier.ts
5
+ /**
6
+ * `Modifier` — a state or structural variation (`_hover`, `_dark`).
7
+ *
8
+ * Stores the authored `selector` (string, `composite()` marker, or
9
+ * `mode()` marker) and resolves it to a CSS selector on demand via
10
+ * the parent Config's lookup callables.
11
+ *
12
+ * `derived.cssSelector` recomputes on access — the resolved value
13
+ * depends on the Config's composite/mode tables, which can grow after
14
+ * the Modifier is constructed.
15
+ */
16
+ var Modifier = class Modifier {
17
+ name;
18
+ selector;
19
+ media;
20
+ description;
21
+ #compositeLookup;
22
+ #modeLookup;
23
+ #derived;
24
+ /**
25
+ * Tailwind variant prefix a modifier name maps to. Strip the leading
26
+ * underscore, kebab-case the remainder, append `:`. `_focusVisible` →
27
+ * `focus-visible:`, `_hover` → `hover:`. Static so callers that only
28
+ * have the modifier name string (codegen `prepareModifierProps`,
29
+ * className builders) can derive it without spinning up a Modifier.
30
+ *
31
+ * Loader and runtime must agree byte-for-byte on this output — the
32
+ * single source of truth lives here.
33
+ */
34
+ static tailwindPrefix(modifierName) {
35
+ return `${kebabCase(modifierName.slice(1))}:`;
36
+ }
37
+ /**
38
+ * Auto-generate a human-readable description from a modifier name —
39
+ * strip the leading `_`, split on camelCase boundaries and digit
40
+ * groups, lowercase. `_onElevation1` → `on elevation 1`. Static so
41
+ * callers with just the name string (and no `Modifier` instance) can
42
+ * reach the same wording; the instance getter
43
+ * `derived.description` uses it as the fallback when the authored
44
+ * `description` is missing.
45
+ */
46
+ static autoDescription(modifierName) {
47
+ return `Conditionally apply styles ${modifierName.replace(/^_/, "").replace(/([A-Z])/g, " $1").replace(/(\d+)/g, " $1").trim().toLowerCase()}`;
48
+ }
49
+ constructor(args) {
50
+ this.name = args.name;
51
+ this.selector = args.definition.selector;
52
+ this.media = args.definition.media;
53
+ this.description = args.definition.description;
54
+ this.#compositeLookup = args.compositeLookup;
55
+ this.#modeLookup = args.modeLookup;
56
+ }
57
+ get derived() {
58
+ if (!this.#derived) {
59
+ const selector = this.selector;
60
+ const name = this.name;
61
+ const authoredDescription = this.description;
62
+ const compositeLookup = this.#compositeLookup;
63
+ const modeLookup = this.#modeLookup;
64
+ this.#derived = {
65
+ get cssSelector() {
66
+ return cssSelector(resolveSelector(selector, compositeLookup, modeLookup));
67
+ },
68
+ get tailwindPrefix() {
69
+ return Modifier.tailwindPrefix(name);
70
+ },
71
+ get description() {
72
+ return authoredDescription ?? Modifier.autoDescription(name);
73
+ }
74
+ };
75
+ }
76
+ return this.#derived;
77
+ }
78
+ toJSON() {
79
+ return {
80
+ name: this.name,
81
+ ...compact({
82
+ selector: this.selector,
83
+ media: this.media,
84
+ description: this.description
85
+ })
86
+ };
87
+ }
88
+ };
89
+ function resolveSelector(selector, compositeLookup, modeLookup) {
90
+ if (selector === void 0) return "";
91
+ if (typeof selector === "string") return selector;
92
+ if (isCompositeRef(selector)) return compositeLookup(selector.ref) ?? "";
93
+ if (isModeRef(selector)) return modeLookup(selector.ref) ?? "";
94
+ return "";
95
+ }
96
+ //#endregion
97
+ export { Modifier };
@@ -0,0 +1,49 @@
1
+ import { CssMotionDefinition, JsMotionDefinition, MotionKeyframes, MotionStateKeyframe, MotionTransition } from "./types.js";
2
+ import { CssClassName } from "./brands.js";
3
+
4
+ //#region src/MotionDef.d.ts
5
+ declare class CssMotionDef {
6
+ #private;
7
+ readonly runtime: "css";
8
+ readonly name: string;
9
+ readonly keyframes: MotionKeyframes;
10
+ readonly transition?: MotionTransition;
11
+ readonly animationDuration?: string | number;
12
+ readonly animationTimingFunction?: string;
13
+ readonly animationDelay?: string | number;
14
+ readonly animationIterationCount?: string | number;
15
+ readonly animationDirection?: string;
16
+ readonly animationFillMode?: string;
17
+ readonly animationPlayState?: string;
18
+ readonly reducedMotion?: 'none';
19
+ constructor(args: {
20
+ name: string;
21
+ definition: CssMotionDefinition;
22
+ });
23
+ get derived(): {
24
+ readonly cssClassName: CssClassName;
25
+ };
26
+ toJSON(): CssMotionDefinition & {
27
+ name: string;
28
+ };
29
+ }
30
+ declare class JsMotionDef {
31
+ readonly runtime: "js";
32
+ readonly name: string;
33
+ readonly initial?: MotionStateKeyframe;
34
+ readonly animate?: MotionStateKeyframe;
35
+ readonly exit?: MotionStateKeyframe;
36
+ readonly transition?: MotionTransition;
37
+ readonly whileHover?: MotionStateKeyframe;
38
+ readonly whileTap?: MotionStateKeyframe;
39
+ constructor(args: {
40
+ name: string;
41
+ definition: JsMotionDefinition;
42
+ });
43
+ toJSON(): JsMotionDefinition & {
44
+ name: string;
45
+ };
46
+ }
47
+ type MotionDef = CssMotionDef | JsMotionDef;
48
+ //#endregion
49
+ export { CssMotionDef, JsMotionDef, MotionDef };
@@ -0,0 +1,97 @@
1
+ import { cssClassName } from "./brands.js";
2
+ import { compact, kebabCase } from "./entity-utils.js";
3
+ //#region src/MotionDef.ts
4
+ /**
5
+ * `MotionDef` — animation presets, discriminated by `runtime`.
6
+ *
7
+ * `CssMotionDef` carries the CSS keyframes + transition for the CSS
8
+ * runtime and exposes a derived CSS class name. `JsMotionDef` carries
9
+ * raw keyframe state for a JS animation library (motion-one / framer)
10
+ * and has no `.derived` — the consumer reads authored state directly.
11
+ */
12
+ var CssMotionDef = class {
13
+ runtime = "css";
14
+ name;
15
+ keyframes;
16
+ transition;
17
+ animationDuration;
18
+ animationTimingFunction;
19
+ animationDelay;
20
+ animationIterationCount;
21
+ animationDirection;
22
+ animationFillMode;
23
+ animationPlayState;
24
+ reducedMotion;
25
+ #derived;
26
+ constructor(args) {
27
+ const d = args.definition;
28
+ this.name = args.name;
29
+ this.keyframes = d.keyframes;
30
+ this.transition = d.transition;
31
+ this.animationDuration = d.animationDuration;
32
+ this.animationTimingFunction = d.animationTimingFunction;
33
+ this.animationDelay = d.animationDelay;
34
+ this.animationIterationCount = d.animationIterationCount;
35
+ this.animationDirection = d.animationDirection;
36
+ this.animationFillMode = d.animationFillMode;
37
+ this.animationPlayState = d.animationPlayState;
38
+ this.reducedMotion = d.reducedMotion === "none" ? "none" : void 0;
39
+ }
40
+ get derived() {
41
+ if (!this.#derived) this.#derived = { cssClassName: cssClassName(`motion-${kebabCase(this.name)}`) };
42
+ return this.#derived;
43
+ }
44
+ toJSON() {
45
+ return {
46
+ name: this.name,
47
+ runtime: "css",
48
+ keyframes: this.keyframes,
49
+ ...compact({
50
+ transition: this.transition,
51
+ animationDuration: this.animationDuration,
52
+ animationTimingFunction: this.animationTimingFunction,
53
+ animationDelay: this.animationDelay,
54
+ animationIterationCount: this.animationIterationCount,
55
+ animationDirection: this.animationDirection,
56
+ animationFillMode: this.animationFillMode,
57
+ animationPlayState: this.animationPlayState,
58
+ reducedMotion: this.reducedMotion
59
+ })
60
+ };
61
+ }
62
+ };
63
+ var JsMotionDef = class {
64
+ runtime = "js";
65
+ name;
66
+ initial;
67
+ animate;
68
+ exit;
69
+ transition;
70
+ whileHover;
71
+ whileTap;
72
+ constructor(args) {
73
+ this.name = args.name;
74
+ this.initial = args.definition.initial;
75
+ this.animate = args.definition.animate;
76
+ this.exit = args.definition.exit;
77
+ this.transition = args.definition.transition;
78
+ this.whileHover = args.definition.whileHover;
79
+ this.whileTap = args.definition.whileTap;
80
+ }
81
+ toJSON() {
82
+ return {
83
+ name: this.name,
84
+ runtime: "js",
85
+ ...compact({
86
+ initial: this.initial,
87
+ animate: this.animate,
88
+ exit: this.exit,
89
+ transition: this.transition,
90
+ whileHover: this.whileHover,
91
+ whileTap: this.whileTap
92
+ })
93
+ };
94
+ }
95
+ };
96
+ //#endregion
97
+ export { CssMotionDef, JsMotionDef };