@office-open/core 0.6.5 → 0.6.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -96,15 +96,15 @@ gen(); // → 1, 2, 3, ...
96
96
 
97
97
  | Operation | hz |
98
98
  | ----------------------------- | ----- |
99
- | `decimalNumber` | ~20M |
100
- | `hexColorValue` (6-char hex) | ~13M |
101
- | `uniqueNumericIdCreator` | ~20M |
102
- | `uniqueId` (nanoid) | ~3.2M |
103
- | `uniqueUuid` | ~1.8M |
104
- | `onOffObj` (true) | ~19M |
105
- | `onOffObj` (false) | ~3.4M |
106
- | `BuilderElement` (attributes) | ~5M |
107
- | `BuilderElement` (children) | ~3.9M |
99
+ | `decimalNumber` | ~18M |
100
+ | `hexColorValue` (6-char hex) | ~11M |
101
+ | `uniqueNumericIdCreator` | ~18M |
102
+ | `uniqueId` (nanoid) | ~3.0M |
103
+ | `uniqueUuid` | ~1.7M |
104
+ | `onOffObj` (true) | ~16M |
105
+ | `onOffObj` (false) | ~3.5M |
106
+ | `BuilderElement` (attributes) | ~4.9M |
107
+ | `BuilderElement` (children) | ~3.6M |
108
108
 
109
109
  ## License
110
110
 
@@ -1,2 +1,2 @@
1
- import { _ as CatAx, a as ChartData, c as ChartSeriesData, d as createChartType, f as ScatterChart, g as AreaChart, h as BarChart, i as ChartCollection, l as ChartType, m as LineChart, n as createNumRef, o as ChartSpace, p as PieChart, r as createStrRef, s as ChartSpaceOptions, t as ChartTitle, u as ChartTypeOptions, v as ValAx } from "../index-DZobntUT.mjs";
1
+ import { _ as CatAx, a as ChartData, c as ChartSeriesData, d as createChartType, f as ScatterChart, g as AreaChart, h as BarChart, i as ChartCollection, l as ChartType, m as LineChart, n as createNumRef, o as ChartSpace, p as PieChart, r as createStrRef, s as ChartSpaceOptions, t as ChartTitle, u as ChartTypeOptions, v as ValAx } from "../index-Bf86IyeY.mjs";
2
2
  export { AreaChart, BarChart, CatAx, ChartCollection, ChartData, ChartSeriesData, ChartSpace, ChartSpaceOptions, ChartTitle, ChartType, ChartTypeOptions, LineChart, PieChart, ScatterChart, ValAx, createChartType, createNumRef, createStrRef };
@@ -1,2 +1,2 @@
1
- import { a as ScatterChart, c as BarChart, d as createStrRef, f as CatAx, i as createChartType, l as AreaChart, n as ChartSpace, o as PieChart, p as ValAx, r as ChartTitle, s as LineChart, t as ChartCollection, u as createNumRef } from "../chart-Bd9E-YhB.mjs";
1
+ import { a as ScatterChart, c as BarChart, d as createStrRef, f as CatAx, i as createChartType, l as AreaChart, n as ChartSpace, o as PieChart, p as ValAx, r as ChartTitle, s as LineChart, t as ChartCollection, u as createNumRef } from "../chart-DO9i3S1G.mjs";
2
2
  export { AreaChart, BarChart, CatAx, ChartCollection, ChartSpace, ChartTitle, LineChart, PieChart, ScatterChart, ValAx, createChartType, createNumRef, createStrRef };
@@ -1,4 +1,4 @@
1
- import { a as BuilderElement, b as XmlComponent, c as chartAttr, h as wrapEl, o as EmptyElement } from "./xml-components-CADgke8j.mjs";
1
+ import { a as BuilderElement, b as XmlComponent, c as chartAttr, h as wrapEl, o as EmptyElement } from "./xml-components-ctIqansl.mjs";
2
2
  //#region src/chart/axes.ts
3
3
  /**
4
4
  * c:scaling — axis scaling configuration (minOccurs=1 in EG_AxShared).
@@ -11,6 +11,9 @@ var Scaling = class extends XmlComponent {
11
11
  };
12
12
  /**
13
13
  * c:catAx — category axis.
14
+ *
15
+ * XSD sequence: EG_AxShared (axId, scaling, delete, axPos, ..., crossAx, crosses)
16
+ * then: auto, lblAlgn, lblOffset, tickLblSkip, tickMarkSkip, noMultiLvlLbl
14
17
  */
15
18
  var CatAx = class extends XmlComponent {
16
19
  constructor(axId, crossAx) {
@@ -19,15 +22,18 @@ var CatAx = class extends XmlComponent {
19
22
  this.root.push(new Scaling());
20
23
  this.root.push(wrapEl("c:delete", chartAttr({ val: 0 })));
21
24
  this.root.push(wrapEl("c:axPos", chartAttr({ val: "b" })));
25
+ this.root.push(wrapEl("c:crossAx", chartAttr({ val: crossAx })));
26
+ this.root.push(wrapEl("c:crosses", chartAttr({ val: "autoZero" })));
22
27
  this.root.push(wrapEl("c:auto", chartAttr({ val: 1 })));
23
28
  this.root.push(wrapEl("c:lblOffset", chartAttr({ val: 100 })));
24
29
  this.root.push(wrapEl("c:noMultiLvlLbl", chartAttr({ val: 0 })));
25
- this.root.push(wrapEl("c:crossAx", chartAttr({ val: crossAx })));
26
- this.root.push(wrapEl("c:crosses", chartAttr({ val: "autoZero" })));
27
30
  }
28
31
  };
29
32
  /**
30
33
  * c:valAx — value axis.
34
+ *
35
+ * XSD sequence: EG_AxShared (axId, scaling, delete, axPos, ..., spPr, ..., crossAx, crosses)
36
+ * then: crossBetween, majorUnit, minorUnit, dispUnits
31
37
  */
32
38
  var ValAx = class extends XmlComponent {
33
39
  constructor(axId, crossAx) {
@@ -40,9 +46,9 @@ var ValAx = class extends XmlComponent {
40
46
  formatCode: "General",
41
47
  sourceLinked: 1
42
48
  })));
49
+ this.root.push(new BuilderElement({ name: "c:spPr" }));
43
50
  this.root.push(wrapEl("c:crossAx", chartAttr({ val: crossAx })));
44
51
  this.root.push(wrapEl("c:crosses", chartAttr({ val: "autoZero" })));
45
- this.root.push(new BuilderElement({ name: "c:spPr" }));
46
52
  }
47
53
  };
48
54
  //#endregion
@@ -82,8 +88,8 @@ var NumRef = class extends XmlComponent {
82
88
  var NumCache = class extends XmlComponent {
83
89
  constructor(values) {
84
90
  super("c:numCache");
85
- this.root.push(wrapEl("c:ptCount", chartAttr({ val: values.length })));
86
91
  this.root.push(new FormatCode("General"));
92
+ this.root.push(wrapEl("c:ptCount", chartAttr({ val: values.length })));
87
93
  for (let i = 0; i < values.length; i++) this.root.push(new NumPt(i, values[i]));
88
94
  }
89
95
  };
@@ -123,9 +129,9 @@ var AreaSeries = class extends XmlComponent {
123
129
  this.root.push(wrapEl("c:idx", chartAttr({ val: index })));
124
130
  this.root.push(wrapEl("c:order", chartAttr({ val: index })));
125
131
  this.root.push(new SeriesTx$4(series.name));
132
+ this.root.push(new EmptyElement("c:spPr"));
126
133
  this.root.push(new SeriesCat$4(categories));
127
134
  this.root.push(new SeriesVal$4(series.values));
128
- this.root.push(new EmptyElement("c:spPr"));
129
135
  }
130
136
  };
131
137
  var SeriesTx$4 = class extends XmlComponent {
@@ -164,9 +170,9 @@ var BarSeries = class extends XmlComponent {
164
170
  this.root.push(wrapEl("c:idx", chartAttr({ val: index })));
165
171
  this.root.push(wrapEl("c:order", chartAttr({ val: index })));
166
172
  this.root.push(new SeriesTx$3(series.name));
173
+ this.root.push(new EmptyElement("c:spPr"));
167
174
  this.root.push(new SeriesCat$3(categories));
168
175
  this.root.push(new SeriesVal$3(series.values));
169
- this.root.push(new EmptyElement("c:spPr"));
170
176
  }
171
177
  };
172
178
  var SeriesTx$3 = class extends XmlComponent {
@@ -204,9 +210,9 @@ var LineSeries = class extends XmlComponent {
204
210
  this.root.push(wrapEl("c:idx", chartAttr({ val: index })));
205
211
  this.root.push(wrapEl("c:order", chartAttr({ val: index })));
206
212
  this.root.push(new SeriesTx$2(series.name));
213
+ this.root.push(new EmptyElement("c:spPr"));
207
214
  this.root.push(new SeriesCat$2(categories));
208
215
  this.root.push(new SeriesVal$2(series.values));
209
- this.root.push(new EmptyElement("c:spPr"));
210
216
  }
211
217
  };
212
218
  var SeriesTx$2 = class extends XmlComponent {
@@ -242,9 +248,9 @@ var PieSeries = class extends XmlComponent {
242
248
  this.root.push(wrapEl("c:idx", chartAttr({ val: index })));
243
249
  this.root.push(wrapEl("c:order", chartAttr({ val: index })));
244
250
  this.root.push(new SeriesTx$1(series.name));
251
+ this.root.push(new EmptyElement("c:spPr"));
245
252
  this.root.push(new SeriesCat$1(categories));
246
253
  this.root.push(new SeriesVal$1(series.values));
247
- this.root.push(new EmptyElement("c:spPr"));
248
254
  }
249
255
  };
250
256
  var SeriesTx$1 = class extends XmlComponent {
@@ -282,9 +288,9 @@ var ScatterSeries = class extends XmlComponent {
282
288
  this.root.push(wrapEl("c:idx", chartAttr({ val: index })));
283
289
  this.root.push(wrapEl("c:order", chartAttr({ val: index })));
284
290
  this.root.push(new SeriesTx(series.name));
291
+ this.root.push(new EmptyElement("c:spPr"));
285
292
  this.root.push(new SeriesCat(categories));
286
293
  this.root.push(new SeriesVal(series.values));
287
- this.root.push(new EmptyElement("c:spPr"));
288
294
  this.root.push(new EmptyElement("c:size"));
289
295
  }
290
296
  };
@@ -412,6 +418,7 @@ var ChartSpace = class extends XmlComponent {
412
418
  this.root.push(wrapEl("c:date1904", chartAttr({ val: 0 })));
413
419
  this.root.push(wrapEl("c:lang", chartAttr({ val: "en-US" })));
414
420
  this.root.push(wrapEl("c:roundedCorners", chartAttr({ val: 0 })));
421
+ if (options.style !== void 0) this.root.push(new ChartStyle(options.style));
415
422
  const chart = new ChartContainer();
416
423
  if (options.title) chart["root"].push(new ChartTitle(options.title));
417
424
  chart["root"].push(wrapEl("c:autoTitleDeleted", chartAttr({ val: 0 })));
@@ -434,7 +441,6 @@ var ChartSpace = class extends XmlComponent {
434
441
  this.root.push(chart);
435
442
  this.root.push(createChartSpPr());
436
443
  this.root.push(createChartTxPr());
437
- if (options.style !== void 0) this.root.push(new ChartStyle(options.style));
438
444
  }
439
445
  };
