webstudio 0.280.0 → 0.280.1

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/lib/cli.js CHANGED
@@ -72782,7 +72782,8 @@ const runtimeOperationContractData = [
72782
72782
  items: {
72783
72783
  type: "string",
72784
72784
  minLength: 1
72785
- }
72785
+ },
72786
+ description: 'Leaf-to-root occurrence path. The first id is the instance to extract, the second is its direct parent, and any remaining ids are successive ancestors toward the page root. Use the id and parentId returned by list-instances; for a section directly under Body, pass ["section-id", "body-id"].'
72786
72787
  },
72787
72788
  label: {
72788
72789
  type: "string",
@@ -121572,7 +121573,9 @@ const attachSharedSlotInput = z$2.object({
121572
121573
  label: z$2.string().min(1).optional()
121573
121574
  });
121574
121575
  const extractSharedSlotInput = z$2.object({
121575
- instanceSelector: z$2.array(z$2.string().min(1)).min(2),
121576
+ instanceSelector: z$2.array(z$2.string().min(1)).min(2).describe(
121577
+ 'Leaf-to-root occurrence path. The first id is the instance to extract, the second is its direct parent, and any remaining ids are successive ancestors toward the page root. Use the id and parentId returned by list-instances; for a section directly under Body, pass ["section-id", "body-id"].'
121578
+ ),
121576
121579
  label: z$2.string().min(1).optional()
121577
121580
  });
121578
121581
  const areInstanceChildrenEqual = (left, right) => {
@@ -121746,7 +121749,7 @@ const extractSharedSlot$1 = (state, input2, context) => {
121746
121749
  if (childIndex === -1) {
121747
121750
  return throwBuilderRuntimeError(
121748
121751
  "BAD_REQUEST",
121749
- "Instance selector does not identify a direct parent"
121752
+ 'instanceSelector must use leaf-to-root order: instanceSelector[1] must be the direct parent of instanceSelector[0]. Use the selected instance id followed by its parentId from list-instances, for example ["section-id", "body-id"].'
121750
121753
  );
121751
121754
  }
121752
121755
  const fragment = {
@@ -187589,6 +187592,34 @@ const isFragmentContentModeCopyableProp = ({
187589
187592
  });
187590
187593
  return isContentModeCopyableProp({ capabilities, prop: prop2 });
187591
187594
  };
187595
+ const parentInstanceByIdCache = /* @__PURE__ */ new WeakMap();
187596
+ const findPageAndSelectorByInstanceId = (pages2, instances, startingInstanceId) => {
187597
+ let parentInstanceById = parentInstanceByIdCache.get(instances);
187598
+ if (parentInstanceById === void 0) {
187599
+ parentInstanceById = /* @__PURE__ */ new Map();
187600
+ for (const instance2 of instances.values()) {
187601
+ for (const child of instance2.children ?? []) {
187602
+ if (child.type === "id") {
187603
+ parentInstanceById.set(child.value, instance2.id);
187604
+ }
187605
+ }
187606
+ }
187607
+ parentInstanceByIdCache.set(instances, parentInstanceById);
187608
+ }
187609
+ const instanceSelector = [];
187610
+ let currentInstanceId = startingInstanceId;
187611
+ while (currentInstanceId) {
187612
+ instanceSelector.push(currentInstanceId);
187613
+ currentInstanceId = parentInstanceById.get(currentInstanceId);
187614
+ }
187615
+ const rootInstanceId = instanceSelector.at(-1);
187616
+ for (const page2 of getAllPages(pages2)) {
187617
+ if (page2.rootInstanceId === rootInstanceId) {
187618
+ return { pageId: page2.id, instanceSelector };
187619
+ }
187620
+ }
187621
+ return { pageId: pages2.homePageId, instanceSelector };
187622
+ };
187592
187623
  const conflictResolutionInput = z$2.enum(["ours", "theirs", "merge"]);
187593
187624
  const insertComponentInput = z$2.object({
187594
187625
  parentInstanceId: z$2.string(),
@@ -187651,9 +187682,17 @@ const canContainDescendant = (ancestorComponent, descendantComponent2, visited =
187651
187682
  (descendant) => typeof descendant === "string" && componentMetas.has(descendant) && canContainDescendant(descendant, descendantComponent2, visited)
187652
187683
  );
187653
187684
  };
187654
- const getStandaloneInsertError = (component) => {
187655
- const meta2 = componentMetas.get(component);
187656
- if (meta2?.contentModel?.category !== "none") {
187685
+ const getComponentPartInsertError = ({
187686
+ component,
187687
+ ancestors
187688
+ }) => {
187689
+ const [parent] = ancestors;
187690
+ const allowedChildren = parent === void 0 ? [] : componentMetas.get(parent.component)?.contentModel?.children ?? [];
187691
+ const allowedByAncestor = ancestors.some((ancestor) => {
187692
+ const descendants = componentMetas.get(ancestor.component)?.contentModel?.descendants ?? [];
187693
+ return descendants.includes(component) || descendants.includes("none");
187694
+ });
187695
+ if (allowedChildren.includes(component) || allowedChildren.includes("none") || allowedByAncestor) {
187657
187696
  return;
187658
187697
  }
187659
187698
  const suggestions = Array.from(componentMetas.entries()).filter(([candidateComponent, candidateMeta]) => {
@@ -188232,7 +188271,21 @@ const insertComponent$1 = (state, input2, context) => {
188232
188271
  const fragment = createComponentTemplateFragment({
188233
188272
  component: input2.component,
188234
188273
  templates: templates2,
188235
- getFallbackError: getStandaloneInsertError,
188274
+ getFallbackError: (component) => {
188275
+ if (componentMetas.get(component)?.contentModel?.category !== "none") {
188276
+ return;
188277
+ }
188278
+ const { instanceSelector } = findPageAndSelectorByInstanceId(
188279
+ mutationState.pages,
188280
+ mutationState.instances,
188281
+ parent.id
188282
+ );
188283
+ const ancestors = instanceSelector.flatMap((instanceId2) => {
188284
+ const instance2 = mutationState.instances.get(instanceId2);
188285
+ return instance2 === void 0 ? [] : [instance2];
188286
+ });
188287
+ return getComponentPartInsertError({ component, ancestors });
188288
+ },
188236
188289
  createId: context.createId
188237
188290
  });
188238
188291
  if (input2.component === elementComponent) {
@@ -215525,6 +215578,16 @@ const mcpArgumentExamples = {
215525
215578
  component: "@webstudio-is/sdk-components-react-radix:Switch"
215526
215579
  }
215527
215580
  ],
215581
+ "extract-slot": [
215582
+ {
215583
+ instanceSelector: ["header-section-id", "body-id"],
215584
+ label: "Site header"
215585
+ },
215586
+ {
215587
+ instanceSelector: ["header-section-id", "page-wrapper-id", "body-id"],
215588
+ label: "Site header"
215589
+ }
215590
+ ],
215528
215591
  "insert-collection": [
215529
215592
  {
215530
215593
  parentInstanceId: "parent-id",
@@ -220904,9 +220967,10 @@ const curatedPublicApiOperationDocumentation = [
220904
220967
  },
220905
220968
  {
220906
220969
  command: "extract-slot",
220907
- description: "Convert an existing instance subtree into shared Slot content without cloning it",
220970
+ description: "Convert an existing instance subtree into shared Slot content without cloning it. instanceSelector is a leaf-to-root occurrence path: start with the instance to extract, then its direct parent, then each successive ancestor toward the page root. Use the id and parentId relationships returned by list-instances. The first example extracts a section directly under Body; the second extracts a section nested in a page wrapper.",
220908
220971
  examples: [
220909
- 'MCP tool: extract-slot {"instanceSelector":["instance-id","parent-id","root-id"],"label":"Site header"}'
220972
+ 'MCP tool: extract-slot {"instanceSelector":["header-section-id","body-id"],"label":"Site header"}',
220973
+ 'MCP tool: extract-slot {"instanceSelector":["header-section-id","page-wrapper-id","body-id"],"label":"Site header"}'
220910
220974
  ]
220911
220975
  },
220912
220976
  {
@@ -222771,7 +222835,7 @@ class HandledCliError extends Error {
222771
222835
  }
222772
222836
  const isHandledCliError = (error) => error instanceof HandledCliError;
222773
222837
  const name = "webstudio";
222774
- const version = "0.280.0";
222838
+ const version = "0.280.1";
222775
222839
  const description = "Webstudio CLI";
222776
222840
  const author = "Webstudio <github@webstudio.is>";
222777
222841
  const homepage = "https://webstudio.is";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webstudio",
3
- "version": "0.280.0",
3
+ "version": "0.280.1",
4
4
  "description": "Webstudio CLI",
5
5
  "author": "Webstudio <github@webstudio.is>",
6
6
  "homepage": "https://webstudio.is",
@@ -44,10 +44,10 @@
44
44
  "warn-once": "^0.1.1",
45
45
  "yargs": "^17.7.2",
46
46
  "zod": "^4.4.3",
47
- "@webstudio-is/http-client": "0.280.0",
48
- "@webstudio-is/protocol": "0.280.0",
49
- "@webstudio-is/sync-client": "0.0.0",
50
- "@webstudio-is/project-migrations": "0.280.0"
47
+ "@webstudio-is/http-client": "0.280.1",
48
+ "@webstudio-is/project-migrations": "0.280.1",
49
+ "@webstudio-is/protocol": "0.280.1",
50
+ "@webstudio-is/sync-client": "0.0.0"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@cloudflare/vite-plugin": "^1.1.0",
@@ -85,19 +85,19 @@
85
85
  "vite": "^6.3.4",
86
86
  "vitest": "^3.1.2",
87
87
  "wrangler": "^3.63.2",
88
+ "@webstudio-is/css-engine": "0.280.1",
88
89
  "@webstudio-is/project-build": "0.0.0",
89
- "@webstudio-is/react-sdk": "0.280.0",
90
- "@webstudio-is/image": "0.280.0",
91
- "@webstudio-is/css-engine": "0.280.0",
92
- "@webstudio-is/sdk": "0.280.0",
93
- "@webstudio-is/sdk-components-animation": "0.280.0",
94
- "@webstudio-is/sdk-components-react": "0.280.0",
95
- "@webstudio-is/sdk-components-react-radix": "0.280.0",
96
- "@webstudio-is/sdk-components-react-remix": "0.280.0",
97
- "@webstudio-is/sdk-components-react-router": "0.280.0",
98
- "@webstudio-is/sdk-components-registry": "0.280.0",
99
- "@webstudio-is/wsauth": "0.280.0",
100
- "@webstudio-is/tsconfig": "1.0.7"
90
+ "@webstudio-is/react-sdk": "0.280.1",
91
+ "@webstudio-is/image": "0.280.1",
92
+ "@webstudio-is/sdk": "0.280.1",
93
+ "@webstudio-is/sdk-components-animation": "0.280.1",
94
+ "@webstudio-is/sdk-components-react": "0.280.1",
95
+ "@webstudio-is/sdk-components-react-router": "0.280.1",
96
+ "@webstudio-is/sdk-components-registry": "0.280.1",
97
+ "@webstudio-is/sdk-components-react-radix": "0.280.1",
98
+ "@webstudio-is/tsconfig": "1.0.7",
99
+ "@webstudio-is/sdk-components-react-remix": "0.280.1",
100
+ "@webstudio-is/wsauth": "0.280.1"
101
101
  },
102
102
  "scripts": {
103
103
  "typecheck": "tsc --noEmit",
@@ -12,7 +12,7 @@
12
12
  "build-cf-types": "wrangler types"
13
13
  },
14
14
  "dependencies": {
15
- "@webstudio-is/wsauth": "0.280.0",
15
+ "@webstudio-is/wsauth": "0.280.1",
16
16
  "@remix-run/cloudflare": "2.16.5",
17
17
  "@remix-run/cloudflare-pages": "2.16.5"
18
18
  },
@@ -11,14 +11,14 @@
11
11
  "@remix-run/node": "2.16.5",
12
12
  "@remix-run/react": "2.16.5",
13
13
  "@remix-run/server-runtime": "2.16.5",
14
- "@webstudio-is/image": "0.280.0",
15
- "@webstudio-is/react-sdk": "0.280.0",
16
- "@webstudio-is/sdk": "0.280.0",
17
- "@webstudio-is/sdk-components-react": "0.280.0",
18
- "@webstudio-is/sdk-components-animation": "0.280.0",
19
- "@webstudio-is/sdk-components-react-radix": "0.280.0",
20
- "@webstudio-is/sdk-components-react-remix": "0.280.0",
21
- "@webstudio-is/wsauth": "0.280.0",
14
+ "@webstudio-is/image": "0.280.1",
15
+ "@webstudio-is/react-sdk": "0.280.1",
16
+ "@webstudio-is/sdk": "0.280.1",
17
+ "@webstudio-is/sdk-components-react": "0.280.1",
18
+ "@webstudio-is/sdk-components-animation": "0.280.1",
19
+ "@webstudio-is/sdk-components-react-radix": "0.280.1",
20
+ "@webstudio-is/sdk-components-react-remix": "0.280.1",
21
+ "@webstudio-is/wsauth": "0.280.1",
22
22
  "isbot": "^5.1.25",
23
23
  "react": "18.3.0-canary-14898b6a9-20240318",
24
24
  "react-dom": "18.3.0-canary-14898b6a9-20240318"
@@ -13,14 +13,14 @@
13
13
  "@react-router/fs-routes": "^7.5.3",
14
14
  "@react-router/node": "^7.5.3",
15
15
  "@react-router/serve": "^7.5.3",
16
- "@webstudio-is/image": "0.280.0",
17
- "@webstudio-is/react-sdk": "0.280.0",
18
- "@webstudio-is/sdk": "0.280.0",
19
- "@webstudio-is/sdk-components-animation": "0.280.0",
20
- "@webstudio-is/sdk-components-react-radix": "0.280.0",
21
- "@webstudio-is/sdk-components-react-router": "0.280.0",
22
- "@webstudio-is/sdk-components-react": "0.280.0",
23
- "@webstudio-is/wsauth": "0.280.0",
16
+ "@webstudio-is/image": "0.280.1",
17
+ "@webstudio-is/react-sdk": "0.280.1",
18
+ "@webstudio-is/sdk": "0.280.1",
19
+ "@webstudio-is/sdk-components-animation": "0.280.1",
20
+ "@webstudio-is/sdk-components-react-radix": "0.280.1",
21
+ "@webstudio-is/sdk-components-react-router": "0.280.1",
22
+ "@webstudio-is/sdk-components-react": "0.280.1",
23
+ "@webstudio-is/wsauth": "0.280.1",
24
24
  "isbot": "^5.1.25",
25
25
  "react": "18.3.0-canary-14898b6a9-20240318",
26
26
  "react-dom": "18.3.0-canary-14898b6a9-20240318",
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "dependencies": {
9
9
  "@cloudflare/vite-plugin": "^1.1.0",
10
- "@webstudio-is/wsauth": "0.280.0",
10
+ "@webstudio-is/wsauth": "0.280.1",
11
11
  "wrangler": "^4.14.1"
12
12
  }
13
13
  }
@@ -9,12 +9,12 @@
9
9
  "typecheck": "tsc --noEmit"
10
10
  },
11
11
  "dependencies": {
12
- "@webstudio-is/image": "0.280.0",
13
- "@webstudio-is/react-sdk": "0.280.0",
14
- "@webstudio-is/sdk": "0.280.0",
15
- "@webstudio-is/sdk-components-react": "0.280.0",
16
- "@webstudio-is/sdk-components-animation": "0.280.0",
17
- "@webstudio-is/sdk-components-react-radix": "0.280.0",
12
+ "@webstudio-is/image": "0.280.1",
13
+ "@webstudio-is/react-sdk": "0.280.1",
14
+ "@webstudio-is/sdk": "0.280.1",
15
+ "@webstudio-is/sdk-components-react": "0.280.1",
16
+ "@webstudio-is/sdk-components-animation": "0.280.1",
17
+ "@webstudio-is/sdk-components-react-radix": "0.280.1",
18
18
  "react": "18.3.0-canary-14898b6a9-20240318",
19
19
  "react-dom": "18.3.0-canary-14898b6a9-20240318",
20
20
  "vike": "^0.4.229"