@xlsx-editor.dev/core 0.0.0-placeholder.0 → 0.1.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/LICENSE +217 -0
  2. package/README.md +254 -2
  3. package/THIRD_PARTY_NOTICES.md +78 -0
  4. package/dist/automation.d.ts +299 -0
  5. package/dist/automation.js +42 -0
  6. package/dist/builtins-nmHrq2Et.d.ts +37 -0
  7. package/dist/cascade.d.ts +196 -0
  8. package/dist/cascade.js +60 -0
  9. package/dist/cell-format-DW8yF-c-.d.ts +226 -0
  10. package/dist/chunk-2DLJYRJC.js +3171 -0
  11. package/dist/chunk-2ZU4337U.js +204 -0
  12. package/dist/chunk-44L37ENZ.js +8219 -0
  13. package/dist/chunk-77N55BLP.js +911 -0
  14. package/dist/chunk-7PV5HQPE.js +84 -0
  15. package/dist/chunk-E4VJJ556.js +756 -0
  16. package/dist/chunk-KG4IL4JI.js +436 -0
  17. package/dist/chunk-PLDK4XO6.js +9125 -0
  18. package/dist/chunk-PRHLYXHL.js +1699 -0
  19. package/dist/chunk-TE4FXG5T.js +3156 -0
  20. package/dist/contracts.d.ts +32 -0
  21. package/dist/contracts.js +0 -0
  22. package/dist/dist-C7NLNUMD.js +2850 -0
  23. package/dist/editor.d.ts +3167 -0
  24. package/dist/editor.js +309 -0
  25. package/dist/harfbuzz-measurer-CkKfsEyu.d.ts +128 -0
  26. package/dist/harfbuzz.wasm +0 -0
  27. package/dist/index.d.ts +11 -0
  28. package/dist/index.js +309 -0
  29. package/dist/layout.d.ts +111 -0
  30. package/dist/layout.js +104 -0
  31. package/dist/merge-commands-DthcNpfw.d.ts +53 -0
  32. package/dist/node-module-shim-LQXGL47O.js +18 -0
  33. package/dist/ops-CfUCjyph.d.ts +629 -0
  34. package/dist/output.d.ts +177 -0
  35. package/dist/output.js +29 -0
  36. package/dist/sheet-index-P5vevMWX.d.ts +52 -0
  37. package/dist/sheet-layout-D9M_4EBn.d.ts +494 -0
  38. package/dist/sheet-protection-D8goxm58.d.ts +209 -0
  39. package/dist/store.d.ts +615 -0
  40. package/dist/store.js +272 -0
  41. package/dist/theme-BprDji6x.d.ts +16 -0
  42. package/dist/units-D6CD_A5I.d.ts +13 -0
  43. package/dist/workbook-index-DsbeR8Kb.d.ts +294 -0
  44. package/licenses/Emscripten-LICENSE.txt +102 -0
  45. package/licenses/HarfBuzz-COPYING.txt +42 -0
  46. package/licenses/HarfBuzz-USE-MIT.txt +21 -0
  47. package/licenses/HarfBuzz-source-notices.txt +4508 -0
  48. package/licenses/README.md +19 -0
  49. package/licenses/Unicode-LICENSE.txt +39 -0
  50. package/licenses/compiler-rt-LICENSE.txt +311 -0
  51. package/licenses/harfbuzz-manifest.json +84 -0
  52. package/licenses/musl-COPYRIGHT.txt +193 -0
  53. package/package.json +79 -6
  54. package/src/styles/editor.css +1933 -0
  55. package/src/styles/editor.css.d.ts +2 -0
