@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.
- package/LICENSE +217 -0
- package/README.md +254 -2
- package/THIRD_PARTY_NOTICES.md +78 -0
- package/dist/automation.d.ts +299 -0
- package/dist/automation.js +42 -0
- package/dist/builtins-nmHrq2Et.d.ts +37 -0
- package/dist/cascade.d.ts +196 -0
- package/dist/cascade.js +60 -0
- package/dist/cell-format-DW8yF-c-.d.ts +226 -0
- package/dist/chunk-2DLJYRJC.js +3171 -0
- package/dist/chunk-2ZU4337U.js +204 -0
- package/dist/chunk-44L37ENZ.js +8219 -0
- package/dist/chunk-77N55BLP.js +911 -0
- package/dist/chunk-7PV5HQPE.js +84 -0
- package/dist/chunk-E4VJJ556.js +756 -0
- package/dist/chunk-KG4IL4JI.js +436 -0
- package/dist/chunk-PLDK4XO6.js +9125 -0
- package/dist/chunk-PRHLYXHL.js +1699 -0
- package/dist/chunk-TE4FXG5T.js +3156 -0
- package/dist/contracts.d.ts +32 -0
- package/dist/contracts.js +0 -0
- package/dist/dist-C7NLNUMD.js +2850 -0
- package/dist/editor.d.ts +3167 -0
- package/dist/editor.js +309 -0
- package/dist/harfbuzz-measurer-CkKfsEyu.d.ts +128 -0
- package/dist/harfbuzz.wasm +0 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +309 -0
- package/dist/layout.d.ts +111 -0
- package/dist/layout.js +104 -0
- package/dist/merge-commands-DthcNpfw.d.ts +53 -0
- package/dist/node-module-shim-LQXGL47O.js +18 -0
- package/dist/ops-CfUCjyph.d.ts +629 -0
- package/dist/output.d.ts +177 -0
- package/dist/output.js +29 -0
- package/dist/sheet-index-P5vevMWX.d.ts +52 -0
- package/dist/sheet-layout-D9M_4EBn.d.ts +494 -0
- package/dist/sheet-protection-D8goxm58.d.ts +209 -0
- package/dist/store.d.ts +615 -0
- package/dist/store.js +272 -0
- package/dist/theme-BprDji6x.d.ts +16 -0
- package/dist/units-D6CD_A5I.d.ts +13 -0
- package/dist/workbook-index-DsbeR8Kb.d.ts +294 -0
- package/licenses/Emscripten-LICENSE.txt +102 -0
- package/licenses/HarfBuzz-COPYING.txt +42 -0
- package/licenses/HarfBuzz-USE-MIT.txt +21 -0
- package/licenses/HarfBuzz-source-notices.txt +4508 -0
- package/licenses/README.md +19 -0
- package/licenses/Unicode-LICENSE.txt +39 -0
- package/licenses/compiler-rt-LICENSE.txt +311 -0
- package/licenses/harfbuzz-manifest.json +84 -0
- package/licenses/musl-COPYRIGHT.txt +193 -0
- package/package.json +79 -6
- package/src/styles/editor.css +1933 -0
- package/src/styles/editor.css.d.ts +2 -0
package/dist/store.js
ADDED
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FIRST_CUSTOM_NUMFMT_ID,
|
|
3
|
+
MAX_COLUMN_WIDTH,
|
|
4
|
+
MAX_FONT_NAME_LENGTH,
|
|
5
|
+
MAX_FORMAT_CODE_LENGTH,
|
|
6
|
+
MAX_FORMAT_NEW_CELLS,
|
|
7
|
+
MAX_FORMULA_DEPTH,
|
|
8
|
+
MAX_FORMULA_LENGTH,
|
|
9
|
+
MAX_FORMULA_TOKENS,
|
|
10
|
+
MAX_RESIZE_NEW_ROWS,
|
|
11
|
+
MAX_ROW_HEIGHT,
|
|
12
|
+
MAX_STYLE_RECORDS,
|
|
13
|
+
PATCH_BORDER_STYLES,
|
|
14
|
+
PATCH_HORIZONTAL,
|
|
15
|
+
PATCH_VERTICAL,
|
|
16
|
+
STRUCTURE_PERMIT,
|
|
17
|
+
STRUCTURE_SUBJECT_KINDS,
|
|
18
|
+
WorkbookDocumentStore,
|
|
19
|
+
ambiguousSheetRange,
|
|
20
|
+
applySaveRules,
|
|
21
|
+
arrayFormulaIn,
|
|
22
|
+
arrayRangeCount,
|
|
23
|
+
cellChildBlocker,
|
|
24
|
+
cellKey,
|
|
25
|
+
cellLocked,
|
|
26
|
+
changedParts,
|
|
27
|
+
checkFormulaGrammar,
|
|
28
|
+
checkRangeEnds,
|
|
29
|
+
clearBlocker,
|
|
30
|
+
clearFormatsOverflow,
|
|
31
|
+
clearRangeBlocker,
|
|
32
|
+
columnFormatAt,
|
|
33
|
+
columnFormats,
|
|
34
|
+
crossSheetRangeAt,
|
|
35
|
+
firstValueLost,
|
|
36
|
+
formatIndex,
|
|
37
|
+
formatRangeOverflow,
|
|
38
|
+
formatTokens,
|
|
39
|
+
inheritedFormat,
|
|
40
|
+
isIsoDate,
|
|
41
|
+
keyAddress,
|
|
42
|
+
lockedCellIn,
|
|
43
|
+
lowerNumberFormat,
|
|
44
|
+
mergedRefMeeting,
|
|
45
|
+
moveCopiedFormula,
|
|
46
|
+
moveFormula,
|
|
47
|
+
normalizeFormula,
|
|
48
|
+
patchGroups,
|
|
49
|
+
patchProblem,
|
|
50
|
+
protectionRefusal,
|
|
51
|
+
qualifyFormula,
|
|
52
|
+
rangeBounds,
|
|
53
|
+
readFormulaInput,
|
|
54
|
+
readSheetProtection,
|
|
55
|
+
readWorkbookProtection,
|
|
56
|
+
rowFormat,
|
|
57
|
+
saveXlsx,
|
|
58
|
+
saveXlsxSteps,
|
|
59
|
+
sharedFormulaText,
|
|
60
|
+
sheetHyperlinks,
|
|
61
|
+
sheetIndex,
|
|
62
|
+
sheetMayHoldFormula,
|
|
63
|
+
sheetNameNeedsQuotes,
|
|
64
|
+
sheetPrefixText,
|
|
65
|
+
structureBlocker,
|
|
66
|
+
tokenizeFormula,
|
|
67
|
+
workbookOracles,
|
|
68
|
+
workbookPartBlocker,
|
|
69
|
+
wrappedValueCell,
|
|
70
|
+
writeXlsx,
|
|
71
|
+
writeXlsxSteps
|
|
72
|
+
} from "./chunk-44L37ENZ.js";
|
|
73
|
+
import {
|
|
74
|
+
CONTENT_TYPE,
|
|
75
|
+
CONTENT_TYPES_PART,
|
|
76
|
+
DEFAULT_LIMITS,
|
|
77
|
+
MAX_COLS,
|
|
78
|
+
MAX_ROWS,
|
|
79
|
+
NS,
|
|
80
|
+
REL,
|
|
81
|
+
STRICT_SPREADSHEETML,
|
|
82
|
+
attr,
|
|
83
|
+
binaryPartOf,
|
|
84
|
+
boolAttr,
|
|
85
|
+
bytesFingerprint,
|
|
86
|
+
canonicalFingerprint,
|
|
87
|
+
canonicalForm,
|
|
88
|
+
canonicalPackageFingerprint,
|
|
89
|
+
cellHasFormula,
|
|
90
|
+
child,
|
|
91
|
+
children,
|
|
92
|
+
columnLetters,
|
|
93
|
+
columnNumber,
|
|
94
|
+
contentTypeOf,
|
|
95
|
+
conventionalPrefix,
|
|
96
|
+
decodeXml,
|
|
97
|
+
decodeXstring,
|
|
98
|
+
elements,
|
|
99
|
+
encodeXstring,
|
|
100
|
+
equivalentPartName,
|
|
101
|
+
find,
|
|
102
|
+
formatCellRef,
|
|
103
|
+
intAttr,
|
|
104
|
+
is,
|
|
105
|
+
kindOf,
|
|
106
|
+
localNameKeys,
|
|
107
|
+
mainWorkbookPart,
|
|
108
|
+
packageFingerprints,
|
|
109
|
+
parseCellRef,
|
|
110
|
+
parseXmlPart,
|
|
111
|
+
parseXmlPartSteps,
|
|
112
|
+
partOf,
|
|
113
|
+
partPastLimit,
|
|
114
|
+
path,
|
|
115
|
+
q,
|
|
116
|
+
readXlsx,
|
|
117
|
+
readXlsxSteps,
|
|
118
|
+
relTarget,
|
|
119
|
+
relTargetByType,
|
|
120
|
+
relationshipById,
|
|
121
|
+
relationshipsOf,
|
|
122
|
+
relsPartName,
|
|
123
|
+
resolveLimits,
|
|
124
|
+
serializeXmlPart,
|
|
125
|
+
serializeXmlPartSteps,
|
|
126
|
+
sharedStringItems,
|
|
127
|
+
sheetByName,
|
|
128
|
+
sheetNameKey,
|
|
129
|
+
sheetsByKey,
|
|
130
|
+
styleLists,
|
|
131
|
+
textOf,
|
|
132
|
+
themeRoot,
|
|
133
|
+
workbookIndex,
|
|
134
|
+
wrappedFormula,
|
|
135
|
+
xmlInvalidAt,
|
|
136
|
+
xmlPartOf
|
|
137
|
+
} from "./chunk-2DLJYRJC.js";
|
|
138
|
+
export {
|
|
139
|
+
CONTENT_TYPE,
|
|
140
|
+
CONTENT_TYPES_PART,
|
|
141
|
+
DEFAULT_LIMITS,
|
|
142
|
+
FIRST_CUSTOM_NUMFMT_ID,
|
|
143
|
+
MAX_COLS,
|
|
144
|
+
MAX_COLUMN_WIDTH,
|
|
145
|
+
MAX_FONT_NAME_LENGTH,
|
|
146
|
+
MAX_FORMAT_CODE_LENGTH,
|
|
147
|
+
MAX_FORMAT_NEW_CELLS,
|
|
148
|
+
MAX_FORMULA_DEPTH,
|
|
149
|
+
MAX_FORMULA_LENGTH,
|
|
150
|
+
MAX_FORMULA_TOKENS,
|
|
151
|
+
MAX_RESIZE_NEW_ROWS,
|
|
152
|
+
MAX_ROWS,
|
|
153
|
+
MAX_ROW_HEIGHT,
|
|
154
|
+
MAX_STYLE_RECORDS,
|
|
155
|
+
NS,
|
|
156
|
+
PATCH_BORDER_STYLES,
|
|
157
|
+
PATCH_HORIZONTAL,
|
|
158
|
+
PATCH_VERTICAL,
|
|
159
|
+
REL,
|
|
160
|
+
STRICT_SPREADSHEETML,
|
|
161
|
+
STRUCTURE_PERMIT,
|
|
162
|
+
STRUCTURE_SUBJECT_KINDS,
|
|
163
|
+
WorkbookDocumentStore,
|
|
164
|
+
ambiguousSheetRange,
|
|
165
|
+
applySaveRules,
|
|
166
|
+
arrayFormulaIn,
|
|
167
|
+
arrayRangeCount,
|
|
168
|
+
attr,
|
|
169
|
+
binaryPartOf,
|
|
170
|
+
boolAttr,
|
|
171
|
+
bytesFingerprint,
|
|
172
|
+
canonicalFingerprint,
|
|
173
|
+
canonicalForm,
|
|
174
|
+
canonicalPackageFingerprint,
|
|
175
|
+
cellChildBlocker,
|
|
176
|
+
cellHasFormula,
|
|
177
|
+
cellKey,
|
|
178
|
+
cellLocked,
|
|
179
|
+
changedParts,
|
|
180
|
+
checkFormulaGrammar,
|
|
181
|
+
checkRangeEnds,
|
|
182
|
+
child,
|
|
183
|
+
children,
|
|
184
|
+
clearBlocker,
|
|
185
|
+
clearFormatsOverflow,
|
|
186
|
+
clearRangeBlocker,
|
|
187
|
+
columnFormatAt,
|
|
188
|
+
columnFormats,
|
|
189
|
+
columnLetters,
|
|
190
|
+
columnNumber,
|
|
191
|
+
contentTypeOf,
|
|
192
|
+
conventionalPrefix,
|
|
193
|
+
crossSheetRangeAt,
|
|
194
|
+
decodeXml,
|
|
195
|
+
decodeXstring,
|
|
196
|
+
elements,
|
|
197
|
+
encodeXstring,
|
|
198
|
+
equivalentPartName,
|
|
199
|
+
find,
|
|
200
|
+
firstValueLost,
|
|
201
|
+
formatCellRef,
|
|
202
|
+
formatIndex,
|
|
203
|
+
formatRangeOverflow,
|
|
204
|
+
formatTokens,
|
|
205
|
+
inheritedFormat,
|
|
206
|
+
intAttr,
|
|
207
|
+
is,
|
|
208
|
+
isIsoDate,
|
|
209
|
+
keyAddress,
|
|
210
|
+
kindOf,
|
|
211
|
+
localNameKeys,
|
|
212
|
+
lockedCellIn,
|
|
213
|
+
lowerNumberFormat,
|
|
214
|
+
mainWorkbookPart,
|
|
215
|
+
mergedRefMeeting,
|
|
216
|
+
moveCopiedFormula,
|
|
217
|
+
moveFormula,
|
|
218
|
+
normalizeFormula,
|
|
219
|
+
packageFingerprints,
|
|
220
|
+
parseCellRef,
|
|
221
|
+
parseXmlPart,
|
|
222
|
+
parseXmlPartSteps,
|
|
223
|
+
partOf,
|
|
224
|
+
partPastLimit,
|
|
225
|
+
patchGroups,
|
|
226
|
+
patchProblem,
|
|
227
|
+
path,
|
|
228
|
+
protectionRefusal,
|
|
229
|
+
q,
|
|
230
|
+
qualifyFormula,
|
|
231
|
+
rangeBounds,
|
|
232
|
+
readFormulaInput,
|
|
233
|
+
readSheetProtection,
|
|
234
|
+
readWorkbookProtection,
|
|
235
|
+
readXlsx,
|
|
236
|
+
readXlsxSteps,
|
|
237
|
+
relTarget,
|
|
238
|
+
relTargetByType,
|
|
239
|
+
relationshipById,
|
|
240
|
+
relationshipsOf,
|
|
241
|
+
relsPartName,
|
|
242
|
+
resolveLimits,
|
|
243
|
+
rowFormat,
|
|
244
|
+
saveXlsx,
|
|
245
|
+
saveXlsxSteps,
|
|
246
|
+
serializeXmlPart,
|
|
247
|
+
serializeXmlPartSteps,
|
|
248
|
+
sharedFormulaText,
|
|
249
|
+
sharedStringItems,
|
|
250
|
+
sheetByName,
|
|
251
|
+
sheetHyperlinks,
|
|
252
|
+
sheetIndex,
|
|
253
|
+
sheetMayHoldFormula,
|
|
254
|
+
sheetNameKey,
|
|
255
|
+
sheetNameNeedsQuotes,
|
|
256
|
+
sheetPrefixText,
|
|
257
|
+
sheetsByKey,
|
|
258
|
+
structureBlocker,
|
|
259
|
+
styleLists,
|
|
260
|
+
textOf,
|
|
261
|
+
themeRoot,
|
|
262
|
+
tokenizeFormula,
|
|
263
|
+
workbookIndex,
|
|
264
|
+
workbookOracles,
|
|
265
|
+
workbookPartBlocker,
|
|
266
|
+
wrappedFormula,
|
|
267
|
+
wrappedValueCell,
|
|
268
|
+
writeXlsx,
|
|
269
|
+
writeXlsxSteps,
|
|
270
|
+
xmlInvalidAt,
|
|
271
|
+
xmlPartOf
|
|
272
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { X as XlsxPackage, W as WorkbookIndex } from './workbook-index-DsbeR8Kb.js';
|
|
2
|
+
import { T as ThemePalette } from './cell-format-DW8yF-c-.js';
|
|
3
|
+
|
|
4
|
+
/** The theme facts the cascade uses. */
|
|
5
|
+
interface WorkbookTheme {
|
|
6
|
+
readonly palette: ThemePalette;
|
|
7
|
+
/** `a:majorFont/a:latin/@typeface`. */
|
|
8
|
+
readonly majorLatin: string | undefined;
|
|
9
|
+
/** `a:minorFont/a:latin/@typeface`. */
|
|
10
|
+
readonly minorLatin: string | undefined;
|
|
11
|
+
}
|
|
12
|
+
/** The theme of a workbook. Cached per theme root. */
|
|
13
|
+
declare function workbookTheme(pkg: XlsxPackage, index: WorkbookIndex): WorkbookTheme;
|
|
14
|
+
|
|
15
|
+
export { workbookTheme as w };
|
|
16
|
+
export type { WorkbookTheme as W };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** EMU in one point: 914400 EMU per inch, 72 points per inch. */
|
|
2
|
+
declare const EMU_PER_POINT = 12700;
|
|
3
|
+
/** CSS pixels in one inch. */
|
|
4
|
+
declare const CSS_PIXELS_PER_INCH = 96;
|
|
5
|
+
/** Points in one CSS pixel. */
|
|
6
|
+
declare const POINTS_PER_PIXEL: number;
|
|
7
|
+
declare const emuToPoints: (emu: number) => number;
|
|
8
|
+
/** CSS pixels to points. */
|
|
9
|
+
declare const pixelsToPoints: (pixels: number) => number;
|
|
10
|
+
/** Points to CSS pixels. */
|
|
11
|
+
declare const pointsToPixels: (points: number) => number;
|
|
12
|
+
|
|
13
|
+
export { CSS_PIXELS_PER_INCH as C, EMU_PER_POINT as E, POINTS_PER_PIXEL as P, pointsToPixels as a, emuToPoints as e, pixelsToPoints as p };
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
/** Archive caps: entry count, total decompressed bytes, and the decompression ratio. */
|
|
2
|
+
interface ZipLimits {
|
|
3
|
+
readonly maxEntries: number;
|
|
4
|
+
/** Max total UNCOMPRESSED bytes across the archive. */
|
|
5
|
+
readonly maxTotalBytes: number;
|
|
6
|
+
/**
|
|
7
|
+
* Max ratio of the archive's total declared uncompressed bytes to the archive's own byte
|
|
8
|
+
* length (zip-bomb guard). Applies once that total exceeds 8 MiB, so a small archive is
|
|
9
|
+
* never refused for compressing well.
|
|
10
|
+
*/
|
|
11
|
+
readonly maxRatio?: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Why XML was refused at the trust boundary.
|
|
16
|
+
*
|
|
17
|
+
* DTDs, entity declarations and external-entity references are PRE-rejected before parsing —
|
|
18
|
+
* blocking XXE and billion-laughs by never handing the parser the construct, rather than by
|
|
19
|
+
* trusting it to be configured safely.
|
|
20
|
+
*/
|
|
21
|
+
type XmlRejection = 'too-large' | 'dtd-forbidden' | 'entity-forbidden' | 'too-deep' | 'too-many-elements' | 'invalid-limits' | 'parse-error';
|
|
22
|
+
/** Per-part caps on size, element count and depth. Clamped into the hard ceilings. */
|
|
23
|
+
interface XmlLimits {
|
|
24
|
+
readonly maxBytes: number;
|
|
25
|
+
/** Element budget; may raise or lower the engine default, up to its hard ceiling. */
|
|
26
|
+
readonly maxElements?: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The typed kinds. Everything not listed is `generic`, carried verbatim.
|
|
31
|
+
*
|
|
32
|
+
* A kind is a LABEL on the same node shape, assigned from the expanded name and the parent's
|
|
33
|
+
* kind. Layout and editing read typed kinds; everything else only has to survive save.
|
|
34
|
+
*/
|
|
35
|
+
type NodeKind = 'generic' | 'workbook' | 'workbookPr' | 'bookViews' | 'workbookView' | 'sheets' | 'sheet' | 'definedNames' | 'definedName' | 'calcPr' | 'worksheet' | 'sheetPr' | 'dimension' | 'sheetViews' | 'sheetView' | 'pane' | 'selection' | 'sheetFormatPr' | 'cols' | 'col' | 'sheetData' | 'row' | 'cell' | 'formula' | 'value' | 'inlineString' | 'sheetCalcPr' | 'mergeCells' | 'mergeCell' | 'hyperlinks' | 'hyperlink' | 'printOptions' | 'pageMargins' | 'pageSetup' | 'drawing' | 'sst' | 'stringItem' | 'richRun' | 'runProperties' | 'stringText' | 'styleSheet' | 'numFmts' | 'numFmt' | 'fonts' | 'font' | 'fills' | 'fill' | 'borders' | 'border' | 'cellStyleXfs' | 'cellXfs' | 'xf' | 'cellStyles' | 'cellStyle' | 'colors' | 'wsDr' | 'twoCellAnchor' | 'oneCellAnchor' | 'absoluteAnchor' | 'anchorFrom' | 'anchorTo';
|
|
36
|
+
/** Assign a typed kind from the expanded name and the parent's kind. */
|
|
37
|
+
declare function kindOf(ns: string, local: string, parent: NodeKind | null): NodeKind;
|
|
38
|
+
|
|
39
|
+
/** A node's stable identity within its part. */
|
|
40
|
+
type NodeId = string;
|
|
41
|
+
|
|
42
|
+
/** One `xmlns` declaration authored on an element. `prefix` is '' for the default namespace. */
|
|
43
|
+
interface NamespaceDecl {
|
|
44
|
+
readonly prefix: string;
|
|
45
|
+
readonly uri: string;
|
|
46
|
+
}
|
|
47
|
+
/** One attribute, carried verbatim. */
|
|
48
|
+
interface Attr {
|
|
49
|
+
readonly ns: string;
|
|
50
|
+
readonly local: string;
|
|
51
|
+
readonly prefix?: string;
|
|
52
|
+
readonly value: string;
|
|
53
|
+
}
|
|
54
|
+
/** An element node. Immutable; edits produce new nodes along the changed path. */
|
|
55
|
+
interface Element {
|
|
56
|
+
readonly type: 'element';
|
|
57
|
+
readonly id: NodeId;
|
|
58
|
+
readonly kind: NodeKind;
|
|
59
|
+
readonly ns: string;
|
|
60
|
+
readonly local: string;
|
|
61
|
+
readonly prefix?: string;
|
|
62
|
+
readonly nsDecls: readonly NamespaceDecl[];
|
|
63
|
+
readonly attrs: readonly Attr[];
|
|
64
|
+
readonly children: readonly Node[];
|
|
65
|
+
}
|
|
66
|
+
/** A text node. Only retained where it is significant (see {@link isSignificantText}). */
|
|
67
|
+
interface TextNode {
|
|
68
|
+
readonly type: 'text';
|
|
69
|
+
readonly id: NodeId;
|
|
70
|
+
readonly value: string;
|
|
71
|
+
}
|
|
72
|
+
type Node = Element | TextNode;
|
|
73
|
+
/** One parsed XML part. `nextId` is the id counter for nodes created by later edits. */
|
|
74
|
+
interface XmlPart {
|
|
75
|
+
readonly partName: string;
|
|
76
|
+
readonly root: Element;
|
|
77
|
+
readonly nextId: number;
|
|
78
|
+
}
|
|
79
|
+
/** Why a part was refused at the trust boundary. */
|
|
80
|
+
type XmlPartRejection = XmlRejection | 'no-root' | 'unbound-prefix' | 'bad-name';
|
|
81
|
+
type XmlPartResult = {
|
|
82
|
+
readonly ok: true;
|
|
83
|
+
readonly part: XmlPart;
|
|
84
|
+
} | {
|
|
85
|
+
readonly ok: false;
|
|
86
|
+
readonly reason: XmlPartRejection;
|
|
87
|
+
readonly detail?: string;
|
|
88
|
+
};
|
|
89
|
+
/** Parse one XML part into the canonical tree. Never throws: the bytes are untrusted. */
|
|
90
|
+
declare function parseXmlPart(partName: string, xml: string, limits?: XmlLimits): XmlPartResult;
|
|
91
|
+
/**
|
|
92
|
+
* {@link parseXmlPart}, yielding between units of work on a long part. The tree, the node ids,
|
|
93
|
+
* and every refusal are the same. A part outside the plain subset of the one-pass reader takes
|
|
94
|
+
* the bounded read in one step.
|
|
95
|
+
*/
|
|
96
|
+
declare function parseXmlPartSteps(partName: string, xml: string, limits?: XmlLimits): Generator<void, XmlPartResult>;
|
|
97
|
+
|
|
98
|
+
/** One part of the package. */
|
|
99
|
+
type PackagePart = {
|
|
100
|
+
readonly kind: 'xml';
|
|
101
|
+
readonly partName: string;
|
|
102
|
+
readonly xml: XmlPart;
|
|
103
|
+
} | {
|
|
104
|
+
readonly kind: 'binary';
|
|
105
|
+
readonly partName: string;
|
|
106
|
+
readonly bytes: Uint8Array;
|
|
107
|
+
};
|
|
108
|
+
/** The whole package. Immutable: an edit produces a new package that shares untouched parts. */
|
|
109
|
+
interface XlsxPackage {
|
|
110
|
+
readonly parts: ReadonlyMap<string, PackagePart>;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Why a file was refused. The `reason` is one of these values:
|
|
114
|
+
*
|
|
115
|
+
* - `zip`: the bytes are not a zip archive, or the archive is damaged or crosses a limit.
|
|
116
|
+
* `detail` gives the zip reader's reason, such as `inflate-error`.
|
|
117
|
+
* - `no-content-types`: the archive has no `[Content_Types].xml` part.
|
|
118
|
+
* - `not-a-workbook`: the package has no workbook part of a known content type. `detail` gives
|
|
119
|
+
* the content type that was found, or what is missing.
|
|
120
|
+
* - `xml`: the XML of the part `partName` is malformed or crosses a limit. `detail` gives the
|
|
121
|
+
* XML reader's reason.
|
|
122
|
+
*/
|
|
123
|
+
type PackageRejection = {
|
|
124
|
+
readonly reason: 'zip';
|
|
125
|
+
readonly detail: string;
|
|
126
|
+
/** With the detail `too-large`, the size limit that the package passed. */
|
|
127
|
+
readonly limit?: 'zip.maxTotalBytes' | 'zip.maxRatio';
|
|
128
|
+
} | {
|
|
129
|
+
readonly reason: 'no-content-types';
|
|
130
|
+
} | {
|
|
131
|
+
readonly reason: 'not-a-workbook';
|
|
132
|
+
readonly detail?: string;
|
|
133
|
+
} | {
|
|
134
|
+
readonly reason: 'xml';
|
|
135
|
+
readonly partName: string;
|
|
136
|
+
readonly detail: XmlPartRejection;
|
|
137
|
+
};
|
|
138
|
+
type PackageResult = {
|
|
139
|
+
readonly ok: true;
|
|
140
|
+
readonly pkg: XlsxPackage;
|
|
141
|
+
} | {
|
|
142
|
+
readonly ok: false;
|
|
143
|
+
readonly error: PackageRejection;
|
|
144
|
+
};
|
|
145
|
+
declare const CONTENT_TYPES_PART = "/[Content_Types].xml";
|
|
146
|
+
/**
|
|
147
|
+
* The XML part limit that `part` passed when the read kept it as bytes, as the reason of the
|
|
148
|
+
* bounded reader (`too-large`, `too-many-elements`, or `too-deep`), or undefined.
|
|
149
|
+
*/
|
|
150
|
+
declare function partPastLimit(part: PackagePart): XmlPartRejection | undefined;
|
|
151
|
+
/** Decode the bytes of an XML part: a UTF-16 byte order mark is honored, UTF-8 otherwise. */
|
|
152
|
+
declare function decodeXml(bytes: Uint8Array): string;
|
|
153
|
+
/** Read a `.xlsx` at the trust boundary. Never throws. */
|
|
154
|
+
declare function readXlsx(bytes: Uint8Array, limits?: ZipLimits): PackageResult;
|
|
155
|
+
/**
|
|
156
|
+
* {@link readXlsx}, yielding between parts and inside a long part. The ZIP read and the content
|
|
157
|
+
* types part come first, in one step each. A caller that stops between yields gives the page a
|
|
158
|
+
* turn. The result is the same either way.
|
|
159
|
+
*/
|
|
160
|
+
declare function readXlsxSteps(bytes: Uint8Array, limits?: ZipLimits): Generator<void, PackageResult>;
|
|
161
|
+
/** The content type of a part, from `[Content_Types].xml`. */
|
|
162
|
+
declare function contentTypeOf(pkg: XlsxPackage, partName: string): string | undefined;
|
|
163
|
+
/** One relationship, resolved against its source part. */
|
|
164
|
+
interface Relationship {
|
|
165
|
+
readonly id: string;
|
|
166
|
+
readonly type: string;
|
|
167
|
+
/** Internal: the resolved part name. External: undefined. */
|
|
168
|
+
readonly target?: string;
|
|
169
|
+
/** External: the raw URI, retained verbatim and NEVER fetched. */
|
|
170
|
+
readonly externalTarget?: string;
|
|
171
|
+
readonly external: boolean;
|
|
172
|
+
}
|
|
173
|
+
/** The `.rels` part name for a source part (`/` for the package). */
|
|
174
|
+
declare function relsPartName(source: string): string;
|
|
175
|
+
/** All relationships of a source part. Unsafe or unresolvable targets are dropped. */
|
|
176
|
+
declare function relationshipsOf(pkg: XlsxPackage, source: string): readonly Relationship[];
|
|
177
|
+
/** The relationship of a source part with id `id`: the first one with that id. */
|
|
178
|
+
declare function relationshipById(pkg: XlsxPackage, source: string, id: string): Relationship | undefined;
|
|
179
|
+
/** The internal target of a relationship id, or undefined. */
|
|
180
|
+
declare function relTarget(pkg: XlsxPackage, source: string, id: string): string | undefined;
|
|
181
|
+
/** The first internal target of a relationship type. */
|
|
182
|
+
declare function relTargetByType(pkg: XlsxPackage, source: string, type: string): string | undefined;
|
|
183
|
+
/** `/xl/workbook.xml`, or wherever the package relationships point. */
|
|
184
|
+
declare function mainWorkbookPart(pkg: XlsxPackage): string | undefined;
|
|
185
|
+
/**
|
|
186
|
+
* The existing part whose name is OPC-equivalent to `partName` (ASCII case-insensitive), or
|
|
187
|
+
* undefined. Part names compare without case (OPC), so a relationship to `sheet1.xml` names a
|
|
188
|
+
* zip entry `Sheet1.xml`. A new part name must not match one: the writer folds case. One key
|
|
189
|
+
* map per part map, built on first use.
|
|
190
|
+
*/
|
|
191
|
+
declare function equivalentPartName(pkg: XlsxPackage, partName: string): string | undefined;
|
|
192
|
+
/** The part with a name OPC-equivalent to `partName`, or undefined. */
|
|
193
|
+
declare function partOf(pkg: XlsxPackage, partName: string | undefined): PackagePart | undefined;
|
|
194
|
+
/** The XML tree of a part, or undefined. */
|
|
195
|
+
declare function xmlPartOf(pkg: XlsxPackage, partName: string | undefined): XmlPart | undefined;
|
|
196
|
+
/** The bytes of a binary part, or undefined. */
|
|
197
|
+
declare function binaryPartOf(pkg: XlsxPackage, partName: string | undefined): Uint8Array | undefined;
|
|
198
|
+
/**
|
|
199
|
+
* Per-part canonical fingerprints. XML parts hash their canonical form; binaries hash bytes.
|
|
200
|
+
* Two packages with the same map are the same document content, however each was written.
|
|
201
|
+
*/
|
|
202
|
+
declare function packageFingerprints(pkg: XlsxPackage): ReadonlyMap<string, string>;
|
|
203
|
+
/** One hash over all part fingerprints: the package's canonical fingerprint. */
|
|
204
|
+
declare function canonicalPackageFingerprint(pkg: XlsxPackage): string;
|
|
205
|
+
|
|
206
|
+
/** The visibility of a sheet tab: `x:sheet/@state` (`ST_SheetState`; default `visible`). */
|
|
207
|
+
type SheetState = 'visible' | 'hidden' | 'veryHidden';
|
|
208
|
+
/** One `x:sheet` of the workbook, in tab order. */
|
|
209
|
+
interface SheetEntry {
|
|
210
|
+
/** 0-based position in `x:sheets`: the tab order, and the `localSheetId` of defined names. */
|
|
211
|
+
readonly index: number;
|
|
212
|
+
readonly name: string;
|
|
213
|
+
readonly sheetId: number | undefined;
|
|
214
|
+
readonly state: SheetState;
|
|
215
|
+
/** The relationship id (`r:id`). */
|
|
216
|
+
readonly relId: string | undefined;
|
|
217
|
+
/** The part the relationship names, when it is internal and present. */
|
|
218
|
+
readonly partName: string | undefined;
|
|
219
|
+
/** `worksheet` when the part is a modeled worksheet; `other` for a chartsheet or a gap. */
|
|
220
|
+
readonly kind: 'worksheet' | 'other';
|
|
221
|
+
}
|
|
222
|
+
/** The workbook-level facts the engine reads. */
|
|
223
|
+
interface WorkbookIndex {
|
|
224
|
+
readonly mainPart: string;
|
|
225
|
+
readonly sheets: readonly SheetEntry[];
|
|
226
|
+
/** `x:workbookPr/@date1904` (`CT_WorkbookPr`, sml.xsd; default false). */
|
|
227
|
+
readonly date1904: boolean;
|
|
228
|
+
/**
|
|
229
|
+
* `x:calcPr/@fullCalcOnLoad` (`CT_CalcPr`, sml.xsd; default false): every formula result of the
|
|
230
|
+
* workbook is stale.
|
|
231
|
+
*/
|
|
232
|
+
readonly fullCalcOnLoad: boolean;
|
|
233
|
+
/**
|
|
234
|
+
* `x:workbookView/@activeTab` of the first view (`CT_BookView`, sml.xsd; default 0), 0 when
|
|
235
|
+
* absent or out of range.
|
|
236
|
+
*/
|
|
237
|
+
readonly activeTab: number;
|
|
238
|
+
readonly sharedStringsPart: string | undefined;
|
|
239
|
+
readonly stylesPart: string | undefined;
|
|
240
|
+
readonly themePart: string | undefined;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* The workbook index of a package. Cached per package, so repeated reads of one revision
|
|
244
|
+
* cost one lookup. Undefined when the package has no workbook part.
|
|
245
|
+
*/
|
|
246
|
+
declare function workbookIndex(pkg: XlsxPackage): WorkbookIndex | undefined;
|
|
247
|
+
/**
|
|
248
|
+
* Fold a sheet name for lookup. Sheet names compare without case. The fold keeps the length:
|
|
249
|
+
* each code point becomes its uppercase only when that uppercase is one code point, so `ß`
|
|
250
|
+
* stays `ß` and `Maße` and `MASSE` stay two names. It is a lookup key only, and the stored name
|
|
251
|
+
* never changes.
|
|
252
|
+
*/
|
|
253
|
+
declare function sheetNameKey(name: string): string;
|
|
254
|
+
/** The sheets whose names fold (`sheetNameKey`) to the key of `name`, in tab order. */
|
|
255
|
+
declare function sheetsByKey(index: WorkbookIndex, name: string): readonly SheetEntry[];
|
|
256
|
+
/**
|
|
257
|
+
* The sheet with a name, or undefined. The one sheet with exactly that name wins; else the one
|
|
258
|
+
* sheet whose name matches without case. A name that matches more than one sheet, which only a
|
|
259
|
+
* file can hold, finds none, so an op on it is refused.
|
|
260
|
+
*/
|
|
261
|
+
declare function sheetByName(index: WorkbookIndex, name: string): SheetEntry | undefined;
|
|
262
|
+
/**
|
|
263
|
+
* The names of the defined names that the sheet at `position` scopes (`@localSheetId`), as
|
|
264
|
+
* `sheetNameKey` folds them. Defined names compare without case.
|
|
265
|
+
*/
|
|
266
|
+
declare function localNameKeys(pkg: XlsxPackage, index: WorkbookIndex, position: number): ReadonlySet<string>;
|
|
267
|
+
/**
|
|
268
|
+
* The `x:si` items of the shared string table, in order. Empty when the part is absent. The same
|
|
269
|
+
* array for the same part revision, so callers can key caches on it.
|
|
270
|
+
*/
|
|
271
|
+
declare function sharedStringItems(pkg: XlsxPackage, index: WorkbookIndex): readonly Element[];
|
|
272
|
+
/** The lists of the styles part that a cell's `@s` reaches, in order. */
|
|
273
|
+
interface StyleLists {
|
|
274
|
+
/** `x:numFmt` by `numFmtId`. The first definition of an id wins. */
|
|
275
|
+
readonly numFmts: ReadonlyMap<number, string>;
|
|
276
|
+
readonly fonts: readonly Element[];
|
|
277
|
+
readonly fills: readonly Element[];
|
|
278
|
+
readonly borders: readonly Element[];
|
|
279
|
+
readonly cellStyleXfs: readonly Element[];
|
|
280
|
+
readonly cellXfs: readonly Element[];
|
|
281
|
+
/** `x:cellStyle` elements. */
|
|
282
|
+
readonly cellStyles: readonly Element[];
|
|
283
|
+
/** `x:dxfs/x:dxf`: the differential formats that conditional formatting rules name. */
|
|
284
|
+
readonly dxfs: readonly Element[];
|
|
285
|
+
/** `x:colors/x:indexedColors/x:rgbColor/@rgb`, when the file redefines the palette. */
|
|
286
|
+
readonly indexedColors: readonly string[] | undefined;
|
|
287
|
+
}
|
|
288
|
+
/** The style lists of the workbook. Empty lists when the styles part is absent. */
|
|
289
|
+
declare function styleLists(pkg: XlsxPackage, index: WorkbookIndex): StyleLists;
|
|
290
|
+
/** The theme part's root (`a:theme`), or undefined. */
|
|
291
|
+
declare function themeRoot(pkg: XlsxPackage, index: WorkbookIndex): Element | undefined;
|
|
292
|
+
|
|
293
|
+
export { readXlsxSteps as B, CONTENT_TYPES_PART as C, relTarget as D, relTargetByType as F, relationshipById as G, relationshipsOf as H, relsPartName as I, sharedStringItems as J, sheetByName as K, sheetNameKey as L, sheetsByKey as M, styleLists as O, themeRoot as Q, workbookIndex as U, xmlPartOf as V, binaryPartOf as m, canonicalPackageFingerprint as n, contentTypeOf as o, decodeXml as p, equivalentPartName as q, kindOf as r, localNameKeys as s, mainWorkbookPart as t, packageFingerprints as u, parseXmlPart as v, parseXmlPartSteps as w, partOf as x, partPastLimit as y, readXlsx as z };
|
|
294
|
+
export type { Attr as A, Element as E, Node as N, PackagePart as P, Relationship as R, SheetEntry as S, TextNode as T, WorkbookIndex as W, XlsxPackage as X, ZipLimits as Z, XmlPart as a, NamespaceDecl as b, NodeId as c, NodeKind as d, PackageRejection as e, PackageResult as f, SheetState as g, StyleLists as h, XmlLimits as i, XmlPartRejection as j, XmlPartResult as k, XmlRejection as l };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
Emscripten is available under 2 licenses, the MIT license and the
|
|
2
|
+
University of Illinois/NCSA Open Source License.
|
|
3
|
+
|
|
4
|
+
Both are permissive open source licenses, with little if any
|
|
5
|
+
practical difference between them.
|
|
6
|
+
|
|
7
|
+
The reason for offering both is that (1) the MIT license is
|
|
8
|
+
well-known, while (2) the University of Illinois/NCSA Open Source
|
|
9
|
+
License allows Emscripten's code to be integrated upstream into
|
|
10
|
+
LLVM, which uses that license, should the opportunity arise.
|
|
11
|
+
|
|
12
|
+
The full text of both licenses follows.
|
|
13
|
+
|
|
14
|
+
==============================================================================
|
|
15
|
+
|
|
16
|
+
Copyright (c) 2010-2014 Emscripten authors, see AUTHORS file.
|
|
17
|
+
|
|
18
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
19
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
20
|
+
in the Software without restriction, including without limitation the rights
|
|
21
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
22
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
23
|
+
furnished to do so, subject to the following conditions:
|
|
24
|
+
|
|
25
|
+
The above copyright notice and this permission notice shall be included in
|
|
26
|
+
all copies or substantial portions of the Software.
|
|
27
|
+
|
|
28
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
29
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
30
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
31
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
32
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
33
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
34
|
+
THE SOFTWARE.
|
|
35
|
+
|
|
36
|
+
==============================================================================
|
|
37
|
+
|
|
38
|
+
Copyright (c) 2010-2014 Emscripten authors, see AUTHORS file.
|
|
39
|
+
All rights reserved.
|
|
40
|
+
|
|
41
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
|
42
|
+
copy of this software and associated documentation files (the
|
|
43
|
+
"Software"), to deal with the Software without restriction, including
|
|
44
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
45
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
46
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
47
|
+
the following conditions:
|
|
48
|
+
|
|
49
|
+
Redistributions of source code must retain the above copyright
|
|
50
|
+
notice, this list of conditions and the following disclaimers.
|
|
51
|
+
|
|
52
|
+
Redistributions in binary form must reproduce the above
|
|
53
|
+
copyright notice, this list of conditions and the following disclaimers
|
|
54
|
+
in the documentation and/or other materials provided with the
|
|
55
|
+
distribution.
|
|
56
|
+
|
|
57
|
+
Neither the names of Mozilla,
|
|
58
|
+
nor the names of its contributors may be used to endorse
|
|
59
|
+
or promote products derived from this Software without specific prior
|
|
60
|
+
written permission.
|
|
61
|
+
|
|
62
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
63
|
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
64
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
65
|
+
IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR
|
|
66
|
+
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
67
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
68
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
|
|
69
|
+
|
|
70
|
+
==============================================================================
|
|
71
|
+
|
|
72
|
+
This program uses portions of Node.js source code located in src/library_path.js,
|
|
73
|
+
in accordance with the terms of the MIT license. Node's license follows:
|
|
74
|
+
|
|
75
|
+
"""
|
|
76
|
+
Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
|
77
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
78
|
+
of this software and associated documentation files (the "Software"), to
|
|
79
|
+
deal in the Software without restriction, including without limitation the
|
|
80
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
81
|
+
sell copies of the Software, and to permit persons to whom the Software is
|
|
82
|
+
furnished to do so, subject to the following conditions:
|
|
83
|
+
|
|
84
|
+
The above copyright notice and this permission notice shall be included in
|
|
85
|
+
all copies or substantial portions of the Software.
|
|
86
|
+
|
|
87
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
88
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
89
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
90
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
91
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
93
|
+
IN THE SOFTWARE.
|
|
94
|
+
"""
|
|
95
|
+
|
|
96
|
+
The musl libc project is bundled in this repo, and it has the MIT license, see
|
|
97
|
+
system/lib/libc/musl/COPYRIGHT
|
|
98
|
+
|
|
99
|
+
The third_party/ subdirectory contains code with other licenses. None of it is
|
|
100
|
+
used by default, but certain options use it (e.g., the optional closure compiler
|
|
101
|
+
flag will run closure compiler from third_party/).
|
|
102
|
+
|