@file-viewer/core 3.1.2 → 3.2.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.
Files changed (103) hide show
  1. package/README.en.md +3 -121
  2. package/README.md +3 -126
  3. package/dist/assets.d.ts +2 -2
  4. package/dist/assets.js +1 -5
  5. package/dist/browser/controller.d.ts +1 -2
  6. package/dist/browser/controller.js +2 -34
  7. package/dist/browser.d.ts +2 -2
  8. package/dist/browser.js +2 -2
  9. package/dist/config/options.d.ts +1 -1
  10. package/dist/contracts/types.d.ts +26 -423
  11. package/dist/contracts/xml.d.ts +0 -11
  12. package/dist/export.d.ts +3 -10
  13. package/dist/export.js +2 -9
  14. package/dist/exportDocument.d.ts +1 -12
  15. package/dist/exportDocument.js +7 -31
  16. package/dist/features/document/dom/anchors.d.ts +1 -1
  17. package/dist/features/document/dom/index.d.ts +5 -5
  18. package/dist/features/document/dom/index.js +3 -3
  19. package/dist/features/document/dom/providers.d.ts +1 -1
  20. package/dist/features/document/events.d.ts +2 -2
  21. package/dist/features/document/events.js +3 -3
  22. package/dist/features/document/fit.d.ts +1 -1
  23. package/dist/features/document/fit.js +1 -1
  24. package/dist/features/document/model.d.ts +1 -1
  25. package/dist/features/document/search.d.ts +1 -1
  26. package/dist/features/document/search.js +2 -2
  27. package/dist/features/document/viewState.d.ts +1 -1
  28. package/dist/features/document/viewState.js +2 -2
  29. package/dist/features/document/zoom.d.ts +3 -2
  30. package/dist/features/document/zoom.js +19 -3
  31. package/dist/features/document/zoomGestures.d.ts +11 -0
  32. package/dist/features/document/zoomGestures.js +111 -0
  33. package/dist/features/printMask.d.ts +1 -1
  34. package/dist/features/printMaskDesigner.d.ts +2 -6
  35. package/dist/features/printMaskDesigner.js +2 -11
  36. package/dist/features/printMaskLoader.d.ts +1 -7
  37. package/dist/features/printMaskLoader.js +1 -7
  38. package/dist/features/watermark.d.ts +1 -1
  39. package/dist/headless.d.ts +29 -29
  40. package/dist/headless.js +16 -21
  41. package/dist/i18n/messages.d.ts +1 -1
  42. package/dist/i18n/messages.de.d.ts +1 -5
  43. package/dist/i18n/messages.de.js +0 -4
  44. package/dist/i18n/messages.ja.d.ts +1 -6
  45. package/dist/i18n/messages.ja.js +0 -5
  46. package/dist/i18n/messages.js +2 -2
  47. package/dist/index.d.ts +74 -74
  48. package/dist/index.js +37 -37
  49. package/dist/lifecycle/facade.d.ts +4 -4
  50. package/dist/lifecycle/facade.js +2 -2
  51. package/dist/lifecycle/operations.d.ts +4 -4
  52. package/dist/lifecycle/operations.js +4 -9
  53. package/dist/output/canvasImage.d.ts +1 -2
  54. package/dist/output/canvasImage.js +1 -4
  55. package/dist/output/export.d.ts +2 -4
  56. package/dist/output/export.js +133 -81
  57. package/dist/output/printLayout.d.ts +2 -5
  58. package/dist/output/printLayout.js +37 -9
  59. package/dist/output/snapshotDownload.d.ts +1 -2
  60. package/dist/output/snapshotDownload.js +2 -3
  61. package/dist/platform/assets.d.ts +9 -16
  62. package/dist/platform/assets.js +60 -17
  63. package/dist/platform/copiedAssets.d.ts +0 -1
  64. package/dist/platform/copiedAssets.js +1 -2
  65. package/dist/presentation/state.d.ts +1 -1
  66. package/dist/presentation/state.js +3 -3
  67. package/dist/print-mask.d.ts +2 -2
  68. package/dist/print-mask.js +1 -1
  69. package/dist/registry/capabilities.d.ts +3 -16
  70. package/dist/registry/capabilities.js +2 -15
  71. package/dist/registry/formats.d.ts +5 -5
  72. package/dist/registry/formats.generated.d.ts +7 -8
  73. package/dist/registry/formats.generated.js +7 -4
  74. package/dist/registry/formats.js +2 -2
  75. package/dist/registry/registry.d.ts +6 -15
  76. package/dist/registry/registry.js +24 -10
  77. package/dist/renderers/image.d.ts +1 -1
  78. package/dist/renderers/image.js +26 -5
  79. package/dist/renderers/index.d.ts +11 -11
  80. package/dist/renderers/index.js +5 -11
  81. package/dist/rendering/dispatcher.d.ts +1 -6
  82. package/dist/rendering/dispatcher.js +3 -3
  83. package/dist/rendering/handler.d.ts +10 -15
  84. package/dist/rendering/handler.js +20 -27
  85. package/dist/security/svgResources.d.ts +0 -10
  86. package/dist/security/svgResources.js +2 -11
  87. package/dist/source/index.d.ts +3 -3
  88. package/dist/source/index.js +1 -1
  89. package/dist/source/loading.d.ts +56 -15
  90. package/dist/source/loading.js +177 -87
  91. package/dist/source/precheck.d.ts +1 -13
  92. package/dist/source/precheck.js +2 -9
  93. package/dist/source/textEncoding.d.ts +6 -3
  94. package/dist/source/textEncoding.js +58 -8
  95. package/dist/viewer/createViewer.d.ts +1 -1
  96. package/dist/viewer/createViewer.js +103 -33
  97. package/dist/viewer/loading.d.ts +2 -6
  98. package/dist/viewer/loading.js +1 -9
  99. package/dist/viewer/operations.d.ts +3 -3
  100. package/dist/viewer/operations.js +6 -14
  101. package/dist/viewer/state.d.ts +2 -6
  102. package/dist/viewer/state.js +3 -8
  103. package/package.json +127 -19
@@ -1,4 +1,4 @@
1
- import type { FileViewerXmlOptions } from './xml';
1
+ import type { FileViewerXmlOptions } from "./xml.js";
2
2
  export type FileViewerSourceKind = 'file' | 'url' | 'buffer' | 'empty';
3
3
  export type FileViewerThemeMode = 'light' | 'dark' | 'system';
4
4
  export type FileViewerResolvedThemeMode = Exclude<FileViewerThemeMode, 'system'>;
