unpdf 0.7.1 → 0.8.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 (46) hide show
  1. package/README.md +9 -13
  2. package/dist/pdfjs.mjs +1 -1
  3. package/dist/types/src/display/annotation_layer.d.ts +14 -7
  4. package/dist/types/src/display/annotation_storage.d.ts +4 -4
  5. package/dist/types/src/display/api.d.ts +14 -9
  6. package/dist/types/src/display/content_disposition.d.ts +7 -0
  7. package/dist/types/src/display/display_utils.d.ts +2 -5
  8. package/dist/types/src/display/editor/annotation_editor_layer.d.ts +13 -8
  9. package/dist/types/src/display/editor/editor.d.ts +51 -15
  10. package/dist/types/src/display/editor/freetext.d.ts +2 -9
  11. package/dist/types/src/display/editor/ink.d.ts +6 -12
  12. package/dist/types/src/display/editor/stamp.d.ts +5 -1
  13. package/dist/types/src/display/editor/tools.d.ts +15 -4
  14. package/dist/types/src/display/fetch_stream.d.ts +68 -0
  15. package/dist/types/src/display/font_loader.d.ts +4 -1
  16. package/dist/types/src/display/network.d.ts +83 -0
  17. package/dist/types/src/display/network_utils.d.ts +14 -0
  18. package/dist/types/src/display/node_stream.d.ts +71 -0
  19. package/dist/types/src/display/node_utils.d.ts +27 -0
  20. package/dist/types/src/display/transport_stream.d.ts +3 -0
  21. package/dist/types/src/display/xfa_layer.d.ts +2 -1
  22. package/dist/types/src/display/xfa_text.d.ts +2 -0
  23. package/dist/types/src/interfaces.d.ts +118 -0
  24. package/dist/types/src/pdf.d.ts +3 -3
  25. package/dist/types/src/shared/util.d.ts +1 -0
  26. package/dist/types/web/annotation_editor_layer_builder.d.ts +8 -5
  27. package/dist/types/web/annotation_layer_builder.d.ts +12 -17
  28. package/dist/types/web/app_options.d.ts +2 -1
  29. package/dist/types/web/download_manager.d.ts +1 -1
  30. package/dist/types/web/generic_scripting.d.ts +1 -1
  31. package/dist/types/web/genericl10n.d.ts +14 -7
  32. package/dist/types/web/interfaces.d.ts +16 -8
  33. package/dist/types/web/l10n.d.ts +27 -0
  34. package/dist/types/web/l10n_utils.d.ts +7 -5
  35. package/dist/types/web/pdf_find_controller.d.ts +2 -1
  36. package/dist/types/web/pdf_link_service.d.ts +1 -1
  37. package/dist/types/web/pdf_page_view.d.ts +9 -7
  38. package/dist/types/web/pdf_thumbnail_view.d.ts +8 -15
  39. package/dist/types/web/pdf_thumbnail_viewer.d.ts +2 -8
  40. package/dist/types/web/pdf_viewer.d.ts +20 -14
  41. package/dist/types/web/text_accessibility.d.ts +5 -3
  42. package/dist/types/web/text_layer_builder.d.ts +7 -2
  43. package/dist/types/web/ui_utils.d.ts +5 -9
  44. package/dist/types/web/xfa_layer_builder.d.ts +4 -6
  45. package/package.json +18 -18
  46. package/dist/types/external/webL10n/l10n.d.ts +0 -0
