@yahoo/uds-create-config 2.45.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +129 -0
- package/dist/ai-lanes.d.ts +23 -0
- package/dist/ai-lanes.js +34 -0
- package/dist/authoring/define-component.d.ts +85 -0
- package/dist/configs/CanvasConfig.d.ts +3237 -0
- package/dist/configs/CanvasConfig.js +332 -0
- package/dist/configs/build-options.d.ts +10 -0
- package/dist/configs/build-options.js +68 -0
- package/dist/configs/platform.d.ts +15 -0
- package/dist/configs/platform.js +17 -0
- package/dist/configs/react-native-system.d.ts +3026 -0
- package/dist/configs/react-native-system.js +64 -0
- package/dist/configs/system.d.ts +2771 -0
- package/dist/configs/system.js +74 -0
- package/dist/css/properties.generated.d.ts +14 -0
- package/dist/css/properties.generated.js +6260 -0
- package/dist/css/value-type.d.ts +48 -0
- package/dist/css/value-type.js +131 -0
- package/dist/css/values.d.ts +33 -0
- package/dist/css/values.js +116 -0
- package/dist/entities/native/NativeModifier.d.ts +25 -0
- package/dist/entities/native/NativeModifier.js +41 -0
- package/dist/entities/native/NativeSettings.d.ts +44 -0
- package/dist/entities/native/NativeSettings.js +39 -0
- package/dist/entities/native/NativeStyleProperty.d.ts +355 -0
- package/dist/entities/native/NativeStyleProperty.js +28 -0
- package/dist/entities/native/NativeToken.d.ts +31 -0
- package/dist/entities/native/NativeToken.js +49 -0
- package/dist/entities/system/CanvasRole.d.ts +34 -0
- package/dist/entities/system/CanvasRole.js +45 -0
- package/dist/entities/system/Component.d.ts +1287 -0
- package/dist/entities/system/Component.js +1840 -0
- package/dist/entities/system/Composite.d.ts +12 -0
- package/dist/entities/system/Composite.js +26 -0
- package/dist/entities/system/Device.d.ts +11 -0
- package/dist/entities/system/Device.js +18 -0
- package/dist/entities/system/File.d.ts +72 -0
- package/dist/entities/system/File.js +136 -0
- package/dist/entities/system/Font.d.ts +48 -0
- package/dist/entities/system/Font.js +56 -0
- package/dist/entities/system/GlobalStyle.d.ts +26 -0
- package/dist/entities/system/GlobalStyle.js +54 -0
- package/dist/entities/system/Guidance.d.ts +85 -0
- package/dist/entities/system/Guidance.js +59 -0
- package/dist/entities/system/GuidanceStyle.d.ts +14 -0
- package/dist/entities/system/GuidanceStyle.js +8 -0
- package/dist/entities/system/Icon.d.ts +46 -0
- package/dist/entities/system/Icon.js +46 -0
- package/dist/entities/system/LinkedSystem.d.ts +504 -0
- package/dist/entities/system/LinkedSystem.js +814 -0
- package/dist/entities/system/Modifier.d.ts +92 -0
- package/dist/entities/system/Modifier.js +120 -0
- package/dist/entities/system/Motion.d.ts +28 -0
- package/dist/entities/system/Motion.js +48 -0
- package/dist/entities/system/Operation.d.ts +100 -0
- package/dist/entities/system/Operation.js +236 -0
- package/dist/entities/system/Package.d.ts +42 -0
- package/dist/entities/system/Package.js +75 -0
- package/dist/entities/system/Settings.d.ts +94 -0
- package/dist/entities/system/Settings.js +166 -0
- package/dist/entities/system/StyleProperty.d.ts +135 -0
- package/dist/entities/system/StyleProperty.js +438 -0
- package/dist/entities/system/Token.d.ts +67 -0
- package/dist/entities/system/Token.js +129 -0
- package/dist/entities/system/Tool.d.ts +134 -0
- package/dist/entities/system/Tool.js +124 -0
- package/dist/entities/system/color.d.ts +64 -0
- package/dist/entities/system/color.js +123 -0
- package/dist/entities/system/component-module.d.ts +63 -0
- package/dist/entities/system/component-module.js +258 -0
- package/dist/entities/system/copy-plan.d.ts +98 -0
- package/dist/entities/system/copy-plan.js +451 -0
- package/dist/entities/system/defineComponent.d.ts +428 -0
- package/dist/entities/system/defineComponent.js +337 -0
- package/dist/entities/system/element.d.ts +101 -0
- package/dist/entities/system/element.js +171 -0
- package/dist/entities/system/icon-library.d.ts +64 -0
- package/dist/entities/system/icon-library.js +112 -0
- package/dist/entities/system/icon-metadata.d.ts +72 -0
- package/dist/entities/system/icon-metadata.js +111 -0
- package/dist/entities/system/link-declaration.d.ts +27 -0
- package/dist/entities/system/link-declaration.js +64 -0
- package/dist/entities/system/link-plan.d.ts +160 -0
- package/dist/entities/system/link-plan.js +770 -0
- package/dist/entities/system/runtime-modules.d.ts +25 -0
- package/dist/entities/system/runtime-modules.js +38 -0
- package/dist/entities/system/style-bag.d.ts +20 -0
- package/dist/entities/system/style-bag.js +246 -0
- package/dist/entities/system/token-index.d.ts +89 -0
- package/dist/entities/system/token-index.js +112 -0
- package/dist/framework/Config.d.ts +2472 -0
- package/dist/framework/Config.js +5023 -0
- package/dist/framework/Entity.d.ts +127 -0
- package/dist/framework/Entity.js +125 -0
- package/dist/framework/authoring.d.ts +24 -0
- package/dist/framework/authoring.js +7 -0
- package/dist/framework/change-hooks.d.ts +119 -0
- package/dist/framework/change-hooks.js +131 -0
- package/dist/framework/changes.d.ts +88 -0
- package/dist/framework/changes.js +246 -0
- package/dist/framework/class-names.d.ts +260 -0
- package/dist/framework/class-names.js +630 -0
- package/dist/framework/coalesce.d.ts +25 -0
- package/dist/framework/coalesce.js +60 -0
- package/dist/framework/config-op.d.ts +76 -0
- package/dist/framework/config-op.js +43 -0
- package/dist/framework/config-operation-kind.d.ts +14 -0
- package/dist/framework/config-operation-kind.js +14 -0
- package/dist/framework/config-ops.d.ts +34 -0
- package/dist/framework/config-ops.js +187 -0
- package/dist/framework/defineConfig.d.ts +196 -0
- package/dist/framework/defineConfig.js +100 -0
- package/dist/framework/defineDerivedEntity.d.ts +74 -0
- package/dist/framework/defineDerivedEntity.js +83 -0
- package/dist/framework/defineEntity.d.ts +318 -0
- package/dist/framework/defineEntity.js +183 -0
- package/dist/framework/defineSubEntity.d.ts +148 -0
- package/dist/framework/defineSubEntity.js +121 -0
- package/dist/framework/derived-mutations.d.ts +20 -0
- package/dist/framework/derived-mutations.js +38 -0
- package/dist/framework/entity-search.d.ts +29 -0
- package/dist/framework/entity-search.js +117 -0
- package/dist/framework/inline-sources.d.ts +49 -0
- package/dist/framework/inline-sources.js +388 -0
- package/dist/framework/layer-styles.d.ts +25 -0
- package/dist/framework/layer-styles.js +49 -0
- package/dist/framework/memo.d.ts +48 -0
- package/dist/framework/memo.js +84 -0
- package/dist/framework/overlay.d.ts +49 -0
- package/dist/framework/overlay.js +17 -0
- package/dist/framework/plan.d.ts +49 -0
- package/dist/framework/plan.js +73 -0
- package/dist/framework/projections.d.ts +480 -0
- package/dist/framework/projections.js +974 -0
- package/dist/framework/prop-surface.d.ts +132 -0
- package/dist/framework/prop-surface.js +278 -0
- package/dist/framework/ref-graph.d.ts +71 -0
- package/dist/framework/ref-graph.js +158 -0
- package/dist/framework/ref-integrity.d.ts +55 -0
- package/dist/framework/ref-integrity.js +171 -0
- package/dist/framework/registered.d.ts +95 -0
- package/dist/framework/registry-dir.d.ts +42 -0
- package/dist/framework/registry-dir.js +48 -0
- package/dist/framework/registry.d.ts +300 -0
- package/dist/framework/registry.js +104 -0
- package/dist/framework/rejection.d.ts +58 -0
- package/dist/framework/rejection.js +111 -0
- package/dist/framework/rename-inference.d.ts +26 -0
- package/dist/framework/rename-inference.js +50 -0
- package/dist/framework/render-spec.d.ts +296 -0
- package/dist/framework/render-spec.js +809 -0
- package/dist/framework/schema-version.d.ts +140 -0
- package/dist/framework/schema-version.js +214 -0
- package/dist/framework/schemas.d.ts +109 -0
- package/dist/framework/schemas.js +615 -0
- package/dist/framework/session.d.ts +196 -0
- package/dist/framework/session.js +367 -0
- package/dist/framework/signature.d.ts +15 -0
- package/dist/framework/signature.js +83 -0
- package/dist/framework/snapshot.d.ts +115 -0
- package/dist/framework/snapshot.js +277 -0
- package/dist/framework/source-integrity.d.ts +226 -0
- package/dist/framework/source-integrity.js +478 -0
- package/dist/framework/sources.d.ts +211 -0
- package/dist/framework/sources.js +89 -0
- package/dist/framework/utils/compiled-schema.d.ts +23 -0
- package/dist/framework/utils/compiled-schema.js +46 -0
- package/dist/framework/utils/content-key.d.ts +15 -0
- package/dist/framework/utils/content-key.js +33 -0
- package/dist/framework/utils/enumerated.d.ts +13 -0
- package/dist/framework/utils/enumerated.js +19 -0
- package/dist/framework/utils/field-path.d.ts +95 -0
- package/dist/framework/utils/field-path.js +136 -0
- package/dist/framework/utils/field-schema.d.ts +55 -0
- package/dist/framework/utils/field-schema.js +183 -0
- package/dist/framework/utils/group.d.ts +37 -0
- package/dist/framework/utils/group.js +13 -0
- package/dist/framework/utils/package-path.d.ts +37 -0
- package/dist/framework/utils/package-path.js +61 -0
- package/dist/framework/utils/refs.d.ts +194 -0
- package/dist/framework/utils/refs.js +403 -0
- package/dist/framework/validate-spec.d.ts +27 -0
- package/dist/framework/validate-spec.js +45 -0
- package/dist/framework/value-domain.d.ts +26 -0
- package/dist/framework/value-domain.js +202 -0
- package/dist/framework/views-facade.d.ts +15 -0
- package/dist/framework/views-facade.js +19 -0
- package/dist/index.d.ts +90 -42
- package/dist/index.js +86 -37
- package/dist/migrations/2.0.0/raw-css.d.ts +11 -0
- package/dist/migrations/2.0.0/raw-css.js +72 -0
- package/dist/migrations/2.0.0/v1-artifact.d.ts +1559 -0
- package/dist/migrations/2.0.0/v1-artifact.js +1018 -0
- package/dist/migrations/20260908171448_settings_as_kind.d.ts +22 -0
- package/dist/migrations/20260908171448_settings_as_kind.js +89 -0
- package/dist/migrations/20260908194245_visible_state_pointer.d.ts +19 -0
- package/dist/migrations/20260908194245_visible_state_pointer.js +115 -0
- package/dist/migrations/20260909183001_icon_knockout_variants.d.ts +18 -0
- package/dist/migrations/20260909183001_icon_knockout_variants.js +8 -0
- package/dist/migrations/20260910212453_linked_system_link_ops.d.ts +13 -0
- package/dist/migrations/20260910212453_linked_system_link_ops.js +8 -0
- package/dist/migrations/index.d.ts +2 -0
- package/dist/migrations/index.js +2 -0
- package/dist/react-native/style-keys.generated.d.ts +10 -0
- package/dist/react-native/style-keys.generated.js +167 -0
- package/dist/renderer/RendererErrorBoundary.d.ts +32 -5
- package/dist/renderer/RendererErrorBoundary.js +59 -10
- package/dist/renderer/UdsRenderer.d.ts +11 -10
- package/dist/renderer/UdsRenderer.js +1 -1
- package/dist/renderer/assetEntries.d.ts +37 -0
- package/dist/renderer/assetEntries.js +39 -0
- package/dist/renderer/assetRenderable.d.ts +14 -6
- package/dist/renderer/assetRenderable.js +8 -2
- package/dist/renderer/componentEntry.d.ts +58 -0
- package/dist/renderer/componentEntry.js +71 -0
- package/dist/renderer/icon-library.d.ts +20 -0
- package/dist/renderer/index.d.ts +7 -7
- package/dist/renderer/index.js +5 -5
- package/dist/renderer/primitives/SlotRenderer.d.ts +1 -1
- package/dist/renderer/primitives/SlotRenderer.js +1 -1
- package/dist/renderer/runtimeComponent.d.ts +33 -0
- package/dist/renderer/runtimeComponent.js +113 -0
- package/dist/renderer/spec-content.d.ts +43 -0
- package/dist/renderer/spec-content.js +95 -0
- package/dist/renderer/wrapRegistry.d.ts +22 -37
- package/dist/renderer/wrapRegistry.js +10 -20
- package/dist/renderer/wrappers/event-bridge.js +6 -5
- package/dist/renderer/wrappers/hex-normalize.js +6 -5
- package/dist/renderer/wrappers/html-aliases.d.ts +7 -2
- package/dist/renderer/wrappers/html-aliases.js +36 -19
- package/dist/renderer/wrappers/inline-styles.js +7 -6
- package/dist/spec/asset-jsx.d.ts +18 -5
- package/dist/spec/asset-jsx.js +27 -16
- package/dist/spec/collapse-text-labels.d.ts +5 -15
- package/dist/spec/collapse-text-labels.js +26 -19
- package/dist/spec/empty-node-slots.d.ts +56 -34
- package/dist/spec/empty-node-slots.js +87 -47
- package/dist/spec/index.d.ts +21 -10
- package/dist/spec/index.js +21 -10
- package/dist/spec/jsxToSpec.d.ts +14 -9
- package/dist/spec/jsxToSpec.js +20 -3
- package/dist/spec/preview-elements.d.ts +63 -0
- package/dist/spec/preview-elements.js +89 -0
- package/dist/spec/rewrite-refs.d.ts +58 -0
- package/dist/spec/rewrite-refs.js +250 -0
- package/dist/spec/specToJsx.js +18 -29
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +39 -52
- package/dist/AssetGroup.d.ts +0 -77
- package/dist/AssetGroup.js +0 -125
- package/dist/Component.d.ts +0 -333
- package/dist/Component.js +0 -1061
- package/dist/ComponentGroup.d.ts +0 -22
- package/dist/ComponentGroup.js +0 -51
- package/dist/CompositeStyle.d.ts +0 -30
- package/dist/CompositeStyle.js +0 -59
- package/dist/Config.d.ts +0 -528
- package/dist/Config.js +0 -1712
- package/dist/Mode.d.ts +0 -41
- package/dist/Mode.js +0 -81
- package/dist/Modifier.d.ts +0 -51
- package/dist/Modifier.js +0 -97
- package/dist/MotionDef.d.ts +0 -81
- package/dist/MotionDef.js +0 -212
- package/dist/Props.d.ts +0 -332
- package/dist/Props.js +0 -35
- package/dist/Provider.d.ts +0 -20
- package/dist/Provider.js +0 -14
- package/dist/StyleProp.d.ts +0 -145
- package/dist/StyleProp.js +0 -239
- package/dist/Token.d.ts +0 -76
- package/dist/Token.js +0 -133
- package/dist/TokenGroup.d.ts +0 -33
- package/dist/TokenGroup.js +0 -69
- package/dist/asset-kind.d.ts +0 -55
- package/dist/asset-kind.js +0 -29
- package/dist/asset-value.d.ts +0 -23
- package/dist/asset-value.js +0 -40
- package/dist/brands.d.ts +0 -30
- package/dist/brands.js +0 -20
- package/dist/captureCallerPath.d.ts +0 -48
- package/dist/captureCallerPath.js +0 -95
- package/dist/colorExpressions.d.ts +0 -131
- package/dist/colorExpressions.js +0 -148
- package/dist/component-referrers.d.ts +0 -30
- package/dist/component-referrers.js +0 -40
- package/dist/config-diagnostics.d.ts +0 -21
- package/dist/config-diagnostics.js +0 -12
- package/dist/defineAssetGroup.d.ts +0 -200
- package/dist/defineAssetGroup.js +0 -323
- package/dist/defineProvider.d.ts +0 -29
- package/dist/defineProvider.js +0 -60
- package/dist/element-marker.d.ts +0 -63
- package/dist/element-marker.js +0 -113
- package/dist/entity-utils.d.ts +0 -56
- package/dist/entity-utils.js +0 -105
- package/dist/extension.d.ts +0 -55
- package/dist/extension.js +0 -214
- package/dist/factories.d.ts +0 -863
- package/dist/factories.js +0 -475
- package/dist/font-face.d.ts +0 -25
- package/dist/font-face.js +0 -72
- package/dist/foreign-component-name.d.ts +0 -21
- package/dist/foreign-component-name.js +0 -42
- package/dist/interpolate.d.ts +0 -20
- package/dist/interpolate.js +0 -10
- package/dist/jsx/__fixtures__/cross-component-preview.d.ts +0 -3
- package/dist/jsx/__fixtures__/cross-component-preview.js +0 -15
- package/dist/jsx/jsx-dev-runtime.d.ts +0 -15
- package/dist/jsx/jsx-dev-runtime.js +0 -11
- package/dist/jsx/jsx-runtime.d.ts +0 -48
- package/dist/jsx/jsx-runtime.js +0 -305
- package/dist/linked-system-pins.d.ts +0 -30
- package/dist/linked-system-pins.js +0 -45
- package/dist/linkedNodePrefixes.d.ts +0 -73
- package/dist/linkedNodePrefixes.js +0 -99
- package/dist/markers.d.ts +0 -235
- package/dist/markers.js +0 -70
- package/dist/motion-constants.d.ts +0 -37
- package/dist/motion-constants.js +0 -61
- package/dist/native/NativeConfig.d.ts +0 -56
- package/dist/native/NativeConfig.js +0 -162
- package/dist/native/assets.d.ts +0 -20
- package/dist/native/assets.js +0 -17
- package/dist/native/components.d.ts +0 -139
- package/dist/native/components.js +0 -67
- package/dist/native/index.d.ts +0 -18
- package/dist/native/index.js +0 -17
- package/dist/native/modes.d.ts +0 -10
- package/dist/native/modes.js +0 -11
- package/dist/native/types.d.ts +0 -95
- package/dist/native/types.js +0 -0
- package/dist/native/validation.d.ts +0 -8
- package/dist/native/validation.js +0 -885
- package/dist/native/values.d.ts +0 -7
- package/dist/native/values.js +0 -15
- package/dist/native.d.ts +0 -12
- package/dist/native.js +0 -10
- package/dist/refs.d.ts +0 -204
- package/dist/refs.js +0 -129
- package/dist/registry-aliases.d.ts +0 -33
- package/dist/registry-aliases.js +0 -35
- package/dist/registry-dir.d.ts +0 -22
- package/dist/registry-dir.js +0 -10
- package/dist/renderer/makeRegistry.d.ts +0 -34
- package/dist/renderer/makeRegistry.js +0 -52
- package/dist/renderer/makeUdsRenderer.d.ts +0 -13
- package/dist/renderer/makeUdsRenderer.js +0 -51
- package/dist/renderer/wrappers/component-slots.d.ts +0 -41
- package/dist/renderer/wrappers/component-slots.js +0 -66
- package/dist/renderer/wrappers/slot-resolution.d.ts +0 -25
- package/dist/renderer/wrappers/slot-resolution.js +0 -68
- package/dist/renderer/wrappers/void-elements.d.ts +0 -37
- package/dist/renderer/wrappers/void-elements.js +0 -40
- package/dist/spec/layer-props.d.ts +0 -52
- package/dist/spec/layer-props.js +0 -149
- package/dist/spec/preview-controls.d.ts +0 -44
- package/dist/spec/preview-controls.js +0 -139
- package/dist/spec/slot-refs.d.ts +0 -39
- package/dist/spec/slot-refs.js +0 -56
- package/dist/token-override-rows.d.ts +0 -68
- package/dist/token-override-rows.js +0 -233
- package/dist/tokenValueType.d.ts +0 -34
- package/dist/tokenValueType.js +0 -138
- package/dist/types/css-properties.d.ts +0 -233
- package/dist/types/css-properties.js +0 -14
- package/dist/types/css-property-keywords.d.ts +0 -156
- package/dist/types/css-property-keywords.js +0 -616
- package/dist/types/css-values.d.ts +0 -63
- package/dist/types/css-values.js +0 -16
- package/dist/types.d.ts +0 -1138
- package/dist/types.js +0 -12
- package/dist/units.d.ts +0 -14
- package/dist/units.js +0 -16
- package/dist/utils/index.d.ts +0 -4
- package/dist/utils/index.js +0 -4
package/README.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# @yahoo/uds-create-config
|
|
2
|
+
|
|
3
|
+
The UDS config layer. A `uds.config.ts` authors one **`Config`** — the single surface both the
|
|
4
|
+
author (`new System().register({ … })`) and every consumer (codegen, Studio, the pipeline)
|
|
5
|
+
read. There are no per-entity `derived` getters and no `CodegenConfig` subclass: group
|
|
6
|
+
enumeration, the dependency graph, the folder/file tree, validation, and the flat wire format
|
|
7
|
+
are all first-class on `Config`, and derived projections are free functions that work on any
|
|
8
|
+
config.
|
|
9
|
+
|
|
10
|
+
## What this fixes from v1
|
|
11
|
+
|
|
12
|
+
"v1" is the config layer this replaced — a bespoke class per entity, projections hanging off
|
|
13
|
+
`.derived` getters, parallel `*Group` entities. The differences:
|
|
14
|
+
|
|
15
|
+
- **Projections are free functions, not per-entity `.derived` getters.** In v1 every
|
|
16
|
+
entity (`Token`, `Component`, `Mode`, `StyleProp`, …) exposed a `.derived` sub-object of
|
|
17
|
+
engine-computed projections that reached cross-entity state through an injected sibling
|
|
18
|
+
lookup / parent-`Config` back-ref and recomputed on each access. All of that is now free
|
|
19
|
+
functions over a plain `Config` (`cssVar`, `className`, `resolveTokenValue`) — no `.derived`
|
|
20
|
+
on entities, no injected back-refs, and they work on any config.
|
|
21
|
+
- **A group is a path prefix, not a Group class.** v1 had explicit `TokenGroup`,
|
|
22
|
+
`ComponentGroup`, `AssetGroup` classes (each with its own `.derived`). Now a kind stores
|
|
23
|
+
one flat, path-keyed record and a group is simply a prefix of it — membership is emergent,
|
|
24
|
+
so there are no parallel Group entities to keep in sync. A group node carries only the
|
|
25
|
+
folder's own metadata, and a prefix with no metadata needs no node at all.
|
|
26
|
+
- **A kind is one zod schema, not a hand-written class.** v1 had a bespoke class per
|
|
27
|
+
entity plus `define*` factories and caller-path capture. `defineEntity({ kind, fields })`
|
|
28
|
+
derives the typed constructors, the kind-bound `ref`, the create/update schemas, and the
|
|
29
|
+
operation set from a single field schema. A config TYPE names the kinds it owns, so what a
|
|
30
|
+
config can hold depends on what was registered into it rather than on import order. The
|
|
31
|
+
base `Entity` owns hydration and serialization, so a new kind adds no constructor or
|
|
32
|
+
`toJSON`.
|
|
33
|
+
- **Identity *is* the qualified path.** `color/brand` is the identity; no caller-path
|
|
34
|
+
capture or separately-tracked namespace. A bare value at an item key is shorthand for the
|
|
35
|
+
kind's primary field, so `Token.item('#1167f4')` skips the object wrapper.
|
|
36
|
+
- **`Config` is the single home for derived structure.** Emergent grouping, the dependency
|
|
37
|
+
graph, the folder/file tree, validation, and the flat wire format are first-class methods
|
|
38
|
+
on `Config` rather than spread across entity getters and helper modules.
|
|
39
|
+
- **Downstream projections read the live config.** The pipeline owns no operation
|
|
40
|
+
definitions and no build-time snapshots — CRUD, MCP tools, and the AI prompt are derived
|
|
41
|
+
at runtime from the current `Config`, so a mutation is reflected immediately (see
|
|
42
|
+
`apps/studio/src/ai/config-v2`).
|
|
43
|
+
|
|
44
|
+
## Authoring
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
import { System, Token } from '@yahoo/uds-create-config';
|
|
48
|
+
|
|
49
|
+
export default new System()
|
|
50
|
+
.register({
|
|
51
|
+
settings: { css: { prefix: 'uds' } }, // one body, no path: settings is a singleton kind
|
|
52
|
+
tokens: {
|
|
53
|
+
color: Token.group({
|
|
54
|
+
label: 'Color',
|
|
55
|
+
items: {
|
|
56
|
+
brand: Token.item('#1167f4'), // bare value = the primary field
|
|
57
|
+
primary: Token.item(Token.ref('color/brand')), // a ref, chased at projection time
|
|
58
|
+
},
|
|
59
|
+
}),
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**A deep path is authored as a group, with `item` leaves.** The stored form is flat and
|
|
65
|
+
path-keyed — identity IS the qualified path (`color/brand`) — but the authored form nests,
|
|
66
|
+
because that is what says which prefixes are folders and lets one carry a label or a
|
|
67
|
+
`cssPrefix`. A flat `'color/brand'` key registers the same item and leaves the folder
|
|
68
|
+
emergent, which is a different artifact. Two shapes keep the flat key, since a group cannot
|
|
69
|
+
express either: an owner path (`Card/Header`, a PART of the `Card` item) and a name that
|
|
70
|
+
contains a slash (`w/1/2`, the fraction). The full rule, with the failure modes, is
|
|
71
|
+
`.claude/rules/config-authoring.md`.
|
|
72
|
+
|
|
73
|
+
## Defining an entity
|
|
74
|
+
|
|
75
|
+
`defineEntity({ kind, fields, groupFields })` is the whole authoring toolkit for one kind,
|
|
76
|
+
derived from its `z.object` field schema. Declare the fields; get the typed `item`/`group`
|
|
77
|
+
constructors, the kind-bound `ref`, and a typed `get`. Registration lives on
|
|
78
|
+
`Config.register`, so the config file reads as a fluent chain.
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
export const Token = defineEntity({
|
|
82
|
+
kind: 'token',
|
|
83
|
+
fields: z.object({ value: z.string() /* … */ }),
|
|
84
|
+
});
|
|
85
|
+
export const { ref: token } = Token;
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
The kind's metadata — field names, create/update schemas, operation set — is built once and
|
|
89
|
+
hangs off the returned class as `kindDef`. A config TYPE names the kind in its `entities`
|
|
90
|
+
map, and `register` copies that metadata into the config instance it is loading, which is
|
|
91
|
+
what `Config` hydrates and validates against. `Token.extend({ … })` makes a VARIANT that
|
|
92
|
+
takes the base's slot, so a config authors through whichever variant it registers.
|
|
93
|
+
|
|
94
|
+
## Entities
|
|
95
|
+
|
|
96
|
+
Concrete kinds live in `src/entities/system/`: `Token`, `StyleProperty`, `Component`,
|
|
97
|
+
`Composite`, `Mode`, `Modifier`, `Motion`, `Font`, `Icon`, `Package`, `Guidance`, `CanvasRole`,
|
|
98
|
+
`GlobalStyle`, `Device`, `LinkedSystem`, plus the derived `Operation` and `Tool`.
|
|
99
|
+
`src/entities/native/` holds the native variants a `ReactNativeSystem` registers in their place
|
|
100
|
+
(`NativeToken`, `NativeMode`, `NativeModifier`, `NativeStyleProperty`).
|
|
101
|
+
|
|
102
|
+
Components are authored with the exported `defineComponent`
|
|
103
|
+
(`src/entities/system/defineComponent.ts`) — see `packages/minimal-template/components/`.
|
|
104
|
+
`src/authoring/define-component.ts` is an unexported **prototype** of a different chaining
|
|
105
|
+
shape for the same job; nothing consumes it.
|
|
106
|
+
|
|
107
|
+
## Projections
|
|
108
|
+
|
|
109
|
+
CSS var names, class names, and chased token literals are exported as **free functions**
|
|
110
|
+
over a plain `Config` (`cssVar`, `cssVarRef`, `className`, `resolveTokenValue`) — not methods
|
|
111
|
+
on a subclass. So codegen and Studio get projections that work on any config without wrapping,
|
|
112
|
+
and the base `Config` stays clean. A projection shared by more than one surface is memoized on
|
|
113
|
+
the snapshot SLICES it reads (`createSliceMemo`), never on the config — a `Config` is immutable,
|
|
114
|
+
so keying on one misses on every edit.
|
|
115
|
+
|
|
116
|
+
## What this package owns vs. what reads it
|
|
117
|
+
|
|
118
|
+
This package owns the config model and its projections. It does **not** own operations
|
|
119
|
+
downstream: `@yahoo/uds-create-codegen` emits CSS from a `Config`, and
|
|
120
|
+
`apps/studio/src/ai/config-v2` derives the CRUD facade, MCP tools, and AI prompt from it.
|
|
121
|
+
Both just read a `Config`.
|
|
122
|
+
|
|
123
|
+
## Develop
|
|
124
|
+
|
|
125
|
+
```sh
|
|
126
|
+
cd packages/config
|
|
127
|
+
bun test # bun:test
|
|
128
|
+
bun run typecheck # tsc --noEmit
|
|
129
|
+
```
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region src/ai-lanes.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The AI lanes — the coarse, user-facing generation workflows a system's AI runs in. One shared
|
|
4
|
+
* vocabulary so the three surfaces that name a lane agree and can be joined: a guidance topic's
|
|
5
|
+
* `appliesTo` (which lane its rules are fed to), an `AiFlow`'s `lane` (which lane produced a canvas
|
|
6
|
+
* node), and a cost-ledger row's `lane` (which lane a model call served).
|
|
7
|
+
*
|
|
8
|
+
* A lane is not an `AiFlow` `origin` (the gesture that started it — `paste`, `duplicate`, `sidebar`
|
|
9
|
+
* carry an origin but run no prompt, so they are not lanes), nor a `multiAgentMode` (how the agents
|
|
10
|
+
* were arranged), nor a `feature` (the per-route telemetry tag). One entry per workflow, not per route.
|
|
11
|
+
*/
|
|
12
|
+
declare const AI_LANES: readonly ["chat", "comment", "huddle", "paint-style", "figma-import", "workspace", "mcp"];
|
|
13
|
+
type AiLane = (typeof AI_LANES)[number];
|
|
14
|
+
/**
|
|
15
|
+
* The subset of lanes a guidance topic can be scoped to — the lanes that actually derive a
|
|
16
|
+
* guidance-filtered prompt today. Drawn from {@link AI_LANES} (every member is an {@link AiLane}) so
|
|
17
|
+
* guidance and the flow/ledger read one vocabulary; a lane joins this set when it starts deriving
|
|
18
|
+
* guidance, and each entry is described in Studio's `WORKFLOWS` map.
|
|
19
|
+
*/
|
|
20
|
+
declare const GUIDANCE_LANES: readonly ["chat", "huddle", "paint-style", "figma-import"];
|
|
21
|
+
type GuidanceLane = (typeof GUIDANCE_LANES)[number];
|
|
22
|
+
//#endregion
|
|
23
|
+
export { AI_LANES, AiLane, GUIDANCE_LANES, GuidanceLane };
|
package/dist/ai-lanes.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region src/ai-lanes.ts
|
|
2
|
+
/**
|
|
3
|
+
* The AI lanes — the coarse, user-facing generation workflows a system's AI runs in. One shared
|
|
4
|
+
* vocabulary so the three surfaces that name a lane agree and can be joined: a guidance topic's
|
|
5
|
+
* `appliesTo` (which lane its rules are fed to), an `AiFlow`'s `lane` (which lane produced a canvas
|
|
6
|
+
* node), and a cost-ledger row's `lane` (which lane a model call served).
|
|
7
|
+
*
|
|
8
|
+
* A lane is not an `AiFlow` `origin` (the gesture that started it — `paste`, `duplicate`, `sidebar`
|
|
9
|
+
* carry an origin but run no prompt, so they are not lanes), nor a `multiAgentMode` (how the agents
|
|
10
|
+
* were arranged), nor a `feature` (the per-route telemetry tag). One entry per workflow, not per route.
|
|
11
|
+
*/
|
|
12
|
+
const AI_LANES = [
|
|
13
|
+
"chat",
|
|
14
|
+
"comment",
|
|
15
|
+
"huddle",
|
|
16
|
+
"paint-style",
|
|
17
|
+
"figma-import",
|
|
18
|
+
"workspace",
|
|
19
|
+
"mcp"
|
|
20
|
+
];
|
|
21
|
+
/**
|
|
22
|
+
* The subset of lanes a guidance topic can be scoped to — the lanes that actually derive a
|
|
23
|
+
* guidance-filtered prompt today. Drawn from {@link AI_LANES} (every member is an {@link AiLane}) so
|
|
24
|
+
* guidance and the flow/ledger read one vocabulary; a lane joins this set when it starts deriving
|
|
25
|
+
* guidance, and each entry is described in Studio's `WORKFLOWS` map.
|
|
26
|
+
*/
|
|
27
|
+
const GUIDANCE_LANES = [
|
|
28
|
+
"chat",
|
|
29
|
+
"huddle",
|
|
30
|
+
"paint-style",
|
|
31
|
+
"figma-import"
|
|
32
|
+
];
|
|
33
|
+
//#endregion
|
|
34
|
+
export { AI_LANES, GUIDANCE_LANES };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PROTOTYPE — typed component authoring in the original `defineComponent` shape, wired to
|
|
3
|
+
* the bridge so its output feeds a live `Config` (see `framework/authoring.ts`):
|
|
4
|
+
*
|
|
5
|
+
* const Button = defineComponent
|
|
6
|
+
* .layers({ root: 'button', text: Text }) // name → element (tag OR component)
|
|
7
|
+
* .config(({ slot, variant, styleProperty }) => ({
|
|
8
|
+
* props: { children: slot(), fill: styleProperty('color/bg'), size: variant({...}) },
|
|
9
|
+
* base: { root: { bg: 'brand', _hover: { bg: 'primary' } } }, // style props + modifiers
|
|
10
|
+
* }));
|
|
11
|
+
*
|
|
12
|
+
* `.layers` names elements only; per-layer styling is `config`'s `base` (once). Props are
|
|
13
|
+
* markers; `styleProperty(name)` = `StyleProperty.ref`. No path arg — identity is assigned at
|
|
14
|
+
* `Config.author`. A layer's bag is narrowed to the keys its element allows (an inner
|
|
15
|
+
* component's exposed props, or the derived style-prop union), and modifier keys
|
|
16
|
+
* (`_hover`, `_disabled`, …) to a derived modifier union — all via `keyof`, no codegen.
|
|
17
|
+
* The returned handle is a ref AND an `Authored`, so it composes into other components and
|
|
18
|
+
* registers through the generic bridge.
|
|
19
|
+
*/
|
|
20
|
+
import type { Authored } from '../framework/authoring';
|
|
21
|
+
import { type Ref } from '../framework/utils/refs';
|
|
22
|
+
/** A component handle — a ref (import/reference it), an `Authored` (register it), and a
|
|
23
|
+
* carrier of `Exposed` (its prop names) so another component styling it gets them. */
|
|
24
|
+
export interface ComponentHandle<Exposed extends string = string> extends Ref, Authored {
|
|
25
|
+
readonly exposes?: Exposed;
|
|
26
|
+
}
|
|
27
|
+
type Element = string | ComponentHandle;
|
|
28
|
+
/** A style bag: style-prop keys (value = a token/keyword/ref) plus modifier keys (value =
|
|
29
|
+
* a nested style-prop bag). Both key groups are DERIVED unions — a bad key won't compile. */
|
|
30
|
+
type StyleBag<SP extends string, MOD extends string> = {
|
|
31
|
+
[K in SP | MOD]?: K extends MOD ? Partial<Record<SP, unknown>> : unknown;
|
|
32
|
+
};
|
|
33
|
+
/** The bag a layer allows: an inner component's exposed props (element is a handle) or a
|
|
34
|
+
* full style bag (element is a tag). */
|
|
35
|
+
type LayerBag<El, SP extends string, MOD extends string> = El extends ComponentHandle<infer E> ? Partial<Record<E, unknown>> : StyleBag<SP, MOD>;
|
|
36
|
+
type LayerOverrides<L, SP extends string, MOD extends string> = {
|
|
37
|
+
[K in keyof L]?: LayerBag<L[K], SP, MOD>;
|
|
38
|
+
};
|
|
39
|
+
/** `target` is `<layer>/<prop>` — where the content lands. Absent for a hole the render places. */
|
|
40
|
+
export type SlotProp = {
|
|
41
|
+
readonly kind: 'slot';
|
|
42
|
+
readonly target?: string;
|
|
43
|
+
};
|
|
44
|
+
export type VariantProp = {
|
|
45
|
+
readonly kind: 'variant';
|
|
46
|
+
readonly values: Record<string, unknown>;
|
|
47
|
+
};
|
|
48
|
+
export type ControlProp = {
|
|
49
|
+
readonly kind: 'control';
|
|
50
|
+
readonly control: 'boolean' | 'string' | 'number';
|
|
51
|
+
};
|
|
52
|
+
export type PropMarker = SlotProp | VariantProp | ControlProp | Ref;
|
|
53
|
+
interface Helpers<L, SP extends string, MOD extends string> {
|
|
54
|
+
slot(target?: string): SlotProp;
|
|
55
|
+
/** Per-variant-value, per-layer overrides — F-bounded so a non-layer key won't compile. */
|
|
56
|
+
variant<V extends {
|
|
57
|
+
[Value in keyof V]: LayerOverrides<L, SP, MOD>;
|
|
58
|
+
}>(values: V): VariantProp;
|
|
59
|
+
boolean(): ControlProp;
|
|
60
|
+
string(): ControlProp;
|
|
61
|
+
number(): ControlProp;
|
|
62
|
+
/** Bind a registered style prop by name (i.e. `StyleProperty.ref`), exposing the prop. */
|
|
63
|
+
styleProperty(name: string): Ref;
|
|
64
|
+
}
|
|
65
|
+
interface Body<L, SP extends string, MOD extends string, P extends Record<string, PropMarker>> {
|
|
66
|
+
props?: P;
|
|
67
|
+
base?: LayerOverrides<L, SP, MOD>;
|
|
68
|
+
compoundProps?: Array<{
|
|
69
|
+
when: Record<string, string>;
|
|
70
|
+
layers: LayerOverrides<L, SP, MOD>;
|
|
71
|
+
}>;
|
|
72
|
+
defaultProps?: Record<string, unknown>;
|
|
73
|
+
label?: string;
|
|
74
|
+
description?: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Bind the style-prop and modifier unions (both derived via `keyof` the config's
|
|
78
|
+
* registrations), then author components in the fluent `.layers(...).config(...)` shape.
|
|
79
|
+
*/
|
|
80
|
+
export declare function componentAuthoring<SP extends string, MOD extends string = never>(): {
|
|
81
|
+
layers<L extends Record<string, Element>>(layers: L): {
|
|
82
|
+
config<P extends Record<string, PropMarker>>(build: (h: Helpers<L, SP, MOD>) => Body<L, SP, MOD, P>): ComponentHandle<Extract<keyof P, string>>;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
export {};
|