@yahoo/uds-create-config 2.45.0 → 3.0.1
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,48 @@
|
|
|
1
|
+
//#region src/css/value-type.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* What KIND of CSS value a literal is.
|
|
4
|
+
*
|
|
5
|
+
* A token's `type` is an open string it may declare, and most don't — a raw palette is authored as
|
|
6
|
+
* bare hex values with no type at all. Everything that wants to treat a token as a colour (a
|
|
7
|
+
* swatch, a picker, the emitted type augmentation, the AI's catalogue) then has nothing to go on,
|
|
8
|
+
* so the inference lives here: beside the entity, once, rather than re-derived by each surface that
|
|
9
|
+
* needs it.
|
|
10
|
+
*
|
|
11
|
+
* The classification is deliberately shallow. It reads the SHAPE of a literal — a leading `#`, a
|
|
12
|
+
* known unit suffix, a recognised function head — and punts when nothing matches, because a wrong
|
|
13
|
+
* confident answer is worse than none: a cell that decides a value is a colour renders a swatch and
|
|
14
|
+
* a colour picker over something that isn't one.
|
|
15
|
+
*/
|
|
16
|
+
/** Recognised value kinds. Open-ended by design — a token's `type` is a string, not a closed set. */
|
|
17
|
+
type ValueType = 'color' | 'length' | 'percentage' | 'angle' | 'time' | 'ratio' | 'shadow' | 'gradient' | 'easing-function' | 'number' | 'string';
|
|
18
|
+
/**
|
|
19
|
+
* The type a literal looks like, or `undefined` when nothing matches.
|
|
20
|
+
*
|
|
21
|
+
* `undefined` is a real answer, not a failure: `var(--foo)` names another value rather than being
|
|
22
|
+
* one, and a bare keyword like `min-content` is a CSS-wide identifier the shape can't place beyond
|
|
23
|
+
* "some string".
|
|
24
|
+
*/
|
|
25
|
+
declare function sniffValueType(value: unknown): ValueType | undefined;
|
|
26
|
+
interface ResolveValueTypeInput {
|
|
27
|
+
/** The type the token DECLARES, if any. */
|
|
28
|
+
readonly type?: string | null;
|
|
29
|
+
/** The token's resolved literal — a ref should be chased before it gets here. */
|
|
30
|
+
readonly value?: unknown;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* A token's effective value type: what it DECLARES, else what its literal looks like.
|
|
34
|
+
*
|
|
35
|
+
* The declared type wins because it is an authoring decision — without it a token deliberately
|
|
36
|
+
* typed `string` could not hold a value that merely looks like a colour. The sniff answers for
|
|
37
|
+
* everything else, which is most of a raw palette.
|
|
38
|
+
*
|
|
39
|
+
* `undefined` when neither can say: an undeclared token whose value names something rather than
|
|
40
|
+
* being something (`var(--foo)`, an unchased ref) has no type to report, and inventing one would
|
|
41
|
+
* put a swatch on a value nobody can paint.
|
|
42
|
+
*/
|
|
43
|
+
declare function resolveValueType({
|
|
44
|
+
type,
|
|
45
|
+
value
|
|
46
|
+
}: ResolveValueTypeInput): string | undefined;
|
|
47
|
+
//#endregion
|
|
48
|
+
export { ResolveValueTypeInput, ValueType, resolveValueType, sniffValueType };
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
//#region src/css/value-type.ts
|
|
2
|
+
/** Function heads that introduce a colour. */
|
|
3
|
+
const COLOR_FUNCTIONS = [
|
|
4
|
+
"rgb(",
|
|
5
|
+
"rgba(",
|
|
6
|
+
"hsl(",
|
|
7
|
+
"hsla(",
|
|
8
|
+
"hwb(",
|
|
9
|
+
"lab(",
|
|
10
|
+
"lch(",
|
|
11
|
+
"oklab(",
|
|
12
|
+
"oklch(",
|
|
13
|
+
"color(",
|
|
14
|
+
"color-mix("
|
|
15
|
+
];
|
|
16
|
+
/** Function heads that introduce a gradient. */
|
|
17
|
+
const GRADIENT_FUNCTIONS = [
|
|
18
|
+
"linear-gradient(",
|
|
19
|
+
"radial-gradient(",
|
|
20
|
+
"conic-gradient(",
|
|
21
|
+
"repeating-linear-gradient(",
|
|
22
|
+
"repeating-radial-gradient(",
|
|
23
|
+
"repeating-conic-gradient("
|
|
24
|
+
];
|
|
25
|
+
/** Function heads that introduce an easing curve. */
|
|
26
|
+
const EASING_FUNCTIONS = [
|
|
27
|
+
"cubic-bezier(",
|
|
28
|
+
"steps(",
|
|
29
|
+
"linear("
|
|
30
|
+
];
|
|
31
|
+
/** Absolute and relative length units, longest-first so `rem` wins over `em`. */
|
|
32
|
+
const LENGTH_UNITS = [
|
|
33
|
+
"ch",
|
|
34
|
+
"cm",
|
|
35
|
+
"dvh",
|
|
36
|
+
"dvw",
|
|
37
|
+
"em",
|
|
38
|
+
"ex",
|
|
39
|
+
"in",
|
|
40
|
+
"lvh",
|
|
41
|
+
"lvw",
|
|
42
|
+
"mm",
|
|
43
|
+
"pc",
|
|
44
|
+
"pt",
|
|
45
|
+
"px",
|
|
46
|
+
"q",
|
|
47
|
+
"rem",
|
|
48
|
+
"svh",
|
|
49
|
+
"svw",
|
|
50
|
+
"vh",
|
|
51
|
+
"vmax",
|
|
52
|
+
"vmin",
|
|
53
|
+
"vw"
|
|
54
|
+
];
|
|
55
|
+
const NUMBER = /^-?(?:\d+(?:\.\d*)?|\.\d+)$/;
|
|
56
|
+
const WITH_UNIT = /^-?(?:\d+(?:\.\d*)?|\.\d+)([a-z%]+)$/;
|
|
57
|
+
/** `16 / 9`, and the space-less `16/9`. */
|
|
58
|
+
const RATIO = /^\d+(\.\d+)?\s*\/\s*\d+(\.\d+)?$/;
|
|
59
|
+
function startsWithAny(value, heads) {
|
|
60
|
+
return heads.some((head) => value.startsWith(head));
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The type a literal looks like, or `undefined` when nothing matches.
|
|
64
|
+
*
|
|
65
|
+
* `undefined` is a real answer, not a failure: `var(--foo)` names another value rather than being
|
|
66
|
+
* one, and a bare keyword like `min-content` is a CSS-wide identifier the shape can't place beyond
|
|
67
|
+
* "some string".
|
|
68
|
+
*/
|
|
69
|
+
function sniffValueType(value) {
|
|
70
|
+
if (typeof value !== "string") return void 0;
|
|
71
|
+
const trimmed = value.trim().toLowerCase();
|
|
72
|
+
if (!trimmed) return void 0;
|
|
73
|
+
if (trimmed.startsWith("var(")) return void 0;
|
|
74
|
+
if (trimmed.startsWith("#")) return "color";
|
|
75
|
+
if (startsWithAny(trimmed, GRADIENT_FUNCTIONS)) return "gradient";
|
|
76
|
+
if (startsWithAny(trimmed, COLOR_FUNCTIONS)) return "color";
|
|
77
|
+
if (startsWithAny(trimmed, EASING_FUNCTIONS)) return "easing-function";
|
|
78
|
+
if (RATIO.test(trimmed)) return "ratio";
|
|
79
|
+
if (NUMBER.test(trimmed)) return "number";
|
|
80
|
+
const unit = WITH_UNIT.exec(trimmed)?.[1];
|
|
81
|
+
if (unit === "%") return "percentage";
|
|
82
|
+
if (unit === "deg" || unit === "rad" || unit === "grad" || unit === "turn") return "angle";
|
|
83
|
+
if (unit === "s" || unit === "ms") return "time";
|
|
84
|
+
if (unit && LENGTH_UNITS.includes(unit)) return "length";
|
|
85
|
+
if (isShadow(trimmed)) return "shadow";
|
|
86
|
+
return "string";
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* A shadow: at least two space-separated lengths, optionally followed by a colour, and optionally
|
|
90
|
+
* led by `inset`. Enough to distinguish `0 1px 2px rgba(…)` from a keyword without a real parser.
|
|
91
|
+
*/
|
|
92
|
+
function isShadow(value) {
|
|
93
|
+
const parts = splitTopLevel(value.startsWith("inset ") ? value.slice(6) : value);
|
|
94
|
+
if (parts.length < 3) return false;
|
|
95
|
+
return parts.filter((part) => NUMBER.test(part) || WITH_UNIT.test(part)).length >= 2;
|
|
96
|
+
}
|
|
97
|
+
/** Split on whitespace, keeping bracketed groups intact. */
|
|
98
|
+
function splitTopLevel(value) {
|
|
99
|
+
const parts = [];
|
|
100
|
+
let depth = 0;
|
|
101
|
+
let current = "";
|
|
102
|
+
for (const char of value) {
|
|
103
|
+
if (char === "(") depth++;
|
|
104
|
+
if (char === ")") depth--;
|
|
105
|
+
if (depth === 0 && /\s/.test(char)) {
|
|
106
|
+
if (current) parts.push(current);
|
|
107
|
+
current = "";
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
current += char;
|
|
111
|
+
}
|
|
112
|
+
if (current) parts.push(current);
|
|
113
|
+
return parts;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* A token's effective value type: what it DECLARES, else what its literal looks like.
|
|
117
|
+
*
|
|
118
|
+
* The declared type wins because it is an authoring decision — without it a token deliberately
|
|
119
|
+
* typed `string` could not hold a value that merely looks like a colour. The sniff answers for
|
|
120
|
+
* everything else, which is most of a raw palette.
|
|
121
|
+
*
|
|
122
|
+
* `undefined` when neither can say: an undeclared token whose value names something rather than
|
|
123
|
+
* being something (`var(--foo)`, an unchased ref) has no type to report, and inventing one would
|
|
124
|
+
* put a swatch on a value nobody can paint.
|
|
125
|
+
*/
|
|
126
|
+
function resolveValueType({ type, value }) {
|
|
127
|
+
if (type) return type;
|
|
128
|
+
return sniffValueType(value);
|
|
129
|
+
}
|
|
130
|
+
//#endregion
|
|
131
|
+
export { resolveValueType, sniffValueType };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { CssGrammar } from "../framework/Config.js";
|
|
2
|
+
import { CssPropertyEntry } from "./properties.generated.js";
|
|
3
|
+
|
|
4
|
+
//#region src/css/values.d.ts
|
|
5
|
+
/** The keywords every property takes, which the grammars leave out. */
|
|
6
|
+
declare const CSS_WIDE_KEYWORDS: ReadonlySet<string>;
|
|
7
|
+
/** Every property the table knows, in CSS spelling, sorted. */
|
|
8
|
+
declare const CSS_PROPERTY_NAMES: readonly string[];
|
|
9
|
+
/** The CSS property behind a name in either spelling, if it is one. */
|
|
10
|
+
declare function cssProperty(name: string): CssPropertyEntry | undefined;
|
|
11
|
+
/** Whether a name, in JSX or CSS spelling, is a CSS property. Vendor-prefixed names are not. */
|
|
12
|
+
declare function isCssProperty(name: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Why a literal is not a value the CSS property takes: `undefined` when it is, a message when it is
|
|
15
|
+
* refused, or `'unknown'` for a value nothing here can judge.
|
|
16
|
+
*
|
|
17
|
+
* The table holds keywords and single-class literals. A shorthand (`all 200ms ease`), a function
|
|
18
|
+
* (`rgb(…)`, `calc(…)`), a property outside the table and a class with no literal spelling
|
|
19
|
+
* (`custom-ident`) are beyond it and go to `grammar` when one is given: a verdict there accepts or
|
|
20
|
+
* refuses, and no verdict leaves the value `'unknown'`, never refused. The table's own answer is never
|
|
21
|
+
* put to the grammar.
|
|
22
|
+
*/
|
|
23
|
+
declare function cssValueIssue({
|
|
24
|
+
property,
|
|
25
|
+
value,
|
|
26
|
+
grammar
|
|
27
|
+
}: {
|
|
28
|
+
property: string;
|
|
29
|
+
value: string | number;
|
|
30
|
+
grammar?: CssGrammar;
|
|
31
|
+
}): string | undefined;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { CSS_PROPERTY_NAMES, CSS_WIDE_KEYWORDS, cssProperty, cssValueIssue, isCssProperty };
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { ref } from "../framework/utils/refs.js";
|
|
2
|
+
import { CSS_PROPERTIES } from "./properties.generated.js";
|
|
3
|
+
//#region src/css/values.ts
|
|
4
|
+
/** A token ref as a model writes it, spelled from the ref itself so the prose can't drift. */
|
|
5
|
+
const spelled = (path) => JSON.stringify(ref("token", path));
|
|
6
|
+
/** `borderRadius` → `border-radius`: the CSS spelling of a JSX name. */
|
|
7
|
+
const kebabCase = (name) => name.replace(/[A-Z]/g, (char) => `-${char.toLowerCase()}`);
|
|
8
|
+
/** The keywords every property takes, which the grammars leave out. */
|
|
9
|
+
const CSS_WIDE_KEYWORDS = new Set([
|
|
10
|
+
"inherit",
|
|
11
|
+
"initial",
|
|
12
|
+
"unset",
|
|
13
|
+
"revert",
|
|
14
|
+
"revert-layer"
|
|
15
|
+
]);
|
|
16
|
+
/** Every property the table knows, in CSS spelling, sorted. */
|
|
17
|
+
const CSS_PROPERTY_NAMES = Object.keys(CSS_PROPERTIES).sort((a, b) => a.localeCompare(b));
|
|
18
|
+
/** The CSS property behind a name in either spelling, if it is one. */
|
|
19
|
+
function cssProperty(name) {
|
|
20
|
+
const css = kebabCase(name);
|
|
21
|
+
return Object.hasOwn(CSS_PROPERTIES, css) ? CSS_PROPERTIES[css] : void 0;
|
|
22
|
+
}
|
|
23
|
+
/** Whether a name, in JSX or CSS spelling, is a CSS property. Vendor-prefixed names are not. */
|
|
24
|
+
function isCssProperty(name) {
|
|
25
|
+
return cssProperty(name) !== void 0;
|
|
26
|
+
}
|
|
27
|
+
const NUMBER = String.raw`[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?`;
|
|
28
|
+
const LENGTH_UNITS = "px|em|rem|ex|rex|cap|rcap|ch|rch|ic|ric|lh|rlh|vw|vh|vi|vb|vmin|vmax|svw|svh|svi|svb|svmin|svmax|lvw|lvh|lvi|lvb|lvmin|lvmax|dvw|dvh|dvi|dvb|dvmin|dvmax|cqw|cqh|cqi|cqb|cqmin|cqmax|cm|mm|q|in|pt|pc";
|
|
29
|
+
const dimension = (units) => new RegExp(`^${NUMBER}(?:${units})$`, "i");
|
|
30
|
+
/**
|
|
31
|
+
* The literal spelling of each value class, for the classes that have one. A class outside this table
|
|
32
|
+
* (`url`, `image`, `custom-ident`, `dashed-ident`) is spelled by a function or by any identifier, so a
|
|
33
|
+
* value that matches nothing else is not refused, only unjudged.
|
|
34
|
+
*/
|
|
35
|
+
const LITERALS = {
|
|
36
|
+
length: new RegExp(`^(?:${NUMBER}(?:${LENGTH_UNITS})|[+-]?0+)$`, "i"),
|
|
37
|
+
percentage: new RegExp(`^${NUMBER}%$`),
|
|
38
|
+
"length-percentage": new RegExp(`^(?:${NUMBER}(?:${LENGTH_UNITS}|%)|[+-]?0+)$`, "i"),
|
|
39
|
+
number: new RegExp(`^${NUMBER}$`),
|
|
40
|
+
integer: /^[+-]?\d+$/,
|
|
41
|
+
color: /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,
|
|
42
|
+
time: dimension("ms|s"),
|
|
43
|
+
angle: dimension("deg|grad|rad|turn"),
|
|
44
|
+
flex: dimension("fr"),
|
|
45
|
+
string: /^(?:"[^"]*"|'[^']*')$/
|
|
46
|
+
};
|
|
47
|
+
/** How a refusal names each class, with a spelling the writer can copy. */
|
|
48
|
+
const CLASS_NOUNS = {
|
|
49
|
+
length: "a length (`4px`, `0.5rem`)",
|
|
50
|
+
percentage: "a percentage (`50%`)",
|
|
51
|
+
"length-percentage": "a length or a percentage (`4px`, `50%`)",
|
|
52
|
+
number: "a number (`1.5`)",
|
|
53
|
+
integer: "an integer (`3`)",
|
|
54
|
+
color: "a hex color (`#1DB954`)",
|
|
55
|
+
time: "a time (`200ms`)",
|
|
56
|
+
angle: "an angle (`45deg`)",
|
|
57
|
+
flex: "a flex fraction (`1fr`)",
|
|
58
|
+
string: "a quoted string"
|
|
59
|
+
};
|
|
60
|
+
const SHOWN_KEYWORDS = 12;
|
|
61
|
+
function takes(entry) {
|
|
62
|
+
const parts = [];
|
|
63
|
+
if (entry.keywords.length > 0) {
|
|
64
|
+
const shown = entry.keywords.slice(0, SHOWN_KEYWORDS).map((keyword) => `\`${keyword}\``).join(", ");
|
|
65
|
+
const rest = entry.keywords.length - SHOWN_KEYWORDS;
|
|
66
|
+
parts.push(rest > 0 ? `one of ${shown} (${rest} more)` : `one of ${shown}`);
|
|
67
|
+
}
|
|
68
|
+
for (const cls of entry.classes) {
|
|
69
|
+
const noun = CLASS_NOUNS[cls];
|
|
70
|
+
if (noun) parts.push(noun);
|
|
71
|
+
}
|
|
72
|
+
return parts.join(", or ");
|
|
73
|
+
}
|
|
74
|
+
/** How a refusal points at the token form, whichever check refused. */
|
|
75
|
+
const TOKEN_HINT = ` A scale step or a color is a token: reference it as \`${spelled("<group>/<name>")}\`, or its group, \`${spelled("<group>")}\`, to offer every token in it.`;
|
|
76
|
+
/**
|
|
77
|
+
* Why a literal is not a value the CSS property takes: `undefined` when it is, a message when it is
|
|
78
|
+
* refused, or `'unknown'` for a value nothing here can judge.
|
|
79
|
+
*
|
|
80
|
+
* The table holds keywords and single-class literals. A shorthand (`all 200ms ease`), a function
|
|
81
|
+
* (`rgb(…)`, `calc(…)`), a property outside the table and a class with no literal spelling
|
|
82
|
+
* (`custom-ident`) are beyond it and go to `grammar` when one is given: a verdict there accepts or
|
|
83
|
+
* refuses, and no verdict leaves the value `'unknown'`, never refused. The table's own answer is never
|
|
84
|
+
* put to the grammar.
|
|
85
|
+
*/
|
|
86
|
+
function cssValueIssue({ property, value, grammar }) {
|
|
87
|
+
const css = kebabCase(property);
|
|
88
|
+
const text = String(value).trim();
|
|
89
|
+
if (CSS_WIDE_KEYWORDS.has(text)) return void 0;
|
|
90
|
+
const unjudged = () => {
|
|
91
|
+
const verdict = grammar?.({
|
|
92
|
+
property: css,
|
|
93
|
+
value: text
|
|
94
|
+
});
|
|
95
|
+
if (verdict === void 0) return "unknown";
|
|
96
|
+
if (verdict) return void 0;
|
|
97
|
+
return `\`${text}\` is not a value \`${css}\` takes: it does not match the property's grammar.${TOKEN_HINT}`;
|
|
98
|
+
};
|
|
99
|
+
const entry = cssProperty(property);
|
|
100
|
+
if (!entry) return unjudged();
|
|
101
|
+
if (/[\s,/(]/.test(text)) return unjudged();
|
|
102
|
+
const lower = text.toLowerCase();
|
|
103
|
+
if (entry.keywords.some((keyword) => keyword.toLowerCase() === lower)) return;
|
|
104
|
+
let judged = true;
|
|
105
|
+
for (const cls of entry.classes) {
|
|
106
|
+
const literal = LITERALS[cls];
|
|
107
|
+
if (!literal) judged = false;
|
|
108
|
+
else if (literal.test(text)) return void 0;
|
|
109
|
+
}
|
|
110
|
+
if (!judged) return unjudged();
|
|
111
|
+
if (/^-[a-z]/i.test(text)) return unjudged();
|
|
112
|
+
const accepted = takes(entry);
|
|
113
|
+
return `\`${text}\` is not a value \`${css}\` takes.${accepted ? ` It takes ${accepted}.` : ""}${TOKEN_HINT}`;
|
|
114
|
+
}
|
|
115
|
+
//#endregion
|
|
116
|
+
export { CSS_PROPERTY_NAMES, CSS_WIDE_KEYWORDS, cssProperty, cssValueIssue, isCssProperty, kebabCase };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { EntityClass } from "../../framework/defineEntity.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
//#region src/entities/native/NativeModifier.d.ts
|
|
5
|
+
declare const NATIVE_ACTIVATIONS: readonly ["appearance", "min-width", "operating-system", "state"];
|
|
6
|
+
type NativeActivation = (typeof NATIVE_ACTIVATIONS)[number];
|
|
7
|
+
declare const NativeModifier: EntityClass<z.ZodObject<{
|
|
8
|
+
type: z.ZodEnum<{
|
|
9
|
+
appearance: "appearance";
|
|
10
|
+
"min-width": "min-width";
|
|
11
|
+
state: "state";
|
|
12
|
+
"operating-system": "operating-system";
|
|
13
|
+
}>;
|
|
14
|
+
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
|
|
15
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
16
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
17
|
+
mode: "mode";
|
|
18
|
+
state: "state";
|
|
19
|
+
}>>;
|
|
20
|
+
default: z.ZodOptional<z.ZodObject<{
|
|
21
|
+
__ref: z.ZodString;
|
|
22
|
+
}, z.core.$strip>>;
|
|
23
|
+
}, z.core.$strip>, "modifier", Record<never, never>, Record<never, never>, false>;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { NATIVE_ACTIVATIONS, NativeActivation, NativeModifier };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { defineEntity } from "../../framework/defineEntity.js";
|
|
2
|
+
import { modifierAxis, modifierGroupFields, modifierInvariants } from "../system/Modifier.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
//#region src/entities/native/NativeModifier.ts
|
|
5
|
+
/**
|
|
6
|
+
* The native variant of `Modifier`. Web's `selector`/`media-query` split is a CSS concept; a native
|
|
7
|
+
* condition is one the OS or a component reports: the appearance (light/dark), a viewport width
|
|
8
|
+
* floor, the operating system itself, or a runtime state a component reports (`pressed`, in
|
|
9
|
+
* Pressable's vocabulary rather than a pseudo-class). An iOS/Android difference is an ordinary
|
|
10
|
+
* modifier riding an `operating-system` option; both ship in one binary, so the choice happens at
|
|
11
|
+
* runtime and codegen's job is `Platform.select()`.
|
|
12
|
+
*/
|
|
13
|
+
const NATIVE_ACTIVATIONS = [
|
|
14
|
+
"appearance",
|
|
15
|
+
"min-width",
|
|
16
|
+
"operating-system",
|
|
17
|
+
"state"
|
|
18
|
+
];
|
|
19
|
+
const NativeModifier = defineEntity({
|
|
20
|
+
kind: "modifier",
|
|
21
|
+
entityName: "NativeModifier",
|
|
22
|
+
fields: z.object({
|
|
23
|
+
type: z.enum(NATIVE_ACTIVATIONS),
|
|
24
|
+
value: z.union([z.string(), z.number()])
|
|
25
|
+
}),
|
|
26
|
+
groupFields: modifierGroupFields,
|
|
27
|
+
uniqueLeaves: true,
|
|
28
|
+
invariants: (config) => {
|
|
29
|
+
const problems = modifierInvariants(config);
|
|
30
|
+
for (const item of config.list("modifier")) {
|
|
31
|
+
const axis = modifierAxis(config, item.path);
|
|
32
|
+
const { type } = item.toJSON();
|
|
33
|
+
const wants = type === "state" ? "state" : "mode";
|
|
34
|
+
if (!axis) problems.push(`Native modifier "${item.path}" belongs to no typed group; a native condition is either an option of a \`mode\` group or a member of a \`state\` group.`);
|
|
35
|
+
else if (axis.type !== wants) problems.push(`Native modifier "${item.path}" activates by \`${type}\`, which belongs under a group typed \`${wants}\`, not "${axis.group}" (\`${axis.type}\`).`);
|
|
36
|
+
}
|
|
37
|
+
return problems;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
//#endregion
|
|
41
|
+
export { NATIVE_ACTIVATIONS, NativeModifier };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { SubEntityClass } from "../../framework/defineSubEntity.js";
|
|
2
|
+
import { EntityClass } from "../../framework/defineEntity.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
//#region src/entities/native/NativeSettings.d.ts
|
|
6
|
+
/** The `canvas` section — how the browser canvas renders a native system. */
|
|
7
|
+
declare const CanvasSection: SubEntityClass<z.ZodObject<{
|
|
8
|
+
packageAliases: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
9
|
+
}, z.core.$strict>>;
|
|
10
|
+
/**
|
|
11
|
+
* `NativeSettings` — the settings of a `ReactNativeSystem`. The same kind as `Settings`, so a reader
|
|
12
|
+
* asks `Settings.get(config)` on either; the shape differs: no `css` and no `playground`, since a
|
|
13
|
+
* native system emits no stylesheet and serves no playground, so a native config declaring either is
|
|
14
|
+
* refused rather than silently carrying a web concept it cannot honor. `canvas` is added.
|
|
15
|
+
*/
|
|
16
|
+
declare const NativeSettings: EntityClass<z.ZodObject<Omit<{
|
|
17
|
+
system: z.ZodOptional<z.ZodObject<{
|
|
18
|
+
id: z.ZodOptional<z.ZodString>;
|
|
19
|
+
}, z.core.$strict>>;
|
|
20
|
+
build: z.ZodOptional<z.ZodObject<{
|
|
21
|
+
inputDir: z.ZodOptional<z.ZodString>;
|
|
22
|
+
outDir: z.ZodOptional<z.ZodString>;
|
|
23
|
+
registryDir: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, z.core.$strict>>;
|
|
25
|
+
css: z.ZodOptional<z.ZodObject<{
|
|
26
|
+
prefix: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
27
|
+
classNames: z.ZodString;
|
|
28
|
+
variables: z.ZodString;
|
|
29
|
+
}, z.core.$strict>]>>;
|
|
30
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
31
|
+
preflight: z.ZodOptional<z.ZodBoolean>;
|
|
32
|
+
safelist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
33
|
+
}, z.core.$strict>>;
|
|
34
|
+
playground: z.ZodOptional<z.ZodObject<{
|
|
35
|
+
pagesDir: z.ZodOptional<z.ZodString>;
|
|
36
|
+
port: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
}, z.core.$strict>>;
|
|
38
|
+
}, "css" | "playground" | "canvas"> & {
|
|
39
|
+
canvas: z.ZodOptional<z.ZodObject<{
|
|
40
|
+
packageAliases: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
41
|
+
}, z.core.$strict>>;
|
|
42
|
+
}, z.core.$strip>, z.ZodObject<Omit<Record<never, never>, never> & {}, z.core.$strip>, "settings", Record<never, never>, Record<never, never>, true>;
|
|
43
|
+
//#endregion
|
|
44
|
+
export { CanvasSection, NativeSettings };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { defineSubEntity } from "../../framework/defineSubEntity.js";
|
|
2
|
+
import { Settings } from "../system/Settings.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
//#region src/entities/native/NativeSettings.ts
|
|
5
|
+
const canvasFields = z.strictObject({
|
|
6
|
+
/** Browser-canvas-only package replacements, by package name. Values resolve from the config
|
|
7
|
+
* directory; phone and application builds continue importing the real package. */
|
|
8
|
+
packageAliases: z.record(z.string(), z.string()).meta({
|
|
9
|
+
title: "Package aliases",
|
|
10
|
+
description: "Packages the browser canvas swaps for a local module, by package name. Paths resolve from the config directory. Phone and app builds keep the real package."
|
|
11
|
+
}).optional() });
|
|
12
|
+
/** The `canvas` section — how the browser canvas renders a native system. */
|
|
13
|
+
const CanvasSection = defineSubEntity({
|
|
14
|
+
name: "canvas",
|
|
15
|
+
label: "Canvas",
|
|
16
|
+
singleton: true,
|
|
17
|
+
fields: canvasFields
|
|
18
|
+
});
|
|
19
|
+
/**
|
|
20
|
+
* `NativeSettings` — the settings of a `ReactNativeSystem`. The same kind as `Settings`, so a reader
|
|
21
|
+
* asks `Settings.get(config)` on either; the shape differs: no `css` and no `playground`, since a
|
|
22
|
+
* native system emits no stylesheet and serves no playground, so a native config declaring either is
|
|
23
|
+
* refused rather than silently carrying a web concept it cannot honor. `canvas` is added.
|
|
24
|
+
*/
|
|
25
|
+
const NativeSettings = Settings.extend({
|
|
26
|
+
entityName: "NativeSettings",
|
|
27
|
+
fields: {
|
|
28
|
+
css: null,
|
|
29
|
+
playground: null,
|
|
30
|
+
canvas: canvasFields.meta({ title: "Canvas" }).optional()
|
|
31
|
+
},
|
|
32
|
+
subEntities: {
|
|
33
|
+
css: null,
|
|
34
|
+
playground: null,
|
|
35
|
+
canvas: CanvasSection
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
//#endregion
|
|
39
|
+
export { CanvasSection, NativeSettings };
|