@blocknote/xl-odt-exporter 0.25.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.
Files changed (44) hide show
  1. package/LICENSE +661 -0
  2. package/dist/GeistMono-Regular-D4rKXxwr.js +5 -0
  3. package/dist/GeistMono-Regular-D4rKXxwr.js.map +1 -0
  4. package/dist/Inter_18pt-Regular-byxnNS-8.js +5 -0
  5. package/dist/Inter_18pt-Regular-byxnNS-8.js.map +1 -0
  6. package/dist/blocknote-xl-odt-exporter.js +1646 -0
  7. package/dist/blocknote-xl-odt-exporter.js.map +1 -0
  8. package/dist/blocknote-xl-odt-exporter.umd.cjs +1080 -0
  9. package/dist/blocknote-xl-odt-exporter.umd.cjs.map +1 -0
  10. package/dist/webpack-stats.json +1 -0
  11. package/package.json +82 -0
  12. package/src/index.ts +1 -0
  13. package/src/odt/__snapshots__/basic/content.xml +448 -0
  14. package/src/odt/__snapshots__/basic/styles.xml +599 -0
  15. package/src/odt/__snapshots__/withCustomOptions/content.xml +462 -0
  16. package/src/odt/__snapshots__/withCustomOptions/styles.xml +599 -0
  17. package/src/odt/defaultSchema/blocks.tsx +460 -0
  18. package/src/odt/defaultSchema/index.ts +9 -0
  19. package/src/odt/defaultSchema/inlineContent.tsx +30 -0
  20. package/src/odt/defaultSchema/styles.ts +59 -0
  21. package/src/odt/index.ts +2 -0
  22. package/src/odt/odtExporter.test.ts +80 -0
  23. package/src/odt/odtExporter.tsx +360 -0
  24. package/src/odt/template/META-INF/manifest.xml +18 -0
  25. package/src/odt/template/Pictures/100000000000014C0000014CDD284996.jpg +0 -0
  26. package/src/odt/template/README.md +3 -0
  27. package/src/odt/template/Thumbnails/thumbnail.png +0 -0
  28. package/src/odt/template/content.xml +430 -0
  29. package/src/odt/template/manifest.rdf +6 -0
  30. package/src/odt/template/meta.xml +19 -0
  31. package/src/odt/template/mimetype +1 -0
  32. package/src/odt/template/settings.xml +173 -0
  33. package/src/odt/template/styles.xml +1078 -0
  34. package/src/odt/template/template blocknote.odt +0 -0
  35. package/src/odt/util/jsx.d.ts +55 -0
  36. package/src/vite-env.d.ts +11 -0
  37. package/types/src/index.d.ts +1 -0
  38. package/types/src/odt/defaultSchema/blocks.d.ts +4 -0
  39. package/types/src/odt/defaultSchema/index.d.ts +529 -0
  40. package/types/src/odt/defaultSchema/inlineContent.d.ts +3 -0
  41. package/types/src/odt/defaultSchema/styles.d.ts +2 -0
  42. package/types/src/odt/index.d.ts +2 -0
  43. package/types/src/odt/odtExporter.d.ts +28 -0
  44. package/types/src/odt/odtExporter.test.d.ts +1 -0
