@yahoo/uds-create-cli 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/package.json +12 -12
- package/subprocess/transform-runner.mjs +200 -34
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yahoo/uds-create-cli",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.108.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
33
33
|
"@orpc/client": "^1.13.9",
|
|
34
34
|
"@orpc/contract": "^1.13.9",
|
|
35
|
-
"@yahoo/uds-create-config": "5.
|
|
36
|
-
"@yahoo/uds-create-loader": "5.
|
|
37
|
-
"@yahoo/uds-create-types": "5.
|
|
38
|
-
"@yahoo/uds-create-utils": "5.
|
|
35
|
+
"@yahoo/uds-create-config": "5.108.0",
|
|
36
|
+
"@yahoo/uds-create-loader": "5.108.0",
|
|
37
|
+
"@yahoo/uds-create-types": "5.108.0",
|
|
38
|
+
"@yahoo/uds-create-utils": "5.108.0",
|
|
39
39
|
"esbuild": "^0.27.4",
|
|
40
40
|
"ts-morph": "^27.0.2",
|
|
41
41
|
"get-tsconfig": "^4.10.0",
|
|
@@ -52,13 +52,13 @@
|
|
|
52
52
|
"lodash": "^4.17.23",
|
|
53
53
|
"prettier": "^3.8.1"
|
|
54
54
|
},
|
|
55
|
-
"udsSchemaVersion":
|
|
55
|
+
"udsSchemaVersion": 20261117234103,
|
|
56
56
|
"optionalDependencies": {
|
|
57
|
-
"@yahoo/uds-create-cli-darwin-arm64": "5.
|
|
58
|
-
"@yahoo/uds-create-cli-darwin-x64": "5.
|
|
59
|
-
"@yahoo/uds-create-cli-linux-arm64": "5.
|
|
60
|
-
"@yahoo/uds-create-cli-linux-x64": "5.
|
|
61
|
-
"@yahoo/uds-create-cli-linux-arm64-musl": "5.
|
|
62
|
-
"@yahoo/uds-create-cli-linux-x64-musl": "5.
|
|
57
|
+
"@yahoo/uds-create-cli-darwin-arm64": "5.108.0",
|
|
58
|
+
"@yahoo/uds-create-cli-darwin-x64": "5.108.0",
|
|
59
|
+
"@yahoo/uds-create-cli-linux-arm64": "5.108.0",
|
|
60
|
+
"@yahoo/uds-create-cli-linux-x64": "5.108.0",
|
|
61
|
+
"@yahoo/uds-create-cli-linux-arm64-musl": "5.108.0",
|
|
62
|
+
"@yahoo/uds-create-cli-linux-x64-musl": "5.108.0"
|
|
63
63
|
}
|
|
64
64
|
}
|
|
@@ -86801,12 +86801,13 @@ var TokenEntity = defineEntity({
|
|
|
86801
86801
|
get: {
|
|
86802
86802
|
input: external_exports.object({
|
|
86803
86803
|
path: pathInput("token"),
|
|
86804
|
-
detail: external_exports.enum(["full"]).optional().describe('`"full"` adds the token\'s stored body: its value, overrides and metadata as authored.')
|
|
86804
|
+
data: external_exports.object({ detail: external_exports.enum(["full"]).optional().describe('`"full"` adds the token\'s stored body: its value, overrides and metadata as authored.') }).optional()
|
|
86805
86805
|
}),
|
|
86806
86806
|
readOnly: true,
|
|
86807
86807
|
label: "Get",
|
|
86808
|
-
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.',
|
|
86808
|
+
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.',
|
|
86809
86809
|
scope: "item",
|
|
86810
|
+
example: ({ path: path2 }) => ({ path: path2 }),
|
|
86810
86811
|
handler: (input2, config2) => config2.resolve("token", String(input2.path))
|
|
86811
86812
|
},
|
|
86812
86813
|
create: { description: `Create a token at \`<group>/<name>\` \u2014 \`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.` }
|
|
@@ -89369,12 +89370,13 @@ var ComponentEntity = defineEntity({
|
|
|
89369
89370
|
get: {
|
|
89370
89371
|
input: external_exports.object({
|
|
89371
89372
|
path: pathInput("component"),
|
|
89372
|
-
detail: external_exports.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.')
|
|
89373
|
+
data: external_exports.strictObject({ detail: external_exports.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()
|
|
89373
89374
|
}),
|
|
89374
89375
|
readOnly: true,
|
|
89375
89376
|
label: "Get",
|
|
89376
|
-
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.',
|
|
89377
|
+
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.',
|
|
89377
89378
|
scope: "item",
|
|
89379
|
+
example: ({ path: path2 }) => ({ path: path2 }),
|
|
89378
89380
|
handler: (input2, config2) => config2.resolve("component", String(input2.path))
|
|
89379
89381
|
},
|
|
89380
89382
|
validate: {
|
|
@@ -92295,7 +92297,11 @@ function placedTypeRef({ type, slug: slug2, system, field }) {
|
|
|
92295
92297
|
type,
|
|
92296
92298
|
slug: slug2
|
|
92297
92299
|
});
|
|
92298
|
-
|
|
92300
|
+
const path2 = pathOf2(placed);
|
|
92301
|
+
if (kindOf2(placed) === "component" && !system.resolve("component", path2)) {
|
|
92302
|
+
const matches = system.list("component").filter((entry) => entry.path.endsWith(`/${path2}`));
|
|
92303
|
+
return rejectData(`The system has no component "${path2}".${matches.length === 1 ? ` Did you mean "${matches[0].path}"?` : ""}`, field);
|
|
92304
|
+
}
|
|
92299
92305
|
return placed;
|
|
92300
92306
|
}
|
|
92301
92307
|
function elementNodeFields({ element: element2, nodeId, slug: slug2, system, field }) {
|
|
@@ -93058,7 +93064,7 @@ var Entity = class {
|
|
|
93058
93064
|
};
|
|
93059
93065
|
|
|
93060
93066
|
// ../config/dist/framework/schema-version.js
|
|
93061
|
-
var CURRENT_SCHEMA_VERSION =
|
|
93067
|
+
var CURRENT_SCHEMA_VERSION = 20261117234103;
|
|
93062
93068
|
var SETTINGS_AS_KIND_VERSION = 20260908171448;
|
|
93063
93069
|
var SchemaVersionTooNew = class extends ConfigFormatError {
|
|
93064
93070
|
found;
|
|
@@ -93078,7 +93084,7 @@ function registerSchemaMigrations(...migrations) {
|
|
|
93078
93084
|
for (const migration of migrations) {
|
|
93079
93085
|
if (migration.version !== 1 && !isMintTimestamp(migration.version)) throw new Error(`Schema migration version ${migration.version} is not a mint timestamp \u2014 mint one with \`date +%Y%m%d%H%M%S\`, like a supabase migration.`);
|
|
93080
93086
|
if (REGISTERED.has(migration.version)) throw new Error(`A schema migration at version ${migration.version} is already registered.`);
|
|
93081
|
-
if (migration.version >
|
|
93087
|
+
if (migration.version > 20261117234103) throw new Error(`Schema migration ${migration.version} is newer than CURRENT_SCHEMA_VERSION (${CURRENT_SCHEMA_VERSION}) \u2014 a stale branch merged, or the mint forgot to bump the constant. Re-mint: set CURRENT_SCHEMA_VERSION to the newest migration version.`);
|
|
93082
93088
|
REGISTERED.set(migration.version, migration);
|
|
93083
93089
|
}
|
|
93084
93090
|
}
|
|
@@ -93109,7 +93115,7 @@ function pendingFor(version2, target2, options) {
|
|
|
93109
93115
|
return [...(options?.migrations ?? REGISTERED).values()].filter((m) => m.version > version2 && m.version <= target2).sort((a, b) => a.version - b.version);
|
|
93110
93116
|
}
|
|
93111
93117
|
function upgradeSerializedConfig(json2, options) {
|
|
93112
|
-
const target2 = options?.target ??
|
|
93118
|
+
const target2 = options?.target ?? 20261117234103;
|
|
93113
93119
|
const version2 = detectedWireVersion(json2);
|
|
93114
93120
|
if (version2 > target2) throw new SchemaVersionTooNew(version2, target2);
|
|
93115
93121
|
const raw = json2;
|
|
@@ -100401,7 +100407,7 @@ var Config = class Config2 {
|
|
|
100401
100407
|
* links from the provided sources. A declared `linkedKind` with no provided source throws. */
|
|
100402
100408
|
hydrateFrom(stored, options) {
|
|
100403
100409
|
const claimed = schemaVersionOf(stored);
|
|
100404
|
-
if (claimed >
|
|
100410
|
+
if (claimed > 20261117234103) throw new SchemaVersionTooNew(claimed);
|
|
100405
100411
|
const wire = upgradeSerializedConfig(stored);
|
|
100406
100412
|
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 \u2014 import the config type's module (e.g. \`configs/system\`) before hydrating.`);
|
|
100407
100413
|
const leftover = wire.options;
|
|
@@ -106977,6 +106983,15 @@ var motionTypesMigration = {
|
|
|
106977
106983
|
up: (json2) => json2
|
|
106978
106984
|
};
|
|
106979
106985
|
|
|
106986
|
+
// ../config/dist/migrations/20261117234103_uds_6038_mcp_inputs.js
|
|
106987
|
+
var UDS_6038_MCP_INPUTS_VERSION = 20261117234103;
|
|
106988
|
+
var uds6038McpInputsMigration = {
|
|
106989
|
+
version: UDS_6038_MCP_INPUTS_VERSION,
|
|
106990
|
+
up(json2) {
|
|
106991
|
+
return json2;
|
|
106992
|
+
}
|
|
106993
|
+
};
|
|
106994
|
+
|
|
106980
106995
|
// ../config/dist/configs/system.js
|
|
106981
106996
|
var System = defineConfig({
|
|
106982
106997
|
name: WEB_CONFIG_NAME,
|
|
@@ -107108,6 +107123,7 @@ if (!registeredSchemaMigrations().has(20261112145536)) registerSchemaMigrations(
|
|
|
107108
107123
|
if (!registeredSchemaMigrations().has(20261112154943)) registerSchemaMigrations(variantBooleansMigration);
|
|
107109
107124
|
if (!registeredSchemaMigrations().has(20261112163439)) registerSchemaMigrations(vendorLinkTypeMigration);
|
|
107110
107125
|
if (!registeredSchemaMigrations().has(20261113131930)) registerSchemaMigrations(styleSetOwnRuleOnlyMigration);
|
|
107126
|
+
if (!registeredSchemaMigrations().has(20261117234103)) registerSchemaMigrations(uds6038McpInputsMigration);
|
|
107111
107127
|
|
|
107112
107128
|
// ../config/dist/capture/node-ops.js
|
|
107113
107129
|
var DEFAULT_WIDTH = 1600;
|
|
@@ -107284,8 +107300,8 @@ var duplicateInput = external_exports.object({
|
|
|
107284
107300
|
var swapInput = external_exports.object({
|
|
107285
107301
|
path: pathInput("node"),
|
|
107286
107302
|
data: external_exports.object({
|
|
107287
|
-
/**
|
|
107288
|
-
type:
|
|
107303
|
+
/** A ref to the component to render instead. */
|
|
107304
|
+
type: Component
|
|
107289
107305
|
})
|
|
107290
107306
|
});
|
|
107291
107307
|
var moveInput = external_exports.object({
|
|
@@ -107455,7 +107471,10 @@ function placeUpdate(place, list) {
|
|
|
107455
107471
|
}
|
|
107456
107472
|
function subtreeOf(config2, path2) {
|
|
107457
107473
|
const out = [];
|
|
107474
|
+
const visited = /* @__PURE__ */ new Set();
|
|
107458
107475
|
const visit2 = (at) => {
|
|
107476
|
+
if (visited.has(at)) return;
|
|
107477
|
+
visited.add(at);
|
|
107459
107478
|
const body = config2.resolve("node", at)?.body;
|
|
107460
107479
|
if (!body) return;
|
|
107461
107480
|
for (const child of childrenOf(body)) visit2(pathOf2(child));
|
|
@@ -107465,13 +107484,59 @@ function subtreeOf(config2, path2) {
|
|
|
107465
107484
|
visit2(path2);
|
|
107466
107485
|
return out;
|
|
107467
107486
|
}
|
|
107487
|
+
function clearAndDeleteSubtrees(config2, roots) {
|
|
107488
|
+
const paths = [...new Set(roots.flatMap((path2) => subtreeOf(config2, path2)))];
|
|
107489
|
+
const deleting = new Set(paths);
|
|
107490
|
+
const unlinkParents = config2.list("node").flatMap((node2) => {
|
|
107491
|
+
const body = node2.body;
|
|
107492
|
+
const children = body.children?.filter((child) => !deleting.has(pathOf2(child)));
|
|
107493
|
+
const slots = body.slots ? Object.fromEntries(Object.entries(body.slots).map(([slot, fills]) => [slot, fills.filter((fill) => !deleting.has(pathOf2(fill)))])) : void 0;
|
|
107494
|
+
const childrenChanged = children?.length !== body.children?.length;
|
|
107495
|
+
const slotsChanged = Object.entries(body.slots ?? {}).some(([slot, fills]) => slots?.[slot]?.length !== fills.length);
|
|
107496
|
+
if (!childrenChanged && !slotsChanged) return [];
|
|
107497
|
+
return [{
|
|
107498
|
+
kind: "node",
|
|
107499
|
+
operation: "update",
|
|
107500
|
+
path: node2.path,
|
|
107501
|
+
data: {
|
|
107502
|
+
...childrenChanged ? { children } : {},
|
|
107503
|
+
...slotsChanged ? { slots } : {}
|
|
107504
|
+
}
|
|
107505
|
+
}];
|
|
107506
|
+
});
|
|
107507
|
+
const clears = paths.flatMap((path2) => {
|
|
107508
|
+
const body = config2.resolve("node", path2)?.body;
|
|
107509
|
+
if (!body) return [];
|
|
107510
|
+
return [{
|
|
107511
|
+
kind: "node",
|
|
107512
|
+
operation: "update",
|
|
107513
|
+
path: path2,
|
|
107514
|
+
data: {
|
|
107515
|
+
...body.children ? { children: [] } : {},
|
|
107516
|
+
...body.slots ? { slots: Object.fromEntries(Object.keys(body.slots).map((slot) => [slot, []])) } : {}
|
|
107517
|
+
}
|
|
107518
|
+
}];
|
|
107519
|
+
});
|
|
107520
|
+
return [
|
|
107521
|
+
...unlinkParents,
|
|
107522
|
+
...clears,
|
|
107523
|
+
...paths.map((path2) => ({
|
|
107524
|
+
kind: "node",
|
|
107525
|
+
operation: "delete",
|
|
107526
|
+
path: path2
|
|
107527
|
+
}))
|
|
107528
|
+
];
|
|
107529
|
+
}
|
|
107530
|
+
function deleteNodePatches(config2, path2) {
|
|
107531
|
+
if (!config2.resolve("node", path2)) {
|
|
107532
|
+
if (!config2.patches.some((patch) => patch.kind === "node" && patch.operation === "delete" && patch.path === path2)) reject("NOT_FOUND", `No node at "${path2}".`);
|
|
107533
|
+
return [];
|
|
107534
|
+
}
|
|
107535
|
+
return clearAndDeleteSubtrees(config2, [path2]);
|
|
107536
|
+
}
|
|
107468
107537
|
function remove(config2, input2) {
|
|
107469
107538
|
const place = placeOf(config2, input2.path, ["path"]);
|
|
107470
|
-
return [placeUpdate(place, place.list.filter((_, i) => i !== place.index)), ...
|
|
107471
|
-
kind: "node",
|
|
107472
|
-
operation: "delete",
|
|
107473
|
-
path: path2
|
|
107474
|
-
}))];
|
|
107539
|
+
return [placeUpdate(place, place.list.filter((_, i) => i !== place.index)), ...clearAndDeleteSubtrees(config2, [input2.path])];
|
|
107475
107540
|
}
|
|
107476
107541
|
function annotationsOn({ config: config2, paths }) {
|
|
107477
107542
|
return config2.list("annotation").map((note) => ({
|
|
@@ -107545,13 +107610,14 @@ function unwrap(config2, input2) {
|
|
|
107545
107610
|
function swap(config2, input2) {
|
|
107546
107611
|
const { slug: slug2, system } = attachedSystem(config2);
|
|
107547
107612
|
const body = bodyOf2(config2, input2.path, ["path"]);
|
|
107548
|
-
const
|
|
107549
|
-
|
|
107550
|
-
|
|
107551
|
-
});
|
|
107552
|
-
const component = system.resolve("component",
|
|
107553
|
-
if (!component) return rejectData(`The system has no component "${
|
|
107554
|
-
|
|
107613
|
+
const source = sourceOf2(input2.data.type);
|
|
107614
|
+
if (source && source !== slug2) return rejectData(`The component ref must target the attached system "${slug2}".`, ["data", "type"]);
|
|
107615
|
+
const componentPath = pathOf2(input2.data.type);
|
|
107616
|
+
const type = source ? input2.data.type : ref("component", `${componentPath}@${slug2}`);
|
|
107617
|
+
const component = system.resolve("component", componentPath);
|
|
107618
|
+
if (!component) return rejectData(`The system has no component "${componentPath}".`, ["data", "type"]);
|
|
107619
|
+
const children = childrenOf(body);
|
|
107620
|
+
const discardChildren = children.length > 0 && childrenPolicy(system, component.path) !== "nodes";
|
|
107555
107621
|
for (const [name, fills] of Object.entries(body.slots ?? {})) {
|
|
107556
107622
|
if (fills.length === 0) continue;
|
|
107557
107623
|
const slot = slotOf({
|
|
@@ -107573,9 +107639,14 @@ function swap(config2, input2) {
|
|
|
107573
107639
|
path: input2.path,
|
|
107574
107640
|
data: {
|
|
107575
107641
|
type,
|
|
107576
|
-
props
|
|
107642
|
+
props,
|
|
107643
|
+
...discardChildren ? { children: [] } : {}
|
|
107577
107644
|
}
|
|
107578
|
-
}
|
|
107645
|
+
}, ...discardChildren ? children.flatMap((child) => subtreeOf(config2, pathOf2(child)).reverse().map((path2) => ({
|
|
107646
|
+
kind: "node",
|
|
107647
|
+
operation: "delete",
|
|
107648
|
+
path: path2
|
|
107649
|
+
}))) : []];
|
|
107579
107650
|
}
|
|
107580
107651
|
function slotTakes({ config: config2, slot, fill }) {
|
|
107581
107652
|
const type = config2.resolve("node", pathOf2(fill))?.body?.type;
|
|
@@ -107764,17 +107835,14 @@ var nodeGestureOps = {
|
|
|
107764
107835
|
input: wrapInput,
|
|
107765
107836
|
readOnly: false,
|
|
107766
107837
|
label: "Wrap children in a container",
|
|
107767
|
-
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.
|
|
107838
|
+
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.`,
|
|
107768
107839
|
scope: "item",
|
|
107769
107840
|
title: (entity) => `Wrap children of ${entity}`,
|
|
107770
107841
|
example: () => ({
|
|
107771
107842
|
path: "card",
|
|
107772
107843
|
data: {
|
|
107773
107844
|
elements: ["card/title", "card/body"],
|
|
107774
|
-
container: {
|
|
107775
|
-
type: "VStack",
|
|
107776
|
-
props: { gap: "2" }
|
|
107777
|
-
}
|
|
107845
|
+
container: { type: "layout/VStack" }
|
|
107778
107846
|
}
|
|
107779
107847
|
}),
|
|
107780
107848
|
handler: (input2, config2) => applied2(config2, wrap(config2, wrapInput.parse(input2)))
|
|
@@ -107816,12 +107884,12 @@ var nodeGestureOps = {
|
|
|
107816
107884
|
input: swapInput,
|
|
107817
107885
|
readOnly: false,
|
|
107818
107886
|
label: "Swap an element for another component",
|
|
107819
|
-
description:
|
|
107887
|
+
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.",
|
|
107820
107888
|
scope: "item",
|
|
107821
107889
|
title: (entity) => `Swap ${entity}`,
|
|
107822
107890
|
example: () => ({
|
|
107823
107891
|
path: "card/row",
|
|
107824
|
-
data: { type: "VStack" }
|
|
107892
|
+
data: { type: Component.ref("VStack") }
|
|
107825
107893
|
}),
|
|
107826
107894
|
handler: (input2, config2) => applied2(config2, swap(config2, swapInput.parse(input2)))
|
|
107827
107895
|
},
|
|
@@ -107975,6 +108043,67 @@ var elementType = external_exports.union([
|
|
|
107975
108043
|
external_exports.object({ __ref: external_exports.enum(["spec:Slot", "spec:Fragment"]) })
|
|
107976
108044
|
]);
|
|
107977
108045
|
var nodeRef = external_exports.lazy(() => Node);
|
|
108046
|
+
var NODE_LIST_LIMIT = 50;
|
|
108047
|
+
var nodeListInput = external_exports.object({
|
|
108048
|
+
page: external_exports.string().min(1).optional().describe("Only nodes on this page and their descendants."),
|
|
108049
|
+
under: external_exports.string().min(1).optional().describe("Only this node and its descendants."),
|
|
108050
|
+
offset: external_exports.number().int().min(0).optional().default(0),
|
|
108051
|
+
limit: external_exports.number().int().min(1).max(100).optional().default(NODE_LIST_LIMIT)
|
|
108052
|
+
});
|
|
108053
|
+
var nodeSearchInput = nodeListInput.extend({ query: external_exports.string().min(1).describe("Text to find in node names, types, and props.") });
|
|
108054
|
+
function namedPath(value, kind) {
|
|
108055
|
+
if (!value) return void 0;
|
|
108056
|
+
return value.startsWith(`${kind}:`) ? pathOf2(value) : value;
|
|
108057
|
+
}
|
|
108058
|
+
function nodePagePath(body) {
|
|
108059
|
+
const page = body.page;
|
|
108060
|
+
return page && typeof page === "object" && "__ref" in page ? pathOf2(page) : void 0;
|
|
108061
|
+
}
|
|
108062
|
+
function containsText(value, query) {
|
|
108063
|
+
if (typeof value === "string") return value.toLowerCase().includes(query);
|
|
108064
|
+
if (Array.isArray(value)) return value.some((entry) => containsText(entry, query));
|
|
108065
|
+
if (value && typeof value === "object") return Object.entries(value).some(([key2, entry]) => key2.toLowerCase().includes(query) || containsText(entry, query));
|
|
108066
|
+
return false;
|
|
108067
|
+
}
|
|
108068
|
+
function nodeSummaries(config2, input2) {
|
|
108069
|
+
const page = namedPath(typeof input2.page === "string" ? input2.page : void 0, "page");
|
|
108070
|
+
const under = namedPath(typeof input2.under === "string" ? input2.under : void 0, "node");
|
|
108071
|
+
const query = typeof input2.query === "string" ? input2.query.toLowerCase() : void 0;
|
|
108072
|
+
const offset = Number(input2.offset ?? 0);
|
|
108073
|
+
const limit = Number(input2.limit ?? NODE_LIST_LIMIT);
|
|
108074
|
+
const nodes = config2.list("node").filter((node2) => {
|
|
108075
|
+
if (under && node2.path !== under && !node2.path.startsWith(`${under}/`)) return false;
|
|
108076
|
+
if (page) {
|
|
108077
|
+
const root = node2.path.split("/")[0] ?? node2.path;
|
|
108078
|
+
const rootBody = config2.resolve("node", root)?.body;
|
|
108079
|
+
if (!rootBody || nodePagePath(rootBody) !== page) return false;
|
|
108080
|
+
}
|
|
108081
|
+
if (!query) return true;
|
|
108082
|
+
const body = node2.body;
|
|
108083
|
+
const type = body.type;
|
|
108084
|
+
const typePath = type && typeof type === "object" && "__ref" in type ? pathOf2(type) : "";
|
|
108085
|
+
return node2.path.toLowerCase().includes(query) || String(node2.displayLabel ?? "").toLowerCase().includes(query) || typePath.toLowerCase().includes(query) || containsText(body.props, query);
|
|
108086
|
+
});
|
|
108087
|
+
const selected = nodes.slice(offset, offset + limit);
|
|
108088
|
+
return {
|
|
108089
|
+
total: nodes.length,
|
|
108090
|
+
offset,
|
|
108091
|
+
limit,
|
|
108092
|
+
nextOffset: offset + selected.length < nodes.length ? offset + selected.length : null,
|
|
108093
|
+
nodes: selected.map((node2) => {
|
|
108094
|
+
const body = node2.body;
|
|
108095
|
+
const type = body.type;
|
|
108096
|
+
const pageRef = body.page;
|
|
108097
|
+
return {
|
|
108098
|
+
path: node2.path,
|
|
108099
|
+
...typeof node2.displayLabel === "string" ? { displayLabel: node2.displayLabel } : {},
|
|
108100
|
+
...typeof body.label === "string" ? { label: body.label } : {},
|
|
108101
|
+
...type && typeof type === "object" && "__ref" in type ? { type: pathOf2(type) } : {},
|
|
108102
|
+
...pageRef && typeof pageRef === "object" && "__ref" in pageRef ? { page: pathOf2(pageRef) } : {}
|
|
108103
|
+
};
|
|
108104
|
+
})
|
|
108105
|
+
};
|
|
108106
|
+
}
|
|
107978
108107
|
var Size = external_exports.discriminatedUnion("type", [external_exports.object({
|
|
107979
108108
|
type: external_exports.literal("custom"),
|
|
107980
108109
|
width: external_exports.number(),
|
|
@@ -107987,14 +108116,51 @@ var Node = defineEntity({
|
|
|
107987
108116
|
kind: "node",
|
|
107988
108117
|
schemas: {
|
|
107989
108118
|
...captureNodeOps,
|
|
107990
|
-
...nodeGestureOps
|
|
108119
|
+
...nodeGestureOps,
|
|
108120
|
+
update: { description: "Update addressed node fields. Supplying `data.props` replaces the whole props bag; use `data.props.<name>` to change one prop." },
|
|
108121
|
+
delete: {
|
|
108122
|
+
input: external_exports.object({ path: pathInput("node") }),
|
|
108123
|
+
readOnly: false,
|
|
108124
|
+
label: "Delete",
|
|
108125
|
+
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.",
|
|
108126
|
+
scope: "item",
|
|
108127
|
+
approval: "destructive",
|
|
108128
|
+
example: ({ config: config2 }) => {
|
|
108129
|
+
const node2 = config2.list("node")[0];
|
|
108130
|
+
return node2 ? { path: node2.path } : void 0;
|
|
108131
|
+
},
|
|
108132
|
+
handler: (input2, config2) => {
|
|
108133
|
+
return deleteNodePatches(config2, String(input2.path)).reduce((next, patch) => next.apply(patch), config2);
|
|
108134
|
+
}
|
|
108135
|
+
},
|
|
108136
|
+
list: {
|
|
108137
|
+
input: nodeListInput,
|
|
108138
|
+
readOnly: true,
|
|
108139
|
+
label: "List",
|
|
108140
|
+
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.",
|
|
108141
|
+
scope: "collection",
|
|
108142
|
+
example: () => ({ limit: 20 }),
|
|
108143
|
+
handler: (input2, config2) => nodeSummaries(config2, input2)
|
|
108144
|
+
},
|
|
108145
|
+
search: {
|
|
108146
|
+
input: nodeSearchInput,
|
|
108147
|
+
readOnly: true,
|
|
108148
|
+
label: "Search",
|
|
108149
|
+
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.",
|
|
108150
|
+
scope: "collection",
|
|
108151
|
+
example: () => ({
|
|
108152
|
+
query: "header",
|
|
108153
|
+
limit: 20
|
|
108154
|
+
}),
|
|
108155
|
+
handler: (input2, config2) => nodeSummaries(config2, input2)
|
|
108156
|
+
}
|
|
107991
108157
|
},
|
|
107992
108158
|
fields: external_exports.object({
|
|
107993
108159
|
/** A real ref, never a bare name — dependents()/rename-cascade need a real edge, and a bare
|
|
107994
108160
|
* `kind:path` string the framework never walks gives neither. Absent only on a placeholder
|
|
107995
108161
|
* awaiting generation. */
|
|
107996
108162
|
type: elementType.optional(),
|
|
107997
|
-
props: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
|
|
108163
|
+
props: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe("The props bag. Supplying `props` in `node/update` replaces this whole bag; use `props.<name>` to update one prop."),
|
|
107998
108164
|
/** The default slot's fill — refs to this node's subtree nodes. */
|
|
107999
108165
|
children: external_exports.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(),
|
|
108000
108166
|
/** Named slots — never folded into `props`; see symptom 5 in the design doc for why. */
|