@shbernal/ts-xlsx 2.1.0 → 3.1.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 (225) hide show
  1. package/README.md +4 -1
  2. package/dist/bytes.d.ts +7 -0
  3. package/dist/bytes.js +22 -0
  4. package/dist/core/address.d.ts +60 -2
  5. package/dist/core/address.js +40 -24
  6. package/dist/core/autofilter.d.ts +5 -4
  7. package/dist/core/autofilter.js +34 -35
  8. package/dist/core/axis-handle.d.ts +10 -0
  9. package/dist/core/axis-handle.js +17 -0
  10. package/dist/core/cell.d.ts +25 -0
  11. package/dist/core/cell.js +9 -3
  12. package/dist/core/clone.d.ts +29 -0
  13. package/dist/core/clone.js +24 -0
  14. package/dist/core/color-resolution.js +2 -4
  15. package/dist/core/column.d.ts +5 -1
  16. package/dist/core/column.js +34 -35
  17. package/dist/core/comment-thread.js +2 -1
  18. package/dist/core/conditional-formatting-overlay.d.ts +2 -1
  19. package/dist/core/conditional-formatting-overlay.js +2 -2
  20. package/dist/core/conditional-formatting.d.ts +14 -6
  21. package/dist/core/conditional-formatting.js +45 -43
  22. package/dist/core/containers.d.ts +12 -0
  23. package/dist/core/containers.js +5 -0
  24. package/dist/core/data-validation-overlay.d.ts +2 -1
  25. package/dist/core/data-validation-overlay.js +4 -4
  26. package/dist/core/data-validation.d.ts +9 -3
  27. package/dist/core/data-validation.js +21 -18
  28. package/dist/core/date-format.d.ts +20 -0
  29. package/dist/core/date-format.js +160 -0
  30. package/dist/core/date.d.ts +43 -8
  31. package/dist/core/date.js +18 -2
  32. package/dist/core/formula.d.ts +26 -0
  33. package/dist/core/formula.js +20 -4
  34. package/dist/core/grid-edits.d.ts +2 -3
  35. package/dist/core/grid-edits.js +69 -70
  36. package/dist/core/grid-shift.d.ts +58 -9
  37. package/dist/core/grid-shift.js +26 -4
  38. package/dist/core/image.d.ts +14 -10
  39. package/dist/core/image.js +9 -9
  40. package/dist/core/internal.d.ts +8 -2
  41. package/dist/core/limits.d.ts +23 -0
  42. package/dist/core/limits.js +4 -0
  43. package/dist/core/merge-index.d.ts +31 -0
  44. package/dist/core/merge-index.js +60 -0
  45. package/dist/core/merge.d.ts +5 -14
  46. package/dist/core/merge.js +18 -27
  47. package/dist/core/page-setup.d.ts +72 -2
  48. package/dist/core/page-setup.js +34 -8
  49. package/dist/core/pivot-table.d.ts +1 -1
  50. package/dist/core/pivot-table.js +67 -53
  51. package/dist/core/protection.js +2 -11
  52. package/dist/core/range.js +34 -30
  53. package/dist/core/row-input.js +2 -2
  54. package/dist/core/row.d.ts +5 -1
  55. package/dist/core/row.js +22 -23
  56. package/dist/core/style.d.ts +134 -75
  57. package/dist/core/style.js +112 -53
  58. package/dist/core/table-style.d.ts +1 -1
  59. package/dist/core/table-style.js +4 -4
  60. package/dist/core/table.d.ts +28 -10
  61. package/dist/core/table.js +54 -39
  62. package/dist/core/theme.js +6 -5
  63. package/dist/core/used-extent.d.ts +44 -0
  64. package/dist/core/used-extent.js +102 -0
  65. package/dist/core/value.d.ts +9 -0
  66. package/dist/core/value.js +36 -34
  67. package/dist/core/workbook-media.d.ts +34 -0
  68. package/dist/core/workbook-media.js +44 -0
  69. package/dist/core/workbook-styles.d.ts +67 -1
  70. package/dist/core/workbook-vba.js +3 -2
  71. package/dist/core/workbook.d.ts +23 -2
  72. package/dist/core/workbook.js +24 -40
  73. package/dist/core/worksheet-comments.d.ts +2 -1
  74. package/dist/core/worksheet-comments.js +20 -13
  75. package/dist/core/worksheet-merges.d.ts +44 -0
  76. package/dist/core/worksheet-merges.js +59 -0
  77. package/dist/core/worksheet-model.d.ts +9 -1
  78. package/dist/core/worksheet-model.js +24 -9
  79. package/dist/core/worksheet.d.ts +72 -12
  80. package/dist/core/worksheet.js +68 -70
  81. package/dist/customui/ribbon.js +6 -7
  82. package/dist/entries/core.d.ts +18 -13
  83. package/dist/entries/core.js +12 -6
  84. package/dist/entries/xlsx.d.ts +1 -1
  85. package/dist/errors.d.ts +64 -0
  86. package/dist/errors.js +22 -0
  87. package/dist/hex.d.ts +8 -0
  88. package/dist/hex.js +3 -0
  89. package/dist/io/csv/delimiter.d.ts +9 -0
  90. package/dist/io/csv/delimiter.js +6 -0
  91. package/dist/io/csv/read.js +11 -4
  92. package/dist/io/csv/write.d.ts +9 -2
  93. package/dist/io/csv/write.js +9 -38
  94. package/dist/io/opc/inflate.js +15 -1
  95. package/dist/io/opc/namespaces.d.ts +16 -0
  96. package/dist/io/opc/namespaces.js +4 -0
  97. package/dist/io/opc/part-paths.d.ts +10 -0
  98. package/dist/io/opc/part-paths.js +16 -1
  99. package/dist/io/opc/read-opc.d.ts +69 -10
  100. package/dist/io/opc/read-opc.js +49 -55
  101. package/dist/io/opc/read-options.d.ts +5 -1
  102. package/dist/io/opc/rels.d.ts +1 -6
  103. package/dist/io/opc/rels.js +1 -4
  104. package/dist/io/opc/sniff-format.d.ts +3 -3
  105. package/dist/io/opc/sniff-format.js +2 -2
  106. package/dist/io/style/xf-style.d.ts +48 -2
  107. package/dist/io/style/xf-style.js +14 -0
  108. package/dist/io/xlsb/formula.d.ts +2 -2
  109. package/dist/io/xlsb/formula.js +49 -34
  110. package/dist/io/xlsb/primitives.js +8 -14
  111. package/dist/io/xlsb/ptg-functions.d.ts +19 -10
  112. package/dist/io/xlsb/ptg-functions.js +385 -596
  113. package/dist/io/xlsb/read-styles.js +50 -83
  114. package/dist/io/xlsb/read-worksheet.d.ts +20 -1
  115. package/dist/io/xlsb/read-worksheet.js +73 -89
  116. package/dist/io/xlsb/read.d.ts +6 -3
  117. package/dist/io/xlsb/read.js +47 -29
  118. package/dist/io/xlsb/record-stream.d.ts +30 -0
  119. package/dist/io/xlsb/record-stream.js +20 -0
  120. package/dist/io/xlsb/record-types.d.ts +1 -5
  121. package/dist/io/xlsb/record-types.js +1 -5
  122. package/dist/io/xlsx/cell-accumulator.d.ts +9 -2
  123. package/dist/io/xlsx/cell-accumulator.js +32 -9
  124. package/dist/io/xlsx/cell-style-resolution.d.ts +25 -0
  125. package/dist/io/xlsx/cell-style-resolution.js +29 -0
  126. package/dist/io/xlsx/cell-value.d.ts +5 -3
  127. package/dist/io/xlsx/cell-value.js +13 -15
  128. package/dist/io/xlsx/color-xml.js +3 -2
  129. package/dist/io/xlsx/column-budget.d.ts +26 -0
  130. package/dist/io/xlsx/column-budget.js +22 -0
  131. package/dist/io/xlsx/comments.d.ts +6 -2
  132. package/dist/io/xlsx/comments.js +36 -31
  133. package/dist/io/xlsx/conditional-formatting.d.ts +9 -5
  134. package/dist/io/xlsx/conditional-formatting.js +51 -46
  135. package/dist/io/xlsx/data-validation.d.ts +9 -7
  136. package/dist/io/xlsx/data-validation.js +38 -35
  137. package/dist/io/xlsx/edit-vba.d.ts +7 -2
  138. package/dist/io/xlsx/edit-vba.js +15 -29
  139. package/dist/io/xlsx/font-xml.d.ts +7 -0
  140. package/dist/io/xlsx/font-xml.js +104 -0
  141. package/dist/io/xlsx/hyperlinks.d.ts +41 -7
  142. package/dist/io/xlsx/hyperlinks.js +40 -28
  143. package/dist/io/xlsx/images.js +24 -25
  144. package/dist/io/xlsx/namespaces.d.ts +16 -0
  145. package/dist/io/xlsx/namespaces.js +7 -0
  146. package/dist/io/xlsx/package-plan.d.ts +23 -3
  147. package/dist/io/xlsx/package-plan.js +66 -25
  148. package/dist/io/xlsx/part-names.d.ts +41 -0
  149. package/dist/io/xlsx/part-names.js +46 -0
  150. package/dist/io/xlsx/pivot.js +8 -7
  151. package/dist/io/xlsx/read-parts.d.ts +59 -0
  152. package/dist/io/xlsx/read-parts.js +252 -0
  153. package/dist/io/xlsx/read-pivot.js +3 -1
  154. package/dist/io/xlsx/read-repair.d.ts +26 -0
  155. package/dist/io/xlsx/read-repair.js +39 -0
  156. package/dist/io/xlsx/{rich-runs.d.ts → read-rich-runs.d.ts} +1 -1
  157. package/dist/io/xlsx/{rich-runs.js → read-rich-runs.js} +7 -3
  158. package/dist/io/xlsx/read-rows.d.ts +18 -5
  159. package/dist/io/xlsx/read-rows.js +50 -37
  160. package/dist/io/xlsx/read-shared-strings.js +5 -3
  161. package/dist/io/xlsx/read-styles.d.ts +1 -6
  162. package/dist/io/xlsx/read-styles.js +65 -109
  163. package/dist/io/xlsx/read-workbook-xml.d.ts +36 -0
  164. package/dist/io/xlsx/read-workbook-xml.js +170 -0
  165. package/dist/io/xlsx/read-worksheet.d.ts +11 -1
  166. package/dist/io/xlsx/read-worksheet.js +51 -193
  167. package/dist/io/xlsx/read.d.ts +5 -13
  168. package/dist/io/xlsx/read.js +111 -436
  169. package/dist/io/xlsx/rich-text.js +1 -1
  170. package/dist/io/xlsx/row-position.d.ts +18 -0
  171. package/dist/io/xlsx/row-position.js +11 -0
  172. package/dist/io/xlsx/row-xml.d.ts +128 -0
  173. package/dist/io/xlsx/row-xml.js +203 -0
  174. package/dist/io/xlsx/shared-formulas.js +2 -2
  175. package/dist/io/xlsx/sheet-properties.d.ts +10 -1
  176. package/dist/io/xlsx/sheet-properties.js +166 -37
  177. package/dist/io/xlsx/style-elements.d.ts +43 -0
  178. package/dist/io/xlsx/style-elements.js +156 -0
  179. package/dist/io/xlsx/styles.d.ts +12 -3
  180. package/dist/io/xlsx/styles.js +5 -204
  181. package/dist/io/xlsx/tables.js +11 -14
  182. package/dist/io/xlsx/theme-xml.d.ts +26 -4
  183. package/dist/io/xlsx/theme-xml.js +107 -69
  184. package/dist/io/xlsx/threaded-comments.d.ts +8 -10
  185. package/dist/io/xlsx/threaded-comments.js +3 -1
  186. package/dist/io/xlsx/workbook-xml.d.ts +54 -4
  187. package/dist/io/xlsx/workbook-xml.js +84 -57
  188. package/dist/io/xlsx/worksheet-xml.d.ts +23 -70
  189. package/dist/io/xlsx/worksheet-xml.js +59 -242
  190. package/dist/io/xlsx/write-stream.d.ts +71 -16
  191. package/dist/io/xlsx/write-stream.js +79 -41
  192. package/dist/io/xlsx/write.d.ts +6 -2
  193. package/dist/io/xlsx/write.js +217 -153
  194. package/dist/rel-type.d.ts +16 -0
  195. package/dist/rel-type.js +6 -0
  196. package/dist/token-set.d.ts +28 -0
  197. package/dist/token-set.js +7 -0
  198. package/dist/vba/bytes.d.ts +14 -5
  199. package/dist/vba/bytes.js +16 -6
  200. package/dist/vba/cfb-format.d.ts +32 -0
  201. package/dist/vba/cfb-format.js +13 -0
  202. package/dist/vba/cfb-writer.d.ts +9 -0
  203. package/dist/vba/cfb-writer.js +28 -25
  204. package/dist/vba/cfb.d.ts +13 -1
  205. package/dist/vba/cfb.js +73 -57
  206. package/dist/vba/codepage.js +2 -1
  207. package/dist/vba/errors.d.ts +7 -0
  208. package/dist/vba/ms-ovba.js +79 -23
  209. package/dist/vba/project-editor.js +35 -40
  210. package/dist/vba/project.d.ts +11 -1
  211. package/dist/vba/project.js +40 -21
  212. package/dist/vba/vba-encoding.js +5 -6
  213. package/dist/xml/xml-attrs.d.ts +37 -0
  214. package/dist/xml/xml-attrs.js +30 -0
  215. package/dist/xml/xml-chars.d.ts +40 -0
  216. package/dist/xml/xml-chars.js +12 -0
  217. package/dist/xml/xml-namespaces.d.ts +31 -0
  218. package/dist/xml/xml-namespaces.js +50 -0
  219. package/dist/xml/xml-read.d.ts +128 -81
  220. package/dist/xml/xml-read.js +161 -178
  221. package/dist/xml/xml-scan.d.ts +78 -0
  222. package/dist/xml/xml-scan.js +180 -0
  223. package/dist/xml/xml.d.ts +29 -28
  224. package/dist/xml/xml.js +24 -24
  225. package/package.json +13 -9
