@maggioli-design-system/mds-accordion-timer 3.6.0 → 3.6.2

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 (63) hide show
  1. package/dist/cjs/{index-ab2aee76.js → index-2cfccbaa.js} +48 -21
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/mds-accordion-timer.cjs.entry.js +99 -99
  4. package/dist/cjs/mds-accordion-timer.cjs.js +2 -2
  5. package/dist/collection/collection-manifest.json +1 -1
  6. package/dist/collection/common/aria.js +18 -18
  7. package/dist/collection/common/keyboard-manager.js +38 -38
  8. package/dist/collection/common/unit.js +7 -7
  9. package/dist/collection/components/mds-accordion-timer/mds-accordion-timer.js +173 -173
  10. package/dist/collection/components/mds-accordion-timer/test/mds-accordion-timer.e2e.js +7 -7
  11. package/dist/collection/components/mds-accordion-timer/test/mds-accordion-timer.stories.js +8 -8
  12. package/dist/collection/dictionary/autocomplete.js +56 -56
  13. package/dist/collection/dictionary/button.js +19 -19
  14. package/dist/collection/dictionary/color.js +14 -14
  15. package/dist/collection/dictionary/floating-ui.js +14 -14
  16. package/dist/collection/dictionary/input.js +31 -15
  17. package/dist/collection/dictionary/loading.js +2 -2
  18. package/dist/collection/dictionary/typography.js +46 -46
  19. package/dist/collection/dictionary/variant.js +54 -54
  20. package/dist/collection/fixtures/cities.js +107 -107
  21. package/dist/components/mds-accordion-timer.d.ts +2 -2
  22. package/dist/components/mds-accordion-timer.js +115 -115
  23. package/dist/documentation.json +2 -2
  24. package/dist/esm/{index-1e1d02d3.js → index-df0a164e.js} +48 -21
  25. package/dist/esm/loader.js +2 -2
  26. package/dist/esm/mds-accordion-timer.entry.js +99 -99
  27. package/dist/esm/mds-accordion-timer.js +3 -3
  28. package/dist/esm-es5/index-df0a164e.js +1 -0
  29. package/dist/esm-es5/loader.js +1 -1
  30. package/dist/esm-es5/mds-accordion-timer.entry.js +1 -1
  31. package/dist/esm-es5/mds-accordion-timer.js +1 -1
  32. package/dist/mds-accordion-timer/mds-accordion-timer.esm.js +1 -1
  33. package/dist/mds-accordion-timer/mds-accordion-timer.js +15 -15
  34. package/dist/mds-accordion-timer/{p-b86c017a.system.entry.js → p-09cc1589.system.entry.js} +1 -1
  35. package/dist/mds-accordion-timer/p-0da95646.system.js +2 -0
  36. package/dist/mds-accordion-timer/p-36be1c3e.js +2 -0
  37. package/dist/mds-accordion-timer/{p-ee10fd98.system.js → p-8dd76b31.system.js} +1 -1
  38. package/{www/build/p-57415df8.entry.js → dist/mds-accordion-timer/p-e57978cc.entry.js} +1 -1
  39. package/dist/stats.json +30 -30
  40. package/dist/types/common/keyboard-manager.d.ts +9 -9
  41. package/dist/types/components/mds-accordion-timer/mds-accordion-timer.d.ts +33 -33
  42. package/dist/types/components/mds-accordion-timer/test/mds-accordion-timer.stories.d.ts +8 -8
  43. package/dist/types/dictionary/input.d.ts +2 -1
  44. package/dist/types/interface/input-value.d.ts +1 -1
  45. package/dist/types/stencil-public-runtime.d.ts +8 -0
  46. package/documentation.json +14 -4
  47. package/package.json +4 -4
  48. package/src/components/mds-accordion-timer/mds-accordion-timer.css +1 -1
  49. package/src/dictionary/input.ts +18 -0
  50. package/src/fixtures/icons.json +3 -0
  51. package/src/fixtures/iconsauce.json +3 -0
  52. package/www/build/mds-accordion-timer.esm.js +1 -1
  53. package/www/build/mds-accordion-timer.js +15 -15
  54. package/www/build/{p-b86c017a.system.entry.js → p-09cc1589.system.entry.js} +1 -1
  55. package/www/build/p-0da95646.system.js +2 -0
  56. package/www/build/p-36be1c3e.js +2 -0
  57. package/www/build/{p-ee10fd98.system.js → p-8dd76b31.system.js} +1 -1
  58. package/{dist/mds-accordion-timer/p-57415df8.entry.js → www/build/p-e57978cc.entry.js} +1 -1
  59. package/dist/esm-es5/index-1e1d02d3.js +0 -1
  60. package/dist/mds-accordion-timer/p-6584787f.system.js +0 -2
  61. package/dist/mds-accordion-timer/p-70e86e8e.js +0 -2
  62. package/www/build/p-6584787f.system.js +0 -2
  63. package/www/build/p-70e86e8e.js +0 -2
