@file-viewer/core 2.1.15 → 2.1.16

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.
@@ -1,7 +1,7 @@
1
1
  export type FileViewerSourceKind = 'file' | 'url' | 'buffer' | 'empty';
2
2
  export type FileViewerThemeMode = 'light' | 'dark' | 'system';
3
3
  export type FileViewerLocale = 'auto' | 'zh-CN' | 'en-US' | (string & {});
4
- export type FileViewerMessageKey = 'toolbar.zoomGroup' | 'toolbar.zoomOut' | 'toolbar.zoomIn' | 'toolbar.zoomReset' | 'toolbar.download' | 'toolbar.downloadTitle' | 'toolbar.print' | 'toolbar.printTitle' | 'toolbar.exportHtml' | 'toolbar.exportHtmlTitle' | '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' | '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' | '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.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.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' | '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.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.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';
4
+ export type FileViewerMessageKey = 'toolbar.zoomGroup' | 'toolbar.zoomOut' | 'toolbar.zoomIn' | 'toolbar.zoomReset' | 'toolbar.download' | 'toolbar.downloadTitle' | 'toolbar.print' | 'toolbar.printTitle' | 'toolbar.exportHtml' | 'toolbar.exportHtmlTitle' | 'toolbar.search' | 'toolbar.searchPlaceholder' | 'toolbar.searchPrevious' | 'toolbar.searchNext' | 'toolbar.searchClear' | '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' | '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' | '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.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.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' | '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.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.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';
5
5
  export type FileViewerMessageParams = Record<string, string | number | boolean | null | undefined>;
6
6
  export type FileViewerMessageResolver = (key: FileViewerMessageKey, params: FileViewerMessageParams, locale: FileViewerLocale) => string | undefined;
7
7
  export type FileViewerMessages = Partial<Record<FileViewerMessageKey, string>> | FileViewerMessageResolver;
