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