unpdf 0.10.1 → 0.12.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 (62) hide show
  1. package/README.md +12 -8
  2. package/dist/index.cjs +15 -15
  3. package/dist/index.d.cts +32 -13
  4. package/dist/index.d.mts +32 -13
  5. package/dist/index.d.ts +32 -13
  6. package/dist/index.mjs +15 -15
  7. package/dist/pdfjs.d.mts +1 -0
  8. package/dist/pdfjs.d.ts +1 -0
  9. package/dist/pdfjs.mjs +1 -1
  10. package/dist/types/src/display/annotation_layer.d.ts +12 -5
  11. package/dist/types/src/display/annotation_storage.d.ts +10 -0
  12. package/dist/types/src/display/api.d.ts +95 -45
  13. package/dist/types/src/display/base_factory.d.ts +7 -1
  14. package/dist/types/src/display/canvas.d.ts +4 -0
  15. package/dist/types/src/display/display_utils.d.ts +6 -4
  16. package/dist/types/src/display/draw_layer.d.ts +12 -14
  17. package/dist/types/src/display/editor/alt_text.d.ts +33 -0
  18. package/dist/types/src/display/editor/annotation_editor_layer.d.ts +26 -2
  19. package/dist/types/src/display/editor/color_picker.d.ts +19 -0
  20. package/dist/types/src/display/editor/editor.d.ts +85 -16
  21. package/dist/types/src/display/editor/freetext.d.ts +6 -1
  22. package/dist/types/src/display/editor/highlight.d.ts +88 -0
  23. package/dist/types/src/display/editor/ink.d.ts +5 -4
  24. package/dist/types/src/display/editor/outliner.d.ts +53 -9
  25. package/dist/types/src/display/editor/stamp.d.ts +22 -1
  26. package/dist/types/src/display/editor/toolbar.d.ts +10 -1
  27. package/dist/types/src/display/editor/tools.d.ts +56 -6
  28. package/dist/types/src/display/fetch_stream.d.ts +3 -4
  29. package/dist/types/src/display/font_loader.d.ts +1 -5
  30. package/dist/types/src/display/network.d.ts +2 -3
  31. package/dist/types/src/display/node_stream.d.ts +5 -6
  32. package/dist/types/src/display/node_utils.d.ts +6 -5
  33. package/dist/types/src/display/optional_content_config.d.ts +6 -1
  34. package/dist/types/src/display/text_layer.d.ts +37 -106
  35. package/dist/types/src/display/transport_stream.d.ts +3 -7
  36. package/dist/types/src/display/worker_options.d.ts +20 -22
  37. package/dist/types/src/pdf.d.ts +3 -6
  38. package/dist/types/src/shared/util.d.ts +24 -22
  39. package/dist/types/web/annotation_editor_layer_builder.d.ts +10 -13
  40. package/dist/types/web/annotation_layer_builder.d.ts +8 -4
  41. package/dist/types/web/app_options.d.ts +5 -4
  42. package/dist/types/web/download_manager.d.ts +1 -2
  43. package/dist/types/web/draw_layer_builder.d.ts +23 -0
  44. package/dist/types/web/event_utils.d.ts +8 -6
  45. package/dist/types/web/genericl10n.d.ts +5 -3
  46. package/dist/types/web/interfaces.d.ts +10 -14
  47. package/dist/types/web/l10n.d.ts +7 -2
  48. package/dist/types/web/pdf_find_controller.d.ts +25 -2
  49. package/dist/types/web/pdf_history.d.ts +1 -53
  50. package/dist/types/web/pdf_link_service.d.ts +4 -107
  51. package/dist/types/web/pdf_page_view.d.ts +16 -21
  52. package/dist/types/web/pdf_scripting_manager.d.ts +6 -10
  53. package/dist/types/web/pdf_thumbnail_view.d.ts +11 -15
  54. package/dist/types/web/pdf_thumbnail_viewer.d.ts +16 -17
  55. package/dist/types/web/pdf_viewer.component.d.ts +1 -2
  56. package/dist/types/web/pdf_viewer.d.ts +67 -35
  57. package/dist/types/web/text_accessibility.d.ts +1 -1
  58. package/dist/types/web/text_highlighter.d.ts +1 -1
  59. package/dist/types/web/text_layer_builder.d.ts +17 -29
  60. package/dist/types/web/ui_utils.d.ts +7 -2
  61. package/package.json +24 -23
  62. package/dist/types/web/l10n_utils.d.ts +0 -9
