@yahoo/uds-create-config 4.10.2 → 4.10.4

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 (103) hide show
  1. package/dist/configs/CanvasConfig.d.ts +165 -77
  2. package/dist/configs/documentation.d.ts +1 -1
  3. package/dist/configs/react-native-system.d.ts +111 -52
  4. package/dist/configs/system.d.ts +121 -87
  5. package/dist/configs/system.js +4 -0
  6. package/dist/entities/documentation/Documentation.d.ts +1 -1
  7. package/dist/entities/native/NativeModifier.d.ts +1 -1
  8. package/dist/entities/native/NativeSettings.d.ts +1 -1
  9. package/dist/entities/native/NativeStyleProperty.d.ts +2 -2
  10. package/dist/entities/native/NativeToken.d.ts +4 -3
  11. package/dist/entities/system/CanvasRole.d.ts +1 -1
  12. package/dist/entities/system/Component.d.ts +23 -13
  13. package/dist/entities/system/Component.js +41 -15
  14. package/dist/entities/system/Composite.d.ts +1 -1
  15. package/dist/entities/system/Device.d.ts +1 -1
  16. package/dist/entities/system/File.d.ts +2 -2
  17. package/dist/entities/system/Font.d.ts +1 -1
  18. package/dist/entities/system/GlobalStyle.d.ts +1 -1
  19. package/dist/entities/system/Guidance.d.ts +1 -1
  20. package/dist/entities/system/GuidanceStyle.d.ts +1 -1
  21. package/dist/entities/system/Icon.d.ts +63 -11
  22. package/dist/entities/system/Icon.js +70 -14
  23. package/dist/entities/system/LinkedSystem.d.ts +1 -1
  24. package/dist/entities/system/Modifier.d.ts +2 -2
  25. package/dist/entities/system/Motion.d.ts +1 -1
  26. package/dist/entities/system/Package.d.ts +1 -1
  27. package/dist/entities/system/Settings.d.ts +1 -1
  28. package/dist/entities/system/StyleProperty.d.ts +12 -19
  29. package/dist/entities/system/StyleProperty.js +7 -10
  30. package/dist/entities/system/Token.d.ts +4 -3
  31. package/dist/entities/system/defineComponent.d.ts +21 -6
  32. package/dist/entities/system/defineComponent.js +7 -12
  33. package/dist/entities/system/glyph-identity.d.ts +7 -0
  34. package/dist/entities/system/glyph-identity.js +153 -0
  35. package/dist/entities/system/icon-domain-invariants.d.ts +11 -0
  36. package/dist/entities/system/icon-domain-invariants.js +178 -0
  37. package/dist/entities/system/icon-library.d.ts +93 -34
  38. package/dist/entities/system/icon-library.js +218 -50
  39. package/dist/entities/system/icon-metadata.d.ts +10 -4
  40. package/dist/entities/system/icon-metadata.js +45 -5
  41. package/dist/entities/system/runtime-modules.js +5 -5
  42. package/dist/entities/system/style-bag.js +14 -2
  43. package/dist/framework/Config.d.ts +1 -1
  44. package/dist/framework/Config.js +34 -5
  45. package/dist/framework/defineConfig.d.ts +6 -3
  46. package/dist/framework/defineEntity.d.ts +54 -15
  47. package/dist/framework/defineEntity.js +56 -2
  48. package/dist/framework/projections.d.ts +40 -2
  49. package/dist/framework/projections.js +99 -5
  50. package/dist/framework/prop-surface.d.ts +6 -5
  51. package/dist/framework/prop-surface.js +12 -14
  52. package/dist/framework/registry.d.ts +17 -1
  53. package/dist/framework/registry.js +2 -1
  54. package/dist/framework/render-spec.d.ts +6 -5
  55. package/dist/framework/render-spec.js +16 -11
  56. package/dist/framework/schema-version.d.ts +1 -1
  57. package/dist/framework/schema-version.js +5 -5
  58. package/dist/framework/signature.js +5 -1
  59. package/dist/framework/utils/group.d.ts +15 -1
  60. package/dist/framework/utils/ref-grammar.d.ts +35 -0
  61. package/dist/framework/utils/ref-grammar.js +76 -0
  62. package/dist/framework/utils/refs.d.ts +13 -45
  63. package/dist/framework/utils/refs.js +31 -94
  64. package/dist/framework/value-domain.js +53 -8
  65. package/dist/index.d.ts +6 -6
  66. package/dist/index.js +5 -5
  67. package/dist/migrations/2.0.0/v1-artifact.d.ts +62 -45
  68. package/dist/migrations/2.0.0/v1-artifact.js +5 -7
  69. package/dist/migrations/20260921044042_icon_library_without_component.d.ts +19 -0
  70. package/dist/migrations/20260921044042_icon_library_without_component.js +86 -0
  71. package/dist/migrations/20260922013625_icon_libraries.d.ts +18 -0
  72. package/dist/migrations/20260922013625_icon_libraries.js +8 -0
  73. package/dist/renderer/UdsRenderer.d.ts +8 -1
  74. package/dist/renderer/UdsRenderer.js +7 -3
  75. package/dist/renderer/glyphEntries.d.ts +32 -0
  76. package/dist/renderer/glyphEntries.js +48 -0
  77. package/dist/renderer/glyphRenderable.d.ts +10 -0
  78. package/dist/renderer/glyphRenderable.js +40 -0
  79. package/dist/renderer/icon-library.d.ts +18 -11
  80. package/dist/renderer/index.d.ts +4 -2
  81. package/dist/renderer/index.js +4 -2
  82. package/dist/renderer/resolveGlyph.d.ts +47 -0
  83. package/dist/renderer/resolveGlyph.js +78 -0
  84. package/dist/renderer/wrapRegistry.d.ts +13 -4
  85. package/dist/renderer/wrapRegistry.js +7 -5
  86. package/dist/renderer/wrappers/component-refs.js +6 -2
  87. package/dist/renderer/wrappers/glyph-props.d.ts +15 -0
  88. package/dist/renderer/wrappers/glyph-props.js +65 -0
  89. package/dist/spec/glyph-jsx.d.ts +41 -0
  90. package/dist/spec/{asset-jsx.js → glyph-jsx.js} +7 -25
  91. package/dist/spec/index.d.ts +2 -2
  92. package/dist/spec/index.js +2 -2
  93. package/dist/spec/jsxToSpec.d.ts +10 -4
  94. package/dist/spec/jsxToSpec.js +21 -4
  95. package/dist/spec/specToJsx.d.ts +20 -9
  96. package/dist/spec/specToJsx.js +77 -16
  97. package/dist/tsconfig.tsbuildinfo +1 -1
  98. package/package.json +2 -2
  99. package/dist/renderer/assetEntries.d.ts +0 -37
  100. package/dist/renderer/assetEntries.js +0 -38
  101. package/dist/renderer/assetRenderable.d.ts +0 -25
  102. package/dist/renderer/assetRenderable.js +0 -19
  103. package/dist/spec/asset-jsx.d.ts +0 -61
