js.documents 4.0.2 → 4.0.4
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 +6 -6
- package/dist/codecs/registry.cjs +1 -1
- package/dist/codecs/registry.js +6 -6
- package/dist/convert/composition.cjs +1 -1
- package/dist/convert/composition.js +16 -16
- package/dist/convert/convert.cjs +1 -1
- package/dist/convert/convert.js +6 -6
- package/dist/edit/markdown/editor.js +3 -3
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/markdown/read.cjs +2 -2
- package/dist/markdown/read.js +3 -3
- package/dist/markdown/write.cjs +1 -1
- package/dist/markdown/write.js +2 -2
- package/dist/odf/formula/read.cjs +2 -2
- package/dist/odf/formula/read.js +3 -3
- package/dist/odf/odg/read.cjs +1 -1
- package/dist/odf/odg/read.js +2 -2
- package/dist/odf/odp/read.cjs +1 -1
- package/dist/odf/odp/read.js +2 -2
- package/dist/odf/ods/read.cjs +1 -1
- package/dist/odf/ods/read.js +2 -2
- package/dist/odf/odt/read.cjs +1 -1
- package/dist/odf/odt/read.js +2 -2
- package/dist/ooxml/docx/extras.cjs +1 -1
- package/dist/ooxml/docx/extras.js +2 -2
- package/dist/ooxml/docx/read.cjs +1 -1
- package/dist/ooxml/docx/read.js +2 -2
- package/dist/ooxml/pptx/read.cjs +1 -1
- package/dist/ooxml/pptx/read.js +2 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -252,7 +252,7 @@ import { buildOdtPackage } from 'documents.js/edit/odt/content';
|
|
|
252
252
|
|
|
253
253
|
### Reading and building xlsx content directly
|
|
254
254
|
|
|
255
|
-
Every other content format has its own standalone `readXContent`-shaped entry point (`readDocxContent`, `readPptxContent`, `readOdtContent`, `readOdpContent`, `readOdsContent`, `readOdgContent`) — xlsx is no longer the exception. `readXlsxContent`/`buildXlsxPackage` are `ooxml.js`'s own spreadsheet `ContentDocument` read/build pair — the same one the `ods⇄xlsx` bridge and every xlsx metadata-rebuild path already use internally — re-exported here directly rather than wrapped, since `readXlsxContent` already produces the right shape on its own. csv's `readCsvContent`/`buildCsvText` are the same kind of directly-exported stage pair, one level further in: they operate on RFC 4180 text rather than a decoded package (see `src/csv/` under Architecture). svg's `readSvgContent`/`buildSvgText` are the drawing-variant counterpart of csv's pair, operating on SVG text rather than a decoded package (see `src/svg/` under Architecture).
|
|
255
|
+
Every other content format has its own standalone `readXContent`-shaped entry point (`readDocxContent`, `readPptxContent`, `readOdtContent`, `readOdpContent`, `readOdsContent`, `readOdgContent`) — xlsx is no longer the exception. `readXlsxContent`/`buildXlsxPackage` are this package's names for `ooxml.js`'s own spreadsheet `ContentDocument` read/build pair — the same one the `ods⇄xlsx` bridge and every xlsx metadata-rebuild path already use internally — re-exported here directly rather than wrapped, since `readXlsxContent` already produces the right shape on its own. (Since `ooxml.js` 4.0.0 the upstream flat builder is named `buildXlsxPackageFromContent` — the bare `buildXlsxPackage` name moved to that package's tree-form `DocumentPackage` builder — so this package re-exports the flat builder under its own long-standing `buildXlsxPackage` name and the `ContentDocument`-in/`Package`-out contract is unchanged.) csv's `readCsvContent`/`buildCsvText` are the same kind of directly-exported stage pair, one level further in: they operate on RFC 4180 text rather than a decoded package (see `src/csv/` under Architecture). svg's `readSvgContent`/`buildSvgText` are the drawing-variant counterpart of csv's pair, operating on SVG text rather than a decoded package (see `src/svg/` under Architecture).
|
|
256
256
|
|
|
257
257
|
```ts
|
|
258
258
|
import { buildXlsxPackage, decodeDocumentPackage, encodeDocumentPackage, readXlsxContent } from 'documents.js';
|
|
@@ -547,10 +547,10 @@ The package is layered from generic primitives outward to the two conversion dir
|
|
|
547
547
|
- **`src/fonts/`** — source-embedded font extraction (`obfuscation.ts` implements ECMA-376 Part 4, 2.8.1; `ooxml.ts`/`odf.ts` resolve font references) and `registry.ts`'s `createDocumentFontRegistry` composing the precedence chain as data.
|
|
548
548
|
- **`src/mathml/`** — a self-contained MathML presentation-layer typesetting engine (no import from `model`, `pdf-codec`, or `odf.js`; consumes only port contracts from `document-schema.js` and its own locally-mirrored `MathMlNode`). Covers `mrow`/`mi`/`mn`/`mo`/`mtext`/`mspace`/`msub`/`msup`/`msubsup`/`munder`/`mover`/`munderover`/`mfrac`/`msqrt`/`mroot`/`mtable`/`mtr`/`mtd`/`mstyle`/`semantics`, driven by the injected `MathFontMetrics` port. Stretches vertical fences and horizontal braces via the font's `MathVariants` data.
|
|
549
549
|
- **`src/omml/`** — the MathML ⇄ OMML structural translator, both directions. `write.ts` covers the identical construct set `src/mathml/layout.ts` typesets; `read.ts` covers strictly more (reads what Word authored, not just what this package writes). Lives outside `src/mathml/` because its I/O type is `ooxml.js`'s `XmlElement` and `src/mathml/` imports no package.
|
|
550
|
-
- **`src/ooxml/`** — thin adapters over `ooxml.js`'s own `
|
|
550
|
+
- **`src/ooxml/`** — thin adapters over `ooxml.js`'s own flat `readDocxContent`/`readPptxContent` readers, wrapping results into `ContentDocument`. `docx/formula.ts` is the one local reading pass (splicing OOXML math equations). `docx/extras.ts`'s `readDocxExtras` returns comments/footnotes/headers/footers/numbering.
|
|
551
551
|
- **`src/odf/`** — ODF-side counterparts: `readOdtContent`/`readOdpContent`/`readOdsContent`/`readOdgContent` are thin adapters over `odf.js`. `formula/read.ts`/`formula/detect.ts` handle embedded formula detection (genuinely new work with no `odf.js`-side equivalent).
|
|
552
552
|
- **`src/latex/`** — the LaTeX presentation → `MathExpression` lowering: `temml.ts` is the pinned-parser boundary (exact-version temml, its internal parse API guarded behind structural type guards), `lower.ts` the mechanical rules and their degradations, `symbols.ts` the glyph/command map and the prose definition scanner, `rational.ts` the exact-rational helpers, `lint.ts` the coherence lint. See [LaTeX lowering into the semantic core](#latex-lowering-into-the-semantic-core).
|
|
553
|
-
- **`src/markdown/`** — third adapter family, via `markdown-codec`. `readMarkdownContent` passes `
|
|
553
|
+
- **`src/markdown/`** — third adapter family, via `markdown-codec`. `readMarkdownContent` passes `readMarkdownContent`'s (markdown-codec's flat reader, so named since that package's 4.0.0; the bare `readMarkdown` name is now its tree-form `DocumentPackage` reader) result through the math-lowering pass (`math.ts` — markdown-codec's preserved `$$` display blocks and `\( \)` inline spans become two-layer formula blocks, with the document's symbol table seeded from its own prose). `buildMarkdownText` wraps `writeMarkdownContent`, reconstructing markdown math syntax from formula blocks carrying a presentation layer. `text.ts` is the byte↔text boundary. `MarkdownEditor` holds a mutable in-memory `ContentDocument`.
|
|
554
554
|
- **`src/csv/`** — fourth adapter family, sharing the spreadsheet variant with xlsx/ods. `records.ts` is the RFC 4180 record parser/writer (one shared `quoteCsvField`, also used by the `.odb` CSV exporter); `text.ts` is the byte↔text boundary, rejecting malformed UTF-8; `read.ts` turns records into a spreadsheet `ContentDocument` (first record as verbatim string header, data cells through the same cell-typing heuristic `pdfToOds` uses); `write.ts` turns one sheet of a spreadsheet `ContentDocument` back into records via each cell's `displayText`. TSV is the same format with `{ delimiter: '\t' }` on either side.
|
|
555
555
|
- **`src/svg/`** — fifth adapter family, sharing the drawing variant with odg. `text.ts` is the byte↔text boundary, rejecting malformed UTF-8; `read.ts` maps the six SVG shape primitives (rect/circle/ellipse/line/polyline/polygon/path) onto a one-page drawing `ContentDocument`, with transform lists composed as 2×3 affines and CSS lengths and the viewBox map resolved into page points; `write.ts` writes the six primitives back out, one shape element each; `path.ts` is the full SVG path-data grammar (M/L/H/V/C/S/Z plus Q/T/A and the relative forms — S/Q/T convert exactly, A is the one bounded approximation at ≤90° per cubic); `transform.ts` parses and composes the transform attribute and classifies the result by frame representability; `units.ts` resolves CSS length units and the viewBox; `paint.ts` resolves fill/stroke presentation attributes and dash styles; `diagnostics.ts` is the shared scope-limit vocabulary.
|
|
556
556
|
- **`src/layout/`** — the pure conversion algorithms: `engine.ts` (wordprocessing → layout: flow, line-breaking, pagination), `slides.ts` (presentation → layout: direct placement), `sheets.ts` (spreadsheet → layout: grid, print settings, the first algorithm accepting `AbortSignal`), `drawing.ts` (drawing → layout: vector primitives + shape reuse), `reconstruct.ts` (layout → content: baseline clustering for wordprocessing/presentation, near-1:1 mapping for drawing, gridline-lattice-or-text-clustering for spreadsheet).
|
|
@@ -591,7 +591,7 @@ To run a single test file: `pnpm vitest run src/path/to/file.test.ts`.
|
|
|
591
591
|
|
|
592
592
|
## Gotchas and quirks
|
|
593
593
|
|
|
594
|
-
- **`ooxml.js`'s typed readers are the basis for conversion** — `readDocxContent`/`readPptxContent` are thin wrappers, not independent walks. They are deliberately not re-exported (exposing both would invite using the wrong one).
|
|
594
|
+
- **`ooxml.js`'s typed readers are the basis for conversion** — `readDocxContent`/`readPptxContent` are thin wrappers, not independent walks. They are deliberately not re-exported (exposing both would invite using the wrong one). The upstream flat docx reader's `comments`/`footnotes`/`headers`/`footers`/`numbering` are exposed via `readDocxExtras`; pptx has no extras reader yet. xlsx is the one exception: `ooxml.js`'s `readXlsxContent` (and flat builder, re-exported here as `buildXlsxPackage`) already read/write a spreadsheet `ContentDocument` directly (unlike the docx/pptx readers, which `readDocxContent`/`readPptxContent` wrap), so they're re-exported as-is rather than given a documents.js-local wrapper of their own. Since `ooxml.js` 4.0.0 the bare `readDocx`/`readPptx`/`readXlsx`/`buildXlsxPackage` names belong to that package's tree-form `DocumentPackage` readers/builder, and the lossy cell-values-only workbook view is `readXlsxWorkbook` — none of those tree-form names is re-exported, for the same "don't expose both the wrapper and the thing it wraps" reason.
|
|
595
595
|
- **ODF text content is not a plain string.** ODF represents runs of spaces as `<text:s>`, tabs as `<text:tab/>`, line breaks as `<text:line-break/>` — all elements, not text nodes. Every ODF text getter MUST call `decodeOdfText`, never `textContent()` — which silently drops them (no error, just shorter text).
|
|
596
596
|
- **docx⇄PDF and pptx⇄PDF are explicitly not round-trip-lossless** — see [Fidelity](#fidelity). The cross-format bridge pairs are a genuinely different case.
|
|
597
597
|
- **A `DocumentPackage` from `onDocument`/`ConversionResult.package` is a snapshot, not a live view** — mutating the tree's content nodes after the layout pass leaves their `frames` stale; nothing detects or rejects that, and the schema keeps the tree's populated `frames` and `pages` in sync with nothing.
|
|
@@ -630,7 +630,7 @@ To run a single test file: `pnpm vitest run src/path/to/file.test.ts`.
|
|
|
630
630
|
- **PDF → docx/pptx/odt/odp table recovery requires a real drawn gridline lattice** — never text alignment (which would invent structure). A lattice with no text inside is rejected.
|
|
631
631
|
- **Merged table cells round-trip as merged.** docx: horizontal merge collapses to one `w:tc` with `w:gridSpan`; vertical merge needs one `w:tc` per covered row with `w:vMerge`. ODF: one entry per grid position, covered cells get `table:covered-table-cell`.
|
|
632
632
|
- **docx headers/footers/comments/footnotes/numbering are readable via `readDocxExtras`** — `readDocxContent` still drops them (`ContentDocument` has nowhere to put them). `PAGE`/`NUMPAGES` field substitution is never read (it's a render-time value).
|
|
633
|
-
- **A docx inline image reads as a real `ContentImageBlock`** — `buildDocxPackage` recognises
|
|
633
|
+
- **A docx inline image reads as a real `ContentImageBlock`** — `buildDocxPackage` recognises the flat docx reader's two-block pattern (empty-text paragraph + image) and writes it back as one paragraph, avoiding spurious blank paragraphs on round trip.
|
|
634
634
|
- **pptx speaker notes survive via a hidden `/Subtype /Text` annotation** — specific to this package's writer/reader pair; other PDF producers/consumers won't see it.
|
|
635
635
|
- **`odmToPdf` is the one non-bytes-in/bytes-out conversion** — chapters are external `.odt` references requiring `resolveSubDocument`. All unresolved sections are collected before throwing `OdmUnresolvedSectionError`.
|
|
636
636
|
- **`.odb` has no `odbToPdf`** — a database front-end's tables/queries/reports are three unrelated output shapes. Rendered *reports* are the exception: `odbReportToDocx`/`odbReportToOdt`/`odbReportToPdf` take an already-rendered `ContentDocument`.
|
|
@@ -730,7 +730,7 @@ Conventional Commits (`feat:`, `fix:`, `test:`, `chore:`, …), enforced by comm
|
|
|
730
730
|
|
|
731
731
|
## References
|
|
732
732
|
|
|
733
|
-
- [ooxml.js](https://github.com/ExaDev/ooxml.js) — docx/pptx/xlsx ⇄ JSON handling and typed reading, including `readXlsxContent
|
|
733
|
+
- [ooxml.js](https://github.com/ExaDev/ooxml.js) — docx/pptx/xlsx ⇄ JSON handling and typed reading, including `readXlsxContent` and the flat spreadsheet builder it pairs with, `buildXlsxPackageFromContent` (consumed by the `odsToXlsx`/`xlsxToOds` bridge and internal codecs, and re-exported directly from this package's own surface under the long-standing `buildXlsxPackage` name — see [Reading and building xlsx content directly](#reading-and-building-xlsx-content-directly)).
|
|
734
734
|
- [document-schema.js](https://github.com/ExaDev/document-schema.js) — owns `ContentDocument`, the tree-form `DocumentPackage` and its styles-table facility, and the port contracts; shared by all sibling packages.
|
|
735
735
|
- [markdown-codec](https://github.com/ExaDev/markdown-codec) — CommonMark+GFM ⇄ `ContentDocument` handling. The third format (after docx/odt) sharing the wordprocessing pivot.
|
|
736
736
|
- [pdf-codec](https://github.com/ExaDev/pdf-codec) — the hand-written PDF codec (`readPdf`/`writePdf`/`pdfCodec`), the embedded STIX Two Math font, and text-measurement/font-resolution primitives.
|
package/dist/codecs/registry.cjs
CHANGED
|
@@ -104,7 +104,7 @@ const DOCUMENT_FORMAT_CODECS = {
|
|
|
104
104
|
require_ports_abort.throwIfAborted(options?.signal);
|
|
105
105
|
return (0, ooxml_js.readXlsxContent)(require_package_codec.decodeDocumentPackage("xlsx", requireArrayBufferBytes(bytes)));
|
|
106
106
|
},
|
|
107
|
-
write: (content) => require_package_codec.encodeDocumentPackage("xlsx", (0, ooxml_js.
|
|
107
|
+
write: (content) => require_package_codec.encodeDocumentPackage("xlsx", (0, ooxml_js.buildXlsxPackageFromContent)(content))
|
|
108
108
|
} }
|
|
109
109
|
};
|
|
110
110
|
//#endregion
|
package/dist/codecs/registry.js
CHANGED
|
@@ -6,8 +6,8 @@ import { buildOdsPackage } from "../edit/ods/content.js";
|
|
|
6
6
|
import { buildOdgPackage } from "../edit/odg/content.js";
|
|
7
7
|
import { readMarkdownContent } from "../markdown/read.js";
|
|
8
8
|
import { buildMarkdownText } from "../markdown/write.js";
|
|
9
|
-
import { readDocxContent } from "../ooxml/docx/read.js";
|
|
10
|
-
import { readPptxContent } from "../ooxml/pptx/read.js";
|
|
9
|
+
import { readDocxContent as readDocxContent$1 } from "../ooxml/docx/read.js";
|
|
10
|
+
import { readPptxContent as readPptxContent$1 } from "../ooxml/pptx/read.js";
|
|
11
11
|
import { readOdfFormulaContent } from "../odf/formula/read.js";
|
|
12
12
|
import { readOdtContent } from "../odf/odt/read.js";
|
|
13
13
|
import { readOdpContent } from "../odf/odp/read.js";
|
|
@@ -22,7 +22,7 @@ import { readSvgContent } from "../svg/read.js";
|
|
|
22
22
|
import { buildSvgText } from "../svg/write.js";
|
|
23
23
|
import { throwIfAborted } from "../ports/abort.js";
|
|
24
24
|
import { decodeDocumentPackage, encodeDocumentPackage } from "../package-codec.js";
|
|
25
|
-
import {
|
|
25
|
+
import { buildXlsxPackageFromContent, readXlsxContent } from "ooxml.js";
|
|
26
26
|
import { readPdf, writePdf } from "pdf-codec";
|
|
27
27
|
//#region src/codecs/registry.ts
|
|
28
28
|
function isArrayBufferBacked(bytes) {
|
|
@@ -36,14 +36,14 @@ const DOCUMENT_FORMAT_CODECS = {
|
|
|
36
36
|
docx: { content: {
|
|
37
37
|
read: (bytes, options) => {
|
|
38
38
|
throwIfAborted(options?.signal);
|
|
39
|
-
return readDocxContent(decodeDocumentPackage("docx", requireArrayBufferBytes(bytes)));
|
|
39
|
+
return readDocxContent$1(decodeDocumentPackage("docx", requireArrayBufferBytes(bytes)));
|
|
40
40
|
},
|
|
41
41
|
write: (content) => encodeDocumentPackage("docx", buildDocxPackage(content))
|
|
42
42
|
} },
|
|
43
43
|
pptx: { content: {
|
|
44
44
|
read: (bytes, options) => {
|
|
45
45
|
throwIfAborted(options?.signal);
|
|
46
|
-
return readPptxContent(decodeDocumentPackage("pptx", requireArrayBufferBytes(bytes)));
|
|
46
|
+
return readPptxContent$1(decodeDocumentPackage("pptx", requireArrayBufferBytes(bytes)));
|
|
47
47
|
},
|
|
48
48
|
write: (content) => encodeDocumentPackage("pptx", buildPptxPackage(content))
|
|
49
49
|
} },
|
|
@@ -103,7 +103,7 @@ const DOCUMENT_FORMAT_CODECS = {
|
|
|
103
103
|
throwIfAborted(options?.signal);
|
|
104
104
|
return readXlsxContent(decodeDocumentPackage("xlsx", requireArrayBufferBytes(bytes)));
|
|
105
105
|
},
|
|
106
|
-
write: (content) => encodeDocumentPackage("xlsx",
|
|
106
|
+
write: (content) => encodeDocumentPackage("xlsx", buildXlsxPackageFromContent(content))
|
|
107
107
|
} }
|
|
108
108
|
};
|
|
109
109
|
//#endregion
|
|
@@ -76,7 +76,7 @@ const FORMAT_NODES = {
|
|
|
76
76
|
family: "ooxml",
|
|
77
77
|
decode: (bytes) => (0, ooxml_js.decodePackage)(bytes),
|
|
78
78
|
read: (pkg) => (0, ooxml_js.readXlsxContent)(pkg),
|
|
79
|
-
build: (content) => (0, ooxml_js.
|
|
79
|
+
build: (content) => (0, ooxml_js.buildXlsxPackageFromContent)(content),
|
|
80
80
|
encode: (pkg) => (0, ooxml_js.encodePackage)(pkg),
|
|
81
81
|
hasSourcePackage: true
|
|
82
82
|
},
|
|
@@ -5,15 +5,15 @@ import { buildOdtPackage } from "../edit/odt/content.js";
|
|
|
5
5
|
import { buildOdpPackage } from "../edit/odp/content.js";
|
|
6
6
|
import { buildOdsPackage } from "../edit/ods/content.js";
|
|
7
7
|
import { buildOdgPackage } from "../edit/odg/content.js";
|
|
8
|
-
import { readMarkdownContent } from "../markdown/read.js";
|
|
8
|
+
import { readMarkdownContent as readMarkdownContent$1 } from "../markdown/read.js";
|
|
9
9
|
import { buildMarkdownText } from "../markdown/write.js";
|
|
10
10
|
import { createDocumentFontRegistry } from "../fonts/registry.js";
|
|
11
|
-
import { readDocxContent } from "../ooxml/docx/read.js";
|
|
12
|
-
import { readPptxContent } from "../ooxml/pptx/read.js";
|
|
13
|
-
import { readOdtContent } from "../odf/odt/read.js";
|
|
14
|
-
import { readOdpContent } from "../odf/odp/read.js";
|
|
15
|
-
import { readOdsContent } from "../odf/ods/read.js";
|
|
16
|
-
import { readOdgContent } from "../odf/odg/read.js";
|
|
11
|
+
import { readDocxContent as readDocxContent$1 } from "../ooxml/docx/read.js";
|
|
12
|
+
import { readPptxContent as readPptxContent$1 } from "../ooxml/pptx/read.js";
|
|
13
|
+
import { readOdtContent as readOdtContent$1 } from "../odf/odt/read.js";
|
|
14
|
+
import { readOdpContent as readOdpContent$1 } from "../odf/odp/read.js";
|
|
15
|
+
import { readOdsContent as readOdsContent$1 } from "../odf/ods/read.js";
|
|
16
|
+
import { readOdgContent as readOdgContent$1 } from "../odf/odg/read.js";
|
|
17
17
|
import { decodeMarkdownText, encodeMarkdownText } from "../markdown/text.js";
|
|
18
18
|
import { decodeCsvText, encodeCsvText } from "../csv/text.js";
|
|
19
19
|
import { readCsvContent } from "../csv/read.js";
|
|
@@ -29,7 +29,7 @@ import { convertDrawingToLayout } from "../layout/drawing.js";
|
|
|
29
29
|
import { reconstructDrawing, reconstructPresentation, reconstructSpreadsheet, reconstructWordprocessing } from "../layout/reconstruct.js";
|
|
30
30
|
import { drawingToPresentation, presentationToDrawing, presentationToWordprocessing, wordprocessingToPresentation } from "./variant-bridges.js";
|
|
31
31
|
import { UnsupportedConversionError } from "./capability.js";
|
|
32
|
-
import {
|
|
32
|
+
import { buildXlsxPackageFromContent, decodePackage, encodePackage, readXlsxContent } from "ooxml.js";
|
|
33
33
|
import { assemblePackage } from "document-schema.js";
|
|
34
34
|
import { createFontMeasurer, createFontRegistry, loadMathFont, readPdf, writePdf } from "pdf-codec";
|
|
35
35
|
import { decodePackage as decodePackage$1, encodePackage as encodePackage$1 } from "odf.js";
|
|
@@ -56,7 +56,7 @@ const FORMAT_NODES = {
|
|
|
56
56
|
variant: "wordprocessing",
|
|
57
57
|
family: "ooxml",
|
|
58
58
|
decode: (bytes) => decodePackage(bytes),
|
|
59
|
-
read: (pkg, options) => readDocxContent(pkg, { onMathDiagnostic: options?.onMathDiagnostic }),
|
|
59
|
+
read: (pkg, options) => readDocxContent$1(pkg, { onMathDiagnostic: options?.onMathDiagnostic }),
|
|
60
60
|
build: (content, options) => buildDocxPackage(content, { onMathDiagnostic: options?.onMathDiagnostic }),
|
|
61
61
|
encode: (pkg) => encodePackage(pkg),
|
|
62
62
|
hasSourcePackage: true
|
|
@@ -65,7 +65,7 @@ const FORMAT_NODES = {
|
|
|
65
65
|
variant: "presentation",
|
|
66
66
|
family: "ooxml",
|
|
67
67
|
decode: (bytes) => decodePackage(bytes),
|
|
68
|
-
read: (pkg, options) => readPptxContent(pkg, { onMathDiagnostic: options?.onMathDiagnostic }),
|
|
68
|
+
read: (pkg, options) => readPptxContent$1(pkg, { onMathDiagnostic: options?.onMathDiagnostic }),
|
|
69
69
|
build: (content, options) => buildPptxPackage(content, { onMathDiagnostic: options?.onMathDiagnostic }),
|
|
70
70
|
encode: (pkg) => encodePackage(pkg),
|
|
71
71
|
hasSourcePackage: true
|
|
@@ -75,7 +75,7 @@ const FORMAT_NODES = {
|
|
|
75
75
|
family: "ooxml",
|
|
76
76
|
decode: (bytes) => decodePackage(bytes),
|
|
77
77
|
read: (pkg) => readXlsxContent(pkg),
|
|
78
|
-
build: (content) =>
|
|
78
|
+
build: (content) => buildXlsxPackageFromContent(content),
|
|
79
79
|
encode: (pkg) => encodePackage(pkg),
|
|
80
80
|
hasSourcePackage: true
|
|
81
81
|
},
|
|
@@ -83,7 +83,7 @@ const FORMAT_NODES = {
|
|
|
83
83
|
variant: "wordprocessing",
|
|
84
84
|
family: "odf",
|
|
85
85
|
decode: (bytes) => decodePackage$1(bytes),
|
|
86
|
-
read: (pkg) => readOdtContent(pkg),
|
|
86
|
+
read: (pkg) => readOdtContent$1(pkg),
|
|
87
87
|
build: (content) => buildOdtPackage(content),
|
|
88
88
|
encode: (pkg) => encodePackage$1(pkg),
|
|
89
89
|
hasSourcePackage: true
|
|
@@ -92,7 +92,7 @@ const FORMAT_NODES = {
|
|
|
92
92
|
variant: "presentation",
|
|
93
93
|
family: "odf",
|
|
94
94
|
decode: (bytes) => decodePackage$1(bytes),
|
|
95
|
-
read: (pkg) => readOdpContent(pkg),
|
|
95
|
+
read: (pkg) => readOdpContent$1(pkg),
|
|
96
96
|
build: (content) => buildOdpPackage(content),
|
|
97
97
|
encode: (pkg) => encodePackage$1(pkg),
|
|
98
98
|
hasSourcePackage: true
|
|
@@ -101,7 +101,7 @@ const FORMAT_NODES = {
|
|
|
101
101
|
variant: "spreadsheet",
|
|
102
102
|
family: "odf",
|
|
103
103
|
decode: (bytes) => decodePackage$1(bytes),
|
|
104
|
-
read: (pkg) => readOdsContent(pkg),
|
|
104
|
+
read: (pkg) => readOdsContent$1(pkg),
|
|
105
105
|
build: (content) => buildOdsPackage(content),
|
|
106
106
|
encode: (pkg) => encodePackage$1(pkg),
|
|
107
107
|
hasSourcePackage: true
|
|
@@ -110,7 +110,7 @@ const FORMAT_NODES = {
|
|
|
110
110
|
variant: "drawing",
|
|
111
111
|
family: "odf",
|
|
112
112
|
decode: (bytes) => decodePackage$1(bytes),
|
|
113
|
-
read: (pkg) => readOdgContent(pkg),
|
|
113
|
+
read: (pkg) => readOdgContent$1(pkg),
|
|
114
114
|
build: (content) => buildOdgPackage(content),
|
|
115
115
|
encode: (pkg) => encodePackage$1(pkg),
|
|
116
116
|
hasSourcePackage: true
|
|
@@ -131,7 +131,7 @@ const FORMAT_NODES = {
|
|
|
131
131
|
variant: "wordprocessing",
|
|
132
132
|
family: "markdown",
|
|
133
133
|
decode: (bytes) => decodeMarkdownText(bytes),
|
|
134
|
-
read: (text, options) => readMarkdownContent(text, {
|
|
134
|
+
read: (text, options) => readMarkdownContent$1(text, {
|
|
135
135
|
signal: options?.signal,
|
|
136
136
|
images: options?.images
|
|
137
137
|
}),
|
package/dist/convert/convert.cjs
CHANGED
|
@@ -302,7 +302,7 @@ function odbToXlsx(bytes, options) {
|
|
|
302
302
|
const tables = require_odb_read.readOdbTables(pkg, { timeZone: options?.timeZone });
|
|
303
303
|
require_ports_abort.throwIfAborted(options?.signal);
|
|
304
304
|
const content = require_odb_spreadsheet.odbTablesToSpreadsheetDocument(tables);
|
|
305
|
-
const out = (0, ooxml_js.encodePackage)((0, ooxml_js.
|
|
305
|
+
const out = (0, ooxml_js.encodePackage)((0, ooxml_js.buildXlsxPackageFromContent)(content));
|
|
306
306
|
options?.onDocument?.((0, document_schema_js.assemblePackage)(content));
|
|
307
307
|
return out;
|
|
308
308
|
}
|
package/dist/convert/convert.js
CHANGED
|
@@ -4,15 +4,15 @@ import { buildDocxPackage } from "../edit/docx/content.js";
|
|
|
4
4
|
import { buildOdtPackage } from "../edit/odt/content.js";
|
|
5
5
|
import { extractSourceFonts } from "../fonts/registry.js";
|
|
6
6
|
import { layoutFormula } from "../mathml/layout.js";
|
|
7
|
-
import { readOdfFormulaContent } from "../odf/formula/read.js";
|
|
8
|
-
import { readOdtContent } from "../odf/odt/read.js";
|
|
7
|
+
import { readOdfFormulaContent as readOdfFormulaContent$1 } from "../odf/formula/read.js";
|
|
8
|
+
import { readOdtContent as readOdtContent$1 } from "../odf/odt/read.js";
|
|
9
9
|
import { convertWordprocessingToLayout } from "../layout/engine.js";
|
|
10
10
|
import { throwIfAborted } from "../ports/abort.js";
|
|
11
11
|
import { buildOdbTableCsv } from "../odb/csv.js";
|
|
12
12
|
import { readOdbTables } from "../odb/read.js";
|
|
13
13
|
import { odbTablesToSpreadsheetDocument } from "../odb/spreadsheet.js";
|
|
14
14
|
import { convertDocument } from "./composition.js";
|
|
15
|
-
import {
|
|
15
|
+
import { buildXlsxPackageFromContent, encodePackage } from "ooxml.js";
|
|
16
16
|
import { COLOR_BLACK, PAGE_SIZE_A4, assemblePackage } from "document-schema.js";
|
|
17
17
|
import { LAYOUT_FORMAT_VERSION, createFontMeasurer, createFontRegistry, loadMathFont, writePdf } from "pdf-codec";
|
|
18
18
|
import { decodePackage as decodePackage$1, encodePackage as encodePackage$1, readOdfMetadata, readOdfParagraph, readOdfTable, readOdm } from "odf.js";
|
|
@@ -50,7 +50,7 @@ const STANDALONE_FORMULA_MARGIN_PT = 72;
|
|
|
50
50
|
function odfToPdf(bytes, options) {
|
|
51
51
|
throwIfAborted(options?.signal);
|
|
52
52
|
const pkg = decodePackage$1(bytes);
|
|
53
|
-
const read = readOdfFormulaContent(pkg);
|
|
53
|
+
const read = readOdfFormulaContent$1(pkg);
|
|
54
54
|
if (read.kind !== "formula") throw new Error("readOdfFormulaContent returned a non-formula ContentDocument");
|
|
55
55
|
const content = {
|
|
56
56
|
...read,
|
|
@@ -260,7 +260,7 @@ function odmToPdf(bytes, options) {
|
|
|
260
260
|
kind: "odf",
|
|
261
261
|
package: chapterPkg
|
|
262
262
|
}));
|
|
263
|
-
const chapterContent = readOdtContent(chapterPkg);
|
|
263
|
+
const chapterContent = readOdtContent$1(chapterPkg);
|
|
264
264
|
if (chapterContent.kind !== "wordprocessing") throw new Error("readOdtContent returned a non-wordprocessing ContentDocument");
|
|
265
265
|
chapterSections.push(chapterContent.sections);
|
|
266
266
|
}
|
|
@@ -301,7 +301,7 @@ function odbToXlsx(bytes, options) {
|
|
|
301
301
|
const tables = readOdbTables(pkg, { timeZone: options?.timeZone });
|
|
302
302
|
throwIfAborted(options?.signal);
|
|
303
303
|
const content = odbTablesToSpreadsheetDocument(tables);
|
|
304
|
-
const out = encodePackage(
|
|
304
|
+
const out = encodePackage(buildXlsxPackageFromContent(content));
|
|
305
305
|
options?.onDocument?.(assemblePackage(content));
|
|
306
306
|
return out;
|
|
307
307
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolveMetadataTimestamps } from "../../model/metadata.js";
|
|
2
2
|
import { systemClock } from "../../ports/clock.js";
|
|
3
|
-
import { readMarkdownContent } from "../../markdown/read.js";
|
|
3
|
+
import { readMarkdownContent as readMarkdownContent$1 } from "../../markdown/read.js";
|
|
4
4
|
import { buildMarkdownText } from "../../markdown/write.js";
|
|
5
5
|
import { MarkdownParagraph, buildParagraph } from "./paragraph.js";
|
|
6
6
|
import { MarkdownList } from "./list.js";
|
|
@@ -61,11 +61,11 @@ var MarkdownEditor = class {
|
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
63
|
function openMarkdown(text, options) {
|
|
64
|
-
return new MarkdownEditor(readMarkdownContent(text, options));
|
|
64
|
+
return new MarkdownEditor(readMarkdownContent$1(text, options));
|
|
65
65
|
}
|
|
66
66
|
function createMarkdownEditor(options) {
|
|
67
67
|
const clock = options?.clock ?? systemClock;
|
|
68
|
-
const document = readMarkdownContent("", {
|
|
68
|
+
const document = readMarkdownContent$1("", {
|
|
69
69
|
pageSize: options?.pageSize,
|
|
70
70
|
margins: options?.margins
|
|
71
71
|
});
|
package/dist/index.cjs
CHANGED
|
@@ -615,7 +615,7 @@ exports.buildSvgText = require_svg_write.buildSvgText;
|
|
|
615
615
|
Object.defineProperty(exports, "buildXlsxPackage", {
|
|
616
616
|
enumerable: true,
|
|
617
617
|
get: function() {
|
|
618
|
-
return ooxml_js.
|
|
618
|
+
return ooxml_js.buildXlsxPackageFromContent;
|
|
619
619
|
}
|
|
620
620
|
});
|
|
621
621
|
Object.defineProperty(exports, "buildXml", {
|
package/dist/index.d.cts
CHANGED
|
@@ -126,6 +126,6 @@ import { MetadataOverrides, SetDocumentMetadataOptions, setDocumentMetadata } fr
|
|
|
126
126
|
import { throwIfAborted } from "./ports/abort.cjs";
|
|
127
127
|
import { Alignment, Box, COLOR_BLACK, CellPosition, CellRange, Color as LayoutColor, ContentBlock, ContentBlockSchema, ContentCellValue, ContentCellValueSchema, ContentDocument, ContentDocumentJson, ContentDocumentSchema, ContentDrawPage, ContentDrawPageSchema, ContentImageBlock, ContentImageBlockSchema, ContentListMembership, ContentPageBreak, ContentPageBreakSchema, ContentParagraph, ContentParagraphSchema, ContentPathPoint, ContentPathPointSchema, ContentPathSegment, ContentPathSegmentSchema, ContentRun, ContentRunSchema, ContentSection, ContentSectionSchema, ContentShape, ContentShapeSchema, ContentSheet, ContentSheetCell, ContentSheetCellSchema, ContentSheetColumn, ContentSheetColumnSchema, ContentSheetImage, ContentSheetPrintRange, ContentSheetPrintRangeSchema, ContentSheetPrintSettings, ContentSheetPrintSettingsSchema, ContentSheetRepeatRange, ContentSheetRepeatRangeSchema, ContentSheetRow, ContentSheetRowSchema, ContentSheetSchema, ContentSlide, ContentSlideSchema, ContentStroke, ContentStrokeSchema, ContentSubpath, ContentSubpathSchema, ContentTable, ContentTableCell, ContentTableCellSchema, ContentTableRow, ContentTableRowSchema, ContentTableSchema, ContentVector, ContentVectorSchema, DEFAULT_LAYOUT_FONT, DocumentJsonResult, DocumentPackage, DocumentPackageJson, DocumentPackageSchema, DocumentSchemaKind, FontFace, LayoutFont, LayoutMetadata, Margins, MathAssembledGlyphs, MathBox, MathColor, MathFontMetrics, MathGlyphMetrics, MathGlyphPlacement, MathGlyphRun, MathLayoutItem, MathRule, MathStretchAxis, MathStretchGlyph, MathStretchResult, MathStroke, PAGE_SIZE_A4, PAGE_SIZE_LETTER, PageSize, PositionedFormula, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, UnrecognizedDocumentSchemaError, cellReference, columnIndexToLetters, columnLettersToIndex, contentDocumentWithSchema, documentFromJson, documentPackageWithSchema, documentSchemaKindOf, isContentBlock, parseCellReference, parseRangeReference, rangeReference, rgbHexToColor, schemaUriFor } from "document-schema.js";
|
|
128
128
|
import { FontFaceParseError, FontRegistry, FontRegistryOptions, FontSubstitution, LAYOUT_FORMAT_VERSION, LayoutDocument, LayoutDocumentSchema, LayoutEllipse, LayoutImage, LayoutImageAsset, LayoutItem, LayoutLine, LayoutLink, LayoutPage, LayoutPath, LayoutPathSegment, LayoutRect, LayoutSubpath, LayoutText, LoadedMathFont, MathFont, MathFontDescriptorMetrics, NOOP_DIAGNOSTIC_SINK, PdfDiagnostic, PdfDiagnosticSeverity, PdfDiagnosticSink, PdfEncryptedError, PdfParseError, ProvidedFont, ReadPdfOptions, ResolvedFace, WinAnsiSubstitution, WritePdfOptions, createFontMeasurer, createFontRegistry, createStandardFontMeasurer, loadMathFont, pdfCodec, readFontFace as describeFontFace, readPdf, writePdf } from "pdf-codec";
|
|
129
|
-
import { Attribute, AttributeSchema, BinaryPart, BinaryPartSchema, Comment, CommentSchema, CompactAttrPairs, CompactPackage, CompactPackageSchema, CompactPart, CompactPartSchema, CompactXmlNode, CompactXmlNodeSchema, DefinedName, DefinedNameSchema, Footnote, FootnoteSchema, NumberingDefinition, NumberingDefinitionSchema, NumberingDefinitions, NumberingLevel, NumberingLevelSchema, Package, PackageSchema, Part, PartSchema, Relationship, XmlCdata, XmlCdataSchema, XmlComment, XmlCommentSchema, XmlDeclaration, XmlDeclarationSchema, XmlElement, XmlElementSchema, XmlNode, XmlNodeSchema, XmlPart, XmlPartSchema, XmlPi, XmlPiSchema, XmlText, XmlTextSchema, attr, base64ToBytes, buildXlsxPackage, buildXml, bytesToBase64, childrenWithTag, compactCodec, compactPackageCodec, decodeCompactPackage, decodeEntities, decodePackage, elementsWithTag, encodeCompactPackage, encodePackage, fromCompact, isCompactXmlNode, isXmlNode, packageCodec, parsePackage, parseXml, readXlsxContent, resolveRelationships, rootElement, serializePackage, textContent as textContent$1, toCompact, unzipPackage, walk, xmlCodec, zipPackage } from "ooxml.js";
|
|
129
|
+
import { Attribute, AttributeSchema, BinaryPart, BinaryPartSchema, Comment, CommentSchema, CompactAttrPairs, CompactPackage, CompactPackageSchema, CompactPart, CompactPartSchema, CompactXmlNode, CompactXmlNodeSchema, DefinedName, DefinedNameSchema, Footnote, FootnoteSchema, NumberingDefinition, NumberingDefinitionSchema, NumberingDefinitions, NumberingLevel, NumberingLevelSchema, Package, PackageSchema, Part, PartSchema, Relationship, XmlCdata, XmlCdataSchema, XmlComment, XmlCommentSchema, XmlDeclaration, XmlDeclarationSchema, XmlElement, XmlElementSchema, XmlNode, XmlNodeSchema, XmlPart, XmlPartSchema, XmlPi, XmlPiSchema, XmlText, XmlTextSchema, attr, base64ToBytes, buildXlsxPackageFromContent as buildXlsxPackage, buildXml, bytesToBase64, childrenWithTag, compactCodec, compactPackageCodec, decodeCompactPackage, decodeEntities, decodePackage, elementsWithTag, encodeCompactPackage, encodePackage, fromCompact, isCompactXmlNode, isXmlNode, packageCodec, parsePackage, parseXml, readXlsxContent, resolveRelationships, rootElement, serializePackage, textContent as textContent$1, toCompact, unzipPackage, walk, xmlCodec, zipPackage } from "ooxml.js";
|
|
130
130
|
import { OdbComponentInfo, OdbConnectionInfo, OdbForm, OdbFormControl, OdbFormDefinition, OdbInventory, OdbQueryInfo, OdbReport, OdbReportBand, OdbReportElement, OdbReportFunction, OdbReportGroup, readOdbForm, readOdbInventory, readOdbReport, resolveOdbComponent } from "odf.js";
|
|
131
131
|
export { type Alignment, type Attribute, AttributeSchema, type BinaryPart, BinaryPartSchema, type Box, type BuildCsvTextOptions, type BuildDocxPackageOptions, type BuildOdgPackageOptions, type BuildOdpPackageOptions, type BuildOdsPackageOptions, type BuildOdtPackageOptions, type BuildPptxPackageOptions, type BuildSvgTextOptions, COLOR_BLACK, type CellPosition, type CellRange, type CellTypeDeclineReason, type CellTypeInference, type CellTypeInferenceResult, type CellTypeInferenceSink, type CellTypeRule, type ClockPort, type Comment, CommentSchema, type CompactAttrPairs, type CompactPackage, CompactPackageSchema, type CompactPart, CompactPartSchema, type CompactXmlNode, CompactXmlNodeSchema, type CompositionHop, type ContentBlock, ContentBlockSchema, type ContentCellValue, ContentCellValueSchema, type ContentDocument, type ContentDocumentJson, ContentDocumentSchema, type ContentDrawPage, ContentDrawPageSchema, type ContentImageBlock, ContentImageBlockSchema, type ContentListMembership, type ContentPageBreak, ContentPageBreakSchema, type ContentParagraph, ContentParagraphSchema, type ContentPathPoint, ContentPathPointSchema, type ContentPathSegment, ContentPathSegmentSchema, type ContentRun, ContentRunSchema, type ContentSection, ContentSectionSchema, type ContentShape, ContentShapeSchema, type ContentSheet, type ContentSheetCell, ContentSheetCellSchema, type ContentSheetColumn, ContentSheetColumnSchema, type ContentSheetImage, type ContentSheetPrintRange, ContentSheetPrintRangeSchema, type ContentSheetPrintSettings, ContentSheetPrintSettingsSchema, type ContentSheetRepeatRange, ContentSheetRepeatRangeSchema, type ContentSheetRow, ContentSheetRowSchema, ContentSheetSchema, type ContentSlide, ContentSlideSchema, type ContentStroke, ContentStrokeSchema, type ContentSubpath, ContentSubpathSchema, type ContentTable, type ContentTableCell, ContentTableCellSchema, type ContentTableRow, ContentTableRowSchema, ContentTableSchema, type ContentVector, ContentVectorSchema, type ConversionOptions, type ConversionPlan, type ConversionRequest, type ConversionResult, type CreateDocxOptions, type CreateEmptyDocxPackageOptions, type CreateEmptyOdgPackageOptions, type CreateEmptyOdpPackageOptions, type CreateEmptyOdsPackageOptions, type CreateEmptyOdtPackageOptions, type CreateEmptyPptxPackageOptions, type CreateMarkdownEditorOptions, type CreateOdgOptions, type CreateOdpOptions, type CreateOdsOptions, type CreateOdtOptions, type CreatePdfOptions, type CreatePptxOptions, CsvBytesSchema, CsvInvalidUtf8Error, CsvParseError, type CsvReadOptions, CsvSheetNotFoundError, CsvSheetNotSpecifiedError, CsvUnsupportedDocumentKindError, type CsvWriteOptions, DEFAULT_LAYOUT_FONT, DOCUMENT_FORMATS, type DefinedName, DefinedNameSchema, type Diagnostic, type DocumentBridgeOptions, type DocumentConverter, type DocumentFontRegistryOptions, type DocumentFormat, DocumentFormatSchema, type DocumentJsonResult, type DocumentPackage, type DocumentPackageJson, DocumentPackageSchema, type DocumentPayload, type DocumentSchemaKind, type DocumentToPdfOptions, type DocxBody, DocxBytesSchema, DocxEditor, type DocxExtras, DocxParagraph, DocxRun, DocxTable, DocxTableCell, DocxTableRow, type DocxVerticalMerge, type DrawingLayoutOptions, type DrawingLayoutResult, type DrawingParagraphInit, type DrawingRunInit, type EngineLayoutOptions, SUPPORTED_BACKUP_FORMAT_VERSION as FIREBIRD_SUPPORTED_BACKUP_FORMAT_VERSION, FirebirdBackupFormatError, FirebirdBackupParseError, type FirebirdBackupSummary, FirebirdCompositeRecordUnsupportedError, FirebirdDataParseError, FirebirdSchemaParseError, FirebirdUnsupportedFieldTypeError, FontDeobfuscationError, type FontFace, FontFaceParseError, type FontRegistry, type FontRegistryOptions, type FontSourcePackage, type FontSubstitution, type Footnote, FootnoteSchema, type GridLattice, type HsqldbBinaryScript, HsqldbBinaryScriptParseError, type HsqldbColumn, type HsqldbDecodeOptions, HsqldbRowFormatError, HsqldbScriptParseError, HsqldbSqlEvaluationError, HsqldbSqlParseError, HsqldbSqlUnsupportedError, type HsqldbTable, LATEX_DIAGNOSTIC_CODES, LAYOUT_FORMAT_VERSION, type LatexDiagnostic, type LatexDiagnosticCode, type LatexDiagnosticSink, type LatexFormulaOptions, type LatexFormulaResult, type LatexLoweringResult, type LayoutColor, type LayoutDocument, LayoutDocumentSchema, type LayoutEllipse, type LayoutFont, type LayoutFormulaOptions, type LayoutImage, type LayoutImageAsset, type LayoutItem, type LayoutLine, type LayoutLink, type LayoutMetadata, type LayoutPage, type LayoutPath, type LayoutPathSegment, type LayoutRect, type LayoutSubpath, type LayoutText, type LoadedMathFont, type LowerLatexOptions, MATH_LINT_CODES, type Margins, type MarkdownBody, MarkdownBytesSchema, MarkdownConstructUnsupportedError, MarkdownEditor, MarkdownList, type MarkdownListInit, type MarkdownMathLoweringOptions, MarkdownParagraph, type ParagraphInit as MarkdownParagraphInit, type MarkdownRenderDiagnostic, type MarkdownRenderDiagnosticCode, MarkdownRenderDiagnosticCodes, type MarkdownRenderDiagnosticSeverity, type MarkdownRenderDiagnosticSink, MarkdownRun, type RunInit as MarkdownRunInit, MarkdownTable, MarkdownTableCell, type TableInit as MarkdownTableInit, MarkdownTableRow, type MathAssembledGlyphs, type MathBox, type MathColor, type MathDiagnostic, type MathDiagnosticKind, type MathFont, type MathFontDescriptorMetrics, type MathFontMetrics, type MathGlyphMetrics, type MathGlyphPlacement, type MathGlyphRun, type MathLayoutItem, type MathLayoutResult, type MathLintCode, type MathLintDiagnostic, type MathMlAttribute, type MathMlElement, type MathMlNode, type MathMlText, type MathRule, type MathStretchAxis, type MathStretchGlyph, type MathStretchResult, type MathStroke, type MathVariant, type MetadataOverrides, NOOP_DIAGNOSTIC_SINK, type NumberingDefinition, NumberingDefinitionSchema, type NumberingDefinitions, type NumberingLevel, NumberingLevelSchema, type OdbComponentInfo, type OdbConnectionInfo, type OdbConversionOptions, type OdbForm, type OdbFormControl, type OdbFormDefinition, type OdbInventory, OdbNoEmbeddedDataSourceError, type OdbQueryInfo, type OdbReport, type OdbReportBand, type OdbReportContentOptions, OdbReportDataSourceError, type OdbReportElement, type OdbReportFunction, type OdbReportGroup, OdbReportNotSpecifiedError, type OdbReportToDocxOptions, type OdbReportToOdtOptions, OdbTableNotFoundError, OdbTableNotSpecifiedError, type OdbToCsvOptions, type OdbUnsupportedFormat, OdbUnsupportedFormatError, OdfEmbeddedFontError, OdgBoxVector, type BoxVectorInit as OdgBoxVectorInit, OdgBytesSchema, OdgEditor, OdgLineVector, type LineVectorInit as OdgLineVectorInit, OdgPage, type PageImageInit as OdgPageImageInit, OdgPathVector, type PathVectorInit as OdgPathVectorInit, type TextBoxInit as OdgTextBoxInit, type OdgVector, type OdgVectorKind, type OdmToPdfOptions, OdmUnresolvedSectionError, OdpBytesSchema, OdpEditor, OdpShape, OdpSlide, type SlideImageInit as OdpSlideImageInit, type SlideTableInit as OdpSlideTableInit, type TextBoxInit$1 as OdpTextBoxInit, OdsBytesSchema, OdsCell, OdsEditor, OdsSheet, type OdtBody, OdtBytesSchema, OdtEditor, OdtList, OdtListItem, OdtParagraph, type ParagraphInit$1 as OdtParagraphInit, OdtRun, type RunInit$1 as OdtRunInit, OdtTable, OdtTableCell, type TableInit$1 as OdtTableInit, OdtTableRow, type OmmlDiagnostic, type OmmlDiagnosticKind, type OmmlReadResult, type OmmlWriteResult, OoxmlEmbeddedFontError, type OperatorProperties, PAGE_SIZE_A4, PAGE_SIZE_LETTER, type Package, PackageSchema, type PageInit, type PageSize, type Part, PartSchema, PdfBytesSchema, type PdfDiagnostic, type PdfDiagnosticSeverity, type PdfDiagnosticSink, PdfEditor, type PdfEllipseInit, PdfEllipseItem, PdfEncryptedError, type PdfImageInit, PdfImageItem, type PdfItem, type PdfLineInit, PdfLineItem, type PdfLinkInit, PdfLinkItem, PdfPage, PdfParseError, type PdfPathInit, PdfPathItem, type PdfRectInit, PdfRectItem, type PdfTextInit, PdfTextItem, type PdfToDocumentOptions, type PositionedFormula, PptxBytesSchema, PptxEditor, PptxShape, PptxSlide, PptxTable, PptxTableCell, type PptxTableInit, PptxTableRow, type PresentationLayoutResult, type ProvidedFont, type ReadCsvContentOptions, type ReadDocumentMetadataOptions, type ReadDocxContentOptions, type ReadFirebirdBackupResult, type ReadPdfOptions, type ReadSvgContentOptions, type ReconstructOptions, type Relationship, type RenderMarkdownOptions, type ResolvedFace, type RptAggregateFunction, type RptBandDefinition, type RptBandInstance, type RptBandKind, type RptFormula, RptFormulaEvaluationError, RptFormulaParseError, RptFormulaUnsupportedError, type RptGroupDefinition, type RptNamedFunctionDefinition, type RptReference, type RptReportDefinition, type RptReportRun, RptReportStructureError, type RptScope, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, SVG_DIAGNOSTIC_CODES, type SetDocumentMetadataOptions, type SheetsLayoutOptions, type SlideImageInit$1 as SlideImageInit, type SlideTableInit$1 as SlideTableInit, type SlidesLayoutOptions, type SpreadsheetLayoutResult, type SqlAggregateArgument, type SqlAggregateFunction, type SqlColumnRef, type SqlComparisonOperator, type SqlLiteral, type SqlNameRef, type SqlOperand, type SqlOrderByTerm, type SqlPredicate, type SqlPunctuation, type SqlResultSet, type SqlSelectItem, type SqlSelectStatement, type SqlSortDirection, type SqlToken, SvgBytesSchema, type SvgDiagnostic, type SvgDiagnosticCode, type SvgDiagnosticSink, SvgInvalidUtf8Error, SvgMissingRootElementError, SvgMultiPageNotSpecifiedError, SvgPageNotFoundError, type SvgReadOptions, SvgUnsupportedDocumentKindError, type SvgWriteOptions, type TextBoxInit$2 as TextBoxInit, type UnifiedConversionOptions, UnrecognizedDocumentSchemaError, UnsupportedFontSourceFormatError, UnsupportedPackageFormatError, type WinAnsiSubstitution, type WordprocessingLayoutResult, type WritePdfOptions, XlsxBytesSchema, type XmlCdata, XmlCdataSchema, type XmlComment, XmlCommentSchema, type XmlDeclaration, XmlDeclarationSchema, type XmlElement, XmlElementSchema, type XmlNode, XmlNodeSchema, type XmlPart, XmlPartSchema, type XmlPi, XmlPiSchema, type XmlText, XmlTextSchema, applyMathVariant, attr, base64ToBytes, buildCsvText, buildDocumentBytes, buildDocxPackage, buildDrawingBlock, buildFormulaBlock, buildMarkdownText, buildOdgPackage, buildOdpPackage, buildOdsPackage, buildOdtPackage, buildOfficeMath, buildOfficeMathParagraph, buildPptxPackage, buildSvgText, buildXlsxPackage, buildXml, bytesToBase64, cellReference, childrenWithTag, collectOfficeMathElements, columnIndexToLetters, columnLettersToIndex, compactCodec, compactPackageCodec, contentDocumentWithSchema, convertDocument, convertDrawingToLayout, convertPresentationToLayout, convertSpreadsheetToLayout, convertWordprocessingToLayout, createDocumentFontRegistry, createDocx, createFontMeasurer, createFontRegistry, createLocalDocumentConverter, createMarkdownEditor, createOdg, createOdp, createOds, createOdt, createPdf, createPptx, createStandardFontMeasurer, csvMarkdownCodec, csvPdfCodec, csvToMarkdown, csvToOds, csvToPdf, csvToXlsx, decodeCompactPackage, decodeCsvText, decodeDocumentPackage, decodeEntities, decodeHsqldbCachedTables, decodeMarkdownText, decodeOdbPackage, decodePackage, decodeSvgText, deobfuscateEmbeddedFont, deriveFontKey, describeFontFace, detectGridLattice, documentFromJson, documentPackageWithSchema, documentSchemaKindOf, docxPdfCodec, docxToMarkdown, docxToOdt, docxToPdf, docxToPptx, drawingOfBlock, elementChildren, elementLocalName, elementsWithTag, encodeCompactPackage, encodeCsvText, encodeDocumentPackage, encodeMarkdownText, encodePackage, encodeSvgText, evaluateRptBandOutsideData, evaluateSelect, extractOdfEmbeddedFonts, extractOoxmlEmbeddedFonts, extractSourceFonts, extractSourceFontsForFormat, firstChildByLocalName, fixedClock, flipY, formulaDocument, formulaOfBlock, formulaPlaceholderText, fromCompact, displayTextFor as hsqldbCellDisplayText, inferCellValue, inflateHsqldbCompressedScript, isCompactXmlNode, isContentBlock, isMathMlElement, isMathVariant, isXmlNode, latexToFormula, layoutDocumentFromPackage, layoutFormula, lintMathCoherence, loadMathFont, localName, looksLikeSfnt, lowerLatex, lowerMarkdownMath, mapMathVariant, markdownDocxCodec, markdownOdtCodec, markdownPdfCodec, markdownToCsv, markdownToDocx, markdownToOdt, markdownToPdf, markdownToXlsx, textContent as mathMlTextContent, odbReportCommandSql, odbReportGroupChain, odbReportToDocx, odbReportToOdt, odbReportToPdf, odbTablesToSpreadsheetDocument, odbToCsv, odbToXlsx, odfToPdf, odgPdfCodec, odgSvgCodec, odgToPdf, odgToSvg, odmToPdf, odpPdfCodec, odpPptxCodec, odpToOdt, odpToPdf, odpToPptx, odsCsvCodec, odsPdfCodec, odsToCsv, odsToPdf, odsToXlsx, odsXlsxCodec, odtDocxCodec, odtPdfCodec, odtToDocx, odtToMarkdown, odtToOdp, odtToPdf, openDocx, openMarkdown, openOdg, openOdp, openOds, openOdt, openPdf, openPptx, operatorProperties, packageCodec, parseCellReference, parseHsqldbBinaryScript, parseHsqldbScript, parsePackage, parseRangeReference, parseRptFormula, parseSelect, parseXml, pdfCodec, pdfToCsv, pdfToDocx, pdfToMarkdown, pdfToOdg, pdfToOdp, pdfToOds, pdfToOdt, pdfToPptx, pdfToSvg, pdfToXlsx, pptxPdfCodec, pptxToDocx, pptxToOdp, pptxToPdf, rangeReference, readCsvContent, readDocumentMetadata, readDocxContent, readDocxExtras, readFirebirdBackup, readMarkdownContent, readOdbForm, readOdbForms, readOdbInventory, readOdbReport, readOdbReportContent, readOdbReports, readOdbTables, readOdfEmbeddedFormula, readOdfFormulaContent, readOdgContent, readOdpContent, readOdsContent, readOdtContent, readOfficeMath, readPdf, readPptxContent, readSvgContent, readXlsxContent, reconstructDrawing, reconstructPresentation, reconstructSpreadsheet, reconstructWordprocessing, renderContentDocumentToMarkdown, renderOdbReportContent, resolveCompositionPlan, resolveMetadataTimestamps, resolveOdbComponent, resolveOdbReportRows, resolveRelationships, rgbHexToColor, rootElement, rptBandDefinition, rptDefinitionFromReport, runRptReport, schemaUriFor, serializePackage, setDocumentMetadata, svgPdfCodec, svgToOdg, svgToPdf, systemClock, textContent$1 as textContent, throwIfAborted, toCompact, tokenizeSql, unzipPackage, walk, writePdf, xlsxCsvCodec, xlsxMarkdownCodec, xlsxPdfCodec, xlsxToCsv, xlsxToMarkdown, xlsxToOds, xlsxToPdf, xmlCodec, zipPackage };
|
package/dist/index.d.ts
CHANGED
|
@@ -124,7 +124,7 @@ import { UnsupportedPackageFormatError, decodeDocumentPackage, decodeOdbPackage,
|
|
|
124
124
|
import { ReadDocumentMetadataOptions, readDocumentMetadata } from "./metadata/read.js";
|
|
125
125
|
import { MetadataOverrides, SetDocumentMetadataOptions, setDocumentMetadata } from "./metadata/write.js";
|
|
126
126
|
import { throwIfAborted } from "./ports/abort.js";
|
|
127
|
-
import { Attribute, AttributeSchema, BinaryPart, BinaryPartSchema, Comment, CommentSchema, CompactAttrPairs, CompactPackage, CompactPackageSchema, CompactPart, CompactPartSchema, CompactXmlNode, CompactXmlNodeSchema, DefinedName, DefinedNameSchema, Footnote, FootnoteSchema, NumberingDefinition, NumberingDefinitionSchema, NumberingDefinitions, NumberingLevel, NumberingLevelSchema, Package, PackageSchema, Part, PartSchema, Relationship, XmlCdata, XmlCdataSchema, XmlComment, XmlCommentSchema, XmlDeclaration, XmlDeclarationSchema, XmlElement, XmlElementSchema, XmlNode, XmlNodeSchema, XmlPart, XmlPartSchema, XmlPi, XmlPiSchema, XmlText, XmlTextSchema, attr, base64ToBytes, buildXlsxPackage, buildXml, bytesToBase64, childrenWithTag, compactCodec, compactPackageCodec, decodeCompactPackage, decodeEntities, decodePackage, elementsWithTag, encodeCompactPackage, encodePackage, fromCompact, isCompactXmlNode, isXmlNode, packageCodec, parsePackage, parseXml, readXlsxContent, resolveRelationships, rootElement, serializePackage, textContent as textContent$1, toCompact, unzipPackage, walk, xmlCodec, zipPackage } from "ooxml.js";
|
|
127
|
+
import { Attribute, AttributeSchema, BinaryPart, BinaryPartSchema, Comment, CommentSchema, CompactAttrPairs, CompactPackage, CompactPackageSchema, CompactPart, CompactPartSchema, CompactXmlNode, CompactXmlNodeSchema, DefinedName, DefinedNameSchema, Footnote, FootnoteSchema, NumberingDefinition, NumberingDefinitionSchema, NumberingDefinitions, NumberingLevel, NumberingLevelSchema, Package, PackageSchema, Part, PartSchema, Relationship, XmlCdata, XmlCdataSchema, XmlComment, XmlCommentSchema, XmlDeclaration, XmlDeclarationSchema, XmlElement, XmlElementSchema, XmlNode, XmlNodeSchema, XmlPart, XmlPartSchema, XmlPi, XmlPiSchema, XmlText, XmlTextSchema, attr, base64ToBytes, buildXlsxPackageFromContent as buildXlsxPackage, buildXml, bytesToBase64, childrenWithTag, compactCodec, compactPackageCodec, decodeCompactPackage, decodeEntities, decodePackage, elementsWithTag, encodeCompactPackage, encodePackage, fromCompact, isCompactXmlNode, isXmlNode, packageCodec, parsePackage, parseXml, readXlsxContent, resolveRelationships, rootElement, serializePackage, textContent as textContent$1, toCompact, unzipPackage, walk, xmlCodec, zipPackage } from "ooxml.js";
|
|
128
128
|
import { Alignment, Box, COLOR_BLACK, CellPosition, CellRange, Color as LayoutColor, ContentBlock, ContentBlockSchema, ContentCellValue, ContentCellValueSchema, ContentDocument, ContentDocumentJson, ContentDocumentSchema, ContentDrawPage, ContentDrawPageSchema, ContentImageBlock, ContentImageBlockSchema, ContentListMembership, ContentPageBreak, ContentPageBreakSchema, ContentParagraph, ContentParagraphSchema, ContentPathPoint, ContentPathPointSchema, ContentPathSegment, ContentPathSegmentSchema, ContentRun, ContentRunSchema, ContentSection, ContentSectionSchema, ContentShape, ContentShapeSchema, ContentSheet, ContentSheetCell, ContentSheetCellSchema, ContentSheetColumn, ContentSheetColumnSchema, ContentSheetImage, ContentSheetPrintRange, ContentSheetPrintRangeSchema, ContentSheetPrintSettings, ContentSheetPrintSettingsSchema, ContentSheetRepeatRange, ContentSheetRepeatRangeSchema, ContentSheetRow, ContentSheetRowSchema, ContentSheetSchema, ContentSlide, ContentSlideSchema, ContentStroke, ContentStrokeSchema, ContentSubpath, ContentSubpathSchema, ContentTable, ContentTableCell, ContentTableCellSchema, ContentTableRow, ContentTableRowSchema, ContentTableSchema, ContentVector, ContentVectorSchema, DEFAULT_LAYOUT_FONT, DocumentJsonResult, DocumentPackage, DocumentPackageJson, DocumentPackageSchema, DocumentSchemaKind, FontFace, LayoutFont, LayoutMetadata, Margins, MathAssembledGlyphs, MathBox, MathColor, MathFontMetrics, MathGlyphMetrics, MathGlyphPlacement, MathGlyphRun, MathLayoutItem, MathRule, MathStretchAxis, MathStretchGlyph, MathStretchResult, MathStroke, PAGE_SIZE_A4, PAGE_SIZE_LETTER, PageSize, PositionedFormula, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, UnrecognizedDocumentSchemaError, cellReference, columnIndexToLetters, columnLettersToIndex, contentDocumentWithSchema, documentFromJson, documentPackageWithSchema, documentSchemaKindOf, isContentBlock, parseCellReference, parseRangeReference, rangeReference, rgbHexToColor, schemaUriFor } from "document-schema.js";
|
|
129
129
|
import { FontFaceParseError, FontRegistry, FontRegistryOptions, FontSubstitution, LAYOUT_FORMAT_VERSION, LayoutDocument, LayoutDocumentSchema, LayoutEllipse, LayoutImage, LayoutImageAsset, LayoutItem, LayoutLine, LayoutLink, LayoutPage, LayoutPath, LayoutPathSegment, LayoutRect, LayoutSubpath, LayoutText, LoadedMathFont, MathFont, MathFontDescriptorMetrics, NOOP_DIAGNOSTIC_SINK, PdfDiagnostic, PdfDiagnosticSeverity, PdfDiagnosticSink, PdfEncryptedError, PdfParseError, ProvidedFont, ReadPdfOptions, ResolvedFace, WinAnsiSubstitution, WritePdfOptions, createFontMeasurer, createFontRegistry, createStandardFontMeasurer, loadMathFont, pdfCodec, readFontFace as describeFontFace, readPdf, writePdf } from "pdf-codec";
|
|
130
130
|
import { OdbComponentInfo, OdbConnectionInfo, OdbForm, OdbFormControl, OdbFormDefinition, OdbInventory, OdbQueryInfo, OdbReport, OdbReportBand, OdbReportElement, OdbReportFunction, OdbReportGroup, readOdbForm, readOdbInventory, readOdbReport, resolveOdbComponent } from "odf.js";
|
package/dist/index.js
CHANGED
|
@@ -116,7 +116,7 @@ import { buildDocumentBytes, layoutDocumentFromPackage } from "./convert/from-pa
|
|
|
116
116
|
import { UnsupportedFontSourceFormatError, extractSourceFontsForFormat } from "./convert/document-fonts.js";
|
|
117
117
|
import { readDocumentMetadata } from "./metadata/read.js";
|
|
118
118
|
import { setDocumentMetadata } from "./metadata/write.js";
|
|
119
|
-
import { AttributeSchema, BinaryPartSchema, CommentSchema, CompactPackageSchema, CompactPartSchema, CompactXmlNodeSchema, DefinedNameSchema, FootnoteSchema, NumberingDefinitionSchema, NumberingLevelSchema, PackageSchema, PartSchema, XmlCdataSchema, XmlCommentSchema, XmlDeclarationSchema, XmlElementSchema, XmlNodeSchema, XmlPartSchema, XmlPiSchema, XmlTextSchema, attr, base64ToBytes, buildXlsxPackage, buildXml, bytesToBase64, childrenWithTag, compactCodec, compactPackageCodec, decodeCompactPackage, decodeEntities, decodePackage, elementsWithTag, encodeCompactPackage, encodePackage, fromCompact, isCompactXmlNode, isXmlNode, packageCodec, parsePackage, parseXml, readXlsxContent, resolveRelationships, rootElement, serializePackage, textContent as textContent$1, toCompact, unzipPackage, walk, xmlCodec, zipPackage } from "ooxml.js";
|
|
119
|
+
import { AttributeSchema, BinaryPartSchema, CommentSchema, CompactPackageSchema, CompactPartSchema, CompactXmlNodeSchema, DefinedNameSchema, FootnoteSchema, NumberingDefinitionSchema, NumberingLevelSchema, PackageSchema, PartSchema, XmlCdataSchema, XmlCommentSchema, XmlDeclarationSchema, XmlElementSchema, XmlNodeSchema, XmlPartSchema, XmlPiSchema, XmlTextSchema, attr, base64ToBytes, buildXlsxPackageFromContent as buildXlsxPackage, buildXml, bytesToBase64, childrenWithTag, compactCodec, compactPackageCodec, decodeCompactPackage, decodeEntities, decodePackage, elementsWithTag, encodeCompactPackage, encodePackage, fromCompact, isCompactXmlNode, isXmlNode, packageCodec, parsePackage, parseXml, readXlsxContent, resolveRelationships, rootElement, serializePackage, textContent as textContent$1, toCompact, unzipPackage, walk, xmlCodec, zipPackage } from "ooxml.js";
|
|
120
120
|
import { COLOR_BLACK, ContentBlockSchema, ContentCellValueSchema, ContentDocumentSchema, ContentDrawPageSchema, ContentImageBlockSchema, ContentPageBreakSchema, ContentParagraphSchema, ContentPathPointSchema, ContentPathSegmentSchema, ContentRunSchema, ContentSectionSchema, ContentShapeSchema, ContentSheetCellSchema, ContentSheetColumnSchema, ContentSheetPrintRangeSchema, ContentSheetPrintSettingsSchema, ContentSheetRepeatRangeSchema, ContentSheetRowSchema, ContentSheetSchema, ContentSlideSchema, ContentStrokeSchema, ContentSubpathSchema, ContentTableCellSchema, ContentTableRowSchema, ContentTableSchema, ContentVectorSchema, DEFAULT_LAYOUT_FONT, DocumentPackageSchema, PAGE_SIZE_A4, PAGE_SIZE_LETTER, SLIDE_SIZE_STANDARD, SLIDE_SIZE_WIDESCREEN, UnrecognizedDocumentSchemaError, cellReference, columnIndexToLetters, columnLettersToIndex, contentDocumentWithSchema, documentFromJson, documentPackageWithSchema, documentSchemaKindOf, isContentBlock, parseCellReference, parseRangeReference, rangeReference, rgbHexToColor, schemaUriFor } from "document-schema.js";
|
|
121
121
|
import { FontFaceParseError, LAYOUT_FORMAT_VERSION, LayoutDocumentSchema, NOOP_DIAGNOSTIC_SINK, PdfEncryptedError, PdfParseError, createFontMeasurer, createFontRegistry, createStandardFontMeasurer, loadMathFont, pdfCodec, readFontFace as describeFontFace, readPdf, writePdf } from "pdf-codec";
|
|
122
122
|
import { readOdbForm, readOdbInventory, readOdbReport, resolveOdbComponent } from "odf.js";
|
package/dist/markdown/read.cjs
CHANGED
|
@@ -3,11 +3,11 @@ const require_markdown_math = require("./math.cjs");
|
|
|
3
3
|
let markdown_codec = require("markdown-codec");
|
|
4
4
|
//#region src/markdown/read.ts
|
|
5
5
|
function readMarkdownContent(text, options, math) {
|
|
6
|
-
const { document } = (0, markdown_codec.
|
|
6
|
+
const { document } = (0, markdown_codec.readMarkdownContent)(text, {
|
|
7
7
|
frontMatter: true,
|
|
8
8
|
...options
|
|
9
9
|
});
|
|
10
|
-
if (document.kind !== "wordprocessing") throw new Error("
|
|
10
|
+
if (document.kind !== "wordprocessing") throw new Error("readMarkdownContent returned a non-wordprocessing ContentDocument");
|
|
11
11
|
return require_markdown_math.lowerMarkdownMath(document, math);
|
|
12
12
|
}
|
|
13
13
|
//#endregion
|
package/dist/markdown/read.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { lowerMarkdownMath } from "./math.js";
|
|
2
|
-
import {
|
|
2
|
+
import { readMarkdownContent as readMarkdownContent$1 } from "markdown-codec";
|
|
3
3
|
//#region src/markdown/read.ts
|
|
4
4
|
function readMarkdownContent(text, options, math) {
|
|
5
|
-
const { document } =
|
|
5
|
+
const { document } = readMarkdownContent$1(text, {
|
|
6
6
|
frontMatter: true,
|
|
7
7
|
...options
|
|
8
8
|
});
|
|
9
|
-
if (document.kind !== "wordprocessing") throw new Error("
|
|
9
|
+
if (document.kind !== "wordprocessing") throw new Error("readMarkdownContent returned a non-wordprocessing ContentDocument");
|
|
10
10
|
return lowerMarkdownMath(document, math);
|
|
11
11
|
}
|
|
12
12
|
//#endregion
|
package/dist/markdown/write.cjs
CHANGED
package/dist/markdown/write.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { formulaOfBlock, formulaPlaceholderText } from "../model/formula.js";
|
|
2
|
-
import { MarkdownUnsupportedDocumentKindError,
|
|
2
|
+
import { MarkdownUnsupportedDocumentKindError, writeMarkdownContent } from "markdown-codec";
|
|
3
3
|
//#region src/markdown/write.ts
|
|
4
4
|
var MarkdownConstructUnsupportedError = class extends Error {
|
|
5
5
|
descriptorKind;
|
|
@@ -59,7 +59,7 @@ function buildMarkdownText(document, options) {
|
|
|
59
59
|
...section,
|
|
60
60
|
blocks: section.blocks.map(markdownBlock)
|
|
61
61
|
}));
|
|
62
|
-
return
|
|
62
|
+
return writeMarkdownContent({
|
|
63
63
|
...document,
|
|
64
64
|
sections
|
|
65
65
|
}, options);
|
|
@@ -2,14 +2,14 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
let odf_js = require("odf.js");
|
|
3
3
|
//#region src/odf/formula/read.ts
|
|
4
4
|
function readOdfFormulaContent(pkg) {
|
|
5
|
-
return (0, odf_js.
|
|
5
|
+
return (0, odf_js.readOdfFormulaContent)(pkg);
|
|
6
6
|
}
|
|
7
7
|
function readOdfEmbeddedFormula(outerPkg, subPackagePath) {
|
|
8
8
|
const contentPart = outerPkg.parts[`${subPackagePath}/content.xml`];
|
|
9
9
|
if (contentPart?.kind !== "xml") return;
|
|
10
10
|
const subPkg = { parts: { "content.xml": contentPart } };
|
|
11
11
|
try {
|
|
12
|
-
const document = (0, odf_js.
|
|
12
|
+
const document = (0, odf_js.readOdfFormulaContent)(subPkg);
|
|
13
13
|
return document.kind === "formula" ? document.formula : void 0;
|
|
14
14
|
} catch {
|
|
15
15
|
return;
|
package/dist/odf/formula/read.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { readOdfFormulaContent as readOdfFormulaContent$1 } from "odf.js";
|
|
2
2
|
//#region src/odf/formula/read.ts
|
|
3
3
|
function readOdfFormulaContent(pkg) {
|
|
4
|
-
return
|
|
4
|
+
return readOdfFormulaContent$1(pkg);
|
|
5
5
|
}
|
|
6
6
|
function readOdfEmbeddedFormula(outerPkg, subPackagePath) {
|
|
7
7
|
const contentPart = outerPkg.parts[`${subPackagePath}/content.xml`];
|
|
8
8
|
if (contentPart?.kind !== "xml") return;
|
|
9
9
|
const subPkg = { parts: { "content.xml": contentPart } };
|
|
10
10
|
try {
|
|
11
|
-
const document =
|
|
11
|
+
const document = readOdfFormulaContent$1(subPkg);
|
|
12
12
|
return document.kind === "formula" ? document.formula : void 0;
|
|
13
13
|
} catch {
|
|
14
14
|
return;
|
package/dist/odf/odg/read.cjs
CHANGED
|
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
let odf_js = require("odf.js");
|
|
3
3
|
//#region src/odf/odg/read.ts
|
|
4
4
|
function readOdgContent(pkg) {
|
|
5
|
-
const odgDoc = (0, odf_js.
|
|
5
|
+
const odgDoc = (0, odf_js.readOdgContent)(pkg);
|
|
6
6
|
return {
|
|
7
7
|
kind: "drawing",
|
|
8
8
|
metadata: { ...odgDoc.metadata },
|
package/dist/odf/odg/read.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { readOdgContent as readOdgContent$1 } from "odf.js";
|
|
2
2
|
//#region src/odf/odg/read.ts
|
|
3
3
|
function readOdgContent(pkg) {
|
|
4
|
-
const odgDoc =
|
|
4
|
+
const odgDoc = readOdgContent$1(pkg);
|
|
5
5
|
return {
|
|
6
6
|
kind: "drawing",
|
|
7
7
|
metadata: { ...odgDoc.metadata },
|
package/dist/odf/odp/read.cjs
CHANGED
|
@@ -6,7 +6,7 @@ const require_odf_vector_detect = require("../vector/detect.cjs");
|
|
|
6
6
|
let odf_js = require("odf.js");
|
|
7
7
|
//#region src/odf/odp/read.ts
|
|
8
8
|
function readOdpContent(pkg) {
|
|
9
|
-
const odpDoc = (0, odf_js.
|
|
9
|
+
const odpDoc = (0, odf_js.readOdpContent)(pkg);
|
|
10
10
|
const contentPart = pkg.parts["content.xml"];
|
|
11
11
|
if (contentPart?.kind === "xml") {
|
|
12
12
|
const root = (0, odf_js.rootElement)(contentPart.nodes);
|
package/dist/odf/odp/read.js
CHANGED
|
@@ -2,10 +2,10 @@ import { buildDrawingBlock } from "../../model/embedded-drawing.js";
|
|
|
2
2
|
import { buildFormulaBlock } from "../../model/formula.js";
|
|
3
3
|
import { collectSlideFormulaFrames } from "../formula/detect.js";
|
|
4
4
|
import { collectSlideVectorGroups } from "../vector/detect.js";
|
|
5
|
-
import { childrenWithTag, findChildElement,
|
|
5
|
+
import { childrenWithTag, findChildElement, readOdpContent as readOdpContent$1, rootElement } from "odf.js";
|
|
6
6
|
//#region src/odf/odp/read.ts
|
|
7
7
|
function readOdpContent(pkg) {
|
|
8
|
-
const odpDoc =
|
|
8
|
+
const odpDoc = readOdpContent$1(pkg);
|
|
9
9
|
const contentPart = pkg.parts["content.xml"];
|
|
10
10
|
if (contentPart?.kind === "xml") {
|
|
11
11
|
const root = rootElement(contentPart.nodes);
|
package/dist/odf/ods/read.cjs
CHANGED
|
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
let odf_js = require("odf.js");
|
|
3
3
|
//#region src/odf/ods/read.ts
|
|
4
4
|
function readOdsContent(pkg) {
|
|
5
|
-
const odsDoc = (0, odf_js.
|
|
5
|
+
const odsDoc = (0, odf_js.readOdsContent)(pkg);
|
|
6
6
|
return {
|
|
7
7
|
kind: "spreadsheet",
|
|
8
8
|
metadata: { ...odsDoc.metadata },
|
package/dist/odf/ods/read.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { readOdsContent as readOdsContent$1 } from "odf.js";
|
|
2
2
|
//#region src/odf/ods/read.ts
|
|
3
3
|
function readOdsContent(pkg) {
|
|
4
|
-
const odsDoc =
|
|
4
|
+
const odsDoc = readOdsContent$1(pkg);
|
|
5
5
|
return {
|
|
6
6
|
kind: "spreadsheet",
|
|
7
7
|
metadata: { ...odsDoc.metadata },
|
package/dist/odf/odt/read.cjs
CHANGED
|
@@ -8,7 +8,7 @@ const require_odf_vector_detect = require("../vector/detect.cjs");
|
|
|
8
8
|
let odf_js = require("odf.js");
|
|
9
9
|
//#region src/odf/odt/read.ts
|
|
10
10
|
function readOdtContent(pkg) {
|
|
11
|
-
const odtDoc = (0, odf_js.
|
|
11
|
+
const odtDoc = (0, odf_js.readOdtContent)(pkg);
|
|
12
12
|
const contentPart = pkg.parts["content.xml"];
|
|
13
13
|
if (contentPart?.kind === "xml" && odtDoc.sections.length === 1) {
|
|
14
14
|
const root = (0, odf_js.rootElement)(contentPart.nodes);
|
package/dist/odf/odt/read.js
CHANGED
|
@@ -4,10 +4,10 @@ import { spliceBlocks } from "../../model/block-splice.js";
|
|
|
4
4
|
import { collectFormulaFrames } from "../formula/detect.js";
|
|
5
5
|
import { collectImageFrames } from "../image/detect.js";
|
|
6
6
|
import { collectContainerVectors, isVectorElementTag } from "../vector/detect.js";
|
|
7
|
-
import { findChildElement,
|
|
7
|
+
import { findChildElement, readOdtContent as readOdtContent$1, rootElement } from "odf.js";
|
|
8
8
|
//#region src/odf/odt/read.ts
|
|
9
9
|
function readOdtContent(pkg) {
|
|
10
|
-
const odtDoc =
|
|
10
|
+
const odtDoc = readOdtContent$1(pkg);
|
|
11
11
|
const contentPart = pkg.parts["content.xml"];
|
|
12
12
|
if (contentPart?.kind === "xml" && odtDoc.sections.length === 1) {
|
|
13
13
|
const root = rootElement(contentPart.nodes);
|
|
@@ -2,7 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
let ooxml_js = require("ooxml.js");
|
|
3
3
|
//#region src/ooxml/docx/extras.ts
|
|
4
4
|
function readDocxExtras(pkg) {
|
|
5
|
-
const docxDoc = (0, ooxml_js.
|
|
5
|
+
const docxDoc = (0, ooxml_js.readDocxContent)(pkg);
|
|
6
6
|
return {
|
|
7
7
|
comments: docxDoc.comments,
|
|
8
8
|
footnotes: docxDoc.footnotes,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { readDocxContent } from "ooxml.js";
|
|
2
2
|
//#region src/ooxml/docx/extras.ts
|
|
3
3
|
function readDocxExtras(pkg) {
|
|
4
|
-
const docxDoc =
|
|
4
|
+
const docxDoc = readDocxContent(pkg);
|
|
5
5
|
return {
|
|
6
6
|
comments: docxDoc.comments,
|
|
7
7
|
footnotes: docxDoc.footnotes,
|
package/dist/ooxml/docx/read.cjs
CHANGED
|
@@ -8,7 +8,7 @@ function documentBody(pkg) {
|
|
|
8
8
|
return root === void 0 ? void 0 : (0, ooxml_js.childrenWithTag)(root, "w:body")[0];
|
|
9
9
|
}
|
|
10
10
|
function readDocxContent(pkg, options) {
|
|
11
|
-
const docxDoc = (0, ooxml_js.
|
|
11
|
+
const docxDoc = (0, ooxml_js.readDocxContent)(pkg);
|
|
12
12
|
const body = documentBody(pkg);
|
|
13
13
|
const sections = body === void 0 ? docxDoc.sections : require_ooxml_docx_embedded_objects.spliceDocxEmbeddedObjects(docxDoc.sections, body.children, options?.onMathDiagnostic);
|
|
14
14
|
return {
|
package/dist/ooxml/docx/read.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { spliceDocxEmbeddedObjects } from "./embedded-objects.js";
|
|
2
|
-
import { childrenWithTag,
|
|
2
|
+
import { childrenWithTag, readDocxContent as readDocxContent$1, rootElement } from "ooxml.js";
|
|
3
3
|
//#region src/ooxml/docx/read.ts
|
|
4
4
|
const DOCUMENT_PART_PATH = "word/document.xml";
|
|
5
5
|
function documentBody(pkg) {
|
|
@@ -7,7 +7,7 @@ function documentBody(pkg) {
|
|
|
7
7
|
return root === void 0 ? void 0 : childrenWithTag(root, "w:body")[0];
|
|
8
8
|
}
|
|
9
9
|
function readDocxContent(pkg, options) {
|
|
10
|
-
const docxDoc =
|
|
10
|
+
const docxDoc = readDocxContent$1(pkg);
|
|
11
11
|
const body = documentBody(pkg);
|
|
12
12
|
const sections = body === void 0 ? docxDoc.sections : spliceDocxEmbeddedObjects(docxDoc.sections, body.children, options?.onMathDiagnostic);
|
|
13
13
|
return {
|
package/dist/ooxml/pptx/read.cjs
CHANGED
|
@@ -19,7 +19,7 @@ function slidePathsInOrder(pkg) {
|
|
|
19
19
|
return paths;
|
|
20
20
|
}
|
|
21
21
|
function readPptxContent(pkg, options) {
|
|
22
|
-
const pptxDoc = (0, ooxml_js.
|
|
22
|
+
const pptxDoc = (0, ooxml_js.readPptxContent)(pkg);
|
|
23
23
|
const slidePaths = slidePathsInOrder(pkg);
|
|
24
24
|
const slides = pptxDoc.slides.map((slide, slideIndex) => {
|
|
25
25
|
const slidePath = slidePaths[slideIndex];
|
package/dist/ooxml/pptx/read.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { spliceSlideFormulas } from "./formula.js";
|
|
2
2
|
import { collapseVectorShapeRuns } from "./vector.js";
|
|
3
|
-
import { attr, childrenWithTag,
|
|
3
|
+
import { attr, childrenWithTag, readPptxContent as readPptxContent$1, resolveRelationships, rootElement } from "ooxml.js";
|
|
4
4
|
//#region src/ooxml/pptx/read.ts
|
|
5
5
|
const PRESENTATION_PART = "ppt/presentation.xml";
|
|
6
6
|
function slidePathsInOrder(pkg) {
|
|
@@ -18,7 +18,7 @@ function slidePathsInOrder(pkg) {
|
|
|
18
18
|
return paths;
|
|
19
19
|
}
|
|
20
20
|
function readPptxContent(pkg, options) {
|
|
21
|
-
const pptxDoc =
|
|
21
|
+
const pptxDoc = readPptxContent$1(pkg);
|
|
22
22
|
const slidePaths = slidePathsInOrder(pkg);
|
|
23
23
|
const slides = pptxDoc.slides.map((slide, slideIndex) => {
|
|
24
24
|
const slidePath = slidePaths[slideIndex];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "js.documents",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.4",
|
|
4
4
|
"description": "Bidirectional docx/pptx <-> PDF conversion and a read+write editable OOXML document model, built on ooxml.js and Zod 4 codecs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -64,9 +64,9 @@
|
|
|
64
64
|
"byte-codec": "^1.1.9",
|
|
65
65
|
"document-schema.js": "^4.3.0",
|
|
66
66
|
"fflate": "^0.8.3",
|
|
67
|
-
"markdown-codec": "^
|
|
68
|
-
"odf.js": "^
|
|
69
|
-
"ooxml.js": "^
|
|
67
|
+
"markdown-codec": "^4.0.0",
|
|
68
|
+
"odf.js": "^5.0.0",
|
|
69
|
+
"ooxml.js": "^4.0.1",
|
|
70
70
|
"pdf-codec": "^3.0.4",
|
|
71
71
|
"temml": "0.13.4",
|
|
72
72
|
"zod": "^4.4.3"
|