@@ -50,13 +50,9 @@ export interface FileViewerToolbarOptions {
50
50
  exportHtml?: boolean;
51
51
  zoom?: boolean;
52
52
  search?: boolean;
53
- /** Shows a manual light/dark mode toggle without changing the host page theme. */
54
53
  theme?: boolean;
55
- /** Built-in toolbar group order. Missing entries keep their default relative order. */
56
54
  order?: FileViewerToolbarItem[];
57
- /** Controls which built-in toolbar actions are displayed without disabling controller APIs. */
58
55
  items?: FileViewerToolbarActionMap;
59
- /** Hard operation permission map. False values block both built-in toolbar and public API calls. */
60
56
  permissions?: FileViewerToolbarActionMap;
61
57
  position?: FileViewerToolbarPosition;
62
58
  beforeOperation?: FileViewerBeforeOperation;
@@ -75,10 +71,6 @@ export interface FileViewerArchiveEntryActionContext {
75
71
  }
76
72
  export type FileViewerArchiveEntryActionPolicy = boolean | ((entry: FileViewerArchiveEntryActionContext) => boolean);
77
73
  export interface FileViewerArchiveEntryActionsOptions {
78
- /**
79
- * Controls the download button for files opened from inside an archive.
80
- * The viewer-level original-file download remains controlled by toolbar options.
81
- */
82
74
  download?: FileViewerArchiveEntryActionPolicy;
83
75
  }
84
76
  export interface FileViewerArchiveOptions {
@@ -89,40 +81,20 @@ export interface FileViewerArchiveOptions {
89
81
  maxArchiveSize?: number;
90
82
  maxEntryPreviewSize?: number;
91
83
  entryActions?: FileViewerArchiveEntryActionsOptions;
92
- /**
93
- * Optional archive password. It is used for the first encrypted archive
94
- * attempt; if it is wrong, the built-in password dialog or requestPassword
95
- * callback can still ask the user for a replacement.
96
- */
97
84
  password?: string;
98
- /**
99
- * Custom password request hook for encrypted archives. Return a string to
100
- * continue, or null/undefined to cancel and surface a friendly error.
101
- */
102
85
  requestPassword?: (context: FileViewerArchivePasswordRequestContext) => string | null | undefined | Promise<string | null | undefined>;
103
86
  }
104
87
  export interface FileViewerChmOptions {
105
- /** Self-hosted module Worker that owns all untrusted CHM parsing and decompression. */
106
88
  workerUrl?: string | URL;
107
- /** Self-hosted wasm-bindgen JavaScript module loaded by the CHM Worker. */
108
89
  wasmModuleUrl?: string | URL;
109
- /** Self-hosted Rust WebAssembly binary loaded by the CHM Worker. */
110
90
  wasmUrl?: string | URL;
111
- /** Maximum time for an individual Worker request. Defaults to 60 seconds. */
112
91
  workerTimeoutMs?: number;
113
- /** Maximum accepted CHM input size. Defaults to 320 MiB. */
114
92
  maxArchiveBytes?: number;
115
- /** Maximum number of virtual files accepted from one CHM. Defaults to 50,000. */
116
93
  maxEntries?: number;
117
- /** Maximum uncompressed size of one virtual file. Defaults to 32 MiB. */
118
94
  maxEntryBytes?: number;
119
- /** Maximum total unique decoded content exposed by the parser. Defaults to 512 MiB. */
120
95
  maxTotalDecompressedBytes?: number;
121
- /** Maximum HTML topic size. Defaults to 16 MiB. */
122
96
  maxHtmlBytes?: number;
123
- /** Maximum topic count scanned by the built-in search. Defaults to 10,000. */
124
97
  maxSearchTopics?: number;
125
- /** Maximum built-in search result count. Defaults to 200. */
126
98
  maxSearchResults?: number;
127
99
  }
128
100
  export type FileViewerArchivePasswordRequestReason = 'encrypted' | 'invalid-password' | 'read-failed' | 'extract-failed';
@@ -134,84 +106,49 @@ export interface FileViewerArchivePasswordRequestContext {
134
106
  error?: unknown;
135
107
  }
136
108
  export interface FileViewerPdfOptions {
109
+ handTool?: boolean;
137
110
  toolbar?: boolean;
138
111
  navigation?: boolean;
139
112
  defaultNavigationVisible?: boolean;
140
113
  thumbnails?: boolean;
141
114
  rotation?: number;
142
- /**
143
- * Highlights and focuses one or more PDF regions after the document loads.
144
- * Use `pixel` with `sourceWidth` / `sourceHeight` for OCR coordinates, or
145
- * `pdf-point` for native PDF coordinates. Page numbers are one-based.
146
- */
147
115
  bbox?: FileViewerPdfBoundingBox | readonly FileViewerPdfBoundingBox[];
148
- /**
149
- * Initial PDF view position. Prefer the top-level `initialViewState` when the
150
- * same state should be passed through framework-neutral viewer APIs.
151
- */
152
116
  initialViewState?: FileViewerViewState;
153
117
  streaming?: boolean | 'same-origin';
154
118
  rangeChunkSize?: number;
155
119
  withCredentials?: boolean;
156
- /**
157
- * Base URL for the self-hosted PDF worker, cMaps, WASM, standard fonts, and
158
- * CJK fallback fonts. Useful for SPA routes whose document URL is deeper
159
- * than the deployment public path, for example `/workspace/c/`.
160
- */
161
120
  assetBaseUrl?: string | URL;
162
121
  workerUrl?: string;
163
122
  cMapUrl?: string;
164
123
  wasmUrl?: string;
165
124
  standardFontDataUrl?: string;
166
- /**
167
- * Enables the self-hosted CJK fallback used when a PDF references a font
168
- * such as Microsoft YaHei without embedding the font data. Defaults to true.
169
- */
170
125
  cjkFontFallback?: boolean;
171
- /**
172
- * Repairs malformed Identity-H/V CJK fonts that omit ToUnicode when the PDF
173
- * also embeds a usable same-family TrueType cmap. Defaults to true. The
174
- * repair is applied only to the in-memory preview and never changes the
175
- * original file used by download operations.
176
- */
177
126
  identityFontRepair?: boolean;
178
- /**
179
- * Directory containing `noto-sans-sc.css`, its `files/` font shards, and
180
- * the bundled font license. The path is resolved against the document base.
181
- */
182
127
  cjkFontFallbackPath?: string;
183
128
  }
184
129
  export type FileViewerPdfBoundingBoxUnit = 'ratio' | 'percent' | 'pixel' | 'pdf-point';
185
130
  export type FileViewerPdfBoundingBoxOrigin = 'top-left' | 'bottom-left';
186
131
  export interface FileViewerPdfBoundingBox {
187
132
  id?: string;
188
- /** One-based PDF page number. Defaults to the current page, then page 1. */
189
133
  page?: number;
190
134
  x: number;
191
135
  y: number;
192
136
  width: number;
193
137
  height: number;
194
- /** Defaults to `pdf-point`. */
195
138
  unit?: FileViewerPdfBoundingBoxUnit;
196
- /** Defaults to `bottom-left` for PDF points and `top-left` otherwise. */
197
139
  origin?: FileViewerPdfBoundingBoxOrigin;
198
- /** Required when `unit` is `pixel`; this is the OCR/source image width. */
199
140
  sourceWidth?: number;
200
- /** Required when `unit` is `pixel`; this is the OCR/source image height. */
201
141
  sourceHeight?: number;
202
- /** CSS color used for the outline and translucent fill. */
203
142
  color?: string;
204
- /** Optional accessible description for the highlighted region. */
205
143
  label?: string;
206
144
  }
207
145
  export interface FileViewerDocxOptions {
208
- /** DOC/DOCX 默认保留插入和删除修订;final 显示定稿,original 显示修订前原稿。 */
146
+ exposeDisplayTargets?: boolean;
209
147
  reviewMode?: 'all' | 'final' | 'original';
210
148
  worker?: boolean;
211
149
  workerUrl?: string;
212
150
  workerJsZipUrl?: string;
213
151
  progressive?: boolean;
214
- /** 默认 false,使用连续流式阅读;设为 true 时才启用 DOCX 页式预览。 */
215
152
  visualPagination?: boolean;
216
153
  workerTimeout?: number;
217
154
  renderPageBatchSize?: number;
@@ -224,41 +161,27 @@ export interface FileViewerDocxOptions {
224
161
  updatePageReferences?: boolean;
225
162
  hideWebHiddenContent?: boolean;
226
163
  ignoreLastRenderedPageBreak?: boolean;
227
- /** External DOC/DOCX/RTF links are blocked by default; internal bookmark links remain active. */
164
+ renderAltChunks?: boolean;
228
165
  externalLinkPolicy?: 'allow' | 'block';
229
- /** Linked DOC/DOCX/RTF image resources are blocked by default; embedded images remain available. */
230
166
  externalResourcePolicy?: 'allow' | 'block';
231
- /** Overrides automatic DOCX dark rendering derived from the viewer theme. */
232
167
  darkMode?: boolean;
233
168
  }
234
169
  export interface FileViewerSpreadsheetOptions {
235
170
  worker?: boolean | 'auto';
236
171
  workerUrl?: string;
237
- /** `worker: 'auto'` 时,大于该字节数的表格自动使用静态 Worker,默认 1MB。 */
238
172
  workerAutoThreshold?: number;
239
- /**
240
- * CSV / TSV 文本编码。默认 `auto`:优先 UTF-8 BOM 和严格 UTF-8,
241
- * 否则使用浏览器内置 GB18030 解码器(同时覆盖 GBK)。
242
- */
243
173
  textEncoding?: 'auto' | 'utf-8' | 'gbk' | 'gb18030';
244
- /** 允许用户在 Excel / CSV / ODS 预览中拖拽表头边界调整列宽,默认关闭以保持历史行为。 */
245
174
  resizableColumns?: boolean;
246
- /** 允许用户在 Excel / CSV / ODS 预览中拖拽行头边界调整行高,默认关闭以保持历史行为。 */
247
175
  resizableRows?: boolean;
176
+ fillViewport?: boolean;
248
177
  }
249
178
  export interface FileViewerPresentationOptions {
250
- /** PPTX/OpenXML Worker URL. This is independent from the binary-PPT Worker. */
251
179
  workerUrl?: string | URL;
252
180
  workerType?: WorkerType;
253
- /** Optional self-hosted native WASM URL used only by the PowerPoint 97–2003 renderer. */
254
181
  pptWasmUrl?: string | URL;
255
- /** Optional self-hosted CJK font-pack URL used only by the PowerPoint 97–2003 renderer. */
256
182
  pptFontUrl?: string | URL;
257
- /** Optional module Worker URL used only by the PowerPoint 97–2003 renderer. */
258
183
  pptWorkerUrl?: string | URL;
259
- /** Selects the binary-PPT Worker path. Defaults to `auto`. */
260
184
  pptWorker?: boolean | 'auto';
261
- /** Controls the binary-PPT bounded IndexedDB frame cache. */
262
185
  pptCache?: false | {
263
186
  enabled?: boolean;
264
187
  dbName?: string;
@@ -266,63 +189,36 @@ export interface FileViewerPresentationOptions {
266
189
  maxEntries?: number;
267
190
  maxEntryBytes?: number;
268
191
  };
269
- /** Render and retain only binary-PPT slides near the viewport. Defaults to true. */
270
192
  pptVirtualize?: boolean;
271
- /** IntersectionObserver overscan for binary-PPT virtualization. Defaults to `150% 0px`. */
272
193
  pptVirtualRootMargin?: string;
273
- /** Delay before an offscreen binary-PPT canvas is cached and released. Defaults to 1200ms. */
274
194
  pptReleaseDelayMs?: number;
275
- /**
276
- * Optional ESM entry override for `@file-viewer/ppt`.
277
- * Full packages and the CDN/IIFE distribution provide a packaged default.
278
- */
279
195
  pptModuleUrl?: string | URL;
280
196
  }
281
197
  export type FileViewerIworkEmbeddedPreviewMode = 'never' | 'loading' | 'fallback';
282
198
  export interface FileViewerIworkOptions {
283
- /** Self-hosted module Worker used for ZIP, Snappy, IWA/Protobuf and iWork '09 XML parsing. */
284
199
  workerUrl?: string | URL;
285
- /** Defaults to true. Disable only in environments without Worker support. */
286
200
  useWorker?: boolean;
287
- /** Maximum parse time before the Worker is terminated. Defaults to 60 seconds. */
288
201
  workerTimeoutMs?: number;
289
- /** Maximum total bytes produced while inflating the outer container and Index.zip. Defaults to 256 MiB. */
290
202
  maxUncompressedBytes?: number;
291
- /** Maximum accepted ZIP compression ratio for a single entry. Defaults to 200. */
292
203
  maxCompressionRatio?: number;
293
- /** Maximum decoded IWA archive/object count. Defaults to 250,000. */
294
204
  maxObjects?: number;
295
- /** Maximum decoded image pixels for one media resource. Defaults to 80 megapixels. */
296
205
  maxImagePixels?: number;
297
- /** Maximum normalized scene/object nesting depth. Defaults to 128. */
298
206
  maxNestingDepth?: number;
299
- /** Embedded Quick Look images are loading placeholders or explicit parse-failure fallbacks, never fidelity evidence. */
300
207
  embeddedPreview?: FileViewerIworkEmbeddedPreviewMode;
301
208
  }
302
209
  export interface FileViewerWordPerfectOptions {
303
- /** Self-hosted Worker that owns WordPerfect signature detection and parsing. */
304
210
  workerUrl?: string | URL;
305
- /** Self-hosted libwpd/librevenge WebAssembly module. */
306
211
  wasmUrl?: string | URL;
307
- /** Defaults to true. */
308
212
  useWorker?: boolean;
309
- /** Maximum parser time before the Worker is terminated. Defaults to 60 seconds. */
310
213
  workerTimeoutMs?: number;
311
214
  }
312
215
  export interface FileViewerHangulOptions {
313
- /** Self-hosted module Worker used for bounded HWP v5 CFB and HWPX ZIP/XML parsing. */
314
216
  workerUrl?: string | URL;
315
- /** Defaults to true. Disable only in environments without Worker support. */
316
217
  useWorker?: boolean;
317
- /** Maximum parser time before the Worker is terminated. Defaults to 60 seconds. */
318
218
  workerTimeoutMs?: number;
319
- /** Maximum total uncompressed HWPX entry bytes or individual HWP stream bytes. Defaults to 256 MiB. */
320
219
  maxUncompressedBytes?: number;
321
- /** Maximum accepted HWPX ZIP compression ratio for a single entry. Defaults to 200. */
322
220
  maxCompressionRatio?: number;
323
- /** Maximum HWPX ZIP entry count. Defaults to 25,000. */
324
221
  maxEntries?: number;
325
- /** Maximum HWP record count decoded across one stream. Defaults to 250,000. */
326
222
  maxRecords?: number;
327
223
  }
328
224
  export type FileRenderExportMode = 'export' | 'print';
@@ -339,13 +235,9 @@ export interface FileViewerThumbnailCaptureOptions {
339
235
  signal?: AbortSignal;
340
236
  }
341
237
  export interface FileRenderThumbnailAdapter {
342
- /** Prepare lazy content immediately before capture. */
343
238
  beforeCapture?: (options: FileViewerThumbnailCaptureOptions) => void | Promise<void>;
344
- /** Identifies a capture result that comes from packaged metadata rather than rendered content. */
345
239
  captureSource?: 'embedded' | 'rendered';
346
- /** A renderer-native fast path. Returning null delegates to the DOM fallback. */
347
240
  capture?: (options: FileViewerThumbnailCaptureOptions) => Blob | null | Promise<Blob | null>;
348
- /** The first page/slide/sheet/cover element used by the DOM fallback. */
349
241
  getTarget?: (options: FileViewerThumbnailCaptureOptions) => Element | null | Promise<Element | null>;
350
242
  }
351
243
  export interface FileRenderExportOptions {
@@ -357,7 +249,6 @@ export interface FileRenderExportAdapter {
357
249
  exportHtml?: boolean;
358
250
  includeDocumentStyles?: boolean;
359
251
  beforeSnapshot?: () => Promise<void> | void;
360
- /** Live page surfaces used by the interactive print-mask designer. */
361
252
  getPrintMaskPages?: () => readonly HTMLElement[];
362
253
  printStyle?: string | ((options: FileRenderExportOptions) => Promise<string> | string);
363
254
  toHtml?: (options: FileRenderExportOptions) => Promise<string> | string;
@@ -366,15 +257,13 @@ export interface FileRenderContext {
366
257
  filename?: string;
367
258
  url?: string;
368
259
  streamUrl?: string;
369
- /** Original browser File retained for renderers that support Blob-backed random access. */
370
- sourceFile?: File;
260
+ sourceFile?: File | Blob;
371
261
  signal?: AbortSignal;
372
262
  options?: FileViewerOptions;
373
263
  surface?: RenderSurface;
374
264
  registerExportAdapter?: (adapter: FileRenderExportAdapter | null) => void;
375
265
  registerThumbnailAdapter?: (adapter: FileRenderThumbnailAdapter | null) => void;
376
266
  renderPurpose?: FileViewerRenderPurpose;
377
- /** Derived-image download, guarded by the owning viewer's permissions, hooks and request version. */
378
267
  requestSnapshotDownload?: (create: (watermark: FileViewerOptions['watermark']) => Promise<{
379
268
  blob: Blob;
380
269
  filename: string;
@@ -387,13 +276,6 @@ export interface FileRenderHandlerComposite<Rendered = unknown, Target extends H
387
276
  accepts: Array<string>;
388
277
  handler: FileRenderHandler<Rendered, Target>;
389
278
  }
390
- /**
391
- * Framework-neutral instance returned by a renderer after it mounts content.
392
- *
393
- * Vue, React legacy, Web Components or imperative renderers may expose different
394
- * teardown names, but wrappers can share this single contract when bridging old
395
- * renderer handlers into the core registry.
396
- */
397
279
  export type FileViewerRenderedInstance = {
398
280
  $el?: Node;
399
281
  unmount: () => void | Promise<void>;
@@ -412,15 +294,10 @@ export interface FileViewerTypstOptions {
412
294
  }
413
295
  export type FileViewerModelLinearUnit = 'millimeter' | 'centimeter' | 'meter' | 'inch' | 'foot';
414
296
  export interface FileViewerModelOptions {
415
- /** Self-hosted worker that keeps STEP/IGES/BREP tessellation off the UI thread. */
416
297
  workerUrl?: string;
417
- /** Self-hosted occt-import-js runtime loaded by the classic worker. */
418
298
  runtimeUrl?: string;
419
- /** Self-hosted OpenCascade WebAssembly module used by the model renderer. */
420
299
  wasmUrl?: string;
421
- /** Disable only when Worker is unavailable or a host deliberately accepts main-thread parsing. */
422
300
  useWorker?: boolean;
423
- /** Maximum time allowed for geometry-kernel initialization and tessellation. Defaults to 120 seconds. */
424
301
  workerTimeoutMs?: number;
425
302
  linearUnit?: FileViewerModelLinearUnit;
426
303
  linearDeflectionType?: 'bounding_box_ratio' | 'absolute_value';
@@ -430,21 +307,14 @@ export interface FileViewerModelOptions {
430
307
  export interface FileViewerDataOptions {
431
308
  sqlWasmUrl?: string;
432
309
  }
433
- /** Limits for the explicit, read-only binary inspector renderer. */
434
310
  export interface FileViewerBinaryInspectorOptions {
435
- /** Whole-input ceiling before the renderer copies bytes into its Worker. Defaults to 16 MiB. */
436
311
  maxFileBytes?: number;
437
- /** Maximum time allowed for one structure-template pass. Defaults to 5 seconds. */
438
312
  maxParseMilliseconds?: number;
439
- /** Maximum structure nodes returned from the Worker. Defaults to 512. */
440
313
  maxStructureNodes?: number;
441
- /** Maximum structure-tree nesting depth. Defaults to 16. */
442
314
  maxStructureDepth?: number;
443
- /** Maximum decoded string bytes in one displayed field. Defaults to 4 KiB. */
444
315
  maxStringBytes?: number;
445
316
  }
446
317
  export type FileViewerIllustratorMode = 'auto' | 'pdf' | 'native';
447
- /** Resource budgets forwarded to the standalone illustrator-pgf Worker. */
448
318
  export interface FileViewerIllustratorLimits {
449
319
  maxFileBytes: number;
450
320
  maxDecodedBytes: number;
@@ -482,85 +352,45 @@ export interface FileViewerIllustratorResourceResolver {
482
352
  resolve(reference: FileViewerIllustratorResourceReference, signal: AbortSignal): Promise<ArrayBuffer | null>;
483
353
  }
484
354
  export interface FileViewerDesignOptions {
485
- /** Illustrator routing: PDF-compatible surface, native PGF scene, or safe automatic fallback. */
486
355
  illustratorMode?: FileViewerIllustratorMode;
487
- /** Self-hosted module Worker that runs the standalone illustrator-pgf parser and renderer. */
488
356
  illustratorWorkerUrl?: string | URL;
489
- /** Resource budgets forwarded to illustrator-pgf. Defaults to the SDK's bounded limits. */
490
357
  illustratorLimits?: Partial<FileViewerIllustratorLimits>;
491
- /** Optional host font resolver used only by the native Illustrator session. */
492
358
  illustratorFontResolver?: FileViewerIllustratorFontResolver;
493
- /** Optional host linked/embedded resource resolver used only by the native Illustrator session. */
494
359
  illustratorResourceResolver?: FileViewerIllustratorResourceResolver;
495
- /** Self-hosted module Worker used for heavy Adobe document parsing and pixel synthesis. */
496
360
  workerUrl?: string | URL;
497
- /** Self-hosted module Worker used for bounded FLA/XFL, XD, INDD/INDT, ICML/IDMS/INX, ASE, and ACO parsing. */
498
361
  containerWorkerUrl?: string | URL;
499
- /** Self-hosted module Worker used for ABR/CSH/PAT/GRD/ASL resource parsing. */
500
362
  adobeResourceWorkerUrl?: string | URL;
501
- /** Self-hosted module Worker that runs the bounded EPS/PostScript interpreter. */
502
363
  postscriptWorkerUrl?: string | URL;
503
- /** Self-hosted, license-safe Stet WebAssembly binary used only inside the PostScript Worker. */
504
364
  postscriptWasmUrl?: string | URL;
505
- /** Defaults to true. Disable only when Worker is unavailable. */
506
365
  useWorker?: boolean;
507
- /** Maximum parser time before the Worker is terminated. Defaults to 60 seconds. */
508
366
  workerTimeoutMs?: number;
509
- /** Base EPS/PostScript rasterization density. Defaults to 96 DPI. */
510
367
  postscriptRenderDpi?: number;
511
- /** Maximum pages produced by one EPS/PostScript program. Defaults to 100. */
512
368
  postscriptMaxPages?: number;
513
- /** Maximum source width or height reported by a PostScript page. Defaults to 100,000 units. */
514
369
  postscriptMaxSourceDimension?: number;
515
- /** Maximum PostScript virtual-machine allocation. Defaults to 256 MiB. */
516
370
  postscriptMaxVmBytes?: number;
517
- /** Maximum PostScript print working set across visible, cached, transient, and print RGBA canvases. Defaults to 128 MiB. */
518
371
  postscriptMaxPrintBytes?: number;
519
- /** Self-hosted module Worker used by the high-fidelity IDML page renderer. */
520
372
  idmlWorkerUrl?: string | URL;
521
- /** Self-hosted @paged-media/introspect-wasm binary used only inside the IDML Worker. */
522
373
  idmlWasmUrl?: string | URL;
523
- /** Base rasterization density for IDML pages. Defaults to 96 DPI. */
524
374
  idmlRenderDpi?: number;
525
- /** Maximum IDML ZIP entry count. Defaults to 20,000. */
526
375
  idmlMaxEntries?: number;
527
- /** Maximum total expanded bytes declared by an IDML package. Defaults to 512 MiB. */
528
376
  idmlMaxExpandedBytes?: number;
529
- /** Maximum IDML page count exposed by the renderer. Defaults to 500. */
530
377
  idmlMaxPages?: number;
531
- /** Maximum frame count exposed by the IDML page tree. Defaults to 100,000. */
532
378
  idmlMaxFrames?: number;
533
- /** Maximum IDML print working set across visible, cached, transient, and print RGBA canvases. Defaults to 128 MiB. */
534
379
  idmlMaxPrintBytes?: number;
535
- /** Maximum structured result returned for ICML/IDMS/INX parsing. Defaults to 24 MiB and is hard-capped at 64 MiB. */
536
380
  indesignExchangeMaxResultBytes?: number;
537
- /** Maximum geometry points retained for one ICML/IDMS/INX page item. Defaults to 4,096 and is hard-capped at 16,384. */
538
381
  indesignExchangeMaxPointsPerItem?: number;
539
- /** Maximum DOM/SVG nodes materialized for one active ICML/IDMS/INX panel. Defaults to 8,000 and is hard-capped at 20,000. */
540
382
  indesignExchangeMaxDomNodesPerPanel?: number;
541
- /** Maximum accepted Photoshop source size. Defaults to 128 MiB. */
542
383
  maxFileBytes?: number;
543
- /** Maximum document canvas area. Defaults to 16 megapixels. */
544
384
  maxCanvasPixels?: number;
545
- /** Maximum width or height accepted for a browser canvas. Defaults to 16,384 pixels. */
546
385
  maxCanvasDimension?: number;
547
- /** Maximum decoded layer count. Defaults to 2,000. */
548
386
  maxLayers?: number;
549
- /** Maximum group nesting depth. Defaults to 64. */
550
387
  maxNestingDepth?: number;
551
- /** Maximum area decoded for one interactive layer. Defaults to 16 megapixels. */
552
388
  maxLayerPixels?: number;
553
- /** Maximum transferred RGBA bytes for one result. Defaults to 128 MiB. */
554
389
  maxDecodedBytes?: number;
555
- /** Maximum retained interactive layer canvas bytes. Defaults to 64 MiB. */
556
390
  maxLayerCacheBytes?: number;
557
- /** Maximum colors, brushes, shapes, pages, or other resource records. Defaults to 4,096. */
558
391
  maxResourceItems?: number;
559
- /** Maximum UTF-16 code units accepted for one resource name. Defaults to 4,096. */
560
392
  maxResourceNameCodeUnits?: number;
561
- /** Maximum total pixels decoded for one resource preview collection. Defaults to 16 megapixels. */
562
393
  maxResourcePreviewPixels?: number;
563
- /** Safety and inventory limits for XD UCF/ZIP containers and saved raster previews. */
564
394
  xd?: {
565
395
  maxFileBytes?: number;
566
396
  maxEntries?: number;
@@ -586,7 +416,6 @@ export interface FileViewerDesignOptions {
586
416
  maxReportedResources?: number;
587
417
  maxReportedArtboards?: number;
588
418
  };
589
- /** Safety and bounded first-frame reconstruction limits for modern ZIP/XFL-based Animate FLA files. */
590
419
  fla?: {
591
420
  maxFileBytes?: number;
592
421
  maxEntries?: number;
@@ -619,7 +448,6 @@ export interface FileViewerDesignOptions {
619
448
  maxPreviewPixels?: number;
620
449
  maxSymbolDepth?: number;
621
450
  };
622
- /** Safety limits for native INDD/INDT master-page, contiguous-object, XMP, and thumbnail reads. */
623
451
  inDesign?: {
624
452
  maxFileBytes?: number;
625
453
  maxDatabasePages?: number;
@@ -635,29 +463,10 @@ export interface FileViewerDesignOptions {
635
463
  export type FileViewerGeoBasemapPreset = 'none' | 'offline' | 'openfreemap' | 'openfreemap-liberty' | 'openfreemap-bright' | 'openfreemap-positron' | 'openfreemap-dark' | 'openfreemap-fiord' | 'osm-raster' | 'tianditu-vector' | 'tianditu-imagery' | 'tianditu-terrain';
636
464
  export type FileViewerTiandituMapStyle = 'vector' | 'imagery' | 'terrain';
637
465
  export interface FileViewerGeoBasemapOptions {
638
- /**
639
- * `raster` uses XYZ/TMS image tiles. `vector-style` uses a MapLibre style
640
- * object or URL, which is the best path for OpenFreeMap/OpenMapTiles stacks.
641
- * `tianditu` builds the official base and annotation raster layers from the
642
- * caller-provided Tianditu token.
643
- */
644
466
  type?: 'raster' | 'vector-style' | 'tianditu';
645
- /**
646
- * Raster XYZ/TMS tile template, for example `/tiles/{z}/{x}/{y}.png`.
647
- */
648
467
  tileUrl?: string | string[];
649
- /**
650
- * MapLibre style JSON URL. Can point to a public source, an intranet mirror,
651
- * or an offline static file distributed with the viewer.
652
- */
653
468
  styleUrl?: string;
654
- /**
655
- * Inline MapLibre style object for fully offline deployments.
656
- */
657
469
  style?: Record<string, unknown>;
658
- /**
659
- * Human-readable label shown in the geo preview details panel.
660
- */
661
470
  label?: string;
662
471
  attribution?: string;
663
472
  tileSize?: number;
@@ -665,86 +474,23 @@ export interface FileViewerGeoBasemapOptions {
665
474
  maxZoom?: number;
666
475
  scheme?: 'xyz' | 'tms';
667
476
  rasterOpacity?: number;
668
- /** Tianditu API token. Required when `type` is `tianditu`. */
669
477
  token?: string;
670
- /** Tianditu map family. Defaults to `vector`. */
671
478
  mapStyle?: FileViewerTiandituMapStyle;
672
- /** Include the matching Tianditu annotation layer. Defaults to true. */
673
479
  labels?: boolean;
674
480
  }
675
481
  export interface FileViewerGeoOptions {
676
- /**
677
- * Source coordinate reference system. GeoJSON normally uses WGS84, but many
678
- * business exports carry Web Mercator, GCJ-02, BD-09, or legacy CRS metadata.
679
- *
680
- * Accepts values such as `EPSG:4326`, `EPSG:3857`, `CRS:84`, `GCJ02`,
681
- * `BD09`, or a proj4 definition string.
682
- */
683
482
  projection?: string;
684
- /**
685
- * Convenience raster tile URL. The renderer stays offline by default; setting
686
- * this property opts into a raster basemap without requiring a full MapLibre
687
- * style. Use `basemap` when you need a named preset or vector style URL.
688
- */
689
483
  tileUrl?: string | string[];
690
- /**
691
- * Basemap configuration. Defaults to an offline empty MapLibre style.
692
- *
693
- * Built-in presets are opt-in: `openfreemap-liberty` uses the public
694
- * OpenFreeMap MapLibre style, and `osm-raster` uses the public OSM raster
695
- * tiles for light usage or demos. Production systems should prefer a
696
- * self-hosted or intranet style/tile URL.
697
- */
698
484
  basemap?: false | FileViewerGeoBasemapPreset | FileViewerGeoBasemapOptions;
699
- /**
700
- * Tianditu API token used by the `tianditu-*` presets. The viewer never
701
- * supplies or persists a token; obtain one for the deployment's own domain.
702
- */
703
485
  tiandituToken?: string;
704
- /**
705
- * Defaults to true. When no CRS is declared and coordinates exceed longitude
706
- * or latitude ranges, the geo renderer treats Web Mercator-sized values as
707
- * EPSG:3857 before rendering.
708
- */
709
486
  inferProjection?: boolean;
710
- /**
711
- * Defaults to true. Disable only for environments without reliable WebGL,
712
- * where the SVG fallback is preferred.
713
- */
714
487
  preferMapEngine?: boolean;
715
- /**
716
- * Padding in CSS pixels when fitting the dataset bounds in the map viewport.
717
- */
718
488
  fitPadding?: number;
719
489
  }
720
490
  export interface FileViewerDrawingOptions {
721
- /**
722
- * Self-hosted diagrams.net viewer script.
723
- *
724
- * The default points to the optional viewer asset copied under
725
- * `vendor/drawio/viewer-static.min.js`. It is only requested when
726
- * `preferOfficial` is explicitly enabled and never reaches public
727
- * diagrams.net hosts.
728
- */
729
491
  viewerScriptUrl?: string;
730
- /**
731
- * Defaults to false so untrusted diagrams use the inert built-in SVG path.
732
- * Set to true only to opt into the separately delivered diagrams.net viewer
733
- * runtime. It runs in a no-same-origin iframe with a restrictive CSP.
734
- */
735
492
  preferOfficial?: boolean;
736
- /**
737
- * PlantUML SVG endpoint. When omitted, the renderer stays fully offline and
738
- * shows an SVG source preview. When provided, the renderer appends the
739
- * encoded PlantUML payload to this base URL. Self-host this endpoint for
740
- * intranet preview.
741
- *
742
- * Example: `/plantuml/svg/`.
743
- */
744
493
  plantumlServerUrl?: string;
745
- /**
746
- * Request timeout for server-rendered PlantUML SVG.
747
- */
748
494
  plantumlTimeoutMs?: number;
749
495
  }
750
496
  export type FileViewerCadRenderer = 'auto' | 'webgl' | 'canvas2d';
@@ -759,32 +505,19 @@ export interface FileViewerCadOptions {
759
505
  useWorker?: boolean;
760
506
  workerTimeoutMs?: number;
761
507
  renderer?: FileViewerCadRenderer;
762
- /** Initial CAD color policy. `monochrome` applies one plot color without mutating source data. */
763
508
  colorMode?: FileViewerCadColorMode;
764
- /** CSS color used by monochrome mode. Defaults to black (#000000). */
765
509
  monochromeColor?: string;
766
- /** Shows the CAD toolbar color-mode toggle. Defaults to true. */
767
510
  showColorModeToggle?: boolean;
768
- /** Show native PNG/JPEG snapshot downloads. Download/export permissions still apply. */
769
511
  showImageExport?: boolean;
770
512
  preferDwgWasm?: boolean;
771
513
  includePaperSpace?: boolean;
772
514
  maxInsertDepth?: number;
773
515
  keepRaw?: boolean;
774
516
  preloadDwg?: boolean;
775
- /**
776
- * `best` fits the first view to visible drawing geometry and ignores common
777
- * CAD outliers such as paper-space frames or far-away markers. `native`
778
- * preserves the raw bounds reported by the underlying CAD renderer.
779
- */
780
517
  fitMode?: FileViewerCadFitMode;
781
- /**
782
- * Fraction of the CAD viewport used by fit-to-view. Defaults to 0.92.
783
- */
784
518
  fitPadding?: number;
785
519
  dwfPreferWebgl?: boolean;
786
520
  dwfPreferWasm?: boolean;
787
- /** Explicit DWF background override; otherwise follows the current color mode. */
788
521
  dwfBackground?: string;
789
522
  dwfMaxDevicePixelRatio?: number;
790
523
  dwfMaxCanvasPixels?: number;
@@ -795,19 +528,12 @@ export interface FileViewerCadOptions {
795
528
  dwfMaxOverviewStrokeCssPx?: number;
796
529
  dwfMinTextCssPx?: number;
797
530
  dwfMinFilledAreaCssPx?: number;
798
- /** Default background is dark for source colors and white for monochrome. Explicit colors are retained. */
799
531
  canvasOptions?: Record<string, unknown>;
800
532
  }
801
533
  export type FileViewerRendererMode = 'extend' | 'replace';
802
534
  export type FileViewerBuiltinRendererPreset = 'all' | 'lite' | 'none';
803
535
  export type FileViewerRendererPresetName = 'all' | 'lite' | 'standard' | 'office' | 'engineering';
804
536
  export interface FileViewerAutoRendererOptions {
805
- /**
806
- * Uses renderer presets registered by build tooling or preset side-effect imports.
807
- *
808
- * Defaults to true in `extend` mode and false in `replace` mode so applications
809
- * can keep a strict hand-picked renderer registry when needed.
810
- */
811
537
  enabled?: boolean;
812
538
  }
813
539
  export interface FileViewerSearchOptions {
@@ -827,69 +553,23 @@ export interface FileViewerAiOptions {
827
553
  chunkOverlap?: number;
828
554
  }
829
555
  export interface FileViewerTextOptions {
830
- /** Initial HTML/HTM view. Preview is static, sandboxed, and offline; defaults to preview. */
831
556
  htmlView?: 'preview' | 'source';
832
- /**
833
- * Source encoding. Defaults to `auto`: BOM and UTF-16 structure first,
834
- * then strict UTF-8, with GB18030 (including GBK) as the final fallback.
835
- */
836
- encoding?: 'auto' | 'utf-8' | 'utf-16le' | 'utf-16be' | 'gbk' | 'gb18030';
837
- /**
838
- * Shows the renderer-local source metadata toolbar (file type, indexing
839
- * status, and line count). Defaults to true. This does not control the
840
- * viewer-level operation toolbar.
841
- */
557
+ encoding?: 'auto' | 'utf-8' | 'utf-16le' | 'utf-16be' | 'gbk' | 'gb18030' | 'iso-8859-1' | 'iso-8859-2' | 'iso-8859-15' | 'windows-1250' | 'windows-1251' | 'windows-1252';
558
+ fallbackEncoding?: 'utf-8' | 'gbk' | 'gb18030' | 'iso-8859-1' | 'iso-8859-2' | 'iso-8859-15' | 'windows-1250' | 'windows-1251' | 'windows-1252';
842
559
  toolbar?: boolean;
843
- /**
844
- * Shows a non-selectable, screen-reader-hidden line-number gutter for code and text.
845
- * Defaults to false for regular files. The virtual large-text view keeps its
846
- * historical visible gutter when this option is omitted; pass false to hide it.
847
- */
848
560
  lineNumbers?: boolean;
849
- /**
850
- * Visually wraps long logical lines without inserting source newlines. Defaults to false.
851
- * Wrapped continuation rows remain associated with their original line number.
852
- */
853
561
  wrapLongLines?: boolean;
854
- /**
855
- * Formats supported structured text with lazily loaded Prettier plugins for display only.
856
- * Defaults to false; malformed, unsupported, or oversized inputs keep their original source.
857
- */
858
562
  prettyPrint?: boolean;
859
- /**
860
- * Maximum decoded UTF-8 source bytes eligible for Prettier. Defaults to the effective
861
- * `virtualizeAboveBytes` value, or 512 KiB when that option is omitted.
862
- */
863
563
  prettyPrintMaxBytes?: number;
864
- /** Switches text and code to bounded virtual rendering above this byte size. Defaults to 512 KiB. */
865
564
  virtualizeAboveBytes?: number;
866
- /**
867
- * Opts Markdown into source-mode virtual rendering above this byte size.
868
- * Markdown stays in its rendered reading view by default; set this only when
869
- * an application prefers bounded source inspection for exceptionally large files.
870
- */
871
565
  markdownVirtualizeAboveBytes?: number;
872
- /** Maximum source bytes mounted for one very long logical line at a time. Defaults to 16 KiB. */
566
+ markdownHighlight?: boolean;
873
567
  maxRenderedLineBytes?: number;
874
- /** Extra logical lines mounted above and below the visible viewport. Defaults to 12. */
875
568
  virtualOverscanLines?: number;
876
569
  }
877
570
  export type FileViewerUiDensity = 'comfortable' | 'compact';
878
571
  export interface FileViewerUiOptions {
879
- /**
880
- * Controls spacing density for viewer chrome such as toolbars, headers,
881
- * archive lists, badges, search inputs, and compact action clusters.
882
- */
883
572
  density?: FileViewerUiDensity;
884
- /**
885
- * Overrides the workspace behind rendered pages, slides, and other preview
886
- * content. Pass any valid CSS background value (for example `transparent`)
887
- * to let the host application provide an immersive surface. Omit this value,
888
- * or pass `auto`, to keep each renderer's light/dark default.
889
- *
890
- * This does not change document pages, slide canvases, spreadsheet cells, or
891
- * other file-authored backgrounds.
892
- */
893
573
  surfaceBackground?: string;
894
574
  }
895
575
  export interface FileViewerDiagnostic {
@@ -900,71 +580,18 @@ export interface FileViewerDiagnostic {
900
580
  }
901
581
  export interface FileViewerOptions {
902
582
  theme?: FileViewerThemeMode;
903
- /**
904
- * Controls how aggressively the viewer protects its DOM and CSS from the
905
- * host page. Standard component packages resolve `auto` to Shadow DOM so
906
- * host resets cannot break the toolbar or rendered content. Use `none`
907
- * explicitly only for legacy integrations that require deep class overrides.
908
- */
583
+ zoomGestures?: boolean | {
584
+ wheel?: boolean;
585
+ pinch?: boolean;
586
+ };
909
587
  styleIsolation?: FileViewerStyleIsolation;
910
- /**
911
- * Viewer UI language. `auto` follows the browser language and resolves the
912
- * built-in Chinese, English, Japanese, and German locales before falling
913
- * back to `en-US`.
914
- */
915
588
  locale?: FileViewerLocale;
916
- /**
917
- * Optional custom copy for built-in viewer UI. Use `i18n.messages` when you
918
- * also want to keep locale and messages grouped together.
919
- */
920
589
  messages?: FileViewerMessages;
921
590
  i18n?: FileViewerI18nOptions;
922
- /**
923
- * Controls how explicit renderer packages or presets are merged into this
924
- * viewer instance.
925
- *
926
- * `extend` mode keeps the configured built-in baseline and appends explicit
927
- * renderers. `replace` mode starts from an empty registry, so `preset` or
928
- * `renderers` fully define the active capability set.
929
- */
930
591
  rendererMode?: FileViewerRendererMode;
931
- /**
932
- * Advanced baseline switch for built-in browser renderers.
933
- *
934
- * Most applications can ignore this option and use `preset` / `renderers`
935
- * with `rendererMode:'replace'`. Keep it for compatibility or very strict
936
- * registry control: `all` preserves the historical full baseline, `lite`
937
- * keeps only low-cost web-native previewers, and `none` starts from an empty
938
- * built-in baseline while still allowing explicit renderer assembly.
939
- */
940
592
  builtinRenderers?: FileViewerBuiltinRendererPreset;
941
- /**
942
- * Enables renderer presets that were auto-registered by `@file-viewer/vite-plugin`
943
- * or by explicitly importing a preset package. Set to false when a product wants
944
- * total manual control through `renderers`.
945
- */
946
593
  autoRenderers?: boolean | FileViewerAutoRendererOptions;
947
- /**
948
- * Product-shaped renderer preset or preset list installed into this viewer
949
- * instance.
950
- *
951
- * This is the bundler-neutral path for Webpack, Rspack, Rollup, Umi,
952
- * legacy script builds, and any environment that should not depend on the
953
- * Vite virtual module. Import one or more preset packages and pass them here:
954
- *
955
- * `const officePreset = await import(theInstalledOfficePresetPackage)`
956
- * `options: { preset: officePreset.default }`
957
- * `options: { preset: [officePreset.default, engineeringPreset.default] }`
958
- *
959
- * The string form (`'office'`, `'all'`, etc.) selects a preset that has
960
- * already been registered by a preset side-effect import or by
961
- * `@file-viewer/vite-plugin`.
962
- */
963
594
  preset?: FileViewerRendererPresetInput;
964
- /**
965
- * @deprecated Use `preset: [officePreset, engineeringPreset]` instead. This
966
- * alias is kept only for compatibility with early 2.x integration drafts.
967
- */
968
595
  presets?: FileViewerRendererPresetInput;
969
596
  renderers?: FileViewerRendererPluginInput;
970
597
  watermark?: boolean | FileViewerWatermarkOptions;
@@ -973,19 +600,7 @@ export interface FileViewerOptions {
973
600
  search?: boolean | FileViewerSearchOptions;
974
601
  ai?: boolean | FileViewerAiOptions;
975
602
  text?: FileViewerTextOptions;
976
- /**
977
- * Explicit content fitting strategy. When omitted, each renderer keeps its
978
- * historical first-screen behavior for backward compatibility.
979
- */
980
603
  fit?: FileViewerFitMode | FileViewerFitOptions;
981
- /**
982
- * Initial renderer view position used after the document becomes ready.
983
- *
984
- * Renderers apply the fields they understand. All standard renderer paths
985
- * expose at least renderer / zoom / scroll snapshots through the generic
986
- * provider; high-interaction renderers such as PDF, XMind, Geo, 3D, and CAD
987
- * add page, navigation, canvas, map, camera, or native view details.
988
- */
989
604
  initialViewState?: FileViewerViewState;
990
605
  archive?: FileViewerArchiveOptions;
991
606
  chm?: FileViewerChmOptions;
@@ -993,24 +608,17 @@ export interface FileViewerOptions {
993
608
  docx?: FileViewerDocxOptions;
994
609
  presentation?: FileViewerPresentationOptions;
995
610
  spreadsheet?: FileViewerSpreadsheetOptions;
996
- /** Image renderer controls; also applies to multipage TIFF previews. */
997
611
  image?: {
998
- /**
999
- * Show rotation controls and allow view-state rotation. Defaults to true.
1000
- * Set false for compact previews. Decoder/EXIF orientation is unchanged.
1001
- */
1002
612
  rotation?: boolean;
1003
613
  };
1004
614
  iwork?: FileViewerIworkOptions;
1005
615
  wordPerfect?: FileViewerWordPerfectOptions;
1006
616
  hangul?: FileViewerHangulOptions;
1007
- /** Receives non-fatal routing, fallback, and capability diagnostics. */
1008
617
  onDiagnostic?: (diagnostic: FileViewerDiagnostic) => void;
1009
618
  typst?: FileViewerTypstOptions;
1010
619
  geo?: FileViewerGeoOptions;
1011
620
  data?: FileViewerDataOptions;
1012
621
  binary?: FileViewerBinaryInspectorOptions;
1013
- /** Configuration for the explicitly installed XML profile renderer. */
1014
622
  xml?: FileViewerXmlOptions;
1015
623
  design?: FileViewerDesignOptions;
1016
624
  drawing?: FileViewerDrawingOptions;
@@ -1272,31 +880,22 @@ export interface FileViewerExportHtmlOptions {
1272
880
  title?: string;
1273
881
  watermarkInlineStyle?: string;
1274
882
  }
1275
- /** Normalized print-mask rectangle in percent of the rendered content box. */
1276
883
  export interface FileViewerPrintMaskRegion {
1277
884
  left: number;
1278
885
  top: number;
1279
886
  width: number;
1280
887
  height: number;
1281
- /** Zero-based rendered page index. Omitted regions retain legacy whole-document coordinates. */
1282
888
  pageIndex?: number;
1283
889
  }
1284
- /** Page-aware image placed above rendered content for printing, such as a seal or signature. */
1285
890
  export interface FileViewerPrintStamp extends FileViewerPrintMaskRegion {
1286
- /** Image URL. Uploaded stamps are converted to a local data URL by the designer. */
1287
891
  src: string;
1288
- /** Image opacity from 0 to 1. Defaults to 1. */
1289
892
  opacity?: number;
1290
- /** Clockwise rotation in degrees. Defaults to 0. */
1291
893
  rotate?: number;
1292
894
  alt?: string;
1293
895
  }
1294
896
  export interface FileViewerPrintMaskOptions {
1295
- /** Solid black cover blocks, matching common OFD/business redaction UX. */
1296
897
  regions?: FileViewerPrintMaskRegion[];
1297
- /** Image overlays, including locally uploaded seals and signatures. */
1298
898
  stamps?: FileViewerPrintStamp[];
1299
- /** Fill color for print masks. Defaults to opaque black. */
1300
899
  color?: string;
1301
900
  }
1302
901
  export interface FileViewerPrintOptions {
@@ -1305,7 +904,6 @@ export interface FileViewerPrintOptions {
1305
904
  printWindow?: Window | null;
1306
905
  title?: string;
1307
906
  watermarkInlineStyle?: string;
1308
- /** Optional print-time cover masks applied above content and below watermark. */
1309
907
  mask?: FileViewerPrintMaskOptions | null;
1310
908
  }
1311
909
  export interface FileViewerSource {
@@ -1340,23 +938,30 @@ export interface RendererCapability {
1340
938
  }
1341
939
  export type FileViewerFormatSupportLevel = 'high-fidelity' | 'structured' | 'basic' | 'experimental';
1342
940
  export type FileViewerFormatStatus = 'stable' | 'experimental';
941
+ export interface RendererSourceTypeProbeInput {
942
+ filename: string;
943
+ extension: string;
944
+ url?: string;
945
+ file?: File | Blob;
946
+ buffer?: ArrayBuffer;
947
+ mimeType?: string;
948
+ signal?: AbortSignal;
949
+ }
950
+ export type RendererSourceTypeProbe = (input: RendererSourceTypeProbeInput) => string | false | null | undefined | Promise<string | false | null | undefined>;
1343
951
  export interface RendererDefinition {
1344
952
  id: string;
1345
953
  label: string;
1346
954
  category: FileViewerRendererCategory;
1347
955
  extensions: readonly string[];
956
+ filenamePatterns?: readonly string[];
957
+ sourceAccess?: 'buffer' | 'stream-preferred';
958
+ resolveSourceType?: RendererSourceTypeProbe;
1348
959
  async?: boolean;
1349
- /** Product-level fidelity contract generated from ecosystem/format-catalog.json. */
1350
960
  supportLevel?: FileViewerFormatSupportLevel;
1351
- /** Experimental formats are routable but are excluded from stable support counts. */
1352
961
  status?: FileViewerFormatStatus;
1353
- /** Owning on-demand renderer package. */
1354
962
  packageName?: string;
1355
- /** Presets that assemble this renderer. */
1356
963
  presets?: readonly FileViewerRendererPresetName[];
1357
- /** Existing renderer whose fallback extensions this specialist replaces when installed. */
1358
964
  enhancesRendererId?: string;
1359
- /** Extensions transferred from enhancesRendererId to this specialist when installed. */
1360
965
  enhancesExtensions?: readonly string[];
1361
966
  containerVersions?: readonly string[];
1362
967
  knownLimits?: readonly string[];
@@ -1430,7 +1035,6 @@ export interface FileViewerLoadOptions {
1430
1035
  }
1431
1036
  export interface FileViewerInstance {
1432
1037
  readonly container: HTMLElement;
1433
- /** Installs configured renderer plugins without loading a document. */
1434
1038
  prepare?(): Promise<void>;
1435
1039
  load(source: FileViewerSource, options?: FileViewerLoadOptions): Promise<RendererSession | null>;
1436
1040
  unload?(reason?: FileViewerLifecycleContext['reason']): Promise<void>;
@@ -1446,7 +1050,6 @@ export interface FileViewerInstance {
1446
1050
  download(options?: FileViewerDownloadOptions): Promise<void>;
1447
1051
  exportHtml(options?: FileViewerExportHtmlOptions): Promise<string>;
1448
1052
  print(options?: FileViewerPrintOptions): Promise<void>;
1449
- /** Open the async print-mask designer, then print with the chosen covers. */
1450
1053
  printWithMask(options?: FileViewerPrintOptions): Promise<void>;
1451
1054
  zoomIn(): Promise<FileViewerZoomState>;
1452
1055
  zoomOut(): Promise<FileViewerZoomState>;