@maggioli-design-system/mds-progress 3.0.0 → 3.0.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-9725b4b4.js → index-abfa4aa9.js} +164 -65
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mds-progress.cjs.entry.js +37 -4
- package/dist/cjs/mds-progress.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/common/aria.js +17 -1
- package/dist/collection/common/device.js +6 -0
- package/dist/collection/common/floating-controller.js +180 -0
- package/dist/collection/common/keyboard-manager.js +2 -2
- package/dist/collection/common/slot.js +19 -0
- package/dist/collection/components/mds-progress/mds-progress.js +28 -3
- package/dist/collection/components/mds-progress/test/mds-progress.stories.js +1 -1
- package/dist/collection/dictionary/animation.js +5 -0
- package/dist/collection/dictionary/file-extensions.js +61 -56
- package/dist/collection/dictionary/text.js +60 -1
- package/dist/collection/dictionary/tree.js +13 -0
- package/dist/collection/fixtures/filenames.js +62 -1
- package/dist/collection/type/animation.js +1 -0
- package/dist/collection/type/tree.js +1 -0
- package/dist/collection/type/variant-file-format.js +5 -0
- package/dist/components/mds-progress.js +36 -3
- package/dist/documentation.d.ts +8 -0
- package/dist/documentation.json +14 -6
- package/dist/esm/{index-9f9c0c97.js → index-a89959e6.js} +164 -65
- package/dist/esm/loader.js +2 -2
- package/dist/esm/mds-progress.entry.js +37 -4
- package/dist/esm/mds-progress.js +3 -3
- package/dist/esm-es5/index-a89959e6.js +1 -0
- 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 +1 -1
- package/dist/mds-progress/p-088b5b20.system.entry.js +1 -0
- package/dist/mds-progress/p-2b265ffa.system.js +1 -0
- package/dist/mds-progress/p-64876922.system.js +2 -0
- package/dist/mds-progress/p-8a9536f1.js +2 -0
- package/dist/mds-progress/p-d8baed2c.entry.js +1 -0
- package/dist/stats.json +75 -41
- package/dist/types/common/aria.d.ts +3 -1
- package/dist/types/common/device.d.ts +2 -0
- package/dist/types/common/floating-controller.d.ts +46 -0
- package/dist/types/common/slot.d.ts +3 -0
- package/dist/types/components/mds-progress/mds-progress.d.ts +1 -0
- package/dist/types/dictionary/animation.d.ts +2 -0
- package/dist/types/dictionary/text.d.ts +3 -1
- package/dist/types/dictionary/tree.d.ts +4 -0
- package/dist/types/fixtures/filenames.d.ts +62 -1
- package/dist/types/type/animation.d.ts +1 -0
- package/dist/types/type/file-types.d.ts +1 -1
- package/dist/types/type/text.d.ts +2 -0
- package/dist/types/type/tree.d.ts +3 -0
- package/dist/types/type/variant-file-format.d.ts +1 -1
- package/documentation.json +63 -20
- package/package.json +3 -3
- package/src/common/aria.ts +22 -2
- package/src/common/device.ts +9 -0
- package/src/common/floating-controller.ts +263 -0
- package/src/common/keyboard-manager.ts +2 -2
- package/src/common/slot.ts +24 -0
- package/src/components/mds-progress/mds-progress.tsx +9 -2
- package/src/components/mds-progress/test/mds-progress.stories.tsx +1 -1
- package/src/dictionary/animation.ts +8 -0
- package/src/dictionary/file-extensions.ts +61 -56
- package/src/dictionary/text.ts +64 -0
- package/src/dictionary/tree.ts +21 -0
- package/src/fixtures/filenames.ts +63 -0
- package/src/fixtures/icons.json +29 -0
- package/src/fixtures/iconsauce.json +11 -0
- package/src/meta/file-format/locale.el.json +44 -0
- package/src/meta/file-format/locale.en.json +44 -0
- package/src/meta/file-format/locale.es.json +44 -0
- package/src/meta/file-format/locale.it.json +44 -0
- package/src/type/animation.ts +3 -0
- package/src/type/file-types.ts +6 -0
- package/src/type/text.ts +59 -0
- package/src/type/tree.ts +12 -0
- package/src/type/variant-file-format.ts +6 -0
- package/www/build/mds-progress.esm.js +1 -1
- package/www/build/mds-progress.js +1 -1
- package/www/build/p-088b5b20.system.entry.js +1 -0
- package/www/build/p-2b265ffa.system.js +1 -0
- package/www/build/p-64876922.system.js +2 -0
- package/www/build/p-8a9536f1.js +2 -0
- package/www/build/p-d8baed2c.entry.js +1 -0
- package/dist/esm-es5/index-9f9c0c97.js +0 -1
- package/dist/mds-progress/p-0e39acfd.system.js +0 -1
- package/dist/mds-progress/p-93b285aa.js +0 -2
- package/dist/mds-progress/p-b8db6677.entry.js +0 -1
- package/dist/mds-progress/p-c09df41d.system.js +0 -2
- package/dist/mds-progress/p-fafac9b1.system.entry.js +0 -1
- package/www/build/p-0e39acfd.system.js +0 -1
- package/www/build/p-93b285aa.js +0 -2
- package/www/build/p-b8db6677.entry.js +0 -1
- package/www/build/p-c09df41d.system.js +0 -2
- package/www/build/p-fafac9b1.system.entry.js +0 -1
|
@@ -21,19 +21,23 @@ function _interopNamespace(e) {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
const NAMESPACE = 'mds-progress';
|
|
24
|
-
const BUILD = /* mds-progress */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad:
|
|
24
|
+
const BUILD = /* mds-progress */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: true, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: false, element: false, event: false, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: false, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: true, hydratedClass: false, hydratedSelectorName: "hydrated", initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: false, mode: false, modernPropertyDecls: false, observeAttribute: true, profile: false, prop: true, propBoolean: false, propMutable: false, propNumber: true, propString: true, reflect: true, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, slot: false, slotChildNodesFix: false, slotRelocation: false, state: true, style: true, svg: false, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: false, vdomKey: true, vdomListener: false, vdomPropOrAttr: true, vdomRef: false, vdomRender: true, vdomStyle: true, vdomText: false, vdomXlink: false, watchCallback: true };
|
|
25
25
|
|
|
26
26
|
/*
|
|
27
|
-
Stencil Client Platform v4.
|
|
27
|
+
Stencil Client Platform v4.25.1 | MIT Licensed | https://stenciljs.com
|
|
28
28
|
*/
|
|
29
29
|
var __defProp = Object.defineProperty;
|
|
30
30
|
var __export = (target, all) => {
|
|
31
31
|
for (var name in all)
|
|
32
32
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
33
33
|
};
|
|
34
|
+
|
|
35
|
+
// src/client/client-host-ref.ts
|
|
34
36
|
var hostRefs = /* @__PURE__ */ new WeakMap();
|
|
35
37
|
var getHostRef = (ref) => hostRefs.get(ref);
|
|
36
|
-
var registerInstance = (lazyInstance, hostRef) =>
|
|
38
|
+
var registerInstance = (lazyInstance, hostRef) => {
|
|
39
|
+
hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef);
|
|
40
|
+
};
|
|
37
41
|
var registerHost = (hostElement, cmpMeta) => {
|
|
38
42
|
const hostRef = {
|
|
39
43
|
$flags$: 0,
|
|
@@ -46,7 +50,8 @@ var registerHost = (hostElement, cmpMeta) => {
|
|
|
46
50
|
hostElement["s-p"] = [];
|
|
47
51
|
hostElement["s-rc"] = [];
|
|
48
52
|
}
|
|
49
|
-
|
|
53
|
+
const ref = hostRefs.set(hostElement, hostRef);
|
|
54
|
+
return ref;
|
|
50
55
|
};
|
|
51
56
|
var isMemberInElement = (elm, memberName) => memberName in elm;
|
|
52
57
|
var consoleError = (e, el) => (0, console.error)(e, el);
|
|
@@ -83,16 +88,22 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
|
|
83
88
|
/* webpackExclude: /\.system\.entry\.js$/ */
|
|
84
89
|
/* webpackMode: "lazy" */
|
|
85
90
|
`./${bundleId}.entry.js${""}`
|
|
86
|
-
)); }).then(
|
|
87
|
-
{
|
|
88
|
-
|
|
91
|
+
)); }).then(
|
|
92
|
+
(importedModule) => {
|
|
93
|
+
{
|
|
94
|
+
cmpModules.set(bundleId, importedModule);
|
|
95
|
+
}
|
|
96
|
+
return importedModule[exportName];
|
|
97
|
+
},
|
|
98
|
+
(e) => {
|
|
99
|
+
consoleError(e, hostRef.$hostElement$);
|
|
89
100
|
}
|
|
90
|
-
|
|
91
|
-
}, consoleError);
|
|
101
|
+
);
|
|
92
102
|
};
|
|
93
103
|
|
|
94
104
|
// src/client/client-style.ts
|
|
95
105
|
var styles = /* @__PURE__ */ new Map();
|
|
106
|
+
var HYDRATED_STYLE_ID = "sty-id";
|
|
96
107
|
var HYDRATED_CSS = "{visibility:hidden}[hydrated]{visibility:inherit}";
|
|
97
108
|
var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
|
|
98
109
|
var win = typeof window !== "undefined" ? window : {};
|
|
@@ -150,12 +161,6 @@ var flush = () => {
|
|
|
150
161
|
};
|
|
151
162
|
var nextTick = (cb) => promiseResolve().then(cb);
|
|
152
163
|
var writeTask = /* @__PURE__ */ queueTask(queueDomWrites, true);
|
|
153
|
-
|
|
154
|
-
// src/utils/constants.ts
|
|
155
|
-
var EMPTY_OBJ = {};
|
|
156
|
-
|
|
157
|
-
// src/utils/helpers.ts
|
|
158
|
-
var isDef = (v) => v != null;
|
|
159
164
|
var isComplexType = (o) => {
|
|
160
165
|
o = typeof o;
|
|
161
166
|
return o === "object" || o === "function";
|
|
@@ -341,7 +346,7 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
341
346
|
}
|
|
342
347
|
if (!appliedStyles.has(scopeId2)) {
|
|
343
348
|
{
|
|
344
|
-
styleElm = doc.createElement("style");
|
|
349
|
+
styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || doc.createElement("style");
|
|
345
350
|
styleElm.innerHTML = style;
|
|
346
351
|
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
|
|
347
352
|
if (nonce != null) {
|
|
@@ -351,7 +356,10 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
|
351
356
|
if (styleContainerNode.nodeName === "HEAD") {
|
|
352
357
|
const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
|
|
353
358
|
const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
|
|
354
|
-
styleContainerNode.insertBefore(
|
|
359
|
+
styleContainerNode.insertBefore(
|
|
360
|
+
styleElm,
|
|
361
|
+
(referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
|
|
362
|
+
);
|
|
355
363
|
} else if ("host" in styleContainerNode) {
|
|
356
364
|
if (supportsConstructableStylesheets) {
|
|
357
365
|
const stylesheet = new CSSStyleSheet();
|
|
@@ -401,16 +409,18 @@ var attachStyles = (hostRef) => {
|
|
|
401
409
|
endAttachStyles();
|
|
402
410
|
};
|
|
403
411
|
var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
|
|
404
|
-
var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
412
|
+
var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
|
|
405
413
|
if (oldValue !== newValue) {
|
|
406
414
|
let isProp = isMemberInElement(elm, memberName);
|
|
407
415
|
memberName.toLowerCase();
|
|
408
416
|
if (memberName === "class") {
|
|
409
417
|
const classList = elm.classList;
|
|
410
418
|
const oldClasses = parseClassList(oldValue);
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
419
|
+
let newClasses = parseClassList(newValue);
|
|
420
|
+
{
|
|
421
|
+
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
|
422
|
+
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
423
|
+
}
|
|
414
424
|
} else if (memberName === "style") {
|
|
415
425
|
{
|
|
416
426
|
for (const prop in oldValue) {
|
|
@@ -447,7 +457,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
447
457
|
elm.setAttribute(memberName, n);
|
|
448
458
|
}
|
|
449
459
|
}
|
|
450
|
-
} else {
|
|
460
|
+
} else if (elm[memberName] !== newValue) {
|
|
451
461
|
elm[memberName] = newValue;
|
|
452
462
|
}
|
|
453
463
|
} catch (e) {
|
|
@@ -469,22 +479,42 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
|
469
479
|
}
|
|
470
480
|
};
|
|
471
481
|
var parseClassListRegex = /\s/;
|
|
472
|
-
var parseClassList = (value) =>
|
|
482
|
+
var parseClassList = (value) => {
|
|
483
|
+
if (typeof value === "object" && value && "baseVal" in value) {
|
|
484
|
+
value = value.baseVal;
|
|
485
|
+
}
|
|
486
|
+
if (!value || typeof value !== "string") {
|
|
487
|
+
return [];
|
|
488
|
+
}
|
|
489
|
+
return value.split(parseClassListRegex);
|
|
490
|
+
};
|
|
473
491
|
|
|
474
492
|
// src/runtime/vdom/update-element.ts
|
|
475
|
-
var updateElement = (oldVnode, newVnode, isSvgMode2) => {
|
|
493
|
+
var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
|
|
476
494
|
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
|
|
477
|
-
const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ ||
|
|
478
|
-
const newVnodeAttrs = newVnode.$attrs$ ||
|
|
495
|
+
const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {};
|
|
496
|
+
const newVnodeAttrs = newVnode.$attrs$ || {};
|
|
479
497
|
{
|
|
480
498
|
for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
|
|
481
499
|
if (!(memberName in newVnodeAttrs)) {
|
|
482
|
-
setAccessor(
|
|
500
|
+
setAccessor(
|
|
501
|
+
elm,
|
|
502
|
+
memberName,
|
|
503
|
+
oldVnodeAttrs[memberName],
|
|
504
|
+
void 0,
|
|
505
|
+
isSvgMode2,
|
|
506
|
+
newVnode.$flags$);
|
|
483
507
|
}
|
|
484
508
|
}
|
|
485
509
|
}
|
|
486
510
|
for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
|
|
487
|
-
setAccessor(
|
|
511
|
+
setAccessor(
|
|
512
|
+
elm,
|
|
513
|
+
memberName,
|
|
514
|
+
oldVnodeAttrs[memberName],
|
|
515
|
+
newVnodeAttrs[memberName],
|
|
516
|
+
isSvgMode2,
|
|
517
|
+
newVnode.$flags$);
|
|
488
518
|
}
|
|
489
519
|
};
|
|
490
520
|
function sortedAttrNames(attrNames) {
|
|
@@ -496,13 +526,10 @@ function sortedAttrNames(attrNames) {
|
|
|
496
526
|
attrNames
|
|
497
527
|
);
|
|
498
528
|
}
|
|
499
|
-
|
|
500
|
-
// src/runtime/vdom/vdom-render.ts
|
|
501
|
-
var scopeId;
|
|
502
529
|
var hostTagName;
|
|
503
530
|
var useNativeShadowDom = false;
|
|
504
531
|
var isSvgMode = false;
|
|
505
|
-
var createElm = (oldParentVNode, newParentVNode, childIndex
|
|
532
|
+
var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
|
506
533
|
const newVNode2 = newParentVNode.$children$[childIndex];
|
|
507
534
|
let i2 = 0;
|
|
508
535
|
let elm;
|
|
@@ -514,11 +541,6 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
|
514
541
|
{
|
|
515
542
|
updateElement(null, newVNode2, isSvgMode);
|
|
516
543
|
}
|
|
517
|
-
const rootNode = elm.getRootNode();
|
|
518
|
-
const isElementWithinShadowRoot = !rootNode.querySelector("body");
|
|
519
|
-
if (!isElementWithinShadowRoot && BUILD.scoped && isDef(scopeId) && elm["s-si"] !== scopeId) {
|
|
520
|
-
elm.classList.add(elm["s-si"] = scopeId);
|
|
521
|
-
}
|
|
522
544
|
if (newVNode2.$children$) {
|
|
523
545
|
for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
|
|
524
546
|
childNode = createElm(oldParentVNode, newVNode2, i2);
|
|
@@ -647,6 +669,9 @@ var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
|
|
|
647
669
|
if (!isInitialRender) {
|
|
648
670
|
return leftVNode.$key$ === rightVNode.$key$;
|
|
649
671
|
}
|
|
672
|
+
if (isInitialRender && !leftVNode.$key$ && rightVNode.$key$) {
|
|
673
|
+
leftVNode.$key$ = rightVNode.$key$;
|
|
674
|
+
}
|
|
650
675
|
return true;
|
|
651
676
|
}
|
|
652
677
|
return false;
|
|
@@ -674,8 +699,9 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
|
|
|
674
699
|
}
|
|
675
700
|
};
|
|
676
701
|
var insertBefore = (parent, newNode, reference) => {
|
|
677
|
-
|
|
678
|
-
|
|
702
|
+
{
|
|
703
|
+
return parent == null ? void 0 : parent.insertBefore(newNode, reference);
|
|
704
|
+
}
|
|
679
705
|
};
|
|
680
706
|
var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
681
707
|
const hostElm = hostRef.$hostElement$;
|
|
@@ -700,9 +726,6 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
|
700
726
|
rootVnode.$flags$ |= 4 /* isHost */;
|
|
701
727
|
hostRef.$vnode$ = rootVnode;
|
|
702
728
|
rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm ;
|
|
703
|
-
{
|
|
704
|
-
scopeId = hostElm["s-sc"];
|
|
705
|
-
}
|
|
706
729
|
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
|
|
707
730
|
patch(oldVNode, rootVnode, isInitialLoad);
|
|
708
731
|
};
|
|
@@ -710,7 +733,14 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
|
710
733
|
// src/runtime/update-component.ts
|
|
711
734
|
var attachToAncestor = (hostRef, ancestorComponent) => {
|
|
712
735
|
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
|
|
713
|
-
ancestorComponent["s-p"].push(
|
|
736
|
+
const index = ancestorComponent["s-p"].push(
|
|
737
|
+
new Promise(
|
|
738
|
+
(r) => hostRef.$onRenderResolve$ = () => {
|
|
739
|
+
ancestorComponent["s-p"].splice(index - 1, 1);
|
|
740
|
+
r();
|
|
741
|
+
}
|
|
742
|
+
)
|
|
743
|
+
);
|
|
714
744
|
}
|
|
715
745
|
};
|
|
716
746
|
var scheduleUpdate = (hostRef, isInitialLoad) => {
|
|
@@ -737,7 +767,7 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
|
|
|
737
767
|
let maybePromise;
|
|
738
768
|
if (isInitialLoad) {
|
|
739
769
|
{
|
|
740
|
-
maybePromise = safeCall(instance, "componentWillLoad");
|
|
770
|
+
maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
|
|
741
771
|
}
|
|
742
772
|
}
|
|
743
773
|
endSchedule();
|
|
@@ -803,12 +833,16 @@ var postUpdateComponent = (hostRef) => {
|
|
|
803
833
|
const tagName = hostRef.$cmpMeta$.$tagName$;
|
|
804
834
|
const elm = hostRef.$hostElement$;
|
|
805
835
|
const endPostUpdate = createTime("postUpdate", tagName);
|
|
836
|
+
const instance = hostRef.$lazyInstance$ ;
|
|
806
837
|
const ancestorComponent = hostRef.$ancestorComponent$;
|
|
807
838
|
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
|
|
808
839
|
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
|
|
809
840
|
{
|
|
810
841
|
addHydratedFlag(elm);
|
|
811
842
|
}
|
|
843
|
+
{
|
|
844
|
+
safeCall(instance, "componentDidLoad", void 0, elm);
|
|
845
|
+
}
|
|
812
846
|
endPostUpdate();
|
|
813
847
|
{
|
|
814
848
|
hostRef.$onReadyResolve$(elm);
|
|
@@ -836,12 +870,12 @@ var appDidLoad = (who) => {
|
|
|
836
870
|
}
|
|
837
871
|
nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
|
|
838
872
|
};
|
|
839
|
-
var safeCall = (instance, method, arg) => {
|
|
873
|
+
var safeCall = (instance, method, arg, elm) => {
|
|
840
874
|
if (instance && instance[method]) {
|
|
841
875
|
try {
|
|
842
876
|
return instance[method](arg);
|
|
843
877
|
} catch (e) {
|
|
844
|
-
consoleError(e);
|
|
878
|
+
consoleError(e, elm);
|
|
845
879
|
}
|
|
846
880
|
}
|
|
847
881
|
return void 0;
|
|
@@ -900,15 +934,68 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
900
934
|
const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
|
|
901
935
|
members.map(([memberName, [memberFlags]]) => {
|
|
902
936
|
if ((memberFlags & 31 /* Prop */ || (flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
|
|
937
|
+
const { get: origGetter, set: origSetter } = Object.getOwnPropertyDescriptor(prototype, memberName) || {};
|
|
938
|
+
if (origGetter) cmpMeta.$members$[memberName][0] |= 2048 /* Getter */;
|
|
939
|
+
if (origSetter) cmpMeta.$members$[memberName][0] |= 4096 /* Setter */;
|
|
940
|
+
if (flags & 1 /* isElementConstructor */ || !origGetter) {
|
|
941
|
+
Object.defineProperty(prototype, memberName, {
|
|
942
|
+
get() {
|
|
943
|
+
{
|
|
944
|
+
if ((cmpMeta.$members$[memberName][0] & 2048 /* Getter */) === 0) {
|
|
945
|
+
return getValue(this, memberName);
|
|
946
|
+
}
|
|
947
|
+
const ref = getHostRef(this);
|
|
948
|
+
const instance = ref ? ref.$lazyInstance$ : prototype;
|
|
949
|
+
if (!instance) return;
|
|
950
|
+
return instance[memberName];
|
|
951
|
+
}
|
|
952
|
+
},
|
|
953
|
+
configurable: true,
|
|
954
|
+
enumerable: true
|
|
955
|
+
});
|
|
956
|
+
}
|
|
903
957
|
Object.defineProperty(prototype, memberName, {
|
|
904
|
-
get() {
|
|
905
|
-
return getValue(this, memberName);
|
|
906
|
-
},
|
|
907
958
|
set(newValue) {
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
959
|
+
const ref = getHostRef(this);
|
|
960
|
+
if (origSetter) {
|
|
961
|
+
const currentValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
|
|
962
|
+
if (typeof currentValue === "undefined" && ref.$instanceValues$.get(memberName)) {
|
|
963
|
+
newValue = ref.$instanceValues$.get(memberName);
|
|
964
|
+
} else if (!ref.$instanceValues$.get(memberName) && currentValue) {
|
|
965
|
+
ref.$instanceValues$.set(memberName, currentValue);
|
|
966
|
+
}
|
|
967
|
+
origSetter.apply(this, [parsePropertyValue(newValue, memberFlags)]);
|
|
968
|
+
newValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
|
|
969
|
+
setValue(this, memberName, newValue, cmpMeta);
|
|
970
|
+
return;
|
|
971
|
+
}
|
|
972
|
+
{
|
|
973
|
+
if ((flags & 1 /* isElementConstructor */) === 0 || (cmpMeta.$members$[memberName][0] & 4096 /* Setter */) === 0) {
|
|
974
|
+
setValue(this, memberName, newValue, cmpMeta);
|
|
975
|
+
if (flags & 1 /* isElementConstructor */ && !ref.$lazyInstance$) {
|
|
976
|
+
ref.$onReadyPromise$.then(() => {
|
|
977
|
+
if (cmpMeta.$members$[memberName][0] & 4096 /* Setter */ && ref.$lazyInstance$[memberName] !== ref.$instanceValues$.get(memberName)) {
|
|
978
|
+
ref.$lazyInstance$[memberName] = newValue;
|
|
979
|
+
}
|
|
980
|
+
});
|
|
981
|
+
}
|
|
982
|
+
return;
|
|
983
|
+
}
|
|
984
|
+
const setterSetVal = () => {
|
|
985
|
+
const currentValue = ref.$lazyInstance$[memberName];
|
|
986
|
+
if (!ref.$instanceValues$.get(memberName) && currentValue) {
|
|
987
|
+
ref.$instanceValues$.set(memberName, currentValue);
|
|
988
|
+
}
|
|
989
|
+
ref.$lazyInstance$[memberName] = parsePropertyValue(newValue, memberFlags);
|
|
990
|
+
setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
|
|
991
|
+
};
|
|
992
|
+
if (ref.$lazyInstance$) {
|
|
993
|
+
setterSetVal();
|
|
994
|
+
} else {
|
|
995
|
+
ref.$onReadyPromise$.then(() => setterSetVal());
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
}
|
|
912
999
|
});
|
|
913
1000
|
}
|
|
914
1001
|
});
|
|
@@ -918,7 +1005,7 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
918
1005
|
plt.jmp(() => {
|
|
919
1006
|
var _a2;
|
|
920
1007
|
const propName = attrNameToPropName.get(attrName);
|
|
921
|
-
if (this.hasOwnProperty(propName)) {
|
|
1008
|
+
if (this.hasOwnProperty(propName) && BUILD.lazyLoad) {
|
|
922
1009
|
newValue = this[propName];
|
|
923
1010
|
delete this[propName];
|
|
924
1011
|
} else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
|
|
@@ -938,7 +1025,11 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
|
938
1025
|
}
|
|
939
1026
|
return;
|
|
940
1027
|
}
|
|
941
|
-
|
|
1028
|
+
const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
|
|
1029
|
+
newValue = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
|
|
1030
|
+
if (newValue !== this[propName] && (!propDesc.get || !!propDesc.set)) {
|
|
1031
|
+
this[propName] = newValue;
|
|
1032
|
+
}
|
|
942
1033
|
});
|
|
943
1034
|
};
|
|
944
1035
|
Cstr.observedAttributes = Array.from(
|
|
@@ -965,9 +1056,8 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
965
1056
|
let Cstr;
|
|
966
1057
|
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
|
967
1058
|
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
const CstrImport = loadModule(cmpMeta);
|
|
1059
|
+
{
|
|
1060
|
+
const CstrImport = loadModule(cmpMeta, hostRef);
|
|
971
1061
|
if (CstrImport && "then" in CstrImport) {
|
|
972
1062
|
const endLoad = uniqueTime();
|
|
973
1063
|
Cstr = await CstrImport;
|
|
@@ -992,7 +1082,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
992
1082
|
try {
|
|
993
1083
|
new Cstr(hostRef);
|
|
994
1084
|
} catch (e) {
|
|
995
|
-
consoleError(e);
|
|
1085
|
+
consoleError(e, elm);
|
|
996
1086
|
}
|
|
997
1087
|
{
|
|
998
1088
|
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
|
|
@@ -1001,10 +1091,6 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
1001
1091
|
hostRef.$flags$ |= 128 /* isWatchReady */;
|
|
1002
1092
|
}
|
|
1003
1093
|
endNewInstance();
|
|
1004
|
-
} else {
|
|
1005
|
-
Cstr = elm.constructor;
|
|
1006
|
-
const cmpTag = elm.localName;
|
|
1007
|
-
customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
|
|
1008
1094
|
}
|
|
1009
1095
|
if (Cstr && Cstr.style) {
|
|
1010
1096
|
let style;
|
|
@@ -1027,7 +1113,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
|
1027
1113
|
schedule();
|
|
1028
1114
|
}
|
|
1029
1115
|
};
|
|
1030
|
-
var fireConnectedCallback = (instance) => {
|
|
1116
|
+
var fireConnectedCallback = (instance, elm) => {
|
|
1031
1117
|
};
|
|
1032
1118
|
|
|
1033
1119
|
// src/runtime/connected-callback.ts
|
|
@@ -1067,7 +1153,7 @@ var connectedCallback = (elm) => {
|
|
|
1067
1153
|
endConnected();
|
|
1068
1154
|
}
|
|
1069
1155
|
};
|
|
1070
|
-
var disconnectInstance = (instance) => {
|
|
1156
|
+
var disconnectInstance = (instance, elm) => {
|
|
1071
1157
|
};
|
|
1072
1158
|
var disconnectedCallback = async (elm) => {
|
|
1073
1159
|
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
|
@@ -1076,6 +1162,12 @@ var disconnectedCallback = async (elm) => {
|
|
|
1076
1162
|
hostRef.$onReadyPromise$.then(() => disconnectInstance());
|
|
1077
1163
|
}
|
|
1078
1164
|
}
|
|
1165
|
+
if (rootAppliedStyles.has(elm)) {
|
|
1166
|
+
rootAppliedStyles.delete(elm);
|
|
1167
|
+
}
|
|
1168
|
+
if (elm.shadowRoot && rootAppliedStyles.has(elm.shadowRoot)) {
|
|
1169
|
+
rootAppliedStyles.delete(elm.shadowRoot);
|
|
1170
|
+
}
|
|
1079
1171
|
};
|
|
1080
1172
|
|
|
1081
1173
|
// src/runtime/bootstrap-lazy.ts
|
|
@@ -1156,6 +1248,13 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
|
1156
1248
|
}
|
|
1157
1249
|
disconnectedCallback() {
|
|
1158
1250
|
plt.jmp(() => disconnectedCallback(this));
|
|
1251
|
+
plt.raf(() => {
|
|
1252
|
+
var _a3;
|
|
1253
|
+
const hostRef = getHostRef(this);
|
|
1254
|
+
if (((_a3 = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a3.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
|
|
1255
|
+
delete hostRef.$vnode$.$elm$;
|
|
1256
|
+
}
|
|
1257
|
+
});
|
|
1159
1258
|
}
|
|
1160
1259
|
componentOnReady() {
|
|
1161
1260
|
return getHostRef(this).$onReadyPromise$;
|
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-abfa4aa9.js');
|
|
6
6
|
const appGlobals = require('./app-globals-3a1e7e63.js');
|
|
7
7
|
|
|
8
8
|
const defineCustomElements = async (win, options) => {
|
|
@@ -2,7 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-abfa4aa9.js');
|
|
6
|
+
|
|
7
|
+
const removeAttributesIf = (element, attribute, valueCheck = 'true', cleanAttributes) => {
|
|
8
|
+
if (ifAttribute(element, attribute, valueCheck)) {
|
|
9
|
+
const attributesList = Array.isArray(cleanAttributes) ? cleanAttributes : [cleanAttributes];
|
|
10
|
+
attributesList.forEach(attributeToRemove => {
|
|
11
|
+
element.removeAttribute(attributeToRemove);
|
|
12
|
+
});
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
return false;
|
|
16
|
+
};
|
|
17
|
+
const ifAttribute = (element, attribute, valueCheck = 'true') => {
|
|
18
|
+
if (element.hasAttribute(attribute) && element.getAttribute(attribute) === valueCheck) {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
return false;
|
|
22
|
+
};
|
|
6
23
|
|
|
7
24
|
const mdsProgressCss = "@tailwind components;\n@tailwind utilities;\n\n/**\n * @prop --mds-progress-background: Sets the background-color of the component\n * @prop --mds-progress-color: Sets the background-color of the progress\n * @prop --mds-progress-duration: Sets the duration of the progress bar animation\n * @prop --mds-progress-radius: Sets the border-radius of the component\n * @prop --mds-progress-thickness: Sets the thickness of the progress bar\n */\n\n:host {\n\n --mds-progress-background: rgb(var(--tone-neutral-08));\n --mds-progress-color: rgb(var(--variant-primary-03));\n --mds-progress-duration: 750ms;\n --mds-progress-radius: 0.5rem;\n --mds-progress-thickness: 0.5rem;\n -webkit-transition-duration: 300ms;\n transition-duration: 300ms;\n -webkit-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n\n background-color: var(--mds-progress-background);\n border-radius: var(--mds-progress-radius);\n display: -ms-flexbox;\n display: flex;\n height: var(--mds-progress-thickness);\n min-width: var(--mds-progress-thickness);\n overflow: hidden;\n position: relative;\n -webkit-transition-property: background-color;\n transition-property: background-color;\n width: 100%;\n}\n\n:host( [direction=\"vertical\"] ) {\n -ms-flex-direction: column;\n flex-direction: column;\n height: unset;\n min-height: var(--mds-progress-thickness);\n width: var(--mds-progress-thickness);\n}\n\n.progress{\n\n -webkit-transition-duration: 500ms;\n\n transition-duration: 500ms;\n\n -webkit-transition-timing-function: cubic-bezier(0.19, 1, 0.22, 1);\n\n transition-timing-function: cubic-bezier(0.19, 1, 0.22, 1);\n\n background-color: var(--mds-progress-color);\n border-radius: var(--mds-progress-radius);\n -webkit-transition-duration: var(--mds-progress-duration);\n transition-duration: var(--mds-progress-duration);\n -webkit-transition-property: background-color, flex-grow;\n transition-property: background-color, flex-grow;\n transition-property: background-color, flex-grow, -ms-flex-positive;\n}\n\n@tailwind utilities;\n\n:host( [variant=\"dark\"] ) {\n\n --mds-progress-color: rgb(var(--tone-neutral-04));\n --mds-progress-background: rgb(var(--tone-neutral-08));\n}\n\n:host( [variant=\"light\"] ) {\n\n --mds-progress-color: rgb(var(--tone-neutral));\n --mds-progress-background: rgb(var(--tone-neutral-05));\n}\n\n:host( [variant=\"error\"] ) {\n\n --mds-progress-color: rgb(var(--status-error-06));\n --mds-progress-background: rgb(var(--status-error-09));\n}\n\n:host( [variant=\"warning\"] ) {\n\n --mds-progress-color: rgb(var(--status-warning-06));\n --mds-progress-background: rgb(var(--status-warning-09));\n}\n\n:host( [variant=\"success\"] ) {\n\n --mds-progress-color: rgb(var(--status-success-06));\n --mds-progress-background: rgb(var(--status-success-09));\n}\n\n:host( [variant=\"info\"] ) {\n\n --mds-progress-color: rgb(var(--status-info-06));\n --mds-progress-background: rgb(var(--status-info-09));\n}\n\n:host( [variant=\"primary\"] ) {\n\n --mds-progress-color: rgb(var(--variant-primary-03));\n --mds-progress-background: rgb(var(--tone-neutral-08));\n}\n\n@tailwind utilities;\n\n@container style(--magma-pref-animation: reduce) {\n :host,\n .progress {\n -webkit-transition-duration: 0s;\n transition-duration: 0s;\n }\n}\n\n@container style(--magma-pref-animation: system) {\n\n @media (prefers-reduced-motion) {\n :host,\n .progress {\n -webkit-transition-duration: 0s;\n transition-duration: 0s;\n }\n }\n}\n\n@container style(--magma-pref-theme: dark) {\n :host,\n :host( [variant=\"primary\"] ) {\n\n --mds-progress-color: rgb(var(--variant-primary-05));\n --mds-progress-background: rgb(var(--tone-neutral-07));\n }\n\n :host( [variant=\"error\"] ) {\n\n --mds-progress-color: rgb(var(--status-error-04));\n --mds-progress-background: rgb(var(--status-error-07));\n }\n\n :host( [variant=\"warning\"] ) {\n\n --mds-progress-color: rgb(var(--status-warning-04));\n --mds-progress-background: rgb(var(--status-warning-07));\n }\n\n :host( [variant=\"success\"] ) {\n\n --mds-progress-color: rgb(var(--status-success-04));\n --mds-progress-background: rgb(var(--status-success-07));\n }\n\n :host( [variant=\"info\"] ) {\n\n --mds-progress-color: rgb(var(--status-info-04));\n --mds-progress-background: rgb(var(--status-info-07));\n }\n}\n\n@container style(--magma-pref-theme: system) {\n\n @media (prefers-color-scheme: dark) {\n :host,\n :host( [variant=\"primary\"] ) {\n\n --mds-progress-color: rgb(var(--variant-primary-05));\n --mds-progress-background: rgb(var(--tone-neutral-07));\n }\n\n :host( [variant=\"error\"] ) {\n\n --mds-progress-color: rgb(var(--status-error-04));\n --mds-progress-background: rgb(var(--status-error-07));\n }\n\n :host( [variant=\"warning\"] ) {\n\n --mds-progress-color: rgb(var(--status-warning-04));\n --mds-progress-background: rgb(var(--status-warning-07));\n }\n\n :host( [variant=\"success\"] ) {\n\n --mds-progress-color: rgb(var(--status-success-04));\n --mds-progress-background: rgb(var(--status-success-07));\n }\n\n :host( [variant=\"info\"] ) {\n\n --mds-progress-color: rgb(var(--status-info-04));\n --mds-progress-background: rgb(var(--status-info-07));\n }\n }\n}\n\n";
|
|
8
25
|
const MdsProgressStyle0 = mdsProgressCss;
|
|
@@ -11,20 +28,36 @@ const MdsProgress = class {
|
|
|
11
28
|
constructor(hostRef) {
|
|
12
29
|
index.registerInstance(this, hostRef);
|
|
13
30
|
this.stepsList = new Array();
|
|
14
|
-
|
|
31
|
+
/**
|
|
32
|
+
* A value between 0 and 1 that rapresents the status progress
|
|
33
|
+
*/
|
|
15
34
|
this.progress = 0;
|
|
35
|
+
/**
|
|
36
|
+
* Specifies the direction of the progress bar, if horizonatl or vertical
|
|
37
|
+
*/
|
|
16
38
|
this.direction = 'horizontal';
|
|
39
|
+
/**
|
|
40
|
+
* Sets the theme variant colors
|
|
41
|
+
*/
|
|
17
42
|
this.variant = 'primary';
|
|
43
|
+
/**
|
|
44
|
+
* Sets the steps that can be pronounced by accessibility technologies
|
|
45
|
+
*/
|
|
18
46
|
this.steps = 'Inizio,Un quarto,Metà,Tre quarti,Fine';
|
|
19
47
|
}
|
|
20
48
|
componentWillLoad() {
|
|
21
49
|
this.stepsList = this.steps.split(',');
|
|
22
50
|
this.setProgress(this.progress);
|
|
23
51
|
}
|
|
52
|
+
componentDidLoad() {
|
|
53
|
+
removeAttributesIf(this.element, 'aria-hidden', 'true', ['aria-valuemax', 'aria-valuemin', 'aria-valuenow', 'aria-valuetext', 'role']);
|
|
54
|
+
}
|
|
24
55
|
setProgress(progress) {
|
|
25
56
|
if (this.steps) {
|
|
26
57
|
this.currentStep = this.stepsList[Math.round(progress * (this.stepsList.length - 1))];
|
|
27
|
-
this.element
|
|
58
|
+
if (!ifAttribute(this.element, 'aria-hidden')) {
|
|
59
|
+
this.element.setAttribute('aria-valuetext', this.currentStep);
|
|
60
|
+
}
|
|
28
61
|
}
|
|
29
62
|
}
|
|
30
63
|
progressChanged(progress) {
|
|
@@ -34,7 +67,7 @@ const MdsProgress = class {
|
|
|
34
67
|
this.stepsList = steps.split(',');
|
|
35
68
|
}
|
|
36
69
|
render() {
|
|
37
|
-
return (index.h(index.Host, { key: '
|
|
70
|
+
return (index.h(index.Host, { key: '1366494830062543321235236455acd23e937ed8', "aria-valuemax": "100", "aria-valuemin": "0", "aria-valuenow": !ifAttribute(this.element, 'aria-hidden') && Math.round(this.progress * 100), role: "progressbar" }, index.h("div", { key: '71db06c95676326e8fcfdadb254de64f1d80521c', class: "contrast-area" }), index.h("div", { key: '1f4bc92b2c3201198b606463f26f47aa9f9ca13e', class: "progress", style: this.direction === 'horizontal'
|
|
38
71
|
? { flexGrow: `${this.progress}` }
|
|
39
72
|
: { flexGrow: `${this.progress}`, width: '100%' } })));
|
|
40
73
|
}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
5
|
+
const index = require('./index-abfa4aa9.js');
|
|
6
6
|
const appGlobals = require('./app-globals-3a1e7e63.js');
|
|
7
7
|
|
|
8
8
|
/*
|
|
9
|
-
Stencil Client Patch Browser v4.
|
|
9
|
+
Stencil Client Patch Browser v4.25.1 | MIT Licensed | https://stenciljs.com
|
|
10
10
|
*/
|
|
11
11
|
var patchBrowser = () => {
|
|
12
12
|
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));
|
|
@@ -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, };
|