@yahoo/uds-create-config 2.44.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +129 -0
- package/dist/ai-lanes.d.ts +23 -0
- package/dist/ai-lanes.js +34 -0
- package/dist/authoring/define-component.d.ts +85 -0
- package/dist/configs/CanvasConfig.d.ts +3237 -0
- package/dist/configs/CanvasConfig.js +332 -0
- package/dist/configs/build-options.d.ts +10 -0
- package/dist/configs/build-options.js +68 -0
- package/dist/configs/platform.d.ts +15 -0
- package/dist/configs/platform.js +17 -0
- package/dist/configs/react-native-system.d.ts +3026 -0
- package/dist/configs/react-native-system.js +64 -0
- package/dist/configs/system.d.ts +2771 -0
- package/dist/configs/system.js +74 -0
- package/dist/css/properties.generated.d.ts +14 -0
- package/dist/css/properties.generated.js +6260 -0
- package/dist/css/value-type.d.ts +48 -0
- package/dist/css/value-type.js +131 -0
- package/dist/css/values.d.ts +33 -0
- package/dist/css/values.js +116 -0
- package/dist/entities/native/NativeModifier.d.ts +25 -0
- package/dist/entities/native/NativeModifier.js +41 -0
- package/dist/entities/native/NativeSettings.d.ts +44 -0
- package/dist/entities/native/NativeSettings.js +39 -0
- package/dist/entities/native/NativeStyleProperty.d.ts +355 -0
- package/dist/entities/native/NativeStyleProperty.js +28 -0
- package/dist/entities/native/NativeToken.d.ts +31 -0
- package/dist/entities/native/NativeToken.js +49 -0
- package/dist/entities/system/CanvasRole.d.ts +34 -0
- package/dist/entities/system/CanvasRole.js +45 -0
- package/dist/entities/system/Component.d.ts +1287 -0
- package/dist/entities/system/Component.js +1840 -0
- package/dist/entities/system/Composite.d.ts +12 -0
- package/dist/entities/system/Composite.js +26 -0
- package/dist/entities/system/Device.d.ts +11 -0
- package/dist/entities/system/Device.js +18 -0
- package/dist/entities/system/File.d.ts +72 -0
- package/dist/entities/system/File.js +136 -0
- package/dist/entities/system/Font.d.ts +48 -0
- package/dist/entities/system/Font.js +56 -0
- package/dist/entities/system/GlobalStyle.d.ts +26 -0
- package/dist/entities/system/GlobalStyle.js +54 -0
- package/dist/entities/system/Guidance.d.ts +85 -0
- package/dist/entities/system/Guidance.js +59 -0
- package/dist/entities/system/GuidanceStyle.d.ts +14 -0
- package/dist/entities/system/GuidanceStyle.js +8 -0
- package/dist/entities/system/Icon.d.ts +46 -0
- package/dist/entities/system/Icon.js +46 -0
- package/dist/entities/system/LinkedSystem.d.ts +504 -0
- package/dist/entities/system/LinkedSystem.js +814 -0
- package/dist/entities/system/Modifier.d.ts +92 -0
- package/dist/entities/system/Modifier.js +120 -0
- package/dist/entities/system/Motion.d.ts +28 -0
- package/dist/entities/system/Motion.js +48 -0
- package/dist/entities/system/Operation.d.ts +100 -0
- package/dist/entities/system/Operation.js +236 -0
- package/dist/entities/system/Package.d.ts +42 -0
- package/dist/entities/system/Package.js +75 -0
- package/dist/entities/system/Settings.d.ts +94 -0
- package/dist/entities/system/Settings.js +166 -0
- package/dist/entities/system/StyleProperty.d.ts +135 -0
- package/dist/entities/system/StyleProperty.js +438 -0
- package/dist/entities/system/Token.d.ts +67 -0
- package/dist/entities/system/Token.js +129 -0
- package/dist/entities/system/Tool.d.ts +134 -0
- package/dist/entities/system/Tool.js +124 -0
- package/dist/entities/system/color.d.ts +64 -0
- package/dist/entities/system/color.js +123 -0
- package/dist/entities/system/component-module.d.ts +63 -0
- package/dist/entities/system/component-module.js +258 -0
- package/dist/entities/system/copy-plan.d.ts +98 -0
- package/dist/entities/system/copy-plan.js +451 -0
- package/dist/entities/system/defineComponent.d.ts +428 -0
- package/dist/entities/system/defineComponent.js +337 -0
- package/dist/entities/system/element.d.ts +101 -0
- package/dist/entities/system/element.js +171 -0
- package/dist/entities/system/icon-library.d.ts +64 -0
- package/dist/entities/system/icon-library.js +112 -0
- package/dist/entities/system/icon-metadata.d.ts +72 -0
- package/dist/entities/system/icon-metadata.js +111 -0
- package/dist/entities/system/link-declaration.d.ts +27 -0
- package/dist/entities/system/link-declaration.js +64 -0
- package/dist/entities/system/link-plan.d.ts +160 -0
- package/dist/entities/system/link-plan.js +770 -0
- package/dist/entities/system/runtime-modules.d.ts +25 -0
- package/dist/entities/system/runtime-modules.js +38 -0
- package/dist/entities/system/style-bag.d.ts +20 -0
- package/dist/entities/system/style-bag.js +246 -0
- package/dist/entities/system/token-index.d.ts +89 -0
- package/dist/entities/system/token-index.js +112 -0
- package/dist/framework/Config.d.ts +2472 -0
- package/dist/framework/Config.js +5023 -0
- package/dist/framework/Entity.d.ts +127 -0
- package/dist/framework/Entity.js +125 -0
- package/dist/framework/authoring.d.ts +24 -0
- package/dist/framework/authoring.js +7 -0
- package/dist/framework/change-hooks.d.ts +119 -0
- package/dist/framework/change-hooks.js +131 -0
- package/dist/framework/changes.d.ts +88 -0
- package/dist/framework/changes.js +246 -0
- package/dist/framework/class-names.d.ts +260 -0
- package/dist/framework/class-names.js +630 -0
- package/dist/framework/coalesce.d.ts +25 -0
- package/dist/framework/coalesce.js +60 -0
- package/dist/framework/config-op.d.ts +76 -0
- package/dist/framework/config-op.js +43 -0
- package/dist/framework/config-operation-kind.d.ts +14 -0
- package/dist/framework/config-operation-kind.js +14 -0
- package/dist/framework/config-ops.d.ts +34 -0
- package/dist/framework/config-ops.js +187 -0
- package/dist/framework/defineConfig.d.ts +196 -0
- package/dist/framework/defineConfig.js +100 -0
- package/dist/framework/defineDerivedEntity.d.ts +74 -0
- package/dist/framework/defineDerivedEntity.js +83 -0
- package/dist/framework/defineEntity.d.ts +318 -0
- package/dist/framework/defineEntity.js +183 -0
- package/dist/framework/defineSubEntity.d.ts +148 -0
- package/dist/framework/defineSubEntity.js +121 -0
- package/dist/framework/derived-mutations.d.ts +20 -0
- package/dist/framework/derived-mutations.js +38 -0
- package/dist/framework/entity-search.d.ts +29 -0
- package/dist/framework/entity-search.js +117 -0
- package/dist/framework/inline-sources.d.ts +49 -0
- package/dist/framework/inline-sources.js +388 -0
- package/dist/framework/layer-styles.d.ts +25 -0
- package/dist/framework/layer-styles.js +49 -0
- package/dist/framework/memo.d.ts +48 -0
- package/dist/framework/memo.js +84 -0
- package/dist/framework/overlay.d.ts +49 -0
- package/dist/framework/overlay.js +17 -0
- package/dist/framework/plan.d.ts +49 -0
- package/dist/framework/plan.js +73 -0
- package/dist/framework/projections.d.ts +480 -0
- package/dist/framework/projections.js +974 -0
- package/dist/framework/prop-surface.d.ts +132 -0
- package/dist/framework/prop-surface.js +278 -0
- package/dist/framework/ref-graph.d.ts +71 -0
- package/dist/framework/ref-graph.js +158 -0
- package/dist/framework/ref-integrity.d.ts +55 -0
- package/dist/framework/ref-integrity.js +171 -0
- package/dist/framework/registered.d.ts +95 -0
- package/dist/framework/registry-dir.d.ts +42 -0
- package/dist/framework/registry-dir.js +48 -0
- package/dist/framework/registry.d.ts +300 -0
- package/dist/framework/registry.js +104 -0
- package/dist/framework/rejection.d.ts +58 -0
- package/dist/framework/rejection.js +111 -0
- package/dist/framework/rename-inference.d.ts +26 -0
- package/dist/framework/rename-inference.js +50 -0
- package/dist/framework/render-spec.d.ts +296 -0
- package/dist/framework/render-spec.js +809 -0
- package/dist/framework/schema-version.d.ts +140 -0
- package/dist/framework/schema-version.js +214 -0
- package/dist/framework/schemas.d.ts +109 -0
- package/dist/framework/schemas.js +615 -0
- package/dist/framework/session.d.ts +196 -0
- package/dist/framework/session.js +367 -0
- package/dist/framework/signature.d.ts +15 -0
- package/dist/framework/signature.js +83 -0
- package/dist/framework/snapshot.d.ts +115 -0
- package/dist/framework/snapshot.js +277 -0
- package/dist/framework/source-integrity.d.ts +226 -0
- package/dist/framework/source-integrity.js +478 -0
- package/dist/framework/sources.d.ts +211 -0
- package/dist/framework/sources.js +89 -0
- package/dist/framework/utils/compiled-schema.d.ts +23 -0
- package/dist/framework/utils/compiled-schema.js +46 -0
- package/dist/framework/utils/content-key.d.ts +15 -0
- package/dist/framework/utils/content-key.js +33 -0
- package/dist/framework/utils/enumerated.d.ts +13 -0
- package/dist/framework/utils/enumerated.js +19 -0
- package/dist/framework/utils/field-path.d.ts +95 -0
- package/dist/framework/utils/field-path.js +136 -0
- package/dist/framework/utils/field-schema.d.ts +55 -0
- package/dist/framework/utils/field-schema.js +183 -0
- package/dist/framework/utils/group.d.ts +37 -0
- package/dist/framework/utils/group.js +13 -0
- package/dist/framework/utils/package-path.d.ts +37 -0
- package/dist/framework/utils/package-path.js +61 -0
- package/dist/framework/utils/refs.d.ts +194 -0
- package/dist/framework/utils/refs.js +403 -0
- package/dist/framework/validate-spec.d.ts +27 -0
- package/dist/framework/validate-spec.js +45 -0
- package/dist/framework/value-domain.d.ts +26 -0
- package/dist/framework/value-domain.js +202 -0
- package/dist/framework/views-facade.d.ts +15 -0
- package/dist/framework/views-facade.js +19 -0
- package/dist/index.d.ts +90 -42
- package/dist/index.js +86 -37
- package/dist/migrations/2.0.0/raw-css.d.ts +11 -0
- package/dist/migrations/2.0.0/raw-css.js +72 -0
- package/dist/migrations/2.0.0/v1-artifact.d.ts +1559 -0
- package/dist/migrations/2.0.0/v1-artifact.js +1018 -0
- package/dist/migrations/20260908171448_settings_as_kind.d.ts +22 -0
- package/dist/migrations/20260908171448_settings_as_kind.js +89 -0
- package/dist/migrations/20260908194245_visible_state_pointer.d.ts +19 -0
- package/dist/migrations/20260908194245_visible_state_pointer.js +115 -0
- package/dist/migrations/20260909183001_icon_knockout_variants.d.ts +18 -0
- package/dist/migrations/20260909183001_icon_knockout_variants.js +8 -0
- package/dist/migrations/20260910212453_linked_system_link_ops.d.ts +13 -0
- package/dist/migrations/20260910212453_linked_system_link_ops.js +8 -0
- package/dist/migrations/index.d.ts +2 -0
- package/dist/migrations/index.js +2 -0
- package/dist/react-native/style-keys.generated.d.ts +10 -0
- package/dist/react-native/style-keys.generated.js +167 -0
- package/dist/renderer/RendererErrorBoundary.d.ts +32 -5
- package/dist/renderer/RendererErrorBoundary.js +59 -10
- package/dist/renderer/UdsRenderer.d.ts +11 -10
- package/dist/renderer/UdsRenderer.js +1 -1
- package/dist/renderer/assetEntries.d.ts +37 -0
- package/dist/renderer/assetEntries.js +39 -0
- package/dist/renderer/assetRenderable.d.ts +14 -6
- package/dist/renderer/assetRenderable.js +8 -2
- package/dist/renderer/componentEntry.d.ts +58 -0
- package/dist/renderer/componentEntry.js +71 -0
- package/dist/renderer/icon-library.d.ts +20 -0
- package/dist/renderer/index.d.ts +7 -7
- package/dist/renderer/index.js +5 -5
- package/dist/renderer/primitives/SlotRenderer.d.ts +1 -1
- package/dist/renderer/primitives/SlotRenderer.js +1 -1
- package/dist/renderer/runtimeComponent.d.ts +33 -0
- package/dist/renderer/runtimeComponent.js +113 -0
- package/dist/renderer/spec-content.d.ts +43 -0
- package/dist/renderer/spec-content.js +95 -0
- package/dist/renderer/wrapRegistry.d.ts +22 -37
- package/dist/renderer/wrapRegistry.js +10 -20
- package/dist/renderer/wrappers/event-bridge.js +6 -5
- package/dist/renderer/wrappers/hex-normalize.js +6 -5
- package/dist/renderer/wrappers/html-aliases.d.ts +7 -2
- package/dist/renderer/wrappers/html-aliases.js +36 -19
- package/dist/renderer/wrappers/inline-styles.js +7 -6
- package/dist/spec/asset-jsx.d.ts +18 -5
- package/dist/spec/asset-jsx.js +27 -16
- package/dist/spec/collapse-text-labels.d.ts +5 -15
- package/dist/spec/collapse-text-labels.js +26 -19
- package/dist/spec/empty-node-slots.d.ts +56 -34
- package/dist/spec/empty-node-slots.js +87 -47
- package/dist/spec/index.d.ts +21 -10
- package/dist/spec/index.js +21 -10
- package/dist/spec/jsxToSpec.d.ts +14 -9
- package/dist/spec/jsxToSpec.js +20 -3
- package/dist/spec/preview-elements.d.ts +63 -0
- package/dist/spec/preview-elements.js +89 -0
- package/dist/spec/rewrite-refs.d.ts +58 -0
- package/dist/spec/rewrite-refs.js +250 -0
- package/dist/spec/specToJsx.js +18 -29
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +39 -52
- package/dist/AssetGroup.d.ts +0 -77
- package/dist/AssetGroup.js +0 -125
- package/dist/Component.d.ts +0 -333
- package/dist/Component.js +0 -1061
- package/dist/ComponentGroup.d.ts +0 -22
- package/dist/ComponentGroup.js +0 -51
- package/dist/CompositeStyle.d.ts +0 -30
- package/dist/CompositeStyle.js +0 -59
- package/dist/Config.d.ts +0 -528
- package/dist/Config.js +0 -1712
- package/dist/Mode.d.ts +0 -41
- package/dist/Mode.js +0 -81
- package/dist/Modifier.d.ts +0 -51
- package/dist/Modifier.js +0 -97
- package/dist/MotionDef.d.ts +0 -81
- package/dist/MotionDef.js +0 -212
- package/dist/Props.d.ts +0 -332
- package/dist/Props.js +0 -35
- package/dist/Provider.d.ts +0 -20
- package/dist/Provider.js +0 -14
- package/dist/StyleProp.d.ts +0 -145
- package/dist/StyleProp.js +0 -239
- package/dist/Token.d.ts +0 -76
- package/dist/Token.js +0 -133
- package/dist/TokenGroup.d.ts +0 -33
- package/dist/TokenGroup.js +0 -69
- package/dist/asset-kind.d.ts +0 -55
- package/dist/asset-kind.js +0 -29
- package/dist/asset-value.d.ts +0 -23
- package/dist/asset-value.js +0 -40
- package/dist/brands.d.ts +0 -30
- package/dist/brands.js +0 -20
- package/dist/captureCallerPath.d.ts +0 -48
- package/dist/captureCallerPath.js +0 -95
- package/dist/colorExpressions.d.ts +0 -131
- package/dist/colorExpressions.js +0 -148
- package/dist/component-referrers.d.ts +0 -30
- package/dist/component-referrers.js +0 -40
- package/dist/config-diagnostics.d.ts +0 -21
- package/dist/config-diagnostics.js +0 -12
- package/dist/defineAssetGroup.d.ts +0 -200
- package/dist/defineAssetGroup.js +0 -323
- package/dist/defineProvider.d.ts +0 -29
- package/dist/defineProvider.js +0 -60
- package/dist/element-marker.d.ts +0 -63
- package/dist/element-marker.js +0 -113
- package/dist/entity-utils.d.ts +0 -56
- package/dist/entity-utils.js +0 -105
- package/dist/extension.d.ts +0 -55
- package/dist/extension.js +0 -214
- package/dist/factories.d.ts +0 -863
- package/dist/factories.js +0 -475
- package/dist/font-face.d.ts +0 -25
- package/dist/font-face.js +0 -72
- package/dist/foreign-component-name.d.ts +0 -21
- package/dist/foreign-component-name.js +0 -42
- package/dist/interpolate.d.ts +0 -20
- package/dist/interpolate.js +0 -10
- package/dist/jsx/__fixtures__/cross-component-preview.d.ts +0 -3
- package/dist/jsx/__fixtures__/cross-component-preview.js +0 -15
- package/dist/jsx/jsx-dev-runtime.d.ts +0 -15
- package/dist/jsx/jsx-dev-runtime.js +0 -11
- package/dist/jsx/jsx-runtime.d.ts +0 -48
- package/dist/jsx/jsx-runtime.js +0 -305
- package/dist/linked-system-pins.d.ts +0 -30
- package/dist/linked-system-pins.js +0 -45
- package/dist/linkedNodePrefixes.d.ts +0 -73
- package/dist/linkedNodePrefixes.js +0 -99
- package/dist/markers.d.ts +0 -235
- package/dist/markers.js +0 -70
- package/dist/motion-constants.d.ts +0 -37
- package/dist/motion-constants.js +0 -61
- package/dist/native/NativeConfig.d.ts +0 -56
- package/dist/native/NativeConfig.js +0 -162
- package/dist/native/assets.d.ts +0 -20
- package/dist/native/assets.js +0 -17
- package/dist/native/components.d.ts +0 -139
- package/dist/native/components.js +0 -67
- package/dist/native/index.d.ts +0 -18
- package/dist/native/index.js +0 -17
- package/dist/native/modes.d.ts +0 -10
- package/dist/native/modes.js +0 -11
- package/dist/native/types.d.ts +0 -95
- package/dist/native/types.js +0 -0
- package/dist/native/validation.d.ts +0 -8
- package/dist/native/validation.js +0 -885
- package/dist/native/values.d.ts +0 -7
- package/dist/native/values.js +0 -15
- package/dist/native.d.ts +0 -12
- package/dist/native.js +0 -10
- package/dist/refs.d.ts +0 -204
- package/dist/refs.js +0 -129
- package/dist/registry-aliases.d.ts +0 -33
- package/dist/registry-aliases.js +0 -35
- package/dist/registry-dir.d.ts +0 -22
- package/dist/registry-dir.js +0 -10
- package/dist/renderer/makeRegistry.d.ts +0 -34
- package/dist/renderer/makeRegistry.js +0 -52
- package/dist/renderer/makeUdsRenderer.d.ts +0 -13
- package/dist/renderer/makeUdsRenderer.js +0 -51
- package/dist/renderer/wrappers/component-slots.d.ts +0 -41
- package/dist/renderer/wrappers/component-slots.js +0 -66
- package/dist/renderer/wrappers/slot-resolution.d.ts +0 -25
- package/dist/renderer/wrappers/slot-resolution.js +0 -68
- package/dist/renderer/wrappers/void-elements.d.ts +0 -37
- package/dist/renderer/wrappers/void-elements.js +0 -40
- package/dist/spec/layer-props.d.ts +0 -52
- package/dist/spec/layer-props.js +0 -149
- package/dist/spec/preview-controls.d.ts +0 -44
- package/dist/spec/preview-controls.js +0 -139
- package/dist/spec/slot-refs.d.ts +0 -39
- package/dist/spec/slot-refs.js +0 -56
- package/dist/token-override-rows.d.ts +0 -68
- package/dist/token-override-rows.js +0 -233
- package/dist/tokenValueType.d.ts +0 -34
- package/dist/tokenValueType.js +0 -138
- package/dist/types/css-properties.d.ts +0 -233
- package/dist/types/css-properties.js +0 -14
- package/dist/types/css-property-keywords.d.ts +0 -156
- package/dist/types/css-property-keywords.js +0 -616
- package/dist/types/css-values.d.ts +0 -63
- package/dist/types/css-values.js +0 -16
- package/dist/types.d.ts +0 -1138
- package/dist/types.js +0 -12
- package/dist/units.d.ts +0 -14
- package/dist/units.js +0 -16
- package/dist/utils/index.d.ts +0 -4
- package/dist/utils/index.js +0 -4
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { SubEntityClass } from "../../framework/defineSubEntity.js";
|
|
2
|
+
import { EntityClass } from "../../framework/defineEntity.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
//#region src/entities/system/Icon.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Icon (`icons/AcornIcon`) — one glyph in an icon library. The library (`icons`) is an EMERGENT group
|
|
8
|
+
* from the path, and everything that describes the SET lives on that group node: its version, the
|
|
9
|
+
* sizes and variants it ships, the component a placed icon renders through, and where the members'
|
|
10
|
+
* descriptive facts come from (`metadata`).
|
|
11
|
+
*
|
|
12
|
+
* A member's identity is still its name; its fields carry what the name can't say. A group that
|
|
13
|
+
* declares `metadata` gets those fields baked at BUILD time from the declared source, and the bake
|
|
14
|
+
* fills only fields with no stored value — an author's hand-written value is never overwritten
|
|
15
|
+
* (every such skip is logged by the build), and a curator's Studio edit is a patch that replays on
|
|
16
|
+
* top of the base regardless. Fields are re-derived every build, so a source removing facts flows
|
|
17
|
+
* through at the next dependency bump rather than lingering.
|
|
18
|
+
*
|
|
19
|
+
* (A per-icon type/variant is config-v2 model gap 8; this is where it lands.)
|
|
20
|
+
*/
|
|
21
|
+
declare const Icon: EntityClass<z.ZodObject<{
|
|
22
|
+
categories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
23
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
24
|
+
codepoint: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
knockoutVariants: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
26
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
27
|
+
module: z.ZodOptional<z.ZodString>;
|
|
28
|
+
version: z.ZodOptional<z.ZodString>;
|
|
29
|
+
metadata: z.ZodOptional<z.ZodObject<{
|
|
30
|
+
from: EntityClass<z.ZodObject<{
|
|
31
|
+
version: z.ZodOptional<z.ZodString>;
|
|
32
|
+
exports: z.ZodOptional<SubEntityClass<z.ZodObject<{}, z.core.$strict>>>;
|
|
33
|
+
}, z.core.$strict>, z.ZodObject<Record<never, never>, z.core.$strip>, "package", Record<never, never>, Record<never, never>, false>;
|
|
34
|
+
format: z.ZodEnum<{
|
|
35
|
+
uds: "uds";
|
|
36
|
+
phosphor: "phosphor";
|
|
37
|
+
}>;
|
|
38
|
+
}, z.core.$strict>>;
|
|
39
|
+
sizes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
40
|
+
variants: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
41
|
+
component: z.ZodOptional<z.ZodObject<{
|
|
42
|
+
__ref: z.ZodString;
|
|
43
|
+
}, z.core.$strip>>;
|
|
44
|
+
}, z.core.$strict>, "icon", Record<never, never>, Record<never, never>, false>;
|
|
45
|
+
//#endregion
|
|
46
|
+
export { Icon };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { defineEntity } from "../../framework/defineEntity.js";
|
|
2
|
+
import { Component } from "./Component.js";
|
|
3
|
+
import { iconMemberMetadata, iconMetadataDeclaration } from "./icon-metadata.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
//#region src/entities/system/Icon.ts
|
|
6
|
+
/**
|
|
7
|
+
* Icon (`icons/AcornIcon`) — one glyph in an icon library. The library (`icons`) is an EMERGENT group
|
|
8
|
+
* from the path, and everything that describes the SET lives on that group node: its version, the
|
|
9
|
+
* sizes and variants it ships, the component a placed icon renders through, and where the members'
|
|
10
|
+
* descriptive facts come from (`metadata`).
|
|
11
|
+
*
|
|
12
|
+
* A member's identity is still its name; its fields carry what the name can't say. A group that
|
|
13
|
+
* declares `metadata` gets those fields baked at BUILD time from the declared source, and the bake
|
|
14
|
+
* fills only fields with no stored value — an author's hand-written value is never overwritten
|
|
15
|
+
* (every such skip is logged by the build), and a curator's Studio edit is a patch that replays on
|
|
16
|
+
* top of the base regardless. Fields are re-derived every build, so a source removing facts flows
|
|
17
|
+
* through at the next dependency bump rather than lingering.
|
|
18
|
+
*
|
|
19
|
+
* (A per-icon type/variant is config-v2 model gap 8; this is where it lands.)
|
|
20
|
+
*/
|
|
21
|
+
const Icon = defineEntity({
|
|
22
|
+
kind: "icon",
|
|
23
|
+
label: "Icon",
|
|
24
|
+
labelPlural: "Icons",
|
|
25
|
+
fields: iconMemberMetadata,
|
|
26
|
+
groupFields: z.strictObject({
|
|
27
|
+
/** The package the glyphs come from. Declared here rather than recovered by scanning source for
|
|
28
|
+
* a namespace import used inside a `.group(…)` call, which is what `assetModules` does today —
|
|
29
|
+
* and what a generated module needs, since it has to import the glyph it renders. The same
|
|
30
|
+
* field a `Package` group carries, for the same reason. */
|
|
31
|
+
module: z.string().optional(),
|
|
32
|
+
version: z.string().optional(),
|
|
33
|
+
/** Where member metadata comes from and how to read it — `{ from, format }`. The build resolves
|
|
34
|
+
* the source and bakes each member's fields; see `icon-metadata.ts`. */
|
|
35
|
+
metadata: iconMetadataDeclaration.optional(),
|
|
36
|
+
/** Named sizes the set ships (`sm: 16`). */
|
|
37
|
+
sizes: z.record(z.string(), z.number()).optional(),
|
|
38
|
+
/** Weights/styles the set ships (`regular`, `fill`). */
|
|
39
|
+
variants: z.array(z.string()).optional(),
|
|
40
|
+
/** The component a placed icon renders through — a REF, so the graph sees the edge and a
|
|
41
|
+
* rename of that component cascades into this library. */
|
|
42
|
+
component: Component.optional()
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
//#endregion
|
|
46
|
+
export { Icon };
|
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
import { CopyPlan } from "./copy-plan.js";
|
|
2
|
+
import { RegisteredEntities } from "../../framework/registered.js";
|
|
3
|
+
import { SourceResolver, SourceState } from "../../framework/sources.js";
|
|
4
|
+
import { EntityClass, ItemOf } from "../../framework/defineEntity.js";
|
|
5
|
+
import { PartialBodyOf } from "../../framework/defineConfig.js";
|
|
6
|
+
import { BreakPlan, LinkPlan, SourceRowState, UnlinkPlan } from "./link-plan.js";
|
|
7
|
+
import { Config } from "../../framework/Config.js";
|
|
8
|
+
import { ComputedInput } from "../../framework/registry.js";
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
|
|
11
|
+
//#region src/entities/system/LinkedSystem.d.ts
|
|
12
|
+
/**
|
|
13
|
+
* A link's slug, as a single path segment.
|
|
14
|
+
*
|
|
15
|
+
* The slug is more than a key: `uds install` writes one registry folder per link and names it this, so
|
|
16
|
+
* a slug that isn't a path segment is one the install step can't use, and `../..` would be a traversal
|
|
17
|
+
* handed to a file write. Stated here on the entity so the rule has one home — the install refuses
|
|
18
|
+
* with it, an authoring UI can say so before submitting, and an AI tool creating a link is bound by it
|
|
19
|
+
* too. Enforced only at install, a config would commit fine and break for whoever runs the build.
|
|
20
|
+
*/
|
|
21
|
+
declare const LINK_SLUG: RegExp;
|
|
22
|
+
/** Whether `slug` can be a link's local name — {@link LINK_SLUG}, as a predicate for a caller that wants
|
|
23
|
+
* to ask rather than to match. */
|
|
24
|
+
declare function isLinkSlug(slug: string): boolean;
|
|
25
|
+
/** What a refused slug should say, in one place, so the install and a form word it identically. */
|
|
26
|
+
declare const LINK_SLUG_MESSAGE = "A link's slug is a single path segment \u2014 letters, digits, dot, dash and underscore \u2014 because it becomes a folder in the registry.";
|
|
27
|
+
/**
|
|
28
|
+
* Where a linked system resolved from, carrying the identity that origin actually has.
|
|
29
|
+
*
|
|
30
|
+
* Discriminated on `from` rather than a flat `{ systemId, version, from }`. A repo-local source has no
|
|
31
|
+
* published identity to report: its identity is the config path, and a built artifact carries no
|
|
32
|
+
* `systemId` or `version` at all. A flat shape would require two fields that one of the three origins
|
|
33
|
+
* can never fill, so a resolver would have to invent an id to satisfy it.
|
|
34
|
+
*
|
|
35
|
+
* Each origin therefore says what it knows, which is also what makes "what did this build against"
|
|
36
|
+
* answerable for both kinds of source.
|
|
37
|
+
*
|
|
38
|
+
* Declared here beside the kind and handed to the framework through `sourceResolution`. These three
|
|
39
|
+
* origins are what a linked system has; a `linkedPackages` kind would resolve from a lockfile and
|
|
40
|
+
* couldn't fill this union, which is why the framework holds only the `status` tag.
|
|
41
|
+
*/
|
|
42
|
+
declare const resolvedSource: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
43
|
+
from: z.ZodLiteral<"disk">;
|
|
44
|
+
configPath: z.ZodString;
|
|
45
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
46
|
+
from: z.ZodLiteral<"registry">;
|
|
47
|
+
systemId: z.ZodString;
|
|
48
|
+
version: z.ZodString;
|
|
49
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
50
|
+
from: z.ZodLiteral<"storage">;
|
|
51
|
+
systemId: z.ZodString;
|
|
52
|
+
version: z.ZodString;
|
|
53
|
+
}, z.core.$strip>], "from">;
|
|
54
|
+
type ResolvedSource = z.infer<typeof resolvedSource>;
|
|
55
|
+
/**
|
|
56
|
+
* Why a declared linked system couldn't be met — a code plus the data that case needs, and no prose.
|
|
57
|
+
*
|
|
58
|
+
* A closed set, so a surface switches exhaustively and adding a case is a compile error at every
|
|
59
|
+
* consumer. Collapsed into `undefined`, these all look alike, which is how a rail ends up saying a
|
|
60
|
+
* value "isn't loaded here" when it is loaded and the ref is broken.
|
|
61
|
+
*
|
|
62
|
+
* **No `message`.** The fix depends on the surface rather than the code: a build tells you to run
|
|
63
|
+
* `uds install` or to build the sibling first, and neither sentence means anything in a browser where
|
|
64
|
+
* `stale` is an update button. One string per code would put CLI instructions into Studio. What such a
|
|
65
|
+
* message really carries is the data here — `stale` can't be phrased at all without both versions.
|
|
66
|
+
*
|
|
67
|
+
* **`not-found` covers three situations on purpose.** A system the caller can't see and a version
|
|
68
|
+
* never published have to be indistinguishable, or the difference is a probe: ask for an id you
|
|
69
|
+
* suspect exists, and a separate code confirms it. A resolver may know which internally; it must not
|
|
70
|
+
* cross out in the value.
|
|
71
|
+
*/
|
|
72
|
+
declare const sourceUnavailable: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
73
|
+
code: z.ZodLiteral<"not-installed">;
|
|
74
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
75
|
+
code: z.ZodLiteral<"unbuilt">;
|
|
76
|
+
configPath: z.ZodString;
|
|
77
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
78
|
+
code: z.ZodLiteral<"stale">;
|
|
79
|
+
installed: z.ZodString;
|
|
80
|
+
pinned: z.ZodString;
|
|
81
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
82
|
+
code: z.ZodLiteral<"not-found">;
|
|
83
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
84
|
+
code: z.ZodLiteral<"unmaterializable">;
|
|
85
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
86
|
+
code: z.ZodLiteral<"unreachable">;
|
|
87
|
+
}, z.core.$strip>], "code">;
|
|
88
|
+
type SourceUnavailable = z.infer<typeof sourceUnavailable>;
|
|
89
|
+
/** A `link` or `unlink` example: one entity the source offers, under the accessor this config files it by. */
|
|
90
|
+
declare function linkExample({
|
|
91
|
+
config,
|
|
92
|
+
path
|
|
93
|
+
}: {
|
|
94
|
+
config: Config;
|
|
95
|
+
path: string;
|
|
96
|
+
}): Record<string, unknown> | undefined;
|
|
97
|
+
/** An example for an op that takes the pin alone, shown once the pin has a source to read. */
|
|
98
|
+
declare function pinExample({
|
|
99
|
+
config,
|
|
100
|
+
path
|
|
101
|
+
}: {
|
|
102
|
+
config: Config;
|
|
103
|
+
path: string;
|
|
104
|
+
}): Record<string, unknown> | undefined;
|
|
105
|
+
/** A break's example, shown once the pin has a source to read. */
|
|
106
|
+
declare function breakExample({
|
|
107
|
+
config,
|
|
108
|
+
path
|
|
109
|
+
}: {
|
|
110
|
+
config: Config;
|
|
111
|
+
path: string;
|
|
112
|
+
}): Record<string, unknown> | undefined;
|
|
113
|
+
/** A copy's example: one entity the source offers, under the accessor this config files it by. */
|
|
114
|
+
declare function copyExample({
|
|
115
|
+
config,
|
|
116
|
+
path
|
|
117
|
+
}: {
|
|
118
|
+
config: Config;
|
|
119
|
+
path: string;
|
|
120
|
+
}): Record<string, unknown> | undefined;
|
|
121
|
+
/**
|
|
122
|
+
* The bridging cast, and the annotation that survives declaration emit.
|
|
123
|
+
*
|
|
124
|
+
* Spelled as a named type because the emitted `.d.ts` is where this has to hold: a structural type
|
|
125
|
+
* here is printed expanded, and {@link RegisteredEntities} is empty in this package, so the field
|
|
126
|
+
* would reach every consumer already resolved against no accessors at all — augmenting it downstream
|
|
127
|
+
* would then change nothing.
|
|
128
|
+
*/
|
|
129
|
+
type PinOptionsField = z.ZodOptional<z.ZodType<PinOptions, PinOptions>>;
|
|
130
|
+
declare const LinkedSystem: EntityClass<z.ZodObject<{
|
|
131
|
+
configPath: z.ZodOptional<z.ZodString>;
|
|
132
|
+
link: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodArray<z.ZodString>]>>]>>;
|
|
133
|
+
options: PinOptionsField;
|
|
134
|
+
package: z.ZodOptional<z.ZodString>;
|
|
135
|
+
systemId: z.ZodOptional<z.ZodString>;
|
|
136
|
+
name: z.ZodOptional<z.ZodString>;
|
|
137
|
+
version: z.ZodOptional<z.ZodString>;
|
|
138
|
+
}, z.core.$strict>, z.ZodObject<Record<never, never>, z.core.$strip>, "linked-system", {
|
|
139
|
+
/**
|
|
140
|
+
* Draw entities from a linked system: the pin's `link` declaration grows to cover them and the
|
|
141
|
+
* build mints a pointer row per entity, in this one op. A row of this config's own at a covered
|
|
142
|
+
* path is deleted so theirs shows through; a row held through another pin becomes an extension
|
|
143
|
+
* through this one. `link-plan` says what that replaces before anything is written.
|
|
144
|
+
*/
|
|
145
|
+
readonly link: {
|
|
146
|
+
readonly input: z.ZodObject<{
|
|
147
|
+
path: z.ZodType<string, string | undefined, z.core.$ZodTypeInternals<string, string | undefined>>;
|
|
148
|
+
data: z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodArray<z.ZodString>]>>]>;
|
|
149
|
+
}, z.core.$strip>;
|
|
150
|
+
readonly readOnly: false;
|
|
151
|
+
readonly label: "Link from";
|
|
152
|
+
readonly description: "Draw entities from a linked system, following the source: `data` names them by accessor — `{ tokens: ['color/brand', 'color'] }` takes an entity and a folder's members, `{ tokens: '*' }` every token, and `'*'` the whole system. What this config already holds at those paths is replaced by theirs, so run `linked-system/link-plan` with the same input first to see what that is. To hold their values as your own instead, `copy`.";
|
|
153
|
+
readonly scope: "item";
|
|
154
|
+
readonly approval: "reference-change";
|
|
155
|
+
readonly title: (entity: string) => string;
|
|
156
|
+
readonly example: typeof linkExample;
|
|
157
|
+
readonly handler: (input: Record<string, unknown>, config: Config) => Config;
|
|
158
|
+
};
|
|
159
|
+
readonly 'link-plan': {
|
|
160
|
+
readonly input: z.ZodObject<{
|
|
161
|
+
path: z.ZodType<string, string | undefined, z.core.$ZodTypeInternals<string, string | undefined>>;
|
|
162
|
+
data: z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodArray<z.ZodString>]>>]>;
|
|
163
|
+
}, z.core.$strip>;
|
|
164
|
+
readonly readOnly: true;
|
|
165
|
+
readonly label: "Plan a link";
|
|
166
|
+
readonly description: "What `link` with the same input replaces — rows of yours deleted so the source shows through, rows held through another pin turned into extensions, and members left alone because they are already here from the same origin. Writes nothing.";
|
|
167
|
+
readonly scope: "item";
|
|
168
|
+
readonly title: (entity: string) => string;
|
|
169
|
+
readonly example: typeof linkExample;
|
|
170
|
+
readonly handler: (input: Record<string, unknown>, config: Config) => Omit<LinkPlan, "patches">;
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* Stop drawing from a linked system, whole or in part. The declaration narrows and the rows it
|
|
174
|
+
* minted retire in the same op; the pin stays, so it can be linked again.
|
|
175
|
+
*/
|
|
176
|
+
readonly unlink: {
|
|
177
|
+
readonly input: z.ZodObject<{
|
|
178
|
+
path: z.ZodType<string, string | undefined, z.core.$ZodTypeInternals<string, string | undefined>>;
|
|
179
|
+
data: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodArray<z.ZodString>]>>]>>;
|
|
180
|
+
}, z.core.$strip>;
|
|
181
|
+
readonly readOnly: false;
|
|
182
|
+
readonly label: "Unlink from";
|
|
183
|
+
readonly description: "Stop following a linked system's entities, in `link`'s shape or everything when `data` is omitted. The rows the declaration minted go with it, and so do the linked rows that point at them, since left linked they would bring them back; nothing of yours moves. A row of yours pointing at one of theirs refuses this — `copy` what is used first, or `break` with `keep: true`. `unlink-plan` names everything that goes.";
|
|
184
|
+
readonly scope: "item";
|
|
185
|
+
readonly approval: "reference-change";
|
|
186
|
+
readonly title: (entity: string) => string;
|
|
187
|
+
readonly example: typeof pinExample;
|
|
188
|
+
readonly handler: (input: Record<string, unknown>, config: Config) => Config;
|
|
189
|
+
};
|
|
190
|
+
readonly 'unlink-plan': {
|
|
191
|
+
readonly input: z.ZodObject<{
|
|
192
|
+
path: z.ZodType<string, string | undefined, z.core.$ZodTypeInternals<string, string | undefined>>;
|
|
193
|
+
data: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodArray<z.ZodString>]>>]>>;
|
|
194
|
+
}, z.core.$strip>;
|
|
195
|
+
readonly readOnly: true;
|
|
196
|
+
readonly label: "Plan an unlink";
|
|
197
|
+
readonly description: "What `unlink` with the same input removes — the minted rows the narrower declaration no longer reaches, with the linked rows taken along because they point at them named in `cascade` — and why the config would refuse it. Writes nothing.";
|
|
198
|
+
readonly scope: "item";
|
|
199
|
+
readonly title: (entity: string) => string;
|
|
200
|
+
readonly example: typeof pinExample;
|
|
201
|
+
readonly handler: (input: Record<string, unknown>, config: Config) => Omit<UnlinkPlan, "patches">;
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* Break the link: the pin goes, and everything drawn through it either becomes this config's own
|
|
205
|
+
* or goes with it.
|
|
206
|
+
*/
|
|
207
|
+
readonly break: {
|
|
208
|
+
readonly input: z.ZodObject<{
|
|
209
|
+
path: z.ZodType<string, string | undefined, z.core.$ZodTypeInternals<string, string | undefined>>;
|
|
210
|
+
keep: z.ZodBoolean;
|
|
211
|
+
}, z.core.$strip>;
|
|
212
|
+
readonly readOnly: false;
|
|
213
|
+
readonly label: "Break link";
|
|
214
|
+
readonly description: "Remove a linked system. With `keep: true` every value drawn through it is copied in as your own first, and a row of yours that pointed through the pin points at the copies; with `keep: false` the rows it minted go, and a row of yours still pointing through it refuses the break. Run `linked-system/break-plan` first to see every row it reaches.";
|
|
215
|
+
readonly scope: "item";
|
|
216
|
+
readonly approval: "destructive";
|
|
217
|
+
readonly title: (entity: string) => string;
|
|
218
|
+
readonly example: typeof breakExample;
|
|
219
|
+
readonly handler: (input: Record<string, unknown>, config: Config) => Config;
|
|
220
|
+
};
|
|
221
|
+
readonly 'break-plan': {
|
|
222
|
+
readonly input: z.ZodObject<{
|
|
223
|
+
path: z.ZodType<string, string | undefined, z.core.$ZodTypeInternals<string, string | undefined>>;
|
|
224
|
+
keep: z.ZodOptional<z.ZodBoolean>;
|
|
225
|
+
data: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodArray<z.ZodString>]>>]>>;
|
|
226
|
+
}, z.core.$strip>;
|
|
227
|
+
readonly readOnly: true;
|
|
228
|
+
readonly label: "Plan a break";
|
|
229
|
+
readonly description: "Every row a break reaches, and why the config would refuse it. `keep` plans `break` with the same input; `data` in `copy`'s shape plans detaching those entities alone — the rows the copy lands, the rows of yours it points at the copies, and the rows still linked that reference what moves. Writes nothing.";
|
|
230
|
+
readonly scope: "item";
|
|
231
|
+
readonly title: (entity: string) => string;
|
|
232
|
+
readonly example: typeof breakExample;
|
|
233
|
+
readonly handler: (input: Record<string, unknown>, config: Config) => Omit<BreakPlan, "patches">;
|
|
234
|
+
};
|
|
235
|
+
/**
|
|
236
|
+
* The source's catalogue read against this config: one row per top-level folder or item the
|
|
237
|
+
* source offers, saying whether it is linked here and what linking it would replace.
|
|
238
|
+
*/
|
|
239
|
+
readonly rows: {
|
|
240
|
+
readonly input: z.ZodObject<{
|
|
241
|
+
path: z.ZodType<string, string | undefined, z.core.$ZodTypeInternals<string, string | undefined>>;
|
|
242
|
+
}, z.core.$strip>;
|
|
243
|
+
readonly readOnly: true;
|
|
244
|
+
readonly label: "Source rows";
|
|
245
|
+
readonly description: "Every top-level folder and item the linked system offers, read against this config: whether every member is linked through this pin, how many rows of yours a `link` would replace, and how many members are already here from the source's own origin. Needs the source attached; empty otherwise.";
|
|
246
|
+
readonly scope: "item";
|
|
247
|
+
readonly title: (entity: string) => string;
|
|
248
|
+
readonly example: typeof pinExample;
|
|
249
|
+
readonly handler: (input: Record<string, unknown>, config: Config) => SourceRowState[];
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* Take entities from a linked system as this config's own — the source's bodies, written once.
|
|
253
|
+
* A pin puts a system within reach and its `link` mints pointers; `copy` stores the value. A copied
|
|
254
|
+
* row is an ordinary authored row from the moment it lands: the source's later versions never reach
|
|
255
|
+
* it, and it renames and deletes like anything else here.
|
|
256
|
+
*
|
|
257
|
+
* A copy stands on its own. What a copied row points at comes with it — a component brings the
|
|
258
|
+
* style properties and tokens it names, a style property brings the token folder its values
|
|
259
|
+
* range over, a code component brings the files its module reaches — and every one of those refs
|
|
260
|
+
* lands bare, on the local copy. A path this config already holds as its own is reused rather
|
|
261
|
+
* than copied, and refs bind to it. Only a ref to a kind this config can't hold stays qualified,
|
|
262
|
+
* and the pin survives to answer it. Someone who wants theirs by reference writes `Button@slug`
|
|
263
|
+
* instead.
|
|
264
|
+
*
|
|
265
|
+
* A pointer at the path, minted through this pin, becomes the literal it stood for with its
|
|
266
|
+
* `extend` laid over the source's body. A folder's meta comes with its members, so a label the
|
|
267
|
+
* folder was inheriting becomes its own.
|
|
268
|
+
*
|
|
269
|
+
* `data` is keyed the way the pin's `link` is: by accessor, then `'*'` for every entry of the kind
|
|
270
|
+
* or the source's paths — an item, or a folder, which takes its members. `'*'` alone takes every
|
|
271
|
+
* kind the source offers and this config can hold. Kinds taken in one edit are copied together,
|
|
272
|
+
* which is what lets a copied component point at the copied tokens rather than back through the
|
|
273
|
+
* pin.
|
|
274
|
+
*
|
|
275
|
+
* Every row lands in one derive (`Config.applyAll`), and each is its own `create` or `replace`
|
|
276
|
+
* patch carrying the literal body, so a draft replays a copy onto a base with nothing attached.
|
|
277
|
+
*/
|
|
278
|
+
readonly copy: {
|
|
279
|
+
readonly input: z.ZodObject<{
|
|
280
|
+
path: z.ZodType<string, string | undefined, z.core.$ZodTypeInternals<string, string | undefined>>;
|
|
281
|
+
data: z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodArray<z.ZodString>]>>]>;
|
|
282
|
+
onConflict: z.ZodOptional<z.ZodEnum<{
|
|
283
|
+
replace: "replace";
|
|
284
|
+
skip: "skip";
|
|
285
|
+
}>>;
|
|
286
|
+
}, z.core.$strip>;
|
|
287
|
+
readonly readOnly: false;
|
|
288
|
+
readonly label: "Copy from";
|
|
289
|
+
readonly description: "Take entities from a linked system as your own, holding the values the source has now and no longer following it. `data` names them by accessor: `{ tokens: ['color/brand', 'color'] }` takes an entity and a folder's members, `{ tokens: '*' }` every token, and `'*'` the whole system. What a copied entity points at comes with it, so run `linked-system/copy-plan` with the same input first and see everything that lands. To use theirs without owning it, declare it in the pin's `link` instead. A whole-system copy is thousands of rows, and on a repo-backed system each one is written into `uds.config.ts`.";
|
|
290
|
+
readonly scope: "item";
|
|
291
|
+
readonly approval: "reference-change";
|
|
292
|
+
readonly title: (entity: string) => string;
|
|
293
|
+
readonly example: typeof copyExample;
|
|
294
|
+
readonly handler: (input: Record<string, unknown>, config: Config) => Config;
|
|
295
|
+
};
|
|
296
|
+
/**
|
|
297
|
+
* What that same `copy` call would do, without doing it — the rows that land, what comes along
|
|
298
|
+
* because something named points at it, and the rows of yours a copied ref binds to instead.
|
|
299
|
+
*
|
|
300
|
+
* A read, taking `copy`'s own input verbatim, so a surface plans the invocation it is about to
|
|
301
|
+
* send. The op is this plan applied, so the two cannot disagree.
|
|
302
|
+
*/
|
|
303
|
+
readonly 'copy-plan': {
|
|
304
|
+
readonly input: z.ZodObject<{
|
|
305
|
+
path: z.ZodType<string, string | undefined, z.core.$ZodTypeInternals<string, string | undefined>>;
|
|
306
|
+
data: z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodArray<z.ZodString>]>>]>;
|
|
307
|
+
onConflict: z.ZodOptional<z.ZodEnum<{
|
|
308
|
+
replace: "replace";
|
|
309
|
+
skip: "skip";
|
|
310
|
+
}>>;
|
|
311
|
+
}, z.core.$strip>;
|
|
312
|
+
readonly readOnly: true;
|
|
313
|
+
readonly label: "Plan a copy";
|
|
314
|
+
readonly description: "See what copying would bring before you do it — what lands as yours, what comes along because it is pointed at, and what you already hold that the copies will point at. Takes exactly the same input as `copy` and writes nothing. Run it before `copy`, and always before a `'*'` copy.";
|
|
315
|
+
readonly scope: "item";
|
|
316
|
+
readonly title: (entity: string) => string;
|
|
317
|
+
readonly example: typeof copyExample;
|
|
318
|
+
readonly handler: (input: Record<string, unknown>, config: Config) => Omit<CopyPlan, "patches">;
|
|
319
|
+
};
|
|
320
|
+
}, {
|
|
321
|
+
/**
|
|
322
|
+
* What to call this source — its `name`, or the slug when it declares none.
|
|
323
|
+
*
|
|
324
|
+
* The fallback belongs here because the default is a fact about the field: `name` is optional, and
|
|
325
|
+
* a source with none is the slug it's filed under. Left to consumers, every surface that renders a
|
|
326
|
+
* source implements the same `??`, and one of them eventually renders `undefined`.
|
|
327
|
+
*/
|
|
328
|
+
readonly displayName: ({
|
|
329
|
+
member,
|
|
330
|
+
path
|
|
331
|
+
}: ComputedInput) => string;
|
|
332
|
+
}, false>;
|
|
333
|
+
/**
|
|
334
|
+
* What a pin's `options` may say, checked against the config type it is declared in — one record per
|
|
335
|
+
* accessor, keyed by the path the source spells, valued by what this config does to it.
|
|
336
|
+
*
|
|
337
|
+
* Each entry names a verb. The two bodies are partial at every depth because that is what an overlay
|
|
338
|
+
* is: `override: { overrides: { dark: … } }` says one conditional
|
|
339
|
+
* value and nothing about the rest of the token.
|
|
340
|
+
*
|
|
341
|
+
* **Which kind an accessor addresses comes from the emitted `uds-env.d.ts`**, through
|
|
342
|
+
* {@link RegisteredEntities}. It cannot come from the schema: this kind is a member of the entity map
|
|
343
|
+
* whose accessors key `options`, so naming that map here would be a type referencing itself. It
|
|
344
|
+
* cannot come from `register` either — the contextual type there is a union with an index signature
|
|
345
|
+
* in it, which switches excess-property checking off, so a misspelled field types clean.
|
|
346
|
+
*
|
|
347
|
+
* So the same route {@link RegisteredPaths} takes: the build knows the answer and writes it down.
|
|
348
|
+
* A config that has built gets `override: { modifers: … }` refused against the token schema; one that
|
|
349
|
+
* has not keeps the open record the schema describes and still compiles.
|
|
350
|
+
*
|
|
351
|
+
* The paths are still `string`. A source's catalogue lives in its installed artifact, so typing those
|
|
352
|
+
* needs a declaration per source — see the source-model doc.
|
|
353
|
+
*/
|
|
354
|
+
type PinOptions = { [A in keyof RegisteredEntities]?: Record<string, PinAdjustment<RegisteredEntities[A]>> };
|
|
355
|
+
/** The pin's `link` field as stored — see the field's own doc. */
|
|
356
|
+
type LinkDeclaration = '*' | Record<string, '*' | readonly string[]>;
|
|
357
|
+
/** One `options` entry, checked against the kind its accessor addresses. The runtime floor — that an
|
|
358
|
+
* entry names at least one of the three — is the schema's `refine`, which reports the path. */
|
|
359
|
+
type PinAdjustment<E> = {
|
|
360
|
+
override?: PartialBodyOf<E>;
|
|
361
|
+
extend?: PartialBodyOf<E>;
|
|
362
|
+
hidden?: boolean;
|
|
363
|
+
};
|
|
364
|
+
/**
|
|
365
|
+
* One `options` entry as stored — what this config does to that path, with the two bodies left open.
|
|
366
|
+
*
|
|
367
|
+
* Also what {@link PinOptions} falls back to before a build has written {@link RegisteredEntities}:
|
|
368
|
+
* the same entry, with nothing to check the bodies against yet.
|
|
369
|
+
*/
|
|
370
|
+
interface PinDirective {
|
|
371
|
+
readonly override?: Record<string, unknown>;
|
|
372
|
+
readonly extend?: Record<string, unknown>;
|
|
373
|
+
readonly hidden?: boolean;
|
|
374
|
+
}
|
|
375
|
+
/** One declared source, typed off this kind's own schema — what the readers below hand back. */
|
|
376
|
+
type Source = ItemOf<typeof LinkedSystem>;
|
|
377
|
+
/**
|
|
378
|
+
* A linked system's state as `Config.sourceStates()` reports it, narrowed to this kind's vocabulary.
|
|
379
|
+
*
|
|
380
|
+
* `Config` spans every source kind a config declares, so it can only type the payloads as `unknown`;
|
|
381
|
+
* only the kind knows them. This is that knowledge, named once so no surface restates the union or
|
|
382
|
+
* casts its way to it. Pick states out of `config.sourceStates()` by their `source` accessor name, then read
|
|
383
|
+
* them as this.
|
|
384
|
+
*/
|
|
385
|
+
type LinkedSystemState = SourceState<ResolvedSource, SourceUnavailable>;
|
|
386
|
+
/**
|
|
387
|
+
* The resolver `Config.load` wants for `linkedSystems`, typed both ways: handed a {@link Source}, and
|
|
388
|
+
* held to this kind's own two payloads.
|
|
389
|
+
*
|
|
390
|
+
* The build's disk resolver and Studio's storage resolver both implement this, which is what makes them
|
|
391
|
+
* answer in one vocabulary rather than two that agree by convention.
|
|
392
|
+
*/
|
|
393
|
+
type LinkedSystemResolver = SourceResolver<Source, ResolvedSource, SourceUnavailable>;
|
|
394
|
+
/**
|
|
395
|
+
* The source an entity comes from — `undefined` for one wholly this config's own, and for one that
|
|
396
|
+
* involves two systems, since naming either would label the other wrongly. See `Entity.source`.
|
|
397
|
+
*
|
|
398
|
+
* This is the provenance read. It folds both ways an entity can involve another system — borrowed and
|
|
399
|
+
* locally extended, or authored here with a value pointing through a link — because a badge, an
|
|
400
|
+
* adornment and a "Source" row want the same answer either way. {@link borrowedItem} is the other read,
|
|
401
|
+
* the one a write gate wants, and picking the wrong one is quiet in both directions.
|
|
402
|
+
*
|
|
403
|
+
* Two hops: the entity's `source` answers which slug, and this kind answers for the slug. It lives
|
|
404
|
+
* beside the kind rather than on `Config` because the answer is one of these items, typed off the schema
|
|
405
|
+
* above. A `Config` method could only hand back a bare `Entity` or a bag naming the fields this kind
|
|
406
|
+
* happens to declare, and every consumer of that bag has to be found again when the kind gains one.
|
|
407
|
+
*
|
|
408
|
+
* Named for the item it answers about, because {@link Config.sourceFor} already answers the
|
|
409
|
+
* slug-to-config question and `sourceOf` already reads the slug off a ref.
|
|
410
|
+
*/
|
|
411
|
+
declare function sourceOfItem({
|
|
412
|
+
config,
|
|
413
|
+
kind,
|
|
414
|
+
path
|
|
415
|
+
}: {
|
|
416
|
+
config: Config;
|
|
417
|
+
kind: string;
|
|
418
|
+
path: string;
|
|
419
|
+
}): Source | undefined;
|
|
420
|
+
/**
|
|
421
|
+
* The source a group draws through — set only when every member agrees on one.
|
|
422
|
+
*
|
|
423
|
+
* The agreement rule is kind-agnostic and lives on {@link Config.groupSource}. This makes the same
|
|
424
|
+
* second hop {@link sourceOfItem} makes, so a surface gets the typed pin rather than a slug it would
|
|
425
|
+
* have to look up itself.
|
|
426
|
+
*/
|
|
427
|
+
declare function sourceOfGroup({
|
|
428
|
+
config,
|
|
429
|
+
kind,
|
|
430
|
+
groupPath
|
|
431
|
+
}: {
|
|
432
|
+
config: Config;
|
|
433
|
+
kind: string;
|
|
434
|
+
groupPath: string;
|
|
435
|
+
}): Source | undefined;
|
|
436
|
+
/**
|
|
437
|
+
* The source an item is — `undefined` for one this config authored, including one whose own fields
|
|
438
|
+
* point through a link.
|
|
439
|
+
*
|
|
440
|
+
* The write gate's reader, where {@link sourceOfItem} is the badge's. They are easy to swap, and the
|
|
441
|
+
* failure is quiet in both directions: gating on `sourceOfItem` locks a local alias its own author
|
|
442
|
+
* wrote, and badging on this one leaves a borrowed value looking native.
|
|
443
|
+
*
|
|
444
|
+
* To choose between them, ask whether the other side is affected. Retargeting a ref we declared changes
|
|
445
|
+
* nothing but our artifact, so it is ours; the fields of an item we borrowed are the source's, and a
|
|
446
|
+
* local edit to them can only be an overlay. See `Entity.borrowedFrom`.
|
|
447
|
+
*/
|
|
448
|
+
declare function borrowedItem({
|
|
449
|
+
config,
|
|
450
|
+
kind,
|
|
451
|
+
path
|
|
452
|
+
}: {
|
|
453
|
+
config: Config;
|
|
454
|
+
kind: string;
|
|
455
|
+
path: string;
|
|
456
|
+
}): Source | undefined;
|
|
457
|
+
/** The source a whole group is borrowed from — {@link borrowedItem}'s group form, and the same second
|
|
458
|
+
* hop {@link sourceOfGroup} makes. Set only when every member agrees, which is `Config`'s rule to
|
|
459
|
+
* state and not this one's. Gates what can be done to the folder: adding, renaming, reordering. */
|
|
460
|
+
declare function borrowedGroup({
|
|
461
|
+
config,
|
|
462
|
+
kind,
|
|
463
|
+
groupPath
|
|
464
|
+
}: {
|
|
465
|
+
config: Config;
|
|
466
|
+
kind: string;
|
|
467
|
+
groupPath: string;
|
|
468
|
+
}): Source | undefined;
|
|
469
|
+
/**
|
|
470
|
+
* The slug this config already draws a source under, or `undefined` when it doesn't draw it at all.
|
|
471
|
+
*
|
|
472
|
+
* Takes either way a source can be named, because the same system reached two ways is the same system:
|
|
473
|
+
* a form offering to draw on one that is already a source should say so and name the slug it lives
|
|
474
|
+
* under, rather than offering a second declaration under another name. Which fields those are is this
|
|
475
|
+
* kind's to know ({@link LinkedSystem.sourceIdentity}); a caller that indexed them itself would be
|
|
476
|
+
* restating the schema.
|
|
477
|
+
*/
|
|
478
|
+
declare function sourceSlugFor({
|
|
479
|
+
config,
|
|
480
|
+
configPath,
|
|
481
|
+
systemId
|
|
482
|
+
}: {
|
|
483
|
+
config: Config | null | undefined;
|
|
484
|
+
configPath?: string | null;
|
|
485
|
+
systemId?: string | null;
|
|
486
|
+
}): string | undefined;
|
|
487
|
+
/**
|
|
488
|
+
* A system's name as a starting slug — lowercase, a single path segment as {@link LINK_SLUG} wants,
|
|
489
|
+
* and not one this config has already taken.
|
|
490
|
+
*
|
|
491
|
+
* The suffix matters because the suggestion is applied on open and on every pick, before anyone has
|
|
492
|
+
* typed: suggesting a slug that already exists greets you with a validation error you didn't cause and
|
|
493
|
+
* a dead submit button. It is for two different systems whose names normalize to the same slug — the
|
|
494
|
+
* same system declared twice is refused outright, by {@link sourceSlugFor}.
|
|
495
|
+
*/
|
|
496
|
+
declare function suggestLinkSlug({
|
|
497
|
+
name,
|
|
498
|
+
taken
|
|
499
|
+
}: {
|
|
500
|
+
name: string;
|
|
501
|
+
taken: ReadonlySet<string>;
|
|
502
|
+
}): string;
|
|
503
|
+
//#endregion
|
|
504
|
+
export { LINK_SLUG, LINK_SLUG_MESSAGE, LinkDeclaration, LinkedSystem, LinkedSystemResolver, LinkedSystemState, PinDirective, PinOptions, PinOptionsField, ResolvedSource, Source, SourceUnavailable, borrowedGroup, borrowedItem, isLinkSlug, resolvedSource, sourceOfGroup, sourceOfItem, sourceSlugFor, sourceUnavailable, suggestLinkSlug };
|