@sheetxl/io-xlsx 0.8.0-beta.1 → 0.8.0-beta.11

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 (191) hide show
  1. package/browser/esm/BiDqExNXiY7ykk8E.mjs +2327 -0
  2. package/browser/esm/{Ctqql4O-3xj2K8vv.mjs → Bs0EzhdU8WgGfPzf.mjs} +193 -143
  3. package/browser/esm/CLWsOc6DO8l1G_LF.mjs +2213 -0
  4. package/browser/esm/{CLWzJJyoSrykkVLX.mjs → CZ9I80og75SDRjv0.mjs} +2 -2
  5. package/browser/esm/{Dz1Dp8DDJvhd09RR.mjs → CuAXx5i4uqTz-mMY.mjs} +1 -1
  6. package/browser/esm/Cv3R6fGatARKedSn.mjs +8635 -0
  7. package/browser/esm/{BkNXyG6NC-w5Xo92.mjs → CzFYJPxmLyKgEKF0.mjs} +28 -13
  8. package/browser/esm/DICL6ecj9BdJv8aX.mjs +104 -0
  9. package/browser/esm/DatIA9fZbEPjW4bh.mjs +5638 -0
  10. package/browser/esm/index.mjs +2 -3
  11. package/browser/esm/yveeVJ6hKDI5KDEz.mjs +4168 -0
  12. package/licenses/dependencies.txt +2 -2
  13. package/node/esm/B9Zn6H1RV07Ob377.mjs +2294 -0
  14. package/node/esm/Bpqm_PpGLpdjL47-.mjs +2368 -0
  15. package/node/esm/{fOnuUjpPCAzmuIXN.mjs → CAJxmJdobUbzpUz5.mjs} +2 -2
  16. package/node/esm/{CEV7nKotMpeRRnQC.mjs → CxlSbH7mmnEEsqmX.mjs} +1 -1
  17. package/node/esm/DD-yXSBzvDYy0TX5.mjs +5842 -0
  18. package/node/esm/DScqM1V4wPntNP6-.mjs +5235 -0
  19. package/node/esm/{CEAmv36xpTNgFwl_.mjs → fopiRR7OiVoEiF7B.mjs} +49 -35
  20. package/node/esm/index.mjs +77 -25
  21. package/node/esm/ipiyzn5Pfohw2afB.mjs +4271 -0
  22. package/package.json +7 -8
  23. package/types/src/AutoFilterRules.d.ts +94 -11
  24. package/types/src/ConditionalFormatRules.d.ts +5 -5
  25. package/types/src/DataValidationRules.d.ts +18 -2
  26. package/types/src/DefinedNameAttributes.d.ts +8 -0
  27. package/types/src/ExcelCalcStamp.d.ts +39 -0
  28. package/types/src/ExcelCompat.d.ts +209 -42
  29. package/types/src/ExcelReservedNames.d.ts +3 -4
  30. package/types/src/KnownFonts.d.ts +50 -0
  31. package/types/src/LegacyFormula.d.ts +41 -7
  32. package/types/src/OOXMLExtensions.d.ts +14 -2
  33. package/types/src/PageLayoutAttributes.d.ts +8 -0
  34. package/types/src/Plugin.d.ts +28 -5
  35. package/types/src/ProtectionAttributes.d.ts +38 -0
  36. package/types/src/SheetKinds.d.ts +57 -0
  37. package/types/src/SheetViewAttributes.d.ts +4 -0
  38. package/types/src/SortExtent.d.ts +16 -0
  39. package/types/src/SourcePackage.d.ts +31 -12
  40. package/types/src/Types.d.ts +28 -0
  41. package/types/src/XlsxHeader.d.ts +19 -0
  42. package/types/src/chart/ChartExXml.d.ts +38 -0
  43. package/types/src/chart/ChartPartXml.d.ts +47 -0
  44. package/types/src/chart/ChartSpaceXml.d.ts +36 -0
  45. package/types/src/chart/_XmlTree.d.ts +34 -0
  46. package/types/src/chart/_chartCodecs.d.ts +10 -0
  47. package/types/src/chart/_chartExCodecs.d.ts +7 -0
  48. package/types/src/chart/_chartExFold.d.ts +14 -0
  49. package/types/src/chart/_chartExMarkup.d.ts +236 -0
  50. package/types/src/chart/_chartExStyle.d.ts +22 -0
  51. package/types/src/chart/_codec.d.ts +78 -0
  52. package/types/src/chart/_drawingml.d.ts +10 -0
  53. package/types/src/chart/_xml.d.ts +70 -0
  54. package/types/src/reader/DocumentPropertiesRead.d.ts +16 -0
  55. package/types/src/reader/DummyFunctionUnwrap.d.ts +2 -2
  56. package/types/src/reader/HeaderStyles.d.ts +15 -0
  57. package/types/src/reader/HiddenFormulas.d.ts +16 -0
  58. package/types/src/reader/IsoDateCell.d.ts +20 -0
  59. package/types/src/reader/LibreOfficeDataTable.d.ts +11 -0
  60. package/types/src/reader/SlicerJoin.d.ts +24 -0
  61. package/types/src/reader/Warning.d.ts +29 -0
  62. package/types/src/reader/ZipReader.d.ts +1 -1
  63. package/types/src/reader/_SlicerRecord.d.ts +37 -0
  64. package/types/src/reader/dom/CustGeomUtils.d.ts +7 -0
  65. package/types/src/reader/dom/DOMTransformer.d.ts +2 -2
  66. package/types/src/reader/dom/ExecutionContext.d.ts +16 -3
  67. package/types/src/reader/dom/Types.d.ts +19 -3
  68. package/types/src/reader/domVisitors/AppPropertiesVisitor.d.ts +13 -1
  69. package/types/src/reader/domVisitors/AutoFilterVisitor.d.ts +16 -3
  70. package/types/src/reader/domVisitors/ColorContainerVisitor.d.ts +15 -2
  71. package/types/src/reader/domVisitors/CommentVisitor.d.ts +24 -2
  72. package/types/src/reader/domVisitors/CommentsVisitor.d.ts +2 -2
  73. package/types/src/reader/domVisitors/DrawingCxnSpVisitor.d.ts +1 -0
  74. package/types/src/reader/domVisitors/DrawingElementVisitor.d.ts +34 -1
  75. package/types/src/reader/domVisitors/DrawingGraphicFrameVisitor.d.ts +9 -0
  76. package/types/src/reader/domVisitors/DrawingGrpSpVisitor.d.ts +14 -2
  77. package/types/src/reader/domVisitors/DrawingPicVisitor.d.ts +30 -2
  78. package/types/src/reader/domVisitors/DrawingSpVisitor.d.ts +20 -1
  79. package/types/src/reader/domVisitors/DrawingVisitor.d.ts +10 -0
  80. package/types/src/reader/domVisitors/ExternalLinkVisitor.d.ts +21 -3
  81. package/types/src/reader/domVisitors/FmtSchemeVisitor.d.ts +4 -4
  82. package/types/src/reader/domVisitors/FontSchemeVisitor.d.ts +3 -2
  83. package/types/src/reader/domVisitors/FormControlPrVisitor.d.ts +9 -0
  84. package/types/src/reader/domVisitors/ObjectDefaultsVisitor.d.ts +11 -0
  85. package/types/src/reader/domVisitors/ShapeTextVisitor.d.ts +44 -0
  86. package/types/src/reader/domVisitors/SheetColorContainerVisitor.d.ts +3 -3
  87. package/types/src/reader/domVisitors/SheetStyleVisitor.d.ts +21 -6
  88. package/types/src/reader/domVisitors/SlicerCacheDefinitionVisitor.d.ts +7 -2
  89. package/types/src/reader/domVisitors/SlicersVisitor.d.ts +7 -3
  90. package/types/src/reader/domVisitors/SortStateVisitor.d.ts +2 -2
  91. package/types/src/reader/domVisitors/TextPropertiesVisitor.d.ts +13 -1
  92. package/types/src/reader/domVisitors/ThreadedCommentVisitor.d.ts +18 -1
  93. package/types/src/reader/domVisitors/ThreadedCommentsVisitor.d.ts +2 -2
  94. package/types/src/reader/domVisitors/WorkbookVisitor.d.ts +11 -1
  95. package/types/src/reader/domVisitors/_Dxfs.d.ts +10 -0
  96. package/types/src/reader/domVisitors/index.d.ts +6 -32
  97. package/types/src/reader/sax/LeanSaxParser.d.ts +58 -0
  98. package/types/src/reader/sax/SaxParser.d.ts +11 -1
  99. package/types/src/reader/sax/SaxVisitor.d.ts +3 -2
  100. package/types/src/reader/saxVisitors/ContentTypesVisitor.d.ts +9 -0
  101. package/types/src/reader/saxVisitors/SharedStringsVisitor.d.ts +46 -6
  102. package/types/src/reader/saxVisitors/WorksheetVisitor.d.ts +23 -11
  103. package/types/src/utils/DrawingMLText.d.ts +39 -0
  104. package/types/src/utils/FormControls.d.ts +170 -0
  105. package/types/src/utils/SharedNames.d.ts +13 -0
  106. package/types/src/utils/SpreadsheetFont.d.ts +38 -0
  107. package/types/src/utils/VmlNoteShapes.d.ts +128 -0
  108. package/types/src/utils/VmlNoteStyle.d.ts +44 -0
  109. package/types/src/utils/VmlPrefixes.d.ts +24 -0
  110. package/types/src/vba/VBAProject.d.ts +52 -4
  111. package/types/src/writer/builder/ContentTypes.d.ts +13 -0
  112. package/types/src/writer/builder/Emitter.d.ts +11 -6
  113. package/types/src/writer/builder/OpcXmlUtils.d.ts +2 -0
  114. package/types/src/writer/builder/PackageBuilder.d.ts +74 -22
  115. package/types/src/writer/builder/PartWriter.d.ts +5 -0
  116. package/types/src/writer/builder/RelationshipSet.d.ts +3 -0
  117. package/types/src/writer/builder/Types.d.ts +124 -38
  118. package/types/src/writer/builder/_Types.d.ts +17 -0
  119. package/types/src/writer/emitters/CommentsEmitter.d.ts +58 -0
  120. package/types/src/writer/emitters/DrawingEmitter.d.ts +2 -2
  121. package/types/src/writer/emitters/EmbeddedPartEmitter.d.ts +60 -0
  122. package/types/src/writer/emitters/ExternalLinkEmitter.d.ts +19 -0
  123. package/types/src/writer/emitters/LegacyDrawingEmitter.d.ts +18 -0
  124. package/types/src/writer/emitters/PersonsEmitter.d.ts +17 -0
  125. package/types/src/writer/emitters/PivotTableEmitter.d.ts +45 -0
  126. package/types/src/writer/emitters/PropsCoreEmitter.d.ts +7 -2
  127. package/types/src/writer/emitters/PropsCustomEmitter.d.ts +15 -0
  128. package/types/src/writer/emitters/SharedStringsEmitter.d.ts +6 -3
  129. package/types/src/writer/emitters/SlicerEmitter.d.ts +66 -0
  130. package/types/src/writer/emitters/StylesEmitter.d.ts +2 -2
  131. package/types/src/writer/emitters/TableEmitter.d.ts +14 -0
  132. package/types/src/writer/emitters/ThreadedCommentsEmitter.d.ts +27 -0
  133. package/types/src/writer/emitters/WorkbookEmitter.d.ts +21 -3
  134. package/types/src/writer/emitters/WorksheetEmitter.d.ts +4 -3
  135. package/types/src/writer/utils/AutoFilter.d.ts +3 -3
  136. package/types/src/writer/utils/CustGeomUtils.d.ts +5 -0
  137. package/types/src/writer/utils/DefaultRows.d.ts +38 -0
  138. package/types/src/writer/utils/DrawMLUtils.d.ts +57 -3
  139. package/types/src/writer/utils/DummyFunction.d.ts +0 -2
  140. package/types/src/writer/utils/DxfCollector.d.ts +14 -11
  141. package/types/src/writer/utils/HiddenFormulaXfs.d.ts +28 -0
  142. package/types/src/writer/utils/PrstGeomUtils.d.ts +6 -0
  143. package/types/src/writer/utils/SheetStyleLayout.d.ts +73 -0
  144. package/types/src/writer/utils/TextUtils.d.ts +26 -2
  145. package/types/src/writer/utils/UnsupportedFunctions.d.ts +2 -2
  146. package/browser/cjs/B6sirGz6w-Bm7Ofo.cjs +0 -1
  147. package/browser/cjs/B7_pDFYCVzt-3hUs.cjs +0 -1
  148. package/browser/cjs/BAtEL-5TLyoaPFDP.cjs +0 -2
  149. package/browser/cjs/Bg0e53JZa8vhmm5a.cjs +0 -1
  150. package/browser/cjs/CIpMN7SDVREKQUQE.cjs +0 -6
  151. package/browser/cjs/CK5FFUvet6FnIYO_.cjs +0 -5
  152. package/browser/cjs/D5Y4KQhKdukOkjvA.cjs +0 -2
  153. package/browser/cjs/DV6LeTEiiFUrZoxj.cjs +0 -1
  154. package/browser/cjs/DWkuoJSgvcXJTdN1.cjs +0 -1
  155. package/browser/cjs/Db8YjGM6TG34c8aT.cjs +0 -1
  156. package/browser/cjs/index.cjs +0 -1
  157. package/browser/cjs/xQ6-wbTw5UzZUM1Y.cjs +0 -1
  158. package/browser/esm/4BWLu134ABlCQEtM.mjs +0 -3655
  159. package/browser/esm/BzQ_lPzc8C4OTIGZ.mjs +0 -99
  160. package/browser/esm/CJknI8BYGSZr-4zS.mjs +0 -52
  161. package/browser/esm/Cok_fBIUCHDSrKw0.mjs +0 -2211
  162. package/browser/esm/D-m_kQLaewdwuXaF.mjs +0 -2685
  163. package/browser/esm/Dj7D2nVdAZ3TiUks.mjs +0 -4743
  164. package/browser/esm/ijQzHH-bvDfUHIi1.mjs +0 -24
  165. package/node/esm/CF1R5ovFsRNu--Rw.mjs +0 -3744
  166. package/node/esm/Ctcl4jN52INWpKWC.mjs +0 -2255
  167. package/node/esm/CvnRSooxEQdlJgMn.mjs +0 -2766
  168. package/node/esm/DQd0vxzTaPt2qSL-.mjs +0 -108
  169. package/node/esm/ssSlRCbCqxvZ9IX8.mjs +0 -2481
  170. package/types/src/legacyChart/OOXMLMappings.d.ts +0 -8
  171. package/types/src/legacyChart/OOXMLUtils.d.ts +0 -78
  172. package/types/src/legacyChart/ToOOXMLConverter.d.ts +0 -30
  173. package/types/src/reader/domVisitors/AxisVisitor.d.ts +0 -12
  174. package/types/src/reader/domVisitors/BarChartTypeVisitor.d.ts +0 -6
  175. package/types/src/reader/domVisitors/ChartSpaceVisitor.d.ts +0 -6
  176. package/types/src/reader/domVisitors/ChartTypeVisitor.d.ts +0 -7
  177. package/types/src/reader/domVisitors/ChartVisitor.d.ts +0 -7
  178. package/types/src/reader/domVisitors/DataLabelsVisitor.d.ts +0 -8
  179. package/types/src/reader/domVisitors/DataPointVisitor.d.ts +0 -6
  180. package/types/src/reader/domVisitors/HyperlinkVisitor.d.ts +0 -6
  181. package/types/src/reader/domVisitors/LayoutVisitor.d.ts +0 -5
  182. package/types/src/reader/domVisitors/LegendEntryVisitor.d.ts +0 -5
  183. package/types/src/reader/domVisitors/LegendVisitor.d.ts +0 -5
  184. package/types/src/reader/domVisitors/MarkerVisitor.d.ts +0 -5
  185. package/types/src/reader/domVisitors/NegativeShapeVisitor.d.ts +0 -6
  186. package/types/src/reader/domVisitors/PlotAreaVisitor.d.ts +0 -5
  187. package/types/src/reader/domVisitors/SeriesVisitor.d.ts +0 -8
  188. package/types/src/reader/domVisitors/TitleVisitor.d.ts +0 -9
  189. package/types/src/writer/emitters/ChartColorsEmitter.d.ts +0 -7
  190. package/types/src/writer/emitters/ChartEmitter.d.ts +0 -14
  191. package/types/src/writer/emitters/ChartStyleEmitter.d.ts +0 -46
