unpdf 1.6.2 → 1.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 (122) hide show
  1. package/README.md +61 -25
  2. package/dist/index.cjs +386 -353
  3. package/dist/index.d.cts +101 -91
  4. package/dist/index.d.mts +101 -91
  5. package/dist/index.mjs +385 -351
  6. package/dist/pdfjs.d.mts +1 -1
  7. package/dist/pdfjs.d.ts +1 -1
  8. package/dist/pdfjs.mjs +52 -59
  9. package/dist/types/external/brotli/decode.d.ts +5 -0
  10. package/dist/types/external/jbig2/jbig2.d.ts +2 -0
  11. package/dist/types/external/openjpeg/openjpeg.d.ts +2 -0
  12. package/dist/types/external/qcms/qcms.d.ts +92 -0
  13. package/dist/types/external/qcms/qcms_utils.d.ts +14 -0
  14. package/dist/types/src/core/ascii_85_stream.d.ts +7 -0
  15. package/dist/types/src/core/ascii_hex_stream.d.ts +7 -0
  16. package/dist/types/src/core/base_stream.d.ts +45 -0
  17. package/dist/types/src/core/brotli_stream.d.ts +9 -0
  18. package/dist/types/src/core/calculate_md5.d.ts +1 -0
  19. package/dist/types/src/core/calculate_sha256.d.ts +1 -0
  20. package/dist/types/src/core/calculate_sha_other.d.ts +2 -0
  21. package/dist/types/src/core/catalog.d.ts +169 -0
  22. package/dist/types/src/core/ccitt_stream.d.ts +18 -0
  23. package/dist/types/src/core/cleanup_helper.d.ts +1 -0
  24. package/dist/types/src/core/colorspace.d.ts +177 -0
  25. package/dist/types/src/core/colorspace_utils.d.ts +21 -0
  26. package/dist/types/src/core/core_utils.d.ts +132 -0
  27. package/dist/types/src/core/crypto.d.ts +136 -0
  28. package/dist/types/src/core/decode_stream.d.ts +32 -0
  29. package/dist/types/src/core/decrypt_stream.d.ts +9 -0
  30. package/dist/types/src/core/file_spec.d.ts +72 -0
  31. package/dist/types/src/core/flate_stream.d.ts +14 -0
  32. package/dist/types/src/core/icc_colorspace.d.ts +22 -0
  33. package/dist/types/src/core/image_utils.d.ts +52 -0
  34. package/dist/types/src/core/jbig2_ccittFax.d.ts +13 -0
  35. package/dist/types/src/core/jbig2_stream.d.ts +17 -0
  36. package/dist/types/src/core/jpeg_stream.d.ts +24 -0
  37. package/dist/types/src/core/jpg.d.ts +62 -0
  38. package/dist/types/src/core/jpx.d.ts +24 -0
  39. package/dist/types/src/core/jpx_stream.d.ts +15 -0
  40. package/dist/types/src/core/lzw_stream.d.ts +19 -0
  41. package/dist/types/src/core/metadata_parser.d.ts +13 -0
  42. package/dist/types/src/core/name_number_tree.d.ts +21 -0
  43. package/dist/types/src/core/parser.d.ts +121 -0
  44. package/dist/types/src/core/pattern.d.ts +63 -0
  45. package/dist/types/src/core/predictor_stream.d.ts +14 -0
  46. package/dist/types/src/core/primitives.d.ts +81 -0
  47. package/dist/types/src/core/run_length_stream.d.ts +6 -0
  48. package/dist/types/src/core/stream.d.ts +20 -0
  49. package/dist/types/src/core/string_utils.d.ts +5 -0
  50. package/dist/types/src/core/struct_tree.d.ts +93 -0
  51. package/dist/types/src/core/unicode.d.ts +5 -0
  52. package/dist/types/src/core/wasm_image.d.ts +21 -0
  53. package/dist/types/src/core/xml_parser.d.ts +79 -0
  54. package/dist/types/src/core/xref.d.ts +52 -0
  55. package/dist/types/src/display/annotation_layer.d.ts +11 -9
  56. package/dist/types/src/display/api.d.ts +92 -65
  57. package/dist/types/src/display/binary_data_factory.d.ts +0 -4
  58. package/dist/types/src/display/canvas.d.ts +58 -12
  59. package/dist/types/src/display/canvas_dependency_tracker.d.ts +2 -2
  60. package/dist/types/src/display/display_utils.d.ts +4 -156
  61. package/dist/types/src/display/draw_layer.d.ts +127 -2
  62. package/dist/types/src/display/editor/alt_text.d.ts +1 -1
  63. package/dist/types/src/display/editor/annotation_editor_layer.d.ts +3 -3
  64. package/dist/types/src/display/editor/color_picker.d.ts +3 -2
  65. package/dist/types/src/display/editor/draw.d.ts +10 -3
  66. package/dist/types/src/display/editor/drawers/freedraw.d.ts +3 -3
  67. package/dist/types/src/display/editor/drawers/highlight.d.ts +0 -1
  68. package/dist/types/src/display/editor/drawers/outline.d.ts +0 -1
  69. package/dist/types/src/display/editor/drawers/signaturedraw.d.ts +13 -13
  70. package/dist/types/src/display/editor/editor.d.ts +2 -1
  71. package/dist/types/src/display/editor/freetext.d.ts +2 -2
  72. package/dist/types/src/display/editor/highlight.d.ts +3 -3
  73. package/dist/types/src/display/editor/ink.d.ts +2 -0
  74. package/dist/types/src/display/editor/toolbar.d.ts +2 -2
  75. package/dist/types/src/display/editor/tools.d.ts +31 -14
  76. package/dist/types/src/display/filter_factory.d.ts +26 -0
  77. package/dist/types/src/display/node_utils.d.ts +2 -2
  78. package/dist/types/src/display/obj_bin_transform_display.d.ts +2 -6
  79. package/dist/types/src/display/optional_content_config.d.ts +13 -3
  80. package/dist/types/src/display/page_viewport.d.ts +137 -0
  81. package/dist/types/src/display/pattern_helper.d.ts +11 -4
  82. package/dist/types/src/display/text_layer.d.ts +13 -13
  83. package/dist/types/src/display/text_layer_images.d.ts +1 -1
  84. package/dist/types/src/display/webgpu.d.ts +11 -0
  85. package/dist/types/src/display/worker_options.d.ts +2 -2
  86. package/dist/types/src/display/xfa_layer.d.ts +10 -3
  87. package/dist/types/src/display/xfa_text.d.ts +2 -2
  88. package/dist/types/src/pdf.d.ts +10 -9
  89. package/dist/types/src/shared/image_utils.d.ts +11 -0
  90. package/dist/types/src/shared/internal_evt.d.ts +7 -0
  91. package/dist/types/src/shared/math_clamp.d.ts +1 -0
  92. package/dist/types/src/shared/util.d.ts +24 -13
  93. package/dist/types/web/annotation_editor_layer_builder.d.ts +5 -5
  94. package/dist/types/web/annotation_layer_builder.d.ts +14 -11
  95. package/dist/types/web/app_options.d.ts +1 -1
  96. package/dist/types/web/autolinker.d.ts +3 -3
  97. package/dist/types/web/base_pdf_page_view.d.ts +1 -0
  98. package/dist/types/web/comment_manager.d.ts +1 -1
  99. package/dist/types/web/draw_layer_builder.d.ts +44 -0
  100. package/dist/types/web/event_utils.d.ts +0 -8
  101. package/dist/types/web/generic_scripting.d.ts +1 -1
  102. package/dist/types/web/genericl10n.d.ts +5 -5
  103. package/dist/types/web/internal_evt.d.ts +7 -0
  104. package/dist/types/web/l10n.d.ts +2 -2
  105. package/dist/types/web/pdf_find_controller.d.ts +16 -5
  106. package/dist/types/web/pdf_history.d.ts +1 -1
  107. package/dist/types/web/pdf_link_service.d.ts +10 -2
  108. package/dist/types/web/pdf_page_view.d.ts +19 -12
  109. package/dist/types/web/pdf_rendering_queue.d.ts +3 -3
  110. package/dist/types/web/pdf_scripting_manager.d.ts +1 -1
  111. package/dist/types/web/pdf_thumbnail_view.d.ts +9 -9
  112. package/dist/types/web/pdf_thumbnail_viewer.d.ts +38 -19
  113. package/dist/types/web/pdf_viewer.d.ts +28 -14
  114. package/dist/types/web/renderable_view.d.ts +2 -2
  115. package/dist/types/web/struct_tree_layer_builder.d.ts +1 -1
  116. package/dist/types/web/text_accessibility.d.ts +1 -1
  117. package/dist/types/web/text_highlighter.d.ts +6 -6
  118. package/dist/types/web/text_layer_builder.d.ts +10 -10
  119. package/dist/types/web/xfa_layer_builder.d.ts +8 -8
  120. package/package.json +25 -24
  121. package/dist/index.d.ts +0 -182
  122. package/dist/types/src/display/webgpu_mesh.d.ts +0 -3
