@pixerate/editor 0.80.0 → 0.81.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 (64) hide show
  1. package/README.md +13 -3
  2. package/dist/agent/index.cjs +102 -6
  3. package/dist/agent/index.cjs.map +1 -1
  4. package/dist/agent/index.d.cts +4 -2
  5. package/dist/agent/index.d.ts +4 -2
  6. package/dist/agent/index.js +101 -5
  7. package/dist/agent/index.js.map +1 -1
  8. package/dist/{builtins-BKYlHH1s.d.ts → builtins-CV1fDj64.d.ts} +5 -1
  9. package/dist/{builtins-1kqwLUnb.d.cts → builtins-c4w0eAYl.d.cts} +5 -1
  10. package/dist/{chunk-2CJ3LPYQ.js → chunk-424H3P4I.js} +13 -295
  11. package/dist/chunk-424H3P4I.js.map +1 -0
  12. package/dist/{chunk-UN33YOXW.cjs → chunk-PA5S7KPC.cjs} +293 -2
  13. package/dist/chunk-PA5S7KPC.cjs.map +1 -0
  14. package/dist/{chunk-IB3ZHQAX.js → chunk-PTYWCFFW.js} +29 -4
  15. package/dist/chunk-PTYWCFFW.js.map +1 -0
  16. package/dist/{chunk-JQ3BB3E6.js → chunk-PXDEFEG2.js} +293 -2
  17. package/dist/chunk-PXDEFEG2.js.map +1 -0
  18. package/dist/{chunk-YU4WQE5M.cjs → chunk-TAPXWP2B.cjs} +95 -377
  19. package/dist/chunk-TAPXWP2B.cjs.map +1 -0
  20. package/dist/{chunk-HXDMZQTD.cjs → chunk-TPOT575P.cjs} +29 -4
  21. package/dist/{chunk-IB3ZHQAX.js.map → chunk-TPOT575P.cjs.map} +1 -1
  22. package/dist/commands/index.cjs +2 -2
  23. package/dist/commands/index.d.cts +1 -1
  24. package/dist/commands/index.d.ts +1 -1
  25. package/dist/commands/index.js +1 -1
  26. package/dist/generation/index.cjs +932 -791
  27. package/dist/generation/index.cjs.map +1 -1
  28. package/dist/generation/index.d.cts +266 -240
  29. package/dist/generation/index.d.ts +266 -240
  30. package/dist/generation/index.js +926 -785
  31. package/dist/generation/index.js.map +1 -1
  32. package/dist/image-editor/index.cjs +266 -2
  33. package/dist/image-editor/index.cjs.map +1 -1
  34. package/dist/image-editor/index.d.cts +12 -1
  35. package/dist/image-editor/index.d.ts +12 -1
  36. package/dist/image-editor/index.js +265 -1
  37. package/dist/image-editor/index.js.map +1 -1
  38. package/dist/index.cjs +3 -3
  39. package/dist/index.cjs.map +1 -1
  40. package/dist/index.js +16 -16
  41. package/dist/spreadsheet/index.cjs +3 -3
  42. package/dist/spreadsheet/index.cjs.map +1 -1
  43. package/dist/spreadsheet/index.js +16 -16
  44. package/package.json +2 -1
  45. package/skills/README.md +55 -0
  46. package/skills/pixerate-agent-tools/SKILL.md +75 -0
  47. package/skills/pixerate-animation-editor/SKILL.md +155 -0
  48. package/skills/pixerate-animation-editor/references/commands.md +123 -0
  49. package/skills/pixerate-canvas/SKILL.md +230 -0
  50. package/skills/pixerate-chart/SKILL.md +190 -0
  51. package/skills/pixerate-diagram/SKILL.md +134 -0
  52. package/skills/pixerate-generation/SKILL.md +109 -0
  53. package/skills/pixerate-image-editor/SKILL.md +139 -0
  54. package/skills/pixerate-parameters/SKILL.md +83 -0
  55. package/skills/pixerate-rich-text/SKILL.md +160 -0
  56. package/skills/pixerate-spreadsheet/SKILL.md +146 -0
  57. package/skills/pixerate-vector/SKILL.md +191 -0
  58. package/skills/pixerate-vector/references/commands.md +138 -0
  59. package/skills/pixerate-video-editor/SKILL.md +173 -0
  60. package/dist/chunk-2CJ3LPYQ.js.map +0 -1
  61. package/dist/chunk-HXDMZQTD.cjs.map +0 -1
  62. package/dist/chunk-JQ3BB3E6.js.map +0 -1
  63. package/dist/chunk-UN33YOXW.cjs.map +0 -1
  64. package/dist/chunk-YU4WQE5M.cjs.map +0 -1
