unpdf 1.8.0 → 1.9.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 (94) hide show
  1. package/README.md +1 -1
  2. package/dist/index.cjs +1 -1
  3. package/dist/index.d.cts +15 -15
  4. package/dist/index.d.mts +15 -15
  5. package/dist/index.mjs +1 -1
  6. package/dist/pdfjs.mjs +37 -37
  7. package/dist/types/external/qcms/qcms.d.ts +11 -7
  8. package/dist/types/external/qcms/qcms_utils.d.ts +1 -6
  9. package/dist/types/src/core/base_stream.d.ts +8 -1
  10. package/dist/types/src/core/catalog.d.ts +12 -12
  11. package/dist/types/src/core/colorspace.d.ts +6 -15
  12. package/dist/types/src/core/core_utils.d.ts +18 -14
  13. package/dist/types/src/core/crypto.d.ts +0 -1
  14. package/dist/types/src/core/file_spec.d.ts +4 -9
  15. package/dist/types/src/core/icc_colorspace.d.ts +0 -1
  16. package/dist/types/src/core/image_resizer.d.ts +24 -0
  17. package/dist/types/src/core/image_utils.d.ts +4 -4
  18. package/dist/types/src/core/jpeg_stream.d.ts +1 -1
  19. package/dist/types/src/core/jpg.d.ts +9 -13
  20. package/dist/types/src/core/parser.d.ts +0 -2
  21. package/dist/types/src/core/pattern.d.ts +0 -2
  22. package/dist/types/src/core/primitives.d.ts +30 -16
  23. package/dist/types/src/core/sasl_prep.d.ts +1 -0
  24. package/dist/types/src/core/sound.d.ts +39 -0
  25. package/dist/types/src/core/string_utils.d.ts +1 -1
  26. package/dist/types/src/core/struct_tree.d.ts +3 -3
  27. package/dist/types/src/core/xml_parser.d.ts +1 -2
  28. package/dist/types/src/core/xref.d.ts +2 -15
  29. package/dist/types/src/display/annotation_layer.d.ts +9 -20
  30. package/dist/types/src/display/annotation_storage.d.ts +7 -7
  31. package/dist/types/src/display/api.d.ts +155 -108
  32. package/dist/types/src/display/canvas.d.ts +2 -1
  33. package/dist/types/src/display/canvas_dependency_tracker.d.ts +8 -3
  34. package/dist/types/src/display/content_disposition.d.ts +0 -1
  35. package/dist/types/src/display/display_utils.d.ts +2 -2
  36. package/dist/types/src/display/draw_layer.d.ts +2 -6
  37. package/dist/types/src/display/editor/annotation_editor_layer.d.ts +18 -19
  38. package/dist/types/src/display/editor/color_picker.d.ts +1 -1
  39. package/dist/types/src/display/editor/comment.d.ts +1 -1
  40. package/dist/types/src/display/editor/draw.d.ts +78 -27
  41. package/dist/types/src/display/editor/drawers/freedraw.d.ts +11 -9
  42. package/dist/types/src/display/editor/drawers/highlight.d.ts +99 -15
  43. package/dist/types/src/display/editor/drawers/inkdraw.d.ts +7 -2
  44. package/dist/types/src/display/editor/drawers/outline.d.ts +65 -2
  45. package/dist/types/src/display/editor/editor.d.ts +24 -22
  46. package/dist/types/src/display/editor/freetext.d.ts +1 -1
  47. package/dist/types/src/display/editor/highlight.d.ts +44 -35
  48. package/dist/types/src/display/editor/ink.d.ts +7 -2
  49. package/dist/types/src/display/editor/stamp.d.ts +1 -1
  50. package/dist/types/src/display/editor/tools.d.ts +21 -19
  51. package/dist/types/src/display/filter_factory.d.ts +1 -3
  52. package/dist/types/src/display/font_loader.d.ts +1 -15
  53. package/dist/types/src/display/network_utils.d.ts +1 -0
  54. package/dist/types/src/display/obj_bin_transform_display.d.ts +25 -38
  55. package/dist/types/src/display/page_viewport.d.ts +5 -5
  56. package/dist/types/src/display/pages_mapper.d.ts +10 -4
  57. package/dist/types/src/display/pattern_helper.d.ts +4 -3
  58. package/dist/types/src/display/pdf_objects.d.ts +1 -3
  59. package/dist/types/src/display/text_layer.d.ts +2 -0
  60. package/dist/types/src/display/touch_manager.d.ts +46 -9
  61. package/dist/types/src/display/worker_options.d.ts +2 -2
  62. package/dist/types/src/display/xfa_layer.d.ts +7 -12
  63. package/dist/types/src/display/xfa_text.d.ts +2 -5
  64. package/dist/types/src/pdf.d.ts +2 -1
  65. package/dist/types/src/shared/base_pdf_stream.d.ts +6 -7
  66. package/dist/types/src/shared/css_utils.d.ts +8 -0
  67. package/dist/types/src/shared/message_handler.d.ts +2 -11
  68. package/dist/types/src/shared/obj_bin_transform_utils.d.ts +4 -3
  69. package/dist/types/src/shared/util.d.ts +4 -6
  70. package/dist/types/web/annotation_editor_layer_builder.d.ts +5 -3
  71. package/dist/types/web/annotation_layer_builder.d.ts +8 -12
  72. package/dist/types/web/draw_layer_builder.d.ts +7 -9
  73. package/dist/types/web/event_utils.d.ts +12 -13
  74. package/dist/types/web/genericl10n.d.ts +2 -2
  75. package/dist/types/web/l10n.d.ts +1 -1
  76. package/dist/types/web/pdf_find_controller.d.ts +5 -6
  77. package/dist/types/web/pdf_find_utils.d.ts +8 -14
  78. package/dist/types/web/pdf_history.d.ts +1 -1
  79. package/dist/types/web/pdf_link_service.d.ts +5 -7
  80. package/dist/types/web/pdf_page_view.d.ts +3 -3
  81. package/dist/types/web/pdf_rendering_queue.d.ts +4 -5
  82. package/dist/types/web/pdf_scripting_manager.d.ts +4 -4
  83. package/dist/types/web/pdf_thumbnail_view.d.ts +2 -2
  84. package/dist/types/web/pdf_thumbnail_viewer.d.ts +14 -15
  85. package/dist/types/web/pdf_viewer.d.ts +36 -16
  86. package/dist/types/web/renderable_view.d.ts +1 -1
  87. package/dist/types/web/sidebar.d.ts +3 -3
  88. package/dist/types/web/struct_tree_layer_builder.d.ts +20 -6
  89. package/dist/types/web/text_accessibility.d.ts +4 -2
  90. package/dist/types/web/text_highlighter.d.ts +1 -2
  91. package/dist/types/web/text_layer_builder.d.ts +5 -5
  92. package/dist/types/web/ui_utils.d.ts +8 -13
  93. package/dist/types/web/xfa_layer_builder.d.ts +7 -7
  94. package/package.json +11 -11
