pdfjs-serverless 0.6.0 → 0.7.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.
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +1 -1
- package/dist/types/src/display/annotation_layer.d.ts +11 -1
- package/dist/types/src/display/api.d.ts +79 -35
- package/dist/types/src/display/canvas.d.ts +2 -1
- package/dist/types/src/display/canvas_factory.d.ts +27 -0
- package/dist/types/src/display/cmap_reader_factory.d.ts +25 -0
- package/dist/types/src/display/display_utils.d.ts +29 -60
- package/dist/types/src/display/draw_layer.d.ts +6 -19
- package/dist/types/src/display/editor/alt_text.d.ts +3 -2
- package/dist/types/src/display/editor/annotation_editor_layer.d.ts +13 -9
- package/dist/types/src/display/editor/color_picker.d.ts +1 -0
- package/dist/types/src/display/editor/draw.d.ts +120 -0
- package/dist/types/src/display/editor/drawers/freedraw.d.ts +31 -0
- package/dist/types/src/display/editor/drawers/highlight.d.ts +36 -0
- package/dist/types/src/display/editor/drawers/inkdraw.d.ts +128 -0
- package/dist/types/src/display/editor/drawers/outline.d.ts +19 -0
- package/dist/types/src/display/editor/editor.d.ts +51 -12
- package/dist/types/src/display/editor/freetext.d.ts +5 -16
- package/dist/types/src/display/editor/highlight.d.ts +7 -25
- package/dist/types/src/display/editor/ink.d.ts +15 -74
- package/dist/types/src/display/editor/stamp.d.ts +13 -17
- package/dist/types/src/display/editor/toolbar.d.ts +3 -2
- package/dist/types/src/display/editor/tools.d.ts +13 -3
- package/dist/types/src/display/fetch_stream.d.ts +6 -13
- package/dist/types/src/display/filter_factory.d.ts +29 -0
- package/dist/types/src/display/font_loader.d.ts +3 -1
- package/dist/types/src/display/network.d.ts +10 -6
- package/dist/types/src/display/network_utils.d.ts +5 -3
- package/dist/types/src/display/node_stream.d.ts +6 -22
- package/dist/types/src/display/node_utils.d.ts +8 -11
- package/dist/types/src/display/optional_content_config.d.ts +1 -1
- package/dist/types/src/display/standard_fontdata_factory.d.ts +20 -0
- package/dist/types/src/display/svg_factory.d.ts +14 -0
- package/dist/types/src/display/text_layer.d.ts +12 -9
- package/dist/types/src/display/touch_manager.d.ts +14 -0
- package/dist/types/src/display/transport_stream.d.ts +1 -1
- package/dist/types/src/display/worker_options.d.ts +2 -2
- package/dist/types/src/interfaces.d.ts +4 -0
- package/dist/types/src/pdf.d.ts +5 -3
- package/dist/types/src/shared/message_handler.d.ts +10 -4
- package/dist/types/src/shared/util.d.ts +9 -20
- package/dist/types/web/annotation_editor_layer_builder.d.ts +5 -2
- package/dist/types/web/annotation_layer_builder.d.ts +2 -1
- package/dist/types/web/app_options.d.ts +1 -1
- package/dist/types/web/event_utils.d.ts +2 -2
- package/dist/types/web/genericl10n.d.ts +5 -5
- package/dist/types/web/interfaces.d.ts +5 -5
- package/dist/types/web/l10n.d.ts +2 -2
- package/dist/types/web/pdf_link_service.d.ts +2 -2
- package/dist/types/web/pdf_page_view.d.ts +5 -11
- package/dist/types/web/pdf_rendering_queue.d.ts +1 -1
- package/dist/types/web/pdf_thumbnail_view.d.ts +1 -1
- package/dist/types/web/pdf_viewer.d.ts +13 -16
- package/dist/types/web/struct_tree_layer_builder.d.ts +4 -2
- package/dist/types/web/text_accessibility.d.ts +1 -1
- package/dist/types/web/text_layer_builder.d.ts +5 -5
- package/dist/types/web/ui_utils.d.ts +3 -19
- package/package.json +15 -15
- package/dist/types/src/display/base_factory.d.ts +0 -60
- package/dist/types/src/display/editor/outliner.d.ts +0 -70
|
@@ -4,9 +4,11 @@ export type TextAccessibilityManager = import("../../../web/text_accessibility.j
|
|
|
4
4
|
export type IL10n = import("../../../web/interfaces").IL10n;
|
|
5
5
|
export type AnnotationLayer = import("../annotation_layer.js").AnnotationLayer;
|
|
6
6
|
export type DrawLayer = import("../draw_layer.js").DrawLayer;
|
|
7
|
+
export type StructTreeLayerBuilder = any;
|
|
7
8
|
export type AnnotationEditorLayerOptions = {
|
|
8
9
|
mode: Object;
|
|
9
10
|
div: HTMLDivElement;
|
|
11
|
+
structTreeLayer: StructTreeLayerBuilder;
|
|
10
12
|
uiManager: AnnotationEditorUIManager;
|
|
11
13
|
enabled: boolean;
|
|
12
14
|
accessibilityManager?: import("../../../web/text_accessibility.js").TextAccessibilityManager | undefined;
|
|
@@ -24,6 +26,7 @@ export type RenderEditorLayerOptions = {
|
|
|
24
26
|
* @typedef {Object} AnnotationEditorLayerOptions
|
|
25
27
|
* @property {Object} mode
|
|
26
28
|
* @property {HTMLDivElement} div
|
|
29
|
+
* @property {StructTreeLayerBuilder} structTreeLayer
|
|
27
30
|
* @property {AnnotationEditorUIManager} uiManager
|
|
28
31
|
* @property {boolean} enabled
|
|
29
32
|
* @property {TextAccessibilityManager} [accessibilityManager]
|
|
@@ -43,15 +46,16 @@ export type RenderEditorLayerOptions = {
|
|
|
43
46
|
*/
|
|
44
47
|
export class AnnotationEditorLayer {
|
|
45
48
|
static _initialized: boolean;
|
|
46
|
-
static "__#
|
|
49
|
+
static "__#33@#editorTypes": Map<number, typeof FreeTextEditor | typeof HighlightEditor | typeof InkEditor | typeof StampEditor>;
|
|
47
50
|
/**
|
|
48
51
|
* @param {AnnotationEditorLayerOptions} options
|
|
49
52
|
*/
|
|
50
|
-
constructor({ uiManager, pageIndex, div, accessibilityManager, annotationLayer, drawLayer, textLayer, viewport, l10n, }: AnnotationEditorLayerOptions);
|
|
53
|
+
constructor({ uiManager, pageIndex, div, structTreeLayer, accessibilityManager, annotationLayer, drawLayer, textLayer, viewport, l10n, }: AnnotationEditorLayerOptions);
|
|
51
54
|
pageIndex: number;
|
|
52
55
|
div: HTMLDivElement;
|
|
53
56
|
viewport: import("../display_utils.js").PageViewport;
|
|
54
57
|
drawLayer: import("../draw_layer.js").DrawLayer;
|
|
58
|
+
_structTree: any;
|
|
55
59
|
get isEmpty(): boolean;
|
|
56
60
|
get isInvisible(): boolean;
|
|
57
61
|
/**
|
|
@@ -65,7 +69,6 @@ export class AnnotationEditorLayer {
|
|
|
65
69
|
*/
|
|
66
70
|
updateMode(mode?: number): void;
|
|
67
71
|
hasTextLayer(textLayer: any): boolean;
|
|
68
|
-
addInkEditorIfNeeded(isCommitting: any): void;
|
|
69
72
|
/**
|
|
70
73
|
* Set the editing state.
|
|
71
74
|
* @param {boolean} isEditing
|
|
@@ -76,6 +79,7 @@ export class AnnotationEditorLayer {
|
|
|
76
79
|
* @param {Object} params
|
|
77
80
|
*/
|
|
78
81
|
addCommands(params: Object): void;
|
|
82
|
+
cleanUndoStack(type: any): void;
|
|
79
83
|
toggleDrawing(enabled?: boolean): void;
|
|
80
84
|
togglePointerEvents(enabled?: boolean): void;
|
|
81
85
|
toggleAnnotationLayerPointerEvents(enabled?: boolean): void;
|
|
@@ -83,7 +87,7 @@ export class AnnotationEditorLayer {
|
|
|
83
87
|
* Enable pointer events on the main div in order to enable
|
|
84
88
|
* editor creation.
|
|
85
89
|
*/
|
|
86
|
-
enable(): void
|
|
90
|
+
enable(): Promise<void>;
|
|
87
91
|
/**
|
|
88
92
|
* Disable editor creation.
|
|
89
93
|
*/
|
|
@@ -168,11 +172,6 @@ export class AnnotationEditorLayer {
|
|
|
168
172
|
* @param {AnnotationEditor} editor
|
|
169
173
|
*/
|
|
170
174
|
toggleSelected(editor: AnnotationEditor): void;
|
|
171
|
-
/**
|
|
172
|
-
* Check if the editor is selected.
|
|
173
|
-
* @param {AnnotationEditor} editor
|
|
174
|
-
*/
|
|
175
|
-
isSelected(editor: AnnotationEditor): boolean;
|
|
176
175
|
/**
|
|
177
176
|
* Unselect an editor.
|
|
178
177
|
* @param {AnnotationEditor} editor
|
|
@@ -188,6 +187,9 @@ export class AnnotationEditorLayer {
|
|
|
188
187
|
* @param {PointerEvent} event
|
|
189
188
|
*/
|
|
190
189
|
pointerdown(event: PointerEvent): void;
|
|
190
|
+
startDrawingSession(event: any): void;
|
|
191
|
+
pause(on: any): void;
|
|
192
|
+
endDrawingSession(isAborted?: boolean): any;
|
|
191
193
|
/**
|
|
192
194
|
*
|
|
193
195
|
* @param {AnnotationEditor} editor
|
|
@@ -196,6 +198,8 @@ export class AnnotationEditorLayer {
|
|
|
196
198
|
* @returns
|
|
197
199
|
*/
|
|
198
200
|
findNewParent(editor: AnnotationEditor, x: number, y: number): boolean;
|
|
201
|
+
commitOrRemove(): boolean;
|
|
202
|
+
onScaleChanging(): void;
|
|
199
203
|
/**
|
|
200
204
|
* Destroy the main editor.
|
|
201
205
|
*/
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Basic draw editor.
|
|
3
|
+
*/
|
|
4
|
+
export class DrawingEditor extends AnnotationEditor {
|
|
5
|
+
static _currentDrawId: number;
|
|
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;
|
|
14
|
+
static _INNER_MARGIN: number;
|
|
15
|
+
static _mergeSVGProperties(p1: any, p2: any): any;
|
|
16
|
+
/**
|
|
17
|
+
* @param {Object} options
|
|
18
|
+
* @return {DrawingOptions} the default options to use for a new editor.
|
|
19
|
+
*/
|
|
20
|
+
static getDefaultDrawingOptions(_options: any): DrawingOptions;
|
|
21
|
+
/**
|
|
22
|
+
* @return {Map<AnnotationEditorParamsType, string>} a map between the
|
|
23
|
+
* parameter types and the name of the options.
|
|
24
|
+
*/
|
|
25
|
+
static get typesMap(): Map<{
|
|
26
|
+
RESIZE: number;
|
|
27
|
+
CREATE: number;
|
|
28
|
+
FREETEXT_SIZE: number;
|
|
29
|
+
FREETEXT_COLOR: number;
|
|
30
|
+
FREETEXT_OPACITY: number;
|
|
31
|
+
INK_COLOR: number;
|
|
32
|
+
INK_THICKNESS: number;
|
|
33
|
+
INK_OPACITY: number;
|
|
34
|
+
HIGHLIGHT_COLOR: number;
|
|
35
|
+
HIGHLIGHT_DEFAULT_COLOR: number;
|
|
36
|
+
HIGHLIGHT_THICKNESS: number;
|
|
37
|
+
HIGHLIGHT_FREE: number;
|
|
38
|
+
HIGHLIGHT_SHOW_ALL: number;
|
|
39
|
+
DRAW_STEP: number;
|
|
40
|
+
}, string>;
|
|
41
|
+
/**
|
|
42
|
+
* @returns {boolean} `true` if several drawings can be added to the
|
|
43
|
+
* annotation.
|
|
44
|
+
*/
|
|
45
|
+
static get supportMultipleDrawings(): boolean;
|
|
46
|
+
/** @inheritdoc */
|
|
47
|
+
static updateDefaultParams(type: any, value: any): void;
|
|
48
|
+
/** @inheritdoc */
|
|
49
|
+
static get defaultPropertiesToUpdate(): any[][];
|
|
50
|
+
static onScaleChangingWhenDrawing(): void;
|
|
51
|
+
/**
|
|
52
|
+
* Create a new drawer instance.
|
|
53
|
+
* @param {number} x - The x coordinate of the event.
|
|
54
|
+
* @param {number} y - The y coordinate of the event.
|
|
55
|
+
* @param {number} parentWidth - The parent width.
|
|
56
|
+
* @param {number} parentHeight - The parent height.
|
|
57
|
+
* @param {number} rotation - The parent rotation.
|
|
58
|
+
*/
|
|
59
|
+
static createDrawerInstance(_x: any, _y: any, _parentWidth: any, _parentHeight: any, _rotation: any): void;
|
|
60
|
+
static startDrawing(parent: any, uiManager: any, _isLTR: any, event: any): void;
|
|
61
|
+
static _drawMove(event: any): void;
|
|
62
|
+
static _cleanup(all: any): void;
|
|
63
|
+
static _endDraw(event: any): void;
|
|
64
|
+
static endDrawing(isAborted: any): any;
|
|
65
|
+
/**
|
|
66
|
+
* Deserialize the drawing outlines.
|
|
67
|
+
* @param {number} pageX - The x coordinate of the page.
|
|
68
|
+
* @param {number} pageY - The y coordinate of the page.
|
|
69
|
+
* @param {number} pageWidth - The width of the page.
|
|
70
|
+
* @param {number} pageHeight - The height of the page.
|
|
71
|
+
* @param {number} innerWidth - The inner width.
|
|
72
|
+
* @param {Object} data - The data to deserialize.
|
|
73
|
+
* @returns {Object} The deserialized outlines.
|
|
74
|
+
*/
|
|
75
|
+
static deserializeDraw(_pageX: any, _pageY: any, _pageWidth: any, _pageHeight: any, _innerWidth: any, _data: any): Object;
|
|
76
|
+
/** @inheritdoc */
|
|
77
|
+
static deserialize(data: any, parent: any, uiManager: any): Promise<AnnotationEditor | null>;
|
|
78
|
+
constructor(params: any);
|
|
79
|
+
_drawId: null;
|
|
80
|
+
/** @inheritdoc */
|
|
81
|
+
updateParams(type: any, value: any): void;
|
|
82
|
+
/** @inheritdoc */
|
|
83
|
+
get propertiesToUpdate(): any[][];
|
|
84
|
+
/**
|
|
85
|
+
* Update a property and make this action undoable.
|
|
86
|
+
* @param {string} color
|
|
87
|
+
*/
|
|
88
|
+
_updateProperty(type: any, name: any, value: any): void;
|
|
89
|
+
/** @inheritdoc */
|
|
90
|
+
_onTranslating(x: any, y: any): void;
|
|
91
|
+
/** @inheritdoc */
|
|
92
|
+
_onTranslated(): void;
|
|
93
|
+
/** @inheritdoc */
|
|
94
|
+
onceAdded(focus: any): void;
|
|
95
|
+
/** @inheritdoc */
|
|
96
|
+
rotate(): void;
|
|
97
|
+
onScaleChanging(): void;
|
|
98
|
+
/**
|
|
99
|
+
* Create the drawing options.
|
|
100
|
+
* @param {Object} _data
|
|
101
|
+
*/
|
|
102
|
+
createDrawingOptions(_data: Object): void;
|
|
103
|
+
serializeDraw(isForCopying: any): any;
|
|
104
|
+
/** @inheritdoc */
|
|
105
|
+
renderAnnotationElement(annotation: any): null;
|
|
106
|
+
#private;
|
|
107
|
+
}
|
|
108
|
+
export class DrawingOptions {
|
|
109
|
+
updateProperty(name: any, value: any): void;
|
|
110
|
+
updateProperties(properties: any): void;
|
|
111
|
+
updateSVGProperty(name: any, value: any): void;
|
|
112
|
+
toSVGProperties(): {
|
|
113
|
+
root: any;
|
|
114
|
+
};
|
|
115
|
+
reset(): void;
|
|
116
|
+
updateAll(options?: this): void;
|
|
117
|
+
clone(): void;
|
|
118
|
+
#private;
|
|
119
|
+
}
|
|
120
|
+
import { AnnotationEditor } from "./editor.js";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export class FreeDrawOutline extends Outline {
|
|
2
|
+
constructor(outline: any, points: any, box: any, scaleFactor: any, innerMargin: any, isLTR: any);
|
|
3
|
+
lastPoint: number[];
|
|
4
|
+
serialize([blX, blY, trX, trY]: [any, any, any, any], rotation: any): {
|
|
5
|
+
outline: any[];
|
|
6
|
+
points: any[][];
|
|
7
|
+
};
|
|
8
|
+
get box(): Float32Array<ArrayBuffer>;
|
|
9
|
+
newOutliner(point: any, box: any, scaleFactor: any, thickness: any, isLTR: any, innerMargin?: number): FreeDrawOutliner;
|
|
10
|
+
getNewOutline(thickness: any, innerMargin: any): FreeDrawOutline;
|
|
11
|
+
#private;
|
|
12
|
+
}
|
|
13
|
+
export class FreeDrawOutliner {
|
|
14
|
+
static "__#19@#MIN_DIST": number;
|
|
15
|
+
static "__#19@#MIN_DIFF": number;
|
|
16
|
+
static "__#19@#MIN": number;
|
|
17
|
+
constructor({ x, y }: {
|
|
18
|
+
x: any;
|
|
19
|
+
y: any;
|
|
20
|
+
}, box: any, scaleFactor: any, thickness: any, isLTR: any, innerMargin?: number);
|
|
21
|
+
isEmpty(): boolean;
|
|
22
|
+
add({ x, y }: {
|
|
23
|
+
x: any;
|
|
24
|
+
y: any;
|
|
25
|
+
}): boolean;
|
|
26
|
+
toSVGPath(): string;
|
|
27
|
+
newFreeDrawOutline(outline: any, points: any, box: any, scaleFactor: any, innerMargin: any, isLTR: any): FreeDrawOutline;
|
|
28
|
+
getOutlines(): FreeDrawOutline;
|
|
29
|
+
#private;
|
|
30
|
+
}
|
|
31
|
+
import { Outline } from "./outline.js";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export class FreeHighlightOutliner extends FreeDrawOutliner {
|
|
2
|
+
}
|
|
3
|
+
export class HighlightOutliner {
|
|
4
|
+
/**
|
|
5
|
+
* Construct an outliner.
|
|
6
|
+
* @param {Array<Object>} boxes - An array of axis-aligned rectangles.
|
|
7
|
+
* @param {number} borderWidth - The width of the border of the boxes, it
|
|
8
|
+
* allows to make the boxes bigger (or smaller).
|
|
9
|
+
* @param {number} innerMargin - The margin between the boxes and the
|
|
10
|
+
* outlines. It's important to not have a null innerMargin when we want to
|
|
11
|
+
* draw the outline else the stroked outline could be clipped because of its
|
|
12
|
+
* width.
|
|
13
|
+
* @param {boolean} isLTR - true if we're in LTR mode. It's used to determine
|
|
14
|
+
* the last point of the boxes.
|
|
15
|
+
*/
|
|
16
|
+
constructor(boxes: Array<Object>, borderWidth?: number, innerMargin?: number, isLTR?: boolean);
|
|
17
|
+
getOutlines(): HighlightOutline;
|
|
18
|
+
#private;
|
|
19
|
+
}
|
|
20
|
+
import { FreeDrawOutliner } from "./freedraw.js";
|
|
21
|
+
declare class HighlightOutline extends Outline {
|
|
22
|
+
constructor(outlines: any, box: any, lastPoint: any);
|
|
23
|
+
lastPoint: any;
|
|
24
|
+
/**
|
|
25
|
+
* Serialize the outlines into the PDF page coordinate system.
|
|
26
|
+
* @param {Array<number>} _bbox - the bounding box of the annotation.
|
|
27
|
+
* @param {number} _rotation - the rotation of the annotation.
|
|
28
|
+
* @returns {Array<Array<number>>}
|
|
29
|
+
*/
|
|
30
|
+
serialize([blX, blY, trX, trY]: Array<number>, _rotation: number): Array<Array<number>>;
|
|
31
|
+
get box(): any;
|
|
32
|
+
get classNamesForOutlining(): string[];
|
|
33
|
+
#private;
|
|
34
|
+
}
|
|
35
|
+
import { Outline } from "./outline.js";
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
export class InkDrawOutline extends Outline {
|
|
2
|
+
static deserialize(pageX: any, pageY: any, pageWidth: any, pageHeight: any, innerMargin: any, { paths: { lines, points }, rotation, thickness }: {
|
|
3
|
+
paths: {
|
|
4
|
+
lines: any;
|
|
5
|
+
points: any;
|
|
6
|
+
};
|
|
7
|
+
rotation: any;
|
|
8
|
+
thickness: any;
|
|
9
|
+
}): InkDrawOutline;
|
|
10
|
+
build(lines: any, parentWidth: any, parentHeight: any, parentScale: any, rotation: any, thickness: any, innerMargin: any): void;
|
|
11
|
+
setLastElement(element: any): {
|
|
12
|
+
path: {
|
|
13
|
+
d: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
removeLastElement(): {
|
|
17
|
+
path: {
|
|
18
|
+
d: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
serialize([pageX, pageY, pageWidth, pageHeight]: [any, any, any, any], isForCopying: any): {
|
|
22
|
+
lines: any[];
|
|
23
|
+
points: any[];
|
|
24
|
+
rect: any[];
|
|
25
|
+
};
|
|
26
|
+
get box(): any;
|
|
27
|
+
updateProperty(name: any, value: any): any;
|
|
28
|
+
updateParentDimensions([width, height]: [any, any], scale: any): any;
|
|
29
|
+
updateRotation(rotation: any): {
|
|
30
|
+
path: {
|
|
31
|
+
transform: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
get viewBox(): any;
|
|
35
|
+
get defaultProperties(): {
|
|
36
|
+
root: {
|
|
37
|
+
viewBox: any;
|
|
38
|
+
};
|
|
39
|
+
path: {
|
|
40
|
+
"transform-origin": string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
get rotationTransform(): string;
|
|
44
|
+
getPathResizingSVGProperties([newX, newY, newWidth, newHeight]: [any, any, any, any]): {
|
|
45
|
+
path: {
|
|
46
|
+
"transform-origin": string;
|
|
47
|
+
transform: string;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
getPathResizedSVGProperties([newX, newY, newWidth, newHeight]: [any, any, any, any]): {
|
|
51
|
+
root: {
|
|
52
|
+
viewBox: any;
|
|
53
|
+
};
|
|
54
|
+
path: {
|
|
55
|
+
"transform-origin": string;
|
|
56
|
+
transform: string | null;
|
|
57
|
+
d: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
getPathTranslatedSVGProperties([newX, newY]: [any, any], parentDimensions: any): {
|
|
61
|
+
root: {
|
|
62
|
+
viewBox: any;
|
|
63
|
+
};
|
|
64
|
+
path: {
|
|
65
|
+
d: string;
|
|
66
|
+
"transform-origin": string;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
get defaultSVGProperties(): {
|
|
70
|
+
root: {
|
|
71
|
+
viewBox: any;
|
|
72
|
+
};
|
|
73
|
+
rootClass: {
|
|
74
|
+
draw: boolean;
|
|
75
|
+
};
|
|
76
|
+
path: {
|
|
77
|
+
d: string;
|
|
78
|
+
"transform-origin": string;
|
|
79
|
+
transform: string | null;
|
|
80
|
+
};
|
|
81
|
+
bbox: any;
|
|
82
|
+
};
|
|
83
|
+
#private;
|
|
84
|
+
}
|
|
85
|
+
export class InkDrawOutliner {
|
|
86
|
+
constructor(x: any, y: any, parentWidth: any, parentHeight: any, rotation: any, thickness: any);
|
|
87
|
+
updateProperty(name: any, value: any): void;
|
|
88
|
+
isEmpty(): boolean;
|
|
89
|
+
isCancellable(): boolean;
|
|
90
|
+
add(x: any, y: any): {
|
|
91
|
+
path: {
|
|
92
|
+
d: string;
|
|
93
|
+
};
|
|
94
|
+
} | null;
|
|
95
|
+
end(x: any, y: any): {
|
|
96
|
+
path: {
|
|
97
|
+
d: string;
|
|
98
|
+
};
|
|
99
|
+
} | null;
|
|
100
|
+
startNew(x: any, y: any, parentWidth: any, parentHeight: any, rotation: any): null;
|
|
101
|
+
getLastElement(): {
|
|
102
|
+
line: any[];
|
|
103
|
+
points: any[];
|
|
104
|
+
} | undefined;
|
|
105
|
+
setLastElement(element: any): {
|
|
106
|
+
path: {
|
|
107
|
+
d: string;
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
removeLastElement(): {
|
|
111
|
+
path: {
|
|
112
|
+
d: string;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
toSVGPath(): string;
|
|
116
|
+
getOutlines(parentWidth: any, parentHeight: any, scale: any, innerMargin: any): InkDrawOutline;
|
|
117
|
+
get defaultSVGProperties(): {
|
|
118
|
+
root: {
|
|
119
|
+
viewBox: string;
|
|
120
|
+
};
|
|
121
|
+
rootClass: {
|
|
122
|
+
draw: boolean;
|
|
123
|
+
};
|
|
124
|
+
bbox: number[];
|
|
125
|
+
};
|
|
126
|
+
#private;
|
|
127
|
+
}
|
|
128
|
+
import { Outline } from "./outline.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export class Outline {
|
|
2
|
+
static PRECISION: number;
|
|
3
|
+
static _rescale(src: any, tx: any, ty: any, sx: any, sy: any, dest: any): any;
|
|
4
|
+
static _rescaleAndSwap(src: any, tx: any, ty: any, sx: any, sy: any, dest: any): any;
|
|
5
|
+
static _translate(src: any, tx: any, ty: any, dest: any): any;
|
|
6
|
+
static svgRound(x: any): number;
|
|
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
|
+
static createBezierPoints(x1: any, y1: any, x2: any, y2: any, x3: any, y3: any): number[];
|
|
10
|
+
/**
|
|
11
|
+
* @returns {string} The SVG path of the outline.
|
|
12
|
+
*/
|
|
13
|
+
toSVGPath(): string;
|
|
14
|
+
/**
|
|
15
|
+
* @type {Object|null} The bounding box of the outline.
|
|
16
|
+
*/
|
|
17
|
+
get box(): Object | null;
|
|
18
|
+
serialize(_bbox: any, _rotation: any): void;
|
|
19
|
+
}
|
|
@@ -33,20 +33,21 @@ export type AnnotationEditorParameters = {
|
|
|
33
33
|
* Base class for editors.
|
|
34
34
|
*/
|
|
35
35
|
export class AnnotationEditor {
|
|
36
|
-
static
|
|
36
|
+
static _l10n: null;
|
|
37
37
|
static _l10nResizer: null;
|
|
38
38
|
static _borderLineWidth: number;
|
|
39
39
|
static _colorManager: ColorManager;
|
|
40
40
|
static _zIndex: number;
|
|
41
41
|
static _telemetryTimeout: number;
|
|
42
42
|
static get _resizerKeyboardManager(): any;
|
|
43
|
+
static get isDrawer(): boolean;
|
|
43
44
|
static get _defaultLineColor(): any;
|
|
44
45
|
static deleteAnnotationElement(editor: any): void;
|
|
45
46
|
/**
|
|
46
47
|
* Initialize the l10n stuff for this type of editor.
|
|
47
48
|
* @param {Object} l10n
|
|
48
49
|
*/
|
|
49
|
-
static initialize(l10n: Object, _uiManager: any
|
|
50
|
+
static initialize(l10n: Object, _uiManager: any): void;
|
|
50
51
|
/**
|
|
51
52
|
* Update the default parameters for this type of editor.
|
|
52
53
|
* @param {number} _type
|
|
@@ -72,7 +73,8 @@ export class AnnotationEditor {
|
|
|
72
73
|
* @param {AnnotationEditorLayer} parent
|
|
73
74
|
*/
|
|
74
75
|
static paste(item: DataTransferItem, parent: AnnotationEditorLayer): void;
|
|
75
|
-
static "__#
|
|
76
|
+
static "__#41@#rotatePoint"(x: any, y: any, angle: any): any[];
|
|
77
|
+
static _round(x: any): number;
|
|
76
78
|
/**
|
|
77
79
|
* Deserialize the editor.
|
|
78
80
|
* The result of the deserialization is a new editor.
|
|
@@ -80,9 +82,9 @@ export class AnnotationEditor {
|
|
|
80
82
|
* @param {Object} data
|
|
81
83
|
* @param {AnnotationEditorLayer} parent
|
|
82
84
|
* @param {AnnotationEditorUIManager} uiManager
|
|
83
|
-
* @returns {AnnotationEditor | null}
|
|
85
|
+
* @returns {Promise<AnnotationEditor | null>}
|
|
84
86
|
*/
|
|
85
|
-
static deserialize(data: Object, parent: AnnotationEditorLayer, uiManager: AnnotationEditorUIManager): AnnotationEditor | null
|
|
87
|
+
static deserialize(data: Object, parent: AnnotationEditorLayer, uiManager: AnnotationEditorUIManager): Promise<AnnotationEditor | null>;
|
|
86
88
|
static get MIN_SIZE(): number;
|
|
87
89
|
static canCreateNewEmptyEditor(): boolean;
|
|
88
90
|
/**
|
|
@@ -91,6 +93,7 @@ export class AnnotationEditor {
|
|
|
91
93
|
constructor(parameters: AnnotationEditorParameters);
|
|
92
94
|
_editToolbar: null;
|
|
93
95
|
_initialOptions: any;
|
|
96
|
+
_initialData: null;
|
|
94
97
|
_isVisible: boolean;
|
|
95
98
|
_uiManager: null;
|
|
96
99
|
_focusEventsAllowed: boolean;
|
|
@@ -177,7 +180,20 @@ export class AnnotationEditor {
|
|
|
177
180
|
*/
|
|
178
181
|
translateInPage(x: number, y: number): void;
|
|
179
182
|
drag(tx: any, ty: any): void;
|
|
183
|
+
/**
|
|
184
|
+
* Called when the editor is being translated.
|
|
185
|
+
* @param {number} x - in page coordinates.
|
|
186
|
+
* @param {number} y - in page coordinates.
|
|
187
|
+
*/
|
|
188
|
+
_onTranslating(x: number, y: number): void;
|
|
189
|
+
/**
|
|
190
|
+
* Called when the editor has been translated.
|
|
191
|
+
* @param {number} x - in page coordinates.
|
|
192
|
+
* @param {number} y - in page coordinates.
|
|
193
|
+
*/
|
|
194
|
+
_onTranslated(x: number, y: number): void;
|
|
180
195
|
get _hasBeenMoved(): boolean;
|
|
196
|
+
get _hasBeenResized(): boolean;
|
|
181
197
|
/**
|
|
182
198
|
* Get the translation to take into account the editor border.
|
|
183
199
|
* The CSS engine positions the element by taking the border into account so
|
|
@@ -195,7 +211,7 @@ export class AnnotationEditor {
|
|
|
195
211
|
* Fix the position of the editor in order to keep it inside its parent page.
|
|
196
212
|
* @param {number} [rotation] - the rotation of the page.
|
|
197
213
|
*/
|
|
198
|
-
fixAndSetPosition(rotation?: number
|
|
214
|
+
fixAndSetPosition(rotation?: number): void;
|
|
199
215
|
/**
|
|
200
216
|
* Convert a screen translation into a page one.
|
|
201
217
|
* @param {number} x
|
|
@@ -223,6 +239,14 @@ export class AnnotationEditor {
|
|
|
223
239
|
* @returns {Array<number>}
|
|
224
240
|
*/
|
|
225
241
|
getInitialTranslation(): Array<number>;
|
|
242
|
+
/**
|
|
243
|
+
* Called when the editor has been resized.
|
|
244
|
+
*/
|
|
245
|
+
_onResized(): void;
|
|
246
|
+
/**
|
|
247
|
+
* Called when the editor is being resized.
|
|
248
|
+
*/
|
|
249
|
+
_onResizing(): void;
|
|
226
250
|
/**
|
|
227
251
|
* Called when the alt text dialog is closed.
|
|
228
252
|
*/
|
|
@@ -233,6 +257,7 @@ export class AnnotationEditor {
|
|
|
233
257
|
*/
|
|
234
258
|
addEditToolbar(): Promise<EditorToolbar | null>;
|
|
235
259
|
removeEditToolbar(): void;
|
|
260
|
+
addContainer(container: any): void;
|
|
236
261
|
getClientDimensions(): DOMRect;
|
|
237
262
|
addAltTextButton(): Promise<void>;
|
|
238
263
|
/**
|
|
@@ -255,6 +280,9 @@ export class AnnotationEditor {
|
|
|
255
280
|
* @param {PointerEvent} event
|
|
256
281
|
*/
|
|
257
282
|
pointerdown(event: PointerEvent): void;
|
|
283
|
+
get isSelected(): any;
|
|
284
|
+
_onStartDragging(): void;
|
|
285
|
+
_onStopDragging(): void;
|
|
258
286
|
moveInDOM(): void;
|
|
259
287
|
_setParentAndPosition(parent: any, x: any, y: any): void;
|
|
260
288
|
/**
|
|
@@ -263,12 +291,13 @@ export class AnnotationEditor {
|
|
|
263
291
|
* @param {number} ty - y-translation in screen coordinates.
|
|
264
292
|
* @param {number} [rotation] - the rotation of the page.
|
|
265
293
|
*/
|
|
266
|
-
getRect(tx: number, ty: number, rotation?: number
|
|
294
|
+
getRect(tx: number, ty: number, rotation?: number): any[];
|
|
267
295
|
getRectInCurrentCoords(rect: any, pageHeight: any): any[];
|
|
268
296
|
/**
|
|
269
297
|
* Executed once this editor has been rendered.
|
|
298
|
+
* @param {boolean} focus - true if the editor should be focused.
|
|
270
299
|
*/
|
|
271
|
-
onceAdded(): void;
|
|
300
|
+
onceAdded(focus: boolean): void;
|
|
272
301
|
/**
|
|
273
302
|
* Check if the editor contains something.
|
|
274
303
|
* @returns {boolean}
|
|
@@ -298,6 +327,7 @@ export class AnnotationEditor {
|
|
|
298
327
|
* @returns {boolean}
|
|
299
328
|
*/
|
|
300
329
|
needsToBeRebuilt(): boolean;
|
|
330
|
+
get isOnScreen(): boolean;
|
|
301
331
|
/**
|
|
302
332
|
* Rebuild the editor in case it has been removed on undo.
|
|
303
333
|
*
|
|
@@ -305,10 +335,19 @@ export class AnnotationEditor {
|
|
|
305
335
|
*/
|
|
306
336
|
rebuild(): void;
|
|
307
337
|
/**
|
|
308
|
-
* Rotate the editor.
|
|
338
|
+
* Rotate the editor when the page is rotated.
|
|
309
339
|
* @param {number} angle
|
|
310
340
|
*/
|
|
311
341
|
rotate(_angle: any): void;
|
|
342
|
+
/**
|
|
343
|
+
* Resize the editor when the page is resized.
|
|
344
|
+
*/
|
|
345
|
+
resize(): void;
|
|
346
|
+
/**
|
|
347
|
+
* Serialize the editor when it has been deleted.
|
|
348
|
+
* @returns {Object}
|
|
349
|
+
*/
|
|
350
|
+
serializeDeleted(): Object;
|
|
312
351
|
/**
|
|
313
352
|
* Serialize the editor.
|
|
314
353
|
* The result of the serialization will be used to construct a
|
|
@@ -319,7 +358,7 @@ export class AnnotationEditor {
|
|
|
319
358
|
* @param {Object | null} [context]
|
|
320
359
|
* @returns {Object | null}
|
|
321
360
|
*/
|
|
322
|
-
serialize(isForCopying?: boolean
|
|
361
|
+
serialize(isForCopying?: boolean, context?: Object | null): Object | null;
|
|
323
362
|
/**
|
|
324
363
|
* Check if an existing annotation associated with this editor has been
|
|
325
364
|
* modified.
|
|
@@ -421,9 +460,9 @@ export class AnnotationEditor {
|
|
|
421
460
|
/**
|
|
422
461
|
* Render an annotation in the annotation layer.
|
|
423
462
|
* @param {Object} annotation
|
|
424
|
-
* @returns {HTMLElement}
|
|
463
|
+
* @returns {HTMLElement|null}
|
|
425
464
|
*/
|
|
426
|
-
renderAnnotationElement(annotation: Object): HTMLElement;
|
|
465
|
+
renderAnnotationElement(annotation: Object): HTMLElement | null;
|
|
427
466
|
resetAnnotationElement(annotation: any): void;
|
|
428
467
|
#private;
|
|
429
468
|
}
|
|
@@ -19,7 +19,7 @@ export class FreeTextEditor extends AnnotationEditor {
|
|
|
19
19
|
static "__#18@#getNodeContent"(node: any): any;
|
|
20
20
|
static "__#18@#deserializeContent"(content: any): any;
|
|
21
21
|
/** @inheritdoc */
|
|
22
|
-
static deserialize(data: any, parent: any, uiManager: any): AnnotationEditor | null
|
|
22
|
+
static deserialize(data: any, parent: any, uiManager: any): Promise<AnnotationEditor | null>;
|
|
23
23
|
constructor(params: any);
|
|
24
24
|
/** @inheritdoc */
|
|
25
25
|
updateParams(type: any, value: any): void;
|
|
@@ -31,6 +31,8 @@ export class FreeTextEditor extends AnnotationEditor {
|
|
|
31
31
|
* @param {number} y in page units.
|
|
32
32
|
*/
|
|
33
33
|
_translateEmpty(x: number, y: number): void;
|
|
34
|
+
/** @inheritdoc */
|
|
35
|
+
onceAdded(focus: any): void;
|
|
34
36
|
/**
|
|
35
37
|
* Commit the content we have in this editor.
|
|
36
38
|
* @returns {undefined}
|
|
@@ -49,22 +51,9 @@ export class FreeTextEditor extends AnnotationEditor {
|
|
|
49
51
|
overlayDiv: HTMLDivElement | undefined;
|
|
50
52
|
editorDivPaste(event: any): void;
|
|
51
53
|
/** @inheritdoc */
|
|
52
|
-
serialize(isForCopying?: boolean):
|
|
53
|
-
annotationType: number;
|
|
54
|
-
color: number[];
|
|
55
|
-
fontSize: any;
|
|
56
|
-
value: string;
|
|
57
|
-
pageIndex: number;
|
|
58
|
-
rect: any[];
|
|
59
|
-
rotation: number;
|
|
60
|
-
structTreeParentId: any;
|
|
61
|
-
} | {
|
|
62
|
-
pageIndex: number;
|
|
63
|
-
id: any;
|
|
64
|
-
deleted: boolean;
|
|
65
|
-
} | null;
|
|
54
|
+
serialize(isForCopying?: boolean): Object | null;
|
|
66
55
|
/** @inheritdoc */
|
|
67
|
-
renderAnnotationElement(annotation: any): HTMLElement;
|
|
56
|
+
renderAnnotationElement(annotation: any): HTMLElement | null;
|
|
68
57
|
#private;
|
|
69
58
|
}
|
|
70
59
|
import { AnnotationEditor } from "./editor.js";
|