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
@@ -1,18 +1,81 @@
1
1
  export class Outline {
2
2
  static PRECISION: number;
3
+ /**
4
+ * Rotate a bounding box which lives in the unit square.
5
+ * @param {Array<number>} bbox
6
+ * @param {number} angle
7
+ * @returns {Array<number>}
8
+ */
9
+ static _rotateBox([x, y, width, height]: Array<number>, angle: number): Array<number>;
3
10
  static _rescale(src: any, tx: any, ty: any, sx: any, sy: any, dest: any): any;
4
11
  static _rescaleAndSwap(src: any, tx: any, ty: any, sx: any, sy: any, dest: any): any;
5
12
  static _translate(src: any, tx: any, ty: any, dest: any): any;
6
13
  static svgRound(x: any): number;
7
14
  static _normalizePoint(x: any, y: any, parentWidth: any, parentHeight: any, rotation: any): number[];
8
15
  static createBezierPoints(x1: any, y1: any, x2: any, y2: any, x3: any, y3: any): number[];
16
+ /** @type {Outline|null} Optional hover/selection outline drawn separately. */
17
+ focusOutline: Outline | null;
9
18
  /**
19
+ * @abstract
10
20
  * @returns {string} The SVG path of the outline.
11
21
  */
12
22
  toSVGPath(): string;
13
23
  /**
14
- * @type {Object|null} The bounding box of the outline.
24
+ * @type {object | null} The bounding box of the outline.
15
25
  */
16
- get box(): Object | null;
26
+ get box(): object | null;
17
27
  serialize(_bbox: any, _rotation: any): void;
28
+ /** @type {object} */
29
+ get defaultSVGProperties(): object;
30
+ /** @type {object} SVG properties used to finalize a drawing session. */
31
+ get defaultProperties(): object;
32
+ /**
33
+ * @param {number} _rotation - the rotation to apply to the outline.
34
+ * @returns {object | null}
35
+ */
36
+ getFocusSVGProperties(_rotation: number): object | null;
37
+ /** @type {boolean} Whether `DrawLayer.drawOutline` applies its mask. */
38
+ get focusMustRemoveSelfIntersections(): boolean;
39
+ /**
40
+ * @param {string} _name
41
+ * @param {*} _value
42
+ * @returns {Array<number>|Float32Array|null} The new bounding box, if any.
43
+ */
44
+ updateProperty(_name: string, _value: any): Array<number> | Float32Array | null;
45
+ /**
46
+ * @param {Array<number>} _dimensions
47
+ * @param {number} _scale
48
+ * @returns {Array<number>|Float32Array|null} The new bounding box, if any.
49
+ */
50
+ updateParentDimensions(_dimensions: Array<number>, _scale: number): Array<number> | Float32Array | null;
51
+ /**
52
+ * @param {Array<number>} _pageTranslation
53
+ * @param {Array<number>} _pageDimensions
54
+ * @returns {Float32Array|null}
55
+ */
56
+ serializeQuadPoints(_pageTranslation: Array<number>, _pageDimensions: Array<number>): Float32Array | null;
57
+ /**
58
+ * @param {number} _rotation
59
+ * @returns {object} the SVG properties to apply to the rotated shape.
60
+ */
61
+ updateRotation(_rotation: number): object;
62
+ /**
63
+ * Called on each resizing step, hence the outline itself is unchanged.
64
+ * @param {Array<number>} _bbox - the bounding box being resized to.
65
+ * @returns {object} the SVG properties to apply to the resizing shape.
66
+ */
67
+ getPathResizingSVGProperties(_bbox: Array<number>): object;
68
+ /**
69
+ * Called once the resizing is done, hence the outline can be updated.
70
+ * @param {Array<number>} _bbox - the new bounding box.
71
+ * @returns {object} the SVG properties to apply to the resized shape.
72
+ */
73
+ getPathResizedSVGProperties(_bbox: Array<number>): object;
74
+ /**
75
+ * Called once the translation is done, hence the outline can be updated.
76
+ * @param {Array<number>} _bbox - the new bounding box.
77
+ * @param {Array<number>} _parentDimensions
78
+ * @returns {object} the SVG properties to apply to the translated shape.
79
+ */
80
+ getPathTranslatedSVGProperties(_bbox: Array<number>, _parentDimensions: Array<number>): object;
18
81
  }
