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
package/dist/ooo1/transform.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { bytesToBase64 } from "../util/base64.js";
|
|
2
2
|
import { ODF_NAMESPACES } from "../ns.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { readMimetype } from "../mimetype.js";
|
|
4
|
+
import { attrValue, findChildElement, rootElement } from "../xml/query.js";
|
|
5
|
+
import { resolveOdfListKind } from "../typed/shared/list.js";
|
|
6
|
+
import { OOO1_NAMESPACES, isOoo1NamespacePrefix, isOoo1Package, odfMediaTypeForOoo1MediaType, ooo1MediaTypeForOdfMediaType } from "./ns.js";
|
|
7
|
+
import { mergeStyleProperties, propertyTypesForContainer, splitStyleProperties } from "./properties.js";
|
|
6
8
|
//#region src/ooo1/transform.ts
|
|
7
9
|
const CANONICAL_PREFIX_BY_URI = new Map([...Object.entries(OOO1_NAMESPACES).map(([prefix, uri]) => [uri, prefix]), ...Object.entries(ODF_NAMESPACES).map(([prefix, uri]) => [uri, prefix])]);
|
|
8
10
|
function isOdfNamespacePrefix(prefix) {
|
|
@@ -150,7 +152,10 @@ const INCH_TOKEN = /(^|\s)(-?(?:\d+(?:\.\d+)?|\.\d+))inch(?=\s|$)/g;
|
|
|
150
152
|
function carriesNoLength(attributeName) {
|
|
151
153
|
return attributeName.endsWith("name") || attributeName === "xlink:href";
|
|
152
154
|
}
|
|
155
|
+
const OOO1_GRAPHIC_STYLE_FAMILY = "graphics";
|
|
156
|
+
const ODF_GRAPHIC_STYLE_FAMILY = "graphic";
|
|
153
157
|
function normaliseAttributeValue(name, value) {
|
|
158
|
+
if (name === "style:family") return value === OOO1_GRAPHIC_STYLE_FAMILY ? ODF_GRAPHIC_STYLE_FAMILY : value;
|
|
154
159
|
if (carriesNoLength(name)) return value;
|
|
155
160
|
return value.replace(INCH_TOKEN, "$1$2in");
|
|
156
161
|
}
|
|
@@ -397,5 +402,289 @@ function transformOoo1Package(pkg) {
|
|
|
397
402
|
};
|
|
398
403
|
return { parts };
|
|
399
404
|
}
|
|
405
|
+
const CLASS_BY_GENRE_ELEMENT = /* @__PURE__ */ new Map([
|
|
406
|
+
["office:text", "text"],
|
|
407
|
+
["office:spreadsheet", "spreadsheet"],
|
|
408
|
+
["office:presentation", "presentation"],
|
|
409
|
+
["office:drawing", "drawing"],
|
|
410
|
+
["office:chart", "chart"]
|
|
411
|
+
]);
|
|
412
|
+
const REVERSE_RENAMED_ELEMENTS = /* @__PURE__ */ new Map([
|
|
413
|
+
["office:font-face-decls", "office:font-decls"],
|
|
414
|
+
["office:scripts", "office:script"],
|
|
415
|
+
["office:script", "office:script-data"],
|
|
416
|
+
["office:event-listeners", "office:events"],
|
|
417
|
+
["style:page-layout", "style:page-master"],
|
|
418
|
+
["text:tab", "text:tab-stop"],
|
|
419
|
+
["text:database-row-select", "text:database-select"],
|
|
420
|
+
["text:index-entry-chapter", "text:index-entry-chapter-number"],
|
|
421
|
+
["table:dependencies", "table:dependences"],
|
|
422
|
+
["table:dependency", "table:dependence"]
|
|
423
|
+
]);
|
|
424
|
+
function reverseNoteTag(tag, noteClass) {
|
|
425
|
+
const isEndnote = noteClass === "endnote";
|
|
426
|
+
if (tag === "text:note") return isEndnote ? "text:endnote" : "text:footnote";
|
|
427
|
+
if (tag === "text:note-ref") return isEndnote ? "text:endnote-ref" : "text:footnote-ref";
|
|
428
|
+
if (tag === "text:notes-configuration") return isEndnote ? "text:endnotes-configuration" : "text:footnotes-configuration";
|
|
429
|
+
}
|
|
430
|
+
function reverseNoteBodyOrCitation(tag, noteClass) {
|
|
431
|
+
const isEndnote = noteClass === "endnote";
|
|
432
|
+
if (tag === "text:note-body") return isEndnote ? "text:endnote-body" : "text:footnote-body";
|
|
433
|
+
if (tag === "text:note-citation") return isEndnote ? "text:endnote-citation" : "text:footnote-citation";
|
|
434
|
+
}
|
|
435
|
+
const PT_IN_TOKEN = /(^|\s)(-?(?:\d+(?:\.\d+)?|\.\d+))in(?=\s|$)/g;
|
|
436
|
+
function reverseAttributeValue(name, value) {
|
|
437
|
+
if (name === "style:family") return value === ODF_GRAPHIC_STYLE_FAMILY ? OOO1_GRAPHIC_STYLE_FAMILY : value;
|
|
438
|
+
if (name === "fo:keep-with-next") {
|
|
439
|
+
if (value === "always") return "true";
|
|
440
|
+
if (value === "auto") return "false";
|
|
441
|
+
return value;
|
|
442
|
+
}
|
|
443
|
+
if (carriesNoLength(name)) return value;
|
|
444
|
+
return value.replace(PT_IN_TOKEN, "$1$2inch");
|
|
445
|
+
}
|
|
446
|
+
function reverseRewriteHref(tag, name, value) {
|
|
447
|
+
if (name === "xlink:href" && PACKAGE_HREF_ELEMENTS.has(tag) && !value.startsWith("#") && !value.includes("://")) return `#${value}`;
|
|
448
|
+
return value;
|
|
449
|
+
}
|
|
450
|
+
function reverseRenamedAttributeName(tag, name) {
|
|
451
|
+
switch (name) {
|
|
452
|
+
case "style:page-layout-name": return "style:page-master-name";
|
|
453
|
+
case "style:leader-text": return "style:leader-char";
|
|
454
|
+
case "text:count-in-text-boxes": return "text:count-in-floating-frames";
|
|
455
|
+
case "form:control-implementation": return "form:service-name";
|
|
456
|
+
case "form:text-style-name": return "form:column-style-name";
|
|
457
|
+
case "office:value-type": return tag === "form:property" ? "form:property-type" : void 0;
|
|
458
|
+
default: return;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
function reverseAttributeNameFor(tag, name) {
|
|
462
|
+
if (tag === "text:h" && name === "text:outline-level") return "text:level";
|
|
463
|
+
if (CELL_ELEMENTS.has(tag)) {
|
|
464
|
+
if (name === "table:content-validation-name") return "table:validation-name";
|
|
465
|
+
for (const local of VALUE_ATTRIBUTE_LOCAL_NAMES) if (name === `office:${local}`) return `table:${local}`;
|
|
466
|
+
}
|
|
467
|
+
if (TEXT_VALUE_ELEMENTS.has(tag)) {
|
|
468
|
+
for (const local of VALUE_ATTRIBUTE_LOCAL_NAMES) if (name === `office:${local}`) return `text:${local}`;
|
|
469
|
+
}
|
|
470
|
+
if (tag === "style:column") {
|
|
471
|
+
if (name === "fo:start-indent") return "fo:margin-left";
|
|
472
|
+
if (name === "fo:end-indent") return "fo:margin-right";
|
|
473
|
+
}
|
|
474
|
+
return reverseRenamedAttributeName(tag, name) ?? name;
|
|
475
|
+
}
|
|
476
|
+
function transformNamespaceDeclarationToOoo1(attribute) {
|
|
477
|
+
const canonical = CANONICAL_PREFIX_BY_URI.get(attribute.value);
|
|
478
|
+
if (canonical === void 0 || !isOoo1NamespacePrefix(canonical)) return attribute;
|
|
479
|
+
return {
|
|
480
|
+
name: attribute.name === "xmlns" ? "xmlns" : `xmlns:${canonical}`,
|
|
481
|
+
value: OOO1_NAMESPACES[canonical]
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
function reverseTransformAttributes(element, tag, prefixes) {
|
|
485
|
+
const out = [];
|
|
486
|
+
for (const attribute of element.attributes) {
|
|
487
|
+
if (attribute.name === "xmlns" || attribute.name.startsWith("xmlns:")) {
|
|
488
|
+
out.push(transformNamespaceDeclarationToOoo1(attribute));
|
|
489
|
+
continue;
|
|
490
|
+
}
|
|
491
|
+
const name = renameQName(attribute.name, prefixes);
|
|
492
|
+
const value = reverseRewriteHref(tag, name, reverseAttributeValue(name, attribute.value));
|
|
493
|
+
out.push({
|
|
494
|
+
name: reverseAttributeNameFor(tag, name),
|
|
495
|
+
value
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
return out;
|
|
499
|
+
}
|
|
500
|
+
function unwrapFrame(frameAttributes, frameChildren) {
|
|
501
|
+
let shape;
|
|
502
|
+
const otherChildren = [];
|
|
503
|
+
for (const child of frameChildren) {
|
|
504
|
+
if (shape === void 0 && child.type === "element" && FRAME_SHAPES.has(child.tag)) {
|
|
505
|
+
shape = child;
|
|
506
|
+
continue;
|
|
507
|
+
}
|
|
508
|
+
otherChildren.push(child);
|
|
509
|
+
}
|
|
510
|
+
if (shape === void 0) return;
|
|
511
|
+
return element(shape.tag, [...shape.attributes, ...frameAttributes], [...shape.children, ...otherChildren]);
|
|
512
|
+
}
|
|
513
|
+
function elementRawText(el) {
|
|
514
|
+
let text = "";
|
|
515
|
+
for (const child of el.children) if (child.type === "text") text += child.value;
|
|
516
|
+
return text;
|
|
517
|
+
}
|
|
518
|
+
function reverseMovedChildren(tag, children) {
|
|
519
|
+
const moved = MOVED_TO_CHILD_ELEMENT.get(tag);
|
|
520
|
+
if (moved === void 0) return;
|
|
521
|
+
const childTagToAttribute = new Map([...moved.entries()].map(([attributeName, childTag]) => [childTag, attributeName]));
|
|
522
|
+
const attributes = [];
|
|
523
|
+
const rest = [];
|
|
524
|
+
for (const child of children) {
|
|
525
|
+
const attributeName = child.type === "element" ? childTagToAttribute.get(child.tag) : void 0;
|
|
526
|
+
if (attributeName !== void 0 && child.type === "element") {
|
|
527
|
+
attributes.push({
|
|
528
|
+
name: attributeName,
|
|
529
|
+
value: elementRawText(child)
|
|
530
|
+
});
|
|
531
|
+
continue;
|
|
532
|
+
}
|
|
533
|
+
rest.push(child);
|
|
534
|
+
}
|
|
535
|
+
return {
|
|
536
|
+
attributes,
|
|
537
|
+
rest
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
function wrapMetaKeywords(nodes) {
|
|
541
|
+
const keywords = nodes.filter((node) => node.type === "element" && node.tag === "meta:keyword");
|
|
542
|
+
if (keywords.length === 0) return [...nodes];
|
|
543
|
+
const out = [];
|
|
544
|
+
let inserted = false;
|
|
545
|
+
for (const node of nodes) {
|
|
546
|
+
if (node.type === "element" && node.tag === "meta:keyword") {
|
|
547
|
+
if (!inserted) {
|
|
548
|
+
out.push({
|
|
549
|
+
type: "element",
|
|
550
|
+
tag: "meta:keywords",
|
|
551
|
+
attributes: [],
|
|
552
|
+
children: keywords
|
|
553
|
+
});
|
|
554
|
+
inserted = true;
|
|
555
|
+
}
|
|
556
|
+
continue;
|
|
557
|
+
}
|
|
558
|
+
out.push(node);
|
|
559
|
+
}
|
|
560
|
+
return out;
|
|
561
|
+
}
|
|
562
|
+
function finaliseReversedChildren(nodes) {
|
|
563
|
+
const { merged, rest } = mergeStyleProperties(nodes);
|
|
564
|
+
return wrapMetaKeywords(merged === void 0 ? rest : [merged, ...rest]);
|
|
565
|
+
}
|
|
566
|
+
function reverseTransformNodes(nodes, context) {
|
|
567
|
+
const out = [];
|
|
568
|
+
for (const node of nodes) {
|
|
569
|
+
if (node.type !== "element") {
|
|
570
|
+
out.push(node);
|
|
571
|
+
continue;
|
|
572
|
+
}
|
|
573
|
+
out.push(...reverseTransformElement(node, context));
|
|
574
|
+
}
|
|
575
|
+
return out;
|
|
576
|
+
}
|
|
577
|
+
function reverseListKind(source, context) {
|
|
578
|
+
return resolveOdfListKind(context.pkg, attrValue(source, "text:style-name")) ?? context.listKind;
|
|
579
|
+
}
|
|
580
|
+
function reverseTransformElement(source, context) {
|
|
581
|
+
const renamedTag = renameQName(source.tag, context.prefixes);
|
|
582
|
+
const attributes = reverseTransformAttributes(source, renamedTag, context.prefixes);
|
|
583
|
+
const genreChild = renamedTag === "office:body" ? source.children.find((child) => child.type === "element") : void 0;
|
|
584
|
+
const recurseInto = genreChild !== void 0 && CLASS_BY_GENRE_ELEMENT.has(genreChild.tag) ? genreChild.children : source.children;
|
|
585
|
+
let childContext = context;
|
|
586
|
+
if (renamedTag === "text:note") childContext = {
|
|
587
|
+
...context,
|
|
588
|
+
noteClass: attrValue(source, "text:note-class") === "endnote" ? "endnote" : "footnote"
|
|
589
|
+
};
|
|
590
|
+
else if (renamedTag === "text:list") childContext = {
|
|
591
|
+
...context,
|
|
592
|
+
listKind: reverseListKind(source, context)
|
|
593
|
+
};
|
|
594
|
+
const children = finaliseReversedChildren(reverseTransformNodes(recurseInto, childContext));
|
|
595
|
+
if (renamedTag === "office:body") return [element("office:body", attributes, children)];
|
|
596
|
+
if (renamedTag === "draw:frame") return [unwrapFrame(attributes, children) ?? element(renamedTag, attributes, children)];
|
|
597
|
+
if (renamedTag === "text:note" || renamedTag === "text:note-ref" || renamedTag === "text:notes-configuration") {
|
|
598
|
+
const noteClassRaw = attrValue(source, "text:note-class");
|
|
599
|
+
const withoutClass = attributes.filter((attribute) => attribute.name !== "text:note-class");
|
|
600
|
+
return [element(reverseNoteTag(renamedTag, noteClassRaw) ?? renamedTag, withoutClass, children)];
|
|
601
|
+
}
|
|
602
|
+
if (renamedTag === "text:note-body" || renamedTag === "text:note-citation") return [element(reverseNoteBodyOrCitation(renamedTag, context.noteClass) ?? renamedTag, attributes, children)];
|
|
603
|
+
if (renamedTag === "table:table" && attrValue(source, "table:is-sub-table") === "true") return [element("table:sub-table", attributes.filter((attribute) => attribute.name !== "table:is-sub-table"), children)];
|
|
604
|
+
if (renamedTag === "style:font-face") return [element("style:font-decl", attributes.map((attribute) => {
|
|
605
|
+
if (attribute.name === "svg:font-family") return {
|
|
606
|
+
name: "fo:font-family",
|
|
607
|
+
value: attribute.value
|
|
608
|
+
};
|
|
609
|
+
if (attribute.name === "style:font-adornments") return {
|
|
610
|
+
name: "style:font-style-name",
|
|
611
|
+
value: attribute.value
|
|
612
|
+
};
|
|
613
|
+
return attribute;
|
|
614
|
+
}), children)];
|
|
615
|
+
const movedBack = reverseMovedChildren(renamedTag, children);
|
|
616
|
+
if (movedBack !== void 0) return [element(renamedTag, [...attributes, ...movedBack.attributes], movedBack.rest)];
|
|
617
|
+
if (renamedTag === "text:list") {
|
|
618
|
+
const kind = reverseListKind(source, context);
|
|
619
|
+
return [element(kind === "ordered" ? "text:ordered-list" : kind === "bullet" ? "text:unordered-list" : renamedTag, attributes, children)];
|
|
620
|
+
}
|
|
621
|
+
const tag = REVERSE_RENAMED_ELEMENTS.get(renamedTag) ?? renamedTag;
|
|
622
|
+
return [element(tag, DOCUMENT_ROOT_ELEMENTS.has(tag) && context.documentClass !== void 0 ? [...attributes, {
|
|
623
|
+
name: "office:class",
|
|
624
|
+
value: context.documentClass
|
|
625
|
+
}] : attributes, children)];
|
|
626
|
+
}
|
|
627
|
+
const CONTENT_XML_PATH = "content.xml";
|
|
628
|
+
function documentClassOf(pkg) {
|
|
629
|
+
const content = pkg.parts[CONTENT_XML_PATH];
|
|
630
|
+
if (content?.kind !== "xml") return;
|
|
631
|
+
const root = rootElement(content.nodes);
|
|
632
|
+
const genre = (root === void 0 ? void 0 : findChildElement(root.children, "office:body"))?.children.find((child) => child.type === "element");
|
|
633
|
+
return genre === void 0 ? void 0 : CLASS_BY_GENRE_ELEMENT.get(genre.tag);
|
|
634
|
+
}
|
|
635
|
+
function reverseTransformXmlPart(nodes, context) {
|
|
636
|
+
const root = rootElement(nodes);
|
|
637
|
+
if (root === void 0) return [...nodes];
|
|
638
|
+
return reverseTransformNodes(nodes, {
|
|
639
|
+
prefixes: prefixRenames(root),
|
|
640
|
+
...context
|
|
641
|
+
});
|
|
642
|
+
}
|
|
643
|
+
function rewriteManifestToOoo1(nodes, ooo1MediaType) {
|
|
644
|
+
return nodes.map((node) => {
|
|
645
|
+
if (node.type !== "element") return node;
|
|
646
|
+
return {
|
|
647
|
+
...node,
|
|
648
|
+
children: node.children.map((entry) => {
|
|
649
|
+
if (entry.type !== "element" || entry.tag !== "manifest:file-entry") return entry;
|
|
650
|
+
if (entry.attributes.find((attribute) => attribute.name === "manifest:full-path")?.value !== "/") return entry;
|
|
651
|
+
return {
|
|
652
|
+
...entry,
|
|
653
|
+
attributes: entry.attributes.map((attribute) => attribute.name === "manifest:media-type" ? {
|
|
654
|
+
name: attribute.name,
|
|
655
|
+
value: ooo1MediaType
|
|
656
|
+
} : attribute)
|
|
657
|
+
};
|
|
658
|
+
})
|
|
659
|
+
};
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
function transformToOoo1Package(pkg) {
|
|
663
|
+
const odfMediaType = readMimetype(pkg);
|
|
664
|
+
if (odfMediaType === void 0) return pkg;
|
|
665
|
+
const ooo1MediaType = ooo1MediaTypeForOdfMediaType(odfMediaType);
|
|
666
|
+
if (ooo1MediaType === void 0) return pkg;
|
|
667
|
+
const documentClass = documentClassOf(pkg);
|
|
668
|
+
const parts = {};
|
|
669
|
+
for (const [path, part] of Object.entries(pkg.parts)) {
|
|
670
|
+
if (path === MIMETYPE_PATH) continue;
|
|
671
|
+
if (part.kind !== "xml") {
|
|
672
|
+
parts[path] = part;
|
|
673
|
+
continue;
|
|
674
|
+
}
|
|
675
|
+
const nodes = reverseTransformXmlPart(part.nodes, {
|
|
676
|
+
pkg,
|
|
677
|
+
documentClass
|
|
678
|
+
});
|
|
679
|
+
parts[path] = path === MANIFEST_PATH ? {
|
|
680
|
+
kind: "xml",
|
|
681
|
+
nodes: rewriteManifestToOoo1(nodes, ooo1MediaType)
|
|
682
|
+
} : {
|
|
683
|
+
kind: "xml",
|
|
684
|
+
nodes
|
|
685
|
+
};
|
|
686
|
+
}
|
|
687
|
+
return { parts };
|
|
688
|
+
}
|
|
400
689
|
//#endregion
|
|
401
|
-
export { transformOoo1Package };
|
|
690
|
+
export { transformOoo1Package, transformToOoo1Package };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_typed_odp_write = require("../typed/odp/write.cjs");
|
|
3
|
+
const require_typed_odt_write = require("../typed/odt/write.cjs");
|
|
4
|
+
const require_typed_odg_write = require("../typed/odg/write.cjs");
|
|
5
|
+
const require_typed_ods_write = require("../typed/ods/write.cjs");
|
|
6
|
+
const require_ooo1_transform = require("./transform.cjs");
|
|
7
|
+
//#region src/ooo1/write.ts
|
|
8
|
+
function writeSxw(document, options = {}) {
|
|
9
|
+
return require_ooo1_transform.transformToOoo1Package(require_typed_odt_write.writeOdt(document, options));
|
|
10
|
+
}
|
|
11
|
+
function writeSxwContent(document, options = {}) {
|
|
12
|
+
return require_ooo1_transform.transformToOoo1Package(require_typed_odt_write.writeOdtContent(document, options));
|
|
13
|
+
}
|
|
14
|
+
function writeSxc(document, options = {}) {
|
|
15
|
+
return require_ooo1_transform.transformToOoo1Package(require_typed_ods_write.writeOds(document, options));
|
|
16
|
+
}
|
|
17
|
+
function writeSxcContent(document, options = {}) {
|
|
18
|
+
return require_ooo1_transform.transformToOoo1Package(require_typed_ods_write.writeOdsContent(document, options));
|
|
19
|
+
}
|
|
20
|
+
function writeSxi(document, options = {}) {
|
|
21
|
+
return require_ooo1_transform.transformToOoo1Package(require_typed_odp_write.writeOdp(document, options));
|
|
22
|
+
}
|
|
23
|
+
function writeSxiContent(document, options = {}) {
|
|
24
|
+
return require_ooo1_transform.transformToOoo1Package(require_typed_odp_write.writeOdpContent(document, options));
|
|
25
|
+
}
|
|
26
|
+
function writeSxd(document, options = {}) {
|
|
27
|
+
return require_ooo1_transform.transformToOoo1Package(require_typed_odg_write.writeOdg(document, options));
|
|
28
|
+
}
|
|
29
|
+
function writeSxdContent(document, options = {}) {
|
|
30
|
+
return require_ooo1_transform.transformToOoo1Package(require_typed_odg_write.writeOdgContent(document, options));
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
exports.writeSxc = writeSxc;
|
|
34
|
+
exports.writeSxcContent = writeSxcContent;
|
|
35
|
+
exports.writeSxd = writeSxd;
|
|
36
|
+
exports.writeSxdContent = writeSxdContent;
|
|
37
|
+
exports.writeSxi = writeSxi;
|
|
38
|
+
exports.writeSxiContent = writeSxiContent;
|
|
39
|
+
exports.writeSxw = writeSxw;
|
|
40
|
+
exports.writeSxwContent = writeSxwContent;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as writeSxi, c as writeSxwContent, i as writeSxdContent, n as writeSxcContent, o as writeSxiContent, r as writeSxd, s as writeSxw, t as writeSxc } from "../write-BZXpT8F6.cjs";
|
|
2
|
+
export { writeSxc, writeSxcContent, writeSxd, writeSxdContent, writeSxi, writeSxiContent, writeSxw, writeSxwContent };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as writeSxi, c as writeSxwContent, i as writeSxdContent, n as writeSxcContent, o as writeSxiContent, r as writeSxd, s as writeSxw, t as writeSxc } from "../write-SKnCTU4C.js";
|
|
2
|
+
export { writeSxc, writeSxcContent, writeSxd, writeSxdContent, writeSxi, writeSxiContent, writeSxw, writeSxwContent };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { writeOdp, writeOdpContent } from "../typed/odp/write.js";
|
|
2
|
+
import { writeOdt, writeOdtContent } from "../typed/odt/write.js";
|
|
3
|
+
import { writeOdg, writeOdgContent } from "../typed/odg/write.js";
|
|
4
|
+
import { writeOds, writeOdsContent } from "../typed/ods/write.js";
|
|
5
|
+
import { transformToOoo1Package } from "./transform.js";
|
|
6
|
+
//#region src/ooo1/write.ts
|
|
7
|
+
function writeSxw(document, options = {}) {
|
|
8
|
+
return transformToOoo1Package(writeOdt(document, options));
|
|
9
|
+
}
|
|
10
|
+
function writeSxwContent(document, options = {}) {
|
|
11
|
+
return transformToOoo1Package(writeOdtContent(document, options));
|
|
12
|
+
}
|
|
13
|
+
function writeSxc(document, options = {}) {
|
|
14
|
+
return transformToOoo1Package(writeOds(document, options));
|
|
15
|
+
}
|
|
16
|
+
function writeSxcContent(document, options = {}) {
|
|
17
|
+
return transformToOoo1Package(writeOdsContent(document, options));
|
|
18
|
+
}
|
|
19
|
+
function writeSxi(document, options = {}) {
|
|
20
|
+
return transformToOoo1Package(writeOdp(document, options));
|
|
21
|
+
}
|
|
22
|
+
function writeSxiContent(document, options = {}) {
|
|
23
|
+
return transformToOoo1Package(writeOdpContent(document, options));
|
|
24
|
+
}
|
|
25
|
+
function writeSxd(document, options = {}) {
|
|
26
|
+
return transformToOoo1Package(writeOdg(document, options));
|
|
27
|
+
}
|
|
28
|
+
function writeSxdContent(document, options = {}) {
|
|
29
|
+
return transformToOoo1Package(writeOdgContent(document, options));
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { writeSxc, writeSxcContent, writeSxd, writeSxdContent, writeSxi, writeSxiContent, writeSxw, writeSxwContent };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_ns = require("../ns.cjs");
|
|
3
|
+
const require_mimetype = require("../mimetype.cjs");
|
|
4
|
+
const require_xml_fragment = require("../xml/fragment.cjs");
|
|
5
|
+
const require_xml_entities = require("../xml/entities.cjs");
|
|
6
|
+
//#region src/package-io/scaffold.ts
|
|
7
|
+
const ODF_DOCUMENT_PREFIXES = [
|
|
8
|
+
"office",
|
|
9
|
+
"style",
|
|
10
|
+
"text",
|
|
11
|
+
"table",
|
|
12
|
+
"draw",
|
|
13
|
+
"fo",
|
|
14
|
+
"xlink",
|
|
15
|
+
"dc",
|
|
16
|
+
"meta",
|
|
17
|
+
"number",
|
|
18
|
+
"svg",
|
|
19
|
+
"presentation"
|
|
20
|
+
];
|
|
21
|
+
const DEFAULT_ODF_VERSION = "1.3";
|
|
22
|
+
function documentPartNodes(rootTag, version, containers) {
|
|
23
|
+
return [{
|
|
24
|
+
type: "declaration",
|
|
25
|
+
attributes: [{
|
|
26
|
+
name: "version",
|
|
27
|
+
value: "1.0"
|
|
28
|
+
}, {
|
|
29
|
+
name: "encoding",
|
|
30
|
+
value: "UTF-8"
|
|
31
|
+
}]
|
|
32
|
+
}, require_xml_fragment.el(rootTag, {
|
|
33
|
+
...require_ns.xmlnsAttributes(ODF_DOCUMENT_PREFIXES),
|
|
34
|
+
"office:version": require_xml_entities.encodeXmlText(version)
|
|
35
|
+
}, [...containers])];
|
|
36
|
+
}
|
|
37
|
+
function createOdfPackage(mediaType, bodyElement, version = "1.3") {
|
|
38
|
+
const pkg = { parts: {
|
|
39
|
+
"content.xml": {
|
|
40
|
+
kind: "xml",
|
|
41
|
+
nodes: documentPartNodes("office:document-content", version, [require_xml_fragment.el("office:automatic-styles"), require_xml_fragment.el("office:body", {}, [bodyElement])])
|
|
42
|
+
},
|
|
43
|
+
"styles.xml": {
|
|
44
|
+
kind: "xml",
|
|
45
|
+
nodes: documentPartNodes("office:document-styles", version, [
|
|
46
|
+
require_xml_fragment.el("office:styles"),
|
|
47
|
+
require_xml_fragment.el("office:automatic-styles"),
|
|
48
|
+
require_xml_fragment.el("office:master-styles")
|
|
49
|
+
])
|
|
50
|
+
}
|
|
51
|
+
} };
|
|
52
|
+
require_mimetype.writeMimetype(pkg, mediaType);
|
|
53
|
+
return pkg;
|
|
54
|
+
}
|
|
55
|
+
function odfPartContainer(pkg, partPath, containerTag) {
|
|
56
|
+
const part = pkg.parts[partPath];
|
|
57
|
+
if (part?.kind !== "xml") throw new Error(`odfPartContainer: "${partPath}" is not an XML part`);
|
|
58
|
+
const container = part.nodes.find((node) => node.type === "element")?.children.find((node) => node.type === "element" && node.tag === containerTag);
|
|
59
|
+
if (container === void 0) throw new Error(`odfPartContainer: "${partPath}" has no ${containerTag} container`);
|
|
60
|
+
return container;
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
exports.DEFAULT_ODF_VERSION = DEFAULT_ODF_VERSION;
|
|
64
|
+
exports.createOdfPackage = createOdfPackage;
|
|
65
|
+
exports.odfPartContainer = odfPartContainer;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { xmlnsAttributes } from "../ns.js";
|
|
2
|
+
import { writeMimetype } from "../mimetype.js";
|
|
3
|
+
import { el } from "../xml/fragment.js";
|
|
4
|
+
import { encodeXmlText } from "../xml/entities.js";
|
|
5
|
+
//#region src/package-io/scaffold.ts
|
|
6
|
+
const ODF_DOCUMENT_PREFIXES = [
|
|
7
|
+
"office",
|
|
8
|
+
"style",
|
|
9
|
+
"text",
|
|
10
|
+
"table",
|
|
11
|
+
"draw",
|
|
12
|
+
"fo",
|
|
13
|
+
"xlink",
|
|
14
|
+
"dc",
|
|
15
|
+
"meta",
|
|
16
|
+
"number",
|
|
17
|
+
"svg",
|
|
18
|
+
"presentation"
|
|
19
|
+
];
|
|
20
|
+
const DEFAULT_ODF_VERSION = "1.3";
|
|
21
|
+
function documentPartNodes(rootTag, version, containers) {
|
|
22
|
+
return [{
|
|
23
|
+
type: "declaration",
|
|
24
|
+
attributes: [{
|
|
25
|
+
name: "version",
|
|
26
|
+
value: "1.0"
|
|
27
|
+
}, {
|
|
28
|
+
name: "encoding",
|
|
29
|
+
value: "UTF-8"
|
|
30
|
+
}]
|
|
31
|
+
}, el(rootTag, {
|
|
32
|
+
...xmlnsAttributes(ODF_DOCUMENT_PREFIXES),
|
|
33
|
+
"office:version": encodeXmlText(version)
|
|
34
|
+
}, [...containers])];
|
|
35
|
+
}
|
|
36
|
+
function createOdfPackage(mediaType, bodyElement, version = "1.3") {
|
|
37
|
+
const pkg = { parts: {
|
|
38
|
+
"content.xml": {
|
|
39
|
+
kind: "xml",
|
|
40
|
+
nodes: documentPartNodes("office:document-content", version, [el("office:automatic-styles"), el("office:body", {}, [bodyElement])])
|
|
41
|
+
},
|
|
42
|
+
"styles.xml": {
|
|
43
|
+
kind: "xml",
|
|
44
|
+
nodes: documentPartNodes("office:document-styles", version, [
|
|
45
|
+
el("office:styles"),
|
|
46
|
+
el("office:automatic-styles"),
|
|
47
|
+
el("office:master-styles")
|
|
48
|
+
])
|
|
49
|
+
}
|
|
50
|
+
} };
|
|
51
|
+
writeMimetype(pkg, mediaType);
|
|
52
|
+
return pkg;
|
|
53
|
+
}
|
|
54
|
+
function odfPartContainer(pkg, partPath, containerTag) {
|
|
55
|
+
const part = pkg.parts[partPath];
|
|
56
|
+
if (part?.kind !== "xml") throw new Error(`odfPartContainer: "${partPath}" is not an XML part`);
|
|
57
|
+
const container = part.nodes.find((node) => node.type === "element")?.children.find((node) => node.type === "element" && node.tag === containerTag);
|
|
58
|
+
if (container === void 0) throw new Error(`odfPartContainer: "${partPath}" has no ${containerTag} container`);
|
|
59
|
+
return container;
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
export { DEFAULT_ODF_VERSION, createOdfPackage, odfPartContainer };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { d as XmlNode, l as XmlElement } from "./node-B6JX5CRX.cjs";
|
|
2
|
+
import { r as Package } from "./package-DMk9fuTI.cjs";
|
|
3
|
+
import { n as StyleProperties } from "./properties-CiIoNu2h.cjs";
|
|
4
|
+
import { a as StyleRegistry } from "./registry-PoQIRgbY.cjs";
|
|
5
|
+
import { i as OdfListIdState } from "./list-BorrTJBY.cjs";
|
|
6
|
+
import { a as OdfDefinitionsSink, l as OdfResidueFormat, s as OdfMarkerHalf } from "./constructs-BzLZy5YP.cjs";
|
|
7
|
+
import { ContentBlock, ContentParagraph, ContentRun, ProvenanceDescriptor } from "document-schema.js";
|
|
8
|
+
//#region src/typed/shared/paragraph.d.ts
|
|
9
|
+
interface OdfParagraphContext {
|
|
10
|
+
readonly provenanceRegions?: ReadonlyMap<string, ProvenanceDescriptor>;
|
|
11
|
+
readonly markersOut?: OdfMarkerHalf[];
|
|
12
|
+
readonly definitions?: OdfDefinitionsSink;
|
|
13
|
+
readonly listIdState?: OdfListIdState;
|
|
14
|
+
readonly format?: OdfResidueFormat;
|
|
15
|
+
}
|
|
16
|
+
declare function readOdfConstructBodyBlocks(body: XmlElement, pkg: Package, context: OdfParagraphContext, listIdState: OdfListIdState): ContentBlock[];
|
|
17
|
+
declare function readOdfParagraph(pElement: XmlElement, pkg: Package, context?: OdfParagraphContext): ContentParagraph;
|
|
18
|
+
declare function readParagraphOrHeading(element: XmlElement, paragraph: ContentParagraph): ContentParagraph;
|
|
19
|
+
declare function odfRunProperties(run: ContentRun): StyleProperties;
|
|
20
|
+
declare function odfParagraphProperties(paragraph: ContentParagraph): StyleProperties;
|
|
21
|
+
declare function segmentOdfParagraphRuns(runs: readonly ContentRun[]): ContentRun[];
|
|
22
|
+
interface OdfParagraphWriteOptions {
|
|
23
|
+
readonly parentStyleName?: string;
|
|
24
|
+
readonly trailingNodes?: readonly XmlNode[];
|
|
25
|
+
}
|
|
26
|
+
declare function writeOdfParagraph(paragraph: ContentParagraph, registry: StyleRegistry, options?: OdfParagraphWriteOptions): XmlElement;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { readOdfConstructBodyBlocks as a, segmentOdfParagraphRuns as c, odfRunProperties as i, writeOdfParagraph as l, OdfParagraphWriteOptions as n, readOdfParagraph as o, odfParagraphProperties as r, readParagraphOrHeading as s, OdfParagraphContext as t };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { d as XmlNode, l as XmlElement } from "./node-B6JX5CRX.js";
|
|
2
|
+
import { r as Package } from "./package-otZYrxiO.js";
|
|
3
|
+
import { n as StyleProperties } from "./properties-CJyykyc_.js";
|
|
4
|
+
import { a as StyleRegistry } from "./registry-C_16-N6i.js";
|
|
5
|
+
import { i as OdfListIdState } from "./list-7FO0SDqZ.js";
|
|
6
|
+
import { a as OdfDefinitionsSink, l as OdfResidueFormat, s as OdfMarkerHalf } from "./constructs-BntJjuvH.js";
|
|
7
|
+
import { ContentBlock, ContentParagraph, ContentRun, ProvenanceDescriptor } from "document-schema.js";
|
|
8
|
+
//#region src/typed/shared/paragraph.d.ts
|
|
9
|
+
interface OdfParagraphContext {
|
|
10
|
+
readonly provenanceRegions?: ReadonlyMap<string, ProvenanceDescriptor>;
|
|
11
|
+
readonly markersOut?: OdfMarkerHalf[];
|
|
12
|
+
readonly definitions?: OdfDefinitionsSink;
|
|
13
|
+
readonly listIdState?: OdfListIdState;
|
|
14
|
+
readonly format?: OdfResidueFormat;
|
|
15
|
+
}
|
|
16
|
+
declare function readOdfConstructBodyBlocks(body: XmlElement, pkg: Package, context: OdfParagraphContext, listIdState: OdfListIdState): ContentBlock[];
|
|
17
|
+
declare function readOdfParagraph(pElement: XmlElement, pkg: Package, context?: OdfParagraphContext): ContentParagraph;
|
|
18
|
+
declare function readParagraphOrHeading(element: XmlElement, paragraph: ContentParagraph): ContentParagraph;
|
|
19
|
+
declare function odfRunProperties(run: ContentRun): StyleProperties;
|
|
20
|
+
declare function odfParagraphProperties(paragraph: ContentParagraph): StyleProperties;
|
|
21
|
+
declare function segmentOdfParagraphRuns(runs: readonly ContentRun[]): ContentRun[];
|
|
22
|
+
interface OdfParagraphWriteOptions {
|
|
23
|
+
readonly parentStyleName?: string;
|
|
24
|
+
readonly trailingNodes?: readonly XmlNode[];
|
|
25
|
+
}
|
|
26
|
+
declare function writeOdfParagraph(paragraph: ContentParagraph, registry: StyleRegistry, options?: OdfParagraphWriteOptions): XmlElement;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { readOdfConstructBodyBlocks as a, segmentOdfParagraphRuns as c, odfRunProperties as i, writeOdfParagraph as l, OdfParagraphWriteOptions as n, readOdfParagraph as o, odfParagraphProperties as r, readParagraphOrHeading as s, OdfParagraphContext as t };
|
|
@@ -30,5 +30,7 @@ declare function rawSubpathFromPoints(points: readonly OdfRawPoint[], closed: bo
|
|
|
30
30
|
declare function parseOdfPathData(d: string): OdfRawSubpath[];
|
|
31
31
|
declare function scaleOdfRawPoint(point: OdfRawPoint, viewBox: OdfViewBox, frame: Box): ContentPathPoint;
|
|
32
32
|
declare function buildOdfSubpaths(rawSubpaths: readonly OdfRawSubpath[], viewBox: OdfViewBox, frame: Box): ContentSubpath[];
|
|
33
|
+
declare function formatOdfViewBox(frame: Box): string;
|
|
34
|
+
declare function formatOdfPathData(subpaths: readonly ContentSubpath[]): string;
|
|
33
35
|
//#endregion
|
|
34
|
-
export { buildOdfSubpaths as a,
|
|
36
|
+
export { buildOdfSubpaths as a, parseOdfPathData as c, rawSubpathFromPoints as d, scaleOdfRawPoint as f, OdfViewBox as i, parseOdfPointsList as l, OdfRawSegment as n, formatOdfPathData as o, OdfRawSubpath as r, formatOdfViewBox as s, OdfRawPoint as t, parseOdfViewBox as u };
|
|
@@ -30,5 +30,7 @@ declare function rawSubpathFromPoints(points: readonly OdfRawPoint[], closed: bo
|
|
|
30
30
|
declare function parseOdfPathData(d: string): OdfRawSubpath[];
|
|
31
31
|
declare function scaleOdfRawPoint(point: OdfRawPoint, viewBox: OdfViewBox, frame: Box): ContentPathPoint;
|
|
32
32
|
declare function buildOdfSubpaths(rawSubpaths: readonly OdfRawSubpath[], viewBox: OdfViewBox, frame: Box): ContentSubpath[];
|
|
33
|
+
declare function formatOdfViewBox(frame: Box): string;
|
|
34
|
+
declare function formatOdfPathData(subpaths: readonly ContentSubpath[]): string;
|
|
33
35
|
//#endregion
|
|
34
|
-
export { buildOdfSubpaths as a,
|
|
36
|
+
export { buildOdfSubpaths as a, parseOdfPathData as c, rawSubpathFromPoints as d, scaleOdfRawPoint as f, OdfViewBox as i, parseOdfPointsList as l, OdfRawSegment as n, formatOdfPathData as o, OdfRawSubpath as r, formatOdfViewBox as s, OdfRawPoint as t, parseOdfViewBox as u };
|
|
@@ -7,7 +7,9 @@ interface OdsDocument {
|
|
|
7
7
|
definitions?: DefinitionsTable;
|
|
8
8
|
source?: Record<string, SourceResidue>;
|
|
9
9
|
}
|
|
10
|
+
declare const DEFAULT_COLUMN_WIDTH_PT = 64;
|
|
11
|
+
declare const DEFAULT_ROW_HEIGHT_PT = 15;
|
|
10
12
|
declare function readOdsContent(pkg: Package): OdsDocument;
|
|
11
13
|
declare function readOds(pkg: Package): DocumentTree;
|
|
12
14
|
//#endregion
|
|
13
|
-
export { readOds as n,
|
|
15
|
+
export { readOdsContent as a, readOds as i, DEFAULT_ROW_HEIGHT_PT as n, OdsDocument as r, DEFAULT_COLUMN_WIDTH_PT as t };
|
|
@@ -2,7 +2,7 @@ import { r as Package } from "./package-DMk9fuTI.cjs";
|
|
|
2
2
|
import { t as OdpDocument } from "./read-DHOQqjOZ.cjs";
|
|
3
3
|
import { i as OdtReadOptions, t as OdtDocument } from "./read-Dy5p1OMb.cjs";
|
|
4
4
|
import { t as OdgDocument } from "./read-DSyz0YLj.cjs";
|
|
5
|
-
import {
|
|
5
|
+
import { r as OdsDocument } from "./read-fphkvCpR.cjs";
|
|
6
6
|
import { DocumentTree } from "document-schema.js";
|
|
7
7
|
//#region src/ooo1/read.d.ts
|
|
8
8
|
declare function readSxwContent(pkg: Package, options?: OdtReadOptions): OdtDocument;
|
|
@@ -2,7 +2,7 @@ import { r as Package } from "./package-otZYrxiO.js";
|
|
|
2
2
|
import { t as OdpDocument } from "./read-DUOJ-1hX.js";
|
|
3
3
|
import { i as OdtReadOptions, t as OdtDocument } from "./read-BcxAWBB5.js";
|
|
4
4
|
import { t as OdgDocument } from "./read-D3wLfr-7.js";
|
|
5
|
-
import {
|
|
5
|
+
import { r as OdsDocument } from "./read-A3CJkqVM.js";
|
|
6
6
|
import { DocumentTree } from "document-schema.js";
|
|
7
7
|
//#region src/ooo1/read.d.ts
|
|
8
8
|
declare function readSxwContent(pkg: Package, options?: OdtReadOptions): OdtDocument;
|
|
@@ -7,7 +7,9 @@ interface OdsDocument {
|
|
|
7
7
|
definitions?: DefinitionsTable;
|
|
8
8
|
source?: Record<string, SourceResidue>;
|
|
9
9
|
}
|
|
10
|
+
declare const DEFAULT_COLUMN_WIDTH_PT = 64;
|
|
11
|
+
declare const DEFAULT_ROW_HEIGHT_PT = 15;
|
|
10
12
|
declare function readOdsContent(pkg: Package): OdsDocument;
|
|
11
13
|
declare function readOds(pkg: Package): DocumentTree;
|
|
12
14
|
//#endregion
|
|
13
|
-
export { readOds as n,
|
|
15
|
+
export { readOdsContent as a, readOds as i, DEFAULT_ROW_HEIGHT_PT as n, OdsDocument as r, DEFAULT_COLUMN_WIDTH_PT as t };
|