@@ -1,4 +1,5 @@
1
- import { ExtendedRef, Ref } from "../../framework/utils/refs.js";
1
+ import { Ref } from "../../framework/utils/ref-grammar.js";
2
+ import { ExtendedRef, Ref as Ref$1 } from "../../framework/utils/refs.js";
2
3
  import { SubEntityClass } from "../../framework/defineSubEntity.js";
3
4
  import { ComputedInput } from "../../framework/registry.js";
4
5
  import { ComponentContractOf, PathOf } from "../../framework/registered.js";
@@ -16,7 +17,7 @@ import { z } from "zod";
16
17
  /** A component-relative reference to one of the enclosing component's own layers — a slot's
17
18
  * `target`. Relative (no component path) because a slot only ever targets a sibling layer, so a
18
19
  * Component rename can't break it; a layer rename cascades through it. */
19
- declare function layerRef(layerKey: string): Ref;
20
+ declare function layerRef(layerKey: string): Ref$1;
20
21
  /**
21
22
  * A component-relative reference to one value of one of the enclosing component's own variant
22
23
  * props — what a style rule conditions on.
@@ -27,7 +28,7 @@ declare function layerRef(layerKey: string): Ref;
27
28
  * re-key themselves. Without the ref the name sits in a plain string, invisible to that rewrite, and
28
29
  * every rule conditioned on the old name silently stops applying.
29
30
  */
30
- declare function valueRef(prop: string, value: string): Ref;
31
+ declare function valueRef(prop: string, value: string): Ref$1;
31
32
  /** The prop names one entry exposes — `null` when the config can't say (an unresolved element). */
32
33
  declare function forwardedNames(config: Config, element: unknown, entry: unknown): string[] | null;
