@file-viewer/core 3.2.2 → 3.3.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 (112) hide show
  1. package/README.en.md +26 -15
  2. package/README.md +47 -41
  3. package/README.zh-CN.md +175 -0
  4. package/dist/assets.d.ts +2 -2
  5. package/dist/assets.js +5 -1
  6. package/dist/browser/controller.d.ts +2 -1
  7. package/dist/browser/controller.js +156 -32
  8. package/dist/browser/source-feedback.d.ts +4 -0
  9. package/dist/browser/source-feedback.js +40 -0
  10. package/dist/browser/toolbar-focus.d.ts +2 -0
  11. package/dist/browser/toolbar-focus.js +46 -0
  12. package/dist/browser.d.ts +2 -2
  13. package/dist/browser.js +2 -2
  14. package/dist/config/options.d.ts +1 -1
  15. package/dist/contracts/types.d.ts +479 -1
  16. package/dist/contracts/xml.d.ts +11 -0
  17. package/dist/export.d.ts +10 -3
  18. package/dist/export.js +9 -2
  19. package/dist/exportDocument.d.ts +12 -1
  20. package/dist/exportDocument.js +31 -2
  21. package/dist/features/document/dom/anchors.d.ts +1 -1
  22. package/dist/features/document/dom/index.d.ts +5 -5
  23. package/dist/features/document/dom/index.js +3 -3
  24. package/dist/features/document/dom/providers.d.ts +1 -1
  25. package/dist/features/document/events.d.ts +2 -2
  26. package/dist/features/document/events.js +3 -3
  27. package/dist/features/document/fit.d.ts +1 -1
  28. package/dist/features/document/fit.js +1 -1
  29. package/dist/features/document/imageHandTool.d.ts +3 -0
  30. package/dist/features/document/imageHandTool.js +141 -0
  31. package/dist/features/document/model.d.ts +1 -1
  32. package/dist/features/document/search.d.ts +1 -1
  33. package/dist/features/document/search.js +2 -2
  34. package/dist/features/document/viewState.d.ts +1 -1
  35. package/dist/features/document/viewState.js +2 -2
  36. package/dist/features/document/zoom.d.ts +1 -1
  37. package/dist/features/document/zoom.js +3 -3
  38. package/dist/features/document/zoomGestures.d.ts +2 -2
  39. package/dist/features/document/zoomGestures.js +2 -0
  40. package/dist/features/printMask.d.ts +1 -1
  41. package/dist/features/printMaskDesigner.d.ts +6 -2
  42. package/dist/features/printMaskDesigner.js +11 -2
  43. package/dist/features/printMaskLoader.d.ts +7 -1
  44. package/dist/features/printMaskLoader.js +7 -1
  45. package/dist/features/watermark.d.ts +1 -1
  46. package/dist/headless.d.ts +29 -29
  47. package/dist/headless.js +21 -16
  48. package/dist/i18n/messages.d.ts +1 -1
  49. package/dist/i18n/messages.de.d.ts +5 -1
  50. package/dist/i18n/messages.de.js +4 -0
  51. package/dist/i18n/messages.ja.d.ts +6 -1
  52. package/dist/i18n/messages.ja.js +5 -0
  53. package/dist/i18n/messages.js +2 -2
  54. package/dist/index.d.ts +77 -75
  55. package/dist/index.js +39 -37
  56. package/dist/lifecycle/facade.d.ts +4 -4
  57. package/dist/lifecycle/facade.js +2 -2
  58. package/dist/lifecycle/operations.d.ts +6 -4
  59. package/dist/lifecycle/operations.js +21 -4
  60. package/dist/output/canvasImage.d.ts +2 -1
  61. package/dist/output/canvasImage.js +4 -1
  62. package/dist/output/export.d.ts +3 -1
  63. package/dist/output/export.js +12 -0
  64. package/dist/output/printLayout.d.ts +5 -0
  65. package/dist/output/printLayout.js +4 -0
  66. package/dist/output/snapshotDownload.d.ts +2 -1
  67. package/dist/output/snapshotDownload.js +3 -2
  68. package/dist/platform/assets.d.ts +9 -2
  69. package/dist/platform/assets.js +15 -1
  70. package/dist/platform/copiedAssets.d.ts +1 -0
  71. package/dist/platform/copiedAssets.js +2 -1
  72. package/dist/presentation/colorScheme.d.ts +3 -0
  73. package/dist/presentation/colorScheme.js +40 -0
  74. package/dist/presentation/state.d.ts +1 -1
  75. package/dist/presentation/state.js +3 -3
  76. package/dist/print-mask.d.ts +2 -2
  77. package/dist/print-mask.js +1 -1
  78. package/dist/registry/capabilities.d.ts +14 -1
  79. package/dist/registry/capabilities.js +15 -2
  80. package/dist/registry/formats.d.ts +1 -1
  81. package/dist/registry/formats.generated.d.ts +1 -0
  82. package/dist/registry/formats.generated.js +1 -0
  83. package/dist/registry/formats.js +2 -2
  84. package/dist/registry/registry.d.ts +15 -1
  85. package/dist/registry/registry.js +10 -2
  86. package/dist/renderers/image.d.ts +1 -1
  87. package/dist/renderers/image.js +13 -7
  88. package/dist/renderers/index.d.ts +1 -1
  89. package/dist/renderers/index.js +11 -5
  90. package/dist/rendering/dispatcher.d.ts +6 -1
  91. package/dist/rendering/dispatcher.js +3 -3
  92. package/dist/rendering/handler.d.ts +13 -3
  93. package/dist/rendering/handler.js +21 -9
  94. package/dist/security/svgResources.d.ts +10 -0
  95. package/dist/security/svgResources.js +12 -0
  96. package/dist/source/index.d.ts +3 -3
  97. package/dist/source/index.js +1 -1
  98. package/dist/source/loading.d.ts +12 -7
  99. package/dist/source/loading.js +22 -17
  100. package/dist/source/precheck.d.ts +13 -1
  101. package/dist/source/precheck.js +9 -2
  102. package/dist/source/textEncoding.d.ts +18 -0
  103. package/dist/source/textEncoding.js +15 -0
  104. package/dist/viewer/createViewer.d.ts +1 -1
  105. package/dist/viewer/createViewer.js +30 -17
  106. package/dist/viewer/loading.d.ts +6 -2
  107. package/dist/viewer/loading.js +9 -1
  108. package/dist/viewer/operations.d.ts +3 -3
  109. package/dist/viewer/operations.js +14 -6
  110. package/dist/viewer/state.d.ts +6 -2
  111. package/dist/viewer/state.js +8 -3
  112. package/package.json +14 -5