440
446
  var ChartContainer = class extends XmlComponent {
@@ -1,2 +1,2 @@
1
- import { $ as RectAlignment, $t as createSolidFill, A as createBevel, At as FillOptions, B as createSoftEdgeEffect, Bt as RelativeRect, C as GeometryGuide, Ct as createGroupFill, D as createShape3D, Dt as createNoFill, E as Shape3DOptions, Et as createPatternFill, F as Point3D, Ft as GradientShadeOptions, G as EffectListOptions, Gt as TileOptions, H as EffectDagOptions, Ht as createGradientFill, I as Scene3DOptions, It as GradientStop, J as createReflectionEffect, Jt as createSourceRectangle, K as createEffectList, Kt as createTileInfo, L as SphereCoords, Lt as LinearShadeOptions, M as BackdropOptions, Mt as buildFill, N as CameraOptions, Nt as extractBlipFillMedia, O as BevelOptions, Ot as BlipFillConfigOptions, P as LightRigOptions, Pt as GradientFillOptions, Q as OuterShadowEffectOptions, Qt as createColorElement, R as Vector3D, Rt as PathShadeOptions, S as PresetGeometryOptions, St as createCustomDash, T as PresetMaterialType, Tt as PresetPattern, U as createEffectDag, Ut as createGradientStop, V as EffectContainerType, Vt as TileFlipMode, W as BlurEffectOptions, Wt as TileAlignment, X as PresetShadowVal, Xt as createBlipEffects, Y as PresetShadowEffectOptions, Yt as BlipEffectsOptions, Z as createPresetShadowEffect, Zt as SolidFillOptions, _ as PathCommand, _t as LineEndOptions, a as Transform2DOptions, an as createSchemeColor, at as BlendMode, b as createCustomGeometry, bt as createLineEnd, c as Stretch, cn as RgbColorOptions, ct as CompoundLine, d as createBlipFill, dn as PresetColorOptions, dt as OutlineFillProperties, en as SystemColor, et as createOuterShadowEffect, f as BlipOptions, fn as createPresetColor, ft as OutlineOptions, g as GeomRect, gn as createColorTransforms, gt as LineEndLength, h as CustomGeometryOptions, hn as ColorTransformOptions, ht as createOutline, i as GroupTransform2DOptions, in as SchemeColorOptions, it as createGlowEffect, j as createBottomBevel, jt as GradientStopOptions, k as BevelPresetType, kt as BlipFillMediaData, l as createExtentionList, ln as createRgbColor, lt as LineCap, m as ConnectionSite, mn as createHslColor, mt as PresetDash, n as MediaTransformation, nn as createSystemColor, nt as createInnerShadowEffect, o as createGroupTransform2D, on as ScRgbColorOptions, ot as FillOverlayEffectOptions, p as createBlip, pn as HslColorOptions, pt as PenAlignment, q as ReflectionEffectOptions, qt as SourceRectangleOptions, r as createTransformation, rn as SchemeColor, rt as GlowEffectOptions, s as createTransform2D, sn as createScRgbColor, st as createFillOverlayEffect, t as MediaDataTransformation, tn as SystemColorOptions, tt as InnerShadowEffectOptions, u as BlipFillOptions, un as PresetColor, ut as LineJoin, v as PathFillMode, vt as LineEndType, w as createAdjustmentValues, wt as PatternFillOptions, x as PresetGeometry, xt as DashStop, y as PathOptions, yt as LineEndWidth, z as createScene3D, zt as PathShadeType } from "../index-CuRO3Jmz.mjs";
1
+ import { $ as RectAlignment, $t as createSolidFill, A as createBevel, At as FillOptions, B as createSoftEdgeEffect, Bt as RelativeRect, C as GeometryGuide, Ct as createGroupFill, D as createShape3D, Dt as createNoFill, E as Shape3DOptions, Et as createPatternFill, F as Point3D, Ft as GradientShadeOptions, G as EffectListOptions, Gt as TileOptions, H as EffectDagOptions, Ht as createGradientFill, I as Scene3DOptions, It as GradientStop, J as createReflectionEffect, Jt as createSourceRectangle, K as createEffectList, Kt as createTileInfo, L as SphereCoords, Lt as LinearShadeOptions, M as BackdropOptions, Mt as buildFill, N as CameraOptions, Nt as extractBlipFillMedia, O as BevelOptions, Ot as BlipFillConfigOptions, P as LightRigOptions, Pt as GradientFillOptions, Q as OuterShadowEffectOptions, Qt as createColorElement, R as Vector3D, Rt as PathShadeOptions, S as PresetGeometryOptions, St as createCustomDash, T as PresetMaterialType, Tt as PresetPattern, U as createEffectDag, Ut as createGradientStop, V as EffectContainerType, Vt as TileFlipMode, W as BlurEffectOptions, Wt as TileAlignment, X as PresetShadowVal, Xt as createBlipEffects, Y as PresetShadowEffectOptions, Yt as BlipEffectsOptions, Z as createPresetShadowEffect, Zt as SolidFillOptions, _ as PathCommand, _t as LineEndOptions, a as Transform2DOptions, an as createSchemeColor, at as BlendMode, b as createCustomGeometry, bt as createLineEnd, c as Stretch, cn as RgbColorOptions, ct as CompoundLine, d as createBlipFill, dn as PresetColorOptions, dt as OutlineFillProperties, en as SystemColor, et as createOuterShadowEffect, f as BlipOptions, fn as createPresetColor, ft as OutlineOptions, g as GeomRect, gn as createColorTransforms, gt as LineEndLength, h as CustomGeometryOptions, hn as ColorTransformOptions, ht as createOutline, i as GroupTransform2DOptions, in as SchemeColorOptions, it as createGlowEffect, j as createBottomBevel, jt as GradientStopOptions, k as BevelPresetType, kt as BlipFillMediaData, l as createExtentionList, ln as createRgbColor, lt as LineCap, m as ConnectionSite, mn as createHslColor, mt as PresetDash, n as MediaTransformation, nn as createSystemColor, nt as createInnerShadowEffect, o as createGroupTransform2D, on as ScRgbColorOptions, ot as FillOverlayEffectOptions, p as createBlip, pn as HslColorOptions, pt as PenAlignment, q as ReflectionEffectOptions, qt as SourceRectangleOptions, r as createTransformation, rn as SchemeColor, rt as GlowEffectOptions, s as createTransform2D, sn as createScRgbColor, st as createFillOverlayEffect, t as MediaDataTransformation, tn as SystemColorOptions, tt as InnerShadowEffectOptions, u as BlipFillOptions, un as PresetColor, ut as LineJoin, v as PathFillMode, vt as LineEndType, w as createAdjustmentValues, wt as PatternFillOptions, x as PresetGeometry, xt as DashStop, y as PathOptions, yt as LineEndWidth, z as createScene3D, zt as PathShadeType } from "../index-CCGNb26x.mjs";
2
2
  export { BackdropOptions, BevelOptions, BevelPresetType, BlendMode, BlipEffectsOptions, BlipFillConfigOptions, BlipFillMediaData, BlipFillOptions, BlipOptions, BlurEffectOptions, CameraOptions, ColorTransformOptions, CompoundLine, ConnectionSite, CustomGeometryOptions, DashStop, EffectContainerType, EffectDagOptions, EffectListOptions, FillOptions, FillOverlayEffectOptions, GeomRect, GeometryGuide, GlowEffectOptions, GradientFillOptions, GradientShadeOptions, GradientStop, GradientStopOptions, GroupTransform2DOptions, HslColorOptions, InnerShadowEffectOptions, LightRigOptions, LineCap, LineEndLength, LineEndOptions, LineEndType, LineEndWidth, LineJoin, LinearShadeOptions, MediaDataTransformation, MediaTransformation, OuterShadowEffectOptions, OutlineFillProperties, OutlineOptions, PathCommand, PathFillMode, PathOptions, PathShadeOptions, PathShadeType, PatternFillOptions, PenAlignment, Point3D, PresetColor, PresetColorOptions, PresetDash, PresetGeometry, PresetGeometryOptions, PresetMaterialType, PresetPattern, PresetShadowEffectOptions, PresetShadowVal, RectAlignment, ReflectionEffectOptions, RelativeRect, RgbColorOptions, ScRgbColorOptions, Scene3DOptions, SchemeColor, SchemeColorOptions, Shape3DOptions, SolidFillOptions, SourceRectangleOptions, SphereCoords, Stretch, SystemColor, SystemColorOptions, TileAlignment, TileFlipMode, TileOptions, Transform2DOptions, Vector3D, buildFill, createAdjustmentValues, createBevel, createBlip, createBlipEffects, createBlipFill, createBottomBevel, createColorElement, createColorTransforms, createCustomDash, createCustomGeometry, createEffectDag, createEffectList, createExtentionList, createFillOverlayEffect, createGlowEffect, createGradientFill, createGradientStop, createGroupFill, createGroupTransform2D, createHslColor, createInnerShadowEffect, createLineEnd, createNoFill, createOuterShadowEffect, createOutline, createPatternFill, createPresetColor, createPresetShadowEffect, createReflectionEffect, createRgbColor, createScRgbColor, createScene3D, createSchemeColor, createShape3D, createSoftEdgeEffect, createSolidFill, createSourceRectangle, createSystemColor, createTileInfo, createTransform2D, createTransformation, extractBlipFillMedia };
@@ -1,2 +1,2 @@
1
- import { A as LineJoin, B as createNoFill, C as createOuterShadowEffect, Ct as createSchemeColor, D as createFillOverlayEffect, Dt as createPresetColor, E as BlendMode, Et as PresetColor, F as LineEndType, G as PathShadeType, H as extractBlipFillMedia, I as LineEndWidth, J as createGradientStop, K as TileFlipMode, L as createLineEnd, M as PresetDash, N as createOutline, O as CompoundLine, Ot as createHslColor, P as LineEndLength, R as createCustomDash, S as RectAlignment, St as SchemeColor, T as createGlowEffect, Tt as createRgbColor, U as PresetPattern, V as buildFill, W as createPatternFill, X as createTileInfo, Y as TileAlignment, _ as createEffectList, _t as createBlipEffects, a as createBlip, b as PresetShadowVal, bt as SystemColor, c as PresetGeometry, d as createShape3D, f as BevelPresetType, g as createEffectDag, gt as createSourceRectangle, h as createScene3D, ht as Stretch, i as createBlipFill, j as PenAlignment, k as LineCap, kt as createColorTransforms, l as createAdjustmentValues, m as createBottomBevel, n as createGroupTransform2D, o as createExtentionList, p as createBevel, q as createGradientFill, r as createTransform2D, s as createCustomGeometry, t as createTransformation, u as PresetMaterialType, v as createSoftEdgeEffect, vt as createColorElement, w as createInnerShadowEffect, wt as createScRgbColor, x as createPresetShadowEffect, xt as createSystemColor, y as createReflectionEffect, yt as createSolidFill, z as createGroupFill } from "../drawingml-YMdpQfWs.mjs";
1
+ import { A as LineJoin, B as createNoFill, C as createOuterShadowEffect, Ct as createSchemeColor, D as createFillOverlayEffect, Dt as createPresetColor, E as BlendMode, Et as PresetColor, F as LineEndType, G as PathShadeType, H as extractBlipFillMedia, I as LineEndWidth, J as createGradientStop, K as TileFlipMode, L as createLineEnd, M as PresetDash, N as createOutline, O as CompoundLine, Ot as createHslColor, P as LineEndLength, R as createCustomDash, S as RectAlignment, St as SchemeColor, T as createGlowEffect, Tt as createRgbColor, U as PresetPattern, V as buildFill, W as createPatternFill, X as createTileInfo, Y as TileAlignment, _ as createEffectList, _t as createBlipEffects, a as createBlip, b as PresetShadowVal, bt as SystemColor, c as PresetGeometry, d as createShape3D, f as BevelPresetType, g as createEffectDag, gt as createSourceRectangle, h as createScene3D, ht as Stretch, i as createBlipFill, j as PenAlignment, k as LineCap, kt as createColorTransforms, l as createAdjustmentValues, m as createBottomBevel, n as createGroupTransform2D, o as createExtentionList, p as createBevel, q as createGradientFill, r as createTransform2D, s as createCustomGeometry, t as createTransformation, u as PresetMaterialType, v as createSoftEdgeEffect, vt as createColorElement, w as createInnerShadowEffect, wt as createScRgbColor, x as createPresetShadowEffect, xt as createSystemColor, y as createReflectionEffect, yt as createSolidFill, z as createGroupFill } from "../drawingml-DzU9sEb0.mjs";
2
2
  export { BevelPresetType, BlendMode, CompoundLine, LineCap, LineEndLength, LineEndType, LineEndWidth, LineJoin, PathShadeType, PenAlignment, PresetColor, PresetDash, PresetGeometry, PresetMaterialType, PresetPattern, PresetShadowVal, RectAlignment, SchemeColor, Stretch, SystemColor, TileAlignment, TileFlipMode, buildFill, createAdjustmentValues, createBevel, createBlip, createBlipEffects, createBlipFill, createBottomBevel, createColorElement, createColorTransforms, createCustomDash, createCustomGeometry, createEffectDag, createEffectList, createExtentionList, createFillOverlayEffect, createGlowEffect, createGradientFill, createGradientStop, createGroupFill, createGroupTransform2D, createHslColor, createInnerShadowEffect, createLineEnd, createNoFill, createOuterShadowEffect, createOutline, createPatternFill, createPresetColor, createPresetShadowEffect, createReflectionEffect, createRgbColor, createScRgbColor, createScene3D, createSchemeColor, createShape3D, createSoftEdgeEffect, createSolidFill, createSourceRectangle, createSystemColor, createTileInfo, createTransform2D, createTransformation, extractBlipFillMedia };
@@ -1,4 +1,4 @@
1
- import { a as BuilderElement, b as XmlComponent } from "./xml-components-CADgke8j.mjs";
1
+ import { a as BuilderElement, b as XmlComponent } from "./xml-components-ctIqansl.mjs";
2
2
  import hash from "hash.js";
3
3
  import { customAlphabet, nanoid } from "nanoid/non-secure";
4
4
  //#region src/converters.ts
@@ -1,4 +1,4 @@
1
- import { C as XmlComponent } from "./index-B1wzvu1m.mjs";
1
+ import { C as XmlComponent } from "./index-bZQnCpM1.mjs";
2
2
 
3
3
  //#region src/smartart/categories.d.ts
4
4
  /** Layout ID → OOXML category type */
@@ -1,14 +1,20 @@
1
- import { C as XmlComponent } from "./index-B1wzvu1m.mjs";
1
+ import { C as XmlComponent } from "./index-bZQnCpM1.mjs";
2
2
 
3
3
  //#region src/chart/axes.d.ts
4
4
  /**
5
5
  * c:catAx — category axis.
6
+ *
7
+ * XSD sequence: EG_AxShared (axId, scaling, delete, axPos, ..., crossAx, crosses)
8
+ * then: auto, lblAlgn, lblOffset, tickLblSkip, tickMarkSkip, noMultiLvlLbl
6
9
  */
7
10
  declare class CatAx extends XmlComponent {
8
11
  constructor(axId: number, crossAx: number);
9
12
  }
10
13
  /**
11
14
  * c:valAx — value axis.
15
+ *
16
+ * XSD sequence: EG_AxShared (axId, scaling, delete, axPos, ..., spPr, ..., crossAx, crosses)
17
+ * then: crossBetween, majorUnit, minorUnit, dispUnits
12
18
  */
13
19
  declare class ValAx extends XmlComponent {
14
20
  constructor(axId: number, crossAx: number);
@@ -71,7 +77,7 @@ interface ChartTypeOptions {
71
77
  readonly series: readonly ChartSeriesData[];
72
78
  readonly categories: readonly string[];
73
79
  }
74
- declare const createChartType: (options: ChartTypeOptions) => BarChart | LineChart | PieChart | AreaChart | ScatterChart;
80
+ declare const createChartType: (options: ChartTypeOptions) => ScatterChart | BarChart | LineChart | PieChart | AreaChart;
75
81
  //#endregion
76
82
  //#region src/chart/chart-space.d.ts
77
83
  interface ChartSpaceOptions {
@@ -1,4 +1,4 @@
1
- import { C as XmlComponent, a as BuilderElement } from "./index-B1wzvu1m.mjs";
1
+ import { C as XmlComponent, a as BuilderElement } from "./index-bZQnCpM1.mjs";
2
2
 
3
3
  //#region src/drawingml/color/color-transform.d.ts
4
4
  /**
@@ -42,6 +42,11 @@ declare abstract class BaseXmlComponent {
42
42
  * @returns The XML-serializable object, or undefined to exclude from output
43
43
  */
44
44
  abstract prepForXml(context: Context): IXmlableObject | undefined;
45
+ /**
46
+ * Direct XML serialization. Override in subclasses for zero-allocation output.
47
+ * Default falls back to prepForXml() + xml().
48
+ */
49
+ toXml(context: Context): string;
45
50
  }
46
51
  //#endregion
47
52
  //#region src/xml-components/component.d.ts
@@ -53,6 +58,11 @@ declare abstract class BaseXmlComponent {
53
58
  declare const EMPTY_OBJECT: {};
54
59
  /**
55
60
  * Base class for all XML components in OOXML documents.
61
+ *
62
+ * `toXml()` traverses the `root` array and calls `toXml()` on each
63
+ * `BaseXmlComponent` child — this avoids building the intermediate
64
+ * `IXmlableObject` tree. Inline `IXmlableObject` children fall back to
65
+ * `xml()` for serialization.
56
66
  */
57
67
  declare abstract class XmlComponent extends BaseXmlComponent {
58
68
  /**
@@ -65,8 +75,8 @@ declare abstract class XmlComponent extends BaseXmlComponent {
65
75
  */
66
76
  prepForXml(context: Context): IXmlableObject | undefined;
67
77
  /**
68
- * Direct XML serialization. Override in subclasses for zero-allocation output.
69
- * Default falls back to prepForXml() + xml().
78
+ * Direct XML serialization traverses `root` and calls `toXml()` on
79
+ * each child, concatenating the results into a single string.
70
80
  */
71
81
  toXml(context: Context): string;
72
82
  /**
@@ -81,6 +91,13 @@ declare abstract class IgnoreIfEmptyXmlComponent extends XmlComponent {
81
91
  private readonly includeIfEmpty;
82
92
  constructor(rootKey: string, includeIfEmpty?: boolean);
83
93
  prepForXml(context: Context): IXmlableObject | undefined;
94
+ /**
95
+ * Suppress empty elements — super.toXml() produces a self-closing tag
96
+ * (`<tag/>`) when there are no child elements; IgnoreIfEmpty returns ""
97
+ * in that case. Child components that already override toXml() (e.g.
98
+ * Worksheet) are unaffected.
99
+ */
100
+ toXml(context: Context): string;
84
101
  }
85
102
  //#endregion
86
103
  //#region src/xml-components/attributes.d.ts
@@ -116,6 +133,8 @@ declare class NextAttributeComponent<T> extends BaseXmlComponent {
116
133
  private readonly root;
117
134
  constructor(root: AttributePayload<T>);
118
135
  prepForXml(_: Context): IXmlableObject;
136
+ /** Attribute components produce no XML output — attrs are inlined by the parent. */
137
+ toXml(_context: Context): string;
119
138
  }
120
139
  //#endregion
121
140
  //#region src/xml-components/elements.d.ts
package/dist/index.d.mts CHANGED
@@ -1,12 +1,11 @@
1
- import { C as XmlComponent, D as IXmlableObject, E as IXmlAttribute, S as IgnoreIfEmptyXmlComponent, T as Context, _ as AttributeMap, a as BuilderElement, b as XmlAttributeComponent, c as chartAttr, d as onOffObj, f as stringContainerObj, g as AttributeData, h as wrapEl, i as convertToXmlComponent, l as hpsMeasureObj, m as stringValObj, n as ImportedRootElementAttributes, o as EmptyElement, p as stringEnumValObj, r as ImportedXmlComponent, s as attrObj, t as InitializableXmlComponent, u as numberValObj, v as AttributePayload, w as BaseXmlComponent, x as EMPTY_OBJECT, y as NextAttributeComponent } from "./index-B1wzvu1m.mjs";
1
+ import { C as XmlComponent, D as IXmlableObject, E as IXmlAttribute, S as IgnoreIfEmptyXmlComponent, T as Context, _ as AttributeMap, a as BuilderElement, b as XmlAttributeComponent, c as chartAttr, d as onOffObj, f as stringContainerObj, g as AttributeData, h as wrapEl, i as convertToXmlComponent, l as hpsMeasureObj, m as stringValObj, n as ImportedRootElementAttributes, o as EmptyElement, p as stringEnumValObj, r as ImportedXmlComponent, s as attrObj, t as InitializableXmlComponent, u as numberValObj, v as AttributePayload, w as BaseXmlComponent, x as EMPTY_OBJECT, y as NextAttributeComponent } from "./index-bZQnCpM1.mjs";
2
2
  import { C as uCharHexNumber, S as twipsMeasureValue, T as unsignedDecimalNumber, _ as pointMeasureValue, a as ThemeColor, b as signedHpsMeasureValue, c as dateTimeValue, d as hexBinary, f as hexColorValue, g as percentageValue, h as measurementOrPercentValue, i as RelativeMeasure, l as decimalNumber, m as longHexNumber, n as PositivePercentage, o as ThemeFont, p as hpsMeasureValue, r as PositiveUniversalMeasure, s as UniversalMeasure, t as Percentage, u as eighthPointMeasureValue, v as positiveUniversalMeasureValue, w as universalMeasureValue, x as signedTwipsMeasureValue, y as shortHexNumber } from "./values-QyWq4U4A.mjs";
3
- import { _ as CatAx, a as ChartData, c as ChartSeriesData, d as createChartType, f as ScatterChart, g as AreaChart, h as BarChart, i as ChartCollection, l as ChartType, m as LineChart, n as createNumRef, o as ChartSpace, p as PieChart, r as createStrRef, s as ChartSpaceOptions, t as ChartTitle, u as ChartTypeOptions, v as ValAx } from "./index-DZobntUT.mjs";
4
- import { $ as RectAlignment, $t as createSolidFill, A as createBevel, At as FillOptions, B as createSoftEdgeEffect, Bt as RelativeRect, C as GeometryGuide, Ct as createGroupFill, D as createShape3D, Dt as createNoFill, E as Shape3DOptions, Et as createPatternFill, F as Point3D, Ft as GradientShadeOptions, G as EffectListOptions, Gt as TileOptions, H as EffectDagOptions, Ht as createGradientFill, I as Scene3DOptions, It as GradientStop, J as createReflectionEffect, Jt as createSourceRectangle, K as createEffectList, Kt as createTileInfo, L as SphereCoords, Lt as LinearShadeOptions, M as BackdropOptions, Mt as buildFill, N as CameraOptions, Nt as extractBlipFillMedia, O as BevelOptions, Ot as BlipFillConfigOptions, P as LightRigOptions, Pt as GradientFillOptions, Q as OuterShadowEffectOptions, Qt as createColorElement, R as Vector3D, Rt as PathShadeOptions, S as PresetGeometryOptions, St as createCustomDash, T as PresetMaterialType, Tt as PresetPattern, U as createEffectDag, Ut as createGradientStop, V as EffectContainerType, Vt as TileFlipMode, W as BlurEffectOptions, Wt as TileAlignment, X as PresetShadowVal, Xt as createBlipEffects, Y as PresetShadowEffectOptions, Yt as BlipEffectsOptions, Z as createPresetShadowEffect, Zt as SolidFillOptions, _ as PathCommand, _t as LineEndOptions, a as Transform2DOptions, an as createSchemeColor, at as BlendMode, b as createCustomGeometry, bt as createLineEnd, c as Stretch, cn as RgbColorOptions, ct as CompoundLine, d as createBlipFill, dn as PresetColorOptions, dt as OutlineFillProperties, en as SystemColor, et as createOuterShadowEffect, f as BlipOptions, fn as createPresetColor, ft as OutlineOptions, g as GeomRect, gn as createColorTransforms, gt as LineEndLength, h as CustomGeometryOptions, hn as ColorTransformOptions, ht as createOutline, i as GroupTransform2DOptions, in as SchemeColorOptions, it as createGlowEffect, j as createBottomBevel, jt as GradientStopOptions, k as BevelPresetType, kt as BlipFillMediaData, l as createExtentionList, ln as createRgbColor, lt as LineCap, m as ConnectionSite, mn as createHslColor, mt as PresetDash, n as MediaTransformation, nn as createSystemColor, nt as createInnerShadowEffect, o as createGroupTransform2D, on as ScRgbColorOptions, ot as FillOverlayEffectOptions, p as createBlip, pn as HslColorOptions, pt as PenAlignment, q as ReflectionEffectOptions, qt as SourceRectangleOptions, r as createTransformation, rn as SchemeColor, rt as GlowEffectOptions, s as createTransform2D, sn as createScRgbColor, st as createFillOverlayEffect, t as MediaDataTransformation, tn as SystemColorOptions, tt as InnerShadowEffectOptions, u as BlipFillOptions, un as PresetColor, ut as LineJoin, v as PathFillMode, vt as LineEndType, w as createAdjustmentValues, wt as PatternFillOptions, x as PresetGeometry, xt as DashStop, y as PathOptions, yt as LineEndWidth, z as createScene3D, zt as PathShadeType } from "./index-CuRO3Jmz.mjs";
5
- import { a as Point, c as Connection, d as getLayoutXml, f as getStyleXml, h as STYLE_CATEGORIES, i as SmartArtData, l as DEFAULT_DRAWING_XML, m as LAYOUT_CATEGORIES, n as createDataModel, o as TransPoint, p as COLOR_CATEGORIES, r as SmartArtCollection, s as DataModel, t as TreeNode, u as getColorXml } from "./index-CZxcE4Q6.mjs";
3
+ import { _ as CatAx, a as ChartData, c as ChartSeriesData, d as createChartType, f as ScatterChart, g as AreaChart, h as BarChart, i as ChartCollection, l as ChartType, m as LineChart, n as createNumRef, o as ChartSpace, p as PieChart, r as createStrRef, s as ChartSpaceOptions, t as ChartTitle, u as ChartTypeOptions, v as ValAx } from "./index-Bf86IyeY.mjs";
4
+ import { $ as RectAlignment, $t as createSolidFill, A as createBevel, At as FillOptions, B as createSoftEdgeEffect, Bt as RelativeRect, C as GeometryGuide, Ct as createGroupFill, D as createShape3D, Dt as createNoFill, E as Shape3DOptions, Et as createPatternFill, F as Point3D, Ft as GradientShadeOptions, G as EffectListOptions, Gt as TileOptions, H as EffectDagOptions, Ht as createGradientFill, I as Scene3DOptions, It as GradientStop, J as createReflectionEffect, Jt as createSourceRectangle, K as createEffectList, Kt as createTileInfo, L as SphereCoords, Lt as LinearShadeOptions, M as BackdropOptions, Mt as buildFill, N as CameraOptions, Nt as extractBlipFillMedia, O as BevelOptions, Ot as BlipFillConfigOptions, P as LightRigOptions, Pt as GradientFillOptions, Q as OuterShadowEffectOptions, Qt as createColorElement, R as Vector3D, Rt as PathShadeOptions, S as PresetGeometryOptions, St as createCustomDash, T as PresetMaterialType, Tt as PresetPattern, U as createEffectDag, Ut as createGradientStop, V as EffectContainerType, Vt as TileFlipMode, W as BlurEffectOptions, Wt as TileAlignment, X as PresetShadowVal, Xt as createBlipEffects, Y as PresetShadowEffectOptions, Yt as BlipEffectsOptions, Z as createPresetShadowEffect, Zt as SolidFillOptions, _ as PathCommand, _t as LineEndOptions, a as Transform2DOptions, an as createSchemeColor, at as BlendMode, b as createCustomGeometry, bt as createLineEnd, c as Stretch, cn as RgbColorOptions, ct as CompoundLine, d as createBlipFill, dn as PresetColorOptions, dt as OutlineFillProperties, en as SystemColor, et as createOuterShadowEffect, f as BlipOptions, fn as createPresetColor, ft as OutlineOptions, g as GeomRect, gn as createColorTransforms, gt as LineEndLength, h as CustomGeometryOptions, hn as ColorTransformOptions, ht as createOutline, i as GroupTransform2DOptions, in as SchemeColorOptions, it as createGlowEffect, j as createBottomBevel, jt as GradientStopOptions, k as BevelPresetType, kt as BlipFillMediaData, l as createExtentionList, ln as createRgbColor, lt as LineCap, m as ConnectionSite, mn as createHslColor, mt as PresetDash, n as MediaTransformation, nn as createSystemColor, nt as createInnerShadowEffect, o as createGroupTransform2D, on as ScRgbColorOptions, ot as FillOverlayEffectOptions, p as createBlip, pn as HslColorOptions, pt as PenAlignment, q as ReflectionEffectOptions, qt as SourceRectangleOptions, r as createTransformation, rn as SchemeColor, rt as GlowEffectOptions, s as createTransform2D, sn as createScRgbColor, st as createFillOverlayEffect, t as MediaDataTransformation, tn as SystemColorOptions, tt as InnerShadowEffectOptions, u as BlipFillOptions, un as PresetColor, ut as LineJoin, v as PathFillMode, vt as LineEndType, w as createAdjustmentValues, wt as PatternFillOptions, x as PresetGeometry, xt as DashStop, y as PathOptions, yt as LineEndWidth, z as createScene3D, zt as PathShadeType } from "./index-CCGNb26x.mjs";
5
+ import { a as Point, c as Connection, d as getLayoutXml, f as getStyleXml, h as STYLE_CATEGORIES, i as SmartArtData, l as DEFAULT_DRAWING_XML, m as LAYOUT_CATEGORIES, n as createDataModel, o as TransPoint, p as COLOR_CATEGORIES, r as SmartArtCollection, s as DataModel, t as TreeNode, u as getColorXml } from "./index-BCjRiF78.mjs";
6
6
  import { _ as PPTX_NS, a as getFirstLevelElements, c as TokenNotFoundError, d as createTraverser, f as RenderedParagraphNode, g as DOCX_NS, h as createReplacer, i as createTextElementContents, l as createSplitInject, m as ReplacerConfig, n as getNextRelationshipIndex, o as patchSpaceAttribute, p as createRunRenderer, r as appendContentType, s as toJson, t as appendRelationship, u as createTokenReplacer, v as XmlNamespaceConfig } from "./index-DNLRdIqy.mjs";
7
7
  import { Element } from "@office-open/xml";
8
8
  import { ZipOptions, Zippable, Zippable as Zippable$1, strFromU8, unzipSync } from "fflate";
9
- import { Readable } from "stream";
10
9
 
11
10
  //#region src/converters.d.ts
12
11
  /**
@@ -90,6 +89,7 @@ type OutputType = keyof OutputByType;
90
89
  declare const OoxmlMimeType: {
91
90
  readonly DOCX: "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
92
91
  readonly PPTX: "application/vnd.openxmlformats-officedocument.presentationml.presentation";
92
+ readonly XLSX: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
93
93
  };
94
94
  declare const convertOutput: <T extends OutputType>(data: Uint8Array, type: T, mimeType?: string) => OutputByType[T];
95
95
  //#endregion
@@ -98,13 +98,6 @@ interface XmlifyedFile {
98
98
  readonly path: string;
99
99
  readonly data: string | Uint8Array;
100
100
  }
101
- declare const PrettifyType: {
102
- readonly NONE: "";
103
- readonly WITH_2_BLANKS: " ";
104
- readonly WITH_4_BLANKS: " ";
105
- readonly WITH_TAB: "\t";
106
- };
107
- declare const convertPrettifyType: (prettify?: boolean | (typeof PrettifyType)[keyof typeof PrettifyType]) => (typeof PrettifyType)[keyof typeof PrettifyType] | undefined;
108
101
  /** Default DEFLATE compression level matching Microsoft Office behavior. */
109
102
  declare const ZIP_DEFLATE_LEVEL = 6;
110
103
  /** STORE level for already-compressed media formats (JPEG, PNG, GIF, etc.). */
@@ -125,18 +118,17 @@ declare const zipAndConvert: <T extends OutputType>(files: Zippable$1, type: T,
125
118
  */
126
119
  declare const zipSyncAndConvert: <T extends OutputType>(files: Zippable$1, type: T, mimeType: string, level?: number) => OutputByType[T];
127
120
  /**
128
- * Create a Node.js Readable stream from compressed file entries.
121
+ * Create a `ReadableStream<Uint8Array>` from compressed file entries.
129
122
  *
130
- * Uses fflate's AsyncZipDeflate for non-blocking DEFLATE compression via
131
- * Web Workers. STORED entries (media) pass through synchronously.
132
- * Chunks are emitted asynchronously as each file's compression completes.
123
+ * Uses fflate's `AsyncZipDeflate` for non-blocking DEFLATE compression.
124
+ * `STORED` entries (media) pass through synchronously.
125
+ * Works in both Node.js and browsers (Web Streams API).
133
126
  */
134
- declare const createZipStream: (files: Zippable$1) => Readable;
135
- type PrettifyValue = (typeof PrettifyType)[keyof typeof PrettifyType];
127
+ declare const createZipStream: (files: Zippable$1) => ReadableStream<Uint8Array>;
136
128
  /**
137
129
  * Compile function provided by each package to convert a file object into a Zippable map.
138
130
  */
139
- type CompileFn<TFile> = (file: TFile, prettify?: PrettifyValue, overrides?: readonly XmlifyedFile[]) => Zippable$1;
131
+ type CompileFn<TFile> = (file: TFile, overrides?: readonly XmlifyedFile[]) => Zippable$1;
140
132
  /**
141
133
  * Packer interface returned by {@link createPacker}.
142
134
  *
@@ -148,35 +140,35 @@ interface Packer<TFile> {
148
140
  /** Compile file to Zippable map (synchronous). */
149
141
  compile: CompileFn<TFile>;
150
142
  /** Generic async output — returns the requested OutputType. */
151
- pack<T extends OutputType>(file: TFile, type: T, prettify?: boolean | PrettifyValue, overrides?: readonly XmlifyedFile[]): Promise<OutputByType[T]>;
143
+ pack<T extends OutputType>(file: TFile, type: T, overrides?: readonly XmlifyedFile[]): Promise<OutputByType[T]>;
152
144
  /** Generic sync output — returns the requested OutputType. */
153
- packSync<T extends OutputType>(file: TFile, type: T, prettify?: boolean | PrettifyValue, overrides?: readonly XmlifyedFile[]): OutputByType[T];
145
+ packSync<T extends OutputType>(file: TFile, type: T, overrides?: readonly XmlifyedFile[]): OutputByType[T];
154
146
  /** Async → `Promise<Uint8Array>` (like `Response.bytes()`). */
155
- toBytes(file: TFile, prettify?: boolean | PrettifyValue, overrides?: readonly XmlifyedFile[]): Promise<Uint8Array>;
147
+ toBytes(file: TFile, overrides?: readonly XmlifyedFile[]): Promise<Uint8Array>;
156
148
  /** Sync → `Uint8Array`. */
157
- toBytesSync(file: TFile, prettify?: boolean | PrettifyValue, overrides?: readonly XmlifyedFile[]): Uint8Array;
149
+ toBytesSync(file: TFile, overrides?: readonly XmlifyedFile[]): Uint8Array;
158
150
  /** Async → `Promise<string>` (raw ZIP content as string). */
159
- toString(file: TFile, prettify?: boolean | PrettifyValue, overrides?: readonly XmlifyedFile[]): Promise<string>;
151
+ toString(file: TFile, overrides?: readonly XmlifyedFile[]): Promise<string>;
160
152
  /** Sync → `string`. */
161
- toStringSync(file: TFile, prettify?: boolean | PrettifyValue, overrides?: readonly XmlifyedFile[]): string;
153
+ toStringSync(file: TFile, overrides?: readonly XmlifyedFile[]): string;
162
154
  /** Async → `Promise<Buffer>` (Node.js). */
163
- toBuffer(file: TFile, prettify?: boolean | PrettifyValue, overrides?: readonly XmlifyedFile[]): Promise<Buffer>;
155
+ toBuffer(file: TFile, overrides?: readonly XmlifyedFile[]): Promise<Buffer>;
164
156
  /** Sync → `Buffer` (Node.js). */
165
- toBufferSync(file: TFile, prettify?: boolean | PrettifyValue, overrides?: readonly XmlifyedFile[]): Buffer;
157
+ toBufferSync(file: TFile, overrides?: readonly XmlifyedFile[]): Buffer;
166
158
  /** Async → `Promise<string>` (base64-encoded). */
167
- toBase64String(file: TFile, prettify?: boolean | PrettifyValue, overrides?: readonly XmlifyedFile[]): Promise<string>;
159
+ toBase64String(file: TFile, overrides?: readonly XmlifyedFile[]): Promise<string>;
168
160
  /** Sync → `string` (base64-encoded). */
169
- toBase64StringSync(file: TFile, prettify?: boolean | PrettifyValue, overrides?: readonly XmlifyedFile[]): string;
161
+ toBase64StringSync(file: TFile, overrides?: readonly XmlifyedFile[]): string;
170
162
  /** Async → `Promise<Blob>` (browser). */
171
- toBlob(file: TFile, prettify?: boolean | PrettifyValue, overrides?: readonly XmlifyedFile[]): Promise<Blob>;
163
+ toBlob(file: TFile, overrides?: readonly XmlifyedFile[]): Promise<Blob>;
172
164
  /** Sync → `Blob`. */
173
- toBlobSync(file: TFile, prettify?: boolean | PrettifyValue, overrides?: readonly XmlifyedFile[]): Blob;
165
+ toBlobSync(file: TFile, overrides?: readonly XmlifyedFile[]): Blob;
174
166
  /** Async → `Promise<ArrayBuffer>`. */
175
- toArrayBuffer(file: TFile, prettify?: boolean | PrettifyValue, overrides?: readonly XmlifyedFile[]): Promise<ArrayBuffer>;
167
+ toArrayBuffer(file: TFile, overrides?: readonly XmlifyedFile[]): Promise<ArrayBuffer>;
176
168
  /** Sync → `ArrayBuffer`. */
177
- toArrayBufferSync(file: TFile, prettify?: boolean | PrettifyValue, overrides?: readonly XmlifyedFile[]): ArrayBuffer;
178
- /** Streaming output via Node.js Readable (truly async, uses Web Workers). */
179
- toStream(file: TFile, prettify?: boolean | PrettifyValue, overrides?: readonly XmlifyedFile[]): Readable;
169
+ toArrayBufferSync(file: TFile, overrides?: readonly XmlifyedFile[]): ArrayBuffer;
170
+ /** Streaming output via `ReadableStream<Uint8Array>` (cross-platform, uses Web Workers). */
171
+ toStream(file: TFile, overrides?: readonly XmlifyedFile[]): ReadableStream<Uint8Array>;
180
172
  }
181
173
  /**
182
174
  * Create a Packer object with all output format methods.
@@ -195,10 +187,11 @@ declare class AppProperties extends ImportedXmlComponent {
195
187
  private static instance;
196
188
  constructor();
197
189
  prepForXml(): Readonly<Record<string, any>> | undefined;
190
+ toXml(_context: Context): string;
198
191
  }
199
192
  //#endregion
200
193
  //#region src/opc/relationships.d.ts
201
- type RelationshipType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" | "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramData" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramLayout" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramQuickStyle" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramColors" | "http://schemas.microsoft.com/office/2007/relationships/diagramLayout" | "http://schemas.microsoft.com/office/2007/relationships/diagramStyle" | "http://schemas.microsoft.com/office/2007/relationships/diagramColors" | "http://schemas.microsoft.com/office/2007/relationships/diagramDrawing" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/bibliography" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/font" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/aFChunk" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/subDocument" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/presProps" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/viewProps" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableStyles" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/commentAuthors" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/video" | "http://schemas.microsoft.com/office/2007/relationships/media";
194
+ type RelationshipType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" | "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramData" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramLayout" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramQuickStyle" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramColors" | "http://schemas.microsoft.com/office/2007/relationships/diagramLayout" | "http://schemas.microsoft.com/office/2007/relationships/diagramStyle" | "http://schemas.microsoft.com/office/2007/relationships/diagramColors" | "http://schemas.microsoft.com/office/2007/relationships/diagramDrawing" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/bibliography" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/font" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/aFChunk" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/subDocument" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/presProps" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/viewProps" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableStyles" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/commentAuthors" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/video" | "http://schemas.microsoft.com/office/2007/relationships/media" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/calcChain" | "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing";
202
195
  declare const TargetModeType: {
203
196
  readonly EXTERNAL: "External";
204
197
  };
@@ -207,6 +200,11 @@ declare class Relationships extends BaseXmlComponent {
207
200
  constructor();
208
201
  addRelationship(id: number | string, type: RelationshipType, target: string, targetMode?: (typeof TargetModeType)[keyof typeof TargetModeType]): void;
209
202
  get relationshipCount(): number;
203
+ /**
204
+ * Zero-allocation fast path: directly concatenate XML string.
205
+ * Bypasses the IXmlableObject intermediate tree entirely.
206
+ */
207
+ toXml(_context: Context): string;
210
208
  prepForXml(_context: Context): IXmlableObject;
211
209
  }
212
210
  //#endregion
@@ -230,11 +228,15 @@ declare const createOverride: (contentType: string, partName?: string) => XmlCom
230
228
  //#endregion
231
229
  //#region src/formatter.d.ts
232
230
  /**
233
- * Converts an XmlComponent tree into a serializable XML object.
231
+ * Converts an XmlComponent tree into a serializable XML object or string.
234
232
  */
235
233
  declare class Formatter {
236
- format<T extends Context = Context>(input: BaseXmlComponent, context?: T): IXmlableObject;
237
- formatToXml(input: XmlComponent, context: Context, declaration?: boolean): string;
234
+ format<T extends Context = Context>(input: BaseXmlComponent, context?: T): Record<string, any>;
235
+ /**
236
+ * Serialize a component directly to XML string via the toXml() fast path.
237
+ * Always includes XML declaration.
238
+ */
239
+ formatToXml(input: BaseXmlComponent, context: Context): string;
238
240
  }
239
241
  //#endregion
240
242
  //#region src/core-properties.d.ts
@@ -269,6 +271,20 @@ declare function buildCorePropertiesXml(opts: {
269
271
  readonly lastModifiedBy?: string;
270
272
  readonly revision?: number;
271
273
  }): IXmlableObject;
274
+ /**
275
+ * Build a cp:coreProperties XML string directly (fast path).
276
+ *
277
+ * Shared by pptx and xlsx to bypass prepForXml → xml() pipeline.
278
+ */
279
+ declare function buildCorePropertiesXmlString(opts: {
280
+ readonly title?: string;
281
+ readonly subject?: string;
282
+ readonly creator?: string;
283
+ readonly keywords?: string;
284
+ readonly description?: string;
285
+ readonly lastModifiedBy?: string;
286
+ readonly revision?: number;
287
+ }): string;
272
288
  //#endregion
273
289
  //#region src/parser.d.ts
274
290
  /**
@@ -328,7 +344,6 @@ declare class RawPassthrough extends BaseXmlComponent {
328
344
  */
329
345
  type IdFormat = "rId" | "plain";
330
346
  declare const formatId: (offset: number, index: number, style: IdFormat) => string;
331
- declare function escapeRegex(str: string): string;
332
347
  declare function hasPlaceholders(xml: string): boolean;
333
348
  declare function collectPlaceholderKeys(xml: string, prefix: string): string[];
334
349
  declare function replaceImagePlaceholders(xml: string, mediaData: readonly {
@@ -362,26 +377,26 @@ declare function invertMap<K extends string, V extends string>(map: Record<K, V>
362
377
  declare const xsdRectAlignment: {
363
378
  /** User-friendly value → XSD value */to: (key: string) => string; /** XSD value → user-friendly value */
364
379
  from: (xsd: string) => string; /** The forward map (user → XSD) */
365
- forward: Record<"topLeft" | "top" | "topRight" | "left" | "center" | "right" | "bottomLeft" | "bottom" | "bottomRight", "tl" | "t" | "tr" | "l" | "ctr" | "r" | "bl" | "b" | "br">; /** The reverse map (XSD → user) */
366
- reverse: Record<"tl" | "t" | "tr" | "l" | "ctr" | "r" | "bl" | "b" | "br", "topLeft" | "top" | "topRight" | "left" | "center" | "right" | "bottomLeft" | "bottom" | "bottomRight">;
380
+ forward: Record<"center" | "topLeft" | "top" | "topRight" | "left" | "right" | "bottomLeft" | "bottom" | "bottomRight", "tl" | "t" | "tr" | "l" | "ctr" | "r" | "bl" | "b" | "br">; /** The reverse map (XSD → user) */
381
+ reverse: Record<"tl" | "t" | "tr" | "l" | "ctr" | "r" | "bl" | "b" | "br", "center" | "topLeft" | "top" | "topRight" | "left" | "right" | "bottomLeft" | "bottom" | "bottomRight">;
367
382
  };
368
383
  declare const xsdTextAlign: {
369
384
  /** User-friendly value → XSD value */to: (key: string) => string; /** XSD value → user-friendly value */
370
385
  from: (xsd: string) => string; /** The forward map (user → XSD) */
371
- forward: Record<"left" | "center" | "right" | "justify", "l" | "ctr" | "r" | "just">; /** The reverse map (XSD → user) */
372
- reverse: Record<"l" | "ctr" | "r" | "just", "left" | "center" | "right" | "justify">;
386
+ forward: Record<"center" | "left" | "right" | "justify", "l" | "ctr" | "r" | "just">; /** The reverse map (XSD → user) */
387
+ reverse: Record<"l" | "ctr" | "r" | "just", "center" | "left" | "right" | "justify">;
373
388
  };
374
389
  declare const xsdTextAnchor: {
375
390
  /** User-friendly value → XSD value */to: (key: string) => string; /** XSD value → user-friendly value */
376
391
  from: (xsd: string) => string; /** The forward map (user → XSD) */
377
- forward: Record<"top" | "center" | "bottom", "t" | "ctr" | "b">; /** The reverse map (XSD → user) */
378
- reverse: Record<"t" | "ctr" | "b", "top" | "center" | "bottom">;
392
+ forward: Record<"center" | "top" | "bottom", "t" | "ctr" | "b">; /** The reverse map (XSD → user) */
393
+ reverse: Record<"t" | "ctr" | "b", "center" | "top" | "bottom">;
379
394
  };
380
395
  declare const xsdLineCap: {
381
396
  /** User-friendly value → XSD value */to: (key: string) => string; /** XSD value → user-friendly value */
382
397
  from: (xsd: string) => string; /** The forward map (user → XSD) */
383
- forward: Record<"flat" | "round" | "square", "flat" | "rnd" | "sq">; /** The reverse map (XSD → user) */
384
- reverse: Record<"flat" | "rnd" | "sq", "flat" | "round" | "square">;
398
+ forward: Record<"round" | "square" | "flat", "flat" | "rnd" | "sq">; /** The reverse map (XSD → user) */
399
+ reverse: Record<"flat" | "rnd" | "sq", "round" | "square" | "flat">;
385
400
  };
386
401
  declare const xsdCompoundLine: {
387
402
  /** User-friendly value → XSD value */to: (key: string) => string; /** XSD value → user-friendly value */
@@ -428,8 +443,8 @@ declare const xsdPresetShadow: {
428
443
  declare const xsdMaterialType: {
429
444
  /** User-friendly value → XSD value */to: (key: string) => string; /** XSD value → user-friendly value */
430
445
  from: (xsd: string) => string; /** The forward map (user → XSD) */
431
- forward: Record<"legacyMatte" | "legacyPlastic" | "legacyMetal" | "legacyWireframe" | "matte" | "plastic" | "metal" | "warmMatte" | "translucentPowder" | "powder" | "darkEdge" | "softEdge" | "clear" | "flat" | "softMetal", "legacyMatte" | "legacyPlastic" | "legacyMetal" | "legacyWireframe" | "matte" | "plastic" | "metal" | "warmMatte" | "translucentPowder" | "powder" | "softEdge" | "clear" | "flat" | "dkEdge" | "softmetal">; /** The reverse map (XSD → user) */
432
- reverse: Record<"legacyMatte" | "legacyPlastic" | "legacyMetal" | "legacyWireframe" | "matte" | "plastic" | "metal" | "warmMatte" | "translucentPowder" | "powder" | "softEdge" | "clear" | "flat" | "dkEdge" | "softmetal", "legacyMatte" | "legacyPlastic" | "legacyMetal" | "legacyWireframe" | "matte" | "plastic" | "metal" | "warmMatte" | "translucentPowder" | "powder" | "darkEdge" | "softEdge" | "clear" | "flat" | "softMetal">;
446
+ forward: Record<"flat" | "legacyMatte" | "legacyPlastic" | "legacyMetal" | "legacyWireframe" | "matte" | "plastic" | "metal" | "warmMatte" | "translucentPowder" | "powder" | "darkEdge" | "softEdge" | "clear" | "softMetal", "flat" | "legacyMatte" | "legacyPlastic" | "legacyMetal" | "legacyWireframe" | "matte" | "plastic" | "metal" | "warmMatte" | "translucentPowder" | "powder" | "softEdge" | "clear" | "dkEdge" | "softmetal">; /** The reverse map (XSD → user) */
447
+ reverse: Record<"flat" | "legacyMatte" | "legacyPlastic" | "legacyMetal" | "legacyWireframe" | "matte" | "plastic" | "metal" | "warmMatte" | "translucentPowder" | "powder" | "softEdge" | "clear" | "dkEdge" | "softmetal", "flat" | "legacyMatte" | "legacyPlastic" | "legacyMetal" | "legacyWireframe" | "matte" | "plastic" | "metal" | "warmMatte" | "translucentPowder" | "powder" | "darkEdge" | "softEdge" | "clear" | "softMetal">;
433
448
  };
434
449
  declare const xsdPattern: {
435
450
  /** User-friendly value → XSD value */to: (key: string) => string; /** XSD value → user-friendly value */
@@ -462,4 +477,18 @@ declare const xsdTextCaps: {
462
477
  reverse: Record<"none" | "small" | "all", "none" | "small" | "all">;
463
478
  };
464
479
  //#endregion
465
- export { AppProperties, AreaChart, AttributeData, AttributeMap, AttributePayload, BackdropOptions, BarChart, BaseXmlComponent, BevelOptions, BevelPresetType, BlendMode, BlipEffectsOptions, BlipFillConfigOptions, BlipFillMediaData, BlipFillOptions, BlipOptions, BlurEffectOptions, BuilderElement, COLOR_CATEGORIES, CameraOptions, CatAx, ChartCollection, ChartData, ChartSeriesData, ChartSpace, ChartSpaceOptions, ChartTitle, ChartType, ChartTypeOptions, ColorTransformOptions, CompileFn, CompoundLine, Connection, ConnectionSite, Context, CoreProperties, CustomGeometryOptions, DEFAULT_DRAWING_XML, DOCX_NS, DashStop, DataModel, type DefaultAttributes, EMPTY_OBJECT, EffectContainerType, EffectDagOptions, EffectListOptions, EmptyElement, FillOptions, FillOverlayEffectOptions, Formatter, GeomRect, GeometryGuide, GlowEffectOptions, GradientFillOptions, GradientShadeOptions, GradientStop, GradientStopOptions, GroupTransform2DOptions, HslColorOptions, IXmlAttribute, IXmlableObject, IdFormat, IgnoreIfEmptyXmlComponent, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, InnerShadowEffectOptions, LAYOUT_CATEGORIES, LightRigOptions, LineCap, LineChart, LineEndLength, LineEndOptions, LineEndType, LineEndWidth, LineJoin, LinearShadeOptions, MediaDataTransformation, MediaTransformation, NextAttributeComponent, OoxmlMimeType, OuterShadowEffectOptions, OutlineFillProperties, OutlineOptions, OutputByType, OutputType, type OverrideAttributes, PPTX_NS, Packer, ParsedArchive, PathCommand, PathFillMode, PathOptions, PathShadeOptions, PathShadeType, PatternFillOptions, PenAlignment, Percentage, PieChart, Point, Point3D, PositivePercentage, PositiveUniversalMeasure, PresetColor, PresetColorOptions, PresetDash, PresetGeometry, PresetGeometryOptions, PresetMaterialType, PresetPattern, PresetShadowEffectOptions, PresetShadowVal, PrettifyType, RawPassthrough, RectAlignment, ReflectionEffectOptions, type RelationshipType, Relationships, RelativeMeasure, RelativeRect, RenderedParagraphNode, ReplacerConfig, RgbColorOptions, STYLE_CATEGORIES, ScRgbColorOptions, ScatterChart, Scene3DOptions, SchemeColor, SchemeColorOptions, Shape3DOptions, SmartArtCollection, SmartArtData, SmartArtRelOptions, SolidFillOptions, SourceRectangleOptions, SphereCoords, Stretch, SystemColor, SystemColorOptions, TargetModeType, ThemeColor, ThemeFont, TileAlignment, TileFlipMode, TileOptions, TokenNotFoundError, TransPoint, Transform2DOptions, TreeNode, UniqueNumericIdCreator, UniversalMeasure, ValAx, Vector3D, XmlAttributeComponent, XmlComponent, XmlNamespaceConfig, XmlifyedFile, ZIP_DEFLATE_LEVEL, ZIP_STORED_LEVEL, type ZipOptions, type Zippable, addSmartArtRelationships, appendContentType, appendRelationship, attrObj, buildCorePropertiesXml, buildFill, chartAttr, collectPlaceholderKeys, convertEmuToInches, convertEmuToPixels, convertEmuToPoints, convertInchesToEmu, convertInchesToTwip, convertMillimetersToTwip, convertOutput, convertPixelsToEmu, convertPointsToEmu, convertPrettifyType, convertToXmlComponent, createAdjustmentValues, createBevel, createBlip, createBlipEffects, createBlipFill, createBottomBevel, createChartType, createColorElement, createColorTransforms, createCustomDash, createCustomGeometry, createDataModel, createDefault, createEffectDag, createEffectList, createExtentionList, createFillOverlayEffect, createGlowEffect, createGradientFill, createGradientStop, createGroupFill, createGroupTransform2D, createHslColor, createInnerShadowEffect, createLineEnd, createNoFill, createNumRef, createOuterShadowEffect, createOutline, createOverride, createPacker, createPatternFill, createPresetColor, createPresetShadowEffect, createReflectionEffect, createReplacer, createRgbColor, createRunRenderer, createScRgbColor, createScene3D, createSchemeColor, createShape3D, createSoftEdgeEffect, createSolidFill, createSourceRectangle, createSplitInject, createStrRef, createSystemColor, createTextElementContents, createTileInfo, createTokenReplacer, createTransform2D, createTransformation, createTraverser, createZipStream, dateTimeValue, decimalNumber, eighthPointMeasureValue, elementToCompact, escapeRegex, extractBlipFillMedia, formatId, getColorXml, getFirstLevelElements, getLayoutXml, getNextRelationshipIndex, getReferencedMedia, getStyleXml, hasPlaceholders, hashedId, hexBinary, hexColorValue, hpsMeasureObj, hpsMeasureValue, invertMap, longHexNumber, measurementOrPercentValue, numberValObj, onOffObj, parseArchive, parseCorePropsElement, patchSpaceAttribute, percentageValue, pointMeasureValue, positiveUniversalMeasureValue, replaceChartPlaceholders, replaceImagePlaceholders, replaceSmartArtPlaceholders, shortHexNumber, signedHpsMeasureValue, signedTwipsMeasureValue, strFromU8, stringContainerObj, stringEnumValObj, stringValObj, toJson, twipsMeasureValue, uCharHexNumber, uniqueId, uniqueNumericIdCreator, uniqueUuid, universalMeasureValue, unsignedDecimalNumber, unzipSync, wrapEl, xsdBlendMode, xsdCompoundLine, xsdEffectContainer, xsdLineCap, xsdLineEndSize, xsdMaterialType, xsdPathFillMode, xsdPattern, xsdPenAlignment, xsdPresetShadow, xsdRectAlignment, xsdStrikeStyle, xsdTextAlign, xsdTextAnchor, xsdTextCaps, xsdUnderlineStyle, xsdVerticalMergeRev, zipAndConvert, zipSyncAndConvert };
480
+ //#region src/compiler-utils.d.ts
481
+ /**
482
+ * Convert a mapping of XML files + overrides + media into a Zippable structure.
483
+ *
484
+ * Centralises the mapping→Zippable conversion shared by all three compilers.
485
+ */
486
+ declare function compileMapping(mapping: Record<string, {
487
+ data: string;
488
+ path: string;
489
+ }>, overrides?: readonly XmlifyedFile[], media?: readonly {
490
+ data: Uint8Array;
491
+ path: string;
492
+ }[]): Zippable;
493
+ //#endregion
494
+ export { AppProperties, AreaChart, AttributeData, AttributeMap, AttributePayload, BackdropOptions, BarChart, BaseXmlComponent, BevelOptions, BevelPresetType, BlendMode, BlipEffectsOptions, BlipFillConfigOptions, BlipFillMediaData, BlipFillOptions, BlipOptions, BlurEffectOptions, BuilderElement, COLOR_CATEGORIES, CameraOptions, CatAx, ChartCollection, ChartData, ChartSeriesData, ChartSpace, ChartSpaceOptions, ChartTitle, ChartType, ChartTypeOptions, ColorTransformOptions, CompileFn, CompoundLine, Connection, ConnectionSite, Context, CoreProperties, CustomGeometryOptions, DEFAULT_DRAWING_XML, DOCX_NS, DashStop, DataModel, type DefaultAttributes, EMPTY_OBJECT, EffectContainerType, EffectDagOptions, EffectListOptions, EmptyElement, FillOptions, FillOverlayEffectOptions, Formatter, GeomRect, GeometryGuide, GlowEffectOptions, GradientFillOptions, GradientShadeOptions, GradientStop, GradientStopOptions, GroupTransform2DOptions, HslColorOptions, IXmlAttribute, IXmlableObject, IdFormat, IgnoreIfEmptyXmlComponent, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, InnerShadowEffectOptions, LAYOUT_CATEGORIES, LightRigOptions, LineCap, LineChart, LineEndLength, LineEndOptions, LineEndType, LineEndWidth, LineJoin, LinearShadeOptions, MediaDataTransformation, MediaTransformation, NextAttributeComponent, OoxmlMimeType, OuterShadowEffectOptions, OutlineFillProperties, OutlineOptions, OutputByType, OutputType, type OverrideAttributes, PPTX_NS, Packer, ParsedArchive, PathCommand, PathFillMode, PathOptions, PathShadeOptions, PathShadeType, PatternFillOptions, PenAlignment, Percentage, PieChart, Point, Point3D, PositivePercentage, PositiveUniversalMeasure, PresetColor, PresetColorOptions, PresetDash, PresetGeometry, PresetGeometryOptions, PresetMaterialType, PresetPattern, PresetShadowEffectOptions, PresetShadowVal, RawPassthrough, RectAlignment, ReflectionEffectOptions, type RelationshipType, Relationships, RelativeMeasure, RelativeRect, RenderedParagraphNode, ReplacerConfig, RgbColorOptions, STYLE_CATEGORIES, ScRgbColorOptions, ScatterChart, Scene3DOptions, SchemeColor, SchemeColorOptions, Shape3DOptions, SmartArtCollection, SmartArtData, SmartArtRelOptions, SolidFillOptions, SourceRectangleOptions, SphereCoords, Stretch, SystemColor, SystemColorOptions, TargetModeType, ThemeColor, ThemeFont, TileAlignment, TileFlipMode, TileOptions, TokenNotFoundError, TransPoint, Transform2DOptions, TreeNode, UniqueNumericIdCreator, UniversalMeasure, ValAx, Vector3D, XmlAttributeComponent, XmlComponent, XmlNamespaceConfig, XmlifyedFile, ZIP_DEFLATE_LEVEL, ZIP_STORED_LEVEL, type ZipOptions, type Zippable, addSmartArtRelationships, appendContentType, appendRelationship, attrObj, buildCorePropertiesXml, buildCorePropertiesXmlString, buildFill, chartAttr, collectPlaceholderKeys, compileMapping, convertEmuToInches, convertEmuToPixels, convertEmuToPoints, convertInchesToEmu, convertInchesToTwip, convertMillimetersToTwip, convertOutput, convertPixelsToEmu, convertPointsToEmu, convertToXmlComponent, createAdjustmentValues, createBevel, createBlip, createBlipEffects, createBlipFill, createBottomBevel, createChartType, createColorElement, createColorTransforms, createCustomDash, createCustomGeometry, createDataModel, createDefault, createEffectDag, createEffectList, createExtentionList, createFillOverlayEffect, createGlowEffect, createGradientFill, createGradientStop, createGroupFill, createGroupTransform2D, createHslColor, createInnerShadowEffect, createLineEnd, createNoFill, createNumRef, createOuterShadowEffect, createOutline, createOverride, createPacker, createPatternFill, createPresetColor, createPresetShadowEffect, createReflectionEffect, createReplacer, createRgbColor, createRunRenderer, createScRgbColor, createScene3D, createSchemeColor, createShape3D, createSoftEdgeEffect, createSolidFill, createSourceRectangle, createSplitInject, createStrRef, createSystemColor, createTextElementContents, createTileInfo, createTokenReplacer, createTransform2D, createTransformation, createTraverser, createZipStream, dateTimeValue, decimalNumber, eighthPointMeasureValue, elementToCompact, extractBlipFillMedia, formatId, getColorXml, getFirstLevelElements, getLayoutXml, getNextRelationshipIndex, getReferencedMedia, getStyleXml, hasPlaceholders, hashedId, hexBinary, hexColorValue, hpsMeasureObj, hpsMeasureValue, invertMap, longHexNumber, measurementOrPercentValue, numberValObj, onOffObj, parseArchive, parseCorePropsElement, patchSpaceAttribute, percentageValue, pointMeasureValue, positiveUniversalMeasureValue, replaceChartPlaceholders, replaceImagePlaceholders, replaceSmartArtPlaceholders, shortHexNumber, signedHpsMeasureValue, signedTwipsMeasureValue, strFromU8, stringContainerObj, stringEnumValObj, stringValObj, toJson, twipsMeasureValue, uCharHexNumber, uniqueId, uniqueNumericIdCreator, uniqueUuid, universalMeasureValue, unsignedDecimalNumber, unzipSync, wrapEl, xsdBlendMode, xsdCompoundLine, xsdEffectContainer, xsdLineCap, xsdLineEndSize, xsdMaterialType, xsdPathFillMode, xsdPattern, xsdPenAlignment, xsdPresetShadow, xsdRectAlignment, xsdStrikeStyle, xsdTextAlign, xsdTextAnchor, xsdTextCaps, xsdUnderlineStyle, xsdVerticalMergeRev, zipAndConvert, zipSyncAndConvert };
package/dist/index.mjs CHANGED
@@ -1,12 +1,11 @@
1
- import { _ as XmlAttributeComponent, a as BuilderElement, b as XmlComponent, c as chartAttr, d as onOffObj, f as stringContainerObj, g as NextAttributeComponent, h as wrapEl, i as convertToXmlComponent, l as hpsMeasureObj, m as stringValObj, n as ImportedRootElementAttributes, o as EmptyElement, p as stringEnumValObj, r as ImportedXmlComponent, s as attrObj, t as InitializableXmlComponent, u as numberValObj, v as EMPTY_OBJECT, x as BaseXmlComponent, y as IgnoreIfEmptyXmlComponent } from "./xml-components-CADgke8j.mjs";
1
+ import { _ as XmlAttributeComponent, a as BuilderElement, b as XmlComponent, c as chartAttr, d as onOffObj, f as stringContainerObj, g as NextAttributeComponent, h as wrapEl, i as convertToXmlComponent, l as hpsMeasureObj, m as stringValObj, n as ImportedRootElementAttributes, o as EmptyElement, p as stringEnumValObj, r as ImportedXmlComponent, s as attrObj, t as InitializableXmlComponent, u as numberValObj, v as EMPTY_OBJECT, x as BaseXmlComponent, y as IgnoreIfEmptyXmlComponent } from "./xml-components-ctIqansl.mjs";
2
2
  import { ThemeColor, ThemeFont, dateTimeValue, decimalNumber, eighthPointMeasureValue, hexBinary, hexColorValue, hpsMeasureValue, longHexNumber, measurementOrPercentValue, percentageValue, pointMeasureValue, positiveUniversalMeasureValue, shortHexNumber, signedHpsMeasureValue, signedTwipsMeasureValue, twipsMeasureValue, uCharHexNumber, universalMeasureValue, unsignedDecimalNumber } from "./values.mjs";
3
- import { $ as xsdCompoundLine, A as LineJoin, At as hashedId, B as createNoFill, Bt as convertPixelsToEmu, C as createOuterShadowEffect, Ct as createSchemeColor, D as createFillOverlayEffect, Dt as createPresetColor, E as BlendMode, Et as PresetColor, F as LineEndType, Ft as convertEmuToPixels, G as PathShadeType, H as extractBlipFillMedia, I as LineEndWidth, It as convertEmuToPoints, J as createGradientStop, K as TileFlipMode, L as createLineEnd, Lt as convertInchesToEmu, M as PresetDash, Mt as uniqueNumericIdCreator, N as createOutline, Nt as uniqueUuid, O as CompoundLine, Ot as createHslColor, P as LineEndLength, Pt as convertEmuToInches, Q as xsdBlendMode, R as createCustomDash, Rt as convertInchesToTwip, S as RectAlignment, St as SchemeColor, T as createGlowEffect, Tt as createRgbColor, U as PresetPattern, V as buildFill, Vt as convertPointsToEmu, W as createPatternFill, X as createTileInfo, Y as TileAlignment, Z as invertMap, _ as createEffectList, _t as createBlipEffects, a as createBlip, at as xsdPattern, b as PresetShadowVal, bt as SystemColor, c as PresetGeometry, ct as xsdRectAlignment, d as createShape3D, dt as xsdTextAnchor, et as xsdEffectContainer, f as BevelPresetType, ft as xsdTextCaps, g as createEffectDag, gt as createSourceRectangle, h as createScene3D, ht as Stretch, i as createBlipFill, it as xsdPathFillMode, j as PenAlignment, jt as uniqueId, k as LineCap, kt as createColorTransforms, l as createAdjustmentValues, lt as xsdStrikeStyle, m as createBottomBevel, mt as xsdVerticalMergeRev, n as createGroupTransform2D, nt as xsdLineEndSize, o as createExtentionList, ot as xsdPenAlignment, p as createBevel, pt as xsdUnderlineStyle, q as createGradientFill, r as createTransform2D, rt as xsdMaterialType, s as createCustomGeometry, st as xsdPresetShadow, t as createTransformation, tt as xsdLineCap, u as PresetMaterialType, ut as xsdTextAlign, v as createSoftEdgeEffect, vt as createColorElement, w as createInnerShadowEffect, wt as createScRgbColor, x as createPresetShadowEffect, xt as createSystemColor, y as createReflectionEffect, yt as createSolidFill, z as createGroupFill, zt as convertMillimetersToTwip } from "./drawingml-YMdpQfWs.mjs";
4
- import { a as DataModel, c as getColorXml, d as COLOR_CATEGORIES, f as LAYOUT_CATEGORIES, i as TransPoint, l as getLayoutXml, n as SmartArtCollection, o as Connection, p as STYLE_CATEGORIES, r as Point, s as DEFAULT_DRAWING_XML, t as createDataModel, u as getStyleXml } from "./smartart-DBQ_rRfK.mjs";
5
- import { a as ScatterChart, c as BarChart, d as createStrRef, f as CatAx, i as createChartType, l as AreaChart, n as ChartSpace, o as PieChart, p as ValAx, r as ChartTitle, s as LineChart, t as ChartCollection, u as createNumRef } from "./chart-Bd9E-YhB.mjs";
6
- import { a as createTraverser, c as TokenNotFoundError, d as getFirstLevelElements, f as patchSpaceAttribute, h as PPTX_NS, i as createReplacer, l as createSplitInject, m as DOCX_NS, n as getNextRelationshipIndex, o as createRunRenderer, p as toJson, r as appendContentType, s as createTokenReplacer, t as appendRelationship, u as createTextElementContents } from "./patch-BdMU95aX.mjs";
7
- import { js2xml, textOf, xml2js } from "@office-open/xml";
3
+ import { $ as xsdCompoundLine, A as LineJoin, At as hashedId, B as createNoFill, Bt as convertPixelsToEmu, C as createOuterShadowEffect, Ct as createSchemeColor, D as createFillOverlayEffect, Dt as createPresetColor, E as BlendMode, Et as PresetColor, F as LineEndType, Ft as convertEmuToPixels, G as PathShadeType, H as extractBlipFillMedia, I as LineEndWidth, It as convertEmuToPoints, J as createGradientStop, K as TileFlipMode, L as createLineEnd, Lt as convertInchesToEmu, M as PresetDash, Mt as uniqueNumericIdCreator, N as createOutline, Nt as uniqueUuid, O as CompoundLine, Ot as createHslColor, P as LineEndLength, Pt as convertEmuToInches, Q as xsdBlendMode, R as createCustomDash, Rt as convertInchesToTwip, S as RectAlignment, St as SchemeColor, T as createGlowEffect, Tt as createRgbColor, U as PresetPattern, V as buildFill, Vt as convertPointsToEmu, W as createPatternFill, X as createTileInfo, Y as TileAlignment, Z as invertMap, _ as createEffectList, _t as createBlipEffects, a as createBlip, at as xsdPattern, b as PresetShadowVal, bt as SystemColor, c as PresetGeometry, ct as xsdRectAlignment, d as createShape3D, dt as xsdTextAnchor, et as xsdEffectContainer, f as BevelPresetType, ft as xsdTextCaps, g as createEffectDag, gt as createSourceRectangle, h as createScene3D, ht as Stretch, i as createBlipFill, it as xsdPathFillMode, j as PenAlignment, jt as uniqueId, k as LineCap, kt as createColorTransforms, l as createAdjustmentValues, lt as xsdStrikeStyle, m as createBottomBevel, mt as xsdVerticalMergeRev, n as createGroupTransform2D, nt as xsdLineEndSize, o as createExtentionList, ot as xsdPenAlignment, p as createBevel, pt as xsdUnderlineStyle, q as createGradientFill, r as createTransform2D, rt as xsdMaterialType, s as createCustomGeometry, st as xsdPresetShadow, t as createTransformation, tt as xsdLineCap, u as PresetMaterialType, ut as xsdTextAlign, v as createSoftEdgeEffect, vt as createColorElement, w as createInnerShadowEffect, wt as createScRgbColor, x as createPresetShadowEffect, xt as createSystemColor, y as createReflectionEffect, yt as createSolidFill, z as createGroupFill, zt as convertMillimetersToTwip } from "./drawingml-DzU9sEb0.mjs";
4
+ import { a as DataModel, c as getColorXml, d as COLOR_CATEGORIES, f as LAYOUT_CATEGORIES, i as TransPoint, l as getLayoutXml, n as SmartArtCollection, o as Connection, p as STYLE_CATEGORIES, r as Point, s as DEFAULT_DRAWING_XML, t as createDataModel, u as getStyleXml } from "./smartart-vyDm6U1_.mjs";
5
+ import { a as ScatterChart, c as BarChart, d as createStrRef, f as CatAx, i as createChartType, l as AreaChart, n as ChartSpace, o as PieChart, p as ValAx, r as ChartTitle, s as LineChart, t as ChartCollection, u as createNumRef } from "./chart-DO9i3S1G.mjs";
6
+ import { a as createTraverser, c as TokenNotFoundError, d as getFirstLevelElements, f as patchSpaceAttribute, h as PPTX_NS, i as createReplacer, l as createSplitInject, m as DOCX_NS, n as getNextRelationshipIndex, o as createRunRenderer, p as toJson, r as appendContentType, s as createTokenReplacer, t as appendRelationship, u as createTextElementContents } from "./patch-O6SD_BaJ.mjs";
7
+ import { escapeXml, js2xml, textOf, xml2js } from "@office-open/xml";
8
8
  import { AsyncZipDeflate, Zip, ZipPassThrough, strFromU8, strFromU8 as strFromU8$1, strToU8, unzipSync, unzipSync as unzipSync$1, zip, zipSync } from "fflate";
9
- import { Readable } from "stream";
10
9
  //#region src/output-type.ts
11
10
  /**
12
11
  * Output type definitions for OOXML document export.
@@ -15,7 +14,8 @@ import { Readable } from "stream";
15
14
  */
16
15
  const OoxmlMimeType = {
17
16
  DOCX: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
18
- PPTX: "application/vnd.openxmlformats-officedocument.presentationml.presentation"
17
+ PPTX: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
18
+ XLSX: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
19
19
  };
20
20
  const convertOutput = (data, type, mimeType = OoxmlMimeType.DOCX) => {
21
21
  switch (type) {
@@ -38,13 +38,6 @@ const convertOutput = (data, type, mimeType = OoxmlMimeType.DOCX) => {
38
38
  *
39
39
  * @module
40
40
  */
41
- const PrettifyType = {
42
- NONE: "",
43
- WITH_2_BLANKS: " ",
44
- WITH_4_BLANKS: " ",
45
- WITH_TAB: " "
46
- };
47
- const convertPrettifyType = (prettify) => prettify === true ? PrettifyType.WITH_2_BLANKS : prettify === false ? void 0 : prettify;
48
41
  /** Default DEFLATE compression level matching Microsoft Office behavior. */
49
42
  const ZIP_DEFLATE_LEVEL = 6;
50
43
  /** STORE level for already-compressed media formats (JPEG, PNG, GIF, etc.). */
@@ -58,7 +51,10 @@ const ZIP_STORED_LEVEL = 0;
58
51
  */
59
52
  const zipAndConvert = async (files, type, mimeType, level = 6) => {
60
53
  return convertOutput(await new Promise((resolve, reject) => {
61
- zip(files, { level }, (err, data) => {
54
+ zip(files, {
55
+ level,
56
+ consume: true
57
+ }, (err, data) => {
62
58
  if (err) reject(err);
63
59
  else resolve(data);
64
60
  });
@@ -74,35 +70,35 @@ const zipSyncAndConvert = (files, type, mimeType, level = 6) => {
74
70
  return convertOutput(zipSync(files, { level }), type, mimeType);
75
71
  };
76
72
  /**
77
- * Create a Node.js Readable stream from compressed file entries.
73
+ * Create a `ReadableStream<Uint8Array>` from compressed file entries.
78
74
  *
79
- * Uses fflate's AsyncZipDeflate for non-blocking DEFLATE compression via
80
- * Web Workers. STORED entries (media) pass through synchronously.
81
- * Chunks are emitted asynchronously as each file's compression completes.
75
+ * Uses fflate's `AsyncZipDeflate` for non-blocking DEFLATE compression.
76
+ * `STORED` entries (media) pass through synchronously.
77
+ * Works in both Node.js and browsers (Web Streams API).
82
78
  */
83
79
  const createZipStream = (files) => {
84
- const stream = new Readable({ read() {} });
85
- try {
86
- const zip = new Zip((err, chunk, final) => {
87
- if (err) {
88
- stream.destroy(err);
89
- return;
80
+ return new ReadableStream({ start(controller) {
81
+ try {
82
+ const zip = new Zip((err, chunk, _final) => {
83
+ if (err) {
84
+ controller.error(err);
85
+ return;
86
+ }
87
+ controller.enqueue(chunk);
88
+ if (_final) controller.close();
89
+ });
90
+ for (const [name, data] of Object.entries(files)) {
91
+ const raw = Array.isArray(data) ? data[0] : data;
92
+ const level = Array.isArray(data) ? data[1].level ?? 6 : 6;
93
+ const entry = level === 0 ? new ZipPassThrough(name) : new AsyncZipDeflate(name, { level });
94
+ zip.add(entry);
95
+ entry.push(raw, true);
90
96
  }
91
- if (!stream.destroyed) stream.push(Buffer.from(chunk));
92
- if (final) stream.push(null);
93
- });
94
- for (const [name, data] of Object.entries(files)) {
95
- const raw = Array.isArray(data) ? data[0] : data;
96
- const level = Array.isArray(data) ? data[1].level ?? 6 : 6;
97
- const entry = level === 0 ? new ZipPassThrough(name) : new AsyncZipDeflate(name, { level });
98
- zip.add(entry);
99
- entry.push(raw, true);
97
+ zip.end();
98
+ } catch (err) {
99
+ controller.error(err instanceof Error ? err : new Error(String(err)));
100
100
  }
101
- zip.end();
102
- } catch (err) {
103
- stream.destroy(err instanceof Error ? err : new Error(String(err)));
104
- }
105
- return stream;
101
+ } });
106
102
  };
107
103
  /**
108
104
  * Create a Packer object with all output format methods.
@@ -113,33 +109,33 @@ const createZipStream = (files) => {
113
109
  */
114
110
  const createPacker = (options) => {
115
111
  const { compile, mimeType } = options;
116
- const compileFiles = (file, prettify, overrides = []) => compile(file, convertPrettifyType(prettify), overrides);
117
- const pack = async (file, type, prettify, overrides) => {
118
- return zipAndConvert(compileFiles(file, prettify, overrides), type, mimeType);
112
+ const compileFiles = (file, overrides = []) => compile(file, overrides);
113
+ const pack = async (file, type, overrides) => {
114
+ return zipAndConvert(compileFiles(file, overrides), type, mimeType);
119
115
  };
120
- const toBytes = (file, prettify, overrides) => pack(file, "uint8array", prettify, overrides);
121
- const toString = (file, prettify, overrides) => pack(file, "string", prettify, overrides);
122
- const toBuffer = (file, prettify, overrides) => pack(file, "nodebuffer", prettify, overrides);
123
- const toBase64String = (file, prettify, overrides) => pack(file, "base64", prettify, overrides);
124
- const toBlob = (file, prettify, overrides) => pack(file, "blob", prettify, overrides);
125
- const toArrayBuffer = (file, prettify, overrides) => pack(file, "arraybuffer", prettify, overrides);
126
- const packSync = (file, type, prettify, overrides) => {
127
- return zipSyncAndConvert(compileFiles(file, prettify, overrides), type, mimeType);
116
+ const toBytes = (file, overrides) => pack(file, "uint8array", overrides);
117
+ const toString = (file, overrides) => pack(file, "string", overrides);
118
+ const toBuffer = (file, overrides) => pack(file, "nodebuffer", overrides);
119
+ const toBase64String = (file, overrides) => pack(file, "base64", overrides);
120
+ const toBlob = (file, overrides) => pack(file, "blob", overrides);
121
+ const toArrayBuffer = (file, overrides) => pack(file, "arraybuffer", overrides);
122
+ const packSync = (file, type, overrides) => {
123
+ return zipSyncAndConvert(compileFiles(file, overrides), type, mimeType);
128
124
  };
129
- const toBytesSync = (file, prettify, overrides) => packSync(file, "uint8array", prettify, overrides);
130
- const toStringSync = (file, prettify, overrides) => packSync(file, "string", prettify, overrides);
131
- const toBufferSync = (file, prettify, overrides) => packSync(file, "nodebuffer", prettify, overrides);
132
- const toBase64StringSync = (file, prettify, overrides) => packSync(file, "base64", prettify, overrides);
133
- const toBlobSync = (file, prettify, overrides) => packSync(file, "blob", prettify, overrides);
134
- const toArrayBufferSync = (file, prettify, overrides) => packSync(file, "arraybuffer", prettify, overrides);
135
- const toStream = (file, prettify, overrides) => {
125
+ const toBytesSync = (file, overrides) => packSync(file, "uint8array", overrides);
126
+ const toStringSync = (file, overrides) => packSync(file, "string", overrides);
127
+ const toBufferSync = (file, overrides) => packSync(file, "nodebuffer", overrides);
128
+ const toBase64StringSync = (file, overrides) => packSync(file, "base64", overrides);
129
+ const toBlobSync = (file, overrides) => packSync(file, "blob", overrides);
130
+ const toArrayBufferSync = (file, overrides) => packSync(file, "arraybuffer", overrides);
131
+ const toStream = (file, overrides) => {
136
132
  let files;
137
133
  try {
138
- files = compileFiles(file, prettify, overrides);
134
+ files = compileFiles(file, overrides);
139
135
  } catch (err) {
140
- const errorStream = new Readable({ read() {} });
141
- errorStream.destroy(err instanceof Error ? err : new Error(String(err)));
142
- return errorStream;
136
+ return new ReadableStream({ start(controller) {
137
+ controller.error(err instanceof Error ? err : new Error(String(err)));
138
+ } });
143
139
  }
144
140
  return createZipStream(files);
145
141
  };
@@ -173,6 +169,9 @@ var AppProperties = class AppProperties extends ImportedXmlComponent {
173
169
  prepForXml() {
174
170
  return AppProperties.instance.prepForXml({ stack: [] });
175
171
  }
172
+ toXml(_context) {
173
+ return AppProperties.instance.toXml(_context);
174
+ }
176
175
  };
177
176
  //#endregion
178
177
  //#region src/opc/relationships.ts
@@ -194,6 +193,19 @@ var Relationships = class extends BaseXmlComponent {
194
193
  get relationshipCount() {
195
194
  return this.entries.length;
196
195
  }
196
+ /**
197
+ * Zero-allocation fast path: directly concatenate XML string.
198
+ * Bypasses the IXmlableObject intermediate tree entirely.
199
+ */
200
+ toXml(_context) {
201
+ const p = ["<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">"];
202
+ for (const e of this.entries) {
203
+ const tm = e.targetMode ? ` TargetMode="${escapeXml(e.targetMode)}"` : "";
204
+ p.push(`<Relationship Id="${escapeXml(e.id)}" Type="${escapeXml(e.type)}" Target="${escapeXml(e.target)}"${tm}/>`);
205
+ }
206
+ p.push("</Relationships>");
207
+ return p.join("");
208
+ }
197
209
  prepForXml(_context) {
198
210
  const children = [RELS_ATTRS];
199
211
  for (const e of this.entries) {
@@ -257,7 +269,7 @@ const createOverride = (contentType, partName) => new BuilderElement({
257
269
  //#region src/formatter.ts
258
270
  const XML_DECL = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>";
259
271
  /**
260
- * Converts an XmlComponent tree into a serializable XML object.
272
+ * Converts an XmlComponent tree into a serializable XML object or string.
261
273
  */
262
274
  var Formatter = class {
263
275
  format(input, context = { stack: [] }) {
@@ -265,9 +277,13 @@ var Formatter = class {
265
277
  if (output) return output;
266
278
  throw new Error("XMLComponent did not format correctly");
267
279
  }
268
- formatToXml(input, context, declaration) {
269
- const str = input.toXml(context);
270
- return declaration ? XML_DECL + str : str;
280
+ /**
281
+ * Serialize a component directly to XML string via the toXml() fast path.
282
+ * Always includes XML declaration.
283
+ */
284
+ formatToXml(input, context) {
285
+ const body = input.toXml(context);
286
+ return body ? XML_DECL + body : "";
271
287
  }
272
288
  };
273
289
  //#endregion
@@ -341,13 +357,33 @@ function buildCorePropertiesXml(opts) {
341
357
  if (opts.creator) children.push({ "dc:creator": [opts.creator] });
342
358
  if (opts.keywords) children.push({ "cp:keywords": [opts.keywords] });
343
359
  if (opts.description) children.push({ "dc:description": [opts.description] });
344
- if (opts.lastModifiedBy) children.push({ "cp:lastModifiedBy": [opts.lastModifiedBy] });
360
+ children.push({ "cp:lastModifiedBy": [opts.lastModifiedBy || opts.creator || "Unknown"] });
345
361
  if (opts.revision) children.push({ "cp:revision": [String(opts.revision)] });
346
362
  const now = (/* @__PURE__ */ new Date()).toISOString();
347
363
  children.push({ "dcterms:created": [W3CDTF_ATTR, now] });
348
364
  children.push({ "dcterms:modified": [W3CDTF_ATTR, now] });
349
365
  return { "cp:coreProperties": children };
350
366
  }
367
+ /**
368
+ * Build a cp:coreProperties XML string directly (fast path).
369
+ *
370
+ * Shared by pptx and xlsx to bypass prepForXml → xml() pipeline.
371
+ */
372
+ function buildCorePropertiesXmlString(opts) {
373
+ const p = ["<cp:coreProperties xmlns:cp=\"http://schemas.openxmlformats.org/package/2006/metadata/core-properties\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcmitype=\"http://purl.org/dc/dcmitype/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"];
374
+ if (opts.title) p.push(`<dc:title>${escapeXml(opts.title)}</dc:title>`);
375
+ if (opts.subject) p.push(`<dc:subject>${escapeXml(opts.subject)}</dc:subject>`);
376
+ if (opts.creator) p.push(`<dc:creator>${escapeXml(opts.creator)}</dc:creator>`);
377
+ if (opts.keywords) p.push(`<cp:keywords>${escapeXml(opts.keywords)}</cp:keywords>`);
378
+ if (opts.description) p.push(`<dc:description>${escapeXml(opts.description)}</dc:description>`);
379
+ p.push(`<cp:lastModifiedBy>${escapeXml(opts.lastModifiedBy || opts.creator || "Unknown")}</cp:lastModifiedBy>`);
380
+ if (opts.revision) p.push(`<cp:revision>${opts.revision}</cp:revision>`);
381
+ const now = (/* @__PURE__ */ new Date()).toISOString();
382
+ p.push(`<dcterms:created xsi:type="dcterms:W3CDTF">${now}</dcterms:created>`);
383
+ p.push(`<dcterms:modified xsi:type="dcterms:W3CDTF">${now}</dcterms:modified>`);
384
+ p.push("</cp:coreProperties>");
385
+ return p.join("");
386
+ }
351
387
  //#endregion
352
388
  //#region src/parser.ts
353
389
  const XML_PARSE_OPTIONS = {
@@ -426,11 +462,34 @@ var ParsedArchive = class {
426
462
  /** Serialize back to a ZIP buffer, merging original zip + modifications. */
427
463
  save() {
428
464
  const files = {};
429
- for (const [path, data] of this.zip) if (!this.modified.has(path)) files[path] = data;
430
- for (const [path, data] of this.modified) files[path] = data;
465
+ for (const [path, data] of this.zip) if (!this.modified.has(path)) files[path] = isMediaPath(path) ? [data, { level: MEDIA_STORED_LEVEL }] : data;
466
+ for (const [path, data] of this.modified) files[path] = isMediaPath(path) ? [data, { level: MEDIA_STORED_LEVEL }] : data;
431
467
  return zipSync(files);
432
468
  }
433
469
  };
470
+ /** Set of already-compressed media file extensions (lowercase, with dot prefix). */
471
+ const MEDIA_EXTENSIONS = new Set([
472
+ ".png",
473
+ ".jpg",
474
+ ".jpeg",
475
+ ".gif",
476
+ ".wmf",
477
+ ".emf",
478
+ ".tif",
479
+ ".tiff",
480
+ ".avi",
481
+ ".mp4",
482
+ ".mp3",
483
+ ".wav"
484
+ ]);
485
+ /** Check if a file path has a media extension that should use STORE (no compression). */
486
+ function isMediaPath(path) {
487
+ const dot = path.lastIndexOf(".");
488
+ if (dot === -1) return false;
489
+ return MEDIA_EXTENSIONS.has(path.slice(dot).toLowerCase());
490
+ }
491
+ /** STORE level for already-compressed media formats. */
492
+ const MEDIA_STORED_LEVEL = 0;
434
493
  /** Parse an OOXML archive (.docx, .pptx, .xlsx) into a ParsedArchive. */
435
494
  function parseArchive(data) {
436
495
  return new ParsedArchive(data);
@@ -474,9 +533,6 @@ var RawPassthrough = class extends BaseXmlComponent {
474
533
  //#endregion
475
534
  //#region src/placeholder.ts
476
535
  const formatId = (offset, index, style) => style === "rId" ? `rId${offset + index}` : `${offset + index}`;
477
- function escapeRegex(str) {
478
- return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
479
- }
480
536
  function hasPlaceholders(xml) {
481
537
  return xml.includes("{");
482
538
  }
@@ -497,7 +553,7 @@ function collectPlaceholderKeys(xml, prefix) {
497
553
  function replaceImagePlaceholders(xml, mediaData, offset, idFormat = "rId") {
498
554
  let result = xml;
499
555
  mediaData.forEach((image, i) => {
500
- result = result.replace(new RegExp(`\\{${escapeRegex(image.fileName)}\\}`, "g"), formatId(offset, i, idFormat));
556
+ result = result.replaceAll(`{${image.fileName}}`, formatId(offset, i, idFormat));
501
557
  });
502
558
  return result;
503
559
  }
@@ -507,7 +563,7 @@ function getReferencedMedia(xml, mediaArray) {
507
563
  function replaceChartPlaceholders(xml, chartKeys, offset, idFormat = "rId") {
508
564
  let result = xml;
509
565
  chartKeys.forEach((key, i) => {
510
- result = result.replace(new RegExp(`\\{chart:${escapeRegex(key)}\\}`, "g"), formatId(offset, i, idFormat));
566
+ result = result.replaceAll(`{chart:${key}}`, formatId(offset, i, idFormat));
511
567
  });
512
568
  return result;
513
569
  }
@@ -518,10 +574,10 @@ function replaceSmartArtPlaceholders(xml, keys, dataOffset, idFormat = "rId") {
518
574
  const qsOffset = loOffset + count;
519
575
  const csOffset = qsOffset + count;
520
576
  keys.forEach((key, i) => {
521
- result = result.replace(new RegExp(`\\{smartart:${escapeRegex(key)}\\}`, "g"), formatId(dataOffset, i, idFormat));
522
- result = result.replace(new RegExp(`\\{smartart-lo:${escapeRegex(key)}\\}`, "g"), formatId(loOffset, i, idFormat));
523
- result = result.replace(new RegExp(`\\{smartart-qs:${escapeRegex(key)}\\}`, "g"), formatId(qsOffset, i, idFormat));
524
- result = result.replace(new RegExp(`\\{smartart-cs:${escapeRegex(key)}\\}`, "g"), formatId(csOffset, i, idFormat));
577
+ result = result.replaceAll(`{smartart:${key}}`, formatId(dataOffset, i, idFormat));
578
+ result = result.replaceAll(`{smartart-lo:${key}}`, formatId(loOffset, i, idFormat));
579
+ result = result.replaceAll(`{smartart-qs:${key}}`, formatId(qsOffset, i, idFormat));
580
+ result = result.replaceAll(`{smartart-cs:${key}}`, formatId(csOffset, i, idFormat));
525
581
  });
526
582
  return result;
527
583
  }
@@ -541,4 +597,22 @@ function addSmartArtRelationships(keys, addRel, baseOffset, globalStartIndex, op
541
597
  });
542
598
  }
543
599
  //#endregion
544
- export { AppProperties, AreaChart, BarChart, BaseXmlComponent, BevelPresetType, BlendMode, BuilderElement, COLOR_CATEGORIES, CatAx, ChartCollection, ChartSpace, ChartTitle, CompoundLine, Connection, DEFAULT_DRAWING_XML, DOCX_NS, DataModel, EMPTY_OBJECT, EmptyElement, Formatter, IgnoreIfEmptyXmlComponent, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, LAYOUT_CATEGORIES, LineCap, LineChart, LineEndLength, LineEndType, LineEndWidth, LineJoin, NextAttributeComponent, OoxmlMimeType, PPTX_NS, ParsedArchive, PathShadeType, PenAlignment, PieChart, Point, PresetColor, PresetDash, PresetGeometry, PresetMaterialType, PresetPattern, PresetShadowVal, PrettifyType, RawPassthrough, RectAlignment, Relationships, STYLE_CATEGORIES, ScatterChart, SchemeColor, SmartArtCollection, Stretch, SystemColor, TargetModeType, ThemeColor, ThemeFont, TileAlignment, TileFlipMode, TokenNotFoundError, TransPoint, ValAx, XmlAttributeComponent, XmlComponent, ZIP_DEFLATE_LEVEL, ZIP_STORED_LEVEL, addSmartArtRelationships, appendContentType, appendRelationship, attrObj, buildCorePropertiesXml, buildFill, chartAttr, collectPlaceholderKeys, convertEmuToInches, convertEmuToPixels, convertEmuToPoints, convertInchesToEmu, convertInchesToTwip, convertMillimetersToTwip, convertOutput, convertPixelsToEmu, convertPointsToEmu, convertPrettifyType, convertToXmlComponent, createAdjustmentValues, createBevel, createBlip, createBlipEffects, createBlipFill, createBottomBevel, createChartType, createColorElement, createColorTransforms, createCustomDash, createCustomGeometry, createDataModel, createDefault, createEffectDag, createEffectList, createExtentionList, createFillOverlayEffect, createGlowEffect, createGradientFill, createGradientStop, createGroupFill, createGroupTransform2D, createHslColor, createInnerShadowEffect, createLineEnd, createNoFill, createNumRef, createOuterShadowEffect, createOutline, createOverride, createPacker, createPatternFill, createPresetColor, createPresetShadowEffect, createReflectionEffect, createReplacer, createRgbColor, createRunRenderer, createScRgbColor, createScene3D, createSchemeColor, createShape3D, createSoftEdgeEffect, createSolidFill, createSourceRectangle, createSplitInject, createStrRef, createSystemColor, createTextElementContents, createTileInfo, createTokenReplacer, createTransform2D, createTransformation, createTraverser, createZipStream, dateTimeValue, decimalNumber, eighthPointMeasureValue, elementToCompact, escapeRegex, extractBlipFillMedia, formatId, getColorXml, getFirstLevelElements, getLayoutXml, getNextRelationshipIndex, getReferencedMedia, getStyleXml, hasPlaceholders, hashedId, hexBinary, hexColorValue, hpsMeasureObj, hpsMeasureValue, invertMap, longHexNumber, measurementOrPercentValue, numberValObj, onOffObj, parseArchive, parseCorePropsElement, patchSpaceAttribute, percentageValue, pointMeasureValue, positiveUniversalMeasureValue, replaceChartPlaceholders, replaceImagePlaceholders, replaceSmartArtPlaceholders, shortHexNumber, signedHpsMeasureValue, signedTwipsMeasureValue, strFromU8, stringContainerObj, stringEnumValObj, stringValObj, toJson, twipsMeasureValue, uCharHexNumber, uniqueId, uniqueNumericIdCreator, uniqueUuid, universalMeasureValue, unsignedDecimalNumber, unzipSync, wrapEl, xsdBlendMode, xsdCompoundLine, xsdEffectContainer, xsdLineCap, xsdLineEndSize, xsdMaterialType, xsdPathFillMode, xsdPattern, xsdPenAlignment, xsdPresetShadow, xsdRectAlignment, xsdStrikeStyle, xsdTextAlign, xsdTextAnchor, xsdTextCaps, xsdUnderlineStyle, xsdVerticalMergeRev, zipAndConvert, zipSyncAndConvert };
600
+ //#region src/compiler-utils.ts
601
+ /** Default STORE level for already-compressed media formats. */
602
+ const ZIP_STORED_LEVEL$1 = 0;
603
+ /** Reusable TextEncoder instance (stateless, safe to share). */
604
+ const encoder = new TextEncoder();
605
+ /**
606
+ * Convert a mapping of XML files + overrides + media into a Zippable structure.
607
+ *
608
+ * Centralises the mapping→Zippable conversion shared by all three compilers.
609
+ */
610
+ function compileMapping(mapping, overrides, media) {
611
+ const files = {};
612
+ for (const entry of Object.values(mapping)) files[entry.path] = encoder.encode(entry.data);
613
+ if (overrides) for (const o of overrides) files[o.path] = typeof o.data === "string" ? encoder.encode(o.data) : o.data;
614
+ if (media) for (const m of media) files[m.path] = [m.data, { level: ZIP_STORED_LEVEL$1 }];
615
+ return files;
616
+ }
617
+ //#endregion
618
+ export { AppProperties, AreaChart, BarChart, BaseXmlComponent, BevelPresetType, BlendMode, BuilderElement, COLOR_CATEGORIES, CatAx, ChartCollection, ChartSpace, ChartTitle, CompoundLine, Connection, DEFAULT_DRAWING_XML, DOCX_NS, DataModel, EMPTY_OBJECT, EmptyElement, Formatter, IgnoreIfEmptyXmlComponent, ImportedRootElementAttributes, ImportedXmlComponent, InitializableXmlComponent, LAYOUT_CATEGORIES, LineCap, LineChart, LineEndLength, LineEndType, LineEndWidth, LineJoin, NextAttributeComponent, OoxmlMimeType, PPTX_NS, ParsedArchive, PathShadeType, PenAlignment, PieChart, Point, PresetColor, PresetDash, PresetGeometry, PresetMaterialType, PresetPattern, PresetShadowVal, RawPassthrough, RectAlignment, Relationships, STYLE_CATEGORIES, ScatterChart, SchemeColor, SmartArtCollection, Stretch, SystemColor, TargetModeType, ThemeColor, ThemeFont, TileAlignment, TileFlipMode, TokenNotFoundError, TransPoint, ValAx, XmlAttributeComponent, XmlComponent, ZIP_DEFLATE_LEVEL, ZIP_STORED_LEVEL, addSmartArtRelationships, appendContentType, appendRelationship, attrObj, buildCorePropertiesXml, buildCorePropertiesXmlString, buildFill, chartAttr, collectPlaceholderKeys, compileMapping, convertEmuToInches, convertEmuToPixels, convertEmuToPoints, convertInchesToEmu, convertInchesToTwip, convertMillimetersToTwip, convertOutput, convertPixelsToEmu, convertPointsToEmu, convertToXmlComponent, createAdjustmentValues, createBevel, createBlip, createBlipEffects, createBlipFill, createBottomBevel, createChartType, createColorElement, createColorTransforms, createCustomDash, createCustomGeometry, createDataModel, createDefault, createEffectDag, createEffectList, createExtentionList, createFillOverlayEffect, createGlowEffect, createGradientFill, createGradientStop, createGroupFill, createGroupTransform2D, createHslColor, createInnerShadowEffect, createLineEnd, createNoFill, createNumRef, createOuterShadowEffect, createOutline, createOverride, createPacker, createPatternFill, createPresetColor, createPresetShadowEffect, createReflectionEffect, createReplacer, createRgbColor, createRunRenderer, createScRgbColor, createScene3D, createSchemeColor, createShape3D, createSoftEdgeEffect, createSolidFill, createSourceRectangle, createSplitInject, createStrRef, createSystemColor, createTextElementContents, createTileInfo, createTokenReplacer, createTransform2D, createTransformation, createTraverser, createZipStream, dateTimeValue, decimalNumber, eighthPointMeasureValue, elementToCompact, extractBlipFillMedia, formatId, getColorXml, getFirstLevelElements, getLayoutXml, getNextRelationshipIndex, getReferencedMedia, getStyleXml, hasPlaceholders, hashedId, hexBinary, hexColorValue, hpsMeasureObj, hpsMeasureValue, invertMap, longHexNumber, measurementOrPercentValue, numberValObj, onOffObj, parseArchive, parseCorePropsElement, patchSpaceAttribute, percentageValue, pointMeasureValue, positiveUniversalMeasureValue, replaceChartPlaceholders, replaceImagePlaceholders, replaceSmartArtPlaceholders, shortHexNumber, signedHpsMeasureValue, signedTwipsMeasureValue, strFromU8, stringContainerObj, stringEnumValObj, stringValObj, toJson, twipsMeasureValue, uCharHexNumber, uniqueId, uniqueNumericIdCreator, uniqueUuid, universalMeasureValue, unsignedDecimalNumber, unzipSync, wrapEl, xsdBlendMode, xsdCompoundLine, xsdEffectContainer, xsdLineCap, xsdLineEndSize, xsdMaterialType, xsdPathFillMode, xsdPattern, xsdPenAlignment, xsdPresetShadow, xsdRectAlignment, xsdStrikeStyle, xsdTextAlign, xsdTextAnchor, xsdTextCaps, xsdUnderlineStyle, xsdVerticalMergeRev, zipAndConvert, zipSyncAndConvert };
@@ -1,2 +1,2 @@
1
- import { a as createTraverser, c as TokenNotFoundError, d as getFirstLevelElements, f as patchSpaceAttribute, h as PPTX_NS, i as createReplacer, l as createSplitInject, m as DOCX_NS, n as getNextRelationshipIndex, o as createRunRenderer, p as toJson, r as appendContentType, s as createTokenReplacer, t as appendRelationship, u as createTextElementContents } from "../patch-BdMU95aX.mjs";
1
+ import { a as createTraverser, c as TokenNotFoundError, d as getFirstLevelElements, f as patchSpaceAttribute, h as PPTX_NS, i as createReplacer, l as createSplitInject, m as DOCX_NS, n as getNextRelationshipIndex, o as createRunRenderer, p as toJson, r as appendContentType, s as createTokenReplacer, t as appendRelationship, u as createTextElementContents } from "../patch-O6SD_BaJ.mjs";
2
2
  export { DOCX_NS, PPTX_NS, TokenNotFoundError, appendContentType, appendRelationship, createReplacer, createRunRenderer, createSplitInject, createTextElementContents, createTokenReplacer, createTraverser, getFirstLevelElements, getNextRelationshipIndex, patchSpaceAttribute, toJson };
@@ -78,11 +78,11 @@ function createSplitInject(ns, createTextElementContents, options) {
78
78
  }).flat() ?? [];
79
79
  return {
80
80
  left: {
81
- ...JSON.parse(JSON.stringify(runElement)),
81
+ ...structuredClone(runElement),
82
82
  elements: splitElements.slice(0, splitIndex + 1)
83
83
  },
84
84
  right: {
85
- ...JSON.parse(JSON.stringify(runElement)),
85
+ ...structuredClone(runElement),
86
86
  elements: splitElements.slice(splitIndex + 1)
87
87
  }
88
88
  };
@@ -1,2 +1,2 @@
1
- import { a as Point, c as Connection, d as getLayoutXml, f as getStyleXml, h as STYLE_CATEGORIES, i as SmartArtData, l as DEFAULT_DRAWING_XML, m as LAYOUT_CATEGORIES, n as createDataModel, o as TransPoint, p as COLOR_CATEGORIES, r as SmartArtCollection, s as DataModel, t as TreeNode, u as getColorXml } from "../index-CZxcE4Q6.mjs";
1
+ import { a as Point, c as Connection, d as getLayoutXml, f as getStyleXml, h as STYLE_CATEGORIES, i as SmartArtData, l as DEFAULT_DRAWING_XML, m as LAYOUT_CATEGORIES, n as createDataModel, o as TransPoint, p as COLOR_CATEGORIES, r as SmartArtCollection, s as DataModel, t as TreeNode, u as getColorXml } from "../index-BCjRiF78.mjs";
2
2
  export { COLOR_CATEGORIES, Connection, DEFAULT_DRAWING_XML, DataModel, LAYOUT_CATEGORIES, Point, STYLE_CATEGORIES, SmartArtCollection, SmartArtData, TransPoint, TreeNode, createDataModel, getColorXml, getLayoutXml, getStyleXml };
@@ -1,2 +1,2 @@
1
- import { a as DataModel, c as getColorXml, d as COLOR_CATEGORIES, f as LAYOUT_CATEGORIES, i as TransPoint, l as getLayoutXml, n as SmartArtCollection, o as Connection, p as STYLE_CATEGORIES, r as Point, s as DEFAULT_DRAWING_XML, t as createDataModel, u as getStyleXml } from "../smartart-DBQ_rRfK.mjs";
1
+ import { a as DataModel, c as getColorXml, d as COLOR_CATEGORIES, f as LAYOUT_CATEGORIES, i as TransPoint, l as getLayoutXml, n as SmartArtCollection, o as Connection, p as STYLE_CATEGORIES, r as Point, s as DEFAULT_DRAWING_XML, t as createDataModel, u as getStyleXml } from "../smartart-vyDm6U1_.mjs";
2
2
  export { COLOR_CATEGORIES, Connection, DEFAULT_DRAWING_XML, DataModel, LAYOUT_CATEGORIES, Point, STYLE_CATEGORIES, SmartArtCollection, TransPoint, createDataModel, getColorXml, getLayoutXml, getStyleXml };
@@ -1,4 +1,4 @@
1
- import { b as XmlComponent, c as chartAttr } from "./xml-components-CADgke8j.mjs";
1
+ import { b as XmlComponent, c as chartAttr } from "./xml-components-ctIqansl.mjs";
2
2
  //#region src/smartart/categories.ts
3
3
  /** Layout ID → OOXML category type */
4
4
  const LAYOUT_CATEGORIES = {
@@ -1,7 +1,12 @@
1
1
  import { hpsMeasureValue } from "./values.mjs";
2
- import { xml, xml2js } from "@office-open/xml";
2
+ import { escapeXml, xml, xml2js } from "@office-open/xml";
3
3
  //#region src/xml-components/base.ts
4
4
  /**
5
+ * Base XML Component infrastructure for OOXML document generation.
6
+ *
7
+ * @module
8
+ */
9
+ /**
5
10
  * Abstract base class for all XML components.
6
11
  */
7
12
  var BaseXmlComponent = class {
@@ -10,6 +15,14 @@ var BaseXmlComponent = class {
10
15
  constructor(rootKey) {
11
16
  this.rootKey = rootKey;
12
17
  }
18
+ /**
19
+ * Direct XML serialization. Override in subclasses for zero-allocation output.
20
+ * Default falls back to prepForXml() + xml().
21
+ */
22
+ toXml(context) {
23
+ const obj = this.prepForXml(context);
24
+ return obj ? xml(obj) : "";
25
+ }
13
26
  };
14
27
  //#endregion
15
28
  //#region src/xml-components/component.ts
@@ -26,6 +39,11 @@ var BaseXmlComponent = class {
26
39
  const EMPTY_OBJECT = Object.seal({});
27
40
  /**
28
41
  * Base class for all XML components in OOXML documents.
42
+ *
43
+ * `toXml()` traverses the `root` array and calls `toXml()` on each
44
+ * `BaseXmlComponent` child — this avoids building the intermediate
45
+ * `IXmlableObject` tree. Inline `IXmlableObject` children fall back to
46
+ * `xml()` for serialization.
29
47
  */
30
48
  var XmlComponent = class extends BaseXmlComponent {
31
49
  /**
@@ -50,12 +68,33 @@ var XmlComponent = class extends BaseXmlComponent {
50
68
  return { [this.rootKey]: children.length ? children.length === 1 && children[0] && typeof children[0] === "object" && "_attr" in children[0] ? children[0] : children : EMPTY_OBJECT };
51
69
  }
52
70
  /**
53
- * Direct XML serialization. Override in subclasses for zero-allocation output.
54
- * Default falls back to prepForXml() + xml().
71
+ * Direct XML serialization traverses `root` and calls `toXml()` on
72
+ * each child, concatenating the results into a single string.
55
73
  */
56
74
  toXml(context) {
57
- const obj = this.prepForXml(context);
58
- return obj ? xml(obj) : "";
75
+ const childParts = [];
76
+ const attrParts = [];
77
+ for (const child of this.root) if (child instanceof BaseXmlComponent) {
78
+ const s = child.toXml(context);
79
+ if (s) childParts.push(s);
80
+ if (!s && child.constructor.name === "NextAttributeComponent") {
81
+ const prepped = child.prepForXml(context);
82
+ if (prepped && typeof prepped === "object" && "_attr" in prepped) {
83
+ const a = prepped._attr;
84
+ for (const key of Object.keys(a)) attrParts.push(`${key}="${escapeXml(String(a[key]))}"`);
85
+ }
86
+ }
87
+ } else if (typeof child === "string") childParts.push(escapeXml(child));
88
+ else if (child != null && typeof child === "object") if ("_attr" in child) {
89
+ const a = child._attr;
90
+ for (const key of Object.keys(a)) attrParts.push(`${key}="${escapeXml(String(a[key]))}"`);
91
+ } else if ("_attributes" in child) {
92
+ const a = child._attributes;
93
+ for (const key of Object.keys(a)) attrParts.push(`${key}="${escapeXml(String(a[key]))}"`);
94
+ } else childParts.push(xml(child));
95
+ const attrStr = attrParts.length ? " " + attrParts.join(" ") : "";
96
+ const body = childParts.join("");
97
+ return body.length === 0 ? `<${this.rootKey}${attrStr}/>` : `<${this.rootKey}${attrStr}>${body}</${this.rootKey}>`;
59
98
  }
60
99
  /**
61
100
  * @deprecated Internal use only.
@@ -79,6 +118,17 @@ var IgnoreIfEmptyXmlComponent = class extends XmlComponent {
79
118
  if (this.includeIfEmpty) return result;
80
119
  if (result && (typeof result[this.rootKey] !== "object" || Object.keys(result[this.rootKey]).length)) return result;
81
120
  }
121
+ /**
122
+ * Suppress empty elements — super.toXml() produces a self-closing tag
123
+ * (`<tag/>`) when there are no child elements; IgnoreIfEmpty returns ""
124
+ * in that case. Child components that already override toXml() (e.g.
125
+ * Worksheet) are unaffected.
126
+ */
127
+ toXml(context) {
128
+ if (this.includeIfEmpty) return super.toXml(context);
129
+ const result = super.toXml(context);
130
+ return result.endsWith("/>") ? "" : result;
131
+ }
82
132
  };
83
133
  //#endregion
84
134
  //#region src/xml-components/attributes.ts
@@ -125,6 +175,10 @@ var NextAttributeComponent = class extends BaseXmlComponent {
125
175
  }
126
176
  return { _attr: attrs };
127
177
  }
178
+ /** Attribute components produce no XML output — attrs are inlined by the parent. */
179
+ toXml(_context) {
180
+ return "";
181
+ }
128
182
  };
129
183
  //#endregion
130
184
  //#region src/xml-components/elements.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@office-open/core",
3
- "version": "0.6.5",
3
+ "version": "0.6.7",
4
4
  "description": "Shared OOXML infrastructure: XmlComponent, value validators, unit converters",
5
5
  "keywords": [
6
6
  "core",
@@ -55,12 +55,12 @@
55
55
  "fflate": "0.8.3",
56
56
  "hash.js": "1.1.7",
57
57
  "nanoid": "5.1.11",
58
- "@office-open/xml": "0.6.5"
58
+ "@office-open/xml": "0.6.7"
59
59
  },
60
60
  "scripts": {
61
61
  "dev": "basis build --stub",
62
62
  "build": "vp pack",
63
- "test": "vp test run --coverage",
63
+ "test": "vp test run",
64
64
  "check": "vp check --fix"
65
65
  }
66
66
  }