@maggioli-design-system/mds-accordion-timer 4.0.0 → 4.0.1
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.
- package/dist/cjs/mds-accordion-timer.cjs.entry.js +16 -12
- package/dist/collection/common/aria.js +17 -1
- package/dist/collection/common/device.js +6 -0
- package/dist/collection/common/keyboard-manager.js +2 -2
- package/dist/collection/components/mds-accordion-timer/mds-accordion-timer.js +16 -12
- package/dist/collection/dictionary/file-extensions.js +114 -56
- package/dist/collection/dictionary/text.js +60 -1
- package/dist/components/mds-accordion-timer.js +16 -12
- package/dist/documentation.json +1 -1
- package/dist/esm/mds-accordion-timer.entry.js +16 -12
- package/dist/esm-es5/mds-accordion-timer.entry.js +1 -1
- package/dist/mds-accordion-timer/mds-accordion-timer.esm.js +1 -1
- package/dist/mds-accordion-timer/p-25856ee2.system.js +1 -1
- package/dist/mds-accordion-timer/p-4eb3ec08.system.entry.js +1 -0
- package/dist/mds-accordion-timer/p-86e0d6b4.entry.js +1 -0
- package/dist/stats.json +18 -16
- package/dist/types/common/aria.d.ts +3 -1
- package/dist/types/common/device.d.ts +2 -0
- package/dist/types/dictionary/text.d.ts +3 -1
- package/dist/types/type/text.d.ts +2 -0
- package/documentation.json +9 -4
- package/package.json +2 -2
- package/src/common/aria.ts +22 -2
- package/src/common/device.ts +9 -0
- package/src/common/keyboard-manager.ts +2 -2
- package/src/components/mds-accordion-timer/mds-accordion-timer.tsx +15 -11
- package/src/dictionary/file-extensions.ts +115 -56
- package/src/dictionary/text.ts +64 -0
- package/src/fixtures/icons.json +8 -0
- package/src/fixtures/iconsauce.json +5 -0
- package/src/meta/file-format/locale.el.json +39 -0
- package/src/meta/file-format/locale.en.json +39 -0
- package/src/meta/file-format/locale.es.json +39 -0
- package/src/meta/file-format/locale.it.json +39 -0
- package/src/type/text.ts +59 -0
- package/www/build/mds-accordion-timer.esm.js +1 -1
- package/www/build/p-25856ee2.system.js +1 -1
- package/www/build/p-4eb3ec08.system.entry.js +1 -0
- package/www/build/p-86e0d6b4.entry.js +1 -0
- package/dist/mds-accordion-timer/p-4dac14fb.entry.js +0 -1
- package/dist/mds-accordion-timer/p-7ae27bb3.system.entry.js +0 -1
- package/www/build/p-4dac14fb.entry.js +0 -1
- package/www/build/p-7ae27bb3.system.entry.js +0 -1
|
@@ -13,7 +13,9 @@ const MdsAccordionTimer = class {
|
|
|
13
13
|
this.changeEvent = index.createEvent(this, "mdsAccordionTimerChange", 7);
|
|
14
14
|
this.currentDuration = 0;
|
|
15
15
|
this.clearIntervals = () => {
|
|
16
|
-
window
|
|
16
|
+
if (typeof window !== 'undefined') {
|
|
17
|
+
window.clearInterval(this.timeChecker);
|
|
18
|
+
}
|
|
17
19
|
this.timeChecker = 0;
|
|
18
20
|
};
|
|
19
21
|
this.remainingTime = () => {
|
|
@@ -24,16 +26,18 @@ const MdsAccordionTimer = class {
|
|
|
24
26
|
return Math.abs(this.remainingTime() / this.currentDuration - 1);
|
|
25
27
|
};
|
|
26
28
|
this.addTimeListener = () => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
this.selectedItem
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
if (typeof window !== 'undefined') {
|
|
30
|
+
this.timeChecker = window.setInterval(() => {
|
|
31
|
+
const progress = this.progress();
|
|
32
|
+
if (this.selectedItem !== undefined) {
|
|
33
|
+
this.selectedItem.progress = progress;
|
|
34
|
+
}
|
|
35
|
+
if (progress === 1) {
|
|
36
|
+
this.selectedItem.progress = 0;
|
|
37
|
+
this.startNext();
|
|
38
|
+
}
|
|
39
|
+
}, 100);
|
|
40
|
+
}
|
|
37
41
|
};
|
|
38
42
|
this.beginningTime = () => {
|
|
39
43
|
this.timeStarted = (new Date()).getTime();
|
|
@@ -138,7 +142,7 @@ const MdsAccordionTimer = class {
|
|
|
138
142
|
this.playTimer();
|
|
139
143
|
}
|
|
140
144
|
render() {
|
|
141
|
-
return (index.h(index.Host, { key: '
|
|
145
|
+
return (index.h(index.Host, { key: '9816683b4c8bacb97302685b1f1b45ff8ab1a209' }, index.h("slot", { key: 'b411a4cdbb6f133f871979df4eccd70433567b56' })));
|
|
142
146
|
}
|
|
143
147
|
get element() { return index.getElement(this); }
|
|
144
148
|
static get watchers() { return {
|
|
@@ -18,6 +18,22 @@ const setAttributeIfEmpty = (element, attribute, value) => {
|
|
|
18
18
|
element.setAttribute(attribute, value);
|
|
19
19
|
return value;
|
|
20
20
|
};
|
|
21
|
+
const removeAttributesIf = (element, attribute, valueCheck = 'true', cleanAttributes) => {
|
|
22
|
+
if (ifAttribute(element, attribute, valueCheck)) {
|
|
23
|
+
const attributesList = Array.isArray(cleanAttributes) ? cleanAttributes : [cleanAttributes];
|
|
24
|
+
attributesList.forEach(attributeToRemove => {
|
|
25
|
+
element.removeAttribute(attributeToRemove);
|
|
26
|
+
});
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
};
|
|
31
|
+
const ifAttribute = (element, attribute, valueCheck = 'true') => {
|
|
32
|
+
if (element.hasAttribute(attribute) && element.getAttribute(attribute) === valueCheck) {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
return false;
|
|
36
|
+
};
|
|
21
37
|
const hashValue = (value) => `${value}-${hash(value)}`;
|
|
22
38
|
const hashRandomValue = (value) => {
|
|
23
39
|
const randomValue = randomInt(1000000);
|
|
@@ -26,4 +42,4 @@ const hashRandomValue = (value) => {
|
|
|
26
42
|
}
|
|
27
43
|
return hash(randomValue.toString());
|
|
28
44
|
};
|
|
29
|
-
export {
|
|
45
|
+
export { hashRandomValue, hashValue, removeAttributesIf, setAttributeIfEmpty, ifAttribute, unslugName, };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const isMobileDevice = () => {
|
|
2
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3
|
+
const userAgent = navigator.userAgent || navigator.vendor || window.opera;
|
|
4
|
+
return /android|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(userAgent);
|
|
5
|
+
};
|
|
6
|
+
export { isMobileDevice, };
|
|
@@ -31,13 +31,13 @@ export class KeyboardManager {
|
|
|
31
31
|
};
|
|
32
32
|
this.attachEscapeBehavior = (callback) => {
|
|
33
33
|
this.escapeCallback = callback;
|
|
34
|
-
if (window !== undefined) {
|
|
34
|
+
if (typeof window !== 'undefined') {
|
|
35
35
|
window.addEventListener('keydown', this.handleEscapeBehaviorDispatchEvent.bind(this));
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
this.detachEscapeBehavior = () => {
|
|
39
39
|
this.escapeCallback = () => { return; };
|
|
40
|
-
if (window !== undefined) {
|
|
40
|
+
if (typeof window !== 'undefined') {
|
|
41
41
|
window.removeEventListener('keydown', this.handleEscapeBehaviorDispatchEvent.bind(this));
|
|
42
42
|
}
|
|
43
43
|
};
|
|
@@ -6,7 +6,9 @@ export class MdsAccordionTimer {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
this.currentDuration = 0;
|
|
8
8
|
this.clearIntervals = () => {
|
|
9
|
-
window
|
|
9
|
+
if (typeof window !== 'undefined') {
|
|
10
|
+
window.clearInterval(this.timeChecker);
|
|
11
|
+
}
|
|
10
12
|
this.timeChecker = 0;
|
|
11
13
|
};
|
|
12
14
|
this.remainingTime = () => {
|
|
@@ -17,16 +19,18 @@ export class MdsAccordionTimer {
|
|
|
17
19
|
return Math.abs(this.remainingTime() / this.currentDuration - 1);
|
|
18
20
|
};
|
|
19
21
|
this.addTimeListener = () => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
this.selectedItem
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
if (typeof window !== 'undefined') {
|
|
23
|
+
this.timeChecker = window.setInterval(() => {
|
|
24
|
+
const progress = this.progress();
|
|
25
|
+
if (this.selectedItem !== undefined) {
|
|
26
|
+
this.selectedItem.progress = progress;
|
|
27
|
+
}
|
|
28
|
+
if (progress === 1) {
|
|
29
|
+
this.selectedItem.progress = 0;
|
|
30
|
+
this.startNext();
|
|
31
|
+
}
|
|
32
|
+
}, 100);
|
|
33
|
+
}
|
|
30
34
|
};
|
|
31
35
|
this.beginningTime = () => {
|
|
32
36
|
this.timeStarted = (new Date()).getTime();
|
|
@@ -131,7 +135,7 @@ export class MdsAccordionTimer {
|
|
|
131
135
|
this.playTimer();
|
|
132
136
|
}
|
|
133
137
|
render() {
|
|
134
|
-
return (h(Host, { key: '
|
|
138
|
+
return (h(Host, { key: '9816683b4c8bacb97302685b1f1b45ff8ab1a209' }, h("slot", { key: 'b411a4cdbb6f133f871979df4eccd70433567b56' })));
|
|
135
139
|
}
|
|
136
140
|
static get is() { return "mds-accordion-timer"; }
|
|
137
141
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1,61 +1,119 @@
|
|
|
1
1
|
const fileExtensionsDictionary = {
|
|
2
|
-
'7z': { format: 'archive', description: '
|
|
3
|
-
ace: { format: 'archive', description: '
|
|
4
|
-
ai: { format: 'vector', description: '
|
|
5
|
-
dart: { format: 'code', description: '
|
|
6
|
-
db: { format: 'data', description: '
|
|
7
|
-
default: { format: 'attachment', description: '
|
|
8
|
-
dmg: { format: 'executable', description: '
|
|
9
|
-
doc: { format: 'text', description: '
|
|
10
|
-
docm: { format: 'text', description: '
|
|
11
|
-
docx: { format: 'text', description: '
|
|
12
|
-
eml: { format: 'email', description: '
|
|
13
|
-
eps: { format: 'vector', description: '
|
|
14
|
-
exe: { format: 'executable', description: '
|
|
15
|
-
flac: { format: 'audio', description: '
|
|
16
|
-
gif: { format: 'image', description: '
|
|
17
|
-
htm: { format: 'markup', description: '
|
|
18
|
-
heic: { format: 'image', description: '
|
|
19
|
-
html: { format: 'markup', description: '
|
|
20
|
-
jpe: { format: 'image', description: '
|
|
21
|
-
jpeg: { format: 'image', description: '
|
|
22
|
-
jpg: { format: 'image', description: '
|
|
23
|
-
js: { format: 'code', description: '
|
|
24
|
-
json: { format: 'data', description: '
|
|
25
|
-
jsx: { format: 'code', description: '
|
|
26
|
-
m2v: { format: 'video', description: '
|
|
27
|
-
mp2: { format: 'audio', description: '
|
|
28
|
-
mp3: { format: 'audio', description: '
|
|
29
|
-
mp4: { format: 'video', description: '
|
|
30
|
-
mp4v: { format: 'video', description: '
|
|
31
|
-
mpeg: { format: 'video', description: '
|
|
32
|
-
mpg4: { format: 'video', description: '
|
|
33
|
-
mpg: { format: 'video', description: '
|
|
34
|
-
mpga: { format: 'audio', description: '
|
|
35
|
-
odp: { format: 'slide', description: '
|
|
36
|
-
ods: { format: 'spreadsheet', description: '
|
|
37
|
-
odt: { format: 'text', description: '
|
|
38
|
-
pdf: { format: 'document', description: '
|
|
39
|
-
php: { format: 'code', description: '
|
|
40
|
-
png: { format: 'image', description: '
|
|
41
|
-
ppt: { format: 'slide', description: '
|
|
42
|
-
rar: { format: 'archive', description: '
|
|
43
|
-
rtf: { format: 'text', description: '
|
|
44
|
-
sass: { format: 'code', description: '
|
|
45
|
-
shtml: { format: 'markup', description: '
|
|
46
|
-
svg: { format: 'vector', description: '
|
|
47
|
-
tar: { format: 'archive', description: '
|
|
48
|
-
tiff: { format: 'image', description: '
|
|
49
|
-
ts: { format: 'code', description: '
|
|
50
|
-
tsx: { format: 'code', description: '
|
|
51
|
-
txt: { format: 'text', description: '
|
|
52
|
-
wav: { format: 'audio', description: '
|
|
53
|
-
webp: { format: 'image', description: '
|
|
54
|
-
xar: { format: 'archive', description: '
|
|
55
|
-
xls: { format: 'spreadsheet', description: '
|
|
56
|
-
xlsx: { format: 'spreadsheet', description: '
|
|
57
|
-
zip: { format: 'archive', description: '
|
|
2
|
+
'7z': { format: 'archive', description: 'compressedArchive' },
|
|
3
|
+
ace: { format: 'archive', description: 'compressedArchive' },
|
|
4
|
+
ai: { format: 'vector', description: 'fileAI' },
|
|
5
|
+
dart: { format: 'code', description: 'dart' },
|
|
6
|
+
db: { format: 'data', description: 'fileDB' },
|
|
7
|
+
default: { format: 'attachment', description: 'unknown' },
|
|
8
|
+
dmg: { format: 'executable', description: 'appleDiskImage' },
|
|
9
|
+
doc: { format: 'text', description: 'documentMS' },
|
|
10
|
+
docm: { format: 'text', description: 'documentMS' },
|
|
11
|
+
docx: { format: 'text', description: 'compressedDocumentMS' },
|
|
12
|
+
eml: { format: 'email', description: 'email' },
|
|
13
|
+
eps: { format: 'vector', description: 'fileEPS' },
|
|
14
|
+
exe: { format: 'executable', description: 'fileEXE' },
|
|
15
|
+
flac: { format: 'audio', description: 'uncompressedAudio' },
|
|
16
|
+
gif: { format: 'image', description: 'compressedImage', preview: true },
|
|
17
|
+
htm: { format: 'markup', description: 'documentWeb' },
|
|
18
|
+
heic: { format: 'image', description: 'imageHEFF' },
|
|
19
|
+
html: { format: 'markup', description: 'documentWeb' },
|
|
20
|
+
jpe: { format: 'image', description: 'compressedImage', preview: true },
|
|
21
|
+
jpeg: { format: 'image', description: 'compressedImage', preview: true },
|
|
22
|
+
jpg: { format: 'image', description: 'compressedImage', preview: true },
|
|
23
|
+
js: { format: 'code', description: 'fileJS' },
|
|
24
|
+
json: { format: 'data', description: 'fileJSON' },
|
|
25
|
+
jsx: { format: 'code', description: 'fileJS' },
|
|
26
|
+
m2v: { format: 'video', description: 'videoSD' },
|
|
27
|
+
mp2: { format: 'audio', description: 'compressedAudio' },
|
|
28
|
+
mp3: { format: 'audio', description: 'compressedAudio' },
|
|
29
|
+
mp4: { format: 'video', description: 'videoHD' },
|
|
30
|
+
mp4v: { format: 'video', description: 'videoHD' },
|
|
31
|
+
mpeg: { format: 'video', description: 'videoSD' },
|
|
32
|
+
mpg4: { format: 'video', description: 'videoSD' },
|
|
33
|
+
mpg: { format: 'video', description: 'videoSD' },
|
|
34
|
+
mpga: { format: 'audio', description: 'compressedAudio' },
|
|
35
|
+
odp: { format: 'slide', description: 'slideLO' },
|
|
36
|
+
ods: { format: 'spreadsheet', description: 'spreadsheetLO' },
|
|
37
|
+
odt: { format: 'text', description: 'documentLO' },
|
|
38
|
+
pdf: { format: 'document', description: 'documentAdobe' },
|
|
39
|
+
php: { format: 'code', description: 'filePHP' },
|
|
40
|
+
png: { format: 'image', description: 'imagePNG', preview: true },
|
|
41
|
+
ppt: { format: 'slide', description: 'slidePowerPoint' },
|
|
42
|
+
rar: { format: 'archive', description: 'compressedArchive' },
|
|
43
|
+
rtf: { format: 'text', description: 'documentRTF' },
|
|
44
|
+
sass: { format: 'code', description: 'fileSASS' },
|
|
45
|
+
shtml: { format: 'markup', description: 'documentWeb' },
|
|
46
|
+
svg: { format: 'vector', description: 'imageSVG', preview: true },
|
|
47
|
+
tar: { format: 'archive', description: 'uncompressedArchive' },
|
|
48
|
+
tiff: { format: 'image', description: 'imageTIFF' },
|
|
49
|
+
ts: { format: 'code', description: 'fileTS' },
|
|
50
|
+
tsx: { format: 'code', description: 'fileTSX' },
|
|
51
|
+
txt: { format: 'text', description: 'documentTXT' },
|
|
52
|
+
wav: { format: 'audio', description: 'uncompressedAudio' },
|
|
53
|
+
webp: { format: 'image', description: 'imageWEBP', preview: true },
|
|
54
|
+
xar: { format: 'archive', description: 'compressedArchive' },
|
|
55
|
+
xls: { format: 'spreadsheet', description: 'spreadsheetMS' },
|
|
56
|
+
xlsx: { format: 'spreadsheet', description: 'spreadsheetMS' },
|
|
57
|
+
zip: { format: 'archive', description: 'compressedArchive' },
|
|
58
58
|
};
|
|
59
|
+
// const fileExtensionsDictionary: FileExtenstion = {
|
|
60
|
+
// '7z': { format: 'archive', description: 'Archivio compresso' },
|
|
61
|
+
// ace: { format: 'archive', description: 'Archivio compresso' },
|
|
62
|
+
// ai: { format: 'vector', description: 'Vettoriale Adobe Illustrator' },
|
|
63
|
+
// dart: { format: 'code', description: 'Dart' },
|
|
64
|
+
// db: { format: 'data', description: 'File di database' },
|
|
65
|
+
// default: { format: 'attachment', description: 'Formato sconosciuto' },
|
|
66
|
+
// dmg: { format: 'executable', description: 'Apple Disk Image' },
|
|
67
|
+
// doc: { format: 'text', description: 'Documento Microsoft Word' },
|
|
68
|
+
// docm: { format: 'text', description: 'Documento Microsoft Word' },
|
|
69
|
+
// docx: { format: 'text', description: 'Documento Microsoft Word Compresso' },
|
|
70
|
+
// eml: { format: 'email', description: 'E-mail di posta elettronica' },
|
|
71
|
+
// eps: { format: 'vector', description: 'Vettoriale Corel Draw' },
|
|
72
|
+
// exe: { format: 'executable', description: 'File eseguibile Windows' },
|
|
73
|
+
// flac: { format: 'audio', description: 'Audio non compresso' },
|
|
74
|
+
// gif: { format: 'image', description: 'Immagine compressa', preview: true },
|
|
75
|
+
// htm: { format: 'markup', description: 'Pagina web' },
|
|
76
|
+
// heic: { format: 'image', description: 'High Efficiency Image File Format' },
|
|
77
|
+
// html: { format: 'markup', description: 'Pagina web' },
|
|
78
|
+
// jpe: { format: 'image', description: 'Immagine compressa', preview: true },
|
|
79
|
+
// jpeg: { format: 'image', description: 'Immagine compressa', preview: true },
|
|
80
|
+
// jpg: { format: 'image', description: 'Immagine compressa', preview: true },
|
|
81
|
+
// js: { format: 'code', description: 'JavaScript' },
|
|
82
|
+
// json: { format: 'data', description: 'JavaScript Object Notation' },
|
|
83
|
+
// jsx: { format: 'code', description: 'JavaScript' },
|
|
84
|
+
// m2v: { format: 'video', description: 'Filmato SD' },
|
|
85
|
+
// mp2: { format: 'audio', description: 'Audio compresso' },
|
|
86
|
+
// mp3: { format: 'audio', description: 'Audio compresso' },
|
|
87
|
+
// mp4: { format: 'video', description: 'Filmato HD' },
|
|
88
|
+
// mp4v: { format: 'video', description: 'Filmato HD' },
|
|
89
|
+
// mpeg: { format: 'video', description: 'Filmato SD' },
|
|
90
|
+
// mpg4: { format: 'video', description: 'Filmato SD' },
|
|
91
|
+
// mpg: { format: 'video', description: 'Filmato SD' },
|
|
92
|
+
// mpga: { format: 'audio', description: 'Audio compresso' },
|
|
93
|
+
// odp: { format: 'slide', description: 'Slide di presentazione LibreOffice' },
|
|
94
|
+
// ods: { format: 'spreadsheet', description: 'Foglio di calcolo LibreOffice' },
|
|
95
|
+
// odt: { format: 'text', description: 'File di testo LibreOffice' },
|
|
96
|
+
// pdf: { format: 'document', description: 'Documento Adobe' },
|
|
97
|
+
// php: { format: 'code', description: 'Hypertext Preprocessor' },
|
|
98
|
+
// png: { format: 'image', description: 'Immagine Portable Network Graphics', preview: true },
|
|
99
|
+
// ppt: { format: 'slide', description: 'Slide di presentazione PowerPoint' },
|
|
100
|
+
// rar: { format: 'archive', description: 'Archivio compresso' },
|
|
101
|
+
// rtf: { format: 'text', description: 'Documento di testo Rich Text Format' },
|
|
102
|
+
// sass: { format: 'code', description: 'Syntactically Awesome StyleSheets' },
|
|
103
|
+
// shtml: { format: 'markup', description: 'Pagina web' },
|
|
104
|
+
// svg: { format: 'vector', description: 'Scalable Vector Graphics', preview: true },
|
|
105
|
+
// tar: { format: 'archive', description: 'Archivio non compresso' },
|
|
106
|
+
// tiff: { format: 'image', description: 'Tag Image File Format' },
|
|
107
|
+
// ts: { format: 'code', description: 'TypeScript' },
|
|
108
|
+
// tsx: { format: 'code', description: 'TypeScript Extended Syntax' },
|
|
109
|
+
// txt: { format: 'text', description: 'Documento di testo non formattato' },
|
|
110
|
+
// wav: { format: 'audio', description: 'Audio non compresso' },
|
|
111
|
+
// webp: { format: 'image', description: 'Immagine Web Picture', preview: true },
|
|
112
|
+
// xar: { format: 'archive', description: 'Archivio compresso' },
|
|
113
|
+
// xls: { format: 'spreadsheet', description: 'Foglio di calcolo Office' },
|
|
114
|
+
// xlsx: { format: 'spreadsheet', description: 'Foglio di calcolo Office' },
|
|
115
|
+
// zip: { format: 'archive', description: 'Archivio compresso' },
|
|
116
|
+
// }
|
|
59
117
|
const genericMimeToExt = new Map([
|
|
60
118
|
['image', ['.png', '.jpg', '.jpeg', '.tiff', '.webp', '.jpe', '.gif', '.heic']],
|
|
61
119
|
['audio', ['.mp2', '.mp3', '.mpga', '.wav', '.flac']],
|
|
@@ -1,6 +1,65 @@
|
|
|
1
|
+
const typographyTagDictionary = [
|
|
2
|
+
'abbr',
|
|
3
|
+
'address',
|
|
4
|
+
'article',
|
|
5
|
+
'b',
|
|
6
|
+
'bdo',
|
|
7
|
+
'blockquote',
|
|
8
|
+
'cite',
|
|
9
|
+
'code',
|
|
10
|
+
'dd',
|
|
11
|
+
'del',
|
|
12
|
+
'details',
|
|
13
|
+
'dfn',
|
|
14
|
+
'div',
|
|
15
|
+
'dl',
|
|
16
|
+
'dt',
|
|
17
|
+
'em',
|
|
18
|
+
'figcaption',
|
|
19
|
+
'h1',
|
|
20
|
+
'h2',
|
|
21
|
+
'h3',
|
|
22
|
+
'h4',
|
|
23
|
+
'h5',
|
|
24
|
+
'h6',
|
|
25
|
+
'i',
|
|
26
|
+
'ins',
|
|
27
|
+
'kbd',
|
|
28
|
+
'label',
|
|
29
|
+
'legend',
|
|
30
|
+
'li',
|
|
31
|
+
'mark',
|
|
32
|
+
'ol',
|
|
33
|
+
'p',
|
|
34
|
+
'pre',
|
|
35
|
+
'q',
|
|
36
|
+
'rb',
|
|
37
|
+
'rt',
|
|
38
|
+
'ruby',
|
|
39
|
+
's',
|
|
40
|
+
'samp',
|
|
41
|
+
'small',
|
|
42
|
+
'span',
|
|
43
|
+
'strong',
|
|
44
|
+
'sub',
|
|
45
|
+
'summary',
|
|
46
|
+
'sup',
|
|
47
|
+
'time',
|
|
48
|
+
'u',
|
|
49
|
+
'ul',
|
|
50
|
+
'var',
|
|
51
|
+
];
|
|
52
|
+
const typographyHeadingTagDictionary = [
|
|
53
|
+
'h1',
|
|
54
|
+
'h2',
|
|
55
|
+
'h3',
|
|
56
|
+
'h4',
|
|
57
|
+
'h5',
|
|
58
|
+
'h6',
|
|
59
|
+
];
|
|
1
60
|
const truncateDictionary = [
|
|
2
61
|
'all',
|
|
3
62
|
'none',
|
|
4
63
|
'word',
|
|
5
64
|
];
|
|
6
|
-
export { truncateDictionary, };
|
|
65
|
+
export { truncateDictionary, typographyHeadingTagDictionary, typographyTagDictionary, };
|
|
@@ -11,7 +11,9 @@ const MdsAccordionTimer$1 = /*@__PURE__*/ proxyCustomElement(class MdsAccordionT
|
|
|
11
11
|
this.changeEvent = createEvent(this, "mdsAccordionTimerChange", 7);
|
|
12
12
|
this.currentDuration = 0;
|
|
13
13
|
this.clearIntervals = () => {
|
|
14
|
-
window
|
|
14
|
+
if (typeof window !== 'undefined') {
|
|
15
|
+
window.clearInterval(this.timeChecker);
|
|
16
|
+
}
|
|
15
17
|
this.timeChecker = 0;
|
|
16
18
|
};
|
|
17
19
|
this.remainingTime = () => {
|
|
@@ -22,16 +24,18 @@ const MdsAccordionTimer$1 = /*@__PURE__*/ proxyCustomElement(class MdsAccordionT
|
|
|
22
24
|
return Math.abs(this.remainingTime() / this.currentDuration - 1);
|
|
23
25
|
};
|
|
24
26
|
this.addTimeListener = () => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
this.selectedItem
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
if (typeof window !== 'undefined') {
|
|
28
|
+
this.timeChecker = window.setInterval(() => {
|
|
29
|
+
const progress = this.progress();
|
|
30
|
+
if (this.selectedItem !== undefined) {
|
|
31
|
+
this.selectedItem.progress = progress;
|
|
32
|
+
}
|
|
33
|
+
if (progress === 1) {
|
|
34
|
+
this.selectedItem.progress = 0;
|
|
35
|
+
this.startNext();
|
|
36
|
+
}
|
|
37
|
+
}, 100);
|
|
38
|
+
}
|
|
35
39
|
};
|
|
36
40
|
this.beginningTime = () => {
|
|
37
41
|
this.timeStarted = (new Date()).getTime();
|
|
@@ -136,7 +140,7 @@ const MdsAccordionTimer$1 = /*@__PURE__*/ proxyCustomElement(class MdsAccordionT
|
|
|
136
140
|
this.playTimer();
|
|
137
141
|
}
|
|
138
142
|
render() {
|
|
139
|
-
return (h(Host, { key: '
|
|
143
|
+
return (h(Host, { key: '9816683b4c8bacb97302685b1f1b45ff8ab1a209' }, h("slot", { key: 'b411a4cdbb6f133f871979df4eccd70433567b56' })));
|
|
140
144
|
}
|
|
141
145
|
get element() { return this; }
|
|
142
146
|
static get watchers() { return {
|
package/dist/documentation.json
CHANGED
|
@@ -9,7 +9,9 @@ const MdsAccordionTimer = class {
|
|
|
9
9
|
this.changeEvent = createEvent(this, "mdsAccordionTimerChange", 7);
|
|
10
10
|
this.currentDuration = 0;
|
|
11
11
|
this.clearIntervals = () => {
|
|
12
|
-
window
|
|
12
|
+
if (typeof window !== 'undefined') {
|
|
13
|
+
window.clearInterval(this.timeChecker);
|
|
14
|
+
}
|
|
13
15
|
this.timeChecker = 0;
|
|
14
16
|
};
|
|
15
17
|
this.remainingTime = () => {
|
|
@@ -20,16 +22,18 @@ const MdsAccordionTimer = class {
|
|
|
20
22
|
return Math.abs(this.remainingTime() / this.currentDuration - 1);
|
|
21
23
|
};
|
|
22
24
|
this.addTimeListener = () => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
this.selectedItem
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
if (typeof window !== 'undefined') {
|
|
26
|
+
this.timeChecker = window.setInterval(() => {
|
|
27
|
+
const progress = this.progress();
|
|
28
|
+
if (this.selectedItem !== undefined) {
|
|
29
|
+
this.selectedItem.progress = progress;
|
|
30
|
+
}
|
|
31
|
+
if (progress === 1) {
|
|
32
|
+
this.selectedItem.progress = 0;
|
|
33
|
+
this.startNext();
|
|
34
|
+
}
|
|
35
|
+
}, 100);
|
|
36
|
+
}
|
|
33
37
|
};
|
|
34
38
|
this.beginningTime = () => {
|
|
35
39
|
this.timeStarted = (new Date()).getTime();
|
|
@@ -134,7 +138,7 @@ const MdsAccordionTimer = class {
|
|
|
134
138
|
this.playTimer();
|
|
135
139
|
}
|
|
136
140
|
render() {
|
|
137
|
-
return (h(Host, { key: '
|
|
141
|
+
return (h(Host, { key: '9816683b4c8bacb97302685b1f1b45ff8ab1a209' }, h("slot", { key: 'b411a4cdbb6f133f871979df4eccd70433567b56' })));
|
|
138
142
|
}
|
|
139
143
|
get element() { return getElement(this); }
|
|
140
144
|
static get watchers() { return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-af411208.js";var mdsAccordionTimerCss="@tailwind utilities;\n\n/**\n * @prop --mds-accordion-timer-progress-bar-color: Sets the color of the progress bar when the mds-accordion-timer-item is selected\n * @prop --mds-accordion-timer-progress-bar-background: Sets the background-color of the progress bar when the mds-accordion-timer-item is selected\n * @prop --mds-accordion-timer-color: Sets the text color of the component mds-accordion-timer-item\n * @prop --mds-accordion-timer-progress-bar-thickness: Sets thickness of the progress bar of the mds-accordion-timer-item\n * @prop --mds-accordion-timer-duration: Sets the transition duration of open/close animation of the mds-accordion-timer-item\n */\n\n:host {\n\n --mds-accordion-timer-progress-bar-color: rgb(var(--tone-neutral-03));\n --mds-accordion-timer-progress-bar-background: rgb(var(--tone-neutral-08));\n --mds-accordion-timer-progress-bar-thickness: 0.25rem;\n --mds-accordion-timer-duration: 500ms;\n\n /* comment */\n display: block;\n}\n\n@container style(--magma-pref-animation: reduce) {\n :host {\n\n --mds-accordion-timer-item-duration: var(--mds-accordion-timer-duration, 0s);\n\n }\n}\n\n@container style(--magma-pref-animation: system) {\n\n @media (prefers-reduced-motion) {\n :host {\n\n --mds-accordion-timer-item-duration: var(--mds-accordion-timer-duration, 0s);\n\n }\n }\n}\n";var MdsAccordionTimerStyle0=mdsAccordionTimerCss;var MdsAccordionTimer=function(){function t(t){var i=this;registerInstance(this,t);this.changeEvent=createEvent(this,"mdsAccordionTimerChange",7);this.currentDuration=0;this.clearIntervals=function(){window.clearInterval(i.timeChecker)
|
|
1
|
+
import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-af411208.js";var mdsAccordionTimerCss="@tailwind utilities;\n\n/**\n * @prop --mds-accordion-timer-progress-bar-color: Sets the color of the progress bar when the mds-accordion-timer-item is selected\n * @prop --mds-accordion-timer-progress-bar-background: Sets the background-color of the progress bar when the mds-accordion-timer-item is selected\n * @prop --mds-accordion-timer-color: Sets the text color of the component mds-accordion-timer-item\n * @prop --mds-accordion-timer-progress-bar-thickness: Sets thickness of the progress bar of the mds-accordion-timer-item\n * @prop --mds-accordion-timer-duration: Sets the transition duration of open/close animation of the mds-accordion-timer-item\n */\n\n:host {\n\n --mds-accordion-timer-progress-bar-color: rgb(var(--tone-neutral-03));\n --mds-accordion-timer-progress-bar-background: rgb(var(--tone-neutral-08));\n --mds-accordion-timer-progress-bar-thickness: 0.25rem;\n --mds-accordion-timer-duration: 500ms;\n\n /* comment */\n display: block;\n}\n\n@container style(--magma-pref-animation: reduce) {\n :host {\n\n --mds-accordion-timer-item-duration: var(--mds-accordion-timer-duration, 0s);\n\n }\n}\n\n@container style(--magma-pref-animation: system) {\n\n @media (prefers-reduced-motion) {\n :host {\n\n --mds-accordion-timer-item-duration: var(--mds-accordion-timer-duration, 0s);\n\n }\n }\n}\n";var MdsAccordionTimerStyle0=mdsAccordionTimerCss;var MdsAccordionTimer=function(){function t(t){var i=this;registerInstance(this,t);this.changeEvent=createEvent(this,"mdsAccordionTimerChange",7);this.currentDuration=0;this.clearIntervals=function(){if(typeof window!=="undefined"){window.clearInterval(i.timeChecker)}i.timeChecker=0};this.remainingTime=function(){var t=i.selectedItemRemainingTime-((new Date).getTime()-i.timeStarted);return t>=0?t:0};this.progress=function(){return Math.abs(i.remainingTime()/i.currentDuration-1)};this.addTimeListener=function(){if(typeof window!=="undefined"){i.timeChecker=window.setInterval((function(){var t=i.progress();if(i.selectedItem!==undefined){i.selectedItem.progress=t}if(t===1){i.selectedItem.progress=0;i.startNext()}}),100)}};this.beginningTime=function(){i.timeStarted=(new Date).getTime();return i.timeStarted};this.setSelectedItem=function(t){i.children.forEach((function(n,e){if(e===t){n.selected=true;n.duration?i.currentDuration=n.duration:i.currentDuration=i.duration;i.selectedItem=n;i.changeEvent.emit({index:e})}else{n.selected=false}}))};this.startNext=function(){var t=i.selectedItem.uuid+1>i.children.length-1?0:i.selectedItem.uuid+1;i.setSelectedItem(t);i.startTimer()};this.startTimer=function(){i.clearIntervals();i.time=i.beginningTime();i.selectedItemRemainingTime=i.currentDuration;i.addTimeListener()};this.playTimer=function(){i.beginningTime();i.addTimeListener()};this.pauseTimer=function(){i.clearIntervals();i.selectedItemRemainingTime=i.remainingTime()};this.stopTimer=function(){i.clearIntervals()};this.time=0;this.duration=1e4;this.paused=undefined}t.prototype.componentDidLoad=function(){var t=this;this.children=this.element.querySelectorAll("mds-accordion-timer-item");this.children.forEach((function(i,n){i.uuid=n;if(i.selected){i.duration?t.currentDuration=i.duration:t.currentDuration=t.duration;t.selectedItem=i}}));if(this.selectedItem!==undefined){this.startTimer()}if(this.paused){this.pauseTimer()}};t.prototype.disconnectedCallback=function(){this.stopTimer();this.clearIntervals()};t.prototype.onClickSelect=function(t){this.clearIntervals();if(this.selectedItem){this.selectedItem.progress=0}this.setSelectedItem(t.detail.uuid);this.startTimer();this.pauseTimer()};t.prototype.onSelect=function(t){this.clearIntervals();this.paused=false;if(this.selectedItem){this.selectedItem.progress=0}this.setSelectedItem(t.detail.uuid);this.startTimer()};t.prototype.onMouseEnterSelect=function(){if(this.paused){return}this.pauseTimer()};t.prototype.onMouseLeaveSelect=function(){if(this.paused){return}if(this.timeChecker===0){this.playTimer()}};t.prototype.handlePaused=function(t){if(t){this.pauseTimer();return}this.playTimer()};t.prototype.render=function(){return h(Host,{key:"9816683b4c8bacb97302685b1f1b45ff8ab1a209"},h("slot",{key:"b411a4cdbb6f133f871979df4eccd70433567b56"}))};Object.defineProperty(t.prototype,"element",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{paused:["handlePaused"]}},enumerable:false,configurable:true});return t}();MdsAccordionTimer.style=MdsAccordionTimerStyle0;export{MdsAccordionTimer as mds_accordion_timer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as o}from"./p-8dd37a13.js";export{s as setNonce}from"./p-8dd37a13.js";import{g as t}from"./p-e1255160.js";(()=>{const o=import.meta.url,t={};return""!==o&&(t.resourcesUrl=new URL(".",o).href),e(t)})().then((async e=>(await t(),o([["p-
|
|
1
|
+
import{p as e,b as o}from"./p-8dd37a13.js";export{s as setNonce}from"./p-8dd37a13.js";import{g as t}from"./p-e1255160.js";(()=>{const o=import.meta.url,t={};return""!==o&&(t.resourcesUrl=new URL(".",o).href),e(t)})().then((async e=>(await t(),o([["p-86e0d6b4",[[1,"mds-accordion-timer",{duration:[514],paused:[516],time:[32]},[[0,"mdsAccordionTimerItemClickSelect","onClickSelect"],[0,"mdsAccordionTimerItemSelect","onSelect"],[0,"mdsAccordionTimerItemMouseEnterSelect","onMouseEnterSelect"],[0,"mdsAccordionTimerItemMouseLeaveSelect","onMouseLeaveSelect"]],{paused:["handlePaused"]}]]]],e))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,c){function o(e){try{s(r.next(e))}catch(e){c(e)}}function u(e){try{s(r["throw"](e))}catch(e){c(e)}}function s(e){e.done?n(e.value):i(e.value).then(o,u)}s((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(c[0]&1)throw c[1];return c[1]},trys:[],ops:[]},r,i,c,o;return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(e){return function(t){return s([e,t])}}function s(u){if(r)throw new TypeError("Generator is already executing.");while(o&&(o=0,u[0]&&(n=0)),n)try{if(r=1,i&&(c=u[0]&2?i["return"]:u[0]?i["throw"]||((c=i["return"])&&c.call(i),0):i.next)&&!(c=c.call(i,u[1])).done)return c;if(i=0,c)u=[u[0]&2,c.value];switch(u[0]){case 0:case 1:c=u;break;case 4:n.label++;return{value:u[1],done:false};case 5:n.label++;i=u[1];u=[0];continue;case 7:u=n.ops.pop();n.trys.pop();continue;default:if(!(c=n.trys,c=c.length>0&&c[c.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!c||u[1]>c[0]&&u[1]<c[3])){n.label=u[1];break}if(u[0]===6&&n.label<c[1]){n.label=c[1];c=u;break}if(c&&n.label<c[2]){n.label=c[2];n.ops.push(u);break}if(c[2])n.ops.pop();n.trys.pop();continue}u=t.call(e,n)}catch(e){u=[6,e];i=0}finally{r=c=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};System.register(["./p-62c48ff3.system.js","./p-56ba5cbf.system.js"],(function(e,t){"use strict";var n,r,i;return{setters:[function(t){n=t.p;r=t.b;e("setNonce",t.s)},function(e){i=e.g}],execute:function(){var e=this;var c=function(){var e=t.meta.url;var r={};if(e!==""){r.resourcesUrl=new URL(".",e).href}return n(r)};c().then((function(t){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,i()];case 1:e.sent();return[2,r([["p-
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,c){function o(e){try{s(r.next(e))}catch(e){c(e)}}function u(e){try{s(r["throw"](e))}catch(e){c(e)}}function s(e){e.done?n(e.value):i(e.value).then(o,u)}s((r=r.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(c[0]&1)throw c[1];return c[1]},trys:[],ops:[]},r,i,c,o;return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(e){return function(t){return s([e,t])}}function s(u){if(r)throw new TypeError("Generator is already executing.");while(o&&(o=0,u[0]&&(n=0)),n)try{if(r=1,i&&(c=u[0]&2?i["return"]:u[0]?i["throw"]||((c=i["return"])&&c.call(i),0):i.next)&&!(c=c.call(i,u[1])).done)return c;if(i=0,c)u=[u[0]&2,c.value];switch(u[0]){case 0:case 1:c=u;break;case 4:n.label++;return{value:u[1],done:false};case 5:n.label++;i=u[1];u=[0];continue;case 7:u=n.ops.pop();n.trys.pop();continue;default:if(!(c=n.trys,c=c.length>0&&c[c.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!c||u[1]>c[0]&&u[1]<c[3])){n.label=u[1];break}if(u[0]===6&&n.label<c[1]){n.label=c[1];c=u;break}if(c&&n.label<c[2]){n.label=c[2];n.ops.push(u);break}if(c[2])n.ops.pop();n.trys.pop();continue}u=t.call(e,n)}catch(e){u=[6,e];i=0}finally{r=c=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:true}}};System.register(["./p-62c48ff3.system.js","./p-56ba5cbf.system.js"],(function(e,t){"use strict";var n,r,i;return{setters:[function(t){n=t.p;r=t.b;e("setNonce",t.s)},function(e){i=e.g}],execute:function(){var e=this;var c=function(){var e=t.meta.url;var r={};if(e!==""){r.resourcesUrl=new URL(".",e).href}return n(r)};c().then((function(t){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,i()];case 1:e.sent();return[2,r([["p-4eb3ec08.system",[[1,"mds-accordion-timer",{duration:[514],paused:[516],time:[32]},[[0,"mdsAccordionTimerItemClickSelect","onClickSelect"],[0,"mdsAccordionTimerItemSelect","onSelect"],[0,"mdsAccordionTimerItemMouseEnterSelect","onMouseEnterSelect"],[0,"mdsAccordionTimerItemMouseLeaveSelect","onMouseLeaveSelect"]],{paused:["handlePaused"]}]]]],t)]}}))}))}))}}}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
System.register(["./p-62c48ff3.system.js"],(function(t){"use strict";var n,i,e,r,o;return{setters:[function(t){n=t.r;i=t.c;e=t.h;r=t.H;o=t.g}],execute:function(){var s="@tailwind utilities;\n\n/**\n * @prop --mds-accordion-timer-progress-bar-color: Sets the color of the progress bar when the mds-accordion-timer-item is selected\n * @prop --mds-accordion-timer-progress-bar-background: Sets the background-color of the progress bar when the mds-accordion-timer-item is selected\n * @prop --mds-accordion-timer-color: Sets the text color of the component mds-accordion-timer-item\n * @prop --mds-accordion-timer-progress-bar-thickness: Sets thickness of the progress bar of the mds-accordion-timer-item\n * @prop --mds-accordion-timer-duration: Sets the transition duration of open/close animation of the mds-accordion-timer-item\n */\n\n:host {\n\n --mds-accordion-timer-progress-bar-color: rgb(var(--tone-neutral-03));\n --mds-accordion-timer-progress-bar-background: rgb(var(--tone-neutral-08));\n --mds-accordion-timer-progress-bar-thickness: 0.25rem;\n --mds-accordion-timer-duration: 500ms;\n\n /* comment */\n display: block;\n}\n\n@container style(--magma-pref-animation: reduce) {\n :host {\n\n --mds-accordion-timer-item-duration: var(--mds-accordion-timer-duration, 0s);\n\n }\n}\n\n@container style(--magma-pref-animation: system) {\n\n @media (prefers-reduced-motion) {\n :host {\n\n --mds-accordion-timer-item-duration: var(--mds-accordion-timer-duration, 0s);\n\n }\n }\n}\n";var c=s;var a=t("mds_accordion_timer",function(){function t(t){var e=this;n(this,t);this.changeEvent=i(this,"mdsAccordionTimerChange",7);this.currentDuration=0;this.clearIntervals=function(){if(typeof window!=="undefined"){window.clearInterval(e.timeChecker)}e.timeChecker=0};this.remainingTime=function(){var t=e.selectedItemRemainingTime-((new Date).getTime()-e.timeStarted);return t>=0?t:0};this.progress=function(){return Math.abs(e.remainingTime()/e.currentDuration-1)};this.addTimeListener=function(){if(typeof window!=="undefined"){e.timeChecker=window.setInterval((function(){var t=e.progress();if(e.selectedItem!==undefined){e.selectedItem.progress=t}if(t===1){e.selectedItem.progress=0;e.startNext()}}),100)}};this.beginningTime=function(){e.timeStarted=(new Date).getTime();return e.timeStarted};this.setSelectedItem=function(t){e.children.forEach((function(n,i){if(i===t){n.selected=true;n.duration?e.currentDuration=n.duration:e.currentDuration=e.duration;e.selectedItem=n;e.changeEvent.emit({index:i})}else{n.selected=false}}))};this.startNext=function(){var t=e.selectedItem.uuid+1>e.children.length-1?0:e.selectedItem.uuid+1;e.setSelectedItem(t);e.startTimer()};this.startTimer=function(){e.clearIntervals();e.time=e.beginningTime();e.selectedItemRemainingTime=e.currentDuration;e.addTimeListener()};this.playTimer=function(){e.beginningTime();e.addTimeListener()};this.pauseTimer=function(){e.clearIntervals();e.selectedItemRemainingTime=e.remainingTime()};this.stopTimer=function(){e.clearIntervals()};this.time=0;this.duration=1e4;this.paused=undefined}t.prototype.componentDidLoad=function(){var t=this;this.children=this.element.querySelectorAll("mds-accordion-timer-item");this.children.forEach((function(n,i){n.uuid=i;if(n.selected){n.duration?t.currentDuration=n.duration:t.currentDuration=t.duration;t.selectedItem=n}}));if(this.selectedItem!==undefined){this.startTimer()}if(this.paused){this.pauseTimer()}};t.prototype.disconnectedCallback=function(){this.stopTimer();this.clearIntervals()};t.prototype.onClickSelect=function(t){this.clearIntervals();if(this.selectedItem){this.selectedItem.progress=0}this.setSelectedItem(t.detail.uuid);this.startTimer();this.pauseTimer()};t.prototype.onSelect=function(t){this.clearIntervals();this.paused=false;if(this.selectedItem){this.selectedItem.progress=0}this.setSelectedItem(t.detail.uuid);this.startTimer()};t.prototype.onMouseEnterSelect=function(){if(this.paused){return}this.pauseTimer()};t.prototype.onMouseLeaveSelect=function(){if(this.paused){return}if(this.timeChecker===0){this.playTimer()}};t.prototype.handlePaused=function(t){if(t){this.pauseTimer();return}this.playTimer()};t.prototype.render=function(){return e(r,{key:"9816683b4c8bacb97302685b1f1b45ff8ab1a209"},e("slot",{key:"b411a4cdbb6f133f871979df4eccd70433567b56"}))};Object.defineProperty(t.prototype,"element",{get:function(){return o(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{paused:["handlePaused"]}},enumerable:false,configurable:true});return t}());a.style=c}}}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as i,h as s,H as e,g as o}from"./p-8dd37a13.js";const n=class{constructor(s){t(this,s),this.changeEvent=i(this,"mdsAccordionTimerChange",7),this.currentDuration=0,this.clearIntervals=()=>{"undefined"!=typeof window&&window.clearInterval(this.timeChecker),this.timeChecker=0},this.remainingTime=()=>{const t=this.selectedItemRemainingTime-((new Date).getTime()-this.timeStarted);return t>=0?t:0},this.progress=()=>Math.abs(this.remainingTime()/this.currentDuration-1),this.addTimeListener=()=>{"undefined"!=typeof window&&(this.timeChecker=window.setInterval((()=>{const t=this.progress();void 0!==this.selectedItem&&(this.selectedItem.progress=t),1===t&&(this.selectedItem.progress=0,this.startNext())}),100))},this.beginningTime=()=>(this.timeStarted=(new Date).getTime(),this.timeStarted),this.setSelectedItem=t=>{this.children.forEach(((i,s)=>{s===t?(i.selected=!0,this.currentDuration=i.duration?i.duration:this.duration,this.selectedItem=i,this.changeEvent.emit({index:s})):i.selected=!1}))},this.startNext=()=>{this.setSelectedItem(this.selectedItem.uuid+1>this.children.length-1?0:this.selectedItem.uuid+1),this.startTimer()},this.startTimer=()=>{this.clearIntervals(),this.time=this.beginningTime(),this.selectedItemRemainingTime=this.currentDuration,this.addTimeListener()},this.playTimer=()=>{this.beginningTime(),this.addTimeListener()},this.pauseTimer=()=>{this.clearIntervals(),this.selectedItemRemainingTime=this.remainingTime()},this.stopTimer=()=>{this.clearIntervals()},this.time=0,this.duration=1e4,this.paused=void 0}componentDidLoad(){this.children=this.element.querySelectorAll("mds-accordion-timer-item"),this.children.forEach(((t,i)=>{t.uuid=i,t.selected&&(this.currentDuration=t.duration?t.duration:this.duration,this.selectedItem=t)})),void 0!==this.selectedItem&&this.startTimer(),this.paused&&this.pauseTimer()}disconnectedCallback(){this.stopTimer(),this.clearIntervals()}onClickSelect(t){this.clearIntervals(),this.selectedItem&&(this.selectedItem.progress=0),this.setSelectedItem(t.detail.uuid),this.startTimer(),this.pauseTimer()}onSelect(t){this.clearIntervals(),this.paused=!1,this.selectedItem&&(this.selectedItem.progress=0),this.setSelectedItem(t.detail.uuid),this.startTimer()}onMouseEnterSelect(){this.paused||this.pauseTimer()}onMouseLeaveSelect(){this.paused||0===this.timeChecker&&this.playTimer()}handlePaused(t){t?this.pauseTimer():this.playTimer()}render(){return s(e,{key:"9816683b4c8bacb97302685b1f1b45ff8ab1a209"},s("slot",{key:"b411a4cdbb6f133f871979df4eccd70433567b56"}))}get element(){return o(this)}static get watchers(){return{paused:["handlePaused"]}}};n.style="@tailwind utilities;\n\n/**\n * @prop --mds-accordion-timer-progress-bar-color: Sets the color of the progress bar when the mds-accordion-timer-item is selected\n * @prop --mds-accordion-timer-progress-bar-background: Sets the background-color of the progress bar when the mds-accordion-timer-item is selected\n * @prop --mds-accordion-timer-color: Sets the text color of the component mds-accordion-timer-item\n * @prop --mds-accordion-timer-progress-bar-thickness: Sets thickness of the progress bar of the mds-accordion-timer-item\n * @prop --mds-accordion-timer-duration: Sets the transition duration of open/close animation of the mds-accordion-timer-item\n */\n\n:host {\n\n --mds-accordion-timer-progress-bar-color: rgb(var(--tone-neutral-03));\n --mds-accordion-timer-progress-bar-background: rgb(var(--tone-neutral-08));\n --mds-accordion-timer-progress-bar-thickness: 0.25rem;\n --mds-accordion-timer-duration: 500ms;\n\n /* comment */\n display: block;\n}\n\n@container style(--magma-pref-animation: reduce) {\n :host {\n\n --mds-accordion-timer-item-duration: var(--mds-accordion-timer-duration, 0s);\n\n }\n}\n\n@container style(--magma-pref-animation: system) {\n\n @media (prefers-reduced-motion) {\n :host {\n\n --mds-accordion-timer-item-duration: var(--mds-accordion-timer-duration, 0s);\n\n }\n }\n}\n";export{n as mds_accordion_timer}
|