@pixerate/editor 0.80.0 → 0.82.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.
Files changed (107) hide show
  1. package/README.md +13 -3
  2. package/dist/agent/index.cjs +138 -13
  3. package/dist/agent/index.cjs.map +1 -1
  4. package/dist/agent/index.d.cts +9 -5
  5. package/dist/agent/index.d.ts +9 -5
  6. package/dist/agent/index.js +144 -19
  7. package/dist/agent/index.js.map +1 -1
  8. package/dist/animation-editor/index.d.cts +1 -1
  9. package/dist/animation-editor/index.d.ts +1 -1
  10. package/dist/bridge/index.d.cts +3 -3
  11. package/dist/bridge/index.d.ts +3 -3
  12. package/dist/{bridge-client-C5dRjrz5.d.ts → bridge-client-CMGfnjTl.d.ts} +1 -1
  13. package/dist/{bridge-client-C5OziCRK.d.cts → bridge-client-VpnICVxP.d.cts} +1 -1
  14. package/dist/{builtins-BKYlHH1s.d.ts → builtins-CV1fDj64.d.ts} +5 -1
  15. package/dist/{builtins-1kqwLUnb.d.cts → builtins-c4w0eAYl.d.cts} +5 -1
  16. package/dist/canvas/index.cjs +235 -104
  17. package/dist/canvas/index.cjs.map +1 -1
  18. package/dist/canvas/index.d.cts +59 -1
  19. package/dist/canvas/index.d.ts +59 -1
  20. package/dist/canvas/index.js +234 -103
  21. package/dist/canvas/index.js.map +1 -1
  22. package/dist/capture-DFEMFmVt.d.cts +133 -0
  23. package/dist/capture-wwNGaW05.d.ts +133 -0
  24. package/dist/chart/index.d.cts +1 -1
  25. package/dist/chart/index.d.ts +1 -1
  26. package/dist/{chunk-2CJ3LPYQ.js → chunk-424H3P4I.js} +13 -295
  27. package/dist/chunk-424H3P4I.js.map +1 -0
  28. package/dist/{chunk-K73CKYUM.cjs → chunk-EI2MOVQ3.cjs} +198 -3
  29. package/dist/chunk-EI2MOVQ3.cjs.map +1 -0
  30. package/dist/chunk-FURT6ZFZ.cjs +1 -0
  31. package/dist/chunk-FURT6ZFZ.cjs.map +1 -0
  32. package/dist/{chunk-GPWNYQ7R.js → chunk-O2W2SP3C.js} +197 -2
  33. package/dist/chunk-O2W2SP3C.js.map +1 -0
  34. package/dist/{chunk-UN33YOXW.cjs → chunk-PA5S7KPC.cjs} +293 -2
  35. package/dist/chunk-PA5S7KPC.cjs.map +1 -0
  36. package/dist/{chunk-IB3ZHQAX.js → chunk-PTYWCFFW.js} +29 -4
  37. package/dist/chunk-PTYWCFFW.js.map +1 -0
  38. package/dist/{chunk-JQ3BB3E6.js → chunk-PXDEFEG2.js} +293 -2
  39. package/dist/chunk-PXDEFEG2.js.map +1 -0
  40. package/dist/chunk-REOJJIY3.js +201 -0
  41. package/dist/chunk-REOJJIY3.js.map +1 -0
  42. package/dist/chunk-RJ2BFKEN.js +1 -0
  43. package/dist/chunk-RJ2BFKEN.js.map +1 -0
  44. package/dist/{chunk-YU4WQE5M.cjs → chunk-TAPXWP2B.cjs} +95 -377
  45. package/dist/chunk-TAPXWP2B.cjs.map +1 -0
  46. package/dist/{chunk-HXDMZQTD.cjs → chunk-TPOT575P.cjs} +29 -4
  47. package/dist/{chunk-IB3ZHQAX.js.map → chunk-TPOT575P.cjs.map} +1 -1
  48. package/dist/chunk-VJUVNERT.cjs +201 -0
  49. package/dist/chunk-VJUVNERT.cjs.map +1 -0
  50. package/dist/commands/index.cjs +2 -2
  51. package/dist/commands/index.d.cts +2 -2
  52. package/dist/commands/index.d.ts +2 -2
  53. package/dist/commands/index.js +1 -1
  54. package/dist/diagram/index.d.cts +1 -1
  55. package/dist/diagram/index.d.ts +1 -1
  56. package/dist/dom-capture-7Wvf6Tyg.d.ts +59 -0
  57. package/dist/dom-capture-GyYuE-zq.d.cts +59 -0
  58. package/dist/generation/index.cjs +932 -791
  59. package/dist/generation/index.cjs.map +1 -1
  60. package/dist/generation/index.d.cts +268 -242
  61. package/dist/generation/index.d.ts +268 -242
  62. package/dist/generation/index.js +926 -785
  63. package/dist/generation/index.js.map +1 -1
  64. package/dist/image-editor/index.cjs +362 -2
  65. package/dist/image-editor/index.cjs.map +1 -1
  66. package/dist/image-editor/index.d.cts +35 -2
  67. package/dist/image-editor/index.d.ts +35 -2
  68. package/dist/image-editor/index.js +361 -1
  69. package/dist/image-editor/index.js.map +1 -1
  70. package/dist/index.cjs +3 -3
  71. package/dist/index.cjs.map +1 -1
  72. package/dist/index.js +16 -16
  73. package/dist/{registry-DIpIaCkH.d.cts → registry-BqA1AZt0.d.cts} +1 -1
  74. package/dist/{registry-7AZFuand.d.ts → registry-D-4fit9C.d.ts} +1 -1
  75. package/dist/spreadsheet/index.cjs +3 -3
  76. package/dist/spreadsheet/index.cjs.map +1 -1
  77. package/dist/spreadsheet/index.js +16 -16
  78. package/dist/tools/index.cjs +33 -4
  79. package/dist/tools/index.cjs.map +1 -1
  80. package/dist/tools/index.d.cts +4 -2
  81. package/dist/tools/index.d.ts +4 -2
  82. package/dist/tools/index.js +43 -14
  83. package/dist/video-editor/index.d.cts +1 -1
  84. package/dist/video-editor/index.d.ts +1 -1
  85. package/package.json +2 -1
  86. package/skills/README.md +55 -0
  87. package/skills/pixerate-agent-tools/SKILL.md +75 -0
  88. package/skills/pixerate-animation-editor/SKILL.md +155 -0
  89. package/skills/pixerate-animation-editor/references/commands.md +123 -0
  90. package/skills/pixerate-canvas/SKILL.md +231 -0
  91. package/skills/pixerate-chart/SKILL.md +190 -0
  92. package/skills/pixerate-diagram/SKILL.md +134 -0
  93. package/skills/pixerate-generation/SKILL.md +109 -0
  94. package/skills/pixerate-image-editor/SKILL.md +140 -0
  95. package/skills/pixerate-parameters/SKILL.md +83 -0
  96. package/skills/pixerate-rich-text/SKILL.md +160 -0
  97. package/skills/pixerate-spreadsheet/SKILL.md +146 -0
  98. package/skills/pixerate-vector/SKILL.md +191 -0
  99. package/skills/pixerate-vector/references/commands.md +138 -0
  100. package/skills/pixerate-video-editor/SKILL.md +173 -0
  101. package/dist/chunk-2CJ3LPYQ.js.map +0 -1
  102. package/dist/chunk-GPWNYQ7R.js.map +0 -1
  103. package/dist/chunk-HXDMZQTD.cjs.map +0 -1
  104. package/dist/chunk-JQ3BB3E6.js.map +0 -1
  105. package/dist/chunk-K73CKYUM.cjs.map +0 -1
  106. package/dist/chunk-UN33YOXW.cjs.map +0 -1
  107. package/dist/chunk-YU4WQE5M.cjs.map +0 -1
