odf.js 3.0.2 → 4.0.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/dist/{codec-C0HcLUmU.d.ts → codec-FXnmhe15.d.ts} +2 -1
- package/dist/{codec-C7qDBOTn.d.cts → codec-m4zK5kxz.d.cts} +2 -1
- package/dist/codec.d.cts +1 -1
- package/dist/codec.d.ts +1 -1
- package/dist/index.cjs +4 -0
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +2 -1
- package/dist/list-C35tiDYU.d.cts +13 -0
- package/dist/list-acGU0xLo.d.ts +13 -0
- package/dist/{shapes-BJAtBY24.d.ts → shapes-BB59aIC8.d.ts} +3 -2
- package/dist/{shapes-CHc96HKu.d.cts → shapes-BqcccDK8.d.cts} +3 -2
- package/dist/typed/draw/shapes.cjs +22 -7
- package/dist/typed/draw/shapes.d.cts +1 -1
- package/dist/typed/draw/shapes.d.ts +1 -1
- package/dist/typed/draw/shapes.js +22 -7
- package/dist/typed/formula/read.cjs +0 -2
- package/dist/typed/formula/read.js +0 -2
- package/dist/typed/odp/read.cjs +4 -3
- package/dist/typed/odp/read.js +4 -3
- package/dist/typed/ods/read.cjs +0 -4
- package/dist/typed/ods/read.js +1 -5
- package/dist/typed/odt/read.cjs +6 -40
- package/dist/typed/odt/read.js +6 -40
- package/dist/typed/shared/list.cjs +50 -0
- package/dist/typed/shared/list.d.cts +2 -0
- package/dist/typed/shared/list.d.ts +2 -0
- package/dist/typed/shared/list.js +47 -0
- package/package.json +2 -2
|
@@ -18,11 +18,12 @@ import "./text-CkNojpZm.js";
|
|
|
18
18
|
import "./cascade-8u4q16_U.js";
|
|
19
19
|
import "./metadata-32LoP2TK.js";
|
|
20
20
|
import "./paragraph-DWNnedIE.js";
|
|
21
|
+
import "./list-acGU0xLo.js";
|
|
21
22
|
import "./table-D81TZyBn.js";
|
|
22
23
|
import "./transform-C7GrZZdR.js";
|
|
23
24
|
import "./masterpage-7nBnqFj-.js";
|
|
24
25
|
import "./path-DE7wkIcz.js";
|
|
25
|
-
import "./shapes-
|
|
26
|
+
import "./shapes-BB59aIC8.js";
|
|
26
27
|
import "./embedded-CNMqOrnt.js";
|
|
27
28
|
import "./read-CxdHrV1m.js";
|
|
28
29
|
import "./read-Dn9qyBBs.js";
|
|
@@ -18,11 +18,12 @@ import "./text-Cal14ZaX.cjs";
|
|
|
18
18
|
import "./cascade-qYa3mgnE.cjs";
|
|
19
19
|
import "./metadata-frJqeeSB.cjs";
|
|
20
20
|
import "./paragraph-9ii2naJC.cjs";
|
|
21
|
+
import "./list-C35tiDYU.cjs";
|
|
21
22
|
import "./table-sweV3r9n.cjs";
|
|
22
23
|
import "./transform-DKEjydnm.cjs";
|
|
23
24
|
import "./masterpage-EmefIRgy.cjs";
|
|
24
25
|
import "./path-DE7wkIcz.cjs";
|
|
25
|
-
import "./shapes-
|
|
26
|
+
import "./shapes-BqcccDK8.cjs";
|
|
26
27
|
import "./embedded-D7Kr1Sce.cjs";
|
|
27
28
|
import "./read-Bd16x8VD.cjs";
|
|
28
29
|
import "./read-BKS_zlGG.cjs";
|
package/dist/codec.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as xmlCodec, n as encodePackage, r as packageCodec, t as decodePackage } from "./codec-
|
|
1
|
+
import { i as xmlCodec, n as encodePackage, r as packageCodec, t as decodePackage } from "./codec-m4zK5kxz.cjs";
|
|
2
2
|
export { decodePackage, encodePackage, packageCodec, xmlCodec };
|
package/dist/codec.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as xmlCodec, n as encodePackage, r as packageCodec, t as decodePackage } from "./codec-
|
|
1
|
+
import { i as xmlCodec, n as encodePackage, r as packageCodec, t as decodePackage } from "./codec-FXnmhe15.js";
|
|
2
2
|
export { decodePackage, encodePackage, packageCodec, xmlCodec };
|
package/dist/index.cjs
CHANGED
|
@@ -28,6 +28,7 @@ const require_typed_shared_geometry = require("./typed/shared/geometry.cjs");
|
|
|
28
28
|
const require_typed_shared_cascade = require("./typed/shared/cascade.cjs");
|
|
29
29
|
const require_typed_shared_metadata = require("./typed/shared/metadata.cjs");
|
|
30
30
|
const require_typed_shared_paragraph = require("./typed/shared/paragraph.cjs");
|
|
31
|
+
const require_typed_shared_list = require("./typed/shared/list.cjs");
|
|
31
32
|
const require_typed_shared_table = require("./typed/shared/table.cjs");
|
|
32
33
|
const require_typed_shared_transform = require("./typed/shared/transform.cjs");
|
|
33
34
|
const require_typed_shared_masterpage = require("./typed/shared/masterpage.cjs");
|
|
@@ -108,6 +109,7 @@ exports.isStyleFamily = require_styles_registry.isStyleFamily;
|
|
|
108
109
|
exports.isXmlNode = require_model_node.isXmlNode;
|
|
109
110
|
exports.measureOdfNodeLength = require_typed_shared_text.measureOdfNodeLength;
|
|
110
111
|
exports.mediaTypeForExtension = require_media_type.mediaTypeForExtension;
|
|
112
|
+
exports.mintOdfListNumId = require_typed_shared_list.mintOdfListNumId;
|
|
111
113
|
exports.netRotationDeg = require_typed_shared_transform.netRotationDeg;
|
|
112
114
|
exports.packageCodec = require_codec.packageCodec;
|
|
113
115
|
exports.paragraphPropertiesToAttributes = require_styles_properties.paragraphPropertiesToAttributes;
|
|
@@ -140,6 +142,7 @@ exports.readOdbInventory = require_typed_odb_read.readOdbInventory;
|
|
|
140
142
|
exports.readOdbReport = require_typed_odb_report.readOdbReport;
|
|
141
143
|
exports.readOdfFormula = require_typed_formula_read.readOdfFormula;
|
|
142
144
|
exports.readOdfFormulaDocument = require_typed_formula_read.readOdfFormulaDocument;
|
|
145
|
+
exports.readOdfListParagraphs = require_typed_shared_list.readOdfListParagraphs;
|
|
143
146
|
exports.readOdfMetadata = require_typed_shared_metadata.readOdfMetadata;
|
|
144
147
|
exports.readOdfParagraph = require_typed_shared_paragraph.readOdfParagraph;
|
|
145
148
|
exports.readOdfTable = require_typed_shared_table.readOdfTable;
|
|
@@ -150,6 +153,7 @@ exports.readOds = require_typed_ods_read.readOds;
|
|
|
150
153
|
exports.readOdt = require_typed_odt_read.readOdt;
|
|
151
154
|
exports.resolveDrawPageSize = require_typed_shared_masterpage.resolveDrawPageSize;
|
|
152
155
|
exports.resolveOdbComponent = require_typed_odb_read.resolveOdbComponent;
|
|
156
|
+
exports.resolveOdfListKind = require_typed_shared_list.resolveOdfListKind;
|
|
153
157
|
exports.resolveOdfShapeGeometry = require_typed_shared_transform.resolveOdfShapeGeometry;
|
|
154
158
|
exports.resolvePageLayoutProperties = require_typed_shared_masterpage.resolvePageLayoutProperties;
|
|
155
159
|
exports.resolveStyle = require_typed_shared_cascade.resolveStyle;
|
package/dist/index.d.cts
CHANGED
|
@@ -26,11 +26,12 @@ import { i as sumOdfNodeLength, n as getOdfSpaceCount, r as measureOdfNodeLength
|
|
|
26
26
|
import { a as resolveStyle, i as findStyleElement, n as StyleCascadeResult, o as resolveStyleElementChain, r as StyleElementChainResult, t as CascadeDiagnostic } from "./cascade-qYa3mgnE.cjs";
|
|
27
27
|
import { n as readOdfMetadata, t as META_PART } from "./metadata-frJqeeSB.cjs";
|
|
28
28
|
import { t as readOdfParagraph } from "./paragraph-9ii2naJC.cjs";
|
|
29
|
+
import { a as resolveOdfListKind, i as readOdfListParagraphs, n as OdfListParagraphReader, r as mintOdfListNumId, t as OdfListIdState } from "./list-C35tiDYU.cjs";
|
|
29
30
|
import { r as readOdfTable } from "./table-sweV3r9n.cjs";
|
|
30
31
|
import { a as composeOdfGroupTransform, c as resolveOdfShapeGeometry, i as applyOdfTransform, n as OdfShapeGeometry, o as netRotationDeg, r as OdfTransformFunction, s as parseOdfTransform, t as OdfPoint } from "./transform-DKEjydnm.cjs";
|
|
31
32
|
import { n as resolvePageLayoutProperties, t as resolveDrawPageSize } from "./masterpage-EmefIRgy.cjs";
|
|
32
33
|
import { a as buildOdfSubpaths, c as parseOdfViewBox, i as OdfViewBox, l as rawSubpathFromPoints, n as OdfRawSegment, o as parseOdfPathData, r as OdfRawSubpath, s as parseOdfPointsList, t as OdfRawPoint, u as scaleOdfRawPoint } from "./path-DE7wkIcz.cjs";
|
|
33
|
-
import { a as walkDrawShapes, i as readDrawPageContent, n as readDrawFrame, r as readDrawImageBlock, t as DrawPageContent } from "./shapes-
|
|
34
|
+
import { a as walkDrawShapes, i as readDrawPageContent, n as readDrawFrame, r as readDrawImageBlock, t as DrawPageContent } from "./shapes-BqcccDK8.cjs";
|
|
34
35
|
import { n as EmbeddedDrawObject, r as readDrawObjectReference, t as EmbeddedDocumentKind } from "./embedded-D7Kr1Sce.cjs";
|
|
35
36
|
import { n as readOdp, t as OdpDocument } from "./read-Bd16x8VD.cjs";
|
|
36
37
|
import { n as readOdt, t as OdtDocument } from "./read-BKS_zlGG.cjs";
|
|
@@ -42,5 +43,5 @@ import { a as readOdbInventory, i as OdbQueryInfo, n as OdbConnectionInfo, o as
|
|
|
42
43
|
import { n as subDocumentPackage, t as SubDocumentPackageOptions } from "./subdocument-CIxH3a5V.cjs";
|
|
43
44
|
import { i as readOdbForm, n as OdbFormControl, r as OdbFormDefinition, t as OdbForm } from "./form-BC-wb1M2.cjs";
|
|
44
45
|
import { a as OdbReportGroup, i as OdbReportFunction, n as OdbReportBand, o as readOdbReport, r as OdbReportElement, t as OdbReport } from "./report-BuCJ7_YU.cjs";
|
|
45
|
-
import { a as Alignment, i as xmlCodec, n as encodePackage, o as AlignmentSchema, r as packageCodec, t as decodePackage } from "./codec-
|
|
46
|
-
export { type Alignment, AlignmentSchema, type Attribute, AttributeSchema, type BinaryPart, BinaryPartSchema, type BuildManifestOptions, type CascadeDiagnostic, type DrawPageContent, type EmbeddedDocumentKind, type EmbeddedDrawObject, type ImageFormat, type InternRequest, type LengthUnit, MANIFEST_PART, META_PART, MIMETYPE_PART, type Manifest, type ManifestEntry, ManifestEntrySchema, type ManifestProblem, ManifestProblemSchema, ManifestSchema, ODF_MEDIA_TYPES, ODF_NAMESPACES, type OdbComponentInfo, type OdbConnectionInfo, type OdbForm, type OdbFormControl, type OdbFormDefinition, type OdbInventory, type OdbQueryInfo, type OdbReport, type OdbReportBand, type OdbReportElement, type OdbReportFunction, type OdbReportGroup, type OdfExtension, type OdfFormulaDocument, type OdfNamespacePrefix, type OdfPoint, type OdfRawPoint, type OdfRawSegment, type OdfRawSubpath, type OdfShapeGeometry, type OdfTransformFunction, type OdfViewBox, type OdgDocument, type OdmDocument, type OdmSection, type OdpDocument, type OdsDocument, type OdtDocument, type OtherPartRef, type Package, PackageSchema, type ParsedProperties, type Part, PartSchema, STYLE_FAMILIES, type StyleCascadeResult, type StyleElementChainResult, type StyleFamily, type StyleProperties, StylePropertiesSchema, StyleRegistry, type StyleRegistryOptions, type SubDocumentPackageOptions, TableCursor, type XmlCdata, XmlCdataSchema, type XmlComment, XmlCommentSchema, type XmlDeclaration, XmlDeclarationSchema, type XmlElement, XmlElementSchema, type XmlNode, XmlNodeSchema, type XmlPart, XmlPartSchema, type XmlPi, XmlPiSchema, type XmlText, XmlTextSchema, type ZipEntry, applyOdfTransform, attrValue, base64ToBytes, buildManifest, buildOdfSubpaths, buildStylePropertyElements, buildXml, bytesToBase64, canonicalPropertiesString, cellReference, childrenWithTag, columnIndexToLetters, columnLettersToIndex, composeOdfGroupTransform, decodeOdfText, decodePackage, decodeXmlText, el, elementsWithTag, encodePackage, encodeXmlText, ensureSpan, findChildElement, findStyleElement, formatOdfColor, formatOdfLength, formatPercentageMultiplier, formatPt, getOdfSpaceCount, isStyleFamily, isXmlNode, measureOdfNodeLength, mediaTypeForExtension, netRotationDeg, packageCodec, paragraphPropertiesToAttributes, parseBox, parseCellReference, parseOdfLength as parseLength, parseOdfLength, parseLinePoints, parseMargins, parseOdfColor, parseOdfPathData, parseOdfPointsList, parseOdfTransform, parseOdfViewBox, parsePackage, parsePageSize, parseParagraphProperties, parseStyleElementProperties, parseTextProperties, parseXml, rawSubpathFromPoints, readDrawFrame, readDrawImageBlock, readDrawObjectReference, readDrawPageContent, readManifest, readMimetype, readOdbForm, readOdbInventory, readOdbReport, readOdfFormula, readOdfFormulaDocument, readOdfMetadata, readOdfParagraph, readOdfTable, readOdg, readOdm, readOdp, readOds, readOdt, resolveDrawPageSize, resolveOdbComponent, resolveOdfShapeGeometry, resolvePageLayoutProperties, resolveStyle, resolveStyleElementChain, rootElement, scaleOdfRawPoint, serializePackage, setDocumentMediaType, sniffImageFormat, subDocumentPackage, sumOdfNodeLength, syncManifest, textPropertiesToAttributes, txt, unzipPackage, validateManifest, walkDrawShapes, writeManifest, writeMimetype, xmlCodec, xmlnsAttributes, zipPackage };
|
|
46
|
+
import { a as Alignment, i as xmlCodec, n as encodePackage, o as AlignmentSchema, r as packageCodec, t as decodePackage } from "./codec-m4zK5kxz.cjs";
|
|
47
|
+
export { type Alignment, AlignmentSchema, type Attribute, AttributeSchema, type BinaryPart, BinaryPartSchema, type BuildManifestOptions, type CascadeDiagnostic, type DrawPageContent, type EmbeddedDocumentKind, type EmbeddedDrawObject, type ImageFormat, type InternRequest, type LengthUnit, MANIFEST_PART, META_PART, MIMETYPE_PART, type Manifest, type ManifestEntry, ManifestEntrySchema, type ManifestProblem, ManifestProblemSchema, ManifestSchema, ODF_MEDIA_TYPES, ODF_NAMESPACES, type OdbComponentInfo, type OdbConnectionInfo, type OdbForm, type OdbFormControl, type OdbFormDefinition, type OdbInventory, type OdbQueryInfo, type OdbReport, type OdbReportBand, type OdbReportElement, type OdbReportFunction, type OdbReportGroup, type OdfExtension, type OdfFormulaDocument, type OdfListIdState, type OdfListParagraphReader, type OdfNamespacePrefix, type OdfPoint, type OdfRawPoint, type OdfRawSegment, type OdfRawSubpath, type OdfShapeGeometry, type OdfTransformFunction, type OdfViewBox, type OdgDocument, type OdmDocument, type OdmSection, type OdpDocument, type OdsDocument, type OdtDocument, type OtherPartRef, type Package, PackageSchema, type ParsedProperties, type Part, PartSchema, STYLE_FAMILIES, type StyleCascadeResult, type StyleElementChainResult, type StyleFamily, type StyleProperties, StylePropertiesSchema, StyleRegistry, type StyleRegistryOptions, type SubDocumentPackageOptions, TableCursor, type XmlCdata, XmlCdataSchema, type XmlComment, XmlCommentSchema, type XmlDeclaration, XmlDeclarationSchema, type XmlElement, XmlElementSchema, type XmlNode, XmlNodeSchema, type XmlPart, XmlPartSchema, type XmlPi, XmlPiSchema, type XmlText, XmlTextSchema, type ZipEntry, applyOdfTransform, attrValue, base64ToBytes, buildManifest, buildOdfSubpaths, buildStylePropertyElements, buildXml, bytesToBase64, canonicalPropertiesString, cellReference, childrenWithTag, columnIndexToLetters, columnLettersToIndex, composeOdfGroupTransform, decodeOdfText, decodePackage, decodeXmlText, el, elementsWithTag, encodePackage, encodeXmlText, ensureSpan, findChildElement, findStyleElement, formatOdfColor, formatOdfLength, formatPercentageMultiplier, formatPt, getOdfSpaceCount, isStyleFamily, isXmlNode, measureOdfNodeLength, mediaTypeForExtension, mintOdfListNumId, netRotationDeg, packageCodec, paragraphPropertiesToAttributes, parseBox, parseCellReference, parseOdfLength as parseLength, parseOdfLength, parseLinePoints, parseMargins, parseOdfColor, parseOdfPathData, parseOdfPointsList, parseOdfTransform, parseOdfViewBox, parsePackage, parsePageSize, parseParagraphProperties, parseStyleElementProperties, parseTextProperties, parseXml, rawSubpathFromPoints, readDrawFrame, readDrawImageBlock, readDrawObjectReference, readDrawPageContent, readManifest, readMimetype, readOdbForm, readOdbInventory, readOdbReport, readOdfFormula, readOdfFormulaDocument, readOdfListParagraphs, readOdfMetadata, readOdfParagraph, readOdfTable, readOdg, readOdm, readOdp, readOds, readOdt, resolveDrawPageSize, resolveOdbComponent, resolveOdfListKind, resolveOdfShapeGeometry, resolvePageLayoutProperties, resolveStyle, resolveStyleElementChain, rootElement, scaleOdfRawPoint, serializePackage, setDocumentMediaType, sniffImageFormat, subDocumentPackage, sumOdfNodeLength, syncManifest, textPropertiesToAttributes, txt, unzipPackage, validateManifest, walkDrawShapes, writeManifest, writeMimetype, xmlCodec, xmlnsAttributes, zipPackage };
|
package/dist/index.d.ts
CHANGED
|
@@ -26,11 +26,12 @@ import { i as sumOdfNodeLength, n as getOdfSpaceCount, r as measureOdfNodeLength
|
|
|
26
26
|
import { a as resolveStyle, i as findStyleElement, n as StyleCascadeResult, o as resolveStyleElementChain, r as StyleElementChainResult, t as CascadeDiagnostic } from "./cascade-8u4q16_U.js";
|
|
27
27
|
import { n as readOdfMetadata, t as META_PART } from "./metadata-32LoP2TK.js";
|
|
28
28
|
import { t as readOdfParagraph } from "./paragraph-DWNnedIE.js";
|
|
29
|
+
import { a as resolveOdfListKind, i as readOdfListParagraphs, n as OdfListParagraphReader, r as mintOdfListNumId, t as OdfListIdState } from "./list-acGU0xLo.js";
|
|
29
30
|
import { r as readOdfTable } from "./table-D81TZyBn.js";
|
|
30
31
|
import { a as composeOdfGroupTransform, c as resolveOdfShapeGeometry, i as applyOdfTransform, n as OdfShapeGeometry, o as netRotationDeg, r as OdfTransformFunction, s as parseOdfTransform, t as OdfPoint } from "./transform-C7GrZZdR.js";
|
|
31
32
|
import { n as resolvePageLayoutProperties, t as resolveDrawPageSize } from "./masterpage-7nBnqFj-.js";
|
|
32
33
|
import { a as buildOdfSubpaths, c as parseOdfViewBox, i as OdfViewBox, l as rawSubpathFromPoints, n as OdfRawSegment, o as parseOdfPathData, r as OdfRawSubpath, s as parseOdfPointsList, t as OdfRawPoint, u as scaleOdfRawPoint } from "./path-DE7wkIcz.js";
|
|
33
|
-
import { a as walkDrawShapes, i as readDrawPageContent, n as readDrawFrame, r as readDrawImageBlock, t as DrawPageContent } from "./shapes-
|
|
34
|
+
import { a as walkDrawShapes, i as readDrawPageContent, n as readDrawFrame, r as readDrawImageBlock, t as DrawPageContent } from "./shapes-BB59aIC8.js";
|
|
34
35
|
import { n as EmbeddedDrawObject, r as readDrawObjectReference, t as EmbeddedDocumentKind } from "./embedded-CNMqOrnt.js";
|
|
35
36
|
import { n as readOdp, t as OdpDocument } from "./read-CxdHrV1m.js";
|
|
36
37
|
import { n as readOdt, t as OdtDocument } from "./read-Dn9qyBBs.js";
|
|
@@ -42,5 +43,5 @@ import { a as readOdbInventory, i as OdbQueryInfo, n as OdbConnectionInfo, o as
|
|
|
42
43
|
import { n as subDocumentPackage, t as SubDocumentPackageOptions } from "./subdocument-DQNQF7wV.js";
|
|
43
44
|
import { i as readOdbForm, n as OdbFormControl, r as OdbFormDefinition, t as OdbForm } from "./form-DcGOX5RW.js";
|
|
44
45
|
import { a as OdbReportGroup, i as OdbReportFunction, n as OdbReportBand, o as readOdbReport, r as OdbReportElement, t as OdbReport } from "./report-MpwUgXbA.js";
|
|
45
|
-
import { a as Alignment, i as xmlCodec, n as encodePackage, o as AlignmentSchema, r as packageCodec, t as decodePackage } from "./codec-
|
|
46
|
-
export { type Alignment, AlignmentSchema, type Attribute, AttributeSchema, type BinaryPart, BinaryPartSchema, type BuildManifestOptions, type CascadeDiagnostic, type DrawPageContent, type EmbeddedDocumentKind, type EmbeddedDrawObject, type ImageFormat, type InternRequest, type LengthUnit, MANIFEST_PART, META_PART, MIMETYPE_PART, type Manifest, type ManifestEntry, ManifestEntrySchema, type ManifestProblem, ManifestProblemSchema, ManifestSchema, ODF_MEDIA_TYPES, ODF_NAMESPACES, type OdbComponentInfo, type OdbConnectionInfo, type OdbForm, type OdbFormControl, type OdbFormDefinition, type OdbInventory, type OdbQueryInfo, type OdbReport, type OdbReportBand, type OdbReportElement, type OdbReportFunction, type OdbReportGroup, type OdfExtension, type OdfFormulaDocument, type OdfNamespacePrefix, type OdfPoint, type OdfRawPoint, type OdfRawSegment, type OdfRawSubpath, type OdfShapeGeometry, type OdfTransformFunction, type OdfViewBox, type OdgDocument, type OdmDocument, type OdmSection, type OdpDocument, type OdsDocument, type OdtDocument, type OtherPartRef, type Package, PackageSchema, type ParsedProperties, type Part, PartSchema, STYLE_FAMILIES, type StyleCascadeResult, type StyleElementChainResult, type StyleFamily, type StyleProperties, StylePropertiesSchema, StyleRegistry, type StyleRegistryOptions, type SubDocumentPackageOptions, TableCursor, type XmlCdata, XmlCdataSchema, type XmlComment, XmlCommentSchema, type XmlDeclaration, XmlDeclarationSchema, type XmlElement, XmlElementSchema, type XmlNode, XmlNodeSchema, type XmlPart, XmlPartSchema, type XmlPi, XmlPiSchema, type XmlText, XmlTextSchema, type ZipEntry, applyOdfTransform, attrValue, base64ToBytes, buildManifest, buildOdfSubpaths, buildStylePropertyElements, buildXml, bytesToBase64, canonicalPropertiesString, cellReference, childrenWithTag, columnIndexToLetters, columnLettersToIndex, composeOdfGroupTransform, decodeOdfText, decodePackage, decodeXmlText, el, elementsWithTag, encodePackage, encodeXmlText, ensureSpan, findChildElement, findStyleElement, formatOdfColor, formatOdfLength, formatPercentageMultiplier, formatPt, getOdfSpaceCount, isStyleFamily, isXmlNode, measureOdfNodeLength, mediaTypeForExtension, netRotationDeg, packageCodec, paragraphPropertiesToAttributes, parseBox, parseCellReference, parseOdfLength as parseLength, parseOdfLength, parseLinePoints, parseMargins, parseOdfColor, parseOdfPathData, parseOdfPointsList, parseOdfTransform, parseOdfViewBox, parsePackage, parsePageSize, parseParagraphProperties, parseStyleElementProperties, parseTextProperties, parseXml, rawSubpathFromPoints, readDrawFrame, readDrawImageBlock, readDrawObjectReference, readDrawPageContent, readManifest, readMimetype, readOdbForm, readOdbInventory, readOdbReport, readOdfFormula, readOdfFormulaDocument, readOdfMetadata, readOdfParagraph, readOdfTable, readOdg, readOdm, readOdp, readOds, readOdt, resolveDrawPageSize, resolveOdbComponent, resolveOdfShapeGeometry, resolvePageLayoutProperties, resolveStyle, resolveStyleElementChain, rootElement, scaleOdfRawPoint, serializePackage, setDocumentMediaType, sniffImageFormat, subDocumentPackage, sumOdfNodeLength, syncManifest, textPropertiesToAttributes, txt, unzipPackage, validateManifest, walkDrawShapes, writeManifest, writeMimetype, xmlCodec, xmlnsAttributes, zipPackage };
|
|
46
|
+
import { a as Alignment, i as xmlCodec, n as encodePackage, o as AlignmentSchema, r as packageCodec, t as decodePackage } from "./codec-FXnmhe15.js";
|
|
47
|
+
export { type Alignment, AlignmentSchema, type Attribute, AttributeSchema, type BinaryPart, BinaryPartSchema, type BuildManifestOptions, type CascadeDiagnostic, type DrawPageContent, type EmbeddedDocumentKind, type EmbeddedDrawObject, type ImageFormat, type InternRequest, type LengthUnit, MANIFEST_PART, META_PART, MIMETYPE_PART, type Manifest, type ManifestEntry, ManifestEntrySchema, type ManifestProblem, ManifestProblemSchema, ManifestSchema, ODF_MEDIA_TYPES, ODF_NAMESPACES, type OdbComponentInfo, type OdbConnectionInfo, type OdbForm, type OdbFormControl, type OdbFormDefinition, type OdbInventory, type OdbQueryInfo, type OdbReport, type OdbReportBand, type OdbReportElement, type OdbReportFunction, type OdbReportGroup, type OdfExtension, type OdfFormulaDocument, type OdfListIdState, type OdfListParagraphReader, type OdfNamespacePrefix, type OdfPoint, type OdfRawPoint, type OdfRawSegment, type OdfRawSubpath, type OdfShapeGeometry, type OdfTransformFunction, type OdfViewBox, type OdgDocument, type OdmDocument, type OdmSection, type OdpDocument, type OdsDocument, type OdtDocument, type OtherPartRef, type Package, PackageSchema, type ParsedProperties, type Part, PartSchema, STYLE_FAMILIES, type StyleCascadeResult, type StyleElementChainResult, type StyleFamily, type StyleProperties, StylePropertiesSchema, StyleRegistry, type StyleRegistryOptions, type SubDocumentPackageOptions, TableCursor, type XmlCdata, XmlCdataSchema, type XmlComment, XmlCommentSchema, type XmlDeclaration, XmlDeclarationSchema, type XmlElement, XmlElementSchema, type XmlNode, XmlNodeSchema, type XmlPart, XmlPartSchema, type XmlPi, XmlPiSchema, type XmlText, XmlTextSchema, type ZipEntry, applyOdfTransform, attrValue, base64ToBytes, buildManifest, buildOdfSubpaths, buildStylePropertyElements, buildXml, bytesToBase64, canonicalPropertiesString, cellReference, childrenWithTag, columnIndexToLetters, columnLettersToIndex, composeOdfGroupTransform, decodeOdfText, decodePackage, decodeXmlText, el, elementsWithTag, encodePackage, encodeXmlText, ensureSpan, findChildElement, findStyleElement, formatOdfColor, formatOdfLength, formatPercentageMultiplier, formatPt, getOdfSpaceCount, isStyleFamily, isXmlNode, measureOdfNodeLength, mediaTypeForExtension, mintOdfListNumId, netRotationDeg, packageCodec, paragraphPropertiesToAttributes, parseBox, parseCellReference, parseOdfLength as parseLength, parseOdfLength, parseLinePoints, parseMargins, parseOdfColor, parseOdfPathData, parseOdfPointsList, parseOdfTransform, parseOdfViewBox, parsePackage, parsePageSize, parseParagraphProperties, parseStyleElementProperties, parseTextProperties, parseXml, rawSubpathFromPoints, readDrawFrame, readDrawImageBlock, readDrawObjectReference, readDrawPageContent, readManifest, readMimetype, readOdbForm, readOdbInventory, readOdbReport, readOdfFormula, readOdfFormulaDocument, readOdfListParagraphs, readOdfMetadata, readOdfParagraph, readOdfTable, readOdg, readOdm, readOdp, readOds, readOdt, resolveDrawPageSize, resolveOdbComponent, resolveOdfListKind, resolveOdfShapeGeometry, resolvePageLayoutProperties, resolveStyle, resolveStyleElementChain, rootElement, scaleOdfRawPoint, serializePackage, setDocumentMediaType, sniffImageFormat, subDocumentPackage, sumOdfNodeLength, syncManifest, textPropertiesToAttributes, txt, unzipPackage, validateManifest, walkDrawShapes, writeManifest, writeMimetype, xmlCodec, xmlnsAttributes, zipPackage };
|
package/dist/index.js
CHANGED
|
@@ -27,6 +27,7 @@ import { parseBox, parseLinePoints, parseMargins, parsePageSize } from "./typed/
|
|
|
27
27
|
import { findStyleElement, resolveStyle, resolveStyleElementChain } from "./typed/shared/cascade.js";
|
|
28
28
|
import { META_PART, readOdfMetadata } from "./typed/shared/metadata.js";
|
|
29
29
|
import { readOdfParagraph } from "./typed/shared/paragraph.js";
|
|
30
|
+
import { mintOdfListNumId, readOdfListParagraphs, resolveOdfListKind } from "./typed/shared/list.js";
|
|
30
31
|
import { readOdfTable } from "./typed/shared/table.js";
|
|
31
32
|
import { applyOdfTransform, composeOdfGroupTransform, netRotationDeg, parseOdfTransform, resolveOdfShapeGeometry } from "./typed/shared/transform.js";
|
|
32
33
|
import { resolveDrawPageSize, resolvePageLayoutProperties } from "./typed/shared/masterpage.js";
|
|
@@ -44,4 +45,4 @@ import { readOdbInventory, resolveOdbComponent } from "./typed/odb/read.js";
|
|
|
44
45
|
import { readOdbForm } from "./typed/odb/form.js";
|
|
45
46
|
import { readOdbReport } from "./typed/odb/report.js";
|
|
46
47
|
import { AlignmentSchema } from "document-schema.js";
|
|
47
|
-
export { AlignmentSchema, AttributeSchema, BinaryPartSchema, MANIFEST_PART, META_PART, MIMETYPE_PART, ManifestEntrySchema, ManifestProblemSchema, ManifestSchema, ODF_MEDIA_TYPES, ODF_NAMESPACES, PackageSchema, PartSchema, STYLE_FAMILIES, StylePropertiesSchema, StyleRegistry, TableCursor, XmlCdataSchema, XmlCommentSchema, XmlDeclarationSchema, XmlElementSchema, XmlNodeSchema, XmlPartSchema, XmlPiSchema, XmlTextSchema, applyOdfTransform, attrValue, base64ToBytes, buildManifest, buildOdfSubpaths, buildStylePropertyElements, buildXml, bytesToBase64, canonicalPropertiesString, cellReference, childrenWithTag, columnIndexToLetters, columnLettersToIndex, composeOdfGroupTransform, decodeOdfText, decodePackage, decodeXmlText, el, elementsWithTag, encodePackage, encodeXmlText, ensureSpan, findChildElement, findStyleElement, formatOdfColor, formatOdfLength, formatPercentageMultiplier, formatPt, getOdfSpaceCount, isStyleFamily, isXmlNode, measureOdfNodeLength, mediaTypeForExtension, netRotationDeg, packageCodec, paragraphPropertiesToAttributes, parseBox, parseCellReference, parseOdfLength as parseLength, parseOdfLength, parseLinePoints, parseMargins, parseOdfColor, parseOdfPathData, parseOdfPointsList, parseOdfTransform, parseOdfViewBox, parsePackage, parsePageSize, parseParagraphProperties, parseStyleElementProperties, parseTextProperties, parseXml, rawSubpathFromPoints, readDrawFrame, readDrawImageBlock, readDrawObjectReference, readDrawPageContent, readManifest, readMimetype, readOdbForm, readOdbInventory, readOdbReport, readOdfFormula, readOdfFormulaDocument, readOdfMetadata, readOdfParagraph, readOdfTable, readOdg, readOdm, readOdp, readOds, readOdt, resolveDrawPageSize, resolveOdbComponent, resolveOdfShapeGeometry, resolvePageLayoutProperties, resolveStyle, resolveStyleElementChain, rootElement, scaleOdfRawPoint, serializePackage, setDocumentMediaType, sniffImageFormat, subDocumentPackage, sumOdfNodeLength, syncManifest, textPropertiesToAttributes, txt, unzipPackage, validateManifest, walkDrawShapes, writeManifest, writeMimetype, xmlCodec, xmlnsAttributes, zipPackage };
|
|
48
|
+
export { AlignmentSchema, AttributeSchema, BinaryPartSchema, MANIFEST_PART, META_PART, MIMETYPE_PART, ManifestEntrySchema, ManifestProblemSchema, ManifestSchema, ODF_MEDIA_TYPES, ODF_NAMESPACES, PackageSchema, PartSchema, STYLE_FAMILIES, StylePropertiesSchema, StyleRegistry, TableCursor, XmlCdataSchema, XmlCommentSchema, XmlDeclarationSchema, XmlElementSchema, XmlNodeSchema, XmlPartSchema, XmlPiSchema, XmlTextSchema, applyOdfTransform, attrValue, base64ToBytes, buildManifest, buildOdfSubpaths, buildStylePropertyElements, buildXml, bytesToBase64, canonicalPropertiesString, cellReference, childrenWithTag, columnIndexToLetters, columnLettersToIndex, composeOdfGroupTransform, decodeOdfText, decodePackage, decodeXmlText, el, elementsWithTag, encodePackage, encodeXmlText, ensureSpan, findChildElement, findStyleElement, formatOdfColor, formatOdfLength, formatPercentageMultiplier, formatPt, getOdfSpaceCount, isStyleFamily, isXmlNode, measureOdfNodeLength, mediaTypeForExtension, mintOdfListNumId, netRotationDeg, packageCodec, paragraphPropertiesToAttributes, parseBox, parseCellReference, parseOdfLength as parseLength, parseOdfLength, parseLinePoints, parseMargins, parseOdfColor, parseOdfPathData, parseOdfPointsList, parseOdfTransform, parseOdfViewBox, parsePackage, parsePageSize, parseParagraphProperties, parseStyleElementProperties, parseTextProperties, parseXml, rawSubpathFromPoints, readDrawFrame, readDrawImageBlock, readDrawObjectReference, readDrawPageContent, readManifest, readMimetype, readOdbForm, readOdbInventory, readOdbReport, readOdfFormula, readOdfFormulaDocument, readOdfListParagraphs, readOdfMetadata, readOdfParagraph, readOdfTable, readOdg, readOdm, readOdp, readOds, readOdt, resolveDrawPageSize, resolveOdbComponent, resolveOdfListKind, resolveOdfShapeGeometry, resolvePageLayoutProperties, resolveStyle, resolveStyleElementChain, rootElement, scaleOdfRawPoint, serializePackage, setDocumentMediaType, sniffImageFormat, subDocumentPackage, sumOdfNodeLength, syncManifest, textPropertiesToAttributes, txt, unzipPackage, validateManifest, walkDrawShapes, writeManifest, writeMimetype, xmlCodec, xmlnsAttributes, zipPackage };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { l as XmlElement } from "./node-CkBWRjNR.cjs";
|
|
2
|
+
import { Package } from "./model/package.cjs";
|
|
3
|
+
import { ContentListMembership, ContentParagraph } from "document-schema.js";
|
|
4
|
+
//#region src/typed/shared/list.d.ts
|
|
5
|
+
interface OdfListIdState {
|
|
6
|
+
next: number;
|
|
7
|
+
}
|
|
8
|
+
declare function resolveOdfListKind(pkg: Package, styleName: string | undefined): 'ordered' | 'bullet' | undefined;
|
|
9
|
+
declare function mintOdfListNumId(pkg: Package, listElement: XmlElement, state: OdfListIdState): string;
|
|
10
|
+
type OdfListParagraphReader = (element: XmlElement) => ContentParagraph;
|
|
11
|
+
declare function readOdfListParagraphs(listElement: XmlElement, membership: ContentListMembership, readParagraph: OdfListParagraphReader): ContentParagraph[];
|
|
12
|
+
//#endregion
|
|
13
|
+
export { resolveOdfListKind as a, readOdfListParagraphs as i, OdfListParagraphReader as n, mintOdfListNumId as r, OdfListIdState as t };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { l as XmlElement } from "./node-CkBWRjNR.js";
|
|
2
|
+
import { Package } from "./model/package.js";
|
|
3
|
+
import { ContentListMembership, ContentParagraph } from "document-schema.js";
|
|
4
|
+
//#region src/typed/shared/list.d.ts
|
|
5
|
+
interface OdfListIdState {
|
|
6
|
+
next: number;
|
|
7
|
+
}
|
|
8
|
+
declare function resolveOdfListKind(pkg: Package, styleName: string | undefined): 'ordered' | 'bullet' | undefined;
|
|
9
|
+
declare function mintOdfListNumId(pkg: Package, listElement: XmlElement, state: OdfListIdState): string;
|
|
10
|
+
type OdfListParagraphReader = (element: XmlElement) => ContentParagraph;
|
|
11
|
+
declare function readOdfListParagraphs(listElement: XmlElement, membership: ContentListMembership, readParagraph: OdfListParagraphReader): ContentParagraph[];
|
|
12
|
+
//#endregion
|
|
13
|
+
export { resolveOdfListKind as a, readOdfListParagraphs as i, OdfListParagraphReader as n, mintOdfListNumId as r, OdfListIdState as t };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { d as XmlNode, l as XmlElement } from "./node-CkBWRjNR.js";
|
|
2
2
|
import { Package } from "./model/package.js";
|
|
3
|
+
import { t as OdfListIdState } from "./list-acGU0xLo.js";
|
|
3
4
|
import { r as OdfTransformFunction } from "./transform-C7GrZZdR.js";
|
|
4
5
|
import { Box, ContentImageBlock, ContentShape, ContentVector } from "document-schema.js";
|
|
5
6
|
//#region src/typed/draw/shapes.d.ts
|
|
6
7
|
declare function readDrawImageBlock(image: XmlElement, frame: XmlElement, frameBox: Box, pkg: Package): ContentImageBlock | undefined;
|
|
7
|
-
declare function readDrawFrame(frame: XmlElement, groupFunctions: readonly OdfTransformFunction[], pkg: Package): ContentShape | undefined;
|
|
8
|
-
declare function walkDrawShapes(children: readonly XmlNode[], groupFunctions: readonly OdfTransformFunction[], pkg: Package, out: ContentShape[], indexState?: DocumentIndexState): void;
|
|
8
|
+
declare function readDrawFrame(frame: XmlElement, groupFunctions: readonly OdfTransformFunction[], pkg: Package, listIdState?: OdfListIdState): ContentShape | undefined;
|
|
9
|
+
declare function walkDrawShapes(children: readonly XmlNode[], groupFunctions: readonly OdfTransformFunction[], pkg: Package, out: ContentShape[], indexState?: DocumentIndexState, listIdState?: OdfListIdState): void;
|
|
9
10
|
interface DocumentIndexState {
|
|
10
11
|
next: number;
|
|
11
12
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { d as XmlNode, l as XmlElement } from "./node-CkBWRjNR.cjs";
|
|
2
2
|
import { Package } from "./model/package.cjs";
|
|
3
|
+
import { t as OdfListIdState } from "./list-C35tiDYU.cjs";
|
|
3
4
|
import { r as OdfTransformFunction } from "./transform-DKEjydnm.cjs";
|
|
4
5
|
import { Box, ContentImageBlock, ContentShape, ContentVector } from "document-schema.js";
|
|
5
6
|
//#region src/typed/draw/shapes.d.ts
|
|
6
7
|
declare function readDrawImageBlock(image: XmlElement, frame: XmlElement, frameBox: Box, pkg: Package): ContentImageBlock | undefined;
|
|
7
|
-
declare function readDrawFrame(frame: XmlElement, groupFunctions: readonly OdfTransformFunction[], pkg: Package): ContentShape | undefined;
|
|
8
|
-
declare function walkDrawShapes(children: readonly XmlNode[], groupFunctions: readonly OdfTransformFunction[], pkg: Package, out: ContentShape[], indexState?: DocumentIndexState): void;
|
|
8
|
+
declare function readDrawFrame(frame: XmlElement, groupFunctions: readonly OdfTransformFunction[], pkg: Package, listIdState?: OdfListIdState): ContentShape | undefined;
|
|
9
|
+
declare function walkDrawShapes(children: readonly XmlNode[], groupFunctions: readonly OdfTransformFunction[], pkg: Package, out: ContentShape[], indexState?: DocumentIndexState, listIdState?: OdfListIdState): void;
|
|
9
10
|
interface DocumentIndexState {
|
|
10
11
|
next: number;
|
|
11
12
|
}
|
|
@@ -8,6 +8,7 @@ const require_typed_shared_text = require("../shared/text.cjs");
|
|
|
8
8
|
const require_typed_shared_geometry = require("../shared/geometry.cjs");
|
|
9
9
|
const require_typed_shared_cascade = require("../shared/cascade.cjs");
|
|
10
10
|
const require_typed_shared_paragraph = require("../shared/paragraph.cjs");
|
|
11
|
+
const require_typed_shared_list = require("../shared/list.cjs");
|
|
11
12
|
const require_typed_shared_table = require("../shared/table.cjs");
|
|
12
13
|
const require_typed_shared_transform = require("../shared/transform.cjs");
|
|
13
14
|
const require_typed_shared_path = require("../shared/path.cjs");
|
|
@@ -64,11 +65,25 @@ function readDrawImageBlock(image, frame, frameBox, pkg) {
|
|
|
64
65
|
if (altText !== void 0) block.altText = altText;
|
|
65
66
|
return block;
|
|
66
67
|
}
|
|
67
|
-
function readDrawFrameContent(frame, frameBox, pkg) {
|
|
68
|
+
function readDrawFrameContent(frame, frameBox, pkg, listIdState) {
|
|
68
69
|
const table = require_xml_query.childrenWithTag(frame, "table:table")[0];
|
|
69
70
|
if (table !== void 0) return [require_typed_shared_table.readOdfTable(table, pkg)];
|
|
70
71
|
const textBox = require_xml_query.childrenWithTag(frame, "draw:text-box")[0];
|
|
71
|
-
if (textBox !== void 0)
|
|
72
|
+
if (textBox !== void 0) {
|
|
73
|
+
const blocks = [];
|
|
74
|
+
for (const child of textBox.children) {
|
|
75
|
+
if (child.type !== "element") continue;
|
|
76
|
+
if (child.tag === "text:p") blocks.push(require_typed_shared_paragraph.readOdfParagraph(child, pkg));
|
|
77
|
+
else if (child.tag === "text:list") {
|
|
78
|
+
const numId = require_typed_shared_list.mintOdfListNumId(pkg, child, listIdState);
|
|
79
|
+
blocks.push(...require_typed_shared_list.readOdfListParagraphs(child, {
|
|
80
|
+
numId,
|
|
81
|
+
level: 0
|
|
82
|
+
}, (element) => require_typed_shared_paragraph.readOdfParagraph(element, pkg)));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return blocks;
|
|
86
|
+
}
|
|
72
87
|
const image = require_xml_query.childrenWithTag(frame, "draw:image")[0];
|
|
73
88
|
if (image !== void 0) {
|
|
74
89
|
const block = readDrawImageBlock(image, frame, frameBox, pkg);
|
|
@@ -76,7 +91,7 @@ function readDrawFrameContent(frame, frameBox, pkg) {
|
|
|
76
91
|
}
|
|
77
92
|
return [];
|
|
78
93
|
}
|
|
79
|
-
function readDrawFrame(frame, groupFunctions, pkg) {
|
|
94
|
+
function readDrawFrame(frame, groupFunctions, pkg, listIdState = { next: 1 }) {
|
|
80
95
|
const ownGeometry = require_typed_shared_transform.resolveOdfShapeGeometry(frame);
|
|
81
96
|
if (ownGeometry === void 0) return;
|
|
82
97
|
const geometry = require_typed_shared_transform.composeOdfGroupTransform(groupFunctions, ownGeometry);
|
|
@@ -85,19 +100,19 @@ function readDrawFrame(frame, groupFunctions, pkg) {
|
|
|
85
100
|
frame: geometry.frame,
|
|
86
101
|
rotationDeg: geometry.rotationDeg,
|
|
87
102
|
...readFrameInsets(frame, pkg),
|
|
88
|
-
blocks: readDrawFrameContent(frame, geometry.frame, pkg)
|
|
103
|
+
blocks: readDrawFrameContent(frame, geometry.frame, pkg, listIdState)
|
|
89
104
|
};
|
|
90
105
|
}
|
|
91
106
|
function readOwnTransformFunctions(element) {
|
|
92
107
|
const value = require_xml_query.attrValue(element, "draw:transform");
|
|
93
108
|
return value === void 0 ? [] : require_typed_shared_transform.parseOdfTransform(value);
|
|
94
109
|
}
|
|
95
|
-
function walkDrawShapes(children, groupFunctions, pkg, out, indexState = { next: 0 }) {
|
|
110
|
+
function walkDrawShapes(children, groupFunctions, pkg, out, indexState = { next: 0 }, listIdState = { next: 1 }) {
|
|
96
111
|
for (const node of children) {
|
|
97
112
|
if (node.type !== "element") continue;
|
|
98
113
|
if (node.tag === "draw:frame") {
|
|
99
114
|
const zIndex = paintOrderKey(node, indexState);
|
|
100
|
-
const shape = readDrawFrame(node, groupFunctions, pkg);
|
|
115
|
+
const shape = readDrawFrame(node, groupFunctions, pkg, listIdState);
|
|
101
116
|
if (shape !== void 0) out.push({
|
|
102
117
|
...shape,
|
|
103
118
|
paintOrder: zIndex
|
|
@@ -105,7 +120,7 @@ function walkDrawShapes(children, groupFunctions, pkg, out, indexState = { next:
|
|
|
105
120
|
} else if (node.tag === "draw:g") {
|
|
106
121
|
const ownFunctions = readOwnTransformFunctions(node);
|
|
107
122
|
const nested = ownFunctions.length === 0 ? groupFunctions : [...ownFunctions, ...groupFunctions];
|
|
108
|
-
walkDrawShapes(node.children, nested, pkg, out, indexState);
|
|
123
|
+
walkDrawShapes(node.children, nested, pkg, out, indexState, listIdState);
|
|
109
124
|
}
|
|
110
125
|
}
|
|
111
126
|
}
|
|
@@ -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-BqcccDK8.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-BB59aIC8.js";
|
|
2
2
|
export { DrawPageContent, readDrawFrame, readDrawImageBlock, readDrawPageContent, walkDrawShapes };
|
|
@@ -7,6 +7,7 @@ import { decodeOdfText } from "../shared/text.js";
|
|
|
7
7
|
import { parseLinePoints } from "../shared/geometry.js";
|
|
8
8
|
import { resolveStyleElementChain } from "../shared/cascade.js";
|
|
9
9
|
import { readOdfParagraph } from "../shared/paragraph.js";
|
|
10
|
+
import { mintOdfListNumId, readOdfListParagraphs } from "../shared/list.js";
|
|
10
11
|
import { readOdfTable } from "../shared/table.js";
|
|
11
12
|
import { applyOdfTransform, composeOdfGroupTransform, parseOdfTransform, resolveOdfShapeGeometry } from "../shared/transform.js";
|
|
12
13
|
import { buildOdfSubpaths, parseOdfPathData, parseOdfPointsList, parseOdfViewBox, rawSubpathFromPoints } from "../shared/path.js";
|
|
@@ -63,11 +64,25 @@ function readDrawImageBlock(image, frame, frameBox, pkg) {
|
|
|
63
64
|
if (altText !== void 0) block.altText = altText;
|
|
64
65
|
return block;
|
|
65
66
|
}
|
|
66
|
-
function readDrawFrameContent(frame, frameBox, pkg) {
|
|
67
|
+
function readDrawFrameContent(frame, frameBox, pkg, listIdState) {
|
|
67
68
|
const table = childrenWithTag(frame, "table:table")[0];
|
|
68
69
|
if (table !== void 0) return [readOdfTable(table, pkg)];
|
|
69
70
|
const textBox = childrenWithTag(frame, "draw:text-box")[0];
|
|
70
|
-
if (textBox !== void 0)
|
|
71
|
+
if (textBox !== void 0) {
|
|
72
|
+
const blocks = [];
|
|
73
|
+
for (const child of textBox.children) {
|
|
74
|
+
if (child.type !== "element") continue;
|
|
75
|
+
if (child.tag === "text:p") blocks.push(readOdfParagraph(child, pkg));
|
|
76
|
+
else if (child.tag === "text:list") {
|
|
77
|
+
const numId = mintOdfListNumId(pkg, child, listIdState);
|
|
78
|
+
blocks.push(...readOdfListParagraphs(child, {
|
|
79
|
+
numId,
|
|
80
|
+
level: 0
|
|
81
|
+
}, (element) => readOdfParagraph(element, pkg)));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return blocks;
|
|
85
|
+
}
|
|
71
86
|
const image = childrenWithTag(frame, "draw:image")[0];
|
|
72
87
|
if (image !== void 0) {
|
|
73
88
|
const block = readDrawImageBlock(image, frame, frameBox, pkg);
|
|
@@ -75,7 +90,7 @@ function readDrawFrameContent(frame, frameBox, pkg) {
|
|
|
75
90
|
}
|
|
76
91
|
return [];
|
|
77
92
|
}
|
|
78
|
-
function readDrawFrame(frame, groupFunctions, pkg) {
|
|
93
|
+
function readDrawFrame(frame, groupFunctions, pkg, listIdState = { next: 1 }) {
|
|
79
94
|
const ownGeometry = resolveOdfShapeGeometry(frame);
|
|
80
95
|
if (ownGeometry === void 0) return;
|
|
81
96
|
const geometry = composeOdfGroupTransform(groupFunctions, ownGeometry);
|
|
@@ -84,19 +99,19 @@ function readDrawFrame(frame, groupFunctions, pkg) {
|
|
|
84
99
|
frame: geometry.frame,
|
|
85
100
|
rotationDeg: geometry.rotationDeg,
|
|
86
101
|
...readFrameInsets(frame, pkg),
|
|
87
|
-
blocks: readDrawFrameContent(frame, geometry.frame, pkg)
|
|
102
|
+
blocks: readDrawFrameContent(frame, geometry.frame, pkg, listIdState)
|
|
88
103
|
};
|
|
89
104
|
}
|
|
90
105
|
function readOwnTransformFunctions(element) {
|
|
91
106
|
const value = attrValue(element, "draw:transform");
|
|
92
107
|
return value === void 0 ? [] : parseOdfTransform(value);
|
|
93
108
|
}
|
|
94
|
-
function walkDrawShapes(children, groupFunctions, pkg, out, indexState = { next: 0 }) {
|
|
109
|
+
function walkDrawShapes(children, groupFunctions, pkg, out, indexState = { next: 0 }, listIdState = { next: 1 }) {
|
|
95
110
|
for (const node of children) {
|
|
96
111
|
if (node.type !== "element") continue;
|
|
97
112
|
if (node.tag === "draw:frame") {
|
|
98
113
|
const zIndex = paintOrderKey(node, indexState);
|
|
99
|
-
const shape = readDrawFrame(node, groupFunctions, pkg);
|
|
114
|
+
const shape = readDrawFrame(node, groupFunctions, pkg, listIdState);
|
|
100
115
|
if (shape !== void 0) out.push({
|
|
101
116
|
...shape,
|
|
102
117
|
paintOrder: zIndex
|
|
@@ -104,7 +119,7 @@ function walkDrawShapes(children, groupFunctions, pkg, out, indexState = { next:
|
|
|
104
119
|
} else if (node.tag === "draw:g") {
|
|
105
120
|
const ownFunctions = readOwnTransformFunctions(node);
|
|
106
121
|
const nested = ownFunctions.length === 0 ? groupFunctions : [...ownFunctions, ...groupFunctions];
|
|
107
|
-
walkDrawShapes(node.children, nested, pkg, out, indexState);
|
|
122
|
+
walkDrawShapes(node.children, nested, pkg, out, indexState, listIdState);
|
|
108
123
|
}
|
|
109
124
|
}
|
|
110
125
|
}
|
|
@@ -2,7 +2,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_xml_entities = require("../../xml/entities.cjs");
|
|
3
3
|
const require_xml_query = require("../../xml/query.cjs");
|
|
4
4
|
const require_typed_shared_metadata = require("../shared/metadata.cjs");
|
|
5
|
-
let document_schema_js = require("document-schema.js");
|
|
6
5
|
//#region src/typed/formula/read.ts
|
|
7
6
|
const CONTENT_PART = "content.xml";
|
|
8
7
|
const MATH_ROOT_TAGS = ["math", "math:math"];
|
|
@@ -49,7 +48,6 @@ function readOdfFormulaDocument(pkg) {
|
|
|
49
48
|
const { mathml, starMath, metadata } = readOdfFormula(pkg);
|
|
50
49
|
return {
|
|
51
50
|
kind: "formula",
|
|
52
|
-
formatVersion: document_schema_js.CONTENT_FORMAT_VERSION,
|
|
53
51
|
metadata,
|
|
54
52
|
formula: starMath === void 0 ? { mathml } : {
|
|
55
53
|
mathml,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { decodeXmlText } from "../../xml/entities.js";
|
|
2
2
|
import { attrValue, elementsWithTag, rootElement } from "../../xml/query.js";
|
|
3
3
|
import { readOdfMetadata } from "../shared/metadata.js";
|
|
4
|
-
import { CONTENT_FORMAT_VERSION } from "document-schema.js";
|
|
5
4
|
//#region src/typed/formula/read.ts
|
|
6
5
|
const CONTENT_PART = "content.xml";
|
|
7
6
|
const MATH_ROOT_TAGS = ["math", "math:math"];
|
|
@@ -48,7 +47,6 @@ function readOdfFormulaDocument(pkg) {
|
|
|
48
47
|
const { mathml, starMath, metadata } = readOdfFormula(pkg);
|
|
49
48
|
return {
|
|
50
49
|
kind: "formula",
|
|
51
|
-
formatVersion: CONTENT_FORMAT_VERSION,
|
|
52
50
|
metadata,
|
|
53
51
|
formula: starMath === void 0 ? { mathml } : {
|
|
54
52
|
mathml,
|
package/dist/typed/odp/read.cjs
CHANGED
|
@@ -15,9 +15,9 @@ function readSlideNotes(page) {
|
|
|
15
15
|
if (notes === void 0) return "";
|
|
16
16
|
return require_xml_query.elementsWithTag(notes.children, "text:p").map(require_typed_shared_text.decodeOdfText).join("\n");
|
|
17
17
|
}
|
|
18
|
-
function readSlide(page, pkg) {
|
|
18
|
+
function readSlide(page, pkg, listIdState) {
|
|
19
19
|
const shapes = [];
|
|
20
|
-
require_typed_draw_shapes.walkDrawShapes(page.children, [], pkg, shapes);
|
|
20
|
+
require_typed_draw_shapes.walkDrawShapes(page.children, [], pkg, shapes, { next: 0 }, listIdState);
|
|
21
21
|
return {
|
|
22
22
|
size: readSlideSize(page, pkg),
|
|
23
23
|
shapes,
|
|
@@ -30,9 +30,10 @@ function readOdp(pkg) {
|
|
|
30
30
|
const body = root === void 0 ? void 0 : require_xml_query.findChildElement(root.children, "office:body");
|
|
31
31
|
const presentation = body === void 0 ? void 0 : require_xml_query.findChildElement(body.children, "office:presentation");
|
|
32
32
|
const pages = presentation === void 0 ? [] : require_xml_query.childrenWithTag(presentation, "draw:page");
|
|
33
|
+
const listIdState = { next: 1 };
|
|
33
34
|
return {
|
|
34
35
|
metadata: require_typed_shared_metadata.readOdfMetadata(pkg),
|
|
35
|
-
slides: pages.map((page) => readSlide(page, pkg))
|
|
36
|
+
slides: pages.map((page) => readSlide(page, pkg, listIdState))
|
|
36
37
|
};
|
|
37
38
|
}
|
|
38
39
|
//#endregion
|
package/dist/typed/odp/read.js
CHANGED
|
@@ -14,9 +14,9 @@ function readSlideNotes(page) {
|
|
|
14
14
|
if (notes === void 0) return "";
|
|
15
15
|
return elementsWithTag(notes.children, "text:p").map(decodeOdfText).join("\n");
|
|
16
16
|
}
|
|
17
|
-
function readSlide(page, pkg) {
|
|
17
|
+
function readSlide(page, pkg, listIdState) {
|
|
18
18
|
const shapes = [];
|
|
19
|
-
walkDrawShapes(page.children, [], pkg, shapes);
|
|
19
|
+
walkDrawShapes(page.children, [], pkg, shapes, { next: 0 }, listIdState);
|
|
20
20
|
return {
|
|
21
21
|
size: readSlideSize(page, pkg),
|
|
22
22
|
shapes,
|
|
@@ -29,9 +29,10 @@ function readOdp(pkg) {
|
|
|
29
29
|
const body = root === void 0 ? void 0 : findChildElement(root.children, "office:body");
|
|
30
30
|
const presentation = body === void 0 ? void 0 : findChildElement(body.children, "office:presentation");
|
|
31
31
|
const pages = presentation === void 0 ? [] : childrenWithTag(presentation, "draw:page");
|
|
32
|
+
const listIdState = { next: 1 };
|
|
32
33
|
return {
|
|
33
34
|
metadata: readOdfMetadata(pkg),
|
|
34
|
-
slides: pages.map((page) => readSlide(page, pkg))
|
|
35
|
+
slides: pages.map((page) => readSlide(page, pkg, listIdState))
|
|
35
36
|
};
|
|
36
37
|
}
|
|
37
38
|
//#endregion
|
package/dist/typed/ods/read.cjs
CHANGED
|
@@ -171,7 +171,6 @@ function readEmbeddedObjectDocument(reference) {
|
|
|
171
171
|
const { metadata, sections } = require_typed_odt_read.readOdt(reference.package);
|
|
172
172
|
return {
|
|
173
173
|
kind: "wordprocessing",
|
|
174
|
-
formatVersion: document_schema_js.CONTENT_FORMAT_VERSION,
|
|
175
174
|
metadata,
|
|
176
175
|
sections
|
|
177
176
|
};
|
|
@@ -180,7 +179,6 @@ function readEmbeddedObjectDocument(reference) {
|
|
|
180
179
|
const { metadata, slides } = require_typed_odp_read.readOdp(reference.package);
|
|
181
180
|
return {
|
|
182
181
|
kind: "presentation",
|
|
183
|
-
formatVersion: document_schema_js.CONTENT_FORMAT_VERSION,
|
|
184
182
|
metadata,
|
|
185
183
|
slides
|
|
186
184
|
};
|
|
@@ -189,7 +187,6 @@ function readEmbeddedObjectDocument(reference) {
|
|
|
189
187
|
const { metadata, pages } = require_typed_odg_read.readOdg(reference.package);
|
|
190
188
|
return {
|
|
191
189
|
kind: "drawing",
|
|
192
|
-
formatVersion: document_schema_js.CONTENT_FORMAT_VERSION,
|
|
193
190
|
metadata,
|
|
194
191
|
pages
|
|
195
192
|
};
|
|
@@ -198,7 +195,6 @@ function readEmbeddedObjectDocument(reference) {
|
|
|
198
195
|
const { metadata, sheets } = readOds(reference.package);
|
|
199
196
|
return {
|
|
200
197
|
kind: "spreadsheet",
|
|
201
|
-
formatVersion: document_schema_js.CONTENT_FORMAT_VERSION,
|
|
202
198
|
metadata,
|
|
203
199
|
sheets
|
|
204
200
|
};
|
package/dist/typed/ods/read.js
CHANGED
|
@@ -14,7 +14,7 @@ import { readDrawObjectReference } from "../draw/embedded.js";
|
|
|
14
14
|
import { readOdp } from "../odp/read.js";
|
|
15
15
|
import { readOdt } from "../odt/read.js";
|
|
16
16
|
import { readOdg } from "../odg/read.js";
|
|
17
|
-
import {
|
|
17
|
+
import { PAGE_SIZE_A4 } from "document-schema.js";
|
|
18
18
|
//#region src/typed/ods/read.ts
|
|
19
19
|
const CONTENT_PART = "content.xml";
|
|
20
20
|
function parseKnownOdfLength(value) {
|
|
@@ -170,7 +170,6 @@ function readEmbeddedObjectDocument(reference) {
|
|
|
170
170
|
const { metadata, sections } = readOdt(reference.package);
|
|
171
171
|
return {
|
|
172
172
|
kind: "wordprocessing",
|
|
173
|
-
formatVersion: CONTENT_FORMAT_VERSION,
|
|
174
173
|
metadata,
|
|
175
174
|
sections
|
|
176
175
|
};
|
|
@@ -179,7 +178,6 @@ function readEmbeddedObjectDocument(reference) {
|
|
|
179
178
|
const { metadata, slides } = readOdp(reference.package);
|
|
180
179
|
return {
|
|
181
180
|
kind: "presentation",
|
|
182
|
-
formatVersion: CONTENT_FORMAT_VERSION,
|
|
183
181
|
metadata,
|
|
184
182
|
slides
|
|
185
183
|
};
|
|
@@ -188,7 +186,6 @@ function readEmbeddedObjectDocument(reference) {
|
|
|
188
186
|
const { metadata, pages } = readOdg(reference.package);
|
|
189
187
|
return {
|
|
190
188
|
kind: "drawing",
|
|
191
|
-
formatVersion: CONTENT_FORMAT_VERSION,
|
|
192
189
|
metadata,
|
|
193
190
|
pages
|
|
194
191
|
};
|
|
@@ -197,7 +194,6 @@ function readEmbeddedObjectDocument(reference) {
|
|
|
197
194
|
const { metadata, sheets } = readOds(reference.package);
|
|
198
195
|
return {
|
|
199
196
|
kind: "spreadsheet",
|
|
200
|
-
formatVersion: CONTENT_FORMAT_VERSION,
|
|
201
197
|
metadata,
|
|
202
198
|
sheets
|
|
203
199
|
};
|
package/dist/typed/odt/read.cjs
CHANGED
|
@@ -4,6 +4,7 @@ const require_xml_query = require("../../xml/query.cjs");
|
|
|
4
4
|
const require_typed_shared_geometry = require("../shared/geometry.cjs");
|
|
5
5
|
const require_typed_shared_metadata = require("../shared/metadata.cjs");
|
|
6
6
|
const require_typed_shared_paragraph = require("../shared/paragraph.cjs");
|
|
7
|
+
const require_typed_shared_list = require("../shared/list.cjs");
|
|
7
8
|
const require_typed_shared_table = require("../shared/table.cjs");
|
|
8
9
|
let document_schema_js = require("document-schema.js");
|
|
9
10
|
//#region src/typed/odt/read.ts
|
|
@@ -16,61 +17,26 @@ function readOutlineLevel(headingElement) {
|
|
|
16
17
|
const parsed = Number.parseInt(raw, 10);
|
|
17
18
|
return Number.isInteger(parsed) && parsed > 0 ? parsed : 1;
|
|
18
19
|
}
|
|
19
|
-
function readParagraphOrHeading(element, pkg
|
|
20
|
+
function readParagraphOrHeading(element, pkg) {
|
|
20
21
|
const paragraph = require_typed_shared_paragraph.readOdfParagraph(element, pkg);
|
|
21
22
|
if (element.tag === "text:h") {
|
|
22
23
|
const outlineLevel = readOutlineLevel(element);
|
|
23
24
|
paragraph.styleId = `Heading${outlineLevel}`;
|
|
24
25
|
paragraph.headingLevel = outlineLevel;
|
|
25
26
|
}
|
|
26
|
-
if (list !== void 0) paragraph.list = list;
|
|
27
27
|
return paragraph;
|
|
28
28
|
}
|
|
29
|
-
function readListItems(listElement, context, pkg, blocks) {
|
|
30
|
-
for (const item of listElement.children) {
|
|
31
|
-
if (item.type !== "element" || item.tag !== "text:list-item") continue;
|
|
32
|
-
for (const itemChild of item.children) {
|
|
33
|
-
if (itemChild.type !== "element") continue;
|
|
34
|
-
if (itemChild.tag === "text:p" || itemChild.tag === "text:h") blocks.push(readParagraphOrHeading(itemChild, pkg, context));
|
|
35
|
-
else if (itemChild.tag === "text:list") readListItems(itemChild, {
|
|
36
|
-
numId: context.numId,
|
|
37
|
-
level: context.level + 1
|
|
38
|
-
}, pkg, blocks);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
function resolveListKind(pkg, styleName) {
|
|
43
|
-
if (styleName === void 0) return void 0;
|
|
44
|
-
for (const partPath of AUTOMATIC_STYLE_PARTS) {
|
|
45
|
-
const part = pkg.parts[partPath];
|
|
46
|
-
if (part?.kind !== "xml") continue;
|
|
47
|
-
const root = require_xml_query.rootElement(part.nodes);
|
|
48
|
-
if (root === void 0) continue;
|
|
49
|
-
for (const containerTag of ["office:automatic-styles", "office:styles"]) {
|
|
50
|
-
const container = require_xml_query.findChildElement(root.children, containerTag);
|
|
51
|
-
if (container === void 0) continue;
|
|
52
|
-
const listStyle = require_xml_query.childrenWithTag(container, "text:list-style").find((el) => require_xml_query.attrValue(el, "style:name") === styleName);
|
|
53
|
-
if (listStyle === void 0) continue;
|
|
54
|
-
if (require_xml_query.childrenWithTag(listStyle, "text:list-level-style-number").some((el) => require_xml_query.attrValue(el, "text:level") === "1")) return "ordered";
|
|
55
|
-
if (require_xml_query.childrenWithTag(listStyle, "text:list-level-style-bullet").some((el) => require_xml_query.attrValue(el, "text:level") === "1")) return "bullet";
|
|
56
|
-
if (require_xml_query.childrenWithTag(listStyle, "text:list-level-style-image").some((el) => require_xml_query.attrValue(el, "text:level") === "1")) return "bullet";
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
29
|
function readBlocks(nodes, pkg, listIdState) {
|
|
62
30
|
const blocks = [];
|
|
63
31
|
for (const node of nodes) {
|
|
64
32
|
if (node.type !== "element") continue;
|
|
65
|
-
if (node.tag === "text:p" || node.tag === "text:h") blocks.push(readParagraphOrHeading(node, pkg
|
|
33
|
+
if (node.tag === "text:p" || node.tag === "text:h") blocks.push(readParagraphOrHeading(node, pkg));
|
|
66
34
|
else if (node.tag === "text:list") {
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
listIdState.next += 1;
|
|
70
|
-
readListItems(node, {
|
|
35
|
+
const numId = require_typed_shared_list.mintOdfListNumId(pkg, node, listIdState);
|
|
36
|
+
blocks.push(...require_typed_shared_list.readOdfListParagraphs(node, {
|
|
71
37
|
numId,
|
|
72
38
|
level: 0
|
|
73
|
-
},
|
|
39
|
+
}, (element) => readParagraphOrHeading(element, pkg)));
|
|
74
40
|
} else if (node.tag === "table:table") blocks.push(require_typed_shared_table.readOdfTable(node, pkg));
|
|
75
41
|
else if (node.tag === "text:section") blocks.push(...readBlocks(node.children, pkg, listIdState));
|
|
76
42
|
}
|
package/dist/typed/odt/read.js
CHANGED
|
@@ -3,6 +3,7 @@ import { attrValue, childrenWithTag, findChildElement, rootElement } from "../..
|
|
|
3
3
|
import { parseMargins, parsePageSize } from "../shared/geometry.js";
|
|
4
4
|
import { readOdfMetadata } from "../shared/metadata.js";
|
|
5
5
|
import { readOdfParagraph } from "../shared/paragraph.js";
|
|
6
|
+
import { mintOdfListNumId, readOdfListParagraphs } from "../shared/list.js";
|
|
6
7
|
import { readOdfTable } from "../shared/table.js";
|
|
7
8
|
import { PAGE_SIZE_A4 } from "document-schema.js";
|
|
8
9
|
//#region src/typed/odt/read.ts
|
|
@@ -15,61 +16,26 @@ function readOutlineLevel(headingElement) {
|
|
|
15
16
|
const parsed = Number.parseInt(raw, 10);
|
|
16
17
|
return Number.isInteger(parsed) && parsed > 0 ? parsed : 1;
|
|
17
18
|
}
|
|
18
|
-
function readParagraphOrHeading(element, pkg
|
|
19
|
+
function readParagraphOrHeading(element, pkg) {
|
|
19
20
|
const paragraph = readOdfParagraph(element, pkg);
|
|
20
21
|
if (element.tag === "text:h") {
|
|
21
22
|
const outlineLevel = readOutlineLevel(element);
|
|
22
23
|
paragraph.styleId = `Heading${outlineLevel}`;
|
|
23
24
|
paragraph.headingLevel = outlineLevel;
|
|
24
25
|
}
|
|
25
|
-
if (list !== void 0) paragraph.list = list;
|
|
26
26
|
return paragraph;
|
|
27
27
|
}
|
|
28
|
-
function readListItems(listElement, context, pkg, blocks) {
|
|
29
|
-
for (const item of listElement.children) {
|
|
30
|
-
if (item.type !== "element" || item.tag !== "text:list-item") continue;
|
|
31
|
-
for (const itemChild of item.children) {
|
|
32
|
-
if (itemChild.type !== "element") continue;
|
|
33
|
-
if (itemChild.tag === "text:p" || itemChild.tag === "text:h") blocks.push(readParagraphOrHeading(itemChild, pkg, context));
|
|
34
|
-
else if (itemChild.tag === "text:list") readListItems(itemChild, {
|
|
35
|
-
numId: context.numId,
|
|
36
|
-
level: context.level + 1
|
|
37
|
-
}, pkg, blocks);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
function resolveListKind(pkg, styleName) {
|
|
42
|
-
if (styleName === void 0) return void 0;
|
|
43
|
-
for (const partPath of AUTOMATIC_STYLE_PARTS) {
|
|
44
|
-
const part = pkg.parts[partPath];
|
|
45
|
-
if (part?.kind !== "xml") continue;
|
|
46
|
-
const root = rootElement(part.nodes);
|
|
47
|
-
if (root === void 0) continue;
|
|
48
|
-
for (const containerTag of ["office:automatic-styles", "office:styles"]) {
|
|
49
|
-
const container = findChildElement(root.children, containerTag);
|
|
50
|
-
if (container === void 0) continue;
|
|
51
|
-
const listStyle = childrenWithTag(container, "text:list-style").find((el) => attrValue(el, "style:name") === styleName);
|
|
52
|
-
if (listStyle === void 0) continue;
|
|
53
|
-
if (childrenWithTag(listStyle, "text:list-level-style-number").some((el) => attrValue(el, "text:level") === "1")) return "ordered";
|
|
54
|
-
if (childrenWithTag(listStyle, "text:list-level-style-bullet").some((el) => attrValue(el, "text:level") === "1")) return "bullet";
|
|
55
|
-
if (childrenWithTag(listStyle, "text:list-level-style-image").some((el) => attrValue(el, "text:level") === "1")) return "bullet";
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
28
|
function readBlocks(nodes, pkg, listIdState) {
|
|
61
29
|
const blocks = [];
|
|
62
30
|
for (const node of nodes) {
|
|
63
31
|
if (node.type !== "element") continue;
|
|
64
|
-
if (node.tag === "text:p" || node.tag === "text:h") blocks.push(readParagraphOrHeading(node, pkg
|
|
32
|
+
if (node.tag === "text:p" || node.tag === "text:h") blocks.push(readParagraphOrHeading(node, pkg));
|
|
65
33
|
else if (node.tag === "text:list") {
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
listIdState.next += 1;
|
|
69
|
-
readListItems(node, {
|
|
34
|
+
const numId = mintOdfListNumId(pkg, node, listIdState);
|
|
35
|
+
blocks.push(...readOdfListParagraphs(node, {
|
|
70
36
|
numId,
|
|
71
37
|
level: 0
|
|
72
|
-
},
|
|
38
|
+
}, (element) => readParagraphOrHeading(element, pkg)));
|
|
73
39
|
} else if (node.tag === "table:table") blocks.push(readOdfTable(node, pkg));
|
|
74
40
|
else if (node.tag === "text:section") blocks.push(...readBlocks(node.children, pkg, listIdState));
|
|
75
41
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_xml_query = require("../../xml/query.cjs");
|
|
3
|
+
//#region src/typed/shared/list.ts
|
|
4
|
+
function resolveOdfListKind(pkg, styleName) {
|
|
5
|
+
if (styleName === void 0) return void 0;
|
|
6
|
+
for (const partPath of ["content.xml", "styles.xml"]) {
|
|
7
|
+
const part = pkg.parts[partPath];
|
|
8
|
+
if (part?.kind !== "xml") continue;
|
|
9
|
+
const root = require_xml_query.rootElement(part.nodes);
|
|
10
|
+
if (root === void 0) continue;
|
|
11
|
+
for (const containerTag of ["office:automatic-styles", "office:styles"]) {
|
|
12
|
+
const container = require_xml_query.findChildElement(root.children, containerTag);
|
|
13
|
+
if (container === void 0) continue;
|
|
14
|
+
const listStyle = require_xml_query.childrenWithTag(container, "text:list-style").find((el) => require_xml_query.attrValue(el, "style:name") === styleName);
|
|
15
|
+
if (listStyle === void 0) continue;
|
|
16
|
+
if (require_xml_query.childrenWithTag(listStyle, "text:list-level-style-number").some((el) => require_xml_query.attrValue(el, "text:level") === "1")) return "ordered";
|
|
17
|
+
if (require_xml_query.childrenWithTag(listStyle, "text:list-level-style-bullet").some((el) => require_xml_query.attrValue(el, "text:level") === "1")) return "bullet";
|
|
18
|
+
if (require_xml_query.childrenWithTag(listStyle, "text:list-level-style-image").some((el) => require_xml_query.attrValue(el, "text:level") === "1")) return "bullet";
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function mintOdfListNumId(pkg, listElement, state) {
|
|
24
|
+
const kind = resolveOdfListKind(pkg, require_xml_query.attrValue(listElement, "text:style-name"));
|
|
25
|
+
const numId = kind !== void 0 ? `${kind}:list${state.next}` : `list${state.next}`;
|
|
26
|
+
state.next += 1;
|
|
27
|
+
return numId;
|
|
28
|
+
}
|
|
29
|
+
function readOdfListParagraphs(listElement, membership, readParagraph) {
|
|
30
|
+
const paragraphs = [];
|
|
31
|
+
for (const item of listElement.children) {
|
|
32
|
+
if (item.type !== "element" || item.tag !== "text:list-item") continue;
|
|
33
|
+
for (const itemChild of item.children) {
|
|
34
|
+
if (itemChild.type !== "element") continue;
|
|
35
|
+
if (itemChild.tag === "text:p" || itemChild.tag === "text:h") {
|
|
36
|
+
const paragraph = readParagraph(itemChild);
|
|
37
|
+
paragraph.list = membership;
|
|
38
|
+
paragraphs.push(paragraph);
|
|
39
|
+
} else if (itemChild.tag === "text:list") paragraphs.push(...readOdfListParagraphs(itemChild, {
|
|
40
|
+
numId: membership.numId,
|
|
41
|
+
level: membership.level + 1
|
|
42
|
+
}, readParagraph));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return paragraphs;
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
exports.mintOdfListNumId = mintOdfListNumId;
|
|
49
|
+
exports.readOdfListParagraphs = readOdfListParagraphs;
|
|
50
|
+
exports.resolveOdfListKind = resolveOdfListKind;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as resolveOdfListKind, i as readOdfListParagraphs, n as OdfListParagraphReader, r as mintOdfListNumId, t as OdfListIdState } from "../../list-C35tiDYU.cjs";
|
|
2
|
+
export { OdfListIdState, OdfListParagraphReader, mintOdfListNumId, readOdfListParagraphs, resolveOdfListKind };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as resolveOdfListKind, i as readOdfListParagraphs, n as OdfListParagraphReader, r as mintOdfListNumId, t as OdfListIdState } from "../../list-acGU0xLo.js";
|
|
2
|
+
export { OdfListIdState, OdfListParagraphReader, mintOdfListNumId, readOdfListParagraphs, resolveOdfListKind };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { attrValue, childrenWithTag, findChildElement, rootElement } from "../../xml/query.js";
|
|
2
|
+
//#region src/typed/shared/list.ts
|
|
3
|
+
function resolveOdfListKind(pkg, styleName) {
|
|
4
|
+
if (styleName === void 0) return void 0;
|
|
5
|
+
for (const partPath of ["content.xml", "styles.xml"]) {
|
|
6
|
+
const part = pkg.parts[partPath];
|
|
7
|
+
if (part?.kind !== "xml") continue;
|
|
8
|
+
const root = rootElement(part.nodes);
|
|
9
|
+
if (root === void 0) continue;
|
|
10
|
+
for (const containerTag of ["office:automatic-styles", "office:styles"]) {
|
|
11
|
+
const container = findChildElement(root.children, containerTag);
|
|
12
|
+
if (container === void 0) continue;
|
|
13
|
+
const listStyle = childrenWithTag(container, "text:list-style").find((el) => attrValue(el, "style:name") === styleName);
|
|
14
|
+
if (listStyle === void 0) continue;
|
|
15
|
+
if (childrenWithTag(listStyle, "text:list-level-style-number").some((el) => attrValue(el, "text:level") === "1")) return "ordered";
|
|
16
|
+
if (childrenWithTag(listStyle, "text:list-level-style-bullet").some((el) => attrValue(el, "text:level") === "1")) return "bullet";
|
|
17
|
+
if (childrenWithTag(listStyle, "text:list-level-style-image").some((el) => attrValue(el, "text:level") === "1")) return "bullet";
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function mintOdfListNumId(pkg, listElement, state) {
|
|
23
|
+
const kind = resolveOdfListKind(pkg, attrValue(listElement, "text:style-name"));
|
|
24
|
+
const numId = kind !== void 0 ? `${kind}:list${state.next}` : `list${state.next}`;
|
|
25
|
+
state.next += 1;
|
|
26
|
+
return numId;
|
|
27
|
+
}
|
|
28
|
+
function readOdfListParagraphs(listElement, membership, readParagraph) {
|
|
29
|
+
const paragraphs = [];
|
|
30
|
+
for (const item of listElement.children) {
|
|
31
|
+
if (item.type !== "element" || item.tag !== "text:list-item") continue;
|
|
32
|
+
for (const itemChild of item.children) {
|
|
33
|
+
if (itemChild.type !== "element") continue;
|
|
34
|
+
if (itemChild.tag === "text:p" || itemChild.tag === "text:h") {
|
|
35
|
+
const paragraph = readParagraph(itemChild);
|
|
36
|
+
paragraph.list = membership;
|
|
37
|
+
paragraphs.push(paragraph);
|
|
38
|
+
} else if (itemChild.tag === "text:list") paragraphs.push(...readOdfListParagraphs(itemChild, {
|
|
39
|
+
numId: membership.numId,
|
|
40
|
+
level: membership.level + 1
|
|
41
|
+
}, readParagraph));
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return paragraphs;
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
export { mintOdfListNumId, readOdfListParagraphs, resolveOdfListKind };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "odf.js",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Type-safe, lossless round-trip conversion between OpenDocument Format packages (odt, ods, odp) and JSON, hand-written and dependency-minimal, built on Zod 4 codecs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"license": "MIT",
|
|
78
78
|
"packageManager": "pnpm@11.6.0",
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"document-schema.js": "^
|
|
80
|
+
"document-schema.js": "^4.0.0",
|
|
81
81
|
"fast-xml-parser": "^5.10.1",
|
|
82
82
|
"fflate": "^0.8.3",
|
|
83
83
|
"zod": "^4.4.3"
|