@@ -0,0 +1,13 @@
1
+ import { ICell } from '@sheetxl/sdk';
2
+ /**
3
+ * Names the reader and the writer both spell, kept here so neither imports the other (they load as
4
+ * separate lazy chunks).
5
+ */
6
+ /**
7
+ * The `<ignoredError>` check attributes, in the schema's order (the order Excel writes them). Only
8
+ * these nine are Excel's; any other `ICell.ErrorCheck` is not written to xlsx.
9
+ */
10
+ export declare const IGNORED_ERROR_CHECKS: readonly ICell.ErrorCheck[];
11
+ /** The 2012 theme extension that names the theme's family (`thm15:themeFamily`). */
12
+ export declare const THEME_FAMILY_EXT_URI = "{05A4C25C-085E-4340-85A3-A5531E510DB2}";
13
+ //# sourceMappingURL=SharedNames.d.ts.map
@@ -0,0 +1,38 @@
1
+ import { IFont, IFontStyle, ITheme } from '@sheetxl/sdk';
2
+ /** Whether a family follows the theme. */
3
+ export declare function isThemeFamily(family: string | null | undefined): family is IFontStyle.ThemeFamily;
4
+ /** The model's family and fallbacks for a `<name>` (or `<rFont>`) and a `<scheme>`, in place. */
5
+ export declare function readFamily(font: {
6
+ family?: string;
7
+ fallbacks?: string[];
8
+ }, scheme: string | null | undefined): void;
9
+ /**
10
+ * The `<name>` and `<scheme>` a family is written as. A font that states no family is the theme's
11
+ * body font when it is a whole record (`whole`), and says nothing when it is differential. A theme
12
+ * font is named by the face cached for it, else by the theme's; with no `theme`, the name is the
13
+ * cached face alone.
14
+ */
15
+ export declare function writeFamily(family: string | undefined, fallbacks: readonly string[] | undefined, theme: ITheme | null, whole: boolean): {
16
+ name?: string;
17
+ scheme?: 'major' | 'minor';
18
+ };
19
+ /** The baseline a `vertAlign` stands for, or `undefined` for a value SpreadsheetML does not define. */
20
+ export declare function readBaseline(vertAlign: string | null | undefined): number | undefined;
21
+ /**
22
+ * The `vertAlign` a baseline is written as. A stated `0` is written as `baseline` only where the
23
+ * font is differential (a dxf, a run), where it undoes an inherited raise.
24
+ */
25
+ export declare function writeBaseline(baseline: number | null | undefined, differential: boolean): string | undefined;
26
+ /** The strike a `<strike>` toggle stands for. */
27
+ export declare function readStrike(on: boolean): IFont.StrikeStyle;
28
+ /** Whether a strike is written as `<strike/>`, or `undefined` when the font states none. */
29
+ export declare function writeStrike(strike: IFont.StrikeStyle | null | undefined): boolean | undefined;
30
+ /** The letter spacing `<condense/>` or `<extend/>` stands for, or `undefined` when it is off. */
31
+ export declare function readMacSpacing(name: 'condense' | 'extend', on: boolean): number | undefined;
32
+ /** The Macintosh style a letter spacing is written as, or `undefined` for none. */
33
+ export declare function writeMacSpacing(letterSpacing: number | null | undefined): 'condense' | 'extend' | undefined;
34
+ /** The underline a `<u val>` stands for; no `val` is a single underline. */
35
+ export declare function readUnderline(val: string | null | undefined): IFont.UnderlineStyle;
36
+ /** The `<u val>` an underline is written as, or `undefined` for none. */
37
+ export declare function writeUnderline(underline: IFont.UnderlineStyle | null | undefined): string | undefined;
38
+ //# sourceMappingURL=SpreadsheetFont.d.ts.map
@@ -0,0 +1,128 @@
1
+ import { NoteShapeStyle } from './VmlNoteStyle';
2
+ /** A note shape as read: its markup and the cell it was on. */
3
+ export interface NoteShape {
4
+ xml: string;
5
+ row: number;
6
+ col: number;
7
+ }
8
+ /**
9
+ * What a note shape says, apart from the cell it is on.
10
+ */
11
+ export interface NoteShapeBox {
12
+ /**
13
+ * The eight numbers of `<x:Anchor>`, or `null` when the shape has none that can be read.
14
+ */
15
+ anchor: number[] | null;
16
+ /**
17
+ * Where the `style` puts the box, in pixels from the sheet's top-left, when the shape has no
18
+ * anchor. Excel places such a box by its `style` alone: `margin-left` / `margin-top` and
19
+ * `width` / `height`, with no margin meaning 0 and no size meaning VML's 750pt.
20
+ */
21
+ bounds: {
22
+ x: number;
23
+ y: number;
24
+ width: number;
25
+ height: number;
26
+ } | null;
27
+ /** Whether the shape has `<x:Visible/>`: the box stays on the sheet. */
28
+ visible: boolean;
29
+ /** The shape's alternative text. */
30
+ alt: string | null;
31
+ /** The box's fill and line, where they are not Excel's default. */
32
+ style: NoteShapeStyle;
33
+ /**
34
+ * The shape without its id, position, cell, alternative text, fill or line, or `null` when
35
+ * that is Excel's default shape.
36
+ */
37
+ xml: string | null;
38
+ }
39
+ /**
40
+ * Where a note shape is written.
41
+ */
42
+ export interface NoteShapePlacement {
43
+ /** The number in `_x0000_s{n}`. */
44
+ shapeId: number;
45
+ zIndex: number;
46
+ /** 0-based. */
47
+ row: number;
48
+ /** 0-based. */
49
+ col: number;
50
+ /** The eight numbers of `<x:Anchor>`. */
51
+ anchor: readonly number[];
52
+ /** The box in pixels, for the `style` echo. */
53
+ bounds: {
54
+ x: number;
55
+ y: number;
56
+ width: number;
57
+ height: number;
58
+ };
59
+ visible: boolean;
60
+ alt?: string | null;
61
+ }
62
+ /**
63
+ * Splits the note shapes out of a VML part.
64
+ *
65
+ * @returns The part with the note shapes removed (`rest`), and the shapes with their cells.
66
+ * `rest` keeps the shapetype declarations, the control shapes and the closing root exactly as
67
+ * they were, so a part with no notes comes back byte for byte.
68
+ */
69
+ export declare function splitNoteShapes(xml: string): {
70
+ rest: string;
71
+ notes: NoteShape[];
72
+ };
73
+ /**
74
+ * Whether the part has any shape at all once its note boxes are taken out — a part that is only
75
+ * the root and the shapetype declarations has nothing left to say.
76
+ */
77
+ export declare function hasShapes(xml: string): boolean;
78
+ /**
79
+ * A note shape without what the model writes: its id, its anchor and the `style` that echoes
80
+ * it, its cell, whether it is shown and its alternative text. Whitespace between elements is
81
+ * dropped, so two shapes that say the same thing are the same string.
82
+ *
83
+ * @returns The markup, or `null` when it is not a shape.
84
+ */
85
+ export declare function normalizeNoteShape(xml: string): string | null;
86
+ /**
87
+ * The shape Excel gives a note that has not been formatted, normalized.
88
+ */
89
+ export declare const DEFAULT_NOTE_SHAPE: string;
90
+ /**
91
+ * Reads a note shape into what a note stores.
92
+ */
93
+ export declare function readNoteShape(xml: string): NoteShapeBox;
94
+ /** A pixel length in points, as Excel writes one: no trailing zeros. */
95
+ export declare const toPt: (px: number) => string;
96
+ /**
97
+ * A note shape for a comment: the markup it carries, or Excel's default, with its id, its
98
+ * position and its cell written in.
99
+ *
100
+ * @param markup A shape as {@link normalizeNoteShape} leaves it, or `null` for the default. One
101
+ * that was not normalized is normalized first.
102
+ */
103
+ export declare function writeNoteShape(markup: string | null | undefined, placement: NoteShapePlacement): string;
104
+ /**
105
+ * The largest shape number the part uses, so a written shape can take the next.
106
+ *
107
+ * @remarks
108
+ * A part with no shapes starts from the block its `<o:idmap>` claims: ids come in blocks of
109
+ * 1024, and Excel gives each sheet's drawing a block of its own.
110
+ */
111
+ export declare function maxShapeId(xml: string): number;
112
+ /** The shapetype every note box refers to, declared once per part. */
113
+ export declare const NOTE_SHAPETYPE = "<v:shapetype id=\"_x0000_t202\" coordsize=\"21600,21600\" o:spt=\"202\"\n path=\"m,l,21600r21600,l21600,xe\">\n <v:stroke joinstyle=\"miter\"/>\n <v:path gradientshapeok=\"t\" o:connecttype=\"rect\"/>\n </v:shapetype>";
114
+ /** An empty VML part, for a sheet whose notes have no drawing to be added to. */
115
+ export declare const EMPTY_LEGACY_DRAWING = "<xml xmlns:v=\"urn:schemas-microsoft-com:vml\"\n xmlns:o=\"urn:schemas-microsoft-com:office:office\"\n xmlns:x=\"urn:schemas-microsoft-com:office:excel\">\n <o:shapelayout v:ext=\"edit\">\n <o:idmap v:ext=\"edit\" data=\"1\"/>\n </o:shapelayout></xml>";
116
+ /**
117
+ * The part with shapes put back before the closing root: note boxes, or the shapes of another
118
+ * kind given its `shapetype`.
119
+ *
120
+ * @param lastShapeId The largest shape number among `shapes`, so the part can claim its block.
121
+ * @param shapetype The declaration `shapes` refer to; the note box's by default.
122
+ *
123
+ * @remarks
124
+ * The shapetype is declared once if any shape needs it and the part does not already declare
125
+ * it. A part that ends up with no shapes at all returns `null`: nothing to write.
126
+ */
127
+ export declare function assembleLegacyDrawing(rest: string | null, shapes: string[], lastShapeId?: number, shapetype?: string): string | null;
128
+ //# sourceMappingURL=VmlNoteShapes.d.ts.map
@@ -0,0 +1,44 @@
1
+ import { IColor, IFill, IStroke } from '@sheetxl/sdk';
2
+ /**
3
+ * A note box's fill and line: the VML of the note's `<v:shape>` and the model's
4
+ * {@link IFill.JSON} / {@link IStroke.JSON}, both ways.
5
+ *
6
+ * @remarks
7
+ * Probed with hidden COM (2026-10-20, `comments-probes/probe-note-format.ps1`). Excel writes the
8
+ * fill as `fillcolor` on the shape with its transparency as `<v:fill opacity>`, and no fill as
9
+ * `filled="f"` (the color left where it was). The line is `strokecolor`, `strokeweight` and
10
+ * `stroked="f"` on the shape, with the dash and the compound on `<v:stroke dashstyle linestyle>`.
11
+ * A color is a CSS color (`red`, `#cfc`), or a name and a palette index (`infoBackground [80]`);
12
+ * Excel refuses a theme color here, so one is written as the color it resolves to.
13
+ *
14
+ * A named VML dash draws the same lengths as the DrawingML preset it is mapped to (`shortdash`
15
+ * is `sysDash`, `3 1`), so a note draws the dash VML draws. Excel's own pairing through COM is
16
+ * not by length and is not followed.
17
+ *
18
+ * Only a solid fill is modeled. A gradient, pattern or picture fill (`<v:fill type>`) is left in
19
+ * the markup as it was read, and the box draws Excel's default fill.
20
+ */
21
+ /** A note box's fill and line, as the model states them. */
22
+ export interface NoteShapeStyle {
23
+ fill?: IFill.JSON;
24
+ stroke?: IStroke.JSON;
25
+ }
26
+ /**
27
+ * Reads a note shape's fill and line into the model's, and the markup with them restored to
28
+ * Excel's default, so the rest can be told apart from a shape that was never formatted.
29
+ *
30
+ * @param markup A normalized note shape.
31
+ */
32
+ export declare function readNoteStyle(markup: string): {
33
+ style: NoteShapeStyle;
34
+ markup: string;
35
+ };
36
+ /**
37
+ * A note shape with the model's fill and line written onto it: the inverse of
38
+ * {@link readNoteStyle}.
39
+ *
40
+ * @param markup A normalized note shape: what a note stored, or Excel's default.
41
+ * @param resolve Resolves a model color, a theme color included.
42
+ */
43
+ export declare function writeNoteStyle(markup: string, style: NoteShapeStyle, resolve: (color: string) => IColor): string;
44
+ //# sourceMappingURL=VmlNoteStyle.d.ts.map
@@ -0,0 +1,24 @@
1
+ /**
2
+ * A VML part's namespace prefixes brought to the ones Excel writes: `v`, `o` and `x`.
3
+ *
4
+ * @remarks
5
+ * Everything that reads a VML part (`VmlNoteShapes.ts`, `FormControls.ts`) matches it as text, by
6
+ * those three prefixes, because the part is not reliably XML: Excel's own leaves `<br>` unclosed
7
+ * inside a note's text box. A prefix is only a name for a namespace, though, and other writers pick
8
+ * their own. openpyxl serializes through ElementTree without registering any, so its note shapes
9
+ * arrive as `<ns0:shape xmlns:ns0="urn:schemas-microsoft-com:vml">`, with `ns0` naming a different
10
+ * namespace on the next element. Unrecognized, such a shape is carried through as foreign markup and
11
+ * no longer matches its note once a structural edit moves the note.
12
+ *
13
+ * So the part is rewritten once on read: each element and attribute prefix bound to one of the three
14
+ * namespaces takes the canonical name, the declarations that bound it are dropped, and the root
15
+ * declares the canonical three. Only declaring elements open a scope, so an unclosed tag cannot throw
16
+ * the bookkeeping off. A part that already uses the canonical prefixes comes back unchanged.
17
+ */
18
+ /**
19
+ * The part with every prefix bound to the VML, Office or Excel namespace renamed to `v`, `o` or
20
+ * `x`. Returned as given when there is nothing to rename, or when a canonical prefix is bound to a
21
+ * different namespace somewhere in it (renaming would then merge two namespaces).
22
+ */
23
+ export declare function canonicalizeVmlPrefixes(xml: string): string;
24
+ //# sourceMappingURL=VmlPrefixes.d.ts.map
@@ -12,12 +12,33 @@
12
12
  * compiled "performance cache" we skip) and decoded with the project code page.
