pdfjs-serverless 1.0.1 → 1.2.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 (86) hide show
  1. package/README.md +14 -44
  2. package/dist/index.d.mts +1 -1
  3. package/dist/index.mjs +1 -1
  4. package/dist/types/src/display/annotation_layer.d.ts +49 -16
  5. package/dist/types/src/display/annotation_storage.d.ts +10 -8
  6. package/dist/types/src/display/api.d.ts +134 -126
  7. package/dist/types/src/display/api_utils.d.ts +13 -0
  8. package/dist/types/src/display/binary_data_factory.d.ts +26 -0
  9. package/dist/types/src/display/canvas.d.ts +97 -92
  10. package/dist/types/src/display/canvas_dependency_tracker.d.ts +216 -0
  11. package/dist/types/src/display/canvas_factory.d.ts +3 -1
  12. package/dist/types/src/display/display_utils.d.ts +27 -3
  13. package/dist/types/src/display/draw_layer.d.ts +2 -6
  14. package/dist/types/src/display/editor/alt_text.d.ts +1 -1
  15. package/dist/types/src/display/editor/annotation_editor_layer.d.ts +16 -19
  16. package/dist/types/src/display/editor/color_picker.d.ts +20 -1
  17. package/dist/types/src/display/editor/comment.d.ts +59 -0
  18. package/dist/types/src/display/editor/draw.d.ts +4 -8
  19. package/dist/types/src/display/editor/drawers/freedraw.d.ts +4 -3
  20. package/dist/types/src/display/editor/drawers/highlight.d.ts +2 -1
  21. package/dist/types/src/display/editor/drawers/signaturedraw.d.ts +13 -13
  22. package/dist/types/src/display/editor/editor.d.ts +119 -15
  23. package/dist/types/src/display/editor/freetext.d.ts +11 -7
  24. package/dist/types/src/display/editor/highlight.d.ts +8 -3
  25. package/dist/types/src/display/editor/ink.d.ts +5 -0
  26. package/dist/types/src/display/editor/signature.d.ts +2 -5
  27. package/dist/types/src/display/editor/stamp.d.ts +3 -1
  28. package/dist/types/src/display/editor/toolbar.d.ts +8 -3
  29. package/dist/types/src/display/editor/tools.d.ts +72 -6
  30. package/dist/types/src/display/fetch_stream.d.ts +3 -56
  31. package/dist/types/src/display/font_loader.d.ts +28 -1
  32. package/dist/types/src/display/network.d.ts +14 -80
  33. package/dist/types/src/display/network_stream.d.ts +2 -0
  34. package/dist/types/src/display/network_utils.d.ts +3 -3
  35. package/dist/types/src/display/node_stream.d.ts +2 -52
  36. package/dist/types/src/display/node_utils.d.ts +5 -19
  37. package/dist/types/src/display/obj_bin_transform_display.d.ts +67 -0
  38. package/dist/types/src/display/pages_mapper.d.ts +72 -0
  39. package/dist/types/src/display/pattern_helper.d.ts +9 -4
  40. package/dist/types/src/display/pdf_objects.d.ts +40 -0
  41. package/dist/types/src/display/text_layer.d.ts +16 -10
  42. package/dist/types/src/display/text_layer_images.d.ts +10 -0
  43. package/dist/types/src/display/transport_stream.d.ts +8 -64
  44. package/dist/types/src/display/webgpu_mesh.d.ts +3 -0
  45. package/dist/types/src/display/worker_options.d.ts +2 -2
  46. package/dist/types/src/display/xfa_layer.d.ts +3 -3
  47. package/dist/types/src/pdf.d.ts +11 -2
  48. package/dist/types/src/{interfaces.d.ts → shared/base_pdf_stream.d.ts} +26 -27
  49. package/dist/types/src/shared/obj_bin_transform_utils.d.ts +26 -0
  50. package/dist/types/src/shared/scripting_utils.d.ts +2 -0
  51. package/dist/types/src/shared/util.d.ts +21 -8
  52. package/dist/types/web/annotation_editor_layer_builder.d.ts +7 -8
  53. package/dist/types/web/annotation_layer_builder.d.ts +18 -23
  54. package/dist/types/web/app_options.d.ts +1 -1
  55. package/dist/types/web/autolinker.d.ts +3 -2
  56. package/dist/types/web/base_download_manager.d.ts +24 -0
  57. package/dist/types/web/base_pdf_page_view.d.ts +7 -6
  58. package/dist/types/web/comment_manager.d.ts +20 -0
  59. package/dist/types/web/download_manager.d.ts +3 -12
  60. package/dist/types/web/draw_layer_builder.d.ts +0 -12
  61. package/dist/types/web/event_utils.d.ts +1 -1
  62. package/dist/types/web/genericl10n.d.ts +6 -10
  63. package/dist/types/web/l10n.d.ts +3 -6
  64. package/dist/types/web/menu.d.ts +11 -0
  65. package/dist/types/web/pdf_find_controller.d.ts +10 -12
  66. package/dist/types/web/pdf_history.d.ts +3 -3
  67. package/dist/types/web/pdf_link_service.d.ts +10 -7
  68. package/dist/types/web/pdf_page_detail_view.d.ts +2 -7
  69. package/dist/types/web/pdf_page_view.d.ts +39 -17
  70. package/dist/types/web/pdf_rendering_queue.d.ts +10 -14
  71. package/dist/types/web/pdf_thumbnail_view.d.ts +18 -50
  72. package/dist/types/web/pdf_thumbnail_viewer.d.ts +57 -13
  73. package/dist/types/web/pdf_viewer.component.d.ts +1 -1
  74. package/dist/types/web/pdf_viewer.d.ts +95 -29
  75. package/dist/types/web/renderable_view.d.ts +33 -0
  76. package/dist/types/web/sidebar.d.ts +65 -0
  77. package/dist/types/web/struct_tree_layer_builder.d.ts +1 -1
  78. package/dist/types/web/text_accessibility.d.ts +1 -1
  79. package/dist/types/web/text_layer_builder.d.ts +11 -6
  80. package/dist/types/web/ui_utils.d.ts +3 -11
  81. package/dist/types/web/xfa_layer_builder.d.ts +4 -4
  82. package/package.json +18 -15
  83. package/dist/types/src/display/cmap_reader_factory.d.ts +0 -25
  84. package/dist/types/src/display/standard_fontdata_factory.d.ts +0 -20
  85. package/dist/types/src/display/wasm_factory.d.ts +0 -20
  86. package/dist/types/web/interfaces.d.ts +0 -167
