@pixerate/editor 0.22.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 +175 -2
- package/THIRD_PARTY_NOTICES.md +139 -0
- package/dist/agent/index.cjs +87 -111
- package/dist/agent/index.cjs.map +1 -1
- package/dist/agent/index.d.cts +70 -211
- package/dist/agent/index.d.ts +70 -211
- package/dist/agent/index.js +78 -102
- package/dist/agent/index.js.map +1 -1
- package/dist/arrangeShortcuts-B8O3f8-P.d.cts +184 -0
- package/dist/arrangeShortcuts-sLlD2rSX.d.ts +184 -0
- package/dist/canvas/index.cjs +2075 -86
- package/dist/canvas/index.cjs.map +1 -1
- package/dist/canvas/index.d.cts +608 -186
- package/dist/canvas/index.d.ts +608 -186
- package/dist/canvas/index.js +2060 -71
- package/dist/canvas/index.js.map +1 -1
- package/dist/chunk-26BVFKHU.cjs +453 -0
- package/dist/chunk-26BVFKHU.cjs.map +1 -0
- package/dist/chunk-2H7ZHPEJ.js +762 -0
- package/dist/chunk-2H7ZHPEJ.js.map +1 -0
- package/dist/{chunk-DENSCKFC.js → chunk-3CN2WD3X.js} +1730 -189
- 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-7DWMJCAT.js +453 -0
- package/dist/chunk-7DWMJCAT.js.map +1 -0
- package/dist/chunk-ARRTP33I.js +101 -0
- package/dist/chunk-ARRTP33I.js.map +1 -0
- package/dist/chunk-CPOKFNBG.cjs +101 -0
- package/dist/chunk-CPOKFNBG.cjs.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-G2I4QJOT.cjs +762 -0
- package/dist/chunk-G2I4QJOT.cjs.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-6M3BCTBD.cjs → chunk-MA2F5KHF.cjs} +470 -242
- package/dist/chunk-MA2F5KHF.cjs.map +1 -0
- package/dist/{chunk-SAZRENEZ.cjs → chunk-MCSJFWAO.cjs} +1733 -192
- 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-RU52I7QO.js → chunk-U5KWZU4X.js} +388 -160
- 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.cjs +860 -0
- package/dist/commands/index.cjs.map +1 -0
- package/dist/commands/index.d.cts +244 -0
- package/dist/commands/index.d.ts +244 -0
- package/dist/commands/index.js +860 -0
- package/dist/commands/index.js.map +1 -0
- 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-B7GIybc4.d.cts → controller-BhLLAoi8.d.cts} +119 -5
- package/dist/{controller-B7GIybc4.d.ts → controller-BhLLAoi8.d.ts} +119 -5
- 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/history/index.cjs +12 -2
- package/dist/history/index.cjs.map +1 -1
- package/dist/history/index.d.cts +211 -7
- package/dist/history/index.d.ts +211 -7
- package/dist/history/index.js +13 -3
- package/dist/image-editor/index.cjs +2244 -38
- package/dist/image-editor/index.cjs.map +1 -1
- package/dist/image-editor/index.d.cts +742 -4
- package/dist/image-editor/index.d.ts +742 -4
- package/dist/image-editor/index.js +2222 -16
- 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 +193 -98
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -48
- package/dist/index.d.ts +17 -48
- package/dist/index.js +198 -103
- 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-BDe-vlv3.d.ts +171 -0
- package/dist/registry-D32LpIc4.d.cts +354 -0
- package/dist/registry-DnzpgY27.d.cts +171 -0
- 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 +53 -3
- package/dist/spreadsheet/index.cjs.map +1 -1
- package/dist/spreadsheet/index.d.cts +247 -18
- package/dist/spreadsheet/index.d.ts +247 -18
- package/dist/spreadsheet/index.js +58 -8
- 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.cts → track-changes-BK5sVf4_.d.cts} +18 -136
- package/dist/{track-changes-BSF58RK0.d.ts → track-changes-CDjCrwKe.d.ts} +18 -136
- package/dist/{types-CJ4U-HHI.d.ts → types-DX4Mh4SL.d.cts} +1 -1
- package/dist/{types-CJ4U-HHI.d.cts → types-DX4Mh4SL.d.ts} +1 -1
- package/dist/types-GT5a5YAX.d.cts +86 -0
- package/dist/types-GT5a5YAX.d.ts +86 -0
- package/package.json +23 -2
- package/dist/chunk-2TWGLC5K.cjs +0 -262
- package/dist/chunk-2TWGLC5K.cjs.map +0 -1
- package/dist/chunk-4SUNJZWB.cjs.map +0 -1
- package/dist/chunk-6M3BCTBD.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-DENSCKFC.js.map +0 -1
- package/dist/chunk-GVSMRPHB.cjs.map +0 -1
- package/dist/chunk-KAADNAPF.js +0 -262
- package/dist/chunk-KAADNAPF.js.map +0 -1
- package/dist/chunk-MJZBNWG7.js.map +0 -1
- package/dist/chunk-OYXSKQFR.js.map +0 -1
- package/dist/chunk-QGHGJ56O.js.map +0 -1
- package/dist/chunk-RU52I7QO.js.map +0 -1
- package/dist/chunk-SAZRENEZ.cjs.map +0 -1
- package/dist/types-BZgcDsC5.d.cts +0 -42
- package/dist/types-BZgcDsC5.d.ts +0 -42
- /package/dist/{chunk-JJDLPEWL.js.map → chunk-3LV6RRPH.js.map} +0 -0
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
rtfToPlainText,
|
|
10
10
|
sanitizeImportedHtml,
|
|
11
11
|
serializeRichClipboardPayload
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-3LV6RRPH.js";
|
|
13
13
|
import {
|
|
14
14
|
MARKDOWN_MENTION_SPLIT_REGEX,
|
|
15
15
|
MENTION_REGEX,
|
|
@@ -27,7 +27,8 @@ import {
|
|
|
27
27
|
preprocessMarkdownMentions,
|
|
28
28
|
sanitizeHtml,
|
|
29
29
|
stripMarkdownCode
|
|
30
|
-
} from "../chunk-
|
|
30
|
+
} from "../chunk-PGNZKFQS.js";
|
|
31
|
+
import "../chunk-5S3Z4PPF.js";
|
|
31
32
|
export {
|
|
32
33
|
MARKDOWN_MENTION_SPLIT_REGEX,
|
|
33
34
|
MENTION_REGEX,
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { P as PromptValues, T as Template, a as PromptDiagnostic } from './tokens-D7yXvUU6.cjs';
|
|
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 };
|
|
@@ -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 _chunk6M3BCTBDcjs = require('../chunk-6M3BCTBD.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
|
|
|
@@ -79,7 +80,6 @@ var _chunk6M3BCTBDcjs = require('../chunk-6M3BCTBD.cjs');
|
|
|
79
80
|
|
|
80
81
|
|
|
81
82
|
|
|
82
|
-
var _chunkSAZRENEZcjs = require('../chunk-SAZRENEZ.cjs');
|
|
83
83
|
|
|
84
84
|
|
|
85
85
|
|
|
@@ -105,6 +105,7 @@ var _chunkSAZRENEZcjs = require('../chunk-SAZRENEZ.cjs');
|
|
|
105
105
|
|
|
106
106
|
|
|
107
107
|
|
|
108
|
+
var _chunkMCSJFWAOcjs = require('../chunk-MCSJFWAO.cjs');
|
|
108
109
|
|
|
109
110
|
|
|
110
111
|
|
|
@@ -159,5 +160,54 @@ var _chunkSAZRENEZcjs = require('../chunk-SAZRENEZ.cjs');
|
|
|
159
160
|
|
|
160
161
|
|
|
161
162
|
|
|
162
|
-
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
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;
|
|
163
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;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;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, 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,
|
|
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';
|
|
@@ -202,24 +202,234 @@ 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
|
-
*
|
|
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
|
+
/** 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). */
|
|
212
226
|
/**
|
|
213
|
-
*
|
|
214
|
-
* -
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
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;
|
|
313
|
+
/**
|
|
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.
|
|
316
|
+
*/
|
|
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;
|
|
320
|
+
/**
|
|
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).
|
|
220
355
|
*/
|
|
221
356
|
declare function formatValueWithCode(value: unknown, format: string): string | null;
|
|
222
357
|
|
|
358
|
+
/**
|
|
359
|
+
* Parsing what people type into a cell (and numeric text in formulas).
|
|
360
|
+
*
|
|
361
|
+
* Recognises numbers with thousands separators, percentages, currency,
|
|
362
|
+
* scientific notation, fractions (`1 1/2`), dates (`3/4/2026`, `2026-03-04`,
|
|
363
|
+
* `4-Mar-2026`, `Mar 4, 2026`), times (`10:30`, `10:30:15 PM`) and
|
|
364
|
+
* date-times. Locale: en-US (month/day/year).
|
|
365
|
+
*
|
|
366
|
+
* Representation: our engine keeps dates as ISO text (`2026-03-04`, or
|
|
367
|
+
* `2026-03-04 18:00:00` with a time), so a typed date becomes ISO text, not a
|
|
368
|
+
* serial number. A time typed on its own (`12:00`) has no date to anchor ISO
|
|
369
|
+
* text to, so it becomes a fraction of a day (0.5), as in Excel.
|
|
370
|
+
*/
|
|
371
|
+
|
|
372
|
+
/** Kind of automatic number format chosen for typed input. */
|
|
373
|
+
type CellInputFormatKind = 'number' | 'currency' | 'percentage' | 'date' | 'time';
|
|
374
|
+
interface ParsedCellInput {
|
|
375
|
+
/** The typed value: number, boolean, ISO date text, error code or text. `''` for empty input. */
|
|
376
|
+
value: string | number | boolean;
|
|
377
|
+
type: 'empty' | 'text' | 'number' | 'boolean' | 'error' | 'date';
|
|
378
|
+
/**
|
|
379
|
+
* Number format code Excel would apply automatically (e.g. `"$"#,##0.00`,
|
|
380
|
+
* `0%`, `#,##0`, `m/d/yyyy`, `h:mm`), or undefined for General.
|
|
381
|
+
*/
|
|
382
|
+
numberFormat?: string;
|
|
383
|
+
/** What kind of format that is, if any. */
|
|
384
|
+
formatKind?: CellInputFormatKind;
|
|
385
|
+
/** `formatKind` mapped onto `CellFormat` (times have no `CellFormat` and map to undefined). */
|
|
386
|
+
cellFormat?: CellFormat;
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Excel 1900-system serial for a date (1 = 1900-01-01, 60 = the fictitious
|
|
390
|
+
* 1900-02-29). Month and day overflow roll over like `DATE()`; years 0–1899
|
|
391
|
+
* are added to 1900. Null before the epoch or after 9999-12-31.
|
|
392
|
+
*/
|
|
393
|
+
declare function serialFromYmd(year: number, month: number, day: number): number | null;
|
|
394
|
+
/**
|
|
395
|
+
* Interprets typed cell input (not formulas). Text that isn't a number,
|
|
396
|
+
* date, time, boolean or error stays text; a leading apostrophe forces text.
|
|
397
|
+
*/
|
|
398
|
+
declare function parseCellInput(input: string): ParsedCellInput;
|
|
399
|
+
/**
|
|
400
|
+
* Numeric text as arithmetic coerces it ("1,000", "50%", "$3", "1/2/2020",
|
|
401
|
+
* "10:00"); dates become 1900-system serial numbers. Null when it isn't numeric.
|
|
402
|
+
*/
|
|
403
|
+
declare function parseNumberText(text: string): number | null;
|
|
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
|
+
|
|
223
433
|
/**
|
|
224
434
|
* RFC 4180 CSV (and other delimiter-separated values) parsing and
|
|
225
435
|
* serialization.
|
|
@@ -288,9 +498,11 @@ declare function isBlankValue(value: unknown): boolean;
|
|
|
288
498
|
/** The numeric value of a number or numeric string, or null. */
|
|
289
499
|
declare function toNumber(value: unknown): number | null;
|
|
290
500
|
/**
|
|
291
|
-
* Sort order for cell values: numbers (ascending)
|
|
292
|
-
*
|
|
293
|
-
*
|
|
501
|
+
* Sort order for cell values, as in Excel: numbers (ascending), then text,
|
|
502
|
+
* booleans and errors; `desc` reverses that order. Numbers compare at 15
|
|
503
|
+
* significant digits and ISO dates chronologically. Text uses a natural,
|
|
504
|
+
* case-insensitive order ("Item 2" before "Item 10"). Blanks always sort
|
|
505
|
+
* last, whatever the direction.
|
|
294
506
|
*/
|
|
295
507
|
declare function compareCellValues(a: unknown, b: unknown, direction?: SortDirection): number;
|
|
296
508
|
/** Whether a cell value passes one filter rule. */
|
|
@@ -308,8 +520,8 @@ declare function roundFloat(value: number): number;
|
|
|
308
520
|
* nearest-first) by `count` values, the way a fill handle does:
|
|
309
521
|
*
|
|
310
522
|
* - numbers: one value repeats; two or more continue their linear trend
|
|
311
|
-
* -
|
|
312
|
-
* continue their day or month step
|
|
523
|
+
* - dates (ISO `YYYY-MM-DD`, or typed like `3/4/2026`): one date counts up
|
|
524
|
+
* by a day; two or more continue their day or month step (as ISO dates)
|
|
313
525
|
* - text ending in a number ("Item 1"): the number counts up (or continues
|
|
314
526
|
* the step of several values with the same prefix/suffix)
|
|
315
527
|
* - anything else (or a mix) repeats the source cyclically
|
|
@@ -343,8 +555,25 @@ interface SpreadsheetMenuItem {
|
|
|
343
555
|
disabled?: boolean;
|
|
344
556
|
/** Draw a divider before this item. */
|
|
345
557
|
separatorBefore?: boolean;
|
|
346
|
-
|
|
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;
|
|
347
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;
|
|
348
577
|
/**
|
|
349
578
|
* Where to place a `position: fixed` menu opened at `point` so it stays inside
|
|
350
579
|
* the viewport: it flips to the left of / above the pointer when it would
|
|
@@ -379,7 +608,7 @@ declare function getSpreadsheetMenuItems(controller: SpreadsheetController, cell
|
|
|
379
608
|
* state syncing: the controller reports changes through `onDocumentChange`
|
|
380
609
|
* and `onSelectionChange`.
|
|
381
610
|
*/
|
|
382
|
-
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"];
|
|
383
612
|
type SpreadsheetTableActionName = (typeof SPREADSHEET_TABLE_ACTIONS)[number];
|
|
384
613
|
type SpreadsheetTableActions = Pick<SpreadsheetController, SpreadsheetTableActionName>;
|
|
385
614
|
/** The table operations of `controller`, bound so they can be passed around. */
|
|
@@ -427,4 +656,4 @@ interface ImportFileIntoSpreadsheetOptions {
|
|
|
427
656
|
*/
|
|
428
657
|
declare function importFileIntoSpreadsheet(controller: SpreadsheetController, input: ImportInput, options: ImportFileIntoSpreadsheetOptions): Promise<ImportOutcome<SpreadsheetImport>>;
|
|
429
658
|
|
|
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 };
|
|
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 };
|