@@ -22,7 +22,7 @@ export type AnnotationEditorParameters = {
22
22
  y: number;
23
23
  };
24
24
  /**
25
- * @typedef {Object} AnnotationEditorParameters
25
+ * @typedef {object} AnnotationEditorParameters
26
26
  * @property {AnnotationEditorUIManager} uiManager - the global manager
27
27
  * @property {AnnotationEditorLayer} parent - the layer containing this editor
28
28
  * @property {string} id - editor id
@@ -46,9 +46,9 @@ export class AnnotationEditor {
46
46
  static deleteAnnotationElement(editor: any): void;
47
47
  /**
48
48
  * Initialize the l10n stuff for this type of editor.
49
- * @param {Object} l10n
49
+ * @param {object} l10n
50
50
  */
51
- static initialize(l10n: Object, _uiManager: any): void;
51
+ static initialize(l10n: object, _uiManager: any): void;
52
52
  /**
53
53
  * Update the default parameters for this type of editor.
54
54
  * @param {number} _type
@@ -79,13 +79,12 @@ export class AnnotationEditor {
79
79
  /**
80
80
  * Deserialize the editor.
81
81
  * The result of the deserialization is a new editor.
82
- *
83
- * @param {Object} data
82
+ * @param {object} data
84
83
  * @param {AnnotationEditorLayer} parent
85
84
  * @param {AnnotationEditorUIManager} uiManager
86
85
  * @returns {Promise<AnnotationEditor | null>}
87
86
  */
88
- static deserialize(data: Object, parent: AnnotationEditorLayer, uiManager: AnnotationEditorUIManager): Promise<AnnotationEditor | null>;
87
+ static deserialize(data: object, parent: AnnotationEditorLayer, uiManager: AnnotationEditorUIManager): Promise<AnnotationEditor | null>;
89
88
  static get MIN_SIZE(): number;
90
89
  static canCreateNewEmptyEditor(): boolean;
91
90
  /**
@@ -139,9 +138,9 @@ export class AnnotationEditor {
139
138
  center(): void;
140
139
  /**
141
140
  * Add some commands into the CommandManager (undo/redo stuff).
142
- * @param {Object} params
141
+ * @param {object} params
143
142
  */
144
- addCommands(params: Object): void;
143
+ addCommands(params: object): void;
145
144
  get currentLayer(): any;
146
145
  /**
147
146
  * This editor will be behind the others.
@@ -421,18 +420,18 @@ export class AnnotationEditor {
421
420
  rebuild(): void;
422
421
  /**
423
422
  * Rotate the editor when the page is rotated.
424
- * @param {number} angle
423
+ * @param {number} _angle
425
424
  */
426
- rotate(_angle: any): void;
425
+ rotate(_angle: number): void;
427
426
  /**
428
427
  * Resize the editor when the page is resized.
429
428
  */
430
429
  resize(): void;
431
430
  /**
432
431
  * Serialize the editor when it has been deleted.
433
- * @returns {Object}
432
+ * @returns {object}
434
433
  */
435
- serializeDeleted(): Object;
434
+ serializeDeleted(): object;
436
435
  /**
437
436
  * Serialize the editor.
438
437
  * The result of the serialization will be used to construct a
@@ -440,10 +439,10 @@ export class AnnotationEditor {
440
439
  *
441
440
  * To implement in subclasses.
442
441
  * @param {boolean} [isForCopying]
443
- * @param {Object | null} [context]
444
- * @returns {Object | null}
442
+ * @param {object | null} [context]
443
+ * @returns {object | null}
445
444
  */
446
- serialize(isForCopying?: boolean, context?: Object | null): Object | null;
445
+ serialize(isForCopying?: boolean, context?: object | null): object | null;
447
446
  /**
448
447
  * Check if an existing annotation associated with this editor has been
449
448
  * modified.
@@ -463,7 +462,10 @@ export class AnnotationEditor {
463
462
  * Add the resizers to this editor.
464
463
  */
465
464
  makeResizable(): void;
466
- get toolbarPosition(): null;
465
+ /**
466
+ * @returns {Array<number>|null}
467
+ */
468
+ get toolbarPosition(): Array<number> | null;
467
469
  /**
468
470
  * Get the position of the comment button.
469
471
  * @returns {Array<number>|null}
@@ -547,14 +549,14 @@ export class AnnotationEditor {
547
549
  get isEditing(): boolean;
548
550
  /**
549
551
  * Get the data to report to the telemetry when the editor is added.
550
- * @returns {Object}
552
+ * @returns {object}
551
553
  */
