@qrcommunication/gigapdf-lib 0.67.0 → 0.68.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/CHANGELOG.md CHANGED
@@ -4,6 +4,62 @@ All notable changes to `@qrcommunication/gigapdf-lib` are documented here.
4
4
  The format follows [Keep a Changelog](https://keepachangelog.com/) and the
5
5
  project adheres to [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## [0.68.0] - 2026-06-23
8
+
9
+ Format-reach + import/render fidelity release: the unified model now exports
10
+ **Markdown / CSV / EPUB** end to end, Office/ODF import preserves far more
11
+ structure, the HTML→PDF renderer gains the remaining common CSS, and several
12
+ image-codec and rendering bugs are fixed.
13
+
14
+ ### Added
15
+
16
+ - **Markdown / CSV / EPUB model export.** The unified editable model can now be
17
+ raised to **Markdown** (`modelToMd`), **CSV** (RFC 4180, `modelToCsv`) and
18
+ **EPUB 3** (`modelToEpub`), alongside the existing
19
+ `modelTo{Docx,Xlsx,Pptx,Odt,Ods,Odp,Pdf,Html,Rtf}` targets (ABI
20
+ `gp_model_to_{md,csv,epub}`).
21
+ - **Complete Markdown modelling.** `CodeBlock`, `Blockquote` and
22
+ `HorizontalRule` are first-class in the model — full Markdown round-trip
23
+ (headings, runs, links, images, nested lists, GFM tables, code blocks,
24
+ block-quotes, horizontal rules, footnotes, front-matter) rendered and exported
25
+ consistently across formats.
26
+ - **Office / ODF import fidelity.** DOCX/XLSX/PPTX and **ODF (`.odt`/`.ods`/
27
+ `.odp`)** import now preserves **images, hyperlinks, strikethrough,
28
+ highlighting, spreadsheet formulas, grouped shapes, charts, SmartArt text and
29
+ master/layout (theme) inheritance**.
30
+ - **HTML / CSS → PDF — remaining common CSS.** **Radial** and **conic**
31
+ gradients, **`font-weight` 100–900**, **`box-shadow`** (blur), **elliptical
32
+ `border-radius`**, dashed/dotted borders, **`linear-gradient`** and
33
+ **`position: sticky`**.
34
+ - **OpenType text shaping.** GPOS mark positioning, GSUB contextual, script
35
+ selection and Arabic joining (complex scripts only; Latin unchanged).
36
+ - **Image codecs.** SVG `<text>` rendering and GIF multi-frame decoding.
37
+ - **Run highlight.** Character-level `background` is painted and emitted across
38
+ HTML, PDF and Office output.
39
+ - **`setTextRunStyle`.** Run-level style bake exposed in the SDK.
40
+ - **Mermaid flowchart renderer** in the HTML engine (`graph TD/LR`, node shapes,
41
+ typed edges + arrowheads, Sugiyama layout → PDF vectors).
42
+
43
+ ### Fixed
44
+
45
+ - **AVIF multi-tile decode — corrupt images > 9.4 MP.** Multi-tile AVIFs were
46
+ decoded as a single tile, garbling pixels. The AV1 spec forces multi-tile
47
+ above ~9.4 MP, so essentially every modern phone/camera AVIF was silently
48
+ corrupted. Each tile is now decoded independently; single-tile and existing
49
+ fixtures are byte-for-byte unchanged (validated bit-exact vs `dav1d`).
50
+ - **WebP lossless (VP8L)** — lossless transforms + meta-Huffman now decode real
51
+ `cwebp`/libwebp lossless images correctly.
52
+
53
+ ### Changed
54
+
55
+ - **Non-Device colorspaces** — Pattern fills and `Separation`/`ICCBased` colours
56
+ in content streams are unified through the raster colour resolver (consistent
57
+ with the rasterizer) instead of a device-default fallback.
58
+ - **Docs honesty** — README corrected to **near-zero-dependency** (hand-written
59
+ PDF/render/conversion core; **RustCrypto** for crypto/signatures; **Boa** for
60
+ JS — the earlier from-scratch JS engine is gone), **1198 tests** (was 284), and
61
+ `.wasm` **~5.6 MB** (was ~540 KB, before Boa was bundled).
62
+
7
63
  ## [0.67.0] - 2026-06-23
8
64
 
9
65
  ### Added
package/dist/index.cjs CHANGED
@@ -831,6 +831,27 @@ var GigaPdfEngine = class _GigaPdfEngine {
831
831
  (p, l) => this._str((o) => this.ex.gp_model_to_rtf(p, l, o))
832
832
  );
833
833
  }
834
+ /** Raise a model to Markdown (decoded UTF-8 string). */
835
+ modelToMarkdown(model) {
836
+ return this._withStr(
837
+ JSON.stringify(model),
838
+ (p, l) => this._str((o) => this.ex.gp_model_to_md(p, l, o))
839
+ );
840
+ }
841
+ /** Raise a model to CSV (decoded UTF-8 string). */
842
+ modelToCsv(model) {
843
+ return this._withStr(
844
+ JSON.stringify(model),
845
+ (p, l) => this._str((o) => this.ex.gp_model_to_csv(p, l, o))
846
+ );
847
+ }
848
+ /** Raise a model to an EPUB e-book (`.epub`). */
849
+ modelToEpub(model) {
850
+ return this._withStr(
851
+ JSON.stringify(model),
852
+ (p, l) => this._buffer((o) => this.ex.gp_model_to_epub(p, l, o))
853
+ );
854
+ }
834
855
  };
