@yahoo/uds-create-config 2.44.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +129 -0
- package/dist/ai-lanes.d.ts +23 -0
- package/dist/ai-lanes.js +34 -0
- package/dist/authoring/define-component.d.ts +85 -0
- package/dist/configs/CanvasConfig.d.ts +3237 -0
- package/dist/configs/CanvasConfig.js +332 -0
- package/dist/configs/build-options.d.ts +10 -0
- package/dist/configs/build-options.js +68 -0
- package/dist/configs/platform.d.ts +15 -0
- package/dist/configs/platform.js +17 -0
- package/dist/configs/react-native-system.d.ts +3026 -0
- package/dist/configs/react-native-system.js +64 -0
- package/dist/configs/system.d.ts +2771 -0
- package/dist/configs/system.js +74 -0
- package/dist/css/properties.generated.d.ts +14 -0
- package/dist/css/properties.generated.js +6260 -0
- package/dist/css/value-type.d.ts +48 -0
- package/dist/css/value-type.js +131 -0
- package/dist/css/values.d.ts +33 -0
- package/dist/css/values.js +116 -0
- package/dist/entities/native/NativeModifier.d.ts +25 -0
- package/dist/entities/native/NativeModifier.js +41 -0
- package/dist/entities/native/NativeSettings.d.ts +44 -0
- package/dist/entities/native/NativeSettings.js +39 -0
- package/dist/entities/native/NativeStyleProperty.d.ts +355 -0
- package/dist/entities/native/NativeStyleProperty.js +28 -0
- package/dist/entities/native/NativeToken.d.ts +31 -0
- package/dist/entities/native/NativeToken.js +49 -0
- package/dist/entities/system/CanvasRole.d.ts +34 -0
- package/dist/entities/system/CanvasRole.js +45 -0
- package/dist/entities/system/Component.d.ts +1287 -0
- package/dist/entities/system/Component.js +1840 -0
- package/dist/entities/system/Composite.d.ts +12 -0
- package/dist/entities/system/Composite.js +26 -0
- package/dist/entities/system/Device.d.ts +11 -0
- package/dist/entities/system/Device.js +18 -0
- package/dist/entities/system/File.d.ts +72 -0
- package/dist/entities/system/File.js +136 -0
- package/dist/entities/system/Font.d.ts +48 -0
- package/dist/entities/system/Font.js +56 -0
- package/dist/entities/system/GlobalStyle.d.ts +26 -0
- package/dist/entities/system/GlobalStyle.js +54 -0
- package/dist/entities/system/Guidance.d.ts +85 -0
- package/dist/entities/system/Guidance.js +59 -0
- package/dist/entities/system/GuidanceStyle.d.ts +14 -0
- package/dist/entities/system/GuidanceStyle.js +8 -0
- package/dist/entities/system/Icon.d.ts +46 -0
- package/dist/entities/system/Icon.js +46 -0
- package/dist/entities/system/LinkedSystem.d.ts +504 -0
- package/dist/entities/system/LinkedSystem.js +814 -0
- package/dist/entities/system/Modifier.d.ts +92 -0
- package/dist/entities/system/Modifier.js +120 -0
- package/dist/entities/system/Motion.d.ts +28 -0
- package/dist/entities/system/Motion.js +48 -0
- package/dist/entities/system/Operation.d.ts +100 -0
- package/dist/entities/system/Operation.js +236 -0
- package/dist/entities/system/Package.d.ts +42 -0
- package/dist/entities/system/Package.js +75 -0
- package/dist/entities/system/Settings.d.ts +94 -0
- package/dist/entities/system/Settings.js +166 -0
- package/dist/entities/system/StyleProperty.d.ts +135 -0
- package/dist/entities/system/StyleProperty.js +438 -0
- package/dist/entities/system/Token.d.ts +67 -0
- package/dist/entities/system/Token.js +129 -0
- package/dist/entities/system/Tool.d.ts +134 -0
- package/dist/entities/system/Tool.js +124 -0
- package/dist/entities/system/color.d.ts +64 -0
- package/dist/entities/system/color.js +123 -0
- package/dist/entities/system/component-module.d.ts +63 -0
- package/dist/entities/system/component-module.js +258 -0
- package/dist/entities/system/copy-plan.d.ts +98 -0
- package/dist/entities/system/copy-plan.js +451 -0
- package/dist/entities/system/defineComponent.d.ts +428 -0
- package/dist/entities/system/defineComponent.js +337 -0
- package/dist/entities/system/element.d.ts +101 -0
- package/dist/entities/system/element.js +171 -0
- package/dist/entities/system/icon-library.d.ts +64 -0
- package/dist/entities/system/icon-library.js +112 -0
- package/dist/entities/system/icon-metadata.d.ts +72 -0
- package/dist/entities/system/icon-metadata.js +111 -0
- package/dist/entities/system/link-declaration.d.ts +27 -0
- package/dist/entities/system/link-declaration.js +64 -0
- package/dist/entities/system/link-plan.d.ts +160 -0
- package/dist/entities/system/link-plan.js +770 -0
- package/dist/entities/system/runtime-modules.d.ts +25 -0
- package/dist/entities/system/runtime-modules.js +38 -0
- package/dist/entities/system/style-bag.d.ts +20 -0
- package/dist/entities/system/style-bag.js +246 -0
- package/dist/entities/system/token-index.d.ts +89 -0
- package/dist/entities/system/token-index.js +112 -0
- package/dist/framework/Config.d.ts +2472 -0
- package/dist/framework/Config.js +5023 -0
- package/dist/framework/Entity.d.ts +127 -0
- package/dist/framework/Entity.js +125 -0
- package/dist/framework/authoring.d.ts +24 -0
- package/dist/framework/authoring.js +7 -0
- package/dist/framework/change-hooks.d.ts +119 -0
- package/dist/framework/change-hooks.js +131 -0
- package/dist/framework/changes.d.ts +88 -0
- package/dist/framework/changes.js +246 -0
- package/dist/framework/class-names.d.ts +260 -0
- package/dist/framework/class-names.js +630 -0
- package/dist/framework/coalesce.d.ts +25 -0
- package/dist/framework/coalesce.js +60 -0
- package/dist/framework/config-op.d.ts +76 -0
- package/dist/framework/config-op.js +43 -0
- package/dist/framework/config-operation-kind.d.ts +14 -0
- package/dist/framework/config-operation-kind.js +14 -0
- package/dist/framework/config-ops.d.ts +34 -0
- package/dist/framework/config-ops.js +187 -0
- package/dist/framework/defineConfig.d.ts +196 -0
- package/dist/framework/defineConfig.js +100 -0
- package/dist/framework/defineDerivedEntity.d.ts +74 -0
- package/dist/framework/defineDerivedEntity.js +83 -0
- package/dist/framework/defineEntity.d.ts +318 -0
- package/dist/framework/defineEntity.js +183 -0
- package/dist/framework/defineSubEntity.d.ts +148 -0
- package/dist/framework/defineSubEntity.js +121 -0
- package/dist/framework/derived-mutations.d.ts +20 -0
- package/dist/framework/derived-mutations.js +38 -0
- package/dist/framework/entity-search.d.ts +29 -0
- package/dist/framework/entity-search.js +117 -0
- package/dist/framework/inline-sources.d.ts +49 -0
- package/dist/framework/inline-sources.js +388 -0
- package/dist/framework/layer-styles.d.ts +25 -0
- package/dist/framework/layer-styles.js +49 -0
- package/dist/framework/memo.d.ts +48 -0
- package/dist/framework/memo.js +84 -0
- package/dist/framework/overlay.d.ts +49 -0
- package/dist/framework/overlay.js +17 -0
- package/dist/framework/plan.d.ts +49 -0
- package/dist/framework/plan.js +73 -0
- package/dist/framework/projections.d.ts +480 -0
- package/dist/framework/projections.js +974 -0
- package/dist/framework/prop-surface.d.ts +132 -0
- package/dist/framework/prop-surface.js +278 -0
- package/dist/framework/ref-graph.d.ts +71 -0
- package/dist/framework/ref-graph.js +158 -0
- package/dist/framework/ref-integrity.d.ts +55 -0
- package/dist/framework/ref-integrity.js +171 -0
- package/dist/framework/registered.d.ts +95 -0
- package/dist/framework/registry-dir.d.ts +42 -0
- package/dist/framework/registry-dir.js +48 -0
- package/dist/framework/registry.d.ts +300 -0
- package/dist/framework/registry.js +104 -0
- package/dist/framework/rejection.d.ts +58 -0
- package/dist/framework/rejection.js +111 -0
- package/dist/framework/rename-inference.d.ts +26 -0
- package/dist/framework/rename-inference.js +50 -0
- package/dist/framework/render-spec.d.ts +296 -0
- package/dist/framework/render-spec.js +809 -0
- package/dist/framework/schema-version.d.ts +140 -0
- package/dist/framework/schema-version.js +214 -0
- package/dist/framework/schemas.d.ts +109 -0
- package/dist/framework/schemas.js +615 -0
- package/dist/framework/session.d.ts +196 -0
- package/dist/framework/session.js +367 -0
- package/dist/framework/signature.d.ts +15 -0
- package/dist/framework/signature.js +83 -0
- package/dist/framework/snapshot.d.ts +115 -0
- package/dist/framework/snapshot.js +277 -0
- package/dist/framework/source-integrity.d.ts +226 -0
- package/dist/framework/source-integrity.js +478 -0
- package/dist/framework/sources.d.ts +211 -0
- package/dist/framework/sources.js +89 -0
- package/dist/framework/utils/compiled-schema.d.ts +23 -0
- package/dist/framework/utils/compiled-schema.js +46 -0
- package/dist/framework/utils/content-key.d.ts +15 -0
- package/dist/framework/utils/content-key.js +33 -0
- package/dist/framework/utils/enumerated.d.ts +13 -0
- package/dist/framework/utils/enumerated.js +19 -0
- package/dist/framework/utils/field-path.d.ts +95 -0
- package/dist/framework/utils/field-path.js +136 -0
- package/dist/framework/utils/field-schema.d.ts +55 -0
- package/dist/framework/utils/field-schema.js +183 -0
- package/dist/framework/utils/group.d.ts +37 -0
- package/dist/framework/utils/group.js +13 -0
- package/dist/framework/utils/package-path.d.ts +37 -0
- package/dist/framework/utils/package-path.js +61 -0
- package/dist/framework/utils/refs.d.ts +194 -0
- package/dist/framework/utils/refs.js +403 -0
- package/dist/framework/validate-spec.d.ts +27 -0
- package/dist/framework/validate-spec.js +45 -0
- package/dist/framework/value-domain.d.ts +26 -0
- package/dist/framework/value-domain.js +202 -0
- package/dist/framework/views-facade.d.ts +15 -0
- package/dist/framework/views-facade.js +19 -0
- package/dist/index.d.ts +90 -42
- package/dist/index.js +86 -37
- package/dist/migrations/2.0.0/raw-css.d.ts +11 -0
- package/dist/migrations/2.0.0/raw-css.js +72 -0
- package/dist/migrations/2.0.0/v1-artifact.d.ts +1559 -0
- package/dist/migrations/2.0.0/v1-artifact.js +1018 -0
- package/dist/migrations/20260908171448_settings_as_kind.d.ts +22 -0
- package/dist/migrations/20260908171448_settings_as_kind.js +89 -0
- package/dist/migrations/20260908194245_visible_state_pointer.d.ts +19 -0
- package/dist/migrations/20260908194245_visible_state_pointer.js +115 -0
- package/dist/migrations/20260909183001_icon_knockout_variants.d.ts +18 -0
- package/dist/migrations/20260909183001_icon_knockout_variants.js +8 -0
- package/dist/migrations/20260910212453_linked_system_link_ops.d.ts +13 -0
- package/dist/migrations/20260910212453_linked_system_link_ops.js +8 -0
- package/dist/migrations/index.d.ts +2 -0
- package/dist/migrations/index.js +2 -0
- package/dist/react-native/style-keys.generated.d.ts +10 -0
- package/dist/react-native/style-keys.generated.js +167 -0
- package/dist/renderer/RendererErrorBoundary.d.ts +32 -5
- package/dist/renderer/RendererErrorBoundary.js +59 -10
- package/dist/renderer/UdsRenderer.d.ts +11 -10
- package/dist/renderer/UdsRenderer.js +1 -1
- package/dist/renderer/assetEntries.d.ts +37 -0
- package/dist/renderer/assetEntries.js +39 -0
- package/dist/renderer/assetRenderable.d.ts +14 -6
- package/dist/renderer/assetRenderable.js +8 -2
- package/dist/renderer/componentEntry.d.ts +58 -0
- package/dist/renderer/componentEntry.js +71 -0
- package/dist/renderer/icon-library.d.ts +20 -0
- package/dist/renderer/index.d.ts +7 -7
- package/dist/renderer/index.js +5 -5
- package/dist/renderer/primitives/SlotRenderer.d.ts +1 -1
- package/dist/renderer/primitives/SlotRenderer.js +1 -1
- package/dist/renderer/runtimeComponent.d.ts +33 -0
- package/dist/renderer/runtimeComponent.js +113 -0
- package/dist/renderer/spec-content.d.ts +43 -0
- package/dist/renderer/spec-content.js +95 -0
- package/dist/renderer/wrapRegistry.d.ts +22 -37
- package/dist/renderer/wrapRegistry.js +10 -20
- package/dist/renderer/wrappers/event-bridge.js +6 -5
- package/dist/renderer/wrappers/hex-normalize.js +6 -5
- package/dist/renderer/wrappers/html-aliases.d.ts +7 -2
- package/dist/renderer/wrappers/html-aliases.js +36 -19
- package/dist/renderer/wrappers/inline-styles.js +7 -6
- package/dist/spec/asset-jsx.d.ts +18 -5
- package/dist/spec/asset-jsx.js +27 -16
- package/dist/spec/collapse-text-labels.d.ts +5 -15
- package/dist/spec/collapse-text-labels.js +26 -19
- package/dist/spec/empty-node-slots.d.ts +56 -34
- package/dist/spec/empty-node-slots.js +87 -47
- package/dist/spec/index.d.ts +21 -10
- package/dist/spec/index.js +21 -10
- package/dist/spec/jsxToSpec.d.ts +14 -9
- package/dist/spec/jsxToSpec.js +20 -3
- package/dist/spec/preview-elements.d.ts +63 -0
- package/dist/spec/preview-elements.js +89 -0
- package/dist/spec/rewrite-refs.d.ts +58 -0
- package/dist/spec/rewrite-refs.js +250 -0
- package/dist/spec/specToJsx.js +18 -29
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +39 -52
- package/dist/AssetGroup.d.ts +0 -77
- package/dist/AssetGroup.js +0 -125
- package/dist/Component.d.ts +0 -333
- package/dist/Component.js +0 -1061
- package/dist/ComponentGroup.d.ts +0 -22
- package/dist/ComponentGroup.js +0 -51
- package/dist/CompositeStyle.d.ts +0 -30
- package/dist/CompositeStyle.js +0 -59
- package/dist/Config.d.ts +0 -528
- package/dist/Config.js +0 -1712
- package/dist/Mode.d.ts +0 -41
- package/dist/Mode.js +0 -81
- package/dist/Modifier.d.ts +0 -51
- package/dist/Modifier.js +0 -97
- package/dist/MotionDef.d.ts +0 -81
- package/dist/MotionDef.js +0 -212
- package/dist/Props.d.ts +0 -332
- package/dist/Props.js +0 -35
- package/dist/Provider.d.ts +0 -20
- package/dist/Provider.js +0 -14
- package/dist/StyleProp.d.ts +0 -145
- package/dist/StyleProp.js +0 -239
- package/dist/Token.d.ts +0 -76
- package/dist/Token.js +0 -133
- package/dist/TokenGroup.d.ts +0 -33
- package/dist/TokenGroup.js +0 -69
- package/dist/asset-kind.d.ts +0 -55
- package/dist/asset-kind.js +0 -29
- package/dist/asset-value.d.ts +0 -23
- package/dist/asset-value.js +0 -40
- package/dist/brands.d.ts +0 -30
- package/dist/brands.js +0 -20
- package/dist/captureCallerPath.d.ts +0 -48
- package/dist/captureCallerPath.js +0 -95
- package/dist/colorExpressions.d.ts +0 -131
- package/dist/colorExpressions.js +0 -148
- package/dist/component-referrers.d.ts +0 -30
- package/dist/component-referrers.js +0 -40
- package/dist/config-diagnostics.d.ts +0 -21
- package/dist/config-diagnostics.js +0 -12
- package/dist/defineAssetGroup.d.ts +0 -200
- package/dist/defineAssetGroup.js +0 -323
- package/dist/defineProvider.d.ts +0 -29
- package/dist/defineProvider.js +0 -60
- package/dist/element-marker.d.ts +0 -63
- package/dist/element-marker.js +0 -113
- package/dist/entity-utils.d.ts +0 -56
- package/dist/entity-utils.js +0 -105
- package/dist/extension.d.ts +0 -55
- package/dist/extension.js +0 -214
- package/dist/factories.d.ts +0 -863
- package/dist/factories.js +0 -475
- package/dist/font-face.d.ts +0 -25
- package/dist/font-face.js +0 -72
- package/dist/foreign-component-name.d.ts +0 -21
- package/dist/foreign-component-name.js +0 -42
- package/dist/interpolate.d.ts +0 -20
- package/dist/interpolate.js +0 -10
- package/dist/jsx/__fixtures__/cross-component-preview.d.ts +0 -3
- package/dist/jsx/__fixtures__/cross-component-preview.js +0 -15
- package/dist/jsx/jsx-dev-runtime.d.ts +0 -15
- package/dist/jsx/jsx-dev-runtime.js +0 -11
- package/dist/jsx/jsx-runtime.d.ts +0 -48
- package/dist/jsx/jsx-runtime.js +0 -305
- package/dist/linked-system-pins.d.ts +0 -30
- package/dist/linked-system-pins.js +0 -45
- package/dist/linkedNodePrefixes.d.ts +0 -73
- package/dist/linkedNodePrefixes.js +0 -99
- package/dist/markers.d.ts +0 -235
- package/dist/markers.js +0 -70
- package/dist/motion-constants.d.ts +0 -37
- package/dist/motion-constants.js +0 -61
- package/dist/native/NativeConfig.d.ts +0 -56
- package/dist/native/NativeConfig.js +0 -162
- package/dist/native/assets.d.ts +0 -20
- package/dist/native/assets.js +0 -17
- package/dist/native/components.d.ts +0 -139
- package/dist/native/components.js +0 -67
- package/dist/native/index.d.ts +0 -18
- package/dist/native/index.js +0 -17
- package/dist/native/modes.d.ts +0 -10
- package/dist/native/modes.js +0 -11
- package/dist/native/types.d.ts +0 -95
- package/dist/native/types.js +0 -0
- package/dist/native/validation.d.ts +0 -8
- package/dist/native/validation.js +0 -885
- package/dist/native/values.d.ts +0 -7
- package/dist/native/values.js +0 -15
- package/dist/native.d.ts +0 -12
- package/dist/native.js +0 -10
- package/dist/refs.d.ts +0 -204
- package/dist/refs.js +0 -129
- package/dist/registry-aliases.d.ts +0 -33
- package/dist/registry-aliases.js +0 -35
- package/dist/registry-dir.d.ts +0 -22
- package/dist/registry-dir.js +0 -10
- package/dist/renderer/makeRegistry.d.ts +0 -34
- package/dist/renderer/makeRegistry.js +0 -52
- package/dist/renderer/makeUdsRenderer.d.ts +0 -13
- package/dist/renderer/makeUdsRenderer.js +0 -51
- package/dist/renderer/wrappers/component-slots.d.ts +0 -41
- package/dist/renderer/wrappers/component-slots.js +0 -66
- package/dist/renderer/wrappers/slot-resolution.d.ts +0 -25
- package/dist/renderer/wrappers/slot-resolution.js +0 -68
- package/dist/renderer/wrappers/void-elements.d.ts +0 -37
- package/dist/renderer/wrappers/void-elements.js +0 -40
- package/dist/spec/layer-props.d.ts +0 -52
- package/dist/spec/layer-props.js +0 -149
- package/dist/spec/preview-controls.d.ts +0 -44
- package/dist/spec/preview-controls.js +0 -139
- package/dist/spec/slot-refs.d.ts +0 -39
- package/dist/spec/slot-refs.js +0 -56
- package/dist/token-override-rows.d.ts +0 -68
- package/dist/token-override-rows.js +0 -233
- package/dist/tokenValueType.d.ts +0 -34
- package/dist/tokenValueType.js +0 -138
- package/dist/types/css-properties.d.ts +0 -233
- package/dist/types/css-properties.js +0 -14
- package/dist/types/css-property-keywords.d.ts +0 -156
- package/dist/types/css-property-keywords.js +0 -616
- package/dist/types/css-values.d.ts +0 -63
- package/dist/types/css-values.js +0 -16
- package/dist/types.d.ts +0 -1138
- package/dist/types.js +0 -12
- package/dist/units.d.ts +0 -14
- package/dist/units.js +0 -16
- package/dist/utils/index.d.ts +0 -4
- package/dist/utils/index.js +0 -4
package/dist/StyleProp.js
DELETED
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
import { compact } from "./entity-utils.js";
|
|
2
|
-
import { isTokenGroupRef } from "./refs.js";
|
|
3
|
-
//#region src/StyleProp.ts
|
|
4
|
-
/**
|
|
5
|
-
* `StyleProp` — a JSX prop that emits CSS (`bg`, `padding`).
|
|
6
|
-
*
|
|
7
|
-
* Authored field set mirrors the `StylePropDefinition` shape. The
|
|
8
|
-
* `derived.tokens` projection walks the `values` array (which may
|
|
9
|
-
* carry `tokenGroup()` markers) and resolves it to a flat list of
|
|
10
|
-
* `Token` instances. That walk reads the parent Config's tokens map,
|
|
11
|
-
* which can grow after the StyleProp is constructed, so the derived
|
|
12
|
-
* tokens list recomputes on each access.
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* Whether a raw CSS value is safe to feed through {@link StyleProp.classNameFor}
|
|
16
|
-
* and get back a syntactically valid class-name body. `classNameFor`'s own
|
|
17
|
-
* substitution only escapes `.` and `/` — anything else (parens, commas,
|
|
18
|
-
* spaces) passes through unchanged and would produce an invalid CSS selector.
|
|
19
|
-
*
|
|
20
|
-
* Not every `{ alias, value }` entry's `value` is meant to be authored
|
|
21
|
-
* directly at a JSX/spec site: a short alias (`in-out`) can resolve to a
|
|
22
|
-
* multi-argument function expression (`transitionTiming`'s
|
|
23
|
-
* `cubic-bezier(0.4, 0, 0.2, 1)`) that no one would ever type as a raw prop
|
|
24
|
-
* value and that can never form a valid class name. A resolved keyword like
|
|
25
|
-
* `justifyContent`'s `space-between`, by contrast, is exactly the kind of
|
|
26
|
-
* value a design element can (and does) carry directly. Callers that derive
|
|
27
|
-
* an *additional* class keyed by the resolved value (rather than the alias)
|
|
28
|
-
* must gate on this first.
|
|
29
|
-
*/
|
|
30
|
-
function isSafeClassNameValue(value) {
|
|
31
|
-
return /^[\w./-]+$/.test(value);
|
|
32
|
-
}
|
|
33
|
-
var StyleProp = class StyleProp {
|
|
34
|
-
name;
|
|
35
|
-
cssProperty;
|
|
36
|
-
classPrefix;
|
|
37
|
-
values;
|
|
38
|
-
arbitrary;
|
|
39
|
-
/**
|
|
40
|
-
* When true, the prop emits its value negated (`calc(<value> * -1)`) — the
|
|
41
|
-
* single source of negativity, read by the emitter, the runtime injector,
|
|
42
|
-
* and the MCP/guidance/lint. See {@link StylePropDefinition.negative}.
|
|
43
|
-
*/
|
|
44
|
-
negative;
|
|
45
|
-
cssType;
|
|
46
|
-
metadata;
|
|
47
|
-
opacityPair;
|
|
48
|
-
/**
|
|
49
|
-
* Optional value→CSS adapter (`gridTemplateColumns`'s `4` →
|
|
50
|
-
* `repeat(4, minmax(0, 1fr))`). Applied to enumerated `values` when deriving
|
|
51
|
-
* the utility-class body, so the native emitter produces real CSS without a
|
|
52
|
-
* Tailwind built-in. Keyword strings (`'none'`) pass through unchanged.
|
|
53
|
-
*/
|
|
54
|
-
transform;
|
|
55
|
-
#tokenLookup;
|
|
56
|
-
/** Live getter for the owning Config's class-name prefix — mirrors the
|
|
57
|
-
* lazy `prefixGetter` pattern on Component / CompositeStyle / TokenGroup
|
|
58
|
-
* so the prop reflects `configure({ prefix })` regardless of chain
|
|
59
|
-
* ordering. Defaults to `'uds'` when built without an owning Config. */
|
|
60
|
-
#prefixGetter;
|
|
61
|
-
#derived;
|
|
62
|
-
/**
|
|
63
|
-
* Build the utility-class name a style prop emits for a given
|
|
64
|
-
* JSX-level value. Single source of truth shared by codegen
|
|
65
|
-
* (`@utility` emission), loader (build-time class derivation), and
|
|
66
|
-
* the runtime renderer — all three must agree byte-for-byte.
|
|
67
|
-
*
|
|
68
|
-
* Conventions (the `prefix` namespaces the whole utility body the same
|
|
69
|
-
* way component classes and CSS variables are namespaced; empty prefix
|
|
70
|
-
* yields the bare form):
|
|
71
|
-
* - `classPrefix === ''` → the value IS the class body (`display="block"`
|
|
72
|
-
* → `.yos-block`).
|
|
73
|
-
* - Boolean `true` → bare `classPrefix` body (`<Box border>` →
|
|
74
|
-
* `.yos-border`, never `.border-true`). Falsy → `undefined` (caller
|
|
75
|
-
* omits the class).
|
|
76
|
-
* - Bracketed arbitrary values (`'[#abc]'`) pass through verbatim.
|
|
77
|
-
* - Otherwise `${classPrefix}-${safeTokenName(value)}` where
|
|
78
|
-
* safeTokenName maps `.` → `_` and `/` → `-`.
|
|
79
|
-
*
|
|
80
|
-
* Static so callers without a StyleProp instance (loader's
|
|
81
|
-
* className builder, codegen's safelist scanner) can derive a class
|
|
82
|
-
* from just the prefix + value pair. Instance callers reach
|
|
83
|
-
* `styleProp.classNameFor(value)`, which supplies the owning Config's
|
|
84
|
-
* prefix automatically.
|
|
85
|
-
*/
|
|
86
|
-
static classNameFor(styleProp, value, prefix = "") {
|
|
87
|
-
if (value === void 0 || value === null || value === false) return void 0;
|
|
88
|
-
let body;
|
|
89
|
-
if (value === true) body = styleProp.classPrefix;
|
|
90
|
-
else {
|
|
91
|
-
const stringValue = String(value);
|
|
92
|
-
const safeValue = stringValue.startsWith("[") && stringValue.endsWith("]") ? stringValue : stringValue.replace(/\./g, "_").replace(/\//g, "-");
|
|
93
|
-
body = styleProp.classPrefix === "" ? safeValue : `${styleProp.classPrefix}-${safeValue}`;
|
|
94
|
-
}
|
|
95
|
-
if (!body) return void 0;
|
|
96
|
-
return prefix ? `${prefix}-${body}` : body;
|
|
97
|
-
}
|
|
98
|
-
/** Instance form of {@link StyleProp.classNameFor} — supplies the owning
|
|
99
|
-
* Config's class-name prefix, and canonicalizes a resolved CSS keyword back
|
|
100
|
-
* to its authored alias ({@link canonicalKeyword}) so a spec that carries
|
|
101
|
-
* either spelling resolves to the one class the alias declared. Without
|
|
102
|
-
* this, a no-prefix prop's resolved spelling collides across props —
|
|
103
|
-
* `textTransform: 'none'` (alias `normal-case`) and `display: 'none'` both
|
|
104
|
-
* produced `.uds-none`, and whichever the CSS emitter wrote last silently
|
|
105
|
-
* redefined the other's rule, leaving `display="none"` painting
|
|
106
|
-
* `text-transform: none` (UDS-2708). */
|
|
107
|
-
classNameFor(value) {
|
|
108
|
-
return StyleProp.classNameFor(this, this.canonicalKeyword(value), this.#prefixGetter());
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Map a resolved CSS keyword back to the alias that authors it, when the
|
|
112
|
-
* value isn't directly writable itself. A value that IS a keyword key
|
|
113
|
-
* (passthrough or alias key) is already canonical and passes through; only
|
|
114
|
-
* a value reachable solely as some alias's resolved form (`'none'` on a
|
|
115
|
-
* prop authored `{ alias: 'normal-case', value: 'none' }`) rewrites to that
|
|
116
|
-
* alias. Non-keyword values (tokens, brackets) pass through untouched.
|
|
117
|
-
*/
|
|
118
|
-
canonicalKeyword(value) {
|
|
119
|
-
if (typeof value !== "string") return value;
|
|
120
|
-
const keywords = this.derived.keywords;
|
|
121
|
-
if (keywords.size === 0 || keywords.has(value)) return value;
|
|
122
|
-
for (const [key, mapped] of keywords) if (typeof key === "string" && mapped === value) return key;
|
|
123
|
-
return value;
|
|
124
|
-
}
|
|
125
|
-
/** The `classPrefix` namespaced with the owning Config's prefix
|
|
126
|
-
* (`bg` → `yos-bg`). The wildcard `@utility` emitter needs the
|
|
127
|
-
* prefixed stem (`yos-bg-*`) since it has no concrete value to run
|
|
128
|
-
* through {@link classNameFor}. Empty when this prop has no class
|
|
129
|
-
* prefix (value-as-class props emit no wildcard utility). */
|
|
130
|
-
get prefixedClassPrefix() {
|
|
131
|
-
if (this.classPrefix === "") return "";
|
|
132
|
-
const prefix = this.#prefixGetter();
|
|
133
|
-
return prefix ? `${prefix}-${this.classPrefix}` : this.classPrefix;
|
|
134
|
-
}
|
|
135
|
-
constructor(args) {
|
|
136
|
-
this.#prefixGetter = args.prefixGetter ?? (() => "uds");
|
|
137
|
-
this.name = args.name;
|
|
138
|
-
this.cssProperty = args.definition.cssProperty;
|
|
139
|
-
this.classPrefix = args.definition.classPrefix;
|
|
140
|
-
this.values = args.definition.values ?? [];
|
|
141
|
-
const arbInput = args.definition.arbitrary;
|
|
142
|
-
if (arbInput === true) this.arbitrary = {};
|
|
143
|
-
else if (arbInput === false || arbInput === void 0) this.arbitrary = void 0;
|
|
144
|
-
else if (typeof arbInput === "string") this.arbitrary = { type: arbInput };
|
|
145
|
-
else this.arbitrary = arbInput;
|
|
146
|
-
this.negative = args.definition.negative === true;
|
|
147
|
-
this.cssType = args.definition.cssType;
|
|
148
|
-
this.metadata = args.definition.metadata ?? {};
|
|
149
|
-
this.opacityPair = args.definition.opacityPair;
|
|
150
|
-
this.transform = args.definition.transform;
|
|
151
|
-
this.#tokenLookup = args.tokenLookup;
|
|
152
|
-
}
|
|
153
|
-
get derived() {
|
|
154
|
-
if (!this.#derived) {
|
|
155
|
-
const values = this.values;
|
|
156
|
-
const lookup = this.#tokenLookup;
|
|
157
|
-
const keywords = /* @__PURE__ */ new Map();
|
|
158
|
-
for (const entry of values) if (typeof entry === "string") keywords.set(entry, this.transform ? this.transform(entry) : entry);
|
|
159
|
-
else if (typeof entry === "number") keywords.set(entry, this.transform ? this.transform(entry) : String(entry));
|
|
160
|
-
else if (typeof entry === "boolean") keywords.set(entry, String(entry));
|
|
161
|
-
else if (typeof entry === "object" && entry !== null && "alias" in entry && "value" in entry) keywords.set(entry.alias, entry.value);
|
|
162
|
-
this.#derived = {
|
|
163
|
-
keywords,
|
|
164
|
-
get tokens() {
|
|
165
|
-
const out = [];
|
|
166
|
-
for (const entry of values) if (isTokenGroupRef(entry)) for (const token of lookup(entry.ref)) out.push(token);
|
|
167
|
-
return out;
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
return this.#derived;
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Token-group namespaces this prop consumes. Used by
|
|
175
|
-
* `TokenGroup.derived.styleProperties` to answer the reverse question.
|
|
176
|
-
*/
|
|
177
|
-
consumedTokenGroups() {
|
|
178
|
-
const out = [];
|
|
179
|
-
for (const entry of this.values) if (isTokenGroupRef(entry)) out.push(entry.ref);
|
|
180
|
-
return out;
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* The values this prop accepts, split by how each is written at the JSX site:
|
|
184
|
-
* - `tokens` — token names from the prop's token groups (`gap="2"`).
|
|
185
|
-
* - `keywords` — literal CSS keywords written verbatim (`display="flex"`).
|
|
186
|
-
* - `aliases` — short keys resolving to a CSS keyword (`flexDirection="col"`
|
|
187
|
-
* → `column`).
|
|
188
|
-
* A bracketed `[...]` arbitrary literal is governed by `this.arbitrary`, not
|
|
189
|
-
* enumerated here. Rendered by `uds_get_style_prop` / `uds_list_style_props`;
|
|
190
|
-
* `accepts()` validates against the same set.
|
|
191
|
-
*/
|
|
192
|
-
allowedValues() {
|
|
193
|
-
const keywords = [];
|
|
194
|
-
const aliases = [];
|
|
195
|
-
for (const [key, value] of this.derived.keywords) {
|
|
196
|
-
const alias = String(key);
|
|
197
|
-
if (typeof value === "string" && value !== alias) aliases.push({
|
|
198
|
-
alias,
|
|
199
|
-
value
|
|
200
|
-
});
|
|
201
|
-
else keywords.push(alias);
|
|
202
|
-
}
|
|
203
|
-
return {
|
|
204
|
-
tokens: this.derived.tokens.map((t) => t.name),
|
|
205
|
-
keywords,
|
|
206
|
-
aliases
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Whether a JSX-site value is accepted: a token name, a literal keyword, an
|
|
211
|
-
* alias key, or a bracketed `[...]` literal when the prop enables `arbitrary`
|
|
212
|
-
* values. The validation primitive behind `uds_validate_props` — a non-token
|
|
213
|
-
* keyword prop (`display`) and an arbitrary-only prop (`fontSize`) both work,
|
|
214
|
-
* not just token-group props.
|
|
215
|
-
*/
|
|
216
|
-
accepts(value) {
|
|
217
|
-
if (value.startsWith("[") && value.endsWith("]")) return this.arbitrary !== void 0;
|
|
218
|
-
for (const key of this.derived.keywords.keys()) if (String(key) === value) return true;
|
|
219
|
-
for (const token of this.derived.tokens) if (token.name === value) return true;
|
|
220
|
-
return false;
|
|
221
|
-
}
|
|
222
|
-
toJSON() {
|
|
223
|
-
return {
|
|
224
|
-
name: this.name,
|
|
225
|
-
cssProperty: this.cssProperty,
|
|
226
|
-
classPrefix: this.classPrefix,
|
|
227
|
-
values: this.values,
|
|
228
|
-
...compact({
|
|
229
|
-
arbitrary: this.arbitrary,
|
|
230
|
-
negative: this.negative || void 0,
|
|
231
|
-
cssType: this.cssType,
|
|
232
|
-
metadata: Object.keys(this.metadata).length > 0 ? this.metadata : void 0,
|
|
233
|
-
opacityPair: this.opacityPair
|
|
234
|
-
})
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
};
|
|
238
|
-
//#endregion
|
|
239
|
-
export { StyleProp, isSafeClassNameValue };
|
package/dist/Token.d.ts
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { CssValueTypeName, CssVarRef } from "./types/css-values.js";
|
|
2
|
-
import { SystemLink, TokenDefinition, TokenModifierKey, TokenModifierValue, TokenType, TokenValue } from "./types.js";
|
|
3
|
-
import { CssClassName, CssVar } from "./brands.js";
|
|
4
|
-
|
|
5
|
-
//#region src/Token.d.ts
|
|
6
|
-
/**
|
|
7
|
-
* Resolved literal value — `token()` refs chased; modifier nesting
|
|
8
|
-
* flattened to the base value.
|
|
9
|
-
*/
|
|
10
|
-
type ResolvedTokenLiteral = string | number | boolean | undefined;
|
|
11
|
-
/**
|
|
12
|
-
* Looks up another token by `namespace/name`. Injected by the parent
|
|
13
|
-
* Config so `Token.derived.value` can chase `token()` aliases without
|
|
14
|
-
* holding a back-ref to the whole config object.
|
|
15
|
-
*
|
|
16
|
-
* `context` is the provenance of the token the ref was authored on. A ref
|
|
17
|
-
* inside a linked token is written against the SOURCE system's group names
|
|
18
|
-
* (`token('base/carbon-5')` in a group linked from Yahoo OS means Yahoo OS's
|
|
19
|
-
* `base` group, whatever the consumer renamed it to), so the lookup resolves
|
|
20
|
-
* it through the link markers instead of the consumer's own keys. Local
|
|
21
|
-
* tokens pass no context and resolve against the consumer's keys directly.
|
|
22
|
-
*/
|
|
23
|
-
type TokenSiblingLookup = (qualifiedName: string, context?: SystemLink) => Token | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* Fallback for system-scoped refs with NO consumer entry: the var reference
|
|
26
|
-
* into the pinned system's regenerated node sheet (`var(--<nodePrefix>-…)`).
|
|
27
|
-
* The node sheet emits all its tokens, so the reference always resolves on
|
|
28
|
-
* the page — `undefined` only when the system isn't pinned.
|
|
29
|
-
*/
|
|
30
|
-
type LinkedVarRefLookup = (system: {
|
|
31
|
-
id: string;
|
|
32
|
-
version: string;
|
|
33
|
-
}, qualifiedName: string) => string | undefined;
|
|
34
|
-
declare class Token {
|
|
35
|
-
#private;
|
|
36
|
-
readonly name: string;
|
|
37
|
-
readonly namespace: string;
|
|
38
|
-
readonly value: TokenValue;
|
|
39
|
-
readonly type?: TokenType;
|
|
40
|
-
readonly modifiers?: Record<TokenModifierKey, TokenModifierValue>;
|
|
41
|
-
/** Provenance when this token is linked from another system; `undefined` for
|
|
42
|
-
* local tokens. Round-trips through `toJSON` so a stored config keeps it. */
|
|
43
|
-
readonly link?: SystemLink;
|
|
44
|
-
constructor(args: {
|
|
45
|
-
name: string;
|
|
46
|
-
namespace: string;
|
|
47
|
-
prefixGetter: () => string;
|
|
48
|
-
definition: TokenDefinition;
|
|
49
|
-
lookup: TokenSiblingLookup;
|
|
50
|
-
linkedVarRef?: LinkedVarRefLookup;
|
|
51
|
-
groupTypeGetter: () => TokenType | undefined;
|
|
52
|
-
});
|
|
53
|
-
/**
|
|
54
|
-
* Sniff a raw value to its best-guess CSS value type. Static so
|
|
55
|
-
* picker UIs (authoring a new token with no `Token` instance yet)
|
|
56
|
-
* can reach the same heuristic the class uses internally. Returns
|
|
57
|
-
* `undefined` when no confident match is possible (e.g. `var(...)`
|
|
58
|
-
* references).
|
|
59
|
-
*/
|
|
60
|
-
static sniffValueType(value: string): TokenType | undefined;
|
|
61
|
-
get derived(): {
|
|
62
|
-
readonly namespace: string;
|
|
63
|
-
readonly qualifiedName: string;
|
|
64
|
-
readonly cssSafeName: CssClassName;
|
|
65
|
-
readonly cssVar: CssVar;
|
|
66
|
-
readonly cssVarRef: CssVarRef;
|
|
67
|
-
readonly value: ResolvedTokenLiteral;
|
|
68
|
-
readonly cssValueType: CssValueTypeName | undefined;
|
|
69
|
-
modifierValues(): Iterable<[TokenModifierKey, ResolvedTokenLiteral]>;
|
|
70
|
-
};
|
|
71
|
-
toJSON(): TokenDefinition & {
|
|
72
|
-
name: string;
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
//#endregion
|
|
76
|
-
export { LinkedVarRefLookup, ResolvedTokenLiteral, Token, TokenSiblingLookup };
|
package/dist/Token.js
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { buildCssVar, kebabCase, toCssSafeName } from "./entity-utils.js";
|
|
2
|
-
import { isTokenRef } from "./refs.js";
|
|
3
|
-
import { resolveTokenValueType, sniffTokenType } from "./tokenValueType.js";
|
|
4
|
-
//#region src/Token.ts
|
|
5
|
-
var Token = class {
|
|
6
|
-
name;
|
|
7
|
-
namespace;
|
|
8
|
-
value;
|
|
9
|
-
type;
|
|
10
|
-
modifiers;
|
|
11
|
-
/** Provenance when this token is linked from another system; `undefined` for
|
|
12
|
-
* local tokens. Round-trips through `toJSON` so a stored config keeps it. */
|
|
13
|
-
link;
|
|
14
|
-
#prefixGetter;
|
|
15
|
-
#lookup;
|
|
16
|
-
#linkedVarRef;
|
|
17
|
-
#groupTypeGetter;
|
|
18
|
-
#derived;
|
|
19
|
-
constructor(args) {
|
|
20
|
-
this.name = args.name;
|
|
21
|
-
this.namespace = args.namespace;
|
|
22
|
-
this.value = args.definition.value;
|
|
23
|
-
this.type = args.definition.type;
|
|
24
|
-
this.modifiers = collectModifiers(args.definition);
|
|
25
|
-
this.link = args.definition.link;
|
|
26
|
-
this.#prefixGetter = args.prefixGetter;
|
|
27
|
-
this.#lookup = args.lookup;
|
|
28
|
-
this.#linkedVarRef = args.linkedVarRef;
|
|
29
|
-
this.#groupTypeGetter = args.groupTypeGetter;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Sniff a raw value to its best-guess CSS value type. Static so
|
|
33
|
-
* picker UIs (authoring a new token with no `Token` instance yet)
|
|
34
|
-
* can reach the same heuristic the class uses internally. Returns
|
|
35
|
-
* `undefined` when no confident match is possible (e.g. `var(...)`
|
|
36
|
-
* references).
|
|
37
|
-
*/
|
|
38
|
-
static sniffValueType(value) {
|
|
39
|
-
return sniffTokenType(value);
|
|
40
|
-
}
|
|
41
|
-
get derived() {
|
|
42
|
-
if (!this.#derived) {
|
|
43
|
-
const name = this.name;
|
|
44
|
-
const namespace = this.namespace;
|
|
45
|
-
const tokenValue = this.value;
|
|
46
|
-
const tokenType = this.type;
|
|
47
|
-
const modifiers = this.modifiers;
|
|
48
|
-
const link = this.link;
|
|
49
|
-
const prefixGetter = this.#prefixGetter;
|
|
50
|
-
const lookup = this.#lookup;
|
|
51
|
-
const linkedVarRef = this.#linkedVarRef;
|
|
52
|
-
const groupTypeGetter = this.#groupTypeGetter;
|
|
53
|
-
this.#derived = {
|
|
54
|
-
namespace,
|
|
55
|
-
qualifiedName: `${kebabCase(namespace)}/${kebabCase(name)}`,
|
|
56
|
-
cssSafeName: toCssSafeName(name),
|
|
57
|
-
get cssVar() {
|
|
58
|
-
return buildCssVar(prefixGetter(), namespace, name);
|
|
59
|
-
},
|
|
60
|
-
get cssVarRef() {
|
|
61
|
-
return `var(${buildCssVar(prefixGetter(), namespace, name)})`;
|
|
62
|
-
},
|
|
63
|
-
get value() {
|
|
64
|
-
return chaseLiteral(tokenValue, lookup, link, void 0, linkedVarRef);
|
|
65
|
-
},
|
|
66
|
-
get cssValueType() {
|
|
67
|
-
const literal = chaseLiteral(tokenValue, lookup, link, void 0, linkedVarRef);
|
|
68
|
-
return resolveTokenValueType({
|
|
69
|
-
value: typeof literal === "string" ? literal : String(tokenValue),
|
|
70
|
-
type: tokenType
|
|
71
|
-
}, groupTypeGetter());
|
|
72
|
-
},
|
|
73
|
-
*modifierValues() {
|
|
74
|
-
if (!modifiers) return;
|
|
75
|
-
for (const [key, value] of Object.entries(modifiers)) yield [key, resolveModifierLiteral(value, lookup, link, linkedVarRef)];
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
return this.#derived;
|
|
80
|
-
}
|
|
81
|
-
toJSON() {
|
|
82
|
-
const out = {
|
|
83
|
-
name: this.name,
|
|
84
|
-
value: this.value
|
|
85
|
-
};
|
|
86
|
-
if (this.type !== void 0) out.type = this.type;
|
|
87
|
-
if (this.link !== void 0) out.link = this.link;
|
|
88
|
-
if (this.modifiers) for (const [key, value] of Object.entries(this.modifiers)) out[key] = value;
|
|
89
|
-
return out;
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
/**
|
|
93
|
-
* Scan a `TokenDefinition` for flat `_${string}` modifier keys and pack
|
|
94
|
-
* them into a single `modifiers` map. Returns `undefined` when no
|
|
95
|
-
* modifier keys are present so the class field can stay optional.
|
|
96
|
-
*/
|
|
97
|
-
function collectModifiers(definition) {
|
|
98
|
-
const modifiers = {};
|
|
99
|
-
let count = 0;
|
|
100
|
-
for (const [key, value] of Object.entries(definition)) if (key.startsWith("_")) {
|
|
101
|
-
modifiers[key] = value;
|
|
102
|
-
count++;
|
|
103
|
-
}
|
|
104
|
-
return count > 0 ? modifiers : void 0;
|
|
105
|
-
}
|
|
106
|
-
function chaseLiteral(value, lookup, context, seen = /* @__PURE__ */ new Set(), linkedVarRef) {
|
|
107
|
-
if (isTokenRef(value)) {
|
|
108
|
-
let refContext = context;
|
|
109
|
-
if (value.scope === "consumer") refContext = void 0;
|
|
110
|
-
else if (value.system) refContext = {
|
|
111
|
-
kind: "token",
|
|
112
|
-
systemId: value.system.id,
|
|
113
|
-
systemVersion: value.system.version,
|
|
114
|
-
sourceKey: value.ref
|
|
115
|
-
};
|
|
116
|
-
const seenKey = `${refContext?.systemId ?? ""}:${value.ref}`;
|
|
117
|
-
if (seen.has(seenKey)) return void 0;
|
|
118
|
-
seen.add(seenKey);
|
|
119
|
-
const next = lookup(value.ref, refContext);
|
|
120
|
-
if (!next) {
|
|
121
|
-
if (value.system && linkedVarRef) return linkedVarRef(value.system, value.ref);
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
return chaseLiteral(next.value, lookup, next.link, seen, linkedVarRef);
|
|
125
|
-
}
|
|
126
|
-
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") return value;
|
|
127
|
-
}
|
|
128
|
-
function resolveModifierLiteral(value, lookup, context, linkedVarRef) {
|
|
129
|
-
if (typeof value === "object" && value !== null && "value" in value) return chaseLiteral(value.value, lookup, context, void 0, linkedVarRef);
|
|
130
|
-
return chaseLiteral(value, lookup, context, void 0, linkedVarRef);
|
|
131
|
-
}
|
|
132
|
-
//#endregion
|
|
133
|
-
export { Token };
|
package/dist/TokenGroup.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { SerializedTokenGroup, TokenGroupDefinition } from "./types.js";
|
|
2
|
-
import { LinkedVarRefLookup, Token, TokenSiblingLookup } from "./Token.js";
|
|
3
|
-
|
|
4
|
-
//#region src/TokenGroup.d.ts
|
|
5
|
-
type StylePropertiesLookup = (namespace: string) => readonly string[];
|
|
6
|
-
declare class TokenGroup {
|
|
7
|
-
#private;
|
|
8
|
-
readonly namespace: string;
|
|
9
|
-
readonly label?: string;
|
|
10
|
-
readonly description?: string;
|
|
11
|
-
readonly tokens: ReadonlyMap<string, Token>;
|
|
12
|
-
constructor(args: {
|
|
13
|
-
namespace: string;
|
|
14
|
-
prefixGetter: () => string;
|
|
15
|
-
definition: TokenGroupDefinition;
|
|
16
|
-
tokenLookup: TokenSiblingLookup;
|
|
17
|
-
linkedVarRef?: LinkedVarRefLookup;
|
|
18
|
-
stylePropertiesLookup: StylePropertiesLookup;
|
|
19
|
-
});
|
|
20
|
-
get derived(): {
|
|
21
|
-
readonly cssPrefix: string;
|
|
22
|
-
readonly styleProperties: readonly string[];
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Wire shape: `{ tokens, label?, description? }`. Token entries live
|
|
26
|
-
* nested under `tokens` so meta keys can never collide with token
|
|
27
|
-
* names — a token named `'label'` is fine. The parent record's key
|
|
28
|
-
* carries the namespace, so it's omitted here.
|
|
29
|
-
*/
|
|
30
|
-
toJSON(): SerializedTokenGroup;
|
|
31
|
-
}
|
|
32
|
-
//#endregion
|
|
33
|
-
export { TokenGroup };
|
package/dist/TokenGroup.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { kebabCase } from "./entity-utils.js";
|
|
2
|
-
import { Token } from "./Token.js";
|
|
3
|
-
//#region src/TokenGroup.ts
|
|
4
|
-
/**
|
|
5
|
-
* `TokenGroup` — a namespace of tokens (`color`, `spacing`).
|
|
6
|
-
*
|
|
7
|
-
* Owns its tokens and exposes `.derived.styleProperties` — the
|
|
8
|
-
* style-prop names whose `values` array references this group. The
|
|
9
|
-
* `styleProperties` computation needs sibling style-props, supplied by
|
|
10
|
-
* the parent `Config` via the `styleProperties` callable.
|
|
11
|
-
*/
|
|
12
|
-
var TokenGroup = class {
|
|
13
|
-
namespace;
|
|
14
|
-
label;
|
|
15
|
-
description;
|
|
16
|
-
tokens;
|
|
17
|
-
#stylePropertiesLookup;
|
|
18
|
-
#derived;
|
|
19
|
-
constructor(args) {
|
|
20
|
-
this.namespace = args.namespace;
|
|
21
|
-
const groupTypeGetter = () => void 0;
|
|
22
|
-
if (args.definition.label !== void 0) this.label = args.definition.label;
|
|
23
|
-
if (args.definition.description !== void 0) this.description = args.definition.description;
|
|
24
|
-
const tokens = /* @__PURE__ */ new Map();
|
|
25
|
-
for (const [name, tokenDef] of Object.entries(args.definition.tokens)) tokens.set(name, new Token({
|
|
26
|
-
name,
|
|
27
|
-
namespace: args.namespace,
|
|
28
|
-
prefixGetter: args.prefixGetter,
|
|
29
|
-
definition: tokenDef,
|
|
30
|
-
lookup: args.tokenLookup,
|
|
31
|
-
linkedVarRef: args.linkedVarRef,
|
|
32
|
-
groupTypeGetter
|
|
33
|
-
}));
|
|
34
|
-
this.tokens = tokens;
|
|
35
|
-
this.#stylePropertiesLookup = args.stylePropertiesLookup;
|
|
36
|
-
}
|
|
37
|
-
get derived() {
|
|
38
|
-
if (!this.#derived) {
|
|
39
|
-
const namespace = this.namespace;
|
|
40
|
-
const lookup = this.#stylePropertiesLookup;
|
|
41
|
-
this.#derived = {
|
|
42
|
-
cssPrefix: kebabCase(namespace),
|
|
43
|
-
get styleProperties() {
|
|
44
|
-
return lookup(namespace);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
return this.#derived;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Wire shape: `{ tokens, label?, description? }`. Token entries live
|
|
52
|
-
* nested under `tokens` so meta keys can never collide with token
|
|
53
|
-
* names — a token named `'label'` is fine. The parent record's key
|
|
54
|
-
* carries the namespace, so it's omitted here.
|
|
55
|
-
*/
|
|
56
|
-
toJSON() {
|
|
57
|
-
const tokens = {};
|
|
58
|
-
for (const [name, token] of this.tokens) {
|
|
59
|
-
const { name: _omit, ...rest } = token.toJSON();
|
|
60
|
-
tokens[name] = rest;
|
|
61
|
-
}
|
|
62
|
-
const out = { tokens };
|
|
63
|
-
if (this.label !== void 0) out.label = this.label;
|
|
64
|
-
if (this.description !== void 0) out.description = this.description;
|
|
65
|
-
return out;
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
//#endregion
|
|
69
|
-
export { TokenGroup };
|
package/dist/asset-kind.d.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
//#region src/asset-kind.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* `assetKind` — what class of asset a group holds (icons, fonts, …).
|
|
4
|
-
*
|
|
5
|
-
* Every asset group picks one of these labels when it's defined (via
|
|
6
|
-
* `.config({ type })`), and we store it on the group as `assetKind`.
|
|
7
|
-
*
|
|
8
|
-
* Why `assetKind` and not just `kind`? Asset groups already carry a
|
|
9
|
-
* separate tag, `__kind: 'assetGroup'`, that marks them as asset-group
|
|
10
|
-
* refs. That tag is the same for every group regardless of class, and
|
|
11
|
-
* the check that relies on it (`isAssetGroupRef()`) must stay that way.
|
|
12
|
-
* If we also called this field `kind`, the two would collide and blur
|
|
13
|
-
* the distinction between "is this an asset group?" and "what kind of
|
|
14
|
-
* asset is in it?". So this field gets its own name: `__kind` answers
|
|
15
|
-
* the first question, `assetKind` answers the second.
|
|
16
|
-
*
|
|
17
|
-
* Behavior differences between classes live in one table below and are
|
|
18
|
-
* read through small helpers like `isPlaceable()`. That keeps callers
|
|
19
|
-
* from branching on the class directly (no "is this a font?" checks
|
|
20
|
-
* scattered around), and adding a new class means adding one row here
|
|
21
|
-
* plus its member contract — not new branches everywhere.
|
|
22
|
-
*/
|
|
23
|
-
type AssetKind = 'icon' | 'font';
|
|
24
|
-
/**
|
|
25
|
-
* Per-class capability record. `placeable` — whether members of this
|
|
26
|
-
* class become canvas nodes (icons do; fonts are consumed via
|
|
27
|
-
* `font-family` token refs and never placed). Both hard guards read
|
|
28
|
-
* this through `isPlaceable()`: the `makeRegistry` asset loop and the
|
|
29
|
-
* `.accepts()` config-load throw.
|
|
30
|
-
*
|
|
31
|
-
* Classes we expect to add later (each is one new row here plus its
|
|
32
|
-
* member contract — and likely `placeable: true`):
|
|
33
|
-
* - images — bitmap assets (PNG/JPEG/WebP) dropped onto the canvas
|
|
34
|
-
* - illustrations — vector artwork (SVG) placed as canvas nodes
|
|
35
|
-
* - logos — brand marks, a constrained flavor of image/vector asset
|
|
36
|
-
* - videos — playable media placed as canvas nodes
|
|
37
|
-
*/
|
|
38
|
-
declare const ASSET_CLASS_CAPABILITIES: {
|
|
39
|
-
readonly icon: {
|
|
40
|
-
readonly placeable: true;
|
|
41
|
-
};
|
|
42
|
-
readonly font: {
|
|
43
|
-
readonly placeable: false;
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* Whether a group's members can fill slots and become canvas nodes.
|
|
48
|
-
* Accepts anything carrying the stamped `assetKind` — both the
|
|
49
|
-
* authored `AssetGroupDefinition` and the registered `AssetGroup`.
|
|
50
|
-
*/
|
|
51
|
-
declare function isPlaceable(group: {
|
|
52
|
-
readonly assetKind: AssetKind;
|
|
53
|
-
}): boolean;
|
|
54
|
-
//#endregion
|
|
55
|
-
export { ASSET_CLASS_CAPABILITIES, AssetKind, isPlaceable };
|
package/dist/asset-kind.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
//#region src/asset-kind.ts
|
|
2
|
-
/**
|
|
3
|
-
* Per-class capability record. `placeable` — whether members of this
|
|
4
|
-
* class become canvas nodes (icons do; fonts are consumed via
|
|
5
|
-
* `font-family` token refs and never placed). Both hard guards read
|
|
6
|
-
* this through `isPlaceable()`: the `makeRegistry` asset loop and the
|
|
7
|
-
* `.accepts()` config-load throw.
|
|
8
|
-
*
|
|
9
|
-
* Classes we expect to add later (each is one new row here plus its
|
|
10
|
-
* member contract — and likely `placeable: true`):
|
|
11
|
-
* - images — bitmap assets (PNG/JPEG/WebP) dropped onto the canvas
|
|
12
|
-
* - illustrations — vector artwork (SVG) placed as canvas nodes
|
|
13
|
-
* - logos — brand marks, a constrained flavor of image/vector asset
|
|
14
|
-
* - videos — playable media placed as canvas nodes
|
|
15
|
-
*/
|
|
16
|
-
const ASSET_CLASS_CAPABILITIES = {
|
|
17
|
-
icon: { placeable: true },
|
|
18
|
-
font: { placeable: false }
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Whether a group's members can fill slots and become canvas nodes.
|
|
22
|
-
* Accepts anything carrying the stamped `assetKind` — both the
|
|
23
|
-
* authored `AssetGroupDefinition` and the registered `AssetGroup`.
|
|
24
|
-
*/
|
|
25
|
-
function isPlaceable(group) {
|
|
26
|
-
return ASSET_CLASS_CAPABILITIES[group.assetKind].placeable;
|
|
27
|
-
}
|
|
28
|
-
//#endregion
|
|
29
|
-
export { ASSET_CLASS_CAPABILITIES, isPlaceable };
|
package/dist/asset-value.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { FontAssetMember } from "./types.js";
|
|
2
|
-
import { AssetGroup } from "./AssetGroup.js";
|
|
3
|
-
|
|
4
|
-
//#region src/asset-value.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Assemble a `font-family` CSS value from a font member — the primary
|
|
7
|
-
* family (always double-quoted, so multi-word names are valid) followed by
|
|
8
|
-
* its fallback stack. `fallback` rides `FontAssetMember`'s open index as
|
|
9
|
-
* `unknown`, so read it defensively: a `string` is appended verbatim (it
|
|
10
|
-
* may itself be a comma list), a `string[]` is joined, anything else is
|
|
11
|
-
* ignored. Fallback entries are emitted verbatim — they're generic keywords
|
|
12
|
-
* (`sans-serif`) or already-formatted names.
|
|
13
|
-
*/
|
|
14
|
-
declare function resolveFontStack(member: FontAssetMember): string;
|
|
15
|
-
/**
|
|
16
|
-
* Resolve a `<slug>/<member>` asset ref to its `font-family` CSS stack.
|
|
17
|
-
* Every failure is a named throw (no silent string fallthrough): a
|
|
18
|
-
* malformed ref, an unregistered group, a non-font group, or a missing
|
|
19
|
-
* member each name the offending ref so config load fails loudly.
|
|
20
|
-
*/
|
|
21
|
-
declare function resolveAssetRefCss(ref: string, assetGroups: ReadonlyMap<string, AssetGroup>): string;
|
|
22
|
-
//#endregion
|
|
23
|
-
export { resolveAssetRefCss, resolveFontStack };
|