552
- get telemetryInitialData(): Object;
554
+ get telemetryInitialData(): object;
553
555
  /**
554
556
  * The telemetry data to use when saving/printing.
555
- * @returns {Object|null}
557
+ * @returns {object | null}
556
558
  */
557
- get telemetryFinalData(): Object | null;
559
+ get telemetryFinalData(): object | null;
558
560
  _reportTelemetry(data: any, mustWait?: boolean): void;
559
561
  /**
560
562
  * Show or hide this editor.
@@ -566,10 +568,10 @@ export class AnnotationEditor {
566
568
  updateFakeAnnotationElement(annotationLayer: any): void;
567
569
  /**
568
570
  * Render an annotation in the annotation layer.
569
- * @param {Object} annotation
571
+ * @param {object} annotation
570
572
  * @returns {HTMLElement|null}
571
573
  */
572
- renderAnnotationElement(annotation: Object): HTMLElement | null;
574
+ renderAnnotationElement(annotation: object): HTMLElement | null;
573
575
  resetAnnotationElement(annotation: any): void;
574
576
  #private;
575
577
  }
@@ -55,7 +55,7 @@ export class FreeTextEditor extends AnnotationEditor {
55
55
  /** @inheritdoc */
56
56
  getPDFRect(): any[];
57
57
  /** @inheritdoc */
58
- serialize(isForCopying?: boolean): Object | null;
58
+ serialize(isForCopying?: boolean): object | null;
59
59
  /** @inheritdoc */
60
60
  renderAnnotationElement(annotation: any): HTMLElement | null;
61
61
  #private;
@@ -1,38 +1,50 @@
1
1
  /**
2
- * Basic draw editor in order to generate an Highlight annotation.
2
+ * Editor for text-selection and freehand highlights.
3
+ * Their geometry comes from separate outline implementations.
3
4
  */
4
- export class HighlightEditor extends AnnotationEditor {
5
- static _defaultColor: null;
6
- static _defaultOpacity: number;
7
- static _defaultThickness: number;
5
+ export class HighlightEditor extends DrawingEditor {
6
+ static _DEFAULT_OPACITY: number;
7
+ static _DEFAULT_THICKNESS: number;
8
+ static _defaultDrawingOptions: null;
8
9
  static _type: string;
9
10
  static _editorType: number;
10
- static _freeHighlightId: number;
11
- static _freeHighlight: null;
12
- static _freeHighlightClipId: string;
13
11
  static get _keyboardManager(): any;
12
+ /** @inheritdoc */
13
+ static initialize(l10n: any, uiManager: any): void;
14
+ /** @inheritdoc */
15
+ static getDefaultDrawingOptions(options: any): any;
16
+ /** @inheritdoc */
17
+ static get typesMap(): any;
14
18
  static computeTelemetryFinalData(data: any): {
15
19
  numberOfColors: any;
16
20
  };
17
21
  /** @inheritdoc */
18
- static initialize(l10n: any, uiManager: any): void;
22
+ static createDrawerInstance({ x, y, box, parent, isLTR }: {
23
+ x: any;
24
+ y: any;
25
+ box: any;
26
+ parent: any;
27
+ isLTR: any;
28
+ }): FreeHighlightDrawer;
19
29
  /** @inheritdoc */
20
- static updateDefaultParams(type: any, value: any): void;
21
- static get defaultPropertiesToUpdate(): (number | null)[][];
22
- static #rotateBbox([x, y, width, height]: [any, any, any, any], angle: any): any[];
23
- static startHighlighting(parent: any, isLTR: any, { target: textLayer, x, y }: {
30
+ static _getDrawingTarget(parent: any, { target }: {
24
31
  target: any;
32
+ }): any;
33
+ /** @inheritdoc */
34
+ static _getPointerCoords({ x, y }: {
25
35
  x: any;
26
36
  y: any;
27
- }): void;
28
- static #highlightMove(parent: any, event: any): void;
29
- static #endHighlight(parent: any, event: any): void;
37
+ }): any[];
30
38
  /** @inheritdoc */
31
- static deserialize(data: any, parent: any, uiManager: any): Promise<AnnotationEditor | null>;
32
- constructor(params: any);
33
- color: any;
34
- opacity: any;
39
+ static _addDrawingListeners(target: any, signal: any): void;
40
+ /** @inheritdoc */
41
+ static deserializeDraw(pageX: any, pageY: any, pageWidth: any, pageHeight: any, _innerMargin: any, data: any, uiManager: any): import("./drawers/freedraw.js").FreeDrawOutline | HighlightOutline;
35
42
  defaultL10nId: string;
43
+ get colorType(): number;
44
+ get color(): any;
45
+ get opacity(): any;
46
+ /** @inheritdoc */
47
+ get _opacityName(): string;
36
48
  /** @inheritdoc */
37
49
  get telemetryInitialData(): {
38
50
  action: string;
@@ -49,28 +61,25 @@ export class HighlightEditor extends AnnotationEditor {
49
61
  /** @inheritdoc */
50
62
  translateInPage(x: any, y: any): void;
51
63
  /** @inheritdoc */
52
- get commentButtonPosition(): null;
53
- /** @inheritdoc */
54
- updateParams(type: any, value: any): void;
64
+ get toolbarPosition(): number[];
55
65
  /** @inheritdoc */
56
- get propertiesToUpdate(): any[][];
57
- /** @inheritdoc */
58
- get toolbarButtons(): any;
66
+ get commentButtonPosition(): number[];
59
67
  /** @inheritdoc */
60
68
  fixAndSetPosition(): void;
61
69
  /** @inheritdoc */
62
70
  getRect(tx: any, ty: any): any[];
63
- /** @inheritdoc */
64
- onceAdded(focus: any): void;
65
- /** @inheritdoc */
66
- rotate(angle: any): void;
67
- pointerover(): void;
68
- pointerleave(): void;
69
71
  _moveCaret(direction: any): void;
70
72
  /** @inheritdoc */
71
- serialize(isForCopying?: boolean): Object | null;
73
+ createDrawingOptions({ color, opacity, thickness }: {
74
+ color: any;
75
+ opacity: any;
76
+ thickness: any;
77
+ }): void;
78
+ _drawingOptions: any;
72
79
  /** @inheritdoc */
73
- renderAnnotationElement(annotation: any): null;
80
+ serialize(isForCopying?: boolean): object | null;
74
81
  #private;
75
82
  }
76
- import { AnnotationEditor } from "./editor.js";
83
+ import { DrawingEditor } from "./draw.js";
84
+ import { FreeHighlightDrawer } from "./drawers/highlight.js";
85
+ import { HighlightOutline } from "./drawers/highlight.js";
@@ -17,7 +17,12 @@ export class InkEditor extends DrawingEditor {
17
17
  /** @inheritdoc */
18
18
  static get typesMap(): any;
19
19
  /** @inheritdoc */
20
- static createDrawerInstance(x: any, y: any, parentWidth: any, parentHeight: any, rotation: any): InkDrawOutliner;
20
+ static createDrawerInstance({ x, y, box: [, , width, height], rotation }: {
21
+ x: any;
22
+ y: any;
23
+ box: [any, any, any, any];
24
+ rotation: any;
25
+ }): InkDrawOutliner;
21
26
  /** @inheritdoc */
22
27
  static deserializeDraw(pageX: any, pageY: any, pageWidth: any, pageHeight: any, innerMargin: any, data: any): any;
23
28
  defaultL10nId: string;
@@ -36,7 +41,7 @@ export class InkEditor extends DrawingEditor {
36
41
  }): void;
37
42
  _drawingOptions: any;
38
43
  /** @inheritdoc */
39
- serialize(isForCopying?: boolean): Object | null;
44
+ serialize(isForCopying?: boolean): object | null;
40
45
  #private;
41
46
  }
42
47
  import { DrawingOptions } from "./draw.js";
@@ -41,7 +41,7 @@ export class StampEditor extends AnnotationEditor {
41
41
  } | null;
42
42
  };
43
43
  /** @inheritdoc */
44
- serialize(isForCopying?: boolean, context?: null): Object | null;
44
+ serialize(isForCopying?: boolean, context?: null): object | null;
45
45
  /** @inheritdoc */
46
46
  renderAnnotationElement(annotation: any): null;
47
47
  #private;
@@ -50,9 +50,9 @@ export class AnnotationEditorUIManager {
50
50
  /**
51
51
  * Delete a comment from an editor with undo support.
52
52
  * @param {AnnotationEditor} editor - The editor whose comment to delete.
53
- * @param {Object} savedData - The comment data to save for undo.
53
+ * @param {object} savedData - The comment data to save for undo.
54
54
  */
55
- deleteComment(editor: AnnotationEditor, savedData: Object): void;
55
+ deleteComment(editor: AnnotationEditor, savedData: object): void;
56
56
  toggleComment(editor: any, isSelected: any, visibility?: undefined): void;
57
57
  makeCommentColor(color: any, opacity: any): any;
58
58
  getCommentDialogElement(): any;
@@ -82,15 +82,16 @@ export class AnnotationEditorUIManager {
82
82
  }): void;
83
83
  highlightSelection(methodOfCreation?: string, comment?: boolean): void;
84
84
  commentSelection(methodOfCreation?: string): void;
85
+ endCurrentEditing(): void;
85
86
  /**
86
87
  * Some annotations may have been modified in the annotation layer
87
88
  * (e.g. comments added or modified).
88
89
  * So this function retrieves the data from the storage and removes
89
90
  * them from the storage in order to be able to save them later.
90
91
  * @param {string} annotationId
91
- * @returns {Object|null} The data associated to the annotation or null.
92
+ * @returns {object | null} The data associated to the annotation or null.
92
93
  */
93
- getAndRemoveDataFromAnnotationStorage(annotationId: string): Object | null;
94
+ getAndRemoveDataFromAnnotationStorage(annotationId: string): object | null;
94
95
  /**
95
96
  * Add an editor in the annotation storage.
96
97
  * @param {AnnotationEditor} editor
@@ -188,11 +189,13 @@ export class AnnotationEditorUIManager {
188
189
  addNewEditorFromKeyboard(): void;
189
190
  /**
190
191
  * Update the toolbar if it's required to reflect the tool currently used.
191
- * @param {Object} options
192
- * @param {number} mode
192
+ * @param {object} options
193
+ * @param {number} options.mode
193
194
  * @returns {undefined}
194
195
  */
195
- updateToolbar(options: Object): undefined;
196
+ updateToolbar(options: {
197
+ mode: number;
198
+ }): undefined;
196
199
  /**
197
200
  * Update a parameter in the current editor or globally.
198
201
  * @param {number} type
@@ -204,7 +207,7 @@ export class AnnotationEditorUIManager {
204
207
  /**
205
208
  * Get all the editors belonging to a given page.
206
209
  * @param {number} pageIndex
207
- * @yields {AnnotationEditor}
210
+ * @yields {AnnotationEditor} An editor on the given page.
208
211
  */
209
212
  getEditors(pageIndex: number): Generator<any, void, unknown>;
210
213
  /**
@@ -278,9 +281,9 @@ export class AnnotationEditorUIManager {
278
281
  redo(): void;
279
282
  /**
280
283
  * Add a command to execute (cmd) and another one to undo it.
281
- * @param {Object} params
284
+ * @param {object} params
282
285
  */
283
- addCommands(params: Object): void;
286
+ addCommands(params: object): void;
284
287
  cleanUndoStack(type: any): void;
285
288
  /**
286
289
  * Delete the current editor or all.
@@ -322,9 +325,9 @@ export class AnnotationEditorUIManager {
322
325
  /**
323
326
  * Is the current editor the one passed as argument?
324
327
  * @param {AnnotationEditor} editor
325
- * @returns
328
+ * @returns {boolean}
326
329
  */
327
- isActive(editor: AnnotationEditor): editor is never;
330
+ isActive(editor: AnnotationEditor): boolean;
328
331
  /**
329
332
  * Get the current active editor.
330
333
  * @returns {AnnotationEditor|null}
@@ -386,10 +389,10 @@ export class ColorManager {
386
389
  export class CommandManager {
387
390
  constructor(maxSize?: number);
388
391
  /**
389
- * @typedef {Object} addOptions
390
- * @property {function} cmd
391
- * @property {function} undo
392
- * @property {function} [post]
392
+ * @typedef {object} addOptions
393
+ * @property {Function} cmd
394
+ * @property {Function} undo
395
+ * @property {Function} [post]
393
396
  * @property {boolean} mustExec
394
397
  * @property {number} type
395
398
  * @property {boolean} overwriteIfSameType
@@ -493,9 +496,8 @@ export class KeyboardManager {
493
496
  /**
494
497
  * Execute a callback, if any, for a given keyboard event.
495
498
  * The self is used as `this` in the callback.
496
- * @param {Object} self
499
+ * @param {object} self
497
500
  * @param {KeyboardEvent} event
498
- * @returns
499
501
  */
500
- exec(self: Object, event: KeyboardEvent): void;
502
+ exec(self: object, event: KeyboardEvent): void;
501
503
  }
@@ -7,7 +7,6 @@ export class BaseFilterFactory {
7
7
  addHighlightHCMFilter(filterName: any, fgColor: any, bgColor: any, newFgColor: any, newBgColor: any): string;
8
8
  /**
9
9
  * Create a filter for the selection of text, given colors.
10
- *
11
10
  * @param {string} fgColor
12
11
  * @param {string} bgColor
13
12
  * @returns {string}
@@ -15,12 +14,11 @@ export class BaseFilterFactory {
15
14
  addSelectionHCMFilter(fgColor: string, bgColor: string): string;
16
15
  /**
17
16
  * Create a filter for the selection of text.
18
- *
19
17
  * @returns {string}
20
18
  */
21
19
  addSelectionFilter(): string;
22
20
  /**
23
- * @param {Object} [pageColors]
21
+ * @param {object} [pageColors]
24
22
  * @param {string} [pageColors.background]
25
23
  * @param {string} [pageColors.foreground]
26
24
  * @returns {Record<string, string> | null}
@@ -1,6 +1,5 @@
1
1
  export class FontFaceObject {
2
2
  constructor(translatedData: any, inspectFont: null | undefined, charProcOperatorList: any, extra: any);
3
- compiledGlyphs: any;
4
3
  _inspectFont: any;
5
4
  charProcOperatorList: any;
6
5
  createNativeFontFace(): FontFace | null;
@@ -17,20 +16,15 @@ export class FontFaceObject {
17
16
  get missingFile(): any;
18
17
  get remeasure(): any;
19
18
  get vertical(): any;
20
- get ascent(): any;
21
- get defaultWidth(): any;
22
- get descent(): any;
23
19
  get bbox(): any;
24
20
  get fontMatrix(): any;
25
21
  get fallbackName(): any;
26
22
  get loadedName(): any;
27
- get mimetype(): any;
28
- get name(): any;
23
+ get mimetype(): "font/opentype" | null;
29
24
  get data(): any;
30
25
  clearData(): void;
31
26
  get cssFontInfo(): any;
32
27
  get systemFontInfo(): any;
33
- get defaultVMetrics(): any;
34
28
  #private;
35
29
  }
36
30
  export class FontLoader {
@@ -39,7 +33,6 @@ export class FontLoader {
39
33
  styleElement?: null | undefined;
40
34
  });
41
35
  _document: Document;
42
- nativeFontFaces: Set<any>;
43
36
  styleElement: HTMLStyleElement | null;
44
37
  loadingRequests: any[] | undefined;
45
38
  loadTestFontId: number | undefined;
@@ -55,12 +48,5 @@ export class FontLoader {
55
48
  bind(font: any): Promise<void>;
56
49
  get isFontLoadingAPISupported(): any;
57
50
  get isSyncFontLoadingSupported(): any;
58
- _queueLoadingCallback(callback: any): {
59
- done: boolean;
60
- complete: () => void;
61
- callback: any;
62
- };
63
- get _loadTestFont(): any;
64
- _prepareFontLoadEvent(font: any, request: any): void;
65
51
  #private;
66
52
  }
@@ -3,6 +3,7 @@ export function createResponseError(status: any, url: any): ResponseException;
3
3
  export function ensureResponseOrigin(rangeOrigin: any, origin: any): void;
4
4
  export function extractFilenameFromHeader(responseHeaders: any): string | null;
5
5
  export function getResponseOrigin(url: any): string | null;
6
+ export function trimHeadersEnd(str: any): any;
6
7
  export function validateRangeRequestCapabilities({ responseHeaders, isHttp, rangeChunkSize, disableRange, }: {
7
8
  responseHeaders: any;
8
9
  isHttp: any;
@@ -1,39 +1,30 @@
1
1
  export class CssFontInfo {
2
2
  constructor(buffer: any);
3
- get fontFamily(): string;
4
- get fontWeight(): string;
5
- get italicAngle(): string;
3
+ get fontFamily(): any;
4
+ get fontWeight(): any;
5
+ get italicAngle(): any;
6
6
  #private;
7
7
  }
8
8
  export class FontInfo {
9
- constructor({ buffer, extra }: {
10
- buffer: any;
11
- extra: any;
12
- });
13
- get black(): boolean | undefined;
14
- get bold(): boolean | undefined;
15
- get disableFontFace(): boolean | undefined;
16
- get fontExtraProperties(): boolean | undefined;
17
- get isInvalidPDFjsFont(): boolean | undefined;
18
- get isType3Font(): boolean | undefined;
19
- get italic(): boolean | undefined;
20
- get missingFile(): boolean | undefined;
21
- get remeasure(): boolean | undefined;
22
- get vertical(): boolean | undefined;
23
- get ascent(): number;
24
- get defaultWidth(): number;
25
- get descent(): number;
26
- get bbox(): any[] | undefined;
27
- get fontMatrix(): any[] | undefined;
28
- get defaultVMetrics(): any[] | undefined;
29
- get fallbackName(): string;
30
- get loadedName(): string;
31
- get mimetype(): string;
32
- get name(): string;
9
+ constructor(buffer: any);
10
+ get black(): any;
11
+ get bold(): any;
12
+ get disableFontFace(): any;
13
+ get fontExtraProperties(): any;
14
+ get isInvalidPDFjsFont(): any;
15
+ get isType3Font(): any;
16
+ get italic(): any;
17
+ get missingFile(): any;
18
+ get remeasure(): any;
19
+ get vertical(): any;
20
+ get bbox(): any;
21
+ get fontMatrix(): any;
22
+ get fallbackName(): any;
23
+ get loadedName(): any;
33
24
  get data(): Uint8Array<any> | undefined;
34
25
  clearData(): void;
35
- get cssFontInfo(): CssFontInfo | null;
36
- get systemFontInfo(): SystemFontInfo | null;
26
+ get cssFontInfo(): any;
27
+ get systemFontInfo(): any;
37
28
  #private;
38
29
  }
39
30
  export class FontPathInfo {
@@ -50,14 +41,10 @@ export class PatternInfo {
50
41
  }
51
42
  export class SystemFontInfo {
52
43
  constructor(buffer: any);
53
- get guessFallback(): boolean;
54
- get css(): string;
55
- get loadedName(): string;
56
- get baseFontName(): string;
57
- get src(): string;
58
- get style(): {
59
- style: string;
60
- weight: string;
61
- };
44
+ get css(): any;
45
+ get loadedName(): any;
46
+ get baseFontName(): any;
47
+ get src(): any;
48
+ get style(): any;
62
49
  #private;
63
50
  }
@@ -60,7 +60,7 @@ export type PageViewportCloneParameters = {
60
60
  dontFlip?: boolean | undefined;
61
61
  };
62
62
  /**
63
- * @typedef {Object} PageViewportParameters
63
+ * @typedef {object} PageViewportParameters
64
64
  * @property {Array<number>} viewBox - The xMin, yMin, xMax and
65
65
  * yMax coordinates.
66
66
  * @property {number} userUnit - The size of units.
@@ -74,7 +74,7 @@ export type PageViewportCloneParameters = {
74
74
  * The default value is `false`.
75
75
  */
76
76
  /**
77
- * @typedef {Object} PageViewportCloneParameters
77
+ * @typedef {object} PageViewportCloneParameters
78
78
  * @property {number} [scale] - The scale, overriding the one in the cloned
79
79
  * viewport. The default value is `this.scale`.
80
80
  * @property {number} [rotation] - The rotation, in degrees, overriding the one
@@ -91,7 +91,7 @@ export type PageViewportCloneParameters = {
91
91
  */
92
92
  export class PageViewport {
93
93
  /**
94
- * @param {PageViewportParameters}
94
+ * @param {PageViewportParameters} params
95
95
  */
96
96
  constructor({ viewBox, userUnit, scale, rotation, offsetX, offsetY, dontFlip, }: PageViewportParameters);
97
97
  viewBox: number[];
@@ -105,9 +105,9 @@ export class PageViewport {
105
105
  height: number;
106
106
  /**
107
107
  * The original, un-scaled, viewport dimensions.
108
- * @type {Object}
108
+ * @type {object}
109
109
  */
110
- get rawDims(): Object;
110
+ get rawDims(): object;
111
111
  /**
112
112
  * Clones viewport, with optional additional properties.
113
113
  * @param {PageViewportCloneParameters} [params]