@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,480 @@
|
|
|
1
|
+
import { Ref } from "./utils/refs.js";
|
|
2
|
+
import { ItemOf } from "./defineEntity.js";
|
|
3
|
+
import { Config } from "./Config.js";
|
|
4
|
+
import { StylePropLeaf, StyleProperty } from "../entities/system/StyleProperty.js";
|
|
5
|
+
|
|
6
|
+
//#region src/framework/projections.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* The variable namespace a linked system's entities are declared under, seen from `config`.
|
|
9
|
+
*
|
|
10
|
+
* Not the source's own prefix. That is a setting the source chose for itself and the one it gets for
|
|
11
|
+
* free is `uds`, so two pinned systems that both took the default would declare the same
|
|
12
|
+
* `--uds-color-brand` and the later `:root` would win — every ref through either pin painting one
|
|
13
|
+
* value, silently, because an over-declared custom property is not an error.
|
|
14
|
+
*
|
|
15
|
+
* The slug is the name that cannot collide: it is a key in the consuming config, unique there by
|
|
16
|
+
* construction, and already the only name resolution uses. So a borrowed variable lives in the
|
|
17
|
+
* consumer's namespace, qualified by the pin it came through.
|
|
18
|
+
*/
|
|
19
|
+
declare const sourceVarPrefix: (config: Config, slug: string) => string;
|
|
20
|
+
/**
|
|
21
|
+
* The CSS custom-property name for an entity — `--<prefix>-<group-kebabed>-<leaf>`.
|
|
22
|
+
*
|
|
23
|
+
* The group segment is kebab-cased and the leaf is not, which is not a stylistic choice: it's the
|
|
24
|
+
* shape the emitted stylesheet declares (`--{prefix}-{kebabCase(namespace)}-{safeTokenName(name)}`).
|
|
25
|
+
* Deriving it any other way produces a `var()` that resolves to nothing for any camelCase group.
|
|
26
|
+
*/
|
|
27
|
+
declare function cssVar(config: Config, _kind: string, path: string, varPrefix?: string): string;
|
|
28
|
+
/** `var(--…)` — the CSS reference to {@link cssVar}. */
|
|
29
|
+
declare function cssVarRef(config: Config, kind: string, path: string, varPrefix?: string): string;
|
|
30
|
+
/** The utility/class name for an entity — `<prefix>-<path-dashed>`. A class is one identifier, so
|
|
31
|
+
* whitespace in the path is written as a hyphen too; a composite or motion preset named with a space
|
|
32
|
+
* otherwise declares a rule no element's class list can match. */
|
|
33
|
+
declare function className(config: Config, _kind: string, path: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* A style prop's allowed values, flattened to concrete strings: literal keywords (`row`)
|
|
36
|
+
* pass through, and a token group ref (`ref('token', 'color')`) expands to every member
|
|
37
|
+
* Token's path (`color/brand`, `color/accent`, …) — the utility set the prop offers,
|
|
38
|
+
* kept in lockstep with the group instead of restated. A ref that names a single token
|
|
39
|
+
* resolves to just that path. Shared by codegen (utility emit) and the UI value picker so
|
|
40
|
+
* both offer the same set. Order follows the authored `values`, group members in store
|
|
41
|
+
* order. Unknown prop → `[]`.
|
|
42
|
+
*/
|
|
43
|
+
declare function stylePropValues(config: Config, path: string): string[];
|
|
44
|
+
/**
|
|
45
|
+
* One allowed value of a style prop as both halves: the `leaf` a consumer authors (`warning`,
|
|
46
|
+
* `carbon/2` — the member path with the bound group's prefix stripped) and the `value` it resolves
|
|
47
|
+
* to for storage/CSS (the qualified token path `color/warning`, or a literal keyword `row`). A group
|
|
48
|
+
* ref (`token('color')`) expands to one entry per member; a literal keyword is its own leaf+value;
|
|
49
|
+
* a single-token ref keeps its name as the leaf. This is the leaf↔qualified reverse map the old
|
|
50
|
+
* Config had (`allowedValues().tokens = token.name` + `accepts(token.name)`) that config-v2 dropped.
|
|
51
|
+
*/
|
|
52
|
+
/** One allowed value of a style prop as both halves, the entity's own {@link StylePropLeaf}. */
|
|
53
|
+
type StylePropEntry = StylePropLeaf;
|
|
54
|
+
/** The leaf value domain a ref offers — for any group-bound prop (composite/variant).
|
|
55
|
+
*
|
|
56
|
+
* Takes the ref itself, not its parts. A caller holding `token:palette@ds` has the whole address; a
|
|
57
|
+
* signature that took it apart made every call site split one by hand, and the three that did
|
|
58
|
+
* disagreed about whether the `@source` survived the trip — which decides which config the members
|
|
59
|
+
* come from. */
|
|
60
|
+
declare function memberLeaves(config: Config, target: string | Ref): string[];
|
|
61
|
+
/** Resolve a group-bound leaf back to its qualified path (`display2` → `textVariant/display2`).
|
|
62
|
+
* `undefined` when the leaf isn't a member — what validation rejects. */
|
|
63
|
+
declare function memberFromLeaf(config: Config, target: string | Ref, leaf: string): string | undefined;
|
|
64
|
+
declare function stylePropEntries(config: Config, path: string): StylePropEntry[];
|
|
65
|
+
/**
|
|
66
|
+
* A style prop's leaf value domain — what a consumer/model actually authors (`warning`, `carbon/2`),
|
|
67
|
+
* not the qualified storage path (`color/warning`). This is what the catalog, `uds_get_component`,
|
|
68
|
+
* `uds_validate_props`, and the UI picker should offer, so the model emits `color="warning"`.
|
|
69
|
+
*/
|
|
70
|
+
declare function stylePropValueLeaves(config: Config, path: string): string[];
|
|
71
|
+
/**
|
|
72
|
+
* Resolve a style-prop leaf value back to its qualified token path (or literal) — the inverse of
|
|
73
|
+
* {@link stylePropValueLeaves}, for validating + rendering an authored `bg="subtle"`. `undefined`
|
|
74
|
+
* when the leaf isn't in the prop's domain.
|
|
75
|
+
*/
|
|
76
|
+
declare function stylePropValueFromLeaf(config: Config, path: string, leaf: string): string | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* The token a style-prop leaf binds, as a qualified path — `('bg', 'brand')` → `color/brand`.
|
|
79
|
+
* `undefined` when the leaf is a keyword the system declared rather than a token (`row`,
|
|
80
|
+
* `flex-start`), or isn't in the prop's domain at all.
|
|
81
|
+
*
|
|
82
|
+
* The pair below is what lets a bag store the binding as a ref while an author keeps writing the
|
|
83
|
+
* leaf: this direction mints the ref at parse time, {@link stylePropLeafForToken} reads it back for
|
|
84
|
+
* the class name. Narrowed to values that actually resolve as tokens, so a keyword is left as the
|
|
85
|
+
* string it is — a ref to a token that doesn't exist would be a dangling edge, which is worse than
|
|
86
|
+
* the missing one it replaced.
|
|
87
|
+
*/
|
|
88
|
+
declare function stylePropTokenPath(config: Config, path: string, leaf: string): string | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* The leaf a style prop calls a token — `('bg', 'color/brand')` → `brand`. The read twin of
|
|
91
|
+
* {@link stylePropTokenPath}, and the reason storing the ref costs no reader its class name.
|
|
92
|
+
*
|
|
93
|
+
* Not `refLeaf`: that strips one path segment, which is right for a variant value
|
|
94
|
+
* (`value:variant/solid`) and wrong here, because a prop's token group can be several segments deep
|
|
95
|
+
* (`spectrum/blue/1` under group `spectrum/blue` is the leaf `1`, not `blue/1`). The group is a fact
|
|
96
|
+
* about the prop's domain, so only the domain can say where the leaf starts.
|
|
97
|
+
*
|
|
98
|
+
* First match wins, the same way {@link stylePropValueFromLeaf} resolves the other direction — a
|
|
99
|
+
* prop binding two groups that share a value already lets authored order decide.
|
|
100
|
+
*/
|
|
101
|
+
declare function stylePropLeafForToken(config: Config, path: string, tokenPath: string): string | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* The leaf an author wrote for a stored ref in a bag — the read side of the binding
|
|
104
|
+
* `value-domain.ts` performs on the way in.
|
|
105
|
+
*
|
|
106
|
+
* Two cases, because where the leaf starts differs:
|
|
107
|
+
*
|
|
108
|
+
* - a token is reached through a style property, whose domain decides how much of the path is the
|
|
109
|
+
* group. `spectrum/blue/1` under the group `spectrum/blue` is the leaf `1`, so the property's own
|
|
110
|
+
* domain is the only thing that can say — hence the lookup rather than trimming a segment.
|
|
111
|
+
* - anything else (a composite member, a motion preset) is named under the group its prop points at,
|
|
112
|
+
* and the authored name is the last segment. This holds for a nested group too: `overlays/elev/1`
|
|
113
|
+
* under `overlays/elev` is `1`.
|
|
114
|
+
*
|
|
115
|
+
* `undefined` when the ref isn't one a bag value could have been authored as, so the caller leaves it
|
|
116
|
+
* alone rather than inventing a name for it.
|
|
117
|
+
*/
|
|
118
|
+
declare function authoredValue(config: Config, key: string, value: unknown): unknown;
|
|
119
|
+
/**
|
|
120
|
+
* A style bag as a surface reads it — every token binding read back to the leaf an author wrote.
|
|
121
|
+
*
|
|
122
|
+
* The inverse of the parse-time binding (`bindBagTokens` on `Component`), and the one place that
|
|
123
|
+
* inverse lives: a bag is stored with refs so the dependency graph sees the edges, while every
|
|
124
|
+
* consumer that renders, edits, or bakes one wants the leaf. Two implementations of this would be two
|
|
125
|
+
* chances to disagree about what a value is called — and the panel and the native theme disagreeing
|
|
126
|
+
* about that is exactly the class of bug the single description is meant to remove.
|
|
127
|
+
*
|
|
128
|
+
* Recurses into modifier blocks, since their values are values too. Returns the bag it was given when
|
|
129
|
+
* nothing was bound, so an untouched bag keeps its identity.
|
|
130
|
+
*/
|
|
131
|
+
declare function authoredBag(config: Config, bag: Record<string, unknown>): Record<string, unknown>;
|
|
132
|
+
/** One resolved style property, as a nameable type — what these lookups hand back. */
|
|
133
|
+
type StylePropertyItem = ItemOf<typeof StyleProperty>;
|
|
134
|
+
/**
|
|
135
|
+
* The style property a prop on `elementType` writes through.
|
|
136
|
+
*
|
|
137
|
+
* Two questions get asked of a config constantly — *what CSS does this prop on this element write?*
|
|
138
|
+
* and *which prop writes this CSS?* — and both have to be answered from the config rather than from a
|
|
139
|
+
* prop's name: `spacingX` in one system is `spacingHorizontal` in the next, so CSS is the stable
|
|
140
|
+
* contract between them.
|
|
141
|
+
*
|
|
142
|
+
* One `StyleProperty` read on top of {@link stylePropertyPathFor}, which is where the routing lives:
|
|
143
|
+
* the component's own table where it declares the prop, the name where it doesn't — which is what an
|
|
144
|
+
* element styled through a raw tag needs, since a raw tag declares no props at all.
|
|
145
|
+
*
|
|
146
|
+
* `elementType` may arrive as a spec element's stored marker (`component:Media`) or as a bare path;
|
|
147
|
+
* the marker is stripped, because the component lookup keys on the path. Missing that strip is
|
|
148
|
+
* invisible in a system whose prop names are its style-property paths — the fallback answers
|
|
149
|
+
* correctly — and wrong the moment a component names a prop something else.
|
|
150
|
+
*/
|
|
151
|
+
declare function stylePropertyFor(config: Config, elementType: string, propName: string): StylePropertyItem | undefined;
|
|
152
|
+
/** Every style property that writes `cssProperty`, in registration order. */
|
|
153
|
+
declare function stylePropertiesWriting(config: Config, cssProperty: string): StylePropertyItem[];
|
|
154
|
+
/** Whether a style property accepts `value` — i.e. the value is one of its leaves. */
|
|
155
|
+
declare function stylePropertyAccepts(config: Config, prop: StylePropertyItem, value: string): boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Each token-backed value a style prop offers, as `leaf → resolved literal` (`'2' → '0.5rem'`) — what
|
|
158
|
+
* a token picker shows beside each name. Keyword values are absent: there's no token behind them, so
|
|
159
|
+
* there's nothing to resolve.
|
|
160
|
+
*/
|
|
161
|
+
declare function stylePropTokenValues(config: Config, propName: string): Record<string, string>;
|
|
162
|
+
/**
|
|
163
|
+
* The token group a style prop draws its values from (`spacing`) — what an "open this in the system"
|
|
164
|
+
* link needs. `undefined` when the prop's values are keywords rather than tokens.
|
|
165
|
+
*
|
|
166
|
+
* Derived from the values themselves rather than from a declared group list: a token-backed value
|
|
167
|
+
* resolves to its qualified path, and everything before the leaf is the group it lives in.
|
|
168
|
+
*/
|
|
169
|
+
declare function stylePropTokenGroup(config: Config, propName: string): string | undefined;
|
|
170
|
+
/**
|
|
171
|
+
* The value of whichever prop in `props` writes `cssProperty`.
|
|
172
|
+
*
|
|
173
|
+
* Reads the element's own props rather than the styling the config would apply, because a caller
|
|
174
|
+
* asking this is asking about a choice someone made on this element (pinning a position, locking an
|
|
175
|
+
* aspect ratio) — not about what the component's rules paint by default.
|
|
176
|
+
*/
|
|
177
|
+
declare function cssPropValue(config: Config, elementType: string, props: Record<string, unknown>, cssProperty: string): string | undefined;
|
|
178
|
+
/**
|
|
179
|
+
* One field of one entity, with refs chased to the literal they denote — local and linked alike.
|
|
180
|
+
*
|
|
181
|
+
* The whole point is that there is no second walk for a borrow. A ref is a ref: `isRef` is the only
|
|
182
|
+
* branch, and whether it carries a `@source` decides only which config the next hop reads, never
|
|
183
|
+
* whether a hop happens. That is what makes "reference something in my system" and "reference
|
|
184
|
+
* something from a linked system" the same feature rather than two that have to agree.
|
|
185
|
+
*
|
|
186
|
+
* A ref stands in for the same field of the entity it names — a token's `value` aliasing another
|
|
187
|
+
* Token's `value`, a composite's `styles` standing in for another composite's `styles` — so the field
|
|
188
|
+
* carries through the chase rather than each kind needing to declare a target.
|
|
189
|
+
*
|
|
190
|
+
* Answers with whatever the ref denotes rather than narrowing to a scalar — a borrowed gradient or
|
|
191
|
+
* derived colour is a resolved value too, and a chase that returned `undefined` for one would be
|
|
192
|
+
* indistinguishable from a chase that failed. A caller wanting a literal narrows.
|
|
193
|
+
*
|
|
194
|
+
* `undefined` only when there is no answer: a missing entity, an unreachable linked source, or a cycle.
|
|
195
|
+
*/
|
|
196
|
+
declare function resolveFieldValue(config: Config, kind: string, path: string, field: string, seen?: Set<string>): unknown;
|
|
197
|
+
/** A token's value with alias refs chased to the base literal — {@link resolveFieldValue} for the one
|
|
198
|
+
* field every token consumer asks about, narrowed to the scalar a display or a stylesheet can use. */
|
|
199
|
+
declare function resolveTokenValue(config: Config, path: string, seen?: Set<string>): string | number | undefined;
|
|
200
|
+
/**
|
|
201
|
+
* The literal a token resolves to under an override condition: its own override there when it holds
|
|
202
|
+
* one, else its base value, with a ref along the way chased under the same condition. That is how the
|
|
203
|
+
* cascade reads it — under `dark`, an alias of `blue/1` is blue/1's dark value — so a swatch painted
|
|
204
|
+
* for a dark cell paints what dark will show. `null` is the base, the same as {@link resolveTokenValue}.
|
|
205
|
+
*/
|
|
206
|
+
declare function resolveTokenValueUnder(config: Config, path: string, condition: string | null, seen?: Set<string>): string | number | undefined;
|
|
207
|
+
/** A style-bag value → its CSS string: a token ref (or a bare token path) becomes a
|
|
208
|
+
* `var(--…)` reference (so mode/theme overrides still flow), anything else is the literal.
|
|
209
|
+
*
|
|
210
|
+
* `varPrefix` renames the namespace every variable in the result is spelled under, and is how a
|
|
211
|
+
* linked source's own values are rendered into the consumer's stylesheet: their token aliasing
|
|
212
|
+
* another of theirs has to name the variable as we declared it, not as they would have. Absent — the
|
|
213
|
+
* ordinary call — it is `config`'s own prefix. */
|
|
214
|
+
declare function renderStyleValue(config: Config, value: unknown, varPrefix?: string): string;
|
|
215
|
+
/**
|
|
216
|
+
* The value a negating prop paints — `calc(<value> * -1)`.
|
|
217
|
+
*
|
|
218
|
+
* `calc` rather than a computed literal because the value is usually a `var(--…)`: the token it names
|
|
219
|
+
* has to stay a reference, so a mode override or a theme swap still reaches it. It's applied at the
|
|
220
|
+
* declaration, not to the token, since the same token feeds the positive prop too.
|
|
221
|
+
*
|
|
222
|
+
* Exported because three emitters need the same string — the stylesheet, the runtime's off-scale
|
|
223
|
+
* branch, and this file's `styleDeclarations` — and a prop that negates from a token but not from a
|
|
224
|
+
* literal is worse than one that never negates at all.
|
|
225
|
+
*/
|
|
226
|
+
declare function negatedCssValue(value: string): string;
|
|
227
|
+
/**
|
|
228
|
+
* What one component's own module does with each prop it declares — name → the style property that
|
|
229
|
+
* prop writes, or `null` for a prop that writes none.
|
|
230
|
+
*
|
|
231
|
+
* This is the routing an emitted module performs, and it is a different question from
|
|
232
|
+
* {@link resolveComponentProps} / `prop-surface`, which answer what a component exposes by chasing
|
|
233
|
+
* `forwards` and `inherits`. Both are right for their callers — an inspector offers the exposed
|
|
234
|
+
* surface — but only this one describes what happens at runtime, because a module destructures its
|
|
235
|
+
* declared props out of the bag and hands the rest to `processStyleProps`:
|
|
236
|
+
*
|
|
237
|
+
* const { className, layerProps, variant, size = "md", children, ...__udsBag } = jsxProps;
|
|
238
|
+
* const [classes, rest] = processStyleProps(__udsBag, { gap: "gapY" });
|
|
239
|
+
*
|
|
240
|
+
* So a declared prop is answered by its declaration whatever its type, and a prop the component does
|
|
241
|
+
* not declare falls through by its own name to the root layer — where every prop the config doesn't
|
|
242
|
+
* model is sent (`rootLayerOf`).
|
|
243
|
+
*
|
|
244
|
+
* Three consequences, each a silent miss for a caller that reads the exposed surface instead:
|
|
245
|
+
*
|
|
246
|
+
* - **A rename is the component's own.** `TokenCellShell` forwards `*` from `HStack`, so its exposed
|
|
247
|
+
* surface reports `gap` as `gapX` — but its module carries no alias, consumes `gap` under the
|
|
248
|
+
* System-wide name, and its baked rule emits `gap:` to match. A forwarded rename is not inherited.
|
|
249
|
+
* - **A `variant`, `composite`, `slot`, `forward`, `string`, `number` or `boolean` prop writes no
|
|
250
|
+
* style property at all**, even where a style property shares its name. It is destructured out
|
|
251
|
+
* before the style-prop table is ever consulted.
|
|
252
|
+
* - **A `null` tombstone is a declaration too** — the prop is declared gone, not merely absent, and
|
|
253
|
+
* it is destructured out like any other. It writes nothing and does not fall through.
|
|
254
|
+
*/
|
|
255
|
+
declare function declaredPropRouting(config: Config, path: string): Map<string, string | null>;
|
|
256
|
+
/**
|
|
257
|
+
* The renames out of {@link declaredPropRouting} — the table a component's module is emitted with and
|
|
258
|
+
* hands to `processStyleProps`.
|
|
259
|
+
*
|
|
260
|
+
* Only the renames, because a prop named after its own property is what the runtime assumes when it
|
|
261
|
+
* finds no entry (`aliases?.[key] ?? key`). So this map is the difference between a prop's
|
|
262
|
+
* consumer-facing name and what it routes to, and an empty answer means "they are the same".
|
|
263
|
+
*/
|
|
264
|
+
declare function styleAliasesOf(config: Config, path: string): Map<string, string>;
|
|
265
|
+
/** Whether a style prop paints the negation of its value (`offsetX`). */
|
|
266
|
+
declare function stylePropNegates(config: Config, path: string): boolean;
|
|
267
|
+
/**
|
|
268
|
+
* Flatten a style bag to resolved CSS declarations — each key resolves to its style prop's
|
|
269
|
+
* CSS `property` (falling back to the key itself as a raw property), each value renders as a
|
|
270
|
+
* Token ref or a literal. `_`-prefixed keys are modifier blocks the caller nests, so they're
|
|
271
|
+
* skipped. The single style→CSS resolver shared by codegen (emit CSS text) and the renderer
|
|
272
|
+
* (inline styles) so a rendered preview matches the emitted stylesheet exactly.
|
|
273
|
+
*/
|
|
274
|
+
/**
|
|
275
|
+
* The style property one bag key writes — the single answer to "what does this prop mean here",
|
|
276
|
+
* for every surface that reads a prop bag.
|
|
277
|
+
*
|
|
278
|
+
* A bag key is an authored name, and what it writes is settled by the definitions it resolves
|
|
279
|
+
* against, in `through` order — first one that declares the key wins, and its answer is the whole
|
|
280
|
+
* answer. A key nothing declares names its own property, which is what a raw tag needs, since a raw
|
|
281
|
+
* tag declares no props at all.
|
|
282
|
+
*
|
|
283
|
+
* `through` is a chain rather than one element because a style rule's bag has two definitions with a
|
|
284
|
+
* claim on it: the component that authored the rule, and the element whose props the rule sets.
|
|
285
|
+
* The author comes first — a component's own declaration of `gap` is what `gap` means throughout its
|
|
286
|
+
* definition, its public API and its style rules alike. So `Row`, which declares `gap` writing
|
|
287
|
+
* `gapX` over a `VStack` layer that writes `gapY`, means column-gap in both places rather than one
|
|
288
|
+
* in each.
|
|
289
|
+
*
|
|
290
|
+
* A member ref key (`component:layout/HStack#props/gap`) names its element outright, so it answers
|
|
291
|
+
* for itself and `through` is irrelevant.
|
|
292
|
+
*
|
|
293
|
+
* `undefined` means "writes no style property": a `variant`, a `composite`, a tombstone, or a key
|
|
294
|
+
* that is not a style property at all (`as`, `type`, a data attribute). Every caller already had to
|
|
295
|
+
* distinguish that from a property, and each one used to decide it differently — the CSS emitter by
|
|
296
|
+
* `config.resolve('style-property', key)` on the authored name, which both mis-resolved a rename and
|
|
297
|
+
* silently dropped a key whose only meaning is a rename (`colSpan`, not itself a property, emitted no
|
|
298
|
+
* declaration at all).
|
|
299
|
+
*/
|
|
300
|
+
declare function stylePropertyPathFor({
|
|
301
|
+
config,
|
|
302
|
+
through,
|
|
303
|
+
key
|
|
304
|
+
}: {
|
|
305
|
+
readonly config: Config;
|
|
306
|
+
/** The definitions to resolve `key` against, in precedence order — a path or a stored marker
|
|
307
|
+
* (`component:Card`) each, `undefined` entries skipped so a raw-tag layer needs no branch at the
|
|
308
|
+
* call site. Empty for a bag no component owns. */
|
|
309
|
+
readonly through?: readonly (string | undefined)[];
|
|
310
|
+
readonly key: string;
|
|
311
|
+
}): string | undefined;
|
|
312
|
+
/**
|
|
313
|
+
* A bag with every key rewritten to the property it writes, resolved through the definitions that
|
|
314
|
+
* have a claim on it ({@link stylePropertyPathFor}). The one place a bag's authored names become
|
|
315
|
+
* properties.
|
|
316
|
+
*
|
|
317
|
+
* Applied at each boundary rather than per key inside each consumer, so `styleDeclarations`, the CSS
|
|
318
|
+
* emitter and `splitStyleProps` all stay pure functions of a property-keyed bag and cannot disagree
|
|
319
|
+
* about what a key meant. A key that writes no style property is left alone, under the name it was
|
|
320
|
+
* authored with: it is the element's own (`as`, `type`, `onClick`), and the consumer routes it there.
|
|
321
|
+
*
|
|
322
|
+
* `_<modifier>` blocks hold an ordinary bag against the same definitions, so they recurse.
|
|
323
|
+
*/
|
|
324
|
+
declare function routedBag({
|
|
325
|
+
config,
|
|
326
|
+
through,
|
|
327
|
+
bag
|
|
328
|
+
}: {
|
|
329
|
+
readonly config: Config;
|
|
330
|
+
readonly through?: readonly (string | undefined)[];
|
|
331
|
+
readonly bag: Record<string, unknown>;
|
|
332
|
+
}): Record<string, unknown>;
|
|
333
|
+
declare function styleDeclarations({
|
|
334
|
+
config,
|
|
335
|
+
bag,
|
|
336
|
+
namespace
|
|
337
|
+
}: {
|
|
338
|
+
readonly config: Config;
|
|
339
|
+
readonly bag: Record<string, unknown>;
|
|
340
|
+
/**
|
|
341
|
+
* The var-name namespace every value renders in, when it is not this config's own.
|
|
342
|
+
*
|
|
343
|
+
* A borrowed entity's bag names the source's vocabulary, so it is resolved against the source — and
|
|
344
|
+
* then its `var()` names have to be the ones we declare for that source's tokens
|
|
345
|
+
* (`sourceVarPrefix`), not the source's own prefix. Without it the rule references a custom property
|
|
346
|
+
* nothing on the page declares, which computes to the inherited value and paints silently wrong.
|
|
347
|
+
*/
|
|
348
|
+
readonly namespace?: string;
|
|
349
|
+
}): Record<string, string>;
|
|
350
|
+
/**
|
|
351
|
+
* An opacity value as a `color-mix()` share.
|
|
352
|
+
*
|
|
353
|
+
* A system may scale opacity as a fraction (`0.5`) or as a percentage (`50%`), and `color-mix()`
|
|
354
|
+
* takes only the latter — a bare `0.5` there is not a small share but a syntax error, and the
|
|
355
|
+
* browser drops the whole declaration.
|
|
356
|
+
*
|
|
357
|
+
* A token reference is the common case and cannot be read here: the value is a `var()`, and what it
|
|
358
|
+
* holds is the theme's answer, which changes per mode. So it is scaled in CSS (`calc(… * 100%)`)
|
|
359
|
+
* rather than resolved, which commits the config to authoring opacity tokens as fractions — the same
|
|
360
|
+
* convention CSS's own `opacity` property uses.
|
|
361
|
+
*/
|
|
362
|
+
declare function opacityPercentage(value: string): string | undefined;
|
|
363
|
+
/**
|
|
364
|
+
* A component's effective props — its own props merged over those it inherits by `extends`ing
|
|
365
|
+
* another component. A child prop overrides the inherited one of the same name; a `null` child
|
|
366
|
+
* prop omits an inherited one. A native-tag `extends` (a string, not a ref) inherits nothing,
|
|
367
|
+
* and a composite doesn't extend, so both resolve to just their own props. Chases the `extends`
|
|
368
|
+
* chain (transitive inheritance), cycle-guarded.
|
|
369
|
+
*/
|
|
370
|
+
declare function resolveComponentProps(config: Config, path: string, seen?: Set<string>): Record<string, unknown>;
|
|
371
|
+
/**
|
|
372
|
+
* Which component actually declared one of a component's resolved props — its ultimate owner.
|
|
373
|
+
*
|
|
374
|
+
* `resolveComponentProps` answers *what* the props are and deliberately flattens away *where each came
|
|
375
|
+
* from*. That provenance is a real question with more than one caller: a rename recorded against one
|
|
376
|
+
* Component has to reach the documents of every component that exposes that prop through `inherits`
|
|
377
|
+
* (`rewriteSpecRefs`), and telling an author which side of a merge a prop came from needs the same fact.
|
|
378
|
+
*
|
|
379
|
+
* Mirrors the merge exactly, so the two can't disagree:
|
|
380
|
+
*
|
|
381
|
+
* - an own non-null declaration means this component owns it — a shadow stops the walk, which is why
|
|
382
|
+
* `HStack`'s own `gap` is `HStack`'s and not the `Box` `gap` it shadows;
|
|
383
|
+
* - an own `null` is the omit tombstone, so the prop does not exist here and has no owner;
|
|
384
|
+
* - otherwise the prop is inherited, and the answer is whatever the inherited component says —
|
|
385
|
+
* transitively, so `Button` → `Pressable` → `Box` reports `Box`.
|
|
386
|
+
*
|
|
387
|
+
* `undefined` when the component doesn't resolve, doesn't expose that prop, or tombstones it.
|
|
388
|
+
*/
|
|
389
|
+
declare function propOwner(config: Config, path: string, prop: string, seen?: Set<string>): string | undefined;
|
|
390
|
+
/** What deriving a domain needs of a prop declaration: the `type` that says which domain rule
|
|
391
|
+
* applies, and the `value` slot every type names its domain under. Structural, so a component's
|
|
392
|
+
* own typed prop and a loosely-read stored record both satisfy it without either being cast. */
|
|
393
|
+
type PropDeclaration = {
|
|
394
|
+
type?: unknown;
|
|
395
|
+
value?: unknown;
|
|
396
|
+
};
|
|
397
|
+
/** A prop declaration's accepted value domain — the leaves an author may write (`warning`,
|
|
398
|
+
* `display2`, a variant name), plus an `accepts` check. Resolved once, relationally, from the prop's
|
|
399
|
+
* `type`: a `variant`'s own values; a `styleProperty`'s referenced value-set leaves; a `composite` group's
|
|
400
|
+
* member leaves. `null` when there's no enumerable domain (a slot/motion content prop, a free scalar,
|
|
401
|
+
* or an unconstrained style prop). The one place prop-value domains are derived — consumed by prop
|
|
402
|
+
* validation, the `get_component` prop-domain display, and the Studio value picker, so none re-derive. */
|
|
403
|
+
declare function propValueDomain(config: Config, decl: PropDeclaration): {
|
|
404
|
+
leaves: string[];
|
|
405
|
+
accepts: (value: string) => boolean;
|
|
406
|
+
} | null;
|
|
407
|
+
/** Validate a prop bag against a component's declared props — unknown props + per-value domain
|
|
408
|
+
* checks. Generic: it resolves each prop's domain via {@link propValueDomain} and checks membership;
|
|
409
|
+
* no per-prop-type logic here. Returns the error strings (empty = valid). Lives in config so the
|
|
410
|
+
* `component/validate` op's truth is config-defined and the pipeline only renders it. */
|
|
411
|
+
declare function validateComponentProps(config: Config, componentPath: string, props: Record<string, unknown>): string[];
|
|
412
|
+
/**
|
|
413
|
+
* The props one preview tile starts from: the component's `defaultProps` with its `previewProps`
|
|
414
|
+
* over the top.
|
|
415
|
+
*
|
|
416
|
+
* Preview wins, and that direction is the whole reason this exists once. `previewProps` is the state
|
|
417
|
+
* a person chose to show a component in — Button's `variant`, an Icon prop's example glyph — so a
|
|
418
|
+
* surface showing that tile has to agree with it, while `defaultProps` remains the baseline for every
|
|
419
|
+
* prop the tile doesn't pin. Get the order backwards and the panel reports a value the canvas isn't
|
|
420
|
+
* rendering, which is invisible until someone edits the wrong one.
|
|
421
|
+
*
|
|
422
|
+
* THE PRECEDENCE RULE, stated once: only a RENDER surface — a preview tile, the catalogue card, slot
|
|
423
|
+
* text seeding — reads this merge. An EDIT surface reads and writes the single field it owns
|
|
424
|
+
* (`defaultProps` OR `previewProps`, never the merge), and anything that SEEDS committed data — a
|
|
425
|
+
* prop binding, a forward's re-seed, a stored instance prop, a default-value form — reads raw
|
|
426
|
+
* `defaultProps`. A preview value that reaches any of those stops being staging and becomes a real
|
|
427
|
+
* default the moment it is saved, which is exactly the leak UDS-3514 closed. Before adding a caller,
|
|
428
|
+
* decide which of the three it is.
|
|
429
|
+
*
|
|
430
|
+
* Empty is the answer for a component that declares neither, and for a path that names no component
|
|
431
|
+
* at all — a caller asking about something absent gets "nothing pinned", not a crash.
|
|
432
|
+
*
|
|
433
|
+
* A fresh object per call, like every projection here. Callers that feed it to a React dep array
|
|
434
|
+
* memoize on the config and the path, which is what actually changes.
|
|
435
|
+
*
|
|
436
|
+
* Read through `Entity.body` rather than `Component.get`, which would be the typed way to ask: this
|
|
437
|
+
* module is imported by `entities/system/Component.ts` (for `resolveComponentProps` and
|
|
438
|
+
* `validateComponentProps`), so importing the class back would close a runtime cycle. `body` is the
|
|
439
|
+
* accessor that exists for a reader which can't reach its entity class, and it is not `toJSON` —
|
|
440
|
+
* serialization is for storage and the wire.
|
|
441
|
+
*/
|
|
442
|
+
declare function previewDefaults(config: Config, path: string): Record<string, unknown>;
|
|
443
|
+
/** A preview grid, derived. Rows sweep a prop's declared values; columns are the states the
|
|
444
|
+
* Component actually styles for. */
|
|
445
|
+
interface PreviewMatrix {
|
|
446
|
+
/** Prop → its sweepable values: every value a variant-typed own prop declares (or every member of a
|
|
447
|
+
* composite-typed prop's group), in declaration order, then any value the style rules name in
|
|
448
|
+
* `when` that the declaration doesn't list. A prop with no declared domain keeps rule order. */
|
|
449
|
+
readonly props: Record<string, string[]>;
|
|
450
|
+
/** Modifiers the component's own rules style under (`_hover`) — the columns worth showing. */
|
|
451
|
+
readonly modifiers: string[];
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* The preview grid a component implies.
|
|
455
|
+
*
|
|
456
|
+
* Nothing new is being said here: a style rule's `when` names a prop and a value, which is an axis
|
|
457
|
+
* and a point on it, and a rule's `_hover` block is a state worth a column. Authoring a matrix
|
|
458
|
+
* restated all of that beside the thing it was derived from, and the two could disagree — a variant
|
|
459
|
+
* added to `styles` and forgotten in the matrix just never appeared in the grid.
|
|
460
|
+
*
|
|
461
|
+
* A composite-typed prop is the same statement made relationally: each member of the group it
|
|
462
|
+
* references is a whole bag of style declarations, so sweeping the prop sweeps styles exactly the
|
|
463
|
+
* way a `when` does — the rules just never restate it. Left unchased, a component styled entirely
|
|
464
|
+
* through composites (a text primitive whose `variant` names a composite group) implies an empty
|
|
465
|
+
* grid, which reads as "no variants" rather than "fifty of them".
|
|
466
|
+
*
|
|
467
|
+
* So a component only authors what a preview can't know: the props one tile starts from.
|
|
468
|
+
*/
|
|
469
|
+
declare function previewMatrix(config: Config, path: string): PreviewMatrix;
|
|
470
|
+
/**
|
|
471
|
+
* A prop's value as the component declares it, from the string a preview axis spells it as.
|
|
472
|
+
*
|
|
473
|
+
* `previewMatrix` names every axis value as a string (`'true'`, `'2'`), and a rule matches on the
|
|
474
|
+
* string form too, so a surface reading the grid never sees the declared type. Anything that writes
|
|
475
|
+
* a value back — a default chosen off a cell — restores it here, or a boolean prop's default is
|
|
476
|
+
* stored as the string `'true'` and never equals the `true` an author writes.
|
|
477
|
+
*/
|
|
478
|
+
declare function propValueFromAxis(config: Config, path: string, prop: string, value: string): unknown;
|
|
479
|
+
//#endregion
|
|
480
|
+
export { PreviewMatrix, PropDeclaration, StylePropEntry, StylePropertyItem, authoredBag, authoredValue, className, cssPropValue, cssVar, cssVarRef, declaredPropRouting, memberFromLeaf, memberLeaves, negatedCssValue, opacityPercentage, previewDefaults, previewMatrix, propOwner, propValueDomain, propValueFromAxis, renderStyleValue, resolveComponentProps, resolveFieldValue, resolveTokenValue, resolveTokenValueUnder, routedBag, sourceVarPrefix, styleAliasesOf, styleDeclarations, stylePropEntries, stylePropLeafForToken, stylePropNegates, stylePropTokenGroup, stylePropTokenPath, stylePropTokenValues, stylePropValueFromLeaf, stylePropValueLeaves, stylePropValues, stylePropertiesWriting, stylePropertyAccepts, stylePropertyFor, stylePropertyPathFor, validateComponentProps };
|