@@ -18,12 +18,12 @@ export class IDownloadManager {
18
18
  */
19
19
  downloadData(data: Uint8Array, filename: string, contentType?: string | undefined): void;
20
20
  /**
21
- * @param {HTMLElement} element
22
21
  * @param {Uint8Array} data
23
22
  * @param {string} filename
23
+ * @param {string | null} [dest]
24
24
  * @returns {boolean} Indicating if the data was opened.
25
25
  */
26
- openOrDownloadData(element: HTMLElement, data: Uint8Array, filename: string): boolean;
26
+ openOrDownloadData(data: Uint8Array, filename: string, dest?: string | null | undefined): boolean;
27
27
  /**
28
28
  * @param {Blob} blob
29
29
  * @param {string} url
@@ -37,29 +37,37 @@ export class IDownloadManager {
37
37
  */
38
38
  export class IL10n {
39
39
  /**
40
- * @returns {Promise<string>} - Resolves to the current locale.
40
+ * @returns {string} - The current locale.
41
41
  */
42
- getLanguage(): Promise<string>;
42
+ getLanguage(): string;
43
43
  /**
44
- * @returns {Promise<string>} - Resolves to 'rtl' or 'ltr'.
44
+ * @returns {string} - 'rtl' or 'ltr'.
45
45
  */
46
- getDirection(): Promise<string>;
46
+ getDirection(): string;
47
47
  /**
48
48
  * Translates text identified by the key and adds/formats data using the args
49
49
  * property bag. If the key was not found, translation falls back to the
50
50
  * fallback text.
51
- * @param {string} key
51
+ * @param {Array | string} ids
52
52
  * @param {Object | null} [args]
53
53
  * @param {string} [fallback]
54
54
  * @returns {Promise<string>}
55
55
  */
56
- get(key: string, args?: Object | null | undefined, fallback?: string | undefined): Promise<string>;
56
+ get(ids: any[] | string, args?: Object | null | undefined, fallback?: string | undefined): Promise<string>;
57
57
  /**
58
58
  * Translates HTML element.
59
59
  * @param {HTMLElement} element
60
60
  * @returns {Promise<void>}
61
61
  */
62
62
  translate(element: HTMLElement): Promise<void>;
63
+ /**
64
+ * Pause the localization.
65
+ */
66
+ pause(): void;
67
+ /**
68
+ * Resume the localization.
69
+ */
70
+ resume(): void;
63
71
  }
64
72
  /** @typedef {import("../src/display/api").PDFPageProxy} PDFPageProxy */
65
73
  /** @typedef {import("../src/display/display_utils").PageViewport} PageViewport */
@@ -0,0 +1,27 @@
1
+ export type IL10n = import("./interfaces").IL10n;
2
+ /** @typedef {import("./interfaces").IL10n} IL10n */
3
+ /**
4
+ * @implements {IL10n}
5
+ */
6
+ export class L10n implements IL10n {
7
+ static "__#46@#fixupLangCode"(langCode: any): any;
8
+ static "__#46@#isRTL"(lang: any): boolean;
9
+ constructor({ lang, isRTL }: {
10
+ lang: any;
11
+ isRTL: any;
12
+ }, l10n?: null);
13
+ _setL10n(l10n: any): void;
14
+ /** @inheritdoc */
15
+ getLanguage(): any;
16
+ /** @inheritdoc */
17
+ getDirection(): string;
18
+ /** @inheritdoc */
19
+ get(ids: any, args: null | undefined, fallback: any): Promise<any>;
20
+ /** @inheritdoc */
21
+ translate(element: any): Promise<void>;
22
+ /** @inheritdoc */
23
+ pause(): void;
24
+ /** @inheritdoc */
25
+ resume(): void;
26
+ #private;
27
+ }
@@ -1,7 +1,9 @@
1
- export function getL10nFallback(key: any, args: any): any;
1
+ export type IL10n = import("./interfaces").IL10n;
2
2
  export namespace NullL10n {
3
- function getLanguage(): Promise<string>;
4
- function getDirection(): Promise<string>;
5
- function get(key: any, args?: null, fallback?: any): Promise<any>;
6
- function translate(element: any): Promise<void>;
3
+ function getLanguage(): any;
4
+ function getDirection(): any;
5
+ function get(ids: any, args: null | undefined, fallback: any): Promise<any>;
6
+ function translate(element: any): Promise<any>;
7
+ function pause(): any;
8
+ function resume(): any;
7
9
  }
@@ -102,7 +102,8 @@ export class PDFFindController {
102
102
  _pagesToSearch: number | null | undefined;
103
103
  _pendingFindMatches: Set<any> | undefined;
104
104
  _resumePageIdx: any;
105
- _firstPageCapability: any;
105
+ _firstPageCapability: PromiseCapability | undefined;
106
106
  _rawQuery: any;
107
107
  #private;
108
108
  }
109
+ import { PromiseCapability } from "../src/pdf";
@@ -75,7 +75,7 @@ export namespace LinkTarget {
75
75
  * @implements {IPDFLinkService}
76
76
  */
77
77
  export class PDFLinkService implements IPDFLinkService {
78
- static "__#42@#isValidExplicitDestination"(dest: any): boolean;
78
+ static "__#43@#isValidExplicitDestination"(dest: any): boolean;
79
79
  /**
80
80
  * @param {PDFLinkServiceOptions} options
81
81
  */
@@ -76,10 +76,10 @@ export type PDFPageViewOptions = {
76
76
  */
77
77
  l10n?: import("./interfaces").IL10n | undefined;
78
78
  /**
79
- * - The function that is used to lookup
79
+ * - The object that is used to lookup
80
80
  * the necessary layer-properties.
81
81
  */
82
- layerProperties?: Function | undefined;
82
+ layerProperties?: Object | undefined;
83
83
  };
84
84
  /**
85
85
  * @implements {IRenderableView}
@@ -105,10 +105,12 @@ export class PDFPageView implements IRenderableView {
105
105
  eventBus: import("./event_utils").EventBus;
106
106
  renderingQueue: import("./pdf_rendering_queue").PDFRenderingQueue | undefined;
107
107
  l10n: {
108
- getLanguage(): Promise<string>;
109
- getDirection(): Promise<string>;
110
- get(key: any, args?: null, fallback?: any): Promise<any>;
111
- translate(element: any): Promise<void>;
108
+ getLanguage(): any;
109
+ getDirection(): any;
110
+ get(ids: any, args: null | undefined, fallback: any): Promise<any>;
111
+ translate(element: any): Promise<any>;
112
+ pause(): any;
113
+ resume(): any;
112
114
  };
113
115
  renderTask: any;
114
116
  resume: (() => void) | null;
@@ -149,7 +151,7 @@ export class PDFPageView implements IRenderableView {
149
151
  */
150
152
  /**
151
153
  * Update e.g. the scale and/or rotation of the page.
152
- * @param {PDFPageViewUpdateParameters}
154
+ * @param {PDFPageViewUpdateParameters} params
153
155
  */
154
156
  update({ scale, rotation, optionalContentConfigPromise, drawingDelay, }: {
155
157
  /**
@@ -1,5 +1,6 @@
1
+ export type OptionalContentConfig = import("../src/display/optional_content_config").OptionalContentConfig;
2
+ export type PageViewport = import("../src/display/display_utils").PageViewport;
1
3
  export type EventBus = import("./event_utils").EventBus;
2
- export type IL10n = import("./interfaces").IL10n;
3
4
  export type IPDFLinkService = import("./interfaces").IPDFLinkService;
4
5
  export type IRenderableView = import("./interfaces").IRenderableView;
5
6
  export type PDFRenderingQueue = import("./pdf_rendering_queue").PDFRenderingQueue;
@@ -25,7 +26,7 @@ export type PDFThumbnailViewOptions = {
25
26
  * A promise that is resolved with an {@link OptionalContentConfig } instance.
26
27
  * The default value is `null`.
27
28
  */
28
- optionalContentConfigPromise?: Promise<OptionalContentConfig> | undefined;
29
+ optionalContentConfigPromise?: Promise<import("../src/display/optional_content_config").OptionalContentConfig> | undefined;
29
30
  /**
30
31
  * - The navigation/linking service.
31
32
  */
@@ -34,10 +35,6 @@ export type PDFThumbnailViewOptions = {
34
35
  * - The rendering queue object.
35
36
  */
36
37
  renderingQueue: PDFRenderingQueue;
37
- /**
38
- * - Localization service.
39
- */
40
- l10n: IL10n;
41
38
  /**
42
39
  * - Overwrites background and foreground colors
43
40
  * with user defined ones in order to improve readability in high contrast
@@ -52,15 +49,15 @@ export class PDFThumbnailView implements IRenderableView {
52
49
  /**
53
50
  * @param {PDFThumbnailViewOptions} options
54
51
  */
55
- constructor({ container, eventBus, id, defaultViewport, optionalContentConfigPromise, linkService, renderingQueue, l10n, pageColors, }: PDFThumbnailViewOptions);
52
+ constructor({ container, eventBus, id, defaultViewport, optionalContentConfigPromise, linkService, renderingQueue, pageColors, }: PDFThumbnailViewOptions);
56
53
  id: number;
57
54
  renderingId: string;
58
55
  pageLabel: string | null;
59
56
  pdfPage: any;
60
57
  rotation: number;
61
- viewport: PageViewport;
62
- pdfPageRotate: any;
63
- _optionalContentConfigPromise: Promise<OptionalContentConfig> | null;
58
+ viewport: import("../src/display/display_utils").PageViewport;
59
+ pdfPageRotate: number;
60
+ _optionalContentConfigPromise: Promise<import("../src/display/optional_content_config").OptionalContentConfig> | null;
64
61
  pageColors: Object | null;
65
62
  eventBus: import("./event_utils").EventBus;
66
63
  linkService: import("./interfaces").IPDFLinkService;
@@ -68,7 +65,6 @@ export class PDFThumbnailView implements IRenderableView {
68
65
  renderTask: any;
69
66
  renderingState: number;
70
67
  resume: (() => void) | null;
71
- l10n: import("./interfaces").IL10n;
72
68
  anchor: HTMLAnchorElement;
73
69
  div: HTMLDivElement;
74
70
  _placeholderImg: HTMLDivElement;
@@ -100,8 +96,6 @@ export class PDFThumbnailView implements IRenderableView {
100
96
  * @private
101
97
  */
102
98
  private _reduceImage;
103
- get _thumbPageTitle(): Promise<string>;
104
- get _thumbPageCanvas(): Promise<string>;
105
99
  /**
106
100
  * @param {string|null} label
107
101
  */
@@ -119,13 +113,12 @@ export class PDFThumbnailView implements IRenderableView {
119
113
  * The default value is `null`.
120
114
  * @property {IPDFLinkService} linkService - The navigation/linking service.
121
115
  * @property {PDFRenderingQueue} renderingQueue - The rendering queue object.
122
- * @property {IL10n} l10n - Localization service.
123
116
  * @property {Object} [pageColors] - Overwrites background and foreground colors
124
117
  * with user defined ones in order to improve readability in high contrast
125
118
  * mode.
126
119
  */
127
120
  export class TempImageFactory {
128
- static "__#51@#tempCanvas": null;
121
+ static "__#55@#tempCanvas": null;
129
122
  static getCanvas(width: any, height: any): (HTMLCanvasElement | CanvasRenderingContext2D | null)[];
130
123
  static destroyCanvas(): void;
131
124
  }
@@ -1,6 +1,6 @@
1
1
  export type PDFDocumentProxy = import("../src/display/api").PDFDocumentProxy;
2
+ export type PDFPageProxy = import("../src/display/api").PDFPageProxy;
2
3
  export type EventBus = import("./event_utils").EventBus;
3
- export type IL10n = import("./interfaces").IL10n;
4
4
  export type IPDFLinkService = import("./interfaces").IPDFLinkService;
5
5
  export type PDFRenderingQueue = import("./pdf_rendering_queue").PDFRenderingQueue;
6
6
  export type PDFThumbnailViewerOptions = {
@@ -21,10 +21,6 @@ export type PDFThumbnailViewerOptions = {
21
21
  * - The rendering queue object.
22
22
  */
23
23
  renderingQueue: PDFRenderingQueue;
24
- /**
25
- * - Localization service.
26
- */
27
- l10n: IL10n;
28
24
  /**
29
25
  * - Overwrites background and foreground colors
30
26
  * with user defined ones in order to improve readability in high contrast
@@ -39,7 +35,6 @@ export type PDFThumbnailViewerOptions = {
39
35
  * @property {EventBus} eventBus - The application event bus.
40
36
  * @property {IPDFLinkService} linkService - The navigation/linking service.
41
37
  * @property {PDFRenderingQueue} renderingQueue - The rendering queue object.
42
- * @property {IL10n} l10n - Localization service.
43
38
  * @property {Object} [pageColors] - Overwrites background and foreground colors
44
39
  * with user defined ones in order to improve readability in high contrast
45
40
  * mode.
@@ -51,12 +46,11 @@ export class PDFThumbnailViewer {
51
46
  /**
52
47
  * @param {PDFThumbnailViewerOptions} options
53
48
  */
54
- constructor({ container, eventBus, linkService, renderingQueue, l10n, pageColors, }: PDFThumbnailViewerOptions);
49
+ constructor({ container, eventBus, linkService, renderingQueue, pageColors, }: PDFThumbnailViewerOptions);
55
50
  container: HTMLDivElement;
56
51
  eventBus: import("./event_utils").EventBus;
57
52
  linkService: import("./interfaces").IPDFLinkService;
58
53
  renderingQueue: import("./pdf_rendering_queue").PDFRenderingQueue;
59
- l10n: import("./interfaces").IL10n;
60
54
  pageColors: Object | null;
61
55
  scroll: {
62
56
  right: boolean;
@@ -6,6 +6,8 @@ export type EventBus = import("./event_utils").EventBus;
6
6
  export type IDownloadManager = import("./interfaces").IDownloadManager;
7
7
  export type IL10n = import("./interfaces").IL10n;
8
8
  export type IPDFLinkService = import("./interfaces").IPDFLinkService;
9
+ export type PDFFindController = import("./pdf_find_controller").PDFFindController;
10
+ export type PDFScriptingManager = import("./pdf_scripting_manager").PDFScriptingManager;
9
11
  export type PDFViewerOptions = {
10
12
  /**
11
13
  * - The container for the viewer element.
@@ -32,12 +34,12 @@ export type PDFViewerOptions = {
32
34
  * - The find controller
33
35
  * component.
34
36
  */
35
- findController?: any;
37
+ findController?: import("./pdf_find_controller").PDFFindController | undefined;
36
38
  /**
37
39
  * - The scripting manager
38
40
  * component.
39
41
  */
40
- scriptingManager?: any;
42
+ scriptingManager?: import("./pdf_scripting_manager").PDFScriptingManager | undefined;
41
43
  /**
42
44
  * - The rendering queue object.
43
45
  */
@@ -179,18 +181,20 @@ export class PDFViewer {
179
181
  eventBus: import("./event_utils").EventBus;
180
182
  linkService: import("./interfaces").IPDFLinkService | SimpleLinkService;
181
183
  downloadManager: import("./interfaces").IDownloadManager | null;
182
- findController: any;
183
- _scriptingManager: any;
184
+ findController: import("./pdf_find_controller").PDFFindController | null;
185
+ _scriptingManager: import("./pdf_scripting_manager").PDFScriptingManager | null;
184
186
  imageResourcesPath: string;
185
187
  enablePrintAutoRotate: boolean;
186
188
  removePageBorders: boolean | undefined;
187
189
  isOffscreenCanvasSupported: boolean;
188
190
  maxCanvasPixels: number | undefined;
189
191
  l10n: {
190
- getLanguage(): Promise<string>;
191
- getDirection(): Promise<string>;
192
- get(key: any, args?: null, fallback?: any): Promise<any>;
193
- translate(element: any): Promise<void>;
192
+ getLanguage(): any;
193
+ getDirection(): any;
194
+ get(ids: any, args: null | undefined, fallback: any): Promise<any>;
195
+ translate(element: any): Promise<any>;
196
+ pause(): any;
197
+ resume(): any;
194
198
  };
195
199
  pageColors: Object | null;
196
200
  defaultRenderingQueue: boolean;
@@ -268,9 +272,10 @@ export class PDFViewer {
268
272
  */
269
273
  get pagesRotation(): number;
270
274
  _pagesRotation: any;
271
- get firstPagePromise(): any;
272
- get onePageRendered(): any;
273
- get pagesPromise(): any;
275
+ get firstPagePromise(): Promise<any> | null;
276
+ get onePageRendered(): Promise<any> | null;
277
+ get pagesPromise(): Promise<any> | null;
278
+ get _layerProperties(): any;
274
279
  getAllText(): Promise<string | null>;
275
280
  /**
276
281
  * @param {PDFDocumentProxy} pdfDocument
@@ -296,9 +301,9 @@ export class PDFViewer {
296
301
  rotation: any;
297
302
  pdfOpenParams: string;
298
303
  } | null | undefined;
299
- _firstPageCapability: any;
300
- _onePageRenderedCapability: any;
301
- _pagesCapability: any;
304
+ _firstPageCapability: PromiseCapability | undefined;
305
+ _onePageRenderedCapability: PromiseCapability | undefined;
306
+ _pagesCapability: PromiseCapability | undefined;
302
307
  _previousScrollMode: any;
303
308
  _spreadMode: any;
304
309
  _scrollUpdate(): void;
@@ -453,3 +458,4 @@ export class PDFViewer {
453
458
  }
454
459
  import { PDFRenderingQueue } from "./pdf_rendering_queue.js";
455
460
  import { SimpleLinkService } from "./pdf_link_service.js";
461
+ import { PromiseCapability } from "../src/pdf";
@@ -14,7 +14,7 @@ export class TextAccessibilityManager {
14
14
  * @param {HTMLElement} e2
15
15
  * @returns {number}
16
16
  */
17
- static "__#45@#compareElementPositions"(e1: HTMLElement, e2: HTMLElement): number;
17
+ static "__#4@#compareElementPositions"(e1: HTMLElement, e2: HTMLElement): number;
18
18
  setTextMapping(textDivs: any): void;
19
19
  /**
20
20
  * Function called when the text layer has finished rendering.
@@ -31,12 +31,14 @@ export class TextAccessibilityManager {
31
31
  * in order to correctly position this editor in the text flow.
32
32
  * @param {HTMLElement} element
33
33
  * @param {boolean} isRemovable
34
+ * @returns {string|null} The id in the struct tree if any.
34
35
  */
35
- addPointerInTextLayer(element: HTMLElement, isRemovable: boolean): void;
36
+ addPointerInTextLayer(element: HTMLElement, isRemovable: boolean): string | null;
36
37
  /**
37
38
  * Move a div in the DOM in order to respect the visual order.
38
39
  * @param {HTMLDivElement} element
40
+ * @returns {string|null} The id in the struct tree if any.
39
41
  */
40
- moveElementInDOM(container: any, element: HTMLDivElement, contentElement: any, isRemovable: any): void;
42
+ moveElementInDOM(container: any, element: HTMLDivElement, contentElement: any, isRemovable: any): string | null;
41
43
  #private;
42
44
  }
@@ -38,11 +38,16 @@ export class TextLayerBuilder {
38
38
  textContentItemsStr: any[];
39
39
  renderingDone: boolean;
40
40
  textDivs: any[];
41
- textDivProperties: WeakMap<object, any>;
42
- textLayerRenderTask: any;
41
+ textDivProperties: WeakMap<WeakKey, any>;
42
+ textLayerRenderTask: import("../src/display/text_layer.js").TextLayerRenderTask | null;
43
43
  highlighter: any;
44
44
  accessibilityManager: any;
45
45
  isOffscreenCanvasSupported: boolean;
46
+ /**
47
+ * Callback used to attach the textLayer to the DOM.
48
+ * @type {function}
49
+ */
50
+ onAppend: Function;
46
51
  div: HTMLDivElement;
47
52
  get numTextDivs(): number;
48
53
  /**
@@ -47,10 +47,10 @@ export type GetVisibleElementsParameters = {
47
47
  export const animationStarted: Promise<any>;
48
48
  /**
49
49
  * Converts API PageLayout values to the format used by `BaseViewer`.
50
- * @param {string} mode - The API PageLayout value.
50
+ * @param {string} layout - The API PageLayout value.
51
51
  * @returns {Object}
52
52
  */
53
- export function apiPageLayoutToViewerModes(layout: any): Object;
53
+ export function apiPageLayoutToViewerModes(layout: string): Object;
54
54
  /**
55
55
  * Converts API PageMode values to the format used by `PDFSidebar`.
56
56
  * NOTE: There's also a "FullScreen" parameter which is not possible to support,
@@ -157,7 +157,7 @@ export function getPageSizeInches({ view, userUnit, rotate }: GetPageSizeInchesP
157
157
  * rendering canvas. Earlier and later refer to index in `views`, not page
158
158
  * layout.)
159
159
  *
160
- * @param {GetVisibleElementsParameters}
160
+ * @param {GetVisibleElementsParameters} params
161
161
  * @returns {Object} `{ first, last, views: [{ id, x, y, view, percent }] }`
162
162
  */
163
163
  export function getVisibleElements({ scrollEl, views, sortByVisibility, horizontal, rtl, }: GetVisibleElementsParameters): Object;
@@ -168,10 +168,6 @@ export function isValidSpreadMode(mode: any): boolean;
168
168
  export const MAX_AUTO_SCALE: 1.25;
169
169
  export const MAX_SCALE: 10;
170
170
  export const MIN_SCALE: 0.1;
171
- /**
172
- * Event handler to suppress context menu.
173
- */
174
- export function noContextMenuHandler(evt: any): void;
175
171
  export function normalizeWheelEventDelta(evt: any): number;
176
172
  export function normalizeWheelEventDirection(evt: any): number;
177
173
  /**
@@ -193,10 +189,10 @@ export class OutputScale {
193
189
  }
194
190
  /**
195
191
  * Helper function to parse query string (e.g. ?param1=value&param2=...).
196
- * @param {string}
192
+ * @param {string} query
197
193
  * @returns {Map}
198
194
  */
199
- export function parseQueryString(query: any): Map<any, any>;
195
+ export function parseQueryString(query: string): Map<any, any>;
200
196
  export namespace PresentationModeState {
201
197
  let UNKNOWN: number;
202
198
  let NORMAL: number;
@@ -1,16 +1,15 @@
1
1
  export type PDFPageProxy = import("../src/display/api").PDFPageProxy;
2
+ export type AnnotationStorage = import("../src/display/annotation_storage").AnnotationStorage;
2
3
  export type PageViewport = import("../src/display/display_utils").PageViewport;
3
4
  export type IPDFLinkService = import("./interfaces").IPDFLinkService;
4
5
  export type XfaLayerBuilderOptions = {
5
- pageDiv: HTMLDivElement;
6
6
  pdfPage: PDFPageProxy;
7
- annotationStorage?: any;
7
+ annotationStorage?: import("../src/display/annotation_storage").AnnotationStorage | undefined;
8
8
  linkService: IPDFLinkService;
9
9
  xfaHtml?: Object | undefined;
10
10
  };
11
11
  /**
12
12
  * @typedef {Object} XfaLayerBuilderOptions
13
- * @property {HTMLDivElement} pageDiv
14
13
  * @property {PDFPageProxy} pdfPage
15
14
  * @property {AnnotationStorage} [annotationStorage]
16
15
  * @property {IPDFLinkService} linkService
@@ -20,10 +19,9 @@ export class XfaLayerBuilder {
20
19
  /**
21
20
  * @param {XfaLayerBuilderOptions} options
22
21
  */
23
- constructor({ pageDiv, pdfPage, annotationStorage, linkService, xfaHtml, }: XfaLayerBuilderOptions);
24
- pageDiv: HTMLDivElement;
22
+ constructor({ pdfPage, annotationStorage, linkService, xfaHtml, }: XfaLayerBuilderOptions);
25
23
  pdfPage: import("../src/display/api").PDFPageProxy;
26
- annotationStorage: any;
24
+ annotationStorage: import("../src/display/annotation_storage").AnnotationStorage;
27
25
  linkService: import("./interfaces").IPDFLinkService;
28
26
  xfaHtml: Object;
29
27
  div: HTMLDivElement | null;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "unpdf",
3
3
  "type": "module",
4
- "version": "0.7.1",
5
- "packageManager": "pnpm@8.7.0",
4
+ "version": "0.8.0",
5
+ "packageManager": "pnpm@8.10.2",
6
6
  "description": "Utilities to work with PDFs in Node.js, browser and workers",
7
7
  "author": "Johann Schopplich <pkg@johannschopplich.com>",
8
8
  "license": "MIT",
@@ -55,10 +55,10 @@
55
55
  "build": "unbuild && node scripts/post-build.mjs",
56
56
  "build:pdfjs": "rollup --config pdfjs.rollup.config.ts --configPlugin typescript && cp -R node_modules/pdfjs-dist/types dist",
57
57
  "dev": "unbuild --stub",
58
- "lint": "eslint \"**/*.ts\" --ignore-path .gitignore",
58
+ "lint": "eslint \"**/*.{cjs,mjs,ts}\" --ignore-path .gitignore",
59
59
  "lint:fix": "npm run lint -- --fix",
60
- "format": "prettier \"**/*.{css,html,json,md,mjs,ts,vue,yml}\" --write",
61
- "format:check": "prettier \"**/*.{css,html,json,md,mjs,ts,vue,yml}\" --check",
60
+ "format": "prettier \"**/*.{json,md,cjs,mjs,ts,yml}\" --write",
61
+ "format:check": "prettier \"**/*.{json,md,cjs,mjs,ts,yml}\" --check",
62
62
  "release": "bumpp --commit --push --tag",
63
63
  "test": "vitest",
64
64
  "test:types": "tsc --noEmit"
@@ -67,22 +67,22 @@
67
67
  "canvas": "^2.11.2"
68
68
  },
69
69
  "devDependencies": {
70
- "@rollup/plugin-alias": "^5.0.0",
71
- "@rollup/plugin-commonjs": "^25.0.4",
72
- "@rollup/plugin-inject": "^5.0.3",
73
- "@rollup/plugin-node-resolve": "^15.2.1",
74
- "@rollup/plugin-replace": "^5.0.2",
75
- "@rollup/plugin-terser": "^0.4.3",
76
- "@rollup/plugin-typescript": "^11.1.3",
77
- "@types/node": "^20.5.7",
70
+ "@rollup/plugin-alias": "^5.0.1",
71
+ "@rollup/plugin-commonjs": "^25.0.7",
72
+ "@rollup/plugin-inject": "^5.0.5",
73
+ "@rollup/plugin-node-resolve": "^15.2.3",
74
+ "@rollup/plugin-replace": "^5.0.5",
75
+ "@rollup/plugin-terser": "^0.4.4",
76
+ "@rollup/plugin-typescript": "^11.1.5",
77
+ "@types/node": "^20.9.0",
78
78
  "bumpp": "^9.2.0",
79
- "eslint": "^8.48.0",
79
+ "eslint": "^8.53.0",
80
80
  "eslint-config-unjs": "^0.2.1",
81
- "fast-glob": "^3.3.1",
82
- "pdfjs-dist": "^3.10.111",
83
- "prettier": "^3.0.2",
81
+ "fast-glob": "^3.3.2",
82
+ "pdfjs-dist": "^4.0.189",
83
+ "prettier": "^3.0.3",
84
84
  "rollup": "^3.28.1",
85
- "typescript": "^5.1.6",
85
+ "typescript": "^5.2.2",
86
86
  "unbuild": "^2.0.0",
87
87
  "unenv": "^1.7.4",
88
88
  "vitest": "^0.34.3"
File without changes