@agnos-ui/core 0.9.2 → 0.10.0-next.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/{accordion-CoM4efp-.js → accordion-CcirvrjR.js} +10 -15
- package/{accordion-cR5JqWJ8.cjs → accordion-yD-czBna.cjs} +10 -15
- package/{alert-DtDozJal.cjs → alert-B-jQDQcB.cjs} +1 -1
- package/{alert-YIlqdEPO.js → alert-gGz2CDS9.js} +1 -1
- package/collapse-BV4kD3j9.js +82 -0
- package/collapse-gLiT080Y.cjs +81 -0
- package/{common-BToNPUDq.cjs → common-D3QcdJ6S.cjs} +1 -1
- package/{common-BqUjUBPy.js → common-DK0ADNTX.js} +1 -1
- package/components/accordion/index.cjs +1 -1
- package/components/accordion/index.js +1 -1
- package/components/alert/index.cjs +1 -1
- package/components/alert/index.js +1 -1
- package/components/carousel/index.cjs +10 -23
- package/components/carousel/index.js +10 -23
- package/components/collapse/collapse.d.ts +132 -0
- package/components/collapse/index.cjs +5 -0
- package/components/collapse/index.d.ts +1 -0
- package/components/collapse/index.js +5 -0
- package/components/drawer/drawer.d.ts +222 -0
- package/components/drawer/index.cjs +5 -0
- package/components/drawer/index.d.ts +1 -0
- package/components/drawer/index.js +5 -0
- package/components/modal/index.cjs +2 -1
- package/components/modal/index.js +2 -1
- package/components/modal/modal.d.ts +5 -0
- package/components/pagination/index.cjs +1 -1
- package/components/pagination/index.js +1 -1
- package/components/progressbar/index.cjs +1 -1
- package/components/progressbar/index.js +1 -1
- package/components/rating/index.cjs +1 -1
- package/components/rating/index.js +1 -1
- package/components/select/index.cjs +1 -1
- package/components/select/index.js +1 -1
- package/components/slider/index.cjs +1 -1
- package/components/slider/index.js +1 -1
- package/components/toast/index.cjs +1 -1
- package/components/toast/index.js +1 -1
- package/components/tree/index.cjs +1 -1
- package/components/tree/index.js +1 -1
- package/config.cjs +2 -2
- package/config.d.ts +10 -0
- package/config.js +2 -2
- package/{dom-gfxqXJpK.js → dom-Bcg9ORcA.js} +64 -54
- package/{dom-CuBx1JPZ.cjs → dom-C2gi9OCP.cjs} +47 -37
- package/drawer-D5SO73ew.js +251 -0
- package/drawer-DP7UPojk.cjs +250 -0
- package/index.cjs +21 -12
- package/index.d.ts +2 -0
- package/index.js +54 -45
- package/isFocusable-Ckwus82R.js +32 -0
- package/isFocusable-DfzDLeAN.cjs +31 -0
- package/{modal-D3wGIDlj.js → modal-CAvQW-vo.js} +26 -32
- package/{modal-BEnQ6c5M.cjs → modal-DiXZXYjR.cjs} +27 -33
- package/package.json +1 -1
- package/{pagination-B97wBLok.js → pagination-BKbMROV6.js} +4 -4
- package/{pagination-C1TT-oea.cjs → pagination-DvZ2rLsz.cjs} +4 -4
- package/{progressbar-BWBlRk_Y.js → progressbar-D8zIcm9n.js} +2 -2
- package/{progressbar-CRvhNB5R.cjs → progressbar-i9xfAxb7.cjs} +2 -2
- package/{promise-XSP94FjG.js → promise-Y53vc4Ia.js} +5 -5
- package/{rating-BXvy9kXq.js → rating-DEXTGWCU.js} +2 -2
- package/{rating-DAb6nR67.cjs → rating-DmG4oUkr.cjs} +2 -2
- package/scrollbars-CT87iv_6.cjs +30 -0
- package/scrollbars-CcxSrnCx.js +31 -0
- package/{select-BdjpnE7_.js → select-Bw68Xdu5.js} +4 -5
- package/{select-C0rJJQfl.cjs → select-MFjAnIt7.cjs} +4 -5
- package/services/extendWidget.cjs +2 -2
- package/services/extendWidget.js +2 -2
- package/services/floatingUI.cjs +8 -29
- package/services/floatingUI.js +9 -30
- package/services/focusElement.cjs +46 -0
- package/services/focusElement.d.ts +9 -0
- package/services/focusElement.js +46 -0
- package/services/focustrack.cjs +1 -1
- package/services/focustrack.js +1 -1
- package/services/matchMedia.cjs +1 -1
- package/services/matchMedia.js +1 -1
- package/services/navManager.cjs +7 -37
- package/services/navManager.js +6 -36
- package/services/portal.cjs +7 -10
- package/services/portal.js +7 -10
- package/services/resizeObserver.cjs +2 -2
- package/services/resizeObserver.js +2 -2
- package/services/siblingsInert.cjs +9 -8
- package/services/siblingsInert.d.ts +13 -3
- package/services/siblingsInert.js +9 -8
- package/services/transitions/baseTransitions.cjs +9 -10
- package/services/transitions/baseTransitions.js +10 -11
- package/services/transitions/collapse.cjs +1 -1
- package/services/transitions/collapse.js +1 -1
- package/services/transitions/cssTransitions.cjs +1 -1
- package/services/transitions/cssTransitions.js +2 -2
- package/services/transitions/simpleClassTransition.cjs +1 -1
- package/services/transitions/simpleClassTransition.js +1 -1
- package/{slider-BmxQ3A_u.js → slider-Cx50Eghd.js} +14 -24
- package/{slider-DSx5CAce.cjs → slider-Dl4Trh32.cjs} +14 -24
- package/toaster-UDglac7x.cjs +187 -0
- package/toaster-_p1GTtHI.js +188 -0
- package/{tree-BFrXdJox.js → tree-DV0tfPlZ.js} +7 -11
- package/{tree-Pvr2rZ-D.cjs → tree-rGHtmCnS.cjs} +7 -11
- package/utils/directive.cjs +3 -1
- package/utils/directive.d.ts +47 -0
- package/utils/directive.js +14 -12
- package/utils/stores.cjs +8 -9
- package/utils/stores.js +8 -9
- package/utils/writables.cjs +1 -1
- package/utils/writables.js +1 -1
- package/{writables-Bn3uhKEG.cjs → writables-DcGT98a7.cjs} +1 -1
- package/{writables-CgpOQ4hA.js → writables-e0tyaQpe.js} +1 -1
- package/toaster-Cayg6Lbq.cjs +0 -209
- package/toaster-XfzHDqz_.js +0 -210
package/services/portal.js
CHANGED
|
@@ -1,25 +1,23 @@
|
|
|
1
|
-
import { b as browserDirective } from "../dom-
|
|
1
|
+
import { b as browserDirective } from "../dom-Bcg9ORcA.js";
|
|
2
2
|
const portal = browserDirective((content, newArg) => {
|
|
3
3
|
let arg;
|
|
4
4
|
let replaceComment;
|
|
5
5
|
const removeReplaceComment = () => {
|
|
6
|
-
var _a;
|
|
7
6
|
if (replaceComment) {
|
|
8
|
-
|
|
7
|
+
replaceComment.parentNode?.replaceChild(content, replaceComment);
|
|
9
8
|
replaceComment = null;
|
|
10
9
|
}
|
|
11
10
|
};
|
|
12
11
|
const update = (newArg2) => {
|
|
13
|
-
|
|
14
|
-
if (newArg2 !== arg && ((newArg2 == null ? void 0 : newArg2.container) !== (arg == null ? void 0 : arg.container) || (newArg2 == null ? void 0 : newArg2.insertBefore) !== (arg == null ? void 0 : arg.insertBefore))) {
|
|
12
|
+
if (newArg2 !== arg && (newArg2?.container !== arg?.container || newArg2?.insertBefore !== arg?.insertBefore)) {
|
|
15
13
|
arg = newArg2;
|
|
16
|
-
const container =
|
|
14
|
+
const container = arg?.container ?? arg?.insertBefore?.parentElement;
|
|
17
15
|
if (container) {
|
|
18
|
-
const insertBefore =
|
|
16
|
+
const insertBefore = arg?.insertBefore ?? null;
|
|
19
17
|
const moveNeeded = content.parentElement !== container || content.nextSibling !== insertBefore;
|
|
20
18
|
if (moveNeeded) {
|
|
21
19
|
if (!replaceComment) {
|
|
22
|
-
replaceComment =
|
|
20
|
+
replaceComment = content.parentNode?.insertBefore(content.ownerDocument.createComment("portal"), content);
|
|
23
21
|
}
|
|
24
22
|
container.insertBefore(content, insertBefore);
|
|
25
23
|
}
|
|
@@ -32,9 +30,8 @@ const portal = browserDirective((content, newArg) => {
|
|
|
32
30
|
return {
|
|
33
31
|
update,
|
|
34
32
|
destroy: () => {
|
|
35
|
-
var _a;
|
|
36
33
|
removeReplaceComment();
|
|
37
|
-
|
|
34
|
+
content.parentNode?.removeChild(content);
|
|
38
35
|
}
|
|
39
36
|
};
|
|
40
37
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const tansu = require("@amadeus-it-group/tansu");
|
|
4
|
-
const utils_directive = require("../dom-
|
|
4
|
+
const utils_directive = require("../dom-C2gi9OCP.cjs");
|
|
5
5
|
const utils_func = require("../utils/func.cjs");
|
|
6
6
|
const createResizeObserver = () => {
|
|
7
7
|
const { element$, directive } = utils_directive.createBrowserStoreDirective();
|
|
@@ -15,7 +15,7 @@ const createResizeObserver = () => {
|
|
|
15
15
|
set(entries[0]);
|
|
16
16
|
});
|
|
17
17
|
observer.observe(element);
|
|
18
|
-
return () => observer
|
|
18
|
+
return () => observer?.disconnect();
|
|
19
19
|
},
|
|
20
20
|
void 0
|
|
21
21
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { derived } from "@amadeus-it-group/tansu";
|
|
2
|
-
import {
|
|
2
|
+
import { l as createBrowserStoreDirective } from "../dom-Bcg9ORcA.js";
|
|
3
3
|
import { noop } from "../utils/func.js";
|
|
4
4
|
const createResizeObserver = () => {
|
|
5
5
|
const { element$, directive } = createBrowserStoreDirective();
|
|
@@ -13,7 +13,7 @@ const createResizeObserver = () => {
|
|
|
13
13
|
set(entries[0]);
|
|
14
14
|
});
|
|
15
15
|
observer.observe(element);
|
|
16
|
-
return () => observer
|
|
16
|
+
return () => observer?.disconnect();
|
|
17
17
|
},
|
|
18
18
|
void 0
|
|
19
19
|
);
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const tansu = require("@amadeus-it-group/tansu");
|
|
4
|
+
const utils_directive = require("../dom-C2gi9OCP.cjs");
|
|
4
5
|
const utils_func = require("../utils/func.cjs");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
6
|
+
const ignoreInertAttributeName = "data-agnos-ignore-inert";
|
|
7
|
+
const applyInertToSiblingsRecursively = (element) => {
|
|
7
8
|
const inertValues = /* @__PURE__ */ new Map();
|
|
8
9
|
const recursiveHelper = (element2) => {
|
|
9
10
|
const parent = element2.parentElement;
|
|
10
11
|
if (parent && element2 !== document.body) {
|
|
11
12
|
Array.from(parent.children).forEach((sibling) => {
|
|
12
|
-
if (sibling !== element2 && sibling.nodeName !== "SCRIPT") {
|
|
13
|
+
if (sibling !== element2 && sibling.nodeName !== "SCRIPT" && !sibling.hasAttribute(ignoreInertAttributeName)) {
|
|
13
14
|
inertValues.set(sibling, sibling.hasAttribute("inert"));
|
|
14
15
|
sibling.toggleAttribute("inert", true);
|
|
15
16
|
}
|
|
@@ -25,16 +26,16 @@ const internalSetSiblingsInert = (element) => {
|
|
|
25
26
|
let internalRevert = utils_func.noop;
|
|
26
27
|
const setSiblingsInert = (element) => {
|
|
27
28
|
internalRevert();
|
|
28
|
-
internalRevert = element ?
|
|
29
|
+
internalRevert = element ? applyInertToSiblingsRecursively(element) : utils_func.noop;
|
|
29
30
|
};
|
|
30
|
-
const { directive: storeArrayDirective, elements$ } = utils_directive.
|
|
31
|
-
const
|
|
31
|
+
const { directive: storeArrayDirective, elements$ } = utils_directive.createConditionalBrowserStoreArrayDirective();
|
|
32
|
+
const lastTrackedElement$ = tansu.computed(
|
|
32
33
|
() => {
|
|
33
34
|
const elements = elements$();
|
|
34
35
|
return elements[elements.length - 1];
|
|
35
36
|
},
|
|
36
37
|
{ equal: Object.is }
|
|
37
38
|
);
|
|
38
|
-
const
|
|
39
|
-
const siblingsInert = utils_directive.mergeDirectives(storeArrayDirective, utils_directive.directiveSubscribe(
|
|
39
|
+
const updateInertState$ = tansu.computed(() => setSiblingsInert(lastTrackedElement$()));
|
|
40
|
+
const siblingsInert = utils_directive.mergeDirectives(storeArrayDirective, utils_directive.directiveSubscribe(updateInertState$));
|
|
40
41
|
exports.siblingsInert = siblingsInert;
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import type { Directive } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* Directive to manage focus trapping by setting the `inert` attribute on sibling elements.
|
|
4
|
+
* This is useful for modal dialogs or overlays where interaction should be limited to a specific subtree.
|
|
5
|
+
*
|
|
6
|
+
* - Recursively traverses up the DOM tree.
|
|
7
|
+
* - Sets `inert` on all siblings except the target element and `<script>` tags.
|
|
8
|
+
* - Use `data-agnos-ignore-inert` to avoid inert attribute for a specified element.
|
|
9
|
+
*
|
|
10
|
+
* Takes boolean or undefined as value:
|
|
11
|
+
* - `true` or `undefined`: Apply inert to siblings.
|
|
12
|
+
* - `false`: Do not apply inert to siblings.
|
|
13
|
+
*
|
|
14
|
+
* Automatically reverts when the target element changes or is removed.
|
|
5
15
|
*/
|
|
6
|
-
export declare const siblingsInert: Directive
|
|
16
|
+
export declare const siblingsInert: Directive<boolean | undefined>;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { computed } from "@amadeus-it-group/tansu";
|
|
2
|
+
import { j as createConditionalBrowserStoreArrayDirective, n as mergeDirectives, d as directiveSubscribe } from "../dom-Bcg9ORcA.js";
|
|
2
3
|
import { noop } from "../utils/func.js";
|
|
3
|
-
|
|
4
|
-
const
|
|
4
|
+
const ignoreInertAttributeName = "data-agnos-ignore-inert";
|
|
5
|
+
const applyInertToSiblingsRecursively = (element) => {
|
|
5
6
|
const inertValues = /* @__PURE__ */ new Map();
|
|
6
7
|
const recursiveHelper = (element2) => {
|
|
7
8
|
const parent = element2.parentElement;
|
|
8
9
|
if (parent && element2 !== document.body) {
|
|
9
10
|
Array.from(parent.children).forEach((sibling) => {
|
|
10
|
-
if (sibling !== element2 && sibling.nodeName !== "SCRIPT") {
|
|
11
|
+
if (sibling !== element2 && sibling.nodeName !== "SCRIPT" && !sibling.hasAttribute(ignoreInertAttributeName)) {
|
|
11
12
|
inertValues.set(sibling, sibling.hasAttribute("inert"));
|
|
12
13
|
sibling.toggleAttribute("inert", true);
|
|
13
14
|
}
|
|
@@ -23,18 +24,18 @@ const internalSetSiblingsInert = (element) => {
|
|
|
23
24
|
let internalRevert = noop;
|
|
24
25
|
const setSiblingsInert = (element) => {
|
|
25
26
|
internalRevert();
|
|
26
|
-
internalRevert = element ?
|
|
27
|
+
internalRevert = element ? applyInertToSiblingsRecursively(element) : noop;
|
|
27
28
|
};
|
|
28
|
-
const { directive: storeArrayDirective, elements$ } =
|
|
29
|
-
const
|
|
29
|
+
const { directive: storeArrayDirective, elements$ } = createConditionalBrowserStoreArrayDirective();
|
|
30
|
+
const lastTrackedElement$ = computed(
|
|
30
31
|
() => {
|
|
31
32
|
const elements = elements$();
|
|
32
33
|
return elements[elements.length - 1];
|
|
33
34
|
},
|
|
34
35
|
{ equal: Object.is }
|
|
35
36
|
);
|
|
36
|
-
const
|
|
37
|
-
const siblingsInert = mergeDirectives(storeArrayDirective, directiveSubscribe(
|
|
37
|
+
const updateInertState$ = computed(() => setSiblingsInert(lastTrackedElement$()));
|
|
38
|
+
const siblingsInert = mergeDirectives(storeArrayDirective, directiveSubscribe(updateInertState$));
|
|
38
39
|
export {
|
|
39
40
|
siblingsInert
|
|
40
41
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const tansu = require("@amadeus-it-group/tansu");
|
|
4
|
-
const utils_writables = require("../../writables-
|
|
4
|
+
const utils_writables = require("../../writables-DcGT98a7.cjs");
|
|
5
5
|
const promise = require("../../promise-CxCD3NYv.cjs");
|
|
6
6
|
const utils_func = require("../../utils/func.cjs");
|
|
7
7
|
const utils_stores = require("../../utils/stores.cjs");
|
|
8
|
-
const utils_directive = require("../../dom-
|
|
8
|
+
const utils_directive = require("../../dom-C2gi9OCP.cjs");
|
|
9
9
|
const neverEndingPromise = new Promise(utils_func.noop);
|
|
10
10
|
const noAnimation = (element, direction) => {
|
|
11
11
|
element.style.display = direction === "show" ? "" : "none";
|
|
@@ -41,8 +41,8 @@ const createTransition = (config) => {
|
|
|
41
41
|
const stop = () => {
|
|
42
42
|
let context;
|
|
43
43
|
currentTransition$.update((currentTransition) => {
|
|
44
|
-
currentTransition
|
|
45
|
-
context = currentTransition
|
|
44
|
+
currentTransition?.abort.abort();
|
|
45
|
+
context = currentTransition?.context;
|
|
46
46
|
return null;
|
|
47
47
|
});
|
|
48
48
|
return context;
|
|
@@ -64,7 +64,6 @@ const createTransition = (config) => {
|
|
|
64
64
|
currentTransition$.set(currentTransition);
|
|
65
65
|
resolve(
|
|
66
66
|
(async () => {
|
|
67
|
-
var _a;
|
|
68
67
|
try {
|
|
69
68
|
await transitionFn(element, visible ? "show" : "hide", animated, signal, context);
|
|
70
69
|
} finally {
|
|
@@ -72,7 +71,7 @@ const createTransition = (config) => {
|
|
|
72
71
|
await neverEndingPromise;
|
|
73
72
|
} else {
|
|
74
73
|
currentTransition$.set(null);
|
|
75
|
-
(
|
|
74
|
+
(visible ? onShown$ : onHidden$)()?.();
|
|
76
75
|
}
|
|
77
76
|
}
|
|
78
77
|
})()
|
|
@@ -100,9 +99,9 @@ const createTransition = (config) => {
|
|
|
100
99
|
if (visibleChanged || animationFromToggle != null) {
|
|
101
100
|
pendingTransition = null;
|
|
102
101
|
}
|
|
103
|
-
const animate = animationFromToggle ??
|
|
102
|
+
const animate = animationFromToggle ?? pendingTransition?.animated ?? (elementChanged && !visible ? false : animated);
|
|
104
103
|
currentTransition = runTransition(visible, animate, element, transition);
|
|
105
|
-
pendingTransition
|
|
104
|
+
pendingTransition?.resolve(currentTransition.promise);
|
|
106
105
|
pendingTransition = null;
|
|
107
106
|
}
|
|
108
107
|
} else {
|
|
@@ -110,7 +109,7 @@ const createTransition = (config) => {
|
|
|
110
109
|
stop();
|
|
111
110
|
currentTransition = null;
|
|
112
111
|
}
|
|
113
|
-
if (visibleChanged || visible &&
|
|
112
|
+
if (visibleChanged || visible && pendingTransition?.animated !== animationFromToggle) {
|
|
114
113
|
pendingTransition = visible && animationFromToggle != null ? {
|
|
115
114
|
// toggle was called to display the element, but the element is not yet in the DOM
|
|
116
115
|
// let's keep the animation setting from toggle and provide the promise for the end of toggle
|
|
@@ -119,7 +118,7 @@ const createTransition = (config) => {
|
|
|
119
118
|
} : null;
|
|
120
119
|
}
|
|
121
120
|
}
|
|
122
|
-
return
|
|
121
|
+
return pendingTransition?.promise ?? currentTransition?.promise;
|
|
123
122
|
}
|
|
124
123
|
);
|
|
125
124
|
let lastToggle = {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { computed, writable, derived, batch } from "@amadeus-it-group/tansu";
|
|
2
|
-
import { d as typeBooleanOrNull, g as typeFunction, c as typeBoolean } from "../../writables-
|
|
3
|
-
import {
|
|
2
|
+
import { d as typeBooleanOrNull, g as typeFunction, c as typeBoolean } from "../../writables-e0tyaQpe.js";
|
|
3
|
+
import { d as promiseWithResolve } from "../../promise-Y53vc4Ia.js";
|
|
4
4
|
import { noop } from "../../utils/func.js";
|
|
5
5
|
import { writablesForProps, bindableDerived, stateStores } from "../../utils/stores.js";
|
|
6
|
-
import {
|
|
6
|
+
import { k as createStoreDirective, n as mergeDirectives, d as directiveSubscribe } from "../../dom-Bcg9ORcA.js";
|
|
7
7
|
const neverEndingPromise = new Promise(noop);
|
|
8
8
|
const noAnimation = (element, direction) => {
|
|
9
9
|
element.style.display = direction === "show" ? "" : "none";
|
|
@@ -39,8 +39,8 @@ const createTransition = (config) => {
|
|
|
39
39
|
const stop = () => {
|
|
40
40
|
let context;
|
|
41
41
|
currentTransition$.update((currentTransition) => {
|
|
42
|
-
currentTransition
|
|
43
|
-
context = currentTransition
|
|
42
|
+
currentTransition?.abort.abort();
|
|
43
|
+
context = currentTransition?.context;
|
|
44
44
|
return null;
|
|
45
45
|
});
|
|
46
46
|
return context;
|
|
@@ -62,7 +62,6 @@ const createTransition = (config) => {
|
|
|
62
62
|
currentTransition$.set(currentTransition);
|
|
63
63
|
resolve(
|
|
64
64
|
(async () => {
|
|
65
|
-
var _a;
|
|
66
65
|
try {
|
|
67
66
|
await transitionFn(element, visible ? "show" : "hide", animated, signal, context);
|
|
68
67
|
} finally {
|
|
@@ -70,7 +69,7 @@ const createTransition = (config) => {
|
|
|
70
69
|
await neverEndingPromise;
|
|
71
70
|
} else {
|
|
72
71
|
currentTransition$.set(null);
|
|
73
|
-
(
|
|
72
|
+
(visible ? onShown$ : onHidden$)()?.();
|
|
74
73
|
}
|
|
75
74
|
}
|
|
76
75
|
})()
|
|
@@ -98,9 +97,9 @@ const createTransition = (config) => {
|
|
|
98
97
|
if (visibleChanged || animationFromToggle != null) {
|
|
99
98
|
pendingTransition = null;
|
|
100
99
|
}
|
|
101
|
-
const animate = animationFromToggle ??
|
|
100
|
+
const animate = animationFromToggle ?? pendingTransition?.animated ?? (elementChanged && !visible ? false : animated);
|
|
102
101
|
currentTransition = runTransition(visible, animate, element, transition);
|
|
103
|
-
pendingTransition
|
|
102
|
+
pendingTransition?.resolve(currentTransition.promise);
|
|
104
103
|
pendingTransition = null;
|
|
105
104
|
}
|
|
106
105
|
} else {
|
|
@@ -108,7 +107,7 @@ const createTransition = (config) => {
|
|
|
108
107
|
stop();
|
|
109
108
|
currentTransition = null;
|
|
110
109
|
}
|
|
111
|
-
if (visibleChanged || visible &&
|
|
110
|
+
if (visibleChanged || visible && pendingTransition?.animated !== animationFromToggle) {
|
|
112
111
|
pendingTransition = visible && animationFromToggle != null ? {
|
|
113
112
|
// toggle was called to display the element, but the element is not yet in the DOM
|
|
114
113
|
// let's keep the animation setting from toggle and provide the promise for the end of toggle
|
|
@@ -117,7 +116,7 @@ const createTransition = (config) => {
|
|
|
117
116
|
} : null;
|
|
118
117
|
}
|
|
119
118
|
}
|
|
120
|
-
return
|
|
119
|
+
return pendingTransition?.promise ?? currentTransition?.promise;
|
|
121
120
|
}
|
|
122
121
|
);
|
|
123
122
|
let lastToggle = {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const utils_directive = require("../../dom-
|
|
3
|
+
const utils_directive = require("../../dom-C2gi9OCP.cjs");
|
|
4
4
|
const services_transitions_cssTransitions = require("./cssTransitions.cjs");
|
|
5
5
|
const createCollapseTransition = ({
|
|
6
6
|
dimension = "height",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as isBrowserHTMLElement,
|
|
1
|
+
import { i as isBrowserHTMLElement, x as removeClasses, y as addClasses, z as reflow } from "../../dom-Bcg9ORcA.js";
|
|
2
2
|
import { createCSSTransition } from "./cssTransitions.js";
|
|
3
3
|
const createCollapseTransition = ({
|
|
4
4
|
dimension = "height",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const utils_directive = require("../../dom-
|
|
3
|
+
const utils_directive = require("../../dom-C2gi9OCP.cjs");
|
|
4
4
|
const utils_func = require("../../utils/func.cjs");
|
|
5
5
|
const promise = require("../../promise-CxCD3NYv.cjs");
|
|
6
6
|
function hasTransition(element) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as isBrowserHTMLElement } from "../../dom-
|
|
1
|
+
import { i as isBrowserHTMLElement } from "../../dom-Bcg9ORcA.js";
|
|
2
2
|
import { noop } from "../../utils/func.js";
|
|
3
|
-
import {
|
|
3
|
+
import { b as promiseFromEvent, c as promiseFromTimeout } from "../../promise-Y53vc4Ia.js";
|
|
4
4
|
function hasTransition(element) {
|
|
5
5
|
return window.getComputedStyle(element).transitionProperty !== "none";
|
|
6
6
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const services_transitions_cssTransitions = require("./cssTransitions.cjs");
|
|
4
|
-
const utils_directive = require("../../dom-
|
|
4
|
+
const utils_directive = require("../../dom-C2gi9OCP.cjs");
|
|
5
5
|
const createSimpleClassTransition = (config) => {
|
|
6
6
|
const { animationPendingClasses, animationPendingShowClasses, animationPendingHideClasses, showClasses, hideClasses } = config;
|
|
7
7
|
return services_transitions_cssTransitions.createCSSTransition((element, direction, animated, context) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createCSSTransition } from "./cssTransitions.js";
|
|
2
|
-
import {
|
|
2
|
+
import { x as removeClasses, y as addClasses, z as reflow } from "../../dom-Bcg9ORcA.js";
|
|
3
3
|
const createSimpleClassTransition = (config) => {
|
|
4
4
|
const { animationPendingClasses, animationPendingShowClasses, animationPendingHideClasses, showClasses, hideClasses } = config;
|
|
5
5
|
return createCSSTransition((element, direction, animated, context) => {
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { computed, writable, readable } from "@amadeus-it-group/tansu";
|
|
2
|
-
import {
|
|
2
|
+
import { l as createBrowserStoreDirective, h as createBrowserStoreArrayDirective, n as mergeDirectives, p as createAttributesDirective, b as browserDirective } from "./dom-Bcg9ORcA.js";
|
|
3
3
|
import { noop } from "./utils/func.js";
|
|
4
4
|
import { writablesForProps, bindableProp, stateStores, true$ } from "./utils/stores.js";
|
|
5
|
-
import { i as typeArray, c as typeBoolean, b as typeNumberInRangeFactory, e as typeString, g as typeFunction, a as typeNumber } from "./writables-
|
|
5
|
+
import { i as typeArray, c as typeBoolean, b as typeNumberInRangeFactory, e as typeString, g as typeFunction, a as typeNumber } from "./writables-e0tyaQpe.js";
|
|
6
6
|
import { createResizeObserver } from "./services/resizeObserver.js";
|
|
7
7
|
import { createWidgetFactory } from "./utils/widget.js";
|
|
8
8
|
const decimalRegExp = /(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/;
|
|
9
9
|
function getDecimalPrecision(number) {
|
|
10
|
-
var _a;
|
|
11
10
|
const matches = ("" + number).match(decimalRegExp);
|
|
12
11
|
return Math.max(
|
|
13
12
|
0,
|
|
14
13
|
// Number of digits right of decimal point.
|
|
15
|
-
(
|
|
14
|
+
(matches[1]?.length ?? 0) - // Adjust for exponential notation.
|
|
16
15
|
(+matches[2] || 0)
|
|
17
16
|
);
|
|
18
17
|
}
|
|
@@ -255,10 +254,9 @@ const createSlider = createWidgetFactory("slider", (config) => {
|
|
|
255
254
|
);
|
|
256
255
|
const sliderDomRect$ = computed(
|
|
257
256
|
() => {
|
|
258
|
-
var _a;
|
|
259
257
|
dimensions$();
|
|
260
258
|
updateSliderSize$();
|
|
261
|
-
return
|
|
259
|
+
return sliderDom$()?.getBoundingClientRect() ?? {};
|
|
262
260
|
},
|
|
263
261
|
{
|
|
264
262
|
equal: Object.is
|
|
@@ -266,10 +264,9 @@ const createSlider = createWidgetFactory("slider", (config) => {
|
|
|
266
264
|
);
|
|
267
265
|
const minLabelDomRect$ = computed(
|
|
268
266
|
() => {
|
|
269
|
-
var _a;
|
|
270
267
|
dimensions$();
|
|
271
268
|
updateSliderSize$();
|
|
272
|
-
return
|
|
269
|
+
return minLabelDom$()?.getBoundingClientRect() ?? {};
|
|
273
270
|
},
|
|
274
271
|
{
|
|
275
272
|
equal: (a, b) => Object.is(a, b)
|
|
@@ -277,10 +274,9 @@ const createSlider = createWidgetFactory("slider", (config) => {
|
|
|
277
274
|
);
|
|
278
275
|
const maxLabelDomRect$ = computed(
|
|
279
276
|
() => {
|
|
280
|
-
var _a;
|
|
281
277
|
dimensions$();
|
|
282
278
|
updateSliderSize$();
|
|
283
|
-
return
|
|
279
|
+
return maxLabelDom$()?.getBoundingClientRect() ?? {};
|
|
284
280
|
},
|
|
285
281
|
{
|
|
286
282
|
equal: (a, b) => Object.is(a, b)
|
|
@@ -318,16 +314,10 @@ const createSlider = createWidgetFactory("slider", (config) => {
|
|
|
318
314
|
const adjustedShowValueLabels$ = computed(() => showValueLabels$() && (!showTicks$() || !showTickValues$()));
|
|
319
315
|
const pixelToPercent = (pixels) => pixels ? pixels / sliderDomRectSize$() * 100 : 0;
|
|
320
316
|
const combinedLabelSize$ = computed(
|
|
321
|
-
() =>
|
|
322
|
-
var _a, _b;
|
|
323
|
-
return pixelToPercent(vertical$() ? (_a = combinedLabelDom$()) == null ? void 0 : _a.getBoundingClientRect().height : (_b = combinedLabelDom$()) == null ? void 0 : _b.getBoundingClientRect().width);
|
|
324
|
-
}
|
|
317
|
+
() => pixelToPercent(vertical$() ? combinedLabelDom$()?.getBoundingClientRect().height : combinedLabelDom$()?.getBoundingClientRect().width)
|
|
325
318
|
);
|
|
326
319
|
const combinedLabelPosition$ = computed(() => vertical$() ? combinedLabelPositionTop$() : combinedLabelPositionLeft$());
|
|
327
|
-
const currentLabelSizeByIndex = (index) =>
|
|
328
|
-
var _a, _b;
|
|
329
|
-
return pixelToPercent(vertical$() ? (_a = currentLabelDomsRect$()[index]) == null ? void 0 : _a.height : (_b = currentLabelDomsRect$()[index]) == null ? void 0 : _b.width);
|
|
330
|
-
};
|
|
320
|
+
const currentLabelSizeByIndex = (index) => pixelToPercent(vertical$() ? currentLabelDomsRect$()[index]?.height : currentLabelDomsRect$()[index]?.width);
|
|
331
321
|
const minValueLabelDisplay$ = computed(() => {
|
|
332
322
|
if (!showMinMaxLabels$() || showTicks$() && showTickValues$()) {
|
|
333
323
|
return false;
|
|
@@ -369,8 +359,8 @@ const createSlider = createWidgetFactory("slider", (config) => {
|
|
|
369
359
|
storedLabelSize$.set(values.map((_, index) => currentLabelSizeByIndex(index) / 2));
|
|
370
360
|
}
|
|
371
361
|
const storedLabelSize = storedLabelSize$();
|
|
372
|
-
const firstLabelSize =
|
|
373
|
-
const secondLabelSize =
|
|
362
|
+
const firstLabelSize = storedLabelSize?.[0] ?? 0;
|
|
363
|
+
const secondLabelSize = storedLabelSize?.[1] ?? 0;
|
|
374
364
|
const biggestLabelSize = Math.max(firstLabelSize, secondLabelSize);
|
|
375
365
|
const intersectionLimit = biggestLabelSize !== 50 ? biggestLabelSize * 2 + 2 : 15;
|
|
376
366
|
return values.length == 2 && values[1] - secondLabelSize - values[0] + firstLabelSize < intersectionLimit;
|
|
@@ -567,7 +557,7 @@ const createSlider = createWidgetFactory("slider", (config) => {
|
|
|
567
557
|
const handleDrag = (e) => {
|
|
568
558
|
e.preventDefault();
|
|
569
559
|
const newCoord = vertical$() ? e.clientY : e.clientX;
|
|
570
|
-
currentTarget
|
|
560
|
+
currentTarget?.focus();
|
|
571
561
|
if (_prevCoordinate !== newCoord) {
|
|
572
562
|
_prevCoordinate = newCoord;
|
|
573
563
|
adjustCoordinate(newCoord, handleId);
|
|
@@ -575,7 +565,7 @@ const createSlider = createWidgetFactory("slider", (config) => {
|
|
|
575
565
|
};
|
|
576
566
|
if (interactive$()) {
|
|
577
567
|
updateSliderSize$.set({});
|
|
578
|
-
currentTarget
|
|
568
|
+
currentTarget?.focus();
|
|
579
569
|
document.addEventListener("mousemove", handleDrag);
|
|
580
570
|
document.addEventListener(
|
|
581
571
|
"mouseup",
|
|
@@ -591,7 +581,7 @@ const createSlider = createWidgetFactory("slider", (config) => {
|
|
|
591
581
|
const handleDrag = (e) => {
|
|
592
582
|
e.preventDefault();
|
|
593
583
|
const newCoord = vertical$() ? e.touches[0].clientY : e.touches[0].clientX;
|
|
594
|
-
currentTarget
|
|
584
|
+
currentTarget?.focus();
|
|
595
585
|
if (_prevCoordinate !== newCoord) {
|
|
596
586
|
_prevCoordinate = newCoord;
|
|
597
587
|
adjustCoordinate(newCoord, handleId);
|
|
@@ -599,7 +589,7 @@ const createSlider = createWidgetFactory("slider", (config) => {
|
|
|
599
589
|
};
|
|
600
590
|
if (interactive$()) {
|
|
601
591
|
updateSliderSize$.set({});
|
|
602
|
-
currentTarget
|
|
592
|
+
currentTarget?.focus();
|
|
603
593
|
document.addEventListener("touchmove", handleDrag, { passive: false });
|
|
604
594
|
document.addEventListener(
|
|
605
595
|
"touchend",
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const tansu = require("@amadeus-it-group/tansu");
|
|
3
|
-
const utils_directive = require("./dom-
|
|
3
|
+
const utils_directive = require("./dom-C2gi9OCP.cjs");
|
|
4
4
|
const utils_func = require("./utils/func.cjs");
|
|
5
5
|
const utils_stores = require("./utils/stores.cjs");
|
|
6
|
-
const utils_writables = require("./writables-
|
|
6
|
+
const utils_writables = require("./writables-DcGT98a7.cjs");
|
|
7
7
|
const services_resizeObserver = require("./services/resizeObserver.cjs");
|
|
8
8
|
const utils_widget = require("./utils/widget.cjs");
|
|
9
9
|
const decimalRegExp = /(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/;
|
|
10
10
|
function getDecimalPrecision(number) {
|
|
11
|
-
var _a;
|
|
12
11
|
const matches = ("" + number).match(decimalRegExp);
|
|
13
12
|
return Math.max(
|
|
14
13
|
0,
|
|
15
14
|
// Number of digits right of decimal point.
|
|
16
|
-
(
|
|
15
|
+
(matches[1]?.length ?? 0) - // Adjust for exponential notation.
|
|
17
16
|
(+matches[2] || 0)
|
|
18
17
|
);
|
|
19
18
|
}
|
|
@@ -256,10 +255,9 @@ const createSlider = utils_widget.createWidgetFactory("slider", (config) => {
|
|
|
256
255
|
);
|
|
257
256
|
const sliderDomRect$ = tansu.computed(
|
|
258
257
|
() => {
|
|
259
|
-
var _a;
|
|
260
258
|
dimensions$();
|
|
261
259
|
updateSliderSize$();
|
|
262
|
-
return
|
|
260
|
+
return sliderDom$()?.getBoundingClientRect() ?? {};
|
|
263
261
|
},
|
|
264
262
|
{
|
|
265
263
|
equal: Object.is
|
|
@@ -267,10 +265,9 @@ const createSlider = utils_widget.createWidgetFactory("slider", (config) => {
|
|
|
267
265
|
);
|
|
268
266
|
const minLabelDomRect$ = tansu.computed(
|
|
269
267
|
() => {
|
|
270
|
-
var _a;
|
|
271
268
|
dimensions$();
|
|
272
269
|
updateSliderSize$();
|
|
273
|
-
return
|
|
270
|
+
return minLabelDom$()?.getBoundingClientRect() ?? {};
|
|
274
271
|
},
|
|
275
272
|
{
|
|
276
273
|
equal: (a, b) => Object.is(a, b)
|
|
@@ -278,10 +275,9 @@ const createSlider = utils_widget.createWidgetFactory("slider", (config) => {
|
|
|
278
275
|
);
|
|
279
276
|
const maxLabelDomRect$ = tansu.computed(
|
|
280
277
|
() => {
|
|
281
|
-
var _a;
|
|
282
278
|
dimensions$();
|
|
283
279
|
updateSliderSize$();
|
|
284
|
-
return
|
|
280
|
+
return maxLabelDom$()?.getBoundingClientRect() ?? {};
|
|
285
281
|
},
|
|
286
282
|
{
|
|
287
283
|
equal: (a, b) => Object.is(a, b)
|
|
@@ -319,16 +315,10 @@ const createSlider = utils_widget.createWidgetFactory("slider", (config) => {
|
|
|
319
315
|
const adjustedShowValueLabels$ = tansu.computed(() => showValueLabels$() && (!showTicks$() || !showTickValues$()));
|
|
320
316
|
const pixelToPercent = (pixels) => pixels ? pixels / sliderDomRectSize$() * 100 : 0;
|
|
321
317
|
const combinedLabelSize$ = tansu.computed(
|
|
322
|
-
() =>
|
|
323
|
-
var _a, _b;
|
|
324
|
-
return pixelToPercent(vertical$() ? (_a = combinedLabelDom$()) == null ? void 0 : _a.getBoundingClientRect().height : (_b = combinedLabelDom$()) == null ? void 0 : _b.getBoundingClientRect().width);
|
|
325
|
-
}
|
|
318
|
+
() => pixelToPercent(vertical$() ? combinedLabelDom$()?.getBoundingClientRect().height : combinedLabelDom$()?.getBoundingClientRect().width)
|
|
326
319
|
);
|
|
327
320
|
const combinedLabelPosition$ = tansu.computed(() => vertical$() ? combinedLabelPositionTop$() : combinedLabelPositionLeft$());
|
|
328
|
-
const currentLabelSizeByIndex = (index) =>
|
|
329
|
-
var _a, _b;
|
|
330
|
-
return pixelToPercent(vertical$() ? (_a = currentLabelDomsRect$()[index]) == null ? void 0 : _a.height : (_b = currentLabelDomsRect$()[index]) == null ? void 0 : _b.width);
|
|
331
|
-
};
|
|
321
|
+
const currentLabelSizeByIndex = (index) => pixelToPercent(vertical$() ? currentLabelDomsRect$()[index]?.height : currentLabelDomsRect$()[index]?.width);
|
|
332
322
|
const minValueLabelDisplay$ = tansu.computed(() => {
|
|
333
323
|
if (!showMinMaxLabels$() || showTicks$() && showTickValues$()) {
|
|
334
324
|
return false;
|
|
@@ -370,8 +360,8 @@ const createSlider = utils_widget.createWidgetFactory("slider", (config) => {
|
|
|
370
360
|
storedLabelSize$.set(values.map((_, index) => currentLabelSizeByIndex(index) / 2));
|
|
371
361
|
}
|
|
372
362
|
const storedLabelSize = storedLabelSize$();
|
|
373
|
-
const firstLabelSize =
|
|
374
|
-
const secondLabelSize =
|
|
363
|
+
const firstLabelSize = storedLabelSize?.[0] ?? 0;
|
|
364
|
+
const secondLabelSize = storedLabelSize?.[1] ?? 0;
|
|
375
365
|
const biggestLabelSize = Math.max(firstLabelSize, secondLabelSize);
|
|
376
366
|
const intersectionLimit = biggestLabelSize !== 50 ? biggestLabelSize * 2 + 2 : 15;
|
|
377
367
|
return values.length == 2 && values[1] - secondLabelSize - values[0] + firstLabelSize < intersectionLimit;
|
|
@@ -568,7 +558,7 @@ const createSlider = utils_widget.createWidgetFactory("slider", (config) => {
|
|
|
568
558
|
const handleDrag = (e) => {
|
|
569
559
|
e.preventDefault();
|
|
570
560
|
const newCoord = vertical$() ? e.clientY : e.clientX;
|
|
571
|
-
currentTarget
|
|
561
|
+
currentTarget?.focus();
|
|
572
562
|
if (_prevCoordinate !== newCoord) {
|
|
573
563
|
_prevCoordinate = newCoord;
|
|
574
564
|
adjustCoordinate(newCoord, handleId);
|
|
@@ -576,7 +566,7 @@ const createSlider = utils_widget.createWidgetFactory("slider", (config) => {
|
|
|
576
566
|
};
|
|
577
567
|
if (interactive$()) {
|
|
578
568
|
updateSliderSize$.set({});
|
|
579
|
-
currentTarget
|
|
569
|
+
currentTarget?.focus();
|
|
580
570
|
document.addEventListener("mousemove", handleDrag);
|
|
581
571
|
document.addEventListener(
|
|
582
572
|
"mouseup",
|
|
@@ -592,7 +582,7 @@ const createSlider = utils_widget.createWidgetFactory("slider", (config) => {
|
|
|
592
582
|
const handleDrag = (e) => {
|
|
593
583
|
e.preventDefault();
|
|
594
584
|
const newCoord = vertical$() ? e.touches[0].clientY : e.touches[0].clientX;
|
|
595
|
-
currentTarget
|
|
585
|
+
currentTarget?.focus();
|
|
596
586
|
if (_prevCoordinate !== newCoord) {
|
|
597
587
|
_prevCoordinate = newCoord;
|
|
598
588
|
adjustCoordinate(newCoord, handleId);
|
|
@@ -600,7 +590,7 @@ const createSlider = utils_widget.createWidgetFactory("slider", (config) => {
|
|
|
600
590
|
};
|
|
601
591
|
if (interactive$()) {
|
|
602
592
|
updateSliderSize$.set({});
|
|
603
|
-
currentTarget
|
|
593
|
+
currentTarget?.focus();
|
|
604
594
|
document.addEventListener("touchmove", handleDrag, { passive: false });
|
|
605
595
|
document.addEventListener(
|
|
606
596
|
"touchend",
|