@file-viewer/core 3.0.3 → 3.1.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/dist/browser/controller.js +107 -4
- package/dist/contracts/types.d.ts +14 -0
- package/dist/headless.d.ts +2 -2
- package/dist/headless.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/platform/assets.d.ts +1 -1
- package/dist/platform/assets.js +1 -1
- package/dist/registry/capabilities.d.ts +2 -2
- package/dist/registry/formats.d.ts +4 -4
- package/dist/registry/formats.generated.d.ts +21 -2
- package/dist/registry/formats.generated.js +41 -0
- package/dist/renderers/index.d.ts +19 -0
- package/dist/viewer/createViewer.js +50 -3
- package/dist/viewer/state.d.ts +9 -0
- package/dist/viewer/state.js +39 -0
- package/package.json +1 -1
|
@@ -13,6 +13,88 @@ const toViewerSourceInput = (options = {}) => ({
|
|
|
13
13
|
type: options.type,
|
|
14
14
|
size: options.size,
|
|
15
15
|
});
|
|
16
|
+
// These options feed renderer selection or rendering itself. Viewer chrome,
|
|
17
|
+
// fitting, watermark, and operation callbacks update in place instead.
|
|
18
|
+
const RENDER_AFFECTING_VIEWER_OPTION_KEYS = [
|
|
19
|
+
'theme',
|
|
20
|
+
'rendererMode',
|
|
21
|
+
'builtinRenderers',
|
|
22
|
+
'autoRenderers',
|
|
23
|
+
'preset',
|
|
24
|
+
'presets',
|
|
25
|
+
'renderers',
|
|
26
|
+
'text',
|
|
27
|
+
'archive',
|
|
28
|
+
'chm',
|
|
29
|
+
'pdf',
|
|
30
|
+
'docx',
|
|
31
|
+
'presentation',
|
|
32
|
+
'spreadsheet',
|
|
33
|
+
'iwork',
|
|
34
|
+
'wordPerfect',
|
|
35
|
+
'hangul',
|
|
36
|
+
'typst',
|
|
37
|
+
'geo',
|
|
38
|
+
'data',
|
|
39
|
+
'binary',
|
|
40
|
+
'design',
|
|
41
|
+
'drawing',
|
|
42
|
+
'cad',
|
|
43
|
+
'model',
|
|
44
|
+
];
|
|
45
|
+
const isPlainViewerOptionRecord = (value) => {
|
|
46
|
+
const prototype = Object.getPrototypeOf(value);
|
|
47
|
+
return prototype === Object.prototype || prototype === null;
|
|
48
|
+
};
|
|
49
|
+
const areSameViewerOptionValues = (current, next, pairs = new WeakMap()) => {
|
|
50
|
+
if (Object.is(current, next)) {
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
if (current === null ||
|
|
54
|
+
next === null ||
|
|
55
|
+
typeof current !== 'object' ||
|
|
56
|
+
typeof next !== 'object') {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
const existingPair = pairs.get(current);
|
|
60
|
+
if (existingPair) {
|
|
61
|
+
return existingPair === next;
|
|
62
|
+
}
|
|
63
|
+
pairs.set(current, next);
|
|
64
|
+
if (Array.isArray(current) || Array.isArray(next)) {
|
|
65
|
+
return Array.isArray(current) &&
|
|
66
|
+
Array.isArray(next) &&
|
|
67
|
+
current.length === next.length &&
|
|
68
|
+
current.every((value, index) => areSameViewerOptionValues(value, next[index], pairs));
|
|
69
|
+
}
|
|
70
|
+
if (!isPlainViewerOptionRecord(current) || !isPlainViewerOptionRecord(next)) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
const currentKeys = Object.keys(current).sort();
|
|
74
|
+
const nextKeys = Object.keys(next).sort();
|
|
75
|
+
return currentKeys.length === nextKeys.length &&
|
|
76
|
+
currentKeys.every((key, index) => {
|
|
77
|
+
return key === nextKeys[index] &&
|
|
78
|
+
areSameViewerOptionValues(current[key], next[key], pairs);
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
const hasViewerRenderingOptionsChanged = (current, next) => {
|
|
82
|
+
return RENDER_AFFECTING_VIEWER_OPTION_KEYS.some(key => {
|
|
83
|
+
return !areSameViewerOptionValues(current === null || current === void 0 ? void 0 : current[key], next === null || next === void 0 ? void 0 : next[key]);
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
const isSameViewerSource = (current, next) => {
|
|
87
|
+
if (!current || !next) {
|
|
88
|
+
return current === next;
|
|
89
|
+
}
|
|
90
|
+
return current.url === next.url &&
|
|
91
|
+
current.file === next.file &&
|
|
92
|
+
current.buffer === next.buffer &&
|
|
93
|
+
current.filename === next.filename &&
|
|
94
|
+
current.name === next.name &&
|
|
95
|
+
current.type === next.type &&
|
|
96
|
+
Object.is(current.size, next.size);
|
|
97
|
+
};
|
|
16
98
|
const canUseFetch = () => typeof fetch === 'function';
|
|
17
99
|
const defaultFetchFile = async ({ url, signal }) => {
|
|
18
100
|
if (!canUseFetch()) {
|
|
@@ -836,7 +918,10 @@ export const mountViewer = (container, initialOptions = {}, coreOptions = {}) =>
|
|
|
836
918
|
}
|
|
837
919
|
};
|
|
838
920
|
if (currentSource) {
|
|
839
|
-
|
|
921
|
+
// The initial declarative source has no caller awaiting it. State changes
|
|
922
|
+
// and the visible error surface remain authoritative without a global
|
|
923
|
+
// unhandled-rejection event for an expected rendering failure.
|
|
924
|
+
void loadSource(currentSource).catch(() => undefined);
|
|
840
925
|
}
|
|
841
926
|
controller = {
|
|
842
927
|
container,
|
|
@@ -854,15 +939,33 @@ export const mountViewer = (container, initialOptions = {}, coreOptions = {}) =>
|
|
|
854
939
|
var _a;
|
|
855
940
|
if (disposed)
|
|
856
941
|
return;
|
|
942
|
+
const nextViewerOptions = (_a = nextOptions.options) !== null && _a !== void 0 ? _a : currentOptions.options;
|
|
943
|
+
const renderingOptionsChanged = hasViewerRenderingOptionsChanged(currentOptions.options, nextViewerOptions);
|
|
857
944
|
currentOptions = {
|
|
858
945
|
...currentOptions,
|
|
859
946
|
...nextOptions,
|
|
860
|
-
options:
|
|
947
|
+
options: nextViewerOptions,
|
|
861
948
|
};
|
|
949
|
+
const nextSource = hasSource(currentOptions)
|
|
950
|
+
? toViewerSourceInput(currentOptions)
|
|
951
|
+
: null;
|
|
952
|
+
const sameSource = isSameViewerSource(currentSource, nextSource);
|
|
953
|
+
const previousViewState = sameSource && renderingOptionsChanged
|
|
954
|
+
? instance.getViewState()
|
|
955
|
+
: null;
|
|
862
956
|
instance.updateOptions(currentOptions.options || {});
|
|
863
957
|
renderToolbar();
|
|
864
|
-
if (
|
|
865
|
-
|
|
958
|
+
if (sameSource && !renderingOptionsChanged) {
|
|
959
|
+
return;
|
|
960
|
+
}
|
|
961
|
+
if (nextSource) {
|
|
962
|
+
const session = await loadSource(nextSource);
|
|
963
|
+
if (session && previousViewState) {
|
|
964
|
+
await instance.applyViewState(previousViewState, {
|
|
965
|
+
action: 'restore',
|
|
966
|
+
source: 'api',
|
|
967
|
+
});
|
|
968
|
+
}
|
|
866
969
|
}
|
|
867
970
|
else {
|
|
868
971
|
currentSource = null;
|
|
@@ -429,6 +429,19 @@ export interface FileViewerModelOptions {
|
|
|
429
429
|
export interface FileViewerDataOptions {
|
|
430
430
|
sqlWasmUrl?: string;
|
|
431
431
|
}
|
|
432
|
+
/** Limits for the explicit, read-only binary inspector renderer. */
|
|
433
|
+
export interface FileViewerBinaryInspectorOptions {
|
|
434
|
+
/** Whole-input ceiling before the renderer copies bytes into its Worker. Defaults to 16 MiB. */
|
|
435
|
+
maxFileBytes?: number;
|
|
436
|
+
/** Maximum time allowed for one structure-template pass. Defaults to 5 seconds. */
|
|
437
|
+
maxParseMilliseconds?: number;
|
|
438
|
+
/** Maximum structure nodes returned from the Worker. Defaults to 512. */
|
|
439
|
+
maxStructureNodes?: number;
|
|
440
|
+
/** Maximum structure-tree nesting depth. Defaults to 16. */
|
|
441
|
+
maxStructureDepth?: number;
|
|
442
|
+
/** Maximum decoded string bytes in one displayed field. Defaults to 4 KiB. */
|
|
443
|
+
maxStringBytes?: number;
|
|
444
|
+
}
|
|
432
445
|
export type FileViewerIllustratorMode = 'auto' | 'pdf' | 'native';
|
|
433
446
|
/** Resource budgets forwarded to the standalone illustrator-pgf Worker. */
|
|
434
447
|
export interface FileViewerIllustratorLimits {
|
|
@@ -987,6 +1000,7 @@ export interface FileViewerOptions {
|
|
|
987
1000
|
typst?: FileViewerTypstOptions;
|
|
988
1001
|
geo?: FileViewerGeoOptions;
|
|
989
1002
|
data?: FileViewerDataOptions;
|
|
1003
|
+
binary?: FileViewerBinaryInspectorOptions;
|
|
990
1004
|
design?: FileViewerDesignOptions;
|
|
991
1005
|
drawing?: FileViewerDrawingOptions;
|
|
992
1006
|
cad?: FileViewerCadOptions;
|
package/dist/headless.d.ts
CHANGED
|
@@ -22,8 +22,8 @@ export { DEFAULT_FILE_VIEWER_SOURCE_FILENAME, createFileViewerTextDecoder, decod
|
|
|
22
22
|
export type { DecodedFileViewerText, FileViewerReadResult, FileViewerTextEncoding, ResolvedFileViewerTextEncoding, ResolvedFileViewerTextSource, } from './source';
|
|
23
23
|
export { cancelFileViewerPreviewRequest, DEFAULT_FILE_VIEWER_PREVIEW_LOAD_ERROR_LOGGER, DEFAULT_FILE_VIEWER_STREAMING_PDF_FILENAME, DEFAULT_PDF_RANGE_CHUNK_SIZE, FILE_VIEWER_PREVIEW_LOAD_ERROR_PREFIXES, FILE_VIEWER_REMOTE_MISSING_DATA_ERROR_MESSAGE, applyFileViewerEmptyPreviewState, applyFileViewerPreviewFilenameState, applyFileViewerPreviewRequestResetState, applyFileViewerPreviewSourceUrlState, applyFileViewerReadPreviewState, applyFileViewerRenderReadinessState, commitFileViewerEmptyPreviewResetState, commitFileViewerLoadStartState, commitFileViewerPreviewRequestStartState, commitFileViewerRemoteDownloadState, createFileViewerEmptyPreviewState, createFileViewerLoadStartState, createFileViewerPreviewRequestResetState, createFileViewerPreviewStateTarget, createFileViewerReadPreviewState, createFileViewerRenderCompleteState, createFileViewerRequestController, createFileViewerRequestScope, createFileViewerSourceLoadingActionHandlers, createFileViewerStreamingPdfPlaceholderFile, finalizeFileViewerPreviewLoadState, hasFileViewerPreviewSource, isFileViewerAbortError, isSameOriginUrl, normalizeFileViewerSourceUrl, normalizePdfStreamingMode, reportFileViewerMissingRemoteData, reportFileViewerPreviewLoadError, resolveFileViewerFileRefSourcePlan, resolveFileViewerLoadStartMessage, resolveFileViewerMissingRemoteDataErrorMessage, resolveFileViewerPageHref, resolveFileViewerPreviewLoadErrorMessage, resolveFileViewerPreviewRequestReason, resolveFileViewerRemoteSourcePlan, runFileViewerLocalFilePreview, runFileViewerPreviewComponentUnmount, runFileViewerPreviewRequest, runFileViewerPreviewSourceChange, runFileViewerRemoteFilePreview, runFileViewerReadAndRenderFile, runFileViewerStreamingPdfPreview, shouldStreamPdfUrl, } from './source/loading';
|
|
24
24
|
export type { CancelFileViewerPreviewRequestInput, CommitFileViewerEmptyPreviewResetStateInput, CommitFileViewerLoadStartStateInput, CommitFileViewerPreviewRequestStartStateInput, CommitFileViewerRenderCompleteStateInput, CommitFileViewerRemoteDownloadStateInput, CreateFileViewerLoadStartStateInput, CreateFileViewerPreviewStateTargetInput, CreateFileViewerReadPreviewStateInput, CreateFileViewerRenderCompleteStateInput, CreateFileViewerSourceLoadingActionHandlersInput, FileViewerEmptyPreviewState, FileViewerFileRefSourcePlan, FileViewerLocalFilePreviewState, FileViewerLoadStartState, FileViewerLocationLike, FileViewerMutableAccessor, FileViewerPreviewComponentUnmountState, FileViewerPreviewLoadErrorKind, FileViewerPreviewLoadErrorLogger, FileViewerPreviewLoadErrorPrefixes, FileViewerPreviewRequestResetState, FileViewerPreviewRequestRunState, FileViewerReadAndRenderFileState, FileViewerReadPreviewState, FileViewerRemoteDownloadState, FileViewerRemoteFileDownloadInput, FileViewerRemoteFilePreviewErrorKind, FileViewerRemoteFilePreviewState, FileViewerRemoteSourcePlan, FileViewerRenderCompleteState, FileViewerRenderReadinessState, FileViewerRequestController, FileViewerRequestScope, FileViewerSourceLoadingActionHandlers, FileViewerStreamingPdfPreviewState, FinalizeFileViewerPreviewLoadStateInput, MutableFileViewerPreviewFilenameState, MutableFileViewerPreviewRequestState, MutableFileViewerPreviewSourceUrlState, MutableFileViewerPreviewState, MutableFileViewerReadPreviewState, MutableFileViewerRenderReadinessState, ReportFileViewerMissingRemoteDataInput, ReportFileViewerPreviewLoadErrorInput, ResolveFileViewerFileRefSourcePlanInput, ResolveFileViewerMissingRemoteDataErrorMessageInput, ResolveFileViewerPreviewLoadErrorMessageInput, ResolveFileViewerPreviewRequestReasonInput, RunFileViewerLocalFilePreviewInput, RunFileViewerPreviewComponentUnmountInput, RunFileViewerPreviewRequestInput, RunFileViewerPreviewSourceChangeInput, RunFileViewerReadAndRenderFileInput, RunFileViewerRemoteFilePreviewInput, RunFileViewerStreamingPdfPreviewInput, } from './source/loading';
|
|
25
|
-
export { DEFAULT_FILE_VIEWER_STATE_THEME, DEFAULT_FILE_VIEWER_UNSUPPORTED_DESCRIPTION, FILE_VIEWER_PREVIEW_MESSAGES, createFileViewerEmptyState, createFileViewerErrorState, createFileViewerPreviewLoadingState, createFileViewerReadyState, createFileViewerUnsupportedState, formatFileViewerErrorMessage, normalizeFileViewerErrorMessage, } from './viewer/state';
|
|
26
|
-
export type { FileViewerErrorMessageFormatter, } from './viewer/state';
|
|
25
|
+
export { DEFAULT_FILE_VIEWER_STATE_THEME, DEFAULT_FILE_VIEWER_UNSUPPORTED_DESCRIPTION, FILE_VIEWER_ERROR_MESSAGE, FILE_VIEWER_PREVIEW_MESSAGES, attachFileViewerErrorMessage, createFileViewerEmptyState, createFileViewerErrorState, createFileViewerPreviewLoadingState, createFileViewerReadyState, createFileViewerUnsupportedState, formatFileViewerErrorMessage, normalizeFileViewerErrorMessage, } from './viewer/state';
|
|
26
|
+
export type { FileViewerErrorMessageCarrier, FileViewerErrorMessageFormatter, } from './viewer/state';
|
|
27
27
|
export { buildFileViewerWatermarkBackgroundImage, buildFileViewerWatermarkInlineStyle, buildFileViewerWatermarkStyle, buildFileViewerWatermarkSvg, normalizeFileViewerWatermark, resolveFileViewerWatermarkPresentationState, } from './features/watermark';
|
|
28
28
|
export type { FileViewerWatermarkPresentationState, FileViewerWatermarkStyle, } from './features/watermark';
|
|
29
29
|
export type { FileRenderContext, FileRenderExportAdapter, FileRenderExportMode, FileRenderExportOptions, FileRenderHandler, FileRenderHandlerComposite, FileViewerBuiltinRendererPreset, FileViewerAiOptions, FileViewerArchiveEntryActionContext, FileViewerArchiveEntryActionPolicy, FileViewerArchiveEntryActionsOptions, FileViewerArchiveOptions, FileViewerChmOptions, FileViewerApplyViewStateOptions, FileViewerBeforeOperation, FileViewerCadColorMode, FileViewerCadDwfLineWeightMode, FileViewerCadOptions, FileViewerCadRenderer, FileViewerComponentEmits, FileViewerComponentEventMap, FileViewerComponentProps, FileViewerDocumentAnchor, FileViewerDocumentChunk, FileViewerDocxOptions, FileViewerDrawingOptions, FileViewerDownloadOptions, FileViewerEvent, FileViewerEventHandler, FileViewerEventType, FileViewerExportHtmlOptions, FileViewerFileRef, FileViewerFitMode, FileViewerFitOptions, FileViewerFitRequest, FileViewerFitResize, FileViewerFitResult, FileViewerFormatStatus, FileViewerFormatSupportLevel, FileViewerGeoOptions, FileViewerInstance, FileViewerLifecycleContext, FileViewerLifecycleHooks, FileViewerLifecyclePhase, FileViewerI18nOptions, FileViewerIworkEmbeddedPreviewMode, FileViewerIworkOptions, FileViewerHangulOptions, FileViewerDiagnostic, FileViewerLocale, FileViewerMessageKey, FileViewerMessageParams, FileViewerMessageResolver, FileViewerMessages, FileViewerNavigationState, FileViewerOperationAvailability, FileViewerOperationContext, FileViewerOperationType, FileViewerOptions, FileViewerPdfBoundingBox, FileViewerPdfBoundingBoxOrigin, FileViewerPdfBoundingBoxUnit, FileViewerPdfOptions, FileViewerPresentationOptions, FileViewerPrintMaskOptions, FileViewerPrintMaskRegion, FileViewerPrintOptions, FileViewerPrintStamp, FileViewerPublicApi, FileViewerRenderStateKind, FileViewerRenderedInstance, FileViewerRendererCategory, FileViewerSearchMatch, FileViewerSearchOptions, FileViewerSearchProvider, FileViewerSearchState, FileViewerSource, FileViewerSourceKind, FileViewerSpreadsheetOptions, FileViewerStateDescriptor, FileViewerStateTheme, FileViewerTextOptions, FileViewerResolvedThemeMode, FileViewerThemeMode, FileViewerToolbarActionMap, FileViewerToolbarItem, FileViewerToolbarOptions, FileViewerToolbarPosition, FileViewerResolvedToolbarItem, FileViewerUiDensity, FileViewerUiOptions, FileViewerTypstOptions, FileViewerViewScrollState, FileViewerViewState, FileViewerViewStateChange, FileViewerViewStateChangeAction, FileViewerViewStateChangeSource, FileViewerViewStateProvider, FileViewerWatermarkOptions, FileViewerWordPerfectOptions, FileViewerZoomProvider, FileViewerZoomState, NormalizedFileViewerSource, RenderSurface, RendererCapability, RendererDefinition, RendererLoadContext, RendererLoader, RendererPlugin, RendererRegistry, RendererSession, ViewerCapabilityState, ViewerLifecycleContext, ViewerOperationContext, } from './contracts/types';
|
package/dist/headless.js
CHANGED
|
@@ -17,5 +17,5 @@ export { createFileViewerRendererDispatcher, } from './rendering/dispatcher.js';
|
|
|
17
17
|
export { buildFileRenderContextFromLoadContext, createFileRenderHandlerRegistry, createFileRenderHandlerLoader, FILE_VIEWER_RENDER_SURFACE_BACKGROUND_PROPERTY, normalizeFileViewerRenderSurfaceBackground, syncFileViewerRenderSurfaceBackground, } from './rendering/handler.js';
|
|
18
18
|
export { DEFAULT_FILE_VIEWER_SOURCE_FILENAME, createFileViewerTextDecoder, decodeFileViewerTextBuffer, decodeFilename, getExtension, normalizeFileExtension, normalizeFilename, normalizeSource, isValidFileViewerUtf8, resolveFileViewerTextEncoding, readFileViewerBuffer, readFileViewerDataUrl, readFileViewerText, resolveFileViewerSourceFilename, wrapFileViewerFileRef, } from './source/index.js';
|
|
19
19
|
export { cancelFileViewerPreviewRequest, DEFAULT_FILE_VIEWER_PREVIEW_LOAD_ERROR_LOGGER, DEFAULT_FILE_VIEWER_STREAMING_PDF_FILENAME, DEFAULT_PDF_RANGE_CHUNK_SIZE, FILE_VIEWER_PREVIEW_LOAD_ERROR_PREFIXES, FILE_VIEWER_REMOTE_MISSING_DATA_ERROR_MESSAGE, applyFileViewerEmptyPreviewState, applyFileViewerPreviewFilenameState, applyFileViewerPreviewRequestResetState, applyFileViewerPreviewSourceUrlState, applyFileViewerReadPreviewState, applyFileViewerRenderReadinessState, commitFileViewerEmptyPreviewResetState, commitFileViewerLoadStartState, commitFileViewerPreviewRequestStartState, commitFileViewerRemoteDownloadState, createFileViewerEmptyPreviewState, createFileViewerLoadStartState, createFileViewerPreviewRequestResetState, createFileViewerPreviewStateTarget, createFileViewerReadPreviewState, createFileViewerRenderCompleteState, createFileViewerRequestController, createFileViewerRequestScope, createFileViewerSourceLoadingActionHandlers, createFileViewerStreamingPdfPlaceholderFile, finalizeFileViewerPreviewLoadState, hasFileViewerPreviewSource, isFileViewerAbortError, isSameOriginUrl, normalizeFileViewerSourceUrl, normalizePdfStreamingMode, reportFileViewerMissingRemoteData, reportFileViewerPreviewLoadError, resolveFileViewerFileRefSourcePlan, resolveFileViewerLoadStartMessage, resolveFileViewerMissingRemoteDataErrorMessage, resolveFileViewerPageHref, resolveFileViewerPreviewLoadErrorMessage, resolveFileViewerPreviewRequestReason, resolveFileViewerRemoteSourcePlan, runFileViewerLocalFilePreview, runFileViewerPreviewComponentUnmount, runFileViewerPreviewRequest, runFileViewerPreviewSourceChange, runFileViewerRemoteFilePreview, runFileViewerReadAndRenderFile, runFileViewerStreamingPdfPreview, shouldStreamPdfUrl, } from './source/loading.js';
|
|
20
|
-
export { DEFAULT_FILE_VIEWER_STATE_THEME, DEFAULT_FILE_VIEWER_UNSUPPORTED_DESCRIPTION, FILE_VIEWER_PREVIEW_MESSAGES, createFileViewerEmptyState, createFileViewerErrorState, createFileViewerPreviewLoadingState, createFileViewerReadyState, createFileViewerUnsupportedState, formatFileViewerErrorMessage, normalizeFileViewerErrorMessage, } from './viewer/state.js';
|
|
20
|
+
export { DEFAULT_FILE_VIEWER_STATE_THEME, DEFAULT_FILE_VIEWER_UNSUPPORTED_DESCRIPTION, FILE_VIEWER_ERROR_MESSAGE, FILE_VIEWER_PREVIEW_MESSAGES, attachFileViewerErrorMessage, createFileViewerEmptyState, createFileViewerErrorState, createFileViewerPreviewLoadingState, createFileViewerReadyState, createFileViewerUnsupportedState, formatFileViewerErrorMessage, normalizeFileViewerErrorMessage, } from './viewer/state.js';
|
|
21
21
|
export { buildFileViewerWatermarkBackgroundImage, buildFileViewerWatermarkInlineStyle, buildFileViewerWatermarkStyle, buildFileViewerWatermarkSvg, normalizeFileViewerWatermark, resolveFileViewerWatermarkPresentationState, } from './features/watermark.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -68,8 +68,8 @@ export { appendFileViewerStyle, buildFileRenderContextFromLoadContext, applyFile
|
|
|
68
68
|
export type { AppendFileViewerStyleOptions, CreateFileViewerRenderSurfaceOptions, CreateFileViewerRenderSurfaceActionHandlersInput, CreateFileViewerRenderReadinessTargetInput, CreateFileViewerRenderSurfaceStateTargetInput, FileViewerStyleHandle, FileViewerRenderSurfaceActionHandlers, FileViewerRenderSurfaceClearState, FileViewerRenderSurfaceState, FileViewerRenderSurfaceMountContext, FileViewerRenderSessionDisposeErrorLogger, MutableFileViewerRenderSurfaceState, ReportFileViewerRenderSessionDisposeErrorInput, ResolvedFileViewerStyleIsolation, ResetFileViewerRenderSurfaceInput, ResolveFileViewerRenderSessionDisposeErrorMessageInput, RunFileViewerRenderSurfaceClearInput, RunFileViewerRenderSurfaceMountInput, } from './rendering/handler';
|
|
69
69
|
export { DEFAULT_FILE_VIEWER_SOURCE_FILENAME, createFileViewerTextDecoder, decodeFileViewerTextBuffer, decodeFilename, getExtension, normalizeFileExtension, normalizeFilename, isValidFileViewerUtf8, resolveFileViewerTextEncoding, resolveFileViewerSourceFilename, normalizeSource, readFileViewerBuffer, readFileViewerDataUrl, readFileViewerText, wrapFileViewerFileRef, } from './source';
|
|
70
70
|
export type { DecodedFileViewerText, FileViewerReadResult, FileViewerTextEncoding, ResolvedFileViewerTextEncoding, ResolvedFileViewerTextSource, } from './source';
|
|
71
|
-
export { DEFAULT_FILE_VIEWER_STATE_THEME, DEFAULT_FILE_VIEWER_UNSUPPORTED_DESCRIPTION, FILE_VIEWER_PREVIEW_MESSAGES, createFileViewerEmptyState, createFileViewerErrorState, createFileViewerPreviewLoadingState, createFileViewerReadyState, createFileViewerUnsupportedState, formatFileViewerErrorMessage, normalizeFileViewerErrorMessage, resolveFileViewerRendererInstallHint, } from './viewer/state';
|
|
72
|
-
export type { FileViewerErrorMessageFormatter, FileViewerRendererInstallHint, } from './viewer/state';
|
|
71
|
+
export { DEFAULT_FILE_VIEWER_STATE_THEME, DEFAULT_FILE_VIEWER_UNSUPPORTED_DESCRIPTION, FILE_VIEWER_ERROR_MESSAGE, FILE_VIEWER_PREVIEW_MESSAGES, attachFileViewerErrorMessage, createFileViewerEmptyState, createFileViewerErrorState, createFileViewerPreviewLoadingState, createFileViewerReadyState, createFileViewerUnsupportedState, formatFileViewerErrorMessage, normalizeFileViewerErrorMessage, resolveFileViewerRendererInstallHint, } from './viewer/state';
|
|
72
|
+
export type { FileViewerErrorMessageCarrier, FileViewerErrorMessageFormatter, FileViewerRendererInstallHint, } from './viewer/state';
|
|
73
73
|
export { buildFileViewerWatermarkBackgroundImage, buildFileViewerWatermarkInlineStyle, buildFileViewerWatermarkStyle, buildFileViewerWatermarkSvg, normalizeFileViewerWatermark, resolveFileViewerWatermarkPresentationState, } from './features/watermark';
|
|
74
74
|
export type { FileViewerWatermarkPresentationState, FileViewerWatermarkStyle, } from './features/watermark';
|
|
75
75
|
export { buildFileViewerPrintMaskOverlayHtml, applyFileViewerPagePrintMasksToHtml, normalizeFileViewerPrintMaskOptions, normalizeFileViewerPrintMaskRegion, normalizeFileViewerPrintStamp, FILE_VIEWER_PRINT_MASK_STYLE, } from './features/printMask';
|
|
@@ -93,5 +93,5 @@ export type { CreateFileViewerZoomControllerOptions, FileViewerZoomOperation, }
|
|
|
93
93
|
export type { CreateViewerOptions } from './viewer/createViewer';
|
|
94
94
|
export type { BuildExportHtmlDocumentOptions, BuildFileViewerRenderedHtmlDocumentOptions, } from './exportDocument';
|
|
95
95
|
export type { CreateFileViewerWorkerControllerOptions, FileViewerWorkerContext, FileViewerWorkerController, FileViewerWorkerErrorHook, FileViewerWorkerEventHandler, FileViewerWorkerFactory, FileViewerWorkerMessageHook, WorkerProvider, WorkerRef, } from './platform/worker';
|
|
96
|
-
export type { FileViewerAiOptions, FileViewerArchiveEntryActionContext, FileViewerArchiveEntryActionPolicy, FileViewerArchiveEntryActionsOptions, FileViewerArchivePasswordRequestContext, FileViewerArchivePasswordRequestReason, FileViewerArchiveOptions, FileViewerChmOptions, FileViewerApplyViewStateOptions, FileViewerBeforeOperation, FileViewerCadColorMode, FileViewerCadDwfLineWeightMode, FileViewerCadOptions, FileViewerCadRenderer, FileViewerModelLinearUnit, FileViewerModelOptions, FileViewerComponentEmits, FileViewerComponentEventMap, FileViewerComponentProps, FileViewerDocumentAnchor, FileViewerDocumentChunk, FileViewerDownloadOptions, FileViewerDocxOptions, FileViewerDrawingOptions, FileViewerEvent, FileViewerEventHandler, FileViewerEventType, FileViewerExportHtmlOptions, FileViewerFileRef, FileViewerFitMode, FileViewerFitOptions, FileViewerFitRequest, FileViewerFitResize, FileViewerFitResult, FileViewerFormatStatus, FileViewerFormatSupportLevel, FileViewerGeoBasemapOptions, FileViewerGeoBasemapPreset, FileViewerGeoOptions, FileViewerTiandituMapStyle, FileRenderContext, FileRenderExportAdapter, FileRenderThumbnailAdapter, FileRenderExportMode, FileRenderExportOptions, FileRenderHandler, FileRenderHandlerComposite, FileViewerBuiltinRendererPreset, FileViewerInstance, FileViewerLoadOptions, FileViewerLifecycleContext, FileViewerLifecycleHooks, FileViewerLifecyclePhase, FileViewerI18nOptions, FileViewerIworkEmbeddedPreviewMode, FileViewerIworkOptions, FileViewerHangulOptions, FileViewerDiagnostic, FileViewerDesignOptions, FileViewerLocale, FileViewerMessageKey, FileViewerMessageParams, FileViewerMessageResolver, FileViewerMessages, FileViewerNavigationState, FileViewerOperationAvailability, FileViewerOperationContext, FileViewerOperationType, FileViewerOptions, FileViewerPdfBoundingBox, FileViewerPdfBoundingBoxOrigin, FileViewerPdfBoundingBoxUnit, FileViewerPdfOptions, FileViewerPresentationOptions, FileViewerPrintOptions, FileViewerPrintMaskOptions, FileViewerPrintMaskRegion, FileViewerPrintStamp, FileViewerPublicApi, FileViewerRenderedInstance, FileViewerRendererMode, FileViewerRendererPluginAssetKind, FileViewerRendererPluginAssetManifest, FileViewerRendererPluginAssetEntry, FileViewerRenderStateKind, FileViewerRenderPurpose, FileViewerRendererCategory, FileViewerRendererHandlerRegistration, FileViewerRendererInstallContext, FileViewerRendererPlugin, FileViewerRendererPluginInput, FileViewerRendererPresetInput, FileViewerRendererPresetName, FileViewerRendererPreset, FileViewerSearchMatch, FileViewerSearchOptions, FileViewerSearchProvider, FileViewerSearchState, FileViewerSource, FileViewerSourceKind, FileViewerThumbnailCaptureOptions, FileViewerThumbnailFit, FileViewerThumbnailFormat, FileViewerSpreadsheetOptions, FileViewerStateDescriptor, FileViewerStateTheme, FileViewerStyleIsolation, FileViewerTextOptions, FileViewerResolvedThemeMode, FileViewerThemeMode, FileViewerToolbarActionMap, FileViewerToolbarItem, FileViewerToolbarOptions, FileViewerToolbarPosition, FileViewerResolvedToolbarItem, FileViewerUiDensity, FileViewerUiOptions, FileViewerTypstOptions, FileViewerViewScrollState, FileViewerViewState, FileViewerViewStateChange, FileViewerViewStateChangeAction, FileViewerViewStateChangeSource, FileViewerViewStateProvider, FileViewerWatermarkOptions, FileViewerWordPerfectOptions, FileViewerZoomProvider, FileViewerZoomState, NormalizedFileViewerSource, RendererCapability, RendererDefinition, RendererPlugin, RendererLoadContext, RendererLoader, RendererRegistry, RendererSession, RenderSurface, ViewerCapabilityState, ViewerLifecycleContext, ViewerOperationContext, } from './contracts/types';
|
|
96
|
+
export type { FileViewerAiOptions, FileViewerArchiveEntryActionContext, FileViewerArchiveEntryActionPolicy, FileViewerArchiveEntryActionsOptions, FileViewerArchivePasswordRequestContext, FileViewerArchivePasswordRequestReason, FileViewerArchiveOptions, FileViewerBinaryInspectorOptions, FileViewerChmOptions, FileViewerApplyViewStateOptions, FileViewerBeforeOperation, FileViewerCadColorMode, FileViewerCadDwfLineWeightMode, FileViewerCadOptions, FileViewerCadRenderer, FileViewerModelLinearUnit, FileViewerModelOptions, FileViewerComponentEmits, FileViewerComponentEventMap, FileViewerComponentProps, FileViewerDocumentAnchor, FileViewerDocumentChunk, FileViewerDownloadOptions, FileViewerDocxOptions, FileViewerDrawingOptions, FileViewerEvent, FileViewerEventHandler, FileViewerEventType, FileViewerExportHtmlOptions, FileViewerFileRef, FileViewerFitMode, FileViewerFitOptions, FileViewerFitRequest, FileViewerFitResize, FileViewerFitResult, FileViewerFormatStatus, FileViewerFormatSupportLevel, FileViewerGeoBasemapOptions, FileViewerGeoBasemapPreset, FileViewerGeoOptions, FileViewerTiandituMapStyle, FileRenderContext, FileRenderExportAdapter, FileRenderThumbnailAdapter, FileRenderExportMode, FileRenderExportOptions, FileRenderHandler, FileRenderHandlerComposite, FileViewerBuiltinRendererPreset, FileViewerInstance, FileViewerLoadOptions, FileViewerLifecycleContext, FileViewerLifecycleHooks, FileViewerLifecyclePhase, FileViewerI18nOptions, FileViewerIworkEmbeddedPreviewMode, FileViewerIworkOptions, FileViewerHangulOptions, FileViewerDiagnostic, FileViewerDesignOptions, FileViewerLocale, FileViewerMessageKey, FileViewerMessageParams, FileViewerMessageResolver, FileViewerMessages, FileViewerNavigationState, FileViewerOperationAvailability, FileViewerOperationContext, FileViewerOperationType, FileViewerOptions, FileViewerPdfBoundingBox, FileViewerPdfBoundingBoxOrigin, FileViewerPdfBoundingBoxUnit, FileViewerPdfOptions, FileViewerPresentationOptions, FileViewerPrintOptions, FileViewerPrintMaskOptions, FileViewerPrintMaskRegion, FileViewerPrintStamp, FileViewerPublicApi, FileViewerRenderedInstance, FileViewerRendererMode, FileViewerRendererPluginAssetKind, FileViewerRendererPluginAssetManifest, FileViewerRendererPluginAssetEntry, FileViewerRenderStateKind, FileViewerRenderPurpose, FileViewerRendererCategory, FileViewerRendererHandlerRegistration, FileViewerRendererInstallContext, FileViewerRendererPlugin, FileViewerRendererPluginInput, FileViewerRendererPresetInput, FileViewerRendererPresetName, FileViewerRendererPreset, FileViewerSearchMatch, FileViewerSearchOptions, FileViewerSearchProvider, FileViewerSearchState, FileViewerSource, FileViewerSourceKind, FileViewerThumbnailCaptureOptions, FileViewerThumbnailFit, FileViewerThumbnailFormat, FileViewerSpreadsheetOptions, FileViewerStateDescriptor, FileViewerStateTheme, FileViewerStyleIsolation, FileViewerTextOptions, FileViewerResolvedThemeMode, FileViewerThemeMode, FileViewerToolbarActionMap, FileViewerToolbarItem, FileViewerToolbarOptions, FileViewerToolbarPosition, FileViewerResolvedToolbarItem, FileViewerUiDensity, FileViewerUiOptions, FileViewerTypstOptions, FileViewerViewScrollState, FileViewerViewState, FileViewerViewStateChange, FileViewerViewStateChangeAction, FileViewerViewStateChangeSource, FileViewerViewStateProvider, FileViewerWatermarkOptions, FileViewerWordPerfectOptions, FileViewerZoomProvider, FileViewerZoomState, NormalizedFileViewerSource, RendererCapability, RendererDefinition, RendererPlugin, RendererLoadContext, RendererLoader, RendererRegistry, RendererSession, RenderSurface, ViewerCapabilityState, ViewerLifecycleContext, ViewerOperationContext, } from './contracts/types';
|
|
97
97
|
export { resolveFileViewerCopiedAssetUrl } from './platform/copiedAssets';
|
package/dist/index.js
CHANGED
|
@@ -175,7 +175,7 @@ export { resolveFileViewerPresentationState, } from './presentation/state.js';
|
|
|
175
175
|
export { createFileViewerRendererDispatcher, } from './rendering/dispatcher.js';
|
|
176
176
|
export { appendFileViewerStyle, buildFileRenderContextFromLoadContext, applyFileViewerRenderSurfaceState, clearFileViewerRenderSurface, createFileRenderHandlerRendererSession, createFileRenderHandlerRegistry, createFileRenderHandlerLoader, createFileViewerRenderSurfaceActionHandlers, createFileViewerRenderReadinessTarget, createFileViewerRenderSurface, createFileViewerRenderSurfaceState, createFileViewerRenderSurfaceStateTarget, createFileViewerRenderTarget, DEFAULT_FILE_VIEWER_RENDER_TARGET_CLASS, FILE_VIEWER_RENDER_SURFACE_BACKGROUND_PROPERTY, DEFAULT_FILE_VIEWER_RENDER_SESSION_DISPOSE_ERROR_LOGGER, FILE_VIEWER_RENDER_SESSION_DISPOSE_ERROR_MESSAGE, disposeActiveFileViewerRendererSession, disposeFileViewerRendered, disposeFileViewerRendererSession, getFileViewerShadowRootForNode, isFileViewerShadowRoot, normalizeFileViewerStyleIsolation, normalizeFileViewerRenderSurfaceBackground, removeFileViewerRenderTarget, reportFileViewerRenderSessionDisposeError, resetFileViewerRenderSurface, resolveFileViewerStyleIsolation, resolveFileViewerRenderSessionDisposeErrorMessage, runFileViewerRenderSurfaceClear, runFileViewerRenderSurfaceMount, syncFileViewerRenderSurfaceBackground, renderFileViewerHandler, } from './rendering/handler.js';
|
|
177
177
|
export { DEFAULT_FILE_VIEWER_SOURCE_FILENAME, createFileViewerTextDecoder, decodeFileViewerTextBuffer, decodeFilename, getExtension, normalizeFileExtension, normalizeFilename, isValidFileViewerUtf8, resolveFileViewerTextEncoding, resolveFileViewerSourceFilename, normalizeSource, readFileViewerBuffer, readFileViewerDataUrl, readFileViewerText, wrapFileViewerFileRef, } from './source/index.js';
|
|
178
|
-
export { DEFAULT_FILE_VIEWER_STATE_THEME, DEFAULT_FILE_VIEWER_UNSUPPORTED_DESCRIPTION, FILE_VIEWER_PREVIEW_MESSAGES, createFileViewerEmptyState, createFileViewerErrorState, createFileViewerPreviewLoadingState, createFileViewerReadyState, createFileViewerUnsupportedState, formatFileViewerErrorMessage, normalizeFileViewerErrorMessage, resolveFileViewerRendererInstallHint, } from './viewer/state.js';
|
|
178
|
+
export { DEFAULT_FILE_VIEWER_STATE_THEME, DEFAULT_FILE_VIEWER_UNSUPPORTED_DESCRIPTION, FILE_VIEWER_ERROR_MESSAGE, FILE_VIEWER_PREVIEW_MESSAGES, attachFileViewerErrorMessage, createFileViewerEmptyState, createFileViewerErrorState, createFileViewerPreviewLoadingState, createFileViewerReadyState, createFileViewerUnsupportedState, formatFileViewerErrorMessage, normalizeFileViewerErrorMessage, resolveFileViewerRendererInstallHint, } from './viewer/state.js';
|
|
179
179
|
export { buildFileViewerWatermarkBackgroundImage, buildFileViewerWatermarkInlineStyle, buildFileViewerWatermarkStyle, buildFileViewerWatermarkSvg, normalizeFileViewerWatermark, resolveFileViewerWatermarkPresentationState, } from './features/watermark.js';
|
|
180
180
|
export { buildFileViewerPrintMaskOverlayHtml, applyFileViewerPagePrintMasksToHtml, normalizeFileViewerPrintMaskOptions, normalizeFileViewerPrintMaskRegion, normalizeFileViewerPrintStamp, FILE_VIEWER_PRINT_MASK_STYLE, } from './features/printMask.js';
|
|
181
181
|
export { openFileViewerPrintMaskDesignerAsync, } from './features/printMaskLoader.js';
|
|
@@ -9,7 +9,7 @@ export declare const DEFAULT_FILE_VIEWER_CHM_WASM_PATH = "vendor/chm/chm_wasm_bg
|
|
|
9
9
|
export declare const DEFAULT_FILE_VIEWER_CHM_WASM_PACKAGE_PATH = "@file-viewer/renderer-chm/wasm/chm_wasm_bg.wasm";
|
|
10
10
|
export declare const DEFAULT_FILE_VIEWER_DOCX_WORKER_PATH = "vendor/docx/docx.worker.js";
|
|
11
11
|
export declare const DEFAULT_FILE_VIEWER_DOCX_WORKER_JSZIP_PATH = "vendor/docx/jszip.min.js";
|
|
12
|
-
export declare const DEFAULT_FILE_VIEWER_DOCX_RUNTIME_VERSION = "0.3.
|
|
12
|
+
export declare const DEFAULT_FILE_VIEWER_DOCX_RUNTIME_VERSION = "0.3.32";
|
|
13
13
|
export declare const DEFAULT_FILE_VIEWER_PRESENTATION_WORKER_PATH = "vendor/pptx/pptx.worker.js";
|
|
14
14
|
export declare const DEFAULT_FILE_VIEWER_PPT_RUNTIME_PATH = "vendor/ppt";
|
|
15
15
|
export declare const DEFAULT_FILE_VIEWER_PPT_RUNTIME_VERSION = "0.3.4";
|
package/dist/platform/assets.js
CHANGED
|
@@ -8,7 +8,7 @@ export const DEFAULT_FILE_VIEWER_CHM_WASM_PATH = 'vendor/chm/chm_wasm_bg.wasm';
|
|
|
8
8
|
export const DEFAULT_FILE_VIEWER_CHM_WASM_PACKAGE_PATH = '@file-viewer/renderer-chm/wasm/chm_wasm_bg.wasm';
|
|
9
9
|
export const DEFAULT_FILE_VIEWER_DOCX_WORKER_PATH = 'vendor/docx/docx.worker.js';
|
|
10
10
|
export const DEFAULT_FILE_VIEWER_DOCX_WORKER_JSZIP_PATH = 'vendor/docx/jszip.min.js';
|
|
11
|
-
export const DEFAULT_FILE_VIEWER_DOCX_RUNTIME_VERSION = '0.3.
|
|
11
|
+
export const DEFAULT_FILE_VIEWER_DOCX_RUNTIME_VERSION = '0.3.32';
|
|
12
12
|
export const DEFAULT_FILE_VIEWER_PRESENTATION_WORKER_PATH = 'vendor/pptx/pptx.worker.js';
|
|
13
13
|
export const DEFAULT_FILE_VIEWER_PPT_RUNTIME_PATH = 'vendor/ppt';
|
|
14
14
|
export const DEFAULT_FILE_VIEWER_PPT_RUNTIME_VERSION = '0.3.4';
|
|
@@ -14,11 +14,11 @@ export declare const ADAPTER_PRINT_REQUIRED_EXTENSIONS: readonly ["docx", "docm"
|
|
|
14
14
|
* 这些格式的预览结果是完整 DOM / SVG / Canvas 截图,解除滚动容器裁切后
|
|
15
15
|
* 可以稳定进入浏览器打印流程。
|
|
16
16
|
*/
|
|
17
|
-
export declare const DOM_PRINTABLE_EXTENSIONS: readonly ["pptx", "pptm", "potx", "potm", "ppsx", "ppsm", "ofd", "dxf", "dwg", "dwf", "dwfx", "xps", "excalidraw", "drawio", "dio", "mermaid", "mmd", "plantuml", "puml", "umd", "md", "markdown", "olb", "dra", ...("markdown" | "webp" | "jpeg" | "png" | "pdf" | "xyz" | "wasm" | "chm" | "typst" | "xd" | "fla" | "js" | "html" | "svg" | "rb" | "docx" | "docm" | "dotx" | "dotm" | "doc" | "dot" | "ppt" | "pot" | "pptx" | "pptm" | "potx" | "potm" | "ppsx" | "ppsm" | "rtf" | "odt" | "odp" | "xlsx" | "xltx" | "xlsm" | "xlsb" | "xls" | "xlt" | "xla" | "xlam" | "xltm" | "csv" | "tsv" | "ods" | "fods" | "pages" | "numbers" | "key" | "wpd" | "wp" | "wp5" | "wp6" | "dbf" | "ofd" | "hwp" | "hwpx" | "typ" | "zip" | "zipx" | "7z" | "rar" | "tar" | "gz" | "gzip" | "tgz" | "bz2" | "bzip2" | "tbz" | "tbz2" | "xz" | "txz" | "lzma" | "zst" | "tzst" | "cab" | "ar" | "cpio" | "iso" | "xar" | "lha" | "lzh" | "jar" | "war" | "ear" | "apk" | "cbz" | "cbr" | "eml" | "msg" | "mbox" | "olb" | "dra" | "gds" | "oas" | "oasis" | "dxf" | "dwg" | "dwf" | "dwfx" | "xps" | "glb" | "gltf" | "obj" | "stl" | "ply" | "fbx" | "dae" | "3ds" | "3mf" | "amf" | "usd" | "usda" | "usdc" | "usdz" | "kmz" | "step" | "stp" | "iges" | "igs" | "ifc" | "3dm" | "brep" | "pcd" | "wrl" | "vrml" | "vtk" | "vtp" | "geojson" | "kml" | "gpx" | "shp" | "excalidraw" | "drawio" | "dio" | "mermaid" | "mmd" | "plantuml" | "puml" | "xmind" | "epub" | "fb2" | "umd" | "gif" | "jpg" | "bmp" | "tiff" | "tif" | "avif" | "ico" | "heic" | "heif" | "jxl" | "dicom" | "dcm" | "p7m" | "p7s" | "p7c" | "p7b" | "pkcs7" | "cms" | "cmsc" | "tsd" | "tst" | "tsq" | "tsr" | "asics" | "scs" | "asice" | "sce" | "ers" | "asc" | "sig" | "pgp" | "gpg" | "jws" | "md" | "txt" | "json" | "mjs" | "cjs" | "css" | "java" | "py" | "htm" | "jsx" | "ts" | "tsx" | "xml" | "log" | "vue" | "yaml" | "yml" | "ini" | "sh" | "bash" | "sql" | "go" | "rs" | "php" | "c" | "cpp" | "cc" | "h" | "hpp" | "cs" | "diff" | "patch" | "bundle" | "bdl" | "jsonc" | "json5" | "ipynb" | "toml" | "proto" | "hcl" | "tex" | "gv" | "http" | "react" | "swift" | "kt" | "mp4" | "webm" | "m3u8" | "mp3" | "mpeg" | "wav" | "ogg" | "oga" | "opus" | "m4a" | "aac" | "flac" | "weba" | "midi" | "mid" | "psb" | "pdd" | "psdt" | "psd" | "ait" | "ai" | "idml" | "icml" | "idms" | "inx" | "xfl" | "indd" | "indt" | "ps" | "eps" | "ase" | "aco" | "abr" | "csh" | "pat" | "grd" | "asl" | "ttf" | "otf" | "woff" | "woff2" | "sqlite" | "parquet" | "avro" | "webarchive")[]];
|
|
17
|
+
export declare const DOM_PRINTABLE_EXTENSIONS: readonly ["pptx", "pptm", "potx", "potm", "ppsx", "ppsm", "ofd", "dxf", "dwg", "dwf", "dwfx", "xps", "excalidraw", "drawio", "dio", "mermaid", "mmd", "plantuml", "puml", "umd", "md", "markdown", "olb", "dra", ...("markdown" | "webp" | "jpeg" | "png" | "pdf" | "xyz" | "wasm" | "chm" | "typst" | "xd" | "fla" | "js" | "html" | "svg" | "rb" | "docx" | "docm" | "dotx" | "dotm" | "doc" | "dot" | "ppt" | "pot" | "pptx" | "pptm" | "potx" | "potm" | "ppsx" | "ppsm" | "rtf" | "odt" | "odp" | "xlsx" | "xltx" | "xlsm" | "xlsb" | "xls" | "xlt" | "xla" | "xlam" | "xltm" | "csv" | "tsv" | "ods" | "fods" | "pages" | "numbers" | "key" | "wpd" | "wp" | "wp5" | "wp6" | "dbf" | "ofd" | "hwp" | "hwpx" | "typ" | "zip" | "zipx" | "7z" | "rar" | "tar" | "gz" | "gzip" | "tgz" | "bz2" | "bzip2" | "tbz" | "tbz2" | "xz" | "txz" | "lzma" | "zst" | "tzst" | "cab" | "ar" | "cpio" | "iso" | "xar" | "lha" | "lzh" | "jar" | "war" | "ear" | "apk" | "cbz" | "cbr" | "eml" | "msg" | "mbox" | "olb" | "dra" | "gds" | "oas" | "oasis" | "dxf" | "dwg" | "dwf" | "dwfx" | "xps" | "glb" | "gltf" | "obj" | "stl" | "ply" | "fbx" | "dae" | "3ds" | "3mf" | "amf" | "usd" | "usda" | "usdc" | "usdz" | "kmz" | "step" | "stp" | "iges" | "igs" | "ifc" | "3dm" | "brep" | "pcd" | "wrl" | "vrml" | "vtk" | "vtp" | "geojson" | "kml" | "gpx" | "shp" | "excalidraw" | "drawio" | "dio" | "mermaid" | "mmd" | "plantuml" | "puml" | "xmind" | "epub" | "fb2" | "umd" | "gif" | "jpg" | "bmp" | "tiff" | "tif" | "avif" | "ico" | "heic" | "heif" | "jxl" | "dicom" | "dcm" | "p7m" | "p7s" | "p7c" | "p7b" | "pkcs7" | "cms" | "cmsc" | "tsd" | "tst" | "tsq" | "tsr" | "asics" | "scs" | "asice" | "sce" | "ers" | "asc" | "sig" | "pgp" | "gpg" | "jws" | "md" | "txt" | "json" | "mjs" | "cjs" | "css" | "java" | "py" | "htm" | "jsx" | "ts" | "tsx" | "xml" | "log" | "vue" | "yaml" | "yml" | "ini" | "sh" | "bash" | "sql" | "go" | "rs" | "php" | "c" | "cpp" | "cc" | "h" | "hpp" | "cs" | "diff" | "patch" | "bundle" | "bdl" | "jsonc" | "json5" | "ipynb" | "toml" | "proto" | "hcl" | "tex" | "gv" | "http" | "react" | "swift" | "kt" | "mp4" | "webm" | "m3u8" | "mp3" | "mpeg" | "wav" | "ogg" | "oga" | "opus" | "m4a" | "aac" | "flac" | "weba" | "midi" | "mid" | "psb" | "pdd" | "psdt" | "psd" | "ait" | "ai" | "idml" | "icml" | "idms" | "inx" | "xfl" | "indd" | "indt" | "ps" | "eps" | "ase" | "aco" | "abr" | "csh" | "pat" | "grd" | "asl" | "ttf" | "otf" | "woff" | "woff2" | "sqlite" | "parquet" | "avro" | "webarchive" | "bin" | "hex" | "elf" | "exe" | "dll" | "class" | "macho")[]];
|
|
18
18
|
/**
|
|
19
19
|
* 这些格式默认不展示打印按钮,避免导出半截内容。
|
|
20
20
|
*/
|
|
21
|
-
export declare const NON_PRINTABLE_EXTENSIONS: readonly ["xlsx", "xltx", "xlsm", "xlsb", "xls", "xlt", "xltm", "csv", "tsv", "ods", "fods", "numbers", ...("markdown" | "webp" | "jpeg" | "png" | "pdf" | "xyz" | "wasm" | "chm" | "typst" | "xd" | "fla" | "js" | "html" | "svg" | "rb" | "docx" | "docm" | "dotx" | "dotm" | "doc" | "dot" | "ppt" | "pot" | "pptx" | "pptm" | "potx" | "potm" | "ppsx" | "ppsm" | "rtf" | "odt" | "odp" | "xlsx" | "xltx" | "xlsm" | "xlsb" | "xls" | "xlt" | "xla" | "xlam" | "xltm" | "csv" | "tsv" | "ods" | "fods" | "pages" | "numbers" | "key" | "wpd" | "wp" | "wp5" | "wp6" | "dbf" | "ofd" | "hwp" | "hwpx" | "typ" | "zip" | "zipx" | "7z" | "rar" | "tar" | "gz" | "gzip" | "tgz" | "bz2" | "bzip2" | "tbz" | "tbz2" | "xz" | "txz" | "lzma" | "zst" | "tzst" | "cab" | "ar" | "cpio" | "iso" | "xar" | "lha" | "lzh" | "jar" | "war" | "ear" | "apk" | "cbz" | "cbr" | "eml" | "msg" | "mbox" | "olb" | "dra" | "gds" | "oas" | "oasis" | "dxf" | "dwg" | "dwf" | "dwfx" | "xps" | "glb" | "gltf" | "obj" | "stl" | "ply" | "fbx" | "dae" | "3ds" | "3mf" | "amf" | "usd" | "usda" | "usdc" | "usdz" | "kmz" | "step" | "stp" | "iges" | "igs" | "ifc" | "3dm" | "brep" | "pcd" | "wrl" | "vrml" | "vtk" | "vtp" | "geojson" | "kml" | "gpx" | "shp" | "excalidraw" | "drawio" | "dio" | "mermaid" | "mmd" | "plantuml" | "puml" | "xmind" | "epub" | "fb2" | "umd" | "gif" | "jpg" | "bmp" | "tiff" | "tif" | "avif" | "ico" | "heic" | "heif" | "jxl" | "dicom" | "dcm" | "p7m" | "p7s" | "p7c" | "p7b" | "pkcs7" | "cms" | "cmsc" | "tsd" | "tst" | "tsq" | "tsr" | "asics" | "scs" | "asice" | "sce" | "ers" | "asc" | "sig" | "pgp" | "gpg" | "jws" | "md" | "txt" | "json" | "mjs" | "cjs" | "css" | "java" | "py" | "htm" | "jsx" | "ts" | "tsx" | "xml" | "log" | "vue" | "yaml" | "yml" | "ini" | "sh" | "bash" | "sql" | "go" | "rs" | "php" | "c" | "cpp" | "cc" | "h" | "hpp" | "cs" | "diff" | "patch" | "bundle" | "bdl" | "jsonc" | "json5" | "ipynb" | "toml" | "proto" | "hcl" | "tex" | "gv" | "http" | "react" | "swift" | "kt" | "mp4" | "webm" | "m3u8" | "mp3" | "mpeg" | "wav" | "ogg" | "oga" | "opus" | "m4a" | "aac" | "flac" | "weba" | "midi" | "mid" | "psb" | "pdd" | "psdt" | "psd" | "ait" | "ai" | "idml" | "icml" | "idms" | "inx" | "xfl" | "indd" | "indt" | "ps" | "eps" | "ase" | "aco" | "abr" | "csh" | "pat" | "grd" | "asl" | "ttf" | "otf" | "woff" | "woff2" | "sqlite" | "parquet" | "avro" | "webarchive")[]];
|
|
21
|
+
export declare const NON_PRINTABLE_EXTENSIONS: readonly ["xlsx", "xltx", "xlsm", "xlsb", "xls", "xlt", "xltm", "csv", "tsv", "ods", "fods", "numbers", ...("markdown" | "webp" | "jpeg" | "png" | "pdf" | "xyz" | "wasm" | "chm" | "typst" | "xd" | "fla" | "js" | "html" | "svg" | "rb" | "docx" | "docm" | "dotx" | "dotm" | "doc" | "dot" | "ppt" | "pot" | "pptx" | "pptm" | "potx" | "potm" | "ppsx" | "ppsm" | "rtf" | "odt" | "odp" | "xlsx" | "xltx" | "xlsm" | "xlsb" | "xls" | "xlt" | "xla" | "xlam" | "xltm" | "csv" | "tsv" | "ods" | "fods" | "pages" | "numbers" | "key" | "wpd" | "wp" | "wp5" | "wp6" | "dbf" | "ofd" | "hwp" | "hwpx" | "typ" | "zip" | "zipx" | "7z" | "rar" | "tar" | "gz" | "gzip" | "tgz" | "bz2" | "bzip2" | "tbz" | "tbz2" | "xz" | "txz" | "lzma" | "zst" | "tzst" | "cab" | "ar" | "cpio" | "iso" | "xar" | "lha" | "lzh" | "jar" | "war" | "ear" | "apk" | "cbz" | "cbr" | "eml" | "msg" | "mbox" | "olb" | "dra" | "gds" | "oas" | "oasis" | "dxf" | "dwg" | "dwf" | "dwfx" | "xps" | "glb" | "gltf" | "obj" | "stl" | "ply" | "fbx" | "dae" | "3ds" | "3mf" | "amf" | "usd" | "usda" | "usdc" | "usdz" | "kmz" | "step" | "stp" | "iges" | "igs" | "ifc" | "3dm" | "brep" | "pcd" | "wrl" | "vrml" | "vtk" | "vtp" | "geojson" | "kml" | "gpx" | "shp" | "excalidraw" | "drawio" | "dio" | "mermaid" | "mmd" | "plantuml" | "puml" | "xmind" | "epub" | "fb2" | "umd" | "gif" | "jpg" | "bmp" | "tiff" | "tif" | "avif" | "ico" | "heic" | "heif" | "jxl" | "dicom" | "dcm" | "p7m" | "p7s" | "p7c" | "p7b" | "pkcs7" | "cms" | "cmsc" | "tsd" | "tst" | "tsq" | "tsr" | "asics" | "scs" | "asice" | "sce" | "ers" | "asc" | "sig" | "pgp" | "gpg" | "jws" | "md" | "txt" | "json" | "mjs" | "cjs" | "css" | "java" | "py" | "htm" | "jsx" | "ts" | "tsx" | "xml" | "log" | "vue" | "yaml" | "yml" | "ini" | "sh" | "bash" | "sql" | "go" | "rs" | "php" | "c" | "cpp" | "cc" | "h" | "hpp" | "cs" | "diff" | "patch" | "bundle" | "bdl" | "jsonc" | "json5" | "ipynb" | "toml" | "proto" | "hcl" | "tex" | "gv" | "http" | "react" | "swift" | "kt" | "mp4" | "webm" | "m3u8" | "mp3" | "mpeg" | "wav" | "ogg" | "oga" | "opus" | "m4a" | "aac" | "flac" | "weba" | "midi" | "mid" | "psb" | "pdd" | "psdt" | "psd" | "ait" | "ai" | "idml" | "icml" | "idms" | "inx" | "xfl" | "indd" | "indt" | "ps" | "eps" | "ase" | "aco" | "abr" | "csh" | "pat" | "grd" | "asl" | "ttf" | "otf" | "woff" | "woff2" | "sqlite" | "parquet" | "avro" | "webarchive" | "bin" | "hex" | "elf" | "exe" | "dll" | "class" | "macho")[]];
|
|
22
22
|
export declare const needsDedicatedPrintAdapter: (extension: string) => boolean;
|
|
23
23
|
export declare const isDomPrintableExtension: (extension: string) => boolean;
|
|
24
24
|
export declare const isKnownNonPrintableExtension: (extension: string) => boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { DEFAULT_REGISTERED_EXTENSIONS, DEFAULT_RENDERER_DEFINITIONS, DEFAULT_STABLE_SUPPORTED_EXTENSIONS, DEFAULT_SUPPORTED_EXTENSIONS, } from './formats.generated';
|
|
2
|
-
export declare const ARCHIVE_EXTENSIONS: readonly ("markdown" | "webp" | "jpeg" | "png" | "pdf" | "xyz" | "wasm" | "chm" | "typst" | "xd" | "fla" | "js" | "html" | "svg" | "rb" | "docx" | "docm" | "dotx" | "dotm" | "doc" | "dot" | "ppt" | "pot" | "pptx" | "pptm" | "potx" | "potm" | "ppsx" | "ppsm" | "rtf" | "odt" | "odp" | "xlsx" | "xltx" | "xlsm" | "xlsb" | "xls" | "xlt" | "xla" | "xlam" | "xltm" | "csv" | "tsv" | "ods" | "fods" | "pages" | "numbers" | "key" | "wpd" | "wp" | "wp5" | "wp6" | "dbf" | "ofd" | "hwp" | "hwpx" | "typ" | "zip" | "zipx" | "7z" | "rar" | "tar" | "gz" | "gzip" | "tgz" | "bz2" | "bzip2" | "tbz" | "tbz2" | "xz" | "txz" | "lzma" | "zst" | "tzst" | "cab" | "ar" | "cpio" | "iso" | "xar" | "lha" | "lzh" | "jar" | "war" | "ear" | "apk" | "cbz" | "cbr" | "eml" | "msg" | "mbox" | "olb" | "dra" | "gds" | "oas" | "oasis" | "dxf" | "dwg" | "dwf" | "dwfx" | "xps" | "glb" | "gltf" | "obj" | "stl" | "ply" | "fbx" | "dae" | "3ds" | "3mf" | "amf" | "usd" | "usda" | "usdc" | "usdz" | "kmz" | "step" | "stp" | "iges" | "igs" | "ifc" | "3dm" | "brep" | "pcd" | "wrl" | "vrml" | "vtk" | "vtp" | "geojson" | "kml" | "gpx" | "shp" | "excalidraw" | "drawio" | "dio" | "mermaid" | "mmd" | "plantuml" | "puml" | "xmind" | "epub" | "fb2" | "umd" | "gif" | "jpg" | "bmp" | "tiff" | "tif" | "avif" | "ico" | "heic" | "heif" | "jxl" | "dicom" | "dcm" | "p7m" | "p7s" | "p7c" | "p7b" | "pkcs7" | "cms" | "cmsc" | "tsd" | "tst" | "tsq" | "tsr" | "asics" | "scs" | "asice" | "sce" | "ers" | "asc" | "sig" | "pgp" | "gpg" | "jws" | "md" | "txt" | "json" | "mjs" | "cjs" | "css" | "java" | "py" | "htm" | "jsx" | "ts" | "tsx" | "xml" | "log" | "vue" | "yaml" | "yml" | "ini" | "sh" | "bash" | "sql" | "go" | "rs" | "php" | "c" | "cpp" | "cc" | "h" | "hpp" | "cs" | "diff" | "patch" | "bundle" | "bdl" | "jsonc" | "json5" | "ipynb" | "toml" | "proto" | "hcl" | "tex" | "gv" | "http" | "react" | "swift" | "kt" | "mp4" | "webm" | "m3u8" | "mp3" | "mpeg" | "wav" | "ogg" | "oga" | "opus" | "m4a" | "aac" | "flac" | "weba" | "midi" | "mid" | "psb" | "pdd" | "psdt" | "psd" | "ait" | "ai" | "idml" | "icml" | "idms" | "inx" | "xfl" | "indd" | "indt" | "ps" | "eps" | "ase" | "aco" | "abr" | "csh" | "pat" | "grd" | "asl" | "ttf" | "otf" | "woff" | "woff2" | "sqlite" | "parquet" | "avro" | "webarchive")[];
|
|
3
|
-
export declare const MODEL_EXTENSIONS: readonly ("markdown" | "webp" | "jpeg" | "png" | "pdf" | "xyz" | "wasm" | "chm" | "typst" | "xd" | "fla" | "js" | "html" | "svg" | "rb" | "docx" | "docm" | "dotx" | "dotm" | "doc" | "dot" | "ppt" | "pot" | "pptx" | "pptm" | "potx" | "potm" | "ppsx" | "ppsm" | "rtf" | "odt" | "odp" | "xlsx" | "xltx" | "xlsm" | "xlsb" | "xls" | "xlt" | "xla" | "xlam" | "xltm" | "csv" | "tsv" | "ods" | "fods" | "pages" | "numbers" | "key" | "wpd" | "wp" | "wp5" | "wp6" | "dbf" | "ofd" | "hwp" | "hwpx" | "typ" | "zip" | "zipx" | "7z" | "rar" | "tar" | "gz" | "gzip" | "tgz" | "bz2" | "bzip2" | "tbz" | "tbz2" | "xz" | "txz" | "lzma" | "zst" | "tzst" | "cab" | "ar" | "cpio" | "iso" | "xar" | "lha" | "lzh" | "jar" | "war" | "ear" | "apk" | "cbz" | "cbr" | "eml" | "msg" | "mbox" | "olb" | "dra" | "gds" | "oas" | "oasis" | "dxf" | "dwg" | "dwf" | "dwfx" | "xps" | "glb" | "gltf" | "obj" | "stl" | "ply" | "fbx" | "dae" | "3ds" | "3mf" | "amf" | "usd" | "usda" | "usdc" | "usdz" | "kmz" | "step" | "stp" | "iges" | "igs" | "ifc" | "3dm" | "brep" | "pcd" | "wrl" | "vrml" | "vtk" | "vtp" | "geojson" | "kml" | "gpx" | "shp" | "excalidraw" | "drawio" | "dio" | "mermaid" | "mmd" | "plantuml" | "puml" | "xmind" | "epub" | "fb2" | "umd" | "gif" | "jpg" | "bmp" | "tiff" | "tif" | "avif" | "ico" | "heic" | "heif" | "jxl" | "dicom" | "dcm" | "p7m" | "p7s" | "p7c" | "p7b" | "pkcs7" | "cms" | "cmsc" | "tsd" | "tst" | "tsq" | "tsr" | "asics" | "scs" | "asice" | "sce" | "ers" | "asc" | "sig" | "pgp" | "gpg" | "jws" | "md" | "txt" | "json" | "mjs" | "cjs" | "css" | "java" | "py" | "htm" | "jsx" | "ts" | "tsx" | "xml" | "log" | "vue" | "yaml" | "yml" | "ini" | "sh" | "bash" | "sql" | "go" | "rs" | "php" | "c" | "cpp" | "cc" | "h" | "hpp" | "cs" | "diff" | "patch" | "bundle" | "bdl" | "jsonc" | "json5" | "ipynb" | "toml" | "proto" | "hcl" | "tex" | "gv" | "http" | "react" | "swift" | "kt" | "mp4" | "webm" | "m3u8" | "mp3" | "mpeg" | "wav" | "ogg" | "oga" | "opus" | "m4a" | "aac" | "flac" | "weba" | "midi" | "mid" | "psb" | "pdd" | "psdt" | "psd" | "ait" | "ai" | "idml" | "icml" | "idms" | "inx" | "xfl" | "indd" | "indt" | "ps" | "eps" | "ase" | "aco" | "abr" | "csh" | "pat" | "grd" | "asl" | "ttf" | "otf" | "woff" | "woff2" | "sqlite" | "parquet" | "avro" | "webarchive")[];
|
|
4
|
-
export declare const TEXT_EXTENSIONS: readonly ("markdown" | "webp" | "jpeg" | "png" | "pdf" | "xyz" | "wasm" | "chm" | "typst" | "xd" | "fla" | "js" | "html" | "svg" | "rb" | "docx" | "docm" | "dotx" | "dotm" | "doc" | "dot" | "ppt" | "pot" | "pptx" | "pptm" | "potx" | "potm" | "ppsx" | "ppsm" | "rtf" | "odt" | "odp" | "xlsx" | "xltx" | "xlsm" | "xlsb" | "xls" | "xlt" | "xla" | "xlam" | "xltm" | "csv" | "tsv" | "ods" | "fods" | "pages" | "numbers" | "key" | "wpd" | "wp" | "wp5" | "wp6" | "dbf" | "ofd" | "hwp" | "hwpx" | "typ" | "zip" | "zipx" | "7z" | "rar" | "tar" | "gz" | "gzip" | "tgz" | "bz2" | "bzip2" | "tbz" | "tbz2" | "xz" | "txz" | "lzma" | "zst" | "tzst" | "cab" | "ar" | "cpio" | "iso" | "xar" | "lha" | "lzh" | "jar" | "war" | "ear" | "apk" | "cbz" | "cbr" | "eml" | "msg" | "mbox" | "olb" | "dra" | "gds" | "oas" | "oasis" | "dxf" | "dwg" | "dwf" | "dwfx" | "xps" | "glb" | "gltf" | "obj" | "stl" | "ply" | "fbx" | "dae" | "3ds" | "3mf" | "amf" | "usd" | "usda" | "usdc" | "usdz" | "kmz" | "step" | "stp" | "iges" | "igs" | "ifc" | "3dm" | "brep" | "pcd" | "wrl" | "vrml" | "vtk" | "vtp" | "geojson" | "kml" | "gpx" | "shp" | "excalidraw" | "drawio" | "dio" | "mermaid" | "mmd" | "plantuml" | "puml" | "xmind" | "epub" | "fb2" | "umd" | "gif" | "jpg" | "bmp" | "tiff" | "tif" | "avif" | "ico" | "heic" | "heif" | "jxl" | "dicom" | "dcm" | "p7m" | "p7s" | "p7c" | "p7b" | "pkcs7" | "cms" | "cmsc" | "tsd" | "tst" | "tsq" | "tsr" | "asics" | "scs" | "asice" | "sce" | "ers" | "asc" | "sig" | "pgp" | "gpg" | "jws" | "md" | "txt" | "json" | "mjs" | "cjs" | "css" | "java" | "py" | "htm" | "jsx" | "ts" | "tsx" | "xml" | "log" | "vue" | "yaml" | "yml" | "ini" | "sh" | "bash" | "sql" | "go" | "rs" | "php" | "c" | "cpp" | "cc" | "h" | "hpp" | "cs" | "diff" | "patch" | "bundle" | "bdl" | "jsonc" | "json5" | "ipynb" | "toml" | "proto" | "hcl" | "tex" | "gv" | "http" | "react" | "swift" | "kt" | "mp4" | "webm" | "m3u8" | "mp3" | "mpeg" | "wav" | "ogg" | "oga" | "opus" | "m4a" | "aac" | "flac" | "weba" | "midi" | "mid" | "psb" | "pdd" | "psdt" | "psd" | "ait" | "ai" | "idml" | "icml" | "idms" | "inx" | "xfl" | "indd" | "indt" | "ps" | "eps" | "ase" | "aco" | "abr" | "csh" | "pat" | "grd" | "asl" | "ttf" | "otf" | "woff" | "woff2" | "sqlite" | "parquet" | "avro" | "webarchive")[];
|
|
5
|
-
export declare const IMAGE_EXTENSIONS: readonly ("markdown" | "webp" | "jpeg" | "png" | "pdf" | "xyz" | "wasm" | "chm" | "typst" | "xd" | "fla" | "js" | "html" | "svg" | "rb" | "docx" | "docm" | "dotx" | "dotm" | "doc" | "dot" | "ppt" | "pot" | "pptx" | "pptm" | "potx" | "potm" | "ppsx" | "ppsm" | "rtf" | "odt" | "odp" | "xlsx" | "xltx" | "xlsm" | "xlsb" | "xls" | "xlt" | "xla" | "xlam" | "xltm" | "csv" | "tsv" | "ods" | "fods" | "pages" | "numbers" | "key" | "wpd" | "wp" | "wp5" | "wp6" | "dbf" | "ofd" | "hwp" | "hwpx" | "typ" | "zip" | "zipx" | "7z" | "rar" | "tar" | "gz" | "gzip" | "tgz" | "bz2" | "bzip2" | "tbz" | "tbz2" | "xz" | "txz" | "lzma" | "zst" | "tzst" | "cab" | "ar" | "cpio" | "iso" | "xar" | "lha" | "lzh" | "jar" | "war" | "ear" | "apk" | "cbz" | "cbr" | "eml" | "msg" | "mbox" | "olb" | "dra" | "gds" | "oas" | "oasis" | "dxf" | "dwg" | "dwf" | "dwfx" | "xps" | "glb" | "gltf" | "obj" | "stl" | "ply" | "fbx" | "dae" | "3ds" | "3mf" | "amf" | "usd" | "usda" | "usdc" | "usdz" | "kmz" | "step" | "stp" | "iges" | "igs" | "ifc" | "3dm" | "brep" | "pcd" | "wrl" | "vrml" | "vtk" | "vtp" | "geojson" | "kml" | "gpx" | "shp" | "excalidraw" | "drawio" | "dio" | "mermaid" | "mmd" | "plantuml" | "puml" | "xmind" | "epub" | "fb2" | "umd" | "gif" | "jpg" | "bmp" | "tiff" | "tif" | "avif" | "ico" | "heic" | "heif" | "jxl" | "dicom" | "dcm" | "p7m" | "p7s" | "p7c" | "p7b" | "pkcs7" | "cms" | "cmsc" | "tsd" | "tst" | "tsq" | "tsr" | "asics" | "scs" | "asice" | "sce" | "ers" | "asc" | "sig" | "pgp" | "gpg" | "jws" | "md" | "txt" | "json" | "mjs" | "cjs" | "css" | "java" | "py" | "htm" | "jsx" | "ts" | "tsx" | "xml" | "log" | "vue" | "yaml" | "yml" | "ini" | "sh" | "bash" | "sql" | "go" | "rs" | "php" | "c" | "cpp" | "cc" | "h" | "hpp" | "cs" | "diff" | "patch" | "bundle" | "bdl" | "jsonc" | "json5" | "ipynb" | "toml" | "proto" | "hcl" | "tex" | "gv" | "http" | "react" | "swift" | "kt" | "mp4" | "webm" | "m3u8" | "mp3" | "mpeg" | "wav" | "ogg" | "oga" | "opus" | "m4a" | "aac" | "flac" | "weba" | "midi" | "mid" | "psb" | "pdd" | "psdt" | "psd" | "ait" | "ai" | "idml" | "icml" | "idms" | "inx" | "xfl" | "indd" | "indt" | "ps" | "eps" | "ase" | "aco" | "abr" | "csh" | "pat" | "grd" | "asl" | "ttf" | "otf" | "woff" | "woff2" | "sqlite" | "parquet" | "avro" | "webarchive")[];
|
|
2
|
+
export declare const ARCHIVE_EXTENSIONS: readonly ("markdown" | "webp" | "jpeg" | "png" | "pdf" | "xyz" | "wasm" | "chm" | "typst" | "xd" | "fla" | "js" | "html" | "svg" | "rb" | "docx" | "docm" | "dotx" | "dotm" | "doc" | "dot" | "ppt" | "pot" | "pptx" | "pptm" | "potx" | "potm" | "ppsx" | "ppsm" | "rtf" | "odt" | "odp" | "xlsx" | "xltx" | "xlsm" | "xlsb" | "xls" | "xlt" | "xla" | "xlam" | "xltm" | "csv" | "tsv" | "ods" | "fods" | "pages" | "numbers" | "key" | "wpd" | "wp" | "wp5" | "wp6" | "dbf" | "ofd" | "hwp" | "hwpx" | "typ" | "zip" | "zipx" | "7z" | "rar" | "tar" | "gz" | "gzip" | "tgz" | "bz2" | "bzip2" | "tbz" | "tbz2" | "xz" | "txz" | "lzma" | "zst" | "tzst" | "cab" | "ar" | "cpio" | "iso" | "xar" | "lha" | "lzh" | "jar" | "war" | "ear" | "apk" | "cbz" | "cbr" | "eml" | "msg" | "mbox" | "olb" | "dra" | "gds" | "oas" | "oasis" | "dxf" | "dwg" | "dwf" | "dwfx" | "xps" | "glb" | "gltf" | "obj" | "stl" | "ply" | "fbx" | "dae" | "3ds" | "3mf" | "amf" | "usd" | "usda" | "usdc" | "usdz" | "kmz" | "step" | "stp" | "iges" | "igs" | "ifc" | "3dm" | "brep" | "pcd" | "wrl" | "vrml" | "vtk" | "vtp" | "geojson" | "kml" | "gpx" | "shp" | "excalidraw" | "drawio" | "dio" | "mermaid" | "mmd" | "plantuml" | "puml" | "xmind" | "epub" | "fb2" | "umd" | "gif" | "jpg" | "bmp" | "tiff" | "tif" | "avif" | "ico" | "heic" | "heif" | "jxl" | "dicom" | "dcm" | "p7m" | "p7s" | "p7c" | "p7b" | "pkcs7" | "cms" | "cmsc" | "tsd" | "tst" | "tsq" | "tsr" | "asics" | "scs" | "asice" | "sce" | "ers" | "asc" | "sig" | "pgp" | "gpg" | "jws" | "md" | "txt" | "json" | "mjs" | "cjs" | "css" | "java" | "py" | "htm" | "jsx" | "ts" | "tsx" | "xml" | "log" | "vue" | "yaml" | "yml" | "ini" | "sh" | "bash" | "sql" | "go" | "rs" | "php" | "c" | "cpp" | "cc" | "h" | "hpp" | "cs" | "diff" | "patch" | "bundle" | "bdl" | "jsonc" | "json5" | "ipynb" | "toml" | "proto" | "hcl" | "tex" | "gv" | "http" | "react" | "swift" | "kt" | "mp4" | "webm" | "m3u8" | "mp3" | "mpeg" | "wav" | "ogg" | "oga" | "opus" | "m4a" | "aac" | "flac" | "weba" | "midi" | "mid" | "psb" | "pdd" | "psdt" | "psd" | "ait" | "ai" | "idml" | "icml" | "idms" | "inx" | "xfl" | "indd" | "indt" | "ps" | "eps" | "ase" | "aco" | "abr" | "csh" | "pat" | "grd" | "asl" | "ttf" | "otf" | "woff" | "woff2" | "sqlite" | "parquet" | "avro" | "webarchive" | "bin" | "hex" | "elf" | "exe" | "dll" | "class" | "macho")[];
|
|
3
|
+
export declare const MODEL_EXTENSIONS: readonly ("markdown" | "webp" | "jpeg" | "png" | "pdf" | "xyz" | "wasm" | "chm" | "typst" | "xd" | "fla" | "js" | "html" | "svg" | "rb" | "docx" | "docm" | "dotx" | "dotm" | "doc" | "dot" | "ppt" | "pot" | "pptx" | "pptm" | "potx" | "potm" | "ppsx" | "ppsm" | "rtf" | "odt" | "odp" | "xlsx" | "xltx" | "xlsm" | "xlsb" | "xls" | "xlt" | "xla" | "xlam" | "xltm" | "csv" | "tsv" | "ods" | "fods" | "pages" | "numbers" | "key" | "wpd" | "wp" | "wp5" | "wp6" | "dbf" | "ofd" | "hwp" | "hwpx" | "typ" | "zip" | "zipx" | "7z" | "rar" | "tar" | "gz" | "gzip" | "tgz" | "bz2" | "bzip2" | "tbz" | "tbz2" | "xz" | "txz" | "lzma" | "zst" | "tzst" | "cab" | "ar" | "cpio" | "iso" | "xar" | "lha" | "lzh" | "jar" | "war" | "ear" | "apk" | "cbz" | "cbr" | "eml" | "msg" | "mbox" | "olb" | "dra" | "gds" | "oas" | "oasis" | "dxf" | "dwg" | "dwf" | "dwfx" | "xps" | "glb" | "gltf" | "obj" | "stl" | "ply" | "fbx" | "dae" | "3ds" | "3mf" | "amf" | "usd" | "usda" | "usdc" | "usdz" | "kmz" | "step" | "stp" | "iges" | "igs" | "ifc" | "3dm" | "brep" | "pcd" | "wrl" | "vrml" | "vtk" | "vtp" | "geojson" | "kml" | "gpx" | "shp" | "excalidraw" | "drawio" | "dio" | "mermaid" | "mmd" | "plantuml" | "puml" | "xmind" | "epub" | "fb2" | "umd" | "gif" | "jpg" | "bmp" | "tiff" | "tif" | "avif" | "ico" | "heic" | "heif" | "jxl" | "dicom" | "dcm" | "p7m" | "p7s" | "p7c" | "p7b" | "pkcs7" | "cms" | "cmsc" | "tsd" | "tst" | "tsq" | "tsr" | "asics" | "scs" | "asice" | "sce" | "ers" | "asc" | "sig" | "pgp" | "gpg" | "jws" | "md" | "txt" | "json" | "mjs" | "cjs" | "css" | "java" | "py" | "htm" | "jsx" | "ts" | "tsx" | "xml" | "log" | "vue" | "yaml" | "yml" | "ini" | "sh" | "bash" | "sql" | "go" | "rs" | "php" | "c" | "cpp" | "cc" | "h" | "hpp" | "cs" | "diff" | "patch" | "bundle" | "bdl" | "jsonc" | "json5" | "ipynb" | "toml" | "proto" | "hcl" | "tex" | "gv" | "http" | "react" | "swift" | "kt" | "mp4" | "webm" | "m3u8" | "mp3" | "mpeg" | "wav" | "ogg" | "oga" | "opus" | "m4a" | "aac" | "flac" | "weba" | "midi" | "mid" | "psb" | "pdd" | "psdt" | "psd" | "ait" | "ai" | "idml" | "icml" | "idms" | "inx" | "xfl" | "indd" | "indt" | "ps" | "eps" | "ase" | "aco" | "abr" | "csh" | "pat" | "grd" | "asl" | "ttf" | "otf" | "woff" | "woff2" | "sqlite" | "parquet" | "avro" | "webarchive" | "bin" | "hex" | "elf" | "exe" | "dll" | "class" | "macho")[];
|
|
4
|
+
export declare const TEXT_EXTENSIONS: readonly ("markdown" | "webp" | "jpeg" | "png" | "pdf" | "xyz" | "wasm" | "chm" | "typst" | "xd" | "fla" | "js" | "html" | "svg" | "rb" | "docx" | "docm" | "dotx" | "dotm" | "doc" | "dot" | "ppt" | "pot" | "pptx" | "pptm" | "potx" | "potm" | "ppsx" | "ppsm" | "rtf" | "odt" | "odp" | "xlsx" | "xltx" | "xlsm" | "xlsb" | "xls" | "xlt" | "xla" | "xlam" | "xltm" | "csv" | "tsv" | "ods" | "fods" | "pages" | "numbers" | "key" | "wpd" | "wp" | "wp5" | "wp6" | "dbf" | "ofd" | "hwp" | "hwpx" | "typ" | "zip" | "zipx" | "7z" | "rar" | "tar" | "gz" | "gzip" | "tgz" | "bz2" | "bzip2" | "tbz" | "tbz2" | "xz" | "txz" | "lzma" | "zst" | "tzst" | "cab" | "ar" | "cpio" | "iso" | "xar" | "lha" | "lzh" | "jar" | "war" | "ear" | "apk" | "cbz" | "cbr" | "eml" | "msg" | "mbox" | "olb" | "dra" | "gds" | "oas" | "oasis" | "dxf" | "dwg" | "dwf" | "dwfx" | "xps" | "glb" | "gltf" | "obj" | "stl" | "ply" | "fbx" | "dae" | "3ds" | "3mf" | "amf" | "usd" | "usda" | "usdc" | "usdz" | "kmz" | "step" | "stp" | "iges" | "igs" | "ifc" | "3dm" | "brep" | "pcd" | "wrl" | "vrml" | "vtk" | "vtp" | "geojson" | "kml" | "gpx" | "shp" | "excalidraw" | "drawio" | "dio" | "mermaid" | "mmd" | "plantuml" | "puml" | "xmind" | "epub" | "fb2" | "umd" | "gif" | "jpg" | "bmp" | "tiff" | "tif" | "avif" | "ico" | "heic" | "heif" | "jxl" | "dicom" | "dcm" | "p7m" | "p7s" | "p7c" | "p7b" | "pkcs7" | "cms" | "cmsc" | "tsd" | "tst" | "tsq" | "tsr" | "asics" | "scs" | "asice" | "sce" | "ers" | "asc" | "sig" | "pgp" | "gpg" | "jws" | "md" | "txt" | "json" | "mjs" | "cjs" | "css" | "java" | "py" | "htm" | "jsx" | "ts" | "tsx" | "xml" | "log" | "vue" | "yaml" | "yml" | "ini" | "sh" | "bash" | "sql" | "go" | "rs" | "php" | "c" | "cpp" | "cc" | "h" | "hpp" | "cs" | "diff" | "patch" | "bundle" | "bdl" | "jsonc" | "json5" | "ipynb" | "toml" | "proto" | "hcl" | "tex" | "gv" | "http" | "react" | "swift" | "kt" | "mp4" | "webm" | "m3u8" | "mp3" | "mpeg" | "wav" | "ogg" | "oga" | "opus" | "m4a" | "aac" | "flac" | "weba" | "midi" | "mid" | "psb" | "pdd" | "psdt" | "psd" | "ait" | "ai" | "idml" | "icml" | "idms" | "inx" | "xfl" | "indd" | "indt" | "ps" | "eps" | "ase" | "aco" | "abr" | "csh" | "pat" | "grd" | "asl" | "ttf" | "otf" | "woff" | "woff2" | "sqlite" | "parquet" | "avro" | "webarchive" | "bin" | "hex" | "elf" | "exe" | "dll" | "class" | "macho")[];
|
|
5
|
+
export declare const IMAGE_EXTENSIONS: readonly ("markdown" | "webp" | "jpeg" | "png" | "pdf" | "xyz" | "wasm" | "chm" | "typst" | "xd" | "fla" | "js" | "html" | "svg" | "rb" | "docx" | "docm" | "dotx" | "dotm" | "doc" | "dot" | "ppt" | "pot" | "pptx" | "pptm" | "potx" | "potm" | "ppsx" | "ppsm" | "rtf" | "odt" | "odp" | "xlsx" | "xltx" | "xlsm" | "xlsb" | "xls" | "xlt" | "xla" | "xlam" | "xltm" | "csv" | "tsv" | "ods" | "fods" | "pages" | "numbers" | "key" | "wpd" | "wp" | "wp5" | "wp6" | "dbf" | "ofd" | "hwp" | "hwpx" | "typ" | "zip" | "zipx" | "7z" | "rar" | "tar" | "gz" | "gzip" | "tgz" | "bz2" | "bzip2" | "tbz" | "tbz2" | "xz" | "txz" | "lzma" | "zst" | "tzst" | "cab" | "ar" | "cpio" | "iso" | "xar" | "lha" | "lzh" | "jar" | "war" | "ear" | "apk" | "cbz" | "cbr" | "eml" | "msg" | "mbox" | "olb" | "dra" | "gds" | "oas" | "oasis" | "dxf" | "dwg" | "dwf" | "dwfx" | "xps" | "glb" | "gltf" | "obj" | "stl" | "ply" | "fbx" | "dae" | "3ds" | "3mf" | "amf" | "usd" | "usda" | "usdc" | "usdz" | "kmz" | "step" | "stp" | "iges" | "igs" | "ifc" | "3dm" | "brep" | "pcd" | "wrl" | "vrml" | "vtk" | "vtp" | "geojson" | "kml" | "gpx" | "shp" | "excalidraw" | "drawio" | "dio" | "mermaid" | "mmd" | "plantuml" | "puml" | "xmind" | "epub" | "fb2" | "umd" | "gif" | "jpg" | "bmp" | "tiff" | "tif" | "avif" | "ico" | "heic" | "heif" | "jxl" | "dicom" | "dcm" | "p7m" | "p7s" | "p7c" | "p7b" | "pkcs7" | "cms" | "cmsc" | "tsd" | "tst" | "tsq" | "tsr" | "asics" | "scs" | "asice" | "sce" | "ers" | "asc" | "sig" | "pgp" | "gpg" | "jws" | "md" | "txt" | "json" | "mjs" | "cjs" | "css" | "java" | "py" | "htm" | "jsx" | "ts" | "tsx" | "xml" | "log" | "vue" | "yaml" | "yml" | "ini" | "sh" | "bash" | "sql" | "go" | "rs" | "php" | "c" | "cpp" | "cc" | "h" | "hpp" | "cs" | "diff" | "patch" | "bundle" | "bdl" | "jsonc" | "json5" | "ipynb" | "toml" | "proto" | "hcl" | "tex" | "gv" | "http" | "react" | "swift" | "kt" | "mp4" | "webm" | "m3u8" | "mp3" | "mpeg" | "wav" | "ogg" | "oga" | "opus" | "m4a" | "aac" | "flac" | "weba" | "midi" | "mid" | "psb" | "pdd" | "psdt" | "psd" | "ait" | "ai" | "idml" | "icml" | "idms" | "inx" | "xfl" | "indd" | "indt" | "ps" | "eps" | "ase" | "aco" | "abr" | "csh" | "pat" | "grd" | "asl" | "ttf" | "otf" | "woff" | "woff2" | "sqlite" | "parquet" | "avro" | "webarchive" | "bin" | "hex" | "elf" | "exe" | "dll" | "class" | "macho")[];
|
|
@@ -859,8 +859,27 @@ export declare const DEFAULT_RENDERER_DEFINITIONS: readonly [{
|
|
|
859
859
|
readonly zoom: false;
|
|
860
860
|
readonly search: true;
|
|
861
861
|
};
|
|
862
|
+
}, {
|
|
863
|
+
readonly id: "binary-inspector";
|
|
864
|
+
readonly label: "Binary Inspector";
|
|
865
|
+
readonly category: "asset";
|
|
866
|
+
readonly extensions: readonly ["bin", "hex", "elf", "exe", "dll", "class", "macho"];
|
|
867
|
+
readonly async: true;
|
|
868
|
+
readonly supportLevel: "structured";
|
|
869
|
+
readonly status: "experimental";
|
|
870
|
+
readonly packageName: "@file-viewer/renderer-binary";
|
|
871
|
+
readonly presets: readonly [];
|
|
872
|
+
readonly containerVersions: readonly ["Raw bytes", "ELF", "PE/COFF", "Mach-O", "PNG", "ZIP", "WebAssembly", "Java class"];
|
|
873
|
+
readonly knownLimits: readonly ["The package is explicit opt-in and never claims application/octet-stream or extensions owned by dedicated renderers", "Only a reviewed built-in template catalog is parsed in a terminable module Worker; user-authored templates, dynamic imports, editing, and patching are out of scope", "Whole inputs, parse time, structure nodes, nesting, and decoded string bytes are capped before data reaches the DOM; large files are rejected instead of partially scanning arbitrary pages"];
|
|
874
|
+
readonly capabilities: {
|
|
875
|
+
readonly download: true;
|
|
876
|
+
readonly print: false;
|
|
877
|
+
readonly exportHtml: false;
|
|
878
|
+
readonly zoom: false;
|
|
879
|
+
readonly search: false;
|
|
880
|
+
};
|
|
862
881
|
}];
|
|
863
|
-
export declare const DEFAULT_REGISTERED_EXTENSIONS: readonly ("markdown" | "webp" | "jpeg" | "png" | "pdf" | "xyz" | "wasm" | "chm" | "typst" | "xd" | "fla" | "js" | "html" | "svg" | "rb" | "docx" | "docm" | "dotx" | "dotm" | "doc" | "dot" | "ppt" | "pot" | "pptx" | "pptm" | "potx" | "potm" | "ppsx" | "ppsm" | "rtf" | "odt" | "odp" | "xlsx" | "xltx" | "xlsm" | "xlsb" | "xls" | "xlt" | "xla" | "xlam" | "xltm" | "csv" | "tsv" | "ods" | "fods" | "pages" | "numbers" | "key" | "wpd" | "wp" | "wp5" | "wp6" | "dbf" | "ofd" | "hwp" | "hwpx" | "typ" | "zip" | "zipx" | "7z" | "rar" | "tar" | "gz" | "gzip" | "tgz" | "bz2" | "bzip2" | "tbz" | "tbz2" | "xz" | "txz" | "lzma" | "zst" | "tzst" | "cab" | "ar" | "cpio" | "iso" | "xar" | "lha" | "lzh" | "jar" | "war" | "ear" | "apk" | "cbz" | "cbr" | "eml" | "msg" | "mbox" | "olb" | "dra" | "gds" | "oas" | "oasis" | "dxf" | "dwg" | "dwf" | "dwfx" | "xps" | "glb" | "gltf" | "obj" | "stl" | "ply" | "fbx" | "dae" | "3ds" | "3mf" | "amf" | "usd" | "usda" | "usdc" | "usdz" | "kmz" | "step" | "stp" | "iges" | "igs" | "ifc" | "3dm" | "brep" | "pcd" | "wrl" | "vrml" | "vtk" | "vtp" | "geojson" | "kml" | "gpx" | "shp" | "excalidraw" | "drawio" | "dio" | "mermaid" | "mmd" | "plantuml" | "puml" | "xmind" | "epub" | "fb2" | "umd" | "gif" | "jpg" | "bmp" | "tiff" | "tif" | "avif" | "ico" | "heic" | "heif" | "jxl" | "dicom" | "dcm" | "p7m" | "p7s" | "p7c" | "p7b" | "pkcs7" | "cms" | "cmsc" | "tsd" | "tst" | "tsq" | "tsr" | "asics" | "scs" | "asice" | "sce" | "ers" | "asc" | "sig" | "pgp" | "gpg" | "jws" | "md" | "txt" | "json" | "mjs" | "cjs" | "css" | "java" | "py" | "htm" | "jsx" | "ts" | "tsx" | "xml" | "log" | "vue" | "yaml" | "yml" | "ini" | "sh" | "bash" | "sql" | "go" | "rs" | "php" | "c" | "cpp" | "cc" | "h" | "hpp" | "cs" | "diff" | "patch" | "bundle" | "bdl" | "jsonc" | "json5" | "ipynb" | "toml" | "proto" | "hcl" | "tex" | "gv" | "http" | "react" | "swift" | "kt" | "mp4" | "webm" | "m3u8" | "mp3" | "mpeg" | "wav" | "ogg" | "oga" | "opus" | "m4a" | "aac" | "flac" | "weba" | "midi" | "mid" | "psb" | "pdd" | "psdt" | "psd" | "ait" | "ai" | "idml" | "icml" | "idms" | "inx" | "xfl" | "indd" | "indt" | "ps" | "eps" | "ase" | "aco" | "abr" | "csh" | "pat" | "grd" | "asl" | "ttf" | "otf" | "woff" | "woff2" | "sqlite" | "parquet" | "avro" | "webarchive")[];
|
|
882
|
+
export declare const DEFAULT_REGISTERED_EXTENSIONS: readonly ("markdown" | "webp" | "jpeg" | "png" | "pdf" | "xyz" | "wasm" | "chm" | "typst" | "xd" | "fla" | "js" | "html" | "svg" | "rb" | "docx" | "docm" | "dotx" | "dotm" | "doc" | "dot" | "ppt" | "pot" | "pptx" | "pptm" | "potx" | "potm" | "ppsx" | "ppsm" | "rtf" | "odt" | "odp" | "xlsx" | "xltx" | "xlsm" | "xlsb" | "xls" | "xlt" | "xla" | "xlam" | "xltm" | "csv" | "tsv" | "ods" | "fods" | "pages" | "numbers" | "key" | "wpd" | "wp" | "wp5" | "wp6" | "dbf" | "ofd" | "hwp" | "hwpx" | "typ" | "zip" | "zipx" | "7z" | "rar" | "tar" | "gz" | "gzip" | "tgz" | "bz2" | "bzip2" | "tbz" | "tbz2" | "xz" | "txz" | "lzma" | "zst" | "tzst" | "cab" | "ar" | "cpio" | "iso" | "xar" | "lha" | "lzh" | "jar" | "war" | "ear" | "apk" | "cbz" | "cbr" | "eml" | "msg" | "mbox" | "olb" | "dra" | "gds" | "oas" | "oasis" | "dxf" | "dwg" | "dwf" | "dwfx" | "xps" | "glb" | "gltf" | "obj" | "stl" | "ply" | "fbx" | "dae" | "3ds" | "3mf" | "amf" | "usd" | "usda" | "usdc" | "usdz" | "kmz" | "step" | "stp" | "iges" | "igs" | "ifc" | "3dm" | "brep" | "pcd" | "wrl" | "vrml" | "vtk" | "vtp" | "geojson" | "kml" | "gpx" | "shp" | "excalidraw" | "drawio" | "dio" | "mermaid" | "mmd" | "plantuml" | "puml" | "xmind" | "epub" | "fb2" | "umd" | "gif" | "jpg" | "bmp" | "tiff" | "tif" | "avif" | "ico" | "heic" | "heif" | "jxl" | "dicom" | "dcm" | "p7m" | "p7s" | "p7c" | "p7b" | "pkcs7" | "cms" | "cmsc" | "tsd" | "tst" | "tsq" | "tsr" | "asics" | "scs" | "asice" | "sce" | "ers" | "asc" | "sig" | "pgp" | "gpg" | "jws" | "md" | "txt" | "json" | "mjs" | "cjs" | "css" | "java" | "py" | "htm" | "jsx" | "ts" | "tsx" | "xml" | "log" | "vue" | "yaml" | "yml" | "ini" | "sh" | "bash" | "sql" | "go" | "rs" | "php" | "c" | "cpp" | "cc" | "h" | "hpp" | "cs" | "diff" | "patch" | "bundle" | "bdl" | "jsonc" | "json5" | "ipynb" | "toml" | "proto" | "hcl" | "tex" | "gv" | "http" | "react" | "swift" | "kt" | "mp4" | "webm" | "m3u8" | "mp3" | "mpeg" | "wav" | "ogg" | "oga" | "opus" | "m4a" | "aac" | "flac" | "weba" | "midi" | "mid" | "psb" | "pdd" | "psdt" | "psd" | "ait" | "ai" | "idml" | "icml" | "idms" | "inx" | "xfl" | "indd" | "indt" | "ps" | "eps" | "ase" | "aco" | "abr" | "csh" | "pat" | "grd" | "asl" | "ttf" | "otf" | "woff" | "woff2" | "sqlite" | "parquet" | "avro" | "webarchive" | "bin" | "hex" | "elf" | "exe" | "dll" | "class" | "macho")[];
|
|
864
883
|
export declare const DEFAULT_STABLE_SUPPORTED_EXTENSIONS: readonly ("markdown" | "webp" | "jpeg" | "png" | "pdf" | "xyz" | "wasm" | "chm" | "typst" | "js" | "html" | "svg" | "rb" | "docx" | "docm" | "dotx" | "dotm" | "doc" | "dot" | "ppt" | "pot" | "pptx" | "pptm" | "potx" | "potm" | "ppsx" | "ppsm" | "rtf" | "odt" | "odp" | "xlsx" | "xltx" | "xlsm" | "xlsb" | "xls" | "xlt" | "xla" | "xlam" | "xltm" | "csv" | "tsv" | "ods" | "fods" | "pages" | "numbers" | "key" | "wpd" | "wp" | "wp5" | "wp6" | "dbf" | "ofd" | "hwp" | "hwpx" | "typ" | "zip" | "zipx" | "7z" | "rar" | "tar" | "gz" | "gzip" | "tgz" | "bz2" | "bzip2" | "tbz" | "tbz2" | "xz" | "txz" | "lzma" | "zst" | "tzst" | "cab" | "ar" | "cpio" | "iso" | "xar" | "lha" | "lzh" | "jar" | "war" | "ear" | "apk" | "cbz" | "cbr" | "eml" | "msg" | "mbox" | "olb" | "dra" | "gds" | "oas" | "oasis" | "dxf" | "dwg" | "dwf" | "dwfx" | "xps" | "glb" | "gltf" | "obj" | "stl" | "ply" | "fbx" | "dae" | "3ds" | "3mf" | "amf" | "usd" | "usda" | "usdc" | "usdz" | "kmz" | "step" | "stp" | "iges" | "igs" | "ifc" | "3dm" | "brep" | "pcd" | "wrl" | "vrml" | "vtk" | "vtp" | "geojson" | "kml" | "gpx" | "shp" | "excalidraw" | "drawio" | "dio" | "mermaid" | "mmd" | "plantuml" | "puml" | "xmind" | "epub" | "fb2" | "umd" | "gif" | "jpg" | "bmp" | "tiff" | "tif" | "avif" | "ico" | "heic" | "heif" | "jxl" | "md" | "txt" | "json" | "mjs" | "cjs" | "css" | "java" | "py" | "htm" | "jsx" | "ts" | "tsx" | "xml" | "log" | "vue" | "yaml" | "yml" | "ini" | "sh" | "bash" | "sql" | "go" | "rs" | "php" | "c" | "cpp" | "cc" | "h" | "hpp" | "cs" | "diff" | "patch" | "bundle" | "bdl" | "jsonc" | "json5" | "ipynb" | "toml" | "proto" | "hcl" | "tex" | "gv" | "http" | "react" | "swift" | "kt" | "mp4" | "webm" | "m3u8" | "mp3" | "mpeg" | "wav" | "ogg" | "oga" | "opus" | "m4a" | "aac" | "flac" | "weba" | "midi" | "mid" | "psd" | "ai" | "eps" | "ase" | "aco" | "ttf" | "otf" | "woff" | "woff2" | "sqlite" | "parquet" | "avro" | "webarchive")[];
|
|
865
884
|
/** @deprecated Use DEFAULT_REGISTERED_EXTENSIONS when the experimental/stable distinction matters. */
|
|
866
|
-
export declare const DEFAULT_SUPPORTED_EXTENSIONS: readonly ("markdown" | "webp" | "jpeg" | "png" | "pdf" | "xyz" | "wasm" | "chm" | "typst" | "xd" | "fla" | "js" | "html" | "svg" | "rb" | "docx" | "docm" | "dotx" | "dotm" | "doc" | "dot" | "ppt" | "pot" | "pptx" | "pptm" | "potx" | "potm" | "ppsx" | "ppsm" | "rtf" | "odt" | "odp" | "xlsx" | "xltx" | "xlsm" | "xlsb" | "xls" | "xlt" | "xla" | "xlam" | "xltm" | "csv" | "tsv" | "ods" | "fods" | "pages" | "numbers" | "key" | "wpd" | "wp" | "wp5" | "wp6" | "dbf" | "ofd" | "hwp" | "hwpx" | "typ" | "zip" | "zipx" | "7z" | "rar" | "tar" | "gz" | "gzip" | "tgz" | "bz2" | "bzip2" | "tbz" | "tbz2" | "xz" | "txz" | "lzma" | "zst" | "tzst" | "cab" | "ar" | "cpio" | "iso" | "xar" | "lha" | "lzh" | "jar" | "war" | "ear" | "apk" | "cbz" | "cbr" | "eml" | "msg" | "mbox" | "olb" | "dra" | "gds" | "oas" | "oasis" | "dxf" | "dwg" | "dwf" | "dwfx" | "xps" | "glb" | "gltf" | "obj" | "stl" | "ply" | "fbx" | "dae" | "3ds" | "3mf" | "amf" | "usd" | "usda" | "usdc" | "usdz" | "kmz" | "step" | "stp" | "iges" | "igs" | "ifc" | "3dm" | "brep" | "pcd" | "wrl" | "vrml" | "vtk" | "vtp" | "geojson" | "kml" | "gpx" | "shp" | "excalidraw" | "drawio" | "dio" | "mermaid" | "mmd" | "plantuml" | "puml" | "xmind" | "epub" | "fb2" | "umd" | "gif" | "jpg" | "bmp" | "tiff" | "tif" | "avif" | "ico" | "heic" | "heif" | "jxl" | "dicom" | "dcm" | "p7m" | "p7s" | "p7c" | "p7b" | "pkcs7" | "cms" | "cmsc" | "tsd" | "tst" | "tsq" | "tsr" | "asics" | "scs" | "asice" | "sce" | "ers" | "asc" | "sig" | "pgp" | "gpg" | "jws" | "md" | "txt" | "json" | "mjs" | "cjs" | "css" | "java" | "py" | "htm" | "jsx" | "ts" | "tsx" | "xml" | "log" | "vue" | "yaml" | "yml" | "ini" | "sh" | "bash" | "sql" | "go" | "rs" | "php" | "c" | "cpp" | "cc" | "h" | "hpp" | "cs" | "diff" | "patch" | "bundle" | "bdl" | "jsonc" | "json5" | "ipynb" | "toml" | "proto" | "hcl" | "tex" | "gv" | "http" | "react" | "swift" | "kt" | "mp4" | "webm" | "m3u8" | "mp3" | "mpeg" | "wav" | "ogg" | "oga" | "opus" | "m4a" | "aac" | "flac" | "weba" | "midi" | "mid" | "psb" | "pdd" | "psdt" | "psd" | "ait" | "ai" | "idml" | "icml" | "idms" | "inx" | "xfl" | "indd" | "indt" | "ps" | "eps" | "ase" | "aco" | "abr" | "csh" | "pat" | "grd" | "asl" | "ttf" | "otf" | "woff" | "woff2" | "sqlite" | "parquet" | "avro" | "webarchive")[];
|
|
885
|
+
export declare const DEFAULT_SUPPORTED_EXTENSIONS: readonly ("markdown" | "webp" | "jpeg" | "png" | "pdf" | "xyz" | "wasm" | "chm" | "typst" | "xd" | "fla" | "js" | "html" | "svg" | "rb" | "docx" | "docm" | "dotx" | "dotm" | "doc" | "dot" | "ppt" | "pot" | "pptx" | "pptm" | "potx" | "potm" | "ppsx" | "ppsm" | "rtf" | "odt" | "odp" | "xlsx" | "xltx" | "xlsm" | "xlsb" | "xls" | "xlt" | "xla" | "xlam" | "xltm" | "csv" | "tsv" | "ods" | "fods" | "pages" | "numbers" | "key" | "wpd" | "wp" | "wp5" | "wp6" | "dbf" | "ofd" | "hwp" | "hwpx" | "typ" | "zip" | "zipx" | "7z" | "rar" | "tar" | "gz" | "gzip" | "tgz" | "bz2" | "bzip2" | "tbz" | "tbz2" | "xz" | "txz" | "lzma" | "zst" | "tzst" | "cab" | "ar" | "cpio" | "iso" | "xar" | "lha" | "lzh" | "jar" | "war" | "ear" | "apk" | "cbz" | "cbr" | "eml" | "msg" | "mbox" | "olb" | "dra" | "gds" | "oas" | "oasis" | "dxf" | "dwg" | "dwf" | "dwfx" | "xps" | "glb" | "gltf" | "obj" | "stl" | "ply" | "fbx" | "dae" | "3ds" | "3mf" | "amf" | "usd" | "usda" | "usdc" | "usdz" | "kmz" | "step" | "stp" | "iges" | "igs" | "ifc" | "3dm" | "brep" | "pcd" | "wrl" | "vrml" | "vtk" | "vtp" | "geojson" | "kml" | "gpx" | "shp" | "excalidraw" | "drawio" | "dio" | "mermaid" | "mmd" | "plantuml" | "puml" | "xmind" | "epub" | "fb2" | "umd" | "gif" | "jpg" | "bmp" | "tiff" | "tif" | "avif" | "ico" | "heic" | "heif" | "jxl" | "dicom" | "dcm" | "p7m" | "p7s" | "p7c" | "p7b" | "pkcs7" | "cms" | "cmsc" | "tsd" | "tst" | "tsq" | "tsr" | "asics" | "scs" | "asice" | "sce" | "ers" | "asc" | "sig" | "pgp" | "gpg" | "jws" | "md" | "txt" | "json" | "mjs" | "cjs" | "css" | "java" | "py" | "htm" | "jsx" | "ts" | "tsx" | "xml" | "log" | "vue" | "yaml" | "yml" | "ini" | "sh" | "bash" | "sql" | "go" | "rs" | "php" | "c" | "cpp" | "cc" | "h" | "hpp" | "cs" | "diff" | "patch" | "bundle" | "bdl" | "jsonc" | "json5" | "ipynb" | "toml" | "proto" | "hcl" | "tex" | "gv" | "http" | "react" | "swift" | "kt" | "mp4" | "webm" | "m3u8" | "mp3" | "mpeg" | "wav" | "ogg" | "oga" | "opus" | "m4a" | "aac" | "flac" | "weba" | "midi" | "mid" | "psb" | "pdd" | "psdt" | "psd" | "ait" | "ai" | "idml" | "icml" | "idms" | "inx" | "xfl" | "indd" | "indt" | "ps" | "eps" | "ase" | "aco" | "abr" | "csh" | "pat" | "grd" | "asl" | "ttf" | "otf" | "woff" | "woff2" | "sqlite" | "parquet" | "avro" | "webarchive" | "bin" | "hex" | "elf" | "exe" | "dll" | "class" | "macho")[];
|
|
@@ -1576,6 +1576,47 @@ export const DEFAULT_RENDERER_DEFINITIONS = [
|
|
|
1576
1576
|
"zoom": false,
|
|
1577
1577
|
"search": true
|
|
1578
1578
|
}
|
|
1579
|
+
},
|
|
1580
|
+
{
|
|
1581
|
+
"id": "binary-inspector",
|
|
1582
|
+
"label": "Binary Inspector",
|
|
1583
|
+
"category": "asset",
|
|
1584
|
+
"extensions": [
|
|
1585
|
+
"bin",
|
|
1586
|
+
"hex",
|
|
1587
|
+
"elf",
|
|
1588
|
+
"exe",
|
|
1589
|
+
"dll",
|
|
1590
|
+
"class",
|
|
1591
|
+
"macho"
|
|
1592
|
+
],
|
|
1593
|
+
"async": true,
|
|
1594
|
+
"supportLevel": "structured",
|
|
1595
|
+
"status": "experimental",
|
|
1596
|
+
"packageName": "@file-viewer/renderer-binary",
|
|
1597
|
+
"presets": [],
|
|
1598
|
+
"containerVersions": [
|
|
1599
|
+
"Raw bytes",
|
|
1600
|
+
"ELF",
|
|
1601
|
+
"PE/COFF",
|
|
1602
|
+
"Mach-O",
|
|
1603
|
+
"PNG",
|
|
1604
|
+
"ZIP",
|
|
1605
|
+
"WebAssembly",
|
|
1606
|
+
"Java class"
|
|
1607
|
+
],
|
|
1608
|
+
"knownLimits": [
|
|
1609
|
+
"The package is explicit opt-in and never claims application/octet-stream or extensions owned by dedicated renderers",
|
|
1610
|
+
"Only a reviewed built-in template catalog is parsed in a terminable module Worker; user-authored templates, dynamic imports, editing, and patching are out of scope",
|
|
1611
|
+
"Whole inputs, parse time, structure nodes, nesting, and decoded string bytes are capped before data reaches the DOM; large files are rejected instead of partially scanning arbitrary pages"
|
|
1612
|
+
],
|
|
1613
|
+
"capabilities": {
|
|
1614
|
+
"download": true,
|
|
1615
|
+
"print": false,
|
|
1616
|
+
"exportHtml": false,
|
|
1617
|
+
"zoom": false,
|
|
1618
|
+
"search": false
|
|
1619
|
+
}
|
|
1579
1620
|
}
|
|
1580
1621
|
];
|
|
1581
1622
|
export const DEFAULT_REGISTERED_EXTENSIONS = Object.freeze(Array.from(new Set(DEFAULT_RENDERER_DEFINITIONS.flatMap(definition => definition.extensions))).sort());
|
|
@@ -868,6 +868,25 @@ export declare const coreLiteRendererDefinitions: ({
|
|
|
868
868
|
readonly zoom: false;
|
|
869
869
|
readonly search: true;
|
|
870
870
|
};
|
|
871
|
+
} | {
|
|
872
|
+
readonly id: "binary-inspector";
|
|
873
|
+
readonly label: "Binary Inspector";
|
|
874
|
+
readonly category: "asset";
|
|
875
|
+
readonly extensions: readonly ["bin", "hex", "elf", "exe", "dll", "class", "macho"];
|
|
876
|
+
readonly async: true;
|
|
877
|
+
readonly supportLevel: "structured";
|
|
878
|
+
readonly status: "experimental";
|
|
879
|
+
readonly packageName: "@file-viewer/renderer-binary";
|
|
880
|
+
readonly presets: readonly [];
|
|
881
|
+
readonly containerVersions: readonly ["Raw bytes", "ELF", "PE/COFF", "Mach-O", "PNG", "ZIP", "WebAssembly", "Java class"];
|
|
882
|
+
readonly knownLimits: readonly ["The package is explicit opt-in and never claims application/octet-stream or extensions owned by dedicated renderers", "Only a reviewed built-in template catalog is parsed in a terminable module Worker; user-authored templates, dynamic imports, editing, and patching are out of scope", "Whole inputs, parse time, structure nodes, nesting, and decoded string bytes are capped before data reaches the DOM; large files are rejected instead of partially scanning arbitrary pages"];
|
|
883
|
+
readonly capabilities: {
|
|
884
|
+
readonly download: true;
|
|
885
|
+
readonly print: false;
|
|
886
|
+
readonly exportHtml: false;
|
|
887
|
+
readonly zoom: false;
|
|
888
|
+
readonly search: false;
|
|
889
|
+
};
|
|
871
890
|
})[];
|
|
872
891
|
export interface CreateFileViewerCoreRendererRegistryOptions {
|
|
873
892
|
builtinRenderers?: FileViewerBuiltinRendererPreset;
|
|
@@ -20,7 +20,7 @@ import { createFileViewerRequestScope } from '../source/loading.js';
|
|
|
20
20
|
import { normalizeSource } from '../source/index.js';
|
|
21
21
|
import { buildFileViewerWatermarkInlineStyle } from '../features/watermark.js';
|
|
22
22
|
import { createFileViewerSnapshotDownload } from '../output/snapshotDownload.js';
|
|
23
|
-
import { createFileViewerUnsupportedState } from './state.js';
|
|
23
|
+
import { createFileViewerErrorState, createFileViewerUnsupportedState } from './state.js';
|
|
24
24
|
const emitLifecycle = async (options, onEvent, phase, source, version, startedAt, reason) => {
|
|
25
25
|
const now = Date.now();
|
|
26
26
|
const context = buildFileViewerLifecycleContextFromNormalizedSource({
|
|
@@ -78,6 +78,9 @@ const createFileViewerLoadSignal = (controller, signals) => {
|
|
|
78
78
|
}
|
|
79
79
|
return controller.signal;
|
|
80
80
|
};
|
|
81
|
+
const isAbortError = (error) => {
|
|
82
|
+
return Boolean(error && typeof error === 'object' && error.name === 'AbortError');
|
|
83
|
+
};
|
|
81
84
|
const renderMissingRendererState = (container, type, options) => {
|
|
82
85
|
const documentRef = container.ownerDocument;
|
|
83
86
|
const state = createFileViewerUnsupportedState(type, undefined, options);
|
|
@@ -106,6 +109,43 @@ const renderMissingRendererState = (container, type, options) => {
|
|
|
106
109
|
wrapper.append(content);
|
|
107
110
|
container.replaceChildren(wrapper);
|
|
108
111
|
};
|
|
112
|
+
const renderFileViewerErrorState = (container, type, error, options) => {
|
|
113
|
+
const documentRef = container.ownerDocument;
|
|
114
|
+
const state = createFileViewerErrorState(type, error, undefined, options);
|
|
115
|
+
const wrapper = documentRef.createElement('div');
|
|
116
|
+
wrapper.className = 'file-viewer-render-error';
|
|
117
|
+
wrapper.setAttribute('role', 'alert');
|
|
118
|
+
wrapper.setAttribute('aria-live', 'assertive');
|
|
119
|
+
wrapper.style.cssText = [
|
|
120
|
+
'display:flex',
|
|
121
|
+
'min-height:260px',
|
|
122
|
+
'height:100%',
|
|
123
|
+
'align-items:center',
|
|
124
|
+
'justify-content:center',
|
|
125
|
+
'padding:32px',
|
|
126
|
+
'box-sizing:border-box',
|
|
127
|
+
'color:var(--file-viewer-text,#172033)',
|
|
128
|
+
'font:14px/1.6 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif',
|
|
129
|
+
].join(';');
|
|
130
|
+
const content = documentRef.createElement('div');
|
|
131
|
+
content.style.cssText = [
|
|
132
|
+
'width:min(680px,100%)',
|
|
133
|
+
'padding:24px',
|
|
134
|
+
'border:1px solid var(--file-viewer-border,rgba(20,35,53,.12))',
|
|
135
|
+
'border-radius:14px',
|
|
136
|
+
'background:var(--file-viewer-render-surface-background,#fff)',
|
|
137
|
+
'box-shadow:0 16px 42px rgba(25,42,54,.08)',
|
|
138
|
+
].join(';');
|
|
139
|
+
const title = documentRef.createElement('strong');
|
|
140
|
+
title.textContent = state.title;
|
|
141
|
+
title.style.cssText = 'display:block;margin-bottom:10px;font-size:18px;';
|
|
142
|
+
const message = documentRef.createElement('p');
|
|
143
|
+
message.textContent = state.message;
|
|
144
|
+
message.style.cssText = 'margin:0;white-space:pre-wrap;overflow-wrap:anywhere;';
|
|
145
|
+
content.append(title, message);
|
|
146
|
+
wrapper.append(content);
|
|
147
|
+
container.replaceChildren(wrapper);
|
|
148
|
+
};
|
|
109
149
|
export const createViewer = (container, createOptions = {}) => {
|
|
110
150
|
let options = createOptions.options || {};
|
|
111
151
|
let registry = createBaseRendererRegistry(createOptions, options);
|
|
@@ -566,11 +606,18 @@ export const createViewer = (container, createOptions = {}) => {
|
|
|
566
606
|
});
|
|
567
607
|
}
|
|
568
608
|
catch (error) {
|
|
569
|
-
if (!requestScope.isCurrentRequest(version)) {
|
|
609
|
+
if (!requestScope.isCurrentRequest(version) || (loadSignal === null || loadSignal === void 0 ? void 0 : loadSignal.aborted) || isAbortError(error)) {
|
|
570
610
|
removeRenderTarget(targetHost);
|
|
571
611
|
return null;
|
|
572
612
|
}
|
|
573
|
-
|
|
613
|
+
applyFileViewerRenderSurfaceState(renderSurfaceState, {
|
|
614
|
+
session: null,
|
|
615
|
+
exportAdapter: null,
|
|
616
|
+
thumbnailAdapter: null,
|
|
617
|
+
});
|
|
618
|
+
removeWatermarkOverlay();
|
|
619
|
+
renderFileViewerErrorState(target, normalized.extension, error, options);
|
|
620
|
+
emitZoomAndOperationAvailabilityChange();
|
|
574
621
|
throw error;
|
|
575
622
|
}
|
|
576
623
|
if (!requestScope.isCurrentRequest(version)) {
|
package/dist/viewer/state.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { type FileViewerI18nInput } from '../i18n/messages';
|
|
2
2
|
import type { FileViewerRendererCategory, FileViewerStateDescriptor, FileViewerStateTheme } from '../contracts/types';
|
|
3
3
|
export type FileViewerErrorMessageFormatter = (prefix: string, error: unknown, i18n?: FileViewerI18nInput) => string;
|
|
4
|
+
/**
|
|
5
|
+
* Renderers can attach a localized, user-safe explanation without replacing
|
|
6
|
+
* the original error object that hosts use for diagnostics and recovery.
|
|
7
|
+
*/
|
|
8
|
+
export declare const FILE_VIEWER_ERROR_MESSAGE: "fileViewerErrorMessage";
|
|
9
|
+
export interface FileViewerErrorMessageCarrier {
|
|
10
|
+
[FILE_VIEWER_ERROR_MESSAGE]?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const attachFileViewerErrorMessage: (error: unknown, message: string) => unknown;
|
|
4
13
|
export declare const FILE_VIEWER_PREVIEW_MESSAGES: Readonly<{
|
|
5
14
|
downloading: "正在下载文件资源...";
|
|
6
15
|
streamingPdf: "正在建立 PDF 流式预览...";
|
package/dist/viewer/state.js
CHANGED
|
@@ -1,6 +1,39 @@
|
|
|
1
1
|
import { normalizeFileExtension } from '../source/index.js';
|
|
2
2
|
import { DEFAULT_RENDERER_DEFINITIONS } from '../registry/formats.js';
|
|
3
3
|
import { resolveFileViewerLocale, translateFileViewerMessage, } from '../i18n/messages.js';
|
|
4
|
+
/**
|
|
5
|
+
* Renderers can attach a localized, user-safe explanation without replacing
|
|
6
|
+
* the original error object that hosts use for diagnostics and recovery.
|
|
7
|
+
*/
|
|
8
|
+
export const FILE_VIEWER_ERROR_MESSAGE = 'fileViewerErrorMessage';
|
|
9
|
+
export const attachFileViewerErrorMessage = (error, message) => {
|
|
10
|
+
const normalizedMessage = message.trim();
|
|
11
|
+
if (!normalizedMessage) {
|
|
12
|
+
return error;
|
|
13
|
+
}
|
|
14
|
+
if (error && typeof error === 'object') {
|
|
15
|
+
try {
|
|
16
|
+
Object.defineProperty(error, FILE_VIEWER_ERROR_MESSAGE, {
|
|
17
|
+
configurable: true,
|
|
18
|
+
value: normalizedMessage,
|
|
19
|
+
});
|
|
20
|
+
return error;
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
// Frozen cross-realm errors retain their original value as the cause below.
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const presented = new Error(normalizedMessage);
|
|
27
|
+
Object.defineProperty(presented, FILE_VIEWER_ERROR_MESSAGE, {
|
|
28
|
+
configurable: true,
|
|
29
|
+
value: normalizedMessage,
|
|
30
|
+
});
|
|
31
|
+
Object.defineProperty(presented, 'cause', {
|
|
32
|
+
configurable: true,
|
|
33
|
+
value: error,
|
|
34
|
+
});
|
|
35
|
+
return presented;
|
|
36
|
+
};
|
|
4
37
|
export const FILE_VIEWER_PREVIEW_MESSAGES = Object.freeze({
|
|
5
38
|
downloading: '正在下载文件资源...',
|
|
6
39
|
streamingPdf: '正在建立 PDF 流式预览...',
|
|
@@ -247,6 +280,12 @@ const readFileViewerErrorProperty = (error, key) => {
|
|
|
247
280
|
}
|
|
248
281
|
};
|
|
249
282
|
export const normalizeFileViewerErrorMessage = (error, i18n) => {
|
|
283
|
+
if (error && typeof error === 'object') {
|
|
284
|
+
const presentedMessage = readFileViewerErrorProperty(error, FILE_VIEWER_ERROR_MESSAGE);
|
|
285
|
+
if (typeof presentedMessage === 'string' && presentedMessage.trim()) {
|
|
286
|
+
return resolveKnownFileViewerErrorMessage(presentedMessage, i18n);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
250
289
|
if (error instanceof Error) {
|
|
251
290
|
return resolveKnownFileViewerErrorMessage(error.message, i18n);
|
|
252
291
|
}
|
package/package.json
CHANGED