odf.js 1.13.2 → 2.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.
Files changed (44) hide show
  1. package/README.md +19 -4
  2. package/dist/index.cjs +10 -0
  3. package/dist/index.d.cts +7 -3
  4. package/dist/index.d.ts +7 -3
  5. package/dist/index.js +7 -3
  6. package/dist/ns.cjs +2 -1
  7. package/dist/ns.d.cts +1 -0
  8. package/dist/ns.d.ts +1 -0
  9. package/dist/ns.js +2 -1
  10. package/dist/typed/draw/embedded.cjs +42 -0
  11. package/dist/typed/draw/embedded.d.cts +13 -0
  12. package/dist/typed/draw/embedded.d.ts +13 -0
  13. package/dist/typed/draw/embedded.js +41 -0
  14. package/dist/typed/draw/shapes.cjs +86 -30
  15. package/dist/typed/draw/shapes.d.cts +4 -1
  16. package/dist/typed/draw/shapes.d.ts +4 -1
  17. package/dist/typed/draw/shapes.js +86 -30
  18. package/dist/typed/formula/read.cjs +14 -0
  19. package/dist/typed/formula/read.d.cts +3 -2
  20. package/dist/typed/formula/read.d.ts +3 -2
  21. package/dist/typed/formula/read.js +14 -1
  22. package/dist/typed/odb/form.cjs +85 -0
  23. package/dist/typed/odb/form.d.cts +31 -0
  24. package/dist/typed/odb/form.d.ts +31 -0
  25. package/dist/typed/odb/form.js +84 -0
  26. package/dist/typed/odb/read.cjs +60 -23
  27. package/dist/typed/odb/read.d.cts +15 -4
  28. package/dist/typed/odb/read.d.ts +15 -4
  29. package/dist/typed/odb/read.js +60 -24
  30. package/dist/typed/odb/report.cjs +161 -0
  31. package/dist/typed/odb/report.d.cts +48 -0
  32. package/dist/typed/odb/report.d.ts +48 -0
  33. package/dist/typed/odb/report.js +160 -0
  34. package/dist/typed/odb/subdocument.cjs +16 -0
  35. package/dist/typed/odb/subdocument.d.cts +8 -0
  36. package/dist/typed/odb/subdocument.d.ts +8 -0
  37. package/dist/typed/odb/subdocument.js +15 -0
  38. package/dist/typed/ods/read.cjs +98 -4
  39. package/dist/typed/ods/read.js +100 -6
  40. package/dist/typed/shared/table.cjs +94 -7
  41. package/dist/typed/shared/table.d.cts +9 -2
  42. package/dist/typed/shared/table.d.ts +9 -2
  43. package/dist/typed/shared/table.js +94 -8
  44. package/package.json +1 -1
package/README.md CHANGED
@@ -51,13 +51,16 @@ This package is under active development. What's built and shipped:
51
51
  - **Namespaces, media types, mimetype, manifest** (`src/ns.ts`, `src/media-type.ts`, `src/mimetype.ts`, `src/manifest.ts`) — full read *and* write, including `META-INF/manifest.xml`'s exhaustive per-part enumeration and the mimetype part's mandatory first-entry/stored/uncompressed byte layout, verified against real LibreOffice-produced output.
52
52
  - **Style interning** (`src/styles/`) — `StyleRegistry`: adopts a part's existing automatic styles on construction, finds-or-mints on `intern()`, fingerprints on canonical serialized properties plus parent style name (never `JSON.stringify`), and is collision-checked across all four style containers a document can have.
