@open-file-viewer/core 0.1.14 → 0.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.
- package/README.md +17 -0
- package/dist/index.cjs +530 -194
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -2
- package/dist/index.d.ts +24 -2
- package/dist/index.js +530 -194
- package/dist/index.js.map +1 -1
- package/dist/style.css +278 -6
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -4,6 +4,7 @@ type PreviewSource = File | Blob | string | ArrayBuffer;
|
|
|
4
4
|
type PreviewFit = "contain" | "cover" | "width" | "height" | "actual" | "scale-down";
|
|
5
5
|
type PreviewFallback = "inline" | "download" | "custom";
|
|
6
6
|
type PreviewTheme = "light" | "dark" | "auto";
|
|
7
|
+
type PreviewLocale = "zh-CN" | "en-US";
|
|
7
8
|
type PreviewToolbarBuiltInAction = "previous" | "next" | "queue" | "zoom-out" | "zoom-in" | "zoom-reset" | "rotate-right" | "download" | "fullscreen" | "print" | "search";
|
|
8
9
|
type PreviewToolbarActionId = PreviewToolbarBuiltInAction | (string & {});
|
|
9
10
|
interface PreviewFile {
|
|
@@ -79,9 +80,12 @@ interface PreviewOptions {
|
|
|
79
80
|
mimeType?: string;
|
|
80
81
|
width?: number | string;
|
|
81
82
|
height?: number | string;
|
|
83
|
+
zoom?: number;
|
|
82
84
|
fit?: PreviewFit;
|
|
83
85
|
plugins?: PreviewPlugin[];
|
|
84
86
|
fallback?: PreviewFallback;
|
|
87
|
+
locale?: PreviewLocale;
|
|
88
|
+
messages?: Partial<PreviewMessages>;
|
|
85
89
|
renderFallback?: (ctx: PreviewContext) => Promise<PreviewInstance> | PreviewInstance;
|
|
86
90
|
toolbar?: boolean | PreviewToolbarOptions;
|
|
87
91
|
theme?: PreviewTheme;
|
|
@@ -90,12 +94,30 @@ interface PreviewOptions {
|
|
|
90
94
|
onError?: (error: Error, file?: PreviewFile) => void;
|
|
91
95
|
onUnsupported?: (file: PreviewFile) => void;
|
|
92
96
|
}
|
|
97
|
+
interface PreviewMessages {
|
|
98
|
+
loading: string;
|
|
99
|
+
unsupportedTitle: string;
|
|
100
|
+
downloadTitle: string;
|
|
101
|
+
downloadFile: string;
|
|
102
|
+
file: string;
|
|
103
|
+
unnamedFile: string;
|
|
104
|
+
format: string;
|
|
105
|
+
unknown: string;
|
|
106
|
+
mime: string;
|
|
107
|
+
undeclared: string;
|
|
108
|
+
size: string;
|
|
109
|
+
source: string;
|
|
110
|
+
remoteUrl: string;
|
|
111
|
+
localFile: string;
|
|
112
|
+
}
|
|
93
113
|
interface PreviewContext {
|
|
94
114
|
host: HTMLElement;
|
|
95
115
|
viewport: HTMLElement;
|
|
96
116
|
file: PreviewFile;
|
|
97
117
|
size: PreviewSize;
|
|
98
|
-
options: Required<Pick<PreviewOptions, "fit" | "fallback">> &
|
|
118
|
+
options: Omit<PreviewOptions, "messages"> & Required<Pick<PreviewOptions, "fit" | "fallback" | "zoom">> & {
|
|
119
|
+
messages: PreviewMessages;
|
|
120
|
+
};
|
|
99
121
|
toolbar?: PreviewToolbarRenderContext;
|
|
100
122
|
setLoading: (loading: boolean) => void;
|
|
101
123
|
setError: (error: Error | string) => void;
|
|
@@ -230,4 +252,4 @@ declare function assetPlugin(): PreviewPlugin;
|
|
|
230
252
|
|
|
231
253
|
declare function fallbackPlugin(): PreviewPlugin;
|
|
232
254
|
|
|
233
|
-
export { type CadBinaryPreviewContext, type CadPluginOptions, type FileViewer, type LibreDwgPreviewOptions, type OfficeConversionContext, type OfficeConversionResult, type OfficePluginOptions, type PreviewCommand, type PreviewContext, type PreviewFallback, type PreviewFile, type PreviewFit, type PreviewInstance, type PreviewItem, type PreviewOptions, type PreviewPlugin, type PreviewSize, type PreviewSource, type PreviewTheme, type PreviewToolbarActionId, type PreviewToolbarBuiltInAction, type PreviewToolbarCustomAction, type PreviewToolbarOptions, type PreviewToolbarRenderContext, archivePlugin, assetPlugin, audioPlugin, cadPlugin, createViewer, drawingPlugin, emailPlugin, epubPlugin, fallbackPlugin, gisPlugin, imagePlugin, model3dPlugin, ofdPlugin, officePlugin, pdfPlugin, textPlugin, videoPlugin, xpsPlugin };
|
|
255
|
+
export { type CadBinaryPreviewContext, type CadPluginOptions, type FileViewer, type LibreDwgPreviewOptions, type OfficeConversionContext, type OfficeConversionResult, type OfficePluginOptions, type PreviewCommand, type PreviewContext, type PreviewFallback, type PreviewFile, type PreviewFit, type PreviewInstance, type PreviewItem, type PreviewLocale, type PreviewMessages, type PreviewOptions, type PreviewPlugin, type PreviewSize, type PreviewSource, type PreviewTheme, type PreviewToolbarActionId, type PreviewToolbarBuiltInAction, type PreviewToolbarCustomAction, type PreviewToolbarOptions, type PreviewToolbarRenderContext, archivePlugin, assetPlugin, audioPlugin, cadPlugin, createViewer, drawingPlugin, emailPlugin, epubPlugin, fallbackPlugin, gisPlugin, imagePlugin, model3dPlugin, ofdPlugin, officePlugin, pdfPlugin, textPlugin, videoPlugin, xpsPlugin };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ type PreviewSource = File | Blob | string | ArrayBuffer;
|
|
|
4
4
|
type PreviewFit = "contain" | "cover" | "width" | "height" | "actual" | "scale-down";
|
|
5
5
|
type PreviewFallback = "inline" | "download" | "custom";
|
|
6
6
|
type PreviewTheme = "light" | "dark" | "auto";
|
|
7
|
+
type PreviewLocale = "zh-CN" | "en-US";
|
|
7
8
|
type PreviewToolbarBuiltInAction = "previous" | "next" | "queue" | "zoom-out" | "zoom-in" | "zoom-reset" | "rotate-right" | "download" | "fullscreen" | "print" | "search";
|
|
8
9
|
type PreviewToolbarActionId = PreviewToolbarBuiltInAction | (string & {});
|
|
9
10
|
interface PreviewFile {
|
|
@@ -79,9 +80,12 @@ interface PreviewOptions {
|
|
|
79
80
|
mimeType?: string;
|
|
80
81
|
width?: number | string;
|
|
81
82
|
height?: number | string;
|
|
83
|
+
zoom?: number;
|
|
82
84
|
fit?: PreviewFit;
|
|
83
85
|
plugins?: PreviewPlugin[];
|
|
84
86
|
fallback?: PreviewFallback;
|
|
87
|
+
locale?: PreviewLocale;
|
|
88
|
+
messages?: Partial<PreviewMessages>;
|
|
85
89
|
renderFallback?: (ctx: PreviewContext) => Promise<PreviewInstance> | PreviewInstance;
|
|
86
90
|
toolbar?: boolean | PreviewToolbarOptions;
|
|
87
91
|
theme?: PreviewTheme;
|
|
@@ -90,12 +94,30 @@ interface PreviewOptions {
|
|
|
90
94
|
onError?: (error: Error, file?: PreviewFile) => void;
|
|
91
95
|
onUnsupported?: (file: PreviewFile) => void;
|
|
92
96
|
}
|
|
97
|
+
interface PreviewMessages {
|
|
98
|
+
loading: string;
|
|
99
|
+
unsupportedTitle: string;
|
|
100
|
+
downloadTitle: string;
|
|
101
|
+
downloadFile: string;
|
|
102
|
+
file: string;
|
|
103
|
+
unnamedFile: string;
|
|
104
|
+
format: string;
|
|
105
|
+
unknown: string;
|
|
106
|
+
mime: string;
|
|
107
|
+
undeclared: string;
|
|
108
|
+
size: string;
|
|
109
|
+
source: string;
|
|
110
|
+
remoteUrl: string;
|
|
111
|
+
localFile: string;
|
|
112
|
+
}
|
|
93
113
|
interface PreviewContext {
|
|
94
114
|
host: HTMLElement;
|
|
95
115
|
viewport: HTMLElement;
|
|
96
116
|
file: PreviewFile;
|
|
97
117
|
size: PreviewSize;
|
|
98
|
-
options: Required<Pick<PreviewOptions, "fit" | "fallback">> &
|
|
118
|
+
options: Omit<PreviewOptions, "messages"> & Required<Pick<PreviewOptions, "fit" | "fallback" | "zoom">> & {
|
|
119
|
+
messages: PreviewMessages;
|
|
120
|
+
};
|
|
99
121
|
toolbar?: PreviewToolbarRenderContext;
|
|
100
122
|
setLoading: (loading: boolean) => void;
|
|
101
123
|
setError: (error: Error | string) => void;
|
|
@@ -230,4 +252,4 @@ declare function assetPlugin(): PreviewPlugin;
|
|
|
230
252
|
|
|
231
253
|
declare function fallbackPlugin(): PreviewPlugin;
|
|
232
254
|
|
|
233
|
-
export { type CadBinaryPreviewContext, type CadPluginOptions, type FileViewer, type LibreDwgPreviewOptions, type OfficeConversionContext, type OfficeConversionResult, type OfficePluginOptions, type PreviewCommand, type PreviewContext, type PreviewFallback, type PreviewFile, type PreviewFit, type PreviewInstance, type PreviewItem, type PreviewOptions, type PreviewPlugin, type PreviewSize, type PreviewSource, type PreviewTheme, type PreviewToolbarActionId, type PreviewToolbarBuiltInAction, type PreviewToolbarCustomAction, type PreviewToolbarOptions, type PreviewToolbarRenderContext, archivePlugin, assetPlugin, audioPlugin, cadPlugin, createViewer, drawingPlugin, emailPlugin, epubPlugin, fallbackPlugin, gisPlugin, imagePlugin, model3dPlugin, ofdPlugin, officePlugin, pdfPlugin, textPlugin, videoPlugin, xpsPlugin };
|
|
255
|
+
export { type CadBinaryPreviewContext, type CadPluginOptions, type FileViewer, type LibreDwgPreviewOptions, type OfficeConversionContext, type OfficeConversionResult, type OfficePluginOptions, type PreviewCommand, type PreviewContext, type PreviewFallback, type PreviewFile, type PreviewFit, type PreviewInstance, type PreviewItem, type PreviewLocale, type PreviewMessages, type PreviewOptions, type PreviewPlugin, type PreviewSize, type PreviewSource, type PreviewTheme, type PreviewToolbarActionId, type PreviewToolbarBuiltInAction, type PreviewToolbarCustomAction, type PreviewToolbarOptions, type PreviewToolbarRenderContext, archivePlugin, assetPlugin, audioPlugin, cadPlugin, createViewer, drawingPlugin, emailPlugin, epubPlugin, fallbackPlugin, gisPlugin, imagePlugin, model3dPlugin, ofdPlugin, officePlugin, pdfPlugin, textPlugin, videoPlugin, xpsPlugin };
|