@yahoo/uds-create-config 5.107.1 → 5.108.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/__fixtures__/yos-native.d.ts +5 -3
- package/dist/configs/CanvasConfig.d.ts +24 -1
- package/dist/configs/CanvasConfig.js +103 -3
- package/dist/configs/react-native-system.d.ts +5 -3
- package/dist/configs/system.js +2 -0
- package/dist/entities/canvas/frame.d.ts +5 -4
- package/dist/entities/canvas/frame.js +5 -6
- package/dist/entities/canvas/node-gestures.d.ts +2 -0
- package/dist/entities/canvas/node-gestures.js +80 -27
- package/dist/entities/canvas/node-patches.js +6 -2
- package/dist/entities/native/NativeToken.d.ts +5 -3
- package/dist/entities/system/Component.d.ts +5 -3
- package/dist/entities/system/Component.js +3 -2
- package/dist/entities/system/Token.d.ts +5 -3
- package/dist/entities/system/Token.js +3 -2
- 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/20261117234103_uds_6038_mcp_inputs.d.ts +4 -0
- package/dist/migrations/20261117234103_uds_6038_mcp_inputs.js +10 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -186,9 +186,11 @@ export declare function yosNative(): import("..").ConfigInstance<{
|
|
|
186
186
|
readonly get: {
|
|
187
187
|
readonly input: import("zod").ZodObject<{
|
|
188
188
|
path: import("zod").ZodType<string, string | undefined, import("zod/v4/core").$ZodTypeInternals<string, string | undefined>>;
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
189
|
+
data: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
190
|
+
detail: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
191
|
+
full: "full";
|
|
192
|
+
}>>;
|
|
193
|
+
}, import("zod/v4/core").$strip>>;
|
|
192
194
|
}, import("zod/v4/core").$strip>;
|
|
193
195
|
};
|
|
194
196
|
}, Record<never, never>, false, Record<never, never>, Record<never, never>>;
|
|
@@ -200,7 +200,30 @@ declare const NodeDefinition: EntityClass<z.ZodObject<{
|
|
|
200
200
|
__ref: z.ZodString;
|
|
201
201
|
}, z.core.$strip>>;
|
|
202
202
|
duplicatedFrom: z.ZodOptional<z.ZodType<Ref, unknown, z.core.$ZodTypeInternals<Ref, unknown>>>;
|
|
203
|
-
}, z.core.$strip>, z.ZodObject<Record<never, never>, z.core.$strip>, "node", {
|
|
203
|
+
}, z.core.$strip>, z.ZodObject<Record<never, never>, z.core.$strip>, "node", {
|
|
204
|
+
readonly delete: {
|
|
205
|
+
readonly input: z.ZodObject<{
|
|
206
|
+
path: z.ZodType<string, string | undefined, z.core.$ZodTypeInternals<string, string | undefined>>;
|
|
207
|
+
}, z.core.$strip>;
|
|
208
|
+
};
|
|
209
|
+
readonly list: {
|
|
210
|
+
readonly input: z.ZodObject<{
|
|
211
|
+
page: z.ZodOptional<z.ZodString>;
|
|
212
|
+
under: z.ZodOptional<z.ZodString>;
|
|
213
|
+
offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
214
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
215
|
+
}, z.core.$strip>;
|
|
216
|
+
};
|
|
217
|
+
readonly search: {
|
|
218
|
+
readonly input: z.ZodObject<{
|
|
219
|
+
page: z.ZodOptional<z.ZodString>;
|
|
220
|
+
under: z.ZodOptional<z.ZodString>;
|
|
221
|
+
offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
222
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
223
|
+
query: z.ZodString;
|
|
224
|
+
}, z.core.$strip>;
|
|
225
|
+
};
|
|
226
|
+
}, {
|
|
204
227
|
/**
|
|
205
228
|
* What a layers rail (or any listing) calls this node: its authored
|
|
206
229
|
* `label`, else what its `type` names — the component's own display label,
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { AI_LANES } from "../ai-lanes.js";
|
|
2
|
+
import { pathOf } from "../framework/utils/refs.js";
|
|
3
|
+
import { pathInput } from "../framework/schemas.js";
|
|
2
4
|
import { defineEntity } from "../framework/defineEntity.js";
|
|
3
5
|
import { Package } from "../entities/system/Package.js";
|
|
4
6
|
import { Component } from "../entities/system/Component.js";
|
|
5
7
|
import { Icon } from "../entities/system/Icon.js";
|
|
6
8
|
import { captureNodeOps } from "../capture/node-ops.js";
|
|
7
|
-
import { nodeGestureOps } from "../entities/canvas/node-gestures.js";
|
|
9
|
+
import { deleteNodePatches, nodeGestureOps } from "../entities/canvas/node-gestures.js";
|
|
8
10
|
import { Device } from "../entities/system/Device.js";
|
|
9
11
|
import { Operation } from "../entities/system/Operation.js";
|
|
10
12
|
import { Tool } from "../entities/system/Tool.js";
|
|
@@ -137,6 +139,67 @@ const elementType = z.union([
|
|
|
137
139
|
* `defineEntity` call below returns, and the explicit annotation breaks the circular type
|
|
138
140
|
* inference (same pattern `Token`'s self-referencing value uses). */
|
|
139
141
|
const nodeRef = z.lazy(() => Node);
|
|
142
|
+
const NODE_LIST_LIMIT = 50;
|
|
143
|
+
const nodeListInput = z.object({
|
|
144
|
+
page: z.string().min(1).optional().describe("Only nodes on this page and their descendants."),
|
|
145
|
+
under: z.string().min(1).optional().describe("Only this node and its descendants."),
|
|
146
|
+
offset: z.number().int().min(0).optional().default(0),
|
|
147
|
+
limit: z.number().int().min(1).max(100).optional().default(NODE_LIST_LIMIT)
|
|
148
|
+
});
|
|
149
|
+
const nodeSearchInput = nodeListInput.extend({ query: z.string().min(1).describe("Text to find in node names, types, and props.") });
|
|
150
|
+
function namedPath(value, kind) {
|
|
151
|
+
if (!value) return void 0;
|
|
152
|
+
return value.startsWith(`${kind}:`) ? pathOf(value) : value;
|
|
153
|
+
}
|
|
154
|
+
function nodePagePath(body) {
|
|
155
|
+
const page = body.page;
|
|
156
|
+
return page && typeof page === "object" && "__ref" in page ? pathOf(page) : void 0;
|
|
157
|
+
}
|
|
158
|
+
function containsText(value, query) {
|
|
159
|
+
if (typeof value === "string") return value.toLowerCase().includes(query);
|
|
160
|
+
if (Array.isArray(value)) return value.some((entry) => containsText(entry, query));
|
|
161
|
+
if (value && typeof value === "object") return Object.entries(value).some(([key, entry]) => key.toLowerCase().includes(query) || containsText(entry, query));
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
function nodeSummaries(config, input) {
|
|
165
|
+
const page = namedPath(typeof input.page === "string" ? input.page : void 0, "page");
|
|
166
|
+
const under = namedPath(typeof input.under === "string" ? input.under : void 0, "node");
|
|
167
|
+
const query = typeof input.query === "string" ? input.query.toLowerCase() : void 0;
|
|
168
|
+
const offset = Number(input.offset ?? 0);
|
|
169
|
+
const limit = Number(input.limit ?? NODE_LIST_LIMIT);
|
|
170
|
+
const nodes = config.list("node").filter((node) => {
|
|
171
|
+
if (under && node.path !== under && !node.path.startsWith(`${under}/`)) return false;
|
|
172
|
+
if (page) {
|
|
173
|
+
const root = node.path.split("/")[0] ?? node.path;
|
|
174
|
+
const rootBody = config.resolve("node", root)?.body;
|
|
175
|
+
if (!rootBody || nodePagePath(rootBody) !== page) return false;
|
|
176
|
+
}
|
|
177
|
+
if (!query) return true;
|
|
178
|
+
const body = node.body;
|
|
179
|
+
const type = body.type;
|
|
180
|
+
const typePath = type && typeof type === "object" && "__ref" in type ? pathOf(type) : "";
|
|
181
|
+
return node.path.toLowerCase().includes(query) || String(node.displayLabel ?? "").toLowerCase().includes(query) || typePath.toLowerCase().includes(query) || containsText(body.props, query);
|
|
182
|
+
});
|
|
183
|
+
const selected = nodes.slice(offset, offset + limit);
|
|
184
|
+
return {
|
|
185
|
+
total: nodes.length,
|
|
186
|
+
offset,
|
|
187
|
+
limit,
|
|
188
|
+
nextOffset: offset + selected.length < nodes.length ? offset + selected.length : null,
|
|
189
|
+
nodes: selected.map((node) => {
|
|
190
|
+
const body = node.body;
|
|
191
|
+
const type = body.type;
|
|
192
|
+
const pageRef = body.page;
|
|
193
|
+
return {
|
|
194
|
+
path: node.path,
|
|
195
|
+
...typeof node.displayLabel === "string" ? { displayLabel: node.displayLabel } : {},
|
|
196
|
+
...typeof body.label === "string" ? { label: body.label } : {},
|
|
197
|
+
...type && typeof type === "object" && "__ref" in type ? { type: pathOf(type) } : {},
|
|
198
|
+
...pageRef && typeof pageRef === "object" && "__ref" in pageRef ? { page: pathOf(pageRef) } : {}
|
|
199
|
+
};
|
|
200
|
+
})
|
|
201
|
+
};
|
|
202
|
+
}
|
|
140
203
|
/** A placed node's frame size — freeform, or powered by a system device. */
|
|
141
204
|
const Size = z.discriminatedUnion("type", [z.object({
|
|
142
205
|
type: z.literal("custom"),
|
|
@@ -150,14 +213,51 @@ const Node = defineEntity({
|
|
|
150
213
|
kind: "node",
|
|
151
214
|
schemas: {
|
|
152
215
|
...captureNodeOps,
|
|
153
|
-
...nodeGestureOps
|
|
216
|
+
...nodeGestureOps,
|
|
217
|
+
update: { description: "Update addressed node fields. Supplying `data.props` replaces the whole props bag; use `data.props.<name>` to change one prop." },
|
|
218
|
+
delete: {
|
|
219
|
+
input: z.object({ path: pathInput("node") }),
|
|
220
|
+
readOnly: false,
|
|
221
|
+
label: "Delete",
|
|
222
|
+
description: "Delete the node at `path` and its render subtree. A node inside another node is removed from its parent before its subtree is deleted.",
|
|
223
|
+
scope: "item",
|
|
224
|
+
approval: "destructive",
|
|
225
|
+
example: ({ config }) => {
|
|
226
|
+
const node = config.list("node")[0];
|
|
227
|
+
return node ? { path: node.path } : void 0;
|
|
228
|
+
},
|
|
229
|
+
handler: (input, config) => {
|
|
230
|
+
return deleteNodePatches(config, String(input.path)).reduce((next, patch) => next.apply(patch), config);
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
list: {
|
|
234
|
+
input: nodeListInput,
|
|
235
|
+
readOnly: true,
|
|
236
|
+
label: "List",
|
|
237
|
+
description: "List a page of node summaries (50 by default). Set `page` or `under` to scope the results; `offset` and `limit` page through matches. Use `node/search` to find nodes by text, component type, or props.",
|
|
238
|
+
scope: "collection",
|
|
239
|
+
example: () => ({ limit: 20 }),
|
|
240
|
+
handler: (input, config) => nodeSummaries(config, input)
|
|
241
|
+
},
|
|
242
|
+
search: {
|
|
243
|
+
input: nodeSearchInput,
|
|
244
|
+
readOnly: true,
|
|
245
|
+
label: "Search",
|
|
246
|
+
description: "Find nodes by case-insensitive text in their path, label, component type, or props. Set `page` or `under` to scope results; use `offset` and `limit` to page through matches.",
|
|
247
|
+
scope: "collection",
|
|
248
|
+
example: () => ({
|
|
249
|
+
query: "header",
|
|
250
|
+
limit: 20
|
|
251
|
+
}),
|
|
252
|
+
handler: (input, config) => nodeSummaries(config, input)
|
|
253
|
+
}
|
|
154
254
|
},
|
|
155
255
|
fields: z.object({
|
|
156
256
|
/** A real ref, never a bare name — dependents()/rename-cascade need a real edge, and a bare
|
|
157
257
|
* `kind:path` string the framework never walks gives neither. Absent only on a placeholder
|
|
158
258
|
* awaiting generation. */
|
|
159
259
|
type: elementType.optional(),
|
|
160
|
-
props: z.record(z.string(), z.unknown()).optional(),
|
|
260
|
+
props: z.record(z.string(), z.unknown()).optional().describe("The props bag. Supplying `props` in `node/update` replaces this whole bag; use `props.<name>` to update one prop."),
|
|
161
261
|
/** The default slot's fill — refs to this node's subtree nodes. */
|
|
162
262
|
children: z.array(nodeRef).describe("Refs to this node's subtree nodes. A child's path nests under this node's root path, such as \"card/title\" under \"card\".").optional(),
|
|
163
263
|
/** Named slots — never folded into `props`; see symptom 5 in the design doc for why. */
|
|
@@ -207,9 +207,11 @@ declare const ReactNativeSystemDefinition: ConfigClass<{
|
|
|
207
207
|
readonly get: {
|
|
208
208
|
readonly input: _$zod.ZodObject<{
|
|
209
209
|
path: _$zod.ZodType<string, string | undefined, _$zod_v4_core0.$ZodTypeInternals<string, string | undefined>>;
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
210
|
+
data: _$zod.ZodOptional<_$zod.ZodObject<{
|
|
211
|
+
detail: _$zod.ZodOptional<_$zod.ZodEnum<{
|
|
212
|
+
full: "full";
|
|
213
|
+
}>>;
|
|
214
|
+
}, _$zod_v4_core0.$strip>>;
|
|
213
215
|
}, _$zod_v4_core0.$strip>;
|
|
214
216
|
};
|
|
215
217
|
}, Record<never, never>, false, Record<never, never>, Record<never, never>>;
|
package/dist/configs/system.js
CHANGED
|
@@ -113,6 +113,7 @@ import { componentStyleSetMigration } from "../migrations/20261015192819_compone
|
|
|
113
113
|
import { sharedMotionMigration } from "../migrations/20261015203142_shared_motion.js";
|
|
114
114
|
import { nativeMotionMigration } from "../migrations/20261015212352_native_motion.js";
|
|
115
115
|
import { motionTypesMigration } from "../migrations/20261015212414_motion_types.js";
|
|
116
|
+
import { uds6038McpInputsMigration } from "../migrations/20261117234103_uds_6038_mcp_inputs.js";
|
|
116
117
|
const System = defineConfig({
|
|
117
118
|
name: WEB_CONFIG_NAME,
|
|
118
119
|
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.",
|
|
@@ -242,5 +243,6 @@ if (!registeredSchemaMigrations().has(20261112145536)) registerSchemaMigrations(
|
|
|
242
243
|
if (!registeredSchemaMigrations().has(20261112154943)) registerSchemaMigrations(variantBooleansMigration);
|
|
243
244
|
if (!registeredSchemaMigrations().has(20261112163439)) registerSchemaMigrations(vendorLinkTypeMigration);
|
|
244
245
|
if (!registeredSchemaMigrations().has(20261113131930)) registerSchemaMigrations(styleSetOwnRuleOnlyMigration);
|
|
246
|
+
if (!registeredSchemaMigrations().has(20261117234103)) registerSchemaMigrations(uds6038McpInputsMigration);
|
|
245
247
|
//#endregion
|
|
246
248
|
export { System };
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
//#region src/entities/canvas/frame.d.ts
|
|
2
2
|
/**
|
|
3
|
-
* A frame is a placed node whose root is
|
|
3
|
+
* A frame is a placed node whose root is Create's own element and whose `frame` field is `true`.
|
|
4
4
|
* It is a screen: its size is the device it stands for, its breakpoints follow its width, and what it
|
|
5
|
-
* holds is ordinary design system nodes.
|
|
5
|
+
* holds is ordinary design system nodes. It has no layout of its own; its content lays out in the
|
|
6
|
+
* platform's default flow, and a design that needs more brings its own container. A mode it forces is the root's own
|
|
6
7
|
* `data-create-force-mode-<group>` prop, as on any layer.
|
|
7
8
|
*/
|
|
8
9
|
/** The container a design-time breakpoint measures: the frame a design sits in, else the page. */
|
|
9
10
|
declare const FRAME_CONTAINER = "create-frame";
|
|
10
|
-
/** A frame's root style: its size, scrolling what is taller,
|
|
11
|
-
*
|
|
11
|
+
/** A frame's root style: its size, scrolling what is taller, and the container its breakpoints
|
|
12
|
+
* measure. */
|
|
12
13
|
declare function frameRootStyle({
|
|
13
14
|
width,
|
|
14
15
|
height
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
//#region src/entities/canvas/frame.ts
|
|
2
2
|
/**
|
|
3
|
-
* A frame is a placed node whose root is
|
|
3
|
+
* A frame is a placed node whose root is Create's own element and whose `frame` field is `true`.
|
|
4
4
|
* It is a screen: its size is the device it stands for, its breakpoints follow its width, and what it
|
|
5
|
-
* holds is ordinary design system nodes.
|
|
5
|
+
* holds is ordinary design system nodes. It has no layout of its own; its content lays out in the
|
|
6
|
+
* platform's default flow, and a design that needs more brings its own container. A mode it forces is the root's own
|
|
6
7
|
* `data-create-force-mode-<group>` prop, as on any layer.
|
|
7
8
|
*/
|
|
8
9
|
/** The container a design-time breakpoint measures: the frame a design sits in, else the page. */
|
|
9
10
|
const FRAME_CONTAINER = "create-frame";
|
|
10
|
-
/** A frame's root style: its size, scrolling what is taller,
|
|
11
|
-
*
|
|
11
|
+
/** A frame's root style: its size, scrolling what is taller, and the container its breakpoints
|
|
12
|
+
* measure. */
|
|
12
13
|
function frameRootStyle({ width, height }) {
|
|
13
14
|
return {
|
|
14
15
|
width: `${width}px`,
|
|
15
16
|
height: `${height}px`,
|
|
16
|
-
display: "flex",
|
|
17
|
-
flexDirection: "column",
|
|
18
17
|
position: "relative",
|
|
19
18
|
overflow: "auto",
|
|
20
19
|
isolation: "isolate",
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { pathOf, ref } from "../../framework/utils/refs.js";
|
|
2
|
-
import { rejectData } from "../../framework/rejection.js";
|
|
1
|
+
import { pathOf, ref, sourceOf } from "../../framework/utils/refs.js";
|
|
2
|
+
import { reject, rejectData } from "../../framework/rejection.js";
|
|
3
3
|
import { pathInput } from "../../framework/schemas.js";
|
|
4
4
|
import { childrenPolicy } from "../system/element.js";
|
|
5
5
|
import { surfaceProps } from "../../framework/prop-surface.js";
|
|
6
6
|
import { forceModeProp, forceModeProps } from "../../framework/class-names.js";
|
|
7
7
|
import { slotOf } from "../../spec/slot.js";
|
|
8
|
-
import {
|
|
8
|
+
import { Component } from "../system/Component.js";
|
|
9
|
+
import { PLACED_NODE_KEY, attachedSystem, placedTypeRef, postOrder } from "./node-patches.js";
|
|
9
10
|
import { z } from "zod";
|
|
10
11
|
//#region src/entities/canvas/node-gestures.ts
|
|
11
12
|
const specSchema = z.object({
|
|
@@ -54,8 +55,8 @@ count: z.number().int().min(1).max(50).optional() }).optional()
|
|
|
54
55
|
const swapInput = z.object({
|
|
55
56
|
path: pathInput("node"),
|
|
56
57
|
data: z.object({
|
|
57
|
-
/**
|
|
58
|
-
type:
|
|
58
|
+
/** A ref to the component to render instead. */
|
|
59
|
+
type: Component })
|
|
59
60
|
});
|
|
60
61
|
const moveInput = z.object({
|
|
61
62
|
path: pathInput("node"),
|
|
@@ -233,7 +234,10 @@ function placeUpdate(place, list) {
|
|
|
233
234
|
/** An element and everything beneath it, deepest first, so each create meets the rows it points at. */
|
|
234
235
|
function subtreeOf(config, path) {
|
|
235
236
|
const out = [];
|
|
237
|
+
const visited = /* @__PURE__ */ new Set();
|
|
236
238
|
const visit = (at) => {
|
|
239
|
+
if (visited.has(at)) return;
|
|
240
|
+
visited.add(at);
|
|
237
241
|
const body = config.resolve("node", at)?.body;
|
|
238
242
|
if (!body) return;
|
|
239
243
|
for (const child of childrenOf(body)) visit(pathOf(child));
|
|
@@ -243,13 +247,59 @@ function subtreeOf(config, path) {
|
|
|
243
247
|
visit(path);
|
|
244
248
|
return out;
|
|
245
249
|
}
|
|
250
|
+
function clearAndDeleteSubtrees(config, roots) {
|
|
251
|
+
const paths = [...new Set(roots.flatMap((path) => subtreeOf(config, path)))];
|
|
252
|
+
const deleting = new Set(paths);
|
|
253
|
+
const unlinkParents = config.list("node").flatMap((node) => {
|
|
254
|
+
const body = node.body;
|
|
255
|
+
const children = body.children?.filter((child) => !deleting.has(pathOf(child)));
|
|
256
|
+
const slots = body.slots ? Object.fromEntries(Object.entries(body.slots).map(([slot, fills]) => [slot, fills.filter((fill) => !deleting.has(pathOf(fill)))])) : void 0;
|
|
257
|
+
const childrenChanged = children?.length !== body.children?.length;
|
|
258
|
+
const slotsChanged = Object.entries(body.slots ?? {}).some(([slot, fills]) => slots?.[slot]?.length !== fills.length);
|
|
259
|
+
if (!childrenChanged && !slotsChanged) return [];
|
|
260
|
+
return [{
|
|
261
|
+
kind: "node",
|
|
262
|
+
operation: "update",
|
|
263
|
+
path: node.path,
|
|
264
|
+
data: {
|
|
265
|
+
...childrenChanged ? { children } : {},
|
|
266
|
+
...slotsChanged ? { slots } : {}
|
|
267
|
+
}
|
|
268
|
+
}];
|
|
269
|
+
});
|
|
270
|
+
const clears = paths.flatMap((path) => {
|
|
271
|
+
const body = config.resolve("node", path)?.body;
|
|
272
|
+
if (!body) return [];
|
|
273
|
+
return [{
|
|
274
|
+
kind: "node",
|
|
275
|
+
operation: "update",
|
|
276
|
+
path,
|
|
277
|
+
data: {
|
|
278
|
+
...body.children ? { children: [] } : {},
|
|
279
|
+
...body.slots ? { slots: Object.fromEntries(Object.keys(body.slots).map((slot) => [slot, []])) } : {}
|
|
280
|
+
}
|
|
281
|
+
}];
|
|
282
|
+
});
|
|
283
|
+
return [
|
|
284
|
+
...unlinkParents,
|
|
285
|
+
...clears,
|
|
286
|
+
...paths.map((path) => ({
|
|
287
|
+
kind: "node",
|
|
288
|
+
operation: "delete",
|
|
289
|
+
path
|
|
290
|
+
}))
|
|
291
|
+
];
|
|
292
|
+
}
|
|
293
|
+
function deleteNodePatches(config, path) {
|
|
294
|
+
if (!config.resolve("node", path)) {
|
|
295
|
+
if (!config.patches.some((patch) => patch.kind === "node" && patch.operation === "delete" && patch.path === path)) reject("NOT_FOUND", `No node at "${path}".`);
|
|
296
|
+
return [];
|
|
297
|
+
}
|
|
298
|
+
return clearAndDeleteSubtrees(config, [path]);
|
|
299
|
+
}
|
|
246
300
|
function remove(config, input) {
|
|
247
301
|
const place = placeOf(config, input.path, ["path"]);
|
|
248
|
-
return [placeUpdate(place, place.list.filter((_, i) => i !== place.index)), ...
|
|
249
|
-
kind: "node",
|
|
250
|
-
operation: "delete",
|
|
251
|
-
path
|
|
252
|
-
}))];
|
|
302
|
+
return [placeUpdate(place, place.list.filter((_, i) => i !== place.index)), ...clearAndDeleteSubtrees(config, [input.path])];
|
|
253
303
|
}
|
|
254
304
|
/** The annotations on `paths`, oldest first, as a layer lists them. */
|
|
255
305
|
function annotationsOn({ config, paths }) {
|
|
@@ -328,13 +378,14 @@ function unwrap(config, input) {
|
|
|
328
378
|
function swap(config, input) {
|
|
329
379
|
const { slug, system } = attachedSystem(config);
|
|
330
380
|
const body = bodyOf(config, input.path, ["path"]);
|
|
331
|
-
const
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
});
|
|
335
|
-
const component = system.resolve("component",
|
|
336
|
-
if (!component) return rejectData(`The system has no component "${
|
|
337
|
-
|
|
381
|
+
const source = sourceOf(input.data.type);
|
|
382
|
+
if (source && source !== slug) return rejectData(`The component ref must target the attached system "${slug}".`, ["data", "type"]);
|
|
383
|
+
const componentPath = pathOf(input.data.type);
|
|
384
|
+
const type = source ? input.data.type : ref("component", `${componentPath}@${slug}`);
|
|
385
|
+
const component = system.resolve("component", componentPath);
|
|
386
|
+
if (!component) return rejectData(`The system has no component "${componentPath}".`, ["data", "type"]);
|
|
387
|
+
const children = childrenOf(body);
|
|
388
|
+
const discardChildren = children.length > 0 && childrenPolicy(system, component.path) !== "nodes";
|
|
338
389
|
for (const [name, fills] of Object.entries(body.slots ?? {})) {
|
|
339
390
|
if (fills.length === 0) continue;
|
|
340
391
|
const slot = slotOf({
|
|
@@ -356,9 +407,14 @@ function swap(config, input) {
|
|
|
356
407
|
path: input.path,
|
|
357
408
|
data: {
|
|
358
409
|
type,
|
|
359
|
-
props
|
|
410
|
+
props,
|
|
411
|
+
...discardChildren ? { children: [] } : {}
|
|
360
412
|
}
|
|
361
|
-
}
|
|
413
|
+
}, ...discardChildren ? children.flatMap((child) => subtreeOf(config, pathOf(child)).reverse().map((path) => ({
|
|
414
|
+
kind: "node",
|
|
415
|
+
operation: "delete",
|
|
416
|
+
path
|
|
417
|
+
}))) : []];
|
|
362
418
|
}
|
|
363
419
|
/** Whether a slot takes the element a fill ref points at. */
|
|
364
420
|
function slotTakes({ config, slot, fill }) {
|
|
@@ -549,17 +605,14 @@ const nodeGestureOps = {
|
|
|
549
605
|
input: wrapInput,
|
|
550
606
|
readOnly: false,
|
|
551
607
|
label: "Wrap children in a container",
|
|
552
|
-
description: "Group or wrap elements (\"wrap these in a stack\", \"group the title and the body\", \"put it in a card\"): some of this node's direct children move into a new container element of the given component type, which takes their place among the node's children.
|
|
608
|
+
description: "Group or wrap elements (\"wrap these in a stack\", \"group the title and the body\", \"put it in a card\"): some of this node's direct children move into a new container element of the given component type, which takes their place among the node's children. Use the full component path as listed by the attached system, including any group prefix. The elements land in the container's children, or in the slot its `slotProp` names, and a slot that lists what it accepts refuses anything else.",
|
|
553
609
|
scope: "item",
|
|
554
610
|
title: (entity) => `Wrap children of ${entity}`,
|
|
555
611
|
example: () => ({
|
|
556
612
|
path: "card",
|
|
557
613
|
data: {
|
|
558
614
|
elements: ["card/title", "card/body"],
|
|
559
|
-
container: {
|
|
560
|
-
type: "VStack",
|
|
561
|
-
props: { gap: "2" }
|
|
562
|
-
}
|
|
615
|
+
container: { type: "layout/VStack" }
|
|
563
616
|
}
|
|
564
617
|
}),
|
|
565
618
|
handler: (input, config) => applied(config, wrap(config, wrapInput.parse(input)))
|
|
@@ -601,12 +654,12 @@ const nodeGestureOps = {
|
|
|
601
654
|
input: swapInput,
|
|
602
655
|
readOnly: false,
|
|
603
656
|
label: "Swap an element for another component",
|
|
604
|
-
description: "Render this element as a different component
|
|
657
|
+
description: "Render this element as a different component using a component ref. It keeps its place and the props the new component takes; children are removed when the new component does not accept them.",
|
|
605
658
|
scope: "item",
|
|
606
659
|
title: (entity) => `Swap ${entity}`,
|
|
607
660
|
example: () => ({
|
|
608
661
|
path: "card/row",
|
|
609
|
-
data: { type: "VStack" }
|
|
662
|
+
data: { type: Component.ref("VStack") }
|
|
610
663
|
}),
|
|
611
664
|
handler: (input, config) => applied(config, swap(config, swapInput.parse(input)))
|
|
612
665
|
},
|
|
@@ -654,4 +707,4 @@ const nodeGestureOps = {
|
|
|
654
707
|
}
|
|
655
708
|
};
|
|
656
709
|
//#endregion
|
|
657
|
-
export { nodeGestureOps };
|
|
710
|
+
export { deleteNodePatches, nodeGestureOps };
|
|
@@ -38,7 +38,11 @@ function placedTypeRef({ type, slug, system, field }) {
|
|
|
38
38
|
type,
|
|
39
39
|
slug
|
|
40
40
|
});
|
|
41
|
-
|
|
41
|
+
const path = pathOf(placed);
|
|
42
|
+
if (kindOf(placed) === "component" && !system.resolve("component", path)) {
|
|
43
|
+
const matches = system.list("component").filter((entry) => entry.path.endsWith(`/${path}`));
|
|
44
|
+
return rejectData(`The system has no component "${path}".${matches.length === 1 ? ` Did you mean "${matches[0].path}"?` : ""}`, field);
|
|
45
|
+
}
|
|
42
46
|
return placed;
|
|
43
47
|
}
|
|
44
48
|
/** The content fields of one element as a node row holds them. */
|
|
@@ -134,4 +138,4 @@ function specToNodePatches({ config, nodeId, spec, placement, field = (key) => [
|
|
|
134
138
|
return patches;
|
|
135
139
|
}
|
|
136
140
|
//#endregion
|
|
137
|
-
export { PLACED_NODE_KEY, attachedSystem,
|
|
141
|
+
export { PLACED_NODE_KEY, attachedSystem, placedTypeRef, postOrder, specToNodePatches };
|
|
@@ -104,9 +104,11 @@ declare const NativeToken: EntityClass<z.ZodObject<Omit<{
|
|
|
104
104
|
readonly get: {
|
|
105
105
|
readonly input: z.ZodObject<{
|
|
106
106
|
path: z.ZodType<string, string | undefined, z.core.$ZodTypeInternals<string, string | undefined>>;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
107
|
+
data: z.ZodOptional<z.ZodObject<{
|
|
108
|
+
detail: z.ZodOptional<z.ZodEnum<{
|
|
109
|
+
full: "full";
|
|
110
|
+
}>>;
|
|
111
|
+
}, z.core.$strip>>;
|
|
110
112
|
}, z.core.$strip>;
|
|
111
113
|
};
|
|
112
114
|
}, Record<never, never>, false, Record<never, never>, Record<never, never>>;
|
|
@@ -939,9 +939,11 @@ declare const ComponentEntity: EntityClass<z.ZodObject<{
|
|
|
939
939
|
readonly get: {
|
|
940
940
|
readonly input: z.ZodObject<{
|
|
941
941
|
path: z.ZodType<string, string | undefined, z.core.$ZodTypeInternals<string, string | undefined>>;
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
942
|
+
data: z.ZodOptional<z.ZodObject<{
|
|
943
|
+
detail: z.ZodOptional<z.ZodEnum<{
|
|
944
|
+
full: "full";
|
|
945
|
+
}>>;
|
|
946
|
+
}, z.core.$strict>>;
|
|
945
947
|
}, z.core.$strip>;
|
|
946
948
|
};
|
|
947
949
|
readonly validate: {
|
|
@@ -3001,12 +3001,13 @@ element: refSchema })
|
|
|
3001
3001
|
get: {
|
|
3002
3002
|
input: z.object({
|
|
3003
3003
|
path: pathInput("component"),
|
|
3004
|
-
detail: z.enum(["full"]).optional().describe("`\"full\"` adds what an author needs: each layer's forwards and what it could still forward, and the style rules, anatomy and preview content.")
|
|
3004
|
+
data: z.strictObject({ detail: z.enum(["full"]).optional().describe("`\"full\"` adds what an author needs: each layer's forwards and what it could still forward, and the style rules, anatomy and preview content.") }).optional()
|
|
3005
3005
|
}),
|
|
3006
3006
|
readOnly: true,
|
|
3007
3007
|
label: "Get",
|
|
3008
|
-
description: "Get one component by its qualified `path`: its props and a usage example. Pass `detail: \"full\"` for the forwards, style rules, anatomy and preview content, which editing it needs.",
|
|
3008
|
+
description: "Get one component by its qualified `path`: its props and a usage example. Pass `data.detail: \"full\"` for the forwards, style rules, anatomy and preview content, which editing it needs.",
|
|
3009
3009
|
scope: "item",
|
|
3010
|
+
example: ({ path }) => ({ path }),
|
|
3010
3011
|
handler: (input, config) => config.resolve("component", String(input.path))
|
|
3011
3012
|
},
|
|
3012
3013
|
validate: {
|
|
@@ -96,9 +96,11 @@ declare const TokenEntity: EntityClass<z.ZodObject<{
|
|
|
96
96
|
readonly get: {
|
|
97
97
|
readonly input: z.ZodObject<{
|
|
98
98
|
path: z.ZodType<string, string | undefined, z.core.$ZodTypeInternals<string, string | undefined>>;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
data: z.ZodOptional<z.ZodObject<{
|
|
100
|
+
detail: z.ZodOptional<z.ZodEnum<{
|
|
101
|
+
full: "full";
|
|
102
|
+
}>>;
|
|
103
|
+
}, z.core.$strip>>;
|
|
102
104
|
}, z.core.$strip>;
|
|
103
105
|
};
|
|
104
106
|
}, Record<never, never>, false, Record<never, never>, Record<never, never>>;
|
|
@@ -152,12 +152,13 @@ const TokenEntity = defineEntity({
|
|
|
152
152
|
get: {
|
|
153
153
|
input: z.object({
|
|
154
154
|
path: pathInput("token"),
|
|
155
|
-
detail: z.enum(["full"]).optional().describe("`\"full\"` adds the token's stored body: its value, overrides and metadata as authored.")
|
|
155
|
+
data: z.object({ detail: z.enum(["full"]).optional().describe("`\"full\"` adds the token's stored body: its value, overrides and metadata as authored.") }).optional()
|
|
156
156
|
}),
|
|
157
157
|
readOnly: true,
|
|
158
158
|
label: "Get",
|
|
159
|
-
description: "Get one token by its qualified `path`: what it comes to in each mode, and the tokens it refers to on the way. Pass `detail: \"full\"` for its stored body, which editing it needs.",
|
|
159
|
+
description: "Get one token by its qualified `path`: what it comes to in each mode, and the tokens it refers to on the way. Pass `data.detail: \"full\"` for its stored body, which editing it needs.",
|
|
160
160
|
scope: "item",
|
|
161
|
+
example: ({ path }) => ({ path }),
|
|
161
162
|
handler: (input, config) => config.resolve("token", String(input.path))
|
|
162
163
|
},
|
|
163
164
|
create: { description: `Create a token at \`<group>/<name>\` — \`data.value\` is the CSS value. The first path segment is its group, and a style property takes a whole group as one ref (\`${JSON.stringify(ref("token", "<group>"))}\`), so put the tokens one prop should offer in one group rather than listing values on the prop.` }
|
|
@@ -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 = 20261117234103;
|
|
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
|
@@ -6681,7 +6681,7 @@ var Config = class Config {
|
|
|
6681
6681
|
* links from the provided sources. A declared `linkedKind` with no provided source throws. */
|
|
6682
6682
|
hydrateFrom(stored, options) {
|
|
6683
6683
|
const claimed = schemaVersionOf(stored);
|
|
6684
|
-
if (claimed >
|
|
6684
|
+
if (claimed > 20261117234103) throw new SchemaVersionTooNew(claimed);
|
|
6685
6685
|
const wire = upgradeSerializedConfig(stored);
|
|
6686
6686
|
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.`);
|
|
6687
6687
|
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 = 20261117234103;
|
|
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 = 20261117234103;
|
|
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 > 20261117234103) 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 ?? 20261117234103;
|
|
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 ?? 20261117234103;
|
|
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 ?? 20261117234103;
|
|
183
183
|
const entries = [];
|
|
184
184
|
const held = [];
|
|
185
185
|
const retired = [];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** MCP operation schemas changed; stored shapes did not. Keep until older artifacts cannot be read. */
|
|
2
|
+
import type { SchemaMigration } from '../framework/schema-version';
|
|
3
|
+
export declare const UDS_6038_MCP_INPUTS_VERSION = 20261117234103;
|
|
4
|
+
export declare const uds6038McpInputsMigration: SchemaMigration;
|