@@ -45,7 +45,7 @@ import {
45
45
  } from "../chunk-PTMIGXZ2.js";
46
46
  import {
47
47
  hasVariantCommands
48
- } from "../chunk-IB3ZHQAX.js";
48
+ } from "../chunk-PTYWCFFW.js";
49
49
  import "../chunk-7DWMJCAT.js";
50
50
  import {
51
51
  validateJsonSchema
@@ -85,7 +85,12 @@ import {
85
85
  } from "../chunk-ZQNDSUZO.js";
86
86
  import "../chunk-SWE3NPOU.js";
87
87
  import "../chunk-O5RYH2PG.js";
88
- import "../chunk-JQ3BB3E6.js";
88
+ import {
89
+ isSingleCellRange,
90
+ normalizeRange,
91
+ rangeContainsRange,
92
+ rangesIntersect
93
+ } from "../chunk-PXDEFEG2.js";
89
94
  import {
90
95
  colNameToIndex,
91
96
  indexToColName,
@@ -1044,6 +1049,14 @@ function parseColumn(name) {
1044
1049
  if (!COLUMN_REGEX.test(name.trim())) throw new Error(`Invalid column "${name}". Use a letter name, e.g. "C".`);
1045
1050
  return colNameToIndex(name.trim().toUpperCase());
1046
1051
  }
1052
+ function parseRange(ref) {
1053
+ const [startRef, endRef = startRef, extra] = String(ref).split(":");
1054
+ if (extra !== void 0) throw new Error(`Invalid range "${ref}". Use A1 notation, e.g. "A1:C5".`);
1055
+ const start = parseCell(startRef);
1056
+ const end = parseCell(endRef);
1057
+ return normalizeRange({ startRow: start.row, startCol: start.col, endRow: end.row, endCol: end.col });
1058
+ }
1059
+ var formatRange = (r) => `${indexToColName(r.startCol)}${r.startRow + 1}:${indexToColName(r.endCol)}${r.endRow + 1}`;
1047
1060
  var CELL_INPUT = { type: ["string", "number", "boolean", "null"] };
1048
1061
  function createSpreadsheetToolProvider(controller, options) {
1049
1062
  const lookup = (row, col) => {
@@ -1054,7 +1067,7 @@ function createSpreadsheetToolProvider(controller, options) {
1054
1067
  const getRange = {
1055
1068
  name: "get_range",
1056
1069
  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.',
1070
+ 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
1071
  inputSchema: {
1059
1072
  type: "object",
1060
1073
  properties: {
@@ -1097,11 +1110,13 @@ function createSpreadsheetToolProvider(controller, options) {
1097
1110
  values.push(valueRow);
1098
1111
  raw.push(rawRow);
1099
1112
  }
1113
+ const read = { startRow: r0, startCol: c0, endRow: r1, endCol: c1 };
1100
1114
  return {
1101
- range: values.length && values[0].length ? `${indexToColName(c0)}${r0 + 1}:${indexToColName(c1)}${r1 + 1}` : null,
1115
+ range: values.length && values[0].length ? formatRange(read) : null,
1102
1116
  values,
1103
1117
  raw,
1104
1118
  errors,
1119
+ merges: controller.getMerges().filter((m) => rangesIntersect(m, read)).map(formatRange),
1105
1120
  sheet: { rows: rowCount, columns: colCount }
1106
1121
  };
1107
1122
  }
@@ -1272,10 +1287,91 @@ function createSpreadsheetToolProvider(controller, options) {
1272
1287
  return { deleted: count, sheet: sheetSize() };
1273
1288
  }
1274
1289
  );
1290
+ const RANGE = { type: "string", description: 'A1-notation range of at least two cells, e.g. "A1:C1".' };
1291
+ const inSheet = (r, ref) => {
1292
+ if (r.endRow >= controller.document.rows.length || r.endCol >= controller.document.columns.length) {
1293
+ throw new Error(`Range ${ref} is outside the sheet (${controller.document.rows.length} rows, ${controller.document.columns.length} columns).`);
1294
+ }
1295
+ };
1296
+ const readOnlyIn = (r) => {
1297
+ const cells = [];
1298
+ for (let row = r.startRow; row <= r.endRow; row++) {
1299
+ for (let col = r.startCol; col <= r.endCol; col++) if (isReadOnly(row, col)) cells.push(`${indexToColName(col)}${row + 1}`);
1300
+ }
1301
+ return cells;
1302
+ };
1303
+ const SPILL = "it overlaps the spill range of a dynamic array formula; move or clear that formula first";
1304
+ const mergeCells = structural(
1305
+ "merge_cells",
1306
+ "Merge cells",
1307
+ "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.",
1308
+ { range: RANGE },
1309
+ ["range"],
1310
+ true,
1311
+ ({ range }) => {
1312
+ const r = parseRange(range);
1313
+ inSheet(r, range);
1314
+ if (isSingleCellRange(r)) throw new Error(`${range} is a single cell; give a range of at least two cells.`);
1315
+ const partial = controller.getMerges().find((m) => rangesIntersect(m, r) && !rangeContainsRange(r, m));
1316
+ if (partial) throw new Error(`${range} partly overlaps the merged range ${formatRange(partial)}; include all of it or unmerge it first.`);
1317
+ const readOnly = readOnlyIn(r);
1318
+ if (readOnly.length) throw new Error(`Read-only cells: ${readOnly.slice(0, 20).join(", ")}. Nothing was merged.`);
1319
+ const cleared = [];
1320
+ for (let row = r.startRow; row <= r.endRow; row++) {
1321
+ for (let col = r.startCol; col <= r.endCol; col++) {
1322
+ if (row === r.startRow && col === r.startCol) continue;
1323
+ const { rowDef, colDef } = lookup(row, col);
1324
+ if (controller.getCell(rowDef.id, colDef.id).raw !== "") cleared.push(`${indexToColName(col)}${row + 1}`);
1325
+ }
1326
+ }
1327
+ if (!controller.mergeCells(r)) throw new Error(`Cannot merge ${range}: ${SPILL}.`);
1328
+ return { merged: formatRange(r), cleared };
1329
+ }
1330
+ );
1331
+ const unmergeCells = structural(
1332
+ "unmerge_cells",
1333
+ "Unmerge cells",
1334
+ "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.",
1335
+ { range: { type: "string", description: 'A1-notation cell or range; every merge touching it is split, e.g. "A1".' } },
1336
+ ["range"],
1337
+ false,
1338
+ ({ range }) => {
1339
+ const r = parseRange(range);
1340
+ const touched = controller.getMerges().filter((m) => rangesIntersect(m, r));
1341
+ if (!touched.length) throw new Error(`No merged cells in ${range}. get_range lists the merges in a range.`);
1342
+ controller.unmergeCells(r);
1343
+ return { unmerged: touched.map(formatRange) };
1344
+ }
1345
+ );
1346
+ const transposeRange = structural(
1347
+ "transpose_range",
1348
+ "Transpose a range",
1349
+ "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.",
1350
+ { range: RANGE },
1351
+ ["range"],
1352
+ true,
1353
+ ({ range }) => {
1354
+ const s = parseRange(range);
1355
+ inSheet(s, range);
1356
+ if (isSingleCellRange(s)) throw new Error(`${range} is a single cell; give a range of at least two cells.`);
1357
+ const t = {
1358
+ startRow: s.startRow,
1359
+ startCol: s.startCol,
1360
+ endRow: s.startRow + (s.endCol - s.startCol),
1361
+ endCol: s.startCol + (s.endRow - s.startRow)
1362
+ };
1363
+ const merge = controller.getMerges().find((m) => rangesIntersect(m, s) || rangesIntersect(m, t));
1364
+ if (merge) throw new Error(`Cannot transpose ${range}: the merged range ${formatRange(merge)} is in the way; unmerge it first.`);
1365
+ const readOnly = [.../* @__PURE__ */ new Set([...readOnlyIn(s), ...readOnlyIn(t)])];
1366
+ if (readOnly.length) throw new Error(`Read-only cells: ${readOnly.slice(0, 20).join(", ")}. Nothing was transposed.`);
1367
+ if (!controller.transposeRange(s)) throw new Error(`Cannot transpose ${range}: ${SPILL}.`);
1368
+ return { range: formatRange(t), sheet: sheetSize() };
1369
+ }
1370
+ );
1275
1371
  return {
1276
1372
  id: options.id,
1277
1373
  namespace: options.namespace,
1278
- tools: [getRange, setCell, setRange, insertRows, deleteRows, insertColumns, deleteColumns]
1374
+ tools: [getRange, setCell, setRange, insertRows, deleteRows, insertColumns, deleteColumns, mergeCells, unmergeCells, transposeRange]
1279
1375
  };
1280
1376
  }
1281
1377
  function missingArgumentsMessage(name, args) {