@yahoo/uds-create-config 4.23.3 → 4.24.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.
@@ -16,6 +16,7 @@ import { listSlots, namedSlots, slotHostedBy, slotOf } from "../spec/slot.js";
16
16
  import { cellAt } from "../spec/cell.js";
17
17
  import { instanceAt } from "../spec/instance.js";
18
18
  import { ComposedValue } from "../entities/system/composed-values.js";
19
+ import { DerivedColor } from "../entities/system/color.js";
19
20
  import { StyleValue } from "../entities/system/style-bag.js";
20
21
  import { OverrideCondition, TokenRefPath, TokenReference } from "../entities/system/Token.js";
21
22
  import { ComponentElementBody, ComponentReference, ComponentStyleBody } from "../entities/system/Component.js";
@@ -1667,19 +1668,20 @@ declare const System: ConfigClass<{
1667
1668
  }, Record<never, never>, false, Record<never, never>, Record<never, never>>;
1668
1669
  globalStyles: EntityClass<_$zod.ZodObject<{
1669
1670
  selector: _$zod.ZodString;
1670
- declarations: _$zod.ZodRecord<_$zod.ZodString, _$zod.ZodType<string | number | {
1671
+ declarations: _$zod.ZodRecord<_$zod.ZodString, _$zod.ZodType<string | number | DerivedColor | {
1671
1672
  __ref: string;
1672
1673
  } | {
1673
- [key: string]: string | number | {
1674
+ [key: string]: string | number | DerivedColor | {
1674
1675
  __ref: string;
1675
1676
  } | /*elided*/any;
1676
- }, unknown, _$zod_v4_core0.$ZodTypeInternals<string | number | {
1677
+ }, unknown, _$zod_v4_core0.$ZodTypeInternals<string | number | DerivedColor | {
1677
1678
  __ref: string;
1678
1679
  } | {
1679
- [key: string]: string | number | {
1680
+ [key: string]: string | number | DerivedColor | {
1680
1681
  __ref: string;
1681
1682
  } | /*elided*/any;
1682
1683
  }, unknown>>>;
1684
+ important: _$zod.ZodOptional<_$zod.ZodBoolean>;
1683
1685
  }, _$zod_v4_core0.$strict>, _$zod.ZodObject<Record<never, never>, _$zod_v4_core0.$strip>, "global-style", Record<never, never>, Record<never, never>, false, Record<never, never>, Record<never, never>>;
1684
1686
  devices: EntityClass<_$zod.ZodObject<{
1685
1687
  width: _$zod.ZodNumber;
@@ -3728,19 +3730,20 @@ declare const System: ConfigClass<{
3728
3730
  }, Record<never, never>, false, Record<never, never>, Record<never, never>>;
3729
3731
  globalStyles: EntityClass<_$zod.ZodObject<{
3730
3732
  selector: _$zod.ZodString;
3731
- declarations: _$zod.ZodRecord<_$zod.ZodString, _$zod.ZodType<string | number | {
3733
+ declarations: _$zod.ZodRecord<_$zod.ZodString, _$zod.ZodType<string | number | DerivedColor | {
3732
3734
  __ref: string;
3733
3735
  } | {
3734
- [key: string]: string | number | {
3736
+ [key: string]: string | number | DerivedColor | {
3735
3737
  __ref: string;
3736
3738
  } | /*elided*/any;
3737
- }, unknown, _$zod_v4_core0.$ZodTypeInternals<string | number | {
3739
+ }, unknown, _$zod_v4_core0.$ZodTypeInternals<string | number | DerivedColor | {
3738
3740
  __ref: string;
3739
3741
  } | {
3740
- [key: string]: string | number | {
3742
+ [key: string]: string | number | DerivedColor | {
3741
3743
  __ref: string;
3742
3744
  } | /*elided*/any;
3743
3745
  }, unknown>>>;
3746
+ important: _$zod.ZodOptional<_$zod.ZodBoolean>;
3744
3747
  }, _$zod_v4_core0.$strict>, _$zod.ZodObject<Record<never, never>, _$zod_v4_core0.$strip>, "global-style", Record<never, never>, Record<never, never>, false, Record<never, never>, Record<never, never>>;
3745
3748
  devices: EntityClass<_$zod.ZodObject<{
3746
3749
  width: _$zod.ZodNumber;
@@ -39,6 +39,7 @@ import { iconCanvasToolMigration } from "../migrations/20260923005318_icon_canva
39
39
  import { computedValuesAndRepeatedNodesMigration } from "../migrations/20260923112910_computed_values_and_repeated_nodes.js";
40
40
  import { transitionTokenValueMigration } from "../migrations/20260923144958_transition_token_value.js";
41
41
  import { renderTokenRefsMigration } from "../migrations/20260923160425_render_token_refs.js";
42
+ import { globalStyleDerivedColorsMigration } from "../migrations/20260923163604_global_style_derived_colors.js";
42
43
  //#region src/configs/system.ts
43
44
  /**
44
45
  * `System` — the design-system config TYPE. Declares the exact kinds a design system owns (tokens,
@@ -98,5 +99,6 @@ if (!registeredSchemaMigrations().has(20260923005318)) registerSchemaMigrations(
98
99
  if (!registeredSchemaMigrations().has(20260923112910)) registerSchemaMigrations(computedValuesAndRepeatedNodesMigration);
99
100
  if (!registeredSchemaMigrations().has(20260923144958)) registerSchemaMigrations(transitionTokenValueMigration);
100
101
  if (!registeredSchemaMigrations().has(20260923160425)) registerSchemaMigrations(renderTokenRefsMigration);
102
+ if (!registeredSchemaMigrations().has(20260923163604)) registerSchemaMigrations(globalStyleDerivedColorsMigration);
101
103
  //#endregion
102
104
  export { System };
@@ -1,17 +1,21 @@
1
1
  import { EntityClass } from "../../framework/defineEntity.js";
2
+ import { DerivedColor } from "./color.js";
2
3
  import { z } from "zod";
3
4
 
4
5
  //#region src/entities/system/GlobalStyle.d.ts
5
6
  /** A declared value, or a nested block of them — an at-rule (`@keyframes`) and a grouped selector
6
- * both hold rules rather than declarations, and they nest to any depth. */
7
+ * both hold rules rather than declarations, and they nest to any depth. A derived colour
8
+ * (`alpha(Token.ref('color/on-primary'), 0.2)`) is a value: it keeps its token, so a rename
9
+ * cascades into the rule and a mode override reaches it, where a baked `rgba()` would not. */
7
10
  type Declared = string | number | {
8
11
  __ref: string;
9
- } | {
12
+ } | DerivedColor | {
10
13
  [key: string]: Declared;
11
14
  };
12
15
  declare const GlobalStyle: EntityClass<z.ZodObject<{
13
16
  selector: z.ZodString;
14
17
  declarations: z.ZodRecord<z.ZodString, z.ZodType<Declared, unknown, z.core.$ZodTypeInternals<Declared, unknown>>>;
18
+ important: z.ZodOptional<z.ZodBoolean>;
15
19
  }, z.core.$strict>, z.ZodObject<Record<never, never>, z.core.$strip>, "global-style", Record<never, never>, Record<never, never>, false, Record<never, never>, Record<never, never>>;
16
20
  /**
17
21
  * A stable name for a rule, from its selector — `@keyframes bounce` → `bounce`, `.prompt-editor p`
@@ -1,5 +1,6 @@
1
1
  import { refSchema } from "../../framework/utils/refs.js";
2
2
  import { defineEntity } from "../../framework/defineEntity.js";
3
+ import { derivedColor } from "./color.js";
3
4
  import { z } from "zod";
4
5
  //#region src/entities/system/GlobalStyle.ts
5
6
  /**
@@ -22,6 +23,7 @@ const declared = z.lazy(() => z.union([
22
23
  z.string(),
23
24
  z.number(),
24
25
  refSchema,
26
+ derivedColor,
25
27
  z.record(z.string(), declared)
26
28
  ]));
27
29
  const GlobalStyle = defineEntity({
@@ -32,7 +34,13 @@ const GlobalStyle = defineEntity({
32
34
  /** What the rule applies to — `html, body`, `@keyframes bounce`, `.prompt-editor p`. */
33
35
  selector: z.string(),
34
36
  /** Property → value, camelCase as it's authored; a nested record is a nested rule. */
35
- declarations: z.record(z.string(), declared)
37
+ declarations: z.record(z.string(), declared),
38
+ /**
39
+ * Every declaration in the rule, nested ones included, is emitted `!important`. The sheet is
40
+ * layered and a third party's stylesheet (React Flow, CodeMirror's injected theme) is not, so a
41
+ * rule meant to beat one has to say so; the flag lets it while its values stay refs.
42
+ */
43
+ important: z.boolean().optional()
36
44
  })
37
45
  });
38
46
  /**
@@ -72,7 +72,7 @@ interface RecordedSource {
72
72
  * The dense-counter `2` a short-lived scheme stamped before the chain existed reads as the mint
73
73
  * that replaced it (see `detectedWireVersion`).
74
74
  */
75
- declare const SERIALIZED_CONFIG_VERSION = 20260923160425;
75
+ declare const SERIALIZED_CONFIG_VERSION = 20260923163604;
76
76
  interface SerializedConfig {
77
77
  /** See {@link SERIALIZED_CONFIG_VERSION}. Always written; a stored artifact may lack it. */
78
78
  readonly version: number;
@@ -4883,7 +4883,7 @@ var Config = class Config {
4883
4883
  * links from the provided sources. A declared `linkedKind` with no provided source throws. */
4884
4884
  hydrateFrom(stored, options) {
4885
4885
  const claimed = schemaVersionOf(stored);
4886
- if (claimed > 20260923160425) throw new SchemaVersionTooNew(claimed);
4886
+ if (claimed > 20260923163604) throw new SchemaVersionTooNew(claimed);
4887
4887
  const wire = upgradeSerializedConfig(stored);
4888
4888
  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, or port the repo once with \`uds migrate\`.`);
4889
4889
  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 = 20260923160425;
18
+ declare const CURRENT_SCHEMA_VERSION = 20260923163604;
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 = 20260923160425;
16
+ const CURRENT_SCHEMA_VERSION = 20260923163604;
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 > 20260923160425) 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 > 20260923163604) 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 ?? 20260923160425;
105
+ const target = options?.target ?? 20260923163604;
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 ?? 20260923160425;
163
+ const target = options?.target ?? 20260923163604;
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 ?? 20260923160425;
182
+ const target = options?.target ?? 20260923163604;
183
183
  const entries = [];
184
184
  const held = [];
185
185
  const retired = [];
@@ -16,6 +16,7 @@ import { listSlots, namedSlots, slotHostedBy, slotOf } from "../../spec/slot.js"
16
16
  import { cellAt } from "../../spec/cell.js";
17
17
  import { instanceAt } from "../../spec/instance.js";
18
18
  import { ComposedValue } from "../../entities/system/composed-values.js";
19
+ import { DerivedColor } from "../../entities/system/color.js";
19
20
  import { StyleValue } from "../../entities/system/style-bag.js";
20
21
  import { OverrideCondition, TokenRefPath, TokenReference } from "../../entities/system/Token.js";
21
22
  import { ComponentElementBody, ComponentReference, ComponentStyleBody } from "../../entities/system/Component.js";
@@ -1841,19 +1842,20 @@ declare function loadV1Artifact(studio: V1Artifact, options?: LoadV1Options): Co
1841
1842
  }, Record<never, never>, false, Record<never, never>, Record<never, never>>;
1842
1843
  globalStyles: EntityClass<_$zod.ZodObject<{
1843
1844
  selector: _$zod.ZodString;
1844
- declarations: _$zod.ZodRecord<_$zod.ZodString, _$zod.ZodType<string | number | {
1845
+ declarations: _$zod.ZodRecord<_$zod.ZodString, _$zod.ZodType<string | number | DerivedColor | {
1845
1846
  __ref: string;
1846
1847
  } | {
1847
- [key: string]: string | number | {
1848
+ [key: string]: string | number | DerivedColor | {
1848
1849
  __ref: string;
1849
1850
  } | /*elided*/any;
1850
- }, unknown, _$zod_v4_core0.$ZodTypeInternals<string | number | {
1851
+ }, unknown, _$zod_v4_core0.$ZodTypeInternals<string | number | DerivedColor | {
1851
1852
  __ref: string;
1852
1853
  } | {
1853
- [key: string]: string | number | {
1854
+ [key: string]: string | number | DerivedColor | {
1854
1855
  __ref: string;
1855
1856
  } | /*elided*/any;
1856
1857
  }, unknown>>>;
1858
+ important: _$zod.ZodOptional<_$zod.ZodBoolean>;
1857
1859
  }, _$zod_v4_core0.$strict>, _$zod.ZodObject<Record<never, never>, _$zod_v4_core0.$strip>, "global-style", Record<never, never>, Record<never, never>, false, Record<never, never>, Record<never, never>>;
1858
1860
  devices: EntityClass<_$zod.ZodObject<{
1859
1861
  width: _$zod.ZodNumber;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * A `global-style` declaration may be a derived colour (`alpha(Token.ref('color/on-primary'), 0.2)`),
3
+ * beside a string, a number, a ref or a nested rule, and a rule may carry `important: true`. The wire
4
+ * shape of every stored config is unchanged: a derived colour is an object the previous schema would
5
+ * have read as a nested rule, the flag is a new optional field, and no stored config held either.
6
+ * Additive, so the envelope passes through as it is.
7
+ */
8
+ import type { SchemaMigration } from '../framework/schema-version';
9
+ export declare const GLOBAL_STYLE_DERIVED_COLORS_VERSION = 20260923163604;
10
+ export declare const globalStyleDerivedColorsMigration: SchemaMigration;
@@ -0,0 +1,10 @@
1
+ //#region src/migrations/20260923163604_global_style_derived_colors.ts
2
+ const GLOBAL_STYLE_DERIVED_COLORS_VERSION = 20260923163604;
3
+ const globalStyleDerivedColorsMigration = {
4
+ version: GLOBAL_STYLE_DERIVED_COLORS_VERSION,
5
+ up(json) {
6
+ return json;
7
+ }
8
+ };
9
+ //#endregion
10
+ export { GLOBAL_STYLE_DERIVED_COLORS_VERSION, globalStyleDerivedColorsMigration };