835
856
  function packHtmlResources(resources) {
836
857
  let size = 4;
@@ -1062,6 +1083,31 @@ var GigaPdfDoc = class {
1062
1083
  (p, l) => this.ex().gp_set_path_style_json(this.h, page, index, p, l)
1063
1084
  ) === 0;
1064
1085
  }
1086
+ /**
1087
+ * Re-style **sub-ranges** of text run `index` on `page` in place — the
1088
+ * by-character-run companion of {@link setPathStyle}. Each span sets the style
1089
+ * of the `[start, end)` UTF-16 slice of the run's *decoded* text (bold / italic
1090
+ * / underline / strike / colour / size); the run is split so the rest keeps its
1091
+ * original style and **positioning is preserved** (the original glyph codes,
1092
+ * including `TJ` kerning, are sliced and re-emitted — never re-encoded — and
1093
+ * each styled slice is wrapped in `q … Q`). Spans may be given in any order and
1094
+ * are clamped to the run's length.
1095
+ *
1096
+ * Notes on each field: `color` is `[r,g,b]` in `0..=1` (text fill); `sizePt`
1097
+ * rescales the slice's font in the run's own text scale; `bold` is faux-bold
1098
+ * (fill+stroke render mode) when no bold variant font is wired; `italic` is a
1099
+ * no-op without an italic/oblique variant (a stream edit can't shear glyphs
1100
+ * without disturbing advances); `underline`/`strike` draw a thin rule in page
1101
+ * space. Returns `false` when `index` does not resolve to a top-level text run
1102
+ * (e.g. it addresses form-XObject text), like {@link setPathStyle} for a
1103
+ * non-matching element.
1104
+ */
1105
+ setTextRunStyle(page, index, spans) {
1106
+ return this.g._withStr(
1107
+ JSON.stringify(spans),
1108
+ (p, l) => this.ex().gp_set_text_run_style_json(this.h, page, index, p, l)
1109
+ ) === 0;
1110
+ }
1065
1111
  /**
1066
1112
  * Set a constant opacity on element `index` on `page` — text, image **or**
1067
1113
  * shape — by registering an `/ExtGState` (`/ca` = `/CA` = `fillAlpha`, clamped