unpdf 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +14 -12
  2. package/dist/index.cjs +10 -16
  3. package/dist/index.d.cts +2 -0
  4. package/dist/index.d.mts +2 -0
  5. package/dist/index.d.ts +2 -0
  6. package/dist/index.mjs +10 -16
  7. package/dist/pdfjs.mjs +1 -1
  8. package/dist/types/src/display/annotation_layer.d.ts +14 -7
  9. package/dist/types/src/display/annotation_storage.d.ts +4 -4
  10. package/dist/types/src/display/api.d.ts +14 -9
  11. package/dist/types/src/display/content_disposition.d.ts +7 -0
  12. package/dist/types/src/display/display_utils.d.ts +2 -5
  13. package/dist/types/src/display/editor/annotation_editor_layer.d.ts +13 -8
  14. package/dist/types/src/display/editor/editor.d.ts +51 -15
  15. package/dist/types/src/display/editor/freetext.d.ts +2 -9
  16. package/dist/types/src/display/editor/ink.d.ts +6 -12
  17. package/dist/types/src/display/editor/stamp.d.ts +5 -1
  18. package/dist/types/src/display/editor/tools.d.ts +15 -4
  19. package/dist/types/src/display/fetch_stream.d.ts +68 -0
  20. package/dist/types/src/display/font_loader.d.ts +4 -1
  21. package/dist/types/src/display/network.d.ts +83 -0
  22. package/dist/types/src/display/network_utils.d.ts +14 -0
  23. package/dist/types/src/display/node_stream.d.ts +71 -0
  24. package/dist/types/src/display/node_utils.d.ts +27 -0
  25. package/dist/types/src/display/transport_stream.d.ts +3 -0
  26. package/dist/types/src/display/xfa_layer.d.ts +2 -1
  27. package/dist/types/src/display/xfa_text.d.ts +2 -0
  28. package/dist/types/src/interfaces.d.ts +118 -0
  29. package/dist/types/src/pdf.d.ts +3 -3
  30. package/dist/types/src/shared/util.d.ts +1 -0
  31. package/dist/types/web/annotation_editor_layer_builder.d.ts +8 -5
  32. package/dist/types/web/annotation_layer_builder.d.ts +12 -17
  33. package/dist/types/web/app_options.d.ts +2 -1
  34. package/dist/types/web/download_manager.d.ts +1 -1
  35. package/dist/types/web/generic_scripting.d.ts +1 -1
  36. package/dist/types/web/genericl10n.d.ts +14 -7
  37. package/dist/types/web/interfaces.d.ts +16 -8
  38. package/dist/types/web/l10n.d.ts +27 -0
  39. package/dist/types/web/l10n_utils.d.ts +7 -5
  40. package/dist/types/web/pdf_find_controller.d.ts +2 -1
  41. package/dist/types/web/pdf_link_service.d.ts +1 -1
  42. package/dist/types/web/pdf_page_view.d.ts +9 -7
  43. package/dist/types/web/pdf_thumbnail_view.d.ts +8 -15
  44. package/dist/types/web/pdf_thumbnail_viewer.d.ts +2 -8
  45. package/dist/types/web/pdf_viewer.d.ts +20 -14
  46. package/dist/types/web/text_accessibility.d.ts +5 -3
  47. package/dist/types/web/text_layer_builder.d.ts +7 -2
  48. package/dist/types/web/ui_utils.d.ts +5 -9
  49. package/dist/types/web/xfa_layer_builder.d.ts +4 -6
  50. package/package.json +18 -18
  51. package/dist/types/external/webL10n/l10n.d.ts +0 -0
@@ -1,12 +1,13 @@
1
1
  export type PDFPageProxy = import("./api").PDFPageProxy;
2
2
  export type PageViewport = import("./display_utils").PageViewport;
3
- export type IDownloadManager = any;
3
+ export type TextAccessibilityManager = import("../../web/text_accessibility.js").TextAccessibilityManager;
4
+ export type IDownloadManager = import("../../web/interfaces").IDownloadManager;
4
5
  export type IPDFLinkService = import("../../web/interfaces").IPDFLinkService;
