@yahoo/uds-create-config 4.53.2 → 4.55.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.
Files changed (64) hide show
  1. package/dist/capture/capture-to-spec.js +22 -6
  2. package/dist/capture/class-grammar.js +2 -3
  3. package/dist/configs/platform.d.ts +8 -1
  4. package/dist/configs/react-native-system.d.ts +21 -9
  5. package/dist/configs/react-native-system.js +1 -1
  6. package/dist/configs/system.js +3 -1
  7. package/dist/css/value-type.js +24 -0
  8. package/dist/entities/documentation/Documentation.d.ts +1 -1
  9. package/dist/entities/native/NativeStyleProperty.d.ts +14 -9
  10. package/dist/entities/native/NativeStyleProperty.js +23 -2
  11. package/dist/entities/native/NativeToken.d.ts +10 -3
  12. package/dist/entities/native/NativeToken.js +39 -4
  13. package/dist/entities/system/Component.js +2 -1
  14. package/dist/entities/system/GlobalStyle.d.ts +2 -2
  15. package/dist/entities/system/GlobalStyle.js +2 -1
  16. package/dist/entities/system/Modifier.d.ts +3 -1
  17. package/dist/entities/system/Modifier.js +3 -1
  18. package/dist/entities/system/Settings.d.ts +9 -1
  19. package/dist/entities/system/Settings.js +6 -2
  20. package/dist/entities/system/StyleProperty.d.ts +39 -3
  21. package/dist/entities/system/StyleProperty.js +141 -18
  22. package/dist/entities/system/Token.d.ts +14 -1
  23. package/dist/entities/system/Token.js +21 -3
  24. package/dist/entities/system/calc.d.ts +28 -0
  25. package/dist/entities/system/calc.js +121 -0
  26. package/dist/entities/system/color.d.ts +29 -4
  27. package/dist/entities/system/color.js +61 -8
  28. package/dist/entities/system/component-module.js +15 -4
  29. package/dist/entities/system/composed-values.d.ts +3 -2
  30. package/dist/entities/system/composed-values.js +20 -1
  31. package/dist/entities/system/defineComponent.d.ts +3 -3
  32. package/dist/entities/system/link-plan.js +10 -1
  33. package/dist/entities/system/linked-token-values.d.ts +34 -0
  34. package/dist/entities/system/linked-token-values.js +135 -0
  35. package/dist/entities/system/shadow.d.ts +9 -7
  36. package/dist/entities/system/shadow.js +8 -7
  37. package/dist/entities/system/style-bag.d.ts +1 -1
  38. package/dist/entities/system/token-index.js +45 -2
  39. package/dist/entities/system/token-values.d.ts +3 -2
  40. package/dist/entities/system/token-values.js +9 -9
  41. package/dist/framework/Config.d.ts +14 -18
  42. package/dist/framework/Config.js +105 -55
  43. package/dist/framework/class-names.d.ts +47 -7
  44. package/dist/framework/class-names.js +115 -14
  45. package/dist/framework/defineEntity.d.ts +3 -1
  46. package/dist/framework/defineEntity.js +3 -1
  47. package/dist/framework/inline-sources.d.ts +3 -3
  48. package/dist/framework/inline-sources.js +1 -1
  49. package/dist/framework/projections.d.ts +84 -3
  50. package/dist/framework/projections.js +315 -20
  51. package/dist/framework/ref-graph.js +1 -1
  52. package/dist/framework/registry.d.ts +7 -0
  53. package/dist/framework/registry.js +2 -1
  54. package/dist/framework/schema-version.d.ts +1 -1
  55. package/dist/framework/schema-version.js +5 -5
  56. package/dist/framework/utils/group.d.ts +2 -1
  57. package/dist/framework/utils/refs.d.ts +19 -2
  58. package/dist/framework/utils/refs.js +100 -12
  59. package/dist/index.d.ts +12 -10
  60. package/dist/index.js +10 -8
  61. package/dist/migrations/20261001162046_oklch_and_emit_fields.d.ts +25 -0
  62. package/dist/migrations/20261001162046_oklch_and_emit_fields.js +10 -0
  63. package/dist/tsconfig.tsbuildinfo +1 -1
  64. package/package.json +2 -2
@@ -1,4 +1,5 @@
1
1
  import { isRef, pathOf } from "../framework/utils/refs.js";
2
+ import { StyleProperty } from "../entities/system/StyleProperty.js";
2
3
  import { LAYER_PROPS, authoredValue } from "../framework/projections.js";
3
4
  import { intoName } from "../framework/prop-surface.js";
4
5
  import { Component } from "../entities/system/Component.js";
@@ -31,7 +32,8 @@ const SKIP_INLINE_PROPERTY = new Set([
31
32
  "border-image-outset",
32
33
  "border-image-repeat"
33
34
  ]);
