odf.js 6.4.1 → 7.1.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 +1 -1
- package/dist/{codec-DTAgph2r.d.ts → codec-BVEK7_Sf.d.ts} +1 -1
- package/dist/{codec-CFdlbFLJ.d.cts → codec-aKINptZk.d.cts} +1 -1
- package/dist/codec.d.cts +1 -1
- package/dist/codec.d.ts +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/{table-XuniPr2I.d.ts → table-B_LX8Dgy.d.ts} +2 -2
- package/dist/{table-CECMtPxZ.d.cts → table-DWTKLvxt.d.cts} +2 -2
- package/dist/typed/ods/write.cjs +10 -2
- package/dist/typed/ods/write.js +11 -3
- package/dist/typed/shared/canonicalise.cjs +9 -1
- package/dist/typed/shared/canonicalise.d.cts +3 -2
- package/dist/typed/shared/canonicalise.d.ts +3 -2
- package/dist/typed/shared/canonicalise.js +10 -3
- package/dist/typed/shared/table.cjs +7 -2
- package/dist/typed/shared/table.d.cts +1 -1
- package/dist/typed/shared/table.d.ts +1 -1
- package/dist/typed/shared/table.js +7 -2
- package/package.json +8 -2
package/README.md
CHANGED
|
@@ -451,7 +451,7 @@ Layered from a lossless core outward, mirroring `ooxml.js`:
|
|
|
451
451
|
- **A rotated `draw:rect`/`ellipse`/`path`/`custom-shape` reads its own `rotationDeg`** via the same `resolveOdfShapeGeometry` machinery `draw:frame` uses, composing any enclosing `draw:g` rotation.
|
|
452
452
|
- **Every `ContentShape`/`ContentVector` carries a resolved `paintOrder`** so true relative paint order survives across the independently-ordered `shapes`/`vectors` arrays.
|
|
453
453
|
- **`svg:fill-rule` and `draw:stroke` map onto `ContentVector.fillRule`/`ContentStroke.style`.** A dotted pattern and `"double"` stroke have no ODF vector-stroke counterpart and remain unread.
|
|
454
|
-
- **`readOdsContent`/`readTableCell` resolve cell `background`/`borders`/`alignment`/`verticalAlignment` from the real style cascade.** An explicit `fo:border-*` of `"none"`/`"hidden"` clears an inherited edge.
|
|
454
|
+
- **`readOdsContent`/`readTableCell` resolve cell `background`/`borders`/`alignment`/`verticalAlignment` from the real style cascade.** An explicit `fo:border-*` of `"none"`/`"hidden"` clears an inherited edge. A cell's own `background` always reads back as a `'solid'` `ContentCellFill` (ExaDev/documents.js#951): `fo:background-color` is a flat OASIS colour attribute with no two-colour pattern-fill vocabulary at all, unlike WordprocessingML's `w:shd` or SpreadsheetML's `patternFill`. Writing a `'pattern'` fill therefore approximates through `resolveCellFillColor`'s own single representative colour (its foreground, falling back to its background) rather than refusing outright, since a flat approximation is strictly more useful than dropping the fill entirely for a format that genuinely cannot state one.
|
|
455
455
|
- **`readOdsContent` reads sheet-anchored drawings** — cell-anchored `draw:frame`s (coordinates relative to the cell) and page-anchored ones (in `table:shapes`). An embedded chart resolves as a `chart`-kind object whose document is a frame-sized drawing page carrying the chart's own cached data table, with the `chart:chart` element quarantined in residue. A sheet cannot carry a floating text box or bare vector; each is skipped.
|
|
456
456
|
- **`readDrawObjectReference` resolves a frame's embedded sub-document kind from its own `content.xml`, not the manifest.** A `draw:object` must be checked _before_ the frame's preview image, since an embedded-object frame also carries a preview `draw:image`.
|
|
457
457
|
|
|
@@ -19,7 +19,7 @@ import "./cascade-PDS3hgrP.js";
|
|
|
19
19
|
import "./metadata-BUzwE_-u.js";
|
|
20
20
|
import "./list-7FO0SDqZ.js";
|
|
21
21
|
import "./paragraph-DtC86tft.js";
|
|
22
|
-
import "./table-
|
|
22
|
+
import "./table-B_LX8Dgy.js";
|
|
23
23
|
import "./scaffold-ehGsIpZ5.js";
|
|
24
24
|
import "./transform-BFNc16LQ.js";
|
|
25
25
|
import "./masterpage-BLK2OJ9q.js";
|
|
@@ -19,7 +19,7 @@ import "./cascade-BpMwrjkB.cjs";
|
|
|
19
19
|
import "./metadata-CYXgXL_h.cjs";
|
|
20
20
|
import "./list-BorrTJBY.cjs";
|
|
21
21
|
import "./paragraph-Bf6Iq5wC.cjs";
|
|
22
|
-
import "./table-
|
|
22
|
+
import "./table-DWTKLvxt.cjs";
|
|
23
23
|
import "./scaffold-44EIMGll.cjs";
|
|
24
24
|
import "./transform-M1gbHp4j.cjs";
|
|
25
25
|
import "./masterpage-KqZshNGZ.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-aKINptZk.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-BVEK7_Sf.js";
|
|
2
2
|
export { decodePackage, encodePackage, packageCodec, xmlCodec };
|
package/dist/index.d.cts
CHANGED
|
@@ -27,7 +27,7 @@ import { a as resolveStyle, i as findStyleElement, n as StyleCascadeResult, o as
|
|
|
27
27
|
import { i as writeOdfMetadata, n as buildOdfMetaNodes, r as readOdfMetadata, t as META_PART } from "./metadata-CYXgXL_h.cjs";
|
|
28
28
|
import { a as OdfListParagraphReader, f as readOdfListParagraphs, i as OdfListIdState, m as writeOdfList, o as buildOdfListStyle, p as resolveOdfListKind, r as OdfListEntry, u as mintOdfListNumId } from "./list-BorrTJBY.cjs";
|
|
29
29
|
import { c as segmentOdfParagraphRuns, i as odfRunProperties, l as writeOdfParagraph, n as OdfParagraphWriteOptions, o as readOdfParagraph, r as odfParagraphProperties } from "./paragraph-Bf6Iq5wC.cjs";
|
|
30
|
-
import { c as writeOdfTable, s as readOdfTable } from "./table-
|
|
30
|
+
import { c as writeOdfTable, s as readOdfTable } from "./table-DWTKLvxt.cjs";
|
|
31
31
|
import { n as createOdfPackage, r as odfPartContainer, t as DEFAULT_ODF_VERSION } from "./scaffold-44EIMGll.cjs";
|
|
32
32
|
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-M1gbHp4j.cjs";
|
|
33
33
|
import { n as resolveDrawPageSize, r as resolvePageLayoutProperties } from "./masterpage-KqZshNGZ.cjs";
|
|
@@ -55,5 +55,5 @@ import { n as transformToOoo1Package, t as transformOoo1Package } from "./transf
|
|
|
55
55
|
import { a as readSxi, c as readSxwContent, i as readSxdContent, n as readSxcContent, o as readSxiContent, r as readSxd, s as readSxw, t as readSxc } from "./read-BgnLFuSi.cjs";
|
|
56
56
|
import { a as writeSxi, c as writeSxwContent, i as writeSxdContent, n as writeSxcContent, o as writeSxiContent, r as writeSxd, s as writeSxw, t as writeSxc } from "./write-BZXpT8F6.cjs";
|
|
57
57
|
import { a as OdbReportGroup, i as OdbReportFunction, n as OdbReportBand, o as readOdbReport, r as OdbReportElement, t as OdbReport } from "./report-39DyUx5W.cjs";
|
|
58
|
-
import { a as Alignment, i as xmlCodec, n as encodePackage, o as AlignmentSchema, r as packageCodec, s as DocumentTree, t as decodePackage } from "./codec-
|
|
58
|
+
import { a as Alignment, i as xmlCodec, n as encodePackage, o as AlignmentSchema, r as packageCodec, s as DocumentTree, t as decodePackage } from "./codec-aKINptZk.cjs";
|
|
59
59
|
export { type Alignment, AlignmentSchema, type Attribute, AttributeSchema, type BinaryPart, BinaryPartSchema, type BuildManifestOptions, type CascadeDiagnostic, DEFAULT_ODF_VERSION, type DocumentTree, 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, OOO1_MEDIA_TYPES, OOO1_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 OdfListEntry, type OdfListIdState, type OdfListParagraphReader, type OdfNamespacePrefix, type OdfParagraphWriteOptions, type OdfPoint, type OdfRawPoint, type OdfRawSegment, type OdfRawSubpath, type OdfShapeGeometry, type OdfTextSegment, type OdfTextSegmentKind, type OdfTransformFunction, type OdfViewBox, type OdgDocument, type OdgWriteOptions, type OdmDocument, type OdmSection, type OdpDocument, type OdpWriteOptions, type OdsDocument, type OdsWriteOptions, type OdtDocument, type OdtHeaderFooterPart, type OdtHeaderFooterVariant, type OdtReadOptions, type OdtWriteOptions, type Ooo1Extension, type Ooo1NamespacePrefix, 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, buildOdfInlineNodes, buildOdfListStyle, buildOdfMetaNodes, buildOdfSubpaths, buildStylePropertyElements, buildXml, bytesToBase64, canonicalPropertiesString, cellReference, childrenWithTag, columnIndexToLetters, columnLettersToIndex, composeOdfGroupTransform, createOdfPackage, decodeOdfText, decodePackage, decodeXmlText, el, elementsWithTag, encodePackage, encodeXmlText, ensureSpan, findChildElement, findStyleElement, formatOdfColor, formatOdfLength, formatOdfNumber, formatOdfPathData, formatOdfViewBox, formatPercentageMultiplier, formatPt, getOdfSpaceCount, isOoo1NamespacePrefix, isOoo1Package, isStyleFamily, isXmlNode, measureOdfNodeLength, mediaTypeForExtension, mintOdfListNumId, netRotationDeg, normaliseOdgContent, normaliseOdpContent, normaliseOdsContent, normaliseOdtContent, odfMediaTypeForOoo1MediaType, odfParagraphProperties, odfPartContainer, odfRunProperties, ooo1MediaTypeForExtension, ooo1MediaTypeForOdfMediaType, 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, readOdfFormControlConstructs, readOdfFormDefinitions, readOdfFormula, readOdfFormulaContent, readOdfFormulaMathMl, readOdfListParagraphs, readOdfMetadata, readOdfParagraph, readOdfTable, readOdg, readOdgContent, readOdm, readOdp, readOdpContent, readOds, readOdsContent, readOdt, readOdtContent, readSxc, readSxcContent, readSxd, readSxdContent, readSxi, readSxiContent, readSxw, readSxwContent, resolveDrawPageSize, resolveOdbComponent, resolveOdfListKind, resolveOdfShapeGeometry, resolvePageLayoutProperties, resolveStyle, resolveStyleElementChain, rootElement, scaleOdfRawPoint, segmentOdfParagraphRuns, segmentOdfText, serializePackage, setDocumentMediaType, sniffImageFormat, subDocumentPackage, sumOdfNodeLength, syncManifest, textPropertiesToAttributes, transformOoo1Package, transformToOoo1Package, txt, unzipPackage, validateManifest, walkDrawShapes, writeDrawFrame, writeDrawShapes, writeDrawVector, writeDrawVectors, writeManifest, writeMimetype, writeOdfList, writeOdfMetadata, writeOdfParagraph, writeOdfTable, writeOdg, writeOdgContent, writeOdp, writeOdpContent, writeOds, writeOdsContent, writeOdt, writeOdtContent, writeSxc, writeSxcContent, writeSxd, writeSxdContent, writeSxi, writeSxiContent, writeSxw, writeSxwContent, xmlCodec, xmlnsAttributes, zipPackage };
|
package/dist/index.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ import { a as resolveStyle, i as findStyleElement, n as StyleCascadeResult, o as
|
|
|
27
27
|
import { i as writeOdfMetadata, n as buildOdfMetaNodes, r as readOdfMetadata, t as META_PART } from "./metadata-BUzwE_-u.js";
|
|
28
28
|
import { a as OdfListParagraphReader, f as readOdfListParagraphs, i as OdfListIdState, m as writeOdfList, o as buildOdfListStyle, p as resolveOdfListKind, r as OdfListEntry, u as mintOdfListNumId } from "./list-7FO0SDqZ.js";
|
|
29
29
|
import { c as segmentOdfParagraphRuns, i as odfRunProperties, l as writeOdfParagraph, n as OdfParagraphWriteOptions, o as readOdfParagraph, r as odfParagraphProperties } from "./paragraph-DtC86tft.js";
|
|
30
|
-
import { c as writeOdfTable, s as readOdfTable } from "./table-
|
|
30
|
+
import { c as writeOdfTable, s as readOdfTable } from "./table-B_LX8Dgy.js";
|
|
31
31
|
import { n as createOdfPackage, r as odfPartContainer, t as DEFAULT_ODF_VERSION } from "./scaffold-ehGsIpZ5.js";
|
|
32
32
|
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-BFNc16LQ.js";
|
|
33
33
|
import { n as resolveDrawPageSize, r as resolvePageLayoutProperties } from "./masterpage-BLK2OJ9q.js";
|
|
@@ -55,5 +55,5 @@ import { n as transformToOoo1Package, t as transformOoo1Package } from "./transf
|
|
|
55
55
|
import { a as readSxi, c as readSxwContent, i as readSxdContent, n as readSxcContent, o as readSxiContent, r as readSxd, s as readSxw, t as readSxc } from "./read-CqaZ01kU.js";
|
|
56
56
|
import { a as writeSxi, c as writeSxwContent, i as writeSxdContent, n as writeSxcContent, o as writeSxiContent, r as writeSxd, s as writeSxw, t as writeSxc } from "./write-SKnCTU4C.js";
|
|
57
57
|
import { a as OdbReportGroup, i as OdbReportFunction, n as OdbReportBand, o as readOdbReport, r as OdbReportElement, t as OdbReport } from "./report-x9RuNwmr.js";
|
|
58
|
-
import { a as Alignment, i as xmlCodec, n as encodePackage, o as AlignmentSchema, r as packageCodec, s as DocumentTree, t as decodePackage } from "./codec-
|
|
58
|
+
import { a as Alignment, i as xmlCodec, n as encodePackage, o as AlignmentSchema, r as packageCodec, s as DocumentTree, t as decodePackage } from "./codec-BVEK7_Sf.js";
|
|
59
59
|
export { type Alignment, AlignmentSchema, type Attribute, AttributeSchema, type BinaryPart, BinaryPartSchema, type BuildManifestOptions, type CascadeDiagnostic, DEFAULT_ODF_VERSION, type DocumentTree, 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, OOO1_MEDIA_TYPES, OOO1_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 OdfListEntry, type OdfListIdState, type OdfListParagraphReader, type OdfNamespacePrefix, type OdfParagraphWriteOptions, type OdfPoint, type OdfRawPoint, type OdfRawSegment, type OdfRawSubpath, type OdfShapeGeometry, type OdfTextSegment, type OdfTextSegmentKind, type OdfTransformFunction, type OdfViewBox, type OdgDocument, type OdgWriteOptions, type OdmDocument, type OdmSection, type OdpDocument, type OdpWriteOptions, type OdsDocument, type OdsWriteOptions, type OdtDocument, type OdtHeaderFooterPart, type OdtHeaderFooterVariant, type OdtReadOptions, type OdtWriteOptions, type Ooo1Extension, type Ooo1NamespacePrefix, 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, buildOdfInlineNodes, buildOdfListStyle, buildOdfMetaNodes, buildOdfSubpaths, buildStylePropertyElements, buildXml, bytesToBase64, canonicalPropertiesString, cellReference, childrenWithTag, columnIndexToLetters, columnLettersToIndex, composeOdfGroupTransform, createOdfPackage, decodeOdfText, decodePackage, decodeXmlText, el, elementsWithTag, encodePackage, encodeXmlText, ensureSpan, findChildElement, findStyleElement, formatOdfColor, formatOdfLength, formatOdfNumber, formatOdfPathData, formatOdfViewBox, formatPercentageMultiplier, formatPt, getOdfSpaceCount, isOoo1NamespacePrefix, isOoo1Package, isStyleFamily, isXmlNode, measureOdfNodeLength, mediaTypeForExtension, mintOdfListNumId, netRotationDeg, normaliseOdgContent, normaliseOdpContent, normaliseOdsContent, normaliseOdtContent, odfMediaTypeForOoo1MediaType, odfParagraphProperties, odfPartContainer, odfRunProperties, ooo1MediaTypeForExtension, ooo1MediaTypeForOdfMediaType, 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, readOdfFormControlConstructs, readOdfFormDefinitions, readOdfFormula, readOdfFormulaContent, readOdfFormulaMathMl, readOdfListParagraphs, readOdfMetadata, readOdfParagraph, readOdfTable, readOdg, readOdgContent, readOdm, readOdp, readOdpContent, readOds, readOdsContent, readOdt, readOdtContent, readSxc, readSxcContent, readSxd, readSxdContent, readSxi, readSxiContent, readSxw, readSxwContent, resolveDrawPageSize, resolveOdbComponent, resolveOdfListKind, resolveOdfShapeGeometry, resolvePageLayoutProperties, resolveStyle, resolveStyleElementChain, rootElement, scaleOdfRawPoint, segmentOdfParagraphRuns, segmentOdfText, serializePackage, setDocumentMediaType, sniffImageFormat, subDocumentPackage, sumOdfNodeLength, syncManifest, textPropertiesToAttributes, transformOoo1Package, transformToOoo1Package, txt, unzipPackage, validateManifest, walkDrawShapes, writeDrawFrame, writeDrawShapes, writeDrawVector, writeDrawVectors, writeManifest, writeMimetype, writeOdfList, writeOdfMetadata, writeOdfParagraph, writeOdfTable, writeOdg, writeOdgContent, writeOdp, writeOdpContent, writeOds, writeOdsContent, writeOdt, writeOdtContent, writeSxc, writeSxcContent, writeSxd, writeSxdContent, writeSxi, writeSxiContent, writeSxw, writeSxwContent, xmlCodec, xmlnsAttributes, zipPackage };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { l as XmlElement } from "./node-B6JX5CRX.js";
|
|
2
2
|
import { r as Package } from "./package-otZYrxiO.js";
|
|
3
3
|
import { a as StyleRegistry } from "./registry-C_16-N6i.js";
|
|
4
|
-
import { Alignment,
|
|
4
|
+
import { Alignment, ContentBorder, ContentCellBorders, ContentCellFill, ContentTable } from "document-schema.js";
|
|
5
5
|
//#region src/typed/shared/table.d.ts
|
|
6
6
|
type BorderEdgeKey = "left" | "right" | "top" | "bottom";
|
|
7
7
|
declare const BORDER_EDGE_KEYS: readonly BorderEdgeKey[];
|
|
8
8
|
declare const BORDER_EDGE_ATTRS: Readonly<Record<BorderEdgeKey, string>>;
|
|
9
9
|
interface CellStyleDecoration {
|
|
10
|
-
background?:
|
|
10
|
+
background?: ContentCellFill;
|
|
11
11
|
borders?: ContentCellBorders;
|
|
12
12
|
alignment?: Alignment;
|
|
13
13
|
verticalAlignment?: "top" | "middle" | "bottom";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { l as XmlElement } from "./node-B6JX5CRX.cjs";
|
|
2
2
|
import { r as Package } from "./package-DMk9fuTI.cjs";
|
|
3
3
|
import { a as StyleRegistry } from "./registry-PoQIRgbY.cjs";
|
|
4
|
-
import { Alignment,
|
|
4
|
+
import { Alignment, ContentBorder, ContentCellBorders, ContentCellFill, ContentTable } from "document-schema.js";
|
|
5
5
|
//#region src/typed/shared/table.d.ts
|
|
6
6
|
type BorderEdgeKey = "left" | "right" | "top" | "bottom";
|
|
7
7
|
declare const BORDER_EDGE_KEYS: readonly BorderEdgeKey[];
|
|
8
8
|
declare const BORDER_EDGE_ATTRS: Readonly<Record<BorderEdgeKey, string>>;
|
|
9
9
|
interface CellStyleDecoration {
|
|
10
|
-
background?:
|
|
10
|
+
background?: ContentCellFill;
|
|
11
11
|
borders?: ContentCellBorders;
|
|
12
12
|
alignment?: Alignment;
|
|
13
13
|
verticalAlignment?: "top" | "middle" | "bottom";
|
package/dist/typed/ods/write.cjs
CHANGED
|
@@ -95,7 +95,8 @@ function writeCellParagraphs(cell, registry) {
|
|
|
95
95
|
}
|
|
96
96
|
function sheetCellStyle(cell, registry) {
|
|
97
97
|
const cellProperties = {};
|
|
98
|
-
|
|
98
|
+
const backgroundColor = cell.background === void 0 ? void 0 : (0, document_schema_js.resolveCellFillColor)(cell.background);
|
|
99
|
+
if (backgroundColor !== void 0) cellProperties["fo:background-color"] = require_typed_shared_color.formatOdfColor(backgroundColor);
|
|
99
100
|
if (cell.borders !== void 0) for (const edge of require_typed_shared_table.BORDER_EDGE_KEYS) {
|
|
100
101
|
const border = cell.borders[edge];
|
|
101
102
|
if (border !== void 0) cellProperties[require_typed_shared_table.BORDER_EDGE_ATTRS[edge]] = require_typed_shared_table.formatBorderEdge(border);
|
|
@@ -357,6 +358,13 @@ function writeSheet(sheet, state) {
|
|
|
357
358
|
function canonicalColor(color) {
|
|
358
359
|
return (0, document_schema_js.rgbHexToColor)((0, document_schema_js.colorToRgbHex)(color));
|
|
359
360
|
}
|
|
361
|
+
function canonicalCellFill(fill) {
|
|
362
|
+
const color = (0, document_schema_js.resolveCellFillColor)(fill);
|
|
363
|
+
return color === void 0 ? void 0 : {
|
|
364
|
+
kind: "solid",
|
|
365
|
+
color: canonicalColor(color)
|
|
366
|
+
};
|
|
367
|
+
}
|
|
360
368
|
function canonicalRun(run) {
|
|
361
369
|
const canonical = { text: run.text };
|
|
362
370
|
if (run.bold !== void 0) canonical.bold = run.bold;
|
|
@@ -431,7 +439,7 @@ function canonicalCell(cell) {
|
|
|
431
439
|
if (runs.length > 0) canonical.runs = runs;
|
|
432
440
|
if (cell.colSpan !== void 0) canonical.colSpan = cell.colSpan;
|
|
433
441
|
if (cell.rowSpan !== void 0) canonical.rowSpan = cell.rowSpan;
|
|
434
|
-
if (cell.background !== void 0) canonical.background =
|
|
442
|
+
if (cell.background !== void 0) canonical.background = canonicalCellFill(cell.background);
|
|
435
443
|
if (cell.borders !== void 0) {
|
|
436
444
|
const borders = {};
|
|
437
445
|
for (const edge of require_typed_shared_table.BORDER_EDGE_KEYS) {
|
package/dist/typed/ods/write.js
CHANGED
|
@@ -12,7 +12,7 @@ import { BORDER_EDGE_ATTRS, BORDER_EDGE_KEYS, formatBorderEdge } from "../shared
|
|
|
12
12
|
import { createOdfPackage, odfPartContainer } from "../../package-io/scaffold.js";
|
|
13
13
|
import { imageExtension } from "../shared/image.js";
|
|
14
14
|
import "../../embedded-BnavfkP-.js";
|
|
15
|
-
import { colorToRgbHex, flattenTree, rgbHexToColor } from "document-schema.js";
|
|
15
|
+
import { colorToRgbHex, flattenTree, resolveCellFillColor, rgbHexToColor } from "document-schema.js";
|
|
16
16
|
//#region src/typed/ods/write.ts
|
|
17
17
|
const CONTENT_PART = "content.xml";
|
|
18
18
|
const STYLES_PART = "styles.xml";
|
|
@@ -94,7 +94,8 @@ function writeCellParagraphs(cell, registry) {
|
|
|
94
94
|
}
|
|
95
95
|
function sheetCellStyle(cell, registry) {
|
|
96
96
|
const cellProperties = {};
|
|
97
|
-
|
|
97
|
+
const backgroundColor = cell.background === void 0 ? void 0 : resolveCellFillColor(cell.background);
|
|
98
|
+
if (backgroundColor !== void 0) cellProperties["fo:background-color"] = formatOdfColor(backgroundColor);
|
|
98
99
|
if (cell.borders !== void 0) for (const edge of BORDER_EDGE_KEYS) {
|
|
99
100
|
const border = cell.borders[edge];
|
|
100
101
|
if (border !== void 0) cellProperties[BORDER_EDGE_ATTRS[edge]] = formatBorderEdge(border);
|
|
@@ -356,6 +357,13 @@ function writeSheet(sheet, state) {
|
|
|
356
357
|
function canonicalColor(color) {
|
|
357
358
|
return rgbHexToColor(colorToRgbHex(color));
|
|
358
359
|
}
|
|
360
|
+
function canonicalCellFill(fill) {
|
|
361
|
+
const color = resolveCellFillColor(fill);
|
|
362
|
+
return color === void 0 ? void 0 : {
|
|
363
|
+
kind: "solid",
|
|
364
|
+
color: canonicalColor(color)
|
|
365
|
+
};
|
|
366
|
+
}
|
|
359
367
|
function canonicalRun(run) {
|
|
360
368
|
const canonical = { text: run.text };
|
|
361
369
|
if (run.bold !== void 0) canonical.bold = run.bold;
|
|
@@ -430,7 +438,7 @@ function canonicalCell(cell) {
|
|
|
430
438
|
if (runs.length > 0) canonical.runs = runs;
|
|
431
439
|
if (cell.colSpan !== void 0) canonical.colSpan = cell.colSpan;
|
|
432
440
|
if (cell.rowSpan !== void 0) canonical.rowSpan = cell.rowSpan;
|
|
433
|
-
if (cell.background !== void 0) canonical.background =
|
|
441
|
+
if (cell.background !== void 0) canonical.background = canonicalCellFill(cell.background);
|
|
434
442
|
if (cell.borders !== void 0) {
|
|
435
443
|
const borders = {};
|
|
436
444
|
for (const edge of BORDER_EDGE_KEYS) {
|
|
@@ -8,6 +8,13 @@ function unsupportedContent(what, where) {
|
|
|
8
8
|
function canonicalColor(color) {
|
|
9
9
|
return (0, document_schema_js.rgbHexToColor)((0, document_schema_js.colorToRgbHex)(color));
|
|
10
10
|
}
|
|
11
|
+
function canonicalCellFill(fill) {
|
|
12
|
+
const color = (0, document_schema_js.resolveCellFillColor)(fill);
|
|
13
|
+
return color === void 0 ? void 0 : {
|
|
14
|
+
kind: "solid",
|
|
15
|
+
color: canonicalColor(color)
|
|
16
|
+
};
|
|
17
|
+
}
|
|
11
18
|
function canonicalRun(run) {
|
|
12
19
|
const canonical = { text: run.text };
|
|
13
20
|
if (run.bold !== void 0) canonical.bold = run.bold;
|
|
@@ -52,7 +59,7 @@ function canonicalCell(cell, covered) {
|
|
|
52
59
|
}) };
|
|
53
60
|
if (cell.colSpan !== void 0) canonical.colSpan = cell.colSpan;
|
|
54
61
|
if (cell.rowSpan !== void 0) canonical.rowSpan = cell.rowSpan;
|
|
55
|
-
if (cell.background !== void 0) canonical.background =
|
|
62
|
+
if (cell.background !== void 0) canonical.background = canonicalCellFill(cell.background);
|
|
56
63
|
if (cell.borders !== void 0) {
|
|
57
64
|
const borders = {};
|
|
58
65
|
for (const edge of [
|
|
@@ -118,6 +125,7 @@ function canonicalImage(image) {
|
|
|
118
125
|
return canonical;
|
|
119
126
|
}
|
|
120
127
|
//#endregion
|
|
128
|
+
exports.canonicalCellFill = canonicalCellFill;
|
|
121
129
|
exports.canonicalColor = canonicalColor;
|
|
122
130
|
exports.canonicalImage = canonicalImage;
|
|
123
131
|
exports.canonicalMetadata = canonicalMetadata;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { Color, ContentImageBlock, ContentParagraph, ContentRun, ContentTable, LayoutMetadata } from "document-schema.js";
|
|
1
|
+
import { Color, ContentCellFill, ContentImageBlock, ContentParagraph, ContentRun, ContentTable, LayoutMetadata } from "document-schema.js";
|
|
2
2
|
//#region src/typed/shared/canonicalise.d.ts
|
|
3
3
|
declare function canonicalColor(color: Color): Color;
|
|
4
|
+
declare function canonicalCellFill(fill: ContentCellFill): ContentCellFill | undefined;
|
|
4
5
|
declare function canonicalRun(run: ContentRun): ContentRun;
|
|
5
6
|
declare function canonicalParagraph(paragraph: ContentParagraph, listNumId: string | undefined): ContentParagraph;
|
|
6
7
|
declare function canonicalTable(table: ContentTable): ContentTable;
|
|
7
8
|
declare function canonicalMetadata(metadata: LayoutMetadata): LayoutMetadata;
|
|
8
9
|
declare function canonicalImage(image: ContentImageBlock): ContentImageBlock;
|
|
9
10
|
//#endregion
|
|
10
|
-
export { canonicalColor, canonicalImage, canonicalMetadata, canonicalParagraph, canonicalRun, canonicalTable };
|
|
11
|
+
export { canonicalCellFill, canonicalColor, canonicalImage, canonicalMetadata, canonicalParagraph, canonicalRun, canonicalTable };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { Color, ContentImageBlock, ContentParagraph, ContentRun, ContentTable, LayoutMetadata } from "document-schema.js";
|
|
1
|
+
import { Color, ContentCellFill, ContentImageBlock, ContentParagraph, ContentRun, ContentTable, LayoutMetadata } from "document-schema.js";
|
|
2
2
|
//#region src/typed/shared/canonicalise.d.ts
|
|
3
3
|
declare function canonicalColor(color: Color): Color;
|
|
4
|
+
declare function canonicalCellFill(fill: ContentCellFill): ContentCellFill | undefined;
|
|
4
5
|
declare function canonicalRun(run: ContentRun): ContentRun;
|
|
5
6
|
declare function canonicalParagraph(paragraph: ContentParagraph, listNumId: string | undefined): ContentParagraph;
|
|
6
7
|
declare function canonicalTable(table: ContentTable): ContentTable;
|
|
7
8
|
declare function canonicalMetadata(metadata: LayoutMetadata): LayoutMetadata;
|
|
8
9
|
declare function canonicalImage(image: ContentImageBlock): ContentImageBlock;
|
|
9
10
|
//#endregion
|
|
10
|
-
export { canonicalColor, canonicalImage, canonicalMetadata, canonicalParagraph, canonicalRun, canonicalTable };
|
|
11
|
+
export { canonicalCellFill, canonicalColor, canonicalImage, canonicalMetadata, canonicalParagraph, canonicalRun, canonicalTable };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { segmentOdfParagraphRuns } from "./paragraph.js";
|
|
2
|
-
import { colorToRgbHex, rgbHexToColor } from "document-schema.js";
|
|
2
|
+
import { colorToRgbHex, resolveCellFillColor, rgbHexToColor } from "document-schema.js";
|
|
3
3
|
//#region src/typed/shared/canonicalise.ts
|
|
4
4
|
function unsupportedContent(what, where) {
|
|
5
5
|
return /* @__PURE__ */ new Error(`${where} carries ${what}, which no ODF writer in this package can produce yet -- refusing to state a canonical form for content that would be silently lost on write. See ExaDev/documents.js for the tracked follow-up covering the fidelity constructs and embedded objects.`);
|
|
@@ -7,6 +7,13 @@ function unsupportedContent(what, where) {
|
|
|
7
7
|
function canonicalColor(color) {
|
|
8
8
|
return rgbHexToColor(colorToRgbHex(color));
|
|
9
9
|
}
|
|
10
|
+
function canonicalCellFill(fill) {
|
|
11
|
+
const color = resolveCellFillColor(fill);
|
|
12
|
+
return color === void 0 ? void 0 : {
|
|
13
|
+
kind: "solid",
|
|
14
|
+
color: canonicalColor(color)
|
|
15
|
+
};
|
|
16
|
+
}
|
|
10
17
|
function canonicalRun(run) {
|
|
11
18
|
const canonical = { text: run.text };
|
|
12
19
|
if (run.bold !== void 0) canonical.bold = run.bold;
|
|
@@ -51,7 +58,7 @@ function canonicalCell(cell, covered) {
|
|
|
51
58
|
}) };
|
|
52
59
|
if (cell.colSpan !== void 0) canonical.colSpan = cell.colSpan;
|
|
53
60
|
if (cell.rowSpan !== void 0) canonical.rowSpan = cell.rowSpan;
|
|
54
|
-
if (cell.background !== void 0) canonical.background =
|
|
61
|
+
if (cell.background !== void 0) canonical.background = canonicalCellFill(cell.background);
|
|
55
62
|
if (cell.borders !== void 0) {
|
|
56
63
|
const borders = {};
|
|
57
64
|
for (const edge of [
|
|
@@ -117,4 +124,4 @@ function canonicalImage(image) {
|
|
|
117
124
|
return canonical;
|
|
118
125
|
}
|
|
119
126
|
//#endregion
|
|
120
|
-
export { canonicalColor, canonicalImage, canonicalMetadata, canonicalParagraph, canonicalRun, canonicalTable };
|
|
127
|
+
export { canonicalCellFill, canonicalColor, canonicalImage, canonicalMetadata, canonicalParagraph, canonicalRun, canonicalTable };
|
|
@@ -6,6 +6,7 @@ const require_typed_shared_color = require("./color.cjs");
|
|
|
6
6
|
const require_xml_query = require("../../xml/query.cjs");
|
|
7
7
|
const require_typed_shared_cascade = require("./cascade.cjs");
|
|
8
8
|
const require_typed_shared_paragraph = require("./paragraph.cjs");
|
|
9
|
+
let document_schema_js = require("document-schema.js");
|
|
9
10
|
//#region src/typed/shared/table.ts
|
|
10
11
|
function readRepeatCount(element, attrName) {
|
|
11
12
|
const raw = require_xml_query.attrValue(element, attrName);
|
|
@@ -110,7 +111,10 @@ function readCellStyleDecoration(elements) {
|
|
|
110
111
|
if (textAlignValue === "left" || textAlignValue === "center" || textAlignValue === "right" || textAlignValue === "justify") alignment = textAlignValue;
|
|
111
112
|
}
|
|
112
113
|
return {
|
|
113
|
-
background
|
|
114
|
+
background: background === void 0 ? void 0 : {
|
|
115
|
+
kind: "solid",
|
|
116
|
+
color: background
|
|
117
|
+
},
|
|
114
118
|
borders: bordersFromAccumulated(borderAccumulator),
|
|
115
119
|
alignment,
|
|
116
120
|
verticalAlignment
|
|
@@ -175,7 +179,8 @@ function formatBorderEdge(border) {
|
|
|
175
179
|
}
|
|
176
180
|
function tableCellStyle(cell, registry) {
|
|
177
181
|
const attributes = {};
|
|
178
|
-
|
|
182
|
+
const backgroundColor = cell.background === void 0 ? void 0 : (0, document_schema_js.resolveCellFillColor)(cell.background);
|
|
183
|
+
if (backgroundColor !== void 0) attributes["fo:background-color"] = require_typed_shared_color.formatOdfColor(backgroundColor);
|
|
179
184
|
const borders = cell.borders;
|
|
180
185
|
if (borders !== void 0) for (const edge of BORDER_EDGE_KEYS) {
|
|
181
186
|
const border = borders[edge];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as formatBorderEdge, c as writeOdfTable, i as CellStyleDecoration, n as BORDER_EDGE_KEYS, o as readCellStyleDecoration, r as BorderEdgeKey, s as readOdfTable, t as BORDER_EDGE_ATTRS } from "../../table-
|
|
1
|
+
import { a as formatBorderEdge, c as writeOdfTable, i as CellStyleDecoration, n as BORDER_EDGE_KEYS, o as readCellStyleDecoration, r as BorderEdgeKey, s as readOdfTable, t as BORDER_EDGE_ATTRS } from "../../table-DWTKLvxt.cjs";
|
|
2
2
|
export { BORDER_EDGE_ATTRS, BORDER_EDGE_KEYS, BorderEdgeKey, CellStyleDecoration, formatBorderEdge, readCellStyleDecoration, readOdfTable, writeOdfTable };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as formatBorderEdge, c as writeOdfTable, i as CellStyleDecoration, n as BORDER_EDGE_KEYS, o as readCellStyleDecoration, r as BorderEdgeKey, s as readOdfTable, t as BORDER_EDGE_ATTRS } from "../../table-
|
|
1
|
+
import { a as formatBorderEdge, c as writeOdfTable, i as CellStyleDecoration, n as BORDER_EDGE_KEYS, o as readCellStyleDecoration, r as BorderEdgeKey, s as readOdfTable, t as BORDER_EDGE_ATTRS } from "../../table-B_LX8Dgy.js";
|
|
2
2
|
export { BORDER_EDGE_ATTRS, BORDER_EDGE_KEYS, BorderEdgeKey, CellStyleDecoration, formatBorderEdge, readCellStyleDecoration, readOdfTable, writeOdfTable };
|
|
@@ -5,6 +5,7 @@ import { formatOdfColor, parseOdfColor } from "./color.js";
|
|
|
5
5
|
import { attrValue, childrenWithTag } from "../../xml/query.js";
|
|
6
6
|
import { findStyleElement } from "./cascade.js";
|
|
7
7
|
import { readOdfParagraph, readParagraphOrHeading, writeOdfParagraph } from "./paragraph.js";
|
|
8
|
+
import { resolveCellFillColor } from "document-schema.js";
|
|
8
9
|
//#region src/typed/shared/table.ts
|
|
9
10
|
function readRepeatCount(element, attrName) {
|
|
10
11
|
const raw = attrValue(element, attrName);
|
|
@@ -109,7 +110,10 @@ function readCellStyleDecoration(elements) {
|
|
|
109
110
|
if (textAlignValue === "left" || textAlignValue === "center" || textAlignValue === "right" || textAlignValue === "justify") alignment = textAlignValue;
|
|
110
111
|
}
|
|
111
112
|
return {
|
|
112
|
-
background
|
|
113
|
+
background: background === void 0 ? void 0 : {
|
|
114
|
+
kind: "solid",
|
|
115
|
+
color: background
|
|
116
|
+
},
|
|
113
117
|
borders: bordersFromAccumulated(borderAccumulator),
|
|
114
118
|
alignment,
|
|
115
119
|
verticalAlignment
|
|
@@ -174,7 +178,8 @@ function formatBorderEdge(border) {
|
|
|
174
178
|
}
|
|
175
179
|
function tableCellStyle(cell, registry) {
|
|
176
180
|
const attributes = {};
|
|
177
|
-
|
|
181
|
+
const backgroundColor = cell.background === void 0 ? void 0 : resolveCellFillColor(cell.background);
|
|
182
|
+
if (backgroundColor !== void 0) attributes["fo:background-color"] = formatOdfColor(backgroundColor);
|
|
178
183
|
const borders = cell.borders;
|
|
179
184
|
if (borders !== void 0) for (const edge of BORDER_EDGE_KEYS) {
|
|
180
185
|
const border = borders[edge];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "odf.js",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"description": "Type-safe, lossless round-trip conversion between OpenDocument Format packages (odt, ods, odp) and JSON, plus read support for the pre-OASIS OpenOffice.org 1.x documents ODF was based on (sxw, sxc, sxi, sxd), hand-written and dependency-minimal, built on Zod 4 codecs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -61,6 +61,8 @@
|
|
|
61
61
|
"test:watch": "vitest --project unit",
|
|
62
62
|
"test:coverage": "turbo run _test:coverage",
|
|
63
63
|
"_test:coverage": "vitest run --project unit --coverage",
|
|
64
|
+
"test:mutation": "turbo run _test:mutation",
|
|
65
|
+
"_test:mutation": "stryker run stryker.config.mjs",
|
|
64
66
|
"test:smoke": "turbo run _test:smoke",
|
|
65
67
|
"_test:smoke": "vitest run --project smoke",
|
|
66
68
|
"prepare": "husky",
|
|
@@ -85,7 +87,7 @@
|
|
|
85
87
|
"license": "MIT",
|
|
86
88
|
"packageManager": "pnpm@11.6.0",
|
|
87
89
|
"dependencies": {
|
|
88
|
-
"document-schema.js": "^
|
|
90
|
+
"document-schema.js": "^6.1.0",
|
|
89
91
|
"fast-xml-parser": "^5.10.1",
|
|
90
92
|
"fflate": "^0.8.3",
|
|
91
93
|
"zod": "^4.4.3"
|
|
@@ -93,10 +95,14 @@
|
|
|
93
95
|
"devDependencies": {
|
|
94
96
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
95
97
|
"@cloudflare/vitest-pool-workers": "^0.20.2",
|
|
98
|
+
"@stryker-mutator/core": "^10.0.0",
|
|
99
|
+
"@stryker-mutator/typescript-checker": "^10.0.0",
|
|
100
|
+
"@stryker-mutator/vitest-runner": "^10.0.0",
|
|
96
101
|
"@types/node": "^26.1.1",
|
|
97
102
|
"@vitest/coverage-v8": "^4.1.10",
|
|
98
103
|
"eslint": "^10.8.0",
|
|
99
104
|
"husky": "^9.1.7",
|
|
105
|
+
"jiti": "2.7.0",
|
|
100
106
|
"publint": "^0.3.21",
|
|
101
107
|
"semantic-release": "^25.0.8",
|
|
102
108
|
"tsdown": "^0.22.13",
|