@pixerate/editor 0.22.0 → 0.23.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 (83) hide show
  1. package/README.md +80 -2
  2. package/THIRD_PARTY_NOTICES.md +88 -0
  3. package/dist/agent/index.cjs +83 -108
  4. package/dist/agent/index.cjs.map +1 -1
  5. package/dist/agent/index.d.cts +69 -211
  6. package/dist/agent/index.d.ts +69 -211
  7. package/dist/agent/index.js +76 -101
  8. package/dist/agent/index.js.map +1 -1
  9. package/dist/arrangeShortcuts-B8O3f8-P.d.cts +184 -0
  10. package/dist/arrangeShortcuts-sLlD2rSX.d.ts +184 -0
  11. package/dist/canvas/index.cjs +879 -83
  12. package/dist/canvas/index.cjs.map +1 -1
  13. package/dist/canvas/index.d.cts +291 -186
  14. package/dist/canvas/index.d.ts +291 -186
  15. package/dist/canvas/index.js +865 -69
  16. package/dist/canvas/index.js.map +1 -1
  17. package/dist/chunk-26BVFKHU.cjs +453 -0
  18. package/dist/chunk-26BVFKHU.cjs.map +1 -0
  19. package/dist/chunk-2H7ZHPEJ.js +762 -0
  20. package/dist/chunk-2H7ZHPEJ.js.map +1 -0
  21. package/dist/chunk-7DWMJCAT.js +453 -0
  22. package/dist/chunk-7DWMJCAT.js.map +1 -0
  23. package/dist/chunk-ARRTP33I.js +101 -0
  24. package/dist/chunk-ARRTP33I.js.map +1 -0
  25. package/dist/chunk-CPOKFNBG.cjs +101 -0
  26. package/dist/chunk-CPOKFNBG.cjs.map +1 -0
  27. package/dist/chunk-G2I4QJOT.cjs +762 -0
  28. package/dist/chunk-G2I4QJOT.cjs.map +1 -0
  29. package/dist/{chunk-RU52I7QO.js → chunk-K3R5NG2D.js} +147 -42
  30. package/dist/chunk-K3R5NG2D.js.map +1 -0
  31. package/dist/{chunk-DENSCKFC.js → chunk-QBJ22YZR.js} +423 -30
  32. package/dist/chunk-QBJ22YZR.js.map +1 -0
  33. package/dist/{chunk-SAZRENEZ.cjs → chunk-RIKBJLS2.cjs} +424 -31
  34. package/dist/chunk-RIKBJLS2.cjs.map +1 -0
  35. package/dist/{chunk-6M3BCTBD.cjs → chunk-XDMXXC4Z.cjs} +230 -125
  36. package/dist/chunk-XDMXXC4Z.cjs.map +1 -0
  37. package/dist/commands/index.cjs +860 -0
  38. package/dist/commands/index.cjs.map +1 -0
  39. package/dist/commands/index.d.cts +592 -0
  40. package/dist/commands/index.d.ts +592 -0
  41. package/dist/commands/index.js +860 -0
  42. package/dist/commands/index.js.map +1 -0
  43. package/dist/{controller-B7GIybc4.d.cts → controller-pePCJLT1.d.cts} +78 -5
  44. package/dist/{controller-B7GIybc4.d.ts → controller-pePCJLT1.d.ts} +78 -5
  45. package/dist/history/index.cjs +12 -2
  46. package/dist/history/index.cjs.map +1 -1
  47. package/dist/history/index.d.cts +211 -7
  48. package/dist/history/index.d.ts +211 -7
  49. package/dist/history/index.js +13 -3
  50. package/dist/image-editor/index.cjs +418 -13
  51. package/dist/image-editor/index.cjs.map +1 -1
  52. package/dist/image-editor/index.d.cts +154 -3
  53. package/dist/image-editor/index.d.ts +154 -3
  54. package/dist/image-editor/index.js +417 -12
  55. package/dist/image-editor/index.js.map +1 -1
  56. package/dist/index.cjs +34 -76
  57. package/dist/index.cjs.map +1 -1
  58. package/dist/index.d.cts +5 -42
  59. package/dist/index.d.ts +5 -42
  60. package/dist/index.js +27 -69
  61. package/dist/index.js.map +1 -1
  62. package/dist/registry-D5-R90p0.d.cts +209 -0
  63. package/dist/registry-D5-R90p0.d.ts +209 -0
  64. package/dist/spreadsheet/index.cjs +19 -3
  65. package/dist/spreadsheet/index.cjs.map +1 -1
  66. package/dist/spreadsheet/index.d.cts +67 -9
  67. package/dist/spreadsheet/index.d.ts +67 -9
  68. package/dist/spreadsheet/index.js +18 -2
  69. package/dist/{types-CJ4U-HHI.d.cts → types-DX4Mh4SL.d.cts} +1 -1
  70. package/dist/{types-CJ4U-HHI.d.ts → types-DX4Mh4SL.d.ts} +1 -1
  71. package/dist/types-GT5a5YAX.d.cts +86 -0
  72. package/dist/types-GT5a5YAX.d.ts +86 -0
  73. package/package.json +8 -2
  74. package/dist/chunk-2TWGLC5K.cjs +0 -262
  75. package/dist/chunk-2TWGLC5K.cjs.map +0 -1
  76. package/dist/chunk-6M3BCTBD.cjs.map +0 -1
  77. package/dist/chunk-DENSCKFC.js.map +0 -1
  78. package/dist/chunk-KAADNAPF.js +0 -262
  79. package/dist/chunk-KAADNAPF.js.map +0 -1
  80. package/dist/chunk-RU52I7QO.js.map +0 -1
  81. package/dist/chunk-SAZRENEZ.cjs.map +0 -1
  82. package/dist/types-BZgcDsC5.d.cts +0 -42
  83. package/dist/types-BZgcDsC5.d.ts +0 -42
