@yahoo/uds-create-config 2.44.0 → 3.0.0
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
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
import { AI_LANES } from "../ai-lanes.js";
|
|
2
|
+
import { defineEntity } from "../framework/defineEntity.js";
|
|
3
|
+
import { Package } from "../entities/system/Package.js";
|
|
4
|
+
import { Component } from "../entities/system/Component.js";
|
|
5
|
+
import { Device } from "../entities/system/Device.js";
|
|
6
|
+
import { Icon } from "../entities/system/Icon.js";
|
|
7
|
+
import { Operation } from "../entities/system/Operation.js";
|
|
8
|
+
import { Tool } from "../entities/system/Tool.js";
|
|
9
|
+
import { defineConfig } from "../framework/defineConfig.js";
|
|
10
|
+
import { System } from "./system.js";
|
|
11
|
+
import { z } from "zod";
|
|
12
|
+
//#region src/configs/CanvasConfig.ts
|
|
13
|
+
/**
|
|
14
|
+
* The canvas config — a design file as its own config TYPE, and every entity it owns, co-located in
|
|
15
|
+
* one home (the same shape `../design-file.ts` keeps, which this supersedes).
|
|
16
|
+
*
|
|
17
|
+
* `Node` is the ONE kind, flat: every element is its own node row. A PLACED node — the thing
|
|
18
|
+
* react-flow wraps — additionally carries `page` + geometry; its subtree nodes carry none and nest
|
|
19
|
+
* under its id (`n1/badge` is part of `n1`, the same occupied-prefix containment `Card/Header`
|
|
20
|
+
* uses), with `children`/`slots` as real node refs. Flat rather than an embedded keyed tree
|
|
21
|
+
* because an embedded tree is the old `spec` jsonb blob again: one Yjs key per node means two
|
|
22
|
+
* people editing different subtree elements conflict as whole-blob writes, and every edit re-ships
|
|
23
|
+
* the tree. One row per element is the collaboration and write granularity. An instance is one
|
|
24
|
+
* placed node, a generation placeholder is a placed node with no `type` yet.
|
|
25
|
+
*
|
|
26
|
+
* AI provenance is the chain node → `AiGeneration` → `AiFlow` → `AiMessage` → `AiChat`, every hop a
|
|
27
|
+
* real ref. The system arrives WHOLE through `SystemSource` — never `LinkedSystem`'s partial-borrow
|
|
28
|
+
* apparatus, which a canvas has no use for. See `docs/config-v2-spec-renderer-model.md`, "Where an
|
|
29
|
+
* entity-shaped Spec lives".
|
|
30
|
+
*
|
|
31
|
+
* Lives in config-v2 (not studio) so every consumer can hold one: the derived `operation`/`tool`
|
|
32
|
+
* catalog means the compact agent tools serve canvas CRUD the same way they serve the system's —
|
|
33
|
+
* the MCP/CLI surface derives from the config type, and a studio-only home would fence
|
|
34
|
+
* that off. Studio keeps the runtime halves (row mapping, Yjs session, dynamic registry), which
|
|
35
|
+
* genuinely are app concerns.
|
|
36
|
+
*/
|
|
37
|
+
/**
|
|
38
|
+
* `SystemSource` — this canvas's pointer at the ONE system it belongs to, in full. `LinkedSystem` is
|
|
39
|
+
* the wrong mechanism here: it exists for a design system partially borrowing PIECES of another
|
|
40
|
+
* (`link`, per-entity `options`, override/extend), and a canvas never does that — a node's `type`
|
|
41
|
+
* always resolves against the whole of exactly one system.
|
|
42
|
+
*
|
|
43
|
+
* The source is attached under the system config's own `name`, which is `system-config` for a web
|
|
44
|
+
* system and `react-native-system` for a native one, so a node ref the canvas mints
|
|
45
|
+
* (`component:actions/Button@system-config`) means "the attached system". The system itself resolves
|
|
46
|
+
* that ref as its own, through `Config.configFor`'s own-name rule.
|
|
47
|
+
*/
|
|
48
|
+
const SystemSource = defineEntity({
|
|
49
|
+
kind: "system-source",
|
|
50
|
+
fields: z.object({
|
|
51
|
+
/** Which system this is, for display and identity-change detection — not resolution itself,
|
|
52
|
+
* which happens through `registerSources`/`Config.load` the same way every source kind works. */
|
|
53
|
+
systemId: z.string().optional() }),
|
|
54
|
+
sourceIdentity: ["systemId"],
|
|
55
|
+
sourceResolution: {
|
|
56
|
+
resolved: z.object({ systemId: z.string().optional() }),
|
|
57
|
+
unavailable: z.object({
|
|
58
|
+
code: z.literal("not-found"),
|
|
59
|
+
systemId: z.string().optional()
|
|
60
|
+
})
|
|
61
|
+
},
|
|
62
|
+
linkable: false
|
|
63
|
+
});
|
|
64
|
+
/**
|
|
65
|
+
* `Canvas` — a surface in a design file (a design file has one or more). Pages belong to a canvas,
|
|
66
|
+
* nodes belong to a page (flat, ref-related, matching the real tables' `canvasId`/`pageId` columns).
|
|
67
|
+
*/
|
|
68
|
+
const Canvas = defineEntity({
|
|
69
|
+
kind: "canvas",
|
|
70
|
+
fields: z.object({ name: z.string().optional() })
|
|
71
|
+
});
|
|
72
|
+
/**
|
|
73
|
+
* `Page` — a page within a `Canvas`. Field-for-field the `canvas_pages` table (id → path,
|
|
74
|
+
* `canvasId` → the ref, timestamps DB-owned).
|
|
75
|
+
*/
|
|
76
|
+
const Page = defineEntity({
|
|
77
|
+
kind: "page",
|
|
78
|
+
fields: z.object({
|
|
79
|
+
canvas: Canvas,
|
|
80
|
+
name: z.string().optional(),
|
|
81
|
+
/** The page's URL segment — unique per canvas, the DB's `url_key`. */
|
|
82
|
+
urlKey: z.string().optional(),
|
|
83
|
+
/** No zod default — it would re-apply on any update that omits the field (see `Node.x`). */
|
|
84
|
+
sortOrder: z.number().optional()
|
|
85
|
+
})
|
|
86
|
+
});
|
|
87
|
+
/**
|
|
88
|
+
* `AiChat` — one conversation. Deliberately minimal: the transcript is the `AiMessage` rows that
|
|
89
|
+
* ref it (flat rows pointing at their owner, never an embedded array nothing can ref into).
|
|
90
|
+
*/
|
|
91
|
+
const AiChat = defineEntity({
|
|
92
|
+
kind: "ai-chat",
|
|
93
|
+
fields: z.object({ title: z.string().optional() }),
|
|
94
|
+
label: "AI chat",
|
|
95
|
+
linkable: false
|
|
96
|
+
});
|
|
97
|
+
/** `AiMessage` — one turn in an `AiChat`. */
|
|
98
|
+
const AiMessage = defineEntity({
|
|
99
|
+
kind: "ai-message",
|
|
100
|
+
fields: z.object({
|
|
101
|
+
chat: AiChat,
|
|
102
|
+
role: z.enum(["user", "assistant"]),
|
|
103
|
+
content: z.string(),
|
|
104
|
+
/** Which model produced this turn — assistant messages only; a user turn has none. Per message
|
|
105
|
+
* rather than per chat, because a conversation can switch models between turns. */
|
|
106
|
+
modelId: z.string().optional(),
|
|
107
|
+
/** Epoch ms — ordering within the chat. */
|
|
108
|
+
sentAt: z.number().optional()
|
|
109
|
+
}),
|
|
110
|
+
label: "AI message",
|
|
111
|
+
linkable: false
|
|
112
|
+
});
|
|
113
|
+
/**
|
|
114
|
+
* `AiFlow` — the invocation that produced one or more generations: which surface it started from,
|
|
115
|
+
* which model ran, how the agents were arranged, and — when it began as a chat turn — the message
|
|
116
|
+
* that kicked it off. One flow can produce several nodes (a fanout literally does), so it is its
|
|
117
|
+
* own entity rather than columns repeated per node.
|
|
118
|
+
*/
|
|
119
|
+
const aiFlowOrigin = z.enum([
|
|
120
|
+
"chat",
|
|
121
|
+
"comment",
|
|
122
|
+
"sidebar",
|
|
123
|
+
"paste",
|
|
124
|
+
"figma-paste",
|
|
125
|
+
"duplicate",
|
|
126
|
+
"mcp"
|
|
127
|
+
]);
|
|
128
|
+
const aiMultiAgentMode = z.enum([
|
|
129
|
+
"single",
|
|
130
|
+
"huddle",
|
|
131
|
+
"fanout"
|
|
132
|
+
]);
|
|
133
|
+
const AiFlow = defineEntity({
|
|
134
|
+
kind: "ai-flow",
|
|
135
|
+
fields: z.object({
|
|
136
|
+
origin: aiFlowOrigin,
|
|
137
|
+
lane: z.enum(AI_LANES).optional(),
|
|
138
|
+
modelId: z.string().optional(),
|
|
139
|
+
multiAgentMode: aiMultiAgentMode.optional(),
|
|
140
|
+
agentCount: z.number().optional(),
|
|
141
|
+
agentNames: z.array(z.string()).optional(),
|
|
142
|
+
/** The chat turn this flow answered, when `origin` is a conversation surface. */
|
|
143
|
+
message: AiMessage.optional()
|
|
144
|
+
}),
|
|
145
|
+
label: "AI flow",
|
|
146
|
+
linkable: false
|
|
147
|
+
});
|
|
148
|
+
/**
|
|
149
|
+
* `AiGeneration` — how one node came to exist: the flow that produced it, and — for an iteration —
|
|
150
|
+
* the lineage it varied from, as a real graph edge. Replaces the `canvas_nodes` table's
|
|
151
|
+
* `generation_*` and `iteration_meta` columns, which all describe this one event.
|
|
152
|
+
*/
|
|
153
|
+
const AiGeneration = defineEntity({
|
|
154
|
+
kind: "ai-generation",
|
|
155
|
+
fields: z.object({
|
|
156
|
+
flow: AiFlow.optional(),
|
|
157
|
+
/** Iteration lineage — the node this generation varied from. Spelled as the ref shape rather
|
|
158
|
+
* than the `Node` entity class, which is defined below this and would be a forward cycle. */
|
|
159
|
+
parentNode: z.object({ __ref: z.string().startsWith("node:") }).optional(),
|
|
160
|
+
iterationNumber: z.number().optional(),
|
|
161
|
+
description: z.string().optional(),
|
|
162
|
+
instructions: z.string().optional(),
|
|
163
|
+
generatedAt: z.number().optional()
|
|
164
|
+
}),
|
|
165
|
+
label: "AI generation",
|
|
166
|
+
linkable: false
|
|
167
|
+
});
|
|
168
|
+
/**
|
|
169
|
+
* What a node or subtree element renders — a union of the kinds a spec `type` may name, each typed
|
|
170
|
+
* by its own entity class (an entity class IS its kind's ref schema), never a bare string. Two arms
|
|
171
|
+
* have no entity behind them yet, so the ref spells the grammar alone:
|
|
172
|
+
*
|
|
173
|
+
* - `html:` — an intrinsic tag (`html:div`); a real kind is deferred (design doc, Platform).
|
|
174
|
+
* - `spec:` — the spec format's own renderer primitives, `spec:Slot` (a content hole — the
|
|
175
|
+
* placeholder a slot-fill drop creates, `shown` as a plain prop) and `spec:Fragment`. These are
|
|
176
|
+
* json-render/UDS-renderer supplied (`wrapRegistry` seeds both), never a system's vocabulary.
|
|
177
|
+
*
|
|
178
|
+
* json-render's remaining `UIElement` surface (`on`/`repeat`/`watch`) is deliberately absent — the
|
|
179
|
+
* data-binding extension the design doc scopes as not started.
|
|
180
|
+
*/
|
|
181
|
+
const elementType = z.union([
|
|
182
|
+
Component,
|
|
183
|
+
Icon,
|
|
184
|
+
Package,
|
|
185
|
+
z.object({ __ref: z.string().startsWith("html:") }),
|
|
186
|
+
z.object({ __ref: z.enum(["spec:Slot", "spec:Fragment"]) })
|
|
187
|
+
]);
|
|
188
|
+
/** A ref to another node. `z.lazy` because `Node` is a SELF-reference — it isn't defined until the
|
|
189
|
+
* `defineEntity` call below returns, and the explicit annotation breaks the circular type
|
|
190
|
+
* inference (same pattern `Token`'s self-referencing value uses). */
|
|
191
|
+
const nodeRef = z.lazy(() => Node);
|
|
192
|
+
/** A placed node's frame size — freeform, or powered by a system device. */
|
|
193
|
+
const Size = z.discriminatedUnion("type", [z.object({
|
|
194
|
+
type: z.literal("custom"),
|
|
195
|
+
width: z.number(),
|
|
196
|
+
height: z.number()
|
|
197
|
+
}), z.object({
|
|
198
|
+
type: z.literal("device"),
|
|
199
|
+
ref: Device
|
|
200
|
+
})]);
|
|
201
|
+
/**
|
|
202
|
+
* `Node` — the unit of a canvas: one element, one record, one row. FLAT — a subtree node is its own
|
|
203
|
+
* item nested under its placed root's id (`n1/badge`), and `children`/`slots` hold real node refs,
|
|
204
|
+
* so `dependents()`, delete-refusal and rename-cascade come from the framework instead of
|
|
205
|
+
* `reKeySlotRefs` (UDS-3526) / `gcUnreachableElements` (UDS-3557) hand-rolling them per gesture.
|
|
206
|
+
*
|
|
207
|
+
* Placement fields are present on a PLACED node (`page` is the discriminant — what the canvas lists
|
|
208
|
+
* and react-flow wraps) and absent on subtree nodes. `type` is optional for exactly one reason: a
|
|
209
|
+
* placed node awaiting its first generation (today's skeleton / pending placeholder) exists before
|
|
210
|
+
* anyone knows what it renders.
|
|
211
|
+
*/
|
|
212
|
+
const Node = defineEntity({
|
|
213
|
+
kind: "node",
|
|
214
|
+
fields: z.object({
|
|
215
|
+
/** A real ref, never a bare name — dependents()/rename-cascade need a real edge, and a bare
|
|
216
|
+
* `kind:path` string the framework never walks gives neither. Absent only on a placeholder
|
|
217
|
+
* awaiting generation. */
|
|
218
|
+
type: elementType.optional(),
|
|
219
|
+
props: z.record(z.string(), z.unknown()).optional(),
|
|
220
|
+
/** The default slot's fill — refs to this node's subtree nodes. */
|
|
221
|
+
children: z.array(nodeRef).describe("Refs to this node's subtree nodes. A child's path nests under this node's root path, such as \"card/title\" under \"card\".").optional(),
|
|
222
|
+
/** Named slots — never folded into `props`; see symptom 5 in the design doc for why. */
|
|
223
|
+
slots: z.record(z.string(), z.array(nodeRef)).describe("Named slot fills, each a list of refs to this node's subtree nodes. A fill's path nests under this node's root path, such as \"card/footer-badge\" under \"card\".").optional(),
|
|
224
|
+
/** json-render's own visibility grammar, borrowed rather than reinvented. */
|
|
225
|
+
visible: z.unknown().optional(),
|
|
226
|
+
/** json-render's repeat grammar — carried opaquely; the data-binding extension the design doc
|
|
227
|
+
* scopes as not started would give its refs real edges. */
|
|
228
|
+
repeat: z.unknown().optional(),
|
|
229
|
+
/** An element-level linked reference (studio's `ElementRef`): this element follows an element
|
|
230
|
+
* of another node, diverging only by its overrides. Opaque here — its `sourceId`/`sourceKey`
|
|
231
|
+
* are resolved by the canvas's linked-copy machinery, not the ref graph; modeling them as real
|
|
232
|
+
* refs is an open follow-up. */
|
|
233
|
+
ref: z.unknown().optional(),
|
|
234
|
+
/** The layers rail's lock on this element: the canvas stops hit-testing it and everything
|
|
235
|
+
* beneath it, while the rail can still select it to unlock. */
|
|
236
|
+
locked: z.boolean().optional(),
|
|
237
|
+
/** The element's name in the layers rail. On a placed node it is the node's own name, which the
|
|
238
|
+
* rename gesture writes and a spec write leaves alone; on a subtree node it travels with the
|
|
239
|
+
* element. */
|
|
240
|
+
label: z.string().optional(),
|
|
241
|
+
page: Page.optional(),
|
|
242
|
+
/** The placed node this one nests inside on the CANVAS (react-flow parent/grouping) — a
|
|
243
|
+
* different relation from `children`, which is render containment. */
|
|
244
|
+
parent: nodeRef.optional(),
|
|
245
|
+
size: Size.optional(),
|
|
246
|
+
x: z.number().optional(),
|
|
247
|
+
y: z.number().optional(),
|
|
248
|
+
collapsed: z.boolean().optional(),
|
|
249
|
+
/** Stacking rank among the page's frames (the legacy `spec.order`). Placed nodes only. */
|
|
250
|
+
order: z.number().optional(),
|
|
251
|
+
/** A node-level linked-copy descriptor (studio's `LinkedSource`): this node renders another
|
|
252
|
+
* node's subtree with overrides. Opaque, same reasoning as `ref`. */
|
|
253
|
+
linkedSource: z.unknown().optional(),
|
|
254
|
+
/** The spec's state model (`spec.state`) — the data-binding surface, carried opaquely until
|
|
255
|
+
* config-v2 models state paths. Placed nodes only. */
|
|
256
|
+
state: z.record(z.string(), z.unknown()).optional(),
|
|
257
|
+
/** The spec's own `meta` bag. Placed nodes only. */
|
|
258
|
+
meta: z.record(z.string(), z.unknown()).optional(),
|
|
259
|
+
/** How this node came to exist, when AI produced it. */
|
|
260
|
+
generation: AiGeneration.optional(),
|
|
261
|
+
/** The placed node this one was duplicated from, when it lives on the same canvas. */
|
|
262
|
+
duplicatedFrom: nodeRef.optional()
|
|
263
|
+
}),
|
|
264
|
+
computed: {
|
|
265
|
+
/**
|
|
266
|
+
* What a layers rail (or any listing) calls this node: its authored
|
|
267
|
+
* `label`, else what its `type` names — the component's own display label,
|
|
268
|
+
* resolved through the same path everything else resolves refs by, so a
|
|
269
|
+
* `kind:` marker never reaches a person. A placeholder awaiting generation
|
|
270
|
+
* (no `type` yet) and a linked copy (a descriptor, no `type` of its own)
|
|
271
|
+
* have no name here; the surface falls back to what it can resolve.
|
|
272
|
+
*
|
|
273
|
+
* The read type intersects this with the base `Entity.displayLabel`, which
|
|
274
|
+
* is never `undefined`, so the intersection reads as `string`. The canvas
|
|
275
|
+
* node view re-types the field optional at its seam.
|
|
276
|
+
*/
|
|
277
|
+
displayLabel: ({ member, config }) => {
|
|
278
|
+
const label = member.label;
|
|
279
|
+
if (typeof label === "string" && label.trim().length > 0) return label;
|
|
280
|
+
if (member.linkedSource != null) return void 0;
|
|
281
|
+
const type = member.type;
|
|
282
|
+
return type ? config.displayLabelOf(type) : void 0;
|
|
283
|
+
} }
|
|
284
|
+
});
|
|
285
|
+
/**
|
|
286
|
+
* `CanvasConfig` — the design-file config TYPE. Owns placement, content, and AI provenance (flat,
|
|
287
|
+
* ref-related), DRAWS ON a system, and derives the same agent-tool catalog (`operation`/`tool`) as
|
|
288
|
+
* the system so its design-file CRUD tools project from it.
|
|
289
|
+
*
|
|
290
|
+
* A source, not a read-through window onto every one of the system's kinds. A node's `type` carries
|
|
291
|
+
* the source it points into (`component:actions/Button@<slug>`), so one resolution path serves both
|
|
292
|
+
* and nothing has to know that THIS config borrows a whole kind. Read-only stays read-only: a
|
|
293
|
+
* source's items resolve through their own config, so there is no local collection to offer CRUD
|
|
294
|
+
* over.
|
|
295
|
+
*/
|
|
296
|
+
const CanvasConfig = defineConfig({
|
|
297
|
+
name: "canvas",
|
|
298
|
+
entities: {
|
|
299
|
+
canvases: Canvas,
|
|
300
|
+
pages: Page,
|
|
301
|
+
nodes: Node,
|
|
302
|
+
chats: AiChat,
|
|
303
|
+
messages: AiMessage,
|
|
304
|
+
flows: AiFlow,
|
|
305
|
+
generations: AiGeneration,
|
|
306
|
+
systems: SystemSource
|
|
307
|
+
},
|
|
308
|
+
sources: { systems: () => System },
|
|
309
|
+
derivedEntities: {
|
|
310
|
+
operations: Operation,
|
|
311
|
+
tools: Tool
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
/**
|
|
315
|
+
* Build a plain (in-memory) canvas target: borrows the system read-only, under its own `name` as the
|
|
316
|
+
* slug, and seeds the canvas + page it starts with. Enough to project tools or run an eval; the
|
|
317
|
+
* live form is the studio session (`apps/studio/src/configs/canvas/canvas-session.ts`).
|
|
318
|
+
*/
|
|
319
|
+
function createCanvasConfig(system) {
|
|
320
|
+
return new CanvasConfig().register({
|
|
321
|
+
canvases: { main: {} },
|
|
322
|
+
pages: { home: { canvas: Canvas.ref("main") } },
|
|
323
|
+
nodes: {},
|
|
324
|
+
chats: {},
|
|
325
|
+
messages: {},
|
|
326
|
+
flows: {},
|
|
327
|
+
generations: {},
|
|
328
|
+
systems: { [system.name]: {} }
|
|
329
|
+
}).registerSources({ systems: { [system.name]: system } });
|
|
330
|
+
}
|
|
331
|
+
//#endregion
|
|
332
|
+
export { AiChat, AiFlow, AiGeneration, AiMessage, Canvas, CanvasConfig, Node, Page, SystemSource, createCanvasConfig };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/configs/build-options.d.ts
|
|
4
|
+
/** The section as a config that set nothing reads it, spelled once. */
|
|
5
|
+
declare const BUILD_DEFAULTS: {
|
|
6
|
+
readonly outDir: ".uds";
|
|
7
|
+
readonly registryDir: ".uds-registry";
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { BUILD_DEFAULTS };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/configs/build-options.ts
|
|
3
|
+
/**
|
|
4
|
+
* The `build` section's fields — where a repo keeps a system's sources, where the build writes, and
|
|
5
|
+
* where linked systems are materialised. Shared by the web and the native config type.
|
|
6
|
+
*
|
|
7
|
+
* Every field is optional and none carries a schema default. A stored body is exactly what was
|
|
8
|
+
* authored, so a default that changes later reaches every system that never set the field. The
|
|
9
|
+
* defaults live in {@link BUILD_DEFAULTS}, which the directory resolvers read.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* A directory INSIDE the project, refused at the point it is written.
|
|
13
|
+
*
|
|
14
|
+
* `outDir` is handed to `rmSync(dir, { recursive: true })` before every build, because a build
|
|
15
|
+
* cleans its own output. So a value that names the project root deletes the project, and one with a
|
|
16
|
+
* `..` in it deletes whatever is up there — from a field in a checked-in config file, which is a very
|
|
17
|
+
* different exposure from a `--output-dir` somebody typed.
|
|
18
|
+
*
|
|
19
|
+
* Refused here rather than at the delete, so a config carrying one never loads at all and the message
|
|
20
|
+
* names the field. The build keeps a second check anyway: this schema only sees a config that came
|
|
21
|
+
* through it, and an artifact can arrive from elsewhere.
|
|
22
|
+
*/
|
|
23
|
+
const insideProject = (field) => z.string().min(1).refine((value) => !value.startsWith("/") && !/^[A-Za-z]:/.test(value), { message: `\`${field}\` has to be relative to the config, not an absolute path.` }).refine((value) => {
|
|
24
|
+
const segments = value.replace(/\\/g, "/").split("/").filter((part) => part !== "");
|
|
25
|
+
return segments.length > 0 && !segments.every((part) => part === ".") && !segments.includes("..");
|
|
26
|
+
}, { message: `\`${field}\` has to name a directory inside the project — not \`.\`, and not one that climbs out with \`..\`.` });
|
|
27
|
+
/** The section as a config that set nothing reads it, spelled once. */
|
|
28
|
+
const BUILD_DEFAULTS = {
|
|
29
|
+
outDir: ".uds",
|
|
30
|
+
registryDir: ".uds-registry"
|
|
31
|
+
};
|
|
32
|
+
const buildFields = z.strictObject({
|
|
33
|
+
/**
|
|
34
|
+
* The directory every file this system seals must live under, relative to the config.
|
|
35
|
+
*
|
|
36
|
+
* Declared rather than inferred. Without it the boundary is guessed per file from the
|
|
37
|
+
* conventional `uds/components/` anchor, and a component that reaches a helper beside it —
|
|
38
|
+
* `../../shared/tone` from `src/uds/components`, an ordinary app layout — climbs out of a root
|
|
39
|
+
* nobody chose and cannot be mirrored into the output at all.
|
|
40
|
+
*
|
|
41
|
+
* Setting it also fixes the emitted layout: a module and the files it imports are both written
|
|
42
|
+
* relative to THIS directory, so the tree beneath it survives the move into {@link outDir} and a
|
|
43
|
+
* relative specifier still resolves. That is what makes reaching outside it the real error, rather
|
|
44
|
+
* than a guess about where the components root probably was.
|
|
45
|
+
*
|
|
46
|
+
* No default, and that is the answer rather than a missing one: unset, the anchor convention stands
|
|
47
|
+
* and the output layout is unchanged.
|
|
48
|
+
*/
|
|
49
|
+
inputDir: insideProject("inputDir").meta({
|
|
50
|
+
title: "Input directory",
|
|
51
|
+
description: "The directory every sealed component file lives under, relative to the config. Emitted modules keep the layout beneath it. Unset, the `uds/components/` folder convention applies."
|
|
52
|
+
}).optional(),
|
|
53
|
+
/** Where `uds build` writes. A CLI `--output-dir` still wins, because a one-off build into a
|
|
54
|
+
* scratch directory is not a property of the system. */
|
|
55
|
+
outDir: insideProject("outDir").meta({
|
|
56
|
+
title: "Output directory",
|
|
57
|
+
description: `Where \`uds build\` writes, relative to the config. The build cleans it before writing, so it has to stay inside the project. Unset, \`${BUILD_DEFAULTS.outDir}\`.`,
|
|
58
|
+
default: BUILD_DEFAULTS.outDir
|
|
59
|
+
}).optional(),
|
|
60
|
+
/** Where `uds pull` materializes linked-system sources — see `resolveRegistryDir`. */
|
|
61
|
+
registryDir: z.string().min(1).meta({
|
|
62
|
+
title: "Registry directory",
|
|
63
|
+
description: `Where \`uds pull\` places the sources of linked systems, relative to the config. Unset, \`${BUILD_DEFAULTS.registryDir}\`.`,
|
|
64
|
+
default: BUILD_DEFAULTS.registryDir
|
|
65
|
+
}).optional()
|
|
66
|
+
});
|
|
67
|
+
//#endregion
|
|
68
|
+
export { BUILD_DEFAULTS, buildFields };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Config } from "../framework/Config.js";
|
|
2
|
+
import { ReactNativeSystemConfig } from "./react-native-system.js";
|
|
3
|
+
import { SystemConfig } from "./system.js";
|
|
4
|
+
|
|
5
|
+
//#region src/configs/platform.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* A design system of either platform — what a holder declares when it draws on a system and has no
|
|
8
|
+
* reason to care which platform it is: the canvas, a session, a pipeline step.
|
|
9
|
+
*/
|
|
10
|
+
type AnySystemConfig = SystemConfig | ReactNativeSystemConfig;
|
|
11
|
+
declare function isNativeConfig(config: Config): boolean;
|
|
12
|
+
/** Whether a config is a design system at all, of either platform. A canvas config is not. */
|
|
13
|
+
declare function isSystemConfig(config: Config): config is AnySystemConfig;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { AnySystemConfig, isNativeConfig, isSystemConfig };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/configs/platform.ts
|
|
2
|
+
/**
|
|
3
|
+
* The names `System` and `ReactNativeSystem` declare themselves under. Held here rather than read
|
|
4
|
+
* off the classes so this module imports nothing at runtime: an entity module can ask which platform
|
|
5
|
+
* a config is without pulling in the config type that registers it, which would close an import cycle.
|
|
6
|
+
*/
|
|
7
|
+
const WEB_CONFIG_NAME = "system-config";
|
|
8
|
+
const NATIVE_CONFIG_NAME = "react-native-system";
|
|
9
|
+
function isNativeConfig(config) {
|
|
10
|
+
return config.name === NATIVE_CONFIG_NAME;
|
|
11
|
+
}
|
|
12
|
+
/** Whether a config is a design system at all, of either platform. A canvas config is not. */
|
|
13
|
+
function isSystemConfig(config) {
|
|
14
|
+
return config.name === "system-config" || config.name === "react-native-system";
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { NATIVE_CONFIG_NAME, WEB_CONFIG_NAME, isNativeConfig, isSystemConfig };
|