@@ -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,9 +50,13 @@ 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. */
53
54
  theme?: boolean;
55
+ /** Built-in toolbar group order. Missing entries keep their default relative order. */
54
56
  order?: FileViewerToolbarItem[];
57
+ /** Controls which built-in toolbar actions are displayed without disabling controller APIs. */
55
58
  items?: FileViewerToolbarActionMap;
59
+ /** Hard operation permission map. False values block both built-in toolbar and public API calls. */
56
60
  permissions?: FileViewerToolbarActionMap;
57
61
  position?: FileViewerToolbarPosition;
58
62
  beforeOperation?: FileViewerBeforeOperation;
@@ -71,6 +75,10 @@ export interface FileViewerArchiveEntryActionContext {
71
75
  }
72
76
  export type FileViewerArchiveEntryActionPolicy = boolean | ((entry: FileViewerArchiveEntryActionContext) => boolean);
73
77
  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
+ */
74
82
  download?: FileViewerArchiveEntryActionPolicy;
75
83
  }
76
84
  export interface FileViewerArchiveOptions {
@@ -78,23 +86,53 @@ export interface FileViewerArchiveOptions {
78
86
  wasmUrl?: string;
79
87
  workerTimeoutMs?: number;
80
88
  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
+ */
81
94
  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
+ */
82
100
  maxEntryPreviewSize?: number;
83
101
  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
+ */
84
107
  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
+ */
85
112
  requestPassword?: (context: FileViewerArchivePasswordRequestContext) => string | null | undefined | Promise<string | null | undefined>;
86
113
  }
87
114
  export interface FileViewerChmOptions {
115
+ /** Self-hosted module Worker that owns all untrusted CHM parsing and decompression. */
88
116
  workerUrl?: string | URL;
117
+ /** Self-hosted wasm-bindgen JavaScript module loaded by the CHM Worker. */
89
118
  wasmModuleUrl?: string | URL;
119
+ /** Self-hosted Rust WebAssembly binary loaded by the CHM Worker. */
90
120
  wasmUrl?: string | URL;
121
+ /** Maximum time for an individual Worker request. Defaults to 60 seconds. */
91
122
  workerTimeoutMs?: number;
123
+ /** Maximum accepted CHM input size. Defaults to 320 MiB. */
92
124
  maxArchiveBytes?: number;
125
+ /** Maximum number of virtual files accepted from one CHM. Defaults to 50,000. */
93
126
  maxEntries?: number;
127
+ /** Maximum uncompressed size of one virtual file. Defaults to 32 MiB. */
94
128
  maxEntryBytes?: number;
129
+ /** Maximum total unique decoded content exposed by the parser. Defaults to 512 MiB. */
95
130
  maxTotalDecompressedBytes?: number;
131
+ /** Maximum HTML topic size. Defaults to 16 MiB. */
96
132
  maxHtmlBytes?: number;
133
+ /** Maximum topic count scanned by the built-in search. Defaults to 10,000. */
97
134
  maxSearchTopics?: number;
135
+ /** Maximum built-in search result count. Defaults to 200. */
98
136
  maxSearchResults?: number;
99
137
  }
100
138
  export type FileViewerArchivePasswordRequestReason = 'encrypted' | 'invalid-password' | 'read-failed' | 'extract-failed';
@@ -106,49 +144,99 @@ export interface FileViewerArchivePasswordRequestContext {
106
144
  error?: unknown;
107
145
  }
108
146
  export interface FileViewerPdfOptions {
147
+ /** Preview-only dark reading palette; follows the viewer theme when omitted. */
148
+ darkMode?: boolean;
149
+ /** Opt-in mouse hand-tool panning. Touch/pinch, links and form fields remain native. Default: false. */
109
150
  handTool?: boolean;
110
151
  toolbar?: boolean;
152
+ /** Hides only the PDF renderer's zoom controls; navigation and rotation remain available. Default: true. */
153
+ zoomToolbar?: boolean;
111
154
  navigation?: boolean;
112
155
  defaultNavigationVisible?: boolean;
113
156
  thumbnails?: boolean;
114
157
  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
+ */
115
163
  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
+ */
116
168
  initialViewState?: FileViewerViewState;
117
169
  streaming?: boolean | 'same-origin';
170
+ /** Opt out of PDF.js background streaming while retaining HTTP Range reads. Default: PDF.js defaults. */
171
+ disableStream?: boolean;
172
+ /** Stop speculative PDF.js reads; requires disableStream:true to be fully effective. */
173
+ disableAutoFetch?: boolean;
118
174
  rangeChunkSize?: number;
119
175
  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
+ */
120
181
  assetBaseUrl?: string | URL;
121
182
  workerUrl?: string;
122
183
  cMapUrl?: string;
123
184
  wasmUrl?: string;
124
185
  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
+ */
125
190
  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
+ */
126
197
  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
+ */
127
202
  cjkFontFallbackPath?: string;
128
203
  }
129
204
  export type FileViewerPdfBoundingBoxUnit = 'ratio' | 'percent' | 'pixel' | 'pdf-point';
130
205
  export type FileViewerPdfBoundingBoxOrigin = 'top-left' | 'bottom-left';
131
206
  export interface FileViewerPdfBoundingBox {
132
207
  id?: string;
208
+ /** One-based PDF page number. Defaults to the current page, then page 1. */
133
209
  page?: number;
134
210
  x: number;
135
211
  y: number;
136
212
  width: number;
137
213
  height: number;
214
+ /** Defaults to `pdf-point`. */
138
215
  unit?: FileViewerPdfBoundingBoxUnit;
216
+ /** Defaults to `bottom-left` for PDF points and `top-left` otherwise. */
139
217
  origin?: FileViewerPdfBoundingBoxOrigin;
218
+ /** Required when `unit` is `pixel`; this is the OCR/source image width. */
140
219
  sourceWidth?: number;
220
+ /** Required when `unit` is `pixel`; this is the OCR/source image height. */
141
221
  sourceHeight?: number;
222
+ /** CSS color used for the outline and translucent fill. */
142
223
  color?: string;
224
+ /** Optional accessible description for the highlighted region. */
143
225
  label?: string;
144
226
  }
145
227
  export interface FileViewerDocxOptions {
228
+ /**
229
+ * 输出源部件与段落的只读定位标识,供独立展示适配器使用;默认关闭。
230
+ * 不提供编辑或文件写回能力,重新渲染后的展示状态由适配器维护。
231
+ */
146
232
  exposeDisplayTargets?: boolean;
233
+ /** DOC/DOCX 默认保留插入和删除修订;final 显示定稿,original 显示修订前原稿。 */
147
234
  reviewMode?: 'all' | 'final' | 'original';
148
235
  worker?: boolean;
149
236
  workerUrl?: string;
150
237
  workerJsZipUrl?: string;
151
238
  progressive?: boolean;
239
+ /** 默认 false,使用连续流式阅读;设为 true 时才启用 DOCX 页式预览。 */
152
240
  visualPagination?: boolean;
153
241
  workerTimeout?: number;
154
242
  renderPageBatchSize?: number;
@@ -161,27 +249,49 @@ export interface FileViewerDocxOptions {
161
249
  updatePageReferences?: boolean;
162
250
  hideWebHiddenContent?: boolean;
163
251
  ignoreLastRenderedPageBreak?: boolean;
252
+ /** Set false to omit embedded HTML altChunks. Omitted/true retains the engine sandbox. */
164
253
  renderAltChunks?: boolean;
254
+ /** External DOC/DOCX/RTF links are blocked by default; internal bookmark links remain active. */
165
255
  externalLinkPolicy?: 'allow' | 'block';
256
+ /** Linked DOC/DOCX/RTF image resources are blocked by default; embedded images remain available. */
166
257
  externalResourcePolicy?: 'allow' | 'block';
258
+ /** Overrides automatic DOCX dark rendering derived from the viewer theme. */
259
+ darkMode?: boolean;
260
+ }
261
+ export interface FileViewerEpubOptions {
262
+ /** Follows the viewer theme when omitted; false retains the book's authored colors. */
167
263
  darkMode?: boolean;
168
264
  }
169
265
  export interface FileViewerSpreadsheetOptions {
170
266
  worker?: boolean | 'auto';
171
267
  workerUrl?: string;
268
+ /** `worker: 'auto'` 时,大于该字节数的表格自动使用静态 Worker,默认 1MB。 */
172
269
  workerAutoThreshold?: number;
270
+ /**
271
+ * CSV / TSV 文本编码。默认 `auto`:优先 UTF-8 BOM 和严格 UTF-8,
272
+ * 否则使用浏览器内置 GB18030 解码器(同时覆盖 GBK)。
273
+ */
173
274
  textEncoding?: 'auto' | 'utf-8' | 'gbk' | 'gb18030';
275
+ /** 允许用户在 Excel / CSV / ODS 预览中拖拽表头边界调整列宽,默认关闭以保持历史行为。 */
174
276
  resizableColumns?: boolean;
277
+ /** 允许用户在 Excel / CSV / ODS 预览中拖拽行头边界调整行高,默认关闭以保持历史行为。 */
175
278
  resizableRows?: boolean;
279
+ /** Fill spreadsheet previews with display-only blank grid cells by default; false keeps the used range only. */
176
280
  fillViewport?: boolean;
177
281
  }
178
282
  export interface FileViewerPresentationOptions {
283
+ /** PPTX/OpenXML Worker URL. This is independent from the binary-PPT Worker. */
179
284
  workerUrl?: string | URL;
180
285
  workerType?: WorkerType;
286
+ /** Optional self-hosted native WASM URL used only by the PowerPoint 97–2003 renderer. */
181
287
  pptWasmUrl?: string | URL;
288
+ /** Optional self-hosted CJK font-pack URL used only by the PowerPoint 97–2003 renderer. */
182
289
  pptFontUrl?: string | URL;
290
+ /** Optional module Worker URL used only by the PowerPoint 97–2003 renderer. */
183
291
  pptWorkerUrl?: string | URL;
292
+ /** Selects the binary-PPT Worker path. Defaults to `auto`. */
184
293
  pptWorker?: boolean | 'auto';
294
+ /** Controls the binary-PPT bounded IndexedDB frame cache. */
185
295
  pptCache?: false | {
186
296
  enabled?: boolean;
187
297
  dbName?: string;
@@ -189,36 +299,63 @@ export interface FileViewerPresentationOptions {
189
299
  maxEntries?: number;
190
300
  maxEntryBytes?: number;
191
301
  };
302
+ /** Render and retain only binary-PPT slides near the viewport. Defaults to true. */
192
303
  pptVirtualize?: boolean;
304
+ /** IntersectionObserver overscan for binary-PPT virtualization. Defaults to `150% 0px`. */
193
305
  pptVirtualRootMargin?: string;
306
+ /** Delay before an offscreen binary-PPT canvas is cached and released. Defaults to 1200ms. */
194
307
  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
+ */
195
312
  pptModuleUrl?: string | URL;
196
313
  }
197
314
  export type FileViewerIworkEmbeddedPreviewMode = 'never' | 'loading' | 'fallback';
198
315
  export interface FileViewerIworkOptions {
316
+ /** Self-hosted module Worker used for ZIP, Snappy, IWA/Protobuf and iWork '09 XML parsing. */
199
317
  workerUrl?: string | URL;
318
+ /** Defaults to true. Disable only in environments without Worker support. */
200
319
  useWorker?: boolean;
320
+ /** Maximum parse time before the Worker is terminated. Defaults to 60 seconds. */
201
321
  workerTimeoutMs?: number;
322
+ /** Maximum total bytes produced while inflating the outer container and Index.zip. Defaults to 256 MiB. */
202
323
  maxUncompressedBytes?: number;
324
+ /** Maximum accepted ZIP compression ratio for a single entry. Defaults to 200. */
203
325
  maxCompressionRatio?: number;
326
+ /** Maximum decoded IWA archive/object count. Defaults to 250,000. */
204
327
  maxObjects?: number;
328
+ /** Maximum decoded image pixels for one media resource. Defaults to 80 megapixels. */
205
329
  maxImagePixels?: number;
330
+ /** Maximum normalized scene/object nesting depth. Defaults to 128. */
206
331
  maxNestingDepth?: number;
332
+ /** Embedded Quick Look images are loading placeholders or explicit parse-failure fallbacks, never fidelity evidence. */
207
333
  embeddedPreview?: FileViewerIworkEmbeddedPreviewMode;
208
334
  }
209
335
  export interface FileViewerWordPerfectOptions {
336
+ /** Self-hosted Worker that owns WordPerfect signature detection and parsing. */
210
337
  workerUrl?: string | URL;
338
+ /** Self-hosted libwpd/librevenge WebAssembly module. */
211
339
  wasmUrl?: string | URL;
340
+ /** Defaults to true. */
212
341
  useWorker?: boolean;
342
+ /** Maximum parser time before the Worker is terminated. Defaults to 60 seconds. */
213
343
  workerTimeoutMs?: number;
214
344
  }
215
345
  export interface FileViewerHangulOptions {
346
+ /** Self-hosted module Worker used for bounded HWP v5 CFB and HWPX ZIP/XML parsing. */
216
347
  workerUrl?: string | URL;
348
+ /** Defaults to true. Disable only in environments without Worker support. */
217
349
  useWorker?: boolean;
350
+ /** Maximum parser time before the Worker is terminated. Defaults to 60 seconds. */
218
351
  workerTimeoutMs?: number;
352
+ /** Maximum total uncompressed HWPX entry bytes or individual HWP stream bytes. Defaults to 256 MiB. */
219
353
  maxUncompressedBytes?: number;
354
+ /** Maximum accepted HWPX ZIP compression ratio for a single entry. Defaults to 200. */
220
355
  maxCompressionRatio?: number;
356
+ /** Maximum HWPX ZIP entry count. Defaults to 25,000. */
221
357
  maxEntries?: number;
358
+ /** Maximum HWP record count decoded across one stream. Defaults to 250,000. */
222
359
  maxRecords?: number;
223
360
  }
224
361
  export type FileRenderExportMode = 'export' | 'print';
@@ -235,9 +372,13 @@ export interface FileViewerThumbnailCaptureOptions {
235
372
  signal?: AbortSignal;
236
373
  }
237
374
  export interface FileRenderThumbnailAdapter {
375
+ /** Prepare lazy content immediately before capture. */
238
376
  beforeCapture?: (options: FileViewerThumbnailCaptureOptions) => void | Promise<void>;
377
+ /** Identifies a capture result that comes from packaged metadata rather than rendered content. */
239
378
  captureSource?: 'embedded' | 'rendered';
379
+ /** A renderer-native fast path. Returning null delegates to the DOM fallback. */
240
380
  capture?: (options: FileViewerThumbnailCaptureOptions) => Blob | null | Promise<Blob | null>;
381
+ /** The first page/slide/sheet/cover element used by the DOM fallback. */
241
382
  getTarget?: (options: FileViewerThumbnailCaptureOptions) => Element | null | Promise<Element | null>;
242
383
  }
243
384
  export interface FileRenderExportOptions {
@@ -249,6 +390,7 @@ export interface FileRenderExportAdapter {
249
390
  exportHtml?: boolean;
250
391
  includeDocumentStyles?: boolean;
251
392
  beforeSnapshot?: () => Promise<void> | void;
393
+ /** Live page surfaces used by the interactive print-mask designer. */
252
394
  getPrintMaskPages?: () => readonly HTMLElement[];
253
395
  printStyle?: string | ((options: FileRenderExportOptions) => Promise<string> | string);
254
396
  toHtml?: (options: FileRenderExportOptions) => Promise<string> | string;
@@ -257,6 +399,7 @@ export interface FileRenderContext {
257
399
  filename?: string;
258
400
  url?: string;
259
401
  streamUrl?: string;
402
+ /** Original browser File or Blob retained for renderers with random access. */
260
403
  sourceFile?: File | Blob;
261
404
  signal?: AbortSignal;
262
405
  options?: FileViewerOptions;
@@ -264,6 +407,7 @@ export interface FileRenderContext {
264
407
  registerExportAdapter?: (adapter: FileRenderExportAdapter | null) => void;
265
408
  registerThumbnailAdapter?: (adapter: FileRenderThumbnailAdapter | null) => void;
266
409
  renderPurpose?: FileViewerRenderPurpose;
410
+ /** Derived-image download, guarded by the owning viewer's permissions, hooks and request version. */
267
411
  requestSnapshotDownload?: (create: (watermark: FileViewerOptions['watermark']) => Promise<{
268
412
  blob: Blob;
269
413
  filename: string;
@@ -276,6 +420,13 @@ export interface FileRenderHandlerComposite<Rendered = unknown, Target extends H
276
420
  accepts: Array<string>;
277
421
  handler: FileRenderHandler<Rendered, Target>;
278
422
  }
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
+ */
279
430
  export type FileViewerRenderedInstance = {
280
431
  $el?: Node;
281
432
  unmount: () => void | Promise<void>;
@@ -294,10 +445,15 @@ export interface FileViewerTypstOptions {
294
445
  }
295
446
  export type FileViewerModelLinearUnit = 'millimeter' | 'centimeter' | 'meter' | 'inch' | 'foot';
296
447
  export interface FileViewerModelOptions {
448
+ /** Self-hosted worker that keeps STEP/IGES/BREP tessellation off the UI thread. */
297
449
  workerUrl?: string;
450
+ /** Self-hosted occt-import-js runtime loaded by the classic worker. */
298
451
  runtimeUrl?: string;
452
+ /** Self-hosted OpenCascade WebAssembly module used by the model renderer. */
299
453
  wasmUrl?: string;
454
+ /** Disable only when Worker is unavailable or a host deliberately accepts main-thread parsing. */
300
455
  useWorker?: boolean;
456
+ /** Maximum time allowed for geometry-kernel initialization and tessellation. Defaults to 120 seconds. */
301
457
  workerTimeoutMs?: number;
302
458
  linearUnit?: FileViewerModelLinearUnit;
303
459
  linearDeflectionType?: 'bounding_box_ratio' | 'absolute_value';
@@ -307,14 +463,21 @@ export interface FileViewerModelOptions {
307
463
  export interface FileViewerDataOptions {
308
464
  sqlWasmUrl?: string;
309
465
  }
466
+ /** Limits for the explicit, read-only binary inspector renderer. */
310
467
  export interface FileViewerBinaryInspectorOptions {
468
+ /** Whole-input ceiling before the renderer copies bytes into its Worker. Defaults to 16 MiB. */
311
469
  maxFileBytes?: number;
470
+ /** Maximum time allowed for one structure-template pass. Defaults to 5 seconds. */
312
471
  maxParseMilliseconds?: number;
472
+ /** Maximum structure nodes returned from the Worker. Defaults to 512. */
313
473
  maxStructureNodes?: number;
474
+ /** Maximum structure-tree nesting depth. Defaults to 16. */
314
475
  maxStructureDepth?: number;
476
+ /** Maximum decoded string bytes in one displayed field. Defaults to 4 KiB. */
315
477
  maxStringBytes?: number;
316
478
  }
317
479
  export type FileViewerIllustratorMode = 'auto' | 'pdf' | 'native';
480
+ /** Resource budgets forwarded to the standalone illustrator-pgf Worker. */
318
481
  export interface FileViewerIllustratorLimits {
319
482
  maxFileBytes: number;
320
483
  maxDecodedBytes: number;
@@ -352,45 +515,85 @@ export interface FileViewerIllustratorResourceResolver {
352
515
  resolve(reference: FileViewerIllustratorResourceReference, signal: AbortSignal): Promise<ArrayBuffer | null>;
353
516
  }
354
517
  export interface FileViewerDesignOptions {
518
+ /** Illustrator routing: PDF-compatible surface, native PGF scene, or safe automatic fallback. */
355
519
  illustratorMode?: FileViewerIllustratorMode;
520
+ /** Self-hosted module Worker that runs the standalone illustrator-pgf parser and renderer. */
356
521
  illustratorWorkerUrl?: string | URL;
522
+ /** Resource budgets forwarded to illustrator-pgf. Defaults to the SDK's bounded limits. */
357
523
  illustratorLimits?: Partial<FileViewerIllustratorLimits>;
524
+ /** Optional host font resolver used only by the native Illustrator session. */
358
525
  illustratorFontResolver?: FileViewerIllustratorFontResolver;
526
+ /** Optional host linked/embedded resource resolver used only by the native Illustrator session. */
359
527
  illustratorResourceResolver?: FileViewerIllustratorResourceResolver;
528
+ /** Self-hosted module Worker used for heavy Adobe document parsing and pixel synthesis. */
360
529
  workerUrl?: string | URL;
530
+ /** Self-hosted module Worker used for bounded FLA/XFL, XD, INDD/INDT, ICML/IDMS/INX, ASE, and ACO parsing. */
361
531
  containerWorkerUrl?: string | URL;
532
+ /** Self-hosted module Worker used for ABR/CSH/PAT/GRD/ASL resource parsing. */
362
533
  adobeResourceWorkerUrl?: string | URL;
534
+ /** Self-hosted module Worker that runs the bounded EPS/PostScript interpreter. */
363
535
  postscriptWorkerUrl?: string | URL;
536
+ /** Self-hosted, license-safe Stet WebAssembly binary used only inside the PostScript Worker. */
364
537
  postscriptWasmUrl?: string | URL;
538
+ /** Defaults to true. Disable only when Worker is unavailable. */
365
539
  useWorker?: boolean;
540
+ /** Maximum parser time before the Worker is terminated. Defaults to 60 seconds. */
366
541
  workerTimeoutMs?: number;
542
+ /** Base EPS/PostScript rasterization density. Defaults to 96 DPI. */
367
543
  postscriptRenderDpi?: number;
544
+ /** Maximum pages produced by one EPS/PostScript program. Defaults to 100. */
368
545
  postscriptMaxPages?: number;
546
+ /** Maximum source width or height reported by a PostScript page. Defaults to 100,000 units. */
369
547
  postscriptMaxSourceDimension?: number;
548
+ /** Maximum PostScript virtual-machine allocation. Defaults to 256 MiB. */
370
549
  postscriptMaxVmBytes?: number;
550
+ /** Maximum PostScript print working set across visible, cached, transient, and print RGBA canvases. Defaults to 128 MiB. */
371
551
  postscriptMaxPrintBytes?: number;
552
+ /** Self-hosted module Worker used by the high-fidelity IDML page renderer. */
372
553
  idmlWorkerUrl?: string | URL;
554
+ /** Self-hosted @paged-media/introspect-wasm binary used only inside the IDML Worker. */
373
555
  idmlWasmUrl?: string | URL;
556
+ /** Base rasterization density for IDML pages. Defaults to 96 DPI. */
374
557
  idmlRenderDpi?: number;
558
+ /** Maximum IDML ZIP entry count. Defaults to 20,000. */
375
559
  idmlMaxEntries?: number;
560
+ /** Maximum total expanded bytes declared by an IDML package. Defaults to 512 MiB. */
376
561
  idmlMaxExpandedBytes?: number;
562
+ /** Maximum IDML page count exposed by the renderer. Defaults to 500. */
377
563
  idmlMaxPages?: number;
564
+ /** Maximum frame count exposed by the IDML page tree. Defaults to 100,000. */
378
565
  idmlMaxFrames?: number;
566
+ /** Maximum IDML print working set across visible, cached, transient, and print RGBA canvases. Defaults to 128 MiB. */
379
567
  idmlMaxPrintBytes?: number;
568
+ /** Maximum structured result returned for ICML/IDMS/INX parsing. Defaults to 24 MiB and is hard-capped at 64 MiB. */
380
569
  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. */
381
571
  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. */
382
573
  indesignExchangeMaxDomNodesPerPanel?: number;
574
+ /** Maximum accepted Photoshop source size. Defaults to 128 MiB. */
383
575
  maxFileBytes?: number;
576
+ /** Maximum document canvas area. Defaults to 16 megapixels. */
384
577
  maxCanvasPixels?: number;
578
+ /** Maximum width or height accepted for a browser canvas. Defaults to 16,384 pixels. */
385
579
  maxCanvasDimension?: number;
580
+ /** Maximum decoded layer count. Defaults to 2,000. */
386
581
  maxLayers?: number;
582
+ /** Maximum group nesting depth. Defaults to 64. */
387
583
  maxNestingDepth?: number;
584
+ /** Maximum area decoded for one interactive layer. Defaults to 16 megapixels. */
388
585
  maxLayerPixels?: number;
586
+ /** Maximum transferred RGBA bytes for one result. Defaults to 128 MiB. */
389
587
  maxDecodedBytes?: number;
588
+ /** Maximum retained interactive layer canvas bytes. Defaults to 64 MiB. */
390
589
  maxLayerCacheBytes?: number;
590
+ /** Maximum colors, brushes, shapes, pages, or other resource records. Defaults to 4,096. */
391
591
  maxResourceItems?: number;
592
+ /** Maximum UTF-16 code units accepted for one resource name. Defaults to 4,096. */
392
593
  maxResourceNameCodeUnits?: number;
594
+ /** Maximum total pixels decoded for one resource preview collection. Defaults to 16 megapixels. */
393
595
  maxResourcePreviewPixels?: number;
596
+ /** Safety and inventory limits for XD UCF/ZIP containers and saved raster previews. */
394
597
  xd?: {
395
598
  maxFileBytes?: number;
396
599
  maxEntries?: number;
@@ -416,6 +619,7 @@ export interface FileViewerDesignOptions {
416
619
  maxReportedResources?: number;
417
620
  maxReportedArtboards?: number;
418
621
  };
622
+ /** Safety and bounded first-frame reconstruction limits for modern ZIP/XFL-based Animate FLA files. */
419
623
  fla?: {
420
624
  maxFileBytes?: number;
421
625
  maxEntries?: number;
@@ -448,6 +652,7 @@ export interface FileViewerDesignOptions {
448
652
  maxPreviewPixels?: number;
449
653
  maxSymbolDepth?: number;
450
654
  };
655
+ /** Safety limits for native INDD/INDT master-page, contiguous-object, XMP, and thumbnail reads. */
451
656
  inDesign?: {
452
657
  maxFileBytes?: number;
453
658
  maxDatabasePages?: number;
@@ -463,10 +668,29 @@ export interface FileViewerDesignOptions {
463
668
  export type FileViewerGeoBasemapPreset = 'none' | 'offline' | 'openfreemap' | 'openfreemap-liberty' | 'openfreemap-bright' | 'openfreemap-positron' | 'openfreemap-dark' | 'openfreemap-fiord' | 'osm-raster' | 'tianditu-vector' | 'tianditu-imagery' | 'tianditu-terrain';
464
669
  export type FileViewerTiandituMapStyle = 'vector' | 'imagery' | 'terrain';
465
670
  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
+ */
466
677
  type?: 'raster' | 'vector-style' | 'tianditu';
678
+ /**
679
+ * Raster XYZ/TMS tile template, for example `/tiles/{z}/{x}/{y}.png`.
680
+ */
467
681
  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
+ */
468
686
  styleUrl?: string;
687
+ /**
688
+ * Inline MapLibre style object for fully offline deployments.
689
+ */
469
690
  style?: Record<string, unknown>;
691
+ /**
692
+ * Human-readable label shown in the geo preview details panel.
693
+ */
470
694
  label?: string;
471
695
  attribution?: string;
472
696
  tileSize?: number;
@@ -474,23 +698,86 @@ export interface FileViewerGeoBasemapOptions {
474
698
  maxZoom?: number;
475
699
  scheme?: 'xyz' | 'tms';
476
700
  rasterOpacity?: number;
701
+ /** Tianditu API token. Required when `type` is `tianditu`. */
477
702
  token?: string;
703
+ /** Tianditu map family. Defaults to `vector`. */
478
704
  mapStyle?: FileViewerTiandituMapStyle;
705
+ /** Include the matching Tianditu annotation layer. Defaults to true. */
479
706
  labels?: boolean;
480
707
  }
481
708
  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
+ */
482
716
  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
+ */
483
722
  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
+ */
484
731
  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
+ */
485
736
  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
+ */
486
742
  inferProjection?: boolean;
743
+ /**
744
+ * Defaults to true. Disable only for environments without reliable WebGL,
745
+ * where the SVG fallback is preferred.
746
+ */
487
747
  preferMapEngine?: boolean;
748
+ /**
749
+ * Padding in CSS pixels when fitting the dataset bounds in the map viewport.
750
+ */
488
751
  fitPadding?: number;
489
752
  }
490
753
  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
+ */
491
762
  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
+ */
492
768
  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
+ */
493
777
  plantumlServerUrl?: string;
778
+ /**
779
+ * Request timeout for server-rendered PlantUML SVG.
780
+ */
494
781
  plantumlTimeoutMs?: number;
495
782
  }
496
783
  export type FileViewerCadRenderer = 'auto' | 'webgl' | 'canvas2d';
@@ -505,19 +792,32 @@ export interface FileViewerCadOptions {
505
792
  useWorker?: boolean;
506
793
  workerTimeoutMs?: number;
507
794
  renderer?: FileViewerCadRenderer;
795
+ /** Initial CAD color policy. `monochrome` applies one plot color without mutating source data. */
508
796
  colorMode?: FileViewerCadColorMode;
797
+ /** CSS color used by monochrome mode. Defaults to black (#000000). */
509
798
  monochromeColor?: string;
799
+ /** Shows the CAD toolbar color-mode toggle. Defaults to true. */
510
800
  showColorModeToggle?: boolean;
801
+ /** Show native PNG/JPEG snapshot downloads. Download/export permissions still apply. */
511
802
  showImageExport?: boolean;
512
803
  preferDwgWasm?: boolean;
513
804
  includePaperSpace?: boolean;
514
805
  maxInsertDepth?: number;
515
806
  keepRaw?: boolean;
516
807
  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
+ */
517
813
  fitMode?: FileViewerCadFitMode;
814
+ /**
815
+ * Fraction of the CAD viewport used by fit-to-view. Defaults to 0.92.
816
+ */
518
817
  fitPadding?: number;
519
818
  dwfPreferWebgl?: boolean;
520
819
  dwfPreferWasm?: boolean;
820
+ /** Explicit DWF background override; otherwise follows the current color mode. */
521
821
  dwfBackground?: string;
522
822
  dwfMaxDevicePixelRatio?: number;
523
823
  dwfMaxCanvasPixels?: number;
@@ -528,12 +828,19 @@ export interface FileViewerCadOptions {
528
828
  dwfMaxOverviewStrokeCssPx?: number;
529
829
  dwfMinTextCssPx?: number;
530
830
  dwfMinFilledAreaCssPx?: number;
831
+ /** Default background is dark for source colors and white for monochrome. Explicit colors are retained. */
531
832
  canvasOptions?: Record<string, unknown>;
532
833
  }
533
834
  export type FileViewerRendererMode = 'extend' | 'replace';
534
835
  export type FileViewerBuiltinRendererPreset = 'all' | 'lite' | 'none';
535
836
  export type FileViewerRendererPresetName = 'all' | 'lite' | 'standard' | 'office' | 'engineering';
536
837
  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
+ */
537
844
  enabled?: boolean;
538
845
  }
539
846
  export interface FileViewerSearchOptions {
@@ -553,23 +860,83 @@ export interface FileViewerAiOptions {
553
860
  chunkOverlap?: number;
554
861
  }
555
862
  export interface FileViewerTextOptions {
863
+ /** Initial HTML/HTM view. Preview is static, sandboxed, and offline; defaults to preview. */
556
864
  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
+ */
557
872
  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
+ */
558
881
  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
+ */
559
887
  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
+ */
560
893
  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
+ */
561
898
  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
+ */
562
903
  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
+ */
563
908
  prettyPrintMaxBytes?: number;
909
+ /** Switches text and code to bounded virtual rendering above this byte size. Defaults to 512 KiB. */
564
910
  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
+ */
565
916
  markdownVirtualizeAboveBytes?: number;
917
+ /** Highlights fenced Markdown code with a declared language. Defaults to true; bounded to 512 KiB of code per document. */
566
918
  markdownHighlight?: boolean;
919
+ /** Maximum source bytes mounted for one very long logical line at a time. Defaults to 16 KiB. */
567
920
  maxRenderedLineBytes?: number;
921
+ /** Extra logical lines mounted above and below the visible viewport. Defaults to 12. */
568
922
  virtualOverscanLines?: number;
569
923
  }
570
924
  export type FileViewerUiDensity = 'comfortable' | 'compact';
571
925
  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
+ */
572
930
  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
+ */
573
940
  surfaceBackground?: string;
574
941
  }
575
942
  export interface FileViewerDiagnostic {
@@ -580,18 +947,79 @@ export interface FileViewerDiagnostic {
580
947
  }
581
948
  export interface FileViewerOptions {
582
949
  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
+ */
583
954
  zoomGestures?: boolean | {
584
955
  wheel?: boolean;
585
956
  pinch?: boolean;
586
957
  };
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
+ */
587
964
  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
+ */
588
970
  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
+ */
589
975
  messages?: FileViewerMessages;
590
976
  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
+ */
591
985
  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
+ */
592
995
  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
+ */
593
1001
  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
+ */
594
1018
  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
+ */
595
1023
  presets?: FileViewerRendererPresetInput;
596
1024
  renderers?: FileViewerRendererPluginInput;
597
1025
  watermark?: boolean | FileViewerWatermarkOptions;
@@ -600,25 +1028,47 @@ export interface FileViewerOptions {
600
1028
  search?: boolean | FileViewerSearchOptions;
601
1029
  ai?: boolean | FileViewerAiOptions;
602
1030
  text?: FileViewerTextOptions;
1031
+ /**
1032
+ * Explicit content fitting strategy. When omitted, each renderer keeps its
1033
+ * historical first-screen behavior for backward compatibility.
1034
+ */
603
1035
  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
+ */
604
1044
  initialViewState?: FileViewerViewState;
605
1045
  archive?: FileViewerArchiveOptions;
606
1046
  chm?: FileViewerChmOptions;
607
1047
  pdf?: FileViewerPdfOptions;
1048
+ epub?: FileViewerEpubOptions;
608
1049
  docx?: FileViewerDocxOptions;
609
1050
  presentation?: FileViewerPresentationOptions;
610
1051
  spreadsheet?: FileViewerSpreadsheetOptions;
1052
+ /** Image renderer controls; also applies to multipage TIFF previews. */
611
1053
  image?: {
1054
+ /** Enable mouse drag panning of overflowing images. Defaults to false; touch scrolling and lightbox clicks are preserved. */
1055
+ 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
+ */
612
1060
  rotation?: boolean;
613
1061
  };
614
1062
  iwork?: FileViewerIworkOptions;
615
1063
  wordPerfect?: FileViewerWordPerfectOptions;
616
1064
  hangul?: FileViewerHangulOptions;
1065
+ /** Receives non-fatal routing, fallback, and capability diagnostics. */
617
1066
  onDiagnostic?: (diagnostic: FileViewerDiagnostic) => void;
618
1067
  typst?: FileViewerTypstOptions;
619
1068
  geo?: FileViewerGeoOptions;
620
1069
  data?: FileViewerDataOptions;
621
1070
  binary?: FileViewerBinaryInspectorOptions;
1071
+ /** Configuration for the explicitly installed XML profile renderer. */
622
1072
  xml?: FileViewerXmlOptions;
623
1073
  design?: FileViewerDesignOptions;
624
1074
  drawing?: FileViewerDrawingOptions;
@@ -727,6 +1177,7 @@ export interface FileViewerNavigationState {
727
1177
  visible?: boolean;
728
1178
  mode?: string;
729
1179
  }
1180
+ /** Zero-based workbook sheet id and inclusive cell bounds. */
730
1181
  export interface FileViewerSpreadsheetRange {
731
1182
  sheetId: number;
732
1183
  startRow: number;
@@ -736,7 +1187,9 @@ export interface FileViewerSpreadsheetRange {
736
1187
  }
737
1188
  export type FileViewerSpreadsheetNavigationStatus = 'idle' | 'pending' | 'applied' | 'rejected' | 'cancelled' | 'failed' | 'disposed';
738
1189
  export interface FileViewerViewState {
1190
+ /** Coordinate navigation for spreadsheets; does not edit or select cell contents. */
739
1191
  spreadsheet?: {
1192
+ /** Active workbook sheet id, retained for restoring views without a range. */
740
1193
  sheetId?: number;
741
1194
  range?: FileViewerSpreadsheetRange;
742
1195
  status?: FileViewerSpreadsheetNavigationStatus;
@@ -893,22 +1346,31 @@ export interface FileViewerExportHtmlOptions {
893
1346
  title?: string;
894
1347
  watermarkInlineStyle?: string;
895
1348
  }
1349
+ /** Normalized print-mask rectangle in percent of the rendered content box. */
896
1350
  export interface FileViewerPrintMaskRegion {
897
1351
  left: number;
898
1352
  top: number;
899
1353
  width: number;
900
1354
  height: number;
1355
+ /** Zero-based rendered page index. Omitted regions retain legacy whole-document coordinates. */
901
1356
  pageIndex?: number;
902
1357
  }
1358
+ /** Page-aware image placed above rendered content for printing, such as a seal or signature. */
903
1359
  export interface FileViewerPrintStamp extends FileViewerPrintMaskRegion {
1360
+ /** Image URL. Uploaded stamps are converted to a local data URL by the designer. */
904
1361
  src: string;
1362
+ /** Image opacity from 0 to 1. Defaults to 1. */
905
1363
  opacity?: number;
1364
+ /** Clockwise rotation in degrees. Defaults to 0. */
906
1365
  rotate?: number;
907
1366
  alt?: string;
908
1367
  }
909
1368
  export interface FileViewerPrintMaskOptions {
1369
+ /** Solid black cover blocks, matching common OFD/business redaction UX. */
910
1370
  regions?: FileViewerPrintMaskRegion[];
1371
+ /** Image overlays, including locally uploaded seals and signatures. */
911
1372
  stamps?: FileViewerPrintStamp[];
1373
+ /** Fill color for print masks. Defaults to opaque black. */
912
1374
  color?: string;
913
1375
  }
914
1376
  export interface FileViewerPrintOptions {
@@ -917,6 +1379,7 @@ export interface FileViewerPrintOptions {
917
1379
  printWindow?: Window | null;
918
1380
  title?: string;
919
1381
  watermarkInlineStyle?: string;
1382
+ /** Optional print-time cover masks applied above content and below watermark. */
920
1383
  mask?: FileViewerPrintMaskOptions | null;
921
1384
  }
922
1385
  export interface FileViewerSource {
@@ -966,15 +1429,28 @@ export interface RendererDefinition {
966
1429
  label: string;
967
1430
  category: FileViewerRendererCategory;
968
1431
  extensions: readonly string[];
1432
+ /** Optional compound filename claims such as tileset.json or *.copc.laz. */
969
1433
  filenamePatterns?: readonly string[];
1434
+ /** Prefer passing the original URL to the renderer instead of eagerly downloading it. */
970
1435
  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
+ */
971
1441
  resolveSourceType?: RendererSourceTypeProbe;
972
1442
  async?: boolean;
1443
+ /** Product-level fidelity contract generated from ecosystem/format-catalog.json. */
973
1444
  supportLevel?: FileViewerFormatSupportLevel;
1445
+ /** Experimental formats are routable but are excluded from stable support counts. */
974
1446
  status?: FileViewerFormatStatus;
1447
+ /** Owning on-demand renderer package. */
975
1448
  packageName?: string;
1449
+ /** Presets that assemble this renderer. */
976
1450
  presets?: readonly FileViewerRendererPresetName[];
1451
+ /** Existing renderer whose fallback extensions this specialist replaces when installed. */
977
1452
  enhancesRendererId?: string;
1453
+ /** Extensions transferred from enhancesRendererId to this specialist when installed. */
978
1454
  enhancesExtensions?: readonly string[];
979
1455
  containerVersions?: readonly string[];
980
1456
  knownLimits?: readonly string[];
@@ -1048,6 +1524,7 @@ export interface FileViewerLoadOptions {
1048
1524
  }
1049
1525
  export interface FileViewerInstance {
1050
1526
  readonly container: HTMLElement;
1527
+ /** Installs configured renderer plugins without loading a document. */
1051
1528
  prepare?(): Promise<void>;
1052
1529
  load(source: FileViewerSource, options?: FileViewerLoadOptions): Promise<RendererSession | null>;
1053
1530
  unload?(reason?: FileViewerLifecycleContext['reason']): Promise<void>;
@@ -1063,6 +1540,7 @@ export interface FileViewerInstance {
1063
1540
  download(options?: FileViewerDownloadOptions): Promise<void>;
1064
1541
  exportHtml(options?: FileViewerExportHtmlOptions): Promise<string>;
1065
1542
  print(options?: FileViewerPrintOptions): Promise<void>;
1543
+ /** Open the async print-mask designer, then print with the chosen covers. */
1066
1544
  printWithMask(options?: FileViewerPrintOptions): Promise<void>;
1067
1545
  zoomIn(): Promise<FileViewerZoomState>;
1068
1546
  zoomOut(): Promise<FileViewerZoomState>;