@@ -1,5 +1,5 @@
1
- import { A as ASTNode, r as FormulaErrorCode, v as FormulaRange, G as GroupAggregate, O as SortDirection, e as CellRange, d as CellPosition, p as FilterRule, S as SpreadsheetController } from '../controller-B7GIybc4.js';
2
- export { B as BinaryOpNode, C as CellCoordinate, a as CellData, b as CellDep, c as CellFormat, f as CellRefNode, g as CellValueReader, h as ColumnBinding, i as ColumnType, j as CsvExportOptions, k as CsvImportOptions, D as DEFAULT_COLUMN_WIDTH, l as DEFAULT_ROW_HEIGHT, m as DataSourceBinder, n as DependencyGraph, E as EvaluationContext, F as FORMULA_ERRORS, o as FilterOperator, q as FormulaDiagnostic, s as FormulaEvaluationResult, t as FormulaEvaluator, u as FormulaParser, w as FormulaToken, x as FormulaTokenType, y as FunctionCallNode, z as GroupSummary, L as LiteralNode, M as MAX_FORMULA_ARRAY_SIZE, N as NameNode, H as NewFilterRule, P as ParsedSpreadsheetClipboard, I as PropertyRefNode, R as RangeNode, J as RowType, K as SPREADSHEET_CLIPBOARD_MIME, Q as SortKey, T as SpillRefNode, U as SpreadsheetCellSpan, V as SpreadsheetClipboardCell, W as SpreadsheetClipboardData, X as SpreadsheetClipboardPayload, Y as SpreadsheetClipboardSource, Z as SpreadsheetColumn, _ as SpreadsheetControllerOptions, $ as SpreadsheetDataSource, a0 as SpreadsheetDataSourceField, a1 as SpreadsheetDocument, a2 as SpreadsheetFilterState, a3 as SpreadsheetGrouping, a4 as SpreadsheetRow, a5 as SpreadsheetRowGroup, a6 as SpreadsheetRowSection, a7 as SpreadsheetSpill, a8 as SpreadsheetTableSettings, a9 as SpreadsheetViewColumn, aa as SpreadsheetViewModel, ab as SpreadsheetViewRow, ac as StructuralChange, ad as UnaryOpNode, ae as WHOLE_COLUMN_END_ROW, af as buildSpreadsheetView, ag as colNameToIndex, ah as columnDependencyKey, ai as computeRowGroups, aj as createSpreadsheetClipboardData, ak as describeFormulaError, al as extractCellDependencies, am as getRowSection, an as getTableSections, ao as indexToColName, ap as isFormulaError, aq as mapFormulaReferences, ar as offsetFormulaReferences, as as parseCellReference, at as parseFormula, au as parseHtmlTable, av as parseRange, aw as readSpreadsheetClipboard, ax as rebaseClipboardRows, ay as remapFormulaReferences, az as rowPassesFilters, aA as serializeHtmlTable, aB as shiftFormulaReferences, aC as tokenizeFormula } from '../controller-B7GIybc4.js';
1
+ import { A as ASTNode, r as FormulaErrorCode, v as FormulaRange, a as CellData, c as CellFormat, G as GroupAggregate, O as SortDirection, e as CellRange, d as CellPosition, p as FilterRule, S as SpreadsheetController } from '../controller-pePCJLT1.js';
2
+ export { B as BinaryOpNode, C as CellCoordinate, b as CellDep, f as CellRefNode, g as CellValueReader, h as ColumnBinding, i as ColumnType, j as CsvExportOptions, k as CsvImportOptions, D as DEFAULT_COLUMN_WIDTH, l as DEFAULT_ROW_HEIGHT, m as DataSourceBinder, n as DependencyGraph, E as EvaluationContext, F as FORMULA_ERRORS, o as FilterOperator, q as FormulaDiagnostic, s as FormulaEvaluationResult, t as FormulaEvaluator, u as FormulaParser, w as FormulaToken, x as FormulaTokenType, y as FunctionCallNode, z as GroupSummary, L as LiteralNode, M as MAX_FORMULA_ARRAY_SIZE, N as NameNode, H as NewFilterRule, P as ParsedSpreadsheetClipboard, I as PropertyRefNode, R as RangeNode, J as RowType, K as SPREADSHEET_CLIPBOARD_MIME, Q as SortKey, T as SpillRefNode, U as SpreadsheetCellSpan, V as SpreadsheetClipboardCell, W as SpreadsheetClipboardData, X as SpreadsheetClipboardPayload, Y as SpreadsheetClipboardSource, Z as SpreadsheetColumn, _ as SpreadsheetControllerOptions, $ as SpreadsheetDataSource, a0 as SpreadsheetDataSourceField, a1 as SpreadsheetDocument, a2 as SpreadsheetFilterState, a3 as SpreadsheetGrouping, a4 as SpreadsheetRow, a5 as SpreadsheetRowGroup, a6 as SpreadsheetRowSection, a7 as SpreadsheetSpill, a8 as SpreadsheetTableSettings, a9 as SpreadsheetViewColumn, aa as SpreadsheetViewModel, ab as SpreadsheetViewRow, ac as StructuralChange, ad as UnaryOpNode, ae as WHOLE_COLUMN_END_ROW, af as buildSpreadsheetView, ag as colNameToIndex, ah as columnDependencyKey, ai as compareNumbers, aj as compareValues, ak as computeRowGroups, al as createSpreadsheetClipboardData, am as describeFormulaError, an as extractCellDependencies, ao as getRowSection, ap as getTableSections, aq as indexToColName, ar as isFormulaError, as as mapFormulaReferences, at as numberToText, au as offsetFormulaReferences, av as parseCellReference, aw as parseFormula, ax as parseHtmlTable, ay as parseRange, az as readSpreadsheetClipboard, aA as rebaseClipboardRows, aB as remapFormulaReferences, aC as rowPassesFilters, aD as serializeHtmlTable, aE as shiftFormulaReferences, aF as sortCompareValues, aG as tokenizeFormula } from '../controller-pePCJLT1.js';
3
3
  import { I as ImportAdapterRegistry, c as ImportAdapter, h as ImportInput, a as ImportOutcome } from '../registry-GJI4gToU.js';
