@pixerate/editor 0.24.0 → 0.25.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 (133) hide show
  1. package/README.md +71 -1
  2. package/THIRD_PARTY_NOTICES.md +29 -0
  3. package/dist/agent/index.cjs +10 -9
  4. package/dist/agent/index.cjs.map +1 -1
  5. package/dist/agent/index.d.cts +1 -1
  6. package/dist/agent/index.d.ts +1 -1
  7. package/dist/agent/index.js +4 -3
  8. package/dist/agent/index.js.map +1 -1
  9. package/dist/canvas/index.cjs +3173 -340
  10. package/dist/canvas/index.cjs.map +1 -1
  11. package/dist/canvas/index.d.cts +617 -4
  12. package/dist/canvas/index.d.ts +617 -4
  13. package/dist/canvas/index.js +3105 -272
  14. package/dist/canvas/index.js.map +1 -1
  15. package/dist/chunk-4BVP64JJ.cjs +1406 -0
  16. package/dist/chunk-4BVP64JJ.cjs.map +1 -0
  17. package/dist/{chunk-XNORY7M6.cjs → chunk-7WISYZFO.cjs} +105 -50
  18. package/dist/chunk-7WISYZFO.cjs.map +1 -0
  19. package/dist/{chunk-OLZJXL4R.cjs → chunk-AL6JMGWW.cjs} +59 -25
  20. package/dist/chunk-AL6JMGWW.cjs.map +1 -0
  21. package/dist/chunk-BVP3TSLH.cjs +69 -0
  22. package/dist/chunk-BVP3TSLH.cjs.map +1 -0
  23. package/dist/{chunk-MCSJFWAO.cjs → chunk-C7P22VIP.cjs} +670 -96
  24. package/dist/chunk-C7P22VIP.cjs.map +1 -0
  25. package/dist/{chunk-PGNZKFQS.js → chunk-ECCCYKGL.js} +76 -21
  26. package/dist/chunk-ECCCYKGL.js.map +1 -0
  27. package/dist/{chunk-3CN2WD3X.js → chunk-FH6F67DN.js} +646 -72
  28. package/dist/chunk-FH6F67DN.js.map +1 -0
  29. package/dist/chunk-HRMEDT2L.js +1406 -0
  30. package/dist/chunk-HRMEDT2L.js.map +1 -0
  31. package/dist/{chunk-ITBSKI26.js → chunk-IXHSYOVY.js} +941 -9
  32. package/dist/chunk-IXHSYOVY.js.map +1 -0
  33. package/dist/{chunk-FODNLX5N.js → chunk-NAXVVS5I.js} +38 -4
  34. package/dist/chunk-NAXVVS5I.js.map +1 -0
  35. package/dist/chunk-O5RYH2PG.js +69 -0
  36. package/dist/chunk-O5RYH2PG.js.map +1 -0
  37. package/dist/{chunk-SBCZ6RN5.cjs → chunk-PO6A6QQH.cjs} +1039 -107
  38. package/dist/chunk-PO6A6QQH.cjs.map +1 -0
  39. package/dist/{chunk-3LV6RRPH.js → chunk-QGYDWPRM.js} +2 -2
  40. package/dist/{chunk-U5KWZU4X.js → chunk-RR7F5GUM.js} +2632 -129
  41. package/dist/chunk-RR7F5GUM.js.map +1 -0
  42. package/dist/{chunk-5S3Z4PPF.js → chunk-UAKDG62Z.js} +232 -25
  43. package/dist/chunk-UAKDG62Z.js.map +1 -0
  44. package/dist/{chunk-SML64VJG.cjs → chunk-V3CHHWOE.cjs} +4 -4
  45. package/dist/{chunk-SML64VJG.cjs.map → chunk-V3CHHWOE.cjs.map} +1 -1
  46. package/dist/chunk-WSQKHXW7.cjs +5726 -0
  47. package/dist/chunk-WSQKHXW7.cjs.map +1 -0
  48. package/dist/{chunk-D27YFC46.cjs → chunk-X4N4WUKB.cjs} +267 -60
  49. package/dist/chunk-X4N4WUKB.cjs.map +1 -0
  50. package/dist/commands/index.cjs +74 -1
  51. package/dist/commands/index.cjs.map +1 -1
  52. package/dist/commands/index.d.cts +34 -1
  53. package/dist/commands/index.d.ts +34 -1
  54. package/dist/commands/index.js +73 -0
  55. package/dist/commands/index.js.map +1 -1
  56. package/dist/compare/index.cjs +3 -3
  57. package/dist/compare/index.d.cts +1 -1
  58. package/dist/compare/index.d.ts +1 -1
  59. package/dist/compare/index.js +2 -2
  60. package/dist/controller-BIJiNoVs.d.cts +1842 -0
  61. package/dist/controller-BIJiNoVs.d.ts +1842 -0
  62. package/dist/{documents-BQjzJNe2.d.ts → documents-CHT1U5Vs.d.ts} +10 -0
  63. package/dist/{documents-KRTPhvst.d.cts → documents-Gp7wb0Me.d.cts} +10 -0
  64. package/dist/extensions/index.cjs +53 -6
  65. package/dist/extensions/index.cjs.map +1 -1
  66. package/dist/extensions/index.d.cts +12 -4
  67. package/dist/extensions/index.d.ts +12 -4
  68. package/dist/extensions/index.js +53 -6
  69. package/dist/generation/index.cjs +1013 -69
  70. package/dist/generation/index.cjs.map +1 -1
  71. package/dist/generation/index.d.cts +474 -13
  72. package/dist/generation/index.d.ts +474 -13
  73. package/dist/generation/index.js +976 -32
  74. package/dist/generation/index.js.map +1 -1
  75. package/dist/image-editor/index.cjs +3385 -1275
  76. package/dist/image-editor/index.cjs.map +1 -1
  77. package/dist/image-editor/index.d.cts +693 -128
  78. package/dist/image-editor/index.d.ts +693 -128
  79. package/dist/image-editor/index.js +3325 -1215
  80. package/dist/image-editor/index.js.map +1 -1
  81. package/dist/{index-fJrlkJCd.d.ts → index-7a6bHTLy.d.ts} +494 -5
  82. package/dist/{index-BhJBSm2d.d.cts → index-Csd5qI8u.d.cts} +494 -5
  83. package/dist/index.cjs +1491 -45
  84. package/dist/index.cjs.map +1 -1
  85. package/dist/index.d.cts +110 -19
  86. package/dist/index.d.ts +110 -19
  87. package/dist/index.js +1464 -18
  88. package/dist/index.js.map +1 -1
  89. package/dist/mention-text-CDnCFd3c.d.cts +53 -0
  90. package/dist/mention-text-CDnCFd3c.d.ts +53 -0
  91. package/dist/model-C1zApQM8.d.cts +219 -0
  92. package/dist/model-C1zApQM8.d.ts +219 -0
  93. package/dist/persistence/index.d.cts +3 -120
  94. package/dist/persistence/index.d.ts +3 -120
  95. package/dist/{registry-GJI4gToU.d.cts → registry-CEgwXED1.d.cts} +12 -1
  96. package/dist/{registry-GJI4gToU.d.ts → registry-CEgwXED1.d.ts} +12 -1
  97. package/dist/serializers/index.cjs +12 -4
  98. package/dist/serializers/index.cjs.map +1 -1
  99. package/dist/serializers/index.d.cts +39 -12
  100. package/dist/serializers/index.d.ts +39 -12
  101. package/dist/serializers/index.js +12 -4
  102. package/dist/spreadsheet/index.cjs +127 -3
  103. package/dist/spreadsheet/index.cjs.map +1 -1
  104. package/dist/spreadsheet/index.d.cts +431 -11
  105. package/dist/spreadsheet/index.d.ts +431 -11
  106. package/dist/spreadsheet/index.js +127 -3
  107. package/dist/storage-BpFfspHm.d.cts +120 -0
  108. package/dist/storage-BpFfspHm.d.ts +120 -0
  109. package/dist/tokens/index.cjs +115 -0
  110. package/dist/tokens/index.cjs.map +1 -0
  111. package/dist/tokens/index.d.cts +212 -0
  112. package/dist/tokens/index.d.ts +212 -0
  113. package/dist/tokens/index.js +115 -0
  114. package/dist/tokens/index.js.map +1 -0
  115. package/dist/{track-changes-BK5sVf4_.d.cts → track-changes-D_VAPELi.d.cts} +95 -11
  116. package/dist/{track-changes-CDjCrwKe.d.ts → track-changes-Db_fGEvx.d.ts} +95 -11
  117. package/package.json +6 -1
  118. package/dist/chunk-3CN2WD3X.js.map +0 -1
  119. package/dist/chunk-5S3Z4PPF.js.map +0 -1
  120. package/dist/chunk-D27YFC46.cjs.map +0 -1
  121. package/dist/chunk-FODNLX5N.js.map +0 -1
  122. package/dist/chunk-ITBSKI26.js.map +0 -1
  123. package/dist/chunk-MA2F5KHF.cjs +0 -3223
  124. package/dist/chunk-MA2F5KHF.cjs.map +0 -1
  125. package/dist/chunk-MCSJFWAO.cjs.map +0 -1
  126. package/dist/chunk-OLZJXL4R.cjs.map +0 -1
  127. package/dist/chunk-PGNZKFQS.js.map +0 -1
  128. package/dist/chunk-SBCZ6RN5.cjs.map +0 -1
  129. package/dist/chunk-U5KWZU4X.js.map +0 -1
  130. package/dist/chunk-XNORY7M6.cjs.map +0 -1
  131. package/dist/controller-BhLLAoi8.d.cts +0 -1000
  132. package/dist/controller-BhLLAoi8.d.ts +0 -1000
  133. /package/dist/{chunk-3LV6RRPH.js.map → chunk-QGYDWPRM.js.map} +0 -0
