@shbernal/ts-xlsx 3.0.0 → 3.2.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 (277) hide show
  1. package/README.md +34 -24
  2. package/dist/bytes.d.ts +10 -2
  3. package/dist/bytes.js +22 -0
  4. package/dist/core/address.d.ts +96 -2
  5. package/dist/core/address.js +87 -33
  6. package/dist/core/array-formula-ranges.d.ts +33 -0
  7. package/dist/core/array-formula-ranges.js +62 -0
  8. package/dist/core/autofilter.d.ts +4 -3
  9. package/dist/core/autofilter.js +31 -30
  10. package/dist/core/axis-handle.d.ts +2 -0
  11. package/dist/core/axis-handle.js +5 -2
  12. package/dist/core/cell.d.ts +4 -3
  13. package/dist/core/cell.js +4 -6
  14. package/dist/core/clone.d.ts +29 -0
  15. package/dist/core/clone.js +24 -0
  16. package/dist/core/color-resolution.js +4 -6
  17. package/dist/core/column.d.ts +1 -0
  18. package/dist/core/column.js +6 -2
  19. package/dist/core/comment-thread.d.ts +7 -3
  20. package/dist/core/comment-thread.js +2 -1
  21. package/dist/core/conditional-formatting-overlay.d.ts +11 -1
  22. package/dist/core/conditional-formatting-overlay.js +30 -3
  23. package/dist/core/conditional-formatting.d.ts +107 -11
  24. package/dist/core/conditional-formatting.js +76 -19
  25. package/dist/core/containers.d.ts +12 -0
  26. package/dist/core/containers.js +5 -0
  27. package/dist/core/data-validation-overlay.d.ts +7 -1
  28. package/dist/core/data-validation-overlay.js +19 -4
  29. package/dist/core/data-validation.d.ts +22 -0
  30. package/dist/core/data-validation.js +30 -4
  31. package/dist/core/date-format.d.ts +20 -0
  32. package/dist/core/date-format.js +170 -0
  33. package/dist/core/date.d.ts +43 -8
  34. package/dist/core/date.js +19 -3
  35. package/dist/core/formula-references.d.ts +26 -0
  36. package/dist/core/formula-references.js +173 -0
  37. package/dist/core/formula-scan.d.ts +2 -0
  38. package/dist/core/formula-scan.js +58 -0
  39. package/dist/core/formula.d.ts +76 -17
  40. package/dist/core/formula.js +87 -80
  41. package/dist/core/function-values.d.ts +4 -0
  42. package/dist/core/function-values.js +58 -0
  43. package/dist/core/future-functions.d.ts +3 -0
  44. package/dist/core/{modern-functions.js → future-functions.js} +119 -88
  45. package/dist/core/grid-edits.d.ts +30 -3
  46. package/dist/core/grid-edits.js +248 -81
  47. package/dist/core/grid-shift.d.ts +58 -9
  48. package/dist/core/grid-shift.js +26 -4
  49. package/dist/core/hyperlink.d.ts +39 -0
  50. package/dist/core/hyperlink.js +88 -0
  51. package/dist/core/image.d.ts +49 -14
  52. package/dist/core/image.js +16 -5
  53. package/dist/core/internal.d.ts +10 -2
  54. package/dist/core/limits.d.ts +25 -0
  55. package/dist/core/limits.js +4 -0
  56. package/dist/core/merge.d.ts +18 -4
  57. package/dist/core/merge.js +33 -20
  58. package/dist/core/page-setup.d.ts +26 -11
  59. package/dist/core/pivot-table.d.ts +49 -10
  60. package/dist/core/pivot-table.js +112 -60
  61. package/dist/core/protection.d.ts +66 -4
  62. package/dist/core/protection.js +6 -11
  63. package/dist/core/range.js +34 -30
  64. package/dist/core/row-input.js +2 -2
  65. package/dist/core/row.d.ts +1 -0
  66. package/dist/core/row.js +6 -2
  67. package/dist/core/structured-reference.d.ts +7 -0
  68. package/dist/core/structured-reference.js +7 -0
  69. package/dist/core/style.d.ts +85 -70
  70. package/dist/core/style.js +92 -28
  71. package/dist/core/table-style.d.ts +1 -1
  72. package/dist/core/table-style.js +4 -4
  73. package/dist/core/table.d.ts +64 -16
  74. package/dist/core/table.js +87 -40
  75. package/dist/core/theme.d.ts +2 -0
  76. package/dist/core/theme.js +9 -5
  77. package/dist/core/value.d.ts +60 -28
  78. package/dist/core/value.js +48 -43
  79. package/dist/core/workbook-media.d.ts +34 -0
  80. package/dist/core/workbook-media.js +44 -0
  81. package/dist/core/workbook-styles.d.ts +83 -1
  82. package/dist/core/workbook-styles.js +4 -0
  83. package/dist/core/workbook-theme.js +5 -3
  84. package/dist/core/workbook-vba.js +3 -2
  85. package/dist/core/workbook.d.ts +41 -3
  86. package/dist/core/workbook.js +46 -41
  87. package/dist/core/worksheet-comments.d.ts +2 -1
  88. package/dist/core/worksheet-comments.js +20 -13
  89. package/dist/core/worksheet-merges.d.ts +49 -0
  90. package/dist/core/worksheet-merges.js +65 -0
  91. package/dist/core/worksheet-model.d.ts +10 -2
  92. package/dist/core/worksheet-model.js +28 -9
  93. package/dist/core/worksheet-pictures.d.ts +3 -3
  94. package/dist/core/worksheet-pictures.js +7 -6
  95. package/dist/core/worksheet.d.ts +165 -27
  96. package/dist/core/worksheet.js +206 -89
  97. package/dist/customui/ribbon.js +2 -1
  98. package/dist/entries/core.d.ts +21 -14
  99. package/dist/entries/core.js +14 -7
  100. package/dist/entries/errors.d.ts +1 -0
  101. package/dist/entries/errors.js +1 -0
  102. package/dist/entries/xlsx.d.ts +1 -1
  103. package/dist/errors.d.ts +64 -0
  104. package/dist/errors.js +22 -0
  105. package/dist/hex.d.ts +8 -0
  106. package/dist/hex.js +3 -0
  107. package/dist/io/cell-metadata/metadata.d.ts +42 -0
  108. package/dist/io/cell-metadata/metadata.js +35 -0
  109. package/dist/io/cell-metadata/rich-values.d.ts +11 -0
  110. package/dist/io/cell-metadata/rich-values.js +80 -0
  111. package/dist/io/csv/delimiter.d.ts +21 -0
  112. package/dist/io/csv/delimiter.js +18 -0
  113. package/dist/io/csv/errors.d.ts +14 -0
  114. package/dist/io/csv/errors.js +5 -0
  115. package/dist/io/csv/read.d.ts +6 -1
  116. package/dist/io/csv/read.js +51 -22
  117. package/dist/io/csv/write.d.ts +19 -5
  118. package/dist/io/csv/write.js +24 -44
  119. package/dist/io/opc/inflate.js +14 -0
  120. package/dist/io/opc/namespaces.d.ts +16 -0
  121. package/dist/io/opc/namespaces.js +4 -0
  122. package/dist/io/opc/part-paths.d.ts +9 -0
  123. package/dist/io/opc/part-paths.js +5 -5
  124. package/dist/io/opc/read-opc.d.ts +58 -14
  125. package/dist/io/opc/read-opc.js +49 -21
  126. package/dist/io/opc/read-options.d.ts +5 -1
  127. package/dist/io/opc/sniff-format.d.ts +3 -3
  128. package/dist/io/opc/sniff-format.js +2 -2
  129. package/dist/io/opc/strict-relationships.d.ts +2 -0
  130. package/dist/io/opc/strict-relationships.js +12 -0
  131. package/dist/io/read-policy/column-budget.d.ts +26 -0
  132. package/dist/io/read-policy/column-budget.js +18 -0
  133. package/dist/io/read-policy/read-repair.d.ts +74 -0
  134. package/dist/io/read-policy/read-repair.js +119 -0
  135. package/dist/io/style/cell-style-resolution.d.ts +25 -0
  136. package/dist/io/style/cell-style-resolution.js +30 -0
  137. package/dist/io/style/xf-style.d.ts +23 -1
  138. package/dist/io/style/xf-style.js +8 -0
  139. package/dist/io/xlsb/formula.d.ts +2 -2
  140. package/dist/io/xlsb/formula.js +52 -35
  141. package/dist/io/xlsb/primitives.js +8 -14
  142. package/dist/io/xlsb/ptg-functions.d.ts +19 -10
  143. package/dist/io/xlsb/ptg-functions.js +495 -596
  144. package/dist/io/xlsb/read-metadata.d.ts +7 -0
  145. package/dist/io/xlsb/read-metadata.js +69 -0
  146. package/dist/io/xlsb/read-styles.js +45 -81
  147. package/dist/io/xlsb/read-worksheet.d.ts +26 -1
  148. package/dist/io/xlsb/read-worksheet.js +148 -106
  149. package/dist/io/xlsb/read.d.ts +6 -3
  150. package/dist/io/xlsb/read.js +70 -31
  151. package/dist/io/xlsb/record-stream.d.ts +30 -0
  152. package/dist/io/xlsb/record-stream.js +20 -0
  153. package/dist/io/xlsb/record-types.d.ts +14 -5
  154. package/dist/io/xlsb/record-types.js +14 -5
  155. package/dist/io/xlsb/sheet-protection.d.ts +20 -0
  156. package/dist/io/xlsb/sheet-protection.js +60 -0
  157. package/dist/io/xlsx/cell-accumulator.d.ts +24 -9
  158. package/dist/io/xlsx/cell-accumulator.js +74 -21
  159. package/dist/io/xlsx/cell-metadata.d.ts +39 -0
  160. package/dist/io/xlsx/cell-metadata.js +162 -0
  161. package/dist/io/xlsx/cell-value.d.ts +19 -5
  162. package/dist/io/xlsx/cell-value.js +45 -30
  163. package/dist/io/xlsx/color-xml.js +3 -2
  164. package/dist/io/xlsx/column-span.d.ts +11 -0
  165. package/dist/io/xlsx/column-span.js +9 -0
  166. package/dist/io/xlsx/comments.d.ts +9 -30
  167. package/dist/io/xlsx/comments.js +25 -83
  168. package/dist/io/xlsx/conditional-formatting.d.ts +43 -23
  169. package/dist/io/xlsx/conditional-formatting.js +437 -138
  170. package/dist/io/xlsx/data-validation.d.ts +12 -7
  171. package/dist/io/xlsx/data-validation.js +67 -53
  172. package/dist/io/xlsx/edit-vba.d.ts +7 -2
  173. package/dist/io/xlsx/edit-vba.js +52 -52
  174. package/dist/io/xlsx/font-xml.d.ts +7 -0
  175. package/dist/io/xlsx/font-xml.js +104 -0
  176. package/dist/io/xlsx/hyperlinks.d.ts +19 -21
  177. package/dist/io/xlsx/hyperlinks.js +12 -32
  178. package/dist/io/xlsx/images.d.ts +49 -16
  179. package/dist/io/xlsx/images.js +149 -50
  180. package/dist/io/xlsx/namespaces.d.ts +24 -0
  181. package/dist/io/xlsx/namespaces.js +11 -0
  182. package/dist/io/xlsx/package-plan.d.ts +60 -15
  183. package/dist/io/xlsx/package-plan.js +83 -18
  184. package/dist/io/xlsx/part-names.d.ts +6 -8
  185. package/dist/io/xlsx/part-names.js +3 -7
  186. package/dist/io/xlsx/pivot.d.ts +5 -5
  187. package/dist/io/xlsx/pivot.js +26 -24
  188. package/dist/io/xlsx/preserved-splices.d.ts +6 -0
  189. package/dist/io/xlsx/preserved-splices.js +74 -0
  190. package/dist/io/xlsx/read-comments.d.ts +29 -0
  191. package/dist/io/xlsx/read-comments.js +75 -0
  192. package/dist/io/xlsx/read-parts.d.ts +59 -0
  193. package/dist/io/xlsx/read-parts.js +259 -0
  194. package/dist/io/xlsx/read-pivot.js +11 -4
  195. package/dist/io/xlsx/{rich-runs.d.ts → read-rich-runs.d.ts} +8 -5
  196. package/dist/io/xlsx/{rich-runs.js → read-rich-runs.js} +24 -4
  197. package/dist/io/xlsx/read-rows.d.ts +35 -11
  198. package/dist/io/xlsx/read-rows.js +73 -49
  199. package/dist/io/xlsx/read-shared-strings.js +3 -2
  200. package/dist/io/xlsx/read-styles.d.ts +0 -30
  201. package/dist/io/xlsx/read-styles.js +45 -105
  202. package/dist/io/xlsx/read-workbook-xml.d.ts +42 -0
  203. package/dist/io/xlsx/read-workbook-xml.js +175 -0
  204. package/dist/io/xlsx/read-worksheet.d.ts +9 -3
  205. package/dist/io/xlsx/read-worksheet.js +70 -177
  206. package/dist/io/xlsx/read.d.ts +3 -14
  207. package/dist/io/xlsx/read.js +74 -411
  208. package/dist/io/xlsx/relationships.d.ts +3 -0
  209. package/dist/io/xlsx/relationships.js +4 -0
  210. package/dist/io/xlsx/rich-text.js +1 -1
  211. package/dist/io/xlsx/row-position.d.ts +20 -0
  212. package/dist/io/xlsx/row-position.js +11 -0
  213. package/dist/io/xlsx/row-xml.d.ts +139 -0
  214. package/dist/io/xlsx/row-xml.js +222 -0
  215. package/dist/io/xlsx/shared-formulas.js +2 -2
  216. package/dist/io/xlsx/sheet-properties.d.ts +10 -1
  217. package/dist/io/xlsx/sheet-properties.js +182 -20
  218. package/dist/io/xlsx/strict-parts.d.ts +7 -0
  219. package/dist/io/xlsx/strict-parts.js +171 -0
  220. package/dist/io/xlsx/style-elements.d.ts +41 -0
  221. package/dist/io/xlsx/style-elements.js +136 -0
  222. package/dist/io/xlsx/styles.d.ts +17 -3
  223. package/dist/io/xlsx/styles.js +13 -209
  224. package/dist/io/xlsx/tables.d.ts +10 -2
  225. package/dist/io/xlsx/tables.js +55 -52
  226. package/dist/io/xlsx/theme-xml.d.ts +32 -4
  227. package/dist/io/xlsx/theme-xml.js +106 -71
  228. package/dist/io/xlsx/threaded-comments.d.ts +14 -11
  229. package/dist/io/xlsx/threaded-comments.js +16 -8
  230. package/dist/io/xlsx/workbook-xml.d.ts +45 -6
  231. package/dist/io/xlsx/workbook-xml.js +62 -54
  232. package/dist/io/xlsx/worksheet-xml.d.ts +26 -70
  233. package/dist/io/xlsx/worksheet-xml.js +69 -282
  234. package/dist/io/xlsx/write-stream.d.ts +90 -19
  235. package/dist/io/xlsx/write-stream.js +80 -25
  236. package/dist/io/xlsx/write.d.ts +12 -6
  237. package/dist/io/xlsx/write.js +226 -123
  238. package/dist/rel-type.d.ts +25 -0
  239. package/dist/rel-type.js +9 -0
  240. package/dist/token-set.d.ts +13 -0
  241. package/dist/token-set.js +4 -1
  242. package/dist/vba/bytes.d.ts +16 -5
  243. package/dist/vba/bytes.js +27 -6
  244. package/dist/vba/cfb-format.d.ts +55 -0
  245. package/dist/vba/cfb-format.js +35 -0
  246. package/dist/vba/cfb-writer.d.ts +8 -0
  247. package/dist/vba/cfb-writer.js +40 -40
  248. package/dist/vba/cfb.d.ts +21 -4
  249. package/dist/vba/cfb.js +124 -90
  250. package/dist/vba/codepage.js +2 -1
  251. package/dist/vba/dir-records.d.ts +6 -0
  252. package/dist/vba/dir-records.js +10 -2
  253. package/dist/vba/errors.d.ts +11 -4
  254. package/dist/vba/index.d.ts +0 -2
  255. package/dist/vba/index.js +0 -2
  256. package/dist/vba/ms-ovba.d.ts +6 -2
  257. package/dist/vba/ms-ovba.js +66 -22
  258. package/dist/vba/project-editor.js +129 -119
  259. package/dist/vba/project.d.ts +15 -1
  260. package/dist/vba/project.js +38 -13
  261. package/dist/vba/vba-encoding.d.ts +4 -10
  262. package/dist/vba/vba-encoding.js +3 -17
  263. package/dist/xml/xml-attrs.d.ts +37 -0
  264. package/dist/xml/xml-attrs.js +30 -0
  265. package/dist/xml/xml-chars.d.ts +40 -0
  266. package/dist/xml/xml-chars.js +12 -0
  267. package/dist/xml/xml-namespaces.d.ts +31 -0
  268. package/dist/xml/xml-namespaces.js +50 -0
  269. package/dist/xml/xml-read.d.ts +101 -11
  270. package/dist/xml/xml-read.js +150 -18
  271. package/dist/xml/xml-scan.d.ts +25 -34
  272. package/dist/xml/xml-scan.js +69 -46
  273. package/dist/xml/xml.d.ts +59 -26
  274. package/dist/xml/xml.js +45 -23
  275. package/package.json +15 -9
  276. package/skills/ts-xlsx-upstream/SKILL.md +21 -13
  277. package/dist/core/modern-functions.d.ts +0 -1