33
34
  /**
@@ -65,7 +66,9 @@ declare const propShape: z.ZodDiscriminatedUnion<[z.ZodObject<{
65
66
  type: z.ZodLiteral<"variant">;
66
67
  value: z.ZodUnion<readonly [z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<{
67
68
  [k: string]: {};
68
- }, string[]>>, z.ZodObject<{
69
+ }, string[]>>, z.ZodArray<z.ZodObject<{
70
+ __ref: z.ZodString;
71
+ }, z.core.$strip>>, z.ZodObject<{
69
72
  __ref: z.ZodString;
70
73
  }, z.core.$strip>, SubEntityClass<z.ZodObject<{
71
74
  label: z.ZodOptional<z.ZodString>;
@@ -440,7 +443,7 @@ declare const componentFields: z.ZodObject<{
440
443
  layers: SubEntityClass<z.ZodUnion<readonly [z.ZodString, z.ZodLazy<z.ZodType<Ref, unknown, z.core.$ZodTypeInternals<Ref, unknown>>>, EntityClass<z.ZodObject<{
441
444
  version: z.ZodOptional<z.ZodString>;
442
445
  exports: z.ZodOptional<SubEntityClass<z.ZodObject<{}, z.core.$strict>>>;
443
- }, z.core.$strict>, z.ZodObject<Record<never, never>, z.core.$strip>, "package", Record<never, never>, Record<never, never>, false>]>>;
446
+ }, z.core.$strict>, z.ZodObject<Record<never, never>, z.core.$strip>, "package", Record<never, never>, Record<never, never>, false, Record<never, never>, Record<never, never>>]>>;
444
447
  props: z.ZodOptional<SubEntityClass<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
445
448
  type: z.ZodLiteral<"slot">;
446
449
  text: z.ZodOptional<z.ZodBoolean>;
@@ -459,7 +462,9 @@ declare const componentFields: z.ZodObject<{
459
462
  type: z.ZodLiteral<"variant">;
460
463
  value: z.ZodUnion<readonly [z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<{
461
464
  [k: string]: {};
462
- }, string[]>>, z.ZodObject<{
465
+ }, string[]>>, z.ZodArray<z.ZodObject<{
466
+ __ref: z.ZodString;
467
+ }, z.core.$strip>>, z.ZodObject<{
463
468
  __ref: z.ZodString;
464
469
  }, z.core.$strip>, SubEntityClass<z.ZodObject<{
465
470
  label: z.ZodOptional<z.ZodString>;
@@ -626,7 +631,7 @@ declare const ComponentEntity: EntityClass<z.ZodObject<{
626
631
  layers: SubEntityClass<z.ZodUnion<readonly [z.ZodString, z.ZodLazy<z.ZodType<Ref, unknown, z.core.$ZodTypeInternals<Ref, unknown>>>, EntityClass<z.ZodObject<{
627
632
  version: z.ZodOptional<z.ZodString>;
628
633
  exports: z.ZodOptional<SubEntityClass<z.ZodObject<{}, z.core.$strict>>>;
629
- }, z.core.$strict>, z.ZodObject<Record<never, never>, z.core.$strip>, "package", Record<never, never>, Record<never, never>, false>]>>;
634
+ }, z.core.$strict>, z.ZodObject<Record<never, never>, z.core.$strip>, "package", Record<never, never>, Record<never, never>, false, Record<never, never>, Record<never, never>>]>>;
630
635
  props: z.ZodOptional<SubEntityClass<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
631
636
  type: z.ZodLiteral<"slot">;
632
637
  text: z.ZodOptional<z.ZodBoolean>;
@@ -645,7 +650,9 @@ declare const ComponentEntity: EntityClass<z.ZodObject<{
645
650
  type: z.ZodLiteral<"variant">;
646
651
  value: z.ZodUnion<readonly [z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<{
647
652
  [k: string]: {};
648
- }, string[]>>, z.ZodObject<{
653
+ }, string[]>>, z.ZodArray<z.ZodObject<{
654
+ __ref: z.ZodString;
655
+ }, z.core.$strip>>, z.ZodObject<{
649
656
  __ref: z.ZodString;
650
657
  }, z.core.$strip>, SubEntityClass<z.ZodObject<{
651
658
  label: z.ZodOptional<z.ZodString>;
@@ -796,7 +803,7 @@ declare const ComponentEntity: EntityClass<z.ZodObject<{
796
803
  layers: SubEntityClass<z.ZodUnion<readonly [z.ZodString, z.ZodLazy<z.ZodType<Ref, unknown, z.core.$ZodTypeInternals<Ref, unknown>>>, EntityClass<z.ZodObject<{
797
804
  version: z.ZodOptional<z.ZodString>;
798
805
  exports: z.ZodOptional<SubEntityClass<z.ZodObject<{}, z.core.$strict>>>;
799
- }, z.core.$strict>, z.ZodObject<Record<never, never>, z.core.$strip>, "package", Record<never, never>, Record<never, never>, false>]>>;
806
+ }, z.core.$strict>, z.ZodObject<Record<never, never>, z.core.$strip>, "package", Record<never, never>, Record<never, never>, false, Record<never, never>, Record<never, never>>]>>;
800
807
  props: z.ZodOptional<SubEntityClass<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
801
808
  type: z.ZodLiteral<"slot">;
802
809
  text: z.ZodOptional<z.ZodBoolean>;
@@ -815,7 +822,9 @@ declare const ComponentEntity: EntityClass<z.ZodObject<{
815
822
  type: z.ZodLiteral<"variant">;
816
823
  value: z.ZodUnion<readonly [z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<{
817
824
  [k: string]: {};
818
- }, string[]>>, z.ZodObject<{
825
+ }, string[]>>, z.ZodArray<z.ZodObject<{
826
+ __ref: z.ZodString;
827
+ }, z.core.$strip>>, z.ZodObject<{
819
828
  __ref: z.ZodString;
820
829
  }, z.core.$strip>, SubEntityClass<z.ZodObject<{
821
830
  label: z.ZodOptional<z.ZodString>;
@@ -1717,7 +1726,7 @@ declare const ComponentEntity: EntityClass<z.ZodObject<{
1717
1726
  path,
1718
1727
  member
1719
1728
  }: ComputedInput) => string[];
1720
- }, false>;
1729
+ }, false, Record<never, never>, Record<never, never>>;
1721
1730
  type ComponentRefDelta = Parameters<ReturnType<(typeof ComponentEntity)['ref']>['extend']>[0];
1722
1731
  type ExactComponentDelta<Delta> = Delta & { [Key in Exclude<keyof Delta, keyof ComponentRefDelta>]: never };
1723
1732
  type ContractLayers<Contract> = Contract extends {
@@ -1766,7 +1775,8 @@ type ExtendedComponentRef<Contract = ComponentContractOf<string>, Delta extends
1766
1775
  */
1767
1776
  styles(rules: readonly StyleRuleInput<ResolvedLayers<Contract, Delta>>[]): ExtendedComponentRef<Contract, Delta, Extra>;
1768
1777
  };
