@yahoo/uds-create-config 5.94.4 → 5.94.5

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.
@@ -50,6 +50,7 @@ import { anatomyNodeOverridesMigration } from "../migrations/20261109214535_anat
50
50
  import { computedVisibilityMigration } from "../migrations/20261110145811_computed_visibility.js";
51
51
  import { anatomyNodeStatesMigration } from "../migrations/20261110171151_anatomy_node_states.js";
52
52
  import { nativeLintLocationsMigration } from "../migrations/20261112145536_native_lint_locations.js";
53
+ import { variantBooleansMigration } from "../migrations/20261112154943_variant_booleans.js";
53
54
  import { CanvasRole } from "../entities/system/CanvasRole.js";
54
55
  import { GlobalStyle } from "../entities/system/GlobalStyle.js";
55
56
  import { Guidance } from "../entities/system/Guidance.js";
@@ -236,5 +237,6 @@ if (!registeredSchemaMigrations().has(20261109214535)) registerSchemaMigrations(
236
237
  if (!registeredSchemaMigrations().has(20261110145811)) registerSchemaMigrations(computedVisibilityMigration);
237
238
  if (!registeredSchemaMigrations().has(20261110171151)) registerSchemaMigrations(anatomyNodeStatesMigration);
238
239
  if (!registeredSchemaMigrations().has(20261112145536)) registerSchemaMigrations(nativeLintLocationsMigration);
240
+ if (!registeredSchemaMigrations().has(20261112154943)) registerSchemaMigrations(variantBooleansMigration);
239
241
  //#endregion
240
242
  export { System };
@@ -65,24 +65,27 @@ declare const variantValueFields: z.ZodObject<{
65
65
  label: z.ZodOptional<z.ZodString>;
66
66
  description: z.ZodOptional<z.ZodString>;
67
67
  deprecated: z.ZodOptional<z.ZodBoolean>;
68
+ boolean: z.ZodOptional<z.ZodBoolean>;
68
69
  }, z.core.$strict>;
69
70
  /** One variant value's body, as stored. */
70
71
  type VariantValueBody = z.infer<typeof variantValueFields>;
71
72
  /** A variant prop's own values — name → body, in the order they were declared. */
72
73
  type VariantValues = Record<string, VariantValueBody>;
73
- /** One value in the list form of a variant's values: a bare name, or the name with its body. */
74
- declare const listedVariantValue: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
74
+ /** One value in the list form of a variant's values: a bare name or boolean, or either with its
75
+ * body. A boolean is stored under its name with `boolean: true`. */
76
+ declare const listedVariantValue: z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodObject<{
75
77
  label: z.ZodOptional<z.ZodString>;
76
78
  description: z.ZodOptional<z.ZodString>;
77
79
  deprecated: z.ZodOptional<z.ZodBoolean>;
78
- value: z.ZodString;
80
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>;
79
81
  }, z.core.$strict>]>;
80
- /** One value as the list form writes it — `'sm'`, or `{ value: 'md', label: 'Medium' }`. */
82
+ /** One value as the list form writes it — `'sm'`, `true`, or `{ value: 'md', label: 'Medium' }`. */
81
83
  type ListedVariantValue = z.input<typeof listedVariantValue>;
82
84
  declare const VariantValueDefinition: SubEntityClass<z.ZodObject<{
83
85
  label: z.ZodOptional<z.ZodString>;
84
86
  description: z.ZodOptional<z.ZodString>;
85
87
  deprecated: z.ZodOptional<z.ZodBoolean>;
88
+ boolean: z.ZodOptional<z.ZodBoolean>;
86
89
  }, z.core.$strict>>;
87
90
  interface VariantValueClass extends Named<typeof VariantValueDefinition> {}
88
91
  /** The forms code may fill a slot with beside its own value — the members of {@link SlotCodeForm}. */
@@ -113,19 +116,19 @@ declare const propShapeDefinition: z.ZodDiscriminatedUnion<[z.ZodObject<{
113
116
  }, z.core.$strip>]>>]>>>;