34
- /** Browser defaults a shorthand such as `border: none` expands into. */
35
+ /** Browser defaults a shorthand such as `border: none` expands into. One is still read when it
36
+ * overrides a property the component's own rules set, as `max-height: none` lifts a panel's cap. */
35
37
  const SKIP_INLINE_VALUE = new Set([
36
38
  "none",
37
39
  "initial",
@@ -180,6 +182,7 @@ var Converter = class {
180
182
  unresolvedIcons = 0;
181
183
  counter = 0;
182
184
  childCap;
185
+ ruled = /* @__PURE__ */ new Map();
183
186
  constructor(options, grammar) {
184
187
  this.options = options;
185
188
  this.grammar = grammar;
@@ -459,7 +462,7 @@ var Converter = class {
459
462
  const stamped = stampedProps(el);
460
463
  if (grammar) this.propsFromClasses(el, grammar, props);
461
464
  Object.assign(props, stamped);
462
- if (grammar) this.propsFromInlineStyle(el, grammar, props);
465
+ if (grammar) this.propsFromInlineStyle(el, grammar, props, path);
463
466
  const layerProps = stampedLayerProps({
464
467
  el,
465
468
  layers: this.layerNames(path)
@@ -613,14 +616,27 @@ var Converter = class {
613
616
  * an off-scale `[value]` only on a property that takes one. Rendering plumbing (box sizing,
614
617
  * transitions, browser defaults) is not a prop and is skipped.
615
618
  */
616
- propsFromInlineStyle(el, grammar, props) {
617
- this.propsFromDeclarations(inlineDeclarations(el), grammar, props);
619
+ propsFromInlineStyle(el, grammar, props, path) {
620
+ this.propsFromDeclarations(inlineDeclarations(el), grammar, props, path === void 0 ? void 0 : this.ruledProperties(path));
621
+ }
622
+ /** The CSS properties a component's own style rules write on its root layer. */
623
+ ruledProperties(path) {
624
+ const known = this.ruled.get(path);
625
+ if (known) return known;
626
+ const out = /* @__PURE__ */ new Set();
627
+ const rules = Object.values(Component.get(this.options.config, path)?.styles ?? {});
628
+ for (const rule of rules) for (const prop of Object.keys(rule.layers?.root ?? {})) {
629
+ if (prop.startsWith("_")) continue;
630
+ for (const property of StyleProperty.get(this.options.config, prop)?.properties ?? []) out.add(property);
631
+ }
632
+ this.ruled.set(path, out);
633
+ return out;
618
634
  }
619
635
  /** {@link propsFromInlineStyle} over declarations the caller supplies. */
620
- propsFromDeclarations(declarations, grammar, props) {
636
+ propsFromDeclarations(declarations, grammar, props, ruled) {
621
637
  for (const [property, raw] of declarations.flatMap(gridAreaLines)) {
622
638
  let value = normalizeCssValue(raw);
623
- if (!value || SKIP_INLINE_PROPERTY.has(property) || SKIP_INLINE_VALUE.has(value)) continue;
639
+ if (!value || SKIP_INLINE_PROPERTY.has(property) || SKIP_INLINE_VALUE.has(value) && !ruled?.has(property)) continue;
624
640
  if (property === "position" && value === "fixed") value = "absolute";
625
641
  if (VIEWPORT_VALUE.test(value) && !WHOLE_VIEWPORT.test(value)) value = frameUnits(value, this.options.width, this.options.height);
626
642
  if (this.propFromDeclaration({
@@ -1,5 +1,5 @@
1
1
  import { isRef, pathOf } from "../framework/utils/refs.js";
2
- import { className, cssVarRef, resolveComponentProps, resolveTokenValue, stylePropEntries } from "../framework/projections.js";
2
+ import { className, renderStyleValue, resolveComponentProps, resolveTokenValue, stylePropEntries } from "../framework/projections.js";
3
3
  import { intoName, routesContent, routesIntoText } from "../framework/prop-surface.js";
4
4
  import { componentLayerClass, componentRuleClasses, stylePropClasses } from "../framework/class-names.js";
5
5
  //#region src/capture/class-grammar.ts
@@ -25,9 +25,8 @@ function classGrammar(config) {
25
25
  if (known) return known;
26
26
  known = /* @__PURE__ */ new Map();
27
27
  for (const entry of stylePropEntries(config, path)) {
28
- const spellings = [];
28
+ const spellings = [normalizeCssValue(renderStyleValue(config, entry.value))];
29
29
  if (config.resolve("token", entry.value)) {
30
- spellings.push(normalizeCssValue(cssVarRef(config, "token", entry.value)));
31
30
  const literal = resolveTokenValue(config, entry.value);
32
31
  if (typeof literal === "string") spellings.push(normalizeCssValue(literal));
33
32
  } else spellings.push(normalizeCssValue(String(entry.value)));
@@ -3,6 +3,13 @@ import { ReactNativeSystemConfig } from "./react-native-system.js";
3
3
  import { SystemConfig } from "./system.js";
4
4
 
5
5
  //#region src/configs/platform.d.ts
6
+ /**
7
+ * The names `System` and `ReactNativeSystem` declare themselves under. Held here rather than read
8
+ * off the classes so this module imports nothing at runtime: an entity module can ask which platform
9
+ * a config is without pulling in the config type that registers it, which would close an import cycle.
10
+ */
11
+ declare const WEB_CONFIG_NAME = "system-config";
12
+ declare const NATIVE_CONFIG_NAME = "react-native-system";
6
13
  /**
7
14
  * A design system of either platform — what a holder declares when it draws on a system and has no
8
15
  * reason to care which platform it is: the canvas, a session, a pipeline step.
@@ -12,4 +19,4 @@ declare function isNativeConfig(config: Config): boolean;
12
19
  /** Whether a config is a design system at all, of either platform. A canvas config is not. */
13
20
  declare function isSystemConfig(config: Config): config is AnySystemConfig;
14
21
  //#endregion
15
- export { AnySystemConfig, isNativeConfig, isSystemConfig };
22
+ export { AnySystemConfig, NATIVE_CONFIG_NAME, WEB_CONFIG_NAME, isNativeConfig, isSystemConfig };
@@ -1,12 +1,12 @@
1
1
  import { Ref } from "../framework/utils/ref-grammar.js";
2
2
  import { SubEntityClass } from "../framework/defineSubEntity.js";
3
3
  import { ComputedInput } from "../framework/registry.js";
4
+ import { DerivedColor } from "../entities/system/color.js";
5
+ import { ComposedValue } from "../entities/system/composed-values.js";
4
6
  import { EntityClass } from "../framework/defineEntity.js";
5
7
  import { ConfigClass } from "../framework/defineConfig.js";
6
8
  import { Named } from "../framework/named.js";
7
9
  import { PackageClass } from "../entities/system/Package.js";
8
- import { DerivedColor } from "../entities/system/color.js";
9
- import { ComposedValue } from "../entities/system/composed-values.js";
10
10
  import { OverrideCondition } from "../entities/system/Token.js";
11
11
  import { StylePropValue } from "../entities/system/StyleProperty.js";
12
12
  import { ComponentClass } from "../entities/system/Component.js";
@@ -70,7 +70,13 @@ declare const ReactNativeSystemDefinition: ConfigClass<{
70
70
  on: _$zod.ZodType<OverrideCondition, unknown, _$zod_v4_core0.$ZodTypeInternals<OverrideCondition, unknown>>;
71
71
  value: _$zod.ZodType<string | number | Ref | ComposedValue, unknown, _$zod_v4_core0.$ZodTypeInternals<string | number | Ref | ComposedValue, unknown>>;
72
72
  }, _$zod_v4_core0.$strip>>>;
73
- }, "value" | "overrides"> & {
73
+ utility: _$zod.ZodOptional<_$zod.ZodBoolean>;
74
+ property: _$zod.ZodOptional<_$zod.ZodObject<{
75
+ syntax: _$zod.ZodOptional<_$zod.ZodString>;
76
+ inherits: _$zod.ZodOptional<_$zod.ZodBoolean>;
77
+ }, _$zod_v4_core0.$strict>>;
78
+ cssVariable: _$zod.ZodOptional<_$zod.ZodUnion<readonly [_$zod.ZodString, _$zod.ZodLiteral<false>]>>;
79
+ }, "value" | "property" | "overrides" | "cssVariable"> & {
74
80
  value: _$zod.ZodType<string | number | boolean | Ref | DerivedColor, unknown, _$zod_v4_core0.$ZodTypeInternals<string | number | boolean | Ref | DerivedColor, unknown>>;
75
81
  overrides: _$zod.ZodOptional<SubEntityClass<_$zod.ZodObject<{
76
82
  on: _$zod.ZodType<OverrideCondition, unknown, _$zod_v4_core0.$ZodTypeInternals<OverrideCondition, unknown>>;
@@ -78,7 +84,8 @@ declare const ReactNativeSystemDefinition: ConfigClass<{
78
84
  }, _$zod_v4_core0.$strip>>>;
79
85
  }, _$zod_v4_core0.$strip>, _$zod.ZodObject<Omit<{
80
86
  cssPrefix: _$zod.ZodOptional<_$zod.ZodString>;
81
- }, "cssPrefix"> & {}, _$zod_v4_core0.$strip>, "token", {}, Record<never, never>, false, Record<never, never>, Record<never, never>>;
87
+ cssVariables: _$zod.ZodOptional<_$zod.ZodBoolean>;
88
+ }, "cssPrefix" | "cssVariables"> & {}, _$zod_v4_core0.$strip>, "token", {}, Record<never, never>, false, Record<never, never>, Record<never, never>>;
82
89
  components: ComponentClass;
83
90
  modifiers: NativeModifierClass;
84
91
  styleProps: EntityClass<_$zod.ZodObject<Omit<{
@@ -88,19 +95,24 @@ declare const ReactNativeSystemDefinition: ConfigClass<{
88
95
  classPrefix: _$zod.ZodOptional<_$zod.ZodString>;
89
96
  arbitrary: _$zod.ZodDefault<_$zod.ZodBoolean>;
90
97
  negates: _$zod.ZodDefault<_$zod.ZodBoolean>;
98
+ selector: _$zod.ZodOptional<_$zod.ZodString>;
99
+ alpha: _$zod.ZodOptional<_$zod.ZodString>;
100
+ declarations: _$zod.ZodOptional<_$zod.ZodRecord<_$zod.ZodString, _$zod.ZodUnion<readonly [_$zod.ZodString, _$zod.ZodObject<{
101
+ __ref: _$zod.ZodString;
102
+ }, _$zod_v4_core0.$strip>]>>>;
91
103
  opacityOf: _$zod.ZodOptional<_$zod.ZodLazy<_$zod.ZodType<Ref, unknown, _$zod_v4_core0.$ZodTypeInternals<Ref, unknown>>>>;
92
- }, "values" | "properties" | "classPrefix"> & {
104
+ }, "values" | "alpha" | "properties" | "declarations" | "classPrefix" | "selector"> & {
93
105
  properties: _$zod.ZodArray<_$zod.ZodPipe<_$zod.ZodPipe<_$zod.ZodString, _$zod.ZodTransform<string, string>>, _$zod.ZodEnum<{
94
- filter: "filter";
95
106
  transform: "transform";
96
- position: "position";
107
+ filter: "filter";
108
+ left: "left";
109
+ right: "right";
97
110
  color: "color";
98
111
  inset: "inset";
112
+ position: "position";
99
113
  end: "end";
100
114
  start: "start";
101
115
  bottom: "bottom";
102
- left: "left";
103
- right: "right";
104
116
  top: "top";
105
117
  flex: "flex";
106
118
  cursor: "cursor";
@@ -2,6 +2,7 @@ import { Font } from "../entities/system/Font.js";
2
2
  import { Package } from "../entities/system/Package.js";
3
3
  import { Composite } from "../entities/system/Composite.js";
4
4
  import { File } from "../entities/system/File.js";
5
+ import { NATIVE_CONFIG_NAME } from "./platform.js";
5
6
  import { Component } from "../entities/system/Component.js";
6
7
  import { Icon } from "../entities/system/Icon.js";
7
8
  import { Device } from "../entities/system/Device.js";
@@ -11,7 +12,6 @@ import { registerSchemaMigrations, registeredSchemaMigrations } from "../framewo
11
12
  import { defineConfig } from "../framework/defineConfig.js";
12
13
  import { CanvasRole } from "../entities/system/CanvasRole.js";
13
14
  import { Guidance } from "../entities/system/Guidance.js";
14
- import { NATIVE_CONFIG_NAME } from "./platform.js";
15
15
  import { LinkedSystem } from "../entities/system/LinkedSystem.js";
16
16
  import { settingsAsKindMigration } from "../migrations/20260908171448_settings_as_kind.js";
17
17
  import { visibleStatePointerMigration } from "../migrations/20260908194245_visible_state_pointer.js";
@@ -5,6 +5,7 @@ import { Modifier } from "../entities/system/Modifier.js";
5
5
  import { Settings } from "../entities/system/Settings.js";
6
6
  import { StyleProperty } from "../entities/system/StyleProperty.js";
7
7
  import { File } from "../entities/system/File.js";
8
+ import { WEB_CONFIG_NAME } from "./platform.js";
8
9
  import { Token } from "../entities/system/Token.js";
9
10
  import { Component } from "../entities/system/Component.js";
10
11
  import { Icon } from "../entities/system/Icon.js";
@@ -17,7 +18,6 @@ import { CanvasRole } from "../entities/system/CanvasRole.js";
17
18
  import { GlobalStyle } from "../entities/system/GlobalStyle.js";
18
19
  import { Guidance } from "../entities/system/Guidance.js";
19
20
  import { GuidanceStyle } from "../entities/system/GuidanceStyle.js";
20
- import { WEB_CONFIG_NAME } from "./platform.js";
21
21
  import { LinkedSystem } from "../entities/system/LinkedSystem.js";
22
22
  import { Motion } from "../entities/system/Motion.js";
23
23
  import { loadV1Artifact } from "../migrations/2.0.0/v1-artifact.js";
@@ -53,6 +53,7 @@ import { canvasToolIconsAndDescriptionsMigration } from "../migrations/202609301
53
53
  import { styleRulesAsListMigration } from "../migrations/20261001112308_style_rules_as_list.js";
54
54
  import { motionExitAndElementDuplicateMigration } from "../migrations/20261001130958_motion_exit_and_element_duplicate.js";
55
55
  import { layerStyleAndForwardOpsMigration } from "../migrations/20261001131000_layer_style_and_forward_ops.js";
56
+ import { oklchAndEmitFieldsMigration } from "../migrations/20261001162046_oklch_and_emit_fields.js";
56
57
  const System = defineConfig({
57
58
  name: WEB_CONFIG_NAME,
58
59
  description: "A design system: the values, primitives and compositions an app is built from. A ref is written `{ \"__ref\": \"<kind>:<path>\" }`, so a token is `{ \"__ref\": \"token:<group>/<name>\" }` and a token group is `{ \"__ref\": \"token:<group>\" }`. Build it in this order. Tokens first, in groups by purpose (colors, spacing, radii, type sizes), since everything else names them. Then style properties, each with `values` holding one ref to the token group whose members it accepts (`{ \"__ref\": \"token:color\" }`), so a prop takes token names rather than raw CSS; add a string keyword only for a value no token holds. A style rule's bag holds a prop's values (`\"padding\": \"4\"`, `\"bg\": \"brand\"`), never raw CSS. Then a few primitive components, one layer each, whose props are style properties (a box for layout and surface, a text for type, a pressable for interaction). Then every other component composed from those primitives: its layers name a primitive or an element, its anatomy places them (a node renders a layer, a tag or `Slot` where a slot prop's content lands; `children` is the edge list; `visible` is `{ \"$state\": \"<prop>\" }`; a prop shown in a nested layer is a `forward` route, and `$state` never sits in a node's props), and its style rules set style-property values per layer, keyed by prop values when a variant changes them. Modes (a dark mode is `{ type: \"selector\", value: \".dark\" }`) change token values through a token's `overrides`, so a component never restyles for a mode; modifiers (hover, focus, disabled) name a state, and a style rule applies under one as a `_hover` block inside a layer bag. Composites bundle style values that recur. Last, register canvas roles: the canvas draws with them, one entity per tool (`frame` for the layout primitive, `text` for the text primitive, `image`) whose entries name the components that tool inserts, and a tool whose role is unregistered is disabled. Give each component a `preview` entry under `*` so it shows content, and never write a CSS property name where a style-property name belongs.",
@@ -117,5 +118,6 @@ if (!registeredSchemaMigrations().has(20260930183521)) registerSchemaMigrations(
117
118
  if (!registeredSchemaMigrations().has(20261001112308)) registerSchemaMigrations(styleRulesAsListMigration);
118
119
  if (!registeredSchemaMigrations().has(20261001130958)) registerSchemaMigrations(motionExitAndElementDuplicateMigration);
119
120
  if (!registeredSchemaMigrations().has(20261001131e3)) registerSchemaMigrations(layerStyleAndForwardOpsMigration);
121
+ if (!registeredSchemaMigrations().has(20261001162046)) registerSchemaMigrations(oklchAndEmitFieldsMigration);
120
122
  //#endregion
121
123
  export { System };
@@ -1,4 +1,21 @@
1
+ import { evaluateCalc, isDivide, isMultiply } from "../entities/system/calc.js";
2
+ import { isDerivedColor, isGradient, isOklchColor } from "../entities/system/color.js";
3
+ import { isShadow as isShadow$1 } from "../entities/system/shadow.js";
1
4
  //#region src/css/value-type.ts
5
+ /**
6
+ * What KIND of CSS value a literal is.
7
+ *
8
+ * A token's `type` is an open string it may declare, and most don't — a raw palette is authored as
9
+ * bare hex values with no type at all. Everything that wants to treat a token as a colour (a
10
+ * swatch, a picker, the emitted type augmentation, the AI's catalogue) then has nothing to go on,
11
+ * so the inference lives here: beside the entity, once, rather than re-derived by each surface that
12
+ * needs it.
13
+ *
14
+ * The classification is deliberately shallow. It reads the SHAPE of a literal — a leading `#`, a
15
+ * known unit suffix, a recognised function head — and punts when nothing matches, because a wrong
16
+ * confident answer is worse than none: a cell that decides a value is a colour renders a swatch and
17
+ * a colour picker over something that isn't one.
18
+ */
2
19
  /** Function heads that introduce a colour. */
3
20
  const COLOR_FUNCTIONS = [
4
21
  "rgb(",
@@ -71,6 +88,13 @@ function startsWithAny(value, heads) {
71
88
  * "some string".
72
89
  */
73
90
  function sniffValueType(value) {
91
+ if (isOklchColor(value) || isDerivedColor(value)) return "color";
92
+ if (isGradient(value)) return "gradient";
93
+ if (isShadow$1(value)) return "shadow";
94
+ if (isMultiply(value) || isDivide(value)) {
95
+ const literal = evaluateCalc(value, (part) => typeof part === "object" ? void 0 : part);
96
+ return literal === void 0 ? void 0 : sniffValueType(String(literal));
97
+ }
74
98
  if (typeof value !== "string") return void 0;
75
99
  const trimmed = value.trim().toLowerCase();
76
100
  if (!trimmed) return void 0;
@@ -15,8 +15,8 @@ declare const DocumentationDefinition: EntityClass<z.ZodObject<{
15
15
  uds: "uds";
16
16
  }>>;
17
17
  platform: z.ZodOptional<z.ZodEnum<{
18
- mobile: "mobile";
19
18
  web: "web";
19
+ mobile: "mobile";
20
20
  }>>;
21
21
  }, z.core.$strict>, z.ZodObject<Record<never, never>, z.core.$strip>, "documentation", {
22
22
  readonly search: {
@@ -6,16 +6,16 @@ import { z } from "zod";
6
6
  //#region src/entities/native/NativeStyleProperty.d.ts
7
7
  /** One React Native style key, as RN's own types declare them. */
8
8
  declare const rnStyleKey: z.ZodEnum<{
9
- filter: "filter";
10
9
  transform: "transform";
11
- position: "position";
10
+ filter: "filter";
11
+ left: "left";
12
+ right: "right";
12
13
  color: "color";
13
14
  inset: "inset";
15
+ position: "position";
14
16
  end: "end";
15
17
  start: "start";
16
18
  bottom: "bottom";
17
- left: "left";
18
- right: "right";
19
19
  top: "top";
20
20
  flex: "flex";
21
21
  cursor: "cursor";
@@ -170,19 +170,24 @@ declare const NativeStyleProperty: EntityClass<z.ZodObject<Omit<{
170
170
  classPrefix: z.ZodOptional<z.ZodString>;
171
171
  arbitrary: z.ZodDefault<z.ZodBoolean>;
172
172
  negates: z.ZodDefault<z.ZodBoolean>;
173
+ selector: z.ZodOptional<z.ZodString>;
174
+ alpha: z.ZodOptional<z.ZodString>;
175
+ declarations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
176
+ __ref: z.ZodString;
177
+ }, z.core.$strip>]>>>;
173
178
  opacityOf: z.ZodOptional<z.ZodLazy<z.ZodType<Ref, unknown, z.core.$ZodTypeInternals<Ref, unknown>>>>;
174
- }, "values" | "properties" | "classPrefix"> & {
179
+ }, "values" | "alpha" | "properties" | "declarations" | "classPrefix" | "selector"> & {
175
180
  properties: z.ZodArray<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodEnum<{
176
- filter: "filter";
177
181
  transform: "transform";
178
- position: "position";
182
+ filter: "filter";
183
+ left: "left";
184
+ right: "right";
179
185
  color: "color";
180
186
  inset: "inset";
187
+ position: "position";
181
188
  end: "end";
182
189
  start: "start";
183
190
  bottom: "bottom";
184
- left: "left";
185
- right: "right";
186
191
  top: "top";
187
192
  flex: "flex";
188
193
  cursor: "cursor";
@@ -20,8 +20,29 @@ const NativeStyleProperty = StyleProperty.extend({
20
20
  entityName: "NativeStyleProperty",
21
21
  fields: {
22
22
  properties: z.array(z.string().transform(camelize).pipe(rnStyleKey)),
23
- values: z.array(stylePropValueSchema()).optional(),
24
- classPrefix: null
23
+ values: z.array(stylePropValueSchema()).check((ctx) => {
24
+ ctx.value.forEach((entry, index) => {
25
+ const bag = entry.value;
26
+ if (typeof bag !== "object" || bag === null) return;
27
+ for (const key of Object.keys(bag)) {
28
+ if (!key.startsWith("@")) continue;
29
+ ctx.issues.push({
30
+ code: "custom",
31
+ input: entry,
32
+ path: [
33
+ index,
34
+ "value",
35
+ key
36
+ ],
37
+ message: `\`${key}\` is a CSS at-rule, which React Native has no counterpart for.`
38
+ });
39
+ }
40
+ });
41
+ }).optional(),
42
+ classPrefix: null,
43
+ selector: null,
44
+ declarations: null,
45
+ alpha: null
25
46
  }
26
47
  });
27
48
  //#endregion
@@ -1,9 +1,9 @@
1
1
  import { Ref } from "../../framework/utils/ref-grammar.js";
2
2
  import { Ref as Ref$1 } from "../../framework/utils/refs.js";
3
3
  import { SubEntityClass } from "../../framework/defineSubEntity.js";
4
- import { EntityClass } from "../../framework/defineEntity.js";
5
4
  import { DerivedColor } from "../system/color.js";
6
5
  import { ComposedValue } from "../system/composed-values.js";
6
+ import { EntityClass } from "../../framework/defineEntity.js";
7
7
  import { OverrideCondition } from "../system/Token.js";
8
8
  import { z } from "zod";
9
9
 
@@ -16,7 +16,13 @@ declare const NativeToken: EntityClass<z.ZodObject<Omit<{
16
16
  on: z.ZodType<OverrideCondition, unknown, z.core.$ZodTypeInternals<OverrideCondition, unknown>>;
17
17
  value: z.ZodType<string | number | Ref | ComposedValue, unknown, z.core.$ZodTypeInternals<string | number | Ref | ComposedValue, unknown>>;
18
18
  }, z.core.$strip>>>;
19
- }, "value" | "overrides"> & {
19
+ utility: z.ZodOptional<z.ZodBoolean>;
20
+ property: z.ZodOptional<z.ZodObject<{
21
+ syntax: z.ZodOptional<z.ZodString>;
22
+ inherits: z.ZodOptional<z.ZodBoolean>;
23
+ }, z.core.$strict>>;
24
+ cssVariable: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<false>]>>;
25
+ }, "value" | "property" | "overrides" | "cssVariable"> & {
20
26
  value: z.ZodType<string | number | boolean | Ref | DerivedColor, unknown, z.core.$ZodTypeInternals<string | number | boolean | Ref | DerivedColor, unknown>>;
21
27
  overrides: z.ZodOptional<SubEntityClass<z.ZodObject<{
22
28
  on: z.ZodType<OverrideCondition, unknown, z.core.$ZodTypeInternals<OverrideCondition, unknown>>;
@@ -24,6 +30,7 @@ declare const NativeToken: EntityClass<z.ZodObject<Omit<{
24
30
  }, z.core.$strip>>>;
25
31
  }, z.core.$strip>, z.ZodObject<Omit<{
26
32
  cssPrefix: z.ZodOptional<z.ZodString>;
27
- }, "cssPrefix"> & {}, z.core.$strip>, "token", {}, Record<never, never>, false, Record<never, never>, Record<never, never>>;
33
+ cssVariables: z.ZodOptional<z.ZodBoolean>;
34
+ }, "cssPrefix" | "cssVariables"> & {}, z.core.$strip>, "token", {}, Record<never, never>, false, Record<never, never>, Record<never, never>>;
28
35
  //#endregion
29
36
  export { NativeToken, nativeTokenValue };
@@ -1,5 +1,8 @@
1
- import { derivedColor } from "../system/color.js";
1
+ import { refSchema } from "../../framework/utils/refs.js";
2
+ import { oklchColor } from "../system/color.js";
2
3
  import { Font } from "../system/Font.js";
4
+ import { NATIVE_CONFIG_NAME } from "../../configs/platform.js";
5
+ import { prepareLinkedTokenBody } from "../system/linked-token-values.js";
3
6
  import { Token, defineOverride } from "../system/Token.js";
4
7
  import { z } from "zod";
5
8
  //#region src/entities/native/NativeToken.ts
@@ -26,13 +29,33 @@ const nativeTokenString = z.union([
26
29
  z.literal("transparent"),
27
30
  z.literal("none")
28
31
  ]);
32
+ /** A derived colour whose operands are colours the native theme can flatten: no gradient, at any
33
+ * depth. */
34
+ const nativeDerivedColor = z.lazy(() => z.strictObject({
35
+ op: z.enum([
36
+ "darken",
37
+ "lighten",
38
+ "alpha",
39
+ "mix"
40
+ ]),
41
+ color: nativeColorOperand,
42
+ amount: z.number(),
43
+ with: nativeColorOperand.optional(),
44
+ space: z.string().optional()
45
+ }));
46
+ const nativeColorOperand = z.lazy(() => z.union([
47
+ z.string(),
48
+ refSchema,
49
+ oklchColor,
50
+ nativeDerivedColor
51
+ ]));
29
52
  const nativeTokenValue = z.union([
30
53
  z.number(),
31
54
  z.boolean(),
32
55
  nativeTokenString,
33
56
  Token,
34
57
  Font,
35
- derivedColor
58
+ nativeDerivedColor
36
59
  ]);
37
60
  /** `Token`'s Override over the native value domain: the same condition and the same derived key. */
38
61
  const NativeOverride = defineOverride(nativeTokenValue);
@@ -40,10 +63,22 @@ const NativeToken = Token.extend({
40
63
  entityName: "NativeToken",
41
64
  fields: {
42
65
  value: nativeTokenValue,
43
- overrides: NativeOverride.optional()
66
+ overrides: NativeOverride.optional(),
67
+ cssVariable: null,
68
+ property: null
44
69
  },
45
70
  subEntities: { overrides: NativeOverride },
46
- groupFields: { cssPrefix: null }
71
+ groupFields: {
72
+ cssPrefix: null,
73
+ cssVariables: null
74
+ },
75
+ prepareLinkedBody: ({ path, body, source, config }) => prepareLinkedTokenBody({
76
+ path,
77
+ body,
78
+ source,
79
+ config,
80
+ destinationPlatform: NATIVE_CONFIG_NAME
81
+ })
47
82
  });
48
83
  //#endregion
49
84
  export { NativeToken, nativeTokenValue };
@@ -2,7 +2,7 @@ import { reject, rejectData } from "../../framework/rejection.js";
2
2
  import { canonicalCondition, isRef, kindOf, memberRef, pathOf, ref, refLeaf, refSchema, splitRef } from "../../framework/utils/refs.js";
3
3
  import { isPlainObject } from "../../framework/utils/field-path.js";
4
4
  import { pathInput } from "../../framework/schemas.js";
5
- import { derivedColor, gradient } from "./color.js";
5
+ import { derivedColor, gradient, oklchColor } from "./color.js";
6
6
  import { shadowValue } from "./shadow.js";
7
7
  import { defineEntity } from "../../framework/defineEntity.js";
8
8
  import { defineSubEntity, orList } from "../../framework/defineSubEntity.js";
@@ -662,6 +662,7 @@ function styleBagValue({ config, declaration, name = "<prop>", glyphLibraries })
662
662
  const property = pathOf(bound.__ref);
663
663
  return z.union([
664
664
  domain,
665
+ oklchColor,
665
666
  derivedColor,
666
667
  gradient,
667
668
  shadowValue,
@@ -1,6 +1,6 @@
1
+ import { DerivedColor, OklchColor } from "./color.js";
1
2
  import { EntityClass } from "../../framework/defineEntity.js";
2
3
  import { Named } from "../../framework/named.js";
3
- import { DerivedColor } from "./color.js";
4
4
  import { z } from "zod";
5
5
 
6
6
  //#region src/entities/system/GlobalStyle.d.ts
@@ -10,7 +10,7 @@ import { z } from "zod";
10
10
  * cascades into the rule and a mode override reaches it, where a baked `rgba()` would not. */
11
11
  type Declared = string | number | {
12
12
  __ref: string;
13
- } | DerivedColor | {
13
+ } | OklchColor | DerivedColor | {
14
14
  [key: string]: Declared;
15
15
  };
16
16
  declare const GlobalStyleDefinition: EntityClass<z.ZodObject<{
@@ -1,5 +1,5 @@
1
1
  import { refSchema } from "../../framework/utils/refs.js";
2
- import { derivedColor } from "./color.js";
2
+ import { derivedColor, oklchColor } from "./color.js";
3
3
  import { defineEntity } from "../../framework/defineEntity.js";
4
4
  import { z } from "zod";
5
5
  //#region src/entities/system/GlobalStyle.ts
@@ -23,6 +23,7 @@ const declared = z.lazy(() => z.union([
23
23
  z.string(),
24
24
  z.number(),
25
25
  refSchema,
26
+ oklchColor,
26
27
  derivedColor,
27
28
  z.record(z.string(), declared)
28
29
  ]));
@@ -41,11 +41,13 @@ type ModifierGroupMeta = z.infer<typeof modifierGroupFields> & {
41
41
  };
42
42
  declare const ModifierDefinition: EntityClass<z.ZodObject<{
43
43
  type: z.ZodEnum<{
44
- composite: "composite";
45
44
  selector: "selector";
45
+ composite: "composite";
46
46
  "media-query": "media-query";
47
47
  }>;
48
48
  value: z.ZodUnion<readonly [z.ZodString, z.ZodLazy<CompositeClass>]>;
49
+ media: z.ZodOptional<z.ZodString>;
50
+ declarations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
49
51
  }, z.core.$strip>, z.ZodObject<{
50
52
  type: z.ZodOptional<z.ZodEnum<{
51
53
  mode: "mode";
@@ -36,7 +36,9 @@ const Modifier = defineEntity({
36
36
  kind: "modifier",
37
37
  fields: z.object({
38
38
  type: z.enum(WEB_ACTIVATIONS).describe("How the modifier activates, such as `selector` or `media`."),
39
- value: z.union([z.string(), z.lazy(() => Composite)]).describe("The selector or query it activates on, or a composite ref.")
39
+ value: z.union([z.string(), z.lazy(() => Composite)]).describe("The selector or query it activates on, or a composite ref."),
40
+ media: z.string().min(1).optional().describe("A media query a selector modifier also needs, as `hover` applies only under `(hover: hover)` so a tap on a touch screen does not leave it stuck."),
41
+ declarations: z.record(z.string(), z.string()).optional().describe("Declarations every rule under the modifier sets first, as `before` sets `content: var(--tw-content)` so the pseudo-element renders.")
40
42
  }).check((ctx) => {
41
43
  const { type, value } = ctx.value;
42
44
  const wantsRef = type === "composite";
@@ -60,6 +60,14 @@ declare function cssPrefixes(value: CssPrefix | undefined): {
60
60
  classNames: string;
61
61
  variables: string;
62
62
  };
63
+ /** `name` under a prefix — `uds-flex`, or `flex` when the prefix is empty. */
64
+ declare function prefixed({
65
+ prefix,
66
+ name
67
+ }: {
68
+ readonly prefix: string;
69
+ readonly name: string;
70
+ }): string;
63
71
  /**
64
72
  * The prefix on every emitted class (`uds`). Shared with codegen, which builds class names that must
65
73
  * agree with the ones the projections produce.
@@ -123,4 +131,4 @@ declare const SettingsDefinition: EntityClass<z.ZodObject<{
123
131
  interface SettingsClass extends Named<typeof SettingsDefinition> {}
124
132
  declare const Settings: SettingsClass;
125
133
  //#endregion
126
- export { BuildSection, BuildSectionClass, CSS_DEFAULTS, CssPrefix, CssSection, CssSectionClass, PLAYGROUND_DEFAULTS, PlaygroundSection, PlaygroundSectionClass, Settings, SettingsClass, SystemSection, SystemSectionClass, classPrefixOf, cssPrefixes, varPrefixOf };
134
+ export { BuildSection, BuildSectionClass, CSS_DEFAULTS, CssPrefix, CssSection, CssSectionClass, PLAYGROUND_DEFAULTS, PlaygroundSection, PlaygroundSectionClass, Settings, SettingsClass, SystemSection, SystemSectionClass, classPrefixOf, cssPrefixes, prefixed, varPrefixOf };
@@ -96,7 +96,7 @@ const cssFields = z.strictObject({
96
96
  /** The files the app's stylesheet is shaken against, as globs from the config's directory. */
97
97
  content: z.array(z.string().min(1)).meta({
98
98
  title: "Content",
99
- description: "The files the build reads for the classes an app uses, as globs relative to the config's directory: `src/**/*.{ts,tsx}`, `app/**/*.tsx`, or a prebuilt package's output such as `node_modules/@acme/widgets/dist/**/*.{js,mjs}`. `.ts`, `.tsx`, `.js`, `.jsx`, `.mjs` and `.cjs` files are read, compiled JSX included. Set, it replaces the default. Unset, `src/**/*.{ts,tsx}`.",
99
+ description: "The files the build reads for the classes an app uses, as globs relative to the config's directory: `src/**/*.{ts,tsx}`, `app/**/*.tsx`, or a prebuilt package's output such as `node_modules/@acme/widgets/dist/**/*.{js,mjs}`. `.ts`, `.tsx`, `.js`, `.jsx`, `.mjs` and `.cjs` files are read for the components they render, compiled JSX included, and every file a glob names — `.html`, `.vue`, `.md` and the rest — for the classes its text spells, as in `class=\"md:flex\"`. Set, it replaces the default. Unset, `src/**/*.{ts,tsx}`.",
100
100
  default: ["src/**/*.{ts,tsx}"]
101
101
  }).optional(),
102
102
  /** What the stylesheet keeps whether or not a scanned file uses it — for a value built at runtime,
@@ -124,6 +124,10 @@ function cssPrefixes(value) {
124
124
  };
125
125
  return value;
126
126
  }
127
+ /** `name` under a prefix — `uds-flex`, or `flex` when the prefix is empty. */
128
+ function prefixed({ prefix, name }) {
129
+ return prefix ? `${prefix}-${name}` : name;
130
+ }
127
131
  /**
128
132
  * The prefix on every emitted class (`uds`). Shared with codegen, which builds class names that must
129
133
  * agree with the ones the projections produce.
@@ -246,4 +250,4 @@ const Settings = defineEntity({
246
250
  inputDir: ({ member, config }) => resolveInputDir(member.build) ?? derivedInputDir(config) }
247
251
  });
248
252
  //#endregion
249
- export { BuildSection, CSS_DEFAULTS, CssSection, PLAYGROUND_DEFAULTS, PlaygroundSection, Settings, SystemSection, classPrefixOf, cssPrefixes, varPrefixOf };
253
+ export { BuildSection, CSS_DEFAULTS, CssSection, PLAYGROUND_DEFAULTS, PlaygroundSection, Settings, SystemSection, classPrefixOf, cssPrefixes, prefixed, varPrefixOf };