@@ -0,0 +1,33 @@
1
+ export class AltText {
2
+ static _l10nPromise: null;
3
+ static initialize(l10nPromise: any): void;
4
+ constructor(editor: any);
5
+ render(): Promise<HTMLButtonElement>;
6
+ finish(): void;
7
+ isEmpty(): boolean;
8
+ hasData(): boolean;
9
+ get guessedText(): null;
10
+ setGuessedText(guessedText: any): Promise<void>;
11
+ toggleAltTextBadge(visibility?: boolean): void;
12
+ serialize(isForCopying: any): {
13
+ altText: null;
14
+ decorative: boolean;
15
+ guessedText: null;
16
+ textWithDisclaimer: null;
17
+ };
18
+ /**
19
+ * Set the alt text data.
20
+ */
21
+ set data({ altText, decorative, guessedText, textWithDisclaimer, cancel, }: {
22
+ altText: null;
23
+ decorative: boolean;
24
+ });
25
+ get data(): {
26
+ altText: null;
27
+ decorative: boolean;
28
+ };
29
+ toggle(enabled?: boolean): void;
30
+ shown(): void;
31
+ destroy(): void;
32
+ #private;
33
+ }
@@ -3,6 +3,7 @@ export type PageViewport = import("../display_utils.js").PageViewport;
3
3
  export type TextAccessibilityManager = import("../../../web/text_accessibility.js").TextAccessibilityManager;
4
4
  export type IL10n = import("../../../web/interfaces").IL10n;
5
5
  export type AnnotationLayer = import("../annotation_layer.js").AnnotationLayer;