@@ -0,0 +1,55 @@
1
+ declare namespace JSX {
2
+ interface IntrinsicElements {
3
+ "office:document-content": any;
4
+ "office:body": any;
5
+ "office:text": any;
6
+ "office:automatic-styles": any;
7
+ "office:font-face-decls": any;
8
+ "office:master-styles": any;
9
+ "style:style": any;
10
+ "style:text-properties": any;
11
+ "style:master-page": any;
12
+ "style:header": any;
13
+ "style:footer": any;
14
+ "text:p": any;
15
+ "text:h": any;
16
+ "text:list-item": any;
17
+ "text:list": any;
18
+ "text:a": any;
19
+ "text:span": any;
20
+ "text:line-break": any;
21
+ "text:tab": any;
22
+ "draw:frame": any;
23
+ "draw:image": any;
24
+ "draw:text-box": any;
25
+ "table:table": any;
26
+ "table:table-row": any;
27
+ "table:table-cell": any;
28
+ "table:table-column": any;
29
+ "manifest:manifest": any;
30
+ "manifest:file-entry": any;
31
+ "style:paragraph-properties": any;
32
+ "style:background-fill": any;
33
+ "style:table-properties": any;
34
+ "style:table-cell-properties": any;
35
+ "style:table-column-properties": any;
36
+ "style:table-row-properties": any;
37
+ "style:font-face": any;
38
+ "svg:font-face-src": any;
39
+ "svg:font-face-uri": any;
40
+ "svg:font-face-format": any;
41
+ "loext:graphic-properties": any;
42
+ }
43
+
44
+ interface IntrinsicAttributes {
45
+ "text:style-name"?: string;
46
+ "style:style-name"?: string;
47
+ "style:name"?: string;
48
+ "style:family"?: string;
49
+ "style:background-fill"?: string;
50
+ "draw:fill"?: string;
51
+ "draw:fill-color"?: string;
52
+ "fo:border"?: string;
53
+ "fo:padding"?: string;
54
+ }
55
+ }
@@ -0,0 +1,11 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
4
+ interface ImportMetaEnv {
5
+ // readonly VITE_APP_TITLE: string;
6
+ // more env variables...
7
+ }
8
+
9
+ interface ImportMeta {
10
+ readonly env: ImportMetaEnv;
11
+ }
@@ -0,0 +1 @@
1
+ export * from "./odt/index.js";
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { BlockMapping, DefaultBlockSchema, pageBreakSchema } from "@blocknote/core";
3
+ export declare const getTabs: (nestingLevel: number) => import("react/jsx-runtime").JSX.Element[];
4
+ export declare const odtBlockMappingForDefaultSchema: BlockMapping<DefaultBlockSchema & typeof pageBreakSchema.blockSchema, any, any, React.ReactNode, React.ReactNode>;
@@ -0,0 +1,529 @@
1
+ /// <reference types="react" />
2
+ export declare const odtDefaultSchemaMappings: {
3
+ blockMapping: import("@blocknote/core").BlockMapping<import("@blocknote/core").BlockSchemaFromSpecs<{
4
+ paragraph: {
5
+ config: {
6
+ type: "paragraph";
7
+ content: "inline";
8
+ propSchema: {
9
+ backgroundColor: {
10
+ default: "default";
11
+ };
12
+ textColor: {
13
+ default: "default";
14
+ };
15
+ textAlignment: {
16
+ default: "left";
17
+ values: readonly ["left", "center", "right", "justify"];
18
+ };
19
+ };
20
+ };
21
+ implementation: import("@blocknote/core").TiptapBlockImplementation<{
22
+ type: "paragraph";
23
+ content: "inline";
24
+ propSchema: {
25
+ backgroundColor: {
26
+ default: "default";
27
+ };
28
+ textColor: {
29
+ default: "default";
30
+ };
31
+ textAlignment: {
32
+ default: "left";
33
+ values: readonly ["left", "center", "right", "justify"];
34
+ };
35
+ };
36
+ }, any, import("@blocknote/core").InlineContentSchema, import("@blocknote/core").StyleSchema>;
37
+ };
38
+ heading: {
39
+ config: {
40
+ type: "heading";
41
+ content: "inline";
42
+ propSchema: {
43
+ level: {
44
+ default: number;
45
+ values: readonly [1, 2, 3];
46
+ };
47
+ backgroundColor: {
48
+ default: "default";
49
+ };
50
+ textColor: {
51
+ default: "default";
52
+ };
53
+ textAlignment: {
54
+ default: "left";
55
+ values: readonly ["left", "center", "right", "justify"];
56
+ };
57
+ };
58
+ };
59
+ implementation: import("@blocknote/core").TiptapBlockImplementation<{
60
+ type: "heading";
61
+ content: "inline";
62
+ propSchema: {
63
+ level: {
64
+ default: number;
65
+ values: readonly [1, 2, 3];
66
+ };
67
+ backgroundColor: {
68
+ default: "default";
69
+ };
70
+ textColor: {
71
+ default: "default";
72
+ };
73
+ textAlignment: {
74
+ default: "left";
75
+ values: readonly ["left", "center", "right", "justify"];
76
+ };
77
+ };
78
+ }, any, import("@blocknote/core").InlineContentSchema, import("@blocknote/core").StyleSchema>;
79
+ };
80
+ codeBlock: {
81
+ config: {
82
+ type: "codeBlock";
83
+ content: "inline";
84
+ propSchema: {
85
+ language: {
86
+ default: string;
87
+ values: string[];
88
+ };
89
+ };
90
+ };
91
+ implementation: import("@blocknote/core").TiptapBlockImplementation<{
92
+ type: "codeBlock";
93
+ content: "inline";
94
+ propSchema: {
95
+ language: {
96
+ default: string;
97
+ values: string[];
98
+ };
99
+ };
100
+ }, any, import("@blocknote/core").InlineContentSchema, import("@blocknote/core").StyleSchema>;
101
+ };
102
+ bulletListItem: {
103
+ config: {
104
+ type: "bulletListItem";
105
+ content: "inline";
106
+ propSchema: {
107
+ backgroundColor: {
108
+ default: "default";
109
+ };
110
+ textColor: {
111
+ default: "default";
112
+ };
113
+ textAlignment: {
114
+ default: "left";
115
+ values: readonly ["left", "center", "right", "justify"];
116
+ };
117
+ };
118
+ };
119
+ implementation: import("@blocknote/core").TiptapBlockImplementation<{
120
+ type: "bulletListItem";
121
+ content: "inline";
122
+ propSchema: {
123
+ backgroundColor: {
124
+ default: "default";
125
+ };
126
+ textColor: {
127
+ default: "default";
128
+ };
129
+ textAlignment: {
130
+ default: "left";
131
+ values: readonly ["left", "center", "right", "justify"];
132
+ };
133
+ };
134
+ }, any, import("@blocknote/core").InlineContentSchema, import("@blocknote/core").StyleSchema>;
135
+ };
136
+ numberedListItem: {
137
+ config: {
138
+ type: "numberedListItem";
139
+ content: "inline";
140
+ propSchema: {
141
+ start: {
142
+ default: undefined;
143
+ type: "number";
144
+ };
145
+ backgroundColor: {
146
+ default: "default";
147
+ };
148
+ textColor: {
149
+ default: "default";
150
+ };
151
+ textAlignment: {
152
+ default: "left";
153
+ values: readonly ["left", "center", "right", "justify"];
154
+ };
155
+ };
156
+ };
157
+ implementation: import("@blocknote/core").TiptapBlockImplementation<{
158
+ type: "numberedListItem";
159
+ content: "inline";
160
+ propSchema: {
161
+ start: {
162
+ default: undefined;
163
+ type: "number";
164
+ };
165
+ backgroundColor: {
166
+ default: "default";
167
+ };
168
+ textColor: {
169
+ default: "default";
170
+ };
171
+ textAlignment: {
172
+ default: "left";
173
+ values: readonly ["left", "center", "right", "justify"];
174
+ };
175
+ };
176
+ }, any, import("@blocknote/core").InlineContentSchema, import("@blocknote/core").StyleSchema>;
177
+ };
178
+ checkListItem: {
179
+ config: {
180
+ type: "checkListItem";
181
+ content: "inline";
182
+ propSchema: {
183
+ checked: {
184
+ default: false;
185
+ };
186
+ backgroundColor: {
187
+ default: "default";
188
+ };
189
+ textColor: {
190
+ default: "default";
191
+ };
192
+ textAlignment: {
193
+ default: "left";
194
+ values: readonly ["left", "center", "right", "justify"];
195
+ };
196
+ };
197
+ };
198
+ implementation: import("@blocknote/core").TiptapBlockImplementation<{
199
+ type: "checkListItem";
200
+ content: "inline";
201
+ propSchema: {
202
+ checked: {
203
+ default: false;
204
+ };
205
+ backgroundColor: {
206
+ default: "default";
207
+ };
208
+ textColor: {
209
+ default: "default";
210
+ };
211
+ textAlignment: {
212
+ default: "left";
213
+ values: readonly ["left", "center", "right", "justify"];
214
+ };
215
+ };
216
+ }, any, import("@blocknote/core").InlineContentSchema, import("@blocknote/core").StyleSchema>;
217
+ };
218
+ table: {
219
+ config: {
220
+ type: "table";
221
+ content: "table";
222
+ propSchema: {
223
+ textColor: {
224
+ default: "default";
225
+ };
226
+ };
227
+ };
228
+ implementation: import("@blocknote/core").TiptapBlockImplementation<{
229
+ type: "table";
230
+ content: "table";
231
+ propSchema: {
232
+ textColor: {
233
+ default: "default";
234
+ };
235
+ };
236
+ }, any, import("@blocknote/core").InlineContentSchema, import("@blocknote/core").StyleSchema>;
237
+ };
238
+ file: {
239
+ config: {
240
+ type: "file";
241
+ propSchema: {
242
+ backgroundColor: {
243
+ default: "default";
244
+ };
245
+ name: {
246
+ default: "";
247
+ };
248
+ url: {
249
+ default: "";
250
+ };
251
+ caption: {
252
+ default: "";
253
+ };
254
+ };
255
+ content: "none";
256
+ isFileBlock: true;
257
+ };
258
+ implementation: import("@blocknote/core").TiptapBlockImplementation<{
259
+ type: "file";
260
+ propSchema: {
261
+ backgroundColor: {
262
+ default: "default";
263
+ };
264
+ name: {
265
+ default: "";
266
+ };
267
+ url: {
268
+ default: "";
269
+ };
270
+ caption: {
271
+ default: "";
272
+ };
273
+ };
274
+ content: "none";
275
+ isFileBlock: true;
276
+ }, any, import("@blocknote/core").InlineContentSchema, import("@blocknote/core").StyleSchema>;
277
+ };
278
+ image: {
279
+ config: {
280
+ type: "image";
281
+ propSchema: {
282
+ textAlignment: {
283
+ default: "left";
284
+ values: readonly ["left", "center", "right", "justify"];
285
+ };
286
+ backgroundColor: {
287
+ default: "default";
288
+ };
289
+ name: {
290
+ default: "";
291
+ };
292
+ url: {
293
+ default: "";
294
+ };
295
+ caption: {
296
+ default: "";
297
+ };
298
+ showPreview: {
299
+ default: true;
300
+ };
301
+ previewWidth: {
302
+ default: number;
303
+ };
304
+ };
305
+ content: "none";
306
+ isFileBlock: true;
307
+ fileBlockAccept: string[];
308
+ };
309
+ implementation: import("@blocknote/core").TiptapBlockImplementation<{
310
+ type: "image";
311
+ propSchema: {
312
+ textAlignment: {
313
+ default: "left";
314
+ values: readonly ["left", "center", "right", "justify"];
315
+ };
316
+ backgroundColor: {
317
+ default: "default";
318
+ };
319
+ name: {
320
+ default: "";
321
+ };
322
+ url: {
323
+ default: "";
324
+ };
325
+ caption: {
326
+ default: "";
327
+ };
328
+ showPreview: {
329
+ default: true;
330
+ };
331
+ previewWidth: {
332
+ default: number;
333
+ };
334
+ };
335
+ content: "none";
336
+ isFileBlock: true;
337
+ fileBlockAccept: string[];
338
+ }, any, import("@blocknote/core").InlineContentSchema, import("@blocknote/core").StyleSchema>;
339
+ };
340
+ video: {
341
+ config: {
342
+ type: "video";
343
+ propSchema: {
344
+ textAlignment: {
345
+ default: "left";
346
+ values: readonly ["left", "center", "right", "justify"];
347
+ };
348
+ backgroundColor: {
349
+ default: "default";
350
+ };
351
+ name: {
352
+ default: "";
353
+ };
354
+ url: {
355
+ default: "";
356
+ };
357
+ caption: {
358
+ default: "";
359
+ };
360
+ showPreview: {
361
+ default: true;
362
+ };
363
+ previewWidth: {
364
+ default: number;
365
+ };
366
+ };
367
+ content: "none";
368
+ isFileBlock: true;
369
+ fileBlockAccept: string[];
370
+ };
371
+ implementation: import("@blocknote/core").TiptapBlockImplementation<{
372
+ type: "video";
373
+ propSchema: {
374
+ textAlignment: {
375
+ default: "left";
376
+ values: readonly ["left", "center", "right", "justify"];
377
+ };
378
+ backgroundColor: {
379
+ default: "default";
380
+ };
381
+ name: {
382
+ default: "";
383
+ };
384
+ url: {
385
+ default: "";
386
+ };
387
+ caption: {
388
+ default: "";
389
+ };
390
+ showPreview: {
391
+ default: true;
392
+ };
393
+ previewWidth: {
394
+ default: number;
395
+ };
396
+ };
397
+ content: "none";
398
+ isFileBlock: true;
399
+ fileBlockAccept: string[];
400
+ }, any, import("@blocknote/core").InlineContentSchema, import("@blocknote/core").StyleSchema>;
401
+ };
402
+ audio: {
403
+ config: {
404
+ type: "audio";
405
+ propSchema: {
406
+ backgroundColor: {
407
+ default: "default";
408
+ };
409
+ name: {
410
+ default: "";
411
+ };
412
+ url: {
413
+ default: "";
414
+ };
415
+ caption: {
416
+ default: "";
417
+ };
418
+ showPreview: {
419
+ default: true;
420
+ };
421
+ };
422
+ content: "none";
423
+ isFileBlock: true;
424
+ fileBlockAccept: string[];
425
+ };
426
+ implementation: import("@blocknote/core").TiptapBlockImplementation<{
427
+ type: "audio";
428
+ propSchema: {
429
+ backgroundColor: {
430
+ default: "default";
431
+ };
432
+ name: {
433
+ default: "";
434
+ };
435
+ url: {
436
+ default: "";
437
+ };
438
+ caption: {
439
+ default: "";
440
+ };
441
+ showPreview: {
442
+ default: true;
443
+ };
444
+ };
445
+ content: "none";
446
+ isFileBlock: true;
447
+ fileBlockAccept: string[];
448
+ }, any, import("@blocknote/core").InlineContentSchema, import("@blocknote/core").StyleSchema>;
449
+ };
450
+ }> & import("@blocknote/core").BlockSchemaFromSpecs<{
451
+ pageBreak: {
452
+ config: {
453
+ type: "pageBreak";
454
+ propSchema: {};
455
+ content: "none";
456
+ isFileBlock: false;
457
+ isSelectable: false;
458
+ };
459
+ implementation: import("@blocknote/core").TiptapBlockImplementation<{
460
+ type: "pageBreak";
461
+ propSchema: {};
462
+ content: "none";
463
+ isFileBlock: false;
464
+ isSelectable: false;
465
+ }, any, import("@blocknote/core").InlineContentSchema, import("@blocknote/core").StyleSchema>;
466
+ };
467
+ }>, any, any, import("react").ReactNode, import("react").ReactNode>;
468
+ inlineContentMapping: import("@blocknote/core").InlineContentMapping<import("@blocknote/core").InlineContentSchemaFromSpecs<{
469
+ text: {
470
+ config: "text";
471
+ implementation: any;
472
+ };
473
+ link: {
474
+ config: "link";
475
+ implementation: any;
476
+ };
477
+ }>, any, JSX.Element, JSX.Element>;
478
+ styleMapping: import("@blocknote/core").StyleMapping<import("@blocknote/core").StyleSchemaFromSpecs<{
479
+ bold: {
480
+ config: {
481
+ type: string;
482
+ propSchema: "boolean";
483
+ };
484
+ implementation: import("@blocknote/core").StyleImplementation;
485
+ };
486
+ italic: {
487
+ config: {
488
+ type: string;
489
+ propSchema: "boolean";
490
+ };
491
+ implementation: import("@blocknote/core").StyleImplementation;
492
+ };
493
+ underline: {
494
+ config: {
495
+ type: string;
496
+ propSchema: "boolean";
497
+ };
498
+ implementation: import("@blocknote/core").StyleImplementation;
499
+ };
500
+ strike: {
501
+ config: {
502
+ type: string;
503
+ propSchema: "boolean";
504
+ };
505
+ implementation: import("@blocknote/core").StyleImplementation;
506
+ };
507
+ code: {
508
+ config: {
509
+ type: string;
510
+ propSchema: "boolean";
511
+ };
512
+ implementation: import("@blocknote/core").StyleImplementation;
513
+ };
514
+ textColor: {
515
+ config: {
516
+ type: string;
517
+ propSchema: "string";
518
+ };
519
+ implementation: import("@blocknote/core").StyleImplementation;
520
+ };
521
+ backgroundColor: {
522
+ config: {
523
+ type: string;
524
+ propSchema: "string";
525
+ };
526
+ implementation: import("@blocknote/core").StyleImplementation;
527
+ };
528
+ }>, Record<string, string>>;
529
+ };
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { DefaultInlineContentSchema, InlineContentMapping } from "@blocknote/core";
3
+ export declare const odtInlineContentMappingForDefaultSchema: InlineContentMapping<DefaultInlineContentSchema, any, JSX.Element, JSX.Element>;
@@ -0,0 +1,2 @@
1
+ import { DefaultStyleSchema, StyleMapping } from "@blocknote/core";
2
+ export declare const odtStyleMappingForDefaultSchema: StyleMapping<DefaultStyleSchema, Record<string, string>>;
@@ -0,0 +1,2 @@
1
+ export * from "./defaultSchema/index.js";
2
+ export * from "./odtExporter.js";
@@ -0,0 +1,28 @@
1
+ /// <reference types="react" />
2
+ import { Block, BlockNoteSchema, BlockSchema, Exporter, ExporterOptions, InlineContentSchema, StyleSchema, StyledText } from "@blocknote/core";
3
+ export declare class ODTExporter<B extends BlockSchema, S extends StyleSchema, I extends InlineContentSchema> extends Exporter<B, I, S, React.ReactNode, React.ReactNode, Record<string, string>, React.ReactNode> {
4
+ protected readonly schema: BlockNoteSchema<B, I, S>;
5
+ private automaticStyles;
6
+ private pictures;
7
+ private styleCounter;
8
+ readonly options: ExporterOptions;
9
+ constructor(schema: BlockNoteSchema<B, I, S>, mappings: Exporter<NoInfer<B>, NoInfer<I>, NoInfer<S>, React.ReactNode, React.ReactNode, Record<string, string>, React.ReactNode>["mappings"], options?: Partial<ExporterOptions>);
10
+ protected loadFonts(): Promise<{
11
+ name: string;
12
+ fileName: string;
13
+ data: Blob;
14
+ }[]>;
15
+ transformStyledText(styledText: StyledText<S>): React.ReactNode;
16
+ transformBlocks(blocks: Block<B, I, S>[], nestingLevel?: number): Promise<React.ReactNode[]>;
17
+ toODTDocument(blocks: Block<B, I, S>[], options?: {
18
+ header?: string | XMLDocument;
19
+ footer?: string | XMLDocument;
20
+ }): Promise<Blob>;
21
+ registerStyle(style: (name: string) => React.ReactNode): string;
22
+ registerPicture(url: string): Promise<{
23
+ path: string;
24
+ mimeType: string;
25
+ height: number;
26
+ width: number;
27
+ }>;
28
+ }
@@ -0,0 +1 @@
1
+ export {};