q2-tecton-elements 1.4.4 → 1.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/dist/cjs/click-elsewhere.cjs.entry.js +1 -1
  2. package/dist/cjs/{index-88eda03b.js → index-56373ad4.js} +6 -1
  3. package/dist/cjs/loader.cjs.js +3 -3
  4. package/dist/cjs/{patch-e20a85b4.js → patch-9ecad880.js} +1 -1
  5. package/dist/cjs/q2-avatar.cjs.entry.js +1 -1
  6. package/dist/cjs/q2-btn.cjs.entry.js +1 -1
  7. package/dist/cjs/q2-calendar.cjs.entry.js +1 -1
  8. package/dist/cjs/q2-carousel-pane.cjs.entry.js +1 -1
  9. package/dist/cjs/q2-carousel.cjs.entry.js +1 -1
  10. package/dist/cjs/q2-checkbox-group.cjs.entry.js +1 -1
  11. package/dist/cjs/q2-checkbox.cjs.entry.js +1 -1
  12. package/dist/cjs/q2-dropdown-item.cjs.entry.js +1 -1
  13. package/dist/cjs/q2-dropdown.cjs.entry.js +6 -4
  14. package/dist/cjs/q2-editable-field.cjs.entry.js +1 -1
  15. package/dist/cjs/q2-icon.cjs.entry.js +1 -1
  16. package/dist/cjs/q2-input_2.cjs.entry.js +2 -2
  17. package/dist/cjs/q2-loading-element.cjs.entry.js +2 -2
  18. package/dist/cjs/q2-loading.cjs.entry.js +2 -2
  19. package/dist/cjs/q2-loc.cjs.entry.js +1 -1
  20. package/dist/cjs/q2-optgroup.cjs.entry.js +1 -1
  21. package/dist/cjs/q2-option.cjs.entry.js +1 -1
  22. package/dist/cjs/q2-radio-group.cjs.entry.js +1 -1
  23. package/dist/cjs/q2-radio.cjs.entry.js +1 -1
  24. package/dist/cjs/q2-section.cjs.entry.js +1 -1
  25. package/dist/cjs/q2-select.cjs.entry.js +1 -1
  26. package/dist/cjs/q2-tab-container.cjs.entry.js +521 -1042
  27. package/dist/cjs/q2-tab-pane.cjs.entry.js +1 -1
  28. package/dist/cjs/q2-tecton-elements.cjs.js +3 -3
  29. package/dist/cjs/{shapes-00766dc3.js → shapes-8ec3a001.js} +1 -1
  30. package/dist/cjs/tecton-tab-pane.cjs.entry.js +2 -1
  31. package/dist/collection/components/q2-dropdown/index.js +8 -4
  32. package/dist/collection/components/q2-input/formatting/phone.js +1 -1
  33. package/dist/collection/components/q2-tab-container/index.js +108 -38
  34. package/dist/collection/components/q2-tab-container/styles.css +4 -2
  35. package/dist/collection/components/tecton-tab-pane/index.js +1 -0
  36. package/dist/esm/click-elsewhere.entry.js +1 -1
  37. package/dist/esm/{index-b70f7228.js → index-06403810.js} +6 -1
  38. package/dist/esm/loader.mjs +3 -3
  39. package/dist/esm/{patch-187aa2d6.js → patch-580829e4.js} +1 -1
  40. package/dist/esm/q2-avatar.entry.js +1 -1
  41. package/dist/esm/q2-btn.entry.js +1 -1
  42. package/dist/esm/q2-calendar.entry.js +1 -1
  43. package/dist/esm/q2-carousel-pane.entry.js +1 -1
  44. package/dist/esm/q2-carousel.entry.js +1 -1
  45. package/dist/esm/q2-checkbox-group.entry.js +1 -1
  46. package/dist/esm/q2-checkbox.entry.js +1 -1
  47. package/dist/esm/q2-dropdown-item.entry.js +1 -1
  48. package/dist/esm/q2-dropdown.entry.js +6 -4
  49. package/dist/esm/q2-editable-field.entry.js +1 -1
  50. package/dist/esm/q2-icon.entry.js +1 -1
  51. package/dist/esm/q2-input_2.entry.js +2 -2
  52. package/dist/esm/q2-loading-element.entry.js +2 -2
  53. package/dist/esm/q2-loading.entry.js +2 -2
  54. package/dist/esm/q2-loc.entry.js +1 -1
  55. package/dist/esm/q2-optgroup.entry.js +1 -1
  56. package/dist/esm/q2-option.entry.js +1 -1
  57. package/dist/esm/q2-radio-group.entry.js +1 -1
  58. package/dist/esm/q2-radio.entry.js +1 -1
  59. package/dist/esm/q2-section.entry.js +1 -1
  60. package/dist/esm/q2-select.entry.js +1 -1
  61. package/dist/esm/q2-tab-container.entry.js +521 -1042
  62. package/dist/esm/q2-tab-pane.entry.js +1 -1
  63. package/dist/esm/q2-tecton-elements.mjs +3 -3
  64. package/dist/esm/{shapes-1a12324b.js → shapes-ac99fc8e.js} +1 -1
  65. package/dist/esm/tecton-tab-pane.entry.js +2 -1
  66. package/dist/esm-es5/click-elsewhere.entry.js +1 -1
  67. package/dist/esm-es5/{index-b70f7228.js → index-06403810.js} +6 -1
  68. package/dist/esm-es5/loader.mjs +3 -3
  69. package/dist/esm-es5/{patch-187aa2d6.js → patch-580829e4.js} +1 -1
  70. package/dist/esm-es5/q2-avatar.entry.js +1 -1
  71. package/dist/esm-es5/q2-btn.entry.js +1 -1
  72. package/dist/esm-es5/q2-calendar.entry.js +1 -1
  73. package/dist/esm-es5/q2-carousel-pane.entry.js +1 -1
  74. package/dist/esm-es5/q2-carousel.entry.js +1 -1
  75. package/dist/esm-es5/q2-checkbox-group.entry.js +1 -1
  76. package/dist/esm-es5/q2-checkbox.entry.js +1 -1
  77. package/dist/esm-es5/q2-dropdown-item.entry.js +1 -1
  78. package/dist/esm-es5/q2-dropdown.entry.js +6 -4
  79. package/dist/esm-es5/q2-editable-field.entry.js +1 -1
  80. package/dist/esm-es5/q2-icon.entry.js +1 -1
  81. package/dist/esm-es5/q2-input_2.entry.js +2 -2
  82. package/dist/esm-es5/q2-loading-element.entry.js +2 -2
  83. package/dist/esm-es5/q2-loading.entry.js +2 -2
  84. package/dist/esm-es5/q2-loc.entry.js +1 -1
  85. package/dist/esm-es5/q2-optgroup.entry.js +1 -1
  86. package/dist/esm-es5/q2-option.entry.js +1 -1
  87. package/dist/esm-es5/q2-radio-group.entry.js +1 -1
  88. package/dist/esm-es5/q2-radio.entry.js +1 -1
  89. package/dist/esm-es5/q2-section.entry.js +1 -1
  90. package/dist/esm-es5/q2-select.entry.js +1 -1
  91. package/dist/esm-es5/q2-tab-container.entry.js +426 -1068
  92. package/dist/esm-es5/q2-tab-pane.entry.js +1 -1
  93. package/dist/esm-es5/q2-tecton-elements.mjs +3 -3
  94. package/dist/esm-es5/{shapes-1a12324b.js → shapes-ac99fc8e.js} +1 -1
  95. package/dist/esm-es5/tecton-tab-pane.entry.js +2 -1
  96. package/dist/q2-tecton-elements/{p-c96424ae.entry.js → p-0898c601.entry.js} +1 -1
  97. package/dist/q2-tecton-elements/{p-c164ff6e.entry.js → p-1118a9a2.entry.js} +1 -1
  98. package/dist/q2-tecton-elements/{p-06e01d71.system.js → p-1b41293f.system.js} +1 -1
  99. package/dist/q2-tecton-elements/{p-b1fb02bf.entry.js → p-2071c411.entry.js} +1 -1
  100. package/dist/q2-tecton-elements/p-2b69fdec.system.js +1 -0
  101. package/dist/q2-tecton-elements/p-2b775411.entry.js +1 -0
  102. package/dist/q2-tecton-elements/{p-30c73ea9.entry.js → p-368f6eee.entry.js} +1 -1
  103. package/dist/q2-tecton-elements/{p-33a4a4e6.system.entry.js → p-3788add3.system.entry.js} +1 -1
  104. package/dist/q2-tecton-elements/{p-5adaa91d.system.entry.js → p-3de63622.system.entry.js} +1 -1
  105. package/dist/q2-tecton-elements/p-43a05b9f.entry.js +1 -0
  106. package/dist/q2-tecton-elements/{p-b96a2e11.entry.js → p-441decb7.entry.js} +1 -1
  107. package/dist/q2-tecton-elements/{p-5f52c28d.system.js → p-46e098a0.system.js} +1 -1
  108. package/dist/q2-tecton-elements/{p-843fdb33.system.entry.js → p-55ff8885.system.entry.js} +1 -1
  109. package/dist/q2-tecton-elements/{p-f01bebc8.system.entry.js → p-560cadce.system.entry.js} +1 -1
  110. package/dist/q2-tecton-elements/{p-9fc24628.js → p-5f9033b7.js} +1 -1
  111. package/dist/q2-tecton-elements/{p-1113bf25.system.entry.js → p-63ec6e3d.system.entry.js} +1 -1
  112. package/dist/q2-tecton-elements/{p-323cbdd3.entry.js → p-65d32cb9.entry.js} +1 -1
  113. package/dist/q2-tecton-elements/{p-a53e34ff.system.entry.js → p-66c9c34a.system.entry.js} +1 -1
  114. package/dist/q2-tecton-elements/p-6c2249f2.entry.js +1 -0
  115. package/dist/q2-tecton-elements/{p-d3d487ce.entry.js → p-7624ed0d.entry.js} +1 -1
  116. package/dist/q2-tecton-elements/{p-9f4d9ea2.system.entry.js → p-7e5a1320.system.entry.js} +1 -1
  117. package/dist/q2-tecton-elements/{p-a68a88bb.system.entry.js → p-824c4b15.system.entry.js} +1 -1
  118. package/dist/q2-tecton-elements/{p-3d8e5455.system.entry.js → p-82ce1d2d.system.entry.js} +1 -1
  119. package/dist/q2-tecton-elements/{p-12cf6e8b.entry.js → p-84e239ae.entry.js} +1 -1
  120. package/dist/q2-tecton-elements/{p-ce2eb03c.js → p-885ad5bb.js} +1 -1
  121. package/dist/q2-tecton-elements/{p-208d0c6e.system.entry.js → p-8fa28d27.system.entry.js} +1 -1
  122. package/dist/q2-tecton-elements/{p-7b10d18b.entry.js → p-94944dd4.entry.js} +1 -1
  123. package/dist/q2-tecton-elements/p-94a26b0f.system.js +1 -0
  124. package/dist/q2-tecton-elements/{p-b88eabe8.system.entry.js → p-9644093a.system.entry.js} +1 -1
  125. package/dist/q2-tecton-elements/{p-5fc58e19.entry.js → p-967e5b17.entry.js} +1 -1
  126. package/dist/q2-tecton-elements/p-9d45cb48.system.entry.js +1 -0
  127. package/dist/q2-tecton-elements/{p-b2a4162a.entry.js → p-9d82b5a4.entry.js} +1 -1
  128. package/dist/q2-tecton-elements/{p-4b737f84.system.entry.js → p-a0865160.system.entry.js} +1 -1
  129. package/dist/q2-tecton-elements/{p-832f3e02.entry.js → p-a7831802.entry.js} +1 -1
  130. package/dist/q2-tecton-elements/p-aa243b6a.system.entry.js +1 -0
  131. package/dist/q2-tecton-elements/{p-5f0adaa9.system.entry.js → p-ad806b56.system.entry.js} +1 -1
  132. package/dist/q2-tecton-elements/{p-75be017a.entry.js → p-b0d0f85d.entry.js} +1 -1
  133. package/dist/q2-tecton-elements/{p-2fce6304.entry.js → p-b3b046f3.entry.js} +1 -1
  134. package/dist/q2-tecton-elements/p-b5ebb4cb.js +1 -0
  135. package/dist/q2-tecton-elements/{p-f6023957.entry.js → p-ba96d37c.entry.js} +1 -1
  136. package/dist/q2-tecton-elements/{p-f6f4572b.system.entry.js → p-bbef2e56.system.entry.js} +1 -1
  137. package/dist/q2-tecton-elements/{p-07203a0e.entry.js → p-c39e81d3.entry.js} +1 -1
  138. package/dist/q2-tecton-elements/{p-46204d10.entry.js → p-c3d24f40.entry.js} +1 -1
  139. package/dist/q2-tecton-elements/p-c88975f8.entry.js +1 -0
  140. package/dist/q2-tecton-elements/{p-535687b4.system.entry.js → p-cb8d4e07.system.entry.js} +1 -1
  141. package/dist/q2-tecton-elements/{p-ad2fa69f.system.entry.js → p-cf340d13.system.entry.js} +1 -1
  142. package/dist/q2-tecton-elements/{p-390b9415.entry.js → p-d30f657f.entry.js} +1 -1
  143. package/dist/q2-tecton-elements/{p-8dfd0e89.system.entry.js → p-db3ade12.system.entry.js} +1 -1
  144. package/dist/q2-tecton-elements/{p-7b3a7b01.entry.js → p-dc4b38dc.entry.js} +1 -1
  145. package/dist/q2-tecton-elements/{p-4fd89735.system.entry.js → p-ebc8a18d.system.entry.js} +1 -1
  146. package/dist/q2-tecton-elements/{p-83ac78cd.entry.js → p-ed186964.entry.js} +1 -1
  147. package/dist/q2-tecton-elements/{p-3a2e7aad.system.entry.js → p-f1717e3c.system.entry.js} +1 -1
  148. package/dist/q2-tecton-elements/{p-dbf210b9.system.entry.js → p-f248c3db.system.entry.js} +1 -1
  149. package/dist/q2-tecton-elements/{p-9a298ef4.entry.js → p-f7f06773.entry.js} +1 -1
  150. package/dist/q2-tecton-elements/p-fc9ea618.system.entry.js +1 -0
  151. package/dist/q2-tecton-elements/{p-49ec33ae.system.entry.js → p-fcc00d73.system.entry.js} +1 -1
  152. package/dist/q2-tecton-elements/{p-b4637b36.system.entry.js → p-fefca9c1.system.entry.js} +1 -1
  153. package/dist/q2-tecton-elements/q2-tecton-elements.esm.js +1 -1
  154. package/dist/q2-tecton-elements/q2-tecton-elements.js +1 -1
  155. package/dist/types/components/q2-dropdown/index.d.ts +1 -0
  156. package/dist/types/components/q2-tab-container/index.d.ts +8 -4
  157. package/dist/types/workspace/workspace/{_tecton-production_release_1.4.x → _tecton-production_release_1.5.x}/packages/q2-tecton-elements/.stencil/test/helpers.d.ts +0 -0
  158. package/package.json +3 -2
  159. package/dist/q2-tecton-elements/p-00067d0a.system.js +0 -1
  160. package/dist/q2-tecton-elements/p-154bd5bd.entry.js +0 -1
  161. package/dist/q2-tecton-elements/p-1a8e579d.js +0 -1
  162. package/dist/q2-tecton-elements/p-268818c7.entry.js +0 -1
  163. package/dist/q2-tecton-elements/p-7e020511.system.entry.js +0 -1
  164. package/dist/q2-tecton-elements/p-bc15b363.entry.js +0 -1
  165. package/dist/q2-tecton-elements/p-ce8573ad.system.entry.js +0 -1
  166. package/dist/q2-tecton-elements/p-e41762c1.system.entry.js +0 -1
  167. package/dist/q2-tecton-elements/p-f08aea0c.system.js +0 -1
  168. package/dist/q2-tecton-elements/p-f15af226.entry.js +0 -1
