unpdf 0.10.0 → 0.11.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 (61) hide show
  1. package/README.md +9 -7
  2. package/dist/index.cjs +15 -19
  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 -19
  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 +10 -3
  11. package/dist/types/src/display/annotation_storage.d.ts +1 -0
  12. package/dist/types/src/display/api.d.ts +54 -26
  13. package/dist/types/src/display/base_factory.d.ts +3 -1
  14. package/dist/types/src/display/canvas.d.ts +2 -0
  15. package/dist/types/src/display/display_utils.d.ts +7 -5
  16. package/dist/types/src/display/draw_layer.d.ts +38 -0
  17. package/dist/types/src/display/editor/alt_text.d.ts +22 -0
  18. package/dist/types/src/display/editor/annotation_editor_layer.d.ts +24 -2
  19. package/dist/types/src/display/editor/color_picker.d.ts +19 -0
  20. package/dist/types/src/display/editor/editor.d.ts +78 -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 +4 -4
  24. package/dist/types/src/display/editor/outliner.d.ts +70 -0
  25. package/dist/types/src/display/editor/stamp.d.ts +1 -1
  26. package/dist/types/src/display/editor/toolbar.d.ts +17 -0
  27. package/dist/types/src/display/editor/tools.d.ts +39 -4
  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 +4 -5
  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 +40 -108
  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 +6 -3
  38. package/dist/types/src/shared/util.d.ts +24 -23
  39. package/dist/types/web/annotation_editor_layer_builder.d.ts +10 -13
  40. package/dist/types/web/annotation_layer_builder.d.ts +7 -4
  41. package/dist/types/web/app_options.d.ts +1 -2
  42. package/dist/types/web/draw_layer_builder.d.ts +23 -0
  43. package/dist/types/web/genericl10n.d.ts +5 -3
  44. package/dist/types/web/interfaces.d.ts +11 -8
  45. package/dist/types/web/l10n.d.ts +5 -2
  46. package/dist/types/web/pdf_find_controller.d.ts +1 -2
  47. package/dist/types/web/pdf_history.d.ts +1 -53
  48. package/dist/types/web/pdf_link_service.d.ts +6 -109
  49. package/dist/types/web/pdf_page_view.d.ts +5 -16
  50. package/dist/types/web/pdf_scripting_manager.d.ts +6 -10
  51. package/dist/types/web/pdf_single_page_viewer.d.ts +2 -2
  52. package/dist/types/web/pdf_thumbnail_view.d.ts +1 -13
  53. package/dist/types/web/pdf_thumbnail_viewer.d.ts +1 -17
  54. package/dist/types/web/pdf_viewer.component.d.ts +1 -2
  55. package/dist/types/web/pdf_viewer.d.ts +90 -42
  56. package/dist/types/web/text_accessibility.d.ts +1 -1
  57. package/dist/types/web/text_highlighter.d.ts +1 -1
  58. package/dist/types/web/text_layer_builder.d.ts +17 -29
  59. package/dist/types/web/ui_utils.d.ts +1 -1
  60. package/package.json +21 -30
  61. package/dist/types/web/l10n_utils.d.ts +0 -9
@@ -3,6 +3,7 @@ export type PageViewport = import("./display_utils").PageViewport;
3
3
  export type TextAccessibilityManager = import("../../web/text_accessibility.js").TextAccessibilityManager;
4
4
  export type IDownloadManager = import("../../web/interfaces").IDownloadManager;
5
5
  export type IPDFLinkService = import("../../web/interfaces").IPDFLinkService;
