@bendyline/squisq-formats 2.3.4 → 2.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE.md +8 -7
- package/THIRD_PARTY_LICENSES.txt +170 -0
- package/dist/{chunk-TAAENIRB.js → chunk-6N2J7C2B.js} +1 -1
- package/dist/{chunk-SBUW7NHR.js → chunk-6X5XN3CZ.js} +2 -0
- package/dist/{chunk-26ISNJ7Y.js → chunk-BGDN7BXK.js} +49 -7
- package/dist/{chunk-GX7RAUME.js → chunk-DWNNYO5H.js} +3 -1
- package/dist/{chunk-4V3KCHAP.js → chunk-ILCJ3WFD.js} +1 -1
- package/dist/{chunk-6S6GU3ZG.js → chunk-KMBBO5H7.js} +3 -3
- package/dist/{chunk-K6XRMVPW.js → chunk-KN62QJYK.js} +42 -5
- package/dist/{chunk-GYIVES2E.js → chunk-KT5DX2QP.js} +42 -1
- package/dist/{chunk-EJTNGKEA.js → chunk-OK622ILP.js} +1 -1
- package/dist/{chunk-X2DEAXNK.js → chunk-S5PCVMKU.js} +6 -0
- package/dist/{chunk-C22NYDN2.js → chunk-TBB4PAX5.js} +111 -20
- package/dist/{chunk-OGS5VCGJ.js → chunk-UIBTXX4L.js} +3 -3
- package/dist/chunk-USU6HTKB.js +94 -0
- package/dist/{chunk-PU7REGWV.js → chunk-WATAOG4Y.js} +2 -2
- package/dist/docx/index.js +6 -5
- package/dist/epub/index.js +3 -2
- package/dist/{extract-MN7LA3NL.js → extract-UTAOG7LV.js} +3 -3
- package/dist/index.js +15 -14
- package/dist/infer/index.js +4 -4
- package/dist/{layouts-DRWZGSPD.js → layouts-2A7QNF6Y.js} +2 -2
- package/dist/ooxml/index.d.ts +7 -1
- package/dist/ooxml/index.js +9 -3
- package/dist/pdf/index.d.ts +2 -2
- package/dist/pdf/index.js +2 -1
- package/dist/pptx/index.js +7 -6
- package/dist/registry/index.js +1 -1
- package/dist/xlsx/index.js +4 -4
- package/package.json +6 -4
- /package/dist/{chunk-YLDQWCHS.js → chunk-GK23NBPZ.js} +0 -0
|
@@ -4,19 +4,20 @@ import {
|
|
|
4
4
|
inlineNodesToRuns,
|
|
5
5
|
sanitizeOfficeHyperlink,
|
|
6
6
|
toOoxmlHex
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-DWNNYO5H.js";
|
|
8
8
|
import {
|
|
9
9
|
extractPlainText,
|
|
10
10
|
stripHtmlTags
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-6X5XN3CZ.js";
|
|
12
12
|
import {
|
|
13
13
|
createPackage
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-ILCJ3WFD.js";
|
|
15
15
|
import {
|
|
16
16
|
escapeXml,
|
|
17
17
|
xmlDeclaration
|
|
18
18
|
} from "./chunk-JU2RHXUB.js";
|
|
19
19
|
import {
|
|
20
|
+
CONTENT_TYPE_PPTX_FONT,
|
|
20
21
|
CONTENT_TYPE_PPTX_PRESENTATION,
|
|
21
22
|
CONTENT_TYPE_PPTX_SLIDE,
|
|
22
23
|
CONTENT_TYPE_PPTX_SLIDE_LAYOUT,
|
|
@@ -27,6 +28,7 @@ import {
|
|
|
27
28
|
NS_PML,
|
|
28
29
|
NS_PML_2010,
|
|
29
30
|
NS_R,
|
|
31
|
+
REL_FONT,
|
|
30
32
|
REL_HYPERLINK,
|
|
31
33
|
REL_IMAGE,
|
|
32
34
|
REL_OFFICE_DOCUMENT,
|
|
@@ -42,10 +44,15 @@ import {
|
|
|
42
44
|
openPackage,
|
|
43
45
|
requireMainPartPath,
|
|
44
46
|
resolveTarget
|
|
45
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-S5PCVMKU.js";
|
|
46
48
|
import {
|
|
47
49
|
buildContainer
|
|
48
50
|
} from "./chunk-IIQYS2YH.js";
|
|
51
|
+
import {
|
|
52
|
+
fontAwesomeFace,
|
|
53
|
+
fontAwesomeFaces,
|
|
54
|
+
fontAwesomeGlyph
|
|
55
|
+
} from "./chunk-USU6HTKB.js";
|
|
49
56
|
import {
|
|
50
57
|
inferMimeType
|
|
51
58
|
} from "./chunk-6RQOV3B3.js";
|
|
@@ -65,7 +72,7 @@ import {
|
|
|
65
72
|
resolvePersistentLayers,
|
|
66
73
|
resolveThemeForDoc
|
|
67
74
|
} from "@bendyline/squisq/doc";
|
|
68
|
-
import {
|
|
75
|
+
import { splitIconMarkers } from "@bendyline/squisq/icon-marker";
|
|
69
76
|
import { readFrontmatterThemeId } from "@bendyline/squisq/markdown";
|
|
70
77
|
|
|
71
78
|
// src/pptx/styles.ts
|
|
@@ -87,12 +94,15 @@ var DEFAULT_CODE_SIZE = 1400;
|
|
|
87
94
|
var HYPERLINK_COLOR = "0563C1";
|
|
88
95
|
|
|
89
96
|
// src/pptx/templates.ts
|
|
90
|
-
function buildPresentationXml(slideCount, slideRelIds, slideMasterRelId, _themeRelId) {
|
|
97
|
+
function buildPresentationXml(slideCount, slideRelIds, slideMasterRelId, _themeRelId, embeddedFonts = []) {
|
|
91
98
|
const sldIdList = [];
|
|
92
99
|
for (let i = 0; i < slideCount; i++) {
|
|
93
100
|
sldIdList.push(`<p:sldId id="${256 + i}" r:id="${slideRelIds[i]}"/>`);
|
|
94
101
|
}
|
|
95
|
-
|
|
102
|
+
const embeddedFontList = embeddedFonts.length > 0 ? `<p:embeddedFontLst>${embeddedFonts.map(
|
|
103
|
+
({ typeface, relId }) => `<p:embeddedFont><p:font typeface="${escapeXml(typeface)}" charset="0" pitchFamily="34"/><p:regular r:id="${escapeXml(relId)}"/></p:embeddedFont>`
|
|
104
|
+
).join("")}</p:embeddedFontLst>` : "";
|
|
105
|
+
return xmlDeclaration() + `<p:presentation xmlns:a="${NS_DRAWINGML}" xmlns:r="${NS_R}" xmlns:p="${NS_PML}" saveSubsetFonts="1"><p:sldMasterIdLst><p:sldMasterId id="2147483648" r:id="${slideMasterRelId}"/></p:sldMasterIdLst><p:sldIdLst>${sldIdList.join("")}</p:sldIdLst><p:sldSz cx="${SLIDE_WIDTH}" cy="${SLIDE_HEIGHT}" type="screen16x9"/><p:notesSz cx="${SLIDE_HEIGHT}" cy="${SLIDE_WIDTH}"/>` + embeddedFontList + `</p:presentation>`;
|
|
96
106
|
}
|
|
97
107
|
function buildSlideMasterXml(layoutRelId) {
|
|
98
108
|
return xmlDeclaration() + `<p:sldMaster xmlns:a="${NS_DRAWINGML}" xmlns:r="${NS_R}" xmlns:p="${NS_PML}"><p:cSld><p:bg><p:bgRef idx="1001"><a:schemeClr val="bg1"/></p:bgRef></p:bg><p:spTree><p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr/></p:spTree></p:cSld><p:clrMap bg1="lt1" tx1="dk1" bg2="lt2" tx2="dk2" accent1="accent1" accent2="accent2" accent3="accent3" accent4="accent4" accent5="accent5" accent6="accent6" hlink="hlink" folHlink="folHlink"/><p:sldLayoutIdLst><p:sldLayoutId id="2147483649" r:id="${layoutRelId}"/></p:sldLayoutIdLst></p:sldMaster>`;
|
|
@@ -152,7 +162,11 @@ async function docToPptx(doc, options = {}) {
|
|
|
152
162
|
viewport: VIEWPORT_PRESETS.landscape,
|
|
153
163
|
persistentLayers,
|
|
154
164
|
theme,
|
|
155
|
-
customTemplates: doc.customTemplates
|
|
165
|
+
customTemplates: doc.customTemplates,
|
|
166
|
+
// A .pptx is a discrete deck: the >20s pacing split would emit N identical
|
|
167
|
+
// copies of one authored slide (a long single block became 18 duplicates).
|
|
168
|
+
// Keep one authored slide as one slide, matching the slideshow.
|
|
169
|
+
splitLongBlocks: false
|
|
156
170
|
});
|
|
157
171
|
const slideBlocks = [];
|
|
158
172
|
if (shouldIncludeCoverSlide(doc, effectiveOptions) && doc.startBlock) {
|
|
@@ -249,7 +263,7 @@ function segmentIntoSlides(children, slideBreak) {
|
|
|
249
263
|
if (node.type === "heading" && node.depth <= maxDepth) {
|
|
250
264
|
if (current) slides.push(current);
|
|
251
265
|
current = {
|
|
252
|
-
title:
|
|
266
|
+
title: node.children,
|
|
253
267
|
titleDepth: node.depth,
|
|
254
268
|
transition: node.attributes?.blockMeta?.transition,
|
|
255
269
|
bodyNodes: []
|
|
@@ -276,6 +290,8 @@ var SlideContext = class {
|
|
|
276
290
|
this.relationships = [];
|
|
277
291
|
this.embeddedImages = [];
|
|
278
292
|
this.nextShapeId = 4;
|
|
293
|
+
/** Font Awesome families referenced by semantic or materialized text runs. */
|
|
294
|
+
this.iconFamilies = /* @__PURE__ */ new Set();
|
|
279
295
|
this.style = style;
|
|
280
296
|
this.images = images;
|
|
281
297
|
this.slideIndex = slideIndex;
|
|
@@ -328,8 +344,8 @@ function buildSlideXml(slide, ctx) {
|
|
|
328
344
|
shapes.push(
|
|
329
345
|
`<p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr/>`
|
|
330
346
|
);
|
|
331
|
-
if (slide.title) {
|
|
332
|
-
shapes.push(buildTitleShape(slide.title, ctx
|
|
347
|
+
if (slide.title?.length) {
|
|
348
|
+
shapes.push(buildTitleShape(slide.title, ctx));
|
|
333
349
|
}
|
|
334
350
|
const bodyParas = convertBodyBlocks(slide.bodyNodes, ctx);
|
|
335
351
|
const hasImages = ctx.embeddedImages.length > 0;
|
|
@@ -392,6 +408,12 @@ function buildLayerSlideXml(block, ctx) {
|
|
|
392
408
|
`<p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr/>`
|
|
393
409
|
];
|
|
394
410
|
const textLayerY = (block.layers ?? []).filter((layer) => layer.type === "text").map((layer) => resolvePositionValue(layer.position.y, 1080));
|
|
411
|
+
for (const layer of block.layers ?? []) {
|
|
412
|
+
if (layer.type !== "text") continue;
|
|
413
|
+
for (const run of splitIconMarkers(layer.content.text ?? "")) {
|
|
414
|
+
if (run.type === "icon") ctx.iconFamilies.add(run.family);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
395
417
|
for (let index = 0; index < (block.layers?.length ?? 0); index++) {
|
|
396
418
|
if ((index & 31) === 0) ctx.signal?.throwIfAborted();
|
|
397
419
|
const layer = block.layers[index];
|
|
@@ -560,7 +582,8 @@ function toEmuRect(rect) {
|
|
|
560
582
|
};
|
|
561
583
|
}
|
|
562
584
|
function buildLayerTextShape(layer, shapeId, maxBottom) {
|
|
563
|
-
const
|
|
585
|
+
const sourceText = layer.content.text ?? "";
|
|
586
|
+
const text = splitIconMarkers(sourceText).map((run) => run.type === "text" ? run.text : "M").join("");
|
|
564
587
|
const style = layer.content.style;
|
|
565
588
|
const padding = style.padding ?? 0;
|
|
566
589
|
const rawLines = text.split("\n");
|
|
@@ -595,14 +618,14 @@ function buildLayerTextShape(layer, shapeId, maxBottom) {
|
|
|
595
618
|
const vertical = style.verticalAlign === "bottom" ? "b" : style.verticalAlign === "middle" ? "ctr" : "t";
|
|
596
619
|
const inset = Math.max(0, Math.round(padding / 1920 * SLIDE_WIDTH));
|
|
597
620
|
const bodyPr = `<a:bodyPr wrap="square" anchor="${vertical}" vertOverflow="clip" horzOverflow="clip" lIns="${inset}" rIns="${inset}" tIns="${inset}" bIns="${inset}"><a:noAutofit/></a:bodyPr>`;
|
|
598
|
-
const paragraphs =
|
|
621
|
+
const paragraphs = sourceText.split("\n").map((line) => buildLayerTextParagraph(line, renderedStyle, align)).join("");
|
|
599
622
|
return `<p:sp><p:nvSpPr><p:cNvPr id="${shapeId}" name="${escapeXml(layer.id)}"/><p:cNvSpPr txBox="1"/><p:nvPr/></p:nvSpPr><p:spPr><a:xfrm><a:off x="${rect.x}" y="${rect.y}"/><a:ext cx="${rect.width}" cy="${rect.height}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom>` + fillXml(style.background, style.backgroundOpacity, style.backgroundGradient) + lineXml(style.borderColor, style.borderWidth, style.borderStyle) + `</p:spPr><p:txBody>${bodyPr}<a:lstStyle/>${paragraphs}</p:txBody></p:sp>`;
|
|
600
623
|
}
|
|
601
624
|
function buildLayerTextParagraph(text, style, align) {
|
|
602
625
|
const size = Math.max(100, Math.round(style.fontSize * 75));
|
|
603
626
|
const color = parseCssColor(style.color, "000000");
|
|
604
627
|
const typeface = officeTypeface(style.fontFamily, DEFAULT_FONT);
|
|
605
|
-
const
|
|
628
|
+
const textRunProperties = [
|
|
606
629
|
`lang="en-US"`,
|
|
607
630
|
`dirty="0"`,
|
|
608
631
|
`sz="${size}"`,
|
|
@@ -610,7 +633,17 @@ function buildLayerTextParagraph(text, style, align) {
|
|
|
610
633
|
...style.fontStyle === "italic" ? ['i="1"'] : []
|
|
611
634
|
].join(" ");
|
|
612
635
|
const lineSpacing = Math.max(1e4, Math.round((style.lineHeight ?? 1.4) * 1e5));
|
|
613
|
-
|
|
636
|
+
const runs = splitIconMarkers(text).map((run) => {
|
|
637
|
+
if (run.type === "text") {
|
|
638
|
+
if (!run.text) return "";
|
|
639
|
+
return `<a:r><a:rPr ${textRunProperties}>${solidColorXml(color)}<a:latin typeface="${escapeXml(typeface)}"/></a:rPr><a:t>${escapeXml(run.text)}</a:t></a:r>`;
|
|
640
|
+
}
|
|
641
|
+
const glyph = fontAwesomeGlyph(run.family, run.name);
|
|
642
|
+
if (!glyph) return "";
|
|
643
|
+
const iconTypeface = fontAwesomeFace(run.family).typeface;
|
|
644
|
+
return `<a:r><a:rPr lang="en-US" dirty="0" sz="${size}">${solidColorXml(color)}<a:latin typeface="${escapeXml(iconTypeface)}"/></a:rPr><a:t>${escapeXml(glyph)}</a:t></a:r>`;
|
|
645
|
+
}).join("");
|
|
646
|
+
return `<a:p><a:pPr algn="${align}"><a:lnSpc><a:spcPct val="${lineSpacing}"/></a:lnSpc></a:pPr>` + (runs || `<a:r><a:rPr ${textRunProperties}>${solidColorXml(color)}<a:latin typeface="${escapeXml(typeface)}"/></a:rPr><a:t> </a:t></a:r>`) + `</a:p>`;
|
|
614
647
|
}
|
|
615
648
|
function buildLayerShape(layer, shapeId) {
|
|
616
649
|
const rect = toEmuRect(resolveLayerRect(layer.position, 100, 100));
|
|
@@ -985,8 +1018,37 @@ function orientation(direction) {
|
|
|
985
1018
|
function inOutDir(direction, fallback) {
|
|
986
1019
|
return direction === "out" ? "out" : direction === "in" ? "in" : fallback;
|
|
987
1020
|
}
|
|
988
|
-
function buildTitleShape(title,
|
|
989
|
-
|
|
1021
|
+
function buildTitleShape(title, ctx) {
|
|
1022
|
+
const runs = inlineNodesToRuns(title, titleRunHandlers(ctx));
|
|
1023
|
+
return `<p:sp><p:nvSpPr><p:cNvPr id="2" name="Title"/><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="title"/></p:nvPr></p:nvSpPr><p:spPr><a:xfrm><a:off x="${TITLE_LEFT}" y="${TITLE_TOP}"/><a:ext cx="${TITLE_WIDTH}" cy="${TITLE_HEIGHT}"/></a:xfrm></p:spPr><p:txBody><a:bodyPr/><a:lstStyle/><a:p>` + runs + `</a:p></p:txBody></p:sp>`;
|
|
1024
|
+
}
|
|
1025
|
+
function titleRunHandlers(ctx) {
|
|
1026
|
+
const handlers = {
|
|
1027
|
+
run: (text, format) => makeTitleRun(text, format, ctx.style),
|
|
1028
|
+
link: (node, format) => inlineNodesToRuns(node.children, handlers, format),
|
|
1029
|
+
image: (node, format) => makeTitleRun(node.alt ?? "", format, ctx.style),
|
|
1030
|
+
icon: (node, format) => makeTitleIconRun(node, format, ctx),
|
|
1031
|
+
lineBreak: () => `<a:br/>`
|
|
1032
|
+
};
|
|
1033
|
+
return handlers;
|
|
1034
|
+
}
|
|
1035
|
+
function makeTitleRun(text, format, style) {
|
|
1036
|
+
if (!text) return "";
|
|
1037
|
+
const attrs = [`lang="en-US"`, `dirty="0"`, `sz="${DEFAULT_TITLE_SIZE}"`];
|
|
1038
|
+
if (format.bold) attrs.push(`b="1"`);
|
|
1039
|
+
if (format.italic) attrs.push(`i="1"`);
|
|
1040
|
+
if (format.strike) attrs.push(`strike="sngStrike"`);
|
|
1041
|
+
const typeface = format.code ? style.codeFont : style.titleFont;
|
|
1042
|
+
return `<a:r><a:rPr ${attrs.join(" ")}><a:solidFill><a:srgbClr val="${style.titleColor}"/></a:solidFill><a:latin typeface="${escapeXml(typeface)}"/></a:rPr><a:t>${escapeXml(text)}</a:t></a:r>`;
|
|
1043
|
+
}
|
|
1044
|
+
function makeTitleIconRun(node, format, ctx) {
|
|
1045
|
+
const glyph = fontAwesomeGlyph(node.family, node.name);
|
|
1046
|
+
if (!glyph) return makeTitleRun(`{[${node.token}]}`, format, ctx.style);
|
|
1047
|
+
const face = fontAwesomeFace(node.family);
|
|
1048
|
+
ctx.iconFamilies.add(node.family);
|
|
1049
|
+
const attrs = [`lang="en-US"`, `dirty="0"`, `sz="${DEFAULT_TITLE_SIZE}"`];
|
|
1050
|
+
if (format.strike) attrs.push(`strike="sngStrike"`);
|
|
1051
|
+
return `<a:r><a:rPr ${attrs.join(" ")}><a:solidFill><a:srgbClr val="${ctx.style.titleColor}"/></a:solidFill><a:latin typeface="${escapeXml(face.typeface)}"/></a:rPr><a:t>${escapeXml(glyph)}</a:t></a:r>`;
|
|
990
1052
|
}
|
|
991
1053
|
function buildBodyShapeCustom(bodyContent, top, height, style) {
|
|
992
1054
|
const defRPr = style.hasTheme ? `<a:defRPr><a:solidFill><a:srgbClr val="${style.text}"/></a:solidFill><a:latin typeface="${escapeXml(style.bodyFont)}"/></a:defRPr>` : "";
|
|
@@ -1135,6 +1197,7 @@ function pptxRunHandlers(ctx) {
|
|
|
1135
1197
|
run: (text, format) => makeRun(text, format, ctx.style),
|
|
1136
1198
|
link: (node, format) => convertLink(node, ctx, format),
|
|
1137
1199
|
image: (node, format) => convertImage(node, format, ctx),
|
|
1200
|
+
icon: (node, format) => makeIconRun(node, format, ctx),
|
|
1138
1201
|
lineBreak: () => `<a:br/>`
|
|
1139
1202
|
};
|
|
1140
1203
|
}
|
|
@@ -1160,6 +1223,16 @@ function makeRun(text, format, style) {
|
|
|
1160
1223
|
}
|
|
1161
1224
|
return `<a:r><a:rPr ${rPrParts.join(" ")}>${innerParts}</a:rPr><a:t>${escapeXml(text)}</a:t></a:r>`;
|
|
1162
1225
|
}
|
|
1226
|
+
function makeIconRun(node, format, ctx) {
|
|
1227
|
+
const glyph = fontAwesomeGlyph(node.family, node.name);
|
|
1228
|
+
if (!glyph) return makeRun(`{[${node.token}]}`, format, ctx.style);
|
|
1229
|
+
const face = fontAwesomeFace(node.family);
|
|
1230
|
+
ctx.iconFamilies.add(node.family);
|
|
1231
|
+
const attrs = [`lang="en-US"`, `dirty="0"`];
|
|
1232
|
+
if (format.strike) attrs.push(`strike="sngStrike"`);
|
|
1233
|
+
const fill = ctx.style.hasTheme ? `<a:solidFill><a:srgbClr val="${ctx.style.text}"/></a:solidFill>` : "";
|
|
1234
|
+
return `<a:r><a:rPr ${attrs.join(" ")}>` + fill + `<a:latin typeface="${escapeXml(face.typeface)}"/></a:rPr><a:t>${escapeXml(glyph)}</a:t></a:r>`;
|
|
1235
|
+
}
|
|
1163
1236
|
function convertLink(node, ctx, format) {
|
|
1164
1237
|
const rId = ctx.addHyperlink(node.url);
|
|
1165
1238
|
if (!rId) return convertInlines(node.children, ctx, format);
|
|
@@ -1204,11 +1277,20 @@ async function buildPptxPackage(slideXmls, slideContexts, options) {
|
|
|
1204
1277
|
}
|
|
1205
1278
|
const slideMasterRelId = relIds.alloc(PRESENTATION_PART);
|
|
1206
1279
|
const themeRelId = relIds.alloc(PRESENTATION_PART);
|
|
1280
|
+
const usedIconFamilies = /* @__PURE__ */ new Set();
|
|
1281
|
+
for (const ctx of slideContexts) {
|
|
1282
|
+
for (const family of ctx.iconFamilies) usedIconFamilies.add(family);
|
|
1283
|
+
}
|
|
1284
|
+
const embeddedIconFonts = fontAwesomeFaces(usedIconFamilies).map((face) => ({
|
|
1285
|
+
face,
|
|
1286
|
+
relId: relIds.alloc(PRESENTATION_PART)
|
|
1287
|
+
}));
|
|
1207
1288
|
const presentationXml = buildPresentationXml(
|
|
1208
1289
|
slideCount,
|
|
1209
1290
|
slideRelIds,
|
|
1210
1291
|
slideMasterRelId,
|
|
1211
|
-
themeRelId
|
|
1292
|
+
themeRelId,
|
|
1293
|
+
embeddedIconFonts.map(({ face, relId }) => ({ typeface: face.typeface, relId }))
|
|
1212
1294
|
);
|
|
1213
1295
|
pkg.addPart("ppt/presentation.xml", presentationXml, CONTENT_TYPE_PPTX_PRESENTATION);
|
|
1214
1296
|
for (let i = 0; i < slideCount; i++) {
|
|
@@ -1273,6 +1355,15 @@ async function buildPptxPackage(slideXmls, slideContexts, options) {
|
|
|
1273
1355
|
type: REL_THEME,
|
|
1274
1356
|
target: "theme/theme1.xml"
|
|
1275
1357
|
});
|
|
1358
|
+
for (const { face, relId } of embeddedIconFonts) {
|
|
1359
|
+
const filename = `${face.fileStem}.fntdata`;
|
|
1360
|
+
pkg.addBinaryPart(`ppt/fonts/${filename}`, face.data, CONTENT_TYPE_PPTX_FONT);
|
|
1361
|
+
pkg.addRelationship("ppt/presentation.xml", {
|
|
1362
|
+
id: relId,
|
|
1363
|
+
type: REL_FONT,
|
|
1364
|
+
target: `fonts/${filename}`
|
|
1365
|
+
});
|
|
1366
|
+
}
|
|
1276
1367
|
if (options.title || options.author || options.description) {
|
|
1277
1368
|
pkg.setCoreProperties({
|
|
1278
1369
|
title: options.title,
|
|
@@ -1503,7 +1594,7 @@ async function importDocument(pkg, options) {
|
|
|
1503
1594
|
let extraction = null;
|
|
1504
1595
|
if (inferTheme || inferLayouts) {
|
|
1505
1596
|
try {
|
|
1506
|
-
const { extractPptxTheme } = await import("./extract-
|
|
1597
|
+
const { extractPptxTheme } = await import("./extract-UTAOG7LV.js");
|
|
1507
1598
|
extraction = await extractPptxTheme(pkg);
|
|
1508
1599
|
} catch (err) {
|
|
1509
1600
|
warnInferenceFailure("theme extraction", err);
|
|
@@ -1520,7 +1611,7 @@ async function importDocument(pkg, options) {
|
|
|
1520
1611
|
}
|
|
1521
1612
|
if (inferLayouts) {
|
|
1522
1613
|
try {
|
|
1523
|
-
const { analyzePptxLayouts: analyzePptxLayouts2 } = await import("./layouts-
|
|
1614
|
+
const { analyzePptxLayouts: analyzePptxLayouts2 } = await import("./layouts-2A7QNF6Y.js");
|
|
1524
1615
|
const { colorHintsFromExtraction } = await import("./mapTheme-4TWH25FT.js");
|
|
1525
1616
|
ctx.inference = await analyzePptxLayouts2(pkg, {
|
|
1526
1617
|
colors: extraction ? colorHintsFromExtraction(extraction) : {}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
extractPlainText
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6X5XN3CZ.js";
|
|
4
4
|
import {
|
|
5
5
|
createPackage
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ILCJ3WFD.js";
|
|
7
7
|
import {
|
|
8
8
|
escapeXml,
|
|
9
9
|
xmlDeclaration
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
getPartXml,
|
|
23
23
|
openPackage,
|
|
24
24
|
requireMainPartPath
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-S5PCVMKU.js";
|
|
26
26
|
|
|
27
27
|
// src/xlsx/index.ts
|
|
28
28
|
import { markdownToDoc } from "@bendyline/squisq/doc";
|