@@ -1,12 +1,137 @@
1
+ /**
2
+ * Configuration for {@linkcode DrawLayer}.
3
+ */
4
+ export type DrawLayerOptions = {
5
+ /**
6
+ * Filter factory used to style selections (optional).
7
+ */
8
+ filterFactory?: Object | null | undefined;
9
+ /**
10
+ * Page foreground/background colors for HCM (optional).
11
+ */
12
+ pageColors?: Object | null | undefined;
13
+ /**
14
+ * Zero-based page index.
15
+ */
16
+ pageIndex: number;
17
+ /**
18
+ * Text layer element (optional).
19
+ */
20
+ textLayer?: Element | null | undefined;
21
+ };
22
+ /**
23
+ * Result of {@linkcode normalizeEdgeBoundary}.
24
+ */
25
+ export type EdgeBoundaryResult = {
26
+ /**
27
+ * Normalized container.
28
+ */
29
+ container: Node;
30
+ /**
31
+ * Normalized offset.
32
+ */
33
+ offset: number;
34
+ };
35
+ /**
36
+ * Result of {@linkcode SelectionRotator}.
37
+ */
38
+ export type SelectionRotatorResult = {
39
+ /**
40
+ * Rotated X coordinate.
41
+ */
42
+ x: number;
43
+ /**
44
+ * Rotated Y coordinate.
45
+ */
46
+ y: number;
47
+ /**
48
+ * Rotated width.
49
+ */
50
+ width: number;
51
+ /**
52
+ * Rotated height.
53
+ */
54
+ height: number;
55
+ };
56
+ /**
57
+ * Rotate the coordinates of a rectangle according to the position of the
58
+ * text layer in the viewport.
59
+ */
60
+ export type SelectionRotator = (x: number, y: number, width: number, height: number) => SelectionRotatorResult;
61
+ /**
62
+ * Data related to the selection for a text layer.
63
+ */
64
+ export type TextLayerSelectionData = {
65
+ /**
66
+ * Draw layer associated with the text layer.
67
+ */
68
+ drawLayer: DrawLayer;
69
+ /**
70
+ * Node (SVG path element) used to draw the selection.
71
+ */
72
+ path?: SVGPathElement | null | undefined;
73
+ /**
74
+ * Node (div element) used to display the selection.
75
+ */
76
+ selectionDiv?: HTMLDivElement | null | undefined;
77
+ };
1
78
  /**
2
79
  * Manage the SVGs drawn on top of the page canvas.
3
80
  * It's important to have them directly on top of the canvas because we want to
4
81
  * be able to use mix-blend-mode for some of them.
5
82
  */
