1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | (function webpackUniversalModuleDefinition(root, factory) {
|
7 | if(typeof exports === 'object' && typeof module === 'object')
|
8 | module.exports = factory();
|
9 | else if(typeof define === 'function' && define.amd)
|
10 | define([], factory);
|
11 | else if(typeof exports === 'object')
|
12 | exports["iconToggle"] = factory();
|
13 | else
|
14 | root["mdc"] = root["mdc"] || {}, root["mdc"]["iconToggle"] = factory();
|
15 | })(this, function() {
|
16 | return (function(modules) {
|
17 |
|
18 | var installedModules = {};
|
19 |
|
20 |
|
21 | function __webpack_require__(moduleId) {
|
22 |
|
23 |
|
24 | if(installedModules[moduleId]) {
|
25 | return installedModules[moduleId].exports;
|
26 | }
|
27 |
|
28 | var module = installedModules[moduleId] = {
|
29 | i: moduleId,
|
30 | l: false,
|
31 | exports: {}
|
32 | };
|
33 |
|
34 |
|
35 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
36 |
|
37 |
|
38 | module.l = true;
|
39 |
|
40 |
|
41 | return module.exports;
|
42 | }
|
43 |
|
44 |
|
45 |
|
46 | __webpack_require__.m = modules;
|
47 |
|
48 |
|
49 | __webpack_require__.c = installedModules;
|
50 |
|
51 |
|
52 | __webpack_require__.d = function(exports, name, getter) {
|
53 | if(!__webpack_require__.o(exports, name)) {
|
54 | Object.defineProperty(exports, name, {
|
55 | configurable: false,
|
56 | enumerable: true,
|
57 | get: getter
|
58 | /******/ });
|
59 | /******/ }
|
60 | /******/ };
|
61 | /******/
|
62 | /******/ // getDefaultExport function for compatibility with non-harmony modules
|
63 | /******/ __webpack_require__.n = function(module) {
|
64 | var getter = module && module.__esModule ?
|
65 | function getDefault() { return module['default']; } :
|
66 | function getModuleExports() { return module; };
|
67 | __webpack_require__.d(getter, 'a', getter);
|
68 | return getter;
|
69 | };
|
70 |
|
71 |
|
72 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
73 |
|
74 |
|
75 | __webpack_require__.p = "";
|
76 |
|
77 |
|
78 | return __webpack_require__(__webpack_require__.s = 122);
|
79 | })
|
80 |
|
81 | ({
|
82 |
|
83 | 0:
|
84 | (function(module, __webpack_exports__, __webpack_require__) {
|
85 |
|
86 | "use strict";
|
87 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
88 |
|
89 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
90 |
|
91 |
|
92 |
|
93 |
|
94 |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 |
|
102 |
|
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 |
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 | var MDCFoundation = function () {
|
118 | _createClass(MDCFoundation, null, [{
|
119 | key: "cssClasses",
|
120 |
|
121 |
|
122 | get: function get() {
|
123 |
|
124 |
|
125 | return {};
|
126 | }
|
127 |
|
128 |
|
129 |
|
130 | }, {
|
131 | key: "strings",
|
132 | get: function get() {
|
133 |
|
134 |
|
135 | return {};
|
136 | }
|
137 |
|
138 |
|
139 |
|
140 | }, {
|
141 | key: "numbers",
|
142 | get: function get() {
|
143 |
|
144 |
|
145 | return {};
|
146 | }
|
147 |
|
148 |
|
149 |
|
150 | }, {
|
151 | key: "defaultAdapter",
|
152 | get: function get() {
|
153 |
|
154 |
|
155 |
|
156 | return {};
|
157 | }
|
158 |
|
159 | |
160 |
|
161 |
|
162 |
|
163 | }]);
|
164 |
|
165 | function MDCFoundation() {
|
166 | var adapter = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
167 |
|
168 | _classCallCheck(this, MDCFoundation);
|
169 |
|
170 |
|
171 | this.adapter_ = adapter;
|
172 | }
|
173 |
|
174 | _createClass(MDCFoundation, [{
|
175 | key: "init",
|
176 | value: function init() {
|
177 |
|
178 | }
|
179 | }, {
|
180 | key: "destroy",
|
181 | value: function destroy() {
|
182 |
|
183 | }
|
184 | }]);
|
185 |
|
186 | return MDCFoundation;
|
187 | }();
|
188 |
|
189 | __webpack_exports__["a"] = (MDCFoundation);
|
190 |
|
191 | }),
|
192 |
|
193 | 1:
|
194 | (function(module, __webpack_exports__, __webpack_require__) {
|
195 |
|
196 | "use strict";
|
197 | var __WEBPACK_IMPORTED_MODULE_0__foundation__ = __webpack_require__(0);
|
198 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
199 |
|
200 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
201 |
|
202 |
|
203 |
|
204 |
|
205 |
|
206 |
|
207 |
|
208 |
|
209 |
|
210 |
|
211 |
|
212 |
|
213 |
|
214 |
|
215 |
|
216 |
|
217 |
|
218 |
|
219 |
|
220 |
|
221 |
|
222 |
|
223 |
|
224 |
|
225 |
|
226 |
|
227 |
|
228 |
|
229 |
|
230 |
|
231 | var MDCComponent = function () {
|
232 | _createClass(MDCComponent, null, [{
|
233 | key: 'attachTo',
|
234 |
|
235 | |
236 |
|
237 |
|
238 |
|
239 | value: function attachTo(root) {
|
240 |
|
241 |
|
242 |
|
243 |
|
244 | return new MDCComponent(root, new __WEBPACK_IMPORTED_MODULE_0__foundation__["a" ]());
|
245 | }
|
246 |
|
247 | |
248 |
|
249 |
|
250 |
|
251 |
|
252 |
|
253 | }]);
|
254 |
|
255 | function MDCComponent(root) {
|
256 | var foundation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
|
257 |
|
258 | _classCallCheck(this, MDCComponent);
|
259 |
|
260 |
|
261 | this.root_ = root;
|
262 |
|
263 | for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
264 | args[_key - 2] = arguments[_key];
|
265 | }
|
266 |
|
267 | this.initialize.apply(this, args);
|
268 |
|
269 |
|
270 |
|
271 | this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation;
|
272 | this.foundation_.init();
|
273 | this.initialSyncWithDOM();
|
274 | }
|
275 |
|
276 | _createClass(MDCComponent, [{
|
277 | key: 'initialize',
|
278 | value: function initialize() /* ...args */{}
|
279 |
|
280 |
|
281 |
|
282 |
|
283 |
|
284 | |
285 |
|
286 |
|
287 |
|
288 | }, {
|
289 | key: 'getDefaultFoundation',
|
290 | value: function getDefaultFoundation() {
|
291 |
|
292 |
|
293 | throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class');
|
294 | }
|
295 | }, {
|
296 | key: 'initialSyncWithDOM',
|
297 | value: function initialSyncWithDOM() {
|
298 |
|
299 |
|
300 |
|
301 |
|
302 | }
|
303 | }, {
|
304 | key: 'destroy',
|
305 | value: function destroy() {
|
306 |
|
307 |
|
308 | this.foundation_.destroy();
|
309 | }
|
310 |
|
311 | |
312 |
|
313 |
|
314 |
|
315 |
|
316 |
|
317 |
|
318 | }, {
|
319 | key: 'listen',
|
320 | value: function listen(evtType, handler) {
|
321 | this.root_.addEventListener(evtType, handler);
|
322 | }
|
323 |
|
324 | |
325 |
|
326 |
|
327 |
|
328 |
|
329 |
|
330 |
|
331 | }, {
|
332 | key: 'unlisten',
|
333 | value: function unlisten(evtType, handler) {
|
334 | this.root_.removeEventListener(evtType, handler);
|
335 | }
|
336 |
|
337 | |
338 |
|
339 |
|
340 |
|
341 |
|
342 |
|
343 |
|
344 |
|
345 | }, {
|
346 | key: 'emit',
|
347 | value: function emit(evtType, evtData) {
|
348 | var shouldBubble = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
349 |
|
350 | var evt = void 0;
|
351 | if (typeof CustomEvent === 'function') {
|
352 | evt = new CustomEvent(evtType, {
|
353 | detail: evtData,
|
354 | bubbles: shouldBubble
|
355 | });
|
356 | } else {
|
357 | evt = document.createEvent('CustomEvent');
|
358 | evt.initCustomEvent(evtType, shouldBubble, false, evtData);
|
359 | }
|
360 |
|
361 | this.root_.dispatchEvent(evt);
|
362 | }
|
363 | }]);
|
364 |
|
365 | return MDCComponent;
|
366 | }();
|
367 |
|
368 | __webpack_exports__["a"] = (MDCComponent);
|
369 |
|
370 | }),
|
371 |
|
372 | 122:
|
373 | (function(module, __webpack_exports__, __webpack_require__) {
|
374 |
|
375 | "use strict";
|
376 | Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
377 | __webpack_require__.d(__webpack_exports__, "MDCIconToggle", function() { return MDCIconToggle; });
|
378 | var __WEBPACK_IMPORTED_MODULE_0__material_base_component__ = __webpack_require__(1);
|
379 | var __WEBPACK_IMPORTED_MODULE_1__foundation__ = __webpack_require__(123);
|
380 | var __WEBPACK_IMPORTED_MODULE_2__material_ripple_index__ = __webpack_require__(4);
|
381 | __webpack_require__.d(__webpack_exports__, "MDCIconToggleFoundation", function() { return __WEBPACK_IMPORTED_MODULE_1__foundation__["a"]; });
|
382 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
383 |
|
384 | var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
|
385 |
|
386 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
387 |
|
388 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
389 |
|
390 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
391 |
|
392 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
393 |
|
394 |
|
395 |
|
396 |
|
397 |
|
398 |
|
399 |
|
400 |
|
401 |
|
402 |
|
403 |
|
404 |
|
405 |
|
406 |
|
407 |
|
408 |
|
409 |
|
410 |
|
411 |
|
412 |
|
413 |
|
414 |
|
415 |
|
416 |
|
417 |
|
418 |
|
419 |
|
420 |
|
421 |
|
422 |
|
423 |
|
424 |
|
425 | var MDCIconToggle = function (_MDCComponent) {
|
426 | _inherits(MDCIconToggle, _MDCComponent);
|
427 |
|
428 | _createClass(MDCIconToggle, null, [{
|
429 | key: 'attachTo',
|
430 | value: function attachTo(root) {
|
431 | return new MDCIconToggle(root);
|
432 | }
|
433 | }]);
|
434 |
|
435 | function MDCIconToggle() {
|
436 | var _ref;
|
437 |
|
438 | _classCallCheck(this, MDCIconToggle);
|
439 |
|
440 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
441 | args[_key] = arguments[_key];
|
442 | }
|
443 |
|
444 |
|
445 | var _this = _possibleConstructorReturn(this, (_ref = MDCIconToggle.__proto__ || Object.getPrototypeOf(MDCIconToggle)).call.apply(_ref, [this].concat(args)));
|
446 |
|
447 | _this.ripple_ = _this.initRipple_();
|
448 | return _this;
|
449 | }
|
450 |
|
451 |
|
452 |
|
453 |
|
454 | _createClass(MDCIconToggle, [{
|
455 | key: 'initRipple_',
|
456 |
|
457 |
|
458 | |
459 |
|
460 |
|
461 |
|
462 | value: function initRipple_() {
|
463 | var _this2 = this;
|
464 |
|
465 | var adapter = _extends(__WEBPACK_IMPORTED_MODULE_2__material_ripple_index__["MDCRipple"].createAdapter(this), {
|
466 | isUnbounded: function isUnbounded() {
|
467 | return true;
|
468 | },
|
469 | isSurfaceActive: function isSurfaceActive() {
|
470 | return _this2.foundation_.isKeyboardActivated();
|
471 | }
|
472 | });
|
473 | var foundation = new __WEBPACK_IMPORTED_MODULE_2__material_ripple_index__["MDCRippleFoundation"](adapter);
|
474 | return new __WEBPACK_IMPORTED_MODULE_2__material_ripple_index__["MDCRipple"](this.root_, foundation);
|
475 | }
|
476 | }, {
|
477 | key: 'destroy',
|
478 | value: function destroy() {
|
479 | this.ripple_.destroy();
|
480 | _get(MDCIconToggle.prototype.__proto__ || Object.getPrototypeOf(MDCIconToggle.prototype), 'destroy', this).call(this);
|
481 | }
|
482 |
|
483 |
|
484 |
|
485 | }, {
|
486 | key: 'getDefaultFoundation',
|
487 | value: function getDefaultFoundation() {
|
488 | var _this3 = this;
|
489 |
|
490 | return new __WEBPACK_IMPORTED_MODULE_1__foundation__["a" ]({
|
491 | addClass: function addClass(className) {
|
492 | return _this3.iconEl_.classList.add(className);
|
493 | },
|
494 | removeClass: function removeClass(className) {
|
495 | return _this3.iconEl_.classList.remove(className);
|
496 | },
|
497 | registerInteractionHandler: function registerInteractionHandler(type, handler) {
|
498 | return _this3.root_.addEventListener(type, handler);
|
499 | },
|
500 | deregisterInteractionHandler: function deregisterInteractionHandler(type, handler) {
|
501 | return _this3.root_.removeEventListener(type, handler);
|
502 | },
|
503 | setText: function setText(text) {
|
504 | return _this3.iconEl_.textContent = text;
|
505 | },
|
506 | getTabIndex: function getTabIndex() {
|
507 | return (_this3.root_.tabIndex
|
508 | );
|
509 | },
|
510 | setTabIndex: function setTabIndex(tabIndex) {
|
511 | return _this3.root_.tabIndex = tabIndex;
|
512 | },
|
513 | getAttr: function getAttr(name, value) {
|
514 | return _this3.root_.getAttribute(name, value);
|
515 | },
|
516 | setAttr: function setAttr(name, value) {
|
517 | return _this3.root_.setAttribute(name, value);
|
518 | },
|
519 | rmAttr: function rmAttr(name) {
|
520 | return _this3.root_.removeAttribute(name);
|
521 | },
|
522 | notifyChange: function notifyChange(evtData) {
|
523 | return _this3.emit(__WEBPACK_IMPORTED_MODULE_1__foundation__["a" ].strings.CHANGE_EVENT, evtData);
|
524 | }
|
525 | });
|
526 | }
|
527 | }, {
|
528 | key: 'initialSyncWithDOM',
|
529 | value: function initialSyncWithDOM() {
|
530 | this.on = this.root_.getAttribute(__WEBPACK_IMPORTED_MODULE_1__foundation__["a" ].strings.ARIA_PRESSED) === 'true';
|
531 | this.disabled = this.root_.getAttribute(__WEBPACK_IMPORTED_MODULE_1__foundation__["a" ].strings.ARIA_DISABLED) === 'true';
|
532 | }
|
533 |
|
534 |
|
535 |
|
536 | }, {
|
537 | key: 'refreshToggleData',
|
538 | value: function refreshToggleData() {
|
539 | this.foundation_.refreshToggleData();
|
540 | }
|
541 | }, {
|
542 | key: 'iconEl_',
|
543 | get: function get() {
|
544 | var sel = this.root_.dataset['iconInnerSelector'];
|
545 |
|
546 | return sel ?
|
547 | this.root_.querySelector(sel) : this.root_;
|
548 | }
|
549 | }, {
|
550 | key: 'ripple',
|
551 | get: function get() {
|
552 | return this.ripple_;
|
553 | }
|
554 |
|
555 |
|
556 |
|
557 | }, {
|
558 | key: 'on',
|
559 | get: function get() {
|
560 | return this.foundation_.isOn();
|
561 | }
|
562 |
|
563 |
|
564 | ,
|
565 | set: function set(isOn) {
|
566 | this.foundation_.toggle(isOn);
|
567 | }
|
568 |
|
569 |
|
570 |
|
571 | }, {
|
572 | key: 'disabled',
|
573 | get: function get() {
|
574 | return this.foundation_.isDisabled();
|
575 | }
|
576 |
|
577 |
|
578 | ,
|
579 | set: function set(isDisabled) {
|
580 | this.foundation_.setDisabled(isDisabled);
|
581 | }
|
582 | }]);
|
583 |
|
584 | return MDCIconToggle;
|
585 | }(__WEBPACK_IMPORTED_MODULE_0__material_base_component__["a" ]);
|
586 |
|
587 |
|
588 |
|
589 | }),
|
590 |
|
591 | 123:
|
592 | (function(module, __webpack_exports__, __webpack_require__) {
|
593 |
|
594 | "use strict";
|
595 | var __WEBPACK_IMPORTED_MODULE_0__material_base_foundation__ = __webpack_require__(0);
|
596 | var __WEBPACK_IMPORTED_MODULE_1__adapter__ = __webpack_require__(124);
|
597 | var __WEBPACK_IMPORTED_MODULE_2__constants__ = __webpack_require__(125);
|
598 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
599 |
|
600 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
601 |
|
602 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
603 |
|
604 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
605 |
|
606 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
607 |
|
608 |
|
609 |
|
610 |
|
611 |
|
612 |
|
613 |
|
614 |
|
615 |
|
616 |
|
617 |
|
618 |
|
619 |
|
620 |
|
621 |
|
622 |
|
623 |
|
624 |
|
625 |
|
626 |
|
627 |
|
628 |
|
629 |
|
630 |
|
631 |
|
632 |
|
633 |
|
634 |
|
635 |
|
636 |
|
637 |
|
638 |
|
639 |
|
640 | var MDCIconToggleFoundation = function (_MDCFoundation) {
|
641 | _inherits(MDCIconToggleFoundation, _MDCFoundation);
|
642 |
|
643 | _createClass(MDCIconToggleFoundation, null, [{
|
644 | key: 'cssClasses',
|
645 | get: function get() {
|
646 | return __WEBPACK_IMPORTED_MODULE_2__constants__["a" ];
|
647 | }
|
648 | }, {
|
649 | key: 'strings',
|
650 | get: function get() {
|
651 | return __WEBPACK_IMPORTED_MODULE_2__constants__["b" ];
|
652 | }
|
653 | }, {
|
654 | key: 'defaultAdapter',
|
655 | get: function get() {
|
656 | return {
|
657 | addClass: function addClass() /* className: string */{},
|
658 | removeClass: function removeClass() /* className: string */{},
|
659 | registerInteractionHandler: function registerInteractionHandler() /* type: string, handler: EventListener */{},
|
660 | deregisterInteractionHandler: function deregisterInteractionHandler() /* type: string, handler: EventListener */{},
|
661 | setText: function setText() /* text: string */{},
|
662 | getTabIndex: function getTabIndex() {
|
663 | return (0
|
664 | );
|
665 | },
|
666 | setTabIndex: function setTabIndex() /* tabIndex: number */{},
|
667 | getAttr: function getAttr() {
|
668 | return ( ''
|
669 | );
|
670 | },
|
671 | setAttr: function setAttr() /* name: string, value: string */{},
|
672 | rmAttr: function rmAttr() /* name: string */{},
|
673 | notifyChange: function notifyChange() /* evtData: IconToggleEvent */{}
|
674 | };
|
675 | }
|
676 | }]);
|
677 |
|
678 | function MDCIconToggleFoundation(adapter) {
|
679 | _classCallCheck(this, MDCIconToggleFoundation);
|
680 |
|
681 |
|
682 | var _this = _possibleConstructorReturn(this, (MDCIconToggleFoundation.__proto__ || Object.getPrototypeOf(MDCIconToggleFoundation)).call(this, _extends(MDCIconToggleFoundation.defaultAdapter, adapter)));
|
683 |
|
684 | _this.on_ = false;
|
685 |
|
686 |
|
687 | _this.disabled_ = false;
|
688 |
|
689 |
|
690 | _this.savedTabIndex_ = -1;
|
691 |
|
692 |
|
693 | _this.toggleOnData_ = null;
|
694 |
|
695 |
|
696 | _this.toggleOffData_ = null;
|
697 |
|
698 | _this.clickHandler_ = function () {
|
699 | return _this.toggleFromEvt_();
|
700 | };
|
701 |
|
702 |
|
703 | _this.isHandlingKeydown_ = false;
|
704 |
|
705 | _this.keydownHandler_ = function ( /** @type {!KeyboardKey} */evt) {
|
706 | if (isSpace(evt)) {
|
707 | _this.isHandlingKeydown_ = true;
|
708 | return evt.preventDefault();
|
709 | }
|
710 | };
|
711 |
|
712 | _this.keyupHandler_ = function ( /** @type {!KeyboardKey} */evt) {
|
713 | if (isSpace(evt)) {
|
714 | _this.isHandlingKeydown_ = false;
|
715 | _this.toggleFromEvt_();
|
716 | }
|
717 | };
|
718 | return _this;
|
719 | }
|
720 |
|
721 | _createClass(MDCIconToggleFoundation, [{
|
722 | key: 'init',
|
723 | value: function init() {
|
724 | this.refreshToggleData();
|
725 | this.savedTabIndex_ = this.adapter_.getTabIndex();
|
726 | this.adapter_.registerInteractionHandler('click', this.clickHandler_);
|
727 | this.adapter_.registerInteractionHandler('keydown', this.keydownHandler_);
|
728 | this.adapter_.registerInteractionHandler('keyup', this.keyupHandler_);
|
729 | }
|
730 | }, {
|
731 | key: 'refreshToggleData',
|
732 | value: function refreshToggleData() {
|
733 | var _MDCIconToggleFoundat = MDCIconToggleFoundation.strings,
|
734 | DATA_TOGGLE_ON = _MDCIconToggleFoundat.DATA_TOGGLE_ON,
|
735 | DATA_TOGGLE_OFF = _MDCIconToggleFoundat.DATA_TOGGLE_OFF;
|
736 |
|
737 | this.toggleOnData_ = this.parseJsonDataAttr_(DATA_TOGGLE_ON);
|
738 | this.toggleOffData_ = this.parseJsonDataAttr_(DATA_TOGGLE_OFF);
|
739 | }
|
740 | }, {
|
741 | key: 'destroy',
|
742 | value: function destroy() {
|
743 | this.adapter_.deregisterInteractionHandler('click', this.clickHandler_);
|
744 | this.adapter_.deregisterInteractionHandler('keydown', this.keydownHandler_);
|
745 | this.adapter_.deregisterInteractionHandler('keyup', this.keyupHandler_);
|
746 | }
|
747 |
|
748 |
|
749 |
|
750 | }, {
|
751 | key: 'toggleFromEvt_',
|
752 | value: function toggleFromEvt_() {
|
753 | this.toggle();
|
754 | var isOn = this.on_;
|
755 |
|
756 | this.adapter_.notifyChange( { isOn: isOn });
|
757 | }
|
758 |
|
759 |
|
760 |
|
761 | }, {
|
762 | key: 'isOn',
|
763 | value: function isOn() {
|
764 | return this.on_;
|
765 | }
|
766 |
|
767 |
|
768 |
|
769 | }, {
|
770 | key: 'toggle',
|
771 | value: function toggle() {
|
772 | var isOn = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !this.on_;
|
773 |
|
774 | this.on_ = isOn;
|
775 |
|
776 | var _MDCIconToggleFoundat2 = MDCIconToggleFoundation.strings,
|
777 | ARIA_LABEL = _MDCIconToggleFoundat2.ARIA_LABEL,
|
778 | ARIA_PRESSED = _MDCIconToggleFoundat2.ARIA_PRESSED;
|
779 |
|
780 |
|
781 | if (this.on_) {
|
782 | this.adapter_.setAttr(ARIA_PRESSED, 'true');
|
783 | } else {
|
784 | this.adapter_.setAttr(ARIA_PRESSED, 'false');
|
785 | }
|
786 |
|
787 | var _ref = this.on_ ? this.toggleOffData_ : this.toggleOnData_,
|
788 | classToRemove = _ref.cssClass;
|
789 |
|
790 | if (classToRemove) {
|
791 | this.adapter_.removeClass(classToRemove);
|
792 | }
|
793 |
|
794 | var _ref2 = this.on_ ? this.toggleOnData_ : this.toggleOffData_,
|
795 | content = _ref2.content,
|
796 | label = _ref2.label,
|
797 | cssClass = _ref2.cssClass;
|
798 |
|
799 | if (cssClass) {
|
800 | this.adapter_.addClass(cssClass);
|
801 | }
|
802 | if (content) {
|
803 | this.adapter_.setText(content);
|
804 | }
|
805 | if (label) {
|
806 | this.adapter_.setAttr(ARIA_LABEL, label);
|
807 | }
|
808 | }
|
809 |
|
810 | |
811 |
|
812 |
|
813 |
|
814 |
|
815 | }, {
|
816 | key: 'parseJsonDataAttr_',
|
817 | value: function parseJsonDataAttr_(dataAttr) {
|
818 | var val = this.adapter_.getAttr(dataAttr);
|
819 | if (!val) {
|
820 | return {};
|
821 | }
|
822 | return (JSON.parse(val)
|
823 | );
|
824 | }
|
825 |
|
826 |
|
827 |
|
828 | }, {
|
829 | key: 'isDisabled',
|
830 | value: function isDisabled() {
|
831 | return this.disabled_;
|
832 | }
|
833 |
|
834 |
|
835 |
|
836 | }, {
|
837 | key: 'setDisabled',
|
838 | value: function setDisabled(isDisabled) {
|
839 | this.disabled_ = isDisabled;
|
840 |
|
841 | var DISABLED = MDCIconToggleFoundation.cssClasses.DISABLED;
|
842 | var ARIA_DISABLED = MDCIconToggleFoundation.strings.ARIA_DISABLED;
|
843 |
|
844 |
|
845 | if (this.disabled_) {
|
846 | this.savedTabIndex_ = this.adapter_.getTabIndex();
|
847 | this.adapter_.setTabIndex(-1);
|
848 | this.adapter_.setAttr(ARIA_DISABLED, 'true');
|
849 | this.adapter_.addClass(DISABLED);
|
850 | } else {
|
851 | this.adapter_.setTabIndex(this.savedTabIndex_);
|
852 | this.adapter_.rmAttr(ARIA_DISABLED);
|
853 | this.adapter_.removeClass(DISABLED);
|
854 | }
|
855 | }
|
856 |
|
857 |
|
858 |
|
859 | }, {
|
860 | key: 'isKeyboardActivated',
|
861 | value: function isKeyboardActivated() {
|
862 | return this.isHandlingKeydown_;
|
863 | }
|
864 | }]);
|
865 |
|
866 | return MDCIconToggleFoundation;
|
867 | }(__WEBPACK_IMPORTED_MODULE_0__material_base_foundation__["a" ]);
|
868 |
|
869 |
|
870 |
|
871 |
|
872 |
|
873 |
|
874 |
|
875 |
|
876 |
|
877 | var KeyboardKey = void 0;
|
878 |
|
879 |
|
880 |
|
881 |
|
882 |
|
883 | function isSpace(keyboardKey) {
|
884 | return keyboardKey.key === 'Space' || keyboardKey.keyCode === 32;
|
885 | }
|
886 |
|
887 |
|
888 |
|
889 | var IconToggleState = function IconToggleState() {
|
890 | _classCallCheck(this, IconToggleState);
|
891 | };
|
892 |
|
893 |
|
894 |
|
895 |
|
896 |
|
897 |
|
898 |
|
899 | IconToggleState.prototype.label;
|
900 |
|
901 |
|
902 |
|
903 |
|
904 |
|
905 | IconToggleState.prototype.content;
|
906 |
|
907 |
|
908 |
|
909 |
|
910 |
|
911 | IconToggleState.prototype.cssClass;
|
912 |
|
913 | __webpack_exports__["a"] = (MDCIconToggleFoundation);
|
914 |
|
915 | }),
|
916 |
|
917 | 124:
|
918 | (function(module, __webpack_exports__, __webpack_require__) {
|
919 |
|
920 | "use strict";
|
921 |
|
922 |
|
923 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
924 |
|
925 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
926 |
|
927 |
|
928 |
|
929 |
|
930 |
|
931 |
|
932 |
|
933 |
|
934 |
|
935 |
|
936 |
|
937 |
|
938 |
|
939 |
|
940 |
|
941 |
|
942 |
|
943 |
|
944 |
|
945 |
|
946 |
|
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 | var MDCIconToggleAdapter = function () {
|
972 | function MDCIconToggleAdapter() {
|
973 | _classCallCheck(this, MDCIconToggleAdapter);
|
974 | }
|
975 |
|
976 | _createClass(MDCIconToggleAdapter, [{
|
977 | key: "addClass",
|
978 |
|
979 |
|
980 | value: function addClass(className) {}
|
981 |
|
982 |
|
983 |
|
984 | }, {
|
985 | key: "removeClass",
|
986 | value: function removeClass(className) {}
|
987 |
|
988 | |
989 |
|
990 |
|
991 |
|
992 |
|
993 | }, {
|
994 | key: "registerInteractionHandler",
|
995 | value: function registerInteractionHandler(type, handler) {}
|
996 |
|
997 | |
998 |
|
999 |
|
1000 |
|
1001 |
|
1002 | }, {
|
1003 | key: "deregisterInteractionHandler",
|
1004 | value: function deregisterInteractionHandler(type, handler) {}
|
1005 |
|
1006 |
|
1007 |
|
1008 | }, {
|
1009 | key: "setText",
|
1010 | value: function setText(text) {}
|
1011 |
|
1012 |
|
1013 |
|
1014 | }, {
|
1015 | key: "getTabIndex",
|
1016 | value: function getTabIndex() {}
|
1017 |
|
1018 |
|
1019 |
|
1020 | }, {
|
1021 | key: "setTabIndex",
|
1022 | value: function setTabIndex(tabIndex) {}
|
1023 |
|
1024 | |
1025 |
|
1026 |
|
1027 |
|
1028 |
|
1029 | }, {
|
1030 | key: "getAttr",
|
1031 | value: function getAttr(name) {}
|
1032 |
|
1033 | |
1034 |
|
1035 |
|
1036 |
|
1037 |
|
1038 | }, {
|
1039 | key: "setAttr",
|
1040 | value: function setAttr(name, value) {}
|
1041 |
|
1042 |
|
1043 |
|
1044 | }, {
|
1045 | key: "rmAttr",
|
1046 | value: function rmAttr(name) {}
|
1047 |
|
1048 |
|
1049 |
|
1050 | }, {
|
1051 | key: "notifyChange",
|
1052 | value: function notifyChange(evtData) {}
|
1053 | }]);
|
1054 |
|
1055 | return MDCIconToggleAdapter;
|
1056 | }();
|
1057 |
|
1058 |
|
1059 |
|
1060 |
|
1061 |
|
1062 |
|
1063 |
|
1064 |
|
1065 | var IconToggleEvent = void 0;
|
1066 |
|
1067 |
|
1068 |
|
1069 | }),
|
1070 |
|
1071 | 125:
|
1072 | (function(module, __webpack_exports__, __webpack_require__) {
|
1073 |
|
1074 | "use strict";
|
1075 | __webpack_require__.d(__webpack_exports__, "a", function() { return cssClasses; });
|
1076 | __webpack_require__.d(__webpack_exports__, "b", function() { return strings; });
|
1077 |
|
1078 |
|
1079 |
|
1080 |
|
1081 |
|
1082 |
|
1083 |
|
1084 |
|
1085 |
|
1086 |
|
1087 |
|
1088 |
|
1089 |
|
1090 |
|
1091 |
|
1092 |
|
1093 |
|
1094 |
|
1095 |
|
1096 |
|
1097 |
|
1098 |
|
1099 |
|
1100 |
|
1101 | var cssClasses = {
|
1102 | ROOT: 'mdc-icon-toggle',
|
1103 | DISABLED: 'mdc-icon-toggle--disabled'
|
1104 | };
|
1105 |
|
1106 |
|
1107 | var strings = {
|
1108 | DATA_TOGGLE_ON: 'data-toggle-on',
|
1109 | DATA_TOGGLE_OFF: 'data-toggle-off',
|
1110 | ARIA_PRESSED: 'aria-pressed',
|
1111 | ARIA_DISABLED: 'aria-disabled',
|
1112 | ARIA_LABEL: 'aria-label',
|
1113 | CHANGE_EVENT: 'MDCIconToggle:change'
|
1114 | };
|
1115 |
|
1116 |
|
1117 |
|
1118 | }),
|
1119 |
|
1120 | 2:
|
1121 | (function(module, __webpack_exports__, __webpack_require__) {
|
1122 |
|
1123 | "use strict";
|
1124 | Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
1125 | __webpack_require__.d(__webpack_exports__, "supportsCssVariables", function() { return supportsCssVariables; });
|
1126 | __webpack_require__.d(__webpack_exports__, "applyPassive", function() { return applyPassive; });
|
1127 | __webpack_require__.d(__webpack_exports__, "getMatchesProperty", function() { return getMatchesProperty; });
|
1128 | __webpack_require__.d(__webpack_exports__, "getNormalizedEventCoords", function() { return getNormalizedEventCoords; });
|
1129 |
|
1130 |
|
1131 |
|
1132 |
|
1133 |
|
1134 |
|
1135 |
|
1136 |
|
1137 |
|
1138 |
|
1139 |
|
1140 |
|
1141 |
|
1142 |
|
1143 |
|
1144 |
|
1145 |
|
1146 |
|
1147 |
|
1148 |
|
1149 |
|
1150 |
|
1151 |
|
1152 |
|
1153 |
|
1154 |
|
1155 |
|
1156 | var supportsCssVariables_ = void 0;
|
1157 |
|
1158 |
|
1159 |
|
1160 |
|
1161 |
|
1162 | var supportsPassive_ = void 0;
|
1163 |
|
1164 |
|
1165 |
|
1166 |
|
1167 |
|
1168 | function detectEdgePseudoVarBug(windowObj) {
|
1169 |
|
1170 |
|
1171 | var document = windowObj.document;
|
1172 | var node = document.createElement('div');
|
1173 | node.className = 'mdc-ripple-surface--test-edge-var-bug';
|
1174 | document.body.appendChild(node);
|
1175 |
|
1176 |
|
1177 |
|
1178 |
|
1179 |
|
1180 | var computedStyle = windowObj.getComputedStyle(node);
|
1181 | var hasPseudoVarBug = computedStyle !== null && computedStyle.borderTopStyle === 'solid';
|
1182 | node.remove();
|
1183 | return hasPseudoVarBug;
|
1184 | }
|
1185 |
|
1186 |
|
1187 |
|
1188 |
|
1189 |
|
1190 |
|
1191 |
|
1192 | function supportsCssVariables(windowObj) {
|
1193 | var forceRefresh = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
1194 |
|
1195 | var supportsCssVariables = supportsCssVariables_;
|
1196 | if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) {
|
1197 | return supportsCssVariables;
|
1198 | }
|
1199 |
|
1200 | var supportsFunctionPresent = windowObj.CSS && typeof windowObj.CSS.supports === 'function';
|
1201 | if (!supportsFunctionPresent) {
|
1202 | return;
|
1203 | }
|
1204 |
|
1205 | var explicitlySupportsCssVars = windowObj.CSS.supports('--css-vars', 'yes');
|
1206 |
|
1207 |
|
1208 | var weAreFeatureDetectingSafari10plus = windowObj.CSS.supports('(--css-vars: yes)') && windowObj.CSS.supports('color', '#00000000');
|
1209 |
|
1210 | if (explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus) {
|
1211 | supportsCssVariables = !detectEdgePseudoVarBug(windowObj);
|
1212 | } else {
|
1213 | supportsCssVariables = false;
|
1214 | }
|
1215 |
|
1216 | if (!forceRefresh) {
|
1217 | supportsCssVariables_ = supportsCssVariables;
|
1218 | }
|
1219 | return supportsCssVariables;
|
1220 | }
|
1221 |
|
1222 |
|
1223 |
|
1224 |
|
1225 |
|
1226 |
|
1227 |
|
1228 |
|
1229 | function applyPassive() {
|
1230 | var globalObj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window;
|
1231 | var forceRefresh = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
1232 |
|
1233 | if (supportsPassive_ === undefined || forceRefresh) {
|
1234 | var isSupported = false;
|
1235 | try {
|
1236 | globalObj.document.addEventListener('test', null, { get passive() {
|
1237 | isSupported = true;
|
1238 | return isSupported;
|
1239 | } });
|
1240 | } catch (e) {}
|
1241 |
|
1242 | supportsPassive_ = isSupported;
|
1243 | }
|
1244 |
|
1245 | return supportsPassive_ ? { passive: true } : false;
|
1246 | }
|
1247 |
|
1248 |
|
1249 |
|
1250 |
|
1251 |
|
1252 | function getMatchesProperty(HTMLElementPrototype) {
|
1253 | |
1254 |
|
1255 |
|
1256 |
|
1257 | var matchesMethods = ['matches', 'webkitMatchesSelector', 'msMatchesSelector'];
|
1258 | var method = 'matches';
|
1259 | for (var i = 0; i < matchesMethods.length; i++) {
|
1260 | var matchesMethod = matchesMethods[i];
|
1261 | if (matchesMethod in HTMLElementPrototype) {
|
1262 | method = matchesMethod;
|
1263 | break;
|
1264 | }
|
1265 | }
|
1266 |
|
1267 | return method;
|
1268 | }
|
1269 |
|
1270 |
|
1271 |
|
1272 |
|
1273 |
|
1274 |
|
1275 |
|
1276 | function getNormalizedEventCoords(ev, pageOffset, clientRect) {
|
1277 | var x = pageOffset.x,
|
1278 | y = pageOffset.y;
|
1279 |
|
1280 | var documentX = x + clientRect.left;
|
1281 | var documentY = y + clientRect.top;
|
1282 |
|
1283 | var normalizedX = void 0;
|
1284 | var normalizedY = void 0;
|
1285 |
|
1286 | if (ev.type === 'touchstart') {
|
1287 | ev = ev;
|
1288 | normalizedX = ev.changedTouches[0].pageX - documentX;
|
1289 | normalizedY = ev.changedTouches[0].pageY - documentY;
|
1290 | } else {
|
1291 | ev = ev;
|
1292 | normalizedX = ev.pageX - documentX;
|
1293 | normalizedY = ev.pageY - documentY;
|
1294 | }
|
1295 |
|
1296 | return { x: normalizedX, y: normalizedY };
|
1297 | }
|
1298 |
|
1299 |
|
1300 |
|
1301 | }),
|
1302 |
|
1303 | 3:
|
1304 | (function(module, __webpack_exports__, __webpack_require__) {
|
1305 |
|
1306 | "use strict";
|
1307 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
1308 |
|
1309 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
1310 |
|
1311 |
|
1312 |
|
1313 |
|
1314 |
|
1315 |
|
1316 |
|
1317 |
|
1318 |
|
1319 |
|
1320 |
|
1321 |
|
1322 |
|
1323 |
|
1324 |
|
1325 |
|
1326 |
|
1327 |
|
1328 |
|
1329 |
|
1330 |
|
1331 |
|
1332 |
|
1333 |
|
1334 |
|
1335 |
|
1336 |
|
1337 |
|
1338 |
|
1339 |
|
1340 |
|
1341 |
|
1342 |
|
1343 |
|
1344 |
|
1345 |
|
1346 |
|
1347 |
|
1348 |
|
1349 |
|
1350 |
|
1351 |
|
1352 |
|
1353 |
|
1354 |
|
1355 |
|
1356 |
|
1357 | var MDCRippleAdapter = function () {
|
1358 | function MDCRippleAdapter() {
|
1359 | _classCallCheck(this, MDCRippleAdapter);
|
1360 | }
|
1361 |
|
1362 | _createClass(MDCRippleAdapter, [{
|
1363 | key: "browserSupportsCssVars",
|
1364 |
|
1365 |
|
1366 | value: function browserSupportsCssVars() {}
|
1367 |
|
1368 |
|
1369 |
|
1370 | }, {
|
1371 | key: "isUnbounded",
|
1372 | value: function isUnbounded() {}
|
1373 |
|
1374 |
|
1375 |
|
1376 | }, {
|
1377 | key: "isSurfaceActive",
|
1378 | value: function isSurfaceActive() {}
|
1379 |
|
1380 |
|
1381 |
|
1382 | }, {
|
1383 | key: "isSurfaceDisabled",
|
1384 | value: function isSurfaceDisabled() {}
|
1385 |
|
1386 |
|
1387 |
|
1388 | }, {
|
1389 | key: "addClass",
|
1390 | value: function addClass(className) {}
|
1391 |
|
1392 |
|
1393 |
|
1394 | }, {
|
1395 | key: "removeClass",
|
1396 | value: function removeClass(className) {}
|
1397 |
|
1398 |
|
1399 |
|
1400 | }, {
|
1401 | key: "containsEventTarget",
|
1402 | value: function containsEventTarget(target) {}
|
1403 |
|
1404 | |
1405 |
|
1406 |
|
1407 |
|
1408 |
|
1409 | }, {
|
1410 | key: "registerInteractionHandler",
|
1411 | value: function registerInteractionHandler(evtType, handler) {}
|
1412 |
|
1413 | |
1414 |
|
1415 |
|
1416 |
|
1417 |
|
1418 | }, {
|
1419 | key: "deregisterInteractionHandler",
|
1420 | value: function deregisterInteractionHandler(evtType, handler) {}
|
1421 |
|
1422 | |
1423 |
|
1424 |
|
1425 |
|
1426 |
|
1427 | }, {
|
1428 | key: "registerDocumentInteractionHandler",
|
1429 | value: function registerDocumentInteractionHandler(evtType, handler) {}
|
1430 |
|
1431 | |
1432 |
|
1433 |
|
1434 |
|
1435 |
|
1436 | }, {
|
1437 | key: "deregisterDocumentInteractionHandler",
|
1438 | value: function deregisterDocumentInteractionHandler(evtType, handler) {}
|
1439 |
|
1440 | |
1441 |
|
1442 |
|
1443 |
|
1444 | }, {
|
1445 | key: "registerResizeHandler",
|
1446 | value: function registerResizeHandler(handler) {}
|
1447 |
|
1448 | |
1449 |
|
1450 |
|
1451 |
|
1452 | }, {
|
1453 | key: "deregisterResizeHandler",
|
1454 | value: function deregisterResizeHandler(handler) {}
|
1455 |
|
1456 | |
1457 |
|
1458 |
|
1459 |
|
1460 |
|
1461 | }, {
|
1462 | key: "updateCssVariable",
|
1463 | value: function updateCssVariable(varName, value) {}
|
1464 |
|
1465 |
|
1466 |
|
1467 | }, {
|
1468 | key: "computeBoundingRect",
|
1469 | value: function computeBoundingRect() {}
|
1470 |
|
1471 |
|
1472 |
|
1473 | }, {
|
1474 | key: "getWindowPageOffset",
|
1475 | value: function getWindowPageOffset() {}
|
1476 | }]);
|
1477 |
|
1478 | return MDCRippleAdapter;
|
1479 | }();
|
1480 |
|
1481 | var _unused_webpack_default_export = (MDCRippleAdapter);
|
1482 |
|
1483 | }),
|
1484 |
|
1485 | 4:
|
1486 | (function(module, __webpack_exports__, __webpack_require__) {
|
1487 |
|
1488 | "use strict";
|
1489 | Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
|
1490 | __webpack_require__.d(__webpack_exports__, "MDCRipple", function() { return MDCRipple; });
|
1491 | __webpack_require__.d(__webpack_exports__, "RippleCapableSurface", function() { return RippleCapableSurface; });
|
1492 | var __WEBPACK_IMPORTED_MODULE_0__material_base_component__ = __webpack_require__(1);
|
1493 | var __WEBPACK_IMPORTED_MODULE_1__adapter__ = __webpack_require__(3);
|
1494 | var __WEBPACK_IMPORTED_MODULE_2__foundation__ = __webpack_require__(5);
|
1495 | var __WEBPACK_IMPORTED_MODULE_3__util__ = __webpack_require__(2);
|
1496 | __webpack_require__.d(__webpack_exports__, "MDCRippleFoundation", function() { return __WEBPACK_IMPORTED_MODULE_2__foundation__["a"]; });
|
1497 | __webpack_require__.d(__webpack_exports__, "util", function() { return __WEBPACK_IMPORTED_MODULE_3__util__; });
|
1498 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
1499 |
|
1500 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
1501 |
|
1502 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
1503 |
|
1504 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
1505 |
|
1506 |
|
1507 |
|
1508 |
|
1509 |
|
1510 |
|
1511 |
|
1512 |
|
1513 |
|
1514 |
|
1515 |
|
1516 |
|
1517 |
|
1518 |
|
1519 |
|
1520 |
|
1521 |
|
1522 |
|
1523 |
|
1524 |
|
1525 |
|
1526 |
|
1527 |
|
1528 |
|
1529 |
|
1530 |
|
1531 |
|
1532 |
|
1533 |
|
1534 |
|
1535 |
|
1536 |
|
1537 |
|
1538 | var MDCRipple = function (_MDCComponent) {
|
1539 | _inherits(MDCRipple, _MDCComponent);
|
1540 |
|
1541 |
|
1542 | function MDCRipple() {
|
1543 | var _ref;
|
1544 |
|
1545 | _classCallCheck(this, MDCRipple);
|
1546 |
|
1547 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
1548 | args[_key] = arguments[_key];
|
1549 | }
|
1550 |
|
1551 |
|
1552 | var _this = _possibleConstructorReturn(this, (_ref = MDCRipple.__proto__ || Object.getPrototypeOf(MDCRipple)).call.apply(_ref, [this].concat(args)));
|
1553 |
|
1554 | _this.disabled = false;
|
1555 |
|
1556 |
|
1557 | _this.unbounded_;
|
1558 | return _this;
|
1559 | }
|
1560 |
|
1561 | |
1562 |
|
1563 |
|
1564 |
|
1565 |
|
1566 |
|
1567 |
|
1568 | _createClass(MDCRipple, [{
|
1569 | key: 'setUnbounded_',
|
1570 |
|
1571 |
|
1572 | |
1573 |
|
1574 |
|
1575 |
|
1576 |
|
1577 |
|
1578 |
|
1579 | value: function setUnbounded_() {
|
1580 | this.foundation_.setUnbounded(this.unbounded_);
|
1581 | }
|
1582 | }, {
|
1583 | key: 'activate',
|
1584 | value: function activate() {
|
1585 | this.foundation_.activate();
|
1586 | }
|
1587 | }, {
|
1588 | key: 'deactivate',
|
1589 | value: function deactivate() {
|
1590 | this.foundation_.deactivate();
|
1591 | }
|
1592 | }, {
|
1593 | key: 'layout',
|
1594 | value: function layout() {
|
1595 | this.foundation_.layout();
|
1596 | }
|
1597 |
|
1598 | |
1599 |
|
1600 |
|
1601 |
|
1602 |
|
1603 | }, {
|
1604 | key: 'getDefaultFoundation',
|
1605 | value: function getDefaultFoundation() {
|
1606 | return new __WEBPACK_IMPORTED_MODULE_2__foundation__["a" ](MDCRipple.createAdapter(this));
|
1607 | }
|
1608 |
|
1609 |
|
1610 |
|
1611 | }, {
|
1612 | key: 'initialSyncWithDOM',
|
1613 | value: function initialSyncWithDOM() {
|
1614 | this.unbounded = 'mdcRippleIsUnbounded' in this.root_.dataset;
|
1615 | }
|
1616 | }, {
|
1617 | key: 'unbounded',
|
1618 |
|
1619 |
|
1620 |
|
1621 | get: function get() {
|
1622 | return this.unbounded_;
|
1623 | }
|
1624 |
|
1625 |
|
1626 | ,
|
1627 | set: function set(unbounded) {
|
1628 | this.unbounded_ = Boolean(unbounded);
|
1629 | this.setUnbounded_();
|
1630 | }
|
1631 | }], [{
|
1632 | key: 'attachTo',
|
1633 | value: function attachTo(root) {
|
1634 | var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
1635 | _ref2$isUnbounded = _ref2.isUnbounded,
|
1636 | isUnbounded = _ref2$isUnbounded === undefined ? undefined : _ref2$isUnbounded;
|
1637 |
|
1638 | var ripple = new MDCRipple(root);
|
1639 |
|
1640 | if (isUnbounded !== undefined) {
|
1641 | ripple.unbounded = isUnbounded;
|
1642 | }
|
1643 | return ripple;
|
1644 | }
|
1645 |
|
1646 | |
1647 |
|
1648 |
|
1649 |
|
1650 |
|
1651 | }, {
|
1652 | key: 'createAdapter',
|
1653 | value: function createAdapter(instance) {
|
1654 | var MATCHES = __WEBPACK_IMPORTED_MODULE_3__util__["getMatchesProperty"](HTMLElement.prototype);
|
1655 |
|
1656 | return {
|
1657 | browserSupportsCssVars: function browserSupportsCssVars() {
|
1658 | return __WEBPACK_IMPORTED_MODULE_3__util__["supportsCssVariables"](window);
|
1659 | },
|
1660 | isUnbounded: function isUnbounded() {
|
1661 | return instance.unbounded;
|
1662 | },
|
1663 | isSurfaceActive: function isSurfaceActive() {
|
1664 | return instance.root_[MATCHES](':active');
|
1665 | },
|
1666 | isSurfaceDisabled: function isSurfaceDisabled() {
|
1667 | return instance.disabled;
|
1668 | },
|
1669 | addClass: function addClass(className) {
|
1670 | return instance.root_.classList.add(className);
|
1671 | },
|
1672 | removeClass: function removeClass(className) {
|
1673 | return instance.root_.classList.remove(className);
|
1674 | },
|
1675 | containsEventTarget: function containsEventTarget(target) {
|
1676 | return instance.root_.contains(target);
|
1677 | },
|
1678 | registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
|
1679 | return instance.root_.addEventListener(evtType, handler, __WEBPACK_IMPORTED_MODULE_3__util__["applyPassive"]());
|
1680 | },
|
1681 | deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
|
1682 | return instance.root_.removeEventListener(evtType, handler, __WEBPACK_IMPORTED_MODULE_3__util__["applyPassive"]());
|
1683 | },
|
1684 | registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) {
|
1685 | return document.documentElement.addEventListener(evtType, handler, __WEBPACK_IMPORTED_MODULE_3__util__["applyPassive"]());
|
1686 | },
|
1687 | deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) {
|
1688 | return document.documentElement.removeEventListener(evtType, handler, __WEBPACK_IMPORTED_MODULE_3__util__["applyPassive"]());
|
1689 | },
|
1690 | registerResizeHandler: function registerResizeHandler(handler) {
|
1691 | return window.addEventListener('resize', handler);
|
1692 | },
|
1693 | deregisterResizeHandler: function deregisterResizeHandler(handler) {
|
1694 | return window.removeEventListener('resize', handler);
|
1695 | },
|
1696 | updateCssVariable: function updateCssVariable(varName, value) {
|
1697 | return instance.root_.style.setProperty(varName, value);
|
1698 | },
|
1699 | computeBoundingRect: function computeBoundingRect() {
|
1700 | return instance.root_.getBoundingClientRect();
|
1701 | },
|
1702 | getWindowPageOffset: function getWindowPageOffset() {
|
1703 | return { x: window.pageXOffset, y: window.pageYOffset };
|
1704 | }
|
1705 | };
|
1706 | }
|
1707 | }]);
|
1708 |
|
1709 | return MDCRipple;
|
1710 | }(__WEBPACK_IMPORTED_MODULE_0__material_base_component__["a" ]);
|
1711 |
|
1712 |
|
1713 |
|
1714 |
|
1715 |
|
1716 |
|
1717 |
|
1718 |
|
1719 | var RippleCapableSurface = function RippleCapableSurface() {
|
1720 | _classCallCheck(this, RippleCapableSurface);
|
1721 | };
|
1722 |
|
1723 |
|
1724 |
|
1725 |
|
1726 | RippleCapableSurface.prototype.root_;
|
1727 |
|
1728 |
|
1729 |
|
1730 |
|
1731 |
|
1732 | RippleCapableSurface.prototype.unbounded;
|
1733 |
|
1734 |
|
1735 |
|
1736 |
|
1737 |
|
1738 | RippleCapableSurface.prototype.disabled;
|
1739 |
|
1740 |
|
1741 |
|
1742 | }),
|
1743 |
|
1744 | 5:
|
1745 | (function(module, __webpack_exports__, __webpack_require__) {
|
1746 |
|
1747 | "use strict";
|
1748 | var __WEBPACK_IMPORTED_MODULE_0__material_base_foundation__ = __webpack_require__(0);
|
1749 | var __WEBPACK_IMPORTED_MODULE_1__adapter__ = __webpack_require__(3);
|
1750 | var __WEBPACK_IMPORTED_MODULE_2__constants__ = __webpack_require__(6);
|
1751 | var __WEBPACK_IMPORTED_MODULE_3__util__ = __webpack_require__(2);
|
1752 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
1753 |
|
1754 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
1755 |
|
1756 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
1757 |
|
1758 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
1759 |
|
1760 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
1761 |
|
1762 |
|
1763 |
|
1764 |
|
1765 |
|
1766 |
|
1767 |
|
1768 |
|
1769 |
|
1770 |
|
1771 |
|
1772 |
|
1773 |
|
1774 |
|
1775 |
|
1776 |
|
1777 |
|
1778 |
|
1779 |
|
1780 |
|
1781 |
|
1782 |
|
1783 |
|
1784 |
|
1785 |
|
1786 |
|
1787 |
|
1788 |
|
1789 |
|
1790 |
|
1791 |
|
1792 |
|
1793 |
|
1794 |
|
1795 |
|
1796 |
|
1797 |
|
1798 |
|
1799 |
|
1800 | var ActivationStateType = void 0;
|
1801 |
|
1802 |
|
1803 |
|
1804 |
|
1805 |
|
1806 |
|
1807 |
|
1808 |
|
1809 |
|
1810 | var ListenerInfoType = void 0;
|
1811 |
|
1812 |
|
1813 |
|
1814 |
|
1815 |
|
1816 |
|
1817 |
|
1818 |
|
1819 |
|
1820 | var ListenersType = void 0;
|
1821 |
|
1822 |
|
1823 |
|
1824 |
|
1825 |
|
1826 |
|
1827 |
|
1828 | var PointType = void 0;
|
1829 |
|
1830 |
|
1831 | var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown'];
|
1832 |
|
1833 |
|
1834 | var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup', 'contextmenu'];
|
1835 |
|
1836 |
|
1837 |
|
1838 | var activatedTargets = [];
|
1839 |
|
1840 |
|
1841 |
|
1842 |
|
1843 |
|
1844 | var MDCRippleFoundation = function (_MDCFoundation) {
|
1845 | _inherits(MDCRippleFoundation, _MDCFoundation);
|
1846 |
|
1847 | _createClass(MDCRippleFoundation, null, [{
|
1848 | key: 'cssClasses',
|
1849 | get: function get() {
|
1850 | return __WEBPACK_IMPORTED_MODULE_2__constants__["a" ];
|
1851 | }
|
1852 | }, {
|
1853 | key: 'strings',
|
1854 | get: function get() {
|
1855 | return __WEBPACK_IMPORTED_MODULE_2__constants__["c" ];
|
1856 | }
|
1857 | }, {
|
1858 | key: 'numbers',
|
1859 | get: function get() {
|
1860 | return __WEBPACK_IMPORTED_MODULE_2__constants__["b" ];
|
1861 | }
|
1862 | }, {
|
1863 | key: 'defaultAdapter',
|
1864 | get: function get() {
|
1865 | return {
|
1866 | browserSupportsCssVars: function browserSupportsCssVars() /* boolean - cached */{},
|
1867 | isUnbounded: function isUnbounded() /* boolean */{},
|
1868 | isSurfaceActive: function isSurfaceActive() /* boolean */{},
|
1869 | isSurfaceDisabled: function isSurfaceDisabled() /* boolean */{},
|
1870 | addClass: function addClass() /* className: string */{},
|
1871 | removeClass: function removeClass() /* className: string */{},
|
1872 | containsEventTarget: function containsEventTarget() /* target: !EventTarget */{},
|
1873 | registerInteractionHandler: function registerInteractionHandler() /* evtType: string, handler: EventListener */{},
|
1874 | deregisterInteractionHandler: function deregisterInteractionHandler() /* evtType: string, handler: EventListener */{},
|
1875 | registerDocumentInteractionHandler: function registerDocumentInteractionHandler() /* evtType: string, handler: EventListener */{},
|
1876 | deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() /* evtType: string, handler: EventListener */{},
|
1877 | registerResizeHandler: function registerResizeHandler() /* handler: EventListener */{},
|
1878 | deregisterResizeHandler: function deregisterResizeHandler() /* handler: EventListener */{},
|
1879 | updateCssVariable: function updateCssVariable() /* varName: string, value: string */{},
|
1880 | computeBoundingRect: function computeBoundingRect() /* ClientRect */{},
|
1881 | getWindowPageOffset: function getWindowPageOffset() /* {x: number, y: number} */{}
|
1882 | };
|
1883 | }
|
1884 | }]);
|
1885 |
|
1886 | function MDCRippleFoundation(adapter) {
|
1887 | _classCallCheck(this, MDCRippleFoundation);
|
1888 |
|
1889 |
|
1890 | var _this = _possibleConstructorReturn(this, (MDCRippleFoundation.__proto__ || Object.getPrototypeOf(MDCRippleFoundation)).call(this, _extends(MDCRippleFoundation.defaultAdapter, adapter)));
|
1891 |
|
1892 | _this.layoutFrame_ = 0;
|
1893 |
|
1894 |
|
1895 | _this.frame_ = { width: 0, height: 0 };
|
1896 |
|
1897 |
|
1898 | _this.activationState_ = _this.defaultActivationState_();
|
1899 |
|
1900 |
|
1901 | _this.initialSize_ = 0;
|
1902 |
|
1903 |
|
1904 | _this.maxRadius_ = 0;
|
1905 |
|
1906 |
|
1907 | _this.activateHandler_ = function (e) {
|
1908 | return _this.activate_(e);
|
1909 | };
|
1910 |
|
1911 |
|
1912 | _this.deactivateHandler_ = function () {
|
1913 | return _this.deactivate_();
|
1914 | };
|
1915 |
|
1916 |
|
1917 | _this.focusHandler_ = function () {
|
1918 | return _this.handleFocus();
|
1919 | };
|
1920 |
|
1921 |
|
1922 | _this.blurHandler_ = function () {
|
1923 | return _this.handleBlur();
|
1924 | };
|
1925 |
|
1926 |
|
1927 | _this.resizeHandler_ = function () {
|
1928 | return _this.layout();
|
1929 | };
|
1930 |
|
1931 |
|
1932 | _this.unboundedCoords_ = {
|
1933 | left: 0,
|
1934 | top: 0
|
1935 | };
|
1936 |
|
1937 |
|
1938 | _this.fgScale_ = 0;
|
1939 |
|
1940 |
|
1941 | _this.activationTimer_ = 0;
|
1942 |
|
1943 |
|
1944 | _this.fgDeactivationRemovalTimer_ = 0;
|
1945 |
|
1946 |
|
1947 | _this.activationAnimationHasEnded_ = false;
|
1948 |
|
1949 |
|
1950 | _this.activationTimerCallback_ = function () {
|
1951 | _this.activationAnimationHasEnded_ = true;
|
1952 | _this.runDeactivationUXLogicIfReady_();
|
1953 | };
|
1954 |
|
1955 |
|
1956 | _this.previousActivationEvent_;
|
1957 | return _this;
|
1958 | }
|
1959 |
|
1960 | |
1961 |
|
1962 |
|
1963 |
|
1964 |
|
1965 |
|
1966 |
|
1967 |
|
1968 |
|
1969 |
|
1970 | _createClass(MDCRippleFoundation, [{
|
1971 | key: 'supportsPressRipple_',
|
1972 | value: function supportsPressRipple_() {
|
1973 | return this.adapter_.browserSupportsCssVars();
|
1974 | }
|
1975 |
|
1976 | |
1977 |
|
1978 |
|
1979 |
|
1980 | }, {
|
1981 | key: 'defaultActivationState_',
|
1982 | value: function defaultActivationState_() {
|
1983 | return {
|
1984 | isActivated: false,
|
1985 | hasDeactivationUXRun: false,
|
1986 | wasActivatedByPointer: false,
|
1987 | wasElementMadeActive: false,
|
1988 | activationEvent: undefined,
|
1989 | isProgrammatic: false
|
1990 | };
|
1991 | }
|
1992 |
|
1993 |
|
1994 |
|
1995 | }, {
|
1996 | key: 'init',
|
1997 | value: function init() {
|
1998 | var _this2 = this;
|
1999 |
|
2000 | var supportsPressRipple = this.supportsPressRipple_();
|
2001 |
|
2002 | this.registerRootHandlers_(supportsPressRipple);
|
2003 |
|
2004 | if (supportsPressRipple) {
|
2005 | var _MDCRippleFoundation$ = MDCRippleFoundation.cssClasses,
|
2006 | ROOT = _MDCRippleFoundation$.ROOT,
|
2007 | UNBOUNDED = _MDCRippleFoundation$.UNBOUNDED;
|
2008 |
|
2009 | requestAnimationFrame(function () {
|
2010 | _this2.adapter_.addClass(ROOT);
|
2011 | if (_this2.adapter_.isUnbounded()) {
|
2012 | _this2.adapter_.addClass(UNBOUNDED);
|
2013 |
|
2014 | _this2.layoutInternal_();
|
2015 | }
|
2016 | });
|
2017 | }
|
2018 | }
|
2019 |
|
2020 |
|
2021 |
|
2022 | }, {
|
2023 | key: 'destroy',
|
2024 | value: function destroy() {
|
2025 | var _this3 = this;
|
2026 |
|
2027 | if (this.supportsPressRipple_()) {
|
2028 | if (this.activationTimer_) {
|
2029 | clearTimeout(this.activationTimer_);
|
2030 | this.activationTimer_ = 0;
|
2031 | this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION);
|
2032 | }
|
2033 |
|
2034 | if (this.fgDeactivationRemovalTimer_) {
|
2035 | clearTimeout(this.fgDeactivationRemovalTimer_);
|
2036 | this.fgDeactivationRemovalTimer_ = 0;
|
2037 | this.adapter_.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION);
|
2038 | }
|
2039 |
|
2040 | var _MDCRippleFoundation$2 = MDCRippleFoundation.cssClasses,
|
2041 | ROOT = _MDCRippleFoundation$2.ROOT,
|
2042 | UNBOUNDED = _MDCRippleFoundation$2.UNBOUNDED;
|
2043 |
|
2044 | requestAnimationFrame(function () {
|
2045 | _this3.adapter_.removeClass(ROOT);
|
2046 | _this3.adapter_.removeClass(UNBOUNDED);
|
2047 | _this3.removeCssVars_();
|
2048 | });
|
2049 | }
|
2050 |
|
2051 | this.deregisterRootHandlers_();
|
2052 | this.deregisterDeactivationHandlers_();
|
2053 | }
|
2054 |
|
2055 | |
2056 |
|
2057 |
|
2058 |
|
2059 |
|
2060 | }, {
|
2061 | key: 'registerRootHandlers_',
|
2062 | value: function registerRootHandlers_(supportsPressRipple) {
|
2063 | var _this4 = this;
|
2064 |
|
2065 | if (supportsPressRipple) {
|
2066 | ACTIVATION_EVENT_TYPES.forEach(function (type) {
|
2067 | _this4.adapter_.registerInteractionHandler(type, _this4.activateHandler_);
|
2068 | });
|
2069 | if (this.adapter_.isUnbounded()) {
|
2070 | this.adapter_.registerResizeHandler(this.resizeHandler_);
|
2071 | }
|
2072 | }
|
2073 |
|
2074 | this.adapter_.registerInteractionHandler('focus', this.focusHandler_);
|
2075 | this.adapter_.registerInteractionHandler('blur', this.blurHandler_);
|
2076 | }
|
2077 |
|
2078 | |
2079 |
|
2080 |
|
2081 |
|
2082 |
|
2083 | }, {
|
2084 | key: 'registerDeactivationHandlers_',
|
2085 | value: function registerDeactivationHandlers_(e) {
|
2086 | var _this5 = this;
|
2087 |
|
2088 | if (e.type === 'keydown') {
|
2089 | this.adapter_.registerInteractionHandler('keyup', this.deactivateHandler_);
|
2090 | } else {
|
2091 | POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (type) {
|
2092 | _this5.adapter_.registerDocumentInteractionHandler(type, _this5.deactivateHandler_);
|
2093 | });
|
2094 | }
|
2095 | }
|
2096 |
|
2097 |
|
2098 |
|
2099 | }, {
|
2100 | key: 'deregisterRootHandlers_',
|
2101 | value: function deregisterRootHandlers_() {
|
2102 | var _this6 = this;
|
2103 |
|
2104 | ACTIVATION_EVENT_TYPES.forEach(function (type) {
|
2105 | _this6.adapter_.deregisterInteractionHandler(type, _this6.activateHandler_);
|
2106 | });
|
2107 | this.adapter_.deregisterInteractionHandler('focus', this.focusHandler_);
|
2108 | this.adapter_.deregisterInteractionHandler('blur', this.blurHandler_);
|
2109 |
|
2110 | if (this.adapter_.isUnbounded()) {
|
2111 | this.adapter_.deregisterResizeHandler(this.resizeHandler_);
|
2112 | }
|
2113 | }
|
2114 |
|
2115 |
|
2116 |
|
2117 | }, {
|
2118 | key: 'deregisterDeactivationHandlers_',
|
2119 | value: function deregisterDeactivationHandlers_() {
|
2120 | var _this7 = this;
|
2121 |
|
2122 | this.adapter_.deregisterInteractionHandler('keyup', this.deactivateHandler_);
|
2123 | POINTER_DEACTIVATION_EVENT_TYPES.forEach(function (type) {
|
2124 | _this7.adapter_.deregisterDocumentInteractionHandler(type, _this7.deactivateHandler_);
|
2125 | });
|
2126 | }
|
2127 |
|
2128 |
|
2129 |
|
2130 | }, {
|
2131 | key: 'removeCssVars_',
|
2132 | value: function removeCssVars_() {
|
2133 | var _this8 = this;
|
2134 |
|
2135 | var strings = MDCRippleFoundation.strings;
|
2136 |
|
2137 | Object.keys(strings).forEach(function (k) {
|
2138 | if (k.indexOf('VAR_') === 0) {
|
2139 | _this8.adapter_.updateCssVariable(strings[k], null);
|
2140 | }
|
2141 | });
|
2142 | }
|
2143 |
|
2144 | |
2145 |
|
2146 |
|
2147 |
|
2148 |
|
2149 | }, {
|
2150 | key: 'activate_',
|
2151 | value: function activate_(e) {
|
2152 | var _this9 = this;
|
2153 |
|
2154 | if (this.adapter_.isSurfaceDisabled()) {
|
2155 | return;
|
2156 | }
|
2157 |
|
2158 | var activationState = this.activationState_;
|
2159 | if (activationState.isActivated) {
|
2160 | return;
|
2161 | }
|
2162 |
|
2163 |
|
2164 | var previousActivationEvent = this.previousActivationEvent_;
|
2165 | var isSameInteraction = previousActivationEvent && e !== undefined && previousActivationEvent.type !== e.type;
|
2166 | if (isSameInteraction) {
|
2167 | return;
|
2168 | }
|
2169 |
|
2170 | activationState.isActivated = true;
|
2171 | activationState.isProgrammatic = e === undefined;
|
2172 | activationState.activationEvent = e;
|
2173 | activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : e !== undefined && (e.type === 'mousedown' || e.type === 'touchstart' || e.type === 'pointerdown');
|
2174 |
|
2175 | var hasActivatedChild = e !== undefined && activatedTargets.length > 0 && activatedTargets.some(function (target) {
|
2176 | return _this9.adapter_.containsEventTarget(target);
|
2177 | });
|
2178 | if (hasActivatedChild) {
|
2179 |
|
2180 | this.resetActivationState_();
|
2181 | return;
|
2182 | }
|
2183 |
|
2184 | if (e !== undefined) {
|
2185 | activatedTargets.push( e.target);
|
2186 | this.registerDeactivationHandlers_(e);
|
2187 | }
|
2188 |
|
2189 | activationState.wasElementMadeActive = this.checkElementMadeActive_(e);
|
2190 | if (activationState.wasElementMadeActive) {
|
2191 | this.animateActivation_();
|
2192 | }
|
2193 |
|
2194 | requestAnimationFrame(function () {
|
2195 |
|
2196 | activatedTargets = [];
|
2197 |
|
2198 | if (!activationState.wasElementMadeActive && e !== undefined && (e.key === ' ' || e.keyCode === 32)) {
|
2199 |
|
2200 |
|
2201 |
|
2202 |
|
2203 |
|
2204 |
|
2205 | activationState.wasElementMadeActive = _this9.checkElementMadeActive_(e);
|
2206 | if (activationState.wasElementMadeActive) {
|
2207 | _this9.animateActivation_();
|
2208 | }
|
2209 | }
|
2210 |
|
2211 | if (!activationState.wasElementMadeActive) {
|
2212 |
|
2213 | _this9.activationState_ = _this9.defaultActivationState_();
|
2214 | }
|
2215 | });
|
2216 | }
|
2217 |
|
2218 | |
2219 |
|
2220 |
|
2221 |
|
2222 |
|
2223 | }, {
|
2224 | key: 'checkElementMadeActive_',
|
2225 | value: function checkElementMadeActive_(e) {
|
2226 | return e !== undefined && e.type === 'keydown' ? this.adapter_.isSurfaceActive() : true;
|
2227 | }
|
2228 |
|
2229 | |
2230 |
|
2231 |
|
2232 |
|
2233 | }, {
|
2234 | key: 'activate',
|
2235 | value: function activate(event) {
|
2236 | this.activate_(event);
|
2237 | }
|
2238 |
|
2239 |
|
2240 |
|
2241 | }, {
|
2242 | key: 'animateActivation_',
|
2243 | value: function animateActivation_() {
|
2244 | var _this10 = this;
|
2245 |
|
2246 | var _MDCRippleFoundation$3 = MDCRippleFoundation.strings,
|
2247 | VAR_FG_TRANSLATE_START = _MDCRippleFoundation$3.VAR_FG_TRANSLATE_START,
|
2248 | VAR_FG_TRANSLATE_END = _MDCRippleFoundation$3.VAR_FG_TRANSLATE_END;
|
2249 | var _MDCRippleFoundation$4 = MDCRippleFoundation.cssClasses,
|
2250 | FG_DEACTIVATION = _MDCRippleFoundation$4.FG_DEACTIVATION,
|
2251 | FG_ACTIVATION = _MDCRippleFoundation$4.FG_ACTIVATION;
|
2252 | var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS;
|
2253 |
|
2254 |
|
2255 | this.layoutInternal_();
|
2256 |
|
2257 | var translateStart = '';
|
2258 | var translateEnd = '';
|
2259 |
|
2260 | if (!this.adapter_.isUnbounded()) {
|
2261 | var _getFgTranslationCoor = this.getFgTranslationCoordinates_(),
|
2262 | startPoint = _getFgTranslationCoor.startPoint,
|
2263 | endPoint = _getFgTranslationCoor.endPoint;
|
2264 |
|
2265 | translateStart = startPoint.x + 'px, ' + startPoint.y + 'px';
|
2266 | translateEnd = endPoint.x + 'px, ' + endPoint.y + 'px';
|
2267 | }
|
2268 |
|
2269 | this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart);
|
2270 | this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd);
|
2271 |
|
2272 | clearTimeout(this.activationTimer_);
|
2273 | clearTimeout(this.fgDeactivationRemovalTimer_);
|
2274 | this.rmBoundedActivationClasses_();
|
2275 | this.adapter_.removeClass(FG_DEACTIVATION);
|
2276 |
|
2277 |
|
2278 | this.adapter_.computeBoundingRect();
|
2279 | this.adapter_.addClass(FG_ACTIVATION);
|
2280 | this.activationTimer_ = setTimeout(function () {
|
2281 | return _this10.activationTimerCallback_();
|
2282 | }, DEACTIVATION_TIMEOUT_MS);
|
2283 | }
|
2284 |
|
2285 | |
2286 |
|
2287 |
|
2288 |
|
2289 |
|
2290 | }, {
|
2291 | key: 'getFgTranslationCoordinates_',
|
2292 | value: function getFgTranslationCoordinates_() {
|
2293 | var _activationState_ = this.activationState_,
|
2294 | activationEvent = _activationState_.activationEvent,
|
2295 | wasActivatedByPointer = _activationState_.wasActivatedByPointer;
|
2296 |
|
2297 |
|
2298 | var startPoint = void 0;
|
2299 | if (wasActivatedByPointer) {
|
2300 | startPoint = Object(__WEBPACK_IMPORTED_MODULE_3__util__["getNormalizedEventCoords"])(
|
2301 | activationEvent, this.adapter_.getWindowPageOffset(), this.adapter_.computeBoundingRect());
|
2302 | } else {
|
2303 | startPoint = {
|
2304 | x: this.frame_.width / 2,
|
2305 | y: this.frame_.height / 2
|
2306 | };
|
2307 | }
|
2308 |
|
2309 | startPoint = {
|
2310 | x: startPoint.x - this.initialSize_ / 2,
|
2311 | y: startPoint.y - this.initialSize_ / 2
|
2312 | };
|
2313 |
|
2314 | var endPoint = {
|
2315 | x: this.frame_.width / 2 - this.initialSize_ / 2,
|
2316 | y: this.frame_.height / 2 - this.initialSize_ / 2
|
2317 | };
|
2318 |
|
2319 | return { startPoint: startPoint, endPoint: endPoint };
|
2320 | }
|
2321 |
|
2322 |
|
2323 |
|
2324 | }, {
|
2325 | key: 'runDeactivationUXLogicIfReady_',
|
2326 | value: function runDeactivationUXLogicIfReady_() {
|
2327 | var _this11 = this;
|
2328 |
|
2329 |
|
2330 |
|
2331 | var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION;
|
2332 | var _activationState_2 = this.activationState_,
|
2333 | hasDeactivationUXRun = _activationState_2.hasDeactivationUXRun,
|
2334 | isActivated = _activationState_2.isActivated;
|
2335 |
|
2336 | var activationHasEnded = hasDeactivationUXRun || !isActivated;
|
2337 |
|
2338 | if (activationHasEnded && this.activationAnimationHasEnded_) {
|
2339 | this.rmBoundedActivationClasses_();
|
2340 | this.adapter_.addClass(FG_DEACTIVATION);
|
2341 | this.fgDeactivationRemovalTimer_ = setTimeout(function () {
|
2342 | _this11.adapter_.removeClass(FG_DEACTIVATION);
|
2343 | }, __WEBPACK_IMPORTED_MODULE_2__constants__["b" ].FG_DEACTIVATION_MS);
|
2344 | }
|
2345 | }
|
2346 |
|
2347 |
|
2348 |
|
2349 | }, {
|
2350 | key: 'rmBoundedActivationClasses_',
|
2351 | value: function rmBoundedActivationClasses_() {
|
2352 | var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION;
|
2353 |
|
2354 | this.adapter_.removeClass(FG_ACTIVATION);
|
2355 | this.activationAnimationHasEnded_ = false;
|
2356 | this.adapter_.computeBoundingRect();
|
2357 | }
|
2358 | }, {
|
2359 | key: 'resetActivationState_',
|
2360 | value: function resetActivationState_() {
|
2361 | var _this12 = this;
|
2362 |
|
2363 | this.previousActivationEvent_ = this.activationState_.activationEvent;
|
2364 | this.activationState_ = this.defaultActivationState_();
|
2365 |
|
2366 |
|
2367 | setTimeout(function () {
|
2368 | return _this12.previousActivationEvent_ = undefined;
|
2369 | }, MDCRippleFoundation.numbers.TAP_DELAY_MS);
|
2370 | }
|
2371 |
|
2372 | |
2373 |
|
2374 |
|
2375 |
|
2376 | }, {
|
2377 | key: 'deactivate_',
|
2378 | value: function deactivate_() {
|
2379 | var _this13 = this;
|
2380 |
|
2381 | var activationState = this.activationState_;
|
2382 |
|
2383 | if (!activationState.isActivated) {
|
2384 | return;
|
2385 | }
|
2386 |
|
2387 | var state = _extends({}, activationState);
|
2388 |
|
2389 | if (activationState.isProgrammatic) {
|
2390 | requestAnimationFrame(function () {
|
2391 | return _this13.animateDeactivation_(state);
|
2392 | });
|
2393 | this.resetActivationState_();
|
2394 | } else {
|
2395 | this.deregisterDeactivationHandlers_();
|
2396 | requestAnimationFrame(function () {
|
2397 | _this13.activationState_.hasDeactivationUXRun = true;
|
2398 | _this13.animateDeactivation_(state);
|
2399 | _this13.resetActivationState_();
|
2400 | });
|
2401 | }
|
2402 | }
|
2403 | }, {
|
2404 | key: 'deactivate',
|
2405 | value: function deactivate() {
|
2406 | this.deactivate_();
|
2407 | }
|
2408 |
|
2409 | |
2410 |
|
2411 |
|
2412 |
|
2413 |
|
2414 | }, {
|
2415 | key: 'animateDeactivation_',
|
2416 | value: function animateDeactivation_(_ref) {
|
2417 | var wasActivatedByPointer = _ref.wasActivatedByPointer,
|
2418 | wasElementMadeActive = _ref.wasElementMadeActive;
|
2419 |
|
2420 | if (wasActivatedByPointer || wasElementMadeActive) {
|
2421 | this.runDeactivationUXLogicIfReady_();
|
2422 | }
|
2423 | }
|
2424 | }, {
|
2425 | key: 'layout',
|
2426 | value: function layout() {
|
2427 | var _this14 = this;
|
2428 |
|
2429 | if (this.layoutFrame_) {
|
2430 | cancelAnimationFrame(this.layoutFrame_);
|
2431 | }
|
2432 | this.layoutFrame_ = requestAnimationFrame(function () {
|
2433 | _this14.layoutInternal_();
|
2434 | _this14.layoutFrame_ = 0;
|
2435 | });
|
2436 | }
|
2437 |
|
2438 |
|
2439 |
|
2440 | }, {
|
2441 | key: 'layoutInternal_',
|
2442 | value: function layoutInternal_() {
|
2443 | var _this15 = this;
|
2444 |
|
2445 | this.frame_ = this.adapter_.computeBoundingRect();
|
2446 | var maxDim = Math.max(this.frame_.height, this.frame_.width);
|
2447 |
|
2448 |
|
2449 |
|
2450 |
|
2451 |
|
2452 |
|
2453 |
|
2454 | var getBoundedRadius = function getBoundedRadius() {
|
2455 | var hypotenuse = Math.sqrt(Math.pow(_this15.frame_.width, 2) + Math.pow(_this15.frame_.height, 2));
|
2456 | return hypotenuse + MDCRippleFoundation.numbers.PADDING;
|
2457 | };
|
2458 |
|
2459 | this.maxRadius_ = this.adapter_.isUnbounded() ? maxDim : getBoundedRadius();
|
2460 |
|
2461 |
|
2462 | this.initialSize_ = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE);
|
2463 | this.fgScale_ = this.maxRadius_ / this.initialSize_;
|
2464 |
|
2465 | this.updateLayoutCssVars_();
|
2466 | }
|
2467 |
|
2468 |
|
2469 |
|
2470 | }, {
|
2471 | key: 'updateLayoutCssVars_',
|
2472 | value: function updateLayoutCssVars_() {
|
2473 | var _MDCRippleFoundation$5 = MDCRippleFoundation.strings,
|
2474 | VAR_FG_SIZE = _MDCRippleFoundation$5.VAR_FG_SIZE,
|
2475 | VAR_LEFT = _MDCRippleFoundation$5.VAR_LEFT,
|
2476 | VAR_TOP = _MDCRippleFoundation$5.VAR_TOP,
|
2477 | VAR_FG_SCALE = _MDCRippleFoundation$5.VAR_FG_SCALE;
|
2478 |
|
2479 |
|
2480 | this.adapter_.updateCssVariable(VAR_FG_SIZE, this.initialSize_ + 'px');
|
2481 | this.adapter_.updateCssVariable(VAR_FG_SCALE, this.fgScale_);
|
2482 |
|
2483 | if (this.adapter_.isUnbounded()) {
|
2484 | this.unboundedCoords_ = {
|
2485 | left: Math.round(this.frame_.width / 2 - this.initialSize_ / 2),
|
2486 | top: Math.round(this.frame_.height / 2 - this.initialSize_ / 2)
|
2487 | };
|
2488 |
|
2489 | this.adapter_.updateCssVariable(VAR_LEFT, this.unboundedCoords_.left + 'px');
|
2490 | this.adapter_.updateCssVariable(VAR_TOP, this.unboundedCoords_.top + 'px');
|
2491 | }
|
2492 | }
|
2493 |
|
2494 |
|
2495 |
|
2496 | }, {
|
2497 | key: 'setUnbounded',
|
2498 | value: function setUnbounded(unbounded) {
|
2499 | var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED;
|
2500 |
|
2501 | if (unbounded) {
|
2502 | this.adapter_.addClass(UNBOUNDED);
|
2503 | } else {
|
2504 | this.adapter_.removeClass(UNBOUNDED);
|
2505 | }
|
2506 | }
|
2507 | }, {
|
2508 | key: 'handleFocus',
|
2509 | value: function handleFocus() {
|
2510 | var _this16 = this;
|
2511 |
|
2512 | requestAnimationFrame(function () {
|
2513 | return _this16.adapter_.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
|
2514 | });
|
2515 | }
|
2516 | }, {
|
2517 | key: 'handleBlur',
|
2518 | value: function handleBlur() {
|
2519 | var _this17 = this;
|
2520 |
|
2521 | requestAnimationFrame(function () {
|
2522 | return _this17.adapter_.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
|
2523 | });
|
2524 | }
|
2525 | }]);
|
2526 |
|
2527 | return MDCRippleFoundation;
|
2528 | }(__WEBPACK_IMPORTED_MODULE_0__material_base_foundation__["a" ]);
|
2529 |
|
2530 | __webpack_exports__["a"] = (MDCRippleFoundation);
|
2531 |
|
2532 | }),
|
2533 |
|
2534 | 6:
|
2535 | (function(module, __webpack_exports__, __webpack_require__) {
|
2536 |
|
2537 | "use strict";
|
2538 | __webpack_require__.d(__webpack_exports__, "a", function() { return cssClasses; });
|
2539 | __webpack_require__.d(__webpack_exports__, "c", function() { return strings; });
|
2540 | __webpack_require__.d(__webpack_exports__, "b", function() { return numbers; });
|
2541 |
|
2542 |
|
2543 |
|
2544 |
|
2545 |
|
2546 |
|
2547 |
|
2548 |
|
2549 |
|
2550 |
|
2551 |
|
2552 |
|
2553 |
|
2554 |
|
2555 |
|
2556 |
|
2557 |
|
2558 |
|
2559 |
|
2560 |
|
2561 |
|
2562 |
|
2563 |
|
2564 | var cssClasses = {
|
2565 |
|
2566 |
|
2567 |
|
2568 | ROOT: 'mdc-ripple-upgraded',
|
2569 | UNBOUNDED: 'mdc-ripple-upgraded--unbounded',
|
2570 | BG_FOCUSED: 'mdc-ripple-upgraded--background-focused',
|
2571 | FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation',
|
2572 | FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation'
|
2573 | };
|
2574 |
|
2575 | var strings = {
|
2576 | VAR_LEFT: '--mdc-ripple-left',
|
2577 | VAR_TOP: '--mdc-ripple-top',
|
2578 | VAR_FG_SIZE: '--mdc-ripple-fg-size',
|
2579 | VAR_FG_SCALE: '--mdc-ripple-fg-scale',
|
2580 | VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start',
|
2581 | VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end'
|
2582 | };
|
2583 |
|
2584 | var numbers = {
|
2585 | PADDING: 10,
|
2586 | INITIAL_ORIGIN_SCALE: 0.6,
|
2587 | DEACTIVATION_TIMEOUT_MS: 225,
|
2588 | FG_DEACTIVATION_MS: 150,
|
2589 | TAP_DELAY_MS: 300 };
|
2590 |
|
2591 |
|
2592 |
|
2593 | })
|
2594 |
|
2595 | });
|
2596 | });
|
2597 |
|
\ | No newline at end of file |