odf.js 6.2.1 → 6.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/README.md +191 -17
- package/dist/{cascade-BDkyOmoo.d.cts → cascade-BpMwrjkB.d.cts} +1 -1
- package/dist/{cascade-CaVinmvp.d.ts → cascade-PDS3hgrP.d.ts} +1 -1
- package/dist/{codec-B72LApRl.d.cts → codec-CFdlbFLJ.d.cts} +21 -13
- package/dist/{codec-rbZGlr37.d.ts → codec-DTAgph2r.d.ts} +21 -13
- package/dist/codec.d.cts +1 -1
- package/dist/codec.d.ts +1 -1
- package/dist/{embedded-UQQNFd5U.js → embedded-BnavfkP-.js} +4 -5
- package/dist/{embedded-BsO-SvtW.cjs → embedded-Bxyss_ck.cjs} +15 -4
- package/dist/index.cjs +53 -1
- package/dist/index.d.cts +24 -16
- package/dist/index.d.ts +24 -16
- package/dist/index.js +19 -11
- package/dist/list-7FO0SDqZ.d.ts +32 -0
- package/dist/list-BorrTJBY.d.cts +32 -0
- package/dist/metadata-BUzwE_-u.d.ts +10 -0
- package/dist/metadata-CYXgXL_h.d.cts +10 -0
- package/dist/{ns-C14w-Zhf.d.cts → ns-DrleaIZQ.d.cts} +3 -1
- package/dist/{ns-CTyKJZeF.d.ts → ns-E0TfX9tZ.d.ts} +3 -1
- package/dist/ooo1/ns.cjs +9 -0
- package/dist/ooo1/ns.d.cts +2 -2
- package/dist/ooo1/ns.d.ts +2 -2
- package/dist/ooo1/ns.js +8 -1
- package/dist/ooo1/properties.cjs +30 -0
- package/dist/ooo1/properties.d.cts +6 -2
- package/dist/ooo1/properties.d.ts +6 -2
- package/dist/ooo1/properties.js +30 -1
- package/dist/ooo1/read.cjs +1 -1
- package/dist/ooo1/read.d.cts +1 -1
- package/dist/ooo1/read.d.ts +1 -1
- package/dist/ooo1/read.js +1 -1
- package/dist/ooo1/transform.cjs +290 -0
- package/dist/ooo1/transform.d.cts +2 -2
- package/dist/ooo1/transform.d.ts +2 -2
- package/dist/ooo1/transform.js +293 -4
- package/dist/ooo1/write.cjs +40 -0
- package/dist/ooo1/write.d.cts +2 -0
- package/dist/ooo1/write.d.ts +2 -0
- package/dist/ooo1/write.js +32 -0
- package/dist/package-io/scaffold.cjs +65 -0
- package/dist/package-io/scaffold.d.cts +2 -0
- package/dist/package-io/scaffold.d.ts +2 -0
- package/dist/package-io/scaffold.js +62 -0
- package/dist/paragraph-Bf6Iq5wC.d.cts +28 -0
- package/dist/paragraph-DtC86tft.d.ts +28 -0
- package/dist/{path-CK0dIPgx.d.cts → path-8HQS-J7y.d.cts} +3 -1
- package/dist/{path-CK0dIPgx.d.ts → path-8HQS-J7y.d.ts} +3 -1
- package/dist/{read-Bo1GBjSE.d.ts → read-A3CJkqVM.d.ts} +3 -1
- package/dist/{read-RFqq4ckj.d.cts → read-BgnLFuSi.d.cts} +1 -1
- package/dist/{read-3yy5EFV_.d.ts → read-CqaZ01kU.d.ts} +1 -1
- package/dist/{read-tpfiT_n4.d.cts → read-fphkvCpR.d.cts} +3 -1
- package/dist/{registry-Dajfxsbz.d.ts → registry-C_16-N6i.d.ts} +2 -0
- package/dist/{registry-B-ZkdQv1.d.cts → registry-PoQIRgbY.d.cts} +2 -0
- package/dist/scaffold-44EIMGll.d.cts +8 -0
- package/dist/scaffold-ehGsIpZ5.d.ts +8 -0
- package/dist/{shapes-QkOsc-WT.d.ts → shapes-B6Ms7ibr.d.ts} +1 -1
- package/dist/{shapes-BCjeY90t.d.cts → shapes-CbBc9t0y.d.cts} +1 -1
- package/dist/styles/properties.cjs +1 -1
- package/dist/styles/properties.js +2 -2
- package/dist/styles/registry.cjs +9 -6
- package/dist/styles/registry.d.cts +1 -1
- package/dist/styles/registry.d.ts +1 -1
- package/dist/styles/registry.js +9 -6
- package/dist/table-CECMtPxZ.d.cts +20 -0
- package/dist/table-XuniPr2I.d.ts +20 -0
- package/dist/text-B8350HA2.d.ts +17 -0
- package/dist/text-pmlTqzgi.d.cts +17 -0
- package/dist/{transform-SDysw9wx.d.cts → transform-DFCPKX7e.d.cts} +2 -1
- package/dist/{transform-DRr76JEu.d.ts → transform-DPliWQuD.d.ts} +2 -1
- package/dist/typed/draw/embedded.cjs +1 -1
- package/dist/typed/draw/embedded.js +1 -1
- package/dist/typed/draw/shapes.cjs +7 -2
- package/dist/typed/draw/shapes.d.cts +1 -1
- package/dist/typed/draw/shapes.d.ts +1 -1
- package/dist/typed/draw/shapes.js +7 -2
- package/dist/typed/draw/write-shapes.cjs +210 -0
- package/dist/typed/draw/write-shapes.d.cts +2 -0
- package/dist/typed/draw/write-shapes.d.ts +2 -0
- package/dist/typed/draw/write-shapes.js +203 -0
- package/dist/typed/draw/write-vectors.cjs +132 -0
- package/dist/typed/draw/write-vectors.d.cts +2 -0
- package/dist/typed/draw/write-vectors.d.ts +2 -0
- package/dist/typed/draw/write-vectors.js +129 -0
- package/dist/typed/odb/form.cjs +1 -1
- package/dist/typed/odb/form.js +1 -1
- package/dist/typed/odg/write.cjs +80 -0
- package/dist/typed/odg/write.d.cts +2 -0
- package/dist/typed/odg/write.d.ts +2 -0
- package/dist/typed/odg/write.js +77 -0
- package/dist/typed/odp/write.cjs +108 -0
- package/dist/typed/odp/write.d.cts +2 -0
- package/dist/typed/odp/write.d.ts +2 -0
- package/dist/typed/odp/write.js +105 -0
- package/dist/typed/ods/read.cjs +3 -1
- package/dist/typed/ods/read.d.cts +2 -2
- package/dist/typed/ods/read.d.ts +2 -2
- package/dist/typed/ods/read.js +2 -2
- package/dist/typed/ods/write.cjs +578 -0
- package/dist/typed/ods/write.d.cts +2 -0
- package/dist/typed/ods/write.d.ts +2 -0
- package/dist/typed/ods/write.js +575 -0
- package/dist/typed/odt/read.cjs +1 -1
- package/dist/typed/odt/read.js +1 -1
- package/dist/typed/odt/write.cjs +278 -0
- package/dist/typed/odt/write.d.cts +2 -0
- package/dist/typed/odt/write.d.ts +2 -0
- package/dist/typed/odt/write.js +275 -0
- package/dist/typed/shared/canonicalise.cjs +126 -0
- package/dist/typed/shared/canonicalise.d.cts +10 -0
- package/dist/typed/shared/canonicalise.d.ts +10 -0
- package/dist/typed/shared/canonicalise.js +120 -0
- package/dist/typed/shared/cascade.d.cts +1 -1
- package/dist/typed/shared/cascade.d.ts +1 -1
- package/dist/typed/shared/list.cjs +81 -0
- package/dist/typed/shared/list.d.cts +2 -2
- package/dist/typed/shared/list.d.ts +2 -2
- package/dist/typed/shared/list.js +75 -1
- package/dist/typed/shared/metadata.cjs +41 -0
- package/dist/typed/shared/metadata.d.cts +2 -2
- package/dist/typed/shared/metadata.d.ts +2 -2
- package/dist/typed/shared/metadata.js +41 -2
- package/dist/typed/shared/paragraph.cjs +118 -2
- package/dist/typed/shared/paragraph.d.cts +2 -2
- package/dist/typed/shared/paragraph.d.ts +2 -2
- package/dist/typed/shared/paragraph.js +117 -5
- package/dist/typed/shared/path.cjs +19 -0
- package/dist/typed/shared/path.d.cts +2 -2
- package/dist/typed/shared/path.d.ts +2 -2
- package/dist/typed/shared/path.js +18 -1
- package/dist/typed/shared/table.cjs +84 -0
- package/dist/typed/shared/table.d.cts +2 -2
- package/dist/typed/shared/table.d.ts +2 -2
- package/dist/typed/shared/table.js +84 -4
- package/dist/typed/shared/text.cjs +60 -0
- package/dist/typed/shared/text.d.cts +2 -2
- package/dist/typed/shared/text.d.ts +2 -2
- package/dist/typed/shared/text.js +60 -2
- package/dist/typed/shared/units.cjs +16 -1
- package/dist/typed/shared/units.d.cts +2 -2
- package/dist/typed/shared/units.d.ts +2 -2
- package/dist/typed/shared/units.js +16 -2
- package/dist/{units-BQSNkTQZ.d.cts → units-DdyaQolR.d.cts} +2 -1
- package/dist/{units-BQSNkTQZ.d.ts → units-DdyaQolR.d.ts} +2 -1
- package/dist/write-4kMi-asu.d.ts +14 -0
- package/dist/write-BZXpT8F6.d.cts +17 -0
- package/dist/write-BhG3t3fJ.d.cts +14 -0
- package/dist/write-BuLQmwLD.d.cts +14 -0
- package/dist/write-C2c4xBXs.d.cts +14 -0
- package/dist/write-CPATqG4v.d.cts +14 -0
- package/dist/write-CfTE2jY8.d.ts +14 -0
- package/dist/write-DttX1rTC.d.ts +14 -0
- package/dist/write-JERychL3.d.ts +14 -0
- package/dist/write-SKnCTU4C.d.ts +17 -0
- package/dist/write-shapes-Co7BrmMZ.d.ts +36 -0
- package/dist/write-shapes-D4piGKf4.d.cts +36 -0
- package/dist/write-vectors-B-RVHAKI.d.cts +11 -0
- package/dist/write-vectors-CYjZoVBW.d.ts +11 -0
- package/package.json +2 -2
- package/dist/list-DwTyo_B2.d.cts +0 -13
- package/dist/list-X_GJY7P3.d.ts +0 -13
- package/dist/metadata-01SgHkRR.d.cts +0 -7
- package/dist/metadata-D1SOBTh8.d.ts +0 -7
- package/dist/paragraph-ByTzS8Li.d.ts +0 -18
- package/dist/paragraph-CVULactG.d.cts +0 -18
- package/dist/table-CYvFMlP6.d.cts +0 -14
- package/dist/table-DclDgC5h.d.ts +0 -14
- package/dist/text-Bn3C7lnm.d.ts +0 -10
- package/dist/text-CDUCcwje.d.cts +0 -10
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_media_type = require("../../media-type.cjs");
|
|
3
|
+
const require_xml_fragment = require("../../xml/fragment.cjs");
|
|
4
|
+
const require_xml_entities = require("../../xml/entities.cjs");
|
|
5
|
+
const require_manifest = require("../../manifest.cjs");
|
|
6
|
+
const require_typed_shared_units = require("../shared/units.cjs");
|
|
7
|
+
const require_styles_registry = require("../../styles/registry.cjs");
|
|
8
|
+
const require_typed_shared_text = require("../shared/text.cjs");
|
|
9
|
+
const require_typed_shared_metadata = require("../shared/metadata.cjs");
|
|
10
|
+
const require_package_io_scaffold = require("../../package-io/scaffold.cjs");
|
|
11
|
+
const require_typed_shared_canonicalise = require("../shared/canonicalise.cjs");
|
|
12
|
+
const require_typed_draw_write_shapes = require("../draw/write-shapes.cjs");
|
|
13
|
+
let document_schema_js = require("document-schema.js");
|
|
14
|
+
//#region src/typed/odp/write.ts
|
|
15
|
+
const CONTENT_PART = "content.xml";
|
|
16
|
+
const STYLES_PART = "styles.xml";
|
|
17
|
+
function canonicalSlide(slide, listState) {
|
|
18
|
+
return {
|
|
19
|
+
size: slide.size,
|
|
20
|
+
shapes: slide.shapes.map((shape, index) => require_typed_draw_write_shapes.canonicalDrawShape(shape, index, listState)),
|
|
21
|
+
notes: slide.notes
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function normaliseOdpContent(document) {
|
|
25
|
+
if (document.kind !== "presentation") throw new Error(`normaliseOdpContent: expected a 'presentation' document, got '${document.kind}'`);
|
|
26
|
+
const listState = { next: 1 };
|
|
27
|
+
return {
|
|
28
|
+
kind: "presentation",
|
|
29
|
+
metadata: require_typed_shared_canonicalise.canonicalMetadata(document.metadata),
|
|
30
|
+
slides: document.slides.map((slide) => canonicalSlide(slide, listState))
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function slidePageLayoutElement(name, pageSize) {
|
|
34
|
+
return require_xml_fragment.el("style:page-layout", { "style:name": require_xml_entities.encodeXmlText(name) }, [require_xml_fragment.el("style:page-layout-properties", {
|
|
35
|
+
"fo:page-width": require_typed_shared_units.formatOdfLength(pageSize.widthPt),
|
|
36
|
+
"fo:page-height": require_typed_shared_units.formatOdfLength(pageSize.heightPt),
|
|
37
|
+
"style:print-orientation": pageSize.widthPt > pageSize.heightPt ? "landscape" : "portrait"
|
|
38
|
+
})]);
|
|
39
|
+
}
|
|
40
|
+
const NOTES_FRAME_BOX = {
|
|
41
|
+
xPt: 42,
|
|
42
|
+
yPt: 320,
|
|
43
|
+
widthPt: 500,
|
|
44
|
+
heightPt: 260
|
|
45
|
+
};
|
|
46
|
+
function notesPageLayoutName(state, stylesAutomaticStyles) {
|
|
47
|
+
if (state.name !== void 0) return state.name;
|
|
48
|
+
const name = "PM0";
|
|
49
|
+
state.name = name;
|
|
50
|
+
stylesAutomaticStyles.children.push(require_xml_fragment.el("style:page-layout", { "style:name": name }, [require_xml_fragment.el("style:page-layout-properties", {
|
|
51
|
+
"fo:page-width": require_typed_shared_units.formatOdfLength(document_schema_js.PAGE_SIZE_A4.widthPt),
|
|
52
|
+
"fo:page-height": require_typed_shared_units.formatOdfLength(document_schema_js.PAGE_SIZE_A4.heightPt),
|
|
53
|
+
"style:print-orientation": "portrait"
|
|
54
|
+
})]));
|
|
55
|
+
return name;
|
|
56
|
+
}
|
|
57
|
+
function writeSlideNotes(notes, state, stylesAutomaticStyles) {
|
|
58
|
+
if (notes.length === 0) return;
|
|
59
|
+
const paragraphs = notes.split("\n").map((line) => require_xml_fragment.el("text:p", {}, require_typed_shared_text.buildOdfInlineNodes(require_typed_shared_text.segmentOdfText(line, true, true))));
|
|
60
|
+
const frame = require_xml_fragment.el("draw:frame", {
|
|
61
|
+
"presentation:class": "notes",
|
|
62
|
+
"svg:x": require_typed_shared_units.formatOdfLength(NOTES_FRAME_BOX.xPt),
|
|
63
|
+
"svg:y": require_typed_shared_units.formatOdfLength(NOTES_FRAME_BOX.yPt),
|
|
64
|
+
"svg:width": require_typed_shared_units.formatOdfLength(NOTES_FRAME_BOX.widthPt),
|
|
65
|
+
"svg:height": require_typed_shared_units.formatOdfLength(NOTES_FRAME_BOX.heightPt)
|
|
66
|
+
}, [require_xml_fragment.el("draw:text-box", {}, paragraphs)]);
|
|
67
|
+
return require_xml_fragment.el("presentation:notes", { "style:page-layout-name": notesPageLayoutName(state, stylesAutomaticStyles) }, [frame]);
|
|
68
|
+
}
|
|
69
|
+
function writeOdpContent(document, options = {}) {
|
|
70
|
+
if (document.kind !== "presentation") throw new Error(`writeOdpContent: expected a 'presentation' document, got '${document.kind}' -- odf.js writes .odp from the presentation arm only`);
|
|
71
|
+
const version = options.version ?? "1.3";
|
|
72
|
+
const presentationElement = require_xml_fragment.el("office:presentation");
|
|
73
|
+
const pkg = require_package_io_scaffold.createOdfPackage(options.template ? require_media_type.ODF_MEDIA_TYPES.otp : require_media_type.ODF_MEDIA_TYPES.odp, presentationElement, version);
|
|
74
|
+
const registry = require_styles_registry.StyleRegistry.forPart(pkg, CONTENT_PART, { otherPart: {
|
|
75
|
+
pkg,
|
|
76
|
+
partPath: STYLES_PART
|
|
77
|
+
} });
|
|
78
|
+
const contentAutomaticStyles = require_package_io_scaffold.odfPartContainer(pkg, CONTENT_PART, "office:automatic-styles");
|
|
79
|
+
const stylesAutomaticStyles = require_package_io_scaffold.odfPartContainer(pkg, STYLES_PART, "office:automatic-styles");
|
|
80
|
+
const masterStyles = require_package_io_scaffold.odfPartContainer(pkg, STYLES_PART, "office:master-styles");
|
|
81
|
+
const shapeState = require_typed_draw_write_shapes.createDrawShapeWriteState(pkg, registry, contentAutomaticStyles);
|
|
82
|
+
const listState = { next: 1 };
|
|
83
|
+
const notesPageLayout = { name: void 0 };
|
|
84
|
+
document.slides.forEach((slide, index) => {
|
|
85
|
+
const masterPageName = `MP${index + 1}`;
|
|
86
|
+
const pageLayoutName = `PM${index + 1}`;
|
|
87
|
+
stylesAutomaticStyles.children.push(slidePageLayoutElement(pageLayoutName, slide.size));
|
|
88
|
+
masterStyles.children.push(require_xml_fragment.el("style:master-page", {
|
|
89
|
+
"style:name": require_xml_entities.encodeXmlText(masterPageName),
|
|
90
|
+
"style:page-layout-name": require_xml_entities.encodeXmlText(pageLayoutName)
|
|
91
|
+
}));
|
|
92
|
+
const shapeElements = require_typed_draw_write_shapes.writeDrawShapes(slide.shapes, listState, shapeState);
|
|
93
|
+
const notesElement = writeSlideNotes(slide.notes, notesPageLayout, stylesAutomaticStyles);
|
|
94
|
+
const children = [...shapeElements];
|
|
95
|
+
if (notesElement !== void 0) children.push(notesElement);
|
|
96
|
+
presentationElement.children.push(require_xml_fragment.el("draw:page", { "draw:master-page-name": require_xml_entities.encodeXmlText(masterPageName) }, children));
|
|
97
|
+
});
|
|
98
|
+
require_typed_shared_metadata.writeOdfMetadata(pkg, document.metadata, version);
|
|
99
|
+
require_manifest.syncManifest(pkg, { version });
|
|
100
|
+
return pkg;
|
|
101
|
+
}
|
|
102
|
+
function writeOdp(document, options = {}) {
|
|
103
|
+
return writeOdpContent((0, document_schema_js.flattenTree)(document), options);
|
|
104
|
+
}
|
|
105
|
+
//#endregion
|
|
106
|
+
exports.normaliseOdpContent = normaliseOdpContent;
|
|
107
|
+
exports.writeOdp = writeOdp;
|
|
108
|
+
exports.writeOdpContent = writeOdpContent;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { ODF_MEDIA_TYPES } from "../../media-type.js";
|
|
2
|
+
import { el } from "../../xml/fragment.js";
|
|
3
|
+
import { encodeXmlText } from "../../xml/entities.js";
|
|
4
|
+
import { syncManifest } from "../../manifest.js";
|
|
5
|
+
import { formatOdfLength } from "../shared/units.js";
|
|
6
|
+
import { StyleRegistry } from "../../styles/registry.js";
|
|
7
|
+
import { buildOdfInlineNodes, segmentOdfText } from "../shared/text.js";
|
|
8
|
+
import { writeOdfMetadata } from "../shared/metadata.js";
|
|
9
|
+
import { createOdfPackage, odfPartContainer } from "../../package-io/scaffold.js";
|
|
10
|
+
import { canonicalMetadata } from "../shared/canonicalise.js";
|
|
11
|
+
import { canonicalDrawShape, createDrawShapeWriteState, writeDrawShapes } from "../draw/write-shapes.js";
|
|
12
|
+
import { PAGE_SIZE_A4, flattenTree } from "document-schema.js";
|
|
13
|
+
//#region src/typed/odp/write.ts
|
|
14
|
+
const CONTENT_PART = "content.xml";
|
|
15
|
+
const STYLES_PART = "styles.xml";
|
|
16
|
+
function canonicalSlide(slide, listState) {
|
|
17
|
+
return {
|
|
18
|
+
size: slide.size,
|
|
19
|
+
shapes: slide.shapes.map((shape, index) => canonicalDrawShape(shape, index, listState)),
|
|
20
|
+
notes: slide.notes
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function normaliseOdpContent(document) {
|
|
24
|
+
if (document.kind !== "presentation") throw new Error(`normaliseOdpContent: expected a 'presentation' document, got '${document.kind}'`);
|
|
25
|
+
const listState = { next: 1 };
|
|
26
|
+
return {
|
|
27
|
+
kind: "presentation",
|
|
28
|
+
metadata: canonicalMetadata(document.metadata),
|
|
29
|
+
slides: document.slides.map((slide) => canonicalSlide(slide, listState))
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function slidePageLayoutElement(name, pageSize) {
|
|
33
|
+
return el("style:page-layout", { "style:name": encodeXmlText(name) }, [el("style:page-layout-properties", {
|
|
34
|
+
"fo:page-width": formatOdfLength(pageSize.widthPt),
|
|
35
|
+
"fo:page-height": formatOdfLength(pageSize.heightPt),
|
|
36
|
+
"style:print-orientation": pageSize.widthPt > pageSize.heightPt ? "landscape" : "portrait"
|
|
37
|
+
})]);
|
|
38
|
+
}
|
|
39
|
+
const NOTES_FRAME_BOX = {
|
|
40
|
+
xPt: 42,
|
|
41
|
+
yPt: 320,
|
|
42
|
+
widthPt: 500,
|
|
43
|
+
heightPt: 260
|
|
44
|
+
};
|
|
45
|
+
function notesPageLayoutName(state, stylesAutomaticStyles) {
|
|
46
|
+
if (state.name !== void 0) return state.name;
|
|
47
|
+
const name = "PM0";
|
|
48
|
+
state.name = name;
|
|
49
|
+
stylesAutomaticStyles.children.push(el("style:page-layout", { "style:name": name }, [el("style:page-layout-properties", {
|
|
50
|
+
"fo:page-width": formatOdfLength(PAGE_SIZE_A4.widthPt),
|
|
51
|
+
"fo:page-height": formatOdfLength(PAGE_SIZE_A4.heightPt),
|
|
52
|
+
"style:print-orientation": "portrait"
|
|
53
|
+
})]));
|
|
54
|
+
return name;
|
|
55
|
+
}
|
|
56
|
+
function writeSlideNotes(notes, state, stylesAutomaticStyles) {
|
|
57
|
+
if (notes.length === 0) return;
|
|
58
|
+
const paragraphs = notes.split("\n").map((line) => el("text:p", {}, buildOdfInlineNodes(segmentOdfText(line, true, true))));
|
|
59
|
+
const frame = el("draw:frame", {
|
|
60
|
+
"presentation:class": "notes",
|
|
61
|
+
"svg:x": formatOdfLength(NOTES_FRAME_BOX.xPt),
|
|
62
|
+
"svg:y": formatOdfLength(NOTES_FRAME_BOX.yPt),
|
|
63
|
+
"svg:width": formatOdfLength(NOTES_FRAME_BOX.widthPt),
|
|
64
|
+
"svg:height": formatOdfLength(NOTES_FRAME_BOX.heightPt)
|
|
65
|
+
}, [el("draw:text-box", {}, paragraphs)]);
|
|
66
|
+
return el("presentation:notes", { "style:page-layout-name": notesPageLayoutName(state, stylesAutomaticStyles) }, [frame]);
|
|
67
|
+
}
|
|
68
|
+
function writeOdpContent(document, options = {}) {
|
|
69
|
+
if (document.kind !== "presentation") throw new Error(`writeOdpContent: expected a 'presentation' document, got '${document.kind}' -- odf.js writes .odp from the presentation arm only`);
|
|
70
|
+
const version = options.version ?? "1.3";
|
|
71
|
+
const presentationElement = el("office:presentation");
|
|
72
|
+
const pkg = createOdfPackage(options.template ? ODF_MEDIA_TYPES.otp : ODF_MEDIA_TYPES.odp, presentationElement, version);
|
|
73
|
+
const registry = StyleRegistry.forPart(pkg, CONTENT_PART, { otherPart: {
|
|
74
|
+
pkg,
|
|
75
|
+
partPath: STYLES_PART
|
|
76
|
+
} });
|
|
77
|
+
const contentAutomaticStyles = odfPartContainer(pkg, CONTENT_PART, "office:automatic-styles");
|
|
78
|
+
const stylesAutomaticStyles = odfPartContainer(pkg, STYLES_PART, "office:automatic-styles");
|
|
79
|
+
const masterStyles = odfPartContainer(pkg, STYLES_PART, "office:master-styles");
|
|
80
|
+
const shapeState = createDrawShapeWriteState(pkg, registry, contentAutomaticStyles);
|
|
81
|
+
const listState = { next: 1 };
|
|
82
|
+
const notesPageLayout = { name: void 0 };
|
|
83
|
+
document.slides.forEach((slide, index) => {
|
|
84
|
+
const masterPageName = `MP${index + 1}`;
|
|
85
|
+
const pageLayoutName = `PM${index + 1}`;
|
|
86
|
+
stylesAutomaticStyles.children.push(slidePageLayoutElement(pageLayoutName, slide.size));
|
|
87
|
+
masterStyles.children.push(el("style:master-page", {
|
|
88
|
+
"style:name": encodeXmlText(masterPageName),
|
|
89
|
+
"style:page-layout-name": encodeXmlText(pageLayoutName)
|
|
90
|
+
}));
|
|
91
|
+
const shapeElements = writeDrawShapes(slide.shapes, listState, shapeState);
|
|
92
|
+
const notesElement = writeSlideNotes(slide.notes, notesPageLayout, stylesAutomaticStyles);
|
|
93
|
+
const children = [...shapeElements];
|
|
94
|
+
if (notesElement !== void 0) children.push(notesElement);
|
|
95
|
+
presentationElement.children.push(el("draw:page", { "draw:master-page-name": encodeXmlText(masterPageName) }, children));
|
|
96
|
+
});
|
|
97
|
+
writeOdfMetadata(pkg, document.metadata, version);
|
|
98
|
+
syncManifest(pkg, { version });
|
|
99
|
+
return pkg;
|
|
100
|
+
}
|
|
101
|
+
function writeOdp(document, options = {}) {
|
|
102
|
+
return writeOdpContent(flattenTree(document), options);
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
105
|
+
export { normaliseOdpContent, writeOdp, writeOdpContent };
|
package/dist/typed/ods/read.cjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_embedded = require("../../embedded-
|
|
2
|
+
const require_embedded = require("../../embedded-Bxyss_ck.cjs");
|
|
3
|
+
exports.DEFAULT_COLUMN_WIDTH_PT = require_embedded.DEFAULT_COLUMN_WIDTH_PT;
|
|
4
|
+
exports.DEFAULT_ROW_HEIGHT_PT = require_embedded.DEFAULT_ROW_HEIGHT_PT;
|
|
3
5
|
exports.readOds = require_embedded.readOds;
|
|
4
6
|
exports.readOdsContent = require_embedded.readOdsContent;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { OdsDocument, readOds, readOdsContent };
|
|
1
|
+
import { a as readOdsContent, i as readOds, n as DEFAULT_ROW_HEIGHT_PT, r as OdsDocument, t as DEFAULT_COLUMN_WIDTH_PT } from "../../read-fphkvCpR.cjs";
|
|
2
|
+
export { DEFAULT_COLUMN_WIDTH_PT, DEFAULT_ROW_HEIGHT_PT, OdsDocument, readOds, readOdsContent };
|
package/dist/typed/ods/read.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { OdsDocument, readOds, readOdsContent };
|
|
1
|
+
import { a as readOdsContent, i as readOds, n as DEFAULT_ROW_HEIGHT_PT, r as OdsDocument, t as DEFAULT_COLUMN_WIDTH_PT } from "../../read-A3CJkqVM.js";
|
|
2
|
+
export { DEFAULT_COLUMN_WIDTH_PT, DEFAULT_ROW_HEIGHT_PT, OdsDocument, readOds, readOdsContent };
|
package/dist/typed/ods/read.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { readOds, readOdsContent };
|
|
1
|
+
import { c as readOds, l as readOdsContent, o as DEFAULT_COLUMN_WIDTH_PT, s as DEFAULT_ROW_HEIGHT_PT } from "../../embedded-BnavfkP-.js";
|
|
2
|
+
export { DEFAULT_COLUMN_WIDTH_PT, DEFAULT_ROW_HEIGHT_PT, readOds, readOdsContent };
|