@yahoo/uds-create-config 5.42.0 → 5.42.2

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.
@@ -1,7 +1,7 @@
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";
4
+ import { DerivedColor, Gradient } from "../entities/system/color.js";
5
5
  import { ComposedValue } from "../entities/system/composed-values.js";
6
6
  import { EntityClass } from "../framework/defineEntity.js";
7
7
  import { ConfigClass } from "../framework/defineConfig.js";
@@ -90,13 +90,13 @@ declare const ReactNativeSystemDefinition: ConfigClass<{
90
90
  }, _$zod_v4_core0.$strict>>;
91
91
  cssVariable: _$zod.ZodOptional<_$zod.ZodUnion<readonly [_$zod.ZodString, _$zod.ZodLiteral<false>]>>;
92
92
  }, "value" | "overrides" | "property" | "cssVariable"> & {
93
- value: _$zod.ZodType<string | number | boolean | Ref | DerivedColor | {
93
+ value: _$zod.ZodType<string | number | boolean | Ref | DerivedColor | Gradient | {
94
94
  flexGrow: number;
95
95
  flexShrink: number;
96
96
  flexBasis: string | number;
97
97
  } | {
98
98
  fontSizeMultiplier: number;
99
- }, unknown, _$zod_v4_core0.$ZodTypeInternals<string | number | boolean | Ref | DerivedColor | {
99
+ }, unknown, _$zod_v4_core0.$ZodTypeInternals<string | number | boolean | Ref | DerivedColor | Gradient | {
100
100
  flexGrow: number;
101
101
  flexShrink: number;
102
102
  flexBasis: string | number;
@@ -105,13 +105,13 @@ declare const ReactNativeSystemDefinition: ConfigClass<{
105
105
  }, unknown>>;
106
106
  overrides: _$zod.ZodOptional<_$zod.ZodUnion<readonly [_$zod.ZodPipe<_$zod.ZodArray<_$zod.ZodObject<{
107
107
  on: _$zod.ZodType<OverrideCondition, unknown, _$zod_v4_core0.$ZodTypeInternals<OverrideCondition, unknown>>;
108
- value: _$zod.ZodType<string | number | boolean | Ref | DerivedColor | {
108
+ value: _$zod.ZodType<string | number | boolean | Ref | DerivedColor | Gradient | {
109
109
  flexGrow: number;
110
110
  flexShrink: number;
111
111
  flexBasis: string | number;
112
112
  } | {
113
113
  fontSizeMultiplier: number;
114
- }, unknown, _$zod_v4_core0.$ZodTypeInternals<string | number | boolean | Ref | DerivedColor | {
114
+ }, unknown, _$zod_v4_core0.$ZodTypeInternals<string | number | boolean | Ref | DerivedColor | Gradient | {
115
115
  flexGrow: number;
116
116
  flexShrink: number;
117
117
  flexBasis: string | number;
@@ -120,7 +120,7 @@ declare const ReactNativeSystemDefinition: ConfigClass<{
120
120
  }, unknown>>;
121
121
  }, _$zod_v4_core0.$strip>>, _$zod.ZodTransform<Record<string, {
122
122
  on: OverrideCondition;
123
- value: string | number | boolean | Ref | DerivedColor | {
123
+ value: string | number | boolean | Ref | DerivedColor | Gradient | {
124
124
  flexGrow: number;
125
125
  flexShrink: number;
126
126
  flexBasis: string | number;
@@ -129,7 +129,7 @@ declare const ReactNativeSystemDefinition: ConfigClass<{
129
129
  };
130
130
  }>, {
131
131
  on: OverrideCondition;
132
- value: string | number | boolean | Ref | DerivedColor | {
132
+ value: string | number | boolean | Ref | DerivedColor | Gradient | {
133
133
  flexGrow: number;
134
134
  flexShrink: number;
135
135
  flexBasis: string | number;
@@ -138,13 +138,13 @@ declare const ReactNativeSystemDefinition: ConfigClass<{
138
138
  };
139
139
  }[]>>, SubEntityClass<_$zod.ZodObject<{
140
140
  on: _$zod.ZodType<OverrideCondition, unknown, _$zod_v4_core0.$ZodTypeInternals<OverrideCondition, unknown>>;
141
- value: _$zod.ZodType<string | number | boolean | Ref | DerivedColor | {
141
+ value: _$zod.ZodType<string | number | boolean | Ref | DerivedColor | Gradient | {
142
142
  flexGrow: number;
143
143
  flexShrink: number;
144
144
  flexBasis: string | number;
145
145
  } | {
146
146
  fontSizeMultiplier: number;
147
- }, unknown, _$zod_v4_core0.$ZodTypeInternals<string | number | boolean | Ref | DerivedColor | {
147
+ }, unknown, _$zod_v4_core0.$ZodTypeInternals<string | number | boolean | Ref | DerivedColor | Gradient | {
148
148
  flexGrow: number;
149
149
  flexShrink: number;
150
150
  flexBasis: string | number;
@@ -23,6 +23,7 @@ import { motionTypeOnlyMigration } from "../migrations/20261016135620_motion_typ
23
23
  import { motionCompatibilityMigration } from "../migrations/20261016164316_motion_compatibility.js";
24
24
  import { nativeStyleArraysAndAutoMigration } from "../migrations/20261016201727_native_style_arrays_and_auto.js";
25
25
  import { buildExcludeMigration } from "../migrations/20261019165323_build_exclude.js";
26
+ import { nativeLinearGradientsMigration } from "../migrations/20261020173914_native_linear_gradients.js";
26
27
  import { CanvasRole } from "../entities/system/CanvasRole.js";
27
28
  import { GlobalStyle } from "../entities/system/GlobalStyle.js";
28
29
  import { Guidance } from "../entities/system/Guidance.js";
@@ -177,5 +178,6 @@ if (!registeredSchemaMigrations().has(20261015202345)) registerSchemaMigrations(
177
178
  if (!registeredSchemaMigrations().has(20261016164316)) registerSchemaMigrations(motionCompatibilityMigration);
178
179
  if (!registeredSchemaMigrations().has(20261016201727)) registerSchemaMigrations(nativeStyleArraysAndAutoMigration);
179
180
  if (!registeredSchemaMigrations().has(20261019165323)) registerSchemaMigrations(buildExcludeMigration);
181
+ if (!registeredSchemaMigrations().has(20261020173914)) registerSchemaMigrations(nativeLinearGradientsMigration);
180
182
  //#endregion
181
183
  export { System };
@@ -1,7 +1,7 @@
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 { DerivedColor } from "../system/color.js";
4
+ import { DerivedColor, Gradient } from "../system/color.js";
5
5
  import { ComposedValue } from "../system/composed-values.js";
6
6
  import { EntityClass } from "../../framework/defineEntity.js";
7
7
  import { OverrideCondition } from "../system/Token.js";
@@ -10,7 +10,7 @@ import { RelativeLineHeightValue } from "../system/linked-line-height-values.js"
10
10
  import { z } from "zod";
11
11
 
12
12
  //#region src/entities/native/NativeToken.d.ts
13
- declare const nativeTokenValue: z.ZodType<number | boolean | string | Ref$1 | DerivedColor | NativeFlexValue | RelativeLineHeightValue>;
13
+ declare const nativeTokenValue: z.ZodType<number | boolean | string | Ref$1 | DerivedColor | Gradient | NativeFlexValue | RelativeLineHeightValue>;
14
14
  declare const NativeToken: EntityClass<z.ZodObject<Omit<{
15
15
  value: z.ZodType<string | number | Ref | ComposedValue, unknown, z.core.$ZodTypeInternals<string | number | Ref | ComposedValue, unknown>>;
16
16
  type: z.ZodOptional<z.ZodString>;
@@ -34,13 +34,13 @@ declare const NativeToken: EntityClass<z.ZodObject<Omit<{
34
34
  }, z.core.$strict>>;
35
35
  cssVariable: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<false>]>>;
36
36
  }, "value" | "overrides" | "property" | "cssVariable"> & {
37
- value: z.ZodType<string | number | boolean | Ref | DerivedColor | {
37
+ value: z.ZodType<string | number | boolean | Ref | DerivedColor | Gradient | {
38
38
  flexGrow: number;
39
39
  flexShrink: number;
40
40
  flexBasis: string | number;
41
41
  } | {
42
42
  fontSizeMultiplier: number;
43
- }, unknown, z.core.$ZodTypeInternals<string | number | boolean | Ref | DerivedColor | {
43
+ }, unknown, z.core.$ZodTypeInternals<string | number | boolean | Ref | DerivedColor | Gradient | {
44
44
  flexGrow: number;
45
45
  flexShrink: number;
46
46
  flexBasis: string | number;
@@ -49,13 +49,13 @@ declare const NativeToken: EntityClass<z.ZodObject<Omit<{
49
49
  }, unknown>>;
50
50
  overrides: z.ZodOptional<z.ZodUnion<readonly [z.ZodPipe<z.ZodArray<z.ZodObject<{
51
51
  on: z.ZodType<OverrideCondition, unknown, z.core.$ZodTypeInternals<OverrideCondition, unknown>>;
52
- value: z.ZodType<string | number | boolean | Ref | DerivedColor | {
52
+ value: z.ZodType<string | number | boolean | Ref | DerivedColor | Gradient | {
53
53
  flexGrow: number;
54
54
  flexShrink: number;
55
55
  flexBasis: string | number;
56
56
  } | {
57
57
  fontSizeMultiplier: number;
58
- }, unknown, z.core.$ZodTypeInternals<string | number | boolean | Ref | DerivedColor | {
58
+ }, unknown, z.core.$ZodTypeInternals<string | number | boolean | Ref | DerivedColor | Gradient | {
59
59
  flexGrow: number;
60
60
  flexShrink: number;
61
61
  flexBasis: string | number;
@@ -64,7 +64,7 @@ declare const NativeToken: EntityClass<z.ZodObject<Omit<{
64
64
  }, unknown>>;
65
65
  }, z.core.$strip>>, z.ZodTransform<Record<string, {
66
66
  on: OverrideCondition;
67
- value: string | number | boolean | Ref | DerivedColor | {
67
+ value: string | number | boolean | Ref | DerivedColor | Gradient | {
68
68
  flexGrow: number;
69
69
  flexShrink: number;
70
70
  flexBasis: string | number;
@@ -73,7 +73,7 @@ declare const NativeToken: EntityClass<z.ZodObject<Omit<{
73
73
  };
74
74
  }>, {
75
75
  on: OverrideCondition;
76
- value: string | number | boolean | Ref | DerivedColor | {
76
+ value: string | number | boolean | Ref | DerivedColor | Gradient | {
77
77
  flexGrow: number;
78
78
  flexShrink: number;
79
79
  flexBasis: string | number;
@@ -82,13 +82,13 @@ declare const NativeToken: EntityClass<z.ZodObject<Omit<{
82
82
  };
83
83
  }[]>>, SubEntityClass<z.ZodObject<{
84
84
  on: z.ZodType<OverrideCondition, unknown, z.core.$ZodTypeInternals<OverrideCondition, unknown>>;
85
- value: z.ZodType<string | number | boolean | Ref | DerivedColor | {
85
+ value: z.ZodType<string | number | boolean | Ref | DerivedColor | Gradient | {
86
86
  flexGrow: number;
87
87
  flexShrink: number;
88
88
  flexBasis: string | number;
89
89
  } | {
90
90
  fontSizeMultiplier: number;
91
- }, unknown, z.core.$ZodTypeInternals<string | number | boolean | Ref | DerivedColor | {
91
+ }, unknown, z.core.$ZodTypeInternals<string | number | boolean | Ref | DerivedColor | Gradient | {
92
92
  flexGrow: number;
93
93
  flexShrink: number;
94
94
  flexBasis: string | number;
@@ -15,7 +15,7 @@ import { z } from "zod";
15
15
  * (`'45deg'`, `'50%'`, a hex or RGB color, `'transparent'`), an alias to another token, a font-family
16
16
  * ref, a derived color (`mix()`/`alpha()` resolve to a concrete color, so they carry), or explicit
17
17
  * native flex declarations (a linked shorthand needs all three longhands), or a relative line
18
- * height resolved against the destination text layer's font size. What
18
+ * height resolved against the destination text layer's font size, or a structured linear gradient. What
19
19
  * deliberately does not validate is web's open string arm — `'1rem'`, `calc(…)`, `'50vh'` mean
20
20
  * nothing off the web, and refusing them here is the platform model: the config is the platform,
21
21
  * so a native config cannot hold a web value.
@@ -58,6 +58,16 @@ const nativeColorOperand = z.lazy(() => z.union([
58
58
  oklchColor,
59
59
  nativeDerivedColor
60
60
  ]));
61
+ /** Linear gradient stops remain structured so token aliases and modes resolve at build time. */
62
+ const nativeGradient = z.strictObject({
63
+ gradient: z.literal("linear"),
64
+ angle: z.string().optional(),
65
+ stops: z.array(z.strictObject({
66
+ color: nativeColorOperand,
67
+ at: z.string().optional()
68
+ })),
69
+ repeating: z.literal(false).optional()
70
+ });
61
71
  const nativeTokenValue = z.union([
62
72
  z.number(),
63
73
  z.boolean(),
@@ -65,6 +75,7 @@ const nativeTokenValue = z.union([
65
75
  Token,
66
76
  Font,
67
77
  nativeDerivedColor,
78
+ nativeGradient,
68
79
  nativeFlexValue,
69
80
  relativeLineHeightValue
70
81
  ]);
@@ -3,7 +3,7 @@ import { isRef, pathOf } from "../../framework/utils/refs.js";
3
3
  import { isNativeFlexValue, nativeFlexToWeb, webFlexToNative } from "./linked-flex-values.js";
4
4
  import { isRelativeLineHeightValue, nativeLineHeightToWeb, webLineHeightToNative } from "./linked-line-height-values.js";
5
5
  import { rootFontSize } from "./token-values.js";
6
- import { stylePropEntries, stylePropertyPathFor } from "../../framework/projections.js";
6
+ import { stylePropEntries, stylePropTokenPath, stylePropertyPathFor } from "../../framework/projections.js";
7
7
  //#region src/entities/system/linked-style-values.ts
8
8
  /** Translate inherited literals before merging the destination's own style overrides. Refs keep
9
9
  * their identity: the linked-token adapter handles their values and mode overrides. */
@@ -28,6 +28,7 @@ function translateLinkedStyleBags({ body, source, config, bags, owner }) {
28
28
  "flexShrink",
29
29
  "lineHeight"
30
30
  ].includes(property)) return [key, raw];
31
+ if (typeof raw === "string" && stylePropTokenPath(source, propPath, raw)) return [key, raw];
31
32
  const alias = stylePropEntries(source, propPath).find((entry) => entry.leaf === String(raw));
32
33
  if (alias?.declarations) return [key, raw];
33
34
  const resolved = alias ? alias.numeric && /^(?:\d+(?:\.\d+)?|\.\d+)$/.test(alias.value) ? Number(alias.value) : alias.value : raw;
@@ -73,7 +73,7 @@ interface RecordedSource {
73
73
  * The dense-counter `2` a short-lived scheme stamped before the chain existed reads as the mint
74
74
  * that replaced it (see `detectedWireVersion`).
75
75
  */
76
- declare const SERIALIZED_CONFIG_VERSION = 20261019165323;
76
+ declare const SERIALIZED_CONFIG_VERSION = 20261020173914;
77
77
  interface SerializedConfig {
78
78
  /** See {@link SERIALIZED_CONFIG_VERSION}. Always written; a stored artifact may lack it. */
79
79
  readonly version: number;
@@ -5862,7 +5862,7 @@ var Config = class Config {
5862
5862
  * links from the provided sources. A declared `linkedKind` with no provided source throws. */
5863
5863
  hydrateFrom(stored, options) {
5864
5864
  const claimed = schemaVersionOf(stored);
5865
- if (claimed > 20261019165323) throw new SchemaVersionTooNew(claimed);
5865
+ if (claimed > 20261020173914) throw new SchemaVersionTooNew(claimed);
5866
5866
  const wire = upgradeSerializedConfig(stored);
5867
5867
  if (!Array.isArray(wire.ownedKinds) || typeof wire.items !== "object" || wire.items === null) throw new ConfigFormatError(`Config "${stored.name ?? "system-config"}" cannot be hydrated: this is not a serialized config-v2 config (no "ownedKinds"/"items"). A pre-cutover build artifact converts through the registered cutover migration — import the config type's module (e.g. \`configs/system\`) before hydrating.`);
5868
5868
  const leftover = wire.options;
@@ -15,7 +15,7 @@ import { Patch, SerializedConfig } from "./Config.js";
15
15
  * sets this constant to its own older timestamp; the merge ref then carries a registered migration
16
16
  * newer than the constant, and the assertion fails until the author re-mints.
17
17
  */
18
- declare const CURRENT_SCHEMA_VERSION = 20261019165323;
18
+ declare const CURRENT_SCHEMA_VERSION = 20261020173914;
19
19
  /** What the walkers need to see of an envelope — loose on purpose, so a typed `SerializedConfig`
20
20
  * and a raw old-shape record both flow in without casts. */
21
21
  interface VersionStamped {
@@ -13,7 +13,7 @@ import { ConfigFormatError } from "./rejection.js";
13
13
  * sets this constant to its own older timestamp; the merge ref then carries a registered migration
14
14
  * newer than the constant, and the assertion fails until the author re-mints.
15
15
  */
16
- const CURRENT_SCHEMA_VERSION = 20261019165323;
16
+ const CURRENT_SCHEMA_VERSION = 20261020173914;
17
17
  /** The mint that moved `options` into the `settings` kind — restated here, rather than imported
18
18
  * from the migration that owns it, because that migration imports this module. */
19
19
  const SETTINGS_AS_KIND_VERSION = 20260908171448;
@@ -45,7 +45,7 @@ function registerSchemaMigrations(...migrations) {
45
45
  for (const migration of migrations) {
46
46
  if (migration.version !== 1 && !isMintTimestamp(migration.version)) throw new Error(`Schema migration version ${migration.version} is not a mint timestamp — mint one with \`date +%Y%m%d%H%M%S\`, like a supabase migration.`);
47
47
  if (REGISTERED.has(migration.version)) throw new Error(`A schema migration at version ${migration.version} is already registered.`);
48
- if (migration.version > 20261019165323) throw new Error(`Schema migration ${migration.version} is newer than CURRENT_SCHEMA_VERSION (${CURRENT_SCHEMA_VERSION}) — a stale branch merged, or the mint forgot to bump the constant. Re-mint: set CURRENT_SCHEMA_VERSION to the newest migration version.`);
48
+ if (migration.version > 20261020173914) throw new Error(`Schema migration ${migration.version} is newer than CURRENT_SCHEMA_VERSION (${CURRENT_SCHEMA_VERSION}) — a stale branch merged, or the mint forgot to bump the constant. Re-mint: set CURRENT_SCHEMA_VERSION to the newest migration version.`);
49
49
  REGISTERED.set(migration.version, migration);
50
50
  }
51
51
  }
@@ -102,7 +102,7 @@ function pendingFor(version, target, options) {
102
102
  * Already-current input passes through untouched — same reference, so hot paths pay nothing.
103
103
  */
104
104
  function upgradeSerializedConfig(json, options) {
105
- const target = options?.target ?? 20261019165323;
105
+ const target = options?.target ?? 20261020173914;
106
106
  const version = detectedWireVersion(json);
107
107
  if (version > target) throw new SchemaVersionTooNew(version, target);
108
108
  const raw = json;
@@ -160,7 +160,7 @@ function upgradedSources(json, options) {
160
160
  * meaning under the current schema and replay skips it — reported by the caller, not swallowed here.
161
161
  */
162
162
  function upgradePatch(patch, writtenAt, options) {
163
- const target = options?.target ?? 20261019165323;
163
+ const target = options?.target ?? 20261020173914;
164
164
  if (writtenAt > target) throw new SchemaVersionTooNew(writtenAt, target);
165
165
  let current = patch;
166
166
  for (const migration of pendingFor(writtenAt, target, options)) {
@@ -179,7 +179,7 @@ function upgradePatch(patch, writtenAt, options) {
179
179
  * stamp would cause.
180
180
  */
181
181
  function upgradeDraftEntries(draft, options) {
182
- const target = options?.target ?? 20261019165323;
182
+ const target = options?.target ?? 20261020173914;
183
183
  const entries = [];
184
184
  const held = [];
185
185
  const retired = [];
@@ -0,0 +1,5 @@
1
+ /** Adds structured native linear gradients. Existing bodies and patches are unchanged.
2
+ * Retire once no supported reader needs to upgrade a pre-gradient schema stamp. */
3
+ import type { SchemaMigration } from '../framework/schema-version';
4
+ export declare const NATIVE_LINEAR_GRADIENTS_VERSION = 20261020173914;
5
+ export declare const nativeLinearGradientsMigration: SchemaMigration;
@@ -0,0 +1,10 @@
1
+ //#region src/migrations/20261020173914_native_linear_gradients.ts
2
+ const NATIVE_LINEAR_GRADIENTS_VERSION = 20261020173914;
3
+ const nativeLinearGradientsMigration = {
4
+ version: NATIVE_LINEAR_GRADIENTS_VERSION,
5
+ up(json) {
6
+ return json;
7
+ }
8
+ };
9
+ //#endregion
10
+ export { NATIVE_LINEAR_GRADIENTS_VERSION, nativeLinearGradientsMigration };