@pdfslick/core 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.
- package/dist/esm/PDFSlick.d.ts +103 -0
- package/dist/esm/PDFSlick.d.ts.map +1 -0
- package/dist/esm/index.css +0 -0
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +2912 -0
- package/dist/esm/lib/index.d.ts +7 -0
- package/dist/esm/lib/index.d.ts.map +1 -0
- package/dist/esm/lib/overlay_manager.d.ts +32 -0
- package/dist/esm/lib/overlay_manager.d.ts.map +1 -0
- package/dist/esm/lib/pdf_presentation_mode.d.ts +46 -0
- package/dist/esm/lib/pdf_presentation_mode.d.ts.map +1 -0
- package/dist/esm/lib/pdf_print_service.d.ts +30 -0
- package/dist/esm/lib/pdf_print_service.d.ts.map +1 -0
- package/dist/esm/lib/pdf_rendering_queue.d.ts +65 -0
- package/dist/esm/lib/pdf_rendering_queue.d.ts.map +1 -0
- package/dist/esm/lib/pdf_thumbnail_view.d.ts +101 -0
- package/dist/esm/lib/pdf_thumbnail_view.d.ts.map +1 -0
- package/dist/esm/lib/pdf_thumbnail_viewer.d.ts +119 -0
- package/dist/esm/lib/pdf_thumbnail_viewer.d.ts.map +1 -0
- package/dist/esm/lib/ui_utils.d.ts +292 -0
- package/dist/esm/lib/ui_utils.d.ts.map +1 -0
- package/dist/esm/store.d.ts +4 -0
- package/dist/esm/store.d.ts.map +1 -0
- package/dist/esm/types.d.ts +111 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/pdf_viewer.css +2762 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/umd/PDFSlick.d.ts +103 -0
- package/dist/umd/PDFSlick.d.ts.map +1 -0
- package/dist/umd/index.d.ts +5 -0
- package/dist/umd/index.d.ts.map +1 -0
- package/dist/umd/index.js +45 -0
- package/dist/umd/lib/index.d.ts +7 -0
- package/dist/umd/lib/index.d.ts.map +1 -0
- package/dist/umd/lib/overlay_manager.d.ts +32 -0
- package/dist/umd/lib/overlay_manager.d.ts.map +1 -0
- package/dist/umd/lib/pdf_presentation_mode.d.ts +46 -0
- package/dist/umd/lib/pdf_presentation_mode.d.ts.map +1 -0
- package/dist/umd/lib/pdf_print_service.d.ts +30 -0
- package/dist/umd/lib/pdf_print_service.d.ts.map +1 -0
- package/dist/umd/lib/pdf_rendering_queue.d.ts +65 -0
- package/dist/umd/lib/pdf_rendering_queue.d.ts.map +1 -0
- package/dist/umd/lib/pdf_thumbnail_view.d.ts +101 -0
- package/dist/umd/lib/pdf_thumbnail_view.d.ts.map +1 -0
- package/dist/umd/lib/pdf_thumbnail_viewer.d.ts +119 -0
- package/dist/umd/lib/pdf_thumbnail_viewer.d.ts.map +1 -0
- package/dist/umd/lib/ui_utils.d.ts +292 -0
- package/dist/umd/lib/ui_utils.d.ts.map +1 -0
- package/dist/umd/store.d.ts +4 -0
- package/dist/umd/store.d.ts.map +1 -0
- package/dist/umd/types.d.ts +111 -0
- package/dist/umd/types.d.ts.map +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
declare const DEFAULT_SCALE_VALUE = "auto";
|
|
2
|
+
declare const DEFAULT_SCALE = 1;
|
|
3
|
+
declare const DEFAULT_SCALE_DELTA = 1.1;
|
|
4
|
+
declare const MIN_SCALE = 0.1;
|
|
5
|
+
declare const MAX_SCALE = 10;
|
|
6
|
+
declare const UNKNOWN_SCALE = 0;
|
|
7
|
+
declare const MAX_AUTO_SCALE = 1.25;
|
|
8
|
+
declare const SCROLLBAR_PADDING = 40;
|
|
9
|
+
declare const VERTICAL_PADDING = 5;
|
|
10
|
+
declare const RenderingStates: {
|
|
11
|
+
INITIAL: number;
|
|
12
|
+
RUNNING: number;
|
|
13
|
+
PAUSED: number;
|
|
14
|
+
FINISHED: number;
|
|
15
|
+
};
|
|
16
|
+
declare const PresentationModeState: {
|
|
17
|
+
UNKNOWN: number;
|
|
18
|
+
NORMAL: number;
|
|
19
|
+
CHANGING: number;
|
|
20
|
+
FULLSCREEN: number;
|
|
21
|
+
};
|
|
22
|
+
declare const SidebarView: {
|
|
23
|
+
UNKNOWN: number;
|
|
24
|
+
NONE: number;
|
|
25
|
+
THUMBS: number;
|
|
26
|
+
OUTLINE: number;
|
|
27
|
+
ATTACHMENTS: number;
|
|
28
|
+
LAYERS: number;
|
|
29
|
+
};
|
|
30
|
+
declare const RendererType: {
|
|
31
|
+
CANVAS: string;
|
|
32
|
+
SVG: string;
|
|
33
|
+
};
|
|
34
|
+
declare const TextLayerMode: {
|
|
35
|
+
DISABLE: number;
|
|
36
|
+
ENABLE: number;
|
|
37
|
+
};
|
|
38
|
+
declare const ScrollMode: {
|
|
39
|
+
UNKNOWN: number;
|
|
40
|
+
VERTICAL: number;
|
|
41
|
+
HORIZONTAL: number;
|
|
42
|
+
WRAPPED: number;
|
|
43
|
+
PAGE: number;
|
|
44
|
+
};
|
|
45
|
+
declare const SpreadMode: {
|
|
46
|
+
UNKNOWN: number;
|
|
47
|
+
NONE: number;
|
|
48
|
+
ODD: number;
|
|
49
|
+
EVEN: number;
|
|
50
|
+
};
|
|
51
|
+
declare const CursorTool: {
|
|
52
|
+
SELECT: number;
|
|
53
|
+
HAND: number;
|
|
54
|
+
ZOOM: number;
|
|
55
|
+
};
|
|
56
|
+
declare const AutoPrintRegExp: RegExp;
|
|
57
|
+
/**
|
|
58
|
+
* Scale factors for the canvas, necessary with HiDPI displays.
|
|
59
|
+
*/
|
|
60
|
+
declare class OutputScale {
|
|
61
|
+
sx: number;
|
|
62
|
+
sy: number;
|
|
63
|
+
constructor();
|
|
64
|
+
/**
|
|
65
|
+
* @type {boolean} Returns `true` when scaling is required, `false` otherwise.
|
|
66
|
+
*/
|
|
67
|
+
get scaled(): boolean;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Scrolls specified element into view of its parent.
|
|
71
|
+
* @param {Object} element - The element to be visible.
|
|
72
|
+
* @param {Object} spot - An object with optional top and left properties,
|
|
73
|
+
* specifying the offset from the top left edge.
|
|
74
|
+
* @param {boolean} [scrollMatches] - When scrolling search results into view,
|
|
75
|
+
* ignore elements that either: Contains marked content identifiers,
|
|
76
|
+
* or have the CSS-rule `overflow: hidden;` set. The default value is `false`.
|
|
77
|
+
*/
|
|
78
|
+
declare function scrollIntoView(element: HTMLElement, spot: any, scrollMatches?: boolean): void;
|
|
79
|
+
/**
|
|
80
|
+
* Helper function to start monitoring the scroll event and converting them into
|
|
81
|
+
* PDF.js friendly one: with scroll debounce and scroll direction.
|
|
82
|
+
*/
|
|
83
|
+
declare function watchScroll(viewAreaElement: HTMLElement, callback: (state: any) => void): {
|
|
84
|
+
right: boolean;
|
|
85
|
+
down: boolean;
|
|
86
|
+
lastX: number;
|
|
87
|
+
lastY: number;
|
|
88
|
+
_eventHandler: (evt: Event) => void;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Helper function to parse query string (e.g. ?param1=value¶m2=...).
|
|
92
|
+
* @param {string}
|
|
93
|
+
* @returns {Map}
|
|
94
|
+
*/
|
|
95
|
+
declare function parseQueryString(query: string): Map<any, any>;
|
|
96
|
+
/**
|
|
97
|
+
* @param {string} str
|
|
98
|
+
* @param {boolean} [replaceInvisible]
|
|
99
|
+
*/
|
|
100
|
+
declare function removeNullCharacters(str: string, replaceInvisible?: boolean): string;
|
|
101
|
+
/**
|
|
102
|
+
* Use binary search to find the index of the first item in a given array which
|
|
103
|
+
* passes a given condition. The items are expected to be sorted in the sense
|
|
104
|
+
* that if the condition is true for one item in the array, then it is also true
|
|
105
|
+
* for all following items.
|
|
106
|
+
*
|
|
107
|
+
* @returns {number} Index of the first array element to pass the test,
|
|
108
|
+
* or |items.length| if no such element exists.
|
|
109
|
+
*/
|
|
110
|
+
declare function binarySearchFirstItem(items: any[], condition: (item: any) => boolean, start?: number): number;
|
|
111
|
+
/**
|
|
112
|
+
* Approximates float number as a fraction using Farey sequence (max order
|
|
113
|
+
* of 8).
|
|
114
|
+
* @param {number} x - Positive float number.
|
|
115
|
+
* @returns {Array} Estimated fraction: the first array item is a numerator,
|
|
116
|
+
* the second one is a denominator.
|
|
117
|
+
*/
|
|
118
|
+
declare function approximateFraction(x: number): number[];
|
|
119
|
+
declare function roundToDivide(x: number, div: number): number;
|
|
120
|
+
/**
|
|
121
|
+
* @typedef {Object} GetPageSizeInchesParameters
|
|
122
|
+
* @property {number[]} view
|
|
123
|
+
* @property {number} userUnit
|
|
124
|
+
* @property {number} rotate
|
|
125
|
+
*/
|
|
126
|
+
/**
|
|
127
|
+
* @typedef {Object} PageSize
|
|
128
|
+
* @property {number} width - In inches.
|
|
129
|
+
* @property {number} height - In inches.
|
|
130
|
+
*/
|
|
131
|
+
/**
|
|
132
|
+
* Gets the size of the specified page, converted from PDF units to inches.
|
|
133
|
+
* @param {GetPageSizeInchesParameters} params
|
|
134
|
+
* @returns {PageSize}
|
|
135
|
+
*/
|
|
136
|
+
declare function getPageSizeInches({ view, userUnit, rotate }: {
|
|
137
|
+
view: number[];
|
|
138
|
+
userUnit: number;
|
|
139
|
+
rotate: number;
|
|
140
|
+
}): {
|
|
141
|
+
width: number;
|
|
142
|
+
height: number;
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Helper function for getVisibleElements.
|
|
146
|
+
*
|
|
147
|
+
* @param {number} index - initial guess at the first visible element
|
|
148
|
+
* @param {Array} views - array of pages, into which `index` is an index
|
|
149
|
+
* @param {number} top - the top of the scroll pane
|
|
150
|
+
* @returns {number} less than or equal to `index` that is definitely at or
|
|
151
|
+
* before the first visible element in `views`, but not by too much. (Usually,
|
|
152
|
+
* this will be the first element in the first partially visible row in
|
|
153
|
+
* `views`, although sometimes it goes back one row further.)
|
|
154
|
+
*/
|
|
155
|
+
declare function backtrackBeforeAllVisibleElements(index: number, views: any[], top: number): number;
|
|
156
|
+
/**
|
|
157
|
+
* @typedef {Object} GetVisibleElementsParameters
|
|
158
|
+
* @property {HTMLElement} scrollEl - A container that can possibly scroll.
|
|
159
|
+
* @property {Array} views - Objects with a `div` property that contains an
|
|
160
|
+
* HTMLElement, which should all be descendants of `scrollEl` satisfying the
|
|
161
|
+
* relevant layout assumptions.
|
|
162
|
+
* @property {boolean} sortByVisibility - If `true`, the returned elements are
|
|
163
|
+
* sorted in descending order of the percent of their padding box that is
|
|
164
|
+
* visible. The default value is `false`.
|
|
165
|
+
* @property {boolean} horizontal - If `true`, the elements are assumed to be
|
|
166
|
+
* laid out horizontally instead of vertically. The default value is `false`.
|
|
167
|
+
* @property {boolean} rtl - If `true`, the `scrollEl` container is assumed to
|
|
168
|
+
* be in right-to-left mode. The default value is `false`.
|
|
169
|
+
*/
|
|
170
|
+
/**
|
|
171
|
+
* Generic helper to find out what elements are visible within a scroll pane.
|
|
172
|
+
*
|
|
173
|
+
* Well, pretty generic. There are some assumptions placed on the elements
|
|
174
|
+
* referenced by `views`:
|
|
175
|
+
* - If `horizontal`, no left of any earlier element is to the right of the
|
|
176
|
+
* left of any later element.
|
|
177
|
+
* - Otherwise, `views` can be split into contiguous rows where, within a row,
|
|
178
|
+
* no top of any element is below the bottom of any other element, and
|
|
179
|
+
* between rows, no bottom of any element in an earlier row is below the
|
|
180
|
+
* top of any element in a later row.
|
|
181
|
+
*
|
|
182
|
+
* (Here, top, left, etc. all refer to the padding edge of the element in
|
|
183
|
+
* question. For pages, that ends up being equivalent to the bounding box of the
|
|
184
|
+
* rendering canvas. Earlier and later refer to index in `views`, not page
|
|
185
|
+
* layout.)
|
|
186
|
+
*
|
|
187
|
+
* @param {GetVisibleElementsParameters}
|
|
188
|
+
* @returns {Object} `{ first, last, views: [{ id, x, y, view, percent }] }`
|
|
189
|
+
*/
|
|
190
|
+
declare function getVisibleElements({ scrollEl, views, sortByVisibility, horizontal, rtl, }: {
|
|
191
|
+
scrollEl: HTMLElement;
|
|
192
|
+
views: {
|
|
193
|
+
div: HTMLElement;
|
|
194
|
+
id: any;
|
|
195
|
+
}[];
|
|
196
|
+
sortByVisibility?: boolean;
|
|
197
|
+
horizontal?: boolean;
|
|
198
|
+
rtl?: boolean;
|
|
199
|
+
}): {
|
|
200
|
+
first: {
|
|
201
|
+
id: any;
|
|
202
|
+
x: number;
|
|
203
|
+
y: number;
|
|
204
|
+
view: {
|
|
205
|
+
div: HTMLElement;
|
|
206
|
+
id: any;
|
|
207
|
+
};
|
|
208
|
+
percent: number;
|
|
209
|
+
widthPercent: number;
|
|
210
|
+
};
|
|
211
|
+
last: {
|
|
212
|
+
id: any;
|
|
213
|
+
x: number;
|
|
214
|
+
y: number;
|
|
215
|
+
view: {
|
|
216
|
+
div: HTMLElement;
|
|
217
|
+
id: any;
|
|
218
|
+
};
|
|
219
|
+
percent: number;
|
|
220
|
+
widthPercent: number;
|
|
221
|
+
} | undefined;
|
|
222
|
+
views: {
|
|
223
|
+
id: any;
|
|
224
|
+
x: number;
|
|
225
|
+
y: number;
|
|
226
|
+
view: {
|
|
227
|
+
div: HTMLElement;
|
|
228
|
+
id: any;
|
|
229
|
+
};
|
|
230
|
+
percent: number;
|
|
231
|
+
widthPercent: number;
|
|
232
|
+
}[];
|
|
233
|
+
ids: Set<unknown>;
|
|
234
|
+
};
|
|
235
|
+
/**
|
|
236
|
+
* Event handler to suppress context menu.
|
|
237
|
+
*/
|
|
238
|
+
declare function noContextMenuHandler(evt: Event): void;
|
|
239
|
+
declare function normalizeWheelEventDirection(evt: WheelEvent): number;
|
|
240
|
+
declare function normalizeWheelEventDelta(evt: WheelEvent): number;
|
|
241
|
+
declare function isValidRotation(angle: number): boolean;
|
|
242
|
+
declare function isValidScrollMode(mode: any): boolean;
|
|
243
|
+
declare function isValidSpreadMode(mode: any): boolean;
|
|
244
|
+
declare function isPortraitOrientation(size: {
|
|
245
|
+
width: number;
|
|
246
|
+
height: number;
|
|
247
|
+
}): boolean;
|
|
248
|
+
/**
|
|
249
|
+
* Promise that is resolved when DOM window becomes visible.
|
|
250
|
+
*/
|
|
251
|
+
declare const animationStarted: Promise<unknown>;
|
|
252
|
+
declare const docStyle: CSSStyleDeclaration;
|
|
253
|
+
declare class ProgressBar {
|
|
254
|
+
#private;
|
|
255
|
+
constructor(bar: HTMLElement);
|
|
256
|
+
get percent(): number;
|
|
257
|
+
set percent(val: number);
|
|
258
|
+
setWidth(viewer: HTMLElement): void;
|
|
259
|
+
setDisableAutoFetch(delay?: number): void;
|
|
260
|
+
hide(): void;
|
|
261
|
+
show(): void;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Get the active or focused element in current DOM.
|
|
265
|
+
*
|
|
266
|
+
* Recursively search for the truly active or focused element in case there are
|
|
267
|
+
* shadow DOMs.
|
|
268
|
+
*
|
|
269
|
+
* @returns {Element} the truly active or focused element.
|
|
270
|
+
*/
|
|
271
|
+
declare function getActiveOrFocusedElement(): Element | null;
|
|
272
|
+
/**
|
|
273
|
+
* Converts API PageLayout values to the format used by `BaseViewer`.
|
|
274
|
+
* @param {string} mode - The API PageLayout value.
|
|
275
|
+
* @returns {Object}
|
|
276
|
+
*/
|
|
277
|
+
declare function apiPageLayoutToViewerModes(layout: string): {
|
|
278
|
+
scrollMode: number;
|
|
279
|
+
spreadMode: number;
|
|
280
|
+
};
|
|
281
|
+
/**
|
|
282
|
+
* Converts API PageMode values to the format used by `PDFSidebar`.
|
|
283
|
+
* NOTE: There's also a "FullScreen" parameter which is not possible to support,
|
|
284
|
+
* since the Fullscreen API used in browsers requires that entering
|
|
285
|
+
* fullscreen mode only occurs as a result of a user-initiated event.
|
|
286
|
+
* @param {string} mode - The API PageMode value.
|
|
287
|
+
* @returns {number} A value from {SidebarView}.
|
|
288
|
+
*/
|
|
289
|
+
declare function apiPageModeToSidebarView(mode: string): number;
|
|
290
|
+
export { animationStarted, apiPageLayoutToViewerModes, apiPageModeToSidebarView, approximateFraction, AutoPrintRegExp, backtrackBeforeAllVisibleElements, // only exported for testing
|
|
291
|
+
binarySearchFirstItem, CursorTool, DEFAULT_SCALE, DEFAULT_SCALE_DELTA, DEFAULT_SCALE_VALUE, docStyle, getActiveOrFocusedElement, getPageSizeInches, getVisibleElements, isPortraitOrientation, isValidRotation, isValidScrollMode, isValidSpreadMode, MAX_AUTO_SCALE, MAX_SCALE, MIN_SCALE, noContextMenuHandler, normalizeWheelEventDelta, normalizeWheelEventDirection, OutputScale, parseQueryString, PresentationModeState, ProgressBar, removeNullCharacters, RendererType, RenderingStates, roundToDivide, SCROLLBAR_PADDING, scrollIntoView, ScrollMode, SidebarView, SpreadMode, TextLayerMode, UNKNOWN_SCALE, VERTICAL_PADDING, watchScroll, };
|
|
292
|
+
//# sourceMappingURL=ui_utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui_utils.d.ts","sourceRoot":"","sources":["../../lib/ui_utils.ts"],"names":[],"mappings":"AAeA,QAAA,MAAM,mBAAmB,SAAS,CAAC;AACnC,QAAA,MAAM,aAAa,IAAM,CAAC;AAC1B,QAAA,MAAM,mBAAmB,MAAM,CAAC;AAChC,QAAA,MAAM,SAAS,MAAM,CAAC;AACtB,QAAA,MAAM,SAAS,KAAO,CAAC;AACvB,QAAA,MAAM,aAAa,IAAI,CAAC;AACxB,QAAA,MAAM,cAAc,OAAO,CAAC;AAC5B,QAAA,MAAM,iBAAiB,KAAK,CAAC;AAC7B,QAAA,MAAM,gBAAgB,IAAI,CAAC;AAE3B,QAAA,MAAM,eAAe;;;;;CAKpB,CAAC;AAEF,QAAA,MAAM,qBAAqB;;;;;CAK1B,CAAC;AAEF,QAAA,MAAM,WAAW;;;;;;;CAOhB,CAAC;AAEF,QAAA,MAAM,YAAY;;;CAIjB,CAAC;AAEF,QAAA,MAAM,aAAa;;;CAGlB,CAAC;AAEF,QAAA,MAAM,UAAU;;;;;;CAMf,CAAC;AAEF,QAAA,MAAM,UAAU;;;;;CAKf,CAAC;AAEF,QAAA,MAAM,UAAU;;;;CAIf,CAAC;AAGF,QAAA,MAAM,eAAe,QAAiB,CAAC;AAEvC;;GAEG;AACH,c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BAAyB,mBAYjC;AAED;;;;GAIG;AACH,iBAAS,0BAA0B,CAAC,MAAM,EAAE,MAAM;;;EAwBjD;AAED;;;;;;;GAOG;AACH,iBAAS,wBAAwB,CAAC,IAAI,EAAE,MAAM,UAc7C;AAED,OAAO,EACL,gBAAgB,EAChB,0BAA0B,EAC1B,wBAAwB,EACxB,mBAAmB,EACnB,eAAe,EACf,iCAAiC,EAAE,4BAA4B;AAC/D,qBAAqB,EACrB,UAAU,EACV,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,QAAQ,EACR,yBAAyB,EACzB,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,SAAS,EACT,SAAS,EACT,oBAAoB,EACpB,wBAAwB,EACxB,4BAA4B,EAC5B,WAAW,EACX,gBAAgB,EAChB,qBAAqB,EACrB,WAAW,EACX,oBAAoB,EACpB,YAAY,EACZ,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,UAAU,EACV,WAAW,EACX,UAAU,EACV,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,WAAW,GACZ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../store.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAEhE,eAAO,MAAM,YAAY,EAAE,kBAuB1B,CAAA;AAED,eAAO,MAAM,MAAM,yDAwDhB,CAAA"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { PDFViewer } from "pdfjs-dist/web/pdf_viewer";
|
|
2
|
+
import { StoreApi } from "zustand";
|
|
3
|
+
import { PDFSlick } from './PDFSlick';
|
|
4
|
+
import { PDFThumbnailView } from "./lib";
|
|
5
|
+
export type TPDFDocumentOutline = {
|
|
6
|
+
title: string;
|
|
7
|
+
bold: boolean;
|
|
8
|
+
italic: boolean;
|
|
9
|
+
color: Uint8ClampedArray;
|
|
10
|
+
dest: string | any[];
|
|
11
|
+
url: string;
|
|
12
|
+
unsafeUrl: string;
|
|
13
|
+
newWindow: boolean;
|
|
14
|
+
count: number;
|
|
15
|
+
items: TPDFDocumentOutline;
|
|
16
|
+
}[];
|
|
17
|
+
export type TPDFDocumentAttachment = {
|
|
18
|
+
filename: string;
|
|
19
|
+
content: Uint8Array;
|
|
20
|
+
};
|
|
21
|
+
export type TPDFDocumentAttachments = Record<string, TPDFDocumentAttachment>;
|
|
22
|
+
export type PDFSlickStateProps = {
|
|
23
|
+
isDocumentLoaded: boolean;
|
|
24
|
+
pagesReady: boolean;
|
|
25
|
+
numPages: number;
|
|
26
|
+
pageNumber: number;
|
|
27
|
+
scale: number;
|
|
28
|
+
scaleValue: string | undefined;
|
|
29
|
+
pagesRotation: number;
|
|
30
|
+
spreadMode: number;
|
|
31
|
+
scrollMode: number;
|
|
32
|
+
url: string | null;
|
|
33
|
+
filename?: string;
|
|
34
|
+
filesize?: number;
|
|
35
|
+
title?: string;
|
|
36
|
+
author?: string;
|
|
37
|
+
subject?: string;
|
|
38
|
+
keywords?: any;
|
|
39
|
+
creationDate?: Date | null;
|
|
40
|
+
modificationDate?: Date | null;
|
|
41
|
+
creator?: string;
|
|
42
|
+
producer?: string;
|
|
43
|
+
version?: string;
|
|
44
|
+
pageSize?: any;
|
|
45
|
+
isLinearized?: boolean;
|
|
46
|
+
documentOutline: TPDFDocumentOutline | null;
|
|
47
|
+
attachments: Map<string, TPDFDocumentAttachment>;
|
|
48
|
+
annotationEditorMode: number;
|
|
49
|
+
thumbnailViews: Map<number, PDFThumbnailView>;
|
|
50
|
+
thumbnails: Map<number, {
|
|
51
|
+
pageNumber: number;
|
|
52
|
+
width: number;
|
|
53
|
+
height: number;
|
|
54
|
+
scale: number;
|
|
55
|
+
rotation: number;
|
|
56
|
+
loaded: boolean;
|
|
57
|
+
pageLabel: string | null;
|
|
58
|
+
src: string | null;
|
|
59
|
+
}>;
|
|
60
|
+
pdfSlick: PDFSlick | null;
|
|
61
|
+
};
|
|
62
|
+
export type PDFSlickStateSetters = {
|
|
63
|
+
_setThumbnailView: (pageNumber: number, view: PDFThumbnailView) => void;
|
|
64
|
+
_setThumbnailsViews: (views: PDFThumbnailView[]) => void;
|
|
65
|
+
};
|
|
66
|
+
export type PDFSlickState = PDFSlickStateProps & PDFSlickStateSetters;
|
|
67
|
+
export type TEventBusEvent = {
|
|
68
|
+
source: PDFViewer;
|
|
69
|
+
pagesCount: number;
|
|
70
|
+
pageNumber: number;
|
|
71
|
+
pagesRotation: number;
|
|
72
|
+
pageLabel: string;
|
|
73
|
+
previous: number;
|
|
74
|
+
scale: number;
|
|
75
|
+
mode: number;
|
|
76
|
+
presetValue: string | undefined;
|
|
77
|
+
error?: any;
|
|
78
|
+
};
|
|
79
|
+
export type PDFSlickOptions = {
|
|
80
|
+
textLayerMode?: number;
|
|
81
|
+
annotationMode?: number;
|
|
82
|
+
annotationEditorMode?: number;
|
|
83
|
+
singlePageViewer?: boolean;
|
|
84
|
+
removePageBorders?: boolean;
|
|
85
|
+
enablePrintAutoRotate?: boolean;
|
|
86
|
+
useOnlyCssZoom?: boolean;
|
|
87
|
+
pageColors?: {
|
|
88
|
+
background: any;
|
|
89
|
+
foreground: any;
|
|
90
|
+
};
|
|
91
|
+
l10n?: any;
|
|
92
|
+
maxCanvasPixels?: number;
|
|
93
|
+
printResolution?: number;
|
|
94
|
+
thumbnailWidth?: number;
|
|
95
|
+
scaleValue?: string;
|
|
96
|
+
filename?: string;
|
|
97
|
+
};
|
|
98
|
+
export type PDFSlickInputArgs = {
|
|
99
|
+
container: HTMLDivElement;
|
|
100
|
+
viewer?: HTMLDivElement | undefined;
|
|
101
|
+
thumbs?: HTMLDivElement | undefined;
|
|
102
|
+
store?: StoreApi<PDFSlickState>;
|
|
103
|
+
options?: PDFSlickOptions;
|
|
104
|
+
};
|
|
105
|
+
export type TEventBusName = "textlayerrendered" | "pagesinit" | "pagesloaded" | "scalechanging" | "pagechanging" | string;
|
|
106
|
+
export type TEventBusOptions = {
|
|
107
|
+
once?: boolean;
|
|
108
|
+
};
|
|
109
|
+
export type TEventBusListener = (source: TEventBusEvent | Object) => void;
|
|
110
|
+
export type TEventBusOn = (eventName: TEventBusName, listener: TEventBusListener, options: TEventBusOptions) => void;
|
|
111
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAEzC,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,iBAAiB,CAAC;IACzB,IAAI,EAAE,MAAM,GAAG,GAAG,EAAE,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,mBAAmB,CAAC;CAC5B,EAAE,CAAC;AAEJ,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,UAAU,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;AAE7E,MAAM,MAAM,kBAAkB,GAAG;IAC/B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;IAEpB,QAAQ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CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,cAAc,CAAC;IAC1B,MAAM,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;IACpC,MAAM,CAAC,EAAE,cAAc,GAAG,SAAS,CAAC;IACpC,KAAK,CAAC,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAC;IAChC,OAAO,CAAC,EAAE,eAAe,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAAG,WAAW,GAAG,aAAa,GAAG,eAAe,GAAG,cAAc,GAAG,MAAM,CAAA;AACzH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,KAAK,IAAI,CAAA;AAEzE,MAAM,MAAM,WAAW,GAAG,CAAC,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,iBAAiB,EAAE,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pdfslick/core",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"source": "./index.ts",
|
|
5
|
+
"main": "dist/umd/index.js",
|
|
6
|
+
"module": "dist/esm/index.js",
|
|
7
|
+
"types": "dist/esm/index.d.ts",
|
|
8
|
+
"description": "PDFSlick — view and interact with PDF documents in your React and SolidJS apps.",
|
|
9
|
+
"keywords": [
|
|
10
|
+
"pdf",
|
|
11
|
+
"pdf.js",
|
|
12
|
+
"react",
|
|
13
|
+
"solidjs",
|
|
14
|
+
"solid",
|
|
15
|
+
"pdfslick"
|
|
16
|
+
],
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "https://github.com/pdfslick/pdfslick.git",
|
|
23
|
+
"directory": "packages/core"
|
|
24
|
+
},
|
|
25
|
+
"sideEffects": [
|
|
26
|
+
"*.css"
|
|
27
|
+
],
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"scripts": {
|
|
30
|
+
"lint": "eslint \"**/*.ts*\"",
|
|
31
|
+
"dev": "concurrently \"rollup --config node:@pdfslick/rollup-config --watch\" \"npm run css-watch\"",
|
|
32
|
+
"build": "rollup --config node:@pdfslick/rollup-config --environment NODE_ENV:production && npm run css",
|
|
33
|
+
"css": "postcss styles/pdf_viewer.css --config ./postcss.config.cjs --dir dist",
|
|
34
|
+
"css-watch": "npm run css -- --watch"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"pdfjs-dist": "3.5.141",
|
|
38
|
+
"zustand": "^4.3.6"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@pdfslick/rollup-config": "*",
|
|
42
|
+
"autoprefixer": "^10.4.14",
|
|
43
|
+
"concurrently": "^8.0.1",
|
|
44
|
+
"eslint": "^7.32.0",
|
|
45
|
+
"eslint-config-custom": "*",
|
|
46
|
+
"postcss": "^8.4.21",
|
|
47
|
+
"postcss-cli": "^10.1.0",
|
|
48
|
+
"postcss-inline-svg": "^6.0.0",
|
|
49
|
+
"react": "^18.2.0",
|
|
50
|
+
"tsconfig": "*",
|
|
51
|
+
"typescript": "^4.9.5"
|
|
52
|
+
},
|
|
53
|
+
"rollup": {
|
|
54
|
+
"globals": {
|
|
55
|
+
"zustand": "zustand",
|
|
56
|
+
"pdfjs-dist": "pdfjsLib"
|
|
57
|
+
},
|
|
58
|
+
"name": "PDFSlickCore"
|
|
59
|
+
}
|
|
60
|
+
}
|