@@ -1,7 +1,9 @@
1
+ import { type ClonePlan } from './clone.ts';
2
+ import { type AssertNever, NAMED_STYLE_ID } from './internal.ts';
1
3
  /** Underline can be a plain flag or one of Excel's named underline styles. */
2
4
  export type UnderlineStyle = boolean | 'none' | 'single' | 'double' | 'singleAccounting' | 'doubleAccounting';
3
5
  /** 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>;
6
+ export declare const isNamedUnderlineStyle: (value: string) => value is "double" | "doubleAccounting" | "none" | "single" | "singleAccounting";
5
7
  /** A colour, expressed as an ARGB hex string (`"FF0000FF"`) or an indexed theme colour. */
6
8
  export interface Color {
7
9
  /** 8-digit ARGB hex, uppercase, no leading `#`. */
@@ -35,13 +37,37 @@ export interface Color {
35
37
  */
36
38
  export declare function parseArgb(value: string): string | undefined;
37
39
  /**
38
- * Fill pattern kinds, as OOXML's `ST_PatternType` enumerates them. `none` is the
40
+ * Fill pattern kinds, in the order OOXML's `ST_PatternType` enumerates them. `none` is the
39
41
  * absence of a fill; `solid` paints the whole cell with the foreground colour (the
40
42
  * common case). The remaining hatch patterns are carried for fidelity on read.
43
+ *
44
+ * The order is load-bearing rather than cosmetic, which is why it is stated twice over -- here, and
45
+ * in {@link FILL_PATTERNS_IN_SCHEMA_ORDER}, tied together by a proof. BIFF12 stores a pattern as its
46
+ * *index* into this enumeration, so the binary codec needs the sequence as a value; the doc above
47
+ * this type used to claim schema order while the union put `gray125` and `gray0625` at positions 2
48
+ * and 6, where the schema puts them last, and the binary codec carried a third copy that was right.
49
+ */
50
+ export type FillPatternType = 'none' | 'solid' | 'mediumGray' | 'darkGray' | 'lightGray' | 'darkHorizontal' | 'darkVertical' | 'darkDown' | 'darkUp' | 'darkGrid' | 'darkTrellis' | 'lightHorizontal' | 'lightVertical' | 'lightDown' | 'lightUp' | 'lightGrid' | 'lightTrellis' | 'gray125' | 'gray0625';
51
+ /**
52
+ * Every {@link FillPatternType}, in `ST_PatternType` order, which is also the order BIFF12's `fls`
53
+ * field indexes: `fls` 1 is `solid`, 2 is `mediumGray`, and so on. Index 0 is `none`, which the
54
+ * model spells as no fill at all rather than as a pattern.
55
+ *
56
+ * One list, consulted by the guard below and by `io/xlsb/read-styles.ts`. It replaced three
57
+ * hand-maintained copies of one enumeration -- the union, the guard's own table, and the binary
58
+ * codec's index array -- of which only the first two were checked against each other, so adding a
59
+ * pattern forced the guard to be updated and let the binary codec silently drop it.
60
+ */
61
+ export declare const FILL_PATTERNS_IN_SCHEMA_ORDER: readonly ["none", "solid", "mediumGray", "darkGray", "lightGray", "darkHorizontal", "darkVertical", "darkDown", "darkUp", "darkGrid", "darkTrellis", "lightHorizontal", "lightVertical", "lightDown", "lightUp", "lightGrid", "lightTrellis", "gray125", "gray0625"];
62
+ /**
63
+ * The two halves of the proof {@link FILL_PATTERNS_IN_SCHEMA_ORDER} owes, since a list -- unlike the
64
+ * `Record` shape every other token guard here is built from -- can name fewer members than its union
65
+ * without the compiler minding. `satisfies` above covers "no invented name"; this covers "no
66
+ * omission".
41
67
  */
42
- export type FillPatternType = 'none' | 'solid' | 'gray125' | 'darkGray' | 'mediumGray' | 'lightGray' | 'gray0625' | 'darkHorizontal' | 'darkVertical' | 'darkDown' | 'darkUp' | 'darkGrid' | 'darkTrellis' | 'lightHorizontal' | 'lightVertical' | 'lightDown' | 'lightUp' | 'lightGrid' | 'lightTrellis';
68
+ export type EveryFillPatternIsOrdered = AssertNever<Exclude<FillPatternType, (typeof FILL_PATTERNS_IN_SCHEMA_ORDER)[number]>>;
43
69
  /** Narrow a raw `<patternFill patternType>` token to a known {@link FillPatternType}. */
44
- export declare function isFillPatternType(value: string): value is FillPatternType;
70
+ export declare const isFillPatternType: (value: string) => value is FillPatternType;
45
71
  /**
46
72
  * A pattern fill. For a `solid` fill the visible colour is the pattern *foreground*
47
73
  * (`fgColor`), OOXML's counter-intuitive rule, while `bgColor` is the automatic
@@ -78,13 +104,25 @@ export interface GradientFill {
78
104
  }
79
105
  /** A cell/row background fill: a flat pattern or a colour gradient. */
80
106
  export type Fill = PatternFill | GradientFill;
107
+ declare const GRADIENT_STOP_CLONE: ClonePlan<GradientStop>;
108
+ /** The proof that {@link GRADIENT_STOP_CLONE} names every field of a gradient stop. */
109
+ export type EveryGradientStopFieldIsCloned = AssertNever<Exclude<keyof Required<GradientStop>, keyof typeof GRADIENT_STOP_CLONE>>;
110
+ declare const PATTERN_FILL_CLONE: ClonePlan<PatternFill>;
111
+ /** The proof that {@link PATTERN_FILL_CLONE} names every field of a pattern fill. */
112
+ export type EveryPatternFillFieldIsCloned = AssertNever<Exclude<keyof Required<PatternFill>, keyof typeof PATTERN_FILL_CLONE>>;
113
+ declare const GRADIENT_FILL_CLONE: ClonePlan<GradientFill>;
114
+ /** The proof that {@link GRADIENT_FILL_CLONE} names every field of a gradient fill. */
115
+ export type EveryGradientFillFieldIsCloned = AssertNever<Exclude<keyof Required<GradientFill>, keyof typeof GRADIENT_FILL_CLONE>>;
116
+ /** A defensive deep copy of a fill, whichever of the two shapes it is. The union is dispatched on
117
+ * `type` because the two halves share no field beyond it, so one plan could not describe both. */
118
+ export declare function cloneFill(fill: Fill): Fill;
81
119
  /**
82
120
  * Line styles a cell border edge can take, as OOXML's `ST_BorderStyle` enumerates them.
83
121
  * `none` is the absence of an edge and is expressed by omitting the edge, not by this value.
84
122
  */
85
123
  export type BorderStyle = 'thin' | 'medium' | 'thick' | 'dashed' | 'dotted' | 'double' | 'hair' | 'mediumDashed' | 'dashDot' | 'mediumDashDot' | 'dashDotDot' | 'mediumDashDotDot' | 'slantDashDot';
86
124
  /** Narrow a raw border-edge `style` attribute to a known {@link BorderStyle}. */
87
- export declare function isBorderStyle(value: string): value is BorderStyle;
125
+ export declare const isBorderStyle: (value: string) => value is BorderStyle;
88
126
  /** One edge of a cell border: its line style, and optionally the line colour. */
89
127
  export interface BorderEdge {
90
128
  readonly style: BorderStyle;
@@ -105,15 +143,23 @@ export interface Border {
105
143
  readonly diagonalUp?: boolean;
106
144
  readonly diagonalDown?: boolean;
107
145
  }
146
+ declare const BORDER_EDGE_CLONE: ClonePlan<BorderEdge>;
147
+ /** The proof that {@link BORDER_EDGE_CLONE} names every field of a border edge. */
148
+ export type EveryBorderEdgeFieldIsCloned = AssertNever<Exclude<keyof Required<BorderEdge>, keyof typeof BORDER_EDGE_CLONE>>;
149
+ declare const BORDER_CLONE: ClonePlan<Border>;
150
+ /** The proof that {@link BORDER_CLONE} names every side of a border. */
151
+ export type EveryBorderFieldIsCloned = AssertNever<Exclude<keyof Required<Border>, keyof typeof BORDER_CLONE>>;
152
+ /** A defensive deep copy of a border, each present edge and its colour included. */
153
+ export declare function cloneBorder(border: Border): Border;
108
154
  /** Vertical alignment of a font relative to the baseline (super/subscript). */
109
155
  export type FontVerticalAlignment = 'superscript' | 'subscript';
110
156
  /** Narrow a raw `<vertAlign val>` token to a known {@link FontVerticalAlignment}. */
111
- export declare function isFontVerticalAlignment(value: string): value is FontVerticalAlignment;
157
+ export declare const isFontVerticalAlignment: (value: string) => value is FontVerticalAlignment;
112
158
  /** The theme-font role a `<scheme val>` names: `"minor"`/`"major"` bind the font to whichever
113
159
  * face the workbook theme assigns that role, `"none"` leaves it a literal, unbound face. */
114
160
  export type FontScheme = 'minor' | 'major' | 'none';
115
161
  /** Narrow a raw `<scheme val>` token to a known {@link FontScheme}. */
116
- export declare function isFontScheme(value: string): value is FontScheme;
162
+ export declare const isFontScheme: (value: string) => value is FontScheme;
117
163
  /** A font, as it applies to a cell or a single rich-text run. Every facet is optional and
118
164
  * independent, like {@link Border}/{@link Alignment}/{@link Protection}: a font sets only the
119
165
  * facets it overrides (Excel's own default font backs the rest), so no consumer ever holds every
@@ -132,17 +178,22 @@ export interface Font {
132
178
  readonly outline?: boolean;
133
179
  readonly vertAlign?: FontVerticalAlignment;
134
180
  }
181
+ declare const FONT_CLONE: ClonePlan<Font>;
182
+ /** The proof that {@link FONT_CLONE} names every facet of a font. */
183
+ export type EveryFontFieldIsCloned = AssertNever<Exclude<keyof Required<Font>, keyof typeof FONT_CLONE>>;
184
+ /** A defensive deep copy of a font, its nested colour included. */
185
+ export declare function cloneFont(font: Font): Font;
135
186
  /** How a cell's content sits horizontally within its bounds, as OOXML's `ST_HorizontalAlignment`
136
187
  * enumerates it. `general` is the type-dependent default (text left, numbers right) and reads
137
188
  * back as no explicit horizontal alignment. */
138
189
  export type HorizontalAlignment = 'general' | 'left' | 'center' | 'right' | 'fill' | 'justify' | 'centerContinuous' | 'distributed';
139
190
  /** Narrow a raw `<alignment horizontal>` token to a known {@link HorizontalAlignment}. */
140
- export declare function isHorizontalAlignment(value: string): value is HorizontalAlignment;
191
+ export declare const isHorizontalAlignment: (value: string) => value is HorizontalAlignment;
141
192
  /** How a cell's content sits vertically within its bounds, as OOXML's `ST_VerticalAlignment`
142
193
  * enumerates it. */
143
194
  export type VerticalAlignment = 'top' | 'center' | 'bottom' | 'justify' | 'distributed';
144
195
  /** Narrow a raw `<alignment vertical>` token to a known {@link VerticalAlignment}. */
145
- export declare function isVerticalAlignment(value: string): value is VerticalAlignment;
196
+ export declare const isVerticalAlignment: (value: string) => value is VerticalAlignment;
146
197
  /**
147
198
  * A cell's alignment. Every facet is optional and independent; an absent facet means the cell
148
199
  * takes Excel's default for it. The boolean flags default to off, so a cell that never enabled
@@ -158,6 +209,53 @@ export interface Alignment {
158
209
  readonly shrinkToFit?: boolean;
159
210
  readonly readingOrder?: number;
160
211
  }
212
+ /**
213
+ * How one `<alignment>` facet encodes: which model key it is, what kind of value it carries, and the
214
+ * value that means "default", which the writer omits and the reader drops.
215
+ *
216
+ * Format-blind on purpose. `Alignment` is a core type and the layering gate forbids core importing a
217
+ * serialisation, so the table states what a facet *is* and each codec supplies the reading and the
218
+ * writing off the `kind`. That is where {@link SHEET_PROTECTION_FLAGS} sits and how it is consumed,
219
+ * and it is the shape the BIFF12 codec drives off too: `io/xlsb/read-styles.ts` walks this list and
220
+ * looks each facet up in a `Record` keyed by {@link Alignment}, so the bit layout stays a BIFF12 fact
221
+ * in the BIFF12 codec while the *set* of facets is decided here, once, for both. (That sentence used
222
+ * to read "if alignment ever reaches it". Alignment had reached it; the comment had not noticed, and
223
+ * the binary reader was restating all seven facets and their default-omission rules by hand.)
224
+ *
225
+ * The OOXML attribute name is the model key for all seven facets, so it is not restated here: a
226
+ * second list that is always identical is a second list to keep in step. A future facet whose
227
+ * attribute differs from its key is the one that would have to add the field.
228
+ */
229
+ export type AlignmentFacet = {
230
+ readonly key: 'horizontal' | 'vertical';
231
+ readonly kind: 'token';
232
+ /** The enumeration guard, and what to call it in the error when a value fails it. */
233
+ readonly isValid: (value: string) => boolean;
234
+ readonly label: string;
235
+ /** The token that means the OOXML default, expressed by omitting the attribute. */
236
+ readonly omit?: string;
237
+ } | {
238
+ readonly key: 'textRotation' | 'indent' | 'readingOrder';
239
+ readonly kind: 'number';
240
+ } | {
241
+ readonly key: 'wrapText' | 'shrinkToFit';
242
+ readonly kind: 'flag';
243
+ };
244
+ /**
245
+ * The seven `<alignment>` facets, declared once. Both directions key off this list, so a facet
246
+ * written but not read (it survives a re-write and vanishes on load) or read but not written (the
247
+ * reverse) is no longer something a reviewer has to notice: {@link EveryAlignmentFacetIsDeclared}
248
+ * makes a facet added to {@link Alignment} and forgotten here a compile error.
249
+ *
250
+ * In ECMA-376 CT_CellAlignment order, which is the order the writer emits.
251
+ */
252
+ export declare const ALIGNMENT_FACETS: readonly AlignmentFacet[];
253
+ /**
254
+ * Compile-time proof that {@link ALIGNMENT_FACETS} covers every {@link Alignment} facet. A facet
255
+ * added to the type without a table entry resolves this to that facet's name, which does not satisfy
256
+ * `never`, so the error names what is missing.
257
+ */
258
+ export type EveryAlignmentFacetIsDeclared = AssertNever<Exclude<keyof Alignment, (typeof ALIGNMENT_FACETS)[number]['key']>>;
161
259
  /**
162
260
  * A cell's protection state, enforced only when the worksheet itself is protected. The flags
163
261
  * do nothing on an unprotected sheet. `locked` defaults to TRUE in OOXML (every cell is locked
@@ -190,6 +288,32 @@ export interface CellStyle {
190
288
  }
191
289
  /** The names of the {@link CellStyle} facets, for helpers that copy the tuple facet-by-facet. */
192
290
  export declare const CELL_STYLE_FACETS: (keyof CellStyle)[];
291
+ /**
292
+ * Everything a cell's *formatting* is, which is the six {@link CellStyle} facets plus two that only a
293
+ * cell can carry: the quote-prefix flag and the link to a named cell style.
294
+ *
295
+ * The two extras are on the cell's `xf` record exactly as the six are, and are written and read back
296
+ * exactly as the six are, but they sat outside the tuple, so every copy path driven by the tuple
297
+ * dropped them: a splice, a `duplicateRow`, or a `dst.model = src.model` turned a leading-apostrophe
298
+ * text cell back into an unprefixed one. That is the merge-loss the tuple exists to make impossible,
299
+ * so they join it. Callers that mean "the six shared facets" (a column default, a named style, a
300
+ * `<dxf>`) still say {@link CellStyle}; callers copying a *cell* say this.
301
+ */
302
+ export type CellContent = CellStyle & {
303
+ quotePrefix?: boolean | undefined;
304
+ [NAMED_STYLE_ID]?: number | undefined;
305
+ };
306
+ /**
307
+ * The names of every {@link CellContent} facet, the six shared ones first. Helpers that copy a cell's
308
+ * whole formatting drive off this, so a facet added to either half reaches all of them at once.
309
+ */
310
+ export declare const CELL_CONTENT_FACETS: (keyof CellContent)[];
311
+ /**
312
+ * Copy every present facet of a cell's formatting from `source` onto `target`, leaving facets
313
+ * `source` omits untouched: {@link assignStyleFacets} widened to the two cell-only facets. This is
314
+ * what a copy of a *cell* uses, so no structural edit can drop one.
315
+ */
316
+ export declare function assignContentFacets(target: CellContent, source: Readonly<CellContent>): void;
193
317
  /**
194
318
  * Copy each present facet of `source` onto `target`, leaving facets `source` omits untouched: the
195
319
  * plain-record counterpart to a cell's `applyCellStyle`, for the {@link CellStyle}-shaped targets a
@@ -205,69 +329,4 @@ export declare function assignStyleFacets(target: CellStyle, source: Readonly<Ce
205
329
  * the tuple reaches a `<col>` style without anyone remembering to widen a literal.
206
330
  */
207
331
  export declare function pickStyleFacets(source: Readonly<CellStyle>): CellStyle;
208
- /**
209
- * A named cell style: the OOXML `cellStyleXfs`/`cellStyles` layer. A spreadsheet applies a built-in
210
- * or custom style (e.g. "Normal", "Accent1") whose visual facets live in this shared, named layer
211
- * rather than on each cell's direct format; a cell links to it and inherits any facet the direct
212
- * format leaves unset. The facets are a cell's own (see {@link CellStyle}); `name` is the style's
213
- * display name and `builtinId` its Excel gallery index when it is a built-in style.
214
- */
215
- export type NamedCellStyle = Readonly<CellStyle> & {
216
- readonly name?: string;
217
- readonly builtinId?: number;
218
- };
219
- /**
220
- * A differential style (OOXML CT_Dxf): formatting laid *over* whatever a cell already carries. Only
221
- * the facets present override; the rest of the cell's own style shows through. It carries the subset
222
- * of the cell-style facets (see {@link CellStyle}) a `<dxf>` can express: font, number format, fill,
223
- * and border.
224
- *
225
- * Differential styles live in one workbook-level table (`<dxfs>`) that several features index into:
226
- * a conditional-formatting rule's highlight format, and a table style's per-element formatting
227
- * (`<tableStyleElement dxfId="…">`). They are interned and shared, so two features asking for the
228
- * same formatting land on one entry.
229
- *
230
- * Not every facet reaches every consumer. As a **table style element**, Excel applies only the font,
231
- * fill, and border: its own object model exposes `Font`, `Interior`, and `Borders` on a table style
232
- * element and nothing for a number format, so a `numFmt` set here is carried faithfully through a
233
- * round-trip but has no visible effect. The type is left whole rather than split, because the same
234
- * value is legitimately reused across both consumers and narrowing it would only move the surprise.
235
- */
236
- export type DifferentialStyle = Pick<CellStyle, 'font' | 'numFmt' | 'fill' | 'border'>;
237
- /**
238
- * The `<tableStyles>` block of a styles part: the custom table/pivot style definitions a file
239
- * declares, and the two gallery names it nominates as the default for a new table and a new pivot.
240
- *
241
- * Each entry of {@link styles} is one `<tableStyle>…</tableStyle>` fragment kept verbatim, for the
242
- * same reason a `<dxf>` is: a `tableStyleElement`'s `dxfId` indexes the differential-style table,
243
- * which the writer re-emits **at its original indices**, so the references stay valid without
244
- * reparsing anything. That index-stability is load-bearing: renumbering the dxf table would
245
- * silently re-point every preserved table style at a different format.
246
- *
247
- * The two default names are ordinary strings, not fragments: they are re-escaped on write, so they
248
- * are held decoded.
249
- */
250
- export interface TableStyleTable {
251
- readonly styles: readonly string[];
252
- readonly defaultTableStyle?: string | undefined;
253
- readonly defaultPivotStyle?: string | undefined;
254
- /**
255
- * The namespace prefixes the verbatim {@link styles} fragments use, mapped to their URI and to
256
- * whether the source marked the prefix ignorable (`mc:Ignorable`).
257
- *
258
- * Carrying a fragment verbatim carries its *prefixes* too. Excel stamps a revision id
259
- * (`xr9:uid="{…}"`) on every `<tableStyle>` it writes, so a fragment re-emitted under a
260
- * `<styleSheet>` that declares only the default namespace is not namespace-well-formed, and no
261
- * consumer can parse the part at all, which is a far louder failure than the dropped table style
262
- * this preservation exists to prevent. The writer re-declares each prefix on `<styleSheet>` and
263
- * re-states the ignorable ones, exactly as the source did.
264
- */
265
- readonly namespaces?: readonly TableStyleNamespace[];
266
- }
267
- /** One namespace declaration a preserved `<tableStyle>` fragment depends on. */
268
- export interface TableStyleNamespace {
269
- readonly prefix: string;
270
- readonly uri: string;
271
- /** Whether the source listed this prefix in the stylesheet's `mc:Ignorable`. */
272
- readonly ignorable: boolean;
273
- }
332
+ export {};
@@ -1,43 +1,64 @@
1
- const NAMED_UNDERLINE_STYLES = {
1
+ import { tokenSet, tokenSetOf } from '../token-set.js';
2
+ import { cloneWith } from './clone.js';
3
+ import { copyKeyIfPresent } from './containers.js';
4
+ import { NAMED_STYLE_ID } from './internal.js';
5
+ export const isNamedUnderlineStyle = tokenSet({
2
6
  none: true,
3
7
  single: true,
4
8
  double: true,
5
9
  singleAccounting: true,
6
10
  doubleAccounting: true,
7
- };
8
- export function isNamedUnderlineStyle(value) {
9
- return Object.hasOwn(NAMED_UNDERLINE_STYLES, value);
10
- }
11
+ });
11
12
  export function parseArgb(value) {
12
13
  const hex = value.startsWith('#') ? value.slice(1) : value;
13
14
  const argb = hex.length === 6 ? `FF${hex}` : hex;
14
15
  return /^[0-9a-fA-F]{8}$/.test(argb) ? argb : undefined;
15
16
  }
16
- const FILL_PATTERN_TYPES = {
17
- none: true,
18
- solid: true,
19
- gray125: true,
20
- darkGray: true,
21
- mediumGray: true,
22
- lightGray: true,
23
- gray0625: true,
24
- darkHorizontal: true,
25
- darkVertical: true,
26
- darkDown: true,
27
- darkUp: true,
28
- darkGrid: true,
29
- darkTrellis: true,
30
- lightHorizontal: true,
31
- lightVertical: true,
32
- lightDown: true,
33
- lightUp: true,
34
- lightGrid: true,
35
- lightTrellis: true,
17
+ export const FILL_PATTERNS_IN_SCHEMA_ORDER = [
18
+ 'none',
19
+ 'solid',
20
+ 'mediumGray',
21
+ 'darkGray',
22
+ 'lightGray',
23
+ 'darkHorizontal',
24
+ 'darkVertical',
25
+ 'darkDown',
26
+ 'darkUp',
27
+ 'darkGrid',
28
+ 'darkTrellis',
29
+ 'lightHorizontal',
30
+ 'lightVertical',
31
+ 'lightDown',
32
+ 'lightUp',
33
+ 'lightGrid',
34
+ 'lightTrellis',
35
+ 'gray125',
36
+ 'gray0625',
37
+ ];
38
+ export const isFillPatternType = tokenSetOf(FILL_PATTERNS_IN_SCHEMA_ORDER);
39
+ const GRADIENT_STOP_CLONE = { position: 'value', color: 'record' };
40
+ const PATTERN_FILL_CLONE = {
41
+ type: 'value',
42
+ pattern: 'value',
43
+ fgColor: 'record',
44
+ bgColor: 'record',
36
45
  };
37
- export function isFillPatternType(value) {
38
- return Object.hasOwn(FILL_PATTERN_TYPES, value);
46
+ const GRADIENT_FILL_CLONE = {
47
+ type: 'value',
48
+ gradient: 'value',
49
+ degree: 'value',
50
+ left: 'value',
51
+ right: 'value',
52
+ top: 'value',
53
+ bottom: 'value',
54
+ stops: (stops) => stops.map((stop) => cloneWith(stop, GRADIENT_STOP_CLONE)),
55
+ };
56
+ export function cloneFill(fill) {
57
+ return fill.type === 'gradient'
58
+ ? cloneWith(fill, GRADIENT_FILL_CLONE)
59
+ : cloneWith(fill, PATTERN_FILL_CLONE);
39
60
  }
40
- const BORDER_STYLES = {
61
+ export const isBorderStyle = tokenSet({
41
62
  thin: true,
42
63
  medium: true,
43
64
  thick: true,
@@ -51,22 +72,44 @@ const BORDER_STYLES = {
51
72
  dashDotDot: true,
52
73
  mediumDashDotDot: true,
53
74
  slantDashDot: true,
75
+ });
76
+ const BORDER_EDGE_CLONE = { style: 'value', color: 'record' };
77
+ const cloneBorderEdge = (edge) => cloneWith(edge, BORDER_EDGE_CLONE);
78
+ const BORDER_CLONE = {
79
+ left: cloneBorderEdge,
80
+ right: cloneBorderEdge,
81
+ top: cloneBorderEdge,
82
+ bottom: cloneBorderEdge,
83
+ diagonal: cloneBorderEdge,
84
+ diagonalUp: 'value',
85
+ diagonalDown: 'value',
54
86
  };
55
- export function isBorderStyle(value) {
56
- return Object.hasOwn(BORDER_STYLES, value);
87
+ export function cloneBorder(border) {
88
+ return cloneWith(border, BORDER_CLONE);
57
89
  }
58
- const FONT_VERTICAL_ALIGNMENTS = {
90
+ export const isFontVerticalAlignment = tokenSet({
59
91
  superscript: true,
60
92
  subscript: true,
93
+ });
94
+ export const isFontScheme = tokenSet({ minor: true, major: true, none: true });
95
+ const FONT_CLONE = {
96
+ name: 'value',
97
+ size: 'value',
98
+ family: 'value',
99
+ scheme: 'value',
100
+ charset: 'value',
101
+ color: 'record',
102
+ bold: 'value',
103
+ italic: 'value',
104
+ underline: 'value',
105
+ strike: 'value',
106
+ outline: 'value',
107
+ vertAlign: 'value',
61
108
  };
62
- export function isFontVerticalAlignment(value) {
63
- return Object.hasOwn(FONT_VERTICAL_ALIGNMENTS, value);
64
- }
65
- const FONT_SCHEMES = { minor: true, major: true, none: true };
66
- export function isFontScheme(value) {
67
- return Object.hasOwn(FONT_SCHEMES, value);
109
+ export function cloneFont(font) {
110
+ return cloneWith(font, FONT_CLONE);
68
111
  }
69
- const HORIZONTAL_ALIGNMENTS = {
112
+ export const isHorizontalAlignment = tokenSet({
70
113
  general: true,
71
114
  left: true,
72
115
  center: true,
@@ -75,20 +118,29 @@ const HORIZONTAL_ALIGNMENTS = {
75
118
  justify: true,
76
119
  centerContinuous: true,
77
120
  distributed: true,
78
- };
79
- export function isHorizontalAlignment(value) {
80
- return Object.hasOwn(HORIZONTAL_ALIGNMENTS, value);
81
- }
82
- const VERTICAL_ALIGNMENTS = {
121
+ });
122
+ export const isVerticalAlignment = tokenSet({
83
123
  top: true,
84
124
  center: true,
85
125
  bottom: true,
86
126
  justify: true,
87
127
  distributed: true,
88
- };
89
- export function isVerticalAlignment(value) {
90
- return Object.hasOwn(VERTICAL_ALIGNMENTS, value);
91
- }
128
+ });
129
+ export const ALIGNMENT_FACETS = [
130
+ {
131
+ key: 'horizontal',
132
+ kind: 'token',
133
+ isValid: isHorizontalAlignment,
134
+ label: 'horizontal alignment',
135
+ omit: 'general',
136
+ },
137
+ { key: 'vertical', kind: 'token', isValid: isVerticalAlignment, label: 'vertical alignment' },
138
+ { key: 'textRotation', kind: 'number' },
139
+ { key: 'wrapText', kind: 'flag' },
140
+ { key: 'indent', kind: 'number' },
141
+ { key: 'shrinkToFit', kind: 'flag' },
142
+ { key: 'readingOrder', kind: 'number' },
143
+ ];
92
144
  const CELL_STYLE_FACET_KEYS = {
93
145
  fill: true,
94
146
  numFmt: true,
@@ -98,17 +150,24 @@ const CELL_STYLE_FACET_KEYS = {
98
150
  protection: true,
99
151
  };
100
152
  export const CELL_STYLE_FACETS = Object.keys(CELL_STYLE_FACET_KEYS);
153
+ const CELL_CONTENT_ONLY_KEYS = {
154
+ quotePrefix: true,
155
+ [NAMED_STYLE_ID]: true,
156
+ };
157
+ export const CELL_CONTENT_FACETS = [
158
+ ...CELL_STYLE_FACETS,
159
+ ...Reflect.ownKeys(CELL_CONTENT_ONLY_KEYS),
160
+ ];
161
+ export function assignContentFacets(target, source) {
162
+ for (const facet of CELL_CONTENT_FACETS)
163
+ copyKeyIfPresent(target, source, facet);
164
+ }
101
165
  export function assignStyleFacets(target, source) {
102
166
  for (const facet of CELL_STYLE_FACETS)
103
- copyFacet(target, source, facet);
167
+ copyKeyIfPresent(target, source, facet);
104
168
  }
105
169
  export function pickStyleFacets(source) {
106
170
  const facets = {};
107
171
  assignStyleFacets(facets, source);
108
172
  return facets;
109
173
  }
110
- function copyFacet(target, source, key) {
111
- const value = source[key];
112
- if (value !== undefined)
113
- target[key] = value;
114
- }
@@ -1,4 +1,4 @@
1
- import type { DifferentialStyle } from './style.ts';
1
+ import type { DifferentialStyle } from './workbook-styles.ts';
2
2
  /**
3
3
  * The regions a table style can format (`ST_TableStyleType`).
4
4
  *
@@ -1,4 +1,4 @@
1
- import { AuthoringError } from '../errors.js';
1
+ import { AuthoringError, invalidToken, quoted } from '../errors.js';
2
2
  export const TABLE_STYLE_ELEMENT_TYPES = [
3
3
  'wholeTable',
4
4
  'headerRow',
@@ -46,17 +46,17 @@ export function checkTableStyle(style) {
46
46
  if (element === undefined)
47
47
  continue;
48
48
  if (!isTableStyleElementType(type)) {
49
- throw new AuthoringError(`Invalid table style element ${JSON.stringify(type)}: not a value the OOXML enumeration allows`);
49
+ throw invalidToken('table style element', type);
50
50
  }
51
51
  const { size } = element;
52
52
  if (size === undefined)
53
53
  continue;
54
54
  if (!STRIPE_ELEMENT_TYPES.has(type)) {
55
- throw new AuthoringError(`table style element "${type}" cannot carry a size: band width applies only to ` +
55
+ throw new AuthoringError(`table style element ${quoted(type)} cannot carry a size: band width applies only to ` +
56
56
  `${[...STRIPE_ELEMENT_TYPES].join(', ')}`);
57
57
  }
58
58
  if (!Number.isInteger(size) || size < 1) {
59
- throw new RangeError(`Invalid table style band size ${size}: expected a positive integer`);
59
+ throw new RangeError(`invalid table style band size ${size}: expected a positive integer`);
60
60
  }
61
61
  }
62
62
  }
@@ -1,4 +1,7 @@
1
1
  import { type GridRect } from './address.ts';
2
+ import { type ClonePlan } from './clone.ts';
3
+ import { type AxisSplice } from './grid-shift.ts';
4
+ import type { AssertNever } from './internal.ts';
2
5
  import type { CellStyle } from './style.ts';
3
6
  import type { CellValue } from './value.ts';
4
7
  /** A per-column cell format applied to a table's body cells: the facets Excel's table-column style
@@ -57,6 +60,16 @@ export interface TableStyleInfo {
57
60
  /** Band the columns (alternating fill). */
58
61
  readonly showColumnStripes?: boolean;
59
62
  }
63
+ /** Copy a style, keeping only its defined fields off the literal so `exactOptionalPropertyTypes`
64
+ * never sees a fabricated `key: undefined`: an absent attribute must stay absent across a copy.
65
+ *
66
+ * The sentinel name `"None"` (Excel's table-style gallery entry for *no* style) is normalised to an
67
+ * absent name: OOXML expresses "unstyled" as a `<tableStyleInfo>` with no `name` attribute, so a
68
+ * literal `name="None"` would reference a style that does not exist and make the file suspect. The
69
+ * banding flags set alongside it are untouched. */
70
+ declare const STYLE_INFO_CLONE: ClonePlan<TableStyleInfo>;
71
+ /** The proof that {@link STYLE_INFO_CLONE} names every field of the style. */
72
+ export type EveryTableStyleInfoFieldIsCloned = AssertNever<Exclude<keyof Required<TableStyleInfo>, keyof typeof STYLE_INFO_CLONE>>;
60
73
  /**
61
74
  * OOXML's totals-row function names (`ST_TotalsRowFunction`) to the `SUBTOTAL` first-argument code
62
75
  * Excel writes into a materialised totals cell. The `10x` band ignores manually hidden rows, the
@@ -75,7 +88,7 @@ export declare const TOTALS_ROW_SUBTOTAL_CODE: Readonly<Partial<Record<TotalsRow
75
88
  */
76
89
  export type TotalsRowFunction = 'average' | 'countNums' | 'count' | 'max' | 'min' | 'stdDev' | 'sum' | 'var' | 'custom' | 'none';
77
90
  /** Narrow a raw `totalsRowFunction` attribute to a known {@link TotalsRowFunction}. */
78
- export declare function isTotalsRowFunction(value: string): value is TotalsRowFunction;
91
+ export declare const isTotalsRowFunction: (value: string) => value is TotalsRowFunction;
79
92
  /** One column of a table: a header name and its optional totals-row behaviour. */
80
93
  export interface TableColumn {
81
94
  /** The column's header/display name. Must be unique within the table (case-insensitively):
@@ -158,20 +171,24 @@ export declare class Table {
158
171
  */
159
172
  addRow(values?: readonly CellValue[]): void;
160
173
  /**
161
- * Re-pin the table through a row splice: `count` rows removed at the 1-based `start`, then rows
162
- * inserted so surviving rows below shift by `delta`. A splice entirely above the table moves its
163
- * whole range by `delta`; one landing inside grows or shrinks the data rows to absorb the change;
174
+ * Re-pin the table through a row splice. A splice entirely above the table moves its whole range
175
+ * by the splice's `delta`; one landing inside grows or shrinks the data rows to absorb the change;
164
176
  * one that deletes the table's every row removes it. Returns `false` when the table no longer has
165
177
  * a row to occupy (the caller drops it), `true` when it survives.
166
178
  */
167
- shiftRows(start: number, count: number, delta: number): boolean;
179
+ shiftRows(splice: AxisSplice): boolean;
168
180
  /**
169
- * Re-pin the table through a column splice. A splice entirely to the table's left moves its anchor
170
- * by `delta`; one to its right leaves it untouched. A splice landing inside the table's columns is
171
- * structural surgery on named columns with no unambiguous answer, so the table's columns are left
172
- * as-is (anchor unchanged) rather than fabricated or dropped. Always returns `true`.
181
+ * Re-pin the table through a column splice, the mirror of {@link shiftRows}. A splice entirely to
182
+ * the table's left moves its anchor by the splice's `delta`; one to its right leaves it untouched;
183
+ * one that deletes the table's every column removes it. Returns `false` when the table no longer
184
+ * has a column to occupy (the caller drops it), `true` when it survives.
185
+ *
186
+ * A splice landing *inside* the table's columns is structural surgery on named columns with no
187
+ * unambiguous answer, so those columns are left as-is rather than fabricated or dropped. Whole-table
188
+ * deletion is not that case: a table left declared over whatever slid into its place, carrying the
189
+ * names of columns that no longer exist, is content the writer then emits.
173
190
  */
174
- shiftColumns(start: number, count: number, delta: number): boolean;
191
+ shiftColumns(splice: AxisSplice): boolean;
175
192
  /**
176
193
  * The options that reconstruct this table: the anchor as a single-cell ref (not the derived
177
194
  * full range), the columns, and the data-row count with the header/totals flags. Feeding this
@@ -194,3 +211,4 @@ export declare class Table {
194
211
  /** The occupied rectangle, for conflict checks such as overlapping merges. */
195
212
  get region(): TableRegion;
196
213
  }
214
+ export {};