basic-file-preview 1.0.0

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.
Files changed (32) hide show
  1. package/README.md +74 -0
  2. package/dist/index.cjs.js +2 -0
  3. package/dist/index.es.js +6 -0
  4. package/dist/lib/DocxPreview.js +1 -0
  5. package/dist/lib/ExcelPreview.js +1 -0
  6. package/dist/lib/ImagePreview.js +1 -0
  7. package/dist/lib/JsonPreview.js +1 -0
  8. package/dist/lib/MarkdownPreview.js +1 -0
  9. package/dist/lib/PdfPreview.js +1 -0
  10. package/dist/lib/PptPreview.js +1 -0
  11. package/dist/lib/TxtPreview.js +2 -0
  12. package/dist/lib/_plugin-vue_export-helper.js +1 -0
  13. package/dist/lib/index.js +8 -0
  14. package/dist/pdf/viewer.properties +282 -0
  15. package/dist/types/auto-imports.d.ts +75 -0
  16. package/dist/types/components/FilePreview/core/DocxPreview.d.ts +7 -0
  17. package/dist/types/components/FilePreview/core/ExcelPreview.d.ts +5 -0
  18. package/dist/types/components/FilePreview/core/ImagePreview.d.ts +5 -0
  19. package/dist/types/components/FilePreview/core/JsonPreview.d.ts +5 -0
  20. package/dist/types/components/FilePreview/core/MarkdownPreview.d.ts +6 -0
  21. package/dist/types/components/FilePreview/core/PdfPreview.d.ts +84 -0
  22. package/dist/types/components/FilePreview/core/PptPreview.d.ts +5 -0
  23. package/dist/types/components/FilePreview/core/TxtPreview.d.ts +7 -0
  24. package/dist/types/components/FilePreview/core/index.d.ts +2 -0
  25. package/dist/types/components/FilePreview/index.d.ts +12 -0
  26. package/dist/types/components/FilePreview/types/index.d.ts +11 -0
  27. package/dist/types/components/FilePreview/utils.d.ts +3 -0
  28. package/dist/types/components/index.d.ts +1 -0
  29. package/dist/types/element-ui.d.ts +21 -0
  30. package/dist/types/index.d.ts +1 -0
  31. package/dist/types/utils/index.d.ts +2 -0
  32. package/package.json +85 -0