6
83
  export class DrawLayer {
7
- static "__#private@#id": number;
84
+ static #id: number;
85
+ static #selectionId: number;
86
+ /** @type {AbortController | null} */
87
+ static #selectionChangeAC: AbortController | null;
88
+ /** @type {Set<HTMLDivElement>} */
89
+ static #selections: Set<HTMLDivElement>;
90
+ /** @type {boolean} */
91
+ static #isSelecting: boolean;
92
+ /** @type {Set<Element>} */
93
+ static #textLayerSet: Set<Element>;
94
+ /** @type {WeakMap<Element, TextLayerSelectionData>} */
95
+ static #textLayers: WeakMap<Element, TextLayerSelectionData>;
96
+ /**
97
+ * Clean up the selection for a text layer.
98
+ *
99
+ * @param {Element} textLayer
100
+ * Text layer.
101
+ * @returns {undefined}
102
+ * Nothing.
103
+ */
104
+ static #cleanupTextLayerSelection(textLayer: Element): undefined;
105
+ /**
106
+ * @returns {boolean}
107
+ * Whether there is a non-collapsed document selection.
108
+ */
109
+ static #hasSelection(): boolean;
110
+ /**
111
+ * @returns {Array<Element>}
112
+ * Connected text layers sorted in document order.
113
+ */
114
+ static #getOrderedTextLayers(): Array<Element>;
115
+ /**
116
+ * Handle `selectionchange` to update the selection display for text layers.
117
+ * We want to display the selection in a separate layer on top of the text
118
+ * layer because the text layer has `mix-blend-mode: multiply` and we want
119
+ * the selection to have a different blend mode.
120
+ *
121
+ * @returns {undefined}
122
+ * Nothing.
123
+ */
124
+ static #selectionChange(): undefined;
8
125
  static get _svgFactory(): any;
9
- static "__#private@#setBox"(element: any, [x, y, width, height]: [any, any, any, any]): void;
126
+ static #setBox(element: any, [x, y, width, height]: [any, any, any, any]): void;
127
+ /**
128
+ * @param {DrawLayerOptions} options
129
+ * Configuration.
130
+ * @returns
131
+ * Instance.
132
+ */
133
+ constructor({ filterFactory, pageColors, pageIndex, textLayer, }: DrawLayerOptions);
134
+ pageIndex: number;
10
135
  setParent(parent: any): void;
11
136
  draw(properties: any, isPathUpdatable?: boolean, hasClip?: boolean): {
12
137
  id: number;
@@ -1,5 +1,5 @@
1
1
  export class AltText {
2
- static "__#private@#l10nNewButton": null;
2
+ static #l10nNewButton: null;
3
3
  static _l10n: null;
4
4
  static initialize(l10n: any): void;
5
5
  constructor(editor: any);
@@ -1,5 +1,5 @@
1
1
  export type AnnotationEditorUIManager = import("./tools.js").AnnotationEditorUIManager;
2
- export type PageViewport = import("../display_utils.js").PageViewport;
2
+ export type PageViewport = import("../page_viewport.js").PageViewport;
3
3
  export type TextAccessibilityManager = import("../../../web/text_accessibility.js").TextAccessibilityManager;
4
4
  export type AnnotationLayer = import("../annotation_layer.js").AnnotationLayer;
5
5
  export type DrawLayer = import("../draw_layer.js").DrawLayer;
@@ -46,14 +46,14 @@ export type RenderEditorLayerOptions = {
46
46
  */
47
47
  export class AnnotationEditorLayer {
48
48
  static _initialized: boolean;
49
- static "__#private@#editorTypes": Map<number, typeof FreeTextEditor | typeof HighlightEditor | typeof InkEditor | typeof SignatureEditor | typeof StampEditor>;
49
+ static #editorTypes: Map<number, typeof FreeTextEditor | typeof HighlightEditor | typeof InkEditor | typeof SignatureEditor | typeof StampEditor>;
50
50
  /**
51
51
  * @param {AnnotationEditorLayerOptions} options
52
52
  */
53
53
  constructor({ uiManager, pageIndex, div, structTreeLayer, accessibilityManager, annotationLayer, drawLayer, textLayer, viewport, l10n, }: AnnotationEditorLayerOptions);
54
54
  pageIndex: number;
55
55
  div: HTMLDivElement;
56
- viewport: import("../display_utils.js").PageViewport;
56
+ viewport: import("../page_viewport.js").PageViewport;
57
57
  drawLayer: import("../draw_layer.js").DrawLayer;
58
58
  _structTree: import("../../../web/struct_tree_layer_builder.js").StructTreeLayerBuilder;
59
59
  get isEmpty(): boolean;
@@ -4,10 +4,11 @@
4
4
  * to select a color for the annotation.
5
5
  */
6
6
  export class BasicColorPicker {
7
- static "__#private@#l10nColor": null;
7
+ static #l10nColor: null;
8
8
  constructor(editor: any);
9
9
  renderButton(): HTMLInputElement;
10
10
  update(value: any): void;
11
+ updateOpacity(value: any): void;
11
12
  destroy(): void;
12
13
  hideDropdown(): void;
13
14
  #private;
@@ -18,7 +19,7 @@ export class BasicColorPicker {
18
19
  * to select a color for the annotation.
19
20
  */
20
21
  export class ColorPicker {
21
- static "__#private@#l10nColor": null;
22
+ static #l10nColor: null;
22
23
  static get _keyboardManager(): any;
23
24
  constructor({ editor, uiManager }: {
24
25
  editor?: null | undefined;
@@ -4,9 +4,9 @@
4
4
  export class DrawingEditor extends AnnotationEditor {
5
5
  static _currentDrawId: number;
6
6
  static _currentParent: null;
7
- static "__#private@#currentDraw": null;
8
- static "__#private@#currentDrawingAC": null;
9
- static "__#private@#currentDrawingOptions": null;
7
+ static #currentDraw: null;
8
+ static #currentDrawingAC: null;
9
+ static #currentDrawingOptions: null;
10
10
  static _INNER_MARGIN: number;
11
11
  static _mergeSVGProperties(p1: any, p2: any): any;
12
12
  /**
@@ -27,6 +27,7 @@ export class DrawingEditor extends AnnotationEditor {
27
27
  INK_COLOR: number;
28
28
  INK_THICKNESS: number;
29
29
  INK_OPACITY: number;
30
+ INK_COLOR_AND_OPACITY: number;
30
31
  HIGHLIGHT_COLOR: number;
31
32
  HIGHLIGHT_THICKNESS: number;
32
33
  HIGHLIGHT_FREE: number;
@@ -73,6 +74,8 @@ export class DrawingEditor extends AnnotationEditor {
73
74
  constructor(params: any);
74
75
  _colorPicker: null;
75
76
  _drawId: null;
77
+ /** @inheritdoc */
78
+ onUpdatedOpacity(): void;
76
79
  _addOutlines(params: any): void;
77
80
  /** @inheritdoc */
78
81
  updateParams(type: any, value: any): void;
@@ -83,6 +86,10 @@ export class DrawingEditor extends AnnotationEditor {
83
86
  * @param {string} color
84
87
  */
85
88
  _updateProperty(type: any, name: any, value: any): void;
89
+ /**
90
+ * Update color and opacity atomically as one undoable command.
91
+ */
92
+ _updateColorAndOpacity(color: any, opacity: any): void;
86
93
  /** @inheritdoc */
87
94
  _onTranslating(_x: any, _y: any): void;
88
95
  /** @inheritdoc */
@@ -12,9 +12,9 @@ export class FreeDrawOutline extends Outline {
12
12
  #private;
13
13
  }
14
14
  export class FreeDrawOutliner {
15
- static "__#private@#MIN_DIST": number;
16
- static "__#private@#MIN_DIFF": number;
17
- static "__#private@#MIN": number;
15
+ static #MIN_DIST: number;
16
+ static #MIN_DIFF: number;
17
+ static #MIN: number;
18
18
  constructor({ x, y }: {
19
19
  x: any;
20
20
  y: any;
@@ -30,7 +30,6 @@ declare class HighlightOutline extends Outline {
30
30
  */
31
31
  serialize([blX, blY, trX, trY]: Array<number>, _rotation: number): Array<Array<number>>;
32
32
  get box(): any;
33
- get classNamesForOutlining(): string[];
34
33
  #private;
35
34
  }
36
35
  import { Outline } from "./outline.js";
@@ -5,7 +5,6 @@ export class Outline {
5
5
  static _translate(src: any, tx: any, ty: any, dest: any): any;
6
6
  static svgRound(x: any): number;
7
7
  static _normalizePoint(x: any, y: any, parentWidth: any, parentHeight: any, rotation: any): number[];
8
- static _normalizePagePoint(x: any, y: any, rotation: any): any[];
9
8
  static createBezierPoints(x1: any, y1: any, x2: any, y2: any, x3: any, y3: any): number[];
10
9
  /**
11
10
  * @returns {string} The SVG path of the outline.
@@ -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 "__#private@#PARAMETERS": {
5
+ static #PARAMETERS: {
6
6
  maxDim: number;
7
7
  sigmaSFactor: number;
8
8
  sigmaR: number;
9
9
  kernelSize: number;
10
10
  };
11
- static "__#private@#neighborIndexToId"(i0: any, j0: any, i: any, j: any): any;
12
- static "__#private@#neighborIdToIndex": Int32Array<ArrayBuffer>;
13
- static "__#private@#clockwiseNonZero"(buf: any, width: any, i0: any, j0: any, i: any, j: any, offset: any): number;
14
- static "__#private@#counterClockwiseNonZero"(buf: any, width: any, i0: any, j0: any, i: any, j: any, offset: any): number;
15
- static "__#private@#findContours"(buf: any, width: any, height: any, threshold: any): {
11
+ static #neighborIndexToId(i0: any, j0: any, i: any, j: any): any;
12
+ static #neighborIdToIndex: Int32Array<ArrayBuffer>;
13
+ static #clockwiseNonZero(buf: any, width: any, i0: any, j0: any, i: any, j: any, offset: any): number;
14
+ static #counterClockwiseNonZero(buf: any, width: any, i0: any, j0: any, i: any, j: any, offset: any): number;
15
+ static #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 "__#private@#douglasPeuckerHelper"(points: any, start: any, end: any, output: any): void;
22
- static "__#private@#douglasPeucker"(points: any): any[] | null;
23
- static "__#private@#bilateralFilter"(buf: any, width: any, height: any, sigmaS: any, sigmaR: any, kernelSize: any): (Uint32Array<ArrayBuffer> | Uint8Array<any>)[];
24
- static "__#private@#getHistogram"(buf: any): Uint32Array<ArrayBuffer>;
25
- static "__#private@#toUint8"(buf: any): Uint8ClampedArray<ArrayBuffer>;
26
- static "__#private@#guessThreshold"(histogram: any): number;
27
- static "__#private@#getGrayPixels"(bitmap: any): any[];
21
+ static #douglasPeuckerHelper(points: any, start: any, end: any, output: any): void;
22
+ static #douglasPeucker(points: any): any[] | null;
23
+ static #bilateralFilter(buf: any, width: any, height: any, sigmaS: any, sigmaR: any, kernelSize: any): (Uint32Array<ArrayBuffer> | Uint8Array<any>)[];
24
+ static #getHistogram(buf: any): Uint32Array<ArrayBuffer>;
25
+ static #toUint8(buf: any): Uint8ClampedArray<ArrayBuffer>;
26
+ static #guessThreshold(histogram: any): number;
27
+ static #getGrayPixels(bitmap: any): any[];
28
28
  static extractContoursFromText(text: any, { fontFamily, fontStyle, fontWeight }: {
29
29
  fontFamily: any;
30
30
  fontStyle: any;
@@ -34,6 +34,7 @@ export type AnnotationEditorParameters = {
34
34
  */
35
35
  export class AnnotationEditor {
36
36
  static _l10n: null;
37
+ static _l10nAlert: null;
37
38
  static _l10nResizer: null;
38
39
  static _borderLineWidth: number;
39
40
  static _colorManager: ColorManager;
@@ -73,7 +74,7 @@ export class AnnotationEditor {
73
74
  * @param {AnnotationEditorLayer} parent
74
75
  */
75
76
  static paste(item: DataTransferItem, parent: AnnotationEditorLayer): void;
76
- static "__#private@#rotatePoint"(x: any, y: any, angle: any): any[];
77
+ static #rotatePoint(x: any, y: any, angle: any): any[];
77
78
  static _round(x: any): number;
78
79
  /**
79
80
  * Deserialize the editor.
@@ -16,8 +16,8 @@ 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 "__#private@#getNodeContent"(node: any): any;
20
- static "__#private@#deserializeContent"(content: any): any;
19
+ static #getNodeContent(node: any): any;
20
+ static #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);
@@ -19,14 +19,14 @@ export class HighlightEditor extends AnnotationEditor {
19
19
  /** @inheritdoc */
20
20
  static updateDefaultParams(type: any, value: any): void;
21
21
  static get defaultPropertiesToUpdate(): (number | null)[][];
22
- static "__#private@#rotateBbox"([x, y, width, height]: [any, any, any, any], angle: any): any[];
22
+ static #rotateBbox([x, y, width, height]: [any, any, any, any], angle: any): any[];
23
23
  static startHighlighting(parent: any, isLTR: any, { target: textLayer, x, y }: {
24
24
  target: any;
25
25
  x: any;
26
26
  y: any;
27
27
  }): void;
28
- static "__#private@#highlightMove"(parent: any, event: any): void;
29
- static "__#private@#endHighlight"(parent: any, event: any): void;
28
+ static #highlightMove(parent: any, event: any): void;
29
+ static #endHighlight(parent: any, event: any): void;
30
30
  /** @inheritdoc */
31
31
  static deserialize(data: any, parent: any, uiManager: any): Promise<AnnotationEditor | null>;
32
32
  constructor(params: any);
@@ -24,6 +24,8 @@ export class InkEditor extends DrawingEditor {
24
24
  /** @inheritdoc */
25
25
  get toolbarButtons(): (string | null)[][];
26
26
  get colorType(): number;
27
+ get colorAndOpacityType(): number;
28
+ get opacityType(): number;
27
29
  get color(): any;
28
30
  get opacity(): any;
29
31
  /** @inheritdoc */
@@ -1,6 +1,6 @@
1
1
  export class EditorToolbar {
2
- static "__#private@#l10nRemove": null;
3
- static "__#private@#pointerDown"(e: any): void;
2
+ static #l10nRemove: null;
3
+ static #pointerDown(e: any): void;
4
4
  constructor(editor: any);
5
5
  render(): HTMLDivElement;
6
6
  get div(): null;
@@ -260,11 +260,6 @@ export class AnnotationEditorUIManager {
260
260
  * @param {AnnotationEditor} editor
261
261
  */
262
262
  setSelected(editor: AnnotationEditor): void;
263
- /**
264
- * Check if the editor is selected.
265
- * @param {AnnotationEditor} editor
266
- */
267
- isSelected(editor: AnnotationEditor): boolean;
268
263
  get firstSelectedEditor(): any;
269
264
  /**
270
265
  * Unselect an editor.
@@ -440,10 +435,10 @@ export class CommandManager {
440
435
  * multiple pointers (e.g. two fingers, a pen, a mouse, ...).
441
436
  */
442
437
  export class CurrentPointers {
443
- static "__#private@#pointerId": number;
444
- static "__#private@#pointerIds": null;
445
- static "__#private@#moveTimestamp": number;
446
- static "__#private@#pointerType": null;
438
+ static #pointerId: number;
439
+ static #pointerIds: null;
440
+ static #moveTimestamp: number;
441
+ static #pointerType: null;
447
442
  static initializeAndAddPointerId(pointerId: any): void;
448
443
  static setPointer(pointerType: any, pointerId: any): void;
449
444
  static setTimeStamp(timeStamp: any): void;
@@ -462,16 +457,39 @@ export class CurrentPointers {
462
457
  * non-mac OSes.
463
458
  */
464
459
  export class KeyboardManager {
460
+ static ALT: number;
461
+ static CTRL: number;
462
+ static META: number;
463
+ static SHIFT: number;
464
+ /**
465
+ * Parse a shortcut string like "ctrl+shift+a" into a `[key, modifiers]`
466
+ * pair. Modifier names are case-insensitive and may appear in any order;
467
+ * the key part is matched against `event.key` so `Space` is normalized to
468
+ * `" "` but other names like `ArrowLeft`, `Enter`, `Backspace`, and
469
+ * single-letter keys (`a`, `Z`) are preserved.
470
+ * @param {string} value
471
+ * @returns {[string|null, number]}
472
+ */
473
+ static #parseShortcut(value: string): [string | null, number];
474
+ /**
475
+ * Translate `event.code` (a layout-independent physical key identifier) to
476
+ * the equivalent `event.key` value on a US layout, so a Ctrl+A shortcut
477
+ * still fires when the user is on a layout where the "A" key produces a
478
+ * non-Latin character.
479
+ * @param {string} code
480
+ * @returns {string|null}
481
+ */
482
+ static #codeToKey(code: string): string | null;
465
483
  /**
466
484
  * Create a new keyboard manager class.
467
485
  * @param {Array<Array>} callbacks - an array containing an array of shortcuts
468
- * and a callback to call.
469
- * A shortcut is a string like `ctrl+c` or `mac+ctrl+c` for mac OS.
486
+ * and a callback to call. If the array contains no `mac+`-prefixed entry,
487
+ * every shortcut applies on all platforms. As soon as it contains at least
488
+ * one `mac+` entry, the `mac+` ones become the macOS-only set and the bare
489
+ * entries apply only on non-Mac.
470
490
  */
471
491
  constructor(callbacks: Array<any[]>);
472
- buffer: any[];
473
492
  callbacks: Map<any, any>;
474
- allKeys: Set<any>;
475
493
  /**
476
494
  * Execute a callback, if any, for a given keyboard event.
477
495
  * The self is used as `this` in the callback.
@@ -480,5 +498,4 @@ export class KeyboardManager {
480
498
  * @returns
481
499
  */
482
500
  exec(self: Object, event: KeyboardEvent): void;
483
- #private;
484
501
  }
@@ -3,7 +3,32 @@ export class BaseFilterFactory {
3
3
  addHCMFilter(fgColor: any, bgColor: any): string;
4
4
  addAlphaFilter(map: any): string;
5
5
  addLuminosityFilter(map: any): string;
6
+ addKnockoutFilter(alpha?: number): string;
6
7
  addHighlightHCMFilter(filterName: any, fgColor: any, bgColor: any, newFgColor: any, newBgColor: any): string;
8
+ /**
9
+ * Create a filter for the selection of text, given colors.
10
+ *
11
+ * @param {string} fgColor
12
+ * @param {string} bgColor
13
+ * @returns {string}
14
+ */
15
+ addSelectionHCMFilter(fgColor: string, bgColor: string): string;
16
+ /**
17
+ * Create a filter for the selection of text.
18
+ *
19
+ * @returns {string}
20
+ */
21
+ addSelectionFilter(): string;
22
+ /**
23
+ * @param {Object} [pageColors]
24
+ * @param {string} [pageColors.background]
25
+ * @param {string} [pageColors.foreground]
26
+ * @returns {Record<string, string> | null}
27
+ */
28
+ createSelectionStyle(pageColors?: {
29
+ background?: string | undefined;
30
+ foreground?: string | undefined;
31
+ }): Record<string, string> | null;
7
32
  destroy(keepHCM?: boolean): void;
8
33
  }
9
34
  /**
@@ -24,6 +49,7 @@ export class DOMFilterFactory extends BaseFilterFactory {
24
49
  addHCMFilter(fgColor: any, bgColor: any): any;
25
50
  addAlphaFilter(map: any): any;
26
51
  addLuminosityFilter(map: any): any;
52
+ addKnockoutFilter(alpha?: number): any;
27
53
  addHighlightHCMFilter(filterName: any, fgColor: any, bgColor: any, newFgColor: any, newBgColor: any): any;
28
54
  #private;
29
55
  }
@@ -1,9 +1,9 @@
1
- export function fetchData(url: any): Promise<Uint8Array<ArrayBuffer>>;
1
+ export function fetchData(url: any): Promise<Uint8Array<any>>;
2
2
  export class NodeBinaryDataFactory extends BaseBinaryDataFactory {
3
3
  /**
4
4
  * @ignore
5
5
  */
6
- _fetch(url: any, kind: any): Promise<Uint8Array<ArrayBuffer>>;
6
+ _fetch(url: any, kind: any): Promise<Uint8Array<any>>;
7
7
  }
8
8
  export class NodeCanvasFactory extends BaseCanvasFactory {
9
9
  /**
@@ -38,7 +38,7 @@ export class FontInfo {
38
38
  }
39
39
  export class FontPathInfo {
40
40
  constructor(buffer: any);
41
- get path(): Float32Array<any> | Float16Array<any>;
41
+ get path(): any;
42
42
  #private;
43
43
  }
44
44
  export class PatternInfo {
@@ -46,11 +46,7 @@ export class PatternInfo {
46
46
  buffer: any;
47
47
  view: DataView<any>;
48
48
  data: Uint8Array<any>;
49
- getIR(): (string | number | number[] | Uint8Array<any> | Float32Array<any> | {
50
- type: number;
51
- coords: Int32Array<any>;
52
- colors: Int32Array<any>;
53
- }[] | null)[] | (string | number | number[] | (string | number)[][] | null)[];
49
+ getIR(): (string | number | number[] | Float32Array<any> | Uint8Array<any> | null)[] | (string | number | number[] | (string | number)[][] | null)[];
54
50
  }
55
51
  export class SystemFontInfo {
56
52
  constructor(buffer: any);
@@ -1,8 +1,13 @@
1
1
  export class OptionalContentConfig {
2
- constructor(data: any, renderingIntent?: number);
2
+ static fromSerializable({ data, renderingIntent, groupState }: {
3
+ data: any;
4
+ renderingIntent: any;
5
+ groupState: any;
6
+ }): OptionalContentConfig;
7
+ constructor(data: any, renderingIntent?: number, groupState?: null);
8
+ creator: null;
9
+ name: null;
3
10
  renderingIntent: number;
4
- name: any;
5
- creator: any;
6
11
  isVisible(group: any): any;
7
12
  setVisibility(id: any, visible?: boolean, preserveRB?: boolean): void;
8
13
  setOCGState({ state, preserveRB }: {
@@ -13,6 +18,11 @@ export class OptionalContentConfig {
13
18
  getOrder(): any;
14
19
  getGroup(id: any): any;
15
20
  getHash(): string;
21
+ get serializable(): {
22
+ data: any;
23
+ renderingIntent: number;
24
+ groupState: Map<any, any>;
25
+ };
16
26
  [Symbol.iterator](): MapIterator<[any, any]>;
17
27
  #private;
18
28
  }