1769
- type ComponentReference<Contract = ComponentContractOf<string>> = Ref & {
1778
+ type ComponentReference<Contract = ComponentContractOf<string>, Path extends string = string> = Ref$1 & {
1779
+ /** The path as a literal, the way every entity's `ref` types its marker. */readonly __ref: `component:${Path}`;
1770
1780
  extend<const Delta extends ComponentRefDelta>(delta: ExactComponentDelta<Delta>): ExtendedComponentRef<Contract, Delta>;
1771
1781
  };
1772
1782
  /**
@@ -1776,7 +1786,7 @@ type ComponentReference<Contract = ComponentContractOf<string>> = Ref & {
1776
1786
  * Only its ref authoring result knows about the source-only `.render()` step.
1777
1787
  */
1778
1788
  declare const Component: Omit<typeof ComponentEntity, "ref"> & {
1779
- ref<const Path extends PathOf<"component">>(path: Path): ComponentReference<ComponentContractOf<Path>>;
1789
+ ref<const Path extends PathOf<"component">>(path: Path): ComponentReference<ComponentContractOf<Path>, Path>;
1780
1790
  slots: typeof listSlots;
1781
1791
  slot: typeof slotOf;
1782
1792
  slotHostedBy: typeof slotHostedBy;
@@ -8,9 +8,10 @@ import { derivedColor, gradient } from "./color.js";
8
8
  import { childrenPolicy } from "./element.js";
9
9
  import { listedIn } from "../../framework/utils/enumerated.js";
10
10
  import { valueSchemaOf } from "../../framework/value-domain.js";
11
+ import { glyphLeafOf } from "./glyph-identity.js";
11
12
  import { Style, addBagKeyIssues, anatomyPropValue, bagNameEdges, bagRewriteName, bindBagTokens, collectBag, isPlainRecord, openBag, styleValue } from "./style-bag.js";
12
13
  import { storedPreview } from "../../framework/preview-store.js";
13
- import { propValueDomain, resolveComponentProps, stylePropValueLeaves, validateComponentProps } from "../../framework/projections.js";
14
+ import { glyphPropsOf, propValueDomain, refListOf, resolveComponentProps, stylePropValueLeaves, validateComponentProps } from "../../framework/projections.js";
14
15
  import { intoName, routedPropIn, routesContent } from "../../framework/prop-surface.js";
15
16
  import { slotAnatomyPropOf, slotTargetsOf, withoutTruthyTerm } from "../../framework/render-spec.js";
16
17
  import { listSlots, namedSlots, slotHostedBy, slotOf } from "../../spec/slot.js";
@@ -18,6 +19,7 @@ import { cellAt } from "../../spec/cell.js";
18
19
  import { instanceAt } from "../../spec/instance.js";
19
20
  import { Package } from "./Package.js";
20
21
  import { File } from "./File.js";
22
+ import { iconDomainInvariants } from "./icon-domain-invariants.js";
21
23
  import { z } from "zod";
22
24
  //#region src/entities/system/Component.ts
23
25
  /**
@@ -311,16 +313,21 @@ const VariantValue = defineSubEntity({
311
313
  orphans: ["styles", "preview"]
312
314
  });
313
315
  /**
314
- * A variant's domain: the values it owns, or a ref that delegates to whatever owns them.
316
+ * A variant's domain: the values it owns, a ref that delegates to whatever owns them, or a list of
317
+ * refs whose leaves are unioned (an icon prop drawing from two libraries through one component).
315
318
  *
316
- * The array form is what an author writes (`['solid', 'ghost']`) and is coerced here into the
317
- * collection it is stored as, so every reader below this line sees one shape. In the schema rather
318
- * than in the authoring adapter because there are four doors into stored state — `register`, an
319
- * item create/update, a sub-op, and the artifact loader — and a coercion outside the schema only
319
+ * The string-array form is what an author writes (`['solid', 'ghost']`) and is coerced here into
320
+ * the collection it is stored as, so every reader below this line sees one shape. In the schema
321
+ * rather than in the authoring adapter because there are four doors into stored state — `register`,
322
+ * an item create/update, a sub-op, and the artifact loader — and a coercion outside the schema only
320
323
  * covers the one it is written in.
324
+ *
325
+ * The two list arms are disjoint: a string fails `refSchema` and a ref fails `z.string()`. Only the
326
+ * empty list could land on either, and it lands on the string list, which coerces it to `{}`.
321
327
  */
322
328
  const variantDomain = z.union([
323
329
  z.array(z.string()).transform((names) => Object.fromEntries(names.map((name) => [name, {}]))),
330
+ z.array(refSchema).min(1),
324
331
  refSchema,
325
332
  VariantValue
326
333
  ]);
@@ -526,9 +533,13 @@ function canonicalWhen(when) {
526
533
  * the leaf case rather than drop those forms, or the same rule validates or not depending on whether
527
534
  * the layer's element happens to resolve — which is a property of the config, not of the rule.
528
535
  */
529
- function styleBagValue(config, declaration, name = "<prop>") {
536
+ function styleBagValue({ config, declaration, name = "<prop>", glyphLibraries }) {
530
537
  const domain = valueSchemaOf(declaration, config);
531
538
  const bound = declaration?.value;
539
+ if (glyphLibraries && glyphLibraries.length > 0) return z.union([glyphLeafOf({
540
+ config,
541
+ libraries: glyphLibraries
542
+ }), domain]);
532
543
  if (declaration?.type === "slot") return z.union([domain, z.never()], { error: () => `\`${name}\` is a slot, so a rule may set it to a string of content and nothing else. A glyph or a nested element is an anatomy node under the layer's node — \`{ "element": { "__ref": "icon:<library>/<Name>" }, "visible": { "$state": "<prop>", "eq": "<value>" } }\` to show one per variant value — and the instance's own content arrives through the prop.` });
533
544
  if (!isRef(bound) || kindOf(bound.__ref) !== "style-property") return domain;
534
545
  const property = pathOf(bound.__ref);
@@ -583,11 +594,21 @@ function bagFor(config, layerElement) {
583
594
  function buildBagFor(config, layerElement) {
584
595
  const shape = { ...stylePropShape(config) };
585
596
  const component = isRef(layerElement) && config.resolveRef(layerElement.__ref) ? pathOf(layerElement.__ref) : void 0;
586
- for (const [name, decl] of Object.entries(component ? resolveComponentProps(config, component) : {})) shape[name] = styleBagValue(config, decl, name).optional();
597
+ const glyphProps = component ? glyphPropsOf(config, component) : {};
598
+ for (const [name, decl] of Object.entries(component ? resolveComponentProps(config, component) : {})) shape[name] = styleBagValue({
599
+ config,
600
+ declaration: decl,
601
+ name,
602
+ glyphLibraries: decl?.type === "forward" ? glyphProps[name] : void 0
603
+ }).optional();
587
604
  const declared = component ? (config.resolve("component", component)?.toJSON())?.props ?? {} : {};
588
605
  for (const [name, decl] of Object.entries(declared)) {
589
606
  if (decl?.type !== "slot" || name in shape) continue;
590
- shape[name] = styleBagValue(config, decl, name).optional();
607
+ shape[name] = styleBagValue({
608
+ config,
609
+ declaration: decl,
610
+ name
611
+ }).optional();
591
612
  }
592
613
  shape.as ??= z.string().optional();
593
614
  let bag;
@@ -619,10 +640,14 @@ function stylePropShape(config) {
619
640
  const cached = stylePropShapes.get(config);
620
641
  if (cached) return cached;
621
642
  const shape = {};
622
- for (const prop of config.list("style-property")) shape[prop.path] = styleBagValue(config, {
623
- type: "styleProperty",
624
- value: { __ref: `style-property:${prop.path}` }
625
- }, prop.path).optional();
643
+ for (const prop of config.list("style-property")) shape[prop.path] = styleBagValue({
644
+ config,
645
+ declaration: {
646
+ type: "styleProperty",
647
+ value: { __ref: `style-property:${prop.path}` }
648
+ },
649
+ name: prop.path
650
+ }).optional();
626
651
  stylePropShapes.set(config, shape);
627
652
  return shape;
628
653
  }
@@ -637,7 +662,7 @@ function stylePropShape(config) {
637
662
  function ownsItsValues(declaration) {
638
663
  const decl = declaration;
639
664
  if (decl?.type !== "variant") return false;
640
- return decl.value !== void 0 && !isRef(decl.value);
665
+ return decl.value !== void 0 && !isRef(decl.value) && refListOf(decl.value) === void 0;
641
666
  }
642
667
  /** The values a variant prop declares, in order — empty for one that delegates its domain. */
643
668
  function ownValues(declaration) {
@@ -2027,7 +2052,8 @@ subtree: z.boolean().default(true) }).optional()
2027
2052
  }),
2028
2053
  handler: (input, config) => validateComponentProps(config, String(input.path), input.data.props ?? {})
2029
2054
  }
2030
- }
2055
+ },
2056
+ invariants: (config) => iconDomainInvariants(config)
2031
2057
  });
