@progress/kendo-pdfviewer-common 0.3.0-dev.202409251137 → 0.3.0-dev.202410100645
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/es/annotations/annotation-editor-layer-builder.js +139 -0
- package/dist/es/annotations/annotation-editor-layer.js +780 -0
- package/dist/es/annotations/annotation-editor-ui-manager.js +1690 -0
- package/dist/es/annotations/annotation-layer-builder.js +217 -0
- package/dist/es/annotations/annotation-layer.js +2793 -0
- package/dist/es/annotations/draw-layer-builder.js +65 -0
- package/dist/es/annotations/draw-layer.js +220 -0
- package/dist/es/annotations/editors/annotation-editor.js +1519 -0
- package/dist/es/annotations/editors/free-text-editor.js +783 -0
- package/dist/es/annotations/editors/highlight-editor.js +717 -0
- package/dist/es/annotations/editors/outliner.js +747 -0
- package/dist/es/annotations/helpers/annotation-storage.js +294 -0
- package/dist/es/annotations/helpers/color-manager.js +72 -0
- package/dist/es/annotations/helpers/command-manager.js +133 -0
- package/dist/es/annotations/helpers/id-manager.js +34 -0
- package/dist/es/annotations/helpers/image-manager.js +176 -0
- package/dist/es/annotations/helpers/text-accessibility-manager.js +212 -0
- package/dist/es/annotations/helpers/tools.js +19 -0
- package/dist/es/annotations/shared/display_utils.js +1024 -0
- package/dist/es/annotations/shared/event_utils.js +213 -0
- package/dist/es/annotations/shared/murmurhash3.js +126 -0
- package/dist/es/annotations/shared/scripting_utils.js +90 -0
- package/dist/es/annotations/shared/ui_utils.js +823 -0
- package/dist/es/annotations/shared/utils.js +909 -0
- package/dist/es/annotations.js +68 -0
- package/dist/es/common/component.js +33 -0
- package/dist/es/common/core.js +91 -0
- package/dist/es/common/dom.js +11 -0
- package/dist/es/common/main.js +4 -0
- package/dist/es/common/math.js +1 -0
- package/dist/es/enums/PdfViewerInteractionMode.js +6 -0
- package/dist/es/links/link-service.js +505 -0
- package/dist/es/main.js +2 -0
- package/dist/es/scroller.js +29 -30
- package/dist/es/text/text-layer-builder.js +288 -0
- package/dist/es/utils.js +42 -14
- package/dist/es/widget/page.js +762 -0
- package/dist/es/widget/pdfviewer.js +1659 -0
- package/dist/es2015/annotations/annotation-editor-layer-builder.js +139 -0
- package/dist/es2015/annotations/annotation-editor-layer.js +780 -0
- package/dist/es2015/annotations/annotation-editor-ui-manager.js +1690 -0
- package/dist/es2015/annotations/annotation-layer-builder.js +217 -0
- package/dist/es2015/annotations/annotation-layer.js +2793 -0
- package/dist/es2015/annotations/draw-layer-builder.js +65 -0
- package/dist/es2015/annotations/draw-layer.js +220 -0
- package/dist/es2015/annotations/editors/annotation-editor.js +1519 -0
- package/dist/es2015/annotations/editors/free-text-editor.js +783 -0
- package/dist/es2015/annotations/editors/highlight-editor.js +717 -0
- package/dist/es2015/annotations/editors/outliner.js +747 -0
- package/dist/es2015/annotations/helpers/annotation-storage.js +294 -0
- package/dist/es2015/annotations/helpers/color-manager.js +72 -0
- package/dist/es2015/annotations/helpers/command-manager.js +133 -0
- package/dist/es2015/annotations/helpers/id-manager.js +34 -0
- package/dist/es2015/annotations/helpers/image-manager.js +176 -0
- package/dist/es2015/annotations/helpers/text-accessibility-manager.js +212 -0
- package/dist/es2015/annotations/helpers/tools.js +19 -0
- package/dist/es2015/annotations/shared/display_utils.js +1024 -0
- package/dist/es2015/annotations/shared/event_utils.js +213 -0
- package/dist/es2015/annotations/shared/murmurhash3.js +126 -0
- package/dist/es2015/annotations/shared/scripting_utils.js +90 -0
- package/dist/es2015/annotations/shared/ui_utils.js +823 -0
- package/dist/es2015/annotations/shared/utils.js +909 -0
- package/dist/es2015/annotations.js +68 -0
- package/dist/es2015/common/component.js +33 -0
- package/dist/es2015/common/core.js +91 -0
- package/dist/es2015/common/dom.js +11 -0
- package/dist/es2015/common/main.js +4 -0
- package/dist/es2015/common/math.js +1 -0
- package/dist/es2015/enums/PdfViewerInteractionMode.js +6 -0
- package/dist/es2015/links/link-service.js +505 -0
- package/dist/es2015/main.js +2 -0
- package/dist/es2015/scroller.js +29 -30
- package/dist/es2015/text/text-layer-builder.js +288 -0
- package/dist/es2015/utils.js +42 -14
- package/dist/es2015/widget/page.js +762 -0
- package/dist/es2015/widget/pdfviewer.js +1659 -0
- package/dist/npm/annotations/annotation-editor-layer-builder.d.ts +39 -0
- package/dist/npm/annotations/annotation-editor-layer-builder.js +142 -0
- package/dist/npm/annotations/annotation-editor-layer.d.ts +196 -0
- package/dist/npm/annotations/annotation-editor-layer.js +783 -0
- package/dist/npm/annotations/annotation-editor-ui-manager.d.ts +281 -0
- package/dist/npm/annotations/annotation-editor-ui-manager.js +1694 -0
- package/dist/npm/annotations/annotation-layer-builder.d.ts +58 -0
- package/dist/npm/annotations/annotation-layer-builder.js +220 -0
- package/dist/npm/annotations/annotation-layer.d.ts +134 -0
- package/dist/npm/annotations/annotation-layer.js +2794 -0
- package/dist/npm/annotations/draw-layer-builder.d.ts +21 -0
- package/dist/npm/annotations/draw-layer-builder.js +68 -0
- package/dist/npm/annotations/draw-layer.d.ts +33 -0
- package/dist/npm/annotations/draw-layer.js +223 -0
- package/dist/npm/annotations/editors/annotation-editor.d.ts +349 -0
- package/dist/npm/annotations/editors/annotation-editor.js +1523 -0
- package/dist/npm/annotations/editors/free-text-editor.d.ts +108 -0
- package/dist/npm/annotations/editors/free-text-editor.js +786 -0
- package/dist/npm/annotations/editors/highlight-editor.d.ts +114 -0
- package/dist/npm/annotations/editors/highlight-editor.js +717 -0
- package/dist/npm/annotations/editors/outliner.d.ts +51 -0
- package/dist/npm/annotations/editors/outliner.js +750 -0
- package/dist/npm/annotations/helpers/annotation-storage.d.ts +98 -0
- package/dist/npm/annotations/helpers/annotation-storage.js +299 -0
- package/dist/npm/annotations/helpers/color-manager.d.ts +6 -0
- package/dist/npm/annotations/helpers/color-manager.js +76 -0
- package/dist/npm/annotations/helpers/command-manager.d.ts +42 -0
- package/dist/npm/annotations/helpers/command-manager.js +137 -0
- package/dist/npm/annotations/helpers/id-manager.d.ts +6 -0
- package/dist/npm/annotations/helpers/id-manager.js +38 -0
- package/dist/npm/annotations/helpers/image-manager.d.ts +18 -0
- package/dist/npm/annotations/helpers/image-manager.js +180 -0
- package/dist/npm/annotations/helpers/text-accessibility-manager.d.ts +36 -0
- package/dist/npm/annotations/helpers/text-accessibility-manager.js +215 -0
- package/dist/npm/annotations/helpers/tools.d.ts +1 -0
- package/dist/npm/annotations/helpers/tools.js +23 -0
- package/dist/npm/annotations/shared/display_utils.d.ts +6 -0
- package/dist/npm/annotations/shared/display_utils.js +1030 -0
- package/dist/npm/annotations/shared/event_utils.d.ts +33 -0
- package/dist/npm/annotations/shared/event_utils.js +165 -0
- package/dist/npm/annotations/shared/murmurhash3.d.ts +8 -0
- package/dist/npm/annotations/shared/murmurhash3.js +129 -0
- package/dist/npm/annotations/shared/scripting_utils.d.ts +17 -0
- package/dist/npm/annotations/shared/scripting_utils.js +93 -0
- package/dist/npm/annotations/shared/ui_utils.d.ts +54 -0
- package/dist/npm/annotations/shared/ui_utils.js +250 -0
- package/dist/npm/annotations/shared/utils.d.ts +148 -0
- package/dist/npm/annotations/shared/utils.js +872 -0
- package/dist/npm/annotations.d.ts +23 -0
- package/dist/npm/annotations.js +72 -0
- package/dist/npm/common/component.d.ts +9 -0
- package/dist/npm/common/component.js +37 -0
- package/dist/npm/common/core.d.ts +18 -0
- package/dist/npm/common/core.js +112 -0
- package/dist/npm/common/dom.d.ts +3 -0
- package/dist/npm/common/dom.js +17 -0
- package/dist/npm/common/main.d.ts +4 -0
- package/dist/npm/common/main.js +7 -0
- package/dist/npm/common/math.d.ts +1 -0
- package/dist/npm/common/math.js +5 -0
- package/dist/npm/enums/PdfViewerInteractionMode.d.ts +4 -0
- package/dist/npm/enums/PdfViewerInteractionMode.js +9 -0
- package/dist/npm/links/link-service.d.ts +116 -0
- package/dist/npm/links/link-service.js +501 -0
- package/dist/npm/main.d.ts +2 -0
- package/dist/npm/main.js +2 -0
- package/dist/npm/scroller.d.ts +7 -3
- package/dist/npm/scroller.js +32 -32
- package/dist/npm/text/text-layer-builder.d.ts +30 -0
- package/dist/npm/text/text-layer-builder.js +291 -0
- package/dist/npm/utils.d.ts +27 -3
- package/dist/npm/utils.js +51 -19
- package/dist/npm/widget/page.d.ts +75 -0
- package/dist/npm/widget/page.js +763 -0
- package/dist/npm/widget/pdfviewer.d.ts +222 -0
- package/dist/npm/widget/pdfviewer.js +1663 -0
- package/package.json +13 -9
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/* Copyright 2022 Mozilla Foundation
|
|
2
|
+
*
|
|
3
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License.
|
|
5
|
+
* You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
* See the License for the specific language governing permissions and
|
|
13
|
+
* limitations under the License.
|
|
14
|
+
*/
|
|
15
|
+
var _AnnotationEditorLayerBuilder_annotationLayer, _AnnotationEditorLayerBuilder_drawLayer, _AnnotationEditorLayerBuilder_onAppend, _AnnotationEditorLayerBuilder_textLayer, _AnnotationEditorLayerBuilder_uiManager;
|
|
16
|
+
import { __awaiter, __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
|
17
|
+
/** @typedef {import("../src/display/api").PDFPageProxy} PDFPageProxy */
|
|
18
|
+
// eslint-disable-next-line max-len
|
|
19
|
+
/** @typedef {import("../src/display/display_utils").PageViewport} PageViewport */
|
|
20
|
+
// eslint-disable-next-line max-len
|
|
21
|
+
/** @typedef {import("../src/display/editor/tools.js").AnnotationEditorUIManager} AnnotationEditorUIManager */
|
|
22
|
+
// eslint-disable-next-line max-len
|
|
23
|
+
/** @typedef {import("./text_accessibility.js").TextAccessibilityManager} TextAccessibilityManager */
|
|
24
|
+
/** @typedef {import("./interfaces").IL10n} IL10n */
|
|
25
|
+
// eslint-disable-next-line max-len
|
|
26
|
+
/** @typedef {import("../src/display/annotation_layer.js").AnnotationLayer} AnnotationLayer */
|
|
27
|
+
import { AnnotationEditorLayer } from "./annotation-editor-layer";
|
|
28
|
+
// import { GenericL10n } from "web-null_l10n";
|
|
29
|
+
/**
|
|
30
|
+
* @typedef {Object} AnnotationEditorLayerBuilderOptions
|
|
31
|
+
* @property {AnnotationEditorUIManager} [uiManager]
|
|
32
|
+
* @property {PDFPageProxy} pdfPage
|
|
33
|
+
* @property {IL10n} [l10n]
|
|
34
|
+
* @property {TextAccessibilityManager} [accessibilityManager]
|
|
35
|
+
* @property {AnnotationLayer} [annotationLayer]
|
|
36
|
+
* @property {TextLayer} [textLayer]
|
|
37
|
+
* @property {DrawLayer} [drawLayer]
|
|
38
|
+
* @property {function} [onAppend]
|
|
39
|
+
*/
|
|
40
|
+
class AnnotationEditorLayerBuilder {
|
|
41
|
+
/**
|
|
42
|
+
* @param {AnnotationEditorLayerBuilderOptions} options
|
|
43
|
+
*/
|
|
44
|
+
constructor(options) {
|
|
45
|
+
// todo: props
|
|
46
|
+
this.pdfPage = null;
|
|
47
|
+
this.annotationEditorLayer = null;
|
|
48
|
+
this._cancelled = null;
|
|
49
|
+
this.div = null;
|
|
50
|
+
this.accessibilityManager = null;
|
|
51
|
+
// todo: props
|
|
52
|
+
_AnnotationEditorLayerBuilder_annotationLayer.set(this, null);
|
|
53
|
+
_AnnotationEditorLayerBuilder_drawLayer.set(this, null);
|
|
54
|
+
_AnnotationEditorLayerBuilder_onAppend.set(this, null);
|
|
55
|
+
_AnnotationEditorLayerBuilder_textLayer.set(this, null);
|
|
56
|
+
_AnnotationEditorLayerBuilder_uiManager.set(this, null);
|
|
57
|
+
this.pdfPage = options.pdfPage;
|
|
58
|
+
this.accessibilityManager = options.accessibilityManager;
|
|
59
|
+
// this.l10n = options.l10n;
|
|
60
|
+
// if (typeof PDFJSDev === "undefined" || PDFJSDev.test("GENERIC")) {
|
|
61
|
+
// this.l10n ||= new GenericL10n();
|
|
62
|
+
// }
|
|
63
|
+
this.annotationEditorLayer = null;
|
|
64
|
+
this.div = null;
|
|
65
|
+
this._cancelled = false;
|
|
66
|
+
__classPrivateFieldSet(this, _AnnotationEditorLayerBuilder_uiManager, options.uiManager, "f");
|
|
67
|
+
__classPrivateFieldSet(this, _AnnotationEditorLayerBuilder_annotationLayer, options.annotationLayer || null, "f");
|
|
68
|
+
__classPrivateFieldSet(this, _AnnotationEditorLayerBuilder_textLayer, options.textLayer || null, "f");
|
|
69
|
+
__classPrivateFieldSet(this, _AnnotationEditorLayerBuilder_drawLayer, options.drawLayer || null, "f");
|
|
70
|
+
__classPrivateFieldSet(this, _AnnotationEditorLayerBuilder_onAppend, options.onAppend || null, "f");
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* @param {PageViewport} viewport
|
|
74
|
+
* @param {string} intent (default value is 'display')
|
|
75
|
+
*/
|
|
76
|
+
render(viewport_1) {
|
|
77
|
+
return __awaiter(this, arguments, void 0, function* (viewport, intent = "display") {
|
|
78
|
+
var _a;
|
|
79
|
+
if (intent !== "display") {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (this._cancelled) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const clonedViewport = viewport.clone({ dontFlip: true });
|
|
86
|
+
if (this.div) {
|
|
87
|
+
this.annotationEditorLayer.update({ viewport: clonedViewport });
|
|
88
|
+
this.show();
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
// Create an AnnotationEditor layer div
|
|
92
|
+
const div = (this.div = document.createElement("div"));
|
|
93
|
+
div.className = "k-annotation-editor-layer annotationEditorLayer";
|
|
94
|
+
div.hidden = true;
|
|
95
|
+
div.dir = __classPrivateFieldGet(this, _AnnotationEditorLayerBuilder_uiManager, "f").direction;
|
|
96
|
+
(_a = __classPrivateFieldGet(this, _AnnotationEditorLayerBuilder_onAppend, "f")) === null || _a === void 0 ? void 0 : _a.call(this, div);
|
|
97
|
+
this.annotationEditorLayer = new AnnotationEditorLayer({
|
|
98
|
+
uiManager: __classPrivateFieldGet(this, _AnnotationEditorLayerBuilder_uiManager, "f"),
|
|
99
|
+
div,
|
|
100
|
+
accessibilityManager: this.accessibilityManager,
|
|
101
|
+
pageIndex: this.pdfPage.pageNumber - 1,
|
|
102
|
+
// l10n: this.l10n,
|
|
103
|
+
viewport: clonedViewport,
|
|
104
|
+
annotationLayer: __classPrivateFieldGet(this, _AnnotationEditorLayerBuilder_annotationLayer, "f"),
|
|
105
|
+
textLayer: __classPrivateFieldGet(this, _AnnotationEditorLayerBuilder_textLayer, "f"),
|
|
106
|
+
drawLayer: __classPrivateFieldGet(this, _AnnotationEditorLayerBuilder_drawLayer, "f"),
|
|
107
|
+
});
|
|
108
|
+
const parameters = {
|
|
109
|
+
viewport: clonedViewport,
|
|
110
|
+
div,
|
|
111
|
+
annotations: null,
|
|
112
|
+
intent,
|
|
113
|
+
};
|
|
114
|
+
this.annotationEditorLayer.render(parameters);
|
|
115
|
+
this.show();
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
cancel() {
|
|
119
|
+
this._cancelled = true;
|
|
120
|
+
if (!this.div) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
this.annotationEditorLayer.destroy();
|
|
124
|
+
}
|
|
125
|
+
hide() {
|
|
126
|
+
if (!this.div) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
this.div.hidden = true;
|
|
130
|
+
}
|
|
131
|
+
show() {
|
|
132
|
+
if (!this.div || this.annotationEditorLayer.isInvisible) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
this.div.hidden = false;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
_AnnotationEditorLayerBuilder_annotationLayer = new WeakMap(), _AnnotationEditorLayerBuilder_drawLayer = new WeakMap(), _AnnotationEditorLayerBuilder_onAppend = new WeakMap(), _AnnotationEditorLayerBuilder_textLayer = new WeakMap(), _AnnotationEditorLayerBuilder_uiManager = new WeakMap();
|
|
139
|
+
export { AnnotationEditorLayerBuilder };
|