pptx-viewer-core 1.3.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/dist/cli/index.js +0 -0
- package/dist/cli/index.mjs +0 -0
- package/dist/converter/index.js +0 -0
- package/dist/converter/index.mjs +0 -0
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +146 -66
- package/dist/index.mjs +146 -66
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,8 @@ All notable changes to this project are documented here.
|
|
|
4
4
|
This file is generated from [Conventional Commits](https://www.conventionalcommits.org)
|
|
5
5
|
by [git-cliff](https://git-cliff.org); do not edit it by hand.
|
|
6
6
|
|
|
7
|
+
## [1.3.1](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-viewer-core@1.3.1) - 2026-07-13
|
|
8
|
+
|
|
7
9
|
## [1.3.0](https://github.com/ChristopherVR/pptx-viewer/releases/tag/pptx-viewer-core@1.3.0) - 2026-07-11
|
|
8
10
|
|
|
9
11
|
### Other
|
package/dist/cli/index.js
CHANGED
|
Binary file
|
package/dist/cli/index.mjs
CHANGED
|
Binary file
|
package/dist/converter/index.js
CHANGED
|
Binary file
|
package/dist/converter/index.mjs
CHANGED
|
Binary file
|
package/dist/index.d.mts
CHANGED
|
@@ -6571,7 +6571,7 @@ declare class PptxHandlerRuntime$10 extends PptxHandlerRuntime$11 {
|
|
|
6571
6571
|
}
|
|
6572
6572
|
|
|
6573
6573
|
declare class PptxHandlerRuntime$$ extends PptxHandlerRuntime$10 {
|
|
6574
|
-
protected extractTextRunStyle(runProperties: XmlObject | undefined, align: TextStyle['align'], relationshipMap?: Map<string, string
|
|
6574
|
+
protected extractTextRunStyle(runProperties: XmlObject | undefined, align: TextStyle['align'], relationshipMap?: Map<string, string>, includeDefaultAlignment?: boolean): TextStyle;
|
|
6575
6575
|
/**
|
|
6576
6576
|
* Copy `@panose` / `@pitchFamily` / `@charset` from a font child node
|
|
6577
6577
|
* (`a:latin`, `a:ea`, `a:cs`, `a:sym`) onto the matching `*Font*`
|
|
@@ -7570,6 +7570,7 @@ declare class PptxHandlerRuntime$D extends PptxHandlerRuntime$E {
|
|
|
7570
7570
|
* merges them so that layout values take priority over master values.
|
|
7571
7571
|
*/
|
|
7572
7572
|
protected lookupPlaceholderDefaults(slidePath: string, phInfo: PlaceholderInfo): PlaceholderDefaults | undefined;
|
|
7573
|
+
private mergePlaceholderLevelStyles;
|
|
7573
7574
|
}
|
|
7574
7575
|
|
|
7575
7576
|
declare class PptxHandlerRuntime$C extends PptxHandlerRuntime$D {
|
|
@@ -8721,7 +8722,7 @@ declare class PptxHandlerRuntime$2 extends PptxHandlerRuntime$3 {
|
|
|
8721
8722
|
notesWidthEmu: number;
|
|
8722
8723
|
notesHeightEmu: number;
|
|
8723
8724
|
orderedSections: PptxSection[];
|
|
8724
|
-
}, slidesWithWarnings: PptxSlide[]): Promise<PptxData>;
|
|
8725
|
+
}, slidesWithWarnings: PptxSlide[], slideMasters: PptxSlideMaster[]): Promise<PptxData>;
|
|
8725
8726
|
/**
|
|
8726
8727
|
* Walk the raw XML of every slide to find the highest numeric `@_id`
|
|
8727
8728
|
* attribute on `p:cNvPr` / `p:cNvCxnSpPr` / `p:cNvPicPr` nodes.
|
package/dist/index.d.ts
CHANGED
|
@@ -6571,7 +6571,7 @@ declare class PptxHandlerRuntime$10 extends PptxHandlerRuntime$11 {
|
|
|
6571
6571
|
}
|
|
6572
6572
|
|
|
6573
6573
|
declare class PptxHandlerRuntime$$ extends PptxHandlerRuntime$10 {
|
|
6574
|
-
protected extractTextRunStyle(runProperties: XmlObject | undefined, align: TextStyle['align'], relationshipMap?: Map<string, string
|
|
6574
|
+
protected extractTextRunStyle(runProperties: XmlObject | undefined, align: TextStyle['align'], relationshipMap?: Map<string, string>, includeDefaultAlignment?: boolean): TextStyle;
|
|
6575
6575
|
/**
|
|
6576
6576
|
* Copy `@panose` / `@pitchFamily` / `@charset` from a font child node
|
|
6577
6577
|
* (`a:latin`, `a:ea`, `a:cs`, `a:sym`) onto the matching `*Font*`
|
|
@@ -7570,6 +7570,7 @@ declare class PptxHandlerRuntime$D extends PptxHandlerRuntime$E {
|
|
|
7570
7570
|
* merges them so that layout values take priority over master values.
|
|
7571
7571
|
*/
|
|
7572
7572
|
protected lookupPlaceholderDefaults(slidePath: string, phInfo: PlaceholderInfo): PlaceholderDefaults | undefined;
|
|
7573
|
+
private mergePlaceholderLevelStyles;
|
|
7573
7574
|
}
|
|
7574
7575
|
|
|
7575
7576
|
declare class PptxHandlerRuntime$C extends PptxHandlerRuntime$D {
|
|
@@ -8721,7 +8722,7 @@ declare class PptxHandlerRuntime$2 extends PptxHandlerRuntime$3 {
|
|
|
8721
8722
|
notesWidthEmu: number;
|
|
8722
8723
|
notesHeightEmu: number;
|
|
8723
8724
|
orderedSections: PptxSection[];
|
|
8724
|
-
}, slidesWithWarnings: PptxSlide[]): Promise<PptxData>;
|
|
8725
|
+
}, slidesWithWarnings: PptxSlide[], slideMasters: PptxSlideMaster[]): Promise<PptxData>;
|
|
8725
8726
|
/**
|
|
8726
8727
|
* Walk the raw XML of every slide to find the highest numeric `@_id`
|
|
8727
8728
|
* attribute on `p:cNvPr` / `p:cNvCxnSpPr` / `p:cNvPicPr` nodes.
|
package/dist/index.js
CHANGED
|
@@ -21508,6 +21508,7 @@ var FONT_SUBSTITUTION_MAP = {
|
|
|
21508
21508
|
MoolBoran: ["Noto Sans Khmer", "sans-serif"],
|
|
21509
21509
|
// Decorative / Display
|
|
21510
21510
|
"Century Gothic": ["URW Gothic", "Futura", "sans-serif"],
|
|
21511
|
+
Oswald: ["Agency FB", "Arial Narrow", "sans-serif"],
|
|
21511
21512
|
"Franklin Gothic": ["Liberation Sans", "Helvetica Neue", "sans-serif"],
|
|
21512
21513
|
"Franklin Gothic Medium": ["Liberation Sans", "Helvetica Neue", "sans-serif"],
|
|
21513
21514
|
Garamond: ["EB Garamond", "Cormorant Garamond", "serif"],
|
|
@@ -31418,8 +31419,8 @@ var PptxHandlerRuntime18 = class extends PptxHandlerRuntime17 {
|
|
|
31418
31419
|
|
|
31419
31420
|
// src/core/core/runtime/PptxHandlerRuntimeTextRunStyleExtraction.ts
|
|
31420
31421
|
var PptxHandlerRuntime19 = class _PptxHandlerRuntime extends PptxHandlerRuntime18 {
|
|
31421
|
-
extractTextRunStyle(runProperties, align, relationshipMap) {
|
|
31422
|
-
const style = { align };
|
|
31422
|
+
extractTextRunStyle(runProperties, align, relationshipMap, includeDefaultAlignment = true) {
|
|
31423
|
+
const style = includeDefaultAlignment ? { align } : {};
|
|
31423
31424
|
if (!runProperties) {
|
|
31424
31425
|
return style;
|
|
31425
31426
|
}
|
|
@@ -38733,11 +38734,12 @@ var PptxHandlerRuntime42 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
38733
38734
|
if (!source) {
|
|
38734
38735
|
return true;
|
|
38735
38736
|
}
|
|
38737
|
+
const typesMatch = source.type === target.type || source.type === "ctrtitle" && target.type === "title" || source.type === "subtitle" && target.type === "body";
|
|
38736
38738
|
if (source.idx !== void 0 && target.idx !== void 0) {
|
|
38737
38739
|
if (source.idx !== target.idx) {
|
|
38738
38740
|
return false;
|
|
38739
38741
|
}
|
|
38740
|
-
if (source.type && target.type &&
|
|
38742
|
+
if (source.type && target.type && !typesMatch) {
|
|
38741
38743
|
return false;
|
|
38742
38744
|
}
|
|
38743
38745
|
return true;
|
|
@@ -38745,11 +38747,11 @@ var PptxHandlerRuntime42 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
38745
38747
|
if (source.idx !== void 0 && target.idx === void 0) {
|
|
38746
38748
|
const singletonTypes = /* @__PURE__ */ new Set(["title", "ctrtitle", "subtitle", "dt", "ftr", "sldnum"]);
|
|
38747
38749
|
if (source.type && singletonTypes.has(source.type)) {
|
|
38748
|
-
return
|
|
38750
|
+
return typesMatch;
|
|
38749
38751
|
}
|
|
38750
38752
|
return false;
|
|
38751
38753
|
}
|
|
38752
|
-
if (source.type && target.type &&
|
|
38754
|
+
if (source.type && target.type && !typesMatch) {
|
|
38753
38755
|
return false;
|
|
38754
38756
|
}
|
|
38755
38757
|
if (source.type && !target.type) {
|
|
@@ -38793,18 +38795,21 @@ var PptxHandlerRuntime43 = class extends PptxHandlerRuntime42 {
|
|
|
38793
38795
|
xmlPath(layoutXmlObj, "p:sldLayout", "p:cSld", "p:spTree"),
|
|
38794
38796
|
expected
|
|
38795
38797
|
);
|
|
38796
|
-
if (layoutContext) {
|
|
38797
|
-
return layoutContext;
|
|
38798
|
-
}
|
|
38799
38798
|
const masterPath = this.resolveMasterPathForLayout(layoutPath);
|
|
38800
|
-
|
|
38801
|
-
|
|
38802
|
-
}
|
|
38803
|
-
const masterXmlObj = this.masterXmlMap.get(masterPath);
|
|
38804
|
-
return this.findPlaceholderInShapeTree(
|
|
38805
|
-
xmlPath(masterXmlObj, "p:sldMaster", "p:cSld", "p:spTree"),
|
|
38799
|
+
const masterContext = masterPath ? this.findPlaceholderInShapeTree(
|
|
38800
|
+
xmlPath(this.masterXmlMap.get(masterPath), "p:sldMaster", "p:cSld", "p:spTree"),
|
|
38806
38801
|
expected
|
|
38807
|
-
);
|
|
38802
|
+
) : void 0;
|
|
38803
|
+
if (!layoutContext) {
|
|
38804
|
+
return masterContext;
|
|
38805
|
+
}
|
|
38806
|
+
if (!masterContext) {
|
|
38807
|
+
return layoutContext;
|
|
38808
|
+
}
|
|
38809
|
+
return {
|
|
38810
|
+
shape: layoutContext.shape || masterContext.shape ? this.mergeXmlObjects(masterContext.shape, layoutContext.shape) : void 0,
|
|
38811
|
+
picture: layoutContext.picture || masterContext.picture ? this.mergeXmlObjects(masterContext.picture, layoutContext.picture) : void 0
|
|
38812
|
+
};
|
|
38808
38813
|
}
|
|
38809
38814
|
mergeXmlObjects(base, override, depth = 0) {
|
|
38810
38815
|
const MAX_MERGE_DEPTH = 64;
|
|
@@ -38857,10 +38862,11 @@ var PptxHandlerRuntime43 = class extends PptxHandlerRuntime42 {
|
|
|
38857
38862
|
* otherwise falls back to `type`.
|
|
38858
38863
|
*/
|
|
38859
38864
|
buildPlaceholderDefaultsKey(phInfo) {
|
|
38865
|
+
const normalizedType = phInfo.type === "ctrtitle" ? "title" : phInfo.type === "subtitle" ? "body" : phInfo.type;
|
|
38860
38866
|
if (phInfo.idx !== void 0) {
|
|
38861
|
-
return
|
|
38867
|
+
return normalizedType ? `${normalizedType}_${phInfo.idx}` : `_${phInfo.idx}`;
|
|
38862
38868
|
}
|
|
38863
|
-
return
|
|
38869
|
+
return normalizedType ?? "body";
|
|
38864
38870
|
}
|
|
38865
38871
|
/**
|
|
38866
38872
|
* Look up merged {@link PlaceholderDefaults} for a shape's placeholder
|
|
@@ -38878,44 +38884,52 @@ var PptxHandlerRuntime43 = class extends PptxHandlerRuntime42 {
|
|
|
38878
38884
|
const masterPath = this.resolveMasterPathForLayout(layoutPath);
|
|
38879
38885
|
const masterMap = masterPath ? this.masterPlaceholderDefaultsCache.get(masterPath) : void 0;
|
|
38880
38886
|
const masterDefaults = masterMap?.get(phKey);
|
|
38881
|
-
|
|
38887
|
+
const normalizedType = this.buildPlaceholderDefaultsKey(phInfo).split("_")[0];
|
|
38888
|
+
const masterTextStyleType = phInfo.type === "title" || phInfo.type === "ctrtitle" ? "title" : phInfo.type === "body" || phInfo.type === "obj" || phInfo.type === "subtitle" ? "body" : "other";
|
|
38889
|
+
const masterTextStyles = masterPath ? this.masterTxStylesCache.get(masterPath) : void 0;
|
|
38890
|
+
const masterTextLevels = masterTextStyleType === "title" ? masterTextStyles?.titleStyle : masterTextStyleType === "body" ? masterTextStyles?.bodyStyle : masterTextStyles?.otherStyle;
|
|
38891
|
+
const resolvedMasterDefaults = masterTextLevels ? {
|
|
38892
|
+
type: masterDefaults?.type ?? normalizedType,
|
|
38893
|
+
...masterDefaults,
|
|
38894
|
+
levelStyles: this.mergePlaceholderLevelStyles(
|
|
38895
|
+
masterTextLevels,
|
|
38896
|
+
masterDefaults?.levelStyles
|
|
38897
|
+
)
|
|
38898
|
+
} : masterDefaults;
|
|
38899
|
+
if (!layoutDefaults && !resolvedMasterDefaults) {
|
|
38882
38900
|
return void 0;
|
|
38883
38901
|
}
|
|
38884
|
-
if (!
|
|
38902
|
+
if (!resolvedMasterDefaults) {
|
|
38885
38903
|
return layoutDefaults;
|
|
38886
38904
|
}
|
|
38887
38905
|
if (!layoutDefaults) {
|
|
38888
|
-
return
|
|
38906
|
+
return resolvedMasterDefaults;
|
|
38889
38907
|
}
|
|
38890
38908
|
const merged = {
|
|
38891
38909
|
type: layoutDefaults.type,
|
|
38892
|
-
idx: layoutDefaults.idx ??
|
|
38893
|
-
bodyInsetLeft: layoutDefaults.bodyInsetLeft ??
|
|
38894
|
-
bodyInsetTop: layoutDefaults.bodyInsetTop ??
|
|
38895
|
-
bodyInsetRight: layoutDefaults.bodyInsetRight ??
|
|
38896
|
-
bodyInsetBottom: layoutDefaults.bodyInsetBottom ??
|
|
38897
|
-
textAnchor: layoutDefaults.textAnchor ??
|
|
38898
|
-
autoFit: layoutDefaults.autoFit ??
|
|
38899
|
-
textWrap: layoutDefaults.textWrap ??
|
|
38900
|
-
promptText: layoutDefaults.promptText ??
|
|
38910
|
+
idx: layoutDefaults.idx ?? resolvedMasterDefaults.idx,
|
|
38911
|
+
bodyInsetLeft: layoutDefaults.bodyInsetLeft ?? resolvedMasterDefaults.bodyInsetLeft,
|
|
38912
|
+
bodyInsetTop: layoutDefaults.bodyInsetTop ?? resolvedMasterDefaults.bodyInsetTop,
|
|
38913
|
+
bodyInsetRight: layoutDefaults.bodyInsetRight ?? resolvedMasterDefaults.bodyInsetRight,
|
|
38914
|
+
bodyInsetBottom: layoutDefaults.bodyInsetBottom ?? resolvedMasterDefaults.bodyInsetBottom,
|
|
38915
|
+
textAnchor: layoutDefaults.textAnchor ?? resolvedMasterDefaults.textAnchor,
|
|
38916
|
+
autoFit: layoutDefaults.autoFit ?? resolvedMasterDefaults.autoFit,
|
|
38917
|
+
textWrap: layoutDefaults.textWrap ?? resolvedMasterDefaults.textWrap,
|
|
38918
|
+
promptText: layoutDefaults.promptText ?? resolvedMasterDefaults.promptText
|
|
38901
38919
|
};
|
|
38902
|
-
if (layoutDefaults.levelStyles ||
|
|
38903
|
-
|
|
38904
|
-
|
|
38905
|
-
|
|
38906
|
-
|
|
38907
|
-
|
|
38908
|
-
|
|
38909
|
-
|
|
38910
|
-
|
|
38911
|
-
|
|
38912
|
-
|
|
38913
|
-
|
|
38914
|
-
|
|
38915
|
-
mergedLevels[key] = layoutLevel ?? masterLevel;
|
|
38916
|
-
}
|
|
38917
|
-
}
|
|
38918
|
-
merged.levelStyles = mergedLevels;
|
|
38920
|
+
if (layoutDefaults.levelStyles || resolvedMasterDefaults.levelStyles) {
|
|
38921
|
+
merged.levelStyles = this.mergePlaceholderLevelStyles(
|
|
38922
|
+
resolvedMasterDefaults.levelStyles,
|
|
38923
|
+
layoutDefaults.levelStyles
|
|
38924
|
+
);
|
|
38925
|
+
}
|
|
38926
|
+
return merged;
|
|
38927
|
+
}
|
|
38928
|
+
mergePlaceholderLevelStyles(base, override) {
|
|
38929
|
+
const merged = {};
|
|
38930
|
+
for (const key of /* @__PURE__ */ new Set([...Object.keys(base ?? {}), ...Object.keys(override ?? {})])) {
|
|
38931
|
+
const level = Number.parseInt(key, 10);
|
|
38932
|
+
merged[level] = { ...base?.[level], ...override?.[level] };
|
|
38919
38933
|
}
|
|
38920
38934
|
return merged;
|
|
38921
38935
|
}
|
|
@@ -40213,7 +40227,11 @@ var PptxHandlerRuntime49 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
40213
40227
|
* for "first-wins" shape-level properties.
|
|
40214
40228
|
*/
|
|
40215
40229
|
resolveShapeParagraphStyle(p, textStyle, ctx) {
|
|
40216
|
-
const
|
|
40230
|
+
const inheritedParagraph = this.ensureArray(ctx.inheritedTxBody?.["a:p"])[0];
|
|
40231
|
+
const pPr = this.mergeXmlObjects(
|
|
40232
|
+
inheritedParagraph?.["a:pPr"],
|
|
40233
|
+
p["a:pPr"]
|
|
40234
|
+
);
|
|
40217
40235
|
const paragraphRtl = this.parseOptionalBooleanAttr(pPr?.["@_rtl"]);
|
|
40218
40236
|
if (paragraphRtl !== void 0 && textStyle.rtl === void 0) {
|
|
40219
40237
|
textStyle.rtl = paragraphRtl;
|
|
@@ -40329,24 +40347,28 @@ var PptxHandlerRuntime49 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
40329
40347
|
const defaultRunStyle = this.extractTextRunStyle(
|
|
40330
40348
|
pPr?.["a:defRPr"],
|
|
40331
40349
|
paraAlign,
|
|
40332
|
-
ctx.slideRelationshipMap
|
|
40350
|
+
ctx.slideRelationshipMap,
|
|
40351
|
+
false
|
|
40333
40352
|
);
|
|
40334
|
-
const level = Number.parseInt(String(pPr
|
|
40335
|
-
const levelKey = `a:lvl${Number.isFinite(level) ? Math.min(Math.max(level + 1, 1), 9) : 1}pPr`;
|
|
40353
|
+
const level = pPr?.["@_lvl"] === void 0 ? -1 : Number.parseInt(String(pPr["@_lvl"]), 10);
|
|
40354
|
+
const levelKey = level === -1 ? "a:defPPr" : `a:lvl${Number.isFinite(level) ? Math.min(Math.max(level + 1, 1), 9) : 1}pPr`;
|
|
40336
40355
|
const inheritedLevelStyle = this.extractTextRunStyle(
|
|
40337
40356
|
ctx.inheritedTxBody?.["a:lstStyle"]?.[levelKey]?.["a:defRPr"],
|
|
40338
40357
|
paraAlign,
|
|
40339
|
-
ctx.slideRelationshipMap
|
|
40358
|
+
ctx.slideRelationshipMap,
|
|
40359
|
+
false
|
|
40340
40360
|
);
|
|
40341
40361
|
const bodyLevelStyle = this.extractTextRunStyle(
|
|
40342
40362
|
ctx.txBody?.["a:lstStyle"]?.[levelKey]?.["a:defRPr"],
|
|
40343
40363
|
paraAlign,
|
|
40344
|
-
ctx.slideRelationshipMap
|
|
40364
|
+
ctx.slideRelationshipMap,
|
|
40365
|
+
false
|
|
40345
40366
|
);
|
|
40346
40367
|
const endParagraphStyle = this.extractTextRunStyle(
|
|
40347
40368
|
p?.["a:endParaRPr"],
|
|
40348
40369
|
paraAlign,
|
|
40349
|
-
ctx.slideRelationshipMap
|
|
40370
|
+
ctx.slideRelationshipMap,
|
|
40371
|
+
false
|
|
40350
40372
|
);
|
|
40351
40373
|
const mergedDefaultRunStyle = {
|
|
40352
40374
|
...ctx.bodyDefaultRunStyle,
|
|
@@ -40356,20 +40378,23 @@ var PptxHandlerRuntime49 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
40356
40378
|
...defaultRunStyle
|
|
40357
40379
|
};
|
|
40358
40380
|
if (ctx.effectiveLevelStyles) {
|
|
40359
|
-
const normalizedLevel = Number.isFinite(level) ? Math.min(Math.max(level, 0), 8) : 0;
|
|
40360
|
-
const phLevel = ctx.effectiveLevelStyles[normalizedLevel] ?? ctx.effectiveLevelStyles[-1];
|
|
40381
|
+
const normalizedLevel = level === -1 ? -1 : Number.isFinite(level) ? Math.min(Math.max(level, 0), 8) : 0;
|
|
40382
|
+
const phLevel = ctx.effectiveLevelStyles[normalizedLevel] ?? ctx.effectiveLevelStyles[-1] ?? (normalizedLevel === -1 ? ctx.effectiveLevelStyles[0] : void 0);
|
|
40361
40383
|
if (phLevel) {
|
|
40362
40384
|
this.applyPlaceholderLevelDefaults(mergedDefaultRunStyle, phLevel);
|
|
40363
40385
|
this.applyPlaceholderLevelDefaults(textStyle, phLevel);
|
|
40364
40386
|
}
|
|
40365
40387
|
}
|
|
40388
|
+
if (pPr?.["@_algn"] === void 0 && textStyle.align !== void 0) {
|
|
40389
|
+
paraAlign = textStyle.align;
|
|
40390
|
+
}
|
|
40366
40391
|
const parMarginLeft = pPr?.["@_marL"] !== void 0 ? Number.parseInt(String(pPr["@_marL"]), 10) / _PptxHandlerRuntime.EMU_PER_PX : void 0;
|
|
40367
40392
|
const parIndent = pPr?.["@_indent"] !== void 0 ? Number.parseInt(String(pPr["@_indent"]), 10) / _PptxHandlerRuntime.EMU_PER_PX : void 0;
|
|
40368
40393
|
let effectiveMarginLeft = parMarginLeft;
|
|
40369
40394
|
let effectiveIndent = parIndent;
|
|
40370
40395
|
if (ctx.effectiveLevelStyles) {
|
|
40371
|
-
const normalizedLevel = Number.isFinite(level) ? Math.min(Math.max(level, 0), 8) : 0;
|
|
40372
|
-
const phLevel = ctx.effectiveLevelStyles[normalizedLevel] ?? ctx.effectiveLevelStyles[-1];
|
|
40396
|
+
const normalizedLevel = level === -1 ? -1 : Number.isFinite(level) ? Math.min(Math.max(level, 0), 8) : 0;
|
|
40397
|
+
const phLevel = ctx.effectiveLevelStyles[normalizedLevel] ?? ctx.effectiveLevelStyles[-1] ?? (normalizedLevel === -1 ? ctx.effectiveLevelStyles[0] : void 0);
|
|
40373
40398
|
if (phLevel) {
|
|
40374
40399
|
if (effectiveMarginLeft === void 0 && phLevel.marginLeft !== void 0) {
|
|
40375
40400
|
effectiveMarginLeft = phLevel.marginLeft;
|
|
@@ -40535,11 +40560,23 @@ var PptxHandlerRuntime50 = class extends PptxHandlerRuntime49 {
|
|
|
40535
40560
|
continue;
|
|
40536
40561
|
}
|
|
40537
40562
|
const items = this.ensureArray(p[key]);
|
|
40538
|
-
|
|
40563
|
+
const rawBreaks = p["a:br"];
|
|
40564
|
+
const breakCount = Array.isArray(rawBreaks) ? rawBreaks.length : rawBreaks === void 0 ? 0 : 1;
|
|
40565
|
+
const insertCollapsedBreaks = key === "a:r" && items.length > 1 && breakCount > 0;
|
|
40566
|
+
for (const [itemIndex, item] of items.entries()) {
|
|
40539
40567
|
switch (key) {
|
|
40540
|
-
case "a:r":
|
|
40568
|
+
case "a:r": {
|
|
40541
40569
|
processRun(item);
|
|
40570
|
+
if (insertCollapsedBreaks && itemIndex < Math.min(items.length - 1, breakCount)) {
|
|
40571
|
+
parts.push("\n");
|
|
40572
|
+
segments.push({
|
|
40573
|
+
text: "\n",
|
|
40574
|
+
style: { ...mergedDefaultRunStyle },
|
|
40575
|
+
isLineBreak: true
|
|
40576
|
+
});
|
|
40577
|
+
}
|
|
40542
40578
|
break;
|
|
40579
|
+
}
|
|
40543
40580
|
case "a:fld":
|
|
40544
40581
|
processField(item);
|
|
40545
40582
|
break;
|
|
@@ -40557,6 +40594,9 @@ var PptxHandlerRuntime50 = class extends PptxHandlerRuntime49 {
|
|
|
40557
40594
|
processAlternateContent(item);
|
|
40558
40595
|
break;
|
|
40559
40596
|
case "a:br": {
|
|
40597
|
+
if (insertCollapsedBreaks) {
|
|
40598
|
+
break;
|
|
40599
|
+
}
|
|
40560
40600
|
const brNode = item ?? {};
|
|
40561
40601
|
const brRunProps = brNode["a:rPr"];
|
|
40562
40602
|
const brStyle = {
|
|
@@ -40719,7 +40759,13 @@ var PptxHandlerRuntime51 = class _PptxHandlerRuntime extends PptxHandlerRuntime5
|
|
|
40719
40759
|
);
|
|
40720
40760
|
const inheritedPlaceholder = slidePath && placeholderInfo ? this.findPlaceholderContext(slidePath, placeholderInfo) : void 0;
|
|
40721
40761
|
const inheritedSpPr = inheritedPlaceholder?.shape?.["p:spPr"] || inheritedPlaceholder?.picture?.["p:spPr"];
|
|
40722
|
-
const effectiveSpPr =
|
|
40762
|
+
const effectiveSpPr = spPr ? {
|
|
40763
|
+
...spPr,
|
|
40764
|
+
"a:xfrm": this.mergeXmlObjects(
|
|
40765
|
+
inheritedSpPr?.["a:xfrm"],
|
|
40766
|
+
spPr["a:xfrm"]
|
|
40767
|
+
)
|
|
40768
|
+
} : inheritedSpPr;
|
|
40723
40769
|
const xfrm = effectiveSpPr?.["a:xfrm"] || spPr?.["a:xfrm"] || inheritedSpPr?.["a:xfrm"];
|
|
40724
40770
|
if (!xfrm) {
|
|
40725
40771
|
return null;
|
|
@@ -40797,14 +40843,16 @@ var PptxHandlerRuntime51 = class _PptxHandlerRuntime extends PptxHandlerRuntime5
|
|
|
40797
40843
|
const inheritedBodyDefaultRunStyle = this.extractTextRunStyle(
|
|
40798
40844
|
xmlPath(inheritedTxBody, "a:lstStyle", "a:defPPr", "a:defRPr"),
|
|
40799
40845
|
"left",
|
|
40800
|
-
slideRelationshipMap
|
|
40846
|
+
slideRelationshipMap,
|
|
40847
|
+
false
|
|
40801
40848
|
);
|
|
40802
40849
|
const bodyDefaultRunStyle = {
|
|
40803
40850
|
...inheritedBodyDefaultRunStyle,
|
|
40804
40851
|
...this.extractTextRunStyle(
|
|
40805
40852
|
xmlPath(txBody, "a:lstStyle", "a:defPPr", "a:defRPr"),
|
|
40806
40853
|
"left",
|
|
40807
|
-
slideRelationshipMap
|
|
40854
|
+
slideRelationshipMap,
|
|
40855
|
+
false
|
|
40808
40856
|
)
|
|
40809
40857
|
};
|
|
40810
40858
|
Object.assign(textStyle, bodyDefaultRunStyle);
|
|
@@ -43191,6 +43239,21 @@ var PptxHandlerRuntime61 = class extends PptxHandlerRuntime60 {
|
|
|
43191
43239
|
element.id = `master-${element.id}`;
|
|
43192
43240
|
elements.push(element);
|
|
43193
43241
|
}
|
|
43242
|
+
} else if (entry.tag === "p:cxnSp") {
|
|
43243
|
+
const connectors = this.ensureArray(spTree["p:cxnSp"]);
|
|
43244
|
+
const connector = connectors[entry.indexInType];
|
|
43245
|
+
if (!connector) {
|
|
43246
|
+
continue;
|
|
43247
|
+
}
|
|
43248
|
+
const element = this.parseConnector(
|
|
43249
|
+
connector,
|
|
43250
|
+
`master-conn-${masterToken}-${entry.indexInType}`,
|
|
43251
|
+
masterPath
|
|
43252
|
+
);
|
|
43253
|
+
if (element) {
|
|
43254
|
+
element.id = `master-${element.id}`;
|
|
43255
|
+
elements.push(element);
|
|
43256
|
+
}
|
|
43194
43257
|
}
|
|
43195
43258
|
}
|
|
43196
43259
|
this.masterCache.set(masterPath, elements);
|
|
@@ -43329,6 +43392,21 @@ var PptxHandlerRuntime62 = class extends PptxHandlerRuntime61 {
|
|
|
43329
43392
|
element.id = `layout-${element.id}`;
|
|
43330
43393
|
elements.push(element);
|
|
43331
43394
|
}
|
|
43395
|
+
} else if (entry.tag === "p:cxnSp") {
|
|
43396
|
+
const connectors = this.ensureArray(spTree["p:cxnSp"]);
|
|
43397
|
+
const connector = connectors[entry.indexInType];
|
|
43398
|
+
if (!connector) {
|
|
43399
|
+
continue;
|
|
43400
|
+
}
|
|
43401
|
+
const element = this.parseConnector(
|
|
43402
|
+
connector,
|
|
43403
|
+
`layout-conn-${layoutToken}-${entry.indexInType}`,
|
|
43404
|
+
layoutPath
|
|
43405
|
+
);
|
|
43406
|
+
if (element) {
|
|
43407
|
+
element.id = `layout-${element.id}`;
|
|
43408
|
+
elements.push(element);
|
|
43409
|
+
}
|
|
43332
43410
|
}
|
|
43333
43411
|
}
|
|
43334
43412
|
const layoutShowMasterSp = xmlAttr(
|
|
@@ -47032,6 +47110,7 @@ var PptxHandlerRuntime79 = class _PptxHandlerRuntime extends PptxHandlerRuntime7
|
|
|
47032
47110
|
this.masterCache.clear();
|
|
47033
47111
|
this.layoutXmlMap.clear();
|
|
47034
47112
|
this.masterXmlMap.clear();
|
|
47113
|
+
this.masterTxStylesCache.clear();
|
|
47035
47114
|
if (typeof globalThis.URL?.revokeObjectURL === "function" && this.blobUrlCache.size > 0) {
|
|
47036
47115
|
for (const url of this.blobUrlCache) {
|
|
47037
47116
|
URL.revokeObjectURL(url);
|
|
@@ -47316,7 +47395,7 @@ var PptxHandlerRuntime79 = class _PptxHandlerRuntime extends PptxHandlerRuntime7
|
|
|
47316
47395
|
|
|
47317
47396
|
// src/core/core/runtime/PptxHandlerRuntimeLoadPipeline.ts
|
|
47318
47397
|
var PptxHandlerRuntime80 = class extends PptxHandlerRuntime79 {
|
|
47319
|
-
async buildLoadData(presentationState, slidesWithWarnings) {
|
|
47398
|
+
async buildLoadData(presentationState, slidesWithWarnings, slideMasters) {
|
|
47320
47399
|
const headerFooter = this.extractHeaderFooter();
|
|
47321
47400
|
const presentationProperties = await this.parsePresentationProperties();
|
|
47322
47401
|
const customShows = this.parseCustomShows();
|
|
@@ -47326,8 +47405,6 @@ var PptxHandlerRuntime80 = class extends PptxHandlerRuntime79 {
|
|
|
47326
47405
|
const themeOptions = await this.parseThemeOptions();
|
|
47327
47406
|
const notesMaster = await this.parseNotesMaster();
|
|
47328
47407
|
const handoutMaster = await this.parseHandoutMaster();
|
|
47329
|
-
const slideMasters = await this.parseSlideMasters();
|
|
47330
|
-
await this.enrichSlideMastersWithTxStyles(slideMasters);
|
|
47331
47408
|
const tags = await this.parseTags();
|
|
47332
47409
|
const customProperties = await this.parseCustomProperties();
|
|
47333
47410
|
const coreProperties = await this.parseCoreProperties();
|
|
@@ -47447,6 +47524,7 @@ var PptxHandlerRuntime80 = class extends PptxHandlerRuntime79 {
|
|
|
47447
47524
|
this.masterCache.clear();
|
|
47448
47525
|
this.layoutXmlMap.clear();
|
|
47449
47526
|
this.masterXmlMap.clear();
|
|
47527
|
+
this.masterTxStylesCache.clear();
|
|
47450
47528
|
this.layoutPlaceholderDefaultsCache.clear();
|
|
47451
47529
|
this.masterPlaceholderDefaultsCache.clear();
|
|
47452
47530
|
this.themeOverrideCache.clear();
|
|
@@ -47467,10 +47545,12 @@ var PptxHandlerRuntime80 = class extends PptxHandlerRuntime79 {
|
|
|
47467
47545
|
this.detectDigitalSignatureParts();
|
|
47468
47546
|
await this.parseCustomXmlParts();
|
|
47469
47547
|
const presentationState = await this.loadPresentationState();
|
|
47548
|
+
const slideMasters = await this.parseSlideMasters();
|
|
47549
|
+
await this.enrichSlideMastersWithTxStyles(slideMasters);
|
|
47470
47550
|
const slides = await this.loadSlidesForPresentation(presentationState.sectionBySlideId);
|
|
47471
47551
|
const slidesWithWarnings = this.attachSlideWarnings(slides);
|
|
47472
47552
|
this.resetElementIdCounter(slides);
|
|
47473
|
-
return this.buildLoadData(presentationState, slidesWithWarnings);
|
|
47553
|
+
return this.buildLoadData(presentationState, slidesWithWarnings, slideMasters);
|
|
47474
47554
|
}
|
|
47475
47555
|
/**
|
|
47476
47556
|
* Retrieve the current background colour for a layout or master.
|
package/dist/index.mjs
CHANGED
|
@@ -21503,6 +21503,7 @@ var FONT_SUBSTITUTION_MAP = {
|
|
|
21503
21503
|
MoolBoran: ["Noto Sans Khmer", "sans-serif"],
|
|
21504
21504
|
// Decorative / Display
|
|
21505
21505
|
"Century Gothic": ["URW Gothic", "Futura", "sans-serif"],
|
|
21506
|
+
Oswald: ["Agency FB", "Arial Narrow", "sans-serif"],
|
|
21506
21507
|
"Franklin Gothic": ["Liberation Sans", "Helvetica Neue", "sans-serif"],
|
|
21507
21508
|
"Franklin Gothic Medium": ["Liberation Sans", "Helvetica Neue", "sans-serif"],
|
|
21508
21509
|
Garamond: ["EB Garamond", "Cormorant Garamond", "serif"],
|
|
@@ -31413,8 +31414,8 @@ var PptxHandlerRuntime18 = class extends PptxHandlerRuntime17 {
|
|
|
31413
31414
|
|
|
31414
31415
|
// src/core/core/runtime/PptxHandlerRuntimeTextRunStyleExtraction.ts
|
|
31415
31416
|
var PptxHandlerRuntime19 = class _PptxHandlerRuntime extends PptxHandlerRuntime18 {
|
|
31416
|
-
extractTextRunStyle(runProperties, align, relationshipMap) {
|
|
31417
|
-
const style = { align };
|
|
31417
|
+
extractTextRunStyle(runProperties, align, relationshipMap, includeDefaultAlignment = true) {
|
|
31418
|
+
const style = includeDefaultAlignment ? { align } : {};
|
|
31418
31419
|
if (!runProperties) {
|
|
31419
31420
|
return style;
|
|
31420
31421
|
}
|
|
@@ -38728,11 +38729,12 @@ var PptxHandlerRuntime42 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
38728
38729
|
if (!source) {
|
|
38729
38730
|
return true;
|
|
38730
38731
|
}
|
|
38732
|
+
const typesMatch = source.type === target.type || source.type === "ctrtitle" && target.type === "title" || source.type === "subtitle" && target.type === "body";
|
|
38731
38733
|
if (source.idx !== void 0 && target.idx !== void 0) {
|
|
38732
38734
|
if (source.idx !== target.idx) {
|
|
38733
38735
|
return false;
|
|
38734
38736
|
}
|
|
38735
|
-
if (source.type && target.type &&
|
|
38737
|
+
if (source.type && target.type && !typesMatch) {
|
|
38736
38738
|
return false;
|
|
38737
38739
|
}
|
|
38738
38740
|
return true;
|
|
@@ -38740,11 +38742,11 @@ var PptxHandlerRuntime42 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
38740
38742
|
if (source.idx !== void 0 && target.idx === void 0) {
|
|
38741
38743
|
const singletonTypes = /* @__PURE__ */ new Set(["title", "ctrtitle", "subtitle", "dt", "ftr", "sldnum"]);
|
|
38742
38744
|
if (source.type && singletonTypes.has(source.type)) {
|
|
38743
|
-
return
|
|
38745
|
+
return typesMatch;
|
|
38744
38746
|
}
|
|
38745
38747
|
return false;
|
|
38746
38748
|
}
|
|
38747
|
-
if (source.type && target.type &&
|
|
38749
|
+
if (source.type && target.type && !typesMatch) {
|
|
38748
38750
|
return false;
|
|
38749
38751
|
}
|
|
38750
38752
|
if (source.type && !target.type) {
|
|
@@ -38788,18 +38790,21 @@ var PptxHandlerRuntime43 = class extends PptxHandlerRuntime42 {
|
|
|
38788
38790
|
xmlPath(layoutXmlObj, "p:sldLayout", "p:cSld", "p:spTree"),
|
|
38789
38791
|
expected
|
|
38790
38792
|
);
|
|
38791
|
-
if (layoutContext) {
|
|
38792
|
-
return layoutContext;
|
|
38793
|
-
}
|
|
38794
38793
|
const masterPath = this.resolveMasterPathForLayout(layoutPath);
|
|
38795
|
-
|
|
38796
|
-
|
|
38797
|
-
}
|
|
38798
|
-
const masterXmlObj = this.masterXmlMap.get(masterPath);
|
|
38799
|
-
return this.findPlaceholderInShapeTree(
|
|
38800
|
-
xmlPath(masterXmlObj, "p:sldMaster", "p:cSld", "p:spTree"),
|
|
38794
|
+
const masterContext = masterPath ? this.findPlaceholderInShapeTree(
|
|
38795
|
+
xmlPath(this.masterXmlMap.get(masterPath), "p:sldMaster", "p:cSld", "p:spTree"),
|
|
38801
38796
|
expected
|
|
38802
|
-
);
|
|
38797
|
+
) : void 0;
|
|
38798
|
+
if (!layoutContext) {
|
|
38799
|
+
return masterContext;
|
|
38800
|
+
}
|
|
38801
|
+
if (!masterContext) {
|
|
38802
|
+
return layoutContext;
|
|
38803
|
+
}
|
|
38804
|
+
return {
|
|
38805
|
+
shape: layoutContext.shape || masterContext.shape ? this.mergeXmlObjects(masterContext.shape, layoutContext.shape) : void 0,
|
|
38806
|
+
picture: layoutContext.picture || masterContext.picture ? this.mergeXmlObjects(masterContext.picture, layoutContext.picture) : void 0
|
|
38807
|
+
};
|
|
38803
38808
|
}
|
|
38804
38809
|
mergeXmlObjects(base, override, depth = 0) {
|
|
38805
38810
|
const MAX_MERGE_DEPTH = 64;
|
|
@@ -38852,10 +38857,11 @@ var PptxHandlerRuntime43 = class extends PptxHandlerRuntime42 {
|
|
|
38852
38857
|
* otherwise falls back to `type`.
|
|
38853
38858
|
*/
|
|
38854
38859
|
buildPlaceholderDefaultsKey(phInfo) {
|
|
38860
|
+
const normalizedType = phInfo.type === "ctrtitle" ? "title" : phInfo.type === "subtitle" ? "body" : phInfo.type;
|
|
38855
38861
|
if (phInfo.idx !== void 0) {
|
|
38856
|
-
return
|
|
38862
|
+
return normalizedType ? `${normalizedType}_${phInfo.idx}` : `_${phInfo.idx}`;
|
|
38857
38863
|
}
|
|
38858
|
-
return
|
|
38864
|
+
return normalizedType ?? "body";
|
|
38859
38865
|
}
|
|
38860
38866
|
/**
|
|
38861
38867
|
* Look up merged {@link PlaceholderDefaults} for a shape's placeholder
|
|
@@ -38873,44 +38879,52 @@ var PptxHandlerRuntime43 = class extends PptxHandlerRuntime42 {
|
|
|
38873
38879
|
const masterPath = this.resolveMasterPathForLayout(layoutPath);
|
|
38874
38880
|
const masterMap = masterPath ? this.masterPlaceholderDefaultsCache.get(masterPath) : void 0;
|
|
38875
38881
|
const masterDefaults = masterMap?.get(phKey);
|
|
38876
|
-
|
|
38882
|
+
const normalizedType = this.buildPlaceholderDefaultsKey(phInfo).split("_")[0];
|
|
38883
|
+
const masterTextStyleType = phInfo.type === "title" || phInfo.type === "ctrtitle" ? "title" : phInfo.type === "body" || phInfo.type === "obj" || phInfo.type === "subtitle" ? "body" : "other";
|
|
38884
|
+
const masterTextStyles = masterPath ? this.masterTxStylesCache.get(masterPath) : void 0;
|
|
38885
|
+
const masterTextLevels = masterTextStyleType === "title" ? masterTextStyles?.titleStyle : masterTextStyleType === "body" ? masterTextStyles?.bodyStyle : masterTextStyles?.otherStyle;
|
|
38886
|
+
const resolvedMasterDefaults = masterTextLevels ? {
|
|
38887
|
+
type: masterDefaults?.type ?? normalizedType,
|
|
38888
|
+
...masterDefaults,
|
|
38889
|
+
levelStyles: this.mergePlaceholderLevelStyles(
|
|
38890
|
+
masterTextLevels,
|
|
38891
|
+
masterDefaults?.levelStyles
|
|
38892
|
+
)
|
|
38893
|
+
} : masterDefaults;
|
|
38894
|
+
if (!layoutDefaults && !resolvedMasterDefaults) {
|
|
38877
38895
|
return void 0;
|
|
38878
38896
|
}
|
|
38879
|
-
if (!
|
|
38897
|
+
if (!resolvedMasterDefaults) {
|
|
38880
38898
|
return layoutDefaults;
|
|
38881
38899
|
}
|
|
38882
38900
|
if (!layoutDefaults) {
|
|
38883
|
-
return
|
|
38901
|
+
return resolvedMasterDefaults;
|
|
38884
38902
|
}
|
|
38885
38903
|
const merged = {
|
|
38886
38904
|
type: layoutDefaults.type,
|
|
38887
|
-
idx: layoutDefaults.idx ??
|
|
38888
|
-
bodyInsetLeft: layoutDefaults.bodyInsetLeft ??
|
|
38889
|
-
bodyInsetTop: layoutDefaults.bodyInsetTop ??
|
|
38890
|
-
bodyInsetRight: layoutDefaults.bodyInsetRight ??
|
|
38891
|
-
bodyInsetBottom: layoutDefaults.bodyInsetBottom ??
|
|
38892
|
-
textAnchor: layoutDefaults.textAnchor ??
|
|
38893
|
-
autoFit: layoutDefaults.autoFit ??
|
|
38894
|
-
textWrap: layoutDefaults.textWrap ??
|
|
38895
|
-
promptText: layoutDefaults.promptText ??
|
|
38905
|
+
idx: layoutDefaults.idx ?? resolvedMasterDefaults.idx,
|
|
38906
|
+
bodyInsetLeft: layoutDefaults.bodyInsetLeft ?? resolvedMasterDefaults.bodyInsetLeft,
|
|
38907
|
+
bodyInsetTop: layoutDefaults.bodyInsetTop ?? resolvedMasterDefaults.bodyInsetTop,
|
|
38908
|
+
bodyInsetRight: layoutDefaults.bodyInsetRight ?? resolvedMasterDefaults.bodyInsetRight,
|
|
38909
|
+
bodyInsetBottom: layoutDefaults.bodyInsetBottom ?? resolvedMasterDefaults.bodyInsetBottom,
|
|
38910
|
+
textAnchor: layoutDefaults.textAnchor ?? resolvedMasterDefaults.textAnchor,
|
|
38911
|
+
autoFit: layoutDefaults.autoFit ?? resolvedMasterDefaults.autoFit,
|
|
38912
|
+
textWrap: layoutDefaults.textWrap ?? resolvedMasterDefaults.textWrap,
|
|
38913
|
+
promptText: layoutDefaults.promptText ?? resolvedMasterDefaults.promptText
|
|
38896
38914
|
};
|
|
38897
|
-
if (layoutDefaults.levelStyles ||
|
|
38898
|
-
|
|
38899
|
-
|
|
38900
|
-
|
|
38901
|
-
|
|
38902
|
-
|
|
38903
|
-
|
|
38904
|
-
|
|
38905
|
-
|
|
38906
|
-
|
|
38907
|
-
|
|
38908
|
-
|
|
38909
|
-
|
|
38910
|
-
mergedLevels[key] = layoutLevel ?? masterLevel;
|
|
38911
|
-
}
|
|
38912
|
-
}
|
|
38913
|
-
merged.levelStyles = mergedLevels;
|
|
38915
|
+
if (layoutDefaults.levelStyles || resolvedMasterDefaults.levelStyles) {
|
|
38916
|
+
merged.levelStyles = this.mergePlaceholderLevelStyles(
|
|
38917
|
+
resolvedMasterDefaults.levelStyles,
|
|
38918
|
+
layoutDefaults.levelStyles
|
|
38919
|
+
);
|
|
38920
|
+
}
|
|
38921
|
+
return merged;
|
|
38922
|
+
}
|
|
38923
|
+
mergePlaceholderLevelStyles(base, override) {
|
|
38924
|
+
const merged = {};
|
|
38925
|
+
for (const key of /* @__PURE__ */ new Set([...Object.keys(base ?? {}), ...Object.keys(override ?? {})])) {
|
|
38926
|
+
const level = Number.parseInt(key, 10);
|
|
38927
|
+
merged[level] = { ...base?.[level], ...override?.[level] };
|
|
38914
38928
|
}
|
|
38915
38929
|
return merged;
|
|
38916
38930
|
}
|
|
@@ -40208,7 +40222,11 @@ var PptxHandlerRuntime49 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
40208
40222
|
* for "first-wins" shape-level properties.
|
|
40209
40223
|
*/
|
|
40210
40224
|
resolveShapeParagraphStyle(p, textStyle, ctx) {
|
|
40211
|
-
const
|
|
40225
|
+
const inheritedParagraph = this.ensureArray(ctx.inheritedTxBody?.["a:p"])[0];
|
|
40226
|
+
const pPr = this.mergeXmlObjects(
|
|
40227
|
+
inheritedParagraph?.["a:pPr"],
|
|
40228
|
+
p["a:pPr"]
|
|
40229
|
+
);
|
|
40212
40230
|
const paragraphRtl = this.parseOptionalBooleanAttr(pPr?.["@_rtl"]);
|
|
40213
40231
|
if (paragraphRtl !== void 0 && textStyle.rtl === void 0) {
|
|
40214
40232
|
textStyle.rtl = paragraphRtl;
|
|
@@ -40324,24 +40342,28 @@ var PptxHandlerRuntime49 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
40324
40342
|
const defaultRunStyle = this.extractTextRunStyle(
|
|
40325
40343
|
pPr?.["a:defRPr"],
|
|
40326
40344
|
paraAlign,
|
|
40327
|
-
ctx.slideRelationshipMap
|
|
40345
|
+
ctx.slideRelationshipMap,
|
|
40346
|
+
false
|
|
40328
40347
|
);
|
|
40329
|
-
const level = Number.parseInt(String(pPr
|
|
40330
|
-
const levelKey = `a:lvl${Number.isFinite(level) ? Math.min(Math.max(level + 1, 1), 9) : 1}pPr`;
|
|
40348
|
+
const level = pPr?.["@_lvl"] === void 0 ? -1 : Number.parseInt(String(pPr["@_lvl"]), 10);
|
|
40349
|
+
const levelKey = level === -1 ? "a:defPPr" : `a:lvl${Number.isFinite(level) ? Math.min(Math.max(level + 1, 1), 9) : 1}pPr`;
|
|
40331
40350
|
const inheritedLevelStyle = this.extractTextRunStyle(
|
|
40332
40351
|
ctx.inheritedTxBody?.["a:lstStyle"]?.[levelKey]?.["a:defRPr"],
|
|
40333
40352
|
paraAlign,
|
|
40334
|
-
ctx.slideRelationshipMap
|
|
40353
|
+
ctx.slideRelationshipMap,
|
|
40354
|
+
false
|
|
40335
40355
|
);
|
|
40336
40356
|
const bodyLevelStyle = this.extractTextRunStyle(
|
|
40337
40357
|
ctx.txBody?.["a:lstStyle"]?.[levelKey]?.["a:defRPr"],
|
|
40338
40358
|
paraAlign,
|
|
40339
|
-
ctx.slideRelationshipMap
|
|
40359
|
+
ctx.slideRelationshipMap,
|
|
40360
|
+
false
|
|
40340
40361
|
);
|
|
40341
40362
|
const endParagraphStyle = this.extractTextRunStyle(
|
|
40342
40363
|
p?.["a:endParaRPr"],
|
|
40343
40364
|
paraAlign,
|
|
40344
|
-
ctx.slideRelationshipMap
|
|
40365
|
+
ctx.slideRelationshipMap,
|
|
40366
|
+
false
|
|
40345
40367
|
);
|
|
40346
40368
|
const mergedDefaultRunStyle = {
|
|
40347
40369
|
...ctx.bodyDefaultRunStyle,
|
|
@@ -40351,20 +40373,23 @@ var PptxHandlerRuntime49 = class _PptxHandlerRuntime extends PptxHandlerRuntime4
|
|
|
40351
40373
|
...defaultRunStyle
|
|
40352
40374
|
};
|
|
40353
40375
|
if (ctx.effectiveLevelStyles) {
|
|
40354
|
-
const normalizedLevel = Number.isFinite(level) ? Math.min(Math.max(level, 0), 8) : 0;
|
|
40355
|
-
const phLevel = ctx.effectiveLevelStyles[normalizedLevel] ?? ctx.effectiveLevelStyles[-1];
|
|
40376
|
+
const normalizedLevel = level === -1 ? -1 : Number.isFinite(level) ? Math.min(Math.max(level, 0), 8) : 0;
|
|
40377
|
+
const phLevel = ctx.effectiveLevelStyles[normalizedLevel] ?? ctx.effectiveLevelStyles[-1] ?? (normalizedLevel === -1 ? ctx.effectiveLevelStyles[0] : void 0);
|
|
40356
40378
|
if (phLevel) {
|
|
40357
40379
|
this.applyPlaceholderLevelDefaults(mergedDefaultRunStyle, phLevel);
|
|
40358
40380
|
this.applyPlaceholderLevelDefaults(textStyle, phLevel);
|
|
40359
40381
|
}
|
|
40360
40382
|
}
|
|
40383
|
+
if (pPr?.["@_algn"] === void 0 && textStyle.align !== void 0) {
|
|
40384
|
+
paraAlign = textStyle.align;
|
|
40385
|
+
}
|
|
40361
40386
|
const parMarginLeft = pPr?.["@_marL"] !== void 0 ? Number.parseInt(String(pPr["@_marL"]), 10) / _PptxHandlerRuntime.EMU_PER_PX : void 0;
|
|
40362
40387
|
const parIndent = pPr?.["@_indent"] !== void 0 ? Number.parseInt(String(pPr["@_indent"]), 10) / _PptxHandlerRuntime.EMU_PER_PX : void 0;
|
|
40363
40388
|
let effectiveMarginLeft = parMarginLeft;
|
|
40364
40389
|
let effectiveIndent = parIndent;
|
|
40365
40390
|
if (ctx.effectiveLevelStyles) {
|
|
40366
|
-
const normalizedLevel = Number.isFinite(level) ? Math.min(Math.max(level, 0), 8) : 0;
|
|
40367
|
-
const phLevel = ctx.effectiveLevelStyles[normalizedLevel] ?? ctx.effectiveLevelStyles[-1];
|
|
40391
|
+
const normalizedLevel = level === -1 ? -1 : Number.isFinite(level) ? Math.min(Math.max(level, 0), 8) : 0;
|
|
40392
|
+
const phLevel = ctx.effectiveLevelStyles[normalizedLevel] ?? ctx.effectiveLevelStyles[-1] ?? (normalizedLevel === -1 ? ctx.effectiveLevelStyles[0] : void 0);
|
|
40368
40393
|
if (phLevel) {
|
|
40369
40394
|
if (effectiveMarginLeft === void 0 && phLevel.marginLeft !== void 0) {
|
|
40370
40395
|
effectiveMarginLeft = phLevel.marginLeft;
|
|
@@ -40530,11 +40555,23 @@ var PptxHandlerRuntime50 = class extends PptxHandlerRuntime49 {
|
|
|
40530
40555
|
continue;
|
|
40531
40556
|
}
|
|
40532
40557
|
const items = this.ensureArray(p[key]);
|
|
40533
|
-
|
|
40558
|
+
const rawBreaks = p["a:br"];
|
|
40559
|
+
const breakCount = Array.isArray(rawBreaks) ? rawBreaks.length : rawBreaks === void 0 ? 0 : 1;
|
|
40560
|
+
const insertCollapsedBreaks = key === "a:r" && items.length > 1 && breakCount > 0;
|
|
40561
|
+
for (const [itemIndex, item] of items.entries()) {
|
|
40534
40562
|
switch (key) {
|
|
40535
|
-
case "a:r":
|
|
40563
|
+
case "a:r": {
|
|
40536
40564
|
processRun(item);
|
|
40565
|
+
if (insertCollapsedBreaks && itemIndex < Math.min(items.length - 1, breakCount)) {
|
|
40566
|
+
parts.push("\n");
|
|
40567
|
+
segments.push({
|
|
40568
|
+
text: "\n",
|
|
40569
|
+
style: { ...mergedDefaultRunStyle },
|
|
40570
|
+
isLineBreak: true
|
|
40571
|
+
});
|
|
40572
|
+
}
|
|
40537
40573
|
break;
|
|
40574
|
+
}
|
|
40538
40575
|
case "a:fld":
|
|
40539
40576
|
processField(item);
|
|
40540
40577
|
break;
|
|
@@ -40552,6 +40589,9 @@ var PptxHandlerRuntime50 = class extends PptxHandlerRuntime49 {
|
|
|
40552
40589
|
processAlternateContent(item);
|
|
40553
40590
|
break;
|
|
40554
40591
|
case "a:br": {
|
|
40592
|
+
if (insertCollapsedBreaks) {
|
|
40593
|
+
break;
|
|
40594
|
+
}
|
|
40555
40595
|
const brNode = item ?? {};
|
|
40556
40596
|
const brRunProps = brNode["a:rPr"];
|
|
40557
40597
|
const brStyle = {
|
|
@@ -40714,7 +40754,13 @@ var PptxHandlerRuntime51 = class _PptxHandlerRuntime extends PptxHandlerRuntime5
|
|
|
40714
40754
|
);
|
|
40715
40755
|
const inheritedPlaceholder = slidePath && placeholderInfo ? this.findPlaceholderContext(slidePath, placeholderInfo) : void 0;
|
|
40716
40756
|
const inheritedSpPr = inheritedPlaceholder?.shape?.["p:spPr"] || inheritedPlaceholder?.picture?.["p:spPr"];
|
|
40717
|
-
const effectiveSpPr =
|
|
40757
|
+
const effectiveSpPr = spPr ? {
|
|
40758
|
+
...spPr,
|
|
40759
|
+
"a:xfrm": this.mergeXmlObjects(
|
|
40760
|
+
inheritedSpPr?.["a:xfrm"],
|
|
40761
|
+
spPr["a:xfrm"]
|
|
40762
|
+
)
|
|
40763
|
+
} : inheritedSpPr;
|
|
40718
40764
|
const xfrm = effectiveSpPr?.["a:xfrm"] || spPr?.["a:xfrm"] || inheritedSpPr?.["a:xfrm"];
|
|
40719
40765
|
if (!xfrm) {
|
|
40720
40766
|
return null;
|
|
@@ -40792,14 +40838,16 @@ var PptxHandlerRuntime51 = class _PptxHandlerRuntime extends PptxHandlerRuntime5
|
|
|
40792
40838
|
const inheritedBodyDefaultRunStyle = this.extractTextRunStyle(
|
|
40793
40839
|
xmlPath(inheritedTxBody, "a:lstStyle", "a:defPPr", "a:defRPr"),
|
|
40794
40840
|
"left",
|
|
40795
|
-
slideRelationshipMap
|
|
40841
|
+
slideRelationshipMap,
|
|
40842
|
+
false
|
|
40796
40843
|
);
|
|
40797
40844
|
const bodyDefaultRunStyle = {
|
|
40798
40845
|
...inheritedBodyDefaultRunStyle,
|
|
40799
40846
|
...this.extractTextRunStyle(
|
|
40800
40847
|
xmlPath(txBody, "a:lstStyle", "a:defPPr", "a:defRPr"),
|
|
40801
40848
|
"left",
|
|
40802
|
-
slideRelationshipMap
|
|
40849
|
+
slideRelationshipMap,
|
|
40850
|
+
false
|
|
40803
40851
|
)
|
|
40804
40852
|
};
|
|
40805
40853
|
Object.assign(textStyle, bodyDefaultRunStyle);
|
|
@@ -43186,6 +43234,21 @@ var PptxHandlerRuntime61 = class extends PptxHandlerRuntime60 {
|
|
|
43186
43234
|
element.id = `master-${element.id}`;
|
|
43187
43235
|
elements.push(element);
|
|
43188
43236
|
}
|
|
43237
|
+
} else if (entry.tag === "p:cxnSp") {
|
|
43238
|
+
const connectors = this.ensureArray(spTree["p:cxnSp"]);
|
|
43239
|
+
const connector = connectors[entry.indexInType];
|
|
43240
|
+
if (!connector) {
|
|
43241
|
+
continue;
|
|
43242
|
+
}
|
|
43243
|
+
const element = this.parseConnector(
|
|
43244
|
+
connector,
|
|
43245
|
+
`master-conn-${masterToken}-${entry.indexInType}`,
|
|
43246
|
+
masterPath
|
|
43247
|
+
);
|
|
43248
|
+
if (element) {
|
|
43249
|
+
element.id = `master-${element.id}`;
|
|
43250
|
+
elements.push(element);
|
|
43251
|
+
}
|
|
43189
43252
|
}
|
|
43190
43253
|
}
|
|
43191
43254
|
this.masterCache.set(masterPath, elements);
|
|
@@ -43324,6 +43387,21 @@ var PptxHandlerRuntime62 = class extends PptxHandlerRuntime61 {
|
|
|
43324
43387
|
element.id = `layout-${element.id}`;
|
|
43325
43388
|
elements.push(element);
|
|
43326
43389
|
}
|
|
43390
|
+
} else if (entry.tag === "p:cxnSp") {
|
|
43391
|
+
const connectors = this.ensureArray(spTree["p:cxnSp"]);
|
|
43392
|
+
const connector = connectors[entry.indexInType];
|
|
43393
|
+
if (!connector) {
|
|
43394
|
+
continue;
|
|
43395
|
+
}
|
|
43396
|
+
const element = this.parseConnector(
|
|
43397
|
+
connector,
|
|
43398
|
+
`layout-conn-${layoutToken}-${entry.indexInType}`,
|
|
43399
|
+
layoutPath
|
|
43400
|
+
);
|
|
43401
|
+
if (element) {
|
|
43402
|
+
element.id = `layout-${element.id}`;
|
|
43403
|
+
elements.push(element);
|
|
43404
|
+
}
|
|
43327
43405
|
}
|
|
43328
43406
|
}
|
|
43329
43407
|
const layoutShowMasterSp = xmlAttr(
|
|
@@ -47027,6 +47105,7 @@ var PptxHandlerRuntime79 = class _PptxHandlerRuntime extends PptxHandlerRuntime7
|
|
|
47027
47105
|
this.masterCache.clear();
|
|
47028
47106
|
this.layoutXmlMap.clear();
|
|
47029
47107
|
this.masterXmlMap.clear();
|
|
47108
|
+
this.masterTxStylesCache.clear();
|
|
47030
47109
|
if (typeof globalThis.URL?.revokeObjectURL === "function" && this.blobUrlCache.size > 0) {
|
|
47031
47110
|
for (const url of this.blobUrlCache) {
|
|
47032
47111
|
URL.revokeObjectURL(url);
|
|
@@ -47311,7 +47390,7 @@ var PptxHandlerRuntime79 = class _PptxHandlerRuntime extends PptxHandlerRuntime7
|
|
|
47311
47390
|
|
|
47312
47391
|
// src/core/core/runtime/PptxHandlerRuntimeLoadPipeline.ts
|
|
47313
47392
|
var PptxHandlerRuntime80 = class extends PptxHandlerRuntime79 {
|
|
47314
|
-
async buildLoadData(presentationState, slidesWithWarnings) {
|
|
47393
|
+
async buildLoadData(presentationState, slidesWithWarnings, slideMasters) {
|
|
47315
47394
|
const headerFooter = this.extractHeaderFooter();
|
|
47316
47395
|
const presentationProperties = await this.parsePresentationProperties();
|
|
47317
47396
|
const customShows = this.parseCustomShows();
|
|
@@ -47321,8 +47400,6 @@ var PptxHandlerRuntime80 = class extends PptxHandlerRuntime79 {
|
|
|
47321
47400
|
const themeOptions = await this.parseThemeOptions();
|
|
47322
47401
|
const notesMaster = await this.parseNotesMaster();
|
|
47323
47402
|
const handoutMaster = await this.parseHandoutMaster();
|
|
47324
|
-
const slideMasters = await this.parseSlideMasters();
|
|
47325
|
-
await this.enrichSlideMastersWithTxStyles(slideMasters);
|
|
47326
47403
|
const tags = await this.parseTags();
|
|
47327
47404
|
const customProperties = await this.parseCustomProperties();
|
|
47328
47405
|
const coreProperties = await this.parseCoreProperties();
|
|
@@ -47442,6 +47519,7 @@ var PptxHandlerRuntime80 = class extends PptxHandlerRuntime79 {
|
|
|
47442
47519
|
this.masterCache.clear();
|
|
47443
47520
|
this.layoutXmlMap.clear();
|
|
47444
47521
|
this.masterXmlMap.clear();
|
|
47522
|
+
this.masterTxStylesCache.clear();
|
|
47445
47523
|
this.layoutPlaceholderDefaultsCache.clear();
|
|
47446
47524
|
this.masterPlaceholderDefaultsCache.clear();
|
|
47447
47525
|
this.themeOverrideCache.clear();
|
|
@@ -47462,10 +47540,12 @@ var PptxHandlerRuntime80 = class extends PptxHandlerRuntime79 {
|
|
|
47462
47540
|
this.detectDigitalSignatureParts();
|
|
47463
47541
|
await this.parseCustomXmlParts();
|
|
47464
47542
|
const presentationState = await this.loadPresentationState();
|
|
47543
|
+
const slideMasters = await this.parseSlideMasters();
|
|
47544
|
+
await this.enrichSlideMastersWithTxStyles(slideMasters);
|
|
47465
47545
|
const slides = await this.loadSlidesForPresentation(presentationState.sectionBySlideId);
|
|
47466
47546
|
const slidesWithWarnings = this.attachSlideWarnings(slides);
|
|
47467
47547
|
this.resetElementIdCounter(slides);
|
|
47468
|
-
return this.buildLoadData(presentationState, slidesWithWarnings);
|
|
47548
|
+
return this.buildLoadData(presentationState, slidesWithWarnings, slideMasters);
|
|
47469
47549
|
}
|
|
47470
47550
|
/**
|
|
47471
47551
|
* Retrieve the current background colour for a layout or master.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pptx-viewer-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "PowerPoint PPTX engine: parse, edit, serialize, and convert .pptx files. Framework-agnostic TypeScript SDK.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
79
|
"emf-converter": "^1.5.0",
|
|
80
|
-
"fast-xml-parser": "^5.
|
|
80
|
+
"fast-xml-parser": "^5.10.0",
|
|
81
81
|
"jszip": "^3.10.1",
|
|
82
82
|
"mtx-decompressor": "^1.4.2"
|
|
83
83
|
},
|