pdfjs-dist 2.0.943 → 2.1.266
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.
Potentially problematic release.
This version of pdfjs-dist might be problematic. Click here for more details.
- package/bower.json +1 -1
- package/build/pdf.js +15329 -11095
- package/build/pdf.js.map +1 -1
- package/build/pdf.min.js +1 -1
- package/build/pdf.worker.js +12497 -4184
- package/build/pdf.worker.js.map +1 -1
- package/build/pdf.worker.min.js +1 -1
- package/image_decoders/pdf.image_decoders.js +3438 -1209
- package/image_decoders/pdf.image_decoders.js.map +1 -1
- package/image_decoders/pdf.image_decoders.min.js +1 -1
- package/lib/core/annotation.js +335 -109
- package/lib/core/arithmetic_decoder.js +274 -244
- package/lib/core/bidi.js +64 -5
- package/lib/core/ccitt.js +172 -17
- package/lib/core/ccitt_stream.js +14 -5
- package/lib/core/cff_parser.js +304 -28
- package/lib/core/charsets.js +4 -3
- package/lib/core/chunked_stream.js +379 -149
- package/lib/core/cmap.js +210 -40
- package/lib/core/colorspace.js +332 -187
- package/lib/core/crypto.js +289 -44
- package/lib/core/document.js +508 -249
- package/lib/core/encodings.js +18 -9
- package/lib/core/evaluator.js +657 -119
- package/lib/core/font_renderer.js +217 -34
- package/lib/core/fonts.js +632 -41
- package/lib/core/function.js +252 -26
- package/lib/core/glyphlist.js +2 -1
- package/lib/core/image.js +124 -27
- package/lib/core/jbig2.js +425 -65
- package/lib/core/jbig2_stream.js +18 -7
- package/lib/core/jpeg_stream.js +24 -8
- package/lib/core/jpg.js +208 -16
- package/lib/core/jpx.js +395 -5
- package/lib/core/jpx_stream.js +17 -5
- package/lib/core/metrics.js +3 -3
- package/lib/core/murmurhash3.js +23 -5
- package/lib/core/obj.js +625 -132
- package/lib/core/operator_list.js +104 -3
- package/lib/core/parser.js +262 -25
- package/lib/core/pattern.js +144 -12
- package/lib/core/pdf_manager.js +104 -70
- package/lib/core/primitives.js +74 -21
- package/lib/core/ps_parser.js +133 -44
- package/lib/core/standard_fonts.js +9 -9
- package/lib/core/stream.js +283 -31
- package/lib/core/type1_parser.js +138 -6
- package/lib/core/unicode.js +28 -1
- package/lib/core/worker.js +192 -57
- package/lib/display/annotation_layer.js +303 -123
- package/lib/display/api.js +1073 -574
- package/lib/display/api_compatibility.js +4 -1
- package/lib/display/canvas.js +314 -18
- package/lib/display/content_disposition.js +70 -23
- package/lib/display/dom_utils.js +112 -59
- package/lib/display/fetch_stream.js +95 -50
- package/lib/display/font_loader.js +250 -132
- package/lib/display/metadata.js +37 -15
- package/lib/display/network.js +123 -34
- package/lib/display/network_utils.js +23 -10
- package/lib/display/node_stream.js +162 -65
- package/lib/display/pattern_helper.js +57 -6
- package/lib/display/svg.js +194 -18
- package/lib/display/text_layer.js +128 -14
- package/lib/display/transport_stream.js +83 -27
- package/lib/display/webgl.js +63 -17
- package/lib/display/worker_options.js +4 -3
- package/lib/display/xml_parser.js +162 -52
- package/lib/examples/node/domstubs.js +56 -3
- package/lib/pdf.js +15 -2
- package/lib/pdf.worker.js +4 -2
- package/lib/shared/compatibility.js +129 -26
- package/lib/shared/global_scope.js +1 -1
- package/lib/shared/is_node.js +3 -3
- package/lib/shared/message_handler.js +103 -45
- package/lib/shared/streams_polyfill.js +20 -16
- package/lib/shared/url_polyfill.js +8 -2
- package/lib/shared/util.js +246 -84
- package/lib/test/unit/annotation_spec.js +99 -73
- package/lib/test/unit/api_spec.js +347 -113
- package/lib/test/unit/bidi_spec.js +6 -6
- package/lib/test/unit/cff_parser_spec.js +17 -5
- package/lib/test/unit/clitests_helper.js +7 -8
- package/lib/test/unit/cmap_spec.js +79 -25
- package/lib/test/unit/colorspace_spec.js +65 -18
- package/lib/test/unit/crypto_spec.js +16 -4
- package/lib/test/unit/custom_spec.js +40 -52
- package/lib/test/unit/display_svg_spec.js +32 -16
- package/lib/test/unit/document_spec.js +2 -2
- package/lib/test/unit/dom_utils_spec.js +8 -8
- package/lib/test/unit/encodings_spec.js +24 -44
- package/lib/test/unit/evaluator_spec.js +15 -8
- package/lib/test/unit/function_spec.js +16 -4
- package/lib/test/unit/jasmine-boot.js +29 -16
- package/lib/test/unit/message_handler_spec.js +19 -6
- package/lib/test/unit/metadata_spec.js +64 -11
- package/lib/test/unit/murmurhash3_spec.js +2 -2
- package/lib/test/unit/network_spec.js +19 -4
- package/lib/test/unit/network_utils_spec.js +6 -4
- package/lib/test/unit/node_stream_spec.js +50 -26
- package/lib/test/unit/parser_spec.js +13 -29
- package/lib/test/unit/pdf_find_controller_spec.js +144 -32
- package/lib/test/unit/pdf_find_utils_spec.js +10 -9
- package/lib/test/unit/pdf_history_spec.js +20 -8
- package/lib/test/unit/primitives_spec.js +23 -3
- package/lib/test/unit/stream_spec.js +8 -3
- package/lib/test/unit/test_utils.js +89 -26
- package/lib/test/unit/testreporter.js +19 -1
- package/lib/test/unit/type1_parser_spec.js +7 -5
- package/lib/test/unit/ui_utils_spec.js +162 -38
- package/lib/test/unit/unicode_spec.js +13 -10
- package/lib/test/unit/util_spec.js +89 -9
- package/lib/web/annotation_layer_builder.js +38 -21
- package/lib/web/app.js +610 -245
- package/lib/web/app_options.js +54 -34
- package/lib/web/base_viewer.js +359 -162
- package/lib/web/chromecom.js +159 -80
- package/lib/web/debugger.js +161 -17
- package/lib/web/download_manager.js +29 -11
- package/lib/web/firefox_print_service.js +16 -8
- package/lib/web/firefoxcom.js +127 -91
- package/lib/web/genericcom.js +50 -31
- package/lib/web/genericl10n.js +46 -34
- package/lib/web/grab_to_pan.js +25 -3
- package/lib/web/interfaces.js +108 -61
- package/lib/web/overlay_manager.js +67 -45
- package/lib/web/password_prompt.js +20 -12
- package/lib/web/pdf_attachment_viewer.js +37 -17
- package/lib/web/pdf_cursor_tools.js +38 -15
- package/lib/web/pdf_document_properties.js +65 -24
- package/lib/web/pdf_find_bar.js +48 -20
- package/lib/web/pdf_find_controller.js +290 -89
- package/lib/web/pdf_find_utils.js +19 -3
- package/lib/web/pdf_history.js +186 -49
- package/lib/web/pdf_link_service.js +127 -52
- package/lib/web/pdf_outline_viewer.js +71 -21
- package/lib/web/pdf_page_view.js +188 -63
- package/lib/web/pdf_presentation_mode.js +98 -33
- package/lib/web/pdf_print_service.js +54 -10
- package/lib/web/pdf_rendering_queue.js +26 -4
- package/lib/web/pdf_sidebar.js +116 -62
- package/lib/web/pdf_sidebar_resizer.js +41 -15
- package/lib/web/pdf_single_page_viewer.js +65 -68
- package/lib/web/pdf_thumbnail_view.js +102 -31
- package/lib/web/pdf_thumbnail_viewer.js +62 -22
- package/lib/web/pdf_viewer.component.js +111 -31
- package/lib/web/pdf_viewer.js +80 -60
- package/lib/web/preferences.js +61 -39
- package/lib/web/secondary_toolbar.js +101 -82
- package/lib/web/text_layer_builder.js +124 -69
- package/lib/web/toolbar.js +67 -27
- package/lib/web/ui_utils.js +284 -128
- package/lib/web/view_history.js +75 -51
- package/lib/web/viewer_compatibility.js +2 -1
- package/package.json +1 -1
- package/web/pdf_viewer.css +1 -1
- package/web/pdf_viewer.js +2200 -973
- package/web/pdf_viewer.js.map +1 -1
- package/lib/web/dom_events.js +0 -140
package/lib/web/interfaces.js
CHANGED
@@ -19,52 +19,64 @@
|
|
19
19
|
* @licend The above is the entire license notice for the
|
20
20
|
* Javascript code in this page
|
21
21
|
*/
|
22
|
-
|
22
|
+
"use strict";
|
23
23
|
|
24
|
-
|
24
|
+
Object.defineProperty(exports, "__esModule", {
|
25
|
+
value: true
|
26
|
+
});
|
27
|
+
exports.IL10n = exports.IPDFAnnotationLayerFactory = exports.IPDFTextLayerFactory = exports.IRenderableView = exports.IPDFHistory = exports.IPDFLinkService = void 0;
|
25
28
|
|
26
|
-
var
|
27
|
-
|
28
|
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
29
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
29
30
|
|
30
31
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
31
32
|
|
32
|
-
function
|
33
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
34
|
+
|
35
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
33
36
|
|
34
37
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
35
38
|
|
36
|
-
var
|
39
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
40
|
+
|
41
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
42
|
+
|
43
|
+
var IPDFLinkService =
|
44
|
+
/*#__PURE__*/
|
45
|
+
function () {
|
37
46
|
function IPDFLinkService() {
|
38
47
|
_classCallCheck(this, IPDFLinkService);
|
39
48
|
}
|
40
49
|
|
41
50
|
_createClass(IPDFLinkService, [{
|
42
|
-
key:
|
51
|
+
key: "navigateTo",
|
43
52
|
value: function navigateTo(dest) {}
|
44
53
|
}, {
|
45
|
-
key:
|
54
|
+
key: "getDestinationHash",
|
46
55
|
value: function getDestinationHash(dest) {}
|
47
56
|
}, {
|
48
|
-
key:
|
57
|
+
key: "getAnchorUrl",
|
49
58
|
value: function getAnchorUrl(hash) {}
|
50
59
|
}, {
|
51
|
-
key:
|
60
|
+
key: "setHash",
|
52
61
|
value: function setHash(hash) {}
|
53
62
|
}, {
|
54
|
-
key:
|
63
|
+
key: "executeNamedAction",
|
55
64
|
value: function executeNamedAction(action) {}
|
56
65
|
}, {
|
57
|
-
key:
|
66
|
+
key: "cachePageRef",
|
58
67
|
value: function cachePageRef(pageNum, pageRef) {}
|
59
68
|
}, {
|
60
|
-
key:
|
69
|
+
key: "isPageVisible",
|
70
|
+
value: function isPageVisible(pageNumber) {}
|
71
|
+
}, {
|
72
|
+
key: "pagesCount",
|
61
73
|
get: function get() {}
|
62
74
|
}, {
|
63
|
-
key:
|
75
|
+
key: "page",
|
64
76
|
get: function get() {},
|
65
77
|
set: function set(value) {}
|
66
78
|
}, {
|
67
|
-
key:
|
79
|
+
key: "rotation",
|
68
80
|
get: function get() {},
|
69
81
|
set: function set(value) {}
|
70
82
|
}]);
|
@@ -72,66 +84,83 @@ var IPDFLinkService = function () {
|
|
72
84
|
return IPDFLinkService;
|
73
85
|
}();
|
74
86
|
|
75
|
-
|
87
|
+
exports.IPDFLinkService = IPDFLinkService;
|
88
|
+
|
89
|
+
var IPDFHistory =
|
90
|
+
/*#__PURE__*/
|
91
|
+
function () {
|
76
92
|
function IPDFHistory() {
|
77
93
|
_classCallCheck(this, IPDFHistory);
|
78
94
|
}
|
79
95
|
|
80
96
|
_createClass(IPDFHistory, [{
|
81
|
-
key:
|
82
|
-
value: function initialize(
|
83
|
-
var
|
97
|
+
key: "initialize",
|
98
|
+
value: function initialize(_ref) {
|
99
|
+
var fingerprint = _ref.fingerprint,
|
100
|
+
_ref$resetHistory = _ref.resetHistory,
|
101
|
+
resetHistory = _ref$resetHistory === void 0 ? false : _ref$resetHistory,
|
102
|
+
_ref$updateUrl = _ref.updateUrl,
|
103
|
+
updateUrl = _ref$updateUrl === void 0 ? false : _ref$updateUrl;
|
84
104
|
}
|
85
105
|
}, {
|
86
|
-
key:
|
87
|
-
value: function push(
|
88
|
-
var namedDest =
|
89
|
-
|
90
|
-
|
106
|
+
key: "push",
|
107
|
+
value: function push(_ref2) {
|
108
|
+
var _ref2$namedDest = _ref2.namedDest,
|
109
|
+
namedDest = _ref2$namedDest === void 0 ? null : _ref2$namedDest,
|
110
|
+
explicitDest = _ref2.explicitDest,
|
111
|
+
pageNumber = _ref2.pageNumber;
|
91
112
|
}
|
92
113
|
}, {
|
93
|
-
key:
|
114
|
+
key: "pushCurrentPosition",
|
94
115
|
value: function pushCurrentPosition() {}
|
95
116
|
}, {
|
96
|
-
key:
|
117
|
+
key: "back",
|
97
118
|
value: function back() {}
|
98
119
|
}, {
|
99
|
-
key:
|
120
|
+
key: "forward",
|
100
121
|
value: function forward() {}
|
101
122
|
}]);
|
102
123
|
|
103
124
|
return IPDFHistory;
|
104
125
|
}();
|
105
126
|
|
106
|
-
|
127
|
+
exports.IPDFHistory = IPDFHistory;
|
128
|
+
|
129
|
+
var IRenderableView =
|
130
|
+
/*#__PURE__*/
|
131
|
+
function () {
|
107
132
|
function IRenderableView() {
|
108
133
|
_classCallCheck(this, IRenderableView);
|
109
134
|
}
|
110
135
|
|
111
136
|
_createClass(IRenderableView, [{
|
112
|
-
key:
|
137
|
+
key: "draw",
|
113
138
|
value: function draw() {}
|
114
139
|
}, {
|
115
|
-
key:
|
140
|
+
key: "resume",
|
116
141
|
value: function resume() {}
|
117
142
|
}, {
|
118
|
-
key:
|
143
|
+
key: "renderingId",
|
119
144
|
get: function get() {}
|
120
145
|
}, {
|
121
|
-
key:
|
146
|
+
key: "renderingState",
|
122
147
|
get: function get() {}
|
123
148
|
}]);
|
124
149
|
|
125
150
|
return IRenderableView;
|
126
151
|
}();
|
127
152
|
|
128
|
-
|
153
|
+
exports.IRenderableView = IRenderableView;
|
154
|
+
|
155
|
+
var IPDFTextLayerFactory =
|
156
|
+
/*#__PURE__*/
|
157
|
+
function () {
|
129
158
|
function IPDFTextLayerFactory() {
|
130
159
|
_classCallCheck(this, IPDFTextLayerFactory);
|
131
160
|
}
|
132
161
|
|
133
162
|
_createClass(IPDFTextLayerFactory, [{
|
134
|
-
key:
|
163
|
+
key: "createTextLayerBuilder",
|
135
164
|
value: function createTextLayerBuilder(textLayerDiv, pageIndex, viewport) {
|
136
165
|
var enhanceTextSelection = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
137
166
|
}
|
@@ -140,13 +169,17 @@ var IPDFTextLayerFactory = function () {
|
|
140
169
|
return IPDFTextLayerFactory;
|
141
170
|
}();
|
142
171
|
|
143
|
-
|
172
|
+
exports.IPDFTextLayerFactory = IPDFTextLayerFactory;
|
173
|
+
|
174
|
+
var IPDFAnnotationLayerFactory =
|
175
|
+
/*#__PURE__*/
|
176
|
+
function () {
|
144
177
|
function IPDFAnnotationLayerFactory() {
|
145
178
|
_classCallCheck(this, IPDFAnnotationLayerFactory);
|
146
179
|
}
|
147
180
|
|
148
181
|
_createClass(IPDFAnnotationLayerFactory, [{
|
149
|
-
key:
|
182
|
+
key: "createAnnotationLayerBuilder",
|
150
183
|
value: function createAnnotationLayerBuilder(pageDiv, pdfPage) {
|
151
184
|
var imageResourcesPath = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
152
185
|
var renderInteractiveForms = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
@@ -157,20 +190,26 @@ var IPDFAnnotationLayerFactory = function () {
|
|
157
190
|
return IPDFAnnotationLayerFactory;
|
158
191
|
}();
|
159
192
|
|
160
|
-
|
193
|
+
exports.IPDFAnnotationLayerFactory = IPDFAnnotationLayerFactory;
|
194
|
+
|
195
|
+
var IL10n =
|
196
|
+
/*#__PURE__*/
|
197
|
+
function () {
|
161
198
|
function IL10n() {
|
162
199
|
_classCallCheck(this, IL10n);
|
163
200
|
}
|
164
201
|
|
165
202
|
_createClass(IL10n, [{
|
166
|
-
key:
|
203
|
+
key: "getLanguage",
|
167
204
|
value: function () {
|
168
|
-
var
|
169
|
-
|
205
|
+
var _getLanguage = _asyncToGenerator(
|
206
|
+
/*#__PURE__*/
|
207
|
+
_regenerator.default.mark(function _callee() {
|
208
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
170
209
|
while (1) {
|
171
210
|
switch (_context.prev = _context.next) {
|
172
211
|
case 0:
|
173
|
-
case
|
212
|
+
case "end":
|
174
213
|
return _context.stop();
|
175
214
|
}
|
176
215
|
}
|
@@ -178,20 +217,22 @@ var IL10n = function () {
|
|
178
217
|
}));
|
179
218
|
|
180
219
|
function getLanguage() {
|
181
|
-
return
|
220
|
+
return _getLanguage.apply(this, arguments);
|
182
221
|
}
|
183
222
|
|
184
223
|
return getLanguage;
|
185
224
|
}()
|
186
225
|
}, {
|
187
|
-
key:
|
226
|
+
key: "getDirection",
|
188
227
|
value: function () {
|
189
|
-
var
|
190
|
-
|
228
|
+
var _getDirection = _asyncToGenerator(
|
229
|
+
/*#__PURE__*/
|
230
|
+
_regenerator.default.mark(function _callee2() {
|
231
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
191
232
|
while (1) {
|
192
233
|
switch (_context2.prev = _context2.next) {
|
193
234
|
case 0:
|
194
|
-
case
|
235
|
+
case "end":
|
195
236
|
return _context2.stop();
|
196
237
|
}
|
197
238
|
}
|
@@ -199,49 +240,53 @@ var IL10n = function () {
|
|
199
240
|
}));
|
200
241
|
|
201
242
|
function getDirection() {
|
202
|
-
return
|
243
|
+
return _getDirection.apply(this, arguments);
|
203
244
|
}
|
204
245
|
|
205
246
|
return getDirection;
|
206
247
|
}()
|
207
248
|
}, {
|
208
|
-
key:
|
249
|
+
key: "get",
|
209
250
|
value: function () {
|
210
|
-
var
|
211
|
-
|
251
|
+
var _get = _asyncToGenerator(
|
252
|
+
/*#__PURE__*/
|
253
|
+
_regenerator.default.mark(function _callee3(key, args, fallback) {
|
254
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
212
255
|
while (1) {
|
213
256
|
switch (_context3.prev = _context3.next) {
|
214
257
|
case 0:
|
215
|
-
case
|
258
|
+
case "end":
|
216
259
|
return _context3.stop();
|
217
260
|
}
|
218
261
|
}
|
219
262
|
}, _callee3, this);
|
220
263
|
}));
|
221
264
|
|
222
|
-
function get(
|
223
|
-
return
|
265
|
+
function get(_x, _x2, _x3) {
|
266
|
+
return _get.apply(this, arguments);
|
224
267
|
}
|
225
268
|
|
226
269
|
return get;
|
227
270
|
}()
|
228
271
|
}, {
|
229
|
-
key:
|
272
|
+
key: "translate",
|
230
273
|
value: function () {
|
231
|
-
var
|
232
|
-
|
274
|
+
var _translate = _asyncToGenerator(
|
275
|
+
/*#__PURE__*/
|
276
|
+
_regenerator.default.mark(function _callee4(element) {
|
277
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
233
278
|
while (1) {
|
234
279
|
switch (_context4.prev = _context4.next) {
|
235
280
|
case 0:
|
236
|
-
case
|
281
|
+
case "end":
|
237
282
|
return _context4.stop();
|
238
283
|
}
|
239
284
|
}
|
240
285
|
}, _callee4, this);
|
241
286
|
}));
|
242
287
|
|
243
|
-
function translate(
|
244
|
-
return
|
288
|
+
function translate(_x4) {
|
289
|
+
return _translate.apply(this, arguments);
|
245
290
|
}
|
246
291
|
|
247
292
|
return translate;
|
@@ -249,4 +294,6 @@ var IL10n = function () {
|
|
249
294
|
}]);
|
250
295
|
|
251
296
|
return IL10n;
|
252
|
-
}();
|
297
|
+
}();
|
298
|
+
|
299
|
+
exports.IL10n = IL10n;
|
@@ -19,26 +19,30 @@
|
|
19
19
|
* @licend The above is the entire license notice for the
|
20
20
|
* Javascript code in this page
|
21
21
|
*/
|
22
|
-
|
22
|
+
"use strict";
|
23
23
|
|
24
24
|
Object.defineProperty(exports, "__esModule", {
|
25
25
|
value: true
|
26
26
|
});
|
27
|
-
exports.OverlayManager =
|
27
|
+
exports.OverlayManager = void 0;
|
28
28
|
|
29
|
-
var _regenerator = require(
|
30
|
-
|
31
|
-
var _regenerator2 = _interopRequireDefault(_regenerator);
|
32
|
-
|
33
|
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
29
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
34
30
|
|
35
31
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
36
32
|
|
37
|
-
function
|
33
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
34
|
+
|
35
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
38
36
|
|
39
37
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
40
38
|
|
41
|
-
var
|
39
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
40
|
+
|
41
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
42
|
+
|
43
|
+
var OverlayManager =
|
44
|
+
/*#__PURE__*/
|
45
|
+
function () {
|
42
46
|
function OverlayManager() {
|
43
47
|
_classCallCheck(this, OverlayManager);
|
44
48
|
|
@@ -48,34 +52,38 @@ var OverlayManager = function () {
|
|
48
52
|
}
|
49
53
|
|
50
54
|
_createClass(OverlayManager, [{
|
51
|
-
key:
|
55
|
+
key: "register",
|
52
56
|
value: function () {
|
53
|
-
var
|
54
|
-
|
55
|
-
|
56
|
-
var
|
57
|
-
|
57
|
+
var _register = _asyncToGenerator(
|
58
|
+
/*#__PURE__*/
|
59
|
+
_regenerator.default.mark(function _callee(name, element) {
|
60
|
+
var callerCloseMethod,
|
61
|
+
canForceClose,
|
62
|
+
container,
|
63
|
+
_args = arguments;
|
64
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
58
65
|
while (1) {
|
59
66
|
switch (_context.prev = _context.next) {
|
60
67
|
case 0:
|
61
|
-
|
68
|
+
callerCloseMethod = _args.length > 2 && _args[2] !== undefined ? _args[2] : null;
|
69
|
+
canForceClose = _args.length > 3 && _args[3] !== undefined ? _args[3] : false;
|
62
70
|
|
63
71
|
if (!(!name || !element || !(container = element.parentNode))) {
|
64
|
-
_context.next =
|
72
|
+
_context.next = 6;
|
65
73
|
break;
|
66
74
|
}
|
67
75
|
|
68
76
|
throw new Error('Not enough parameters.');
|
69
77
|
|
70
|
-
case
|
78
|
+
case 6:
|
71
79
|
if (!this._overlays[name]) {
|
72
|
-
_context.next =
|
80
|
+
_context.next = 8;
|
73
81
|
break;
|
74
82
|
}
|
75
83
|
|
76
84
|
throw new Error('The overlay is already registered.');
|
77
85
|
|
78
|
-
case
|
86
|
+
case 8:
|
79
87
|
this._overlays[name] = {
|
80
88
|
element: element,
|
81
89
|
container: container,
|
@@ -83,25 +91,27 @@ var OverlayManager = function () {
|
|
83
91
|
canForceClose: canForceClose
|
84
92
|
};
|
85
93
|
|
86
|
-
case
|
87
|
-
case
|
94
|
+
case 9:
|
95
|
+
case "end":
|
88
96
|
return _context.stop();
|
89
97
|
}
|
90
98
|
}
|
91
99
|
}, _callee, this);
|
92
100
|
}));
|
93
101
|
|
94
|
-
function register(
|
95
|
-
return
|
102
|
+
function register(_x, _x2) {
|
103
|
+
return _register.apply(this, arguments);
|
96
104
|
}
|
97
105
|
|
98
106
|
return register;
|
99
107
|
}()
|
100
108
|
}, {
|
101
|
-
key:
|
109
|
+
key: "unregister",
|
102
110
|
value: function () {
|
103
|
-
var
|
104
|
-
|
111
|
+
var _unregister = _asyncToGenerator(
|
112
|
+
/*#__PURE__*/
|
113
|
+
_regenerator.default.mark(function _callee2(name) {
|
114
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
105
115
|
while (1) {
|
106
116
|
switch (_context2.prev = _context2.next) {
|
107
117
|
case 0:
|
@@ -124,24 +134,26 @@ var OverlayManager = function () {
|
|
124
134
|
delete this._overlays[name];
|
125
135
|
|
126
136
|
case 7:
|
127
|
-
case
|
137
|
+
case "end":
|
128
138
|
return _context2.stop();
|
129
139
|
}
|
130
140
|
}
|
131
141
|
}, _callee2, this);
|
132
142
|
}));
|
133
143
|
|
134
|
-
function unregister(
|
135
|
-
return
|
144
|
+
function unregister(_x3) {
|
145
|
+
return _unregister.apply(this, arguments);
|
136
146
|
}
|
137
147
|
|
138
148
|
return unregister;
|
139
149
|
}()
|
140
150
|
}, {
|
141
|
-
key:
|
151
|
+
key: "open",
|
142
152
|
value: function () {
|
143
|
-
var
|
144
|
-
|
153
|
+
var _open = _asyncToGenerator(
|
154
|
+
/*#__PURE__*/
|
155
|
+
_regenerator.default.mark(function _callee3(name) {
|
156
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
145
157
|
while (1) {
|
146
158
|
switch (_context3.prev = _context3.next) {
|
147
159
|
case 0:
|
@@ -164,6 +176,7 @@ var OverlayManager = function () {
|
|
164
176
|
}
|
165
177
|
|
166
178
|
this._closeThroughCaller();
|
179
|
+
|
167
180
|
_context3.next = 14;
|
168
181
|
break;
|
169
182
|
|
@@ -180,29 +193,34 @@ var OverlayManager = function () {
|
|
180
193
|
|
181
194
|
case 14:
|
182
195
|
this._active = name;
|
196
|
+
|
183
197
|
this._overlays[this._active].element.classList.remove('hidden');
|
198
|
+
|
184
199
|
this._overlays[this._active].container.classList.remove('hidden');
|
200
|
+
|
185
201
|
window.addEventListener('keydown', this._keyDownBound);
|
186
202
|
|
187
203
|
case 18:
|
188
|
-
case
|
204
|
+
case "end":
|
189
205
|
return _context3.stop();
|
190
206
|
}
|
191
207
|
}
|
192
208
|
}, _callee3, this);
|
193
209
|
}));
|
194
210
|
|
195
|
-
function open(
|
196
|
-
return
|
211
|
+
function open(_x4) {
|
212
|
+
return _open.apply(this, arguments);
|
197
213
|
}
|
198
214
|
|
199
215
|
return open;
|
200
216
|
}()
|
201
217
|
}, {
|
202
|
-
key:
|
218
|
+
key: "close",
|
203
219
|
value: function () {
|
204
|
-
var
|
205
|
-
|
220
|
+
var _close = _asyncToGenerator(
|
221
|
+
/*#__PURE__*/
|
222
|
+
_regenerator.default.mark(function _callee4(name) {
|
223
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
206
224
|
while (1) {
|
207
225
|
switch (_context4.prev = _context4.next) {
|
208
226
|
case 0:
|
@@ -231,44 +249,48 @@ var OverlayManager = function () {
|
|
231
249
|
|
232
250
|
case 10:
|
233
251
|
this._overlays[this._active].container.classList.add('hidden');
|
252
|
+
|
234
253
|
this._overlays[this._active].element.classList.add('hidden');
|
254
|
+
|
235
255
|
this._active = null;
|
236
256
|
window.removeEventListener('keydown', this._keyDownBound);
|
237
257
|
|
238
258
|
case 14:
|
239
|
-
case
|
259
|
+
case "end":
|
240
260
|
return _context4.stop();
|
241
261
|
}
|
242
262
|
}
|
243
263
|
}, _callee4, this);
|
244
264
|
}));
|
245
265
|
|
246
|
-
function close(
|
247
|
-
return
|
266
|
+
function close(_x5) {
|
267
|
+
return _close.apply(this, arguments);
|
248
268
|
}
|
249
269
|
|
250
270
|
return close;
|
251
271
|
}()
|
252
272
|
}, {
|
253
|
-
key:
|
273
|
+
key: "_keyDown",
|
254
274
|
value: function _keyDown(evt) {
|
255
275
|
if (this._active && evt.keyCode === 27) {
|
256
276
|
this._closeThroughCaller();
|
277
|
+
|
257
278
|
evt.preventDefault();
|
258
279
|
}
|
259
280
|
}
|
260
281
|
}, {
|
261
|
-
key:
|
282
|
+
key: "_closeThroughCaller",
|
262
283
|
value: function _closeThroughCaller() {
|
263
284
|
if (this._overlays[this._active].callerCloseMethod) {
|
264
285
|
this._overlays[this._active].callerCloseMethod();
|
265
286
|
}
|
287
|
+
|
266
288
|
if (this._active) {
|
267
289
|
this.close(this._active);
|
268
290
|
}
|
269
291
|
}
|
270
292
|
}, {
|
271
|
-
key:
|
293
|
+
key: "active",
|
272
294
|
get: function get() {
|
273
295
|
return this._active;
|
274
296
|
}
|