6
+ export type AnnotationEditorUIManager = any;
6
7
  export type AnnotationElementParameters = {
7
8
  data: Object;
8
9
  layer: HTMLDivElement;
@@ -26,7 +27,7 @@ export type AnnotationLayerParameters = {
26
27
  annotations: any[];
27
28
  page: PDFPageProxy;
28
29
  linkService: IPDFLinkService;
29
- downloadManager: IDownloadManager;
30
+ downloadManager?: import("../../web/interfaces").IDownloadManager | undefined;
30
31
  annotationStorage?: AnnotationStorage | undefined;
31
32
  /**
32
33
  * - Path for image resources, mainly
@@ -48,6 +49,7 @@ export type AnnotationLayerParameters = {
48
49
  } | null | undefined;
49
50
  annotationCanvasMap?: Map<string, HTMLCanvasElement> | undefined;
50
51
  accessibilityManager?: import("../../web/text_accessibility.js").TextAccessibilityManager | undefined;
52
+ annotationEditorUIManager?: any;
51
53
  };
52
54
  /**
53
55
  * @typedef {Object} AnnotationLayerParameters
@@ -56,7 +58,7 @@ export type AnnotationLayerParameters = {
56
58
  * @property {Array} annotations
57
59
  * @property {PDFPageProxy} page
58
60
  * @property {IPDFLinkService} linkService
59
- * @property {IDownloadManager} downloadManager
61
+ * @property {IDownloadManager} [downloadManager]
60
62
  * @property {AnnotationStorage} [annotationStorage]
61
63
  * @property {string} [imageResourcesPath] - Path for image resources, mainly
62
64
  * for annotation icons. Include trailing slash.
@@ -67,15 +69,17 @@ export type AnnotationLayerParameters = {
67
69
  * @property {Object<string, Array<Object>> | null} [fieldObjects]
68
70
  * @property {Map<string, HTMLCanvasElement>} [annotationCanvasMap]
69
71
  * @property {TextAccessibilityManager} [accessibilityManager]
72
+ * @property {AnnotationEditorUIManager} [annotationEditorUIManager]
70
73
  */
71
74
  /**
72
75
  * Manage the layer containing all the annotations.
73
76
  */
74
77
  export class AnnotationLayer {
75
- constructor({ div, accessibilityManager, annotationCanvasMap, page, viewport, }: {
78
+ constructor({ div, accessibilityManager, annotationCanvasMap, annotationEditorUIManager, page, viewport, }: {
76
79
  div: any;
77
80
  accessibilityManager: any;
78
81
  annotationCanvasMap: any;
82
+ annotationEditorUIManager: any;
79
83
  page: any;
80
84
  viewport: any;
81
85
  });
@@ -83,6 +87,7 @@ export class AnnotationLayer {
83
87
  page: any;
84
88
  viewport: any;
85
89
  zIndex: number;
90
+ _annotationEditorUIManager: any;
86
91
  popupShow: any[] | undefined;
87
92
  /**
88
93
  * Render a new annotation layer with all annotation elements.
@@ -150,6 +155,8 @@ declare class AnnotationElement {
150
155
  parent: any;
151
156
  container: HTMLElement | undefined;
152
157
  get hasPopupData(): boolean;
158
+ updateEdited(params: any): void;
159
+ resetEdited(): void;
153
160
  /**
154
161
  * Create an empty container for the annotation's HTML element.
155
162
  *
@@ -62,6 +62,7 @@ export class AnnotationStorage {
62
62
  hash: string;
63
63
  transfer: any[];
64
64
  };
65
+ get editorStats(): any;
65
66
  #private;
66
67
  }
67
68
  /**
@@ -1,5 +1,4 @@
1
1
  export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
2
- export type BinaryData = TypedArray | ArrayBuffer | Array<number> | string;
3
2
  export type RefProxy = {
4
3
  num: number;
5
4
  gen: number;
@@ -13,7 +12,8 @@ export type DocumentInitParameters = {
13
12
  */
14
13
  url?: string | URL | undefined;
15
14
  /**
16
- * - Binary PDF data.
15
+ * -
16
+ * Binary PDF data.
17
17
  * Use TypedArrays (Uint8Array) to improve the memory usage. If PDF data is
18
18
  * BASE64-encoded, use `atob()` to convert it to a binary string first.
19
19
  *
@@ -21,7 +21,7 @@ export type DocumentInitParameters = {
21
21
  * worker-thread. This will help reduce main-thread memory usage, however
22
22
  * it will take ownership of the TypedArrays.
23
23
  */
24
- data?: BinaryData | undefined;
24
+ data?: string | number[] | ArrayBuffer | TypedArray | undefined;
25
25
  /**
26
26
  * - Basic authentication headers.
27
27
  */
@@ -126,8 +126,8 @@ export type DocumentInitParameters = {
126
126
  maxImageSize?: number | undefined;
127
127
  /**
128
128
  * - Determines if we can evaluate strings
129
- * as JavaScript. Primarily used to improve performance of font rendering, and
130
- * when parsing PDF functions. The default value is `true`.
129
+ * as JavaScript. Primarily used to improve performance of PDF functions.
130
+ * The default value is `true`.
131
131
  */
132
132
  isEvalSupported?: boolean | undefined;
133
133
  /**
@@ -279,6 +279,10 @@ export type TextContent = {
279
279
  styles: {
280
280
  [x: string]: TextStyle;
281
281
  };
282
+ /**
283
+ * - The document /Lang attribute.
284
+ */
285
+ lang: string | null;
282
286
  };
283
287
  /**
284
288
  * Page text content part.
@@ -519,9 +523,9 @@ export type PDFWorkerParameters = {
519
523
  /** @type {string} */
520
524
  export const build: string;
521
525
  export const DefaultCanvasFactory: typeof DOMCanvasFactory | typeof NodeCanvasFactory;
522
- export const DefaultCMapReaderFactory: typeof DOMCMapReaderFactory;
526
+ export const DefaultCMapReaderFactory: typeof NodeCMapReaderFactory;
523
527
  export const DefaultFilterFactory: typeof DOMFilterFactory | typeof NodeFilterFactory;
524
- export const DefaultStandardFontDataFactory: typeof DOMStandardFontDataFactory;
528
+ export const DefaultStandardFontDataFactory: typeof NodeStandardFontDataFactory;
525
529
  /**
526
530
  * @typedef { Int8Array | Uint8Array | Uint8ClampedArray |
527
531
  * Int16Array | Uint16Array |
@@ -529,9 +533,6 @@ export const DefaultStandardFontDataFactory: typeof DOMStandardFontDataFactory;
529
533
  * Float64Array
530
534
  * } TypedArray
531
535
  */
532
- /**
533
- * @typedef { TypedArray | ArrayBuffer | Array<number> | string } BinaryData
534
- */
535
536
  /**
536
537
  * @typedef {Object} RefProxy
537
538
  * @property {number} num
@@ -542,7 +543,8 @@ export const DefaultStandardFontDataFactory: typeof DOMStandardFontDataFactory;
542
543
  *
543
544
  * @typedef {Object} DocumentInitParameters
544
545
  * @property {string | URL} [url] - The URL of the PDF.
545
- * @property {BinaryData} [data] - Binary PDF data.
546
+ * @property {TypedArray | ArrayBuffer | Array<number> | string} [data] -
547
+ * Binary PDF data.
546
548
  * Use TypedArrays (Uint8Array) to improve the memory usage. If PDF data is
547
549
  * BASE64-encoded, use `atob()` to convert it to a binary string first.
548
550
  *
@@ -598,8 +600,8 @@ export const DefaultStandardFontDataFactory: typeof DOMStandardFontDataFactory;
598
600
  * pixels, i.e. width * height. Images above this value will not be rendered.
599
601
  * Use -1 for no limit, which is also the default value.
600
602
  * @property {boolean} [isEvalSupported] - Determines if we can evaluate strings
601
- * as JavaScript. Primarily used to improve performance of font rendering, and
602
- * when parsing PDF functions. The default value is `true`.
603
+ * as JavaScript. Primarily used to improve performance of PDF functions.
604
+ * The default value is `true`.
603
605
  * @property {boolean} [isOffscreenCanvasSupported] - Determines if we can use
604
606
  * `OffscreenCanvas` in the worker. Primarily used to improve performance of
605
607
  * image conversion/rendering.
@@ -685,7 +687,7 @@ export class PDFDataRangeTransport {
685
687
  _progressListeners: any[];
686
688
  _progressiveReadListeners: any[];
687
689
  _progressiveDoneListeners: any[];
688
- _readyCapability: PromiseCapability;
690
+ _readyCapability: any;
689
691
  /**
690
692
  * @param {function} listener
691
693
  */
@@ -736,8 +738,8 @@ export class PDFDataRangeTransport {
736
738
  * after which individual pages can be rendered.
737
739
  */
738
740
  export class PDFDocumentLoadingTask {
739
- static "__#33@#docId": number;
740
- _capability: PromiseCapability;
741
+ static "__#45@#docId": number;
742
+ _capability: any;
741
743
  _transport: any;
742
744
  _worker: any;
743
745
  /**
@@ -917,11 +919,32 @@ export class PDFDocumentProxy {
917
919
  items: any[];
918
920
  }[]>;
919
921
  /**
922
+ * @typedef {Object} GetOptionalContentConfigParameters
923
+ * @property {string} [intent] - Determines the optional content groups that
924
+ * are visible by default; valid values are:
925
+ * - 'display' (viewable groups).
926
+ * - 'print' (printable groups).
927
+ * - 'any' (all groups).
928
+ * The default value is 'display'.
929
+ */
930
+ /**
931
+ * @param {GetOptionalContentConfigParameters} [params] - Optional content
932
+ * config parameters.
920
933
  * @returns {Promise<OptionalContentConfig>} A promise that is resolved with
921
934
  * an {@link OptionalContentConfig} that contains all the optional content
922
935
  * groups (assuming that the document has any).
923
936
  */
924
- getOptionalContentConfig(): Promise<OptionalContentConfig>;
937
+ getOptionalContentConfig({ intent }?: {
938
+ /**
939
+ * - Determines the optional content groups that
940
+ * are visible by default; valid values are:
941
+ * - 'display' (viewable groups).
942
+ * - 'print' (printable groups).
943
+ * - 'any' (all groups).
944
+ * The default value is 'display'.
945
+ */
946
+ intent?: string | undefined;
947
+ } | undefined): Promise<OptionalContentConfig>;
925
948
  /**
926
949
  * @returns {Promise<Array<number> | null>} A promise that is resolved with
927
950
  * an {Array} that contains the permission flags for the PDF document, or
@@ -991,6 +1014,11 @@ export class PDFDocumentProxy {
991
1014
  * Destroys the current document instance and terminates the worker.
992
1015
  */
993
1016
  destroy(): Promise<void>;
1017
+ /**
1018
+ * @param {RefProxy} ref - The page reference.
1019
+ * @returns {number | null} The page number, if it's cached.
1020
+ */
1021
+ cachedPageNumber(ref: RefProxy): number | null;
994
1022
  /**
995
1023
  * @type {DocumentInitParameters} A subset of the current
996
1024
  * {DocumentInitParameters}, which are needed in the viewer.
@@ -1052,6 +1080,7 @@ export class PDFDocumentProxy {
1052
1080
  * items are included when includeMarkedContent is true.
1053
1081
  * @property {Object<string, TextStyle>} styles - {@link TextStyle} objects,
1054
1082
  * indexed by font name.
1083
+ * @property {string | null} lang - The document /Lang attribute.
1055
1084
  */
1056
1085
  /**
1057
1086
  * Page text content part.
@@ -1226,11 +1255,11 @@ export class PDFPageProxy {
1226
1255
  */
1227
1256
  getViewport({ scale, rotation, offsetX, offsetY, dontFlip, }?: GetViewportParameters): PageViewport;
1228
1257
  /**
1229
- * @param {GetAnnotationsParameters} params - Annotation parameters.
1258
+ * @param {GetAnnotationsParameters} [params] - Annotation parameters.
1230
1259
  * @returns {Promise<Array<any>>} A promise that is resolved with an
1231
1260
  * {Array} of the annotation objects.
1232
1261
  */
1233
- getAnnotations({ intent }?: GetAnnotationsParameters): Promise<Array<any>>;
1262
+ getAnnotations({ intent }?: GetAnnotationsParameters | undefined): Promise<Array<any>>;
1234
1263
  /**
1235
1264
  * @returns {Promise<Object>} A promise that is resolved with an
1236
1265
  * {Object} with JS actions.
@@ -1334,7 +1363,7 @@ export class PDFPageProxy {
1334
1363
  * @param {PDFWorkerParameters} params - The worker initialization parameters.
1335
1364
  */
1336
1365
  export class PDFWorker {
1337
- static "__#36@#workerPorts": any;
1366
+ static "__#48@#workerPorts": any;
1338
1367
  /**
1339
1368
  * @param {PDFWorkerParameters} params - The worker initialization parameters.
1340
1369
  */
@@ -1344,7 +1373,7 @@ export class PDFWorker {
1344
1373
  * @type {string}
1345
1374
  */
1346
1375
  static get workerSrc(): string;
1347
- static get "__#36@#mainThreadWorkerMessageHandler"(): any;
1376
+ static get "__#48@#mainThreadWorkerMessageHandler"(): any;
1348
1377
  static get _setupFakeWorkerGlobal(): any;
1349
1378
  constructor({ name, port, verbosity, }?: {
1350
1379
  name?: null | undefined;
@@ -1354,7 +1383,7 @@ export class PDFWorker {
1354
1383
  name: any;
1355
1384
  destroyed: boolean;
1356
1385
  verbosity: number;
1357
- _readyCapability: PromiseCapability;
1386
+ _readyCapability: any;
1358
1387
  _port: any;
1359
1388
  _webWorker: Worker | null;
1360
1389
  _messageHandler: MessageHandler | null;
@@ -1424,13 +1453,11 @@ import { OptionalContentConfig } from "./optional_content_config.js";
1424
1453
  import { PrintAnnotationStorage } from "./annotation_storage.js";
1425
1454
  import { DOMCanvasFactory } from "./display_utils.js";
1426
1455
  import { NodeCanvasFactory } from "./node_utils";
1427
- import { DOMCMapReaderFactory } from "./display_utils.js";
1456
+ import { NodeCMapReaderFactory } from "./node_utils";
1428
1457
  import { DOMFilterFactory } from "./display_utils.js";
1429
1458
  import { NodeFilterFactory } from "./node_utils";
1430
- import { DOMStandardFontDataFactory } from "./display_utils.js";
1431
- import { PromiseCapability } from "../shared/util.js";
1459
+ import { NodeStandardFontDataFactory } from "./node_utils";
1432
1460
  import { AnnotationStorage } from "./annotation_storage.js";
1433
- import { info } from "../shared/util.js";
1434
1461
  import { Metadata } from "./metadata.js";
1435
1462
  import { StatTimer } from "./display_utils.js";
1436
1463
  /**
@@ -1465,6 +1492,7 @@ declare class PDFObjects {
1465
1492
  */
1466
1493
  resolve(objId: string, data?: any): void;
1467
1494
  clear(): void;
1495
+ [Symbol.iterator](): Generator<any[], void, unknown>;
1468
1496
  #private;
1469
1497
  }
1470
1498
  import { MessageHandler } from "../shared/message_handler.js";
@@ -28,7 +28,9 @@ export class BaseCMapReaderFactory {
28
28
  export class BaseFilterFactory {
29
29
  addFilter(maps: any): string;
30
30
  addHCMFilter(fgColor: any, bgColor: any): string;
31
- addHighlightHCMFilter(fgColor: any, bgColor: any, newFgColor: any, newBgColor: any): string;
31
+ addAlphaFilter(map: any): string;
32
+ addLuminosityFilter(map: any): string;
33
+ addHighlightHCMFilter(filterName: any, fgColor: any, bgColor: any, newFgColor: any, newBgColor: any): string;
32
34
  destroy(keepHCM?: boolean): void;
33
35
  }
34
36
  export class BaseStandardFontDataFactory {
@@ -79,6 +79,8 @@ export class CanvasGraphics {
79
79
  beginSMaskMode(): void;
80
80
  endSMaskMode(): void;
81
81
  compose(dirtyBox: any): void;
82
+ composeSMask(ctx: any, smask: any, layerCtx: any, layerBox: any): void;
83
+ genericComposeSMask(maskCtx: any, layerCtx: any, width: any, height: any, subtype: any, backdrop: any, transferMap: any, layerOffsetX: any, layerOffsetY: any, maskOffsetX: any, maskOffsetY: any): void;
82
84
  save(): void;
83
85
  restore(): void;
84
86
  transform(a: any, b: any, c: any, d: any, e: any, f: any): void;
@@ -71,7 +71,7 @@ export class DOMCMapReaderFactory extends BaseCMapReaderFactory {
71
71
  * @ignore
72
72
  */
73
73
  _fetchData(url: any, compressionType: any): Promise<{
74
- cMapData: any;
74
+ cMapData: Uint8Array;
75
75
  compressionType: any;
76
76
  }>;
77
77
  }
@@ -91,14 +91,16 @@ export class DOMFilterFactory extends BaseFilterFactory {
91
91
  });
92
92
  addFilter(maps: any): any;
93
93
  addHCMFilter(fgColor: any, bgColor: any): any;
94
- addHighlightHCMFilter(fgColor: any, bgColor: any, newFgColor: any, newBgColor: any): any;
94
+ addAlphaFilter(map: any): any;
95
+ addLuminosityFilter(map: any): any;
96
+ addHighlightHCMFilter(filterName: any, fgColor: any, bgColor: any, newFgColor: any, newBgColor: any): any;
95
97
  #private;
96
98
  }
97
99
  export class DOMStandardFontDataFactory extends BaseStandardFontDataFactory {
98
100
  /**
99
101
  * @ignore
100
102
  */
101
- _fetchData(url: any): Promise<any>;
103
+ _fetchData(url: any): Promise<Uint8Array>;
102
104
  }
103
105
  export class DOMSVGFactory extends BaseSVGFactory {
104
106
  /**
@@ -106,16 +108,16 @@ export class DOMSVGFactory extends BaseSVGFactory {
106
108
  */
107
109
  _createSVG(type: any): any;
108
110
  }
111
+ export function fetchData(url: any, type?: string): Promise<any>;
109
112
  export function getColorValues(colors: any): void;
110
113
  export function getCurrentTransform(ctx: any): any[];
111
114
  export function getCurrentTransformInverse(ctx: any): any[];
112
115
  /**
113
116
  * Gets the filename from a given URL.
114
117
  * @param {string} url
115
- * @param {boolean} [onlyStripPath]
116
118
  * @returns {string}
117
119
  */
118
- export function getFilenameFromUrl(url: string, onlyStripPath?: boolean | undefined): string;
120
+ export function getFilenameFromUrl(url: string): string;
119
121
  /**
120
122
  * Returns the filename or guessed filename from the url (see issue 3455).
121
123
  * @param {string} url - The original PDF location.
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Manage the SVGs drawn on top of the page canvas.
3
+ * It's important to have them directly on top of the canvas because we want to
4
+ * be able to use mix-blend-mode for some of them.
5
+ */
6
+ export class DrawLayer {
7
+ static get _svgFactory(): any;
8
+ static "__#26@#setBox"(element: any, { x, y, width, height }?: {
9
+ x?: number | undefined;
10
+ y?: number | undefined;
11
+ width?: number | undefined;
12
+ height?: number | undefined;
13
+ }): void;
14
+ constructor({ pageIndex }: {
15
+ pageIndex: any;
16
+ });
17
+ pageIndex: any;
18
+ setParent(parent: any): void;
19
+ highlight(outlines: any, color: any, opacity: any, isPathUpdatable?: boolean): {
20
+ id: number;
21
+ clipPathId: string;
22
+ };
23
+ highlightOutline(outlines: any): number;
24
+ finalizeLine(id: any, line: any): void;
25
+ updateLine(id: any, line: any): void;
26
+ removeFreeHighlight(id: any): void;
27
+ updatePath(id: any, line: any): void;
28
+ updateBox(id: any, box: any): void;
29
+ show(id: any, visible: any): void;
30
+ rotate(id: any, angle: any): void;
31
+ changeColor(id: any, color: any): void;
32
+ changeOpacity(id: any, opacity: any): void;
33
+ addClass(id: any, className: any): void;
34
+ removeClass(id: any, className: any): void;
35
+ remove(id: any): void;
36
+ destroy(): void;
37
+ #private;
38
+ }
@@ -0,0 +1,22 @@
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
+ /**
9
+ * Set the alt text data.
10
+ */
11
+ set data({ altText, decorative }: {
12
+ altText: string;
13
+ decorative: boolean;
14
+ });
15
+ get data(): {
16
+ altText: string;
17
+ decorative: boolean;
18
+ };
19
+ toggle(enabled?: boolean): void;
20
+ destroy(): void;
21
+ #private;
22
+ }
@@ -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 "__#27@#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.
@@ -69,6 +77,7 @@ export class AnnotationEditorLayer {
69
77
  */
70
78
  addCommands(params: Object): void;
71
79
  togglePointerEvents(enabled?: boolean): void;
80
+ toggleAnnotationLayerPointerEvents(enabled?: boolean): void;
72
81
  /**
73
82
  * Enable pointer events on the main div in order to enable
74
83
  * editor creation.
@@ -84,6 +93,8 @@ export class AnnotationEditorLayer {
84
93
  * @param {AnnotationEditor} editor
85
94
  */
86
95
  setActiveEditor(editor: AnnotationEditor): void;
96
+ enableTextSelection(): void;
97
+ disableTextSelection(): void;
87
98
  enableClick(): void;
88
99
  disableClick(): void;
89
100
  attach(editor: any): void;
@@ -120,6 +131,7 @@ export class AnnotationEditorLayer {
120
131
  * @returns {string}
121
132
  */
122
133
  getNextId(): string;
134
+ canCreateNewEmptyEditor(): boolean | undefined;
123
135
  /**
124
136
  * Paste some content into a new editor.
125
137
  * @param {number} mode
@@ -132,6 +144,14 @@ export class AnnotationEditorLayer {
132
144
  * @returns {AnnotationEditor | null}
133
145
  */
134
146
  deserialize(data: Object): AnnotationEditor | null;
147
+ /**
148
+ * Create and add a new editor.
149
+ * @param {PointerEvent} event
150
+ * @param {boolean} isCentered
151
+ * @param [Object] data
152
+ * @returns {AnnotationEditor}
153
+ */
154
+ createAndAddNewEditor(event: PointerEvent, isCentered: boolean, data?: {}): AnnotationEditor;
135
155
  /**
136
156
  * Create and add a new editor.
137
157
  */
@@ -193,9 +213,11 @@ export class AnnotationEditorLayer {
193
213
  * @returns {Object} dimensions.
194
214
  */
195
215
  get pageDimensions(): Object;
216
+ get scale(): number;
196
217
  #private;
197
218
  }
198
219
  import { AnnotationEditor } from "./editor.js";
199
220
  import { FreeTextEditor } from "./freetext.js";
221
+ import { HighlightEditor } from "./highlight.js";
200
222
  import { InkEditor } from "./ink.js";
201
223
  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
+ }