@maggioli-design-system/mds-input-tip 1.2.2 → 1.3.0
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-442db91d.js → index-66d8bb25.js} +143 -58
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mds-input-tip.cjs.entry.js +8 -2
- package/dist/cjs/mds-input-tip.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/common/floating-controller.js +180 -0
- package/dist/collection/common/slot.js +28 -0
- package/dist/collection/common/string.js +30 -0
- package/dist/collection/components/mds-input-tip/mds-input-tip.css +123 -0
- package/dist/collection/components/mds-input-tip/mds-input-tip.js +10 -0
- package/dist/collection/dictionary/animation.js +5 -0
- package/dist/collection/dictionary/file-extensions.js +6 -59
- package/dist/collection/dictionary/keyboard.js +84 -0
- 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/keyboard.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-input-tip.js +7 -1
- package/dist/documentation.d.ts +8 -0
- package/dist/documentation.json +15 -5
- package/dist/esm/{index-8fed469d.js → index-4e431d49.js} +143 -58
- package/dist/esm/loader.js +2 -2
- package/dist/esm/mds-input-tip.entry.js +8 -2
- package/dist/esm/mds-input-tip.js +3 -3
- package/dist/esm-es5/index-4e431d49.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mds-input-tip.entry.js +1 -1
- package/dist/esm-es5/mds-input-tip.js +1 -1
- package/dist/mds-input-tip/mds-input-tip.esm.js +1 -1
- package/dist/mds-input-tip/mds-input-tip.js +1 -1
- package/dist/mds-input-tip/p-27388d25.entry.js +1 -0
- package/dist/mds-input-tip/p-7eeec96b.system.js +2 -0
- package/dist/mds-input-tip/p-b8376582.js +2 -0
- package/dist/mds-input-tip/{p-c915dfb3.system.js → p-c7ede63a.system.js} +1 -1
- package/dist/mds-input-tip/p-d876075e.system.entry.js +1 -0
- package/dist/stats.json +74 -37
- package/dist/types/common/floating-controller.d.ts +46 -0
- package/dist/types/common/slot.d.ts +4 -0
- package/dist/types/common/string.d.ts +4 -0
- package/dist/types/dictionary/animation.d.ts +2 -0
- package/dist/types/dictionary/keyboard.d.ts +2 -0
- 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/keyboard.d.ts +12 -0
- package/dist/types/type/tree.d.ts +3 -0
- package/dist/types/type/variant-file-format.d.ts +1 -1
- package/documentation.json +76 -16
- package/package.json +4 -4
- package/readme.md +7 -0
- package/src/common/floating-controller.ts +263 -0
- package/src/common/slot.ts +35 -0
- package/src/common/string.ts +42 -0
- package/src/components/mds-input-tip/mds-input-tip.css +5 -0
- package/src/components/mds-input-tip/readme.md +7 -0
- package/src/dictionary/animation.ts +8 -0
- package/src/dictionary/file-extensions.ts +6 -60
- package/src/dictionary/keyboard.ts +87 -0
- package/src/dictionary/tree.ts +21 -0
- package/src/fixtures/filenames.ts +63 -0
- package/src/fixtures/icons.json +39 -1
- package/src/fixtures/iconsauce.json +6 -0
- package/src/meta/file-format/locale.el.json +26 -21
- package/src/meta/file-format/locale.en.json +26 -21
- package/src/meta/file-format/locale.es.json +26 -21
- package/src/meta/file-format/locale.it.json +26 -21
- package/src/meta/keyboard/keys.json +83 -0
- package/src/tailwind/components.css +11 -0
- package/src/tailwind/fouc.css +118 -0
- package/src/type/animation.ts +3 -0
- package/src/type/file-types.ts +6 -0
- package/src/type/keyboard.ts +93 -0
- package/src/type/tree.ts +12 -0
- package/src/type/variant-file-format.ts +6 -0
- package/www/build/mds-input-tip.esm.js +1 -1
- package/www/build/mds-input-tip.js +1 -1
- package/www/build/p-27388d25.entry.js +1 -0
- package/www/build/p-7eeec96b.system.js +2 -0
- package/www/build/p-b8376582.js +2 -0
- package/www/build/{p-c915dfb3.system.js → p-c7ede63a.system.js} +1 -1
- package/www/build/p-d876075e.system.entry.js +1 -0
- package/dist/esm-es5/index-8fed469d.js +0 -1
- package/dist/mds-input-tip/p-37c61f56.system.js +0 -2
- package/dist/mds-input-tip/p-3e967425.js +0 -2
- package/dist/mds-input-tip/p-4486a5e4.entry.js +0 -1
- package/dist/mds-input-tip/p-fadf816e.system.entry.js +0 -1
- package/www/build/p-37c61f56.system.js +0 -2
- package/www/build/p-3e967425.js +0 -2
- package/www/build/p-4486a5e4.entry.js +0 -1
- package/www/build/p-fadf816e.system.entry.js +0 -1
@@ -21,19 +21,23 @@ function _interopNamespace(e) {
|
|
21
21
|
}
|
22
22
|
|
23
23
|
const NAMESPACE = 'mds-input-tip';
|
24
|
-
const BUILD = /* mds-input-tip */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: false, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: false, 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: false, lifecycleDOMEvents: false, member: true, method: false, mode: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: false, propNumber: false, propString: true, reflect: true, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, slot: true, slotChildNodesFix: false, slotRelocation: false, state: false, style: true, svg: false, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: false, vdomFunctional: false, vdomKey: true, vdomListener: false, vdomPropOrAttr: true, vdomRef: false, vdomRender: true, vdomStyle: false, vdomText: false, vdomXlink: false, watchCallback: false };
|
24
|
+
const BUILD = /* mds-input-tip */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: false, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: false, 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: false, lifecycleDOMEvents: false, member: true, method: false, mode: false, modernPropertyDecls: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: false, propNumber: false, propString: true, reflect: true, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, slot: true, slotChildNodesFix: false, slotRelocation: false, state: false, style: true, svg: false, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: false, vdomFunctional: false, vdomKey: true, vdomListener: false, vdomPropOrAttr: true, vdomRef: false, vdomRender: true, vdomStyle: false, vdomText: false, vdomXlink: false, watchCallback: false };
|
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";
|
@@ -334,7 +339,7 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
334
339
|
}
|
335
340
|
if (!appliedStyles.has(scopeId2)) {
|
336
341
|
{
|
337
|
-
styleElm = doc.createElement("style");
|
342
|
+
styleElm = document.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`) || doc.createElement("style");
|
338
343
|
styleElm.innerHTML = style;
|
339
344
|
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
|
340
345
|
if (nonce != null) {
|
@@ -344,7 +349,10 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
|
|
344
349
|
if (styleContainerNode.nodeName === "HEAD") {
|
345
350
|
const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
|
346
351
|
const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
|
347
|
-
styleContainerNode.insertBefore(
|
352
|
+
styleContainerNode.insertBefore(
|
353
|
+
styleElm,
|
354
|
+
(referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
|
355
|
+
);
|
348
356
|
} else if ("host" in styleContainerNode) {
|
349
357
|
if (supportsConstructableStylesheets) {
|
350
358
|
const stylesheet = new CSSStyleSheet();
|
@@ -394,7 +402,7 @@ var attachStyles = (hostRef) => {
|
|
394
402
|
endAttachStyles();
|
395
403
|
};
|
396
404
|
var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
|
397
|
-
var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
405
|
+
var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
|
398
406
|
if (oldValue !== newValue) {
|
399
407
|
let isProp = isMemberInElement(elm, memberName);
|
400
408
|
memberName.toLowerCase();
|
@@ -413,7 +421,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
413
421
|
elm.setAttribute(memberName, n);
|
414
422
|
}
|
415
423
|
}
|
416
|
-
} else {
|
424
|
+
} else if (elm[memberName] !== newValue) {
|
417
425
|
elm[memberName] = newValue;
|
418
426
|
}
|
419
427
|
} catch (e) {
|
@@ -436,19 +444,31 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
|
436
444
|
};
|
437
445
|
|
438
446
|
// src/runtime/vdom/update-element.ts
|
439
|
-
var updateElement = (oldVnode, newVnode, isSvgMode2) => {
|
447
|
+
var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
|
440
448
|
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
|
441
|
-
const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ ||
|
442
|
-
const newVnodeAttrs = newVnode.$attrs$ ||
|
449
|
+
const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {};
|
450
|
+
const newVnodeAttrs = newVnode.$attrs$ || {};
|
443
451
|
{
|
444
452
|
for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
|
445
453
|
if (!(memberName in newVnodeAttrs)) {
|
446
|
-
setAccessor(
|
454
|
+
setAccessor(
|
455
|
+
elm,
|
456
|
+
memberName,
|
457
|
+
oldVnodeAttrs[memberName],
|
458
|
+
void 0,
|
459
|
+
isSvgMode2,
|
460
|
+
newVnode.$flags$);
|
447
461
|
}
|
448
462
|
}
|
449
463
|
}
|
450
464
|
for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
|
451
|
-
setAccessor(
|
465
|
+
setAccessor(
|
466
|
+
elm,
|
467
|
+
memberName,
|
468
|
+
oldVnodeAttrs[memberName],
|
469
|
+
newVnodeAttrs[memberName],
|
470
|
+
isSvgMode2,
|
471
|
+
newVnode.$flags$);
|
452
472
|
}
|
453
473
|
};
|
454
474
|
function sortedAttrNames(attrNames) {
|
@@ -460,13 +480,10 @@ function sortedAttrNames(attrNames) {
|
|
460
480
|
attrNames
|
461
481
|
);
|
462
482
|
}
|
463
|
-
|
464
|
-
// src/runtime/vdom/vdom-render.ts
|
465
|
-
var scopeId;
|
466
483
|
var hostTagName;
|
467
484
|
var useNativeShadowDom = false;
|
468
485
|
var isSvgMode = false;
|
469
|
-
var createElm = (oldParentVNode, newParentVNode, childIndex
|
486
|
+
var createElm = (oldParentVNode, newParentVNode, childIndex) => {
|
470
487
|
const newVNode2 = newParentVNode.$children$[childIndex];
|
471
488
|
let i2 = 0;
|
472
489
|
let elm;
|
@@ -478,11 +495,6 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
|
478
495
|
{
|
479
496
|
updateElement(null, newVNode2, isSvgMode);
|
480
497
|
}
|
481
|
-
const rootNode = elm.getRootNode();
|
482
|
-
const isElementWithinShadowRoot = !rootNode.querySelector("body");
|
483
|
-
if (!isElementWithinShadowRoot && BUILD.scoped && isDef(scopeId) && elm["s-si"] !== scopeId) {
|
484
|
-
elm.classList.add(elm["s-si"] = scopeId);
|
485
|
-
}
|
486
498
|
if (newVNode2.$children$) {
|
487
499
|
for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
|
488
500
|
childNode = createElm(oldParentVNode, newVNode2, i2);
|
@@ -611,6 +623,9 @@ var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
|
|
611
623
|
if (!isInitialRender) {
|
612
624
|
return leftVNode.$key$ === rightVNode.$key$;
|
613
625
|
}
|
626
|
+
if (isInitialRender && !leftVNode.$key$ && rightVNode.$key$) {
|
627
|
+
leftVNode.$key$ = rightVNode.$key$;
|
628
|
+
}
|
614
629
|
return true;
|
615
630
|
}
|
616
631
|
return false;
|
@@ -639,8 +654,9 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
|
|
639
654
|
}
|
640
655
|
};
|
641
656
|
var insertBefore = (parent, newNode, reference) => {
|
642
|
-
|
643
|
-
|
657
|
+
{
|
658
|
+
return parent == null ? void 0 : parent.insertBefore(newNode, reference);
|
659
|
+
}
|
644
660
|
};
|
645
661
|
var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
646
662
|
const hostElm = hostRef.$hostElement$;
|
@@ -665,9 +681,6 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
665
681
|
rootVnode.$flags$ |= 4 /* isHost */;
|
666
682
|
hostRef.$vnode$ = rootVnode;
|
667
683
|
rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm ;
|
668
|
-
{
|
669
|
-
scopeId = hostElm["s-sc"];
|
670
|
-
}
|
671
684
|
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
|
672
685
|
patch(oldVNode, rootVnode, isInitialLoad);
|
673
686
|
};
|
@@ -675,7 +688,14 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
675
688
|
// src/runtime/update-component.ts
|
676
689
|
var attachToAncestor = (hostRef, ancestorComponent) => {
|
677
690
|
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
|
678
|
-
ancestorComponent["s-p"].push(
|
691
|
+
const index = ancestorComponent["s-p"].push(
|
692
|
+
new Promise(
|
693
|
+
(r) => hostRef.$onRenderResolve$ = () => {
|
694
|
+
ancestorComponent["s-p"].splice(index - 1, 1);
|
695
|
+
r();
|
696
|
+
}
|
697
|
+
)
|
698
|
+
);
|
679
699
|
}
|
680
700
|
};
|
681
701
|
var scheduleUpdate = (hostRef, isInitialLoad) => {
|
@@ -834,15 +854,68 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
834
854
|
const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
|
835
855
|
members.map(([memberName, [memberFlags]]) => {
|
836
856
|
if ((memberFlags & 31 /* Prop */ || (flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
|
857
|
+
const { get: origGetter, set: origSetter } = Object.getOwnPropertyDescriptor(prototype, memberName) || {};
|
858
|
+
if (origGetter) cmpMeta.$members$[memberName][0] |= 2048 /* Getter */;
|
859
|
+
if (origSetter) cmpMeta.$members$[memberName][0] |= 4096 /* Setter */;
|
860
|
+
if (flags & 1 /* isElementConstructor */ || !origGetter) {
|
861
|
+
Object.defineProperty(prototype, memberName, {
|
862
|
+
get() {
|
863
|
+
{
|
864
|
+
if ((cmpMeta.$members$[memberName][0] & 2048 /* Getter */) === 0) {
|
865
|
+
return getValue(this, memberName);
|
866
|
+
}
|
867
|
+
const ref = getHostRef(this);
|
868
|
+
const instance = ref ? ref.$lazyInstance$ : prototype;
|
869
|
+
if (!instance) return;
|
870
|
+
return instance[memberName];
|
871
|
+
}
|
872
|
+
},
|
873
|
+
configurable: true,
|
874
|
+
enumerable: true
|
875
|
+
});
|
876
|
+
}
|
837
877
|
Object.defineProperty(prototype, memberName, {
|
838
|
-
get() {
|
839
|
-
return getValue(this, memberName);
|
840
|
-
},
|
841
878
|
set(newValue) {
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
879
|
+
const ref = getHostRef(this);
|
880
|
+
if (origSetter) {
|
881
|
+
const currentValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
|
882
|
+
if (typeof currentValue === "undefined" && ref.$instanceValues$.get(memberName)) {
|
883
|
+
newValue = ref.$instanceValues$.get(memberName);
|
884
|
+
} else if (!ref.$instanceValues$.get(memberName) && currentValue) {
|
885
|
+
ref.$instanceValues$.set(memberName, currentValue);
|
886
|
+
}
|
887
|
+
origSetter.apply(this, [parsePropertyValue(newValue, memberFlags)]);
|
888
|
+
newValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
|
889
|
+
setValue(this, memberName, newValue, cmpMeta);
|
890
|
+
return;
|
891
|
+
}
|
892
|
+
{
|
893
|
+
if ((flags & 1 /* isElementConstructor */) === 0 || (cmpMeta.$members$[memberName][0] & 4096 /* Setter */) === 0) {
|
894
|
+
setValue(this, memberName, newValue, cmpMeta);
|
895
|
+
if (flags & 1 /* isElementConstructor */ && !ref.$lazyInstance$) {
|
896
|
+
ref.$onReadyPromise$.then(() => {
|
897
|
+
if (cmpMeta.$members$[memberName][0] & 4096 /* Setter */ && ref.$lazyInstance$[memberName] !== ref.$instanceValues$.get(memberName)) {
|
898
|
+
ref.$lazyInstance$[memberName] = newValue;
|
899
|
+
}
|
900
|
+
});
|
901
|
+
}
|
902
|
+
return;
|
903
|
+
}
|
904
|
+
const setterSetVal = () => {
|
905
|
+
const currentValue = ref.$lazyInstance$[memberName];
|
906
|
+
if (!ref.$instanceValues$.get(memberName) && currentValue) {
|
907
|
+
ref.$instanceValues$.set(memberName, currentValue);
|
908
|
+
}
|
909
|
+
ref.$lazyInstance$[memberName] = parsePropertyValue(newValue, memberFlags);
|
910
|
+
setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
|
911
|
+
};
|
912
|
+
if (ref.$lazyInstance$) {
|
913
|
+
setterSetVal();
|
914
|
+
} else {
|
915
|
+
ref.$onReadyPromise$.then(() => setterSetVal());
|
916
|
+
}
|
917
|
+
}
|
918
|
+
}
|
846
919
|
});
|
847
920
|
}
|
848
921
|
});
|
@@ -852,7 +925,7 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
852
925
|
plt.jmp(() => {
|
853
926
|
var _a2;
|
854
927
|
const propName = attrNameToPropName.get(attrName);
|
855
|
-
if (this.hasOwnProperty(propName)) {
|
928
|
+
if (this.hasOwnProperty(propName) && BUILD.lazyLoad) {
|
856
929
|
newValue = this[propName];
|
857
930
|
delete this[propName];
|
858
931
|
} else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
|
@@ -872,7 +945,11 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
|
|
872
945
|
}
|
873
946
|
return;
|
874
947
|
}
|
875
|
-
|
948
|
+
const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
|
949
|
+
newValue = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
|
950
|
+
if (newValue !== this[propName] && (!propDesc.get || !!propDesc.set)) {
|
951
|
+
this[propName] = newValue;
|
952
|
+
}
|
876
953
|
});
|
877
954
|
};
|
878
955
|
Cstr.observedAttributes = Array.from(
|
@@ -899,9 +976,8 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
899
976
|
let Cstr;
|
900
977
|
if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
|
901
978
|
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
|
902
|
-
|
903
|
-
|
904
|
-
const CstrImport = loadModule(cmpMeta);
|
979
|
+
{
|
980
|
+
const CstrImport = loadModule(cmpMeta, hostRef);
|
905
981
|
if (CstrImport && "then" in CstrImport) {
|
906
982
|
const endLoad = uniqueTime();
|
907
983
|
Cstr = await CstrImport;
|
@@ -923,16 +999,12 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
923
999
|
try {
|
924
1000
|
new Cstr(hostRef);
|
925
1001
|
} catch (e) {
|
926
|
-
consoleError(e);
|
1002
|
+
consoleError(e, elm);
|
927
1003
|
}
|
928
1004
|
{
|
929
1005
|
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
|
930
1006
|
}
|
931
1007
|
endNewInstance();
|
932
|
-
} else {
|
933
|
-
Cstr = elm.constructor;
|
934
|
-
const cmpTag = elm.localName;
|
935
|
-
customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
|
936
1008
|
}
|
937
1009
|
if (Cstr && Cstr.style) {
|
938
1010
|
let style;
|
@@ -955,7 +1027,7 @@ var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
|
955
1027
|
schedule();
|
956
1028
|
}
|
957
1029
|
};
|
958
|
-
var fireConnectedCallback = (instance) => {
|
1030
|
+
var fireConnectedCallback = (instance, elm) => {
|
959
1031
|
};
|
960
1032
|
|
961
1033
|
// src/runtime/connected-callback.ts
|
@@ -995,7 +1067,7 @@ var connectedCallback = (elm) => {
|
|
995
1067
|
endConnected();
|
996
1068
|
}
|
997
1069
|
};
|
998
|
-
var disconnectInstance = (instance) => {
|
1070
|
+
var disconnectInstance = (instance, elm) => {
|
999
1071
|
};
|
1000
1072
|
var disconnectedCallback = async (elm) => {
|
1001
1073
|
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
|
@@ -1004,6 +1076,12 @@ var disconnectedCallback = async (elm) => {
|
|
1004
1076
|
hostRef.$onReadyPromise$.then(() => disconnectInstance());
|
1005
1077
|
}
|
1006
1078
|
}
|
1079
|
+
if (rootAppliedStyles.has(elm)) {
|
1080
|
+
rootAppliedStyles.delete(elm);
|
1081
|
+
}
|
1082
|
+
if (elm.shadowRoot && rootAppliedStyles.has(elm.shadowRoot)) {
|
1083
|
+
rootAppliedStyles.delete(elm.shadowRoot);
|
1084
|
+
}
|
1007
1085
|
};
|
1008
1086
|
|
1009
1087
|
// src/runtime/bootstrap-lazy.ts
|
@@ -1080,6 +1158,13 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
|
|
1080
1158
|
}
|
1081
1159
|
disconnectedCallback() {
|
1082
1160
|
plt.jmp(() => disconnectedCallback(this));
|
1161
|
+
plt.raf(() => {
|
1162
|
+
var _a3;
|
1163
|
+
const hostRef = getHostRef(this);
|
1164
|
+
if (((_a3 = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a3.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
|
1165
|
+
delete hostRef.$vnode$.$elm$;
|
1166
|
+
}
|
1167
|
+
});
|
1083
1168
|
}
|
1084
1169
|
componentOnReady() {
|
1085
1170
|
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-66d8bb25.js');
|
6
6
|
const appGlobals = require('./app-globals-3a1e7e63.js');
|
7
7
|
|
8
8
|
const defineCustomElements = async (win, options) => {
|
@@ -2,15 +2,21 @@
|
|
2
2
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
4
4
|
|
5
|
-
const index = require('./index-
|
5
|
+
const index = require('./index-66d8bb25.js');
|
6
6
|
|
7
|
-
const mdsInputTipCss = "@tailwind utilities;\n\n:host {\n\n --mds-input-tip-active-translate: translate(0, 0);\n\n left: 0.25rem;\n\n right: 0.25rem;\n\n gap: 0.25rem;\n\n -webkit-transition-duration: 300ms;\n\n transition-duration: 300ms;\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 display: -ms-flexbox;\n\n display: flex;\n -ms-flex-pack: end;\n justify-content: flex-end;\n pointer-events: none;\n position: absolute;\n -webkit-transform: var(--mds-input-tip-active-translate);\n transform: var(--mds-input-tip-active-translate);\n -webkit-transition-property: -webkit-transform;\n transition-property: -webkit-transform;\n transition-property: transform;\n transition-property: transform, -webkit-transform;\n}\n\n:host(:empty) {\n display: none;\n}\n\n:host([position=\"top\"]) {\n top: 0.25rem;\n}\n\n:host([position=\"bottom\"]) {\n bottom: 0.25rem;\n}\n\n:host([position=\"top\"][active]:not([active=\"false\"])) {\n\n --mds-input-tip-active-translate: translate(calc(0.25rem * -1), calc(0.25rem * -1));\n}\n\n:host([position=\"top\"][active]:not([active=\"false\"])) ::slotted( mds-input-tip-item ) {\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n}\n\n:host([position=\"bottom\"][active]:not([active=\"false\"])) {\n\n --mds-input-tip-active-translate: translate(calc(0.25rem * -1), 0.25rem);\n}\n\n:host([position=\"bottom\"][active]:not([active=\"false\"])) ::slotted( mds-input-tip-item ) {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n}\n\n@container style(--magma-pref-animation: reduce) {\n :host {\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 -webkit-transition-duration: 0s;\n transition-duration: 0s;\n }\n }\n}\n\n";
|
7
|
+
const mdsInputTipCss = "@tailwind utilities;\n\n/**\n * @prop --mds-input-tip-active-translate: Set the translate of the tip when it is active.\n */\n\n:host {\n\n --mds-input-tip-active-translate: translate(0, 0);\n\n left: 0.25rem;\n\n right: 0.25rem;\n\n gap: 0.25rem;\n\n -webkit-transition-duration: 300ms;\n\n transition-duration: 300ms;\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 display: -ms-flexbox;\n\n display: flex;\n -ms-flex-pack: end;\n justify-content: flex-end;\n pointer-events: none;\n position: absolute;\n -webkit-transform: var(--mds-input-tip-active-translate);\n transform: var(--mds-input-tip-active-translate);\n -webkit-transition-property: -webkit-transform;\n transition-property: -webkit-transform;\n transition-property: transform;\n transition-property: transform, -webkit-transform;\n}\n\n:host(:empty) {\n display: none;\n}\n\n:host([position=\"top\"]) {\n top: 0.25rem;\n}\n\n:host([position=\"bottom\"]) {\n bottom: 0.25rem;\n}\n\n:host([position=\"top\"][active]:not([active=\"false\"])) {\n\n --mds-input-tip-active-translate: translate(calc(0.25rem * -1), calc(0.25rem * -1));\n}\n\n:host([position=\"top\"][active]:not([active=\"false\"])) ::slotted( mds-input-tip-item ) {\n border-top-left-radius: 0;\n border-top-right-radius: 0;\n}\n\n:host([position=\"bottom\"][active]:not([active=\"false\"])) {\n\n --mds-input-tip-active-translate: translate(calc(0.25rem * -1), 0.25rem);\n}\n\n:host([position=\"bottom\"][active]:not([active=\"false\"])) ::slotted( mds-input-tip-item ) {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n}\n\n@container style(--magma-pref-animation: reduce) {\n :host {\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 -webkit-transition-duration: 0s;\n transition-duration: 0s;\n }\n }\n}\n\n:host(:not(:is([hydrated], .hydrated))) {\n -webkit-animation-duration: 0s;\n animation-duration: 0s;\n border-color: transparent;\n -webkit-box-shadow: 0 0 0 transparent;\n box-shadow: 0 0 0 transparent;\n opacity: 0;\n outline-color: transparent;\n -webkit-transition-delay: 0s;\n transition-delay: 0s;\n -webkit-transition-duration: 0s;\n transition-duration: 0s;\n visibility: hidden;\n}\n\n/* TODO refact(stencil): Uses only used selector from parent shadowDOM component */\n\nmds-accordion:not(:is([hydrated], .hydrated)),\nmds-accordion-item:not(:is([hydrated], .hydrated)),\nmds-accordion-timer:not(:is([hydrated], .hydrated)),\nmds-accordion-timer-item:not(:is([hydrated], .hydrated)),\nmds-author:not(:is([hydrated], .hydrated)),\nmds-avatar:not(:is([hydrated], .hydrated)),\nmds-badge:not(:is([hydrated], .hydrated)),\nmds-banner:not(:is([hydrated], .hydrated)),\nmds-benchmark-bar:not(:is([hydrated], .hydrated)),\nmds-bibliography:not(:is([hydrated], .hydrated)),\nmds-breadcrumb:not(:is([hydrated], .hydrated)),\nmds-breadcrumb-item:not(:is([hydrated], .hydrated)),\nmds-button:not(:is([hydrated], .hydrated)),\nmds-card:not(:is([hydrated], .hydrated)),\nmds-card-content:not(:is([hydrated], .hydrated)),\nmds-card-footer:not(:is([hydrated], .hydrated)),\nmds-card-header:not(:is([hydrated], .hydrated)),\nmds-card-media:not(:is([hydrated], .hydrated)),\nmds-chip:not(:is([hydrated], .hydrated)),\nmds-details:not(:is([hydrated], .hydrated)),\nmds-dropdown:not(:is([hydrated], .hydrated)),\nmds-entity:not(:is([hydrated], .hydrated)),\nmds-file:not(:is([hydrated], .hydrated)),\nmds-file-preview:not(:is([hydrated], .hydrated)),\nmds-filter:not(:is([hydrated], .hydrated)),\nmds-filter-item:not(:is([hydrated], .hydrated)),\nmds-header:not(:is([hydrated], .hydrated)),\nmds-header-bar:not(:is([hydrated], .hydrated)),\nmds-help:not(:is([hydrated], .hydrated)),\nmds-horizontal-scroll:not(:is([hydrated], .hydrated)),\nmds-hr:not(:is([hydrated], .hydrated)),\nmds-icon:not(:is([hydrated], .hydrated)),\nmds-img:not(:is([hydrated], .hydrated)),\nmds-input:not(:is([hydrated], .hydrated)),\nmds-input-field:not(:is([hydrated], .hydrated)),\nmds-input-range:not(:is([hydrated], .hydrated)),\nmds-input-select:not(:is([hydrated], .hydrated)),\nmds-input-switch:not(:is([hydrated], .hydrated)),\nmds-input-tip:not(:is([hydrated], .hydrated)),\nmds-input-tip-item:not(:is([hydrated], .hydrated)),\nmds-input-upload:not(:is([hydrated], .hydrated)),\nmds-keyboard:not(:is([hydrated], .hydrated)),\nmds-keyboard-key:not(:is([hydrated], .hydrated)),\nmds-kpi:not(:is([hydrated], .hydrated)),\nmds-kpi-item:not(:is([hydrated], .hydrated)),\nmds-label:not(:is([hydrated], .hydrated)),\nmds-list:not(:is([hydrated], .hydrated)),\nmds-list-item:not(:is([hydrated], .hydrated)),\nmds-modal:not(:is([hydrated], .hydrated)),\nmds-note:not(:is([hydrated], .hydrated)),\nmds-notification:not(:is([hydrated], .hydrated)),\nmds-paginator:not(:is([hydrated], .hydrated)),\nmds-paginator-item:not(:is([hydrated], .hydrated)),\nmds-pref:not(:is([hydrated], .hydrated)),\nmds-pref-animation:not(:is([hydrated], .hydrated)),\nmds-pref-consumption:not(:is([hydrated], .hydrated)),\nmds-pref-contrast:not(:is([hydrated], .hydrated)),\nmds-pref-language:not(:is([hydrated], .hydrated)),\nmds-pref-language-item:not(:is([hydrated], .hydrated)),\nmds-pref-theme:not(:is([hydrated], .hydrated)),\nmds-price-table:not(:is([hydrated], .hydrated)),\nmds-price-table-features:not(:is([hydrated], .hydrated)),\nmds-price-table-features-cell:not(:is([hydrated], .hydrated)),\nmds-price-table-features-row:not(:is([hydrated], .hydrated)),\nmds-price-table-header:not(:is([hydrated], .hydrated)),\nmds-price-table-list:not(:is([hydrated], .hydrated)),\nmds-price-table-list-item:not(:is([hydrated], .hydrated)),\nmds-progress:not(:is([hydrated], .hydrated)),\nmds-push-notification:not(:is([hydrated], .hydrated)),\nmds-push-notifications:not(:is([hydrated], .hydrated)),\nmds-quote:not(:is([hydrated], .hydrated)),\nmds-separator:not(:is([hydrated], .hydrated)),\nmds-spinner:not(:is([hydrated], .hydrated)),\nmds-stepper-bar:not(:is([hydrated], .hydrated)),\nmds-stepper-bar-item:not(:is([hydrated], .hydrated)),\nmds-tab:not(:is([hydrated], .hydrated)),\nmds-tab-bar:not(:is([hydrated], .hydrated)),\nmds-tab-bar-item:not(:is([hydrated], .hydrated)),\nmds-tab-item:not(:is([hydrated], .hydrated)),\nmds-table:not(:is([hydrated], .hydrated)),\nmds-table-body:not(:is([hydrated], .hydrated)),\nmds-table-cell:not(:is([hydrated], .hydrated)),\nmds-table-footer:not(:is([hydrated], .hydrated)),\nmds-table-header:not(:is([hydrated], .hydrated)),\nmds-table-header-cell:not(:is([hydrated], .hydrated)),\nmds-table-row:not(:is([hydrated], .hydrated)),\nmds-text:not(:is([hydrated], .hydrated)),\nmds-toast:not(:is([hydrated], .hydrated)),\nmds-tooltip:not(:is([hydrated], .hydrated)),\nmds-tree:not(:is([hydrated], .hydrated)),\nmds-tree-item:not(:is([hydrated], .hydrated)),\nmds-url-view:not(:is([hydrated], .hydrated)),\nmds-usage:not(:is([hydrated], .hydrated)),\nmds-video-wall:not(:is([hydrated], .hydrated)),\nmds-zero:not(:is([hydrated], .hydrated))\n{\n -webkit-animation-duration: 0s;\n animation-duration: 0s;\n border-color: transparent;\n -webkit-box-shadow: 0 0 0 transparent;\n box-shadow: 0 0 0 transparent;\n opacity: 0;\n outline-color: transparent;\n -webkit-transition-delay: 0s;\n transition-delay: 0s;\n -webkit-transition-duration: 0s;\n transition-duration: 0s;\n visibility: hidden;\n}\n\n";
|
8
8
|
const MdsInputTipStyle0 = mdsInputTipCss;
|
9
9
|
|
10
10
|
const MdsInputTip = class {
|
11
11
|
constructor(hostRef) {
|
12
12
|
index.registerInstance(this, hostRef);
|
13
|
+
/**
|
14
|
+
* Specifies if the component is active and shows expanded children or not
|
15
|
+
*/
|
13
16
|
this.active = false;
|
17
|
+
/**
|
18
|
+
* Specifies the position of the element relative to its container
|
19
|
+
*/
|
14
20
|
this.position = 'top';
|
15
21
|
}
|
16
22
|
render() {
|
@@ -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-66d8bb25.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-input-tip.cjs.js', document.baseURI).href));
|
@@ -0,0 +1,180 @@
|
|
1
|
+
import { arrow, autoPlacement, autoUpdate, computePosition, flip, offset, shift, } from "@floating-ui/dom";
|
2
|
+
import { cssDurationToMilliseconds } from "./unit";
|
3
|
+
import { setAttributeIfEmpty } from "./aria";
|
4
|
+
export class FloatingController {
|
5
|
+
constructor(host, arrowEl) {
|
6
|
+
this.arrowInset = (middleware, arrowPosition) => {
|
7
|
+
const { arrow } = middleware;
|
8
|
+
const inset = { bottom: '', left: '', right: '', top: '' };
|
9
|
+
if (arrow === undefined) {
|
10
|
+
return {};
|
11
|
+
}
|
12
|
+
switch (arrowPosition) {
|
13
|
+
case 'bottom':
|
14
|
+
inset.left = arrow.x !== null ? `${arrow.x}px` : '';
|
15
|
+
inset.top = '100%';
|
16
|
+
break;
|
17
|
+
case 'left':
|
18
|
+
inset.right = '100%';
|
19
|
+
inset.top = arrow.y !== null ? `${arrow.y}px` : '';
|
20
|
+
break;
|
21
|
+
case 'right':
|
22
|
+
inset.left = '100%';
|
23
|
+
inset.top = arrow.y !== null ? `${arrow.y}px` : '';
|
24
|
+
break;
|
25
|
+
case 'top':
|
26
|
+
inset.left = arrow.x !== null ? `${arrow.x}px` : '';
|
27
|
+
inset.top = '';
|
28
|
+
break;
|
29
|
+
default:
|
30
|
+
break;
|
31
|
+
}
|
32
|
+
return inset;
|
33
|
+
};
|
34
|
+
this.arrowTransform = (arrowPosition) => {
|
35
|
+
let transformProps = this._host.arrow && this._host.visible ? 'scale(1)' : 'scale(0)';
|
36
|
+
switch (arrowPosition) {
|
37
|
+
case 'bottom':
|
38
|
+
transformProps = `rotate(180deg) ${transformProps} translate(0, -100%)`;
|
39
|
+
break;
|
40
|
+
case 'left':
|
41
|
+
transformProps = `rotate(-90deg) ${transformProps} translate(50%, -50%)`;
|
42
|
+
break;
|
43
|
+
case 'right':
|
44
|
+
transformProps = `rotate(90deg) ${transformProps} translate(-50%, -50%)`;
|
45
|
+
break;
|
46
|
+
case 'top':
|
47
|
+
transformProps = `rotate(0deg) ${transformProps} translate(0, 0)`;
|
48
|
+
break;
|
49
|
+
default:
|
50
|
+
break;
|
51
|
+
}
|
52
|
+
return { transform: transformProps };
|
53
|
+
};
|
54
|
+
this.arrowTransformOrigin = (arrowPosition) => {
|
55
|
+
switch (arrowPosition) {
|
56
|
+
case 'bottom':
|
57
|
+
return { transformOrigin: 'center top' };
|
58
|
+
case 'left':
|
59
|
+
return { transformOrigin: 'right center' };
|
60
|
+
case 'right':
|
61
|
+
return { transformOrigin: 'left center' };
|
62
|
+
case 'top':
|
63
|
+
return { transformOrigin: 'center bottom' };
|
64
|
+
default:
|
65
|
+
return { transformOrigin: 'center top' };
|
66
|
+
}
|
67
|
+
};
|
68
|
+
this.calculatePosition = () => {
|
69
|
+
if (!this._caller)
|
70
|
+
return;
|
71
|
+
const middleware = new Array();
|
72
|
+
const config = {};
|
73
|
+
if (this._host.shiftPadding) {
|
74
|
+
config.padding = this._host.shiftPadding;
|
75
|
+
}
|
76
|
+
if (this._host.autoPlacement) {
|
77
|
+
middleware.push(autoPlacement());
|
78
|
+
}
|
79
|
+
if (this._host.offset) {
|
80
|
+
middleware.push(offset(this._host.offset));
|
81
|
+
}
|
82
|
+
if (!this._host.autoPlacement && this._host.flip) {
|
83
|
+
middleware.push(flip(config));
|
84
|
+
}
|
85
|
+
if (this._host.shift) {
|
86
|
+
middleware.push(shift(config));
|
87
|
+
}
|
88
|
+
if (this.arrowEl && this._host.arrow) {
|
89
|
+
middleware.push(arrow({
|
90
|
+
element: this.arrowEl,
|
91
|
+
padding: this._host.arrowPadding,
|
92
|
+
}));
|
93
|
+
}
|
94
|
+
computePosition(this._caller, this._host, {
|
95
|
+
middleware,
|
96
|
+
placement: this._host.placement,
|
97
|
+
strategy: this._host.strategy,
|
98
|
+
}).then(({ x, y, placement, middlewareData }) => {
|
99
|
+
Object.assign(this._host.style, {
|
100
|
+
left: `${x}px`,
|
101
|
+
top: `${y}px`,
|
102
|
+
});
|
103
|
+
const arrowStyle = {};
|
104
|
+
const arrowPosition = {
|
105
|
+
top: 'bottom',
|
106
|
+
right: 'left',
|
107
|
+
bottom: 'top',
|
108
|
+
left: 'right',
|
109
|
+
}[placement.split('-')[0]];
|
110
|
+
if (arrowPosition && this.arrowEl) {
|
111
|
+
Object.assign(arrowStyle, this.arrowTransform(arrowPosition));
|
112
|
+
Object.assign(arrowStyle, this.arrowInset(middlewareData, arrowPosition));
|
113
|
+
Object.assign(arrowStyle, this.arrowTransformOrigin(arrowPosition));
|
114
|
+
Object.assign(this.arrowEl.style, arrowStyle);
|
115
|
+
}
|
116
|
+
});
|
117
|
+
};
|
118
|
+
this._host = host;
|
119
|
+
this.arrowEl = arrowEl;
|
120
|
+
}
|
121
|
+
updateCaller(target) {
|
122
|
+
var _a, _b, _c;
|
123
|
+
// search caller in document or rootNode of host (if target is in shadowDOM)
|
124
|
+
const caller = (_c = (_b = (_a = this._host.parentElement) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector(target)) !== null && _c !== void 0 ? _c : this._host.getRootNode().querySelector(target);
|
125
|
+
if (!caller) {
|
126
|
+
throw Error(`Target not found: ${target}`);
|
127
|
+
}
|
128
|
+
this._caller = caller;
|
129
|
+
setAttributeIfEmpty(this._caller, 'aria-haspopup', 'true');
|
130
|
+
setAttributeIfEmpty(this._caller, 'aria-controls', target);
|
131
|
+
setAttributeIfEmpty(this._host, 'role', 'menu');
|
132
|
+
setAttributeIfEmpty(this._host, 'aria-labelledby', target);
|
133
|
+
return caller;
|
134
|
+
}
|
135
|
+
updatePosition() {
|
136
|
+
if (this.cleanupAutoUpdate)
|
137
|
+
this.cleanupAutoUpdate();
|
138
|
+
this.cleanupAutoUpdate = autoUpdate(this._caller, this._host, this.calculatePosition);
|
139
|
+
}
|
140
|
+
dismiss() {
|
141
|
+
this.cleanupAutoUpdate();
|
142
|
+
}
|
143
|
+
}
|
144
|
+
export class Backdrop {
|
145
|
+
constructor(backdropId) {
|
146
|
+
this.defaultBackdropId = 'magma-backdrop';
|
147
|
+
this.backdropBackgroundVisible = 'rgba(var(--magma-backdrop-color, 0 0 0) / var(--magma-backdrop-opacity, 0.1))';
|
148
|
+
this.backdropBackgroundHidden = 'rgba(var(--magma-backdrop-color, 0 0 0) / 0)';
|
149
|
+
this.backdropId = backdropId !== null && backdropId !== void 0 ? backdropId : this.defaultBackdropId;
|
150
|
+
this.cssBackdropZIndex = `var(--${this.backdropId}-z-index, 4000)`;
|
151
|
+
this.cssBackdropDuration = `var(--${this.backdropId}-animation-duration, 300ms)`;
|
152
|
+
}
|
153
|
+
attachBackdrop() {
|
154
|
+
if (!this.backdropEl) {
|
155
|
+
this.backdropEl = document.createElement('div');
|
156
|
+
this.backdropEl.className = this.backdropId;
|
157
|
+
this.backdropEl.style.inset = '0';
|
158
|
+
this.backdropEl.style.pointerEvents = 'none';
|
159
|
+
this.backdropEl.style.position = 'fixed';
|
160
|
+
this.backdropEl.style.transition = `background-color ${this.cssBackdropDuration} ease-out`;
|
161
|
+
this.backdropEl.style.zIndex = this.cssBackdropZIndex;
|
162
|
+
}
|
163
|
+
this.backdropEl.style.backgroundColor = this.backdropBackgroundHidden;
|
164
|
+
document.body.appendChild(this.backdropEl);
|
165
|
+
clearTimeout(this.backdropTimer);
|
166
|
+
this.backdropTimer = setTimeout(() => {
|
167
|
+
this.backdropEl.style.backgroundColor = this.backdropBackgroundVisible;
|
168
|
+
}, 1);
|
169
|
+
}
|
170
|
+
detachBackdrop() {
|
171
|
+
if (!this.backdropEl) {
|
172
|
+
return;
|
173
|
+
}
|
174
|
+
this.backdropEl.style.backgroundColor = 'transparent';
|
175
|
+
clearTimeout(this.backdropTimer);
|
176
|
+
this.backdropTimer = setTimeout(() => {
|
177
|
+
this.backdropEl.remove();
|
178
|
+
}, cssDurationToMilliseconds(this.cssBackdropDuration));
|
179
|
+
}
|
180
|
+
}
|