@@ -1,16 +1,33 @@
1
1
  import {
2
+ CONDITIONAL_FORMAT_ICON_SETS,
3
+ CONDITIONAL_FORMAT_PRESETS,
4
+ CONDITIONAL_FORMAT_STYLE_PRESETS,
5
+ CONDITIONAL_FORMAT_TIME_PERIODS,
6
+ ConditionalFormatEngine,
7
+ DATA_VALIDATION_ERROR_STYLE_OPTIONS,
8
+ DATA_VALIDATION_OPERATOR_OPTIONS,
9
+ DATA_VALIDATION_TYPE_OPTIONS,
2
10
  DEFAULT_COLUMN_WIDTH,
11
+ DEFAULT_CONDITIONAL_FORMAT_STYLE,
12
+ DEFAULT_DATA_VALIDATION_MESSAGE,
13
+ DEFAULT_DATA_VALIDATION_TITLE,
3
14
  DEFAULT_ROW_HEIGHT,
4
15
  DataSourceBinder,
5
16
  DependencyGraph,
17
+ EMPTY_CONDITIONAL_FORMAT_OVERLAY,
18
+ MAX_DEFINED_NAME_LENGTH,
19
+ MAX_SHEET_NAME_LENGTH,
6
20
  NUMBER_FORMAT_PRESETS,
7
21
  SPREADSHEET_CLIPBOARD_MIME,
8
22
  SPREADSHEET_IMPORT_ADAPTERS,
9
23
  SPREADSHEET_TABLE_ACTIONS,
10
24
  SpreadsheetController,
25
+ adjustRangeForStructuralChange,
26
+ adjustRangesForStructuralChange,
11
27
  aggregateValues,
12
28
  applyFormulaSuggestion,
13
29
  bindSpreadsheetTableActions,
30
+ blendConditionalFormatColors,
14
31
  buildSpreadsheetView,
15
32
  cellFormatForNumberFormat,
16
33
  clampMenuPosition,
@@ -18,44 +35,86 @@ import {
18
35
  compareCellValues,
19
36
  computeFillTarget,
20
37
  computeRowGroups,
38
+ conditionalFormatContrastColor,
39
+ conditionalFormatIconCount,
40
+ conditionalFormatNumber,
41
+ conditionalFormatStyleString,
42
+ copySheetName,
43
+ createConditionalFormatRule,
21
44
  createSpreadsheetClipboardData,
22
45
  csvImportAdapter,
46
+ defaultIconThresholds,
47
+ deleteSheetInFormula,
48
+ describeConditionalFormat,
49
+ describeDataValidation,
50
+ evaluateConditionalFormats,
23
51
  extractCellDependencies,
52
+ extractNameDependencies,
24
53
  fillSeries,
54
+ findDataValidation,
55
+ findInvalidCells,
56
+ forEachRangeCell,
25
57
  formatCellDisplay,
26
58
  formatCellForDisplay,
59
+ formatRuleRanges,
60
+ formatSheetPrefix,
27
61
  formatValueWithCode,
62
+ formulaIdentifiers,
63
+ getConditionalFormatCss,
64
+ getConditionalFormatIcon,
65
+ getDataBarCss,
28
66
  getFillDirection,
29
67
  getFormulaCaretContext,
30
68
  getFormulaHints,
69
+ getNameManagerRows,
31
70
  getRowSection,
71
+ getSheetTabMenuItems,
32
72
  getSpreadsheetMenuItems,
33
73
  getTableSections,
74
+ getValidationListValues,
34
75
  importFileIntoSpreadsheet,
35
76
  isBlankValue,
36
77
  isGeneralNumberFormat,
78
+ isLambdaDefinition,
37
79
  isSingleCellRange,
38
80
  mapFormulaReferences,
39
81
  matchesFilterRule,
82
+ matchesTimePeriod,
83
+ nextSheetName,
40
84
  normalizeRange,
41
85
  numberFormatForCellFormat,
42
86
  offsetFormulaReferences,
43
87
  parseHtmlTable,
88
+ parseRuleRanges,
89
+ quoteSheetName,
44
90
  rangeContains,
45
91
  rangeContainsRange,
92
+ rangesContain,
46
93
  rangesIntersect,
47
94
  readSpreadsheetClipboard,
48
95
  rebaseClipboardRows,
49
96
  registerSpreadsheetImportAdapters,
50
97
  remapFormulaReferences,
98
+ renameNameInFormula,
99
+ renameSheetInFormula,
51
100
  roundFloat,
52
101
  rowPassesFilters,
102
+ ruleAnchor,
103
+ ruleFormulaAt,
53
104
  runSpreadsheetMenuItem,
54
105
  serializeHtmlTable,
106
+ sheetDropIndex,
107
+ sheetNameNeedsQuotes,
55
108
  shiftFormulaReferences,
109
+ shiftRuleFormula,
110
+ subtractRange,
111
+ subtractRangeFromRanges,
56
112
  toNumber,
57
- tsvImportAdapter
58
- } from "../chunk-U5KWZU4X.js";
113
+ tsvImportAdapter,
114
+ validateCellInput,
115
+ validateDefinedName,
116
+ validateSheetName
117
+ } from "../chunk-RR7F5GUM.js";
59
118
  import {
60
119
  escapeCsvField,
61
120
  parseCsv,
@@ -66,8 +125,10 @@ import {
66
125
  import {
67
126
  FORMULA_ERRORS,
68
127
  FormulaEvaluator,
128
+ FormulaLambda,
69
129
  FormulaParser,
70
130
  MAX_FORMULA_ARRAY_SIZE,
131
+ MAX_LAMBDA_DEPTH,
71
132
  MAX_NUMBER_FORMAT_CODE_CHARS,
72
133
  NumberFormat,
73
134
  WHOLE_COLUMN_END_ROW,
@@ -89,6 +150,7 @@ import {
89
150
  getFormulaSignatureParts,
90
151
  indexToColName,
91
152
  isFormulaError,
153
+ isFormulaLambda,
92
154
  listFormulaFunctions,
93
155
  numberFormatColorToCss,
94
156
  numberToText,
@@ -105,17 +167,33 @@ import {
105
167
  tokenizeFormula,
106
168
  unregisterFormulaFunction,
107
169
  wildcardToRegExp
108
- } from "../chunk-3CN2WD3X.js";
170
+ } from "../chunk-FH6F67DN.js";
109
171
  export {
172
+ CONDITIONAL_FORMAT_ICON_SETS,
173
+ CONDITIONAL_FORMAT_PRESETS,
174
+ CONDITIONAL_FORMAT_STYLE_PRESETS,
175
+ CONDITIONAL_FORMAT_TIME_PERIODS,
176
+ ConditionalFormatEngine,
177
+ DATA_VALIDATION_ERROR_STYLE_OPTIONS,
178
+ DATA_VALIDATION_OPERATOR_OPTIONS,
179
+ DATA_VALIDATION_TYPE_OPTIONS,
110
180
  DEFAULT_COLUMN_WIDTH,
181
+ DEFAULT_CONDITIONAL_FORMAT_STYLE,
182
+ DEFAULT_DATA_VALIDATION_MESSAGE,
183
+ DEFAULT_DATA_VALIDATION_TITLE,
111
184
  DEFAULT_ROW_HEIGHT,
112
185
  DataSourceBinder,
113
186
  DependencyGraph,
187
+ EMPTY_CONDITIONAL_FORMAT_OVERLAY,
114
188
  FORMULA_ERRORS,
115
189
  FormulaEvaluator,
190
+ FormulaLambda,
116
191
  FormulaParser,
192
+ MAX_DEFINED_NAME_LENGTH,
117
193
  MAX_FORMULA_ARRAY_SIZE,
194
+ MAX_LAMBDA_DEPTH,
118
195
  MAX_NUMBER_FORMAT_CODE_CHARS,
196
+ MAX_SHEET_NAME_LENGTH,
119
197
  NUMBER_FORMAT_PRESETS,
120
198
  NumberFormat,
121
199
  SPREADSHEET_CLIPBOARD_MIME,
@@ -123,9 +201,12 @@ export {
123
201
  SPREADSHEET_TABLE_ACTIONS,
124
202
  SpreadsheetController,
125
203
  WHOLE_COLUMN_END_ROW,
204
+ adjustRangeForStructuralChange,
205
+ adjustRangesForStructuralChange,
126
206
  aggregateValues,
127
207
  applyFormulaSuggestion,
128
208
  bindSpreadsheetTableActions,
209
+ blendConditionalFormatColors,
129
210
  buildSpreadsheetView,
130
211
  builtinNumberFormat,
131
212
  builtinNumberFormatId,
@@ -140,19 +221,40 @@ export {
140
221
  compareValues,
141
222
  computeFillTarget,
142
223
  computeRowGroups,
224
+ conditionalFormatContrastColor,
225
+ conditionalFormatIconCount,
226
+ conditionalFormatNumber,
227
+ conditionalFormatStyleString,
228
+ copySheetName,
229
+ createConditionalFormatRule,
143
230
  createSpreadsheetClipboardData,
144
231
  csvImportAdapter,
145
232
  dateValueToSerial,
233
+ defaultIconThresholds,
234
+ deleteSheetInFormula,
235
+ describeConditionalFormat,
236
+ describeDataValidation,
146
237
  describeFormulaError,
147
238
  escapeCsvField,
239
+ evaluateConditionalFormats,
148
240
  extractCellDependencies,
241
+ extractNameDependencies,
149
242
  fillSeries,
243
+ findDataValidation,
244
+ findInvalidCells,
245
+ forEachRangeCell,
150
246
  formatCellDisplay,
151
247
  formatCellForDisplay,
152
248
  formatGeneralFit,
153
249
  formatNumberFormatValue,
250
+ formatRuleRanges,
251
+ formatSheetPrefix,
154
252
  formatTextFunction,
155
253
  formatValueWithCode,
254
+ formulaIdentifiers,
255
+ getConditionalFormatCss,
256
+ getConditionalFormatIcon,
257
+ getDataBarCss,
156
258
  getFillDirection,
157
259
  getFormulaArgumentSpecIndex,
158
260
  getFormulaCaretContext,
@@ -160,18 +262,25 @@ export {
160
262
  getFormulaHints,
161
263
  getFormulaSignature,
162
264
  getFormulaSignatureParts,
265
+ getNameManagerRows,
163
266
  getRowSection,
267
+ getSheetTabMenuItems,
164
268
  getSpreadsheetMenuItems,
165
269
  getTableSections,
270
+ getValidationListValues,
166
271
  importFileIntoSpreadsheet,
167
272
  indexToColName,
168
273
  isBlankValue,
169
274
  isFormulaError,
275
+ isFormulaLambda,
170
276
  isGeneralNumberFormat,
277
+ isLambdaDefinition,
171
278
  isSingleCellRange,
172
279
  listFormulaFunctions,
173
280
  mapFormulaReferences,
174
281
  matchesFilterRule,
282
+ matchesTimePeriod,
283
+ nextSheetName,
175
284
  normalizeRange,
176
285
  numberFormatColorToCss,
177
286
  numberFormatForCellFormat,
@@ -185,29 +294,44 @@ export {
185
294
  parseHtmlTable,
186
295
  parseNumberText,
187
296
  parseRange,
297
+ parseRuleRanges,
188
298
  parseTsv,
299
+ quoteSheetName,
189
300
  rangeContains,
190
301
  rangeContainsRange,
302
+ rangesContain,
191
303
  rangesIntersect,
192
304
  readSpreadsheetClipboard,
193
305
  rebaseClipboardRows,
194
306
  registerFormulaFunction,
195
307
  registerSpreadsheetImportAdapters,
196
308
  remapFormulaReferences,
309
+ renameNameInFormula,
310
+ renameSheetInFormula,
197
311
  roundFloat,
198
312
  rowPassesFilters,
313
+ ruleAnchor,
314
+ ruleFormulaAt,
199
315
  runSpreadsheetMenuItem,
200
316
  searchFormulaFunctions,
201
317
  serialFromYmd,
202
318
  serializeCsv,
203
319
  serializeHtmlTable,
204
320
  serializeTsv,
321
+ sheetDropIndex,
322
+ sheetNameNeedsQuotes,
205
323
  shiftFormulaReferences,
324
+ shiftRuleFormula,
206
325
  sortCompareValues,
326
+ subtractRange,
327
+ subtractRangeFromRanges,
207
328
  toNumber,
208
329
  tokenizeFormula,
209
330
  tsvImportAdapter,
210
331
  unregisterFormulaFunction,
332
+ validateCellInput,
333
+ validateDefinedName,
334
+ validateSheetName,
211
335
  wildcardToRegExp
212
336
  };
213
337
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Key/value storage adapters for autosave and crash recovery. Every adapter is
3
+ * async, stores strings, feature-detects its backend (an unavailable backend
4
+ * rejects every call with `StorageUnavailableError` instead of throwing at
5
+ * construction, so SSR and old browsers are safe) and accepts an injectable
6
+ * failure mode for tests.
7
+ */
8
+ type StorageOperation = "get" | "set" | "remove";
9
+ /**
10
+ * Injected failure: return `true` (or an `Error`) to make that operation fail.
11
+ * Example: `failure: (op) => op === "set"` simulates a full disk.
12
+ */
13
+ type StorageFailureMode = (operation: StorageOperation, key: string) => boolean | Error | undefined | void;
14
+ interface StorageAdapter {
15
+ /** Short backend name, e.g. `"memory"`, `"localStorage"`, `"indexedDB"`, `"opfs"`. */
16
+ readonly kind: string;
17
+ /** Whether the backend was found. When `false`, every call rejects. */
18
+ readonly available: boolean;
19
+ get(key: string): Promise<string | null>;
20
+ set(key: string, value: string): Promise<void>;
21
+ remove(key: string): Promise<void>;
22
+ }
23
+ interface StorageAdapterOptions {
24
+ failure?: StorageFailureMode;
25
+ }
26
+ declare class StorageUnavailableError extends Error {
27
+ constructor(kind: string);
28
+ }
29
+ declare class InjectedStorageError extends Error {
30
+ constructor(operation: StorageOperation, key: string);
31
+ }
32
+ /** Wraps an adapter so `failure` can make any of its operations fail. */
33
+ declare function withStorageFailures(inner: StorageAdapter, failure: StorageFailureMode): StorageAdapter;
34
+ interface MemoryStorage extends StorageAdapter {
35
+ /** The underlying map (inspect it in tests). */
36
+ readonly entries: Map<string, string>;
37
+ }
38
+ /** In-memory storage (tests, SSR, or a session-only fallback). */
39
+ declare function createMemoryStorage(options?: StorageAdapterOptions & {
40
+ initial?: Record<string, string>;
41
+ }): MemoryStorage;
42
+ /** Minimal `Storage` surface used by the localStorage adapter. */
43
+ interface WebStorageLike {
44
+ getItem(key: string): string | null;
45
+ setItem(key: string, value: string): void;
46
+ removeItem(key: string): void;
47
+ }
48
+ interface LocalStorageAdapterOptions extends StorageAdapterOptions {
49
+ /** Storage to use (default `globalThis.localStorage`, e.g. pass `sessionStorage`). */
50
+ storage?: WebStorageLike;
51
+ }
52
+ /** Whether `localStorage` can be used (it throws when site data is blocked). */
53
+ declare function isLocalStorageAvailable(): boolean;
54
+ /**
55
+ * `localStorage` adapter; every key is prefixed with `prefix`. Writes are
56
+ * synchronous under the hood, so they complete even inside `pagehide`.
57
+ * A full quota rejects the `set` (`QuotaExceededError`).
58
+ */
59
+ declare function createLocalStorageAdapter(prefix?: string, options?: LocalStorageAdapterOptions): StorageAdapter;
60
+ /** Minimal `IDBFactory` surface (the real `indexedDB`, or a fake in tests). */
61
+ interface IdbFactoryLike {
62
+ open(name: string, version?: number): any;
63
+ }
64
+ interface IndexedDbAdapterOptions extends StorageAdapterOptions {
65
+ /** Object store name (default `"kv"`). */
66
+ store?: string;
67
+ /** Factory to use (default `globalThis.indexedDB`). */
68
+ indexedDB?: IdbFactoryLike;
69
+ }
70
+ /** Whether `indexedDB` exists in this environment. */
71
+ declare function isIndexedDbAvailable(): boolean;
72
+ /**
73
+ * IndexedDB adapter: one database `name` with a single key/value object store.
74
+ * A `set` resolves when its transaction completes (not merely when the request
75
+ * succeeds), so a resolved write is durable.
76
+ */
77
+ declare function createIndexedDbAdapter(name?: string, options?: IndexedDbAdapterOptions): StorageAdapter;
78
+ /** Minimal `FileSystemDirectoryHandle` surface used by the OPFS adapter. */
79
+ interface OpfsDirectoryLike {
80
+ getDirectoryHandle(name: string, options?: {
81
+ create?: boolean;
82
+ }): Promise<OpfsDirectoryLike>;
83
+ getFileHandle(name: string, options?: {
84
+ create?: boolean;
85
+ }): Promise<OpfsFileLike>;
86
+ removeEntry(name: string): Promise<void>;
87
+ }
88
+ interface OpfsFileLike {
89
+ getFile(): Promise<{
90
+ text(): Promise<string>;
91
+ }>;
92
+ createWritable?(): Promise<{
93
+ write(data: string): Promise<void>;
94
+ close(): Promise<void>;
95
+ }>;
96
+ /** Rename in place (Chromium, Safari). Used for temp-file + rename writes. */
97
+ move?(name: string): Promise<void>;
98
+ }
99
+ interface OpfsAdapterOptions extends StorageAdapterOptions {
100
+ /** Root directory (default `navigator.storage.getDirectory()`). */
101
+ root?: () => Promise<OpfsDirectoryLike>;
102
+ /** Force the write-then-pointer-swap strategy even when `move` exists. */
103
+ disableRename?: boolean;
104
+ }
105
+ /** Whether the Origin Private File System exists (`navigator.storage.getDirectory`). */
106
+ declare function isOpfsAvailable(): boolean;
107
+ /**
108
+ * Origin Private File System adapter. Values are files in `dir` (created on
109
+ * demand), named after the URI-encoded key.
110
+ *
111
+ * Writes never leave a half-written value behind: where file handles support
112
+ * `move`, the value is written to `<file>.tmp` and renamed over `<file>`;
113
+ * otherwise it alternates between two slots (`<file>.a` / `<file>.b`) and then
114
+ * swaps a pointer file (`<file>.ptr`), so a crash mid-write keeps the previous
115
+ * value. Main-thread writes need `createWritable` (missing in some Safari
116
+ * versions); without it, `set` rejects with `StorageUnavailableError`.
117
+ */
118
+ declare function createOpfsAdapter(dir?: string, options?: OpfsAdapterOptions): StorageAdapter;
119
+
120
+ export { type IdbFactoryLike as I, type LocalStorageAdapterOptions as L, type MemoryStorage as M, type OpfsAdapterOptions as O, type StorageAdapter as S, type WebStorageLike as W, type IndexedDbAdapterOptions as a, InjectedStorageError as b, type OpfsDirectoryLike as c, type OpfsFileLike as d, type StorageAdapterOptions as e, type StorageFailureMode as f, type StorageOperation as g, StorageUnavailableError as h, createIndexedDbAdapter as i, createLocalStorageAdapter as j, createMemoryStorage as k, createOpfsAdapter as l, isIndexedDbAvailable as m, isLocalStorageAvailable as n, isOpfsAvailable as o, withStorageFailures as w };
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Key/value storage adapters for autosave and crash recovery. Every adapter is
3
+ * async, stores strings, feature-detects its backend (an unavailable backend
4
+ * rejects every call with `StorageUnavailableError` instead of throwing at
5
+ * construction, so SSR and old browsers are safe) and accepts an injectable
6
+ * failure mode for tests.
7
+ */
8
+ type StorageOperation = "get" | "set" | "remove";
9
+ /**
10
+ * Injected failure: return `true` (or an `Error`) to make that operation fail.
11
+ * Example: `failure: (op) => op === "set"` simulates a full disk.
12
+ */
13
+ type StorageFailureMode = (operation: StorageOperation, key: string) => boolean | Error | undefined | void;
14
+ interface StorageAdapter {
15
+ /** Short backend name, e.g. `"memory"`, `"localStorage"`, `"indexedDB"`, `"opfs"`. */
16
+ readonly kind: string;
17
+ /** Whether the backend was found. When `false`, every call rejects. */
18
+ readonly available: boolean;
19
+ get(key: string): Promise<string | null>;
20
+ set(key: string, value: string): Promise<void>;
21
+ remove(key: string): Promise<void>;
22
+ }
23
+ interface StorageAdapterOptions {
24
+ failure?: StorageFailureMode;
25
+ }
26
+ declare class StorageUnavailableError extends Error {
27
+ constructor(kind: string);
28
+ }
29
+ declare class InjectedStorageError extends Error {
30
+ constructor(operation: StorageOperation, key: string);
31
+ }
32
+ /** Wraps an adapter so `failure` can make any of its operations fail. */
33
+ declare function withStorageFailures(inner: StorageAdapter, failure: StorageFailureMode): StorageAdapter;
34
+ interface MemoryStorage extends StorageAdapter {
35
+ /** The underlying map (inspect it in tests). */
36
+ readonly entries: Map<string, string>;
37
+ }
38
+ /** In-memory storage (tests, SSR, or a session-only fallback). */
39
+ declare function createMemoryStorage(options?: StorageAdapterOptions & {
40
+ initial?: Record<string, string>;
41
+ }): MemoryStorage;
42
+ /** Minimal `Storage` surface used by the localStorage adapter. */
43
+ interface WebStorageLike {
44
+ getItem(key: string): string | null;
45
+ setItem(key: string, value: string): void;
46
+ removeItem(key: string): void;
47
+ }
48
+ interface LocalStorageAdapterOptions extends StorageAdapterOptions {
49
+ /** Storage to use (default `globalThis.localStorage`, e.g. pass `sessionStorage`). */
50
+ storage?: WebStorageLike;
51
+ }
52
+ /** Whether `localStorage` can be used (it throws when site data is blocked). */
53
+ declare function isLocalStorageAvailable(): boolean;
54
+ /**
55
+ * `localStorage` adapter; every key is prefixed with `prefix`. Writes are
56
+ * synchronous under the hood, so they complete even inside `pagehide`.
57
+ * A full quota rejects the `set` (`QuotaExceededError`).
58
+ */
59
+ declare function createLocalStorageAdapter(prefix?: string, options?: LocalStorageAdapterOptions): StorageAdapter;
60
+ /** Minimal `IDBFactory` surface (the real `indexedDB`, or a fake in tests). */
61
+ interface IdbFactoryLike {
62
+ open(name: string, version?: number): any;
63
+ }
64
+ interface IndexedDbAdapterOptions extends StorageAdapterOptions {
65
+ /** Object store name (default `"kv"`). */
66
+ store?: string;
67
+ /** Factory to use (default `globalThis.indexedDB`). */
68
+ indexedDB?: IdbFactoryLike;
69
+ }
70
+ /** Whether `indexedDB` exists in this environment. */
71
+ declare function isIndexedDbAvailable(): boolean;
72
+ /**
73
+ * IndexedDB adapter: one database `name` with a single key/value object store.
74
+ * A `set` resolves when its transaction completes (not merely when the request
75
+ * succeeds), so a resolved write is durable.
76
+ */
77
+ declare function createIndexedDbAdapter(name?: string, options?: IndexedDbAdapterOptions): StorageAdapter;
78
+ /** Minimal `FileSystemDirectoryHandle` surface used by the OPFS adapter. */
79
+ interface OpfsDirectoryLike {
80
+ getDirectoryHandle(name: string, options?: {
81
+ create?: boolean;
82
+ }): Promise<OpfsDirectoryLike>;
83
+ getFileHandle(name: string, options?: {
84
+ create?: boolean;
85
+ }): Promise<OpfsFileLike>;
86
+ removeEntry(name: string): Promise<void>;
87
+ }
88
+ interface OpfsFileLike {
89
+ getFile(): Promise<{
90
+ text(): Promise<string>;
91
+ }>;
92
+ createWritable?(): Promise<{
93
+ write(data: string): Promise<void>;
94
+ close(): Promise<void>;
95
+ }>;
96
+ /** Rename in place (Chromium, Safari). Used for temp-file + rename writes. */
97
+ move?(name: string): Promise<void>;
98
+ }
99
+ interface OpfsAdapterOptions extends StorageAdapterOptions {
100
+ /** Root directory (default `navigator.storage.getDirectory()`). */
101
+ root?: () => Promise<OpfsDirectoryLike>;
102
+ /** Force the write-then-pointer-swap strategy even when `move` exists. */
103
+ disableRename?: boolean;
104
+ }
105
+ /** Whether the Origin Private File System exists (`navigator.storage.getDirectory`). */
106
+ declare function isOpfsAvailable(): boolean;
107
+ /**
108
+ * Origin Private File System adapter. Values are files in `dir` (created on
109
+ * demand), named after the URI-encoded key.
110
+ *
111
+ * Writes never leave a half-written value behind: where file handles support
112
+ * `move`, the value is written to `<file>.tmp` and renamed over `<file>`;
113
+ * otherwise it alternates between two slots (`<file>.a` / `<file>.b`) and then
114
+ * swaps a pointer file (`<file>.ptr`), so a crash mid-write keeps the previous
115
+ * value. Main-thread writes need `createWritable` (missing in some Safari
116
+ * versions); without it, `set` rejects with `StorageUnavailableError`.
117
+ */
118
+ declare function createOpfsAdapter(dir?: string, options?: OpfsAdapterOptions): StorageAdapter;
119
+
120
+ export { type IdbFactoryLike as I, type LocalStorageAdapterOptions as L, type MemoryStorage as M, type OpfsAdapterOptions as O, type StorageAdapter as S, type WebStorageLike as W, type IndexedDbAdapterOptions as a, InjectedStorageError as b, type OpfsDirectoryLike as c, type OpfsFileLike as d, type StorageAdapterOptions as e, type StorageFailureMode as f, type StorageOperation as g, StorageUnavailableError as h, createIndexedDbAdapter as i, createLocalStorageAdapter as j, createMemoryStorage as k, createOpfsAdapter as l, isIndexedDbAvailable as m, isLocalStorageAvailable as n, isOpfsAvailable as o, withStorageFailures as w };
@@ -0,0 +1,115 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+ var _chunk4BVP64JJcjs = require('../chunk-4BVP64JJ.cjs');
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+
82
+
83
+
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+ exports.EMPTY_TOKEN_STATE = _chunk4BVP64JJcjs.EMPTY_TOKEN_STATE; exports.TOKEN_SCOPES_BY_TYPE = _chunk4BVP64JJcjs.TOKEN_SCOPES_BY_TYPE; exports.TOKEN_TYPES = _chunk4BVP64JJcjs.TOKEN_TYPES; exports.TokenError = _chunk4BVP64JJcjs.TokenError; exports.TokenStore = _chunk4BVP64JJcjs.TokenStore; exports.W3C_TOKENS_EXTENSION = _chunk4BVP64JJcjs.W3C_TOKENS_EXTENSION; exports.addTokenMode = _chunk4BVP64JJcjs.addTokenMode; exports.checkTokenAlias = _chunk4BVP64JJcjs.checkTokenAlias; exports.coerceTokenLiteral = _chunk4BVP64JJcjs.coerceTokenLiteral; exports.createTokenCollection = _chunk4BVP64JJcjs.createTokenCollection; exports.createTokenStore = _chunk4BVP64JJcjs.createTokenStore; exports.createTokenVariable = _chunk4BVP64JJcjs.createTokenVariable; exports.cssString = _chunk4BVP64JJcjs.cssString; exports.defaultTokenId = _chunk4BVP64JJcjs.defaultTokenId; exports.defaultTokenValue = _chunk4BVP64JJcjs.defaultTokenValue; exports.deleteTokenCollection = _chunk4BVP64JJcjs.deleteTokenCollection; exports.deleteTokenVariables = _chunk4BVP64JJcjs.deleteTokenVariables; exports.exportTokensCss = _chunk4BVP64JJcjs.exportTokensCss; exports.exportW3CTokens = _chunk4BVP64JJcjs.exportW3CTokens; exports.exportW3CTokensJson = _chunk4BVP64JJcjs.exportW3CTokensJson; exports.findTokenCollection = _chunk4BVP64JJcjs.findTokenCollection; exports.findTokenMode = _chunk4BVP64JJcjs.findTokenMode; exports.findTokenVariable = _chunk4BVP64JJcjs.findTokenVariable; exports.formatTokenCssValue = _chunk4BVP64JJcjs.formatTokenCssValue; exports.formatTokenValue = _chunk4BVP64JJcjs.formatTokenValue; exports.getCollectionVariables = _chunk4BVP64JJcjs.getCollectionVariables; exports.getCurrentMode = _chunk4BVP64JJcjs.getCurrentMode; exports.getDefaultMode = _chunk4BVP64JJcjs.getDefaultMode; exports.getTokenCollection = _chunk4BVP64JJcjs.getTokenCollection; exports.getTokenCssName = _chunk4BVP64JJcjs.getTokenCssName; exports.getTokenCssVariables = _chunk4BVP64JJcjs.getTokenCssVariables; exports.getTokenVariable = _chunk4BVP64JJcjs.getTokenVariable; exports.hexToRgba = _chunk4BVP64JJcjs.hexToRgba; exports.importW3CTokens = _chunk4BVP64JJcjs.importW3CTokens; exports.isTokenAlias = _chunk4BVP64JJcjs.isTokenAlias; exports.isTokenInScope = _chunk4BVP64JJcjs.isTokenInScope; exports.isTokenScopeKnown = _chunk4BVP64JJcjs.isTokenScopeKnown; exports.literalTokenType = _chunk4BVP64JJcjs.literalTokenType; exports.moveTokenMode = _chunk4BVP64JJcjs.moveTokenMode; exports.normalizeTokenColor = _chunk4BVP64JJcjs.normalizeTokenColor; exports.normalizeTokenName = _chunk4BVP64JJcjs.normalizeTokenName; exports.normalizeTokenScopes = _chunk4BVP64JJcjs.normalizeTokenScopes; exports.parseTokenState = _chunk4BVP64JJcjs.parseTokenState; exports.prepareTokenValue = _chunk4BVP64JJcjs.prepareTokenValue; exports.removeTokenMode = _chunk4BVP64JJcjs.removeTokenMode; exports.renameTokenCollection = _chunk4BVP64JJcjs.renameTokenCollection; exports.renameTokenMode = _chunk4BVP64JJcjs.renameTokenMode; exports.renameTokenVariable = _chunk4BVP64JJcjs.renameTokenVariable; exports.resolveToken = _chunk4BVP64JJcjs.resolveToken; exports.resolveTokenInMode = _chunk4BVP64JJcjs.resolveTokenInMode; exports.resolveTokenValue = _chunk4BVP64JJcjs.resolveTokenValue; exports.rgbaToHex = _chunk4BVP64JJcjs.rgbaToHex; exports.setTokenValue = _chunk4BVP64JJcjs.setTokenValue; exports.tokenSlug = _chunk4BVP64JJcjs.tokenSlug; exports.updateTokenVariable = _chunk4BVP64JJcjs.updateTokenVariable;
115
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/editor/editor/packages/core/dist/tokens/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,43GAAC","file":"/home/runner/work/editor/editor/packages/core/dist/tokens/index.cjs"}