@eternalheart/vue-file-preview 1.6.13 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/README.zh-CN.md +4 -0
- package/lib/FilePreviewContent.vue.d.ts +25 -6
- package/lib/FilePreviewEmbed.vue.d.ts +19 -6
- package/lib/FilePreviewModal.vue.d.ts +19 -6
- package/lib/chunks/{EmptyState.vue_vue_type_script_setup_true_lang-C7qk6wj0.mjs → EmptyState.vue_vue_type_script_setup_true_lang-DSQp7H-K.mjs} +1 -1
- package/lib/chunks/{avifLoader-CAUzjn-d-C0KRpetN.mjs → avifLoader-CAUzjn-d-Cf00sjt2.mjs} +1 -1
- package/lib/chunks/{heicLoader-D_9PukkA-Czof_5FJ.mjs → heicLoader-D_9PukkA-cn1P7b2x.mjs} +1 -1
- package/lib/chunks/{index-BASg1cr4.mjs → index-0VXtKKev.mjs} +1018 -1018
- package/lib/chunks/index-0fXL30y0.mjs +333 -0
- package/lib/chunks/{index-C9mAajbD.mjs → index-B1AwVHWI.mjs} +191 -191
- package/lib/chunks/{index-BvBqDq3O.mjs → index-B77rFiau.mjs} +2023 -2023
- package/lib/chunks/index-BB10as16.mjs +108 -0
- package/lib/chunks/index-BBIn-k4u.mjs +359 -0
- package/lib/chunks/index-BSzaI9ea.mjs +122 -0
- package/lib/chunks/index-BZvy39tn.mjs +117 -0
- package/lib/chunks/index-BlJEM2Lb.mjs +383 -0
- package/lib/chunks/{index-CxKZKUJj.mjs → index-CZlnxQFA.mjs} +1385 -1385
- package/lib/chunks/index-ClhTPqDI.mjs +137 -0
- package/lib/chunks/{index-8Vpbg2kS.mjs → index-D690gnNu.mjs} +118 -117
- package/lib/chunks/index-D7WykPYL.mjs +51 -0
- package/lib/chunks/{index-DZZN3kYi.mjs → index-DBzyeU0G.mjs} +1609 -1375
- package/lib/chunks/{index-Dkro_8Fy.mjs → index-DKFX5ToE.mjs} +33 -33
- package/lib/chunks/index-DRmKaFXK.mjs +157 -0
- package/lib/chunks/index-DXf3wXT5.mjs +155 -0
- package/lib/chunks/{index-BuqPb5mP.mjs → index-Dp7QQjNH.mjs} +114 -114
- package/lib/chunks/index-FzI__DHC.mjs +104 -0
- package/lib/chunks/index-PWjCziZG.mjs +90 -0
- package/lib/chunks/index-bT6XWKO_.mjs +52 -0
- package/lib/chunks/{index-DN4Ui0Gh.mjs → index-tX9VR6Vo.mjs} +122 -122
- package/lib/chunks/{jp2Loader-Dig19xyo-CKUaGhPl.mjs → jp2Loader-Dig19xyo-D-OEDL3n.mjs} +1 -1
- package/lib/chunks/{psdLoader-C0tKUXXl-CYWoQis5.mjs → psdLoader-C0tKUXXl-CVN06LUc.mjs} +1 -1
- package/lib/chunks/{rawLoader-C-tPeFAB-C35zC8nZ.mjs → rawLoader-C-tPeFAB-DBqcJPFK.mjs} +5 -5
- package/lib/chunks/{tiffLoader-BlhByX8w-BOxg_Du5.mjs → tiffLoader-BlhByX8w-8-0icdyL.mjs} +1 -1
- package/lib/chunks/{useShikiHighlight-BPmcxA-h.mjs → useShikiHighlight-a_GUszuU.mjs} +1 -1
- package/lib/composables/useAudioPlayer.d.ts +1 -1
- package/lib/composables/usePreviewEvents.d.ts +27 -0
- package/lib/composables/useRequest.d.ts +16 -4
- package/lib/composables/useThemeMode.d.ts +1 -1
- package/lib/composables/useTranslator.d.ts +2 -2
- package/lib/core/events.d.ts +69 -0
- package/lib/core/i18n/index.d.ts +29 -0
- package/lib/core/i18n/messages/en-US.d.ts +5 -0
- package/lib/core/i18n/messages/index.d.ts +9 -0
- package/lib/core/i18n/messages/zh-CN.d.ts +5 -0
- package/lib/core/i18n/types.d.ts +23 -0
- package/lib/core/index.d.ts +34 -0
- package/lib/core/loaders/avifLoader.d.ts +22 -0
- package/lib/core/loaders/heicLoader.d.ts +21 -0
- package/lib/core/loaders/jp2Loader.d.ts +16 -0
- package/lib/core/loaders/jp2Worker.d.ts +1 -0
- package/lib/core/loaders/psdLoader.d.ts +14 -0
- package/lib/core/loaders/rawLoader.d.ts +14 -0
- package/lib/core/loaders/registry.d.ts +32 -0
- package/lib/core/loaders/tiffLoader.d.ts +28 -0
- package/lib/core/loaders/types.d.ts +56 -0
- package/lib/core/types.d.ts +89 -0
- package/lib/core/utils/csvParser.d.ts +31 -0
- package/lib/core/utils/emptyState.d.ts +28 -0
- package/lib/core/utils/excelDataConverter.d.ts +61 -0
- package/lib/core/utils/fileNormalizer.d.ts +21 -0
- package/lib/core/utils/fileType.d.ts +21 -0
- package/lib/core/utils/legacy-office/doc.d.ts +25 -0
- package/lib/core/utils/legacy-office/index.d.ts +8 -0
- package/lib/core/utils/legacy-office/ole.d.ts +8 -0
- package/lib/core/utils/legacy-office/ppt.d.ts +79 -0
- package/lib/core/utils/legacy-office/xls.d.ts +28 -0
- package/lib/core/utils/mimeTypes.d.ts +29 -0
- package/lib/core/utils/ooxml/docx.d.ts +17 -0
- package/lib/core/utils/ooxml/index.d.ts +4 -0
- package/lib/core/utils/ooxml/pptx.d.ts +7 -0
- package/lib/core/utils/ooxml/xml.d.ts +15 -0
- package/lib/core/utils/ooxml/zip.d.ts +3 -0
- package/lib/core/utils/pdfWorker.d.ts +61 -0
- package/lib/core/utils/previewMode.d.ts +7 -0
- package/lib/core/utils/request.d.ts +49 -0
- package/lib/core/utils/subtitleParser.d.ts +44 -0
- package/lib/core/utils/textDecoder.d.ts +30 -0
- package/lib/core/utils/uint8ArrayPolyfill.d.ts +18 -0
- package/lib/core/utils/zipReader.d.ts +51 -0
- package/lib/core/workers/imageDecoder.worker.d.ts +31 -0
- package/lib/core/workers/workerClient.d.ts +14 -0
- package/lib/i18n/localeKey.d.ts +1 -1
- package/lib/index.cjs +60 -60
- package/lib/index.css +1 -1
- package/lib/index.d.ts +11 -9
- package/lib/index.mjs +15 -12
- package/lib/renderers/Audio/index.vue.d.ts +1 -1
- package/lib/renderers/Cad/index.vue.d.ts +1 -1
- package/lib/renderers/Cad/toolbar.d.ts +2 -2
- package/lib/renderers/Csv/index.vue.d.ts +1 -1
- package/lib/renderers/Doc/index.vue.d.ts +1 -1
- package/lib/renderers/Docx/index.vue.d.ts +1 -1
- package/lib/renderers/Epub/index.vue.d.ts +1 -1
- package/lib/renderers/Font/index.vue.d.ts +1 -1
- package/lib/renderers/Image/index.vue.d.ts +2 -2
- package/lib/renderers/Json/index.vue.d.ts +2 -2
- package/lib/renderers/Markdown/index.vue.d.ts +1 -1
- package/lib/renderers/Mobi/index.vue.d.ts +1 -1
- package/lib/renderers/Msg/index.vue.d.ts +1 -1
- package/lib/renderers/Pdf/index.vue.d.ts +1 -1
- package/lib/renderers/Ppt/index.vue.d.ts +1 -1
- package/lib/renderers/Pptx/index.vue.d.ts +2 -2
- package/lib/renderers/Subtitle/index.vue.d.ts +1 -1
- package/lib/renderers/Text/index.vue.d.ts +2 -2
- package/lib/renderers/Unsupported/index.vue.d.ts +1 -1
- package/lib/renderers/Video/index.vue.d.ts +1 -1
- package/lib/renderers/Xlsx/index.vue.d.ts +2 -2
- package/lib/renderers/Xml/index.vue.d.ts +1 -1
- package/lib/renderers/Zip/TreeItem.vue.d.ts +1 -1
- package/lib/renderers/Zip/index.vue.d.ts +1 -1
- package/lib/renderers/base.types.d.ts +1 -1
- package/lib/renderers/registry.d.ts +1 -1
- package/lib/types.d.ts +3 -3
- package/package.json +2 -2
- package/lib/chunks/index--612Smof.mjs +0 -383
- package/lib/chunks/index-B21EAyWz.mjs +0 -137
- package/lib/chunks/index-BB0i4QqI.mjs +0 -117
- package/lib/chunks/index-BVdrGK3Q.mjs +0 -356
- package/lib/chunks/index-BlrFFeqc.mjs +0 -330
- package/lib/chunks/index-Bp9CuvMZ.mjs +0 -157
- package/lib/chunks/index-Bxpf9v5j.mjs +0 -104
- package/lib/chunks/index-CDg6vIbT.mjs +0 -51
- package/lib/chunks/index-CWE-hKSs.mjs +0 -90
- package/lib/chunks/index-CY3xzGgt.mjs +0 -108
- package/lib/chunks/index-D30L8tm9.mjs +0 -155
- package/lib/chunks/index-VdzIFJJW.mjs +0 -118
- package/lib/chunks/index-aoXgVLBb.mjs +0 -52
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 图片解码 Web Worker
|
|
3
|
+
*
|
|
4
|
+
* 用于在主线程外执行耗时的 WASM 解码(HEIC/RAW/PSD),避免阻塞 UI。
|
|
5
|
+
*
|
|
6
|
+
* 消息协议:
|
|
7
|
+
* - 接收:{ id: string, mimeType: string, buffer: ArrayBuffer, options?: DecodeOptions }
|
|
8
|
+
* - 返回成功:{ id: string, success: true, data: ArrayBuffer, mimeType: string }
|
|
9
|
+
* - 返回失败:{ id: string, success: false, error: PreviewErrorDetail }
|
|
10
|
+
*/
|
|
11
|
+
import { type PreviewErrorDetail } from '../i18n/index.js';
|
|
12
|
+
import type { DecodeOptions } from '../loaders/types.js';
|
|
13
|
+
interface DecodeRequest {
|
|
14
|
+
id: string;
|
|
15
|
+
mimeType: string;
|
|
16
|
+
buffer: ArrayBuffer;
|
|
17
|
+
options?: DecodeOptions;
|
|
18
|
+
}
|
|
19
|
+
interface DecodeSuccessResponse {
|
|
20
|
+
id: string;
|
|
21
|
+
success: true;
|
|
22
|
+
data: ArrayBuffer;
|
|
23
|
+
mimeType: string;
|
|
24
|
+
}
|
|
25
|
+
interface DecodeErrorResponse {
|
|
26
|
+
id: string;
|
|
27
|
+
success: false;
|
|
28
|
+
error: PreviewErrorDetail;
|
|
29
|
+
}
|
|
30
|
+
type DecodeResponse = DecodeSuccessResponse | DecodeErrorResponse;
|
|
31
|
+
export type { DecodeRequest, DecodeResponse, DecodeSuccessResponse, DecodeErrorResponse };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DecodeOptions } from '../loaders/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* 检测某 MIME 类型是否适合在 Worker 中解码
|
|
4
|
+
*/
|
|
5
|
+
export declare function shouldUseWorker(mimeType: string): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* 在 Web Worker 中解码图片
|
|
8
|
+
*
|
|
9
|
+
* @param mimeType MIME 类型
|
|
10
|
+
* @param buffer 原始文件 ArrayBuffer
|
|
11
|
+
* @param options 解码选项
|
|
12
|
+
* @returns 解码后的 Blob
|
|
13
|
+
*/
|
|
14
|
+
export declare function decodeInWorker(mimeType: string, buffer: ArrayBuffer, options?: DecodeOptions): Promise<Blob>;
|
package/lib/i18n/localeKey.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { InjectionKey, Ref, ComputedRef } from 'vue';
|
|
2
|
-
import type { Locale, Translator } from '
|
|
2
|
+
import type { Locale, Translator } from '../core/index.js';
|
|
3
3
|
export interface LocaleInjection {
|
|
4
4
|
locale: Ref<Locale>;
|
|
5
5
|
t: ComputedRef<Translator>;
|