5
6
  export type AnnotationElementParameters = {
6
7
  data: Object;
7
8
  layer: HTMLDivElement;
8
9
  linkService: IPDFLinkService;
9
- downloadManager: any;
10
+ downloadManager?: import("../../web/interfaces").IDownloadManager | undefined;
10
11
  annotationStorage?: AnnotationStorage | undefined;
11
12
  /**
12
13
  * - Path for image resources, mainly
@@ -25,7 +26,7 @@ export type AnnotationLayerParameters = {
25
26
  annotations: any[];
26
27
  page: PDFPageProxy;
27
28
  linkService: IPDFLinkService;
28
- downloadManager: any;
29
+ downloadManager: IDownloadManager;
29
30
  annotationStorage?: AnnotationStorage | undefined;
30
31
  /**
31
32
  * - Path for image resources, mainly
@@ -46,7 +47,7 @@ export type AnnotationLayerParameters = {
46
47
  [x: string]: Object[];
47
48
  } | null | undefined;
48
49
  annotationCanvasMap?: Map<string, HTMLCanvasElement> | undefined;
49
- accessibilityManager?: any;
50
+ accessibilityManager?: import("../../web/text_accessibility.js").TextAccessibilityManager | undefined;
50
51
  };
51
52
  /**
52
53
  * @typedef {Object} AnnotationLayerParameters
@@ -71,16 +72,14 @@ export type AnnotationLayerParameters = {
71
72
  * Manage the layer containing all the annotations.
72
73
  */
73
74
  export class AnnotationLayer {
74
- constructor({ div, accessibilityManager, annotationCanvasMap, l10n, page, viewport, }: {
75
+ constructor({ div, accessibilityManager, annotationCanvasMap, page, viewport, }: {
75
76
  div: any;
76
77
  accessibilityManager: any;
77
78
  annotationCanvasMap: any;
78
- l10n: any;
79
79
  page: any;
80
80
  viewport: any;
81
81
  });
82
82
  div: any;
83
- l10n: any;
84
83
  page: any;
85
84
  viewport: any;
86
85
  zIndex: number;
@@ -109,6 +108,7 @@ export class FreeTextAnnotationElement extends AnnotationElement {
109
108
  textPosition: any;
110
109
  annotationEditorType: number;
111
110
  render(): HTMLElement | undefined;
111
+ get _isEditable(): any;
112
112
  }
113
113
  export class InkAnnotationElement extends AnnotationElement {
114
114
  constructor(parameters: any);
@@ -125,6 +125,11 @@ export class StampAnnotationElement extends AnnotationElement {
125
125
  }
126
126
  import { AnnotationStorage } from "./annotation_storage.js";
127
127
  declare class AnnotationElement {
128
+ static _hasPopupData({ titleObj, contentsObj, richText }: {
129
+ titleObj: any;
130
+ contentsObj: any;
131
+ richText: any;
132
+ }): boolean;
128
133
  constructor(parameters: any, { isRenderable, ignoreBorder, createQuadrilaterals, }?: {
129
134
  isRenderable?: boolean | undefined;
130
135
  ignoreBorder?: boolean | undefined;
@@ -144,6 +149,7 @@ declare class AnnotationElement {
144
149
  _fieldObjects: any;
145
150
  parent: any;
146
151
  container: HTMLElement | undefined;
152
+ get hasPopupData(): boolean;
147
153
  /**
148
154
  * Create an empty container for the annotation's HTML element.
149
155
  *
@@ -197,6 +203,7 @@ declare class AnnotationElement {
197
203
  */
198
204
  public getElementsToTriggerPopup(): Array<HTMLElement> | HTMLElement;
199
205
  addHighlightArea(): void;
206
+ get _isEditable(): boolean;
200
207
  _editOnDoubleClick(): void;
201
208
  #private;
202
209
  }
@@ -56,11 +56,11 @@ export class AnnotationStorage {
56
56
  get serializable(): Readonly<{
57
57
  map: null;
58
58
  hash: "";
59
- transfers: undefined;
59
+ transfer: undefined;
60
60
  }> | {
61
61
  map: Map<any, any>;
62
62
  hash: string;
63
- transfers: any[];
63
+ transfer: any[];
64
64
  };
65
65
  #private;
66
66
  }
@@ -78,12 +78,12 @@ export class PrintAnnotationStorage extends AnnotationStorage {
78
78
  get serializable(): {
79
79
  map: any;
80
80
  hash: any;
81
- transfers: any;
81
+ transfer: any;
82
82
  };
83
83
  #private;
84
84
  }
85
85
  export const SerializableEmpty: Readonly<{
86
86
  map: null;
87
87
  hash: "";
88
- transfers: undefined;
88
+ transfer: undefined;
89
89
  }>;
@@ -518,10 +518,10 @@ export type PDFWorkerParameters = {
518
518
  };
519
519
  /** @type {string} */
520
520
  export const build: string;
521
- export const DefaultCanvasFactory: any;
522
- export const DefaultCMapReaderFactory: any;
523
- export const DefaultFilterFactory: any;
524
- export const DefaultStandardFontDataFactory: any;
521
+ export const DefaultCanvasFactory: typeof DOMCanvasFactory | typeof NodeCanvasFactory;
522
+ export const DefaultCMapReaderFactory: typeof DOMCMapReaderFactory;
523
+ export const DefaultFilterFactory: typeof DOMFilterFactory | typeof NodeFilterFactory;
524
+ export const DefaultStandardFontDataFactory: typeof DOMStandardFontDataFactory;
525
525
  /**
526
526
  * @typedef { Int8Array | Uint8Array | Uint8ClampedArray |
527
527
  * Int16Array | Uint16Array |
@@ -736,7 +736,7 @@ export class PDFDataRangeTransport {
736
736
  * after which individual pages can be rendered.
737
737
  */
738
738
  export class PDFDocumentLoadingTask {
739
- static "__#32@#docId": number;
739
+ static "__#33@#docId": number;
740
740
  _capability: PromiseCapability;
741
741
  _transport: any;
742
742
  _worker: any;
@@ -1334,7 +1334,7 @@ export class PDFPageProxy {
1334
1334
  * @param {PDFWorkerParameters} params - The worker initialization parameters.
1335
1335
  */
1336
1336
  export class PDFWorker {
1337
- static "__#35@#workerPorts": any;
1337
+ static "__#36@#workerPorts": any;
1338
1338
  /**
1339
1339
  * @param {PDFWorkerParameters} params - The worker initialization parameters.
1340
1340
  */
@@ -1344,7 +1344,7 @@ export class PDFWorker {
1344
1344
  * @type {string}
1345
1345
  */
1346
1346
  static get workerSrc(): string;
1347
- static get _mainThreadWorkerMessageHandler(): any;
1347
+ static get "__#36@#mainThreadWorkerMessageHandler"(): any;
1348
1348
  static get _setupFakeWorkerGlobal(): any;
1349
1349
  constructor({ name, port, verbosity, }?: {
1350
1350
  name?: null | undefined;
@@ -1383,7 +1383,6 @@ export class PDFWorker {
1383
1383
  }
1384
1384
  export namespace PDFWorkerUtil {
1385
1385
  let isWorkerDisabled: boolean;
1386
- let fallbackWorkerSrc: null;
1387
1386
  let fakeWorkerId: number;
1388
1387
  }
1389
1388
  /**
@@ -1423,6 +1422,12 @@ export const version: string;
1423
1422
  import { PageViewport } from "./display_utils.js";
1424
1423
  import { OptionalContentConfig } from "./optional_content_config.js";
1425
1424
  import { PrintAnnotationStorage } from "./annotation_storage.js";
1425
+ import { DOMCanvasFactory } from "./display_utils.js";
1426
+ import { NodeCanvasFactory } from "./node_utils";
1427
+ import { DOMCMapReaderFactory } from "./display_utils.js";
1428
+ import { DOMFilterFactory } from "./display_utils.js";
1429
+ import { NodeFilterFactory } from "./node_utils";
1430
+ import { DOMStandardFontDataFactory } from "./display_utils.js";
1426
1431
  import { PromiseCapability } from "../shared/util.js";
1427
1432
  import { AnnotationStorage } from "./annotation_storage.js";
1428
1433
  import { info } from "../shared/util.js";
@@ -1463,4 +1468,4 @@ declare class PDFObjects {
1463
1468
  #private;
1464
1469
  }
1465
1470
  import { MessageHandler } from "../shared/message_handler.js";
1466
- export { SVGGraphics };
1471
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Extract file name from the Content-Disposition HTTP response header.
3
+ *
4
+ * @param {string} contentDisposition
5
+ * @returns {string} Filename, if found in the Content-Disposition header.
6
+ */
7
+ export function getFilenameFromContentDispositionHeader(contentDisposition: string): string;
@@ -55,7 +55,6 @@ export type PageViewportCloneParameters = {
55
55
  */
56
56
  dontFlip?: boolean | undefined;
57
57
  };
58
- export const AnnotationPrefix: "pdfjs_internal_id_";
59
58
  export function deprecated(details: any): void;
60
59
  export class DOMCanvasFactory extends BaseCanvasFactory {
61
60
  constructor({ ownerDocument }?: {
@@ -137,11 +136,9 @@ export function isDataScheme(url: any): boolean;
137
136
  export function isPdfFile(filename: any): boolean;
138
137
  export function isValidFetchUrl(url: any, baseUrl: any): boolean;
139
138
  /**
140
- * @param {string} src
141
- * @param {boolean} [removeScriptElement]
142
- * @returns {Promise<void>}
139
+ * Event handler to suppress context menu.
143
140
  */
144
- export function loadScript(src: string, removeScriptElement?: boolean | undefined): Promise<void>;
141
+ export function noContextMenu(e: any): void;
145
142
  /**
146
143
  * @typedef {Object} PageViewportParameters
147
144
  * @property {Array<number>} viewBox - The xMin, yMin, xMax and
@@ -1,17 +1,17 @@
1
1
  export type AnnotationEditorUIManager = import("./tools.js").AnnotationEditorUIManager;
2
2
  export type PageViewport = import("../display_utils.js").PageViewport;
3
- export type TextAccessibilityManager = any;
4
- export type IL10n = any;
5
- export type AnnotationLayer = any;
3
+ export type TextAccessibilityManager = import("../../../web/text_accessibility.js").TextAccessibilityManager;
4
+ export type IL10n = import("../../../web/interfaces").IL10n;
5
+ export type AnnotationLayer = import("../annotation_layer.js").AnnotationLayer;
6
6
  export type AnnotationEditorLayerOptions = {
7
7
  mode: Object;
8
8
  div: HTMLDivElement;
9
9
  uiManager: AnnotationEditorUIManager;
10
10
  enabled: boolean;
11
- accessibilityManager?: any;
11
+ accessibilityManager?: import("../../../web/text_accessibility.js").TextAccessibilityManager | undefined;
12
12
  pageIndex: number;
13
- l10n: any;
14
- annotationLayer?: any;
13
+ l10n: IL10n;
14
+ annotationLayer?: import("../annotation_layer.js").AnnotationLayer | undefined;
15
15
  viewport: PageViewport;
16
16
  };
17
17
  export type RenderEditorLayerOptions = {
@@ -38,6 +38,7 @@ export type RenderEditorLayerOptions = {
38
38
  */
39
39
  export class AnnotationEditorLayer {
40
40
  static _initialized: boolean;
41
+ static "__#18@#editorTypes": Map<number, typeof FreeTextEditor | typeof InkEditor | typeof StampEditor>;
41
42
  /**
42
43
  * @param {AnnotationEditorLayerOptions} options
43
44
  */
@@ -67,6 +68,7 @@ export class AnnotationEditorLayer {
67
68
  * @param {Object} params
68
69
  */
69
70
  addCommands(params: Object): void;
71
+ togglePointerEvents(enabled?: boolean): void;
70
72
  /**
71
73
  * Enable pointer events on the main div in order to enable
72
74
  * editor creation.
@@ -127,9 +129,9 @@ export class AnnotationEditorLayer {
127
129
  /**
128
130
  * Create a new editor
129
131
  * @param {Object} data
130
- * @returns {AnnotationEditor}
132
+ * @returns {AnnotationEditor | null}
131
133
  */
132
- deserialize(data: Object): AnnotationEditor;
134
+ deserialize(data: Object): AnnotationEditor | null;
133
135
  /**
134
136
  * Create and add a new editor.
135
137
  */
@@ -194,3 +196,6 @@ export class AnnotationEditorLayer {
194
196
  #private;
195
197
  }
196
198
  import { AnnotationEditor } from "./editor.js";
199
+ import { FreeTextEditor } from "./freetext.js";
200
+ import { InkEditor } from "./ink.js";
201
+ import { StampEditor } from "./stamp.js";
@@ -1,5 +1,4 @@
1
1
  export type AnnotationEditorLayer = import("./annotation_editor_layer.js").AnnotationEditorLayer;
2
- export type AnnotationEditorUIManager = import("./tools.js").AnnotationEditorUIManager;
3
2
  export type AnnotationEditorParameters = {
4
3
  /**
5
4
  * - the global manager
@@ -34,15 +33,18 @@ export type AnnotationEditorParameters = {
34
33
  * Base class for editors.
35
34
  */
36
35
  export class AnnotationEditor {
36
+ static _borderLineWidth: number;
37
37
  static _colorManager: ColorManager;
38
38
  static _zIndex: number;
39
+ static SMALL_EDITOR_SIZE: number;
40
+ static get _resizerKeyboardManager(): any;
39
41
  static get _defaultLineColor(): any;
40
42
  static deleteAnnotationElement(editor: any): void;
41
43
  /**
42
44
  * Initialize the l10n stuff for this type of editor.
43
- * @param {Object} _l10n
45
+ * @param {Object} l10n
44
46
  */
45
- static initialize(_l10n: Object): void;
47
+ static initialize(l10n: Object, options?: null): void;
46
48
  /**
47
49
  * Update the default parameters for this type of editor.
48
50
  * @param {number} _type
@@ -60,7 +62,7 @@ export class AnnotationEditor {
60
62
  * @param {string} mime
61
63
  * @returns {boolean}
62
64
  */
63
- static isHandlingMimeForPasting(_mime: any): boolean;
65
+ static isHandlingMimeForPasting(mime: string): boolean;
64
66
  /**
65
67
  * Extract the data from the clipboard item and delegate the creation of the
66
68
  * editor to the parent.
@@ -68,8 +70,7 @@ export class AnnotationEditor {
68
70
  * @param {AnnotationEditorLayer} parent
69
71
  */
70
72
  static paste(item: DataTransferItem, parent: AnnotationEditorLayer): void;
71
- static "__#23@#rotatePoint"(x: any, y: any, angle: any): any[];
72
- static "__#23@#noContextMenu"(e: any): void;
73
+ static "__#24@#rotatePoint"(x: any, y: any, angle: any): any[];
73
74
  /**
74
75
  * Deserialize the editor.
75
76
  * The result of the deserialization is a new editor.
@@ -77,9 +78,9 @@ export class AnnotationEditor {
77
78
  * @param {Object} data
78
79
  * @param {AnnotationEditorLayer} parent
79
80
  * @param {AnnotationEditorUIManager} uiManager
80
- * @returns {AnnotationEditor}
81
+ * @returns {AnnotationEditor | null}
81
82
  */
82
- static deserialize(data: Object, parent: AnnotationEditorLayer, uiManager: AnnotationEditorUIManager): AnnotationEditor;
83
+ static deserialize(data: Object, parent: AnnotationEditorLayer, uiManager: AnnotationEditorUIManager): AnnotationEditor | null;
83
84
  static get MIN_SIZE(): number;
84
85
  /**
85
86
  * @param {AnnotationEditorParameters} parameters
@@ -88,6 +89,7 @@ export class AnnotationEditor {
88
89
  _initialOptions: any;
89
90
  _uiManager: null;
90
91
  _focusEventsAllowed: boolean;
92
+ _l10nPromise: null;
91
93
  parent: import("./annotation_editor_layer.js").AnnotationEditorLayer;
92
94
  id: string;
93
95
  width: any;
@@ -97,6 +99,7 @@ export class AnnotationEditor {
97
99
  div: HTMLDivElement | null;
98
100
  annotationElementId: any;
99
101
  _willKeepAspectRatio: boolean;
102
+ _structTreeParentId: any;
100
103
  rotation: number;
101
104
  pageRotation: number;
102
105
  pageDimensions: any[];
@@ -105,6 +108,7 @@ export class AnnotationEditor {
105
108
  y: number;
106
109
  isAttachedToDOM: boolean;
107
110
  deleted: boolean;
111
+ get editorType(): any;
108
112
  /**
109
113
  * Get the properties to update in the UI for this editor.
110
114
  * @returns {Array}
@@ -112,6 +116,10 @@ export class AnnotationEditor {
112
116
  get propertiesToUpdate(): any[];
113
117
  set _isDraggable(arg: boolean);
114
118
  get _isDraggable(): boolean;
119
+ /**
120
+ * @returns {boolean} true if the editor handles the Enter key itself.
121
+ */
122
+ get isEnterHandled(): boolean;
115
123
  center(): void;
116
124
  /**
117
125
  * Add some commands into the CommandManager (undo/redo stuff).
@@ -193,11 +201,25 @@ export class AnnotationEditor {
193
201
  * @returns {Array<number>}
194
202
  */
195
203
  getInitialTranslation(): Array<number>;
204
+ addAltTextButton(): Promise<void>;
205
+ altTextFinish(): void;
206
+ getClientDimensions(): DOMRect;
207
+ /**
208
+ * Set the alt text data.
209
+ */
210
+ set altTextData(arg: {
211
+ altText: string;
212
+ decorative: boolean;
213
+ });
214
+ get altTextData(): {
215
+ altText: string;
216
+ decorative: boolean;
217
+ };
196
218
  /**
197
219
  * Render this editor in a div.
198
- * @returns {HTMLDivElement}
220
+ * @returns {HTMLDivElement | null}
199
221
  */
200
- render(): HTMLDivElement;
222
+ render(): HTMLDivElement | null;
201
223
  /**
202
224
  * Onpointerdown callback.
203
225
  * @param {PointerEvent} event
@@ -233,7 +255,7 @@ export class AnnotationEditor {
233
255
  */
234
256
  isInEditMode(): boolean;
235
257
  /**
236
- * If it returns true, then this editor handle the keyboard
258
+ * If it returns true, then this editor handles the keyboard
237
259
  * events itself.
238
260
  * @returns {boolean}
239
261
  */
@@ -255,10 +277,11 @@ export class AnnotationEditor {
255
277
  * new annotation to add to the pdf document.
256
278
  *
257
279
  * To implement in subclasses.
258
- * @param {boolean} isForCopying
259
- * @param {Object} [context]
280
+ * @param {boolean} [isForCopying]
281
+ * @param {Object | null} [context]
282
+ * @returns {Object | null}
260
283
  */
261
- serialize(_isForCopying?: boolean, _context?: null): void;
284
+ serialize(isForCopying?: boolean | undefined, context?: Object | null | undefined): Object | null;
262
285
  /**
263
286
  * Remove this editor.
264
287
  * It's used on ctrl+backspace action.
@@ -272,6 +295,13 @@ export class AnnotationEditor {
272
295
  * Add the resizers to this editor.
273
296
  */
274
297
  makeResizable(): void;
298
+ /**
299
+ * onkeydown callback.
300
+ * @param {KeyboardEvent} event
301
+ */
302
+ keydown(event: KeyboardEvent): void;
303
+ _resizeWithKeyboard(x: any, y: any): void;
304
+ _stopResizingWithKeyboard(): void;
275
305
  /**
276
306
  * Select this editor.
277
307
  */
@@ -300,10 +330,15 @@ export class AnnotationEditor {
300
330
  * The editor is about to be edited.
301
331
  */
302
332
  enterInEditMode(): void;
333
+ /**
334
+ * @returns {HTMLElement | null} the element requiring an alt text.
335
+ */
336
+ getImageForAltText(): HTMLElement | null;
303
337
  /**
304
338
  * Get the div which really contains the displayed content.
339
+ * @returns {HTMLDivElement | undefined}
305
340
  */
306
- get contentDiv(): HTMLDivElement | null;
341
+ get contentDiv(): HTMLDivElement | undefined;
307
342
  /**
308
343
  * When set to true, it means that this editor is currently edited.
309
344
  * @param {boolean} value
@@ -322,4 +357,5 @@ export class AnnotationEditor {
322
357
  setAspectRatio(width: number, height: number): void;
323
358
  #private;
324
359
  }
360
+ import { AnnotationEditorUIManager } from "./tools.js";
325
361
  import { ColorManager } from "./tools.js";
@@ -4,12 +4,12 @@ export type AnnotationEditorLayer = import("./annotation_editor_layer.js").Annot
4
4
  */
5
5
  export class FreeTextEditor extends AnnotationEditor {
6
6
  static _freeTextDefaultContent: string;
7
- static _l10nPromise: any;
8
7
  static _internalPadding: number;
9
8
  static _defaultColor: null;
10
9
  static _defaultFontSize: number;
11
10
  static get _keyboardManager(): any;
12
11
  static _type: string;
12
+ static _editorType: number;
13
13
  /** @inheritdoc */
14
14
  static initialize(l10n: any): void;
15
15
  /** @inheritdoc */
@@ -39,20 +39,12 @@ export class FreeTextEditor extends AnnotationEditor {
39
39
  * @param {MouseEvent} event
40
40
  */
41
41
  dblclick(event: MouseEvent): void;
42
- /**
43
- * onkeydown callback.
44
- * @param {KeyboardEvent} event
45
- */
46
- keydown(event: KeyboardEvent): void;
47
42
  editorDivKeydown(event: any): void;
48
43
  editorDivFocus(event: any): void;
49
44
  editorDivBlur(event: any): void;
50
45
  editorDivInput(event: any): void;
51
- /** @inheritdoc */
52
- render(): HTMLDivElement | null;
53
46
  editorDiv: HTMLDivElement | undefined;
54
47
  overlayDiv: HTMLDivElement | undefined;
55
- get contentDiv(): HTMLDivElement | undefined;
56
48
  /** @inheritdoc */
57
49
  serialize(isForCopying?: boolean): {
58
50
  annotationType: number;
@@ -62,6 +54,7 @@ export class FreeTextEditor extends AnnotationEditor {
62
54
  pageIndex: number;
63
55
  rect: any[];
64
56
  rotation: number;
57
+ structTreeParentId: any;
65
58
  } | {
66
59
  pageIndex: number;
67
60
  id: any;
@@ -5,8 +5,8 @@ export class InkEditor extends AnnotationEditor {
5
5
  static _defaultColor: null;
6
6
  static _defaultOpacity: number;
7
7
  static _defaultThickness: number;
8
- static _l10nPromise: any;
9
8
  static _type: string;
9
+ static _editorType: number;
10
10
  /** @inheritdoc */
11
11
  static initialize(l10n: any): void;
12
12
  /** @inheritdoc */
@@ -15,12 +15,12 @@ export class InkEditor extends AnnotationEditor {
15
15
  static get defaultPropertiesToUpdate(): any[][];
16
16
  /**
17
17
  * Convert into a Path2D.
18
- * @param {Arra<Array<number>} bezier
18
+ * @param {Array<Array<number>>} bezier
19
19
  * @returns {Path2D}
20
20
  */
21
- static "__#15@#buildPath2D"(bezier: Arra<number[]>): Path2D;
22
- static "__#15@#toPDFCoordinates"(points: any, rect: any, rotation: any): any;
23
- static "__#15@#fromPDFCoordinates"(points: any, rect: any, rotation: any): any;
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;
24
24
  /** @inheritdoc */
25
25
  static deserialize(data: any, parent: any, uiManager: any): AnnotationEditor | null;
26
26
  constructor(params: any);
@@ -45,11 +45,6 @@ export class InkEditor extends AnnotationEditor {
45
45
  * @param {PointerEvent} event
46
46
  */
47
47
  canvasPointerdown(event: PointerEvent): void;
48
- /**
49
- * oncontextmenu callback for the canvas we're drawing on.
50
- * @param {PointerEvent} event
51
- */
52
- canvasContextMenu(event: PointerEvent): void;
53
48
  /**
54
49
  * onpointermove callback for the canvas we're drawing on.
55
50
  * @param {PointerEvent} event
@@ -66,8 +61,6 @@ export class InkEditor extends AnnotationEditor {
66
61
  */
67
62
  canvasPointerleave(event: PointerEvent): void;
68
63
  ctx: CanvasRenderingContext2D | null | undefined;
69
- /** @inheritdoc */
70
- render(): HTMLDivElement | null;
71
64
  /**
72
65
  * When the dimensions of the div change the inner canvas must
73
66
  * renew its dimensions, hence it must redraw its own contents.
@@ -89,6 +82,7 @@ export class InkEditor extends AnnotationEditor {
89
82
  pageIndex: number;
90
83
  rect: any[];
91
84
  rotation: number;
85
+ structTreeParentId: any;
92
86
  } | null;
93
87
  #private;
94
88
  }
@@ -3,6 +3,9 @@
3
3
  */
4
4
  export class StampEditor extends AnnotationEditor {
5
5
  static _type: string;
6
+ static _editorType: number;
7
+ /** @inheritdoc */
8
+ static initialize(l10n: any): void;
6
9
  static get supportedTypes(): any;
7
10
  static get supportedTypesStr(): any;
8
11
  /** @inheritdoc */
@@ -13,7 +16,7 @@ export class StampEditor extends AnnotationEditor {
13
16
  static deserialize(data: any, parent: any, uiManager: any): AnnotationEditor | null;
14
17
  constructor(params: any);
15
18
  /** @inheritdoc */
16
- render(): HTMLDivElement | null;
19
+ getImageForAltText(): null;
17
20
  /** @inheritdoc */
18
21
  serialize(isForCopying?: boolean, context?: null): {
19
22
  annotationType: number;
@@ -22,6 +25,7 @@ export class StampEditor extends AnnotationEditor {
22
25
  rect: any[];
23
26
  rotation: number;
24
27
  isSvg: boolean;
28
+ structTreeParentId: any;
25
29
  } | null;
26
30
  #private;
27
31
  }
@@ -12,13 +12,16 @@ export class AnnotationEditorUIManager {
12
12
  static TRANSLATE_SMALL: number;
13
13
  static TRANSLATE_BIG: number;
14
14
  static get _keyboardManager(): any;
15
- constructor(container: any, viewer: any, eventBus: any, pdfDocument: any, pageColors: any);
15
+ constructor(container: any, viewer: any, altTextManager: any, eventBus: any, pdfDocument: any, pageColors: any);
16
+ _eventBus: any;
16
17
  viewParameters: {
17
18
  realScale: number;
18
19
  rotation: number;
19
20
  };
20
21
  destroy(): void;
21
22
  get hcmFilter(): any;
23
+ get direction(): any;
24
+ editAltText(editor: any): void;
22
25
  onPageChanging({ pageNumber }: {
23
26
  pageNumber: any;
24
27
  }): void;
@@ -40,6 +43,8 @@ export class AnnotationEditorUIManager {
40
43
  addToAnnotationStorage(editor: AnnotationEditor): void;
41
44
  blur(): void;
42
45
  focus(): void;
46
+ addEditListeners(): void;
47
+ removeEditListeners(): void;
43
48
  /**
44
49
  * Copy callback.
45
50
  * @param {ClipboardEvent} event
@@ -97,8 +102,11 @@ export class AnnotationEditorUIManager {
97
102
  * Change the editor mode (None, FreeText, Ink, ...)
98
103
  * @param {number} mode
99
104
  * @param {string|null} editId
105
+ * @param {boolean} [isFromKeyboard] - true if the mode change is due to a
106
+ * keyboard action.
100
107
  */
101
- updateMode(mode: number, editId?: string | null): void;
108
+ updateMode(mode: number, editId?: string | null, isFromKeyboard?: boolean | undefined): void;
109
+ addNewEditorFromKeyboard(): void;
102
110
  /**
103
111
  * Update the toolbar if it's required to reflect the tool currently used.
104
112
  * @param {number} mode
@@ -170,12 +178,14 @@ export class AnnotationEditorUIManager {
170
178
  * @param {AnnotationEditor} editor
171
179
  */
172
180
  isSelected(editor: AnnotationEditor): boolean;
181
+ get firstSelectedEditor(): any;
173
182
  /**
174
183
  * Unselect an editor.
175
184
  * @param {AnnotationEditor} editor
176
185
  */
177
186
  unselect(editor: AnnotationEditor): void;
178
187
  get hasSelection(): boolean;
188
+ get isEnterHandled(): any;
179
189
  /**
180
190
  * Undo the last command.
181
191
  */
@@ -225,6 +235,7 @@ export class AnnotationEditorUIManager {
225
235
  * @param {AnnotationEditor} editor
226
236
  */
227
237
  rebuild(editor: AnnotationEditor): void;
238
+ get isEditorHandlingKeyboard(): any;
228
239
  /**
229
240
  * Is the current editor the one passed as argument?
230
241
  * @param {AnnotationEditor} editor
@@ -334,11 +345,11 @@ export class KeyboardManager {
334
345
  /**
335
346
  * Execute a callback, if any, for a given keyboard event.
336
347
  * The self is used as `this` in the callback.
337
- * @param {Object} self.
348
+ * @param {Object} self
338
349
  * @param {KeyboardEvent} event
339
350
  * @returns
340
351
  */
341
- exec(self: any, event: KeyboardEvent): void;
352
+ exec(self: Object, event: KeyboardEvent): void;
342
353
  #private;
343
354
  }
344
355
  /**