@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,246 @@
|
|
|
1
|
+
//#region src/framework/changes.ts
|
|
2
|
+
/** The base as a config of its own — the branch with no draft applied. */
|
|
3
|
+
function baseOf(config) {
|
|
4
|
+
return config.withDraft([]).config;
|
|
5
|
+
}
|
|
6
|
+
const str = (value) => typeof value === "string" ? value : void 0;
|
|
7
|
+
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8
|
+
/** A value inside a body, by dotted path. `undefined` past any missing step. */
|
|
9
|
+
function walk(body, segments) {
|
|
10
|
+
let current = body;
|
|
11
|
+
for (const segment of segments) {
|
|
12
|
+
if (!isRecord(current)) return void 0;
|
|
13
|
+
current = current[segment];
|
|
14
|
+
}
|
|
15
|
+
return current;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The dotted path a sub-op's member sits at. `field` is the declared path (`props/value`) and
|
|
19
|
+
* `owner` the member it sits in (`size`), so the owner slots in after the first segment.
|
|
20
|
+
*/
|
|
21
|
+
function subFieldPath({ field, owner, key }) {
|
|
22
|
+
const [head, ...rest] = field.split("/");
|
|
23
|
+
const segments = owner ? [
|
|
24
|
+
head,
|
|
25
|
+
owner,
|
|
26
|
+
...rest
|
|
27
|
+
] : [head, ...rest];
|
|
28
|
+
if (key !== void 0) segments.push(key);
|
|
29
|
+
return segments.join(".");
|
|
30
|
+
}
|
|
31
|
+
/** The body a target has in a config: the resolved item, or the stored group node. */
|
|
32
|
+
function bodyAt(config, kind, path, target) {
|
|
33
|
+
if (target === "group") return config.groupMeta(kind, path);
|
|
34
|
+
return config.resolve(kind, path)?.body;
|
|
35
|
+
}
|
|
36
|
+
/** The value a change addresses in one config — the body, or the field within it. */
|
|
37
|
+
function changeValueAt({ config, change, side }) {
|
|
38
|
+
if (change.target === "order" || change.path === void 0) return side === "before" ? config.snapshot.values(change.kind).map((entity) => entity.path) : void 0;
|
|
39
|
+
const body = bodyAt(config, change.kind, change.path, change.target);
|
|
40
|
+
if (change.field === void 0) return body;
|
|
41
|
+
return walk(body, change.field.split("."));
|
|
42
|
+
}
|
|
43
|
+
const GROUP_OPERATIONS = new Set([
|
|
44
|
+
"group-update",
|
|
45
|
+
"group-rename",
|
|
46
|
+
"group-delete"
|
|
47
|
+
]);
|
|
48
|
+
/** One pending patch as a change, with its values read off `base` and `draft`. */
|
|
49
|
+
function changeOf(entry, { base, draft }) {
|
|
50
|
+
const patch = entry.patch;
|
|
51
|
+
const kind = str(patch.kind) ?? "config";
|
|
52
|
+
const operation = str(patch.verb) ?? str(patch.operation) ?? "update";
|
|
53
|
+
const path = str(patch.path) ?? str(patch.input?.path);
|
|
54
|
+
const to = str(patch.to);
|
|
55
|
+
const head = {
|
|
56
|
+
id: entry.id,
|
|
57
|
+
changeset: entry.changeset,
|
|
58
|
+
kind,
|
|
59
|
+
operation
|
|
60
|
+
};
|
|
61
|
+
if (operation === "reorder" || operation === "group-reorder") return {
|
|
62
|
+
...head,
|
|
63
|
+
target: "order",
|
|
64
|
+
before: base.snapshot.values(kind).map((entity) => entity.path),
|
|
65
|
+
after: Array.isArray(patch.order) ? patch.order : void 0
|
|
66
|
+
};
|
|
67
|
+
const target = GROUP_OPERATIONS.has(operation) ? "group" : "item";
|
|
68
|
+
if (operation === "rename" || operation === "group-rename") return {
|
|
69
|
+
...head,
|
|
70
|
+
target,
|
|
71
|
+
path,
|
|
72
|
+
to,
|
|
73
|
+
before: path,
|
|
74
|
+
after: to
|
|
75
|
+
};
|
|
76
|
+
let field;
|
|
77
|
+
const declaredField = str(patch.field);
|
|
78
|
+
if (declaredField !== void 0) field = subFieldPath({
|
|
79
|
+
field: declaredField,
|
|
80
|
+
owner: str(patch.owner),
|
|
81
|
+
key: str(patch.key)
|
|
82
|
+
});
|
|
83
|
+
else if ((operation === "update" || operation === "group-update") && isRecord(patch.data)) {
|
|
84
|
+
const keys = Object.keys(patch.data);
|
|
85
|
+
if (keys.length === 1) field = keys[0];
|
|
86
|
+
}
|
|
87
|
+
const shape = {
|
|
88
|
+
kind,
|
|
89
|
+
path,
|
|
90
|
+
field,
|
|
91
|
+
target
|
|
92
|
+
};
|
|
93
|
+
return {
|
|
94
|
+
...head,
|
|
95
|
+
target,
|
|
96
|
+
path,
|
|
97
|
+
field,
|
|
98
|
+
before: changeValueAt({
|
|
99
|
+
config: base,
|
|
100
|
+
change: shape,
|
|
101
|
+
side: "before"
|
|
102
|
+
}),
|
|
103
|
+
after: changeValueAt({
|
|
104
|
+
config: draft,
|
|
105
|
+
change: shape,
|
|
106
|
+
side: "after"
|
|
107
|
+
})
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/** Every pending patch of `config` as a change, in draft order. */
|
|
111
|
+
function changesOf(config, base = baseOf(config)) {
|
|
112
|
+
return config.pending.map((entry) => changeOf(entry, {
|
|
113
|
+
base,
|
|
114
|
+
draft: config
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
117
|
+
/** `path` relative to `entity`: `''` for the entity itself, else the remainder. */
|
|
118
|
+
function relativeTo(entity, path) {
|
|
119
|
+
if (path === entity) return "";
|
|
120
|
+
if (path.startsWith(`${entity}/`)) return path.slice(entity.length + 1);
|
|
121
|
+
return path;
|
|
122
|
+
}
|
|
123
|
+
/** The last segment of a path. */
|
|
124
|
+
const leafOf = (path) => path.slice(path.lastIndexOf("/") + 1);
|
|
125
|
+
const quoteList = (names) => [...names].map((name) => `'${name}'`).join(", ");
|
|
126
|
+
/** A collector for one phrase family: subgroups touched and leaf names touched, kept in order. */
|
|
127
|
+
var Touched = class {
|
|
128
|
+
subgroups = /* @__PURE__ */ new Set();
|
|
129
|
+
leaves = /* @__PURE__ */ new Set();
|
|
130
|
+
add(relative) {
|
|
131
|
+
const slash = relative.indexOf("/");
|
|
132
|
+
if (slash === -1) this.leaves.add(relative);
|
|
133
|
+
else this.subgroups.add(relative.slice(0, slash));
|
|
134
|
+
}
|
|
135
|
+
get empty() {
|
|
136
|
+
return this.subgroups.size === 0 && this.leaves.size === 0;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* What a set of changes on one entity did, in words — the line a card carries under the entity's
|
|
141
|
+
* name. `entity` is the path the changes are grouped under, which may be a prefix of what each
|
|
142
|
+
* change addresses (a token group over its tokens) or the item itself (a component).
|
|
143
|
+
*/
|
|
144
|
+
function summarizeChanges({ config, kind, entity, changes }) {
|
|
145
|
+
const label = config.entityLabel(kind).toLowerCase();
|
|
146
|
+
const plural = config.entityLabelPlural(kind).toLowerCase();
|
|
147
|
+
const added = new Touched();
|
|
148
|
+
const adjusted = new Touched();
|
|
149
|
+
const removed = /* @__PURE__ */ new Set();
|
|
150
|
+
const renamed = [];
|
|
151
|
+
const newMembers = /* @__PURE__ */ new Map();
|
|
152
|
+
const ownFields = /* @__PURE__ */ new Set();
|
|
153
|
+
let reordered = false;
|
|
154
|
+
for (const change of changes) {
|
|
155
|
+
if (change.target === "order") {
|
|
156
|
+
reordered = true;
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
const relative = entity !== void 0 && change.path !== void 0 ? relativeTo(entity, change.path) : change.path ?? "";
|
|
160
|
+
switch (change.operation) {
|
|
161
|
+
case "create":
|
|
162
|
+
case "replace":
|
|
163
|
+
added.add(relative);
|
|
164
|
+
break;
|
|
165
|
+
case "group-update":
|
|
166
|
+
if (change.before === void 0) added.add(relative);
|
|
167
|
+
else adjusted.add(relative);
|
|
168
|
+
break;
|
|
169
|
+
case "sub-create":
|
|
170
|
+
case "sub-upsert": {
|
|
171
|
+
const head = change.field?.split(".")[0] ?? "";
|
|
172
|
+
const name = (config.subEntityOf(kind, head)?.label ?? head).toLowerCase();
|
|
173
|
+
newMembers.set(name, (newMembers.get(name) ?? 0) + 1);
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
case "delete":
|
|
177
|
+
case "group-delete":
|
|
178
|
+
removed.add(relative || leafOf(change.path ?? label));
|
|
179
|
+
break;
|
|
180
|
+
case "rename":
|
|
181
|
+
case "group-rename":
|
|
182
|
+
renamed.push(`Renamed '${relative || change.path}' to '${entity !== void 0 && change.to !== void 0 ? relativeTo(entity, change.to) : change.to}'`);
|
|
183
|
+
break;
|
|
184
|
+
default: if (relative === "") {
|
|
185
|
+
const head = change.field?.split(".")[0];
|
|
186
|
+
if (head) ownFields.add(head);
|
|
187
|
+
else adjusted.add("");
|
|
188
|
+
} else adjusted.add(relative);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
const phrases = [];
|
|
192
|
+
if (added.subgroups.size > 0) {
|
|
193
|
+
const noun = added.subgroups.size === 1 ? "subgroup" : "subgroups";
|
|
194
|
+
phrases.push(`New ${noun} ${quoteList(added.subgroups)} added`);
|
|
195
|
+
}
|
|
196
|
+
if (added.leaves.size > 0) {
|
|
197
|
+
const leaves = [...added.leaves].filter((leaf) => leaf !== "");
|
|
198
|
+
if (leaves.length > 0) {
|
|
199
|
+
const noun = leaves.length === 1 ? label : plural;
|
|
200
|
+
phrases.push(`New ${noun} ${quoteList(leaves)} added`);
|
|
201
|
+
}
|
|
202
|
+
if (added.leaves.has("")) phrases.push(`New ${label}`);
|
|
203
|
+
}
|
|
204
|
+
for (const [name, count] of newMembers) phrases.push(count === 1 ? `New ${name}` : `${count} new ${name}s`);
|
|
205
|
+
if (adjusted.subgroups.size > 0) {
|
|
206
|
+
const noun = adjusted.subgroups.size === 1 ? "subgroup" : "subgroups";
|
|
207
|
+
phrases.push(`Adjustments to ${noun} ${quoteList(adjusted.subgroups)}`);
|
|
208
|
+
}
|
|
209
|
+
{
|
|
210
|
+
const leaves = [...adjusted.leaves].filter((leaf) => leaf !== "");
|
|
211
|
+
if (leaves.length > 0) phrases.push(`Adjustments to ${quoteList(leaves)}`);
|
|
212
|
+
}
|
|
213
|
+
if (ownFields.size > 0) phrases.push(`Adjustments to ${[...ownFields].join(", ")}`);
|
|
214
|
+
else if (adjusted.leaves.has("")) phrases.push("Adjustments");
|
|
215
|
+
if (removed.size > 0) phrases.push(`Removed ${quoteList(removed)}`);
|
|
216
|
+
phrases.push(...renamed);
|
|
217
|
+
if (reordered) phrases.push(`Reordered ${plural}`);
|
|
218
|
+
return phrases.join("; ");
|
|
219
|
+
}
|
|
220
|
+
const count = (n, one, many) => `${n} ${n === 1 ? one : many}`;
|
|
221
|
+
/**
|
|
222
|
+
* A body summarized as what it contains — the cell for a created or deleted container, where the
|
|
223
|
+
* body itself is too much to show. `undefined` for a value that is not a body.
|
|
224
|
+
*
|
|
225
|
+
* `config` is the one the body was read from, since a group's members are counted there.
|
|
226
|
+
*/
|
|
227
|
+
function describeBody({ config, kind, path, target, value }) {
|
|
228
|
+
if (!isRecord(value)) return void 0;
|
|
229
|
+
const label = config.entityLabel(kind).toLowerCase();
|
|
230
|
+
const plural = config.entityLabelPlural(kind).toLowerCase();
|
|
231
|
+
if (target === "group") {
|
|
232
|
+
const members = config.members(kind, path).length;
|
|
233
|
+
return `1 ${label} group with ${count(members, label, plural)}`;
|
|
234
|
+
}
|
|
235
|
+
const parts = [];
|
|
236
|
+
const subEntities = config.entityOf(kind)?.subEntities ?? {};
|
|
237
|
+
for (const [field, sub] of Object.entries(subEntities)) {
|
|
238
|
+
const members = value[field];
|
|
239
|
+
const size = isRecord(members) ? Object.keys(members).length : 0;
|
|
240
|
+
if (size === 0) continue;
|
|
241
|
+
parts.push(count(size, sub.label.toLowerCase(), sub.labelPlural.toLowerCase()));
|
|
242
|
+
}
|
|
243
|
+
return parts.length > 0 ? `1 ${label} with ${parts.join(", ")}` : `1 ${label}`;
|
|
244
|
+
}
|
|
245
|
+
//#endregion
|
|
246
|
+
export { baseOf, changeOf, changeValueAt, changesOf, describeBody, summarizeChanges };
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { Config } from "./Config.js";
|
|
2
|
+
|
|
3
|
+
//#region src/framework/class-names.d.ts
|
|
4
|
+
/** `HStack` → `hstack`, `AvatarItem` → `avatar-item`. A dash only between a lower/digit and an
|
|
5
|
+
* upper, so an initialism isn't split. */
|
|
6
|
+
declare function kebabComponent(name: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* The attribute a surface sets to hold a modifier's state open — `data-create-force-focus-visible`.
|
|
9
|
+
*
|
|
10
|
+
* This is a contract between two sides that can't see each other: an editor sets the attribute on an
|
|
11
|
+
* element, and a stylesheet emitted somewhere else has to match it. Every spelling derives from here,
|
|
12
|
+
* including the playground's inlined copy, since a multi-word modifier (`focusVisible`) matches
|
|
13
|
+
* nothing when one side skips the kebab-casing.
|
|
14
|
+
*/
|
|
15
|
+
declare function forceStateAttribute(modifier: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* The attribute that forces one mode group on an element and its subtree:
|
|
18
|
+
* `data-create-force-mode-<group>="<option>"`. The group is lowercased and a nested group's slashes
|
|
19
|
+
* become dashes, since an attribute name can hold neither. The emitter admits this attribute beside
|
|
20
|
+
* every selector mode's own selector, so an element carrying it is in the mode whatever shape the
|
|
21
|
+
* author gave the selector.
|
|
22
|
+
*/
|
|
23
|
+
declare function forceModeAttribute(group: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* The attribute and value that force one mode option (`colorMode/dark` →
|
|
26
|
+
* `data-create-force-mode-colormode="dark"`). A mode outside any group has none, since there is no
|
|
27
|
+
* group to force.
|
|
28
|
+
*/
|
|
29
|
+
declare function forceModeAttributeOf(modePath: string): {
|
|
30
|
+
name: string;
|
|
31
|
+
value: string;
|
|
32
|
+
} | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* The spec prop that forces a mode group on an element. It keeps the group's authored casing
|
|
35
|
+
* (`data-create-force-mode-colorMode`), and the render wrapper spells it as
|
|
36
|
+
* {@link forceModeAttribute} when it reaches the DOM.
|
|
37
|
+
*/
|
|
38
|
+
declare function forceModeProp(group: string): string;
|
|
39
|
+
/** The group a spec prop forces a mode on, or `undefined` when the prop is something else. */
|
|
40
|
+
declare function forceModePropGroup(key: string): string | undefined;
|
|
41
|
+
/** Whether a spec prop forces a mode group, in the current spelling or the one persisted specs carry. */
|
|
42
|
+
declare function isForceModeProp(key: string): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* The option a spec's props force for one group, or `undefined`. Reads the current prop first, and
|
|
45
|
+
* falls back to the legacy spelling so a design saved before the rename still forces its mode.
|
|
46
|
+
*/
|
|
47
|
+
declare function forceModePropValue(props: Readonly<Record<string, unknown>> | undefined, group: string): string | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Every prop that can force one group, current spelling first. A writer clears each of them when it
|
|
50
|
+
* changes the selection, so a legacy key can't keep forcing a mode the user turned off.
|
|
51
|
+
*/
|
|
52
|
+
declare function forceModeProps(group: string): readonly string[];
|
|
53
|
+
/**
|
|
54
|
+
* The class stem for a component — `uds-list-item`.
|
|
55
|
+
*
|
|
56
|
+
* Derived from the component's PATH, not its name, so a grouped component (`forms/Toggle`) gets a
|
|
57
|
+
* stem no other group can collide with. Everything a component wears extends this stem.
|
|
58
|
+
*/
|
|
59
|
+
declare function componentClassBase(config: Config, path: string): string;
|
|
60
|
+
/** The class one layer wears unconditionally — `uds-list-item-label`. A component's defaults land on
|
|
61
|
+
* this selector at zero specificity, so nothing about it is conditional. */
|
|
62
|
+
declare function componentLayerClass(config: Config, path: string, layer: string): string;
|
|
63
|
+
/**
|
|
64
|
+
* A rule's condition as it appears in a class name: `{size:'xs'}` → `size-xs`, and an empty condition
|
|
65
|
+
* (an unconditional rule) → `''`.
|
|
66
|
+
*
|
|
67
|
+
* A class name is an IDENTIFIER, so the value is made safe for one: an unescaped `.` starts a second
|
|
68
|
+
* class and `/` is not a name character at all, so a rule keyed on `size: '0.5'` emitted
|
|
69
|
+
* `.uds-card-root-size-0.5` — parsed as `.uds-card-root-size-0` plus garbage, discarding the rule,
|
|
70
|
+
* while the module put the literal string on the element.
|
|
71
|
+
*
|
|
72
|
+
* Written out rather than shared with {@link stylePropClassName}, which applies the same transform:
|
|
73
|
+
* as a small module-private helper it did not survive one of the bundlers this module is compiled
|
|
74
|
+
* through, and `uds build` died on `classSafe is not defined`. Two spellings of four characters is
|
|
75
|
+
* the cheaper problem.
|
|
76
|
+
*/
|
|
77
|
+
declare function ruleCondition(when: Record<string, unknown> | null | undefined): string;
|
|
78
|
+
/** One layer's conditional class — the rule it comes from, and the props that have to hold. */
|
|
79
|
+
interface ComponentRuleClass {
|
|
80
|
+
/** The layer the class lands on. */
|
|
81
|
+
readonly layer: string;
|
|
82
|
+
/** Prop → value, all of which must match for the class to apply. Empty means unconditional.
|
|
83
|
+
* `unknown` rather than `string`: a condition on a boolean prop holds a real `true`, and the
|
|
84
|
+
* emitted module tests it with `=== true`. */
|
|
85
|
+
readonly when: Record<string, unknown>;
|
|
86
|
+
readonly className: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Every conditional class a component's style rules produce.
|
|
90
|
+
*
|
|
91
|
+
* Unconditional rules are absent by design: they land on the layer's own zero-specificity selector
|
|
92
|
+
* ({@link componentLayerClass}), which every element already wears with nothing to test.
|
|
93
|
+
*/
|
|
94
|
+
declare function componentRuleClasses(config: Config, path: string): ComponentRuleClass[];
|
|
95
|
+
/**
|
|
96
|
+
* Every COMPOSITE class a component's style rules apply, with the condition each applies under.
|
|
97
|
+
*
|
|
98
|
+
* A composite prop names a value (`variant: 'ui6'`) whose CSS is a class rather than a set of
|
|
99
|
+
* declarations, so it can't reach the element the way a style prop does. Same shape as
|
|
100
|
+
* {@link componentRuleClasses} for that reason.
|
|
101
|
+
*
|
|
102
|
+
* This answers WHICH CLASS a rule's composite ends up as, not who applies it — the layer's receiver
|
|
103
|
+
* does, out of the prop it is forwarded ({@link layerCompositeProps}). The caller is the EXTRACTOR,
|
|
104
|
+
* which has to keep that class's CSS from being shaken out as unreferenced: after the forward the
|
|
105
|
+
* value appears in the emitted module only as a prop string, so nothing else in the build names it.
|
|
106
|
+
*
|
|
107
|
+
* Unlike `componentRuleClasses`, an UNCONDITIONAL rule is included (`when` empty). That function
|
|
108
|
+
* omits them because their declarations land on the layer's own zero-specificity selector — but a
|
|
109
|
+
* composite contributes no declarations there, so omitting it would drop the class entirely.
|
|
110
|
+
*/
|
|
111
|
+
declare function componentCompositeClasses(config: Config, path: string): ComponentRuleClass[];
|
|
112
|
+
/** The class a CSS motion preset is applied by. Namespaced, so it doesn't share a space with the
|
|
113
|
+
* style-prop utilities; the `@keyframes` it runs keep their own name. */
|
|
114
|
+
declare function motionClassName(config: Config, path: string): string;
|
|
115
|
+
/**
|
|
116
|
+
* Every MOTION class a component's style rules apply — a layer bag naming a preset (`motion: 'spin'`).
|
|
117
|
+
*
|
|
118
|
+
* The same shape and the same reason as {@link componentCompositeClasses}: a CSS preset's whole
|
|
119
|
+
* runtime is a class, so a layer that references one has to wear it, under whatever condition its
|
|
120
|
+
* rule declares. Without this the value went nowhere — `motion` names no style property so it isn't
|
|
121
|
+
* a declaration, and it IS a declared prop of the layer's element so it isn't an attribute either.
|
|
122
|
+
*
|
|
123
|
+
* A JS preset is skipped: it animates in the client and has no class to wear.
|
|
124
|
+
*/
|
|
125
|
+
declare function componentMotionClasses(config: Config, path: string): ComponentRuleClass[];
|
|
126
|
+
/**
|
|
127
|
+
* The classes a component's OWN props put on it, by layer — `variant="body"` picking
|
|
128
|
+
* `textVariant/body`'s class.
|
|
129
|
+
*
|
|
130
|
+
* A composite is the only prop that works this way, and it has to: its whole CSS is a class, so it
|
|
131
|
+
* can't ride the prop channel the way a style prop does. That makes it the one piece of an
|
|
132
|
+
* instance's styling a projection can lose entirely, and losing it is what made a component look one
|
|
133
|
+
* way in the component editor and another on a canvas — the expansion resolved it, the anatomy
|
|
134
|
+
* projection had no route for it, and the matrix painted the cell in the wrong typography.
|
|
135
|
+
*
|
|
136
|
+
* So both projections read this and neither derives it. `state` is merged over the component's
|
|
137
|
+
* defaults, because a value the caller didn't set has to read the default — the same rule
|
|
138
|
+
* {@link layerStyles} follows.
|
|
139
|
+
*
|
|
140
|
+
* Keyed by layer even though today it only ever names the ROOT one, so a caller needs no opinion
|
|
141
|
+
* about which layer that is: an instance's own props land where its own props land.
|
|
142
|
+
*/
|
|
143
|
+
declare function componentPropClasses(config: Config, path: string, state?: Record<string, unknown>): Record<string, string[]>;
|
|
144
|
+
/**
|
|
145
|
+
* The COMPOSITE a style rule sets on each layer, for one instance — forwarded to the layer as a prop.
|
|
146
|
+
*
|
|
147
|
+
* A composite's whole CSS is a class, so a rule's condition class (where the stylesheet hangs its
|
|
148
|
+
* DECLARATIONS) cannot carry one. The route is the layer's RECEIVER: the bag key already IS that
|
|
149
|
+
* receiver's own prop name — `variant` for a `Text`-backed layer, `textVariant` for an `Input`-backed
|
|
150
|
+
* one, both binding the same group — so this copies the key verbatim and there is nothing to resolve.
|
|
151
|
+
* `Text` turns `variant="label3"` into `uds-textVariant-label3` for itself, and always has.
|
|
152
|
+
*
|
|
153
|
+
* Forwarding rather than resolving is what makes a layer's styling live-editable at all: a class only
|
|
154
|
+
* exists once a build has emitted the stylesheet, so an edit that makes a NEW style rule paints
|
|
155
|
+
* nothing until a rebuild, while a prop json-render applies on the spot. Both projections of a
|
|
156
|
+
* component read this, so neither has to know the receiver's name for the group.
|
|
157
|
+
*
|
|
158
|
+
* Only what the receiver DECLARES as composite-typed. A bag key it doesn't declare is an ordinary
|
|
159
|
+
* prop or an attribute, and belongs to whatever channel already carries it.
|
|
160
|
+
*/
|
|
161
|
+
declare function layerCompositeProps(config: Config, path: string, state?: Record<string, unknown>): Record<string, Record<string, unknown>>;
|
|
162
|
+
/**
|
|
163
|
+
* The CSS MOTION classes a style rule puts on a layer, for one instance.
|
|
164
|
+
*
|
|
165
|
+
* A preset's whole runtime is a class too, and a composite's route (forward it, and let the receiver
|
|
166
|
+
* resolve its own prop — {@link layerCompositeProps}) does not exist for this one: `motion` is not a
|
|
167
|
+
* style property, so {@link splitStyleProps} has no dispatch for it and a forwarded `motion="spin"`
|
|
168
|
+
* would reach the element as an attribute and animate nothing. The emitted runtime table DOES carry
|
|
169
|
+
* it — codegen adds a closed `motion` entry — which is why a component with a module needs nothing
|
|
170
|
+
* here, and one expanded from the config alone needs this.
|
|
171
|
+
*/
|
|
172
|
+
declare function styleRuleMotionClasses(config: Config, path: string, state?: Record<string, unknown>): Record<string, string[]>;
|
|
173
|
+
/**
|
|
174
|
+
* The class-name stem for a style prop: its authored `classPrefix` when it declares one, else its
|
|
175
|
+
* path — or, for an OPACITY COMPANION, its target's stem plus `-opacity`.
|
|
176
|
+
*
|
|
177
|
+
* An EMPTY prefix is meaningful and not the same as an absent one — `position: absolute` ships as
|
|
178
|
+
* `.uds-absolute`, with no prop segment at all — so this tests for `undefined` rather than
|
|
179
|
+
* falsiness.
|
|
180
|
+
*
|
|
181
|
+
* The companion case exists because the path fallback is wrong for one: a companion is named after
|
|
182
|
+
* the prop it modulates (`bgOpacity`), so falling back to the path spells the stem in the prop's
|
|
183
|
+
* camelCase (`uds-bgOpacity`) rather than the kebab every other class uses, and spells it
|
|
184
|
+
* independently of the target whose fade it is. Deriving it from the PAIRING keeps the two in step —
|
|
185
|
+
* renaming `bg`'s prefix moves `bg-opacity` with it — and costs a config nothing to author. Every
|
|
186
|
+
* opacity prop in every config in this repo declares no prefix, which is what made this reachable.
|
|
187
|
+
*/
|
|
188
|
+
declare function stylePropClassBase(config: Config, path: string): string;
|
|
189
|
+
/**
|
|
190
|
+
* The class for one authored value — `bg="primary"` → `uds-bg-primary`.
|
|
191
|
+
*
|
|
192
|
+
* The value is a LEAF, which is what a call site writes; an empty leaf is a boolean prop's `true`
|
|
193
|
+
* arm, whose class is the bare stem (`uds-border`) because a flag names no value.
|
|
194
|
+
*
|
|
195
|
+
* A slash becomes a dash and a DOT an underscore, because a class name can hold neither: `.uds-p-0.5`
|
|
196
|
+
* is not one selector but two (`uds-p-0` and `5`), so the rule the sheet wrote could never match the
|
|
197
|
+
* element the module classed. `spacing/0.5` is a real token in a real system, which is how that
|
|
198
|
+
* surfaced.
|
|
199
|
+
*/
|
|
200
|
+
declare function stylePropClassName(config: Config, path: string, leaf: string): string;
|
|
201
|
+
/** What a prop bag amounts to once styling is taken out of it. */
|
|
202
|
+
interface SplitStyleProps {
|
|
203
|
+
/** The classes the bag's style props produce, space-joined. */
|
|
204
|
+
readonly className: string;
|
|
205
|
+
/** The props that aren't styling — the element's own (`id`, `onClick`, a data attribute). */
|
|
206
|
+
readonly rest: Record<string, unknown>;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Split a prop bag into a class string and the props that aren't styling.
|
|
210
|
+
*
|
|
211
|
+
* This is the same dispatch the emitted `_style-props` runtime performs, over a live config instead
|
|
212
|
+
* of the table that build baked. Both exist because they run in different places — an app's module
|
|
213
|
+
* has no config at runtime, and the canvas has no baked table for a component that was never built —
|
|
214
|
+
* but the CLASS NAMES both produce come from {@link stylePropClassName}, so the two can't disagree
|
|
215
|
+
* about what a value is called.
|
|
216
|
+
*
|
|
217
|
+
* An off-scale value can't be a class, so it lands in `style` on the returned rest; an explicit
|
|
218
|
+
* `style` the caller passed still wins, since that's the escape hatch of last resort.
|
|
219
|
+
*/
|
|
220
|
+
declare function splitStyleProps({
|
|
221
|
+
config,
|
|
222
|
+
bag,
|
|
223
|
+
through
|
|
224
|
+
}: {
|
|
225
|
+
readonly config: Config;
|
|
226
|
+
readonly bag: Record<string, unknown>;
|
|
227
|
+
/** The definitions this bag's keys resolve against, in precedence order — see
|
|
228
|
+
* {@link stylePropertyPathFor}. `<VStack gap="4">` wears `uds-gap-y-4`. Empty for a bag with no
|
|
229
|
+
* owning component, where a key names its own property. */
|
|
230
|
+
readonly through?: readonly (string | undefined)[];
|
|
231
|
+
}): SplitStyleProps;
|
|
232
|
+
/**
|
|
233
|
+
* Every class a prop can produce, by leaf.
|
|
234
|
+
*
|
|
235
|
+
* Deduplicated on the leaf, keeping the FIRST: a prop may bind two token groups that share one
|
|
236
|
+
* (`top` takes both `spacing` and `position`, and both declare `0`), and `stylePropValueFromLeaf`
|
|
237
|
+
* resolves such a value with a `.find()` — so authored order already decides which token a leaf
|
|
238
|
+
* means, and the class set follows that rather than inventing a second answer.
|
|
239
|
+
*/
|
|
240
|
+
declare function stylePropClasses(config: Config, path: string): Map<string, string>;
|
|
241
|
+
/**
|
|
242
|
+
* Every MODIFIER-prefixed utility class the config itself asks for — `focus:uds-border-color-brand`.
|
|
243
|
+
*
|
|
244
|
+
* Modifier utilities can't be emitted exhaustively: every modifier against every utility is 25 ×
|
|
245
|
+
* 9,284 rules for a real system, and a sheet nobody can load is the same as no sheet. So they're
|
|
246
|
+
* driven by USE, and a build takes `used` from having read the app's source files.
|
|
247
|
+
*
|
|
248
|
+
* Studio has no source files to read, and doesn't need any: a config STATES what it asks for. Every
|
|
249
|
+
* bag it holds — a component's defaults, a preview's, each style rule's per-layer bag, each anatomy
|
|
250
|
+
* node's props, a composite's bag — goes through the same {@link splitStyleProps} the runtime uses,
|
|
251
|
+
* so the strings match on both sides by construction rather than by agreement. For the studio system
|
|
252
|
+
* that's 86 classes against 232,100.
|
|
253
|
+
*
|
|
254
|
+
* WHAT THIS CANNOT SEE, stated because the gap is real: a prop set on a design-file NODE (a
|
|
255
|
+
* `_hover` a user adds in the designer panel) is in the document, not the system, so no projection of
|
|
256
|
+
* the system can predict it. Covering those needs the document as a second source of use.
|
|
257
|
+
*/
|
|
258
|
+
declare function modifierUtilitiesUsed(config: Config): Set<string>;
|
|
259
|
+
//#endregion
|
|
260
|
+
export { ComponentRuleClass, SplitStyleProps, componentClassBase, componentCompositeClasses, componentLayerClass, componentMotionClasses, componentPropClasses, componentRuleClasses, forceModeAttribute, forceModeAttributeOf, forceModeProp, forceModePropGroup, forceModePropValue, forceModeProps, forceStateAttribute, isForceModeProp, kebabComponent, layerCompositeProps, modifierUtilitiesUsed, motionClassName, ruleCondition, splitStyleProps, stylePropClassBase, stylePropClassName, stylePropClasses, styleRuleMotionClasses };
|