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