Skip to content

Commit f313f91

Browse files
feat: update pdf.js types to commit f57fc80
1 parent 16a81ee commit f313f91

77 files changed

Lines changed: 1743 additions & 877 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

types/src/display/annotation_layer.d.ts

Lines changed: 46 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
export type PDFPageProxy = import("./api").PDFPageProxy;
22
export type PageViewport = import("./display_utils").PageViewport;
33
export type TextAccessibilityManager = import("../../web/text_accessibility.js").TextAccessibilityManager;
4-
export type IDownloadManager = import("../../web/interfaces").IDownloadManager;
5-
export type IPDFLinkService = import("../../web/interfaces").IPDFLinkService;
64
export type AnnotationEditorUIManager = any;
75
export type StructTreeLayerBuilder = import("../../web/struct_tree_layer_builder.js").StructTreeLayerBuilder;
6+
export type CommentManager = import("../../web/comment_manager.js").CommentManager;
7+
export type PDFLinkService = import("../../web/pdf_link_service.js").PDFLinkService;
8+
export type BaseDownloadManager = import("../../web/base_download_manager.js").BaseDownloadManager;
89
export type AnnotationElementParameters = {
910
data: Object;
1011
layer: HTMLDivElement;
11-
linkService: IPDFLinkService;
12-
downloadManager?: import("../../web/interfaces").IDownloadManager | undefined;
12+
linkService: PDFLinkService;
13+
downloadManager?: import("../../web/base_download_manager.js").BaseDownloadManager | undefined;
1314
annotationStorage?: AnnotationStorage | undefined;
1415
/**
1516
* - Path for image resources, mainly
@@ -27,8 +28,8 @@ export type AnnotationLayerParameters = {
2728
div: HTMLDivElement;
2829
annotations: any[];
2930
page: PDFPageProxy;
30-
linkService: IPDFLinkService;
31-
downloadManager?: import("../../web/interfaces").IDownloadManager | undefined;
31+
linkService: PDFLinkService;
32+
downloadManager?: import("../../web/base_download_manager.js").BaseDownloadManager | undefined;
3233
annotationStorage?: AnnotationStorage | undefined;
3334
/**
3435
* - Path for image resources, mainly
@@ -52,15 +53,19 @@ export type AnnotationLayerParameters = {
5253
accessibilityManager?: import("../../web/text_accessibility.js").TextAccessibilityManager | undefined;
5354
annotationEditorUIManager?: AnnotationEditorUIManager;
5455
structTreeLayer?: import("../../web/struct_tree_layer_builder.js").StructTreeLayerBuilder | undefined;
56+
/**
57+
* - The comment manager instance.
58+
*/
59+
commentManager?: import("../../web/comment_manager.js").CommentManager | undefined;
5560
};
5661
/**
5762
* @typedef {Object} AnnotationLayerParameters
5863
* @property {PageViewport} viewport
5964
* @property {HTMLDivElement} div
6065
* @property {Array} annotations
6166
* @property {PDFPageProxy} page
62-
* @property {IPDFLinkService} linkService
63-
* @property {IDownloadManager} [downloadManager]
67+
* @property {PDFLinkService} linkService
68+
* @property {BaseDownloadManager} [downloadManager]
6469
* @property {AnnotationStorage} [annotationStorage]
6570
* @property {string} [imageResourcesPath] - Path for image resources, mainly
6671
* for annotation icons. Include trailing slash.
@@ -73,6 +78,7 @@ export type AnnotationLayerParameters = {
7378
* @property {TextAccessibilityManager} [accessibilityManager]
7479
* @property {AnnotationEditorUIManager} [annotationEditorUIManager]
7580
* @property {StructTreeLayerBuilder} [structTreeLayer]
81+
* @property {CommentManager} [commentManager] - The comment manager instance.
7682
*/
7783
/**
7884
* Manage the layer containing all the annotations.
@@ -82,20 +88,24 @@ export class AnnotationLayer {
8288
* @private
8389
*/
8490
private static get _defaultBorderStyle();
85-
constructor({ div, accessibilityManager, annotationCanvasMap, annotationEditorUIManager, page, viewport, structTreeLayer, }: {
91+
constructor({ div, accessibilityManager, annotationCanvasMap, annotationEditorUIManager, page, viewport, structTreeLayer, commentManager, linkService, annotationStorage, }: {
8692
div: any;
8793
accessibilityManager: any;
8894
annotationCanvasMap: any;
8995
annotationEditorUIManager: any;
9096
page: any;
9197
viewport: any;
9298
structTreeLayer: any;
99+
commentManager: any;
100+
linkService: any;
101+
annotationStorage: any;
93102
});
103+
zIndex: number;
94104
div: any;
95105
page: any;
96106
viewport: any;
97-
zIndex: number;
98107
_annotationEditorUIManager: any;
108+
_commentManager: any;
99109
popupShow: any[] | undefined;
100110
hasEditableAnnotations(): boolean;
101111
/**
@@ -109,19 +119,21 @@ export class AnnotationLayer {
109119
* Add link annotations to the annotation layer.
110120
*
111121
* @param {Array<Object>} annotations
112-
* @param {IPDFLinkService} linkService
113-
* @memberof AnnotationLayer
114122
*/
115-
addLinkAnnotations(annotations: Array<Object>, linkService: IPDFLinkService): Promise<void>;
123+
addLinkAnnotations(annotations: Array<Object>): Promise<void>;
116124
/**
117125
* Update the annotation elements on existing annotation layer.
118126
*
119127
* @param {AnnotationLayerParameters} viewport
120128
* @memberof AnnotationLayer
121129
*/
122130
update({ viewport }: AnnotationLayerParameters): void;
123-
getEditableAnnotations(): any[];
131+
getEditableAnnotations(): MapIterator<any>;
124132
getEditableAnnotation(id: any): any;
133+
addFakeAnnotation(editor: any): EditorAnnotationElement;
134+
removeAnnotation(id: any): void;
135+
updateFakeAnnotations(editors: any): void;
136+
togglePointerEvents(enabled?: boolean): void;
125137
#private;
126138
}
127139
export class FreeTextAnnotationElement extends AnnotationElement {
@@ -151,6 +163,13 @@ export class StampAnnotationElement extends AnnotationElement {
151163
render(): HTMLElement | undefined;
152164
}
153165
import { AnnotationStorage } from "./annotation_storage.js";
166+
declare class EditorAnnotationElement extends AnnotationElement {
167+
constructor(parameters: any);
168+
editor: any;
169+
render(): HTMLElement | undefined;
170+
createOrUpdatePopup(): void;
171+
remove(): void;
172+
}
154173
declare class AnnotationElement {
155174
static _hasPopupData({ contentsObj, richText }: {
156175
contentsObj: any;
@@ -170,15 +189,25 @@ declare class AnnotationElement {
170189
renderForms: any;
171190
svgFactory: any;
172191
annotationStorage: any;
192+
enableComment: any;
173193
enableScripting: any;
174194
hasJSActions: any;
175195
_fieldObjects: any;
176196
parent: any;
197+
hasOwnCommentButton: boolean;
198+
contentElement: HTMLElement | undefined;
177199
container: HTMLElement | undefined;
178200
get _isEditable(): any;
179-
get hasPopupData(): boolean;
180-
updateEdited(params: any): void;
201+
get hasPopupData(): any;
202+
get commentData(): any;
203+
get hasCommentButton(): any;
204+
get commentButtonPosition(): any;
205+
_normalizePoint(point: any): any;
206+
set commentText(text: any);
207+
get commentText(): any;
208+
removePopup(): void;
181209
popup: any;
210+
updateEdited(params: any): void;
182211
resetEdited(): void;
183212
/**
184213
* Create an empty container for the annotation's HTML element.
@@ -212,6 +241,7 @@ declare class AnnotationElement {
212241
*/
213242
private _createPopup;
214243
get hasPopupElement(): boolean;
244+
get extraPopupElement(): null;
215245
/**
216246
* Render the annotation's HTML element(s).
217247
*

types/src/display/annotation_storage.d.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
* Key/value storage for annotation data in forms.
33
*/
44
export class AnnotationStorage {
5-
onSetModified: any;
6-
onResetModified: any;
7-
onAnnotationEditor: any;
5+
onSetModified: null;
6+
onResetModified: null;
7+
onAnnotationEditor: null;
88
/**
99
* Get the value for a given key if it exists, or return the default value.
1010
* @param {string} key
@@ -56,6 +56,8 @@ export class AnnotationStorage {
5656
};
5757
get editorStats(): any;
5858
resetModifiedIds(): void;
59+
updateEditor(annotationId: any, data: any): boolean;
60+
getEditor(annotationId: any): any;
5961
/**
6062
* @returns {{ids: Set<string>, hash: string}}
6163
*/
@@ -77,11 +79,11 @@ export class PrintAnnotationStorage extends AnnotationStorage {
7779
* PLEASE NOTE: Only intended for usage within the API itself.
7880
* @ignore
7981
*/
80-
get serializable(): {
81-
map: any;
82-
hash: any;
83-
transfer: any;
84-
};
82+
get serializable(): Readonly<{
83+
map: null;
84+
hash: "";
85+
transfer: undefined;
86+
}>;
8587
get modifiedIds(): any;
8688
#private;
8789
}

0 commit comments

Comments
 (0)