@@ -1,10 +1,10 @@
1
1
  export type AnnotationEditorUIManager = import("./tools.js").AnnotationEditorUIManager;
2
2
  export type PageViewport = import("../display_utils.js").PageViewport;
3
3
  export type TextAccessibilityManager = import("../../../web/text_accessibility.js").TextAccessibilityManager;
4
- export type IL10n = import("../../../web/interfaces").IL10n;
5
4
  export type AnnotationLayer = import("../annotation_layer.js").AnnotationLayer;
6
5
  export type DrawLayer = import("../draw_layer.js").DrawLayer;
7
- export type StructTreeLayerBuilder = any;
6
+ export type StructTreeLayerBuilder = import("../../../web/struct_tree_layer_builder.js").StructTreeLayerBuilder;
7
+ export type L10n = import("../../../web/l10n.js").L10n;
8
8
  export type AnnotationEditorLayerOptions = {
9
9
  mode: Object;
10
10
  div: HTMLDivElement;
@@ -13,7 +13,7 @@ export type AnnotationEditorLayerOptions = {
13
13
  enabled: boolean;
14
14
  accessibilityManager?: import("../../../web/text_accessibility.js").TextAccessibilityManager | undefined;
15
15
  pageIndex: number;
16
- l10n: IL10n;
16
+ l10n: L10n;
17
17
  annotationLayer?: import("../annotation_layer.js").AnnotationLayer | undefined;
18
18
  textLayer?: HTMLDivElement | undefined;
19
19
  drawLayer: DrawLayer;
@@ -31,7 +31,7 @@ export type RenderEditorLayerOptions = {
31
31
  * @property {boolean} enabled
32
32
  * @property {TextAccessibilityManager} [accessibilityManager]
33
33
  * @property {number} pageIndex
34
- * @property {IL10n} l10n
34
+ * @property {L10n} l10n
35
35
  * @property {AnnotationLayer} [annotationLayer]
36
36
  * @property {HTMLDivElement} [textLayer]
37
37
  * @property {DrawLayer} drawLayer
@@ -46,7 +46,7 @@ export type RenderEditorLayerOptions = {
46
46
  */
47
47
  export class AnnotationEditorLayer {
48
48
  static _initialized: boolean;
49
- static "__#34@#editorTypes": Map<number, typeof FreeTextEditor | typeof HighlightEditor | typeof InkEditor | typeof SignatureEditor | typeof StampEditor>;
49
+ static "__#private@#editorTypes": Map<number, typeof FreeTextEditor | typeof HighlightEditor | typeof InkEditor | typeof SignatureEditor | typeof StampEditor>;
50
50
  /**
51
51
  * @param {AnnotationEditorLayerOptions} options
52
52
  */
@@ -55,14 +55,14 @@ export class AnnotationEditorLayer {
55
55
  div: HTMLDivElement;
56
56
  viewport: import("../display_utils.js").PageViewport;
57
57
  drawLayer: import("../draw_layer.js").DrawLayer;
58
- _structTree: any;
58
+ _structTree: import("../../../web/struct_tree_layer_builder.js").StructTreeLayerBuilder;
59
59
  get isEmpty(): boolean;
60
60
  get isInvisible(): boolean;
61
61
  /**
62
62
  * Update the toolbar if it's required to reflect the tool currently used.
63
- * @param {number} mode
63
+ * @param {Object} options
64
64
  */
65
- updateToolbar(mode: number): void;
65
+ updateToolbar(options: Object): void;
66
66
  /**
67
67
  * The mode has changed: it must be updated.
68
68
  * @param {number} mode
@@ -111,7 +111,7 @@ export class AnnotationEditorLayer {
111
111
  remove(editor: AnnotationEditor): void;
112
112
  /**
113
113
  * An editor can have a different parent, for example after having
114
- * being dragged and droped from a page to another.
114
+ * being dragged and dropped from a page to another.
115
115
  * @param {AnnotationEditor} editor
116
116
  */
117
117
  changeParent(editor: AnnotationEditor): void;
@@ -131,25 +131,21 @@ export class AnnotationEditorLayer {
131
131
  * @param {AnnotationEditor} editor
132
132
  */
133
133
  addUndoableEditor(editor: AnnotationEditor): void;
134
- /**
135
- * Get an id for an editor.
136
- * @returns {string}
137
- */
138
- getNextId(): string;
134
+ getEditorByUID(uid: any): any;
139
135
  combinedSignal(ac: any): AbortSignal;
140
136
  canCreateNewEmptyEditor(): boolean | undefined;
141
137
  /**
142
138
  * Paste some content into a new editor.
143
- * @param {number} mode
139
+ * @param {Object} options
144
140
  * @param {Object} params
145
141
  */
146
- pasteEditor(mode: number, params: Object): Promise<void>;
142
+ pasteEditor(options: Object, params: Object): Promise<void>;
147
143
  /**
148
144
  * Create a new editor
149
145
  * @param {Object} data
150
- * @returns {AnnotationEditor | null}
146
+ * @returns {Promise<AnnotationEditor | null>}
151
147
  */
152
- deserialize(data: Object): AnnotationEditor | null;
148
+ deserialize(data: Object): Promise<AnnotationEditor | null>;
153
149
  /**
154
150
  * Create and add a new editor.
155
151
  * @param {PointerEvent} event
@@ -158,6 +154,7 @@ export class AnnotationEditorLayer {
158
154
  * @returns {AnnotationEditor}
159
155
  */
160
156
  createAndAddNewEditor(event: PointerEvent, isCentered: boolean, data?: {}): AnnotationEditor;
157
+ get boundingClientRect(): DOMRect;
161
158
  /**
162
159
  * Create and add a new editor.
163
160
  */
@@ -208,7 +205,7 @@ export class AnnotationEditorLayer {
208
205
  * Render the main editor.
209
206
  * @param {RenderEditorLayerOptions} parameters
210
207
  */
211
- render({ viewport }: RenderEditorLayerOptions): void;
208
+ render({ viewport }: RenderEditorLayerOptions): Promise<void>;
212
209
  /**
213
210
  * Update the main editor.
214
211
  * @param {RenderEditorLayerOptions} parameters
@@ -1,5 +1,24 @@
1
+ /**
2
+ * BasicColorPicker class provides a simple color picker.
3
+ * It displays an input element (with type="color") that allows the user
4
+ * to select a color for the annotation.
5
+ */
6
+ export class BasicColorPicker {
7
+ static "__#private@#l10nColor": null;
8
+ constructor(editor: any);
9
+ renderButton(): HTMLInputElement;
10
+ update(value: any): void;
11
+ destroy(): void;
12
+ hideDropdown(): void;
13
+ #private;
14
+ }
15
+ /**
16
+ * ColorPicker class provides a color picker for the annotation editor.
17
+ * It displays a dropdown with some predefined colors and allows the user
18
+ * to select a color for the annotation.
19
+ */
1
20
  export class ColorPicker {
2
- static "__#23@#l10nColor": null;
21
+ static "__#private@#l10nColor": null;
3
22
  static get _keyboardManager(): any;
4
23
  constructor({ editor, uiManager }: {
5
24
  editor?: null | undefined;
@@ -0,0 +1,59 @@
1
+ export class Comment {
2
+ constructor(editor: any);
3
+ renderForToolbar(): any;
4
+ renderForStandalone(): any;
5
+ focusButton(): void;
6
+ onUpdatedColor(): void;
7
+ get commentButtonWidth(): number;
8
+ set commentPopupPositionInLayer(pos: number[] | null);
9
+ get commentPopupPositionInLayer(): number[] | null;
10
+ hasDefaultPopupPosition(): boolean;
11
+ removeStandaloneCommentButton(): void;
12
+ removeToolbarCommentButton(): void;
13
+ setCommentButtonStates({ selected, hasPopup }: {
14
+ selected: any;
15
+ hasPopup: any;
16
+ }): void;
17
+ edit(options: any): void;
18
+ finish(): void;
19
+ isDeleted(): boolean;
20
+ isEmpty(): boolean;
21
+ hasBeenEdited(): boolean;
22
+ serialize(): {
23
+ text: null;
24
+ richText: null;
25
+ date: null;
26
+ deleted: boolean;
27
+ };
28
+ /**
29
+ * Set the comment data.
30
+ */
31
+ set data(text: {
32
+ text: null;
33
+ richText: null;
34
+ date: null;
35
+ deleted: boolean;
36
+ });
37
+ get data(): {
38
+ text: null;
39
+ richText: null;
40
+ date: null;
41
+ deleted: boolean;
42
+ };
43
+ /**
44
+ * Restore the comment data (used for undo).
45
+ * @param {Object} data - The comment data to restore.
46
+ * @param {string} data.text - The comment text.
47
+ * @param {string|null} data.richText - The rich text content.
48
+ * @param {Date|null} data.date - The original date.
49
+ */
50
+ restoreData({ text, richText, date }: {
51
+ text: string;
52
+ richText: string | null;
53
+ date: Date | null;
54
+ }): void;
55
+ setInitialText(text: any, richText?: null): void;
56
+ shown(): void;
57
+ destroy(): void;
58
+ #private;
59
+ }
@@ -4,13 +4,9 @@
4
4
  export class DrawingEditor extends AnnotationEditor {
5
5
  static _currentDrawId: number;
6
6
  static _currentParent: null;
7
- static "__#26@#currentDraw": null;
8
- static "__#26@#currentDrawingAC": null;
9
- static "__#26@#currentDrawingOptions": null;
10
- static "__#26@#currentPointerId": number;
11
- static "__#26@#currentPointerType": null;
12
- static "__#26@#currentPointerIds": null;
13
- static "__#26@#currentMoveTimestamp": number;
7
+ static "__#private@#currentDraw": null;
8
+ static "__#private@#currentDrawingAC": null;
9
+ static "__#private@#currentDrawingOptions": null;
14
10
  static _INNER_MARGIN: number;
15
11
  static _mergeSVGProperties(p1: any, p2: any): any;
16
12
  /**
@@ -32,7 +28,6 @@ export class DrawingEditor extends AnnotationEditor {
32
28
  INK_THICKNESS: number;
33
29
  INK_OPACITY: number;
34
30
  HIGHLIGHT_COLOR: number;
35
- HIGHLIGHT_DEFAULT_COLOR: number;
36
31
  HIGHLIGHT_THICKNESS: number;
37
32
  HIGHLIGHT_FREE: number;
38
33
  HIGHLIGHT_SHOW_ALL: number;
@@ -76,6 +71,7 @@ export class DrawingEditor extends AnnotationEditor {
76
71
  /** @inheritdoc */
77
72
  static deserialize(data: any, parent: any, uiManager: any): Promise<AnnotationEditor | null>;
78
73
  constructor(params: any);
74
+ _colorPicker: null;
79
75
  _drawId: null;
80
76
  _addOutlines(params: any): void;
81
77
  /** @inheritdoc */
@@ -1,5 +1,6 @@
1
1
  export class FreeDrawOutline extends Outline {
2
2
  constructor(outline: any, points: any, box: any, scaleFactor: any, innerMargin: any, isLTR: any);
3
+ firstPoint: number[];
3
4
  lastPoint: number[];
4
5
  serialize([blX, blY, trX, trY]: [any, any, any, any], rotation: any): {
5
6
  outline: any[];
@@ -11,9 +12,9 @@ export class FreeDrawOutline extends Outline {
11
12
  #private;
12
13
  }
13
14
  export class FreeDrawOutliner {
14
- static "__#19@#MIN_DIST": number;
15
- static "__#19@#MIN_DIFF": number;
16
- static "__#19@#MIN": number;
15
+ static "__#private@#MIN_DIST": number;
16
+ static "__#private@#MIN_DIFF": number;
17
+ static "__#private@#MIN": number;
17
18
  constructor({ x, y }: {
18
19
  x: any;
19
20
  y: any;
@@ -19,7 +19,8 @@ export class HighlightOutliner {
19
19
  }
20
20
  import { FreeDrawOutliner } from "./freedraw.js";
21
21
  declare class HighlightOutline extends Outline {
22
- constructor(outlines: any, box: any, lastPoint: any);
22
+ constructor(outlines: any, box: any, firstPoint: any, lastPoint: any);
23
+ firstPoint: any;
23
24
  lastPoint: any;
24
25
  /**
25
26
  * Serialize the outlines into the PDF page coordinate system.
@@ -2,29 +2,29 @@
2
2
  * Basic text editor in order to create a Signature annotation.
3
3
  */
4
4
  export class SignatureExtractor {
5
- static "__#30@#PARAMETERS": {
5
+ static "__#private@#PARAMETERS": {
6
6
  maxDim: number;
7
7
  sigmaSFactor: number;
8
8
  sigmaR: number;
9
9
  kernelSize: number;
10
10
  };
11
- static "__#30@#neighborIndexToId"(i0: any, j0: any, i: any, j: any): any;
12
- static "__#30@#neighborIdToIndex": Int32Array<ArrayBuffer>;
13
- static "__#30@#clockwiseNonZero"(buf: any, width: any, i0: any, j0: any, i: any, j: any, offset: any): number;
14
- static "__#30@#counterClockwiseNonZero"(buf: any, width: any, i0: any, j0: any, i: any, j: any, offset: any): number;
15
- static "__#30@#findContours"(buf: any, width: any, height: any, threshold: any): {
11
+ static "__#private@#neighborIndexToId"(i0: any, j0: any, i: any, j: any): any;
12
+ static "__#private@#neighborIdToIndex": Int32Array<ArrayBuffer>;
13
+ static "__#private@#clockwiseNonZero"(buf: any, width: any, i0: any, j0: any, i: any, j: any, offset: any): number;
14
+ static "__#private@#counterClockwiseNonZero"(buf: any, width: any, i0: any, j0: any, i: any, j: any, offset: any): number;
15
+ static "__#private@#findContours"(buf: any, width: any, height: any, threshold: any): {
16
16
  isHole: boolean;
17
17
  points: number[];
18
18
  id: number;
19
19
  parent: number;
20
20
  }[];
21
- static "__#30@#douglasPeuckerHelper"(points: any, start: any, end: any, output: any): void;
22
- static "__#30@#douglasPeucker"(points: any): any[] | null;
23
- static "__#30@#bilateralFilter"(buf: any, width: any, height: any, sigmaS: any, sigmaR: any, kernelSize: any): (Uint32Array<ArrayBuffer> | Uint8Array<any>)[];
24
- static "__#30@#getHistogram"(buf: any): Uint32Array<ArrayBuffer>;
25
- static "__#30@#toUint8"(buf: any): Uint8ClampedArray<ArrayBuffer>;
26
- static "__#30@#guessThreshold"(histogram: any): number;
27
- static "__#30@#getGrayPixels"(bitmap: any): any[];
21
+ static "__#private@#douglasPeuckerHelper"(points: any, start: any, end: any, output: any): void;
22
+ static "__#private@#douglasPeucker"(points: any): any[] | null;
23
+ static "__#private@#bilateralFilter"(buf: any, width: any, height: any, sigmaS: any, sigmaR: any, kernelSize: any): (Uint32Array<ArrayBuffer> | Uint8Array<any>)[];
24
+ static "__#private@#getHistogram"(buf: any): Uint32Array<ArrayBuffer>;
25
+ static "__#private@#toUint8"(buf: any): Uint8ClampedArray<ArrayBuffer>;
26
+ static "__#private@#guessThreshold"(histogram: any): number;
27
+ static "__#private@#getGrayPixels"(bitmap: any): any[];
28
28
  static extractContoursFromText(text: any, { fontFamily, fontStyle, fontWeight }: {
29
29
  fontFamily: any;
30
30
  fontStyle: any;
@@ -73,7 +73,7 @@ export class AnnotationEditor {
73
73
  * @param {AnnotationEditorLayer} parent
74
74
  */
75
75
  static paste(item: DataTransferItem, parent: AnnotationEditorLayer): void;
76
- static "__#42@#rotatePoint"(x: any, y: any, angle: any): any[];
76
+ static "__#private@#rotatePoint"(x: any, y: any, angle: any): any[];
77
77
  static _round(x: any): number;
78
78
  /**
79
79
  * Deserialize the editor.
@@ -91,6 +91,7 @@ export class AnnotationEditor {
91
91
  * @param {AnnotationEditorParameters} parameters
92
92
  */
93
93
  constructor(parameters: AnnotationEditorParameters);
94
+ isSelected: boolean;
94
95
  _isCopy: boolean;
95
96
  _editToolbar: null;
96
97
  _initialOptions: any;
@@ -108,6 +109,9 @@ export class AnnotationEditor {
108
109
  annotationElementId: any;
109
110
  _willKeepAspectRatio: boolean;
110
111
  _structTreeParentId: any;
112
+ creationDate: any;
113
+ modificationDate: any;
114
+ canAddComment: boolean;
111
115
  rotation: number;
112
116
  pageRotation: number;
113
117
  pageDimensions: any[];
@@ -116,7 +120,9 @@ export class AnnotationEditor {
116
120
  y: number;
117
121
  isAttachedToDOM: boolean;
118
122
  deleted: boolean;
123
+ updatePageIndex(newPageIndex: any): void;
119
124
  get editorType(): any;
125
+ get mode(): any;
120
126
  /**
121
127
  * Get the properties to update in the UI for this editor.
122
128
  * @returns {Array}
@@ -124,6 +130,7 @@ export class AnnotationEditor {
124
130
  get propertiesToUpdate(): any[];
125
131
  set _isDraggable(value: boolean);
126
132
  get _isDraggable(): boolean;
133
+ get uid(): any;
127
134
  /**
128
135
  * @returns {boolean} true if the editor handles the Enter key itself.
129
136
  */
@@ -232,11 +239,8 @@ export class AnnotationEditor {
232
239
  get parentDimensions(): number[];
233
240
  /**
234
241
  * Set the dimensions of this editor.
235
- * @param {number} width
236
- * @param {number} height
237
242
  */
238
- setDims(width: number, height: number): void;
239
- fixDims(): void;
243
+ setDims(): void;
240
244
  /**
241
245
  * Get the translation used to position this editor when it's created.
242
246
  * @returns {Array<number>}
@@ -254,15 +258,26 @@ export class AnnotationEditor {
254
258
  * Called when the alt text dialog is closed.
255
259
  */
256
260
  altTextFinish(): void;
261
+ /**
262
+ * Get the toolbar buttons for this editor.
263
+ * @returns {Array<Array<string|object|null>>|null}
264
+ */
265
+ get toolbarButtons(): Array<Array<string | object | null>> | null;
257
266
  /**
258
267
  * Add a toolbar for this editor.
259
268
  * @returns {Promise<EditorToolbar|null>}
260
269
  */
261
270
  addEditToolbar(): Promise<EditorToolbar | null>;
271
+ addCommentButtonInToolbar(): void;
272
+ removeCommentButtonFromToolbar(): void;
262
273
  removeEditToolbar(): void;
263
274
  addContainer(container: any): void;
264
275
  getClientDimensions(): DOMRect;
265
- addAltTextButton(): Promise<void>;
276
+ /**
277
+ * Create the alt text for this editor.
278
+ * @returns {object}
279
+ */
280
+ createAltText(): object;
266
281
  /**
267
282
  * Set the alt text data.
268
283
  */
@@ -273,6 +288,46 @@ export class AnnotationEditor {
273
288
  serializeAltText(isForCopying: any): any;
274
289
  hasAltText(): boolean;
275
290
  hasAltTextData(): any;
291
+ focusCommentButton(): void;
292
+ addCommentButton(): Comment | null;
293
+ addStandaloneCommentButton(): void;
294
+ removeStandaloneCommentButton(): void;
295
+ hideStandaloneCommentButton(): void;
296
+ set comment(value: {
297
+ text: never;
298
+ richText: never;
299
+ date: never;
300
+ deleted: never;
301
+ color: any;
302
+ opacity: any;
303
+ } | null);
304
+ get comment(): {
305
+ text: never;
306
+ richText: never;
307
+ date: never;
308
+ deleted: never;
309
+ color: any;
310
+ opacity: any;
311
+ } | null;
312
+ setCommentData({ comment, popupRef, richText }: {
313
+ comment: any;
314
+ popupRef: any;
315
+ richText: any;
316
+ }): void;
317
+ get hasEditedComment(): any;
318
+ get hasDeletedComment(): any;
319
+ get hasComment(): boolean;
320
+ editComment(options: any): Promise<void>;
321
+ toggleComment(isSelected: any, visibility?: undefined): void;
322
+ setSelectedCommentButton(selected: any): void;
323
+ addComment(serialized: any): void;
324
+ updateFromAnnotationLayer({ popup: { contents, deleted } }: {
325
+ popup: {
326
+ contents: any;
327
+ deleted: any;
328
+ };
329
+ }): void;
330
+ get parentBoundingClientRect(): DOMRect;
276
331
  /**
277
332
  * Render this editor in a div.
278
333
  * @returns {HTMLDivElement | null}
@@ -283,7 +338,6 @@ export class AnnotationEditor {
283
338
  * @param {PointerEvent} event
284
339
  */
285
340
  pointerdown(event: PointerEvent): void;
286
- get isSelected(): any;
287
341
  _onStartDragging(): void;
288
342
  _onStopDragging(): void;
289
343
  moveInDOM(): void;
@@ -296,6 +350,31 @@ export class AnnotationEditor {
296
350
  */
297
351
  getRect(tx: number, ty: number, rotation?: number): any[];
298
352
  getRectInCurrentCoords(rect: any, pageHeight: any): any[];
353
+ /**
354
+ * Get the rect in page coordinates without any translation.
355
+ * It's used when serializing the editor.
356
+ * @returns {Array<number>}
357
+ */
358
+ getPDFRect(): Array<number>;
359
+ getNonHCMColor(): any;
360
+ /**
361
+ * The color has been changed.
362
+ */
363
+ onUpdatedColor(): void;
364
+ getData(): {
365
+ id: any;
366
+ pageIndex: number;
367
+ rect: number[];
368
+ richText: any;
369
+ contentsObj: {
370
+ str: any;
371
+ };
372
+ creationDate: any;
373
+ modificationDate: any;
374
+ popupRef: boolean;
375
+ color: any;
376
+ opacity: any;
377
+ };
299
378
  /**
300
379
  * Executed once this editor has been rendered.
301
380
  * @param {boolean} focus - true if the editor should be focused.
@@ -308,12 +387,14 @@ export class AnnotationEditor {
308
387
  isEmpty(): boolean;
309
388
  /**
310
389
  * Enable edit mode.
390
+ * @returns {boolean} - true if the edit mode has been enabled.
311
391
  */
312
- enableEditMode(): void;
392
+ enableEditMode(): boolean;
313
393
  /**
314
394
  * Disable edit mode.
395
+ * @returns {boolean} - true if the edit mode has been disabled.
315
396
  */
316
- disableEditMode(): void;
397
+ disableEditMode(): boolean;
317
398
  /**
318
399
  * Check if the editor is edited.
319
400
  * @returns {boolean}
@@ -382,6 +463,19 @@ export class AnnotationEditor {
382
463
  */
383
464
  makeResizable(): void;
384
465
  get toolbarPosition(): null;
466
+ /**
467
+ * Get the position of the comment button.
468
+ * @returns {Array<number>|null}
469
+ */
470
+ get commentButtonPosition(): Array<number> | null;
471
+ get commentButtonPositionInPage(): number[];
472
+ get commentButtonColor(): any;
473
+ set commentPopupPosition(pos: any);
474
+ get commentPopupPosition(): any;
475
+ hasDefaultPopupPosition(): any;
476
+ get commentButtonWidth(): any;
477
+ get elementBeforePopup(): HTMLDivElement | null;
478
+ setCommentButtonStates(options: any): void;
385
479
  /**
386
480
  * onkeydown callback.
387
481
  * @param {KeyboardEvent} event
@@ -393,10 +487,12 @@ export class AnnotationEditor {
393
487
  * Select this editor.
394
488
  */
395
489
  select(): void;
490
+ focus(): void;
396
491
  /**
397
492
  * Unselect this editor.
398
493
  */
399
494
  unselect(): void;
495
+ hideCommentPopup(): void;
400
496
  /**
401
497
  * Update some parameters which have been changed through the UI.
402
498
  * @param {number} type
@@ -413,10 +509,22 @@ export class AnnotationEditor {
413
509
  * their properties.
414
510
  */
415
511
  enableEditing(): void;
512
+ /**
513
+ * Check if the content of this editor can be changed.
514
+ * For example, a FreeText editor can be changed (the user can change the
515
+ * text), but a Stamp editor cannot.
516
+ * @returns {boolean}
517
+ */
518
+ get canChangeContent(): boolean;
416
519
  /**
417
520
  * The editor is about to be edited.
418
521
  */
419
522
  enterInEditMode(): void;
523
+ /**
524
+ * ondblclick callback.
525
+ * @param {MouseEvent} event
526
+ */
527
+ dblclick(event: MouseEvent): void;
420
528
  /**
421
529
  * @returns {HTMLElement | null} the element requiring an alt text.
422
530
  */
@@ -436,12 +544,6 @@ export class AnnotationEditor {
436
544
  * @type {boolean}
437
545
  */
438
546
  get isEditing(): boolean;
439
- /**
440
- * Set the aspect ratio to use when resizing.
441
- * @param {number} width
442
- * @param {number} height
443
- */
444
- setAspectRatio(width: number, height: number): void;
445
547
  /**
446
548
  * Get the data to report to the telemetry when the editor is added.
447
549
  * @returns {Object}
@@ -460,6 +562,7 @@ export class AnnotationEditor {
460
562
  show(visible?: boolean | undefined): void;
461
563
  enable(): void;
462
564
  disable(): void;
565
+ updateFakeAnnotationElement(annotationLayer: any): void;
463
566
  /**
464
567
  * Render an annotation in the annotation layer.
465
568
  * @param {Object} annotation
@@ -471,4 +574,5 @@ export class AnnotationEditor {
471
574
  }
472
575
  import { AnnotationEditorUIManager } from "./tools.js";
473
576
  import { EditorToolbar } from "./toolbar.js";
577
+ import { Comment } from "./comment.js";
474
578
  import { ColorManager } from "./tools.js";
@@ -16,15 +16,20 @@ export class FreeTextEditor extends AnnotationEditor {
16
16
  static updateDefaultParams(type: any, value: any): void;
17
17
  /** @inheritdoc */
18
18
  static get defaultPropertiesToUpdate(): any[][];
19
- static "__#18@#getNodeContent"(node: any): any;
20
- static "__#18@#deserializeContent"(content: any): any;
19
+ static "__#private@#getNodeContent"(node: any): any;
20
+ static "__#private@#deserializeContent"(content: any): any;
21
21
  /** @inheritdoc */
22
22
  static deserialize(data: any, parent: any, uiManager: any): Promise<AnnotationEditor | null>;
23
23
  constructor(params: any);
24
+ _colorPicker: null;
25
+ color: any;
24
26
  /** @inheritdoc */
25
27
  updateParams(type: any, value: any): void;
26
28
  /** @inheritdoc */
27
29
  get propertiesToUpdate(): any[][];
30
+ /** @inheritdoc */
31
+ get toolbarButtons(): (string | null)[][];
32
+ get colorType(): number;
28
33
  /**
29
34
  * Helper to translate the editor with the keyboard when it's empty.
30
35
  * @param {number} x in page units.
@@ -38,11 +43,8 @@ export class FreeTextEditor extends AnnotationEditor {
38
43
  * @returns {undefined}
39
44
  */
40
45
  commit(): undefined;
41
- /**
42
- * ondblclick callback.
43
- * @param {MouseEvent} event
44
- */
45
- dblclick(event: MouseEvent): void;
46
+ /** @inheritdoc */
47
+ keydown(event: any): void;
46
48
  editorDivKeydown(event: any): void;
47
49
  editorDivFocus(event: any): void;
48
50
  editorDivBlur(event: any): void;
@@ -51,6 +53,8 @@ export class FreeTextEditor extends AnnotationEditor {
51
53
  overlayDiv: HTMLDivElement | undefined;
52
54
  editorDivPaste(event: any): void;
53
55
  /** @inheritdoc */
56
+ getPDFRect(): any[];
57
+ /** @inheritdoc */
54
58
  serialize(isForCopying?: boolean): Object | null;
55
59
  /** @inheritdoc */
56
60
  renderAnnotationElement(annotation: any): HTMLElement | null;
@@ -19,18 +19,19 @@ export class HighlightEditor extends AnnotationEditor {
19
19
  /** @inheritdoc */
20
20
  static updateDefaultParams(type: any, value: any): void;
21
21
  static get defaultPropertiesToUpdate(): (number | null)[][];
22
- static "__#24@#rotateBbox"([x, y, width, height]: [any, any, any, any], angle: any): any[];
22
+ static "__#private@#rotateBbox"([x, y, width, height]: [any, any, any, any], angle: any): any[];
23
23
  static startHighlighting(parent: any, isLTR: any, { target: textLayer, x, y }: {
24
24
  target: any;
25
25
  x: any;
26
26
  y: any;
27
27
  }): void;
28
- static "__#24@#highlightMove"(parent: any, event: any): void;
29
- static "__#24@#endHighlight"(parent: any, event: any): void;
28
+ static "__#private@#highlightMove"(parent: any, event: any): void;
29
+ static "__#private@#endHighlight"(parent: any, event: any): void;
30
30
  /** @inheritdoc */
31
31
  static deserialize(data: any, parent: any, uiManager: any): Promise<AnnotationEditor | null>;
32
32
  constructor(params: any);
33
33
  color: any;
34
+ opacity: any;
34
35
  defaultL10nId: string;
35
36
  /** @inheritdoc */
36
37
  get telemetryInitialData(): {
@@ -48,10 +49,14 @@ export class HighlightEditor extends AnnotationEditor {
48
49
  /** @inheritdoc */
49
50
  translateInPage(x: any, y: any): void;
50
51
  /** @inheritdoc */
52
+ get commentButtonPosition(): null;
53
+ /** @inheritdoc */
51
54
  updateParams(type: any, value: any): void;
52
55
  /** @inheritdoc */
53
56
  get propertiesToUpdate(): any[][];
54
57
  /** @inheritdoc */
58
+ get toolbarButtons(): any;
59
+ /** @inheritdoc */
55
60
  fixAndSetPosition(): void;
56
61
  /** @inheritdoc */
57
62
  getRect(tx: any, ty: any): any[];
@@ -22,6 +22,11 @@ export class InkEditor extends DrawingEditor {
22
22
  static deserializeDraw(pageX: any, pageY: any, pageWidth: any, pageHeight: any, innerMargin: any, data: any): any;
23
23
  defaultL10nId: string;
24
24
  /** @inheritdoc */
25
+ get toolbarButtons(): (string | null)[][];
26
+ get colorType(): number;
27
+ get color(): any;
28
+ get opacity(): any;
29
+ /** @inheritdoc */
25
30
  createDrawingOptions({ color, thickness, opacity }: {
26
31
  color: any;
27
32
  thickness: any;