ooxml.js 3.1.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -25
- package/dist/{build-CBL9scQK.d.cts → build-D-ldsmtA.d.cts} +2 -2
- package/dist/{build-C0gS5QeG.d.ts → build-q0qMH_ML.d.ts} +2 -2
- package/dist/codec-BOGj_yQL.d.ts +90 -0
- package/dist/codec-CZkWeDXF.d.cts +90 -0
- package/dist/codec.d.cts +1 -1
- package/dist/codec.d.ts +1 -1
- package/dist/document-package-BDr3nkqJ.d.cts +10 -0
- package/dist/document-package-kartHoyl.d.ts +10 -0
- package/dist/index.cjs +253 -7
- package/dist/index.d.cts +8 -7
- package/dist/index.d.ts +8 -7
- package/dist/index.js +8 -7
- package/dist/{read-D_CpruL_.d.cts → read-ClIHv1ef.d.cts} +2 -2
- package/dist/{read-OBV7MMlF.d.cts → read-DY3Sm5T3.d.cts} +2 -2
- package/dist/{read-CeCtSzjQ.d.ts → read-DcJZITV9.d.ts} +2 -2
- package/dist/{read-B2-FFhqI.d.ts → read-gB0H2bff.d.ts} +2 -2
- package/dist/typed/document-package.cjs +43 -0
- package/dist/typed/document-package.d.cts +2 -0
- package/dist/typed/document-package.d.ts +2 -0
- package/dist/typed/document-package.js +38 -0
- package/dist/typed/docx/read.cjs +4 -4
- package/dist/typed/docx/read.d.cts +2 -2
- package/dist/typed/docx/read.d.ts +2 -2
- package/dist/typed/docx/read.js +4 -4
- package/dist/typed/docx/write.cjs +3 -3
- package/dist/typed/docx/write.d.cts +2 -2
- package/dist/typed/docx/write.d.ts +2 -2
- package/dist/typed/docx/write.js +3 -3
- package/dist/typed/pptx/read.cjs +2 -2
- package/dist/typed/pptx/read.d.cts +2 -2
- package/dist/typed/pptx/read.d.ts +2 -2
- package/dist/typed/pptx/read.js +2 -2
- package/dist/typed/xlsx/build.cjs +4 -4
- package/dist/typed/xlsx/build.d.cts +2 -2
- package/dist/typed/xlsx/build.d.ts +2 -2
- package/dist/typed/xlsx/build.js +4 -4
- package/dist/typed/xlsx/content.cjs +2 -2
- package/dist/typed/xlsx/content.js +2 -2
- package/dist/typed/xlsx.cjs +2 -2
- package/dist/typed/xlsx.d.cts +2 -2
- package/dist/typed/xlsx.d.ts +2 -2
- package/dist/typed/xlsx.js +2 -2
- package/dist/{write-U3Ap0vHi.d.ts → write-97yEqc6w.d.ts} +2 -2
- package/dist/{write-C08_maSc.d.cts → write-BFEF46Ir.d.cts} +2 -2
- package/dist/{xlsx-B97t4YE-.d.cts → xlsx-CpX5nzGV.d.cts} +2 -2
- package/dist/{xlsx-BxKODiLX.d.ts → xlsx-DacFqZeF.d.ts} +2 -2
- package/package.json +2 -2
- package/dist/codec-B3qT1CGZ.d.ts +0 -89
- package/dist/codec-CuzuI9Dy.d.cts +0 -89
package/README.md
CHANGED
|
@@ -50,7 +50,7 @@ graph TD
|
|
|
50
50
|
|
|
51
51
|
## Why
|
|
52
52
|
|
|
53
|
-
Semantic typed models are lossy and one-directional: they cannot round-trip. True round-trip needs every part, relationship, and binary byte-for-byte at the content level. `ooxml.js` provides that lossless foundation, with typed
|
|
53
|
+
Semantic typed models are lossy and one-directional: they cannot round-trip. True round-trip needs every part, relationship, and binary byte-for-byte at the content level. `ooxml.js` provides that lossless foundation, with typed per-format readers and writers on top — each available both as `document-schema.js`'s tree-form `DocumentPackage` and as the flat, content-level shape that tree decomposes.
|
|
54
54
|
|
|
55
55
|
## Getting started
|
|
56
56
|
|
|
@@ -70,7 +70,7 @@ npm install ooxml.js
|
|
|
70
70
|
|
|
71
71
|
## Compatibility
|
|
72
72
|
|
|
73
|
-
Worker-isomorphic: runtime `src/` uses no Node-only APIs (no `node:*` imports, no bare Node builtins, no `Buffer` global), so the published package runs in Cloudflare Workers, Deno Deploy, browser bundlers, or any ES2024+ host — not just Node. This is enforced statically by an `eslint` guard (`no-restricted-imports`/`no-restricted-globals` in `eslint.config.ts`) that rejects any Node-only import in `src/`, and dynamically by the `workerd` test suite (`pnpm test:workers`) that exercises the xlsx decode path inside a Cloudflare Workers isolate on every CI run. The `engines.node >= 20` pin is the development and CI floor, not a runtime constraint on consumers.
|
|
73
|
+
Worker-isomorphic: runtime `src/` uses no Node-only APIs (no `node:*` imports, no bare Node builtins, no `Buffer` global), so the published package runs in Cloudflare Workers, Deno Deploy, browser bundlers, or any ES2024+ host — not just Node. This is enforced statically by an `eslint` guard (`no-restricted-imports`/`no-restricted-globals` in `eslint.config.ts`) that rejects any Node-only import in `src/`, and dynamically by the `workerd` test suite (`pnpm test:workers`) that exercises the xlsx decode path, and the `DocumentPackage` assembly and write path on top of it, inside a Cloudflare Workers isolate on every CI run. The `engines.node >= 20` pin is the development and CI floor, not a runtime constraint on consumers.
|
|
74
74
|
|
|
75
75
|
## Usage
|
|
76
76
|
|
|
@@ -96,43 +96,80 @@ const pkg = z.decode(packageCodec, bytes);
|
|
|
96
96
|
const out = z.encode(packageCodec, pkg);
|
|
97
97
|
```
|
|
98
98
|
|
|
99
|
-
Typed
|
|
99
|
+
### Typed readers and writers
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
import { decodePackage, readDocx } from 'ooxml.js';
|
|
101
|
+
Above the lossless core sit typed readers that resolve a format's own cascades — the docx style cascade, pptx's placeholder → layout → master → theme inheritance, xlsx's style-index → number-format classification — so order, styling, and geometry come through, not just flattened text. Each format has two entry points onto the same read: one producing `document-schema.js`'s tree-form `DocumentPackage`, one producing the flat, content-level shape that tree decomposes.
|
|
103
102
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
103
|
+
| Format | `DocumentPackage` (primary) | Flat, content-level |
|
|
104
|
+
| --- | --- | --- |
|
|
105
|
+
| docx | `readDocx` / `buildDocxPackage` | `readDocxContent` / `buildDocxPackageFromContent` |
|
|
106
|
+
| pptx | `readPptx` (read-only) | `readPptxContent` (read-only) |
|
|
107
|
+
| xlsx | `readXlsx` / `buildXlsxPackage` | `readXlsxContent` / `buildXlsxPackageFromContent` |
|
|
108
|
+
|
|
109
|
+
`readXlsxWorkbook` sits outside the table: a separate lossy, cell-values-only reading view (sheet names, references, resolved values, formulas, merged ranges, defined names) with no write side.
|
|
108
110
|
|
|
109
|
-
|
|
111
|
+
#### The `DocumentPackage` API
|
|
112
|
+
|
|
113
|
+
`readDocx`/`readPptx`/`readXlsx` decompose what they read into the tree `document-schema.js` defines — one group per top-level container, headings and lists nested inside the section they belong to, block-scoped constructs promoted to the region they span, repeated formatting factored into a package-level styles table. `buildDocxPackage`/`buildXlsxPackage` take one back the other way:
|
|
110
114
|
|
|
111
115
|
```ts
|
|
112
116
|
import { buildDocxPackage, decodePackage, encodePackage, readDocx } from 'ooxml.js';
|
|
113
117
|
|
|
114
|
-
const
|
|
115
|
-
//
|
|
116
|
-
//
|
|
117
|
-
|
|
118
|
+
const document = readDocx(decodePackage(bytes)); // DocumentPackage, kind: 'wordprocessing'
|
|
119
|
+
// document.children is one section group per section, the section's page geometry on the group's own
|
|
120
|
+
// node. Inside it, a heading paragraph opens a group holding the blocks beneath it, a list paragraph
|
|
121
|
+
// opens its own, and a table stays a leaf — decomposition groups a container's block flow, it never
|
|
122
|
+
// descends into a table's cells.
|
|
123
|
+
const out = encodePackage(buildDocxPackage(document)); // a complete docx, built from scratch
|
|
118
124
|
```
|
|
119
125
|
|
|
120
|
-
|
|
126
|
+
Readers mint the styles table (`assemblePackage`, i.e. `decompose` plus the frequency pass) because a reader is where a package first comes into existence. Writers materialise every ref back into direct properties (`flattenPackage`) before handing the content to the format writer, so a minted package, a hand-built one with no table at all, and a re-minted one all write out identically. Both transforms — and `decompose`/`factorStyles` for a caller composing its own boundary — are re-exported from this package, so consuming what these readers return takes no second dependency.
|
|
121
127
|
|
|
122
|
-
`
|
|
128
|
+
Minting has a real consequence for a caller walking the tree by hand, and it is the single biggest behavioural difference between these primary names and the `Content` ones below: a run or paragraph that shares its formatting with others in the same subtree no longer carries that formatting itself. Three bold, red paragraphs in one section come back as three plain `{"text": "..."}` runs plus one `style: "s1"` ref on the enclosing group, with `styles: {"s1": {"run": {"bold": true, "color": {...}}}}` on the package root — not as three runs each carrying `bold`/`color` directly. Reading a run's real effective formatting off a tree therefore means resolving its ancestor groups' `style` refs first: `resolveStyleChain` collects the chain from the root down to a node, `overlayStyleEntries` merges it outermost-first (the nearest entry wins), and `applyParagraphStyleProperties`/`applyRunStyleProperties` gap-fill a resolved entry onto whatever direct properties the node already carries. All four are re-exported from this package's barrel alongside `StylesTable`/`StyleEntry`/`StyleParagraphProperties`/`StyleRunProperties`, so resolving a run's formatting back out of a tree takes no second dependency either. A `Content`-suffixed reader never needs any of this: it returns a fully materialised `ContentDocument` with no refs and no table to consult.
|
|
129
|
+
|
|
130
|
+
#### The flat, content-level API
|
|
131
|
+
|
|
132
|
+
The `Content`-suffixed functions are what the tree-form ones wrap, exported in their own right for a caller driving a pipeline stage by stage (`documents.js`'s conversion engine does exactly this) or needing what the tree has no spelling for. Routing through the tree costs no fidelity of its own: `buildDocxPackage(readDocx(pkg))` builds the identical `Package` `buildDocxPackageFromContent(readDocxContent(pkg))` does, and flattening a tree reproduces exactly the content its content-level reader returns — both pinned in `src/typed/document-package.test.ts`.
|
|
123
133
|
|
|
124
134
|
```ts
|
|
125
|
-
import {
|
|
135
|
+
import { buildXlsxPackageFromContent, decodePackage, readXlsxContent } from 'ooxml.js';
|
|
126
136
|
|
|
127
137
|
const content = readXlsxContent(decodePackage(bytes)); // ContentDocument, kind: 'spreadsheet'
|
|
128
|
-
const pkg =
|
|
138
|
+
const pkg = buildXlsxPackageFromContent(content); // a fresh Package built from scratch, not a write-back into `pkg`
|
|
129
139
|
```
|
|
130
140
|
|
|
141
|
+
`readDocxContent` is the only reader in this package that returns a docx's comments, footnotes, header/footer text, and `word/numbering.xml` definitions: those sit on `DocxDocument` outside its `sections`, which is exactly the part of it `ContentDocument` — and therefore the tree — has no place for. They do not survive `buildDocxPackageFromContent` either (it writes none of those parts), so this is about which reader returns them, not about which pair round-trips them.
|
|
142
|
+
|
|
143
|
+
#### Fidelity constructs
|
|
144
|
+
|
|
145
|
+
Both docx readers read the block-scoped fidelity constructs — structured document tags, fields, bookmarks, and tracked changes. In the flat form they are `document-schema.js` construct-boundary markers bracketing the blocks each one spans, one matched `constructStart`/`constructEnd` pair per construct, nesting as brackets do; in the tree they are promoted to a group over exactly that region, carrying the same descriptor. Both docx writers write them back.
|
|
146
|
+
|
|
147
|
+
A construct whose extent is a sub-sequence of one paragraph's runs — a field inside a sentence, a bookmark over three words, a few inserted words in an otherwise untouched paragraph — has no marker encoding: the marker pair brackets whole blocks, so those occurrences keep their existing treatment (the text still comes through; the construct itself does not). See the gotchas below.
|
|
148
|
+
|
|
149
|
+
### Migrating from 3.x
|
|
150
|
+
|
|
151
|
+
The `DocumentPackage` readers and writers took the primary names, and the functions that held them were renamed rather than removed. Every one of them still behaves exactly as it did:
|
|
152
|
+
|
|
153
|
+
| Was | Is now |
|
|
154
|
+
| --- | --- |
|
|
155
|
+
| `readDocx` | `readDocxContent` |
|
|
156
|
+
| `readPptx` | `readPptxContent` |
|
|
157
|
+
| `readXlsx` | `readXlsxWorkbook` |
|
|
158
|
+
| `buildDocxPackage` | `buildDocxPackageFromContent` |
|
|
159
|
+
| `buildXlsxPackage` | `buildXlsxPackageFromContent` |
|
|
160
|
+
|
|
161
|
+
`readXlsxContent` is unchanged, and is the one name that already followed this convention.
|
|
162
|
+
|
|
163
|
+
Three of the renames are silent under a plain call — `readDocx`, `readPptx`, and `readXlsx` still take a `Package`, they just return a `DocumentPackage` now — so a TypeScript caller sees the break where it uses the result (`doc.sections` becomes `document.children`), and a JavaScript caller sees it at runtime. Either add the `Content` suffix to keep the previous behaviour, or move to the tree.
|
|
164
|
+
|
|
165
|
+
### Deep imports
|
|
166
|
+
|
|
131
167
|
Every module under `src/` is importable directly, by the same path it has relative to `src/`, without going through the barrel:
|
|
132
168
|
|
|
133
169
|
```ts
|
|
134
170
|
import { bytesToBase64, base64ToBytes } from 'ooxml.js/util/base64';
|
|
135
171
|
import { readXlsxContent } from 'ooxml.js/typed/xlsx/content';
|
|
172
|
+
import { readDocx, buildDocxPackage } from 'ooxml.js/typed/document-package';
|
|
136
173
|
```
|
|
137
174
|
|
|
138
175
|
## The ooxml.js format
|
|
@@ -241,23 +278,25 @@ The package layers a lossless core outward to lossy convenience views:
|
|
|
241
278
|
- **`src/package-io/`** — `read.ts`/`write.ts` unzip, classify each entry as XML or binary (`looksLikeXml` byte sniff), and parse/serialize.
|
|
242
279
|
- **`src/codec.ts`** — public round-trip surface: `packageCodec`/`xmlCodec` (`z.codec()` pairs) plus `decodePackage`/`encodePackage` wrappers.
|
|
243
280
|
- **`src/compact.ts`** — the ooxml.js format: `compactCodec`/`compactPackageCodec` plus `toCompact`/`fromCompact`/`decodeCompactPackage`/`encodeCompactPackage` wrappers.
|
|
244
|
-
- **`src/typed/`** — lossy projections. `
|
|
245
|
-
- **`src/typed/
|
|
246
|
-
- **`src/typed/
|
|
281
|
+
- **`src/typed/`** — lossy projections. `readDocxContent` resolves the full style cascade (`docDefaults` → `basedOn` → paragraph-mark → character styles → direct formatting) into ordered `sections` plus comments/footnotes/headers/footers/numbering; `readPptxContent` resolves placeholder → layout → master → theme inheritance into `slides` (presentation order via `p:sldIdLst`); `readXlsxWorkbook` covers cell values/formulas, merged ranges, defined names. `typed/shared/` holds shared OOXML primitives (`drawingml.ts` geometry/theme/colour, `color.ts` `ColorTransform` cascade, `units.ts`, `metadata.ts`, `source-path.ts`). Types come from `document-schema.js`. Only the docx and xlsx `ContentDocument`-shaped pairs encode back to a `Package`; everything else is one-way, and faithful round-tripping goes through `decodePackage`/`encodePackage`.
|
|
282
|
+
- **`src/typed/document-package.ts`** — the `DocumentPackage`-native surface, and nothing else: `readDocx`/`readPptx`/`readXlsx` are their content-level reader composed with `document-schema.js`'s `assemblePackage`, `buildDocxPackage`/`buildXlsxPackage` are `flattenPackage` composed with their content-level writer. One module rather than one per format, because the adapters are format-uniform and the reasoning behind them (why a reader mints styles rather than calling bare `decompose`, why a writer's kind guard lives at this boundary, what a docx's non-content parts do instead of riding the tree) is one argument stated once.
|
|
283
|
+
- **`src/typed/docx/`** — `read.ts` and `write.ts` are a read/write pair over `ContentSection[]`. `constructs.ts` owns the fidelity construct vocabulary both halves share: the descriptor shapes (`contentControl` from `w:sdt`, `field` from `w:fldChar`/`w:fldSimple`, `anchor` from `w:bookmarkStart`/`End`, `provenance` from `w:ins`/`w:del`/`w:moveFrom`/`w:moveTo`) and the rule deciding which occurrences are block-scoped enough to bracket. `buildDocxPackageFromContent` builds a complete docx `Package` from scratch; it writes no `styles.xml`, `numbering.xml`, comments, footnotes, or headers/footers, so the `DocxDocument` fields outside `sections` do not survive the pair.
|
|
284
|
+
- **`src/typed/xlsx/`** — a `ContentDocument`-shaped read/write pair alongside the lossy `readXlsxWorkbook` (both exported; different callers). `readXlsxContent` reads column widths, row heights, hidden rows/columns, merged ranges, every cell value kind, print settings, and cell comments (`comments.ts`: legacy `xl/comments{N}.xml` notes plus `[MS-XLSX]` threaded comments, both resolved through the worksheet part's own relationships, never by part name); `buildXlsxPackageFromContent` builds a complete xlsx `Package` from scratch (never editing the decoded package). `number-format.ts`/`styles.ts`/`serial.ts` run both ways: reading classifies style index → format code → kind (`percentage`/`currency`/`date`/`time`/`dateTime`); writing emits interned `numFmt` codes, fed back through the classifier in tests. The classifier is not a formatter (`displayText` is the typed-value spelling). Scope limits: `currency` with no ISO code writes as plain `number`; non-canonical temporal values degrade to text; cell comments read but do not write (`buildXlsxPackageFromContent` emits no comment part, so they do not survive this pair); column widths re-approximate through xlsx's own character-width unit on every write, so a width drifts slightly on each round trip rather than reaching a fixed point.
|
|
247
285
|
|
|
248
286
|
## Conventions
|
|
249
287
|
|
|
250
288
|
- **Zod-first schema/type/guard.** Every model type is inferred from its Zod schema (`z.infer<typeof XSchema>`), not hand-written.
|
|
251
289
|
- **`XmlNode` uses a recursive structural guard, not `z.lazy`.** `z.lazy` collapses to `unknown` for element-children in the pinned Zod version, so `XmlElementSchema` validates `children` via `z.custom<XmlNode>(isXmlNode)`. Any change to `XmlNode`'s shape must update `isXmlNode` in step. `CompactXmlNode` and `document-schema.js`'s `ContentBlock` reuse this pattern.
|
|
252
|
-
- **Lossless core vs. lossy views is a hard boundary.** `decodePackage`/`encodePackage` stay byte/part faithful. A `src/typed/*` reader is a lossy projection; faithful round-tripping goes through the generic `Package`. `readXlsxContent`/`
|
|
290
|
+
- **Lossless core vs. lossy views is a hard boundary.** `decodePackage`/`encodePackage` stay byte/part faithful. A `src/typed/*` reader is a lossy projection; faithful round-tripping goes through the generic `Package`. `readXlsxContent`/`buildXlsxPackageFromContent` and `readDocxContent`/`buildDocxPackageFromContent` are the deliberate exceptions — read/write pairs around the shared content model, where each writer builds a fresh package rather than touching the decoded one. The `DocumentPackage`-native pairs above them are those same pairs with a structural transform on each end, so they inherit exactly the same boundary.
|
|
253
291
|
- **XML entities stay raw in the lossless layer.** `parseXml` runs with `processEntities: false`; typed readers decode the five standard entities (`decodeEntities` in `typed/util.ts`) only in their own lossy projection.
|
|
254
292
|
- **No type assertions.** `eslint.config.ts` bans `as` and angle-bracket casts (`assertionStyle: "never"`, `noInlineConfig: true` — no `eslint-disable` escape hatch). Narrow with a guard or parse with Zod.
|
|
255
293
|
|
|
256
294
|
## Gotchas and quirks
|
|
257
295
|
|
|
296
|
+
- **A `Content` suffix means the flat form, not a lesser one.** `readDocx` and `readDocxContent` are the same read; the suffix says which shape comes back (`DocumentPackage` versus the flat `DocxDocument`/`ContentDocument`), never which is more faithful. The pair that genuinely differs in what it reads is `readXlsxWorkbook`, whose name says so by naming its own return type rather than taking a suffix.
|
|
258
297
|
- **A construct marker brackets whole blocks, never a sub-sequence of runs.** `document-schema.js`'s flat form has no run-level extent, so an inline field, a mid-paragraph bookmark, a run-level content control, or a few inserted words inside an otherwise untouched paragraph are read exactly as before — the text survives, the construct does not. So does an extent that crosses another, or that straddles a section break: neither is expressible as balanced brackets, and both are dropped rather than emitted at a position that would decode to a different nesting.
|
|
259
|
-
-
|
|
260
|
-
-
|
|
298
|
+
- **The docx pair round-trips `sections`, not a whole `DocxDocument`.** Numbering definitions, cell border styling/shading, and `w:themeColor` (without `themeShade`/`themeTint`) are read; images read into `ContentImageBlock` (floating `wp:anchor` position not recorded); `PAGE`/`NUMPAGES` fields resolve to Word's cached text. The writer emits no `styles.xml`, `numbering.xml`, comments, footnotes, or headers/footers, so the `DocxDocument` fields outside `sections` do not come back — a paragraph's `styleId` is still written as a `w:pStyle` reference, resolving to nothing, since every property the style would have contributed is already spelled as direct formatting by then.
|
|
299
|
+
- **pptx is read-only.** Connector shapes (`p:cxnSp`) are skipped; shape rotation composes through groups; a chart graphic frame reads its chart part's cached series/category model into a table block (header row = series names, one row per category index); a SmartArt graphic frame reads its diagram data model's node text as paragraphs in diagram order (depth-first over `parOf` connections, siblings by `srcOrd`); an OLE graphic frame reads the fallback picture its `mc:Fallback` carries (or, with none reachable, a paragraph naming the `p:oleObj`'s `progId`) — the embedded payload itself is an external application's data and is not decoded.
|
|
261
300
|
- **xlsx has no native percentage/currency/date/time cell type.** Both directions are closed via the number-format engine: reading classifies style → format code → kind; writing emits interned `numFmt` codes, fed back through the classifier in tests. `displayText` is the typed-value spelling, not the producer's rendered string.
|
|
262
301
|
- **`test:smoke` depends on a fresh build.** It runs `tsdown && vitest run --project smoke`, always rebuilding `dist/` first. A bare `vitest` runs both projects; `smoke` fails loudly (`Cannot find module '../dist/index.js'`) if `dist/` is unbuilt.
|
|
263
302
|
- **Binary-vs-XML part classification is a byte sniff, not an extension check.** `looksLikeXml` looks for a leading `<` after skipping a UTF-8 BOM and whitespace; any future binary format starting with `<` would misclassify.
|
|
@@ -281,7 +320,7 @@ Commits follow Conventional Commits (`feat:`, `fix:`, `test:`, `chore:`, …), e
|
|
|
281
320
|
|
|
282
321
|
## References
|
|
283
322
|
|
|
284
|
-
- [document-schema.js](https://github.com/ExaDev/document-schema.js) — canonical `ContentBlock`/`ContentSection`/geometry/colour schemas and `ContentDocument`/`LayoutMetadata` types shared with `odf.js` and `documents.js
|
|
323
|
+
- [document-schema.js](https://github.com/ExaDev/document-schema.js) — canonical `ContentBlock`/`ContentSection`/geometry/colour schemas and `ContentDocument`/`LayoutMetadata` types shared with `odf.js` and `documents.js`, plus the `DocumentPackage` tree and the `decompose`/`flattenPackage`/`assemblePackage`/`factorStyles` transform this package's primary readers and writers are built on.
|
|
285
324
|
- [odf.js](https://github.com/ExaDev/odf.js) — sibling OpenDocument Format package, also on `document-schema.js`.
|
|
286
325
|
- [documents.js](https://github.com/ExaDev/documents.js) — adds PDF conversion and a read-and-write docx/pptx editor on top of this package.
|
|
287
326
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as Package } from "./package-L24lkba-.cjs";
|
|
2
2
|
import { ContentDocument } from "document-schema.js";
|
|
3
3
|
//#region src/typed/xlsx/build.d.ts
|
|
4
|
-
declare function
|
|
4
|
+
declare function buildXlsxPackageFromContent(document: ContentDocument): Package;
|
|
5
5
|
//#endregion
|
|
6
|
-
export {
|
|
6
|
+
export { buildXlsxPackageFromContent as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as Package } from "./package-BUojjTXf.js";
|
|
2
2
|
import { ContentDocument } from "document-schema.js";
|
|
3
3
|
//#region src/typed/xlsx/build.d.ts
|
|
4
|
-
declare function
|
|
4
|
+
declare function buildXlsxPackageFromContent(document: ContentDocument): Package;
|
|
5
5
|
//#endregion
|
|
6
|
-
export {
|
|
6
|
+
export { buildXlsxPackageFromContent as t };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { d as XmlNode } from "./node-CkBWRjNR.js";
|
|
2
|
+
import { r as Package } from "./package-BUojjTXf.js";
|
|
3
|
+
import "./read-CMDEXqGw.js";
|
|
4
|
+
import "./write-CT-EgVT7.js";
|
|
5
|
+
import "./parse-A8_8sdpX.js";
|
|
6
|
+
import "./build-Z1KRkSEB.js";
|
|
7
|
+
import "./fragment-B1ZV7T5Z.js";
|
|
8
|
+
import "./util-DFe4UbvU.js";
|
|
9
|
+
import "./compact-f0TfhicN.js";
|
|
10
|
+
import "./color-fFIKAs-Y.js";
|
|
11
|
+
import "./metadata-o_WH9V_I.js";
|
|
12
|
+
import "./document-package-kartHoyl.js";
|
|
13
|
+
import "./read-gB0H2bff.js";
|
|
14
|
+
import "./write-97yEqc6w.js";
|
|
15
|
+
import "./numbering-D0YfuiOO.js";
|
|
16
|
+
import "./read-DcJZITV9.js";
|
|
17
|
+
import "./xlsx-DacFqZeF.js";
|
|
18
|
+
import "./content-t6ZfmfQM.js";
|
|
19
|
+
import "./build-q0qMH_ML.js";
|
|
20
|
+
import { z } from "zod";
|
|
21
|
+
import { Alignment as Alignment$1, AlignmentSchema, AnchorDescriptor as AnchorDescriptor$1, AnchorDescriptorSchema, AnchorType, AnchorTypeSchema, Box as Box$1, BoxSchema, COLOR_BLACK as COLOR_BLACK$1, Color as Color$1, ColorSchema, ConstructDescriptor as ConstructDescriptor$1, ConstructDescriptorSchema, ConstructMarkerImbalance, ConstructMarkerImbalanceError, ContentBlock as ContentBlock$1, ContentBlockSchema, ContentBorder, ContentBorderSchema, ContentCellBorders as ContentCellBorders$1, ContentCellBordersSchema, ContentCellValue, ContentCellValueSchema, ContentConstructEnd, ContentConstructEndSchema, ContentConstructStart, ContentConstructStartSchema, ContentControlDescriptor as ContentControlDescriptor$1, ContentControlDescriptorSchema, ContentControlLock, ContentControlLockSchema, ContentControlType, ContentControlTypeSchema, ContentDocument as ContentDocument$1, ContentDocumentSchema, ContentImageBlock, ContentImageBlockSchema, ContentListMembership, ContentListMembershipSchema, ContentPageBreak, ContentPageBreakSchema, ContentParagraph as ContentParagraph$1, ContentParagraphSchema, ContentRun, ContentRunSchema, ContentSection as ContentSection$1, ContentSectionSchema as ContentSectionSchema$1, ContentShape, ContentShapeSchema, ContentSheet, ContentSheetCell, ContentSheetCellSchema, ContentSheetColumn, ContentSheetColumnSchema, ContentSheetImage, ContentSheetImageSchema, ContentSheetPrintRange as ContentSheetPrintRange$1, ContentSheetPrintRangeSchema, ContentSheetPrintSettings as ContentSheetPrintSettings$1, ContentSheetPrintSettingsSchema, ContentSheetRepeatRange as ContentSheetRepeatRange$1, ContentSheetRepeatRangeSchema, ContentSheetRow, ContentSheetRowSchema, ContentSheetSchema, ContentSlide, ContentSlideSchema as ContentSlideSchema$1, ContentStrokeStyle, ContentStrokeStyleSchema, ContentTable as ContentTable$1, ContentTableCell, ContentTableCellSchema, ContentTableRow, ContentTableRowSchema, ContentTableSchema, DivisionDescriptor, DivisionDescriptorSchema, DocumentPackage as DocumentPackage$1, DocumentPackageSchema, DrawPageChild, DrawPageDescriptor, DrawPageGroupNode, DrawPageGroupSchema, FieldDescriptor, FieldDescriptorSchema, HeadingGroupNode, HeadingGroupSchema, HeadingParagraph, LinkDescriptor, LinkDescriptorSchema, LinkTarget, LinkTargetSchema, ListChild, ListGroupNode, ListGroupSchema, ListParagraph, Margins, MarginsSchema, PAGE_SIZE_A4 as PAGE_SIZE_A4$1, PAGE_SIZE_LETTER as PAGE_SIZE_LETTER$1, PackageBlockLeaf, PackageBlockLeafSchema, PackageChildren, PackageGroup, PackageGroupSchema, PackageLeaf, PackageLeafSchema, PackageNode, PackageNodeSchema, PageSize as PageSize$1, PageSizeSchema, ProvenanceChange as ProvenanceChange$1, ProvenanceChangeSchema, ProvenanceDescriptor as ProvenanceDescriptor$1, ProvenanceDescriptorSchema, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN as SLIDE_SIZE_WIDESCREEN$1, SectionChild, SectionConstructGroupNode, SectionConstructGroupSchema, SectionDescriptor, SectionGroupNode, SectionGroupSchema, ShapeChild, ShapeConstructGroupNode, ShapeConstructGroupSchema, ShapeDescriptor, ShapeGroupNode, ShapeGroupSchema, SheetChild, SheetDescriptor, SheetGroupNode, SheetGroupSchema, SlideDescriptor, SlideGroupNode, SlideGroupSchema, StyleEntry, StyleEntrySchema, StyleParagraphProperties, StyleParagraphPropertiesSchema, StyleRunProperties, StyleRunPropertiesSchema, StylesTable, StylesTableSchema, applyParagraphStyleProperties, applyRunStyleProperties, assemblePackage as assemblePackage$1, colorToRgbHex as colorToRgbHex$1, decompose, factorStyles, findConstructMarkerImbalance as findConstructMarkerImbalance$1, flattenPackage as flattenPackage$1, isContentBlock, isContentConstructEnd, isContentConstructStart, isDrawPageGroupNode, isHeadingGroupNode, isListGroupNode, isPackageBlockLeaf, isPackageGroup, isPackageLeaf, isPackageNode, isSectionConstructGroupNode, isSectionGroupNode, isShapeConstructGroupNode, isShapeGroupNode, isSheetGroupNode, isSlideGroupNode, overlayStyleEntries, resolveStyleChain, rgbHexToColor as rgbHexToColor$1 } from "document-schema.js";
|
|
22
|
+
//#region src/codec.d.ts
|
|
23
|
+
declare const xmlCodec: z.ZodCodec<z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
24
|
+
type: z.ZodLiteral<"text">;
|
|
25
|
+
value: z.ZodString;
|
|
26
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
27
|
+
type: z.ZodLiteral<"cdata">;
|
|
28
|
+
value: z.ZodString;
|
|
29
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
30
|
+
type: z.ZodLiteral<"comment">;
|
|
31
|
+
value: z.ZodString;
|
|
32
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
33
|
+
type: z.ZodLiteral<"declaration">;
|
|
34
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
35
|
+
name: z.ZodString;
|
|
36
|
+
value: z.ZodString;
|
|
37
|
+
}, z.core.$strip>>;
|
|
38
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
39
|
+
type: z.ZodLiteral<"pi">;
|
|
40
|
+
target: z.ZodString;
|
|
41
|
+
content: z.ZodString;
|
|
42
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
43
|
+
type: z.ZodLiteral<"element">;
|
|
44
|
+
tag: z.ZodString;
|
|
45
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
46
|
+
name: z.ZodString;
|
|
47
|
+
value: z.ZodString;
|
|
48
|
+
}, z.core.$strip>>;
|
|
49
|
+
children: z.ZodArray<z.ZodCustom<XmlNode, XmlNode>>;
|
|
50
|
+
}, z.core.$strip>], "type">>>;
|
|
51
|
+
declare const packageCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, z.ZodObject<{
|
|
52
|
+
parts: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
53
|
+
kind: z.ZodLiteral<"xml">;
|
|
54
|
+
nodes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
55
|
+
type: z.ZodLiteral<"text">;
|
|
56
|
+
value: z.ZodString;
|
|
57
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
58
|
+
type: z.ZodLiteral<"cdata">;
|
|
59
|
+
value: z.ZodString;
|
|
60
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
61
|
+
type: z.ZodLiteral<"comment">;
|
|
62
|
+
value: z.ZodString;
|
|
63
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
64
|
+
type: z.ZodLiteral<"declaration">;
|
|
65
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
66
|
+
name: z.ZodString;
|
|
67
|
+
value: z.ZodString;
|
|
68
|
+
}, z.core.$strip>>;
|
|
69
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
70
|
+
type: z.ZodLiteral<"pi">;
|
|
71
|
+
target: z.ZodString;
|
|
72
|
+
content: z.ZodString;
|
|
73
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
74
|
+
type: z.ZodLiteral<"element">;
|
|
75
|
+
tag: z.ZodString;
|
|
76
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
77
|
+
name: z.ZodString;
|
|
78
|
+
value: z.ZodString;
|
|
79
|
+
}, z.core.$strip>>;
|
|
80
|
+
children: z.ZodArray<z.ZodCustom<XmlNode, XmlNode>>;
|
|
81
|
+
}, z.core.$strip>], "type">>;
|
|
82
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
83
|
+
kind: z.ZodLiteral<"binary">;
|
|
84
|
+
base64: z.ZodString;
|
|
85
|
+
}, z.core.$strip>], "kind">>;
|
|
86
|
+
}, z.core.$strip>>;
|
|
87
|
+
declare function decodePackage(bytes: Uint8Array<ArrayBuffer>): Package;
|
|
88
|
+
declare function encodePackage(pkg: Package): Uint8Array<ArrayBuffer>;
|
|
89
|
+
//#endregion
|
|
90
|
+
export { ContentShapeSchema as $, isHeadingGroupNode as $n, PackageChildren as $t, ContentConstructStart as A, SlideDescriptor as An, DrawPageChild as At, ContentImageBlock as B, StylesTableSchema as Bn, LinkDescriptorSchema as Bt, ContentBorderSchema as C, ShapeDescriptor as Cn, ContentTableRow as Ct, ContentCellValueSchema as D, SheetDescriptor as Dn, DivisionDescriptorSchema as Dt, ContentCellValue as E, SheetChild as En, DivisionDescriptor as Et, ContentControlLockSchema as F, StyleParagraphProperties as Fn, FieldDescriptorSchema as Ft, ContentPageBreakSchema as G, decompose as Gn, ListGroupSchema as Gt, ContentListMembership as H, applyRunStyleProperties as Hn, LinkTargetSchema as Ht, ContentControlType as I, StyleParagraphPropertiesSchema as In, HeadingGroupNode as It, ContentRun as J, flattenPackage$1 as Jn, MarginsSchema as Jt, ContentParagraph$1 as K, factorStyles as Kn, ListParagraph as Kt, ContentControlTypeSchema as L, StyleRunProperties as Ln, HeadingGroupSchema as Lt, ContentControlDescriptor$1 as M, SlideGroupSchema as Mn, DrawPageGroupNode as Mt, ContentControlDescriptorSchema as N, StyleEntry as Nn, DrawPageGroupSchema as Nt, ContentConstructEnd as O, SheetGroupNode as On, DocumentPackage$1 as Ot, ContentControlLock as P, StyleEntrySchema as Pn, FieldDescriptor as Pt, ContentShape as Q, isDrawPageGroupNode as Qn, PackageBlockLeafSchema as Qt, ContentDocument$1 as R, StyleRunPropertiesSchema as Rn, HeadingParagraph as Rt, ContentBorder as S, ShapeConstructGroupSchema as Sn, ContentTableCellSchema as St, ContentCellBordersSchema as T, ShapeGroupSchema as Tn, ContentTableSchema as Tt, ContentListMembershipSchema as U, assemblePackage$1 as Un, ListChild as Ut, ContentImageBlockSchema as V, applyParagraphStyleProperties as Vn, LinkTarget as Vt, ContentPageBreak as W, colorToRgbHex$1 as Wn, ListGroupNode as Wt, ContentSection$1 as X, isContentConstructEnd as Xn, PAGE_SIZE_LETTER$1 as Xt, ContentRunSchema as Y, isContentBlock as Yn, PAGE_SIZE_A4$1 as Yt, ContentSectionSchema$1 as Z, isContentConstructStart as Zn, PackageBlockLeaf as Zt, ConstructDescriptorSchema as _, SectionDescriptor as _n, ContentSlideSchema$1 as _t, Alignment$1 as a, PackageNodeSchema as an, isSectionConstructGroupNode as ar, ContentSheetImage as at, ContentBlock$1 as b, ShapeChild as bn, ContentTable$1 as bt, AnchorDescriptorSchema as c, ProvenanceChange$1 as cn, isShapeGroupNode as cr, ContentSheetPrintRangeSchema as ct, Box$1 as d, ProvenanceDescriptorSchema as dn, overlayStyleEntries as dr, ContentSheetRepeatRange$1 as dt, PackageGroup as en, isListGroupNode as er, ContentSheet as et, BoxSchema as f, SLIDE_SIZE_STANDARD as fn, resolveStyleChain as fr, ContentSheetRepeatRangeSchema as ft, ConstructDescriptor$1 as g, SectionConstructGroupSchema as gn, ContentSlide as gt, ColorSchema as h, SectionConstructGroupNode as hn, ContentSheetSchema as ht, xmlCodec as i, PackageNode as in, isPackageNode as ir, ContentSheetColumnSchema as it, ContentConstructStartSchema as j, SlideGroupNode as jn, DrawPageDescriptor as jt, ContentConstructEndSchema as k, SheetGroupSchema as kn, DocumentPackageSchema as kt, AnchorType as l, ProvenanceChangeSchema as ln, isSheetGroupNode as lr, ContentSheetPrintSettings$1 as lt, Color$1 as m, SectionChild as mn, ContentSheetRowSchema as mt, encodePackage as n, PackageLeaf as nn, isPackageGroup as nr, ContentSheetCellSchema as nt, AlignmentSchema as o, PageSize$1 as on, isSectionGroupNode as or, ContentSheetImageSchema as ot, COLOR_BLACK$1 as p, SLIDE_SIZE_WIDESCREEN$1 as pn, rgbHexToColor$1 as pr, ContentSheetRow as pt, ContentParagraphSchema as q, findConstructMarkerImbalance$1 as qn, Margins as qt, packageCodec as r, PackageLeafSchema as rn, isPackageLeaf as rr, ContentSheetColumn as rt, AnchorDescriptor$1 as s, PageSizeSchema as sn, isShapeConstructGroupNode as sr, ContentSheetPrintRange$1 as st, decodePackage as t, PackageGroupSchema as tn, isPackageBlockLeaf as tr, ContentSheetCell as tt, AnchorTypeSchema as u, ProvenanceDescriptor$1 as un, isSlideGroupNode as ur, ContentSheetPrintSettingsSchema as ut, ConstructMarkerImbalance as v, SectionGroupNode as vn, ContentStrokeStyle as vt, ContentCellBorders$1 as w, ShapeGroupNode as wn, ContentTableRowSchema as wt, ContentBlockSchema as x, ShapeConstructGroupNode as xn, ContentTableCell as xt, ConstructMarkerImbalanceError as y, SectionGroupSchema as yn, ContentStrokeStyleSchema as yt, ContentDocumentSchema as z, StylesTable as zn, LinkDescriptor as zt };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { d as XmlNode } from "./node-CkBWRjNR.cjs";
|
|
2
|
+
import { r as Package } from "./package-L24lkba-.cjs";
|
|
3
|
+
import "./read-DzmMJPHd.cjs";
|
|
4
|
+
import "./write-6JmxvaK5.cjs";
|
|
5
|
+
import "./parse-CP5FLZqv.cjs";
|
|
6
|
+
import "./build-XSm3I8LT.cjs";
|
|
7
|
+
import "./fragment-B1og_8uA.cjs";
|
|
8
|
+
import "./util-M3JJlDhF.cjs";
|
|
9
|
+
import "./compact-B1qg9oex.cjs";
|
|
10
|
+
import "./color-fFIKAs-Y.cjs";
|
|
11
|
+
import "./metadata-D6o-kLpg.cjs";
|
|
12
|
+
import "./document-package-BDr3nkqJ.cjs";
|
|
13
|
+
import "./read-ClIHv1ef.cjs";
|
|
14
|
+
import "./write-BFEF46Ir.cjs";
|
|
15
|
+
import "./numbering-C53LT-Jx.cjs";
|
|
16
|
+
import "./read-DY3Sm5T3.cjs";
|
|
17
|
+
import "./xlsx-CpX5nzGV.cjs";
|
|
18
|
+
import "./content-UlQ-Nhgi.cjs";
|
|
19
|
+
import "./build-D-ldsmtA.cjs";
|
|
20
|
+
import { z } from "zod";
|
|
21
|
+
import { Alignment as Alignment$1, AlignmentSchema, AnchorDescriptor as AnchorDescriptor$1, AnchorDescriptorSchema, AnchorType, AnchorTypeSchema, Box as Box$1, BoxSchema, COLOR_BLACK, Color as Color$1, ColorSchema, ConstructDescriptor as ConstructDescriptor$1, ConstructDescriptorSchema, ConstructMarkerImbalance, ConstructMarkerImbalanceError, ContentBlock as ContentBlock$1, ContentBlockSchema, ContentBorder, ContentBorderSchema, ContentCellBorders as ContentCellBorders$1, ContentCellBordersSchema, ContentCellValue, ContentCellValueSchema, ContentConstructEnd, ContentConstructEndSchema, ContentConstructStart, ContentConstructStartSchema, ContentControlDescriptor as ContentControlDescriptor$1, ContentControlDescriptorSchema, ContentControlLock, ContentControlLockSchema, ContentControlType, ContentControlTypeSchema, ContentDocument as ContentDocument$1, ContentDocumentSchema, ContentImageBlock, ContentImageBlockSchema, ContentListMembership, ContentListMembershipSchema, ContentPageBreak, ContentPageBreakSchema, ContentParagraph as ContentParagraph$1, ContentParagraphSchema, ContentRun, ContentRunSchema, ContentSection as ContentSection$1, ContentSectionSchema, ContentShape, ContentShapeSchema, ContentSheet, ContentSheetCell, ContentSheetCellSchema, ContentSheetColumn, ContentSheetColumnSchema, ContentSheetImage, ContentSheetImageSchema, ContentSheetPrintRange as ContentSheetPrintRange$1, ContentSheetPrintRangeSchema, ContentSheetPrintSettings as ContentSheetPrintSettings$1, ContentSheetPrintSettingsSchema, ContentSheetRepeatRange as ContentSheetRepeatRange$1, ContentSheetRepeatRangeSchema, ContentSheetRow, ContentSheetRowSchema, ContentSheetSchema, ContentSlide, ContentSlideSchema, ContentStrokeStyle, ContentStrokeStyleSchema, ContentTable as ContentTable$1, ContentTableCell, ContentTableCellSchema, ContentTableRow, ContentTableRowSchema, ContentTableSchema, DivisionDescriptor, DivisionDescriptorSchema, DocumentPackage as DocumentPackage$1, DocumentPackageSchema, DrawPageChild, DrawPageDescriptor, DrawPageGroupNode, DrawPageGroupSchema, FieldDescriptor, FieldDescriptorSchema, HeadingGroupNode, HeadingGroupSchema, HeadingParagraph, LinkDescriptor, LinkDescriptorSchema, LinkTarget, LinkTargetSchema, ListChild, ListGroupNode, ListGroupSchema, ListParagraph, Margins, MarginsSchema, PAGE_SIZE_A4, PAGE_SIZE_LETTER, PackageBlockLeaf, PackageBlockLeafSchema, PackageChildren, PackageGroup, PackageGroupSchema, PackageLeaf, PackageLeafSchema, PackageNode, PackageNodeSchema, PageSize as PageSize$1, PageSizeSchema, ProvenanceChange as ProvenanceChange$1, ProvenanceChangeSchema, ProvenanceDescriptor as ProvenanceDescriptor$1, ProvenanceDescriptorSchema, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, SectionChild, SectionConstructGroupNode, SectionConstructGroupSchema, SectionDescriptor, SectionGroupNode, SectionGroupSchema, ShapeChild, ShapeConstructGroupNode, ShapeConstructGroupSchema, ShapeDescriptor, ShapeGroupNode, ShapeGroupSchema, SheetChild, SheetDescriptor, SheetGroupNode, SheetGroupSchema, SlideDescriptor, SlideGroupNode, SlideGroupSchema, StyleEntry, StyleEntrySchema, StyleParagraphProperties, StyleParagraphPropertiesSchema, StyleRunProperties, StyleRunPropertiesSchema, StylesTable, StylesTableSchema, applyParagraphStyleProperties, applyRunStyleProperties, assemblePackage, colorToRgbHex, decompose, factorStyles, findConstructMarkerImbalance, flattenPackage, isContentBlock, isContentConstructEnd, isContentConstructStart, isDrawPageGroupNode, isHeadingGroupNode, isListGroupNode, isPackageBlockLeaf, isPackageGroup, isPackageLeaf, isPackageNode, isSectionConstructGroupNode, isSectionGroupNode, isShapeConstructGroupNode, isShapeGroupNode, isSheetGroupNode, isSlideGroupNode, overlayStyleEntries, resolveStyleChain, rgbHexToColor } from "document-schema.js";
|
|
22
|
+
//#region src/codec.d.ts
|
|
23
|
+
declare const xmlCodec: z.ZodCodec<z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
24
|
+
type: z.ZodLiteral<"text">;
|
|
25
|
+
value: z.ZodString;
|
|
26
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
27
|
+
type: z.ZodLiteral<"cdata">;
|
|
28
|
+
value: z.ZodString;
|
|
29
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
30
|
+
type: z.ZodLiteral<"comment">;
|
|
31
|
+
value: z.ZodString;
|
|
32
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
33
|
+
type: z.ZodLiteral<"declaration">;
|
|
34
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
35
|
+
name: z.ZodString;
|
|
36
|
+
value: z.ZodString;
|
|
37
|
+
}, z.core.$strip>>;
|
|
38
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
39
|
+
type: z.ZodLiteral<"pi">;
|
|
40
|
+
target: z.ZodString;
|
|
41
|
+
content: z.ZodString;
|
|
42
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
43
|
+
type: z.ZodLiteral<"element">;
|
|
44
|
+
tag: z.ZodString;
|
|
45
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
46
|
+
name: z.ZodString;
|
|
47
|
+
value: z.ZodString;
|
|
48
|
+
}, z.core.$strip>>;
|
|
49
|
+
children: z.ZodArray<z.ZodCustom<XmlNode, XmlNode>>;
|
|
50
|
+
}, z.core.$strip>], "type">>>;
|
|
51
|
+
declare const packageCodec: z.ZodCodec<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>, z.ZodObject<{
|
|
52
|
+
parts: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
53
|
+
kind: z.ZodLiteral<"xml">;
|
|
54
|
+
nodes: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
55
|
+
type: z.ZodLiteral<"text">;
|
|
56
|
+
value: z.ZodString;
|
|
57
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
58
|
+
type: z.ZodLiteral<"cdata">;
|
|
59
|
+
value: z.ZodString;
|
|
60
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
61
|
+
type: z.ZodLiteral<"comment">;
|
|
62
|
+
value: z.ZodString;
|
|
63
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
64
|
+
type: z.ZodLiteral<"declaration">;
|
|
65
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
66
|
+
name: z.ZodString;
|
|
67
|
+
value: z.ZodString;
|
|
68
|
+
}, z.core.$strip>>;
|
|
69
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
70
|
+
type: z.ZodLiteral<"pi">;
|
|
71
|
+
target: z.ZodString;
|
|
72
|
+
content: z.ZodString;
|
|
73
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
74
|
+
type: z.ZodLiteral<"element">;
|
|
75
|
+
tag: z.ZodString;
|
|
76
|
+
attributes: z.ZodArray<z.ZodObject<{
|
|
77
|
+
name: z.ZodString;
|
|
78
|
+
value: z.ZodString;
|
|
79
|
+
}, z.core.$strip>>;
|
|
80
|
+
children: z.ZodArray<z.ZodCustom<XmlNode, XmlNode>>;
|
|
81
|
+
}, z.core.$strip>], "type">>;
|
|
82
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
83
|
+
kind: z.ZodLiteral<"binary">;
|
|
84
|
+
base64: z.ZodString;
|
|
85
|
+
}, z.core.$strip>], "kind">>;
|
|
86
|
+
}, z.core.$strip>>;
|
|
87
|
+
declare function decodePackage(bytes: Uint8Array<ArrayBuffer>): Package;
|
|
88
|
+
declare function encodePackage(pkg: Package): Uint8Array<ArrayBuffer>;
|
|
89
|
+
//#endregion
|
|
90
|
+
export { ContentShapeSchema as $, isHeadingGroupNode as $n, PackageChildren as $t, ContentConstructStart as A, SlideDescriptor as An, DrawPageChild as At, ContentImageBlock as B, StylesTableSchema as Bn, LinkDescriptorSchema as Bt, ContentBorderSchema as C, ShapeDescriptor as Cn, ContentTableRow as Ct, ContentCellValueSchema as D, SheetDescriptor as Dn, DivisionDescriptorSchema as Dt, ContentCellValue as E, SheetChild as En, DivisionDescriptor as Et, ContentControlLockSchema as F, StyleParagraphProperties as Fn, FieldDescriptorSchema as Ft, ContentPageBreakSchema as G, decompose as Gn, ListGroupSchema as Gt, ContentListMembership as H, applyRunStyleProperties as Hn, LinkTargetSchema as Ht, ContentControlType as I, StyleParagraphPropertiesSchema as In, HeadingGroupNode as It, ContentRun as J, flattenPackage as Jn, MarginsSchema as Jt, ContentParagraph$1 as K, factorStyles as Kn, ListParagraph as Kt, ContentControlTypeSchema as L, StyleRunProperties as Ln, HeadingGroupSchema as Lt, ContentControlDescriptor$1 as M, SlideGroupSchema as Mn, DrawPageGroupNode as Mt, ContentControlDescriptorSchema as N, StyleEntry as Nn, DrawPageGroupSchema as Nt, ContentConstructEnd as O, SheetGroupNode as On, DocumentPackage$1 as Ot, ContentControlLock as P, StyleEntrySchema as Pn, FieldDescriptor as Pt, ContentShape as Q, isDrawPageGroupNode as Qn, PackageBlockLeafSchema as Qt, ContentDocument$1 as R, StyleRunPropertiesSchema as Rn, HeadingParagraph as Rt, ContentBorder as S, ShapeConstructGroupSchema as Sn, ContentTableCellSchema as St, ContentCellBordersSchema as T, ShapeGroupSchema as Tn, ContentTableSchema as Tt, ContentListMembershipSchema as U, assemblePackage as Un, ListChild as Ut, ContentImageBlockSchema as V, applyParagraphStyleProperties as Vn, LinkTarget as Vt, ContentPageBreak as W, colorToRgbHex as Wn, ListGroupNode as Wt, ContentSection$1 as X, isContentConstructEnd as Xn, PAGE_SIZE_LETTER as Xt, ContentRunSchema as Y, isContentBlock as Yn, PAGE_SIZE_A4 as Yt, ContentSectionSchema as Z, isContentConstructStart as Zn, PackageBlockLeaf as Zt, ConstructDescriptorSchema as _, SectionDescriptor as _n, ContentSlideSchema as _t, Alignment$1 as a, PackageNodeSchema as an, isSectionConstructGroupNode as ar, ContentSheetImage as at, ContentBlock$1 as b, ShapeChild as bn, ContentTable$1 as bt, AnchorDescriptorSchema as c, ProvenanceChange$1 as cn, isShapeGroupNode as cr, ContentSheetPrintRangeSchema as ct, Box$1 as d, ProvenanceDescriptorSchema as dn, overlayStyleEntries as dr, ContentSheetRepeatRange$1 as dt, PackageGroup as en, isListGroupNode as er, ContentSheet as et, BoxSchema as f, SLIDE_SIZE_STANDARD as fn, resolveStyleChain as fr, ContentSheetRepeatRangeSchema as ft, ConstructDescriptor$1 as g, SectionConstructGroupSchema as gn, ContentSlide as gt, ColorSchema as h, SectionConstructGroupNode as hn, ContentSheetSchema as ht, xmlCodec as i, PackageNode as in, isPackageNode as ir, ContentSheetColumnSchema as it, ContentConstructStartSchema as j, SlideGroupNode as jn, DrawPageDescriptor as jt, ContentConstructEndSchema as k, SheetGroupSchema as kn, DocumentPackageSchema as kt, AnchorType as l, ProvenanceChangeSchema as ln, isSheetGroupNode as lr, ContentSheetPrintSettings$1 as lt, Color$1 as m, SectionChild as mn, ContentSheetRowSchema as mt, encodePackage as n, PackageLeaf as nn, isPackageGroup as nr, ContentSheetCellSchema as nt, AlignmentSchema as o, PageSize$1 as on, isSectionGroupNode as or, ContentSheetImageSchema as ot, COLOR_BLACK as p, SLIDE_SIZE_WIDESCREEN as pn, rgbHexToColor as pr, ContentSheetRow as pt, ContentParagraphSchema as q, findConstructMarkerImbalance as qn, Margins as qt, packageCodec as r, PackageLeafSchema as rn, isPackageLeaf as rr, ContentSheetColumn as rt, AnchorDescriptor$1 as s, PageSizeSchema as sn, isShapeConstructGroupNode as sr, ContentSheetPrintRange$1 as st, decodePackage as t, PackageGroupSchema as tn, isPackageBlockLeaf as tr, ContentSheetCell as tt, AnchorTypeSchema as u, ProvenanceDescriptor$1 as un, isSlideGroupNode as ur, ContentSheetPrintSettingsSchema as ut, ConstructMarkerImbalance as v, SectionGroupNode as vn, ContentStrokeStyle as vt, ContentCellBorders$1 as w, ShapeGroupNode as wn, ContentTableRowSchema as wt, ContentBlockSchema as x, ShapeConstructGroupNode as xn, ContentTableCell as xt, ConstructMarkerImbalanceError as y, SectionGroupSchema as yn, ContentStrokeStyleSchema as yt, ContentDocumentSchema as z, StylesTable as zn, LinkDescriptor as zt };
|
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-CZkWeDXF.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-BOGj_yQL.js";
|
|
2
2
|
export { decodePackage, encodePackage, packageCodec, xmlCodec };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { r as Package } from "./package-L24lkba-.cjs";
|
|
2
|
+
import { DocumentPackage } from "document-schema.js";
|
|
3
|
+
//#region src/typed/document-package.d.ts
|
|
4
|
+
declare function readDocx(pkg: Package): DocumentPackage;
|
|
5
|
+
declare function buildDocxPackage(document: DocumentPackage): Package;
|
|
6
|
+
declare function readPptx(pkg: Package): DocumentPackage;
|
|
7
|
+
declare function readXlsx(pkg: Package): DocumentPackage;
|
|
8
|
+
declare function buildXlsxPackage(document: DocumentPackage): Package;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { readXlsx as a, readPptx as i, buildXlsxPackage as n, readDocx as r, buildDocxPackage as t };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { r as Package } from "./package-BUojjTXf.js";
|
|
2
|
+
import { DocumentPackage } from "document-schema.js";
|
|
3
|
+
//#region src/typed/document-package.d.ts
|
|
4
|
+
declare function readDocx(pkg: Package): DocumentPackage;
|
|
5
|
+
declare function buildDocxPackage(document: DocumentPackage): Package;
|
|
6
|
+
declare function readPptx(pkg: Package): DocumentPackage;
|
|
7
|
+
declare function readXlsx(pkg: Package): DocumentPackage;
|
|
8
|
+
declare function buildXlsxPackage(document: DocumentPackage): Package;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { readXlsx as a, readPptx as i, buildXlsxPackage as n, readDocx as r, buildDocxPackage as t };
|