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
@@ -0,0 +1,139 @@
1
+ /**
2
+ * ODS reader type definitions.
3
+ *
4
+ * These types describe the in-memory model returned by readOds().
5
+ */
6
+ /** Top-level ODS document model returned by readOds(). */
7
+ export interface OdsDocumentModel {
8
+ /** Sheets in tab order. */
9
+ sheets: OdsSheetModel[];
10
+ /** Document metadata from meta.xml. */
11
+ metadata?: OdsMetadata;
12
+ }
13
+ /** Document metadata from meta.xml. */
14
+ export interface OdsMetadata {
15
+ title?: string;
16
+ creator?: string;
17
+ description?: string;
18
+ creationDate?: string;
19
+ lastModified?: string;
20
+ }
21
+ /** A single sheet (tab) in the spreadsheet. */
22
+ export interface OdsSheetModel {
23
+ /** Sheet tab name. */
24
+ name: string;
25
+ /** Tab color if set (hex or CSS named color). */
26
+ tabColor?: string;
27
+ /** Rows in order. Sparse rows (e.g. from table:number-rows-repeated) are expanded. */
28
+ rows: OdsRowModel[];
29
+ /** Column widths by zero-based column index. */
30
+ columnWidths: Map<number, string>;
31
+ /** Number of frozen rows (from settings.xml). */
32
+ freezeRows?: number;
33
+ /** Number of frozen columns (from settings.xml). */
34
+ freezeColumns?: number;
35
+ }
36
+ /** A row of cells. */
37
+ export interface OdsRowModel {
38
+ /** Zero-based row index within the sheet. */
39
+ index: number;
40
+ /** Cells in column order. Covered cells have type "covered". */
41
+ cells: OdsCellModel[];
42
+ /** Row height if explicitly set. */
43
+ height?: string;
44
+ }
45
+ /**
46
+ * A single cell in the spreadsheet.
47
+ *
48
+ * Cell types:
49
+ * - `"string"` — text value; `value` is a string
50
+ * - `"float"` — numeric value; `value` is a number
51
+ * - `"date"` — date/datetime; `value` is a Date (UTC)
52
+ * - `"boolean"` — boolean; `value` is true or false
53
+ * - `"formula"` — formula cell; `value` is the cached result, `formula` is the original string
54
+ * - `"empty"` — no content; `value` is null
55
+ * - `"covered"` — covered by a merge from a primary cell; `value` is null
56
+ */
57
+ export interface OdsCellModel {
58
+ /** Zero-based column index. Always correct regardless of merges. */
59
+ colIndex: number;
60
+ /** Cell type. */
61
+ type: "string" | "float" | "date" | "boolean" | "formula" | "empty" | "covered";
62
+ /**
63
+ * The typed JavaScript value.
64
+ * - string → string
65
+ * - float → number
66
+ * - date → Date (UTC)
67
+ * - boolean → boolean
68
+ * - formula → cached result (number, string, or boolean)
69
+ * - empty/covered → null
70
+ */
71
+ value: string | number | boolean | Date | null;
72
+ /**
73
+ * Original formula string for formula cells (e.g. `"=SUM(A1:A10)"`).
74
+ * The `of:` OpenFormula prefix is stripped.
75
+ * Undefined for non-formula cells.
76
+ */
77
+ formula?: string;
78
+ /**
79
+ * Display text as it appears in the cell (the text:p content).
80
+ * e.g. `"1,234.56"` for a formatted number, `"15/01/2026"` for a date.
81
+ * May differ from `value` when number or date formatting is applied.
82
+ */
83
+ displayText?: string;
84
+ /**
85
+ * Number of columns this cell spans (1 = no merge).
86
+ * Only set when > 1.
87
+ */
88
+ colSpan?: number;
89
+ /**
90
+ * Number of rows this cell spans (1 = no merge).
91
+ * Only set when > 1.
92
+ */
93
+ rowSpan?: number;
94
+ /** Cell formatting extracted from the cell style. */
95
+ formatting?: OdsCellFormatting;
96
+ }
97
+ /** Cell formatting properties extracted from ODS automatic styles. */
98
+ export interface OdsCellFormatting {
99
+ bold?: boolean;
100
+ italic?: boolean;
101
+ underline?: boolean;
102
+ fontSize?: string;
103
+ fontFamily?: string;
104
+ /** Text color. */
105
+ color?: string;
106
+ /** Cell background color. */
107
+ backgroundColor?: string;
108
+ /** Horizontal text alignment. */
109
+ textAlign?: "left" | "center" | "right";
110
+ /** Vertical alignment. */
111
+ verticalAlign?: "top" | "middle" | "bottom";
112
+ /** Number format string (e.g. `"decimal:2"`, `"currency:EUR"`, `"percentage"`). */
113
+ numberFormat?: string;
114
+ /** Date format string (e.g. `"YYYY-MM-DD"`, `"DD/MM/YYYY"`). */
115
+ dateFormat?: string;
116
+ }
117
+ /** Options for {@link readOds}. */
118
+ export interface ReadOdsOptions {
119
+ /**
120
+ * Whether to include cell formatting in the model.
121
+ * Defaults to `true`. Set to `false` for faster parsing when
122
+ * only values and types are needed.
123
+ */
124
+ includeFormatting?: boolean;
125
+ }
126
+ /** Options for {@link odsToHtml}. */
127
+ export interface OdsHtmlOptions {
128
+ /**
129
+ * Whether to include inline styles from cell formatting.
130
+ * Defaults to `true`.
131
+ */
132
+ includeStyles?: boolean;
133
+ /**
134
+ * CSS class prefix for generated elements.
135
+ * Defaults to `"ods"`.
136
+ */
137
+ classPrefix?: string;
138
+ }
139
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/ods-reader/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,0DAA0D;AAC1D,MAAM,WAAW,gBAAgB;IAC/B,2BAA2B;IAC3B,MAAM,EAAE,aAAa,EAAE,CAAC;IACxB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,WAAW,CAAC;CACxB;AAED,uCAAuC;AACvC,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,+CAA+C;AAC/C,MAAM,WAAW,aAAa;IAC5B,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sFAAsF;IACtF,IAAI,EAAE,WAAW,EAAE,CAAC;IACpB,gDAAgD;IAChD,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oDAAoD;IACpD,aAAa,CAAC,EAA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,QAAQ,GAAG,QAAQ,CAAC;IAC5C,mFAAmF;IACnF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAID,mCAAmC;AACnC,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,qCAAqC;AACrC,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * ODS reader type definitions.
3
+ *
4
+ * These types describe the in-memory model returned by readOds().
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/ods-reader/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "odf-kit",
3
- "version": "0.9.6",
3
+ "version": "0.9.8",
4
4
  "description": "Generate, fill, read, and convert OpenDocument Format (.odt) files in JavaScript and TypeScript. Works in Node.js and browsers.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -14,10 +14,18 @@
