documents.js 1.46.1 → 1.48.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 +34 -23
- package/dist/index.cjs +680 -61
- package/dist/index.d.cts +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.js +676 -63
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AttributeSchema, BinaryPartSchema, CommentSchema, CompactPackageSchema, CompactPartSchema, CompactXmlNodeSchema, DefinedNameSchema, PackageSchema, PartSchema, XmlCdataSchema, XmlCommentSchema, XmlDeclarationSchema, XmlElementSchema, XmlNodeSchema, XmlPartSchema, XmlPiSchema, XmlTextSchema, attr, attr as attr$1, base64ToBytes, base64ToBytes as base64ToBytes$1, buildXml, bytesToBase64, bytesToBase64 as bytesToBase64$1, childrenWithTag, compactCodec, compactPackageCodec, decodeCompactPackage, decodeEntities, decodePackage, decodePackage as decodePackage$1, elementsWithTag, elementsWithTag as elementsWithTag$1, encodeCompactPackage, encodePackage, encodePackage as encodePackage$1, fromCompact, isCompactXmlNode, isXmlNode, packageCodec, parsePackage, parseXml, readDocx, readPptx, resolveRelationships, resolveRelationships as resolveRelationships$1, rootElement, rootElement as rootElement$1, serializePackage, textContent, textContent as textContent$1, toCompact, unzipPackage, walk, xmlCodec, zipPackage } from "ooxml.js";
|
|
2
2
|
import { COLOR_BLACK, ContentBlockSchema, ContentCellValueSchema, ContentDrawPageSchema, ContentDrawPageSchema as ContentDrawPageSchema$1, ContentImageBlockSchema, ContentPageBreakSchema, ContentParagraphSchema, ContentPathPointSchema, ContentPathSegmentSchema, ContentRunSchema, ContentSectionSchema, ContentSectionSchema as ContentSectionSchema$1, ContentShapeSchema, ContentSheetCellSchema, ContentSheetColumnSchema, ContentSheetPrintRangeSchema, ContentSheetPrintSettingsSchema, ContentSheetRepeatRangeSchema, ContentSheetRowSchema, ContentSheetSchema, ContentSheetSchema as ContentSheetSchema$1, ContentSlideSchema, ContentSlideSchema as ContentSlideSchema$1, ContentStrokeSchema, ContentSubpathSchema, ContentTableCellSchema, ContentTableRowSchema, ContentTableSchema, ContentVectorSchema, DEFAULT_LAYOUT_FONT, LAYOUT_FORMAT_VERSION, LAYOUT_FORMAT_VERSION as LAYOUT_FORMAT_VERSION$1, LayoutDocumentSchema, LayoutMetadataSchema, PAGE_SIZE_A4, PAGE_SIZE_LETTER, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, colorToRgbHex, isContentBlock, rgbHexToColor } from "document-content-model";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import { ODF_MEDIA_TYPES, StyleRegistry, applyOdfTransform, base64ToBytes as base64ToBytes$2, buildOdfSubpaths, bytesToBase64 as bytesToBase64$2, decodeOdfText, decodePackage as decodePackage$2, encodePackage as encodePackage$2, formatOdfColor, formatOdfLength, parseBox, parseCellReference, parseLinePoints, parseOdfColor, parseOdfLength, parseOdfPathData, parseOdfViewBox, readOdg, readOdp, readOds, readOdt, resolveOdfShapeGeometry, resolveStyle, setDocumentMediaType, syncManifest, syncManifest as syncManifest$1, xmlnsAttributes } from "odf.js";
|
|
4
|
+
import { ODF_MEDIA_TYPES, StyleRegistry, applyOdfTransform, base64ToBytes as base64ToBytes$2, buildOdfSubpaths, bytesToBase64 as bytesToBase64$2, decodeOdfText, decodePackage as decodePackage$2, encodePackage as encodePackage$2, findStyleElement, formatOdfColor, formatOdfLength, parseBox, parseCellReference, parseLinePoints, parseMargins, parseOdfColor, parseOdfLength, parseOdfPathData, parseOdfViewBox, parsePageSize, readOdg, readOdp, readOds, readOdt, resolveOdfShapeGeometry, resolvePageLayoutProperties, resolveStyle, setDocumentMediaType, syncManifest, syncManifest as syncManifest$1, xmlnsAttributes } from "odf.js";
|
|
5
5
|
import { Unzlib, inflateSync, unzlibSync, zlibSync } from "fflate";
|
|
6
6
|
//#region src/model/content.ts
|
|
7
7
|
const CONTENT_FORMAT_VERSION = 1;
|
|
@@ -535,7 +535,7 @@ function needsSpacePreserve(text) {
|
|
|
535
535
|
}
|
|
536
536
|
//#endregion
|
|
537
537
|
//#region src/edit/docx/run.ts
|
|
538
|
-
function directChild$
|
|
538
|
+
function directChild$11(parent, tag) {
|
|
539
539
|
for (const child of parent.children) if (child.type === "element" && child.tag === tag) return child;
|
|
540
540
|
}
|
|
541
541
|
function appendUElement(rPr, value) {
|
|
@@ -544,7 +544,7 @@ function appendUElement(rPr, value) {
|
|
|
544
544
|
return created;
|
|
545
545
|
}
|
|
546
546
|
function findOrCreateT(run) {
|
|
547
|
-
const existing = directChild$
|
|
547
|
+
const existing = directChild$11(run, "w:t");
|
|
548
548
|
if (existing !== void 0) return existing;
|
|
549
549
|
const created = el("w:t");
|
|
550
550
|
run.children.push(created);
|
|
@@ -564,7 +564,7 @@ var DocxRun = class {
|
|
|
564
564
|
}
|
|
565
565
|
rPr(create) {
|
|
566
566
|
const node = this.live();
|
|
567
|
-
return create ? ensureFirstChild(node, "w:rPr") : directChild$
|
|
567
|
+
return create ? ensureFirstChild(node, "w:rPr") : directChild$11(node, "w:rPr");
|
|
568
568
|
}
|
|
569
569
|
get text() {
|
|
570
570
|
return textContent$1(this.live());
|
|
@@ -588,14 +588,14 @@ var DocxRun = class {
|
|
|
588
588
|
}
|
|
589
589
|
get underline() {
|
|
590
590
|
const rPr = this.rPr(false);
|
|
591
|
-
const uElement = rPr === void 0 ? void 0 : directChild$
|
|
591
|
+
const uElement = rPr === void 0 ? void 0 : directChild$11(rPr, "w:u");
|
|
592
592
|
if (uElement === void 0) return false;
|
|
593
593
|
for (const a of uElement.attributes) if (a.name === "w:val") return a.value !== "none";
|
|
594
594
|
return true;
|
|
595
595
|
}
|
|
596
596
|
set underline(value) {
|
|
597
597
|
const rPr = this.rPr(true);
|
|
598
|
-
const existing = directChild$
|
|
598
|
+
const existing = directChild$11(rPr, "w:u");
|
|
599
599
|
if (existing === void 0) {
|
|
600
600
|
appendUElement(rPr, value);
|
|
601
601
|
return;
|
|
@@ -669,7 +669,7 @@ function buildRun$1(init = {}) {
|
|
|
669
669
|
}
|
|
670
670
|
//#endregion
|
|
671
671
|
//#region src/edit/docx/paragraph.ts
|
|
672
|
-
function directChild$
|
|
672
|
+
function directChild$10(parent, tag) {
|
|
673
673
|
for (const child of parent.children) if (child.type === "element" && child.tag === tag) return child;
|
|
674
674
|
}
|
|
675
675
|
var DocxParagraph = class {
|
|
@@ -688,7 +688,7 @@ var DocxParagraph = class {
|
|
|
688
688
|
}
|
|
689
689
|
pPr(create) {
|
|
690
690
|
const node = this.live();
|
|
691
|
-
return create ? ensureFirstChild(node, "w:pPr") : directChild$
|
|
691
|
+
return create ? ensureFirstChild(node, "w:pPr") : directChild$10(node, "w:pPr");
|
|
692
692
|
}
|
|
693
693
|
get text() {
|
|
694
694
|
return textContent$1(this.live());
|
|
@@ -725,7 +725,7 @@ var DocxParagraph = class {
|
|
|
725
725
|
set styleId(value) {
|
|
726
726
|
if (value === void 0) {
|
|
727
727
|
const pPr = this.pPr(false);
|
|
728
|
-
const existing = pPr === void 0 ? void 0 : directChild$
|
|
728
|
+
const existing = pPr === void 0 ? void 0 : directChild$10(pPr, "w:pStyle");
|
|
729
729
|
if (existing !== void 0 && pPr !== void 0) removeChild(pPr.children, existing);
|
|
730
730
|
return;
|
|
731
731
|
}
|
|
@@ -737,7 +737,7 @@ var DocxParagraph = class {
|
|
|
737
737
|
set alignment(value) {
|
|
738
738
|
if (value === void 0) {
|
|
739
739
|
const pPr = this.pPr(false);
|
|
740
|
-
const existing = pPr === void 0 ? void 0 : directChild$
|
|
740
|
+
const existing = pPr === void 0 ? void 0 : directChild$10(pPr, "w:jc");
|
|
741
741
|
if (existing !== void 0 && pPr !== void 0) removeChild(pPr.children, existing);
|
|
742
742
|
return;
|
|
743
743
|
}
|
|
@@ -745,12 +745,12 @@ var DocxParagraph = class {
|
|
|
745
745
|
}
|
|
746
746
|
get list() {
|
|
747
747
|
const pPr = this.pPr(false);
|
|
748
|
-
const numPr = pPr === void 0 ? void 0 : directChild$
|
|
748
|
+
const numPr = pPr === void 0 ? void 0 : directChild$10(pPr, "w:numPr");
|
|
749
749
|
if (numPr === void 0) return;
|
|
750
|
-
const numIdElement = directChild$
|
|
750
|
+
const numIdElement = directChild$10(numPr, "w:numId");
|
|
751
751
|
const numId = numIdElement === void 0 ? void 0 : attr$1(numIdElement, "w:val");
|
|
752
752
|
if (numId === void 0) return;
|
|
753
|
-
const ilvlElement = directChild$
|
|
753
|
+
const ilvlElement = directChild$10(numPr, "w:ilvl");
|
|
754
754
|
const ilvl = ilvlElement === void 0 ? void 0 : attr$1(ilvlElement, "w:val");
|
|
755
755
|
return {
|
|
756
756
|
numId,
|
|
@@ -760,7 +760,7 @@ var DocxParagraph = class {
|
|
|
760
760
|
set list(value) {
|
|
761
761
|
const pPr = this.pPr(true);
|
|
762
762
|
if (value === void 0) {
|
|
763
|
-
const existing = directChild$
|
|
763
|
+
const existing = directChild$10(pPr, "w:numPr");
|
|
764
764
|
if (existing !== void 0) removeChild(pPr.children, existing);
|
|
765
765
|
return;
|
|
766
766
|
}
|
|
@@ -1425,7 +1425,7 @@ function createEmptyPptxPackage() {
|
|
|
1425
1425
|
}
|
|
1426
1426
|
//#endregion
|
|
1427
1427
|
//#region src/edit/pptx/shape.ts
|
|
1428
|
-
function directChild$
|
|
1428
|
+
function directChild$9(parent, tag) {
|
|
1429
1429
|
for (const child of parent.children) if (child.type === "element" && child.tag === tag) return child;
|
|
1430
1430
|
}
|
|
1431
1431
|
function parseEmuAttr(element, name) {
|
|
@@ -1446,7 +1446,7 @@ var PptxShape = class {
|
|
|
1446
1446
|
}
|
|
1447
1447
|
spPrElement(create) {
|
|
1448
1448
|
const node = this.live();
|
|
1449
|
-
const existing = directChild$
|
|
1449
|
+
const existing = directChild$9(node, "p:spPr");
|
|
1450
1450
|
if (existing !== void 0 || !create) return existing;
|
|
1451
1451
|
const created = el("p:spPr");
|
|
1452
1452
|
node.children.push(created);
|
|
@@ -1454,10 +1454,10 @@ var PptxShape = class {
|
|
|
1454
1454
|
}
|
|
1455
1455
|
get frame() {
|
|
1456
1456
|
const spPr = this.spPrElement(false);
|
|
1457
|
-
const xfrm = spPr === void 0 ? void 0 : directChild$
|
|
1457
|
+
const xfrm = spPr === void 0 ? void 0 : directChild$9(spPr, "a:xfrm");
|
|
1458
1458
|
if (xfrm === void 0) return;
|
|
1459
|
-
const off = directChild$
|
|
1460
|
-
const ext = directChild$
|
|
1459
|
+
const off = directChild$9(xfrm, "a:off");
|
|
1460
|
+
const ext = directChild$9(xfrm, "a:ext");
|
|
1461
1461
|
if (off === void 0 || ext === void 0) return;
|
|
1462
1462
|
const x = parseEmuAttr(off, "x");
|
|
1463
1463
|
const y = parseEmuAttr(off, "y");
|
|
@@ -1473,7 +1473,7 @@ var PptxShape = class {
|
|
|
1473
1473
|
}
|
|
1474
1474
|
set frame(value) {
|
|
1475
1475
|
const spPr = this.spPrElement(true);
|
|
1476
|
-
let xfrm = directChild$
|
|
1476
|
+
let xfrm = directChild$9(spPr, "a:xfrm");
|
|
1477
1477
|
if (xfrm === void 0) {
|
|
1478
1478
|
xfrm = el("a:xfrm");
|
|
1479
1479
|
spPr.children.unshift(xfrm);
|
|
@@ -1487,12 +1487,12 @@ var PptxShape = class {
|
|
|
1487
1487
|
})];
|
|
1488
1488
|
}
|
|
1489
1489
|
get text() {
|
|
1490
|
-
const txBody = directChild$
|
|
1490
|
+
const txBody = directChild$9(this.live(), "p:txBody");
|
|
1491
1491
|
return txBody === void 0 ? "" : textContent$1(txBody);
|
|
1492
1492
|
}
|
|
1493
1493
|
set text(value) {
|
|
1494
1494
|
const node = this.live();
|
|
1495
|
-
let txBody = directChild$
|
|
1495
|
+
let txBody = directChild$9(node, "p:txBody");
|
|
1496
1496
|
if (txBody === void 0) {
|
|
1497
1497
|
txBody = el("p:txBody", {}, [el("a:bodyPr"), el("a:lstStyle")]);
|
|
1498
1498
|
node.children.push(txBody);
|
|
@@ -1503,7 +1503,7 @@ var PptxShape = class {
|
|
|
1503
1503
|
}
|
|
1504
1504
|
setParagraphs(paragraphs) {
|
|
1505
1505
|
const node = this.live();
|
|
1506
|
-
let txBody = directChild$
|
|
1506
|
+
let txBody = directChild$9(node, "p:txBody");
|
|
1507
1507
|
if (txBody === void 0) {
|
|
1508
1508
|
txBody = el("p:txBody", {}, [el("a:bodyPr"), el("a:lstStyle")]);
|
|
1509
1509
|
node.children.push(txBody);
|
|
@@ -1614,12 +1614,12 @@ function insertPictureShapeMedia(context, slideRoot, frame, image) {
|
|
|
1614
1614
|
}
|
|
1615
1615
|
//#endregion
|
|
1616
1616
|
//#region src/edit/pptx/slide.ts
|
|
1617
|
-
function directChild$
|
|
1617
|
+
function directChild$8(parent, tag) {
|
|
1618
1618
|
for (const child of parent.children) if (child.type === "element" && child.tag === tag) return child;
|
|
1619
1619
|
}
|
|
1620
1620
|
function findSpTree(slideRoot) {
|
|
1621
|
-
const cSld = directChild$
|
|
1622
|
-
const spTree = cSld === void 0 ? void 0 : directChild$
|
|
1621
|
+
const cSld = directChild$8(slideRoot, "p:cSld");
|
|
1622
|
+
const spTree = cSld === void 0 ? void 0 : directChild$8(cSld, "p:spTree");
|
|
1623
1623
|
if (spTree === void 0) throw new Error("slide has no p:cSld/p:spTree element");
|
|
1624
1624
|
return spTree;
|
|
1625
1625
|
}
|
|
@@ -1751,7 +1751,7 @@ const PRESENTATION_PART_PATH = "ppt/presentation.xml";
|
|
|
1751
1751
|
const MEDIA_DIR = "ppt/media";
|
|
1752
1752
|
const SLIDE_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.presentationml.slide+xml";
|
|
1753
1753
|
const SLIDE_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide";
|
|
1754
|
-
function directChild$
|
|
1754
|
+
function directChild$7(parent, tag) {
|
|
1755
1755
|
for (const child of parent.children) if (child.type === "element" && child.tag === tag) return child;
|
|
1756
1756
|
}
|
|
1757
1757
|
function attrValue(element, name) {
|
|
@@ -1763,12 +1763,12 @@ function findPresentationRoot(pkg) {
|
|
|
1763
1763
|
return root;
|
|
1764
1764
|
}
|
|
1765
1765
|
function findSldIdLst(presentationRoot) {
|
|
1766
|
-
const sldIdLst = directChild$
|
|
1766
|
+
const sldIdLst = directChild$7(presentationRoot, "p:sldIdLst");
|
|
1767
1767
|
if (sldIdLst === void 0) throw new Error(`${PRESENTATION_PART_PATH} has no p:sldIdLst element`);
|
|
1768
1768
|
return sldIdLst;
|
|
1769
1769
|
}
|
|
1770
1770
|
function findSldSz(presentationRoot) {
|
|
1771
|
-
const sldSz = directChild$
|
|
1771
|
+
const sldSz = directChild$7(presentationRoot, "p:sldSz");
|
|
1772
1772
|
if (sldSz === void 0) throw new Error(`${PRESENTATION_PART_PATH} has no p:sldSz element`);
|
|
1773
1773
|
return sldSz;
|
|
1774
1774
|
}
|
|
@@ -1967,12 +1967,12 @@ function appendShape$2(slide, shape) {
|
|
|
1967
1967
|
}
|
|
1968
1968
|
//#endregion
|
|
1969
1969
|
//#region src/edit/odt/automatic-styles.ts
|
|
1970
|
-
const CONTENT_PART_PATH$
|
|
1970
|
+
const CONTENT_PART_PATH$5 = "content.xml";
|
|
1971
1971
|
function ensureAutomaticStyles(pkg) {
|
|
1972
|
-
const part = pkg.parts[CONTENT_PART_PATH$
|
|
1973
|
-
if (part?.kind !== "xml") throw new Error(`ensureAutomaticStyles: package has no ${CONTENT_PART_PATH$
|
|
1972
|
+
const part = pkg.parts[CONTENT_PART_PATH$5];
|
|
1973
|
+
if (part?.kind !== "xml") throw new Error(`ensureAutomaticStyles: package has no ${CONTENT_PART_PATH$5} part`);
|
|
1974
1974
|
const root = part.nodes.find((n) => n.type === "element");
|
|
1975
|
-
if (root === void 0) throw new Error(`ensureAutomaticStyles: ${CONTENT_PART_PATH$
|
|
1975
|
+
if (root === void 0) throw new Error(`ensureAutomaticStyles: ${CONTENT_PART_PATH$5} has no root element`);
|
|
1976
1976
|
for (const child of root.children) if (child.type === "element" && child.tag === "office:automatic-styles") return child;
|
|
1977
1977
|
const created = el("office:automatic-styles");
|
|
1978
1978
|
const insertBeforeTags = /* @__PURE__ */ new Set([
|
|
@@ -2066,7 +2066,7 @@ function applyStyleChange(pkg, element, family, change) {
|
|
|
2066
2066
|
...readCurrentStyleProperties(pkg, element, family),
|
|
2067
2067
|
...change
|
|
2068
2068
|
};
|
|
2069
|
-
const name = StyleRegistry.forPart(pkg, CONTENT_PART_PATH$
|
|
2069
|
+
const name = StyleRegistry.forPart(pkg, CONTENT_PART_PATH$5).intern({
|
|
2070
2070
|
family,
|
|
2071
2071
|
properties: merged
|
|
2072
2072
|
});
|
|
@@ -2325,7 +2325,7 @@ const META_NS_PREFIXES$3 = [
|
|
|
2325
2325
|
const ODF_VERSION$3 = "1.3";
|
|
2326
2326
|
const PAGE_LAYOUT_NAME$3 = "PM1";
|
|
2327
2327
|
const MASTER_PAGE_NAME$3 = "Standard";
|
|
2328
|
-
const DEFAULT_MARGIN_PT = 72;
|
|
2328
|
+
const DEFAULT_MARGIN_PT$1 = 72;
|
|
2329
2329
|
function declaration$3() {
|
|
2330
2330
|
return {
|
|
2331
2331
|
type: "declaration",
|
|
@@ -2349,10 +2349,10 @@ function buildPageLayout$3() {
|
|
|
2349
2349
|
return el("style:page-layout", { "style:name": PAGE_LAYOUT_NAME$3 }, [el("style:page-layout-properties", {
|
|
2350
2350
|
"fo:page-width": `${PAGE_SIZE_LETTER.widthPt}pt`,
|
|
2351
2351
|
"fo:page-height": `${PAGE_SIZE_LETTER.heightPt}pt`,
|
|
2352
|
-
"fo:margin-top": `${DEFAULT_MARGIN_PT}pt`,
|
|
2353
|
-
"fo:margin-right": `${DEFAULT_MARGIN_PT}pt`,
|
|
2354
|
-
"fo:margin-bottom": `${DEFAULT_MARGIN_PT}pt`,
|
|
2355
|
-
"fo:margin-left": `${DEFAULT_MARGIN_PT}pt`
|
|
2352
|
+
"fo:margin-top": `${DEFAULT_MARGIN_PT$1}pt`,
|
|
2353
|
+
"fo:margin-right": `${DEFAULT_MARGIN_PT$1}pt`,
|
|
2354
|
+
"fo:margin-bottom": `${DEFAULT_MARGIN_PT$1}pt`,
|
|
2355
|
+
"fo:margin-left": `${DEFAULT_MARGIN_PT$1}pt`
|
|
2356
2356
|
})]);
|
|
2357
2357
|
}
|
|
2358
2358
|
function buildStylesXml$3() {
|
|
@@ -2513,20 +2513,20 @@ function buildTable(pkg, init) {
|
|
|
2513
2513
|
}
|
|
2514
2514
|
//#endregion
|
|
2515
2515
|
//#region src/edit/odt/editor.ts
|
|
2516
|
-
const CONTENT_PART_PATH$
|
|
2516
|
+
const CONTENT_PART_PATH$4 = "content.xml";
|
|
2517
2517
|
function findContentRoot(pkg) {
|
|
2518
|
-
const part = pkg.parts[CONTENT_PART_PATH$
|
|
2518
|
+
const part = pkg.parts[CONTENT_PART_PATH$4];
|
|
2519
2519
|
const root = part?.kind === "xml" ? part.nodes.find((n) => n.type === "element") : void 0;
|
|
2520
|
-
if (root === void 0) throw new Error(`package has no root element at ${CONTENT_PART_PATH$
|
|
2520
|
+
if (root === void 0) throw new Error(`package has no root element at ${CONTENT_PART_PATH$4}`);
|
|
2521
2521
|
return root;
|
|
2522
2522
|
}
|
|
2523
|
-
function directChild$
|
|
2523
|
+
function directChild$6(parent, tag) {
|
|
2524
2524
|
for (const child of parent.children) if (child.type === "element" && child.tag === tag) return child;
|
|
2525
2525
|
}
|
|
2526
2526
|
function findOfficeText(contentRoot) {
|
|
2527
|
-
const body = directChild$
|
|
2528
|
-
const text = body === void 0 ? void 0 : directChild$
|
|
2529
|
-
if (text === void 0) throw new Error(`${CONTENT_PART_PATH$
|
|
2527
|
+
const body = directChild$6(contentRoot, "office:body");
|
|
2528
|
+
const text = body === void 0 ? void 0 : directChild$6(body, "office:text");
|
|
2529
|
+
if (text === void 0) throw new Error(`${CONTENT_PART_PATH$4} has no office:body/office:text element`);
|
|
2530
2530
|
return text;
|
|
2531
2531
|
}
|
|
2532
2532
|
var OdtBodyImpl = class {
|
|
@@ -2789,7 +2789,7 @@ function addImageMedia(pkg, imageBytes, format) {
|
|
|
2789
2789
|
}
|
|
2790
2790
|
//#endregion
|
|
2791
2791
|
//#region src/edit/odp/shape.ts
|
|
2792
|
-
function directChild$
|
|
2792
|
+
function directChild$5(parent, tag) {
|
|
2793
2793
|
for (const child of parent.children) if (child.type === "element" && child.tag === tag) return child;
|
|
2794
2794
|
}
|
|
2795
2795
|
function buildTransformAttr(frame, rotationDeg) {
|
|
@@ -2857,7 +2857,7 @@ var OdpShape = class {
|
|
|
2857
2857
|
}
|
|
2858
2858
|
textBox(create) {
|
|
2859
2859
|
const node = this.live();
|
|
2860
|
-
const existing = directChild$
|
|
2860
|
+
const existing = directChild$5(node, "draw:text-box");
|
|
2861
2861
|
if (existing !== void 0 || !create) return existing;
|
|
2862
2862
|
const created = el("draw:text-box");
|
|
2863
2863
|
node.children.push(created);
|
|
@@ -2918,7 +2918,7 @@ function insertImageFrameMedia(context, frame, image) {
|
|
|
2918
2918
|
}
|
|
2919
2919
|
//#endregion
|
|
2920
2920
|
//#region src/edit/odp/slide.ts
|
|
2921
|
-
function directChild$
|
|
2921
|
+
function directChild$4(parent, tag) {
|
|
2922
2922
|
for (const child of parent.children) if (child.type === "element" && child.tag === tag) return child;
|
|
2923
2923
|
}
|
|
2924
2924
|
const NOTES_FRAME_X_PT = 20;
|
|
@@ -2967,13 +2967,13 @@ var OdpSlide = class {
|
|
|
2967
2967
|
return new OdpShape(node.children, frameElement, this.context.pkg);
|
|
2968
2968
|
}
|
|
2969
2969
|
get notes() {
|
|
2970
|
-
const notesElement = directChild$
|
|
2970
|
+
const notesElement = directChild$4(this.live(), "presentation:notes");
|
|
2971
2971
|
if (notesElement === void 0) return "";
|
|
2972
2972
|
return elementsWithTag$1(notesElement.children, "text:p").map((p) => decodeOdfText$1(p.children)).join("\n");
|
|
2973
2973
|
}
|
|
2974
2974
|
set notes(value) {
|
|
2975
2975
|
const node = this.live();
|
|
2976
|
-
const existing = directChild$
|
|
2976
|
+
const existing = directChild$4(node, "presentation:notes");
|
|
2977
2977
|
const notesElement = buildNotesElement(this.context.pkg, value);
|
|
2978
2978
|
if (existing === void 0) node.children.push(notesElement);
|
|
2979
2979
|
else existing.children = notesElement.children;
|
|
@@ -2985,27 +2985,27 @@ var OdpSlide = class {
|
|
|
2985
2985
|
};
|
|
2986
2986
|
//#endregion
|
|
2987
2987
|
//#region src/edit/odp/editor.ts
|
|
2988
|
-
const CONTENT_PART_PATH$
|
|
2989
|
-
const STYLES_PART_PATH$
|
|
2990
|
-
function directChild$
|
|
2988
|
+
const CONTENT_PART_PATH$3 = "content.xml";
|
|
2989
|
+
const STYLES_PART_PATH$2 = "styles.xml";
|
|
2990
|
+
function directChild$3(parent, tag) {
|
|
2991
2991
|
for (const child of parent.children) if (child.type === "element" && child.tag === tag) return child;
|
|
2992
2992
|
}
|
|
2993
|
-
function findRoot$
|
|
2993
|
+
function findRoot$3(pkg, partPath) {
|
|
2994
2994
|
const part = pkg.parts[partPath];
|
|
2995
2995
|
const root = part?.kind === "xml" ? part.nodes.find((n) => n.type === "element") : void 0;
|
|
2996
2996
|
if (root === void 0) throw new Error(`package has no root element at ${partPath}`);
|
|
2997
2997
|
return root;
|
|
2998
2998
|
}
|
|
2999
2999
|
function findOfficePresentation(pkg) {
|
|
3000
|
-
const body = directChild$
|
|
3001
|
-
const presentation = body === void 0 ? void 0 : directChild$
|
|
3002
|
-
if (presentation === void 0) throw new Error(`${CONTENT_PART_PATH$
|
|
3000
|
+
const body = directChild$3(findRoot$3(pkg, CONTENT_PART_PATH$3), "office:body");
|
|
3001
|
+
const presentation = body === void 0 ? void 0 : directChild$3(body, "office:presentation");
|
|
3002
|
+
if (presentation === void 0) throw new Error(`${CONTENT_PART_PATH$3} has no office:body/office:presentation element`);
|
|
3003
3003
|
return presentation;
|
|
3004
3004
|
}
|
|
3005
3005
|
function findPageLayoutProperties$1(pkg) {
|
|
3006
|
-
const pageLayout = directChild$
|
|
3007
|
-
const properties = pageLayout === void 0 ? void 0 : directChild$
|
|
3008
|
-
if (properties === void 0) throw new Error(`${STYLES_PART_PATH$
|
|
3006
|
+
const pageLayout = directChild$3(findRoot$3(pkg, STYLES_PART_PATH$2), "office:automatic-styles")?.children.find((c) => c.type === "element" && c.tag === "style:page-layout" && attr$1(c, "style:name") === "PM1");
|
|
3007
|
+
const properties = pageLayout === void 0 ? void 0 : directChild$3(pageLayout, "style:page-layout-properties");
|
|
3008
|
+
if (properties === void 0) throw new Error(`${STYLES_PART_PATH$2} has no style:page-layout[style:name="PM1"]/style:page-layout-properties element`);
|
|
3009
3009
|
return properties;
|
|
3010
3010
|
}
|
|
3011
3011
|
var OdpEditor = class {
|
|
@@ -3507,6 +3507,87 @@ var OdsCell = class {
|
|
|
3507
3507
|
}
|
|
3508
3508
|
};
|
|
3509
3509
|
//#endregion
|
|
3510
|
+
//#region src/edit/ods/print-settings.ts
|
|
3511
|
+
const STYLES_PART_PATH$1 = "styles.xml";
|
|
3512
|
+
const CONTENT_PART_PATH$2 = "content.xml";
|
|
3513
|
+
function findRoot$2(pkg, partPath) {
|
|
3514
|
+
const part = pkg.parts[partPath];
|
|
3515
|
+
const root = part?.kind === "xml" ? part.nodes.find((n) => n.type === "element") : void 0;
|
|
3516
|
+
if (root === void 0) throw new Error(`package has no root element at ${partPath}`);
|
|
3517
|
+
return root;
|
|
3518
|
+
}
|
|
3519
|
+
function directChild$2(parent, tag) {
|
|
3520
|
+
for (const child of parent.children) if (child.type === "element" && child.tag === tag) return child;
|
|
3521
|
+
}
|
|
3522
|
+
function findStylesAutomaticStyles(pkg) {
|
|
3523
|
+
const found = directChild$2(findRoot$2(pkg, STYLES_PART_PATH$1), "office:automatic-styles");
|
|
3524
|
+
if (found === void 0) throw new Error(`${STYLES_PART_PATH$1} has no office:automatic-styles element`);
|
|
3525
|
+
return found;
|
|
3526
|
+
}
|
|
3527
|
+
function findMasterStyles(pkg) {
|
|
3528
|
+
const found = directChild$2(findRoot$2(pkg, STYLES_PART_PATH$1), "office:master-styles");
|
|
3529
|
+
if (found === void 0) throw new Error(`${STYLES_PART_PATH$1} has no office:master-styles element`);
|
|
3530
|
+
return found;
|
|
3531
|
+
}
|
|
3532
|
+
function findContentAutomaticStyles(pkg) {
|
|
3533
|
+
const found = directChild$2(findRoot$2(pkg, CONTENT_PART_PATH$2), "office:automatic-styles");
|
|
3534
|
+
if (found === void 0) throw new Error(`${CONTENT_PART_PATH$2} has no office:automatic-styles element`);
|
|
3535
|
+
return found;
|
|
3536
|
+
}
|
|
3537
|
+
const DEFAULT_MARGIN_PT = 56.69291338582677;
|
|
3538
|
+
const DEFAULT_MARGINS = {
|
|
3539
|
+
topPt: DEFAULT_MARGIN_PT,
|
|
3540
|
+
rightPt: DEFAULT_MARGIN_PT,
|
|
3541
|
+
bottomPt: DEFAULT_MARGIN_PT,
|
|
3542
|
+
leftPt: DEFAULT_MARGIN_PT
|
|
3543
|
+
};
|
|
3544
|
+
function readSheetPrintSettings(pkg, tableElement) {
|
|
3545
|
+
const tableStyleName = attr$1(tableElement, "table:style-name");
|
|
3546
|
+
const tableStyleElement = tableStyleName === void 0 ? void 0 : findStyleElement(tableStyleName, "table", pkg);
|
|
3547
|
+
const masterPageName = tableStyleElement === void 0 ? void 0 : attr$1(tableStyleElement, "style:master-page-name");
|
|
3548
|
+
const layoutProperties = resolvePageLayoutProperties(pkg, masterPageName);
|
|
3549
|
+
const pageSize = layoutProperties === void 0 ? void 0 : parsePageSize(layoutProperties);
|
|
3550
|
+
const margins = layoutProperties === void 0 ? void 0 : parseMargins(layoutProperties);
|
|
3551
|
+
const printTokens = new Set((layoutProperties === void 0 ? void 0 : attr$1(layoutProperties, "style:print"))?.split(" ").filter((token) => token.length > 0) ?? []);
|
|
3552
|
+
const pageOrder = (layoutProperties === void 0 ? void 0 : attr$1(layoutProperties, "style:print-page-order")) === "ltr" ? "overThenDown" : "downThenOver";
|
|
3553
|
+
return {
|
|
3554
|
+
pageSize: pageSize ?? PAGE_SIZE_A4,
|
|
3555
|
+
margins: margins ?? DEFAULT_MARGINS,
|
|
3556
|
+
gridlines: printTokens.has("grid"),
|
|
3557
|
+
headers: printTokens.has("headers"),
|
|
3558
|
+
pageOrder
|
|
3559
|
+
};
|
|
3560
|
+
}
|
|
3561
|
+
function writeSheetPrintSettings(pkg, tableElement, settings) {
|
|
3562
|
+
const stylesAutomaticStyles = findStylesAutomaticStyles(pkg);
|
|
3563
|
+
const masterStyles = findMasterStyles(pkg);
|
|
3564
|
+
const contentAutomaticStyles = findContentAutomaticStyles(pkg);
|
|
3565
|
+
const printTokens = [settings.gridlines ? "grid" : void 0, settings.headers ? "headers" : void 0].filter((token) => token !== void 0);
|
|
3566
|
+
const pageLayoutName = nextStyleName(stylesAutomaticStyles, "style:page-layout", "OdsPageLayout");
|
|
3567
|
+
stylesAutomaticStyles.children.push(el("style:page-layout", { "style:name": pageLayoutName }, [el("style:page-layout-properties", {
|
|
3568
|
+
"fo:page-width": formatOdfLength(settings.pageSize.widthPt),
|
|
3569
|
+
"fo:page-height": formatOdfLength(settings.pageSize.heightPt),
|
|
3570
|
+
"fo:margin-top": formatOdfLength(settings.margins.topPt),
|
|
3571
|
+
"fo:margin-right": formatOdfLength(settings.margins.rightPt),
|
|
3572
|
+
"fo:margin-bottom": formatOdfLength(settings.margins.bottomPt),
|
|
3573
|
+
"fo:margin-left": formatOdfLength(settings.margins.leftPt),
|
|
3574
|
+
...printTokens.length > 0 ? { "style:print": printTokens.join(" ") } : {},
|
|
3575
|
+
"style:print-page-order": settings.pageOrder === "overThenDown" ? "ltr" : "ttb"
|
|
3576
|
+
})]));
|
|
3577
|
+
const masterPageName = nextStyleName(masterStyles, "style:master-page", "OdsMasterPage");
|
|
3578
|
+
masterStyles.children.push(el("style:master-page", {
|
|
3579
|
+
"style:name": masterPageName,
|
|
3580
|
+
"style:page-layout-name": pageLayoutName
|
|
3581
|
+
}));
|
|
3582
|
+
const tableStyleName = nextStyleName(contentAutomaticStyles, "style:style", "OdsSheetPrint");
|
|
3583
|
+
contentAutomaticStyles.children.push(el("style:style", {
|
|
3584
|
+
"style:name": tableStyleName,
|
|
3585
|
+
"style:family": "table",
|
|
3586
|
+
"style:master-page-name": masterPageName
|
|
3587
|
+
}));
|
|
3588
|
+
setAttr(tableElement, "table:style-name", tableStyleName);
|
|
3589
|
+
}
|
|
3590
|
+
//#endregion
|
|
3510
3591
|
//#region src/edit/ods/sheet.ts
|
|
3511
3592
|
const NAME_ATTR = "table:name";
|
|
3512
3593
|
var OdsSheet = class {
|
|
@@ -3531,6 +3612,12 @@ var OdsSheet = class {
|
|
|
3531
3612
|
set name(value) {
|
|
3532
3613
|
setAttr(this.live(), NAME_ATTR, value);
|
|
3533
3614
|
}
|
|
3615
|
+
get printSettings() {
|
|
3616
|
+
return readSheetPrintSettings(this.pkg, this.live());
|
|
3617
|
+
}
|
|
3618
|
+
set printSettings(value) {
|
|
3619
|
+
writeSheetPrintSettings(this.pkg, this.live(), value);
|
|
3620
|
+
}
|
|
3534
3621
|
cell(row, column) {
|
|
3535
3622
|
const node = resolveCellNode(this.live(), row, column);
|
|
3536
3623
|
if (node.tag === "table:covered-table-cell") throw new Error(`cell (${row}, ${column}) is covered by a merged range -- address the merge's own anchor cell instead`);
|
|
@@ -3643,6 +3730,7 @@ function buildOdsPackage(content) {
|
|
|
3643
3730
|
if (content.sheets.length > 0) editor.removeSheetAt(0);
|
|
3644
3731
|
for (const sheet of content.sheets) {
|
|
3645
3732
|
const odsSheet = editor.addSheet(sheet.name);
|
|
3733
|
+
odsSheet.printSettings = sheet.printSettings;
|
|
3646
3734
|
for (const cell of sheet.cells) appendCell(odsSheet, cell);
|
|
3647
3735
|
}
|
|
3648
3736
|
return editor.toPackage();
|
|
@@ -3761,7 +3849,10 @@ const GRAPHIC_STYLE_PREFIX = "gr";
|
|
|
3761
3849
|
function graphicPropertyAttrs(init) {
|
|
3762
3850
|
const attrs = {};
|
|
3763
3851
|
if (init.fill === void 0) attrs["draw:fill"] = "none";
|
|
3764
|
-
else
|
|
3852
|
+
else {
|
|
3853
|
+
attrs["draw:fill"] = "solid";
|
|
3854
|
+
attrs["draw:fill-color"] = formatOdfColor(init.fill);
|
|
3855
|
+
}
|
|
3765
3856
|
if (init.stroke === void 0) attrs["draw:stroke"] = "none";
|
|
3766
3857
|
else {
|
|
3767
3858
|
attrs["svg:stroke-color"] = formatOdfColor(init.stroke.color);
|
|
@@ -8441,6 +8532,7 @@ function writeEllipse(writer, item) {
|
|
|
8441
8532
|
writer.writeAscii(`${formatPoint(cx - kx, cy + ry)} ${formatPoint(cx - rx, cy + ky)} ${formatPoint(cx - rx, cy)} c\n`);
|
|
8442
8533
|
writer.writeAscii(`${formatPoint(cx - rx, cy - ky)} ${formatPoint(cx - kx, cy - ry)} ${formatPoint(cx, cy - ry)} c\n`);
|
|
8443
8534
|
writer.writeAscii(`${formatPoint(cx + kx, cy - ry)} ${formatPoint(cx + rx, cy - ky)} ${formatPoint(cx + rx, cy)} c\n`);
|
|
8535
|
+
writer.writeAscii("h\n");
|
|
8444
8536
|
writer.writeAscii(`${paint}\n`);
|
|
8445
8537
|
}
|
|
8446
8538
|
function writeSubpath(writer, subpath) {
|
|
@@ -10823,6 +10915,471 @@ function imageToShape(img, slideHeightPt, images) {
|
|
|
10823
10915
|
}]
|
|
10824
10916
|
};
|
|
10825
10917
|
}
|
|
10918
|
+
function reconstructDrawing(doc, options) {
|
|
10919
|
+
const signal = options?.signal;
|
|
10920
|
+
const pages = doc.pages.map((page) => {
|
|
10921
|
+
throwIfAborted(signal);
|
|
10922
|
+
return reconstructDrawPage(page, doc.images);
|
|
10923
|
+
});
|
|
10924
|
+
return {
|
|
10925
|
+
kind: "drawing",
|
|
10926
|
+
formatVersion: 1,
|
|
10927
|
+
metadata: doc.metadata,
|
|
10928
|
+
pages
|
|
10929
|
+
};
|
|
10930
|
+
}
|
|
10931
|
+
function reconstructDrawPage(page, images) {
|
|
10932
|
+
const vectors = [];
|
|
10933
|
+
const shapes = [];
|
|
10934
|
+
for (const item of page.items) if (item.kind === "rect") vectors.push(layoutRectToVector(item, page.heightPt));
|
|
10935
|
+
else if (item.kind === "ellipse") vectors.push(layoutEllipseToVector(item, page.heightPt));
|
|
10936
|
+
else if (item.kind === "line") vectors.push(layoutLineToVector(item, page.heightPt));
|
|
10937
|
+
else if (item.kind === "path") vectors.push(layoutPathToVector(item, page.heightPt));
|
|
10938
|
+
else if (item.kind === "text") shapes.push(layoutTextToShape(item, page.heightPt));
|
|
10939
|
+
else if (item.kind === "image") {
|
|
10940
|
+
const shape = imageToShape(item, page.heightPt, images);
|
|
10941
|
+
if (shape !== void 0) shapes.push(shape);
|
|
10942
|
+
}
|
|
10943
|
+
return {
|
|
10944
|
+
size: {
|
|
10945
|
+
widthPt: page.widthPt,
|
|
10946
|
+
heightPt: page.heightPt
|
|
10947
|
+
},
|
|
10948
|
+
shapes,
|
|
10949
|
+
vectors
|
|
10950
|
+
};
|
|
10951
|
+
}
|
|
10952
|
+
function layoutRectToVector(item, pageHeightPt) {
|
|
10953
|
+
return {
|
|
10954
|
+
kind: "rect",
|
|
10955
|
+
frame: flipY({
|
|
10956
|
+
xPt: item.xPt,
|
|
10957
|
+
yPt: item.yPt,
|
|
10958
|
+
widthPt: item.widthPt,
|
|
10959
|
+
heightPt: item.heightPt
|
|
10960
|
+
}, pageHeightPt),
|
|
10961
|
+
fill: item.fill,
|
|
10962
|
+
stroke: item.stroke,
|
|
10963
|
+
sourcePath: item.sourcePath
|
|
10964
|
+
};
|
|
10965
|
+
}
|
|
10966
|
+
function layoutEllipseToVector(item, pageHeightPt) {
|
|
10967
|
+
return {
|
|
10968
|
+
kind: "ellipse",
|
|
10969
|
+
frame: flipY({
|
|
10970
|
+
xPt: item.xPt,
|
|
10971
|
+
yPt: item.yPt,
|
|
10972
|
+
widthPt: item.widthPt,
|
|
10973
|
+
heightPt: item.heightPt
|
|
10974
|
+
}, pageHeightPt),
|
|
10975
|
+
fill: item.fill,
|
|
10976
|
+
stroke: item.stroke,
|
|
10977
|
+
sourcePath: item.sourcePath
|
|
10978
|
+
};
|
|
10979
|
+
}
|
|
10980
|
+
function layoutLineToVector(item, pageHeightPt) {
|
|
10981
|
+
return {
|
|
10982
|
+
kind: "line",
|
|
10983
|
+
from: {
|
|
10984
|
+
xPt: item.x1Pt,
|
|
10985
|
+
yPt: pageHeightPt - item.y1Pt
|
|
10986
|
+
},
|
|
10987
|
+
to: {
|
|
10988
|
+
xPt: item.x2Pt,
|
|
10989
|
+
yPt: pageHeightPt - item.y2Pt
|
|
10990
|
+
},
|
|
10991
|
+
stroke: {
|
|
10992
|
+
color: item.color,
|
|
10993
|
+
widthPt: item.widthPt
|
|
10994
|
+
},
|
|
10995
|
+
sourcePath: item.sourcePath
|
|
10996
|
+
};
|
|
10997
|
+
}
|
|
10998
|
+
function collectPathPoints(subpaths) {
|
|
10999
|
+
const points = [];
|
|
11000
|
+
for (const subpath of subpaths) {
|
|
11001
|
+
points.push({
|
|
11002
|
+
xPt: subpath.startXPt,
|
|
11003
|
+
yPt: subpath.startYPt
|
|
11004
|
+
});
|
|
11005
|
+
for (const segment of subpath.segments) {
|
|
11006
|
+
if (segment.kind === "cubic") {
|
|
11007
|
+
points.push({
|
|
11008
|
+
xPt: segment.c1xPt,
|
|
11009
|
+
yPt: segment.c1yPt
|
|
11010
|
+
});
|
|
11011
|
+
points.push({
|
|
11012
|
+
xPt: segment.c2xPt,
|
|
11013
|
+
yPt: segment.c2yPt
|
|
11014
|
+
});
|
|
11015
|
+
}
|
|
11016
|
+
points.push({
|
|
11017
|
+
xPt: segment.xPt,
|
|
11018
|
+
yPt: segment.yPt
|
|
11019
|
+
});
|
|
11020
|
+
}
|
|
11021
|
+
}
|
|
11022
|
+
return points;
|
|
11023
|
+
}
|
|
11024
|
+
function pathBoundingFrame(points, pageHeightPt) {
|
|
11025
|
+
if (points.length === 0) return {
|
|
11026
|
+
xPt: 0,
|
|
11027
|
+
yPt: 0,
|
|
11028
|
+
widthPt: 0,
|
|
11029
|
+
heightPt: 0
|
|
11030
|
+
};
|
|
11031
|
+
let minX = Number.POSITIVE_INFINITY;
|
|
11032
|
+
let maxX = Number.NEGATIVE_INFINITY;
|
|
11033
|
+
let minYDown = Number.POSITIVE_INFINITY;
|
|
11034
|
+
let maxYDown = Number.NEGATIVE_INFINITY;
|
|
11035
|
+
for (const point of points) {
|
|
11036
|
+
const yDown = pageHeightPt - point.yPt;
|
|
11037
|
+
minX = Math.min(minX, point.xPt);
|
|
11038
|
+
maxX = Math.max(maxX, point.xPt);
|
|
11039
|
+
minYDown = Math.min(minYDown, yDown);
|
|
11040
|
+
maxYDown = Math.max(maxYDown, yDown);
|
|
11041
|
+
}
|
|
11042
|
+
return {
|
|
11043
|
+
xPt: minX,
|
|
11044
|
+
yPt: minYDown,
|
|
11045
|
+
widthPt: maxX - minX,
|
|
11046
|
+
heightPt: maxYDown - minYDown
|
|
11047
|
+
};
|
|
11048
|
+
}
|
|
11049
|
+
function localizePathPoint(frame, point, pageHeightPt) {
|
|
11050
|
+
return {
|
|
11051
|
+
xPt: point.xPt - frame.xPt,
|
|
11052
|
+
yPt: pageHeightPt - frame.yPt - point.yPt
|
|
11053
|
+
};
|
|
11054
|
+
}
|
|
11055
|
+
function layoutPathToVector(item, pageHeightPt) {
|
|
11056
|
+
const frame = pathBoundingFrame(collectPathPoints(item.subpaths), pageHeightPt);
|
|
11057
|
+
return {
|
|
11058
|
+
kind: "path",
|
|
11059
|
+
frame,
|
|
11060
|
+
subpaths: item.subpaths.map((subpath) => ({
|
|
11061
|
+
start: localizePathPoint(frame, {
|
|
11062
|
+
xPt: subpath.startXPt,
|
|
11063
|
+
yPt: subpath.startYPt
|
|
11064
|
+
}, pageHeightPt),
|
|
11065
|
+
closed: subpath.closed,
|
|
11066
|
+
segments: subpath.segments.map((segment) => {
|
|
11067
|
+
if (segment.kind === "line") return {
|
|
11068
|
+
kind: "line",
|
|
11069
|
+
to: localizePathPoint(frame, {
|
|
11070
|
+
xPt: segment.xPt,
|
|
11071
|
+
yPt: segment.yPt
|
|
11072
|
+
}, pageHeightPt)
|
|
11073
|
+
};
|
|
11074
|
+
return {
|
|
11075
|
+
kind: "cubic",
|
|
11076
|
+
control1: localizePathPoint(frame, {
|
|
11077
|
+
xPt: segment.c1xPt,
|
|
11078
|
+
yPt: segment.c1yPt
|
|
11079
|
+
}, pageHeightPt),
|
|
11080
|
+
control2: localizePathPoint(frame, {
|
|
11081
|
+
xPt: segment.c2xPt,
|
|
11082
|
+
yPt: segment.c2yPt
|
|
11083
|
+
}, pageHeightPt),
|
|
11084
|
+
to: localizePathPoint(frame, {
|
|
11085
|
+
xPt: segment.xPt,
|
|
11086
|
+
yPt: segment.yPt
|
|
11087
|
+
}, pageHeightPt)
|
|
11088
|
+
};
|
|
11089
|
+
})
|
|
11090
|
+
})),
|
|
11091
|
+
fill: item.fill,
|
|
11092
|
+
fillRule: item.fillRule,
|
|
11093
|
+
stroke: item.stroke,
|
|
11094
|
+
sourcePath: item.sourcePath
|
|
11095
|
+
};
|
|
11096
|
+
}
|
|
11097
|
+
function layoutTextToShape(item, pageHeightPt) {
|
|
11098
|
+
return {
|
|
11099
|
+
frame: computeBlockFrame({ lines: [{
|
|
11100
|
+
items: [item],
|
|
11101
|
+
baselineY: item.yPt
|
|
11102
|
+
}] }, pageHeightPt),
|
|
11103
|
+
rotationDeg: item.rotationDeg !== void 0 ? -item.rotationDeg : void 0,
|
|
11104
|
+
insetLeftPt: 0,
|
|
11105
|
+
insetTopPt: 0,
|
|
11106
|
+
insetRightPt: 0,
|
|
11107
|
+
insetBottomPt: 0,
|
|
11108
|
+
blocks: [{
|
|
11109
|
+
kind: "paragraph",
|
|
11110
|
+
runs: [textItemToContentRun(item)]
|
|
11111
|
+
}]
|
|
11112
|
+
};
|
|
11113
|
+
}
|
|
11114
|
+
function extractLineCandidates(items) {
|
|
11115
|
+
const segments = [];
|
|
11116
|
+
for (const item of items) {
|
|
11117
|
+
if (item.kind === "line") {
|
|
11118
|
+
segments.push({
|
|
11119
|
+
x1Pt: item.x1Pt,
|
|
11120
|
+
y1Pt: item.y1Pt,
|
|
11121
|
+
x2Pt: item.x2Pt,
|
|
11122
|
+
y2Pt: item.y2Pt
|
|
11123
|
+
});
|
|
11124
|
+
continue;
|
|
11125
|
+
}
|
|
11126
|
+
if (item.kind === "path" && item.stroke !== void 0 && item.subpaths.length === 1) {
|
|
11127
|
+
const subpath = item.subpaths[0];
|
|
11128
|
+
if (subpath.segments.length === 1 && subpath.segments[0].kind === "line") {
|
|
11129
|
+
const segment = subpath.segments[0];
|
|
11130
|
+
segments.push({
|
|
11131
|
+
x1Pt: subpath.startXPt,
|
|
11132
|
+
y1Pt: subpath.startYPt,
|
|
11133
|
+
x2Pt: segment.xPt,
|
|
11134
|
+
y2Pt: segment.yPt
|
|
11135
|
+
});
|
|
11136
|
+
}
|
|
11137
|
+
}
|
|
11138
|
+
}
|
|
11139
|
+
return segments;
|
|
11140
|
+
}
|
|
11141
|
+
const AXIS_ALIGNMENT_TOLERANCE_PT = .5;
|
|
11142
|
+
const MIN_GRIDLINE_LENGTH_PT = 4;
|
|
11143
|
+
function classifyAxisLine(seg) {
|
|
11144
|
+
const dx = Math.abs(seg.x2Pt - seg.x1Pt);
|
|
11145
|
+
const dy = Math.abs(seg.y2Pt - seg.y1Pt);
|
|
11146
|
+
if (dy <= AXIS_ALIGNMENT_TOLERANCE_PT && dx >= MIN_GRIDLINE_LENGTH_PT) return {
|
|
11147
|
+
axis: "horizontal",
|
|
11148
|
+
position: (seg.y1Pt + seg.y2Pt) / 2,
|
|
11149
|
+
spanPt: dx
|
|
11150
|
+
};
|
|
11151
|
+
if (dx <= AXIS_ALIGNMENT_TOLERANCE_PT && dy >= MIN_GRIDLINE_LENGTH_PT) return {
|
|
11152
|
+
axis: "vertical",
|
|
11153
|
+
position: (seg.x1Pt + seg.x2Pt) / 2,
|
|
11154
|
+
spanPt: dy
|
|
11155
|
+
};
|
|
11156
|
+
}
|
|
11157
|
+
const POSITION_DEDUPE_TOLERANCE_PT = .5;
|
|
11158
|
+
function dedupeAxisLines(lines, descending) {
|
|
11159
|
+
const sorted = [...lines].sort((a, b) => descending ? b.position - a.position : a.position - b.position);
|
|
11160
|
+
const result = [];
|
|
11161
|
+
for (const candidate of sorted) {
|
|
11162
|
+
const last = result[result.length - 1];
|
|
11163
|
+
if (last !== void 0 && Math.abs(candidate.position - last.position) <= POSITION_DEDUPE_TOLERANCE_PT) last.spanPt = Math.max(last.spanPt, candidate.spanPt);
|
|
11164
|
+
else result.push({
|
|
11165
|
+
position: candidate.position,
|
|
11166
|
+
spanPt: candidate.spanPt
|
|
11167
|
+
});
|
|
11168
|
+
}
|
|
11169
|
+
return result;
|
|
11170
|
+
}
|
|
11171
|
+
const MIN_GRIDLINE_COUNT_PER_AXIS = 3;
|
|
11172
|
+
const GRID_SPAN_CONSISTENCY_RATIO = .9;
|
|
11173
|
+
function isRegularLattice(lines) {
|
|
11174
|
+
if (lines.length < MIN_GRIDLINE_COUNT_PER_AXIS) return false;
|
|
11175
|
+
const maxSpanPt = Math.max(...lines.map((l) => l.spanPt));
|
|
11176
|
+
return lines.filter((l) => l.spanPt >= maxSpanPt * GRID_SPAN_CONSISTENCY_RATIO).length >= MIN_GRIDLINE_COUNT_PER_AXIS;
|
|
11177
|
+
}
|
|
11178
|
+
function detectGridLattice(items) {
|
|
11179
|
+
const horizontal = [];
|
|
11180
|
+
const vertical = [];
|
|
11181
|
+
for (const seg of extractLineCandidates(items)) {
|
|
11182
|
+
const classified = classifyAxisLine(seg);
|
|
11183
|
+
if (classified === void 0) continue;
|
|
11184
|
+
(classified.axis === "horizontal" ? horizontal : vertical).push(classified);
|
|
11185
|
+
}
|
|
11186
|
+
const rowBoundaries = dedupeAxisLines(horizontal, true);
|
|
11187
|
+
const columnBoundaries = dedupeAxisLines(vertical, false);
|
|
11188
|
+
if (!isRegularLattice(rowBoundaries) || !isRegularLattice(columnBoundaries)) return;
|
|
11189
|
+
return {
|
|
11190
|
+
rowBoundariesDescPt: rowBoundaries.map((l) => l.position),
|
|
11191
|
+
columnBoundariesAscPt: columnBoundaries.map((l) => l.position)
|
|
11192
|
+
};
|
|
11193
|
+
}
|
|
11194
|
+
const OUTER_EDGE_TOLERANCE_PT = 3;
|
|
11195
|
+
function findRowIndex(rowBoundariesDescPt, yPt) {
|
|
11196
|
+
const lastIndex = rowBoundariesDescPt.length - 1;
|
|
11197
|
+
if (yPt > rowBoundariesDescPt[0] + OUTER_EDGE_TOLERANCE_PT || yPt < rowBoundariesDescPt[lastIndex] - OUTER_EDGE_TOLERANCE_PT) return;
|
|
11198
|
+
for (let i = 0; i < lastIndex; i++) if (yPt > rowBoundariesDescPt[i + 1]) return i;
|
|
11199
|
+
return lastIndex - 1;
|
|
11200
|
+
}
|
|
11201
|
+
function findColumnIndex(columnBoundariesAscPt, xPt) {
|
|
11202
|
+
const lastIndex = columnBoundariesAscPt.length - 1;
|
|
11203
|
+
if (xPt < columnBoundariesAscPt[0] - OUTER_EDGE_TOLERANCE_PT || xPt > columnBoundariesAscPt[lastIndex] + OUTER_EDGE_TOLERANCE_PT) return;
|
|
11204
|
+
for (let j = 0; j < lastIndex; j++) if (xPt < columnBoundariesAscPt[j + 1]) return j;
|
|
11205
|
+
return lastIndex - 1;
|
|
11206
|
+
}
|
|
11207
|
+
function joinCellText(items) {
|
|
11208
|
+
const sorted = [...items].sort((a, b) => a.xPt - b.xPt);
|
|
11209
|
+
let text = "";
|
|
11210
|
+
sorted.forEach((item, i) => {
|
|
11211
|
+
if (i > 0) {
|
|
11212
|
+
const prev = sorted[i - 1];
|
|
11213
|
+
if (item.xPt - (prev.xPt + (prev.widthPt ?? 0)) > MIN_WORD_GAP_PT) text += " ";
|
|
11214
|
+
}
|
|
11215
|
+
text += item.text;
|
|
11216
|
+
});
|
|
11217
|
+
return text;
|
|
11218
|
+
}
|
|
11219
|
+
function groupKey(row, column) {
|
|
11220
|
+
return `${row},${column}`;
|
|
11221
|
+
}
|
|
11222
|
+
function addToGroup(groups, row, column, item) {
|
|
11223
|
+
const key = groupKey(row, column);
|
|
11224
|
+
const existing = groups.get(key);
|
|
11225
|
+
if (existing === void 0) groups.set(key, [item]);
|
|
11226
|
+
else existing.push(item);
|
|
11227
|
+
}
|
|
11228
|
+
function buildCellsFromGroups(groups) {
|
|
11229
|
+
const cells = [];
|
|
11230
|
+
for (const [key, items] of groups) {
|
|
11231
|
+
const displayText = joinCellText(items);
|
|
11232
|
+
if (displayText.length === 0) continue;
|
|
11233
|
+
const [rowPart, columnPart] = key.split(",");
|
|
11234
|
+
cells.push({
|
|
11235
|
+
row: Number(rowPart),
|
|
11236
|
+
column: Number(columnPart),
|
|
11237
|
+
value: {
|
|
11238
|
+
kind: "string",
|
|
11239
|
+
value: displayText
|
|
11240
|
+
},
|
|
11241
|
+
displayText
|
|
11242
|
+
});
|
|
11243
|
+
}
|
|
11244
|
+
cells.sort((a, b) => a.row - b.row || a.column - b.column);
|
|
11245
|
+
return cells;
|
|
11246
|
+
}
|
|
11247
|
+
function buildGridFromLattice(textItems, lattice) {
|
|
11248
|
+
const groups = /* @__PURE__ */ new Map();
|
|
11249
|
+
for (const item of textItems) {
|
|
11250
|
+
const row = findRowIndex(lattice.rowBoundariesDescPt, item.yPt);
|
|
11251
|
+
const column = findColumnIndex(lattice.columnBoundariesAscPt, item.xPt);
|
|
11252
|
+
if (row === void 0 || column === void 0) continue;
|
|
11253
|
+
addToGroup(groups, row, column, item);
|
|
11254
|
+
}
|
|
11255
|
+
const columns = [];
|
|
11256
|
+
for (let j = 0; j < lattice.columnBoundariesAscPt.length - 1; j++) columns.push({
|
|
11257
|
+
index: j,
|
|
11258
|
+
widthPt: lattice.columnBoundariesAscPt[j + 1] - lattice.columnBoundariesAscPt[j]
|
|
11259
|
+
});
|
|
11260
|
+
const rows = [];
|
|
11261
|
+
for (let i = 0; i < lattice.rowBoundariesDescPt.length - 1; i++) rows.push({
|
|
11262
|
+
index: i,
|
|
11263
|
+
heightPt: lattice.rowBoundariesDescPt[i] - lattice.rowBoundariesDescPt[i + 1]
|
|
11264
|
+
});
|
|
11265
|
+
return {
|
|
11266
|
+
cells: buildCellsFromGroups(groups),
|
|
11267
|
+
columns,
|
|
11268
|
+
rows,
|
|
11269
|
+
gridlines: true
|
|
11270
|
+
};
|
|
11271
|
+
}
|
|
11272
|
+
const COLUMN_ALIGNMENT_TOLERANCE_PT = 3;
|
|
11273
|
+
const MIN_COLUMN_RECURRENCE = 2;
|
|
11274
|
+
function detectColumnPositions(segmentsByLine) {
|
|
11275
|
+
const allXs = segmentsByLine.flatMap((segments) => segments.map((segment) => segment.items[0].xPt));
|
|
11276
|
+
if (allXs.length === 0) return [];
|
|
11277
|
+
const counts = bucketCounts(allXs, COLUMN_ALIGNMENT_TOLERANCE_PT);
|
|
11278
|
+
const recurring = [...counts.entries()].filter(([, count]) => count >= MIN_COLUMN_RECURRENCE).map(([bucket]) => bucket);
|
|
11279
|
+
const positions = recurring.length > 0 ? recurring : [...counts.keys()];
|
|
11280
|
+
positions.sort((a, b) => a - b);
|
|
11281
|
+
return positions;
|
|
11282
|
+
}
|
|
11283
|
+
function nearestColumnIndex(positions, xPt) {
|
|
11284
|
+
let bestIndex = 0;
|
|
11285
|
+
let bestDistancePt = Number.POSITIVE_INFINITY;
|
|
11286
|
+
positions.forEach((position, index) => {
|
|
11287
|
+
const distancePt = Math.abs(position - xPt);
|
|
11288
|
+
if (distancePt < bestDistancePt) {
|
|
11289
|
+
bestDistancePt = distancePt;
|
|
11290
|
+
bestIndex = index;
|
|
11291
|
+
}
|
|
11292
|
+
});
|
|
11293
|
+
return bestIndex;
|
|
11294
|
+
}
|
|
11295
|
+
const DEFAULT_COLUMN_WIDTH_FALLBACK_PT = 40;
|
|
11296
|
+
function lastColumnWidthPt(groups, columnIndex, anchorXPt) {
|
|
11297
|
+
let maxWidthPt = 0;
|
|
11298
|
+
for (const [key, items] of groups) {
|
|
11299
|
+
const [, columnPart] = key.split(",");
|
|
11300
|
+
if (Number(columnPart) !== columnIndex) continue;
|
|
11301
|
+
for (const item of items) maxWidthPt = Math.max(maxWidthPt, item.xPt + (item.widthPt ?? 0) - anchorXPt);
|
|
11302
|
+
}
|
|
11303
|
+
return maxWidthPt > 0 ? maxWidthPt : DEFAULT_COLUMN_WIDTH_FALLBACK_PT;
|
|
11304
|
+
}
|
|
11305
|
+
function buildGridFromTextClustering(textItems) {
|
|
11306
|
+
const lines = clusterIntoLines(textItems);
|
|
11307
|
+
if (lines.length === 0) return {
|
|
11308
|
+
cells: [],
|
|
11309
|
+
columns: [],
|
|
11310
|
+
rows: [],
|
|
11311
|
+
gridlines: false
|
|
11312
|
+
};
|
|
11313
|
+
const segmentsByLine = lines.map((l) => splitLineByLargeGaps(l));
|
|
11314
|
+
const columnPositions = detectColumnPositions(segmentsByLine);
|
|
11315
|
+
const groups = /* @__PURE__ */ new Map();
|
|
11316
|
+
segmentsByLine.forEach((segments, rowIndex) => {
|
|
11317
|
+
for (const segment of segments) {
|
|
11318
|
+
const key = groupKey(rowIndex, nearestColumnIndex(columnPositions, segment.items[0].xPt));
|
|
11319
|
+
const existing = groups.get(key);
|
|
11320
|
+
if (existing === void 0) groups.set(key, [...segment.items]);
|
|
11321
|
+
else existing.push(...segment.items);
|
|
11322
|
+
}
|
|
11323
|
+
});
|
|
11324
|
+
const nominalRowHeightPt = estimateModalLineSpacing(lines);
|
|
11325
|
+
const rows = lines.map((line, i) => {
|
|
11326
|
+
const nextBaselineY = lines[i + 1]?.baselineY;
|
|
11327
|
+
const heightPt = nextBaselineY !== void 0 ? line.baselineY - nextBaselineY : nominalRowHeightPt;
|
|
11328
|
+
return {
|
|
11329
|
+
index: i,
|
|
11330
|
+
heightPt: heightPt > 0 ? heightPt : nominalRowHeightPt
|
|
11331
|
+
};
|
|
11332
|
+
});
|
|
11333
|
+
const columns = columnPositions.map((position, j) => {
|
|
11334
|
+
const nextPosition = columnPositions[j + 1];
|
|
11335
|
+
return {
|
|
11336
|
+
index: j,
|
|
11337
|
+
widthPt: nextPosition !== void 0 ? nextPosition - position : lastColumnWidthPt(groups, j, position)
|
|
11338
|
+
};
|
|
11339
|
+
});
|
|
11340
|
+
return {
|
|
11341
|
+
cells: buildCellsFromGroups(groups),
|
|
11342
|
+
columns,
|
|
11343
|
+
rows,
|
|
11344
|
+
gridlines: false
|
|
11345
|
+
};
|
|
11346
|
+
}
|
|
11347
|
+
function reconstructSheet(page, pageIndex) {
|
|
11348
|
+
const textItems = page.items.filter((i) => i.kind === "text");
|
|
11349
|
+
const lattice = detectGridLattice(page.items);
|
|
11350
|
+
const grid = lattice !== void 0 ? buildGridFromLattice(textItems, lattice) : buildGridFromTextClustering(textItems);
|
|
11351
|
+
const printSettings = {
|
|
11352
|
+
pageSize: {
|
|
11353
|
+
widthPt: page.widthPt,
|
|
11354
|
+
heightPt: page.heightPt
|
|
11355
|
+
},
|
|
11356
|
+
margins: ZERO_MARGINS,
|
|
11357
|
+
gridlines: grid.gridlines,
|
|
11358
|
+
headers: false,
|
|
11359
|
+
pageOrder: "downThenOver"
|
|
11360
|
+
};
|
|
11361
|
+
return {
|
|
11362
|
+
name: `Sheet${pageIndex + 1}`,
|
|
11363
|
+
cells: grid.cells,
|
|
11364
|
+
columns: grid.columns,
|
|
11365
|
+
rows: grid.rows,
|
|
11366
|
+
images: [],
|
|
11367
|
+
printSettings
|
|
11368
|
+
};
|
|
11369
|
+
}
|
|
11370
|
+
function reconstructSpreadsheet(doc, options) {
|
|
11371
|
+
const signal = options?.signal;
|
|
11372
|
+
const sheets = doc.pages.map((page, index) => {
|
|
11373
|
+
throwIfAborted(signal);
|
|
11374
|
+
return reconstructSheet(page, index);
|
|
11375
|
+
});
|
|
11376
|
+
return {
|
|
11377
|
+
kind: "spreadsheet",
|
|
11378
|
+
formatVersion: 1,
|
|
11379
|
+
metadata: doc.metadata,
|
|
11380
|
+
sheets
|
|
11381
|
+
};
|
|
11382
|
+
}
|
|
10826
11383
|
//#endregion
|
|
10827
11384
|
//#region src/convert/convert.ts
|
|
10828
11385
|
function docxToPdf(bytes, options) {
|
|
@@ -10904,6 +11461,20 @@ function pdfToOdp(bytes, options) {
|
|
|
10904
11461
|
}), { signal: options?.signal });
|
|
10905
11462
|
return encodePackage$2(buildOdpPackage(content));
|
|
10906
11463
|
}
|
|
11464
|
+
function pdfToOdg(bytes, options) {
|
|
11465
|
+
const content = reconstructDrawing(readPdf(bytes, {
|
|
11466
|
+
signal: options?.signal,
|
|
11467
|
+
sink: options?.sink
|
|
11468
|
+
}), { signal: options?.signal });
|
|
11469
|
+
return encodePackage$2(buildOdgPackage(content));
|
|
11470
|
+
}
|
|
11471
|
+
function pdfToOds(bytes, options) {
|
|
11472
|
+
const content = reconstructSpreadsheet(readPdf(bytes, {
|
|
11473
|
+
signal: options?.signal,
|
|
11474
|
+
sink: options?.sink
|
|
11475
|
+
}), { signal: options?.signal });
|
|
11476
|
+
return encodePackage$2(buildOdsPackage(content));
|
|
11477
|
+
}
|
|
10907
11478
|
//#endregion
|
|
10908
11479
|
//#region src/convert/codec.ts
|
|
10909
11480
|
const docxPdfCodec = z.codec(DocxBytesSchema, PdfBytesSchema, {
|
|
@@ -10922,6 +11493,14 @@ const odpPdfCodec = z.codec(OdpBytesSchema, PdfBytesSchema, {
|
|
|
10922
11493
|
decode: (odpBytes) => odpToPdf(odpBytes),
|
|
10923
11494
|
encode: (pdfBytes) => pdfToOdp(pdfBytes)
|
|
10924
11495
|
});
|
|
11496
|
+
const odsPdfCodec = z.codec(OdsBytesSchema, PdfBytesSchema, {
|
|
11497
|
+
decode: (odsBytes) => odsToPdf(odsBytes),
|
|
11498
|
+
encode: (pdfBytes) => pdfToOds(pdfBytes)
|
|
11499
|
+
});
|
|
11500
|
+
const odgPdfCodec = z.codec(OdgBytesSchema, PdfBytesSchema, {
|
|
11501
|
+
decode: (odgBytes) => odgToPdf(odgBytes),
|
|
11502
|
+
encode: (pdfBytes) => pdfToOdg(pdfBytes)
|
|
11503
|
+
});
|
|
10925
11504
|
//#endregion
|
|
10926
11505
|
//#region src/convert/local.ts
|
|
10927
11506
|
const SUPPORTED_CONVERSIONS = [
|
|
@@ -10964,6 +11543,14 @@ const SUPPORTED_CONVERSIONS = [
|
|
|
10964
11543
|
{
|
|
10965
11544
|
source: "pdf",
|
|
10966
11545
|
target: "odp"
|
|
11546
|
+
},
|
|
11547
|
+
{
|
|
11548
|
+
source: "pdf",
|
|
11549
|
+
target: "ods"
|
|
11550
|
+
},
|
|
11551
|
+
{
|
|
11552
|
+
source: "pdf",
|
|
11553
|
+
target: "odg"
|
|
10967
11554
|
}
|
|
10968
11555
|
];
|
|
10969
11556
|
function substitutionDiagnostic(substitution, context) {
|
|
@@ -11119,6 +11706,32 @@ function createLocalDocumentConverter() {
|
|
|
11119
11706
|
diagnostics
|
|
11120
11707
|
});
|
|
11121
11708
|
}
|
|
11709
|
+
if (source.format === "pdf" && targetFormat === "ods") {
|
|
11710
|
+
const bytes = pdfToOds(source.bytes, {
|
|
11711
|
+
signal: options.signal,
|
|
11712
|
+
sink: (d) => diagnostics.push(fromPdfDiagnostic(d))
|
|
11713
|
+
});
|
|
11714
|
+
return Promise.resolve({
|
|
11715
|
+
document: {
|
|
11716
|
+
format: "ods",
|
|
11717
|
+
bytes
|
|
11718
|
+
},
|
|
11719
|
+
diagnostics
|
|
11720
|
+
});
|
|
11721
|
+
}
|
|
11722
|
+
if (source.format === "pdf" && targetFormat === "odg") {
|
|
11723
|
+
const bytes = pdfToOdg(source.bytes, {
|
|
11724
|
+
signal: options.signal,
|
|
11725
|
+
sink: (d) => diagnostics.push(fromPdfDiagnostic(d))
|
|
11726
|
+
});
|
|
11727
|
+
return Promise.resolve({
|
|
11728
|
+
document: {
|
|
11729
|
+
format: "odg",
|
|
11730
|
+
bytes
|
|
11731
|
+
},
|
|
11732
|
+
diagnostics
|
|
11733
|
+
});
|
|
11734
|
+
}
|
|
11122
11735
|
return Promise.reject(/* @__PURE__ */ new Error(`unsupported conversion: ${source.format} -> ${targetFormat}`));
|
|
11123
11736
|
}
|
|
11124
11737
|
};
|
|
@@ -11130,4 +11743,4 @@ function fixedClock(date) {
|
|
|
11130
11743
|
return { now: () => date };
|
|
11131
11744
|
}
|
|
11132
11745
|
//#endregion
|
|
11133
|
-
export { AttributeSchema, BinaryPartSchema, COLOR_BLACK, CONTENT_FORMAT_VERSION, CommentSchema, CompactPackageSchema, CompactPartSchema, CompactXmlNodeSchema, ContentBlockSchema, ContentCellValueSchema, ContentDocumentSchema, ContentDrawPageSchema, ContentImageBlockSchema, ContentPageBreakSchema, ContentParagraphSchema, ContentPathPointSchema, ContentPathSegmentSchema, ContentRunSchema, ContentSectionSchema, ContentShapeSchema, ContentSheetCellSchema, ContentSheetColumnSchema, ContentSheetPrintRangeSchema, ContentSheetPrintSettingsSchema, ContentSheetRepeatRangeSchema, ContentSheetRowSchema, ContentSheetSchema, ContentSlideSchema, ContentStrokeSchema, ContentSubpathSchema, ContentTableCellSchema, ContentTableRowSchema, ContentTableSchema, ContentVectorSchema, DEFAULT_LAYOUT_FONT, DefinedNameSchema, DocxBytesSchema, DocxEditor, DocxParagraph, DocxRun, DocxTable, DocxTableCell, DocxTableRow, LAYOUT_FORMAT_VERSION, NOOP_DIAGNOSTIC_SINK, OdgBoxVector, OdgBytesSchema, OdgEditor, OdgLineVector, OdgPage, OdgPathVector, OdpBytesSchema, OdpEditor, OdpShape, OdpSlide, OdsBytesSchema, OdsCell, OdsEditor, OdsSheet, OdtBytesSchema, OdtEditor, OdtList, OdtListItem, OdtParagraph, OdtRun, OdtTable, OdtTableCell, OdtTableRow, PAGE_SIZE_A4, PAGE_SIZE_LETTER, PackageSchema, PartSchema, PdfBytesSchema, PdfEncryptedError, PdfParseError, PptxBytesSchema, PptxEditor, PptxShape, PptxSlide, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, XmlCdataSchema, XmlCommentSchema, XmlDeclarationSchema, XmlElementSchema, XmlNodeSchema, XmlPartSchema, XmlPiSchema, XmlTextSchema, attr, base64ToBytes, buildDocxPackage, buildOdgPackage, buildOdpPackage, buildOdsPackage, buildOdtPackage, buildPptxPackage, buildXml, bytesToBase64, childrenWithTag, compactCodec, compactPackageCodec, convertDrawingToLayout, convertPresentationToLayout, convertSpreadsheetToLayout, convertWordprocessingToLayout, createDocx, createLocalDocumentConverter, createOdg, createOdp, createOds, createOdt, createPptx, decodeCompactPackage, decodeEntities, decodePackage, docxPdfCodec, docxToPdf, elementsWithTag, encodeCompactPackage, encodePackage, fixedClock, flipY, fromCompact, isCompactXmlNode, isContentBlock, isXmlNode, odgToPdf, odpPdfCodec, odpToPdf, odsToPdf, odtPdfCodec, odtToPdf, openDocx, openOdg, openOdp, openOds, openOdt, openPptx, packageCodec, parsePackage, parseXml, pdfCodec, pdfToDocx, pdfToOdp, pdfToOdt, pdfToPptx, pptxPdfCodec, pptxToPdf, readDocxContent, readOdgContent, readOdpContent, readOdsContent, readOdtContent, readPdf, readPptxContent, reconstructPresentation, reconstructWordprocessing, resolveRelationships, rgbHexToColor, rootElement, serializePackage, systemClock, textContent, throwIfAborted, toCompact, unzipPackage, walk, writePdf, xmlCodec, zipPackage };
|
|
11746
|
+
export { AttributeSchema, BinaryPartSchema, COLOR_BLACK, CONTENT_FORMAT_VERSION, CommentSchema, CompactPackageSchema, CompactPartSchema, CompactXmlNodeSchema, ContentBlockSchema, ContentCellValueSchema, ContentDocumentSchema, ContentDrawPageSchema, ContentImageBlockSchema, ContentPageBreakSchema, ContentParagraphSchema, ContentPathPointSchema, ContentPathSegmentSchema, ContentRunSchema, ContentSectionSchema, ContentShapeSchema, ContentSheetCellSchema, ContentSheetColumnSchema, ContentSheetPrintRangeSchema, ContentSheetPrintSettingsSchema, ContentSheetRepeatRangeSchema, ContentSheetRowSchema, ContentSheetSchema, ContentSlideSchema, ContentStrokeSchema, ContentSubpathSchema, ContentTableCellSchema, ContentTableRowSchema, ContentTableSchema, ContentVectorSchema, DEFAULT_LAYOUT_FONT, DefinedNameSchema, DocxBytesSchema, DocxEditor, DocxParagraph, DocxRun, DocxTable, DocxTableCell, DocxTableRow, LAYOUT_FORMAT_VERSION, NOOP_DIAGNOSTIC_SINK, OdgBoxVector, OdgBytesSchema, OdgEditor, OdgLineVector, OdgPage, OdgPathVector, OdpBytesSchema, OdpEditor, OdpShape, OdpSlide, OdsBytesSchema, OdsCell, OdsEditor, OdsSheet, OdtBytesSchema, OdtEditor, OdtList, OdtListItem, OdtParagraph, OdtRun, OdtTable, OdtTableCell, OdtTableRow, PAGE_SIZE_A4, PAGE_SIZE_LETTER, PackageSchema, PartSchema, PdfBytesSchema, PdfEncryptedError, PdfParseError, PptxBytesSchema, PptxEditor, PptxShape, PptxSlide, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, XmlCdataSchema, XmlCommentSchema, XmlDeclarationSchema, XmlElementSchema, XmlNodeSchema, XmlPartSchema, XmlPiSchema, XmlTextSchema, attr, base64ToBytes, buildDocxPackage, buildOdgPackage, buildOdpPackage, buildOdsPackage, buildOdtPackage, buildPptxPackage, buildXml, bytesToBase64, childrenWithTag, compactCodec, compactPackageCodec, convertDrawingToLayout, convertPresentationToLayout, convertSpreadsheetToLayout, convertWordprocessingToLayout, createDocx, createLocalDocumentConverter, createOdg, createOdp, createOds, createOdt, createPptx, decodeCompactPackage, decodeEntities, decodePackage, docxPdfCodec, docxToPdf, elementsWithTag, encodeCompactPackage, encodePackage, fixedClock, flipY, fromCompact, isCompactXmlNode, isContentBlock, isXmlNode, odgPdfCodec, odgToPdf, odpPdfCodec, odpToPdf, odsPdfCodec, odsToPdf, odtPdfCodec, odtToPdf, openDocx, openOdg, openOdp, openOds, openOdt, openPptx, packageCodec, parsePackage, parseXml, pdfCodec, pdfToDocx, pdfToOdg, pdfToOdp, pdfToOds, pdfToOdt, pdfToPptx, pptxPdfCodec, pptxToPdf, readDocxContent, readOdgContent, readOdpContent, readOdsContent, readOdtContent, readPdf, readPptxContent, reconstructDrawing, reconstructPresentation, reconstructSpreadsheet, reconstructWordprocessing, resolveRelationships, rgbHexToColor, rootElement, serializePackage, systemClock, textContent, throwIfAborted, toCompact, unzipPackage, walk, writePdf, xmlCodec, zipPackage };
|