@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
@@ -200,7 +200,11 @@ interface SpreadsheetCommandOptions {
200
200
  /** Scope (default `spreadsheet`). Pass `null` for global. */
201
201
  scope?: string | null;
202
202
  }
203
- /** Palette / agent commands for common spreadsheet table actions (no default shortcuts). */
203
+ /**
204
+ * Palette / agent commands for common spreadsheet table actions (no default shortcuts).
205
+ * Merge, unmerge and transpose act on the user's selection; agents should use the
206
+ * `merge_cells` / `unmerge_cells` / `transpose_range` tools, which take a range.
207
+ */
204
208
  declare function createSpreadsheetCommands(controller: SpreadsheetCommandTarget, options?: SpreadsheetCommandOptions): CommandSpec[];
205
209
 
206
210
  export { type ArrangeCommandOptions as A, type ComponentCommandOptions as C, DEFAULT_HISTORY_SHORTCUTS as D, type HistoryCommandOptions as H, type ShapeCommandOptions as S, type ArrangeCommandTarget as a, type ComponentCommandTarget as b, type HistoryCommandTarget as c, type ShapeCommandTarget as d, type SpreadsheetCommandOptions as e, type SpreadsheetCommandTarget as f, createArrangeCommands as g, createComponentCommands as h, createHistoryCommands as i, createShapeCommands as j, createSpreadsheetCommands as k, hasVariantCommands as l, matchHistoryShortcut as m };
@@ -200,7 +200,11 @@ interface SpreadsheetCommandOptions {
200
200
  /** Scope (default `spreadsheet`). Pass `null` for global. */
201
201
  scope?: string | null;
202
202
  }
203
- /** Palette / agent commands for common spreadsheet table actions (no default shortcuts). */
203
+ /**
204
+ * Palette / agent commands for common spreadsheet table actions (no default shortcuts).
205
+ * Merge, unmerge and transpose act on the user's selection; agents should use the
206
+ * `merge_cells` / `unmerge_cells` / `transpose_range` tools, which take a range.
207
+ */
204
208
  declare function createSpreadsheetCommands(controller: SpreadsheetCommandTarget, options?: SpreadsheetCommandOptions): CommandSpec[];
205
209
 
206
210
  export { type ArrangeCommandOptions as A, type ComponentCommandOptions as C, DEFAULT_HISTORY_SHORTCUTS as D, type HistoryCommandOptions as H, type ShapeCommandOptions as S, type ArrangeCommandTarget as a, type ComponentCommandTarget as b, type HistoryCommandTarget as c, type ShapeCommandTarget as d, type SpreadsheetCommandOptions as e, type SpreadsheetCommandTarget as f, createArrangeCommands as g, createComponentCommands as h, createHistoryCommands as i, createShapeCommands as j, createSpreadsheetCommands as k, hasVariantCommands as l, matchHistoryShortcut as m };
