odf-kit 0.9.6 → 0.9.8

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +306 -272
  3. package/dist/index.d.ts +1 -1
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/ods/content.d.ts +0 -9
  6. package/dist/ods/content.d.ts.map +1 -1
  7. package/dist/ods/content.js +274 -97
  8. package/dist/ods/content.js.map +1 -1
  9. package/dist/ods/document.d.ts +2 -42
  10. package/dist/ods/document.d.ts.map +1 -1
  11. package/dist/ods/document.js +7 -42
  12. package/dist/ods/document.js.map +1 -1
  13. package/dist/ods/index.d.ts +1 -1
  14. package/dist/ods/index.d.ts.map +1 -1
  15. package/dist/ods/settings.d.ts +13 -0
  16. package/dist/ods/settings.d.ts.map +1 -0
  17. package/dist/ods/settings.js +67 -0
  18. package/dist/ods/settings.js.map +1 -0
  19. package/dist/ods/sheet-builder.d.ts +42 -28
  20. package/dist/ods/sheet-builder.d.ts.map +1 -1
  21. package/dist/ods/sheet-builder.js +57 -42
  22. package/dist/ods/sheet-builder.js.map +1 -1
  23. package/dist/ods/types.d.ts +68 -30
  24. package/dist/ods/types.d.ts.map +1 -1
  25. package/dist/ods-reader/html-renderer.d.ts +19 -0
  26. package/dist/ods-reader/html-renderer.d.ts.map +1 -0
  27. package/dist/ods-reader/html-renderer.js +123 -0
  28. package/dist/ods-reader/html-renderer.js.map +1 -0
  29. package/dist/ods-reader/index.d.ts +19 -0
  30. package/dist/ods-reader/index.d.ts.map +1 -0
  31. package/dist/ods-reader/index.js +22 -0
  32. package/dist/ods-reader/index.js.map +1 -0
  33. package/dist/ods-reader/parser.d.ts +24 -0
  34. package/dist/ods-reader/parser.d.ts.map +1 -0
  35. package/dist/ods-reader/parser.js +544 -0
  36. package/dist/ods-reader/parser.js.map +1 -0
  37. package/dist/ods-reader/types.d.ts +139 -0
  38. package/dist/ods-reader/types.d.ts.map +1 -0
  39. package/dist/ods-reader/types.js +7 -0
  40. package/dist/ods-reader/types.js.map +1 -0
  41. package/package.json +22 -5
