@sheetxl/io-xlsx 0.8.0-beta.9 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/LICENSE.md +8 -7
  2. package/browser/esm/7rZlWcm56hn3Jmnk.mjs +7021 -0
  3. package/browser/esm/AZus_5slvoIVhf1u.mjs +10323 -0
  4. package/browser/esm/B9QfzGvsvg-V3utu.mjs +4632 -0
  5. package/browser/esm/{C-2KaUyV4gs-sDTZ.mjs → BIR_Si489gIkGOnc.mjs} +194 -144
  6. package/browser/esm/{DsSIg46AR7IFBN5N.mjs → BJFvc-i40R4rPZ5y.mjs} +939 -804
  7. package/browser/esm/{D-epcZSoKLbsAIaC.mjs → BX8Ebx4NC5zp7_3J.mjs} +3 -3
  8. package/browser/esm/{CxtFawTfwRTCC4Xr.mjs → Bnxw38IvtA04zXEE.mjs} +2 -2
  9. package/browser/esm/CfVhYH77KdrR3fEK.mjs +24 -0
  10. package/browser/esm/index.mjs +3 -4
  11. package/browser/esm/jIQks3Crw6jehdDU.mjs +2474 -0
  12. package/browser/esm/{CRrTMRdN_IcSA_pm.mjs → qc9hnuR2z-whY8YO.mjs} +3 -3
  13. package/browser/esm/wZGpmkMUubNjClhG.mjs +104 -0
  14. package/licenses/dependencies.txt +2 -2
  15. package/node/esm/{BsTMtvwpQoPNv95M.mjs → BNLHWJHyy5eB0P_4.mjs} +2 -2
  16. package/node/esm/CVtsY2F9A9NzEGLk.mjs +2478 -0
  17. package/node/esm/CoeQ0LO-nNXiowwv.mjs +7284 -0
  18. package/node/esm/CxY3iIYLXVhCebeV.mjs +4746 -0
  19. package/node/esm/D2CZy9TQM9h2uqBh.mjs +2562 -0
  20. package/node/esm/{BCr4lCI6qQXXN0K1.mjs → Dm0hvKcR4xb0TV_N.mjs} +3 -3
  21. package/node/esm/_IA1gQ-zFQYQSZSs.mjs +6957 -0
  22. package/node/esm/index.mjs +65 -28
  23. package/node/esm/{CBtj0-a4l2qux2hA.mjs → zZFe3mW0xjmobowq.mjs} +3 -3
  24. package/package.json +9 -10
  25. package/types/src/AutoFilterRules.d.ts +34 -44
  26. package/types/src/ConditionalFormatRules.d.ts +2 -2
  27. package/types/src/DataTableFormula.d.ts +26 -0
  28. package/types/src/DataValidationRules.d.ts +0 -5
  29. package/types/src/DefinedNameAttributes.d.ts +8 -0
  30. package/types/src/ExcelCalcStamp.d.ts +0 -36
  31. package/types/src/ExcelCompat.d.ts +15 -143
  32. package/types/src/ExcelFunctionFacts.d.ts +0 -272
  33. package/types/src/ExcelReservedNames.d.ts +0 -65
  34. package/types/src/KnownFonts.d.ts +37 -0
  35. package/types/src/LegacyFormula.d.ts +1 -46
  36. package/types/src/OOXMLExtensions.d.ts +24 -2
  37. package/types/src/PageLayoutAttributes.d.ts +8 -0
  38. package/types/src/Plugin.d.ts +15 -3
  39. package/types/src/ProtectionAttributes.d.ts +2 -2
  40. package/types/src/SheetKinds.d.ts +42 -0
  41. package/types/src/SheetViewAttributes.d.ts +4 -0
  42. package/types/src/SortExtent.d.ts +16 -0
  43. package/types/src/SourcePackage.d.ts +0 -44
  44. package/types/src/SparklineGroups.d.ts +52 -0
  45. package/types/src/Types.d.ts +13 -3
  46. package/types/src/XlsxHeader.d.ts +19 -0
  47. package/types/src/chart/ChartExXml.d.ts +38 -0
  48. package/types/src/chart/ChartPartXml.d.ts +47 -0
  49. package/types/src/chart/ChartSpaceXml.d.ts +37 -0
  50. package/types/src/chart/_XmlTree.d.ts +34 -0
  51. package/types/src/chart/_chartCodecs.d.ts +12 -0
  52. package/types/src/chart/_chartExCodecs.d.ts +7 -0
  53. package/types/src/chart/_chartExFold.d.ts +14 -0
  54. package/types/src/chart/_chartExMarkup.d.ts +236 -0
  55. package/types/src/chart/_chartExStyle.d.ts +13 -0
  56. package/types/src/chart/_codec.d.ts +78 -0
  57. package/types/src/chart/_drawingml.d.ts +10 -0
  58. package/types/src/chart/_xml.d.ts +70 -0
  59. package/types/src/pivot/PivotArea.d.ts +20 -0
  60. package/types/src/pivot/PivotCacheRead.d.ts +30 -0
  61. package/types/src/pivot/PivotCacheWrite.d.ts +23 -0
  62. package/types/src/pivot/PivotFilters.d.ts +29 -0
  63. package/types/src/pivot/PivotFormats.d.ts +60 -0
  64. package/types/src/pivot/PivotTableRead.d.ts +44 -0
  65. package/types/src/pivot/PivotTableWrite.d.ts +13 -0
  66. package/types/src/pivot/_PivotCacheXml.d.ts +48 -0
  67. package/types/src/pivot/_PivotTableXml.d.ts +23 -0
  68. package/types/src/reader/CellControls.d.ts +18 -0
  69. package/types/src/reader/DocumentPropertiesRead.d.ts +16 -0
  70. package/types/src/reader/DummyFunctionUnwrap.d.ts +43 -23
  71. package/types/src/reader/HeaderStyles.d.ts +15 -0
  72. package/types/src/reader/IsoDateCell.d.ts +20 -0
  73. package/types/src/reader/LibreOfficeDataTable.d.ts +12 -0
  74. package/types/src/reader/PivotButtons.d.ts +14 -0
  75. package/types/src/reader/PivotCellFormats.d.ts +22 -0
  76. package/types/src/reader/SlicerJoin.d.ts +26 -0
  77. package/types/src/reader/ZipReader.d.ts +1 -1
  78. package/types/src/reader/_SlicerRecord.d.ts +59 -0
  79. package/types/src/reader/dom/DOMTransformer.d.ts +2 -2
  80. package/types/src/reader/domVisitors/AppPropertiesVisitor.d.ts +13 -1
  81. package/types/src/reader/domVisitors/AutoFilterVisitor.d.ts +3 -11
  82. package/types/src/reader/domVisitors/ColorContainerVisitor.d.ts +8 -1
  83. package/types/src/reader/domVisitors/CommentVisitor.d.ts +2 -2
  84. package/types/src/reader/domVisitors/DrawingElementVisitor.d.ts +13 -6
  85. package/types/src/reader/domVisitors/DrawingGraphicFrameVisitor.d.ts +9 -0
  86. package/types/src/reader/domVisitors/DrawingGrpSpVisitor.d.ts +10 -7
  87. package/types/src/reader/domVisitors/DrawingPicVisitor.d.ts +22 -13
  88. package/types/src/reader/domVisitors/DrawingSpVisitor.d.ts +5 -5
  89. package/types/src/reader/domVisitors/DrawingVisitor.d.ts +4 -2
  90. package/types/src/reader/domVisitors/ExternalLinkVisitor.d.ts +1 -11
  91. package/types/src/reader/domVisitors/FeaturePropertyBagVisitor.d.ts +18 -0
  92. package/types/src/reader/domVisitors/FmtSchemeVisitor.d.ts +0 -11
  93. package/types/src/reader/domVisitors/FontSchemeVisitor.d.ts +3 -2
  94. package/types/src/reader/domVisitors/ObjectDefaultsVisitor.d.ts +11 -0
  95. package/types/src/reader/domVisitors/SheetColorContainerVisitor.d.ts +2 -2
  96. package/types/src/reader/domVisitors/SheetStyleVisitor.d.ts +26 -5
  97. package/types/src/reader/domVisitors/SlicerCacheDefinitionVisitor.d.ts +11 -2
  98. package/types/src/reader/domVisitors/SlicersVisitor.d.ts +9 -3
  99. package/types/src/reader/domVisitors/SortStateVisitor.d.ts +2 -2
  100. package/types/src/reader/domVisitors/ThreadedCommentsVisitor.d.ts +2 -2
  101. package/types/src/reader/domVisitors/TimelinesVisitor.d.ts +13 -0
  102. package/types/src/reader/domVisitors/WorkbookVisitor.d.ts +0 -9
  103. package/types/src/reader/domVisitors/_Dxfs.d.ts +10 -0
  104. package/types/src/reader/domVisitors/index.d.ts +6 -34
  105. package/types/src/reader/saxVisitors/ContentTypesVisitor.d.ts +1 -0
  106. package/types/src/reader/saxVisitors/SharedStringsVisitor.d.ts +31 -6
  107. package/types/src/reader/saxVisitors/WorksheetVisitor.d.ts +26 -8
  108. package/types/src/richValue/ErrorRichValueHandler.d.ts +22 -0
  109. package/types/src/richValue/IRichValueHandler.d.ts +109 -0
  110. package/types/src/richValue/LocalImageRichValueHandler.d.ts +18 -0
  111. package/types/src/richValue/RichDataParts.d.ts +69 -0
  112. package/types/src/richValue/RichRecordWriter.d.ts +61 -0
  113. package/types/src/richValue/RichValueHandlers.d.ts +25 -0
  114. package/types/src/richValue/RichValueResolver.d.ts +54 -0
  115. package/types/src/richValue/WebImageRichValueHandler.d.ts +37 -0
  116. package/types/src/richValue/index.d.ts +7 -0
  117. package/types/src/utils/DrawingMLText.d.ts +2 -2
  118. package/types/src/utils/FormControls.d.ts +79 -6
  119. package/types/src/utils/SharedNames.d.ts +13 -0
  120. package/types/src/utils/SpreadsheetFont.d.ts +38 -0
  121. package/types/src/utils/VmlNoteShapes.d.ts +25 -32
  122. package/types/src/utils/VmlNoteStyle.d.ts +25 -0
  123. package/types/src/utils/VmlPrefixes.d.ts +24 -0
  124. package/types/src/vba/VBAProject.d.ts +0 -19
  125. package/types/src/writer/EvaluationSheet.d.ts +5 -0
  126. package/types/src/writer/builder/OpcXmlUtils.d.ts +0 -8
  127. package/types/src/writer/builder/PackageBuilder.d.ts +2 -41
  128. package/types/src/writer/builder/Types.d.ts +18 -28
  129. package/types/src/writer/emitters/CommentsEmitter.d.ts +3 -3
  130. package/types/src/writer/emitters/DrawingEmitter.d.ts +2 -2
  131. package/types/src/writer/emitters/ExternalLinkEmitter.d.ts +0 -11
  132. package/types/src/writer/emitters/FeaturePropertyBagEmitter.d.ts +8 -0
  133. package/types/src/writer/emitters/LegacyDrawingEmitter.d.ts +4 -4
  134. package/types/src/writer/emitters/PivotTableEmitter.d.ts +30 -1
  135. package/types/src/writer/emitters/PropsCoreEmitter.d.ts +7 -2
  136. package/types/src/writer/emitters/PropsCustomEmitter.d.ts +15 -0
  137. package/types/src/writer/emitters/RichValuePartsEmitters.d.ts +36 -0
  138. package/types/src/writer/emitters/RichValueRelEmitter.d.ts +12 -0
  139. package/types/src/writer/emitters/RichValueStructureEmitter.d.ts +4 -3
  140. package/types/src/writer/emitters/RichValueTypesEmitter.d.ts +3 -2
  141. package/types/src/writer/emitters/RichValueWebImageEmitter.d.ts +24 -0
  142. package/types/src/writer/emitters/SharedStringsEmitter.d.ts +6 -3
  143. package/types/src/writer/emitters/SlicerEmitter.d.ts +132 -0
  144. package/types/src/writer/emitters/StylesEmitter.d.ts +35 -2
  145. package/types/src/writer/emitters/TableEmitter.d.ts +14 -0
  146. package/types/src/writer/emitters/WorkbookEmitter.d.ts +24 -2
  147. package/types/src/writer/emitters/WorksheetEmitter.d.ts +4 -3
  148. package/types/src/writer/utils/AutoFilter.d.ts +3 -3
  149. package/types/src/writer/utils/CellControlComplements.d.ts +29 -0
  150. package/types/src/writer/utils/DateSystem.d.ts +6 -0
  151. package/types/src/writer/utils/DefaultRows.d.ts +22 -0
  152. package/types/src/writer/utils/DrawMLUtils.d.ts +8 -6
  153. package/types/src/writer/utils/DummyFunction.d.ts +0 -25
  154. package/types/src/writer/utils/DxfCollector.d.ts +14 -11
  155. package/types/src/writer/utils/PrstGeomUtils.d.ts +11 -3
  156. package/types/src/writer/utils/RichValueCollector.d.ts +81 -129
  157. package/types/src/writer/utils/SheetStyleLayout.d.ts +86 -0
  158. package/types/src/writer/utils/TextUtils.d.ts +6 -1
  159. package/types/src/writer/utils/UnsupportedFunctions.d.ts +2 -2
  160. package/types/src/writer/utils/XfVariants.d.ts +61 -0
  161. package/browser/cjs/B0Ugu_crqQYpdfQz.cjs +0 -1
  162. package/browser/cjs/B6sirGz6w-Bm7Ofo.cjs +0 -1
  163. package/browser/cjs/BHM3_D9PsNURVAVy.cjs +0 -1
  164. package/browser/cjs/BHWdwAQ322YA8JAZ.cjs +0 -6
  165. package/browser/cjs/CeuX8p1aBuKTuagi.cjs +0 -2
  166. package/browser/cjs/D3EWCPfCu-qMOIGd.cjs +0 -1
  167. package/browser/cjs/DSM4q1dhVVXvsgby.cjs +0 -30
  168. package/browser/cjs/DiAHwNv2I8RHE9GY.cjs +0 -1
  169. package/browser/cjs/index.cjs +0 -1
  170. package/browser/cjs/wrpXlaSBGEicQf6_.cjs +0 -6
  171. package/browser/cjs/xQ6-wbTw5UzZUM1Y.cjs +0 -1
  172. package/browser/esm/Bu64BYvRAlVftMr1.mjs +0 -67
  173. package/browser/esm/CWt4fDYEbj2hvsl_.mjs +0 -3346
  174. package/browser/esm/Ccnxz-y2WBEgfvvh.mjs +0 -6498
  175. package/browser/esm/Dx64JMAGwNNDBkC1.mjs +0 -4928
  176. package/browser/esm/Sv4twwEJDb9dZ91h.mjs +0 -149
  177. package/node/esm/BPn5XBizKkwaUqXB.mjs +0 -4285
  178. package/node/esm/BVV11IlqF6Lmlv8D.mjs +0 -154
  179. package/node/esm/BiJEEgltJzx94zIR.mjs +0 -3433
  180. package/node/esm/CkmZuMvRTpva7eQu.mjs +0 -5074
  181. package/node/esm/j0RE2usgdljRw_gr.mjs +0 -2345
  182. package/types/src/legacyChart/OOXMLMappings.d.ts +0 -8
  183. package/types/src/legacyChart/OOXMLUtils.d.ts +0 -78
  184. package/types/src/legacyChart/ToOOXMLConverter.d.ts +0 -30
  185. package/types/src/reader/domVisitors/AxisVisitor.d.ts +0 -12
  186. package/types/src/reader/domVisitors/BarChartTypeVisitor.d.ts +0 -6
  187. package/types/src/reader/domVisitors/ChartSpaceVisitor.d.ts +0 -6
  188. package/types/src/reader/domVisitors/ChartTypeVisitor.d.ts +0 -7
  189. package/types/src/reader/domVisitors/ChartVisitor.d.ts +0 -7
  190. package/types/src/reader/domVisitors/DataLabelsVisitor.d.ts +0 -8
  191. package/types/src/reader/domVisitors/DataPointVisitor.d.ts +0 -6
  192. package/types/src/reader/domVisitors/LayoutVisitor.d.ts +0 -5
  193. package/types/src/reader/domVisitors/LegendEntryVisitor.d.ts +0 -5
  194. package/types/src/reader/domVisitors/LegendVisitor.d.ts +0 -5
  195. package/types/src/reader/domVisitors/MarkerVisitor.d.ts +0 -5
  196. package/types/src/reader/domVisitors/NegativeShapeVisitor.d.ts +0 -6
  197. package/types/src/reader/domVisitors/PlotAreaVisitor.d.ts +0 -5
  198. package/types/src/reader/domVisitors/RichValueDataVisitor.d.ts +0 -7
  199. package/types/src/reader/domVisitors/RichValueStructureVisitor.d.ts +0 -6
  200. package/types/src/reader/domVisitors/SeriesVisitor.d.ts +0 -8
  201. package/types/src/reader/domVisitors/TitleVisitor.d.ts +0 -9
  202. package/types/src/writer/emitters/ChartColorsEmitter.d.ts +0 -7
  203. package/types/src/writer/emitters/ChartEmitter.d.ts +0 -14
  204. package/types/src/writer/emitters/ChartStyleEmitter.d.ts +0 -46
  205. package/types/src/writer/utils/HiddenFormulaXfs.d.ts +0 -28
