odf-kit 0.9.9 → 0.10.1
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 +42 -0
- package/README.md +97 -4
- package/dist/docx/body-reader.d.ts +54 -0
- package/dist/docx/body-reader.d.ts.map +1 -0
- package/dist/docx/body-reader.js +1124 -0
- package/dist/docx/body-reader.js.map +1 -0
- package/dist/docx/converter.d.ts +51 -0
- package/dist/docx/converter.d.ts.map +1 -0
- package/dist/docx/converter.js +799 -0
- package/dist/docx/converter.js.map +1 -0
- package/dist/docx/index.d.ts +81 -0
- package/dist/docx/index.d.ts.map +1 -0
- package/dist/docx/index.js +69 -0
- package/dist/docx/index.js.map +1 -0
- package/dist/docx/numbering.d.ts +42 -0
- package/dist/docx/numbering.d.ts.map +1 -0
- package/dist/docx/numbering.js +236 -0
- package/dist/docx/numbering.js.map +1 -0
- package/dist/docx/reader.d.ts +38 -0
- package/dist/docx/reader.d.ts.map +1 -0
- package/dist/docx/reader.js +512 -0
- package/dist/docx/reader.js.map +1 -0
- package/dist/docx/relationships.d.ts +27 -0
- package/dist/docx/relationships.d.ts.map +1 -0
- package/dist/docx/relationships.js +89 -0
- package/dist/docx/relationships.js.map +1 -0
- package/dist/docx/styles.d.ts +46 -0
- package/dist/docx/styles.d.ts.map +1 -0
- package/dist/docx/styles.js +383 -0
- package/dist/docx/styles.js.map +1 -0
- package/dist/docx/types.d.ts +266 -0
- package/dist/docx/types.d.ts.map +1 -0
- package/dist/docx/types.js +38 -0
- package/dist/docx/types.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +36 -1
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* odf-kit — DOCX internal model types
|
|
3
|
+
*
|
|
4
|
+
* These types represent the parsed state of a .docx file. They are internal
|
|
5
|
+
* to the odf-kit/docx pipeline and are not part of the public API.
|
|
6
|
+
*
|
|
7
|
+
* Flow: .docx bytes → reader.ts → DocxDocument → converter.ts → OdtDocument
|
|
8
|
+
*/
|
|
9
|
+
export interface DocxDocument {
|
|
10
|
+
metadata: DocxMetadata;
|
|
11
|
+
pageLayout: DocxPageLayout;
|
|
12
|
+
body: DocxBodyElement[];
|
|
13
|
+
footnotes: Map<string, DocxNote>;
|
|
14
|
+
endnotes: Map<string, DocxNote>;
|
|
15
|
+
headers: DocxHeaderFooter[];
|
|
16
|
+
footers: DocxHeaderFooter[];
|
|
17
|
+
styles: StyleMap;
|
|
18
|
+
numbering: NumberingMap;
|
|
19
|
+
relationships: RelationshipMap;
|
|
20
|
+
images: ImageMap;
|
|
21
|
+
}
|
|
22
|
+
export interface DocxMetadata {
|
|
23
|
+
title: string | null;
|
|
24
|
+
creator: string | null;
|
|
25
|
+
description: string | null;
|
|
26
|
+
created: string | null;
|
|
27
|
+
modified: string | null;
|
|
28
|
+
}
|
|
29
|
+
export interface DocxPageLayout {
|
|
30
|
+
/** Page width in cm. */
|
|
31
|
+
width: number | null;
|
|
32
|
+
/** Page height in cm. */
|
|
33
|
+
height: number | null;
|
|
34
|
+
/** Margins in cm. */
|
|
35
|
+
marginTop: number | null;
|
|
36
|
+
marginBottom: number | null;
|
|
37
|
+
marginLeft: number | null;
|
|
38
|
+
marginRight: number | null;
|
|
39
|
+
/** "portrait" | "landscape". Derived from width vs height when w:orient absent. */
|
|
40
|
+
orientation: "portrait" | "landscape" | null;
|
|
41
|
+
}
|
|
42
|
+
export type DocxBodyElement = DocxParagraph | DocxTable | DocxPageBreak;
|
|
43
|
+
export interface DocxPageBreak {
|
|
44
|
+
type: "pageBreak";
|
|
45
|
+
}
|
|
46
|
+
export interface DocxParagraph {
|
|
47
|
+
type: "paragraph";
|
|
48
|
+
/** Resolved heading level (1–6), or null for body text. */
|
|
49
|
+
headingLevel: number | null;
|
|
50
|
+
/** Paragraph style ID from styles.xml, e.g. "Heading1", "Normal". */
|
|
51
|
+
styleId: string | null;
|
|
52
|
+
props: ParaProps;
|
|
53
|
+
runs: DocxInlineElement[];
|
|
54
|
+
}
|
|
55
|
+
export type DocxInlineElement = DocxRun | DocxHyperlink | DocxInlineImage | DocxFootnoteReference | DocxEndnoteReference | DocxBookmark | DocxTab | DocxLineBreak;
|
|
56
|
+
export interface DocxRun {
|
|
57
|
+
type: "run";
|
|
58
|
+
text: string;
|
|
59
|
+
props: RunProps;
|
|
60
|
+
}
|
|
61
|
+
export interface DocxHyperlink {
|
|
62
|
+
type: "hyperlink";
|
|
63
|
+
/** Resolved URL for external links; anchor target for internal links. */
|
|
64
|
+
url: string;
|
|
65
|
+
/** True if this is an internal bookmark link (starts with #). */
|
|
66
|
+
internal: boolean;
|
|
67
|
+
runs: DocxRun[];
|
|
68
|
+
}
|
|
69
|
+
export interface DocxInlineImage {
|
|
70
|
+
type: "inlineImage";
|
|
71
|
+
/** Relationship ID — used to look up bytes in DocxDocument.images. */
|
|
72
|
+
rId: string;
|
|
73
|
+
/** Width in cm, derived from EMU value (1 cm = 914400 / 100 EMU). */
|
|
74
|
+
widthCm: number;
|
|
75
|
+
/** Height in cm. */
|
|
76
|
+
heightCm: number;
|
|
77
|
+
/** Alt text from wp:docPr descr attribute. */
|
|
78
|
+
altText: string | null;
|
|
79
|
+
}
|
|
80
|
+
export interface DocxFootnoteReference {
|
|
81
|
+
type: "footnoteReference";
|
|
82
|
+
/** Matches a key in DocxDocument.footnotes. */
|
|
83
|
+
id: string;
|
|
84
|
+
}
|
|
85
|
+
export interface DocxEndnoteReference {
|
|
86
|
+
type: "endnoteReference";
|
|
87
|
+
/** Matches a key in DocxDocument.endnotes. */
|
|
88
|
+
id: string;
|
|
89
|
+
}
|
|
90
|
+
export interface DocxNote {
|
|
91
|
+
id: string;
|
|
92
|
+
/** Full paragraph support — notes may contain multiple paragraphs. */
|
|
93
|
+
body: DocxBodyElement[];
|
|
94
|
+
}
|
|
95
|
+
export interface DocxBookmark {
|
|
96
|
+
type: "bookmark";
|
|
97
|
+
name: string;
|
|
98
|
+
/** "start" | "end" — paired markers in the body. */
|
|
99
|
+
position: "start" | "end";
|
|
100
|
+
}
|
|
101
|
+
export interface DocxTab {
|
|
102
|
+
type: "tab";
|
|
103
|
+
}
|
|
104
|
+
export interface DocxLineBreak {
|
|
105
|
+
type: "lineBreak";
|
|
106
|
+
}
|
|
107
|
+
export interface DocxTable {
|
|
108
|
+
type: "table";
|
|
109
|
+
/** Column widths in cm, one per column. Derived from w:tblGrid / w:gridCol. */
|
|
110
|
+
columnWidths: number[];
|
|
111
|
+
rows: DocxTableRow[];
|
|
112
|
+
}
|
|
113
|
+
export interface DocxTableRow {
|
|
114
|
+
cells: DocxTableCell[];
|
|
115
|
+
}
|
|
116
|
+
export interface DocxTableCell {
|
|
117
|
+
/** Number of columns this cell spans (w:gridSpan). Default: 1. */
|
|
118
|
+
colSpan: number;
|
|
119
|
+
/**
|
|
120
|
+
* Rowspan is inferred from w:vMerge / w:vMerge w:val="restart".
|
|
121
|
+
* "restart" = first cell of a vertical merge group.
|
|
122
|
+
* "continue" = continuation cell (rendered as merged, no output cell).
|
|
123
|
+
* null = not merged vertically.
|
|
124
|
+
*/
|
|
125
|
+
vMerge: "restart" | "continue" | null;
|
|
126
|
+
/** Background color (hex, no #), from w:shd w:fill. */
|
|
127
|
+
backgroundColor: string | null;
|
|
128
|
+
/** Vertical alignment: "top" | "center" | "bottom". */
|
|
129
|
+
verticalAlign: "top" | "center" | "bottom" | null;
|
|
130
|
+
body: DocxBodyElement[];
|
|
131
|
+
}
|
|
132
|
+
export interface DocxHeaderFooter {
|
|
133
|
+
/**
|
|
134
|
+
* "default" | "first" | "even"
|
|
135
|
+
* Corresponds to w:type attribute on w:hdr / w:ftr.
|
|
136
|
+
*/
|
|
137
|
+
headerType: "default" | "first" | "even";
|
|
138
|
+
body: DocxBodyElement[];
|
|
139
|
+
}
|
|
140
|
+
export interface RunProps {
|
|
141
|
+
bold: boolean;
|
|
142
|
+
italic: boolean;
|
|
143
|
+
underline: boolean;
|
|
144
|
+
strikethrough: boolean;
|
|
145
|
+
doubleStrikethrough: boolean;
|
|
146
|
+
superscript: boolean;
|
|
147
|
+
subscript: boolean;
|
|
148
|
+
smallCaps: boolean;
|
|
149
|
+
allCaps: boolean;
|
|
150
|
+
/** Hex color string without #, e.g. "FF0000". Null = auto/default. */
|
|
151
|
+
color: string | null;
|
|
152
|
+
/** Font size in points. Null = inherited. */
|
|
153
|
+
fontSize: number | null;
|
|
154
|
+
/** Highlight color name, e.g. "yellow", "cyan". Null = none. */
|
|
155
|
+
highlight: string | null;
|
|
156
|
+
/** Font family name. Null = inherited. */
|
|
157
|
+
fontFamily: string | null;
|
|
158
|
+
/** BCP 47 language tag, e.g. "en-US". Null = inherited. */
|
|
159
|
+
lang: string | null;
|
|
160
|
+
/** Character style ID reference. Null = none. */
|
|
161
|
+
rStyleId: string | null;
|
|
162
|
+
}
|
|
163
|
+
export declare const DEFAULT_RUN_PROPS: RunProps;
|
|
164
|
+
export interface ParaProps {
|
|
165
|
+
/** "left" | "center" | "right" | "justify". Null = inherited. */
|
|
166
|
+
alignment: "left" | "center" | "right" | "justify" | null;
|
|
167
|
+
/**
|
|
168
|
+
* Force a page break before this paragraph (w:pageBreakBefore).
|
|
169
|
+
* When true the converter emits a page break before the paragraph.
|
|
170
|
+
*/
|
|
171
|
+
pageBreakBefore: boolean;
|
|
172
|
+
/** Space before paragraph in cm. Null = inherited. */
|
|
173
|
+
spaceBefore: number | null;
|
|
174
|
+
/** Space after paragraph in cm. Null = inherited. */
|
|
175
|
+
spaceAfter: number | null;
|
|
176
|
+
/**
|
|
177
|
+
* Line height. Null = auto (single).
|
|
178
|
+
* Expressed as a multiplier, e.g. 1.5 = 150%, 2.0 = double.
|
|
179
|
+
*/
|
|
180
|
+
lineHeight: number | null;
|
|
181
|
+
/** Left indentation in cm. Null = none. */
|
|
182
|
+
indentLeft: number | null;
|
|
183
|
+
/** Right indentation in cm. Null = none. */
|
|
184
|
+
indentRight: number | null;
|
|
185
|
+
/** First-line indentation in cm. Negative = hanging. Null = none. */
|
|
186
|
+
indentFirstLine: number | null;
|
|
187
|
+
/**
|
|
188
|
+
* List membership. Null = not a list item.
|
|
189
|
+
*/
|
|
190
|
+
list: ParaListProps | null;
|
|
191
|
+
/** Paragraph bottom border, for horizontal rule simulation. */
|
|
192
|
+
borderBottom: ParaBorder | null;
|
|
193
|
+
}
|
|
194
|
+
export declare const DEFAULT_PARA_PROPS: ParaProps;
|
|
195
|
+
export interface ParaListProps {
|
|
196
|
+
/** References a key in NumberingMap. */
|
|
197
|
+
numId: string;
|
|
198
|
+
/** Zero-based list level (0 = outermost). */
|
|
199
|
+
level: number;
|
|
200
|
+
}
|
|
201
|
+
export interface ParaBorder {
|
|
202
|
+
/** Border style, e.g. "solid", "dashed". Mapped from w:val. */
|
|
203
|
+
style: string;
|
|
204
|
+
/** Line width in pt. Derived from w:sz (eighths of a point → divide by 8). */
|
|
205
|
+
widthPt: number;
|
|
206
|
+
/** Hex color without #. */
|
|
207
|
+
color: string;
|
|
208
|
+
}
|
|
209
|
+
/** Keyed by styleId (w:styleId attribute), e.g. "Heading1", "Normal". */
|
|
210
|
+
export type StyleMap = Map<string, StyleEntry>;
|
|
211
|
+
export interface StyleEntry {
|
|
212
|
+
styleId: string;
|
|
213
|
+
/** Display name, e.g. "heading 1", "Normal". */
|
|
214
|
+
name: string;
|
|
215
|
+
type: "paragraph" | "character" | "table" | "numbering";
|
|
216
|
+
/** Resolved heading level (1–6). Null if not a heading style. */
|
|
217
|
+
headingLevel: number | null;
|
|
218
|
+
/** Parent style ID (w:basedOn). Null = no parent. */
|
|
219
|
+
basedOn: string | null;
|
|
220
|
+
/** Default character formatting for this style. */
|
|
221
|
+
rPr: Partial<RunProps> | null;
|
|
222
|
+
/** Default paragraph formatting for this style. */
|
|
223
|
+
pPr: Partial<ParaProps> | null;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Keyed by numId (string). Each value is an array of levels (index = level).
|
|
227
|
+
* Level 0 is the outermost list level.
|
|
228
|
+
*/
|
|
229
|
+
export type NumberingMap = Map<string, NumberingLevel[]>;
|
|
230
|
+
export interface NumberingLevel {
|
|
231
|
+
/** Zero-based level index. */
|
|
232
|
+
level: number;
|
|
233
|
+
/** True = ordered (numbered) list. False = unordered (bullet) list. */
|
|
234
|
+
isOrdered: boolean;
|
|
235
|
+
/**
|
|
236
|
+
* DOCX numFmt value: "bullet", "decimal", "lowerRoman", "upperRoman",
|
|
237
|
+
* "lowerLetter", "upperLetter", "ordinal", "none", etc.
|
|
238
|
+
*/
|
|
239
|
+
numFormat: string;
|
|
240
|
+
/** List start value. Default: 1. */
|
|
241
|
+
start: number;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Keyed by relationship ID (rId), value is the resolved file path within
|
|
245
|
+
* the ZIP, e.g. "word/media/image1.png", or an external URL.
|
|
246
|
+
*/
|
|
247
|
+
export type RelationshipMap = Map<string, RelationshipEntry>;
|
|
248
|
+
export interface RelationshipEntry {
|
|
249
|
+
/** Full path within ZIP (for internal rels) or URL (for external rels). */
|
|
250
|
+
target: string;
|
|
251
|
+
/** True if this is an external URL (hyperlink, etc.). */
|
|
252
|
+
external: boolean;
|
|
253
|
+
/** Relationship type URI, e.g. ".../hyperlink", ".../image". */
|
|
254
|
+
type: string;
|
|
255
|
+
}
|
|
256
|
+
export interface ImageEntry {
|
|
257
|
+
/** Raw image bytes. */
|
|
258
|
+
bytes: Uint8Array;
|
|
259
|
+
/** MIME type derived from file extension, e.g. "image/png", "image/jpeg". */
|
|
260
|
+
mimeType: string;
|
|
261
|
+
/** Original filename within the ZIP, e.g. "image1.png". */
|
|
262
|
+
filename: string;
|
|
263
|
+
}
|
|
264
|
+
/** Keyed by rId — same keys as RelationshipMap for image-type relationships. */
|
|
265
|
+
export type ImageMap = Map<string, ImageEntry>;
|
|
266
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @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EAAE,MAAM,CAAC;IACf,yDAAyD;IACzD,QAAQ,EAAE,OAAO,CAAC;IAClB,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;CACd;AAMD,MAAM,WAAW,UAAU;IACzB,uBAAuB;IACvB,KAAK,EAAE,UAAU,CAAC;IAClB,6EAA6E;IAC7E,QAAQ,EAAE,MAAM,CAAC;IACjB,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,gFAAgF;AAChF,MAAM,MAAM,QAAQ,GAAG,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* odf-kit — DOCX internal model types
|
|
3
|
+
*
|
|
4
|
+
* These types represent the parsed state of a .docx file. They are internal
|
|
5
|
+
* to the odf-kit/docx pipeline and are not part of the public API.
|
|
6
|
+
*
|
|
7
|
+
* Flow: .docx bytes → reader.ts → DocxDocument → converter.ts → OdtDocument
|
|
8
|
+
*/
|
|
9
|
+
export const DEFAULT_RUN_PROPS = {
|
|
10
|
+
bold: false,
|
|
11
|
+
italic: false,
|
|
12
|
+
underline: false,
|
|
13
|
+
strikethrough: false,
|
|
14
|
+
doubleStrikethrough: false,
|
|
15
|
+
superscript: false,
|
|
16
|
+
subscript: false,
|
|
17
|
+
smallCaps: false,
|
|
18
|
+
allCaps: false,
|
|
19
|
+
color: null,
|
|
20
|
+
fontSize: null,
|
|
21
|
+
highlight: null,
|
|
22
|
+
fontFamily: null,
|
|
23
|
+
lang: null,
|
|
24
|
+
rStyleId: null,
|
|
25
|
+
};
|
|
26
|
+
export const DEFAULT_PARA_PROPS = {
|
|
27
|
+
alignment: null,
|
|
28
|
+
pageBreakBefore: false,
|
|
29
|
+
spaceBefore: null,
|
|
30
|
+
spaceAfter: null,
|
|
31
|
+
lineHeight: null,
|
|
32
|
+
indentLeft: null,
|
|
33
|
+
indentRight: null,
|
|
34
|
+
indentFirstLine: null,
|
|
35
|
+
list: null,
|
|
36
|
+
borderBottom: null,
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/docx/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAqPH,MAAM,CAAC,MAAM,iBAAiB,GAAa;IACzC,IAAI,EAAE,KAAK;IACX,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,KAAK;IAChB,aAAa,EAAE,KAAK;IACpB,mBAAmB,EAAE,KAAK;IAC1B,WAAW,EAAE,KAAK;IAClB,SAAS,EAAE,KAAK;IAChB,SAAS,EAAE,KAAK;IAChB,OAAO,EAAE,KAAK;IACd,KAAK,EAAE,IAAI;IACX,QAAQ,EAAE,IAAI;IACd,SAAS,EAAE,IAAI;IACf,UAAU,EAAE,IAAI;IAChB,IAAI,EAAE,IAAI;IACV,QAAQ,EAAE,IAAI;CACf,CAAC;AAqCF,MAAM,CAAC,MAAM,kBAAkB,GAAc;IAC3C,SAAS,EAAE,IAAI;IACf,eAAe,EAAE,KAAK;IACtB,WAAW,EAAE,IAAI;IACjB,UAAU,EAAE,IAAI;IAChB,UAAU,EAAE,IAAI;IAChB,UAAU,EAAE,IAAI;IAChB,WAAW,EAAE,IAAI;IACjB,eAAe,EAAE,IAAI;IACrB,IAAI,EAAE,IAAI;IACV,YAAY,EAAE,IAAI;CACnB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -13,4 +13,6 @@ export type { TemplateData } from "./template/index.js";
|
|
|
13
13
|
export { OdsDocument } from "./ods/index.js";
|
|
14
14
|
export { OdsSheet } from "./ods/index.js";
|
|
15
15
|
export type { OdsCellValue, OdsCellObject, OdsCellOptions, OdsCellType, OdsRowOptions, OdsDateFormat, } from "./ods/index.js";
|
|
16
|
+
export { docxToOdt } from "./docx/index.js";
|
|
17
|
+
export type { DocxToOdtOptions, DocxToOdtResult } from "./docx/index.js";
|
|
16
18
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EACV,cAAc,EACd,cAAc,EACd,OAAO,EACP,YAAY,EACZ,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,OAAO,EACP,WAAW,EACX,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjF,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,YAAY,EACV,YAAY,EACZ,aAAa,EACb,cAAc,EACd,WAAW,EACX,aAAa,EACb,aAAa,GACd,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/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} from "./odt/index.js";
|
|
|
11
11
|
export { fillTemplate, healPlaceholders, replaceAll } from "./template/index.js";
|
|
12
12
|
export { OdsDocument } from "./ods/index.js";
|
|
13
13
|
export { OdsSheet } from "./ods/index.js";
|
|
14
|
+
export { docxToOdt } from "./docx/index.js";
|
|
14
15
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,2CAA2C;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAmB7C,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjF,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,2CAA2C;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAmB7C,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjF,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAS1C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "odf-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
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",
|
|
@@ -41,6 +41,41 @@
|
|
|
41
41
|
"./typst": {
|
|
42
42
|
"types": "./dist/typst/index.d.ts",
|
|
43
43
|
"import": "./dist/typst/index.js"
|
|
44
|
+
},
|
|
45
|
+
"./docx": {
|
|
46
|
+
"types": "./dist/docx/index.d.ts",
|
|
47
|
+
"import": "./dist/docx/index.js"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"typesVersions": {
|
|
51
|
+
"*": {
|
|
52
|
+
"odt": [
|
|
53
|
+
"./dist/odt/index.d.ts"
|
|
54
|
+
],
|
|
55
|
+
"odt-reader": [
|
|
56
|
+
"./dist/reader/index.d.ts"
|
|
57
|
+
],
|
|
58
|
+
"ods": [
|
|
59
|
+
"./dist/ods/index.d.ts"
|
|
60
|
+
],
|
|
61
|
+
"ods-reader": [
|
|
62
|
+
"./dist/ods-reader/index.d.ts"
|
|
63
|
+
],
|
|
64
|
+
"xlsx": [
|
|
65
|
+
"./dist/xlsx/index.d.ts"
|
|
66
|
+
],
|
|
67
|
+
"template": [
|
|
68
|
+
"./dist/template/index.d.ts"
|
|
69
|
+
],
|
|
70
|
+
"reader": [
|
|
71
|
+
"./dist/reader/index.d.ts"
|
|
72
|
+
],
|
|
73
|
+
"typst": [
|
|
74
|
+
"./dist/typst/index.d.ts"
|
|
75
|
+
],
|
|
76
|
+
"docx": [
|
|
77
|
+
"./dist/docx/index.d.ts"
|
|
78
|
+
]
|
|
44
79
|
}
|
|
45
80
|
},
|
|
46
81
|
"files": [
|