13
13
  */
14
14
  export declare namespace VBAProject {
15
+ /**
16
+ * What kind of module this is (MS-OVBA `MODULETYPE`).
17
+ *
18
+ * @remarks
19
+ * The distinction is semantic, not cosmetic: only `procedural` modules contribute
20
+ * functions to the worksheet formula namespace. A UDF declared in a `document`
21
+ * module is unreachable from a formula.
22
+ *
23
+ * `document` is the spec's `0x0021`/`0x0022` split, so it is broader than its name:
24
+ * `0x0022` covers document modules **and** class and designer (UserForm) modules.
25
+ * Which object a `document` module belongs to — a sheet, the workbook, or nothing
26
+ * addressable — is answered by matching {@link Module.name} against code names, not
27
+ * by this field.
28
+ */
29
+ type ModuleType = 'procedural' | 'document';
15
30
  /** A single extracted VBA module. */
16
31
  interface Module {
17
32
  /** Module name as shown in the VBE project tree (e.g. `Module1`, `ThisWorkbook`). */
18
33
  name: string;
19
34
  /** Full source, including the leading `Attribute VB_*` lines Excel keeps hidden. */
20
35
  code: string;
36
+ /**
37
+ * Standard (`procedural`) module, or a document module bound to the workbook or
38
+ * a sheet. For a document module {@link Module.name} is the code name of the
39
+ * object it belongs to.
40
+ */
41
+ type: ModuleType;
21
42
  }
22
43
  interface Project {
23
44
  /** Code page declared by the project (e.g. 1252). */
@@ -25,7 +46,7 @@ export declare namespace VBAProject {
25
46
  modules: Module[];
26
47
  }
27
48
  /**
28
- * Extract all VBA modules from a raw `xl/vbaProject.bin`.
49
+ * Extract all VBA modules, with their source, from a raw `xl/vbaProject.bin`.
29
50
  *
30
51
  * The `dir` stream is a flat sequence of `Id(2) Size(4) Data(Size)` records,
31
52
  * **with one exception**: `PROJECTVERSION` (0x0009) stores a fixed reserved value
@@ -35,12 +56,39 @@ export declare namespace VBAProject {
35
56
  *
36
57
  * @param vbaProjectBin The bytes of the `xl/vbaProject.bin` part.
37
58
  * @returns The parsed project, or `null` if the bytes are not a compound file.
59
+ *
60
+ * @remarks
61
+ * Deliberately eager. A lazy variant existed briefly, deferring each module's stream until
62
+ * someone read it; measured on the corpus it saved **7µs** — the cost is the compound-file walk
63
+ * and the `dir` decompress, which happen either way, and the per-module streams are noise beside
64
+ * them. What it cost was a module JSON whose properties existed before their values did, which
65
+ * is not a trade worth making for microseconds.
38
66
  */
39
67
  const extract: (vbaProjectBin: Uint8Array | ArrayBuffer) => Project | null;
68
+ /** A module's source, separated into the part VBA hides and the part it shows. */
69
+ interface Source {
70
+ /**
71
+ * The leading `Attribute VB_*` block. Bookkeeping VBA hides from the editor, and not
72
+ * derivable from anything else — `VB_Base` names an interface GUID, `VB_PredeclaredId` and
73
+ * `VB_Exposed` are per-module settings — so it is kept rather than reconstructed.
74
+ */
75
+ header: string;
76
+ /** What the VBA editor displays. Empty for a document module nobody has written in. */
77
+ body: string;
78
+ }
40
79
  /**
41
- * Strip the leading hidden `Attribute VB_*` lines from a module's source so the
42
- * result matches what the VBA editor displays. Procedure-level `Attribute` lines
43
- * (indented, inside a `Sub`/`Function`) are left untouched.
80
+ * Split a module's source into its hidden `Attribute VB_*` header and the source proper.
81
+ *
82
+ * @remarks
83
+ * Only the leading module-level block is header. Procedure-level `Attribute` lines (indented,
84
+ * inside a `Sub`/`Function`) belong to the body — VBA hides those in the editor too, but they
85
+ * sit inside code and cannot be lifted out of it.
86
+ */
87
+ const splitAttributes: (code: string) => Source;
88
+ /**
89
+ * The source without its hidden `Attribute VB_*` header.
90
+ *
91
+ * @see {@link splitAttributes} to keep the header as well.
44
92
  */
45
93
  const stripAttributes: (code: string) => string;
46
94
  }
@@ -12,6 +12,19 @@ export declare class ContentTypes {
12
12
  constructor();
13
13
  addDefault(ext: string, contentType: string): void;
14
14
  addOverride(partName: string, contentType: string): void;
15
+ /**
16
+ * Change the content type already recorded for `partName`, keeping its position in the document.
17
+ *
18
+ * @remarks
19
+ * {@link addOverride} is first-wins, which is right for the emitters that race to declare a part.
20
+ * This is the deliberate exception: a *variant* of a part an emitter already claimed, decided
21
+ * only once the whole package is known. The workbook part is the case that needs it — whether it
22
+ * is `…spreadsheetml.sheet.main+xml` or `…ms-excel.sheet.macroEnabled.main+xml` depends on
23
+ * whether a VBA project ended up in the package, which no emitter can know while emitting.
24
+ *
25
+ * A no-op when `partName` has no override yet: this replaces a declaration, it never invents one.
26
+ */
27
+ replaceOverride(partName: string, contentType: string): void;
15
28
  toXmlBytes(): Uint8Array;
16
29
  }
17
30
  export declare const NS_CT = "http://schemas.openxmlformats.org/package/2006/content-types";
@@ -5,20 +5,25 @@ export declare abstract class Emitter<T = any> implements IEmitter<T> {
5
5
  protected _contentType: string;
6
6
  protected _relTypeUri: string;
7
7
  protected _path: string | ((instance: T) => string) | undefined;
8
+ protected _regeneratesRelationships: boolean;
8
9
  constructor(options: {
9
10
  kind: string;
10
11
  contentType: string;
11
12
  relTypeUri: string;
12
13
  path?: string | ((instance: T) => string);
14
+ /** {@inheritdoc IEmitter.regeneratesRelationships} */
15
+ regeneratesRelationships?: boolean;
13
16
  });
17
+ /** @inheritdoc IEmitter.regeneratesRelationships */
18
+ regeneratesRelationships(): boolean;
14
19
  /** @inheritdoc IEmitter.emit */
15
20
  abstract emit(instance: T, ctx: EmitContext): Promise<void> | void;
16
- /** @inheritdoc IEmitter.kind */
17
- get kind(): string;
18
- /** @inheritdoc IEmitter.contentType */
19
- get contentType(): string;
20
- /** @inheritdoc IEmitter.relTypeUri */
21
- get relTypeUri(): string;
21
+ /** @inheritdoc IEmitter.getKind */
22
+ getKind(): string;
23
+ /** @inheritdoc IEmitter.getContentType */
24
+ getContentType(_instance?: T): string;
25
+ /** @inheritdoc IEmitter.getRelTypeUri */
26
+ getRelTypeUri(_instance?: T): string;
22
27
  /** @inheritdoc IEmitter.getPath */
23
28
  getPath(instance: T): string;
24
29
  }
@@ -17,6 +17,8 @@ export interface SourceContentTypes {
17
17
  }
18
18
  export declare function parseContentTypesXml(bytes: Uint8Array): SourceContentTypes;
19
19
  export interface SourceRelationship {
20
+ /** The source's own `rId`, meaningful only to the part that declared it. */
21
+ readonly id: string;
20
22
  readonly type: string;
21
23
  /** Verbatim from the source XML — relative to the referencing part, exactly as OPC requires. */
22
24
  readonly target: string;
@@ -59,13 +59,38 @@ export declare class PackageBuilder<Out> {
59
59
  private _scheduledByNodeKey;
60
60
  private _nodesByPath;
61
61
  private _writtenPaths;
62
+ /** Claimed paths whose emitter regenerates every relationship ({@link IEmitter.regeneratesRelationships}). */
63
+ private _regeneratedPaths;
62
64
  private _partWriter;
63
65
  private _registry;
64
66
  private _options;
65
67
  private _sourcePackage;
68
+ /** See {@link PackageBuilderOptions.macroEnabled}. */
69
+ private _macroEnabled;
70
+ /** See {@link PackageBuilderOptions.template}. */
71
+ private _template;
66
72
  private _explicitRelTargets;
67
73
  private _mapState;
68
74
  constructor(zip: IZipBackend<Out>, registry: EmitterRegistry, options?: PackageBuilderOptions);
75
+ /**
76
+ * Whether a source part named `name` will be in this package once {@link _passthroughSourceParts}
77
+ * has run — the drop rules of `DESIGN-PACKAGE-PASSTHROUGH.md` §4, as one predicate. `false` when
78
+ * there is no source package or it has no such part.
79
+ *
80
+ * @remarks
81
+ * Does not consider whether an emitter claimed the *path* — that part is then in the package, but
82
+ * as the emitter's, not the source's. It does consider whether the reader took the part onto the
83
+ * model ({@link ISourcePackage.isAbsorbed}), which is a different question: the model writes that
84
+ * part wherever its own numbering puts it, which need not be where the source had it.
85
+ */
86
+ private _isSourcePartCarried;
87
+ /**
88
+ * Hold the source's own relationship ids back in `partPath`'s set, before the emitter rewriting
89
+ * that part allocates anything — see {@link IRelationshipSet.reserve}. The emitter's edges then
90
+ * go above them, and a source edge {@link _mergeSourceRelsInto} carries back in afterwards keeps
91
+ * its name, which is what a captured source fragment replayed inside the part still cites.
92
+ */
93
+ private _reserveSourceRelIds;
69
94
  /**
70
95
  * Wait for all scheduled parts to be emitted.
71
96
  */
@@ -88,13 +113,51 @@ export declare class PackageBuilder<Out> {
88
113
  */
89
114
  private _passthroughSourceParts;
90
115
  /**
91
- * Seed `sourcePart`'s {@link IRelationshipSet} with the source's edges: drop one whose target an
92
- * emitter already claimed (that emitter made its own, correct edge already — keeping both would
93
- * duplicate it), drop one whose target did not survive at all (§5), keep the rest verbatim. Always
94
- * allocates a fresh rId (never the source's) — the edge is what matters, not its name, and reusing
95
- * the source's `rIdN` strings would collide with whatever an emitter already allocated in this same
96
- * set. Targets are carried forward as-is (still relative to the same referencing part, at the same
97
- * OPC path) — nothing to recompute.
116
+ * Declare the workbook part's macro-enabled **variant** of `CT_Workbook` when the package being
117
+ * built is one — the difference between `…spreadsheetml.sheet.main+xml` and
118
+ * `…ms-excel.sheet.macroEnabled.main+xml`.
119
+ *
120
+ * @remarks
121
+ * `xl/workbook.xml` is emitter-claimed, and its emitter declares the plain variant unconditionally
122
+ * because macro-enabledness is not a property of the workbook — it is a property of the format
123
+ * being written to, which no emitter can see. Without this a macro workbook would be saved
124
+ * carrying a VBA project it no longer admits to: the payload preserved and every statement about
125
+ * it wrong.
126
+ *
127
+ * The decision is {@link PackageBuilderOptions.macroEnabled}, i.e. purely the resolved write
128
+ * format, and the **same flag also decides whether the project part is carried**
129
+ * ({@link _passthroughSourceParts}). Deriving both from one input is what makes it impossible for
130
+ * the declaration and the payload to disagree — the earlier attempt inferred the variant from the
131
+ * source package instead, which got an `.xlsm`-to-`.xlsx` export wrong in both halves at once.
132
+ *
133
+ * Independent of whether a project is actually present: a macro-enabled workbook containing no
134
+ * VBA at all is a legal thing for Excel to produce, and demoting it would silently change the
135
+ * file type the user asked for.
136
+ *
137
+ * Scoped to the workbook part on purpose. A blanket "source Override wins for claimed parts"
138
+ * would let a stale declaration through on anything.
139
+ */
140
+ private _applyWorkbookContentTypeVariant;
141
+ /**
142
+ * Seed `sourcePart`'s {@link IRelationshipSet} with the source's edges, each under the source's
143
+ * own id. Targets are carried forward as-is (still relative to the same referencing part, at the
144
+ * same OPC path) — nothing to recompute.
145
+ *
146
+ * @remarks
147
+ * Which edges come back depends on who wrote the part (`DESIGN-PACKAGE-PASSTHROUGH.md` §6):
148
+ *
149
+ * - A **preserved** part is the source's bytes, so its XML still cites the ids the source's
150
+ * `.rels` defined; every edge whose target is still in the package comes back with that id.
151
+ * Nothing else ever wrote into this set, so the ids are free.
152
+ * - A **rewritten** part (the root, or one an emitter claimed) had its emitter recreate the edges
153
+ * it cites, so only what the emitter did not recreate is added: not an edge whose target an
154
+ * emitter claimed (its own, correct edge exists already — keeping both would duplicate it), not
155
+ * one added by name through `addRelationship`. The set had the source's ids reserved before
156
+ * the emitter allocated ({@link _reserveSourceRelIds}), so these too keep their names —
157
+ * unless an emitter took the id as a hint for a different target, in which case it is fresh.
158
+ *
159
+ * An edge whose target did not survive at all is dropped either way (§5). A `TargetMode="External"`
160
+ * or `#`-fragment target is not a part and is never resolved as one.
98
161
  */
99
162
  private _mergeSourceRelsInto;
100
163
  /**
@@ -104,8 +167,8 @@ export declare class PackageBuilder<Out> {
104
167
  * @param instance The instance of the part to add.
105
168
  * @returns The path of the added root part.
106
169
  */
107
- addPart<T = any>(kind: string, instance: T, pathTemplate?: string): PackagePart;
108
- protected _addPartInternal<T = any>(currentPartPath: string, kind: string, instance: T, pathTemplate?: string): PackagePart;
170
+ addPart<T = any>(kind: string, instance: T, pathTemplate?: string, idHint?: string): PackagePart;
171
+ protected _addPartInternal<T = any>(currentPartPath: string, kind: string, instance: T, pathTemplate?: string, idHint?: string): PackagePart;
109
172
  /**
110
173
  * Add a binary to the package.
111
174
  *
@@ -119,19 +182,8 @@ export declare class PackageBuilder<Out> {
119
182
  * @remarks
120
183
  * Override is only used if the path is not a template
121
184
  */
122
- addBinary(bytes: Uint8Array, contentType: string, relTypeUri: string, pathTemplate: string, override?: boolean): PackagePart;
123
- protected _addBinaryInternal(currentPartPath: string, bytes: Uint8Array, contentType: string, relTypeUri: string, pathTemplate: string, override?: boolean): PackagePart;
124
- /**
125
- * Implements {@link EmitContext.forkPreservedPart}.
126
- *
127
- * @remarks
128
- * The collision domain for the new path includes every name the source package could still emit
129
- * via passthrough, not just what's already been written — `_passthroughSourceParts` (which is what
130
- * actually registers the *original* target's own path into {@link _writtenPaths}) only runs after
131
- * `waitEmit()` completes, so at fork time the source's own numbering (`chart2.xml` already existing
132
- * as an unrelated real chart, say) isn't visible there yet.
133
- */
134
- protected _forkPreservedPart(currentPartPath: string, sourcePartPath: string, contentType: string, relTypeUri: string, pathTemplate: string): PackagePart | null;
185
+ addBinary(bytes: Uint8Array, contentType: string, relTypeUri: string, pathTemplate: string, override?: boolean, idHint?: string): PackagePart;
186
+ protected _addBinaryInternal(currentPartPath: string, bytes: Uint8Array, contentType: string, relTypeUri: string, pathTemplate: string, override?: boolean, idHint?: string): PackagePart;
135
187
  protected _waitForDescendants(parentPath: string): Promise<void>;
136
188
  protected _processPart(node: Scheduled): Promise<void>;
137
189
  }
@@ -12,6 +12,11 @@ export declare class PartWriter<Out = any> implements IPartWriter<Out> {
12
12
  addContentType(path: string, contentType: string): void;
13
13
  /** @inheritdoc IPartWriter.addDefaultType */
14
14
  addDefaultType(extension: string, contentType: string): void;
15
+ /**
16
+ * Change the content type already declared for `path`. See {@link ContentTypes.replaceOverride} —
17
+ * this exists for a part whose *variant* is only decidable once the whole package is known.
18
+ */
19
+ replaceContentType(path: string, contentType: string): void;
15
20
  /** @inheritdoc IPartWriter.addPart */
16
21
  addPart(path: string, body: PartBody, contentType: string, options?: ZipAddOptions): void;
17
22
  /** @inheritdoc IPartWriter.rels */
@@ -3,6 +3,7 @@ export declare class RelationshipSet implements IRelationshipSet {
3
3
  readonly sourcePart: string;
4
4
  private rels;
5
5
  private usedIds;
6
+ private reservedIds;
6
7
  private nextId;
7
8
  constructor(sourcePart: string);
8
9
  /** @inheritdoc IRelationshipSet.add */
@@ -10,6 +11,8 @@ export declare class RelationshipSet implements IRelationshipSet {
10
11
  external?: boolean;
11
12
  idHint?: string;
12
13
  }): string;
14
+ /** @inheritdoc IRelationshipSet.reserve */
15
+ reserve(ids: Iterable<string>): void;
13
16
  /** @inheritdoc IRelationshipSet.list */
14
17
  list(): readonly IRelationship[];
15
18
  toXmlBytes(): Uint8Array;