@@ -0,0 +1,54 @@
1
+ import { IRichData, Scalar } from '@sheetxl/sdk';
2
+ import { IRichValueReader } from './IRichValueHandler';
3
+ import { RichDataParts } from './RichDataParts';
4
+ /**
5
+ * The name base of a kind made from a supporting property bag structure. A rich value
6
+ * structure's kind is based on its `t`, which Excel never starts with `#`.
7
+ *
8
+ * @internal
9
+ */
10
+ export declare const BAG_KIND_BASE = "#spb";
11
+ /**
12
+ * Excel's reserved presentation keys: read into {@link IRichMeta}, not held as values. The kind
13
+ * still declares them, in file order, so a value is written back with the structure it was read
14
+ * with.
15
+ *
16
+ * - `_Display`: the card (`^Order`, `TitleProperty`, `SubTitleProperty`), for the kind.
17
+ * - `_Icon`: the icon, for the kind.
18
+ * - `_Flags`: per property, where it is not offered (`ShowInCardView`, …).
19
+ * - `_Format`: per property, a `richStyles` entry (1-based): number format, title, hero image.
20
+ * - `_SubLabel`: per property, its caption.
21
+ *
22
+ * @internal
23
+ */
24
+ export declare const META_KEYS: ReadonlySet<string>;
25
+ /**
26
+ * A property name as a bag key names it. Excel escapes a key that starts with a reserved character
27
+ * (`%`, `^`, a backtick) with a backtick: the `_Flags` bag names `%ProviderInfo` as `` `%ProviderInfo ``.
28
+ *
29
+ * @internal
30
+ */
31
+ export declare const unescapeBagKey: (key: string) => string;
32
+ /** A property name as a bag key, escaped as Excel escapes it ({@link unescapeBagKey}). @internal */
33
+ export declare const escapeBagKey: (name: string) => string;
34
+ /** What one file's rich values read as, by `<rv>` index. @internal */
35
+ export interface RichValueResolver {
36
+ /** The value a cell naming `<rv>` `index` holds: an error, a rich value's JSON, or `undefined`. */
37
+ cellValue(index: number): Scalar | IRichData.JSON | undefined;
38
+ }
39
+ /**
40
+ * Reads a file's rich values into cell values.
41
+ *
42
+ * @remarks
43
+ * A structure a handler reads (`_error`, `_webimage`, `_localImage`) is read by it. Every other
44
+ * structure is a {@link RichRecord} of a kind made from the structure; supporting property bags
45
+ * become records of their own, Excel's presentation keys ({@link META_KEYS}) become meta, and an
46
+ * entity's two forms are one value: a cell holds the full record (Excel's `_linkedentity` names it
47
+ * by `%cvi`; a `_linkedentity2` stub matches its `_linkedentity2core` by identity), and a nested
48
+ * entity with no full record holds its stub. A `_formattednumber` inside a record is a number,
49
+ * its format the property's.
50
+ *
51
+ * @internal
52
+ */
53
+ export declare const createRichValueResolver: (parts: RichDataParts, readers: ReadonlyMap<string, IRichValueReader>, warn: (message: string) => void) => RichValueResolver;
54
+ //# sourceMappingURL=RichValueResolver.d.ts.map
@@ -0,0 +1,37 @@
1
+ import { IResource } from '@sheetxl/sdk';
2
+ import { IRichValueHandler, RichValueReadContext } from './IRichValueHandler';
3
+ /** The part listing the pictures `_webimage` rich values name, by position. */
4
+ export declare const WEB_IMAGES_PART = "/xl/richData/rdRichValueWebImage.xml";
5
+ /** One `<webImageSrd>`: where a picture came from, and the picture Excel kept. */
6
+ export interface WebImage {
7
+ /** The source URL (`address`), or `null` when the file names none. */
8
+ source: string | null;
9
+ /** The kept picture (`blip`), or `null`. */
10
+ bytes: ArrayBuffer | null;
11
+ }
12
+ /** A picture a `_webimage` written names: its source, and the resource holding its bytes. */
13
+ export interface WrittenWebImage {
14
+ source: string;
15
+ resource: IResource | null;
16
+ }
17
+ /**
18
+ * The pictures of rdRichValueWebImage.xml, in file order: a `_webimage`'s `WebImageIdentifier`
19
+ * indexes this list. Empty when the part is absent.
20
+ */
21
+ export declare const readWebImages: (ctx: RichValueReadContext) => WebImage[];
22
+ export declare const calcOriginOf: (formula: string | null) => number;
23
+ /**
24
+ * Excel's `_webimage` structure: a picture as a cell value (`IMAGE`), read as and written from an
25
+ * `image` value.
26
+ *
27
+ * @remarks
28
+ * The structure names its picture by position in rdRichValueWebImage.xml, which holds the source
29
+ * URL (`address`, an external hyperlink) and the picture Excel kept for it (`blip`, a media part).
30
+ * Reading adds each picture to the workbook as the resource its values hold; writing takes the
31
+ * bytes from the value's resource, else the workbook's fetch. Alt text, height and width have no
32
+ * key: Excel's file for them is unprobed.
33
+ *
34
+ * @internal
35
+ */
36
+ export declare const WebImageRichValueHandler: IRichValueHandler;
37
+ //# sourceMappingURL=WebImageRichValueHandler.d.ts.map
@@ -0,0 +1,7 @@
1
+ export * from './IRichValueHandler';
2
+ export * from './RichValueHandlers';
3
+ export { WEB_IMAGES_PART } from './WebImageRichValueHandler';
4
+ export * from './RichDataParts';
5
+ export * from './RichValueResolver';
6
+ export * from './RichRecordWriter';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -23,9 +23,9 @@ export declare const fontAlignment: Vocabulary<IText.FontAlignment>;
23
23
  /** `bodyPr/@anchor`. */
