@vue-pdf-viewer/viewer 1.3.0-beta.1 → 1.3.0-beta.10
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/index.js +4955 -4799
- package/dist/index.umd.cjs +8 -8
- package/dist/types/components/LayerTextSearchHighlight.vue.d.ts +0 -14
- package/dist/types/components/VPdfPage.vue.d.ts +5 -3
- package/dist/types/components/VPdfViewer.vue.d.ts +1 -9
- package/dist/types/composables/usePdfPagesSizes.d.ts +1 -1
- package/dist/types/composables/useSearch.d.ts +2 -2
- package/dist/types/composables/useVirtualPages.d.ts +1 -1
- package/dist/types/composables/useVisibilities.d.ts +8 -0
- package/dist/types/const.d.ts +4 -3
- package/dist/types/utils/searchHighlight.d.ts +7 -0
- package/dist/types/utils/types.d.ts +34 -4
- package/dist/types/utils/uiViewer.d.ts +2 -0
- package/package.json +1 -1
- package/dist/types/composables/useVirtual.d.ts +0 -36
- package/dist/types/composables/useVirtualScroll.d.ts +0 -18
|
@@ -1,21 +1,7 @@
|
|
|
1
1
|
interface OwnProps {
|
|
2
2
|
pageIndex: number;
|
|
3
3
|
searchKeyword: string;
|
|
4
|
-
totalPages?: number;
|
|
5
4
|
}
|
|
6
|
-
interface FlagKeyword {
|
|
7
|
-
keyword: string;
|
|
8
|
-
matchCase?: boolean;
|
|
9
|
-
wholeWords?: boolean;
|
|
10
|
-
}
|
|
11
|
-
type SingleKeyword = string | RegExp | FlagKeyword;
|
|
12
|
-
interface NormalizedKeyword {
|
|
13
|
-
keyword: string;
|
|
14
|
-
regExp: RegExp;
|
|
15
|
-
wholeWords: boolean;
|
|
16
|
-
}
|
|
17
|
-
export declare const normalizeFlagKeyword: (flagKeyword: FlagKeyword) => NormalizedKeyword;
|
|
18
|
-
export declare const normalizeSingleKeyword: (keyword: SingleKeyword, matchCase?: boolean, wholeWords?: boolean) => NormalizedKeyword;
|
|
19
5
|
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<OwnProps>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<OwnProps>>>, {}, {}>;
|
|
20
6
|
export default _default;
|
|
21
7
|
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type { AnnotationEventPayload, HighlightEventPayload, HighlightOptions, Match, TextLayerLoadedEventPayload } from '../utils/types';
|
|
1
|
+
import type { AnnotationEventPayload, HighlightEventPayload, HighlightOptions, Match, TextLayerLoadedEventPayload, VisibilityInfo } from '../utils/types';
|
|
2
2
|
import type { PageViewport, PDFPageProxy } from 'pdfjs-dist/types/web/interfaces';
|
|
3
3
|
import type { PDFDocumentProxy } from 'pdfjs-dist';
|
|
4
4
|
interface BaseProps {
|
|
5
|
-
|
|
6
|
-
rotation: number;
|
|
5
|
+
pageIndex: number;
|
|
7
6
|
page: PDFPageProxy;
|
|
8
7
|
viewport: PageViewport;
|
|
9
8
|
document: PDFDocumentProxy;
|
|
@@ -33,6 +32,8 @@ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimePr
|
|
|
33
32
|
annotated: (payload: AnnotationEventPayload) => void;
|
|
34
33
|
} & {
|
|
35
34
|
annotationLoaded: (payload?: any[] | undefined) => void;
|
|
35
|
+
} & {
|
|
36
|
+
intersected: (args: VisibilityInfo) => void;
|
|
36
37
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<BaseProps & {
|
|
37
38
|
textLayer: true;
|
|
38
39
|
highlightText: string;
|
|
@@ -45,6 +46,7 @@ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimePr
|
|
|
45
46
|
currentHighlight?: Match | undefined;
|
|
46
47
|
highlightOptions?: HighlightOptions | undefined;
|
|
47
48
|
}>> | import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<BaseProps & NonTextProps>>> & {
|
|
49
|
+
onIntersected?: ((args: VisibilityInfo) => any) | undefined;
|
|
48
50
|
onHighlight?: ((payload: HighlightEventPayload) => any) | undefined;
|
|
49
51
|
onTextLoaded?: ((payload: TextLayerLoadedEventPayload) => any) | undefined;
|
|
50
52
|
onAnnotationLoaded?: ((payload?: any[] | undefined) => any) | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AnnotationEventPayload,
|
|
1
|
+
import type { AnnotationEventPayload, TextLayerLoadedEventPayload, RotateEvent, ToolbarOptions, Localization } from '@/utils/types';
|
|
2
2
|
import { ScrollMode, ViewMode, ZoomLevel } from '@/utils/enumerators';
|
|
3
3
|
import '../style.scss';
|
|
4
4
|
declare const _default: {
|
|
@@ -54,7 +54,6 @@ declare const _default: {
|
|
|
54
54
|
readonly default: () => Record<string, Localization>;
|
|
55
55
|
};
|
|
56
56
|
}>> & {
|
|
57
|
-
onHighlight?: ((payload: HighlightEventPayload) => any) | undefined;
|
|
58
57
|
onTextLoaded?: ((payload: TextLayerLoadedEventPayload) => any) | undefined;
|
|
59
58
|
onAnnotation?: ((payload: AnnotationEventPayload) => any) | undefined;
|
|
60
59
|
onAnnotationLoaded?: ((payload: any[]) => any) | undefined;
|
|
@@ -66,8 +65,6 @@ declare const _default: {
|
|
|
66
65
|
goToPage: (page: number) => void;
|
|
67
66
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
68
67
|
annotation: (payload: AnnotationEventPayload) => void;
|
|
69
|
-
} & {
|
|
70
|
-
highlight: (payload: HighlightEventPayload) => void;
|
|
71
68
|
} & {
|
|
72
69
|
loaded: () => void;
|
|
73
70
|
} & {
|
|
@@ -132,7 +129,6 @@ declare const _default: {
|
|
|
132
129
|
readonly default: () => Record<string, Localization>;
|
|
133
130
|
};
|
|
134
131
|
}>> & {
|
|
135
|
-
onHighlight?: ((payload: HighlightEventPayload) => any) | undefined;
|
|
136
132
|
onTextLoaded?: ((payload: TextLayerLoadedEventPayload) => any) | undefined;
|
|
137
133
|
onAnnotation?: ((payload: AnnotationEventPayload) => any) | undefined;
|
|
138
134
|
onAnnotationLoaded?: ((payload: any[]) => any) | undefined;
|
|
@@ -211,7 +207,6 @@ declare const _default: {
|
|
|
211
207
|
readonly default: () => Record<string, Localization>;
|
|
212
208
|
};
|
|
213
209
|
}>> & {
|
|
214
|
-
onHighlight?: ((payload: HighlightEventPayload) => any) | undefined;
|
|
215
210
|
onTextLoaded?: ((payload: TextLayerLoadedEventPayload) => any) | undefined;
|
|
216
211
|
onAnnotation?: ((payload: AnnotationEventPayload) => any) | undefined;
|
|
217
212
|
onAnnotationLoaded?: ((payload: any[]) => any) | undefined;
|
|
@@ -289,7 +284,6 @@ declare const _default: {
|
|
|
289
284
|
readonly default: () => Record<string, Localization>;
|
|
290
285
|
};
|
|
291
286
|
}>> & {
|
|
292
|
-
onHighlight?: ((payload: HighlightEventPayload) => any) | undefined;
|
|
293
287
|
onTextLoaded?: ((payload: TextLayerLoadedEventPayload) => any) | undefined;
|
|
294
288
|
onAnnotation?: ((payload: AnnotationEventPayload) => any) | undefined;
|
|
295
289
|
onAnnotationLoaded?: ((payload: any[]) => any) | undefined;
|
|
@@ -301,8 +295,6 @@ declare const _default: {
|
|
|
301
295
|
goToPage: (page: number) => void;
|
|
302
296
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
303
297
|
annotation: (payload: AnnotationEventPayload) => void;
|
|
304
|
-
} & {
|
|
305
|
-
highlight: (payload: HighlightEventPayload) => void;
|
|
306
298
|
} & {
|
|
307
299
|
loaded: () => void;
|
|
308
300
|
} & {
|
|
@@ -2,7 +2,7 @@ import { MaybeRef, UnwrapRef } from 'vue';
|
|
|
2
2
|
import { ViewerPdfPage, ViewerState } from '@/utils/types';
|
|
3
3
|
import { ZoomLevel } from '@/utils/enumerators';
|
|
4
4
|
export declare function usePdfPageSizes(props: UnwrapRef<ViewerState>, initialScale: MaybeRef<number | ZoomLevel>): {
|
|
5
|
-
pdfPages: import("vue").
|
|
5
|
+
pdfPages: import("vue").ComputedRef<ViewerPdfPage[]>;
|
|
6
6
|
actualPdfPages: import("vue").ShallowRef<ViewerPdfPage[]>;
|
|
7
7
|
defaultScale: import("vue").Ref<number, number>;
|
|
8
8
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Match, PdfPageSize } from '@/components';
|
|
2
|
-
import {
|
|
2
|
+
import { Ref, ShallowRef } from 'vue';
|
|
3
3
|
import type { PDFDocumentProxy } from 'pdfjs-dist';
|
|
4
4
|
interface MatchValue extends Match {
|
|
5
5
|
page: number;
|
|
6
6
|
pageMatchIdx: number;
|
|
7
7
|
}
|
|
8
|
-
export declare const useSearch: (pdfDoc: ShallowRef<PDFDocumentProxy | undefined>, pageSizes: Ref<PdfPageSize[] | undefined
|
|
8
|
+
export declare const useSearch: (pdfDoc: ShallowRef<PDFDocumentProxy | undefined>, pageSizes: Ref<PdfPageSize[] | undefined>) => {
|
|
9
9
|
searchValue: Ref<string, string>;
|
|
10
10
|
matches: Ref<{
|
|
11
11
|
page: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ComputedRef, CSSProperties, Ref, StyleValue, UnwrapRef } from 'vue';
|
|
2
2
|
import { ViewerPdfPage, ScrollMode, ViewMode } from '..';
|
|
3
3
|
export interface UseVirtualListItem<T> {
|
|
4
4
|
data: T;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Ref } from 'vue';
|
|
2
|
+
import { VisibilityInfo } from '@/utils/types';
|
|
3
|
+
export declare function useVisibilities(totalPages: Ref<number>): {
|
|
4
|
+
resetVisibility: () => void;
|
|
5
|
+
updateVisibility: (info: VisibilityInfo) => void;
|
|
6
|
+
currentPage: Ref<number, number>;
|
|
7
|
+
calculateCurrentPage: () => number;
|
|
8
|
+
};
|
package/dist/types/const.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PDFDocumentProxy } from 'pdfjs-dist/types/src/display/api';
|
|
2
2
|
import type { PDFPageProxy } from 'pdfjs-dist/types/web/interfaces';
|
|
3
3
|
import type { InjectionKey, Slot, Ref, ComponentPublicInstance, ShallowRef } from 'vue';
|
|
4
|
-
import type {
|
|
4
|
+
import type { HighlightMatchPosition, License, Localization, NormalizedKeyword, Offset, ToolbarOptions, ViewerPdfPage } from './utils/types';
|
|
5
5
|
export declare const DEFAULT_TOOLBAR_OPTIONS: ToolbarOptions;
|
|
6
6
|
export declare const Locales: Record<string, Localization>;
|
|
7
7
|
export declare const DEFAULT_OFFSET: Offset;
|
|
@@ -10,7 +10,7 @@ export declare const MIN_ZOOM_SCALE = 0.25;
|
|
|
10
10
|
export declare const MAX_ZOOM_SCALE = 10;
|
|
11
11
|
export declare const SCROLL_BAR_WIDTH = 20;
|
|
12
12
|
export declare const PAGE_PADDING = 1;
|
|
13
|
-
export declare const PAGE_OFFSET =
|
|
13
|
+
export declare const PAGE_OFFSET = 0;
|
|
14
14
|
export declare const LAST_PAGE_OFFSET = 4;
|
|
15
15
|
export declare const FILE_INPUT: InjectionKey<Ref<ComponentPublicInstance<import("vue").DefineComponent<{}, {
|
|
16
16
|
triggerClick: () => void;
|
|
@@ -49,6 +49,8 @@ export declare const FILE_INPUT: InjectionKey<Ref<ComponentPublicInstance<import
|
|
|
49
49
|
onChange?: ((file: string) => any) | undefined;
|
|
50
50
|
onFilenameChange?: ((file: string) => any) | undefined;
|
|
51
51
|
}, {}, {}>, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | undefined>>;
|
|
52
|
+
export declare const EMPTY_KEYWORD_REGEXP: NormalizedKeyword;
|
|
53
|
+
export declare const CURRENT_MATCH_CSS_CLASS = "vpv-highlight__text-current";
|
|
52
54
|
export declare const LATEST_MATCH_POSITION: InjectionKey<Ref<HighlightMatchPosition | undefined, HighlightMatchPosition | undefined>>;
|
|
53
55
|
export declare const GET_PAGE: InjectionKey<(doc: PDFDocumentProxy, pageIndex: number) => Promise<PDFPageProxy>>;
|
|
54
56
|
export declare const VIEWER_STATE: InjectionKey<{
|
|
@@ -60,7 +62,6 @@ export declare const VIEWER_STATE: InjectionKey<{
|
|
|
60
62
|
scale: number | undefined;
|
|
61
63
|
rotation: number;
|
|
62
64
|
}>;
|
|
63
|
-
export declare const LATEST_DESTINATION: InjectionKey<Ref<Destination | undefined, Destination | undefined>>;
|
|
64
65
|
export declare const TOOLBAR_OPTIONS: InjectionKey<Ref<ToolbarOptions | undefined, ToolbarOptions | undefined>>;
|
|
65
66
|
export declare const TOTAL_TOOL_OTHERS_MENU: InjectionKey<Ref<number, number>>;
|
|
66
67
|
export declare const IS_DARK: InjectionKey<Ref<boolean, boolean>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CSSProperties } from 'vue';
|
|
2
|
+
import type { FlagKeyword, HighlightArea, NormalizedKeyword, SingleKeyword } from './types';
|
|
3
|
+
export declare const normalizeFlagKeyword: (flagKeyword: FlagKeyword) => NormalizedKeyword;
|
|
4
|
+
export declare const normalizeSingleKeyword: (keyword: SingleKeyword, matchCase?: boolean, wholeWords?: boolean) => NormalizedKeyword;
|
|
5
|
+
export declare const sortHighlightPosition: (a: HighlightArea, b: HighlightArea) => 0 | 1 | -1;
|
|
6
|
+
export declare const getHighlightStyle: (area: HighlightArea) => CSSProperties;
|
|
7
|
+
export declare const unwrap: (ele: Node) => void;
|
|
@@ -41,6 +41,36 @@ export interface RotateEvent {
|
|
|
41
41
|
direction: 'clockwise' | 'counterclockwise';
|
|
42
42
|
rotate: number;
|
|
43
43
|
}
|
|
44
|
+
export interface CharacterIndex {
|
|
45
|
+
char: string;
|
|
46
|
+
charIdxInSpan: number;
|
|
47
|
+
spanIdx: number;
|
|
48
|
+
}
|
|
49
|
+
export interface MatchRangeIndex {
|
|
50
|
+
keyword: RegExp;
|
|
51
|
+
startIndex: number;
|
|
52
|
+
endIndex: number;
|
|
53
|
+
}
|
|
54
|
+
export interface FlagKeyword {
|
|
55
|
+
keyword: string;
|
|
56
|
+
matchCase?: boolean;
|
|
57
|
+
wholeWords?: boolean;
|
|
58
|
+
}
|
|
59
|
+
export type SingleKeyword = string | RegExp | FlagKeyword;
|
|
60
|
+
export interface NormalizedKeyword {
|
|
61
|
+
keyword: string;
|
|
62
|
+
regExp: RegExp;
|
|
63
|
+
wholeWords: boolean;
|
|
64
|
+
}
|
|
65
|
+
export interface HighlightArea {
|
|
66
|
+
keywordStr: string;
|
|
67
|
+
left: number;
|
|
68
|
+
top: number;
|
|
69
|
+
height: number;
|
|
70
|
+
width: number;
|
|
71
|
+
pageHeight: number;
|
|
72
|
+
pageWidth: number;
|
|
73
|
+
}
|
|
44
74
|
export interface HighlightEventPayload {
|
|
45
75
|
matches: Match[];
|
|
46
76
|
page: number;
|
|
@@ -163,6 +193,10 @@ export interface ViewerState {
|
|
|
163
193
|
scale: Ref<number | undefined>;
|
|
164
194
|
rotation: Ref<number>;
|
|
165
195
|
}
|
|
196
|
+
export interface VisibilityInfo {
|
|
197
|
+
pageIndex: number;
|
|
198
|
+
ratio: number;
|
|
199
|
+
}
|
|
166
200
|
export interface ToolbarOptions {
|
|
167
201
|
/**
|
|
168
202
|
* Determines whether the toolbar includes a search functionality.
|
|
@@ -299,10 +333,6 @@ export interface HighlightMatchPosition {
|
|
|
299
333
|
matchIdx: number;
|
|
300
334
|
pageIdx: number;
|
|
301
335
|
}
|
|
302
|
-
export interface HighlightMatchPosition {
|
|
303
|
-
matchIdx: number;
|
|
304
|
-
pageIdx: number;
|
|
305
|
-
}
|
|
306
336
|
export type Localization = {
|
|
307
337
|
searchButtonTooltip: string;
|
|
308
338
|
searchInputPlaceholder: string;
|
package/package.json
CHANGED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Ref, UnwrapRef, CSSProperties } from 'vue';
|
|
2
|
-
import { ScrollMode, ViewMode } from '@/utils/enumerators';
|
|
3
|
-
import { VirtualItem, Offset, ViewerPdfPage } from '@/utils/types';
|
|
4
|
-
export interface VisiblePagesRange {
|
|
5
|
-
endPage: number;
|
|
6
|
-
numPages: number;
|
|
7
|
-
startPage: number;
|
|
8
|
-
}
|
|
9
|
-
export type SetRenderRange = (visiblePagesRange: VisiblePagesRange) => {
|
|
10
|
-
endPage: number;
|
|
11
|
-
startPage: number;
|
|
12
|
-
};
|
|
13
|
-
interface UseVirtualProps {
|
|
14
|
-
pages: Ref<ViewerPdfPage[]>;
|
|
15
|
-
viewerRef: Ref<HTMLElement | undefined>;
|
|
16
|
-
scrollMode: Ref<ScrollMode>;
|
|
17
|
-
viewMode: Ref<ViewMode>;
|
|
18
|
-
isRtl: boolean;
|
|
19
|
-
smoothScroll: Ref<boolean>;
|
|
20
|
-
}
|
|
21
|
-
export declare const useVirtual: (props: UnwrapRef<UseVirtualProps>) => {
|
|
22
|
-
visibilities: import("vue").WritableComputedRef<any[]>;
|
|
23
|
-
virtualItems: import("vue").ComputedRef<VirtualItem[]>;
|
|
24
|
-
getContainerStyles: () => CSSProperties;
|
|
25
|
-
getItemContainerStyles: (item: VirtualItem) => CSSProperties;
|
|
26
|
-
getItemStyles: (item: VirtualItem) => CSSProperties;
|
|
27
|
-
virtualRangeState: import("vue").ComputedRef<{
|
|
28
|
-
startPage: number;
|
|
29
|
-
endPage: number;
|
|
30
|
-
maxVisibilityIndex: number;
|
|
31
|
-
} | undefined>;
|
|
32
|
-
isScrolling: Ref<boolean, boolean>;
|
|
33
|
-
scrollToItem: (index: number, offset?: Offset) => void;
|
|
34
|
-
zoom: (scale: number, index: number) => void;
|
|
35
|
-
};
|
|
36
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Ref, UnwrapRef } from 'vue';
|
|
2
|
-
import { Offset } from '../utils/types';
|
|
3
|
-
import { ScrollDirection, ScrollMode, ViewMode } from '../utils/enumerators';
|
|
4
|
-
interface UseScrollReturn {
|
|
5
|
-
scrollOffset: Ref<Offset>;
|
|
6
|
-
scrollDirection: Ref<ScrollDirection>;
|
|
7
|
-
isScrolling: Ref<boolean>;
|
|
8
|
-
scrollTo: (target: Offset, smooth?: boolean) => void;
|
|
9
|
-
}
|
|
10
|
-
interface UseScrollProps {
|
|
11
|
-
viewerRef: Ref<HTMLElement | undefined>;
|
|
12
|
-
scrollMode: Ref<ScrollMode>;
|
|
13
|
-
viewMode: Ref<ViewMode>;
|
|
14
|
-
isRtl: boolean;
|
|
15
|
-
smooth: Ref<boolean>;
|
|
16
|
-
}
|
|
17
|
-
export declare const useVirtualScroll: (props: UnwrapRef<UseScrollProps>) => UseScrollReturn;
|
|
18
|
-
export {};
|