@file-viewer/core 2.2.9 → 2.3.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.
@@ -13,6 +13,12 @@ export declare const coreLiteRendererDefinitions: ({
13
13
  readonly category: "office";
14
14
  readonly extensions: readonly ["docx", "docm", "dotx", "dotm"];
15
15
  readonly async: true;
16
+ readonly supportLevel: "high-fidelity";
17
+ readonly status: "stable";
18
+ readonly packageName: "@file-viewer/renderer-word";
19
+ readonly presets: readonly ["office", "all"];
20
+ readonly containerVersions: readonly ["OOXML Transitional", "OOXML Strict"];
21
+ readonly knownLimits: readonly ["VBA is never executed"];
16
22
  readonly capabilities: {
17
23
  readonly download: true;
18
24
  readonly print: "adapter";
@@ -26,6 +32,12 @@ export declare const coreLiteRendererDefinitions: ({
26
32
  readonly category: "office";
27
33
  readonly extensions: readonly ["doc", "dot"];
28
34
  readonly async: true;
35
+ readonly supportLevel: "structured";
36
+ readonly status: "stable";
37
+ readonly packageName: "@file-viewer/renderer-word";
38
+ readonly presets: readonly ["office", "all"];
39
+ readonly containerVersions: readonly ["Word 97-2003 Binary"];
40
+ readonly knownLimits: readonly ["Macros are never executed"];
29
41
  readonly capabilities: {
30
42
  readonly download: true;
31
43
  readonly print: "adapter";
@@ -37,8 +49,14 @@ export declare const coreLiteRendererDefinitions: ({
37
49
  readonly id: "office-presentation-binary";
38
50
  readonly label: "PowerPoint 97–2003";
39
51
  readonly category: "office";
40
- readonly extensions: readonly ["ppt"];
52
+ readonly extensions: readonly ["ppt", "pot"];
41
53
  readonly async: true;
54
+ readonly supportLevel: "structured";
55
+ readonly status: "stable";
56
+ readonly packageName: "@file-viewer/renderer-presentation";
57
+ readonly presets: readonly ["office", "all"];
58
+ readonly containerVersions: readonly ["PowerPoint 97-2003 Binary"];
59
+ readonly knownLimits: readonly ["Embedded engine watermark is retained", "Macros are never executed"];
42
60
  readonly capabilities: {
43
61
  readonly download: true;
44
62
  readonly print: "adapter";
@@ -52,6 +70,12 @@ export declare const coreLiteRendererDefinitions: ({
52
70
  readonly category: "office";
53
71
  readonly extensions: readonly ["pptx", "pptm", "potx", "potm", "ppsx", "ppsm"];
54
72
  readonly async: true;
73
+ readonly supportLevel: "high-fidelity";
74
+ readonly status: "stable";
75
+ readonly packageName: "@file-viewer/renderer-presentation";
76
+ readonly presets: readonly ["office", "all"];
77
+ readonly containerVersions: readonly ["OOXML Transitional", "OOXML Strict"];
78
+ readonly knownLimits: readonly ["Macros and external programs are never executed"];
55
79
  readonly capabilities: {
56
80
  readonly download: true;
57
81
  readonly print: true;
@@ -65,6 +89,12 @@ export declare const coreLiteRendererDefinitions: ({
65
89
  readonly category: "office";
66
90
  readonly extensions: readonly ["rtf", "odt", "odp"];
67
91
  readonly async: true;
92
+ readonly supportLevel: "structured";
93
+ readonly status: "stable";
94
+ readonly packageName: "@file-viewer/renderer-word";
95
+ readonly presets: readonly ["office", "all"];
96
+ readonly containerVersions: readonly ["RTF", "OpenDocument"];
97
+ readonly knownLimits: readonly [];
68
98
  readonly capabilities: {
69
99
  readonly download: true;
70
100
  readonly print: true;
@@ -76,8 +106,109 @@ export declare const coreLiteRendererDefinitions: ({
76
106
  readonly id: "spreadsheet-openxml";
77
107
  readonly label: "Spreadsheet";
78
108
  readonly category: "office";
79
- readonly extensions: readonly ["xlsx", "xltx", "xlsm", "xlsb", "xls", "xlt", "xltm", "csv", "tsv", "ods", "fods", "numbers"];
109
+ readonly extensions: readonly ["xlsx", "xltx", "xlsm", "xlsb", "xls", "xlt", "xla", "xlam", "xltm", "csv", "tsv", "ods", "fods"];
80
110
  readonly async: true;
111
+ readonly supportLevel: "structured";
112
+ readonly status: "stable";
113
+ readonly packageName: "@file-viewer/renderer-spreadsheet";
114
+ readonly presets: readonly ["office", "all"];
115
+ readonly containerVersions: readonly ["OOXML", "BIFF", "OpenDocument", "Delimited text"];
116
+ readonly knownLimits: readonly ["VBA and add-in code are never executed", "Formula results are read from the saved workbook cache"];
117
+ readonly capabilities: {
118
+ readonly download: true;
119
+ readonly print: false;
120
+ readonly exportHtml: false;
121
+ readonly zoom: "provider";
122
+ readonly search: true;
123
+ };
124
+ } | {
125
+ readonly id: "apple-pages";
126
+ readonly label: "Apple Pages";
127
+ readonly category: "office";
128
+ readonly extensions: readonly ["pages"];
129
+ readonly async: true;
130
+ readonly supportLevel: "high-fidelity";
131
+ readonly status: "stable";
132
+ readonly packageName: "@file-viewer/renderer-iwork";
133
+ readonly presets: readonly ["office", "all"];
134
+ readonly containerVersions: readonly ["iWork '09 index.xml(.gz)", "iWork 2013+ IWA"];
135
+ readonly knownLimits: readonly ["Static preview only", "Encrypted iwpv2 files are detected but not decrypted"];
136
+ readonly capabilities: {
137
+ readonly download: true;
138
+ readonly print: "adapter";
139
+ readonly exportHtml: "adapter";
140
+ readonly zoom: "provider";
141
+ readonly search: true;
142
+ };
143
+ } | {
144
+ readonly id: "apple-numbers";
145
+ readonly label: "Apple Numbers";
146
+ readonly category: "office";
147
+ readonly extensions: readonly ["numbers"];
148
+ readonly async: true;
149
+ readonly supportLevel: "high-fidelity";
150
+ readonly status: "stable";
151
+ readonly packageName: "@file-viewer/renderer-iwork";
152
+ readonly presets: readonly ["office", "all"];
153
+ readonly containerVersions: readonly ["iWork '09 index.xml", "iWork 2013+ IWA"];
154
+ readonly knownLimits: readonly ["Formula results are read from the saved document cache", "Encrypted iwpv2 files are detected but not decrypted"];
155
+ readonly capabilities: {
156
+ readonly download: true;
157
+ readonly print: "adapter";
158
+ readonly exportHtml: "adapter";
159
+ readonly zoom: "provider";
160
+ readonly search: true;
161
+ };
162
+ } | {
163
+ readonly id: "apple-keynote";
164
+ readonly label: "Apple Keynote";
165
+ readonly category: "office";
166
+ readonly extensions: readonly ["key"];
167
+ readonly async: true;
168
+ readonly supportLevel: "high-fidelity";
169
+ readonly status: "stable";
170
+ readonly packageName: "@file-viewer/renderer-iwork";
171
+ readonly presets: readonly ["office", "all"];
172
+ readonly containerVersions: readonly ["iWork '09 index.apxl", "iWork 2013+ IWA"];
173
+ readonly knownLimits: readonly ["Animations, transitions and video playback are not executed", "Encrypted iwpv2 files are detected but not decrypted"];
174
+ readonly capabilities: {
175
+ readonly download: true;
176
+ readonly print: "adapter";
177
+ readonly exportHtml: "adapter";
178
+ readonly zoom: "provider";
179
+ readonly search: true;
180
+ };
181
+ } | {
182
+ readonly id: "office-wordperfect";
183
+ readonly label: "WordPerfect";
184
+ readonly category: "office";
185
+ readonly extensions: readonly ["wpd", "wp", "wp5", "wp6"];
186
+ readonly async: true;
187
+ readonly supportLevel: "structured";
188
+ readonly status: "stable";
189
+ readonly packageName: "@file-viewer/renderer-wordperfect";
190
+ readonly presets: readonly ["office", "all"];
191
+ readonly containerVersions: readonly ["WordPerfect 4.2", "WordPerfect 5.x", "WordPerfect 6+"];
192
+ readonly knownLimits: readonly ["Macros are never executed", ".wp5 and .wp6 are routing aliases for genuine WP5/WP6 payloads, not separate container formats", "Pagination and unsupported embedded objects are presented as structured static preview"];
193
+ readonly capabilities: {
194
+ readonly download: true;
195
+ readonly print: "adapter";
196
+ readonly exportHtml: "adapter";
197
+ readonly zoom: "provider";
198
+ readonly search: true;
199
+ };
200
+ } | {
201
+ readonly id: "spreadsheet-dbf";
202
+ readonly label: "dBASE Table";
203
+ readonly category: "office";
204
+ readonly extensions: readonly ["dbf"];
205
+ readonly async: true;
206
+ readonly supportLevel: "structured";
207
+ readonly status: "stable";
208
+ readonly packageName: "@file-viewer/renderer-spreadsheet";
209
+ readonly presets: readonly ["office", "all"];
210
+ readonly containerVersions: readonly ["dBASE III/IV", "Visual FoxPro"];
211
+ readonly knownLimits: readonly ["Missing DBT/FPT memo sidecars are reported as incomplete"];
81
212
  readonly capabilities: {
82
213
  readonly download: true;
83
214
  readonly print: false;
@@ -91,6 +222,12 @@ export declare const coreLiteRendererDefinitions: ({
91
222
  readonly category: "document";
92
223
  readonly extensions: readonly ["pdf"];
93
224
  readonly async: true;
225
+ readonly supportLevel: "high-fidelity";
226
+ readonly status: "stable";
227
+ readonly packageName: "@file-viewer/renderer-pdf";
228
+ readonly presets: readonly ["office", "all"];
229
+ readonly containerVersions: readonly ["PDF"];
230
+ readonly knownLimits: readonly [];
94
231
  readonly capabilities: {
95
232
  readonly download: true;
96
233
  readonly print: "adapter";
@@ -104,6 +241,12 @@ export declare const coreLiteRendererDefinitions: ({
104
241
  readonly category: "document";
105
242
  readonly extensions: readonly ["ofd"];
106
243
  readonly async: true;
244
+ readonly supportLevel: "structured";
245
+ readonly status: "stable";
246
+ readonly packageName: "@file-viewer/renderer-ofd";
247
+ readonly presets: readonly ["office", "all"];
248
+ readonly containerVersions: readonly ["OFD"];
249
+ readonly knownLimits: readonly [];
107
250
  readonly capabilities: {
108
251
  readonly download: true;
109
252
  readonly print: true;
@@ -111,12 +254,37 @@ export declare const coreLiteRendererDefinitions: ({
111
254
  readonly zoom: "provider";
112
255
  readonly search: true;
113
256
  };
257
+ } | {
258
+ readonly id: "office-hangul";
259
+ readonly label: "Hancom Hangul";
260
+ readonly category: "office";
261
+ readonly extensions: readonly ["hwp", "hwpx"];
262
+ readonly async: true;
263
+ readonly supportLevel: "structured";
264
+ readonly status: "stable";
265
+ readonly packageName: "@file-viewer/renderer-hangul";
266
+ readonly presets: readonly ["office", "all"];
267
+ readonly containerVersions: readonly ["HWP v5 CFB", "HWPX ZIP/XML"];
268
+ readonly knownLimits: readonly ["Encrypted, DRM-protected and distribution documents are detected but not decrypted", "Charts, OLE objects and advanced drawing effects remain limited in the static structured preview", "HWP v5 pagination is approximated when the binary producer omits usable page geometry"];
269
+ readonly capabilities: {
270
+ readonly download: true;
271
+ readonly print: "adapter";
272
+ readonly exportHtml: "adapter";
273
+ readonly zoom: "provider";
274
+ readonly search: true;
275
+ };
114
276
  } | {
115
277
  readonly id: "typst";
116
278
  readonly label: "Typst";
117
279
  readonly category: "document";
118
280
  readonly extensions: readonly ["typ", "typst"];
119
281
  readonly async: true;
282
+ readonly supportLevel: "high-fidelity";
283
+ readonly status: "stable";
284
+ readonly packageName: "@file-viewer/renderer-typst";
285
+ readonly presets: readonly ["all"];
286
+ readonly containerVersions: readonly ["Typst source"];
287
+ readonly knownLimits: readonly [];
120
288
  readonly capabilities: {
121
289
  readonly download: true;
122
290
  readonly print: "adapter";
@@ -130,6 +298,12 @@ export declare const coreLiteRendererDefinitions: ({
130
298
  readonly category: "archive";
131
299
  readonly extensions: readonly ["zip", "zipx", "7z", "rar", "tar", "gz", "gzip", "tgz", "bz2", "bzip2", "tbz", "tbz2", "xz", "txz", "lzma", "zst", "tzst", "cab", "ar", "cpio", "iso", "xar", "lha", "lzh", "jar", "war", "ear", "apk", "cbz", "cbr"];
132
300
  readonly async: true;
301
+ readonly supportLevel: "structured";
302
+ readonly status: "stable";
303
+ readonly packageName: "@file-viewer/renderer-archive";
304
+ readonly presets: readonly ["all"];
305
+ readonly containerVersions: readonly ["libarchive-supported containers"];
306
+ readonly knownLimits: readonly [];
133
307
  readonly capabilities: {
134
308
  readonly download: true;
135
309
  readonly print: false;
@@ -143,6 +317,12 @@ export declare const coreLiteRendererDefinitions: ({
143
317
  readonly category: "email";
144
318
  readonly extensions: readonly ["eml", "msg", "mbox"];
145
319
  readonly async: true;
320
+ readonly supportLevel: "structured";
321
+ readonly status: "stable";
322
+ readonly packageName: "@file-viewer/renderer-email";
323
+ readonly presets: readonly ["all"];
324
+ readonly containerVersions: readonly ["MIME", "Outlook MSG", "mbox"];
325
+ readonly knownLimits: readonly [];
146
326
  readonly capabilities: {
147
327
  readonly download: true;
148
328
  readonly print: false;
@@ -156,6 +336,12 @@ export declare const coreLiteRendererDefinitions: ({
156
336
  readonly category: "eda";
157
337
  readonly extensions: readonly ["olb", "dra", "gds", "oas", "oasis"];
158
338
  readonly async: true;
339
+ readonly supportLevel: "structured";
340
+ readonly status: "stable";
341
+ readonly packageName: "@file-viewer/renderer-eda";
342
+ readonly presets: readonly ["engineering", "all"];
343
+ readonly containerVersions: readonly ["OrCAD", "GDSII", "OASIS"];
344
+ readonly knownLimits: readonly [];
159
345
  readonly capabilities: {
160
346
  readonly download: true;
161
347
  readonly print: true;
@@ -169,6 +355,12 @@ export declare const coreLiteRendererDefinitions: ({
169
355
  readonly category: "cad";
170
356
  readonly extensions: readonly ["dxf", "dwg", "dwf", "dwfx", "xps"];
171
357
  readonly async: true;
358
+ readonly supportLevel: "high-fidelity";
359
+ readonly status: "stable";
360
+ readonly packageName: "@file-viewer/renderer-cad";
361
+ readonly presets: readonly ["engineering", "all"];
362
+ readonly containerVersions: readonly ["DWG", "DXF", "DWF", "DWFX/XPS"];
363
+ readonly knownLimits: readonly [];
172
364
  readonly capabilities: {
173
365
  readonly download: true;
174
366
  readonly print: true;
@@ -182,6 +374,12 @@ export declare const coreLiteRendererDefinitions: ({
182
374
  readonly category: "model";
183
375
  readonly extensions: readonly ["glb", "gltf", "obj", "stl", "ply", "fbx", "dae", "3ds", "3mf", "amf", "usd", "usda", "usdc", "usdz", "kmz", "step", "stp", "iges", "igs", "ifc", "3dm", "brep", "pcd", "wrl", "vrml", "xyz", "vtk", "vtp"];
184
376
  readonly async: true;
377
+ readonly supportLevel: "structured";
378
+ readonly status: "stable";
379
+ readonly packageName: "@file-viewer/renderer-3d";
380
+ readonly presets: readonly ["engineering", "all"];
381
+ readonly containerVersions: readonly ["Mesh", "CAD exchange", "scene"];
382
+ readonly knownLimits: readonly [];
185
383
  readonly capabilities: {
186
384
  readonly download: true;
187
385
  readonly print: false;
@@ -195,6 +393,12 @@ export declare const coreLiteRendererDefinitions: ({
195
393
  readonly category: "geo";
196
394
  readonly extensions: readonly ["geojson", "kml", "gpx", "shp"];
197
395
  readonly async: true;
396
+ readonly supportLevel: "structured";
397
+ readonly status: "stable";
398
+ readonly packageName: "@file-viewer/renderer-geo";
399
+ readonly presets: readonly ["engineering", "all"];
400
+ readonly containerVersions: readonly ["GeoJSON", "KML", "GPX", "Shapefile"];
401
+ readonly knownLimits: readonly [];
198
402
  readonly capabilities: {
199
403
  readonly download: true;
200
404
  readonly print: true;
@@ -208,6 +412,12 @@ export declare const coreLiteRendererDefinitions: ({
208
412
  readonly category: "drawing";
209
413
  readonly extensions: readonly ["excalidraw", "drawio", "dio", "mermaid", "mmd", "plantuml", "puml"];
210
414
  readonly async: true;
415
+ readonly supportLevel: "structured";
416
+ readonly status: "stable";
417
+ readonly packageName: "@file-viewer/renderer-drawing";
418
+ readonly presets: readonly ["all"];
419
+ readonly containerVersions: readonly ["Draw.io", "Excalidraw", "Mermaid", "PlantUML"];
420
+ readonly knownLimits: readonly [];
211
421
  readonly capabilities: {
212
422
  readonly download: true;
213
423
  readonly print: true;
@@ -221,6 +431,12 @@ export declare const coreLiteRendererDefinitions: ({
221
431
  readonly category: "mindmap";
222
432
  readonly extensions: readonly ["xmind"];
223
433
  readonly async: true;
434
+ readonly supportLevel: "structured";
435
+ readonly status: "stable";
436
+ readonly packageName: "@file-viewer/renderer-mindmap";
437
+ readonly presets: readonly ["all"];
438
+ readonly containerVersions: readonly ["XMind"];
439
+ readonly knownLimits: readonly [];
224
440
  readonly capabilities: {
225
441
  readonly download: true;
226
442
  readonly print: true;
@@ -234,6 +450,12 @@ export declare const coreLiteRendererDefinitions: ({
234
450
  readonly category: "ebook";
235
451
  readonly extensions: readonly ["epub"];
236
452
  readonly async: true;
453
+ readonly supportLevel: "high-fidelity";
454
+ readonly status: "stable";
455
+ readonly packageName: "@file-viewer/renderer-epub";
456
+ readonly presets: readonly ["all"];
457
+ readonly containerVersions: readonly ["EPUB 2", "EPUB 3"];
458
+ readonly knownLimits: readonly [];
237
459
  readonly capabilities: {
238
460
  readonly download: true;
239
461
  readonly print: false;
@@ -241,12 +463,37 @@ export declare const coreLiteRendererDefinitions: ({
241
463
  readonly zoom: false;
242
464
  readonly search: "provider";
243
465
  };
466
+ } | {
467
+ readonly id: "ebook-fb2";
468
+ readonly label: "FictionBook";
469
+ readonly category: "ebook";
470
+ readonly extensions: readonly ["fb2"];
471
+ readonly async: true;
472
+ readonly supportLevel: "structured";
473
+ readonly status: "stable";
474
+ readonly packageName: "@file-viewer/renderer-epub";
475
+ readonly presets: readonly ["all"];
476
+ readonly containerVersions: readonly ["FictionBook 2 XML"];
477
+ readonly knownLimits: readonly ["External network resources are not loaded"];
478
+ readonly capabilities: {
479
+ readonly download: true;
480
+ readonly print: true;
481
+ readonly exportHtml: true;
482
+ readonly zoom: false;
483
+ readonly search: true;
484
+ };
244
485
  } | {
245
486
  readonly id: "umd";
246
487
  readonly label: "UMD";
247
488
  readonly category: "ebook";
248
489
  readonly extensions: readonly ["umd"];
249
490
  readonly async: true;
491
+ readonly supportLevel: "structured";
492
+ readonly status: "stable";
493
+ readonly packageName: "@file-viewer/renderer-epub";
494
+ readonly presets: readonly ["all"];
495
+ readonly containerVersions: readonly ["UMD"];
496
+ readonly knownLimits: readonly [];
250
497
  readonly capabilities: {
251
498
  readonly download: true;
252
499
  readonly print: true;
@@ -260,6 +507,12 @@ export declare const coreLiteRendererDefinitions: ({
260
507
  readonly category: "image";
261
508
  readonly extensions: readonly ["gif", "jpg", "jpeg", "bmp", "tiff", "tif", "png", "svg", "webp", "avif", "ico", "heic", "heif", "jxl"];
262
509
  readonly async: true;
510
+ readonly supportLevel: "high-fidelity";
511
+ readonly status: "stable";
512
+ readonly packageName: "@file-viewer/renderer-image";
513
+ readonly presets: readonly ["lite", "all"];
514
+ readonly containerVersions: readonly ["Raster", "SVG"];
515
+ readonly knownLimits: readonly [];
263
516
  readonly capabilities: {
264
517
  readonly download: true;
265
518
  readonly print: true;
@@ -273,6 +526,12 @@ export declare const coreLiteRendererDefinitions: ({
273
526
  readonly category: "markdown";
274
527
  readonly extensions: readonly ["md", "markdown"];
275
528
  readonly async: true;
529
+ readonly supportLevel: "structured";
530
+ readonly status: "stable";
531
+ readonly packageName: "@file-viewer/renderer-text";
532
+ readonly presets: readonly ["lite", "all"];
533
+ readonly containerVersions: readonly ["CommonMark/GFM"];
534
+ readonly knownLimits: readonly [];
276
535
  readonly capabilities: {
277
536
  readonly download: true;
278
537
  readonly print: true;
@@ -286,6 +545,12 @@ export declare const coreLiteRendererDefinitions: ({
286
545
  readonly category: "code";
287
546
  readonly extensions: readonly ["txt", "json", "js", "mjs", "cjs", "css", "java", "py", "html", "htm", "jsx", "ts", "tsx", "xml", "log", "vue", "yaml", "yml", "ini", "sh", "bash", "sql", "go", "rs", "php", "c", "cpp", "cc", "h", "hpp", "cs", "diff", "patch", "bundle", "bdl", "jsonc", "json5", "ipynb", "toml", "proto", "hcl", "tex", "gv", "http", "react", "rb", "swift", "kt"];
288
547
  readonly async: true;
548
+ readonly supportLevel: "structured";
549
+ readonly status: "stable";
550
+ readonly packageName: "@file-viewer/renderer-text";
551
+ readonly presets: readonly ["lite", "all"];
552
+ readonly containerVersions: readonly ["Plain text", "source code", "Git bundle"];
553
+ readonly knownLimits: readonly [];
289
554
  readonly capabilities: {
290
555
  readonly download: true;
291
556
  readonly print: true;
@@ -299,6 +564,12 @@ export declare const coreLiteRendererDefinitions: ({
299
564
  readonly category: "media";
300
565
  readonly extensions: readonly ["mp4", "webm", "m3u8"];
301
566
  readonly async: true;
567
+ readonly supportLevel: "high-fidelity";
568
+ readonly status: "stable";
569
+ readonly packageName: "@file-viewer/renderer-media";
570
+ readonly presets: readonly ["lite", "all"];
571
+ readonly containerVersions: readonly ["Browser media"];
572
+ readonly knownLimits: readonly ["Codec support follows the browser"];
302
573
  readonly capabilities: {
303
574
  readonly download: true;
304
575
  readonly print: false;
@@ -312,6 +583,12 @@ export declare const coreLiteRendererDefinitions: ({
312
583
  readonly category: "media";
313
584
  readonly extensions: readonly ["mp3", "mpeg", "wav", "ogg", "oga", "opus", "m4a", "aac", "flac", "weba", "midi", "mid"];
314
585
  readonly async: true;
586
+ readonly supportLevel: "high-fidelity";
587
+ readonly status: "stable";
588
+ readonly packageName: "@file-viewer/renderer-media";
589
+ readonly presets: readonly ["lite", "all"];
590
+ readonly containerVersions: readonly ["Browser media", "MIDI"];
591
+ readonly knownLimits: readonly ["Codec support follows the browser"];
315
592
  readonly capabilities: {
316
593
  readonly download: true;
317
594
  readonly print: false;
@@ -325,6 +602,12 @@ export declare const coreLiteRendererDefinitions: ({
325
602
  readonly category: "asset";
326
603
  readonly extensions: readonly ["ttf", "otf", "woff", "woff2", "psd", "ai", "eps", "sqlite", "wasm", "parquet", "avro", "webarchive"];
327
604
  readonly async: true;
605
+ readonly supportLevel: "structured";
606
+ readonly status: "stable";
607
+ readonly packageName: "@file-viewer/renderer-data";
608
+ readonly presets: readonly ["all"];
609
+ readonly containerVersions: readonly ["Font", "design", "database", "binary data"];
610
+ readonly knownLimits: readonly [];
328
611
  readonly capabilities: {
329
612
  readonly download: true;
330
613
  readonly print: false;
@@ -3,6 +3,15 @@ export interface FileViewerRendererHandlerEntry<Handler> {
3
3
  rendererId: string;
4
4
  handler: Handler;
5
5
  }
6
+ /**
7
+ * Content-signature aware renderers can throw this shape when the filename
8
+ * extension points at the wrong container. The orchestration layer follows the
9
+ * redirect once, using the handler registered for the detected renderer id.
10
+ */
11
+ export interface FileViewerRendererRedirectError extends Error {
12
+ actualRendererId: string;
13
+ }
14
+ export declare const resolveFileViewerRendererRedirectId: (error: unknown) => string | undefined;
6
15
  export interface CreateFileViewerRendererDispatcherOptions<Handler> {
7
16
  registry?: RendererRegistry;
8
17
  handlers: Iterable<FileViewerRendererHandlerEntry<Handler>>;
@@ -1,6 +1,13 @@
1
1
  import { DEFAULT_RENDERER_DEFINITIONS } from '../registry/formats.js';
2
2
  import { createRendererRegistry } from '../registry/registry.js';
3
3
  import { normalizeFileExtension } from '../source/index.js';
4
+ export const resolveFileViewerRendererRedirectId = (error) => {
5
+ if (!error || typeof error !== 'object' || !('actualRendererId' in error)) {
6
+ return undefined;
7
+ }
8
+ const rendererId = String(error.actualRendererId || '').trim();
9
+ return rendererId || undefined;
10
+ };
4
11
  export const createFileViewerRendererDispatcher = ({ registry = createRendererRegistry(DEFAULT_RENDERER_DEFINITIONS), handlers, fallbackHandler, fallbackKey = 'error', }) => {
5
12
  const handlersByRendererId = Array.from(handlers).reduce((result, entry) => {
6
13
  result.set(entry.rendererId, entry.handler);
@@ -11,7 +11,7 @@ export interface ReportFileViewerRenderSessionDisposeErrorInput extends ResolveF
11
11
  onLogError?: FileViewerRenderSessionDisposeErrorLogger | null;
12
12
  }
13
13
  export interface RenderFileViewerHandlerInput<Rendered = unknown, Target extends HTMLElement = HTMLElement> {
14
- dispatcher: Pick<FileViewerRendererDispatcher<FileRenderHandler<Rendered, Target>>, 'resolve'>;
14
+ dispatcher: Pick<FileViewerRendererDispatcher<FileRenderHandler<Rendered, Target>>, 'resolve' | 'handlersByRendererId'>;
15
15
  buffer: ArrayBuffer;
16
16
  target: Target;
17
17
  type?: string;
@@ -6,6 +6,7 @@
6
6
  import { DEFAULT_RENDERER_DEFINITIONS } from '../registry/formats.js';
7
7
  import { waitForFileViewerNextPaint } from '../output/export.js';
8
8
  import { createFileViewerRendererDispatcher } from './dispatcher.js';
9
+ import { resolveFileViewerRendererRedirectId } from './dispatcher.js';
9
10
  import { createRendererRegistry } from '../registry/registry.js';
10
11
  import { getExtension, normalizeFileExtension } from '../source/index.js';
11
12
  import { applyFileViewerRenderReadinessState, } from '../source/loading.js';
@@ -489,6 +490,7 @@ export const buildFileRenderContextFromLoadContext = ({ source, surface, options
489
490
  ...renderContext,
490
491
  });
491
492
  export const renderFileViewerHandler = async ({ dispatcher, buffer, target, type = '', context, throwOnMissingHandler = false, }) => {
493
+ var _a, _b, _c;
492
494
  const normalizedType = normalizeFileExtension(type);
493
495
  const handler = dispatcher.resolve(normalizedType);
494
496
  if (!handler) {
@@ -497,7 +499,31 @@ export const renderFileViewerHandler = async ({ dispatcher, buffer, target, type
497
499
  }
498
500
  return undefined;
499
501
  }
500
- return handler(buffer, target, normalizedType, context);
502
+ try {
503
+ return await handler(buffer, target, normalizedType, context);
504
+ }
505
+ catch (error) {
506
+ const redirectedRendererId = resolveFileViewerRendererRedirectId(error);
507
+ const redirectedHandler = redirectedRendererId
508
+ ? dispatcher.handlersByRendererId.get(redirectedRendererId)
509
+ : undefined;
510
+ if (!redirectedHandler || redirectedHandler === handler) {
511
+ throw error;
512
+ }
513
+ const redirectedType = ((_a = DEFAULT_RENDERER_DEFINITIONS
514
+ .find(definition => definition.id === redirectedRendererId)) === null || _a === void 0 ? void 0 : _a.extensions[0]) || normalizedType;
515
+ (_c = (_b = context === null || context === void 0 ? void 0 : context.options) === null || _b === void 0 ? void 0 : _b.onDiagnostic) === null || _c === void 0 ? void 0 : _c.call(_b, {
516
+ code: 'renderer-content-signature-redirect',
517
+ level: 'warning',
518
+ message: `File extension .${normalizedType} contains the ${redirectedRendererId} container and was routed as .${redirectedType}.`,
519
+ detail: {
520
+ declaredExtension: normalizedType,
521
+ detectedRendererId: redirectedRendererId,
522
+ routedExtension: redirectedType,
523
+ },
524
+ });
525
+ return await redirectedHandler(buffer, target, redirectedType, context);
526
+ }
501
527
  };
502
528
  export const createFileRenderHandlerLoader = ({ handler, rendererId, getTarget = context => context.surface.container, createContext = buildFileRenderContextFromLoadContext, destroy, }) => {
503
529
  return async (context) => {
@@ -552,7 +578,14 @@ export const createFileRenderHandlerRegistry = ({ definitions = DEFAULT_RENDERER
552
578
  return {
553
579
  ...definition,
554
580
  load: createFileRenderHandlerLoader({
555
- handler,
581
+ handler: (buffer, target, type, context) => renderFileViewerHandler({
582
+ dispatcher,
583
+ buffer,
584
+ target,
585
+ type,
586
+ context,
587
+ throwOnMissingHandler: true,
588
+ }),
556
589
  rendererId: definition.id,
557
590
  getTarget,
558
591
  createContext,
@@ -1,4 +1,6 @@
1
1
  import type { FileViewerFileRef, FileViewerSource, NormalizedFileViewerSource } from '../contracts/types';
2
+ export { createFileViewerTextDecoder, decodeFileViewerTextBuffer, isValidFileViewerUtf8, resolveFileViewerTextEncoding, } from './textEncoding';
3
+ export type { DecodedFileViewerText, FileViewerTextEncoding, ResolvedFileViewerTextEncoding, ResolvedFileViewerTextSource, } from './textEncoding';
2
4
  export type FileViewerReadResult = string | ArrayBuffer | undefined | null;
3
5
  export declare const DEFAULT_FILE_VIEWER_SOURCE_FILENAME = "preview.bin";
4
6
  export declare const normalizeFileExtension: (extension: string) => string;
@@ -1,3 +1,4 @@
1
+ export { createFileViewerTextDecoder, decodeFileViewerTextBuffer, isValidFileViewerUtf8, resolveFileViewerTextEncoding, } from './textEncoding.js';
1
2
  export const DEFAULT_FILE_VIEWER_SOURCE_FILENAME = 'preview.bin';
2
3
  export const normalizeFileExtension = (extension) => {
3
4
  return extension.trim().replace(/^\./, '').toLowerCase();
@@ -0,0 +1,14 @@
1
+ export type FileViewerTextEncoding = 'auto' | 'utf-8' | 'utf-16le' | 'utf-16be' | 'gbk' | 'gb18030';
2
+ export type ResolvedFileViewerTextEncoding = Exclude<FileViewerTextEncoding, 'auto' | 'gbk'>;
3
+ export interface DecodedFileViewerText {
4
+ text: string;
5
+ encoding: ResolvedFileViewerTextEncoding;
6
+ }
7
+ export interface ResolvedFileViewerTextSource {
8
+ encoding: ResolvedFileViewerTextEncoding;
9
+ bomLength: number;
10
+ }
11
+ export declare const isValidFileViewerUtf8: (bytes: Uint8Array) => boolean;
12
+ export declare const resolveFileViewerTextEncoding: (bytes: Uint8Array, encoding?: FileViewerTextEncoding | string) => ResolvedFileViewerTextSource;
13
+ export declare const createFileViewerTextDecoder: (encoding: ResolvedFileViewerTextEncoding) => TextDecoder;
14
+ export declare const decodeFileViewerTextBuffer: (data: ArrayBuffer, encoding?: FileViewerTextEncoding | string) => DecodedFileViewerText;