unpdf 1.0.6 → 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 (47) hide show
  1. package/README.md +35 -2
  2. package/dist/index.cjs +28 -0
  3. package/dist/index.d.cts +7 -1
  4. package/dist/index.d.mts +7 -1
  5. package/dist/index.d.ts +7 -1
  6. package/dist/index.mjs +28 -1
  7. package/dist/pdfjs.mjs +1 -1
  8. package/dist/types/src/display/annotation_layer.d.ts +5 -2
  9. package/dist/types/src/display/api.d.ts +30 -74
  10. package/dist/types/src/display/api_utils.d.ts +13 -0
  11. package/dist/types/src/display/canvas.d.ts +2 -2
  12. package/dist/types/src/display/display_utils.d.ts +2 -1
  13. package/dist/types/src/display/draw_layer.d.ts +2 -2
  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 +6 -6
  16. package/dist/types/src/display/editor/color_picker.d.ts +20 -1
  17. package/dist/types/src/display/editor/comment.d.ts +32 -0
  18. package/dist/types/src/display/editor/draw.d.ts +8 -8
  19. package/dist/types/src/display/editor/drawers/freedraw.d.ts +3 -3
  20. package/dist/types/src/display/editor/drawers/signaturedraw.d.ts +13 -13
  21. package/dist/types/src/display/editor/editor.d.ts +48 -5
  22. package/dist/types/src/display/editor/freetext.d.ts +9 -7
  23. package/dist/types/src/display/editor/highlight.d.ts +6 -3
  24. package/dist/types/src/display/editor/ink.d.ts +4 -0
  25. package/dist/types/src/display/editor/signature.d.ts +2 -0
  26. package/dist/types/src/display/editor/stamp.d.ts +2 -0
  27. package/dist/types/src/display/editor/toolbar.d.ts +3 -0
  28. package/dist/types/src/display/editor/tools.d.ts +14 -3
  29. package/dist/types/src/display/pdf_objects.d.ts +40 -0
  30. package/dist/types/src/display/text_layer.d.ts +9 -9
  31. package/dist/types/src/display/worker_options.d.ts +2 -2
  32. package/dist/types/src/pdf.d.ts +3 -2
  33. package/dist/types/src/shared/scripting_utils.d.ts +2 -0
  34. package/dist/types/src/shared/util.d.ts +2 -2
  35. package/dist/types/web/app_options.d.ts +1 -1
  36. package/dist/types/web/autolinker.d.ts +2 -2
  37. package/dist/types/web/base_pdf_page_view.d.ts +0 -1
  38. package/dist/types/web/event_utils.d.ts +1 -1
  39. package/dist/types/web/genericl10n.d.ts +5 -5
  40. package/dist/types/web/l10n.d.ts +2 -2
  41. package/dist/types/web/pdf_find_controller.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 +2 -10
  44. package/dist/types/web/pdf_viewer.d.ts +42 -1
  45. package/dist/types/web/text_accessibility.d.ts +1 -1
  46. package/dist/types/web/text_layer_builder.d.ts +4 -4
  47. package/package.json +13 -13
@@ -152,8 +152,7 @@ export class StampAnnotationElement extends AnnotationElement {
152
152
  }
153
153
  import { AnnotationStorage } from "./annotation_storage.js";