24
24
  export declare const anchor: Vocabulary<ITextFrame.VerticalAlignment>;
25
25
  /** `rPr/@u`. */
26
- export declare const underline: Vocabulary<IText.UnderlineStyle>;
26
+ export declare const underline: Vocabulary<IFont.UnderlineStyle>;
27
27
  /** `rPr/@strike`. */
28
- export declare const strike: Vocabulary<IText.StrikeStyle>;
28
+ export declare const strike: Vocabulary<IFont.StrikeStyle>;
29
29
  /** `bodyPr/@vert`. */
30
30
  export declare const writingMode: Vocabulary<ITextFrame.WritingMode>;
31
31
  /** `bodyPr/@vertOverflow` and `@horzOverflow`. */
@@ -1,4 +1,4 @@
1
- import { IFormControl, ICaptioned, ISheet, ITextFrame } from '@sheetxl/sdk';
1
+ import { IFormControl, ICaptioned, IAnchored, Bounds, IMovable, IWorksheet, ITextFrame } from '@sheetxl/sdk';
2
2
  /**
3
3
  * A form control as Excel stores it, in and out of the model's form-control content types.
4
4
  *
@@ -7,9 +7,14 @@ import { IFormControl, ICaptioned, ISheet, ITextFrame } from '@sheetxl/sdk';
7
7
  * and what it holds; a shape in the sheet's VML draws it for Excel 2007; and a hidden `<xdr:sp>`
8
8
  * in the drawing part — the *twin*, joined to the control by `a14:compatExt/@spid` — carries the
9
9
  * caption and its font for Excel 2010 and later. The model holds one content per control, typed
10
- * by kind ({@link IFormControl.Type}), and this module turns it into, and out of, the first and
11
- * the third. The VML shape is still replayed as it was read (`withControlAnchors`), with the
12
- * cells of its anchor rewritten from the movable.
10
+ * by kind ({@link IFormControl.Type}), and this module turns it into, and out of, all three.
11
+ *
12
+ * Excel 2010 and later read only the `<controls>` entry, the part and the twin: the VML shape is
13
+ * an echo they ignore and regenerate (its `<x:Checked>`, its caption, even its absence). So the
14
+ * shape is never carried: the reader takes it out of the sheet's VML, and the writer draws a new
15
+ * one from the model for the consumers that still read it (Excel 2007, LibreOffice). A file
16
+ * Excel 2007 wrote has no part and no `<controls>` entry at all, only the shape; that shape is
17
+ * read into a control ({@link readControlShape}) and written back in all three forms.
13
18
  */