@@ -0,0 +1,88 @@
1
+ import { AuthoringError, quoted } from '../errors.js';
2
+ import { boundedRect, decodeRange, encodeAddress, encodeRect, tryDecodeRange, } from './address.js';
3
+ import { replaceContents } from './containers.js';
4
+ import { shiftRect } from './grid-shift.js';
5
+ export class HyperlinkOverlay {
6
+ #entries = [];
7
+ #rects = [];
8
+ add(link) {
9
+ const rect = boundedRect(decodeRange(link.ref));
10
+ if (rect === undefined) {
11
+ throw new AuthoringError(`hyperlink range ${quoted(link.ref)} names a whole row or column, not cells`);
12
+ }
13
+ const stored = storedLink(link, refOf(rect));
14
+ this.#removeRef(stored.ref);
15
+ this.#entries.push(stored);
16
+ this.#rects.push(rect);
17
+ }
18
+ remove(ref) {
19
+ const decoded = tryDecodeRange(ref);
20
+ const rect = decoded === undefined ? undefined : boundedRect(decoded);
21
+ return rect !== undefined && this.#removeRef(refOf(rect));
22
+ }
23
+ get entries() {
24
+ return this.#entries;
25
+ }
26
+ at(col, row) {
27
+ for (let index = this.#entries.length - 1; index >= 0; index--) {
28
+ const rect = this.#rects[index];
29
+ if (rect !== undefined &&
30
+ col >= rect.left &&
31
+ col <= rect.right &&
32
+ row >= rect.top &&
33
+ row <= rect.bottom) {
34
+ return this.#entries[index];
35
+ }
36
+ }
37
+ return undefined;
38
+ }
39
+ shift(splice) {
40
+ const entries = [];
41
+ const rects = [];
42
+ this.#entries.forEach((entry, index) => {
43
+ const rect = this.#rects[index];
44
+ const moved = rect === undefined ? undefined : shiftRect(rect, splice);
45
+ if (moved === undefined)
46
+ return;
47
+ const ref = refOf(moved);
48
+ entries.push(ref === entry.ref ? entry : storedLink(entry, ref));
49
+ rects.push(moved);
50
+ });
51
+ replaceContents(this.#entries, entries);
52
+ replaceContents(this.#rects, rects);
53
+ }
54
+ copyRow(from, to) {
55
+ const copies = this.#entries.flatMap((entry, index) => {
56
+ const rect = this.#rects[index];
57
+ return rect === undefined || rect.top !== from || rect.bottom !== from
58
+ ? []
59
+ : [storedLink(entry, refOf({ ...rect, top: to, bottom: to }))];
60
+ });
61
+ for (const copy of copies)
62
+ this.add(copy);
63
+ }
64
+ clear() {
65
+ this.#entries.length = 0;
66
+ this.#rects.length = 0;
67
+ }
68
+ #removeRef(ref) {
69
+ const index = this.#entries.findIndex((entry) => entry.ref === ref);
70
+ if (index === -1)
71
+ return false;
72
+ this.#entries.splice(index, 1);
73
+ this.#rects.splice(index, 1);
74
+ return true;
75
+ }
76
+ }
77
+ function refOf(rect) {
78
+ return rect.top === rect.bottom && rect.left === rect.right
79
+ ? encodeAddress(rect.left, rect.top)
80
+ : encodeRect(rect);
81
+ }
82
+ function storedLink(link, ref) {
83
+ return {
84
+ ref,
85
+ target: link.target,
86
+ ...(link.tooltip === undefined ? {} : { tooltip: link.tooltip }),
87
+ };
88
+ }
@@ -14,8 +14,9 @@ export interface AnchorPoint {
14
14
  * DPI-independent by construction: a pixel extent is a fixed physical size regardless of screen. */
15
15
  export declare const PX_TO_EMU = 9525;
16
16
  /** How a two-cell-anchored image tracks edits to the cells it spans. `twoCell` moves and resizes with
17
- * them; `oneCell` moves but keeps its size; `absolute` is pinned to the page and does neither. Excel
18
- * defaults to `oneCell` when the attribute is omitted. */
17
+ * them; `oneCell` moves but keeps its size; `absolute` is pinned to the page and does neither. The
18
+ * schema default, which a file omitting the attribute means, is `twoCell`; an image authored here
19
+ * without one is written as `oneCell`, which is this library's own default. */
19
20
  export type ImageEditAs = 'oneCell' | 'twoCell' | 'absolute';
20
21
  /** Narrow a raw `<xdr:twoCellAnchor editAs>` token to a known {@link ImageEditAs}. */
21
22
  export declare const isImageEditAs: (value: string) => value is ImageEditAs;
@@ -57,12 +58,42 @@ export type RowHeightLookup = (row: number) => number | undefined;
57
58
  * the column's size. An already-integer point keeps a zero offset (unless one was given). The two
58
59
  * lookups supply each column/row's size; a size they leave `undefined` falls back to Excel's default. */
59
60
  export declare function resolveAnchorPoint(point: AnchorPoint, columnWidth: ColumnWidthLookup, rowHeight: RowHeightLookup): AnchorPoint;
60
- /** An image pinned to a worksheet: which workbook media it shows (`imageId`) and where. */
61
- export interface AnchoredImage {
61
+ /**
62
+ * How much of a picture is cut away at each edge, as a fraction of the picture's own size: `0.1` crops
63
+ * a tenth, and a negative value pads the picture out. An absent edge is not cropped.
64
+ */
65
+ export interface ImageCrop {
66
+ readonly left?: number;
67
+ readonly top?: number;
68
+ readonly right?: number;
69
+ readonly bottom?: number;
70
+ }
71
+ /** Where clicking a picture goes: a URL, or a `#`-prefixed place in this workbook (`#Sheet1!C3`), as a
72
+ * sheet hyperlink's `target` spells one. */
73
+ export interface ImageHyperlink {
74
+ readonly target: string;
75
+ /** The text shown when the pointer rests on the picture. */
76
+ readonly tooltip?: string;
77
+ }
78
+ /** What a picture says about itself beyond which image it shows and where. */
79
+ export interface PictureProperties {
80
+ /** Alternative text: what a screen reader says in place of the picture. */
81
+ readonly description?: string;
82
+ /** The picture's title, shown with its alternative text. */
83
+ readonly title?: string;
84
+ readonly crop?: ImageCrop;
85
+ readonly hyperlink?: ImageHyperlink;
86
+ }
87
+ /** An image pinned to a worksheet: which workbook media it shows (`imageId`), where, and the picture's
88
+ * own properties. */
89
+ export interface AnchoredImage extends PictureProperties {
62
90
  /** Index into the workbook's media registry (the id {@link Workbook.addImage} returned). */
63
91
  readonly imageId: number;
64
92
  readonly anchor: ImageAnchor;
65
93
  }
94
+ /** The {@link PictureProperties} a value carries, and nothing else, so an image can be re-pinned or carried
95
+ * to another workbook without its alternative text, crop or link being left behind. */
96
+ export declare function pictureProperties(picture: PictureProperties): PictureProperties;
66
97
  /** A picture's bytes and its file kind, as held in the workbook's media registry. */
67
98
  export interface WorkbookImage {
68
99
  /** Lower-case file extension without a dot: `"png"`, `"jpeg"`, `"gif"`. Drives the media part's
@@ -85,7 +116,7 @@ export declare function normalizeImageExtension(extension: string | undefined, d
85
116
  * itself is what lets an anchor cross that boundary, which is why the transfer form carries bytes
86
117
  * where the stored form carries an id.
87
118
  */
88
- export interface PortableImage {
119
+ export interface PortableImage extends PictureProperties {
89
120
  readonly image: WorkbookImage;
90
121
  readonly anchor: ImageAnchor;
91
122
  }
@@ -99,15 +130,19 @@ export interface WorksheetImages {
99
130
  readonly background: WorkbookImage | undefined;
100
131
  }
101
132
  /**
102
- * The id under which `image` is already registered in `media`, or `undefined` if it is not.
133
+ * A picture's content identity as a map key: its kind, its length, and a digest of its bytes.
134
+ *
135
+ * **Content-addressed, not reference-addressed.** Two byte-identical pictures are one picture,
136
+ * however they reached the registry. That is what keeps repeated imports from growing the media list
137
+ * without bound, so the same logo carried onto twenty sheets registers once, and it is why identity
138
+ * cannot be object identity: a picture arriving from another workbook would never satisfy that.
103
139
  *
104
- * Content-addressed rather than reference-addressed: two byte-identical pictures are one picture,
105
- * however they reached the registry. This is what keeps repeated imports from growing the media
106
- * list without bound (the same logo carried onto twenty sheets registers once), and it is why the
107
- * comparison is over bytes rather than object identity, which a picture arriving from another
108
- * workbook would never satisfy.
140
+ * **A key rather than a scan**, which is the part that changed. The comparison used to walk the whole
141
+ * media list byte by byte per candidate, and importing a sheet's pictures asks it once per anchored
142
+ * image, so merging a workbook of fifty distinct megabyte images compared bytes fifty times over
143
+ * fifty candidates. The workbook indexes each picture as it is registered instead.
109
144
  *
110
- * The length check comes first and short-circuits, so pictures of different sizes never reach the
111
- * byte loop; only same-extension, same-length candidates are compared in full.
145
+ * SHA-512 rather than a cheap checksum because a collision here silently substitutes one picture for
146
+ * another; the length is in the key as well, so a collision would have to match that too.
112
147
  */
113
- export declare function findRegisteredImage(media: readonly WorkbookImage[], image: WorkbookImage): number | undefined;
148
+ export declare function imageContentKey(image: WorkbookImage): string;
@@ -1,3 +1,5 @@
1
+ import { hex } from '../hex.js';
2
+ import { sha512 } from '../sha512.js';
1
3
  import { tokenSet } from '../token-set.js';
2
4
  export const PX_TO_EMU = 9525;
3
5
  export const isImageEditAs = tokenSet({ oneCell: true, twoCell: true, absolute: true });
@@ -17,6 +19,15 @@ export function resolveAnchorPoint(point, columnWidth, rowHeight) {
17
19
  const rowOff = (point.rowOff ?? 0) + Math.round((point.row - row) * rowHeightEmu);
18
20
  return { col, row, colOff, rowOff };
19
21
  }
22
+ export function pictureProperties(picture) {
23
+ const { description, title, crop, hyperlink } = picture;
24
+ return {
25
+ ...(description === undefined ? {} : { description }),
26
+ ...(title === undefined ? {} : { title }),
27
+ ...(crop === undefined ? {} : { crop: { ...crop } }),
28
+ ...(hyperlink === undefined ? {} : { hyperlink: { ...hyperlink } }),
29
+ };
30
+ }
20
31
  const IMAGE_MAGIC = [
21
32
  { ext: 'png', sig: [0x89, 0x50, 0x4e, 0x47] },
22
33
  { ext: 'jpeg', sig: [0xff, 0xd8, 0xff] },
@@ -40,9 +51,9 @@ export function normalizeImageExtension(extension, data) {
40
51
  }
41
52
  return sniffImageExtension(data);
42
53
  }
43
- export function findRegisteredImage(media, image) {
44
- const index = media.findIndex((held) => held.extension === image.extension &&
45
- held.data.length === image.data.length &&
46
- held.data.every((byte, i) => byte === image.data[i]));
47
- return index === -1 ? undefined : index;
54
+ export function imageContentKey(image) {
55
+ let digest = '';
56
+ for (const byte of sha512(image.data))
57
+ digest += hex(byte, 2);
58
+ return `${image.extension}:${image.data.length}:${digest}`;
48
59
  }
@@ -1,6 +1,14 @@
1
1
  /**
2
- * Keys the codec-only operations on `Workbook` and `Worksheet` (see `WorkbookInternals` /
3
- * `WorksheetInternals`, declared beside their classes).
2
+ * Keys the operations the library's own machinery may perform on a published class and a caller may
3
+ * not (see `WorkbookInternals` / `WorksheetInternals`, declared beside their classes).
4
+ *
5
+ * Not only the model: `WorksheetStreamWriter` hangs its construction and its row-flush plumbing off
6
+ * the same key, on the static side and the instance side respectively, because that class has the
7
+ * identical problem one layer up. Its constructor took the writer's style registry and its
8
+ * `flushedSheet()` returned the writer's flushed-row record, so seven internal types were named by a
9
+ * published signature and none of them was a type a consumer could write down. `StreamedRow` is
10
+ * constructed through the same static key, because a row built outside its writer could commit, and
11
+ * so evict, a row number that writer never handed out.
4
12
  */
5
13
  export declare const INTERNAL: unique symbol;
6
14
  /**
@@ -28,3 +28,28 @@ export declare const MAX_ROW_HEIGHT = 409.5;
28
28
  * value for it is a bug rather than a shortcut.
29
29
  */
30
30
  export declare const MAX_COLUMN_WIDTH = 255;
31
+ /**
32
+ * The longest sheet name Excel accepts, in UTF-16 code units. A longer one is refused outright rather
33
+ * than truncated: a truncated name silently collides with its neighbours.
34
+ */
35
+ export declare const MAX_SHEET_NAME_LENGTH = 31;
36
+ /**
37
+ * The characters Excel forbids anywhere in a sheet name. A name may also not begin or end with an
38
+ * apostrophe, which this pattern does not express because the position is what makes it illegal: a
39
+ * sheet-qualified reference quotes the name with apostrophes, so one at either edge cannot be told
40
+ * from the quoting.
41
+ */
42
+ export declare const INVALID_SHEET_NAME_CHARS: RegExp;
43
+ /** The longest table name Excel accepts, in UTF-16 code units. */
44
+ export declare const MAX_TABLE_NAME_LENGTH = 255;
45
+ /**
46
+ * Excel's table-name grammar: start with a letter, underscore, or backslash; every later character a
47
+ * letter, digit, period, or underscore. Unicode letters and digits are allowed.
48
+ *
49
+ * The pattern is the grammar only. Excel also refuses a name that reads as a reference: an A1 cell on
50
+ * the grid (`T1`), an R1C1 reference (`R`, `C`, `RC`, `R1C1`, `R1X`), or `TRUE`/`FALSE`, in any case.
51
+ * No regular expression states that honestly, because "on the grid" is a bound on the column letters
52
+ * and the row number, so `Worksheet.addTable` checks it separately and a name passing this pattern
53
+ * can still be refused.
54
+ */
55
+ export declare const TABLE_NAME_PATTERN: RegExp;
@@ -1,2 +1,6 @@
1
1
  export const MAX_ROW_HEIGHT = 409.5;
2
2
  export const MAX_COLUMN_WIDTH = 255;
3
+ export const MAX_SHEET_NAME_LENGTH = 31;
4
+ export const INVALID_SHEET_NAME_CHARS = /[*?:\\/[\]]/;
5
+ export const MAX_TABLE_NAME_LENGTH = 255;
6
+ export const TABLE_NAME_PATTERN = /^[\p{L}\\_][\p{L}\p{N}._]*$/u;
@@ -1,7 +1,21 @@
1
1
  import { type GridRect } from './address.ts';
2
2
  import type { Cell } from './cell.ts';
3
+ import { type AxisSplice } from './grid-shift.ts';
3
4
  /** A merged region, as the {@link GridRect} every range-shaped thing in the library is. */
4
5
  export type MergeRect = GridRect;
6
+ /**
7
+ * Each merged range that overlaps a table, paired with the first table it overlaps. Excel forbids a
8
+ * merge inside a table: the writer refuses that geometry and the reader drops the merge, the repair
9
+ * Excel makes on load. Both used to spell the overlap test out by hand. The answer is a list of its
10
+ * own, so the reader can unmerge while it walks it rather than the live `sheet.merges`. An unbounded
11
+ * whole-row/column merge carries no rectangle and overlaps nothing.
12
+ */
13
+ export declare function mergesOverlappingTables<T extends {
14
+ readonly region: GridRect;
15
+ }>(merges: readonly string[], tables: readonly T[]): {
16
+ readonly merge: string;
17
+ readonly table: T;
18
+ }[];
5
19
  /**
6
20
  * Drop any value already sitting in a merge's covered non-anchor cells, keeping only the top-left
7
21
  * anchor, the collapse Excel performs on merge. A leftover covered value would serialise as a
@@ -15,12 +29,12 @@ export declare function clearCoveredValues(rows: Map<number, Map<number, Cell>>,
15
29
  * that can exist contributes no rectangle, the reader's rule for every other foreign attribute. */
16
30
  export declare function decodeSqrefRects(sqref: string): MergeRect[];
17
31
  /**
18
- * Re-anchor an OOXML `sqref` through a splice of `count` lines at `start` on `axis`, the inverse of
19
- * {@link decodeSqrefRects}. Returns `undefined` when the splice deleted every area the `sqref` named:
20
- * an empty `sqref` is not writable, so the entry holding it goes too.
32
+ * Re-anchor an OOXML `sqref` through a splice, the inverse of {@link decodeSqrefRects}. Returns
33
+ * `undefined` when the splice deleted every area the `sqref` named: an empty `sqref` is not
34
+ * writable, so the entry holding it goes too.
21
35
  *
22
36
  * Each space-separated area shifts on its own, and one the splice does not move is returned as the
23
37
  * *original text*. That matters for a file the library did not author: `B:B` and `B1:B1048576` decode
24
38
  * identically, so a re-encode would rewrite a foreign spelling and cost the byte-clean round trip.
25
39
  */
26
- export declare function shiftSqref(sqref: string, axis: 'row' | 'col', start: number, count: number, delta: number): string | undefined;
40
+ export declare function shiftSqref(sqref: string, splice: AxisSplice): string | undefined;
@@ -1,16 +1,29 @@
1
- import { encodeCornerRef, tryDecodeRange } from './address.js';
2
- import { isDeletedSpan, shiftIndex } from './grid-shift.js';
1
+ import { boundedRect, decodeRange, encodeCornerRef, rectsOverlap, tryDecodeRange, } from './address.js';
2
+ import { shiftSpan } from './grid-shift.js';
3
+ export function mergesOverlappingTables(merges, tables) {
4
+ const overlapping = [];
5
+ if (tables.length === 0)
6
+ return overlapping;
7
+ for (const merge of merges) {
8
+ const rect = boundedRect(decodeRange(merge));
9
+ if (rect === undefined)
10
+ continue;
11
+ const table = tables.find((candidate) => rectsOverlap(rect, candidate.region));
12
+ if (table !== undefined)
13
+ overlapping.push({ merge, table });
14
+ }
15
+ return overlapping;
16
+ }
3
17
  export function clearCoveredValues(rows, rect) {
4
- for (let row = rect.top; row <= rect.bottom; row++) {
5
- const cols = rows.get(row);
6
- if (cols === undefined)
18
+ for (const [row, cols] of rows) {
19
+ if (row < rect.top || row > rect.bottom)
7
20
  continue;
8
- for (let col = rect.left; col <= rect.right; col++) {
21
+ for (const [col, covered] of cols) {
22
+ if (col < rect.left || col > rect.right)
23
+ continue;
9
24
  if (row === rect.top && col === rect.left)
10
25
  continue;
11
- const covered = cols.get(col);
12
- if (covered !== undefined)
13
- covered.value = null;
26
+ covered.value = null;
14
27
  }
15
28
  }
16
29
  }
@@ -32,33 +45,33 @@ export function decodeSqrefRects(sqref) {
32
45
  }
33
46
  return rects;
34
47
  }
35
- export function shiftSqref(sqref, axis, start, count, delta) {
48
+ export function shiftSqref(sqref, splice) {
36
49
  const areas = [];
37
50
  for (const area of sqref.split(/\s+/)) {
38
51
  if (area === '')
39
52
  continue;
40
- const shifted = shiftSqrefArea(area, axis, start, count, delta);
53
+ const shifted = shiftSqrefArea(area, splice);
41
54
  if (shifted !== undefined)
42
55
  areas.push(shifted);
43
56
  }
44
57
  return areas.length > 0 ? areas.join(' ') : undefined;
45
58
  }
46
- function shiftSqrefArea(area, axis, start, count, delta) {
59
+ function shiftSqrefArea(area, splice) {
47
60
  const decoded = tryDecodeRange(area);
48
61
  if (decoded === undefined)
49
62
  return area;
50
63
  const { top, left, bottom, right } = decoded;
51
- const [lo, hi] = axis === 'row' ? [top, bottom] : [left, right];
64
+ const rowAxis = splice.axis === 'row';
65
+ const [lo, hi] = rowAxis ? [top, bottom] : [left, right];
52
66
  if (lo === undefined || hi === undefined)
53
67
  return area;
54
- if (isDeletedSpan(lo, hi, start, count))
68
+ const moved = shiftSpan(lo, hi, splice);
69
+ if (moved === undefined)
55
70
  return undefined;
56
- const movedLo = shiftIndex(lo, start, count, delta, axis);
57
- const movedHi = shiftIndex(hi, start, count, delta, axis);
58
- if (movedLo === lo && movedHi === hi)
71
+ if (moved.lo === lo && moved.hi === hi)
59
72
  return area;
60
- const [tl, br] = axis === 'row'
61
- ? [encodeCornerRef(left, movedLo), encodeCornerRef(right, movedHi)]
62
- : [encodeCornerRef(movedLo, top), encodeCornerRef(movedHi, bottom)];
73
+ const [tl, br] = rowAxis
74
+ ? [encodeCornerRef(left, moved.lo), encodeCornerRef(right, moved.hi)]
75
+ : [encodeCornerRef(moved.lo, top), encodeCornerRef(moved.hi, bottom)];
63
76
  return area.includes(':') ? `${tl}:${br}` : tl;
64
77
  }
@@ -60,13 +60,18 @@ export type PageSetupFacet = {
60
60
  readonly key: 'paperSize' | 'scale' | 'fitToWidth' | 'fitToHeight';
61
61
  /** A non-negative integer: a page count, a percentage, or a paper-size id. */
62
62
  readonly kind: 'count';
63
- } | {
64
- readonly key: 'pageOrder' | 'orientation';
63
+ } | PageSetupTokenFacet<'pageOrder', PageOrder> | PageSetupTokenFacet<'orientation', PageOrientation>;
64
+ /**
65
+ * An enumerated `<pageSetup>` attribute. One entry per key, each with a guard that narrows to that
66
+ * key's own union, so a reader holding the entry can assign what the guard accepted without a cast.
67
+ */
68
+ interface PageSetupTokenFacet<K extends keyof PageSetup, T extends string> {
69
+ readonly key: K;
65
70
  readonly kind: 'token';
66
71
  /** The enumeration guard, and what to call it in the error when a value fails it. */
67
- readonly isValid: (value: string) => boolean;
72
+ readonly isValid: (value: string) => value is T;
68
73
  readonly label: string;
69
- };
74
+ }
70
75
  /**
71
76
  * The six `<pageSetup>` attributes, declared once, in CT_PageSetup order. Both directions key off
72
77
  * this list, so an attribute written but not read (it survives a re-write and vanishes on load) or
@@ -127,17 +132,26 @@ export declare const PRINT_OPTION_FLAGS: readonly ["horizontalCentered", "vertic
127
132
  /** Compile-time proof that {@link PRINT_OPTION_FLAGS} covers every {@link PrintOptions} flag. */
128
133
  export type EveryPrintOptionFlagIsDeclared = AssertNever<Exclude<keyof PrintOptions, (typeof PRINT_OPTION_FLAGS)[number]>>;
129
134
  /**
130
- * A manual page break (`<brk>`). For a row break, `id` is the row the layout splits *before*; for a
131
- * column break it is the column. `max` bounds the break's extent across the other axis (Excel writes
132
- * the last row/column index) and `man` marks it author-set rather than automatic. The model preserves
133
- * whatever the source carried so a round-trip reproduces the break's span exactly.
135
+ * A page break (`<brk>`). It falls after line `id` and before line `id + 1`, rows for a row break and
136
+ * columns for a column break, which is how Excel counts it: a break Excel shows above row 20 is saved
137
+ * as `id="19"`. `min` and `max` bound its extent across the other axis, zero-based, and Excel writes
138
+ * only the whole axis (`max` 16383 for a row break). `man` marks an author-set break rather than one
139
+ * a producer recorded as automatic. The model keeps whatever the source carried.
140
+ *
141
+ * A row or column splice moves a break with the line after it and drops the break when that line is
142
+ * deleted, which is what Excel Desktop does: driven over COM, a manual break above row 10 moved above
143
+ * row 11 when a row was inserted at row 1, and went away when row 11 was then deleted, and a column
144
+ * break moved the same way. The extent is not moved, because the only one Excel writes is the whole
145
+ * axis, and a splice should leave that whole rather than shorten it by the lines it removed.
134
146
  */
135
147
  export interface PageBreak {
136
- /** The row (or column) the break precedes. */
148
+ /** The last row (or column) before the break. */
137
149
  readonly id: number;
138
- /** The break's far extent across the other axis, if the source declared one. */
150
+ /** The break's near extent across the other axis, zero-based, if the source declared one. */
151
+ readonly min?: number;
152
+ /** The break's far extent across the other axis, zero-based, if the source declared one. */
139
153
  readonly max?: number;
140
- /** `true` when the break is manual (author-set); Excel-authored breaks always are. */
154
+ /** Whether the break is manual. A break without it is written as a manual one: Excel stores no other kind. */
141
155
  readonly man?: boolean;
142
156
  }
143
157
  /**
@@ -176,3 +190,4 @@ export interface HeaderFooter {
176
190
  export declare const HEADER_FOOTER_ELEMENTS: readonly ["oddHeader", "oddFooter", "evenHeader", "evenFooter", "firstHeader", "firstFooter"];
177
191
  /** Compile-time proof that {@link HEADER_FOOTER_ELEMENTS} covers every {@link HeaderFooter} slot. */
178
192
  export type EveryHeaderFooterElementIsDeclared = AssertNever<Exclude<keyof HeaderFooter, (typeof HEADER_FOOTER_ELEMENTS)[number]>>;
193
+ export {};
@@ -1,3 +1,5 @@
1
+ import { type SheetSplice } from './formula-references.ts';
2
+ import { INTERNAL } from './internal.ts';
1
3
  import type { Worksheet } from './worksheet.ts';
2
4
  /** The aggregation a pivot's value field applies. These are OOXML's `ST_DataConsolidateFunction`
3
5
  * names verbatim, so a metric doubles as its `<dataField subtotal="…">` value. Excel performs the
@@ -27,13 +29,20 @@ export interface ParsedPivotSource {
27
29
  readonly kind: PivotSourceKind;
28
30
  readonly sheet: string;
29
31
  readonly ref: string;
32
+ /**
33
+ * Whether {@link sheet} and {@link ref} name a range in another workbook, which the cache reaches
34
+ * through a relationship. A row or column splice of this workbook moves the source of a pivot drawing
35
+ * from one of its own sheets, as Excel does, and never one of these.
36
+ */
37
+ readonly inAnotherWorkbook: boolean;
30
38
  }
31
39
  /** The semantic model reconstructed from a loaded pivot's `pivotTableDefinition` and its
32
40
  * `pivotCacheDefinition` (see `io/xlsx/read-pivot.ts`). Field roles are indices into {@link fields};
33
41
  * {@link metric} is the aggregation the value field applies. This mirrors the authoring model's shape
34
42
  * without requiring the source sheet it was built from, so a pivot loaded from a package is
35
43
  * inspectable data rather than an opaque preserved blob. It is a read-only view: the writer emits a
36
- * loaded pivot from its preserved parts, not from this model, so exposing it never double-emits. */
44
+ * loaded pivot from its preserved parts, not from this model, so exposing it never double-emits. A
45
+ * splice of the source sheet moves the source range in both, by {@link splicePivotSource}. */
37
46
  export interface ParsedPivotTable {
38
47
  readonly name: string;
39
48
  readonly cacheId: string;
@@ -49,7 +58,8 @@ export interface ParsedPivotTable {
49
58
  readonly metric: PivotMetric;
50
59
  }
51
60
  /** How a pivot table is authored: a source sheet and the header names that drive each axis.
52
- * `rows`/`columns`/`values` name columns by their header text in the source's first row. */
61
+ * `rows`/`columns`/`values` name columns by their header text in the source's first row, ignoring
62
+ * case, as the headers themselves must be unique ignoring case. */
53
63
  export interface PivotTableOptions {
54
64
  readonly source: Worksheet;
55
65
  readonly rows: readonly string[];
@@ -68,20 +78,25 @@ export type PivotItem = {
68
78
  } | {
69
79
  readonly kind: 'blank';
70
80
  };
71
- /** The numeric summary Excel expects on a non-shared field whose every present value is a number. */
81
+ /** The range and integrality of the numbers a cache field holds, which Excel records beside them. */
72
82
  export interface PivotNumericSummary {
73
83
  readonly allInteger: boolean;
74
84
  readonly min: number;
75
85
  readonly max: number;
76
86
  }
77
87
  /** One field of the pivot cache. An axis field (row or column) carries a `sharedItems` catalogue its
78
- * records reference by index; any other field stores its values inline in the records and, when they
79
- * are all numeric, describes them with a `numeric` summary. */
88
+ * records reference by index; any other field stores its values inline in the records. Either way the
89
+ * cache describes which kinds of value the field holds, because Excel reads the catalogue against that
90
+ * description: a catalogue of numbers that does not say it holds numbers opens with the repair prompt. */
80
91
  export interface PivotCacheField {
81
92
  readonly name: string;
82
93
  readonly sharedItems: readonly PivotItem[] | null;
83
- readonly numeric: PivotNumericSummary | null;
94
+ /** Whether any value is a string. */
95
+ readonly containsString: boolean;
96
+ /** Whether any value is missing. */
84
97
  readonly containsBlank: boolean;
98
+ /** The field's numbers, summarised, or `null` when it holds none. */
99
+ readonly numeric: PivotNumericSummary | null;
85
100
  }
86
101
  /** One cell of a cache record: an index into a shared-items catalogue, or an inline value. */
87
102
  export type PivotRecordCell = {
@@ -93,14 +108,15 @@ export type PivotRecordCell = {
93
108
  * the full cache (fields + records) and the axis-field wiring the renderer needs; nothing here
94
109
  * touches XML.
95
110
  *
96
- * Supported shape: exactly one value field aggregated by `sum`, at least one row field and one
97
- * column field. An unsupported request throws at authoring time rather than emitting a corrupt file.
111
+ * Supported shape: at least one row field and one column field, each source field on at most one
112
+ * axis and at most once, over a header row whose names are unique ignoring case; and exactly one value
113
+ * field, aggregated by any {@link PivotMetric} (`sum` by default), which may also be an axis field. An
114
+ * unsupported request throws at authoring time rather than emitting a corrupt file.
98
115
  */
99
116
  export declare class PivotTable {
117
+ #private;
100
118
  readonly metric: PivotMetric;
101
119
  readonly sourceSheetName: string;
102
- /** The `A1:C4` source range: the header row through the last data row, across the field columns. */
103
- readonly sourceRef: string;
104
120
  readonly cacheFields: readonly PivotCacheField[];
105
121
  readonly records: readonly (readonly PivotRecordCell[])[];
106
122
  /** Indices into {@link cacheFields} of the row-axis, column-axis, and value fields. */
@@ -108,6 +124,29 @@ export declare class PivotTable {
108
124
  readonly columnFields: readonly number[];
109
125
  readonly valueField: number;
110
126
  constructor(options: PivotTableOptions);
127
+ /**
128
+ * The `A1:C4` source range: the header row through the last data row, across the field columns.
129
+ *
130
+ * It moves with a row or column splice of the source sheet, as Excel moves a pivot's source: an
131
+ * insert inside it grows it and a delete shrinks it, while a delete that takes the whole range leaves
132
+ * it as it was. The cache captured at construction does not change; Excel rebuilds it from this range
133
+ * when it opens the file.
134
+ */
135
+ get sourceRef(): string;
136
+ /** What a splice does to the pivot's source; see `core/internal.ts`. */
137
+ readonly [INTERNAL]: PivotTableInternals;
111
138
  /** The value field's header name, used to label the aggregated data column ("Sum of Amount"). */
112
139
  get valueFieldName(): string;
113
140
  }
141
+ /**
142
+ * A pivot's worksheet source range on `sheet`, moved through a splice as Excel moves it: grown by an
143
+ * insert inside it, shrunk by a delete, and left as it was by a delete that takes every row or every
144
+ * column of it, which Excel does not turn into `#REF!`. A splice of another sheet leaves it too. The one
145
+ * rule for an authored pivot, a loaded pivot's view, and the preserved cache the writer edits.
146
+ */
147
+ export declare function splicePivotSource(sheet: string, ref: string, edit: SheetSplice): string;
148
+ /** What the library's own machinery may do to a {@link PivotTable}; reached as `pivot[INTERNAL]`. */
149
+ export interface PivotTableInternals {
150
+ /** Move the source range through a row or column splice, when the splice is of the source sheet. */
151
+ spliceSource(edit: SheetSplice): void;
152
+ }