154
154
  declare class AnnotationElement {
155
- static _hasPopupData({ titleObj, contentsObj, richText }: {
156
- titleObj: any;
155
+ static _hasPopupData({ contentsObj, richText }: {
157
156
  contentsObj: any;
158
157
  richText: any;
159
158
  }): boolean;
@@ -179,6 +178,7 @@ declare class AnnotationElement {
179
178
  get _isEditable(): any;
180
179
  get hasPopupData(): boolean;
181
180
  updateEdited(params: any): void;
181
+ popup: any;
182
182
  resetEdited(): void;
183
183
  /**
184
184
  * Create an empty container for the annotation's HTML element.
@@ -205,10 +205,13 @@ declare class AnnotationElement {
205
205
  * annotations that do not have a Popup entry in the dictionary, but
206
206
  * are of a type that works with popups (such as Highlight annotations).
207
207
  *
208
+ * @param {Object} [popupData] - The data for the popup, if any.
209
+ *
208
210
  * @private
209
211
  * @memberof AnnotationElement
210
212
  */
211
213
  private _createPopup;
214
+ get hasPopupElement(): boolean;
212
215
  /**
213
216
  * Render the annotation's HTML element(s).
214
217
  *
@@ -48,7 +48,7 @@ export type DocumentInitParameters = {
48
48
  range?: PDFDataRangeTransport | undefined;
49
49
  /**
50
50
  * - Specify maximum number of bytes fetched
51
- * per range request. The default value is {@link DEFAULT_RANGE_CHUNK_SIZE}.
51
+ * per range request. The default value is 65536 (= 2^16).
52
52
  */
53
53
  rangeChunkSize?: number | undefined;
54
54
  /**
@@ -414,10 +414,19 @@ export type GetAnnotationsParameters = {
414
414
  */
415
415
  export type RenderParameters = {
416
416
  /**
417
- * - A 2D context of a DOM
418
- * Canvas object.
417
+ * - 2D context of a DOM
418
+ * Canvas object for backwards compatibility; it is recommended to use the
419
+ * `canvas` parameter instead.
420
+ * If the context must absolutely be used to render the page, the canvas must
421
+ * be null.
419
422
  */
420
423
  canvasContext: CanvasRenderingContext2D;
424
+ /**
425
+ * - A DOM Canvas object. The default
426
+ * value is the canvas associated with the `canvasContext` parameter if no
427
+ * value is provided explicitly.
428
+ */
429
+ canvas: HTMLCanvasElement | null;
421
430
  /**
422
431
  * - Rendering viewport obtained by calling
423
432
  * the `PDFPageProxy.getViewport` method.
@@ -609,7 +618,7 @@ export const build: string;
609
618
  * @property {PDFDataRangeTransport} [range] - Allows for using a custom range
610
619
  * transport implementation.
611
620
  * @property {number} [rangeChunkSize] - Specify maximum number of bytes fetched
612
- * per range request. The default value is {@link DEFAULT_RANGE_CHUNK_SIZE}.
621
+ * per range request. The default value is 65536 (= 2^16).
613
622
  * @property {PDFWorker} [worker] - The worker that will be used for loading and
614
623
  * parsing the PDF data.
615
624
  * @property {number} [verbosity] - Controls the logging level; the constants
@@ -732,14 +741,6 @@ export const build: string;
732
741
  * @returns {PDFDocumentLoadingTask}
733
742
  */
734
743
  export function getDocument(src?: string | URL | TypedArray | ArrayBuffer | DocumentInitParameters): PDFDocumentLoadingTask;
735
- export const isValidExplicitDest: (dest?: any) => boolean;
736
- export class LoopbackPort {
737
- postMessage(obj: any, transfer: any): void;
738
- addEventListener(name: any, listener: any, options?: null): void;
739
- removeEventListener(name: any, listener: any): void;
740
- terminate(): void;
741
- #private;
742
- }
743
744
  /**
744
745
  * Abstract class to support range requests file loading.
745
746
  *
@@ -759,11 +760,6 @@ export class PDFDataRangeTransport {
759
760
  initialData: Uint8Array<ArrayBufferLike> | null;
760
761
  progressiveDone: boolean;
761
762
  contentDispositionFilename: string;
762
- _rangeListeners: any[];
763
- _progressListeners: any[];
764
- _progressiveReadListeners: any[];
765
- _progressiveDoneListeners: any[];
766
- _readyCapability: any;
767
763
  /**
768
764
  * @param {function} listener
769
765
  */
@@ -802,6 +798,7 @@ export class PDFDataRangeTransport {
802
798
  */
803
799
  requestDataRange(begin: number, end: number): void;
804
800
  abort(): void;
801
+ #private;
805
802
  }
806
803
  /**
807
804
  * @typedef {Object} OnProgressParameters
@@ -814,7 +811,7 @@ export class PDFDataRangeTransport {
814
811
  * after which individual pages can be rendered.
815
812
  */
816
813
  export class PDFDocumentLoadingTask {
817
- static "__#55@#docId": number;
814
+ static "__#59@#docId": number;
818
815
  /**
819
816
  * @private
820
817
  */
@@ -1221,8 +1218,14 @@ export class PDFDocumentProxy {
1221
1218
  * Page render parameters.
1222
1219
  *
1223
1220
  * @typedef {Object} RenderParameters
1224
- * @property {CanvasRenderingContext2D} canvasContext - A 2D context of a DOM
1225
- * Canvas object.
1221
+ * @property {CanvasRenderingContext2D} canvasContext - 2D context of a DOM
1222
+ * Canvas object for backwards compatibility; it is recommended to use the
1223
+ * `canvas` parameter instead.
1224
+ * If the context must absolutely be used to render the page, the canvas must
1225
+ * be null.
1226
+ * @property {HTMLCanvasElement|null} canvas - A DOM Canvas object. The default
1227
+ * value is the canvas associated with the `canvasContext` parameter if no
1228
+ * value is provided explicitly.
1226
1229
  * @property {PageViewport} viewport - Rendering viewport obtained by calling
1227
1230
  * the `PDFPageProxy.getViewport` method.
1228
1231
  * @property {string} [intent] - Rendering intent, can be 'display', 'print',
@@ -1384,7 +1387,7 @@ export class PDFPageProxy {
1384
1387
  * @returns {RenderTask} An object that contains a promise that is
1385
1388
  * resolved when the page finishes rendering.
1386
1389
  */
1387
- render({ canvasContext, viewport, intent, annotationMode, transform, background, optionalContentConfigPromise, annotationCanvasMap, pageColors, printAnnotationStorage, isEditing, }: RenderParameters): RenderTask;
1390
+ render({ canvasContext, canvas, viewport, intent, annotationMode, transform, background, optionalContentConfigPromise, annotationCanvasMap, pageColors, printAnnotationStorage, isEditing, }: RenderParameters): RenderTask;
1388
1391
  /**
1389
1392
  * @param {GetOperatorListParameters} params - Page getOperatorList
1390
1393
  * parameters.
@@ -1467,20 +1470,20 @@ export class PDFPageProxy {
1467
1470
  * @param {PDFWorkerParameters} params - The worker initialization parameters.
1468
1471
  */
1469
1472
  export class PDFWorker {
1470
- static "__#58@#fakeWorkerId": number;
1471
- static "__#58@#isWorkerDisabled": boolean;
1472
- static "__#58@#workerPorts": any;
1473
+ static "__#62@#fakeWorkerId": number;
1474
+ static "__#62@#isWorkerDisabled": boolean;
1475
+ static "__#62@#workerPorts": WeakMap<object, any>;
1473
1476
  /**
1474
1477
  * @param {PDFWorkerParameters} params - The worker initialization parameters.
1475
1478
  * @returns {PDFWorker}
1476
1479
  */
1477
- static fromPort(params: PDFWorkerParameters): PDFWorker;
1480
+ static create(params: PDFWorkerParameters): PDFWorker;
1478
1481
  /**
1479
1482
  * The current `workerSrc`, when it exists.
1480
1483
  * @type {string}
1481
1484
  */
1482
1485
  static get workerSrc(): string;
1483
- static get "__#58@#mainThreadWorkerMessageHandler"(): any;
1486
+ static get "__#62@#mainThreadWorkerMessageHandler"(): any;
1484
1487
  static get _setupFakeWorkerGlobal(): any;
1485
1488
  constructor({ name, port, verbosity, }?: {
1486
1489
  name?: null | undefined;
@@ -1490,10 +1493,6 @@ export class PDFWorker {
1490
1493
  name: any;
1491
1494
  destroyed: boolean;
1492
1495
  verbosity: number;
1493
- _readyCapability: any;
1494
- _port: any;
1495
- _webWorker: Worker | null;
1496
- _messageHandler: MessageHandler | null;
1497
1496
  /**
1498
1497
  * Promise for worker initialization completion.
1499
1498
  * @type {Promise<void>}
@@ -1509,9 +1508,6 @@ export class PDFWorker {
1509
1508
  * @type {MessageHandler}
1510
1509
  */
1511
1510
  get messageHandler(): MessageHandler;
1512
- _initializeFromPort(port: any): void;
1513
- _initialize(): void;
1514
- _setupFakeWorker(): void;
1515
1511
  /**
1516
1512
  * Destroys the worker instance.
1517
1513
  */
@@ -1567,45 +1563,5 @@ import { PrintAnnotationStorage } from "./annotation_storage.js";
1567
1563
  import { AnnotationStorage } from "./annotation_storage.js";
1568
1564
  import { Metadata } from "./metadata.js";
1569
1565
  import { StatTimer } from "./display_utils.js";
1570
- /**
1571
- * A PDF document and page is built of many objects. E.g. there are objects for
1572
- * fonts, images, rendering code, etc. These objects may get processed inside of
1573
- * a worker. This class implements some basic methods to manage these objects.
1574
- */
1575
- declare class PDFObjects {
1576
- /**
1577
- * If called *without* callback, this returns the data of `objId` but the
1578
- * object needs to be resolved. If it isn't, this method throws.
1579
- *
1580
- * If called *with* a callback, the callback is called with the data of the
1581
- * object once the object is resolved. That means, if you call this method
1582
- * and the object is already resolved, the callback gets called right away.
1583
- *
1584
- * @param {string} objId
1585
- * @param {function} [callback]
1586
- * @returns {any}
1587
- */
1588
- get(objId: string, callback?: Function): any;
1589
- /**
1590
- * @param {string} objId
1591
- * @returns {boolean}
1592
- */
1593
- has(objId: string): boolean;
1594
- /**
1595
- * @param {string} objId
1596
- * @returns {boolean}
1597
- */
1598
- delete(objId: string): boolean;
1599
- /**
1600
- * Resolves the object `objId` with optional `data`.
1601
- *
1602
- * @param {string} objId
1603
- * @param {any} [data]
1604
- */
1605
- resolve(objId: string, data?: any): void;
1606
- clear(): void;
1607
- [Symbol.iterator](): Generator<any[], void, unknown>;
1608
- #private;
1609
- }
1566
+ import { PDFObjects } from "./pdf_objects.js";
1610
1567
  import { MessageHandler } from "../shared/message_handler.js";
1611
- export {};
@@ -0,0 +1,13 @@
1
+ export function getDataProp(val: any): Uint8Array<any>;
2
+ export function getFactoryUrlProp(val: any): string | null;
3
+ export function getUrlProp(val: any): string | null;
4
+ export function isNameProxy(v: any): boolean;
5
+ export function isRefProxy(v: any): boolean;
6
+ export const isValidExplicitDest: (dest?: any) => boolean;
7
+ export class LoopbackPort {
8
+ postMessage(obj: any, transfer: any): void;
9
+ addEventListener(name: any, listener: any, options?: null): void;
10
+ removeEventListener(name: any, listener: any): void;
11
+ terminate(): void;
12
+ #private;
13
+ }
@@ -119,9 +119,9 @@ export class CanvasGraphics {
119
119
  getColorN_Pattern(IR: any): any;
120
120
  setStrokeColorN(...args: any[]): void;
121
121
  setFillColorN(...args: any[]): void;
122
- setStrokeRGBColor(r: any, g: any, b: any): void;
122
+ setStrokeRGBColor(color: any): void;
123
123
  setStrokeTransparent(): void;
124
- setFillRGBColor(r: any, g: any, b: any): void;
124
+ setFillRGBColor(color: any): void;
125
125
  setFillTransparent(): void;
126
126
  _getPattern(objId: any, matrix?: null): any;
127
127
  shadingFill(objId: any): void;
@@ -98,6 +98,7 @@ export function noContextMenu(e: any): void;
98
98
  */
99
99
  export class OutputScale {
100
100
  static get pixelRatio(): number;
101
+ static capPixels(maxPixels: any, capAreaFactor: any): any;
101
102
  /**
102
103
  * @type {number} Horizontal scale.
103
104
  */
@@ -119,7 +120,7 @@ export class OutputScale {
119
120
  * @returns {boolean} Returns `true` if scaling was limited,
120
121
  * `false` otherwise.
121
122
  */
122
- limitCanvas(width: any, height: any, maxPixels: any, maxDim: any): boolean;
123
+ limitCanvas(width: any, height: any, maxPixels: any, maxDim: any, capAreaFactor?: number): boolean;
123
124
  }
124
125
  /**
125
126
  * @typedef {Object} PageViewportParameters
@@ -4,9 +4,9 @@
4
4
  * be able to use mix-blend-mode for some of them.
5
5
  */
6
6
  export class DrawLayer {
7
- static "__#33@#id": number;
7
+ static "__#34@#id": number;
8
8
  static get _svgFactory(): any;
9
- static "__#33@#setBox"(element: any, [x, y, width, height]: [any, any, any, any]): void;
9
+ static "__#34@#setBox"(element: any, [x, y, width, height]: [any, any, any, any]): void;
10
10
  constructor({ pageIndex }: {
11
11
  pageIndex: any;
12
12
  });
@@ -1,5 +1,5 @@
1
1
  export class AltText {
2
- static "__#40@#l10nNewButton": null;
2
+ static "__#41@#l10nNewButton": null;
3
3
  static _l10n: null;
4
4
  static initialize(l10n: any): void;
5
5
  constructor(editor: any);
@@ -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 "__#35@#editorTypes": Map<number, typeof FreeTextEditor | typeof HighlightEditor | typeof InkEditor | typeof SignatureEditor | typeof StampEditor>;
50
50
  /**
51
51
  * @param {AnnotationEditorLayerOptions} options
52
52
  */
@@ -60,9 +60,9 @@ export class AnnotationEditorLayer {
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;
@@ -140,10 +140,10 @@ export class AnnotationEditorLayer {
140
140
  canCreateNewEmptyEditor(): boolean | undefined;
141
141
  /**
142
142
  * Paste some content into a new editor.
143
- * @param {number} mode
143
+ * @param {Object} options
144
144
  * @param {Object} params
145
145
  */
146
- pasteEditor(mode: number, params: Object): Promise<void>;
146
+ pasteEditor(options: Object, params: Object): Promise<void>;
147
147
  /**
148
148
  * Create a new editor
149
149
  * @param {Object} data
@@ -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 "__#6@#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 "__#5@#l10nColor": null;
3
22
  static get _keyboardManager(): any;
4
23
  constructor({ editor, uiManager }: {
5
24
  editor?: null | undefined;
@@ -0,0 +1,32 @@
1
+ export class Comment {
2
+ constructor(editor: any);
3
+ toolbar: any;
4
+ render(): HTMLButtonElement | null;
5
+ edit(): void;
6
+ finish(): void;
7
+ isDeleted(): boolean;
8
+ hasBeenEdited(): boolean;
9
+ serialize(): {
10
+ text: null;
11
+ date: null;
12
+ deleted: boolean;
13
+ };
14
+ /**
15
+ * Set the comment data.
16
+ */
17
+ set data(text: {
18
+ text: null;
19
+ date: null;
20
+ deleted: boolean;
21
+ });
22
+ get data(): {
23
+ text: null;
24
+ date: null;
25
+ deleted: boolean;
26
+ };
27
+ setInitialText(text: any): void;
28
+ toggle(enabled?: boolean): void;
29
+ shown(): void;
30
+ destroy(): void;
31
+ #private;
32
+ }
@@ -4,13 +4,13 @@
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 "__#27@#currentDraw": null;
8
+ static "__#27@#currentDrawingAC": null;
9
+ static "__#27@#currentDrawingOptions": null;
10
+ static "__#27@#currentPointerId": number;
11
+ static "__#27@#currentPointerType": null;
12
+ static "__#27@#currentPointerIds": null;
13
+ static "__#27@#currentMoveTimestamp": number;
14
14
  static _INNER_MARGIN: number;
15
15
  static _mergeSVGProperties(p1: any, p2: any): any;
16
16
  /**
@@ -32,7 +32,6 @@ export class DrawingEditor extends AnnotationEditor {
32
32
  INK_THICKNESS: number;
33
33
  INK_OPACITY: number;
34
34
  HIGHLIGHT_COLOR: number;
35
- HIGHLIGHT_DEFAULT_COLOR: number;
36
35
  HIGHLIGHT_THICKNESS: number;
37
36
  HIGHLIGHT_FREE: number;
38
37
  HIGHLIGHT_SHOW_ALL: number;
@@ -76,6 +75,7 @@ export class DrawingEditor extends AnnotationEditor {
76
75
  /** @inheritdoc */
77
76
  static deserialize(data: any, parent: any, uiManager: any): Promise<AnnotationEditor | null>;
78
77
  constructor(params: any);
78
+ _colorPicker: null;
79
79
  _drawId: null;
80
80
  _addOutlines(params: any): void;
81
81
  /** @inheritdoc */
@@ -11,9 +11,9 @@ export class FreeDrawOutline extends Outline {
11
11
  #private;
12
12
  }
13
13
  export class FreeDrawOutliner {
14
- static "__#19@#MIN_DIST": number;
15
- static "__#19@#MIN_DIFF": number;
16
- static "__#19@#MIN": number;
14
+ static "__#21@#MIN_DIST": number;
15
+ static "__#21@#MIN_DIFF": number;
16
+ static "__#21@#MIN": number;
17
17
  constructor({ x, y }: {
18
18
  x: any;
19
19
  y: any;
@@ -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 "__#31@#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 "__#31@#neighborIndexToId"(i0: any, j0: any, i: any, j: any): any;
12
+ static "__#31@#neighborIdToIndex": Int32Array<ArrayBuffer>;
13
+ static "__#31@#clockwiseNonZero"(buf: any, width: any, i0: any, j0: any, i: any, j: any, offset: any): number;
14
+ static "__#31@#counterClockwiseNonZero"(buf: any, width: any, i0: any, j0: any, i: any, j: any, offset: any): number;
15
+ static "__#31@#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 "__#31@#douglasPeuckerHelper"(points: any, start: any, end: any, output: any): void;
22
+ static "__#31@#douglasPeucker"(points: any): any[] | null;
23
+ static "__#31@#bilateralFilter"(buf: any, width: any, height: any, sigmaS: any, sigmaR: any, kernelSize: any): (Uint32Array<ArrayBuffer> | Uint8Array<any>)[];
24
+ static "__#31@#getHistogram"(buf: any): Uint32Array<ArrayBuffer>;
25
+ static "__#31@#toUint8"(buf: any): Uint8ClampedArray<ArrayBuffer>;
26
+ static "__#31@#guessThreshold"(histogram: any): number;
27
+ static "__#31@#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 "__#44@#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;
@@ -117,6 +118,7 @@ export class AnnotationEditor {
117
118
  isAttachedToDOM: boolean;
118
119
  deleted: boolean;
119
120
  get editorType(): any;
121
+ get mode(): any;
120
122
  /**
121
123
  * Get the properties to update in the UI for this editor.
122
124
  * @returns {Array}
@@ -254,6 +256,11 @@ export class AnnotationEditor {
254
256
  * Called when the alt text dialog is closed.
255
257
  */
256
258
  altTextFinish(): void;
259
+ /**
260
+ * Get the toolbar buttons for this editor.
261
+ * @returns {Array<Array<string|object|null>>|null}
262
+ */
263
+ get toolbarButtons(): Array<Array<string | object | null>> | null;
257
264
  /**
258
265
  * Add a toolbar for this editor.
259
266
  * @returns {Promise<EditorToolbar|null>}
@@ -262,7 +269,11 @@ export class AnnotationEditor {
262
269
  removeEditToolbar(): void;
263
270
  addContainer(container: any): void;
264
271
  getClientDimensions(): DOMRect;
265
- addAltTextButton(): Promise<void>;
272
+ /**
273
+ * Create the alt text for this editor.
274
+ * @returns {object}
275
+ */
276
+ createAltText(): object;
266
277
  /**
267
278
  * Set the alt text data.
268
279
  */
@@ -273,6 +284,24 @@ export class AnnotationEditor {
273
284
  serializeAltText(isForCopying: any): any;
274
285
  hasAltText(): boolean;
275
286
  hasAltTextData(): any;
287
+ addCommentButton(): Comment;
288
+ get commentColor(): null;
289
+ set comment(text: {
290
+ text: any;
291
+ date: any;
292
+ deleted: any;
293
+ color: null;
294
+ });
295
+ get comment(): {
296
+ text: any;
297
+ date: any;
298
+ deleted: any;
299
+ color: null;
300
+ };
301
+ setCommentData(text: any): void;
302
+ get hasEditedComment(): any;
303
+ editComment(): Promise<void>;
304
+ addComment(serialized: any): void;
276
305
  /**
277
306
  * Render this editor in a div.
278
307
  * @returns {HTMLDivElement | null}
@@ -283,7 +312,6 @@ export class AnnotationEditor {
283
312
  * @param {PointerEvent} event
284
313
  */
285
314
  pointerdown(event: PointerEvent): void;
286
- get isSelected(): any;
287
315
  _onStartDragging(): void;
288
316
  _onStopDragging(): void;
289
317
  moveInDOM(): void;
@@ -308,12 +336,14 @@ export class AnnotationEditor {
308
336
  isEmpty(): boolean;
309
337
  /**
310
338
  * Enable edit mode.
339
+ * @returns {boolean} - true if the edit mode has been enabled.
311
340
  */
312
- enableEditMode(): void;
341
+ enableEditMode(): boolean;
313
342
  /**
314
343
  * Disable edit mode.
344
+ * @returns {boolean} - true if the edit mode has been disabled.
315
345
  */
316
- disableEditMode(): void;
346
+ disableEditMode(): boolean;
317
347
  /**
318
348
  * Check if the editor is edited.
319
349
  * @returns {boolean}
@@ -413,10 +443,22 @@ export class AnnotationEditor {
413
443
  * their properties.
414
444
  */
415
445
  enableEditing(): void;
446
+ /**
447
+ * Check if the content of this editor can be changed.
448
+ * For example, a FreeText editor can be changed (the user can change the
449
+ * text), but a Stamp editor cannot.
450
+ * @returns {boolean}
451
+ */
452
+ get canChangeContent(): boolean;
416
453
  /**
417
454
  * The editor is about to be edited.
418
455
  */
419
456
  enterInEditMode(): void;
457
+ /**
458
+ * ondblclick callback.
459
+ * @param {MouseEvent} event
460
+ */
461
+ dblclick(event: MouseEvent): void;
420
462
  /**
421
463
  * @returns {HTMLElement | null} the element requiring an alt text.
422
464
  */
@@ -471,4 +513,5 @@ export class AnnotationEditor {
471
513
  }
472
514
  import { AnnotationEditorUIManager } from "./tools.js";
473
515
  import { EditorToolbar } from "./toolbar.js";
516
+ import { Comment } from "./comment.js";
474
517
  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 "__#20@#getNodeContent"(node: any): any;
20
+ static "__#20@#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;
24
25
  /** @inheritdoc */
25
26
  updateParams(type: any, value: any): void;
26
27
  /** @inheritdoc */
27
28
  get propertiesToUpdate(): any[][];
29
+ /** @inheritdoc */
30
+ get toolbarButtons(): (string | null)[][];
31
+ get colorType(): number;
32
+ get colorValue(): any;
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;