@@ -8,7 +8,23 @@ import {
8
8
  getLayoutedNodes,
9
9
  placeBeside
10
10
  } from "../chunk-VHZCXHS4.js";
11
+ import "../chunk-RJ2BFKEN.js";
11
12
  import {
13
+ JSON_RPC_ERRORS,
14
+ MCP_PROTOCOL_VERSIONS,
15
+ TOOL_BRIDGE_DEFAULT_PORT,
16
+ TOOL_BRIDGE_PROTOCOL,
17
+ TOOL_NAMESPACE_SEPARATOR,
18
+ ToolRegistry,
19
+ ToolRegistryError,
20
+ connectToolBridge,
21
+ createMcpServer,
22
+ createToolRegistry,
23
+ toToolResult
24
+ } from "../chunk-PTMIGXZ2.js";
25
+ import {
26
+ CAPTURE_EXCLUDE_SELECTOR,
27
+ CAPTURE_OVERLAY_SELECTORS,
12
28
  EDITOR_CANVAS_TOOLS,
13
29
  EDITOR_MCP_TOOLS,
14
30
  EDITOR_PROMPT_TOOLS,
@@ -28,24 +44,24 @@ import {
28
44
  MCP_TOOL_PROMPT_REPLACE_RANGE,
29
45
  MCP_TOOL_PROMPT_SELECT,
30
46
  MCP_TOOL_PROMPT_SET_VARIABLE,
31
- MCP_TOOL_VIEW_EDITOR
32
- } from "../chunk-GPWNYQ7R.js";
47
+ MCP_TOOL_VIEW_EDITOR,
48
+ cloneElementWithStyles,
49
+ createElementCaptureSurface,
50
+ elementToSvg,
51
+ rasterizeElement
52
+ } from "../chunk-O2W2SP3C.js";
33
53
  import {
34
- JSON_RPC_ERRORS,
35
- MCP_PROTOCOL_VERSIONS,
36
- TOOL_BRIDGE_DEFAULT_PORT,
37
- TOOL_BRIDGE_PROTOCOL,
38
- TOOL_NAMESPACE_SEPARATOR,
39
- ToolRegistry,
40
- ToolRegistryError,
41
- connectToolBridge,
42
- createMcpServer,
43
- createToolRegistry,
44
- toToolResult
45
- } from "../chunk-PTMIGXZ2.js";
54
+ captureInputSchema,
55
+ captureOutputSize,
56
+ createCaptureTool,
57
+ createCaptureToolProvider,
58
+ resolveCaptureRequest,
59
+ toCapturedImageData,
60
+ unionCaptureRects
61
+ } from "../chunk-REOJJIY3.js";
46
62
  import {
47
63
  hasVariantCommands
48
- } from "../chunk-IB3ZHQAX.js";
64
+ } from "../chunk-PTYWCFFW.js";
49
65
  import "../chunk-7DWMJCAT.js";
