@office-open/pptx 0.6.6 → 0.6.8
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 +12 -12
- package/dist/{index.d.ts → index.d.mts} +14 -35
- package/dist/index.d.mts.map +1 -0
- package/dist/{index.js → index.mjs} +310 -782
- package/dist/index.mjs.map +1 -0
- package/package.json +7 -7
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- /package/dist/{chunk-DJOrGtkp.js → chunk-090QGkrx.mjs} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as __toCommonJS, n as __exportAll, r as __reExport, t as __esmMin } from "./chunk-
|
|
2
|
-
import { AppProperties, BaseXmlComponent, BuilderElement, EmptyElement, Formatter, Formatter as Formatter$1, ImportedXmlComponent,
|
|
1
|
+
import { i as __toCommonJS, n as __exportAll, r as __reExport, t as __esmMin } from "./chunk-090QGkrx.mjs";
|
|
2
|
+
import { AppProperties, BaseXmlComponent, BuilderElement, EmptyElement, Formatter, Formatter as Formatter$1, ImportedXmlComponent, OoxmlMimeType, PPTX_NS, Relationships, XmlComponent, ZIP_STORED_LEVEL, addSmartArtRelationships, appendContentType, buildAttrObject, buildCorePropertiesXmlString, collectPlaceholderKeys, compileMapping, convertEmuToInches, convertEmuToPixels, convertEmuToPixels as convertEmuToPixels$1, convertEmuToPoints, convertInchesToEmu, convertPixelsToEmu, convertPixelsToEmu as convertPixelsToEmu$1, convertPointsToEmu, createPacker, createReplacer, formatId, getReferencedMedia, hasPlaceholders, hashedId, parseArchive, parseCorePropsElement, replaceChartPlaceholders, replaceImagePlaceholders, replaceSmartArtPlaceholders, strFromU8, stringContainerObj, toJson, uniqueId, uniqueNumericIdCreator, uniqueUuid, unzipSync, xsdLineEndSize, xsdRectAlignment, xsdStrikeStyle, xsdTextAlign, xsdTextAnchor, xsdTextCaps, xsdUnderlineStyle, zipAndConvert } from "@office-open/core";
|
|
3
3
|
import { BevelPresetType, CompoundLine, LineCap, LineJoin, PathShadeType, PenAlignment, PresetDash, PresetGeometry, PresetMaterialType, Stretch, TileFlipMode, buildFill, createBevel, createBlip, createBottomBevel, createColorElement, createColorTransforms, createEffectList, createEffectList as createEffectList$1, createGradientFill, createGradientStop, createGroupTransform2D, createOutline, createOutline as createOutline$1, createScene3D, createScene3D as createScene3D$1, createShape3D, createShape3D as createShape3D$1, createTransform2D, extractBlipFillMedia } from "@office-open/core/drawingml";
|
|
4
4
|
import { ChartCollection, ChartSpace } from "@office-open/core/chart";
|
|
5
5
|
import { attr, attrBool, attrNum, children, colorAttr, escapeXml, findChild, findDeep, js2xml, textOf, xml, xml2js } from "@office-open/xml";
|
|
@@ -116,7 +116,7 @@ function createPptxEffectList(options) {
|
|
|
116
116
|
return effectListOpts ? createEffectList$1(effectListOpts) : null;
|
|
117
117
|
}
|
|
118
118
|
var ReflectionAlignment;
|
|
119
|
-
var init_effects = __esmMin(() => {
|
|
119
|
+
var init_effects = __esmMin((() => {
|
|
120
120
|
ReflectionAlignment = {
|
|
121
121
|
TOP_LEFT: "topLeft",
|
|
122
122
|
TOP: "top",
|
|
@@ -128,23 +128,23 @@ var init_effects = __esmMin(() => {
|
|
|
128
128
|
BOTTOM: "bottom",
|
|
129
129
|
BOTTOM_RIGHT: "bottomRight"
|
|
130
130
|
};
|
|
131
|
-
});
|
|
131
|
+
}));
|
|
132
132
|
//#endregion
|
|
133
133
|
//#region src/file/drawingml/fill.ts
|
|
134
|
-
var init_fill = __esmMin(() => {});
|
|
134
|
+
var init_fill = __esmMin((() => {}));
|
|
135
135
|
//#endregion
|
|
136
136
|
//#region src/file/xml-components/base.ts
|
|
137
|
-
var init_base = __esmMin(() => {});
|
|
137
|
+
var init_base = __esmMin((() => {}));
|
|
138
138
|
//#endregion
|
|
139
139
|
//#region src/file/xml-components/index.ts
|
|
140
|
-
var init_xml_components = __esmMin(() => {
|
|
140
|
+
var init_xml_components = __esmMin((() => {
|
|
141
141
|
init_base();
|
|
142
|
-
});
|
|
142
|
+
}));
|
|
143
143
|
//#endregion
|
|
144
144
|
//#region src/file/background/background.ts
|
|
145
145
|
var background_exports = /* @__PURE__ */ __exportAll({ Background: () => Background });
|
|
146
146
|
var Background, BackgroundProperties;
|
|
147
|
-
var init_background = __esmMin(() => {
|
|
147
|
+
var init_background = __esmMin((() => {
|
|
148
148
|
init_effects();
|
|
149
149
|
init_fill();
|
|
150
150
|
init_xml_components();
|
|
@@ -165,21 +165,17 @@ var init_background = __esmMin(() => {
|
|
|
165
165
|
if (el) this.root.push(el);
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
child._attr.shadeToTitle = 1;
|
|
175
|
-
return obj;
|
|
176
|
-
}
|
|
177
|
-
children.unshift({ _attr: { shadeToTitle: 1 } });
|
|
168
|
+
toXml(context) {
|
|
169
|
+
if (this.shadeToTitle) {
|
|
170
|
+
this.root.unshift({ _attr: { shadeToTitle: 1 } });
|
|
171
|
+
const result = super.toXml(context);
|
|
172
|
+
this.root.shift();
|
|
173
|
+
return result;
|
|
178
174
|
}
|
|
179
|
-
return
|
|
175
|
+
return super.toXml(context);
|
|
180
176
|
}
|
|
181
177
|
};
|
|
182
|
-
});
|
|
178
|
+
}));
|
|
183
179
|
//#endregion
|
|
184
180
|
//#region src/file/chart/chart-collection.ts
|
|
185
181
|
init_background();
|
|
@@ -192,10 +188,7 @@ init_xml_components();
|
|
|
192
188
|
var CommentAuthorList = class extends XmlComponent {
|
|
193
189
|
constructor(authors) {
|
|
194
190
|
super("p:cmAuthorLst");
|
|
195
|
-
this.root.push(
|
|
196
|
-
key: "xmlns:p",
|
|
197
|
-
value: "http://schemas.openxmlformats.org/presentationml/2006/main"
|
|
198
|
-
} }));
|
|
191
|
+
this.root.push(buildAttrObject({ "xmlns:p": "http://schemas.openxmlformats.org/presentationml/2006/main" }));
|
|
199
192
|
for (const author of authors) this.root.push(new BuilderElement({
|
|
200
193
|
name: "p:cmAuthor",
|
|
201
194
|
attributes: {
|
|
@@ -232,10 +225,7 @@ init_xml_components();
|
|
|
232
225
|
var SlideCommentList = class extends XmlComponent {
|
|
233
226
|
constructor(comments) {
|
|
234
227
|
super("p:cmLst");
|
|
235
|
-
this.root.push(
|
|
236
|
-
key: "xmlns:p",
|
|
237
|
-
value: "http://schemas.openxmlformats.org/presentationml/2006/main"
|
|
238
|
-
} }));
|
|
228
|
+
this.root.push(buildAttrObject({ "xmlns:p": "http://schemas.openxmlformats.org/presentationml/2006/main" }));
|
|
239
229
|
for (const comment of comments) this.root.push(new BuilderElement({
|
|
240
230
|
name: "p:cm",
|
|
241
231
|
attributes: {
|
|
@@ -283,7 +273,7 @@ const PPTX_NOTES = "application/vnd.openxmlformats-officedocument.presentationml
|
|
|
283
273
|
const PPTX_COMMENTS = "application/vnd.openxmlformats-officedocument.presentationml.comments+xml";
|
|
284
274
|
const PPTX_COMMENT_AUTHORS = "application/vnd.openxmlformats-officedocument.presentationml.commentAuthors+xml";
|
|
285
275
|
const PPTX_CHART = "application/vnd.openxmlformats-officedocument.drawingml.chart+xml";
|
|
286
|
-
const
|
|
276
|
+
const STATIC_ENTRIES = [
|
|
287
277
|
{
|
|
288
278
|
type: "Default",
|
|
289
279
|
contentType: "application/vnd.openxmlformats-package.relationships+xml",
|
|
@@ -349,16 +339,12 @@ const STATIC_CHILDREN = [{ _attr: { xmlns: "http://schemas.openxmlformats.org/pa
|
|
|
349
339
|
contentType: "application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml",
|
|
350
340
|
key: "/ppt/tableStyles.xml"
|
|
351
341
|
}
|
|
352
|
-
]
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
ContentType: e.contentType,
|
|
359
|
-
PartName: e.key
|
|
360
|
-
} } };
|
|
361
|
-
})];
|
|
342
|
+
];
|
|
343
|
+
function formatEntry(e) {
|
|
344
|
+
if (e.type === "Default") return `<Default ContentType="${escapeXml(e.contentType)}" Extension="${escapeXml(e.key)}"/>`;
|
|
345
|
+
return `<Override ContentType="${escapeXml(e.contentType)}" PartName="${escapeXml(e.key)}"/>`;
|
|
346
|
+
}
|
|
347
|
+
const STATIC_XML = `<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">` + STATIC_ENTRIES.map(formatEntry).join("");
|
|
362
348
|
var ContentTypes = class extends BaseXmlComponent {
|
|
363
349
|
dynamicEntries = [];
|
|
364
350
|
constructor() {
|
|
@@ -455,17 +441,11 @@ var ContentTypes = class extends BaseXmlComponent {
|
|
|
455
441
|
key: `/ppt/theme/theme${index}.xml`
|
|
456
442
|
});
|
|
457
443
|
}
|
|
458
|
-
|
|
459
|
-
const
|
|
460
|
-
for (const e of this.dynamicEntries)
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
} } });
|
|
464
|
-
else children.push({ Override: { _attr: {
|
|
465
|
-
ContentType: e.contentType,
|
|
466
|
-
PartName: e.key
|
|
467
|
-
} } });
|
|
468
|
-
return { Types: children };
|
|
444
|
+
toXml(_context) {
|
|
445
|
+
const parts = [STATIC_XML];
|
|
446
|
+
for (const e of this.dynamicEntries) parts.push(formatEntry(e));
|
|
447
|
+
parts.push("</Types>");
|
|
448
|
+
return parts.join("");
|
|
469
449
|
}
|
|
470
450
|
};
|
|
471
451
|
//#endregion
|
|
@@ -477,8 +457,8 @@ var CoreProperties = class extends BaseXmlComponent {
|
|
|
477
457
|
super("cp:coreProperties");
|
|
478
458
|
this.options = options;
|
|
479
459
|
}
|
|
480
|
-
|
|
481
|
-
return
|
|
460
|
+
toXml(_context) {
|
|
461
|
+
return buildCorePropertiesXmlString(this.options);
|
|
482
462
|
}
|
|
483
463
|
};
|
|
484
464
|
//#endregion
|
|
@@ -544,9 +524,6 @@ var GroupTransform2D = class extends XmlComponent {
|
|
|
544
524
|
super(`${prefix}:xfrm`);
|
|
545
525
|
this.core = createGroupTransform2D(options, `${prefix}:xfrm`);
|
|
546
526
|
}
|
|
547
|
-
prepForXml(context) {
|
|
548
|
-
return this.core["prepForXml"]?.(context);
|
|
549
|
-
}
|
|
550
527
|
toXml(context) {
|
|
551
528
|
return this.core.toXml(context);
|
|
552
529
|
}
|
|
@@ -594,32 +571,6 @@ var GroupShapeNonVisualProperties = class extends BuilderElement {
|
|
|
594
571
|
}
|
|
595
572
|
};
|
|
596
573
|
//#endregion
|
|
597
|
-
//#region src/file/shape/paragraph/end-paragraph-run.ts
|
|
598
|
-
init_xml_components();
|
|
599
|
-
/**
|
|
600
|
-
* Pure function: builds a:endParaRPr XML object.
|
|
601
|
-
*/
|
|
602
|
-
function buildEndParagraphRunProperties(lang = "en-US") {
|
|
603
|
-
return { "a:endParaRPr": { _attr: { lang } } };
|
|
604
|
-
}
|
|
605
|
-
/**
|
|
606
|
-
* a:endParaRPr — End paragraph run properties.
|
|
607
|
-
* Lazy: stores lang, builds XML object in prepForXml.
|
|
608
|
-
*/
|
|
609
|
-
var EndParagraphRunProperties = class extends BuilderElement {
|
|
610
|
-
lang;
|
|
611
|
-
constructor(lang = "en-US") {
|
|
612
|
-
super({ name: "a:endParaRPr" });
|
|
613
|
-
this.lang = lang;
|
|
614
|
-
}
|
|
615
|
-
prepForXml(_context) {
|
|
616
|
-
return buildEndParagraphRunProperties(this.lang);
|
|
617
|
-
}
|
|
618
|
-
toXml(_context) {
|
|
619
|
-
return `<a:endParaRPr lang="${this.lang}"/>`;
|
|
620
|
-
}
|
|
621
|
-
};
|
|
622
|
-
//#endregion
|
|
623
574
|
//#region src/file/shape/paragraph/paragraph-properties.ts
|
|
624
575
|
init_xml_components();
|
|
625
576
|
const TextAlignment = {
|
|
@@ -673,7 +624,7 @@ function buildParagraphProperties(options) {
|
|
|
673
624
|
}
|
|
674
625
|
/**
|
|
675
626
|
* a:pPr — Paragraph properties (alignment, indent, spacing).
|
|
676
|
-
* Lazy: stores options, builds XML
|
|
627
|
+
* Lazy: stores options, builds XML in toXml().
|
|
677
628
|
* Omitted from output when completely empty.
|
|
678
629
|
*/
|
|
679
630
|
var ParagraphProperties = class extends XmlComponent {
|
|
@@ -682,15 +633,31 @@ var ParagraphProperties = class extends XmlComponent {
|
|
|
682
633
|
super("a:pPr");
|
|
683
634
|
this.options = options;
|
|
684
635
|
}
|
|
685
|
-
prepForXml(_context) {
|
|
686
|
-
return buildParagraphProperties(this.options);
|
|
687
|
-
}
|
|
688
636
|
toXml(_context) {
|
|
689
637
|
const obj = buildParagraphProperties(this.options);
|
|
690
638
|
return obj ? xml(obj) : "";
|
|
691
639
|
}
|
|
692
640
|
};
|
|
693
641
|
//#endregion
|
|
642
|
+
//#region src/file/constants.ts
|
|
643
|
+
/**
|
|
644
|
+
* OOXML magic-number constants for PPTX generation.
|
|
645
|
+
*
|
|
646
|
+
* Values are in EMU (English Metric Units) or hundredths of a point,
|
|
647
|
+
* as defined by the OOXML specification.
|
|
648
|
+
* @module
|
|
649
|
+
*/
|
|
650
|
+
/** Default outline width: 1pt = 12700 EMU */
|
|
651
|
+
const DEFAULT_OUTLINE_WIDTH = 12700;
|
|
652
|
+
/** Default shadow blur radius: ~4pt = 50800 EMU */
|
|
653
|
+
const DEFAULT_SHADOW_BLUR_RADIUS = 50800;
|
|
654
|
+
/** Default shadow distance: ~3pt = 38100 EMU */
|
|
655
|
+
const DEFAULT_SHADOW_DISTANCE = 38100;
|
|
656
|
+
/** Default shadow direction: 270° = 2700000 (60,000ths of a degree) */
|
|
657
|
+
const DEFAULT_SHADOW_DIRECTION = 27e5;
|
|
658
|
+
/** Default shadow alpha: 40% = 40000 (100,000ths of a percent) */
|
|
659
|
+
const DEFAULT_SHADOW_ALPHA = 4e4;
|
|
660
|
+
//#endregion
|
|
694
661
|
//#region src/file/shape/paragraph/run-properties.ts
|
|
695
662
|
init_fill();
|
|
696
663
|
init_xml_components();
|
|
@@ -711,81 +678,39 @@ const TextCapitalization = {
|
|
|
711
678
|
SMALL: "small"
|
|
712
679
|
};
|
|
713
680
|
/**
|
|
714
|
-
*
|
|
715
|
-
* @param hyperlinkKey - pre-generated key for hyperlink placeholder
|
|
716
|
-
* @param fillObject - pre-built fill IXmlableObject (from buildFill)
|
|
681
|
+
* Builds a:rPr attribute string.
|
|
717
682
|
*/
|
|
718
|
-
function
|
|
719
|
-
const
|
|
720
|
-
|
|
721
|
-
if (options.
|
|
722
|
-
if (options.
|
|
723
|
-
if (options.
|
|
724
|
-
if (options.
|
|
725
|
-
if (options.
|
|
726
|
-
if (options.
|
|
727
|
-
if (options.
|
|
728
|
-
if (options.
|
|
729
|
-
if (options.
|
|
730
|
-
if (options.
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
children.push({ "a:ea": { _attr: { typeface: options.font } } });
|
|
739
|
-
}
|
|
740
|
-
if (options.hyperlink && hyperlinkKey) {
|
|
741
|
-
const hlinkAttrs = { "r:id": `{hlink:${hyperlinkKey}}` };
|
|
742
|
-
if (options.hyperlink.tooltip) hlinkAttrs.tooltip = options.hyperlink.tooltip;
|
|
743
|
-
children.push({ "a:hlinkClick": { _attr: hlinkAttrs } });
|
|
744
|
-
}
|
|
745
|
-
if (options.rightToLeft !== void 0) children.push({ "a:rtl": { _attr: { val: options.rightToLeft ? 1 : 0 } } });
|
|
746
|
-
if (children.length === 0) return void 0;
|
|
747
|
-
return { "a:rPr": children.length === 1 && "_attr" in children[0] ? children[0] : children };
|
|
683
|
+
function buildAttrString(options) {
|
|
684
|
+
const attrs = [];
|
|
685
|
+
if (options.fontSize) attrs.push(`sz="${options.fontSize * 100}"`);
|
|
686
|
+
if (options.bold !== void 0) attrs.push(`b="${options.bold ? 1 : 0}"`);
|
|
687
|
+
if (options.italic !== void 0) attrs.push(`i="${options.italic ? 1 : 0}"`);
|
|
688
|
+
if (options.underline) attrs.push(`u="${xsdUnderlineStyle.to(options.underline)}"`);
|
|
689
|
+
if (options.lang) attrs.push(`lang="${options.lang}"`);
|
|
690
|
+
if (options.strike) attrs.push(`strike="${xsdStrikeStyle.to(options.strike)}"`);
|
|
691
|
+
if (options.baseline !== void 0) attrs.push(`baseline="${options.baseline}"`);
|
|
692
|
+
if (options.capitalization) attrs.push(`cap="${xsdTextCaps.to(options.capitalization)}"`);
|
|
693
|
+
if (options.spacing !== void 0) attrs.push(`spc="${options.spacing}"`);
|
|
694
|
+
if (options.noProof !== void 0) attrs.push(`noProof="${options.noProof ? 1 : 0}"`);
|
|
695
|
+
if (options.dirty !== void 0) attrs.push(`dirty="${options.dirty ? 1 : 0}"`);
|
|
696
|
+
return attrs.join(" ");
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* Checks if options have any settable properties.
|
|
700
|
+
*/
|
|
701
|
+
function hasRunProperties(options) {
|
|
702
|
+
return !!(options.fontSize || options.bold !== void 0 || options.italic !== void 0 || options.underline || options.font || options.lang || options.fill || options.hyperlink || options.strike || options.baseline !== void 0 || options.spacing !== void 0 || options.capitalization || options.shadow !== void 0 || options.outline !== void 0 || options.rightToLeft !== void 0 || options.noProof !== void 0 || options.dirty !== void 0);
|
|
748
703
|
}
|
|
749
704
|
/**
|
|
750
705
|
* a:rPr — Run properties (font, size, color, etc.).
|
|
751
|
-
* Lazy: stores options, builds XML object in prepForXml.
|
|
752
706
|
*/
|
|
753
707
|
var RunProperties = class extends XmlComponent {
|
|
754
708
|
options;
|
|
755
|
-
static hasProperties
|
|
756
|
-
return !!(options.fontSize || options.bold !== void 0 || options.italic !== void 0 || options.underline || options.font || options.lang || options.fill || options.hyperlink || options.strike || options.baseline !== void 0 || options.spacing !== void 0 || options.capitalization || options.shadow !== void 0 || options.outline !== void 0 || options.rightToLeft !== void 0 || options.noProof !== void 0 || options.dirty !== void 0);
|
|
757
|
-
}
|
|
709
|
+
static hasProperties = hasRunProperties;
|
|
758
710
|
constructor(options = {}) {
|
|
759
711
|
super("a:rPr");
|
|
760
712
|
this.options = options;
|
|
761
713
|
}
|
|
762
|
-
prepForXml(context) {
|
|
763
|
-
const opts = this.options;
|
|
764
|
-
let hyperlinkKey;
|
|
765
|
-
if (opts.hyperlink) {
|
|
766
|
-
hyperlinkKey = `hlink_${nextHyperlinkId++}`;
|
|
767
|
-
context.fileData?.hyperlinks?.addHyperlink(hyperlinkKey, opts.hyperlink.url, opts.hyperlink.tooltip);
|
|
768
|
-
}
|
|
769
|
-
let fillObj;
|
|
770
|
-
if (opts.fill !== void 0) fillObj = buildFill(opts.fill).prepForXml(context) ?? void 0;
|
|
771
|
-
let outlineObj;
|
|
772
|
-
if (opts.outline) outlineObj = createOutline$1({
|
|
773
|
-
width: 12700,
|
|
774
|
-
type: "solidFill",
|
|
775
|
-
color: { value: "000000" }
|
|
776
|
-
}).prepForXml(context) ?? void 0;
|
|
777
|
-
let effectListObj;
|
|
778
|
-
if (opts.shadow) effectListObj = createEffectList$1({ outerShadow: {
|
|
779
|
-
blurRadius: 50800,
|
|
780
|
-
distance: 38100,
|
|
781
|
-
direction: 27e5,
|
|
782
|
-
color: {
|
|
783
|
-
value: "000000",
|
|
784
|
-
transforms: { alpha: 4e4 }
|
|
785
|
-
}
|
|
786
|
-
} }).prepForXml(context) ?? void 0;
|
|
787
|
-
return buildRunProperties(opts, hyperlinkKey, fillObj, effectListObj, outlineObj);
|
|
788
|
-
}
|
|
789
714
|
toXml(context) {
|
|
790
715
|
const opts = this.options;
|
|
791
716
|
let hyperlinkKey;
|
|
@@ -793,26 +718,35 @@ var RunProperties = class extends XmlComponent {
|
|
|
793
718
|
hyperlinkKey = `hlink_${nextHyperlinkId++}`;
|
|
794
719
|
context.fileData?.hyperlinks?.addHyperlink(hyperlinkKey, opts.hyperlink.url, opts.hyperlink.tooltip);
|
|
795
720
|
}
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
width: 12700,
|
|
721
|
+
const parts = [];
|
|
722
|
+
const attrStr = buildAttrString(opts);
|
|
723
|
+
if (opts.outline) parts.push(createOutline$1({
|
|
724
|
+
width: DEFAULT_OUTLINE_WIDTH,
|
|
801
725
|
type: "solidFill",
|
|
802
726
|
color: { value: "000000" }
|
|
803
|
-
}).
|
|
804
|
-
|
|
805
|
-
if (opts.shadow)
|
|
806
|
-
blurRadius:
|
|
807
|
-
distance:
|
|
808
|
-
direction:
|
|
727
|
+
}).toXml(context));
|
|
728
|
+
if (opts.fill !== void 0) parts.push(buildFill(opts.fill).toXml(context));
|
|
729
|
+
if (opts.shadow) parts.push(createEffectList$1({ outerShadow: {
|
|
730
|
+
blurRadius: DEFAULT_SHADOW_BLUR_RADIUS,
|
|
731
|
+
distance: DEFAULT_SHADOW_DISTANCE,
|
|
732
|
+
direction: DEFAULT_SHADOW_DIRECTION,
|
|
809
733
|
color: {
|
|
810
734
|
value: "000000",
|
|
811
|
-
transforms: { alpha:
|
|
735
|
+
transforms: { alpha: DEFAULT_SHADOW_ALPHA }
|
|
812
736
|
}
|
|
813
|
-
} }).
|
|
814
|
-
|
|
815
|
-
|
|
737
|
+
} }).toXml(context));
|
|
738
|
+
if (opts.font) {
|
|
739
|
+
parts.push(`<a:latin typeface="${opts.font}"/>`);
|
|
740
|
+
parts.push(`<a:ea typeface="${opts.font}"/>`);
|
|
741
|
+
}
|
|
742
|
+
if (opts.hyperlink && hyperlinkKey) {
|
|
743
|
+
const tooltip = opts.hyperlink.tooltip ? ` tooltip="${opts.hyperlink.tooltip}"` : "";
|
|
744
|
+
parts.push(`<a:hlinkClick r:id="{hlink:${hyperlinkKey}}"${tooltip}/>`);
|
|
745
|
+
}
|
|
746
|
+
if (opts.rightToLeft !== void 0) parts.push(`<a:rtl val="${opts.rightToLeft ? 1 : 0}"/>`);
|
|
747
|
+
if (attrStr.length === 0 && parts.length === 0) return "";
|
|
748
|
+
if (parts.length === 0) return `<a:rPr ${attrStr}/>`;
|
|
749
|
+
return `<a:rPr ${attrStr}>${parts.join("")}</a:rPr>`;
|
|
816
750
|
}
|
|
817
751
|
};
|
|
818
752
|
//#endregion
|
|
@@ -820,7 +754,6 @@ var RunProperties = class extends XmlComponent {
|
|
|
820
754
|
init_xml_components();
|
|
821
755
|
/**
|
|
822
756
|
* a:r — A run of text with properties.
|
|
823
|
-
* Lazy: stores options, builds XML object in prepForXml.
|
|
824
757
|
*/
|
|
825
758
|
var TextRun = class extends XmlComponent {
|
|
826
759
|
options;
|
|
@@ -828,34 +761,9 @@ var TextRun = class extends XmlComponent {
|
|
|
828
761
|
super("a:r");
|
|
829
762
|
this.options = typeof options === "string" ? { text: options } : options;
|
|
830
763
|
}
|
|
831
|
-
prepForXml(context) {
|
|
832
|
-
const children = [];
|
|
833
|
-
if (RunProperties.hasProperties(this.options)) {
|
|
834
|
-
const rPrObj = new RunProperties(this.options).prepForXml(context);
|
|
835
|
-
if (rPrObj) children.push(rPrObj);
|
|
836
|
-
}
|
|
837
|
-
if (this.options.text) children.push({ "a:t": [this.options.text] });
|
|
838
|
-
return { "a:r": children.length === 0 ? {} : children.length === 1 && "_attr" in children[0] ? children[0] : children };
|
|
839
|
-
}
|
|
840
|
-
/**
|
|
841
|
-
* Fast path: simple properties (no hyperlink/fill/shadow/outline) skip
|
|
842
|
-
* RunProperties side effects and serialize directly.
|
|
843
|
-
* Complex path uses RunProperties.toXml() + direct text serialization.
|
|
844
|
-
*/
|
|
845
764
|
toXml(context) {
|
|
846
|
-
const
|
|
847
|
-
|
|
848
|
-
if (!hasRPr || !opts.hyperlink && !opts.fill && !opts.shadow && !opts.outline) {
|
|
849
|
-
let body = "";
|
|
850
|
-
if (hasRPr) {
|
|
851
|
-
const rPrObj = buildRunProperties(opts);
|
|
852
|
-
if (rPrObj) body += xml(rPrObj);
|
|
853
|
-
}
|
|
854
|
-
if (opts.text) body += `<a:t>${escapeXml(opts.text)}</a:t>`;
|
|
855
|
-
return body.length === 0 ? "<a:r/>" : `<a:r>${body}</a:r>`;
|
|
856
|
-
}
|
|
857
|
-
let body = new RunProperties(opts).toXml(context);
|
|
858
|
-
if (opts.text) body += `<a:t>${escapeXml(opts.text)}</a:t>`;
|
|
765
|
+
const body = new RunProperties(this.options).toXml(context);
|
|
766
|
+
if (this.options.text) return `<a:r>${body}<a:t>${escapeXml(this.options.text)}</a:t></a:r>`;
|
|
859
767
|
return body ? `<a:r>${body}</a:r>` : "<a:r/>";
|
|
860
768
|
}
|
|
861
769
|
};
|
|
@@ -864,7 +772,7 @@ var TextRun = class extends XmlComponent {
|
|
|
864
772
|
init_xml_components();
|
|
865
773
|
/**
|
|
866
774
|
* a:p — A paragraph in a text body.
|
|
867
|
-
* Lazy: stores options, builds XML
|
|
775
|
+
* Lazy: stores options, builds XML in toXml().
|
|
868
776
|
*/
|
|
869
777
|
var Paragraph = class extends XmlComponent {
|
|
870
778
|
options;
|
|
@@ -872,21 +780,6 @@ var Paragraph = class extends XmlComponent {
|
|
|
872
780
|
super("a:p");
|
|
873
781
|
this.options = typeof options === "string" ? { text: options } : options;
|
|
874
782
|
}
|
|
875
|
-
prepForXml(context) {
|
|
876
|
-
const children = [];
|
|
877
|
-
const pPr = buildParagraphProperties(this.options.properties ?? {});
|
|
878
|
-
if (pPr) children.push(pPr);
|
|
879
|
-
if (this.options.text) {
|
|
880
|
-
const obj = new TextRun(this.options.text).prepForXml(context);
|
|
881
|
-
if (obj) children.push(obj);
|
|
882
|
-
}
|
|
883
|
-
if (this.options.children) for (const rawChild of this.options.children) {
|
|
884
|
-
const obj = (rawChild instanceof TextRun || rawChild instanceof XmlComponent ? rawChild : new TextRun(rawChild)).prepForXml(context);
|
|
885
|
-
if (obj) children.push(obj);
|
|
886
|
-
}
|
|
887
|
-
children.push(buildEndParagraphRunProperties());
|
|
888
|
-
return { "a:p": children };
|
|
889
|
-
}
|
|
890
783
|
toXml(context) {
|
|
891
784
|
const parts = [];
|
|
892
785
|
const pPr = buildParagraphProperties(this.options.properties ?? {});
|
|
@@ -906,16 +799,17 @@ var Paragraph = class extends XmlComponent {
|
|
|
906
799
|
init_xml_components();
|
|
907
800
|
init_fill();
|
|
908
801
|
function buildBorderLine(name, options) {
|
|
909
|
-
const attrs =
|
|
802
|
+
const attrs = [];
|
|
803
|
+
if (options.width !== void 0) attrs.push(`w="${options.width}"`);
|
|
910
804
|
const children = [];
|
|
911
|
-
if (options.
|
|
912
|
-
if (options.
|
|
913
|
-
|
|
914
|
-
|
|
805
|
+
if (options.color) children.push(`<a:solidFill><a:srgbClr val="${options.color.replace("#", "")}"/></a:solidFill>`);
|
|
806
|
+
if (options.dashStyle) children.push(`<a:prstDash val="${options.dashStyle}"/>`);
|
|
807
|
+
const attrStr = attrs.length > 0 ? ` ${attrs.join(" ")}` : "";
|
|
808
|
+
if (children.length === 0) return `<${name}${attrStr}/>`;
|
|
809
|
+
return `<${name}${attrStr}>${children.join("")}</${name}>`;
|
|
915
810
|
}
|
|
916
811
|
/**
|
|
917
812
|
* a:tcPr — Table cell properties (borders + fill).
|
|
918
|
-
* Lazy: stores options, builds IXmlableObject in prepForXml.
|
|
919
813
|
*/
|
|
920
814
|
var TableCellProperties = class extends BaseXmlComponent {
|
|
921
815
|
options;
|
|
@@ -923,25 +817,28 @@ var TableCellProperties = class extends BaseXmlComponent {
|
|
|
923
817
|
super("a:tcPr");
|
|
924
818
|
this.options = options;
|
|
925
819
|
}
|
|
926
|
-
|
|
927
|
-
const
|
|
820
|
+
toXml(context) {
|
|
821
|
+
const parts = [];
|
|
928
822
|
const opts = this.options;
|
|
929
|
-
if (opts?.verticalAlign)
|
|
823
|
+
if (opts?.verticalAlign) parts.push(`anchor="${opts.verticalAlign}"`);
|
|
930
824
|
if (opts?.borders) {
|
|
931
|
-
if (opts.borders.left)
|
|
932
|
-
if (opts.borders.right)
|
|
933
|
-
if (opts.borders.top)
|
|
934
|
-
if (opts.borders.bottom)
|
|
825
|
+
if (opts.borders.left) parts.push(buildBorderLine("a:lnL", opts.borders.left));
|
|
826
|
+
if (opts.borders.right) parts.push(buildBorderLine("a:lnR", opts.borders.right));
|
|
827
|
+
if (opts.borders.top) parts.push(buildBorderLine("a:lnT", opts.borders.top));
|
|
828
|
+
if (opts.borders.bottom) parts.push(buildBorderLine("a:lnB", opts.borders.bottom));
|
|
935
829
|
}
|
|
936
830
|
if (opts?.fill !== void 0) {
|
|
937
|
-
const
|
|
938
|
-
|
|
831
|
+
const fillComp = buildFill(opts.fill);
|
|
832
|
+
parts.push(fillComp.toXml(context));
|
|
939
833
|
}
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
834
|
+
if (parts.length === 0) return "<a:tcPr/>";
|
|
835
|
+
if (!parts[0].startsWith("<")) {
|
|
836
|
+
const attrStr = parts[0];
|
|
837
|
+
const children = parts.slice(1);
|
|
838
|
+
if (children.length === 0) return `<a:tcPr ${attrStr}/>`;
|
|
839
|
+
return `<a:tcPr ${attrStr}>${children.join("")}</a:tcPr>`;
|
|
840
|
+
}
|
|
841
|
+
return `<a:tcPr>${parts.join("")}</a:tcPr>`;
|
|
945
842
|
}
|
|
946
843
|
};
|
|
947
844
|
//#endregion
|
|
@@ -954,7 +851,7 @@ const VerticalAlignment = {
|
|
|
954
851
|
};
|
|
955
852
|
/**
|
|
956
853
|
* a:tc — Table cell with text body and properties.
|
|
957
|
-
* Lazy: stores options, builds
|
|
854
|
+
* Lazy: stores options, builds XML string in toXml.
|
|
958
855
|
*/
|
|
959
856
|
var TableCell = class extends BaseXmlComponent {
|
|
960
857
|
options;
|
|
@@ -967,36 +864,6 @@ var TableCell = class extends BaseXmlComponent {
|
|
|
967
864
|
children: [new TextRun({ text: options.text })]
|
|
968
865
|
})] : void 0);
|
|
969
866
|
}
|
|
970
|
-
prepForXml(context) {
|
|
971
|
-
const opts = this.options;
|
|
972
|
-
const children = [];
|
|
973
|
-
const tcAttrs = {};
|
|
974
|
-
if (opts.columnSpan !== void 0 && opts.columnSpan > 1) tcAttrs.gridSpan = opts.columnSpan;
|
|
975
|
-
if (opts.rowSpan !== void 0 && opts.rowSpan > 1) tcAttrs.rowSpan = opts.rowSpan;
|
|
976
|
-
if (Object.keys(tcAttrs).length > 0) children.push({ _attr: tcAttrs });
|
|
977
|
-
const txBodyChildren = [];
|
|
978
|
-
const margins = opts.margins;
|
|
979
|
-
const bodyPrAttrs = {};
|
|
980
|
-
if (margins?.top !== void 0) bodyPrAttrs.tIns = margins.top;
|
|
981
|
-
if (margins?.bottom !== void 0) bodyPrAttrs.bIns = margins.bottom;
|
|
982
|
-
if (margins?.left !== void 0) bodyPrAttrs.lIns = margins.left;
|
|
983
|
-
if (margins?.right !== void 0) bodyPrAttrs.rIns = margins.right;
|
|
984
|
-
txBodyChildren.push({ "a:bodyPr": Object.keys(bodyPrAttrs).length > 0 ? { _attr: bodyPrAttrs } : {} });
|
|
985
|
-
txBodyChildren.push({ "a:lstStyle": {} });
|
|
986
|
-
if (this.paragraphs) for (const p of this.paragraphs) {
|
|
987
|
-
const pObj = p.prepForXml(context);
|
|
988
|
-
if (pObj) txBodyChildren.push(pObj);
|
|
989
|
-
}
|
|
990
|
-
else txBodyChildren.push({ "a:p": [] });
|
|
991
|
-
children.push({ "a:txBody": txBodyChildren });
|
|
992
|
-
const tcPrObj = new TableCellProperties({
|
|
993
|
-
fill: opts.fill,
|
|
994
|
-
borders: opts.borders,
|
|
995
|
-
verticalAlign: opts.verticalAlign ? xsdTextAnchor.to(opts.verticalAlign) : void 0
|
|
996
|
-
}).prepForXml(context);
|
|
997
|
-
if (tcPrObj) children.push(tcPrObj);
|
|
998
|
-
return { "a:tc": children };
|
|
999
|
-
}
|
|
1000
867
|
toXml(context) {
|
|
1001
868
|
const opts = this.options;
|
|
1002
869
|
const parts = [];
|
|
@@ -1054,7 +921,7 @@ function buildBodyPr(options) {
|
|
|
1054
921
|
}
|
|
1055
922
|
/**
|
|
1056
923
|
* p:txBody — Text body within a shape.
|
|
1057
|
-
* Lazy: stores options, builds XML
|
|
924
|
+
* Lazy: stores options, builds XML in toXml().
|
|
1058
925
|
*/
|
|
1059
926
|
var TextBody = class extends XmlComponent {
|
|
1060
927
|
options;
|
|
@@ -1062,23 +929,6 @@ var TextBody = class extends XmlComponent {
|
|
|
1062
929
|
super("p:txBody");
|
|
1063
930
|
this.options = options;
|
|
1064
931
|
}
|
|
1065
|
-
prepForXml(context) {
|
|
1066
|
-
const children = [];
|
|
1067
|
-
children.push(buildBodyPr(this.options));
|
|
1068
|
-
children.push({ "a:lstStyle": {} });
|
|
1069
|
-
if (this.options.children) for (const p of this.options.children) {
|
|
1070
|
-
const obj = (typeof p === "string" ? new Paragraph({ children: [new TextRun({ text: p })] }) : p instanceof Paragraph ? p : new Paragraph(p)).prepForXml(context);
|
|
1071
|
-
if (obj) children.push(obj);
|
|
1072
|
-
}
|
|
1073
|
-
else if (this.options.text !== void 0) {
|
|
1074
|
-
const obj = new Paragraph({ children: [new TextRun({ text: this.options.text })] }).prepForXml(context);
|
|
1075
|
-
if (obj) children.push(obj);
|
|
1076
|
-
} else {
|
|
1077
|
-
const obj = new Paragraph().prepForXml(context);
|
|
1078
|
-
if (obj) children.push(obj);
|
|
1079
|
-
}
|
|
1080
|
-
return { "p:txBody": children };
|
|
1081
|
-
}
|
|
1082
932
|
toXml(context) {
|
|
1083
933
|
const parts = [];
|
|
1084
934
|
parts.push(xml(buildBodyPr(this.options)));
|
|
@@ -1103,19 +953,10 @@ init_xml_components();
|
|
|
1103
953
|
var NotesSlide = class extends XmlComponent {
|
|
1104
954
|
constructor(options = {}) {
|
|
1105
955
|
super("p:notes");
|
|
1106
|
-
this.root.push(
|
|
1107
|
-
"xmlns:a":
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
},
|
|
1111
|
-
"xmlns:r": {
|
|
1112
|
-
key: "xmlns:r",
|
|
1113
|
-
value: "http://schemas.openxmlformats.org/officeDocument/2006/relationships"
|
|
1114
|
-
},
|
|
1115
|
-
"xmlns:p": {
|
|
1116
|
-
key: "xmlns:p",
|
|
1117
|
-
value: "http://schemas.openxmlformats.org/presentationml/2006/main"
|
|
1118
|
-
}
|
|
956
|
+
this.root.push(buildAttrObject({
|
|
957
|
+
"xmlns:a": "http://schemas.openxmlformats.org/drawingml/2006/main",
|
|
958
|
+
"xmlns:r": "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
|
|
959
|
+
"xmlns:p": "http://schemas.openxmlformats.org/presentationml/2006/main"
|
|
1119
960
|
}));
|
|
1120
961
|
this.root.push(new NotesCommonSlideData(options.text));
|
|
1121
962
|
this.root.push(new BuilderElement({
|
|
@@ -1297,8 +1138,8 @@ var PresentationProperties = class PresentationProperties extends ImportedXmlCom
|
|
|
1297
1138
|
this.key = showOptions ? presPropsKey(showOptions) : "";
|
|
1298
1139
|
if (!PresentationProperties.cache.has(this.key)) PresentationProperties.cache.set(this.key, ImportedXmlComponent.fromXmlString(buildPresPropsXml(showOptions)));
|
|
1299
1140
|
}
|
|
1300
|
-
|
|
1301
|
-
return PresentationProperties.cache.get(this.key).
|
|
1141
|
+
toXml(context) {
|
|
1142
|
+
return PresentationProperties.cache.get(this.key).toXml(context);
|
|
1302
1143
|
}
|
|
1303
1144
|
};
|
|
1304
1145
|
function presPropsKey(o) {
|
|
@@ -1337,10 +1178,9 @@ const DEFAULT_TEXT_STYLE_XML = `<p:defaultTextStyle xmlns:a="http://schemas.open
|
|
|
1337
1178
|
<a:defRPr sz="1800" kern="1200"><a:solidFill><a:schemeClr val="tx1"/></a:solidFill><a:latin typeface="+mn-lt"/><a:ea typeface="+mn-ea"/><a:cs typeface="+mn-cs"/></a:defRPr>
|
|
1338
1179
|
</a:lvl9pPr>
|
|
1339
1180
|
</p:defaultTextStyle>`;
|
|
1340
|
-
const DEFAULT_TEXT_STYLE_OBJ = ImportedXmlComponent.fromXmlString(DEFAULT_TEXT_STYLE_XML).prepForXml({ stack: [] });
|
|
1341
1181
|
/**
|
|
1342
1182
|
* p:presentation — Root element of a PPTX file.
|
|
1343
|
-
* Lazy: stores options, builds XML
|
|
1183
|
+
* Lazy: stores options, builds XML in toXml().
|
|
1344
1184
|
*/
|
|
1345
1185
|
var Presentation = class extends XmlComponent {
|
|
1346
1186
|
options;
|
|
@@ -1348,38 +1188,6 @@ var Presentation = class extends XmlComponent {
|
|
|
1348
1188
|
super("p:presentation");
|
|
1349
1189
|
this.options = options;
|
|
1350
1190
|
}
|
|
1351
|
-
prepForXml(_context) {
|
|
1352
|
-
const opts = this.options;
|
|
1353
|
-
const children = [];
|
|
1354
|
-
children.push({ _attr: {
|
|
1355
|
-
"xmlns:a": "http://schemas.openxmlformats.org/drawingml/2006/main",
|
|
1356
|
-
"xmlns:r": "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
|
|
1357
|
-
"xmlns:p": "http://schemas.openxmlformats.org/presentationml/2006/main"
|
|
1358
|
-
} });
|
|
1359
|
-
const masterIds = Array.from({ length: opts.masterCount }, (_, i) => ({ "p:sldMasterId": { _attr: {
|
|
1360
|
-
id: 2147483648 + i * 12,
|
|
1361
|
-
"r:id": `rId${i + 1}`
|
|
1362
|
-
} } }));
|
|
1363
|
-
children.push({ "p:sldMasterIdLst": masterIds });
|
|
1364
|
-
const slideRidOffset = opts.masterCount + 1;
|
|
1365
|
-
const sldIds = opts.slideIds.map((id, i) => ({ "p:sldId": { _attr: {
|
|
1366
|
-
id,
|
|
1367
|
-
"r:id": `rId${slideRidOffset + i}`
|
|
1368
|
-
} } }));
|
|
1369
|
-
children.push({ "p:sldIdLst": sldIds });
|
|
1370
|
-
const cx = opts.slideWidth ?? 12192e3;
|
|
1371
|
-
const cy = opts.slideHeight ?? 6858e3;
|
|
1372
|
-
children.push({ "p:sldSz": { _attr: {
|
|
1373
|
-
cx,
|
|
1374
|
-
cy
|
|
1375
|
-
} } });
|
|
1376
|
-
children.push({ "p:notesSz": { _attr: {
|
|
1377
|
-
cx: 6858e3,
|
|
1378
|
-
cy: 9144e3
|
|
1379
|
-
} } });
|
|
1380
|
-
children.push(DEFAULT_TEXT_STYLE_OBJ);
|
|
1381
|
-
return { "p:presentation": children };
|
|
1382
|
-
}
|
|
1383
1191
|
toXml(_context) {
|
|
1384
1192
|
const opts = this.options;
|
|
1385
1193
|
const cx = opts.slideWidth ?? 12192e3;
|
|
@@ -1425,9 +1233,6 @@ var Transform2D = class extends XmlComponent {
|
|
|
1425
1233
|
super(`${prefix}:xfrm`);
|
|
1426
1234
|
this.core = createTransform2D(options, `${prefix}:xfrm`);
|
|
1427
1235
|
}
|
|
1428
|
-
prepForXml(context) {
|
|
1429
|
-
return this.core["prepForXml"]?.(context);
|
|
1430
|
-
}
|
|
1431
1236
|
toXml(context) {
|
|
1432
1237
|
return this.core.toXml(context);
|
|
1433
1238
|
}
|
|
@@ -1495,10 +1300,6 @@ var Chart = class extends XmlComponent {
|
|
|
1495
1300
|
key: this.chartKey
|
|
1496
1301
|
});
|
|
1497
1302
|
}
|
|
1498
|
-
prepForXml(context) {
|
|
1499
|
-
this.registerChart(context);
|
|
1500
|
-
return super.prepForXml(context);
|
|
1501
|
-
}
|
|
1502
1303
|
toXml(context) {
|
|
1503
1304
|
this.registerChart(context);
|
|
1504
1305
|
return super.toXml(context);
|
|
@@ -1542,29 +1343,17 @@ var ChartGraphic = class extends XmlComponent {
|
|
|
1542
1343
|
var ChartGraphicData = class extends XmlComponent {
|
|
1543
1344
|
constructor(chartKey) {
|
|
1544
1345
|
super("a:graphicData");
|
|
1545
|
-
this.root.push(
|
|
1546
|
-
key: "uri",
|
|
1547
|
-
value: "http://schemas.openxmlformats.org/drawingml/2006/chart"
|
|
1548
|
-
} }));
|
|
1346
|
+
this.root.push(buildAttrObject({ uri: "http://schemas.openxmlformats.org/drawingml/2006/chart" }));
|
|
1549
1347
|
this.root.push(new ChartRef(chartKey));
|
|
1550
1348
|
}
|
|
1551
1349
|
};
|
|
1552
1350
|
var ChartRef = class extends XmlComponent {
|
|
1553
1351
|
constructor(chartKey) {
|
|
1554
1352
|
super("c:chart");
|
|
1555
|
-
this.root.push(
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
},
|
|
1560
|
-
xmlnsR: {
|
|
1561
|
-
key: "xmlns:r",
|
|
1562
|
-
value: "http://schemas.openxmlformats.org/officeDocument/2006/relationships"
|
|
1563
|
-
},
|
|
1564
|
-
rId: {
|
|
1565
|
-
key: "r:id",
|
|
1566
|
-
value: `{chart:${chartKey}}`
|
|
1567
|
-
}
|
|
1353
|
+
this.root.push(buildAttrObject({
|
|
1354
|
+
"xmlns:c": "http://schemas.openxmlformats.org/drawingml/2006/chart",
|
|
1355
|
+
"xmlns:r": "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
|
|
1356
|
+
"r:id": `{chart:${chartKey}}`
|
|
1568
1357
|
}));
|
|
1569
1358
|
}
|
|
1570
1359
|
};
|
|
@@ -1601,7 +1390,7 @@ function buildMediaData(type, fileName, width, height, data) {
|
|
|
1601
1390
|
*
|
|
1602
1391
|
* Encapsulates the common structure: ID assignment, media data building,
|
|
1603
1392
|
* p:spPr (Transform2D + PresetGeometry), p:blipFill, p:nvPicPr parts,
|
|
1604
|
-
* and media registration in
|
|
1393
|
+
* and media registration in toXml().
|
|
1605
1394
|
*/
|
|
1606
1395
|
var MediaFrameBase = class extends XmlComponent {
|
|
1607
1396
|
shapeId;
|
|
@@ -1708,10 +1497,6 @@ var MediaFrameBase = class extends XmlComponent {
|
|
|
1708
1497
|
if (this.posterData) file?.media.addImage(this.posterData.fileName, this.posterData);
|
|
1709
1498
|
file?.media.addMedia(this.mediaData.fileName, this.mediaData);
|
|
1710
1499
|
}
|
|
1711
|
-
prepForXml(context) {
|
|
1712
|
-
this.registerMedia(context);
|
|
1713
|
-
return super.prepForXml(context);
|
|
1714
|
-
}
|
|
1715
1500
|
toXml(context) {
|
|
1716
1501
|
this.registerMedia(context);
|
|
1717
1502
|
return super.toXml(context);
|
|
@@ -1906,7 +1691,7 @@ init_xml_components();
|
|
|
1906
1691
|
/**
|
|
1907
1692
|
* p:pic — A picture on a slide.
|
|
1908
1693
|
*
|
|
1909
|
-
* Registers image with Media collection via
|
|
1694
|
+
* Registers image with Media collection via toXml().
|
|
1910
1695
|
* The ImageReplacer replaces `{fileName}` placeholder with actual rId.
|
|
1911
1696
|
*/
|
|
1912
1697
|
var Picture = class Picture extends XmlComponent {
|
|
@@ -1943,10 +1728,6 @@ var Picture = class Picture extends XmlComponent {
|
|
|
1943
1728
|
registerMedia(context) {
|
|
1944
1729
|
context.fileData?.media.addImage(this.imageData.fileName, this.imageData);
|
|
1945
1730
|
}
|
|
1946
|
-
prepForXml(context) {
|
|
1947
|
-
this.registerMedia(context);
|
|
1948
|
-
return super.prepForXml(context);
|
|
1949
|
-
}
|
|
1950
1731
|
toXml(context) {
|
|
1951
1732
|
this.registerMedia(context);
|
|
1952
1733
|
return super.toXml(context);
|
|
@@ -1957,7 +1738,7 @@ var Picture = class Picture extends XmlComponent {
|
|
|
1957
1738
|
init_xml_components();
|
|
1958
1739
|
/**
|
|
1959
1740
|
* p:grpSp — Group shape containing child shapes.
|
|
1960
|
-
* Lazy: stores options, builds XML
|
|
1741
|
+
* Lazy: stores options, builds XML in toXml().
|
|
1961
1742
|
*/
|
|
1962
1743
|
var GroupShape = class GroupShape extends BaseXmlComponent {
|
|
1963
1744
|
static nextId = 100;
|
|
@@ -1968,47 +1749,6 @@ var GroupShape = class GroupShape extends BaseXmlComponent {
|
|
|
1968
1749
|
this.id = GroupShape.nextId++;
|
|
1969
1750
|
this.options = options;
|
|
1970
1751
|
}
|
|
1971
|
-
prepForXml(context) {
|
|
1972
|
-
const opts = this.options;
|
|
1973
|
-
const id = this.id;
|
|
1974
|
-
const name = `Group ${id}`;
|
|
1975
|
-
const children = [];
|
|
1976
|
-
children.push({ "p:nvGrpSpPr": [
|
|
1977
|
-
{ "p:cNvPr": { _attr: {
|
|
1978
|
-
id,
|
|
1979
|
-
name
|
|
1980
|
-
} } },
|
|
1981
|
-
{ "p:cNvGrpSpPr": {} },
|
|
1982
|
-
{ "p:nvPr": {} }
|
|
1983
|
-
] });
|
|
1984
|
-
const xfrmChildren = [];
|
|
1985
|
-
const xfrmAttrs = {};
|
|
1986
|
-
if (opts.flipHorizontal !== void 0) xfrmAttrs.flipH = opts.flipHorizontal ? 1 : 0;
|
|
1987
|
-
if (opts.rotation !== void 0) xfrmAttrs.rot = opts.rotation;
|
|
1988
|
-
if (Object.keys(xfrmAttrs).length > 0) xfrmChildren.push({ _attr: xfrmAttrs });
|
|
1989
|
-
xfrmChildren.push({ "a:off": { _attr: {
|
|
1990
|
-
x: opts.x !== void 0 ? convertPixelsToEmu$1(opts.x) : 0,
|
|
1991
|
-
y: opts.y !== void 0 ? convertPixelsToEmu$1(opts.y) : 0
|
|
1992
|
-
} } });
|
|
1993
|
-
xfrmChildren.push({ "a:ext": { _attr: {
|
|
1994
|
-
cx: opts.width !== void 0 ? convertPixelsToEmu$1(opts.width) : 0,
|
|
1995
|
-
cy: opts.height !== void 0 ? convertPixelsToEmu$1(opts.height) : 0
|
|
1996
|
-
} } });
|
|
1997
|
-
xfrmChildren.push({ "a:chOff": { _attr: {
|
|
1998
|
-
x: 0,
|
|
1999
|
-
y: 0
|
|
2000
|
-
} } });
|
|
2001
|
-
xfrmChildren.push({ "a:chExt": { _attr: {
|
|
2002
|
-
cx: 0,
|
|
2003
|
-
cy: 0
|
|
2004
|
-
} } });
|
|
2005
|
-
children.push({ "p:grpSpPr": [{ "a:xfrm": xfrmChildren }] });
|
|
2006
|
-
for (const rawChild of opts.children) {
|
|
2007
|
-
const obj = coerceChild(rawChild).prepForXml(context);
|
|
2008
|
-
if (obj) children.push(obj);
|
|
2009
|
-
}
|
|
2010
|
-
return { "p:grpSp": children };
|
|
2011
|
-
}
|
|
2012
1752
|
toXml(context) {
|
|
2013
1753
|
const opts = this.options;
|
|
2014
1754
|
const id = this.id;
|
|
@@ -2278,7 +2018,6 @@ init_effects();
|
|
|
2278
2018
|
init_fill();
|
|
2279
2019
|
/**
|
|
2280
2020
|
* p:spPr — Shape properties (transform, geometry, fill, outline, effects).
|
|
2281
|
-
* Lazy: stores options, builds XML object directly in prepForXml.
|
|
2282
2021
|
*/
|
|
2283
2022
|
var ShapeProperties = class extends BaseXmlComponent {
|
|
2284
2023
|
options;
|
|
@@ -2286,15 +2025,11 @@ var ShapeProperties = class extends BaseXmlComponent {
|
|
|
2286
2025
|
super("p:spPr");
|
|
2287
2026
|
this.options = options;
|
|
2288
2027
|
}
|
|
2289
|
-
|
|
2028
|
+
toXml(context) {
|
|
2290
2029
|
const opts = this.options;
|
|
2291
|
-
const
|
|
2292
|
-
if (opts.x !== void 0 || opts.y !== void 0 || opts.width !== void 0 || opts.height !== void 0 || opts.flipHorizontal !== void 0 || opts.rotation !== void 0)
|
|
2293
|
-
|
|
2294
|
-
if (xfrmObj) children.push(xfrmObj);
|
|
2295
|
-
}
|
|
2296
|
-
const geomObj = new PresetGeometry({ preset: opts.geometry ?? "rect" }).prepForXml(context);
|
|
2297
|
-
if (geomObj) children.push(geomObj);
|
|
2030
|
+
const parts = [];
|
|
2031
|
+
if (opts.x !== void 0 || opts.y !== void 0 || opts.width !== void 0 || opts.height !== void 0 || opts.flipHorizontal !== void 0 || opts.rotation !== void 0) parts.push(new Transform2D(opts).toXml(context));
|
|
2032
|
+
parts.push(new PresetGeometry({ preset: opts.geometry ?? "rect" }).toXml(context));
|
|
2298
2033
|
const media = opts.fill ? extractBlipFillMedia(opts.fill) : void 0;
|
|
2299
2034
|
if (media) context.fileData?.media.addImage(media.fileName, {
|
|
2300
2035
|
data: media.data,
|
|
@@ -2311,59 +2046,34 @@ var ShapeProperties = class extends BaseXmlComponent {
|
|
|
2311
2046
|
}
|
|
2312
2047
|
}
|
|
2313
2048
|
});
|
|
2314
|
-
const
|
|
2315
|
-
|
|
2316
|
-
if (opts.outline)
|
|
2317
|
-
const outlineObj = createOutlineCompat(opts.outline).prepForXml(context);
|
|
2318
|
-
if (outlineObj) children.push(outlineObj);
|
|
2319
|
-
}
|
|
2049
|
+
const fillComponent = buildFill(opts.fill !== void 0 ? opts.fill : { type: "none" });
|
|
2050
|
+
parts.push(fillComponent.toXml(context));
|
|
2051
|
+
if (opts.outline) parts.push(createOutlineCompat(opts.outline).toXml(context));
|
|
2320
2052
|
if (opts.effects) {
|
|
2321
2053
|
const effectObj = createPptxEffectList(opts.effects);
|
|
2322
|
-
if (effectObj)
|
|
2323
|
-
const effectXmlObj = effectObj.prepForXml(context);
|
|
2324
|
-
if (effectXmlObj) children.push(effectXmlObj);
|
|
2325
|
-
}
|
|
2054
|
+
if (effectObj) parts.push(effectObj.toXml(context));
|
|
2326
2055
|
const scene3d = buildScene3D(opts.effects);
|
|
2327
|
-
if (scene3d)
|
|
2328
|
-
const sceneObj = scene3d.prepForXml(context);
|
|
2329
|
-
if (sceneObj) children.push(sceneObj);
|
|
2330
|
-
}
|
|
2056
|
+
if (scene3d) parts.push(scene3d.toXml(context));
|
|
2331
2057
|
const shape3d = buildShape3D(opts.effects);
|
|
2332
|
-
if (shape3d)
|
|
2333
|
-
const shapeObj = shape3d.prepForXml(context);
|
|
2334
|
-
if (shapeObj) children.push(shapeObj);
|
|
2335
|
-
}
|
|
2058
|
+
if (shape3d) parts.push(shape3d.toXml(context));
|
|
2336
2059
|
}
|
|
2337
2060
|
if (opts.connectionSites && opts.connectionSites.length > 0) {
|
|
2338
|
-
const
|
|
2061
|
+
const cxnParts = [];
|
|
2339
2062
|
for (const site of opts.connectionSites) {
|
|
2340
|
-
const
|
|
2341
|
-
|
|
2342
|
-
cxnChildren.push({ "a:cxn": { _attr: siteAttrs } });
|
|
2063
|
+
const ang = site.angle !== void 0 ? ` ang="${site.angle}"` : "";
|
|
2064
|
+
cxnParts.push(`<a:cxn pos="${site.x} ${site.y}"${ang}/>`);
|
|
2343
2065
|
}
|
|
2344
|
-
|
|
2066
|
+
parts.push(`<a:cxnLst>${cxnParts.join("")}</a:cxnLst>`);
|
|
2345
2067
|
}
|
|
2346
|
-
return {
|
|
2347
|
-
}
|
|
2348
|
-
toXml(context) {
|
|
2349
|
-
const obj = this.prepForXml(context);
|
|
2350
|
-
return obj ? xml(obj) : "";
|
|
2068
|
+
return `<p:spPr>${parts.join("")}</p:spPr>`;
|
|
2351
2069
|
}
|
|
2352
2070
|
};
|
|
2353
2071
|
//#endregion
|
|
2354
2072
|
//#region src/file/shape/shape.ts
|
|
2355
2073
|
init_xml_components();
|
|
2356
2074
|
/**
|
|
2357
|
-
* Pure function: builds p:ph element for placeholder.
|
|
2358
|
-
*/
|
|
2359
|
-
function buildPlaceholder(type, index) {
|
|
2360
|
-
const attrs = { type };
|
|
2361
|
-
if (index !== void 0) attrs.idx = index;
|
|
2362
|
-
return { "p:ph": { _attr: attrs } };
|
|
2363
|
-
}
|
|
2364
|
-
/**
|
|
2365
2075
|
* p:sp — A shape on a slide.
|
|
2366
|
-
* Lazy: stores options, builds XML
|
|
2076
|
+
* Lazy: stores options, builds XML in toXml().
|
|
2367
2077
|
*
|
|
2368
2078
|
* x/y/width/height accept pixel values and are internally converted to EMUs.
|
|
2369
2079
|
*/
|
|
@@ -2382,35 +2092,6 @@ var Shape = class Shape extends XmlComponent {
|
|
|
2382
2092
|
id
|
|
2383
2093
|
};
|
|
2384
2094
|
}
|
|
2385
|
-
prepForXml(context) {
|
|
2386
|
-
const opts = this.options;
|
|
2387
|
-
const id = this.shapeId;
|
|
2388
|
-
const name = opts.name ?? `Shape ${id}`;
|
|
2389
|
-
const children = [];
|
|
2390
|
-
const nvPrChildren = [];
|
|
2391
|
-
if (opts.placeholder) nvPrChildren.push(buildPlaceholder(opts.placeholder, opts.placeholderIndex));
|
|
2392
|
-
children.push({ "p:nvSpPr": [
|
|
2393
|
-
{ "p:cNvPr": { _attr: {
|
|
2394
|
-
id,
|
|
2395
|
-
name
|
|
2396
|
-
} } },
|
|
2397
|
-
{ "p:cNvSpPr": {} },
|
|
2398
|
-
{ "p:nvPr": nvPrChildren.length > 0 ? nvPrChildren : {} }
|
|
2399
|
-
] });
|
|
2400
|
-
const spPrObj = new ShapeProperties({
|
|
2401
|
-
...emuPositionOptional(opts),
|
|
2402
|
-
geometry: opts.geometry,
|
|
2403
|
-
fill: opts.fill,
|
|
2404
|
-
outline: opts.outline,
|
|
2405
|
-
effects: opts.effects,
|
|
2406
|
-
flipHorizontal: opts.flipHorizontal,
|
|
2407
|
-
rotation: opts.rotation
|
|
2408
|
-
}).prepForXml(context);
|
|
2409
|
-
if (spPrObj) children.push(spPrObj);
|
|
2410
|
-
const txBodyObj = new TextBody(opts.textBody ?? {}).prepForXml(context);
|
|
2411
|
-
if (txBodyObj) children.push(txBodyObj);
|
|
2412
|
-
return { "p:sp": children };
|
|
2413
|
-
}
|
|
2414
2095
|
toXml(context) {
|
|
2415
2096
|
const opts = this.options;
|
|
2416
2097
|
const id = this.shapeId;
|
|
@@ -2475,10 +2156,6 @@ var SmartArt = class extends XmlComponent {
|
|
|
2475
2156
|
color: this.colorId
|
|
2476
2157
|
});
|
|
2477
2158
|
}
|
|
2478
|
-
prepForXml(context) {
|
|
2479
|
-
this.registerSmartArt(context);
|
|
2480
|
-
return super.prepForXml(context);
|
|
2481
|
-
}
|
|
2482
2159
|
toXml(context) {
|
|
2483
2160
|
this.registerSmartArt(context);
|
|
2484
2161
|
return super.toXml(context);
|
|
@@ -2522,41 +2199,20 @@ var SmartArtGraphic = class extends XmlComponent {
|
|
|
2522
2199
|
var SmartArtGraphicData = class extends XmlComponent {
|
|
2523
2200
|
constructor(smartArtKey) {
|
|
2524
2201
|
super("a:graphicData");
|
|
2525
|
-
this.root.push(
|
|
2526
|
-
key: "uri",
|
|
2527
|
-
value: "http://schemas.openxmlformats.org/drawingml/2006/diagram"
|
|
2528
|
-
} }));
|
|
2202
|
+
this.root.push(buildAttrObject({ uri: "http://schemas.openxmlformats.org/drawingml/2006/diagram" }));
|
|
2529
2203
|
this.root.push(new DiagramRelIds(smartArtKey));
|
|
2530
2204
|
}
|
|
2531
2205
|
};
|
|
2532
2206
|
var DiagramRelIds = class extends XmlComponent {
|
|
2533
2207
|
constructor(smartArtKey) {
|
|
2534
2208
|
super("dgm:relIds");
|
|
2535
|
-
this.root.push(
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
}
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
value: "http://schemas.openxmlformats.org/officeDocument/2006/relationships"
|
|
2543
|
-
},
|
|
2544
|
-
rDm: {
|
|
2545
|
-
key: "r:dm",
|
|
2546
|
-
value: `{smartart:${smartArtKey}}`
|
|
2547
|
-
},
|
|
2548
|
-
rLo: {
|
|
2549
|
-
key: "r:lo",
|
|
2550
|
-
value: `{smartart-lo:${smartArtKey}}`
|
|
2551
|
-
},
|
|
2552
|
-
rQs: {
|
|
2553
|
-
key: "r:qs",
|
|
2554
|
-
value: `{smartart-qs:${smartArtKey}}`
|
|
2555
|
-
},
|
|
2556
|
-
rCs: {
|
|
2557
|
-
key: "r:cs",
|
|
2558
|
-
value: `{smartart-cs:${smartArtKey}}`
|
|
2559
|
-
}
|
|
2209
|
+
this.root.push(buildAttrObject({
|
|
2210
|
+
"xmlns:dgm": "http://schemas.openxmlformats.org/drawingml/2006/diagram",
|
|
2211
|
+
"xmlns:r": "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
|
|
2212
|
+
"r:dm": `{smartart:${smartArtKey}}`,
|
|
2213
|
+
"r:lo": `{smartart-lo:${smartArtKey}}`,
|
|
2214
|
+
"r:qs": `{smartart-qs:${smartArtKey}}`,
|
|
2215
|
+
"r:cs": `{smartart-cs:${smartArtKey}}`
|
|
2560
2216
|
}));
|
|
2561
2217
|
}
|
|
2562
2218
|
};
|
|
@@ -2565,7 +2221,7 @@ var DiagramRelIds = class extends XmlComponent {
|
|
|
2565
2221
|
init_xml_components();
|
|
2566
2222
|
/**
|
|
2567
2223
|
* a:graphic > a:graphicData — DrawingML graphic wrapper for table.
|
|
2568
|
-
* Lazy: stores table reference, builds
|
|
2224
|
+
* Lazy: stores table reference, builds XML in toXml().
|
|
2569
2225
|
*/
|
|
2570
2226
|
var Graphic = class extends BaseXmlComponent {
|
|
2571
2227
|
table;
|
|
@@ -2573,12 +2229,6 @@ var Graphic = class extends BaseXmlComponent {
|
|
|
2573
2229
|
super("a:graphic");
|
|
2574
2230
|
this.table = table;
|
|
2575
2231
|
}
|
|
2576
|
-
prepForXml(context) {
|
|
2577
|
-
const tableObj = this.table.prepForXml(context);
|
|
2578
|
-
const graphicDataChildren = [{ _attr: { uri: "http://schemas.openxmlformats.org/drawingml/2006/table" } }];
|
|
2579
|
-
if (tableObj) graphicDataChildren.push(tableObj);
|
|
2580
|
-
return { "a:graphic": [{ "a:graphicData": graphicDataChildren }] };
|
|
2581
|
-
}
|
|
2582
2232
|
toXml(context) {
|
|
2583
2233
|
return `<a:graphic><a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/table">${this.table.toXml(context)}</a:graphicData></a:graphic>`;
|
|
2584
2234
|
}
|
|
@@ -2625,7 +2275,7 @@ var GraphicFrameNonVisual = class GraphicFrameNonVisual extends XmlComponent {
|
|
|
2625
2275
|
init_xml_components();
|
|
2626
2276
|
/**
|
|
2627
2277
|
* a:tblGrid — Table grid with column width definitions.
|
|
2628
|
-
* Lazy: stores widths, builds
|
|
2278
|
+
* Lazy: stores widths, builds XML in toXml().
|
|
2629
2279
|
*/
|
|
2630
2280
|
var TableGrid = class extends BaseXmlComponent {
|
|
2631
2281
|
columnWidths;
|
|
@@ -2633,9 +2283,6 @@ var TableGrid = class extends BaseXmlComponent {
|
|
|
2633
2283
|
super("a:tblGrid");
|
|
2634
2284
|
this.columnWidths = columnWidths;
|
|
2635
2285
|
}
|
|
2636
|
-
prepForXml(_context) {
|
|
2637
|
-
return { "a:tblGrid": this.columnWidths.map((w) => ({ "a:gridCol": { _attr: { w } } })) };
|
|
2638
|
-
}
|
|
2639
2286
|
toXml(_context) {
|
|
2640
2287
|
return `<a:tblGrid>${this.columnWidths.map((w) => `<a:gridCol w="${w}"/>`).join("")}</a:tblGrid>`;
|
|
2641
2288
|
}
|
|
@@ -2645,7 +2292,7 @@ var TableGrid = class extends BaseXmlComponent {
|
|
|
2645
2292
|
init_xml_components();
|
|
2646
2293
|
/**
|
|
2647
2294
|
* a:tblPr — Table properties (firstRow, bandRow, etc.).
|
|
2648
|
-
* Lazy: stores options, builds
|
|
2295
|
+
* Lazy: stores options, builds XML in toXml().
|
|
2649
2296
|
*/
|
|
2650
2297
|
var TableProperties = class extends BaseXmlComponent {
|
|
2651
2298
|
options;
|
|
@@ -2653,18 +2300,6 @@ var TableProperties = class extends BaseXmlComponent {
|
|
|
2653
2300
|
super("a:tblPr");
|
|
2654
2301
|
this.options = options;
|
|
2655
2302
|
}
|
|
2656
|
-
prepForXml(_context) {
|
|
2657
|
-
if (!this.options) return { "a:tblPr": {} };
|
|
2658
|
-
const attrs = {};
|
|
2659
|
-
const opts = this.options;
|
|
2660
|
-
if (opts.firstRow !== void 0) attrs.firstRow = opts.firstRow ? 1 : 0;
|
|
2661
|
-
if (opts.lastRow !== void 0) attrs.lastRow = opts.lastRow ? 1 : 0;
|
|
2662
|
-
if (opts.bandRow !== void 0) attrs.bandRow = opts.bandRow ? 1 : 0;
|
|
2663
|
-
if (opts.firstCol !== void 0) attrs.firstCol = opts.firstCol ? 1 : 0;
|
|
2664
|
-
if (opts.lastCol !== void 0) attrs.lastCol = opts.lastCol ? 1 : 0;
|
|
2665
|
-
if (opts.bandCol !== void 0) attrs.bandCol = opts.bandCol ? 1 : 0;
|
|
2666
|
-
return { "a:tblPr": Object.keys(attrs).length > 0 ? { _attr: attrs } : {} };
|
|
2667
|
-
}
|
|
2668
2303
|
toXml(_context) {
|
|
2669
2304
|
if (!this.options) return "<a:tblPr/>";
|
|
2670
2305
|
const opts = this.options;
|
|
@@ -2683,7 +2318,7 @@ var TableProperties = class extends BaseXmlComponent {
|
|
|
2683
2318
|
init_xml_components();
|
|
2684
2319
|
/**
|
|
2685
2320
|
* a:tr — Table row containing cells.
|
|
2686
|
-
* Lazy: stores options, builds
|
|
2321
|
+
* Lazy: stores options, builds XML in toXml().
|
|
2687
2322
|
*/
|
|
2688
2323
|
var TableRow = class extends BaseXmlComponent {
|
|
2689
2324
|
options;
|
|
@@ -2691,15 +2326,6 @@ var TableRow = class extends BaseXmlComponent {
|
|
|
2691
2326
|
super("a:tr");
|
|
2692
2327
|
this.options = options;
|
|
2693
2328
|
}
|
|
2694
|
-
prepForXml(context) {
|
|
2695
|
-
const children = [];
|
|
2696
|
-
children.push({ _attr: { h: this.options.height ?? 0 } });
|
|
2697
|
-
for (const cell of this.options.cells) {
|
|
2698
|
-
const obj = new TableCell(cell).prepForXml(context);
|
|
2699
|
-
if (obj) children.push(obj);
|
|
2700
|
-
}
|
|
2701
|
-
return { "a:tr": children };
|
|
2702
|
-
}
|
|
2703
2329
|
toXml(context) {
|
|
2704
2330
|
const h = this.options.height ?? 0;
|
|
2705
2331
|
const parts = [];
|
|
@@ -2712,7 +2338,7 @@ var TableRow = class extends BaseXmlComponent {
|
|
|
2712
2338
|
init_xml_components();
|
|
2713
2339
|
/**
|
|
2714
2340
|
* a:tbl — DrawingML table element.
|
|
2715
|
-
* Lazy: stores options, builds
|
|
2341
|
+
* Lazy: stores options, builds XML in toXml().
|
|
2716
2342
|
*/
|
|
2717
2343
|
var DrawingTable = class extends BaseXmlComponent {
|
|
2718
2344
|
options;
|
|
@@ -2720,44 +2346,6 @@ var DrawingTable = class extends BaseXmlComponent {
|
|
|
2720
2346
|
super("a:tbl");
|
|
2721
2347
|
this.options = options;
|
|
2722
2348
|
}
|
|
2723
|
-
prepForXml(context) {
|
|
2724
|
-
const opts = this.options;
|
|
2725
|
-
const children = [];
|
|
2726
|
-
const tblPrObj = new TableProperties({
|
|
2727
|
-
firstRow: opts.firstRow,
|
|
2728
|
-
lastRow: opts.lastRow,
|
|
2729
|
-
bandRow: opts.bandRow,
|
|
2730
|
-
firstCol: opts.firstCol,
|
|
2731
|
-
lastCol: opts.lastCol,
|
|
2732
|
-
bandCol: opts.bandCol
|
|
2733
|
-
}).prepForXml(context);
|
|
2734
|
-
if (tblPrObj) children.push(tblPrObj);
|
|
2735
|
-
const gridObj = new TableGrid(opts.columnWidths && opts.columnWidths.length > 0 ? [...opts.columnWidths] : Array.from({ length: opts.rows[0]?.cells.length ?? 1 }, () => 0)).prepForXml(context);
|
|
2736
|
-
if (gridObj) children.push(gridObj);
|
|
2737
|
-
const tb = opts.borders;
|
|
2738
|
-
const rowCount = opts.rows.length;
|
|
2739
|
-
for (let ri = 0; ri < rowCount; ri++) {
|
|
2740
|
-
const row = opts.rows[ri];
|
|
2741
|
-
const colCount = row.cells.length;
|
|
2742
|
-
const cells = tb ? row.cells.map((cell, ci) => {
|
|
2743
|
-
const b = { ...cell.borders };
|
|
2744
|
-
if (ri === 0 && tb.top && !b.top) b.top = tb.top;
|
|
2745
|
-
if (ri === rowCount - 1 && tb.bottom && !b.bottom) b.bottom = tb.bottom;
|
|
2746
|
-
if (ci === 0 && tb.left && !b.left) b.left = tb.left;
|
|
2747
|
-
if (ci === colCount - 1 && tb.right && !b.right) b.right = tb.right;
|
|
2748
|
-
return Object.keys(b).length === 0 ? cell : {
|
|
2749
|
-
...cell,
|
|
2750
|
-
borders: b
|
|
2751
|
-
};
|
|
2752
|
-
}) : row.cells;
|
|
2753
|
-
const trObj = new TableRow({
|
|
2754
|
-
...row,
|
|
2755
|
-
cells
|
|
2756
|
-
}).prepForXml(context);
|
|
2757
|
-
if (trObj) children.push(trObj);
|
|
2758
|
-
}
|
|
2759
|
-
return { "a:tbl": children };
|
|
2760
|
-
}
|
|
2761
2349
|
toXml(context) {
|
|
2762
2350
|
const opts = this.options;
|
|
2763
2351
|
const parts = [];
|
|
@@ -2770,24 +2358,12 @@ var DrawingTable = class extends BaseXmlComponent {
|
|
|
2770
2358
|
bandCol: opts.bandCol
|
|
2771
2359
|
});
|
|
2772
2360
|
parts.push(tblPr.toXml(context));
|
|
2773
|
-
const colWidths = opts.columnWidths && opts.columnWidths.length > 0 ?
|
|
2361
|
+
const colWidths = opts.columnWidths && opts.columnWidths.length > 0 ? opts.columnWidths : Array.from({ length: opts.rows[0]?.cells.length ?? 1 }, () => 0);
|
|
2774
2362
|
parts.push(new TableGrid(colWidths).toXml(context));
|
|
2775
|
-
const tb = opts.borders;
|
|
2776
2363
|
const rowCount = opts.rows.length;
|
|
2777
2364
|
for (let ri = 0; ri < rowCount; ri++) {
|
|
2778
2365
|
const row = opts.rows[ri];
|
|
2779
|
-
const
|
|
2780
|
-
const cells = tb ? row.cells.map((cell, ci) => {
|
|
2781
|
-
const b = { ...cell.borders };
|
|
2782
|
-
if (ri === 0 && tb.top && !b.top) b.top = tb.top;
|
|
2783
|
-
if (ri === rowCount - 1 && tb.bottom && !b.bottom) b.bottom = tb.bottom;
|
|
2784
|
-
if (ci === 0 && tb.left && !b.left) b.left = tb.left;
|
|
2785
|
-
if (ci === colCount - 1 && tb.right && !b.right) b.right = tb.right;
|
|
2786
|
-
return Object.keys(b).length === 0 ? cell : {
|
|
2787
|
-
...cell,
|
|
2788
|
-
borders: b
|
|
2789
|
-
};
|
|
2790
|
-
}) : row.cells;
|
|
2366
|
+
const cells = this.distributeBorders(row, ri, rowCount, opts.borders);
|
|
2791
2367
|
parts.push(new TableRow({
|
|
2792
2368
|
...row,
|
|
2793
2369
|
cells
|
|
@@ -2795,6 +2371,29 @@ var DrawingTable = class extends BaseXmlComponent {
|
|
|
2795
2371
|
}
|
|
2796
2372
|
return `<a:tbl>${parts.join("")}</a:tbl>`;
|
|
2797
2373
|
}
|
|
2374
|
+
/** Distribute table-level borders to edge cells only when needed. */
|
|
2375
|
+
distributeBorders(row, ri, rowCount, tb) {
|
|
2376
|
+
if (!tb) return row.cells;
|
|
2377
|
+
const colCount = row.cells.length;
|
|
2378
|
+
return row.cells.map((cell, ci) => {
|
|
2379
|
+
const needTop = ri === 0 && !!tb.top && !cell.borders?.top;
|
|
2380
|
+
const needBottom = ri === rowCount - 1 && !!tb.bottom && !cell.borders?.bottom;
|
|
2381
|
+
const needLeft = ci === 0 && !!tb.left && !cell.borders?.left;
|
|
2382
|
+
const needRight = ci === colCount - 1 && !!tb.right && !cell.borders?.right;
|
|
2383
|
+
if (!needTop && !needBottom && !needLeft && !needRight) return cell;
|
|
2384
|
+
const borders = {
|
|
2385
|
+
...cell.borders,
|
|
2386
|
+
...needTop && { top: tb.top },
|
|
2387
|
+
...needBottom && { bottom: tb.bottom },
|
|
2388
|
+
...needLeft && { left: tb.left },
|
|
2389
|
+
...needRight && { right: tb.right }
|
|
2390
|
+
};
|
|
2391
|
+
return {
|
|
2392
|
+
...cell,
|
|
2393
|
+
borders
|
|
2394
|
+
};
|
|
2395
|
+
});
|
|
2396
|
+
}
|
|
2798
2397
|
};
|
|
2799
2398
|
//#endregion
|
|
2800
2399
|
//#region src/file/table/table-frame.ts
|
|
@@ -2990,8 +2589,8 @@ function buildChildrenXml$1(children) {
|
|
|
2990
2589
|
const ctx = { stack: [] };
|
|
2991
2590
|
let result = "";
|
|
2992
2591
|
for (const child of children) {
|
|
2993
|
-
const
|
|
2994
|
-
if (
|
|
2592
|
+
const xmlStr = coerceMasterChild(child).toXml(ctx);
|
|
2593
|
+
if (xmlStr) result += xmlStr;
|
|
2995
2594
|
}
|
|
2996
2595
|
return result;
|
|
2997
2596
|
}
|
|
@@ -3052,8 +2651,8 @@ var SlideLayout = class SlideLayout extends ImportedXmlComponent {
|
|
|
3052
2651
|
if (!SlideLayout.cache.has(this.cacheKey)) SlideLayout.cache.set(this.cacheKey, ImportedXmlComponent.fromXmlString(buildLayoutXml(layoutType, slideWidth)));
|
|
3053
2652
|
}
|
|
3054
2653
|
}
|
|
3055
|
-
|
|
3056
|
-
return SlideLayout.cache.get(this.cacheKey).
|
|
2654
|
+
toXml(context) {
|
|
2655
|
+
return SlideLayout.cache.get(this.cacheKey).toXml(context);
|
|
3057
2656
|
}
|
|
3058
2657
|
};
|
|
3059
2658
|
var DefaultSlideLayout = class extends SlideLayout {
|
|
@@ -3119,17 +2718,15 @@ function footerBody(algn, fldType, fldId, fldText) {
|
|
|
3119
2718
|
function buildBackgroundXml(bg) {
|
|
3120
2719
|
if (!bg) return `<p:bgRef idx="1001"><a:schemeClr val="bg1"/></p:bgRef>`;
|
|
3121
2720
|
const { Background } = (init_background(), __toCommonJS(background_exports));
|
|
3122
|
-
|
|
3123
|
-
if (!obj) return `<p:bgRef idx="1001"><a:schemeClr val="bg1"/></p:bgRef>`;
|
|
3124
|
-
return xml(obj).replace(/^<p:bg[^>]*>/, "").replace(/<\/p:bg>$/, "");
|
|
2721
|
+
return new Background(bg).toXml({ stack: [] }).replace(/^<p:bg[^>]*>/, "").replace(/<\/p:bg>$/, "");
|
|
3125
2722
|
}
|
|
3126
2723
|
function buildChildrenXml(children) {
|
|
3127
2724
|
if (!children || children.length === 0) return "";
|
|
3128
2725
|
const ctx = { stack: [] };
|
|
3129
2726
|
let result = "";
|
|
3130
2727
|
for (const child of children) {
|
|
3131
|
-
const
|
|
3132
|
-
if (
|
|
2728
|
+
const xmlStr = coerceMasterChild(child).toXml(ctx);
|
|
2729
|
+
if (xmlStr) result += xmlStr;
|
|
3133
2730
|
}
|
|
3134
2731
|
return result;
|
|
3135
2732
|
}
|
|
@@ -3172,8 +2769,8 @@ var DefaultSlideMaster = class DefaultSlideMaster extends ImportedXmlComponent {
|
|
|
3172
2769
|
this.cacheKey = `${layoutCount}:${masterOptions ? JSON.stringify(masterOptions) : ""}:${slideWidth}:${masterIndex}`;
|
|
3173
2770
|
if (!DefaultSlideMaster.cache.has(this.cacheKey)) DefaultSlideMaster.cache.set(this.cacheKey, ImportedXmlComponent.fromXmlString(buildSlideMasterXml(layoutCount, headerFooter, masterOptions, slideWidth, masterIndex)));
|
|
3174
2771
|
}
|
|
3175
|
-
|
|
3176
|
-
return DefaultSlideMaster.cache.get(this.cacheKey).
|
|
2772
|
+
toXml(context) {
|
|
2773
|
+
return DefaultSlideMaster.cache.get(this.cacheKey).toXml(context);
|
|
3177
2774
|
}
|
|
3178
2775
|
};
|
|
3179
2776
|
//#endregion
|
|
@@ -4258,33 +3855,33 @@ const DIRECTION_MAP = {
|
|
|
4258
3855
|
in: "in"
|
|
4259
3856
|
};
|
|
4260
3857
|
function buildTransitionElement(type, direction, orient, thruBlk, spokes) {
|
|
4261
|
-
const attrs = {};
|
|
4262
3858
|
const dir = direction ? DIRECTION_MAP[direction] : void 0;
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
else if (
|
|
4266
|
-
else if (type
|
|
4267
|
-
else if (
|
|
4268
|
-
else if (type === "
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
return { [`p:${type}`]: Object.keys(attrs).length > 0 ? { _attr: attrs } : {} };
|
|
3859
|
+
const attrs = [];
|
|
3860
|
+
if (ORIENT_TYPES.has(type) && dir) attrs.push(`dir="${dir}"`);
|
|
3861
|
+
else if (SIDE_DIR_TYPES.has(type) && dir) attrs.push(`dir="${dir}"`);
|
|
3862
|
+
else if (EIGHT_DIR_TYPES.has(type) && dir) attrs.push(`dir="${dir}"`);
|
|
3863
|
+
else if (type === "strips" && dir) attrs.push(`dir="${dir}"`);
|
|
3864
|
+
else if ((type === "fade" || type === "cut") && thruBlk !== void 0) attrs.push(`thruBlk="${thruBlk ? 1 : 0}"`);
|
|
3865
|
+
else if (type === "split") attrs.push(`orient="${orient ?? "horz"}"`, `dir="${dir ?? "out"}"`);
|
|
3866
|
+
else if (type === "wheel") attrs.push(`spokes="${spokes ?? 4}"`);
|
|
3867
|
+
else if (type === "zoom" && dir) attrs.push(`dir="${dir}"`);
|
|
3868
|
+
return attrs.length > 0 ? `<p:${type} ${attrs.join(" ")}/>` : `<p:${type}/>`;
|
|
4274
3869
|
}
|
|
4275
3870
|
function buildTransition(options) {
|
|
3871
|
+
const attrParts = [];
|
|
3872
|
+
if (options.speed) attrParts.push(`spd="${options.speed}"`);
|
|
3873
|
+
if (options.advanceOnClick !== void 0) attrParts.push(`advClick="${options.advanceOnClick ? 1 : 0}"`);
|
|
3874
|
+
if (options.advanceAfterTime !== void 0) attrParts.push(`advTm="${options.advanceAfterTime}"`);
|
|
4276
3875
|
const children = [];
|
|
4277
|
-
const attrs = {};
|
|
4278
|
-
if (options.speed) attrs.spd = options.speed;
|
|
4279
|
-
if (options.advanceOnClick !== void 0) attrs.advClick = options.advanceOnClick ? 1 : 0;
|
|
4280
|
-
if (options.advanceAfterTime !== void 0) attrs.advTm = options.advanceAfterTime;
|
|
4281
|
-
if (Object.keys(attrs).length > 0) children.push({ _attr: attrs });
|
|
4282
3876
|
if (options.type) children.push(buildTransitionElement(options.type, options.direction, options.orient, options.thruBlk, options.spokes));
|
|
4283
|
-
|
|
3877
|
+
if (attrParts.length === 0 && children.length === 0) return "<p:transition/>";
|
|
3878
|
+
const attrStr = attrParts.length > 0 ? ` ${attrParts.join(" ")}` : "";
|
|
3879
|
+
if (children.length === 0) return `<p:transition${attrStr}/>`;
|
|
3880
|
+
return `<p:transition${attrStr}>${children.join("")}</p:transition>`;
|
|
4284
3881
|
}
|
|
4285
3882
|
/**
|
|
4286
3883
|
* p:transition — Slide transition effect.
|
|
4287
|
-
* Lazy: stores options, builds XML
|
|
3884
|
+
* Lazy: stores options, builds XML in toXml.
|
|
4288
3885
|
*/
|
|
4289
3886
|
var Transition = class extends BaseXmlComponent {
|
|
4290
3887
|
options;
|
|
@@ -4292,7 +3889,7 @@ var Transition = class extends BaseXmlComponent {
|
|
|
4292
3889
|
super("p:transition");
|
|
4293
3890
|
this.options = options;
|
|
4294
3891
|
}
|
|
4295
|
-
|
|
3892
|
+
toXml(_context) {
|
|
4296
3893
|
return buildTransition(this.options);
|
|
4297
3894
|
}
|
|
4298
3895
|
};
|
|
@@ -4315,7 +3912,7 @@ function collectAnimations(children) {
|
|
|
4315
3912
|
}
|
|
4316
3913
|
/**
|
|
4317
3914
|
* p:sld — A slide in a presentation.
|
|
4318
|
-
* Lazy: stores options, builds XML
|
|
3915
|
+
* Lazy: stores options, builds XML in toXml().
|
|
4319
3916
|
*/
|
|
4320
3917
|
var Slide = class extends XmlComponent {
|
|
4321
3918
|
children;
|
|
@@ -4329,70 +3926,11 @@ var Slide = class extends XmlComponent {
|
|
|
4329
3926
|
this.transition = transition;
|
|
4330
3927
|
this.HeaderFooter = headerFooter;
|
|
4331
3928
|
}
|
|
4332
|
-
prepForXml(context) {
|
|
4333
|
-
const children = [];
|
|
4334
|
-
children.push({ _attr: {
|
|
4335
|
-
"xmlns:a": "http://schemas.openxmlformats.org/drawingml/2006/main",
|
|
4336
|
-
"xmlns:r": "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
|
|
4337
|
-
"xmlns:p": "http://schemas.openxmlformats.org/presentationml/2006/main"
|
|
4338
|
-
} });
|
|
4339
|
-
const cSldChildren = [];
|
|
4340
|
-
if (this.background) {
|
|
4341
|
-
const bgObj = this.background.prepForXml(context);
|
|
4342
|
-
if (bgObj) cSldChildren.push(bgObj);
|
|
4343
|
-
}
|
|
4344
|
-
const spTreeChildren = [{ "p:nvGrpSpPr": [
|
|
4345
|
-
{ "p:cNvPr": { _attr: {
|
|
4346
|
-
id: 1,
|
|
4347
|
-
name: ""
|
|
4348
|
-
} } },
|
|
4349
|
-
{ "p:cNvGrpSpPr": {} },
|
|
4350
|
-
{ "p:nvPr": {} }
|
|
4351
|
-
] }, { "p:grpSpPr": [{ "a:xfrm": [
|
|
4352
|
-
{ "a:off": { _attr: {
|
|
4353
|
-
x: 0,
|
|
4354
|
-
y: 0
|
|
4355
|
-
} } },
|
|
4356
|
-
{ "a:ext": { _attr: {
|
|
4357
|
-
cx: 0,
|
|
4358
|
-
cy: 0
|
|
4359
|
-
} } },
|
|
4360
|
-
{ "a:chOff": { _attr: {
|
|
4361
|
-
x: 0,
|
|
4362
|
-
y: 0
|
|
4363
|
-
} } },
|
|
4364
|
-
{ "a:chExt": { _attr: {
|
|
4365
|
-
cx: 0,
|
|
4366
|
-
cy: 0
|
|
4367
|
-
} } }
|
|
4368
|
-
] }] }];
|
|
4369
|
-
const coercedChildren = this.children.map(coerceChild);
|
|
4370
|
-
for (const child of coercedChildren) {
|
|
4371
|
-
const obj = child.prepForXml(context);
|
|
4372
|
-
if (obj) spTreeChildren.push(obj);
|
|
4373
|
-
}
|
|
4374
|
-
cSldChildren.push({ "p:spTree": spTreeChildren });
|
|
4375
|
-
children.push({ "p:cSld": cSldChildren });
|
|
4376
|
-
children.push({ "p:clrMapOvr": [{ "a:masterClrMapping": {} }] });
|
|
4377
|
-
if (this.transition) {
|
|
4378
|
-
const transObj = buildTransition(this.transition);
|
|
4379
|
-
if (transObj) children.push(transObj);
|
|
4380
|
-
}
|
|
4381
|
-
const animations = collectAnimations(coercedChildren);
|
|
4382
|
-
if (animations.length > 0) {
|
|
4383
|
-
const timingObj = new SlideTiming(animations).prepForXml(context);
|
|
4384
|
-
if (timingObj) children.push(timingObj);
|
|
4385
|
-
}
|
|
4386
|
-
return { "p:sld": children };
|
|
4387
|
-
}
|
|
4388
3929
|
toXml(context) {
|
|
4389
3930
|
const parts = [];
|
|
4390
3931
|
parts.push("<p:sld xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:p=\"http://schemas.openxmlformats.org/presentationml/2006/main\">");
|
|
4391
3932
|
parts.push("<p:cSld>");
|
|
4392
|
-
if (this.background)
|
|
4393
|
-
const bgObj = this.background.prepForXml(context);
|
|
4394
|
-
if (bgObj) parts.push(xml(bgObj));
|
|
4395
|
-
}
|
|
3933
|
+
if (this.background) parts.push(this.background.toXml(context));
|
|
4396
3934
|
parts.push("<p:spTree>");
|
|
4397
3935
|
parts.push("<p:nvGrpSpPr><p:cNvPr id=\"1\" name=\"\"/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr>");
|
|
4398
3936
|
parts.push("<p:grpSpPr><a:xfrm><a:off x=\"0\" y=\"0\"/><a:ext cx=\"0\" cy=\"0\"/><a:chOff x=\"0\" y=\"0\"/><a:chExt cx=\"0\" cy=\"0\"/></a:xfrm></p:grpSpPr>");
|
|
@@ -4404,14 +3942,11 @@ var Slide = class extends XmlComponent {
|
|
|
4404
3942
|
parts.push("</p:spTree>");
|
|
4405
3943
|
parts.push("</p:cSld>");
|
|
4406
3944
|
parts.push("<p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr>");
|
|
4407
|
-
if (this.transition)
|
|
4408
|
-
const transObj = buildTransition(this.transition);
|
|
4409
|
-
if (transObj) parts.push(xml(transObj));
|
|
4410
|
-
}
|
|
3945
|
+
if (this.transition) parts.push(buildTransition(this.transition));
|
|
4411
3946
|
const animations = collectAnimations(coercedChildren);
|
|
4412
3947
|
if (animations.length > 0) {
|
|
4413
|
-
const
|
|
4414
|
-
|
|
3948
|
+
const timing = new SlideTiming(animations);
|
|
3949
|
+
parts.push(timing.toXml(context));
|
|
4415
3950
|
}
|
|
4416
3951
|
parts.push("</p:sld>");
|
|
4417
3952
|
return parts.join("");
|
|
@@ -4426,8 +3961,8 @@ var TableStyles = class TableStyles extends ImportedXmlComponent {
|
|
|
4426
3961
|
constructor() {
|
|
4427
3962
|
super("a:tblStyleLst");
|
|
4428
3963
|
}
|
|
4429
|
-
|
|
4430
|
-
return TableStyles.instance.
|
|
3964
|
+
toXml(context) {
|
|
3965
|
+
return TableStyles.instance.toXml(context);
|
|
4431
3966
|
}
|
|
4432
3967
|
};
|
|
4433
3968
|
//#endregion
|
|
@@ -4521,9 +4056,6 @@ var DefaultTheme = class DefaultTheme extends ImportedXmlComponent {
|
|
|
4521
4056
|
this.cacheKey = options ? themeKey(options) : "";
|
|
4522
4057
|
if (!DefaultTheme.cache.has(this.cacheKey)) DefaultTheme.cache.set(this.cacheKey, ImportedXmlComponent.fromXmlString(buildThemeXml(options)));
|
|
4523
4058
|
}
|
|
4524
|
-
prepForXml() {
|
|
4525
|
-
return DefaultTheme.cache.get(this.cacheKey).prepForXml({ stack: [] });
|
|
4526
|
-
}
|
|
4527
4059
|
toXml(context) {
|
|
4528
4060
|
return DefaultTheme.cache.get(this.cacheKey).toXml(context);
|
|
4529
4061
|
}
|
|
@@ -4563,8 +4095,8 @@ var ViewProperties = class ViewProperties extends ImportedXmlComponent {
|
|
|
4563
4095
|
constructor() {
|
|
4564
4096
|
super("p:viewPr");
|
|
4565
4097
|
}
|
|
4566
|
-
|
|
4567
|
-
return ViewProperties.instance.
|
|
4098
|
+
toXml(context) {
|
|
4099
|
+
return ViewProperties.instance.toXml(context);
|
|
4568
4100
|
}
|
|
4569
4101
|
};
|
|
4570
4102
|
//#endregion
|
|
@@ -4925,6 +4457,23 @@ var Text = class extends XmlComponent {
|
|
|
4925
4457
|
}
|
|
4926
4458
|
};
|
|
4927
4459
|
//#endregion
|
|
4460
|
+
//#region src/file/shape/paragraph/end-paragraph-run.ts
|
|
4461
|
+
init_xml_components();
|
|
4462
|
+
/**
|
|
4463
|
+
* a:endParaRPr — End paragraph run properties.
|
|
4464
|
+
* Lazy: stores lang, builds XML in toXml().
|
|
4465
|
+
*/
|
|
4466
|
+
var EndParagraphRunProperties = class extends BuilderElement {
|
|
4467
|
+
lang;
|
|
4468
|
+
constructor(lang = "en-US") {
|
|
4469
|
+
super({ name: "a:endParaRPr" });
|
|
4470
|
+
this.lang = lang;
|
|
4471
|
+
}
|
|
4472
|
+
toXml(_context) {
|
|
4473
|
+
return `<a:endParaRPr lang="${this.lang}"/>`;
|
|
4474
|
+
}
|
|
4475
|
+
};
|
|
4476
|
+
//#endregion
|
|
4928
4477
|
//#region src/file/shape/paragraph/field.ts
|
|
4929
4478
|
init_xml_components();
|
|
4930
4479
|
/**
|
|
@@ -4935,15 +4484,9 @@ init_xml_components();
|
|
|
4935
4484
|
var Field = class extends XmlComponent {
|
|
4936
4485
|
constructor(fieldType, displayText) {
|
|
4937
4486
|
super("a:fld");
|
|
4938
|
-
this.root.push(
|
|
4939
|
-
id: {
|
|
4940
|
-
|
|
4941
|
-
value: `{${crypto.randomUUID()}}`
|
|
4942
|
-
},
|
|
4943
|
-
type: {
|
|
4944
|
-
key: "type",
|
|
4945
|
-
value: fieldType
|
|
4946
|
-
}
|
|
4487
|
+
this.root.push(buildAttrObject({
|
|
4488
|
+
id: `{${crypto.randomUUID()}}`,
|
|
4489
|
+
type: fieldType
|
|
4947
4490
|
}));
|
|
4948
4491
|
this.root.push(new BuilderElement({
|
|
4949
4492
|
name: "a:rPr",
|
|
@@ -5047,8 +4590,8 @@ var DefaultNotesMaster = class DefaultNotesMaster extends ImportedXmlComponent {
|
|
|
5047
4590
|
constructor() {
|
|
5048
4591
|
super("p:notesMaster");
|
|
5049
4592
|
}
|
|
5050
|
-
|
|
5051
|
-
return DefaultNotesMaster.instance.
|
|
4593
|
+
toXml(context) {
|
|
4594
|
+
return DefaultNotesMaster.instance.toXml(context);
|
|
5052
4595
|
}
|
|
5053
4596
|
};
|
|
5054
4597
|
//#endregion
|
|
@@ -5064,23 +4607,11 @@ var HeaderFooter = class extends XmlComponent {
|
|
|
5064
4607
|
constructor(options = {}) {
|
|
5065
4608
|
super("p:hf");
|
|
5066
4609
|
const attrs = {};
|
|
5067
|
-
if (options.slideNumber !== false) attrs.sldNum =
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
if (
|
|
5072
|
-
key: "dt",
|
|
5073
|
-
value: 1
|
|
5074
|
-
};
|
|
5075
|
-
if (options.header === true) attrs.hdr = {
|
|
5076
|
-
key: "hdr",
|
|
5077
|
-
value: 1
|
|
5078
|
-
};
|
|
5079
|
-
if (options.footer !== false && options.footer !== void 0) attrs.ftr = {
|
|
5080
|
-
key: "ftr",
|
|
5081
|
-
value: 1
|
|
5082
|
-
};
|
|
5083
|
-
if (Object.keys(attrs).length > 0) this.root.push(new NextAttributeComponent(attrs));
|
|
4610
|
+
if (options.slideNumber !== false) attrs.sldNum = 1;
|
|
4611
|
+
if (options.dateTime !== false) attrs.dt = 1;
|
|
4612
|
+
if (options.header === true) attrs.hdr = 1;
|
|
4613
|
+
if (options.footer !== false && options.footer !== void 0) attrs.ftr = 1;
|
|
4614
|
+
if (Object.keys(attrs).length > 0) this.root.push(buildAttrObject(attrs));
|
|
5084
4615
|
if (typeof options.footer === "string") this.root.push(new BuilderElement({
|
|
5085
4616
|
name: "p:ftr",
|
|
5086
4617
|
children: [new BuilderElement({
|
|
@@ -5116,7 +4647,7 @@ init_background();
|
|
|
5116
4647
|
function replaceHyperlinkPlaceholders(xml, hyperlinks, offset) {
|
|
5117
4648
|
let result = xml;
|
|
5118
4649
|
hyperlinks.forEach((h, i) => {
|
|
5119
|
-
result = result.
|
|
4650
|
+
result = result.replaceAll(`{hlink:${h.key}}`, formatId(offset, i, "rId"));
|
|
5120
4651
|
});
|
|
5121
4652
|
return result;
|
|
5122
4653
|
}
|
|
@@ -5125,27 +4656,33 @@ function replaceHyperlinkPlaceholders(xml, hyperlinks, offset) {
|
|
|
5125
4656
|
function replaceMediaPlaceholders(xml, mediaData, offset) {
|
|
5126
4657
|
let result = xml;
|
|
5127
4658
|
mediaData.forEach((m, i) => {
|
|
5128
|
-
result = result.
|
|
4659
|
+
result = result.replaceAll(`{media:${m.fileName}}`, formatId(offset, i, "rId"));
|
|
5129
4660
|
});
|
|
5130
4661
|
return result;
|
|
5131
4662
|
}
|
|
5132
4663
|
function replaceVideoPlaceholders(xml, mediaData, offset) {
|
|
5133
4664
|
let result = xml;
|
|
5134
4665
|
mediaData.forEach((m, i) => {
|
|
5135
|
-
result = result.
|
|
4666
|
+
result = result.replaceAll(`{video:${m.fileName}}`, formatId(offset, i, "rId"));
|
|
5136
4667
|
});
|
|
5137
4668
|
return result;
|
|
5138
4669
|
}
|
|
5139
4670
|
function getMediaRefs(xml, mediaArray) {
|
|
5140
|
-
return collectRefs(xml, "media:", mediaArray);
|
|
4671
|
+
return collectRefs(xml, "{media:", mediaArray);
|
|
5141
4672
|
}
|
|
5142
4673
|
function getVideoRefs(xml, mediaArray) {
|
|
5143
|
-
return collectRefs(xml, "video:", mediaArray);
|
|
4674
|
+
return collectRefs(xml, "{video:", mediaArray);
|
|
5144
4675
|
}
|
|
5145
|
-
function collectRefs(xml,
|
|
5146
|
-
const pattern = new RegExp(`\\{${escapeRegex(prefix)}([^}]+)\\}`, "g");
|
|
4676
|
+
function collectRefs(xml, search, mediaArray) {
|
|
5147
4677
|
const keys = /* @__PURE__ */ new Set();
|
|
5148
|
-
|
|
4678
|
+
let pos = 0;
|
|
4679
|
+
while ((pos = xml.indexOf(search, pos)) !== -1) {
|
|
4680
|
+
const keyStart = pos + search.length;
|
|
4681
|
+
const keyEnd = xml.indexOf("}", keyStart);
|
|
4682
|
+
if (keyEnd === -1) break;
|
|
4683
|
+
keys.add(xml.substring(keyStart, keyEnd));
|
|
4684
|
+
pos = keyEnd + 1;
|
|
4685
|
+
}
|
|
5149
4686
|
return mediaArray.filter((m) => keys.has(m.fileName));
|
|
5150
4687
|
}
|
|
5151
4688
|
//#endregion
|
|
@@ -5155,18 +4692,17 @@ const encoder$1 = new TextEncoder();
|
|
|
5155
4692
|
var Compiler = class {
|
|
5156
4693
|
formatter = new Formatter$1();
|
|
5157
4694
|
compile(file, overrides = []) {
|
|
5158
|
-
const declaration = true;
|
|
5159
4695
|
const context = {
|
|
5160
4696
|
fileData: file,
|
|
5161
4697
|
stack: []
|
|
5162
4698
|
};
|
|
5163
4699
|
const mapping = {
|
|
5164
4700
|
AppProperties: {
|
|
5165
|
-
data: this.formatter.formatToXml(file.appProperties, context
|
|
4701
|
+
data: this.formatter.formatToXml(file.appProperties, context),
|
|
5166
4702
|
path: "docProps/app.xml"
|
|
5167
4703
|
},
|
|
5168
4704
|
Properties: {
|
|
5169
|
-
data: this.formatter.formatToXml(file.coreProperties, context
|
|
4705
|
+
data: this.formatter.formatToXml(file.coreProperties, context),
|
|
5170
4706
|
path: "docProps/core.xml"
|
|
5171
4707
|
},
|
|
5172
4708
|
FileRelationships: {
|
|
@@ -5176,26 +4712,26 @@ var Compiler = class {
|
|
|
5176
4712
|
};
|
|
5177
4713
|
const themes = file.themes;
|
|
5178
4714
|
for (let ti = 0; ti < themes.length; ti++) mapping[`Theme${ti}`] = {
|
|
5179
|
-
data: this.formatter.formatToXml(themes[ti], context
|
|
4715
|
+
data: this.formatter.formatToXml(themes[ti], context),
|
|
5180
4716
|
path: `ppt/theme/theme${ti + 1}.xml`
|
|
5181
4717
|
};
|
|
5182
4718
|
mapping["TableStyles"] = {
|
|
5183
|
-
data: this.formatter.formatToXml(file.tableStyles, context
|
|
4719
|
+
data: this.formatter.formatToXml(file.tableStyles, context),
|
|
5184
4720
|
path: "ppt/tableStyles.xml"
|
|
5185
4721
|
};
|
|
5186
4722
|
mapping["PresProps"] = {
|
|
5187
|
-
data: this.formatter.formatToXml(file.presProps, context
|
|
4723
|
+
data: this.formatter.formatToXml(file.presProps, context),
|
|
5188
4724
|
path: "ppt/presProps.xml"
|
|
5189
4725
|
};
|
|
5190
4726
|
mapping["ViewProps"] = {
|
|
5191
|
-
data: this.formatter.formatToXml(file.viewProps, context
|
|
4727
|
+
data: this.formatter.formatToXml(file.viewProps, context),
|
|
5192
4728
|
path: "ppt/viewProps.xml"
|
|
5193
4729
|
};
|
|
5194
4730
|
const masters = file.slideMasters;
|
|
5195
4731
|
const masterRels = file.slideMasterRelsArray;
|
|
5196
4732
|
for (let mi = 0; mi < masters.length; mi++) {
|
|
5197
4733
|
mapping[`SlideMaster${mi}`] = {
|
|
5198
|
-
data: this.formatter.formatToXml(masters[mi], context
|
|
4734
|
+
data: this.formatter.formatToXml(masters[mi], context),
|
|
5199
4735
|
path: `ppt/slideMasters/slideMaster${mi + 1}.xml`
|
|
5200
4736
|
};
|
|
5201
4737
|
mapping[`SlideMasterRels${mi}`] = {
|
|
@@ -5207,7 +4743,7 @@ var Compiler = class {
|
|
|
5207
4743
|
const layoutRels = file.allLayoutRelsArray;
|
|
5208
4744
|
for (let li = 0; li < layouts.length; li++) {
|
|
5209
4745
|
mapping[`SlideLayout${li}`] = {
|
|
5210
|
-
data: this.formatter.formatToXml(layouts[li].layout, context
|
|
4746
|
+
data: this.formatter.formatToXml(layouts[li].layout, context),
|
|
5211
4747
|
path: `ppt/slideLayouts/slideLayout${li + 1}.xml`
|
|
5212
4748
|
};
|
|
5213
4749
|
mapping[`SlideLayoutRels${li}`] = {
|
|
@@ -5223,7 +4759,7 @@ var Compiler = class {
|
|
|
5223
4759
|
if (file.notesSlides.length > 0) {
|
|
5224
4760
|
file.presentationWrapper.relationships.addRelationship(file.presentationWrapper.relationships.relationshipCount + 1, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster", "notesMasters/notesMaster1.xml");
|
|
5225
4761
|
mapping["NotesMaster"] = {
|
|
5226
|
-
data: this.formatter.formatToXml(new DefaultNotesMaster(), context
|
|
4762
|
+
data: this.formatter.formatToXml(new DefaultNotesMaster(), context),
|
|
5227
4763
|
path: "ppt/notesMasters/notesMaster1.xml"
|
|
5228
4764
|
};
|
|
5229
4765
|
mapping["NotesMasterRelationships"] = {
|
|
@@ -5232,13 +4768,11 @@ var Compiler = class {
|
|
|
5232
4768
|
};
|
|
5233
4769
|
}
|
|
5234
4770
|
if (file.commentAuthorList) file.presentationWrapper.relationships.addRelationship(file.presentationWrapper.relationships.relationshipCount + 1, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/commentAuthors", "commentAuthors.xml");
|
|
5235
|
-
const presentationXml = this.formatter.formatToXml(file.presentationWrapper.view, context
|
|
4771
|
+
const presentationXml = this.formatter.formatToXml(file.presentationWrapper.view, context);
|
|
5236
4772
|
let currentImageCount = 0;
|
|
5237
4773
|
const mediaData = getReferencedMedia(presentationXml, file.media.array);
|
|
5238
4774
|
const presImageOffset = file.presentationWrapper.relationships.relationshipCount + 1;
|
|
5239
|
-
mediaData.
|
|
5240
|
-
file.presentationWrapper.relationships.addRelationship(presImageOffset + idx, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", `../media/${image.fileName}`);
|
|
5241
|
-
});
|
|
4775
|
+
for (let idx = 0; idx < mediaData.length; idx++) file.presentationWrapper.relationships.addRelationship(presImageOffset + idx, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", `../media/${mediaData[idx].fileName}`);
|
|
5242
4776
|
const replacedPresentationXml = replaceImagePlaceholders(presentationXml, mediaData, presImageOffset);
|
|
5243
4777
|
currentImageCount += mediaData.length;
|
|
5244
4778
|
mapping["Presentation"] = {
|
|
@@ -5251,28 +4785,29 @@ var Compiler = class {
|
|
|
5251
4785
|
};
|
|
5252
4786
|
for (let i = 0; i < file.slides.length; i++) {
|
|
5253
4787
|
const slideWrapper = file.slideWrappers[i];
|
|
5254
|
-
const slideXml = this.formatter.formatToXml(slideWrapper.view, context
|
|
4788
|
+
const slideXml = this.formatter.formatToXml(slideWrapper.view, context);
|
|
5255
4789
|
const slideMediaData = getReferencedMedia(slideXml, file.media.array);
|
|
5256
4790
|
const slideImageOffset = slideWrapper.relationships.relationshipCount + 1;
|
|
5257
|
-
slideMediaData.
|
|
5258
|
-
slideWrapper.relationships.addRelationship(slideImageOffset + idx, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", `../media/${image.fileName}`);
|
|
5259
|
-
});
|
|
4791
|
+
for (let idx = 0; idx < slideMediaData.length; idx++) slideWrapper.relationships.addRelationship(slideImageOffset + idx, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", `../media/${slideMediaData[idx].fileName}`);
|
|
5260
4792
|
let replacedSlideXml = replaceImagePlaceholders(slideXml, slideMediaData, slideImageOffset);
|
|
5261
4793
|
currentImageCount += slideMediaData.length;
|
|
5262
4794
|
if (hasPlaceholders(replacedSlideXml)) {
|
|
5263
4795
|
const slideChartKeys = collectPlaceholderKeys(replacedSlideXml, "chart:");
|
|
5264
4796
|
if (slideChartKeys.length > 0) {
|
|
5265
4797
|
const slideChartOffset = slideWrapper.relationships.relationshipCount + 1;
|
|
5266
|
-
const
|
|
4798
|
+
const slideChartKeySet = new Set(slideChartKeys);
|
|
4799
|
+
const slideCharts = file.charts.array.filter((c) => slideChartKeySet.has(c.key));
|
|
5267
4800
|
replacedSlideXml = replaceChartPlaceholders(replacedSlideXml, slideCharts.map((c) => c.key), slideChartOffset);
|
|
5268
|
-
slideCharts.
|
|
4801
|
+
for (let ci = 0; ci < slideCharts.length; ci++) {
|
|
4802
|
+
const chartData = slideCharts[ci];
|
|
5269
4803
|
const globalIndex = file.charts.array.indexOf(chartData);
|
|
5270
4804
|
slideWrapper.relationships.addRelationship(slideChartOffset + ci, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart", `../charts/chart${globalIndex + 1}.xml`);
|
|
5271
|
-
}
|
|
4805
|
+
}
|
|
5272
4806
|
}
|
|
5273
4807
|
const slideSmartArtKeys = collectPlaceholderKeys(replacedSlideXml, "smartart:");
|
|
5274
4808
|
if (slideSmartArtKeys.length > 0) {
|
|
5275
|
-
const
|
|
4809
|
+
const slideSmartArtKeySet = new Set(slideSmartArtKeys);
|
|
4810
|
+
const slideSmartArts = file.smartArts.array.filter((s) => slideSmartArtKeySet.has(s.key));
|
|
5276
4811
|
const saOffset = slideWrapper.relationships.relationshipCount + 1;
|
|
5277
4812
|
replacedSlideXml = replaceSmartArtPlaceholders(replacedSlideXml, slideSmartArts.map((s) => s.key), saOffset);
|
|
5278
4813
|
const saGlobalStart = file.smartArts.array.indexOf(slideSmartArts[0]);
|
|
@@ -5285,12 +4820,11 @@ var Compiler = class {
|
|
|
5285
4820
|
}
|
|
5286
4821
|
const slideHlinkKeys = collectPlaceholderKeys(replacedSlideXml, "hlink:");
|
|
5287
4822
|
if (slideHlinkKeys.length > 0) {
|
|
5288
|
-
const
|
|
4823
|
+
const slideHlinkKeySet = new Set(slideHlinkKeys);
|
|
4824
|
+
const slideHlinks = file.hyperlinks.array.filter((h) => slideHlinkKeySet.has(h.key));
|
|
5289
4825
|
const hlinkOffset = slideWrapper.relationships.relationshipCount + 1;
|
|
5290
4826
|
replacedSlideXml = replaceHyperlinkPlaceholders(replacedSlideXml, slideHlinks, hlinkOffset);
|
|
5291
|
-
slideHlinks.
|
|
5292
|
-
slideWrapper.relationships.addRelationship(hlinkOffset + hi, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", hlink.url, "External");
|
|
5293
|
-
});
|
|
4827
|
+
for (let hi = 0; hi < slideHlinks.length; hi++) slideWrapper.relationships.addRelationship(hlinkOffset + hi, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink", slideHlinks[hi].url, "External");
|
|
5294
4828
|
}
|
|
5295
4829
|
const slideMediaRefs = getMediaRefs(replacedSlideXml, file.media.array);
|
|
5296
4830
|
const slideVideoRefs = getVideoRefs(replacedSlideXml, file.media.array);
|
|
@@ -5299,12 +4833,8 @@ var Compiler = class {
|
|
|
5299
4833
|
const videoOffset = mediaOffset + slideMediaRefs.length;
|
|
5300
4834
|
replacedSlideXml = replaceMediaPlaceholders(replacedSlideXml, slideMediaRefs, mediaOffset);
|
|
5301
4835
|
replacedSlideXml = replaceVideoPlaceholders(replacedSlideXml, slideVideoRefs, videoOffset);
|
|
5302
|
-
slideMediaRefs.
|
|
5303
|
-
|
|
5304
|
-
});
|
|
5305
|
-
slideVideoRefs.forEach((video, vi) => {
|
|
5306
|
-
slideWrapper.relationships.addRelationship(videoOffset + vi, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/video", `../media/${video.fileName}`);
|
|
5307
|
-
});
|
|
4836
|
+
for (let mi = 0; mi < slideMediaRefs.length; mi++) slideWrapper.relationships.addRelationship(mediaOffset + mi, "http://schemas.microsoft.com/office/2007/relationships/media", `../media/${slideMediaRefs[mi].fileName}`);
|
|
4837
|
+
for (let vi = 0; vi < slideVideoRefs.length; vi++) slideWrapper.relationships.addRelationship(videoOffset + vi, "http://schemas.openxmlformats.org/officeDocument/2006/relationships/video", `../media/${slideVideoRefs[vi].fileName}`);
|
|
5308
4838
|
}
|
|
5309
4839
|
}
|
|
5310
4840
|
mapping[`Slide${i}`] = {
|
|
@@ -5319,16 +4849,14 @@ var Compiler = class {
|
|
|
5319
4849
|
path: `ppt/slides/_rels/slide${i + 1}.xml.rels`
|
|
5320
4850
|
};
|
|
5321
4851
|
}
|
|
5322
|
-
file.charts.array.
|
|
5323
|
-
|
|
5324
|
-
});
|
|
5325
|
-
file.smartArts.array.forEach((_, i) => {
|
|
4852
|
+
for (let i = 0; i < file.charts.array.length; i++) file.contentTypes.addChart(i + 1);
|
|
4853
|
+
for (let i = 0; i < file.smartArts.array.length; i++) {
|
|
5326
4854
|
file.contentTypes.addDiagramData(i + 1);
|
|
5327
4855
|
file.contentTypes.addDiagramLayout(i + 1);
|
|
5328
4856
|
file.contentTypes.addDiagramStyle(i + 1);
|
|
5329
4857
|
file.contentTypes.addDiagramColors(i + 1);
|
|
5330
4858
|
file.contentTypes.addDiagramDrawing(i + 1);
|
|
5331
|
-
}
|
|
4859
|
+
}
|
|
5332
4860
|
mapping["ContentTypes"] = {
|
|
5333
4861
|
data: this.formatter.formatToXml(file.contentTypes, context),
|
|
5334
4862
|
path: "[Content_Types].xml"
|
|
@@ -5336,7 +4864,7 @@ var Compiler = class {
|
|
|
5336
4864
|
const files = compileMapping(mapping, overrides);
|
|
5337
4865
|
for (let i = 0; i < file.charts.array.length; i++) {
|
|
5338
4866
|
const chartData = file.charts.array[i];
|
|
5339
|
-
files[`ppt/charts/chart${i + 1}.xml`] = encoder$1.encode(this.formatter.formatToXml(chartData.chartSpace, context
|
|
4867
|
+
files[`ppt/charts/chart${i + 1}.xml`] = encoder$1.encode(this.formatter.formatToXml(chartData.chartSpace, context));
|
|
5340
4868
|
files[`ppt/charts/_rels/chart${i + 1}.xml.rels`] = encoder$1.encode(xml({ Relationships: { _attr: { xmlns: "http://schemas.openxmlformats.org/package/2006/relationships" } } }, { declaration: {
|
|
5341
4869
|
encoding: "UTF-8",
|
|
5342
4870
|
standalone: "yes"
|
|
@@ -5344,7 +4872,7 @@ var Compiler = class {
|
|
|
5344
4872
|
}
|
|
5345
4873
|
for (let i = 0; i < file.smartArts.array.length; i++) {
|
|
5346
4874
|
const smartArtData = file.smartArts.array[i];
|
|
5347
|
-
files[`ppt/diagrams/data${i + 1}.xml`] = encoder$1.encode(this.formatter.formatToXml(smartArtData.dataModel, context
|
|
4875
|
+
files[`ppt/diagrams/data${i + 1}.xml`] = encoder$1.encode(this.formatter.formatToXml(smartArtData.dataModel, context));
|
|
5348
4876
|
files[`ppt/diagrams/layout${i + 1}.xml`] = encoder$1.encode(getLayoutXml(smartArtData.layout));
|
|
5349
4877
|
files[`ppt/diagrams/quickStyle${i + 1}.xml`] = encoder$1.encode(getStyleXml(smartArtData.style));
|
|
5350
4878
|
files[`ppt/diagrams/colors${i + 1}.xml`] = encoder$1.encode(getColorXml(smartArtData.color));
|
|
@@ -5352,15 +4880,15 @@ var Compiler = class {
|
|
|
5352
4880
|
}
|
|
5353
4881
|
for (let i = 0; i < file.notesSlides.length; i++) {
|
|
5354
4882
|
const notesSlide = file.notesSlides[i];
|
|
5355
|
-
files[`ppt/notesSlides/notesSlide${i + 1}.xml`] = encoder$1.encode(this.formatter.formatToXml(notesSlide, context
|
|
4883
|
+
files[`ppt/notesSlides/notesSlide${i + 1}.xml`] = encoder$1.encode(this.formatter.formatToXml(notesSlide, context));
|
|
5356
4884
|
files[`ppt/notesSlides/_rels/notesSlide${i + 1}.xml.rels`] = encoder$1.encode(xml({ Relationships: { _attr: { xmlns: "http://schemas.openxmlformats.org/package/2006/relationships" } } }, { declaration: {
|
|
5357
4885
|
encoding: "UTF-8",
|
|
5358
4886
|
standalone: "yes"
|
|
5359
4887
|
} }));
|
|
5360
4888
|
}
|
|
5361
|
-
if (file.commentAuthorList) files["ppt/commentAuthors.xml"] = encoder$1.encode(this.formatter.formatToXml(file.commentAuthorList, context
|
|
4889
|
+
if (file.commentAuthorList) files["ppt/commentAuthors.xml"] = encoder$1.encode(this.formatter.formatToXml(file.commentAuthorList, context));
|
|
5362
4890
|
const commentLists = file.slideCommentLists;
|
|
5363
|
-
for (let i = 0; i < commentLists.length; i++) if (commentLists[i]) files[`ppt/comments/comment${i + 1}.xml`] = encoder$1.encode(this.formatter.formatToXml(commentLists[i], context
|
|
4891
|
+
for (let i = 0; i < commentLists.length; i++) if (commentLists[i]) files[`ppt/comments/comment${i + 1}.xml`] = encoder$1.encode(this.formatter.formatToXml(commentLists[i], context));
|
|
5364
4892
|
for (const image of file.media.array) {
|
|
5365
4893
|
files[`ppt/media/${image.fileName}`] = [image.data, { level: ZIP_STORED_LEVEL }];
|
|
5366
4894
|
if (image.type === "svg" && "fallback" in image) {
|
|
@@ -7656,4 +7184,4 @@ __reExport(/* @__PURE__ */ __exportAll({
|
|
|
7656
7184
|
//#endregion
|
|
7657
7185
|
export { AppProperties, AudioFrame, Background, BevelPresetType, BlipFill, Chart, ChartCollection, ChartSpace, CompoundLine, ConnectorShape, ContentTypes, CoreProperties, DateTimeField, DefaultNotesMaster, DefaultSlideLayout, DefaultSlideMaster, DefaultTheme, DrawingTable, EndParagraphRunProperties, Field, File, File as Presentation, GroupShape, GroupShapeProperties, GroupTransform2D, HeaderFooter, LineCap, LineJoin, LineShape, Media, NonVisualDrawingProperties, NonVisualPictureProperties, NonVisualShapeProperties, NotesSlide, Packer, Paragraph, ParagraphProperties, PatchType, PathShadeType, PenAlignment, Picture, PresentationWrapper, PresetDash, PresetGeometry, PresetMaterialType, ReflectionAlignment, Relationships, RunProperties, Shape, ShapeProperties, ShapeTree, Slide, SlideLayout, SlideNumberField, SlideSizePreset, SmartArt, StrikeStyle, Table, TableCell, TableCellProperties, TableProperties, TableRow, Text, TextAlignment, TextBody, TextCapitalization, TextRun, TileFlipMode, Transform2D, Transition, UnderlineStyle, VerticalAlignment, VideoFrame, buildFill, coerceChild, convertEmuToInches, convertEmuToPixels, convertEmuToPoints, convertInchesToEmu, convertPixelsToEmu, convertPointsToEmu, createBevel, createBottomBevel, createColorElement, createColorTransforms, createEffectList, createGradientFill, createGradientStop, createOutline, createOutlineCompat, createPptxEffectList, createScene3D, createShape3D, createTransformation, extractBlipFillMedia, hashedId, parseArchive, parsePptx, parsePresentation, patchPresentation, percentToTHousandths, uniqueId, uniqueNumericIdCreator, uniqueUuid };
|
|
7658
7186
|
|
|
7659
|
-
//# sourceMappingURL=index.
|
|
7187
|
+
//# sourceMappingURL=index.mjs.map
|