4
4
 
5
5
  type FormulaFunctionCategory = 'math' | 'statistical' | 'logical' | 'text' | 'lookup' | 'date' | 'information';
@@ -202,13 +202,22 @@ declare function wildcardToRegExp(pattern: string): RegExp;
202
202
  * Parses a criterion as used by SUMIF, COUNTIFS etc.:
203
203
  * - a number or boolean matches equal values (`5` matches 5 and the text "5");
204
204
  * - text may start with `=`, `<>`, `<`, `<=`, `>` or `>=`. Numeric operands
205
- * compare numbers; text operands compare text case-insensitively;
205
+ * (typed-input rules: `">1,000"`, `"<50%"`, `">$5"`) compare numbers; date
206
+ * operands (`">=3/1/2026"`, `"<2026-03-01"`) compare ISO dates (and serial
207
+ * numbers) chronologically; text operands compare text case-insensitively;
206
208
  * - `=`/`<>` text operands and plain text support `*` and `?` wildcards;
207
209
  * - `""` and `"="` match blank cells, `"<>"` matches non-blank cells.
208
210
  * Error values in the data never match.
209
211
  */
210
212
  declare function parseCriteria(criterion: unknown): FormulaCriteriaPredicate;
211
213
 
214
+ /**
215
+ * The text a cell shows: its error, or its value formatted with the number
216
+ * format chosen for typed input (`numberFormat`, e.g. `"$"#,##0.00` for
217
+ * `$1,200.50`, `0%` for `10%`, `m/d/yyyy` for `3/4/2026`). Other numbers use
218
+ * up to 15 significant digits and booleans show as TRUE/FALSE.
219
+ */
220
+ declare function formatCellDisplay(cell: Pick<CellData, 'value' | 'error' | 'numberFormat'> | null | undefined): string;
212
221
  /**
213
222
  * A subset of spreadsheet number format codes, as used by TEXT():
214
223
  * - numbers: `0`, `#`, `0.00`, `#,##0`, `#,##0.00`, `0%`, `0.0%`, `0.00E+00`,
@@ -220,6 +229,53 @@ declare function parseCriteria(criterion: unknown): FormulaCriteriaPredicate;
220
229
  */
