@yahoo/uds-create-config 5.60.5 → 5.61.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.
- package/dist/configs/system.js +2 -0
- package/dist/entities/system/Component.d.ts +27 -4
- package/dist/entities/system/Component.js +33 -16
- package/dist/entities/system/defineComponent.d.ts +5 -3
- package/dist/framework/Config.d.ts +1 -1
- package/dist/framework/Config.js +1 -1
- package/dist/framework/schema-version.d.ts +1 -1
- package/dist/framework/schema-version.js +5 -5
- package/dist/migrations/20261027184442_variant_values_list_with_bodies.d.ts +7 -0
- package/dist/migrations/20261027184442_variant_values_list_with_bodies.js +8 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
package/dist/configs/system.js
CHANGED
|
@@ -31,6 +31,7 @@ import { cssContentScriptsMigration } from "../migrations/20261022152120_css_con
|
|
|
31
31
|
import { linkTypeMigration } from "../migrations/20261022184639_link_type.js";
|
|
32
32
|
import { conditionalDefaultsMigration } from "../migrations/20261023152030_conditional_defaults.js";
|
|
33
33
|
import { timingValueMigration } from "../migrations/20261026125912_timing_value.js";
|
|
34
|
+
import { variantValuesListWithBodiesMigration } from "../migrations/20261027184442_variant_values_list_with_bodies.js";
|
|
34
35
|
import { CanvasRole } from "../entities/system/CanvasRole.js";
|
|
35
36
|
import { GlobalStyle } from "../entities/system/GlobalStyle.js";
|
|
36
37
|
import { Guidance } from "../entities/system/Guidance.js";
|
|
@@ -195,5 +196,6 @@ if (!registeredSchemaMigrations().has(20261022152120)) registerSchemaMigrations(
|
|
|
195
196
|
if (!registeredSchemaMigrations().has(20261022184639)) registerSchemaMigrations(linkTypeMigration);
|
|
196
197
|
if (!registeredSchemaMigrations().has(20261023152030)) registerSchemaMigrations(conditionalDefaultsMigration);
|
|
197
198
|
if (!registeredSchemaMigrations().has(20261026125912)) registerSchemaMigrations(timingValueMigration);
|
|
199
|
+
if (!registeredSchemaMigrations().has(20261027184442)) registerSchemaMigrations(variantValuesListWithBodiesMigration);
|
|
198
200
|
//#endregion
|
|
199
201
|
export { System };
|
|
@@ -69,6 +69,15 @@ declare const variantValueFields: z.ZodObject<{
|
|
|
69
69
|
type VariantValueBody = z.infer<typeof variantValueFields>;
|
|
70
70
|
/** A variant prop's own values — name → body, in the order they were declared. */
|
|
71
71
|
type VariantValues = Record<string, VariantValueBody>;
|
|
72
|
+
/** One value in the list form of a variant's values: a bare name, or the name with its body. */
|
|
73
|
+
declare const listedVariantValue: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
74
|
+
label: z.ZodOptional<z.ZodString>;
|
|
75
|
+
description: z.ZodOptional<z.ZodString>;
|
|
76
|
+
deprecated: z.ZodOptional<z.ZodBoolean>;
|
|
77
|
+
value: z.ZodString;
|
|
78
|
+
}, z.core.$strict>]>;
|
|
79
|
+
/** One value as the list form writes it — `'sm'`, or `{ value: 'md', label: 'Medium' }`. */
|
|
80
|
+
type ListedVariantValue = z.input<typeof listedVariantValue>;
|
|
72
81
|
declare const VariantValueDefinition: SubEntityClass<z.ZodObject<{
|
|
73
82
|
label: z.ZodOptional<z.ZodString>;
|
|
74
83
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -103,9 +112,23 @@ declare const propShapeDefinition: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
103
112
|
}, z.core.$strip>]>>]>>>;
|
|
104
113
|
}, z.core.$strict>, z.ZodObject<{
|
|
105
114
|
type: z.ZodLiteral<"variant">;
|
|
106
|
-
value: z.ZodUnion<readonly [z.ZodPipe<z.ZodArray<z.ZodString
|
|
107
|
-
|
|
108
|
-
|
|
115
|
+
value: z.ZodUnion<readonly [z.ZodPipe<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
116
|
+
label: z.ZodOptional<z.ZodString>;
|
|
117
|
+
description: z.ZodOptional<z.ZodString>;
|
|
118
|
+
deprecated: z.ZodOptional<z.ZodBoolean>;
|
|
119
|
+
value: z.ZodString;
|
|
120
|
+
}, z.core.$strict>]>>, z.ZodTransform<{
|
|
121
|
+
[k: string]: {
|
|
122
|
+
label?: string | undefined;
|
|
123
|
+
description?: string | undefined;
|
|
124
|
+
deprecated?: boolean | undefined;
|
|
125
|
+
};
|
|
126
|
+
}, (string | {
|
|
127
|
+
value: string;
|
|
128
|
+
label?: string | undefined;
|
|
129
|
+
description?: string | undefined;
|
|
130
|
+
deprecated?: boolean | undefined;
|
|
131
|
+
})[]>>, z.ZodArray<z.ZodObject<{
|
|
109
132
|
__ref: z.ZodString;
|
|
110
133
|
}, z.core.$strip>>, z.ZodObject<{
|
|
111
134
|
__ref: z.ZodString;
|
|
@@ -1004,4 +1027,4 @@ interface ComponentClass extends Omit<typeof ComponentEntity, 'ref' | 'item'> {
|
|
|
1004
1027
|
instance: typeof instanceAt;
|
|
1005
1028
|
}
|
|
1006
1029
|
//#endregion
|
|
1007
|
-
export { AnatomyNodeClass, AuthoredPropBody, Component, ComponentBody, ComponentClass, ComponentCreateInput, ComponentElementBody, ComponentItemInput, ComponentPropBody, ComponentReference, ComponentStyleBody, ContractStyleRules, ElementVisibility, ElementVisibilityInput, ElementVisibilitySchema, ExtendedComponentRef, ForwardClass, LayerClass, ProjectedVisibility, PropClass, PropShapeSchema, SLOT_CODE_FORMS, VariantValueBody, VariantValues, blankComponentBody, canonicalWhen, forwardedNames, layerRef, ownValues, ownsItsValues, valueRef };
|
|
1030
|
+
export { AnatomyNodeClass, AuthoredPropBody, Component, ComponentBody, ComponentClass, ComponentCreateInput, ComponentElementBody, ComponentItemInput, ComponentPropBody, ComponentReference, ComponentStyleBody, ContractStyleRules, ElementVisibility, ElementVisibilityInput, ElementVisibilitySchema, ExtendedComponentRef, ForwardClass, LayerClass, ListedVariantValue, ProjectedVisibility, PropClass, PropShapeSchema, SLOT_CODE_FORMS, VariantValueBody, VariantValues, blankComponentBody, canonicalWhen, forwardedNames, layerRef, ownValues, ownsItsValues, valueRef };
|
|
@@ -335,19 +335,30 @@ function declaringForwardRefs(config, element, value) {
|
|
|
335
335
|
});
|
|
336
336
|
}
|
|
337
337
|
const Forward = ForwardDefinition;
|
|
338
|
+
/**
|
|
339
|
+
* One value a variant prop offers — the keyed collection under its `value`.
|
|
340
|
+
*
|
|
341
|
+
* Keyed rather than a list of names, for the three things a bare string can't be: it can't be
|
|
342
|
+
* reordered without rewriting every other value beside it, it can't carry what to call it in a
|
|
343
|
+
* picker, and it can't be renamed by the ordinary cascade — which is what a keyed collection gets
|
|
344
|
+
* from the framework, the same one `layers` and `props` are.
|
|
345
|
+
*/
|
|
346
|
+
const variantValueFields = z.strictObject({
|
|
347
|
+
/** What to call it, and what it's for, where it is offered — a picker row, the AI's catalogue.
|
|
348
|
+
* The name is an identifier and reads like one (`ui6`, `xs`); this is the human half. */
|
|
349
|
+
label: z.string().optional(),
|
|
350
|
+
description: z.string().optional(),
|
|
351
|
+
/** Withdrawn from new work, exactly as a component's own `deprecated` is: still valid wherever
|
|
352
|
+
* it is already used, left out of surfaces that offer values. The alternative to deleting it,
|
|
353
|
+
* which takes its styling with it. */
|
|
354
|
+
deprecated: z.boolean().optional()
|
|
355
|
+
});
|
|
356
|
+
/** One value in the list form of a variant's values: a bare name, or the name with its body. */
|
|
357
|
+
const listedVariantValue = z.union([z.string(), variantValueFields.extend({ value: z.string() })]);
|
|
338
358
|
const VariantValue = defineSubEntity({
|
|
339
359
|
name: "value",
|
|
340
360
|
label: "Value",
|
|
341
|
-
fields:
|
|
342
|
-
/** What to call it, and what it's for, where it is offered — a picker row, the AI's catalogue.
|
|
343
|
-
* The name is an identifier and reads like one (`ui6`, `xs`); this is the human half. */
|
|
344
|
-
label: z.string().optional(),
|
|
345
|
-
description: z.string().optional(),
|
|
346
|
-
/** Withdrawn from new work, exactly as a component's own `deprecated` is: still valid wherever
|
|
347
|
-
* it is already used, left out of surfaces that offer values. The alternative to deleting it,
|
|
348
|
-
* which takes its styling with it. */
|
|
349
|
-
deprecated: z.boolean().optional()
|
|
350
|
-
}),
|
|
361
|
+
fields: variantValueFields,
|
|
351
362
|
namedValuesIn: [
|
|
352
363
|
"defaultProps",
|
|
353
364
|
"preview/*/props",
|
|
@@ -363,17 +374,23 @@ const VariantValue = defineSubEntity({
|
|
|
363
374
|
* A variant's domain: the values it owns, a ref that delegates to whatever owns them, or a list of
|
|
364
375
|
* refs whose leaves are unioned (an icon prop drawing from two libraries through one component).
|
|
365
376
|
*
|
|
366
|
-
* The
|
|
367
|
-
*
|
|
377
|
+
* The list form is what an author writes (`['solid', 'ghost']`, with `{ value: 'outline', label }` for
|
|
378
|
+
* a value that carries a body) and is coerced here into the collection it is stored as, so every
|
|
379
|
+
* reader below this line sees one shape. In the schema
|
|
368
380
|
* rather than in the authoring adapter because there are four doors into stored state — `register`,
|
|
369
381
|
* an item create/update, a sub-op, and the artifact loader — and a coercion outside the schema only
|
|
370
382
|
* covers the one it is written in.
|
|
371
383
|
*
|
|
372
|
-
* The two list arms are disjoint: a
|
|
373
|
-
* empty list could land on either, and it lands on the
|
|
384
|
+
* The two list arms are disjoint: a ref fails both members of the value list, and a value fails
|
|
385
|
+
* `refSchema`. Only the empty list could land on either, and it lands on the value list, which
|
|
386
|
+
* coerces it to `{}`.
|
|
374
387
|
*/
|
|
375
388
|
const variantDomain = z.union([
|
|
376
|
-
z.array(
|
|
389
|
+
z.array(listedVariantValue).transform((values) => Object.fromEntries(values.map((entry) => {
|
|
390
|
+
if (typeof entry === "string") return [entry, {}];
|
|
391
|
+
const { value, ...body } = entry;
|
|
392
|
+
return [value, body];
|
|
393
|
+
}))),
|
|
377
394
|
z.array(refSchema).min(1),
|
|
378
395
|
refSchema,
|
|
379
396
|
VariantValue
|
|
@@ -541,7 +558,7 @@ const PROP_TYPES = [
|
|
|
541
558
|
"number",
|
|
542
559
|
"boolean"
|
|
543
560
|
];
|
|
544
|
-
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\"] }`; 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`. `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.";
|
|
561
|
+
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`. `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.";
|
|
545
562
|
const Prop = defineSubEntity({
|
|
546
563
|
name: "prop",
|
|
547
564
|
label: "Prop",
|
|
@@ -6,7 +6,7 @@ import { StyleValue } from "./style-bag.js";
|
|
|
6
6
|
import { StylePropertyClass } from "./StyleProperty.js";
|
|
7
7
|
import { ComponentSourceInput } from "./component-source-fields.js";
|
|
8
8
|
import { PropsOrRules } from "./prop-rules.js";
|
|
9
|
-
import { VariantValues } from "./Component.js";
|
|
9
|
+
import { ListedVariantValue, VariantValues } from "./Component.js";
|
|
10
10
|
import { AllHTMLAttributes, ComponentPropsWithRef, ComponentType, ElementType, JSX, ReactElement, ReactNode, Ref } from "react";
|
|
11
11
|
|
|
12
12
|
//#region src/entities/system/defineComponent.d.ts
|
|
@@ -189,7 +189,7 @@ interface ForwardDecl<Path extends string = string> {
|
|
|
189
189
|
*/
|
|
190
190
|
type PropDecl<Path extends string = string> = SlotDecl | ForwardDecl<Path> | {
|
|
191
191
|
type: 'variant';
|
|
192
|
-
value: readonly
|
|
192
|
+
value: readonly ListedVariantValue[] | VariantValues | Ref$1 | readonly Ref$1[];
|
|
193
193
|
required?: boolean;
|
|
194
194
|
when?: PropCondition;
|
|
195
195
|
} | {
|
|
@@ -356,7 +356,9 @@ type StylePropValue<Target extends string> = Target extends keyof RegisteredStyl
|
|
|
356
356
|
*/
|
|
357
357
|
type DomainValueOf<V> = V extends readonly {
|
|
358
358
|
__ref: `icon:${string}`;
|
|
359
|
-
}[] ? GlyphComponent : V extends readonly Ref$1[] ? string : V extends readonly (infer Member)[] ? Member
|
|
359
|
+
}[] ? GlyphComponent : V extends readonly Ref$1[] ? string : V extends readonly (infer Member)[] ? Member extends {
|
|
360
|
+
value: infer Name;
|
|
361
|
+
} ? Name : Member : V extends VariantValues ? keyof V & string : V extends {
|
|
360
362
|
__ref: `${string}#${string}`;
|
|
361
363
|
} ? string : V extends {
|
|
362
364
|
__ref: `icon:${string}`;
|
|
@@ -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 =
|
|
77
|
+
declare const SERIALIZED_CONFIG_VERSION = 20261027184442;
|
|
78
78
|
interface SerializedConfig {
|
|
79
79
|
/** See {@link SERIALIZED_CONFIG_VERSION}. Always written; a stored artifact may lack it. */
|
|
80
80
|
readonly version: number;
|
package/dist/framework/Config.js
CHANGED
|
@@ -6257,7 +6257,7 @@ var Config = class Config {
|
|
|
6257
6257
|
* links from the provided sources. A declared `linkedKind` with no provided source throws. */
|
|
6258
6258
|
hydrateFrom(stored, options) {
|
|
6259
6259
|
const claimed = schemaVersionOf(stored);
|
|
6260
|
-
if (claimed >
|
|
6260
|
+
if (claimed > 20261027184442) throw new SchemaVersionTooNew(claimed);
|
|
6261
6261
|
const wire = upgradeSerializedConfig(stored);
|
|
6262
6262
|
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.`);
|
|
6263
6263
|
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 =
|
|
18
|
+
declare const CURRENT_SCHEMA_VERSION = 20261027184442;
|
|
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 =
|
|
16
|
+
const CURRENT_SCHEMA_VERSION = 20261027184442;
|
|
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 >
|
|
48
|
+
if (migration.version > 20261027184442) 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 ??
|
|
105
|
+
const target = options?.target ?? 20261027184442;
|
|
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 ??
|
|
163
|
+
const target = options?.target ?? 20261027184442;
|
|
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 ??
|
|
182
|
+
const target = options?.target ?? 20261027184442;
|
|
183
183
|
const entries = [];
|
|
184
184
|
const held = [];
|
|
185
185
|
const retired = [];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** A variant's list of values may give a value its body in place, `['sm', { value: 'md', label:
|
|
2
|
+
* 'Medium' }]`, beside bare names. The list is coerced into the stored collection as before, so stored
|
|
3
|
+
* configs and draft patches keep their meaning. Retire this identity hop only when no supported
|
|
4
|
+
* artifact predates this schema. */
|
|
5
|
+
import type { SchemaMigration } from '../framework/schema-version';
|
|
6
|
+
export declare const VARIANT_VALUES_LIST_WITH_BODIES_VERSION = 20261027184442;
|
|
7
|
+
export declare const variantValuesListWithBodiesMigration: SchemaMigration;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/migrations/20261027184442_variant_values_list_with_bodies.ts
|
|
2
|
+
const VARIANT_VALUES_LIST_WITH_BODIES_VERSION = 20261027184442;
|
|
3
|
+
const variantValuesListWithBodiesMigration = {
|
|
4
|
+
version: VARIANT_VALUES_LIST_WITH_BODIES_VERSION,
|
|
5
|
+
up: (json) => json
|
|
6
|
+
};
|
|
7
|
+
//#endregion
|
|
8
|
+
export { VARIANT_VALUES_LIST_WITH_BODIES_VERSION, variantValuesListWithBodiesMigration };
|