@@ -0,0 +1,75 @@
1
+ /* eslint-disable */
2
+ /* prettier-ignore */
3
+ // @ts-nocheck
4
+ // noinspection JSUnusedGlobalSymbols
5
+ // Generated by unplugin-auto-import
6
+ // biome-ignore lint: disable
7
+ export {}
8
+ declare global {
9
+ const EffectScope: typeof import('vue').EffectScope
10
+ const ElMessage: typeof import('element-plus/es').ElMessage
11
+ const ElMessageBox: typeof import('element-plus/es').ElMessageBox
12
+ const computed: typeof import('vue').computed
13
+ const createApp: typeof import('vue').createApp
14
+ const customRef: typeof import('vue').customRef
15
+ const defineAsyncComponent: typeof import('vue').defineAsyncComponent
16
+ const defineComponent: typeof import('vue').defineComponent
17
+ const effectScope: typeof import('vue').effectScope
18
+ const getCurrentInstance: typeof import('vue').getCurrentInstance
19
+ const getCurrentScope: typeof import('vue').getCurrentScope
20
+ const getCurrentWatcher: typeof import('vue').getCurrentWatcher
21
+ const h: typeof import('vue').h
22
+ const inject: typeof import('vue').inject
23
+ const isProxy: typeof import('vue').isProxy
24
+ const isReactive: typeof import('vue').isReactive
25
+ const isReadonly: typeof import('vue').isReadonly
26
+ const isRef: typeof import('vue').isRef
27
+ const isShallow: typeof import('vue').isShallow
28
+ const markRaw: typeof import('vue').markRaw
29
+ const nextTick: typeof import('vue').nextTick
30
+ const onActivated: typeof import('vue').onActivated
31
+ const onBeforeMount: typeof import('vue').onBeforeMount
32
+ const onBeforeUnmount: typeof import('vue').onBeforeUnmount
33
+ const onBeforeUpdate: typeof import('vue').onBeforeUpdate
34
+ const onDeactivated: typeof import('vue').onDeactivated
35
+ const onErrorCaptured: typeof import('vue').onErrorCaptured
36
+ const onMounted: typeof import('vue').onMounted
37
+ const onRenderTracked: typeof import('vue').onRenderTracked
38
+ const onRenderTriggered: typeof import('vue').onRenderTriggered
39
+ const onScopeDispose: typeof import('vue').onScopeDispose
40
+ const onServerPrefetch: typeof import('vue').onServerPrefetch
41
+ const onUnmounted: typeof import('vue').onUnmounted
42
+ const onUpdated: typeof import('vue').onUpdated
43
+ const onWatcherCleanup: typeof import('vue').onWatcherCleanup
44
+ const provide: typeof import('vue').provide
45
+ const reactive: typeof import('vue').reactive
46
+ const readonly: typeof import('vue').readonly
47
+ const ref: typeof import('vue').ref
48
+ const resolveComponent: typeof import('vue').resolveComponent
49
+ const shallowReactive: typeof import('vue').shallowReactive
50
+ const shallowReadonly: typeof import('vue').shallowReadonly
51
+ const shallowRef: typeof import('vue').shallowRef
52
+ const toRaw: typeof import('vue').toRaw
53
+ const toRef: typeof import('vue').toRef
54
+ const toRefs: typeof import('vue').toRefs
55
+ const toValue: typeof import('vue').toValue
56
+ const triggerRef: typeof import('vue').triggerRef
57
+ const unref: typeof import('vue').unref
58
+ const useAttrs: typeof import('vue').useAttrs
59
+ const useCssModule: typeof import('vue').useCssModule
60
+ const useCssVars: typeof import('vue').useCssVars
61
+ const useId: typeof import('vue').useId
62
+ const useModel: typeof import('vue').useModel
63
+ const useSlots: typeof import('vue').useSlots
64
+ const useTemplateRef: typeof import('vue').useTemplateRef
65
+ const watch: typeof import('vue').watch
66
+ const watchEffect: typeof import('vue').watchEffect
67
+ const watchPostEffect: typeof import('vue').watchPostEffect
68
+ const watchSyncEffect: typeof import('vue').watchSyncEffect
69
+ }
70
+ // for type re-export
71
+ declare global {
72
+ // @ts-ignore
73
+ export type { Component, Slot, Slots, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, ShallowRef, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue'
74
+ import('vue')
75
+ }
@@ -0,0 +1,7 @@
1
+ interface Props {
2
+ url: string;
3
+ }
4
+ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
5
+ docxRef: unknown;
6
+ }, any>;
7
+ export default _default;
@@ -0,0 +1,5 @@
1
+ interface Props {
2
+ url: string;
3
+ }
4
+ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
5
+ export default _default;
@@ -0,0 +1,5 @@
1
+ interface Props {
2
+ url: string;
3
+ }
4
+ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
5
+ export default _default;
@@ -0,0 +1,5 @@
1
+ interface Props {
2
+ url: string;
3
+ }
4
+ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
5
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import { Viewer } from '@bytemd/vue-next';
2
+ interface Props {
3
+ url: string;
4
+ }
5
+ declare const _default: Viewer<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
6
+ export default _default;
@@ -0,0 +1,84 @@
1
+ interface Props {
2
+ url: string;
3
+ }
4
+ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
5
+ pdfRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<globalThis.ExtractPropTypes<{
6
+ config: {
7
+ default: () => ToolbarConfig;
8
+ type: PropType<ToolbarConfig>;
9
+ };
10
+ title: {
11
+ type: BooleanConstructor;
12
+ default: () => boolean;
13
+ };
14
+ pdf: {
15
+ type: (StringConstructor | ArrayBufferConstructor)[];
16
+ };
17
+ theme: PropType<Theme>;
18
+ fileName: StringConstructor;
19
+ idConfig: {
20
+ type: PropType<ToolbarIdConfig>;
21
+ };
22
+ pageScale: PropType<PageScale>;
23
+ pageNumber: NumberConstructor;
24
+ }>>, {
25
+ showElem: (defaultToolbarPath: string, customToolbarElem?: string | number | symbol) => boolean;
26
+ getScale: (value: number) => string;
27
+ slotProps: import('vue').ComputedRef<{
28
+ toggleTheme: () => void;
29
+ isSidebarHidden: boolean;
30
+ isFindbarHidden: boolean;
31
+ }>;
32
+ isToolbarHidden: import('vue').ComputedRef<"zero-top" | "">;
33
+ isSidebarToolbarHidden: import('vue').ComputedRef<string | boolean>;
34
+ localTheme: import('vue').ComputedRef<Theme>;
35
+ defaultLocale: import('vue').Ref<string>;
36
+ bindOpenHandler: () => void;
37
+ }, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, {
38
+ title: boolean;
39
+ config: ToolbarConfig;
40
+ }, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {}, any, import('vue').ComponentProvideOptions, {
41
+ P: {};
42
+ B: {};
43
+ D: {};
44
+ C: {};
45
+ M: {};
46
+ Defaults: {};
47
+ }, Readonly<globalThis.ExtractPropTypes<{
48
+ config: {
49
+ default: () => ToolbarConfig;
50
+ type: PropType<ToolbarConfig>;
51
+ };
52
+ title: {
53
+ type: BooleanConstructor;
54
+ default: () => boolean;
55
+ };
56
+ pdf: {
57
+ type: (StringConstructor | ArrayBufferConstructor)[];
58
+ };
59
+ theme: PropType<Theme>;
60
+ fileName: StringConstructor;
61
+ idConfig: {
62
+ type: PropType<ToolbarIdConfig>;
63
+ };
64
+ pageScale: PropType<PageScale>;
65
+ pageNumber: NumberConstructor;
66
+ }>>, {
67
+ showElem: (defaultToolbarPath: string, customToolbarElem?: string | number | symbol) => boolean;
68
+ getScale: (value: number) => string;
69
+ slotProps: import('vue').ComputedRef<{
70
+ toggleTheme: () => void;
71
+ isSidebarHidden: boolean;
72
+ isFindbarHidden: boolean;
73
+ }>;
74
+ isToolbarHidden: import('vue').ComputedRef<"zero-top" | "">;
75
+ isSidebarToolbarHidden: import('vue').ComputedRef<string | boolean>;
76
+ localTheme: import('vue').ComputedRef<Theme>;
77
+ defaultLocale: import('vue').Ref<string>;
78
+ bindOpenHandler: () => void;
79
+ }, {}, {}, {}, {
80
+ title: boolean;
81
+ config: ToolbarConfig;
82
+ }> | null;
83
+ }, HTMLDivElement>;
84
+ export default _default;
@@ -0,0 +1,5 @@
1
+ interface Props {
2
+ url: string;
3
+ }
4
+ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
5
+ export default _default;
@@ -0,0 +1,7 @@
1
+ interface Props {
2
+ url: string;
3
+ }
4
+ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
5
+ contentRef: HTMLPreElement;
6
+ }, HTMLDivElement>;
7
+ export default _default;
@@ -0,0 +1,2 @@
1
+ export declare const supportFileSuffix: string[];
2
+ export declare const componentMap: Record<string, any>;
@@ -0,0 +1,12 @@
1
+ import { FilePreviewProps, ShowParams } from './types/index';
2
+ declare const _default: import('vue').DefineComponent<FilePreviewProps, {
3
+ show: (options: ShowParams) => void;
4
+ close: () => void;
5
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
6
+ "update:visible": (...args: any[]) => void;
7
+ close: (...args: any[]) => void;
8
+ }, string, import('vue').PublicProps, Readonly<FilePreviewProps> & Readonly<{
9
+ "onUpdate:visible"?: ((...args: any[]) => any) | undefined;
10
+ onClose?: ((...args: any[]) => any) | undefined;
11
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
12
+ export default _default;
@@ -0,0 +1,11 @@
1
+ export interface FilePreviewProps {
2
+ visible: boolean;
3
+ url: string;
4
+ name: string;
5
+ watermark?: string | string[];
6
+ }
7
+ export interface ShowParams {
8
+ url: string;
9
+ name: string;
10
+ watermark?: string | string[];
11
+ }
@@ -0,0 +1,3 @@
1
+ import { ShowParams } from './types';
2
+ export declare const getFileSuffix: (fileName: string) => string;
3
+ export declare const validatePreviewOptions: (options: ShowParams) => boolean;
@@ -0,0 +1 @@
1
+ export * from './FilePreview';
@@ -0,0 +1,21 @@
1
+ /* eslint-disable */
2
+ // @ts-nocheck
3
+ // biome-ignore lint: disable
4
+ // oxlint-disable
5
+ // ------
6
+ // Generated by unplugin-vue-components
7
+ // Read more: https://github.com/vuejs/core/pull/3399
8
+
9
+ export {}
10
+
11
+ /* prettier-ignore */
12
+ declare module 'vue' {
13
+ export interface GlobalComponents {
14
+ ElDrawer: typeof import('element-plus/es')['ElDrawer']
15
+ ElImage: typeof import('element-plus/es')['ElImage']
16
+ ElWatermark: typeof import('element-plus/es')['ElWatermark']
17
+ }
18
+ export interface GlobalDirectives {
19
+ vLoading: typeof import('element-plus/es')['ElLoadingDirective']
20
+ }
21
+ }
@@ -0,0 +1 @@
1
+ export * from './components';
@@ -0,0 +1,2 @@
1
+ import { Component } from 'vue';
2
+ export declare const withInstall: <T extends Component>(component: T) => T;
package/package.json ADDED
@@ -0,0 +1,85 @@
1
+ {
2
+ "name": "basic-file-preview",
3
+ "private": false,
4
+ "version": "1.0.0",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.es.js",
8
+ "types": "./dist/types/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/types/index.d.ts",
12
+ "import": "./dist/index.es.js",
13
+ "require": "./dist/index.cjs"
14
+ }
15
+ },
16
+ "author": "balabilibo",
17
+ "license": "MIT",
18
+ "description": "这是一个基于 vue3、element-plus 封装的文件预览组件,目前仅支持预览以(pdf、docx、xlsx、pptx、txt、json、md)格式结尾的文件以及常规格式的图片,并提供水印功能",
19
+ "keywords": [
20
+ "vue3",
21
+ "basic-file-preview",
22
+ "file-preview",
23
+ "office",
24
+ "txt",
25
+ "json",
26
+ "markdown"
27
+ ],
28
+ "files": [
29
+ "dist"
30
+ ],
31
+ "scripts": {
32
+ "dev": "vite",
33
+ "build": "vue-tsc -b && vite build",
34
+ "preview": "vite preview"
35
+ },
36
+ "dependencies": {
37
+ "@bytemd/plugin-breaks": "^1.22.0",
38
+ "@bytemd/plugin-frontmatter": "^1.22.0",
39
+ "@bytemd/plugin-gemoji": "^1.22.0",
40
+ "@bytemd/plugin-gfm": "^1.22.0",
41
+ "@bytemd/plugin-highlight": "^1.22.0",
42
+ "@bytemd/plugin-math": "^1.22.0",
43
+ "@bytemd/plugin-medium-zoom": "^1.22.0",
44
+ "@bytemd/plugin-mermaid": "^1.22.0",
45
+ "@bytemd/vue-next": "^1.22.0",
46
+ "@rollup/plugin-commonjs": "^29.0.0",
47
+ "@vue-office/docx": "^1.6.3",
48
+ "@vue-office/excel": "^1.7.14",
49
+ "@vue-office/pptx": "^1.0.1",
50
+ "axios": "^1.13.5",
51
+ "bytemd": "^1.22.0",
52
+ "element-plus": "^2.13.2",
53
+ "juejin-markdown-themes": "^1.34.0",
54
+ "sass": "^1.97.3",
55
+ "unocss": "66.5.12",
56
+ "vue": "^3.5.25",
57
+ "vue-demi": "0.14.6",
58
+ "vue-json-viewer": "^3.0.4",
59
+ "vue3-pdf-app": "^1.0.3"
60
+ },
61
+ "devDependencies": {
62
+ "@types/node": "^24.10.1",
63
+ "@vitejs/plugin-vue": "^6.0.2",
64
+ "@vue/tsconfig": "^0.8.1",
65
+ "typescript": "~5.9.3",
66
+ "unplugin-auto-import": "^21.0.0",
67
+ "unplugin-vue-components": "^31.0.0",
68
+ "vite": "^7.3.1",
69
+ "vite-plugin-css-injected-by-js": "^4.0.1",
70
+ "vite-plugin-dts": "^4.5.4",
71
+ "vue-tsc": "^3.1.5"
72
+ },
73
+ "pnpm": {
74
+ "ignoredBuiltDependencies": [
75
+ "@parcel/watcher",
76
+ "esbuild"
77
+ ],
78
+ "onlyBuiltDependencies": [
79
+ "@vue-office/docx",
80
+ "@vue-office/excel",
81
+ "@vue-office/pptx",
82
+ "vue-demi"
83
+ ]
84
+ }
85
+ }