14
19
  /** The x14 namespace the `ctrlProp` part declares. */
15
20
  export declare const NS_FORM_CONTROL = "http://schemas.microsoft.com/office/spreadsheetml/2009/9/main";
@@ -65,8 +70,12 @@ export declare function readControlTwin(text: ITextFrame.JSON | undefined): Cont
65
70
  * The twin is read as a hidden shape of its own (`DrawingSpVisitor`, which marks it with
66
71
  * {@link ControlTwinMarks}); here it becomes the control's caption and font, and is written back
67
72
  * from those (`controlTwinShape`). A twin whose control was not read stays the hidden shape it was.
73
+ *
74
+ * A twin inside a group is the control's place in it: Excel draws a grouped control at its twin's
75
+ * frame in the group, and its `<controls>` anchor only restates that on the sheet. So the member
76
+ * becomes the control, and the control read from `<controls>` leaves the sheet.
68
77
  */
69
- export declare function absorbControlTwins(sheet: ISheet.JSON): void;
78
+ export declare function absorbControlTwins(sheet: IWorksheet.JSON): void;
70
79
  /**
71
80
  * The hidden `<xdr:sp>` the drawing part carries for a control, written from the model.
72
81
  *
@@ -74,8 +83,33 @@ export declare function absorbControlTwins(sheet: ISheet.JSON): void;
74
83
  * Hidden, so the drawing layer never shows it; its `cNvPr/@id` is the shape id, as Excel's own
75
84
  * is. The caption's font is restated as Excel restates it: size, weight and style on the run,
76
85
  * the color as a solid fill, the family as `latin`.
86
+ *
87
+ * On the sheet the twin hangs from its anchor and states no frame; in a group it is the control's
88
+ * place in the group, so `frame` (pixels, in the group's child space) is written.
89
+ */
90
+ export declare function controlTwinShape(type: string, json: IFormControl.JSON, name: string | undefined, frame?: Bounds): string;
91
+ /**
92
+ * A control the sheet writes, wherever it is: on the sheet, or a member of a group, with where
93
+ * it sits in cells.
94
+ */
95
+ export interface SheetControl {
96
+ /** The control's movable, as the sheet's JSON or its group's holds it. */
97
+ jsonMovable: IMovable.JSON;
98
+ /** Its corners in cells. */
99
+ anchor: IMovable.AnchorOffset;
100
+ /** How it moves and sizes with its cells. */
101
+ anchorType: IAnchored.Type;
102
+ }
103
+ /**
104
+ * The sheet's controls, each in its `<controls>` place.
105
+ *
106
+ * @remarks
107
+ * A control on the sheet is where its anchor says. A grouped control is wherever its group draws
108
+ * it, which only the live model knows, so its corners are found from its drawn bounds; it moves
109
+ * and sizes as its group does. The JSON's movables are the sheet's (less notes) in order, and a
110
+ * group's members its own, in order.
77
111
  */
