1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | (function webpackUniversalModuleDefinition(root, factory) {
|
9 | if(typeof exports === 'object' && typeof module === 'object')
|
10 | module.exports = factory();
|
11 | else if(typeof define === 'function' && define.amd)
|
12 | define("@material/checkbox", [], factory);
|
13 | else if(typeof exports === 'object')
|
14 | exports["checkbox"] = factory();
|
15 | else
|
16 | root["mdc"] = root["mdc"] || {}, root["mdc"]["checkbox"] = factory();
|
17 | })(this, function() {
|
18 | return (function(modules) {
|
19 |
|
20 | var installedModules = {};
|
21 |
|
22 |
|
23 | function __webpack_require__(moduleId) {
|
24 |
|
25 |
|
26 | if(installedModules[moduleId]) {
|
27 | return installedModules[moduleId].exports;
|
28 | }
|
29 |
|
30 | var module = installedModules[moduleId] = {
|
31 | i: moduleId,
|
32 | l: false,
|
33 | exports: {}
|
34 | };
|
35 |
|
36 |
|
37 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
38 |
|
39 |
|
40 | module.l = true;
|
41 |
|
42 |
|
43 | return module.exports;
|
44 | }
|
45 |
|
46 |
|
47 |
|
48 | __webpack_require__.m = modules;
|
49 |
|
50 |
|
51 | __webpack_require__.c = installedModules;
|
52 |
|
53 |
|
54 | __webpack_require__.d = function(exports, name, getter) {
|
55 | if(!__webpack_require__.o(exports, name)) {
|
56 | Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
57 | }
|
58 | };
|
59 |
|
60 |
|
61 | __webpack_require__.r = function(exports) {
|
62 | if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
63 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
64 | }
|
65 | Object.defineProperty(exports, '__esModule', { value: true });
|
66 | };
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 | __webpack_require__.t = function(value, mode) {
|
74 | if(mode & 1) value = __webpack_require__(value);
|
75 | if(mode & 8) return value;
|
76 | if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
77 | var ns = Object.create(null);
|
78 | __webpack_require__.r(ns);
|
79 | Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
80 | if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
81 | return ns;
|
82 | };
|
83 |
|
84 |
|
85 | __webpack_require__.n = function(module) {
|
86 | var getter = module && module.__esModule ?
|
87 | function getDefault() { return module['default']; } :
|
88 | function getModuleExports() { return module; };
|
89 | __webpack_require__.d(getter, 'a', getter);
|
90 | return getter;
|
91 | };
|
92 |
|
93 |
|
94 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
95 |
|
96 |
|
97 | __webpack_require__.p = "";
|
98 |
|
99 |
|
100 |
|
101 | return __webpack_require__(__webpack_require__.s = "./packages/mdc-checkbox/index.ts");
|
102 | })
|
103 |
|
104 | ({
|
105 |
|
106 | "./packages/mdc-animation/util.ts":
|
107 |
|
108 |
|
109 |
|
110 |
|
111 | (function(module, exports, __webpack_require__) {
|
112 |
|
113 | "use strict";
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 |
|
136 |
|
137 |
|
138 | Object.defineProperty(exports, "__esModule", { value: true });
|
139 | exports.getCorrectEventName = exports.getCorrectPropertyName = void 0;
|
140 | var cssPropertyNameMap = {
|
141 | animation: {
|
142 | prefixed: '-webkit-animation',
|
143 | standard: 'animation'
|
144 | },
|
145 | transform: {
|
146 | prefixed: '-webkit-transform',
|
147 | standard: 'transform'
|
148 | },
|
149 | transition: {
|
150 | prefixed: '-webkit-transition',
|
151 | standard: 'transition'
|
152 | }
|
153 | };
|
154 | var jsEventTypeMap = {
|
155 | animationend: {
|
156 | cssProperty: 'animation',
|
157 | prefixed: 'webkitAnimationEnd',
|
158 | standard: 'animationend'
|
159 | },
|
160 | animationiteration: {
|
161 | cssProperty: 'animation',
|
162 | prefixed: 'webkitAnimationIteration',
|
163 | standard: 'animationiteration'
|
164 | },
|
165 | animationstart: {
|
166 | cssProperty: 'animation',
|
167 | prefixed: 'webkitAnimationStart',
|
168 | standard: 'animationstart'
|
169 | },
|
170 | transitionend: {
|
171 | cssProperty: 'transition',
|
172 | prefixed: 'webkitTransitionEnd',
|
173 | standard: 'transitionend'
|
174 | }
|
175 | };
|
176 | function isWindow(windowObj) {
|
177 | return Boolean(windowObj.document) && typeof windowObj.document.createElement === 'function';
|
178 | }
|
179 | function getCorrectPropertyName(windowObj, cssProperty) {
|
180 | if (isWindow(windowObj) && cssProperty in cssPropertyNameMap) {
|
181 | var el = windowObj.document.createElement('div');
|
182 | var _a = cssPropertyNameMap[cssProperty],
|
183 | standard = _a.standard,
|
184 | prefixed = _a.prefixed;
|
185 | var isStandard = standard in el.style;
|
186 | return isStandard ? standard : prefixed;
|
187 | }
|
188 | return cssProperty;
|
189 | }
|
190 | exports.getCorrectPropertyName = getCorrectPropertyName;
|
191 | function getCorrectEventName(windowObj, eventType) {
|
192 | if (isWindow(windowObj) && eventType in jsEventTypeMap) {
|
193 | var el = windowObj.document.createElement('div');
|
194 | var _a = jsEventTypeMap[eventType],
|
195 | standard = _a.standard,
|
196 | prefixed = _a.prefixed,
|
197 | cssProperty = _a.cssProperty;
|
198 | var isStandard = cssProperty in el.style;
|
199 | return isStandard ? standard : prefixed;
|
200 | }
|
201 | return eventType;
|
202 | }
|
203 | exports.getCorrectEventName = getCorrectEventName;
|
204 |
|
205 | }),
|
206 |
|
207 | "./packages/mdc-base/component.ts":
|
208 |
|
209 |
|
210 |
|
211 |
|
212 | (function(module, exports, __webpack_require__) {
|
213 |
|
214 | "use strict";
|
215 |
|
216 |
|
217 |
|
218 |
|
219 |
|
220 |
|
221 |
|
222 |
|
223 |
|
224 |
|
225 |
|
226 |
|
227 |
|
228 |
|
229 |
|
230 |
|
231 |
|
232 |
|
233 |
|
234 |
|
235 |
|
236 |
|
237 |
|
238 |
|
239 | var __read = this && this.__read || function (o, n) {
|
240 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
241 | if (!m) return o;
|
242 | var i = m.call(o),
|
243 | r,
|
244 | ar = [],
|
245 | e;
|
246 | try {
|
247 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
248 | ar.push(r.value);
|
249 | }
|
250 | } catch (error) {
|
251 | e = { error: error };
|
252 | } finally {
|
253 | try {
|
254 | if (r && !r.done && (m = i["return"])) m.call(i);
|
255 | } finally {
|
256 | if (e) throw e.error;
|
257 | }
|
258 | }
|
259 | return ar;
|
260 | };
|
261 | var __spreadArray = this && this.__spreadArray || function (to, from) {
|
262 | for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) {
|
263 | to[j] = from[i];
|
264 | }return to;
|
265 | };
|
266 | Object.defineProperty(exports, "__esModule", { value: true });
|
267 | exports.MDCComponent = void 0;
|
268 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
269 | var MDCComponent = function () {
|
270 | function MDCComponent(root, foundation) {
|
271 | var args = [];
|
272 | for (var _i = 2; _i < arguments.length; _i++) {
|
273 | args[_i - 2] = arguments[_i];
|
274 | }
|
275 | this.root = root;
|
276 | this.initialize.apply(this, __spreadArray([], __read(args)));
|
277 |
|
278 |
|
279 |
|
280 | this.foundation = foundation === undefined ? this.getDefaultFoundation() : foundation;
|
281 | this.foundation.init();
|
282 | this.initialSyncWithDOM();
|
283 | }
|
284 | MDCComponent.attachTo = function (root) {
|
285 |
|
286 |
|
287 |
|
288 |
|
289 | return new MDCComponent(root, new foundation_1.MDCFoundation({}));
|
290 | };
|
291 |
|
292 | MDCComponent.prototype.initialize = function () {
|
293 | var _args = [];
|
294 | for (var _i = 0; _i < arguments.length; _i++) {
|
295 | _args[_i] = arguments[_i];
|
296 | }
|
297 |
|
298 |
|
299 |
|
300 | };
|
301 | MDCComponent.prototype.getDefaultFoundation = function () {
|
302 |
|
303 |
|
304 | throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class');
|
305 | };
|
306 | MDCComponent.prototype.initialSyncWithDOM = function () {
|
307 |
|
308 |
|
309 |
|
310 |
|
311 | };
|
312 | MDCComponent.prototype.destroy = function () {
|
313 |
|
314 |
|
315 | this.foundation.destroy();
|
316 | };
|
317 | MDCComponent.prototype.listen = function (evtType, handler, options) {
|
318 | this.root.addEventListener(evtType, handler, options);
|
319 | };
|
320 | MDCComponent.prototype.unlisten = function (evtType, handler, options) {
|
321 | this.root.removeEventListener(evtType, handler, options);
|
322 | };
|
323 | |
324 |
|
325 |
|
326 | MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) {
|
327 | if (shouldBubble === void 0) {
|
328 | shouldBubble = false;
|
329 | }
|
330 | var evt;
|
331 | if (typeof CustomEvent === 'function') {
|
332 | evt = new CustomEvent(evtType, {
|
333 | bubbles: shouldBubble,
|
334 | detail: evtData
|
335 | });
|
336 | } else {
|
337 | evt = document.createEvent('CustomEvent');
|
338 | evt.initCustomEvent(evtType, shouldBubble, false, evtData);
|
339 | }
|
340 | this.root.dispatchEvent(evt);
|
341 | };
|
342 | return MDCComponent;
|
343 | }();
|
344 | exports.MDCComponent = MDCComponent;
|
345 |
|
346 | exports.default = MDCComponent;
|
347 |
|
348 | }),
|
349 |
|
350 | "./packages/mdc-base/foundation.ts":
|
351 |
|
352 |
|
353 |
|
354 |
|
355 | (function(module, exports, __webpack_require__) {
|
356 |
|
357 | "use strict";
|
358 |
|
359 |
|
360 |
|
361 |
|
362 |
|
363 |
|
364 |
|
365 |
|
366 |
|
367 |
|
368 |
|
369 |
|
370 |
|
371 |
|
372 |
|
373 |
|
374 |
|
375 |
|
376 |
|
377 |
|
378 |
|
379 |
|
380 |
|
381 |
|
382 | Object.defineProperty(exports, "__esModule", { value: true });
|
383 | exports.MDCFoundation = void 0;
|
384 | var MDCFoundation = function () {
|
385 | function MDCFoundation(adapter) {
|
386 | if (adapter === void 0) {
|
387 | adapter = {};
|
388 | }
|
389 | this.adapter = adapter;
|
390 | }
|
391 | Object.defineProperty(MDCFoundation, "cssClasses", {
|
392 | get: function get() {
|
393 |
|
394 |
|
395 | return {};
|
396 | },
|
397 | enumerable: false,
|
398 | configurable: true
|
399 | });
|
400 | Object.defineProperty(MDCFoundation, "strings", {
|
401 | get: function get() {
|
402 |
|
403 |
|
404 | return {};
|
405 | },
|
406 | enumerable: false,
|
407 | configurable: true
|
408 | });
|
409 | Object.defineProperty(MDCFoundation, "numbers", {
|
410 | get: function get() {
|
411 |
|
412 |
|
413 | return {};
|
414 | },
|
415 | enumerable: false,
|
416 | configurable: true
|
417 | });
|
418 | Object.defineProperty(MDCFoundation, "defaultAdapter", {
|
419 | get: function get() {
|
420 |
|
421 |
|
422 |
|
423 | return {};
|
424 | },
|
425 | enumerable: false,
|
426 | configurable: true
|
427 | });
|
428 | MDCFoundation.prototype.init = function () {
|
429 |
|
430 | };
|
431 | MDCFoundation.prototype.destroy = function () {
|
432 |
|
433 | };
|
434 | return MDCFoundation;
|
435 | }();
|
436 | exports.MDCFoundation = MDCFoundation;
|
437 |
|
438 | exports.default = MDCFoundation;
|
439 |
|
440 | }),
|
441 |
|
442 | "./packages/mdc-checkbox/adapter.ts":
|
443 |
|
444 |
|
445 |
|
446 |
|
447 | (function(module, exports, __webpack_require__) {
|
448 |
|
449 | "use strict";
|
450 |
|
451 |
|
452 |
|
453 |
|
454 |
|
455 |
|
456 |
|
457 |
|
458 |
|
459 |
|
460 |
|
461 |
|
462 |
|
463 |
|
464 |
|
465 |
|
466 |
|
467 |
|
468 |
|
469 |
|
470 |
|
471 |
|
472 |
|
473 |
|
474 | Object.defineProperty(exports, "__esModule", { value: true });
|
475 |
|
476 | }),
|
477 |
|
478 | "./packages/mdc-checkbox/component.ts":
|
479 |
|
480 |
|
481 |
|
482 |
|
483 | (function(module, exports, __webpack_require__) {
|
484 |
|
485 | "use strict";
|
486 |
|
487 |
|
488 |
|
489 |
|
490 |
|
491 |
|
492 |
|
493 |
|
494 |
|
495 |
|
496 |
|
497 |
|
498 |
|
499 |
|
500 |
|
501 |
|
502 |
|
503 |
|
504 |
|
505 |
|
506 |
|
507 |
|
508 |
|
509 |
|
510 | var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
511 |
|
512 | var __extends = this && this.__extends || function () {
|
513 | var _extendStatics = function extendStatics(d, b) {
|
514 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
515 | d.__proto__ = b;
|
516 | } || function (d, b) {
|
517 | for (var p in b) {
|
518 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
519 | }
|
520 | };
|
521 | return _extendStatics(d, b);
|
522 | };
|
523 | return function (d, b) {
|
524 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
525 | _extendStatics(d, b);
|
526 | function __() {
|
527 | this.constructor = d;
|
528 | }
|
529 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
530 | };
|
531 | }();
|
532 | var __assign = this && this.__assign || function () {
|
533 | __assign = Object.assign || function (t) {
|
534 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
535 | s = arguments[i];
|
536 | for (var p in s) {
|
537 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
538 | }
|
539 | }
|
540 | return t;
|
541 | };
|
542 | return __assign.apply(this, arguments);
|
543 | };
|
544 | var __values = this && this.__values || function (o) {
|
545 | var s = typeof Symbol === "function" && Symbol.iterator,
|
546 | m = s && o[s],
|
547 | i = 0;
|
548 | if (m) return m.call(o);
|
549 | if (o && typeof o.length === "number") return {
|
550 | next: function next() {
|
551 | if (o && i >= o.length) o = void 0;
|
552 | return { value: o && o[i++], done: !o };
|
553 | }
|
554 | };
|
555 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
556 | };
|
557 | Object.defineProperty(exports, "__esModule", { value: true });
|
558 | exports.MDCCheckbox = void 0;
|
559 | var util_1 = __webpack_require__( "./packages/mdc-animation/util.ts");
|
560 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
561 | var events_1 = __webpack_require__( "./packages/mdc-dom/events.ts");
|
562 | var ponyfill_1 = __webpack_require__( "./packages/mdc-dom/ponyfill.ts");
|
563 | var component_2 = __webpack_require__( "./packages/mdc-ripple/component.ts");
|
564 | var foundation_1 = __webpack_require__( "./packages/mdc-ripple/foundation.ts");
|
565 | var constants_1 = __webpack_require__( "./packages/mdc-checkbox/constants.ts");
|
566 | var foundation_2 = __webpack_require__( "./packages/mdc-checkbox/foundation.ts");
|
567 | var CB_PROTO_PROPS = ['checked', 'indeterminate'];
|
568 | var MDCCheckbox = function (_super) {
|
569 | __extends(MDCCheckbox, _super);
|
570 | function MDCCheckbox() {
|
571 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
572 | _this.rippleSurface = _this.createRipple();
|
573 | return _this;
|
574 | }
|
575 | MDCCheckbox.attachTo = function (root) {
|
576 | return new MDCCheckbox(root);
|
577 | };
|
578 | Object.defineProperty(MDCCheckbox.prototype, "ripple", {
|
579 | get: function get() {
|
580 | return this.rippleSurface;
|
581 | },
|
582 | enumerable: false,
|
583 | configurable: true
|
584 | });
|
585 | Object.defineProperty(MDCCheckbox.prototype, "checked", {
|
586 | get: function get() {
|
587 | return this.getNativeControl().checked;
|
588 | },
|
589 | set: function set(checked) {
|
590 | this.getNativeControl().checked = checked;
|
591 | },
|
592 | enumerable: false,
|
593 | configurable: true
|
594 | });
|
595 | Object.defineProperty(MDCCheckbox.prototype, "indeterminate", {
|
596 | get: function get() {
|
597 | return this.getNativeControl().indeterminate;
|
598 | },
|
599 | set: function set(indeterminate) {
|
600 | this.getNativeControl().indeterminate = indeterminate;
|
601 | },
|
602 | enumerable: false,
|
603 | configurable: true
|
604 | });
|
605 | Object.defineProperty(MDCCheckbox.prototype, "disabled", {
|
606 | get: function get() {
|
607 | return this.getNativeControl().disabled;
|
608 | },
|
609 | set: function set(disabled) {
|
610 | this.foundation.setDisabled(disabled);
|
611 | },
|
612 | enumerable: false,
|
613 | configurable: true
|
614 | });
|
615 | Object.defineProperty(MDCCheckbox.prototype, "value", {
|
616 | get: function get() {
|
617 | return this.getNativeControl().value;
|
618 | },
|
619 | set: function set(value) {
|
620 | this.getNativeControl().value = value;
|
621 | },
|
622 | enumerable: false,
|
623 | configurable: true
|
624 | });
|
625 | MDCCheckbox.prototype.initialize = function () {
|
626 | var DATA_INDETERMINATE_ATTR = constants_1.strings.DATA_INDETERMINATE_ATTR;
|
627 | this.getNativeControl().indeterminate = this.getNativeControl().getAttribute(DATA_INDETERMINATE_ATTR) === 'true';
|
628 | this.getNativeControl().removeAttribute(DATA_INDETERMINATE_ATTR);
|
629 | };
|
630 | MDCCheckbox.prototype.initialSyncWithDOM = function () {
|
631 | var _this = this;
|
632 | this.handleChange = function () {
|
633 | _this.foundation.handleChange();
|
634 | };
|
635 | this.handleAnimationEnd = function () {
|
636 | _this.foundation.handleAnimationEnd();
|
637 | };
|
638 | this.getNativeControl().addEventListener('change', this.handleChange);
|
639 | this.listen(util_1.getCorrectEventName(window, 'animationend'), this.handleAnimationEnd);
|
640 | this.installPropertyChangeHooks();
|
641 | };
|
642 | MDCCheckbox.prototype.destroy = function () {
|
643 | this.rippleSurface.destroy();
|
644 | this.getNativeControl().removeEventListener('change', this.handleChange);
|
645 | this.unlisten(util_1.getCorrectEventName(window, 'animationend'), this.handleAnimationEnd);
|
646 | this.uninstallPropertyChangeHooks();
|
647 | _super.prototype.destroy.call(this);
|
648 | };
|
649 | MDCCheckbox.prototype.getDefaultFoundation = function () {
|
650 | var _this = this;
|
651 |
|
652 |
|
653 | var adapter = {
|
654 | addClass: function addClass(className) {
|
655 | return _this.root.classList.add(className);
|
656 | },
|
657 | forceLayout: function forceLayout() {
|
658 | return _this.root.offsetWidth;
|
659 | },
|
660 | hasNativeControl: function hasNativeControl() {
|
661 | return !!_this.getNativeControl();
|
662 | },
|
663 | isAttachedToDOM: function isAttachedToDOM() {
|
664 | return Boolean(_this.root.parentNode);
|
665 | },
|
666 | isChecked: function isChecked() {
|
667 | return _this.checked;
|
668 | },
|
669 | isIndeterminate: function isIndeterminate() {
|
670 | return _this.indeterminate;
|
671 | },
|
672 | removeClass: function removeClass(className) {
|
673 | _this.root.classList.remove(className);
|
674 | },
|
675 | removeNativeControlAttr: function removeNativeControlAttr(attr) {
|
676 | _this.getNativeControl().removeAttribute(attr);
|
677 | },
|
678 | setNativeControlAttr: function setNativeControlAttr(attr, value) {
|
679 | _this.getNativeControl().setAttribute(attr, value);
|
680 | },
|
681 | setNativeControlDisabled: function setNativeControlDisabled(disabled) {
|
682 | _this.getNativeControl().disabled = disabled;
|
683 | }
|
684 | };
|
685 | return new foundation_2.MDCCheckboxFoundation(adapter);
|
686 | };
|
687 | MDCCheckbox.prototype.createRipple = function () {
|
688 | var _this = this;
|
689 |
|
690 |
|
691 | var adapter = __assign(__assign({}, component_2.MDCRipple.createAdapter(this)), { deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
|
692 | _this.getNativeControl().removeEventListener(evtType, handler, events_1.applyPassive());
|
693 | }, isSurfaceActive: function isSurfaceActive() {
|
694 | return ponyfill_1.matches(_this.getNativeControl(), ':active');
|
695 | }, isUnbounded: function isUnbounded() {
|
696 | return true;
|
697 | }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
|
698 | _this.getNativeControl().addEventListener(evtType, handler, events_1.applyPassive());
|
699 | } });
|
700 | return new component_2.MDCRipple(this.root, new foundation_1.MDCRippleFoundation(adapter));
|
701 | };
|
702 | MDCCheckbox.prototype.installPropertyChangeHooks = function () {
|
703 | var e_1, _a;
|
704 | var _this = this;
|
705 | var nativeCb = this.getNativeControl();
|
706 | var cbProto = Object.getPrototypeOf(nativeCb);
|
707 | var _loop_1 = function _loop_1(controlState) {
|
708 | var desc = Object.getOwnPropertyDescriptor(cbProto, controlState);
|
709 |
|
710 |
|
711 | if (!validDescriptor(desc)) {
|
712 | return { value: void 0 };
|
713 | }
|
714 |
|
715 | var nativeGetter = desc.get;
|
716 | var nativeCbDesc = {
|
717 | configurable: desc.configurable,
|
718 | enumerable: desc.enumerable,
|
719 | get: nativeGetter,
|
720 | set: function set(state) {
|
721 | desc.set.call(nativeCb, state);
|
722 | _this.foundation.handleChange();
|
723 | }
|
724 | };
|
725 | Object.defineProperty(nativeCb, controlState, nativeCbDesc);
|
726 | };
|
727 | try {
|
728 | for (var CB_PROTO_PROPS_1 = __values(CB_PROTO_PROPS), CB_PROTO_PROPS_1_1 = CB_PROTO_PROPS_1.next(); !CB_PROTO_PROPS_1_1.done; CB_PROTO_PROPS_1_1 = CB_PROTO_PROPS_1.next()) {
|
729 | var controlState = CB_PROTO_PROPS_1_1.value;
|
730 | var state_1 = _loop_1(controlState);
|
731 | if ((typeof state_1 === "undefined" ? "undefined" : _typeof(state_1)) === "object") return state_1.value;
|
732 | }
|
733 | } catch (e_1_1) {
|
734 | e_1 = { error: e_1_1 };
|
735 | } finally {
|
736 | try {
|
737 | if (CB_PROTO_PROPS_1_1 && !CB_PROTO_PROPS_1_1.done && (_a = CB_PROTO_PROPS_1.return)) _a.call(CB_PROTO_PROPS_1);
|
738 | } finally {
|
739 | if (e_1) throw e_1.error;
|
740 | }
|
741 | }
|
742 | };
|
743 | MDCCheckbox.prototype.uninstallPropertyChangeHooks = function () {
|
744 | var e_2, _a;
|
745 | var nativeCb = this.getNativeControl();
|
746 | var cbProto = Object.getPrototypeOf(nativeCb);
|
747 | try {
|
748 | for (var CB_PROTO_PROPS_2 = __values(CB_PROTO_PROPS), CB_PROTO_PROPS_2_1 = CB_PROTO_PROPS_2.next(); !CB_PROTO_PROPS_2_1.done; CB_PROTO_PROPS_2_1 = CB_PROTO_PROPS_2.next()) {
|
749 | var controlState = CB_PROTO_PROPS_2_1.value;
|
750 | var desc = Object.getOwnPropertyDescriptor(cbProto, controlState);
|
751 | if (!validDescriptor(desc)) {
|
752 | return;
|
753 | }
|
754 | Object.defineProperty(nativeCb, controlState, desc);
|
755 | }
|
756 | } catch (e_2_1) {
|
757 | e_2 = { error: e_2_1 };
|
758 | } finally {
|
759 | try {
|
760 | if (CB_PROTO_PROPS_2_1 && !CB_PROTO_PROPS_2_1.done && (_a = CB_PROTO_PROPS_2.return)) _a.call(CB_PROTO_PROPS_2);
|
761 | } finally {
|
762 | if (e_2) throw e_2.error;
|
763 | }
|
764 | }
|
765 | };
|
766 | MDCCheckbox.prototype.getNativeControl = function () {
|
767 | var NATIVE_CONTROL_SELECTOR = constants_1.strings.NATIVE_CONTROL_SELECTOR;
|
768 | var el = this.root.querySelector(NATIVE_CONTROL_SELECTOR);
|
769 | if (!el) {
|
770 | throw new Error("Checkbox component requires a " + NATIVE_CONTROL_SELECTOR + " element");
|
771 | }
|
772 | return el;
|
773 | };
|
774 | return MDCCheckbox;
|
775 | }(component_1.MDCComponent);
|
776 | exports.MDCCheckbox = MDCCheckbox;
|
777 | function validDescriptor(inputPropDesc) {
|
778 | return !!inputPropDesc && typeof inputPropDesc.set === 'function';
|
779 | }
|
780 |
|
781 | }),
|
782 |
|
783 | "./packages/mdc-checkbox/constants.ts":
|
784 |
|
785 |
|
786 |
|
787 |
|
788 | (function(module, exports, __webpack_require__) {
|
789 |
|
790 | "use strict";
|
791 |
|
792 |
|
793 |
|
794 |
|
795 |
|
796 |
|
797 |
|
798 |
|
799 |
|
800 |
|
801 |
|
802 |
|
803 |
|
804 |
|
805 |
|
806 |
|
807 |
|
808 |
|
809 |
|
810 |
|
811 |
|
812 |
|
813 |
|
814 |
|
815 | Object.defineProperty(exports, "__esModule", { value: true });
|
816 | exports.numbers = exports.strings = exports.cssClasses = void 0;
|
817 | exports.cssClasses = {
|
818 | ANIM_CHECKED_INDETERMINATE: 'mdc-checkbox--anim-checked-indeterminate',
|
819 | ANIM_CHECKED_UNCHECKED: 'mdc-checkbox--anim-checked-unchecked',
|
820 | ANIM_INDETERMINATE_CHECKED: 'mdc-checkbox--anim-indeterminate-checked',
|
821 | ANIM_INDETERMINATE_UNCHECKED: 'mdc-checkbox--anim-indeterminate-unchecked',
|
822 | ANIM_UNCHECKED_CHECKED: 'mdc-checkbox--anim-unchecked-checked',
|
823 | ANIM_UNCHECKED_INDETERMINATE: 'mdc-checkbox--anim-unchecked-indeterminate',
|
824 | BACKGROUND: 'mdc-checkbox__background',
|
825 | CHECKED: 'mdc-checkbox--checked',
|
826 | CHECKMARK: 'mdc-checkbox__checkmark',
|
827 | CHECKMARK_PATH: 'mdc-checkbox__checkmark-path',
|
828 | DISABLED: 'mdc-checkbox--disabled',
|
829 | INDETERMINATE: 'mdc-checkbox--indeterminate',
|
830 | MIXEDMARK: 'mdc-checkbox__mixedmark',
|
831 | NATIVE_CONTROL: 'mdc-checkbox__native-control',
|
832 | ROOT: 'mdc-checkbox',
|
833 | SELECTED: 'mdc-checkbox--selected',
|
834 | UPGRADED: 'mdc-checkbox--upgraded'
|
835 | };
|
836 | exports.strings = {
|
837 | ARIA_CHECKED_ATTR: 'aria-checked',
|
838 | ARIA_CHECKED_INDETERMINATE_VALUE: 'mixed',
|
839 | DATA_INDETERMINATE_ATTR: 'data-indeterminate',
|
840 | NATIVE_CONTROL_SELECTOR: '.mdc-checkbox__native-control',
|
841 | TRANSITION_STATE_CHECKED: 'checked',
|
842 | TRANSITION_STATE_INDETERMINATE: 'indeterminate',
|
843 | TRANSITION_STATE_INIT: 'init',
|
844 | TRANSITION_STATE_UNCHECKED: 'unchecked'
|
845 | };
|
846 | exports.numbers = {
|
847 | ANIM_END_LATCH_MS: 250
|
848 | };
|
849 |
|
850 | }),
|
851 |
|
852 | "./packages/mdc-checkbox/foundation.ts":
|
853 |
|
854 |
|
855 |
|
856 |
|
857 | (function(module, exports, __webpack_require__) {
|
858 |
|
859 | "use strict";
|
860 |
|
861 |
|
862 |
|
863 |
|
864 |
|
865 |
|
866 |
|
867 |
|
868 |
|
869 |
|
870 |
|
871 |
|
872 |
|
873 |
|
874 |
|
875 |
|
876 |
|
877 |
|
878 |
|
879 |
|
880 |
|
881 |
|
882 |
|
883 |
|
884 | var __extends = this && this.__extends || function () {
|
885 | var _extendStatics = function extendStatics(d, b) {
|
886 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
887 | d.__proto__ = b;
|
888 | } || function (d, b) {
|
889 | for (var p in b) {
|
890 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
891 | }
|
892 | };
|
893 | return _extendStatics(d, b);
|
894 | };
|
895 | return function (d, b) {
|
896 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
897 | _extendStatics(d, b);
|
898 | function __() {
|
899 | this.constructor = d;
|
900 | }
|
901 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
902 | };
|
903 | }();
|
904 | var __assign = this && this.__assign || function () {
|
905 | __assign = Object.assign || function (t) {
|
906 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
907 | s = arguments[i];
|
908 | for (var p in s) {
|
909 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
910 | }
|
911 | }
|
912 | return t;
|
913 | };
|
914 | return __assign.apply(this, arguments);
|
915 | };
|
916 | Object.defineProperty(exports, "__esModule", { value: true });
|
917 | exports.MDCCheckboxFoundation = void 0;
|
918 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
919 | var constants_1 = __webpack_require__( "./packages/mdc-checkbox/constants.ts");
|
920 | var MDCCheckboxFoundation = function (_super) {
|
921 | __extends(MDCCheckboxFoundation, _super);
|
922 | function MDCCheckboxFoundation(adapter) {
|
923 | var _this = _super.call(this, __assign(__assign({}, MDCCheckboxFoundation.defaultAdapter), adapter)) || this;
|
924 | _this.currentCheckState = constants_1.strings.TRANSITION_STATE_INIT;
|
925 | _this.currentAnimationClass = '';
|
926 | _this.animEndLatchTimer = 0;
|
927 | _this.enableAnimationEndHandler = false;
|
928 | return _this;
|
929 | }
|
930 | Object.defineProperty(MDCCheckboxFoundation, "cssClasses", {
|
931 | get: function get() {
|
932 | return constants_1.cssClasses;
|
933 | },
|
934 | enumerable: false,
|
935 | configurable: true
|
936 | });
|
937 | Object.defineProperty(MDCCheckboxFoundation, "strings", {
|
938 | get: function get() {
|
939 | return constants_1.strings;
|
940 | },
|
941 | enumerable: false,
|
942 | configurable: true
|
943 | });
|
944 | Object.defineProperty(MDCCheckboxFoundation, "numbers", {
|
945 | get: function get() {
|
946 | return constants_1.numbers;
|
947 | },
|
948 | enumerable: false,
|
949 | configurable: true
|
950 | });
|
951 | Object.defineProperty(MDCCheckboxFoundation, "defaultAdapter", {
|
952 | get: function get() {
|
953 | return {
|
954 | addClass: function addClass() {
|
955 | return undefined;
|
956 | },
|
957 | forceLayout: function forceLayout() {
|
958 | return undefined;
|
959 | },
|
960 | hasNativeControl: function hasNativeControl() {
|
961 | return false;
|
962 | },
|
963 | isAttachedToDOM: function isAttachedToDOM() {
|
964 | return false;
|
965 | },
|
966 | isChecked: function isChecked() {
|
967 | return false;
|
968 | },
|
969 | isIndeterminate: function isIndeterminate() {
|
970 | return false;
|
971 | },
|
972 | removeClass: function removeClass() {
|
973 | return undefined;
|
974 | },
|
975 | removeNativeControlAttr: function removeNativeControlAttr() {
|
976 | return undefined;
|
977 | },
|
978 | setNativeControlAttr: function setNativeControlAttr() {
|
979 | return undefined;
|
980 | },
|
981 | setNativeControlDisabled: function setNativeControlDisabled() {
|
982 | return undefined;
|
983 | }
|
984 | };
|
985 | },
|
986 | enumerable: false,
|
987 | configurable: true
|
988 | });
|
989 | MDCCheckboxFoundation.prototype.init = function () {
|
990 | this.currentCheckState = this.determineCheckState();
|
991 | this.updateAriaChecked();
|
992 | this.adapter.addClass(constants_1.cssClasses.UPGRADED);
|
993 | };
|
994 | MDCCheckboxFoundation.prototype.destroy = function () {
|
995 | clearTimeout(this.animEndLatchTimer);
|
996 | };
|
997 | MDCCheckboxFoundation.prototype.setDisabled = function (disabled) {
|
998 | this.adapter.setNativeControlDisabled(disabled);
|
999 | if (disabled) {
|
1000 | this.adapter.addClass(constants_1.cssClasses.DISABLED);
|
1001 | } else {
|
1002 | this.adapter.removeClass(constants_1.cssClasses.DISABLED);
|
1003 | }
|
1004 | };
|
1005 | |
1006 |
|
1007 |
|
1008 | MDCCheckboxFoundation.prototype.handleAnimationEnd = function () {
|
1009 | var _this = this;
|
1010 | if (!this.enableAnimationEndHandler) {
|
1011 | return;
|
1012 | }
|
1013 | clearTimeout(this.animEndLatchTimer);
|
1014 | this.animEndLatchTimer = setTimeout(function () {
|
1015 | _this.adapter.removeClass(_this.currentAnimationClass);
|
1016 | _this.enableAnimationEndHandler = false;
|
1017 | }, constants_1.numbers.ANIM_END_LATCH_MS);
|
1018 | };
|
1019 | |
1020 |
|
1021 |
|
1022 | MDCCheckboxFoundation.prototype.handleChange = function () {
|
1023 | this.transitionCheckState();
|
1024 | };
|
1025 | MDCCheckboxFoundation.prototype.transitionCheckState = function () {
|
1026 | if (!this.adapter.hasNativeControl()) {
|
1027 | return;
|
1028 | }
|
1029 | var oldState = this.currentCheckState;
|
1030 | var newState = this.determineCheckState();
|
1031 | if (oldState === newState) {
|
1032 | return;
|
1033 | }
|
1034 | this.updateAriaChecked();
|
1035 | var TRANSITION_STATE_UNCHECKED = constants_1.strings.TRANSITION_STATE_UNCHECKED;
|
1036 | var SELECTED = constants_1.cssClasses.SELECTED;
|
1037 | if (newState === TRANSITION_STATE_UNCHECKED) {
|
1038 | this.adapter.removeClass(SELECTED);
|
1039 | } else {
|
1040 | this.adapter.addClass(SELECTED);
|
1041 | }
|
1042 |
|
1043 |
|
1044 | if (this.currentAnimationClass.length > 0) {
|
1045 | clearTimeout(this.animEndLatchTimer);
|
1046 | this.adapter.forceLayout();
|
1047 | this.adapter.removeClass(this.currentAnimationClass);
|
1048 | }
|
1049 | this.currentAnimationClass = this.getTransitionAnimationClass(oldState, newState);
|
1050 | this.currentCheckState = newState;
|
1051 |
|
1052 |
|
1053 | if (this.adapter.isAttachedToDOM() && this.currentAnimationClass.length > 0) {
|
1054 | this.adapter.addClass(this.currentAnimationClass);
|
1055 | this.enableAnimationEndHandler = true;
|
1056 | }
|
1057 | };
|
1058 | MDCCheckboxFoundation.prototype.determineCheckState = function () {
|
1059 | var TRANSITION_STATE_INDETERMINATE = constants_1.strings.TRANSITION_STATE_INDETERMINATE,
|
1060 | TRANSITION_STATE_CHECKED = constants_1.strings.TRANSITION_STATE_CHECKED,
|
1061 | TRANSITION_STATE_UNCHECKED = constants_1.strings.TRANSITION_STATE_UNCHECKED;
|
1062 | if (this.adapter.isIndeterminate()) {
|
1063 | return TRANSITION_STATE_INDETERMINATE;
|
1064 | }
|
1065 | return this.adapter.isChecked() ? TRANSITION_STATE_CHECKED : TRANSITION_STATE_UNCHECKED;
|
1066 | };
|
1067 | MDCCheckboxFoundation.prototype.getTransitionAnimationClass = function (oldState, newState) {
|
1068 | var TRANSITION_STATE_INIT = constants_1.strings.TRANSITION_STATE_INIT,
|
1069 | TRANSITION_STATE_CHECKED = constants_1.strings.TRANSITION_STATE_CHECKED,
|
1070 | TRANSITION_STATE_UNCHECKED = constants_1.strings.TRANSITION_STATE_UNCHECKED;
|
1071 | var _a = MDCCheckboxFoundation.cssClasses,
|
1072 | ANIM_UNCHECKED_CHECKED = _a.ANIM_UNCHECKED_CHECKED,
|
1073 | ANIM_UNCHECKED_INDETERMINATE = _a.ANIM_UNCHECKED_INDETERMINATE,
|
1074 | ANIM_CHECKED_UNCHECKED = _a.ANIM_CHECKED_UNCHECKED,
|
1075 | ANIM_CHECKED_INDETERMINATE = _a.ANIM_CHECKED_INDETERMINATE,
|
1076 | ANIM_INDETERMINATE_CHECKED = _a.ANIM_INDETERMINATE_CHECKED,
|
1077 | ANIM_INDETERMINATE_UNCHECKED = _a.ANIM_INDETERMINATE_UNCHECKED;
|
1078 | switch (oldState) {
|
1079 | case TRANSITION_STATE_INIT:
|
1080 | if (newState === TRANSITION_STATE_UNCHECKED) {
|
1081 | return '';
|
1082 | }
|
1083 | return newState === TRANSITION_STATE_CHECKED ? ANIM_INDETERMINATE_CHECKED : ANIM_INDETERMINATE_UNCHECKED;
|
1084 | case TRANSITION_STATE_UNCHECKED:
|
1085 | return newState === TRANSITION_STATE_CHECKED ? ANIM_UNCHECKED_CHECKED : ANIM_UNCHECKED_INDETERMINATE;
|
1086 | case TRANSITION_STATE_CHECKED:
|
1087 | return newState === TRANSITION_STATE_UNCHECKED ? ANIM_CHECKED_UNCHECKED : ANIM_CHECKED_INDETERMINATE;
|
1088 | default:
|
1089 |
|
1090 | return newState === TRANSITION_STATE_CHECKED ? ANIM_INDETERMINATE_CHECKED : ANIM_INDETERMINATE_UNCHECKED;
|
1091 | }
|
1092 | };
|
1093 | MDCCheckboxFoundation.prototype.updateAriaChecked = function () {
|
1094 |
|
1095 | if (this.adapter.isIndeterminate()) {
|
1096 | this.adapter.setNativeControlAttr(constants_1.strings.ARIA_CHECKED_ATTR, constants_1.strings.ARIA_CHECKED_INDETERMINATE_VALUE);
|
1097 | } else {
|
1098 |
|
1099 |
|
1100 | this.adapter.removeNativeControlAttr(constants_1.strings.ARIA_CHECKED_ATTR);
|
1101 | }
|
1102 | };
|
1103 | return MDCCheckboxFoundation;
|
1104 | }(foundation_1.MDCFoundation);
|
1105 | exports.MDCCheckboxFoundation = MDCCheckboxFoundation;
|
1106 |
|
1107 | exports.default = MDCCheckboxFoundation;
|
1108 |
|
1109 | }),
|
1110 |
|
1111 | "./packages/mdc-checkbox/index.ts":
|
1112 |
|
1113 |
|
1114 |
|
1115 |
|
1116 | (function(module, exports, __webpack_require__) {
|
1117 |
|
1118 | "use strict";
|
1119 |
|
1120 |
|
1121 |
|
1122 |
|
1123 |
|
1124 |
|
1125 |
|
1126 |
|
1127 |
|
1128 |
|
1129 |
|
1130 |
|
1131 |
|
1132 |
|
1133 |
|
1134 |
|
1135 |
|
1136 |
|
1137 |
|
1138 |
|
1139 |
|
1140 |
|
1141 |
|
1142 |
|
1143 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
1144 | if (k2 === undefined) k2 = k;
|
1145 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
1146 | return m[k];
|
1147 | } });
|
1148 | } : function (o, m, k, k2) {
|
1149 | if (k2 === undefined) k2 = k;
|
1150 | o[k2] = m[k];
|
1151 | });
|
1152 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
1153 | for (var p in m) {
|
1154 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
1155 | }
|
1156 | };
|
1157 | Object.defineProperty(exports, "__esModule", { value: true });
|
1158 | __exportStar(__webpack_require__( "./packages/mdc-checkbox/adapter.ts"), exports);
|
1159 | __exportStar(__webpack_require__( "./packages/mdc-checkbox/component.ts"), exports);
|
1160 | __exportStar(__webpack_require__( "./packages/mdc-checkbox/constants.ts"), exports);
|
1161 | __exportStar(__webpack_require__( "./packages/mdc-checkbox/foundation.ts"), exports);
|
1162 |
|
1163 | }),
|
1164 |
|
1165 | "./packages/mdc-dom/events.ts":
|
1166 |
|
1167 |
|
1168 |
|
1169 |
|
1170 | (function(module, exports, __webpack_require__) {
|
1171 |
|
1172 | "use strict";
|
1173 |
|
1174 |
|
1175 |
|
1176 |
|
1177 |
|
1178 |
|
1179 |
|
1180 |
|
1181 |
|
1182 |
|
1183 |
|
1184 |
|
1185 |
|
1186 |
|
1187 |
|
1188 |
|
1189 |
|
1190 |
|
1191 |
|
1192 |
|
1193 |
|
1194 |
|
1195 |
|
1196 |
|
1197 | Object.defineProperty(exports, "__esModule", { value: true });
|
1198 | exports.applyPassive = void 0;
|
1199 |
|
1200 |
|
1201 |
|
1202 |
|
1203 | function applyPassive(globalObj) {
|
1204 | if (globalObj === void 0) {
|
1205 | globalObj = window;
|
1206 | }
|
1207 | return supportsPassiveOption(globalObj) ? { passive: true } : false;
|
1208 | }
|
1209 | exports.applyPassive = applyPassive;
|
1210 | function supportsPassiveOption(globalObj) {
|
1211 | if (globalObj === void 0) {
|
1212 | globalObj = window;
|
1213 | }
|
1214 |
|
1215 |
|
1216 | var passiveSupported = false;
|
1217 | try {
|
1218 | var options = {
|
1219 |
|
1220 |
|
1221 | get passive() {
|
1222 | passiveSupported = true;
|
1223 | return false;
|
1224 | }
|
1225 | };
|
1226 | var handler = function handler() {};
|
1227 | globalObj.document.addEventListener('test', handler, options);
|
1228 | globalObj.document.removeEventListener('test', handler, options);
|
1229 | } catch (err) {
|
1230 | passiveSupported = false;
|
1231 | }
|
1232 | return passiveSupported;
|
1233 | }
|
1234 |
|
1235 | }),
|
1236 |
|
1237 | "./packages/mdc-dom/ponyfill.ts":
|
1238 |
|
1239 |
|
1240 |
|
1241 |
|
1242 | (function(module, exports, __webpack_require__) {
|
1243 |
|
1244 | "use strict";
|
1245 |
|
1246 |
|
1247 |
|
1248 |
|
1249 |
|
1250 |
|
1251 |
|
1252 |
|
1253 |
|
1254 |
|
1255 |
|
1256 |
|
1257 |
|
1258 |
|
1259 |
|
1260 |
|
1261 |
|
1262 |
|
1263 |
|
1264 |
|
1265 |
|
1266 |
|
1267 |
|
1268 |
|
1269 | Object.defineProperty(exports, "__esModule", { value: true });
|
1270 | exports.estimateScrollWidth = exports.matches = exports.closest = void 0;
|
1271 |
|
1272 |
|
1273 |
|
1274 |
|
1275 | function closest(element, selector) {
|
1276 | if (element.closest) {
|
1277 | return element.closest(selector);
|
1278 | }
|
1279 | var el = element;
|
1280 | while (el) {
|
1281 | if (matches(el, selector)) {
|
1282 | return el;
|
1283 | }
|
1284 | el = el.parentElement;
|
1285 | }
|
1286 | return null;
|
1287 | }
|
1288 | exports.closest = closest;
|
1289 | function matches(element, selector) {
|
1290 | var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector;
|
1291 | return nativeMatches.call(element, selector);
|
1292 | }
|
1293 | exports.matches = matches;
|
1294 |
|
1295 |
|
1296 |
|
1297 |
|
1298 |
|
1299 |
|
1300 |
|
1301 |
|
1302 | function estimateScrollWidth(element) {
|
1303 |
|
1304 |
|
1305 |
|
1306 |
|
1307 | var htmlEl = element;
|
1308 | if (htmlEl.offsetParent !== null) {
|
1309 | return htmlEl.scrollWidth;
|
1310 | }
|
1311 | var clone = htmlEl.cloneNode(true);
|
1312 | clone.style.setProperty('position', 'absolute');
|
1313 | clone.style.setProperty('transform', 'translate(-9999px, -9999px)');
|
1314 | document.documentElement.appendChild(clone);
|
1315 | var scrollWidth = clone.scrollWidth;
|
1316 | document.documentElement.removeChild(clone);
|
1317 | return scrollWidth;
|
1318 | }
|
1319 | exports.estimateScrollWidth = estimateScrollWidth;
|
1320 |
|
1321 | }),
|
1322 |
|
1323 | "./packages/mdc-ripple/component.ts":
|
1324 |
|
1325 |
|
1326 |
|
1327 |
|
1328 | (function(module, exports, __webpack_require__) {
|
1329 |
|
1330 | "use strict";
|
1331 |
|
1332 |
|
1333 |
|
1334 |
|
1335 |
|
1336 |
|
1337 |
|
1338 |
|
1339 |
|
1340 |
|
1341 |
|
1342 |
|
1343 |
|
1344 |
|
1345 |
|
1346 |
|
1347 |
|
1348 |
|
1349 |
|
1350 |
|
1351 |
|
1352 |
|
1353 |
|
1354 |
|
1355 | var __extends = this && this.__extends || function () {
|
1356 | var _extendStatics = function extendStatics(d, b) {
|
1357 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
1358 | d.__proto__ = b;
|
1359 | } || function (d, b) {
|
1360 | for (var p in b) {
|
1361 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
1362 | }
|
1363 | };
|
1364 | return _extendStatics(d, b);
|
1365 | };
|
1366 | return function (d, b) {
|
1367 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
1368 | _extendStatics(d, b);
|
1369 | function __() {
|
1370 | this.constructor = d;
|
1371 | }
|
1372 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
1373 | };
|
1374 | }();
|
1375 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
1376 | if (k2 === undefined) k2 = k;
|
1377 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
1378 | return m[k];
|
1379 | } });
|
1380 | } : function (o, m, k, k2) {
|
1381 | if (k2 === undefined) k2 = k;
|
1382 | o[k2] = m[k];
|
1383 | });
|
1384 | var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
1385 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
1386 | } : function (o, v) {
|
1387 | o["default"] = v;
|
1388 | });
|
1389 | var __importStar = this && this.__importStar || function (mod) {
|
1390 | if (mod && mod.__esModule) return mod;
|
1391 | var result = {};
|
1392 | if (mod != null) for (var k in mod) {
|
1393 | if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
1394 | }__setModuleDefault(result, mod);
|
1395 | return result;
|
1396 | };
|
1397 | Object.defineProperty(exports, "__esModule", { value: true });
|
1398 | exports.MDCRipple = void 0;
|
1399 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
1400 | var events_1 = __webpack_require__( "./packages/mdc-dom/events.ts");
|
1401 | var ponyfill_1 = __webpack_require__( "./packages/mdc-dom/ponyfill.ts");
|
1402 | var foundation_1 = __webpack_require__( "./packages/mdc-ripple/foundation.ts");
|
1403 | var util = __importStar(__webpack_require__( "./packages/mdc-ripple/util.ts"));
|
1404 | var MDCRipple = function (_super) {
|
1405 | __extends(MDCRipple, _super);
|
1406 | function MDCRipple() {
|
1407 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
1408 | _this.disabled = false;
|
1409 | return _this;
|
1410 | }
|
1411 | MDCRipple.attachTo = function (root, opts) {
|
1412 | if (opts === void 0) {
|
1413 | opts = {
|
1414 | isUnbounded: undefined
|
1415 | };
|
1416 | }
|
1417 | var ripple = new MDCRipple(root);
|
1418 |
|
1419 | if (opts.isUnbounded !== undefined) {
|
1420 | ripple.unbounded = opts.isUnbounded;
|
1421 | }
|
1422 | return ripple;
|
1423 | };
|
1424 | MDCRipple.createAdapter = function (instance) {
|
1425 | return {
|
1426 | addClass: function addClass(className) {
|
1427 | return instance.root.classList.add(className);
|
1428 | },
|
1429 | browserSupportsCssVars: function browserSupportsCssVars() {
|
1430 | return util.supportsCssVariables(window);
|
1431 | },
|
1432 | computeBoundingRect: function computeBoundingRect() {
|
1433 | return instance.root.getBoundingClientRect();
|
1434 | },
|
1435 | containsEventTarget: function containsEventTarget(target) {
|
1436 | return instance.root.contains(target);
|
1437 | },
|
1438 | deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) {
|
1439 | return document.documentElement.removeEventListener(evtType, handler, events_1.applyPassive());
|
1440 | },
|
1441 | deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
|
1442 | return instance.root.removeEventListener(evtType, handler, events_1.applyPassive());
|
1443 | },
|
1444 | deregisterResizeHandler: function deregisterResizeHandler(handler) {
|
1445 | return window.removeEventListener('resize', handler);
|
1446 | },
|
1447 | getWindowPageOffset: function getWindowPageOffset() {
|
1448 | return { x: window.pageXOffset, y: window.pageYOffset };
|
1449 | },
|
1450 | isSurfaceActive: function isSurfaceActive() {
|
1451 | return ponyfill_1.matches(instance.root, ':active');
|
1452 | },
|
1453 | isSurfaceDisabled: function isSurfaceDisabled() {
|
1454 | return Boolean(instance.disabled);
|
1455 | },
|
1456 | isUnbounded: function isUnbounded() {
|
1457 | return Boolean(instance.unbounded);
|
1458 | },
|
1459 | registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) {
|
1460 | return document.documentElement.addEventListener(evtType, handler, events_1.applyPassive());
|
1461 | },
|
1462 | registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
|
1463 | return instance.root.addEventListener(evtType, handler, events_1.applyPassive());
|
1464 | },
|
1465 | registerResizeHandler: function registerResizeHandler(handler) {
|
1466 | return window.addEventListener('resize', handler);
|
1467 | },
|
1468 | removeClass: function removeClass(className) {
|
1469 | return instance.root.classList.remove(className);
|
1470 | },
|
1471 | updateCssVariable: function updateCssVariable(varName, value) {
|
1472 | return instance.root.style.setProperty(varName, value);
|
1473 | }
|
1474 | };
|
1475 | };
|
1476 | Object.defineProperty(MDCRipple.prototype, "unbounded", {
|
1477 | get: function get() {
|
1478 | return Boolean(this.isUnbounded);
|
1479 | },
|
1480 | set: function set(unbounded) {
|
1481 | this.isUnbounded = Boolean(unbounded);
|
1482 | this.setUnbounded();
|
1483 | },
|
1484 | enumerable: false,
|
1485 | configurable: true
|
1486 | });
|
1487 | MDCRipple.prototype.activate = function () {
|
1488 | this.foundation.activate();
|
1489 | };
|
1490 | MDCRipple.prototype.deactivate = function () {
|
1491 | this.foundation.deactivate();
|
1492 | };
|
1493 | MDCRipple.prototype.layout = function () {
|
1494 | this.foundation.layout();
|
1495 | };
|
1496 | MDCRipple.prototype.getDefaultFoundation = function () {
|
1497 | return new foundation_1.MDCRippleFoundation(MDCRipple.createAdapter(this));
|
1498 | };
|
1499 | MDCRipple.prototype.initialSyncWithDOM = function () {
|
1500 | var root = this.root;
|
1501 | this.isUnbounded = 'mdcRippleIsUnbounded' in root.dataset;
|
1502 | };
|
1503 | |
1504 |
|
1505 |
|
1506 |
|
1507 |
|
1508 |
|
1509 | MDCRipple.prototype.setUnbounded = function () {
|
1510 | this.foundation.setUnbounded(Boolean(this.isUnbounded));
|
1511 | };
|
1512 | return MDCRipple;
|
1513 | }(component_1.MDCComponent);
|
1514 | exports.MDCRipple = MDCRipple;
|
1515 |
|
1516 | }),
|
1517 |
|
1518 | "./packages/mdc-ripple/constants.ts":
|
1519 |
|
1520 |
|
1521 |
|
1522 |
|
1523 | (function(module, exports, __webpack_require__) {
|
1524 |
|
1525 | "use strict";
|
1526 |
|
1527 |
|
1528 |
|
1529 |
|
1530 |
|
1531 |
|
1532 |
|
1533 |
|
1534 |
|
1535 |
|
1536 |
|
1537 |
|
1538 |
|
1539 |
|
1540 |
|
1541 |
|
1542 |
|
1543 |
|
1544 |
|
1545 |
|
1546 |
|
1547 |
|
1548 |
|
1549 |
|
1550 | Object.defineProperty(exports, "__esModule", { value: true });
|
1551 | exports.numbers = exports.strings = exports.cssClasses = void 0;
|
1552 | exports.cssClasses = {
|
1553 |
|
1554 |
|
1555 |
|
1556 | BG_FOCUSED: 'mdc-ripple-upgraded--background-focused',
|
1557 | FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation',
|
1558 | FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation',
|
1559 | ROOT: 'mdc-ripple-upgraded',
|
1560 | UNBOUNDED: 'mdc-ripple-upgraded--unbounded'
|
1561 | };
|
1562 | exports.strings = {
|
1563 | VAR_FG_SCALE: '--mdc-ripple-fg-scale',
|
1564 | VAR_FG_SIZE: '--mdc-ripple-fg-size',
|
1565 | VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end',
|
1566 | VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start',
|
1567 | VAR_LEFT: '--mdc-ripple-left',
|
1568 | VAR_TOP: '--mdc-ripple-top'
|
1569 | };
|
1570 | exports.numbers = {
|
1571 | DEACTIVATION_TIMEOUT_MS: 225,
|
1572 | FG_DEACTIVATION_MS: 150,
|
1573 | INITIAL_ORIGIN_SCALE: 0.6,
|
1574 | PADDING: 10,
|
1575 | TAP_DELAY_MS: 300 };
|
1576 |
|
1577 | }),
|
1578 |
|
1579 | "./packages/mdc-ripple/foundation.ts":
|
1580 |
|
1581 |
|
1582 |
|
1583 |
|
1584 | (function(module, exports, __webpack_require__) {
|
1585 |
|
1586 | "use strict";
|
1587 |
|
1588 |
|
1589 |
|
1590 |
|
1591 |
|
1592 |
|
1593 |
|
1594 |
|
1595 |
|
1596 |
|
1597 |
|
1598 |
|
1599 |
|
1600 |
|
1601 |
|
1602 |
|
1603 |
|
1604 |
|
1605 |
|
1606 |
|
1607 |
|
1608 |
|
1609 |
|
1610 |
|
1611 | var __extends = this && this.__extends || function () {
|
1612 | var _extendStatics = function extendStatics(d, b) {
|
1613 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
1614 | d.__proto__ = b;
|
1615 | } || function (d, b) {
|
1616 | for (var p in b) {
|
1617 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
1618 | }
|
1619 | };
|
1620 | return _extendStatics(d, b);
|
1621 | };
|
1622 | return function (d, b) {
|
1623 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
1624 | _extendStatics(d, b);
|
1625 | function __() {
|
1626 | this.constructor = d;
|
1627 | }
|
1628 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
1629 | };
|
1630 | }();
|
1631 | var __assign = this && this.__assign || function () {
|
1632 | __assign = Object.assign || function (t) {
|
1633 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
1634 | s = arguments[i];
|
1635 | for (var p in s) {
|
1636 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
1637 | }
|
1638 | }
|
1639 | return t;
|
1640 | };
|
1641 | return __assign.apply(this, arguments);
|
1642 | };
|
1643 | var __values = this && this.__values || function (o) {
|
1644 | var s = typeof Symbol === "function" && Symbol.iterator,
|
1645 | m = s && o[s],
|
1646 | i = 0;
|
1647 | if (m) return m.call(o);
|
1648 | if (o && typeof o.length === "number") return {
|
1649 | next: function next() {
|
1650 | if (o && i >= o.length) o = void 0;
|
1651 | return { value: o && o[i++], done: !o };
|
1652 | }
|
1653 | };
|
1654 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
1655 | };
|
1656 | Object.defineProperty(exports, "__esModule", { value: true });
|
1657 | exports.MDCRippleFoundation = void 0;
|
1658 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
1659 | var constants_1 = __webpack_require__( "./packages/mdc-ripple/constants.ts");
|
1660 | var util_1 = __webpack_require__( "./packages/mdc-ripple/util.ts");
|
1661 |
|
1662 | var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown'];
|
1663 |
|
1664 | var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup', 'contextmenu'];
|
1665 |
|
1666 | var activatedTargets = [];
|
1667 | var MDCRippleFoundation = function (_super) {
|
1668 | __extends(MDCRippleFoundation, _super);
|
1669 | function MDCRippleFoundation(adapter) {
|
1670 | var _this = _super.call(this, __assign(__assign({}, MDCRippleFoundation.defaultAdapter), adapter)) || this;
|
1671 | _this.activationAnimationHasEnded = false;
|
1672 | _this.activationTimer = 0;
|
1673 | _this.fgDeactivationRemovalTimer = 0;
|
1674 | _this.fgScale = '0';
|
1675 | _this.frame = { width: 0, height: 0 };
|
1676 | _this.initialSize = 0;
|
1677 | _this.layoutFrame = 0;
|
1678 | _this.maxRadius = 0;
|
1679 | _this.unboundedCoords = { left: 0, top: 0 };
|
1680 | _this.activationState = _this.defaultActivationState();
|
1681 | _this.activationTimerCallback = function () {
|
1682 | _this.activationAnimationHasEnded = true;
|
1683 | _this.runDeactivationUXLogicIfReady();
|
1684 | };
|
1685 | _this.activateHandler = function (e) {
|
1686 | _this.activateImpl(e);
|
1687 | };
|
1688 | _this.deactivateHandler = function () {
|
1689 | _this.deactivateImpl();
|
1690 | };
|
1691 | _this.focusHandler = function () {
|
1692 | _this.handleFocus();
|
1693 | };
|
1694 | _this.blurHandler = function () {
|
1695 | _this.handleBlur();
|
1696 | };
|
1697 | _this.resizeHandler = function () {
|
1698 | _this.layout();
|
1699 | };
|
1700 | return _this;
|
1701 | }
|
1702 | Object.defineProperty(MDCRippleFoundation, "cssClasses", {
|
1703 | get: function get() {
|
1704 | return constants_1.cssClasses;
|
1705 | },
|
1706 | enumerable: false,
|
1707 | configurable: true
|
1708 | });
|
1709 | Object.defineProperty(MDCRippleFoundation, "strings", {
|
1710 | get: function get() {
|
1711 | return constants_1.strings;
|
1712 | },
|
1713 | enumerable: false,
|
1714 | configurable: true
|
1715 | });
|
1716 | Object.defineProperty(MDCRippleFoundation, "numbers", {
|
1717 | get: function get() {
|
1718 | return constants_1.numbers;
|
1719 | },
|
1720 | enumerable: false,
|
1721 | configurable: true
|
1722 | });
|
1723 | Object.defineProperty(MDCRippleFoundation, "defaultAdapter", {
|
1724 | get: function get() {
|
1725 | return {
|
1726 | addClass: function addClass() {
|
1727 | return undefined;
|
1728 | },
|
1729 | browserSupportsCssVars: function browserSupportsCssVars() {
|
1730 | return true;
|
1731 | },
|
1732 | computeBoundingRect: function computeBoundingRect() {
|
1733 | return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
|
1734 | },
|
1735 | containsEventTarget: function containsEventTarget() {
|
1736 | return true;
|
1737 | },
|
1738 | deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() {
|
1739 | return undefined;
|
1740 | },
|
1741 | deregisterInteractionHandler: function deregisterInteractionHandler() {
|
1742 | return undefined;
|
1743 | },
|
1744 | deregisterResizeHandler: function deregisterResizeHandler() {
|
1745 | return undefined;
|
1746 | },
|
1747 | getWindowPageOffset: function getWindowPageOffset() {
|
1748 | return { x: 0, y: 0 };
|
1749 | },
|
1750 | isSurfaceActive: function isSurfaceActive() {
|
1751 | return true;
|
1752 | },
|
1753 | isSurfaceDisabled: function isSurfaceDisabled() {
|
1754 | return true;
|
1755 | },
|
1756 | isUnbounded: function isUnbounded() {
|
1757 | return true;
|
1758 | },
|
1759 | registerDocumentInteractionHandler: function registerDocumentInteractionHandler() {
|
1760 | return undefined;
|
1761 | },
|
1762 | registerInteractionHandler: function registerInteractionHandler() {
|
1763 | return undefined;
|
1764 | },
|
1765 | registerResizeHandler: function registerResizeHandler() {
|
1766 | return undefined;
|
1767 | },
|
1768 | removeClass: function removeClass() {
|
1769 | return undefined;
|
1770 | },
|
1771 | updateCssVariable: function updateCssVariable() {
|
1772 | return undefined;
|
1773 | }
|
1774 | };
|
1775 | },
|
1776 | enumerable: false,
|
1777 | configurable: true
|
1778 | });
|
1779 | MDCRippleFoundation.prototype.init = function () {
|
1780 | var _this = this;
|
1781 | var supportsPressRipple = this.supportsPressRipple();
|
1782 | this.registerRootHandlers(supportsPressRipple);
|
1783 | if (supportsPressRipple) {
|
1784 | var _a = MDCRippleFoundation.cssClasses,
|
1785 | ROOT_1 = _a.ROOT,
|
1786 | UNBOUNDED_1 = _a.UNBOUNDED;
|
1787 | requestAnimationFrame(function () {
|
1788 | _this.adapter.addClass(ROOT_1);
|
1789 | if (_this.adapter.isUnbounded()) {
|
1790 | _this.adapter.addClass(UNBOUNDED_1);
|
1791 |
|
1792 | _this.layoutInternal();
|
1793 | }
|
1794 | });
|
1795 | }
|
1796 | };
|
1797 | MDCRippleFoundation.prototype.destroy = function () {
|
1798 | var _this = this;
|
1799 | if (this.supportsPressRipple()) {
|
1800 | if (this.activationTimer) {
|
1801 | clearTimeout(this.activationTimer);
|
1802 | this.activationTimer = 0;
|
1803 | this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION);
|
1804 | }
|
1805 | if (this.fgDeactivationRemovalTimer) {
|
1806 | clearTimeout(this.fgDeactivationRemovalTimer);
|
1807 | this.fgDeactivationRemovalTimer = 0;
|
1808 | this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION);
|
1809 | }
|
1810 | var _a = MDCRippleFoundation.cssClasses,
|
1811 | ROOT_2 = _a.ROOT,
|
1812 | UNBOUNDED_2 = _a.UNBOUNDED;
|
1813 | requestAnimationFrame(function () {
|
1814 | _this.adapter.removeClass(ROOT_2);
|
1815 | _this.adapter.removeClass(UNBOUNDED_2);
|
1816 | _this.removeCssVars();
|
1817 | });
|
1818 | }
|
1819 | this.deregisterRootHandlers();
|
1820 | this.deregisterDeactivationHandlers();
|
1821 | };
|
1822 | |
1823 |
|
1824 |
|
1825 | MDCRippleFoundation.prototype.activate = function (evt) {
|
1826 | this.activateImpl(evt);
|
1827 | };
|
1828 | MDCRippleFoundation.prototype.deactivate = function () {
|
1829 | this.deactivateImpl();
|
1830 | };
|
1831 | MDCRippleFoundation.prototype.layout = function () {
|
1832 | var _this = this;
|
1833 | if (this.layoutFrame) {
|
1834 | cancelAnimationFrame(this.layoutFrame);
|
1835 | }
|
1836 | this.layoutFrame = requestAnimationFrame(function () {
|
1837 | _this.layoutInternal();
|
1838 | _this.layoutFrame = 0;
|
1839 | });
|
1840 | };
|
1841 | MDCRippleFoundation.prototype.setUnbounded = function (unbounded) {
|
1842 | var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED;
|
1843 | if (unbounded) {
|
1844 | this.adapter.addClass(UNBOUNDED);
|
1845 | } else {
|
1846 | this.adapter.removeClass(UNBOUNDED);
|
1847 | }
|
1848 | };
|
1849 | MDCRippleFoundation.prototype.handleFocus = function () {
|
1850 | var _this = this;
|
1851 | requestAnimationFrame(function () {
|
1852 | return _this.adapter.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
|
1853 | });
|
1854 | };
|
1855 | MDCRippleFoundation.prototype.handleBlur = function () {
|
1856 | var _this = this;
|
1857 | requestAnimationFrame(function () {
|
1858 | return _this.adapter.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
|
1859 | });
|
1860 | };
|
1861 | |
1862 |
|
1863 |
|
1864 |
|
1865 |
|
1866 |
|
1867 | MDCRippleFoundation.prototype.supportsPressRipple = function () {
|
1868 | return this.adapter.browserSupportsCssVars();
|
1869 | };
|
1870 | MDCRippleFoundation.prototype.defaultActivationState = function () {
|
1871 | return {
|
1872 | activationEvent: undefined,
|
1873 | hasDeactivationUXRun: false,
|
1874 | isActivated: false,
|
1875 | isProgrammatic: false,
|
1876 | wasActivatedByPointer: false,
|
1877 | wasElementMadeActive: false
|
1878 | };
|
1879 | };
|
1880 | |
1881 |
|
1882 |
|
1883 | MDCRippleFoundation.prototype.registerRootHandlers = function (supportsPressRipple) {
|
1884 | var e_1, _a;
|
1885 | if (supportsPressRipple) {
|
1886 | try {
|
1887 | for (var ACTIVATION_EVENT_TYPES_1 = __values(ACTIVATION_EVENT_TYPES), ACTIVATION_EVENT_TYPES_1_1 = ACTIVATION_EVENT_TYPES_1.next(); !ACTIVATION_EVENT_TYPES_1_1.done; ACTIVATION_EVENT_TYPES_1_1 = ACTIVATION_EVENT_TYPES_1.next()) {
|
1888 | var evtType = ACTIVATION_EVENT_TYPES_1_1.value;
|
1889 | this.adapter.registerInteractionHandler(evtType, this.activateHandler);
|
1890 | }
|
1891 | } catch (e_1_1) {
|
1892 | e_1 = { error: e_1_1 };
|
1893 | } finally {
|
1894 | try {
|
1895 | if (ACTIVATION_EVENT_TYPES_1_1 && !ACTIVATION_EVENT_TYPES_1_1.done && (_a = ACTIVATION_EVENT_TYPES_1.return)) _a.call(ACTIVATION_EVENT_TYPES_1);
|
1896 | } finally {
|
1897 | if (e_1) throw e_1.error;
|
1898 | }
|
1899 | }
|
1900 | if (this.adapter.isUnbounded()) {
|
1901 | this.adapter.registerResizeHandler(this.resizeHandler);
|
1902 | }
|
1903 | }
|
1904 | this.adapter.registerInteractionHandler('focus', this.focusHandler);
|
1905 | this.adapter.registerInteractionHandler('blur', this.blurHandler);
|
1906 | };
|
1907 | MDCRippleFoundation.prototype.registerDeactivationHandlers = function (evt) {
|
1908 | var e_2, _a;
|
1909 | if (evt.type === 'keydown') {
|
1910 | this.adapter.registerInteractionHandler('keyup', this.deactivateHandler);
|
1911 | } else {
|
1912 | try {
|
1913 | for (var POINTER_DEACTIVATION_EVENT_TYPES_1 = __values(POINTER_DEACTIVATION_EVENT_TYPES), POINTER_DEACTIVATION_EVENT_TYPES_1_1 = POINTER_DEACTIVATION_EVENT_TYPES_1.next(); !POINTER_DEACTIVATION_EVENT_TYPES_1_1.done; POINTER_DEACTIVATION_EVENT_TYPES_1_1 = POINTER_DEACTIVATION_EVENT_TYPES_1.next()) {
|
1914 | var evtType = POINTER_DEACTIVATION_EVENT_TYPES_1_1.value;
|
1915 | this.adapter.registerDocumentInteractionHandler(evtType, this.deactivateHandler);
|
1916 | }
|
1917 | } catch (e_2_1) {
|
1918 | e_2 = { error: e_2_1 };
|
1919 | } finally {
|
1920 | try {
|
1921 | if (POINTER_DEACTIVATION_EVENT_TYPES_1_1 && !POINTER_DEACTIVATION_EVENT_TYPES_1_1.done && (_a = POINTER_DEACTIVATION_EVENT_TYPES_1.return)) _a.call(POINTER_DEACTIVATION_EVENT_TYPES_1);
|
1922 | } finally {
|
1923 | if (e_2) throw e_2.error;
|
1924 | }
|
1925 | }
|
1926 | }
|
1927 | };
|
1928 | MDCRippleFoundation.prototype.deregisterRootHandlers = function () {
|
1929 | var e_3, _a;
|
1930 | try {
|
1931 | for (var ACTIVATION_EVENT_TYPES_2 = __values(ACTIVATION_EVENT_TYPES), ACTIVATION_EVENT_TYPES_2_1 = ACTIVATION_EVENT_TYPES_2.next(); !ACTIVATION_EVENT_TYPES_2_1.done; ACTIVATION_EVENT_TYPES_2_1 = ACTIVATION_EVENT_TYPES_2.next()) {
|
1932 | var evtType = ACTIVATION_EVENT_TYPES_2_1.value;
|
1933 | this.adapter.deregisterInteractionHandler(evtType, this.activateHandler);
|
1934 | }
|
1935 | } catch (e_3_1) {
|
1936 | e_3 = { error: e_3_1 };
|
1937 | } finally {
|
1938 | try {
|
1939 | if (ACTIVATION_EVENT_TYPES_2_1 && !ACTIVATION_EVENT_TYPES_2_1.done && (_a = ACTIVATION_EVENT_TYPES_2.return)) _a.call(ACTIVATION_EVENT_TYPES_2);
|
1940 | } finally {
|
1941 | if (e_3) throw e_3.error;
|
1942 | }
|
1943 | }
|
1944 | this.adapter.deregisterInteractionHandler('focus', this.focusHandler);
|
1945 | this.adapter.deregisterInteractionHandler('blur', this.blurHandler);
|
1946 | if (this.adapter.isUnbounded()) {
|
1947 | this.adapter.deregisterResizeHandler(this.resizeHandler);
|
1948 | }
|
1949 | };
|
1950 | MDCRippleFoundation.prototype.deregisterDeactivationHandlers = function () {
|
1951 | var e_4, _a;
|
1952 | this.adapter.deregisterInteractionHandler('keyup', this.deactivateHandler);
|
1953 | try {
|
1954 | for (var POINTER_DEACTIVATION_EVENT_TYPES_2 = __values(POINTER_DEACTIVATION_EVENT_TYPES), POINTER_DEACTIVATION_EVENT_TYPES_2_1 = POINTER_DEACTIVATION_EVENT_TYPES_2.next(); !POINTER_DEACTIVATION_EVENT_TYPES_2_1.done; POINTER_DEACTIVATION_EVENT_TYPES_2_1 = POINTER_DEACTIVATION_EVENT_TYPES_2.next()) {
|
1955 | var evtType = POINTER_DEACTIVATION_EVENT_TYPES_2_1.value;
|
1956 | this.adapter.deregisterDocumentInteractionHandler(evtType, this.deactivateHandler);
|
1957 | }
|
1958 | } catch (e_4_1) {
|
1959 | e_4 = { error: e_4_1 };
|
1960 | } finally {
|
1961 | try {
|
1962 | if (POINTER_DEACTIVATION_EVENT_TYPES_2_1 && !POINTER_DEACTIVATION_EVENT_TYPES_2_1.done && (_a = POINTER_DEACTIVATION_EVENT_TYPES_2.return)) _a.call(POINTER_DEACTIVATION_EVENT_TYPES_2);
|
1963 | } finally {
|
1964 | if (e_4) throw e_4.error;
|
1965 | }
|
1966 | }
|
1967 | };
|
1968 | MDCRippleFoundation.prototype.removeCssVars = function () {
|
1969 | var _this = this;
|
1970 | var rippleStrings = MDCRippleFoundation.strings;
|
1971 | var keys = Object.keys(rippleStrings);
|
1972 | keys.forEach(function (key) {
|
1973 | if (key.indexOf('VAR_') === 0) {
|
1974 | _this.adapter.updateCssVariable(rippleStrings[key], null);
|
1975 | }
|
1976 | });
|
1977 | };
|
1978 | MDCRippleFoundation.prototype.activateImpl = function (evt) {
|
1979 | var _this = this;
|
1980 | if (this.adapter.isSurfaceDisabled()) {
|
1981 | return;
|
1982 | }
|
1983 | var activationState = this.activationState;
|
1984 | if (activationState.isActivated) {
|
1985 | return;
|
1986 | }
|
1987 |
|
1988 | var previousActivationEvent = this.previousActivationEvent;
|
1989 | var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type;
|
1990 | if (isSameInteraction) {
|
1991 | return;
|
1992 | }
|
1993 | activationState.isActivated = true;
|
1994 | activationState.isProgrammatic = evt === undefined;
|
1995 | activationState.activationEvent = evt;
|
1996 | activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown');
|
1997 | var hasActivatedChild = evt !== undefined && activatedTargets.length > 0 && activatedTargets.some(function (target) {
|
1998 | return _this.adapter.containsEventTarget(target);
|
1999 | });
|
2000 | if (hasActivatedChild) {
|
2001 |
|
2002 | this.resetActivationState();
|
2003 | return;
|
2004 | }
|
2005 | if (evt !== undefined) {
|
2006 | activatedTargets.push(evt.target);
|
2007 | this.registerDeactivationHandlers(evt);
|
2008 | }
|
2009 | activationState.wasElementMadeActive = this.checkElementMadeActive(evt);
|
2010 | if (activationState.wasElementMadeActive) {
|
2011 | this.animateActivation();
|
2012 | }
|
2013 | requestAnimationFrame(function () {
|
2014 |
|
2015 | activatedTargets = [];
|
2016 | if (!activationState.wasElementMadeActive && evt !== undefined && (evt.key === ' ' || evt.keyCode === 32)) {
|
2017 |
|
2018 |
|
2019 |
|
2020 |
|
2021 |
|
2022 |
|
2023 | activationState.wasElementMadeActive = _this.checkElementMadeActive(evt);
|
2024 | if (activationState.wasElementMadeActive) {
|
2025 | _this.animateActivation();
|
2026 | }
|
2027 | }
|
2028 | if (!activationState.wasElementMadeActive) {
|
2029 |
|
2030 | _this.activationState = _this.defaultActivationState();
|
2031 | }
|
2032 | });
|
2033 | };
|
2034 | MDCRippleFoundation.prototype.checkElementMadeActive = function (evt) {
|
2035 | return evt !== undefined && evt.type === 'keydown' ? this.adapter.isSurfaceActive() : true;
|
2036 | };
|
2037 | MDCRippleFoundation.prototype.animateActivation = function () {
|
2038 | var _this = this;
|
2039 | var _a = MDCRippleFoundation.strings,
|
2040 | VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START,
|
2041 | VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END;
|
2042 | var _b = MDCRippleFoundation.cssClasses,
|
2043 | FG_DEACTIVATION = _b.FG_DEACTIVATION,
|
2044 | FG_ACTIVATION = _b.FG_ACTIVATION;
|
2045 | var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS;
|
2046 | this.layoutInternal();
|
2047 | var translateStart = '';
|
2048 | var translateEnd = '';
|
2049 | if (!this.adapter.isUnbounded()) {
|
2050 | var _c = this.getFgTranslationCoordinates(),
|
2051 | startPoint = _c.startPoint,
|
2052 | endPoint = _c.endPoint;
|
2053 | translateStart = startPoint.x + "px, " + startPoint.y + "px";
|
2054 | translateEnd = endPoint.x + "px, " + endPoint.y + "px";
|
2055 | }
|
2056 | this.adapter.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart);
|
2057 | this.adapter.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd);
|
2058 |
|
2059 | clearTimeout(this.activationTimer);
|
2060 | clearTimeout(this.fgDeactivationRemovalTimer);
|
2061 | this.rmBoundedActivationClasses();
|
2062 | this.adapter.removeClass(FG_DEACTIVATION);
|
2063 |
|
2064 | this.adapter.computeBoundingRect();
|
2065 | this.adapter.addClass(FG_ACTIVATION);
|
2066 | this.activationTimer = setTimeout(function () {
|
2067 | _this.activationTimerCallback();
|
2068 | }, DEACTIVATION_TIMEOUT_MS);
|
2069 | };
|
2070 | MDCRippleFoundation.prototype.getFgTranslationCoordinates = function () {
|
2071 | var _a = this.activationState,
|
2072 | activationEvent = _a.activationEvent,
|
2073 | wasActivatedByPointer = _a.wasActivatedByPointer;
|
2074 | var startPoint;
|
2075 | if (wasActivatedByPointer) {
|
2076 | startPoint = util_1.getNormalizedEventCoords(activationEvent, this.adapter.getWindowPageOffset(), this.adapter.computeBoundingRect());
|
2077 | } else {
|
2078 | startPoint = {
|
2079 | x: this.frame.width / 2,
|
2080 | y: this.frame.height / 2
|
2081 | };
|
2082 | }
|
2083 |
|
2084 | startPoint = {
|
2085 | x: startPoint.x - this.initialSize / 2,
|
2086 | y: startPoint.y - this.initialSize / 2
|
2087 | };
|
2088 | var endPoint = {
|
2089 | x: this.frame.width / 2 - this.initialSize / 2,
|
2090 | y: this.frame.height / 2 - this.initialSize / 2
|
2091 | };
|
2092 | return { startPoint: startPoint, endPoint: endPoint };
|
2093 | };
|
2094 | MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady = function () {
|
2095 | var _this = this;
|
2096 |
|
2097 |
|
2098 | var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION;
|
2099 | var _a = this.activationState,
|
2100 | hasDeactivationUXRun = _a.hasDeactivationUXRun,
|
2101 | isActivated = _a.isActivated;
|
2102 | var activationHasEnded = hasDeactivationUXRun || !isActivated;
|
2103 | if (activationHasEnded && this.activationAnimationHasEnded) {
|
2104 | this.rmBoundedActivationClasses();
|
2105 | this.adapter.addClass(FG_DEACTIVATION);
|
2106 | this.fgDeactivationRemovalTimer = setTimeout(function () {
|
2107 | _this.adapter.removeClass(FG_DEACTIVATION);
|
2108 | }, constants_1.numbers.FG_DEACTIVATION_MS);
|
2109 | }
|
2110 | };
|
2111 | MDCRippleFoundation.prototype.rmBoundedActivationClasses = function () {
|
2112 | var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION;
|
2113 | this.adapter.removeClass(FG_ACTIVATION);
|
2114 | this.activationAnimationHasEnded = false;
|
2115 | this.adapter.computeBoundingRect();
|
2116 | };
|
2117 | MDCRippleFoundation.prototype.resetActivationState = function () {
|
2118 | var _this = this;
|
2119 | this.previousActivationEvent = this.activationState.activationEvent;
|
2120 | this.activationState = this.defaultActivationState();
|
2121 |
|
2122 |
|
2123 | setTimeout(function () {
|
2124 | return _this.previousActivationEvent = undefined;
|
2125 | }, MDCRippleFoundation.numbers.TAP_DELAY_MS);
|
2126 | };
|
2127 | MDCRippleFoundation.prototype.deactivateImpl = function () {
|
2128 | var _this = this;
|
2129 | var activationState = this.activationState;
|
2130 |
|
2131 | if (!activationState.isActivated) {
|
2132 | return;
|
2133 | }
|
2134 | var state = __assign({}, activationState);
|
2135 | if (activationState.isProgrammatic) {
|
2136 | requestAnimationFrame(function () {
|
2137 | _this.animateDeactivation(state);
|
2138 | });
|
2139 | this.resetActivationState();
|
2140 | } else {
|
2141 | this.deregisterDeactivationHandlers();
|
2142 | requestAnimationFrame(function () {
|
2143 | _this.activationState.hasDeactivationUXRun = true;
|
2144 | _this.animateDeactivation(state);
|
2145 | _this.resetActivationState();
|
2146 | });
|
2147 | }
|
2148 | };
|
2149 | MDCRippleFoundation.prototype.animateDeactivation = function (_a) {
|
2150 | var wasActivatedByPointer = _a.wasActivatedByPointer,
|
2151 | wasElementMadeActive = _a.wasElementMadeActive;
|
2152 | if (wasActivatedByPointer || wasElementMadeActive) {
|
2153 | this.runDeactivationUXLogicIfReady();
|
2154 | }
|
2155 | };
|
2156 | MDCRippleFoundation.prototype.layoutInternal = function () {
|
2157 | var _this = this;
|
2158 | this.frame = this.adapter.computeBoundingRect();
|
2159 | var maxDim = Math.max(this.frame.height, this.frame.width);
|
2160 |
|
2161 |
|
2162 |
|
2163 |
|
2164 |
|
2165 |
|
2166 | var getBoundedRadius = function getBoundedRadius() {
|
2167 | var hypotenuse = Math.sqrt(Math.pow(_this.frame.width, 2) + Math.pow(_this.frame.height, 2));
|
2168 | return hypotenuse + MDCRippleFoundation.numbers.PADDING;
|
2169 | };
|
2170 | this.maxRadius = this.adapter.isUnbounded() ? maxDim : getBoundedRadius();
|
2171 |
|
2172 | var initialSize = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE);
|
2173 |
|
2174 | if (this.adapter.isUnbounded() && initialSize % 2 !== 0) {
|
2175 | this.initialSize = initialSize - 1;
|
2176 | } else {
|
2177 | this.initialSize = initialSize;
|
2178 | }
|
2179 | this.fgScale = "" + this.maxRadius / this.initialSize;
|
2180 | this.updateLayoutCssVars();
|
2181 | };
|
2182 | MDCRippleFoundation.prototype.updateLayoutCssVars = function () {
|
2183 | var _a = MDCRippleFoundation.strings,
|
2184 | VAR_FG_SIZE = _a.VAR_FG_SIZE,
|
2185 | VAR_LEFT = _a.VAR_LEFT,
|
2186 | VAR_TOP = _a.VAR_TOP,
|
2187 | VAR_FG_SCALE = _a.VAR_FG_SCALE;
|
2188 | this.adapter.updateCssVariable(VAR_FG_SIZE, this.initialSize + "px");
|
2189 | this.adapter.updateCssVariable(VAR_FG_SCALE, this.fgScale);
|
2190 | if (this.adapter.isUnbounded()) {
|
2191 | this.unboundedCoords = {
|
2192 | left: Math.round(this.frame.width / 2 - this.initialSize / 2),
|
2193 | top: Math.round(this.frame.height / 2 - this.initialSize / 2)
|
2194 | };
|
2195 | this.adapter.updateCssVariable(VAR_LEFT, this.unboundedCoords.left + "px");
|
2196 | this.adapter.updateCssVariable(VAR_TOP, this.unboundedCoords.top + "px");
|
2197 | }
|
2198 | };
|
2199 | return MDCRippleFoundation;
|
2200 | }(foundation_1.MDCFoundation);
|
2201 | exports.MDCRippleFoundation = MDCRippleFoundation;
|
2202 |
|
2203 | exports.default = MDCRippleFoundation;
|
2204 |
|
2205 | }),
|
2206 |
|
2207 | "./packages/mdc-ripple/util.ts":
|
2208 |
|
2209 |
|
2210 |
|
2211 |
|
2212 | (function(module, exports, __webpack_require__) {
|
2213 |
|
2214 | "use strict";
|
2215 |
|
2216 |
|
2217 | Object.defineProperty(exports, "__esModule", { value: true });
|
2218 | exports.getNormalizedEventCoords = exports.supportsCssVariables = void 0;
|
2219 |
|
2220 |
|
2221 |
|
2222 |
|
2223 | var supportsCssVariables_;
|
2224 | function supportsCssVariables(windowObj, forceRefresh) {
|
2225 | if (forceRefresh === void 0) {
|
2226 | forceRefresh = false;
|
2227 | }
|
2228 | var CSS = windowObj.CSS;
|
2229 | var supportsCssVars = supportsCssVariables_;
|
2230 | if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) {
|
2231 | return supportsCssVariables_;
|
2232 | }
|
2233 | var supportsFunctionPresent = CSS && typeof CSS.supports === 'function';
|
2234 | if (!supportsFunctionPresent) {
|
2235 | return false;
|
2236 | }
|
2237 | var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes');
|
2238 |
|
2239 |
|
2240 | var weAreFeatureDetectingSafari10plus = CSS.supports('(--css-vars: yes)') && CSS.supports('color', '#00000000');
|
2241 | supportsCssVars = explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus;
|
2242 | if (!forceRefresh) {
|
2243 | supportsCssVariables_ = supportsCssVars;
|
2244 | }
|
2245 | return supportsCssVars;
|
2246 | }
|
2247 | exports.supportsCssVariables = supportsCssVariables;
|
2248 | function getNormalizedEventCoords(evt, pageOffset, clientRect) {
|
2249 | if (!evt) {
|
2250 | return { x: 0, y: 0 };
|
2251 | }
|
2252 | var x = pageOffset.x,
|
2253 | y = pageOffset.y;
|
2254 | var documentX = x + clientRect.left;
|
2255 | var documentY = y + clientRect.top;
|
2256 | var normalizedX;
|
2257 | var normalizedY;
|
2258 |
|
2259 | if (evt.type === 'touchstart') {
|
2260 | var touchEvent = evt;
|
2261 | normalizedX = touchEvent.changedTouches[0].pageX - documentX;
|
2262 | normalizedY = touchEvent.changedTouches[0].pageY - documentY;
|
2263 | } else {
|
2264 | var mouseEvent = evt;
|
2265 | normalizedX = mouseEvent.pageX - documentX;
|
2266 | normalizedY = mouseEvent.pageY - documentY;
|
2267 | }
|
2268 | return { x: normalizedX, y: normalizedY };
|
2269 | }
|
2270 | exports.getNormalizedEventCoords = getNormalizedEventCoords;
|
2271 |
|
2272 | })
|
2273 |
|
2274 | });
|
2275 | });
|
2276 |
|
\ | No newline at end of file |