114
117
  }, z.core.$strict>, z.ZodObject<{
115
118
  type: z.ZodLiteral<"variant">;
116
- value: z.ZodUnion<readonly [z.ZodPipe<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
119
+ value: z.ZodUnion<readonly [z.ZodPipe<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodBoolean, z.ZodObject<{
117
120
  label: z.ZodOptional<z.ZodString>;
118
121
  description: z.ZodOptional<z.ZodString>;
119
122
  deprecated: z.ZodOptional<z.ZodBoolean>;
120
- value: z.ZodString;
123
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodBoolean]>;
121
124
  }, z.core.$strict>]>>, z.ZodTransform<{
122
125
  [k: string]: {
123
126
  label?: string | undefined;
124
127
  description?: string | undefined;
125
128
  deprecated?: boolean | undefined;
126
129
  };
127
- }, (string | {
128
- value: string;
130
+ }, (string | boolean | {
131
+ value: string | boolean;
129
132
  label?: string | undefined;
130
133
  description?: string | undefined;
131
134
  deprecated?: boolean | undefined;
@@ -366,10 +366,19 @@ const variantValueFields = z.strictObject({
366
366
  /** Withdrawn from new work, exactly as a component's own `deprecated` is: still valid wherever
367
367
  * it is already used, left out of surfaces that offer values. The alternative to deleting it,
368
368
  * which takes its styling with it. */
369
- deprecated: z.boolean().optional()
369
+ deprecated: z.boolean().optional(),
370
+ /** The member stands for the boolean its name spells, so `true` and `false` are what code passes
371
+ * and a rule tests, beside the variant's other names (`checked`: `true`, `false`,
372
+ * `'indeterminate'`). Only a value named `true` or `false` may carry it. */
373
+ boolean: z.boolean().optional()
370
374
  });
371
- /** One value in the list form of a variant's values: a bare name, or the name with its body. */
372
- const listedVariantValue = z.union([z.string(), variantValueFields.extend({ value: z.string() })]);
375
+ /** One value in the list form of a variant's values: a bare name or boolean, or either with its
376
+ * body. A boolean is stored under its name with `boolean: true`. */
377
+ const listedVariantValue = z.union([
378
+ z.string(),
379
+ z.boolean(),
380
+ variantValueFields.omit({ boolean: true }).extend({ value: z.union([z.string(), z.boolean()]) })
381
+ ]);
373
382
  const VariantValue = defineSubEntity({
374
383
  name: "value",
375
384
  label: "Value",
@@ -383,7 +392,8 @@ const VariantValue = defineSubEntity({
383
392
  "styles",
384
393
  "preview",
385
394
  "defaultPropsWhen"
386
- ]
395
+ ],
396
+ renameRefusal: (member) => member?.boolean ? "it stands for a boolean, which its name spells. Delete it and add the value under its new name instead." : void 0
387
397
  });
388
398
  /**
389
399
  * A variant's domain: the values it owns, a ref that delegates to whatever owns them, or a list of
@@ -403,8 +413,12 @@ const VariantValue = defineSubEntity({
403
413
  const variantDomain = z.union([
404
414
  z.array(listedVariantValue).transform((values) => Object.fromEntries(values.map((entry) => {
405
415
  if (typeof entry === "string") return [entry, {}];
416
+ if (typeof entry === "boolean") return [String(entry), { boolean: true }];
406
417
  const { value, ...body } = entry;
407
- return [value, body];
418
+ return typeof value === "boolean" ? [String(value), {
419
+ ...body,
420
+ boolean: true
421
+ }] : [value, body];
408
422
  }))),
409
423
  z.array(refSchema).min(1),
410
424
  refSchema,
@@ -503,6 +517,23 @@ function propShapeWith(when) {
503
517
  value: variantDomain,
504
518
  required: z.boolean().optional(),
505
519
  when
520
+ }).check((ctx) => {
521
+ const { value } = ctx.value;
522
+ if (typeof value !== "object" || value === null || isRef(value)) return;
523
+ if (Array.isArray(value)) return;
524
+ for (const [name, body] of Object.entries(value)) {
525
+ if (!body?.boolean || name === "true" || name === "false") continue;
526
+ ctx.issues.push({
527
+ code: "custom",
528
+ input: ctx.value,
529
+ path: [
530
+ "value",
531
+ name,
532
+ "boolean"
533
+ ],
534
+ message: `Only a value named \`true\` or \`false\` stands for a boolean; \`${name}\` is a name.`
535
+ });
536
+ }
506
537
  }),
507
538
  z.strictObject({
508
539
  type: z.literal("forward"),
@@ -585,7 +616,7 @@ const PROP_TYPES = [
585
616
  "number",
586
617
  "boolean"
587
618
  ];
588
- const PROP_DESCRIPTION = "What the prop is. A style property the component exposes, `{ \"type\": \"styleProperty\", \"value\": { \"__ref\": \"style-property:<name>\" } }`, which is what a primitive's props mostly are and what makes a style rule's bag key valid on it; a closed set of names a style rule keys on, `{ \"type\": \"variant\", \"value\": [\"sm\", \"lg\"] }`, where a value that carries a label is written in place as `{ \"value\": \"md\", \"label\": \"Medium\" }`; content, `{ \"type\": \"slot\", \"text\": true }`, or a slot whose own value is a library member, `{ \"type\": \"slot\", \"value\": { \"__ref\": \"icon:<library>\" } }`, which code may also fill with the forms it lists under `code` (`[\"node\", \"element\", \"render\"]`); or a plain `string`, `number` or `boolean`. An id no two instances share is `{ \"type\": \"string\", \"uniqueId\": true }`; a prop naming one adds `\"uniqueIdRef\": { \"__ref\": \"component:<path>#props/<id>\" }`, and with both is one per id. `null` hides a prop an inherited layer would expose. A prop that applies only under a condition on a sibling carries `when`, the record a style rule uses: `{ \"type\": \"string\", \"when\": { \"type\": \"color\" } }` shows it for one value, `{ \"when\": { \"type\": [\"default\", \"header\"] } }` for several.";
619
+ const PROP_DESCRIPTION = "What the prop is. A style property the component exposes, `{ \"type\": \"styleProperty\", \"value\": { \"__ref\": \"style-property:<name>\" } }`, which is what a primitive's props mostly are and what makes a style rule's bag key valid on it; a closed set of names a style rule keys on, `{ \"type\": \"variant\", \"value\": [\"sm\", \"lg\"] }`, where a value that carries a label is written in place as `{ \"value\": \"md\", \"label\": \"Medium\" }`, and `true` and `false` may sit beside names (`[true, false, \"indeterminate\"]`); content, `{ \"type\": \"slot\", \"text\": true }`, or a slot whose own value is a library member, `{ \"type\": \"slot\", \"value\": { \"__ref\": \"icon:<library>\" } }`, which code may also fill with the forms it lists under `code` (`[\"node\", \"element\", \"render\"]`); or a plain `string`, `number` or `boolean`. An id no two instances share is `{ \"type\": \"string\", \"uniqueId\": true }`; a prop naming one adds `\"uniqueIdRef\": { \"__ref\": \"component:<path>#props/<id>\" }`, and with both is one per id. `null` hides a prop an inherited layer would expose. A prop that applies only under a condition on a sibling carries `when`, the record a style rule uses: `{ \"type\": \"string\", \"when\": { \"type\": \"color\" } }` shows it for one value, `{ \"when\": { \"type\": [\"default\", \"header\"] } }` for several.";
589
620
  const Prop = defineSubEntity({
590
621
  name: "prop",
591
622
  label: "Prop",
@@ -919,7 +950,7 @@ function conditionValue(prop, declaration, config) {
919
950
  if (scalar) return scalar;
920
951
  const domain = valueSchemaOf(declaration, config);
921
952
  if (!ownsItsValues(declaration)) return domain;
922
- return z.union([domain, refSchema]).transform((value) => isRef(value) ? value : valueRef(prop, String(value)));
953
+ return z.union([domain, refSchema]).transform((value) => isRef(value) || typeof value === "boolean" ? value : valueRef(prop, String(value)));
923
954
  }
924
955
  /** The condition on a STATE: a boolean's `true`/`false`, or one of a variant state's names. A state
925
956
  * has no value members to ref, so a variant's condition is the name itself. */
@@ -364,13 +364,18 @@ type DomainValueOf<V> = V extends readonly {
364
364
  __ref: `icon:${string}`;
365
365
  }[] ? GlyphComponent : V extends readonly Ref$1[] ? string : V extends readonly (infer Member)[] ? Member extends {
366
366
  value: infer Name;
367
- } ? Name : Member : V extends VariantValues ? keyof V & string : V extends {
367
+ } ? Name : Member : V extends VariantValues ? KeyedValueOf<V> : V extends {
368
368
  __ref: `${string}#${string}`;
369
369
  } ? string : V extends {
370
370
  __ref: `icon:${string}`;
371
371
  } ? GlyphComponent : V extends {
372
372
  __ref: `${infer Kind}:${infer Path}`;
373
373
  } ? RegisteredMembers<Kind, Path> : string;
374
+ /** A keyed collection's values: each member's name, or the boolean a `true` or `false` member
375
+ * stands for. */
376
+ type KeyedValueOf<V> = { [K in keyof V & string]: V[K] extends {
377
+ boolean: true;
378
+ } ? K extends 'true' ? true : K extends 'false' ? false : K : K }[keyof V & string];
374
379
  /** A slot's own value: its `value` domain's type where it declares one (a glyph component for an
375
380
  * icon library), else content, which is a `ReactNode` and nothing narrower. */
376
381
  type OwnSlotValue<D, View extends 'render' | 'consumer'> = D extends {
@@ -3,6 +3,7 @@ import { isCssProperty, kebabCase } from "../../css/values.js";
3
3
  import "../../configs/platform.js";
4
4
  import { composedValueSchemas } from "./composed-values.js";
5
5
  import { defineSubEntity } from "../../framework/defineSubEntity.js";
6
+ import { booleanValuesIn } from "../../framework/utils/enumerated.js";
6
7
  import { valueSchemaOf } from "../../framework/value-domain.js";
7
8
  import { glyphMemberRefIn, glyphPackageRef } from "./glyph-identity.js";
8
9
  import { glyphPropsOfBody, isCustomPropertyKey, refListOf, stylePropTokenPath } from "../../framework/projections.js";
@@ -89,7 +90,11 @@ const Style = defineSubEntity({
89
90
  otherwise: value
90
91
  });
91
92
  }
92
- if (declared) return value;
93
+ if (declared) {
94
+ const booleans = [...booleanValuesIn(declared.value)];
95
+ if (declared.type !== "variant" || booleans.length === 0) return value;
96
+ return z.union([z.enum(booleans).transform((name) => name === "true"), value]);
97
+ }
93
98
  if (!config.resolve("style-property", key)) return value;
94
99
  return bound(config, {
95
100
  type: "styleProperty",
@@ -74,7 +74,7 @@ interface RecordedSource {
74
74
  * The dense-counter `2` a short-lived scheme stamped before the chain existed reads as the mint
75
75
  * that replaced it (see `detectedWireVersion`).
76
76
  */
77
- declare const SERIALIZED_CONFIG_VERSION = 20261112145536;
77
+ declare const SERIALIZED_CONFIG_VERSION = 20261112154943;
78
78
  interface SerializedConfig {
79
79
  /** See {@link SERIALIZED_CONFIG_VERSION}. Always written; a stored artifact may lack it. */
80
80
  readonly version: number;
@@ -442,18 +442,26 @@ function storeCollection(def, patch, next) {
442
442
  }
443
443
  /** Drop every member of a declared `orphans` collection that still points at `target` — what a
444
444
  * delete leaves behind when a sibling member exists only to describe the one removed. */
445
- function dropOrphans(sub, def, target, namespace, keyed) {
445
+ function dropOrphans(sub, def, target, namespace, keyed, held) {
446
446
  if (!sub?.orphans?.length) return def;
447
447
  let out = def;
448
448
  for (const field of sub.orphans) {
449
449
  const collection = out[field];
450
450
  if (!isPlainObject(collection)) continue;
451
451
  const keyedFields = Object.entries(keyed?.subEntities[field]?.namesMembersOf ?? {}).filter(([, names]) => names === keyed?.collection).map(([record]) => record);
452
+ const heldFields = Object.entries(held?.subEntities[field]?.namesMembersOf ?? {}).filter(([, names]) => names === held?.collection).map(([record]) => record);
453
+ const holdsLiteral = (value) => typeof value === "boolean" && String(value) === held?.key;
452
454
  const kept = Object.fromEntries(Object.entries(collection).filter(([, member]) => {
453
455
  if (keyed && isPlainObject(member) && keyedFields.some((record) => {
454
456
  const names = member[record];
455
457
  return isPlainObject(names) && Object.hasOwn(names, keyed.key);
456
458
  })) return false;
459
+ if (held && isPlainObject(member) && heldFields.some((record) => {
460
+ const names = member[record];
461
+ if (!isPlainObject(names)) return false;
462
+ const value = names[held.owner];
463
+ return Array.isArray(value) ? value.some(holdsLiteral) : holdsLiteral(value);
464
+ })) return false;
457
465
  const refs = collectRefs(member);
458
466
  if (refs.includes(target)) return false;
459
467
  if (!namespace) return true;
@@ -496,7 +504,9 @@ function renameValueAt(node, path, owner, from, to) {
496
504
  if (head === void 0) return node;
497
505
  if (rest.length === 0) {
498
506
  const record = node[head];
499
- if (!isPlainObject(record) || record[owner] !== from) return node;
507
+ if (!isPlainObject(record)) return node;
508
+ const held = record[owner];
509
+ if (held !== from && !(typeof held === "boolean" && String(held) === from)) return node;
500
510
  const next = { ...record };
501
511
  if (to === void 0) delete next[owner];
502
512
  else next[owner] = to;
@@ -2493,6 +2503,8 @@ var Config = class Config {
2493
2503
  } else if (patch.operation === "sub-rename") {
2494
2504
  if (!(patch.key in collection)) reject("NOT_FOUND", `No ${patch.field}/${patch.key} on ${patch.kind} "${patch.path}"`);
2495
2505
  if (patch.to in collection) reject("ALREADY_EXISTS", `${patch.kind} "${patch.path}" already has ${patch.field}/${patch.to}`);
2506
+ const refusal = sub?.renameRefusal?.(collection[patch.key]);
2507
+ if (refusal) reject("UNSUPPORTED", `Cannot rename ${patch.field}/${patch.key} on ${patch.kind} "${patch.path}": ${refusal}`);
2496
2508
  memberRename = {
2497
2509
  from: memberRef(patch.kind, patch.path, patch.field, patch.key).__ref,
2498
2510
  to: memberRef(patch.kind, patch.path, patch.field, patch.to).__ref
@@ -2530,7 +2542,12 @@ var Config = class Config {
2530
2542
  collection: patch.field,
2531
2543
  key: patch.key,
2532
2544
  subEntities: entry.subEntities
2533
- } : void 0);
2545
+ } : void 0, patch.owner === void 0 ? void 0 : {
2546
+ collection: patch.field.split("/").slice(0, -1).join("/"),
2547
+ owner: patch.owner,
2548
+ key: patch.key,
2549
+ subEntities: entry.subEntities
2550
+ });
2534
2551
  }
2535
2552
  const next = snapshot.withChanges([itemChange(entry, patch.kind, patch.path, def)]);
2536
2553
  if (!memberRename) return next;
@@ -6583,7 +6600,7 @@ var Config = class Config {
6583
6600
  * links from the provided sources. A declared `linkedKind` with no provided source throws. */
6584
6601
  hydrateFrom(stored, options) {
6585
6602
  const claimed = schemaVersionOf(stored);
6586
- if (claimed > 20261112145536) throw new SchemaVersionTooNew(claimed);
6603
+ if (claimed > 20261112154943) throw new SchemaVersionTooNew(claimed);
6587
6604
  const wire = upgradeSerializedConfig(stored);
6588
6605
  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.`);
6589
6606
  const leftover = wire.options;
@@ -112,7 +112,8 @@ type SubEntityClass<F extends z.ZodTypeAny = z.ZodTypeAny> = CollectionSchema<F>
112
112
  * true where the dependent is meaningless without its subject — a layer's deletion does NOT
113
113
  * imply that of the rules targeting it, which have their own other layers to style.
114
114
  */
115
- readonly orphans?: readonly string[]; /** A ref to one member: `Prop.ref('component', 'Pressable', 'gap')`. */
115
+ readonly orphans?: readonly string[]; /** Why a member can't be renamed, for one whose name is its meaning; `undefined` when it can. */
116
+ readonly renameRefusal?: (member: unknown) => string | undefined; /** A ref to one member: `Prop.ref('component', 'Pressable', 'gap')`. */
116
117
  ref(kind: string, path: string, member: string): Ref;
117
118
  /** One member of this collection on `owner` (a path or a ref) — the sub-entity twin of
118
119
  * `Component.get`. A member ref resolves without naming the member twice. `ownerMember` names
@@ -156,6 +157,7 @@ declare function defineSubEntity<F extends z.ZodTypeAny>(spec: {
156
157
  keyedByNameIn?: readonly string[];
157
158
  listedIn?: readonly string[];
158
159
  orphans?: readonly string[];
160
+ renameRefusal?: (member: unknown) => string | undefined;
159
161
  }): SubEntityClass<F>;
160
162
  /**
161
163
  * A collection whose members carry their own identity (`defineSubEntity({ key })`), authored as a
@@ -89,6 +89,7 @@ function defineSubEntity(spec) {
89
89
  keyedByNameIn: spec.keyedByNameIn,
90
90
  listedIn: spec.listedIn,
91
91
  orphans: spec.orphans,
92
+ renameRefusal: spec.renameRefusal,
92
93
  ref: (kind, path, member) => memberRef(kind, path, spec.name, member),
93
94
  get: (config, owner, member, ownerMember) => {
94
95
  if (spec.singleton) return memberOn(config, owner);
@@ -9,7 +9,7 @@ import { createSliceMemo } from "./memo.js";
9
9
  import { drawnMotionName } from "../entities/system/drawn-motion.js";
10
10
  import { fontFamilyStack } from "../entities/system/Font.js";
11
11
  import { classPrefixOf, prefixed, varPrefixOf } from "../entities/system/Settings.js";
12
- import { listedIn } from "./utils/enumerated.js";
12
+ import { listedIn, literalNamed } from "./utils/enumerated.js";
13
13
  import "../entities/system/Modifier.js";
14
14
  import { StyleProperty, leavesOfStylePropValue, numberUnitRefusal } from "../entities/system/StyleProperty.js";
15
15
  import { componentStates } from "./component-states.js";
@@ -2259,6 +2259,7 @@ function propValueFromAxis(config, path, prop, value) {
2259
2259
  const parsed = Number(value);
2260
2260
  return Number.isFinite(parsed) ? parsed : value;
2261
2261
  }
2262
+ if (declared?.type === "variant") return literalNamed(declared.value, value);
2262
2263
  return value;
2263
2264
  }
2264
2265
  /** The `value` a string, number or boolean prop declares as its default, per prop. */
@@ -23,6 +23,9 @@ interface SurfaceVariantProp extends SurfacePropBase {
23
23
  * plain list: its leaves are the group node's own field values, a menu-sized set. Mirrors
24
24
  * {@link SurfaceSlotProp.acceptsIconLibraries}. */
25
25
  readonly iconLibraries?: readonly string[];
26
+ /** The values that stand for a boolean, which a surface writes as `true` or `false` rather than
27
+ * as their names. */
28
+ readonly booleans?: readonly ('true' | 'false')[];
26
29
  }
27
30
  interface SurfaceStylePropertyProp extends SurfacePropBase {
28
31
  readonly kind: 'styleProperty';
@@ -170,7 +173,6 @@ declare function routesContent(config: Config, layers: Readonly<Record<string, u
170
173
  * what a component accepts; a caller with no editor for it can fall back to a generic one.
171
174
  */
172
175
  declare function surfaceProps(config: Config, componentPath: string, /** Forwards already followed, so a routing loop terminates. Internal — callers pass nothing. */
173
-
174
176
  seen?: ReadonlySet<string>): SurfaceProp[];
175
177
  /** One prop by name, or `undefined` when the component doesn't expose it. */
176
178
  declare function surfaceProp(config: Config, componentPath: string, name: string): SurfaceProp | undefined;
@@ -1,5 +1,6 @@
1
1
  import { isRef, kindOf, memberOf, pathOf, refLeaf } from "./utils/refs.js";
2
2
  import { forwardsOf, rootLayerOf } from "../entities/system/element.js";
3
+ import { booleanValuesIn } from "./utils/enumerated.js";
3
4
  import { propValueDomain, refListOf, resolveComponentProps, takenByForward } from "./projections.js";
4
5
  import { layerOfElement, slotHostLayer } from "./slot-host.js";
5
6
  import { Component } from "../entities/system/Component.js";
@@ -321,12 +322,14 @@ function surfaceProps(config, componentPath, seen = /* @__PURE__ */ new Set()) {
321
322
  }
322
323
  if (decl.type === "variant") {
323
324
  const iconLibraries = variantIconLibraries(config, decl.value);
325
+ const booleans = [...booleanValuesIn(decl.value)];
324
326
  props.push(conditioned({
325
327
  name,
326
328
  kind: "variant",
327
329
  required,
328
330
  values: propValueDomain(config, decl)?.leaves ?? [],
329
- ...iconLibraries !== void 0 ? { iconLibraries } : {}
331
+ ...iconLibraries !== void 0 ? { iconLibraries } : {},
332
+ ...booleans.length > 0 ? { booleans } : {}
330
333
  }, when));
331
334
  continue;
332
335
  }
@@ -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 = 20261112145536;
18
+ declare const CURRENT_SCHEMA_VERSION = 20261112154943;
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 = 20261112145536;
16
+ const CURRENT_SCHEMA_VERSION = 20261112154943;
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 > 20261112145536) 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 > 20261112154943) 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 ?? 20261112145536;
105
+ const target = options?.target ?? 20261112154943;
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 ?? 20261112145536;
163
+ const target = options?.target ?? 20261112154943;
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 ?? 20261112145536;
182
+ const target = options?.target ?? 20261112154943;
183
183
  const entries = [];
184
184
  const held = [];
185
185
  const retired = [];
@@ -11,3 +11,9 @@
11
11
  * offers, while `value-domain` already reads `projections` for the ref case.
12
12
  */
13
13
  export declare function listedIn(domain: unknown): string[] | undefined;
14
+ /** The names of a keyed collection's members that stand for a boolean: `true` and `false`, each
15
+ * stored under its own name with `boolean: true` in its body. */
16
+ export declare function booleanValuesIn(domain: unknown): ReadonlySet<'true' | 'false'>;
17
+ /** What code passes for one of a domain's values: the boolean a `true` or `false` member stands for,
18
+ * else the name itself. */
19
+ export declare function literalNamed(domain: unknown, name: string): string | boolean;
@@ -15,5 +15,22 @@ function listedIn(domain) {
15
15
  if (Array.isArray(domain)) return domain.filter((value) => typeof value === "string");
16
16
  return typeof domain === "object" && domain !== null ? Object.keys(domain) : void 0;
17
17
  }
18
+ /** The names of a keyed collection's members that stand for a boolean: `true` and `false`, each
19
+ * stored under its own name with `boolean: true` in its body. */
20
+ function booleanValuesIn(domain) {
21
+ const out = /* @__PURE__ */ new Set();
22
+ if (typeof domain !== "object" || domain === null || Array.isArray(domain)) return out;
23
+ for (const name of ["true", "false"]) {
24
+ const body = domain[name];
25
+ if (typeof body === "object" && body !== null && body.boolean === true) out.add(name);
26
+ }
27
+ return out;
28
+ }
29
+ /** What code passes for one of a domain's values: the boolean a `true` or `false` member stands for,
30
+ * else the name itself. */
31
+ function literalNamed(domain, name) {
32
+ if (name !== "true" && name !== "false") return name;
33
+ return booleanValuesIn(domain).has(name) ? name === "true" : name;
34
+ }
18
35
  //#endregion
19
- export { listedIn };
36
+ export { booleanValuesIn, listedIn, literalNamed };
@@ -1,5 +1,5 @@
1
1
  import { isRef, kindOf, memberOf, pathOf, ref, refSchema } from "./utils/refs.js";
2
- import { listedIn } from "./utils/enumerated.js";
2
+ import { booleanValuesIn, listedIn } from "./utils/enumerated.js";
3
3
  import { bodyNumberLeaves, bodyNumberUnit, memberFromLeaf, memberLeaves, refListOf, stylePropValueFromLeaf, stylePropValueLeaves } from "./projections.js";
4
4
  import { z } from "zod";
5
5
  //#region src/framework/value-domain.ts
@@ -32,6 +32,19 @@ function oneOf(values) {
32
32
  return values.length > 0 ? z.enum(values, { error: () => `one of ${spellValues(values)}` }) : void 0;
33
33
  }
34
34
  /**
35
+ * One of a keyed collection's names. A member that stands for a boolean is the boolean, and its name
36
+ * as a string is taken and stored as the boolean too, since a picker spells every value as a string.
37
+ */
38
+ function listedSchema(domain, listed) {
39
+ const booleans = booleanValuesIn(domain);
40
+ if (booleans.size === 0) return oneOf(listed);
41
+ const names = listed.filter((name) => !booleans.has(name));
42
+ const spelled = [...booleans];
43
+ const forms = [z.literal(spelled.map((name) => name === "true")), z.enum(spelled).transform((name) => name === "true")];
44
+ if (names.length > 0) forms.push(z.enum(names));
45
+ return z.union(forms, { error: () => names.length > 0 ? `${[...booleans].join(", ")}, or one of ${spellValues(names)}` : [...booleans].join(" or ") });
46
+ }
47
+ /**
35
48
  * The off-system literal a style property may take beside its token set — `[13px]`, `[#abc]`.
36
49
  *
37
50
  * The brackets are the marker, not the value: `styleDeclarations` strips them when it paints, and
@@ -189,7 +202,7 @@ function valueSchemaOf(declaration, config, seen = /* @__PURE__ */ new Set()) {
189
202
  return buildRefListDomainSchema(targets, config, seen);
190
203
  }
191
204
  const listed = listedIn(domain);
192
- if (listed) return oneOf(listed) ?? z.unknown();
205
+ if (listed) return listedSchema(domain, listed) ?? z.unknown();
193
206
  if (typeof domain === "boolean") return z.boolean();
194
207
  if (typeof domain === "string") return z.string();
195
208
  if (typeof domain === "number") return z.number();
@@ -0,0 +1,8 @@
1
+ /**
2
+ * An addition only, so the envelope passes through as it is: a variant value's body may carry
3
+ * `boolean: true`, on a value named `true` or `false`. The value is that boolean, and a condition or
4
+ * default on it holds the boolean. The list form takes `true` and `false` and stores them so.
5
+ */
6
+ import type { SchemaMigration } from '../framework/schema-version';
7
+ export declare const VARIANT_BOOLEANS_VERSION = 20261112154943;
8
+ export declare const variantBooleansMigration: SchemaMigration;
@@ -0,0 +1,10 @@
1
+ //#region src/migrations/20261112154943_variant_booleans.ts
2
+ const VARIANT_BOOLEANS_VERSION = 20261112154943;
3
+ const variantBooleansMigration = {
4
+ version: VARIANT_BOOLEANS_VERSION,
5
+ up(json) {
6
+ return json;
7
+ }
8
+ };
9
+ //#endregion
10
+ export { VARIANT_BOOLEANS_VERSION, variantBooleansMigration };