@file-viewer/core 3.3.1 → 3.3.3

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