@@ -1,1059 +1,362 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- extendStatics(d, b);
10
- function __() { this.constructor = d; }
11
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
- };
13
- })();
14
- import { r as registerInstance, c as createEvent, h, g as getElement } from './index-b70f7228.js';
1
+ import { r as registerInstance, c as createEvent, h, g as getElement } from './index-06403810.js';
15
2
  import { c as createGuid } from './index-ff056163.js';
16
- function isFunction(x) {
17
- return typeof x === 'function';
3
+ function createCommonjsModule(fn, basedir, module) {
4
+ return module = {
5
+ path: basedir,
6
+ exports: {},
7
+ require: function (path, base) {
8
+ return commonjsRequire();
9
+ }
10
+ }, fn(module, module.exports), module.exports;
18
11
  }
19
- var _enable_super_gross_mode_that_will_cause_bad_things = false;
20
- var config = {
21
- Promise: undefined,
22
- set useDeprecatedSynchronousErrorHandling(value) {
23
- if (value) {
24
- var error = new Error();
25
- console.warn('DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n' + error.stack);
26
- }
27
- else if (_enable_super_gross_mode_that_will_cause_bad_things) {
28
- console.log('RxJS: Back to a better error behavior. Thank you. <3');
29
- }
30
- _enable_super_gross_mode_that_will_cause_bad_things = value;
31
- },
32
- get useDeprecatedSynchronousErrorHandling() {
33
- return _enable_super_gross_mode_that_will_cause_bad_things;
34
- },
35
- };
36
- function hostReportError(err) {
37
- setTimeout(function () { throw err; }, 0);
12
+ function commonjsRequire() {
13
+ throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
38
14
  }
39
- var empty = {
40
- closed: true,
41
- next: function (value) { },
42
- error: function (err) {
43
- if (config.useDeprecatedSynchronousErrorHandling) {
44
- throw err;
45
- }
46
- else {
47
- hostReportError(err);
48
- }
49
- },
50
- complete: function () { }
51
- };
52
- var isArray = (function () { return Array.isArray || (function (x) { return x && typeof x.length === 'number'; }); })();
53
- function isObject(x) {
54
- return x !== null && typeof x === 'object';
55
- }
56
- var UnsubscriptionErrorImpl = (function () {
57
- function UnsubscriptionErrorImpl(errors) {
58
- Error.call(this);
59
- this.message = errors ?
60
- errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ') : '';
61
- this.name = 'UnsubscriptionError';
62
- this.errors = errors;
63
- return this;
64
- }
65
- UnsubscriptionErrorImpl.prototype = Object.create(Error.prototype);
66
- return UnsubscriptionErrorImpl;
67
- })();
68
- var UnsubscriptionError = UnsubscriptionErrorImpl;
69
- var Subscription = /** @class */ (function () {
70
- function Subscription(unsubscribe) {
71
- this.closed = false;
72
- this._parentOrParents = null;
73
- this._subscriptions = null;
74
- if (unsubscribe) {
75
- this._ctorUnsubscribe = true;
76
- this._unsubscribe = unsubscribe;
77
- }
78
- }
79
- Subscription.prototype.unsubscribe = function () {
80
- var errors;
81
- if (this.closed) {
82
- return;
83
- }
84
- var _a = this, _parentOrParents = _a._parentOrParents, _ctorUnsubscribe = _a._ctorUnsubscribe, _unsubscribe = _a._unsubscribe, _subscriptions = _a._subscriptions;
85
- this.closed = true;
86
- this._parentOrParents = null;
87
- this._subscriptions = null;
88
- if (_parentOrParents instanceof Subscription) {
89
- _parentOrParents.remove(this);
90
- }
91
- else if (_parentOrParents !== null) {
92
- for (var index = 0; index < _parentOrParents.length; ++index) {
93
- var parent = _parentOrParents[index];
94
- parent.remove(this);
95
- }
96
- }
97
- if (isFunction(_unsubscribe)) {
98
- if (_ctorUnsubscribe) {
99
- this._unsubscribe = undefined;
100
- }
101
- try {
102
- _unsubscribe.call(this);
103
- }
104
- catch (e) {
105
- errors = e instanceof UnsubscriptionError ? flattenUnsubscriptionErrors(e.errors) : [e];
15
+ var smoothscroll = createCommonjsModule(function (module, exports) {
16
+ /* smoothscroll v0.4.4 - 2019 - Dustan Kasten, Jeremias Menichelli - MIT License */
17
+ (function () {
18
+ // polyfill
19
+ function polyfill() {
20
+ // aliases
21
+ var w = window;
22
+ var d = document;
23
+ // return if scroll behavior is supported and polyfill is not forced
24
+ if ('scrollBehavior' in d.documentElement.style &&
25
+ w.__forceSmoothScrollPolyfill__ !== true) {
26
+ return;
106
27
  }
107
- }
108
- if (isArray(_subscriptions)) {
109
- var index = -1;
110
- var len = _subscriptions.length;
111
- while (++index < len) {
112
- var sub = _subscriptions[index];
113
- if (isObject(sub)) {
114
- try {
115
- sub.unsubscribe();
116
- }
117
- catch (e) {
118
- errors = errors || [];
119
- if (e instanceof UnsubscriptionError) {
120
- errors = errors.concat(flattenUnsubscriptionErrors(e.errors));
121
- }
122
- else {
123
- errors.push(e);
124
- }
125
- }
28
+ // globals
29
+ var Element = w.HTMLElement || w.Element;
30
+ var SCROLL_TIME = 468;
31
+ // object gathering original scroll methods
32
+ var original = {
33
+ scroll: w.scroll || w.scrollTo,
34
+ scrollBy: w.scrollBy,
35
+ elementScroll: Element.prototype.scroll || scrollElement,
36
+ scrollIntoView: Element.prototype.scrollIntoView
37
+ };
38
+ // define timing method
39
+ var now = w.performance && w.performance.now
40
+ ? w.performance.now.bind(w.performance)
41
+ : Date.now;
42
+ /**
43
+ * indicates if a the current browser is made by Microsoft
44
+ * @method isMicrosoftBrowser
45
+ * @param {String} userAgent
46
+ * @returns {Boolean}
47
+ */
48
+ function isMicrosoftBrowser(userAgent) {
49
+ var userAgentPatterns = ['MSIE ', 'Trident/', 'Edge/'];
50
+ return new RegExp(userAgentPatterns.join('|')).test(userAgent);
51
+ }
52
+ /*
53
+ * IE has rounding bug rounding down clientHeight and clientWidth and
54
+ * rounding up scrollHeight and scrollWidth causing false positives
55
+ * on hasScrollableSpace
56
+ */
57
+ var ROUNDING_TOLERANCE = isMicrosoftBrowser(w.navigator.userAgent) ? 1 : 0;
58
+ /**
59
+ * changes scroll position inside an element
60
+ * @method scrollElement
61
+ * @param {Number} x
62
+ * @param {Number} y
63
+ * @returns {undefined}
64
+ */
65
+ function scrollElement(x, y) {
66
+ this.scrollLeft = x;
67
+ this.scrollTop = y;
68
+ }
69
+ /**
70
+ * returns result of applying ease math function to a number
71
+ * @method ease
72
+ * @param {Number} k
73
+ * @returns {Number}
74
+ */
75
+ function ease(k) {
76
+ return 0.5 * (1 - Math.cos(Math.PI * k));
77
+ }
78
+ /**
79
+ * indicates if a smooth behavior should be applied
80
+ * @method shouldBailOut
81
+ * @param {Number|Object} firstArg
82
+ * @returns {Boolean}
83
+ */
84
+ function shouldBailOut(firstArg) {
85
+ if (firstArg === null ||
86
+ typeof firstArg !== 'object' ||
87
+ firstArg.behavior === undefined ||
88
+ firstArg.behavior === 'auto' ||
89
+ firstArg.behavior === 'instant') {
90
+ // first argument is not an object/null
91
+ // or behavior is auto, instant or undefined
92
+ return true;
126
93
  }
127
- }
128
- }
129
- if (errors) {
130
- throw new UnsubscriptionError(errors);
131
- }
132
- };
133
- Subscription.prototype.add = function (teardown) {
134
- var subscription = teardown;
135
- if (!teardown) {
136
- return Subscription.EMPTY;
137
- }
138
- switch (typeof teardown) {
139
- case 'function':
140
- subscription = new Subscription(teardown);
141
- case 'object':
142
- if (subscription === this || subscription.closed || typeof subscription.unsubscribe !== 'function') {
143
- return subscription;
94
+ if (typeof firstArg === 'object' && firstArg.behavior === 'smooth') {
95
+ // first argument is an object and behavior is smooth
96
+ return false;
144
97
  }
145
- else if (this.closed) {
146
- subscription.unsubscribe();
147
- return subscription;
98
+ // throw error when behavior is not supported
99
+ throw new TypeError('behavior member of ScrollOptions ' +
100
+ firstArg.behavior +
101
+ ' is not a valid value for enumeration ScrollBehavior.');
102
+ }
103
+ /**
104
+ * indicates if an element has scrollable space in the provided axis
105
+ * @method hasScrollableSpace
106
+ * @param {Node} el
107
+ * @param {String} axis
108
+ * @returns {Boolean}
109
+ */
110
+ function hasScrollableSpace(el, axis) {
111
+ if (axis === 'Y') {
112
+ return el.clientHeight + ROUNDING_TOLERANCE < el.scrollHeight;
148
113
  }
149
- else if (!(subscription instanceof Subscription)) {
150
- var tmp = subscription;
151
- subscription = new Subscription();
152
- subscription._subscriptions = [tmp];
114
+ if (axis === 'X') {
115
+ return el.clientWidth + ROUNDING_TOLERANCE < el.scrollWidth;
153
116
  }
154
- break;
155
- default: {
156
- throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.');
157
- }
158
- }
159
- var _parentOrParents = subscription._parentOrParents;
160
- if (_parentOrParents === null) {
161
- subscription._parentOrParents = this;
162
- }
163
- else if (_parentOrParents instanceof Subscription) {
164
- if (_parentOrParents === this) {
165
- return subscription;
166
- }
167
- subscription._parentOrParents = [_parentOrParents, this];
168
- }
169
- else if (_parentOrParents.indexOf(this) === -1) {
170
- _parentOrParents.push(this);
171
- }
172
- else {
173
- return subscription;
174
- }
175
- var subscriptions = this._subscriptions;
176
- if (subscriptions === null) {
177
- this._subscriptions = [subscription];
178
- }
179
- else {
180
- subscriptions.push(subscription);
181
- }
182
- return subscription;
183
- };
184
- Subscription.prototype.remove = function (subscription) {
185
- var subscriptions = this._subscriptions;
186
- if (subscriptions) {
187
- var subscriptionIndex = subscriptions.indexOf(subscription);
188
- if (subscriptionIndex !== -1) {
189
- subscriptions.splice(subscriptionIndex, 1);
190
117
  }
191
- }
192
- };
193
- return Subscription;
194
- }());
195
- Subscription.EMPTY = (function (empty) {
196
- empty.closed = true;
197
- return empty;
198
- }(new Subscription()));
199
- function flattenUnsubscriptionErrors(errors) {
200
- return errors.reduce(function (errs, err) { return errs.concat((err instanceof UnsubscriptionError) ? err.errors : err); }, []);
201
- }
202
- var rxSubscriber = (function () { return typeof Symbol === 'function'
203
- ? Symbol('rxSubscriber')
204
- : '@@rxSubscriber_' + Math.random(); })();
205
- var Subscriber = /** @class */ (function (_super) {
206
- __extends(Subscriber, _super);
207
- function Subscriber(destinationOrNext, error, complete) {
208
- var _this = _super.call(this) || this;
209
- _this.syncErrorValue = null;
210
- _this.syncErrorThrown = false;
211
- _this.syncErrorThrowable = false;
212
- _this.isStopped = false;
213
- switch (arguments.length) {
214
- case 0:
215
- _this.destination = empty;
216
- break;
217
- case 1:
218
- if (!destinationOrNext) {
219
- _this.destination = empty;
220
- break;
118
+ /**
119
+ * indicates if an element has a scrollable overflow property in the axis
120
+ * @method canOverflow
121
+ * @param {Node} el
122
+ * @param {String} axis
123
+ * @returns {Boolean}
124
+ */
125
+ function canOverflow(el, axis) {
126
+ var overflowValue = w.getComputedStyle(el, null)['overflow' + axis];
127
+ return overflowValue === 'auto' || overflowValue === 'scroll';
128
+ }
129
+ /**
130
+ * indicates if an element can be scrolled in either axis
131
+ * @method isScrollable
132
+ * @param {Node} el
133
+ * @param {String} axis
134
+ * @returns {Boolean}
135
+ */
136
+ function isScrollable(el) {
137
+ var isScrollableY = hasScrollableSpace(el, 'Y') && canOverflow(el, 'Y');
138
+ var isScrollableX = hasScrollableSpace(el, 'X') && canOverflow(el, 'X');
139
+ return isScrollableY || isScrollableX;
140
+ }
141
+ /**
142
+ * finds scrollable parent of an element
143
+ * @method findScrollableParent
144
+ * @param {Node} el
145
+ * @returns {Node} el
146
+ */
147
+ function findScrollableParent(el) {
148
+ while (el !== d.body && isScrollable(el) === false) {
149
+ el = el.parentNode || el.host;
221
150
  }
222
- if (typeof destinationOrNext === 'object') {
223
- if (destinationOrNext instanceof Subscriber) {
224
- _this.syncErrorThrowable = destinationOrNext.syncErrorThrowable;
225
- _this.destination = destinationOrNext;
226
- destinationOrNext.add(_this);
227
- }
228
- else {
229
- _this.syncErrorThrowable = true;
230
- _this.destination = new SafeSubscriber(_this, destinationOrNext);
231
- }
232
- break;
151
+ return el;
152
+ }
153
+ /**
154
+ * self invoked function that, given a context, steps through scrolling
155
+ * @method step
156
+ * @param {Object} context
157
+ * @returns {undefined}
158
+ */
159
+ function step(context) {
160
+ var time = now();
161
+ var value;
162
+ var currentX;
163
+ var currentY;
164
+ var elapsed = (time - context.startTime) / SCROLL_TIME;
165
+ // avoid elapsed times higher than one
166
+ elapsed = elapsed > 1 ? 1 : elapsed;
167
+ // apply easing to elapsed time
168
+ value = ease(elapsed);
169
+ currentX = context.startX + (context.x - context.startX) * value;
170
+ currentY = context.startY + (context.y - context.startY) * value;
171
+ context.method.call(context.scrollable, currentX, currentY);
172
+ // scroll more if we have not reached our destination
173
+ if (currentX !== context.x || currentY !== context.y) {
174
+ w.requestAnimationFrame(step.bind(w, context));
233
175
  }
234
- default:
235
- _this.syncErrorThrowable = true;
236
- _this.destination = new SafeSubscriber(_this, destinationOrNext, error, complete);
237
- break;
238
- }
239
- return _this;
240
- }
241
- Subscriber.prototype[rxSubscriber] = function () { return this; };
242
- Subscriber.create = function (next, error, complete) {
243
- var subscriber = new Subscriber(next, error, complete);
244
- subscriber.syncErrorThrowable = false;
245
- return subscriber;
246
- };
247
- Subscriber.prototype.next = function (value) {
248
- if (!this.isStopped) {
249
- this._next(value);
250
- }
251
- };
252
- Subscriber.prototype.error = function (err) {
253
- if (!this.isStopped) {
254
- this.isStopped = true;
255
- this._error(err);
256
- }
257
- };
258
- Subscriber.prototype.complete = function () {
259
- if (!this.isStopped) {
260
- this.isStopped = true;
261
- this._complete();
262
- }
263
- };
264
- Subscriber.prototype.unsubscribe = function () {
265
- if (this.closed) {
266
- return;
267
- }
268
- this.isStopped = true;
269
- _super.prototype.unsubscribe.call(this);
270
- };
271
- Subscriber.prototype._next = function (value) {
272
- this.destination.next(value);
273
- };
274
- Subscriber.prototype._error = function (err) {
275
- this.destination.error(err);
276
- this.unsubscribe();
277
- };
278
- Subscriber.prototype._complete = function () {
279
- this.destination.complete();
280
- this.unsubscribe();
281
- };
282
- Subscriber.prototype._unsubscribeAndRecycle = function () {
283
- var _parentOrParents = this._parentOrParents;
284
- this._parentOrParents = null;
285
- this.unsubscribe();
286
- this.closed = false;
287
- this.isStopped = false;
288
- this._parentOrParents = _parentOrParents;
289
- return this;
290
- };
291
- return Subscriber;
292
- }(Subscription));
293
- var SafeSubscriber = /** @class */ (function (_super) {
294
- __extends(SafeSubscriber, _super);
295
- function SafeSubscriber(_parentSubscriber, observerOrNext, error, complete) {
296
- var _this = _super.call(this) || this;
297
- _this._parentSubscriber = _parentSubscriber;
298
- var next;
299
- var context = _this;
300
- if (isFunction(observerOrNext)) {
301
- next = observerOrNext;
302
- }
303
- else if (observerOrNext) {
304
- next = observerOrNext.next;
305
- error = observerOrNext.error;
306
- complete = observerOrNext.complete;
307
- if (observerOrNext !== empty) {
308
- context = Object.create(observerOrNext);
309
- if (isFunction(context.unsubscribe)) {
310
- _this.add(context.unsubscribe.bind(context));
311
- }
312
- context.unsubscribe = _this.unsubscribe.bind(_this);
313
176
  }
314
- }
315
- _this._context = context;
316
- _this._next = next;
317
- _this._error = error;
318
- _this._complete = complete;
319
- return _this;
320
- }
321
- SafeSubscriber.prototype.next = function (value) {
322
- if (!this.isStopped && this._next) {
323
- var _parentSubscriber = this._parentSubscriber;
324
- if (!config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
325
- this.__tryOrUnsub(this._next, value);
326
- }
327
- else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) {
328
- this.unsubscribe();
329
- }
330
- }
331
- };
332
- SafeSubscriber.prototype.error = function (err) {
333
- if (!this.isStopped) {
334
- var _parentSubscriber = this._parentSubscriber;
335
- var useDeprecatedSynchronousErrorHandling = config.useDeprecatedSynchronousErrorHandling;
336
- if (this._error) {
337
- if (!useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
338
- this.__tryOrUnsub(this._error, err);
339
- this.unsubscribe();
177
+ /**
178
+ * scrolls window or element with a smooth behavior
179
+ * @method smoothScroll
180
+ * @param {Object|Node} el
181
+ * @param {Number} x
182
+ * @param {Number} y
183
+ * @returns {undefined}
184
+ */
185
+ function smoothScroll(el, x, y) {
186
+ var scrollable;
187
+ var startX;
188
+ var startY;
189
+ var method;
190
+ var startTime = now();
191
+ // define scroll context
192
+ if (el === d.body) {
193
+ scrollable = w;
194
+ startX = w.scrollX || w.pageXOffset;
195
+ startY = w.scrollY || w.pageYOffset;
196
+ method = original.scroll;
340
197
  }
341
198
  else {
342
- this.__tryOrSetError(_parentSubscriber, this._error, err);
343
- this.unsubscribe();
199
+ scrollable = el;
200
+ startX = el.scrollLeft;
201
+ startY = el.scrollTop;
202
+ method = scrollElement;
344
203
  }
345
- }
346
- else if (!_parentSubscriber.syncErrorThrowable) {
347
- this.unsubscribe();
348
- if (useDeprecatedSynchronousErrorHandling) {
349
- throw err;
204
+ // scroll looping over a frame
205
+ step({
206
+ scrollable: scrollable,
207
+ method: method,
208
+ startTime: startTime,
209
+ startX: startX,
210
+ startY: startY,
211
+ x: x,
212
+ y: y
213
+ });
214
+ }
215
+ // ORIGINAL METHODS OVERRIDES
216
+ // w.scroll and w.scrollTo
217
+ w.scroll = w.scrollTo = function () {
218
+ // avoid action when no arguments are passed
219
+ if (arguments[0] === undefined) {
220
+ return;
350
221
  }
351
- hostReportError(err);
352
- }
353
- else {
354
- if (useDeprecatedSynchronousErrorHandling) {
355
- _parentSubscriber.syncErrorValue = err;
356
- _parentSubscriber.syncErrorThrown = true;
222
+ // avoid smooth behavior if not required
223
+ if (shouldBailOut(arguments[0]) === true) {
224
+ original.scroll.call(w, arguments[0].left !== undefined
225
+ ? arguments[0].left
226
+ : typeof arguments[0] !== 'object'
227
+ ? arguments[0]
228
+ : w.scrollX || w.pageXOffset,
229
+ // use top prop, second argument if present or fallback to scrollY
230
+ arguments[0].top !== undefined
231
+ ? arguments[0].top
232
+ : arguments[1] !== undefined
233
+ ? arguments[1]
234
+ : w.scrollY || w.pageYOffset);
235
+ return;
357
236
  }
358
- else {
359
- hostReportError(err);
237
+ // LET THE SMOOTHNESS BEGIN!
238
+ smoothScroll.call(w, d.body, arguments[0].left !== undefined
239
+ ? ~~arguments[0].left
240
+ : w.scrollX || w.pageXOffset, arguments[0].top !== undefined
241
+ ? ~~arguments[0].top
242
+ : w.scrollY || w.pageYOffset);
243
+ };
244
+ // w.scrollBy
245
+ w.scrollBy = function () {
246
+ // avoid action when no arguments are passed
247
+ if (arguments[0] === undefined) {
248
+ return;
360
249
  }
361
- this.unsubscribe();
362
- }
363
- }
364
- };
365
- SafeSubscriber.prototype.complete = function () {
366
- var _this = this;
367
- if (!this.isStopped) {
368
- var _parentSubscriber = this._parentSubscriber;
369
- if (this._complete) {
370
- var wrappedComplete = function () { return _this._complete.call(_this._context); };
371
- if (!config.useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
372
- this.__tryOrUnsub(wrappedComplete);
373
- this.unsubscribe();
250
+ // avoid smooth behavior if not required
251
+ if (shouldBailOut(arguments[0])) {
252
+ original.scrollBy.call(w, arguments[0].left !== undefined
253
+ ? arguments[0].left
254
+ : typeof arguments[0] !== 'object' ? arguments[0] : 0, arguments[0].top !== undefined
255
+ ? arguments[0].top
256
+ : arguments[1] !== undefined ? arguments[1] : 0);
257
+ return;
374
258
  }
375
- else {
376
- this.__tryOrSetError(_parentSubscriber, wrappedComplete);
377
- this.unsubscribe();
259
+ // LET THE SMOOTHNESS BEGIN!
260
+ smoothScroll.call(w, d.body, ~~arguments[0].left + (w.scrollX || w.pageXOffset), ~~arguments[0].top + (w.scrollY || w.pageYOffset));
261
+ };
262
+ // Element.prototype.scroll and Element.prototype.scrollTo
263
+ Element.prototype.scroll = Element.prototype.scrollTo = function () {
264
+ // avoid action when no arguments are passed
265
+ if (arguments[0] === undefined) {
266
+ return;
378
267
  }
379
- }
380
- else {
381
- this.unsubscribe();
382
- }
383
- }
384
- };
385
- SafeSubscriber.prototype.__tryOrUnsub = function (fn, value) {
386
- try {
387
- fn.call(this._context, value);
388
- }
389
- catch (err) {
390
- this.unsubscribe();
391
- if (config.useDeprecatedSynchronousErrorHandling) {
392
- throw err;
393
- }
394
- else {
395
- hostReportError(err);
396
- }
397
- }
398
- };
399
- SafeSubscriber.prototype.__tryOrSetError = function (parent, fn, value) {
400
- if (!config.useDeprecatedSynchronousErrorHandling) {
401
- throw new Error('bad call');
402
- }
403
- try {
404
- fn.call(this._context, value);
405
- }
406
- catch (err) {
407
- if (config.useDeprecatedSynchronousErrorHandling) {
408
- parent.syncErrorValue = err;
409
- parent.syncErrorThrown = true;
410
- return true;
411
- }
412
- else {
413
- hostReportError(err);
414
- return true;
415
- }
416
- }
417
- return false;
418
- };
419
- SafeSubscriber.prototype._unsubscribe = function () {
420
- var _parentSubscriber = this._parentSubscriber;
421
- this._context = null;
422
- this._parentSubscriber = null;
423
- _parentSubscriber.unsubscribe();
424
- };
425
- return SafeSubscriber;
426
- }(Subscriber));
427
- function canReportError(observer) {
428
- while (observer) {
429
- var closed = observer.closed, destination = observer.destination, isStopped = observer.isStopped;
430
- if (closed || isStopped) {
431
- return false;
432
- }
433
- else if (destination && destination instanceof Subscriber) {
434
- observer = destination;
435
- }
436
- else {
437
- observer = null;
438
- }
439
- }
440
- return true;
441
- }
442
- function toSubscriber(nextOrObserver, error, complete) {
443
- if (nextOrObserver) {
444
- if (nextOrObserver instanceof Subscriber) {
445
- return nextOrObserver;
446
- }
447
- if (nextOrObserver[rxSubscriber]) {
448
- return nextOrObserver[rxSubscriber]();
449
- }
450
- }
451
- if (!nextOrObserver && !error && !complete) {
452
- return new Subscriber(empty);
453
- }
454
- return new Subscriber(nextOrObserver, error, complete);
455
- }
456
- var observable = (function () { return typeof Symbol === 'function' && Symbol.observable || '@@observable'; })();
457
- function identity(x) {
458
- return x;
459
- }
460
- function pipeFromArray(fns) {
461
- if (fns.length === 0) {
462
- return identity;
463
- }
464
- if (fns.length === 1) {
465
- return fns[0];
466
- }
467
- return function piped(input) {
468
- return fns.reduce(function (prev, fn) { return fn(prev); }, input);
469
- };
470
- }
471
- var Observable = /** @class */ (function () {
472
- function Observable(subscribe) {
473
- this._isScalar = false;
474
- if (subscribe) {
475
- this._subscribe = subscribe;
476
- }
477
- }
478
- Observable.prototype.lift = function (operator) {
479
- var observable = new Observable();
480
- observable.source = this;
481
- observable.operator = operator;
482
- return observable;
483
- };
484
- Observable.prototype.subscribe = function (observerOrNext, error, complete) {
485
- var operator = this.operator;
486
- var sink = toSubscriber(observerOrNext, error, complete);
487
- if (operator) {
488
- sink.add(operator.call(sink, this.source));
489
- }
490
- else {
491
- sink.add(this.source || (config.useDeprecatedSynchronousErrorHandling && !sink.syncErrorThrowable) ?
492
- this._subscribe(sink) :
493
- this._trySubscribe(sink));
494
- }
495
- if (config.useDeprecatedSynchronousErrorHandling) {
496
- if (sink.syncErrorThrowable) {
497
- sink.syncErrorThrowable = false;
498
- if (sink.syncErrorThrown) {
499
- throw sink.syncErrorValue;
268
+ // avoid smooth behavior if not required
269
+ if (shouldBailOut(arguments[0]) === true) {
270
+ // if one number is passed, throw error to match Firefox implementation
271
+ if (typeof arguments[0] === 'number' && arguments[1] === undefined) {
272
+ throw new SyntaxError('Value could not be converted');
273
+ }
274
+ original.elementScroll.call(this,
275
+ // use left prop, first number argument or fallback to scrollLeft
276
+ arguments[0].left !== undefined
277
+ ? ~~arguments[0].left
278
+ : typeof arguments[0] !== 'object' ? ~~arguments[0] : this.scrollLeft,
279
+ // use top prop, second argument or fallback to scrollTop
280
+ arguments[0].top !== undefined
281
+ ? ~~arguments[0].top
282
+ : arguments[1] !== undefined ? ~~arguments[1] : this.scrollTop);
283
+ return;
500
284
  }
501
- }
502
- }
503
- return sink;
504
- };
505
- Observable.prototype._trySubscribe = function (sink) {
506
- try {
507
- return this._subscribe(sink);
508
- }
509
- catch (err) {
510
- if (config.useDeprecatedSynchronousErrorHandling) {
511
- sink.syncErrorThrown = true;
512
- sink.syncErrorValue = err;
513
- }
514
- if (canReportError(sink)) {
515
- sink.error(err);
516
- }
517
- else {
518
- console.warn(err);
519
- }
520
- }
521
- };
522
- Observable.prototype.forEach = function (next, promiseCtor) {
523
- var _this = this;
524
- promiseCtor = getPromiseCtor(promiseCtor);
525
- return new promiseCtor(function (resolve, reject) {
526
- var subscription;
527
- subscription = _this.subscribe(function (value) {
528
- try {
529
- next(value);
285
+ var left = arguments[0].left;
286
+ var top = arguments[0].top;
287
+ // LET THE SMOOTHNESS BEGIN!
288
+ smoothScroll.call(this, this, typeof left === 'undefined' ? this.scrollLeft : ~~left, typeof top === 'undefined' ? this.scrollTop : ~~top);
289
+ };
290
+ // Element.prototype.scrollBy
291
+ Element.prototype.scrollBy = function () {
292
+ // avoid action when no arguments are passed
293
+ if (arguments[0] === undefined) {
294
+ return;
295
+ }
296
+ // avoid smooth behavior if not required
297
+ if (shouldBailOut(arguments[0]) === true) {
298
+ original.elementScroll.call(this, arguments[0].left !== undefined
299
+ ? ~~arguments[0].left + this.scrollLeft
300
+ : ~~arguments[0] + this.scrollLeft, arguments[0].top !== undefined
301
+ ? ~~arguments[0].top + this.scrollTop
302
+ : ~~arguments[1] + this.scrollTop);
303
+ return;
530
304
  }
531
- catch (err) {
532
- reject(err);
533
- if (subscription) {
534
- subscription.unsubscribe();
305
+ this.scroll({
306
+ left: ~~arguments[0].left + this.scrollLeft,
307
+ top: ~~arguments[0].top + this.scrollTop,
308
+ behavior: arguments[0].behavior
309
+ });
310
+ };
311
+ // Element.prototype.scrollIntoView
312
+ Element.prototype.scrollIntoView = function () {
313
+ // avoid smooth behavior if not required
314
+ if (shouldBailOut(arguments[0]) === true) {
315
+ original.scrollIntoView.call(this, arguments[0] === undefined ? true : arguments[0]);
316
+ return;
317
+ }
318
+ // LET THE SMOOTHNESS BEGIN!
319
+ var scrollableParent = findScrollableParent(this);
320
+ var parentRects = scrollableParent.getBoundingClientRect();
321
+ var clientRects = this.getBoundingClientRect();
322
+ if (scrollableParent !== d.body) {
323
+ // reveal element inside parent
324
+ smoothScroll.call(this, scrollableParent, scrollableParent.scrollLeft + clientRects.left - parentRects.left, scrollableParent.scrollTop + clientRects.top - parentRects.top);
325
+ // reveal parent in viewport unless is fixed
326
+ if (w.getComputedStyle(scrollableParent).position !== 'fixed') {
327
+ w.scrollBy({
328
+ left: parentRects.left,
329
+ top: parentRects.top,
330
+ behavior: 'smooth'
331
+ });
535
332
  }
536
333
  }
537
- }, reject, resolve);
538
- });
539
- };
540
- Observable.prototype._subscribe = function (subscriber) {
541
- var source = this.source;
542
- return source && source.subscribe(subscriber);
543
- };
544
- Observable.prototype[observable] = function () {
545
- return this;
546
- };
547
- Observable.prototype.pipe = function () {
548
- var operations = [];
549
- for (var _i = 0; _i < arguments.length; _i++) {
550
- operations[_i] = arguments[_i];
551
- }
552
- if (operations.length === 0) {
553
- return this;
554
- }
555
- return pipeFromArray(operations)(this);
556
- };
557
- Observable.prototype.toPromise = function (promiseCtor) {
558
- var _this = this;
559
- promiseCtor = getPromiseCtor(promiseCtor);
560
- return new promiseCtor(function (resolve, reject) {
561
- var value;
562
- _this.subscribe(function (x) { return value = x; }, function (err) { return reject(err); }, function () { return resolve(value); });
563
- });
564
- };
565
- return Observable;
566
- }());
567
- Observable.create = function (subscribe) {
568
- return new Observable(subscribe);
569
- };
570
- function getPromiseCtor(promiseCtor) {
571
- if (!promiseCtor) {
572
- promiseCtor = Promise;
573
- }
574
- if (!promiseCtor) {
575
- throw new Error('no Promise impl found');
576
- }
577
- return promiseCtor;
578
- }
579
- var Action = /** @class */ (function (_super) {
580
- __extends(Action, _super);
581
- function Action(scheduler, work) {
582
- return _super.call(this) || this;
583
- }
584
- Action.prototype.schedule = function (state, delay) {
585
- if (delay === void 0) { delay = 0; }
586
- return this;
587
- };
588
- return Action;
589
- }(Subscription));
590
- var AsyncAction = /** @class */ (function (_super) {
591
- __extends(AsyncAction, _super);
592
- function AsyncAction(scheduler, work) {
593
- var _this = _super.call(this, scheduler, work) || this;
594
- _this.scheduler = scheduler;
595
- _this.work = work;
596
- _this.pending = false;
597
- return _this;
598
- }
599
- AsyncAction.prototype.schedule = function (state, delay) {
600
- if (delay === void 0) { delay = 0; }
601
- if (this.closed) {
602
- return this;
603
- }
604
- this.state = state;
605
- var id = this.id;
606
- var scheduler = this.scheduler;
607
- if (id != null) {
608
- this.id = this.recycleAsyncId(scheduler, id, delay);
609
- }
610
- this.pending = true;
611
- this.delay = delay;
612
- this.id = this.id || this.requestAsyncId(scheduler, this.id, delay);
613
- return this;
614
- };
615
- AsyncAction.prototype.requestAsyncId = function (scheduler, id, delay) {
616
- if (delay === void 0) { delay = 0; }
617
- return setInterval(scheduler.flush.bind(scheduler, this), delay);
618
- };
619
- AsyncAction.prototype.recycleAsyncId = function (scheduler, id, delay) {
620
- if (delay === void 0) { delay = 0; }
621
- if (delay !== null && this.delay === delay && this.pending === false) {
622
- return id;
623
- }
624
- clearInterval(id);
625
- return undefined;
626
- };
627
- AsyncAction.prototype.execute = function (state, delay) {
628
- if (this.closed) {
629
- return new Error('executing a cancelled action');
630
- }
631
- this.pending = false;
632
- var error = this._execute(state, delay);
633
- if (error) {
634
- return error;
635
- }
636
- else if (this.pending === false && this.id != null) {
637
- this.id = this.recycleAsyncId(this.scheduler, this.id, null);
638
- }
639
- };
640
- AsyncAction.prototype._execute = function (state, delay) {
641
- var errored = false;
642
- var errorValue = undefined;
643
- try {
644
- this.work(state);
645
- }
646
- catch (e) {
647
- errored = true;
648
- errorValue = !!e && e || new Error(e);
649
- }
650
- if (errored) {
651
- this.unsubscribe();
652
- return errorValue;
653
- }
654
- };
655
- AsyncAction.prototype._unsubscribe = function () {
656
- var id = this.id;
657
- var scheduler = this.scheduler;
658
- var actions = scheduler.actions;
659
- var index = actions.indexOf(this);
660
- this.work = null;
661
- this.state = null;
662
- this.pending = false;
663
- this.scheduler = null;
664
- if (index !== -1) {
665
- actions.splice(index, 1);
666
- }
667
- if (id != null) {
668
- this.id = this.recycleAsyncId(scheduler, id, null);
669
- }
670
- this.delay = null;
671
- };
672
- return AsyncAction;
673
- }(Action));
674
- var Scheduler = /** @class */ (function () {
675
- function Scheduler(SchedulerAction, now) {
676
- if (now === void 0) { now = Scheduler.now; }
677
- this.SchedulerAction = SchedulerAction;
678
- this.now = now;
679
- }
680
- Scheduler.prototype.schedule = function (work, delay, state) {
681
- if (delay === void 0) { delay = 0; }
682
- return new this.SchedulerAction(this, work).schedule(state, delay);
683
- };
684
- return Scheduler;
685
- }());
686
- Scheduler.now = function () { return Date.now(); };
687
- var AsyncScheduler = /** @class */ (function (_super) {
688
- __extends(AsyncScheduler, _super);
689
- function AsyncScheduler(SchedulerAction, now) {
690
- if (now === void 0) { now = Scheduler.now; }
691
- var _this = _super.call(this, SchedulerAction, function () {
692
- if (AsyncScheduler.delegate && AsyncScheduler.delegate !== _this) {
693
- return AsyncScheduler.delegate.now();
694
- }
695
- else {
696
- return now();
697
- }
698
- }) || this;
699
- _this.actions = [];
700
- _this.active = false;
701
- _this.scheduled = undefined;
702
- return _this;
703
- }
704
- AsyncScheduler.prototype.schedule = function (work, delay, state) {
705
- if (delay === void 0) { delay = 0; }
706
- if (AsyncScheduler.delegate && AsyncScheduler.delegate !== this) {
707
- return AsyncScheduler.delegate.schedule(work, delay, state);
708
- }
709
- else {
710
- return _super.prototype.schedule.call(this, work, delay, state);
711
- }
712
- };
713
- AsyncScheduler.prototype.flush = function (action) {
714
- var actions = this.actions;
715
- if (this.active) {
716
- actions.push(action);
717
- return;
718
- }
719
- var error;
720
- this.active = true;
721
- do {
722
- if (error = action.execute(action.state, action.delay)) {
723
- break;
724
- }
725
- } while (action = actions.shift());
726
- this.active = false;
727
- if (error) {
728
- while (action = actions.shift()) {
729
- action.unsubscribe();
730
- }
731
- throw error;
732
- }
733
- };
734
- return AsyncScheduler;
735
- }(Scheduler));
736
- var subscribeToArray = function (array) { return function (subscriber) {
737
- for (var i = 0, len = array.length; i < len && !subscriber.closed; i++) {
738
- subscriber.next(array[i]);
739
- }
740
- subscriber.complete();
741
- }; };
742
- var asyncScheduler = new AsyncScheduler(AsyncAction);
743
- var async = asyncScheduler;
744
- function map(project, thisArg) {
745
- return function mapOperation(source) {
746
- if (typeof project !== 'function') {
747
- throw new TypeError('argument is not a function. Are you looking for `mapTo()`?');
748
- }
749
- return source.lift(new MapOperator(project, thisArg));
750
- };
751
- }
752
- var MapOperator = /** @class */ (function () {
753
- function MapOperator(project, thisArg) {
754
- this.project = project;
755
- this.thisArg = thisArg;
756
- }
757
- MapOperator.prototype.call = function (subscriber, source) {
758
- return source.subscribe(new MapSubscriber(subscriber, this.project, this.thisArg));
759
- };
760
- return MapOperator;
761
- }());
762
- var MapSubscriber = /** @class */ (function (_super) {
763
- __extends(MapSubscriber, _super);
764
- function MapSubscriber(destination, project, thisArg) {
765
- var _this = _super.call(this, destination) || this;
766
- _this.project = project;
767
- _this.count = 0;
768
- _this.thisArg = thisArg || _this;
769
- return _this;
770
- }
771
- MapSubscriber.prototype._next = function (value) {
772
- var result;
773
- try {
774
- result = this.project.call(this.thisArg, value, this.count++);
775
- }
776
- catch (err) {
777
- this.destination.error(err);
778
- return;
779
- }
780
- this.destination.next(result);
781
- };
782
- return MapSubscriber;
783
- }(Subscriber));
784
- var subscribeToPromise = function (promise) { return function (subscriber) {
785
- promise.then(function (value) {
786
- if (!subscriber.closed) {
787
- subscriber.next(value);
788
- subscriber.complete();
789
- }
790
- }, function (err) { return subscriber.error(err); })
791
- .then(null, hostReportError);
792
- return subscriber;
793
- }; };
794
- function getSymbolIterator() {
795
- if (typeof Symbol !== 'function' || !Symbol.iterator) {
796
- return '@@iterator';
797
- }
798
- return Symbol.iterator;
799
- }
800
- var iterator = getSymbolIterator();
801
- var subscribeToIterable = function (iterable) { return function (subscriber) {
802
- var iterator$1 = iterable[iterator]();
803
- do {
804
- var item = void 0;
805
- try {
806
- item = iterator$1.next();
807
- }
808
- catch (err) {
809
- subscriber.error(err);
810
- return subscriber;
811
- }
812
- if (item.done) {
813
- subscriber.complete();
814
- break;
815
- }
816
- subscriber.next(item.value);
817
- if (subscriber.closed) {
818
- break;
819
- }
820
- } while (true);
821
- if (typeof iterator$1.return === 'function') {
822
- subscriber.add(function () {
823
- if (iterator$1.return) {
824
- iterator$1.return();
825
- }
826
- });
827
- }
828
- return subscriber;
829
- }; };
830
- var subscribeToObservable = function (obj) { return function (subscriber) {
831
- var obs = obj[observable]();
832
- if (typeof obs.subscribe !== 'function') {
833
- throw new TypeError('Provided object does not correctly implement Symbol.observable');
834
- }
835
- else {
836
- return obs.subscribe(subscriber);
837
- }
838
- }; };
839
- var isArrayLike = (function (x) { return x && typeof x.length === 'number' && typeof x !== 'function'; });
840
- function isPromise(value) {
841
- return !!value && typeof value.subscribe !== 'function' && typeof value.then === 'function';
842
- }
843
- var subscribeTo = function (result) {
844
- if (!!result && typeof result[observable] === 'function') {
845
- return subscribeToObservable(result);
846
- }
847
- else if (isArrayLike(result)) {
848
- return subscribeToArray(result);
849
- }
850
- else if (isPromise(result)) {
851
- return subscribeToPromise(result);
852
- }
853
- else if (!!result && typeof result[iterator] === 'function') {
854
- return subscribeToIterable(result);
855
- }
856
- else {
857
- var value = isObject(result) ? 'an invalid object' : "'" + result + "'";
858
- var msg = "You provided " + value + " where a stream was expected."
859
- + ' You can provide an Observable, Promise, Array, or Iterable.';
860
- throw new TypeError(msg);
861
- }
862
- };
863
- var SimpleInnerSubscriber = /** @class */ (function (_super) {
864
- __extends(SimpleInnerSubscriber, _super);
865
- function SimpleInnerSubscriber(parent) {
866
- var _this = _super.call(this) || this;
867
- _this.parent = parent;
868
- return _this;
869
- }
870
- SimpleInnerSubscriber.prototype._next = function (value) {
871
- this.parent.notifyNext(value);
872
- };
873
- SimpleInnerSubscriber.prototype._error = function (error) {
874
- this.parent.notifyError(error);
875
- this.unsubscribe();
876
- };
877
- SimpleInnerSubscriber.prototype._complete = function () {
878
- this.parent.notifyComplete();
879
- this.unsubscribe();
880
- };
881
- return SimpleInnerSubscriber;
882
- }(Subscriber));
883
- var SimpleOuterSubscriber = /** @class */ (function (_super) {
884
- __extends(SimpleOuterSubscriber, _super);
885
- function SimpleOuterSubscriber() {
886
- return _super !== null && _super.apply(this, arguments) || this;
887
- }
888
- SimpleOuterSubscriber.prototype.notifyNext = function (innerValue) {
889
- this.destination.next(innerValue);
890
- };
891
- SimpleOuterSubscriber.prototype.notifyError = function (err) {
892
- this.destination.error(err);
893
- };
894
- SimpleOuterSubscriber.prototype.notifyComplete = function () {
895
- this.destination.complete();
896
- };
897
- return SimpleOuterSubscriber;
898
- }(Subscriber));
899
- function innerSubscribe(result, innerSubscriber) {
900
- if (innerSubscriber.closed) {
901
- return undefined;
902
- }
903
- if (result instanceof Observable) {
904
- return result.subscribe(innerSubscriber);
905
- }
906
- return subscribeTo(result)(innerSubscriber);
907
- }
908
- function fromEvent(target, eventName, options, resultSelector) {
909
- if (isFunction(options)) {
910
- resultSelector = options;
911
- options = undefined;
912
- }
913
- if (resultSelector) {
914
- return fromEvent(target, eventName, options).pipe(map(function (args) { return isArray(args) ? resultSelector.apply(void 0, args) : resultSelector(args); }));
915
- }
916
- return new Observable(function (subscriber) {
917
- function handler(e) {
918
- if (arguments.length > 1) {
919
- subscriber.next(Array.prototype.slice.call(arguments));
920
- }
921
- else {
922
- subscriber.next(e);
923
- }
924
- }
925
- setupSubscription(target, eventName, handler, subscriber, options);
926
- });
927
- }
928
- function setupSubscription(sourceObj, eventName, handler, subscriber, options) {
929
- var unsubscribe;
930
- if (isEventTarget(sourceObj)) {
931
- var source_1 = sourceObj;
932
- sourceObj.addEventListener(eventName, handler, options);
933
- unsubscribe = function () { return source_1.removeEventListener(eventName, handler, options); };
934
- }
935
- else if (isJQueryStyleEventEmitter(sourceObj)) {
936
- var source_2 = sourceObj;
937
- sourceObj.on(eventName, handler);
938
- unsubscribe = function () { return source_2.off(eventName, handler); };
939
- }
940
- else if (isNodeStyleEventEmitter(sourceObj)) {
941
- var source_3 = sourceObj;
942
- sourceObj.addListener(eventName, handler);
943
- unsubscribe = function () { return source_3.removeListener(eventName, handler); };
944
- }
945
- else if (sourceObj && sourceObj.length) {
946
- for (var i = 0, len = sourceObj.length; i < len; i++) {
947
- setupSubscription(sourceObj[i], eventName, handler, subscriber, options);
334
+ else {
335
+ // reveal element in viewport
336
+ w.scrollBy({
337
+ left: clientRects.left,
338
+ top: clientRects.top,
339
+ behavior: 'smooth'
340
+ });
341
+ }
342
+ };
948
343
  }
949
- }
950
- else {
951
- throw new TypeError('Invalid event target');
952
- }
953
- subscriber.add(unsubscribe);
954
- }
955
- function isNodeStyleEventEmitter(sourceObj) {
956
- return sourceObj && typeof sourceObj.addListener === 'function' && typeof sourceObj.removeListener === 'function';
344
+ {
345
+ // commonjs
346
+ module.exports = { polyfill: polyfill };
347
+ }
348
+ }());
349
+ });
350
+ var stylesCss = "*{-webkit-box-sizing:border-box;box-sizing:border-box}*:active{outline:none}*:focus{outline:none;-webkit-box-shadow:var(--const-global-focus);box-shadow:var(--const-global-focus)}:host{-webkit-box-shadow:none !important;box-shadow:none !important}::-moz-focus-inner{border:none}input,button{font-family:inherit;font-size:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}.tab-container{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.tab-list{padding:0;display:-ms-flexbox;display:flex;margin:0;list-style:none;border-bottom:1px solid\n var(--tct-tab-container-border-color, var(--tct-gray-l1, var(--app-gray-l1, #cccccc)));white-space:nowrap;overflow-x:hidden;-ms-flex-align:center;align-items:center}.tab-list li.nav{position:absolute;height:44px;width:46px}.tab-list li.nav-left{left:-15px;background:-webkit-gradient(linear, left top, right top, color-stop(60%, var(--tct-section-bg, var(--t-section-bg, #ffffff))), to(rgba(255,255,255,0)));background:linear-gradient(to right, var(--tct-section-bg, var(--t-section-bg, #ffffff)) 60%, rgba(255,255,255,0))}.tab-list li.nav-right{right:-15px;background:-webkit-gradient(linear, right top, left top, color-stop(60%, var(--tct-section-bg, var(--t-section-bg, #ffffff))), to(rgba(255,255,255,0)));background:linear-gradient(to left, var(--tct-section-bg, var(--t-section-bg, #ffffff)) 60%, rgba(255,255,255,0))}.tab-list li.nav .arrow-container{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;height:inherit;width:inherit;cursor:pointer}.tab-list li.nav .arrow-container a{padding:0;margin:0;height:inherit;width:inherit;border-bottom:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}.tab-list li.nav .arrow-container a q2-icon{width:19px;height:19px}.tab-list a{width:var(--tct-tab-hover-width, var(--t-tab-hover-width, 100%));text-align:center;text-decoration:none;padding:var(--tct-scale-2, var(--app-scale-2, 10px));margin:var(--tct-scale-1, var(--app-scale-1, 5px)) var(--tct-scale-1, var(--app-scale-1, 5px))\n 0;color:var(--tct-tab-inactive-color, var(--t-tab-inactive, inherit));font-size:var(--tct-tab-font-size, var(--t-tab-font-size, 17px));border-bottom:3px solid transparent;display:block;-webkit-transition:color var(--tct-tween-2, var(--app-tween-2, 0.4s ease)),\n border-color var(--tct-tween-1, var(--app-tween-1, 0.2s ease));transition:color var(--tct-tween-2, var(--app-tween-2, 0.4s ease)),\n border-color var(--tct-tween-1, var(--app-tween-1, 0.2s ease))}:host([type='section']) .tab-list a{font-size:inherit;padding:var(--tct-scale-2, var(--app-scale-2, 10px))\n var(--tct-scale-1, var(--app-scale-1, 5px))}@media screen and (max-width: 767px){.tab-list a{font-size:inherit;padding:var(--tct-scale-2, var(--app-scale-2, 10px))\n var(--tct-scale-1, var(--app-scale-1, 5px))}}.tab-list a:hover{color:var(--tct-tab-active-color, var(--t-tab-active, #2e2e2e));background-color:var(--tct-tab-hover-bg-color, var(--t-tab-hover-bg-color, inherit));width:var(--tct-tab-hover-width, var(--t-tab-hover-width, 100%))}.tab-list a[aria-selected='true']{color:var(--tct-tab-active-color, var(--t-tab-active, #2e2e2e));border-color:currentColor;width:var(--tct-tab-active-width, var(--t-tab-active-width, 100%));background-color:var(--tct-tab-active-bg-color, var(--t-tab-active-bg-color, inherit))}:host([color='alt']) .tab-list a{color:var(--tct-tab-alt-inactive-color, var(--t-tab-alt-inactive, inherit))}:host([color='alt']) .tab-list a:hover,:host([color='alt']) .tab-list a[aria-selected='true']{color:var(--tct-tab-alt-active-color, var(--t-tab-alt-active, inherit))}.tab-content{padding:var(--tct-scale-2, var(--app-scale-2, 10px)) 0}";
351
+ // enable scroll animation polyfill only on safari
352
+ var userAgent = navigator.userAgent.toLowerCase();
353
+ var isSafari = userAgent.includes('safari') && !userAgent.includes('chrome');
354
+ var isFirefox = userAgent.includes('firefox');
355
+ if (isSafari) {
356
+ // smooth scroll is not supported on safari
357
+ smoothscroll.polyfill();
358
+ window['__forceSmoothScrollPolyfill__'] = true;
957
359
  }
958
- function isJQueryStyleEventEmitter(sourceObj) {
959
- return sourceObj && typeof sourceObj.on === 'function' && typeof sourceObj.off === 'function';
960
- }
961
- function isEventTarget(sourceObj) {
962
- return sourceObj && typeof sourceObj.addEventListener === 'function' && typeof sourceObj.removeEventListener === 'function';
963
- }
964
- function isNumeric(val) {
965
- return !isArray(val) && (val - parseFloat(val) + 1) >= 0;
966
- }
967
- function interval(period, scheduler) {
968
- if (period === void 0) { period = 0; }
969
- if (scheduler === void 0) { scheduler = async; }
970
- if (!isNumeric(period) || period < 0) {
971
- period = 0;
972
- }
973
- if (!scheduler || typeof scheduler.schedule !== 'function') {
974
- scheduler = async;
975
- }
976
- return new Observable(function (subscriber) {
977
- subscriber.add(scheduler.schedule(dispatch, period, { subscriber: subscriber, counter: 0, period: period }));
978
- return subscriber;
979
- });
980
- }
981
- function dispatch(state) {
982
- var subscriber = state.subscriber, counter = state.counter, period = state.period;
983
- subscriber.next(counter);
984
- this.schedule({ subscriber: subscriber, counter: counter + 1, period: period }, period);
985
- }
986
- function debounce(durationSelector) {
987
- return function (source) { return source.lift(new DebounceOperator(durationSelector)); };
988
- }
989
- var DebounceOperator = /** @class */ (function () {
990
- function DebounceOperator(durationSelector) {
991
- this.durationSelector = durationSelector;
992
- }
993
- DebounceOperator.prototype.call = function (subscriber, source) {
994
- return source.subscribe(new DebounceSubscriber(subscriber, this.durationSelector));
995
- };
996
- return DebounceOperator;
997
- }());
998
- var DebounceSubscriber = /** @class */ (function (_super) {
999
- __extends(DebounceSubscriber, _super);
1000
- function DebounceSubscriber(destination, durationSelector) {
1001
- var _this = _super.call(this, destination) || this;
1002
- _this.durationSelector = durationSelector;
1003
- _this.hasValue = false;
1004
- return _this;
1005
- }
1006
- DebounceSubscriber.prototype._next = function (value) {
1007
- try {
1008
- var result = this.durationSelector.call(this, value);
1009
- if (result) {
1010
- this._tryNext(value, result);
1011
- }
1012
- }
1013
- catch (err) {
1014
- this.destination.error(err);
1015
- }
1016
- };
1017
- DebounceSubscriber.prototype._complete = function () {
1018
- this.emitValue();
1019
- this.destination.complete();
1020
- };
1021
- DebounceSubscriber.prototype._tryNext = function (value, duration) {
1022
- var subscription = this.durationSubscription;
1023
- this.value = value;
1024
- this.hasValue = true;
1025
- if (subscription) {
1026
- subscription.unsubscribe();
1027
- this.remove(subscription);
1028
- }
1029
- subscription = innerSubscribe(duration, new SimpleInnerSubscriber(this));
1030
- if (subscription && !subscription.closed) {
1031
- this.add(this.durationSubscription = subscription);
1032
- }
1033
- };
1034
- DebounceSubscriber.prototype.notifyNext = function () {
1035
- this.emitValue();
1036
- };
1037
- DebounceSubscriber.prototype.notifyComplete = function () {
1038
- this.emitValue();
1039
- };
1040
- DebounceSubscriber.prototype.emitValue = function () {
1041
- if (this.hasValue) {
1042
- var value = this.value;
1043
- var subscription = this.durationSubscription;
1044
- if (subscription) {
1045
- this.durationSubscription = undefined;
1046
- subscription.unsubscribe();
1047
- this.remove(subscription);
1048
- }
1049
- this.value = undefined;
1050
- this.hasValue = false;
1051
- _super.prototype._next.call(this, value);
1052
- }
1053
- };
1054
- return DebounceSubscriber;
1055
- }(SimpleOuterSubscriber));
1056
- var stylesCss = "*{-webkit-box-sizing:border-box;box-sizing:border-box}*:active{outline:none}*:focus{outline:none;-webkit-box-shadow:var(--const-global-focus);box-shadow:var(--const-global-focus)}:host{-webkit-box-shadow:none !important;box-shadow:none !important}::-moz-focus-inner{border:none}input,button{font-family:inherit;font-size:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}.tab-container{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.tab-list{padding:0;display:-ms-flexbox;display:flex;margin:0;list-style:none;border-bottom:1px solid\n var(--tct-tab-container-border-color, var(--tct-gray-l1, var(--app-gray-l1, #cccccc)));white-space:nowrap;overflow-x:hidden;-ms-flex-align:center;align-items:center}.tab-list li.nav{position:absolute;height:44px;width:46px}.tab-list li.nav-left{left:-15px;background:-webkit-gradient(linear, left top, right top, color-stop(60%, var(--tct-section-bg, var(--t-section-bg, #ffffff))), to(transparent));background:linear-gradient(to right, var(--tct-section-bg, var(--t-section-bg, #ffffff)) 60%, transparent)}.tab-list li.nav-right{right:-15px;background:-webkit-gradient(linear, right top, left top, color-stop(60%, var(--tct-section-bg, var(--t-section-bg, #ffffff))), to(transparent));background:linear-gradient(to left, var(--tct-section-bg, var(--t-section-bg, #ffffff)) 60%, transparent)}.tab-list li.nav .arrow-container{display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;height:inherit;width:inherit;cursor:pointer}.tab-list li.nav .arrow-container a{padding:0;margin:0;height:inherit;width:inherit;border-bottom:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}.tab-list li.nav .arrow-container a q2-icon{width:19px;height:19px}.tab-list a{text-decoration:none;padding:var(--tct-scale-2, var(--app-scale-2, 10px));margin:var(--tct-scale-1, var(--app-scale-1, 5px)) var(--tct-scale-1, var(--app-scale-1, 5px))\n 0;color:var(--tct-tab-inactive-color, var(--t-tab-inactive, inherit));font-size:var(--tct-tab-font-size, var(--t-tab-font-size, 17px));border-bottom:3px solid transparent;display:block;-webkit-transition:color var(--tct-tween-2, var(--app-tween-2, 0.4s ease)),\n border-color var(--tct-tween-1, var(--app-tween-1, 0.2s ease));transition:color var(--tct-tween-2, var(--app-tween-2, 0.4s ease)),\n border-color var(--tct-tween-1, var(--app-tween-1, 0.2s ease))}:host([type='section']) .tab-list a{font-size:inherit;padding:var(--tct-scale-2, var(--app-scale-2, 10px))\n var(--tct-scale-1, var(--app-scale-1, 5px))}@media screen and (max-width: 767px){.tab-list a{font-size:inherit;padding:var(--tct-scale-2, var(--app-scale-2, 10px))\n var(--tct-scale-1, var(--app-scale-1, 5px))}}.tab-list a:hover{color:var(--tct-tab-active-color, var(--t-tab-active, #2e2e2e));background-color:var(--tct-tab-hover-bg-color, var(--t-tab-hover-bg-color, inherit));width:var(--tct-tab-hover-width, var(--t-tab-hover-width, 100%))}.tab-list a[aria-selected='true']{color:var(--tct-tab-active-color, var(--t-tab-active, #2e2e2e));border-color:currentColor;width:var(--tct-tab-active-width, var(--t-tab-active-width, 100%));background-color:var(--tct-tab-active-bg-color, var(--t-tab-active-bg-color, inherit))}:host([color='alt']) .tab-list a{color:var(--tct-tab-alt-inactive-color, var(--t-tab-alt-inactive, inherit))}:host([color='alt']) .tab-list a:hover,:host([color='alt']) .tab-list a[aria-selected='true']{color:var(--tct-tab-alt-active-color, var(--t-tab-alt-active, inherit))}.tab-content{padding:var(--tct-scale-2, var(--app-scale-2, 10px)) 0}";
1057
360
  var Q2TabContainer = /** @class */ (function () {
1058
361
  function Q2TabContainer(hostRef) {
1059
362
  var _this = this;
@@ -1062,16 +365,9 @@ var Q2TabContainer = /** @class */ (function () {
1062
365
  this.settled = createEvent(this, "settled", 7);
1063
366
  this.guid = createGuid();
1064
367
  this.scheduledAfterRender = [];
368
+ this.lastScrolled = new Date(null).getTime();
1065
369
  this.hasLeft = false;
1066
370
  this.hasRight = false;
1067
- this.initTabScroll = function () {
1068
- var tabList = _this.hostElement.shadowRoot.querySelector('.tab-list');
1069
- if (tabList) {
1070
- var scrollWidth = tabList.scrollWidth, clientWidth = tabList.clientWidth, scrollLeft = tabList.scrollLeft;
1071
- _this.hasLeft = scrollLeft > 0;
1072
- _this.hasRight = scrollWidth > clientWidth;
1073
- }
1074
- };
1075
371
  ///////// Actions /////////
1076
372
  this.updateTabData = function () {
1077
373
  _this.updateTabPaneProps();
@@ -1108,38 +404,81 @@ var Q2TabContainer = /** @class */ (function () {
1108
404
  _this.moveToAdjacentTab(value, 'prev');
1109
405
  return;
1110
406
  }
407
+ if (event.code === 'Space' || event.code === 'Enter') {
408
+ // to prevent triggering scroll when press the space key
409
+ event.preventDefault();
410
+ _this.change.emit({ value: value });
411
+ return;
412
+ }
1111
413
  };
1112
414
  this.moveToAdjacentTab = function (value, direction) {
1113
415
  var index = _this.tabs.map(function (_a) {
1114
416
  var value = _a.value;
1115
417
  return value;
1116
418
  }).indexOf(value);
1117
- var indexUpdated = false;
1118
- if (direction === 'next' && index !== _this.tabs.length - 1) {
1119
- index = index + 1;
1120
- indexUpdated = true;
1121
- }
1122
- if (direction === 'prev' && index !== 0) {
1123
- index = index - 1;
1124
- indexUpdated = true;
419
+ var newIndex = direction === 'next'
420
+ ? Math.min(index + 1, _this.tabs.length - 1)
421
+ : Math.max(index - 1, 0);
422
+ if (index !== newIndex) {
423
+ var focusedTab = _this.moveFocus(newIndex);
424
+ // Scroll only if it overflows
425
+ if (_this.tabList.scrollWidth > _this.tabList.clientWidth) {
426
+ // Scroll only if it's first or last tab
427
+ if (newIndex !== 0 && newIndex !== _this.tabs.length - 1) {
428
+ _this.scrollByKeyboard(direction, focusedTab);
429
+ }
430
+ else {
431
+ // first or last element: just show or hide nav arrow
432
+ _this.onTabScroll(direction);
433
+ }
434
+ }
1125
435
  }
1126
- if (indexUpdated) {
1127
- var value_1 = _this.tabs[index].value;
1128
- _this.hostElement.shadowRoot
1129
- .querySelector(".tab-list a[data-value=\"" + value_1 + "\"]")
1130
- .focus();
1131
- _this.change.emit({ value: value_1 });
436
+ };
437
+ this.moveFocus = function (index) {
438
+ var focusedValue = _this.tabs[index].value;
439
+ var focusedTab = _this.hostElement.shadowRoot.querySelector(".tab-list a[data-value=\"" + focusedValue + "\"]");
440
+ focusedTab.focus({ preventScroll: true });
441
+ return focusedTab;
442
+ };
443
+ this.calculateKeyboardScroll = function (direction, focusedTab) {
444
+ var tabListLeft = _this.tabList.getBoundingClientRect().left;
445
+ var focusedTabLeft = focusedTab.getBoundingClientRect().left;
446
+ var arrowWidth = 46;
447
+ var scrollAmount = 0;
448
+ // check how much focused tab overflows
449
+ if (direction === 'next' &&
450
+ focusedTabLeft + focusedTab.clientWidth >
451
+ tabListLeft + _this.tabList.clientWidth + arrowWidth) {
452
+ scrollAmount =
453
+ _this.tabList.scrollLeft +
454
+ arrowWidth +
455
+ (focusedTabLeft + focusedTab.clientWidth) -
456
+ (tabListLeft + _this.tabList.clientWidth);
457
+ }
458
+ else if (direction === 'prev' && focusedTabLeft + arrowWidth < tabListLeft) {
459
+ scrollAmount = _this.tabList.scrollLeft - arrowWidth + (focusedTabLeft - tabListLeft);
460
+ }
461
+ return scrollAmount;
462
+ };
463
+ this.scrollByKeyboard = function (direction, focusedTab) {
464
+ var scrollAmount = _this.calculateKeyboardScroll(direction, focusedTab);
465
+ if (scrollAmount !== 0) {
466
+ _this.tabList.scroll({ left: scrollAmount, behavior: 'smooth' });
467
+ // wait to finish scroll then show or hide nav arrow
468
+ setTimeout(function () { return _this.onTabScroll(); }, 100);
1132
469
  }
1133
470
  };
1134
471
  this.calculateTabScroll = function (_a) {
1135
472
  var direction = _a.direction, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth, scrollLeft = _a.scrollLeft;
473
+ var directions = { prev: -1, next: 1 };
474
+ // step 0 means no scroll needed, re-render or resize can trigger this
475
+ var step = directions[direction] || 0;
1136
476
  var scrollRate = 0.5; // half of visual width
1137
- var step = direction === 'left' ? -1 : 1;
1138
477
  var delta = Math.round(clientWidth * scrollRate);
1139
478
  var newScrollLeft = scrollLeft + step * delta;
1140
479
  var scrolled = clientWidth + newScrollLeft;
1141
480
  var hasLeft = newScrollLeft > 0;
1142
- var hasRight = scrollWidth >= scrolled;
481
+ var hasRight = scrollWidth > scrolled;
1143
482
  return {
1144
483
  newScrollLeft: newScrollLeft,
1145
484
  hasLeft: hasLeft,
@@ -1147,17 +486,25 @@ var Q2TabContainer = /** @class */ (function () {
1147
486
  };
1148
487
  };
1149
488
  this.onTabScroll = function (direction) {
1150
- var tabList = _this.hostElement.shadowRoot.querySelector('.tab-list');
1151
- var scrollWidth = tabList.scrollWidth, clientWidth = tabList.clientWidth, scrollLeft = tabList.scrollLeft;
1152
- var _a = _this.calculateTabScroll({
489
+ // throttle under 50ms due to re-rendering & resizing
490
+ var now = new Date().getTime();
491
+ if (now - _this.lastScrolled < 50)
492
+ return;
493
+ _this.lastScrolled = now;
494
+ if (!_this.tabList)
495
+ return;
496
+ var _a = _this.tabList, scrollWidth = _a.scrollWidth, clientWidth = _a.clientWidth, scrollLeft = _a.scrollLeft;
497
+ var _b = _this.calculateTabScroll({
1153
498
  direction: direction,
1154
499
  scrollWidth: scrollWidth,
1155
500
  clientWidth: clientWidth,
1156
501
  scrollLeft: scrollLeft
1157
- }), newScrollLeft = _a.newScrollLeft, hasLeft = _a.hasLeft, hasRight = _a.hasRight;
502
+ }), newScrollLeft = _b.newScrollLeft, hasLeft = _b.hasLeft, hasRight = _b.hasRight;
1158
503
  _this.hasLeft = hasLeft;
1159
504
  _this.hasRight = hasRight;
1160
- tabList.scroll({ left: newScrollLeft, behavior: 'smooth' });
505
+ if (direction) {
506
+ _this.tabList.scroll({ left: newScrollLeft, behavior: 'smooth' });
507
+ }
1161
508
  };
1162
509
  }
1163
510
  Q2TabContainer.prototype.loc = function (key, subs) {
@@ -1189,12 +536,30 @@ var Q2TabContainer = /** @class */ (function () {
1189
536
  enumerable: false,
1190
537
  configurable: true
1191
538
  });
539
+ Object.defineProperty(Q2TabContainer.prototype, "tabList", {
540
+ get: function () {
541
+ return this.hostElement.shadowRoot.querySelector('.tab-list');
542
+ },
543
+ enumerable: false,
544
+ configurable: true
545
+ });
1192
546
  ///////// Default Handler /////////
1193
547
  Q2TabContainer.prototype.defaultChangeHandler = function (event) {
1194
548
  if (event.target === this.hostElement && !this.hostElement.onchange) {
1195
549
  this.value = event.detail.value;
1196
550
  }
1197
551
  };
552
+ Q2TabContainer.prototype.onResize = function () {
553
+ this.onTabScroll();
554
+ };
555
+ Q2TabContainer.prototype.onFocus = function () {
556
+ var _this = this;
557
+ // firefox receives focus on overflowed element even if it's not interactive element
558
+ if (isFirefox) {
559
+ var index = this.tabs.findIndex(function (el) { return el.value === _this.selectedTabValue; });
560
+ this.moveFocus(index);
561
+ }
562
+ };
1198
563
  ///////// Lifecycle Hooks /////////
1199
564
  Q2TabContainer.prototype.componentWillLoad = function () {
1200
565
  var observer = new MutationObserver(this.updateTabData);
@@ -1206,18 +571,11 @@ var Q2TabContainer = /** @class */ (function () {
1206
571
  this.scheduledAfterRender.forEach(function (fn) { return fn(); });
1207
572
  this.scheduledAfterRender = [];
1208
573
  this.settled.emit();
1209
- if (!this.resizeSubscription) {
1210
- this.initTabScroll();
1211
- this.resizeSubscription = fromEvent(window, 'resize')
1212
- .pipe(debounce(function () { return interval(200); }))
1213
- .subscribe(this.initTabScroll);
1214
- }
574
+ this.onTabScroll();
1215
575
  };
1216
576
  Q2TabContainer.prototype.disconnectedCallback = function () {
1217
577
  this.mutationObserver.disconnect();
1218
578
  this.mutationObserver = null;
1219
- this.resizeSubscription.unsubscribe();
1220
- this.resizeSubscription = null;
1221
579
  };
1222
580
  ///////// Observers /////////
1223
581
  Q2TabContainer.prototype.valueObserver = function () {
@@ -1230,7 +588,7 @@ var Q2TabContainer = /** @class */ (function () {
1230
588
  ///////// View Methods /////////
1231
589
  Q2TabContainer.prototype.render = function () {
1232
590
  var _this = this;
1233
- return (h("div", { class: "tab-container" }, h("ul", { class: "tab-list", role: "tablist" }, this.hasLeft && (h("li", { role: "presentation", class: "nav nav-left", onClick: function () { return _this.onTabScroll('left'); } }, h("div", { class: "arrow-container" }, h("a", null, h("q2-icon", { type: "chevron-left" }))))), this.tabs.map(function (tab, index) { return _this.generateTab(tab, index); }), this.hasRight && (h("li", { role: "presentation", class: "nav nav-right", onClick: function () { return _this.onTabScroll('right'); } }, h("div", { class: "arrow-container" }, h("a", null, h("q2-icon", { type: "chevron-right" })))))), h("div", { class: "tab-content" }, h("slot", null))));
591
+ return (h("div", { class: "tab-container" }, h("ul", { class: "tab-list", role: "tablist" }, this.hasLeft && (h("li", { role: "presentation", class: "nav nav-left", onClick: function () { return _this.onTabScroll('prev'); } }, h("div", { class: "arrow-container" }, h("a", null, h("q2-icon", { type: "chevron-left" }))))), this.tabs.map(function (tab, index) { return _this.generateTab(tab, index); }), this.hasRight && (h("li", { role: "presentation", class: "nav nav-right", onClick: function () { return _this.onTabScroll('next'); } }, h("div", { class: "arrow-container" }, h("a", null, h("q2-icon", { type: "chevron-right" })))))), h("div", { class: "tab-content" }, h("slot", null))));
1234
592
  };
1235
593
  Q2TabContainer.prototype.generateTab = function (tab, index) {
1236
594
  var label = tab.label, value = tab.value;