odf.js 6.2.0 → 6.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -2
- 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-BnzBd5_I.d.cts} +10 -8
- package/dist/{codec-rbZGlr37.d.ts → codec-Dg_HWuH1.d.ts} +10 -8
- package/dist/codec.d.cts +1 -1
- package/dist/codec.d.ts +1 -1
- package/dist/{embedded-UQQNFd5U.js → embedded-BONPxvS3.js} +1 -2
- package/dist/{embedded-BsO-SvtW.cjs → embedded-wrtHCJ68.cjs} +1 -2
- package/dist/index.cjs +20 -1
- package/dist/index.d.cts +12 -10
- package/dist/index.d.ts +12 -10
- package/dist/index.js +9 -7
- package/dist/{list-DwTyo_B2.d.cts → list-Bttwr1mk.d.cts} +7 -1
- package/dist/{list-X_GJY7P3.d.ts → list-vhXd0Jf6.d.ts} +7 -1
- package/dist/metadata-BUzwE_-u.d.ts +10 -0
- package/dist/metadata-CYXgXL_h.d.cts +10 -0
- package/dist/ooo1/read.cjs +1 -1
- package/dist/ooo1/read.js +1 -1
- package/dist/package-io/scaffold.cjs +64 -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 +61 -0
- package/dist/paragraph-BdwsQisB.d.cts +28 -0
- package/dist/paragraph-BoVy1LrN.d.ts +28 -0
- 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-BCjeY90t.d.cts → shapes-BQhXAk0D.d.cts} +1 -1
- package/dist/{shapes-QkOsc-WT.d.ts → shapes-DUzrrf7b.d.ts} +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-CYvFMlP6.d.cts → table-ByhqRnSG.d.cts} +3 -1
- package/dist/{table-DclDgC5h.d.ts → table-DElqGcT0.d.ts} +3 -1
- package/dist/text-B8350HA2.d.ts +17 -0
- package/dist/text-pmlTqzgi.d.cts +17 -0
- package/dist/typed/draw/embedded.cjs +1 -1
- package/dist/typed/draw/embedded.js +1 -1
- package/dist/typed/draw/shapes.d.cts +1 -1
- package/dist/typed/draw/shapes.d.ts +1 -1
- package/dist/typed/odb/form.cjs +1 -1
- package/dist/typed/odb/form.js +1 -1
- package/dist/typed/ods/read.cjs +1 -1
- package/dist/typed/ods/read.js +1 -1
- package/dist/typed/odt/read.cjs +1 -1
- package/dist/typed/odt/read.js +1 -1
- package/dist/typed/odt/write.cjs +409 -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 +406 -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 +49 -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 +48 -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/table.cjs +81 -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/write-7Uu_wlkL.d.cts +13 -0
- package/dist/write-DGcI9W7Z.d.ts +13 -0
- package/package.json +2 -2
- 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/text-Bn3C7lnm.d.ts +0 -10
- package/dist/text-CDUCcwje.d.cts +0 -10
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
];
|
|
19
|
+
const DEFAULT_ODF_VERSION = "1.3";
|
|
20
|
+
function documentPartNodes(rootTag, version, containers) {
|
|
21
|
+
return [{
|
|
22
|
+
type: "declaration",
|
|
23
|
+
attributes: [{
|
|
24
|
+
name: "version",
|
|
25
|
+
value: "1.0"
|
|
26
|
+
}, {
|
|
27
|
+
name: "encoding",
|
|
28
|
+
value: "UTF-8"
|
|
29
|
+
}]
|
|
30
|
+
}, el(rootTag, {
|
|
31
|
+
...xmlnsAttributes(ODF_DOCUMENT_PREFIXES),
|
|
32
|
+
"office:version": encodeXmlText(version)
|
|
33
|
+
}, [...containers])];
|
|
34
|
+
}
|
|
35
|
+
function createOdfPackage(mediaType, bodyElement, version = "1.3") {
|
|
36
|
+
const pkg = { parts: {
|
|
37
|
+
"content.xml": {
|
|
38
|
+
kind: "xml",
|
|
39
|
+
nodes: documentPartNodes("office:document-content", version, [el("office:automatic-styles"), el("office:body", {}, [bodyElement])])
|
|
40
|
+
},
|
|
41
|
+
"styles.xml": {
|
|
42
|
+
kind: "xml",
|
|
43
|
+
nodes: documentPartNodes("office:document-styles", version, [
|
|
44
|
+
el("office:styles"),
|
|
45
|
+
el("office:automatic-styles"),
|
|
46
|
+
el("office:master-styles")
|
|
47
|
+
])
|
|
48
|
+
}
|
|
49
|
+
} };
|
|
50
|
+
writeMimetype(pkg, mediaType);
|
|
51
|
+
return pkg;
|
|
52
|
+
}
|
|
53
|
+
function odfPartContainer(pkg, partPath, containerTag) {
|
|
54
|
+
const part = pkg.parts[partPath];
|
|
55
|
+
if (part?.kind !== "xml") throw new Error(`odfPartContainer: "${partPath}" is not an XML part`);
|
|
56
|
+
const container = part.nodes.find((node) => node.type === "element")?.children.find((node) => node.type === "element" && node.tag === containerTag);
|
|
57
|
+
if (container === void 0) throw new Error(`odfPartContainer: "${partPath}" has no ${containerTag} container`);
|
|
58
|
+
return container;
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
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 { n as OdfListIdState } from "./list-Bttwr1mk.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 { n as OdfListIdState } from "./list-vhXd0Jf6.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 };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { l as XmlElement } from "./node-B6JX5CRX.js";
|
|
1
2
|
import { r as Package } from "./package-otZYrxiO.js";
|
|
2
3
|
import { n as StyleProperties } from "./properties-CJyykyc_.js";
|
|
3
4
|
//#region src/styles/registry.d.ts
|
|
@@ -8,6 +9,7 @@ interface InternRequest {
|
|
|
8
9
|
properties: StyleProperties;
|
|
9
10
|
family: StyleFamily;
|
|
10
11
|
parentStyleName?: string;
|
|
12
|
+
propertyElements?: readonly XmlElement[];
|
|
11
13
|
}
|
|
12
14
|
interface OtherPartRef {
|
|
13
15
|
pkg: Package;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { l as XmlElement } from "./node-B6JX5CRX.cjs";
|
|
1
2
|
import { r as Package } from "./package-DMk9fuTI.cjs";
|
|
2
3
|
import { n as StyleProperties } from "./properties-CiIoNu2h.cjs";
|
|
3
4
|
//#region src/styles/registry.d.ts
|
|
@@ -8,6 +9,7 @@ interface InternRequest {
|
|
|
8
9
|
properties: StyleProperties;
|
|
9
10
|
family: StyleFamily;
|
|
10
11
|
parentStyleName?: string;
|
|
12
|
+
propertyElements?: readonly XmlElement[];
|
|
11
13
|
}
|
|
12
14
|
interface OtherPartRef {
|
|
13
15
|
pkg: Package;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { l as XmlElement } from "./node-B6JX5CRX.cjs";
|
|
2
|
+
import { r as Package } from "./package-DMk9fuTI.cjs";
|
|
3
|
+
//#region src/package-io/scaffold.d.ts
|
|
4
|
+
declare const DEFAULT_ODF_VERSION = "1.3";
|
|
5
|
+
declare function createOdfPackage(mediaType: string, bodyElement: XmlElement, version?: string): Package;
|
|
6
|
+
declare function odfPartContainer(pkg: Package, partPath: string, containerTag: string): XmlElement;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { createOdfPackage as n, odfPartContainer as r, DEFAULT_ODF_VERSION as t };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { l as XmlElement } from "./node-B6JX5CRX.js";
|
|
2
|
+
import { r as Package } from "./package-otZYrxiO.js";
|
|
3
|
+
//#region src/package-io/scaffold.d.ts
|
|
4
|
+
declare const DEFAULT_ODF_VERSION = "1.3";
|
|
5
|
+
declare function createOdfPackage(mediaType: string, bodyElement: XmlElement, version?: string): Package;
|
|
6
|
+
declare function odfPartContainer(pkg: Package, partPath: string, containerTag: string): XmlElement;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { createOdfPackage as n, odfPartContainer as r, DEFAULT_ODF_VERSION as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { d as XmlNode, l as XmlElement } from "./node-B6JX5CRX.cjs";
|
|
2
2
|
import { r as Package } from "./package-DMk9fuTI.cjs";
|
|
3
|
-
import {
|
|
3
|
+
import { n as OdfListIdState } from "./list-Bttwr1mk.cjs";
|
|
4
4
|
import { r as OdfTransformFunction } from "./transform-M1gbHp4j.cjs";
|
|
5
5
|
import { Box, ContentImageBlock, ContentShape, ContentVector } from "document-schema.js";
|
|
6
6
|
//#region src/typed/draw/shapes.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { d as XmlNode, l as XmlElement } from "./node-B6JX5CRX.js";
|
|
2
2
|
import { r as Package } from "./package-otZYrxiO.js";
|
|
3
|
-
import {
|
|
3
|
+
import { n as OdfListIdState } from "./list-vhXd0Jf6.js";
|
|
4
4
|
import { r as OdfTransformFunction } from "./transform-BFNc16LQ.js";
|
|
5
5
|
import { Box, ContentImageBlock, ContentShape, ContentVector } from "document-schema.js";
|
|
6
6
|
//#region src/typed/draw/shapes.d.ts
|
|
@@ -110,7 +110,7 @@ function parseTextProperties(element) {
|
|
|
110
110
|
if (strike === "unknown") hasUnknown = true;
|
|
111
111
|
else if (strike !== void 0) properties.strike = strike;
|
|
112
112
|
const fontFamily = attrs.get(ATTR.fontFamily);
|
|
113
|
-
if (fontFamily !== void 0) properties.fontFamily = fontFamily;
|
|
113
|
+
if (fontFamily !== void 0) properties.fontFamily = require_xml_entities.decodeXmlText(fontFamily);
|
|
114
114
|
const fontSize = attrs.get(ATTR.fontSize);
|
|
115
115
|
if (fontSize !== void 0) {
|
|
116
116
|
const pt = require_typed_shared_units.parseOdfLength(fontSize);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { encodeXmlText } from "../xml/entities.js";
|
|
1
|
+
import { decodeXmlText, encodeXmlText } from "../xml/entities.js";
|
|
2
2
|
import { formatOdfLength, parseOdfLength } from "../typed/shared/units.js";
|
|
3
3
|
import { formatOdfColor, parseOdfColor } from "../typed/shared/color.js";
|
|
4
4
|
import { z } from "zod";
|
|
@@ -109,7 +109,7 @@ function parseTextProperties(element) {
|
|
|
109
109
|
if (strike === "unknown") hasUnknown = true;
|
|
110
110
|
else if (strike !== void 0) properties.strike = strike;
|
|
111
111
|
const fontFamily = attrs.get(ATTR.fontFamily);
|
|
112
|
-
if (fontFamily !== void 0) properties.fontFamily = fontFamily;
|
|
112
|
+
if (fontFamily !== void 0) properties.fontFamily = decodeXmlText(fontFamily);
|
|
113
113
|
const fontSize = attrs.get(ATTR.fontSize);
|
|
114
114
|
if (fontSize !== void 0) {
|
|
115
115
|
const pt = parseOdfLength(fontSize);
|
package/dist/styles/registry.cjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_xml_build = require("../xml/build.cjs");
|
|
2
3
|
const require_xml_fragment = require("../xml/fragment.cjs");
|
|
3
4
|
const require_xml_entities = require("../xml/entities.cjs");
|
|
4
5
|
const require_styles_properties = require("./properties.cjs");
|
|
@@ -87,13 +88,15 @@ function reserveStyleNames(container, reserved) {
|
|
|
87
88
|
}
|
|
88
89
|
const FINGERPRINT_SEPARATOR = "\0";
|
|
89
90
|
const NO_PARENT_SENTINEL = "";
|
|
90
|
-
function computeFingerprint(family, properties, parentStyleName) {
|
|
91
|
+
function computeFingerprint(family, properties, parentStyleName, propertyElements) {
|
|
91
92
|
const parentComponent = parentStyleName ?? NO_PARENT_SENTINEL;
|
|
92
|
-
|
|
93
|
+
const components = [
|
|
93
94
|
family,
|
|
94
95
|
require_styles_serialize.canonicalPropertiesString(properties),
|
|
95
96
|
parentComponent
|
|
96
|
-
]
|
|
97
|
+
];
|
|
98
|
+
if (propertyElements !== void 0 && propertyElements.length > 0) components.push(require_xml_build.buildXml([...propertyElements]));
|
|
99
|
+
return components.join(FINGERPRINT_SEPARATOR);
|
|
97
100
|
}
|
|
98
101
|
var StyleRegistry = class StyleRegistry {
|
|
99
102
|
automaticStyles;
|
|
@@ -134,7 +137,7 @@ var StyleRegistry = class StyleRegistry {
|
|
|
134
137
|
const parsed = require_styles_properties.parseStyleElementProperties(child);
|
|
135
138
|
if (!parsed.hasUnknown) {
|
|
136
139
|
const parentStyleName = attrValue(child, "style:parent-style-name");
|
|
137
|
-
const fingerprint = computeFingerprint(family, parsed.properties, parentStyleName);
|
|
140
|
+
const fingerprint = computeFingerprint(family, parsed.properties, parentStyleName, void 0);
|
|
138
141
|
if (!registry.fingerprintToName.has(fingerprint)) {
|
|
139
142
|
registry.fingerprintToName.set(fingerprint, name);
|
|
140
143
|
registry.nameToFingerprint.set(name, fingerprint);
|
|
@@ -157,7 +160,7 @@ var StyleRegistry = class StyleRegistry {
|
|
|
157
160
|
return registry;
|
|
158
161
|
}
|
|
159
162
|
fingerprint(request) {
|
|
160
|
-
return computeFingerprint(request.family, request.properties, request.parentStyleName);
|
|
163
|
+
return computeFingerprint(request.family, request.properties, request.parentStyleName, request.propertyElements);
|
|
161
164
|
}
|
|
162
165
|
intern(request) {
|
|
163
166
|
const fingerprint = this.fingerprint(request);
|
|
@@ -169,7 +172,7 @@ var StyleRegistry = class StyleRegistry {
|
|
|
169
172
|
"style:family": request.family
|
|
170
173
|
};
|
|
171
174
|
if (request.parentStyleName !== void 0) attributes["style:parent-style-name"] = require_xml_entities.encodeXmlText(request.parentStyleName);
|
|
172
|
-
const styleElement = require_xml_fragment.el("style:style", attributes, require_styles_serialize.buildStylePropertyElements(request.properties));
|
|
175
|
+
const styleElement = require_xml_fragment.el("style:style", attributes, [...require_styles_serialize.buildStylePropertyElements(request.properties), ...request.propertyElements ?? []]);
|
|
173
176
|
this.automaticStyles.children.push(styleElement);
|
|
174
177
|
this.knownStyles.set(name, styleElement);
|
|
175
178
|
this.reservedByFamily[request.family].add(name);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as StyleRegistry, i as StyleFamily, n as OtherPartRef, o as StyleRegistryOptions, r as STYLE_FAMILIES, s as isStyleFamily, t as InternRequest } from "../registry-
|
|
1
|
+
import { a as StyleRegistry, i as StyleFamily, n as OtherPartRef, o as StyleRegistryOptions, r as STYLE_FAMILIES, s as isStyleFamily, t as InternRequest } from "../registry-PoQIRgbY.cjs";
|
|
2
2
|
export { InternRequest, OtherPartRef, STYLE_FAMILIES, StyleFamily, StyleRegistry, StyleRegistryOptions, isStyleFamily };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as StyleRegistry, i as StyleFamily, n as OtherPartRef, o as StyleRegistryOptions, r as STYLE_FAMILIES, s as isStyleFamily, t as InternRequest } from "../registry-
|
|
1
|
+
import { a as StyleRegistry, i as StyleFamily, n as OtherPartRef, o as StyleRegistryOptions, r as STYLE_FAMILIES, s as isStyleFamily, t as InternRequest } from "../registry-C_16-N6i.js";
|
|
2
2
|
export { InternRequest, OtherPartRef, STYLE_FAMILIES, StyleFamily, StyleRegistry, StyleRegistryOptions, isStyleFamily };
|
package/dist/styles/registry.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { buildXml } from "../xml/build.js";
|
|
1
2
|
import { el } from "../xml/fragment.js";
|
|
2
3
|
import { encodeXmlText } from "../xml/entities.js";
|
|
3
4
|
import { parseStyleElementProperties } from "./properties.js";
|
|
@@ -86,13 +87,15 @@ function reserveStyleNames(container, reserved) {
|
|
|
86
87
|
}
|
|
87
88
|
const FINGERPRINT_SEPARATOR = "\0";
|
|
88
89
|
const NO_PARENT_SENTINEL = "";
|
|
89
|
-
function computeFingerprint(family, properties, parentStyleName) {
|
|
90
|
+
function computeFingerprint(family, properties, parentStyleName, propertyElements) {
|
|
90
91
|
const parentComponent = parentStyleName ?? NO_PARENT_SENTINEL;
|
|
91
|
-
|
|
92
|
+
const components = [
|
|
92
93
|
family,
|
|
93
94
|
canonicalPropertiesString(properties),
|
|
94
95
|
parentComponent
|
|
95
|
-
]
|
|
96
|
+
];
|
|
97
|
+
if (propertyElements !== void 0 && propertyElements.length > 0) components.push(buildXml([...propertyElements]));
|
|
98
|
+
return components.join(FINGERPRINT_SEPARATOR);
|
|
96
99
|
}
|
|
97
100
|
var StyleRegistry = class StyleRegistry {
|
|
98
101
|
automaticStyles;
|
|
@@ -133,7 +136,7 @@ var StyleRegistry = class StyleRegistry {
|
|
|
133
136
|
const parsed = parseStyleElementProperties(child);
|
|
134
137
|
if (!parsed.hasUnknown) {
|
|
135
138
|
const parentStyleName = attrValue(child, "style:parent-style-name");
|
|
136
|
-
const fingerprint = computeFingerprint(family, parsed.properties, parentStyleName);
|
|
139
|
+
const fingerprint = computeFingerprint(family, parsed.properties, parentStyleName, void 0);
|
|
137
140
|
if (!registry.fingerprintToName.has(fingerprint)) {
|
|
138
141
|
registry.fingerprintToName.set(fingerprint, name);
|
|
139
142
|
registry.nameToFingerprint.set(name, fingerprint);
|
|
@@ -156,7 +159,7 @@ var StyleRegistry = class StyleRegistry {
|
|
|
156
159
|
return registry;
|
|
157
160
|
}
|
|
158
161
|
fingerprint(request) {
|
|
159
|
-
return computeFingerprint(request.family, request.properties, request.parentStyleName);
|
|
162
|
+
return computeFingerprint(request.family, request.properties, request.parentStyleName, request.propertyElements);
|
|
160
163
|
}
|
|
161
164
|
intern(request) {
|
|
162
165
|
const fingerprint = this.fingerprint(request);
|
|
@@ -168,7 +171,7 @@ var StyleRegistry = class StyleRegistry {
|
|
|
168
171
|
"style:family": request.family
|
|
169
172
|
};
|
|
170
173
|
if (request.parentStyleName !== void 0) attributes["style:parent-style-name"] = encodeXmlText(request.parentStyleName);
|
|
171
|
-
const styleElement = el("style:style", attributes, buildStylePropertyElements(request.properties));
|
|
174
|
+
const styleElement = el("style:style", attributes, [...buildStylePropertyElements(request.properties), ...request.propertyElements ?? []]);
|
|
172
175
|
this.automaticStyles.children.push(styleElement);
|
|
173
176
|
this.knownStyles.set(name, styleElement);
|
|
174
177
|
this.reservedByFamily[request.family].add(name);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { l as XmlElement } from "./node-B6JX5CRX.cjs";
|
|
2
2
|
import { r as Package } from "./package-DMk9fuTI.cjs";
|
|
3
|
+
import { a as StyleRegistry } from "./registry-PoQIRgbY.cjs";
|
|
3
4
|
import { Alignment, Color, ContentCellBorders, ContentTable } from "document-schema.js";
|
|
4
5
|
//#region src/typed/shared/table.d.ts
|
|
5
6
|
interface CellStyleDecoration {
|
|
@@ -9,6 +10,7 @@ interface CellStyleDecoration {
|
|
|
9
10
|
verticalAlignment?: "top" | "middle" | "bottom";
|
|
10
11
|
}
|
|
11
12
|
declare function readCellStyleDecoration(elements: readonly XmlElement[]): CellStyleDecoration;
|
|
13
|
+
declare function writeOdfTable(table: ContentTable, registry: StyleRegistry, tableName: string): XmlElement;
|
|
12
14
|
declare function readOdfTable(tableElement: XmlElement, pkg: Package): ContentTable;
|
|
13
15
|
//#endregion
|
|
14
|
-
export { readCellStyleDecoration as n, readOdfTable as r, CellStyleDecoration as t };
|
|
16
|
+
export { writeOdfTable as i, readCellStyleDecoration as n, readOdfTable as r, CellStyleDecoration as t };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { l as XmlElement } from "./node-B6JX5CRX.js";
|
|
2
2
|
import { r as Package } from "./package-otZYrxiO.js";
|
|
3
|
+
import { a as StyleRegistry } from "./registry-C_16-N6i.js";
|
|
3
4
|
import { Alignment, Color, ContentCellBorders, ContentTable } from "document-schema.js";
|
|
4
5
|
//#region src/typed/shared/table.d.ts
|
|
5
6
|
interface CellStyleDecoration {
|
|
@@ -9,6 +10,7 @@ interface CellStyleDecoration {
|
|
|
9
10
|
verticalAlignment?: "top" | "middle" | "bottom";
|
|
10
11
|
}
|
|
11
12
|
declare function readCellStyleDecoration(elements: readonly XmlElement[]): CellStyleDecoration;
|
|
13
|
+
declare function writeOdfTable(table: ContentTable, registry: StyleRegistry, tableName: string): XmlElement;
|
|
12
14
|
declare function readOdfTable(tableElement: XmlElement, pkg: Package): ContentTable;
|
|
13
15
|
//#endregion
|
|
14
|
-
export { readCellStyleDecoration as n, readOdfTable as r, CellStyleDecoration as t };
|
|
16
|
+
export { writeOdfTable as i, readCellStyleDecoration as n, readOdfTable as r, CellStyleDecoration as t };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { d as XmlNode, l as XmlElement } from "./node-B6JX5CRX.js";
|
|
2
|
+
//#region src/typed/shared/text.d.ts
|
|
3
|
+
declare const ODF_FIELD_TAGS: ReadonlySet<string>;
|
|
4
|
+
declare function isOdfFieldElement(element: XmlElement): boolean;
|
|
5
|
+
declare function getOdfSpaceCount(element: XmlElement): number;
|
|
6
|
+
declare function measureOdfNodeLength(node: XmlNode): number;
|
|
7
|
+
declare function sumOdfNodeLength(nodes: readonly XmlNode[]): number;
|
|
8
|
+
declare function decodeOdfText(container: XmlElement): string;
|
|
9
|
+
type OdfTextSegmentKind = "text" | "space" | "tab" | "lineBreak";
|
|
10
|
+
interface OdfTextSegment {
|
|
11
|
+
readonly kind: OdfTextSegmentKind;
|
|
12
|
+
readonly text: string;
|
|
13
|
+
}
|
|
14
|
+
declare function segmentOdfText(text: string, protectLeading: boolean, protectTrailing: boolean): OdfTextSegment[];
|
|
15
|
+
declare function buildOdfInlineNodes(segments: readonly OdfTextSegment[]): XmlNode[];
|
|
16
|
+
//#endregion
|
|
17
|
+
export { decodeOdfText as a, measureOdfNodeLength as c, buildOdfInlineNodes as i, segmentOdfText as l, OdfTextSegment as n, getOdfSpaceCount as o, OdfTextSegmentKind as r, isOdfFieldElement as s, ODF_FIELD_TAGS as t, sumOdfNodeLength as u };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { d as XmlNode, l as XmlElement } from "./node-B6JX5CRX.cjs";
|
|
2
|
+
//#region src/typed/shared/text.d.ts
|
|
3
|
+
declare const ODF_FIELD_TAGS: ReadonlySet<string>;
|
|
4
|
+
declare function isOdfFieldElement(element: XmlElement): boolean;
|
|
5
|
+
declare function getOdfSpaceCount(element: XmlElement): number;
|
|
6
|
+
declare function measureOdfNodeLength(node: XmlNode): number;
|
|
7
|
+
declare function sumOdfNodeLength(nodes: readonly XmlNode[]): number;
|
|
8
|
+
declare function decodeOdfText(container: XmlElement): string;
|
|
9
|
+
type OdfTextSegmentKind = "text" | "space" | "tab" | "lineBreak";
|
|
10
|
+
interface OdfTextSegment {
|
|
11
|
+
readonly kind: OdfTextSegmentKind;
|
|
12
|
+
readonly text: string;
|
|
13
|
+
}
|
|
14
|
+
declare function segmentOdfText(text: string, protectLeading: boolean, protectTrailing: boolean): OdfTextSegment[];
|
|
15
|
+
declare function buildOdfInlineNodes(segments: readonly OdfTextSegment[]): XmlNode[];
|
|
16
|
+
//#endregion
|
|
17
|
+
export { decodeOdfText as a, measureOdfNodeLength as c, buildOdfInlineNodes as i, segmentOdfText as l, OdfTextSegment as n, getOdfSpaceCount as o, OdfTextSegmentKind as r, isOdfFieldElement as s, ODF_FIELD_TAGS as t, sumOdfNodeLength as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_embedded = require("../../embedded-
|
|
2
|
+
const require_embedded = require("../../embedded-wrtHCJ68.cjs");
|
|
3
3
|
exports.readDrawObjectReference = require_embedded.readDrawObjectReference;
|
|
4
4
|
exports.readEmbeddedObjectDocument = require_embedded.readEmbeddedObjectDocument;
|
|
5
5
|
exports.readOdfChartContent = require_embedded.readOdfChartContent;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as readEmbeddedObjectDocument, r as readOdfChartContent, t as readDrawObjectReference } from "../../embedded-
|
|
1
|
+
import { n as readEmbeddedObjectDocument, r as readOdfChartContent, t as readDrawObjectReference } from "../../embedded-BONPxvS3.js";
|
|
2
2
|
export { readDrawObjectReference, readEmbeddedObjectDocument, readOdfChartContent };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as walkDrawShapes, i as readDrawPageContent, n as readDrawFrame, r as readDrawImageBlock, t as DrawPageContent } from "../../shapes-
|
|
1
|
+
import { a as walkDrawShapes, i as readDrawPageContent, n as readDrawFrame, r as readDrawImageBlock, t as DrawPageContent } from "../../shapes-BQhXAk0D.cjs";
|
|
2
2
|
export { DrawPageContent, readDrawFrame, readDrawImageBlock, readDrawPageContent, walkDrawShapes };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as walkDrawShapes, i as readDrawPageContent, n as readDrawFrame, r as readDrawImageBlock, t as DrawPageContent } from "../../shapes-
|
|
1
|
+
import { a as walkDrawShapes, i as readDrawPageContent, n as readDrawFrame, r as readDrawImageBlock, t as DrawPageContent } from "../../shapes-DUzrrf7b.js";
|
|
2
2
|
export { DrawPageContent, readDrawFrame, readDrawImageBlock, readDrawPageContent, walkDrawShapes };
|
package/dist/typed/odb/form.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_xml_query = require("../../xml/query.cjs");
|
|
3
3
|
const require_typed_odb_subdocument = require("./subdocument.cjs");
|
|
4
|
-
const require_embedded = require("../../embedded-
|
|
4
|
+
const require_embedded = require("../../embedded-wrtHCJ68.cjs");
|
|
5
5
|
const require_typed_shared_forms = require("../shared/forms.cjs");
|
|
6
6
|
const require_typed_odb_read = require("./read.cjs");
|
|
7
7
|
//#region src/typed/odb/form.ts
|
package/dist/typed/odb/form.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { findChildElement, rootElement } from "../../xml/query.js";
|
|
2
2
|
import { subDocumentPackage } from "./subdocument.js";
|
|
3
|
-
import { a as readOdtContent } from "../../embedded-
|
|
3
|
+
import { a as readOdtContent } from "../../embedded-BONPxvS3.js";
|
|
4
4
|
import { readOdfFormDefinitions } from "../shared/forms.js";
|
|
5
5
|
import { resolveOdbComponent } from "./read.js";
|
|
6
6
|
//#region src/typed/odb/form.ts
|
package/dist/typed/ods/read.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_embedded = require("../../embedded-
|
|
2
|
+
const require_embedded = require("../../embedded-wrtHCJ68.cjs");
|
|
3
3
|
exports.readOds = require_embedded.readOds;
|
|
4
4
|
exports.readOdsContent = require_embedded.readOdsContent;
|
package/dist/typed/ods/read.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { o as readOds, s as readOdsContent } from "../../embedded-
|
|
1
|
+
import { o as readOds, s as readOdsContent } from "../../embedded-BONPxvS3.js";
|
|
2
2
|
export { readOds, readOdsContent };
|
package/dist/typed/odt/read.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_embedded = require("../../embedded-
|
|
2
|
+
const require_embedded = require("../../embedded-wrtHCJ68.cjs");
|
|
3
3
|
exports.readOdt = require_embedded.readOdt;
|
|
4
4
|
exports.readOdtContent = require_embedded.readOdtContent;
|
package/dist/typed/odt/read.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as readOdtContent, i as readOdt } from "../../embedded-
|
|
1
|
+
import { a as readOdtContent, i as readOdt } from "../../embedded-BONPxvS3.js";
|
|
2
2
|
export { readOdt, readOdtContent };
|