package/CHANGELOG.md CHANGED
@@ -5,6 +5,50 @@ All notable changes to odf-kit will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.9.8] - 2026-04-10
9
+
10
+ ### Added
11
+
12
+ - **`readOds()`** — Parse an ODS file into a structured `OdsDocumentModel`. Returns typed JavaScript values — `string`, `number`, `boolean`, `Date` — never display-formatted strings. Available via `odf-kit/ods-reader`.
13
+ - **`odsToHtml()`** — Convert an ODS file directly to an HTML string. Each sheet rendered as a `<table>` with inline styles. Available via `odf-kit/ods-reader`.
14
+ - **`OdsDocumentModel`** — sheets → rows → cells with `value`, `type`, `formula?`, `displayText?`, `colSpan?`, `rowSpan?`, `formatting?`.
15
+ - **Cell types:** `"string"`, `"float"`, `"date"`, `"boolean"`, `"formula"`, `"empty"`, `"covered"`.
16
+ - **Formula cells** — `value` is the cached result, `formula` is the original formula string (e.g. `"=SUM(A1:A10)"`).
17
+ - **Merged cell handling** — primary cell has `colSpan`/`rowSpan`, covered cells have `type: "covered"` and `value: null` at correct physical column indices.
18
+ - **Cell formatting** — `OdsCellFormatting` with bold, italic, underline, fontSize, fontFamily, color, backgroundColor, textAlign, verticalAlign, numberFormat, dateFormat. Set `includeFormatting: false` for faster parsing when only values are needed.
19
+ - **Sheet metadata** — tab color, freeze rows/columns read from settings.xml.
20
+ - **Document metadata** — title, creator, description from meta.xml.
21
+ - **`odf-kit/ods-reader`** sub-export added.
22
+ - **`odf-kit/odt-reader`** alias added for `odf-kit/reader` — consistent naming with `odf-kit/ods-reader`.
23
+ - 40 new tests (889 total).
24
+
25
+ ## [0.9.7] - 2026-04-10
26
+
27
+ ### Added
28
+
29
+ - **Number formats** — `numberFormat` option on `OdsCellOptions` for professional numeric display. Formats: `"integer"` (1,234), `"decimal:N"` (1,234.56), `"percentage"` / `"percentage:N"` (12.34%), `"currency:CODE"` / `"currency:CODE:N"` (€1,234.56). Applies at row level (default for all cells) or per cell. Style deduplication — identical formats share one ODF style element.
30
+ - **Percentage cells** — `type: "percentage"` on `OdsCellObject`. Stores raw decimal, displays as percentage.
31
+ - **Currency cells** — `type: "currency"` on `OdsCellObject` with `numberFormat: "currency:CODE"`. Supports 30+ ISO 4217 currency codes with correct symbols.
32
+ - **Merged cells** — `colSpan` and `rowSpan` on `OdsCellObject`. Automatically emits `table:covered-table-cell` elements for spanned positions. Supports combined colSpan + rowSpan and merges at any column position.
33
+ - **Freeze rows/columns** — `sheet.freezeRows(N)` and `sheet.freezeColumns(N)` on `OdsSheet`. Generates `settings.xml` in the ODS ZIP with LibreOffice-compatible freeze configuration. `settings.xml` only emitted when at least one sheet has freeze settings.
34
+ - **Hyperlinks in ODS cells** — `href` on `OdsCellObject`. Cell text rendered as `text:a` link with `xlink:href`. `xmlns:xlink` namespace declared on document root.
35
+ - **Sheet tab color** — `sheet.setTabColor(color)` on `OdsSheet`. Accepts hex (`"#FF0000"`) or CSS named colors. Emits `table:tab-color` on the sheet's table style.
36
+ - **`OdsCellType`** exported from public API.
37
+ - 32 new tests (849 total).
38
+
39
+ ## [0.9.6] - 2026-04-10
40
+
41
+ ### Added
42
+
43
+ - **`tiptapToOdt()`** — Convert TipTap/ProseMirror JSON directly to ODT. Accepts the JSON object returned by `editor.getJSON()` in TipTap and returns a valid `.odt` file as `Uint8Array`. No dependency on `@tiptap/core` — walks the JSON tree as a plain object.
44
+ - **Supported block nodes:** `doc`, `paragraph`, `heading` (levels 1–6), `bulletList`, `orderedList`, `listItem` (nested), `blockquote`, `codeBlock`, `horizontalRule`, `hardBreak`, `image`, `table`, `tableRow`, `tableCell`, `tableHeader`.
45
+ - **Supported marks:** `bold`, `italic`, `underline`, `strike`, `code`, `link`, `textStyle` (color, fontSize, fontFamily), `highlight`, `superscript`, `subscript`.
46
+ - **Image support:** Data URIs decoded and embedded directly. Other URLs looked up in the `images` option (`Record<src, Uint8Array>`). Unknown URLs emit a placeholder paragraph.
47
+ - **`unknownNodeHandler`** callback in `TiptapToOdtOptions` — handle custom TipTap extensions without waiting for odf-kit to add support.
48
+ - **`TiptapNode`**, **`TiptapMark`**, **`TiptapToOdtOptions`** types exported.
49
+ - All `HtmlToOdtOptions` apply (page format, margins, orientation, metadata).
50
+ - 31 new tests (817 total).
51
+
8
52
  ## [0.9.5] - 2026-04-09
9
53
 
10
54
  ### Added
@@ -142,6 +186,9 @@ Initial release. Complete ODT generation support.
142
186
  - Tables, page layout, headers/footers, page breaks, lists, tab stops.
143
187
  - Method chaining. Full TypeScript types. ESM-only, Node.js 22+. 102 tests.
144
188
 
189
+ [0.9.8]: https://github.com/GitHubNewbie0/odf-kit/releases/tag/v0.9.8
190
+ [0.9.7]: https://github.com/GitHubNewbie0/odf-kit/releases/tag/v0.9.7
191
+ [0.9.6]: https://github.com/GitHubNewbie0/odf-kit/releases/tag/v0.9.6
145
192
  [0.9.5]: https://github.com/GitHubNewbie0/odf-kit/releases/tag/v0.9.5
146
193
  [0.9.4]: https://github.com/GitHubNewbie0/odf-kit/releases/tag/v0.9.4
147
194
  [0.9.2]: https://github.com/GitHubNewbie0/odf-kit/releases/tag/v0.9.2