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/switch", [], factory);
|
13 | else if(typeof exports === 'object')
|
14 | exports["switch"] = factory();
|
15 | else
|
16 | root["mdc"] = root["mdc"] || {}, root["mdc"]["switch"] = 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-switch/index.ts");
|
102 | })
|
103 |
|
104 | ({
|
105 |
|
106 | "./packages/mdc-base/component.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 | var __read = this && this.__read || function (o, n) {
|
139 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
140 | if (!m) return o;
|
141 | var i = m.call(o),
|
142 | r,
|
143 | ar = [],
|
144 | e;
|
145 | try {
|
146 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
147 | ar.push(r.value);
|
148 | }
|
149 | } catch (error) {
|
150 | e = { error: error };
|
151 | } finally {
|
152 | try {
|
153 | if (r && !r.done && (m = i["return"])) m.call(i);
|
154 | } finally {
|
155 | if (e) throw e.error;
|
156 | }
|
157 | }
|
158 | return ar;
|
159 | };
|
160 | var __spreadArray = this && this.__spreadArray || function (to, from) {
|
161 | for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) {
|
162 | to[j] = from[i];
|
163 | }return to;
|
164 | };
|
165 | Object.defineProperty(exports, "__esModule", { value: true });
|
166 | exports.MDCComponent = void 0;
|
167 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
168 | var MDCComponent = function () {
|
169 | function MDCComponent(root, foundation) {
|
170 | var args = [];
|
171 | for (var _i = 2; _i < arguments.length; _i++) {
|
172 | args[_i - 2] = arguments[_i];
|
173 | }
|
174 | this.root = root;
|
175 | this.initialize.apply(this, __spreadArray([], __read(args)));
|
176 |
|
177 |
|
178 |
|
179 | this.foundation = foundation === undefined ? this.getDefaultFoundation() : foundation;
|
180 | this.foundation.init();
|
181 | this.initialSyncWithDOM();
|
182 | }
|
183 | MDCComponent.attachTo = function (root) {
|
184 |
|
185 |
|
186 |
|
187 |
|
188 | return new MDCComponent(root, new foundation_1.MDCFoundation({}));
|
189 | };
|
190 |
|
191 | MDCComponent.prototype.initialize = function () {
|
192 | var _args = [];
|
193 | for (var _i = 0; _i < arguments.length; _i++) {
|
194 | _args[_i] = arguments[_i];
|
195 | }
|
196 |
|
197 |
|
198 |
|
199 | };
|
200 | MDCComponent.prototype.getDefaultFoundation = function () {
|
201 |
|
202 |
|
203 | throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class');
|
204 | };
|
205 | MDCComponent.prototype.initialSyncWithDOM = function () {
|
206 |
|
207 |
|
208 |
|
209 |
|
210 | };
|
211 | MDCComponent.prototype.destroy = function () {
|
212 |
|
213 |
|
214 | this.foundation.destroy();
|
215 | };
|
216 | MDCComponent.prototype.listen = function (evtType, handler, options) {
|
217 | this.root.addEventListener(evtType, handler, options);
|
218 | };
|
219 | MDCComponent.prototype.unlisten = function (evtType, handler, options) {
|
220 | this.root.removeEventListener(evtType, handler, options);
|
221 | };
|
222 | |
223 |
|
224 |
|
225 | MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) {
|
226 | if (shouldBubble === void 0) {
|
227 | shouldBubble = false;
|
228 | }
|
229 | var evt;
|
230 | if (typeof CustomEvent === 'function') {
|
231 | evt = new CustomEvent(evtType, {
|
232 | bubbles: shouldBubble,
|
233 | detail: evtData
|
234 | });
|
235 | } else {
|
236 | evt = document.createEvent('CustomEvent');
|
237 | evt.initCustomEvent(evtType, shouldBubble, false, evtData);
|
238 | }
|
239 | this.root.dispatchEvent(evt);
|
240 | };
|
241 | return MDCComponent;
|
242 | }();
|
243 | exports.MDCComponent = MDCComponent;
|
244 |
|
245 | exports.default = MDCComponent;
|
246 |
|
247 | }),
|
248 |
|
249 | "./packages/mdc-base/foundation.ts":
|
250 |
|
251 |
|
252 |
|
253 |
|
254 | (function(module, exports, __webpack_require__) {
|
255 |
|
256 | "use strict";
|
257 |
|
258 |
|
259 |
|
260 |
|
261 |
|
262 |
|
263 |
|
264 |
|
265 |
|
266 |
|
267 |
|
268 |
|
269 |
|
270 |
|
271 |
|
272 |
|
273 |
|
274 |
|
275 |
|
276 |
|
277 |
|
278 |
|
279 |
|
280 |
|
281 | Object.defineProperty(exports, "__esModule", { value: true });
|
282 | exports.MDCFoundation = void 0;
|
283 | var MDCFoundation = function () {
|
284 | function MDCFoundation(adapter) {
|
285 | if (adapter === void 0) {
|
286 | adapter = {};
|
287 | }
|
288 | this.adapter = adapter;
|
289 | }
|
290 | Object.defineProperty(MDCFoundation, "cssClasses", {
|
291 | get: function get() {
|
292 |
|
293 |
|
294 | return {};
|
295 | },
|
296 | enumerable: false,
|
297 | configurable: true
|
298 | });
|
299 | Object.defineProperty(MDCFoundation, "strings", {
|
300 | get: function get() {
|
301 |
|
302 |
|
303 | return {};
|
304 | },
|
305 | enumerable: false,
|
306 | configurable: true
|
307 | });
|
308 | Object.defineProperty(MDCFoundation, "numbers", {
|
309 | get: function get() {
|
310 |
|
311 |
|
312 | return {};
|
313 | },
|
314 | enumerable: false,
|
315 | configurable: true
|
316 | });
|
317 | Object.defineProperty(MDCFoundation, "defaultAdapter", {
|
318 | get: function get() {
|
319 |
|
320 |
|
321 |
|
322 | return {};
|
323 | },
|
324 | enumerable: false,
|
325 | configurable: true
|
326 | });
|
327 | MDCFoundation.prototype.init = function () {
|
328 |
|
329 | };
|
330 | MDCFoundation.prototype.destroy = function () {
|
331 |
|
332 | };
|
333 | return MDCFoundation;
|
334 | }();
|
335 | exports.MDCFoundation = MDCFoundation;
|
336 |
|
337 | exports.default = MDCFoundation;
|
338 |
|
339 | }),
|
340 |
|
341 | "./packages/mdc-base/observer-foundation.ts":
|
342 |
|
343 |
|
344 |
|
345 |
|
346 | (function(module, exports, __webpack_require__) {
|
347 |
|
348 | "use strict";
|
349 |
|
350 |
|
351 |
|
352 |
|
353 |
|
354 |
|
355 |
|
356 |
|
357 |
|
358 |
|
359 |
|
360 |
|
361 |
|
362 |
|
363 |
|
364 |
|
365 |
|
366 |
|
367 |
|
368 |
|
369 |
|
370 |
|
371 |
|
372 |
|
373 | var __extends = this && this.__extends || function () {
|
374 | var _extendStatics = function extendStatics(d, b) {
|
375 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
376 | d.__proto__ = b;
|
377 | } || function (d, b) {
|
378 | for (var p in b) {
|
379 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
380 | }
|
381 | };
|
382 | return _extendStatics(d, b);
|
383 | };
|
384 | return function (d, b) {
|
385 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
386 | _extendStatics(d, b);
|
387 | function __() {
|
388 | this.constructor = d;
|
389 | }
|
390 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
391 | };
|
392 | }();
|
393 | var __values = this && this.__values || function (o) {
|
394 | var s = typeof Symbol === "function" && Symbol.iterator,
|
395 | m = s && o[s],
|
396 | i = 0;
|
397 | if (m) return m.call(o);
|
398 | if (o && typeof o.length === "number") return {
|
399 | next: function next() {
|
400 | if (o && i >= o.length) o = void 0;
|
401 | return { value: o && o[i++], done: !o };
|
402 | }
|
403 | };
|
404 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
405 | };
|
406 | var __read = this && this.__read || function (o, n) {
|
407 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
408 | if (!m) return o;
|
409 | var i = m.call(o),
|
410 | r,
|
411 | ar = [],
|
412 | e;
|
413 | try {
|
414 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
415 | ar.push(r.value);
|
416 | }
|
417 | } catch (error) {
|
418 | e = { error: error };
|
419 | } finally {
|
420 | try {
|
421 | if (r && !r.done && (m = i["return"])) m.call(i);
|
422 | } finally {
|
423 | if (e) throw e.error;
|
424 | }
|
425 | }
|
426 | return ar;
|
427 | };
|
428 | var __spreadArray = this && this.__spreadArray || function (to, from) {
|
429 | for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) {
|
430 | to[j] = from[i];
|
431 | }return to;
|
432 | };
|
433 | Object.defineProperty(exports, "__esModule", { value: true });
|
434 | exports.MDCObserverFoundation = void 0;
|
435 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
436 | var observer_1 = __webpack_require__( "./packages/mdc-base/observer.ts");
|
437 | var MDCObserverFoundation = function (_super) {
|
438 | __extends(MDCObserverFoundation, _super);
|
439 | function MDCObserverFoundation(adapter) {
|
440 | var _this = _super.call(this, adapter) || this;
|
441 |
|
442 | _this.unobserves = new Set();
|
443 | return _this;
|
444 | }
|
445 | MDCObserverFoundation.prototype.destroy = function () {
|
446 | _super.prototype.destroy.call(this);
|
447 | this.unobserve();
|
448 | };
|
449 | |
450 |
|
451 |
|
452 |
|
453 |
|
454 |
|
455 |
|
456 |
|
457 |
|
458 |
|
459 |
|
460 |
|
461 | MDCObserverFoundation.prototype.observe = function (target, observers) {
|
462 | var e_1, _a;
|
463 | var _this = this;
|
464 | var cleanup = [];
|
465 | try {
|
466 | for (var _b = __values(Object.keys(observers)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
467 | var property = _c.value;
|
468 | var observer = observers[property].bind(this);
|
469 | cleanup.push(this.observeProperty(target, property, observer));
|
470 | }
|
471 | } catch (e_1_1) {
|
472 | e_1 = { error: e_1_1 };
|
473 | } finally {
|
474 | try {
|
475 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
476 | } finally {
|
477 | if (e_1) throw e_1.error;
|
478 | }
|
479 | }
|
480 | var unobserve = function unobserve() {
|
481 | var e_2, _a;
|
482 | try {
|
483 | for (var cleanup_1 = __values(cleanup), cleanup_1_1 = cleanup_1.next(); !cleanup_1_1.done; cleanup_1_1 = cleanup_1.next()) {
|
484 | var cleanupFn = cleanup_1_1.value;
|
485 | cleanupFn();
|
486 | }
|
487 | } catch (e_2_1) {
|
488 | e_2 = { error: e_2_1 };
|
489 | } finally {
|
490 | try {
|
491 | if (cleanup_1_1 && !cleanup_1_1.done && (_a = cleanup_1.return)) _a.call(cleanup_1);
|
492 | } finally {
|
493 | if (e_2) throw e_2.error;
|
494 | }
|
495 | }
|
496 | _this.unobserves.delete(unobserve);
|
497 | };
|
498 | this.unobserves.add(unobserve);
|
499 | return unobserve;
|
500 | };
|
501 | |
502 |
|
503 |
|
504 |
|
505 |
|
506 |
|
507 |
|
508 |
|
509 |
|
510 |
|
511 |
|
512 |
|
513 |
|
514 |
|
515 |
|
516 |
|
517 |
|
518 | MDCObserverFoundation.prototype.observeProperty = function (target, property, observer) {
|
519 | return observer_1.observeProperty(target, property, observer);
|
520 | };
|
521 | |
522 |
|
523 |
|
524 |
|
525 |
|
526 |
|
527 |
|
528 | MDCObserverFoundation.prototype.setObserversEnabled = function (target, enabled) {
|
529 | observer_1.setObserversEnabled(target, enabled);
|
530 | };
|
531 | |
532 |
|
533 |
|
534 | MDCObserverFoundation.prototype.unobserve = function () {
|
535 | var e_3, _a;
|
536 | try {
|
537 |
|
538 | for (var _b = __values(__spreadArray([], __read(this.unobserves))), _c = _b.next(); !_c.done; _c = _b.next()) {
|
539 | var unobserve = _c.value;
|
540 | unobserve();
|
541 | }
|
542 | } catch (e_3_1) {
|
543 | e_3 = { error: e_3_1 };
|
544 | } finally {
|
545 | try {
|
546 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
547 | } finally {
|
548 | if (e_3) throw e_3.error;
|
549 | }
|
550 | }
|
551 | };
|
552 | return MDCObserverFoundation;
|
553 | }(foundation_1.MDCFoundation);
|
554 | exports.MDCObserverFoundation = MDCObserverFoundation;
|
555 |
|
556 | }),
|
557 |
|
558 | "./packages/mdc-base/observer.ts":
|
559 |
|
560 |
|
561 |
|
562 |
|
563 | (function(module, exports, __webpack_require__) {
|
564 |
|
565 | "use strict";
|
566 |
|
567 |
|
568 |
|
569 |
|
570 |
|
571 |
|
572 |
|
573 |
|
574 |
|
575 |
|
576 |
|
577 |
|
578 |
|
579 |
|
580 |
|
581 |
|
582 |
|
583 |
|
584 |
|
585 |
|
586 |
|
587 |
|
588 |
|
589 |
|
590 | var __extends = this && this.__extends || function () {
|
591 | var _extendStatics = function extendStatics(d, b) {
|
592 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
593 | d.__proto__ = b;
|
594 | } || function (d, b) {
|
595 | for (var p in b) {
|
596 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
597 | }
|
598 | };
|
599 | return _extendStatics(d, b);
|
600 | };
|
601 | return function (d, b) {
|
602 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
603 | _extendStatics(d, b);
|
604 | function __() {
|
605 | this.constructor = d;
|
606 | }
|
607 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
608 | };
|
609 | }();
|
610 | var __assign = this && this.__assign || function () {
|
611 | __assign = Object.assign || function (t) {
|
612 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
613 | s = arguments[i];
|
614 | for (var p in s) {
|
615 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
616 | }
|
617 | }
|
618 | return t;
|
619 | };
|
620 | return __assign.apply(this, arguments);
|
621 | };
|
622 | var __values = this && this.__values || function (o) {
|
623 | var s = typeof Symbol === "function" && Symbol.iterator,
|
624 | m = s && o[s],
|
625 | i = 0;
|
626 | if (m) return m.call(o);
|
627 | if (o && typeof o.length === "number") return {
|
628 | next: function next() {
|
629 | if (o && i >= o.length) o = void 0;
|
630 | return { value: o && o[i++], done: !o };
|
631 | }
|
632 | };
|
633 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
634 | };
|
635 | var __read = this && this.__read || function (o, n) {
|
636 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
637 | if (!m) return o;
|
638 | var i = m.call(o),
|
639 | r,
|
640 | ar = [],
|
641 | e;
|
642 | try {
|
643 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
644 | ar.push(r.value);
|
645 | }
|
646 | } catch (error) {
|
647 | e = { error: error };
|
648 | } finally {
|
649 | try {
|
650 | if (r && !r.done && (m = i["return"])) m.call(i);
|
651 | } finally {
|
652 | if (e) throw e.error;
|
653 | }
|
654 | }
|
655 | return ar;
|
656 | };
|
657 | var __spreadArray = this && this.__spreadArray || function (to, from) {
|
658 | for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) {
|
659 | to[j] = from[i];
|
660 | }return to;
|
661 | };
|
662 | Object.defineProperty(exports, "__esModule", { value: true });
|
663 | exports.setObserversEnabled = exports.getDescriptor = exports.observeProperty = exports.mdcObserver = void 0;
|
664 |
|
665 |
|
666 |
|
667 |
|
668 |
|
669 |
|
670 |
|
671 |
|
672 |
|
673 | function mdcObserver(baseClass) {
|
674 | if (baseClass === void 0) {
|
675 | baseClass = function () {
|
676 | function class_1() {}
|
677 | return class_1;
|
678 | }();
|
679 | }
|
680 |
|
681 |
|
682 | var unobserveMap = new WeakMap();
|
683 | return (function (_super) {
|
684 | __extends(MDCObserver, _super);
|
685 | function MDCObserver() {
|
686 | return _super !== null && _super.apply(this, arguments) || this;
|
687 | }
|
688 | MDCObserver.prototype.observe = function (target, observers) {
|
689 | var e_1, _a;
|
690 | var _this = this;
|
691 | var cleanup = [];
|
692 | try {
|
693 | for (var _b = __values(Object.keys(observers)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
694 | var property = _c.value;
|
695 | var observer = observers[property].bind(this);
|
696 | cleanup.push(observeProperty(target, property, observer));
|
697 | }
|
698 | } catch (e_1_1) {
|
699 | e_1 = { error: e_1_1 };
|
700 | } finally {
|
701 | try {
|
702 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
703 | } finally {
|
704 | if (e_1) throw e_1.error;
|
705 | }
|
706 | }
|
707 | var unobserve = function unobserve() {
|
708 | var e_2, _a;
|
709 | try {
|
710 | for (var cleanup_1 = __values(cleanup), cleanup_1_1 = cleanup_1.next(); !cleanup_1_1.done; cleanup_1_1 = cleanup_1.next()) {
|
711 | var cleanupFn = cleanup_1_1.value;
|
712 | cleanupFn();
|
713 | }
|
714 | } catch (e_2_1) {
|
715 | e_2 = { error: e_2_1 };
|
716 | } finally {
|
717 | try {
|
718 | if (cleanup_1_1 && !cleanup_1_1.done && (_a = cleanup_1.return)) _a.call(cleanup_1);
|
719 | } finally {
|
720 | if (e_2) throw e_2.error;
|
721 | }
|
722 | }
|
723 | var unobserves = unobserveMap.get(_this) || [];
|
724 | var index = unobserves.indexOf(unobserve);
|
725 | if (index > -1) {
|
726 | unobserves.splice(index, 1);
|
727 | }
|
728 | };
|
729 | var unobserves = unobserveMap.get(this);
|
730 | if (!unobserves) {
|
731 | unobserves = [];
|
732 | unobserveMap.set(this, unobserves);
|
733 | }
|
734 | unobserves.push(unobserve);
|
735 | return unobserve;
|
736 | };
|
737 | MDCObserver.prototype.setObserversEnabled = function (target, enabled) {
|
738 | setObserversEnabled(target, enabled);
|
739 | };
|
740 | MDCObserver.prototype.unobserve = function () {
|
741 | var e_3, _a;
|
742 |
|
743 |
|
744 | var unobserves = unobserveMap.get(this) || [];
|
745 | try {
|
746 | for (var _b = __values(__spreadArray([], __read(unobserves))), _c = _b.next(); !_c.done; _c = _b.next()) {
|
747 | var unobserve = _c.value;
|
748 | unobserve();
|
749 | }
|
750 | } catch (e_3_1) {
|
751 | e_3 = { error: e_3_1 };
|
752 | } finally {
|
753 | try {
|
754 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
755 | } finally {
|
756 | if (e_3) throw e_3.error;
|
757 | }
|
758 | }
|
759 | };
|
760 | return MDCObserver;
|
761 | }(baseClass)
|
762 | );
|
763 | }
|
764 | exports.mdcObserver = mdcObserver;
|
765 |
|
766 |
|
767 |
|
768 |
|
769 |
|
770 |
|
771 |
|
772 |
|
773 |
|
774 |
|
775 |
|
776 |
|
777 |
|
778 |
|
779 |
|
780 |
|
781 |
|
782 | function observeProperty(target, property, observer) {
|
783 | var targetObservers = installObserver(target, property);
|
784 | var observers = targetObservers.getObservers(property);
|
785 | observers.push(observer);
|
786 | return function () {
|
787 | observers.splice(observers.indexOf(observer), 1);
|
788 | };
|
789 | }
|
790 | exports.observeProperty = observeProperty;
|
791 |
|
792 |
|
793 |
|
794 | var allTargetObservers = new WeakMap();
|
795 |
|
796 |
|
797 |
|
798 |
|
799 |
|
800 |
|
801 |
|
802 |
|
803 |
|
804 |
|
805 |
|
806 |
|
807 |
|
808 |
|
809 | function installObserver(target, property) {
|
810 | var observersMap = new Map();
|
811 | if (!allTargetObservers.has(target)) {
|
812 | allTargetObservers.set(target, {
|
813 | isEnabled: true,
|
814 | getObservers: function getObservers(key) {
|
815 | var observers = observersMap.get(key) || [];
|
816 | if (!observersMap.has(key)) {
|
817 | observersMap.set(key, observers);
|
818 | }
|
819 | return observers;
|
820 | },
|
821 | installedProperties: new Set()
|
822 | });
|
823 | }
|
824 | var targetObservers = allTargetObservers.get(target);
|
825 | if (targetObservers.installedProperties.has(property)) {
|
826 |
|
827 | return targetObservers;
|
828 | }
|
829 |
|
830 |
|
831 | var descriptor = getDescriptor(target, property) || {
|
832 | configurable: true,
|
833 | enumerable: true,
|
834 | value: target[property],
|
835 | writable: true
|
836 | };
|
837 |
|
838 | var observedDescriptor = __assign({}, descriptor);
|
839 | var descGet = descriptor.get,
|
840 | descSet = descriptor.set;
|
841 | if ('value' in descriptor) {
|
842 |
|
843 |
|
844 |
|
845 |
|
846 | delete observedDescriptor.value;
|
847 | delete observedDescriptor.writable;
|
848 |
|
849 | var value_1 = descriptor.value;
|
850 | descGet = function descGet() {
|
851 | return value_1;
|
852 | };
|
853 |
|
854 | if (descriptor.writable) {
|
855 | descSet = function descSet(newValue) {
|
856 | value_1 = newValue;
|
857 | };
|
858 | }
|
859 | }
|
860 | if (descGet) {
|
861 | observedDescriptor.get = function () {
|
862 |
|
863 | return descGet.call(this);
|
864 | };
|
865 | }
|
866 | if (descSet) {
|
867 | observedDescriptor.set = function (newValue) {
|
868 | var e_4, _a;
|
869 |
|
870 | var previous = descGet ? descGet.call(this) : newValue;
|
871 | descSet.call(this, newValue);
|
872 | if (targetObservers.isEnabled && (!descGet || newValue !== previous)) {
|
873 | try {
|
874 | for (var _b = __values(targetObservers.getObservers(property)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
875 | var observer = _c.value;
|
876 | observer(newValue, previous);
|
877 | }
|
878 | } catch (e_4_1) {
|
879 | e_4 = { error: e_4_1 };
|
880 | } finally {
|
881 | try {
|
882 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
883 | } finally {
|
884 | if (e_4) throw e_4.error;
|
885 | }
|
886 | }
|
887 | }
|
888 | };
|
889 | }
|
890 | targetObservers.installedProperties.add(property);
|
891 | Object.defineProperty(target, property, observedDescriptor);
|
892 | return targetObservers;
|
893 | }
|
894 |
|
895 |
|
896 |
|
897 |
|
898 |
|
899 |
|
900 |
|
901 |
|
902 |
|
903 |
|
904 |
|
905 |
|
906 | function getDescriptor(target, property) {
|
907 | var descriptorTarget = target;
|
908 | var descriptor;
|
909 | while (descriptorTarget) {
|
910 | descriptor = Object.getOwnPropertyDescriptor(descriptorTarget, property);
|
911 | if (descriptor) {
|
912 | break;
|
913 | }
|
914 |
|
915 |
|
916 | descriptorTarget = Object.getPrototypeOf(descriptorTarget);
|
917 | }
|
918 | return descriptor;
|
919 | }
|
920 | exports.getDescriptor = getDescriptor;
|
921 |
|
922 |
|
923 |
|
924 |
|
925 |
|
926 |
|
927 |
|
928 |
|
929 | function setObserversEnabled(target, enabled) {
|
930 | var targetObservers = allTargetObservers.get(target);
|
931 | if (targetObservers) {
|
932 | targetObservers.isEnabled = enabled;
|
933 | }
|
934 | }
|
935 | exports.setObserversEnabled = setObserversEnabled;
|
936 |
|
937 | }),
|
938 |
|
939 | "./packages/mdc-dom/events.ts":
|
940 |
|
941 |
|
942 |
|
943 |
|
944 | (function(module, exports, __webpack_require__) {
|
945 |
|
946 | "use strict";
|
947 |
|
948 |
|
949 |
|
950 |
|
951 |
|
952 |
|
953 |
|
954 |
|
955 |
|
956 |
|
957 |
|
958 |
|
959 |
|
960 |
|
961 |
|
962 |
|
963 |
|
964 |
|
965 |
|
966 |
|
967 |
|
968 |
|
969 |
|
970 |
|
971 | Object.defineProperty(exports, "__esModule", { value: true });
|
972 | exports.applyPassive = void 0;
|
973 |
|
974 |
|
975 |
|
976 |
|
977 | function applyPassive(globalObj) {
|
978 | if (globalObj === void 0) {
|
979 | globalObj = window;
|
980 | }
|
981 | return supportsPassiveOption(globalObj) ? { passive: true } : false;
|
982 | }
|
983 | exports.applyPassive = applyPassive;
|
984 | function supportsPassiveOption(globalObj) {
|
985 | if (globalObj === void 0) {
|
986 | globalObj = window;
|
987 | }
|
988 |
|
989 |
|
990 | var passiveSupported = false;
|
991 | try {
|
992 | var options = {
|
993 |
|
994 |
|
995 | get passive() {
|
996 | passiveSupported = true;
|
997 | return false;
|
998 | }
|
999 | };
|
1000 | var handler = function handler() {};
|
1001 | globalObj.document.addEventListener('test', handler, options);
|
1002 | globalObj.document.removeEventListener('test', handler, options);
|
1003 | } catch (err) {
|
1004 | passiveSupported = false;
|
1005 | }
|
1006 | return passiveSupported;
|
1007 | }
|
1008 |
|
1009 | }),
|
1010 |
|
1011 | "./packages/mdc-dom/ponyfill.ts":
|
1012 |
|
1013 |
|
1014 |
|
1015 |
|
1016 | (function(module, exports, __webpack_require__) {
|
1017 |
|
1018 | "use strict";
|
1019 |
|
1020 |
|
1021 |
|
1022 |
|
1023 |
|
1024 |
|
1025 |
|
1026 |
|
1027 |
|
1028 |
|
1029 |
|
1030 |
|
1031 |
|
1032 |
|
1033 |
|
1034 |
|
1035 |
|
1036 |
|
1037 |
|
1038 |
|
1039 |
|
1040 |
|
1041 |
|
1042 |
|
1043 | Object.defineProperty(exports, "__esModule", { value: true });
|
1044 | exports.estimateScrollWidth = exports.matches = exports.closest = void 0;
|
1045 |
|
1046 |
|
1047 |
|
1048 |
|
1049 | function closest(element, selector) {
|
1050 | if (element.closest) {
|
1051 | return element.closest(selector);
|
1052 | }
|
1053 | var el = element;
|
1054 | while (el) {
|
1055 | if (matches(el, selector)) {
|
1056 | return el;
|
1057 | }
|
1058 | el = el.parentElement;
|
1059 | }
|
1060 | return null;
|
1061 | }
|
1062 | exports.closest = closest;
|
1063 | function matches(element, selector) {
|
1064 | var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector;
|
1065 | return nativeMatches.call(element, selector);
|
1066 | }
|
1067 | exports.matches = matches;
|
1068 |
|
1069 |
|
1070 |
|
1071 |
|
1072 |
|
1073 |
|
1074 |
|
1075 |
|
1076 | function estimateScrollWidth(element) {
|
1077 |
|
1078 |
|
1079 |
|
1080 |
|
1081 | var htmlEl = element;
|
1082 | if (htmlEl.offsetParent !== null) {
|
1083 | return htmlEl.scrollWidth;
|
1084 | }
|
1085 | var clone = htmlEl.cloneNode(true);
|
1086 | clone.style.setProperty('position', 'absolute');
|
1087 | clone.style.setProperty('transform', 'translate(-9999px, -9999px)');
|
1088 | document.documentElement.appendChild(clone);
|
1089 | var scrollWidth = clone.scrollWidth;
|
1090 | document.documentElement.removeChild(clone);
|
1091 | return scrollWidth;
|
1092 | }
|
1093 | exports.estimateScrollWidth = estimateScrollWidth;
|
1094 |
|
1095 | }),
|
1096 |
|
1097 | "./packages/mdc-ripple/component.ts":
|
1098 |
|
1099 |
|
1100 |
|
1101 |
|
1102 | (function(module, exports, __webpack_require__) {
|
1103 |
|
1104 | "use strict";
|
1105 |
|
1106 |
|
1107 |
|
1108 |
|
1109 |
|
1110 |
|
1111 |
|
1112 |
|
1113 |
|
1114 |
|
1115 |
|
1116 |
|
1117 |
|
1118 |
|
1119 |
|
1120 |
|
1121 |
|
1122 |
|
1123 |
|
1124 |
|
1125 |
|
1126 |
|
1127 |
|
1128 |
|
1129 | var __extends = this && this.__extends || function () {
|
1130 | var _extendStatics = function extendStatics(d, b) {
|
1131 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
1132 | d.__proto__ = b;
|
1133 | } || function (d, b) {
|
1134 | for (var p in b) {
|
1135 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
1136 | }
|
1137 | };
|
1138 | return _extendStatics(d, b);
|
1139 | };
|
1140 | return function (d, b) {
|
1141 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
1142 | _extendStatics(d, b);
|
1143 | function __() {
|
1144 | this.constructor = d;
|
1145 | }
|
1146 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
1147 | };
|
1148 | }();
|
1149 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
1150 | if (k2 === undefined) k2 = k;
|
1151 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
1152 | return m[k];
|
1153 | } });
|
1154 | } : function (o, m, k, k2) {
|
1155 | if (k2 === undefined) k2 = k;
|
1156 | o[k2] = m[k];
|
1157 | });
|
1158 | var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
1159 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
1160 | } : function (o, v) {
|
1161 | o["default"] = v;
|
1162 | });
|
1163 | var __importStar = this && this.__importStar || function (mod) {
|
1164 | if (mod && mod.__esModule) return mod;
|
1165 | var result = {};
|
1166 | if (mod != null) for (var k in mod) {
|
1167 | if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
1168 | }__setModuleDefault(result, mod);
|
1169 | return result;
|
1170 | };
|
1171 | Object.defineProperty(exports, "__esModule", { value: true });
|
1172 | exports.MDCRipple = void 0;
|
1173 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
1174 | var events_1 = __webpack_require__( "./packages/mdc-dom/events.ts");
|
1175 | var ponyfill_1 = __webpack_require__( "./packages/mdc-dom/ponyfill.ts");
|
1176 | var foundation_1 = __webpack_require__( "./packages/mdc-ripple/foundation.ts");
|
1177 | var util = __importStar(__webpack_require__( "./packages/mdc-ripple/util.ts"));
|
1178 | var MDCRipple = function (_super) {
|
1179 | __extends(MDCRipple, _super);
|
1180 | function MDCRipple() {
|
1181 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
1182 | _this.disabled = false;
|
1183 | return _this;
|
1184 | }
|
1185 | MDCRipple.attachTo = function (root, opts) {
|
1186 | if (opts === void 0) {
|
1187 | opts = {
|
1188 | isUnbounded: undefined
|
1189 | };
|
1190 | }
|
1191 | var ripple = new MDCRipple(root);
|
1192 |
|
1193 | if (opts.isUnbounded !== undefined) {
|
1194 | ripple.unbounded = opts.isUnbounded;
|
1195 | }
|
1196 | return ripple;
|
1197 | };
|
1198 | MDCRipple.createAdapter = function (instance) {
|
1199 | return {
|
1200 | addClass: function addClass(className) {
|
1201 | return instance.root.classList.add(className);
|
1202 | },
|
1203 | browserSupportsCssVars: function browserSupportsCssVars() {
|
1204 | return util.supportsCssVariables(window);
|
1205 | },
|
1206 | computeBoundingRect: function computeBoundingRect() {
|
1207 | return instance.root.getBoundingClientRect();
|
1208 | },
|
1209 | containsEventTarget: function containsEventTarget(target) {
|
1210 | return instance.root.contains(target);
|
1211 | },
|
1212 | deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) {
|
1213 | return document.documentElement.removeEventListener(evtType, handler, events_1.applyPassive());
|
1214 | },
|
1215 | deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
|
1216 | return instance.root.removeEventListener(evtType, handler, events_1.applyPassive());
|
1217 | },
|
1218 | deregisterResizeHandler: function deregisterResizeHandler(handler) {
|
1219 | return window.removeEventListener('resize', handler);
|
1220 | },
|
1221 | getWindowPageOffset: function getWindowPageOffset() {
|
1222 | return { x: window.pageXOffset, y: window.pageYOffset };
|
1223 | },
|
1224 | isSurfaceActive: function isSurfaceActive() {
|
1225 | return ponyfill_1.matches(instance.root, ':active');
|
1226 | },
|
1227 | isSurfaceDisabled: function isSurfaceDisabled() {
|
1228 | return Boolean(instance.disabled);
|
1229 | },
|
1230 | isUnbounded: function isUnbounded() {
|
1231 | return Boolean(instance.unbounded);
|
1232 | },
|
1233 | registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) {
|
1234 | return document.documentElement.addEventListener(evtType, handler, events_1.applyPassive());
|
1235 | },
|
1236 | registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
|
1237 | return instance.root.addEventListener(evtType, handler, events_1.applyPassive());
|
1238 | },
|
1239 | registerResizeHandler: function registerResizeHandler(handler) {
|
1240 | return window.addEventListener('resize', handler);
|
1241 | },
|
1242 | removeClass: function removeClass(className) {
|
1243 | return instance.root.classList.remove(className);
|
1244 | },
|
1245 | updateCssVariable: function updateCssVariable(varName, value) {
|
1246 | return instance.root.style.setProperty(varName, value);
|
1247 | }
|
1248 | };
|
1249 | };
|
1250 | Object.defineProperty(MDCRipple.prototype, "unbounded", {
|
1251 | get: function get() {
|
1252 | return Boolean(this.isUnbounded);
|
1253 | },
|
1254 | set: function set(unbounded) {
|
1255 | this.isUnbounded = Boolean(unbounded);
|
1256 | this.setUnbounded();
|
1257 | },
|
1258 | enumerable: false,
|
1259 | configurable: true
|
1260 | });
|
1261 | MDCRipple.prototype.activate = function () {
|
1262 | this.foundation.activate();
|
1263 | };
|
1264 | MDCRipple.prototype.deactivate = function () {
|
1265 | this.foundation.deactivate();
|
1266 | };
|
1267 | MDCRipple.prototype.layout = function () {
|
1268 | this.foundation.layout();
|
1269 | };
|
1270 | MDCRipple.prototype.getDefaultFoundation = function () {
|
1271 | return new foundation_1.MDCRippleFoundation(MDCRipple.createAdapter(this));
|
1272 | };
|
1273 | MDCRipple.prototype.initialSyncWithDOM = function () {
|
1274 | var root = this.root;
|
1275 | this.isUnbounded = 'mdcRippleIsUnbounded' in root.dataset;
|
1276 | };
|
1277 | |
1278 |
|
1279 |
|
1280 |
|
1281 |
|
1282 |
|
1283 | MDCRipple.prototype.setUnbounded = function () {
|
1284 | this.foundation.setUnbounded(Boolean(this.isUnbounded));
|
1285 | };
|
1286 | return MDCRipple;
|
1287 | }(component_1.MDCComponent);
|
1288 | exports.MDCRipple = MDCRipple;
|
1289 |
|
1290 | }),
|
1291 |
|
1292 | "./packages/mdc-ripple/constants.ts":
|
1293 |
|
1294 |
|
1295 |
|
1296 |
|
1297 | (function(module, exports, __webpack_require__) {
|
1298 |
|
1299 | "use strict";
|
1300 |
|
1301 |
|
1302 |
|
1303 |
|
1304 |
|
1305 |
|
1306 |
|
1307 |
|
1308 |
|
1309 |
|
1310 |
|
1311 |
|
1312 |
|
1313 |
|
1314 |
|
1315 |
|
1316 |
|
1317 |
|
1318 |
|
1319 |
|
1320 |
|
1321 |
|
1322 |
|
1323 |
|
1324 | Object.defineProperty(exports, "__esModule", { value: true });
|
1325 | exports.numbers = exports.strings = exports.cssClasses = void 0;
|
1326 | exports.cssClasses = {
|
1327 |
|
1328 |
|
1329 |
|
1330 | BG_FOCUSED: 'mdc-ripple-upgraded--background-focused',
|
1331 | FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation',
|
1332 | FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation',
|
1333 | ROOT: 'mdc-ripple-upgraded',
|
1334 | UNBOUNDED: 'mdc-ripple-upgraded--unbounded'
|
1335 | };
|
1336 | exports.strings = {
|
1337 | VAR_FG_SCALE: '--mdc-ripple-fg-scale',
|
1338 | VAR_FG_SIZE: '--mdc-ripple-fg-size',
|
1339 | VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end',
|
1340 | VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start',
|
1341 | VAR_LEFT: '--mdc-ripple-left',
|
1342 | VAR_TOP: '--mdc-ripple-top'
|
1343 | };
|
1344 | exports.numbers = {
|
1345 | DEACTIVATION_TIMEOUT_MS: 225,
|
1346 | FG_DEACTIVATION_MS: 150,
|
1347 | INITIAL_ORIGIN_SCALE: 0.6,
|
1348 | PADDING: 10,
|
1349 | TAP_DELAY_MS: 300 };
|
1350 |
|
1351 | }),
|
1352 |
|
1353 | "./packages/mdc-ripple/foundation.ts":
|
1354 |
|
1355 |
|
1356 |
|
1357 |
|
1358 | (function(module, exports, __webpack_require__) {
|
1359 |
|
1360 | "use strict";
|
1361 |
|
1362 |
|
1363 |
|
1364 |
|
1365 |
|
1366 |
|
1367 |
|
1368 |
|
1369 |
|
1370 |
|
1371 |
|
1372 |
|
1373 |
|
1374 |
|
1375 |
|
1376 |
|
1377 |
|
1378 |
|
1379 |
|
1380 |
|
1381 |
|
1382 |
|
1383 |
|
1384 |
|
1385 | var __extends = this && this.__extends || function () {
|
1386 | var _extendStatics = function extendStatics(d, b) {
|
1387 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
1388 | d.__proto__ = b;
|
1389 | } || function (d, b) {
|
1390 | for (var p in b) {
|
1391 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
1392 | }
|
1393 | };
|
1394 | return _extendStatics(d, b);
|
1395 | };
|
1396 | return function (d, b) {
|
1397 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
1398 | _extendStatics(d, b);
|
1399 | function __() {
|
1400 | this.constructor = d;
|
1401 | }
|
1402 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
1403 | };
|
1404 | }();
|
1405 | var __assign = this && this.__assign || function () {
|
1406 | __assign = Object.assign || function (t) {
|
1407 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
1408 | s = arguments[i];
|
1409 | for (var p in s) {
|
1410 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
1411 | }
|
1412 | }
|
1413 | return t;
|
1414 | };
|
1415 | return __assign.apply(this, arguments);
|
1416 | };
|
1417 | var __values = this && this.__values || function (o) {
|
1418 | var s = typeof Symbol === "function" && Symbol.iterator,
|
1419 | m = s && o[s],
|
1420 | i = 0;
|
1421 | if (m) return m.call(o);
|
1422 | if (o && typeof o.length === "number") return {
|
1423 | next: function next() {
|
1424 | if (o && i >= o.length) o = void 0;
|
1425 | return { value: o && o[i++], done: !o };
|
1426 | }
|
1427 | };
|
1428 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
1429 | };
|
1430 | Object.defineProperty(exports, "__esModule", { value: true });
|
1431 | exports.MDCRippleFoundation = void 0;
|
1432 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
1433 | var constants_1 = __webpack_require__( "./packages/mdc-ripple/constants.ts");
|
1434 | var util_1 = __webpack_require__( "./packages/mdc-ripple/util.ts");
|
1435 |
|
1436 | var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown'];
|
1437 |
|
1438 | var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup', 'contextmenu'];
|
1439 |
|
1440 | var activatedTargets = [];
|
1441 | var MDCRippleFoundation = function (_super) {
|
1442 | __extends(MDCRippleFoundation, _super);
|
1443 | function MDCRippleFoundation(adapter) {
|
1444 | var _this = _super.call(this, __assign(__assign({}, MDCRippleFoundation.defaultAdapter), adapter)) || this;
|
1445 | _this.activationAnimationHasEnded = false;
|
1446 | _this.activationTimer = 0;
|
1447 | _this.fgDeactivationRemovalTimer = 0;
|
1448 | _this.fgScale = '0';
|
1449 | _this.frame = { width: 0, height: 0 };
|
1450 | _this.initialSize = 0;
|
1451 | _this.layoutFrame = 0;
|
1452 | _this.maxRadius = 0;
|
1453 | _this.unboundedCoords = { left: 0, top: 0 };
|
1454 | _this.activationState = _this.defaultActivationState();
|
1455 | _this.activationTimerCallback = function () {
|
1456 | _this.activationAnimationHasEnded = true;
|
1457 | _this.runDeactivationUXLogicIfReady();
|
1458 | };
|
1459 | _this.activateHandler = function (e) {
|
1460 | _this.activateImpl(e);
|
1461 | };
|
1462 | _this.deactivateHandler = function () {
|
1463 | _this.deactivateImpl();
|
1464 | };
|
1465 | _this.focusHandler = function () {
|
1466 | _this.handleFocus();
|
1467 | };
|
1468 | _this.blurHandler = function () {
|
1469 | _this.handleBlur();
|
1470 | };
|
1471 | _this.resizeHandler = function () {
|
1472 | _this.layout();
|
1473 | };
|
1474 | return _this;
|
1475 | }
|
1476 | Object.defineProperty(MDCRippleFoundation, "cssClasses", {
|
1477 | get: function get() {
|
1478 | return constants_1.cssClasses;
|
1479 | },
|
1480 | enumerable: false,
|
1481 | configurable: true
|
1482 | });
|
1483 | Object.defineProperty(MDCRippleFoundation, "strings", {
|
1484 | get: function get() {
|
1485 | return constants_1.strings;
|
1486 | },
|
1487 | enumerable: false,
|
1488 | configurable: true
|
1489 | });
|
1490 | Object.defineProperty(MDCRippleFoundation, "numbers", {
|
1491 | get: function get() {
|
1492 | return constants_1.numbers;
|
1493 | },
|
1494 | enumerable: false,
|
1495 | configurable: true
|
1496 | });
|
1497 | Object.defineProperty(MDCRippleFoundation, "defaultAdapter", {
|
1498 | get: function get() {
|
1499 | return {
|
1500 | addClass: function addClass() {
|
1501 | return undefined;
|
1502 | },
|
1503 | browserSupportsCssVars: function browserSupportsCssVars() {
|
1504 | return true;
|
1505 | },
|
1506 | computeBoundingRect: function computeBoundingRect() {
|
1507 | return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
|
1508 | },
|
1509 | containsEventTarget: function containsEventTarget() {
|
1510 | return true;
|
1511 | },
|
1512 | deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() {
|
1513 | return undefined;
|
1514 | },
|
1515 | deregisterInteractionHandler: function deregisterInteractionHandler() {
|
1516 | return undefined;
|
1517 | },
|
1518 | deregisterResizeHandler: function deregisterResizeHandler() {
|
1519 | return undefined;
|
1520 | },
|
1521 | getWindowPageOffset: function getWindowPageOffset() {
|
1522 | return { x: 0, y: 0 };
|
1523 | },
|
1524 | isSurfaceActive: function isSurfaceActive() {
|
1525 | return true;
|
1526 | },
|
1527 | isSurfaceDisabled: function isSurfaceDisabled() {
|
1528 | return true;
|
1529 | },
|
1530 | isUnbounded: function isUnbounded() {
|
1531 | return true;
|
1532 | },
|
1533 | registerDocumentInteractionHandler: function registerDocumentInteractionHandler() {
|
1534 | return undefined;
|
1535 | },
|
1536 | registerInteractionHandler: function registerInteractionHandler() {
|
1537 | return undefined;
|
1538 | },
|
1539 | registerResizeHandler: function registerResizeHandler() {
|
1540 | return undefined;
|
1541 | },
|
1542 | removeClass: function removeClass() {
|
1543 | return undefined;
|
1544 | },
|
1545 | updateCssVariable: function updateCssVariable() {
|
1546 | return undefined;
|
1547 | }
|
1548 | };
|
1549 | },
|
1550 | enumerable: false,
|
1551 | configurable: true
|
1552 | });
|
1553 | MDCRippleFoundation.prototype.init = function () {
|
1554 | var _this = this;
|
1555 | var supportsPressRipple = this.supportsPressRipple();
|
1556 | this.registerRootHandlers(supportsPressRipple);
|
1557 | if (supportsPressRipple) {
|
1558 | var _a = MDCRippleFoundation.cssClasses,
|
1559 | ROOT_1 = _a.ROOT,
|
1560 | UNBOUNDED_1 = _a.UNBOUNDED;
|
1561 | requestAnimationFrame(function () {
|
1562 | _this.adapter.addClass(ROOT_1);
|
1563 | if (_this.adapter.isUnbounded()) {
|
1564 | _this.adapter.addClass(UNBOUNDED_1);
|
1565 |
|
1566 | _this.layoutInternal();
|
1567 | }
|
1568 | });
|
1569 | }
|
1570 | };
|
1571 | MDCRippleFoundation.prototype.destroy = function () {
|
1572 | var _this = this;
|
1573 | if (this.supportsPressRipple()) {
|
1574 | if (this.activationTimer) {
|
1575 | clearTimeout(this.activationTimer);
|
1576 | this.activationTimer = 0;
|
1577 | this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION);
|
1578 | }
|
1579 | if (this.fgDeactivationRemovalTimer) {
|
1580 | clearTimeout(this.fgDeactivationRemovalTimer);
|
1581 | this.fgDeactivationRemovalTimer = 0;
|
1582 | this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION);
|
1583 | }
|
1584 | var _a = MDCRippleFoundation.cssClasses,
|
1585 | ROOT_2 = _a.ROOT,
|
1586 | UNBOUNDED_2 = _a.UNBOUNDED;
|
1587 | requestAnimationFrame(function () {
|
1588 | _this.adapter.removeClass(ROOT_2);
|
1589 | _this.adapter.removeClass(UNBOUNDED_2);
|
1590 | _this.removeCssVars();
|
1591 | });
|
1592 | }
|
1593 | this.deregisterRootHandlers();
|
1594 | this.deregisterDeactivationHandlers();
|
1595 | };
|
1596 | |
1597 |
|
1598 |
|
1599 | MDCRippleFoundation.prototype.activate = function (evt) {
|
1600 | this.activateImpl(evt);
|
1601 | };
|
1602 | MDCRippleFoundation.prototype.deactivate = function () {
|
1603 | this.deactivateImpl();
|
1604 | };
|
1605 | MDCRippleFoundation.prototype.layout = function () {
|
1606 | var _this = this;
|
1607 | if (this.layoutFrame) {
|
1608 | cancelAnimationFrame(this.layoutFrame);
|
1609 | }
|
1610 | this.layoutFrame = requestAnimationFrame(function () {
|
1611 | _this.layoutInternal();
|
1612 | _this.layoutFrame = 0;
|
1613 | });
|
1614 | };
|
1615 | MDCRippleFoundation.prototype.setUnbounded = function (unbounded) {
|
1616 | var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED;
|
1617 | if (unbounded) {
|
1618 | this.adapter.addClass(UNBOUNDED);
|
1619 | } else {
|
1620 | this.adapter.removeClass(UNBOUNDED);
|
1621 | }
|
1622 | };
|
1623 | MDCRippleFoundation.prototype.handleFocus = function () {
|
1624 | var _this = this;
|
1625 | requestAnimationFrame(function () {
|
1626 | return _this.adapter.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
|
1627 | });
|
1628 | };
|
1629 | MDCRippleFoundation.prototype.handleBlur = function () {
|
1630 | var _this = this;
|
1631 | requestAnimationFrame(function () {
|
1632 | return _this.adapter.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
|
1633 | });
|
1634 | };
|
1635 | |
1636 |
|
1637 |
|
1638 |
|
1639 |
|
1640 |
|
1641 | MDCRippleFoundation.prototype.supportsPressRipple = function () {
|
1642 | return this.adapter.browserSupportsCssVars();
|
1643 | };
|
1644 | MDCRippleFoundation.prototype.defaultActivationState = function () {
|
1645 | return {
|
1646 | activationEvent: undefined,
|
1647 | hasDeactivationUXRun: false,
|
1648 | isActivated: false,
|
1649 | isProgrammatic: false,
|
1650 | wasActivatedByPointer: false,
|
1651 | wasElementMadeActive: false
|
1652 | };
|
1653 | };
|
1654 | |
1655 |
|
1656 |
|
1657 | MDCRippleFoundation.prototype.registerRootHandlers = function (supportsPressRipple) {
|
1658 | var e_1, _a;
|
1659 | if (supportsPressRipple) {
|
1660 | try {
|
1661 | 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()) {
|
1662 | var evtType = ACTIVATION_EVENT_TYPES_1_1.value;
|
1663 | this.adapter.registerInteractionHandler(evtType, this.activateHandler);
|
1664 | }
|
1665 | } catch (e_1_1) {
|
1666 | e_1 = { error: e_1_1 };
|
1667 | } finally {
|
1668 | try {
|
1669 | if (ACTIVATION_EVENT_TYPES_1_1 && !ACTIVATION_EVENT_TYPES_1_1.done && (_a = ACTIVATION_EVENT_TYPES_1.return)) _a.call(ACTIVATION_EVENT_TYPES_1);
|
1670 | } finally {
|
1671 | if (e_1) throw e_1.error;
|
1672 | }
|
1673 | }
|
1674 | if (this.adapter.isUnbounded()) {
|
1675 | this.adapter.registerResizeHandler(this.resizeHandler);
|
1676 | }
|
1677 | }
|
1678 | this.adapter.registerInteractionHandler('focus', this.focusHandler);
|
1679 | this.adapter.registerInteractionHandler('blur', this.blurHandler);
|
1680 | };
|
1681 | MDCRippleFoundation.prototype.registerDeactivationHandlers = function (evt) {
|
1682 | var e_2, _a;
|
1683 | if (evt.type === 'keydown') {
|
1684 | this.adapter.registerInteractionHandler('keyup', this.deactivateHandler);
|
1685 | } else {
|
1686 | try {
|
1687 | 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()) {
|
1688 | var evtType = POINTER_DEACTIVATION_EVENT_TYPES_1_1.value;
|
1689 | this.adapter.registerDocumentInteractionHandler(evtType, this.deactivateHandler);
|
1690 | }
|
1691 | } catch (e_2_1) {
|
1692 | e_2 = { error: e_2_1 };
|
1693 | } finally {
|
1694 | try {
|
1695 | 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);
|
1696 | } finally {
|
1697 | if (e_2) throw e_2.error;
|
1698 | }
|
1699 | }
|
1700 | }
|
1701 | };
|
1702 | MDCRippleFoundation.prototype.deregisterRootHandlers = function () {
|
1703 | var e_3, _a;
|
1704 | try {
|
1705 | 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()) {
|
1706 | var evtType = ACTIVATION_EVENT_TYPES_2_1.value;
|
1707 | this.adapter.deregisterInteractionHandler(evtType, this.activateHandler);
|
1708 | }
|
1709 | } catch (e_3_1) {
|
1710 | e_3 = { error: e_3_1 };
|
1711 | } finally {
|
1712 | try {
|
1713 | if (ACTIVATION_EVENT_TYPES_2_1 && !ACTIVATION_EVENT_TYPES_2_1.done && (_a = ACTIVATION_EVENT_TYPES_2.return)) _a.call(ACTIVATION_EVENT_TYPES_2);
|
1714 | } finally {
|
1715 | if (e_3) throw e_3.error;
|
1716 | }
|
1717 | }
|
1718 | this.adapter.deregisterInteractionHandler('focus', this.focusHandler);
|
1719 | this.adapter.deregisterInteractionHandler('blur', this.blurHandler);
|
1720 | if (this.adapter.isUnbounded()) {
|
1721 | this.adapter.deregisterResizeHandler(this.resizeHandler);
|
1722 | }
|
1723 | };
|
1724 | MDCRippleFoundation.prototype.deregisterDeactivationHandlers = function () {
|
1725 | var e_4, _a;
|
1726 | this.adapter.deregisterInteractionHandler('keyup', this.deactivateHandler);
|
1727 | try {
|
1728 | 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()) {
|
1729 | var evtType = POINTER_DEACTIVATION_EVENT_TYPES_2_1.value;
|
1730 | this.adapter.deregisterDocumentInteractionHandler(evtType, this.deactivateHandler);
|
1731 | }
|
1732 | } catch (e_4_1) {
|
1733 | e_4 = { error: e_4_1 };
|
1734 | } finally {
|
1735 | try {
|
1736 | 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);
|
1737 | } finally {
|
1738 | if (e_4) throw e_4.error;
|
1739 | }
|
1740 | }
|
1741 | };
|
1742 | MDCRippleFoundation.prototype.removeCssVars = function () {
|
1743 | var _this = this;
|
1744 | var rippleStrings = MDCRippleFoundation.strings;
|
1745 | var keys = Object.keys(rippleStrings);
|
1746 | keys.forEach(function (key) {
|
1747 | if (key.indexOf('VAR_') === 0) {
|
1748 | _this.adapter.updateCssVariable(rippleStrings[key], null);
|
1749 | }
|
1750 | });
|
1751 | };
|
1752 | MDCRippleFoundation.prototype.activateImpl = function (evt) {
|
1753 | var _this = this;
|
1754 | if (this.adapter.isSurfaceDisabled()) {
|
1755 | return;
|
1756 | }
|
1757 | var activationState = this.activationState;
|
1758 | if (activationState.isActivated) {
|
1759 | return;
|
1760 | }
|
1761 |
|
1762 | var previousActivationEvent = this.previousActivationEvent;
|
1763 | var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type;
|
1764 | if (isSameInteraction) {
|
1765 | return;
|
1766 | }
|
1767 | activationState.isActivated = true;
|
1768 | activationState.isProgrammatic = evt === undefined;
|
1769 | activationState.activationEvent = evt;
|
1770 | activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown');
|
1771 | var hasActivatedChild = evt !== undefined && activatedTargets.length > 0 && activatedTargets.some(function (target) {
|
1772 | return _this.adapter.containsEventTarget(target);
|
1773 | });
|
1774 | if (hasActivatedChild) {
|
1775 |
|
1776 | this.resetActivationState();
|
1777 | return;
|
1778 | }
|
1779 | if (evt !== undefined) {
|
1780 | activatedTargets.push(evt.target);
|
1781 | this.registerDeactivationHandlers(evt);
|
1782 | }
|
1783 | activationState.wasElementMadeActive = this.checkElementMadeActive(evt);
|
1784 | if (activationState.wasElementMadeActive) {
|
1785 | this.animateActivation();
|
1786 | }
|
1787 | requestAnimationFrame(function () {
|
1788 |
|
1789 | activatedTargets = [];
|
1790 | if (!activationState.wasElementMadeActive && evt !== undefined && (evt.key === ' ' || evt.keyCode === 32)) {
|
1791 |
|
1792 |
|
1793 |
|
1794 |
|
1795 |
|
1796 |
|
1797 | activationState.wasElementMadeActive = _this.checkElementMadeActive(evt);
|
1798 | if (activationState.wasElementMadeActive) {
|
1799 | _this.animateActivation();
|
1800 | }
|
1801 | }
|
1802 | if (!activationState.wasElementMadeActive) {
|
1803 |
|
1804 | _this.activationState = _this.defaultActivationState();
|
1805 | }
|
1806 | });
|
1807 | };
|
1808 | MDCRippleFoundation.prototype.checkElementMadeActive = function (evt) {
|
1809 | return evt !== undefined && evt.type === 'keydown' ? this.adapter.isSurfaceActive() : true;
|
1810 | };
|
1811 | MDCRippleFoundation.prototype.animateActivation = function () {
|
1812 | var _this = this;
|
1813 | var _a = MDCRippleFoundation.strings,
|
1814 | VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START,
|
1815 | VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END;
|
1816 | var _b = MDCRippleFoundation.cssClasses,
|
1817 | FG_DEACTIVATION = _b.FG_DEACTIVATION,
|
1818 | FG_ACTIVATION = _b.FG_ACTIVATION;
|
1819 | var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS;
|
1820 | this.layoutInternal();
|
1821 | var translateStart = '';
|
1822 | var translateEnd = '';
|
1823 | if (!this.adapter.isUnbounded()) {
|
1824 | var _c = this.getFgTranslationCoordinates(),
|
1825 | startPoint = _c.startPoint,
|
1826 | endPoint = _c.endPoint;
|
1827 | translateStart = startPoint.x + "px, " + startPoint.y + "px";
|
1828 | translateEnd = endPoint.x + "px, " + endPoint.y + "px";
|
1829 | }
|
1830 | this.adapter.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart);
|
1831 | this.adapter.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd);
|
1832 |
|
1833 | clearTimeout(this.activationTimer);
|
1834 | clearTimeout(this.fgDeactivationRemovalTimer);
|
1835 | this.rmBoundedActivationClasses();
|
1836 | this.adapter.removeClass(FG_DEACTIVATION);
|
1837 |
|
1838 | this.adapter.computeBoundingRect();
|
1839 | this.adapter.addClass(FG_ACTIVATION);
|
1840 | this.activationTimer = setTimeout(function () {
|
1841 | _this.activationTimerCallback();
|
1842 | }, DEACTIVATION_TIMEOUT_MS);
|
1843 | };
|
1844 | MDCRippleFoundation.prototype.getFgTranslationCoordinates = function () {
|
1845 | var _a = this.activationState,
|
1846 | activationEvent = _a.activationEvent,
|
1847 | wasActivatedByPointer = _a.wasActivatedByPointer;
|
1848 | var startPoint;
|
1849 | if (wasActivatedByPointer) {
|
1850 | startPoint = util_1.getNormalizedEventCoords(activationEvent, this.adapter.getWindowPageOffset(), this.adapter.computeBoundingRect());
|
1851 | } else {
|
1852 | startPoint = {
|
1853 | x: this.frame.width / 2,
|
1854 | y: this.frame.height / 2
|
1855 | };
|
1856 | }
|
1857 |
|
1858 | startPoint = {
|
1859 | x: startPoint.x - this.initialSize / 2,
|
1860 | y: startPoint.y - this.initialSize / 2
|
1861 | };
|
1862 | var endPoint = {
|
1863 | x: this.frame.width / 2 - this.initialSize / 2,
|
1864 | y: this.frame.height / 2 - this.initialSize / 2
|
1865 | };
|
1866 | return { startPoint: startPoint, endPoint: endPoint };
|
1867 | };
|
1868 | MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady = function () {
|
1869 | var _this = this;
|
1870 |
|
1871 |
|
1872 | var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION;
|
1873 | var _a = this.activationState,
|
1874 | hasDeactivationUXRun = _a.hasDeactivationUXRun,
|
1875 | isActivated = _a.isActivated;
|
1876 | var activationHasEnded = hasDeactivationUXRun || !isActivated;
|
1877 | if (activationHasEnded && this.activationAnimationHasEnded) {
|
1878 | this.rmBoundedActivationClasses();
|
1879 | this.adapter.addClass(FG_DEACTIVATION);
|
1880 | this.fgDeactivationRemovalTimer = setTimeout(function () {
|
1881 | _this.adapter.removeClass(FG_DEACTIVATION);
|
1882 | }, constants_1.numbers.FG_DEACTIVATION_MS);
|
1883 | }
|
1884 | };
|
1885 | MDCRippleFoundation.prototype.rmBoundedActivationClasses = function () {
|
1886 | var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION;
|
1887 | this.adapter.removeClass(FG_ACTIVATION);
|
1888 | this.activationAnimationHasEnded = false;
|
1889 | this.adapter.computeBoundingRect();
|
1890 | };
|
1891 | MDCRippleFoundation.prototype.resetActivationState = function () {
|
1892 | var _this = this;
|
1893 | this.previousActivationEvent = this.activationState.activationEvent;
|
1894 | this.activationState = this.defaultActivationState();
|
1895 |
|
1896 |
|
1897 | setTimeout(function () {
|
1898 | return _this.previousActivationEvent = undefined;
|
1899 | }, MDCRippleFoundation.numbers.TAP_DELAY_MS);
|
1900 | };
|
1901 | MDCRippleFoundation.prototype.deactivateImpl = function () {
|
1902 | var _this = this;
|
1903 | var activationState = this.activationState;
|
1904 |
|
1905 | if (!activationState.isActivated) {
|
1906 | return;
|
1907 | }
|
1908 | var state = __assign({}, activationState);
|
1909 | if (activationState.isProgrammatic) {
|
1910 | requestAnimationFrame(function () {
|
1911 | _this.animateDeactivation(state);
|
1912 | });
|
1913 | this.resetActivationState();
|
1914 | } else {
|
1915 | this.deregisterDeactivationHandlers();
|
1916 | requestAnimationFrame(function () {
|
1917 | _this.activationState.hasDeactivationUXRun = true;
|
1918 | _this.animateDeactivation(state);
|
1919 | _this.resetActivationState();
|
1920 | });
|
1921 | }
|
1922 | };
|
1923 | MDCRippleFoundation.prototype.animateDeactivation = function (_a) {
|
1924 | var wasActivatedByPointer = _a.wasActivatedByPointer,
|
1925 | wasElementMadeActive = _a.wasElementMadeActive;
|
1926 | if (wasActivatedByPointer || wasElementMadeActive) {
|
1927 | this.runDeactivationUXLogicIfReady();
|
1928 | }
|
1929 | };
|
1930 | MDCRippleFoundation.prototype.layoutInternal = function () {
|
1931 | var _this = this;
|
1932 | this.frame = this.adapter.computeBoundingRect();
|
1933 | var maxDim = Math.max(this.frame.height, this.frame.width);
|
1934 |
|
1935 |
|
1936 |
|
1937 |
|
1938 |
|
1939 |
|
1940 | var getBoundedRadius = function getBoundedRadius() {
|
1941 | var hypotenuse = Math.sqrt(Math.pow(_this.frame.width, 2) + Math.pow(_this.frame.height, 2));
|
1942 | return hypotenuse + MDCRippleFoundation.numbers.PADDING;
|
1943 | };
|
1944 | this.maxRadius = this.adapter.isUnbounded() ? maxDim : getBoundedRadius();
|
1945 |
|
1946 | var initialSize = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE);
|
1947 |
|
1948 | if (this.adapter.isUnbounded() && initialSize % 2 !== 0) {
|
1949 | this.initialSize = initialSize - 1;
|
1950 | } else {
|
1951 | this.initialSize = initialSize;
|
1952 | }
|
1953 | this.fgScale = "" + this.maxRadius / this.initialSize;
|
1954 | this.updateLayoutCssVars();
|
1955 | };
|
1956 | MDCRippleFoundation.prototype.updateLayoutCssVars = function () {
|
1957 | var _a = MDCRippleFoundation.strings,
|
1958 | VAR_FG_SIZE = _a.VAR_FG_SIZE,
|
1959 | VAR_LEFT = _a.VAR_LEFT,
|
1960 | VAR_TOP = _a.VAR_TOP,
|
1961 | VAR_FG_SCALE = _a.VAR_FG_SCALE;
|
1962 | this.adapter.updateCssVariable(VAR_FG_SIZE, this.initialSize + "px");
|
1963 | this.adapter.updateCssVariable(VAR_FG_SCALE, this.fgScale);
|
1964 | if (this.adapter.isUnbounded()) {
|
1965 | this.unboundedCoords = {
|
1966 | left: Math.round(this.frame.width / 2 - this.initialSize / 2),
|
1967 | top: Math.round(this.frame.height / 2 - this.initialSize / 2)
|
1968 | };
|
1969 | this.adapter.updateCssVariable(VAR_LEFT, this.unboundedCoords.left + "px");
|
1970 | this.adapter.updateCssVariable(VAR_TOP, this.unboundedCoords.top + "px");
|
1971 | }
|
1972 | };
|
1973 | return MDCRippleFoundation;
|
1974 | }(foundation_1.MDCFoundation);
|
1975 | exports.MDCRippleFoundation = MDCRippleFoundation;
|
1976 |
|
1977 | exports.default = MDCRippleFoundation;
|
1978 |
|
1979 | }),
|
1980 |
|
1981 | "./packages/mdc-ripple/util.ts":
|
1982 |
|
1983 |
|
1984 |
|
1985 |
|
1986 | (function(module, exports, __webpack_require__) {
|
1987 |
|
1988 | "use strict";
|
1989 |
|
1990 |
|
1991 | Object.defineProperty(exports, "__esModule", { value: true });
|
1992 | exports.getNormalizedEventCoords = exports.supportsCssVariables = void 0;
|
1993 |
|
1994 |
|
1995 |
|
1996 |
|
1997 | var supportsCssVariables_;
|
1998 | function supportsCssVariables(windowObj, forceRefresh) {
|
1999 | if (forceRefresh === void 0) {
|
2000 | forceRefresh = false;
|
2001 | }
|
2002 | var CSS = windowObj.CSS;
|
2003 | var supportsCssVars = supportsCssVariables_;
|
2004 | if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) {
|
2005 | return supportsCssVariables_;
|
2006 | }
|
2007 | var supportsFunctionPresent = CSS && typeof CSS.supports === 'function';
|
2008 | if (!supportsFunctionPresent) {
|
2009 | return false;
|
2010 | }
|
2011 | var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes');
|
2012 |
|
2013 |
|
2014 | var weAreFeatureDetectingSafari10plus = CSS.supports('(--css-vars: yes)') && CSS.supports('color', '#00000000');
|
2015 | supportsCssVars = explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus;
|
2016 | if (!forceRefresh) {
|
2017 | supportsCssVariables_ = supportsCssVars;
|
2018 | }
|
2019 | return supportsCssVars;
|
2020 | }
|
2021 | exports.supportsCssVariables = supportsCssVariables;
|
2022 | function getNormalizedEventCoords(evt, pageOffset, clientRect) {
|
2023 | if (!evt) {
|
2024 | return { x: 0, y: 0 };
|
2025 | }
|
2026 | var x = pageOffset.x,
|
2027 | y = pageOffset.y;
|
2028 | var documentX = x + clientRect.left;
|
2029 | var documentY = y + clientRect.top;
|
2030 | var normalizedX;
|
2031 | var normalizedY;
|
2032 |
|
2033 | if (evt.type === 'touchstart') {
|
2034 | var touchEvent = evt;
|
2035 | normalizedX = touchEvent.changedTouches[0].pageX - documentX;
|
2036 | normalizedY = touchEvent.changedTouches[0].pageY - documentY;
|
2037 | } else {
|
2038 | var mouseEvent = evt;
|
2039 | normalizedX = mouseEvent.pageX - documentX;
|
2040 | normalizedY = mouseEvent.pageY - documentY;
|
2041 | }
|
2042 | return { x: normalizedX, y: normalizedY };
|
2043 | }
|
2044 | exports.getNormalizedEventCoords = getNormalizedEventCoords;
|
2045 |
|
2046 | }),
|
2047 |
|
2048 | "./packages/mdc-switch/adapter.ts":
|
2049 |
|
2050 |
|
2051 |
|
2052 |
|
2053 | (function(module, exports, __webpack_require__) {
|
2054 |
|
2055 | "use strict";
|
2056 |
|
2057 |
|
2058 |
|
2059 |
|
2060 |
|
2061 |
|
2062 |
|
2063 |
|
2064 |
|
2065 |
|
2066 |
|
2067 |
|
2068 |
|
2069 |
|
2070 |
|
2071 |
|
2072 |
|
2073 |
|
2074 |
|
2075 |
|
2076 |
|
2077 |
|
2078 |
|
2079 |
|
2080 | Object.defineProperty(exports, "__esModule", { value: true });
|
2081 |
|
2082 | }),
|
2083 |
|
2084 | "./packages/mdc-switch/component.ts":
|
2085 |
|
2086 |
|
2087 |
|
2088 |
|
2089 | (function(module, exports, __webpack_require__) {
|
2090 |
|
2091 | "use strict";
|
2092 |
|
2093 |
|
2094 |
|
2095 |
|
2096 |
|
2097 |
|
2098 |
|
2099 |
|
2100 |
|
2101 |
|
2102 |
|
2103 |
|
2104 |
|
2105 |
|
2106 |
|
2107 |
|
2108 |
|
2109 |
|
2110 |
|
2111 |
|
2112 |
|
2113 |
|
2114 |
|
2115 |
|
2116 | var __extends = this && this.__extends || function () {
|
2117 | var _extendStatics = function extendStatics(d, b) {
|
2118 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
2119 | d.__proto__ = b;
|
2120 | } || function (d, b) {
|
2121 | for (var p in b) {
|
2122 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
2123 | }
|
2124 | };
|
2125 | return _extendStatics(d, b);
|
2126 | };
|
2127 | return function (d, b) {
|
2128 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
2129 | _extendStatics(d, b);
|
2130 | function __() {
|
2131 | this.constructor = d;
|
2132 | }
|
2133 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
2134 | };
|
2135 | }();
|
2136 | var __assign = this && this.__assign || function () {
|
2137 | __assign = Object.assign || function (t) {
|
2138 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
2139 | s = arguments[i];
|
2140 | for (var p in s) {
|
2141 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
2142 | }
|
2143 | }
|
2144 | return t;
|
2145 | };
|
2146 | return __assign.apply(this, arguments);
|
2147 | };
|
2148 | Object.defineProperty(exports, "__esModule", { value: true });
|
2149 | exports.MDCSwitch = void 0;
|
2150 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
2151 | var component_2 = __webpack_require__( "./packages/mdc-ripple/component.ts");
|
2152 | var foundation_1 = __webpack_require__( "./packages/mdc-ripple/foundation.ts");
|
2153 | var constants_1 = __webpack_require__( "./packages/mdc-switch/constants.ts");
|
2154 | var foundation_2 = __webpack_require__( "./packages/mdc-switch/foundation.ts");
|
2155 |
|
2156 |
|
2157 |
|
2158 | var MDCSwitch = function (_super) {
|
2159 | __extends(MDCSwitch, _super);
|
2160 | function MDCSwitch(root, foundation) {
|
2161 | var _this = _super.call(this, root, foundation) || this;
|
2162 | _this.root = root;
|
2163 | return _this;
|
2164 | }
|
2165 | |
2166 |
|
2167 |
|
2168 |
|
2169 |
|
2170 | MDCSwitch.attachTo = function (root) {
|
2171 | return new MDCSwitch(root);
|
2172 | };
|
2173 | MDCSwitch.prototype.initialize = function () {
|
2174 | this.ripple = new component_2.MDCRipple(this.root, this.createRippleFoundation());
|
2175 | };
|
2176 | MDCSwitch.prototype.initialSyncWithDOM = function () {
|
2177 | var rippleElement = this.root.querySelector(constants_1.Selectors.RIPPLE);
|
2178 | if (!rippleElement) {
|
2179 | throw new Error("Switch " + constants_1.Selectors.RIPPLE + " element is required.");
|
2180 | }
|
2181 | this.rippleElement = rippleElement;
|
2182 | this.root.addEventListener('click', this.foundation.handleClick);
|
2183 | this.foundation.initFromDOM();
|
2184 | };
|
2185 | MDCSwitch.prototype.destroy = function () {
|
2186 | _super.prototype.destroy.call(this);
|
2187 | this.ripple.destroy();
|
2188 | this.root.removeEventListener('click', this.foundation.handleClick);
|
2189 | };
|
2190 | MDCSwitch.prototype.getDefaultFoundation = function () {
|
2191 | return new foundation_2.MDCSwitchRenderFoundation(this.createAdapter());
|
2192 | };
|
2193 | MDCSwitch.prototype.createAdapter = function () {
|
2194 | var _this = this;
|
2195 | return {
|
2196 | addClass: function addClass(className) {
|
2197 | _this.root.classList.add(className);
|
2198 | },
|
2199 | hasClass: function hasClass(className) {
|
2200 | return _this.root.classList.contains(className);
|
2201 | },
|
2202 | isDisabled: function isDisabled() {
|
2203 | return _this.root.disabled;
|
2204 | },
|
2205 | removeClass: function removeClass(className) {
|
2206 | _this.root.classList.remove(className);
|
2207 | },
|
2208 | setAriaChecked: function setAriaChecked(ariaChecked) {
|
2209 | return _this.root.setAttribute('aria-checked', ariaChecked);
|
2210 | },
|
2211 | setDisabled: function setDisabled(disabled) {
|
2212 | _this.root.disabled = disabled;
|
2213 | },
|
2214 | state: this
|
2215 | };
|
2216 | };
|
2217 | MDCSwitch.prototype.createRippleFoundation = function () {
|
2218 | return new foundation_1.MDCRippleFoundation(this.createRippleAdapter());
|
2219 | };
|
2220 | MDCSwitch.prototype.createRippleAdapter = function () {
|
2221 | var _this = this;
|
2222 | return __assign(__assign({}, component_2.MDCRipple.createAdapter(this)), { computeBoundingRect: function computeBoundingRect() {
|
2223 | return _this.rippleElement.getBoundingClientRect();
|
2224 | }, isUnbounded: function isUnbounded() {
|
2225 | return true;
|
2226 | } });
|
2227 | };
|
2228 | return MDCSwitch;
|
2229 | }(component_1.MDCComponent);
|
2230 | exports.MDCSwitch = MDCSwitch;
|
2231 |
|
2232 | }),
|
2233 |
|
2234 | "./packages/mdc-switch/constants.ts":
|
2235 |
|
2236 |
|
2237 |
|
2238 |
|
2239 | (function(module, exports, __webpack_require__) {
|
2240 |
|
2241 | "use strict";
|
2242 |
|
2243 |
|
2244 |
|
2245 |
|
2246 |
|
2247 |
|
2248 |
|
2249 |
|
2250 |
|
2251 |
|
2252 |
|
2253 |
|
2254 |
|
2255 |
|
2256 |
|
2257 |
|
2258 |
|
2259 |
|
2260 |
|
2261 |
|
2262 |
|
2263 |
|
2264 |
|
2265 |
|
2266 | Object.defineProperty(exports, "__esModule", { value: true });
|
2267 | exports.Selectors = exports.CssClasses = void 0;
|
2268 |
|
2269 |
|
2270 |
|
2271 | var CssClasses;
|
2272 | (function (CssClasses) {
|
2273 | CssClasses["PROCESSING"] = "mdc-switch--processing";
|
2274 | CssClasses["SELECTED"] = "mdc-switch--selected";
|
2275 | CssClasses["UNSELECTED"] = "mdc-switch--unselected";
|
2276 | })(CssClasses = exports.CssClasses || (exports.CssClasses = {}));
|
2277 |
|
2278 |
|
2279 |
|
2280 | var Selectors;
|
2281 | (function (Selectors) {
|
2282 | Selectors["RIPPLE"] = ".mdc-switch__ripple";
|
2283 | })(Selectors = exports.Selectors || (exports.Selectors = {}));
|
2284 |
|
2285 | }),
|
2286 |
|
2287 | "./packages/mdc-switch/deprecated/adapter.ts":
|
2288 |
|
2289 |
|
2290 |
|
2291 |
|
2292 | (function(module, exports, __webpack_require__) {
|
2293 |
|
2294 | "use strict";
|
2295 |
|
2296 |
|
2297 |
|
2298 |
|
2299 |
|
2300 |
|
2301 |
|
2302 |
|
2303 |
|
2304 |
|
2305 |
|
2306 |
|
2307 |
|
2308 |
|
2309 |
|
2310 |
|
2311 |
|
2312 |
|
2313 |
|
2314 |
|
2315 |
|
2316 |
|
2317 |
|
2318 |
|
2319 | Object.defineProperty(exports, "__esModule", { value: true });
|
2320 |
|
2321 | }),
|
2322 |
|
2323 | "./packages/mdc-switch/deprecated/component.ts":
|
2324 |
|
2325 |
|
2326 |
|
2327 |
|
2328 | (function(module, exports, __webpack_require__) {
|
2329 |
|
2330 | "use strict";
|
2331 |
|
2332 |
|
2333 |
|
2334 |
|
2335 |
|
2336 |
|
2337 |
|
2338 |
|
2339 |
|
2340 |
|
2341 |
|
2342 |
|
2343 |
|
2344 |
|
2345 |
|
2346 |
|
2347 |
|
2348 |
|
2349 |
|
2350 |
|
2351 |
|
2352 |
|
2353 |
|
2354 |
|
2355 | var __extends = this && this.__extends || function () {
|
2356 | var _extendStatics = function extendStatics(d, b) {
|
2357 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
2358 | d.__proto__ = b;
|
2359 | } || function (d, b) {
|
2360 | for (var p in b) {
|
2361 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
2362 | }
|
2363 | };
|
2364 | return _extendStatics(d, b);
|
2365 | };
|
2366 | return function (d, b) {
|
2367 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
2368 | _extendStatics(d, b);
|
2369 | function __() {
|
2370 | this.constructor = d;
|
2371 | }
|
2372 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
2373 | };
|
2374 | }();
|
2375 | var __assign = this && this.__assign || function () {
|
2376 | __assign = Object.assign || function (t) {
|
2377 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
2378 | s = arguments[i];
|
2379 | for (var p in s) {
|
2380 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
2381 | }
|
2382 | }
|
2383 | return t;
|
2384 | };
|
2385 | return __assign.apply(this, arguments);
|
2386 | };
|
2387 | var __read = this && this.__read || function (o, n) {
|
2388 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
2389 | if (!m) return o;
|
2390 | var i = m.call(o),
|
2391 | r,
|
2392 | ar = [],
|
2393 | e;
|
2394 | try {
|
2395 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
2396 | ar.push(r.value);
|
2397 | }
|
2398 | } catch (error) {
|
2399 | e = { error: error };
|
2400 | } finally {
|
2401 | try {
|
2402 | if (r && !r.done && (m = i["return"])) m.call(i);
|
2403 | } finally {
|
2404 | if (e) throw e.error;
|
2405 | }
|
2406 | }
|
2407 | return ar;
|
2408 | };
|
2409 | var __spreadArray = this && this.__spreadArray || function (to, from) {
|
2410 | for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) {
|
2411 | to[j] = from[i];
|
2412 | }return to;
|
2413 | };
|
2414 | Object.defineProperty(exports, "__esModule", { value: true });
|
2415 | exports.MDCSwitch = void 0;
|
2416 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
2417 | var events_1 = __webpack_require__( "./packages/mdc-dom/events.ts");
|
2418 | var ponyfill_1 = __webpack_require__( "./packages/mdc-dom/ponyfill.ts");
|
2419 | var component_2 = __webpack_require__( "./packages/mdc-ripple/component.ts");
|
2420 | var foundation_1 = __webpack_require__( "./packages/mdc-ripple/foundation.ts");
|
2421 | var foundation_2 = __webpack_require__( "./packages/mdc-switch/deprecated/foundation.ts");
|
2422 | var MDCSwitch = function (_super) {
|
2423 | __extends(MDCSwitch, _super);
|
2424 | function MDCSwitch() {
|
2425 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
2426 | _this.rippleSurface = _this.createRipple();
|
2427 | return _this;
|
2428 | }
|
2429 | MDCSwitch.attachTo = function (root) {
|
2430 | return new MDCSwitch(root);
|
2431 | };
|
2432 | MDCSwitch.prototype.destroy = function () {
|
2433 | _super.prototype.destroy.call(this);
|
2434 | this.rippleSurface.destroy();
|
2435 | this.nativeControl.removeEventListener('change', this.changeHandler);
|
2436 | };
|
2437 | MDCSwitch.prototype.initialSyncWithDOM = function () {
|
2438 | var _this = this;
|
2439 | this.changeHandler = function () {
|
2440 | var _a;
|
2441 | var args = [];
|
2442 | for (var _i = 0; _i < arguments.length; _i++) {
|
2443 | args[_i] = arguments[_i];
|
2444 | }
|
2445 | (_a = _this.foundation).handleChange.apply(_a, __spreadArray([], __read(args)));
|
2446 | };
|
2447 | this.nativeControl.addEventListener('change', this.changeHandler);
|
2448 |
|
2449 |
|
2450 |
|
2451 | this.checked = this.checked;
|
2452 | };
|
2453 | MDCSwitch.prototype.getDefaultFoundation = function () {
|
2454 | var _this = this;
|
2455 |
|
2456 |
|
2457 | var adapter = {
|
2458 | addClass: function addClass(className) {
|
2459 | return _this.root.classList.add(className);
|
2460 | },
|
2461 | removeClass: function removeClass(className) {
|
2462 | return _this.root.classList.remove(className);
|
2463 | },
|
2464 | setNativeControlChecked: function setNativeControlChecked(checked) {
|
2465 | return _this.nativeControl.checked = checked;
|
2466 | },
|
2467 | setNativeControlDisabled: function setNativeControlDisabled(disabled) {
|
2468 | return _this.nativeControl.disabled = disabled;
|
2469 | },
|
2470 | setNativeControlAttr: function setNativeControlAttr(attr, value) {
|
2471 | _this.nativeControl.setAttribute(attr, value);
|
2472 | }
|
2473 | };
|
2474 | return new foundation_2.MDCSwitchFoundation(adapter);
|
2475 | };
|
2476 | Object.defineProperty(MDCSwitch.prototype, "ripple", {
|
2477 | get: function get() {
|
2478 | return this.rippleSurface;
|
2479 | },
|
2480 | enumerable: false,
|
2481 | configurable: true
|
2482 | });
|
2483 | Object.defineProperty(MDCSwitch.prototype, "checked", {
|
2484 | get: function get() {
|
2485 | return this.nativeControl.checked;
|
2486 | },
|
2487 | set: function set(checked) {
|
2488 | this.foundation.setChecked(checked);
|
2489 | },
|
2490 | enumerable: false,
|
2491 | configurable: true
|
2492 | });
|
2493 | Object.defineProperty(MDCSwitch.prototype, "disabled", {
|
2494 | get: function get() {
|
2495 | return this.nativeControl.disabled;
|
2496 | },
|
2497 | set: function set(disabled) {
|
2498 | this.foundation.setDisabled(disabled);
|
2499 | },
|
2500 | enumerable: false,
|
2501 | configurable: true
|
2502 | });
|
2503 | MDCSwitch.prototype.createRipple = function () {
|
2504 | var _this = this;
|
2505 | var RIPPLE_SURFACE_SELECTOR = foundation_2.MDCSwitchFoundation.strings.RIPPLE_SURFACE_SELECTOR;
|
2506 | var rippleSurface = this.root.querySelector(RIPPLE_SURFACE_SELECTOR);
|
2507 |
|
2508 |
|
2509 | var adapter = __assign(__assign({}, component_2.MDCRipple.createAdapter(this)), { addClass: function addClass(className) {
|
2510 | return rippleSurface.classList.add(className);
|
2511 | }, computeBoundingRect: function computeBoundingRect() {
|
2512 | return rippleSurface.getBoundingClientRect();
|
2513 | }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
|
2514 | _this.nativeControl.removeEventListener(evtType, handler, events_1.applyPassive());
|
2515 | }, isSurfaceActive: function isSurfaceActive() {
|
2516 | return ponyfill_1.matches(_this.nativeControl, ':active');
|
2517 | }, isUnbounded: function isUnbounded() {
|
2518 | return true;
|
2519 | }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
|
2520 | _this.nativeControl.addEventListener(evtType, handler, events_1.applyPassive());
|
2521 | }, removeClass: function removeClass(className) {
|
2522 | rippleSurface.classList.remove(className);
|
2523 | }, updateCssVariable: function updateCssVariable(varName, value) {
|
2524 | rippleSurface.style.setProperty(varName, value);
|
2525 | } });
|
2526 | return new component_2.MDCRipple(this.root, new foundation_1.MDCRippleFoundation(adapter));
|
2527 | };
|
2528 | Object.defineProperty(MDCSwitch.prototype, "nativeControl", {
|
2529 | get: function get() {
|
2530 | var NATIVE_CONTROL_SELECTOR = foundation_2.MDCSwitchFoundation.strings.NATIVE_CONTROL_SELECTOR;
|
2531 | return this.root.querySelector(NATIVE_CONTROL_SELECTOR);
|
2532 | },
|
2533 | enumerable: false,
|
2534 | configurable: true
|
2535 | });
|
2536 | return MDCSwitch;
|
2537 | }(component_1.MDCComponent);
|
2538 | exports.MDCSwitch = MDCSwitch;
|
2539 |
|
2540 | }),
|
2541 |
|
2542 | "./packages/mdc-switch/deprecated/constants.ts":
|
2543 |
|
2544 |
|
2545 |
|
2546 |
|
2547 | (function(module, exports, __webpack_require__) {
|
2548 |
|
2549 | "use strict";
|
2550 |
|
2551 |
|
2552 |
|
2553 |
|
2554 |
|
2555 |
|
2556 |
|
2557 |
|
2558 |
|
2559 |
|
2560 |
|
2561 |
|
2562 |
|
2563 |
|
2564 |
|
2565 |
|
2566 |
|
2567 |
|
2568 |
|
2569 |
|
2570 |
|
2571 |
|
2572 |
|
2573 |
|
2574 | Object.defineProperty(exports, "__esModule", { value: true });
|
2575 | exports.strings = exports.cssClasses = void 0;
|
2576 |
|
2577 | var cssClasses = {
|
2578 |
|
2579 | CHECKED: 'mdc-switch--checked',
|
2580 |
|
2581 | DISABLED: 'mdc-switch--disabled'
|
2582 | };
|
2583 | exports.cssClasses = cssClasses;
|
2584 |
|
2585 | var strings = {
|
2586 |
|
2587 | ARIA_CHECKED_ATTR: 'aria-checked',
|
2588 |
|
2589 | NATIVE_CONTROL_SELECTOR: '.mdc-switch__native-control',
|
2590 |
|
2591 | RIPPLE_SURFACE_SELECTOR: '.mdc-switch__thumb-underlay'
|
2592 | };
|
2593 | exports.strings = strings;
|
2594 |
|
2595 | }),
|
2596 |
|
2597 | "./packages/mdc-switch/deprecated/foundation.ts":
|
2598 |
|
2599 |
|
2600 |
|
2601 |
|
2602 | (function(module, exports, __webpack_require__) {
|
2603 |
|
2604 | "use strict";
|
2605 |
|
2606 |
|
2607 |
|
2608 |
|
2609 |
|
2610 |
|
2611 |
|
2612 |
|
2613 |
|
2614 |
|
2615 |
|
2616 |
|
2617 |
|
2618 |
|
2619 |
|
2620 |
|
2621 |
|
2622 |
|
2623 |
|
2624 |
|
2625 |
|
2626 |
|
2627 |
|
2628 |
|
2629 | var __extends = this && this.__extends || function () {
|
2630 | var _extendStatics = function extendStatics(d, b) {
|
2631 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
2632 | d.__proto__ = b;
|
2633 | } || function (d, b) {
|
2634 | for (var p in b) {
|
2635 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
2636 | }
|
2637 | };
|
2638 | return _extendStatics(d, b);
|
2639 | };
|
2640 | return function (d, b) {
|
2641 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
2642 | _extendStatics(d, b);
|
2643 | function __() {
|
2644 | this.constructor = d;
|
2645 | }
|
2646 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
2647 | };
|
2648 | }();
|
2649 | var __assign = this && this.__assign || function () {
|
2650 | __assign = Object.assign || function (t) {
|
2651 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
2652 | s = arguments[i];
|
2653 | for (var p in s) {
|
2654 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
2655 | }
|
2656 | }
|
2657 | return t;
|
2658 | };
|
2659 | return __assign.apply(this, arguments);
|
2660 | };
|
2661 | Object.defineProperty(exports, "__esModule", { value: true });
|
2662 | exports.MDCSwitchFoundation = void 0;
|
2663 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
2664 | var constants_1 = __webpack_require__( "./packages/mdc-switch/deprecated/constants.ts");
|
2665 | var MDCSwitchFoundation = function (_super) {
|
2666 | __extends(MDCSwitchFoundation, _super);
|
2667 | function MDCSwitchFoundation(adapter) {
|
2668 | return _super.call(this, __assign(__assign({}, MDCSwitchFoundation.defaultAdapter), adapter)) || this;
|
2669 | }
|
2670 | Object.defineProperty(MDCSwitchFoundation, "strings", {
|
2671 |
|
2672 | get: function get() {
|
2673 | return constants_1.strings;
|
2674 | },
|
2675 | enumerable: false,
|
2676 | configurable: true
|
2677 | });
|
2678 | Object.defineProperty(MDCSwitchFoundation, "cssClasses", {
|
2679 |
|
2680 | get: function get() {
|
2681 | return constants_1.cssClasses;
|
2682 | },
|
2683 | enumerable: false,
|
2684 | configurable: true
|
2685 | });
|
2686 | Object.defineProperty(MDCSwitchFoundation, "defaultAdapter", {
|
2687 |
|
2688 | get: function get() {
|
2689 | return {
|
2690 | addClass: function addClass() {
|
2691 | return undefined;
|
2692 | },
|
2693 | removeClass: function removeClass() {
|
2694 | return undefined;
|
2695 | },
|
2696 | setNativeControlChecked: function setNativeControlChecked() {
|
2697 | return undefined;
|
2698 | },
|
2699 | setNativeControlDisabled: function setNativeControlDisabled() {
|
2700 | return undefined;
|
2701 | },
|
2702 | setNativeControlAttr: function setNativeControlAttr() {
|
2703 | return undefined;
|
2704 | }
|
2705 | };
|
2706 | },
|
2707 | enumerable: false,
|
2708 | configurable: true
|
2709 | });
|
2710 |
|
2711 | MDCSwitchFoundation.prototype.setChecked = function (checked) {
|
2712 | this.adapter.setNativeControlChecked(checked);
|
2713 | this.updateAriaChecked(checked);
|
2714 | this.updateCheckedStyling(checked);
|
2715 | };
|
2716 |
|
2717 | MDCSwitchFoundation.prototype.setDisabled = function (disabled) {
|
2718 | this.adapter.setNativeControlDisabled(disabled);
|
2719 | if (disabled) {
|
2720 | this.adapter.addClass(constants_1.cssClasses.DISABLED);
|
2721 | } else {
|
2722 | this.adapter.removeClass(constants_1.cssClasses.DISABLED);
|
2723 | }
|
2724 | };
|
2725 |
|
2726 | MDCSwitchFoundation.prototype.handleChange = function (evt) {
|
2727 | var nativeControl = evt.target;
|
2728 | this.updateAriaChecked(nativeControl.checked);
|
2729 | this.updateCheckedStyling(nativeControl.checked);
|
2730 | };
|
2731 |
|
2732 | MDCSwitchFoundation.prototype.updateCheckedStyling = function (checked) {
|
2733 | if (checked) {
|
2734 | this.adapter.addClass(constants_1.cssClasses.CHECKED);
|
2735 | } else {
|
2736 | this.adapter.removeClass(constants_1.cssClasses.CHECKED);
|
2737 | }
|
2738 | };
|
2739 | MDCSwitchFoundation.prototype.updateAriaChecked = function (checked) {
|
2740 | this.adapter.setNativeControlAttr(constants_1.strings.ARIA_CHECKED_ATTR, "" + !!checked);
|
2741 | };
|
2742 | return MDCSwitchFoundation;
|
2743 | }(foundation_1.MDCFoundation);
|
2744 | exports.MDCSwitchFoundation = MDCSwitchFoundation;
|
2745 |
|
2746 | exports.default = MDCSwitchFoundation;
|
2747 |
|
2748 | }),
|
2749 |
|
2750 | "./packages/mdc-switch/deprecated/index.ts":
|
2751 |
|
2752 |
|
2753 |
|
2754 |
|
2755 | (function(module, exports, __webpack_require__) {
|
2756 |
|
2757 | "use strict";
|
2758 |
|
2759 |
|
2760 |
|
2761 |
|
2762 |
|
2763 |
|
2764 |
|
2765 |
|
2766 |
|
2767 |
|
2768 |
|
2769 |
|
2770 |
|
2771 |
|
2772 |
|
2773 |
|
2774 |
|
2775 |
|
2776 |
|
2777 |
|
2778 |
|
2779 |
|
2780 |
|
2781 |
|
2782 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
2783 | if (k2 === undefined) k2 = k;
|
2784 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
2785 | return m[k];
|
2786 | } });
|
2787 | } : function (o, m, k, k2) {
|
2788 | if (k2 === undefined) k2 = k;
|
2789 | o[k2] = m[k];
|
2790 | });
|
2791 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
2792 | for (var p in m) {
|
2793 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
2794 | }
|
2795 | };
|
2796 | Object.defineProperty(exports, "__esModule", { value: true });
|
2797 | __exportStar(__webpack_require__( "./packages/mdc-switch/deprecated/adapter.ts"), exports);
|
2798 | __exportStar(__webpack_require__( "./packages/mdc-switch/deprecated/component.ts"), exports);
|
2799 | __exportStar(__webpack_require__( "./packages/mdc-switch/deprecated/constants.ts"), exports);
|
2800 | __exportStar(__webpack_require__( "./packages/mdc-switch/deprecated/foundation.ts"), exports);
|
2801 |
|
2802 | }),
|
2803 |
|
2804 | "./packages/mdc-switch/foundation.ts":
|
2805 |
|
2806 |
|
2807 |
|
2808 |
|
2809 | (function(module, exports, __webpack_require__) {
|
2810 |
|
2811 | "use strict";
|
2812 |
|
2813 |
|
2814 |
|
2815 |
|
2816 |
|
2817 |
|
2818 |
|
2819 |
|
2820 |
|
2821 |
|
2822 |
|
2823 |
|
2824 |
|
2825 |
|
2826 |
|
2827 |
|
2828 |
|
2829 |
|
2830 |
|
2831 |
|
2832 |
|
2833 |
|
2834 |
|
2835 |
|
2836 | var __extends = this && this.__extends || function () {
|
2837 | var _extendStatics = function extendStatics(d, b) {
|
2838 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
2839 | d.__proto__ = b;
|
2840 | } || function (d, b) {
|
2841 | for (var p in b) {
|
2842 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
2843 | }
|
2844 | };
|
2845 | return _extendStatics(d, b);
|
2846 | };
|
2847 | return function (d, b) {
|
2848 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
2849 | _extendStatics(d, b);
|
2850 | function __() {
|
2851 | this.constructor = d;
|
2852 | }
|
2853 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
2854 | };
|
2855 | }();
|
2856 | Object.defineProperty(exports, "__esModule", { value: true });
|
2857 | exports.MDCSwitchRenderFoundation = exports.MDCSwitchFoundation = void 0;
|
2858 | var observer_foundation_1 = __webpack_require__( "./packages/mdc-base/observer-foundation.ts");
|
2859 | var constants_1 = __webpack_require__( "./packages/mdc-switch/constants.ts");
|
2860 |
|
2861 |
|
2862 |
|
2863 |
|
2864 |
|
2865 |
|
2866 |
|
2867 | var MDCSwitchFoundation = function (_super) {
|
2868 | __extends(MDCSwitchFoundation, _super);
|
2869 | function MDCSwitchFoundation(adapter) {
|
2870 | var _this = _super.call(this, adapter) || this;
|
2871 | _this.handleClick = _this.handleClick.bind(_this);
|
2872 | return _this;
|
2873 | }
|
2874 | |
2875 |
|
2876 |
|
2877 | MDCSwitchFoundation.prototype.init = function () {
|
2878 | this.observe(this.adapter.state, {
|
2879 | disabled: this.stopProcessingIfDisabled,
|
2880 | processing: this.stopProcessingIfDisabled
|
2881 | });
|
2882 | };
|
2883 | |
2884 |
|
2885 |
|
2886 |
|
2887 | MDCSwitchFoundation.prototype.handleClick = function () {
|
2888 | if (this.adapter.state.disabled) {
|
2889 | return;
|
2890 | }
|
2891 | this.adapter.state.selected = !this.adapter.state.selected;
|
2892 | };
|
2893 | MDCSwitchFoundation.prototype.stopProcessingIfDisabled = function () {
|
2894 | if (this.adapter.state.disabled) {
|
2895 | this.adapter.state.processing = false;
|
2896 | }
|
2897 | };
|
2898 | return MDCSwitchFoundation;
|
2899 | }(observer_foundation_1.MDCObserverFoundation);
|
2900 | exports.MDCSwitchFoundation = MDCSwitchFoundation;
|
2901 |
|
2902 |
|
2903 |
|
2904 |
|
2905 |
|
2906 |
|
2907 |
|
2908 |
|
2909 |
|
2910 |
|
2911 | var MDCSwitchRenderFoundation = function (_super) {
|
2912 | __extends(MDCSwitchRenderFoundation, _super);
|
2913 | function MDCSwitchRenderFoundation() {
|
2914 | return _super !== null && _super.apply(this, arguments) || this;
|
2915 | }
|
2916 | |
2917 |
|
2918 |
|
2919 | MDCSwitchRenderFoundation.prototype.init = function () {
|
2920 | _super.prototype.init.call(this);
|
2921 | this.observe(this.adapter.state, {
|
2922 | disabled: this.onDisabledChange,
|
2923 | processing: this.onProcessingChange,
|
2924 | selected: this.onSelectedChange
|
2925 | });
|
2926 | };
|
2927 | |
2928 |
|
2929 |
|
2930 |
|
2931 |
|
2932 |
|
2933 | MDCSwitchRenderFoundation.prototype.initFromDOM = function () {
|
2934 |
|
2935 | this.setObserversEnabled(this.adapter.state, false);
|
2936 | this.adapter.state.selected = this.adapter.hasClass(constants_1.CssClasses.SELECTED);
|
2937 |
|
2938 | this.onSelectedChange();
|
2939 | this.adapter.state.disabled = this.adapter.isDisabled();
|
2940 | this.adapter.state.processing = this.adapter.hasClass(constants_1.CssClasses.PROCESSING);
|
2941 |
|
2942 | this.setObserversEnabled(this.adapter.state, true);
|
2943 | this.stopProcessingIfDisabled();
|
2944 | };
|
2945 | MDCSwitchRenderFoundation.prototype.onDisabledChange = function () {
|
2946 | this.adapter.setDisabled(this.adapter.state.disabled);
|
2947 | };
|
2948 | MDCSwitchRenderFoundation.prototype.onProcessingChange = function () {
|
2949 | this.toggleClass(this.adapter.state.processing, constants_1.CssClasses.PROCESSING);
|
2950 | };
|
2951 | MDCSwitchRenderFoundation.prototype.onSelectedChange = function () {
|
2952 | this.adapter.setAriaChecked(String(this.adapter.state.selected));
|
2953 | this.toggleClass(this.adapter.state.selected, constants_1.CssClasses.SELECTED);
|
2954 | this.toggleClass(!this.adapter.state.selected, constants_1.CssClasses.UNSELECTED);
|
2955 | };
|
2956 | MDCSwitchRenderFoundation.prototype.toggleClass = function (addClass, className) {
|
2957 | if (addClass) {
|
2958 | this.adapter.addClass(className);
|
2959 | } else {
|
2960 | this.adapter.removeClass(className);
|
2961 | }
|
2962 | };
|
2963 | return MDCSwitchRenderFoundation;
|
2964 | }(MDCSwitchFoundation);
|
2965 | exports.MDCSwitchRenderFoundation = MDCSwitchRenderFoundation;
|
2966 |
|
2967 | }),
|
2968 |
|
2969 | "./packages/mdc-switch/index.ts":
|
2970 |
|
2971 |
|
2972 |
|
2973 |
|
2974 | (function(module, exports, __webpack_require__) {
|
2975 |
|
2976 | "use strict";
|
2977 |
|
2978 |
|
2979 |
|
2980 |
|
2981 |
|
2982 |
|
2983 |
|
2984 |
|
2985 |
|
2986 |
|
2987 |
|
2988 |
|
2989 |
|
2990 |
|
2991 |
|
2992 |
|
2993 |
|
2994 |
|
2995 |
|
2996 |
|
2997 |
|
2998 |
|
2999 |
|
3000 |
|
3001 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
3002 | if (k2 === undefined) k2 = k;
|
3003 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
3004 | return m[k];
|
3005 | } });
|
3006 | } : function (o, m, k, k2) {
|
3007 | if (k2 === undefined) k2 = k;
|
3008 | o[k2] = m[k];
|
3009 | });
|
3010 | var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
3011 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
3012 | } : function (o, v) {
|
3013 | o["default"] = v;
|
3014 | });
|
3015 | var __importStar = this && this.__importStar || function (mod) {
|
3016 | if (mod && mod.__esModule) return mod;
|
3017 | var result = {};
|
3018 | if (mod != null) for (var k in mod) {
|
3019 | if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
3020 | }__setModuleDefault(result, mod);
|
3021 | return result;
|
3022 | };
|
3023 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
3024 | for (var p in m) {
|
3025 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
3026 | }
|
3027 | };
|
3028 | Object.defineProperty(exports, "__esModule", { value: true });
|
3029 | exports.deprecated = void 0;
|
3030 |
|
3031 | var deprecated = __importStar(__webpack_require__( "./packages/mdc-switch/deprecated/index.ts"));
|
3032 | exports.deprecated = deprecated;
|
3033 | __exportStar(__webpack_require__( "./packages/mdc-switch/adapter.ts"), exports);
|
3034 | __exportStar(__webpack_require__( "./packages/mdc-switch/component.ts"), exports);
|
3035 | __exportStar(__webpack_require__( "./packages/mdc-switch/constants.ts"), exports);
|
3036 | __exportStar(__webpack_require__( "./packages/mdc-switch/foundation.ts"), exports);
|
3037 |
|
3038 | })
|
3039 |
|
3040 | });
|
3041 | });
|
3042 |
|
\ | No newline at end of file |