221
230
  declare function formatValueWithCode(value: unknown, format: string): string | null;
222
231
 
232
+ /**
233
+ * Parsing what people type into a cell (and numeric text in formulas).
234
+ *
235
+ * Recognises numbers with thousands separators, percentages, currency,
236
+ * scientific notation, fractions (`1 1/2`), dates (`3/4/2026`, `2026-03-04`,
237
+ * `4-Mar-2026`, `Mar 4, 2026`), times (`10:30`, `10:30:15 PM`) and
238
+ * date-times. Locale: en-US (month/day/year).
239
+ *
240
+ * Representation: our engine keeps dates as ISO text (`2026-03-04`, or
241
+ * `2026-03-04 18:00:00` with a time), so a typed date becomes ISO text, not a
242
+ * serial number. A time typed on its own (`12:00`) has no date to anchor ISO
243
+ * text to, so it becomes a fraction of a day (0.5), as in Excel.
244
+ */
245
+
246
+ /** Kind of automatic number format chosen for typed input. */
247
+ type CellInputFormatKind = 'number' | 'currency' | 'percentage' | 'date' | 'time';
248
+ interface ParsedCellInput {
249
+ /** The typed value: number, boolean, ISO date text, error code or text. `''` for empty input. */
250
+ value: string | number | boolean;
251
+ type: 'empty' | 'text' | 'number' | 'boolean' | 'error' | 'date';
252
+ /**
253
+ * Number format code Excel would apply automatically (e.g. `"$"#,##0.00`,
254
+ * `0%`, `#,##0`, `m/d/yyyy`, `h:mm`), or undefined for General.
255
+ */
256
+ numberFormat?: string;
257
+ /** What kind of format that is, if any. */
258
+ formatKind?: CellInputFormatKind;
259
+ /** `formatKind` mapped onto `CellFormat` (times have no `CellFormat` and map to undefined). */
260
+ cellFormat?: CellFormat;
261
+ }
262
+ /**
263
+ * Excel 1900-system serial for a date (1 = 1900-01-01, 60 = the fictitious
264
+ * 1900-02-29). Month and day overflow roll over like `DATE()`; years 0–1899
265
+ * are added to 1900. Null before the epoch or after 9999-12-31.
266
+ */
267
+ declare function serialFromYmd(year: number, month: number, day: number): number | null;
268
+ /**
269
+ * Interprets typed cell input (not formulas). Text that isn't a number,
270
+ * date, time, boolean or error stays text; a leading apostrophe forces text.
271
+ */
272
+ declare function parseCellInput(input: string): ParsedCellInput;
273
+ /**
274
+ * Numeric text as arithmetic coerces it ("1,000", "50%", "$3", "1/2/2020",
275
+ * "10:00"); dates become 1900-system serial numbers. Null when it isn't numeric.
276
+ */
277
+ declare function parseNumberText(text: string): number | null;
278
+
223
279
  /**
224
280
  * RFC 4180 CSV (and other delimiter-separated values) parsing and
225
281
  * serialization.
@@ -288,9 +344,11 @@ declare function isBlankValue(value: unknown): boolean;
288
344
  /** The numeric value of a number or numeric string, or null. */
289
345
  declare function toNumber(value: unknown): number | null;
290
346
  /**
291
- * Sort order for cell values: numbers (ascending) before text (natural,
292
- * case-insensitive). `desc` reverses that order. Blanks always sort last,
293
- * whatever the direction.
347
+ * Sort order for cell values, as in Excel: numbers (ascending), then text,
348
+ * booleans and errors; `desc` reverses that order. Numbers compare at 15
349
+ * significant digits and ISO dates chronologically. Text uses a natural,
350
+ * case-insensitive order ("Item 2" before "Item 10"). Blanks always sort
351
+ * last, whatever the direction.
294
352
  */
295
353
  declare function compareCellValues(a: unknown, b: unknown, direction?: SortDirection): number;
296
354
  /** Whether a cell value passes one filter rule. */
@@ -308,8 +366,8 @@ declare function roundFloat(value: number): number;
308
366
  * nearest-first) by `count` values, the way a fill handle does:
309
367
  *
310
368
  * - numbers: one value repeats; two or more continue their linear trend
311
- * - ISO dates (`YYYY-MM-DD`): one date counts up by a day; two or more
312
- * continue their day or month step
369
+ * - dates (ISO `YYYY-MM-DD`, or typed like `3/4/2026`): one date counts up
370
+ * by a day; two or more continue their day or month step (as ISO dates)
313
371
  * - text ending in a number ("Item 1"): the number counts up (or continues
314
372
  * the step of several values with the same prefix/suffix)