14
14
  "types": "./dist/odt/index.d.ts",
15
15
  "import": "./dist/odt/index.js"
16
16
  },
17
+ "./odt-reader": {
18
+ "types": "./dist/reader/index.d.ts",
19
+ "import": "./dist/reader/index.js"
20
+ },
17
21
  "./ods": {
18
22
  "types": "./dist/ods/index.d.ts",
19
23
  "import": "./dist/ods/index.js"
20
24
  },
25
+ "./ods-reader": {
26
+ "types": "./dist/ods-reader/index.d.ts",
27
+ "import": "./dist/ods-reader/index.js"
28
+ },
21
29
  "./template": {
22
30
  "types": "./dist/template/index.d.ts",
23
31
  "import": "./dist/template/index.js"
@@ -51,13 +59,22 @@
51
59
  "opendocument",
52
60
  "odt",
53
61
  "ods",
54
- "odp",
55
- "odg",
56
62
  "libreoffice",
57
63
  "document",
58
64
  "spreadsheet",
59
- "presentation",
60
- "browser"
65
+ "browser",
66
+ "tiptap",
67
+ "prosemirror",
68
+ "tiptap-odt",
69
+ "prosemirror-odt",
70
+ "html-to-odt",
71
+ "markdown-to-odt",
72
+ "tiptap-export",
73
+ "odt-export",
74
+ "odt-generator",
75
+ "template",
76
+ "typst",
77
+ "iso26300"
61
78
  ],
62
79
  "author": "GitHubNewbie0",
63
80
  "license": "Apache-2.0",