2032
2058
  const baseComponentRef = ComponentEntity.ref.bind(ComponentEntity);
2033
2059
  /** Component refs add the source-only authoring steps to the generic ref-extension value. All of them
@@ -7,6 +7,6 @@ import { z } from "zod";
7
7
  /** A composite variant (`overlays/elevation/1`) — the style-prop bag it applies. */
8
8
  declare const Composite: EntityClass<z.ZodObject<{
9
9
  styles: SubEntityClass<z.ZodType<StyleValue, unknown, z.core.$ZodTypeInternals<StyleValue, unknown>>>;
10
- }, z.core.$strip>, z.ZodObject<Record<never, never>, z.core.$strip>, "composite", Record<never, never>, Record<never, never>, false>;
10
+ }, z.core.$strip>, z.ZodObject<Record<never, never>, z.core.$strip>, "composite", Record<never, never>, Record<never, never>, false, Record<never, never>, Record<never, never>>;
11
11
  //#endregion
12
12
  export { Composite };
@@ -6,6 +6,6 @@ declare const Device: EntityClass<z.ZodObject<{
6
6
  width: z.ZodNumber;
7
7
  height: z.ZodNumber;
8
8
  name: z.ZodOptional<z.ZodString>;
9
- }, z.core.$strip>, z.ZodObject<Record<never, never>, z.core.$strip>, "device", Record<never, never>, Record<never, never>, false>;
9
+ }, z.core.$strip>, z.ZodObject<Record<never, never>, z.core.$strip>, "device", Record<never, never>, Record<never, never>, false, Record<never, never>, Record<never, never>>;
10
10
  //#endregion
11
11
  export { Device };
@@ -1,4 +1,4 @@
1
- import { Ref } from "../../framework/utils/refs.js";
1
+ import { Ref } from "../../framework/utils/ref-grammar.js";
2
2
  import { SubEntityClass } from "../../framework/defineSubEntity.js";
3
3
  import { ComputedInput } from "../../framework/registry.js";
4
4
  import { EntityClass } from "../../framework/defineEntity.js";
@@ -68,6 +68,6 @@ declare const File: EntityClass<z.ZodObject<{
68
68
  readonly binary: ({
69
69
  path
70
70
  }: ComputedInput) => boolean;
71
- }, false>;
71
+ }, false, Record<never, never>, Record<never, never>>;
72
72
  //#endregion
73
73
  export { File, SCRIPT_EXTENSIONS, isBinaryAsset };