315
373
  * - anything else (or a mix) repeats the source cyclically
@@ -427,4 +485,4 @@ interface ImportFileIntoSpreadsheetOptions {
427
485
  */
428
486
  declare function importFileIntoSpreadsheet(controller: SpreadsheetController, input: ImportInput, options: ImportFileIntoSpreadsheetOptions): Promise<ImportOutcome<SpreadsheetImport>>;
429
487
 
430
- export { ASTNode, CellPosition, CellRange, type CsvParseOptions, type CsvSerializeOptions, type FillDirection, FilterRule, type FormulaActiveCall, type FormulaArgument, type FormulaArgumentSpec, type FormulaArgumentType, type FormulaCaretContext, type FormulaCriteriaPredicate, FormulaErrorCode, type FormulaFunctionCategory, type FormulaFunctionContext, type FormulaFunctionDefinition, type FormulaFunctionSuggestion, type FormulaHints, FormulaRange, type FormulaSignaturePart, GroupAggregate, type ImportFileIntoSpreadsheetOptions, SPREADSHEET_IMPORT_ADAPTERS, SPREADSHEET_TABLE_ACTIONS, SortDirection, SpreadsheetController, type SpreadsheetImport, type SpreadsheetImportAdapter, type SpreadsheetMenuItem, type SpreadsheetTableActionName, type SpreadsheetTableActions, aggregateValues, applyFormulaSuggestion, bindSpreadsheetTableActions, checkFormulaArgumentCount, clampMenuPosition, compareCellValues, computeFillTarget, csvImportAdapter, escapeCsvField, fillSeries, formatValueWithCode, getFillDirection, getFormulaArgumentSpecIndex, getFormulaCaretContext, getFormulaFunction, getFormulaHints, getFormulaSignature, getFormulaSignatureParts, getSpreadsheetMenuItems, importFileIntoSpreadsheet, isBlankValue, isSingleCellRange, listFormulaFunctions, matchesFilterRule, normalizeRange, parseCriteria, parseCsv, parseTsv, rangeContains, rangeContainsRange, rangesIntersect, registerFormulaFunction, registerSpreadsheetImportAdapters, roundFloat, searchFormulaFunctions, serializeCsv, serializeTsv, toNumber, tsvImportAdapter, unregisterFormulaFunction, wildcardToRegExp };
488
+ export { ASTNode, CellData, CellFormat, type CellInputFormatKind, CellPosition, CellRange, type CsvParseOptions, type CsvSerializeOptions, type FillDirection, FilterRule, type FormulaActiveCall, type FormulaArgument, type FormulaArgumentSpec, type FormulaArgumentType, type FormulaCaretContext, type FormulaCriteriaPredicate, FormulaErrorCode, type FormulaFunctionCategory, type FormulaFunctionContext, type FormulaFunctionDefinition, type FormulaFunctionSuggestion, type FormulaHints, FormulaRange, type FormulaSignaturePart, GroupAggregate, type ImportFileIntoSpreadsheetOptions, type ParsedCellInput, SPREADSHEET_IMPORT_ADAPTERS, SPREADSHEET_TABLE_ACTIONS, SortDirection, SpreadsheetController, type SpreadsheetImport, type SpreadsheetImportAdapter, type SpreadsheetMenuItem, type SpreadsheetTableActionName, type SpreadsheetTableActions, aggregateValues, applyFormulaSuggestion, bindSpreadsheetTableActions, checkFormulaArgumentCount, clampMenuPosition, compareCellValues, computeFillTarget, csvImportAdapter, escapeCsvField, fillSeries, formatCellDisplay, formatValueWithCode, getFillDirection, getFormulaArgumentSpecIndex, getFormulaCaretContext, getFormulaFunction, getFormulaHints, getFormulaSignature, getFormulaSignatureParts, getSpreadsheetMenuItems, importFileIntoSpreadsheet, isBlankValue, isSingleCellRange, listFormulaFunctions, matchesFilterRule, normalizeRange, parseCellInput, parseCriteria, parseCsv, parseNumberText, parseTsv, rangeContains, rangeContainsRange, rangesIntersect, registerFormulaFunction, registerSpreadsheetImportAdapters, roundFloat, searchFormulaFunctions, serialFromYmd, serializeCsv, serializeTsv, toNumber, tsvImportAdapter, unregisterFormulaFunction, wildcardToRegExp };
@@ -52,7 +52,7 @@ import {
52
52
  shiftFormulaReferences,
53
53
  toNumber,
54
54
  tsvImportAdapter
55
- } from "../chunk-RU52I7QO.js";
55
+ } from "../chunk-K3R5NG2D.js";
56
56
  import {
57
57
  FORMULA_ERRORS,
58
58
  FormulaEvaluator,
@@ -61,7 +61,10 @@ import {
61
61
  WHOLE_COLUMN_END_ROW,
62
62
  checkFormulaArgumentCount,
63
63
  colNameToIndex,
64
+ compareNumbers,
65
+ compareValues,
64
66
  describeFormulaError,
67
+ formatCellDisplay,
65
68
  formatValueWithCode,
66
69
  getFormulaArgumentSpecIndex,
67
70
  getFormulaFunction,
@@ -70,16 +73,21 @@ import {
70
73
  indexToColName,
71
74
  isFormulaError,
72
75
  listFormulaFunctions,
76
+ numberToText,
77
+ parseCellInput,
73
78
  parseCellReference,
74
79
  parseCriteria,
75
80
  parseFormula,
81
+ parseNumberText,
76
82
  parseRange,
77
83
  registerFormulaFunction,
78
84
  searchFormulaFunctions,
85
+ serialFromYmd,
86
+ sortCompareValues,
79
87
  tokenizeFormula,
80
88
  unregisterFormulaFunction,
81
89
  wildcardToRegExp
82
- } from "../chunk-DENSCKFC.js";
90
+ } from "../chunk-QBJ22YZR.js";
83
91
  export {
84
92
  DEFAULT_COLUMN_WIDTH,
85
93
  DEFAULT_ROW_HEIGHT,
@@ -103,6 +111,8 @@ export {
103
111
  colNameToIndex,
104
112
  columnDependencyKey,
105
113
  compareCellValues,
114
+ compareNumbers,
115
+ compareValues,
106
116
  computeFillTarget,
107
117
  computeRowGroups,
108
118
  createSpreadsheetClipboardData,
@@ -111,6 +121,7 @@ export {
111
121
  escapeCsvField,
112
122
  extractCellDependencies,
113
123
  fillSeries,
124
+ formatCellDisplay,
114
125
  formatValueWithCode,
115
126
  getFillDirection,
116
127
  getFormulaArgumentSpecIndex,
@@ -131,12 +142,15 @@ export {
131
142
  mapFormulaReferences,
132
143
  matchesFilterRule,
133
144
  normalizeRange,
145
+ numberToText,
134
146
  offsetFormulaReferences,
147
+ parseCellInput,
135
148
  parseCellReference,
136
149
  parseCriteria,
137
150
  parseCsv,
138
151
  parseFormula,
139
152
  parseHtmlTable,
153
+ parseNumberText,
140
154
  parseRange,
141
155
  parseTsv,
142
156
  rangeContains,
@@ -150,10 +164,12 @@ export {
150
164
  roundFloat,
151
165
  rowPassesFilters,
152
166
  searchFormulaFunctions,
167
+ serialFromYmd,
153
168
  serializeCsv,
154
169
  serializeHtmlTable,
155
170
  serializeTsv,
156
171
  shiftFormulaReferences,
172
+ sortCompareValues,
157
173
  toNumber,
158
174
  tokenizeFormula,
159
175
  tsvImportAdapter,
@@ -214,4 +214,4 @@ interface CanvasDockingCallbacks<TNode extends CanvasNode = CanvasNode> {
214
214
  onDockDrop?: (dockTarget: TNode, draggedNode: TNode) => void;
215
215
  }
216
216
 
217
- export type { CanvasNode as C, DirectionalDisplacementOptions as D, ExplodeNodeOptions as E, FanOutTrajectoryOptions as F, GraphDifferences as G, IncrementalLayoutOptions as I, NodeTransition as N, PlaceBesideOptions as P, Rect as R, Side as S, TrajectoryFunction as T, XYPosition as X, CanvasEdge as a, CanvasLayoutOptions as b, CanvasNodeStyle as c, ReflowDisplacementOptions as d, CanvasClipboardPayload as e, Position as f, Point as g, CanvasDockingCallbacks as h, CollapseNodeOptions as i, DisplacementDirection as j, DockStrategy as k, ExplosionSnapshot as l, TrajectoryPoint as m };
217
+ export type { CanvasNode as C, DirectionalDisplacementOptions as D, ExplodeNodeOptions as E, FanOutTrajectoryOptions as F, GraphDifferences as G, IncrementalLayoutOptions as I, NodeTransition as N, PlaceBesideOptions as P, Rect as R, Side as S, TrajectoryFunction as T, XYPosition as X, CanvasNodeStyle as a, CanvasEdge as b, CanvasLayoutOptions as c, ReflowDisplacementOptions as d, CanvasClipboardPayload as e, Position as f, Point as g, CanvasDockingCallbacks as h, CollapseNodeOptions as i, DisplacementDirection as j, DockStrategy as k, ExplosionSnapshot as l, TrajectoryPoint as m };
@@ -214,4 +214,4 @@ interface CanvasDockingCallbacks<TNode extends CanvasNode = CanvasNode> {
214
214
  onDockDrop?: (dockTarget: TNode, draggedNode: TNode) => void;
215
215
  }
216
216
 
217
- export type { CanvasNode as C, DirectionalDisplacementOptions as D, ExplodeNodeOptions as E, FanOutTrajectoryOptions as F, GraphDifferences as G, IncrementalLayoutOptions as I, NodeTransition as N, PlaceBesideOptions as P, Rect as R, Side as S, TrajectoryFunction as T, XYPosition as X, CanvasEdge as a, CanvasLayoutOptions as b, CanvasNodeStyle as c, ReflowDisplacementOptions as d, CanvasClipboardPayload as e, Position as f, Point as g, CanvasDockingCallbacks as h, CollapseNodeOptions as i, DisplacementDirection as j, DockStrategy as k, ExplosionSnapshot as l, TrajectoryPoint as m };
217
+ export type { CanvasNode as C, DirectionalDisplacementOptions as D, ExplodeNodeOptions as E, FanOutTrajectoryOptions as F, GraphDifferences as G, IncrementalLayoutOptions as I, NodeTransition as N, PlaceBesideOptions as P, Rect as R, Side as S, TrajectoryFunction as T, XYPosition as X, CanvasNodeStyle as a, CanvasEdge as b, CanvasLayoutOptions as c, ReflowDisplacementOptions as d, CanvasClipboardPayload as e, Position as f, Point as g, CanvasDockingCallbacks as h, CollapseNodeOptions as i, DisplacementDirection as j, DockStrategy as k, ExplosionSnapshot as l, TrajectoryPoint as m };
@@ -0,0 +1,86 @@
1
+ interface Command {
2
+ execute: () => void;
3
+ undo: () => void;
4
+ redo?: () => void;
5
+ name: string;
6
+ tag?: string;
7
+ timestamp?: number;
8
+ /**
9
+ * Approximate memory held by this command (closures, snapshots), in bytes.
10
+ * Counted against `HistoryManagerOptions.maxBytes` when no `sizeOf` hook is set.
11
+ */
12
+ byteSize?: number;
13
+ }
14
+ interface HistoryState {
15
+ canUndo: boolean;
16
+ canRedo: boolean;
17
+ undoName: string;
18
+ redoName: string;
19
+ undoCount: number;
20
+ redoCount: number;
21
+ }
22
+ interface HistoryManagerOptions {
23
+ /**
24
+ * Maximum number of undo states to keep. Defaults to 50.
25
+ */
26
+ maxDepth?: number;
27
+ /**
28
+ * Approximate memory budget in bytes for the undo and redo stacks
29
+ * (0 or omitted = unlimited). The oldest undo steps that do not fit are
30
+ * dropped; the most recent one is always kept so the last step can be undone.
31
+ */
32
+ maxBytes?: number;
33
+ /**
34
+ * Measures a command for `maxBytes`. Defaults to `command.byteSize ?? 0`.
35
+ */
36
+ sizeOf?: (command: Command) => number;
37
+ /**
38
+ * Optional callback fired whenever the history state changes.
39
+ */
40
+ onStateChange?: (state: HistoryState) => void;
41
+ }
42
+ interface SnapshotCommandOptions<T> {
43
+ name: string;
44
+ before: T;
45
+ after: T;
46
+ apply: (state: T) => void;
47
+ tag?: string;
48
+ }
49
+ interface MergedExecutionOptions {
50
+ /**
51
+ * Window in milliseconds during which commands with the same tag will be coalesced.
52
+ * Defaults to 300ms. Ignored when `key` is set or a gesture is held.
53
+ */
54
+ windowMs?: number;
55
+ /**
56
+ * Gesture key. Consecutive merged executes with the same key fold into one
57
+ * undo step regardless of timing, until another command is recorded, undo /
58
+ * redo / `revertTo` / `goTo` runs, or `endGesture()` is called.
59
+ */
60
+ key?: string;
61
+ }
62
+ /** One row of a History panel (see `HistoryManager.getEntries`). */
63
+ interface HistoryEntry {
64
+ /** Stable id of the step (unchanged while a gesture merges into it). */
65
+ id: number;
66
+ /** The step's command name. */
67
+ label: string;
68
+ /** Position in the timeline: undo steps first (oldest = 0), then redo steps. */
69
+ index: number;
70
+ /** True for the step that produced the current state (the top of the undo stack). */
71
+ current: boolean;
72
+ /** True for steps on the redo stack (undone, can be redone). */
73
+ undone: boolean;
74
+ }
75
+ /**
76
+ * A point in the undo history, from `HistoryManager.mark()`, for `revertTo`.
77
+ * Treat it as opaque.
78
+ */
79
+ interface HistoryMark {
80
+ readonly topId: number | null;
81
+ readonly nextId: number;
82
+ readonly epoch: number;
83
+ readonly dropped: number;
84
+ }
85
+
86
+ export type { Command as C, HistoryState as H, MergedExecutionOptions as M, SnapshotCommandOptions as S, HistoryEntry as a, HistoryManagerOptions as b, HistoryMark as c };
@@ -0,0 +1,86 @@
1
+ interface Command {
2
+ execute: () => void;
3
+ undo: () => void;
4
+ redo?: () => void;
5
+ name: string;
6
+ tag?: string;
7
+ timestamp?: number;
8
+ /**
9
+ * Approximate memory held by this command (closures, snapshots), in bytes.
10
+ * Counted against `HistoryManagerOptions.maxBytes` when no `sizeOf` hook is set.
11
+ */
12
+ byteSize?: number;
13
+ }
14
+ interface HistoryState {
15
+ canUndo: boolean;
16
+ canRedo: boolean;
17
+ undoName: string;
18
+ redoName: string;
19
+ undoCount: number;
20
+ redoCount: number;
21
+ }
22
+ interface HistoryManagerOptions {
23
+ /**
24
+ * Maximum number of undo states to keep. Defaults to 50.
25
+ */
26
+ maxDepth?: number;
27
+ /**
28
+ * Approximate memory budget in bytes for the undo and redo stacks
29
+ * (0 or omitted = unlimited). The oldest undo steps that do not fit are
30
+ * dropped; the most recent one is always kept so the last step can be undone.
31
+ */
32
+ maxBytes?: number;
33
+ /**
34
+ * Measures a command for `maxBytes`. Defaults to `command.byteSize ?? 0`.
35
+ */
36
+ sizeOf?: (command: Command) => number;
37
+ /**
38
+ * Optional callback fired whenever the history state changes.
39
+ */
40
+ onStateChange?: (state: HistoryState) => void;
41
+ }
42
+ interface SnapshotCommandOptions<T> {
43
+ name: string;
44
+ before: T;
45
+ after: T;
46
+ apply: (state: T) => void;
47
+ tag?: string;
48
+ }
49
+ interface MergedExecutionOptions {
50
+ /**
51
+ * Window in milliseconds during which commands with the same tag will be coalesced.
52
+ * Defaults to 300ms. Ignored when `key` is set or a gesture is held.
53
+ */
54
+ windowMs?: number;
55
+ /**
56
+ * Gesture key. Consecutive merged executes with the same key fold into one
57
+ * undo step regardless of timing, until another command is recorded, undo /
58
+ * redo / `revertTo` / `goTo` runs, or `endGesture()` is called.
59
+ */
60
+ key?: string;
61
+ }
62
+ /** One row of a History panel (see `HistoryManager.getEntries`). */
63
+ interface HistoryEntry {
64
+ /** Stable id of the step (unchanged while a gesture merges into it). */
65
+ id: number;
66
+ /** The step's command name. */
67
+ label: string;
68
+ /** Position in the timeline: undo steps first (oldest = 0), then redo steps. */
69
+ index: number;
70
+ /** True for the step that produced the current state (the top of the undo stack). */
71
+ current: boolean;
72
+ /** True for steps on the redo stack (undone, can be redone). */
73
+ undone: boolean;
74
+ }
75
+ /**
76
+ * A point in the undo history, from `HistoryManager.mark()`, for `revertTo`.
77
+ * Treat it as opaque.
78
+ */
79
+ interface HistoryMark {
80
+ readonly topId: number | null;
81
+ readonly nextId: number;
82
+ readonly epoch: number;
83
+ readonly dropped: number;
84
+ }
85
+
86
+ export type { Command as C, HistoryState as H, MergedExecutionOptions as M, SnapshotCommandOptions as S, HistoryEntry as a, HistoryManagerOptions as b, HistoryMark as c };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixerate/editor",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "description": "UI-agnostic rich text and media editing core library",
5
5
  "author": "Pixerate",
6
6
  "license": "MIT",
@@ -58,10 +58,16 @@
58
58
  "types": "./dist/image-editor/index.d.ts",
59
59
  "import": "./dist/image-editor/index.js",
60
60
  "require": "./dist/image-editor/index.cjs"
61
+ },
62
+ "./commands": {
63
+ "types": "./dist/commands/index.d.ts",
64
+ "import": "./dist/commands/index.js",
65
+ "require": "./dist/commands/index.cjs"
61
66
  }
62
67
  },
63
68
  "files": [
64
- "dist"
69
+ "dist",
70
+ "THIRD_PARTY_NOTICES.md"
65
71
  ],
66
72
  "sideEffects": false,
67
73
  "dependencies": {