@shbernal/ts-xlsx 1.0.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 +23 -0
- package/README.md +230 -0
- package/dist/core/address.d.ts +49 -0
- package/dist/core/address.js +125 -0
- package/dist/core/autofilter.d.ts +55 -0
- package/dist/core/autofilter.js +48 -0
- package/dist/core/cell.d.ts +132 -0
- package/dist/core/cell.js +249 -0
- package/dist/core/color-resolution.d.ts +58 -0
- package/dist/core/color-resolution.js +170 -0
- package/dist/core/column.d.ts +87 -0
- package/dist/core/column.js +167 -0
- package/dist/core/comment-thread.d.ts +116 -0
- package/dist/core/comment-thread.js +62 -0
- package/dist/core/conditional-formatting-overlay.d.ts +15 -0
- package/dist/core/conditional-formatting-overlay.js +24 -0
- package/dist/core/conditional-formatting.d.ts +70 -0
- package/dist/core/conditional-formatting.js +35 -0
- package/dist/core/containers.d.ts +2 -0
- package/dist/core/containers.js +25 -0
- package/dist/core/data-validation-overlay.d.ts +28 -0
- package/dist/core/data-validation-overlay.js +56 -0
- package/dist/core/data-validation.d.ts +38 -0
- package/dist/core/data-validation.js +13 -0
- package/dist/core/date.d.ts +25 -0
- package/dist/core/date.js +58 -0
- package/dist/core/formula.d.ts +49 -0
- package/dist/core/formula.js +319 -0
- package/dist/core/grid-edits.d.ts +22 -0
- package/dist/core/grid-edits.js +206 -0
- package/dist/core/image.d.ts +76 -0
- package/dist/core/image.js +65 -0
- package/dist/core/internal.d.ts +11 -0
- package/dist/core/internal.js +29 -0
- package/dist/core/merge.d.ts +13 -0
- package/dist/core/merge.js +26 -0
- package/dist/core/modern-functions.d.ts +1 -0
- package/dist/core/modern-functions.js +165 -0
- package/dist/core/page-setup.d.ts +94 -0
- package/dist/core/page-setup.js +6 -0
- package/dist/core/pivot-table.d.ts +113 -0
- package/dist/core/pivot-table.js +249 -0
- package/dist/core/preserved.d.ts +58 -0
- package/dist/core/preserved.js +5 -0
- package/dist/core/protection.d.ts +67 -0
- package/dist/core/protection.js +68 -0
- package/dist/core/range.d.ts +112 -0
- package/dist/core/range.js +283 -0
- package/dist/core/row.d.ts +73 -0
- package/dist/core/row.js +135 -0
- package/dist/core/style.d.ts +246 -0
- package/dist/core/style.js +125 -0
- package/dist/core/table-style.d.ts +67 -0
- package/dist/core/table-style.js +90 -0
- package/dist/core/table.d.ts +194 -0
- package/dist/core/table.js +291 -0
- package/dist/core/theme.d.ts +90 -0
- package/dist/core/theme.js +272 -0
- package/dist/core/value.d.ts +115 -0
- package/dist/core/value.js +144 -0
- package/dist/core/workbook-protection.d.ts +27 -0
- package/dist/core/workbook-protection.js +25 -0
- package/dist/core/workbook.d.ts +528 -0
- package/dist/core/workbook.js +732 -0
- package/dist/core/worksheet-model.d.ts +34 -0
- package/dist/core/worksheet-model.js +100 -0
- package/dist/core/worksheet.d.ts +647 -0
- package/dist/core/worksheet.js +1025 -0
- package/dist/customui/errors.d.ts +15 -0
- package/dist/customui/errors.js +15 -0
- package/dist/customui/index.d.ts +2 -0
- package/dist/customui/index.js +7 -0
- package/dist/customui/ribbon.d.ts +86 -0
- package/dist/customui/ribbon.js +180 -0
- package/dist/entries/core.d.ts +23 -0
- package/dist/entries/core.js +20 -0
- package/dist/entries/csv.d.ts +2 -0
- package/dist/entries/csv.js +6 -0
- package/dist/entries/customui.d.ts +1 -0
- package/dist/entries/customui.js +3 -0
- package/dist/entries/errors.d.ts +7 -0
- package/dist/entries/errors.js +20 -0
- package/dist/entries/vba.d.ts +2 -0
- package/dist/entries/vba.js +7 -0
- package/dist/entries/xlsb.d.ts +1 -0
- package/dist/entries/xlsb.js +7 -0
- package/dist/entries/xlsx.d.ts +5 -0
- package/dist/entries/xlsx.js +18 -0
- package/dist/errors.d.ts +65 -0
- package/dist/errors.js +66 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +19 -0
- package/dist/io/csv/read.d.ts +15 -0
- package/dist/io/csv/read.js +113 -0
- package/dist/io/csv/write.d.ts +28 -0
- package/dist/io/csv/write.js +124 -0
- package/dist/io/opc/errors.d.ts +46 -0
- package/dist/io/opc/errors.js +49 -0
- package/dist/io/opc/inflate.d.ts +15 -0
- package/dist/io/opc/inflate.js +91 -0
- package/dist/io/opc/namespaces.d.ts +18 -0
- package/dist/io/opc/namespaces.js +18 -0
- package/dist/io/opc/part-paths.d.ts +4 -0
- package/dist/io/opc/part-paths.js +35 -0
- package/dist/io/opc/read-opc.d.ts +24 -0
- package/dist/io/opc/read-opc.js +153 -0
- package/dist/io/opc/read-options.d.ts +10 -0
- package/dist/io/opc/read-options.js +7 -0
- package/dist/io/opc/rels.d.ts +15 -0
- package/dist/io/opc/rels.js +28 -0
- package/dist/io/opc/sniff-format.d.ts +27 -0
- package/dist/io/opc/sniff-format.js +92 -0
- package/dist/io/style/xf-style.d.ts +47 -0
- package/dist/io/style/xf-style.js +95 -0
- package/dist/io/xlsb/errors.d.ts +15 -0
- package/dist/io/xlsb/errors.js +15 -0
- package/dist/io/xlsb/formula.d.ts +48 -0
- package/dist/io/xlsb/formula.js +398 -0
- package/dist/io/xlsb/primitives.d.ts +86 -0
- package/dist/io/xlsb/primitives.js +230 -0
- package/dist/io/xlsb/ptg-functions.d.ts +16 -0
- package/dist/io/xlsb/ptg-functions.js +659 -0
- package/dist/io/xlsb/read-shared-strings.d.ts +2 -0
- package/dist/io/xlsb/read-shared-strings.js +22 -0
- package/dist/io/xlsb/read-styles.d.ts +4 -0
- package/dist/io/xlsb/read-styles.js +386 -0
- package/dist/io/xlsb/read-worksheet.d.ts +9 -0
- package/dist/io/xlsb/read-worksheet.js +301 -0
- package/dist/io/xlsb/read.d.ts +20 -0
- package/dist/io/xlsb/read.js +199 -0
- package/dist/io/xlsb/record-stream.d.ts +14 -0
- package/dist/io/xlsb/record-stream.js +56 -0
- package/dist/io/xlsb/record-types.d.ts +55 -0
- package/dist/io/xlsb/record-types.js +73 -0
- package/dist/io/xlsx/cell-accumulator.d.ts +25 -0
- package/dist/io/xlsx/cell-accumulator.js +172 -0
- package/dist/io/xlsx/cell-value.d.ts +32 -0
- package/dist/io/xlsx/cell-value.js +85 -0
- package/dist/io/xlsx/comments.d.ts +74 -0
- package/dist/io/xlsx/comments.js +243 -0
- package/dist/io/xlsx/conditional-formatting.d.ts +32 -0
- package/dist/io/xlsx/conditional-formatting.js +464 -0
- package/dist/io/xlsx/data-validation.d.ts +20 -0
- package/dist/io/xlsx/data-validation.js +258 -0
- package/dist/io/xlsx/edit-vba.d.ts +23 -0
- package/dist/io/xlsx/edit-vba.js +139 -0
- package/dist/io/xlsx/errors.d.ts +17 -0
- package/dist/io/xlsx/errors.js +17 -0
- package/dist/io/xlsx/hyperlinks.d.ts +42 -0
- package/dist/io/xlsx/hyperlinks.js +139 -0
- package/dist/io/xlsx/images.d.ts +34 -0
- package/dist/io/xlsx/images.js +218 -0
- package/dist/io/xlsx/namespaces.d.ts +55 -0
- package/dist/io/xlsx/namespaces.js +55 -0
- package/dist/io/xlsx/package-plan.d.ts +103 -0
- package/dist/io/xlsx/package-plan.js +168 -0
- package/dist/io/xlsx/pivot-read.d.ts +5 -0
- package/dist/io/xlsx/pivot-read.js +134 -0
- package/dist/io/xlsx/pivot.d.ts +12 -0
- package/dist/io/xlsx/pivot.js +141 -0
- package/dist/io/xlsx/read-rows.d.ts +85 -0
- package/dist/io/xlsx/read-rows.js +286 -0
- package/dist/io/xlsx/read-styles.d.ts +8 -0
- package/dist/io/xlsx/read-styles.js +551 -0
- package/dist/io/xlsx/read-worksheet.d.ts +4 -0
- package/dist/io/xlsx/read-worksheet.js +528 -0
- package/dist/io/xlsx/read.d.ts +32 -0
- package/dist/io/xlsx/read.js +680 -0
- package/dist/io/xlsx/relationships.d.ts +33 -0
- package/dist/io/xlsx/relationships.js +47 -0
- package/dist/io/xlsx/rich-runs.d.ts +13 -0
- package/dist/io/xlsx/rich-runs.js +59 -0
- package/dist/io/xlsx/rich-text.d.ts +7 -0
- package/dist/io/xlsx/rich-text.js +23 -0
- package/dist/io/xlsx/shared-formulas.d.ts +6 -0
- package/dist/io/xlsx/shared-formulas.js +52 -0
- package/dist/io/xlsx/shared-strings-read.d.ts +2 -0
- package/dist/io/xlsx/shared-strings-read.js +70 -0
- package/dist/io/xlsx/shared-strings.d.ts +17 -0
- package/dist/io/xlsx/shared-strings.js +50 -0
- package/dist/io/xlsx/sheet-properties.d.ts +13 -0
- package/dist/io/xlsx/sheet-properties.js +211 -0
- package/dist/io/xlsx/styles.d.ts +138 -0
- package/dist/io/xlsx/styles.js +821 -0
- package/dist/io/xlsx/tables.d.ts +9 -0
- package/dist/io/xlsx/tables.js +208 -0
- package/dist/io/xlsx/threaded-comments.d.ts +102 -0
- package/dist/io/xlsx/threaded-comments.js +308 -0
- package/dist/io/xlsx/workbook-xml.d.ts +12 -0
- package/dist/io/xlsx/workbook-xml.js +353 -0
- package/dist/io/xlsx/worksheet-xml.d.ts +86 -0
- package/dist/io/xlsx/worksheet-xml.js +643 -0
- package/dist/io/xlsx/write-stream.d.ts +171 -0
- package/dist/io/xlsx/write-stream.js +399 -0
- package/dist/io/xlsx/write.d.ts +81 -0
- package/dist/io/xlsx/write.js +396 -0
- package/dist/io/xlsx/x14-ext.d.ts +9 -0
- package/dist/io/xlsx/x14-ext.js +12 -0
- package/dist/vba/cfb-writer.d.ts +19 -0
- package/dist/vba/cfb-writer.js +277 -0
- package/dist/vba/cfb.d.ts +16 -0
- package/dist/vba/cfb.js +324 -0
- package/dist/vba/codepage.d.ts +18 -0
- package/dist/vba/codepage.js +87 -0
- package/dist/vba/errors.d.ts +24 -0
- package/dist/vba/errors.js +24 -0
- package/dist/vba/index.d.ts +5 -0
- package/dist/vba/index.js +15 -0
- package/dist/vba/ms-ovba.d.ts +12 -0
- package/dist/vba/ms-ovba.js +176 -0
- package/dist/vba/project-editor.d.ts +62 -0
- package/dist/vba/project-editor.js +377 -0
- package/dist/vba/project.d.ts +45 -0
- package/dist/vba/project.js +160 -0
- package/dist/vba/vba-encoding.d.ts +14 -0
- package/dist/vba/vba-encoding.js +39 -0
- package/dist/xml/errors.d.ts +15 -0
- package/dist/xml/errors.js +15 -0
- package/dist/xml/xml-read.d.ts +107 -0
- package/dist/xml/xml-read.js +283 -0
- package/dist/xml/xml.d.ts +41 -0
- package/dist/xml/xml.js +86 -0
- package/package.json +117 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
/** Underline can be a plain flag or one of Excel's named underline styles. */
|
|
2
|
+
export type UnderlineStyle = boolean | 'none' | 'single' | 'double' | 'singleAccounting' | 'doubleAccounting';
|
|
3
|
+
/** Narrow a raw `<u val>` token to a named {@link UnderlineStyle} (the non-boolean members). */
|
|
4
|
+
export declare function isNamedUnderlineStyle(value: string): value is Exclude<UnderlineStyle, boolean>;
|
|
5
|
+
/** A colour, expressed as an ARGB hex string (`"FF0000FF"`) or an indexed theme colour. */
|
|
6
|
+
export interface Color {
|
|
7
|
+
/** 8-digit ARGB hex, uppercase, no leading `#`. */
|
|
8
|
+
readonly argb?: string;
|
|
9
|
+
/** Index into the workbook theme's colour scheme. */
|
|
10
|
+
readonly theme?: number;
|
|
11
|
+
/** Tint applied to the theme colour, in `[-1, 1]`. */
|
|
12
|
+
readonly tint?: number;
|
|
13
|
+
/** Index into the legacy indexed colour palette. In a solid fill, `bgColor` is the
|
|
14
|
+
* automatic placeholder `indexed="64"`; the visible colour lives on `fgColor`. */
|
|
15
|
+
readonly indexed?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Fill pattern kinds, as OOXML's `ST_PatternType` enumerates them. `none` is the
|
|
19
|
+
* absence of a fill; `solid` paints the whole cell with the foreground colour (the
|
|
20
|
+
* common case). The remaining hatch patterns are carried for fidelity on read.
|
|
21
|
+
*/
|
|
22
|
+
export type FillPatternType = 'none' | 'solid' | 'gray125' | 'darkGray' | 'mediumGray' | 'lightGray' | 'gray0625' | 'darkHorizontal' | 'darkVertical' | 'darkDown' | 'darkUp' | 'darkGrid' | 'darkTrellis' | 'lightHorizontal' | 'lightVertical' | 'lightDown' | 'lightUp' | 'lightGrid' | 'lightTrellis';
|
|
23
|
+
/** Narrow a raw `<patternFill patternType>` token to a known {@link FillPatternType}. */
|
|
24
|
+
export declare function isFillPatternType(value: string): value is FillPatternType;
|
|
25
|
+
/**
|
|
26
|
+
* A pattern fill. For a `solid` fill the visible colour is the pattern *foreground*
|
|
27
|
+
* (`fgColor`) — OOXML's counter-intuitive rule — while `bgColor` is the automatic
|
|
28
|
+
* indexed placeholder.
|
|
29
|
+
*/
|
|
30
|
+
export interface PatternFill {
|
|
31
|
+
readonly type: 'pattern';
|
|
32
|
+
readonly pattern: FillPatternType;
|
|
33
|
+
readonly fgColor?: Color;
|
|
34
|
+
readonly bgColor?: Color;
|
|
35
|
+
}
|
|
36
|
+
/** A colour stop in a gradient, at a fractional `position` in `[0, 1]` along the gradient axis. */
|
|
37
|
+
export interface GradientStop {
|
|
38
|
+
readonly position: number;
|
|
39
|
+
readonly color: Color;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A gradient fill, as OOXML's `CT_GradientFill`. A `linear` gradient runs at `degree`
|
|
43
|
+
* degrees across the cell; a `path` gradient radiates from an inner rectangle whose
|
|
44
|
+
* insets are `left`/`right`/`top`/`bottom` (each a fraction in `[0, 1]`). The `stops`
|
|
45
|
+
* place colours along the axis; a well-formed gradient names at least two.
|
|
46
|
+
*/
|
|
47
|
+
export interface GradientFill {
|
|
48
|
+
readonly type: 'gradient';
|
|
49
|
+
readonly gradient: 'linear' | 'path';
|
|
50
|
+
/** Rotation of a `linear` gradient, in degrees. Absent (and meaningless) for `path`. */
|
|
51
|
+
readonly degree?: number;
|
|
52
|
+
/** Inner-rectangle insets of a `path` gradient, each a fraction in `[0, 1]`. */
|
|
53
|
+
readonly left?: number;
|
|
54
|
+
readonly right?: number;
|
|
55
|
+
readonly top?: number;
|
|
56
|
+
readonly bottom?: number;
|
|
57
|
+
readonly stops: readonly GradientStop[];
|
|
58
|
+
}
|
|
59
|
+
/** A cell/row background fill: a flat pattern or a colour gradient. */
|
|
60
|
+
export type Fill = PatternFill | GradientFill;
|
|
61
|
+
/**
|
|
62
|
+
* Line styles a cell border edge can take, as OOXML's `ST_BorderStyle` enumerates them.
|
|
63
|
+
* `none` is the absence of an edge and is expressed by omitting the edge, not by this value.
|
|
64
|
+
*/
|
|
65
|
+
export type BorderStyle = 'thin' | 'medium' | 'thick' | 'dashed' | 'dotted' | 'double' | 'hair' | 'mediumDashed' | 'dashDot' | 'mediumDashDot' | 'dashDotDot' | 'mediumDashDotDot' | 'slantDashDot';
|
|
66
|
+
/** Narrow a raw border-edge `style` attribute to a known {@link BorderStyle}. */
|
|
67
|
+
export declare function isBorderStyle(value: string): value is BorderStyle;
|
|
68
|
+
/** One edge of a cell border: its line style, and optionally the line colour. */
|
|
69
|
+
export interface BorderEdge {
|
|
70
|
+
readonly style: BorderStyle;
|
|
71
|
+
readonly color?: Color;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* A cell's border. Each of the four sides plus the diagonal is an independent edge; an
|
|
75
|
+
* absent edge means that side has no border (it is not rendered), so a cell bordered on
|
|
76
|
+
* one side never implies the other three. `diagonalUp`/`diagonalDown` select which way a
|
|
77
|
+
* present diagonal edge runs.
|
|
78
|
+
*/
|
|
79
|
+
export interface Border {
|
|
80
|
+
readonly left?: BorderEdge;
|
|
81
|
+
readonly right?: BorderEdge;
|
|
82
|
+
readonly top?: BorderEdge;
|
|
83
|
+
readonly bottom?: BorderEdge;
|
|
84
|
+
readonly diagonal?: BorderEdge;
|
|
85
|
+
readonly diagonalUp?: boolean;
|
|
86
|
+
readonly diagonalDown?: boolean;
|
|
87
|
+
}
|
|
88
|
+
/** Vertical alignment of a font relative to the baseline (super/subscript). */
|
|
89
|
+
export type FontVerticalAlignment = 'superscript' | 'subscript';
|
|
90
|
+
/** Narrow a raw `<vertAlign val>` token to a known {@link FontVerticalAlignment}. */
|
|
91
|
+
export declare function isFontVerticalAlignment(value: string): value is FontVerticalAlignment;
|
|
92
|
+
/** The theme-font role a `<scheme val>` names — `"minor"`/`"major"` bind the font to whichever
|
|
93
|
+
* face the workbook theme assigns that role, `"none"` leaves it a literal, unbound face. */
|
|
94
|
+
export type FontScheme = 'minor' | 'major' | 'none';
|
|
95
|
+
/** Narrow a raw `<scheme val>` token to a known {@link FontScheme}. */
|
|
96
|
+
export declare function isFontScheme(value: string): value is FontScheme;
|
|
97
|
+
/** A font, as it applies to a cell or a single rich-text run. Every facet is optional and
|
|
98
|
+
* independent, like {@link Border}/{@link Alignment}/{@link Protection} — a font sets only the
|
|
99
|
+
* facets it overrides (Excel's own default font backs the rest), so no consumer ever holds every
|
|
100
|
+
* field populated at once. */
|
|
101
|
+
export interface Font {
|
|
102
|
+
readonly name?: string;
|
|
103
|
+
readonly size?: number;
|
|
104
|
+
readonly family?: number;
|
|
105
|
+
readonly scheme?: FontScheme;
|
|
106
|
+
readonly charset?: number;
|
|
107
|
+
readonly color?: Color;
|
|
108
|
+
readonly bold?: boolean;
|
|
109
|
+
readonly italic?: boolean;
|
|
110
|
+
readonly underline?: UnderlineStyle;
|
|
111
|
+
readonly strike?: boolean;
|
|
112
|
+
readonly outline?: boolean;
|
|
113
|
+
readonly vertAlign?: FontVerticalAlignment;
|
|
114
|
+
}
|
|
115
|
+
/** How a cell's content sits horizontally within its bounds, as OOXML's `ST_HorizontalAlignment`
|
|
116
|
+
* enumerates it. `general` is the type-dependent default (text left, numbers right) and reads
|
|
117
|
+
* back as no explicit horizontal alignment. */
|
|
118
|
+
export type HorizontalAlignment = 'general' | 'left' | 'center' | 'right' | 'fill' | 'justify' | 'centerContinuous' | 'distributed';
|
|
119
|
+
/** Narrow a raw `<alignment horizontal>` token to a known {@link HorizontalAlignment}. */
|
|
120
|
+
export declare function isHorizontalAlignment(value: string): value is HorizontalAlignment;
|
|
121
|
+
/** How a cell's content sits vertically within its bounds, as OOXML's `ST_VerticalAlignment`
|
|
122
|
+
* enumerates it. */
|
|
123
|
+
export type VerticalAlignment = 'top' | 'center' | 'bottom' | 'justify' | 'distributed';
|
|
124
|
+
/** Narrow a raw `<alignment vertical>` token to a known {@link VerticalAlignment}. */
|
|
125
|
+
export declare function isVerticalAlignment(value: string): value is VerticalAlignment;
|
|
126
|
+
/**
|
|
127
|
+
* A cell's alignment. Every facet is optional and independent; an absent facet means the cell
|
|
128
|
+
* takes Excel's default for it. The boolean flags default to off — a cell that never enabled
|
|
129
|
+
* `wrapText`/`shrinkToFit` must never read back with them on. `textRotation` is in degrees
|
|
130
|
+
* (0–180, where 91–180 encodes -1° to -90°); `indent` is a non-negative indent level.
|
|
131
|
+
*/
|
|
132
|
+
export interface Alignment {
|
|
133
|
+
readonly horizontal?: HorizontalAlignment;
|
|
134
|
+
readonly vertical?: VerticalAlignment;
|
|
135
|
+
readonly textRotation?: number;
|
|
136
|
+
readonly wrapText?: boolean;
|
|
137
|
+
readonly indent?: number;
|
|
138
|
+
readonly shrinkToFit?: boolean;
|
|
139
|
+
readonly readingOrder?: number;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* A cell's protection state, enforced only when the worksheet itself is protected — the flags
|
|
143
|
+
* do nothing on an unprotected sheet. `locked` defaults to TRUE in OOXML (every cell is locked
|
|
144
|
+
* unless told otherwise), so the meaningful, information-carrying state is an explicitly
|
|
145
|
+
* *unlocked* cell (`locked: false`); marking a cell locked merely restates the default and
|
|
146
|
+
* records nothing. `hidden` (defaults false) hides the cell's formula from the formula bar of a
|
|
147
|
+
* protected sheet. A cell that never set either flag reads back with neither.
|
|
148
|
+
*/
|
|
149
|
+
export interface Protection {
|
|
150
|
+
readonly locked?: boolean;
|
|
151
|
+
readonly hidden?: boolean;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* The six direct-format facets a cell can carry — its fill, number format, font, border, alignment,
|
|
155
|
+
* and protection. Every facet is optional and independent: a cell sets only the facets it overrides
|
|
156
|
+
* and inherits the rest. This one tuple is the unit of style throughout the library, so the
|
|
157
|
+
* interfaces that carry a cell's formatting compose it rather than re-listing the fields — a column,
|
|
158
|
+
* table column, or named style whose facets *default* the cells that leave them unset (see
|
|
159
|
+
* {@link ColumnProperties}, {@link NamedCellStyle}), and a cell's own resolved format. Because they
|
|
160
|
+
* share this type, "add a facet" is a single edit here and the compiler enforces that no read/write
|
|
161
|
+
* path silently drops one — the round-trip symmetry the merge-loss contract depends on.
|
|
162
|
+
*/
|
|
163
|
+
export interface CellStyle {
|
|
164
|
+
fill?: Fill | undefined;
|
|
165
|
+
numFmt?: string | undefined;
|
|
166
|
+
font?: Font | undefined;
|
|
167
|
+
border?: Border | undefined;
|
|
168
|
+
alignment?: Alignment | undefined;
|
|
169
|
+
protection?: Protection | undefined;
|
|
170
|
+
}
|
|
171
|
+
/** The names of the {@link CellStyle} facets, for helpers that copy the tuple facet-by-facet. */
|
|
172
|
+
export declare const CELL_STYLE_FACETS: (keyof CellStyle)[];
|
|
173
|
+
/**
|
|
174
|
+
* Copy each present facet of `source` onto `target`, leaving facets `source` omits untouched — the
|
|
175
|
+
* plain-record counterpart to a cell's `applyCellStyle`, for the {@link CellStyle}-shaped targets a
|
|
176
|
+
* `Cell`'s setters don't reach (a column's cell-defaults, a named style being assembled on read).
|
|
177
|
+
* Driven by {@link CELL_STYLE_FACETS}, so a facet added to the tuple reaches these paths the moment
|
|
178
|
+
* it joins — the same single-point-of-change the cell path gets.
|
|
179
|
+
*/
|
|
180
|
+
export declare function assignStyleFacets(target: CellStyle, source: Readonly<CellStyle>): void;
|
|
181
|
+
/**
|
|
182
|
+
* A named cell style — the OOXML `cellStyleXfs`/`cellStyles` layer. A spreadsheet applies a built-in
|
|
183
|
+
* or custom style (e.g. "Normal", "Accent1") whose visual facets live in this shared, named layer
|
|
184
|
+
* rather than on each cell's direct format; a cell links to it and inherits any facet the direct
|
|
185
|
+
* format leaves unset. The facets are a cell's own (see {@link CellStyle}); `name` is the style's
|
|
186
|
+
* display name and `builtinId` its Excel gallery index when it is a built-in style.
|
|
187
|
+
*/
|
|
188
|
+
export type NamedCellStyle = Readonly<CellStyle> & {
|
|
189
|
+
readonly name?: string;
|
|
190
|
+
readonly builtinId?: number;
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* A differential style (OOXML CT_Dxf): formatting laid *over* whatever a cell already carries. Only
|
|
194
|
+
* the facets present override; the rest of the cell's own style shows through. It carries the subset
|
|
195
|
+
* of the cell-style facets (see {@link CellStyle}) a `<dxf>` can express — font, number format, fill,
|
|
196
|
+
* and border.
|
|
197
|
+
*
|
|
198
|
+
* Differential styles live in one workbook-level table (`<dxfs>`) that several features index into:
|
|
199
|
+
* a conditional-formatting rule's highlight format, and a table style's per-element formatting
|
|
200
|
+
* (`<tableStyleElement dxfId="…">`). They are interned and shared, so two features asking for the
|
|
201
|
+
* same formatting land on one entry.
|
|
202
|
+
*
|
|
203
|
+
* Not every facet reaches every consumer. As a **table style element**, Excel applies only the font,
|
|
204
|
+
* fill, and border: its own object model exposes `Font`, `Interior`, and `Borders` on a table style
|
|
205
|
+
* element and nothing for a number format, so a `numFmt` set here is carried faithfully through a
|
|
206
|
+
* round-trip but has no visible effect. The type is left whole rather than split, because the same
|
|
207
|
+
* value is legitimately reused across both consumers and narrowing it would only move the surprise.
|
|
208
|
+
*/
|
|
209
|
+
export type DifferentialStyle = Pick<CellStyle, 'font' | 'numFmt' | 'fill' | 'border'>;
|
|
210
|
+
/**
|
|
211
|
+
* The `<tableStyles>` block of a styles part: the custom table/pivot style definitions a file
|
|
212
|
+
* declares, and the two gallery names it nominates as the default for a new table and a new pivot.
|
|
213
|
+
*
|
|
214
|
+
* Each entry of {@link styles} is one `<tableStyle>…</tableStyle>` fragment kept verbatim, for the
|
|
215
|
+
* same reason a `<dxf>` is: a `tableStyleElement`'s `dxfId` indexes the differential-style table,
|
|
216
|
+
* which the writer re-emits **at its original indices**, so the references stay valid without
|
|
217
|
+
* reparsing anything. That index-stability is load-bearing — renumbering the dxf table would
|
|
218
|
+
* silently re-point every preserved table style at a different format.
|
|
219
|
+
*
|
|
220
|
+
* The two default names are ordinary strings, not fragments: they are re-escaped on write, so they
|
|
221
|
+
* are held decoded.
|
|
222
|
+
*/
|
|
223
|
+
export interface TableStyleTable {
|
|
224
|
+
readonly styles: readonly string[];
|
|
225
|
+
readonly defaultTableStyle?: string | undefined;
|
|
226
|
+
readonly defaultPivotStyle?: string | undefined;
|
|
227
|
+
/**
|
|
228
|
+
* The namespace prefixes the verbatim {@link styles} fragments use, mapped to their URI and to
|
|
229
|
+
* whether the source marked the prefix ignorable (`mc:Ignorable`).
|
|
230
|
+
*
|
|
231
|
+
* Carrying a fragment verbatim carries its *prefixes* too. Excel stamps a revision id
|
|
232
|
+
* (`xr9:uid="{…}"`) on every `<tableStyle>` it writes, so a fragment re-emitted under a
|
|
233
|
+
* `<styleSheet>` that declares only the default namespace is not namespace-well-formed — no
|
|
234
|
+
* consumer can parse the part at all, which is a far louder failure than the dropped table style
|
|
235
|
+
* this preservation exists to prevent. The writer re-declares each prefix on `<styleSheet>` and
|
|
236
|
+
* re-states the ignorable ones, exactly as the source did.
|
|
237
|
+
*/
|
|
238
|
+
readonly namespaces?: readonly TableStyleNamespace[];
|
|
239
|
+
}
|
|
240
|
+
/** One namespace declaration a preserved `<tableStyle>` fragment depends on. */
|
|
241
|
+
export interface TableStyleNamespace {
|
|
242
|
+
readonly prefix: string;
|
|
243
|
+
readonly uri: string;
|
|
244
|
+
/** Whether the source listed this prefix in the stylesheet's `mc:Ignorable`. */
|
|
245
|
+
readonly ignorable: boolean;
|
|
246
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
// Cell style primitives.
|
|
2
|
+
//
|
|
3
|
+
// Styles are a large surface in OOXML (fonts, fills, borders, alignment, number
|
|
4
|
+
// formats, protection). The rewrite grows them corpus-first; this module models the
|
|
5
|
+
// facets landed so far — colours, fills, borders, fonts, alignment, and protection.
|
|
6
|
+
const NAMED_UNDERLINE_STYLES = new Set([
|
|
7
|
+
'none',
|
|
8
|
+
'single',
|
|
9
|
+
'double',
|
|
10
|
+
'singleAccounting',
|
|
11
|
+
'doubleAccounting',
|
|
12
|
+
]);
|
|
13
|
+
/** Narrow a raw `<u val>` token to a named {@link UnderlineStyle} (the non-boolean members). */
|
|
14
|
+
export function isNamedUnderlineStyle(value) {
|
|
15
|
+
return NAMED_UNDERLINE_STYLES.has(value);
|
|
16
|
+
}
|
|
17
|
+
const FILL_PATTERN_TYPES = new Set([
|
|
18
|
+
'none',
|
|
19
|
+
'solid',
|
|
20
|
+
'gray125',
|
|
21
|
+
'darkGray',
|
|
22
|
+
'mediumGray',
|
|
23
|
+
'lightGray',
|
|
24
|
+
'gray0625',
|
|
25
|
+
'darkHorizontal',
|
|
26
|
+
'darkVertical',
|
|
27
|
+
'darkDown',
|
|
28
|
+
'darkUp',
|
|
29
|
+
'darkGrid',
|
|
30
|
+
'darkTrellis',
|
|
31
|
+
'lightHorizontal',
|
|
32
|
+
'lightVertical',
|
|
33
|
+
'lightDown',
|
|
34
|
+
'lightUp',
|
|
35
|
+
'lightGrid',
|
|
36
|
+
'lightTrellis',
|
|
37
|
+
]);
|
|
38
|
+
/** Narrow a raw `<patternFill patternType>` token to a known {@link FillPatternType}. */
|
|
39
|
+
export function isFillPatternType(value) {
|
|
40
|
+
return FILL_PATTERN_TYPES.has(value);
|
|
41
|
+
}
|
|
42
|
+
const BORDER_STYLES = new Set([
|
|
43
|
+
'thin',
|
|
44
|
+
'medium',
|
|
45
|
+
'thick',
|
|
46
|
+
'dashed',
|
|
47
|
+
'dotted',
|
|
48
|
+
'double',
|
|
49
|
+
'hair',
|
|
50
|
+
'mediumDashed',
|
|
51
|
+
'dashDot',
|
|
52
|
+
'mediumDashDot',
|
|
53
|
+
'dashDotDot',
|
|
54
|
+
'mediumDashDotDot',
|
|
55
|
+
'slantDashDot',
|
|
56
|
+
]);
|
|
57
|
+
/** Narrow a raw border-edge `style` attribute to a known {@link BorderStyle}. */
|
|
58
|
+
export function isBorderStyle(value) {
|
|
59
|
+
return BORDER_STYLES.has(value);
|
|
60
|
+
}
|
|
61
|
+
/** Narrow a raw `<vertAlign val>` token to a known {@link FontVerticalAlignment}. */
|
|
62
|
+
export function isFontVerticalAlignment(value) {
|
|
63
|
+
return value === 'superscript' || value === 'subscript';
|
|
64
|
+
}
|
|
65
|
+
/** Narrow a raw `<scheme val>` token to a known {@link FontScheme}. */
|
|
66
|
+
export function isFontScheme(value) {
|
|
67
|
+
return value === 'minor' || value === 'major' || value === 'none';
|
|
68
|
+
}
|
|
69
|
+
const HORIZONTAL_ALIGNMENTS = new Set([
|
|
70
|
+
'general',
|
|
71
|
+
'left',
|
|
72
|
+
'center',
|
|
73
|
+
'right',
|
|
74
|
+
'fill',
|
|
75
|
+
'justify',
|
|
76
|
+
'centerContinuous',
|
|
77
|
+
'distributed',
|
|
78
|
+
]);
|
|
79
|
+
/** Narrow a raw `<alignment horizontal>` token to a known {@link HorizontalAlignment}. */
|
|
80
|
+
export function isHorizontalAlignment(value) {
|
|
81
|
+
return HORIZONTAL_ALIGNMENTS.has(value);
|
|
82
|
+
}
|
|
83
|
+
const VERTICAL_ALIGNMENTS = new Set([
|
|
84
|
+
'top',
|
|
85
|
+
'center',
|
|
86
|
+
'bottom',
|
|
87
|
+
'justify',
|
|
88
|
+
'distributed',
|
|
89
|
+
]);
|
|
90
|
+
/** Narrow a raw `<alignment vertical>` token to a known {@link VerticalAlignment}. */
|
|
91
|
+
export function isVerticalAlignment(value) {
|
|
92
|
+
return VERTICAL_ALIGNMENTS.has(value);
|
|
93
|
+
}
|
|
94
|
+
// One entry per facet, as a Record rather than a bare list so the compiler rejects it the moment a
|
|
95
|
+
// facet is added to CellStyle and forgotten here — which would otherwise let the facet-list-driven
|
|
96
|
+
// copies below (assignStyleFacets) silently skip the new facet, a merge-loss.
|
|
97
|
+
const CELL_STYLE_FACET_KEYS = {
|
|
98
|
+
fill: true,
|
|
99
|
+
numFmt: true,
|
|
100
|
+
font: true,
|
|
101
|
+
border: true,
|
|
102
|
+
alignment: true,
|
|
103
|
+
protection: true,
|
|
104
|
+
};
|
|
105
|
+
/** The names of the {@link CellStyle} facets, for helpers that copy the tuple facet-by-facet. */
|
|
106
|
+
export const CELL_STYLE_FACETS = Object.keys(CELL_STYLE_FACET_KEYS);
|
|
107
|
+
/**
|
|
108
|
+
* Copy each present facet of `source` onto `target`, leaving facets `source` omits untouched — the
|
|
109
|
+
* plain-record counterpart to a cell's `applyCellStyle`, for the {@link CellStyle}-shaped targets a
|
|
110
|
+
* `Cell`'s setters don't reach (a column's cell-defaults, a named style being assembled on read).
|
|
111
|
+
* Driven by {@link CELL_STYLE_FACETS}, so a facet added to the tuple reaches these paths the moment
|
|
112
|
+
* it joins — the same single-point-of-change the cell path gets.
|
|
113
|
+
*/
|
|
114
|
+
export function assignStyleFacets(target, source) {
|
|
115
|
+
for (const facet of CELL_STYLE_FACETS)
|
|
116
|
+
copyFacet(target, source, facet);
|
|
117
|
+
}
|
|
118
|
+
// A single facet key at a time, so the write's key type is one member (not the whole union) and
|
|
119
|
+
// `target[key] = source[key]` typechecks without a cast — the correlated-key access TS can't verify
|
|
120
|
+
// when the key is a union.
|
|
121
|
+
function copyFacet(target, source, key) {
|
|
122
|
+
const value = source[key];
|
|
123
|
+
if (value !== undefined)
|
|
124
|
+
target[key] = value;
|
|
125
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { DifferentialStyle } from './style.ts';
|
|
2
|
+
/**
|
|
3
|
+
* The regions a table style can format (`ST_TableStyleType`).
|
|
4
|
+
*
|
|
5
|
+
* The first thirteen apply to a **table**; the rest style a **pivot table**, which has regions a
|
|
6
|
+
* table does not have (subtotal rows, page-field labels, subheadings). Both live in the same
|
|
7
|
+
* enumeration and the same `<tableStyle>` element — what decides which regions a consumer honours is
|
|
8
|
+
* the style's own `table`/`pivot` flags, not the element names — so the type carries all of them
|
|
9
|
+
* rather than splitting into two enumerations that a caller would have to choose between up front.
|
|
10
|
+
*/
|
|
11
|
+
export declare const TABLE_STYLE_ELEMENT_TYPES: readonly ["wholeTable", "headerRow", "totalRow", "firstColumn", "lastColumn", "firstRowStripe", "secondRowStripe", "firstColumnStripe", "secondColumnStripe", "firstHeaderCell", "lastHeaderCell", "firstTotalCell", "lastTotalCell", "firstSubtotalColumn", "secondSubtotalColumn", "thirdSubtotalColumn", "firstSubtotalRow", "secondSubtotalRow", "thirdSubtotalRow", "blankRow", "firstColumnSubheading", "secondColumnSubheading", "thirdColumnSubheading", "firstRowSubheading", "secondRowSubheading", "thirdRowSubheading", "pageFieldLabels", "pageFieldValues"];
|
|
12
|
+
/** One region of a table or pivot that a table style can format. */
|
|
13
|
+
export type TableStyleElementType = (typeof TABLE_STYLE_ELEMENT_TYPES)[number];
|
|
14
|
+
/** The four element types banded across several rows or columns — the only ones {@link TableStyleElement.size} means anything on. */
|
|
15
|
+
export declare const STRIPE_ELEMENT_TYPES: ReadonlySet<TableStyleElementType>;
|
|
16
|
+
export declare function isTableStyleElementType(value: string): value is TableStyleElementType;
|
|
17
|
+
/**
|
|
18
|
+
* How one region of a table is formatted: a {@link DifferentialStyle} laid over whatever the cells
|
|
19
|
+
* already carry, plus — for a stripe — how many rows or columns wide one band is.
|
|
20
|
+
*
|
|
21
|
+
* A `numFmt` here is carried faithfully but has no visible effect: Excel's own table-style element
|
|
22
|
+
* exposes a font, an interior and borders, and nothing for a number format. See
|
|
23
|
+
* {@link DifferentialStyle}.
|
|
24
|
+
*/
|
|
25
|
+
export interface TableStyleElement extends DifferentialStyle {
|
|
26
|
+
/**
|
|
27
|
+
* The band width, in rows or columns, for a striped element — `2` makes each band two rows deep.
|
|
28
|
+
* Defaults to 1.
|
|
29
|
+
*
|
|
30
|
+
* Meaningful **only** on the four stripe types ({@link STRIPE_ELEMENT_TYPES}); ECMA-376 says so and
|
|
31
|
+
* Excel ignores it elsewhere. Setting it on any other element is rejected rather than silently
|
|
32
|
+
* dropped: a caller who wrote it meant something by it, and a value that vanishes into a file that
|
|
33
|
+
* still opens cleanly is the kind of bug nobody finds.
|
|
34
|
+
*/
|
|
35
|
+
readonly size?: number | undefined;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A custom table style, ready to be registered on a workbook and named by a table's
|
|
39
|
+
* {@link TableStyleInfo.name}.
|
|
40
|
+
*
|
|
41
|
+
* Elements are applied in the order ECMA-376 fixes, not the order they are written here: whole table,
|
|
42
|
+
* then the column stripes, then the row stripes, then last/first column, header row, total row, and
|
|
43
|
+
* the four corner cells. So a row stripe wins over a column stripe, and both win over the whole-table
|
|
44
|
+
* formatting — worth knowing when a stripe colour appears not to take.
|
|
45
|
+
*/
|
|
46
|
+
export interface TableStyle {
|
|
47
|
+
/** The name a table references, and the name Excel shows in its style gallery. */
|
|
48
|
+
readonly name: string;
|
|
49
|
+
/** The regions this style formats. An element left out is not styled by it. */
|
|
50
|
+
readonly elements: Readonly<Partial<Record<TableStyleElementType, TableStyleElement>>>;
|
|
51
|
+
/** Whether the style is offered for tables. Defaults to true. */
|
|
52
|
+
readonly table?: boolean | undefined;
|
|
53
|
+
/** Whether the style is offered for pivot tables. Defaults to true. */
|
|
54
|
+
readonly pivot?: boolean | undefined;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Reject a table style the writer would otherwise emit as valid-but-inert XML.
|
|
58
|
+
*
|
|
59
|
+
* Both failures here are of the same kind: Excel accepts the file and quietly does nothing with the
|
|
60
|
+
* part the caller cared about. An empty name means no table can ever reference the style, and a
|
|
61
|
+
* `size` outside a stripe is ignored — neither shows up as a repair prompt or a schema error, so the
|
|
62
|
+
* only place to catch them is the call that made them.
|
|
63
|
+
*
|
|
64
|
+
* @throws {@link AuthoringError} if the name is empty, or a non-stripe element carries a `size`, or a `size` is not
|
|
65
|
+
* a positive integer.
|
|
66
|
+
*/
|
|
67
|
+
export declare function checkTableStyle(style: TableStyle): void;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// A custom table style: the named, reusable look a table (or a pivot) applies to itself by name.
|
|
2
|
+
//
|
|
3
|
+
// A table style is a list of *elements*, each naming one region of the table — the whole table, the
|
|
4
|
+
// header row, the first row stripe — and the differential formatting to lay over it. Excel's built-in
|
|
5
|
+
// gallery ("TableStyleMedium2" and its sixty siblings) is exactly this shape; a workbook that declares
|
|
6
|
+
// its own joins the gallery for that file, and a table reaches it by name through
|
|
7
|
+
// `TableStyleInfo.name`.
|
|
8
|
+
import { AuthoringError } from "../errors.js";
|
|
9
|
+
/**
|
|
10
|
+
* The regions a table style can format (`ST_TableStyleType`).
|
|
11
|
+
*
|
|
12
|
+
* The first thirteen apply to a **table**; the rest style a **pivot table**, which has regions a
|
|
13
|
+
* table does not have (subtotal rows, page-field labels, subheadings). Both live in the same
|
|
14
|
+
* enumeration and the same `<tableStyle>` element — what decides which regions a consumer honours is
|
|
15
|
+
* the style's own `table`/`pivot` flags, not the element names — so the type carries all of them
|
|
16
|
+
* rather than splitting into two enumerations that a caller would have to choose between up front.
|
|
17
|
+
*/
|
|
18
|
+
export const TABLE_STYLE_ELEMENT_TYPES = [
|
|
19
|
+
'wholeTable',
|
|
20
|
+
'headerRow',
|
|
21
|
+
'totalRow',
|
|
22
|
+
'firstColumn',
|
|
23
|
+
'lastColumn',
|
|
24
|
+
'firstRowStripe',
|
|
25
|
+
'secondRowStripe',
|
|
26
|
+
'firstColumnStripe',
|
|
27
|
+
'secondColumnStripe',
|
|
28
|
+
'firstHeaderCell',
|
|
29
|
+
'lastHeaderCell',
|
|
30
|
+
'firstTotalCell',
|
|
31
|
+
'lastTotalCell',
|
|
32
|
+
'firstSubtotalColumn',
|
|
33
|
+
'secondSubtotalColumn',
|
|
34
|
+
'thirdSubtotalColumn',
|
|
35
|
+
'firstSubtotalRow',
|
|
36
|
+
'secondSubtotalRow',
|
|
37
|
+
'thirdSubtotalRow',
|
|
38
|
+
'blankRow',
|
|
39
|
+
'firstColumnSubheading',
|
|
40
|
+
'secondColumnSubheading',
|
|
41
|
+
'thirdColumnSubheading',
|
|
42
|
+
'firstRowSubheading',
|
|
43
|
+
'secondRowSubheading',
|
|
44
|
+
'thirdRowSubheading',
|
|
45
|
+
'pageFieldLabels',
|
|
46
|
+
'pageFieldValues',
|
|
47
|
+
];
|
|
48
|
+
/** The four element types banded across several rows or columns — the only ones {@link TableStyleElement.size} means anything on. */
|
|
49
|
+
export const STRIPE_ELEMENT_TYPES = new Set([
|
|
50
|
+
'firstRowStripe',
|
|
51
|
+
'secondRowStripe',
|
|
52
|
+
'firstColumnStripe',
|
|
53
|
+
'secondColumnStripe',
|
|
54
|
+
]);
|
|
55
|
+
export function isTableStyleElementType(value) {
|
|
56
|
+
return TABLE_STYLE_ELEMENT_TYPES.includes(value);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Reject a table style the writer would otherwise emit as valid-but-inert XML.
|
|
60
|
+
*
|
|
61
|
+
* Both failures here are of the same kind: Excel accepts the file and quietly does nothing with the
|
|
62
|
+
* part the caller cared about. An empty name means no table can ever reference the style, and a
|
|
63
|
+
* `size` outside a stripe is ignored — neither shows up as a repair prompt or a schema error, so the
|
|
64
|
+
* only place to catch them is the call that made them.
|
|
65
|
+
*
|
|
66
|
+
* @throws {@link AuthoringError} if the name is empty, or a non-stripe element carries a `size`, or a `size` is not
|
|
67
|
+
* a positive integer.
|
|
68
|
+
*/
|
|
69
|
+
export function checkTableStyle(style) {
|
|
70
|
+
if (style.name === '') {
|
|
71
|
+
throw new AuthoringError('a table style needs a name: a table references its style by name');
|
|
72
|
+
}
|
|
73
|
+
for (const [type, element] of Object.entries(style.elements)) {
|
|
74
|
+
if (element === undefined)
|
|
75
|
+
continue;
|
|
76
|
+
if (!isTableStyleElementType(type)) {
|
|
77
|
+
throw new AuthoringError(`Invalid table style element ${JSON.stringify(type)}: not a value the OOXML enumeration allows`);
|
|
78
|
+
}
|
|
79
|
+
const { size } = element;
|
|
80
|
+
if (size === undefined)
|
|
81
|
+
continue;
|
|
82
|
+
if (!STRIPE_ELEMENT_TYPES.has(type)) {
|
|
83
|
+
throw new AuthoringError(`table style element "${type}" cannot carry a size: band width applies only to ` +
|
|
84
|
+
`${[...STRIPE_ELEMENT_TYPES].join(', ')}`);
|
|
85
|
+
}
|
|
86
|
+
if (!Number.isInteger(size) || size < 1) {
|
|
87
|
+
throw new AuthoringError(`Invalid table style band size ${size}: expected a positive integer`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|