@@ -44,7 +44,7 @@ declare const Font: EntityClass<z.ZodObject<{
44
44
  isVariableFont: z.ZodOptional<z.ZodBoolean>;
45
45
  }, z.core.$strict>, z.ZodObject<{
46
46
  version: z.ZodOptional<z.ZodString>;
47
- }, z.core.$strict>, "font", Record<never, never>, Record<never, never>, false>;
47
+ }, z.core.$strict>, "font", Record<never, never>, Record<never, never>, false, Record<never, never>, Record<never, never>>;
48
48
  /**
49
49
  * The `font-family` value a family stands for: its own name, quoted, then its fallback stack as
50
50
  * authored — `"YA Sans VF", Helvetica Neue, Arial, sans-serif`.
@@ -12,7 +12,7 @@ type Declared = string | number | {
12
12
  declare const GlobalStyle: EntityClass<z.ZodObject<{
13
13
  selector: z.ZodString;
14
14
  declarations: z.ZodRecord<z.ZodString, z.ZodType<Declared, unknown, z.core.$ZodTypeInternals<Declared, unknown>>>;
15
- }, z.core.$strict>, z.ZodObject<Record<never, never>, z.core.$strip>, "global-style", Record<never, never>, Record<never, never>, false>;
15
+ }, z.core.$strict>, z.ZodObject<Record<never, never>, z.core.$strip>, "global-style", Record<never, never>, Record<never, never>, false, Record<never, never>, Record<never, never>>;
16
16
  /**
17
17
  * A stable name for a rule, from its selector — `@keyframes bounce` → `bounce`, `.prompt-editor p`
18
18
  * → `promptEditorP`. Suffixed on collision, so two selectors that slug alike both land.
@@ -54,7 +54,7 @@ declare const Guidance: EntityClass<z.ZodObject<{
54
54
  "paint-style": "paint-style";
55
55
  "figma-import": "figma-import";
56
56
  }>>>;
57
- }, z.core.$strict>, "guidance", Record<never, never>, Record<never, never>, false>;
57
+ }, z.core.$strict>, "guidance", Record<never, never>, Record<never, never>, false, Record<never, never>, Record<never, never>>;
58
58
  /**
59
59
  * A topic's effective reach, and which topic decided it. `appliesTo === undefined` means every
60
60
  * lane. `declaredBy` is the topic the answer was read from, so a lane can say "inherited from
@@ -9,6 +9,6 @@ declare const guidanceStyleFields: z.ZodObject<{
9
9
  type GuidanceStyleBody = z.infer<typeof guidanceStyleFields>;
10
10
  declare const GuidanceStyle: EntityClass<z.ZodObject<{
11
11
  text: z.ZodString;
12
- }, z.core.$strip>, z.ZodObject<Record<never, never>, z.core.$strip>, "guidance-style", Record<never, never>, Record<never, never>, false>;
12
+ }, z.core.$strip>, z.ZodObject<Record<never, never>, z.core.$strip>, "guidance-style", Record<never, never>, Record<never, never>, false, Record<never, never>, Record<never, never>>;
13
13
  //#endregion
14
14
  export { GuidanceStyle, GuidanceStyleBody };
@@ -1,13 +1,29 @@
1
1
  import { SubEntityClass } from "../../framework/defineSubEntity.js";
2
- import { EntityClass } from "../../framework/defineEntity.js";
2
+ import { EntityClass, GroupComputedInput } from "../../framework/defineEntity.js";
3
+ import { GlyphNamespace } from "./glyph-identity.js";
3
4
  import { z } from "zod";
4
5
 
5
6
  //#region src/entities/system/Icon.d.ts
7
+ /**
8
+ * How a set's `variant` reaches the drawing. Closed, like `metadata.format`: an arm exists only
9
+ * when the shared glyph resolver implements it.
10
+ *
11
+ * - `{ prop: 'weight' }`: the glyph takes the variant as a prop (Phosphor).
12
+ * - `{ export: { filled: '{name}Filled' } }`: a variant is another export, named by the template
13
+ * with `{name}` replaced by the member's name; a variant not listed draws the bare export (Tabler).
14
+ */
15
+ declare const iconVariantAs: z.ZodUnion<readonly [z.ZodObject<{
16
+ prop: z.ZodString;
17
+ }, z.core.$strict>, z.ZodObject<{
18
+ export: z.ZodRecord<z.ZodString, z.ZodString>;
19
+ }, z.core.$strict>]>;
20
+ type IconVariantAs = z.infer<typeof iconVariantAs>;
6
21
  /**
7
22
  * Icon (`icons/AcornIcon`) — one glyph in an icon library. The library (`icons`) is an EMERGENT group
8
23
  * from the path, and everything that describes the SET lives on that group node: its version, the
9
- * sizes and variants it ships, the component a placed icon renders through, and where the members'
10
- * descriptive facts come from (`metadata`).
24
+ * sizes and variants it ships, and where the members' descriptive facts come from (`metadata`). A
25
+ * component that renders a glyph names the library through its own prop's domain (`Icon.ref('phosphor')`),
26
+ * so the edge runs from the component to the set and the set knows nothing about its renderers.
11
27
  *
12
28
  * A member's identity is still its name; its fields carry what the name can't say. A group that
13
29
  * declares `metadata` gets those fields baked at BUILD time from the declared source, and the bake
@@ -22,25 +38,61 @@ declare const Icon: EntityClass<z.ZodObject<{
22
38
  categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
23
39
  tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
24
40
  codepoint: z.ZodOptional<z.ZodNumber>;
41
+ variants: z.ZodOptional<z.ZodArray<z.ZodString>>;
25
42
  knockoutVariants: z.ZodOptional<z.ZodArray<z.ZodString>>;
26
43
  }, z.core.$strict>, z.ZodObject<{
27
- module: z.ZodOptional<z.ZodString>;
28
- version: z.ZodOptional<z.ZodString>;
44
+ package: z.ZodOptional<z.ZodObject<{
45
+ __ref: z.ZodString;
46
+ }, z.core.$strip>>;
29
47
  metadata: z.ZodOptional<z.ZodObject<{
30
48
  from: EntityClass<z.ZodObject<{
31
49
  version: z.ZodOptional<z.ZodString>;
32
50
  exports: z.ZodOptional<SubEntityClass<z.ZodObject<{}, z.core.$strict>>>;
33
- }, z.core.$strict>, z.ZodObject<Record<never, never>, z.core.$strip>, "package", Record<never, never>, Record<never, never>, false>;
51
+ }, z.core.$strict>, z.ZodObject<Record<never, never>, z.core.$strip>, "package", Record<never, never>, Record<never, never>, false, Record<never, never>, Record<never, never>>;
34
52
  format: z.ZodEnum<{
35
53
  uds: "uds";
36
54
  phosphor: "phosphor";
55
+ tabler: "tabler";
37
56
  }>;
38
57
  }, z.core.$strict>>;
39
58
  sizes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
40
59
  variants: z.ZodOptional<z.ZodArray<z.ZodString>>;
41
- component: z.ZodOptional<z.ZodObject<{
42
- __ref: z.ZodString;
43
- }, z.core.$strip>>;
44
- }, z.core.$strict>, "icon", Record<never, never>, Record<never, never>, false>;
60
+ variantAs: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
61
+ prop: z.ZodString;
62
+ }, z.core.$strict>, z.ZodObject<{
63
+ export: z.ZodRecord<z.ZodString, z.ZodString>;
64
+ }, z.core.$strict>]>>;
65
+ }, z.core.$strict>, "icon", Record<never, never>, Record<never, never>, false, {
66
+ /** The glyphs the set ships, by leaf name. */readonly members: ({
67
+ config,
68
+ path
69
+ }: GroupComputedInput) => string[];
70
+ /** The module the glyphs import from: the named package's path. `pathOf` drops a source
71
+ * qualifier, so a borrowed set's module is still the bare specifier. */
72
+ readonly module: ({
73
+ meta
74
+ }: GroupComputedInput) => string | undefined;
75
+ /** The version the named package pins, resolved through the ref in whichever config holds the
76
+ * package row. */
77
+ readonly version: ({
78
+ config,
79
+ meta
80
+ }: GroupComputedInput) => string | undefined;
81
+ }, {
82
+ /**
83
+ * The package's module namespace, so an authored glyph (`name={StarIcon}`) is matched to its
84
+ * member by reference rather than by anything the component says about itself: Tabler's
85
+ * `displayName` is not its export name. Read once while the config file is evaluated and never
86
+ * stored; only the names under `items` are recorded, so a deprecated alias of a listed export
87
+ * resolves to the listed name.
88
+ */
89
+ readonly glyphs: ({
90
+ input,
91
+ body
92
+ }: {
93
+ input: GlyphNamespace;
94
+ body: Readonly<Record<string, unknown>>;
95
+ }) => void;
96
+ }>;
45
97
  //#endregion
