@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.
Files changed (153) hide show
  1. package/dist/es/annotations/annotation-editor-layer-builder.js +139 -0
  2. package/dist/es/annotations/annotation-editor-layer.js +780 -0
  3. package/dist/es/annotations/annotation-editor-ui-manager.js +1690 -0
  4. package/dist/es/annotations/annotation-layer-builder.js +217 -0
  5. package/dist/es/annotations/annotation-layer.js +2793 -0
  6. package/dist/es/annotations/draw-layer-builder.js +65 -0
  7. package/dist/es/annotations/draw-layer.js +220 -0
  8. package/dist/es/annotations/editors/annotation-editor.js +1519 -0
  9. package/dist/es/annotations/editors/free-text-editor.js +783 -0
  10. package/dist/es/annotations/editors/highlight-editor.js +717 -0
  11. package/dist/es/annotations/editors/outliner.js +747 -0
  12. package/dist/es/annotations/helpers/annotation-storage.js +294 -0
  13. package/dist/es/annotations/helpers/color-manager.js +72 -0
  14. package/dist/es/annotations/helpers/command-manager.js +133 -0
  15. package/dist/es/annotations/helpers/id-manager.js +34 -0
  16. package/dist/es/annotations/helpers/image-manager.js +176 -0
  17. package/dist/es/annotations/helpers/text-accessibility-manager.js +212 -0
  18. package/dist/es/annotations/helpers/tools.js +19 -0
  19. package/dist/es/annotations/shared/display_utils.js +1024 -0
  20. package/dist/es/annotations/shared/event_utils.js +213 -0
  21. package/dist/es/annotations/shared/murmurhash3.js +126 -0
  22. package/dist/es/annotations/shared/scripting_utils.js +90 -0
  23. package/dist/es/annotations/shared/ui_utils.js +823 -0
  24. package/dist/es/annotations/shared/utils.js +909 -0
  25. package/dist/es/annotations.js +68 -0
  26. package/dist/es/common/component.js +33 -0
  27. package/dist/es/common/core.js +91 -0
  28. package/dist/es/common/dom.js +11 -0
  29. package/dist/es/common/main.js +4 -0
  30. package/dist/es/common/math.js +1 -0
  31. package/dist/es/enums/PdfViewerInteractionMode.js +6 -0
  32. package/dist/es/links/link-service.js +505 -0
  33. package/dist/es/main.js +2 -0
  34. package/dist/es/scroller.js +29 -30
  35. package/dist/es/text/text-layer-builder.js +288 -0
  36. package/dist/es/utils.js +42 -14
  37. package/dist/es/widget/page.js +762 -0
  38. package/dist/es/widget/pdfviewer.js +1659 -0
  39. package/dist/es2015/annotations/annotation-editor-layer-builder.js +139 -0
  40. package/dist/es2015/annotations/annotation-editor-layer.js +780 -0
  41. package/dist/es2015/annotations/annotation-editor-ui-manager.js +1690 -0
  42. package/dist/es2015/annotations/annotation-layer-builder.js +217 -0
  43. package/dist/es2015/annotations/annotation-layer.js +2793 -0
  44. package/dist/es2015/annotations/draw-layer-builder.js +65 -0
  45. package/dist/es2015/annotations/draw-layer.js +220 -0
  46. package/dist/es2015/annotations/editors/annotation-editor.js +1519 -0
  47. package/dist/es2015/annotations/editors/free-text-editor.js +783 -0
  48. package/dist/es2015/annotations/editors/highlight-editor.js +717 -0
  49. package/dist/es2015/annotations/editors/outliner.js +747 -0
  50. package/dist/es2015/annotations/helpers/annotation-storage.js +294 -0
  51. package/dist/es2015/annotations/helpers/color-manager.js +72 -0
  52. package/dist/es2015/annotations/helpers/command-manager.js +133 -0
  53. package/dist/es2015/annotations/helpers/id-manager.js +34 -0
  54. package/dist/es2015/annotations/helpers/image-manager.js +176 -0
  55. package/dist/es2015/annotations/helpers/text-accessibility-manager.js +212 -0
  56. package/dist/es2015/annotations/helpers/tools.js +19 -0
  57. package/dist/es2015/annotations/shared/display_utils.js +1024 -0
  58. package/dist/es2015/annotations/shared/event_utils.js +213 -0
  59. package/dist/es2015/annotations/shared/murmurhash3.js +126 -0
  60. package/dist/es2015/annotations/shared/scripting_utils.js +90 -0
  61. package/dist/es2015/annotations/shared/ui_utils.js +823 -0
  62. package/dist/es2015/annotations/shared/utils.js +909 -0
  63. package/dist/es2015/annotations.js +68 -0
  64. package/dist/es2015/common/component.js +33 -0
  65. package/dist/es2015/common/core.js +91 -0
  66. package/dist/es2015/common/dom.js +11 -0
  67. package/dist/es2015/common/main.js +4 -0
  68. package/dist/es2015/common/math.js +1 -0
  69. package/dist/es2015/enums/PdfViewerInteractionMode.js +6 -0
  70. package/dist/es2015/links/link-service.js +505 -0
  71. package/dist/es2015/main.js +2 -0
  72. package/dist/es2015/scroller.js +29 -30
  73. package/dist/es2015/text/text-layer-builder.js +288 -0
  74. package/dist/es2015/utils.js +42 -14
  75. package/dist/es2015/widget/page.js +762 -0
  76. package/dist/es2015/widget/pdfviewer.js +1659 -0
  77. package/dist/npm/annotations/annotation-editor-layer-builder.d.ts +39 -0
  78. package/dist/npm/annotations/annotation-editor-layer-builder.js +142 -0
  79. package/dist/npm/annotations/annotation-editor-layer.d.ts +196 -0
  80. package/dist/npm/annotations/annotation-editor-layer.js +783 -0
  81. package/dist/npm/annotations/annotation-editor-ui-manager.d.ts +281 -0
  82. package/dist/npm/annotations/annotation-editor-ui-manager.js +1694 -0
  83. package/dist/npm/annotations/annotation-layer-builder.d.ts +58 -0
  84. package/dist/npm/annotations/annotation-layer-builder.js +220 -0
  85. package/dist/npm/annotations/annotation-layer.d.ts +134 -0
  86. package/dist/npm/annotations/annotation-layer.js +2794 -0
  87. package/dist/npm/annotations/draw-layer-builder.d.ts +21 -0
  88. package/dist/npm/annotations/draw-layer-builder.js +68 -0
  89. package/dist/npm/annotations/draw-layer.d.ts +33 -0
  90. package/dist/npm/annotations/draw-layer.js +223 -0
  91. package/dist/npm/annotations/editors/annotation-editor.d.ts +349 -0
  92. package/dist/npm/annotations/editors/annotation-editor.js +1523 -0
  93. package/dist/npm/annotations/editors/free-text-editor.d.ts +108 -0
  94. package/dist/npm/annotations/editors/free-text-editor.js +786 -0
  95. package/dist/npm/annotations/editors/highlight-editor.d.ts +114 -0
  96. package/dist/npm/annotations/editors/highlight-editor.js +717 -0
  97. package/dist/npm/annotations/editors/outliner.d.ts +51 -0
  98. package/dist/npm/annotations/editors/outliner.js +750 -0
  99. package/dist/npm/annotations/helpers/annotation-storage.d.ts +98 -0
  100. package/dist/npm/annotations/helpers/annotation-storage.js +299 -0
  101. package/dist/npm/annotations/helpers/color-manager.d.ts +6 -0
  102. package/dist/npm/annotations/helpers/color-manager.js +76 -0
  103. package/dist/npm/annotations/helpers/command-manager.d.ts +42 -0
  104. package/dist/npm/annotations/helpers/command-manager.js +137 -0
  105. package/dist/npm/annotations/helpers/id-manager.d.ts +6 -0
  106. package/dist/npm/annotations/helpers/id-manager.js +38 -0
  107. package/dist/npm/annotations/helpers/image-manager.d.ts +18 -0
  108. package/dist/npm/annotations/helpers/image-manager.js +180 -0
  109. package/dist/npm/annotations/helpers/text-accessibility-manager.d.ts +36 -0
  110. package/dist/npm/annotations/helpers/text-accessibility-manager.js +215 -0
  111. package/dist/npm/annotations/helpers/tools.d.ts +1 -0
  112. package/dist/npm/annotations/helpers/tools.js +23 -0
  113. package/dist/npm/annotations/shared/display_utils.d.ts +6 -0
  114. package/dist/npm/annotations/shared/display_utils.js +1030 -0
  115. package/dist/npm/annotations/shared/event_utils.d.ts +33 -0
  116. package/dist/npm/annotations/shared/event_utils.js +165 -0
  117. package/dist/npm/annotations/shared/murmurhash3.d.ts +8 -0
  118. package/dist/npm/annotations/shared/murmurhash3.js +129 -0
  119. package/dist/npm/annotations/shared/scripting_utils.d.ts +17 -0
  120. package/dist/npm/annotations/shared/scripting_utils.js +93 -0
  121. package/dist/npm/annotations/shared/ui_utils.d.ts +54 -0
  122. package/dist/npm/annotations/shared/ui_utils.js +250 -0
  123. package/dist/npm/annotations/shared/utils.d.ts +148 -0
  124. package/dist/npm/annotations/shared/utils.js +872 -0
  125. package/dist/npm/annotations.d.ts +23 -0
  126. package/dist/npm/annotations.js +72 -0
  127. package/dist/npm/common/component.d.ts +9 -0
  128. package/dist/npm/common/component.js +37 -0
  129. package/dist/npm/common/core.d.ts +18 -0
  130. package/dist/npm/common/core.js +112 -0
  131. package/dist/npm/common/dom.d.ts +3 -0
  132. package/dist/npm/common/dom.js +17 -0
  133. package/dist/npm/common/main.d.ts +4 -0
  134. package/dist/npm/common/main.js +7 -0
  135. package/dist/npm/common/math.d.ts +1 -0
  136. package/dist/npm/common/math.js +5 -0
  137. package/dist/npm/enums/PdfViewerInteractionMode.d.ts +4 -0
  138. package/dist/npm/enums/PdfViewerInteractionMode.js +9 -0
  139. package/dist/npm/links/link-service.d.ts +116 -0
  140. package/dist/npm/links/link-service.js +501 -0
  141. package/dist/npm/main.d.ts +2 -0
  142. package/dist/npm/main.js +2 -0
  143. package/dist/npm/scroller.d.ts +7 -3
  144. package/dist/npm/scroller.js +32 -32
  145. package/dist/npm/text/text-layer-builder.d.ts +30 -0
  146. package/dist/npm/text/text-layer-builder.js +291 -0
  147. package/dist/npm/utils.d.ts +27 -3
  148. package/dist/npm/utils.js +51 -19
  149. package/dist/npm/widget/page.d.ts +75 -0
  150. package/dist/npm/widget/page.js +763 -0
  151. package/dist/npm/widget/pdfviewer.d.ts +222 -0
  152. package/dist/npm/widget/pdfviewer.js +1663 -0
  153. 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 };