@@ -33,7 +33,7 @@ export namespace FindState {
33
33
  export function getOriginalIndex(diffs: any, pos: any, len: any): any[];
34
34
  export function normalize(text: any, options?: {}): any[];
35
35
  /**
36
- * @typedef {Object} PDFFindControllerOptions
36
+ * @typedef {object} PDFFindControllerOptions
37
37
  * @property {PDFLinkService} linkService - The navigation/linking service.
38
38
  * @property {EventBus} eventBus - The application event bus.
39
39
  * @property {number} [delay] - The number of milliseconds to delay execution of
@@ -56,7 +56,7 @@ export class PDFFindController {
56
56
  _eventBus: import("./event_utils.js").EventBus;
57
57
  /**
58
58
  * Callback used to check if a `pageNumber` is currently visible.
59
- * @type {function}
59
+ * @type {Function}
60
60
  */
61
61
  onIsPageVisible: Function;
62
62
  get highlightMatches(): boolean | undefined;
@@ -70,7 +70,6 @@ export class PDFFindController {
70
70
  /**
71
71
  * Set a reference to the PDF document in order to search it.
72
72
  * Note that searching is not possible if this method is not called.
73
- *
74
73
  * @param {PDFDocumentProxy} pdfDocument - The PDF document to search.
75
74
  */
76
75
  setDocument(pdfDocument: PDFDocumentProxy): void;
@@ -79,14 +78,14 @@ export class PDFFindController {
79
78
  _findTimeout: any;
80
79
  _highlightMatches: boolean | undefined;
81
80
  /**
82
- * @typedef {Object} PDFFindControllerScrollMatchIntoViewParams
81
+ * @typedef {object} PDFFindControllerScrollMatchIntoViewParams
83
82
  * @property {HTMLElement} element
84
83
  * @property {number} pageIndex
85
84
  * @property {number} matchIndex
86
85
  */
87
86
  /**
88
87
  * Scroll the current match into view.
89
- * @param {PDFFindControllerScrollMatchIntoViewParams}
88
+ * @param {PDFFindControllerScrollMatchIntoViewParams} params
90
89
  */
91
90
  scrollMatchIntoView({ element, pageIndex, matchIndex }: {
92
91
  element: HTMLElement;
@@ -116,7 +115,7 @@ export class PDFFindController {
116
115
  _firstPageCapability: any;
117
116
  _rawQuery: any;
118
117
  /**
119
- * @typedef {Object} FindMatch
118
+ * @typedef {object} FindMatch
120
119
  * @property {number} index - The start of the matched text in the page's
121
120
  * string contents.
122
121
  * @property {number} length - The length of the matched text.
@@ -1,16 +1,10 @@
1
- export namespace CharacterType {
2
- let SPACE: number;
3
- let ALPHA_LETTER: number;
4
- let PUNCT: number;
5
- let HAN_LETTER: number;
6
- let KATAKANA_LETTER: number;
7
- let HIRAGANA_LETTER: number;
8
- let HALFWIDTH_KATAKANA_LETTER: number;
9
- let THAI_LETTER: number;
10
- }
1
+ export function getNormalizeWithNFKC(): any;
11
2
  /**
12
- * This function is based on the word-break detection implemented in:
13
- * https://hg.mozilla.org/mozilla-central/file/tip/intl/lwbrk/WordBreaker.cpp
3
+ * Determine if the match spanning `[startIdx, startIdx + length)` in `content`
4
+ * is a whole word, i.e. there's a word break on each side of it. Each boundary
5
+ * is tested on its two adjacent characters in isolation rather than on the
6
+ * whole string, so a contraction such as "can't" doesn't prevent "can" from
7
+ * being an entire word, matching Firefox's find:
8
+ * https://searchfox.org/firefox-main/source/toolkit/components/find/nsFind.cpp
14
9
  */
15
- export function getCharacterType(charCode: any): number;
16
- export function getNormalizeWithNFKC(): any;
10
+ export function isEntireWord(content: any, startIdx: any, length: any): boolean;
@@ -82,7 +82,7 @@ export class PDFHistory {
82
82
  _updateViewareaTimeout: any;
83
83
  /**
84
84
  * Push an internal destination to the browser history.
85
- * @param {PushParameters}
85
+ * @param {PushParameters} params
86
86
  */
87
87
  push({ namedDest, explicitDest, pageNumber }: PushParameters): void;
88
88
  /**
@@ -30,7 +30,7 @@ export namespace LinkTarget {
30
30
  let TOP: number;
31
31
  }
32
32
  /**
33
- * @typedef {Object} PDFLinkServiceOptions
33
+ * @typedef {object} PDFLinkServiceOptions
34
34
  * @property {EventBus} eventBus - The application event bus.
35
35
  * @property {number} [externalLinkTarget] - Specifies the `target` attribute
36
36
  * for external links. Must use one of the values from {LinkTarget}.
@@ -88,13 +88,11 @@ export class PDFLinkService {
88
88
  get isInPresentationMode(): boolean;
89
89
  /**
90
90
  * This method will, when available, also update the browser history.
91
- *
92
91
  * @param {string|Array} dest - The named, or explicit, PDF destination.
93
92
  */
94
93
  goToDestination(dest: string | any[]): Promise<void>;
95
94
  /**
96
95
  * This method will, when available, also update the browser history.
97
- *
98
96
  * @param {number|string} val - The page number, or page label.
99
97
  */
100
98
  goToPage(val: number | string): void;
@@ -103,9 +101,9 @@ export class PDFLinkService {
103
101
  * @param {number} pageNumber - The page number to scroll to.
104
102
  * @param {number} x - The x-coordinate to scroll to in page coordinates.
105
103
  * @param {number} y - The y-coordinate to scroll to in page coordinates.
106
- * @param {Object} [options]
104
+ * @param {object} [options]
107
105
  */
108
- goToXY(pageNumber: number, x: number, y: number, options?: Object): void;
106
+ goToXY(pageNumber: number, x: number, y: number, options?: object): void;
109
107
  /**
110
108
  * @param {string} id
111
109
  * Unique attachment identifier (required).
@@ -141,9 +139,9 @@ export class PDFLinkService {
141
139
  */
142
140
  executeNamedAction(action: string): void;
143
141
  /**
144
- * @param {Object} action
142
+ * @param {object} action
145
143
  */
146
- executeSetOCGState(action: Object): Promise<void>;
144
+ executeSetOCGState(action: object): Promise<void>;
147
145
  }
148
146
  export class SimpleLinkService extends PDFLinkService {
149
147
  }
@@ -105,7 +105,7 @@ export type PDFPageViewOptions = {
105
105
  * with user defined ones in order to improve readability in high contrast
106
106
  * mode.
107
107
  */
108
- pageColors?: Object | undefined;
108
+ pageColors?: object | undefined;
109
109
  /**
110
110
  * - Localization service.
111
111
  */
@@ -114,7 +114,7 @@ export type PDFPageViewOptions = {
114
114
  * - The object that is used to lookup
115
115
  * the necessary layer-properties.
116
116
  */
117
- layerProperties?: Object | undefined;
117
+ layerProperties?: object | undefined;
118
118
  /**
119
119
  * - Enable creation of hyperlinks from
120
120
  * text that look like URLs. The default value is `true`.
@@ -175,7 +175,7 @@ export class PDFPageView extends BasePDFPageView {
175
175
  toggleEditingMode(isEditing: any): void;
176
176
  updateVisibleArea(visibleArea: any): void;
177
177
  /**
178
- * @typedef {Object} PDFPageViewUpdateParameters
178
+ * @typedef {object} PDFPageViewUpdateParameters
179
179
  * @property {number} [scale] The new scale, if specified.
180
180
  * @property {number} [rotation] The new rotation, if specified.
181
181
  * @property {Promise<OptionalContentConfig>} [optionalContentConfigPromise]
@@ -22,17 +22,17 @@ export class PDFRenderingQueue {
22
22
  */
23
23
  isHighestPriority(view: RenderableView): boolean;
24
24
  /**
25
- * @param {Object} currentlyVisiblePages
25
+ * @param {object} currentlyVisiblePages
26
26
  */
27
- renderHighestPriority(currentlyVisiblePages: Object): void;
27
+ renderHighestPriority(currentlyVisiblePages: object): void;
28
28
  /**
29
- * @param {Object} visible
29
+ * @param {object} visible
30
30
  * @param {Array} views
31
31
  * @param {boolean} scrolledDown
32
32
  * @param {boolean} [preRenderExtra]
33
33
  * @param {boolean} [ignoreDetailViews]
34
34
  */
35
- getHighestPriority(visible: Object, views: any[], scrolledDown: boolean, preRenderExtra?: boolean, ignoreDetailViews?: boolean): any;
35
+ getHighestPriority(visible: object, views: any[], scrolledDown: boolean, preRenderExtra?: boolean, ignoreDetailViews?: boolean): any;
36
36
  /**
37
37
  * @param {RenderableView} view
38
38
  * @returns {boolean}
@@ -42,7 +42,6 @@ export class PDFRenderingQueue {
42
42
  * Render a page or thumbnail view. This calls the appropriate function
43
43
  * based on the views state. If the view is already rendered it will return
44
44
  * `false`.
45
- *
46
45
  * @param {RenderableView} view
47
46
  */
48
47
  renderView(view: RenderableView): boolean;
@@ -14,7 +14,7 @@ export type PDFScriptingManagerOptions = {
14
14
  * initializing scripting; must contain a `createScripting` method.
15
15
  * PLEASE NOTE: Primarily intended for the default viewer use-case.
16
16
  */
17
- externalServices?: Object | undefined;
17
+ externalServices?: object | undefined;
18
18
  /**
19
19
  * - The function that is used to lookup
20
20
  * the necessary document properties.
@@ -22,14 +22,14 @@ export type PDFScriptingManagerOptions = {
22
22
  docProperties?: Function | undefined;
23
23
  };
24
24
  /**
25
- * @typedef {Object} PDFScriptingManagerOptions
25
+ * @typedef {object} PDFScriptingManagerOptions
26
26
  * @property {EventBus} eventBus - The application event bus.
27
27
  * @property {string} [sandboxBundleSrc] - The path and filename of the
28
28
  * scripting bundle.
29
- * @property {Object} [externalServices] - The factory that is used when
29
+ * @property {object} [externalServices] - The factory that is used when
30
30
  * initializing scripting; must contain a `createScripting` method.
31
31
  * PLEASE NOTE: Primarily intended for the default viewer use-case.
32
- * @property {function} [docProperties] - The function that is used to lookup
32
+ * @property {Function} [docProperties] - The function that is used to lookup
33
33
  * the necessary document properties.
34
34
  */
35
35
  export class PDFScriptingManager {
@@ -46,7 +46,7 @@ export type PDFThumbnailViewOptions = {
46
46
  * with user defined ones in order to improve readability in high contrast
47
47
  * mode.
48
48
  */
49
- pageColors?: Object | undefined;
49
+ pageColors?: object | undefined;
50
50
  };
51
51
  export type OptionalContentConfig = import("../src/display/optional_content_config.js").OptionalContentConfig;
52
52
  export type PageViewport = import("../src/display/page_viewport.js").PageViewport;
@@ -66,7 +66,7 @@ export class PDFThumbnailView extends RenderableView {
66
66
  _optionalContentConfigPromise: Promise<import("../src/display/optional_content_config.js").OptionalContentConfig> | null;
67
67
  maxCanvasPixels: any;
68
68
  maxCanvasDim: any;
69
- pageColors: Object | null;
69
+ pageColors: object | null;
70
70
  eventBus: import("./event_utils.js").EventBus;
71
71
  linkService: PDFLinkService;
72
72
  renderingQueue: import("./pdf_rendering_queue.js").PDFRenderingQueue;
@@ -38,7 +38,7 @@ export type PDFThumbnailViewerOptions = {
38
38
  * with user defined ones in order to improve readability in high contrast
39
39
  * mode.
40
40
  */
41
- pageColors?: Object | undefined;
41
+ pageColors?: object | undefined;
42
42
  /**
43
43
  * - The AbortSignal for the window
44
44
  * events.
@@ -63,30 +63,30 @@ export type PDFThumbnailViewerOptions = {
63
63
  * - The status bar elements to manage the status
64
64
  * label and action when editing pages.
65
65
  */
66
- statusBar?: Object | undefined;
66
+ statusBar?: object | undefined;
67
67
  /**
68
68
  * - The undo bar elements to manage the undo
69
69
  * action.
70
70
  */
71
- undoBar?: Object | undefined;
71
+ undoBar?: object | undefined;
72
72
  /**
73
73
  * - The menu elements to manage saving edited
74
74
  * PDF.
75
75
  */
76
- manageMenu?: Object | undefined;
76
+ manageMenu?: object | undefined;
77
77
  /**
78
78
  * - The waiting bar elements shown during
79
79
  * long-running operations.
80
80
  */
81
- waitingBar?: Object | undefined;
81
+ waitingBar?: object | undefined;
82
82
  /**
83
83
  * - The file picker and button used to
84
84
  * add one or more PDF files to merge with the current one.
85
85
  */
86
- addFileComponent?: Object | undefined;
86
+ addFileComponent?: object | undefined;
87
87
  };
88
88
  /**
89
- * @typedef {Object} PDFThumbnailViewerOptions
89
+ * @typedef {object} PDFThumbnailViewerOptions
90
90
  * @property {HTMLDivElement} container - The container for the thumbnail
91
91
  * elements.
92
92
  * @property {EventBus} eventBus - The application event bus.
@@ -98,7 +98,7 @@ export type PDFThumbnailViewerOptions = {
98
98
  * @property {number} [maxCanvasDim] - The maximum supported canvas dimension,
99
99
  * in either width or height. Use `-1` for no limit.
100
100
  * The default value is 32767.
101
- * @property {Object} [pageColors] - Overwrites background and foreground colors
101
+ * @property {object} [pageColors] - Overwrites background and foreground colors
102
102
  * with user defined ones in order to improve readability in high contrast
103
103
  * mode.
104
104
  * @property {AbortSignal} [abortSignal] - The AbortSignal for the window
@@ -109,15 +109,15 @@ export type PDFThumbnailViewerOptions = {
109
109
  * The default value is `false`.
110
110
  * @property {boolean} [enableSplitMerge] - Enables split and merge features.
111
111
  * The default value is `false`.
112
- * @property {Object} [statusBar] - The status bar elements to manage the status
112
+ * @property {object} [statusBar] - The status bar elements to manage the status
113
113
  * label and action when editing pages.
114
- * @property {Object} [undoBar] - The undo bar elements to manage the undo
114
+ * @property {object} [undoBar] - The undo bar elements to manage the undo
115
115
  * action.
116
- * @property {Object} [manageMenu] - The menu elements to manage saving edited
116
+ * @property {object} [manageMenu] - The menu elements to manage saving edited
117
117
  * PDF.
118
- * @property {Object} [waitingBar] - The waiting bar elements shown during
118
+ * @property {object} [waitingBar] - The waiting bar elements shown during
119
119
  * long-running operations.
120
- * @property {Object} [addFileComponent] - The file picker and button used to
120
+ * @property {object} [addFileComponent] - The file picker and button used to
121
121
  * add one or more PDF files to merge with the current one.
122
122
  */
123
123
  /**
@@ -145,14 +145,13 @@ export class PDFThumbnailViewer {
145
145
  renderingQueue: import("./pdf_rendering_queue.js").PDFRenderingQueue;
146
146
  maxCanvasPixels: number | undefined;
147
147
  maxCanvasDim: number | undefined;
148
- pageColors: Object | null;
148
+ pageColors: object | null;
149
149
  _manageMenu: Menu | undefined;
150
150
  scroll: {
151
151
  right: boolean;
152
152
  down: boolean;
153
153
  lastX: any;
154
154
  lastY: any;
155
- _eventHandler: (evt: any) => void;
156
155
  };
157
156
  getThumbnail(index: any): any;
158
157
  _currentPageNumber: any;
@@ -143,7 +143,7 @@ export type PDFViewerOptions = {
143
143
  * with user defined ones in order to improve readability in high contrast
144
144
  * mode.
145
145
  */
146
- pageColors?: Object | undefined;
146
+ pageColors?: object | undefined;
147
147
  /**
148
148
  * - Enable zooming on pinch gesture.
149
149
  * The default value is `true`.
@@ -166,7 +166,7 @@ export namespace PagesCountLimit {
166
166
  let PAUSE_EAGER_PAGE_INIT: number;
167
167
  }
168
168
  /**
169
- * @typedef {Object} PDFViewerOptions
169
+ * @typedef {object} PDFViewerOptions
170
170
  * @property {HTMLDivElement} container - The container for the viewer element.
171
171
  * @property {HTMLDivElement} [viewer] - The viewer element.
172
172
  * @property {EventBus} eventBus - The application event bus.
@@ -224,7 +224,7 @@ export namespace PagesCountLimit {
224
224
  * @property {L10n} [l10n] - Localization service.
225
225
  * @property {boolean} [enablePermissions] - Enables PDF document permissions,
226
226
  * when they exist. The default value is `false`.
227
- * @property {Object} [pageColors] - Overwrites background and foreground colors
227
+ * @property {object} [pageColors] - Overwrites background and foreground colors
228
228
  * with user defined ones in order to improve readability in high contrast
229
229
  * mode.
230
230
  * @property {boolean} [supportsPinchToZoom] - Enable zooming on pinch gesture.
@@ -275,7 +275,7 @@ export class PDFViewer {
275
275
  enableSelectionRendering: boolean;
276
276
  imagesRightClickMinSize: number;
277
277
  l10n: import("./l10n.js").L10n | undefined;
278
- pageColors: Object | null;
278
+ pageColors: object | null;
279
279
  defaultRenderingQueue: boolean;
280
280
  renderingQueue: PDFRenderingQueue | undefined;
281
281
  scroll: {
@@ -283,7 +283,6 @@ export class PDFViewer {
283
283
  down: boolean;
284
284
  lastX: any;
285
285
  lastY: any;
286
- _eventHandler: (evt: any) => void;
287
286
  };
288
287
  presentationModeState: number;
289
288
  get printingAllowed(): boolean;
@@ -338,7 +337,8 @@ export class PDFViewer {
338
337
  */
339
338
  get currentScale(): number;
340
339
  /**
341
- * @param val - The scale of the pages (in percent or predefined value).
340
+ * @param {string} val - The scale of the pages (in percent or predefined
341
+ * value).
342
342
  */
343
343
  set currentScaleValue(val: string);
344
344
  /**
@@ -360,10 +360,10 @@ export class PDFViewer {
360
360
  get _layerProperties(): any;
361
361
  getAllText(interruptSignal?: null): Promise<string | null>;
362
362
  /**
363
- * @param {PDFDocumentProxy} pdfDocument
363
+ * @param {PDFDocumentProxy|null} pdfDocument
364
364
  */
365
- setDocument(pdfDocument: PDFDocumentProxy): void;
366
- pdfDocument: import("../src/display/api.js").PDFDocumentProxy | undefined;
365
+ setDocument(pdfDocument: PDFDocumentProxy | null): void;
366
+ pdfDocument: import("../src/display/api.js").PDFDocumentProxy | null | undefined;
367
367
  _scrollMode: any;
368
368
  _optionalContentConfigPromise: Promise<import("../src/display/optional_content_config.js").OptionalContentConfig> | null | undefined;
369
369
  onPagesEdited({ pagesMapper, type, hasBeenCut, pageNumbers }: {
@@ -384,8 +384,8 @@ export class PDFViewer {
384
384
  _location: {
385
385
  pageNumber: any;
386
386
  scale: any;
387
- top: number;
388
- left: number;
387
+ top: any;
388
+ left: any;
389
389
  rotation: any;
390
390
  pdfOpenParams: string;
391
391
  } | null | undefined;
@@ -395,6 +395,13 @@ export class PDFViewer {
395
395
  _previousScrollMode: any;
396
396
  _spreadMode: any;
397
397
  _scrollUpdate(): void;
398
+ /**
399
+ * Scroll the viewer by the given gesture deltas: like `GrabToPan` does, the
400
+ * content follows the gesture.
401
+ * @param {number} dx - Horizontal delta.
402
+ * @param {number} dy - Vertical delta.
403
+ */
404
+ panBy(dx: number, dy: number): void;
398
405
  /**
399
406
  * @param {string} label - The page label.
400
407
  * @returns {number|null} The page number corresponding to the page label,
@@ -402,7 +409,7 @@ export class PDFViewer {
402
409
  */
403
410
  pageLabelToPageNumber(label: string): number | null;
404
411
  /**
405
- * @typedef {Object} ScrollPageIntoViewParameters
412
+ * @typedef {object} ScrollPageIntoViewParameters
406
413
  * @property {number} pageNumber - The page number.
407
414
  * @property {Array} [destArray] - The original PDF destination array, in the
408
415
  * format: <page-ref> </XYZ|/FitXXX> <args..>
@@ -454,7 +461,7 @@ export class PDFViewer {
454
461
  get isChangingPresentationMode(): boolean;
455
462
  get isHorizontalScrollbarEnabled(): boolean;
456
463
  get isVerticalScrollbarEnabled(): boolean;
457
- _getVisiblePages(): Object;
464
+ _getVisiblePages(): object;
458
465
  cleanup(): void;
459
466
  /**
460
467
  * @private
@@ -513,18 +520,19 @@ export class PDFViewer {
513
520
  */
514
521
  previousPage(): boolean;
515
522
  /**
516
- * @typedef {Object} ChangeScaleOptions
523
+ * @typedef {object} ChangeScaleOptions
517
524
  * @property {number} [drawingDelay]
518
525
  * @property {number} [scaleFactor]
519
526
  * @property {number} [steps]
520
527
  * @property {Array} [origin] x and y coordinates of the scale
521
528
  * transformation origin.
529
+ * @property {Array<number>} [pan] - Horizontal and vertical gesture deltas.
522
530
  */
523
531
  /**
524
532
  * Changes the current zoom level by the specified amount.
525
533
  * @param {ChangeScaleOptions} [options]
526
534
  */
527
- updateScale({ drawingDelay, scaleFactor, steps, origin }?: {
535
+ updateScale({ drawingDelay, scaleFactor, steps, origin, pan, }?: {
528
536
  drawingDelay?: number | undefined;
529
537
  scaleFactor?: number | undefined;
530
538
  steps?: number | undefined;
@@ -533,6 +541,10 @@ export class PDFViewer {
533
541
  * transformation origin.
534
542
  */
535
543
  origin?: any[] | undefined;
544
+ /**
545
+ * - Horizontal and vertical gesture deltas.
546
+ */
547
+ pan?: number[] | undefined;
536
548
  }): void;
537
549
  /**
538
550
  * Increase the current zoom level one, or more, times.
@@ -547,6 +559,10 @@ export class PDFViewer {
547
559
  * transformation origin.
548
560
  */
549
561
  origin?: any[] | undefined;
562
+ /**
563
+ * - Horizontal and vertical gesture deltas.
564
+ */
565
+ pan?: number[] | undefined;
550
566
  }): void;
551
567
  /**
552
568
  * Decrease the current zoom level one, or more, times.
@@ -561,10 +577,14 @@ export class PDFViewer {
561
577
  * transformation origin.
562
578
  */
563
579
  origin?: any[] | undefined;
580
+ /**
581
+ * - Horizontal and vertical gesture deltas.
582
+ */
583
+ pan?: number[] | undefined;
564
584
  }): void;
565
585
  get containerTopLeft(): number[];
566
586
  /**
567
- * @typedef {Object} AnnotationEditorModeOptions
587
+ * @typedef {object} AnnotationEditorModeOptions
568
588
  * @property {number} mode - The editor mode (none, FreeText, ink, ...).
569
589
  * @property {string|null} [editId] - ID of the existing annotation to edit.
570
590
  * @property {boolean} [isFromKeyboard] - True if the mode change is due to a
@@ -9,7 +9,7 @@ export class RenderableView {
9
9
  */
10
10
  renderTask: import("../src/display/api.js").RenderTask | null;
11
11
  /**
12
- * @type {function | null}
12
+ * @type {Function | null}
13
13
  */
14
14
  resume: Function | null;
15
15
  /**
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export class Sidebar {
5
5
  /**
6
- * @typedef {Object} SidebarElements
6
+ * @typedef {object} SidebarElements
7
7
  * @property {HTMLElement} sidebar - The sidebar element.
8
8
  * @property {HTMLElement} resizer - The sidebar resizer element.
9
9
  * @property {HTMLElement} toggleButton - The button used to toggle the
@@ -52,9 +52,9 @@ export class Sidebar {
52
52
  onStopResizing(): void;
53
53
  /**
54
54
  * Callback to be executed when the sidebar is being resized.
55
- * @param {number} newWidth - The new width of the sidebar in pixels.
55
+ * @param {number} _newWidth - The new width of the sidebar in pixels.
56
56
  */
57
- onResizing(_newWidth: any): void;
57
+ onResizing(_newWidth: number): void;
58
58
  /**
59
59
  * Toggle the sidebar's visibility.
60
60
  * @param {boolean} [visibility] - The visibility state to set.
@@ -1,23 +1,37 @@
1
1
  export type PDFPageProxy = import("../src/display/api.js").PDFPageProxy;
2
2
  export type StructTreeLayerBuilderOptions = {
3
3
  pdfPage: PDFPageProxy;
4
- rawDims: Object;
4
+ rawDims: object;
5
5
  };
6
6
  /**
7
- * @typedef {Object} StructTreeLayerBuilderOptions
7
+ * @typedef {object} StructTreeLayerBuilderOptions
8
8
  * @property {PDFPageProxy} pdfPage
9
- * @property {Object} rawDims
9
+ * @property {object} rawDims
10
10
  */
11
11
  export class StructTreeLayerBuilder {
12
12
  /**
13
- * @param {StructTreeLayerBuilderOptions} options
13
+ * @param {PDFPageProxy} pdfPage
14
+ * @param {object} rawDims
14
15
  */
15
- constructor(pdfPage: any, rawDims: any);
16
+ constructor(pdfPage: PDFPageProxy, rawDims: object);
16
17
  /**
17
18
  * @returns {Promise<void>}
18
19
  */
19
20
  render(): Promise<void>;
20
- getAriaAttributes(annotationId: any): Promise<any>;
21
+ /**
22
+ * @param {string} annotationId
23
+ * @param {object} [options]
24
+ * @param {boolean} [options.enableLinkOwnership]
25
+ * @returns {Promise<Map<string, string>|null|undefined>}
26
+ */
27
+ getAriaAttributes(annotationId: string, { enableLinkOwnership }?: {
28
+ enableLinkOwnership?: boolean | undefined;
29
+ }): Promise<Map<string, string> | null | undefined>;
30
+ /**
31
+ * Get the ids of annotations owned by the structure tree.
32
+ * @returns {Promise<Set<string>|null>}
33
+ */
34
+ getAnnotationIds(): Promise<Set<string> | null>;
21
35
  hide(): void;
22
36
  show(): void;
23
37
  updateTextLayer(): void;
@@ -9,7 +9,6 @@ export class TextAccessibilityManager {
9
9
  /**
10
10
  * Compare the positions of two elements, it must correspond to
11
11
  * the visual ordering.
12
- *
13
12
  * @param {HTMLElement} e1
14
13
  * @param {HTMLElement} e2
15
14
  * @returns {number}
@@ -36,9 +35,12 @@ export class TextAccessibilityManager {
36
35
  addPointerInTextLayer(element: HTMLElement, isRemovable: boolean): string | null;
37
36
  /**
38
37
  * Move a div in the DOM in order to respect the visual order.
38
+ * @param {HTMLElement} container
39
39
  * @param {HTMLDivElement} element
40
+ * @param {HTMLElement} contentElement
41
+ * @param {boolean} isRemovable
40
42
  * @returns {string|null} The id in the struct tree if any.
41
43
  */
42
- moveElementInDOM(container: any, element: HTMLDivElement, contentElement: any, isRemovable: any): string | null;
44
+ moveElementInDOM(container: HTMLElement, element: HTMLDivElement, contentElement: HTMLElement, isRemovable: boolean): string | null;
43
45
  #private;
44
46
  }
@@ -14,7 +14,7 @@ export type TextHighlighterOptions = {
14
14
  /** @typedef {import("./event_utils.js").EventBus} EventBus */
15
15
  /** @typedef {import("./pdf_find_controller.js").PDFFindController} PDFFindController */
16
16
  /**
17
- * @typedef {Object} TextHighlighterOptions
17
+ * @typedef {object} TextHighlighterOptions
18
18
  * @property {PDFFindController} findController
19
19
  * @property {EventBus} eventBus - The application event bus.
20
20
  * @property {number} pageIndex - The page index.
@@ -40,7 +40,6 @@ export class TextHighlighter {
40
40
  * The arrays should be of equal length and the array element at each index
41
41
  * should correspond to the other. e.g.
42
42
  * `items[0] = "<span>Item 0</span>" and texts[0] = "Item 0";
43
- *
44
43
  * @param {Array<Node>} divs
45
44
  * @param {Array<string>} texts
46
45
  */
@@ -18,23 +18,23 @@ export type TextLayerBuilderOptions = {
18
18
  export type TextLayerBuilderRenderOptions = {
19
19
  viewport: PageViewport;
20
20
  images: TextLayerImages;
21
- textContentParams?: Object | undefined;
21
+ textContentParams?: object | undefined;
22
22
  };
23
23
  /**
24
- * @typedef {Object} TextLayerBuilderOptions
24
+ * @typedef {object} TextLayerBuilderOptions
25
25
  * @property {PDFPageProxy} pdfPage
26
26
  * @property {TextHighlighter} [highlighter] - Optional object that will handle
27
27
  * highlighting text from the find controller.
28
28
  * @property {TextAccessibilityManager} [accessibilityManager]
29
29
  * @property {boolean} [enablePermissions]
30
- * @property {function} [onAppend]
30
+ * @property {Function} [onAppend]
31
31
  * @property {AbortSignal} [abortSignal]
32
32
  */
33
33
  /**
34
- * @typedef {Object} TextLayerBuilderRenderOptions
34
+ * @typedef {object} TextLayerBuilderRenderOptions
35
35
  * @property {PageViewport} viewport
36
36
  * @property {TextLayerImages} images
37
- * @property {Object} [textContentParams]
37
+ * @property {object} [textContentParams]
38
38
  */
39
39
  /**
40
40
  * The text layer builder provides text selection functionality for the PDF.