53
53
  - **Shared typed primitives** (`src/typed/shared/`) — ODF length-unit parsing (`cm`/`mm`/`in`/`pt`/`pc`/`px`), A1-style spreadsheet cell-reference computation with repeat-count cursor advancement, colour/geometry/master-page-size parsing into `document-schema.js`'s own types, ODF's `text:s`/`text:tab`/`text:line-break` whitespace-run decoding, the read-side style cascade (`style:default-style` → parent chain → the referenced style — one layer shorter than OOXML's, since ODF has no separate direct-formatting layer on top), the shared `text:p` → `ContentParagraph`/`ContentRun` and `table:table` → `ContentTable` readers (`readOdfParagraph`/`readOdfTable`) every typed reader below builds on, the `draw:transform`/`draw:g` group-flattening geometry resolver, an `svg:d`/`draw:points` vector-path grammar parser, and `meta.xml` reading.
54
- - **Typed readers** — `readOdt` (wordprocessing), `readOdp` (presentation slides: `draw:frame`/`draw:g` text/image/table content), `readOdg` (drawing pages: every vector primitive — `draw:rect`/`draw:ellipse`/`draw:circle`/`draw:line`/`draw:path`/`draw:polygon`/`draw:polyline`, plus a recognised `draw:custom-shape` preset subset — in real `draw:z-index`-aware paint order), and `readOds` (spreadsheets: geometry- and print-settings-rich, every `office:value-type` variant with its own OpenFormula string) each resolve a `Package` into `document-schema.js`'s own `ContentSection`/`ContentSlide`/`ContentDrawPage`/`ContentSheet` shapes.
55
- - **`readOdfFormula`** resolves a standalone or embedded `.odf` formula's `content.xml` — bare MathML with no `office:document-content` wrapper, confirmed against real LibreOffice output — into its raw MathML nodes plus, when present, the formula's own native StarMath annotation string. There is no `document-schema.js` pivot type for MathML, so this reader's own output type is its own.
54
+ - **Typed readers** — `readOdt` (wordprocessing), `readOdp` (presentation slides: `draw:frame`/`draw:g` text/image/table content), `readOdg` (drawing pages: every vector primitive — `draw:rect`/`draw:ellipse`/`draw:circle`/`draw:line`/`draw:path`/`draw:polygon`/`draw:polyline`, plus a recognised `draw:custom-shape` preset subset — in real `draw:z-index`-aware paint order), and `readOds` (spreadsheets: geometry- and print-settings-rich, every `office:value-type` variant with its own OpenFormula string, plus cell- and page-anchored `draw:frame` images and embedded ODF sub-documents) each resolve a `Package` into `document-schema.js`'s own `ContentSection`/`ContentSlide`/`ContentDrawPage`/`ContentSheet` shapes.
55
+ - **`readOdfFormula`** resolves a standalone or embedded `.odf` formula's `content.xml` — bare MathML with no `office:document-content` wrapper, confirmed against real LibreOffice output — into its raw MathML nodes plus, when present, the formula's own native StarMath annotation string, in this reader's own bespoke `OdfFormulaDocument` shape. **`readOdfFormulaDocument`** wraps that same result into a real `document-schema.js` `ContentDocument` of kind `'formula'` — `document-schema.js` 2.0.0 added a `MathMlNode`/`ContentFormula` pivot shape for exactly this, a structural mirror of this package's own `XmlNode` that `readOdfFormula`'s real output assigns to with zero cast.
56
56
  - **`readOdm`** resolves a `.odm` master document's own `content.xml` into an ordered list of chapter references (`{ name, href, filterName? }`, one per top-level linked `text:section`) without opening the external `.odt` files those references point at. A master document's chapters are genuinely external files by ODF design, not embedded package sub-documents — confirmed against real LibreOffice output, which never caches a chapter's own content inside the master document itself (see `src/typed/odm/read.ts`'s own top-of-file note).
