@monstermann/signals-modal 0.4.2 → 0.4.5
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/README.md +2011 -0
- package/dist/anchor/getAnchorElement.d.mts +30 -0
- package/dist/anchor/getAnchorElement.mjs +30 -0
- package/dist/anchor/getAnchorMeasurement.d.mts +39 -1
- package/dist/anchor/getAnchorMeasurement.mjs +37 -0
- package/dist/anchor/setAnchorElement.d.mts +26 -0
- package/dist/anchor/setAnchorElement.mjs +26 -0
- package/dist/anchor/withAnchorElement.d.mts +31 -0
- package/dist/anchor/withAnchorElement.mjs +31 -1
- package/dist/anchor/withAnchorMeasurement.d.mts +44 -1
- package/dist/anchor/withAnchorMeasurement.mjs +45 -3
- package/dist/anchor/withMouseAnchor.d.mts +35 -1
- package/dist/anchor/withMouseAnchor.mjs +36 -3
- package/dist/createModal.d.mts +29 -0
- package/dist/createModal.mjs +29 -0
- package/dist/floating/getFloatingElement.d.mts +30 -0
- package/dist/floating/getFloatingElement.mjs +30 -0
- package/dist/floating/getFloatingMeasurement.d.mts +39 -1
- package/dist/floating/getFloatingMeasurement.mjs +37 -0
- package/dist/floating/setFloatingElement.d.mts +26 -0
- package/dist/floating/setFloatingElement.mjs +26 -0
- package/dist/floating/withFloatingElement.d.mts +31 -0
- package/dist/floating/withFloatingElement.mjs +31 -1
- package/dist/floating/withFloatingMeasurement.d.mts +42 -1
- package/dist/floating/withFloatingMeasurement.mjs +43 -3
- package/dist/groups/getDialogs.d.mts +29 -0
- package/dist/groups/getDialogs.mjs +29 -0
- package/dist/groups/getGroupsForModal.d.mts +29 -0
- package/dist/groups/getGroupsForModal.mjs +29 -0
- package/dist/groups/getModalsForGroup.d.mts +29 -0
- package/dist/groups/getModalsForGroup.mjs +29 -0
- package/dist/groups/getPopovers.d.mts +29 -0
- package/dist/groups/getPopovers.mjs +29 -0
- package/dist/groups/getTooltips.d.mts +29 -0
- package/dist/groups/getTooltips.mjs +29 -0
- package/dist/groups/isDialog.d.mts +29 -0
- package/dist/groups/isDialog.mjs +29 -0
- package/dist/groups/isModalInGroup.d.mts +29 -0
- package/dist/groups/isModalInGroup.mjs +29 -0
- package/dist/groups/isPopover.d.mts +29 -0
- package/dist/groups/isPopover.mjs +29 -0
- package/dist/groups/isTooltip.d.mts +29 -0
- package/dist/groups/isTooltip.mjs +29 -0
- package/dist/groups/modalGroups.mjs +42 -0
- package/dist/groups/withModalGroups.d.mts +30 -0
- package/dist/groups/withModalGroups.mjs +30 -1
- package/dist/position/getModalPlacement.d.mts +50 -0
- package/dist/position/getModalPlacement.mjs +49 -0
- package/dist/position/getModalPosition.d.mts +59 -0
- package/dist/position/getModalPosition.mjs +58 -0
- package/dist/position/withBoundary.d.mts +32 -1
- package/dist/position/withBoundary.mjs +33 -3
- package/dist/position/withPlacement.d.mts +78 -1
- package/dist/position/withPlacement.mjs +78 -1
- package/dist/position/withPosition.d.mts +67 -1
- package/dist/position/withPosition.mjs +68 -2
- package/dist/scroll/withCloseOnScroll.d.mts +37 -0
- package/dist/scroll/withCloseOnScroll.mjs +37 -1
- package/dist/status/closeAllModals.d.mts +33 -0
- package/dist/status/closeAllModals.mjs +33 -0
- package/dist/status/closeLastModal.d.mts +18 -0
- package/dist/status/closeLastModal.mjs +18 -0
- package/dist/status/closeModal.d.mts +28 -0
- package/dist/status/closeModal.mjs +28 -0
- package/dist/status/getClosedModals.d.mts +32 -0
- package/dist/status/getClosedModals.mjs +32 -0
- package/dist/status/getClosingModals.d.mts +36 -0
- package/dist/status/getClosingModals.mjs +36 -0
- package/dist/status/getModalStatus.d.mts +31 -0
- package/dist/status/getModalStatus.mjs +30 -0
- package/dist/status/getOpenModals.d.mts +36 -0
- package/dist/status/getOpenModals.mjs +36 -0
- package/dist/status/getOpenedModals.d.mts +32 -0
- package/dist/status/getOpenedModals.mjs +32 -0
- package/dist/status/getOpeningModals.d.mts +36 -0
- package/dist/status/getOpeningModals.mjs +36 -0
- package/dist/status/getVisibleModals.d.mts +36 -0
- package/dist/status/getVisibleModals.mjs +36 -0
- package/dist/status/internals.mjs +15 -6
- package/dist/status/isAnyModalClosed.d.mts +32 -0
- package/dist/status/isAnyModalClosed.mjs +32 -0
- package/dist/status/isAnyModalClosing.d.mts +35 -0
- package/dist/status/isAnyModalClosing.mjs +35 -0
- package/dist/status/isAnyModalOpen.d.mts +32 -0
- package/dist/status/isAnyModalOpen.mjs +32 -0
- package/dist/status/isAnyModalOpened.d.mts +32 -0
- package/dist/status/isAnyModalOpened.mjs +32 -0
- package/dist/status/isAnyModalOpening.d.mts +35 -0
- package/dist/status/isAnyModalOpening.mjs +35 -0
- package/dist/status/isAnyModalVisible.d.mts +32 -0
- package/dist/status/isAnyModalVisible.mjs +32 -0
- package/dist/status/isModalClosed.d.mts +28 -0
- package/dist/status/isModalClosed.mjs +28 -0
- package/dist/status/isModalClosing.d.mts +32 -0
- package/dist/status/isModalClosing.mjs +32 -0
- package/dist/status/isModalOpen.d.mts +28 -0
- package/dist/status/isModalOpen.mjs +28 -0
- package/dist/status/isModalOpened.d.mts +30 -0
- package/dist/status/isModalOpened.mjs +30 -0
- package/dist/status/isModalOpening.d.mts +30 -0
- package/dist/status/isModalOpening.mjs +30 -0
- package/dist/status/isModalVisible.d.mts +30 -0
- package/dist/status/isModalVisible.mjs +30 -0
- package/dist/status/onModalClosed.d.mts +31 -0
- package/dist/status/onModalClosed.mjs +31 -1
- package/dist/status/onModalClosing.d.mts +33 -2
- package/dist/status/onModalClosing.mjs +31 -1
- package/dist/status/onModalOpened.d.mts +31 -0
- package/dist/status/onModalOpened.mjs +31 -1
- package/dist/status/onModalOpening.d.mts +33 -2
- package/dist/status/onModalOpening.mjs +31 -1
- package/dist/status/openModal.d.mts +26 -0
- package/dist/status/openModal.mjs +26 -0
- package/dist/status/setModalStatus.d.mts +29 -0
- package/dist/status/setModalStatus.mjs +28 -0
- package/dist/status/withModalStatus.d.mts +41 -0
- package/dist/status/withModalStatus.mjs +43 -3
- package/dist/utils/closeLastModalOnClickOutside.d.mts +18 -0
- package/dist/utils/closeLastModalOnClickOutside.mjs +18 -0
- package/dist/utils/closeLastModalOnEsc.d.mts +18 -0
- package/dist/utils/closeLastModalOnEsc.mjs +18 -0
- package/dist/utils/syncModalGroupsToBody.d.mts +37 -0
- package/dist/utils/syncModalGroupsToBody.mjs +38 -1
- package/package.json +6 -5
|
@@ -1,4 +1,39 @@
|
|
|
1
1
|
//#region src/status/isAnyModalClosing.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* # isAnyModalClosing
|
|
4
|
+
*
|
|
5
|
+
* <Badge type="tip">Reactive</Badge>
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* function isAnyModalClosing(): boolean;
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* Returns `true` if any modal has status `"closing"`.
|
|
12
|
+
*
|
|
13
|
+
* ## Example
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* import {
|
|
17
|
+
* createModal,
|
|
18
|
+
* withModalStatus,
|
|
19
|
+
* closeModal,
|
|
20
|
+
* isAnyModalClosing,
|
|
21
|
+
* } from "@monstermann/signals-modal";
|
|
22
|
+
*
|
|
23
|
+
* createModal("modal1", () => {
|
|
24
|
+
* withModalStatus("opened");
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* createModal("modal2", () => {
|
|
28
|
+
* withModalStatus();
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* closeModal("modal1");
|
|
32
|
+
*
|
|
33
|
+
* isAnyModalClosing(); // true
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
2
37
|
declare function isAnyModalClosing(): boolean;
|
|
3
38
|
//#endregion
|
|
4
39
|
export { isAnyModalClosing };
|
|
@@ -1,6 +1,41 @@
|
|
|
1
1
|
import { getClosingModals } from "./getClosingModals.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/status/isAnyModalClosing.ts
|
|
4
|
+
/**
|
|
5
|
+
* # isAnyModalClosing
|
|
6
|
+
*
|
|
7
|
+
* <Badge type="tip">Reactive</Badge>
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* function isAnyModalClosing(): boolean;
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* Returns `true` if any modal has status `"closing"`.
|
|
14
|
+
*
|
|
15
|
+
* ## Example
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* import {
|
|
19
|
+
* createModal,
|
|
20
|
+
* withModalStatus,
|
|
21
|
+
* closeModal,
|
|
22
|
+
* isAnyModalClosing,
|
|
23
|
+
* } from "@monstermann/signals-modal";
|
|
24
|
+
*
|
|
25
|
+
* createModal("modal1", () => {
|
|
26
|
+
* withModalStatus("opened");
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* createModal("modal2", () => {
|
|
30
|
+
* withModalStatus();
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* closeModal("modal1");
|
|
34
|
+
*
|
|
35
|
+
* isAnyModalClosing(); // true
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
4
39
|
function isAnyModalClosing() {
|
|
5
40
|
return getClosingModals().length > 0;
|
|
6
41
|
}
|
|
@@ -1,4 +1,36 @@
|
|
|
1
1
|
//#region src/status/isAnyModalOpen.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* # isAnyModalOpen
|
|
4
|
+
*
|
|
5
|
+
* <Badge type="tip">Reactive</Badge>
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* function isAnyModalOpen(): boolean;
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* Returns `true` if any modal has status `"opening"` or `"opened"`.
|
|
12
|
+
*
|
|
13
|
+
* ## Example
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* import {
|
|
17
|
+
* createModal,
|
|
18
|
+
* withModalStatus,
|
|
19
|
+
* isAnyModalOpen,
|
|
20
|
+
* } from "@monstermann/signals-modal";
|
|
21
|
+
*
|
|
22
|
+
* createModal("modal1", () => {
|
|
23
|
+
* withModalStatus();
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* createModal("modal2", () => {
|
|
27
|
+
* withModalStatus("opened");
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* isAnyModalOpen(); // true
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
2
34
|
declare function isAnyModalOpen(): boolean;
|
|
3
35
|
//#endregion
|
|
4
36
|
export { isAnyModalOpen };
|
|
@@ -1,6 +1,38 @@
|
|
|
1
1
|
import { getOpenModals } from "./getOpenModals.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/status/isAnyModalOpen.ts
|
|
4
|
+
/**
|
|
5
|
+
* # isAnyModalOpen
|
|
6
|
+
*
|
|
7
|
+
* <Badge type="tip">Reactive</Badge>
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* function isAnyModalOpen(): boolean;
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* Returns `true` if any modal has status `"opening"` or `"opened"`.
|
|
14
|
+
*
|
|
15
|
+
* ## Example
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* import {
|
|
19
|
+
* createModal,
|
|
20
|
+
* withModalStatus,
|
|
21
|
+
* isAnyModalOpen,
|
|
22
|
+
* } from "@monstermann/signals-modal";
|
|
23
|
+
*
|
|
24
|
+
* createModal("modal1", () => {
|
|
25
|
+
* withModalStatus();
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* createModal("modal2", () => {
|
|
29
|
+
* withModalStatus("opened");
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* isAnyModalOpen(); // true
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
4
36
|
function isAnyModalOpen() {
|
|
5
37
|
return getOpenModals().length > 0;
|
|
6
38
|
}
|
|
@@ -1,4 +1,36 @@
|
|
|
1
1
|
//#region src/status/isAnyModalOpened.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* # isAnyModalOpened
|
|
4
|
+
*
|
|
5
|
+
* <Badge type="tip">Reactive</Badge>
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* function isAnyModalOpened(): boolean;
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* Returns `true` if any modal has status `"opened"`.
|
|
12
|
+
*
|
|
13
|
+
* ## Example
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* import {
|
|
17
|
+
* createModal,
|
|
18
|
+
* withModalStatus,
|
|
19
|
+
* isAnyModalOpened,
|
|
20
|
+
* } from "@monstermann/signals-modal";
|
|
21
|
+
*
|
|
22
|
+
* createModal("modal1", () => {
|
|
23
|
+
* withModalStatus();
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* createModal("modal2", () => {
|
|
27
|
+
* withModalStatus("opened");
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* isAnyModalOpened(); // true
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
2
34
|
declare function isAnyModalOpened(): boolean;
|
|
3
35
|
//#endregion
|
|
4
36
|
export { isAnyModalOpened };
|
|
@@ -1,6 +1,38 @@
|
|
|
1
1
|
import { getOpenedModals } from "./getOpenedModals.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/status/isAnyModalOpened.ts
|
|
4
|
+
/**
|
|
5
|
+
* # isAnyModalOpened
|
|
6
|
+
*
|
|
7
|
+
* <Badge type="tip">Reactive</Badge>
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* function isAnyModalOpened(): boolean;
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* Returns `true` if any modal has status `"opened"`.
|
|
14
|
+
*
|
|
15
|
+
* ## Example
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* import {
|
|
19
|
+
* createModal,
|
|
20
|
+
* withModalStatus,
|
|
21
|
+
* isAnyModalOpened,
|
|
22
|
+
* } from "@monstermann/signals-modal";
|
|
23
|
+
*
|
|
24
|
+
* createModal("modal1", () => {
|
|
25
|
+
* withModalStatus();
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* createModal("modal2", () => {
|
|
29
|
+
* withModalStatus("opened");
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* isAnyModalOpened(); // true
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
4
36
|
function isAnyModalOpened() {
|
|
5
37
|
return getOpenedModals().length > 0;
|
|
6
38
|
}
|
|
@@ -1,4 +1,39 @@
|
|
|
1
1
|
//#region src/status/isAnyModalOpening.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* # isAnyModalOpening
|
|
4
|
+
*
|
|
5
|
+
* <Badge type="tip">Reactive</Badge>
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* function isAnyModalOpening(): boolean;
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* Returns `true` if any modal has status `"opening"`.
|
|
12
|
+
*
|
|
13
|
+
* ## Example
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* import {
|
|
17
|
+
* createModal,
|
|
18
|
+
* withModalStatus,
|
|
19
|
+
* openModal,
|
|
20
|
+
* isAnyModalOpening,
|
|
21
|
+
* } from "@monstermann/signals-modal";
|
|
22
|
+
*
|
|
23
|
+
* createModal("modal1", () => {
|
|
24
|
+
* withModalStatus();
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* createModal("modal2", () => {
|
|
28
|
+
* withModalStatus();
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* openModal("modal1");
|
|
32
|
+
*
|
|
33
|
+
* isAnyModalOpening(); // true
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
2
37
|
declare function isAnyModalOpening(): boolean;
|
|
3
38
|
//#endregion
|
|
4
39
|
export { isAnyModalOpening };
|
|
@@ -1,6 +1,41 @@
|
|
|
1
1
|
import { getOpeningModals } from "./getOpeningModals.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/status/isAnyModalOpening.ts
|
|
4
|
+
/**
|
|
5
|
+
* # isAnyModalOpening
|
|
6
|
+
*
|
|
7
|
+
* <Badge type="tip">Reactive</Badge>
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* function isAnyModalOpening(): boolean;
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* Returns `true` if any modal has status `"opening"`.
|
|
14
|
+
*
|
|
15
|
+
* ## Example
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* import {
|
|
19
|
+
* createModal,
|
|
20
|
+
* withModalStatus,
|
|
21
|
+
* openModal,
|
|
22
|
+
* isAnyModalOpening,
|
|
23
|
+
* } from "@monstermann/signals-modal";
|
|
24
|
+
*
|
|
25
|
+
* createModal("modal1", () => {
|
|
26
|
+
* withModalStatus();
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* createModal("modal2", () => {
|
|
30
|
+
* withModalStatus();
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* openModal("modal1");
|
|
34
|
+
*
|
|
35
|
+
* isAnyModalOpening(); // true
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
4
39
|
function isAnyModalOpening() {
|
|
5
40
|
return getOpeningModals().length > 0;
|
|
6
41
|
}
|
|
@@ -1,4 +1,36 @@
|
|
|
1
1
|
//#region src/status/isAnyModalVisible.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* # isAnyModalVisible
|
|
4
|
+
*
|
|
5
|
+
* <Badge type="tip">Reactive</Badge>
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* function isAnyModalVisible(): boolean;
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* Returns `true` if any modal is visible (not `"closed"`). This includes `"opening"`, `"opened"`, and `"closing"` statuses.
|
|
12
|
+
*
|
|
13
|
+
* ## Example
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* import {
|
|
17
|
+
* createModal,
|
|
18
|
+
* withModalStatus,
|
|
19
|
+
* isAnyModalVisible,
|
|
20
|
+
* } from "@monstermann/signals-modal";
|
|
21
|
+
*
|
|
22
|
+
* createModal("modal1", () => {
|
|
23
|
+
* withModalStatus();
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* createModal("modal2", () => {
|
|
27
|
+
* withModalStatus("opened");
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* isAnyModalVisible(); // true
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
2
34
|
declare function isAnyModalVisible(): boolean;
|
|
3
35
|
//#endregion
|
|
4
36
|
export { isAnyModalVisible };
|
|
@@ -1,6 +1,38 @@
|
|
|
1
1
|
import { getVisibleModals } from "./getVisibleModals.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/status/isAnyModalVisible.ts
|
|
4
|
+
/**
|
|
5
|
+
* # isAnyModalVisible
|
|
6
|
+
*
|
|
7
|
+
* <Badge type="tip">Reactive</Badge>
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* function isAnyModalVisible(): boolean;
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* Returns `true` if any modal is visible (not `"closed"`). This includes `"opening"`, `"opened"`, and `"closing"` statuses.
|
|
14
|
+
*
|
|
15
|
+
* ## Example
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* import {
|
|
19
|
+
* createModal,
|
|
20
|
+
* withModalStatus,
|
|
21
|
+
* isAnyModalVisible,
|
|
22
|
+
* } from "@monstermann/signals-modal";
|
|
23
|
+
*
|
|
24
|
+
* createModal("modal1", () => {
|
|
25
|
+
* withModalStatus();
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* createModal("modal2", () => {
|
|
29
|
+
* withModalStatus("opened");
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* isAnyModalVisible(); // true
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
4
36
|
function isAnyModalVisible() {
|
|
5
37
|
return getVisibleModals().length > 0;
|
|
6
38
|
}
|
|
@@ -1,4 +1,32 @@
|
|
|
1
1
|
//#region src/status/isModalClosed.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* # isModalClosed
|
|
4
|
+
*
|
|
5
|
+
* <Badge type="tip">Reactive</Badge>
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* function isModalClosed(key: string): boolean;
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* Returns `true` if the modal's status is `"closed"` or if the modal doesn't exist.
|
|
12
|
+
*
|
|
13
|
+
* ## Example
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* import {
|
|
17
|
+
* createModal,
|
|
18
|
+
* withModalStatus,
|
|
19
|
+
* isModalClosed,
|
|
20
|
+
* } from "@monstermann/signals-modal";
|
|
21
|
+
*
|
|
22
|
+
* createModal("key", () => {
|
|
23
|
+
* withModalStatus();
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* isModalClosed("key"); // true
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
2
30
|
declare function isModalClosed(key: string): boolean;
|
|
3
31
|
//#endregion
|
|
4
32
|
export { isModalClosed };
|
|
@@ -1,6 +1,34 @@
|
|
|
1
1
|
import { $keysToStatus } from "./internals.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/status/isModalClosed.ts
|
|
4
|
+
/**
|
|
5
|
+
* # isModalClosed
|
|
6
|
+
*
|
|
7
|
+
* <Badge type="tip">Reactive</Badge>
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* function isModalClosed(key: string): boolean;
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* Returns `true` if the modal's status is `"closed"` or if the modal doesn't exist.
|
|
14
|
+
*
|
|
15
|
+
* ## Example
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* import {
|
|
19
|
+
* createModal,
|
|
20
|
+
* withModalStatus,
|
|
21
|
+
* isModalClosed,
|
|
22
|
+
* } from "@monstermann/signals-modal";
|
|
23
|
+
*
|
|
24
|
+
* createModal("key", () => {
|
|
25
|
+
* withModalStatus();
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* isModalClosed("key"); // true
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
4
32
|
function isModalClosed(key) {
|
|
5
33
|
const $status = $keysToStatus().get(key);
|
|
6
34
|
return $status === void 0 || $status() === "closed";
|
|
@@ -1,4 +1,36 @@
|
|
|
1
1
|
//#region src/status/isModalClosing.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* # isModalClosing
|
|
4
|
+
*
|
|
5
|
+
* <Badge type="tip">Reactive</Badge>
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* function isModalClosing(key: string): boolean;
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* Returns `true` if the modal's status is `"closing"`.
|
|
12
|
+
*
|
|
13
|
+
* ## Example
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* import {
|
|
17
|
+
* createModal,
|
|
18
|
+
* withModalStatus,
|
|
19
|
+
* openModal,
|
|
20
|
+
* closeModal,
|
|
21
|
+
* isModalClosing,
|
|
22
|
+
* } from "@monstermann/signals-modal";
|
|
23
|
+
*
|
|
24
|
+
* createModal("key", () => {
|
|
25
|
+
* const { $status } = withModalStatus();
|
|
26
|
+
* $status("opened");
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* closeModal("key");
|
|
30
|
+
* isModalClosing("key"); // true
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
2
34
|
declare function isModalClosing(key: string): boolean;
|
|
3
35
|
//#endregion
|
|
4
36
|
export { isModalClosing };
|
|
@@ -1,6 +1,38 @@
|
|
|
1
1
|
import { $keysToStatus } from "./internals.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/status/isModalClosing.ts
|
|
4
|
+
/**
|
|
5
|
+
* # isModalClosing
|
|
6
|
+
*
|
|
7
|
+
* <Badge type="tip">Reactive</Badge>
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* function isModalClosing(key: string): boolean;
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* Returns `true` if the modal's status is `"closing"`.
|
|
14
|
+
*
|
|
15
|
+
* ## Example
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* import {
|
|
19
|
+
* createModal,
|
|
20
|
+
* withModalStatus,
|
|
21
|
+
* openModal,
|
|
22
|
+
* closeModal,
|
|
23
|
+
* isModalClosing,
|
|
24
|
+
* } from "@monstermann/signals-modal";
|
|
25
|
+
*
|
|
26
|
+
* createModal("key", () => {
|
|
27
|
+
* const { $status } = withModalStatus();
|
|
28
|
+
* $status("opened");
|
|
29
|
+
* });
|
|
30
|
+
*
|
|
31
|
+
* closeModal("key");
|
|
32
|
+
* isModalClosing("key"); // true
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
4
36
|
function isModalClosing(key) {
|
|
5
37
|
return $keysToStatus().get(key)?.() === "closing";
|
|
6
38
|
}
|
|
@@ -1,4 +1,32 @@
|
|
|
1
1
|
//#region src/status/isModalOpen.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* # isModalOpen
|
|
4
|
+
*
|
|
5
|
+
* <Badge type="tip">Reactive</Badge>
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* function isModalOpen(key: string): boolean;
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* Returns `true` if the modal's status is `"opening"` or `"opened"`.
|
|
12
|
+
*
|
|
13
|
+
* ## Example
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* import {
|
|
17
|
+
* createModal,
|
|
18
|
+
* withModalStatus,
|
|
19
|
+
* isModalOpen,
|
|
20
|
+
* } from "@monstermann/signals-modal";
|
|
21
|
+
*
|
|
22
|
+
* createModal("key", () => {
|
|
23
|
+
* const { $status } = withModalStatus("opening");
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* isModalOpen("key"); // true
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
2
30
|
declare function isModalOpen(key: string): boolean;
|
|
3
31
|
//#endregion
|
|
4
32
|
export { isModalOpen };
|
|
@@ -2,6 +2,34 @@ import { isModalOpened } from "./isModalOpened.mjs";
|
|
|
2
2
|
import { isModalOpening } from "./isModalOpening.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/status/isModalOpen.ts
|
|
5
|
+
/**
|
|
6
|
+
* # isModalOpen
|
|
7
|
+
*
|
|
8
|
+
* <Badge type="tip">Reactive</Badge>
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* function isModalOpen(key: string): boolean;
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* Returns `true` if the modal's status is `"opening"` or `"opened"`.
|
|
15
|
+
*
|
|
16
|
+
* ## Example
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* import {
|
|
20
|
+
* createModal,
|
|
21
|
+
* withModalStatus,
|
|
22
|
+
* isModalOpen,
|
|
23
|
+
* } from "@monstermann/signals-modal";
|
|
24
|
+
*
|
|
25
|
+
* createModal("key", () => {
|
|
26
|
+
* const { $status } = withModalStatus("opening");
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* isModalOpen("key"); // true
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
5
33
|
function isModalOpen(key) {
|
|
6
34
|
return isModalOpening(key) || isModalOpened(key);
|
|
7
35
|
}
|
|
@@ -1,4 +1,34 @@
|
|
|
1
1
|
//#region src/status/isModalOpened.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* # isModalOpened
|
|
4
|
+
*
|
|
5
|
+
* <Badge type="tip">Reactive</Badge>
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* function isModalOpened(key: string): boolean;
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* Returns `true` if the modal's status is `"opened"`.
|
|
12
|
+
*
|
|
13
|
+
* ## Example
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* import {
|
|
17
|
+
* createModal,
|
|
18
|
+
* withModalStatus,
|
|
19
|
+
* openModal,
|
|
20
|
+
* isModalOpened,
|
|
21
|
+
* } from "@monstermann/signals-modal";
|
|
22
|
+
*
|
|
23
|
+
* createModal("key", () => {
|
|
24
|
+
* const { $status } = withModalStatus();
|
|
25
|
+
* $status("opened");
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* isModalOpened("key"); // true
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
2
32
|
declare function isModalOpened(key: string): boolean;
|
|
3
33
|
//#endregion
|
|
4
34
|
export { isModalOpened };
|
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
import { $keysToStatus } from "./internals.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/status/isModalOpened.ts
|
|
4
|
+
/**
|
|
5
|
+
* # isModalOpened
|
|
6
|
+
*
|
|
7
|
+
* <Badge type="tip">Reactive</Badge>
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* function isModalOpened(key: string): boolean;
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* Returns `true` if the modal's status is `"opened"`.
|
|
14
|
+
*
|
|
15
|
+
* ## Example
|
|
16
|
+
*
|
|
17
|
+
* ```ts
|
|
18
|
+
* import {
|
|
19
|
+
* createModal,
|
|
20
|
+
* withModalStatus,
|
|
21
|
+
* openModal,
|
|
22
|
+
* isModalOpened,
|
|
23
|
+
* } from "@monstermann/signals-modal";
|
|
24
|
+
*
|
|
25
|
+
* createModal("key", () => {
|
|
26
|
+
* const { $status } = withModalStatus();
|
|
27
|
+
* $status("opened");
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* isModalOpened("key"); // true
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
4
34
|
function isModalOpened(key) {
|
|
5
35
|
return $keysToStatus().get(key)?.() === "opened";
|
|
6
36
|
}
|