@@ -3,129 +3,129 @@ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/
3
3
  const mdsAccordionTimerCss = ":host{--mds-accordion-timer-progress-bar-color:rgb(var(--tone-neutral-03));--mds-accordion-timer-progress-bar-background:rgb(var(--tone-neutral-08));--mds-accordion-timer-progress-bar-thickness:0.25rem;--mds-accordion-timer-duration:500ms;display:block}";
4
4
 
5
5
  const MdsAccordionTimer$1 = /*@__PURE__*/ proxyCustomElement(class MdsAccordionTimer extends HTMLElement {
6
- constructor() {
7
- super();
8
- this.__registerHost();
9
- this.__attachShadow();
10
- this.changeEvent = createEvent(this, "mdsAccordionTimerChange", 7);
11
- this.clearIntervals = () => {
12
- window.clearInterval(this.timer);
13
- window.clearInterval(this.timeChecker);
14
- this.timeChecker = 0;
15
- };
16
- this.progress = () => {
17
- return Math.abs(this.remainingTime() / this.duration - 1);
18
- };
19
- this.addTimeListener = () => {
20
- this.timeChecker = window.setInterval(() => {
21
- const progress = this.progress();
6
+ constructor() {
7
+ super();
8
+ this.__registerHost();
9
+ this.__attachShadow();
10
+ this.changeEvent = createEvent(this, "mdsAccordionTimerChange", 7);
11
+ this.clearIntervals = () => {
12
+ window.clearInterval(this.timer);
13
+ window.clearInterval(this.timeChecker);
14
+ this.timeChecker = 0;
15
+ };
16
+ this.progress = () => {
17
+ return Math.abs(this.remainingTime() / this.duration - 1);
18
+ };
19
+ this.addTimeListener = () => {
20
+ this.timeChecker = window.setInterval(() => {
21
+ const progress = this.progress();
22
+ if (this.selectedItem !== undefined) {
23
+ this.selectedItem.progress = progress;
24
+ }
25
+ if (progress === 1) {
26
+ this.selectedItem.progress = 0;
27
+ this.startNext();
28
+ }
29
+ }, 100);
30
+ };
31
+ this.beginningTime = () => {
32
+ this.timeStarted = (new Date()).getTime();
33
+ return this.timeStarted;
34
+ };
35
+ this.remainingTime = () => {
36
+ const remainingTime = this.selectedItemDurationTime - ((new Date()).getTime() - this.timeStarted);
37
+ return remainingTime >= 0 ? remainingTime : 0;
38
+ };
39
+ this.setSelectedItem = (uuid) => {
40
+ this.children.forEach((item, key) => {
41
+ if (key === uuid) {
42
+ item.selected = true;
43
+ this.selectedItem = item;
44
+ this.changeEvent.emit();
45
+ }
46
+ else {
47
+ item.selected = false;
48
+ }
49
+ });
50
+ };
51
+ this.startNext = () => {
52
+ const nextUuid = this.selectedItem.uuid + 1 > this.children.length - 1 ? 0 : this.selectedItem.uuid + 1;
53
+ this.setSelectedItem(nextUuid);
54
+ this.startTimer();
55
+ };
56
+ this.startTimer = () => {
57
+ this.clearIntervals();
58
+ this.time = this.beginningTime();
59
+ this.selectedItemDurationTime = this.duration;
60
+ this.addTimeListener();
61
+ };
62
+ this.playTimer = () => {
63
+ this.beginningTime();
64
+ this.addTimeListener();
65
+ };
66
+ this.pauseTimer = () => {
67
+ this.clearIntervals();
68
+ this.selectedItemDurationTime = this.remainingTime();
69
+ };
70
+ this.stopTimer = () => {
71
+ this.clearIntervals();
72
+ };
73
+ this.time = 0;
74
+ this.duration = 10000;
75
+ }
76
+ componentDidLoad() {
77
+ this.children = this.element.querySelectorAll('mds-accordion-timer-item');
78
+ this.children.forEach((item, key) => {
79
+ item.uuid = key;
80
+ if (item.selected) {
81
+ this.selectedItem = item;
82
+ }
83
+ });
22
84
  if (this.selectedItem !== undefined) {
23
- this.selectedItem.progress = progress;
24
- }
25
- if (progress === 1) {
26
- this.selectedItem.progress = 0;
27
- this.startNext();
85
+ this.startTimer();
28
86
  }
29
- }, 100);
30
- };
31
- this.beginningTime = () => {
32
- this.timeStarted = (new Date()).getTime();
33
- return this.timeStarted;
34
- };
35
- this.remainingTime = () => {
36
- const remainingTime = this.selectedItemDurationTime - ((new Date()).getTime() - this.timeStarted);
37
- return remainingTime >= 0 ? remainingTime : 0;
38
- };
39
- this.setSelectedItem = (uuid) => {
40
- this.children.forEach((item, key) => {
41
- if (key === uuid) {
42
- item.selected = true;
43
- this.selectedItem = item;
44
- this.changeEvent.emit();
45
- }
46
- else {
47
- item.selected = false;
87
+ }
88
+ disconnectedCallback() {
89
+ this.stopTimer();
90
+ this.clearIntervals();
91
+ }
92
+ onClickActive(event) {
93
+ if (this.selectedItem) {
94
+ this.selectedItem.progress = 0;
48
95
  }
49
- });
50
- };
51
- this.startNext = () => {
52
- const nextUuid = this.selectedItem.uuid + 1 > this.children.length - 1 ? 0 : this.selectedItem.uuid + 1;
53
- this.setSelectedItem(nextUuid);
54
- this.startTimer();
55
- };
56
- this.startTimer = () => {
57
- this.clearIntervals();
58
- this.time = this.beginningTime();
59
- this.selectedItemDurationTime = this.duration;
60
- this.addTimeListener();
61
- };
62
- this.playTimer = () => {
63
- this.beginningTime();
64
- this.addTimeListener();
65
- };
66
- this.pauseTimer = () => {
67
- this.clearIntervals();
68
- this.selectedItemDurationTime = this.remainingTime();
69
- };
70
- this.stopTimer = () => {
71
- this.clearIntervals();
72
- };
73
- this.time = 0;
74
- this.duration = 10000;
75
- }
76
- componentDidLoad() {
77
- this.children = this.element.querySelectorAll('mds-accordion-timer-item');
78
- this.children.forEach((item, key) => {
79
- item.uuid = key;
80
- if (item.selected) {
81
- this.selectedItem = item;
82
- }
83
- });
84
- if (this.selectedItem !== undefined) {
85
- this.startTimer();
96
+ this.setSelectedItem(event.detail.uuid);
97
+ this.startTimer();
98
+ this.pauseTimer();
99
+ }
100
+ onMouseEnterSelect() {
101
+ this.pauseTimer();
86
102
  }
87
- }
88
- disconnectedCallback() {
89
- this.stopTimer();
90
- this.clearIntervals();
91
- }
92
- onClickActive(event) {
93
- if (this.selectedItem) {
94
- this.selectedItem.progress = 0;
103
+ onMouseLeaveSelect() {
104
+ if (this.timeChecker === 0) {
105
+ this.playTimer();
106
+ }
95
107
  }
96
- this.setSelectedItem(event.detail.uuid);
97
- this.startTimer();
98
- this.pauseTimer();
99
- }
100
- onMouseEnterSelect() {
101
- this.pauseTimer();
102
- }
103
- onMouseLeaveSelect() {
104
- if (this.timeChecker === 0) {
105
- this.playTimer();
108
+ render() {
109
+ return (h(Host, null, h("slot", null)));
106
110
  }
107
- }
108
- render() {
109
- return (h(Host, null, h("slot", null)));
110
- }
111
- get element() { return this; }
112
- static get style() { return mdsAccordionTimerCss; }
111
+ get element() { return this; }
112
+ static get style() { return mdsAccordionTimerCss; }
113
113
  }, [1, "mds-accordion-timer", {
114
- "duration": [2],
115
- "time": [32]
116
- }, [[0, "mdsAccordionTimerItemClickSelect", "onClickActive"], [0, "mdsAccordionTimerItemMouseEnterSelect", "onMouseEnterSelect"], [0, "mdsAccordionTimerItemMouseLeaveSelect", "onMouseLeaveSelect"]]]);
114
+ "duration": [2],
115
+ "time": [32]
116
+ }, [[0, "mdsAccordionTimerItemClickSelect", "onClickActive"], [0, "mdsAccordionTimerItemMouseEnterSelect", "onMouseEnterSelect"], [0, "mdsAccordionTimerItemMouseLeaveSelect", "onMouseLeaveSelect"]]]);
117
117
  function defineCustomElement$1() {
118
- if (typeof customElements === "undefined") {
119
- return;
120
- }
121
- const components = ["mds-accordion-timer"];
122
- components.forEach(tagName => { switch (tagName) {
123
- case "mds-accordion-timer":
124
- if (!customElements.get(tagName)) {
125
- customElements.define(tagName, MdsAccordionTimer$1);
126
- }
127
- break;
128
- } });
118
+ if (typeof customElements === "undefined") {
119
+ return;
120
+ }
121
+ const components = ["mds-accordion-timer"];
122
+ components.forEach(tagName => { switch (tagName) {
123
+ case "mds-accordion-timer":
124
+ if (!customElements.get(tagName)) {
125
+ customElements.define(tagName, MdsAccordionTimer$1);
126
+ }
127
+ break;
128
+ } });
129
129
  }
130
130
 
131
131
  const MdsAccordionTimer = MdsAccordionTimer$1;
@@ -1,8 +1,8 @@
1
1
  {
2
- "timestamp": "2023-11-08T17:53:20",
2
+ "timestamp": "2023-12-20T08:46:16",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
- "version": "4.7.1",
5
+ "version": "4.8.0",
6
6
  "typescriptVersion": "5.2.2"
7
7
  },
8
8
  "components": [
@@ -26,6 +26,13 @@ const uniqueTime = (key, measureText) => {
26
26
  }
27
27
  };
28
28
  const HYDRATED_CSS = '{visibility:hidden}[hydrated]{visibility:inherit}';
29
+ /**
30
+ * Constant for styles to be globally applied to `slot-fb` elements for pseudo-slot behavior.
31
+ *
32
+ * Two cascading rules must be used instead of a `:not()` selector due to Stencil browser
33
+ * support as of Stencil v4.
34
+ */
35
+ const SLOT_FB_CSS = 'slot-fb{display:contents}slot-fb[hidden]{display:none}';
29
36
  const isDef = (v) => v != null;
30
37
  /**
31
38
  * Check whether a value is a 'complex type', defined here as an object or a
@@ -228,6 +235,10 @@ const addStyle = (styleContainerNode, cmpMeta, mode) => {
228
235
  }
229
236
  styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
230
237
  }
238
+ // Add styles for `slot-fb` elements if we're using slots outside the Shadow DOM
239
+ if (cmpMeta.$flags$ & 4 /* CMP_FLAGS.hasSlotRelocation */) {
240
+ styleElm.innerHTML += SLOT_FB_CSS;
241
+ }
231
242
  if (appliedStyles) {
232
243
  appliedStyles.add(scopeId);
233
244
  }