@@ -1,15 +1,26 @@
1
1
  import {
2
2
  FormulaEvaluator,
3
3
  WHOLE_COLUMN_END_ROW,
4
+ aggregateValues,
5
+ compareCellValues,
4
6
  describeFormulaError,
7
+ fillSeries,
8
+ getFillDirection,
5
9
  getFormulaArgumentSpecIndex,
6
10
  getFormulaFunction,
7
11
  getFormulaSignature,
8
12
  getFormulaSignatureParts,
13
+ isBlankValue,
14
+ isSingleCellRange,
15
+ matchesFilterRule,
16
+ normalizeRange,
9
17
  parseFormula,
18
+ rangeContains,
19
+ rangeContainsRange,
20
+ rangesIntersect,
10
21
  searchFormulaFunctions,
11
22
  tokenizeFormula
12
- } from "./chunk-JQ3BB3E6.js";
23
+ } from "./chunk-PXDEFEG2.js";
13
24
  import {
14
25
  NumberFormat,
15
26
  colNameToIndex,
@@ -19,12 +30,9 @@ import {
19
30
  isBlank,
20
31
  isFormulaError,
21
32
  numberToText,
22
- numericValue,
23
33
  parseCellInput,
24
- parseIsoDate,
25
34
  serialFromYmd,
26
35
  serialToDate,
27
- sortCompareValues,
28
36
  toBoolean,
29
37
  toText
30
38
  } from "./chunk-EKYHKQPG.js";
@@ -1287,282 +1295,6 @@ function isLambdaDefinition(definition) {
1287
1295
  return /^=?\s*LAMBDA\s*\(/i.test(definition.refersTo);
1288
1296
  }
1289
1297
 
1290
- // src/spreadsheet/table.ts
1291
- function normalizeRange(range) {
1292
- return {
1293
- startRow: Math.min(range.startRow, range.endRow),
1294
- startCol: Math.min(range.startCol, range.endCol),
1295
- endRow: Math.max(range.startRow, range.endRow),
1296
- endCol: Math.max(range.startCol, range.endCol)
1297
- };
1298
- }
1299
- function rangeContains(range, row, col) {
1300
- const r = normalizeRange(range);
1301
- return row >= r.startRow && row <= r.endRow && col >= r.startCol && col <= r.endCol;
1302
- }
1303
- function rangesIntersect(a, b) {
1304
- const x = normalizeRange(a);
1305
- const y = normalizeRange(b);
1306
- return x.startRow <= y.endRow && y.startRow <= x.endRow && x.startCol <= y.endCol && y.startCol <= x.endCol;
1307
- }
1308
- function rangeContainsRange(outer, inner) {
1309
- const o = normalizeRange(outer);
1310
- const i = normalizeRange(inner);
1311
- return i.startRow >= o.startRow && i.endRow <= o.endRow && i.startCol >= o.startCol && i.endCol <= o.endCol;
1312
- }
1313
- function isSingleCellRange(range) {
1314
- const r = normalizeRange(range);
1315
- return r.startRow === r.endRow && r.startCol === r.endCol;
1316
- }
1317
- var NUMBER_PATTERN = /^[-+]?(\d+\.?\d*|\.\d+)(e[-+]?\d+)?$/i;
1318
- var ISO_DATE_PATTERN = /^(\d{4})-(\d{2})-(\d{2})$/;
1319
- function isBlankValue(value) {
1320
- return value === null || value === void 0 || typeof value === "string" && value.trim() === "";
1321
- }
1322
- function toNumber(value) {
1323
- if (typeof value === "number") return Number.isFinite(value) ? value : null;
1324
- if (typeof value === "string") {
1325
- const trimmed = value.trim();
1326
- if (NUMBER_PATTERN.test(trimmed)) return parseFloat(trimmed);
1327
- }
1328
- return null;
1329
- }
1330
- var collator = typeof Intl !== "undefined" ? new Intl.Collator(void 0, { numeric: true, sensitivity: "base" }) : null;
1331
- function compareText(a, b) {
1332
- return collator ? collator.compare(a, b) : a < b ? -1 : a > b ? 1 : 0;
1333
- }
1334
- function compareCellValues(a, b, direction = "asc") {
1335
- const aBlank = isBlankValue(a);
1336
- const bBlank = isBlankValue(b);
1337
- if (aBlank || bBlank) return aBlank === bBlank ? 0 : aBlank ? 1 : -1;
1338
- let result;
1339
- if (isPlainText(a) && isPlainText(b) && !(parseIsoDate(a) && parseIsoDate(b))) {
1340
- result = compareText(a, b);
1341
- } else {
1342
- result = sortCompareValues(a, b);
1343
- }
1344
- if (result === 0) return 0;
1345
- return direction === "desc" ? -Math.sign(result) : Math.sign(result);
1346
- }
1347
- var isPlainText = (value) => typeof value === "string" && !isFormulaError(value);
1348
- function filterValue(value) {
1349
- if (isBlankValue(value) || isFormulaError(value)) return null;
1350
- if (typeof value === "number") return Number.isFinite(value) ? { value, kind: "number" } : null;
1351
- if (typeof value === "boolean") return { value, kind: "boolean" };
1352
- const num = numericValue(value);
1353
- if (num !== null) return { value: num, kind: "number" };
1354
- const text = String(value);
1355
- return { value: text, kind: parseIsoDate(text) ? "number" : "text" };
1356
- }
1357
- function filterOperand(operand) {
1358
- if (typeof operand !== "string") return filterValue(operand);
1359
- if (operand.trim() === "") return null;
1360
- const parsed = parseCellInput(operand.trim());
1361
- if (parsed.type === "number" || parsed.type === "date" || parsed.type === "boolean") return filterValue(parsed.value);
1362
- return { value: operand, kind: "text" };
1363
- }
1364
- function compareForFilter(value, operand) {
1365
- const a = filterValue(value);
1366
- const b = filterOperand(operand);
1367
- if (!a || !b || a.kind !== b.kind) return null;
1368
- return compareValues(a.value, b.value);
1369
- }
1370
- function looselyEquals(value, operand) {
1371
- const c = compareForFilter(value, operand);
1372
- if (c !== null) return c === 0;
1373
- return String(value ?? "").trim().toLowerCase() === String(operand ?? "").trim().toLowerCase();
1374
- }
1375
- function matchesFilterRule(value, rule) {
1376
- const text = String(value ?? "").toLowerCase();
1377
- switch (rule.operator) {
1378
- case "equals":
1379
- return looselyEquals(value, rule.value);
1380
- case "notEquals":
1381
- return !looselyEquals(value, rule.value);
1382
- case "contains":
1383
- return text.includes(String(rule.value ?? "").toLowerCase());
1384
- case "notContains":
1385
- return !text.includes(String(rule.value ?? "").toLowerCase());
1386
- case "greaterThan": {
1387
- const c = compareForFilter(value, rule.value);
1388
- return c !== null && c > 0;
1389
- }
1390
- case "greaterThanOrEqual": {
1391
- const c = compareForFilter(value, rule.value);
1392
- return c !== null && c >= 0;
1393
- }
1394
- case "lessThan": {
1395
- const c = compareForFilter(value, rule.value);
1396
- return c !== null && c < 0;
1397
- }
1398
- case "lessThanOrEqual": {
1399
- const c = compareForFilter(value, rule.value);
1400
- return c !== null && c <= 0;
1401
- }
1402
- case "between": {
1403
- const lo = compareForFilter(value, rule.value);
1404
- const hi = compareForFilter(value, rule.value2);
1405
- return lo !== null && hi !== null && lo >= 0 && hi <= 0;
1406
- }
1407
- case "isBlank":
1408
- return isBlankValue(value);
1409
- case "isNotBlank":
1410
- return !isBlankValue(value);
1411
- case "oneOf":
1412
- return (rule.values ?? []).some((candidate) => String(candidate) === String(value ?? ""));
1413
- default:
1414
- return true;
1415
- }
1416
- }
1417
- function aggregateValues(values, aggregate) {
1418
- if (aggregate === "count") return values.filter((v) => !isBlankValue(v)).length;
1419
- const numbers = [];
1420
- for (const v of values) {
1421
- const n = toNumber(v);
1422
- if (n !== null) numbers.push(n);
1423
- }
1424
- if (numbers.length === 0) return aggregate === "sum" ? 0 : null;
1425
- switch (aggregate) {
1426
- case "sum":
1427
- return roundFloat(numbers.reduce((s, n) => s + n, 0));
1428
- case "average":
1429
- return roundFloat(numbers.reduce((s, n) => s + n, 0) / numbers.length);
1430
- case "min":
1431
- return numbers.reduce((m, n) => n < m ? n : m, numbers[0]);
1432
- case "max":
1433
- return numbers.reduce((m, n) => n > m ? n : m, numbers[0]);
1434
- default:
1435
- return null;
1436
- }
1437
- }
1438
- function roundFloat(value) {
1439
- return Number.isInteger(value) ? value : parseFloat(value.toPrecision(12));
1440
- }
1441
- var DAY_MS = 864e5;
1442
- var TRAILING_NUMBER = /^(.*?)(\d+)(\D*)$/;
1443
- function classifyFillValue(raw) {
1444
- if (raw.trim() === "") return { kind: "blank" };
1445
- const num = toNumber(raw);
1446
- if (num !== null) return { kind: "number", value: num };
1447
- const typed = parseCellInput(raw);
1448
- const date = ISO_DATE_PATTERN.exec(typed.type === "date" ? String(typed.value) : raw.trim());
1449
- if (date) {
1450
- const [year, month, day] = [Number(date[1]), Number(date[2]), Number(date[3])];
1451
- const time = Date.UTC(year, month - 1, day);
1452
- const check = new Date(time);
1453
- if (check.getUTCMonth() === month - 1 && check.getUTCDate() === day) {
1454
- return { kind: "date", time, year, month, day };
1455
- }
1456
- }
1457
- const textNumber = TRAILING_NUMBER.exec(raw);
1458
- if (textNumber && textNumber[1] !== "") {
1459
- return {
1460
- kind: "textNumber",
1461
- prefix: textNumber[1],
1462
- value: parseInt(textNumber[2], 10),
1463
- width: textNumber[2].length,
1464
- suffix: textNumber[3]
1465
- };
1466
- }
1467
- return { kind: "text", text: raw };
1468
- }
1469
- var pad = (n, width) => String(Math.abs(n)).padStart(width, "0");
1470
- function formatDate(time) {
1471
- const d = new Date(time);
1472
- return `${d.getUTCFullYear()}-${pad(d.getUTCMonth() + 1, 2)}-${pad(d.getUTCDate(), 2)}`;
1473
- }
1474
- function constantStep(values) {
1475
- const step = values[1] - values[0];
1476
- for (let i = 2; i < values.length; i++) {
1477
- if (Math.abs(values[i] - values[i - 1] - step) > 1e-9) return null;
1478
- }
1479
- return step;
1480
- }
1481
- function linearTrend(values, x) {
1482
- const n = values.length;
1483
- const meanX = (n - 1) / 2;
1484
- const meanY = values.reduce((s, v) => s + v, 0) / n;
1485
- let num = 0;
1486
- let den = 0;
1487
- values.forEach((v, i) => {
1488
- num += (i - meanX) * (v - meanY);
1489
- den += (i - meanX) ** 2;
1490
- });
1491
- const slope = den === 0 ? 0 : num / den;
1492
- return meanY + slope * (x - meanX);
1493
- }
1494
- function fillSeries(source, count) {
1495
- if (count <= 0) return [];
1496
- if (source.length === 0) return Array(count).fill("");
1497
- const repeat = () => Array.from({ length: count }, (_, i) => source[i % source.length]);
1498
- const parsed = source.map(classifyFillValue);
1499
- const kind = parsed[0].kind;
1500
- if (!parsed.every((p) => p.kind === kind)) return repeat();
1501
- const n = source.length;
1502
- if (kind === "number") {
1503
- if (n === 1) return repeat();
1504
- const values = parsed.map((p) => p.value);
1505
- return Array.from({ length: count }, (_, i) => String(roundFloat(linearTrend(values, n + i))));
1506
- }
1507
- if (kind === "date") {
1508
- const dates = parsed;
1509
- if (n === 1) {
1510
- return Array.from({ length: count }, (_, i) => formatDate(dates[0].time + (i + 1) * DAY_MS));
1511
- }
1512
- const monthIndex = dates.map((d) => d.year * 12 + (d.month - 1));
1513
- const monthStep = constantStep(monthIndex);
1514
- if (monthStep !== null && monthStep !== 0 && dates.every((d) => d.day === dates[0].day)) {
1515
- const last = monthIndex[n - 1];
1516
- return Array.from({ length: count }, (_, i) => {
1517
- const m = last + monthStep * (i + 1);
1518
- const year = Math.floor(m / 12);
1519
- const month = m - year * 12;
1520
- const daysInMonth = new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
1521
- return formatDate(Date.UTC(year, month, Math.min(dates[0].day, daysInMonth)));
1522
- });
1523
- }
1524
- const dayStep = constantStep(dates.map((d) => Math.round(d.time / DAY_MS)));
1525
- if (dayStep === null) return repeat();
1526
- const lastTime = dates[n - 1].time;
1527
- return Array.from({ length: count }, (_, i) => formatDate(lastTime + dayStep * (i + 1) * DAY_MS));
1528
- }
1529
- if (kind === "textNumber") {
1530
- const items = parsed;
1531
- const { prefix, suffix } = items[0];
1532
- if (!items.every((t) => t.prefix === prefix && t.suffix === suffix)) return repeat();
1533
- const step = n === 1 ? 1 : constantStep(items.map((t) => t.value));
1534
- if (step === null) return repeat();
1535
- const last = items[n - 1];
1536
- return Array.from({ length: count }, (_, i) => {
1537
- const value = last.value + step * (i + 1);
1538
- const digits = value < 0 ? `-${pad(value, last.width)}` : pad(value, last.width);
1539
- return `${prefix}${digits}${suffix}`;
1540
- });
1541
- }
1542
- return repeat();
1543
- }
1544
- function computeFillTarget(source, pointer) {
1545
- const s = normalizeRange(source);
1546
- const rowOverflow = pointer.row > s.endRow ? pointer.row - s.endRow : pointer.row < s.startRow ? s.startRow - pointer.row : 0;
1547
- const colOverflow = pointer.col > s.endCol ? pointer.col - s.endCol : pointer.col < s.startCol ? s.startCol - pointer.col : 0;
1548
- if (rowOverflow === 0 && colOverflow === 0) return null;
1549
- if (rowOverflow >= colOverflow) {
1550
- return pointer.row > s.endRow ? { ...s, endRow: pointer.row } : { ...s, startRow: pointer.row };
1551
- }
1552
- return pointer.col > s.endCol ? { ...s, endCol: pointer.col } : { ...s, startCol: pointer.col };
1553
- }
1554
- function getFillDirection(source, target) {
1555
- const s = normalizeRange(source);
1556
- const t = normalizeRange(target);
1557
- const sameCols = s.startCol === t.startCol && s.endCol === t.endCol;
1558
- const sameRows = s.startRow === t.startRow && s.endRow === t.endRow;
1559
- if (sameCols && t.startRow === s.startRow && t.endRow > s.endRow) return "down";
1560
- if (sameCols && t.endRow === s.endRow && t.startRow < s.startRow) return "up";
1561
- if (sameRows && t.startCol === s.startCol && t.endCol > s.endCol) return "right";
1562
- if (sameRows && t.endCol === s.endCol && t.startCol < s.startCol) return "left";
1563
- return null;
1564
- }
1565
-
1566
1298
  // src/spreadsheet/clipboard.ts
1567
1299
  var SPREADSHEET_CLIPBOARD_MIME = "application/x.pixerate.spreadsheet+json";
1568
1300
  var displayText = (value) => value === null || value === void 0 ? "" : String(value);
@@ -6699,20 +6431,6 @@ export {
6699
6431
  copySheetName,
6700
6432
  validateDefinedName,
6701
6433
  isLambdaDefinition,
6702
- normalizeRange,
6703
- rangeContains,
6704
- rangesIntersect,
6705
- rangeContainsRange,
6706
- isSingleCellRange,
6707
- isBlankValue,
6708
- toNumber,
6709
- compareCellValues,
6710
- matchesFilterRule,
6711
- aggregateValues,
6712
- roundFloat,
6713
- fillSeries,
6714
- computeFillTarget,
6715
- getFillDirection,
6716
6434
  SPREADSHEET_CLIPBOARD_MIME,
6717
6435
  serializeHtmlTable,
6718
6436
  parseHtmlTable,
@@ -6803,4 +6521,4 @@ export {
6803
6521
  getSpreadsheetScrollToCell,
6804
6522
  sameSpreadsheetViewWindow
6805
6523
  };
6806
- //# sourceMappingURL=chunk-2CJ3LPYQ.js.map
6524
+ //# sourceMappingURL=chunk-424H3P4I.js.map