@maggioli-design-system/mds-progress 2.8.1 → 2.8.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.
- package/dist/cjs/{index-87340659.js → index-53e759e9.js} +29 -17
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mds-progress.cjs.entry.js +36 -36
- package/dist/cjs/mds-progress.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/common/aria.js +18 -18
- package/dist/collection/common/keyboard-manager.js +38 -38
- package/dist/collection/common/unit.js +7 -7
- package/dist/collection/components/mds-progress/mds-progress.css +5 -0
- package/dist/collection/components/mds-progress/mds-progress.js +142 -142
- package/dist/collection/components/mds-progress/meta/dictionary.js +2 -2
- package/dist/collection/components/mds-progress/test/mds-progress.e2e.js +7 -7
- package/dist/collection/components/mds-progress/test/mds-progress.stories.js +20 -20
- package/dist/collection/dictionary/autocomplete.js +56 -56
- package/dist/collection/dictionary/button.js +19 -19
- package/dist/collection/dictionary/color.js +14 -14
- package/dist/collection/dictionary/floating-ui.js +14 -14
- package/dist/collection/dictionary/input.js +31 -15
- package/dist/collection/dictionary/loading.js +2 -2
- package/dist/collection/dictionary/typography.js +46 -46
- package/dist/collection/dictionary/variant.js +54 -54
- package/dist/collection/fixtures/cities.js +107 -107
- package/dist/components/mds-progress.d.ts +2 -2
- package/dist/components/mds-progress.js +58 -58
- package/dist/documentation.json +2 -2
- package/dist/esm/{index-641b8321.js → index-d7c3a08c.js} +29 -17
- package/dist/esm/loader.js +2 -2
- package/dist/esm/mds-progress.entry.js +36 -36
- package/dist/esm/mds-progress.js +3 -3
- package/dist/esm-es5/{index-641b8321.js → index-d7c3a08c.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mds-progress.entry.js +1 -1
- package/dist/esm-es5/mds-progress.js +1 -1
- package/dist/mds-progress/mds-progress.esm.js +1 -1
- package/dist/mds-progress/mds-progress.js +15 -15
- package/dist/mds-progress/{p-ae73d6e3.system.js → p-3fd7c0e1.system.js} +1 -1
- package/dist/mds-progress/{p-5cb282f0.system.js → p-72564754.system.js} +1 -1
- package/dist/mds-progress/{p-82cf4718.entry.js → p-ba0c7117.entry.js} +1 -1
- package/dist/mds-progress/p-e157ffcb.js +2 -0
- package/dist/mds-progress/p-efdf2de7.system.entry.js +1 -0
- package/dist/stats.json +30 -30
- package/dist/types/common/keyboard-manager.d.ts +9 -9
- package/dist/types/components/mds-progress/mds-progress.d.ts +24 -24
- package/dist/types/components/mds-progress/test/mds-progress.stories.d.ts +37 -37
- package/dist/types/dictionary/input.d.ts +2 -1
- package/dist/types/interface/input-value.d.ts +1 -1
- package/dist/types/stencil-public-runtime.d.ts +8 -0
- package/documentation.json +14 -4
- package/package.json +3 -3
- package/src/components/mds-progress/mds-progress.css +1 -1
- package/src/dictionary/input.ts +18 -0
- package/src/fixtures/icons.json +3 -0
- package/src/fixtures/iconsauce.json +3 -0
- package/www/build/mds-progress.esm.js +1 -1
- package/www/build/mds-progress.js +15 -15
- package/www/build/{p-ae73d6e3.system.js → p-3fd7c0e1.system.js} +1 -1
- package/www/build/{p-5cb282f0.system.js → p-72564754.system.js} +1 -1
- package/www/build/{p-82cf4718.entry.js → p-ba0c7117.entry.js} +1 -1
- package/www/build/p-e157ffcb.js +2 -0
- package/www/build/p-efdf2de7.system.entry.js +1 -0
- package/dist/mds-progress/p-3f2f6022.system.entry.js +0 -1
- package/dist/mds-progress/p-eef73ce9.js +0 -2
- package/www/build/p-3f2f6022.system.entry.js +0 -1
- package/www/build/p-eef73ce9.js +0 -2
|
@@ -388,7 +388,11 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
388
388
|
elm[memberName] = newValue;
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
|
-
catch (e) {
|
|
391
|
+
catch (e) {
|
|
392
|
+
/**
|
|
393
|
+
* in case someone tries to set a read-only property, e.g. "namespaceURI", we just ignore it
|
|
394
|
+
*/
|
|
395
|
+
}
|
|
392
396
|
}
|
|
393
397
|
if (newValue == null || newValue === false) {
|
|
394
398
|
if (newValue !== false || elm.getAttribute(memberName) === '') {
|
|
@@ -407,6 +411,11 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
407
411
|
}
|
|
408
412
|
};
|
|
409
413
|
const parseClassListRegex = /\s/;
|
|
414
|
+
/**
|
|
415
|
+
* Parsed a string of classnames into an array
|
|
416
|
+
* @param value className string, e.g. "foo bar baz"
|
|
417
|
+
* @returns list of classes, e.g. ["foo", "bar", "baz"]
|
|
418
|
+
*/
|
|
410
419
|
const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
|
|
411
420
|
const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
|
412
421
|
// if the element passed in is a shadow root, which is a document fragment
|
|
@@ -1116,13 +1125,13 @@ const setValue = (ref, propName, newVal, cmpMeta) => {
|
|
|
1116
1125
|
*/
|
|
1117
1126
|
const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
1118
1127
|
var _a;
|
|
1128
|
+
const prototype = Cstr.prototype;
|
|
1119
1129
|
if (cmpMeta.$members$) {
|
|
1120
1130
|
if (Cstr.watchers) {
|
|
1121
1131
|
cmpMeta.$watchers$ = Cstr.watchers;
|
|
1122
1132
|
}
|
|
1123
1133
|
// It's better to have a const than two Object.entries()
|
|
1124
1134
|
const members = Object.entries(cmpMeta.$members$);
|
|
1125
|
-
const prototype = Cstr.prototype;
|
|
1126
1135
|
members.map(([memberName, [memberFlags]]) => {
|
|
1127
1136
|
if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
|
|
1128
1137
|
((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
|
|
@@ -1145,6 +1154,7 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1145
1154
|
const attrNameToPropName = new Map();
|
|
1146
1155
|
prototype.attributeChangedCallback = function (attrName, oldValue, newValue) {
|
|
1147
1156
|
plt.jmp(() => {
|
|
1157
|
+
var _a;
|
|
1148
1158
|
const propName = attrNameToPropName.get(attrName);
|
|
1149
1159
|
// In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
|
|
1150
1160
|
// in the case where an attribute was set inline.
|
|
@@ -1200,11 +1210,12 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1200
1210
|
// 1. The instance is ready
|
|
1201
1211
|
// 2. The watchers are ready
|
|
1202
1212
|
// 3. The value has changed
|
|
1203
|
-
if (
|
|
1213
|
+
if (flags &&
|
|
1214
|
+
!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) &&
|
|
1204
1215
|
flags & 128 /* HOST_FLAGS.isWatchReady */ &&
|
|
1205
1216
|
newValue !== oldValue) {
|
|
1206
1217
|
const instance = hostRef.$lazyInstance$ ;
|
|
1207
|
-
const entry = cmpMeta.$watchers$[attrName];
|
|
1218
|
+
const entry = (_a = cmpMeta.$watchers$) === null || _a === void 0 ? void 0 : _a[attrName];
|
|
1208
1219
|
entry === null || entry === void 0 ? void 0 : entry.forEach((callbackName) => {
|
|
1209
1220
|
if (instance[callbackName] != null) {
|
|
1210
1221
|
instance[callbackName].call(instance, newValue, oldValue, attrName);
|
|
@@ -1226,10 +1237,11 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
1226
1237
|
...members
|
|
1227
1238
|
.filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */)
|
|
1228
1239
|
.map(([propName, m]) => {
|
|
1240
|
+
var _a;
|
|
1229
1241
|
const attrName = m[1] || propName;
|
|
1230
1242
|
attrNameToPropName.set(attrName, propName);
|
|
1231
1243
|
if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
|
|
1232
|
-
cmpMeta.$attrsToReflect
|
|
1244
|
+
(_a = cmpMeta.$attrsToReflect$) === null || _a === void 0 ? void 0 : _a.push([propName, attrName]);
|
|
1233
1245
|
}
|
|
1234
1246
|
return attrName;
|
|
1235
1247
|
}),
|
|
@@ -1567,19 +1579,19 @@ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
1567
1579
|
return module[exportName];
|
|
1568
1580
|
}
|
|
1569
1581
|
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1582
|
+
if (!hmrVersionId || !BUILD.hotModuleReplacement) {
|
|
1583
|
+
const processMod = importedModule => {
|
|
1584
|
+
cmpModules.set(bundleId, importedModule);
|
|
1585
|
+
return importedModule[exportName];
|
|
1586
|
+
}
|
|
1587
|
+
switch(bundleId) {
|
|
1588
|
+
|
|
1589
|
+
case 'mds-progress.cjs':
|
|
1590
|
+
return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
|
|
1591
|
+
/* webpackMode: "lazy" */
|
|
1592
|
+
'./mds-progress.cjs.entry.js')); }).then(processMod, consoleError);
|
|
1593
|
+
}
|
|
1581
1594
|
}
|
|
1582
|
-
}
|
|
1583
1595
|
return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
|
|
1584
1596
|
/* @vite-ignore */
|
|
1585
1597
|
/* webpackInclude: /\.entry\.js$/ */
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-53e759e9.js');
|
|
6
6
|
|
|
7
7
|
const defineCustomElements = (win, options) => {
|
|
8
8
|
if (typeof window === 'undefined') return undefined;
|
|
@@ -2,46 +2,46 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-53e759e9.js');
|
|
6
6
|
|
|
7
|
-
const mdsProgressCss = "@tailwind utilities; :host{--mds-progress-background:rgb(var(--tone-neutral-08));--mds-progress-color:rgb(var(--brand-maggioli-03));--mds-progress-duration:750ms;--mds-progress-radius:0.5rem;--mds-progress-thickness:0.5rem;-webkit-transition-property:color, background-color, border-color, fill, stroke, -webkit-text-decoration-color;transition-property:color, background-color, border-color, fill, stroke, -webkit-text-decoration-color;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, -webkit-text-decoration-color;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transition-duration:150ms;transition-duration:150ms;background-color:var(--mds-progress-background);border-radius:var(--mds-progress-radius);display:-ms-flexbox;display:flex;height:var(--mds-progress-thickness);min-width:var(--mds-progress-thickness);overflow:hidden;width:100%}:host([direction=\"vertical\"]){-ms-flex-direction:column;flex-direction:column;height:unset;min-height:var(--mds-progress-thickness);width:var(--mds-progress-thickness)}.progress{-webkit-transition-timing-function:cubic-bezier(0.19, 1, 0.22, 1);transition-timing-function:cubic-bezier(0.19, 1, 0.22, 1);background-color:var(--mds-progress-color);border-radius:var(--mds-progress-radius);-webkit-transition-duration:var(--mds-progress-duration);transition-duration:var(--mds-progress-duration);-webkit-transition-property:background-color, flex-grow;transition-property:background-color, flex-grow;transition-property:background-color, flex-grow, -ms-flex-positive}.fixed{position:fixed}.absolute{position:absolute}.border{border-width:1px}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}:host([variant=\"dark\"]){--mds-progress-color:rgb(var(--tone-neutral-04));--mds-progress-background:rgb(var(--tone-neutral-08))}:host([variant=\"light\"]){--mds-progress-color:rgb(var(--tone-neutral));--mds-progress-background:rgb(var(--tone-neutral-05))}:host([variant=\"error\"]){--mds-progress-color:rgb(var(--status-error-06));--mds-progress-background:rgb(var(--status-error-09))}:host([variant=\"warning\"]){--mds-progress-color:rgb(var(--status-warning-06));--mds-progress-background:rgb(var(--status-warning-09))}:host([variant=\"success\"]){--mds-progress-color:rgb(var(--status-success-06));--mds-progress-background:rgb(var(--status-success-09))}:host([variant=\"info\"]){--mds-progress-color:rgb(var(--status-info-06));--mds-progress-background:rgb(var(--status-info-09))}:host([variant=\"primary\"]){--mds-progress-color:rgb(var(--brand-maggioli-03));--mds-progress-background:rgb(var(--tone-neutral-08))}";
|
|
7
|
+
const mdsProgressCss = "@tailwind utilities; :host{--mds-progress-background:rgb(var(--tone-neutral-08));--mds-progress-color:rgb(var(--brand-maggioli-03));--mds-progress-duration:750ms;--mds-progress-radius:0.5rem;--mds-progress-thickness:0.5rem;-webkit-transition-property:color, background-color, border-color, fill, stroke, -webkit-text-decoration-color;transition-property:color, background-color, border-color, fill, stroke, -webkit-text-decoration-color;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, -webkit-text-decoration-color;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transition-duration:150ms;transition-duration:150ms;background-color:var(--mds-progress-background);border-radius:var(--mds-progress-radius);display:-ms-flexbox;display:flex;height:var(--mds-progress-thickness);min-width:var(--mds-progress-thickness);overflow:hidden;width:100%}:host([direction=\"vertical\"]){-ms-flex-direction:column;flex-direction:column;height:unset;min-height:var(--mds-progress-thickness);width:var(--mds-progress-thickness)}.progress{-webkit-transition-timing-function:cubic-bezier(0.19, 1, 0.22, 1);transition-timing-function:cubic-bezier(0.19, 1, 0.22, 1);background-color:var(--mds-progress-color);border-radius:var(--mds-progress-radius);-webkit-transition-duration:var(--mds-progress-duration);transition-duration:var(--mds-progress-duration);-webkit-transition-property:background-color, flex-grow;transition-property:background-color, flex-grow;transition-property:background-color, flex-grow, -ms-flex-positive}.fixed{position:fixed}.absolute{position:absolute}.border{border-width:1px}.text{font-size:1rem}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}:host([variant=\"dark\"]){--mds-progress-color:rgb(var(--tone-neutral-04));--mds-progress-background:rgb(var(--tone-neutral-08))}:host([variant=\"light\"]){--mds-progress-color:rgb(var(--tone-neutral));--mds-progress-background:rgb(var(--tone-neutral-05))}:host([variant=\"error\"]){--mds-progress-color:rgb(var(--status-error-06));--mds-progress-background:rgb(var(--status-error-09))}:host([variant=\"warning\"]){--mds-progress-color:rgb(var(--status-warning-06));--mds-progress-background:rgb(var(--status-warning-09))}:host([variant=\"success\"]){--mds-progress-color:rgb(var(--status-success-06));--mds-progress-background:rgb(var(--status-success-09))}:host([variant=\"info\"]){--mds-progress-color:rgb(var(--status-info-06));--mds-progress-background:rgb(var(--status-info-09))}:host([variant=\"primary\"]){--mds-progress-color:rgb(var(--brand-maggioli-03));--mds-progress-background:rgb(var(--tone-neutral-08))}";
|
|
8
8
|
|
|
9
9
|
const MdsProgress = class {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
componentWillLoad() {
|
|
20
|
-
this.stepsList = this.steps.split(',');
|
|
21
|
-
this.setProgress(this.progress);
|
|
22
|
-
}
|
|
23
|
-
setProgress(progress) {
|
|
24
|
-
if (this.steps) {
|
|
25
|
-
this.currentStep = this.stepsList[Math.round(progress * (this.stepsList.length - 1))];
|
|
26
|
-
this.element.setAttribute('aria-valuetext', this.currentStep);
|
|
10
|
+
constructor(hostRef) {
|
|
11
|
+
index.registerInstance(this, hostRef);
|
|
12
|
+
this.stepsList = new Array();
|
|
13
|
+
this.currentStep = undefined;
|
|
14
|
+
this.progress = 0;
|
|
15
|
+
this.direction = 'horizontal';
|
|
16
|
+
this.variant = 'primary';
|
|
17
|
+
this.steps = 'Inizio,Un quarto,Metà,Tre quarti,Fine';
|
|
27
18
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
19
|
+
componentWillLoad() {
|
|
20
|
+
this.stepsList = this.steps.split(',');
|
|
21
|
+
this.setProgress(this.progress);
|
|
22
|
+
}
|
|
23
|
+
setProgress(progress) {
|
|
24
|
+
if (this.steps) {
|
|
25
|
+
this.currentStep = this.stepsList[Math.round(progress * (this.stepsList.length - 1))];
|
|
26
|
+
this.element.setAttribute('aria-valuetext', this.currentStep);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
progressChanged(progress) {
|
|
30
|
+
this.setProgress(progress);
|
|
31
|
+
}
|
|
32
|
+
stepsChanged(steps) {
|
|
33
|
+
this.stepsList = steps.split(',');
|
|
34
|
+
}
|
|
35
|
+
render() {
|
|
36
|
+
return (index.h(index.Host, { "aria-valuemax": "100", "aria-valuemin": "0", "aria-valuenow": Math.round(this.progress * 100), role: "progressbar" }, index.h("div", { class: "progress", style: this.direction === 'horizontal'
|
|
37
|
+
? { flexGrow: `${this.progress}` }
|
|
38
|
+
: { flexGrow: `${this.progress}`, width: '100%' } })));
|
|
39
|
+
}
|
|
40
|
+
get element() { return index.getElement(this); }
|
|
41
|
+
static get watchers() { return {
|
|
42
|
+
"progress": ["progressChanged"],
|
|
43
|
+
"steps": ["stepsChanged"]
|
|
44
|
+
}; }
|
|
45
45
|
};
|
|
46
46
|
MdsProgress.style = mdsProgressCss;
|
|
47
47
|
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-53e759e9.js');
|
|
6
6
|
|
|
7
7
|
/*
|
|
8
|
-
Stencil Client Patch Browser v4.
|
|
8
|
+
Stencil Client Patch Browser v4.8.0 | MIT Licensed | https://stenciljs.com
|
|
9
9
|
*/
|
|
10
10
|
const patchBrowser = () => {
|
|
11
11
|
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('mds-progress.cjs.js', document.baseURI).href));
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
const hash = (s) => {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
let i, h;
|
|
3
|
+
for (i = 0, h = 0; i < s.length; i++) {
|
|
4
|
+
h = Math.imul(31, h) + s.charCodeAt(i) | 0;
|
|
5
|
+
}
|
|
6
|
+
return h.toString();
|
|
7
7
|
};
|
|
8
8
|
const randomInt = (max) => Math.floor(Math.random() * max);
|
|
9
9
|
const unslugName = (name) => {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
var _a, _b, _c;
|
|
11
|
+
return (_c = (_b = (_a = name.split('/')) === null || _a === void 0 ? void 0 : _a.slice(-1).pop()) === null || _b === void 0 ? void 0 : _b.replace(/-/g, ' ')) !== null && _c !== void 0 ? _c : name;
|
|
12
12
|
};
|
|
13
13
|
const setAttributeIfEmpty = (element, attribute, value) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
var _a;
|
|
15
|
+
if (element.hasAttribute(attribute)) {
|
|
16
|
+
return (_a = element.getAttribute(attribute)) !== null && _a !== void 0 ? _a : '';
|
|
17
|
+
}
|
|
18
|
+
element.setAttribute(attribute, value);
|
|
19
|
+
return value;
|
|
20
20
|
};
|
|
21
21
|
const hashValue = (value) => `${value}-${hash(value)}`;
|
|
22
22
|
const hashRandomValue = (value) => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
const randomValue = randomInt(1000000);
|
|
24
|
+
if (value) {
|
|
25
|
+
return `${value}-${hash(randomValue.toString())}`;
|
|
26
|
+
}
|
|
27
|
+
return hash(randomValue.toString());
|
|
28
28
|
};
|
|
29
29
|
export { unslugName, setAttributeIfEmpty, hashRandomValue, hashValue, };
|
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
export class KeyboardManager {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
2
|
+
constructor() {
|
|
3
|
+
this.elements = [];
|
|
4
|
+
this.handleClickBehaviorDispatchEvent = (event) => {
|
|
5
|
+
if (event.code === 'Space' || event.code === 'Enter' || event.code === 'NumpadEnter') {
|
|
6
|
+
event.target.click();
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
this.handleEscapeBehaviorDispatchEvent = (event) => {
|
|
10
|
+
if (event.code === 'Escape' && this.escapeCallback) {
|
|
11
|
+
this.escapeCallback();
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
this.addElement = (el, name = 'element') => {
|
|
15
|
+
this.elements[name] = el;
|
|
16
|
+
};
|
|
17
|
+
this.attachClickBehavior = (name = 'element') => {
|
|
18
|
+
if (this.elements[name]) {
|
|
19
|
+
this.elements[name].addEventListener('keydown', this.handleClickBehaviorDispatchEvent);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
this.detachClickBehavior = (name = 'element') => {
|
|
23
|
+
if (this.elements[name]) {
|
|
24
|
+
this.elements[name].removeEventListener('keydown', this.handleClickBehaviorDispatchEvent);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
this.attachEscapeBehavior = (callBack) => {
|
|
28
|
+
this.escapeCallback = callBack;
|
|
29
|
+
if (window !== undefined) {
|
|
30
|
+
window.addEventListener('keydown', this.handleEscapeBehaviorDispatchEvent.bind(this));
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
this.detachEscapeBehavior = () => {
|
|
34
|
+
this.escapeCallback = () => { return; };
|
|
35
|
+
if (window !== undefined) {
|
|
36
|
+
window.removeEventListener('keydown', this.handleEscapeBehaviorDispatchEvent.bind(this));
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
40
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const cssDurationToMilliseconds = (duration, defaultValue = 1000) => {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
if (duration.includes('s')) {
|
|
3
|
+
return Number(duration.replace('s', '')) * 1000;
|
|
4
|
+
}
|
|
5
|
+
if (duration.includes('ms')) {
|
|
6
|
+
return Number(duration.replace('s', ''));
|
|
7
|
+
}
|
|
8
|
+
return defaultValue;
|
|
9
9
|
};
|
|
10
10
|
export { cssDurationToMilliseconds, };
|