odf.js 5.1.2 → 5.3.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 +5 -3
- package/dist/{cascade-rhqUQrUa.d.ts → cascade-BZ7zqXhL.d.ts} +2 -2
- package/dist/{cascade-BmvsXcAz.d.cts → cascade-DWQfTwaM.d.cts} +2 -2
- package/dist/{codec-BAz7YIru.d.cts → codec-LgpdP32n.d.cts} +13 -13
- package/dist/{codec-BxxFEqvT.d.ts → codec-sFSMk-if.d.ts} +13 -13
- package/dist/codec.d.cts +1 -1
- package/dist/codec.d.ts +1 -1
- package/dist/{constructs-CJpDDQV0.d.ts → constructs-B1yajQJB.d.ts} +8 -1
- package/dist/{constructs-Dy_DMFs3.d.cts → constructs-BSC_5kfU.d.cts} +8 -1
- package/dist/embedded-BSSdoKcK.js +904 -0
- package/dist/{embedded-BPhuSEEI.d.ts → embedded-ClsebpWi.d.ts} +7 -2
- package/dist/embedded-DbLrCGPi.cjs +945 -0
- package/dist/{embedded-J3M3kDvY.d.cts → embedded-rKOsAsjg.d.cts} +7 -2
- package/dist/{form-D3H5H2NL.d.ts → form-CsOrcORr.d.ts} +2 -2
- package/dist/{form-BGCT81ss.d.cts → form-D8wh-xhJ.d.cts} +2 -2
- package/dist/{forms-cIjw-Jf-.d.cts → forms-BydLKkI0.d.cts} +1 -1
- package/dist/{forms-D1-0spCe.d.ts → forms-iwRSwhOn.d.ts} +1 -1
- package/dist/index.cjs +7 -9
- package/dist/index.d.cts +15 -15
- package/dist/index.d.ts +15 -15
- package/dist/index.js +2 -4
- package/dist/{masterpage-XJ2v2khe.d.cts → masterpage-Bt6gxuoL.d.cts} +2 -1
- package/dist/{masterpage-C1McDhMv.d.ts → masterpage-By_F05W4.d.ts} +2 -1
- package/dist/{paragraph-6hzAZpmi.d.ts → paragraph-BE71DZ0t.d.ts} +4 -3
- package/dist/{paragraph-BBmSl_sK.d.cts → paragraph-CuEMXbDg.d.cts} +4 -3
- package/dist/{properties-BF_Fv6B3.d.cts → properties-C-JKQZUD.d.cts} +2 -0
- package/dist/{properties-DjAIdPry.d.ts → properties-Rral02h1.d.ts} +2 -0
- package/dist/read-24g5eZw6.d.ts +25 -0
- package/dist/{read-lc0t0UHK.d.ts → read-BLoaDxr_.d.ts} +2 -1
- package/dist/{read-B4238IGr.d.cts → read-C3Ei_MYc.d.cts} +2 -1
- package/dist/{read-CTfeWaWq.d.cts → read-CDSmR3qt.d.cts} +2 -1
- package/dist/{read-CdvX2qnz.d.ts → read-DJqvINGW.d.ts} +2 -1
- package/dist/{read-Db_GZ0ZH.d.ts → read-DfEHXwgn.d.ts} +2 -1
- package/dist/{read-DOYWO6BM.d.cts → read-IOYq80AA.d.cts} +2 -1
- package/dist/read-rwDsgR0d.d.cts +25 -0
- package/dist/{registry-CaJpWDke.d.cts → registry-CphRYjDD.d.cts} +1 -1
- package/dist/{registry-BVeEpUMI.d.ts → registry-D5RGBteE.d.ts} +1 -1
- package/dist/{serialize-DvaE_t5D.d.ts → serialize-B-lq0LiG.d.ts} +1 -1
- package/dist/{serialize-9xvti0FF.d.cts → serialize-D1fti8C5.d.cts} +1 -1
- package/dist/styles/properties.cjs +25 -3
- package/dist/styles/properties.d.cts +1 -1
- package/dist/styles/properties.d.ts +1 -1
- package/dist/styles/properties.js +25 -3
- package/dist/styles/registry.d.cts +1 -1
- package/dist/styles/registry.d.ts +1 -1
- package/dist/styles/serialize.d.cts +1 -1
- package/dist/styles/serialize.d.ts +1 -1
- package/dist/typed/draw/embedded.cjs +4 -85
- package/dist/typed/draw/embedded.d.cts +2 -2
- package/dist/typed/draw/embedded.d.ts +2 -2
- package/dist/typed/draw/embedded.js +2 -84
- package/dist/typed/draw/shapes.cjs +4 -1
- package/dist/typed/draw/shapes.js +4 -1
- package/dist/typed/odb/form.cjs +2 -2
- package/dist/typed/odb/form.d.cts +1 -1
- package/dist/typed/odb/form.d.ts +1 -1
- package/dist/typed/odb/form.js +1 -1
- package/dist/typed/odg/read.cjs +14 -4
- package/dist/typed/odg/read.d.cts +1 -1
- package/dist/typed/odg/read.d.ts +1 -1
- package/dist/typed/odg/read.js +14 -4
- package/dist/typed/odp/read.cjs +51 -4
- package/dist/typed/odp/read.d.cts +1 -1
- package/dist/typed/odp/read.d.ts +1 -1
- package/dist/typed/odp/read.js +52 -5
- package/dist/typed/ods/read.cjs +3 -446
- package/dist/typed/ods/read.d.cts +1 -1
- package/dist/typed/ods/read.d.ts +1 -1
- package/dist/typed/ods/read.js +1 -444
- package/dist/typed/odt/read.cjs +3 -310
- package/dist/typed/odt/read.d.cts +2 -2
- package/dist/typed/odt/read.d.ts +2 -2
- package/dist/typed/odt/read.js +1 -308
- package/dist/typed/shared/cascade.d.cts +1 -1
- package/dist/typed/shared/cascade.d.ts +1 -1
- package/dist/typed/shared/constructs.cjs +73 -0
- package/dist/typed/shared/constructs.d.cts +2 -2
- package/dist/typed/shared/constructs.d.ts +2 -2
- package/dist/typed/shared/constructs.js +67 -1
- package/dist/typed/shared/forms.d.cts +1 -1
- package/dist/typed/shared/forms.d.ts +1 -1
- package/dist/typed/shared/masterpage.cjs +7 -0
- package/dist/typed/shared/masterpage.d.cts +2 -2
- package/dist/typed/shared/masterpage.d.ts +2 -2
- package/dist/typed/shared/masterpage.js +7 -1
- package/dist/typed/shared/paragraph.cjs +17 -6
- package/dist/typed/shared/paragraph.d.cts +2 -2
- package/dist/typed/shared/paragraph.d.ts +2 -2
- package/dist/typed/shared/paragraph.js +18 -8
- package/package.json +2 -2
- package/dist/read-Cs1ktkWB.d.cts +0 -15
- package/dist/read-DHuiGh_y.d.ts +0 -15
|
@@ -17,7 +17,9 @@ const StylePropertiesSchema = z.object({
|
|
|
17
17
|
spacingAfterPt: z.number().optional(),
|
|
18
18
|
lineSpacing: z.number().optional(),
|
|
19
19
|
indentLeftPt: z.number().optional(),
|
|
20
|
-
indentFirstLinePt: z.number().optional()
|
|
20
|
+
indentFirstLinePt: z.number().optional(),
|
|
21
|
+
pageBreakBefore: z.boolean().optional(),
|
|
22
|
+
pageBreakAfter: z.boolean().optional()
|
|
21
23
|
});
|
|
22
24
|
const ATTR = {
|
|
23
25
|
fontWeight: "fo:font-weight",
|
|
@@ -35,7 +37,9 @@ const ATTR = {
|
|
|
35
37
|
marginBottom: "fo:margin-bottom",
|
|
36
38
|
lineHeight: "fo:line-height",
|
|
37
39
|
marginLeft: "fo:margin-left",
|
|
38
|
-
textIndent: "fo:text-indent"
|
|
40
|
+
textIndent: "fo:text-indent",
|
|
41
|
+
breakBefore: "fo:break-before",
|
|
42
|
+
breakAfter: "fo:break-after"
|
|
39
43
|
};
|
|
40
44
|
const TEXT_ATTR_NAMES = /* @__PURE__ */ new Set([
|
|
41
45
|
ATTR.fontWeight,
|
|
@@ -55,7 +59,9 @@ const PARAGRAPH_ATTR_NAMES = /* @__PURE__ */ new Set([
|
|
|
55
59
|
ATTR.marginBottom,
|
|
56
60
|
ATTR.lineHeight,
|
|
57
61
|
ATTR.marginLeft,
|
|
58
|
-
ATTR.textIndent
|
|
62
|
+
ATTR.textIndent,
|
|
63
|
+
ATTR.breakBefore,
|
|
64
|
+
ATTR.breakAfter
|
|
59
65
|
]);
|
|
60
66
|
function attributeMap(element) {
|
|
61
67
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -159,6 +165,14 @@ function parseParagraphProperties(element) {
|
|
|
159
165
|
if (multiplier === void 0) hasUnknown = true;
|
|
160
166
|
else properties.lineSpacing = multiplier;
|
|
161
167
|
}
|
|
168
|
+
const breakBefore = attrs.get(ATTR.breakBefore);
|
|
169
|
+
if (breakBefore === "page") properties.pageBreakBefore = true;
|
|
170
|
+
else if (breakBefore === "auto") properties.pageBreakBefore = false;
|
|
171
|
+
else if (breakBefore !== void 0) hasUnknown = true;
|
|
172
|
+
const breakAfter = attrs.get(ATTR.breakAfter);
|
|
173
|
+
if (breakAfter === "page") properties.pageBreakAfter = true;
|
|
174
|
+
else if (breakAfter === "auto") properties.pageBreakAfter = false;
|
|
175
|
+
else if (breakAfter !== void 0) hasUnknown = true;
|
|
162
176
|
return {
|
|
163
177
|
properties,
|
|
164
178
|
hasUnknown
|
|
@@ -275,6 +289,14 @@ function paragraphPropertiesToAttributes(properties) {
|
|
|
275
289
|
name: ATTR.textIndent,
|
|
276
290
|
value: formatPt(properties.indentFirstLinePt)
|
|
277
291
|
});
|
|
292
|
+
if (properties.pageBreakBefore !== void 0) attributes.push({
|
|
293
|
+
name: ATTR.breakBefore,
|
|
294
|
+
value: properties.pageBreakBefore ? "page" : "auto"
|
|
295
|
+
});
|
|
296
|
+
if (properties.pageBreakAfter !== void 0) attributes.push({
|
|
297
|
+
name: ATTR.breakAfter,
|
|
298
|
+
value: properties.pageBreakAfter ? "page" : "auto"
|
|
299
|
+
});
|
|
278
300
|
return attributes;
|
|
279
301
|
}
|
|
280
302
|
//#endregion
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as StyleRegistry, i as StyleFamily, n as OtherPartRef, o as StyleRegistryOptions, r as STYLE_FAMILIES, s as isStyleFamily, t as InternRequest } from "../registry-
|
|
1
|
+
import { a as StyleRegistry, i as StyleFamily, n as OtherPartRef, o as StyleRegistryOptions, r as STYLE_FAMILIES, s as isStyleFamily, t as InternRequest } from "../registry-CphRYjDD.cjs";
|
|
2
2
|
export { InternRequest, OtherPartRef, STYLE_FAMILIES, StyleFamily, StyleRegistry, StyleRegistryOptions, isStyleFamily };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as StyleRegistry, i as StyleFamily, n as OtherPartRef, o as StyleRegistryOptions, r as STYLE_FAMILIES, s as isStyleFamily, t as InternRequest } from "../registry-
|
|
1
|
+
import { a as StyleRegistry, i as StyleFamily, n as OtherPartRef, o as StyleRegistryOptions, r as STYLE_FAMILIES, s as isStyleFamily, t as InternRequest } from "../registry-D5RGBteE.js";
|
|
2
2
|
export { InternRequest, OtherPartRef, STYLE_FAMILIES, StyleFamily, StyleRegistry, StyleRegistryOptions, isStyleFamily };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as canonicalPropertiesString, t as buildStylePropertyElements } from "../serialize-
|
|
1
|
+
import { n as canonicalPropertiesString, t as buildStylePropertyElements } from "../serialize-D1fti8C5.cjs";
|
|
2
2
|
export { buildStylePropertyElements, canonicalPropertiesString };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as canonicalPropertiesString, t as buildStylePropertyElements } from "../serialize-
|
|
1
|
+
import { n as canonicalPropertiesString, t as buildStylePropertyElements } from "../serialize-B-lq0LiG.js";
|
|
2
2
|
export { buildStylePropertyElements, canonicalPropertiesString };
|
|
@@ -1,86 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const require_typed_odb_subdocument = require("../odb/subdocument.cjs");
|
|
7
|
-
//#region src/typed/draw/embedded.ts
|
|
8
|
-
const CONTENT_PART = "content.xml";
|
|
9
|
-
function embeddedKindFor(bodyChildTag) {
|
|
10
|
-
switch (bodyChildTag) {
|
|
11
|
-
case "office:text": return "wordprocessing";
|
|
12
|
-
case "office:spreadsheet": return "spreadsheet";
|
|
13
|
-
case "office:presentation": return "presentation";
|
|
14
|
-
case "office:drawing": return "drawing";
|
|
15
|
-
case "office:chart": return "chart";
|
|
16
|
-
default: return;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
function readOdfChartContent(chartPackage, frame, format) {
|
|
20
|
-
const contentPart = chartPackage.parts[CONTENT_PART];
|
|
21
|
-
const contentRoot = contentPart?.kind === "xml" ? require_xml_query.rootElement(contentPart.nodes) : void 0;
|
|
22
|
-
const chartElement = contentRoot === void 0 ? void 0 : require_xml_query.elementsWithTag(contentRoot.children, "chart:chart")[0];
|
|
23
|
-
const localTable = chartElement === void 0 ? void 0 : require_xml_query.elementsWithTag(chartElement.children, "table:table")[0];
|
|
24
|
-
const blocks = localTable === void 0 ? [] : [require_typed_shared_table.readOdfTable(localTable, chartPackage)];
|
|
25
|
-
return {
|
|
26
|
-
document: {
|
|
27
|
-
kind: "drawing",
|
|
28
|
-
metadata: {},
|
|
29
|
-
pages: [{
|
|
30
|
-
size: {
|
|
31
|
-
widthPt: frame.widthPt,
|
|
32
|
-
heightPt: frame.heightPt
|
|
33
|
-
},
|
|
34
|
-
shapes: [{
|
|
35
|
-
frame: {
|
|
36
|
-
xPt: 0,
|
|
37
|
-
yPt: 0,
|
|
38
|
-
widthPt: frame.widthPt,
|
|
39
|
-
heightPt: frame.heightPt
|
|
40
|
-
},
|
|
41
|
-
insetLeftPt: 0,
|
|
42
|
-
insetTopPt: 0,
|
|
43
|
-
insetRightPt: 0,
|
|
44
|
-
insetBottomPt: 0,
|
|
45
|
-
blocks
|
|
46
|
-
}],
|
|
47
|
-
vectors: []
|
|
48
|
-
}]
|
|
49
|
-
},
|
|
50
|
-
residue: chartElement === void 0 ? void 0 : require_typed_shared_constructs.odfResidue(format, chartElement)
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
function subDocumentKind(nodes) {
|
|
54
|
-
const root = require_xml_query.rootElement(nodes);
|
|
55
|
-
const body = root === void 0 ? void 0 : require_xml_query.findChildElement(root.children, "office:body");
|
|
56
|
-
const bodyChild = body === void 0 ? void 0 : require_xml_query.rootElement(body.children);
|
|
57
|
-
const bodyKind = bodyChild === void 0 ? void 0 : embeddedKindFor(bodyChild.tag);
|
|
58
|
-
if (bodyKind !== void 0) return bodyKind;
|
|
59
|
-
return require_typed_formula_read.findMathRoot(nodes) === void 0 ? void 0 : "formula";
|
|
60
|
-
}
|
|
61
|
-
function normaliseObjectHref(raw) {
|
|
62
|
-
const withoutPrefix = raw.startsWith("./") ? raw.slice(2) : raw;
|
|
63
|
-
const trimmed = withoutPrefix.endsWith("/") ? withoutPrefix.slice(0, -1) : withoutPrefix;
|
|
64
|
-
if (trimmed.length === 0 || trimmed.startsWith("..") || trimmed.startsWith("/") || trimmed.includes("://")) return;
|
|
65
|
-
return trimmed;
|
|
66
|
-
}
|
|
67
|
-
function readDrawObjectReference(frame, pkg) {
|
|
68
|
-
const object = require_xml_query.childrenWithTag(frame, "draw:object")[0];
|
|
69
|
-
if (object === void 0) return;
|
|
70
|
-
const rawHref = require_xml_query.attrValue(object, "xlink:href");
|
|
71
|
-
const href = rawHref === void 0 ? void 0 : normaliseObjectHref(rawHref);
|
|
72
|
-
if (href === void 0) return;
|
|
73
|
-
const subPackage = require_typed_odb_subdocument.subDocumentPackage(pkg, href, { allowMissingContent: true });
|
|
74
|
-
const contentPart = subPackage.parts[CONTENT_PART];
|
|
75
|
-
if (contentPart?.kind !== "xml") return;
|
|
76
|
-
const objectKind = subDocumentKind(contentPart.nodes);
|
|
77
|
-
if (objectKind === void 0) return;
|
|
78
|
-
return {
|
|
79
|
-
objectKind,
|
|
80
|
-
package: subPackage,
|
|
81
|
-
href
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
//#endregion
|
|
85
|
-
exports.readDrawObjectReference = readDrawObjectReference;
|
|
86
|
-
exports.readOdfChartContent = readOdfChartContent;
|
|
2
|
+
const require_embedded = require("../../embedded-DbLrCGPi.cjs");
|
|
3
|
+
exports.readDrawObjectReference = require_embedded.readDrawObjectReference;
|
|
4
|
+
exports.readEmbeddedObjectDocument = require_embedded.readEmbeddedObjectDocument;
|
|
5
|
+
exports.readOdfChartContent = require_embedded.readOdfChartContent;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as
|
|
2
|
-
export { EmbeddedDocumentKind, EmbeddedDrawObject, readDrawObjectReference, readOdfChartContent };
|
|
1
|
+
import { a as readEmbeddedObjectDocument, i as readDrawObjectReference, n as EmbeddedDocumentRead, o as readOdfChartContent, r as EmbeddedDrawObject, t as EmbeddedDocumentKind } from "../../embedded-rKOsAsjg.cjs";
|
|
2
|
+
export { EmbeddedDocumentKind, EmbeddedDocumentRead, EmbeddedDrawObject, readDrawObjectReference, readEmbeddedObjectDocument, readOdfChartContent };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as
|
|
2
|
-
export { EmbeddedDocumentKind, EmbeddedDrawObject, readDrawObjectReference, readOdfChartContent };
|
|
1
|
+
import { a as readEmbeddedObjectDocument, i as readDrawObjectReference, n as EmbeddedDocumentRead, o as readOdfChartContent, r as EmbeddedDrawObject, t as EmbeddedDocumentKind } from "../../embedded-ClsebpWi.js";
|
|
2
|
+
export { EmbeddedDocumentKind, EmbeddedDocumentRead, EmbeddedDrawObject, readDrawObjectReference, readEmbeddedObjectDocument, readOdfChartContent };
|
|
@@ -1,84 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { readOdfTable } from "../shared/table.js";
|
|
4
|
-
import { findMathRoot } from "../formula/read.js";
|
|
5
|
-
import { subDocumentPackage } from "../odb/subdocument.js";
|
|
6
|
-
//#region src/typed/draw/embedded.ts
|
|
7
|
-
const CONTENT_PART = "content.xml";
|
|
8
|
-
function embeddedKindFor(bodyChildTag) {
|
|
9
|
-
switch (bodyChildTag) {
|
|
10
|
-
case "office:text": return "wordprocessing";
|
|
11
|
-
case "office:spreadsheet": return "spreadsheet";
|
|
12
|
-
case "office:presentation": return "presentation";
|
|
13
|
-
case "office:drawing": return "drawing";
|
|
14
|
-
case "office:chart": return "chart";
|
|
15
|
-
default: return;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
function readOdfChartContent(chartPackage, frame, format) {
|
|
19
|
-
const contentPart = chartPackage.parts[CONTENT_PART];
|
|
20
|
-
const contentRoot = contentPart?.kind === "xml" ? rootElement(contentPart.nodes) : void 0;
|
|
21
|
-
const chartElement = contentRoot === void 0 ? void 0 : elementsWithTag(contentRoot.children, "chart:chart")[0];
|
|
22
|
-
const localTable = chartElement === void 0 ? void 0 : elementsWithTag(chartElement.children, "table:table")[0];
|
|
23
|
-
const blocks = localTable === void 0 ? [] : [readOdfTable(localTable, chartPackage)];
|
|
24
|
-
return {
|
|
25
|
-
document: {
|
|
26
|
-
kind: "drawing",
|
|
27
|
-
metadata: {},
|
|
28
|
-
pages: [{
|
|
29
|
-
size: {
|
|
30
|
-
widthPt: frame.widthPt,
|
|
31
|
-
heightPt: frame.heightPt
|
|
32
|
-
},
|
|
33
|
-
shapes: [{
|
|
34
|
-
frame: {
|
|
35
|
-
xPt: 0,
|
|
36
|
-
yPt: 0,
|
|
37
|
-
widthPt: frame.widthPt,
|
|
38
|
-
heightPt: frame.heightPt
|
|
39
|
-
},
|
|
40
|
-
insetLeftPt: 0,
|
|
41
|
-
insetTopPt: 0,
|
|
42
|
-
insetRightPt: 0,
|
|
43
|
-
insetBottomPt: 0,
|
|
44
|
-
blocks
|
|
45
|
-
}],
|
|
46
|
-
vectors: []
|
|
47
|
-
}]
|
|
48
|
-
},
|
|
49
|
-
residue: chartElement === void 0 ? void 0 : odfResidue(format, chartElement)
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
function subDocumentKind(nodes) {
|
|
53
|
-
const root = rootElement(nodes);
|
|
54
|
-
const body = root === void 0 ? void 0 : findChildElement(root.children, "office:body");
|
|
55
|
-
const bodyChild = body === void 0 ? void 0 : rootElement(body.children);
|
|
56
|
-
const bodyKind = bodyChild === void 0 ? void 0 : embeddedKindFor(bodyChild.tag);
|
|
57
|
-
if (bodyKind !== void 0) return bodyKind;
|
|
58
|
-
return findMathRoot(nodes) === void 0 ? void 0 : "formula";
|
|
59
|
-
}
|
|
60
|
-
function normaliseObjectHref(raw) {
|
|
61
|
-
const withoutPrefix = raw.startsWith("./") ? raw.slice(2) : raw;
|
|
62
|
-
const trimmed = withoutPrefix.endsWith("/") ? withoutPrefix.slice(0, -1) : withoutPrefix;
|
|
63
|
-
if (trimmed.length === 0 || trimmed.startsWith("..") || trimmed.startsWith("/") || trimmed.includes("://")) return;
|
|
64
|
-
return trimmed;
|
|
65
|
-
}
|
|
66
|
-
function readDrawObjectReference(frame, pkg) {
|
|
67
|
-
const object = childrenWithTag(frame, "draw:object")[0];
|
|
68
|
-
if (object === void 0) return;
|
|
69
|
-
const rawHref = attrValue(object, "xlink:href");
|
|
70
|
-
const href = rawHref === void 0 ? void 0 : normaliseObjectHref(rawHref);
|
|
71
|
-
if (href === void 0) return;
|
|
72
|
-
const subPackage = subDocumentPackage(pkg, href, { allowMissingContent: true });
|
|
73
|
-
const contentPart = subPackage.parts[CONTENT_PART];
|
|
74
|
-
if (contentPart?.kind !== "xml") return;
|
|
75
|
-
const objectKind = subDocumentKind(contentPart.nodes);
|
|
76
|
-
if (objectKind === void 0) return;
|
|
77
|
-
return {
|
|
78
|
-
objectKind,
|
|
79
|
-
package: subPackage,
|
|
80
|
-
href
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
//#endregion
|
|
84
|
-
export { readDrawObjectReference, readOdfChartContent };
|
|
1
|
+
import { n as readEmbeddedObjectDocument, r as readOdfChartContent, t as readDrawObjectReference } from "../../embedded-BSSdoKcK.js";
|
|
2
|
+
export { readDrawObjectReference, readEmbeddedObjectDocument, readOdfChartContent };
|
|
@@ -8,6 +8,7 @@ const require_typed_shared_text = require("../shared/text.cjs");
|
|
|
8
8
|
const require_typed_shared_geometry = require("../shared/geometry.cjs");
|
|
9
9
|
const require_typed_shared_cascade = require("../shared/cascade.cjs");
|
|
10
10
|
const require_typed_shared_list = require("../shared/list.cjs");
|
|
11
|
+
const require_typed_shared_constructs = require("../shared/constructs.cjs");
|
|
11
12
|
const require_typed_shared_paragraph = require("../shared/paragraph.cjs");
|
|
12
13
|
const require_typed_shared_table = require("../shared/table.cjs");
|
|
13
14
|
const require_typed_shared_transform = require("../shared/transform.cjs");
|
|
@@ -284,12 +285,14 @@ function readCustomShapeAsTextShape(element, groupFunctions, pkg) {
|
|
|
284
285
|
const ownGeometry = require_typed_shared_transform.resolveOdfShapeGeometry(element);
|
|
285
286
|
if (ownGeometry === void 0) return;
|
|
286
287
|
const geometry = require_typed_shared_transform.composeOdfGroupTransform(groupFunctions, ownGeometry);
|
|
288
|
+
const enhancedGeometry = require_xml_query.childrenWithTag(element, "draw:enhanced-geometry")[0];
|
|
287
289
|
return {
|
|
288
290
|
name: require_xml_query.attrValue(element, "draw:name"),
|
|
289
291
|
frame: geometry.frame,
|
|
290
292
|
rotationDeg: geometry.rotationDeg,
|
|
291
293
|
...readFrameInsets(element, pkg),
|
|
292
|
-
blocks: paragraphs
|
|
294
|
+
blocks: paragraphs,
|
|
295
|
+
...enhancedGeometry !== void 0 ? { source: require_typed_shared_constructs.odfResidue("odg", enhancedGeometry) } : {}
|
|
293
296
|
};
|
|
294
297
|
}
|
|
295
298
|
function nextDocumentIndex(state) {
|
|
@@ -7,6 +7,7 @@ import { decodeOdfText } from "../shared/text.js";
|
|
|
7
7
|
import { parseLinePoints } from "../shared/geometry.js";
|
|
8
8
|
import { resolveStyleElementChain } from "../shared/cascade.js";
|
|
9
9
|
import { mintOdfListNumId, readOdfListParagraphs } from "../shared/list.js";
|
|
10
|
+
import { odfResidue } from "../shared/constructs.js";
|
|
10
11
|
import { readOdfParagraph } from "../shared/paragraph.js";
|
|
11
12
|
import { readOdfTable } from "../shared/table.js";
|
|
12
13
|
import { applyOdfTransform, composeOdfGroupTransform, parseOdfTransform, resolveOdfShapeGeometry } from "../shared/transform.js";
|
|
@@ -283,12 +284,14 @@ function readCustomShapeAsTextShape(element, groupFunctions, pkg) {
|
|
|
283
284
|
const ownGeometry = resolveOdfShapeGeometry(element);
|
|
284
285
|
if (ownGeometry === void 0) return;
|
|
285
286
|
const geometry = composeOdfGroupTransform(groupFunctions, ownGeometry);
|
|
287
|
+
const enhancedGeometry = childrenWithTag(element, "draw:enhanced-geometry")[0];
|
|
286
288
|
return {
|
|
287
289
|
name: attrValue(element, "draw:name"),
|
|
288
290
|
frame: geometry.frame,
|
|
289
291
|
rotationDeg: geometry.rotationDeg,
|
|
290
292
|
...readFrameInsets(element, pkg),
|
|
291
|
-
blocks: paragraphs
|
|
293
|
+
blocks: paragraphs,
|
|
294
|
+
...enhancedGeometry !== void 0 ? { source: odfResidue("odg", enhancedGeometry) } : {}
|
|
292
295
|
};
|
|
293
296
|
}
|
|
294
297
|
function nextDocumentIndex(state) {
|
package/dist/typed/odb/form.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_xml_query = require("../../xml/query.cjs");
|
|
3
3
|
const require_typed_odb_subdocument = require("./subdocument.cjs");
|
|
4
|
+
const require_embedded = require("../../embedded-DbLrCGPi.cjs");
|
|
4
5
|
const require_typed_shared_forms = require("../shared/forms.cjs");
|
|
5
|
-
const require_typed_odt_read = require("../odt/read.cjs");
|
|
6
6
|
const require_typed_odb_read = require("./read.cjs");
|
|
7
7
|
//#region src/typed/odb/form.ts
|
|
8
8
|
const CONTENT_PART = "content.xml";
|
|
@@ -20,7 +20,7 @@ function readOdbForm(pkg, formName) {
|
|
|
20
20
|
return {
|
|
21
21
|
name: component.name,
|
|
22
22
|
href: component.href,
|
|
23
|
-
document:
|
|
23
|
+
document: require_embedded.readOdtContent(subPackage),
|
|
24
24
|
forms: readFormDefinitions(require_xml_query.rootElement(contentPart.nodes))
|
|
25
25
|
};
|
|
26
26
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as readOdbForm, t as OdbForm } from "../../form-
|
|
1
|
+
import { n as readOdbForm, t as OdbForm } from "../../form-D8wh-xhJ.cjs";
|
|
2
2
|
export { OdbForm, readOdbForm };
|
package/dist/typed/odb/form.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as readOdbForm, t as OdbForm } from "../../form-
|
|
1
|
+
import { n as readOdbForm, t as OdbForm } from "../../form-CsOrcORr.js";
|
|
2
2
|
export { OdbForm, readOdbForm };
|
package/dist/typed/odb/form.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { findChildElement, rootElement } from "../../xml/query.js";
|
|
2
2
|
import { subDocumentPackage } from "./subdocument.js";
|
|
3
|
+
import { a as readOdtContent } from "../../embedded-BSSdoKcK.js";
|
|
3
4
|
import { readOdfFormDefinitions } from "../shared/forms.js";
|
|
4
|
-
import { readOdtContent } from "../odt/read.js";
|
|
5
5
|
import { resolveOdbComponent } from "./read.js";
|
|
6
6
|
//#region src/typed/odb/form.ts
|
|
7
7
|
const CONTENT_PART = "content.xml";
|
package/dist/typed/odg/read.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_xml_query = require("../../xml/query.cjs");
|
|
3
3
|
const require_typed_shared_metadata = require("../shared/metadata.cjs");
|
|
4
|
+
const require_typed_shared_constructs = require("../shared/constructs.cjs");
|
|
4
5
|
const require_typed_shared_masterpage = require("../shared/masterpage.cjs");
|
|
5
6
|
const require_typed_draw_shapes = require("../draw/shapes.cjs");
|
|
6
7
|
let document_schema_js = require("document-schema.js");
|
|
@@ -9,10 +10,14 @@ const CONTENT_PART = "content.xml";
|
|
|
9
10
|
function readPage(page, pkg) {
|
|
10
11
|
const size = require_typed_shared_masterpage.resolveDrawPageSize(page, pkg) ?? document_schema_js.PAGE_SIZE_A4;
|
|
11
12
|
const { shapes, vectors } = require_typed_draw_shapes.readDrawPageContent(page.children, pkg);
|
|
13
|
+
const unmapped = [];
|
|
14
|
+
require_typed_shared_constructs.collectOdfUnmappedShapeResidue(page.children, unmapped);
|
|
15
|
+
const source = unmapped.length > 0 ? require_typed_shared_constructs.odfResidue("odg", ...unmapped) : void 0;
|
|
12
16
|
return {
|
|
13
17
|
size,
|
|
14
18
|
shapes,
|
|
15
|
-
vectors
|
|
19
|
+
vectors,
|
|
20
|
+
...source !== void 0 ? { source } : {}
|
|
16
21
|
};
|
|
17
22
|
}
|
|
18
23
|
function readOdgContent(pkg) {
|
|
@@ -21,18 +26,23 @@ function readOdgContent(pkg) {
|
|
|
21
26
|
const body = root === void 0 ? void 0 : require_xml_query.findChildElement(root.children, "office:body");
|
|
22
27
|
const drawing = body === void 0 ? void 0 : require_xml_query.findChildElement(body.children, "office:drawing");
|
|
23
28
|
const pages = drawing === void 0 ? [] : require_xml_query.childrenWithTag(drawing, "draw:page");
|
|
29
|
+
const source = {};
|
|
30
|
+
require_typed_shared_constructs.collectOdfNonContentPartResidue(pkg, "odg", source);
|
|
24
31
|
return {
|
|
25
32
|
metadata: require_typed_shared_metadata.readOdfMetadata(pkg),
|
|
26
|
-
pages: pages.map((page) => readPage(page, pkg))
|
|
33
|
+
pages: pages.map((page) => readPage(page, pkg)),
|
|
34
|
+
...Object.keys(source).length > 0 ? { source } : {}
|
|
27
35
|
};
|
|
28
36
|
}
|
|
29
37
|
function readOdg(pkg) {
|
|
30
|
-
const { metadata, pages } = readOdgContent(pkg);
|
|
31
|
-
|
|
38
|
+
const { metadata, pages, source } = readOdgContent(pkg);
|
|
39
|
+
const assembled = (0, document_schema_js.assemblePackage)({
|
|
32
40
|
kind: "drawing",
|
|
33
41
|
metadata,
|
|
34
42
|
pages
|
|
35
43
|
});
|
|
44
|
+
if (source !== void 0) assembled.source = source;
|
|
45
|
+
return assembled;
|
|
36
46
|
}
|
|
37
47
|
//#endregion
|
|
38
48
|
exports.readOdg = readOdg;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as readOdg, r as readOdgContent, t as OdgDocument } from "../../read-
|
|
1
|
+
import { n as readOdg, r as readOdgContent, t as OdgDocument } from "../../read-IOYq80AA.cjs";
|
|
2
2
|
export { OdgDocument, readOdg, readOdgContent };
|
package/dist/typed/odg/read.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as readOdg, r as readOdgContent, t as OdgDocument } from "../../read-
|
|
1
|
+
import { n as readOdg, r as readOdgContent, t as OdgDocument } from "../../read-BLoaDxr_.js";
|
|
2
2
|
export { OdgDocument, readOdg, readOdgContent };
|
package/dist/typed/odg/read.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { childrenWithTag, findChildElement, rootElement } from "../../xml/query.js";
|
|
2
2
|
import { readOdfMetadata } from "../shared/metadata.js";
|
|
3
|
+
import { collectOdfNonContentPartResidue, collectOdfUnmappedShapeResidue, odfResidue } from "../shared/constructs.js";
|
|
3
4
|
import { resolveDrawPageSize } from "../shared/masterpage.js";
|
|
4
5
|
import { readDrawPageContent } from "../draw/shapes.js";
|
|
5
6
|
import { PAGE_SIZE_A4, assemblePackage } from "document-schema.js";
|
|
@@ -8,10 +9,14 @@ const CONTENT_PART = "content.xml";
|
|
|
8
9
|
function readPage(page, pkg) {
|
|
9
10
|
const size = resolveDrawPageSize(page, pkg) ?? PAGE_SIZE_A4;
|
|
10
11
|
const { shapes, vectors } = readDrawPageContent(page.children, pkg);
|
|
12
|
+
const unmapped = [];
|
|
13
|
+
collectOdfUnmappedShapeResidue(page.children, unmapped);
|
|
14
|
+
const source = unmapped.length > 0 ? odfResidue("odg", ...unmapped) : void 0;
|
|
11
15
|
return {
|
|
12
16
|
size,
|
|
13
17
|
shapes,
|
|
14
|
-
vectors
|
|
18
|
+
vectors,
|
|
19
|
+
...source !== void 0 ? { source } : {}
|
|
15
20
|
};
|
|
16
21
|
}
|
|
17
22
|
function readOdgContent(pkg) {
|
|
@@ -20,18 +25,23 @@ function readOdgContent(pkg) {
|
|
|
20
25
|
const body = root === void 0 ? void 0 : findChildElement(root.children, "office:body");
|
|
21
26
|
const drawing = body === void 0 ? void 0 : findChildElement(body.children, "office:drawing");
|
|
22
27
|
const pages = drawing === void 0 ? [] : childrenWithTag(drawing, "draw:page");
|
|
28
|
+
const source = {};
|
|
29
|
+
collectOdfNonContentPartResidue(pkg, "odg", source);
|
|
23
30
|
return {
|
|
24
31
|
metadata: readOdfMetadata(pkg),
|
|
25
|
-
pages: pages.map((page) => readPage(page, pkg))
|
|
32
|
+
pages: pages.map((page) => readPage(page, pkg)),
|
|
33
|
+
...Object.keys(source).length > 0 ? { source } : {}
|
|
26
34
|
};
|
|
27
35
|
}
|
|
28
36
|
function readOdg(pkg) {
|
|
29
|
-
const { metadata, pages } = readOdgContent(pkg);
|
|
30
|
-
|
|
37
|
+
const { metadata, pages, source } = readOdgContent(pkg);
|
|
38
|
+
const assembled = assemblePackage({
|
|
31
39
|
kind: "drawing",
|
|
32
40
|
metadata,
|
|
33
41
|
pages
|
|
34
42
|
});
|
|
43
|
+
if (source !== void 0) assembled.source = source;
|
|
44
|
+
return assembled;
|
|
35
45
|
}
|
|
36
46
|
//#endregion
|
|
37
47
|
export { readOdg, readOdgContent };
|
package/dist/typed/odp/read.cjs
CHANGED
|
@@ -2,6 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_xml_query = require("../../xml/query.cjs");
|
|
3
3
|
const require_typed_shared_text = require("../shared/text.cjs");
|
|
4
4
|
const require_typed_shared_metadata = require("../shared/metadata.cjs");
|
|
5
|
+
const require_typed_shared_constructs = require("../shared/constructs.cjs");
|
|
5
6
|
const require_typed_shared_masterpage = require("../shared/masterpage.cjs");
|
|
6
7
|
const require_typed_draw_shapes = require("../draw/shapes.cjs");
|
|
7
8
|
let document_schema_js = require("document-schema.js");
|
|
@@ -15,13 +16,53 @@ function readSlideNotes(page) {
|
|
|
15
16
|
if (notes === void 0) return "";
|
|
16
17
|
return require_xml_query.elementsWithTag(notes.children, "text:p").map(require_typed_shared_text.decodeOdfText).join("\n");
|
|
17
18
|
}
|
|
19
|
+
const ODP_TRANSITION_ATTRIBUTES = [
|
|
20
|
+
"presentation:transition-type",
|
|
21
|
+
"presentation:transition-style",
|
|
22
|
+
"presentation:transition-speed",
|
|
23
|
+
"presentation:duration",
|
|
24
|
+
"smil:type",
|
|
25
|
+
"smil:subtype",
|
|
26
|
+
"smil:direction",
|
|
27
|
+
"smil:fadeColor"
|
|
28
|
+
];
|
|
29
|
+
function findDrawingPageProperties(pkg, styleName) {
|
|
30
|
+
if (styleName === void 0) return;
|
|
31
|
+
for (const partPath of ["content.xml", "styles.xml"]) {
|
|
32
|
+
const part = pkg.parts[partPath];
|
|
33
|
+
if (part?.kind !== "xml") continue;
|
|
34
|
+
const root = require_xml_query.rootElement(part.nodes);
|
|
35
|
+
if (root === void 0) continue;
|
|
36
|
+
for (const containerTag of ["office:automatic-styles", "office:styles"]) {
|
|
37
|
+
const container = require_xml_query.findChildElement(root.children, containerTag);
|
|
38
|
+
if (container === void 0) continue;
|
|
39
|
+
for (const style of require_xml_query.childrenWithTag(container, "style:style")) if (require_xml_query.attrValue(style, "style:family") === "drawing-page" && require_xml_query.attrValue(style, "style:name") === styleName) return require_xml_query.childrenWithTag(style, "style:drawing-page-properties")[0];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const ODP_PRESENTATION_EXTRA_TAGS = /* @__PURE__ */ new Set([
|
|
44
|
+
"presentation:sound",
|
|
45
|
+
"presentation:animations",
|
|
46
|
+
"anim:par",
|
|
47
|
+
"anim:seq"
|
|
48
|
+
]);
|
|
49
|
+
function readSlideResidue(page, pkg) {
|
|
50
|
+
const elements = [];
|
|
51
|
+
const drawingPageProperties = findDrawingPageProperties(pkg, require_xml_query.attrValue(page, "draw:style-name"));
|
|
52
|
+
if (drawingPageProperties !== void 0 && ODP_TRANSITION_ATTRIBUTES.some((name) => require_xml_query.attrValue(drawingPageProperties, name) !== void 0)) elements.push(require_typed_shared_constructs.odfAttributeElement(drawingPageProperties, ...ODP_TRANSITION_ATTRIBUTES));
|
|
53
|
+
for (const child of page.children) if (child.type === "element" && ODP_PRESENTATION_EXTRA_TAGS.has(child.tag)) elements.push(child);
|
|
54
|
+
require_typed_shared_constructs.collectOdfUnmappedShapeResidue(page.children, elements);
|
|
55
|
+
return elements.length > 0 ? require_typed_shared_constructs.odfResidue("odp", ...elements) : void 0;
|
|
56
|
+
}
|
|
18
57
|
function readSlide(page, pkg, listIdState) {
|
|
19
58
|
const shapes = [];
|
|
20
59
|
require_typed_draw_shapes.walkDrawShapes(page.children, [], pkg, shapes, { next: 0 }, listIdState);
|
|
60
|
+
const source = readSlideResidue(page, pkg);
|
|
21
61
|
return {
|
|
22
62
|
size: readSlideSize(page, pkg),
|
|
23
63
|
shapes,
|
|
24
|
-
notes: readSlideNotes(page)
|
|
64
|
+
notes: readSlideNotes(page),
|
|
65
|
+
...source !== void 0 ? { source } : {}
|
|
25
66
|
};
|
|
26
67
|
}
|
|
27
68
|
function readOdpContent(pkg) {
|
|
@@ -31,18 +72,24 @@ function readOdpContent(pkg) {
|
|
|
31
72
|
const presentation = body === void 0 ? void 0 : require_xml_query.findChildElement(body.children, "office:presentation");
|
|
32
73
|
const pages = presentation === void 0 ? [] : require_xml_query.childrenWithTag(presentation, "draw:page");
|
|
33
74
|
const listIdState = { next: 1 };
|
|
75
|
+
const slides = pages.map((page) => readSlide(page, pkg, listIdState));
|
|
76
|
+
const source = {};
|
|
77
|
+
require_typed_shared_constructs.collectOdfNonContentPartResidue(pkg, "odp", source);
|
|
34
78
|
return {
|
|
35
79
|
metadata: require_typed_shared_metadata.readOdfMetadata(pkg),
|
|
36
|
-
slides
|
|
80
|
+
slides,
|
|
81
|
+
...Object.keys(source).length > 0 ? { source } : {}
|
|
37
82
|
};
|
|
38
83
|
}
|
|
39
84
|
function readOdp(pkg) {
|
|
40
|
-
const { metadata, slides } = readOdpContent(pkg);
|
|
41
|
-
|
|
85
|
+
const { metadata, slides, source } = readOdpContent(pkg);
|
|
86
|
+
const assembled = (0, document_schema_js.assemblePackage)({
|
|
42
87
|
kind: "presentation",
|
|
43
88
|
metadata,
|
|
44
89
|
slides
|
|
45
90
|
});
|
|
91
|
+
if (source !== void 0) assembled.source = source;
|
|
92
|
+
return assembled;
|
|
46
93
|
}
|
|
47
94
|
//#endregion
|
|
48
95
|
exports.readOdp = readOdp;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as readOdp, r as readOdpContent, t as OdpDocument } from "../../read-
|
|
1
|
+
import { n as readOdp, r as readOdpContent, t as OdpDocument } from "../../read-CDSmR3qt.cjs";
|
|
2
2
|
export { OdpDocument, readOdp, readOdpContent };
|
package/dist/typed/odp/read.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as readOdp, r as readOdpContent, t as OdpDocument } from "../../read-
|
|
1
|
+
import { n as readOdp, r as readOdpContent, t as OdpDocument } from "../../read-DfEHXwgn.js";
|
|
2
2
|
export { OdpDocument, readOdp, readOdpContent };
|