odf.js 4.0.2 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -11
- package/dist/{codec-FXnmhe15.d.ts → codec-DqldvlN5.d.ts} +8 -8
- package/dist/{codec-m4zK5kxz.d.cts → codec-jKlS0rWl.d.cts} +8 -8
- package/dist/codec.d.cts +1 -1
- package/dist/codec.d.ts +1 -1
- package/dist/{form-DcGOX5RW.d.ts → form-BsAAx5-p.d.ts} +1 -1
- package/dist/{form-BC-wb1M2.d.cts → form-DSIbHxog.d.cts} +1 -1
- package/dist/index.cjs +6 -1
- package/dist/index.d.cts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.js +6 -6
- package/dist/read-B4zS8bGb.d.ts +11 -0
- package/dist/read-B9zz_ax1.d.ts +11 -0
- package/dist/read-BHpPvhzR.d.cts +11 -0
- package/dist/read-BM8KaFQS.d.cts +11 -0
- package/dist/read-C6MhadqG.d.ts +11 -0
- package/dist/read-CszvDMMt.d.cts +11 -0
- package/dist/read-DOuXgPhP.d.ts +15 -0
- package/dist/read-KpU38maT.d.cts +11 -0
- package/dist/read-YSIwlhrk.d.ts +11 -0
- package/dist/read-xCmo7cec.d.cts +15 -0
- package/dist/typed/formula/read.cjs +11 -6
- package/dist/typed/formula/read.d.cts +2 -2
- package/dist/typed/formula/read.d.ts +2 -2
- package/dist/typed/formula/read.js +10 -6
- package/dist/typed/odb/form.cjs +1 -1
- package/dist/typed/odb/form.d.cts +1 -1
- package/dist/typed/odb/form.d.ts +1 -1
- package/dist/typed/odb/form.js +2 -2
- package/dist/typed/odg/read.cjs +10 -1
- package/dist/typed/odg/read.d.cts +2 -2
- package/dist/typed/odg/read.d.ts +2 -2
- package/dist/typed/odg/read.js +11 -3
- package/dist/typed/odp/read.cjs +10 -1
- package/dist/typed/odp/read.d.cts +2 -2
- package/dist/typed/odp/read.d.ts +2 -2
- package/dist/typed/odp/read.js +11 -3
- package/dist/typed/ods/read.cjs +16 -7
- package/dist/typed/ods/read.d.cts +2 -2
- package/dist/typed/ods/read.d.ts +2 -2
- package/dist/typed/ods/read.js +21 -13
- package/dist/typed/odt/read.cjs +13 -4
- package/dist/typed/odt/read.d.cts +2 -2
- package/dist/typed/odt/read.d.ts +2 -2
- package/dist/typed/odt/read.js +14 -6
- package/package.json +2 -2
- package/dist/read-B0aBfNRf.d.ts +0 -10
- package/dist/read-BKS_zlGG.d.cts +0 -10
- package/dist/read-Bd16x8VD.d.cts +0 -10
- package/dist/read-Bleh4LfR.d.ts +0 -14
- package/dist/read-C7gT8wtc.d.ts +0 -10
- package/dist/read-CxdHrV1m.d.ts +0 -10
- package/dist/read-D4DKvOY7.d.cts +0 -10
- package/dist/read-DapcRIZV.d.cts +0 -10
- package/dist/read-Dn9qyBBs.d.ts +0 -10
- package/dist/read-DyR9HfLT.d.cts +0 -14
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
`odf.js` is the ODF sibling of [`ooxml.js`](https://github.com/ExaDev/ooxml.js), mirroring its architecture: a lossless ZIP-of-XML core that round-trips any package byte-for-content-faithful, with typed readers layered on top. Two ODF-specific differences shape the design: ODF has no relationship mechanism (inter-part references are direct paths, with an exhaustive `META-INF/manifest.xml`), and ODF has no inline/direct formatting — every formatting difference must be a named "automatic style," so `odf.js` owns a style-interning subsystem (`src/styles/`) with no OOXML equivalent.
|
|
8
8
|
|
|
9
|
-
**This package does not depend on `ooxml.js`.** `ooxml.js`'s branding and SBOM are scoped to ECMA-376/OOXML; depending on it would be the wrong signal for an OASIS-standard codec and would force a breaking `ooxml.js` release for every ODF-only fix. The small generic ZIP/XML/`Package` layer is duplicated, kept structurally identical so TypeScript's structural typing makes both packages' values interchangeable for a shared consumer like `documents.js`. Both depend on [`document-schema.js`](https://github.com/ExaDev/document-schema.js) for the genuinely identical `ContentDocument`/`
|
|
9
|
+
**This package does not depend on `ooxml.js`.** `ooxml.js`'s branding and SBOM are scoped to ECMA-376/OOXML; depending on it would be the wrong signal for an OASIS-standard codec and would force a breaking `ooxml.js` release for every ODF-only fix. The small generic ZIP/XML/`Package` layer is duplicated, kept structurally identical so TypeScript's structural typing makes both packages' values interchangeable for a shared consumer like `documents.js`. Both depend on [`document-schema.js`](https://github.com/ExaDev/document-schema.js) for the genuinely identical `ContentDocument`/`DocumentPackage` content model.
|
|
10
10
|
|
|
11
11
|
```mermaid
|
|
12
12
|
graph TD
|
|
@@ -58,8 +58,9 @@ Under active development. Built and shipped:
|
|
|
58
58
|
- **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` and the mimetype part's mandatory first-entry/stored/uncompressed layout.
|
|
59
59
|
- **Style interning** (`src/styles/`) — `StyleRegistry` adopts existing automatic styles, finds-or-mints on `intern()`, fingerprints on canonical serialized properties (never `JSON.stringify`), collision-checked across all four style containers.
|
|
60
60
|
- **Shared typed primitives** (`src/typed/shared/`) — unit parsing, A1 cell-reference computation with repeat-count cursor advancement, colour/geometry/master-page parsing into `document-schema.js` types, whitespace-run decoding, the read-side style cascade, shared `readOdfParagraph`/`readOdfTable`, the `draw:transform`/`draw:g` group-flattening geometry resolver, an `svg:d`/`draw:points` path parser, and `meta.xml` reading.
|
|
61
|
-
- **Typed readers** — `readOdt`
|
|
62
|
-
-
|
|
61
|
+
- **Typed readers, at two levels** — `readOdt`/`readOdp`/`readOdg`/`readOds`/`readOdfFormula` resolve a `Package` into a `document-schema.js` **`DocumentPackage`**: the single hierarchical artefact, with a minted styles table. Beneath each sits its `*Content` sibling (`readOdtContent`, `readOdpContent`, `readOdgContent`, `readOdsContent`, `readOdfFormulaContent`) producing the flat `ContentDocument`-level shape instead. See [Reading a document](#reading-a-document).
|
|
62
|
+
- **What each reader actually covers** — wordprocessing (`readOdt`), presentation (`readOdp`), drawing (`readOdg`: vector primitives in `draw:z-index`-aware paint order), spreadsheet (`readOds`: every `office:value-type`, cell/page-anchored images, and embedded sub-documents), each expressed in `document-schema.js`'s own `ContentSection`/`ContentSlide`/`ContentDrawPage`/`ContentSheet` vocabulary.
|
|
63
|
+
- **`readOdfFormulaMathMl`** — resolves a standalone/embedded `.odf` formula's bare-MathML `content.xml` into raw MathML nodes plus a StarMath annotation, with no pivot shaping at all. **`readOdfFormulaContent`** wraps that into a real `'formula'`-kind `ContentDocument`, and **`readOdfFormula`** into a `DocumentPackage`.
|
|
63
64
|
- **`readOdm`** — resolves a `.odm` master document into an ordered list of chapter references (`{ name, href, filterName? }`); chapters are genuinely external `.odt` files by ODF design, never cached.
|
|
64
65
|
- **`readOdbInventory`** — resolves a `.odb` into connection info, table names, query definitions (`{ name, command, escapeProcessing? }` with real SQL text), and form/report `{ name, href }` pairs. A sub-document directory is named after an opaque *persistent* name (`forms/Obj11`), not the user-visible name.
|
|
65
66
|
- **`readOdbForm`/`readOdbReport`** — extract one sub-document's *static structure*, executing nothing: a form's control tree and data bindings, or a report's band stack, recursive group tree, bound fields, and computed expressions.
|
|
@@ -96,7 +97,69 @@ To run a single test file: `pnpm vitest run src/path/to/file.test.ts`.
|
|
|
96
97
|
|
|
97
98
|
## Usage
|
|
98
99
|
|
|
99
|
-
|
|
100
|
+
### Reading a document
|
|
101
|
+
|
|
102
|
+
A typed reader takes a `Package` (bytes go through `decodePackage`/`parsePackage` first) and returns a [`DocumentPackage`](https://github.com/ExaDev/document-schema.js#the-package-tree) — `document-schema.js`'s single hierarchical artefact, where structure, layout, and content are fused in one tree and a `styles` table has already been minted over it:
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
import { decodePackage, readOdt } from 'odf.js';
|
|
106
|
+
|
|
107
|
+
const pkg = decodePackage(new Uint8Array(await file.arrayBuffer()));
|
|
108
|
+
const document = readOdt(pkg);
|
|
109
|
+
|
|
110
|
+
document.kind; // 'wordprocessing'
|
|
111
|
+
document.metadata; // title, author, keywords, ... from meta.xml
|
|
112
|
+
document.children; // one section group per ContentSection, headings and lists grouped inside it
|
|
113
|
+
document.styles; // the minted styles table the tree's `style` refs name
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
One reader per format, each returning the `DocumentPackage` arm its format produces:
|
|
117
|
+
|
|
118
|
+
| Format | Reader | Package kind |
|
|
119
|
+
| --- | --- | --- |
|
|
120
|
+
| `.odt` | `readOdt` | `wordprocessing` |
|
|
121
|
+
| `.odp` | `readOdp` | `presentation` |
|
|
122
|
+
| `.ods` | `readOds` | `spreadsheet` |
|
|
123
|
+
| `.odg` | `readOdg` | `drawing` |
|
|
124
|
+
| `.odf` | `readOdfFormula` | `formula` |
|
|
125
|
+
|
|
126
|
+
Each is assembled through `document-schema.js`'s own `assemblePackage`, so odf.js's packages are built exactly the way every other package construction site in this family builds one. No `pages` array is populated and no node carries `frames`: a reader runs before any layout pass, and rendered page geometry is a layout engine's to report, never a reader's to invent.
|
|
127
|
+
|
|
128
|
+
### The flat `ContentDocument` level
|
|
129
|
+
|
|
130
|
+
Beneath each package-native reader sits the flat reader it is built on, unchanged in behaviour and exported under a `*Content` name. Reach for these when you work in `document-schema.js`'s flat codec-exchange form — as `documents.js`'s own conversion pipeline does — rather than in the tree:
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
import { readOdsContent, readOdfFormulaMathMl } from 'odf.js';
|
|
134
|
+
|
|
135
|
+
const { metadata, sheets } = readOdsContent(pkg); // the flat ContentSheet[] shape, no tree, no styles table
|
|
136
|
+
const { mathml, starMath } = readOdfFormulaMathMl(formulaPkg); // rawest of all: MathML nodes and the StarMath annotation
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
`readOdtContent`/`readOdpContent`/`readOdgContent`/`readOdsContent` return `{ metadata, sections | slides | pages | sheets }`; `readOdfFormulaContent` returns a whole `'formula'`-kind `ContentDocument`; `readOdfFormulaMathMl` returns the raw MathML with no pivot shaping at all. A package-native reader calls its own `*Content` sibling and reshapes that result, so the two levels are one read and can never disagree about what the file says.
|
|
140
|
+
|
|
141
|
+
Crossing between the levels is `document-schema.js`'s job, not this package's: `flattenPackage(readOdt(pkg))` reproduces exactly what `readOdtContent(pkg)` returns, wrapped in its `ContentDocument` envelope. That equality is pinned per format against real fixture bytes in this package's own test suites.
|
|
142
|
+
|
|
143
|
+
### The primary names moved — migrating from 4.x
|
|
144
|
+
|
|
145
|
+
Every bare `readOdX` name now belongs to the package-native reader. Callers of the old flat functions rename; nothing about those functions' behaviour changed:
|
|
146
|
+
|
|
147
|
+
| 4.x | 5.0 | Returns |
|
|
148
|
+
| --- | --- | --- |
|
|
149
|
+
| `readOdt` | `readOdtContent` | `OdtDocument` |
|
|
150
|
+
| `readOdp` | `readOdpContent` | `OdpDocument` |
|
|
151
|
+
| `readOdg` | `readOdgContent` | `OdgDocument` |
|
|
152
|
+
| `readOds` | `readOdsContent` | `OdsDocument` |
|
|
153
|
+
| `readOdfFormulaDocument` | `readOdfFormulaContent` | `ContentDocument` |
|
|
154
|
+
| `readOdfFormula` | `readOdfFormulaMathMl` | `OdfFormulaDocument` |
|
|
155
|
+
|
|
156
|
+
The rename is a compile error at every call site, never a silent behaviour change: each new bare name returns a `DocumentPackage`, which is assignable to none of the old return types.
|
|
157
|
+
|
|
158
|
+
`readOdm`, `readOdbInventory`, `readOdbForm`, and `readOdbReport` are untouched, and none gains a package-native form. `readOdm`'s chapters are external file references and `readOdbInventory`/`readOdbReport` describe structure rather than content, so none of those three has a `ContentDocument` to decompose. `readOdbForm` is the exception that proves the rule rather than a fourth case of it: a form's sub-document is a complete, ordinary ODF text document, so `readOdbForm` does call `readOdtContent` on it and does return an `OdtDocument` — but that document is one component nested inside the form's own control-tree result, not the function's own top-level return value, so there is no `DocumentPackage`-native `readOdbForm` to add without changing what the function returns altogether.
|
|
159
|
+
|
|
160
|
+
### The lossless core
|
|
161
|
+
|
|
162
|
+
The ZIP-of-XML layer every reader above is built on:
|
|
100
163
|
|
|
101
164
|
```ts
|
|
102
165
|
import { decodePackage, encodePackage } from 'odf.js';
|
|
@@ -121,6 +184,8 @@ syncManifest(pkg); // rebuilds manifest.xml to exactly match pkg's current parts
|
|
|
121
184
|
readMimetype(pkg); // 'application/vnd.oasis.opendocument.text'
|
|
122
185
|
```
|
|
123
186
|
|
|
187
|
+
### Direct module imports
|
|
188
|
+
|
|
124
189
|
Every module is also importable directly by its own subpath, without going through the barrel:
|
|
125
190
|
|
|
126
191
|
```ts
|
|
@@ -143,9 +208,9 @@ Layered from a lossless core outward, mirroring `ooxml.js`:
|
|
|
143
208
|
- **`src/manifest.ts`** — full manifest read/write; the manifest is ODF's one mandatory part, unlike `ooxml.js`'s read-only OPC-relationship stance.
|
|
144
209
|
- **`src/styles/`** — `properties.ts`/`serialize.ts` (canonical property-bag ↔ XML attributes), `registry.ts` (`StyleRegistry`, the mandatory style-interning layer), `span.ts` (character-range `text:span` wrapping).
|
|
145
210
|
- **`src/typed/shared/`** — ODF-specific typed primitives every reader builds on (units, A1 cursors, colour/geometry, whitespace runs, style cascade, shared paragraph/table readers, transform/path parsing, metadata).
|
|
146
|
-
- **`src/typed/odt/`, `odp/`, `odg/`, `ods/`** — the `readOdt`/`readOdp`/`readOdg`/`readOds`
|
|
211
|
+
- **`src/typed/odt/`, `odp/`, `odg/`, `ods/`** — one module per format, each carrying both levels of its reader: the package-native `readOdt`/`readOdp`/`readOdg`/`readOds` and the flat `readOdtContent`/`readOdpContent`/`readOdgContent`/`readOdsContent` it is built on.
|
|
147
212
|
- **`src/typed/draw/`** — the shared `draw:frame`/`draw:g`/vector shape vocabulary (`shapes.ts`), plus `embedded.ts` (`readDrawObjectReference`, `readDrawImageBlock`).
|
|
148
|
-
- **`src/typed/formula/`, `odm/`** — `readOdfFormula`/`
|
|
213
|
+
- **`src/typed/formula/`, `odm/`** — `readOdfFormula`/`readOdfFormulaContent`/`readOdfFormulaMathMl` and `readOdm`.
|
|
149
214
|
- **`src/typed/odb/`** — `readOdbInventory`, `readOdbForm`/`readOdbReport`, `resolveOdbComponent`, `subDocumentPackage`.
|
|
150
215
|
|
|
151
216
|
## Conventions
|
|
@@ -166,10 +231,10 @@ Layered from a lossless core outward, mirroring `ooxml.js`:
|
|
|
166
231
|
- **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.
|
|
167
232
|
- **Every `ContentShape`/`ContentVector` carries a resolved `paintOrder`** so true relative paint order survives across the independently-ordered `shapes`/`vectors` arrays.
|
|
168
233
|
- **`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.
|
|
169
|
-
- **`
|
|
170
|
-
- **`
|
|
234
|
+
- **`readOdsContent`/`readTableCell` resolve cell `background`/`borders`/`alignment`/`verticalAlignment` from the real style cascade.** An explicit `fo:border-*` of `"none"`/`"hidden"` clears an inherited edge.
|
|
235
|
+
- **`readOdsContent` reads sheet-anchored drawings** — cell-anchored `draw:frame`s (coordinates relative to the cell) and page-anchored ones (in `table:shapes`). A sheet cannot carry a floating text box, bare vector, or embedded chart; each is skipped.
|
|
171
236
|
- **`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`.
|
|
172
|
-
- **An embedded Math object in a spreadsheet cell reads as `objectKind: 'formula'`** — its `content.xml` root *is* the MathML root, so `readDrawObjectReference` falls back to `findMathRoot` and dispatches to `
|
|
237
|
+
- **An embedded Math object in a spreadsheet cell reads as `objectKind: 'formula'`** — its `content.xml` root *is* the MathML root, so `readDrawObjectReference` falls back to `findMathRoot` and dispatches to `readOdfFormulaContent`.
|
|
173
238
|
- **A `draw:frame`'s alternative text (`svg:title`, falling back to `svg:desc`) reads into `ContentImageBlock.altText`.**
|
|
174
239
|
- **`readOdbInventory`'s `queries` carry real `db:command` SQL text**, not just names — a breaking rename from `string[]` to `OdbQueryInfo[]`.
|
|
175
240
|
- **`.odb` Form/Report structure extraction is real** (`readOdbForm`/`readOdbReport`), grounded in a genuine fixture. **A SQL/`rpt:` rendering engine to execute a query or evaluate report totals is deliberately not attempted** — see the Status section. Even a fully bounded SQL engine would not suffice to render a report: grouping breaks (`rpt:HASCHANGED`), prefix functions (`rpt:LEFT`), and running totals (`rpt:SUM`) are evaluated by Report Builder's own `rpt:` formula language, not by SQL.
|
|
@@ -185,8 +250,8 @@ Conventional Commits (`feat:`, `fix:`, `test:`, `chore:`, …), enforced by comm
|
|
|
185
250
|
## References
|
|
186
251
|
|
|
187
252
|
- [ooxml.js](https://github.com/ExaDev/ooxml.js) — the OOXML sibling; architecturally mirrored, deliberately not depended on.
|
|
188
|
-
- [document-schema.js](https://github.com/ExaDev/document-schema.js) — the canonical `ContentDocument`/`
|
|
189
|
-
- [documents.js](https://github.com/ExaDev/documents.js) — the downstream consumer; its `readOdtContent`/`readOdpContent`/`readOdsContent`/`readOdgContent`
|
|
253
|
+
- [document-schema.js](https://github.com/ExaDev/document-schema.js) — the canonical `ContentDocument`/`DocumentPackage` schema both packages depend on, and the home of the `assemblePackage`/`flattenPackage`/`decompose`/`factorStyles` transform between the two encodings.
|
|
254
|
+
- [documents.js](https://github.com/ExaDev/documents.js) — the downstream consumer; its own `readOdtContent`/`readOdpContent`/`readOdsContent`/`readOdgContent` adapters wrap this package's flat `*Content` readers into `ContentDocument`s, adding the odt/odp formula, image, and vector detection passes those readers deliberately leave out.
|
|
190
255
|
|
|
191
256
|
## License
|
|
192
257
|
|
|
@@ -25,18 +25,18 @@ import "./masterpage-7nBnqFj-.js";
|
|
|
25
25
|
import "./path-DE7wkIcz.js";
|
|
26
26
|
import "./shapes-BB59aIC8.js";
|
|
27
27
|
import "./embedded-CNMqOrnt.js";
|
|
28
|
-
import "./read-
|
|
29
|
-
import "./read-
|
|
30
|
-
import "./read-
|
|
31
|
-
import "./read-
|
|
32
|
-
import "./read-
|
|
28
|
+
import "./read-YSIwlhrk.js";
|
|
29
|
+
import "./read-C6MhadqG.js";
|
|
30
|
+
import "./read-B9zz_ax1.js";
|
|
31
|
+
import "./read-B4zS8bGb.js";
|
|
32
|
+
import "./read-DOuXgPhP.js";
|
|
33
33
|
import "./read-BkFbEves.js";
|
|
34
34
|
import "./read-BoIUENWq.js";
|
|
35
35
|
import "./subdocument-DQNQF7wV.js";
|
|
36
|
-
import "./form-
|
|
36
|
+
import "./form-BsAAx5-p.js";
|
|
37
37
|
import "./report-MpwUgXbA.js";
|
|
38
38
|
import { z } from "zod";
|
|
39
|
-
import { Alignment as Alignment$1, AlignmentSchema as AlignmentSchema$1 } from "document-schema.js";
|
|
39
|
+
import { Alignment as Alignment$1, AlignmentSchema as AlignmentSchema$1, DocumentPackage as DocumentPackage$1 } from "document-schema.js";
|
|
40
40
|
//#region src/codec.d.ts
|
|
41
41
|
declare const xmlCodec: z.ZodCodec<z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
42
42
|
type: z.ZodLiteral<"text">;
|
|
@@ -105,4 +105,4 @@ declare const packageCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint
|
|
|
105
105
|
declare function decodePackage(bytes: Uint8Array<ArrayBuffer>): Package;
|
|
106
106
|
declare function encodePackage(pkg: Package): Uint8Array<ArrayBuffer>;
|
|
107
107
|
//#endregion
|
|
108
|
-
export { Alignment$1 as a, xmlCodec as i, encodePackage as n, AlignmentSchema$1 as o, packageCodec as r, decodePackage as t };
|
|
108
|
+
export { Alignment$1 as a, xmlCodec as i, encodePackage as n, AlignmentSchema$1 as o, packageCodec as r, DocumentPackage$1 as s, decodePackage as t };
|
|
@@ -25,18 +25,18 @@ import "./masterpage-EmefIRgy.cjs";
|
|
|
25
25
|
import "./path-DE7wkIcz.cjs";
|
|
26
26
|
import "./shapes-BqcccDK8.cjs";
|
|
27
27
|
import "./embedded-D7Kr1Sce.cjs";
|
|
28
|
-
import "./read-
|
|
29
|
-
import "./read-
|
|
30
|
-
import "./read-
|
|
31
|
-
import "./read-
|
|
32
|
-
import "./read-
|
|
28
|
+
import "./read-KpU38maT.cjs";
|
|
29
|
+
import "./read-CszvDMMt.cjs";
|
|
30
|
+
import "./read-BM8KaFQS.cjs";
|
|
31
|
+
import "./read-BHpPvhzR.cjs";
|
|
32
|
+
import "./read-xCmo7cec.cjs";
|
|
33
33
|
import "./read-DNNf5_6n.cjs";
|
|
34
34
|
import "./read-DrdmKX0x.cjs";
|
|
35
35
|
import "./subdocument-CIxH3a5V.cjs";
|
|
36
|
-
import "./form-
|
|
36
|
+
import "./form-DSIbHxog.cjs";
|
|
37
37
|
import "./report-BuCJ7_YU.cjs";
|
|
38
38
|
import { z } from "zod";
|
|
39
|
-
import { Alignment as Alignment$1, AlignmentSchema } from "document-schema.js";
|
|
39
|
+
import { Alignment as Alignment$1, AlignmentSchema, DocumentPackage as DocumentPackage$1 } from "document-schema.js";
|
|
40
40
|
//#region src/codec.d.ts
|
|
41
41
|
declare const xmlCodec: z.ZodCodec<z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
42
42
|
type: z.ZodLiteral<"text">;
|
|
@@ -105,4 +105,4 @@ declare const packageCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint
|
|
|
105
105
|
declare function decodePackage(bytes: Uint8Array<ArrayBuffer>): Package;
|
|
106
106
|
declare function encodePackage(pkg: Package): Uint8Array<ArrayBuffer>;
|
|
107
107
|
//#endregion
|
|
108
|
-
export { Alignment$1 as a, xmlCodec as i, encodePackage as n, AlignmentSchema as o, packageCodec as r, decodePackage as t };
|
|
108
|
+
export { Alignment$1 as a, xmlCodec as i, encodePackage as n, AlignmentSchema as o, packageCodec as r, DocumentPackage$1 as s, decodePackage as t };
|
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-jKlS0rWl.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-DqldvlN5.js";
|
|
2
2
|
export { decodePackage, encodePackage, packageCodec, xmlCodec };
|
package/dist/index.cjs
CHANGED
|
@@ -141,16 +141,21 @@ exports.readOdbForm = require_typed_odb_form.readOdbForm;
|
|
|
141
141
|
exports.readOdbInventory = require_typed_odb_read.readOdbInventory;
|
|
142
142
|
exports.readOdbReport = require_typed_odb_report.readOdbReport;
|
|
143
143
|
exports.readOdfFormula = require_typed_formula_read.readOdfFormula;
|
|
144
|
-
exports.
|
|
144
|
+
exports.readOdfFormulaContent = require_typed_formula_read.readOdfFormulaContent;
|
|
145
|
+
exports.readOdfFormulaMathMl = require_typed_formula_read.readOdfFormulaMathMl;
|
|
145
146
|
exports.readOdfListParagraphs = require_typed_shared_list.readOdfListParagraphs;
|
|
146
147
|
exports.readOdfMetadata = require_typed_shared_metadata.readOdfMetadata;
|
|
147
148
|
exports.readOdfParagraph = require_typed_shared_paragraph.readOdfParagraph;
|
|
148
149
|
exports.readOdfTable = require_typed_shared_table.readOdfTable;
|
|
149
150
|
exports.readOdg = require_typed_odg_read.readOdg;
|
|
151
|
+
exports.readOdgContent = require_typed_odg_read.readOdgContent;
|
|
150
152
|
exports.readOdm = require_typed_odm_read.readOdm;
|
|
151
153
|
exports.readOdp = require_typed_odp_read.readOdp;
|
|
154
|
+
exports.readOdpContent = require_typed_odp_read.readOdpContent;
|
|
152
155
|
exports.readOds = require_typed_ods_read.readOds;
|
|
156
|
+
exports.readOdsContent = require_typed_ods_read.readOdsContent;
|
|
153
157
|
exports.readOdt = require_typed_odt_read.readOdt;
|
|
158
|
+
exports.readOdtContent = require_typed_odt_read.readOdtContent;
|
|
154
159
|
exports.resolveDrawPageSize = require_typed_shared_masterpage.resolveDrawPageSize;
|
|
155
160
|
exports.resolveOdbComponent = require_typed_odb_read.resolveOdbComponent;
|
|
156
161
|
exports.resolveOdfListKind = require_typed_shared_list.resolveOdfListKind;
|
package/dist/index.d.cts
CHANGED
|
@@ -33,15 +33,15 @@ import { n as resolvePageLayoutProperties, t as resolveDrawPageSize } from "./ma
|
|
|
33
33
|
import { a as buildOdfSubpaths, c as parseOdfViewBox, i as OdfViewBox, l as rawSubpathFromPoints, n as OdfRawSegment, o as parseOdfPathData, r as OdfRawSubpath, s as parseOdfPointsList, t as OdfRawPoint, u as scaleOdfRawPoint } from "./path-DE7wkIcz.cjs";
|
|
34
34
|
import { a as walkDrawShapes, i as readDrawPageContent, n as readDrawFrame, r as readDrawImageBlock, t as DrawPageContent } from "./shapes-BqcccDK8.cjs";
|
|
35
35
|
import { n as EmbeddedDrawObject, r as readDrawObjectReference, t as EmbeddedDocumentKind } from "./embedded-D7Kr1Sce.cjs";
|
|
36
|
-
import { n as readOdp, t as OdpDocument } from "./read-
|
|
37
|
-
import { n as readOdt, t as OdtDocument } from "./read-
|
|
38
|
-
import { n as readOdg, t as OdgDocument } from "./read-
|
|
39
|
-
import { n as readOds, t as OdsDocument } from "./read-
|
|
40
|
-
import { i as
|
|
36
|
+
import { n as readOdp, r as readOdpContent, t as OdpDocument } from "./read-KpU38maT.cjs";
|
|
37
|
+
import { n as readOdt, r as readOdtContent, t as OdtDocument } from "./read-CszvDMMt.cjs";
|
|
38
|
+
import { n as readOdg, r as readOdgContent, t as OdgDocument } from "./read-BM8KaFQS.cjs";
|
|
39
|
+
import { n as readOds, r as readOdsContent, t as OdsDocument } from "./read-BHpPvhzR.cjs";
|
|
40
|
+
import { a as readOdfFormulaMathMl, i as readOdfFormulaContent, r as readOdfFormula, t as OdfFormulaDocument } from "./read-xCmo7cec.cjs";
|
|
41
41
|
import { n as OdmSection, r as readOdm, t as OdmDocument } from "./read-DNNf5_6n.cjs";
|
|
42
42
|
import { a as readOdbInventory, i as OdbQueryInfo, n as OdbConnectionInfo, o as resolveOdbComponent, r as OdbInventory, t as OdbComponentInfo } from "./read-DrdmKX0x.cjs";
|
|
43
43
|
import { n as subDocumentPackage, t as SubDocumentPackageOptions } from "./subdocument-CIxH3a5V.cjs";
|
|
44
|
-
import { i as readOdbForm, n as OdbFormControl, r as OdbFormDefinition, t as OdbForm } from "./form-
|
|
44
|
+
import { i as readOdbForm, n as OdbFormControl, r as OdbFormDefinition, t as OdbForm } from "./form-DSIbHxog.cjs";
|
|
45
45
|
import { a as OdbReportGroup, i as OdbReportFunction, n as OdbReportBand, o as readOdbReport, r as OdbReportElement, t as OdbReport } from "./report-BuCJ7_YU.cjs";
|
|
46
|
-
import { a as Alignment, i as xmlCodec, n as encodePackage, o as AlignmentSchema, r as packageCodec, t as decodePackage } from "./codec-
|
|
47
|
-
export { type Alignment, AlignmentSchema, type Attribute, AttributeSchema, type BinaryPart, BinaryPartSchema, type BuildManifestOptions, type CascadeDiagnostic, type DrawPageContent, type EmbeddedDocumentKind, type EmbeddedDrawObject, type ImageFormat, type InternRequest, type LengthUnit, MANIFEST_PART, META_PART, MIMETYPE_PART, type Manifest, type ManifestEntry, ManifestEntrySchema, type ManifestProblem, ManifestProblemSchema, ManifestSchema, ODF_MEDIA_TYPES, ODF_NAMESPACES, type OdbComponentInfo, type OdbConnectionInfo, type OdbForm, type OdbFormControl, type OdbFormDefinition, type OdbInventory, type OdbQueryInfo, type OdbReport, type OdbReportBand, type OdbReportElement, type OdbReportFunction, type OdbReportGroup, type OdfExtension, type OdfFormulaDocument, type OdfListIdState, type OdfListParagraphReader, type OdfNamespacePrefix, type OdfPoint, type OdfRawPoint, type OdfRawSegment, type OdfRawSubpath, type OdfShapeGeometry, type OdfTransformFunction, type OdfViewBox, type OdgDocument, type OdmDocument, type OdmSection, type OdpDocument, type OdsDocument, type OdtDocument, type OtherPartRef, type Package, PackageSchema, type ParsedProperties, type Part, PartSchema, STYLE_FAMILIES, type StyleCascadeResult, type StyleElementChainResult, type StyleFamily, type StyleProperties, StylePropertiesSchema, StyleRegistry, type StyleRegistryOptions, type SubDocumentPackageOptions, TableCursor, type XmlCdata, XmlCdataSchema, type XmlComment, XmlCommentSchema, type XmlDeclaration, XmlDeclarationSchema, type XmlElement, XmlElementSchema, type XmlNode, XmlNodeSchema, type XmlPart, XmlPartSchema, type XmlPi, XmlPiSchema, type XmlText, XmlTextSchema, type ZipEntry, applyOdfTransform, attrValue, base64ToBytes, buildManifest, buildOdfSubpaths, buildStylePropertyElements, buildXml, bytesToBase64, canonicalPropertiesString, cellReference, childrenWithTag, columnIndexToLetters, columnLettersToIndex, composeOdfGroupTransform, decodeOdfText, decodePackage, decodeXmlText, el, elementsWithTag, encodePackage, encodeXmlText, ensureSpan, findChildElement, findStyleElement, formatOdfColor, formatOdfLength, formatPercentageMultiplier, formatPt, getOdfSpaceCount, isStyleFamily, isXmlNode, measureOdfNodeLength, mediaTypeForExtension, mintOdfListNumId, netRotationDeg, packageCodec, paragraphPropertiesToAttributes, parseBox, parseCellReference, parseOdfLength as parseLength, parseOdfLength, parseLinePoints, parseMargins, parseOdfColor, parseOdfPathData, parseOdfPointsList, parseOdfTransform, parseOdfViewBox, parsePackage, parsePageSize, parseParagraphProperties, parseStyleElementProperties, parseTextProperties, parseXml, rawSubpathFromPoints, readDrawFrame, readDrawImageBlock, readDrawObjectReference, readDrawPageContent, readManifest, readMimetype, readOdbForm, readOdbInventory, readOdbReport, readOdfFormula,
|
|
46
|
+
import { a as Alignment, i as xmlCodec, n as encodePackage, o as AlignmentSchema, r as packageCodec, s as DocumentPackage, t as decodePackage } from "./codec-jKlS0rWl.cjs";
|
|
47
|
+
export { type Alignment, AlignmentSchema, type Attribute, AttributeSchema, type BinaryPart, BinaryPartSchema, type BuildManifestOptions, type CascadeDiagnostic, type DocumentPackage, type DrawPageContent, type EmbeddedDocumentKind, type EmbeddedDrawObject, type ImageFormat, type InternRequest, type LengthUnit, MANIFEST_PART, META_PART, MIMETYPE_PART, type Manifest, type ManifestEntry, ManifestEntrySchema, type ManifestProblem, ManifestProblemSchema, ManifestSchema, ODF_MEDIA_TYPES, ODF_NAMESPACES, type OdbComponentInfo, type OdbConnectionInfo, type OdbForm, type OdbFormControl, type OdbFormDefinition, type OdbInventory, type OdbQueryInfo, type OdbReport, type OdbReportBand, type OdbReportElement, type OdbReportFunction, type OdbReportGroup, type OdfExtension, type OdfFormulaDocument, type OdfListIdState, type OdfListParagraphReader, type OdfNamespacePrefix, type OdfPoint, type OdfRawPoint, type OdfRawSegment, type OdfRawSubpath, type OdfShapeGeometry, type OdfTransformFunction, type OdfViewBox, type OdgDocument, type OdmDocument, type OdmSection, type OdpDocument, type OdsDocument, type OdtDocument, type OtherPartRef, type Package, PackageSchema, type ParsedProperties, type Part, PartSchema, STYLE_FAMILIES, type StyleCascadeResult, type StyleElementChainResult, type StyleFamily, type StyleProperties, StylePropertiesSchema, StyleRegistry, type StyleRegistryOptions, type SubDocumentPackageOptions, TableCursor, type XmlCdata, XmlCdataSchema, type XmlComment, XmlCommentSchema, type XmlDeclaration, XmlDeclarationSchema, type XmlElement, XmlElementSchema, type XmlNode, XmlNodeSchema, type XmlPart, XmlPartSchema, type XmlPi, XmlPiSchema, type XmlText, XmlTextSchema, type ZipEntry, applyOdfTransform, attrValue, base64ToBytes, buildManifest, buildOdfSubpaths, buildStylePropertyElements, buildXml, bytesToBase64, canonicalPropertiesString, cellReference, childrenWithTag, columnIndexToLetters, columnLettersToIndex, composeOdfGroupTransform, decodeOdfText, decodePackage, decodeXmlText, el, elementsWithTag, encodePackage, encodeXmlText, ensureSpan, findChildElement, findStyleElement, formatOdfColor, formatOdfLength, formatPercentageMultiplier, formatPt, getOdfSpaceCount, isStyleFamily, isXmlNode, measureOdfNodeLength, mediaTypeForExtension, mintOdfListNumId, netRotationDeg, packageCodec, paragraphPropertiesToAttributes, parseBox, parseCellReference, parseOdfLength as parseLength, parseOdfLength, parseLinePoints, parseMargins, parseOdfColor, parseOdfPathData, parseOdfPointsList, parseOdfTransform, parseOdfViewBox, parsePackage, parsePageSize, parseParagraphProperties, parseStyleElementProperties, parseTextProperties, parseXml, rawSubpathFromPoints, readDrawFrame, readDrawImageBlock, readDrawObjectReference, readDrawPageContent, readManifest, readMimetype, readOdbForm, readOdbInventory, readOdbReport, readOdfFormula, readOdfFormulaContent, readOdfFormulaMathMl, readOdfListParagraphs, readOdfMetadata, readOdfParagraph, readOdfTable, readOdg, readOdgContent, readOdm, readOdp, readOdpContent, readOds, readOdsContent, readOdt, readOdtContent, resolveDrawPageSize, resolveOdbComponent, resolveOdfListKind, resolveOdfShapeGeometry, resolvePageLayoutProperties, resolveStyle, resolveStyleElementChain, rootElement, scaleOdfRawPoint, serializePackage, setDocumentMediaType, sniffImageFormat, subDocumentPackage, sumOdfNodeLength, syncManifest, textPropertiesToAttributes, txt, unzipPackage, validateManifest, walkDrawShapes, writeManifest, writeMimetype, xmlCodec, xmlnsAttributes, zipPackage };
|
package/dist/index.d.ts
CHANGED
|
@@ -33,15 +33,15 @@ import { n as resolvePageLayoutProperties, t as resolveDrawPageSize } from "./ma
|
|
|
33
33
|
import { a as buildOdfSubpaths, c as parseOdfViewBox, i as OdfViewBox, l as rawSubpathFromPoints, n as OdfRawSegment, o as parseOdfPathData, r as OdfRawSubpath, s as parseOdfPointsList, t as OdfRawPoint, u as scaleOdfRawPoint } from "./path-DE7wkIcz.js";
|
|
34
34
|
import { a as walkDrawShapes, i as readDrawPageContent, n as readDrawFrame, r as readDrawImageBlock, t as DrawPageContent } from "./shapes-BB59aIC8.js";
|
|
35
35
|
import { n as EmbeddedDrawObject, r as readDrawObjectReference, t as EmbeddedDocumentKind } from "./embedded-CNMqOrnt.js";
|
|
36
|
-
import { n as readOdp, t as OdpDocument } from "./read-
|
|
37
|
-
import { n as readOdt, t as OdtDocument } from "./read-
|
|
38
|
-
import { n as readOdg, t as OdgDocument } from "./read-
|
|
39
|
-
import { n as readOds, t as OdsDocument } from "./read-
|
|
40
|
-
import { i as
|
|
36
|
+
import { n as readOdp, r as readOdpContent, t as OdpDocument } from "./read-YSIwlhrk.js";
|
|
37
|
+
import { n as readOdt, r as readOdtContent, t as OdtDocument } from "./read-C6MhadqG.js";
|
|
38
|
+
import { n as readOdg, r as readOdgContent, t as OdgDocument } from "./read-B9zz_ax1.js";
|
|
39
|
+
import { n as readOds, r as readOdsContent, t as OdsDocument } from "./read-B4zS8bGb.js";
|
|
40
|
+
import { a as readOdfFormulaMathMl, i as readOdfFormulaContent, r as readOdfFormula, t as OdfFormulaDocument } from "./read-DOuXgPhP.js";
|
|
41
41
|
import { n as OdmSection, r as readOdm, t as OdmDocument } from "./read-BkFbEves.js";
|
|
42
42
|
import { a as readOdbInventory, i as OdbQueryInfo, n as OdbConnectionInfo, o as resolveOdbComponent, r as OdbInventory, t as OdbComponentInfo } from "./read-BoIUENWq.js";
|
|
43
43
|
import { n as subDocumentPackage, t as SubDocumentPackageOptions } from "./subdocument-DQNQF7wV.js";
|
|
44
|
-
import { i as readOdbForm, n as OdbFormControl, r as OdbFormDefinition, t as OdbForm } from "./form-
|
|
44
|
+
import { i as readOdbForm, n as OdbFormControl, r as OdbFormDefinition, t as OdbForm } from "./form-BsAAx5-p.js";
|
|
45
45
|
import { a as OdbReportGroup, i as OdbReportFunction, n as OdbReportBand, o as readOdbReport, r as OdbReportElement, t as OdbReport } from "./report-MpwUgXbA.js";
|
|
46
|
-
import { a as Alignment, i as xmlCodec, n as encodePackage, o as AlignmentSchema, r as packageCodec, t as decodePackage } from "./codec-
|
|
47
|
-
export { type Alignment, AlignmentSchema, type Attribute, AttributeSchema, type BinaryPart, BinaryPartSchema, type BuildManifestOptions, type CascadeDiagnostic, type DrawPageContent, type EmbeddedDocumentKind, type EmbeddedDrawObject, type ImageFormat, type InternRequest, type LengthUnit, MANIFEST_PART, META_PART, MIMETYPE_PART, type Manifest, type ManifestEntry, ManifestEntrySchema, type ManifestProblem, ManifestProblemSchema, ManifestSchema, ODF_MEDIA_TYPES, ODF_NAMESPACES, type OdbComponentInfo, type OdbConnectionInfo, type OdbForm, type OdbFormControl, type OdbFormDefinition, type OdbInventory, type OdbQueryInfo, type OdbReport, type OdbReportBand, type OdbReportElement, type OdbReportFunction, type OdbReportGroup, type OdfExtension, type OdfFormulaDocument, type OdfListIdState, type OdfListParagraphReader, type OdfNamespacePrefix, type OdfPoint, type OdfRawPoint, type OdfRawSegment, type OdfRawSubpath, type OdfShapeGeometry, type OdfTransformFunction, type OdfViewBox, type OdgDocument, type OdmDocument, type OdmSection, type OdpDocument, type OdsDocument, type OdtDocument, type OtherPartRef, type Package, PackageSchema, type ParsedProperties, type Part, PartSchema, STYLE_FAMILIES, type StyleCascadeResult, type StyleElementChainResult, type StyleFamily, type StyleProperties, StylePropertiesSchema, StyleRegistry, type StyleRegistryOptions, type SubDocumentPackageOptions, TableCursor, type XmlCdata, XmlCdataSchema, type XmlComment, XmlCommentSchema, type XmlDeclaration, XmlDeclarationSchema, type XmlElement, XmlElementSchema, type XmlNode, XmlNodeSchema, type XmlPart, XmlPartSchema, type XmlPi, XmlPiSchema, type XmlText, XmlTextSchema, type ZipEntry, applyOdfTransform, attrValue, base64ToBytes, buildManifest, buildOdfSubpaths, buildStylePropertyElements, buildXml, bytesToBase64, canonicalPropertiesString, cellReference, childrenWithTag, columnIndexToLetters, columnLettersToIndex, composeOdfGroupTransform, decodeOdfText, decodePackage, decodeXmlText, el, elementsWithTag, encodePackage, encodeXmlText, ensureSpan, findChildElement, findStyleElement, formatOdfColor, formatOdfLength, formatPercentageMultiplier, formatPt, getOdfSpaceCount, isStyleFamily, isXmlNode, measureOdfNodeLength, mediaTypeForExtension, mintOdfListNumId, netRotationDeg, packageCodec, paragraphPropertiesToAttributes, parseBox, parseCellReference, parseOdfLength as parseLength, parseOdfLength, parseLinePoints, parseMargins, parseOdfColor, parseOdfPathData, parseOdfPointsList, parseOdfTransform, parseOdfViewBox, parsePackage, parsePageSize, parseParagraphProperties, parseStyleElementProperties, parseTextProperties, parseXml, rawSubpathFromPoints, readDrawFrame, readDrawImageBlock, readDrawObjectReference, readDrawPageContent, readManifest, readMimetype, readOdbForm, readOdbInventory, readOdbReport, readOdfFormula,
|
|
46
|
+
import { a as Alignment, i as xmlCodec, n as encodePackage, o as AlignmentSchema, r as packageCodec, s as DocumentPackage, t as decodePackage } from "./codec-DqldvlN5.js";
|
|
47
|
+
export { type Alignment, AlignmentSchema, type Attribute, AttributeSchema, type BinaryPart, BinaryPartSchema, type BuildManifestOptions, type CascadeDiagnostic, type DocumentPackage, type DrawPageContent, type EmbeddedDocumentKind, type EmbeddedDrawObject, type ImageFormat, type InternRequest, type LengthUnit, MANIFEST_PART, META_PART, MIMETYPE_PART, type Manifest, type ManifestEntry, ManifestEntrySchema, type ManifestProblem, ManifestProblemSchema, ManifestSchema, ODF_MEDIA_TYPES, ODF_NAMESPACES, type OdbComponentInfo, type OdbConnectionInfo, type OdbForm, type OdbFormControl, type OdbFormDefinition, type OdbInventory, type OdbQueryInfo, type OdbReport, type OdbReportBand, type OdbReportElement, type OdbReportFunction, type OdbReportGroup, type OdfExtension, type OdfFormulaDocument, type OdfListIdState, type OdfListParagraphReader, type OdfNamespacePrefix, type OdfPoint, type OdfRawPoint, type OdfRawSegment, type OdfRawSubpath, type OdfShapeGeometry, type OdfTransformFunction, type OdfViewBox, type OdgDocument, type OdmDocument, type OdmSection, type OdpDocument, type OdsDocument, type OdtDocument, type OtherPartRef, type Package, PackageSchema, type ParsedProperties, type Part, PartSchema, STYLE_FAMILIES, type StyleCascadeResult, type StyleElementChainResult, type StyleFamily, type StyleProperties, StylePropertiesSchema, StyleRegistry, type StyleRegistryOptions, type SubDocumentPackageOptions, TableCursor, type XmlCdata, XmlCdataSchema, type XmlComment, XmlCommentSchema, type XmlDeclaration, XmlDeclarationSchema, type XmlElement, XmlElementSchema, type XmlNode, XmlNodeSchema, type XmlPart, XmlPartSchema, type XmlPi, XmlPiSchema, type XmlText, XmlTextSchema, type ZipEntry, applyOdfTransform, attrValue, base64ToBytes, buildManifest, buildOdfSubpaths, buildStylePropertyElements, buildXml, bytesToBase64, canonicalPropertiesString, cellReference, childrenWithTag, columnIndexToLetters, columnLettersToIndex, composeOdfGroupTransform, decodeOdfText, decodePackage, decodeXmlText, el, elementsWithTag, encodePackage, encodeXmlText, ensureSpan, findChildElement, findStyleElement, formatOdfColor, formatOdfLength, formatPercentageMultiplier, formatPt, getOdfSpaceCount, isStyleFamily, isXmlNode, measureOdfNodeLength, mediaTypeForExtension, mintOdfListNumId, netRotationDeg, packageCodec, paragraphPropertiesToAttributes, parseBox, parseCellReference, parseOdfLength as parseLength, parseOdfLength, parseLinePoints, parseMargins, parseOdfColor, parseOdfPathData, parseOdfPointsList, parseOdfTransform, parseOdfViewBox, parsePackage, parsePageSize, parseParagraphProperties, parseStyleElementProperties, parseTextProperties, parseXml, rawSubpathFromPoints, readDrawFrame, readDrawImageBlock, readDrawObjectReference, readDrawPageContent, readManifest, readMimetype, readOdbForm, readOdbInventory, readOdbReport, readOdfFormula, readOdfFormulaContent, readOdfFormulaMathMl, readOdfListParagraphs, readOdfMetadata, readOdfParagraph, readOdfTable, readOdg, readOdgContent, readOdm, readOdp, readOdpContent, readOds, readOdsContent, readOdt, readOdtContent, resolveDrawPageSize, resolveOdbComponent, resolveOdfListKind, resolveOdfShapeGeometry, resolvePageLayoutProperties, resolveStyle, resolveStyleElementChain, rootElement, scaleOdfRawPoint, serializePackage, setDocumentMediaType, sniffImageFormat, subDocumentPackage, sumOdfNodeLength, syncManifest, textPropertiesToAttributes, txt, unzipPackage, validateManifest, walkDrawShapes, writeManifest, writeMimetype, xmlCodec, xmlnsAttributes, zipPackage };
|
package/dist/index.js
CHANGED
|
@@ -33,16 +33,16 @@ 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, readDrawImageBlock, readDrawPageContent, walkDrawShapes } from "./typed/draw/shapes.js";
|
|
36
|
-
import { readOdfFormula,
|
|
36
|
+
import { readOdfFormula, readOdfFormulaContent, readOdfFormulaMathMl } from "./typed/formula/read.js";
|
|
37
37
|
import { subDocumentPackage } from "./typed/odb/subdocument.js";
|
|
38
38
|
import { readDrawObjectReference } from "./typed/draw/embedded.js";
|
|
39
|
-
import { readOdp } from "./typed/odp/read.js";
|
|
40
|
-
import { readOdt } from "./typed/odt/read.js";
|
|
41
|
-
import { readOdg } from "./typed/odg/read.js";
|
|
42
|
-
import { readOds } from "./typed/ods/read.js";
|
|
39
|
+
import { readOdp, readOdpContent } from "./typed/odp/read.js";
|
|
40
|
+
import { readOdt, readOdtContent } from "./typed/odt/read.js";
|
|
41
|
+
import { readOdg, readOdgContent } from "./typed/odg/read.js";
|
|
42
|
+
import { readOds, readOdsContent } from "./typed/ods/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";
|
|
46
46
|
import { readOdbReport } from "./typed/odb/report.js";
|
|
47
47
|
import { AlignmentSchema } from "document-schema.js";
|
|
48
|
-
export { AlignmentSchema, AttributeSchema, BinaryPartSchema, MANIFEST_PART, META_PART, MIMETYPE_PART, ManifestEntrySchema, ManifestProblemSchema, ManifestSchema, ODF_MEDIA_TYPES, ODF_NAMESPACES, PackageSchema, PartSchema, STYLE_FAMILIES, StylePropertiesSchema, StyleRegistry, TableCursor, XmlCdataSchema, XmlCommentSchema, XmlDeclarationSchema, XmlElementSchema, XmlNodeSchema, XmlPartSchema, XmlPiSchema, XmlTextSchema, applyOdfTransform, attrValue, base64ToBytes, buildManifest, buildOdfSubpaths, buildStylePropertyElements, buildXml, bytesToBase64, canonicalPropertiesString, cellReference, childrenWithTag, columnIndexToLetters, columnLettersToIndex, composeOdfGroupTransform, decodeOdfText, decodePackage, decodeXmlText, el, elementsWithTag, encodePackage, encodeXmlText, ensureSpan, findChildElement, findStyleElement, formatOdfColor, formatOdfLength, formatPercentageMultiplier, formatPt, getOdfSpaceCount, isStyleFamily, isXmlNode, measureOdfNodeLength, mediaTypeForExtension, mintOdfListNumId, netRotationDeg, packageCodec, paragraphPropertiesToAttributes, parseBox, parseCellReference, parseOdfLength as parseLength, parseOdfLength, parseLinePoints, parseMargins, parseOdfColor, parseOdfPathData, parseOdfPointsList, parseOdfTransform, parseOdfViewBox, parsePackage, parsePageSize, parseParagraphProperties, parseStyleElementProperties, parseTextProperties, parseXml, rawSubpathFromPoints, readDrawFrame, readDrawImageBlock, readDrawObjectReference, readDrawPageContent, readManifest, readMimetype, readOdbForm, readOdbInventory, readOdbReport, readOdfFormula,
|
|
48
|
+
export { AlignmentSchema, AttributeSchema, BinaryPartSchema, MANIFEST_PART, META_PART, MIMETYPE_PART, ManifestEntrySchema, ManifestProblemSchema, ManifestSchema, ODF_MEDIA_TYPES, ODF_NAMESPACES, PackageSchema, PartSchema, STYLE_FAMILIES, StylePropertiesSchema, StyleRegistry, TableCursor, XmlCdataSchema, XmlCommentSchema, XmlDeclarationSchema, XmlElementSchema, XmlNodeSchema, XmlPartSchema, XmlPiSchema, XmlTextSchema, applyOdfTransform, attrValue, base64ToBytes, buildManifest, buildOdfSubpaths, buildStylePropertyElements, buildXml, bytesToBase64, canonicalPropertiesString, cellReference, childrenWithTag, columnIndexToLetters, columnLettersToIndex, composeOdfGroupTransform, decodeOdfText, decodePackage, decodeXmlText, el, elementsWithTag, encodePackage, encodeXmlText, ensureSpan, findChildElement, findStyleElement, formatOdfColor, formatOdfLength, formatPercentageMultiplier, formatPt, getOdfSpaceCount, isStyleFamily, isXmlNode, measureOdfNodeLength, mediaTypeForExtension, mintOdfListNumId, netRotationDeg, packageCodec, paragraphPropertiesToAttributes, parseBox, parseCellReference, parseOdfLength as parseLength, parseOdfLength, parseLinePoints, parseMargins, parseOdfColor, parseOdfPathData, parseOdfPointsList, parseOdfTransform, parseOdfViewBox, parsePackage, parsePageSize, parseParagraphProperties, parseStyleElementProperties, parseTextProperties, parseXml, rawSubpathFromPoints, readDrawFrame, readDrawImageBlock, readDrawObjectReference, readDrawPageContent, readManifest, readMimetype, readOdbForm, readOdbInventory, readOdbReport, readOdfFormula, readOdfFormulaContent, readOdfFormulaMathMl, readOdfListParagraphs, readOdfMetadata, readOdfParagraph, readOdfTable, readOdg, readOdgContent, readOdm, readOdp, readOdpContent, readOds, readOdsContent, readOdt, readOdtContent, resolveDrawPageSize, resolveOdbComponent, resolveOdfListKind, resolveOdfShapeGeometry, resolvePageLayoutProperties, resolveStyle, resolveStyleElementChain, rootElement, scaleOdfRawPoint, serializePackage, setDocumentMediaType, sniffImageFormat, subDocumentPackage, sumOdfNodeLength, syncManifest, textPropertiesToAttributes, txt, unzipPackage, validateManifest, walkDrawShapes, writeManifest, writeMimetype, xmlCodec, xmlnsAttributes, zipPackage };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Package } from "./model/package.js";
|
|
2
|
+
import { ContentSheet, DocumentPackage, LayoutMetadata } from "document-schema.js";
|
|
3
|
+
//#region src/typed/ods/read.d.ts
|
|
4
|
+
interface OdsDocument {
|
|
5
|
+
metadata: LayoutMetadata;
|
|
6
|
+
sheets: ContentSheet[];
|
|
7
|
+
}
|
|
8
|
+
declare function readOdsContent(pkg: Package): OdsDocument;
|
|
9
|
+
declare function readOds(pkg: Package): DocumentPackage;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { readOds as n, readOdsContent as r, OdsDocument as t };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Package } from "./model/package.js";
|
|
2
|
+
import { ContentDrawPage, DocumentPackage, LayoutMetadata } from "document-schema.js";
|
|
3
|
+
//#region src/typed/odg/read.d.ts
|
|
4
|
+
interface OdgDocument {
|
|
5
|
+
metadata: LayoutMetadata;
|
|
6
|
+
pages: ContentDrawPage[];
|
|
7
|
+
}
|
|
8
|
+
declare function readOdgContent(pkg: Package): OdgDocument;
|
|
9
|
+
declare function readOdg(pkg: Package): DocumentPackage;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { readOdg as n, readOdgContent as r, OdgDocument as t };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Package } from "./model/package.cjs";
|
|
2
|
+
import { ContentSheet, DocumentPackage, LayoutMetadata } from "document-schema.js";
|
|
3
|
+
//#region src/typed/ods/read.d.ts
|
|
4
|
+
interface OdsDocument {
|
|
5
|
+
metadata: LayoutMetadata;
|
|
6
|
+
sheets: ContentSheet[];
|
|
7
|
+
}
|
|
8
|
+
declare function readOdsContent(pkg: Package): OdsDocument;
|
|
9
|
+
declare function readOds(pkg: Package): DocumentPackage;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { readOds as n, readOdsContent as r, OdsDocument as t };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Package } from "./model/package.cjs";
|
|
2
|
+
import { ContentDrawPage, DocumentPackage, LayoutMetadata } from "document-schema.js";
|
|
3
|
+
//#region src/typed/odg/read.d.ts
|
|
4
|
+
interface OdgDocument {
|
|
5
|
+
metadata: LayoutMetadata;
|
|
6
|
+
pages: ContentDrawPage[];
|
|
7
|
+
}
|
|
8
|
+
declare function readOdgContent(pkg: Package): OdgDocument;
|
|
9
|
+
declare function readOdg(pkg: Package): DocumentPackage;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { readOdg as n, readOdgContent as r, OdgDocument as t };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Package } from "./model/package.js";
|
|
2
|
+
import { ContentSection, DocumentPackage, LayoutMetadata } from "document-schema.js";
|
|
3
|
+
//#region src/typed/odt/read.d.ts
|
|
4
|
+
interface OdtDocument {
|
|
5
|
+
metadata: LayoutMetadata;
|
|
6
|
+
sections: ContentSection[];
|
|
7
|
+
}
|
|
8
|
+
declare function readOdtContent(pkg: Package): OdtDocument;
|
|
9
|
+
declare function readOdt(pkg: Package): DocumentPackage;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { readOdt as n, readOdtContent as r, OdtDocument as t };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Package } from "./model/package.cjs";
|
|
2
|
+
import { ContentSection, DocumentPackage, LayoutMetadata } from "document-schema.js";
|
|
3
|
+
//#region src/typed/odt/read.d.ts
|
|
4
|
+
interface OdtDocument {
|
|
5
|
+
metadata: LayoutMetadata;
|
|
6
|
+
sections: ContentSection[];
|
|
7
|
+
}
|
|
8
|
+
declare function readOdtContent(pkg: Package): OdtDocument;
|
|
9
|
+
declare function readOdt(pkg: Package): DocumentPackage;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { readOdt as n, readOdtContent as r, OdtDocument as t };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { d as XmlNode, l as XmlElement } from "./node-CkBWRjNR.js";
|
|
2
|
+
import { Package } from "./model/package.js";
|
|
3
|
+
import { ContentDocument, DocumentPackage, LayoutMetadata } from "document-schema.js";
|
|
4
|
+
//#region src/typed/formula/read.d.ts
|
|
5
|
+
interface OdfFormulaDocument {
|
|
6
|
+
starMath?: string;
|
|
7
|
+
mathml: XmlNode[];
|
|
8
|
+
metadata: LayoutMetadata;
|
|
9
|
+
}
|
|
10
|
+
declare function findMathRoot(nodes: readonly XmlNode[]): XmlElement | undefined;
|
|
11
|
+
declare function readOdfFormulaMathMl(pkg: Package): OdfFormulaDocument;
|
|
12
|
+
declare function readOdfFormulaContent(pkg: Package): ContentDocument;
|
|
13
|
+
declare function readOdfFormula(pkg: Package): DocumentPackage;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { readOdfFormulaMathMl as a, readOdfFormulaContent as i, findMathRoot as n, readOdfFormula as r, OdfFormulaDocument as t };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Package } from "./model/package.cjs";
|
|
2
|
+
import { ContentSlide, DocumentPackage, LayoutMetadata } from "document-schema.js";
|
|
3
|
+
//#region src/typed/odp/read.d.ts
|
|
4
|
+
interface OdpDocument {
|
|
5
|
+
metadata: LayoutMetadata;
|
|
6
|
+
slides: ContentSlide[];
|
|
7
|
+
}
|
|
8
|
+
declare function readOdpContent(pkg: Package): OdpDocument;
|
|
9
|
+
declare function readOdp(pkg: Package): DocumentPackage;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { readOdp as n, readOdpContent as r, OdpDocument as t };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Package } from "./model/package.js";
|
|
2
|
+
import { ContentSlide, DocumentPackage, LayoutMetadata } from "document-schema.js";
|
|
3
|
+
//#region src/typed/odp/read.d.ts
|
|
4
|
+
interface OdpDocument {
|
|
5
|
+
metadata: LayoutMetadata;
|
|
6
|
+
slides: ContentSlide[];
|
|
7
|
+
}
|
|
8
|
+
declare function readOdpContent(pkg: Package): OdpDocument;
|
|
9
|
+
declare function readOdp(pkg: Package): DocumentPackage;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { readOdp as n, readOdpContent as r, OdpDocument as t };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { d as XmlNode, l as XmlElement } from "./node-CkBWRjNR.cjs";
|
|
2
|
+
import { Package } from "./model/package.cjs";
|
|
3
|
+
import { ContentDocument, DocumentPackage, LayoutMetadata } from "document-schema.js";
|
|
4
|
+
//#region src/typed/formula/read.d.ts
|
|
5
|
+
interface OdfFormulaDocument {
|
|
6
|
+
starMath?: string;
|
|
7
|
+
mathml: XmlNode[];
|
|
8
|
+
metadata: LayoutMetadata;
|
|
9
|
+
}
|
|
10
|
+
declare function findMathRoot(nodes: readonly XmlNode[]): XmlElement | undefined;
|
|
11
|
+
declare function readOdfFormulaMathMl(pkg: Package): OdfFormulaDocument;
|
|
12
|
+
declare function readOdfFormulaContent(pkg: Package): ContentDocument;
|
|
13
|
+
declare function readOdfFormula(pkg: Package): DocumentPackage;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { readOdfFormulaMathMl as a, readOdfFormulaContent as i, findMathRoot as n, readOdfFormula as r, OdfFormulaDocument as t };
|
|
@@ -2,6 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_xml_entities = require("../../xml/entities.cjs");
|
|
3
3
|
const require_xml_query = require("../../xml/query.cjs");
|
|
4
4
|
const require_typed_shared_metadata = require("../shared/metadata.cjs");
|
|
5
|
+
let document_schema_js = require("document-schema.js");
|
|
5
6
|
//#region src/typed/formula/read.ts
|
|
6
7
|
const CONTENT_PART = "content.xml";
|
|
7
8
|
const MATH_ROOT_TAGS = ["math", "math:math"];
|
|
@@ -28,11 +29,11 @@ function findStarMathAnnotation(mathRoot) {
|
|
|
28
29
|
if (text.length > 0) return text;
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
|
-
function
|
|
32
|
+
function readOdfFormulaMathMl(pkg) {
|
|
32
33
|
const contentPart = pkg.parts[CONTENT_PART];
|
|
33
|
-
if (contentPart?.kind !== "xml") throw new Error(`
|
|
34
|
+
if (contentPart?.kind !== "xml") throw new Error(`readOdfFormulaMathMl: package has no ${CONTENT_PART} part`);
|
|
34
35
|
const mathRoot = findMathRoot(contentPart.nodes);
|
|
35
|
-
if (mathRoot === void 0) throw new Error(`
|
|
36
|
+
if (mathRoot === void 0) throw new Error(`readOdfFormulaMathMl: ${CONTENT_PART} has no MathML root element`);
|
|
36
37
|
const metadata = require_typed_shared_metadata.readOdfMetadata(pkg);
|
|
37
38
|
const starMath = findStarMathAnnotation(mathRoot);
|
|
38
39
|
return starMath === void 0 ? {
|
|
@@ -44,8 +45,8 @@ function readOdfFormula(pkg) {
|
|
|
44
45
|
metadata
|
|
45
46
|
};
|
|
46
47
|
}
|
|
47
|
-
function
|
|
48
|
-
const { mathml, starMath, metadata } =
|
|
48
|
+
function readOdfFormulaContent(pkg) {
|
|
49
|
+
const { mathml, starMath, metadata } = readOdfFormulaMathMl(pkg);
|
|
49
50
|
return {
|
|
50
51
|
kind: "formula",
|
|
51
52
|
metadata,
|
|
@@ -55,7 +56,11 @@ function readOdfFormulaDocument(pkg) {
|
|
|
55
56
|
}
|
|
56
57
|
};
|
|
57
58
|
}
|
|
59
|
+
function readOdfFormula(pkg) {
|
|
60
|
+
return (0, document_schema_js.assemblePackage)(readOdfFormulaContent(pkg));
|
|
61
|
+
}
|
|
58
62
|
//#endregion
|
|
59
63
|
exports.findMathRoot = findMathRoot;
|
|
60
64
|
exports.readOdfFormula = readOdfFormula;
|
|
61
|
-
exports.
|
|
65
|
+
exports.readOdfFormulaContent = readOdfFormulaContent;
|
|
66
|
+
exports.readOdfFormulaMathMl = readOdfFormulaMathMl;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as
|
|
2
|
-
export { OdfFormulaDocument, findMathRoot, readOdfFormula,
|
|
1
|
+
import { a as readOdfFormulaMathMl, i as readOdfFormulaContent, n as findMathRoot, r as readOdfFormula, t as OdfFormulaDocument } from "../../read-xCmo7cec.cjs";
|
|
2
|
+
export { OdfFormulaDocument, findMathRoot, readOdfFormula, readOdfFormulaContent, readOdfFormulaMathMl };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as
|
|
2
|
-
export { OdfFormulaDocument, findMathRoot, readOdfFormula,
|
|
1
|
+
import { a as readOdfFormulaMathMl, i as readOdfFormulaContent, n as findMathRoot, r as readOdfFormula, t as OdfFormulaDocument } from "../../read-DOuXgPhP.js";
|
|
2
|
+
export { OdfFormulaDocument, findMathRoot, readOdfFormula, readOdfFormulaContent, readOdfFormulaMathMl };
|