@@ -0,0 +1,226 @@
1
+ import { X as XlsxPackage, W as WorkbookIndex, E as Element } from './workbook-index-DsbeR8Kb.js';
2
+
3
+ /** The reason of a cascade problem. */
4
+ type CascadeProblemCode = 'shared-string-out-of-range' | 'bad-number' | 'bad-boolean' | 'unknown-cell-type' | 'cell-format-out-of-range' | 'number-format-id-malformed' | 'font-out-of-range' | 'fill-out-of-range' | 'border-out-of-range' | 'gradient-rectangle-out-of-range' | 'format-code-too-long' | 'format-too-many-sections' | 'format-too-many-brackets' | 'format-code-unparsable';
5
+ /** A problem of the cascade lane. `detail` is a short, capped excerpt of the file value. */
6
+ interface CascadeProblem {
7
+ readonly code: CascadeProblemCode;
8
+ readonly detail?: string;
9
+ }
10
+
11
+ /** One run of a rich string, as stored. `richTextRuns` (cell-format.ts) resolves its font. */
12
+ interface TextRun {
13
+ /** The text of the run (`x:r/x:t`, `CT_RElt`, `ST_Xstring`), with `_xHHHH_` escapes decoded. */
14
+ readonly text: string;
15
+ }
16
+ type CellValue = {
17
+ readonly kind: 'empty';
18
+ } | {
19
+ readonly kind: 'number';
20
+ readonly value: number;
21
+ } | {
22
+ readonly kind: 'string';
23
+ readonly text: string;
24
+ readonly runs?: readonly TextRun[];
25
+ } | {
26
+ readonly kind: 'boolean';
27
+ readonly value: boolean;
28
+ } | {
29
+ readonly kind: 'error';
30
+ readonly code: string;
31
+ }
32
+ /** `t="d"`: the ISO 8601 text as stored. The number format converts it to a serial. */
33
+ | {
34
+ readonly kind: 'date';
35
+ readonly iso: string;
36
+ };
37
+ interface ResolvedValue {
38
+ readonly value: CellValue;
39
+ /** The cell holds `x:f`. */
40
+ readonly formula: boolean;
41
+ /** The value is a cached formula result that can be out of date. */
42
+ readonly stale: boolean;
43
+ /** Why a stored value cannot be shown, for the caller to record with the cell reference. */
44
+ readonly problem?: CascadeProblem;
45
+ }
46
+ /** The text of a string item, and its runs when it has `x:r` children. */
47
+ interface StringItem {
48
+ /** The text of the item: its own `x:t` text, then the text of each run in order, decoded. */
49
+ readonly text: string;
50
+ /** The runs of a rich string (`x:r`), in order. Absent when the item has no runs. */
51
+ readonly runs?: readonly TextRun[];
52
+ }
53
+ /**
54
+ * The text of an `x:si` or `x:is` string item (`CT_Rst`), and its runs when it has `x:r`
55
+ * children.
56
+ */
57
+ declare function stringItem(item: Element | undefined): StringItem;
58
+ /** Whether the formula results of a sheet are stale from the file. */
59
+ declare function sheetStale(index: WorkbookIndex, worksheetRoot: Element): boolean;
60
+ /**
61
+ * The stored value of a cell. `stale` is the sheet's stale state from {@link sheetStale}; it
62
+ * applies to formula cells only.
63
+ */
64
+ declare function cellValue(pkg: XlsxPackage, index: WorkbookIndex, cell: Element, stale: boolean): ResolvedValue;
65
+ /**
66
+ * A finite `xsd:double` (XML Schema), as in `x:c/x:v` of a number cell (`CT_Cell`; the schema
67
+ * types `x:v` as `ST_Xstring`): an optional sign, digits with an optional point, and an optional
68
+ * exponent. Refuses hex, binary, and octal literals, surrounding spaces,
69
+ * `INF`, and `NaN`. One pass, no regular expression.
70
+ */
71
+ declare function parseDouble(raw: string): number | undefined;
72
+
73
+ /** A resolved color: `RRGGBB`, upper case. */
74
+ type Rgb = string;
75
+ /** The theme color scheme, in theme index order: lt1, dk1, lt2, dk2, accent1-6, hlink, folHlink. */
76
+ type ThemePalette = readonly (Rgb | undefined)[];
77
+ /** What a color resolves against. */
78
+ interface ColorContext {
79
+ readonly theme: ThemePalette;
80
+ /**
81
+ * `x:colors/x:indexedColors/x:rgbColor/@rgb` (`CT_IndexedColors`) of the styles part, when the
82
+ * file redefines the palette.
83
+ */
84
+ readonly indexed: readonly string[] | undefined;
85
+ }
86
+ /** Where a color is used: `auto` means black text and borders, and a white fill. */
87
+ type ColorUse = 'font' | 'border' | 'fill';
88
+ /**
89
+ * Resolve a `CT_Color` element: `@auto`, then `@rgb`, `@theme`, and `@indexed`, with `@tint`
90
+ * (`xsd:double`, default 0) on the result. Returns undefined for a missing element and for a
91
+ * color that names nothing; the caller then uses its default.
92
+ */
93
+ declare function resolveColor(el: Element | undefined, context: ColorContext, use: ColorUse): Rgb | undefined;
94
+
95
+ /** `x:u/@val` (`ST_UnderlineValues`). */
96
+ type UnderlineStyle = 'none' | 'single' | 'double' | 'singleAccounting' | 'doubleAccounting';
97
+ /** A resolved `x:font` (`CT_Font`) or run properties `x:rPr` (`CT_RPrElt`). */
98
+ interface ResolvedFont {
99
+ readonly family: string;
100
+ /** Font size in points. */
101
+ readonly sizePt: number;
102
+ readonly bold: boolean;
103
+ readonly italic: boolean;
104
+ readonly underline: UnderlineStyle;
105
+ readonly strike: boolean;
106
+ readonly color: Rgb;
107
+ /** `x:vertAlign/@val` (`ST_VerticalAlignRun`, shared-commonSimpleTypes.xsd). */
108
+ readonly vertAlign: 'baseline' | 'superscript' | 'subscript';
109
+ }
110
+ /**
111
+ * A resolved `x:fill` (`CT_Fill`): `x:patternFill` (`CT_PatternFill`, `@patternType` of
112
+ * `ST_PatternType`) or `x:gradientFill` (`CT_GradientFill`, stops of `CT_GradientStop`).
113
+ */
114
+ type ResolvedFill = {
115
+ readonly kind: 'none';
116
+ } | {
117
+ readonly kind: 'solid';
118
+ readonly color: Rgb;
119
+ } | {
120
+ readonly kind: 'pattern';
121
+ readonly pattern: string;
122
+ readonly foreground: Rgb;
123
+ readonly background: Rgb | undefined;
124
+ } | {
125
+ readonly kind: 'gradient';
126
+ /** `@type` (`ST_GradientType`, default `linear`). */
127
+ readonly type: 'linear' | 'path';
128
+ /** `@degree` (`xsd:double`, default 0). */
129
+ readonly degree: number;
130
+ /** The inner rectangle of a `path` gradient; all 0 for a `linear` one. */
131
+ readonly rect: GradientRect;
132
+ /** `x:stop/@position` and `x:stop/x:color` (`CT_GradientStop`). */
133
+ readonly stops: readonly {
134
+ readonly position: number;
135
+ readonly color: Rgb;
136
+ }[];
137
+ };
138
+ /**
139
+ * The inner rectangle of a `path` gradient (`@left`, `@right`, `@top`, `@bottom`): the positions
140
+ * of its edges as fractions of the width and height, from the left and top edges. Paint applies
141
+ * them to the box of the cell: the cell and its right and bottom gridline pixel. Measured on
142
+ * fixture `fills-patterns`: `left="0.2" right="0.4"` paints the first stop from 0.2 to
143
+ * 0.4 of the width. Each value lies in 0 to 1, with `left <= right` and `top <= bottom`.
144
+ */
145
+ interface GradientRect {
146
+ readonly left: number;
147
+ readonly right: number;
148
+ readonly top: number;
149
+ readonly bottom: number;
150
+ }
151
+ /** One edge of a border (`CT_BorderPr`). */
152
+ interface BorderEdge {
153
+ /** `ST_BorderStyle`; `none` when the edge has no line. */
154
+ readonly style: string;
155
+ readonly color: Rgb;
156
+ }
157
+ /** A resolved `x:border` (`CT_Border`), with `@diagonalUp` and `@diagonalDown`. */
158
+ interface ResolvedBorder {
159
+ readonly left: BorderEdge;
160
+ readonly right: BorderEdge;
161
+ readonly top: BorderEdge;
162
+ readonly bottom: BorderEdge;
163
+ readonly diagonal: BorderEdge;
164
+ readonly diagonalUp: boolean;
165
+ readonly diagonalDown: boolean;
166
+ }
167
+ /** A resolved `x:alignment` (`CT_CellAlignment`). */
168
+ interface ResolvedAlignment {
169
+ /** `ST_HorizontalAlignment`; `general` aligns by value type. */
170
+ readonly horizontal: string;
171
+ /** `ST_VerticalAlignment`; the schema default is `bottom`. */
172
+ readonly vertical: string;
173
+ readonly wrapText: boolean;
174
+ readonly shrinkToFit: boolean;
175
+ readonly indent: number;
176
+ /** `ST_TextRotation`: 0 to 180 degrees, or 255 for vertical stacked text. */
177
+ readonly textRotation: number;
178
+ }
179
+ /** A resolved `x:protection` (`CT_CellProtection`): `@locked` and `@hidden`. */
180
+ interface ResolvedProtection {
181
+ readonly locked: boolean;
182
+ readonly hidden: boolean;
183
+ }
184
+ interface ResolvedCellFormat {
185
+ /** The cell format index that was used: the cell's `@s`, or 0 after a fallback. */
186
+ readonly xf: number;
187
+ readonly numFmtId: number;
188
+ /** The custom format code of `numFmtId`, when the styles part defines one. */
189
+ readonly formatCode: string | undefined;
190
+ readonly font: ResolvedFont;
191
+ readonly fill: ResolvedFill;
192
+ readonly border: ResolvedBorder;
193
+ readonly alignment: ResolvedAlignment;
194
+ readonly protection: ResolvedProtection;
195
+ }
196
+ interface CellFormatResult {
197
+ readonly format: ResolvedCellFormat;
198
+ /** Why the format fell back, for the caller to record with the cell reference. */
199
+ readonly problems: readonly CascadeProblem[];
200
+ }
201
+ /** One run of a rich string with its resolved font. */
202
+ interface RichTextRun {
203
+ readonly text: string;
204
+ readonly font: ResolvedFont;
205
+ }
206
+ /**
207
+ * The resolved format of a cell format index (`x:c/@s`, as the file wrote it, or undefined for
208
+ * the default). Out-of-range indexes fall back to index 0 and return a problem.
209
+ */
210
+ declare function cellFormat(pkg: XlsxPackage, index: WorkbookIndex, s: string | undefined): CellFormatResult;
211
+ /**
212
+ * The runs of a rich string with resolved fonts. Each run reads its `x:rPr` through the font
213
+ * rules of the cascade, and a property that the run does not set comes from `cellFont`. The
214
+ * sender controls the number of runs, so the same runs resolve once for each cell font.
215
+ */
216
+ declare function richTextRuns(runs: readonly TextRun[], cellFont: ResolvedFont, pkg: XlsxPackage, index: WorkbookIndex): readonly RichTextRun[];
217
+ /**
218
+ * The default font of a workbook: the font of the Normal cell style (`x:cellStyle` with
219
+ * `builtinId="0"`, then its `xfId` in `x:cellStyleXfs`, then that format's `fontId`), or the
220
+ * font of `x:cellXfs[0]` when the styles part names no Normal style (quick reference, "Styles").
221
+ * It sets the maximum digit width of column widths and the default row height.
222
+ */
223
+ declare function defaultFont(pkg: XlsxPackage, index: WorkbookIndex): ResolvedFont;
224
+
225
+ export { cellFormat as o, cellValue as p, defaultFont as q, parseDouble as r, resolveColor as s, richTextRuns as t, sheetStale as u, stringItem as v };
226
+ export type { BorderEdge as B, CellValue as C, GradientRect as G, ResolvedCellFormat as R, StringItem as S, ThemePalette as T, UnderlineStyle as U, Rgb as a, ResolvedFill as b, CascadeProblem as c, CascadeProblemCode as d, CellFormatResult as e, ColorContext as f, ColorUse as g, ResolvedAlignment as h, ResolvedBorder as i, ResolvedFont as j, ResolvedProtection as k, ResolvedValue as l, RichTextRun as m, TextRun as n };