js.documents 1.74.0 → 1.75.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 CHANGED
@@ -264,7 +264,7 @@ const docxBack = z.encode(docxPdfCodec, pdfFromDocx);
264
264
 
265
265
  The ten PDF-bypassing bridges above get the same treatment: `odtDocxCodec`, `odpPptxCodec`, `odsXlsxCodec` (odt bytes ⇄ docx bytes, odp bytes ⇄ pptx bytes, ods bytes ⇄ xlsx bytes), and `markdownDocxCodec`/`markdownOdtCodec` (markdown bytes ⇄ docx bytes, markdown bytes ⇄ odt bytes) — the no-options form again, `odtToDocx`/`docxToOdt`/`markdownToDocx`/`docxToMarkdown`/etc. remain the entry points for `signal`.
266
266
 
267
- `readDocxContent`/`readPptxContent`/`readOdtContent`/`readOdpContent`/`readOdsContent`/`readOdgContent`/`readMarkdownContent` (docx/pptx/odt/odp/ods/odg/markdown → `ContentDocument`), `buildMarkdownText` (`ContentDocument` → markdown text, markdown's own write-side counterpart — there is no live-view editor for markdown, so this is the whole write path, not one stage of a larger one), `convertWordprocessingToLayout`/`convertPresentationToLayout`/`convertSpreadsheetToLayout`/`convertDrawingToLayout` (`ContentDocument` → `LayoutDocument`), and `reconstructWordprocessing`/`reconstructPresentation`/`reconstructSpreadsheet`/`reconstructDrawing` (`LayoutDocument` → `ContentDocument`) are each exported individually too, for a caller that wants one stage of the pipeline without the rest. `readDocxContent` and `readOdtContent` both produce the identical `wordprocessing`-variant `ContentDocument` shape from two completely unrelated package formats (OOXML and ODF), which is what lets `odtToPdf` feed `convertWordprocessingToLayout` without a single line of that engine changing; `readMarkdownContent` produces that identical shape too, from markdown-codec's own `readMarkdown`, making markdown the third format sharing this one pivot and layout engine — not just a second data point; `readPptxContent` and `readOdpContent` do the same for the `presentation` variant and `convertPresentationToLayout`. `readOdgContent`/`convertDrawingToLayout` has no OOXML-side counterpart at all (no drawing-equivalent OOXML format this package reads); `readOdsContent`/`convertSpreadsheetToLayout` now does have one on the read side — `ooxml.js`'s own `readXlsxContent` — but only for the PDF-bypassing `odsToXlsx`/`xlsxToOds` bridge below, not for the PDF pivot: xlsx has no PDF conversion of its own, so `convertSpreadsheetToLayout` still has no xlsx-layout counterpart to reuse or be reused by. Both `convertSpreadsheetToLayout` and `convertDrawingToLayout` are genuinely new layout algorithms, since a spreadsheet's addressed-grid-with-print-settings semantics and a drawing's vector-primitive vocabulary (rect/ellipse/line/path) have no flow/pagination or direct-placement analogue; `convertDrawingToLayout` does still reuse `convertPresentationToLayout`'s own shape-conversion logic (`convertShape`, exported from `src/layout/slides.ts`) verbatim for whatever text/image/table content a drawing page also carries. `reconstructDrawing` is `reconstructWordprocessing`/`reconstructPresentation`'s drawing-side counterpart, but does no baseline/paragraph clustering at all — a drawing has no semantic structure to recover, only a near-1:1 `LayoutItem` → `ContentVector`/`ContentShape` mapping to make, in the same paint order the items were recovered in. `reconstructSpreadsheet` is a genuinely different geometry-recovery problem from either: a real gridline lattice on the page (drawn by a printed sheet with gridlines enabled) is used DIRECTLY as cell boundaries when one is detected; absent one, text is clustered into a 2D grid from geometry alone. It recovers what was printed, not what was entered: every cell keeps its rendered string verbatim in `displayText`, and additionally gets a heuristically re-typed `value` (number/percentage/currency/date/boolean) wherever exactly one reading of that string is defensible — an explicitly probabilistic step, reported per cell through `ReconstructOptions.onCellTypeInference`, and never extended to claiming a formula (see [Fidelity](#fidelity)). `reconstructWordprocessing`/`reconstructPresentation` additionally recover a page's vector primitives and, gated strictly on a real drawn gridline lattice, a real table — see the [Gotchas](#gotchas-and-quirks) entries on each.
267
+ `readDocxContent`/`readPptxContent`/`readOdtContent`/`readOdpContent`/`readOdsContent`/`readOdgContent`/`readMarkdownContent` (docx/pptx/odt/odp/ods/odg/markdown → `ContentDocument`), `buildMarkdownText` (`ContentDocument` → markdown text, markdown's own write-side counterpart — `MarkdownEditor.toMarkdownText` (`src/edit/markdown/editor.ts`) calls it directly as its own save step rather than wrapping a byte-level writer, so this remains the whole write path even though markdown now has a live-view editor), `convertWordprocessingToLayout`/`convertPresentationToLayout`/`convertSpreadsheetToLayout`/`convertDrawingToLayout` (`ContentDocument` → `LayoutDocument`), and `reconstructWordprocessing`/`reconstructPresentation`/`reconstructSpreadsheet`/`reconstructDrawing` (`LayoutDocument` → `ContentDocument`) are each exported individually too, for a caller that wants one stage of the pipeline without the rest. `readDocxContent` and `readOdtContent` both produce the identical `wordprocessing`-variant `ContentDocument` shape from two completely unrelated package formats (OOXML and ODF), which is what lets `odtToPdf` feed `convertWordprocessingToLayout` without a single line of that engine changing; `readMarkdownContent` produces that identical shape too, from markdown-codec's own `readMarkdown`, making markdown the third format sharing this one pivot and layout engine — not just a second data point; `readPptxContent` and `readOdpContent` do the same for the `presentation` variant and `convertPresentationToLayout`. `readOdgContent`/`convertDrawingToLayout` has no OOXML-side counterpart at all (no drawing-equivalent OOXML format this package reads); `readOdsContent`/`convertSpreadsheetToLayout` now does have one on the read side — `ooxml.js`'s own `readXlsxContent` — but only for the PDF-bypassing `odsToXlsx`/`xlsxToOds` bridge below, not for the PDF pivot: xlsx has no PDF conversion of its own, so `convertSpreadsheetToLayout` still has no xlsx-layout counterpart to reuse or be reused by. Both `convertSpreadsheetToLayout` and `convertDrawingToLayout` are genuinely new layout algorithms, since a spreadsheet's addressed-grid-with-print-settings semantics and a drawing's vector-primitive vocabulary (rect/ellipse/line/path) have no flow/pagination or direct-placement analogue; `convertDrawingToLayout` does still reuse `convertPresentationToLayout`'s own shape-conversion logic (`convertShape`, exported from `src/layout/slides.ts`) verbatim for whatever text/image/table content a drawing page also carries. `reconstructDrawing` is `reconstructWordprocessing`/`reconstructPresentation`'s drawing-side counterpart, but does no baseline/paragraph clustering at all — a drawing has no semantic structure to recover, only a near-1:1 `LayoutItem` → `ContentVector`/`ContentShape` mapping to make, in the same paint order the items were recovered in. `reconstructSpreadsheet` is a genuinely different geometry-recovery problem from either: a real gridline lattice on the page (drawn by a printed sheet with gridlines enabled) is used DIRECTLY as cell boundaries when one is detected; absent one, text is clustered into a 2D grid from geometry alone. It recovers what was printed, not what was entered: every cell keeps its rendered string verbatim in `displayText`, and additionally gets a heuristically re-typed `value` (number/percentage/currency/date/boolean) wherever exactly one reading of that string is defensible — an explicitly probabilistic step, reported per cell through `ReconstructOptions.onCellTypeInference`, and never extended to claiming a formula (see [Fidelity](#fidelity)). `reconstructWordprocessing`/`reconstructPresentation` additionally recover a page's vector primitives and, gated strictly on a real drawn gridline lattice, a real table — see the [Gotchas](#gotchas-and-quirks) entries on each.
268
268
 
269
269
  One further conversion, `odmToPdf`, is shaped differently from every conversion above: a `.odm` (ODF master document, a "book" of chapters) never carries its own chapters' content — each `text:section` is a bare external reference to a standalone `.odt` file, confirmed against real LibreOffice output (see Gotchas below) — so producing a PDF needs a caller-supplied `resolveSubDocument` callback to hand back each chapter's own bytes given that section's `href`. Every chapter's own `ContentSection[]` is concatenated in `text:section` document order into one combined document, with an explicit page break marking each chapter boundary, and fed through the same `convertWordprocessingToLayout` engine every `wordprocessing`-variant conversion above already uses unmodified:
270
270
 
@@ -499,7 +499,7 @@ The package is layered from generic primitives outward to the two conversion dir
499
499
  - **`src/omml/`** — the MathML ⇄ OMML (Office Math Markup Language, ECMA-376 Part 1 §22.1's own `m:` vocabulary) structural translator, both directions. `write.ts`'s `buildOfficeMath`/`buildOfficeMathParagraph` are the write side, the counterpart to `src/mathml/`'s own typesetting engine, covering the identical construct set deliberately, so a formula rendered to PDF and the same formula written into a docx degrade in exactly the same places rather than one being silently better than the other: each MathML construct maps onto its real OMML element (`mfrac` → `m:f`, `msqrt`/`mroot` → `m:rad` with `m:radPr/m:degHide` and the degree/radicand order reversed, `msub`/`msup`/`msubsup` → `m:sSub`/`m:sSup`/`m:sSubSup`, `munder`/`mover` → `m:limLow`/`m:limUpp` and `munderover` → the two nested, `mtable`/`mtr`/`mtd` → `m:m`/`m:mr`/`m:e` with per-column `m:mcs`/`m:mc` justification, and every token element → an `m:r`/`m:t` run whose `mathvariant` becomes OMML's own `m:scr` script + `m:sty` style pair). `read.ts`'s `readOfficeMath`/`collectOfficeMathElements` are the read side, the structural inverse of every one of those mappings, and read STRICTLY MORE than the writer writes — deliberately, since the writer only ever has to express what MathML can say while the reader has to cope with whatever Word itself authored: `m:d` (Word's representation of every parenthesised sub-expression), `m:nary` (a sum/product/integral with limits AND its own operand), `m:acc`, `m:bar`, `m:func`, and `m:sPre` each have one exact MathML inverse and no writer counterpart at all. Both directions emit no geometry, measure nothing, and load no font — this is a vocabulary translation, not a rendering. The directory lives outside `src/mathml/` for that directory's own isolation rule: `write.ts`'s whole output type (and `read.ts`'s whole input type) is `ooxml.js`'s `XmlElement`, and `src/mathml/` imports no package at all. `shared.ts` holds what neither direction owns: the `OmmlDiagnostic` shape both report through, the one `mathvariant` ⇄ `m:scr`/`m:sty` table each reads in its own direction, and `mi`'s own intrinsic-variant default. `buildDocxPackage` and `readDocxContent` are their real callers; a construct with no counterpart in the target vocabulary degrades on its own, with a diagnostic, exactly as `src/mathml/layout.ts`'s own `unsupported` fallback does for the PDF path.
500
500
  - **`src/ooxml/`** — resolves a `Package` into a `ContentDocument`: `docx/read.ts` and `pptx/read.ts` are now thin adapters over `ooxml.js`'s own `readDocx`/`readPptx`, wrapping their `{ metadata, sections }`/`{ metadata, slides }` result into `ContentDocument`'s `wordprocessing`/`presentation` shape. The docx style cascade (`docDefaults` → named-style `basedOn` chains → paragraph-mark run properties → character styles → direct formatting), the pptx placeholder → layout → master → theme inheritance cascade, and DrawingML geometry/colour resolution all now live upstream in `ooxml.js` itself, not in this package. `docx/formula.ts` is the one piece of genuinely local reading work left: a second, independent pass over the same `word/document.xml`, splicing every OOXML math equation `src/omml/read.ts` recovers into the sections `readDocx` produced — needed because `readDocx` has no `m:oMath` handling at all, exactly the way `src/odf/odt/read.ts` needs its own pass for a formula `odf.js`'s `readOdt` likewise does not read. Positioning is derived rather than approximated, and by a shorter route than the ODF side's own block-counting mirror needs: every `w:p` produces exactly one top-level `ContentParagraph` block and nothing else produces one, so the Nth `w:p` in the body IS the Nth paragraph-kind block. A `w:p` carrying nothing but its equation is CONSUMED by the formula block rather than emitted alongside it, which is what keeps a `docx → odt → docx` round trip from accumulating one blank paragraph per formula per hop. `docx/extras.ts`'s `readDocxExtras` is a second, independent re-projection of that same `readDocx` call, for the data `readDocxContent` genuinely cannot carry through `ContentDocument`'s section/block shape at all: comments, footnotes, headers/footers, and numbering (`abstractNum`/`num`) definitions. It calls `readDocx` a second time rather than being fused onto `readDocxContent`'s own return value — an accepted cost matching every other "each pipeline stage independently exported" pair in this codebase — and reuses `ooxml.js`'s own `Comment`/`Footnote`/`NumberingDefinitions` types directly rather than mirroring them locally.
501
501
  - **`src/odf/`** — the ODF-side counterpart to `src/ooxml/`, resolving an `odf.js` `Package` into a `ContentDocument`: `odt/read.ts`'s `readOdtContent` is a thin adapter over `odf.js`'s own `readOdt`, wrapping its `{ metadata, sections }` result into the identical `wordprocessing` shape `readDocxContent` produces — the concrete proof that odt and docx genuinely share one pivot and one layout engine. `odp/read.ts`'s `readOdpContent` is the same adapter over `odf.js`'s own `readOdp`, wrapping `{ metadata, slides }` into the identical `presentation` shape `readPptxContent` produces. `ods/read.ts`'s `readOdsContent` wraps `odf.js`'s `readOds`'s `{ metadata, sheets }` into the `spreadsheet` `ContentDocument` variant, and `odg/read.ts`'s `readOdgContent` wraps `odf.js`'s `readOdg`'s `{ metadata, pages }` into the `drawing` variant — `odg` still has no OOXML-side sibling adapter at all (no drawing-equivalent OOXML format this package reads); `ods` now does, `ooxml.js`'s own `readXlsxContent`/`buildXlsxPackage`, consumed directly by `src/convert/convert.ts`'s `odsToXlsx`/`xlsxToOds` bridge (see below) but deliberately not re-exported from this package's own public surface, mirroring the `readDocx`/`readPptx` non-re-export choice above. `buildOdtPackage`/`buildOdpPackage`/`buildOdsPackage`/`buildOdgPackage` (`src/edit/{odt,odp,ods,odg}/content.ts`) each bridge a `ContentDocument` back to a fresh package built on that format's own live-view editor, closing the PDF → odt/odp/ods/odg direction (`pdfToOdt`/`pdfToOdp`/`pdfToOds`/`pdfToOdg` each call the matching one) — see the `pdfToOds` gotcha below for `buildOdsPackage`'s own printSettings-writing addition. `formula/read.ts`'s `readOdfFormulaContent`/`readOdfEmbeddedFormula` are the same thin-adapter pattern over `odf.js`'s own `readOdfFormulaDocument`, for a standalone `.odf` (the whole `'formula'`-kind `ContentDocument`) and an embedded sub-object (its bare `ContentFormula`) respectively — the latter reading the sub-object's own `content.xml` directly out of the outer package's flat `Package.parts` record, no separate unzip step needed; `formula/detect.ts`'s `collectFormulaFrames`/`collectSlideFormulaFrames` are genuinely new work with no `odf.js`-side equivalent at all — `odf.js`'s own `readDrawFrameContent` doesn't recognise a `draw:object`-bearing `draw:frame` yet, so `odt/read.ts` and `odp/read.ts` each run one of these as a second pass over the same package's raw `content.xml` to find and inject a formula's own embedded-object block. `collectFormulaFrames` is a deep walk (a frame directly in the container, one nested inside a `draw:g` group with that group's own `draw:transform` composed exactly as `walkDrawShapes` composes it, and one anchored inline inside a paragraph's own run content); `collectSlideFormulaFrames` replicates `odf.js`'s own `walkDrawShapes` traversal precisely so each formula's `ContentShape` index is derived rather than guessed. See the Gotchas entry below for where each detected formula's block actually lands.
502
- - **`src/markdown/`** — a third, independent counterpart to `src/ooxml/`/`src/odf/`, resolving markdown text into a `ContentDocument` via the external [`markdown-codec`](https://github.com/ExaDev/markdown-codec) dependency rather than a package format: `read.ts`'s `readMarkdownContent` is a thin adapter over `markdown-codec`'s own `readMarkdown`, re-stamping `documents.js`'s own `CONTENT_FORMAT_VERSION` onto a fresh envelope (`markdown-codec`'s `readMarkdown` already produces a full `document-schema.js` `ContentDocument`, structurally identical to but nominally separate from this package's local one) — mirroring `readOdtContent`/`readDocxContent` exactly, and the concrete third proof (after odt/docx) that this pivot and layout engine are genuinely format-agnostic. `write.ts`'s `buildMarkdownText` is the reverse, a thin wrapper over `markdown-codec`'s own `writeMarkdown` — deliberately living beside `read.ts` rather than under `src/edit/`, since markdown has no `XmlElement` tree for a live-view editor to hold a mutable reference into; there is no `MarkdownEditor` the way there is a `DocxEditor`/`OdtEditor`. `text.ts`'s `decodeMarkdownText`/`encodeMarkdownText` are the byte↔text boundary neither `readMarkdown`/`writeMarkdown` nor `markdownCodec`'s own `MarkdownBytesSchema` sit on (both operate on strings, not bytes) — the step every bytes-in/bytes-out ergonomic conversion in `convert.ts` needs, using a fatal-mode `TextDecoder` so a non-UTF-8 input throws immediately rather than silently producing replacement characters.
502
+ - **`src/markdown/`** — a third, independent counterpart to `src/ooxml/`/`src/odf/`, resolving markdown text into a `ContentDocument` via the external [`markdown-codec`](https://github.com/ExaDev/markdown-codec) dependency rather than a package format: `read.ts`'s `readMarkdownContent` is a thin adapter over `markdown-codec`'s own `readMarkdown`, re-stamping `documents.js`'s own `CONTENT_FORMAT_VERSION` onto a fresh envelope (`markdown-codec`'s `readMarkdown` already produces a full `document-schema.js` `ContentDocument`, structurally identical to but nominally separate from this package's local one) — mirroring `readOdtContent`/`readDocxContent` exactly, and the concrete third proof (after odt/docx) that this pivot and layout engine are genuinely format-agnostic. `write.ts`'s `buildMarkdownText` is the reverse, a thin wrapper over `markdown-codec`'s own `writeMarkdown` — deliberately living beside `read.ts` rather than under `src/edit/markdown/`, since `MarkdownEditor` (`src/edit/markdown/editor.ts`) calls it directly as its own `toMarkdownText` rather than this module reaching back into `src/edit/`. `MarkdownEditor` does now exist, alongside `DocxEditor`/`OdtEditor`/etc., but it holds a mutable in-memory `ContentDocument` rather than a real `XmlElement` tree inside a decoded `Package` — markdown has no such tree at all — so every `MarkdownParagraph`/`MarkdownRun`/`MarkdownTable`/`MarkdownTableCell` it produces holds a direct reference into that plain object instead, and saving is nothing more than calling `buildMarkdownText` again. `text.ts`'s `decodeMarkdownText`/`encodeMarkdownText` are the byte↔text boundary neither `readMarkdown`/`writeMarkdown` nor `markdownCodec`'s own `MarkdownBytesSchema` sit on (both operate on strings, not bytes) — the step every bytes-in/bytes-out ergonomic conversion in `convert.ts` needs, using a fatal-mode `TextDecoder` so a non-UTF-8 input throws immediately rather than silently producing replacement characters.
503
503
  - **`src/layout/`** — the pure conversion algorithms, importing `model`, (for formula placement) `mathml`, and — for line-wrapping/pagination itself — several primitives sourced from the external `pdf-codec` dependency: the injected `TextMeasurer` port and `wrapRunsToWidth` (pdf-codec's own `measure.ts`/`text-layout.ts`, since deciding where a line breaks needs to know how wide text renders in a PDF standard-14 font, regardless of which format the content came from), `loadMathFont` (pdf-codec's own `math-font.ts`, for formula placement), pdf-codec's `matrix.ts`'s `rotatePointAboutCenter` (`slides.ts`'s own shape-rotation placement), and pdf-codec's `afm-widths.ts`/`fonts.ts`'s `STANDARD_METRICS`/`resolveStandardFont` (`reconstruct.ts`'s own font-matching when reconstructing from a `LayoutDocument`) — this package's one dependency on external font/text-measurement primitives, since text layout is inherently coupled to the one font model (pdf-codec's own standard-14 resolution) every conversion direction ultimately renders through: `engine.ts` (`ContentDocument` wordprocessing → `LayoutDocument`: flow, line-breaking, pagination — fed identically by docx-, odt-, and markdown-sourced content; also returns `WordprocessingLayoutResult.formulas`, every embedded formula block it laid out via `src/mathml`'s `layoutFormula`, positioned in PDF page space — see the Gotchas entry below on why a formula can't become an ordinary `LayoutItem`), `slides.ts` (`ContentDocument` presentation → `LayoutDocument`: direct EMU-to-point placement, no pagination needed — fed identically by pptx- and odp-sourced content; also exports `convertShape`, the single-`ContentShape`-to-`LayoutItem[]` conversion `drawing.ts` below reuses verbatim, now optionally formula-aware via its own trailing `formulaContext` parameter so `drawing.ts`'s existing call site keeps compiling unchanged), `sheets.ts` (`ContentDocument` spreadsheet → `LayoutDocument`: resolve the print range, build cumulative column/row offsets skipping hidden ones, reserve header/repeat-row-column space, resolve an explicit or non-iterative fit-to-page scale, partition into column/row bands honouring manual breaks with the same "an oversized item gets its own band and overflows rather than looping" guarantee `engine.ts`'s `ensureRoom` documents, emit pages in `downThenOver`/`overThenDown` order, then per page paint cell backgrounds/gridlines/cell borders/headers/cell text, honouring a cell's own `alignment`/`verticalAlignment` where it declares one and falling back to the value-kind default and bottom where it doesn't, with `###`/spill-then-truncate overflow handling — the first layout algorithm in this package that accepts an `AbortSignal`, since a 50k-cell sheet needs cancellation where a docx/pptx page count never did; also returns `SpreadsheetLayoutResult.formulas`, every cell-anchored embedded formula it laid out via `src/mathml`'s `layoutFormula`, resolved against the anchor cell's own already-positioned axis geometry plus the frame's cell-relative offset and positioned in PDF page space — the sheets-side counterpart to `engine.ts`'s and `slides.ts`'s own formula output), `drawing.ts` (`ContentDocument` drawing → `LayoutDocument`: one `ContentDrawPage` per PDF page, direct placement like `slides.ts`, with one new emission path — an unrotated `ContentVector` `rect`/`ellipse`/`line` maps onto the pre-existing `LayoutRect`/`LayoutEllipse`/`LayoutLine` kinds, a `path` vector's local, viewBox-relative subpath points are resolved through the vector's own frame offset then a single page-space flip into a `LayoutPath` value, and a *rotated* rect/ellipse/path becomes a `LayoutPath` of rotated points since neither `LayoutRect` nor `LayoutEllipse` models rotation; the page's `shapes` and `vectors` are merged into one true-paint-order walk through their shared `paintOrder` field rather than painted as two sequential arrays), `reconstruct.ts` (`LayoutDocument` → `ContentDocument`: `reconstructWordprocessing`/`reconstructPresentation` do baseline-proximity line clustering, then paragraph/text-block clustering from geometry — PDF has no semantic paragraph or shape structure to recover, only positioned glyphs; `reconstructDrawing` does no clustering at all, since a drawing has no such structure to infer in the first place — every `LayoutItem` maps close to 1:1 back onto a `ContentVector` `rect`/`ellipse`/`line`/`path` or a `ContentShape`, in the exact z-order it was painted, bucketed into `ContentDrawPageSchema`'s own `shapes`/`vectors` arrays with each item's walk position stamped as its `paintOrder`, so the relative order between the two arrays survives; `reconstructSpreadsheet` tries a real gridline lattice first — scanning the page's `LayoutLine`/stroked-single-segment-`LayoutPath` items for enough parallel horizontal and vertical lines at consistent positions to call it a printed grid, using those line positions directly as cell boundaries when found — and falls back to text-position clustering otherwise, reusing this same module's `clusterIntoLines` for rows and a parallel recurring-x-position generalisation of `clusterIntoParagraphs`'s own `dominantLeftX` for columns; every recovered cell is a bare string, column widths/row heights are genuinely measured from whichever geometry was used, and no print range/scale/repeat-rows/repeat-columns/manual-breaks are ever inferred).
504
504
  - **`src/hsqldb/`** — the `.odb` decoders, in two tiers over two genuinely different on-disk storage shapes a HSQLDB table can use. `script.ts` (Tier 1): a small, bounded HSQLDB TEXT-script-format (`hsqldb.script_format=0`) DDL/DML text parser, not a database engine — `parseHsqldbScript(bytes)` extracts `CREATE TABLE`'s own column names/types and `INSERT INTO`'s own row values into `HsqldbTable[]`, tolerating (skipping) every other statement kind real HSQLDB output emits that this package has no use for (users, grants, sequences, indexes, views), and throwing `HsqldbScriptParseError` for anything matching neither list. `rowformat.ts`/`cache.ts` (Tier 2): a CACHED table's own binary row-store format — LibreOffice's embedded-HSQLDB default (`database.isStoredFileAccess()` switches `hsqldb.default_table_type` to `cached` specifically for storage-backed access, confirmed against the decompiled engine source) — a CACHED table's DDL still lives in `database/script` as ordinary TEXT (Tier 1 parses it unmodified) but its row *data* lives in a separate binary page-cache file, `database/data`. `rowformat.ts` decodes one column's own binary field at a time (`HsqldbDataCursor`, a big-endian `DataView` cursor; `readHsqldbColumnValue`, one branch per SQL type code); `cache.ts` walks a table's own AVL row-position tree (`readHsqldbCachedTableRows`, following each row's persisted `iLeft`/`iRight` child positions recursively, needing no key-comparison or free-list logic at all — a deleted row is already unlinked from the tree before its space can be reused, so a traversal rooted at the tree's current root only ever reaches live rows), rooted at the position `parseHsqldbIndexRoots` recovers from each table's own `SET TABLE ... INDEX'...'` script line, using `parseHsqldbProperties`'s reading of `database/properties` (cache-file scale, engine version) to resolve byte offsets; `decodeHsqldbCachedTables` is the orchestration `src/odb/read.ts` calls, splicing real rows into every table with an index-root line and leaving every other table (MEMORY/TEXT, or a genuinely empty CACHED table — HSQLDB never writes an index-root line for one) exactly as Tier 1 already produced it. `binary-script.ts` (Tier 4): HSQLDB's own whole-script BINARY (`hsqldb.script_format=1`) and COMPRESSED (`=3`) serialisations of `database/script` itself — `parseHsqldbBinaryScript` reads the leading `org.hsqldb.Result` record carrying the database's DDL, rejoins its statements into exactly the TEXT-format script text the same database would have written at `script_format=0`, feeds that to Tier 1, and then decodes the per-table row sections that follow through `rowformat.ts`'s existing per-column decoder; `inflateHsqldbCompressedScript` is the zlib unwrap `=3` needs first, `fflate`'s `unzlibSync`, the one place in `src/hsqldb/` with a dependency beyond `document-schema.js`. All tiers mirror pdf-codec's own isolation discipline: `script.ts` imports only `document-schema.js`'s `ContentCellValue` type; `rowformat.ts` imports the same plus nothing else; `cache.ts` imports only those two and `script.ts`'s own types — no odf.js `Package`/`XmlElement` knowledge anywhere in `src/hsqldb/` — the caller is responsible for handing every function its raw bytes/text already extracted from a real `.odb` package. `HsqldbTable`/`HsqldbColumn` are also the shared pivot shape `src/firebird/`'s own Tier 3 decoder below produces. See Gotchas for Tier 2's own version scope and verification account.
505
505
  - **`src/firebird/`** — the Tier 3 `.odb` decoder: a reader for Firebird's own gbak logical-backup format (`database/firebird.fbk`), the artifact a real Firebird-embedded `.odb` actually contains — see the README's own Gotchas entry below for the empirical finding that this is NOT a raw on-disk ODS page dump, the single largest correction this subsystem's own design went through. `reader.ts` holds the two distinct byte-level primitives the format mixes (`FirebirdBackupReader`, the generic little-endian tag+length+value attribute framing every `rec_*`/`att_*` record uses, plus its own RLE/"PackBits"-style decompression for `att_data_data` when the backup is compressed; `XdrReader`, the big-endian, 4-byte-aligned RFC 1832 XDR decoding a row's own field values use once compression is peeled off). `blr-types.ts` maps a field's own BLR type opcode (`att_field_type`) onto its physical storage representation, sourced directly from Firebird's own `blr.h`/`align.h`. `date.ts` restates Firebird's own MJD-epoch DATE and 1/10000-second-tick TIME encoding, taken from `NoThrowTimeStamp.cpp`. `schema.ts` walks `rec_relation`/`rec_field` (column definitions gbak has ALREADY resolved from the live engine's system tables at backup time — see the Gotchas entry). `data.ts` walks `rec_relation_data`/`rec_data` (a relation's own rows, addressed by name), decoding each row's XDR-and-possibly-RLE-compressed field-value sequence into `ContentCellValue[]`. `backup.ts`'s `readFirebirdBackup` is the top-level entry point, producing the identical `HsqldbTable[]` shape `parseHsqldbScript` does.
@@ -8,6 +8,8 @@ const require_edit_odt_content = require("../edit/odt/content.cjs");
8
8
  const require_edit_odp_content = require("../edit/odp/content.cjs");
9
9
  const require_edit_ods_content = require("../edit/ods/content.cjs");
10
10
  const require_edit_odg_content = require("../edit/odg/content.cjs");
11
+ const require_markdown_read = require("../markdown/read.cjs");
12
+ const require_markdown_write = require("../markdown/write.cjs");
11
13
  const require_fonts_registry = require("../fonts/registry.cjs");
12
14
  const require_mathml_layout = require("../mathml/layout.cjs");
13
15
  const require_ooxml_docx_read = require("../ooxml/docx/read.cjs");
@@ -18,8 +20,6 @@ const require_odf_odp_read = require("../odf/odp/read.cjs");
18
20
  const require_odf_ods_read = require("../odf/ods/read.cjs");
19
21
  const require_odf_odg_read = require("../odf/odg/read.cjs");
20
22
  const require_markdown_text = require("../markdown/text.cjs");
21
- const require_markdown_read = require("../markdown/read.cjs");
22
- const require_markdown_write = require("../markdown/write.cjs");
23
23
  const require_layout_engine = require("../layout/engine.cjs");
24
24
  const require_layout_slides = require("../layout/slides.cjs");
25
25
  const require_ports_abort = require("../ports/abort.cjs");
@@ -7,6 +7,8 @@ import { buildOdtPackage } from "../edit/odt/content.js";
7
7
  import { buildOdpPackage } from "../edit/odp/content.js";
8
8
  import { buildOdsPackage } from "../edit/ods/content.js";
9
9
  import { buildOdgPackage } from "../edit/odg/content.js";
10
+ import { readMarkdownContent } from "../markdown/read.js";
11
+ import { buildMarkdownText } from "../markdown/write.js";
10
12
  import { createDocumentFontRegistry, extractSourceFonts } from "../fonts/registry.js";
11
13
  import { layoutFormula } from "../mathml/layout.js";
12
14
  import { readDocxContent } from "../ooxml/docx/read.js";
@@ -17,8 +19,6 @@ import { readOdpContent } from "../odf/odp/read.js";
17
19
  import { readOdsContent } from "../odf/ods/read.js";
18
20
  import { readOdgContent } from "../odf/odg/read.js";
19
21
  import { decodeMarkdownText, encodeMarkdownText } from "../markdown/text.js";
20
- import { readMarkdownContent } from "../markdown/read.js";
21
- import { buildMarkdownText } from "../markdown/write.js";
22
22
  import { convertWordprocessingToLayout } from "../layout/engine.js";
23
23
  import { convertPresentationToLayout } from "../layout/slides.js";
24
24
  import { throwIfAborted } from "../ports/abort.js";
@@ -0,0 +1,79 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_model_metadata = require("../../model/metadata.cjs");
3
+ const require_ports_clock = require("../../ports/clock.cjs");
4
+ const require_markdown_read = require("../../markdown/read.cjs");
5
+ const require_markdown_write = require("../../markdown/write.cjs");
6
+ const require_edit_markdown_paragraph = require("./paragraph.cjs");
7
+ const require_edit_markdown_list = require("./list.cjs");
8
+ const require_edit_markdown_table = require("./table.cjs");
9
+ let markdown_codec = require("markdown-codec");
10
+ //#region src/edit/markdown/editor.ts
11
+ var MarkdownBodyImpl = class {
12
+ blocks;
13
+ numIdState;
14
+ constructor(blocks, numIdState) {
15
+ this.blocks = blocks;
16
+ this.numIdState = numIdState;
17
+ }
18
+ paragraphs() {
19
+ return this.blocks.filter((block) => block.kind === "paragraph").map((block) => new require_edit_markdown_paragraph.MarkdownParagraph(this.blocks, block));
20
+ }
21
+ appendParagraph(init) {
22
+ const node = require_edit_markdown_paragraph.buildParagraph(init);
23
+ this.blocks.push(node);
24
+ return new require_edit_markdown_paragraph.MarkdownParagraph(this.blocks, node);
25
+ }
26
+ tables() {
27
+ return this.blocks.filter((block) => block.kind === "table").map((block) => new require_edit_markdown_table.MarkdownTable(this.blocks, block));
28
+ }
29
+ appendTable(init) {
30
+ const node = require_edit_markdown_table.buildTable(init);
31
+ this.blocks.push(node);
32
+ return new require_edit_markdown_table.MarkdownTable(this.blocks, node);
33
+ }
34
+ startList(init) {
35
+ const numId = (0, markdown_codec.mintListNumId)(this.numIdState, {
36
+ type: init.type,
37
+ start: init.start,
38
+ task: init.task ?? false,
39
+ loose: init.loose ?? false
40
+ });
41
+ return new require_edit_markdown_list.MarkdownList(numId, this.blocks);
42
+ }
43
+ };
44
+ var MarkdownEditor = class {
45
+ body;
46
+ document;
47
+ constructor(document) {
48
+ if (document.kind !== "wordprocessing") throw new Error(`MarkdownEditor requires a wordprocessing ContentDocument, got "${document.kind}"`);
49
+ const section = document.sections[0];
50
+ if (section === void 0) throw new Error("markdown ContentDocument carries no sections");
51
+ this.document = document;
52
+ this.body = new MarkdownBodyImpl(section.blocks, (0, markdown_codec.createNumIdMintState)());
53
+ }
54
+ paragraphs() {
55
+ return this.body.paragraphs();
56
+ }
57
+ tables() {
58
+ return this.body.tables();
59
+ }
60
+ toMarkdownText(options) {
61
+ return require_markdown_write.buildMarkdownText(this.document, options);
62
+ }
63
+ };
64
+ function openMarkdown(text, options) {
65
+ return new MarkdownEditor(require_markdown_read.readMarkdownContent(text, options));
66
+ }
67
+ function createMarkdownEditor(options) {
68
+ const clock = options?.clock ?? require_ports_clock.systemClock;
69
+ const document = require_markdown_read.readMarkdownContent("", {
70
+ pageSize: options?.pageSize,
71
+ margins: options?.margins
72
+ });
73
+ document.metadata = require_model_metadata.resolveMetadataTimestamps(document.metadata, clock);
74
+ return new MarkdownEditor(document);
75
+ }
76
+ //#endregion
77
+ exports.MarkdownEditor = MarkdownEditor;
78
+ exports.createMarkdownEditor = createMarkdownEditor;
79
+ exports.openMarkdown = openMarkdown;
@@ -0,0 +1,32 @@
1
+ import { ClockPort } from "../../ports/clock.cjs";
2
+ import { r as Margins, s as PageSize$1 } from "../../geometry-DaJr8yQW.cjs";
3
+ import { MarkdownParagraph, ParagraphInit } from "./paragraph.cjs";
4
+ import { MarkdownList, MarkdownListInit } from "./list.cjs";
5
+ import { MarkdownTable, TableInit } from "./table.cjs";
6
+ import { ContentDocument } from "document-schema.js";
7
+ import { ReadMarkdownOptions, WriteMarkdownOptions } from "markdown-codec";
8
+ //#region src/edit/markdown/editor.d.ts
9
+ interface MarkdownBody {
10
+ paragraphs(): MarkdownParagraph[];
11
+ appendParagraph(init?: ParagraphInit): MarkdownParagraph;
12
+ tables(): MarkdownTable[];
13
+ appendTable(init: TableInit): MarkdownTable;
14
+ startList(init: MarkdownListInit): MarkdownList;
15
+ }
16
+ interface CreateMarkdownEditorOptions {
17
+ readonly clock?: ClockPort;
18
+ readonly pageSize?: PageSize$1;
19
+ readonly margins?: Margins;
20
+ }
21
+ declare class MarkdownEditor {
22
+ readonly body: MarkdownBody;
23
+ private readonly document;
24
+ constructor(document: ContentDocument);
25
+ paragraphs(): MarkdownParagraph[];
26
+ tables(): MarkdownTable[];
27
+ toMarkdownText(options?: WriteMarkdownOptions): string;
28
+ }
29
+ declare function openMarkdown(text: string, options?: ReadMarkdownOptions): MarkdownEditor;
30
+ declare function createMarkdownEditor(options?: CreateMarkdownEditorOptions): MarkdownEditor;
31
+ //#endregion
32
+ export { CreateMarkdownEditorOptions, MarkdownBody, MarkdownEditor, createMarkdownEditor, openMarkdown };
@@ -0,0 +1,32 @@
1
+ import { ClockPort } from "../../ports/clock.js";
2
+ import { r as Margins, s as PageSize$1 } from "../../geometry-DaJr8yQW.js";
3
+ import { MarkdownParagraph, ParagraphInit } from "./paragraph.js";
4
+ import { MarkdownList, MarkdownListInit } from "./list.js";
5
+ import { MarkdownTable, TableInit } from "./table.js";
6
+ import { ContentDocument } from "document-schema.js";
7
+ import { ReadMarkdownOptions, WriteMarkdownOptions } from "markdown-codec";
8
+ //#region src/edit/markdown/editor.d.ts
9
+ interface MarkdownBody {
10
+ paragraphs(): MarkdownParagraph[];
11
+ appendParagraph(init?: ParagraphInit): MarkdownParagraph;
12
+ tables(): MarkdownTable[];
13
+ appendTable(init: TableInit): MarkdownTable;
14
+ startList(init: MarkdownListInit): MarkdownList;
15
+ }
16
+ interface CreateMarkdownEditorOptions {
17
+ readonly clock?: ClockPort;
18
+ readonly pageSize?: PageSize$1;
19
+ readonly margins?: Margins;
20
+ }
21
+ declare class MarkdownEditor {
22
+ readonly body: MarkdownBody;
23
+ private readonly document;
24
+ constructor(document: ContentDocument);
25
+ paragraphs(): MarkdownParagraph[];
26
+ tables(): MarkdownTable[];
27
+ toMarkdownText(options?: WriteMarkdownOptions): string;
28
+ }
29
+ declare function openMarkdown(text: string, options?: ReadMarkdownOptions): MarkdownEditor;
30
+ declare function createMarkdownEditor(options?: CreateMarkdownEditorOptions): MarkdownEditor;
31
+ //#endregion
32
+ export { CreateMarkdownEditorOptions, MarkdownBody, MarkdownEditor, createMarkdownEditor, openMarkdown };
@@ -0,0 +1,76 @@
1
+ import { resolveMetadataTimestamps } from "../../model/metadata.js";
2
+ import { systemClock } from "../../ports/clock.js";
3
+ import { readMarkdownContent } from "../../markdown/read.js";
4
+ import { buildMarkdownText } from "../../markdown/write.js";
5
+ import { MarkdownParagraph, buildParagraph } from "./paragraph.js";
6
+ import { MarkdownList } from "./list.js";
7
+ import { MarkdownTable, buildTable } from "./table.js";
8
+ import { createNumIdMintState, mintListNumId } from "markdown-codec";
9
+ //#region src/edit/markdown/editor.ts
10
+ var MarkdownBodyImpl = class {
11
+ blocks;
12
+ numIdState;
13
+ constructor(blocks, numIdState) {
14
+ this.blocks = blocks;
15
+ this.numIdState = numIdState;
16
+ }
17
+ paragraphs() {
18
+ return this.blocks.filter((block) => block.kind === "paragraph").map((block) => new MarkdownParagraph(this.blocks, block));
19
+ }
20
+ appendParagraph(init) {
21
+ const node = buildParagraph(init);
22
+ this.blocks.push(node);
23
+ return new MarkdownParagraph(this.blocks, node);
24
+ }
25
+ tables() {
26
+ return this.blocks.filter((block) => block.kind === "table").map((block) => new MarkdownTable(this.blocks, block));
27
+ }
28
+ appendTable(init) {
29
+ const node = buildTable(init);
30
+ this.blocks.push(node);
31
+ return new MarkdownTable(this.blocks, node);
32
+ }
33
+ startList(init) {
34
+ const numId = mintListNumId(this.numIdState, {
35
+ type: init.type,
36
+ start: init.start,
37
+ task: init.task ?? false,
38
+ loose: init.loose ?? false
39
+ });
40
+ return new MarkdownList(numId, this.blocks);
41
+ }
42
+ };
43
+ var MarkdownEditor = class {
44
+ body;
45
+ document;
46
+ constructor(document) {
47
+ if (document.kind !== "wordprocessing") throw new Error(`MarkdownEditor requires a wordprocessing ContentDocument, got "${document.kind}"`);
48
+ const section = document.sections[0];
49
+ if (section === void 0) throw new Error("markdown ContentDocument carries no sections");
50
+ this.document = document;
51
+ this.body = new MarkdownBodyImpl(section.blocks, createNumIdMintState());
52
+ }
53
+ paragraphs() {
54
+ return this.body.paragraphs();
55
+ }
56
+ tables() {
57
+ return this.body.tables();
58
+ }
59
+ toMarkdownText(options) {
60
+ return buildMarkdownText(this.document, options);
61
+ }
62
+ };
63
+ function openMarkdown(text, options) {
64
+ return new MarkdownEditor(readMarkdownContent(text, options));
65
+ }
66
+ function createMarkdownEditor(options) {
67
+ const clock = options?.clock ?? systemClock;
68
+ const document = readMarkdownContent("", {
69
+ pageSize: options?.pageSize,
70
+ margins: options?.margins
71
+ });
72
+ document.metadata = resolveMetadataTimestamps(document.metadata, clock);
73
+ return new MarkdownEditor(document);
74
+ }
75
+ //#endregion
76
+ export { MarkdownEditor, createMarkdownEditor, openMarkdown };
@@ -0,0 +1,22 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_edit_markdown_paragraph = require("./paragraph.cjs");
3
+ //#region src/edit/markdown/list.ts
4
+ var MarkdownList = class {
5
+ numId;
6
+ container;
7
+ constructor(numId, container) {
8
+ this.numId = numId;
9
+ this.container = container;
10
+ }
11
+ appendItem(level = 0, init) {
12
+ const node = require_edit_markdown_paragraph.buildParagraph(init);
13
+ node.list = {
14
+ numId: this.numId,
15
+ level
16
+ };
17
+ this.container.push(node);
18
+ return new require_edit_markdown_paragraph.MarkdownParagraph(this.container, node);
19
+ }
20
+ };
21
+ //#endregion
22
+ exports.MarkdownList = MarkdownList;
@@ -0,0 +1,17 @@
1
+ import { MarkdownParagraph, ParagraphInit } from "./paragraph.cjs";
2
+ import { ContentBlock } from "document-schema.js";
3
+ //#region src/edit/markdown/list.d.ts
4
+ interface MarkdownListInit {
5
+ readonly type: 'bullet' | 'ordered';
6
+ readonly start?: number;
7
+ readonly task?: boolean;
8
+ readonly loose?: boolean;
9
+ }
10
+ declare class MarkdownList {
11
+ readonly numId: string;
12
+ private readonly container;
13
+ constructor(numId: string, container: ContentBlock[]);
14
+ appendItem(level?: number, init?: ParagraphInit): MarkdownParagraph;
15
+ }
16
+ //#endregion
17
+ export { MarkdownList, MarkdownListInit };
@@ -0,0 +1,17 @@
1
+ import { MarkdownParagraph, ParagraphInit } from "./paragraph.js";
2
+ import { ContentBlock } from "document-schema.js";
3
+ //#region src/edit/markdown/list.d.ts
4
+ interface MarkdownListInit {
5
+ readonly type: 'bullet' | 'ordered';
6
+ readonly start?: number;
7
+ readonly task?: boolean;
8
+ readonly loose?: boolean;
9
+ }
10
+ declare class MarkdownList {
11
+ readonly numId: string;
12
+ private readonly container;
13
+ constructor(numId: string, container: ContentBlock[]);
14
+ appendItem(level?: number, init?: ParagraphInit): MarkdownParagraph;
15
+ }
16
+ //#endregion
17
+ export { MarkdownList, MarkdownListInit };
@@ -0,0 +1,21 @@
1
+ import { MarkdownParagraph, buildParagraph } from "./paragraph.js";
2
+ //#region src/edit/markdown/list.ts
3
+ var MarkdownList = class {
4
+ numId;
5
+ container;
6
+ constructor(numId, container) {
7
+ this.numId = numId;
8
+ this.container = container;
9
+ }
10
+ appendItem(level = 0, init) {
11
+ const node = buildParagraph(init);
12
+ node.list = {
13
+ numId: this.numId,
14
+ level
15
+ };
16
+ this.container.push(node);
17
+ return new MarkdownParagraph(this.container, node);
18
+ }
19
+ };
20
+ //#endregion
21
+ export { MarkdownList };
@@ -0,0 +1,87 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_edit_markdown_run = require("./run.cjs");
3
+ let markdown_codec = require("markdown-codec");
4
+ //#region src/edit/markdown/paragraph.ts
5
+ var MarkdownParagraph = class {
6
+ container;
7
+ node;
8
+ removed = false;
9
+ constructor(container, node) {
10
+ this.container = container;
11
+ this.node = node;
12
+ }
13
+ live() {
14
+ if (this.removed) throw new Error("this MarkdownParagraph has been removed from its body and can no longer be used");
15
+ return this.node;
16
+ }
17
+ get text() {
18
+ return this.live().runs.map((run) => run.text).join("");
19
+ }
20
+ runs() {
21
+ const node = this.live();
22
+ return node.runs.map((run) => new require_edit_markdown_run.MarkdownRun(node.runs, run));
23
+ }
24
+ appendRun(init) {
25
+ const node = this.live();
26
+ const run = require_edit_markdown_run.buildRun(init);
27
+ node.runs.push(run);
28
+ return new require_edit_markdown_run.MarkdownRun(node.runs, run);
29
+ }
30
+ insertRunAt(index, init) {
31
+ const node = this.live();
32
+ const run = require_edit_markdown_run.buildRun(init);
33
+ const insertAt = Math.min(Math.max(index, 0), node.runs.length);
34
+ node.runs.splice(insertAt, 0, run);
35
+ return new require_edit_markdown_run.MarkdownRun(node.runs, run);
36
+ }
37
+ get styleId() {
38
+ return this.live().styleId;
39
+ }
40
+ set styleId(value) {
41
+ const node = this.live();
42
+ if (value === void 0) delete node.styleId;
43
+ else node.styleId = value;
44
+ }
45
+ get headingLevel() {
46
+ const styleId = this.live().styleId;
47
+ return styleId === void 0 ? void 0 : (0, markdown_codec.parseHeadingStyleId)(styleId);
48
+ }
49
+ set headingLevel(level) {
50
+ this.styleId = level === void 0 ? void 0 : (0, markdown_codec.headingStyleId)(level);
51
+ }
52
+ get quoteDepth() {
53
+ const indent = this.live().indentLeftPt;
54
+ if (indent === void 0 || indent <= 0) return 0;
55
+ return Math.max(1, Math.round(indent / markdown_codec.QUOTE_INDENT_PT));
56
+ }
57
+ set quoteDepth(depth) {
58
+ const node = this.live();
59
+ if (depth <= 0) delete node.indentLeftPt;
60
+ else node.indentLeftPt = depth * markdown_codec.QUOTE_INDENT_PT;
61
+ }
62
+ get list() {
63
+ return this.live().list;
64
+ }
65
+ set list(value) {
66
+ const node = this.live();
67
+ if (value === void 0) delete node.list;
68
+ else node.list = value;
69
+ }
70
+ remove() {
71
+ const node = this.live();
72
+ const index = this.container.indexOf(node);
73
+ if (index !== -1) this.container.splice(index, 1);
74
+ this.removed = true;
75
+ }
76
+ };
77
+ function buildParagraph(init = {}) {
78
+ const node = {
79
+ kind: "paragraph",
80
+ runs: init.text === void 0 ? [] : [require_edit_markdown_run.buildRun({ text: init.text })]
81
+ };
82
+ if (init.styleId !== void 0) node.styleId = init.styleId;
83
+ return node;
84
+ }
85
+ //#endregion
86
+ exports.MarkdownParagraph = MarkdownParagraph;
87
+ exports.buildParagraph = buildParagraph;
@@ -0,0 +1,30 @@
1
+ import { n as RunInit, t as MarkdownRun } from "../../run-DpQRXEGp.cjs";
2
+ import { ContentBlock, ContentListMembership, ContentParagraph } from "document-schema.js";
3
+ //#region src/edit/markdown/paragraph.d.ts
4
+ interface ParagraphInit {
5
+ readonly text?: string;
6
+ readonly styleId?: string;
7
+ }
8
+ declare class MarkdownParagraph {
9
+ private readonly container;
10
+ private readonly node;
11
+ private removed;
12
+ constructor(container: ContentBlock[], node: ContentParagraph);
13
+ private live;
14
+ get text(): string;
15
+ runs(): MarkdownRun[];
16
+ appendRun(init?: RunInit): MarkdownRun;
17
+ insertRunAt(index: number, init?: RunInit): MarkdownRun;
18
+ get styleId(): string | undefined;
19
+ set styleId(value: string | undefined);
20
+ get headingLevel(): number | undefined;
21
+ set headingLevel(level: number | undefined);
22
+ get quoteDepth(): number;
23
+ set quoteDepth(depth: number);
24
+ get list(): ContentListMembership | undefined;
25
+ set list(value: ContentListMembership | undefined);
26
+ remove(): void;
27
+ }
28
+ declare function buildParagraph(init?: ParagraphInit): ContentParagraph;
29
+ //#endregion
30
+ export { MarkdownParagraph, ParagraphInit, buildParagraph };
@@ -0,0 +1,30 @@
1
+ import { n as RunInit, t as MarkdownRun } from "../../run-DpQRXEGp.js";
2
+ import { ContentBlock, ContentListMembership, ContentParagraph } from "document-schema.js";
3
+ //#region src/edit/markdown/paragraph.d.ts
4
+ interface ParagraphInit {
5
+ readonly text?: string;
6
+ readonly styleId?: string;
7
+ }
8
+ declare class MarkdownParagraph {
9
+ private readonly container;
10
+ private readonly node;
11
+ private removed;
12
+ constructor(container: ContentBlock[], node: ContentParagraph);
13
+ private live;
14
+ get text(): string;
15
+ runs(): MarkdownRun[];
16
+ appendRun(init?: RunInit): MarkdownRun;
17
+ insertRunAt(index: number, init?: RunInit): MarkdownRun;
18
+ get styleId(): string | undefined;
19
+ set styleId(value: string | undefined);
20
+ get headingLevel(): number | undefined;
21
+ set headingLevel(level: number | undefined);
22
+ get quoteDepth(): number;
23
+ set quoteDepth(depth: number);
24
+ get list(): ContentListMembership | undefined;
25
+ set list(value: ContentListMembership | undefined);
26
+ remove(): void;
27
+ }
28
+ declare function buildParagraph(init?: ParagraphInit): ContentParagraph;
29
+ //#endregion
30
+ export { MarkdownParagraph, ParagraphInit, buildParagraph };