78
- export declare function controlTwinShape(type: string, json: IFormControl.JSON, name: string | undefined): string;
112
+ export declare function sheetControls(sheet: IWorksheet, json: IWorksheet.JSON): SheetControl[];
79
113
  /** The attributes an `mc:AlternateContent` around a twin's anchor declares. */
80
114
  export declare const TWIN_ALTERNATE_CONTENT_ATTRIBUTES: {
81
115
  'xmlns:mc': string;
@@ -94,4 +128,43 @@ export declare function isVmlControlShape(shape: string): boolean;
94
128
  * to drop it. Shapes that draw something else are left as they are.
95
129
  */
96
130
  export declare function mapVmlControlShapes(xml: string, update: (shape: string, shapeId: number | null) => string | null): string;
131
+ /** The shapetype every control shape refers to, declared once per part. */
132
+ export declare const CONTROL_SHAPETYPE = "<v:shapetype id=\"_x0000_t201\" coordsize=\"21600,21600\" o:spt=\"201\"\n path=\"m,l,21600r21600,l21600,xe\">\n <v:stroke joinstyle=\"miter\"/>\n <v:path shadowok=\"f\" o:extrusionok=\"f\" strokeok=\"f\" fillok=\"f\" o:connecttype=\"rect\"/>\n <o:lock v:ext=\"edit\" shapetype=\"t\"/>\n </v:shapetype>";
133
+ /**
134
+ * Where a control shape is written.
135
+ */
136
+ export interface ControlShapePlacement {
137
+ /** The number in `_x0000_s{n}`: the control's own shape id. */
138
+ shapeId: number;
139
+ zIndex: number;
140
+ /** The eight numbers of `<x:Anchor>`. */
141
+ anchor: readonly number[];
142
+ /** The control in pixels, for the `style` echo. */
143
+ bounds: Bounds;
144
+ anchorType: IAnchored.Type;
145
+ }
146
+ /**
147
+ * The VML shape that draws a control for the consumers that still read one, written from the
148
+ * model.
149
+ *
150
+ * @remarks
151
+ * Excel's own spelling, child for child, of a control it draws fresh. `<x:MoveWithCells/>` and
152
+ * `<x:SizeWithCells/>` are inverted in VML: present means the control does *not* follow its
153
+ * cells. Returns `null` for a kind the VML has no name for.
154
+ */
155
+ export declare function writeControlShape(type: string, control: IFormControl.JSON, placement: ControlShapePlacement): string | null;
156
+ /**
157
+ * A control read from its VML shape alone, as Excel 2007 stores one: no part, no `<controls>`
158
+ * entry. `null` when the shape is not a control or names no anchor.
159
+ *
160
+ * @remarks
161
+ * The anchor's offsets are the authoring machine's pixels and are taken as they are.
162
+ */
163
+ export declare function readControlShape(shape: string, shapeId: number | null): IMovable.JSON | null;
164
+ /**
165
+ * Takes every control shape out of the sheet's VML: a shape whose control was read from the
166
+ * sheet is dropped (the writer draws a new one), and one with no control is read into one
167
+ * ({@link readControlShape}). A part left with no shapes is dropped with them.
168
+ */
169
+ export declare function absorbControlShapes(sheet: IWorksheet.JSON): void;
97
170
  //# sourceMappingURL=FormControls.d.ts.map
@@ -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
@@ -1,28 +1,4 @@
1
- /**
2
- * The note boxes in a sheet's VML drawing: finding them, keeping them apart from the control
3
- * shapes that share the part, reading each into what a note stores, and writing one for every
4
- * comment.
5
- *
6
- * @remarks
7
- * A note's box is a `<v:shape>` whose `<x:ClientData ObjectType="Note">` names its cell in
8
- * `<x:Row>`/`<x:Column>` (0-based), and its corners in `<x:Anchor>` as four cell/offset pairs
9
- * (left cell, left offset, top cell, top offset, right cell, right offset, bottom cell, bottom
10
- * offset). Nothing else in the VML names a note, so the cell is the join to the comment.
11
- *
12
- * The anchor alone places a box (the `style` margins are an echo Excel regenerates), and
13
- * `<x:Visible/>` alone shows it. So a shape is read into those two and the rest of its markup,
14
- * and what is left is the same for every note Excel made and never formatted. That markup is kept
15
- * only when it is not Excel's default, and the id, the anchor, the cell and the `style` echo are
16
- * written from the model.
17
- *
18
- * A form control's shape is in the same part and is placed the same way, by its `<x:Anchor>`
19
- * with `style` as the echo. It is still replayed whole from the sheet's drawing, with only its
20
- * anchor cells rewritten (`withControlAnchors`). The split here is the one it would take to move
21
- * onto its control: the opening tag, the `style` and the anchor are read and written by the same
22
- * code, and only the cell (`<x:Row>`/`<x:Column>`), `<x:Visible/>` and the default shape are a
23
- * note's. The difference to keep is the id: nothing refers to a note's, so it is minted on
24
- * write, while a `<control shapeId>` names its shape's and has to keep it.
25
- */
1
+ import { NoteShapeStyle } from './VmlNoteStyle';
26
2
  /** A note shape as read: its markup and the cell it was on. */
27
3
  export interface NoteShape {
28
4
  xml: string;
@@ -37,13 +13,26 @@ export interface NoteShapeBox {
37
13
  * The eight numbers of `<x:Anchor>`, or `null` when the shape has none that can be read.
38
14
  */
39
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;
40
27
  /** Whether the shape has `<x:Visible/>`: the box stays on the sheet. */
41
28
  visible: boolean;
42
29
  /** The shape's alternative text. */
43
30
  alt: string | null;
31
+ /** The box's fill and line, where they are not Excel's default. */
32
+ style: NoteShapeStyle;
44
33
  /**
45
- * The shape without its id, position, cell or alternative text, or `null` when that is
46
- * Excel's default shape.
34
+ * The shape without its id, position, cell, alternative text, fill or line, or `null` when
35
+ * that is Excel's default shape.
47
36
  */
48
37
  xml: string | null;
49
38
  }
@@ -102,6 +91,8 @@ export declare const DEFAULT_NOTE_SHAPE: string;
102
91
  * Reads a note shape into what a note stores.
103
92
  */
104
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;
105
96
  /**
106
97
  * A note shape for a comment: the markup it carries, or Excel's default, with its id, its
107
98
  * position and its cell written in.
@@ -123,13 +114,15 @@ export declare const NOTE_SHAPETYPE = "<v:shapetype id=\"_x0000_t202\" coordsize
123
114
  /** An empty VML part, for a sheet whose notes have no drawing to be added to. */
124
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>";
125
116
  /**
126
- * The part with the note shapes put back before the closing root.
117
+ * The part with shapes put back before the closing root: note boxes, or the shapes of another
118
+ * kind given its `shapetype`.
127
119
  *
128
- * @param lastShapeId The largest shape number among `notes`, so the part can claim its block.
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.
129
122
  *
130
123
  * @remarks
131
- * The note shapetype is declared once if any shape needs it and the part does not already
132
- * declare it. A part that ends up with no shapes at all returns `null`: nothing to write.
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.
133
126
  */
134
- export declare function assembleLegacyDrawing(rest: string | null, notes: string[], lastShapeId?: number): string | null;
127
+ export declare function assembleLegacyDrawing(rest: string | null, shapes: string[], lastShapeId?: number, shapetype?: string): string | null;
135
128
  //# sourceMappingURL=VmlNoteShapes.d.ts.map
@@ -0,0 +1,25 @@
1
+ import { IColor, IFill, IStroke } from '@sheetxl/sdk';
2
+ /** A note box's fill and line, as the model states them. */
3
+ export interface NoteShapeStyle {
4
+ fill?: IFill.JSON;
5
+ stroke?: IStroke.JSON;
6
+ }
7
+ /**
8
+ * Reads a note shape's fill and line into the model's, and the markup with them restored to
9
+ * Excel's default, so the rest can be told apart from a shape that was never formatted.
10
+ *
11
+ * @param markup A normalized note shape.
12
+ */
13
+ export declare function readNoteStyle(markup: string): {
14
+ style: NoteShapeStyle;
15
+ markup: string;
16
+ };
17
+ /**
18
+ * A note shape with the model's fill and line written onto it: the inverse of
19
+ * {@link readNoteStyle}.
20
+ *
21
+ * @param markup A normalized note shape: what a note stored, or Excel's default.
22
+ * @param resolve Resolves a model color, a theme color included.
23
+ */
24
+ export declare function writeNoteStyle(markup: string, style: NoteShapeStyle, resolve: (color: string) => IColor): string;
25
+ //# 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
@@ -45,25 +45,6 @@ export declare namespace VBAProject {
45
45
  codePage: number;
46
46
  modules: Module[];
47
47
  }
48
- /**
49
- * Extract all VBA modules, with their source, from a raw `xl/vbaProject.bin`.
50
- *
51
- * The `dir` stream is a flat sequence of `Id(2) Size(4) Data(Size)` records,
52
- * **with one exception**: `PROJECTVERSION` (0x0009) stores a fixed reserved value
53
- * `4` in the size slot but is followed by 6 bytes (VersionMajor + VersionMinor).
54
- * Treating its size as a skip length misaligns everything after it — which is why
55
- * a naive walk never finds the module records.
56
- *
57
- * @param vbaProjectBin The bytes of the `xl/vbaProject.bin` part.
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.
66
- */
67
48
  const extract: (vbaProjectBin: Uint8Array | ArrayBuffer) => Project | null;
68
49
  /** A module's source, separated into the part VBA hides and the part it shows. */
69
50
  interface Source {
@@ -0,0 +1,5 @@
1
+ /**
2
+ * `bytes` — a written xlsx package — with the evaluation sheet added as the first tab.
3
+ */
4
+ export declare const addEvaluationSheet: (bytes: Uint8Array) => Promise<Uint8Array>;
5
+ //# sourceMappingURL=EvaluationSheet.d.ts.map
@@ -1,11 +1,3 @@
1
- /**
2
- * Minimal, dependency-free parsing for the two flat OPC manifest formats the writer needs to read
3
- * back from a retained source package: `[Content_Types].xml` and `*.rels`. Both are, per spec, a
4
- * single level of self-closing elements with only attributes — no text content, no nesting beyond
5
- * the root — so an attribute-order-independent regex parser is enough, and it keeps the writer from
6
- * needing a DOM parser (it otherwise only ever produces XML, never parses it). See
7
- * `DESIGN-PACKAGE-PASSTHROUGH.md` §6.
8
- */
9
1
  export declare function decodeXmlEntities(s: string): string;
10
2
  export interface SourceContentTypes {
11
3
  readonly defaults: readonly {
@@ -67,20 +67,11 @@ export declare class PackageBuilder<Out> {
67
67
  private _sourcePackage;
68
68
  /** See {@link PackageBuilderOptions.macroEnabled}. */
69
69
  private _macroEnabled;
70
+ /** See {@link PackageBuilderOptions.template}. */
71
+ private _template;
70
72
  private _explicitRelTargets;
71
73
  private _mapState;
72
74
  constructor(zip: IZipBackend<Out>, registry: EmitterRegistry, options?: PackageBuilderOptions);
73
- /**
74
- * Whether a source part named `name` will be in this package once {@link _passthroughSourceParts}
75
- * has run — the drop rules of `DESIGN-PACKAGE-PASSTHROUGH.md` §4, as one predicate. `false` when
76
- * there is no source package or it has no such part.
77
- *
78
- * @remarks
79
- * Does not consider whether an emitter claimed the *path* — that part is then in the package, but
80
- * as the emitter's, not the source's. It does consider whether the reader took the part onto the
81
- * model ({@link ISourcePackage.isAbsorbed}), which is a different question: the model writes that
82
- * part wherever its own numbering puts it, which need not be where the source had it.
83
- */
84
75
  private _isSourcePartCarried;
85
76
  /**
86
77
  * Hold the source's own relationship ids back in `partPath`'s set, before the emitter rewriting
@@ -100,15 +91,6 @@ export declare class PackageBuilder<Out> {
100
91
  * @returns The resulting package as a Uint8Array.
101
92
  */
102
93
  build(options?: ZipBackendCloseOptions): Promise<Uint8Array>;
103
- /**
104
- * Copy through every source-package part no emitter claimed, once emission is complete and
105
- * {@link _writtenPaths} is final. See `DESIGN-PACKAGE-PASSTHROUGH.md` §4 (bucket rules) and §6
106
- * (the rels/content-types merge).
107
- *
108
- * @remarks
109
- * No re-fetch, no residue map: this only ever reads the bytes handed in via
110
- * {@link PackageBuilderOptions.sourcePackage} — see the design doc's non-goals (§7).
111
- */
112
94
  private _passthroughSourceParts;
113
95
  /**
114
96
  * Declare the workbook part's macro-enabled **variant** of `CT_Workbook` when the package being
@@ -136,27 +118,6 @@ export declare class PackageBuilder<Out> {
136
118
  * would let a stale declaration through on anything.
137
119
  */
138
120
  private _applyWorkbookContentTypeVariant;
139
- /**
140
- * Seed `sourcePart`'s {@link IRelationshipSet} with the source's edges, each under the source's
141
- * own id. Targets are carried forward as-is (still relative to the same referencing part, at the
142
- * same OPC path) — nothing to recompute.
143
- *
144
- * @remarks
145
- * Which edges come back depends on who wrote the part (`DESIGN-PACKAGE-PASSTHROUGH.md` §6):
146
- *
147
- * - A **preserved** part is the source's bytes, so its XML still cites the ids the source's
148
- * `.rels` defined; every edge whose target is still in the package comes back with that id.
149
- * Nothing else ever wrote into this set, so the ids are free.
150
- * - A **rewritten** part (the root, or one an emitter claimed) had its emitter recreate the edges
151
- * it cites, so only what the emitter did not recreate is added: not an edge whose target an
152
- * emitter claimed (its own, correct edge exists already — keeping both would duplicate it), not
153
- * one added by name through `addRelationship`. The set had the source's ids reserved before
154
- * the emitter allocated ({@link _reserveSourceRelIds}), so these too keep their names —
155
- * unless an emitter took the id as a hint for a different target, in which case it is fresh.
156
- *
157
- * An edge whose target did not survive at all is dropped either way (§5). A `TargetMode="External"`
158
- * or `#`-fragment target is not a part and is never resolved as one.
159
- */
160
121
  private _mergeSourceRelsInto;
161
122
  /**
162
123
  * Add a root part to the package.
@@ -161,26 +161,20 @@ export interface EmitContext {
161
161
  * @returns The rId of the added relationship.
162
162
  */
163
163
  addExternal(relTypeUri: string, targetUrl: string, idHint?: string): PackagePart;
164
+ addRelationship(relTypeUri: string, targetPartPath: string, idHint?: string): string | null;
164
165
  /**
165
- * Adds a relationship from the current part to a part that is already going to be in this
166
- * package, rather than creating one: either a part another emitter wrote — one that is shared,
167
- * written once by whoever owns it and referenced from each part that uses it (a pivot cache,
168
- * written by the workbook, from every pivot table on it) — or a part the source package carries
169
- * through untouched because nothing modeled it (a `<ddeLink>` external link).
166
+ * Whether the package will hold the source package's own bytes at `partPath`: the source has the
167
+ * part, the passthrough carries it, and no emitter has claimed the path so far.
170
168
  *
171
- * @param relTypeUri The relationship type URI.
172
- * @param targetPartPath The target's absolute path (relative to the package root, no leading `/`).
173
- * @param idHint A preferred id (e.g. the source's own original rId), honored only if free in this
174
- * part's set; it falls back silently to an auto-generated id otherwise, so a caller that needs the
175
- * id to line up with something it already wrote (a replayed fragment citing this target) must use
176
- * the returned value rather than assume the hint was honored.
177
- * @returns The id assigned, or `null` if the target will not be in the package — no emitter
178
- * claimed the path and no source part survives at it (there is no source package, it has no such
179
- * part, the model absorbed it, or it is in a drop bucket for this save; see
180
- * `DESIGN-PACKAGE-PASSTHROUGH.md` §4). Nothing was added in that case: the caller must not write
181
- * the element that would have cited it.
169
+ * @remarks
170
+ * The question a replayed source fragment asks before citing a part: {@link addRelationship}
171
+ * accepts a path an emitter wrote, and what an emitter wrote there may be a different part of the
172
+ * same kind (the writer numbers pivot caches its own way). An emitter scheduled later can still
173
+ * claim the path, so ask once the parts that could collide have been added.
174
+ *
175
+ * @param partPath The part's absolute path (relative to the package root, no leading `/`).
182
176
  */
183
- addRelationship(relTypeUri: string, targetPartPath: string, idHint?: string): string | null;
177
+ carriesSourcePart(partPath: string): boolean;
184
178
  /**
185
179
  * Waits for all dependants to be emitted.
186
180
  */
@@ -296,11 +290,6 @@ export interface PackageBuilderOptions {
296
290
  * A map that can be used across emitters to share state.
297
291
  */
298
292
  mapState?: Map<string, any>;
299
- /**
300
- * The source package to seed the build from, if the destination is being saved back into the same
301
- * OOXML package family it was read from. Parts no emitter claims are copied through verbatim
302
- * instead of being dropped. See `DESIGN-PACKAGE-PASSTHROUGH.md`.
303
- */
304
293
  sourcePackage?: ISourcePackage | null;
305
294
  /**
306
295
  * Whether the package being built is macro-enabled (`.xlsm`) rather than plain (`.xlsx`).
@@ -314,6 +303,13 @@ export interface PackageBuilderOptions {
314
303
  * a source's VBA project, matching Excel's own *Save As*.
315
304
  */
316
305
  macroEnabled?: boolean;
306
+ /**
307
+ * Whether the package being built is a template (`.xltx`/`.xltm`). Only the `xl/workbook.xml`
308
+ * content-type variant follows from it.
309
+ *
310
+ * @defaultValue false
311
+ */
312
+ template?: boolean;
317
313
  /**
318
314
  * Callback invoked when a part is emitted.
319
315
  *
@@ -354,12 +350,6 @@ export interface ISourcePackagePart {
354
350
  readonly uncompressedSize: number;
355
351
  readonly raw?: ISourcePackageRawPart;
356
352
  }
357
- /**
358
- * Structural interface for a retained source package, seeded into {@link PackageBuilder} so an
359
- * xlsx→xlsx round trip can copy through the parts nothing modeled instead of dropping them. Kept
360
- * structural (not importing `../SourcePackage` directly) so `builder/` stays format-agnostic — see
361
- * `DESIGN-PACKAGE-PASSTHROUGH.md` §6.
362
- */
363
353
  export interface ISourcePackage {
364
354
  getNames(): string[];
365
355
  has(name: string): boolean;
@@ -1,4 +1,4 @@
1
- import { IComment, ISheet, IStyledFont, ITheme } from '@sheetxl/sdk';
1
+ import { IComment, IWorksheet, IFontStyle, ITheme } from '@sheetxl/sdk';
2
2
  import { Emitter, EmitContext, IXmlWriter } from '../builder';
3
3
  export declare const REL_TYPE_COMMENTS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments";
4
4
  export declare const REL_TYPE_THREADED_COMMENTS = "http://schemas.microsoft.com/office/2017/10/relationships/threadedComment";
@@ -16,7 +16,7 @@ export interface CommentHandle {
16
16
  }
17
17
  /** What the worksheet emitter schedules: the sheet's comments, roots only, in reading order. */
18
18
  export interface CommentsPartHandle {
19
- sheet: ISheet;
19
+ sheet: IWorksheet;
20
20
  comments: CommentHandle[];
21
21
  }
22
22
  /**
@@ -46,7 +46,7 @@ export declare function writeRichText(xml: IXmlWriter, content: IComment.Content
46
46
  * A run's `<rPr>`, in the order Excel writes it. Only what the run sets is written, and a property
47
47
  * set off (`weight: 400`) is written off, since it overrides whatever the run would inherit.
48
48
  */
49
- export declare function writeRunProperties(xml: IXmlWriter, font: IStyledFont.JSON, theme: ITheme): void;
49
+ export declare function writeRunProperties(xml: IXmlWriter, font: IFontStyle.JSON, theme: ITheme): void;
50
50
  /**
51
51
  * The cell address of a comment, or `null` when its cell is gone.
52
52
  */