@@ -914,10 +925,10 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
914
925
  */
915
926
  const proxyComponent = (Cstr, cmpMeta, flags) => {
916
927
  var _a;
928
+ const prototype = Cstr.prototype;
917
929
  if (cmpMeta.$members$) {
918
930
  // It's better to have a const than two Object.entries()
919
931
  const members = Object.entries(cmpMeta.$members$);
920
- const prototype = Cstr.prototype;
921
932
  members.map(([memberName, [memberFlags]]) => {
922
933
  if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
923
934
  ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
@@ -940,6 +951,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
940
951
  const attrNameToPropName = new Map();
941
952
  prototype.attributeChangedCallback = function (attrName, oldValue, newValue) {
942
953
  plt.jmp(() => {
954
+ var _a;
943
955
  const propName = attrNameToPropName.get(attrName);
944
956
  // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
945
957
  // in the case where an attribute was set inline.
@@ -995,11 +1007,12 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
995
1007
  // 1. The instance is ready
996
1008
  // 2. The watchers are ready
997
1009
  // 3. The value has changed
998
- if (!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) &&
1010
+ if (flags &&
1011
+ !(flags & 8 /* HOST_FLAGS.isConstructingInstance */) &&
999
1012
  flags & 128 /* HOST_FLAGS.isWatchReady */ &&
1000
1013
  newValue !== oldValue) {
1001
1014
  const instance = hostRef.$lazyInstance$ ;
1002
- const entry = cmpMeta.$watchers$[attrName];
1015
+ const entry = (_a = cmpMeta.$watchers$) === null || _a === void 0 ? void 0 : _a[attrName];
1003
1016
  entry === null || entry === void 0 ? void 0 : entry.forEach((callbackName) => {
1004
1017
  if (instance[callbackName] != null) {
1005
1018
  instance[callbackName].call(instance, newValue, oldValue, attrName);
@@ -1194,12 +1207,13 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1194
1207
  const customElements = win.customElements;
1195
1208
  const head = doc.head;
1196
1209
  const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
1197
- const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
1210
+ const dataStyles = /*@__PURE__*/ doc.createElement('style');
1198
1211
  const deferredConnectedCallbacks = [];
1199
1212
  let appLoadFallback;
1200
1213
  let isBootstrapping = true;
1201
1214
  Object.assign(plt, options);
1202
1215
  plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
1216
+ let hasSlotRelocation = false;
1203
1217
  lazyBundles.map((lazyBundle) => {
1204
1218
  lazyBundle[1].map((compactMeta) => {
1205
1219
  const cmpMeta = {
@@ -1208,6 +1222,11 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1208
1222
  $members$: compactMeta[2],
1209
1223
  $listeners$: compactMeta[3],
1210
1224
  };
1225
+ // Check if we are using slots outside the shadow DOM in this component.
1226
+ // We'll use this information later to add styles for `slot-fb` elements
1227
+ if (cmpMeta.$flags$ & 4 /* CMP_FLAGS.hasSlotRelocation */) {
1228
+ hasSlotRelocation = true;
1229
+ }
1211
1230
  {
1212
1231
  cmpMeta.$members$ = compactMeta[2];
1213
1232
  }
@@ -1261,15 +1280,23 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1261
1280
  }
1262
1281
  });
1263
1282
  });
1283
+ // Add styles for `slot-fb` elements if any of our components are using slots outside the Shadow DOM
1284
+ if (hasSlotRelocation) {
1285
+ dataStyles.innerHTML += SLOT_FB_CSS;
1286
+ }
1287
+ // Add hydration styles
1264
1288
  {
1265
- visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1266
- visibilityStyle.setAttribute('data-styles', '');
1289
+ dataStyles.innerHTML += cmpTags + HYDRATED_CSS;
1290
+ }
1291
+ // If we have styles, add them to the DOM
1292
+ if (dataStyles.innerHTML.length) {
1293
+ dataStyles.setAttribute('data-styles', '');
1294
+ head.insertBefore(dataStyles, metaCharset ? metaCharset.nextSibling : head.firstChild);
1267
1295
  // Apply CSP nonce to the style tag if it exists
1268
1296
  const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
1269
1297
  if (nonce != null) {
1270
- visibilityStyle.setAttribute('nonce', nonce);
1298
+ dataStyles.setAttribute('nonce', nonce);
1271
1299
  }
1272
- head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1273
1300
  }
1274
1301
  // Process deferred connectedCallbacks now all components have been registered
1275
1302
  isBootstrapping = false;
@@ -1376,19 +1403,19 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1376
1403
  return module[exportName];
1377
1404
  }
1378
1405
 
1379
- if (!hmrVersionId || !BUILD.hotModuleReplacement) {
1380
- const processMod = importedModule => {
1381
- cmpModules.set(bundleId, importedModule);
1382
- return importedModule[exportName];
1406
+ if (!hmrVersionId || !BUILD.hotModuleReplacement) {
1407
+ const processMod = importedModule => {
1408
+ cmpModules.set(bundleId, importedModule);
1409
+ return importedModule[exportName];
1410
+ }
1411
+ switch(bundleId) {
1412
+
1413
+ case 'mds-accordion-timer':
1414
+ return import(
1415
+ /* webpackMode: "lazy" */
1416
+ './mds-accordion-timer.entry.js').then(processMod, consoleError);
1417
+ }
1383
1418
  }
1384
- switch(bundleId) {
1385
-
1386
- case 'mds-accordion-timer':
1387
- return import(
1388
- /* webpackMode: "lazy" */
1389
- './mds-accordion-timer.entry.js').then(processMod, consoleError);
1390
- }
1391
- }
1392
1419
  return import(
1393
1420
  /* @vite-ignore */
1394
1421
  /* webpackInclude: /\.entry\.js$/ */
@@ -1463,7 +1490,7 @@ const flush = () => {
1463
1490
  }
1464
1491
  }
1465
1492
  };
1466
- const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1493
+ const nextTick = (cb) => promiseResolve().then(cb);
1467
1494
  const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1468
1495
 
1469
1496
  export { Host as H, bootstrapLazy as b, createEvent as c, getElement as g, h, promiseResolve as p, registerInstance as r, setNonce as s };
@@ -1,5 +1,5 @@
1
- import { b as bootstrapLazy } from './index-1e1d02d3.js';
2
- export { s as setNonce } from './index-1e1d02d3.js';
1
+ import { b as bootstrapLazy } from './index-df0a164e.js';
2
+ export { s as setNonce } from './index-df0a164e.js';
3
3
 
4
4
  const defineCustomElements = (win, options) => {
5
5
  if (typeof window === 'undefined') return undefined;
@@ -1,112 +1,112 @@
1
- import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-1e1d02d3.js';
1
+ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-df0a164e.js';
2
2
 
3
3
  const mdsAccordionTimerCss = ":host{--mds-accordion-timer-progress-bar-color:rgb(var(--tone-neutral-03));--mds-accordion-timer-progress-bar-background:rgb(var(--tone-neutral-08));--mds-accordion-timer-progress-bar-thickness:0.25rem;--mds-accordion-timer-duration:500ms;display:block}";
4
4
 
5
5
  const MdsAccordionTimer = class {
6
- constructor(hostRef) {
7
- registerInstance(this, hostRef);
8
- this.changeEvent = createEvent(this, "mdsAccordionTimerChange", 7);
9
- this.clearIntervals = () => {
10
- window.clearInterval(this.timer);
11
- window.clearInterval(this.timeChecker);
12
- this.timeChecker = 0;
13
- };
14
- this.progress = () => {
15
- return Math.abs(this.remainingTime() / this.duration - 1);
16
- };
17
- this.addTimeListener = () => {
18
- this.timeChecker = window.setInterval(() => {
19
- const progress = this.progress();
6
+ constructor(hostRef) {
7
+ registerInstance(this, hostRef);
8
+ this.changeEvent = createEvent(this, "mdsAccordionTimerChange", 7);
9
+ this.clearIntervals = () => {
10
+ window.clearInterval(this.timer);
11
+ window.clearInterval(this.timeChecker);
12
+ this.timeChecker = 0;
13
+ };
14
+ this.progress = () => {
15
+ return Math.abs(this.remainingTime() / this.duration - 1);
16
+ };
17
+ this.addTimeListener = () => {
18
+ this.timeChecker = window.setInterval(() => {
19
+ const progress = this.progress();
20
+ if (this.selectedItem !== undefined) {
21
+ this.selectedItem.progress = progress;
22
+ }
23
+ if (progress === 1) {
24
+ this.selectedItem.progress = 0;
25
+ this.startNext();
26
+ }
27
+ }, 100);
28
+ };
29
+ this.beginningTime = () => {
30
+ this.timeStarted = (new Date()).getTime();
31
+ return this.timeStarted;
32
+ };
33
+ this.remainingTime = () => {
34
+ const remainingTime = this.selectedItemDurationTime - ((new Date()).getTime() - this.timeStarted);
35
+ return remainingTime >= 0 ? remainingTime : 0;
36
+ };
37
+ this.setSelectedItem = (uuid) => {
38
+ this.children.forEach((item, key) => {
39
+ if (key === uuid) {
40
+ item.selected = true;
41
+ this.selectedItem = item;
42
+ this.changeEvent.emit();
43
+ }
44
+ else {
45
+ item.selected = false;
46
+ }
47
+ });
48
+ };
49
+ this.startNext = () => {
50
+ const nextUuid = this.selectedItem.uuid + 1 > this.children.length - 1 ? 0 : this.selectedItem.uuid + 1;
51
+ this.setSelectedItem(nextUuid);
52
+ this.startTimer();
53
+ };
54
+ this.startTimer = () => {
55
+ this.clearIntervals();
56
+ this.time = this.beginningTime();
57
+ this.selectedItemDurationTime = this.duration;
58
+ this.addTimeListener();
59
+ };
60
+ this.playTimer = () => {
61
+ this.beginningTime();
62
+ this.addTimeListener();
63
+ };
64
+ this.pauseTimer = () => {
65
+ this.clearIntervals();
66
+ this.selectedItemDurationTime = this.remainingTime();
67
+ };
68
+ this.stopTimer = () => {
69
+ this.clearIntervals();
70
+ };
71
+ this.time = 0;
72
+ this.duration = 10000;
73
+ }
74
+ componentDidLoad() {
75
+ this.children = this.element.querySelectorAll('mds-accordion-timer-item');
76
+ this.children.forEach((item, key) => {
77
+ item.uuid = key;
78
+ if (item.selected) {
79
+ this.selectedItem = item;
80
+ }
81
+ });
20
82
  if (this.selectedItem !== undefined) {
21
- this.selectedItem.progress = progress;
22
- }
23
- if (progress === 1) {
24
- this.selectedItem.progress = 0;
25
- this.startNext();
83
+ this.startTimer();
26
84
  }
27
- }, 100);
28
- };
29
- this.beginningTime = () => {
30
- this.timeStarted = (new Date()).getTime();
31
- return this.timeStarted;
32
- };
33
- this.remainingTime = () => {
34
- const remainingTime = this.selectedItemDurationTime - ((new Date()).getTime() - this.timeStarted);
35
- return remainingTime >= 0 ? remainingTime : 0;
36
- };
37
- this.setSelectedItem = (uuid) => {
38
- this.children.forEach((item, key) => {
39
- if (key === uuid) {
40
- item.selected = true;
41
- this.selectedItem = item;
42
- this.changeEvent.emit();
43
- }
44
- else {
45
- item.selected = false;
85
+ }
86
+ disconnectedCallback() {
87
+ this.stopTimer();
88
+ this.clearIntervals();
89
+ }
90
+ onClickActive(event) {
91
+ if (this.selectedItem) {
92
+ this.selectedItem.progress = 0;
46
93
  }
47
- });
48
- };
49
- this.startNext = () => {
50
- const nextUuid = this.selectedItem.uuid + 1 > this.children.length - 1 ? 0 : this.selectedItem.uuid + 1;
51
- this.setSelectedItem(nextUuid);
52
- this.startTimer();
53
- };
54
- this.startTimer = () => {
55
- this.clearIntervals();
56
- this.time = this.beginningTime();
57
- this.selectedItemDurationTime = this.duration;
58
- this.addTimeListener();
59
- };
60
- this.playTimer = () => {
61
- this.beginningTime();
62
- this.addTimeListener();
63
- };
64
- this.pauseTimer = () => {
65
- this.clearIntervals();
66
- this.selectedItemDurationTime = this.remainingTime();
67
- };
68
- this.stopTimer = () => {
69
- this.clearIntervals();
70
- };
71
- this.time = 0;
72
- this.duration = 10000;
73
- }
74
- componentDidLoad() {
75
- this.children = this.element.querySelectorAll('mds-accordion-timer-item');
76
- this.children.forEach((item, key) => {
77
- item.uuid = key;
78
- if (item.selected) {
79
- this.selectedItem = item;
80
- }
81
- });
82
- if (this.selectedItem !== undefined) {
83
- this.startTimer();
94
+ this.setSelectedItem(event.detail.uuid);
95
+ this.startTimer();
96
+ this.pauseTimer();
97
+ }
98
+ onMouseEnterSelect() {
99
+ this.pauseTimer();
84
100
  }
85
- }
86
- disconnectedCallback() {
87
- this.stopTimer();
88
- this.clearIntervals();
89
- }
90
- onClickActive(event) {
91
- if (this.selectedItem) {
92
- this.selectedItem.progress = 0;
101
+ onMouseLeaveSelect() {
102
+ if (this.timeChecker === 0) {
103
+ this.playTimer();
104
+ }
93
105
  }
94
- this.setSelectedItem(event.detail.uuid);
95
- this.startTimer();
96
- this.pauseTimer();
97
- }
98
- onMouseEnterSelect() {
99
- this.pauseTimer();
100
- }
101
- onMouseLeaveSelect() {
102
- if (this.timeChecker === 0) {
103
- this.playTimer();
106
+ render() {
107
+ return (h(Host, null, h("slot", null)));
104
108
  }
105
- }
106
- render() {
107
- return (h(Host, null, h("slot", null)));
108
- }
109
- get element() { return getElement(this); }
109
+ get element() { return getElement(this); }
110
110
  };
111
111
  MdsAccordionTimer.style = mdsAccordionTimerCss;
112
112
 
@@ -1,8 +1,8 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-1e1d02d3.js';
2
- export { s as setNonce } from './index-1e1d02d3.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-df0a164e.js';
2
+ export { s as setNonce } from './index-df0a164e.js';
3
3
 
4
4
  /*
5
- Stencil Client Patch Browser v4.7.1 | MIT Licensed | https://stenciljs.com
5
+ Stencil Client Patch Browser v4.8.0 | MIT Licensed | https://stenciljs.com
6
6
  */
7
7
  const patchBrowser = () => {
8
8
  const importMeta = import.meta.url;