@office-open/core 0.6.4 → 0.6.6
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 +9 -9
- package/dist/chart/index.d.ts +2 -0
- package/dist/chart/index.js +2 -0
- package/dist/{chart/index.mjs → chart-BUlAcF2k.js} +18 -12
- package/dist/drawingml/index.d.ts +2 -0
- package/dist/drawingml/index.js +2 -0
- package/dist/{drawingml/index.mjs → drawingml-DG6euH0k.js} +280 -3
- package/dist/{index-DigYTiB_.d.mts → index-BDwL0MVx.d.ts} +1 -1
- package/dist/{drawingml/index.d.mts → index-C1jJNA2J.d.ts} +2 -2
- package/dist/index-NK0k2I-R.d.ts +127 -0
- package/dist/{index-mjYQ4KiG.d.mts → index-k2ds4fI-.d.ts} +20 -3
- package/dist/{chart/index.d.mts → index-nyrpMDHV.d.ts} +9 -3
- package/dist/{index.d.mts → index.d.ts} +78 -60
- package/dist/{index.mjs → index.js} +114 -82
- package/dist/patch/index.d.ts +2 -0
- package/dist/patch/index.js +2 -0
- package/dist/patch-BWan_fhF.js +337 -0
- package/dist/smartart/{index.d.mts → index.d.ts} +1 -1
- package/dist/smartart/{index.mjs → index.js} +1 -1
- package/dist/{smartart-DBQ_rRfK.mjs → smartart-DGNfjKA9.js} +1 -1
- package/dist/{values.d.mts → values.d.ts} +1 -1
- package/dist/{xml-components-CADgke8j.mjs → xml-components-SxPlKGms.js} +49 -6
- package/package.json +15 -19
- package/dist/archive.d.mts +0 -58
- package/dist/archive.mjs +0 -135
- package/dist/xsd-mappings-BiTj9yJn.mjs +0 -279
- /package/dist/{values-CIh0bdS1.d.mts → values-CyCW27--.d.ts} +0 -0
- /package/dist/{values.mjs → values.js} +0 -0
package/README.md
CHANGED
|
@@ -96,15 +96,15 @@ gen(); // → 1, 2, 3, ...
|
|
|
96
96
|
|
|
97
97
|
| Operation | hz |
|
|
98
98
|
| ----------------------------- | ----- |
|
|
99
|
-
| `decimalNumber` | ~
|
|
100
|
-
| `hexColorValue` (6-char hex) | ~
|
|
101
|
-
| `uniqueNumericIdCreator` | ~
|
|
102
|
-
| `uniqueId` (nanoid) | ~3.
|
|
103
|
-
| `uniqueUuid` | ~1.
|
|
104
|
-
| `onOffObj` (true) | ~
|
|
105
|
-
| `onOffObj` (false) | ~3.
|
|
106
|
-
| `BuilderElement` (attributes) | ~
|
|
107
|
-
| `BuilderElement` (children) | ~3.
|
|
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
|
|
|
@@ -0,0 +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-nyrpMDHV.js";
|
|
2
|
+
export { AreaChart, BarChart, CatAx, ChartCollection, ChartData, ChartSeriesData, ChartSpace, ChartSpaceOptions, ChartTitle, ChartType, ChartTypeOptions, LineChart, PieChart, ScatterChart, ValAx, createChartType, createNumRef, createStrRef };
|
|
@@ -0,0 +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-BUlAcF2k.js";
|
|
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 "
|
|
1
|
+
import { a as BuilderElement, b as XmlComponent, c as chartAttr, h as wrapEl, o as EmptyElement } from "./xml-components-SxPlKGms.js";
|
|
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 {
|
|
@@ -608,4 +614,4 @@ var ChartCollection = class {
|
|
|
608
614
|
}
|
|
609
615
|
};
|
|
610
616
|
//#endregion
|
|
611
|
-
export {
|
|
617
|
+
export { ScatterChart as a, BarChart as c, createStrRef as d, CatAx as f, createChartType as i, AreaChart as l, ChartSpace as n, PieChart as o, ValAx as p, ChartTitle as r, LineChart as s, ChartCollection as t, createNumRef as u };
|
|
@@ -0,0 +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-C1jJNA2J.js";
|
|
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 };
|
|
@@ -0,0 +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-DG6euH0k.js";
|
|
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,5 +1,75 @@
|
|
|
1
|
-
import { a as BuilderElement, b as XmlComponent } from "
|
|
2
|
-
import
|
|
1
|
+
import { a as BuilderElement, b as XmlComponent } from "./xml-components-SxPlKGms.js";
|
|
2
|
+
import hash from "hash.js";
|
|
3
|
+
import { customAlphabet, nanoid } from "nanoid/non-secure";
|
|
4
|
+
//#region src/converters.ts
|
|
5
|
+
/**
|
|
6
|
+
* OOXML unit conversion utilities.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Converts millimeters to TWIP (twentieths of a point).
|
|
12
|
+
*/
|
|
13
|
+
const convertMillimetersToTwip = (millimeters) => Math.floor(millimeters / 25.4 * 72 * 20);
|
|
14
|
+
/**
|
|
15
|
+
* Converts inches to TWIP (twentieths of a point).
|
|
16
|
+
*/
|
|
17
|
+
const convertInchesToTwip = (inches) => Math.floor(inches * 72 * 20);
|
|
18
|
+
/**
|
|
19
|
+
* Converts pixels to EMU (96 DPI).
|
|
20
|
+
*/
|
|
21
|
+
const convertPixelsToEmu = (pixels) => Math.round(pixels * 9525);
|
|
22
|
+
/**
|
|
23
|
+
* Converts EMU to pixels (96 DPI).
|
|
24
|
+
*/
|
|
25
|
+
const convertEmuToPixels = (emus) => Math.round(emus / 9525);
|
|
26
|
+
/**
|
|
27
|
+
* Converts inches to EMU.
|
|
28
|
+
*/
|
|
29
|
+
const convertInchesToEmu = (inches) => Math.round(inches * 914400);
|
|
30
|
+
/**
|
|
31
|
+
* Converts EMU to inches.
|
|
32
|
+
*/
|
|
33
|
+
const convertEmuToInches = (emus) => emus / 914400;
|
|
34
|
+
/**
|
|
35
|
+
* Converts points to EMU.
|
|
36
|
+
*/
|
|
37
|
+
const convertPointsToEmu = (points) => Math.round(points * 12700);
|
|
38
|
+
/**
|
|
39
|
+
* Converts EMU to points.
|
|
40
|
+
*/
|
|
41
|
+
const convertEmuToPoints = (emus) => emus / 12700;
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/id-generators.ts
|
|
44
|
+
/**
|
|
45
|
+
* Unique ID generation utilities.
|
|
46
|
+
*
|
|
47
|
+
* @module
|
|
48
|
+
*/
|
|
49
|
+
/**
|
|
50
|
+
* Creates a unique numeric ID generator with sequential numbering.
|
|
51
|
+
*/
|
|
52
|
+
const uniqueNumericIdCreator = (initial = 0) => {
|
|
53
|
+
let currentCount = initial;
|
|
54
|
+
return () => ++currentCount;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Generates a unique lowercase alphanumeric ID using nanoid.
|
|
58
|
+
*/
|
|
59
|
+
const uniqueId = () => nanoid().toLowerCase();
|
|
60
|
+
/**
|
|
61
|
+
* Generates a SHA-1 hash of the provided data.
|
|
62
|
+
*/
|
|
63
|
+
const hashedId = (data) => hash.sha1().update(data instanceof ArrayBuffer ? new Uint8Array(data) : data).digest("hex");
|
|
64
|
+
/**
|
|
65
|
+
* Generates a random hexadecimal string of specified length.
|
|
66
|
+
*/
|
|
67
|
+
const generateUuidPart = (count) => customAlphabet("1234567890abcdef", count)();
|
|
68
|
+
/**
|
|
69
|
+
* Generates a UUID v4-style unique identifier.
|
|
70
|
+
*/
|
|
71
|
+
const uniqueUuid = () => `${generateUuidPart(8)}-${generateUuidPart(4)}-${generateUuidPart(4)}-${generateUuidPart(4)}-${generateUuidPart(12)}`;
|
|
72
|
+
//#endregion
|
|
3
73
|
//#region src/drawingml/color/color-transform.ts
|
|
4
74
|
/**
|
|
5
75
|
* Color transform elements for DrawingML colors.
|
|
@@ -1056,6 +1126,213 @@ var Stretch = class extends XmlComponent {
|
|
|
1056
1126
|
}
|
|
1057
1127
|
};
|
|
1058
1128
|
//#endregion
|
|
1129
|
+
//#region src/xsd-mappings.ts
|
|
1130
|
+
/**
|
|
1131
|
+
* Bidirectional mappings between user-friendly values and XSD abbreviated values.
|
|
1132
|
+
*
|
|
1133
|
+
* When XSD uses full English words (e.g. "center", "start"), values are used directly — no mapping needed.
|
|
1134
|
+
* When XSD uses abbreviations (e.g. "ctr", "l", "rnd"), this module maps them to full words.
|
|
1135
|
+
*
|
|
1136
|
+
* Usage in generation (Options → XML): xsdAlign.to("center") → "ctr"
|
|
1137
|
+
* Usage in parsing (XML → Options): xsdAlign.from("ctr") → "center"
|
|
1138
|
+
*/
|
|
1139
|
+
/** Invert a Record<K, V> into Record<V, K>. */
|
|
1140
|
+
function invertMap(map) {
|
|
1141
|
+
const result = {};
|
|
1142
|
+
for (const key in map) result[map[key]] = key;
|
|
1143
|
+
return result;
|
|
1144
|
+
}
|
|
1145
|
+
/** Create a bidirectional mapping helper from a single forward map. */
|
|
1146
|
+
function bidi(forward) {
|
|
1147
|
+
const reverse = invertMap(forward);
|
|
1148
|
+
return {
|
|
1149
|
+
/** User-friendly value → XSD value */
|
|
1150
|
+
to: (key) => forward[key] ?? key,
|
|
1151
|
+
/** XSD value → user-friendly value */
|
|
1152
|
+
from: (xsd) => reverse[xsd] ?? xsd,
|
|
1153
|
+
/** The forward map (user → XSD) */
|
|
1154
|
+
forward,
|
|
1155
|
+
/** The reverse map (XSD → user) */
|
|
1156
|
+
reverse
|
|
1157
|
+
};
|
|
1158
|
+
}
|
|
1159
|
+
const xsdRectAlignment = bidi({
|
|
1160
|
+
topLeft: "tl",
|
|
1161
|
+
top: "t",
|
|
1162
|
+
topRight: "tr",
|
|
1163
|
+
left: "l",
|
|
1164
|
+
center: "ctr",
|
|
1165
|
+
right: "r",
|
|
1166
|
+
bottomLeft: "bl",
|
|
1167
|
+
bottom: "b",
|
|
1168
|
+
bottomRight: "br"
|
|
1169
|
+
});
|
|
1170
|
+
const xsdTextAlign = bidi({
|
|
1171
|
+
left: "l",
|
|
1172
|
+
center: "ctr",
|
|
1173
|
+
right: "r",
|
|
1174
|
+
justify: "just"
|
|
1175
|
+
});
|
|
1176
|
+
const xsdTextAnchor = bidi({
|
|
1177
|
+
top: "t",
|
|
1178
|
+
center: "ctr",
|
|
1179
|
+
bottom: "b"
|
|
1180
|
+
});
|
|
1181
|
+
const xsdLineCap = bidi({
|
|
1182
|
+
round: "rnd",
|
|
1183
|
+
square: "sq",
|
|
1184
|
+
flat: "flat"
|
|
1185
|
+
});
|
|
1186
|
+
const xsdCompoundLine = bidi({
|
|
1187
|
+
single: "sng",
|
|
1188
|
+
double: "dbl",
|
|
1189
|
+
thickThin: "thickThin",
|
|
1190
|
+
thinThick: "thinThick",
|
|
1191
|
+
triple: "tri"
|
|
1192
|
+
});
|
|
1193
|
+
const xsdPenAlignment = bidi({
|
|
1194
|
+
center: "ctr",
|
|
1195
|
+
inside: "in"
|
|
1196
|
+
});
|
|
1197
|
+
const xsdLineEndSize = bidi({
|
|
1198
|
+
small: "sm",
|
|
1199
|
+
medium: "med",
|
|
1200
|
+
large: "lg"
|
|
1201
|
+
});
|
|
1202
|
+
const xsdBlendMode = bidi({
|
|
1203
|
+
over: "over",
|
|
1204
|
+
multiply: "mult",
|
|
1205
|
+
screen: "screen",
|
|
1206
|
+
darken: "darken",
|
|
1207
|
+
lighten: "lighten"
|
|
1208
|
+
});
|
|
1209
|
+
const xsdPathFillMode = bidi({
|
|
1210
|
+
none: "none",
|
|
1211
|
+
normal: "norm",
|
|
1212
|
+
lighten: "lighten",
|
|
1213
|
+
lightenLess: "lightenLess",
|
|
1214
|
+
darken: "darken",
|
|
1215
|
+
darkenLess: "darkenLess"
|
|
1216
|
+
});
|
|
1217
|
+
const xsdEffectContainer = bidi({
|
|
1218
|
+
sibling: "sib",
|
|
1219
|
+
tree: "tree"
|
|
1220
|
+
});
|
|
1221
|
+
const xsdPresetShadow = bidi({
|
|
1222
|
+
shadow1: "shdw1",
|
|
1223
|
+
shadow2: "shdw2",
|
|
1224
|
+
shadow3: "shdw3",
|
|
1225
|
+
shadow4: "shdw4",
|
|
1226
|
+
shadow5: "shdw5",
|
|
1227
|
+
shadow6: "shdw6",
|
|
1228
|
+
shadow7: "shdw7",
|
|
1229
|
+
shadow8: "shdw8",
|
|
1230
|
+
shadow9: "shdw9",
|
|
1231
|
+
shadow10: "shdw10",
|
|
1232
|
+
shadow11: "shdw11",
|
|
1233
|
+
shadow12: "shdw12",
|
|
1234
|
+
shadow13: "shdw13",
|
|
1235
|
+
shadow14: "shdw14",
|
|
1236
|
+
shadow15: "shdw15",
|
|
1237
|
+
shadow16: "shdw16",
|
|
1238
|
+
shadow17: "shdw17",
|
|
1239
|
+
shadow18: "shdw18",
|
|
1240
|
+
shadow19: "shdw19",
|
|
1241
|
+
shadow20: "shdw20"
|
|
1242
|
+
});
|
|
1243
|
+
const xsdMaterialType = bidi({
|
|
1244
|
+
legacyMatte: "legacyMatte",
|
|
1245
|
+
legacyPlastic: "legacyPlastic",
|
|
1246
|
+
legacyMetal: "legacyMetal",
|
|
1247
|
+
legacyWireframe: "legacyWireframe",
|
|
1248
|
+
matte: "matte",
|
|
1249
|
+
plastic: "plastic",
|
|
1250
|
+
metal: "metal",
|
|
1251
|
+
warmMatte: "warmMatte",
|
|
1252
|
+
translucentPowder: "translucentPowder",
|
|
1253
|
+
powder: "powder",
|
|
1254
|
+
darkEdge: "dkEdge",
|
|
1255
|
+
softEdge: "softEdge",
|
|
1256
|
+
clear: "clear",
|
|
1257
|
+
flat: "flat",
|
|
1258
|
+
softMetal: "softmetal"
|
|
1259
|
+
});
|
|
1260
|
+
const xsdPattern = bidi({
|
|
1261
|
+
percent5: "pct5",
|
|
1262
|
+
percent10: "pct10",
|
|
1263
|
+
percent20: "pct20",
|
|
1264
|
+
percent25: "pct25",
|
|
1265
|
+
percent30: "pct30",
|
|
1266
|
+
percent40: "pct40",
|
|
1267
|
+
percent50: "pct50",
|
|
1268
|
+
percent60: "pct60",
|
|
1269
|
+
percent70: "pct70",
|
|
1270
|
+
percent75: "pct75",
|
|
1271
|
+
percent80: "pct80",
|
|
1272
|
+
percent90: "pct90",
|
|
1273
|
+
horizontal: "horz",
|
|
1274
|
+
vertical: "vert",
|
|
1275
|
+
lightHorizontal: "ltHorz",
|
|
1276
|
+
lightVertical: "ltVert",
|
|
1277
|
+
darkHorizontal: "dkHorz",
|
|
1278
|
+
darkVertical: "dkVert",
|
|
1279
|
+
narrowHorizontal: "narHorz",
|
|
1280
|
+
narrowVertical: "narVert",
|
|
1281
|
+
dashedHorizontal: "dashHorz",
|
|
1282
|
+
dashedVertical: "dashVert",
|
|
1283
|
+
cross: "cross",
|
|
1284
|
+
downDiagonal: "dnDiag",
|
|
1285
|
+
upDiagonal: "upDiag",
|
|
1286
|
+
lightDownDiagonal: "ltDnDiag",
|
|
1287
|
+
lightUpDiagonal: "ltUpDiag",
|
|
1288
|
+
darkDownDiagonal: "dkDnDiag",
|
|
1289
|
+
darkUpDiagonal: "dkUpDiag",
|
|
1290
|
+
wideDownDiagonal: "wdDnDiag",
|
|
1291
|
+
wideUpDiagonal: "wdUpDiag",
|
|
1292
|
+
dashedDownDiagonal: "dashDnDiag",
|
|
1293
|
+
dashedUpDiagonal: "dashUpDiag",
|
|
1294
|
+
diagonalCross: "diagCross",
|
|
1295
|
+
smallChecker: "smCheck",
|
|
1296
|
+
largeChecker: "lgCheck",
|
|
1297
|
+
smallGrid: "smGrid",
|
|
1298
|
+
largeGrid: "lgGrid",
|
|
1299
|
+
dotGrid: "dotGrid",
|
|
1300
|
+
smallConfetti: "smConfetti",
|
|
1301
|
+
largeConfetti: "lgConfetti",
|
|
1302
|
+
horizontalBrick: "horzBrick",
|
|
1303
|
+
diagonalBrick: "diagBrick",
|
|
1304
|
+
solidDiamond: "solidDmnd",
|
|
1305
|
+
openDiamond: "openDmnd",
|
|
1306
|
+
dottedDiamond: "dotDmnd",
|
|
1307
|
+
plaid: "plaid",
|
|
1308
|
+
sphere: "sphere",
|
|
1309
|
+
weave: "weave",
|
|
1310
|
+
divot: "divot",
|
|
1311
|
+
shingle: "shingle",
|
|
1312
|
+
wave: "wave",
|
|
1313
|
+
trellis: "trellis",
|
|
1314
|
+
zigZag: "zigZag"
|
|
1315
|
+
});
|
|
1316
|
+
const xsdVerticalMergeRev = bidi({
|
|
1317
|
+
continue: "cont",
|
|
1318
|
+
restart: "rest"
|
|
1319
|
+
});
|
|
1320
|
+
const xsdUnderlineStyle = bidi({
|
|
1321
|
+
single: "sng",
|
|
1322
|
+
double: "dbl",
|
|
1323
|
+
none: "none"
|
|
1324
|
+
});
|
|
1325
|
+
const xsdStrikeStyle = bidi({
|
|
1326
|
+
singleStrike: "sngStrike",
|
|
1327
|
+
doubleStrike: "dblStrike",
|
|
1328
|
+
noStrike: "noStrike"
|
|
1329
|
+
});
|
|
1330
|
+
const xsdTextCaps = bidi({
|
|
1331
|
+
none: "none",
|
|
1332
|
+
all: "all",
|
|
1333
|
+
small: "small"
|
|
1334
|
+
});
|
|
1335
|
+
//#endregion
|
|
1059
1336
|
//#region src/drawingml/blip/tile.ts
|
|
1060
1337
|
/**
|
|
1061
1338
|
* Tile fill module for blip fills.
|
|
@@ -3875,4 +4152,4 @@ const createTransformation = (options) => ({
|
|
|
3875
4152
|
rotation: options.rotation ? options.rotation * 6e4 : void 0
|
|
3876
4153
|
});
|
|
3877
4154
|
//#endregion
|
|
3878
|
-
export {
|
|
4155
|
+
export { xsdCompoundLine as $, LineJoin as A, hashedId as At, createNoFill as B, convertPixelsToEmu as Bt, createOuterShadowEffect as C, createSchemeColor as Ct, createFillOverlayEffect as D, createPresetColor as Dt, BlendMode as E, PresetColor as Et, LineEndType as F, convertEmuToPixels as Ft, PathShadeType as G, extractBlipFillMedia as H, LineEndWidth as I, convertEmuToPoints as It, createGradientStop as J, TileFlipMode as K, createLineEnd as L, convertInchesToEmu as Lt, PresetDash as M, uniqueNumericIdCreator as Mt, createOutline as N, uniqueUuid as Nt, CompoundLine as O, createHslColor as Ot, LineEndLength as P, convertEmuToInches as Pt, xsdBlendMode as Q, createCustomDash as R, convertInchesToTwip as Rt, RectAlignment as S, SchemeColor as St, createGlowEffect as T, createRgbColor as Tt, PresetPattern as U, buildFill as V, convertPointsToEmu as Vt, createPatternFill as W, createTileInfo as X, TileAlignment as Y, invertMap as Z, createEffectList as _, createBlipEffects as _t, createBlip as a, xsdPattern as at, PresetShadowVal as b, SystemColor as bt, PresetGeometry as c, xsdRectAlignment as ct, createShape3D as d, xsdTextAnchor as dt, xsdEffectContainer as et, BevelPresetType as f, xsdTextCaps as ft, createEffectDag as g, createSourceRectangle as gt, createScene3D as h, Stretch as ht, createBlipFill as i, xsdPathFillMode as it, PenAlignment as j, uniqueId as jt, LineCap as k, createColorTransforms as kt, createAdjustmentValues as l, xsdStrikeStyle as lt, createBottomBevel as m, xsdVerticalMergeRev as mt, createGroupTransform2D as n, xsdLineEndSize as nt, createExtentionList as o, xsdPenAlignment as ot, createBevel as p, xsdUnderlineStyle as pt, createGradientFill as q, createTransform2D as r, xsdMaterialType as rt, createCustomGeometry as s, xsdPresetShadow as st, createTransformation as t, xsdLineCap as tt, PresetMaterialType as u, xsdTextAlign as ut, createSoftEdgeEffect as v, createColorElement as vt, createInnerShadowEffect as w, createScRgbColor as wt, createPresetShadowEffect as x, createSystemColor as xt, createReflectionEffect as y, createSolidFill as yt, createGroupFill as z, convertMillimetersToTwip as zt };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as XmlComponent, a as BuilderElement } from "
|
|
1
|
+
import { C as XmlComponent, a as BuilderElement } from "./index-k2ds4fI-.js";
|
|
2
2
|
|
|
3
3
|
//#region src/drawingml/color/color-transform.d.ts
|
|
4
4
|
/**
|
|
@@ -3124,4 +3124,4 @@ interface MediaTransformation {
|
|
|
3124
3124
|
*/
|
|
3125
3125
|
declare const createTransformation: (options: MediaTransformation) => MediaDataTransformation;
|
|
3126
3126
|
//#endregion
|
|
3127
|
-
export {
|
|
3127
|
+
export { RectAlignment as $, createSolidFill as $t, createBevel as A, FillOptions as At, createSoftEdgeEffect as B, RelativeRect as Bt, GeometryGuide as C, createGroupFill as Ct, createShape3D as D, createNoFill as Dt, Shape3DOptions as E, createPatternFill as Et, Point3D as F, GradientShadeOptions as Ft, EffectListOptions as G, TileOptions as Gt, EffectDagOptions as H, createGradientFill as Ht, Scene3DOptions as I, GradientStop as It, createReflectionEffect as J, createSourceRectangle as Jt, createEffectList as K, createTileInfo as Kt, SphereCoords as L, LinearShadeOptions as Lt, BackdropOptions as M, buildFill as Mt, CameraOptions as N, extractBlipFillMedia as Nt, BevelOptions as O, BlipFillConfigOptions as Ot, LightRigOptions as P, GradientFillOptions as Pt, OuterShadowEffectOptions as Q, createColorElement as Qt, Vector3D as R, PathShadeOptions as Rt, PresetGeometryOptions as S, createCustomDash as St, PresetMaterialType as T, PresetPattern as Tt, createEffectDag as U, createGradientStop as Ut, EffectContainerType as V, TileFlipMode as Vt, BlurEffectOptions as W, TileAlignment as Wt, PresetShadowVal as X, createBlipEffects as Xt, PresetShadowEffectOptions as Y, BlipEffectsOptions as Yt, createPresetShadowEffect as Z, SolidFillOptions as Zt, PathCommand as _, LineEndOptions as _t, Transform2DOptions as a, createSchemeColor as an, BlendMode as at, createCustomGeometry as b, createLineEnd as bt, Stretch as c, RgbColorOptions as cn, CompoundLine as ct, createBlipFill as d, PresetColorOptions as dn, OutlineFillProperties as dt, SystemColor as en, createOuterShadowEffect as et, BlipOptions as f, createPresetColor as fn, OutlineOptions as ft, GeomRect as g, createColorTransforms as gn, LineEndLength as gt, CustomGeometryOptions as h, ColorTransformOptions as hn, createOutline as ht, GroupTransform2DOptions as i, SchemeColorOptions as in, createGlowEffect as it, createBottomBevel as j, GradientStopOptions as jt, BevelPresetType as k, BlipFillMediaData as kt, createExtentionList as l, createRgbColor as ln, LineCap as lt, ConnectionSite as m, createHslColor as mn, PresetDash as mt, MediaTransformation as n, createSystemColor as nn, createInnerShadowEffect as nt, createGroupTransform2D as o, ScRgbColorOptions as on, FillOverlayEffectOptions as ot, createBlip as p, HslColorOptions as pn, PenAlignment as pt, ReflectionEffectOptions as q, SourceRectangleOptions as qt, createTransformation as r, SchemeColor as rn, GlowEffectOptions as rt, createTransform2D as s, createScRgbColor as sn, createFillOverlayEffect as st, MediaDataTransformation as t, SystemColorOptions as tn, InnerShadowEffectOptions as tt, BlipFillOptions as u, PresetColor as un, LineJoin as ut, PathFillMode as v, LineEndType as vt, createAdjustmentValues as w, PatternFillOptions as wt, PresetGeometry as x, DashStop as xt, PathOptions as y, LineEndWidth as yt, createScene3D as z, PathShadeType as zt };
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { Element } from "@office-open/xml";
|
|
2
|
+
|
|
3
|
+
//#region src/patch/xml-namespace.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Namespace configuration for XML patch operations.
|
|
6
|
+
*
|
|
7
|
+
* Parameterises element names so the same patch algorithm works for both
|
|
8
|
+
* DOCX (`w:*`) and PPTX (`a:*`) documents.
|
|
9
|
+
*/
|
|
10
|
+
interface XmlNamespaceConfig {
|
|
11
|
+
readonly paragraph: string;
|
|
12
|
+
readonly run: string;
|
|
13
|
+
readonly text: string;
|
|
14
|
+
readonly runProperties: string;
|
|
15
|
+
}
|
|
16
|
+
declare const DOCX_NS: XmlNamespaceConfig;
|
|
17
|
+
declare const PPTX_NS: XmlNamespaceConfig;
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/patch/xml-replacer.d.ts
|
|
20
|
+
interface ReplacerConfig {
|
|
21
|
+
readonly ns: XmlNamespaceConfig;
|
|
22
|
+
readonly formatChild: (child: unknown, context: unknown) => Element[];
|
|
23
|
+
readonly preserveSpace?: boolean;
|
|
24
|
+
}
|
|
25
|
+
interface ReplacerResult {
|
|
26
|
+
readonly element: Element;
|
|
27
|
+
readonly didFindOccurrence: boolean;
|
|
28
|
+
}
|
|
29
|
+
declare function createReplacer(config: ReplacerConfig): ({
|
|
30
|
+
json,
|
|
31
|
+
patch,
|
|
32
|
+
patchText,
|
|
33
|
+
context,
|
|
34
|
+
keepOriginalStyles
|
|
35
|
+
}: {
|
|
36
|
+
readonly json: Element;
|
|
37
|
+
readonly patch: {
|
|
38
|
+
readonly type: string;
|
|
39
|
+
readonly children: readonly unknown[];
|
|
40
|
+
};
|
|
41
|
+
readonly patchText: string;
|
|
42
|
+
readonly context: unknown;
|
|
43
|
+
readonly keepOriginalStyles?: boolean;
|
|
44
|
+
}) => ReplacerResult;
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/patch/run-renderer.d.ts
|
|
47
|
+
interface ElementWrapper {
|
|
48
|
+
readonly element: Element;
|
|
49
|
+
readonly index: number;
|
|
50
|
+
readonly parent: ElementWrapper | undefined;
|
|
51
|
+
}
|
|
52
|
+
interface RenderedParagraphNode {
|
|
53
|
+
readonly text: string;
|
|
54
|
+
readonly runs: readonly IRenderedRunNode[];
|
|
55
|
+
readonly index: number;
|
|
56
|
+
readonly pathToParagraph: readonly number[];
|
|
57
|
+
}
|
|
58
|
+
interface StartAndEnd {
|
|
59
|
+
readonly start: number;
|
|
60
|
+
readonly end: number;
|
|
61
|
+
}
|
|
62
|
+
type IParts = {
|
|
63
|
+
readonly text: string;
|
|
64
|
+
readonly index: number;
|
|
65
|
+
} & StartAndEnd;
|
|
66
|
+
type IRenderedRunNode = {
|
|
67
|
+
readonly text: string;
|
|
68
|
+
readonly parts: readonly IParts[];
|
|
69
|
+
readonly index: number;
|
|
70
|
+
} & StartAndEnd;
|
|
71
|
+
declare function createRunRenderer(ns: XmlNamespaceConfig): (node: ElementWrapper) => RenderedParagraphNode;
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/patch/xml-traverser.d.ts
|
|
74
|
+
declare function createTraverser(ns: XmlNamespaceConfig): {
|
|
75
|
+
traverse: (node: Element) => readonly RenderedParagraphNode[];
|
|
76
|
+
findLocationOfText: (node: Element, text: string) => readonly RenderedParagraphNode[];
|
|
77
|
+
};
|
|
78
|
+
//#endregion
|
|
79
|
+
//#region src/patch/paragraph-token-replacer.d.ts
|
|
80
|
+
declare function createTokenReplacer(createTextElementContents: (text: string) => Element[], options?: {
|
|
81
|
+
readonly preserveSpace?: boolean;
|
|
82
|
+
}): ({
|
|
83
|
+
paragraphElement,
|
|
84
|
+
renderedParagraph,
|
|
85
|
+
originalText,
|
|
86
|
+
replacementText
|
|
87
|
+
}: {
|
|
88
|
+
readonly paragraphElement: Element;
|
|
89
|
+
readonly renderedParagraph: RenderedParagraphNode;
|
|
90
|
+
readonly originalText: string;
|
|
91
|
+
readonly replacementText: string;
|
|
92
|
+
}) => Element;
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/patch/paragraph-split-inject.d.ts
|
|
95
|
+
declare class TokenNotFoundError extends Error {
|
|
96
|
+
constructor(token: string);
|
|
97
|
+
}
|
|
98
|
+
declare function createSplitInject(ns: XmlNamespaceConfig, createTextElementContents: (text: string) => Element[], options?: {
|
|
99
|
+
readonly preserveSpace?: boolean;
|
|
100
|
+
}): {
|
|
101
|
+
findRunElementIndexWithToken: (paragraphElement: Element, token: string) => number;
|
|
102
|
+
splitRunElement: (runElement: Element, token: string) => {
|
|
103
|
+
readonly left: Element;
|
|
104
|
+
readonly right: Element;
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/patch/xml-patch-utils.d.ts
|
|
109
|
+
declare const toJson: (xmlData: string) => Element;
|
|
110
|
+
/**
|
|
111
|
+
* Creates the inner content of a text element (`w:t` / `a:t`).
|
|
112
|
+
*
|
|
113
|
+
* Returns `[{ type: "text", text }]` for non-empty text, `[]` for empty.
|
|
114
|
+
* The `xml:space` attribute is handled separately by `patchSpaceAttribute`.
|
|
115
|
+
*/
|
|
116
|
+
declare const createTextElementContents: (text: string) => Element[];
|
|
117
|
+
declare const patchSpaceAttribute: (element: Element) => Element;
|
|
118
|
+
declare const getFirstLevelElements: (relationships: Element, id: string) => Element[];
|
|
119
|
+
//#endregion
|
|
120
|
+
//#region src/patch/content-types-manager.d.ts
|
|
121
|
+
declare const appendContentType: (element: Element, contentType: string, extension: string) => void;
|
|
122
|
+
//#endregion
|
|
123
|
+
//#region src/patch/relationship-manager.d.ts
|
|
124
|
+
declare const getNextRelationshipIndex: (relationships: Element) => number;
|
|
125
|
+
declare const appendRelationship: (relationships: Element, id: number | string, type: string, target: string, targetMode?: string) => readonly Element[];
|
|
126
|
+
//#endregion
|
|
127
|
+
export { PPTX_NS as _, getFirstLevelElements as a, TokenNotFoundError as c, createTraverser as d, RenderedParagraphNode as f, DOCX_NS as g, createReplacer as h, createTextElementContents as i, createSplitInject as l, ReplacerConfig as m, getNextRelationshipIndex as n, patchSpaceAttribute as o, createRunRenderer as p, appendContentType as r, toJson as s, appendRelationship as t, createTokenReplacer as u, XmlNamespaceConfig as v };
|