50
66
  import {
51
67
  validateJsonSchema
@@ -85,7 +101,12 @@ import {
85
101
  } from "../chunk-ZQNDSUZO.js";
86
102
  import "../chunk-SWE3NPOU.js";
87
103
  import "../chunk-O5RYH2PG.js";
88
- import "../chunk-JQ3BB3E6.js";
104
+ import {
105
+ isSingleCellRange,
106
+ normalizeRange,
107
+ rangeContainsRange,
108
+ rangesIntersect
109
+ } from "../chunk-PXDEFEG2.js";
89
110
  import {
90
111
  colNameToIndex,
91
112
  indexToColName,
@@ -1044,6 +1065,14 @@ function parseColumn(name) {
1044
1065
  if (!COLUMN_REGEX.test(name.trim())) throw new Error(`Invalid column "${name}". Use a letter name, e.g. "C".`);
1045
1066
  return colNameToIndex(name.trim().toUpperCase());
1046
1067
  }
1068
+ function parseRange(ref) {
1069
+ const [startRef, endRef = startRef, extra] = String(ref).split(":");
1070
+ if (extra !== void 0) throw new Error(`Invalid range "${ref}". Use A1 notation, e.g. "A1:C5".`);
1071
+ const start = parseCell(startRef);
1072
+ const end = parseCell(endRef);
1073
+ return normalizeRange({ startRow: start.row, startCol: start.col, endRow: end.row, endCol: end.col });
1074
+ }
1075
+ var formatRange = (r) => `${indexToColName(r.startCol)}${r.startRow + 1}:${indexToColName(r.endCol)}${r.endRow + 1}`;
1047
1076
  var CELL_INPUT = { type: ["string", "number", "boolean", "null"] };
1048
1077
  function createSpreadsheetToolProvider(controller, options) {
1049
1078
  const lookup = (row, col) => {
@@ -1054,7 +1083,7 @@ function createSpreadsheetToolProvider(controller, options) {
1054
1083
  const getRange = {
1055
1084
  name: "get_range",
1056
1085
  title: "Read cells",
1057
- description: 'Reads a cell range in A1 notation (e.g. "A1:C5" or "B2") and returns computed values, raw input and errors.',
1086
+ description: 'Reads a cell range in A1 notation (e.g. "A1:C5" or "B2") and returns computed values, raw input, errors and the merged ranges that touch it (a merged range shows its value in its top-left cell).',
1058
1087
  inputSchema: {
1059
1088
  type: "object",
1060
1089
  properties: {
@@ -1097,11 +1126,13 @@ function createSpreadsheetToolProvider(controller, options) {
1097
1126
  values.push(valueRow);
1098
1127
  raw.push(rawRow);
1099
1128
  }
1129
+ const read = { startRow: r0, startCol: c0, endRow: r1, endCol: c1 };
1100
1130
  return {
1101
- range: values.length && values[0].length ? `${indexToColName(c0)}${r0 + 1}:${indexToColName(c1)}${r1 + 1}` : null,
1131
+ range: values.length && values[0].length ? formatRange(read) : null,
1102
1132
  values,
1103
1133
  raw,
1104
1134
  errors,
1135
+ merges: controller.getMerges().filter((m) => rangesIntersect(m, read)).map(formatRange),
1105
1136
  sheet: { rows: rowCount, columns: colCount }
1106
1137
  };
1107
1138
  }
@@ -1272,10 +1303,91 @@ function createSpreadsheetToolProvider(controller, options) {
1272
1303
  return { deleted: count, sheet: sheetSize() };
1273
1304
  }
1274
1305
  );
1306
+ const RANGE = { type: "string", description: 'A1-notation range of at least two cells, e.g. "A1:C1".' };
1307
+ const inSheet = (r, ref) => {
1308
+ if (r.endRow >= controller.document.rows.length || r.endCol >= controller.document.columns.length) {
1309
+ throw new Error(`Range ${ref} is outside the sheet (${controller.document.rows.length} rows, ${controller.document.columns.length} columns).`);
1310
+ }
1311
+ };
1312
+ const readOnlyIn = (r) => {
1313
+ const cells = [];
1314
+ for (let row = r.startRow; row <= r.endRow; row++) {
1315
+ for (let col = r.startCol; col <= r.endCol; col++) if (isReadOnly(row, col)) cells.push(`${indexToColName(col)}${row + 1}`);
1316
+ }
1317
+ return cells;
1318
+ };
1319
+ const SPILL = "it overlaps the spill range of a dynamic array formula; move or clear that formula first";
1320
+ const mergeCells = structural(
1321
+ "merge_cells",
1322
+ "Merge cells",
1323
+ "Merges a range into one cell showing the top-left cell's value. The other cells in the range are cleared, so move their contents first. Merges fully inside the range are absorbed. One undo step. Returns the merged range and the cells that were cleared. Use merges only for titles outside data regions: they break sorting, filtering and transposing.",
1324
+ { range: RANGE },
1325
+ ["range"],
1326
+ true,
1327
+ ({ range }) => {
1328
+ const r = parseRange(range);
1329
+ inSheet(r, range);
1330
+ if (isSingleCellRange(r)) throw new Error(`${range} is a single cell; give a range of at least two cells.`);
1331
+ const partial = controller.getMerges().find((m) => rangesIntersect(m, r) && !rangeContainsRange(r, m));
1332
+ if (partial) throw new Error(`${range} partly overlaps the merged range ${formatRange(partial)}; include all of it or unmerge it first.`);
1333
+ const readOnly = readOnlyIn(r);
1334
+ if (readOnly.length) throw new Error(`Read-only cells: ${readOnly.slice(0, 20).join(", ")}. Nothing was merged.`);
1335
+ const cleared = [];
1336
+ for (let row = r.startRow; row <= r.endRow; row++) {
1337
+ for (let col = r.startCol; col <= r.endCol; col++) {
1338
+ if (row === r.startRow && col === r.startCol) continue;
1339
+ const { rowDef, colDef } = lookup(row, col);
1340
+ if (controller.getCell(rowDef.id, colDef.id).raw !== "") cleared.push(`${indexToColName(col)}${row + 1}`);
1341
+ }
1342
+ }
1343
+ if (!controller.mergeCells(r)) throw new Error(`Cannot merge ${range}: ${SPILL}.`);
1344
+ return { merged: formatRange(r), cleared };
1345
+ }
1346
+ );
1347
+ const unmergeCells = structural(
1348
+ "unmerge_cells",
1349
+ "Unmerge cells",
1350
+ "Splits every merged range that touches a range back into separate cells (the value stays in the top-left cell; the others are empty). One undo step. Returns the ranges that were unmerged.",
1351
+ { range: { type: "string", description: 'A1-notation cell or range; every merge touching it is split, e.g. "A1".' } },
1352
+ ["range"],
1353
+ false,
1354
+ ({ range }) => {
1355
+ const r = parseRange(range);
1356
+ const touched = controller.getMerges().filter((m) => rangesIntersect(m, r));
1357
+ if (!touched.length) throw new Error(`No merged cells in ${range}. get_range lists the merges in a range.`);
1358
+ controller.unmergeCells(r);
1359
+ return { unmerged: touched.map(formatRange) };
1360
+ }
1361
+ );
1362
+ const transposeRange = structural(
1363
+ "transpose_range",
1364
+ "Transpose a range",
1365
+ "Swaps the rows and columns of a range in place, anchored on its top-left cell (A1:C2 becomes A1:B3), moving values, formulas, formats and rules; formulas that point into the range follow their cells. The sheet grows to fit. One undo step. Returns the new range. Cells the result covers outside the original range are overwritten.",
1366
+ { range: RANGE },
1367
+ ["range"],
1368
+ true,
1369
+ ({ range }) => {
1370
+ const s = parseRange(range);
1371
+ inSheet(s, range);
1372
+ if (isSingleCellRange(s)) throw new Error(`${range} is a single cell; give a range of at least two cells.`);
1373
+ const t = {
1374
+ startRow: s.startRow,
1375
+ startCol: s.startCol,
1376
+ endRow: s.startRow + (s.endCol - s.startCol),
1377
+ endCol: s.startCol + (s.endRow - s.startRow)
1378
+ };
1379
+ const merge = controller.getMerges().find((m) => rangesIntersect(m, s) || rangesIntersect(m, t));
1380
+ if (merge) throw new Error(`Cannot transpose ${range}: the merged range ${formatRange(merge)} is in the way; unmerge it first.`);
1381
+ const readOnly = [.../* @__PURE__ */ new Set([...readOnlyIn(s), ...readOnlyIn(t)])];
1382
+ if (readOnly.length) throw new Error(`Read-only cells: ${readOnly.slice(0, 20).join(", ")}. Nothing was transposed.`);
1383
+ if (!controller.transposeRange(s)) throw new Error(`Cannot transpose ${range}: ${SPILL}.`);
1384
+ return { range: formatRange(t), sheet: sheetSize() };
1385
+ }
1386
+ );
1275
1387
  return {
1276
1388
  id: options.id,
1277
1389
  namespace: options.namespace,
1278
- tools: [getRange, setCell, setRange, insertRows, deleteRows, insertColumns, deleteColumns]
1390
+ tools: [getRange, setCell, setRange, insertRows, deleteRows, insertColumns, deleteColumns, mergeCells, unmergeCells, transposeRange]
1279
1391
  };
1280
1392
  }
1281
1393
  function missingArgumentsMessage(name, args) {
@@ -1539,6 +1651,8 @@ function createCanvasComponentToolProvider(controller, options = { id: "canvas-c
1539
1651
  return { id: options.id, namespace: options.namespace, tools };
1540
1652
  }
1541
1653
  export {
1654
+ CAPTURE_EXCLUDE_SELECTOR,
1655
+ CAPTURE_OVERLAY_SELECTORS,
1542
1656
  EDITOR_CANVAS_TOOLS,
1543
1657
  EDITOR_MCP_TOOLS,
1544
1658
  EDITOR_PROMPT_TOOLS,
@@ -1566,19 +1680,30 @@ export {
1566
1680
  TOOL_NAMESPACE_SEPARATOR,
1567
1681
  ToolRegistry,
1568
1682
  ToolRegistryError,
1683
+ captureInputSchema,
1684
+ captureOutputSize,
1685
+ cloneElementWithStyles,
1569
1686
  connectToolBridge,
1570
1687
  createCanvasComponentToolProvider,
1688
+ createCaptureTool,
1689
+ createCaptureToolProvider,
1571
1690
  createDocumentChartTools,
1572
1691
  createEditorMcpToolProvider,
1692
+ createElementCaptureSurface,
1573
1693
  createMcpServer,
1574
1694
  createRichTextToolProvider,
1575
1695
  createSpreadsheetToolProvider,
1576
1696
  createToolRegistry,
1697
+ elementToSvg,
1577
1698
  normalizeSide,
1578
1699
  planAgentCommand,
1579
1700
  planToolCall,
1701
+ rasterizeElement,
1702
+ resolveCaptureRequest,
1703
+ toCapturedImageData,
1580
1704
  toToolResult,
1581
1705
  toolCallToAgentCommand,
1706
+ unionCaptureRects,
1582
1707
  validateAgentCommand,
1583
1708
  validateJsonSchema
1584
1709
  };