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/top-app-bar", [], factory);
|
13 | else if(typeof exports === 'object')
|
14 | exports["top-app-bar"] = factory();
|
15 | else
|
16 | root["mdc"] = root["mdc"] || {}, root["mdc"]["top-app-bar"] = 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-top-app-bar/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-dom/events.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 | Object.defineProperty(exports, "__esModule", { value: true });
|
374 | exports.applyPassive = void 0;
|
375 |
|
376 |
|
377 |
|
378 |
|
379 | function applyPassive(globalObj) {
|
380 | if (globalObj === void 0) {
|
381 | globalObj = window;
|
382 | }
|
383 | return supportsPassiveOption(globalObj) ? { passive: true } : false;
|
384 | }
|
385 | exports.applyPassive = applyPassive;
|
386 | function supportsPassiveOption(globalObj) {
|
387 | if (globalObj === void 0) {
|
388 | globalObj = window;
|
389 | }
|
390 |
|
391 |
|
392 | var passiveSupported = false;
|
393 | try {
|
394 | var options = {
|
395 |
|
396 |
|
397 | get passive() {
|
398 | passiveSupported = true;
|
399 | return false;
|
400 | }
|
401 | };
|
402 | var handler = function handler() {};
|
403 | globalObj.document.addEventListener('test', handler, options);
|
404 | globalObj.document.removeEventListener('test', handler, options);
|
405 | } catch (err) {
|
406 | passiveSupported = false;
|
407 | }
|
408 | return passiveSupported;
|
409 | }
|
410 |
|
411 | }),
|
412 |
|
413 | "./packages/mdc-dom/ponyfill.ts":
|
414 |
|
415 |
|
416 |
|
417 |
|
418 | (function(module, exports, __webpack_require__) {
|
419 |
|
420 | "use strict";
|
421 |
|
422 |
|
423 |
|
424 |
|
425 |
|
426 |
|
427 |
|
428 |
|
429 |
|
430 |
|
431 |
|
432 |
|
433 |
|
434 |
|
435 |
|
436 |
|
437 |
|
438 |
|
439 |
|
440 |
|
441 |
|
442 |
|
443 |
|
444 |
|
445 | Object.defineProperty(exports, "__esModule", { value: true });
|
446 | exports.estimateScrollWidth = exports.matches = exports.closest = void 0;
|
447 |
|
448 |
|
449 |
|
450 |
|
451 | function closest(element, selector) {
|
452 | if (element.closest) {
|
453 | return element.closest(selector);
|
454 | }
|
455 | var el = element;
|
456 | while (el) {
|
457 | if (matches(el, selector)) {
|
458 | return el;
|
459 | }
|
460 | el = el.parentElement;
|
461 | }
|
462 | return null;
|
463 | }
|
464 | exports.closest = closest;
|
465 | function matches(element, selector) {
|
466 | var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector;
|
467 | return nativeMatches.call(element, selector);
|
468 | }
|
469 | exports.matches = matches;
|
470 |
|
471 |
|
472 |
|
473 |
|
474 |
|
475 |
|
476 |
|
477 |
|
478 | function estimateScrollWidth(element) {
|
479 |
|
480 |
|
481 |
|
482 |
|
483 | var htmlEl = element;
|
484 | if (htmlEl.offsetParent !== null) {
|
485 | return htmlEl.scrollWidth;
|
486 | }
|
487 | var clone = htmlEl.cloneNode(true);
|
488 | clone.style.setProperty('position', 'absolute');
|
489 | clone.style.setProperty('transform', 'translate(-9999px, -9999px)');
|
490 | document.documentElement.appendChild(clone);
|
491 | var scrollWidth = clone.scrollWidth;
|
492 | document.documentElement.removeChild(clone);
|
493 | return scrollWidth;
|
494 | }
|
495 | exports.estimateScrollWidth = estimateScrollWidth;
|
496 |
|
497 | }),
|
498 |
|
499 | "./packages/mdc-ripple/component.ts":
|
500 |
|
501 |
|
502 |
|
503 |
|
504 | (function(module, exports, __webpack_require__) {
|
505 |
|
506 | "use strict";
|
507 |
|
508 |
|
509 |
|
510 |
|
511 |
|
512 |
|
513 |
|
514 |
|
515 |
|
516 |
|
517 |
|
518 |
|
519 |
|
520 |
|
521 |
|
522 |
|
523 |
|
524 |
|
525 |
|
526 |
|
527 |
|
528 |
|
529 |
|
530 |
|
531 | var __extends = this && this.__extends || function () {
|
532 | var _extendStatics = function extendStatics(d, b) {
|
533 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
534 | d.__proto__ = b;
|
535 | } || function (d, b) {
|
536 | for (var p in b) {
|
537 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
538 | }
|
539 | };
|
540 | return _extendStatics(d, b);
|
541 | };
|
542 | return function (d, b) {
|
543 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
544 | _extendStatics(d, b);
|
545 | function __() {
|
546 | this.constructor = d;
|
547 | }
|
548 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
549 | };
|
550 | }();
|
551 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
552 | if (k2 === undefined) k2 = k;
|
553 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
554 | return m[k];
|
555 | } });
|
556 | } : function (o, m, k, k2) {
|
557 | if (k2 === undefined) k2 = k;
|
558 | o[k2] = m[k];
|
559 | });
|
560 | var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
561 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
562 | } : function (o, v) {
|
563 | o["default"] = v;
|
564 | });
|
565 | var __importStar = this && this.__importStar || function (mod) {
|
566 | if (mod && mod.__esModule) return mod;
|
567 | var result = {};
|
568 | if (mod != null) for (var k in mod) {
|
569 | if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
570 | }__setModuleDefault(result, mod);
|
571 | return result;
|
572 | };
|
573 | Object.defineProperty(exports, "__esModule", { value: true });
|
574 | exports.MDCRipple = void 0;
|
575 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
576 | var events_1 = __webpack_require__( "./packages/mdc-dom/events.ts");
|
577 | var ponyfill_1 = __webpack_require__( "./packages/mdc-dom/ponyfill.ts");
|
578 | var foundation_1 = __webpack_require__( "./packages/mdc-ripple/foundation.ts");
|
579 | var util = __importStar(__webpack_require__( "./packages/mdc-ripple/util.ts"));
|
580 | var MDCRipple = function (_super) {
|
581 | __extends(MDCRipple, _super);
|
582 | function MDCRipple() {
|
583 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
584 | _this.disabled = false;
|
585 | return _this;
|
586 | }
|
587 | MDCRipple.attachTo = function (root, opts) {
|
588 | if (opts === void 0) {
|
589 | opts = {
|
590 | isUnbounded: undefined
|
591 | };
|
592 | }
|
593 | var ripple = new MDCRipple(root);
|
594 |
|
595 | if (opts.isUnbounded !== undefined) {
|
596 | ripple.unbounded = opts.isUnbounded;
|
597 | }
|
598 | return ripple;
|
599 | };
|
600 | MDCRipple.createAdapter = function (instance) {
|
601 | return {
|
602 | addClass: function addClass(className) {
|
603 | return instance.root.classList.add(className);
|
604 | },
|
605 | browserSupportsCssVars: function browserSupportsCssVars() {
|
606 | return util.supportsCssVariables(window);
|
607 | },
|
608 | computeBoundingRect: function computeBoundingRect() {
|
609 | return instance.root.getBoundingClientRect();
|
610 | },
|
611 | containsEventTarget: function containsEventTarget(target) {
|
612 | return instance.root.contains(target);
|
613 | },
|
614 | deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) {
|
615 | return document.documentElement.removeEventListener(evtType, handler, events_1.applyPassive());
|
616 | },
|
617 | deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
|
618 | return instance.root.removeEventListener(evtType, handler, events_1.applyPassive());
|
619 | },
|
620 | deregisterResizeHandler: function deregisterResizeHandler(handler) {
|
621 | return window.removeEventListener('resize', handler);
|
622 | },
|
623 | getWindowPageOffset: function getWindowPageOffset() {
|
624 | return { x: window.pageXOffset, y: window.pageYOffset };
|
625 | },
|
626 | isSurfaceActive: function isSurfaceActive() {
|
627 | return ponyfill_1.matches(instance.root, ':active');
|
628 | },
|
629 | isSurfaceDisabled: function isSurfaceDisabled() {
|
630 | return Boolean(instance.disabled);
|
631 | },
|
632 | isUnbounded: function isUnbounded() {
|
633 | return Boolean(instance.unbounded);
|
634 | },
|
635 | registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) {
|
636 | return document.documentElement.addEventListener(evtType, handler, events_1.applyPassive());
|
637 | },
|
638 | registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
|
639 | return instance.root.addEventListener(evtType, handler, events_1.applyPassive());
|
640 | },
|
641 | registerResizeHandler: function registerResizeHandler(handler) {
|
642 | return window.addEventListener('resize', handler);
|
643 | },
|
644 | removeClass: function removeClass(className) {
|
645 | return instance.root.classList.remove(className);
|
646 | },
|
647 | updateCssVariable: function updateCssVariable(varName, value) {
|
648 | return instance.root.style.setProperty(varName, value);
|
649 | }
|
650 | };
|
651 | };
|
652 | Object.defineProperty(MDCRipple.prototype, "unbounded", {
|
653 | get: function get() {
|
654 | return Boolean(this.isUnbounded);
|
655 | },
|
656 | set: function set(unbounded) {
|
657 | this.isUnbounded = Boolean(unbounded);
|
658 | this.setUnbounded();
|
659 | },
|
660 | enumerable: false,
|
661 | configurable: true
|
662 | });
|
663 | MDCRipple.prototype.activate = function () {
|
664 | this.foundation.activate();
|
665 | };
|
666 | MDCRipple.prototype.deactivate = function () {
|
667 | this.foundation.deactivate();
|
668 | };
|
669 | MDCRipple.prototype.layout = function () {
|
670 | this.foundation.layout();
|
671 | };
|
672 | MDCRipple.prototype.getDefaultFoundation = function () {
|
673 | return new foundation_1.MDCRippleFoundation(MDCRipple.createAdapter(this));
|
674 | };
|
675 | MDCRipple.prototype.initialSyncWithDOM = function () {
|
676 | var root = this.root;
|
677 | this.isUnbounded = 'mdcRippleIsUnbounded' in root.dataset;
|
678 | };
|
679 | |
680 |
|
681 |
|
682 |
|
683 |
|
684 |
|
685 | MDCRipple.prototype.setUnbounded = function () {
|
686 | this.foundation.setUnbounded(Boolean(this.isUnbounded));
|
687 | };
|
688 | return MDCRipple;
|
689 | }(component_1.MDCComponent);
|
690 | exports.MDCRipple = MDCRipple;
|
691 |
|
692 | }),
|
693 |
|
694 | "./packages/mdc-ripple/constants.ts":
|
695 |
|
696 |
|
697 |
|
698 |
|
699 | (function(module, exports, __webpack_require__) {
|
700 |
|
701 | "use strict";
|
702 |
|
703 |
|
704 |
|
705 |
|
706 |
|
707 |
|
708 |
|
709 |
|
710 |
|
711 |
|
712 |
|
713 |
|
714 |
|
715 |
|
716 |
|
717 |
|
718 |
|
719 |
|
720 |
|
721 |
|
722 |
|
723 |
|
724 |
|
725 |
|
726 | Object.defineProperty(exports, "__esModule", { value: true });
|
727 | exports.numbers = exports.strings = exports.cssClasses = void 0;
|
728 | exports.cssClasses = {
|
729 |
|
730 |
|
731 |
|
732 | BG_FOCUSED: 'mdc-ripple-upgraded--background-focused',
|
733 | FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation',
|
734 | FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation',
|
735 | ROOT: 'mdc-ripple-upgraded',
|
736 | UNBOUNDED: 'mdc-ripple-upgraded--unbounded'
|
737 | };
|
738 | exports.strings = {
|
739 | VAR_FG_SCALE: '--mdc-ripple-fg-scale',
|
740 | VAR_FG_SIZE: '--mdc-ripple-fg-size',
|
741 | VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end',
|
742 | VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start',
|
743 | VAR_LEFT: '--mdc-ripple-left',
|
744 | VAR_TOP: '--mdc-ripple-top'
|
745 | };
|
746 | exports.numbers = {
|
747 | DEACTIVATION_TIMEOUT_MS: 225,
|
748 | FG_DEACTIVATION_MS: 150,
|
749 | INITIAL_ORIGIN_SCALE: 0.6,
|
750 | PADDING: 10,
|
751 | TAP_DELAY_MS: 300 };
|
752 |
|
753 | }),
|
754 |
|
755 | "./packages/mdc-ripple/foundation.ts":
|
756 |
|
757 |
|
758 |
|
759 |
|
760 | (function(module, exports, __webpack_require__) {
|
761 |
|
762 | "use strict";
|
763 |
|
764 |
|
765 |
|
766 |
|
767 |
|
768 |
|
769 |
|
770 |
|
771 |
|
772 |
|
773 |
|
774 |
|
775 |
|
776 |
|
777 |
|
778 |
|
779 |
|
780 |
|
781 |
|
782 |
|
783 |
|
784 |
|
785 |
|
786 |
|
787 | var __extends = this && this.__extends || function () {
|
788 | var _extendStatics = function extendStatics(d, b) {
|
789 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
790 | d.__proto__ = b;
|
791 | } || function (d, b) {
|
792 | for (var p in b) {
|
793 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
794 | }
|
795 | };
|
796 | return _extendStatics(d, b);
|
797 | };
|
798 | return function (d, b) {
|
799 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
800 | _extendStatics(d, b);
|
801 | function __() {
|
802 | this.constructor = d;
|
803 | }
|
804 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
805 | };
|
806 | }();
|
807 | var __assign = this && this.__assign || function () {
|
808 | __assign = Object.assign || function (t) {
|
809 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
810 | s = arguments[i];
|
811 | for (var p in s) {
|
812 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
813 | }
|
814 | }
|
815 | return t;
|
816 | };
|
817 | return __assign.apply(this, arguments);
|
818 | };
|
819 | var __values = this && this.__values || function (o) {
|
820 | var s = typeof Symbol === "function" && Symbol.iterator,
|
821 | m = s && o[s],
|
822 | i = 0;
|
823 | if (m) return m.call(o);
|
824 | if (o && typeof o.length === "number") return {
|
825 | next: function next() {
|
826 | if (o && i >= o.length) o = void 0;
|
827 | return { value: o && o[i++], done: !o };
|
828 | }
|
829 | };
|
830 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
831 | };
|
832 | Object.defineProperty(exports, "__esModule", { value: true });
|
833 | exports.MDCRippleFoundation = void 0;
|
834 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
835 | var constants_1 = __webpack_require__( "./packages/mdc-ripple/constants.ts");
|
836 | var util_1 = __webpack_require__( "./packages/mdc-ripple/util.ts");
|
837 |
|
838 | var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown'];
|
839 |
|
840 | var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup', 'contextmenu'];
|
841 |
|
842 | var activatedTargets = [];
|
843 | var MDCRippleFoundation = function (_super) {
|
844 | __extends(MDCRippleFoundation, _super);
|
845 | function MDCRippleFoundation(adapter) {
|
846 | var _this = _super.call(this, __assign(__assign({}, MDCRippleFoundation.defaultAdapter), adapter)) || this;
|
847 | _this.activationAnimationHasEnded = false;
|
848 | _this.activationTimer = 0;
|
849 | _this.fgDeactivationRemovalTimer = 0;
|
850 | _this.fgScale = '0';
|
851 | _this.frame = { width: 0, height: 0 };
|
852 | _this.initialSize = 0;
|
853 | _this.layoutFrame = 0;
|
854 | _this.maxRadius = 0;
|
855 | _this.unboundedCoords = { left: 0, top: 0 };
|
856 | _this.activationState = _this.defaultActivationState();
|
857 | _this.activationTimerCallback = function () {
|
858 | _this.activationAnimationHasEnded = true;
|
859 | _this.runDeactivationUXLogicIfReady();
|
860 | };
|
861 | _this.activateHandler = function (e) {
|
862 | _this.activateImpl(e);
|
863 | };
|
864 | _this.deactivateHandler = function () {
|
865 | _this.deactivateImpl();
|
866 | };
|
867 | _this.focusHandler = function () {
|
868 | _this.handleFocus();
|
869 | };
|
870 | _this.blurHandler = function () {
|
871 | _this.handleBlur();
|
872 | };
|
873 | _this.resizeHandler = function () {
|
874 | _this.layout();
|
875 | };
|
876 | return _this;
|
877 | }
|
878 | Object.defineProperty(MDCRippleFoundation, "cssClasses", {
|
879 | get: function get() {
|
880 | return constants_1.cssClasses;
|
881 | },
|
882 | enumerable: false,
|
883 | configurable: true
|
884 | });
|
885 | Object.defineProperty(MDCRippleFoundation, "strings", {
|
886 | get: function get() {
|
887 | return constants_1.strings;
|
888 | },
|
889 | enumerable: false,
|
890 | configurable: true
|
891 | });
|
892 | Object.defineProperty(MDCRippleFoundation, "numbers", {
|
893 | get: function get() {
|
894 | return constants_1.numbers;
|
895 | },
|
896 | enumerable: false,
|
897 | configurable: true
|
898 | });
|
899 | Object.defineProperty(MDCRippleFoundation, "defaultAdapter", {
|
900 | get: function get() {
|
901 | return {
|
902 | addClass: function addClass() {
|
903 | return undefined;
|
904 | },
|
905 | browserSupportsCssVars: function browserSupportsCssVars() {
|
906 | return true;
|
907 | },
|
908 | computeBoundingRect: function computeBoundingRect() {
|
909 | return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
|
910 | },
|
911 | containsEventTarget: function containsEventTarget() {
|
912 | return true;
|
913 | },
|
914 | deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() {
|
915 | return undefined;
|
916 | },
|
917 | deregisterInteractionHandler: function deregisterInteractionHandler() {
|
918 | return undefined;
|
919 | },
|
920 | deregisterResizeHandler: function deregisterResizeHandler() {
|
921 | return undefined;
|
922 | },
|
923 | getWindowPageOffset: function getWindowPageOffset() {
|
924 | return { x: 0, y: 0 };
|
925 | },
|
926 | isSurfaceActive: function isSurfaceActive() {
|
927 | return true;
|
928 | },
|
929 | isSurfaceDisabled: function isSurfaceDisabled() {
|
930 | return true;
|
931 | },
|
932 | isUnbounded: function isUnbounded() {
|
933 | return true;
|
934 | },
|
935 | registerDocumentInteractionHandler: function registerDocumentInteractionHandler() {
|
936 | return undefined;
|
937 | },
|
938 | registerInteractionHandler: function registerInteractionHandler() {
|
939 | return undefined;
|
940 | },
|
941 | registerResizeHandler: function registerResizeHandler() {
|
942 | return undefined;
|
943 | },
|
944 | removeClass: function removeClass() {
|
945 | return undefined;
|
946 | },
|
947 | updateCssVariable: function updateCssVariable() {
|
948 | return undefined;
|
949 | }
|
950 | };
|
951 | },
|
952 | enumerable: false,
|
953 | configurable: true
|
954 | });
|
955 | MDCRippleFoundation.prototype.init = function () {
|
956 | var _this = this;
|
957 | var supportsPressRipple = this.supportsPressRipple();
|
958 | this.registerRootHandlers(supportsPressRipple);
|
959 | if (supportsPressRipple) {
|
960 | var _a = MDCRippleFoundation.cssClasses,
|
961 | ROOT_1 = _a.ROOT,
|
962 | UNBOUNDED_1 = _a.UNBOUNDED;
|
963 | requestAnimationFrame(function () {
|
964 | _this.adapter.addClass(ROOT_1);
|
965 | if (_this.adapter.isUnbounded()) {
|
966 | _this.adapter.addClass(UNBOUNDED_1);
|
967 |
|
968 | _this.layoutInternal();
|
969 | }
|
970 | });
|
971 | }
|
972 | };
|
973 | MDCRippleFoundation.prototype.destroy = function () {
|
974 | var _this = this;
|
975 | if (this.supportsPressRipple()) {
|
976 | if (this.activationTimer) {
|
977 | clearTimeout(this.activationTimer);
|
978 | this.activationTimer = 0;
|
979 | this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION);
|
980 | }
|
981 | if (this.fgDeactivationRemovalTimer) {
|
982 | clearTimeout(this.fgDeactivationRemovalTimer);
|
983 | this.fgDeactivationRemovalTimer = 0;
|
984 | this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION);
|
985 | }
|
986 | var _a = MDCRippleFoundation.cssClasses,
|
987 | ROOT_2 = _a.ROOT,
|
988 | UNBOUNDED_2 = _a.UNBOUNDED;
|
989 | requestAnimationFrame(function () {
|
990 | _this.adapter.removeClass(ROOT_2);
|
991 | _this.adapter.removeClass(UNBOUNDED_2);
|
992 | _this.removeCssVars();
|
993 | });
|
994 | }
|
995 | this.deregisterRootHandlers();
|
996 | this.deregisterDeactivationHandlers();
|
997 | };
|
998 | |
999 |
|
1000 |
|
1001 | MDCRippleFoundation.prototype.activate = function (evt) {
|
1002 | this.activateImpl(evt);
|
1003 | };
|
1004 | MDCRippleFoundation.prototype.deactivate = function () {
|
1005 | this.deactivateImpl();
|
1006 | };
|
1007 | MDCRippleFoundation.prototype.layout = function () {
|
1008 | var _this = this;
|
1009 | if (this.layoutFrame) {
|
1010 | cancelAnimationFrame(this.layoutFrame);
|
1011 | }
|
1012 | this.layoutFrame = requestAnimationFrame(function () {
|
1013 | _this.layoutInternal();
|
1014 | _this.layoutFrame = 0;
|
1015 | });
|
1016 | };
|
1017 | MDCRippleFoundation.prototype.setUnbounded = function (unbounded) {
|
1018 | var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED;
|
1019 | if (unbounded) {
|
1020 | this.adapter.addClass(UNBOUNDED);
|
1021 | } else {
|
1022 | this.adapter.removeClass(UNBOUNDED);
|
1023 | }
|
1024 | };
|
1025 | MDCRippleFoundation.prototype.handleFocus = function () {
|
1026 | var _this = this;
|
1027 | requestAnimationFrame(function () {
|
1028 | return _this.adapter.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
|
1029 | });
|
1030 | };
|
1031 | MDCRippleFoundation.prototype.handleBlur = function () {
|
1032 | var _this = this;
|
1033 | requestAnimationFrame(function () {
|
1034 | return _this.adapter.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
|
1035 | });
|
1036 | };
|
1037 | |
1038 |
|
1039 |
|
1040 |
|
1041 |
|
1042 |
|
1043 | MDCRippleFoundation.prototype.supportsPressRipple = function () {
|
1044 | return this.adapter.browserSupportsCssVars();
|
1045 | };
|
1046 | MDCRippleFoundation.prototype.defaultActivationState = function () {
|
1047 | return {
|
1048 | activationEvent: undefined,
|
1049 | hasDeactivationUXRun: false,
|
1050 | isActivated: false,
|
1051 | isProgrammatic: false,
|
1052 | wasActivatedByPointer: false,
|
1053 | wasElementMadeActive: false
|
1054 | };
|
1055 | };
|
1056 | |
1057 |
|
1058 |
|
1059 | MDCRippleFoundation.prototype.registerRootHandlers = function (supportsPressRipple) {
|
1060 | var e_1, _a;
|
1061 | if (supportsPressRipple) {
|
1062 | try {
|
1063 | 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()) {
|
1064 | var evtType = ACTIVATION_EVENT_TYPES_1_1.value;
|
1065 | this.adapter.registerInteractionHandler(evtType, this.activateHandler);
|
1066 | }
|
1067 | } catch (e_1_1) {
|
1068 | e_1 = { error: e_1_1 };
|
1069 | } finally {
|
1070 | try {
|
1071 | if (ACTIVATION_EVENT_TYPES_1_1 && !ACTIVATION_EVENT_TYPES_1_1.done && (_a = ACTIVATION_EVENT_TYPES_1.return)) _a.call(ACTIVATION_EVENT_TYPES_1);
|
1072 | } finally {
|
1073 | if (e_1) throw e_1.error;
|
1074 | }
|
1075 | }
|
1076 | if (this.adapter.isUnbounded()) {
|
1077 | this.adapter.registerResizeHandler(this.resizeHandler);
|
1078 | }
|
1079 | }
|
1080 | this.adapter.registerInteractionHandler('focus', this.focusHandler);
|
1081 | this.adapter.registerInteractionHandler('blur', this.blurHandler);
|
1082 | };
|
1083 | MDCRippleFoundation.prototype.registerDeactivationHandlers = function (evt) {
|
1084 | var e_2, _a;
|
1085 | if (evt.type === 'keydown') {
|
1086 | this.adapter.registerInteractionHandler('keyup', this.deactivateHandler);
|
1087 | } else {
|
1088 | try {
|
1089 | 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()) {
|
1090 | var evtType = POINTER_DEACTIVATION_EVENT_TYPES_1_1.value;
|
1091 | this.adapter.registerDocumentInteractionHandler(evtType, this.deactivateHandler);
|
1092 | }
|
1093 | } catch (e_2_1) {
|
1094 | e_2 = { error: e_2_1 };
|
1095 | } finally {
|
1096 | try {
|
1097 | 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);
|
1098 | } finally {
|
1099 | if (e_2) throw e_2.error;
|
1100 | }
|
1101 | }
|
1102 | }
|
1103 | };
|
1104 | MDCRippleFoundation.prototype.deregisterRootHandlers = function () {
|
1105 | var e_3, _a;
|
1106 | try {
|
1107 | 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()) {
|
1108 | var evtType = ACTIVATION_EVENT_TYPES_2_1.value;
|
1109 | this.adapter.deregisterInteractionHandler(evtType, this.activateHandler);
|
1110 | }
|
1111 | } catch (e_3_1) {
|
1112 | e_3 = { error: e_3_1 };
|
1113 | } finally {
|
1114 | try {
|
1115 | if (ACTIVATION_EVENT_TYPES_2_1 && !ACTIVATION_EVENT_TYPES_2_1.done && (_a = ACTIVATION_EVENT_TYPES_2.return)) _a.call(ACTIVATION_EVENT_TYPES_2);
|
1116 | } finally {
|
1117 | if (e_3) throw e_3.error;
|
1118 | }
|
1119 | }
|
1120 | this.adapter.deregisterInteractionHandler('focus', this.focusHandler);
|
1121 | this.adapter.deregisterInteractionHandler('blur', this.blurHandler);
|
1122 | if (this.adapter.isUnbounded()) {
|
1123 | this.adapter.deregisterResizeHandler(this.resizeHandler);
|
1124 | }
|
1125 | };
|
1126 | MDCRippleFoundation.prototype.deregisterDeactivationHandlers = function () {
|
1127 | var e_4, _a;
|
1128 | this.adapter.deregisterInteractionHandler('keyup', this.deactivateHandler);
|
1129 | try {
|
1130 | 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()) {
|
1131 | var evtType = POINTER_DEACTIVATION_EVENT_TYPES_2_1.value;
|
1132 | this.adapter.deregisterDocumentInteractionHandler(evtType, this.deactivateHandler);
|
1133 | }
|
1134 | } catch (e_4_1) {
|
1135 | e_4 = { error: e_4_1 };
|
1136 | } finally {
|
1137 | try {
|
1138 | 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);
|
1139 | } finally {
|
1140 | if (e_4) throw e_4.error;
|
1141 | }
|
1142 | }
|
1143 | };
|
1144 | MDCRippleFoundation.prototype.removeCssVars = function () {
|
1145 | var _this = this;
|
1146 | var rippleStrings = MDCRippleFoundation.strings;
|
1147 | var keys = Object.keys(rippleStrings);
|
1148 | keys.forEach(function (key) {
|
1149 | if (key.indexOf('VAR_') === 0) {
|
1150 | _this.adapter.updateCssVariable(rippleStrings[key], null);
|
1151 | }
|
1152 | });
|
1153 | };
|
1154 | MDCRippleFoundation.prototype.activateImpl = function (evt) {
|
1155 | var _this = this;
|
1156 | if (this.adapter.isSurfaceDisabled()) {
|
1157 | return;
|
1158 | }
|
1159 | var activationState = this.activationState;
|
1160 | if (activationState.isActivated) {
|
1161 | return;
|
1162 | }
|
1163 |
|
1164 | var previousActivationEvent = this.previousActivationEvent;
|
1165 | var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type;
|
1166 | if (isSameInteraction) {
|
1167 | return;
|
1168 | }
|
1169 | activationState.isActivated = true;
|
1170 | activationState.isProgrammatic = evt === undefined;
|
1171 | activationState.activationEvent = evt;
|
1172 | activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown');
|
1173 | var hasActivatedChild = evt !== undefined && activatedTargets.length > 0 && activatedTargets.some(function (target) {
|
1174 | return _this.adapter.containsEventTarget(target);
|
1175 | });
|
1176 | if (hasActivatedChild) {
|
1177 |
|
1178 | this.resetActivationState();
|
1179 | return;
|
1180 | }
|
1181 | if (evt !== undefined) {
|
1182 | activatedTargets.push(evt.target);
|
1183 | this.registerDeactivationHandlers(evt);
|
1184 | }
|
1185 | activationState.wasElementMadeActive = this.checkElementMadeActive(evt);
|
1186 | if (activationState.wasElementMadeActive) {
|
1187 | this.animateActivation();
|
1188 | }
|
1189 | requestAnimationFrame(function () {
|
1190 |
|
1191 | activatedTargets = [];
|
1192 | if (!activationState.wasElementMadeActive && evt !== undefined && (evt.key === ' ' || evt.keyCode === 32)) {
|
1193 |
|
1194 |
|
1195 |
|
1196 |
|
1197 |
|
1198 |
|
1199 | activationState.wasElementMadeActive = _this.checkElementMadeActive(evt);
|
1200 | if (activationState.wasElementMadeActive) {
|
1201 | _this.animateActivation();
|
1202 | }
|
1203 | }
|
1204 | if (!activationState.wasElementMadeActive) {
|
1205 |
|
1206 | _this.activationState = _this.defaultActivationState();
|
1207 | }
|
1208 | });
|
1209 | };
|
1210 | MDCRippleFoundation.prototype.checkElementMadeActive = function (evt) {
|
1211 | return evt !== undefined && evt.type === 'keydown' ? this.adapter.isSurfaceActive() : true;
|
1212 | };
|
1213 | MDCRippleFoundation.prototype.animateActivation = function () {
|
1214 | var _this = this;
|
1215 | var _a = MDCRippleFoundation.strings,
|
1216 | VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START,
|
1217 | VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END;
|
1218 | var _b = MDCRippleFoundation.cssClasses,
|
1219 | FG_DEACTIVATION = _b.FG_DEACTIVATION,
|
1220 | FG_ACTIVATION = _b.FG_ACTIVATION;
|
1221 | var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS;
|
1222 | this.layoutInternal();
|
1223 | var translateStart = '';
|
1224 | var translateEnd = '';
|
1225 | if (!this.adapter.isUnbounded()) {
|
1226 | var _c = this.getFgTranslationCoordinates(),
|
1227 | startPoint = _c.startPoint,
|
1228 | endPoint = _c.endPoint;
|
1229 | translateStart = startPoint.x + "px, " + startPoint.y + "px";
|
1230 | translateEnd = endPoint.x + "px, " + endPoint.y + "px";
|
1231 | }
|
1232 | this.adapter.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart);
|
1233 | this.adapter.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd);
|
1234 |
|
1235 | clearTimeout(this.activationTimer);
|
1236 | clearTimeout(this.fgDeactivationRemovalTimer);
|
1237 | this.rmBoundedActivationClasses();
|
1238 | this.adapter.removeClass(FG_DEACTIVATION);
|
1239 |
|
1240 | this.adapter.computeBoundingRect();
|
1241 | this.adapter.addClass(FG_ACTIVATION);
|
1242 | this.activationTimer = setTimeout(function () {
|
1243 | _this.activationTimerCallback();
|
1244 | }, DEACTIVATION_TIMEOUT_MS);
|
1245 | };
|
1246 | MDCRippleFoundation.prototype.getFgTranslationCoordinates = function () {
|
1247 | var _a = this.activationState,
|
1248 | activationEvent = _a.activationEvent,
|
1249 | wasActivatedByPointer = _a.wasActivatedByPointer;
|
1250 | var startPoint;
|
1251 | if (wasActivatedByPointer) {
|
1252 | startPoint = util_1.getNormalizedEventCoords(activationEvent, this.adapter.getWindowPageOffset(), this.adapter.computeBoundingRect());
|
1253 | } else {
|
1254 | startPoint = {
|
1255 | x: this.frame.width / 2,
|
1256 | y: this.frame.height / 2
|
1257 | };
|
1258 | }
|
1259 |
|
1260 | startPoint = {
|
1261 | x: startPoint.x - this.initialSize / 2,
|
1262 | y: startPoint.y - this.initialSize / 2
|
1263 | };
|
1264 | var endPoint = {
|
1265 | x: this.frame.width / 2 - this.initialSize / 2,
|
1266 | y: this.frame.height / 2 - this.initialSize / 2
|
1267 | };
|
1268 | return { startPoint: startPoint, endPoint: endPoint };
|
1269 | };
|
1270 | MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady = function () {
|
1271 | var _this = this;
|
1272 |
|
1273 |
|
1274 | var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION;
|
1275 | var _a = this.activationState,
|
1276 | hasDeactivationUXRun = _a.hasDeactivationUXRun,
|
1277 | isActivated = _a.isActivated;
|
1278 | var activationHasEnded = hasDeactivationUXRun || !isActivated;
|
1279 | if (activationHasEnded && this.activationAnimationHasEnded) {
|
1280 | this.rmBoundedActivationClasses();
|
1281 | this.adapter.addClass(FG_DEACTIVATION);
|
1282 | this.fgDeactivationRemovalTimer = setTimeout(function () {
|
1283 | _this.adapter.removeClass(FG_DEACTIVATION);
|
1284 | }, constants_1.numbers.FG_DEACTIVATION_MS);
|
1285 | }
|
1286 | };
|
1287 | MDCRippleFoundation.prototype.rmBoundedActivationClasses = function () {
|
1288 | var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION;
|
1289 | this.adapter.removeClass(FG_ACTIVATION);
|
1290 | this.activationAnimationHasEnded = false;
|
1291 | this.adapter.computeBoundingRect();
|
1292 | };
|
1293 | MDCRippleFoundation.prototype.resetActivationState = function () {
|
1294 | var _this = this;
|
1295 | this.previousActivationEvent = this.activationState.activationEvent;
|
1296 | this.activationState = this.defaultActivationState();
|
1297 |
|
1298 |
|
1299 | setTimeout(function () {
|
1300 | return _this.previousActivationEvent = undefined;
|
1301 | }, MDCRippleFoundation.numbers.TAP_DELAY_MS);
|
1302 | };
|
1303 | MDCRippleFoundation.prototype.deactivateImpl = function () {
|
1304 | var _this = this;
|
1305 | var activationState = this.activationState;
|
1306 |
|
1307 | if (!activationState.isActivated) {
|
1308 | return;
|
1309 | }
|
1310 | var state = __assign({}, activationState);
|
1311 | if (activationState.isProgrammatic) {
|
1312 | requestAnimationFrame(function () {
|
1313 | _this.animateDeactivation(state);
|
1314 | });
|
1315 | this.resetActivationState();
|
1316 | } else {
|
1317 | this.deregisterDeactivationHandlers();
|
1318 | requestAnimationFrame(function () {
|
1319 | _this.activationState.hasDeactivationUXRun = true;
|
1320 | _this.animateDeactivation(state);
|
1321 | _this.resetActivationState();
|
1322 | });
|
1323 | }
|
1324 | };
|
1325 | MDCRippleFoundation.prototype.animateDeactivation = function (_a) {
|
1326 | var wasActivatedByPointer = _a.wasActivatedByPointer,
|
1327 | wasElementMadeActive = _a.wasElementMadeActive;
|
1328 | if (wasActivatedByPointer || wasElementMadeActive) {
|
1329 | this.runDeactivationUXLogicIfReady();
|
1330 | }
|
1331 | };
|
1332 | MDCRippleFoundation.prototype.layoutInternal = function () {
|
1333 | var _this = this;
|
1334 | this.frame = this.adapter.computeBoundingRect();
|
1335 | var maxDim = Math.max(this.frame.height, this.frame.width);
|
1336 |
|
1337 |
|
1338 |
|
1339 |
|
1340 |
|
1341 |
|
1342 | var getBoundedRadius = function getBoundedRadius() {
|
1343 | var hypotenuse = Math.sqrt(Math.pow(_this.frame.width, 2) + Math.pow(_this.frame.height, 2));
|
1344 | return hypotenuse + MDCRippleFoundation.numbers.PADDING;
|
1345 | };
|
1346 | this.maxRadius = this.adapter.isUnbounded() ? maxDim : getBoundedRadius();
|
1347 |
|
1348 | var initialSize = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE);
|
1349 |
|
1350 | if (this.adapter.isUnbounded() && initialSize % 2 !== 0) {
|
1351 | this.initialSize = initialSize - 1;
|
1352 | } else {
|
1353 | this.initialSize = initialSize;
|
1354 | }
|
1355 | this.fgScale = "" + this.maxRadius / this.initialSize;
|
1356 | this.updateLayoutCssVars();
|
1357 | };
|
1358 | MDCRippleFoundation.prototype.updateLayoutCssVars = function () {
|
1359 | var _a = MDCRippleFoundation.strings,
|
1360 | VAR_FG_SIZE = _a.VAR_FG_SIZE,
|
1361 | VAR_LEFT = _a.VAR_LEFT,
|
1362 | VAR_TOP = _a.VAR_TOP,
|
1363 | VAR_FG_SCALE = _a.VAR_FG_SCALE;
|
1364 | this.adapter.updateCssVariable(VAR_FG_SIZE, this.initialSize + "px");
|
1365 | this.adapter.updateCssVariable(VAR_FG_SCALE, this.fgScale);
|
1366 | if (this.adapter.isUnbounded()) {
|
1367 | this.unboundedCoords = {
|
1368 | left: Math.round(this.frame.width / 2 - this.initialSize / 2),
|
1369 | top: Math.round(this.frame.height / 2 - this.initialSize / 2)
|
1370 | };
|
1371 | this.adapter.updateCssVariable(VAR_LEFT, this.unboundedCoords.left + "px");
|
1372 | this.adapter.updateCssVariable(VAR_TOP, this.unboundedCoords.top + "px");
|
1373 | }
|
1374 | };
|
1375 | return MDCRippleFoundation;
|
1376 | }(foundation_1.MDCFoundation);
|
1377 | exports.MDCRippleFoundation = MDCRippleFoundation;
|
1378 |
|
1379 | exports.default = MDCRippleFoundation;
|
1380 |
|
1381 | }),
|
1382 |
|
1383 | "./packages/mdc-ripple/util.ts":
|
1384 |
|
1385 |
|
1386 |
|
1387 |
|
1388 | (function(module, exports, __webpack_require__) {
|
1389 |
|
1390 | "use strict";
|
1391 |
|
1392 |
|
1393 | Object.defineProperty(exports, "__esModule", { value: true });
|
1394 | exports.getNormalizedEventCoords = exports.supportsCssVariables = void 0;
|
1395 |
|
1396 |
|
1397 |
|
1398 |
|
1399 | var supportsCssVariables_;
|
1400 | function supportsCssVariables(windowObj, forceRefresh) {
|
1401 | if (forceRefresh === void 0) {
|
1402 | forceRefresh = false;
|
1403 | }
|
1404 | var CSS = windowObj.CSS;
|
1405 | var supportsCssVars = supportsCssVariables_;
|
1406 | if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) {
|
1407 | return supportsCssVariables_;
|
1408 | }
|
1409 | var supportsFunctionPresent = CSS && typeof CSS.supports === 'function';
|
1410 | if (!supportsFunctionPresent) {
|
1411 | return false;
|
1412 | }
|
1413 | var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes');
|
1414 |
|
1415 |
|
1416 | var weAreFeatureDetectingSafari10plus = CSS.supports('(--css-vars: yes)') && CSS.supports('color', '#00000000');
|
1417 | supportsCssVars = explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus;
|
1418 | if (!forceRefresh) {
|
1419 | supportsCssVariables_ = supportsCssVars;
|
1420 | }
|
1421 | return supportsCssVars;
|
1422 | }
|
1423 | exports.supportsCssVariables = supportsCssVariables;
|
1424 | function getNormalizedEventCoords(evt, pageOffset, clientRect) {
|
1425 | if (!evt) {
|
1426 | return { x: 0, y: 0 };
|
1427 | }
|
1428 | var x = pageOffset.x,
|
1429 | y = pageOffset.y;
|
1430 | var documentX = x + clientRect.left;
|
1431 | var documentY = y + clientRect.top;
|
1432 | var normalizedX;
|
1433 | var normalizedY;
|
1434 |
|
1435 | if (evt.type === 'touchstart') {
|
1436 | var touchEvent = evt;
|
1437 | normalizedX = touchEvent.changedTouches[0].pageX - documentX;
|
1438 | normalizedY = touchEvent.changedTouches[0].pageY - documentY;
|
1439 | } else {
|
1440 | var mouseEvent = evt;
|
1441 | normalizedX = mouseEvent.pageX - documentX;
|
1442 | normalizedY = mouseEvent.pageY - documentY;
|
1443 | }
|
1444 | return { x: normalizedX, y: normalizedY };
|
1445 | }
|
1446 | exports.getNormalizedEventCoords = getNormalizedEventCoords;
|
1447 |
|
1448 | }),
|
1449 |
|
1450 | "./packages/mdc-top-app-bar/adapter.ts":
|
1451 |
|
1452 |
|
1453 |
|
1454 |
|
1455 | (function(module, exports, __webpack_require__) {
|
1456 |
|
1457 | "use strict";
|
1458 |
|
1459 |
|
1460 |
|
1461 |
|
1462 |
|
1463 |
|
1464 |
|
1465 |
|
1466 |
|
1467 |
|
1468 |
|
1469 |
|
1470 |
|
1471 |
|
1472 |
|
1473 |
|
1474 |
|
1475 |
|
1476 |
|
1477 |
|
1478 |
|
1479 |
|
1480 |
|
1481 |
|
1482 | Object.defineProperty(exports, "__esModule", { value: true });
|
1483 |
|
1484 | }),
|
1485 |
|
1486 | "./packages/mdc-top-app-bar/component.ts":
|
1487 |
|
1488 |
|
1489 |
|
1490 |
|
1491 | (function(module, exports, __webpack_require__) {
|
1492 |
|
1493 | "use strict";
|
1494 |
|
1495 |
|
1496 |
|
1497 |
|
1498 |
|
1499 |
|
1500 |
|
1501 |
|
1502 |
|
1503 |
|
1504 |
|
1505 |
|
1506 |
|
1507 |
|
1508 |
|
1509 |
|
1510 |
|
1511 |
|
1512 |
|
1513 |
|
1514 |
|
1515 |
|
1516 |
|
1517 |
|
1518 | var __extends = this && this.__extends || function () {
|
1519 | var _extendStatics = function extendStatics(d, b) {
|
1520 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
1521 | d.__proto__ = b;
|
1522 | } || function (d, b) {
|
1523 | for (var p in b) {
|
1524 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
1525 | }
|
1526 | };
|
1527 | return _extendStatics(d, b);
|
1528 | };
|
1529 | return function (d, b) {
|
1530 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
1531 | _extendStatics(d, b);
|
1532 | function __() {
|
1533 | this.constructor = d;
|
1534 | }
|
1535 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
1536 | };
|
1537 | }();
|
1538 | var __values = this && this.__values || function (o) {
|
1539 | var s = typeof Symbol === "function" && Symbol.iterator,
|
1540 | m = s && o[s],
|
1541 | i = 0;
|
1542 | if (m) return m.call(o);
|
1543 | if (o && typeof o.length === "number") return {
|
1544 | next: function next() {
|
1545 | if (o && i >= o.length) o = void 0;
|
1546 | return { value: o && o[i++], done: !o };
|
1547 | }
|
1548 | };
|
1549 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
1550 | };
|
1551 | Object.defineProperty(exports, "__esModule", { value: true });
|
1552 | exports.MDCTopAppBar = void 0;
|
1553 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
1554 | var component_2 = __webpack_require__( "./packages/mdc-ripple/component.ts");
|
1555 | var constants_1 = __webpack_require__( "./packages/mdc-top-app-bar/constants.ts");
|
1556 | var foundation_1 = __webpack_require__( "./packages/mdc-top-app-bar/fixed/foundation.ts");
|
1557 | var foundation_2 = __webpack_require__( "./packages/mdc-top-app-bar/short/foundation.ts");
|
1558 | var foundation_3 = __webpack_require__( "./packages/mdc-top-app-bar/standard/foundation.ts");
|
1559 | var MDCTopAppBar = function (_super) {
|
1560 | __extends(MDCTopAppBar, _super);
|
1561 | function MDCTopAppBar() {
|
1562 | return _super !== null && _super.apply(this, arguments) || this;
|
1563 | }
|
1564 | MDCTopAppBar.attachTo = function (root) {
|
1565 | return new MDCTopAppBar(root);
|
1566 | };
|
1567 | MDCTopAppBar.prototype.initialize = function (rippleFactory) {
|
1568 | if (rippleFactory === void 0) {
|
1569 | rippleFactory = function rippleFactory(el) {
|
1570 | return component_2.MDCRipple.attachTo(el);
|
1571 | };
|
1572 | }
|
1573 | this.navIcon = this.root.querySelector(constants_1.strings.NAVIGATION_ICON_SELECTOR);
|
1574 |
|
1575 | var icons = [].slice.call(this.root.querySelectorAll(constants_1.strings.ACTION_ITEM_SELECTOR));
|
1576 | if (this.navIcon) {
|
1577 | icons.push(this.navIcon);
|
1578 | }
|
1579 | this.iconRipples = icons.map(function (icon) {
|
1580 | var ripple = rippleFactory(icon);
|
1581 | ripple.unbounded = true;
|
1582 | return ripple;
|
1583 | });
|
1584 | this.scrollTarget = window;
|
1585 | };
|
1586 | MDCTopAppBar.prototype.initialSyncWithDOM = function () {
|
1587 | this.handleNavigationClick = this.foundation.handleNavigationClick.bind(this.foundation);
|
1588 | this.handleWindowResize = this.foundation.handleWindowResize.bind(this.foundation);
|
1589 | this.handleTargetScroll = this.foundation.handleTargetScroll.bind(this.foundation);
|
1590 | this.scrollTarget.addEventListener('scroll', this.handleTargetScroll);
|
1591 | if (this.navIcon) {
|
1592 | this.navIcon.addEventListener('click', this.handleNavigationClick);
|
1593 | }
|
1594 | var isFixed = this.root.classList.contains(constants_1.cssClasses.FIXED_CLASS);
|
1595 | var isShort = this.root.classList.contains(constants_1.cssClasses.SHORT_CLASS);
|
1596 | if (!isShort && !isFixed) {
|
1597 | window.addEventListener('resize', this.handleWindowResize);
|
1598 | }
|
1599 | };
|
1600 | MDCTopAppBar.prototype.destroy = function () {
|
1601 | var e_1, _a;
|
1602 | try {
|
1603 | for (var _b = __values(this.iconRipples), _c = _b.next(); !_c.done; _c = _b.next()) {
|
1604 | var iconRipple = _c.value;
|
1605 | iconRipple.destroy();
|
1606 | }
|
1607 | } catch (e_1_1) {
|
1608 | e_1 = { error: e_1_1 };
|
1609 | } finally {
|
1610 | try {
|
1611 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
1612 | } finally {
|
1613 | if (e_1) throw e_1.error;
|
1614 | }
|
1615 | }
|
1616 | this.scrollTarget.removeEventListener('scroll', this.handleTargetScroll);
|
1617 | if (this.navIcon) {
|
1618 | this.navIcon.removeEventListener('click', this.handleNavigationClick);
|
1619 | }
|
1620 | var isFixed = this.root.classList.contains(constants_1.cssClasses.FIXED_CLASS);
|
1621 | var isShort = this.root.classList.contains(constants_1.cssClasses.SHORT_CLASS);
|
1622 | if (!isShort && !isFixed) {
|
1623 | window.removeEventListener('resize', this.handleWindowResize);
|
1624 | }
|
1625 | _super.prototype.destroy.call(this);
|
1626 | };
|
1627 | MDCTopAppBar.prototype.setScrollTarget = function (target) {
|
1628 |
|
1629 | this.scrollTarget.removeEventListener('scroll', this.handleTargetScroll);
|
1630 | this.scrollTarget = target;
|
1631 |
|
1632 | this.handleTargetScroll = this.foundation.handleTargetScroll.bind(this.foundation);
|
1633 | this.scrollTarget.addEventListener('scroll', this.handleTargetScroll);
|
1634 | };
|
1635 | MDCTopAppBar.prototype.getDefaultFoundation = function () {
|
1636 | var _this = this;
|
1637 |
|
1638 |
|
1639 |
|
1640 | var adapter = {
|
1641 | hasClass: function hasClass(className) {
|
1642 | return _this.root.classList.contains(className);
|
1643 | },
|
1644 | addClass: function addClass(className) {
|
1645 | return _this.root.classList.add(className);
|
1646 | },
|
1647 | removeClass: function removeClass(className) {
|
1648 | return _this.root.classList.remove(className);
|
1649 | },
|
1650 | setStyle: function setStyle(property, value) {
|
1651 | return _this.root.style.setProperty(property, value);
|
1652 | },
|
1653 | getTopAppBarHeight: function getTopAppBarHeight() {
|
1654 | return _this.root.clientHeight;
|
1655 | },
|
1656 | notifyNavigationIconClicked: function notifyNavigationIconClicked() {
|
1657 | return _this.emit(constants_1.strings.NAVIGATION_EVENT, {});
|
1658 | },
|
1659 | getViewportScrollY: function getViewportScrollY() {
|
1660 | var win = _this.scrollTarget;
|
1661 | var el = _this.scrollTarget;
|
1662 | return win.pageYOffset !== undefined ? win.pageYOffset : el.scrollTop;
|
1663 | },
|
1664 | getTotalActionItems: function getTotalActionItems() {
|
1665 | return _this.root.querySelectorAll(constants_1.strings.ACTION_ITEM_SELECTOR).length;
|
1666 | }
|
1667 | };
|
1668 |
|
1669 | var foundation;
|
1670 | if (this.root.classList.contains(constants_1.cssClasses.SHORT_CLASS)) {
|
1671 | foundation = new foundation_2.MDCShortTopAppBarFoundation(adapter);
|
1672 | } else if (this.root.classList.contains(constants_1.cssClasses.FIXED_CLASS)) {
|
1673 | foundation = new foundation_1.MDCFixedTopAppBarFoundation(adapter);
|
1674 | } else {
|
1675 | foundation = new foundation_3.MDCTopAppBarFoundation(adapter);
|
1676 | }
|
1677 | return foundation;
|
1678 | };
|
1679 | return MDCTopAppBar;
|
1680 | }(component_1.MDCComponent);
|
1681 | exports.MDCTopAppBar = MDCTopAppBar;
|
1682 |
|
1683 | }),
|
1684 |
|
1685 | "./packages/mdc-top-app-bar/constants.ts":
|
1686 |
|
1687 |
|
1688 |
|
1689 |
|
1690 | (function(module, exports, __webpack_require__) {
|
1691 |
|
1692 | "use strict";
|
1693 |
|
1694 |
|
1695 |
|
1696 |
|
1697 |
|
1698 |
|
1699 |
|
1700 |
|
1701 |
|
1702 |
|
1703 |
|
1704 |
|
1705 |
|
1706 |
|
1707 |
|
1708 |
|
1709 |
|
1710 |
|
1711 |
|
1712 |
|
1713 |
|
1714 |
|
1715 |
|
1716 |
|
1717 | Object.defineProperty(exports, "__esModule", { value: true });
|
1718 | exports.strings = exports.numbers = exports.cssClasses = void 0;
|
1719 | var cssClasses = {
|
1720 | FIXED_CLASS: 'mdc-top-app-bar--fixed',
|
1721 | FIXED_SCROLLED_CLASS: 'mdc-top-app-bar--fixed-scrolled',
|
1722 | SHORT_CLASS: 'mdc-top-app-bar--short',
|
1723 | SHORT_COLLAPSED_CLASS: 'mdc-top-app-bar--short-collapsed',
|
1724 | SHORT_HAS_ACTION_ITEM_CLASS: 'mdc-top-app-bar--short-has-action-item'
|
1725 | };
|
1726 | exports.cssClasses = cssClasses;
|
1727 | var numbers = {
|
1728 | DEBOUNCE_THROTTLE_RESIZE_TIME_MS: 100,
|
1729 | MAX_TOP_APP_BAR_HEIGHT: 128
|
1730 | };
|
1731 | exports.numbers = numbers;
|
1732 | var strings = {
|
1733 | ACTION_ITEM_SELECTOR: '.mdc-top-app-bar__action-item',
|
1734 | NAVIGATION_EVENT: 'MDCTopAppBar:nav',
|
1735 | NAVIGATION_ICON_SELECTOR: '.mdc-top-app-bar__navigation-icon',
|
1736 | ROOT_SELECTOR: '.mdc-top-app-bar',
|
1737 | TITLE_SELECTOR: '.mdc-top-app-bar__title'
|
1738 | };
|
1739 | exports.strings = strings;
|
1740 |
|
1741 | }),
|
1742 |
|
1743 | "./packages/mdc-top-app-bar/fixed/foundation.ts":
|
1744 |
|
1745 |
|
1746 |
|
1747 |
|
1748 | (function(module, exports, __webpack_require__) {
|
1749 |
|
1750 | "use strict";
|
1751 |
|
1752 |
|
1753 |
|
1754 |
|
1755 |
|
1756 |
|
1757 |
|
1758 |
|
1759 |
|
1760 |
|
1761 |
|
1762 |
|
1763 |
|
1764 |
|
1765 |
|
1766 |
|
1767 |
|
1768 |
|
1769 |
|
1770 |
|
1771 |
|
1772 |
|
1773 |
|
1774 |
|
1775 | var __extends = this && this.__extends || function () {
|
1776 | var _extendStatics = function extendStatics(d, b) {
|
1777 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
1778 | d.__proto__ = b;
|
1779 | } || function (d, b) {
|
1780 | for (var p in b) {
|
1781 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
1782 | }
|
1783 | };
|
1784 | return _extendStatics(d, b);
|
1785 | };
|
1786 | return function (d, b) {
|
1787 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
1788 | _extendStatics(d, b);
|
1789 | function __() {
|
1790 | this.constructor = d;
|
1791 | }
|
1792 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
1793 | };
|
1794 | }();
|
1795 | Object.defineProperty(exports, "__esModule", { value: true });
|
1796 | exports.MDCFixedTopAppBarFoundation = void 0;
|
1797 | var constants_1 = __webpack_require__( "./packages/mdc-top-app-bar/constants.ts");
|
1798 | var foundation_1 = __webpack_require__( "./packages/mdc-top-app-bar/standard/foundation.ts");
|
1799 | var MDCFixedTopAppBarFoundation = function (_super) {
|
1800 | __extends(MDCFixedTopAppBarFoundation, _super);
|
1801 | function MDCFixedTopAppBarFoundation() {
|
1802 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
1803 | |
1804 |
|
1805 |
|
1806 | _this.wasScrolled = false;
|
1807 | return _this;
|
1808 | }
|
1809 | |
1810 |
|
1811 |
|
1812 | MDCFixedTopAppBarFoundation.prototype.handleTargetScroll = function () {
|
1813 | var currentScroll = this.adapter.getViewportScrollY();
|
1814 | if (currentScroll <= 0) {
|
1815 | if (this.wasScrolled) {
|
1816 | this.adapter.removeClass(constants_1.cssClasses.FIXED_SCROLLED_CLASS);
|
1817 | this.wasScrolled = false;
|
1818 | }
|
1819 | } else {
|
1820 | if (!this.wasScrolled) {
|
1821 | this.adapter.addClass(constants_1.cssClasses.FIXED_SCROLLED_CLASS);
|
1822 | this.wasScrolled = true;
|
1823 | }
|
1824 | }
|
1825 | };
|
1826 | return MDCFixedTopAppBarFoundation;
|
1827 | }(foundation_1.MDCTopAppBarFoundation);
|
1828 | exports.MDCFixedTopAppBarFoundation = MDCFixedTopAppBarFoundation;
|
1829 |
|
1830 | exports.default = MDCFixedTopAppBarFoundation;
|
1831 |
|
1832 | }),
|
1833 |
|
1834 | "./packages/mdc-top-app-bar/foundation.ts":
|
1835 |
|
1836 |
|
1837 |
|
1838 |
|
1839 | (function(module, exports, __webpack_require__) {
|
1840 |
|
1841 | "use strict";
|
1842 |
|
1843 |
|
1844 |
|
1845 |
|
1846 |
|
1847 |
|
1848 |
|
1849 |
|
1850 |
|
1851 |
|
1852 |
|
1853 |
|
1854 |
|
1855 |
|
1856 |
|
1857 |
|
1858 |
|
1859 |
|
1860 |
|
1861 |
|
1862 |
|
1863 |
|
1864 |
|
1865 |
|
1866 | var __extends = this && this.__extends || function () {
|
1867 | var _extendStatics = function extendStatics(d, b) {
|
1868 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
1869 | d.__proto__ = b;
|
1870 | } || function (d, b) {
|
1871 | for (var p in b) {
|
1872 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
1873 | }
|
1874 | };
|
1875 | return _extendStatics(d, b);
|
1876 | };
|
1877 | return function (d, b) {
|
1878 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
1879 | _extendStatics(d, b);
|
1880 | function __() {
|
1881 | this.constructor = d;
|
1882 | }
|
1883 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
1884 | };
|
1885 | }();
|
1886 | var __assign = this && this.__assign || function () {
|
1887 | __assign = Object.assign || function (t) {
|
1888 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
1889 | s = arguments[i];
|
1890 | for (var p in s) {
|
1891 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
1892 | }
|
1893 | }
|
1894 | return t;
|
1895 | };
|
1896 | return __assign.apply(this, arguments);
|
1897 | };
|
1898 | Object.defineProperty(exports, "__esModule", { value: true });
|
1899 | exports.MDCTopAppBarBaseFoundation = void 0;
|
1900 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
1901 | var constants_1 = __webpack_require__( "./packages/mdc-top-app-bar/constants.ts");
|
1902 | var MDCTopAppBarBaseFoundation = function (_super) {
|
1903 | __extends(MDCTopAppBarBaseFoundation, _super);
|
1904 |
|
1905 | function MDCTopAppBarBaseFoundation(adapter) {
|
1906 | return _super.call(this, __assign(__assign({}, MDCTopAppBarBaseFoundation.defaultAdapter), adapter)) || this;
|
1907 | }
|
1908 | Object.defineProperty(MDCTopAppBarBaseFoundation, "strings", {
|
1909 | get: function get() {
|
1910 | return constants_1.strings;
|
1911 | },
|
1912 | enumerable: false,
|
1913 | configurable: true
|
1914 | });
|
1915 | Object.defineProperty(MDCTopAppBarBaseFoundation, "cssClasses", {
|
1916 | get: function get() {
|
1917 | return constants_1.cssClasses;
|
1918 | },
|
1919 | enumerable: false,
|
1920 | configurable: true
|
1921 | });
|
1922 | Object.defineProperty(MDCTopAppBarBaseFoundation, "numbers", {
|
1923 | get: function get() {
|
1924 | return constants_1.numbers;
|
1925 | },
|
1926 | enumerable: false,
|
1927 | configurable: true
|
1928 | });
|
1929 | Object.defineProperty(MDCTopAppBarBaseFoundation, "defaultAdapter", {
|
1930 | |
1931 |
|
1932 |
|
1933 | get: function get() {
|
1934 |
|
1935 | return {
|
1936 | addClass: function addClass() {
|
1937 | return undefined;
|
1938 | },
|
1939 | removeClass: function removeClass() {
|
1940 | return undefined;
|
1941 | },
|
1942 | hasClass: function hasClass() {
|
1943 | return false;
|
1944 | },
|
1945 | setStyle: function setStyle() {
|
1946 | return undefined;
|
1947 | },
|
1948 | getTopAppBarHeight: function getTopAppBarHeight() {
|
1949 | return 0;
|
1950 | },
|
1951 | notifyNavigationIconClicked: function notifyNavigationIconClicked() {
|
1952 | return undefined;
|
1953 | },
|
1954 | getViewportScrollY: function getViewportScrollY() {
|
1955 | return 0;
|
1956 | },
|
1957 | getTotalActionItems: function getTotalActionItems() {
|
1958 | return 0;
|
1959 | }
|
1960 | };
|
1961 |
|
1962 | },
|
1963 | enumerable: false,
|
1964 | configurable: true
|
1965 | });
|
1966 |
|
1967 | MDCTopAppBarBaseFoundation.prototype.handleTargetScroll = function () {};
|
1968 |
|
1969 | MDCTopAppBarBaseFoundation.prototype.handleWindowResize = function () {};
|
1970 | MDCTopAppBarBaseFoundation.prototype.handleNavigationClick = function () {
|
1971 | this.adapter.notifyNavigationIconClicked();
|
1972 | };
|
1973 | return MDCTopAppBarBaseFoundation;
|
1974 | }(foundation_1.MDCFoundation);
|
1975 | exports.MDCTopAppBarBaseFoundation = MDCTopAppBarBaseFoundation;
|
1976 |
|
1977 | exports.default = MDCTopAppBarBaseFoundation;
|
1978 |
|
1979 | }),
|
1980 |
|
1981 | "./packages/mdc-top-app-bar/index.ts":
|
1982 |
|
1983 |
|
1984 |
|
1985 |
|
1986 | (function(module, exports, __webpack_require__) {
|
1987 |
|
1988 | "use strict";
|
1989 |
|
1990 |
|
1991 |
|
1992 |
|
1993 |
|
1994 |
|
1995 |
|
1996 |
|
1997 |
|
1998 |
|
1999 |
|
2000 |
|
2001 |
|
2002 |
|
2003 |
|
2004 |
|
2005 |
|
2006 |
|
2007 |
|
2008 |
|
2009 |
|
2010 |
|
2011 |
|
2012 |
|
2013 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
2014 | if (k2 === undefined) k2 = k;
|
2015 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
2016 | return m[k];
|
2017 | } });
|
2018 | } : function (o, m, k, k2) {
|
2019 | if (k2 === undefined) k2 = k;
|
2020 | o[k2] = m[k];
|
2021 | });
|
2022 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
2023 | for (var p in m) {
|
2024 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
2025 | }
|
2026 | };
|
2027 | Object.defineProperty(exports, "__esModule", { value: true });
|
2028 | __exportStar(__webpack_require__( "./packages/mdc-top-app-bar/adapter.ts"), exports);
|
2029 | __exportStar(__webpack_require__( "./packages/mdc-top-app-bar/component.ts"), exports);
|
2030 | __exportStar(__webpack_require__( "./packages/mdc-top-app-bar/constants.ts"), exports);
|
2031 | __exportStar(__webpack_require__( "./packages/mdc-top-app-bar/foundation.ts"), exports);
|
2032 | __exportStar(__webpack_require__( "./packages/mdc-top-app-bar/fixed/foundation.ts"), exports);
|
2033 | __exportStar(__webpack_require__( "./packages/mdc-top-app-bar/short/foundation.ts"), exports);
|
2034 | __exportStar(__webpack_require__( "./packages/mdc-top-app-bar/standard/foundation.ts"), exports);
|
2035 |
|
2036 | }),
|
2037 |
|
2038 | "./packages/mdc-top-app-bar/short/foundation.ts":
|
2039 |
|
2040 |
|
2041 |
|
2042 |
|
2043 | (function(module, exports, __webpack_require__) {
|
2044 |
|
2045 | "use strict";
|
2046 |
|
2047 |
|
2048 |
|
2049 |
|
2050 |
|
2051 |
|
2052 |
|
2053 |
|
2054 |
|
2055 |
|
2056 |
|
2057 |
|
2058 |
|
2059 |
|
2060 |
|
2061 |
|
2062 |
|
2063 |
|
2064 |
|
2065 |
|
2066 |
|
2067 |
|
2068 |
|
2069 |
|
2070 | var __extends = this && this.__extends || function () {
|
2071 | var _extendStatics = function extendStatics(d, b) {
|
2072 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
2073 | d.__proto__ = b;
|
2074 | } || function (d, b) {
|
2075 | for (var p in b) {
|
2076 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
2077 | }
|
2078 | };
|
2079 | return _extendStatics(d, b);
|
2080 | };
|
2081 | return function (d, b) {
|
2082 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
2083 | _extendStatics(d, b);
|
2084 | function __() {
|
2085 | this.constructor = d;
|
2086 | }
|
2087 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
2088 | };
|
2089 | }();
|
2090 | Object.defineProperty(exports, "__esModule", { value: true });
|
2091 | exports.MDCShortTopAppBarFoundation = void 0;
|
2092 | var constants_1 = __webpack_require__( "./packages/mdc-top-app-bar/constants.ts");
|
2093 | var foundation_1 = __webpack_require__( "./packages/mdc-top-app-bar/foundation.ts");
|
2094 | var MDCShortTopAppBarFoundation = function (_super) {
|
2095 | __extends(MDCShortTopAppBarFoundation, _super);
|
2096 |
|
2097 | function MDCShortTopAppBarFoundation(adapter) {
|
2098 | var _this = _super.call(this, adapter) || this;
|
2099 | _this.collapsed = false;
|
2100 | _this.isAlwaysCollapsed = false;
|
2101 | return _this;
|
2102 | }
|
2103 | Object.defineProperty(MDCShortTopAppBarFoundation.prototype, "isCollapsed", {
|
2104 |
|
2105 | get: function get() {
|
2106 | return this.collapsed;
|
2107 | },
|
2108 | enumerable: false,
|
2109 | configurable: true
|
2110 | });
|
2111 | MDCShortTopAppBarFoundation.prototype.init = function () {
|
2112 | _super.prototype.init.call(this);
|
2113 | if (this.adapter.getTotalActionItems() > 0) {
|
2114 | this.adapter.addClass(constants_1.cssClasses.SHORT_HAS_ACTION_ITEM_CLASS);
|
2115 | }
|
2116 |
|
2117 | this.setAlwaysCollapsed(this.adapter.hasClass(constants_1.cssClasses.SHORT_COLLAPSED_CLASS));
|
2118 | };
|
2119 | |
2120 |
|
2121 |
|
2122 |
|
2123 |
|
2124 | MDCShortTopAppBarFoundation.prototype.setAlwaysCollapsed = function (value) {
|
2125 | this.isAlwaysCollapsed = !!value;
|
2126 | if (this.isAlwaysCollapsed) {
|
2127 | this.collapse();
|
2128 | } else {
|
2129 |
|
2130 | this.maybeCollapseBar();
|
2131 | }
|
2132 | };
|
2133 | MDCShortTopAppBarFoundation.prototype.getAlwaysCollapsed = function () {
|
2134 | return this.isAlwaysCollapsed;
|
2135 | };
|
2136 | |
2137 |
|
2138 |
|
2139 | MDCShortTopAppBarFoundation.prototype.handleTargetScroll = function () {
|
2140 | this.maybeCollapseBar();
|
2141 | };
|
2142 | MDCShortTopAppBarFoundation.prototype.maybeCollapseBar = function () {
|
2143 | if (this.isAlwaysCollapsed) {
|
2144 | return;
|
2145 | }
|
2146 | var currentScroll = this.adapter.getViewportScrollY();
|
2147 | if (currentScroll <= 0) {
|
2148 | if (this.collapsed) {
|
2149 | this.uncollapse();
|
2150 | }
|
2151 | } else {
|
2152 | if (!this.collapsed) {
|
2153 | this.collapse();
|
2154 | }
|
2155 | }
|
2156 | };
|
2157 | MDCShortTopAppBarFoundation.prototype.uncollapse = function () {
|
2158 | this.adapter.removeClass(constants_1.cssClasses.SHORT_COLLAPSED_CLASS);
|
2159 | this.collapsed = false;
|
2160 | };
|
2161 | MDCShortTopAppBarFoundation.prototype.collapse = function () {
|
2162 | this.adapter.addClass(constants_1.cssClasses.SHORT_COLLAPSED_CLASS);
|
2163 | this.collapsed = true;
|
2164 | };
|
2165 | return MDCShortTopAppBarFoundation;
|
2166 | }(foundation_1.MDCTopAppBarBaseFoundation);
|
2167 | exports.MDCShortTopAppBarFoundation = MDCShortTopAppBarFoundation;
|
2168 |
|
2169 | exports.default = MDCShortTopAppBarFoundation;
|
2170 |
|
2171 | }),
|
2172 |
|
2173 | "./packages/mdc-top-app-bar/standard/foundation.ts":
|
2174 |
|
2175 |
|
2176 |
|
2177 |
|
2178 | (function(module, exports, __webpack_require__) {
|
2179 |
|
2180 | "use strict";
|
2181 |
|
2182 |
|
2183 |
|
2184 |
|
2185 |
|
2186 |
|
2187 |
|
2188 |
|
2189 |
|
2190 |
|
2191 |
|
2192 |
|
2193 |
|
2194 |
|
2195 |
|
2196 |
|
2197 |
|
2198 |
|
2199 |
|
2200 |
|
2201 |
|
2202 |
|
2203 |
|
2204 |
|
2205 | var __extends = this && this.__extends || function () {
|
2206 | var _extendStatics = function extendStatics(d, b) {
|
2207 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
2208 | d.__proto__ = b;
|
2209 | } || function (d, b) {
|
2210 | for (var p in b) {
|
2211 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
2212 | }
|
2213 | };
|
2214 | return _extendStatics(d, b);
|
2215 | };
|
2216 | return function (d, b) {
|
2217 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
2218 | _extendStatics(d, b);
|
2219 | function __() {
|
2220 | this.constructor = d;
|
2221 | }
|
2222 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
2223 | };
|
2224 | }();
|
2225 | Object.defineProperty(exports, "__esModule", { value: true });
|
2226 | exports.MDCTopAppBarFoundation = void 0;
|
2227 | var constants_1 = __webpack_require__( "./packages/mdc-top-app-bar/constants.ts");
|
2228 | var foundation_1 = __webpack_require__( "./packages/mdc-top-app-bar/foundation.ts");
|
2229 | var INITIAL_VALUE = 0;
|
2230 | var MDCTopAppBarFoundation = function (_super) {
|
2231 | __extends(MDCTopAppBarFoundation, _super);
|
2232 |
|
2233 | function MDCTopAppBarFoundation(adapter) {
|
2234 | var _this = _super.call(this, adapter) || this;
|
2235 | |
2236 |
|
2237 |
|
2238 | _this.wasDocked = true;
|
2239 | |
2240 |
|
2241 |
|
2242 | _this.isDockedShowing = true;
|
2243 | |
2244 |
|
2245 |
|
2246 | _this.currentAppBarOffsetTop = 0;
|
2247 | |
2248 |
|
2249 |
|
2250 | _this.isCurrentlyBeingResized = false;
|
2251 | |
2252 |
|
2253 |
|
2254 | _this.resizeThrottleId = INITIAL_VALUE;
|
2255 | |
2256 |
|
2257 |
|
2258 |
|
2259 | _this.resizeDebounceId = INITIAL_VALUE;
|
2260 | _this.lastScrollPosition = _this.adapter.getViewportScrollY();
|
2261 | _this.topAppBarHeight = _this.adapter.getTopAppBarHeight();
|
2262 | return _this;
|
2263 | }
|
2264 | MDCTopAppBarFoundation.prototype.destroy = function () {
|
2265 | _super.prototype.destroy.call(this);
|
2266 | this.adapter.setStyle('top', '');
|
2267 | };
|
2268 | |
2269 |
|
2270 |
|
2271 | MDCTopAppBarFoundation.prototype.handleTargetScroll = function () {
|
2272 | var currentScrollPosition = Math.max(this.adapter.getViewportScrollY(), 0);
|
2273 | var diff = currentScrollPosition - this.lastScrollPosition;
|
2274 | this.lastScrollPosition = currentScrollPosition;
|
2275 |
|
2276 |
|
2277 |
|
2278 | if (!this.isCurrentlyBeingResized) {
|
2279 | this.currentAppBarOffsetTop -= diff;
|
2280 | if (this.currentAppBarOffsetTop > 0) {
|
2281 | this.currentAppBarOffsetTop = 0;
|
2282 | } else if (Math.abs(this.currentAppBarOffsetTop) > this.topAppBarHeight) {
|
2283 | this.currentAppBarOffsetTop = -this.topAppBarHeight;
|
2284 | }
|
2285 | this.moveTopAppBar();
|
2286 | }
|
2287 | };
|
2288 | |
2289 |
|
2290 |
|
2291 | MDCTopAppBarFoundation.prototype.handleWindowResize = function () {
|
2292 | var _this = this;
|
2293 |
|
2294 | if (!this.resizeThrottleId) {
|
2295 | this.resizeThrottleId = setTimeout(function () {
|
2296 | _this.resizeThrottleId = INITIAL_VALUE;
|
2297 | _this.throttledResizeHandler();
|
2298 | }, constants_1.numbers.DEBOUNCE_THROTTLE_RESIZE_TIME_MS);
|
2299 | }
|
2300 | this.isCurrentlyBeingResized = true;
|
2301 | if (this.resizeDebounceId) {
|
2302 | clearTimeout(this.resizeDebounceId);
|
2303 | }
|
2304 | this.resizeDebounceId = setTimeout(function () {
|
2305 | _this.handleTargetScroll();
|
2306 | _this.isCurrentlyBeingResized = false;
|
2307 | _this.resizeDebounceId = INITIAL_VALUE;
|
2308 | }, constants_1.numbers.DEBOUNCE_THROTTLE_RESIZE_TIME_MS);
|
2309 | };
|
2310 | |
2311 |
|
2312 |
|
2313 | MDCTopAppBarFoundation.prototype.checkForUpdate = function () {
|
2314 | var offscreenBoundaryTop = -this.topAppBarHeight;
|
2315 | var hasAnyPixelsOffscreen = this.currentAppBarOffsetTop < 0;
|
2316 | var hasAnyPixelsOnscreen = this.currentAppBarOffsetTop > offscreenBoundaryTop;
|
2317 | var partiallyShowing = hasAnyPixelsOffscreen && hasAnyPixelsOnscreen;
|
2318 |
|
2319 | if (partiallyShowing) {
|
2320 | this.wasDocked = false;
|
2321 | } else {
|
2322 |
|
2323 | if (!this.wasDocked) {
|
2324 | this.wasDocked = true;
|
2325 | return true;
|
2326 | } else if (this.isDockedShowing !== hasAnyPixelsOnscreen) {
|
2327 | this.isDockedShowing = hasAnyPixelsOnscreen;
|
2328 | return true;
|
2329 | }
|
2330 | }
|
2331 | return partiallyShowing;
|
2332 | };
|
2333 | |
2334 |
|
2335 |
|
2336 | MDCTopAppBarFoundation.prototype.moveTopAppBar = function () {
|
2337 | if (this.checkForUpdate()) {
|
2338 |
|
2339 |
|
2340 | var offset = this.currentAppBarOffsetTop;
|
2341 | if (Math.abs(offset) >= this.topAppBarHeight) {
|
2342 | offset = -constants_1.numbers.MAX_TOP_APP_BAR_HEIGHT;
|
2343 | }
|
2344 | this.adapter.setStyle('top', offset + 'px');
|
2345 | }
|
2346 | };
|
2347 | |
2348 |
|
2349 |
|
2350 |
|
2351 | MDCTopAppBarFoundation.prototype.throttledResizeHandler = function () {
|
2352 | var currentHeight = this.adapter.getTopAppBarHeight();
|
2353 | if (this.topAppBarHeight !== currentHeight) {
|
2354 | this.wasDocked = false;
|
2355 |
|
2356 |
|
2357 |
|
2358 | this.currentAppBarOffsetTop -= this.topAppBarHeight - currentHeight;
|
2359 | this.topAppBarHeight = currentHeight;
|
2360 | }
|
2361 | this.handleTargetScroll();
|
2362 | };
|
2363 | return MDCTopAppBarFoundation;
|
2364 | }(foundation_1.MDCTopAppBarBaseFoundation);
|
2365 | exports.MDCTopAppBarFoundation = MDCTopAppBarFoundation;
|
2366 |
|
2367 | exports.default = MDCTopAppBarFoundation;
|
2368 |
|
2369 | })
|
2370 |
|
2371 | });
|
2372 | });
|
2373 |
|
\ | No newline at end of file |