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
|
@@ -28,6 +28,72 @@ function odfResidue(format, ...elements) {
|
|
|
28
28
|
xml: require_xml_build.buildXml(elements)
|
|
29
29
|
};
|
|
30
30
|
}
|
|
31
|
+
const ODF_EXTENSION_NAMESPACE_PREFIXES = /* @__PURE__ */ new Set([
|
|
32
|
+
"loext:",
|
|
33
|
+
"calcext:",
|
|
34
|
+
"officeooo:",
|
|
35
|
+
"ooo:",
|
|
36
|
+
"oooc:",
|
|
37
|
+
"ooow:",
|
|
38
|
+
"formx:",
|
|
39
|
+
"field:",
|
|
40
|
+
"drawooo:",
|
|
41
|
+
"tableooo:"
|
|
42
|
+
]);
|
|
43
|
+
function isOdfExtensionElement(element) {
|
|
44
|
+
return [...ODF_EXTENSION_NAMESPACE_PREFIXES].some((prefix) => element.tag.startsWith(prefix));
|
|
45
|
+
}
|
|
46
|
+
const ODF_UNMAPPED_SHAPE_TAGS = /* @__PURE__ */ new Set([
|
|
47
|
+
"dr3d:scene",
|
|
48
|
+
"draw:connector",
|
|
49
|
+
"draw:measure",
|
|
50
|
+
"draw:applet",
|
|
51
|
+
"draw:plugin",
|
|
52
|
+
"draw:floating-frame"
|
|
53
|
+
]);
|
|
54
|
+
function collectOdfUnmappedShapeResidue(children, out) {
|
|
55
|
+
for (const node of children) {
|
|
56
|
+
if (node.type !== "element") continue;
|
|
57
|
+
if (node.tag === "draw:g") collectOdfUnmappedShapeResidue(node.children, out);
|
|
58
|
+
else if (ODF_UNMAPPED_SHAPE_TAGS.has(node.tag) || isOdfExtensionElement(node)) out.push(node);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function odfAttributeElement(element, ...attributeNames) {
|
|
62
|
+
return {
|
|
63
|
+
...element,
|
|
64
|
+
children: [],
|
|
65
|
+
attributes: element.attributes.filter((attribute) => attributeNames.includes(attribute.name))
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function addOdfPackageResidue(out, key, format, ...elements) {
|
|
69
|
+
if (elements.length === 0) return;
|
|
70
|
+
const addition = require_xml_build.buildXml(elements);
|
|
71
|
+
const existing = out[key];
|
|
72
|
+
out[key] = existing === void 0 ? {
|
|
73
|
+
format,
|
|
74
|
+
xml: addition
|
|
75
|
+
} : {
|
|
76
|
+
format,
|
|
77
|
+
xml: `${existing.xml}${addition}`
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
const ODF_CONSUMED_PART_PATHS = /* @__PURE__ */ new Set([
|
|
81
|
+
"content.xml",
|
|
82
|
+
"styles.xml",
|
|
83
|
+
"meta.xml",
|
|
84
|
+
"META-INF/manifest.xml"
|
|
85
|
+
]);
|
|
86
|
+
function isEmbeddedObjectPart(path) {
|
|
87
|
+
const [firstSegment] = path.split("/");
|
|
88
|
+
return firstSegment !== void 0 && /^Object \d+$/.test(firstSegment);
|
|
89
|
+
}
|
|
90
|
+
function collectOdfNonContentPartResidue(pkg, format, out) {
|
|
91
|
+
for (const [path, part] of Object.entries(pkg.parts)) {
|
|
92
|
+
if (part.kind !== "xml" || ODF_CONSUMED_PART_PATHS.has(path) || isEmbeddedObjectPart(path)) continue;
|
|
93
|
+
const elements = part.nodes.filter((node) => node.type === "element");
|
|
94
|
+
if (elements.length > 0) out[path] = odfResidue(format, ...elements);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
31
97
|
function readOdfBooleanAttribute(element, name) {
|
|
32
98
|
const raw = require_xml_query.attrValue(element, name);
|
|
33
99
|
if (raw === "true") return true;
|
|
@@ -372,15 +438,22 @@ function collectOdfNamedExpressions(nodes, out) {
|
|
|
372
438
|
}
|
|
373
439
|
}
|
|
374
440
|
//#endregion
|
|
441
|
+
exports.ODF_CONSUMED_PART_PATHS = ODF_CONSUMED_PART_PATHS;
|
|
375
442
|
exports.ODF_INDEX_WRAPPER_TAGS = ODF_INDEX_WRAPPER_TAGS;
|
|
443
|
+
exports.ODF_UNMAPPED_SHAPE_TAGS = ODF_UNMAPPED_SHAPE_TAGS;
|
|
444
|
+
exports.addOdfPackageResidue = addOdfPackageResidue;
|
|
376
445
|
exports.collectOdfDataStyleDefinitions = collectOdfDataStyleDefinitions;
|
|
377
446
|
exports.collectOdfFieldMasterDefinitions = collectOdfFieldMasterDefinitions;
|
|
378
447
|
exports.collectOdfFontFaceDefinitions = collectOdfFontFaceDefinitions;
|
|
379
448
|
exports.collectOdfNamedExpressions = collectOdfNamedExpressions;
|
|
449
|
+
exports.collectOdfNonContentPartResidue = collectOdfNonContentPartResidue;
|
|
380
450
|
exports.collectOdfProvenanceRegions = collectOdfProvenanceRegions;
|
|
451
|
+
exports.collectOdfUnmappedShapeResidue = collectOdfUnmappedShapeResidue;
|
|
381
452
|
exports.insertOdfConstructMarkers = insertOdfConstructMarkers;
|
|
382
453
|
exports.isOdfBlockScopedHalf = isOdfBlockScopedHalf;
|
|
454
|
+
exports.isOdfExtensionElement = isOdfExtensionElement;
|
|
383
455
|
exports.isOdfIndexWrapper = isOdfIndexWrapper;
|
|
456
|
+
exports.odfAttributeElement = odfAttributeElement;
|
|
384
457
|
exports.odfBookmarkAnchorDescriptor = odfBookmarkAnchorDescriptor;
|
|
385
458
|
exports.odfChangedRegionId = odfChangedRegionId;
|
|
386
459
|
exports.odfDivisionDescriptor = odfDivisionDescriptor;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { ODF_INDEX_WRAPPER_TAGS, OdfConstructExtent, OdfDefinitionsSink, OdfMarkerEvent, OdfMarkerHalf, OdfMarkerKind, OdfResidueFormat, collectOdfDataStyleDefinitions, collectOdfFieldMasterDefinitions, collectOdfFontFaceDefinitions, collectOdfNamedExpressions, collectOdfProvenanceRegions, insertOdfConstructMarkers, isOdfBlockScopedHalf, isOdfIndexWrapper, odfBookmarkAnchorDescriptor, odfChangedRegionId, odfDivisionDescriptor, odfFieldDescriptor, odfIndexControlDescriptor, odfMarkerHalfEventIndex, odfResidue, pairOdfMarkerHalves, resolveOdfMarkerEvents };
|
|
1
|
+
import { A as pairOdfMarkerHalves, C as odfBookmarkAnchorDescriptor, D as odfIndexControlDescriptor, E as odfFieldDescriptor, O as odfMarkerHalfEventIndex, S as odfAttributeElement, T as odfDivisionDescriptor, _ as collectOdfUnmappedShapeResidue, a as OdfDefinitionsSink, b as isOdfExtensionElement, c as OdfMarkerKind, d as collectOdfDataStyleDefinitions, f as collectOdfFieldMasterDefinitions, g as collectOdfProvenanceRegions, h as collectOdfNonContentPartResidue, i as OdfConstructExtent, j as resolveOdfMarkerEvents, k as odfResidue, l as OdfResidueFormat, m as collectOdfNamedExpressions, n as ODF_INDEX_WRAPPER_TAGS, o as OdfMarkerEvent, p as collectOdfFontFaceDefinitions, r as ODF_UNMAPPED_SHAPE_TAGS, s as OdfMarkerHalf, t as ODF_CONSUMED_PART_PATHS, u as addOdfPackageResidue, v as insertOdfConstructMarkers, w as odfChangedRegionId, x as isOdfIndexWrapper, y as isOdfBlockScopedHalf } from "../../constructs-BSC_5kfU.cjs";
|
|
2
|
+
export { ODF_CONSUMED_PART_PATHS, ODF_INDEX_WRAPPER_TAGS, ODF_UNMAPPED_SHAPE_TAGS, OdfConstructExtent, OdfDefinitionsSink, OdfMarkerEvent, OdfMarkerHalf, OdfMarkerKind, OdfResidueFormat, addOdfPackageResidue, collectOdfDataStyleDefinitions, collectOdfFieldMasterDefinitions, collectOdfFontFaceDefinitions, collectOdfNamedExpressions, collectOdfNonContentPartResidue, collectOdfProvenanceRegions, collectOdfUnmappedShapeResidue, insertOdfConstructMarkers, isOdfBlockScopedHalf, isOdfExtensionElement, isOdfIndexWrapper, odfAttributeElement, odfBookmarkAnchorDescriptor, odfChangedRegionId, odfDivisionDescriptor, odfFieldDescriptor, odfIndexControlDescriptor, odfMarkerHalfEventIndex, odfResidue, pairOdfMarkerHalves, resolveOdfMarkerEvents };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { ODF_INDEX_WRAPPER_TAGS, OdfConstructExtent, OdfDefinitionsSink, OdfMarkerEvent, OdfMarkerHalf, OdfMarkerKind, OdfResidueFormat, collectOdfDataStyleDefinitions, collectOdfFieldMasterDefinitions, collectOdfFontFaceDefinitions, collectOdfNamedExpressions, collectOdfProvenanceRegions, insertOdfConstructMarkers, isOdfBlockScopedHalf, isOdfIndexWrapper, odfBookmarkAnchorDescriptor, odfChangedRegionId, odfDivisionDescriptor, odfFieldDescriptor, odfIndexControlDescriptor, odfMarkerHalfEventIndex, odfResidue, pairOdfMarkerHalves, resolveOdfMarkerEvents };
|
|
1
|
+
import { A as pairOdfMarkerHalves, C as odfBookmarkAnchorDescriptor, D as odfIndexControlDescriptor, E as odfFieldDescriptor, O as odfMarkerHalfEventIndex, S as odfAttributeElement, T as odfDivisionDescriptor, _ as collectOdfUnmappedShapeResidue, a as OdfDefinitionsSink, b as isOdfExtensionElement, c as OdfMarkerKind, d as collectOdfDataStyleDefinitions, f as collectOdfFieldMasterDefinitions, g as collectOdfProvenanceRegions, h as collectOdfNonContentPartResidue, i as OdfConstructExtent, j as resolveOdfMarkerEvents, k as odfResidue, l as OdfResidueFormat, m as collectOdfNamedExpressions, n as ODF_INDEX_WRAPPER_TAGS, o as OdfMarkerEvent, p as collectOdfFontFaceDefinitions, r as ODF_UNMAPPED_SHAPE_TAGS, s as OdfMarkerHalf, t as ODF_CONSUMED_PART_PATHS, u as addOdfPackageResidue, v as insertOdfConstructMarkers, w as odfChangedRegionId, x as isOdfIndexWrapper, y as isOdfBlockScopedHalf } from "../../constructs-B1yajQJB.js";
|
|
2
|
+
export { ODF_CONSUMED_PART_PATHS, ODF_INDEX_WRAPPER_TAGS, ODF_UNMAPPED_SHAPE_TAGS, OdfConstructExtent, OdfDefinitionsSink, OdfMarkerEvent, OdfMarkerHalf, OdfMarkerKind, OdfResidueFormat, addOdfPackageResidue, collectOdfDataStyleDefinitions, collectOdfFieldMasterDefinitions, collectOdfFontFaceDefinitions, collectOdfNamedExpressions, collectOdfNonContentPartResidue, collectOdfProvenanceRegions, collectOdfUnmappedShapeResidue, insertOdfConstructMarkers, isOdfBlockScopedHalf, isOdfExtensionElement, isOdfIndexWrapper, odfAttributeElement, odfBookmarkAnchorDescriptor, odfChangedRegionId, odfDivisionDescriptor, odfFieldDescriptor, odfIndexControlDescriptor, odfMarkerHalfEventIndex, odfResidue, pairOdfMarkerHalves, resolveOdfMarkerEvents };
|
|
@@ -27,6 +27,72 @@ function odfResidue(format, ...elements) {
|
|
|
27
27
|
xml: buildXml(elements)
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
+
const ODF_EXTENSION_NAMESPACE_PREFIXES = /* @__PURE__ */ new Set([
|
|
31
|
+
"loext:",
|
|
32
|
+
"calcext:",
|
|
33
|
+
"officeooo:",
|
|
34
|
+
"ooo:",
|
|
35
|
+
"oooc:",
|
|
36
|
+
"ooow:",
|
|
37
|
+
"formx:",
|
|
38
|
+
"field:",
|
|
39
|
+
"drawooo:",
|
|
40
|
+
"tableooo:"
|
|
41
|
+
]);
|
|
42
|
+
function isOdfExtensionElement(element) {
|
|
43
|
+
return [...ODF_EXTENSION_NAMESPACE_PREFIXES].some((prefix) => element.tag.startsWith(prefix));
|
|
44
|
+
}
|
|
45
|
+
const ODF_UNMAPPED_SHAPE_TAGS = /* @__PURE__ */ new Set([
|
|
46
|
+
"dr3d:scene",
|
|
47
|
+
"draw:connector",
|
|
48
|
+
"draw:measure",
|
|
49
|
+
"draw:applet",
|
|
50
|
+
"draw:plugin",
|
|
51
|
+
"draw:floating-frame"
|
|
52
|
+
]);
|
|
53
|
+
function collectOdfUnmappedShapeResidue(children, out) {
|
|
54
|
+
for (const node of children) {
|
|
55
|
+
if (node.type !== "element") continue;
|
|
56
|
+
if (node.tag === "draw:g") collectOdfUnmappedShapeResidue(node.children, out);
|
|
57
|
+
else if (ODF_UNMAPPED_SHAPE_TAGS.has(node.tag) || isOdfExtensionElement(node)) out.push(node);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function odfAttributeElement(element, ...attributeNames) {
|
|
61
|
+
return {
|
|
62
|
+
...element,
|
|
63
|
+
children: [],
|
|
64
|
+
attributes: element.attributes.filter((attribute) => attributeNames.includes(attribute.name))
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function addOdfPackageResidue(out, key, format, ...elements) {
|
|
68
|
+
if (elements.length === 0) return;
|
|
69
|
+
const addition = buildXml(elements);
|
|
70
|
+
const existing = out[key];
|
|
71
|
+
out[key] = existing === void 0 ? {
|
|
72
|
+
format,
|
|
73
|
+
xml: addition
|
|
74
|
+
} : {
|
|
75
|
+
format,
|
|
76
|
+
xml: `${existing.xml}${addition}`
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
const ODF_CONSUMED_PART_PATHS = /* @__PURE__ */ new Set([
|
|
80
|
+
"content.xml",
|
|
81
|
+
"styles.xml",
|
|
82
|
+
"meta.xml",
|
|
83
|
+
"META-INF/manifest.xml"
|
|
84
|
+
]);
|
|
85
|
+
function isEmbeddedObjectPart(path) {
|
|
86
|
+
const [firstSegment] = path.split("/");
|
|
87
|
+
return firstSegment !== void 0 && /^Object \d+$/.test(firstSegment);
|
|
88
|
+
}
|
|
89
|
+
function collectOdfNonContentPartResidue(pkg, format, out) {
|
|
90
|
+
for (const [path, part] of Object.entries(pkg.parts)) {
|
|
91
|
+
if (part.kind !== "xml" || ODF_CONSUMED_PART_PATHS.has(path) || isEmbeddedObjectPart(path)) continue;
|
|
92
|
+
const elements = part.nodes.filter((node) => node.type === "element");
|
|
93
|
+
if (elements.length > 0) out[path] = odfResidue(format, ...elements);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
30
96
|
function readOdfBooleanAttribute(element, name) {
|
|
31
97
|
const raw = attrValue(element, name);
|
|
32
98
|
if (raw === "true") return true;
|
|
@@ -371,4 +437,4 @@ function collectOdfNamedExpressions(nodes, out) {
|
|
|
371
437
|
}
|
|
372
438
|
}
|
|
373
439
|
//#endregion
|
|
374
|
-
export { ODF_INDEX_WRAPPER_TAGS, collectOdfDataStyleDefinitions, collectOdfFieldMasterDefinitions, collectOdfFontFaceDefinitions, collectOdfNamedExpressions, collectOdfProvenanceRegions, insertOdfConstructMarkers, isOdfBlockScopedHalf, isOdfIndexWrapper, odfBookmarkAnchorDescriptor, odfChangedRegionId, odfDivisionDescriptor, odfFieldDescriptor, odfIndexControlDescriptor, odfMarkerHalfEventIndex, odfResidue, pairOdfMarkerHalves, resolveOdfMarkerEvents };
|
|
440
|
+
export { ODF_CONSUMED_PART_PATHS, ODF_INDEX_WRAPPER_TAGS, ODF_UNMAPPED_SHAPE_TAGS, addOdfPackageResidue, collectOdfDataStyleDefinitions, collectOdfFieldMasterDefinitions, collectOdfFontFaceDefinitions, collectOdfNamedExpressions, collectOdfNonContentPartResidue, collectOdfProvenanceRegions, collectOdfUnmappedShapeResidue, insertOdfConstructMarkers, isOdfBlockScopedHalf, isOdfExtensionElement, isOdfIndexWrapper, odfAttributeElement, odfBookmarkAnchorDescriptor, odfChangedRegionId, odfDivisionDescriptor, odfFieldDescriptor, odfIndexControlDescriptor, odfMarkerHalfEventIndex, odfResidue, pairOdfMarkerHalves, resolveOdfMarkerEvents };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as readOdfFormDefinitions, n as OdbFormDefinition, r as readOdfFormControlConstructs, t as OdbFormControl } from "../../forms-
|
|
1
|
+
import { i as readOdfFormDefinitions, n as OdbFormDefinition, r as readOdfFormControlConstructs, t as OdbFormControl } from "../../forms-BydLKkI0.cjs";
|
|
2
2
|
export { OdbFormControl, OdbFormDefinition, readOdfFormControlConstructs, readOdfFormDefinitions };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as readOdfFormDefinitions, n as OdbFormDefinition, r as readOdfFormControlConstructs, t as OdbFormControl } from "../../forms-
|
|
1
|
+
import { i as readOdfFormDefinitions, n as OdbFormDefinition, r as readOdfFormControlConstructs, t as OdbFormControl } from "../../forms-iwRSwhOn.js";
|
|
2
2
|
export { OdbFormControl, OdbFormDefinition, readOdfFormControlConstructs, readOdfFormDefinitions };
|
|
@@ -34,6 +34,13 @@ function resolveDrawPageSize(page, pkg) {
|
|
|
34
34
|
const properties = resolvePageLayoutProperties(pkg, require_xml_query.attrValue(page, "draw:master-page-name"));
|
|
35
35
|
return properties === void 0 ? void 0 : require_typed_shared_geometry.parsePageSize(properties);
|
|
36
36
|
}
|
|
37
|
+
function readOdfMasterPageElements(pkg) {
|
|
38
|
+
const stylesPart = pkg.parts[STYLES_PART];
|
|
39
|
+
const stylesRoot = stylesPart?.kind === "xml" ? require_xml_query.rootElement(stylesPart.nodes) : void 0;
|
|
40
|
+
const masterStyles = stylesRoot === void 0 ? void 0 : require_xml_query.findChildElement(stylesRoot.children, "office:master-styles");
|
|
41
|
+
return masterStyles === void 0 ? [] : require_xml_query.childrenWithTag(masterStyles, "style:master-page");
|
|
42
|
+
}
|
|
37
43
|
//#endregion
|
|
44
|
+
exports.readOdfMasterPageElements = readOdfMasterPageElements;
|
|
38
45
|
exports.resolveDrawPageSize = resolveDrawPageSize;
|
|
39
46
|
exports.resolvePageLayoutProperties = resolvePageLayoutProperties;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as resolvePageLayoutProperties, t as
|
|
2
|
-
export { resolveDrawPageSize, resolvePageLayoutProperties };
|
|
1
|
+
import { n as resolveDrawPageSize, r as resolvePageLayoutProperties, t as readOdfMasterPageElements } from "../../masterpage-Bt6gxuoL.cjs";
|
|
2
|
+
export { readOdfMasterPageElements, resolveDrawPageSize, resolvePageLayoutProperties };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as resolvePageLayoutProperties, t as
|
|
2
|
-
export { resolveDrawPageSize, resolvePageLayoutProperties };
|
|
1
|
+
import { n as resolveDrawPageSize, r as resolvePageLayoutProperties, t as readOdfMasterPageElements } from "../../masterpage-By_F05W4.js";
|
|
2
|
+
export { readOdfMasterPageElements, resolveDrawPageSize, resolvePageLayoutProperties };
|
|
@@ -33,5 +33,11 @@ function resolveDrawPageSize(page, pkg) {
|
|
|
33
33
|
const properties = resolvePageLayoutProperties(pkg, attrValue(page, "draw:master-page-name"));
|
|
34
34
|
return properties === void 0 ? void 0 : parsePageSize(properties);
|
|
35
35
|
}
|
|
36
|
+
function readOdfMasterPageElements(pkg) {
|
|
37
|
+
const stylesPart = pkg.parts[STYLES_PART];
|
|
38
|
+
const stylesRoot = stylesPart?.kind === "xml" ? rootElement(stylesPart.nodes) : void 0;
|
|
39
|
+
const masterStyles = stylesRoot === void 0 ? void 0 : findChildElement(stylesRoot.children, "office:master-styles");
|
|
40
|
+
return masterStyles === void 0 ? [] : childrenWithTag(masterStyles, "style:master-page");
|
|
41
|
+
}
|
|
36
42
|
//#endregion
|
|
37
|
-
export { resolveDrawPageSize, resolvePageLayoutProperties };
|
|
43
|
+
export { readOdfMasterPageElements, resolveDrawPageSize, resolvePageLayoutProperties };
|
|
@@ -177,6 +177,10 @@ function collectRuns(container, baseProperties, pkg, out, walk, hyperlinkTarget
|
|
|
177
177
|
order: walk.order++,
|
|
178
178
|
descriptor: () => void 0
|
|
179
179
|
});
|
|
180
|
+
} else if (node.tag === "text:ruby" || node.tag === "text:meta" || require_typed_shared_constructs.isOdfExtensionElement(node)) {
|
|
181
|
+
if (node.tag === "text:ruby") for (const base of require_xml_query.childrenWithTag(node, "text:ruby-base")) collectRuns(base, baseProperties, pkg, out, walk, hyperlinkTarget);
|
|
182
|
+
else collectRuns(node, baseProperties, pkg, out, walk, hyperlinkTarget);
|
|
183
|
+
walk.residueElements.push(node);
|
|
180
184
|
}
|
|
181
185
|
}
|
|
182
186
|
}
|
|
@@ -201,21 +205,25 @@ function runFromText(text, properties) {
|
|
|
201
205
|
function readOdfParagraph(pElement, pkg, context = {}) {
|
|
202
206
|
const styleName = require_xml_query.attrValue(pElement, "text:style-name");
|
|
203
207
|
const paragraphProperties = require_typed_shared_cascade.resolveStyle(styleName, "paragraph", pkg).properties;
|
|
204
|
-
let source;
|
|
205
|
-
if (context.format !== void 0 && styleName !== void 0) {
|
|
206
|
-
const unknownElements = require_typed_shared_cascade.resolveStyleElementChain(styleName, "paragraph", pkg).elements.flatMap((style) => [...require_xml_query.childrenWithTag(style, "style:paragraph-properties").filter((properties) => require_styles_properties.parseParagraphProperties(properties).hasUnknown), ...require_xml_query.childrenWithTag(style, "style:text-properties").filter((properties) => require_styles_properties.parseTextProperties(properties).hasUnknown)]);
|
|
207
|
-
if (unknownElements.length > 0) source = require_typed_shared_constructs.odfResidue(context.format, ...unknownElements);
|
|
208
|
-
}
|
|
209
208
|
const runs = [];
|
|
210
209
|
const walk = {
|
|
211
210
|
extents: [],
|
|
212
211
|
halves: [],
|
|
212
|
+
residueElements: [],
|
|
213
213
|
order: 0,
|
|
214
214
|
provenanceRegions: context.provenanceRegions,
|
|
215
215
|
definitions: context.definitions,
|
|
216
216
|
listIdState: context.listIdState ?? { next: 1 }
|
|
217
217
|
};
|
|
218
218
|
collectRuns(pElement, paragraphProperties, pkg, runs, walk);
|
|
219
|
+
let source;
|
|
220
|
+
if (context.format !== void 0) {
|
|
221
|
+
const residueElements = [];
|
|
222
|
+
if (styleName !== void 0) residueElements.push(...require_typed_shared_cascade.resolveStyleElementChain(styleName, "paragraph", pkg).elements.flatMap((style) => [...require_xml_query.childrenWithTag(style, "style:paragraph-properties").filter((properties) => require_styles_properties.parseParagraphProperties(properties).hasUnknown), ...require_xml_query.childrenWithTag(style, "style:text-properties").filter((properties) => require_styles_properties.parseTextProperties(properties).hasUnknown)]));
|
|
223
|
+
if (require_xml_query.attrValue(pElement, "text:is-list-header") !== void 0) residueElements.push(require_typed_shared_constructs.odfAttributeElement(pElement, "text:is-list-header"));
|
|
224
|
+
residueElements.push(...walk.residueElements);
|
|
225
|
+
if (residueElements.length > 0) source = require_typed_shared_constructs.odfResidue(context.format, ...residueElements);
|
|
226
|
+
}
|
|
219
227
|
const { extents: pairedExtents, paired } = require_typed_shared_constructs.pairOdfMarkerHalves(walk.halves, pElement);
|
|
220
228
|
walk.extents.push(...pairedExtents);
|
|
221
229
|
for (const half of walk.halves) if (half.kind === "annotation" && half.side === "start" && !paired.has(half.element) && !require_typed_shared_constructs.isOdfBlockScopedHalf(half, pElement)) {
|
|
@@ -238,8 +246,11 @@ function readOdfParagraph(pElement, pkg, context = {}) {
|
|
|
238
246
|
spacingAfterPt: paragraphProperties.spacingAfterPt,
|
|
239
247
|
lineSpacing: paragraphProperties.lineSpacing,
|
|
240
248
|
indentLeftPt: paragraphProperties.indentLeftPt,
|
|
241
|
-
indentFirstLinePt: paragraphProperties.indentFirstLinePt
|
|
249
|
+
indentFirstLinePt: paragraphProperties.indentFirstLinePt,
|
|
250
|
+
pageBreakBefore: paragraphProperties.pageBreakBefore,
|
|
251
|
+
pageBreakAfter: paragraphProperties.pageBreakAfter
|
|
242
252
|
};
|
|
243
253
|
}
|
|
244
254
|
//#endregion
|
|
255
|
+
exports.readOdfConstructBodyBlocks = readOdfConstructBodyBlocks;
|
|
245
256
|
exports.readOdfParagraph = readOdfParagraph;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as readOdfParagraph, t as OdfParagraphContext } from "../../paragraph-
|
|
2
|
-
export { OdfParagraphContext, readOdfParagraph };
|
|
1
|
+
import { n as readOdfConstructBodyBlocks, r as readOdfParagraph, t as OdfParagraphContext } from "../../paragraph-CuEMXbDg.cjs";
|
|
2
|
+
export { OdfParagraphContext, readOdfConstructBodyBlocks, readOdfParagraph };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as readOdfParagraph, t as OdfParagraphContext } from "../../paragraph-
|
|
2
|
-
export { OdfParagraphContext, readOdfParagraph };
|
|
1
|
+
import { n as readOdfConstructBodyBlocks, r as readOdfParagraph, t as OdfParagraphContext } from "../../paragraph-BE71DZ0t.js";
|
|
2
|
+
export { OdfParagraphContext, readOdfConstructBodyBlocks, readOdfParagraph };
|
|
@@ -4,7 +4,7 @@ import { attrValue, childrenWithTag, findChildElement } from "../../xml/query.js
|
|
|
4
4
|
import { decodeOdfText, getOdfSpaceCount, isOdfFieldElement } from "./text.js";
|
|
5
5
|
import { resolveStyle, resolveStyleElementChain } from "./cascade.js";
|
|
6
6
|
import { mintOdfListNumId, readOdfListParagraphs } from "./list.js";
|
|
7
|
-
import { isOdfBlockScopedHalf, odfBookmarkAnchorDescriptor, odfFieldDescriptor, odfResidue, pairOdfMarkerHalves } from "./constructs.js";
|
|
7
|
+
import { isOdfBlockScopedHalf, isOdfExtensionElement, odfAttributeElement, odfBookmarkAnchorDescriptor, odfFieldDescriptor, odfResidue, pairOdfMarkerHalves } from "./constructs.js";
|
|
8
8
|
//#region src/typed/shared/paragraph.ts
|
|
9
9
|
function readOdfConstructBodyBlocks(body, pkg, context, listIdState) {
|
|
10
10
|
const blocks = [];
|
|
@@ -176,6 +176,10 @@ function collectRuns(container, baseProperties, pkg, out, walk, hyperlinkTarget
|
|
|
176
176
|
order: walk.order++,
|
|
177
177
|
descriptor: () => void 0
|
|
178
178
|
});
|
|
179
|
+
} else if (node.tag === "text:ruby" || node.tag === "text:meta" || isOdfExtensionElement(node)) {
|
|
180
|
+
if (node.tag === "text:ruby") for (const base of childrenWithTag(node, "text:ruby-base")) collectRuns(base, baseProperties, pkg, out, walk, hyperlinkTarget);
|
|
181
|
+
else collectRuns(node, baseProperties, pkg, out, walk, hyperlinkTarget);
|
|
182
|
+
walk.residueElements.push(node);
|
|
179
183
|
}
|
|
180
184
|
}
|
|
181
185
|
}
|
|
@@ -200,21 +204,25 @@ function runFromText(text, properties) {
|
|
|
200
204
|
function readOdfParagraph(pElement, pkg, context = {}) {
|
|
201
205
|
const styleName = attrValue(pElement, "text:style-name");
|
|
202
206
|
const paragraphProperties = resolveStyle(styleName, "paragraph", pkg).properties;
|
|
203
|
-
let source;
|
|
204
|
-
if (context.format !== void 0 && styleName !== void 0) {
|
|
205
|
-
const unknownElements = resolveStyleElementChain(styleName, "paragraph", pkg).elements.flatMap((style) => [...childrenWithTag(style, "style:paragraph-properties").filter((properties) => parseParagraphProperties(properties).hasUnknown), ...childrenWithTag(style, "style:text-properties").filter((properties) => parseTextProperties(properties).hasUnknown)]);
|
|
206
|
-
if (unknownElements.length > 0) source = odfResidue(context.format, ...unknownElements);
|
|
207
|
-
}
|
|
208
207
|
const runs = [];
|
|
209
208
|
const walk = {
|
|
210
209
|
extents: [],
|
|
211
210
|
halves: [],
|
|
211
|
+
residueElements: [],
|
|
212
212
|
order: 0,
|
|
213
213
|
provenanceRegions: context.provenanceRegions,
|
|
214
214
|
definitions: context.definitions,
|
|
215
215
|
listIdState: context.listIdState ?? { next: 1 }
|
|
216
216
|
};
|
|
217
217
|
collectRuns(pElement, paragraphProperties, pkg, runs, walk);
|
|
218
|
+
let source;
|
|
219
|
+
if (context.format !== void 0) {
|
|
220
|
+
const residueElements = [];
|
|
221
|
+
if (styleName !== void 0) residueElements.push(...resolveStyleElementChain(styleName, "paragraph", pkg).elements.flatMap((style) => [...childrenWithTag(style, "style:paragraph-properties").filter((properties) => parseParagraphProperties(properties).hasUnknown), ...childrenWithTag(style, "style:text-properties").filter((properties) => parseTextProperties(properties).hasUnknown)]));
|
|
222
|
+
if (attrValue(pElement, "text:is-list-header") !== void 0) residueElements.push(odfAttributeElement(pElement, "text:is-list-header"));
|
|
223
|
+
residueElements.push(...walk.residueElements);
|
|
224
|
+
if (residueElements.length > 0) source = odfResidue(context.format, ...residueElements);
|
|
225
|
+
}
|
|
218
226
|
const { extents: pairedExtents, paired } = pairOdfMarkerHalves(walk.halves, pElement);
|
|
219
227
|
walk.extents.push(...pairedExtents);
|
|
220
228
|
for (const half of walk.halves) if (half.kind === "annotation" && half.side === "start" && !paired.has(half.element) && !isOdfBlockScopedHalf(half, pElement)) {
|
|
@@ -237,8 +245,10 @@ function readOdfParagraph(pElement, pkg, context = {}) {
|
|
|
237
245
|
spacingAfterPt: paragraphProperties.spacingAfterPt,
|
|
238
246
|
lineSpacing: paragraphProperties.lineSpacing,
|
|
239
247
|
indentLeftPt: paragraphProperties.indentLeftPt,
|
|
240
|
-
indentFirstLinePt: paragraphProperties.indentFirstLinePt
|
|
248
|
+
indentFirstLinePt: paragraphProperties.indentFirstLinePt,
|
|
249
|
+
pageBreakBefore: paragraphProperties.pageBreakBefore,
|
|
250
|
+
pageBreakAfter: paragraphProperties.pageBreakAfter
|
|
241
251
|
};
|
|
242
252
|
}
|
|
243
253
|
//#endregion
|
|
244
|
-
export { readOdfParagraph };
|
|
254
|
+
export { readOdfConstructBodyBlocks, readOdfParagraph };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "odf.js",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
4
4
|
"description": "Type-safe, lossless round-trip conversion between OpenDocument Format packages (odt, ods, odp) and JSON, hand-written and dependency-minimal, built on Zod 4 codecs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"license": "MIT",
|
|
80
80
|
"packageManager": "pnpm@11.6.0",
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"document-schema.js": "^4.
|
|
82
|
+
"document-schema.js": "^4.9.0",
|
|
83
83
|
"fast-xml-parser": "^5.10.1",
|
|
84
84
|
"fflate": "^0.8.3",
|
|
85
85
|
"zod": "^4.4.3"
|
package/dist/read-Cs1ktkWB.d.cts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { r as Package } from "./package-L24lkba-.cjs";
|
|
2
|
-
import { ContentSection, DefinitionsTable, DocumentPackage, LayoutMetadata } from "document-schema.js";
|
|
3
|
-
//#region src/typed/odt/read.d.ts
|
|
4
|
-
interface OdtReadOptions {
|
|
5
|
-
frames?: 'lift' | 'none';
|
|
6
|
-
}
|
|
7
|
-
interface OdtDocument {
|
|
8
|
-
metadata: LayoutMetadata;
|
|
9
|
-
sections: ContentSection[];
|
|
10
|
-
definitions?: DefinitionsTable;
|
|
11
|
-
}
|
|
12
|
-
declare function readOdtContent(pkg: Package, options?: OdtReadOptions): OdtDocument;
|
|
13
|
-
declare function readOdt(pkg: Package, options?: OdtReadOptions): DocumentPackage;
|
|
14
|
-
//#endregion
|
|
15
|
-
export { readOdtContent as i, OdtReadOptions as n, readOdt as r, OdtDocument as t };
|
package/dist/read-DHuiGh_y.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { r as Package } from "./package-BUojjTXf.js";
|
|
2
|
-
import { ContentSection, DefinitionsTable, DocumentPackage, LayoutMetadata } from "document-schema.js";
|
|
3
|
-
//#region src/typed/odt/read.d.ts
|
|
4
|
-
interface OdtReadOptions {
|
|
5
|
-
frames?: 'lift' | 'none';
|
|
6
|
-
}
|
|
7
|
-
interface OdtDocument {
|
|
8
|
-
metadata: LayoutMetadata;
|
|
9
|
-
sections: ContentSection[];
|
|
10
|
-
definitions?: DefinitionsTable;
|
|
11
|
-
}
|
|
12
|
-
declare function readOdtContent(pkg: Package, options?: OdtReadOptions): OdtDocument;
|
|
13
|
-
declare function readOdt(pkg: Package, options?: OdtReadOptions): DocumentPackage;
|
|
14
|
-
//#endregion
|
|
15
|
-
export { readOdtContent as i, OdtReadOptions as n, readOdt as r, OdtDocument as t };
|