6
+ export type DrawLayer = import("../draw_layer.js").DrawLayer;
6
7
  export type AnnotationEditorLayerOptions = {
7
8
  mode: Object;
8
9
  div: HTMLDivElement;
@@ -12,6 +13,8 @@ export type AnnotationEditorLayerOptions = {
12
13
  pageIndex: number;
13
14
  l10n: IL10n;
14
15
  annotationLayer?: import("../annotation_layer.js").AnnotationLayer | undefined;
16
+ textLayer?: HTMLDivElement | undefined;
17
+ drawLayer: DrawLayer;
15
18
  viewport: PageViewport;
16
19
  };
17
20
  export type RenderEditorLayerOptions = {
@@ -27,6 +30,8 @@ export type RenderEditorLayerOptions = {
27
30
  * @property {number} pageIndex
28
31
  * @property {IL10n} l10n
29
32
  * @property {AnnotationLayer} [annotationLayer]
33
+ * @property {HTMLDivElement} [textLayer]
34
+ * @property {DrawLayer} drawLayer
30
35
  * @property {PageViewport} viewport
31
36
  */
32
37
  /**
@@ -38,15 +43,17 @@ export type RenderEditorLayerOptions = {
38
43
  */
39
44
  export class AnnotationEditorLayer {
40
45
  static _initialized: boolean;
41
- static "__#18@#editorTypes": Map<number, typeof FreeTextEditor | typeof InkEditor | typeof StampEditor>;
46
+ static "__#28@#editorTypes": Map<number, typeof FreeTextEditor | typeof HighlightEditor | typeof InkEditor | typeof StampEditor>;
42
47
  /**
43
48
  * @param {AnnotationEditorLayerOptions} options
44
49
  */
45
- constructor({ uiManager, pageIndex, div, accessibilityManager, annotationLayer, viewport, l10n, }: AnnotationEditorLayerOptions);
50
+ constructor({ uiManager, pageIndex, div, accessibilityManager, annotationLayer, drawLayer, textLayer, viewport, l10n, }: AnnotationEditorLayerOptions);
46
51
  pageIndex: number;
47
52
  div: HTMLDivElement;
48
53
  viewport: import("../display_utils.js").PageViewport;
54
+ drawLayer: import("../draw_layer.js").DrawLayer;
49
55
  get isEmpty(): boolean;
56
+ get isInvisible(): boolean;
50
57
  /**
51
58
  * Update the toolbar if it's required to reflect the tool currently used.
52
59
  * @param {number} mode
@@ -57,6 +64,7 @@ export class AnnotationEditorLayer {
57
64
  * @param {number} mode
58
65
  */
59
66
  updateMode(mode?: number): void;
67
+ hasTextLayer(textLayer: any): boolean;
60
68
  addInkEditorIfNeeded(isCommitting: any): void;
61
69
  /**
62
70
  * Set the editing state.
@@ -68,7 +76,9 @@ export class AnnotationEditorLayer {
68
76
  * @param {Object} params
69
77
  */
70
78
  addCommands(params: Object): void;
79
+ toggleDrawing(enabled?: boolean): void;
71
80
  togglePointerEvents(enabled?: boolean): void;
81
+ toggleAnnotationLayerPointerEvents(enabled?: boolean): void;
72
82
  /**
73
83
  * Enable pointer events on the main div in order to enable
74
84
  * editor creation.
@@ -84,6 +94,8 @@ export class AnnotationEditorLayer {
84
94
  * @param {AnnotationEditor} editor
85
95
  */
86
96
  setActiveEditor(editor: AnnotationEditor): void;
97
+ enableTextSelection(): void;
98
+ disableTextSelection(): void;
87
99
  enableClick(): void;
88
100
  disableClick(): void;
89
101
  attach(editor: any): void;
@@ -120,6 +132,8 @@ export class AnnotationEditorLayer {
120
132
  * @returns {string}
121
133
  */
122
134
  getNextId(): string;
135
+ combinedSignal(ac: any): AbortSignal;
136
+ canCreateNewEmptyEditor(): boolean | undefined;
123
137
  /**
124
138
  * Paste some content into a new editor.
125
139
  * @param {number} mode
@@ -132,6 +146,14 @@ export class AnnotationEditorLayer {
132
146
  * @returns {AnnotationEditor | null}
133
147
  */
134
148
  deserialize(data: Object): AnnotationEditor | null;
149
+ /**
150
+ * Create and add a new editor.
151
+ * @param {PointerEvent} event
152
+ * @param {boolean} isCentered
153
+ * @param [Object] data
154
+ * @returns {AnnotationEditor}
155
+ */
156
+ createAndAddNewEditor(event: PointerEvent, isCentered: boolean, data?: {}): AnnotationEditor;
135
157
  /**
136
158
  * Create and add a new editor.
137
159
  */
@@ -193,9 +215,11 @@ export class AnnotationEditorLayer {
193
215
  * @returns {Object} dimensions.
194
216
  */
195
217
  get pageDimensions(): Object;
218
+ get scale(): number;
196
219
  #private;
197
220
  }
198
221
  import { AnnotationEditor } from "./editor.js";
199
222
  import { FreeTextEditor } from "./freetext.js";
223
+ import { HighlightEditor } from "./highlight.js";
200
224
  import { InkEditor } from "./ink.js";
201
225
  import { StampEditor } from "./stamp.js";
@@ -0,0 +1,19 @@
1
+ export class ColorPicker {
2
+ static get _keyboardManager(): any;
3
+ constructor({ editor, uiManager }: {
4
+ editor?: null | undefined;
5
+ uiManager?: null | undefined;
6
+ });
7
+ renderButton(): HTMLButtonElement;
8
+ renderMainDropdown(): HTMLDivElement;
9
+ _colorSelectFromKeyboard(event: any): void;
10
+ _moveToNext(event: any): void;
11
+ _moveToPrevious(event: any): void;
12
+ _moveToBeginning(event: any): void;
13
+ _moveToEnd(event: any): void;
14
+ hideDropdown(): void;
15
+ _hideDropdownFromKeyboard(): void;
16
+ updateColor(color: any): void;
17
+ destroy(): void;
18
+ #private;
19
+ }
@@ -33,10 +33,12 @@ export type AnnotationEditorParameters = {
33
33
  * Base class for editors.
34
34
  */
35
35
  export class AnnotationEditor {
36
+ static _l10nPromise: null;
37
+ static _l10nResizer: null;
36
38
  static _borderLineWidth: number;
37
39
  static _colorManager: ColorManager;
38
40
  static _zIndex: number;
39
- static SMALL_EDITOR_SIZE: number;
41
+ static _telemetryTimeout: number;
40
42
  static get _resizerKeyboardManager(): any;
41
43
  static get _defaultLineColor(): any;
42
44
  static deleteAnnotationElement(editor: any): void;
@@ -44,7 +46,7 @@ export class AnnotationEditor {
44
46
  * Initialize the l10n stuff for this type of editor.
45
47
  * @param {Object} l10n
46
48
  */
47
- static initialize(l10n: Object, options?: null): void;
49
+ static initialize(l10n: Object, _uiManager: any, options: any): void;
48
50
  /**
49
51
  * Update the default parameters for this type of editor.
50
52
  * @param {number} _type
@@ -70,7 +72,7 @@ export class AnnotationEditor {
70
72
  * @param {AnnotationEditorLayer} parent
71
73
  */
72
74
  static paste(item: DataTransferItem, parent: AnnotationEditorLayer): void;
73
- static "__#25@#rotatePoint"(x: any, y: any, angle: any): any[];
75
+ static "__#35@#rotatePoint"(x: any, y: any, angle: any): any[];
74
76
  /**
75
77
  * Deserialize the editor.
76
78
  * The result of the deserialization is a new editor.
@@ -82,14 +84,16 @@ export class AnnotationEditor {
82
84
  */
83
85
  static deserialize(data: Object, parent: AnnotationEditorLayer, uiManager: AnnotationEditorUIManager): AnnotationEditor | null;
84
86
  static get MIN_SIZE(): number;
87
+ static canCreateNewEmptyEditor(): boolean;
85
88
  /**
86
89
  * @param {AnnotationEditorParameters} parameters
87
90
  */
88
91
  constructor(parameters: AnnotationEditorParameters);
92
+ _editToolbar: null;
89
93
  _initialOptions: any;
94
+ _isVisible: boolean;
90
95
  _uiManager: null;
91
96
  _focusEventsAllowed: boolean;
92
- _l10nPromise: null;
93
97
  parent: import("./annotation_editor_layer.js").AnnotationEditorLayer;
94
98
  id: string;
95
99
  width: any;
@@ -173,7 +177,25 @@ export class AnnotationEditor {
173
177
  */
174
178
  translateInPage(x: number, y: number): void;
175
179
  drag(tx: any, ty: any): void;
176
- fixAndSetPosition(): void;
180
+ get _hasBeenMoved(): boolean;
181
+ /**
182
+ * Get the translation to take into account the editor border.
183
+ * The CSS engine positions the element by taking the border into account so
184
+ * we must apply the opposite translation to have the editor in the right
185
+ * position.
186
+ * @returns {Array<number>}
187
+ */
188
+ getBaseTranslation(): Array<number>;
189
+ /**
190
+ * @returns {boolean} true if position must be fixed (i.e. make the x and y
191
+ * living in the page).
192
+ */
193
+ get _mustFixPosition(): boolean;
194
+ /**
195
+ * Fix the position of the editor in order to keep it inside its parent page.
196
+ * @param {number} [rotation] - the rotation of the page.
197
+ */
198
+ fixAndSetPosition(rotation?: number | undefined): void;
177
199
  /**
178
200
  * Convert a screen translation into a page one.
179
201
  * @param {number} x
@@ -201,22 +223,28 @@ export class AnnotationEditor {
201
223
  * @returns {Array<number>}
202
224
  */
203
225
  getInitialTranslation(): Array<number>;
204
- addAltTextButton(): Promise<void>;
226
+ /**
227
+ * Called when the alt text dialog is closed.
228
+ */
205
229
  altTextFinish(): void;
206
- addEditToolbar(): void;
230
+ /**
231
+ * Add a toolbar for this editor.
232
+ * @returns {Promise<EditorToolbar|null>}
233
+ */
234
+ addEditToolbar(): Promise<EditorToolbar | null>;
207
235
  removeEditToolbar(): void;
208
236
  getClientDimensions(): DOMRect;
237
+ addAltTextButton(): Promise<void>;
209
238
  /**
210
239
  * Set the alt text data.
211
240
  */
212
- set altTextData({ altText, decorative }: {
213
- altText: string;
214
- decorative: boolean;
215
- });
216
- get altTextData(): {
217
- altText: string;
218
- decorative: boolean;
219
- };
241
+ set altTextData(data: any);
242
+ get altTextData(): any;
243
+ get guessedAltText(): any;
244
+ setGuessedAltText(text: any): Promise<void>;
245
+ serializeAltText(isForCopying: any): any;
246
+ hasAltText(): boolean;
247
+ hasAltTextData(): any;
220
248
  /**
221
249
  * Render this editor in a div.
222
250
  * @returns {HTMLDivElement | null}
@@ -231,8 +259,11 @@ export class AnnotationEditor {
231
259
  _setParentAndPosition(parent: any, x: any, y: any): void;
232
260
  /**
233
261
  * Convert the current rect into a page one.
262
+ * @param {number} tx - x-translation in screen coordinates.
263
+ * @param {number} ty - y-translation in screen coordinates.
264
+ * @param {number} [rotation] - the rotation of the page.
234
265
  */
235
- getRect(tx: any, ty: any): any[];
266
+ getRect(tx: number, ty: number, rotation?: number | undefined): any[];
236
267
  getRectInCurrentCoords(rect: any, pageHeight: any): any[];
237
268
  /**
238
269
  * Executed once this editor has been rendered.
@@ -273,6 +304,11 @@ export class AnnotationEditor {
273
304
  * To implement in subclasses.
274
305
  */
275
306
  rebuild(): void;
307
+ /**
308
+ * Rotate the editor.
309
+ * @param {number} angle
310
+ */
311
+ rotate(_angle: any): void;
276
312
  /**
277
313
  * Serialize the editor.
278
314
  * The result of the serialization will be used to construct a
@@ -284,6 +320,12 @@ export class AnnotationEditor {
284
320
  * @returns {Object | null}
285
321
  */
286
322
  serialize(isForCopying?: boolean | undefined, context?: Object | null | undefined): Object | null;
323
+ /**
324
+ * Check if an existing annotation associated with this editor has been
325
+ * modified.
326
+ * @returns {boolean}
327
+ */
328
+ get hasBeenModified(): boolean;
287
329
  /**
288
330
  * Remove this editor.
289
331
  * It's used on ctrl+backspace action.
@@ -297,6 +339,7 @@ export class AnnotationEditor {
297
339
  * Add the resizers to this editor.
298
340
  */
299
341
  makeResizable(): void;
342
+ get toolbarPosition(): null;
300
343
  /**
301
344
  * onkeydown callback.
302
345
  * @param {KeyboardEvent} event
@@ -357,7 +400,33 @@ export class AnnotationEditor {
357
400
  * @param {number} height
358
401
  */
359
402
  setAspectRatio(width: number, height: number): void;
403
+ /**
404
+ * Get the data to report to the telemetry when the editor is added.
405
+ * @returns {Object}
406
+ */
407
+ get telemetryInitialData(): Object;
408
+ /**
409
+ * The telemetry data to use when saving/printing.
410
+ * @returns {Object|null}
411
+ */
412
+ get telemetryFinalData(): Object | null;
413
+ _reportTelemetry(data: any, mustWait?: boolean): void;
414
+ /**
415
+ * Show or hide this editor.
416
+ * @param {boolean|undefined} visible
417
+ */
418
+ show(visible?: boolean | undefined): void;
419
+ enable(): void;
420
+ disable(): void;
421
+ /**
422
+ * Render an annotation in the annotation layer.
423
+ * @param {Object} annotation
424
+ * @returns {HTMLElement}
425
+ */
426
+ renderAnnotationElement(annotation: Object): HTMLElement;
427
+ resetAnnotationElement(annotation: any): void;
360
428
  #private;
361
429
  }
362
430
  import { AnnotationEditorUIManager } from "./tools.js";
431
+ import { EditorToolbar } from "./toolbar.js";
363
432
  import { ColorManager } from "./tools.js";
@@ -11,11 +11,13 @@ export class FreeTextEditor extends AnnotationEditor {
11
11
  static _type: string;
12
12
  static _editorType: number;
13
13
  /** @inheritdoc */
14
- static initialize(l10n: any): void;
14
+ static initialize(l10n: any, uiManager: any): void;
15
15
  /** @inheritdoc */
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
21
  /** @inheritdoc */
20
22
  static deserialize(data: any, parent: any, uiManager: any): AnnotationEditor | null;
21
23
  constructor(params: any);
@@ -45,6 +47,7 @@ export class FreeTextEditor extends AnnotationEditor {
45
47
  editorDivInput(event: any): void;
46
48
  editorDiv: HTMLDivElement | undefined;
47
49
  overlayDiv: HTMLDivElement | undefined;
50
+ editorDivPaste(event: any): void;
48
51
  /** @inheritdoc */
49
52
  serialize(isForCopying?: boolean): {
50
53
  annotationType: number;
@@ -60,6 +63,8 @@ export class FreeTextEditor extends AnnotationEditor {
60
63
  id: any;
61
64
  deleted: boolean;
62
65
  } | null;
66
+ /** @inheritdoc */
67
+ renderAnnotationElement(annotation: any): HTMLElement;
63
68
  #private;
64
69
  }
65
70
  import { AnnotationEditor } from "./editor.js";
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Basic draw editor in order to generate an Highlight annotation.
3
+ */
4
+ export class HighlightEditor extends AnnotationEditor {
5
+ static _defaultColor: null;
6
+ static _defaultOpacity: number;
7
+ static _defaultThickness: number;
8
+ static _l10nPromise: any;
9
+ static _type: string;
10
+ static _editorType: number;
11
+ static _freeHighlightId: number;
12
+ static _freeHighlight: null;
13
+ static _freeHighlightClipId: string;
14
+ static get _keyboardManager(): any;
15
+ static computeTelemetryFinalData(data: any): {
16
+ numberOfColors: any;
17
+ };
18
+ /** @inheritdoc */
19
+ static initialize(l10n: any, uiManager: any): void;
20
+ /** @inheritdoc */
21
+ static updateDefaultParams(type: any, value: any): void;
22
+ static get defaultPropertiesToUpdate(): (number | null)[][];
23
+ static "__#24@#rotateBbox"({ x, y, width, height }: {
24
+ x: any;
25
+ y: any;
26
+ width: any;
27
+ height: any;
28
+ }, angle: any): {
29
+ x: any;
30
+ y: any;
31
+ width: any;
32
+ height: any;
33
+ };
34
+ static startHighlighting(parent: any, isLTR: any, { target: textLayer, x, y }: {
35
+ target: any;
36
+ x: any;
37
+ y: any;
38
+ }): void;
39
+ static "__#24@#highlightMove"(parent: any, event: any): void;
40
+ static "__#24@#endHighlight"(parent: any, event: any): void;
41
+ /** @inheritdoc */
42
+ static deserialize(data: any, parent: any, uiManager: any): AnnotationEditor | null;
43
+ constructor(params: any);
44
+ color: any;
45
+ /** @inheritdoc */
46
+ get telemetryInitialData(): {
47
+ action: string;
48
+ type: string;
49
+ color: any;
50
+ thickness: any;
51
+ methodOfCreation: string;
52
+ };
53
+ /** @inheritdoc */
54
+ get telemetryFinalData(): {
55
+ type: string;
56
+ color: any;
57
+ };
58
+ /** @inheritdoc */
59
+ translateInPage(x: any, y: any): void;
60
+ /** @inheritdoc */
61
+ updateParams(type: any, value: any): void;
62
+ /** @inheritdoc */
63
+ get propertiesToUpdate(): any[][];
64
+ /** @inheritdoc */
65
+ fixAndSetPosition(): void;
66
+ /** @inheritdoc */
67
+ getRect(tx: any, ty: any): any[];
68
+ /** @inheritdoc */
69
+ rotate(angle: any): void;
70
+ pointerover(): void;
71
+ pointerleave(): void;
72
+ _moveCaret(direction: any): void;
73
+ /** @inheritdoc */
74
+ serialize(isForCopying?: boolean): {
75
+ annotationType: number;
76
+ color: number[];
77
+ opacity: any;
78
+ thickness: any;
79
+ quadPoints: Float32Array | null;
80
+ outlines: any;
81
+ pageIndex: number;
82
+ rect: any[];
83
+ rotation: number;
84
+ structTreeParentId: any;
85
+ } | null;
86
+ #private;
87
+ }
88
+ import { AnnotationEditor } from "./editor.js";
@@ -8,7 +8,7 @@ export class InkEditor extends AnnotationEditor {
8
8
  static _type: string;
9
9
  static _editorType: number;
10
10
  /** @inheritdoc */
11
- static initialize(l10n: any): void;
11
+ static initialize(l10n: any, uiManager: any): void;
12
12
  /** @inheritdoc */
13
13
  static updateDefaultParams(type: any, value: any): void;
14
14
  /** @inheritdoc */
@@ -18,9 +18,9 @@ export class InkEditor extends AnnotationEditor {
18
18
  * @param {Array<Array<number>>} bezier
19
19
  * @returns {Path2D}
20
20
  */
21
- static "__#16@#buildPath2D"(bezier: Array<Array<number>>): Path2D;
22
- static "__#16@#toPDFCoordinates"(points: any, rect: any, rotation: any): any;
23
- static "__#16@#fromPDFCoordinates"(points: any, rect: any, rotation: any): any;
21
+ static "__#25@#buildPath2D"(bezier: Array<Array<number>>): Path2D;
22
+ static "__#25@#toPDFCoordinates"(points: any, rect: any, rotation: any): any;
23
+ static "__#25@#fromPDFCoordinates"(points: any, rect: any, rotation: any): any;
24
24
  /** @inheritdoc */
25
25
  static deserialize(data: any, parent: any, uiManager: any): AnnotationEditor | null;
26
26
  constructor(params: any);
@@ -40,6 +40,7 @@ export class InkEditor extends AnnotationEditor {
40
40
  get propertiesToUpdate(): any[][];
41
41
  canvas: HTMLCanvasElement | null | undefined;
42
42
  onScaleChanging(): void;
43
+ pointerdownAC: any;
43
44
  /**
44
45
  * onpointerdown callback for the canvas we're drawing on.
45
46
  * @param {PointerEvent} event
@@ -1,3 +1,21 @@
1
+ export class FreeOutliner {
2
+ static "__#21@#MIN_DIST": number;
3
+ static "__#21@#MIN_DIFF": number;
4
+ static "__#21@#MIN": number;
5
+ constructor({ x, y }: {
6
+ x: any;
7
+ y: any;
8
+ }, box: any, scaleFactor: any, thickness: any, isLTR: any, innerMargin?: number);
9
+ get free(): boolean;
10
+ isEmpty(): boolean;
11
+ add({ x, y }: {
12
+ x: any;
13
+ y: any;
14
+ }): boolean;
15
+ toSVGPath(): string;
16
+ getOutlines(): FreeHighlightOutline;
17
+ #private;
18
+ }
1
19
  export class Outliner {
2
20
  /**
3
21
  * Construct an outliner.
@@ -12,15 +30,41 @@ export class Outliner {
12
30
  * the last point of the boxes.
13
31
  */
14
32
  constructor(boxes: Array<Object>, borderWidth?: number, innerMargin?: number, isLTR?: boolean);
15
- getOutlines(): {
16
- outlines: any[][];
17
- box: {
18
- x: number;
19
- y: number;
20
- width: number;
21
- height: number;
22
- lastPoint: any[];
23
- };
33
+ getOutlines(): HighlightOutline;
34
+ #private;
35
+ }
36
+ declare class FreeHighlightOutline extends Outline {
37
+ constructor(outline: any, points: any, box: any, scaleFactor: any, innerMargin: any, isLTR: any);
38
+ serialize([blX, blY, trX, trY]: [any, any, any, any], rotation: any): {
39
+ outline: number[];
40
+ points: number[][];
24
41
  };
42
+ get box(): null;
43
+ getNewOutline(thickness: any, innerMargin: any): FreeHighlightOutline;
25
44
  #private;
26
45
  }
46
+ declare class HighlightOutline extends Outline {
47
+ constructor(outlines: any, box: any);
48
+ /**
49
+ * Serialize the outlines into the PDF page coordinate system.
50
+ * @param {Array<number>} _bbox - the bounding box of the annotation.
51
+ * @param {number} _rotation - the rotation of the annotation.
52
+ * @returns {Array<Array<number>>}
53
+ */
54
+ serialize([blX, blY, trX, trY]: Array<number>, _rotation: number): Array<Array<number>>;
55
+ get box(): any;
56
+ #private;
57
+ }
58
+ declare class Outline {
59
+ /**
60
+ * @returns {string} The SVG path of the outline.
61
+ */
62
+ toSVGPath(): string;
63
+ /**
64
+ * @type {Object|null} The bounding box of the outline.
65
+ */
66
+ get box(): Object | null;
67
+ serialize(_bbox: any, _rotation: any): void;
68
+ get free(): any;
69
+ }
70
+ export {};
@@ -5,17 +5,38 @@ export class StampEditor extends AnnotationEditor {
5
5
  static _type: string;
6
6
  static _editorType: number;
7
7
  /** @inheritdoc */
8
- static initialize(l10n: any): void;
8
+ static initialize(l10n: any, uiManager: any): void;
9
9
  static get supportedTypes(): any;
10
10
  static get supportedTypesStr(): any;
11
11
  /** @inheritdoc */
12
12
  static isHandlingMimeForPasting(mime: any): any;
13
13
  /** @inheritdoc */
14
14
  static paste(item: any, parent: any): void;
15
+ static computeTelemetryFinalData(data: any): {
16
+ hasAltText: any;
17
+ hasNoAltText: any;
18
+ };
15
19
  /** @inheritdoc */
16
20
  static deserialize(data: any, parent: any, uiManager: any): AnnotationEditor | null;
17
21
  constructor(params: any);
18
22
  /** @inheritdoc */
23
+ get telemetryFinalData(): {
24
+ type: string;
25
+ hasAltText: boolean;
26
+ };
27
+ mlGuessAltText(imageData?: null, updateAltTextData?: boolean): Promise<any>;
28
+ copyCanvas(maxDimension: any, createImageData?: boolean): {
29
+ canvas: HTMLCanvasElement;
30
+ imageData: {
31
+ width: any;
32
+ height: any;
33
+ data: Uint8ClampedArray;
34
+ };
35
+ } | {
36
+ canvas: HTMLCanvasElement;
37
+ imageData: null;
38
+ };
39
+ /** @inheritdoc */
19
40
  getImageForAltText(): null;
20
41
  /** @inheritdoc */
21
42
  serialize(isForCopying?: boolean, context?: null): {
@@ -1,9 +1,18 @@
1
1
  export class EditorToolbar {
2
- static "__#24@#pointerDown"(e: any): void;
2
+ static "__#4@#l10nRemove": null;
3
+ static "__#4@#pointerDown"(e: any): void;
3
4
  constructor(editor: any);
4
5
  render(): HTMLDivElement;
5
6
  hide(): void;
6
7
  show(): void;
8
+ addAltText(altText: any): Promise<void>;
9
+ addColorPicker(colorPicker: any): void;
7
10
  remove(): void;
8
11
  #private;
9
12
  }
13
+ export class HighlightToolbar {
14
+ constructor(uiManager: any);
15
+ show(parent: any, boxes: any, isLTR: any): void;
16
+ hide(): void;
17
+ #private;
18
+ }