documents.js 1.33.3 → 1.33.4
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/dist/index.cjs +60 -4
- package/dist/index.d.cts +12 -12
- package/dist/index.d.ts +12 -12
- package/dist/index.js +60 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1308,16 +1308,21 @@ const DML_NS = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
|
1308
1308
|
const R_NS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
1309
1309
|
const DEFAULT_SLIDE_WIDTH_EMU = "12192000";
|
|
1310
1310
|
const DEFAULT_SLIDE_HEIGHT_EMU = "6858000";
|
|
1311
|
+
const DEFAULT_NOTES_WIDTH_EMU = "6858000";
|
|
1312
|
+
const DEFAULT_NOTES_HEIGHT_EMU = "9144000";
|
|
1311
1313
|
const SLIDE_MASTER_PART_PATH = "ppt/slideMasters/slideMaster1.xml";
|
|
1312
1314
|
const SLIDE_LAYOUT_PART_PATH = "ppt/slideLayouts/slideLayout1.xml";
|
|
1313
1315
|
const THEME_PART_PATH = "ppt/theme/theme1.xml";
|
|
1314
1316
|
const PRESENTATION_PART_PATH$1 = "ppt/presentation.xml";
|
|
1317
|
+
const NOTES_MASTER_PART_PATH = "ppt/notesMasters/notesMaster1.xml";
|
|
1315
1318
|
const SLIDE_MASTER_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml";
|
|
1316
1319
|
const SLIDE_LAYOUT_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml";
|
|
1317
1320
|
const THEME_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.theme+xml";
|
|
1321
|
+
const NOTES_MASTER_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml";
|
|
1318
1322
|
const SLIDE_MASTER_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster";
|
|
1319
1323
|
const SLIDE_LAYOUT_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout";
|
|
1320
1324
|
const THEME_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme";
|
|
1325
|
+
const NOTES_MASTER_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster";
|
|
1321
1326
|
const MIN_MASTER_OR_LAYOUT_ID = 2147483648;
|
|
1322
1327
|
function declaration() {
|
|
1323
1328
|
return {
|
|
@@ -1454,6 +1459,37 @@ function buildSlideLayout() {
|
|
|
1454
1459
|
preserve: "1"
|
|
1455
1460
|
}, [el("p:cSld", { name: "Blank" }, [buildEmptyGroupSpTree()]), el("p:clrMapOvr", {}, [el("a:masterClrMapping")])]);
|
|
1456
1461
|
}
|
|
1462
|
+
function buildNotesMaster() {
|
|
1463
|
+
return el("p:notesMaster", {
|
|
1464
|
+
"xmlns:p": PML_NS,
|
|
1465
|
+
"xmlns:a": DML_NS
|
|
1466
|
+
}, [el("p:cSld", {}, [buildWhiteBackground(), buildEmptyGroupSpTree()]), buildIdentityColorMap()]);
|
|
1467
|
+
}
|
|
1468
|
+
function ensureNotesMaster(pkg) {
|
|
1469
|
+
if (pkg.parts[NOTES_MASTER_PART_PATH] !== void 0) return NOTES_MASTER_PART_PATH;
|
|
1470
|
+
const masterToThemeTarget = buildRelativeTarget(NOTES_MASTER_PART_PATH, THEME_PART_PATH);
|
|
1471
|
+
addRelationship(pkg, NOTES_MASTER_PART_PATH, {
|
|
1472
|
+
type: THEME_REL_TYPE,
|
|
1473
|
+
target: masterToThemeTarget
|
|
1474
|
+
});
|
|
1475
|
+
pkg.parts[NOTES_MASTER_PART_PATH] = {
|
|
1476
|
+
kind: "xml",
|
|
1477
|
+
nodes: [declaration(), buildNotesMaster()]
|
|
1478
|
+
};
|
|
1479
|
+
ensureContentTypeOverride(pkg, NOTES_MASTER_PART_PATH, NOTES_MASTER_CONTENT_TYPE);
|
|
1480
|
+
const presentationToNotesMasterTarget = buildRelativeTarget(PRESENTATION_PART_PATH$1, NOTES_MASTER_PART_PATH);
|
|
1481
|
+
const relId = addRelationship(pkg, PRESENTATION_PART_PATH$1, {
|
|
1482
|
+
type: NOTES_MASTER_REL_TYPE,
|
|
1483
|
+
target: presentationToNotesMasterTarget
|
|
1484
|
+
});
|
|
1485
|
+
const presentationPart = pkg.parts[PRESENTATION_PART_PATH$1];
|
|
1486
|
+
const presentationElement = presentationPart?.kind === "xml" ? presentationPart.nodes.find((n) => n.type === "element") : void 0;
|
|
1487
|
+
if (presentationElement === void 0) throw new Error("ensureNotesMaster: package has no ppt/presentation.xml element");
|
|
1488
|
+
const sldMasterIdLstIndex = presentationElement.children.findIndex((c) => c.type === "element" && c.tag === "p:sldMasterIdLst");
|
|
1489
|
+
const notesMasterIdLst = el("p:notesMasterIdLst", {}, [el("p:notesMasterId", { "r:id": relId })]);
|
|
1490
|
+
presentationElement.children.splice(sldMasterIdLstIndex === -1 ? 0 : sldMasterIdLstIndex + 1, 0, notesMasterIdLst);
|
|
1491
|
+
return NOTES_MASTER_PART_PATH;
|
|
1492
|
+
}
|
|
1457
1493
|
function createEmptyPptxPackage() {
|
|
1458
1494
|
const contentTypes = el("Types", { xmlns: CONTENT_TYPES_NS }, [
|
|
1459
1495
|
el("Default", {
|
|
@@ -1535,6 +1571,9 @@ function createEmptyPptxPackage() {
|
|
|
1535
1571
|
})]), el("p:sldIdLst"), el("p:sldSz", {
|
|
1536
1572
|
cx: DEFAULT_SLIDE_WIDTH_EMU,
|
|
1537
1573
|
cy: DEFAULT_SLIDE_HEIGHT_EMU
|
|
1574
|
+
}), el("p:notesSz", {
|
|
1575
|
+
cx: DEFAULT_NOTES_WIDTH_EMU,
|
|
1576
|
+
cy: DEFAULT_NOTES_HEIGHT_EMU
|
|
1538
1577
|
}));
|
|
1539
1578
|
return pkg;
|
|
1540
1579
|
}
|
|
@@ -1757,7 +1796,7 @@ function nextIdIn(root) {
|
|
|
1757
1796
|
const NOTES_SLIDE_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide";
|
|
1758
1797
|
const NOTES_SLIDE_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml";
|
|
1759
1798
|
function buildMinimalNotesSlide(text) {
|
|
1760
|
-
|
|
1799
|
+
const body = el("p:sp", {}, [
|
|
1761
1800
|
el("p:nvSpPr", {}, [
|
|
1762
1801
|
el("p:cNvPr", {
|
|
1763
1802
|
id: "2",
|
|
@@ -1769,13 +1808,25 @@ function buildMinimalNotesSlide(text) {
|
|
|
1769
1808
|
idx: "1"
|
|
1770
1809
|
})])
|
|
1771
1810
|
]),
|
|
1772
|
-
el("p:spPr"
|
|
1811
|
+
el("p:spPr", {}, [el("a:xfrm", {}, [el("a:off", {
|
|
1812
|
+
x: "685800",
|
|
1813
|
+
y: "4400550"
|
|
1814
|
+
}), el("a:ext", {
|
|
1815
|
+
cx: "5486400",
|
|
1816
|
+
cy: "4200525"
|
|
1817
|
+
})])]),
|
|
1773
1818
|
el("p:txBody", {}, [
|
|
1774
1819
|
el("a:bodyPr"),
|
|
1775
1820
|
el("a:lstStyle"),
|
|
1776
1821
|
el("a:p", {}, [el("a:r", {}, [el("a:t", {}, [txt(encodeXmlText(text))])])])
|
|
1777
1822
|
])
|
|
1778
|
-
])
|
|
1823
|
+
]);
|
|
1824
|
+
const spTree = buildEmptyGroupSpTree();
|
|
1825
|
+
spTree.children.push(body);
|
|
1826
|
+
return el("p:notes", {
|
|
1827
|
+
"xmlns:p": PML_NS,
|
|
1828
|
+
"xmlns:a": DML_NS
|
|
1829
|
+
}, [el("p:cSld", {}, [spTree]), el("p:clrMapOvr", {}, [el("a:masterClrMapping")])]);
|
|
1779
1830
|
}
|
|
1780
1831
|
var PptxSlide = class {
|
|
1781
1832
|
container;
|
|
@@ -1826,12 +1877,17 @@ var PptxSlide = class {
|
|
|
1826
1877
|
const existingRel = [...(0, ooxml_js.resolveRelationships)(pkg, slidePartPath).values()].find((r) => r.type === NOTES_SLIDE_RELATIONSHIP_TYPE);
|
|
1827
1878
|
let notesPartPath;
|
|
1828
1879
|
if (existingRel === void 0) {
|
|
1829
|
-
notesPartPath = `ppt/notesSlides/notesSlide${Object.keys(pkg.parts).filter((p) =>
|
|
1880
|
+
notesPartPath = `ppt/notesSlides/notesSlide${Object.keys(pkg.parts).filter((p) => /^ppt\/notesSlides\/notesSlide\d+\.xml$/.test(p)).length + 1}.xml`;
|
|
1830
1881
|
ensureContentTypeOverride(pkg, notesPartPath, NOTES_SLIDE_CONTENT_TYPE);
|
|
1831
1882
|
addRelationship(pkg, slidePartPath, {
|
|
1832
1883
|
type: NOTES_SLIDE_RELATIONSHIP_TYPE,
|
|
1833
1884
|
target: buildRelativeTarget(slidePartPath, notesPartPath)
|
|
1834
1885
|
});
|
|
1886
|
+
const notesMasterPartPath = ensureNotesMaster(pkg);
|
|
1887
|
+
addRelationship(pkg, notesPartPath, {
|
|
1888
|
+
type: NOTES_MASTER_REL_TYPE,
|
|
1889
|
+
target: buildRelativeTarget(notesPartPath, notesMasterPartPath)
|
|
1890
|
+
});
|
|
1835
1891
|
} else notesPartPath = existingRel.target;
|
|
1836
1892
|
pkg.parts[notesPartPath] = {
|
|
1837
1893
|
kind: "xml",
|
package/dist/index.d.cts
CHANGED
|
@@ -265,12 +265,12 @@ declare const LayoutTextSchema: z.ZodObject<{
|
|
|
265
265
|
font: z.ZodObject<{
|
|
266
266
|
family: z.ZodString;
|
|
267
267
|
weight: z.ZodEnum<{
|
|
268
|
-
bold: "bold";
|
|
269
268
|
normal: "normal";
|
|
269
|
+
bold: "bold";
|
|
270
270
|
}>;
|
|
271
271
|
style: z.ZodEnum<{
|
|
272
|
-
italic: "italic";
|
|
273
272
|
normal: "normal";
|
|
273
|
+
italic: "italic";
|
|
274
274
|
}>;
|
|
275
275
|
}, z.core.$strip>;
|
|
276
276
|
sizePt: z.ZodNumber;
|
|
@@ -367,12 +367,12 @@ declare const LayoutItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
367
367
|
font: z.ZodObject<{
|
|
368
368
|
family: z.ZodString;
|
|
369
369
|
weight: z.ZodEnum<{
|
|
370
|
-
bold: "bold";
|
|
371
370
|
normal: "normal";
|
|
371
|
+
bold: "bold";
|
|
372
372
|
}>;
|
|
373
373
|
style: z.ZodEnum<{
|
|
374
|
-
italic: "italic";
|
|
375
374
|
normal: "normal";
|
|
375
|
+
italic: "italic";
|
|
376
376
|
}>;
|
|
377
377
|
}, z.core.$strip>;
|
|
378
378
|
sizePt: z.ZodNumber;
|
|
@@ -462,12 +462,12 @@ declare const LayoutPageSchema: z.ZodObject<{
|
|
|
462
462
|
font: z.ZodObject<{
|
|
463
463
|
family: z.ZodString;
|
|
464
464
|
weight: z.ZodEnum<{
|
|
465
|
-
bold: "bold";
|
|
466
465
|
normal: "normal";
|
|
466
|
+
bold: "bold";
|
|
467
467
|
}>;
|
|
468
468
|
style: z.ZodEnum<{
|
|
469
|
-
italic: "italic";
|
|
470
469
|
normal: "normal";
|
|
470
|
+
italic: "italic";
|
|
471
471
|
}>;
|
|
472
472
|
}, z.core.$strip>;
|
|
473
473
|
sizePt: z.ZodNumber;
|
|
@@ -591,12 +591,12 @@ declare const LayoutDocumentSchema: z.ZodObject<{
|
|
|
591
591
|
font: z.ZodObject<{
|
|
592
592
|
family: z.ZodString;
|
|
593
593
|
weight: z.ZodEnum<{
|
|
594
|
-
bold: "bold";
|
|
595
594
|
normal: "normal";
|
|
595
|
+
bold: "bold";
|
|
596
596
|
}>;
|
|
597
597
|
style: z.ZodEnum<{
|
|
598
|
-
italic: "italic";
|
|
599
598
|
normal: "normal";
|
|
599
|
+
italic: "italic";
|
|
600
600
|
}>;
|
|
601
601
|
}, z.core.$strip>;
|
|
602
602
|
sizePt: z.ZodNumber;
|
|
@@ -694,12 +694,12 @@ declare function flipY(box: Box$1, containerHeightPt: number): Box$1;
|
|
|
694
694
|
declare const LayoutFontSchema: z.ZodObject<{
|
|
695
695
|
family: z.ZodString;
|
|
696
696
|
weight: z.ZodEnum<{
|
|
697
|
-
bold: "bold";
|
|
698
697
|
normal: "normal";
|
|
698
|
+
bold: "bold";
|
|
699
699
|
}>;
|
|
700
700
|
style: z.ZodEnum<{
|
|
701
|
-
italic: "italic";
|
|
702
701
|
normal: "normal";
|
|
702
|
+
italic: "italic";
|
|
703
703
|
}>;
|
|
704
704
|
}, z.core.$strip>;
|
|
705
705
|
type LayoutFont = z.infer<typeof LayoutFontSchema>;
|
|
@@ -991,12 +991,12 @@ declare const pdfCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Arr
|
|
|
991
991
|
font: z.ZodObject<{
|
|
992
992
|
family: z.ZodString;
|
|
993
993
|
weight: z.ZodEnum<{
|
|
994
|
-
bold: "bold";
|
|
995
994
|
normal: "normal";
|
|
995
|
+
bold: "bold";
|
|
996
996
|
}>;
|
|
997
997
|
style: z.ZodEnum<{
|
|
998
|
-
italic: "italic";
|
|
999
998
|
normal: "normal";
|
|
999
|
+
italic: "italic";
|
|
1000
1000
|
}>;
|
|
1001
1001
|
}, z.core.$strip>;
|
|
1002
1002
|
sizePt: z.ZodNumber;
|
package/dist/index.d.ts
CHANGED
|
@@ -265,12 +265,12 @@ declare const LayoutTextSchema: z.ZodObject<{
|
|
|
265
265
|
font: z.ZodObject<{
|
|
266
266
|
family: z.ZodString;
|
|
267
267
|
weight: z.ZodEnum<{
|
|
268
|
-
bold: "bold";
|
|
269
268
|
normal: "normal";
|
|
269
|
+
bold: "bold";
|
|
270
270
|
}>;
|
|
271
271
|
style: z.ZodEnum<{
|
|
272
|
-
italic: "italic";
|
|
273
272
|
normal: "normal";
|
|
273
|
+
italic: "italic";
|
|
274
274
|
}>;
|
|
275
275
|
}, z.core.$strip>;
|
|
276
276
|
sizePt: z.ZodNumber;
|
|
@@ -367,12 +367,12 @@ declare const LayoutItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
367
367
|
font: z.ZodObject<{
|
|
368
368
|
family: z.ZodString;
|
|
369
369
|
weight: z.ZodEnum<{
|
|
370
|
-
bold: "bold";
|
|
371
370
|
normal: "normal";
|
|
371
|
+
bold: "bold";
|
|
372
372
|
}>;
|
|
373
373
|
style: z.ZodEnum<{
|
|
374
|
-
italic: "italic";
|
|
375
374
|
normal: "normal";
|
|
375
|
+
italic: "italic";
|
|
376
376
|
}>;
|
|
377
377
|
}, z.core.$strip>;
|
|
378
378
|
sizePt: z.ZodNumber;
|
|
@@ -462,12 +462,12 @@ declare const LayoutPageSchema: z.ZodObject<{
|
|
|
462
462
|
font: z.ZodObject<{
|
|
463
463
|
family: z.ZodString;
|
|
464
464
|
weight: z.ZodEnum<{
|
|
465
|
-
bold: "bold";
|
|
466
465
|
normal: "normal";
|
|
466
|
+
bold: "bold";
|
|
467
467
|
}>;
|
|
468
468
|
style: z.ZodEnum<{
|
|
469
|
-
italic: "italic";
|
|
470
469
|
normal: "normal";
|
|
470
|
+
italic: "italic";
|
|
471
471
|
}>;
|
|
472
472
|
}, z.core.$strip>;
|
|
473
473
|
sizePt: z.ZodNumber;
|
|
@@ -591,12 +591,12 @@ declare const LayoutDocumentSchema: z.ZodObject<{
|
|
|
591
591
|
font: z.ZodObject<{
|
|
592
592
|
family: z.ZodString;
|
|
593
593
|
weight: z.ZodEnum<{
|
|
594
|
-
bold: "bold";
|
|
595
594
|
normal: "normal";
|
|
595
|
+
bold: "bold";
|
|
596
596
|
}>;
|
|
597
597
|
style: z.ZodEnum<{
|
|
598
|
-
italic: "italic";
|
|
599
598
|
normal: "normal";
|
|
599
|
+
italic: "italic";
|
|
600
600
|
}>;
|
|
601
601
|
}, z.core.$strip>;
|
|
602
602
|
sizePt: z.ZodNumber;
|
|
@@ -694,12 +694,12 @@ declare function flipY(box: Box$1, containerHeightPt: number): Box$1;
|
|
|
694
694
|
declare const LayoutFontSchema: z.ZodObject<{
|
|
695
695
|
family: z.ZodString;
|
|
696
696
|
weight: z.ZodEnum<{
|
|
697
|
-
bold: "bold";
|
|
698
697
|
normal: "normal";
|
|
698
|
+
bold: "bold";
|
|
699
699
|
}>;
|
|
700
700
|
style: z.ZodEnum<{
|
|
701
|
-
italic: "italic";
|
|
702
701
|
normal: "normal";
|
|
702
|
+
italic: "italic";
|
|
703
703
|
}>;
|
|
704
704
|
}, z.core.$strip>;
|
|
705
705
|
type LayoutFont = z.infer<typeof LayoutFontSchema>;
|
|
@@ -991,12 +991,12 @@ declare const pdfCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Arr
|
|
|
991
991
|
font: z.ZodObject<{
|
|
992
992
|
family: z.ZodString;
|
|
993
993
|
weight: z.ZodEnum<{
|
|
994
|
-
bold: "bold";
|
|
995
994
|
normal: "normal";
|
|
995
|
+
bold: "bold";
|
|
996
996
|
}>;
|
|
997
997
|
style: z.ZodEnum<{
|
|
998
|
-
italic: "italic";
|
|
999
998
|
normal: "normal";
|
|
999
|
+
italic: "italic";
|
|
1000
1000
|
}>;
|
|
1001
1001
|
}, z.core.$strip>;
|
|
1002
1002
|
sizePt: z.ZodNumber;
|
package/dist/index.js
CHANGED
|
@@ -1307,16 +1307,21 @@ const DML_NS = "http://schemas.openxmlformats.org/drawingml/2006/main";
|
|
|
1307
1307
|
const R_NS = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
1308
1308
|
const DEFAULT_SLIDE_WIDTH_EMU = "12192000";
|
|
1309
1309
|
const DEFAULT_SLIDE_HEIGHT_EMU = "6858000";
|
|
1310
|
+
const DEFAULT_NOTES_WIDTH_EMU = "6858000";
|
|
1311
|
+
const DEFAULT_NOTES_HEIGHT_EMU = "9144000";
|
|
1310
1312
|
const SLIDE_MASTER_PART_PATH = "ppt/slideMasters/slideMaster1.xml";
|
|
1311
1313
|
const SLIDE_LAYOUT_PART_PATH = "ppt/slideLayouts/slideLayout1.xml";
|
|
1312
1314
|
const THEME_PART_PATH = "ppt/theme/theme1.xml";
|
|
1313
1315
|
const PRESENTATION_PART_PATH$1 = "ppt/presentation.xml";
|
|
1316
|
+
const NOTES_MASTER_PART_PATH = "ppt/notesMasters/notesMaster1.xml";
|
|
1314
1317
|
const SLIDE_MASTER_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml";
|
|
1315
1318
|
const SLIDE_LAYOUT_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml";
|
|
1316
1319
|
const THEME_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.theme+xml";
|
|
1320
|
+
const NOTES_MASTER_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml";
|
|
1317
1321
|
const SLIDE_MASTER_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster";
|
|
1318
1322
|
const SLIDE_LAYOUT_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout";
|
|
1319
1323
|
const THEME_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme";
|
|
1324
|
+
const NOTES_MASTER_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster";
|
|
1320
1325
|
const MIN_MASTER_OR_LAYOUT_ID = 2147483648;
|
|
1321
1326
|
function declaration() {
|
|
1322
1327
|
return {
|
|
@@ -1453,6 +1458,37 @@ function buildSlideLayout() {
|
|
|
1453
1458
|
preserve: "1"
|
|
1454
1459
|
}, [el("p:cSld", { name: "Blank" }, [buildEmptyGroupSpTree()]), el("p:clrMapOvr", {}, [el("a:masterClrMapping")])]);
|
|
1455
1460
|
}
|
|
1461
|
+
function buildNotesMaster() {
|
|
1462
|
+
return el("p:notesMaster", {
|
|
1463
|
+
"xmlns:p": PML_NS,
|
|
1464
|
+
"xmlns:a": DML_NS
|
|
1465
|
+
}, [el("p:cSld", {}, [buildWhiteBackground(), buildEmptyGroupSpTree()]), buildIdentityColorMap()]);
|
|
1466
|
+
}
|
|
1467
|
+
function ensureNotesMaster(pkg) {
|
|
1468
|
+
if (pkg.parts[NOTES_MASTER_PART_PATH] !== void 0) return NOTES_MASTER_PART_PATH;
|
|
1469
|
+
const masterToThemeTarget = buildRelativeTarget(NOTES_MASTER_PART_PATH, THEME_PART_PATH);
|
|
1470
|
+
addRelationship(pkg, NOTES_MASTER_PART_PATH, {
|
|
1471
|
+
type: THEME_REL_TYPE,
|
|
1472
|
+
target: masterToThemeTarget
|
|
1473
|
+
});
|
|
1474
|
+
pkg.parts[NOTES_MASTER_PART_PATH] = {
|
|
1475
|
+
kind: "xml",
|
|
1476
|
+
nodes: [declaration(), buildNotesMaster()]
|
|
1477
|
+
};
|
|
1478
|
+
ensureContentTypeOverride(pkg, NOTES_MASTER_PART_PATH, NOTES_MASTER_CONTENT_TYPE);
|
|
1479
|
+
const presentationToNotesMasterTarget = buildRelativeTarget(PRESENTATION_PART_PATH$1, NOTES_MASTER_PART_PATH);
|
|
1480
|
+
const relId = addRelationship(pkg, PRESENTATION_PART_PATH$1, {
|
|
1481
|
+
type: NOTES_MASTER_REL_TYPE,
|
|
1482
|
+
target: presentationToNotesMasterTarget
|
|
1483
|
+
});
|
|
1484
|
+
const presentationPart = pkg.parts[PRESENTATION_PART_PATH$1];
|
|
1485
|
+
const presentationElement = presentationPart?.kind === "xml" ? presentationPart.nodes.find((n) => n.type === "element") : void 0;
|
|
1486
|
+
if (presentationElement === void 0) throw new Error("ensureNotesMaster: package has no ppt/presentation.xml element");
|
|
1487
|
+
const sldMasterIdLstIndex = presentationElement.children.findIndex((c) => c.type === "element" && c.tag === "p:sldMasterIdLst");
|
|
1488
|
+
const notesMasterIdLst = el("p:notesMasterIdLst", {}, [el("p:notesMasterId", { "r:id": relId })]);
|
|
1489
|
+
presentationElement.children.splice(sldMasterIdLstIndex === -1 ? 0 : sldMasterIdLstIndex + 1, 0, notesMasterIdLst);
|
|
1490
|
+
return NOTES_MASTER_PART_PATH;
|
|
1491
|
+
}
|
|
1456
1492
|
function createEmptyPptxPackage() {
|
|
1457
1493
|
const contentTypes = el("Types", { xmlns: CONTENT_TYPES_NS }, [
|
|
1458
1494
|
el("Default", {
|
|
@@ -1534,6 +1570,9 @@ function createEmptyPptxPackage() {
|
|
|
1534
1570
|
})]), el("p:sldIdLst"), el("p:sldSz", {
|
|
1535
1571
|
cx: DEFAULT_SLIDE_WIDTH_EMU,
|
|
1536
1572
|
cy: DEFAULT_SLIDE_HEIGHT_EMU
|
|
1573
|
+
}), el("p:notesSz", {
|
|
1574
|
+
cx: DEFAULT_NOTES_WIDTH_EMU,
|
|
1575
|
+
cy: DEFAULT_NOTES_HEIGHT_EMU
|
|
1537
1576
|
}));
|
|
1538
1577
|
return pkg;
|
|
1539
1578
|
}
|
|
@@ -1756,7 +1795,7 @@ function nextIdIn(root) {
|
|
|
1756
1795
|
const NOTES_SLIDE_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide";
|
|
1757
1796
|
const NOTES_SLIDE_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml";
|
|
1758
1797
|
function buildMinimalNotesSlide(text) {
|
|
1759
|
-
|
|
1798
|
+
const body = el("p:sp", {}, [
|
|
1760
1799
|
el("p:nvSpPr", {}, [
|
|
1761
1800
|
el("p:cNvPr", {
|
|
1762
1801
|
id: "2",
|
|
@@ -1768,13 +1807,25 @@ function buildMinimalNotesSlide(text) {
|
|
|
1768
1807
|
idx: "1"
|
|
1769
1808
|
})])
|
|
1770
1809
|
]),
|
|
1771
|
-
el("p:spPr"
|
|
1810
|
+
el("p:spPr", {}, [el("a:xfrm", {}, [el("a:off", {
|
|
1811
|
+
x: "685800",
|
|
1812
|
+
y: "4400550"
|
|
1813
|
+
}), el("a:ext", {
|
|
1814
|
+
cx: "5486400",
|
|
1815
|
+
cy: "4200525"
|
|
1816
|
+
})])]),
|
|
1772
1817
|
el("p:txBody", {}, [
|
|
1773
1818
|
el("a:bodyPr"),
|
|
1774
1819
|
el("a:lstStyle"),
|
|
1775
1820
|
el("a:p", {}, [el("a:r", {}, [el("a:t", {}, [txt(encodeXmlText(text))])])])
|
|
1776
1821
|
])
|
|
1777
|
-
])
|
|
1822
|
+
]);
|
|
1823
|
+
const spTree = buildEmptyGroupSpTree();
|
|
1824
|
+
spTree.children.push(body);
|
|
1825
|
+
return el("p:notes", {
|
|
1826
|
+
"xmlns:p": PML_NS,
|
|
1827
|
+
"xmlns:a": DML_NS
|
|
1828
|
+
}, [el("p:cSld", {}, [spTree]), el("p:clrMapOvr", {}, [el("a:masterClrMapping")])]);
|
|
1778
1829
|
}
|
|
1779
1830
|
var PptxSlide = class {
|
|
1780
1831
|
container;
|
|
@@ -1825,12 +1876,17 @@ var PptxSlide = class {
|
|
|
1825
1876
|
const existingRel = [...resolveRelationships$1(pkg, slidePartPath).values()].find((r) => r.type === NOTES_SLIDE_RELATIONSHIP_TYPE);
|
|
1826
1877
|
let notesPartPath;
|
|
1827
1878
|
if (existingRel === void 0) {
|
|
1828
|
-
notesPartPath = `ppt/notesSlides/notesSlide${Object.keys(pkg.parts).filter((p) =>
|
|
1879
|
+
notesPartPath = `ppt/notesSlides/notesSlide${Object.keys(pkg.parts).filter((p) => /^ppt\/notesSlides\/notesSlide\d+\.xml$/.test(p)).length + 1}.xml`;
|
|
1829
1880
|
ensureContentTypeOverride(pkg, notesPartPath, NOTES_SLIDE_CONTENT_TYPE);
|
|
1830
1881
|
addRelationship(pkg, slidePartPath, {
|
|
1831
1882
|
type: NOTES_SLIDE_RELATIONSHIP_TYPE,
|
|
1832
1883
|
target: buildRelativeTarget(slidePartPath, notesPartPath)
|
|
1833
1884
|
});
|
|
1885
|
+
const notesMasterPartPath = ensureNotesMaster(pkg);
|
|
1886
|
+
addRelationship(pkg, notesPartPath, {
|
|
1887
|
+
type: NOTES_MASTER_REL_TYPE,
|
|
1888
|
+
target: buildRelativeTarget(notesPartPath, notesMasterPartPath)
|
|
1889
|
+
});
|
|
1834
1890
|
} else notesPartPath = existingRel.target;
|
|
1835
1891
|
pkg.parts[notesPartPath] = {
|
|
1836
1892
|
kind: "xml",
|
package/package.json
CHANGED