57
- - **`readOdbInventory`** resolves a `.odb` database front-end package into connection info plus the *names* of its forms/queries/reports/tables never their content, and never the embedded/external database engine's own binary or script storage. Confirmed against real LibreOffice output that `office:database` lives directly in the package's ordinary `content.xml` (no separate `database/connection.xml` part, contrary to the OASIS schema's own chapter layout suggesting one), that queries are named inline (`db:queries/db:query`, no manifest part of their own), and that a live engine's own tables have no ODF-level manifest listing at all only forms/reports genuinely are separate manifest sub-document parts (`forms/<Name>/content.xml`, `reports/<Name>/content.xml`). See `src/typed/odb/read.ts`'s own top-of-file note for the full findings.
57
+ - **`readOdbInventory`** resolves a `.odb` database front-end package into connection info, its table *names*, its query *definitions* (name, real `db:command` SQL text, and `db:escape-processing` when declared), and its forms/reports as `{ name, href }` pairs. Confirmed against real LibreOffice output that `office:database` lives directly in the package's ordinary `content.xml` (no separate `database/connection.xml` part, contrary to the OASIS schema's own chapter layout suggesting one), that queries are declared inline (`db:queries/db:query`, no manifest part of their own), and that a live engine's own tables have no ODF-level manifest listing at all. A form's/report's sub-document directory is named after an opaque *persistent* name (`forms/Obj11`), **not** after the form/report — the user-visible name lives only in `content.xml`'s own `db:forms`/`db:reports` registry, which is where this reader takes both the name and the href from. See `src/typed/odb/read.ts`'s own top-of-file note for the full findings.
58
+ - **`readOdbForm`** and **`readOdbReport`** open one of those sub-documents and extract its *static structure*, executing nothing. A form sub-document is a complete, ordinary ODF text document (`readOdt` reads it unmodified through `subDocumentPackage`, a synthetic sub-`Package` view over the sub-document's own directory) plus an `office:text/office:forms` control tree: per form, its `form:command`/`form:command-type` binding, every control's real element tag, UNO control implementation and `form:data-field` binding, and any genuinely nested sub-form with its own independent binding. A report sub-document uses the `rpt:` Report Builder vocabulary: the `rpt:command`/`rpt:command-type` data binding, the band stack (report header, page header, detail, page footer, report footer), the recursive group tree with each group's own expression/sort/page-break attributes and header/footer bands, every band's bound fields (`field:[COLUMN]`, unwrapped into a real column name) and computed expressions (`rpt:SUM([AMOUNT])`, left verbatim), and the report's own `rpt:function` declarations. Both are grounded in a real, LibreOffice-generated fixture rather than in the schema — which is what caught the two shapes an assumed reading gets wrong: the detail band is nested *inside the innermost group*, not a sibling of the other bands, and a group's key is a formula (`rpt:HASCHANGED("REGION")`), not a bare column name. See `src/typed/odb/form.ts`'s and `src/typed/odb/report.ts`'s own top-of-file notes.
58
59
 
59
60
  Not yet built: live-view editors and the `.odb` database-table-export subsystem. This section will be replaced with real usage examples once those land — see the [Architecture](#architecture) section below for the intended shape, and this repository's own commit history/releases for current progress.
60
61
 
62
+ A general-purpose SQL query engine for actually rendering a Report against its data — as opposed to reading the report's own static `rpt:command`/band/group definition, which `readOdbReport` already does — has been deliberately **not attempted**, not merely left unstarted. `readOdbInventory` already extracts a query's or report's real `db:command`/`rpt:command` SQL text verbatim, and a rough survey against the one real fixture this package has (`src/typed/odb/fixtures/form-and-report.odb`) suggests the underlying query text itself would often fall inside a plausible bounded SQL subset (single-table `SELECT`/`WHERE`/`ORDER BY`, no `JOIN`s or subqueries) — but that survey is a sample size of one report and should not be read as a real coverage figure. Building even a bounded engine against it means reimplementing a slice of HSQLDB's/Firebird's own query semantics, which is a materially different undertaking from decoding their file formats (already done safely elsewhere in this package's `.odb` support) and raises its own licensing questions that have not yet been reviewed. This is gated on the requesting engineer's own explicit sign-off on that licensing posture, given after reading the relevant engine source — not given yet — before any such engine is built.
63
+
61
64
  ## Getting started
62
65
 
63
66
  Requires Node.js `>=20` and pnpm `11.6.0` (pinned via `packageManager` in `package.json`).
@@ -123,7 +126,7 @@ Layered from a lossless core outward, mirroring `ooxml.js`'s own structure:
123
126
  - **`src/manifest.ts`** — unlike `ooxml.js` (which only ever *reads* OPC relationships, leaving writing to `documents.js`), `odf.js` owns manifest read **and** write, since the manifest is ODF's one mandatory part and its correctness is exhaustive.
124
127
  - **`src/styles/`** — `properties.ts` (the property-bag shape + real ODF attribute parsing), `serialize.ts` (canonical, deterministic property-bag → XML attributes), `registry.ts` (`StyleRegistry`, ODF's mandatory style-interning layer, no OOXML equivalent), `span.ts` (character-range wrapping into a formattable `text:span`, correctly splitting `text:s`/`text:tab` elements that straddle a boundary).
125
128
  - **`src/typed/shared/`** — the ODF-specific typed primitives every future format reader builds on: `units.ts`, `a1.ts`, `color.ts`/`geometry.ts` (parsing into `document-schema.js`'s own types, never redefining them), `style.ts` (a thin re-export — ODF's style-properties concern is fully covered by `styles/properties.ts` and the cascade below), `text.ts` (whitespace-run decoding), `cascade.ts` (the read-side style-resolution walk), `paragraph.ts`/`table.ts` (`readOdfParagraph`/`readOdfTable`, the shared `text:p` → `ContentParagraph`/`ContentRun` and `table:table` → `ContentTable` readers `readOdt`, `readOds`, and `typed/draw/shapes.ts` all call), `transform.ts` (the `draw:transform`/`draw:g` group-flattening geometry resolver), `masterpage.ts` (master-page → page-layout page-size/print-settings resolution, shared by a `draw:page`'s own size and a spreadsheet's print settings), `path.ts` (an `svg:d`/`draw:points` vector-path grammar parser), `metadata.ts` (`meta.xml` reading).
126
- - **`src/typed/odt/`, `src/typed/odp/`, `src/typed/odg/`, `src/typed/ods/`** — the built `readOdt`/`readOdp`/`readOdg`/`readOds` readers; **`src/typed/draw/`** — the `draw:frame`/`draw:g`/vector-primitive shape vocabulary `readOdp` and `readOdg` both share; **`src/typed/formula/`, `src/typed/odm/`** — `readOdfFormula` (raw MathML, no `document-schema.js` pivot) and `readOdm` (a `.odm` master document's own external chapter references — name/href/filter-name per linked `text:section`, never the linked content itself); **`src/typed/odb/`** — `readOdbInventory` (a `.odb` package's own connection info plus form/query/report/table *names*, never their content or the database engine's own storage).
129
+ - **`src/typed/odt/`, `src/typed/odp/`, `src/typed/odg/`, `src/typed/ods/`** — the built `readOdt`/`readOdp`/`readOdg`/`readOds` readers; **`src/typed/draw/`** — the `draw:frame`/`draw:g`/vector-primitive shape vocabulary `readOdp` and `readOdg` both share (`shapes.ts`), plus `embedded.ts`'s `readDrawObjectReference`, the `draw:object` embedded-sub-document counterpart `readOds` resolves a sheet's anchored OLE objects through; **`src/typed/formula/`, `src/typed/odm/`** — `readOdfFormula`/`readOdfFormulaDocument` (raw MathML, and the `document-schema.js` `ContentDocument` 'formula'-kind pivot built on top of it) and `readOdm` (a `.odm` master document's own external chapter references — name/href/filter-name per linked `text:section`, never the linked content itself); **`src/typed/odb/`** — `readOdbInventory` (a `.odb` package's own connection info, table/query/form/report registry, never the database engine's own storage), plus `readOdbForm`/`readOdbReport` (static, execution-free structure extraction from a form's or report's own ODF sub-document) and `subDocumentPackage` (the synthetic sub-`Package` view they read those sub-documents through).
127
130
 
128
131
  ## Why no `ooxml.js` dependency
129
132
 
@@ -144,6 +147,18 @@ See the top of this README — the short version: `ooxml.js`'s branding and sign
144
147
  - **`meta:keyword` appears once per keyword**, unlike OOXML's single comma-separated `cp:keywords` element.
145
148
  - **`table:number-columns-repeated`/`table:number-rows-repeated` must be cursor-advanced, never materialized.** A real spreadsheet has trailing cells/rows with repeat counts over a million; `typed/shared/a1.ts`'s cursor advances in O(1) without allocating that many objects — tested against a real repeat count taken from a genuine LibreOffice template.
146
149
  - **ODF cells carry no explicit cell-reference attribute at all** (unlike xlsx's `r="B7"`) — `typed/shared/a1.ts` computes A1-style references from a running column/row cursor as a reader walks cells in document order.
150
+ - **A rotated `draw:rect`/`draw:ellipse`/`draw:path`/`draw:custom-shape` vector primitive now reads its own `rotationDeg`, not just its unrotated bounding frame.** `resolveVectorGeometry` (`typed/draw/shapes.ts`) replaces the old frame-only `resolveVectorFrame`, reusing the exact same `resolveOdfShapeGeometry`/`composeOdfGroupTransform` machinery `draw:frame` already resolved rotation through, including composing an enclosing `draw:g`'s own rotation the same way it already did for a frame. `ContentVectorSchema`'s rect/ellipse/path variants already carried a `rotationDeg` field before this change — it was being discarded on the read side, not missing from the schema.
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
+ - **`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
+ - **`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 formula or chart object (`ContentEmbeddedObject.document` is a required `ContentDocument`, whose union has no MathML- or chart-shaped variant) — each skipped rather than mapped onto an approximation of a different kind.
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.
156
+ - **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
+ - **`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
+ - **`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.
159
+ - **`.odb` Form/Report structure extraction is real and working, grounded in a genuine LibreOffice-generated fixture, not blocked.** `readOdbForm`/`readOdbReport` open a form's or report's own sub-document (via `subDocumentPackage`, a synthetic sub-`Package` view over its directory) and extract its complete static structure — command bindings, control trees, nested sub-forms, the band/group hierarchy, bound and computed expressions — executing nothing. See the Architecture section above and `src/typed/odb/form.ts`/`report.ts`'s own top-of-file notes for the two real shapes this fixture caught that an assumed reading would have got wrong. **A SQL/`rpt:` rendering engine to actually execute a query or evaluate a report's own totals against real data is deliberately not attempted**, not merely unstarted — that is a materially different, larger undertaking (reimplementing a slice of HSQLDB's/Firebird's own query semantics) with its own unreviewed licensing question, gated on the requesting engineer's explicit sign-off after reading the relevant engine source. See the bounded-SQL-subset assessment immediately below for exactly how far the *reading* side alone gets you.
160
+
161
+ - **A bounded-SQL-subset assessment for Report rendering exists for exactly one real report, and it should be read that way.** `src/typed/odb/fixtures/form-and-report.odb`'s own "SalesByRegion" report is bound (`rpt:command-type="query"`) to a saved query whose real SQL text is `SELECT "SALES"."REGION", "SALES"."QUARTER", "SALES"."CUSTOMER", "SALES"."AMOUNT" FROM "SALES" WHERE "SALES"."AMOUNT" >= 100 ORDER BY "SALES"."REGION" ASC, "SALES"."QUARTER" ASC, "SALES"."AMOUNT" DESC` — single-table, a simple comparison `WHERE`, a multi-column `ORDER BY`, no `JOIN`, no subquery, and (in the SQL itself) no `GROUP BY` or aggregate function at all. That one query sits entirely inside the bounded subset described above. The fixture's bound form is even simpler: its top-level `form:form` binds directly to the bare table name `SALES` (`form:command-type="table"`), equivalent to an unconditional `SELECT * FROM "SALES"`. On this single data point, 100% of the real `.odb` command bindings seen so far (one query, one table binding, one repeat use of the same query from a nested sub-form) fall inside the bounded subset — but a sample of one report from one fixture says essentially nothing about the real-world distribution of `.odb` files in the wild, and should not be quoted as a coverage percentage beyond "the one file we have." **A more consequential finding sits alongside the SQL text itself: even a fully bounded SQL engine would not be sufficient to render this one report.** The report's own grouping breaks (`rpt:HASCHANGED("REGION")`, `rpt:HASCHANGED("LEFT_QUARTER")`), its prefix-character grouping function (`rpt:LEFT([QUARTER];2)`), and its running per-group/per-report totals (`rpt:SUM([AMOUNT])`) are all evaluated by Report Builder's own `rpt:` formula language over the plain, ungrouped, ordered row stream the SQL query returns — LibreOffice does not express any of that as SQL `GROUP BY`/aggregate syntax at all. Rendering even this one simple report therefore needs a bounded SQL engine *and* a separate `rpt:` formula evaluator (`HASCHANGED`, `LEFT`, `SUM`, and whatever else real reports use) — two genuinely different pieces of engine-semantics reimplementation, not one.
147
162
 
148
163
  ## Release and publishing
149
164
 
package/dist/index.cjs CHANGED
@@ -34,6 +34,8 @@ 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_odb_subdocument = require("./typed/odb/subdocument.cjs");
38
+ const require_typed_draw_embedded = require("./typed/draw/embedded.cjs");
37
39
  const require_typed_odp_read = require("./typed/odp/read.cjs");
38
40
  const require_typed_odt_read = require("./typed/odt/read.cjs");
39
41
  const require_typed_odg_read = require("./typed/odg/read.cjs");
@@ -41,6 +43,8 @@ const require_typed_ods_read = require("./typed/ods/read.cjs");
41
43
  const require_typed_formula_read = require("./typed/formula/read.cjs");
42
44
  const require_typed_odm_read = require("./typed/odm/read.cjs");
43
45
  const require_typed_odb_read = require("./typed/odb/read.cjs");
46
+ const require_typed_odb_form = require("./typed/odb/form.cjs");
47
+ const require_typed_odb_report = require("./typed/odb/report.cjs");
44
48
  let document_schema_js = require("document-schema.js");
45
49
  Object.defineProperty(exports, "AlignmentSchema", {
46
50
  enumerable: true,
@@ -127,11 +131,15 @@ exports.parseTextProperties = require_styles_properties.parseTextProperties;
127
131
  exports.parseXml = require_xml_parse.parseXml;
128
132
  exports.rawSubpathFromPoints = require_typed_shared_path.rawSubpathFromPoints;
129
133
  exports.readDrawFrame = require_typed_draw_shapes.readDrawFrame;
134
+ exports.readDrawObjectReference = require_typed_draw_embedded.readDrawObjectReference;
130
135
  exports.readDrawPageContent = require_typed_draw_shapes.readDrawPageContent;
131
136
  exports.readManifest = require_manifest.readManifest;
132
137
  exports.readMimetype = require_mimetype.readMimetype;
138
+ exports.readOdbForm = require_typed_odb_form.readOdbForm;
133
139
  exports.readOdbInventory = require_typed_odb_read.readOdbInventory;
140
+ exports.readOdbReport = require_typed_odb_report.readOdbReport;
134
141
  exports.readOdfFormula = require_typed_formula_read.readOdfFormula;
142
+ exports.readOdfFormulaDocument = require_typed_formula_read.readOdfFormulaDocument;
135
143
  exports.readOdfMetadata = require_typed_shared_metadata.readOdfMetadata;
136
144
  exports.readOdfParagraph = require_typed_shared_paragraph.readOdfParagraph;
137
145
  exports.readOdfTable = require_typed_shared_table.readOdfTable;
@@ -141,6 +149,7 @@ exports.readOdp = require_typed_odp_read.readOdp;
141
149
  exports.readOds = require_typed_ods_read.readOds;
142
150
  exports.readOdt = require_typed_odt_read.readOdt;
143
151
  exports.resolveDrawPageSize = require_typed_shared_masterpage.resolveDrawPageSize;
152
+ exports.resolveOdbComponent = require_typed_odb_read.resolveOdbComponent;
144
153
  exports.resolveOdfShapeGeometry = require_typed_shared_transform.resolveOdfShapeGeometry;
145
154
  exports.resolvePageLayoutProperties = require_typed_shared_masterpage.resolvePageLayoutProperties;
146
155
  exports.resolveStyle = require_typed_shared_cascade.resolveStyle;
@@ -150,6 +159,7 @@ exports.scaleOdfRawPoint = require_typed_shared_path.scaleOdfRawPoint;
150
159
  exports.serializePackage = require_package_io_write.serializePackage;
151
160
  exports.setDocumentMediaType = require_manifest.setDocumentMediaType;
152
161
  exports.sniffImageFormat = require_image_sniff.sniffImageFormat;
162
+ exports.subDocumentPackage = require_typed_odb_subdocument.subDocumentPackage;
153
163
  exports.sumOdfNodeLength = require_typed_shared_text.sumOdfNodeLength;
154
164
  exports.syncManifest = require_manifest.syncManifest;
155
165
  exports.textPropertiesToAttributes = require_styles_properties.textPropertiesToAttributes;
package/dist/index.d.cts CHANGED
@@ -33,11 +33,15 @@ import { OdfPoint, OdfShapeGeometry, OdfTransformFunction, applyOdfTransform, co
33
33
  import { resolveDrawPageSize, resolvePageLayoutProperties } from "./typed/shared/masterpage.cjs";
34
34
  import { OdfRawPoint, OdfRawSegment, OdfRawSubpath, OdfViewBox, buildOdfSubpaths, parseOdfPathData, parseOdfPointsList, parseOdfViewBox, rawSubpathFromPoints, scaleOdfRawPoint } from "./typed/shared/path.cjs";
35
35
  import { DrawPageContent, readDrawFrame, readDrawPageContent, walkDrawShapes } from "./typed/draw/shapes.cjs";
36
+ import { EmbeddedDocumentKind, EmbeddedDrawObject, readDrawObjectReference } from "./typed/draw/embedded.cjs";
36
37
  import { OdpDocument, readOdp } from "./typed/odp/read.cjs";
37
38
  import { OdtDocument, readOdt } from "./typed/odt/read.cjs";
38
39
  import { OdgDocument, readOdg } from "./typed/odg/read.cjs";
39
40
  import { OdsDocument, readOds } from "./typed/ods/read.cjs";
40
- import { OdfFormulaDocument, readOdfFormula } from "./typed/formula/read.cjs";
41
+ import { OdfFormulaDocument, readOdfFormula, readOdfFormulaDocument } from "./typed/formula/read.cjs";
41
42
  import { OdmDocument, OdmSection, readOdm } from "./typed/odm/read.cjs";
42
- import { OdbConnectionInfo, OdbInventory, readOdbInventory } from "./typed/odb/read.cjs";
43
- export { type Alignment, AlignmentSchema, type Attribute, AttributeSchema, type BinaryPart, BinaryPartSchema, type BuildManifestOptions, type CascadeDiagnostic, type DrawPageContent, 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 OdbConnectionInfo, type OdbInventory, 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, 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, readDrawPageContent, readManifest, readMimetype, readOdbInventory, readOdfFormula, readOdfMetadata, readOdfParagraph, readOdfTable, readOdg, readOdm, readOdp, readOds, readOdt, resolveDrawPageSize, resolveOdfShapeGeometry, resolvePageLayoutProperties, resolveStyle, resolveStyleElementChain, rootElement, scaleOdfRawPoint, serializePackage, setDocumentMediaType, sniffImageFormat, sumOdfNodeLength, syncManifest, textPropertiesToAttributes, txt, unzipPackage, validateManifest, walkDrawShapes, writeManifest, writeMimetype, xmlCodec, xmlnsAttributes, zipPackage };
43
+ import { OdbComponentInfo, OdbConnectionInfo, OdbInventory, OdbQueryInfo, readOdbInventory, resolveOdbComponent } from "./typed/odb/read.cjs";
44
+ import { SubDocumentPackageOptions, subDocumentPackage } from "./typed/odb/subdocument.cjs";
45
+ import { OdbForm, OdbFormControl, OdbFormDefinition, readOdbForm } from "./typed/odb/form.cjs";
46
+ import { OdbReport, OdbReportBand, OdbReportElement, OdbReportFunction, OdbReportGroup, readOdbReport } from "./typed/odb/report.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 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, 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 };
package/dist/index.d.ts CHANGED
@@ -33,11 +33,15 @@ import { OdfPoint, OdfShapeGeometry, OdfTransformFunction, applyOdfTransform, co
33
33
  import { resolveDrawPageSize, resolvePageLayoutProperties } from "./typed/shared/masterpage.js";
34
34
  import { OdfRawPoint, OdfRawSegment, OdfRawSubpath, OdfViewBox, buildOdfSubpaths, parseOdfPathData, parseOdfPointsList, parseOdfViewBox, rawSubpathFromPoints, scaleOdfRawPoint } from "./typed/shared/path.js";
35
35
  import { DrawPageContent, readDrawFrame, readDrawPageContent, walkDrawShapes } from "./typed/draw/shapes.js";
36
+ import { EmbeddedDocumentKind, EmbeddedDrawObject, readDrawObjectReference } from "./typed/draw/embedded.js";
36
37
  import { OdpDocument, readOdp } from "./typed/odp/read.js";
37
38
  import { OdtDocument, readOdt } from "./typed/odt/read.js";
38
39
  import { OdgDocument, readOdg } from "./typed/odg/read.js";
39
40
  import { OdsDocument, readOds } from "./typed/ods/read.js";
40
- import { OdfFormulaDocument, readOdfFormula } from "./typed/formula/read.js";
41
+ import { OdfFormulaDocument, readOdfFormula, readOdfFormulaDocument } from "./typed/formula/read.js";
41
42
  import { OdmDocument, OdmSection, readOdm } from "./typed/odm/read.js";
42
- import { OdbConnectionInfo, OdbInventory, readOdbInventory } from "./typed/odb/read.js";
43
- export { type Alignment, AlignmentSchema, type Attribute, AttributeSchema, type BinaryPart, BinaryPartSchema, type BuildManifestOptions, type CascadeDiagnostic, type DrawPageContent, 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 OdbConnectionInfo, type OdbInventory, 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, 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, readDrawPageContent, readManifest, readMimetype, readOdbInventory, readOdfFormula, readOdfMetadata, readOdfParagraph, readOdfTable, readOdg, readOdm, readOdp, readOds, readOdt, resolveDrawPageSize, resolveOdfShapeGeometry, resolvePageLayoutProperties, resolveStyle, resolveStyleElementChain, rootElement, scaleOdfRawPoint, serializePackage, setDocumentMediaType, sniffImageFormat, sumOdfNodeLength, syncManifest, textPropertiesToAttributes, txt, unzipPackage, validateManifest, walkDrawShapes, writeManifest, writeMimetype, xmlCodec, xmlnsAttributes, zipPackage };
43
+ import { OdbComponentInfo, OdbConnectionInfo, OdbInventory, OdbQueryInfo, readOdbInventory, resolveOdbComponent } from "./typed/odb/read.js";
44
+ import { SubDocumentPackageOptions, subDocumentPackage } from "./typed/odb/subdocument.js";
45
+ import { OdbForm, OdbFormControl, OdbFormDefinition, readOdbForm } from "./typed/odb/form.js";
46
+ import { OdbReport, OdbReportBand, OdbReportElement, OdbReportFunction, OdbReportGroup, readOdbReport } from "./typed/odb/report.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 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, 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 };
package/dist/index.js CHANGED
@@ -33,11 +33,15 @@ 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 { subDocumentPackage } from "./typed/odb/subdocument.js";
37
+ import { readDrawObjectReference } from "./typed/draw/embedded.js";
36
38
  import { readOdp } from "./typed/odp/read.js";
37
39
  import { readOdt } from "./typed/odt/read.js";
38
40
  import { readOdg } from "./typed/odg/read.js";
39
41
  import { readOds } from "./typed/ods/read.js";
40
- import { readOdfFormula } from "./typed/formula/read.js";
42
+ import { readOdfFormula, readOdfFormulaDocument } from "./typed/formula/read.js";
41
43
  import { readOdm } from "./typed/odm/read.js";
42
- import { readOdbInventory } from "./typed/odb/read.js";
43
- 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, readDrawPageContent, readManifest, readMimetype, readOdbInventory, readOdfFormula, readOdfMetadata, readOdfParagraph, readOdfTable, readOdg, readOdm, readOdp, readOds, readOdt, resolveDrawPageSize, resolveOdfShapeGeometry, resolvePageLayoutProperties, resolveStyle, resolveStyleElementChain, rootElement, scaleOdfRawPoint, serializePackage, setDocumentMediaType, sniffImageFormat, sumOdfNodeLength, syncManifest, textPropertiesToAttributes, txt, unzipPackage, validateManifest, walkDrawShapes, writeManifest, writeMimetype, xmlCodec, xmlnsAttributes, zipPackage };
44
+ import { readOdbInventory, resolveOdbComponent } from "./typed/odb/read.js";
45
+ import { readOdbForm } from "./typed/odb/form.js";
46
+ import { readOdbReport } from "./typed/odb/report.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, 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 };
package/dist/ns.cjs CHANGED
@@ -25,7 +25,8 @@ const ODF_NAMESPACES = Object.freeze({
25
25
  xsd: "http://www.w3.org/2001/XMLSchema",
26
26
  xsi: "http://www.w3.org/2001/XMLSchema-instance",
27
27
  manifest: "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0",
28
- db: "urn:oasis:names:tc:opendocument:xmlns:database:1.0"
28
+ db: "urn:oasis:names:tc:opendocument:xmlns:database:1.0",
29
+ rpt: "http://openoffice.org/2005/report"
29
30
  });
30
31
  function xmlnsAttributes(prefixes) {
31
32
  const attrs = {};
package/dist/ns.d.cts CHANGED
@@ -25,6 +25,7 @@ declare const ODF_NAMESPACES: Readonly<{
25
25
  xsi: "http://www.w3.org/2001/XMLSchema-instance";
26
26
  manifest: "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0";
27
27
  db: "urn:oasis:names:tc:opendocument:xmlns:database:1.0";
28
+ rpt: "http://openoffice.org/2005/report";
28
29
  }>;
29
30
  type OdfNamespacePrefix = keyof typeof ODF_NAMESPACES;
30
31
  declare function xmlnsAttributes(prefixes: readonly OdfNamespacePrefix[]): Record<string, string>;
package/dist/ns.d.ts CHANGED
@@ -25,6 +25,7 @@ declare const ODF_NAMESPACES: Readonly<{
25
25
  xsi: "http://www.w3.org/2001/XMLSchema-instance";
26
26
  manifest: "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0";
27
27
  db: "urn:oasis:names:tc:opendocument:xmlns:database:1.0";
28
+ rpt: "http://openoffice.org/2005/report";
28
29
  }>;
29
30
  type OdfNamespacePrefix = keyof typeof ODF_NAMESPACES;
30
31
  declare function xmlnsAttributes(prefixes: readonly OdfNamespacePrefix[]): Record<string, string>;
package/dist/ns.js CHANGED
@@ -24,7 +24,8 @@ const ODF_NAMESPACES = Object.freeze({
24
24
  xsd: "http://www.w3.org/2001/XMLSchema",
25
25
  xsi: "http://www.w3.org/2001/XMLSchema-instance",
26
26
  manifest: "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0",
27
- db: "urn:oasis:names:tc:opendocument:xmlns:database:1.0"
27
+ db: "urn:oasis:names:tc:opendocument:xmlns:database:1.0",
28
+ rpt: "http://openoffice.org/2005/report"
28
29
  });
29
30
  function xmlnsAttributes(prefixes) {
30
31
  const attrs = {};
@@ -0,0 +1,42 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_xml_query = require("../../xml/query.cjs");
3
+ const require_typed_odb_subdocument = require("../odb/subdocument.cjs");
4
+ //#region src/typed/draw/embedded.ts
5
+ const CONTENT_PART = "content.xml";
6
+ function embeddedKindFor(bodyChildTag) {
7
+ switch (bodyChildTag) {
8
+ case "office:text": return "wordprocessing";
9
+ case "office:spreadsheet": return "spreadsheet";
10
+ case "office:presentation": return "presentation";
11
+ case "office:drawing": return "drawing";
12
+ default: return;
13
+ }
14
+ }
15
+ function normaliseObjectHref(raw) {
16
+ const withoutPrefix = raw.startsWith("./") ? raw.slice(2) : raw;
17
+ const trimmed = withoutPrefix.endsWith("/") ? withoutPrefix.slice(0, -1) : withoutPrefix;
18
+ if (trimmed.length === 0 || trimmed.startsWith("..") || trimmed.startsWith("/") || trimmed.includes("://")) return;
19
+ return trimmed;
20
+ }
21
+ function readDrawObjectReference(frame, pkg) {
22
+ const object = require_xml_query.childrenWithTag(frame, "draw:object")[0];
23
+ if (object === void 0) return;
24
+ const rawHref = require_xml_query.attrValue(object, "xlink:href");
25
+ const href = rawHref === void 0 ? void 0 : normaliseObjectHref(rawHref);
26
+ if (href === void 0) return;
27
+ const subPackage = require_typed_odb_subdocument.subDocumentPackage(pkg, href, { allowMissingContent: true });
28
+ const contentPart = subPackage.parts[CONTENT_PART];
29
+ if (contentPart?.kind !== "xml") return;
30
+ const root = require_xml_query.rootElement(contentPart.nodes);
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);
34
+ if (objectKind === void 0) return;
35
+ return {
36
+ objectKind,
37
+ package: subPackage,
38
+ href
39
+ };
40
+ }
41
+ //#endregion
42
+ exports.readDrawObjectReference = readDrawObjectReference;
@@ -0,0 +1,13 @@
1
+ import { l as XmlElement } from "../../node-CkBWRjNR.cjs";
2
+ import { Package } from "../../model/package.cjs";
3
+ import { ContentEmbeddedObjectKind } from "document-schema.js";
4
+ //#region src/typed/draw/embedded.d.ts
5
+ type EmbeddedDocumentKind = Extract<ContentEmbeddedObjectKind, 'wordprocessing' | 'presentation' | 'spreadsheet' | 'drawing'>;
6
+ interface EmbeddedDrawObject {
7
+ objectKind: EmbeddedDocumentKind;
8
+ package: Package;
9
+ href: string;
10
+ }
11
+ declare function readDrawObjectReference(frame: XmlElement, pkg: Package): EmbeddedDrawObject | undefined;
12
+ //#endregion
13
+ export { EmbeddedDocumentKind, EmbeddedDrawObject, readDrawObjectReference };
@@ -0,0 +1,13 @@
1
+ import { l as XmlElement } from "../../node-CkBWRjNR.js";
2
+ import { Package } from "../../model/package.js";
3
+ import { ContentEmbeddedObjectKind } from "document-schema.js";
4
+ //#region src/typed/draw/embedded.d.ts
5
+ type EmbeddedDocumentKind = Extract<ContentEmbeddedObjectKind, 'wordprocessing' | 'presentation' | 'spreadsheet' | 'drawing'>;
6
+ interface EmbeddedDrawObject {
7
+ objectKind: EmbeddedDocumentKind;
8
+ package: Package;
9
+ href: string;
10
+ }
11
+ declare function readDrawObjectReference(frame: XmlElement, pkg: Package): EmbeddedDrawObject | undefined;
12
+ //#endregion
13
+ export { EmbeddedDocumentKind, EmbeddedDrawObject, readDrawObjectReference };
@@ -0,0 +1,41 @@
1
+ import { attrValue, childrenWithTag, findChildElement, rootElement } from "../../xml/query.js";
2
+ import { subDocumentPackage } from "../odb/subdocument.js";
3
+ //#region src/typed/draw/embedded.ts
4
+ const CONTENT_PART = "content.xml";
5
+ function embeddedKindFor(bodyChildTag) {
6
+ switch (bodyChildTag) {
7
+ case "office:text": return "wordprocessing";
8
+ case "office:spreadsheet": return "spreadsheet";
9
+ case "office:presentation": return "presentation";
10
+ case "office:drawing": return "drawing";
11
+ default: return;
12
+ }
13
+ }
14
+ function normaliseObjectHref(raw) {
15
+ const withoutPrefix = raw.startsWith("./") ? raw.slice(2) : raw;
16
+ const trimmed = withoutPrefix.endsWith("/") ? withoutPrefix.slice(0, -1) : withoutPrefix;
17
+ if (trimmed.length === 0 || trimmed.startsWith("..") || trimmed.startsWith("/") || trimmed.includes("://")) return;
18
+ return trimmed;
19
+ }
20
+ function readDrawObjectReference(frame, pkg) {
21
+ const object = childrenWithTag(frame, "draw:object")[0];
22
+ if (object === void 0) return;
23
+ const rawHref = attrValue(object, "xlink:href");
24
+ const href = rawHref === void 0 ? void 0 : normaliseObjectHref(rawHref);
25
+ if (href === void 0) return;
26
+ const subPackage = subDocumentPackage(pkg, href, { allowMissingContent: true });
27
+ const contentPart = subPackage.parts[CONTENT_PART];
28
+ if (contentPart?.kind !== "xml") return;
29
+ const root = rootElement(contentPart.nodes);
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);
33
+ if (objectKind === void 0) return;
34
+ return {
35
+ objectKind,
36
+ package: subPackage,
37
+ href
38
+ };
39
+ }
40
+ //#endregion
41
+ export { readDrawObjectReference };