46
- export { Icon };
98
+ export { Icon, IconVariantAs, iconVariantAs };
@@ -1,13 +1,26 @@
1
+ import { isRef, pathOf } from "../../framework/utils/refs.js";
1
2
  import { defineEntity } from "../../framework/defineEntity.js";
2
- import { Component } from "./Component.js";
3
+ import { glyphOfLibrary, recordGlyphIdentities } from "./glyph-identity.js";
4
+ import { Package } from "./Package.js";
5
+ import { iconDomainInvariants } from "./icon-domain-invariants.js";
3
6
  import { iconMemberMetadata, iconMetadataDeclaration } from "./icon-metadata.js";
4
7
  import { z } from "zod";
5
8
  //#region src/entities/system/Icon.ts
6
9
  /**
10
+ * How a set's `variant` reaches the drawing. Closed, like `metadata.format`: an arm exists only
11
+ * when the shared glyph resolver implements it.
12
+ *
13
+ * - `{ prop: 'weight' }`: the glyph takes the variant as a prop (Phosphor).
14
+ * - `{ export: { filled: '{name}Filled' } }`: a variant is another export, named by the template
15
+ * with `{name}` replaced by the member's name; a variant not listed draws the bare export (Tabler).
16
+ */
17
+ const iconVariantAs = z.union([z.strictObject({ prop: z.string().min(1) }), z.strictObject({ export: z.record(z.string().min(1), z.string().min(1)) })]);
18
+ /**
7
19
  * Icon (`icons/AcornIcon`) — one glyph in an icon library. The library (`icons`) is an EMERGENT group
8
20
  * from the path, and everything that describes the SET lives on that group node: its version, the
9
- * sizes and variants it ships, the component a placed icon renders through, and where the members'
10
- * descriptive facts come from (`metadata`).
21
+ * sizes and variants it ships, and where the members' descriptive facts come from (`metadata`). A
22
+ * component that renders a glyph names the library through its own prop's domain (`Icon.ref('phosphor')`),
23
+ * so the edge runs from the component to the set and the set knows nothing about its renderers.
11
24
  *
12
25
  * A member's identity is still its name; its fields carry what the name can't say. A group that
13
26
  * declares `metadata` gets those fields baked at BUILD time from the declared source, and the bake
@@ -24,12 +37,10 @@ const Icon = defineEntity({
24
37
  labelPlural: "Icons",
25
38
  fields: iconMemberMetadata,
26
39
  groupFields: z.strictObject({
27
- /** The package the glyphs come from. Declared here rather than recovered by scanning source for
28
- * a namespace import used inside a `.group(…)` call, which is what `assetModules` does today —
29
- * and what a generated module needs, since it has to import the glyph it renders. The same
30
- * field a `Package` group carries, for the same reason. */
31
- module: z.string().optional(),
32
- version: z.string().optional(),
40
+ /** The package the glyphs come from — a REF to the `Package` item, which owns the module
41
+ * specifier (its path) and the pinned version. A generated module imports the glyphs it renders
42
+ * from it, and a render that imports a member of it is placing a glyph of this set. */
43
+ package: Package.optional(),
33
44
  /** Where member metadata comes from and how to read it — `{ from, format }`. The build resolves
34
45
  * the source and bakes each member's fields; see `icon-metadata.ts`. */
35
46
  metadata: iconMetadataDeclaration.optional(),
@@ -37,10 +48,55 @@ const Icon = defineEntity({
37
48
  sizes: z.record(z.string(), z.number()).optional(),
38
49
  /** Weights/styles the set ships (`regular`, `fill`). */
39
50
  variants: z.array(z.string()).optional(),
40
- /** The component a placed icon renders through — a REF, so the graph sees the edge and a
41
- * rename of that component cascades into this library. */
42
- component: Component.optional()
43
- })
51
+ /** How a variant reaches the glyph; see {@link iconVariantAs}. Absent, a variant is dropped at
52
+ * render. */
53
+ variantAs: iconVariantAs.optional()
54
+ }),
55
+ groupComputed: {
56
+ /** The glyphs the set ships, by leaf name. */
57
+ members: ({ config, path }) => config.members("icon", path).map((member) => member.path.startsWith(`${path}/`) ? member.path.slice(path.length + 1) : member.path),
58
+ /** The module the glyphs import from: the named package's path. `pathOf` drops a source
59
+ * qualifier, so a borrowed set's module is still the bare specifier. */
60
+ module: ({ meta }) => isRef(meta.package) ? pathOf(meta.package) : void 0,
61
+ /** The version the named package pins, resolved through the ref in whichever config holds the
62
+ * package row. */
63
+ version: ({ config, meta }) => {
64
+ if (!isRef(meta.package)) return void 0;
65
+ const pinned = config.resolveRef(meta.package)?.toJSON();
66
+ return typeof pinned?.version === "string" ? pinned.version : void 0;
67
+ }
68
+ },
69
+ groupInputs: {
70
+ /**
71
+ * The package's module namespace, so an authored glyph (`name={StarIcon}`) is matched to its
72
+ * member by reference rather than by anything the component says about itself: Tabler's
73
+ * `displayName` is not its export name. Read once while the config file is evaluated and never
74
+ * stored; only the names under `items` are recorded, so a deprecated alias of a listed export
75
+ * resolves to the listed name.
76
+ */
77
+ glyphs: ({ input, body }) => {
78
+ if (!isRef(body.package)) throw new Error("Icon.group: `glyphs` needs `package` on the same group, since a glyph is identified as an export of that module.");
79
+ recordGlyphIdentities({
80
+ namespace: input,
81
+ names: Object.keys(body.items ?? {}),
82
+ specifier: pathOf(body.package)
83
+ });
84
+ } },
85
+ /**
86
+ * A value bound to a library may be the glyph component itself, or the `package:` export ref the
87
+ * open-bag pass turned it into. Either is answered as the member name when the export is one of
88
+ * this library's and comes from the module its `package` names.
89
+ */
90
+ authoredValue: ({ config, target, leaves }) => {
91
+ const meta = config.configFor(target)?.groupMeta("icon", pathOf(target));
92
+ const module = isRef(meta?.package) ? pathOf(meta.package) : void 0;
93
+ return glyphOfLibrary({
94
+ library: pathOf(target),
95
+ module,
96
+ leaves
97
+ });
98
+ },
99
+ invariants: (config) => iconDomainInvariants(config)
44
100
  });
