@file-viewer/core 2.4.0 → 3.0.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.
- package/README.en.md +18 -1
- package/README.md +18 -1
- package/dist/config/options.js +9 -3
- package/dist/contracts/types.d.ts +249 -9
- package/dist/export.d.ts +10 -0
- package/dist/export.js +9 -0
- package/dist/exportDocument.d.ts +36 -0
- package/dist/exportDocument.js +894 -0
- package/dist/features/document/zoom.d.ts +1 -0
- package/dist/features/document/zoom.js +3 -0
- package/dist/features/printMask.js +138 -13
- package/dist/headless.d.ts +2 -2
- package/dist/headless.js +1 -1
- package/dist/i18n/messages.de.js +3 -0
- package/dist/i18n/messages.ja.js +3 -0
- package/dist/i18n/messages.js +6 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.js +3 -2
- package/dist/output/export.d.ts +3 -24
- package/dist/output/export.js +27 -372
- package/dist/output/printLayout.js +10 -0
- package/dist/platform/assets.d.ts +69 -2
- package/dist/platform/assets.js +532 -29
- package/dist/registry/capabilities.d.ts +2 -2
- package/dist/registry/formats.d.ts +4 -4
- package/dist/registry/formats.generated.d.ts +273 -20
- package/dist/registry/formats.generated.js +463 -2
- package/dist/registry/registry.js +153 -11
- package/dist/renderers/index.d.ts +270 -17
- package/dist/security/svgResources.d.ts +13 -0
- package/dist/security/svgResources.js +177 -0
- package/dist/viewer/createViewer.js +42 -0
- package/dist/viewer/operations.d.ts +1 -0
- package/dist/viewer/operations.js +68 -5
- package/dist/viewer/state.js +1 -0
- package/package.json +9 -1
package/README.en.md
CHANGED
|
@@ -66,9 +66,26 @@ const viewer = createViewer(document.querySelector('#viewer')!, {
|
|
|
66
66
|
await viewer.load({ url: '/files/report.pdf' })
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
+
HTML document builders live in the opt-in export entry so ordinary previews do
|
|
70
|
+
not download the sanitizer. The viewer's `exportHtml()` and `print()` methods
|
|
71
|
+
load this entry only when invoked. For v3, migrate direct builder imports from
|
|
72
|
+
the package root to the explicit subpath:
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
import {
|
|
76
|
+
buildExportHtmlDocument,
|
|
77
|
+
buildFileViewerRenderedHtmlDocument
|
|
78
|
+
} from '@file-viewer/core/export'
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The deprecated Vue 3 template re-exports are asynchronous in v3 to preserve
|
|
82
|
+
this lazy boundary, so legacy calls must use `await buildExportHtmlDocument(...)`
|
|
83
|
+
or `await collectDocumentStyles()`. Direct imports from the `export` subpath
|
|
84
|
+
keep their documented return types.
|
|
85
|
+
|
|
69
86
|
`options.styleIsolation` accepts `auto`, `shadow`, `scoped`, or `none`. Use `shadow` when a custom host or framework wrapper needs a ShadowRoot-backed render surface. Core passes the resolved `surface` to renderer `load(context)`, so custom renderers should inject styles into `context.surface.shadowRoot` or the renderer container instead of `document.head`, and should mount overlays inside the same isolated surface when possible.
|
|
70
87
|
|
|
71
|
-
The root `@file-viewer/core` entry remains the
|
|
88
|
+
The root `@file-viewer/core` entry remains the normal browser-compatible entry. New component packages should prefer the narrowest explicit entry point they need: `headless` for contracts and build-time helpers, `browser` for real browser preview, and `export` for sanitized standalone HTML documents.
|
|
72
89
|
|
|
73
90
|
```ts
|
|
74
91
|
import {
|
package/README.md
CHANGED
|
@@ -66,9 +66,26 @@ const viewer = createViewer(document.querySelector('#viewer')!, {
|
|
|
66
66
|
await viewer.load({ url: '/files/report.pdf' })
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
+
HTML document builders live in the opt-in export entry so ordinary previews do
|
|
70
|
+
not download the sanitizer. The viewer's `exportHtml()` and `print()` methods
|
|
71
|
+
load this entry only when invoked. For v3, migrate direct builder imports from
|
|
72
|
+
the package root to the explicit subpath:
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
import {
|
|
76
|
+
buildExportHtmlDocument,
|
|
77
|
+
buildFileViewerRenderedHtmlDocument
|
|
78
|
+
} from '@file-viewer/core/export'
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Vue 3 模板中已弃用的兼容导出在 v3 中改为异步,以保持这条懒加载边界;
|
|
82
|
+
旧调用需要使用 `await buildExportHtmlDocument(...)` 或
|
|
83
|
+
`await collectDocumentStyles()`。直接从 `export` 子路径导入时,返回类型仍
|
|
84
|
+
按该子路径的 API 文档保持不变。
|
|
85
|
+
|
|
69
86
|
`options.styleIsolation` accepts `auto`, `shadow`, `scoped`, or `none`. Use `shadow` when a custom host or framework wrapper needs a ShadowRoot-backed render surface. Core passes the resolved `surface` to renderer `load(context)`, so custom renderers should inject styles into `context.surface.shadowRoot` or the renderer container instead of `document.head`, and should mount overlays inside the same isolated surface when possible.
|
|
70
87
|
|
|
71
|
-
The root `@file-viewer/core` entry remains the
|
|
88
|
+
The root `@file-viewer/core` entry remains the normal browser-compatible entry. New component packages should prefer the narrowest explicit entry point they need: `headless` for contracts and build-time helpers, `browser` for real browser preview, and `export` for sanitized standalone HTML documents.
|
|
72
89
|
|
|
73
90
|
```ts
|
|
74
91
|
import {
|
package/dist/config/options.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const UNSAFE_JSON_KEYS = new Set(['__proto__', 'constructor', 'prototype']);
|
|
1
2
|
const isRecord = (value) => {
|
|
2
3
|
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
3
4
|
};
|
|
@@ -31,14 +32,19 @@ const sanitizeJsonValue = (value) => {
|
|
|
31
32
|
if (!isRecord(value)) {
|
|
32
33
|
return undefined;
|
|
33
34
|
}
|
|
34
|
-
const
|
|
35
|
+
const outputEntries = [];
|
|
35
36
|
Object.entries(value).forEach(([key, nextValue]) => {
|
|
37
|
+
if (UNSAFE_JSON_KEYS.has(key)) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
36
40
|
const sanitized = sanitizeJsonValue(nextValue);
|
|
37
41
|
if (sanitized !== undefined) {
|
|
38
|
-
|
|
42
|
+
outputEntries.push([key, sanitized]);
|
|
39
43
|
}
|
|
40
44
|
});
|
|
41
|
-
return
|
|
45
|
+
return outputEntries.length
|
|
46
|
+
? Object.fromEntries(outputEntries)
|
|
47
|
+
: undefined;
|
|
42
48
|
};
|
|
43
49
|
const stripExecutionOnlyOptions = (value) => {
|
|
44
50
|
const { beforeOperation: _beforeOperation, hooks: _hooks, preset: _preset, presets: _presets, renderers: _renderers, rendererMode: _rendererMode, ...rest } = value;
|
|
@@ -3,7 +3,7 @@ export type FileViewerThemeMode = 'light' | 'dark' | 'system';
|
|
|
3
3
|
export type FileViewerResolvedThemeMode = Exclude<FileViewerThemeMode, 'system'>;
|
|
4
4
|
export type FileViewerLocale = 'auto' | 'zh-CN' | 'en-US' | 'ja-JP' | 'de-DE' | (string & {});
|
|
5
5
|
export type FileViewerStyleIsolation = 'auto' | 'shadow' | 'scoped' | 'none';
|
|
6
|
-
export type FileViewerMessageKey = 'toolbar.zoomGroup' | 'toolbar.zoomOut' | 'toolbar.zoomIn' | 'toolbar.zoomReset' | 'toolbar.download' | 'toolbar.downloadTitle' | 'toolbar.print' | 'toolbar.printTitle' | 'toolbar.printDirect' | 'toolbar.printMask' | 'toolbar.printMaskTitle' | 'toolbar.printMaskAdd' | 'toolbar.printMaskClear' | 'toolbar.printMaskCancel' | 'toolbar.printMaskConfirm' | 'toolbar.printMaskHint' | 'toolbar.printStampUpload' | 'toolbar.printStampRemove' | 'toolbar.printStampResize' | 'toolbar.exportHtml' | 'toolbar.exportHtmlTitle' | 'toolbar.search' | 'toolbar.searchPlaceholder' | 'toolbar.searchPrevious' | 'toolbar.searchNext' | 'toolbar.searchClear' | 'toolbar.theme' | 'toolbar.themeToLight' | 'toolbar.themeToDark' | 'state.ready.title' | 'state.ready.message' | 'state.empty.title' | 'state.empty.message' | 'state.unsupported.install.title' | 'state.unsupported.install.message' | 'state.unsupported.install.description' | 'state.unsupported.title' | 'state.unsupported.message' | 'state.unsupported.description' | 'state.error.title' | 'preview.downloading' | 'preview.streamingPdf' | 'preview.reading' | 'error.download' | 'error.print' | 'error.exportHtml' | 'error.noDownloadSource' | 'error.noExportContent' | 'error.printUnavailable' | 'error.printWindowBlocked' | 'error.remoteDownload' | 'error.localRead' | 'error.load' | 'error.stream' | 'error.beforeOperation' | 'error.unknown' | 'error.blobUnavailable' | 'error.sourceUnsupported' | 'error.fileReadArrayBuffer' | 'error.fileReadDataUrl' | 'error.fileReadText' | 'error.imageDataUrlRead' | 'operation.download' | 'operation.print' | 'operation.exportHtml' | 'operation.zoomIn' | 'operation.zoomOut' | 'operation.zoomReset' | 'pdf.toolbar.toggleNavigation' | 'pdf.toolbar.previousPage' | 'pdf.toolbar.nextPage' | 'pdf.toolbar.fitWidth' | 'pdf.toolbar.zoomOut' | 'pdf.toolbar.zoomIn' | 'pdf.toolbar.rotateLeft' | 'pdf.toolbar.rotateRight' | 'pdf.nav.typeLabel' | 'pdf.nav.pagesTab' | 'pdf.nav.outlineTab' | 'pdf.nav.pagesTitle' | 'pdf.nav.outlineTitle' | 'pdf.nav.pageCount' | 'pdf.nav.itemCount' | 'pdf.nav.pageLabel' | 'pdf.nav.outlineEmpty' | 'pdf.nav.outlineFallbackTitle' | 'pdf.thumbnail.alt' | 'pdf.state.loading' | 'pdf.error.browserWindow' | 'pdf.error.missingSource' | 'pdf.error.loadFailed' | 'pdf.error.notLoaded' | 'pdf.error.unloaded' | 'pdf.error.canvasUnavailable' | 'pdf.export.pageTitle' | 'spreadsheet.loading.kicker' | 'spreadsheet.loading.title' | 'spreadsheet.loading.hint' | 'spreadsheet.loading.streaming' | 'spreadsheet.tabs.ariaLabel' | 'spreadsheet.state.parsingWorkbook' | 'spreadsheet.state.preparingSheet' | 'spreadsheet.state.preparingSheetNamed' | 'spreadsheet.state.cachedRows' | 'spreadsheet.state.rows' | 'spreadsheet.state.rowsAndColumns' | 'spreadsheet.error.parseFailed' | 'spreadsheet.error.workerFailed' | 'word.error.invalidDocx' | 'word.error.missingOdfContent' | 'word.error.odfXmlParseFailed' | 'word.title.rtf' | 'word.title.openDocumentPresentation' | 'word.title.openDocumentText' | 'word.page.fallback' | 'word.page.empty' | 'word.body' | 'word.body.empty' | 'ofd.toolbar.pageNavigation' | 'ofd.toolbar.documentPages' | 'ofd.toolbar.previousPage' | 'ofd.toolbar.nextPage' | 'ofd.toolbar.pageStatus' | 'ofd.toolbar.noPages' | 'ofd.state.loading' | 'ofd.error.empty' | 'ofd.error.parseFailed' | 'presentation.state.loading' | 'presentation.error.title' | 'presentation.error.parseFailed' | 'presentation.ppt.state.loading' | 'presentation.ppt.error.title' | 'presentation.ppt.error.parseFailed' | 'presentation.ppt.error.assetHint' | 'presentation.slideshow.start' | 'presentation.slideshow.exit' | 'presentation.slideshow.hint' | 'archive.error.nestedUnsupported' | 'archive.loading.readingDirectory' | 'archive.loading.readingDirectoryHint' | 'archive.search.placeholder' | 'archive.sidebar.hide' | 'archive.sidebar.show' | 'archive.preview.title' | 'archive.preview.chooseFile' | 'archive.preview.downloadFile' | 'archive.error.title' | 'archive.stats.summary' | 'archive.warning.encrypted' | 'archive.password.title' | 'archive.password.description' | 'archive.password.placeholder' | 'archive.password.invalid' | 'archive.password.required' | 'archive.password.cancel' | 'archive.password.confirm' | 'archive.error.passwordRequired' | 'archive.error.encryptedRequiresWorker' | 'archive.empty.title' | 'archive.empty.message' | 'archive.loading.initializingCandidate' | 'archive.loading.initializingCandidateHint' | 'archive.error.candidateInitTimeout' | 'archive.error.encryptedCheckTimeout' | 'archive.loading.directoryReadyHint' | 'archive.error.candidateReadTimeout' | 'archive.loading.workerFallback' | 'archive.loading.workerFallbackHint' | 'archive.notice.workerFallback' | 'archive.error.tooLarge' | 'archive.loading.initializingWorker' | 'archive.loading.initializingWorkerHint' | 'archive.error.workerInitFailed' | 'archive.error.workerUnsupported' | 'archive.error.indexedDbUnavailable' | 'archive.error.entryTooLarge' | 'archive.loading.extracting' | 'archive.loading.rendering' | 'archive.loading.exporting' | 'media.audio.title' | 'media.audio.description' | 'media.audio.unsupported' | 'media.video.title' | 'media.video.unsupported' | 'media.video.hlsHint' | 'media.video.codecUnsupportedBadge' | 'media.video.codecUnsupportedTitle' | 'media.video.codecUnsupportedDescription' | 'media.video.codecUnsupportedAction' | 'media.video.softwareLoading' | 'media.video.softwareBadge' | 'media.video.play' | 'media.video.pause' | 'media.video.seek' | 'media.video.mute' | 'media.video.unmute' | 'media.video.fullscreen' | 'media.midi.title' | 'media.midi.loading' | 'media.midi.trackHeader' | 'media.midi.instrumentHeader' | 'media.midi.channelHeader' | 'media.midi.noteCountHeader' | 'media.midi.durationHeader' | 'media.midi.durationStat' | 'media.midi.trackStat' | 'media.midi.noteStat' | 'media.midi.parseFailed' | 'email.mbox.subject' | 'email.mbox.summary' | 'email.error.title' | 'email.meta.from' | 'email.meta.to' | 'email.meta.cc' | 'email.meta.date' | 'email.tabs.text' | 'email.tabs.headers' | 'email.attachments.title' | 'email.attachments.empty' | 'email.attachments.download' | 'email.attachments.opening' | 'email.attachments.nestedUnavailable' | 'email.loading.parsing' | 'data.font.sample' | 'data.error.fontFaceUnsupported' | 'data.title.font' | 'data.title.sqlite' | 'data.title.parquet' | 'data.title.avro' | 'data.title.wasm' | 'data.title.eps' | 'data.title.ai' | 'data.title.webarchive' | 'data.title.summary' | 'data.label.format' | 'data.label.size' | 'data.label.rendering' | 'data.label.objects' | 'data.label.sampleTable' | 'data.label.rows' | 'data.label.columns' | 'data.label.sampleRows' | 'data.label.imports' | 'data.label.exports' | 'data.label.magic' | 'data.label.note' | 'data.label.container' | 'data.value.schemaRead' | 'data.value.schemaUnread' | 'data.note.aiSummary' | 'data.note.postscriptSummary' | 'data.note.webarchive' | 'data.image.alt' | 'psd.title' | 'psd.action.fit' | 'psd.action.showAll' | 'psd.action.hideAll' | 'psd.layers.title' | 'psd.layers.redrawable' | 'psd.layers.empty' | 'psd.layers.hidden' | 'drawing.error.viewerLoadFailed' | 'drawing.error.excalidrawEmpty' | 'drawing.error.excalidrawTimeout' | 'drawing.error.drawioParseFailed' | 'drawing.error.drawioNoModel' | 'drawing.error.drawioNoElements' | 'drawing.error.viewerInitFailed' | 'drawing.error.drawioTimeout' | 'drawing.error.svgParseFailed' | 'drawing.error.plantumlRenderFailed' | 'drawing.title.excalidraw' | 'drawing.title.mermaid' | 'drawing.title.plantuml' | 'drawing.title.drawio' | 'drawing.toolbar.zoomOut' | 'drawing.toolbar.zoomIn' | 'drawing.toolbar.fit' | 'drawing.toolbar.fitWidth' | 'drawing.state.loading' | 'text.code.loadingHighlight' | 'text.code.indexingLargeFile' | 'text.code.virtualized' | 'text.code.firstSegment' | 'text.code.previousSegment' | 'text.code.nextSegment' | 'text.code.lastSegment' | 'ebook.toc' | 'ebook.reading' | 'ebook.itemCount' | 'epub.title' | 'epub.previousPage' | 'epub.nextPage' | 'epub.loading' | 'epub.chapterFallback' | 'epub.renderIncomplete' | 'umd.title' | 'umd.previousChapter' | 'umd.nextChapter' | 'umd.loading' | 'umd.emptyContent' | 'umd.chapterFallback' | 'umd.galleryFallback' | 'umd.warningBodyTooShort' | 'umd.error.unexpectedEnd' | 'umd.error.invalidFile' | 'typst.summaryRenderer' | 'typst.pageSummary.empty' | 'typst.pageSummary.ready' | 'typst.status.compiling' | 'typst.status.failed' | 'typst.status.rendered' | 'typst.loading.title' | 'typst.loading.hint' | 'typst.error.title' | 'typst.error.timeout' | 'typst.error.timeoutHint' | 'typst.error.assetHint' | 'typst.error.svgParseFailed' | 'typst.error.wasmLoadFailed' | 'xmind.toolbar.zoomOut' | 'xmind.toolbar.zoomIn' | 'xmind.toolbar.fit' | 'xmind.toolbar.fitTitle' | 'xmind.state.loading' | 'xmind.stats.nodes' | 'xmind.stats.depth' | 'xmind.stats.theme' | 'xmind.stats.template' | 'xmind.badge.paused' | 'xmind.badge.collapsed' | 'xmind.badge.floating' | 'xmind.badge.summary' | 'xmind.badge.callout' | 'xmind.imageResource' | 'xmind.error.unrecognized' | 'xmind.error.noCanvas' | 'cad.toolbar.fit' | 'cad.toolbar.zoomOut' | 'cad.toolbar.zoomIn' | 'cad.layers.title' | 'cad.layers.count' | 'cad.layers.merged' | 'cad.inspector.title' | 'cad.inspector.entities' | 'cad.inspector.blocks' | 'cad.inspector.pages' | 'cad.inspector.drawn' | 'cad.state.loadingViewer' | 'cad.state.parsing' | 'cad.error.parseFailed' | 'image.alt' | 'image.toolbar.rotation' | 'image.toolbar.rotateLeft' | 'image.toolbar.rotateRight' | 'image.lightbox.alt' | 'image.lightbox.close' | 'gitBundle.error.invalid' | 'gitBundle.error.missingPack' | 'gitBundle.notice.delta' | 'gitBundle.title.history' | 'gitBundle.title.fileTree' | 'gitBundle.file.choose' | 'gitBundle.file.noTree' | 'gitBundle.file.none' | 'gitBundle.history.empty' | 'gitBundle.toolbar.summary' | 'gitBundle.meta.bundle' | 'gitBundle.meta.refs' | 'gitBundle.meta.commits' | 'gitBundle.meta.objects' | 'gitBundle.meta.deltas' | 'gitBundle.meta.objectFormat' | 'gitBundle.meta.objectTypes' | 'geo.error.unrecognized' | 'geo.error.xmlParseFailed' | 'geo.error.unsupported' | 'geo.title' | 'geo.featureCount' | 'geo.bounds' | 'geo.geometryTypes' | 'geo.aria' | 'geo.loading' | 'geo.projection' | 'geo.engine' | 'geo.basemap' | 'geo.basemap.offline' | 'geo.basemap.custom' | 'geo.engine.maplibre' | 'geo.engine.svg' | 'geo.error.projection' | 'geo.action.fit' | 'model.toolbar.fit' | 'model.toolbar.rotate' | 'model.toolbar.wireframe' | 'model.toolbar.grid' | 'model.toolbar.axes' | 'model.state.loadingSummary' | 'model.state.loading' | 'model.state.loaded' | 'model.state.parseFailed' | 'model.summary.meshes' | 'model.summary.points' | 'model.error.daeEmpty' | 'model.error.unsupported' | 'model.error.parseFailed' | 'model.notice.signature' | 'loading.generic.label' | 'loading.generic.hint' | 'loading.word.label' | 'loading.word.hint' | 'loading.wordWorker.hint' | 'loading.sheet.label' | 'loading.sheet.hint' | 'loading.csv.label' | 'loading.csv.hint' | 'loading.presentation.label' | 'loading.presentation.hint' | 'loading.pdf.label' | 'loading.pdf.hint' | 'loading.ofd.label' | 'loading.ofd.hint' | 'loading.archive.label' | 'loading.archive.hint' | 'loading.email.label' | 'loading.email.hint' | 'loading.msg.hint' | 'loading.eda.label' | 'loading.eda.hint' | 'loading.cad.label' | 'loading.cad.hint' | 'loading.dwg.hint' | 'loading.dwf.hint' | 'loading.dwfx.hint' | 'loading.xps.hint' | 'loading.drawio.label' | 'loading.drawio.hint' | 'loading.excalidraw.label' | 'loading.excalidraw.hint' | 'loading.epub.label' | 'loading.epub.hint' | 'loading.umd.label' | 'loading.umd.hint' | 'loading.image.label' | 'loading.image.hint' | 'loading.video.label' | 'loading.video.hint' | 'loading.audio.label' | 'loading.audio.hint';
|
|
6
|
+
export type FileViewerMessageKey = 'toolbar.zoomGroup' | 'toolbar.zoomOut' | 'toolbar.zoomIn' | 'toolbar.zoomReset' | 'toolbar.download' | 'toolbar.downloadTitle' | 'toolbar.print' | 'toolbar.printTitle' | 'toolbar.printDirect' | 'toolbar.printMask' | 'toolbar.printMaskTitle' | 'toolbar.printMaskAdd' | 'toolbar.printMaskClear' | 'toolbar.printMaskCancel' | 'toolbar.printMaskConfirm' | 'toolbar.printMaskHint' | 'toolbar.printStampUpload' | 'toolbar.printStampRemove' | 'toolbar.printStampResize' | 'toolbar.exportHtml' | 'toolbar.exportHtmlTitle' | 'toolbar.search' | 'toolbar.searchPlaceholder' | 'toolbar.searchPrevious' | 'toolbar.searchNext' | 'toolbar.searchClear' | 'toolbar.theme' | 'toolbar.themeToLight' | 'toolbar.themeToDark' | 'state.ready.title' | 'state.ready.message' | 'state.empty.title' | 'state.empty.message' | 'state.unsupported.install.title' | 'state.unsupported.install.message' | 'state.unsupported.install.description' | 'state.unsupported.title' | 'state.unsupported.message' | 'state.unsupported.description' | 'state.error.title' | 'preview.downloading' | 'preview.streamingPdf' | 'preview.reading' | 'error.download' | 'error.print' | 'error.exportHtml' | 'error.noDownloadSource' | 'error.noExportContent' | 'error.printUnavailable' | 'error.printWindowBlocked' | 'error.remoteDownload' | 'error.localRead' | 'error.load' | 'error.stream' | 'error.beforeOperation' | 'error.unknown' | 'error.blobUnavailable' | 'error.sourceUnsupported' | 'error.fileReadArrayBuffer' | 'error.fileReadDataUrl' | 'error.fileReadText' | 'error.imageDataUrlRead' | 'operation.download' | 'operation.print' | 'operation.exportHtml' | 'operation.zoomIn' | 'operation.zoomOut' | 'operation.zoomReset' | 'pdf.toolbar.toggleNavigation' | 'pdf.toolbar.previousPage' | 'pdf.toolbar.nextPage' | 'pdf.toolbar.fitWidth' | 'pdf.toolbar.zoomOut' | 'pdf.toolbar.zoomIn' | 'pdf.toolbar.rotateLeft' | 'pdf.toolbar.rotateRight' | 'pdf.nav.typeLabel' | 'pdf.nav.pagesTab' | 'pdf.nav.outlineTab' | 'pdf.nav.pagesTitle' | 'pdf.nav.outlineTitle' | 'pdf.nav.pageCount' | 'pdf.nav.itemCount' | 'pdf.nav.pageLabel' | 'pdf.nav.outlineEmpty' | 'pdf.nav.outlineFallbackTitle' | 'pdf.thumbnail.alt' | 'pdf.state.loading' | 'pdf.error.browserWindow' | 'pdf.error.missingSource' | 'pdf.error.loadFailed' | 'pdf.error.notLoaded' | 'pdf.error.unloaded' | 'pdf.error.canvasUnavailable' | 'pdf.export.pageTitle' | 'spreadsheet.loading.kicker' | 'spreadsheet.loading.title' | 'spreadsheet.loading.hint' | 'spreadsheet.loading.streaming' | 'spreadsheet.tabs.ariaLabel' | 'spreadsheet.state.parsingWorkbook' | 'spreadsheet.state.preparingSheet' | 'spreadsheet.state.preparingSheetNamed' | 'spreadsheet.state.cachedRows' | 'spreadsheet.state.rows' | 'spreadsheet.state.rowsAndColumns' | 'spreadsheet.error.parseFailed' | 'spreadsheet.error.workerFailed' | 'word.error.invalidDocx' | 'word.error.missingOdfContent' | 'word.error.odfXmlParseFailed' | 'word.title.rtf' | 'word.title.openDocumentPresentation' | 'word.title.openDocumentText' | 'word.page.fallback' | 'word.page.empty' | 'word.body' | 'word.body.empty' | 'ofd.toolbar.pageNavigation' | 'ofd.toolbar.documentPages' | 'ofd.toolbar.previousPage' | 'ofd.toolbar.nextPage' | 'ofd.toolbar.pageStatus' | 'ofd.toolbar.noPages' | 'ofd.state.loading' | 'ofd.error.empty' | 'ofd.error.parseFailed' | 'presentation.state.loading' | 'presentation.error.title' | 'presentation.error.parseFailed' | 'presentation.ppt.state.loading' | 'presentation.ppt.error.title' | 'presentation.ppt.error.parseFailed' | 'presentation.ppt.error.assetHint' | 'presentation.slideshow.start' | 'presentation.slideshow.exit' | 'presentation.slideshow.hint' | 'archive.error.nestedUnsupported' | 'archive.loading.readingDirectory' | 'archive.loading.readingDirectoryHint' | 'archive.search.placeholder' | 'archive.sidebar.hide' | 'archive.sidebar.show' | 'archive.preview.title' | 'archive.preview.chooseFile' | 'archive.preview.downloadFile' | 'archive.error.title' | 'archive.stats.summary' | 'archive.warning.encrypted' | 'archive.password.title' | 'archive.password.description' | 'archive.password.placeholder' | 'archive.password.invalid' | 'archive.password.required' | 'archive.password.cancel' | 'archive.password.confirm' | 'archive.error.passwordRequired' | 'archive.error.encryptedRequiresWorker' | 'archive.empty.title' | 'archive.empty.message' | 'archive.loading.initializingCandidate' | 'archive.loading.initializingCandidateHint' | 'archive.error.candidateInitTimeout' | 'archive.error.encryptedCheckTimeout' | 'archive.loading.directoryReadyHint' | 'archive.error.candidateReadTimeout' | 'archive.loading.workerFallback' | 'archive.loading.workerFallbackHint' | 'archive.notice.workerFallback' | 'archive.error.tooLarge' | 'archive.loading.initializingWorker' | 'archive.loading.initializingWorkerHint' | 'archive.error.workerInitFailed' | 'archive.error.workerUnsupported' | 'archive.error.indexedDbUnavailable' | 'archive.error.entryTooLarge' | 'archive.loading.extracting' | 'archive.loading.rendering' | 'archive.loading.exporting' | 'media.audio.title' | 'media.audio.description' | 'media.audio.unsupported' | 'media.video.title' | 'media.video.unsupported' | 'media.video.hlsHint' | 'media.video.codecUnsupportedBadge' | 'media.video.codecUnsupportedTitle' | 'media.video.codecUnsupportedDescription' | 'media.video.codecUnsupportedAction' | 'media.video.softwareLoading' | 'media.video.softwareBadge' | 'media.video.play' | 'media.video.pause' | 'media.video.seek' | 'media.video.mute' | 'media.video.unmute' | 'media.video.fullscreen' | 'media.midi.title' | 'media.midi.loading' | 'media.midi.trackHeader' | 'media.midi.instrumentHeader' | 'media.midi.channelHeader' | 'media.midi.noteCountHeader' | 'media.midi.durationHeader' | 'media.midi.durationStat' | 'media.midi.trackStat' | 'media.midi.noteStat' | 'media.midi.parseFailed' | 'email.mbox.subject' | 'email.mbox.summary' | 'email.error.title' | 'email.meta.from' | 'email.meta.to' | 'email.meta.cc' | 'email.meta.date' | 'email.tabs.text' | 'email.tabs.headers' | 'email.attachments.title' | 'email.attachments.empty' | 'email.attachments.download' | 'email.attachments.opening' | 'email.attachments.nestedUnavailable' | 'email.loading.parsing' | 'data.font.sample' | 'data.error.fontFaceUnsupported' | 'data.title.font' | 'data.title.sqlite' | 'data.title.parquet' | 'data.title.avro' | 'data.title.wasm' | 'data.title.eps' | 'data.title.ai' | 'data.title.webarchive' | 'data.title.summary' | 'data.label.format' | 'data.label.size' | 'data.label.rendering' | 'data.label.objects' | 'data.label.sampleTable' | 'data.label.rows' | 'data.label.columns' | 'data.label.sampleRows' | 'data.label.imports' | 'data.label.exports' | 'data.label.magic' | 'data.label.note' | 'data.label.container' | 'data.value.schemaRead' | 'data.value.schemaUnread' | 'data.note.aiSummary' | 'data.note.postscriptSummary' | 'data.note.webarchive' | 'data.image.alt' | 'psd.title' | 'psd.action.fit' | 'psd.action.showAll' | 'psd.action.hideAll' | 'psd.layers.title' | 'psd.layers.redrawable' | 'psd.layers.empty' | 'psd.layers.hidden' | 'drawing.error.viewerLoadFailed' | 'drawing.error.excalidrawEmpty' | 'drawing.error.excalidrawTimeout' | 'drawing.error.drawioParseFailed' | 'drawing.error.drawioNoModel' | 'drawing.error.drawioNoElements' | 'drawing.error.viewerInitFailed' | 'drawing.error.drawioTimeout' | 'drawing.error.svgParseFailed' | 'drawing.error.plantumlRenderFailed' | 'drawing.title.excalidraw' | 'drawing.title.mermaid' | 'drawing.title.plantuml' | 'drawing.title.drawio' | 'drawing.toolbar.zoomOut' | 'drawing.toolbar.zoomIn' | 'drawing.toolbar.fit' | 'drawing.toolbar.fitWidth' | 'drawing.state.loading' | 'text.code.loadingHighlight' | 'text.code.formattedPreview' | 'text.code.showOriginal' | 'text.code.showFormatted' | 'text.code.indexingLargeFile' | 'text.code.virtualized' | 'text.code.firstSegment' | 'text.code.previousSegment' | 'text.code.nextSegment' | 'text.code.lastSegment' | 'ebook.toc' | 'ebook.reading' | 'ebook.itemCount' | 'epub.title' | 'epub.previousPage' | 'epub.nextPage' | 'epub.loading' | 'epub.chapterFallback' | 'epub.renderIncomplete' | 'umd.title' | 'umd.previousChapter' | 'umd.nextChapter' | 'umd.loading' | 'umd.emptyContent' | 'umd.chapterFallback' | 'umd.galleryFallback' | 'umd.warningBodyTooShort' | 'umd.error.unexpectedEnd' | 'umd.error.invalidFile' | 'typst.summaryRenderer' | 'typst.pageSummary.empty' | 'typst.pageSummary.ready' | 'typst.status.compiling' | 'typst.status.failed' | 'typst.status.rendered' | 'typst.loading.title' | 'typst.loading.hint' | 'typst.error.title' | 'typst.error.timeout' | 'typst.error.timeoutHint' | 'typst.error.assetHint' | 'typst.error.svgParseFailed' | 'typst.error.wasmLoadFailed' | 'xmind.toolbar.zoomOut' | 'xmind.toolbar.zoomIn' | 'xmind.toolbar.fit' | 'xmind.toolbar.fitTitle' | 'xmind.state.loading' | 'xmind.stats.nodes' | 'xmind.stats.depth' | 'xmind.stats.theme' | 'xmind.stats.template' | 'xmind.badge.paused' | 'xmind.badge.collapsed' | 'xmind.badge.floating' | 'xmind.badge.summary' | 'xmind.badge.callout' | 'xmind.imageResource' | 'xmind.error.unrecognized' | 'xmind.error.noCanvas' | 'cad.toolbar.fit' | 'cad.toolbar.zoomOut' | 'cad.toolbar.zoomIn' | 'cad.layers.title' | 'cad.layers.count' | 'cad.layers.merged' | 'cad.inspector.title' | 'cad.inspector.entities' | 'cad.inspector.blocks' | 'cad.inspector.pages' | 'cad.inspector.drawn' | 'cad.state.loadingViewer' | 'cad.state.parsing' | 'cad.error.parseFailed' | 'image.alt' | 'image.toolbar.rotation' | 'image.toolbar.rotateLeft' | 'image.toolbar.rotateRight' | 'image.lightbox.alt' | 'image.lightbox.close' | 'gitBundle.error.invalid' | 'gitBundle.error.missingPack' | 'gitBundle.notice.delta' | 'gitBundle.title.history' | 'gitBundle.title.fileTree' | 'gitBundle.file.choose' | 'gitBundle.file.noTree' | 'gitBundle.file.none' | 'gitBundle.history.empty' | 'gitBundle.toolbar.summary' | 'gitBundle.meta.bundle' | 'gitBundle.meta.refs' | 'gitBundle.meta.commits' | 'gitBundle.meta.objects' | 'gitBundle.meta.deltas' | 'gitBundle.meta.objectFormat' | 'gitBundle.meta.objectTypes' | 'geo.error.unrecognized' | 'geo.error.xmlParseFailed' | 'geo.error.unsupported' | 'geo.title' | 'geo.featureCount' | 'geo.bounds' | 'geo.geometryTypes' | 'geo.aria' | 'geo.loading' | 'geo.projection' | 'geo.engine' | 'geo.basemap' | 'geo.basemap.offline' | 'geo.basemap.custom' | 'geo.engine.maplibre' | 'geo.engine.svg' | 'geo.error.projection' | 'geo.action.fit' | 'model.toolbar.fit' | 'model.toolbar.rotate' | 'model.toolbar.wireframe' | 'model.toolbar.grid' | 'model.toolbar.axes' | 'model.state.loadingSummary' | 'model.state.loading' | 'model.state.loaded' | 'model.state.parseFailed' | 'model.summary.meshes' | 'model.summary.points' | 'model.error.daeEmpty' | 'model.error.unsupported' | 'model.error.parseFailed' | 'model.notice.signature' | 'loading.generic.label' | 'loading.generic.hint' | 'loading.word.label' | 'loading.word.hint' | 'loading.wordWorker.hint' | 'loading.sheet.label' | 'loading.sheet.hint' | 'loading.csv.label' | 'loading.csv.hint' | 'loading.presentation.label' | 'loading.presentation.hint' | 'loading.pdf.label' | 'loading.pdf.hint' | 'loading.ofd.label' | 'loading.ofd.hint' | 'loading.archive.label' | 'loading.archive.hint' | 'loading.email.label' | 'loading.email.hint' | 'loading.msg.hint' | 'loading.eda.label' | 'loading.eda.hint' | 'loading.cad.label' | 'loading.cad.hint' | 'loading.dwg.hint' | 'loading.dwf.hint' | 'loading.dwfx.hint' | 'loading.xps.hint' | 'loading.drawio.label' | 'loading.drawio.hint' | 'loading.excalidraw.label' | 'loading.excalidraw.hint' | 'loading.epub.label' | 'loading.epub.hint' | 'loading.umd.label' | 'loading.umd.hint' | 'loading.image.label' | 'loading.image.hint' | 'loading.video.label' | 'loading.video.hint' | 'loading.audio.label' | 'loading.audio.hint';
|
|
7
7
|
export type FileViewerMessageParams = Record<string, string | number | boolean | null | undefined>;
|
|
8
8
|
export type FileViewerMessageResolver = (key: FileViewerMessageKey, params: FileViewerMessageParams, locale: FileViewerLocale) => string | undefined;
|
|
9
9
|
export type FileViewerMessages = Partial<Record<FileViewerMessageKey, string>> | FileViewerMessageResolver;
|
|
@@ -28,7 +28,7 @@ export type FileViewerToolbarItem = 'search' | 'zoom' | 'download' | 'print' | '
|
|
|
28
28
|
export type FileViewerResolvedToolbarItem = 'search' | 'zoom' | 'download' | 'print' | 'exportHtml' | 'theme';
|
|
29
29
|
export type FileViewerToolbarActionMap = Partial<Record<FileViewerOperationType, boolean>>;
|
|
30
30
|
export type FileViewerRenderStateKind = 'idle' | 'loading' | 'ready' | 'empty' | 'unsupported' | 'error';
|
|
31
|
-
export type FileViewerRendererCategory = 'office' | 'document' | 'archive' | 'email' | 'eda' | 'cad' | 'model' | 'geo' | 'drawing' | 'mindmap' | 'ebook' | 'image' | 'markdown' | 'code' | 'media' | 'asset' | 'fallback';
|
|
31
|
+
export type FileViewerRendererCategory = 'office' | 'document' | 'archive' | 'email' | 'eda' | 'cad' | 'model' | 'geo' | 'drawing' | 'mindmap' | 'ebook' | 'image' | 'medical-image' | 'cryptographic-container' | 'markdown' | 'code' | 'media' | 'asset' | 'fallback';
|
|
32
32
|
export interface FileViewerWatermarkOptions {
|
|
33
33
|
enabled?: boolean;
|
|
34
34
|
text?: string;
|
|
@@ -100,6 +100,30 @@ export interface FileViewerArchiveOptions {
|
|
|
100
100
|
*/
|
|
101
101
|
requestPassword?: (context: FileViewerArchivePasswordRequestContext) => string | null | undefined | Promise<string | null | undefined>;
|
|
102
102
|
}
|
|
103
|
+
export interface FileViewerChmOptions {
|
|
104
|
+
/** Self-hosted module Worker that owns all untrusted CHM parsing and decompression. */
|
|
105
|
+
workerUrl?: string | URL;
|
|
106
|
+
/** Self-hosted wasm-bindgen JavaScript module loaded by the CHM Worker. */
|
|
107
|
+
wasmModuleUrl?: string | URL;
|
|
108
|
+
/** Self-hosted Rust WebAssembly binary loaded by the CHM Worker. */
|
|
109
|
+
wasmUrl?: string | URL;
|
|
110
|
+
/** Maximum time for an individual Worker request. Defaults to 60 seconds. */
|
|
111
|
+
workerTimeoutMs?: number;
|
|
112
|
+
/** Maximum accepted CHM input size. Defaults to 320 MiB. */
|
|
113
|
+
maxArchiveBytes?: number;
|
|
114
|
+
/** Maximum number of virtual files accepted from one CHM. Defaults to 50,000. */
|
|
115
|
+
maxEntries?: number;
|
|
116
|
+
/** Maximum uncompressed size of one virtual file. Defaults to 32 MiB. */
|
|
117
|
+
maxEntryBytes?: number;
|
|
118
|
+
/** Maximum total unique decoded content exposed by the parser. Defaults to 512 MiB. */
|
|
119
|
+
maxTotalDecompressedBytes?: number;
|
|
120
|
+
/** Maximum HTML topic size. Defaults to 16 MiB. */
|
|
121
|
+
maxHtmlBytes?: number;
|
|
122
|
+
/** Maximum topic count scanned by the built-in search. Defaults to 10,000. */
|
|
123
|
+
maxSearchTopics?: number;
|
|
124
|
+
/** Maximum built-in search result count. Defaults to 200. */
|
|
125
|
+
maxSearchResults?: number;
|
|
126
|
+
}
|
|
103
127
|
export type FileViewerArchivePasswordRequestReason = 'encrypted' | 'invalid-password' | 'read-failed' | 'extract-failed';
|
|
104
128
|
export interface FileViewerArchivePasswordRequestContext {
|
|
105
129
|
filename: string;
|
|
@@ -197,8 +221,10 @@ export interface FileViewerDocxOptions {
|
|
|
197
221
|
updatePageReferences?: boolean;
|
|
198
222
|
hideWebHiddenContent?: boolean;
|
|
199
223
|
ignoreLastRenderedPageBreak?: boolean;
|
|
200
|
-
/** External DOCX links are blocked by default; internal bookmark links remain active. */
|
|
224
|
+
/** External DOC/DOCX/RTF links are blocked by default; internal bookmark links remain active. */
|
|
201
225
|
externalLinkPolicy?: 'allow' | 'block';
|
|
226
|
+
/** Linked DOC/DOCX/RTF image resources are blocked by default; embedded images remain available. */
|
|
227
|
+
externalResourcePolicy?: 'allow' | 'block';
|
|
202
228
|
/** Overrides automatic DOCX dark rendering derived from the viewer theme. */
|
|
203
229
|
darkMode?: boolean;
|
|
204
230
|
}
|
|
@@ -337,6 +363,8 @@ export interface FileRenderContext {
|
|
|
337
363
|
filename?: string;
|
|
338
364
|
url?: string;
|
|
339
365
|
streamUrl?: string;
|
|
366
|
+
/** Original browser File retained for renderers that support Blob-backed random access. */
|
|
367
|
+
sourceFile?: File;
|
|
340
368
|
signal?: AbortSignal;
|
|
341
369
|
options?: FileViewerOptions;
|
|
342
370
|
surface?: RenderSurface;
|
|
@@ -394,6 +422,195 @@ export interface FileViewerModelOptions {
|
|
|
394
422
|
export interface FileViewerDataOptions {
|
|
395
423
|
sqlWasmUrl?: string;
|
|
396
424
|
}
|
|
425
|
+
export type FileViewerIllustratorMode = 'auto' | 'pdf' | 'native';
|
|
426
|
+
/** Resource budgets forwarded to the standalone illustrator-pgf Worker. */
|
|
427
|
+
export interface FileViewerIllustratorLimits {
|
|
428
|
+
maxFileBytes: number;
|
|
429
|
+
maxDecodedBytes: number;
|
|
430
|
+
maxPdfObjects: number;
|
|
431
|
+
maxPrivateBlocks: number;
|
|
432
|
+
maxTokens: number;
|
|
433
|
+
maxStatements: number;
|
|
434
|
+
maxNodes: number;
|
|
435
|
+
maxPathPoints: number;
|
|
436
|
+
maxNesting: number;
|
|
437
|
+
maxStringBytes: number;
|
|
438
|
+
maxSingleRasterPixels: number;
|
|
439
|
+
maxTotalRasterBytes: number;
|
|
440
|
+
maxWorkerTimeMs: number;
|
|
441
|
+
maxRenderPixels: number;
|
|
442
|
+
maxCacheBytes: number;
|
|
443
|
+
}
|
|
444
|
+
export interface FileViewerIllustratorFontReference {
|
|
445
|
+
postScriptName: string;
|
|
446
|
+
family?: string;
|
|
447
|
+
style?: string;
|
|
448
|
+
subset?: boolean;
|
|
449
|
+
}
|
|
450
|
+
export interface FileViewerIllustratorResourceReference {
|
|
451
|
+
id: string;
|
|
452
|
+
kind: string;
|
|
453
|
+
path?: string;
|
|
454
|
+
uri?: string;
|
|
455
|
+
sha256?: string;
|
|
456
|
+
}
|
|
457
|
+
export interface FileViewerIllustratorFontResolver {
|
|
458
|
+
resolve(reference: FileViewerIllustratorFontReference, signal: AbortSignal): Promise<ArrayBuffer | FontFace | null>;
|
|
459
|
+
}
|
|
460
|
+
export interface FileViewerIllustratorResourceResolver {
|
|
461
|
+
resolve(reference: FileViewerIllustratorResourceReference, signal: AbortSignal): Promise<ArrayBuffer | null>;
|
|
462
|
+
}
|
|
463
|
+
export interface FileViewerDesignOptions {
|
|
464
|
+
/** Illustrator routing: PDF-compatible surface, native PGF scene, or safe automatic fallback. */
|
|
465
|
+
illustratorMode?: FileViewerIllustratorMode;
|
|
466
|
+
/** Self-hosted module Worker that runs the standalone illustrator-pgf parser and renderer. */
|
|
467
|
+
illustratorWorkerUrl?: string | URL;
|
|
468
|
+
/** Resource budgets forwarded to illustrator-pgf. Defaults to the SDK's bounded limits. */
|
|
469
|
+
illustratorLimits?: Partial<FileViewerIllustratorLimits>;
|
|
470
|
+
/** Optional host font resolver used only by the native Illustrator session. */
|
|
471
|
+
illustratorFontResolver?: FileViewerIllustratorFontResolver;
|
|
472
|
+
/** Optional host linked/embedded resource resolver used only by the native Illustrator session. */
|
|
473
|
+
illustratorResourceResolver?: FileViewerIllustratorResourceResolver;
|
|
474
|
+
/** Self-hosted module Worker used for heavy Adobe document parsing and pixel synthesis. */
|
|
475
|
+
workerUrl?: string | URL;
|
|
476
|
+
/** Self-hosted module Worker used for bounded FLA/XFL, XD, INDD/INDT, ICML/IDMS/INX, ASE, and ACO parsing. */
|
|
477
|
+
containerWorkerUrl?: string | URL;
|
|
478
|
+
/** Self-hosted module Worker used for ABR/CSH/PAT/GRD/ASL resource parsing. */
|
|
479
|
+
adobeResourceWorkerUrl?: string | URL;
|
|
480
|
+
/** Self-hosted module Worker that runs the bounded EPS/PostScript interpreter. */
|
|
481
|
+
postscriptWorkerUrl?: string | URL;
|
|
482
|
+
/** Self-hosted, license-safe Stet WebAssembly binary used only inside the PostScript Worker. */
|
|
483
|
+
postscriptWasmUrl?: string | URL;
|
|
484
|
+
/** Defaults to true. Disable only when Worker is unavailable. */
|
|
485
|
+
useWorker?: boolean;
|
|
486
|
+
/** Maximum parser time before the Worker is terminated. Defaults to 60 seconds. */
|
|
487
|
+
workerTimeoutMs?: number;
|
|
488
|
+
/** Base EPS/PostScript rasterization density. Defaults to 96 DPI. */
|
|
489
|
+
postscriptRenderDpi?: number;
|
|
490
|
+
/** Maximum pages produced by one EPS/PostScript program. Defaults to 100. */
|
|
491
|
+
postscriptMaxPages?: number;
|
|
492
|
+
/** Maximum source width or height reported by a PostScript page. Defaults to 100,000 units. */
|
|
493
|
+
postscriptMaxSourceDimension?: number;
|
|
494
|
+
/** Maximum PostScript virtual-machine allocation. Defaults to 256 MiB. */
|
|
495
|
+
postscriptMaxVmBytes?: number;
|
|
496
|
+
/** Maximum PostScript print working set across visible, cached, transient, and print RGBA canvases. Defaults to 128 MiB. */
|
|
497
|
+
postscriptMaxPrintBytes?: number;
|
|
498
|
+
/** Self-hosted module Worker used by the high-fidelity IDML page renderer. */
|
|
499
|
+
idmlWorkerUrl?: string | URL;
|
|
500
|
+
/** Self-hosted @paged-media/introspect-wasm binary used only inside the IDML Worker. */
|
|
501
|
+
idmlWasmUrl?: string | URL;
|
|
502
|
+
/** Base rasterization density for IDML pages. Defaults to 96 DPI. */
|
|
503
|
+
idmlRenderDpi?: number;
|
|
504
|
+
/** Maximum IDML ZIP entry count. Defaults to 20,000. */
|
|
505
|
+
idmlMaxEntries?: number;
|
|
506
|
+
/** Maximum total expanded bytes declared by an IDML package. Defaults to 512 MiB. */
|
|
507
|
+
idmlMaxExpandedBytes?: number;
|
|
508
|
+
/** Maximum IDML page count exposed by the renderer. Defaults to 500. */
|
|
509
|
+
idmlMaxPages?: number;
|
|
510
|
+
/** Maximum frame count exposed by the IDML page tree. Defaults to 100,000. */
|
|
511
|
+
idmlMaxFrames?: number;
|
|
512
|
+
/** Maximum IDML print working set across visible, cached, transient, and print RGBA canvases. Defaults to 128 MiB. */
|
|
513
|
+
idmlMaxPrintBytes?: number;
|
|
514
|
+
/** Maximum structured result returned for ICML/IDMS/INX parsing. Defaults to 24 MiB and is hard-capped at 64 MiB. */
|
|
515
|
+
indesignExchangeMaxResultBytes?: number;
|
|
516
|
+
/** Maximum geometry points retained for one ICML/IDMS/INX page item. Defaults to 4,096 and is hard-capped at 16,384. */
|
|
517
|
+
indesignExchangeMaxPointsPerItem?: number;
|
|
518
|
+
/** Maximum DOM/SVG nodes materialized for one active ICML/IDMS/INX panel. Defaults to 8,000 and is hard-capped at 20,000. */
|
|
519
|
+
indesignExchangeMaxDomNodesPerPanel?: number;
|
|
520
|
+
/** Maximum accepted Photoshop source size. Defaults to 128 MiB. */
|
|
521
|
+
maxFileBytes?: number;
|
|
522
|
+
/** Maximum document canvas area. Defaults to 16 megapixels. */
|
|
523
|
+
maxCanvasPixels?: number;
|
|
524
|
+
/** Maximum width or height accepted for a browser canvas. Defaults to 16,384 pixels. */
|
|
525
|
+
maxCanvasDimension?: number;
|
|
526
|
+
/** Maximum decoded layer count. Defaults to 2,000. */
|
|
527
|
+
maxLayers?: number;
|
|
528
|
+
/** Maximum group nesting depth. Defaults to 64. */
|
|
529
|
+
maxNestingDepth?: number;
|
|
530
|
+
/** Maximum area decoded for one interactive layer. Defaults to 16 megapixels. */
|
|
531
|
+
maxLayerPixels?: number;
|
|
532
|
+
/** Maximum transferred RGBA bytes for one result. Defaults to 128 MiB. */
|
|
533
|
+
maxDecodedBytes?: number;
|
|
534
|
+
/** Maximum retained interactive layer canvas bytes. Defaults to 64 MiB. */
|
|
535
|
+
maxLayerCacheBytes?: number;
|
|
536
|
+
/** Maximum colors, brushes, shapes, pages, or other resource records. Defaults to 4,096. */
|
|
537
|
+
maxResourceItems?: number;
|
|
538
|
+
/** Maximum UTF-16 code units accepted for one resource name. Defaults to 4,096. */
|
|
539
|
+
maxResourceNameCodeUnits?: number;
|
|
540
|
+
/** Maximum total pixels decoded for one resource preview collection. Defaults to 16 megapixels. */
|
|
541
|
+
maxResourcePreviewPixels?: number;
|
|
542
|
+
/** Safety and inventory limits for XD UCF/ZIP containers and saved raster previews. */
|
|
543
|
+
xd?: {
|
|
544
|
+
maxFileBytes?: number;
|
|
545
|
+
maxEntries?: number;
|
|
546
|
+
maxCentralDirectoryBytes?: number;
|
|
547
|
+
maxEntryNameBytes?: number;
|
|
548
|
+
maxPathDepth?: number;
|
|
549
|
+
maxEntryCompressedBytes?: number;
|
|
550
|
+
maxEntryUncompressedBytes?: number;
|
|
551
|
+
maxTotalUncompressedBytes?: number;
|
|
552
|
+
maxCompressionRatio?: number;
|
|
553
|
+
maxManifestBytes?: number;
|
|
554
|
+
maxStructureFileBytes?: number;
|
|
555
|
+
maxStructureTotalBytes?: number;
|
|
556
|
+
maxStructureFiles?: number;
|
|
557
|
+
maxJsonNodes?: number;
|
|
558
|
+
maxJsonDepth?: number;
|
|
559
|
+
maxJsonStringBytes?: number;
|
|
560
|
+
maxPreviewCandidates?: number;
|
|
561
|
+
maxPreviewBytes?: number;
|
|
562
|
+
maxPreviewTotalBytes?: number;
|
|
563
|
+
maxPreviewDimension?: number;
|
|
564
|
+
maxPreviewPixels?: number;
|
|
565
|
+
maxReportedResources?: number;
|
|
566
|
+
maxReportedArtboards?: number;
|
|
567
|
+
};
|
|
568
|
+
/** Safety and bounded first-frame reconstruction limits for modern ZIP/XFL-based Animate FLA files. */
|
|
569
|
+
fla?: {
|
|
570
|
+
maxFileBytes?: number;
|
|
571
|
+
maxEntries?: number;
|
|
572
|
+
maxCentralDirectoryBytes?: number;
|
|
573
|
+
maxEntryNameBytes?: number;
|
|
574
|
+
maxPathDepth?: number;
|
|
575
|
+
maxEntryCompressedBytes?: number;
|
|
576
|
+
maxEntryUncompressedBytes?: number;
|
|
577
|
+
maxTotalUncompressedBytes?: number;
|
|
578
|
+
maxCompressionRatio?: number;
|
|
579
|
+
maxXmlFileBytes?: number;
|
|
580
|
+
maxXmlTotalBytes?: number;
|
|
581
|
+
maxXmlFiles?: number;
|
|
582
|
+
maxXmlNodes?: number;
|
|
583
|
+
maxXmlDepth?: number;
|
|
584
|
+
maxXmlAttributes?: number;
|
|
585
|
+
maxXmlTextBytes?: number;
|
|
586
|
+
maxAttributeBytes?: number;
|
|
587
|
+
maxTimelines?: number;
|
|
588
|
+
maxLayers?: number;
|
|
589
|
+
maxFrames?: number;
|
|
590
|
+
maxSymbols?: number;
|
|
591
|
+
maxReportedResources?: number;
|
|
592
|
+
maxPreviewElements?: number;
|
|
593
|
+
maxPreviewPathCommands?: number;
|
|
594
|
+
maxPreviewSvgBytes?: number;
|
|
595
|
+
maxPreviewAssetBytes?: number;
|
|
596
|
+
maxPreviewAssetTotalBytes?: number;
|
|
597
|
+
maxPreviewDimension?: number;
|
|
598
|
+
maxPreviewPixels?: number;
|
|
599
|
+
maxSymbolDepth?: number;
|
|
600
|
+
};
|
|
601
|
+
/** Safety limits for native INDD/INDT master-page, contiguous-object, XMP, and thumbnail reads. */
|
|
602
|
+
inDesign?: {
|
|
603
|
+
maxFileBytes?: number;
|
|
604
|
+
maxDatabasePages?: number;
|
|
605
|
+
maxContiguousObjects?: number;
|
|
606
|
+
maxObjectBytes?: number;
|
|
607
|
+
maxXmpBytes?: number;
|
|
608
|
+
maxPreviewCandidates?: number;
|
|
609
|
+
maxPreviewBytes?: number;
|
|
610
|
+
maxPreviewDimension?: number;
|
|
611
|
+
maxPreviewPixels?: number;
|
|
612
|
+
};
|
|
613
|
+
}
|
|
397
614
|
export type FileViewerGeoBasemapPreset = 'none' | 'offline' | 'openfreemap' | 'openfreemap-liberty' | 'openfreemap-bright' | 'openfreemap-positron' | 'openfreemap-dark' | 'openfreemap-fiord' | 'osm-raster' | 'tianditu-vector' | 'tianditu-imagery' | 'tianditu-terrain';
|
|
398
615
|
export type FileViewerTiandituMapStyle = 'vector' | 'imagery' | 'terrain';
|
|
399
616
|
export interface FileViewerGeoBasemapOptions {
|
|
@@ -483,14 +700,16 @@ export interface FileViewerDrawingOptions {
|
|
|
483
700
|
/**
|
|
484
701
|
* Self-hosted diagrams.net viewer script.
|
|
485
702
|
*
|
|
486
|
-
* The default points to the viewer asset copied under
|
|
487
|
-
* `vendor/drawio/viewer-static.min.js
|
|
488
|
-
*
|
|
703
|
+
* The default points to the optional viewer asset copied under
|
|
704
|
+
* `vendor/drawio/viewer-static.min.js`. It is only requested when
|
|
705
|
+
* `preferOfficial` is explicitly enabled and never reaches public
|
|
706
|
+
* diagrams.net hosts.
|
|
489
707
|
*/
|
|
490
708
|
viewerScriptUrl?: string;
|
|
491
709
|
/**
|
|
492
|
-
* Defaults to
|
|
493
|
-
*
|
|
710
|
+
* Defaults to false so untrusted diagrams use the inert built-in SVG path.
|
|
711
|
+
* Set to true only to opt into the separately delivered diagrams.net viewer
|
|
712
|
+
* runtime. It runs in a no-same-origin iframe with a restrictive CSP.
|
|
494
713
|
*/
|
|
495
714
|
preferOfficial?: boolean;
|
|
496
715
|
/**
|
|
@@ -549,7 +768,7 @@ export interface FileViewerCadOptions {
|
|
|
549
768
|
}
|
|
550
769
|
export type FileViewerRendererMode = 'extend' | 'replace';
|
|
551
770
|
export type FileViewerBuiltinRendererPreset = 'all' | 'lite' | 'none';
|
|
552
|
-
export type FileViewerRendererPresetName = 'all' | 'lite' | 'office' | 'engineering';
|
|
771
|
+
export type FileViewerRendererPresetName = 'all' | 'lite' | 'standard' | 'office' | 'engineering';
|
|
553
772
|
export interface FileViewerAutoRendererOptions {
|
|
554
773
|
/**
|
|
555
774
|
* Uses renderer presets registered by build tooling or preset side-effect imports.
|
|
@@ -593,6 +812,21 @@ export interface FileViewerTextOptions {
|
|
|
593
812
|
* historical visible gutter when this option is omitted; pass false to hide it.
|
|
594
813
|
*/
|
|
595
814
|
lineNumbers?: boolean;
|
|
815
|
+
/**
|
|
816
|
+
* Visually wraps long logical lines without inserting source newlines. Defaults to false.
|
|
817
|
+
* Wrapped continuation rows remain associated with their original line number.
|
|
818
|
+
*/
|
|
819
|
+
wrapLongLines?: boolean;
|
|
820
|
+
/**
|
|
821
|
+
* Formats supported structured text with lazily loaded Prettier plugins for display only.
|
|
822
|
+
* Defaults to false; malformed, unsupported, or oversized inputs keep their original source.
|
|
823
|
+
*/
|
|
824
|
+
prettyPrint?: boolean;
|
|
825
|
+
/**
|
|
826
|
+
* Maximum decoded UTF-8 source bytes eligible for Prettier. Defaults to the effective
|
|
827
|
+
* `virtualizeAboveBytes` value, or 512 KiB when that option is omitted.
|
|
828
|
+
*/
|
|
829
|
+
prettyPrintMaxBytes?: number;
|
|
596
830
|
/** Switches text and code to bounded virtual rendering above this byte size. Defaults to 512 KiB. */
|
|
597
831
|
virtualizeAboveBytes?: number;
|
|
598
832
|
/**
|
|
@@ -720,6 +954,7 @@ export interface FileViewerOptions {
|
|
|
720
954
|
*/
|
|
721
955
|
initialViewState?: FileViewerViewState;
|
|
722
956
|
archive?: FileViewerArchiveOptions;
|
|
957
|
+
chm?: FileViewerChmOptions;
|
|
723
958
|
pdf?: FileViewerPdfOptions;
|
|
724
959
|
docx?: FileViewerDocxOptions;
|
|
725
960
|
presentation?: FileViewerPresentationOptions;
|
|
@@ -732,6 +967,7 @@ export interface FileViewerOptions {
|
|
|
732
967
|
typst?: FileViewerTypstOptions;
|
|
733
968
|
geo?: FileViewerGeoOptions;
|
|
734
969
|
data?: FileViewerDataOptions;
|
|
970
|
+
design?: FileViewerDesignOptions;
|
|
735
971
|
drawing?: FileViewerDrawingOptions;
|
|
736
972
|
cad?: FileViewerCadOptions;
|
|
737
973
|
model?: FileViewerModelOptions;
|
|
@@ -1073,6 +1309,10 @@ export interface RendererDefinition {
|
|
|
1073
1309
|
packageName?: string;
|
|
1074
1310
|
/** Presets that assemble this renderer. */
|
|
1075
1311
|
presets?: readonly FileViewerRendererPresetName[];
|
|
1312
|
+
/** Existing renderer whose fallback extensions this specialist replaces when installed. */
|
|
1313
|
+
enhancesRendererId?: string;
|
|
1314
|
+
/** Extensions transferred from enhancesRendererId to this specialist when installed. */
|
|
1315
|
+
enhancesExtensions?: readonly string[];
|
|
1076
1316
|
containerVersions?: readonly string[];
|
|
1077
1317
|
knownLimits?: readonly string[];
|
|
1078
1318
|
capabilities?: RendererCapability;
|
package/dist/export.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Explicit HTML export and print-document entrypoint.
|
|
3
|
+
*
|
|
4
|
+
* This subpath owns the DOM sanitizer and is intentionally excluded from the
|
|
5
|
+
* normal viewer/headless graph. Viewer operations load it only when the user
|
|
6
|
+
* starts an HTML export or print operation.
|
|
7
|
+
*/
|
|
8
|
+
export { buildFileViewerRenderedDomDocument, buildFileViewerRenderedHtmlDocument, buildExportDomDocument, buildExportHtmlDocument, collectDocumentStyles, sanitizeFileViewerExportDocumentDom, sanitizeFileViewerExportDocumentHtml, } from './exportDocument';
|
|
9
|
+
export type { BuildExportHtmlDocumentOptions, BuildFileViewerRenderedHtmlDocumentOptions, } from './exportDocument';
|
|
10
|
+
export { inlineFileViewerBlobUrlsInHtml, prepareFileViewerRenderedContentForSnapshot, replaceFileViewerCanvasWithImages, resolveFileViewerPrintStyle, triggerFileViewerBlobDownload, triggerFileViewerUrlDownload, waitForFileViewerImages, waitForFileViewerNextPaint, waitForFileViewerPrintWindowReady, } from './output/export';
|
package/dist/export.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Explicit HTML export and print-document entrypoint.
|
|
3
|
+
*
|
|
4
|
+
* This subpath owns the DOM sanitizer and is intentionally excluded from the
|
|
5
|
+
* normal viewer/headless graph. Viewer operations load it only when the user
|
|
6
|
+
* starts an HTML export or print operation.
|
|
7
|
+
*/
|
|
8
|
+
export { buildFileViewerRenderedDomDocument, buildFileViewerRenderedHtmlDocument, buildExportDomDocument, buildExportHtmlDocument, collectDocumentStyles, sanitizeFileViewerExportDocumentDom, sanitizeFileViewerExportDocumentHtml, } from './exportDocument.js';
|
|
9
|
+
export { inlineFileViewerBlobUrlsInHtml, prepareFileViewerRenderedContentForSnapshot, replaceFileViewerCanvasWithImages, resolveFileViewerPrintStyle, triggerFileViewerBlobDownload, triggerFileViewerUrlDownload, waitForFileViewerImages, waitForFileViewerNextPaint, waitForFileViewerPrintWindowReady, } from './output/export.js';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { FileRenderExportAdapter, FileRenderExportMode, FileViewerPrintMaskOptions } from './contracts/types';
|
|
2
|
+
/**
|
|
3
|
+
* Sanitize the complete standalone export document before it is downloaded or
|
|
4
|
+
* mounted into a print window. This is deliberately enforced in core because
|
|
5
|
+
* third-party render adapters and watermark overrides are library inputs.
|
|
6
|
+
*/
|
|
7
|
+
export declare const sanitizeFileViewerExportDocumentHtml: (html: string, documentRef?: Document) => string;
|
|
8
|
+
/**
|
|
9
|
+
* Produce a sanitized, inert document tree for the print-window mount path.
|
|
10
|
+
* Returning DOM here avoids reinterpreting the sanitized string through a
|
|
11
|
+
* second HTML sink such as document.write or innerHTML.
|
|
12
|
+
*/
|
|
13
|
+
export declare const sanitizeFileViewerExportDocumentDom: (html: string, documentRef?: Document) => HTMLHtmlElement;
|
|
14
|
+
export interface BuildExportHtmlDocumentOptions {
|
|
15
|
+
contentHtml: string;
|
|
16
|
+
includeDocumentStyles?: boolean;
|
|
17
|
+
printStyle?: string;
|
|
18
|
+
title: string;
|
|
19
|
+
watermarkInlineStyle?: string;
|
|
20
|
+
mask?: FileViewerPrintMaskOptions | null;
|
|
21
|
+
/** Document whose Window owns the sanitizer. Defaults to the active document. */
|
|
22
|
+
documentRef?: Document;
|
|
23
|
+
}
|
|
24
|
+
export declare const collectDocumentStyles: (documentRef?: Document) => string;
|
|
25
|
+
export declare const buildExportHtmlDocument: (options: BuildExportHtmlDocumentOptions) => string;
|
|
26
|
+
export declare const buildExportDomDocument: (options: BuildExportHtmlDocumentOptions) => HTMLHtmlElement;
|
|
27
|
+
export interface BuildFileViewerRenderedHtmlDocumentOptions {
|
|
28
|
+
source: HTMLElement;
|
|
29
|
+
mode?: FileRenderExportMode;
|
|
30
|
+
title: string;
|
|
31
|
+
adapter?: FileRenderExportAdapter | null;
|
|
32
|
+
watermarkInlineStyle?: string;
|
|
33
|
+
mask?: FileViewerPrintMaskOptions | null;
|
|
34
|
+
}
|
|
35
|
+
export declare const buildFileViewerRenderedHtmlDocument: (options: BuildFileViewerRenderedHtmlDocumentOptions) => Promise<string>;
|
|
36
|
+
export declare const buildFileViewerRenderedDomDocument: (options: BuildFileViewerRenderedHtmlDocumentOptions) => Promise<HTMLHtmlElement>;
|