odf.js 2.1.0 → 2.2.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 +3 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/typed/draw/embedded.cjs +10 -4
- package/dist/typed/draw/embedded.d.cts +1 -1
- package/dist/typed/draw/embedded.d.ts +1 -1
- package/dist/typed/draw/embedded.js +10 -4
- package/dist/typed/formula/read.cjs +1 -0
- package/dist/typed/formula/read.d.cts +3 -2
- package/dist/typed/formula/read.d.ts +3 -2
- package/dist/typed/formula/read.js +1 -1
- package/dist/typed/ods/read.cjs +7 -1
- package/dist/typed/ods/read.js +7 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -151,8 +151,9 @@ See the top of this README — the short version: `ooxml.js`'s branding and sign
|
|
|
151
151
|
- **Every `ContentShape`/`ContentVector` a drawing or presentation reader produces is now stamped with its own resolved `paintOrder`, not merely sorted by it and discarded.** `walkDrawPageContent` (odg) and `walkDrawShapes` (odp) both compute a real z-index per element — an explicit `draw:z-index` when present, otherwise a monotonic document-encounter counter — purely to order their own output arrays; that value is now attached to each produced value via the same single counter threaded across the whole walk. Because `shapes` and `vectors` are stamped from the identical counter, a caller can recover their true relative paint order across the two independently-ordered arrays by comparing `paintOrder` directly — closing the cross-array ordering gap `documents.js`'s own README previously described as unrecoverable, even though `ContentDrawPageSchema` itself still keeps the two arrays with no shared ordering field of its own.
|
|
152
152
|
- **`svg:fill-rule` (`nonzero`/`evenodd`) and `draw:stroke`'s `solid`/`dash` enumeration are now read and mapped onto `ContentVector`'s path-variant `fillRule` and `ContentStroke.style`.** Both mappings are confirmed against the OASIS schema reference rather than only against real-world producer output — `typed/draw/shapes.ts`'s own comment notes that a live-LibreOffice re-verification of `svg:fill-rule` specifically was blocked by the same headless-`soffice`-hang constraint `documents.js`'s own README documents. A genuinely dotted (as opposed to dashed) stroke pattern, and a `"double"` stroke style ODF's own vector-stroke model has no concept of at all, both remain unread — real, permanent boundaries rather than oversights (see that file's own comment for why each). The original test coverage for `svg:fill-rule` only ever exercised a single-loop `svg:d`, which cannot actually distinguish the two rules — there is nothing for `evenodd`'s alternating parity to differ from `nonzero`'s winding count with only one contour. `shapes.test.ts` now also covers a genuine two-subpath "letter O" donut shape (an outer square and an inner square hole, both wound in the same rotational direction), the real-world case the attribute exists for: `nonzero` would fill the hole solid (winding number 2, still non-zero) while `evenodd` correctly punches it (parity toggles to 0 inside), and the test confirms both subpaths, their `closed` flags, and the inner subpath's scaled points are read correctly alongside `fillRule` itself.
|
|
153
153
|
- **`readOds` and the shared `readTableCell` (odt/odp table cells) now resolve `fo:background-color`, the `fo:border`/`fo:border-(left|right|top|bottom)` shorthand-and-per-edge-override chain, `style:vertical-align`, and a cell style's own `style:paragraph-properties` `fo:text-align` from the real ODF style cascade**, populating `ContentSheetCell`/`ContentTableCell`'s `background`/`borders` (plus `ContentSheetCell`'s own `alignment`/`verticalAlignment`) rather than leaving them unpopulated. `readCellStyleDecoration` (`typed/shared/table.ts`) is the one fold both callers share: `readOds` resolves it over the full root-to-target `style:parent-style-name` chain (`resolveStyleElementChain`, confirmed against this package's own `kitchen-sink.ods` fixture's real `ce1`..`ce5` → `Default` chain), `readTableCell` over the single style element `findStyleElement` already resolves. An explicit `fo:border-*` override of `"none"`/`"hidden"` genuinely clears an inherited edge rather than merely leaving it unmentioned.
|
|
154
|
-
- **`readOds` now reads drawings anchored to a sheet, populating `ContentSheet.images` (previously hardcoded `[]`) and `ContentSheet.embeddedObjects` (previously never set), through the same `typed/draw/shapes.ts` primitives `readOdp`/`readOdg` already use.** ODF has exactly two spreadsheet anchoring conventions, both confirmed against real LibreOffice 26.2 output (`src/typed/ods/fixtures/sheet-anchors.ods`, built via a Java UNO client and never hand-edited): a **cell-anchored** `draw:frame` is a *direct child of the `table:table-cell` it is anchored to*, with `svg:x`/`svg:y` measured from **that cell's own top-left corner**; a **page-anchored** one sits in a `table:shapes` element (a child of `table:table` preceding its column definitions) with absolute sheet coordinates. The anchor cell reference is not read from any attribute at all — ODF cells have none (see the cursor gotchas above) — it is the same running `TableCursor` position `ContentSheetCell.row`/`column` already come from; a page-anchored image is reported against cell `(0, 0)`, whose own top-left *is* the sheet origin, so its absolute offsets carry through exactly rather than being approximated. A `draw:g` group is walked through, composing its own `draw:transform` via `readDrawFrame`'s existing `groupFunctions` parameter. What a sheet cannot carry is anything `ContentSheetSchema` has nowhere to put — a floating text box or table frame (no `shapes` array), a bare vector primitive (no `vectors` array), and an embedded
|
|
155
|
-
- **`readDrawObjectReference` (`typed/draw/embedded.ts`) is the new shared `draw:object` counterpart to `shapes.ts`'s existing `draw:image` handling**, resolving a frame's embedded-object reference into the sub-`Package` it names (via `subDocumentPackage`) plus the `ContentEmbeddedObjectKind` that sub-document actually is, read from its own `office:body` content child rather than from the manifest's declared media type — one signal, so the reported kind and the reader that produced the content agree by construction. It deliberately stops short of calling `readOdt`/`readOds`/`readOdp`/`readOdg` itself: doing so would import `readOds`, which imports this module. A real embedded-object frame also carries a `draw:image` preview of its own object (an `ObjectReplacements/` GDI metafile), so `draw:object` must be checked *before* a frame's image content — the same ordering, for the same reason, that `readDrawFrameContent` already applies to a table frame's preview image.
|
|
154
|
+
- **`readOds` now reads drawings anchored to a sheet, populating `ContentSheet.images` (previously hardcoded `[]`) and `ContentSheet.embeddedObjects` (previously never set), through the same `typed/draw/shapes.ts` primitives `readOdp`/`readOdg` already use.** ODF has exactly two spreadsheet anchoring conventions, both confirmed against real LibreOffice 26.2 output (`src/typed/ods/fixtures/sheet-anchors.ods`, built via a Java UNO client and never hand-edited): a **cell-anchored** `draw:frame` is a *direct child of the `table:table-cell` it is anchored to*, with `svg:x`/`svg:y` measured from **that cell's own top-left corner**; a **page-anchored** one sits in a `table:shapes` element (a child of `table:table` preceding its column definitions) with absolute sheet coordinates. The anchor cell reference is not read from any attribute at all — ODF cells have none (see the cursor gotchas above) — it is the same running `TableCursor` position `ContentSheetCell.row`/`column` already come from; a page-anchored image is reported against cell `(0, 0)`, whose own top-left *is* the sheet origin, so its absolute offsets carry through exactly rather than being approximated. A `draw:g` group is walked through, composing its own `draw:transform` via `readDrawFrame`'s existing `groupFunctions` parameter. What a sheet cannot carry is anything `ContentSheetSchema` has nowhere to put — a floating text box or table frame (no `shapes` array), a bare vector primitive (no `vectors` array), and an embedded **chart** object (`ContentEmbeddedObjectKind` has no `chart` member to map one onto) — each skipped rather than mapped onto an approximation of a different kind. An embedded **formula** object is no longer among them; see the bullet below.
|
|
155
|
+
- **`readDrawObjectReference` (`typed/draw/embedded.ts`) is the new shared `draw:object` counterpart to `shapes.ts`'s existing `draw:image` handling**, resolving a frame's embedded-object reference into the sub-`Package` it names (via `subDocumentPackage`) plus the `ContentEmbeddedObjectKind` that sub-document actually is, read from its own `content.xml` (the `office:body` content child, or — for a formula — a bare MathML root) rather than from the manifest's declared media type — one signal, so the reported kind and the reader that produced the content agree by construction. It deliberately stops short of calling `readOdt`/`readOds`/`readOdp`/`readOdg` itself: doing so would import `readOds`, which imports this module. A real embedded-object frame also carries a `draw:image` preview of its own object (an `ObjectReplacements/` GDI metafile), so `draw:object` must be checked *before* a frame's image content — the same ordering, for the same reason, that `readDrawFrameContent` already applies to a table frame's preview image.
|
|
156
|
+
- **An embedded LibreOffice Math object anchored to a spreadsheet cell now reads as a real `ContentEmbeddedObject` of `objectKind: 'formula'`, carrying a genuine `ContentDocument` formula payload rather than being skipped.** A formula sub-document is the one embedded kind with no `office:body` at all — its `content.xml` root *is* the MathML root — so `readDrawObjectReference` falls back to `typed/formula/read.ts`'s own `findMathRoot` (reused, not restated) whenever the `office:body` path resolves nothing, and `readOds` dispatches the resulting reference to `readOdfFormulaDocument`, the same function the standalone `.odf` path already uses. `document-schema.js` 2.2.0 is what makes this representable at all: its `ContentDocument` union carries a real `'formula'` variant, and its `ContentEmbeddedObject` gained the same `anchorRow`/`anchorColumn`/`offsetXPt`/`offsetYPt` quartet `ContentSheetImage` already had — so an embedded object's anchor cell is now recorded exactly as an anchored image's is, for *every* embedded kind, not just formulas. Confirmed against real, unmodified LibreOffice 26.2 output (`src/typed/ods/fixtures/sheet-formula.ods`, a Calc sheet built via a Java UNO client with a `com.sun.star.drawing.OLE2Shape` carrying Math's own CLSID and a real StarMath `Formula` property, anchored to cell C4, never hand-edited): the outer manifest declares `Object 1/` as `application/vnd.oasis.opendocument.formula`, that sub-document ships **no `meta.xml` of its own**, and its `content.xml` is the same bare `<math>` root with a default MathML `xmlns` `typed/formula/read.ts` already documents for a standalone `.odf`.
|
|
156
157
|
- **A `draw:frame`'s alternative text (`svg:title`, falling back to `svg:desc`) is now read into `ContentImageBlock.altText` for every format**, not just spreadsheets. Both are plain-text *child elements* of `draw:frame` itself, not attributes — confirmed against real LibreOffice output, where a Calc image's UNO `Title`/`Description` properties round-trip as `<svg:title>`/`<svg:desc>` siblings of the frame's own `draw:image`.
|
|
157
158
|
- **`readOdfFormulaDocument` now wraps a formula's raw MathML into a real `document-schema.js` `ContentDocument` of kind `'formula'`**, alongside (not instead of) this package's own pre-existing bespoke `OdfFormulaDocument` shape from `readOdfFormula`, which is unchanged. `document-schema.js` 2.0.0 added the `MathMlNode`/`ContentFormula` pivot specifically for this — a structural mirror of this package's own `XmlNode` that `readOdfFormula`'s existing return value assigns into with zero cast.
|
|
158
159
|
- **`readOdbInventory`'s `queries` now carry each query's real `db:command` SQL text (plus `db:escape-processing` when declared) instead of only a bare name.** `OdbInventory.queries` is now `OdbQueryInfo[]` (`{ name, command, escapeProcessing? }`), a breaking rename from the previous `string[]` — a query's own `db:command` is already inline in `content.xml`, unlike a form/report/table's real content, which lives in a separate sub-document or database engine this reader never opens, so the "content lives elsewhere, only names are read" rule that correctly applies to those does not hold for a query. `db:command` is entity-decoded before being returned, matching every other typed reader's convention.
|
package/dist/index.cjs
CHANGED
|
@@ -34,13 +34,13 @@ const require_typed_shared_transform = require("./typed/shared/transform.cjs");
|
|
|
34
34
|
const require_typed_shared_masterpage = require("./typed/shared/masterpage.cjs");
|
|
35
35
|
const require_typed_shared_path = require("./typed/shared/path.cjs");
|
|
36
36
|
const require_typed_draw_shapes = require("./typed/draw/shapes.cjs");
|
|
37
|
+
const require_typed_formula_read = require("./typed/formula/read.cjs");
|
|
37
38
|
const require_typed_odb_subdocument = require("./typed/odb/subdocument.cjs");
|
|
38
39
|
const require_typed_draw_embedded = require("./typed/draw/embedded.cjs");
|
|
39
40
|
const require_typed_odp_read = require("./typed/odp/read.cjs");
|
|
40
41
|
const require_typed_odt_read = require("./typed/odt/read.cjs");
|
|
41
42
|
const require_typed_odg_read = require("./typed/odg/read.cjs");
|
|
42
43
|
const require_typed_ods_read = require("./typed/ods/read.cjs");
|
|
43
|
-
const require_typed_formula_read = require("./typed/formula/read.cjs");
|
|
44
44
|
const require_typed_odm_read = require("./typed/odm/read.cjs");
|
|
45
45
|
const require_typed_odb_read = require("./typed/odb/read.cjs");
|
|
46
46
|
const require_typed_odb_form = require("./typed/odb/form.cjs");
|
package/dist/index.js
CHANGED
|
@@ -33,13 +33,13 @@ import { applyOdfTransform, composeOdfGroupTransform, netRotationDeg, parseOdfTr
|
|
|
33
33
|
import { resolveDrawPageSize, resolvePageLayoutProperties } from "./typed/shared/masterpage.js";
|
|
34
34
|
import { buildOdfSubpaths, parseOdfPathData, parseOdfPointsList, parseOdfViewBox, rawSubpathFromPoints, scaleOdfRawPoint } from "./typed/shared/path.js";
|
|
35
35
|
import { readDrawFrame, readDrawPageContent, walkDrawShapes } from "./typed/draw/shapes.js";
|
|
36
|
+
import { readOdfFormula, readOdfFormulaDocument } from "./typed/formula/read.js";
|
|
36
37
|
import { subDocumentPackage } from "./typed/odb/subdocument.js";
|
|
37
38
|
import { readDrawObjectReference } from "./typed/draw/embedded.js";
|
|
38
39
|
import { readOdp } from "./typed/odp/read.js";
|
|
39
40
|
import { readOdt } from "./typed/odt/read.js";
|
|
40
41
|
import { readOdg } from "./typed/odg/read.js";
|
|
41
42
|
import { readOds } from "./typed/ods/read.js";
|
|
42
|
-
import { readOdfFormula, readOdfFormulaDocument } from "./typed/formula/read.js";
|
|
43
43
|
import { readOdm } from "./typed/odm/read.js";
|
|
44
44
|
import { readOdbInventory, resolveOdbComponent } from "./typed/odb/read.js";
|
|
45
45
|
import { readOdbForm } from "./typed/odb/form.js";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_xml_query = require("../../xml/query.cjs");
|
|
3
|
+
const require_typed_formula_read = require("../formula/read.cjs");
|
|
3
4
|
const require_typed_odb_subdocument = require("../odb/subdocument.cjs");
|
|
4
5
|
//#region src/typed/draw/embedded.ts
|
|
5
6
|
const CONTENT_PART = "content.xml";
|
|
@@ -12,6 +13,14 @@ function embeddedKindFor(bodyChildTag) {
|
|
|
12
13
|
default: return;
|
|
13
14
|
}
|
|
14
15
|
}
|
|
16
|
+
function subDocumentKind(nodes) {
|
|
17
|
+
const root = require_xml_query.rootElement(nodes);
|
|
18
|
+
const body = root === void 0 ? void 0 : require_xml_query.findChildElement(root.children, "office:body");
|
|
19
|
+
const bodyChild = body === void 0 ? void 0 : require_xml_query.rootElement(body.children);
|
|
20
|
+
const bodyKind = bodyChild === void 0 ? void 0 : embeddedKindFor(bodyChild.tag);
|
|
21
|
+
if (bodyKind !== void 0) return bodyKind;
|
|
22
|
+
return require_typed_formula_read.findMathRoot(nodes) === void 0 ? void 0 : "formula";
|
|
23
|
+
}
|
|
15
24
|
function normaliseObjectHref(raw) {
|
|
16
25
|
const withoutPrefix = raw.startsWith("./") ? raw.slice(2) : raw;
|
|
17
26
|
const trimmed = withoutPrefix.endsWith("/") ? withoutPrefix.slice(0, -1) : withoutPrefix;
|
|
@@ -27,10 +36,7 @@ function readDrawObjectReference(frame, pkg) {
|
|
|
27
36
|
const subPackage = require_typed_odb_subdocument.subDocumentPackage(pkg, href, { allowMissingContent: true });
|
|
28
37
|
const contentPart = subPackage.parts[CONTENT_PART];
|
|
29
38
|
if (contentPart?.kind !== "xml") return;
|
|
30
|
-
const
|
|
31
|
-
const body = root === void 0 ? void 0 : require_xml_query.findChildElement(root.children, "office:body");
|
|
32
|
-
const bodyChild = body === void 0 ? void 0 : require_xml_query.rootElement(body.children);
|
|
33
|
-
const objectKind = bodyChild === void 0 ? void 0 : embeddedKindFor(bodyChild.tag);
|
|
39
|
+
const objectKind = subDocumentKind(contentPart.nodes);
|
|
34
40
|
if (objectKind === void 0) return;
|
|
35
41
|
return {
|
|
36
42
|
objectKind,
|
|
@@ -2,7 +2,7 @@ import { l as XmlElement } from "../../node-CkBWRjNR.cjs";
|
|
|
2
2
|
import { Package } from "../../model/package.cjs";
|
|
3
3
|
import { ContentEmbeddedObjectKind } from "document-schema.js";
|
|
4
4
|
//#region src/typed/draw/embedded.d.ts
|
|
5
|
-
type EmbeddedDocumentKind =
|
|
5
|
+
type EmbeddedDocumentKind = ContentEmbeddedObjectKind;
|
|
6
6
|
interface EmbeddedDrawObject {
|
|
7
7
|
objectKind: EmbeddedDocumentKind;
|
|
8
8
|
package: Package;
|
|
@@ -2,7 +2,7 @@ import { l as XmlElement } from "../../node-CkBWRjNR.js";
|
|
|
2
2
|
import { Package } from "../../model/package.js";
|
|
3
3
|
import { ContentEmbeddedObjectKind } from "document-schema.js";
|
|
4
4
|
//#region src/typed/draw/embedded.d.ts
|
|
5
|
-
type EmbeddedDocumentKind =
|
|
5
|
+
type EmbeddedDocumentKind = ContentEmbeddedObjectKind;
|
|
6
6
|
interface EmbeddedDrawObject {
|
|
7
7
|
objectKind: EmbeddedDocumentKind;
|
|
8
8
|
package: Package;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { attrValue, childrenWithTag, findChildElement, rootElement } from "../../xml/query.js";
|
|
2
|
+
import { findMathRoot } from "../formula/read.js";
|
|
2
3
|
import { subDocumentPackage } from "../odb/subdocument.js";
|
|
3
4
|
//#region src/typed/draw/embedded.ts
|
|
4
5
|
const CONTENT_PART = "content.xml";
|
|
@@ -11,6 +12,14 @@ function embeddedKindFor(bodyChildTag) {
|
|
|
11
12
|
default: return;
|
|
12
13
|
}
|
|
13
14
|
}
|
|
15
|
+
function subDocumentKind(nodes) {
|
|
16
|
+
const root = rootElement(nodes);
|
|
17
|
+
const body = root === void 0 ? void 0 : findChildElement(root.children, "office:body");
|
|
18
|
+
const bodyChild = body === void 0 ? void 0 : rootElement(body.children);
|
|
19
|
+
const bodyKind = bodyChild === void 0 ? void 0 : embeddedKindFor(bodyChild.tag);
|
|
20
|
+
if (bodyKind !== void 0) return bodyKind;
|
|
21
|
+
return findMathRoot(nodes) === void 0 ? void 0 : "formula";
|
|
22
|
+
}
|
|
14
23
|
function normaliseObjectHref(raw) {
|
|
15
24
|
const withoutPrefix = raw.startsWith("./") ? raw.slice(2) : raw;
|
|
16
25
|
const trimmed = withoutPrefix.endsWith("/") ? withoutPrefix.slice(0, -1) : withoutPrefix;
|
|
@@ -26,10 +35,7 @@ function readDrawObjectReference(frame, pkg) {
|
|
|
26
35
|
const subPackage = subDocumentPackage(pkg, href, { allowMissingContent: true });
|
|
27
36
|
const contentPart = subPackage.parts[CONTENT_PART];
|
|
28
37
|
if (contentPart?.kind !== "xml") return;
|
|
29
|
-
const
|
|
30
|
-
const body = root === void 0 ? void 0 : findChildElement(root.children, "office:body");
|
|
31
|
-
const bodyChild = body === void 0 ? void 0 : rootElement(body.children);
|
|
32
|
-
const objectKind = bodyChild === void 0 ? void 0 : embeddedKindFor(bodyChild.tag);
|
|
38
|
+
const objectKind = subDocumentKind(contentPart.nodes);
|
|
33
39
|
if (objectKind === void 0) return;
|
|
34
40
|
return {
|
|
35
41
|
objectKind,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as XmlNode } from "../../node-CkBWRjNR.cjs";
|
|
1
|
+
import { d as XmlNode, l as XmlElement } from "../../node-CkBWRjNR.cjs";
|
|
2
2
|
import { Package } from "../../model/package.cjs";
|
|
3
3
|
import { ContentDocument, LayoutMetadata } from "document-schema.js";
|
|
4
4
|
//#region src/typed/formula/read.d.ts
|
|
@@ -7,7 +7,8 @@ interface OdfFormulaDocument {
|
|
|
7
7
|
mathml: XmlNode[];
|
|
8
8
|
metadata: LayoutMetadata;
|
|
9
9
|
}
|
|
10
|
+
declare function findMathRoot(nodes: readonly XmlNode[]): XmlElement | undefined;
|
|
10
11
|
declare function readOdfFormula(pkg: Package): OdfFormulaDocument;
|
|
11
12
|
declare function readOdfFormulaDocument(pkg: Package): ContentDocument;
|
|
12
13
|
//#endregion
|
|
13
|
-
export { OdfFormulaDocument, readOdfFormula, readOdfFormulaDocument };
|
|
14
|
+
export { OdfFormulaDocument, findMathRoot, readOdfFormula, readOdfFormulaDocument };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as XmlNode } from "../../node-CkBWRjNR.js";
|
|
1
|
+
import { d as XmlNode, l as XmlElement } from "../../node-CkBWRjNR.js";
|
|
2
2
|
import { Package } from "../../model/package.js";
|
|
3
3
|
import { ContentDocument, LayoutMetadata } from "document-schema.js";
|
|
4
4
|
//#region src/typed/formula/read.d.ts
|
|
@@ -7,7 +7,8 @@ interface OdfFormulaDocument {
|
|
|
7
7
|
mathml: XmlNode[];
|
|
8
8
|
metadata: LayoutMetadata;
|
|
9
9
|
}
|
|
10
|
+
declare function findMathRoot(nodes: readonly XmlNode[]): XmlElement | undefined;
|
|
10
11
|
declare function readOdfFormula(pkg: Package): OdfFormulaDocument;
|
|
11
12
|
declare function readOdfFormulaDocument(pkg: Package): ContentDocument;
|
|
12
13
|
//#endregion
|
|
13
|
-
export { OdfFormulaDocument, readOdfFormula, readOdfFormulaDocument };
|
|
14
|
+
export { OdfFormulaDocument, findMathRoot, readOdfFormula, readOdfFormulaDocument };
|
package/dist/typed/ods/read.cjs
CHANGED
|
@@ -10,6 +10,7 @@ const require_typed_shared_table = require("../shared/table.cjs");
|
|
|
10
10
|
const require_typed_shared_transform = require("../shared/transform.cjs");
|
|
11
11
|
const require_typed_shared_masterpage = require("../shared/masterpage.cjs");
|
|
12
12
|
const require_typed_draw_shapes = require("../draw/shapes.cjs");
|
|
13
|
+
const require_typed_formula_read = require("../formula/read.cjs");
|
|
13
14
|
const require_typed_draw_embedded = require("../draw/embedded.cjs");
|
|
14
15
|
const require_typed_odp_read = require("../odp/read.cjs");
|
|
15
16
|
const require_typed_odt_read = require("../odt/read.cjs");
|
|
@@ -200,6 +201,7 @@ function readEmbeddedObjectDocument(reference) {
|
|
|
200
201
|
sheets
|
|
201
202
|
};
|
|
202
203
|
}
|
|
204
|
+
case "formula": return require_typed_formula_read.readOdfFormulaDocument(reference.package);
|
|
203
205
|
}
|
|
204
206
|
}
|
|
205
207
|
function collectAnchoredFrame(frameElement, groupFunctions, pkg, anchorRow, anchorColumn, images, embeddedObjects) {
|
|
@@ -210,7 +212,11 @@ function collectAnchoredFrame(frameElement, groupFunctions, pkg, anchorRow, anch
|
|
|
210
212
|
embeddedObjects.push({
|
|
211
213
|
objectKind: reference.objectKind,
|
|
212
214
|
document: readEmbeddedObjectDocument(reference),
|
|
213
|
-
frame: shape.frame
|
|
215
|
+
frame: shape.frame,
|
|
216
|
+
anchorRow,
|
|
217
|
+
anchorColumn,
|
|
218
|
+
offsetXPt: shape.frame.xPt,
|
|
219
|
+
offsetYPt: shape.frame.yPt
|
|
214
220
|
});
|
|
215
221
|
return;
|
|
216
222
|
}
|
package/dist/typed/ods/read.js
CHANGED
|
@@ -9,6 +9,7 @@ import { readCellStyleDecoration } from "../shared/table.js";
|
|
|
9
9
|
import { parseOdfTransform } from "../shared/transform.js";
|
|
10
10
|
import { resolvePageLayoutProperties } from "../shared/masterpage.js";
|
|
11
11
|
import { readDrawFrame } from "../draw/shapes.js";
|
|
12
|
+
import { readOdfFormulaDocument } from "../formula/read.js";
|
|
12
13
|
import { readDrawObjectReference } from "../draw/embedded.js";
|
|
13
14
|
import { readOdp } from "../odp/read.js";
|
|
14
15
|
import { readOdt } from "../odt/read.js";
|
|
@@ -199,6 +200,7 @@ function readEmbeddedObjectDocument(reference) {
|
|
|
199
200
|
sheets
|
|
200
201
|
};
|
|
201
202
|
}
|
|
203
|
+
case "formula": return readOdfFormulaDocument(reference.package);
|
|
202
204
|
}
|
|
203
205
|
}
|
|
204
206
|
function collectAnchoredFrame(frameElement, groupFunctions, pkg, anchorRow, anchorColumn, images, embeddedObjects) {
|
|
@@ -209,7 +211,11 @@ function collectAnchoredFrame(frameElement, groupFunctions, pkg, anchorRow, anch
|
|
|
209
211
|
embeddedObjects.push({
|
|
210
212
|
objectKind: reference.objectKind,
|
|
211
213
|
document: readEmbeddedObjectDocument(reference),
|
|
212
|
-
frame: shape.frame
|
|
214
|
+
frame: shape.frame,
|
|
215
|
+
anchorRow,
|
|
216
|
+
anchorColumn,
|
|
217
|
+
offsetXPt: shape.frame.xPt,
|
|
218
|
+
offsetYPt: shape.frame.yPt
|
|
213
219
|
});
|
|
214
220
|
return;
|
|
215
221
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "odf.js",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.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": {
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"license": "MIT",
|
|
70
70
|
"packageManager": "pnpm@11.6.0",
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"document-schema.js": "^2.
|
|
72
|
+
"document-schema.js": "^2.2.0",
|
|
73
73
|
"fast-xml-parser": "^5.10.1",
|
|
74
74
|
"fflate": "^0.8.3",
|
|
75
75
|
"zod": "^4.4.3"
|