@@ -35,6 +35,7 @@ export interface FileViewerToolbarOptions {
35
35
  print?: boolean;
36
36
  exportHtml?: boolean;
37
37
  zoom?: boolean;
38
+ search?: boolean;
38
39
  /** Controls which built-in toolbar actions are displayed without disabling controller APIs. */
39
40
  items?: FileViewerToolbarActionMap;
40
41
  /** Hard operation permission map. False values block both built-in toolbar and public API calls. */
@@ -11,6 +11,11 @@ const ZH_CN_MESSAGES = {
11
11
  'toolbar.printTitle': '打印完整渲染内容',
12
12
  'toolbar.exportHtml': 'HTML',
13
13
  'toolbar.exportHtmlTitle': '导出当前渲染后的 HTML',
14
+ 'toolbar.search': '搜索',
15
+ 'toolbar.searchPlaceholder': '搜索文档',
16
+ 'toolbar.searchPrevious': '上一个匹配',
17
+ 'toolbar.searchNext': '下一个匹配',
18
+ 'toolbar.searchClear': '清除搜索',
14
19
  'state.ready.title': '预览完成',
15
20
  'state.ready.message': '文件内容已完成渲染。',
16
21
  'state.empty.title': '暂无文件',
@@ -383,6 +388,11 @@ const EN_US_MESSAGES = {
383
388
  'toolbar.printTitle': 'Print the complete rendered document',
384
389
  'toolbar.exportHtml': 'HTML',
385
390
  'toolbar.exportHtmlTitle': 'Export the rendered HTML',
391
+ 'toolbar.search': 'Search',
392
+ 'toolbar.searchPlaceholder': 'Search document',
393
+ 'toolbar.searchPrevious': 'Previous match',
394
+ 'toolbar.searchNext': 'Next match',
395
+ 'toolbar.searchClear': 'Clear search',
386
396
  'state.ready.title': 'Preview ready',
387
397
  'state.ready.message': 'The file has been rendered.',
388
398
  'state.empty.title': 'No file selected',
@@ -464,6 +464,7 @@ export const normalizeFileViewerToolbar = (options) => {
464
464
  print: false,
465
465
  exportHtml: false,
466
466
  zoom: false,
467
+ search: false,
467
468
  };
468
469
  }
469
470
  if (toolbar && typeof toolbar === 'object') {
@@ -472,6 +473,7 @@ export const normalizeFileViewerToolbar = (options) => {
472
473
  print: toolbar.print !== false && isFileViewerToolbarOperationVisible(toolbar, 'print'),
473
474
  exportHtml: toolbar.exportHtml !== false && isFileViewerToolbarOperationVisible(toolbar, 'export-html'),
474
475
  zoom: toolbar.zoom !== false && hasAnyToolbarZoomOperation(toolbar),
476
+ search: toolbar.search !== false,
475
477
  items: toolbar.items,
476
478
  permissions: toolbar.permissions,
477
479
  position: toolbar.position,
@@ -486,6 +488,7 @@ export const normalizeFileViewerToolbar = (options) => {
486
488
  print: true,
487
489
  exportHtml: true,
488
490
  zoom: true,
491
+ search: true,
489
492
  };
490
493
  };
491
494
  export const resolveFileViewerOperationAvailability = ({ extension, hasOriginalSource, renderedReady, hasError = false, adapter, source, zoomState, }) => {
@@ -455,6 +455,7 @@ export const buildFileViewerRenderedHtmlDocument = async ({ source, mode = 'expo
455
455
  }
456
456
  await prepareFileViewerRenderedContentForSnapshot(source, adapter);
457
457
  const clone = source.cloneNode(true);
458
+ clone.querySelectorAll('.viewer-watermark').forEach(node => node.remove());
458
459
  replaceFileViewerCanvasWithImages(source, clone);
459
460
  const printStyle = await resolveFileViewerPrintStyle(adapter, exportOptions);
460
461
  return buildExportHtmlDocument({
@@ -1,8 +1,9 @@
1
- import type { FileViewerArchiveOptions, FileViewerCadOptions, FileViewerDataOptions, FileViewerDocxOptions, FileViewerDrawingOptions, FileViewerOptions, FileViewerPdfOptions, FileViewerSpreadsheetOptions, FileViewerTypstOptions } from '../contracts/types';
1
+ import type { FileViewerArchiveOptions, FileViewerCadOptions, FileViewerDataOptions, FileViewerDocxOptions, FileViewerDrawingOptions, FileViewerOptions, FileViewerPdfOptions, FileViewerPresentationOptions, FileViewerSpreadsheetOptions, FileViewerTypstOptions } from '../contracts/types';
2
2
  export declare const DEFAULT_FILE_VIEWER_ARCHIVE_WORKER_PATH = "vendor/libarchive/worker-bundle.js";
3
3
  export declare const DEFAULT_FILE_VIEWER_ARCHIVE_WASM_PATH = "vendor/libarchive/libarchive.wasm";
4
4
  export declare const DEFAULT_FILE_VIEWER_DOCX_WORKER_PATH = "vendor/docx/docx.worker.js";
5
5
  export declare const DEFAULT_FILE_VIEWER_DOCX_WORKER_JSZIP_PATH = "vendor/docx/jszip.min.js";
6
+ export declare const DEFAULT_FILE_VIEWER_PRESENTATION_WORKER_PATH = "vendor/pptx/pptx.worker.js";
6
7
  export declare const DEFAULT_FILE_VIEWER_SPREADSHEET_WORKER_PATH = "vendor/xlsx/sheet.worker.js";
7
8
  export declare const DEFAULT_FILE_VIEWER_PDF_WORKER_PATH = "vendor/pdf/pdf.worker.mjs";
8
9
  export declare const DEFAULT_FILE_VIEWER_PDF_CMAP_PATH = "vendor/pdf/cmaps/";
@@ -40,7 +41,7 @@ export interface ResolvedFileViewerPdfAssetUrls {
40
41
  }
41
42
  export type FileViewerRendererAssetKind = 'directory' | 'worker' | 'wasm' | 'wasm-directory' | 'script' | 'bundled-wasm';
42
43
  export type FileViewerRendererAssetTarget = 'public' | 'bundled' | 'external';
43
- export type FileViewerRendererAssetOptionPath = 'archive.workerUrl' | 'archive.wasmUrl' | 'cad.wasmPath' | 'cad.workerUrl' | 'cad.dwfWasmUrl' | 'data.sqlWasmUrl' | 'docx.workerJsZipUrl' | 'docx.workerUrl' | 'drawing.viewerScriptUrl' | 'pdf.workerUrl' | 'pdf.cMapUrl' | 'pdf.wasmUrl' | 'pdf.standardFontDataUrl' | 'spreadsheet.workerUrl' | 'typst.compilerWasmUrl' | 'typst.fontAssetsUrl' | 'typst.rendererWasmUrl';
44
+ export type FileViewerRendererAssetOptionPath = 'archive.workerUrl' | 'archive.wasmUrl' | 'cad.wasmPath' | 'cad.workerUrl' | 'cad.dwfWasmUrl' | 'data.sqlWasmUrl' | 'docx.workerJsZipUrl' | 'docx.workerUrl' | 'drawing.viewerScriptUrl' | 'pdf.workerUrl' | 'pdf.cMapUrl' | 'pdf.wasmUrl' | 'pdf.standardFontDataUrl' | 'presentation.workerUrl' | 'spreadsheet.workerUrl' | 'typst.compilerWasmUrl' | 'typst.fontAssetsUrl' | 'typst.rendererWasmUrl';
44
45
  export interface FileViewerRendererAssetDefinition {
45
46
  id: string;
46
47
  rendererId: string;
@@ -75,6 +76,7 @@ export declare const resolveFileViewerDrawioViewerScriptUrl: (options?: Pick<Fil
75
76
  export declare const resolveFileViewerDocxWorkerUrl: (options?: Pick<FileViewerDocxOptions, "workerUrl"> | null, documentBaseUrl?: string) => string;
76
77
  export declare const resolveFileViewerDocxWorkerJsZipUrl: (options?: Pick<FileViewerDocxOptions, "workerJsZipUrl"> | null, documentBaseUrl?: string) => string;
77
78
  export declare const resolveFileViewerSpreadsheetWorkerUrl: (options?: Pick<FileViewerSpreadsheetOptions, "workerUrl"> | null, documentBaseUrl?: string) => string;
79
+ export declare const resolveFileViewerPresentationWorkerUrl: (options?: Pick<FileViewerPresentationOptions, "workerUrl"> | null, documentBaseUrl?: string) => string;
78
80
  export declare const resolveFileViewerTypstCompilerWasmUrl: (options?: Pick<FileViewerTypstOptions, "compilerWasmUrl"> | null, overrides?: Array<string | undefined>, documentBaseUrl?: string) => string;
79
81
  export declare const resolveFileViewerTypstRendererWasmUrl: (options?: Pick<FileViewerTypstOptions, "rendererWasmUrl"> | null, overrides?: Array<string | undefined>, documentBaseUrl?: string) => string;
80
82
  export declare const resolveFileViewerTypstFontAssetsUrl: (options?: Pick<FileViewerTypstOptions, "fontAssetsUrl"> | null, overrides?: Array<string | undefined>, documentBaseUrl?: string) => string;
@@ -2,6 +2,7 @@ export const DEFAULT_FILE_VIEWER_ARCHIVE_WORKER_PATH = 'vendor/libarchive/worker
2
2
  export const DEFAULT_FILE_VIEWER_ARCHIVE_WASM_PATH = 'vendor/libarchive/libarchive.wasm';
3
3
  export const DEFAULT_FILE_VIEWER_DOCX_WORKER_PATH = 'vendor/docx/docx.worker.js';
4
4
  export const DEFAULT_FILE_VIEWER_DOCX_WORKER_JSZIP_PATH = 'vendor/docx/jszip.min.js';
5
+ export const DEFAULT_FILE_VIEWER_PRESENTATION_WORKER_PATH = 'vendor/pptx/pptx.worker.js';
5
6
  export const DEFAULT_FILE_VIEWER_SPREADSHEET_WORKER_PATH = 'vendor/xlsx/sheet.worker.js';
6
7
  export const DEFAULT_FILE_VIEWER_PDF_WORKER_PATH = 'vendor/pdf/pdf.worker.mjs';
7
8
  export const DEFAULT_FILE_VIEWER_PDF_CMAP_PATH = 'vendor/pdf/cmaps/';
@@ -178,6 +179,21 @@ export const DEFAULT_FILE_VIEWER_RENDERER_ASSET_MANIFESTS = [
178
179
  },
179
180
  ],
180
181
  },
182
+ {
183
+ rendererId: 'office-presentation',
184
+ assets: [
185
+ {
186
+ id: 'pptx-worker',
187
+ rendererId: 'office-presentation',
188
+ kind: 'worker',
189
+ target: 'public',
190
+ required: false,
191
+ defaultPath: DEFAULT_FILE_VIEWER_PRESENTATION_WORKER_PATH,
192
+ optionPath: 'presentation.workerUrl',
193
+ description: 'Optional @file-viewer/pptx worker for stable PPTX parsing in IIFE, CDN, and offline deployments.',
194
+ },
195
+ ],
196
+ },
181
197
  {
182
198
  rendererId: 'spreadsheet-openxml',
183
199
  assets: [
@@ -334,6 +350,11 @@ export const resolveFileViewerSpreadsheetWorkerUrl = (options, documentBaseUrl)
334
350
  documentBaseUrl,
335
351
  });
336
352
  };
353
+ export const resolveFileViewerPresentationWorkerUrl = (options, documentBaseUrl) => {
354
+ return resolveFileViewerAssetUrl(options === null || options === void 0 ? void 0 : options.workerUrl, DEFAULT_FILE_VIEWER_PRESENTATION_WORKER_PATH, {
355
+ documentBaseUrl,
356
+ });
357
+ };
337
358
  export const resolveFileViewerTypstCompilerWasmUrl = (options, overrides = [], documentBaseUrl) => {
338
359
  return resolveFileViewerAssetUrl((options === null || options === void 0 ? void 0 : options.compilerWasmUrl) || overrides.find(Boolean), DEFAULT_FILE_VIEWER_TYPST_COMPILER_WASM_URL, { documentBaseUrl });
339
360
  };
@@ -353,7 +374,7 @@ export const getFileViewerRendererAssetManifest = (rendererId) => {
353
374
  return DEFAULT_FILE_VIEWER_RENDERER_ASSET_MANIFESTS.find(manifest => manifest.rendererId === rendererId) || null;
354
375
  };
355
376
  const getRendererAssetOptionValue = (options, optionPath) => {
356
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
377
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
357
378
  switch (optionPath) {
358
379
  case 'archive.workerUrl':
359
380
  return (_a = options === null || options === void 0 ? void 0 : options.archive) === null || _a === void 0 ? void 0 : _a.workerUrl;
@@ -381,14 +402,16 @@ const getRendererAssetOptionValue = (options, optionPath) => {
381
402
  return (_m = options === null || options === void 0 ? void 0 : options.pdf) === null || _m === void 0 ? void 0 : _m.wasmUrl;
382
403
  case 'pdf.standardFontDataUrl':
383
404
  return (_o = options === null || options === void 0 ? void 0 : options.pdf) === null || _o === void 0 ? void 0 : _o.standardFontDataUrl;
405
+ case 'presentation.workerUrl':
406
+ return (_p = options === null || options === void 0 ? void 0 : options.presentation) === null || _p === void 0 ? void 0 : _p.workerUrl;
384
407
  case 'spreadsheet.workerUrl':
385
- return (_p = options === null || options === void 0 ? void 0 : options.spreadsheet) === null || _p === void 0 ? void 0 : _p.workerUrl;
408
+ return (_q = options === null || options === void 0 ? void 0 : options.spreadsheet) === null || _q === void 0 ? void 0 : _q.workerUrl;
386
409
  case 'typst.compilerWasmUrl':
387
- return (_q = options === null || options === void 0 ? void 0 : options.typst) === null || _q === void 0 ? void 0 : _q.compilerWasmUrl;
410
+ return (_r = options === null || options === void 0 ? void 0 : options.typst) === null || _r === void 0 ? void 0 : _r.compilerWasmUrl;
388
411
  case 'typst.fontAssetsUrl':
389
- return (_r = options === null || options === void 0 ? void 0 : options.typst) === null || _r === void 0 ? void 0 : _r.fontAssetsUrl;
412
+ return (_s = options === null || options === void 0 ? void 0 : options.typst) === null || _s === void 0 ? void 0 : _s.fontAssetsUrl;
390
413
  case 'typst.rendererWasmUrl':
391
- return (_s = options === null || options === void 0 ? void 0 : options.typst) === null || _s === void 0 ? void 0 : _s.rendererWasmUrl;
414
+ return (_t = options === null || options === void 0 ? void 0 : options.typst) === null || _t === void 0 ? void 0 : _t.rendererWasmUrl;
392
415
  default:
393
416
  return undefined;
394
417
  }
@@ -99,6 +99,108 @@ export const createViewer = (container, createOptions = {}) => {
99
99
  anchors: { value: [] },
100
100
  state: createEmptyFileViewerSearchState(),
101
101
  };
102
+ let watermarkEl = null;
103
+ let forcedWatermarkContainerPosition = false;
104
+ let watermarkResizeObserver = null;
105
+ let watermarkMutationObserver = null;
106
+ let watermarkFrame = null;
107
+ const getContainerWindow = () => container.ownerDocument.defaultView || (typeof window !== 'undefined' ? window : undefined);
108
+ const cancelWatermarkFrame = () => {
109
+ if (watermarkFrame === null) {
110
+ return;
111
+ }
112
+ const view = getContainerWindow();
113
+ if (view === null || view === void 0 ? void 0 : view.cancelAnimationFrame) {
114
+ view.cancelAnimationFrame(watermarkFrame);
115
+ }
116
+ watermarkFrame = null;
117
+ };
118
+ const updateWatermarkOverlaySize = () => {
119
+ watermarkFrame = null;
120
+ if (!watermarkEl || watermarkEl.parentElement !== container) {
121
+ return;
122
+ }
123
+ const previousDisplay = watermarkEl.style.display;
124
+ watermarkEl.style.display = 'none';
125
+ const width = Math.max(container.scrollWidth, container.clientWidth);
126
+ const height = Math.max(container.scrollHeight, container.clientHeight);
127
+ watermarkEl.style.display = previousDisplay;
128
+ watermarkEl.style.width = `${width}px`;
129
+ watermarkEl.style.height = `${height}px`;
130
+ };
131
+ const scheduleWatermarkSizeUpdate = () => {
132
+ if (!watermarkEl) {
133
+ return;
134
+ }
135
+ cancelWatermarkFrame();
136
+ const view = getContainerWindow();
137
+ if (view === null || view === void 0 ? void 0 : view.requestAnimationFrame) {
138
+ watermarkFrame = view.requestAnimationFrame(updateWatermarkOverlaySize);
139
+ return;
140
+ }
141
+ updateWatermarkOverlaySize();
142
+ };
143
+ const stopWatermarkObservers = () => {
144
+ cancelWatermarkFrame();
145
+ watermarkResizeObserver === null || watermarkResizeObserver === void 0 ? void 0 : watermarkResizeObserver.disconnect();
146
+ watermarkResizeObserver = null;
147
+ watermarkMutationObserver === null || watermarkMutationObserver === void 0 ? void 0 : watermarkMutationObserver.disconnect();
148
+ watermarkMutationObserver = null;
149
+ };
150
+ const startWatermarkObservers = () => {
151
+ stopWatermarkObservers();
152
+ const view = getContainerWindow();
153
+ if (view === null || view === void 0 ? void 0 : view.ResizeObserver) {
154
+ watermarkResizeObserver = new view.ResizeObserver(() => scheduleWatermarkSizeUpdate());
155
+ watermarkResizeObserver.observe(container);
156
+ }
157
+ if (view === null || view === void 0 ? void 0 : view.MutationObserver) {
158
+ watermarkMutationObserver = new view.MutationObserver(mutations => {
159
+ const onlyWatermarkChanged = mutations.every(mutation => watermarkEl && (mutation.target === watermarkEl ||
160
+ watermarkEl.contains(mutation.target)));
161
+ if (!onlyWatermarkChanged) {
162
+ scheduleWatermarkSizeUpdate();
163
+ }
164
+ });
165
+ watermarkMutationObserver.observe(container, {
166
+ attributes: true,
167
+ childList: true,
168
+ subtree: true,
169
+ });
170
+ }
171
+ scheduleWatermarkSizeUpdate();
172
+ };
173
+ const removeWatermarkOverlay = () => {
174
+ stopWatermarkObservers();
175
+ watermarkEl === null || watermarkEl === void 0 ? void 0 : watermarkEl.remove();
176
+ watermarkEl = null;
177
+ if (forcedWatermarkContainerPosition) {
178
+ container.style.position = '';
179
+ forcedWatermarkContainerPosition = false;
180
+ }
181
+ };
182
+ const syncWatermarkOverlay = () => {
183
+ const inlineStyle = buildFileViewerWatermarkInlineStyle(options.watermark);
184
+ if (!inlineStyle) {
185
+ removeWatermarkOverlay();
186
+ return;
187
+ }
188
+ if (!watermarkEl || watermarkEl.ownerDocument !== container.ownerDocument) {
189
+ watermarkEl = container.ownerDocument.createElement('div');
190
+ watermarkEl.className = 'viewer-watermark';
191
+ watermarkEl.setAttribute('aria-hidden', 'true');
192
+ }
193
+ watermarkEl.style.cssText = inlineStyle;
194
+ const view = getContainerWindow();
195
+ if ((view === null || view === void 0 ? void 0 : view.getComputedStyle) && view.getComputedStyle(container).position === 'static' && !container.style.position) {
196
+ container.style.position = 'relative';
197
+ forcedWatermarkContainerPosition = true;
198
+ }
199
+ if (watermarkEl.parentElement !== container) {
200
+ container.appendChild(watermarkEl);
201
+ }
202
+ startWatermarkObservers();
203
+ };
102
204
  const ensureRendererPluginsInstalled = async () => {
103
205
  const nextMode = options.rendererMode || 'extend';
104
206
  const nextRendererInput = options.renderers;
@@ -264,6 +366,7 @@ export const createViewer = (container, createOptions = {}) => {
264
366
  session: null,
265
367
  exportAdapter: null,
266
368
  });
369
+ removeWatermarkOverlay();
267
370
  await documentActions.clearDocumentState();
268
371
  zoomController.clearProvider();
269
372
  viewStateController.clearProvider();
@@ -284,6 +387,7 @@ export const createViewer = (container, createOptions = {}) => {
284
387
  if (!(renderer === null || renderer === void 0 ? void 0 : renderer.load)) {
285
388
  renderMissingRendererState(container, normalized.extension, options);
286
389
  applyFileViewerRenderSurfaceState(renderSurfaceState, { session: null });
390
+ syncWatermarkOverlay();
287
391
  emitZoomAndOperationAvailabilityChange();
288
392
  await emitLifecycle(options, createOptions.onEvent, 'load-complete', normalized, version, startedAt);
289
393
  return null;
@@ -298,6 +402,7 @@ export const createViewer = (container, createOptions = {}) => {
298
402
  },
299
403
  });
300
404
  applyFileViewerRenderSurfaceState(renderSurfaceState, { session });
405
+ syncWatermarkOverlay();
301
406
  zoomController.refreshProvider();
302
407
  viewStateController.refreshProvider();
303
408
  await documentActions.refreshDocumentIndex({ notify: false });
@@ -310,12 +415,14 @@ export const createViewer = (container, createOptions = {}) => {
310
415
  documentActions.destroyDocumentFeatures();
311
416
  zoomController.destroy();
312
417
  viewStateController.destroy();
418
+ removeWatermarkOverlay();
313
419
  },
314
420
  updateOptions(nextOptions) {
315
421
  options = {
316
422
  ...options,
317
423
  ...nextOptions,
318
424
  };
425
+ syncWatermarkOverlay();
319
426
  },
320
427
  getCapabilities(extension) {
321
428
  return getCapabilitiesForExtension(extension);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@file-viewer/core",
3
- "version": "2.1.15",
3
+ "version": "2.1.16",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Framework-neutral modular TypeScript core for Flyfish File Viewer renderer orchestration, lifecycle APIs, search, zoom, print, and export",