@pixerate/editor 0.23.0 → 0.24.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.
- package/README.md +96 -1
- package/THIRD_PARTY_NOTICES.md +51 -0
- package/dist/agent/index.cjs +9 -8
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.d.cts +4 -3
- package/dist/agent/index.d.ts +4 -3
- package/dist/agent/index.js +3 -2
- package/dist/agent/index.js.map +1 -1
- package/dist/canvas/index.cjs +1210 -17
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +318 -1
- package/dist/canvas/index.d.ts +318 -1
- package/dist/canvas/index.js +1199 -6
- package/dist/canvas/index.js.map +1 -1
- package/dist/{chunk-QBJ22YZR.js → chunk-3CN2WD3X.js} +1354 -206
- package/dist/chunk-3CN2WD3X.js.map +1 -0
- package/dist/{chunk-JJDLPEWL.js → chunk-3LV6RRPH.js} +2 -2
- package/dist/{chunk-MJZBNWG7.js → chunk-5S3Z4PPF.js} +78 -557
- package/dist/chunk-5S3Z4PPF.js.map +1 -0
- package/dist/chunk-664LQYFJ.js +115 -0
- package/dist/chunk-664LQYFJ.js.map +1 -0
- package/dist/{chunk-AA4ZEVCC.cjs → chunk-D27YFC46.cjs} +101 -580
- package/dist/chunk-D27YFC46.cjs.map +1 -0
- package/dist/chunk-D6FH2YAX.cjs +131 -0
- package/dist/chunk-D6FH2YAX.cjs.map +1 -0
- package/dist/{chunk-4SUNJZWB.cjs → chunk-FD4LPFAE.cjs} +48 -200
- package/dist/chunk-FD4LPFAE.cjs.map +1 -0
- package/dist/chunk-FODNLX5N.js +749 -0
- package/dist/chunk-FODNLX5N.js.map +1 -0
- package/dist/{chunk-OYXSKQFR.js → chunk-FPENXAEJ.js} +35 -187
- package/dist/chunk-FPENXAEJ.js.map +1 -0
- package/dist/chunk-HLIMTC6N.js +1 -0
- package/dist/chunk-HLIMTC6N.js.map +1 -0
- package/dist/{chunk-QGHGJ56O.js → chunk-ITBSKI26.js} +1483 -19
- package/dist/chunk-ITBSKI26.js.map +1 -0
- package/dist/{chunk-XDMXXC4Z.cjs → chunk-MA2F5KHF.cjs} +350 -227
- package/dist/chunk-MA2F5KHF.cjs.map +1 -0
- package/dist/{chunk-RIKBJLS2.cjs → chunk-MCSJFWAO.cjs} +1356 -208
- package/dist/chunk-MCSJFWAO.cjs.map +1 -0
- package/dist/chunk-MKA3AHLV.cjs +256 -0
- package/dist/chunk-MKA3AHLV.cjs.map +1 -0
- package/dist/chunk-OLZJXL4R.cjs +749 -0
- package/dist/chunk-OLZJXL4R.cjs.map +1 -0
- package/dist/chunk-OXSV64JX.js +689 -0
- package/dist/chunk-OXSV64JX.js.map +1 -0
- package/dist/chunk-P3RQ5UJE.cjs +689 -0
- package/dist/chunk-P3RQ5UJE.cjs.map +1 -0
- package/dist/chunk-P6ODPZ4W.js +256 -0
- package/dist/chunk-P6ODPZ4W.js.map +1 -0
- package/dist/chunk-PGNZKFQS.js +685 -0
- package/dist/chunk-PGNZKFQS.js.map +1 -0
- package/dist/chunk-PL4JB3BF.cjs +1 -0
- package/dist/chunk-PL4JB3BF.cjs.map +1 -0
- package/dist/{chunk-GVSMRPHB.cjs → chunk-SBCZ6RN5.cjs} +1568 -104
- package/dist/chunk-SBCZ6RN5.cjs.map +1 -0
- package/dist/{chunk-CL37JGFW.cjs → chunk-SML64VJG.cjs} +4 -4
- package/dist/{chunk-CL37JGFW.cjs.map → chunk-SML64VJG.cjs.map} +1 -1
- package/dist/chunk-TNNJXF46.cjs +115 -0
- package/dist/chunk-TNNJXF46.cjs.map +1 -0
- package/dist/chunk-U5HZSFCS.js +131 -0
- package/dist/chunk-U5HZSFCS.js.map +1 -0
- package/dist/{chunk-K3R5NG2D.js → chunk-U5KWZU4X.js} +251 -128
- package/dist/chunk-U5KWZU4X.js.map +1 -0
- package/dist/chunk-XNORY7M6.cjs +685 -0
- package/dist/chunk-XNORY7M6.cjs.map +1 -0
- package/dist/commands/index.d.cts +5 -353
- package/dist/commands/index.d.ts +5 -353
- package/dist/comment-store-BEMgVlAA.d.cts +135 -0
- package/dist/comment-store-BEMgVlAA.d.ts +135 -0
- package/dist/compare/index.cjs +15 -0
- package/dist/compare/index.cjs.map +1 -0
- package/dist/compare/index.d.cts +58 -0
- package/dist/compare/index.d.ts +58 -0
- package/dist/compare/index.js +15 -0
- package/dist/compare/index.js.map +1 -0
- package/dist/{controller-pePCJLT1.d.cts → controller-BhLLAoi8.d.cts} +45 -4
- package/dist/{controller-pePCJLT1.d.ts → controller-BhLLAoi8.d.ts} +45 -4
- package/dist/documents-BQjzJNe2.d.ts +76 -0
- package/dist/documents-KRTPhvst.d.cts +76 -0
- package/dist/extensions/index.cjs +53 -5
- package/dist/extensions/index.cjs.map +1 -1
- package/dist/extensions/index.d.cts +7 -3
- package/dist/extensions/index.d.ts +7 -3
- package/dist/extensions/index.js +52 -4
- package/dist/generation/index.cjs +1373 -0
- package/dist/generation/index.cjs.map +1 -0
- package/dist/generation/index.d.cts +554 -0
- package/dist/generation/index.d.ts +554 -0
- package/dist/generation/index.js +1373 -0
- package/dist/generation/index.js.map +1 -0
- package/dist/grammar/index.cjs +48 -3
- package/dist/grammar/index.cjs.map +1 -1
- package/dist/grammar/index.d.cts +322 -100
- package/dist/grammar/index.d.ts +322 -100
- package/dist/grammar/index.js +54 -9
- package/dist/image-editor/index.cjs +1831 -30
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +590 -3
- package/dist/image-editor/index.d.ts +590 -3
- package/dist/image-editor/index.js +1807 -6
- package/dist/image-editor/index.js.map +1 -1
- package/dist/{index-CCr_z9kF.d.cts → index-BhJBSm2d.d.cts} +370 -4
- package/dist/{index-Ck6ajwXh.d.ts → index-fJrlkJCd.d.ts} +370 -4
- package/dist/index.cjs +162 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -8
- package/dist/index.d.ts +14 -8
- package/dist/index.js +174 -37
- package/dist/index.js.map +1 -1
- package/dist/migrate-iTlm3a8h.d.cts +112 -0
- package/dist/migrate-iTlm3a8h.d.ts +112 -0
- package/dist/persistence/index.cjs +676 -0
- package/dist/persistence/index.cjs.map +1 -0
- package/dist/persistence/index.d.cts +347 -0
- package/dist/persistence/index.d.ts +347 -0
- package/dist/persistence/index.js +676 -0
- package/dist/persistence/index.js.map +1 -0
- package/dist/{registry-D5-R90p0.d.cts → registry-BDe-vlv3.d.ts} +2 -40
- package/dist/registry-D32LpIc4.d.cts +354 -0
- package/dist/{registry-D5-R90p0.d.ts → registry-DnzpgY27.d.cts} +2 -40
- package/dist/registry-evKTP4ls.d.ts +354 -0
- package/dist/schema-DYDGdYL9.d.cts +41 -0
- package/dist/schema-DYDGdYL9.d.ts +41 -0
- package/dist/serializers/index.cjs +4 -3
- package/dist/serializers/index.cjs.map +1 -1
- package/dist/serializers/index.d.cts +2 -1
- package/dist/serializers/index.d.ts +2 -1
- package/dist/serializers/index.js +3 -2
- package/dist/sourcemap-C8AH3MBQ.d.cts +91 -0
- package/dist/sourcemap-DA1Evhrv.d.ts +91 -0
- package/dist/spreadsheet/index.cjs +37 -3
- package/dist/spreadsheet/index.cjs.map +1 -1
- package/dist/spreadsheet/index.d.cts +188 -17
- package/dist/spreadsheet/index.d.ts +188 -17
- package/dist/spreadsheet/index.js +43 -9
- package/dist/{tokens-CyLZmIei.d.cts → tokens-D7yXvUU6.d.cts} +15 -2
- package/dist/{tokens-CyLZmIei.d.ts → tokens-D7yXvUU6.d.ts} +15 -2
- package/dist/{track-changes-BSF58RK0.d.ts → track-changes-BK5sVf4_.d.cts} +18 -136
- package/dist/{track-changes-BSF58RK0.d.cts → track-changes-CDjCrwKe.d.ts} +18 -136
- package/package.json +16 -1
- package/dist/chunk-4SUNJZWB.cjs.map +0 -1
- package/dist/chunk-AA4ZEVCC.cjs.map +0 -1
- package/dist/chunk-AXV2ZW34.cjs +0 -118
- package/dist/chunk-AXV2ZW34.cjs.map +0 -1
- package/dist/chunk-B2ZRLN4S.js +0 -118
- package/dist/chunk-B2ZRLN4S.js.map +0 -1
- package/dist/chunk-GVSMRPHB.cjs.map +0 -1
- package/dist/chunk-K3R5NG2D.js.map +0 -1
- package/dist/chunk-MJZBNWG7.js.map +0 -1
- package/dist/chunk-OYXSKQFR.js.map +0 -1
- package/dist/chunk-QBJ22YZR.js.map +0 -1
- package/dist/chunk-QGHGJ56O.js.map +0 -1
- package/dist/chunk-RIKBJLS2.cjs.map +0 -1
- package/dist/chunk-XDMXXC4Z.cjs.map +0 -1
- /package/dist/{chunk-JJDLPEWL.js.map → chunk-3LV6RRPH.js.map} +0 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { P as PromptValues, T as Template, a as PromptDiagnostic } from './tokens-D7yXvUU6.js';
|
|
2
|
+
|
|
3
|
+
interface ResolveTemplatesOptions {
|
|
4
|
+
bindings?: Record<string, string>;
|
|
5
|
+
maxDepth?: number;
|
|
6
|
+
/**
|
|
7
|
+
* Values for `{variable}` slots and `{?variable}` sections. When omitted,
|
|
8
|
+
* variables, defaults and section tags are left exactly as written.
|
|
9
|
+
*/
|
|
10
|
+
values?: PromptValues;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Recursively resolves template tags `{{template_name}}` in a given text.
|
|
14
|
+
* A tag that would recurse into itself is replaced with `TEMPLATE_LOOP_ERROR`,
|
|
15
|
+
* and a tag nested deeper than `maxDepth` with `TEMPLATE_DEPTH_ERROR`; the rest
|
|
16
|
+
* of the text still resolves normally.
|
|
17
|
+
*
|
|
18
|
+
* Pass `options.values` to also fill variables (falling back to their
|
|
19
|
+
* `{name|default}`) and evaluate `{?name}…{/name}` / `{!name}…{/name}`
|
|
20
|
+
* sections, including those inside template bodies. See `resolvePrompt` for
|
|
21
|
+
* the source map and diagnostics.
|
|
22
|
+
*/
|
|
23
|
+
declare function resolveTemplates(text: string, templates?: Template[], options?: ResolveTemplatesOptions): string;
|
|
24
|
+
/**
|
|
25
|
+
* Replaces `{variableName}` with values from a dictionary, falling back to a
|
|
26
|
+
* `{variableName|default}` when no value is supplied, and evaluates
|
|
27
|
+
* `{?name}…{/name}` / `{!name}…{/name}` sections. Variables with neither a
|
|
28
|
+
* value nor a default are left as written. Templates are not expanded.
|
|
29
|
+
*/
|
|
30
|
+
declare function resolveVariables(text: string, values: PromptValues): string;
|
|
31
|
+
/**
|
|
32
|
+
* Extracts unique template names referenced in text.
|
|
33
|
+
*/
|
|
34
|
+
declare function extractTemplateNames(text: string): string[];
|
|
35
|
+
/**
|
|
36
|
+
* Extracts unique variable names referenced in text, including names used by
|
|
37
|
+
* conditional section tags (`amount` for `{?amount>100}…{/amount}`).
|
|
38
|
+
* Defaults and descriptions are stripped.
|
|
39
|
+
*/
|
|
40
|
+
declare function extractVariableNames(text: string): string[];
|
|
41
|
+
/**
|
|
42
|
+
* Extracts unique instruction names referenced in text.
|
|
43
|
+
*/
|
|
44
|
+
declare function extractInstructionNames(text: string): string[];
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* One contiguous piece of resolved output and the raw range it came from.
|
|
48
|
+
*
|
|
49
|
+
* - `raw`: copied verbatim; offsets map character by character.
|
|
50
|
+
* - `template`: the expansion of a `{{template}}` tag.
|
|
51
|
+
* - `variable`: a substituted value or `|default` for a `{variable}` tag.
|
|
52
|
+
* - `conditional`: a section tag, or a whole removed section. These segments
|
|
53
|
+
* are empty in the resolved text (`resolvedStart === resolvedEnd`).
|
|
54
|
+
*
|
|
55
|
+
* Offsets inside non-raw segments map to the start of their raw range.
|
|
56
|
+
*/
|
|
57
|
+
interface SourceMapSegment {
|
|
58
|
+
resolvedStart: number;
|
|
59
|
+
resolvedEnd: number;
|
|
60
|
+
source: "raw" | "template" | "variable" | "conditional";
|
|
61
|
+
rawStart: number;
|
|
62
|
+
rawEnd: number;
|
|
63
|
+
templateName?: string;
|
|
64
|
+
/** Variable substituted (`variable`) or tested (`conditional`). */
|
|
65
|
+
variableName?: string;
|
|
66
|
+
/** For `variable` segments: whether a supplied value or the default was used. */
|
|
67
|
+
valueSource?: "value" | "default";
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Resolves templates in text while tracking character offset mapping
|
|
71
|
+
* between the raw input and the fully resolved output.
|
|
72
|
+
*
|
|
73
|
+
* Pass `options.values` to also substitute variables and evaluate conditional
|
|
74
|
+
* sections (see `resolvePrompt`); without it the output is unchanged from the
|
|
75
|
+
* template-only behavior.
|
|
76
|
+
*/
|
|
77
|
+
declare function resolveTemplatesWithMapping(text: string, templates?: Template[], templateBindings?: Record<string, string>, options?: Pick<ResolveTemplatesOptions, "maxDepth" | "values">): {
|
|
78
|
+
text: string;
|
|
79
|
+
map: SourceMapSegment[];
|
|
80
|
+
diagnostics: PromptDiagnostic[];
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Maps an offset in resolved text back to the corresponding offset in raw text.
|
|
84
|
+
*/
|
|
85
|
+
declare function mapResolvedOffsetToRaw(resolvedOffset: number, map: SourceMapSegment[]): number;
|
|
86
|
+
/**
|
|
87
|
+
* Maps an offset in raw text to the corresponding offset in resolved text.
|
|
88
|
+
*/
|
|
89
|
+
declare function mapRawOffsetToResolved(rawOffset: number, map: SourceMapSegment[]): number;
|
|
90
|
+
|
|
91
|
+
export { type ResolveTemplatesOptions as R, type SourceMapSegment as S, extractTemplateNames as a, extractVariableNames as b, mapResolvedOffsetToRaw as c, resolveTemplatesWithMapping as d, extractInstructionNames as e, resolveVariables as f, mapRawOffsetToResolved as m, resolveTemplates as r };
|
|
@@ -52,16 +52,17 @@
|
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
|
|
55
|
-
var _chunkXDMXXC4Zcjs = require('../chunk-XDMXXC4Z.cjs');
|
|
56
55
|
|
|
57
56
|
|
|
58
57
|
|
|
58
|
+
var _chunkMA2F5KHFcjs = require('../chunk-MA2F5KHF.cjs');
|
|
59
59
|
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
|
|
63
63
|
|
|
64
64
|
|
|
65
|
+
var _chunkTNNJXF46cjs = require('../chunk-TNNJXF46.cjs');
|
|
65
66
|
|
|
66
67
|
|
|
67
68
|
|
|
@@ -87,7 +88,6 @@ var _chunkXDMXXC4Zcjs = require('../chunk-XDMXXC4Z.cjs');
|
|
|
87
88
|
|
|
88
89
|
|
|
89
90
|
|
|
90
|
-
var _chunkRIKBJLS2cjs = require('../chunk-RIKBJLS2.cjs');
|
|
91
91
|
|
|
92
92
|
|
|
93
93
|
|
|
@@ -105,6 +105,7 @@ var _chunkRIKBJLS2cjs = require('../chunk-RIKBJLS2.cjs');
|
|
|
105
105
|
|
|
106
106
|
|
|
107
107
|
|
|
108
|
+
var _chunkMCSJFWAOcjs = require('../chunk-MCSJFWAO.cjs');
|
|
108
109
|
|
|
109
110
|
|
|
110
111
|
|
|
@@ -175,5 +176,38 @@ var _chunkRIKBJLS2cjs = require('../chunk-RIKBJLS2.cjs');
|
|
|
175
176
|
|
|
176
177
|
|
|
177
178
|
|
|
178
|
-
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
exports.DEFAULT_COLUMN_WIDTH = _chunkMA2F5KHFcjs.DEFAULT_COLUMN_WIDTH; exports.DEFAULT_ROW_HEIGHT = _chunkMA2F5KHFcjs.DEFAULT_ROW_HEIGHT; exports.DataSourceBinder = _chunkMA2F5KHFcjs.DataSourceBinder; exports.DependencyGraph = _chunkMA2F5KHFcjs.DependencyGraph; exports.FORMULA_ERRORS = _chunkMCSJFWAOcjs.FORMULA_ERRORS; exports.FormulaEvaluator = _chunkMCSJFWAOcjs.FormulaEvaluator; exports.FormulaParser = _chunkMCSJFWAOcjs.FormulaParser; exports.MAX_FORMULA_ARRAY_SIZE = _chunkMCSJFWAOcjs.MAX_FORMULA_ARRAY_SIZE; exports.MAX_NUMBER_FORMAT_CODE_CHARS = _chunkMCSJFWAOcjs.MAX_NUMBER_FORMAT_CODE_CHARS; exports.NUMBER_FORMAT_PRESETS = _chunkMA2F5KHFcjs.NUMBER_FORMAT_PRESETS; exports.NumberFormat = _chunkMCSJFWAOcjs.NumberFormat; exports.SPREADSHEET_CLIPBOARD_MIME = _chunkMA2F5KHFcjs.SPREADSHEET_CLIPBOARD_MIME; exports.SPREADSHEET_IMPORT_ADAPTERS = _chunkMA2F5KHFcjs.SPREADSHEET_IMPORT_ADAPTERS; exports.SPREADSHEET_TABLE_ACTIONS = _chunkMA2F5KHFcjs.SPREADSHEET_TABLE_ACTIONS; exports.SpreadsheetController = _chunkMA2F5KHFcjs.SpreadsheetController; exports.WHOLE_COLUMN_END_ROW = _chunkMCSJFWAOcjs.WHOLE_COLUMN_END_ROW; exports.aggregateValues = _chunkMA2F5KHFcjs.aggregateValues; exports.applyFormulaSuggestion = _chunkMA2F5KHFcjs.applyFormulaSuggestion; exports.bindSpreadsheetTableActions = _chunkMA2F5KHFcjs.bindSpreadsheetTableActions; exports.buildSpreadsheetView = _chunkMA2F5KHFcjs.buildSpreadsheetView; exports.builtinNumberFormat = _chunkMCSJFWAOcjs.builtinNumberFormat; exports.builtinNumberFormatId = _chunkMCSJFWAOcjs.builtinNumberFormatId; exports.cellFormatForNumberFormat = _chunkMA2F5KHFcjs.cellFormatForNumberFormat; exports.checkFormulaArgumentCount = _chunkMCSJFWAOcjs.checkFormulaArgumentCount; exports.clampMenuPosition = _chunkMA2F5KHFcjs.clampMenuPosition; exports.clearNumberFormatCache = _chunkMCSJFWAOcjs.clearNumberFormatCache; exports.colNameToIndex = _chunkMCSJFWAOcjs.colNameToIndex; exports.columnDependencyKey = _chunkMA2F5KHFcjs.columnDependencyKey; exports.compareCellValues = _chunkMA2F5KHFcjs.compareCellValues; exports.compareNumbers = _chunkMCSJFWAOcjs.compareNumbers; exports.compareValues = _chunkMCSJFWAOcjs.compareValues; exports.computeFillTarget = _chunkMA2F5KHFcjs.computeFillTarget; exports.computeRowGroups = _chunkMA2F5KHFcjs.computeRowGroups; exports.createSpreadsheetClipboardData = _chunkMA2F5KHFcjs.createSpreadsheetClipboardData; exports.csvImportAdapter = _chunkMA2F5KHFcjs.csvImportAdapter; exports.dateValueToSerial = _chunkMCSJFWAOcjs.dateValueToSerial; exports.describeFormulaError = _chunkMCSJFWAOcjs.describeFormulaError; exports.escapeCsvField = _chunkTNNJXF46cjs.escapeCsvField; exports.extractCellDependencies = _chunkMA2F5KHFcjs.extractCellDependencies; exports.fillSeries = _chunkMA2F5KHFcjs.fillSeries; exports.formatCellDisplay = _chunkMA2F5KHFcjs.formatCellDisplay; exports.formatCellForDisplay = _chunkMA2F5KHFcjs.formatCellForDisplay; exports.formatGeneralFit = _chunkMCSJFWAOcjs.formatGeneralFit; exports.formatNumberFormatValue = _chunkMCSJFWAOcjs.formatNumberFormatValue; exports.formatTextFunction = _chunkMCSJFWAOcjs.formatTextFunction; exports.formatValueWithCode = _chunkMA2F5KHFcjs.formatValueWithCode; exports.getFillDirection = _chunkMA2F5KHFcjs.getFillDirection; exports.getFormulaArgumentSpecIndex = _chunkMCSJFWAOcjs.getFormulaArgumentSpecIndex; exports.getFormulaCaretContext = _chunkMA2F5KHFcjs.getFormulaCaretContext; exports.getFormulaFunction = _chunkMCSJFWAOcjs.getFormulaFunction; exports.getFormulaHints = _chunkMA2F5KHFcjs.getFormulaHints; exports.getFormulaSignature = _chunkMCSJFWAOcjs.getFormulaSignature; exports.getFormulaSignatureParts = _chunkMCSJFWAOcjs.getFormulaSignatureParts; exports.getRowSection = _chunkMA2F5KHFcjs.getRowSection; exports.getSpreadsheetMenuItems = _chunkMA2F5KHFcjs.getSpreadsheetMenuItems; exports.getTableSections = _chunkMA2F5KHFcjs.getTableSections; exports.importFileIntoSpreadsheet = _chunkMA2F5KHFcjs.importFileIntoSpreadsheet; exports.indexToColName = _chunkMCSJFWAOcjs.indexToColName; exports.isBlankValue = _chunkMA2F5KHFcjs.isBlankValue; exports.isFormulaError = _chunkMCSJFWAOcjs.isFormulaError; exports.isGeneralNumberFormat = _chunkMA2F5KHFcjs.isGeneralNumberFormat; exports.isSingleCellRange = _chunkMA2F5KHFcjs.isSingleCellRange; exports.listFormulaFunctions = _chunkMCSJFWAOcjs.listFormulaFunctions; exports.mapFormulaReferences = _chunkMA2F5KHFcjs.mapFormulaReferences; exports.matchesFilterRule = _chunkMA2F5KHFcjs.matchesFilterRule; exports.normalizeRange = _chunkMA2F5KHFcjs.normalizeRange; exports.numberFormatColorToCss = _chunkMCSJFWAOcjs.numberFormatColorToCss; exports.numberFormatForCellFormat = _chunkMA2F5KHFcjs.numberFormatForCellFormat; exports.numberToText = _chunkMCSJFWAOcjs.numberToText; exports.offsetFormulaReferences = _chunkMA2F5KHFcjs.offsetFormulaReferences; exports.parseCellInput = _chunkMCSJFWAOcjs.parseCellInput; exports.parseCellReference = _chunkMCSJFWAOcjs.parseCellReference; exports.parseCriteria = _chunkMCSJFWAOcjs.parseCriteria; exports.parseCsv = _chunkTNNJXF46cjs.parseCsv; exports.parseFormula = _chunkMCSJFWAOcjs.parseFormula; exports.parseHtmlTable = _chunkMA2F5KHFcjs.parseHtmlTable; exports.parseNumberText = _chunkMCSJFWAOcjs.parseNumberText; exports.parseRange = _chunkMCSJFWAOcjs.parseRange; exports.parseTsv = _chunkTNNJXF46cjs.parseTsv; exports.rangeContains = _chunkMA2F5KHFcjs.rangeContains; exports.rangeContainsRange = _chunkMA2F5KHFcjs.rangeContainsRange; exports.rangesIntersect = _chunkMA2F5KHFcjs.rangesIntersect; exports.readSpreadsheetClipboard = _chunkMA2F5KHFcjs.readSpreadsheetClipboard; exports.rebaseClipboardRows = _chunkMA2F5KHFcjs.rebaseClipboardRows; exports.registerFormulaFunction = _chunkMCSJFWAOcjs.registerFormulaFunction; exports.registerSpreadsheetImportAdapters = _chunkMA2F5KHFcjs.registerSpreadsheetImportAdapters; exports.remapFormulaReferences = _chunkMA2F5KHFcjs.remapFormulaReferences; exports.roundFloat = _chunkMA2F5KHFcjs.roundFloat; exports.rowPassesFilters = _chunkMA2F5KHFcjs.rowPassesFilters; exports.runSpreadsheetMenuItem = _chunkMA2F5KHFcjs.runSpreadsheetMenuItem; exports.searchFormulaFunctions = _chunkMCSJFWAOcjs.searchFormulaFunctions; exports.serialFromYmd = _chunkMCSJFWAOcjs.serialFromYmd; exports.serializeCsv = _chunkTNNJXF46cjs.serializeCsv; exports.serializeHtmlTable = _chunkMA2F5KHFcjs.serializeHtmlTable; exports.serializeTsv = _chunkTNNJXF46cjs.serializeTsv; exports.shiftFormulaReferences = _chunkMA2F5KHFcjs.shiftFormulaReferences; exports.sortCompareValues = _chunkMCSJFWAOcjs.sortCompareValues; exports.toNumber = _chunkMA2F5KHFcjs.toNumber; exports.tokenizeFormula = _chunkMCSJFWAOcjs.tokenizeFormula; exports.tsvImportAdapter = _chunkMA2F5KHFcjs.tsvImportAdapter; exports.unregisterFormulaFunction = _chunkMCSJFWAOcjs.unregisterFormulaFunction; exports.wildcardToRegExp = _chunkMCSJFWAOcjs.wildcardToRegExp;
|
|
179
213
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/editor/editor/packages/core/dist/spreadsheet/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;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;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;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,
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/editor/editor/packages/core/dist/spreadsheet/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;AACA;AACF,yDAA8B;AAC9B;AACE;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;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;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,itNAAC","file":"/home/runner/work/editor/editor/packages/core/dist/spreadsheet/index.cjs"}
|
|
@@ -1,5 +1,5 @@
|
|
|
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-
|
|
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-
|
|
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-BhLLAoi8.cjs';
|
|
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-BhLLAoi8.cjs';
|
|
3
3
|
import { I as ImportAdapterRegistry, c as ImportAdapter, h as ImportInput, a as ImportOutcome } from '../registry-GJI4gToU.cjs';
|
|
4
4
|
|
|
5
5
|
type FormulaFunctionCategory = 'math' | 'statistical' | 'logical' | 'text' | 'lookup' | 'date' | 'information';
|
|
@@ -211,21 +211,147 @@ declare function wildcardToRegExp(pattern: string): RegExp;
|
|
|
211
211
|
*/
|
|
212
212
|
declare function parseCriteria(criterion: unknown): FormulaCriteriaPredicate;
|
|
213
213
|
|
|
214
|
+
/** Number format code parsing: sections, bracket tags and tokens. */
|
|
215
|
+
/** Colour from a `[Red]` or `[ColorN]` section tag (`color1`…`color56` = palette index). */
|
|
216
|
+
type NumberFormatColor = 'black' | 'blue' | 'cyan' | 'green' | 'magenta' | 'red' | 'white' | 'yellow' | `color${number}`;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* The General format squeezed into `maxChars` characters, as Excel shows it
|
|
220
|
+
* in a narrow column: fewer decimals, then scientific notation; `null` when
|
|
221
|
+
* even that does not fit (the caller paints `####`).
|
|
222
|
+
*/
|
|
223
|
+
declare function formatGeneralFit(n: number, maxChars: number): string | null;
|
|
224
|
+
|
|
225
|
+
/** Built-in number formats (ECMA-376 §18.8.30, en-US). */
|
|
226
|
+
/**
|
|
227
|
+
* Built-in format code for an id (0–49, en-US), e.g. 14 → `m/d/yyyy`.
|
|
228
|
+
* Locale-specific ids (23–36) and unknown ids return undefined.
|
|
229
|
+
*/
|
|
230
|
+
declare function builtinNumberFormat(id: number): string | undefined;
|
|
231
|
+
/** Id of a built-in format code. Matching ignores case and backslash escapes. */
|
|
232
|
+
declare function builtinNumberFormatId(code: string): number | undefined;
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Longest number format code, in characters, that is parsed (Excel's own
|
|
236
|
+
* limit). A longer code displays its value as General and makes `TEXT`
|
|
237
|
+
* return `#VALUE!`. The cap also bounds work that scales with the code.
|
|
238
|
+
*/
|
|
239
|
+
declare const MAX_NUMBER_FORMAT_CODE_CHARS = 255;
|
|
240
|
+
/** Best guess at the ribbon's number-format category. */
|
|
241
|
+
type NumberFormatKind = 'general' | 'number' | 'currency' | 'accounting' | 'date' | 'time' | 'percentage' | 'fraction' | 'scientific' | 'text'
|
|
242
|
+
/** Zip codes, phone numbers, social security numbers. */
|
|
243
|
+
| 'special' | 'custom';
|
|
244
|
+
/** A value formatted with a number format, ready to paint. */
|
|
245
|
+
interface FormattedNumberValue {
|
|
246
|
+
text: string;
|
|
247
|
+
/** Colour from a `[Red]` / `[ColorN]` tag of the section used. */
|
|
248
|
+
color?: NumberFormatColor;
|
|
249
|
+
/**
|
|
250
|
+
* Repeat-fill character from `*x` and its position (UTF-16 index) in
|
|
251
|
+
* `text`; a renderer may repeat it to fill the cell width.
|
|
252
|
+
*/
|
|
253
|
+
fill?: {
|
|
254
|
+
char: string;
|
|
255
|
+
index: number;
|
|
256
|
+
};
|
|
257
|
+
/** True for numbers (right-aligned by default); text, booleans and errors are false. */
|
|
258
|
+
numeric: boolean;
|
|
259
|
+
}
|
|
260
|
+
/** A parsed number format code. Parsing never fails: malformed parts become literal text. */
|
|
261
|
+
declare class NumberFormat {
|
|
262
|
+
readonly code: string;
|
|
263
|
+
private readonly general;
|
|
264
|
+
private readonly sections;
|
|
265
|
+
/** Sections that apply to numbers (a trailing text section is excluded). */
|
|
266
|
+
private readonly numSections;
|
|
267
|
+
/** Index of the section that applies to text, if any. */
|
|
268
|
+
private readonly textSection;
|
|
269
|
+
private constructor();
|
|
270
|
+
/**
|
|
271
|
+
* Parses a format code. Never throws: unknown or malformed parts degrade to
|
|
272
|
+
* literal text, and a code longer than 255 characters degrades to General.
|
|
273
|
+
*/
|
|
274
|
+
static parse(code: string): NumberFormat;
|
|
275
|
+
/** `parse` without the 255-character cap (for tests that reach renderer edge cases). */
|
|
276
|
+
static parseUncapped(code: string): NumberFormat;
|
|
277
|
+
/** Like `parse`, but remembers recently parsed codes (bounded), so formatting many values parses a code once. */
|
|
278
|
+
static parseCached(code: string): NumberFormat;
|
|
279
|
+
static general(): NumberFormat;
|
|
280
|
+
isGeneral(): boolean;
|
|
281
|
+
private numberSections;
|
|
282
|
+
/** True when the code contains date or time tokens. */
|
|
283
|
+
isDate(): boolean;
|
|
284
|
+
isPercent(): boolean;
|
|
285
|
+
/** True for a pure text format such as `@`. */
|
|
286
|
+
isText(): boolean;
|
|
287
|
+
/** Best guess at the format category. */
|
|
288
|
+
kind(): NumberFormatKind;
|
|
289
|
+
/**
|
|
290
|
+
* Picks the number section for `v`, and whether the minus sign is dropped
|
|
291
|
+
* (a negative section shows the absolute value). Null means General.
|
|
292
|
+
*/
|
|
293
|
+
private select;
|
|
294
|
+
/**
|
|
295
|
+
* Formats a number. `overflow` is true when the value can't be shown (a
|
|
296
|
+
* date out of range, painted as `########`).
|
|
297
|
+
*/
|
|
298
|
+
formatNumber(n: number): FormattedNumberValue & {
|
|
299
|
+
overflow: boolean;
|
|
300
|
+
};
|
|
301
|
+
/** Formats text through the text section (`@`), or returns it unchanged. */
|
|
302
|
+
formatText(text: string): FormattedNumberValue;
|
|
303
|
+
/**
|
|
304
|
+
* Formats a cell value: numbers through the number sections, ISO date text
|
|
305
|
+
* (`2026-03-04`, `2026-03-04 18:00:00`) and `Date`s as serial numbers, other
|
|
306
|
+
* text through the text section; booleans show TRUE/FALSE and error values
|
|
307
|
+
* themselves.
|
|
308
|
+
*/
|
|
309
|
+
format(value: unknown): FormattedNumberValue;
|
|
310
|
+
}
|
|
311
|
+
/** Empties the parse cache used by `NumberFormat.parseCached` (mainly for tests). */
|
|
312
|
+
declare function clearNumberFormatCache(): void;
|
|
214
313
|
/**
|
|
215
|
-
*
|
|
216
|
-
*
|
|
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.
|
|
314
|
+
* 1900-system serial number of a date value: ISO date text (with an optional
|
|
315
|
+
* time) or a `Date` (its local date and time). Null for anything else.
|
|
219
316
|
*/
|
|
220
|
-
declare function
|
|
317
|
+
declare function dateValueToSerial(value: unknown): number | null;
|
|
318
|
+
/** Formats a cell value with a format code (see `NumberFormat.format`). */
|
|
319
|
+
declare function formatNumberFormatValue(value: unknown, code: string): FormattedNumberValue;
|
|
221
320
|
/**
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
|
|
321
|
+
* The `TEXT()` worksheet function: formats a value with a format code.
|
|
322
|
+
* Blanks count as 0; numeric and date text (`"5"`, `"3/4/2026"`,
|
|
323
|
+
* `"2026-03-04"`) is converted to a number first; other text and booleans
|
|
324
|
+
* (as TRUE/FALSE) go through the text section, or are returned as is.
|
|
325
|
+
* Errors: the value's own error, `#VALUE!` for a code over 255 characters or
|
|
326
|
+
* a date out of range, `#NUM!` for a non-finite number.
|
|
327
|
+
*/
|
|
328
|
+
declare function formatTextFunction(value: unknown, code: string): {
|
|
329
|
+
text: string;
|
|
330
|
+
} | {
|
|
331
|
+
error: string;
|
|
332
|
+
};
|
|
333
|
+
/** CSS colour for a format colour (`red` → `#FF0000`, `color10` → `#008000`). */
|
|
334
|
+
declare function numberFormatColorToCss(color: NumberFormatColor): string;
|
|
335
|
+
|
|
336
|
+
type DisplayCell = Pick<CellData, 'value' | 'error' | 'numberFormat' | 'format'>;
|
|
337
|
+
/**
|
|
338
|
+
* How a cell is shown: its error, or its value formatted with its number
|
|
339
|
+
* format code (`numberFormat`: set explicitly, inherited from the column, or
|
|
340
|
+
* chosen for typed input, e.g. `"$"#,##0.00` for `$1,200.50`). Numbers in a
|
|
341
|
+
* cell with a `currency` / `percentage` / `date` `CellFormat` but no code use
|
|
342
|
+
* that kind's code. Without a code (General), numbers use up to 15
|
|
343
|
+
* significant digits and booleans show as TRUE/FALSE.
|
|
344
|
+
*
|
|
345
|
+
* `numeric` is true for numbers (and dates shown through a date format):
|
|
346
|
+
* grids right-align those. `color` comes from a `[Red]` / `[ColorN]` tag.
|
|
347
|
+
*/
|
|
348
|
+
declare function formatCellForDisplay(cell: DisplayCell | null | undefined): FormattedNumberValue;
|
|
349
|
+
/** The text a cell shows (see `formatCellForDisplay`). Used by grids, CSV export and the clipboard. */
|
|
350
|
+
declare function formatCellDisplay(cell: DisplayCell | null | undefined): string;
|
|
351
|
+
/**
|
|
352
|
+
* Formats a value with a number format code, as `TEXT()` does (see
|
|
353
|
+
* `formatTextFunction`). Null when the value can't be shown with that code
|
|
354
|
+
* (a date out of range, a code over 255 characters, an error value).
|
|
229
355
|
*/
|
|
230
356
|
declare function formatValueWithCode(value: unknown, format: string): string | null;
|
|
231
357
|
|
|
@@ -276,6 +402,34 @@ declare function parseCellInput(input: string): ParsedCellInput;
|
|
|
276
402
|
*/
|
|
277
403
|
declare function parseNumberText(text: string): number | null;
|
|
278
404
|
|
|
405
|
+
/**
|
|
406
|
+
* Common number formats offered by the "Format cells" menu, and the mapping
|
|
407
|
+
* between format codes and the coarser `CellFormat` kinds.
|
|
408
|
+
*/
|
|
409
|
+
|
|
410
|
+
interface NumberFormatPreset {
|
|
411
|
+
id: 'general' | 'number' | 'currency' | 'percent' | 'date' | 'time';
|
|
412
|
+
label: string;
|
|
413
|
+
code: string;
|
|
414
|
+
}
|
|
415
|
+
/** Presets of the "Format cells" menu (en-US). */
|
|
416
|
+
declare const NUMBER_FORMAT_PRESETS: readonly NumberFormatPreset[];
|
|
417
|
+
/**
|
|
418
|
+
* Format code for a `CellFormat` kind, used to display numbers in cells that
|
|
419
|
+
* have a kind but no format code: `currency` → `"$"#,##0.00`, `percentage` →
|
|
420
|
+
* `0%`, `date` → `m/d/yyyy`. Other kinds (`number`, `text` — the default of
|
|
421
|
+
* new columns —, `badge`, `status`, `assignee`) display as General (undefined).
|
|
422
|
+
*/
|
|
423
|
+
declare function numberFormatForCellFormat(format: CellFormat | undefined): string | undefined;
|
|
424
|
+
/**
|
|
425
|
+
* `CellFormat` kind matching a format code (`"$"#,##0.00` → `currency`,
|
|
426
|
+
* `0%` → `percentage`, `m/d/yyyy` → `date`, `0.00` → `number`, `@` → `text`);
|
|
427
|
+
* undefined for General, times and custom codes.
|
|
428
|
+
*/
|
|
429
|
+
declare function cellFormatForNumberFormat(code: string): CellFormat | undefined;
|
|
430
|
+
/** True for an empty or `General` code. */
|
|
431
|
+
declare const isGeneralNumberFormat: (code: string | undefined) => boolean;
|
|
432
|
+
|
|
279
433
|
/**
|
|
280
434
|
* RFC 4180 CSV (and other delimiter-separated values) parsing and
|
|
281
435
|
* serialization.
|
|
@@ -401,8 +555,25 @@ interface SpreadsheetMenuItem {
|
|
|
401
555
|
disabled?: boolean;
|
|
402
556
|
/** Draw a divider before this item. */
|
|
403
557
|
separatorBefore?: boolean;
|
|
404
|
-
|
|
558
|
+
/** The item is the current choice of its group (e.g. the cell's number format). */
|
|
559
|
+
checked?: boolean;
|
|
560
|
+
/**
|
|
561
|
+
* Ask for text before running (e.g. a custom number format code): the
|
|
562
|
+
* editor prompts with `label` and `defaultValue`, then calls `run(text)`;
|
|
563
|
+
* cancelling skips `run`.
|
|
564
|
+
*/
|
|
565
|
+
input?: {
|
|
566
|
+
label: string;
|
|
567
|
+
defaultValue?: string;
|
|
568
|
+
};
|
|
569
|
+
run: (input?: string) => void;
|
|
405
570
|
}
|
|
571
|
+
/**
|
|
572
|
+
* Runs a menu item the way the editors do: an item with `input` first asks
|
|
573
|
+
* for text with `ask` (default `window.prompt`) and is skipped when that is
|
|
574
|
+
* cancelled. Returns whether `run` was called.
|
|
575
|
+
*/
|
|
576
|
+
declare function runSpreadsheetMenuItem(item: SpreadsheetMenuItem, ask?: (label: string, defaultValue: string) => string | null | undefined): boolean;
|
|
406
577
|
/**
|
|
407
578
|
* Where to place a `position: fixed` menu opened at `point` so it stays inside
|
|
408
579
|
* the viewport: it flips to the left of / above the pointer when it would
|
|
@@ -437,7 +608,7 @@ declare function getSpreadsheetMenuItems(controller: SpreadsheetController, cell
|
|
|
437
608
|
* state syncing: the controller reports changes through `onDocumentChange`
|
|
438
609
|
* and `onSelectionChange`.
|
|
439
610
|
*/
|
|
440
|
-
declare const SPREADSHEET_TABLE_ACTIONS: readonly ["sortRows", "getFilterState", "setFilterRules", "addFilterRule", "updateFilterRule", "removeFilterRule", "clearFilters", "setFiltersEnabled", "toggleFilters", "setHeaderRowCount", "setFooterRowCount", "setHeaderColumnCount", "setFrozenRowCount", "setFrozenColumnCount", "hideRows", "unhideRows", "hideColumns", "unhideColumns", "unhideAll", "getMerges", "getMergeAt", "mergeCells", "unmergeCells", "autofill", "groupRowsBy", "ungroupRows", "setGroupSummary", "setGroupCollapsed", "toggleGroupCollapsed", "getGroups", "transposeRange", "exportToCsv", "importFromCsv", "copyToClipboardData", "pasteClipboardData"];
|
|
611
|
+
declare const SPREADSHEET_TABLE_ACTIONS: readonly ["sortRows", "getFilterState", "setFilterRules", "addFilterRule", "updateFilterRule", "removeFilterRule", "clearFilters", "setFiltersEnabled", "toggleFilters", "setHeaderRowCount", "setFooterRowCount", "setHeaderColumnCount", "setFrozenRowCount", "setFrozenColumnCount", "hideRows", "unhideRows", "hideColumns", "unhideColumns", "unhideAll", "getMerges", "getMergeAt", "mergeCells", "unmergeCells", "autofill", "groupRowsBy", "ungroupRows", "setGroupSummary", "setGroupCollapsed", "toggleGroupCollapsed", "getGroups", "transposeRange", "setCellNumberFormat", "setColumnNumberFormat", "exportToCsv", "importFromCsv", "copyToClipboardData", "pasteClipboardData"];
|
|
441
612
|
type SpreadsheetTableActionName = (typeof SPREADSHEET_TABLE_ACTIONS)[number];
|
|
442
613
|
type SpreadsheetTableActions = Pick<SpreadsheetController, SpreadsheetTableActionName>;
|
|
443
614
|
/** The table operations of `controller`, bound so they can be passed around. */
|
|
@@ -485,4 +656,4 @@ interface ImportFileIntoSpreadsheetOptions {
|
|
|
485
656
|
*/
|
|
486
657
|
declare function importFileIntoSpreadsheet(controller: SpreadsheetController, input: ImportInput, options: ImportFileIntoSpreadsheetOptions): Promise<ImportOutcome<SpreadsheetImport>>;
|
|
487
658
|
|
|
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 };
|
|
659
|
+
export { ASTNode, CellData, CellFormat, type CellInputFormatKind, CellPosition, CellRange, type CsvParseOptions, type CsvSerializeOptions, type FillDirection, FilterRule, type FormattedNumberValue, 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, MAX_NUMBER_FORMAT_CODE_CHARS, NUMBER_FORMAT_PRESETS, NumberFormat, type NumberFormatColor, type NumberFormatKind, type NumberFormatPreset, type ParsedCellInput, SPREADSHEET_IMPORT_ADAPTERS, SPREADSHEET_TABLE_ACTIONS, SortDirection, SpreadsheetController, type SpreadsheetImport, type SpreadsheetImportAdapter, type SpreadsheetMenuItem, type SpreadsheetTableActionName, type SpreadsheetTableActions, aggregateValues, applyFormulaSuggestion, bindSpreadsheetTableActions, builtinNumberFormat, builtinNumberFormatId, cellFormatForNumberFormat, checkFormulaArgumentCount, clampMenuPosition, clearNumberFormatCache, compareCellValues, computeFillTarget, csvImportAdapter, dateValueToSerial, escapeCsvField, fillSeries, formatCellDisplay, formatCellForDisplay, formatGeneralFit, formatNumberFormatValue, formatTextFunction, formatValueWithCode, getFillDirection, getFormulaArgumentSpecIndex, getFormulaCaretContext, getFormulaFunction, getFormulaHints, getFormulaSignature, getFormulaSignatureParts, getSpreadsheetMenuItems, importFileIntoSpreadsheet, isBlankValue, isGeneralNumberFormat, isSingleCellRange, listFormulaFunctions, matchesFilterRule, normalizeRange, numberFormatColorToCss, numberFormatForCellFormat, parseCellInput, parseCriteria, parseCsv, parseNumberText, parseTsv, rangeContains, rangeContainsRange, rangesIntersect, registerFormulaFunction, registerSpreadsheetImportAdapters, roundFloat, runSpreadsheetMenuItem, searchFormulaFunctions, serialFromYmd, serializeCsv, serializeTsv, toNumber, tsvImportAdapter, unregisterFormulaFunction, wildcardToRegExp };
|