@yahoo/uds-create-config 2.45.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,296 @@
|
|
|
1
|
+
import { Config } from "./Config.js";
|
|
2
|
+
import { StateCondition } from "@json-render/core";
|
|
3
|
+
|
|
4
|
+
//#region src/framework/render-spec.d.ts
|
|
5
|
+
/** A node in a flat render spec — json-render's own shape, which is what a canvas paints.
|
|
6
|
+
*
|
|
7
|
+
* Distinct from {@link import('./validate-spec').SpecNode}, the NESTED form a design file authors
|
|
8
|
+
* and `validateSpec` checks: that one is a tree of instances a person composed, this one is the
|
|
9
|
+
* flat `elements` map a renderer walks. */
|
|
10
|
+
interface RenderElement {
|
|
11
|
+
readonly type: string;
|
|
12
|
+
readonly props?: Record<string, unknown>;
|
|
13
|
+
readonly children?: string[];
|
|
14
|
+
/** json-render's own slot grammar: slot name → the element keys that fill it. */
|
|
15
|
+
readonly slots?: Record<string, string[]>;
|
|
16
|
+
/** json-render's own visibility grammar, borrowed rather than reinvented. Left `unknown` because a
|
|
17
|
+
* json-render `Spec` is read through this type too, and its grammar has `$item`, `$index` and
|
|
18
|
+
* `$and` arms the entity refuses. */
|
|
19
|
+
readonly visible?: unknown;
|
|
20
|
+
}
|
|
21
|
+
interface RenderSpec {
|
|
22
|
+
readonly root: string;
|
|
23
|
+
readonly elements: Record<string, RenderElement>;
|
|
24
|
+
}
|
|
25
|
+
/** What a build produces per component: the anatomy, and the tile a catalogue shows. */
|
|
26
|
+
interface ComponentSpecs {
|
|
27
|
+
readonly render?: RenderSpec;
|
|
28
|
+
readonly preview?: RenderSpec;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The node a tree ENTERS at — the one nothing else claims as a child.
|
|
32
|
+
*
|
|
33
|
+
* A name can't answer this. `root` names the root LAYER, and a render is free to put a wrapper above
|
|
34
|
+
* that layer — a menu provider, a positioner, a portal — so the layer is somewhere in the middle of
|
|
35
|
+
* its own tree. Entering by name amputated every ancestor: the tree rendered without the provider
|
|
36
|
+
* that its own descendants read from, and those descendants threw on the first paint.
|
|
37
|
+
*
|
|
38
|
+
* Structure states it instead, and in a whole tree exactly one node is unclaimed. Two or more is a
|
|
39
|
+
* FOREST — a reader that couldn't finish, or a condition that left siblings with no parent — and then
|
|
40
|
+
* the component is whichever of them holds most of it: the strays get dropped either way, and
|
|
41
|
+
* dropping the real tree to render a stray leaf is the worse of the two. Nothing unclaimed at all
|
|
42
|
+
* (a cycle) falls back to the name, which is the best a malformed tree deserves.
|
|
43
|
+
*/
|
|
44
|
+
declare function entryKeyOf(nodes: Record<string, {
|
|
45
|
+
readonly children?: readonly string[];
|
|
46
|
+
readonly slots?: Record<string, string[]>;
|
|
47
|
+
} | undefined>): string;
|
|
48
|
+
/**
|
|
49
|
+
* A component's anatomy, projected to the json-render spec a canvas reads.
|
|
50
|
+
*
|
|
51
|
+
* The artifact's SOURCE changes and its shape does not: `element` becomes `type` and a ref
|
|
52
|
+
* serializes to its string form, while `children` / `visible` / `text` pass through, since those
|
|
53
|
+
* were borrowed from json-render's own vocabulary rather than invented.
|
|
54
|
+
*
|
|
55
|
+
* A component with no stored anatomy but ONE layer is still answered outright — it is one element,
|
|
56
|
+
* and that was always stated rather than run.
|
|
57
|
+
*/
|
|
58
|
+
declare function deriveSpec(config: Config, path: string): RenderSpec | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* ONE COMPONENT, as a spec — the instance form, and the only place the `component:` prefix is minted.
|
|
61
|
+
*
|
|
62
|
+
* A spec type is `kind:identity`, always: the emitted registry keys every entry that way and holds
|
|
63
|
+
* no bare names, so `Box` resolves to nothing while `component:Box` resolves to the module. That
|
|
64
|
+
* makes the prefix load-bearing rather than decorative, and something load-bearing spelled by
|
|
65
|
+
* string-concatenation at each site is a spelling waiting to drift — three places in this file did
|
|
66
|
+
* it, and a consumer that wanted the same shape had no choice but to add a fourth.
|
|
67
|
+
*
|
|
68
|
+
* So consumers ask for the SHAPE instead of assembling it, and the type itself comes from `ref` —
|
|
69
|
+
* the same maker `Component.ref` is bound to — rather than a template. A caller outside this
|
|
70
|
+
* package has no business knowing the prefix at all.
|
|
71
|
+
*/
|
|
72
|
+
declare function instanceSpec(path: string, props?: Record<string, unknown>): RenderSpec;
|
|
73
|
+
/** A component's spec, and WHICH OF THE TWO it is. */
|
|
74
|
+
interface ComponentSpec {
|
|
75
|
+
readonly spec: RenderSpec;
|
|
76
|
+
/**
|
|
77
|
+
* What `spec` describes — the component's own structure, or the component as one element.
|
|
78
|
+
*
|
|
79
|
+
* `'composition'` is its internal tree, so an editor may author it. `'leaf'` is the component
|
|
80
|
+
* itself, correct to paint but with no tree in it: an editor offering composition tools against one
|
|
81
|
+
* would be offering to restructure something it cannot see.
|
|
82
|
+
*
|
|
83
|
+
* Not a capability claim, because two different ones already read as that and neither is this.
|
|
84
|
+
* Whether a component ACCEPTS CHILDREN is `childrenPolicy` (`'none' | 'text' | 'nodes'`), and it is
|
|
85
|
+
* orthogonal — a `div`-rooted component with layers and no anatomy takes nodes while having no tree
|
|
86
|
+
* to show, and a void-rooted one can project a tree and accept nothing.
|
|
87
|
+
*/
|
|
88
|
+
readonly kind: 'composition' | 'leaf';
|
|
89
|
+
/** Why the composition isn't shown, for a surface to say so. Absent when it is. */
|
|
90
|
+
readonly reason?: string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The spec for a component, ALWAYS — the leaf form when its composition doesn't project.
|
|
94
|
+
*
|
|
95
|
+
* `deriveSpec` declines rather than guess, and that is right: a tree missing a node is worse than an
|
|
96
|
+
* admission that it can't be built. But a caller still has to paint something, and the honest thing to
|
|
97
|
+
* paint is the component ITSELF — one element, `component:<path>`, which the renderer resolves to the
|
|
98
|
+
* real module with whatever its render closes over intact. That is strictly better than the previous
|
|
99
|
+
* fallback (a spec captured by an earlier build), which showed a structure the config no longer
|
|
100
|
+
* describes and let an editor author against it.
|
|
101
|
+
*
|
|
102
|
+
* So the two answers are separated: what to RENDER (always available) and WHICH of the two it is. A
|
|
103
|
+
* surface reads `kind` to decide whether to offer composition tools, and `reason` to explain why not.
|
|
104
|
+
*/
|
|
105
|
+
declare function componentSpec(config: Config, path: string): ComponentSpec;
|
|
106
|
+
/**
|
|
107
|
+
* A component as it is SHOWN — itself, in the example state its author wrote.
|
|
108
|
+
*
|
|
109
|
+
* The sibling above answers "what is this made of", and that is the question a layer panel and a
|
|
110
|
+
* variant matrix ask. A catalogue card, a palette card and a docs thumbnail ask the other one, and
|
|
111
|
+
* answering them with a composition is what left those tiles wrong: {@link deriveSpec} reads anatomy
|
|
112
|
+
* off the render's JSX STATICALLY, without the preview's props, so a prop-driven branch arrives as an
|
|
113
|
+
* unresolved `$state` condition and prop-driven text doesn't arrive at all. The tile painted the
|
|
114
|
+
* structure with its example content missing.
|
|
115
|
+
*
|
|
116
|
+
* One element, always, whatever the component is made of — because WHO DRAWS IT isn't this
|
|
117
|
+
* projection's call. A built component is in the renderer's registry, so the element resolves to its
|
|
118
|
+
* real module and is handed the example props directly. One created in Studio isn't, so
|
|
119
|
+
* {@link expandSpec} replaces it with the tree the config describes, resolving those same props'
|
|
120
|
+
* conditions and bound elements on the way. Both paths exist already; emitting the component and
|
|
121
|
+
* letting the renderer choose is what reaches them.
|
|
122
|
+
*
|
|
123
|
+
* Only the preview's props. A component's `defaultProps` are already folded into its layer's
|
|
124
|
+
* zero-specificity rule at build time, so seeding them here would re-apply as an instance's style
|
|
125
|
+
* props what the stylesheet has said once already.
|
|
126
|
+
*
|
|
127
|
+
* One stored preview value is not a prop yet: JSX such as `startIcon: <Icon/>` crosses config.json as
|
|
128
|
+
* a `PreviewElement` data marker. It is lowered here into the native `slots` + keyed-element form a
|
|
129
|
+
* spec authors directly. That makes this projection render-ready for every host instead of relying on
|
|
130
|
+
* a Studio-only registry wrapper to revive the marker later.
|
|
131
|
+
*/
|
|
132
|
+
declare function previewSpec(config: Config, path: string): RenderSpec | undefined;
|
|
133
|
+
interface ExpandOptions {
|
|
134
|
+
/**
|
|
135
|
+
* The spec `type`s the renderer already has a component for — in practice the keys of the
|
|
136
|
+
* codegen-emitted registry.
|
|
137
|
+
*
|
|
138
|
+
* A component in this set is LEFT NAMED, deliberately: its emitted module is the real thing, with
|
|
139
|
+
* whatever its render closes over (a hook, a context, an event handler) intact, and re-deriving it
|
|
140
|
+
* from data would be a worse copy of something that already exists. Expansion is for what the
|
|
141
|
+
* registry CAN'T name — which is exactly a component whose structure is data and whose module was
|
|
142
|
+
* never built.
|
|
143
|
+
*
|
|
144
|
+
* Omitted, everything the config describes expands, which is what a test wants and what a caller
|
|
145
|
+
* with no registry to consult gets.
|
|
146
|
+
*/
|
|
147
|
+
readonly rendered?: ReadonlySet<string>;
|
|
148
|
+
}
|
|
149
|
+
interface ExpansionResult {
|
|
150
|
+
readonly spec: RenderSpec;
|
|
151
|
+
/** Types left in place that neither the registry nor the config can draw — each would paint
|
|
152
|
+
* nothing, so a caller can surface them instead of showing a hole. */
|
|
153
|
+
readonly unresolved: readonly string[];
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Resolve every element's `visible` CONDITION against a prop bag, leaving a plain boolean.
|
|
157
|
+
*
|
|
158
|
+
* json-render evaluates the condition itself at render time, so this changes nothing about what
|
|
159
|
+
* paints. What it changes is what the spec can be ASKED: an unresolved `{ $state: '/startIcon' }`
|
|
160
|
+
* says only "it depends", where `false` says "this draws nothing", and a reader that has to decide
|
|
161
|
+
* whether a container is empty needs the second.
|
|
162
|
+
*
|
|
163
|
+
* That reader is the UDS renderer. A container whose children all draw nothing must fall back to its
|
|
164
|
+
* `props.children` label — and with the condition unresolved it could not tell, so every `Button`
|
|
165
|
+
* cell in the matrix rendered blank: the root lists `startIcon`/`endIcon`, and an unset icon is a
|
|
166
|
+
* node whose condition is false. `expandSpec` already resolves visibility for an INSTANCE; this is
|
|
167
|
+
* the same answer for a spec rendered as the component's own anatomy, where the caller supplies the
|
|
168
|
+
* state instead of an instance.
|
|
169
|
+
*
|
|
170
|
+
* A condition that does not resolve is left exactly as it was, so nothing is claimed about it.
|
|
171
|
+
*/
|
|
172
|
+
declare function specWithResolvedVisibility(spec: RenderSpec, state: Record<string, unknown>): RenderSpec;
|
|
173
|
+
/** The comparison a `$state` test can make: json-render's own operator set, minus the state pointer
|
|
174
|
+
* and the `not` modifier. Typed off the library so an operator it adds is a typecheck failure here
|
|
175
|
+
* until {@link COMPARATORS} handles it. */
|
|
176
|
+
type VisibilityOperator = Exclude<keyof StateCondition, '$state' | 'not'>;
|
|
177
|
+
/** A value in json-render's `visible` grammar, resolved against a prop bag. `undefined` when this
|
|
178
|
+
* reader can't settle it, which leaves the condition on the element for the renderer to judge. */
|
|
179
|
+
declare function resolveVisibility(condition: unknown, state: Record<string, unknown>): boolean | undefined;
|
|
180
|
+
/**
|
|
181
|
+
* Which PROPS a `visible` condition reads, in the order they appear.
|
|
182
|
+
*
|
|
183
|
+
* `resolveVisibility` answers "does this draw here"; this answers "what decides that" — the question
|
|
184
|
+
* an editor asks. A surface offering to bind visibility to a property needs to know whether one is
|
|
185
|
+
* already driving it, and a surface refusing an edit needs to name what to change instead of the
|
|
186
|
+
* layer. Both were guessing: the layers panel told an author to "switch to a matching cell" for a
|
|
187
|
+
* node gated on a slot being filled, where no cell in the matrix can ever match.
|
|
188
|
+
*
|
|
189
|
+
* Duplicates are collapsed, so a condition testing one prop twice reads as the one prop it is about.
|
|
190
|
+
*/
|
|
191
|
+
declare function visibilityStateProps(condition: unknown): string[];
|
|
192
|
+
/** One test a `visible` condition makes, in the terms an editor phrases it with. */
|
|
193
|
+
interface VisibilityTerm {
|
|
194
|
+
/** The prop the test reads, without the JSON-pointer slash. */
|
|
195
|
+
readonly prop: string;
|
|
196
|
+
/** `truthy` is the bare `{ $state }` form; the rest are json-render's comparison operators. */
|
|
197
|
+
readonly operator: VisibilityOperator | 'truthy';
|
|
198
|
+
/** The operand, absent for a truthiness test. */
|
|
199
|
+
readonly value?: unknown;
|
|
200
|
+
/** Whether the test carries `not: true`. */
|
|
201
|
+
readonly negated: boolean;
|
|
202
|
+
/** How this term joins the terms beside it: `and` for an array or `$and`, `or` inside `$or`. */
|
|
203
|
+
readonly junction: 'and' | 'or';
|
|
204
|
+
/** Which `$or` group the term belongs to. Members of one `$or` share an index; every term outside
|
|
205
|
+
* one has its own, so two `$or` groups side by side stay apart. */
|
|
206
|
+
readonly group: number;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* The tests a `visible` condition makes, in order, flattened to one list.
|
|
210
|
+
*
|
|
211
|
+
* `visibilityStateProps` names the props; this keeps what is asked of each one, so a surface can say
|
|
212
|
+
* "shows when `tone` is `danger`" rather than "follows `tone`". Grouping survives as `junction` and
|
|
213
|
+
* `group`: the stored grammar is an and-list whose entries are single tests or one `$or` each, so
|
|
214
|
+
* the two together are enough to read the condition back. A boolean or a shape this reader does not
|
|
215
|
+
* know yields no terms.
|
|
216
|
+
*/
|
|
217
|
+
declare function visibilityTerms(condition: unknown): VisibilityTerm[];
|
|
218
|
+
/**
|
|
219
|
+
* A `visible` condition with every bare truthiness test of `prop` taken out.
|
|
220
|
+
*
|
|
221
|
+
* Three answers: `undefined` for a condition that makes no such test, so a caller leaves the field
|
|
222
|
+
* alone; `null` when nothing survives the removal, which is the value that clears it; otherwise the
|
|
223
|
+
* condition that remains, unwrapped when one term is left.
|
|
224
|
+
*
|
|
225
|
+
* Only the bare form goes — `{ $state: '/prop' }` with no comparison and no `not`, which is the test
|
|
226
|
+
* a value being present answers. A `$or` group holding one goes whole, since a true member settles
|
|
227
|
+
* the group; its other members go with it, and moving the fill out later does not bring them back,
|
|
228
|
+
* which is also true of a bare gate. `$state` is matched without its JSON-pointer slash, so both
|
|
229
|
+
* spellings are the same test.
|
|
230
|
+
*/
|
|
231
|
+
declare function withoutTruthyTerm({
|
|
232
|
+
condition,
|
|
233
|
+
prop
|
|
234
|
+
}: {
|
|
235
|
+
condition: unknown;
|
|
236
|
+
prop: string;
|
|
237
|
+
}): unknown;
|
|
238
|
+
/**
|
|
239
|
+
* The type a BOUND element resolves to, given the value its prop was handed.
|
|
240
|
+
*
|
|
241
|
+
* This is the one thing json-render has no vocabulary for — `UIElement.type` is a plain string — so
|
|
242
|
+
* a stored spec can't hold it and `deriveSpec` declines. An expansion is a different position: the
|
|
243
|
+
* instance is right here, so the prop has a value, and the prop's own declaration says what domain
|
|
244
|
+
* that value is drawn from. `Icon` is the case that matters: one bound node, resolved per instance,
|
|
245
|
+
* rather than 51 conditioned siblings copying a library's index into every component that draws a
|
|
246
|
+
* glyph.
|
|
247
|
+
*
|
|
248
|
+
* Two ways the domain is known, in order: the prop DELEGATES it (`value` is a ref to the library,
|
|
249
|
+
* which is the shape that keeps 1,530 names in one place), or the prop enumerates its values and the
|
|
250
|
+
* member is found by asking which group declares it. The second exists because a config migrated
|
|
251
|
+
* from v1 spells an icon prop as an enumeration, and a glyph is no less resolvable for it.
|
|
252
|
+
*/
|
|
253
|
+
declare function boundElementType(config: Config, componentPath: string, prop: string, value: unknown): string | undefined;
|
|
254
|
+
/** Where one slot prop's content lands. */
|
|
255
|
+
interface SlotTarget {
|
|
256
|
+
/** The layer that holds the content. */
|
|
257
|
+
readonly layer: string;
|
|
258
|
+
/** The prop the content arrives as on the instance (`children`, `startIcon`). */
|
|
259
|
+
readonly from: string;
|
|
260
|
+
/** The prop it lands under on the layer — `children` unless the slot said otherwise. */
|
|
261
|
+
readonly into: string;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Where a component's slot props route their content, as the config states it.
|
|
265
|
+
*
|
|
266
|
+
* {@link expandInstance} has always known this; nothing outside this file could ask. A surface that
|
|
267
|
+
* needs the same answer had to guess from the spec's shape instead — "the one element carrying a
|
|
268
|
+
* string" — and a spec projected from the ANATOMY carries no strings at all, so the guess fell
|
|
269
|
+
* through to the root. For a component whose content slot NAMES its layer that is the wrong element
|
|
270
|
+
* AND an occupied one: the label lands beside the element children it was supposed to go inside, and
|
|
271
|
+
* the layer meant to hold it renders empty. Every one of Studio's own components shaped that way
|
|
272
|
+
* (`Badge`, `StudioButton`, `Toggle`, …) painted as an empty shell in the component editor.
|
|
273
|
+
*
|
|
274
|
+
* Exported so the answer has ONE owner. An untargeted slot still resolves to the root here — that is
|
|
275
|
+
* `slotTargets`' rule, not a caller's assumption, and it is the same rule the expansion renders by.
|
|
276
|
+
*/
|
|
277
|
+
declare function slotTargetsOf(config: Config, path: string): SlotTarget[];
|
|
278
|
+
/**
|
|
279
|
+
* Expand every component element the renderer can't name into the tree it is made of.
|
|
280
|
+
*
|
|
281
|
+
* The spec's own keys are KEPT — an expanded instance's root is emitted under the key it already
|
|
282
|
+
* had, so a `slots` entry, a selection marker, or anything else that names an element by key
|
|
283
|
+
* still resolves. Only the nodes an expansion adds get new keys, namespaced under the instance they
|
|
284
|
+
* belong to.
|
|
285
|
+
*/
|
|
286
|
+
declare function expandSpec(config: Config, spec: RenderSpec, options?: ExpandOptions): ExpansionResult;
|
|
287
|
+
/**
|
|
288
|
+
* One component instance, expanded from nothing but the config — what a canvas paints for a
|
|
289
|
+
* component created in Studio.
|
|
290
|
+
*
|
|
291
|
+
* The single-element spec this starts from is what a design-file node amounts to, so this is
|
|
292
|
+
* {@link expandSpec} with the ceremony removed.
|
|
293
|
+
*/
|
|
294
|
+
declare function expandComponent(config: Config, path: string, props?: Record<string, unknown>, options?: ExpandOptions): ExpansionResult;
|
|
295
|
+
//#endregion
|
|
296
|
+
export { ComponentSpec, ComponentSpecs, ExpandOptions, ExpansionResult, RenderElement, RenderSpec, SlotTarget, VisibilityOperator, VisibilityTerm, boundElementType, componentSpec, deriveSpec, entryKeyOf, expandComponent, expandSpec, instanceSpec, previewSpec, resolveVisibility, slotTargetsOf, specWithResolvedVisibility, visibilityStateProps, visibilityTerms, withoutTruthyTerm };
|