45
101
  //#endregion
46
- export { Icon };
102
+ export { Icon, iconVariantAs };
@@ -329,7 +329,7 @@ declare const LinkedSystem: EntityClass<z.ZodObject<{
329
329
  member,
330
330
  path
331
331
  }: ComputedInput) => string;
332
- }, false>;
332
+ }, false, Record<never, never>, Record<never, never>>;
333
333
  /**
334
334
  * What a pin's `options` may say, checked against the config type it is declared in — one record per
335
335
  * accessor, keyed by the path the source spells, valued by what this config does to it.
@@ -46,7 +46,7 @@ declare const Modifier: EntityClass<z.ZodObject<{
46
46
  }>;
47
47
  value: z.ZodUnion<readonly [z.ZodString, z.ZodLazy<EntityClass<z.ZodObject<{
48
48
  styles: SubEntityClass<z.ZodType<StyleValue, unknown, z.core.$ZodTypeInternals<StyleValue, unknown>>>;
49
- }, z.core.$strip>, z.ZodObject<Record<never, never>, z.core.$strip>, "composite", Record<never, never>, Record<never, never>, false>>]>;
49
+ }, z.core.$strip>, z.ZodObject<Record<never, never>, z.core.$strip>, "composite", Record<never, never>, Record<never, never>, false, Record<never, never>, Record<never, never>>>]>;
50
50
  }, z.core.$strip>, z.ZodObject<{
51
51
  type: z.ZodOptional<z.ZodEnum<{
52
52
  mode: "mode";
@@ -55,7 +55,7 @@ declare const Modifier: EntityClass<z.ZodObject<{
55
55
  default: z.ZodOptional<z.ZodObject<{
56
56
  __ref: z.ZodString;
57
57
  }, z.core.$strip>>;
58
- }, z.core.$strip>, "modifier", Record<never, never>, Record<never, never>, false>;
58
+ }, z.core.$strip>, "modifier", Record<never, never>, Record<never, never>, false, Record<never, never>, Record<never, never>>;
59
59
  /** A path's last segment. */
60
60
  declare function modifierLeaf(path: string): string;
61
61
  /**
@@ -23,6 +23,6 @@ declare const Motion: EntityClass<z.ZodDiscriminatedUnion<[z.ZodObject<{
23
23
  drag: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>;
24
24
  dragConstraints: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
25
25
  dragElastic: z.ZodOptional<z.ZodNumber>;
26
- }, z.core.$strict>], "runtime">, z.ZodObject<Record<never, never>, z.core.$strip>, "motion", Record<never, never>, Record<never, never>, false>;
26
+ }, z.core.$strict>], "runtime">, z.ZodObject<Record<never, never>, z.core.$strip>, "motion", Record<never, never>, Record<never, never>, false, Record<never, never>, Record<never, never>>;
27
27
  //#endregion
28
28
  export { Motion };
@@ -37,6 +37,6 @@ import { z } from "zod";
37
37
  declare const Package: EntityClass<z.ZodObject<{
38
38
  version: z.ZodOptional<z.ZodString>;
39
39
  exports: z.ZodOptional<SubEntityClass<z.ZodObject<{}, z.core.$strict>>>;
40
- }, z.core.$strict>, z.ZodObject<Record<never, never>, z.core.$strip>, "package", Record<never, never>, Record<never, never>, false>;
40
+ }, z.core.$strict>, z.ZodObject<Record<never, never>, z.core.$strip>, "package", Record<never, never>, Record<never, never>, false, Record<never, never>, Record<never, never>>;
41
41
  //#endregion
42
42
  export { Package };
@@ -89,6 +89,6 @@ declare const Settings: EntityClass<z.ZodObject<{
89
89
  pagesDir: z.ZodOptional<z.ZodString>;
90
90
  port: z.ZodOptional<z.ZodNumber>;
91
91
  }, z.core.$strict>>;
92
- }, z.core.$strict>, z.ZodObject<Record<never, never>, z.core.$strip>, "settings", Record<never, never>, Record<never, never>, true>;
92
+ }, z.core.$strict>, z.ZodObject<Record<never, never>, z.core.$strip>, "settings", Record<never, never>, Record<never, never>, true, Record<never, never>, Record<never, never>>;
93
93
  //#endregion
94
94
  export { BuildSection, CSS_DEFAULTS, CssPrefix, CssSection, PLAYGROUND_DEFAULTS, PlaygroundSection, Settings, SystemSection, classPrefixOf, cssPrefixes, varPrefixOf };