@zag-js/toast 2.0.0-next.2 → 2.0.0-next.4
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/index.d.mts +10 -17
- package/dist/index.d.ts +10 -17
- package/dist/index.js +18 -45
- package/dist/index.mjs +5 -11
- package/dist/toast-group.connect.d.mts +4 -8
- package/dist/toast-group.connect.d.ts +4 -8
- package/dist/toast-group.connect.js +82 -103
- package/dist/toast-group.connect.mjs +77 -67
- package/dist/toast-group.machine.d.mts +2 -8
- package/dist/toast-group.machine.d.ts +2 -8
- package/dist/toast-group.machine.js +295 -290
- package/dist/toast-group.machine.mjs +290 -254
- package/dist/toast.anatomy.d.mts +2 -6
- package/dist/toast.anatomy.d.ts +2 -6
- package/dist/toast.anatomy.js +8 -40
- package/dist/toast.anatomy.mjs +4 -14
- package/dist/toast.connect.d.mts +4 -8
- package/dist/toast.connect.d.ts +4 -8
- package/dist/toast.connect.js +176 -160
- package/dist/toast.connect.mjs +171 -124
- package/dist/toast.dom.d.mts +21 -14
- package/dist/toast.dom.d.ts +21 -14
- package/dist/toast.dom.js +50 -48
- package/dist/toast.dom.mjs +35 -17
- package/dist/toast.machine.d.mts +2 -8
- package/dist/toast.machine.d.ts +2 -8
- package/dist/toast.machine.js +404 -288
- package/dist/toast.machine.mjs +400 -253
- package/dist/toast.store.d.mts +2 -8
- package/dist/toast.store.d.ts +2 -8
- package/dist/toast.store.js +345 -263
- package/dist/toast.store.mjs +341 -238
- package/dist/toast.types.d.mts +460 -427
- package/dist/toast.types.d.ts +460 -427
- package/dist/toast.types.js +4 -18
- package/dist/toast.types.mjs +1 -0
- package/dist/toast.utils.d.mts +10 -13
- package/dist/toast.utils.d.ts +10 -13
- package/dist/toast.utils.js +185 -198
- package/dist/toast.utils.mjs +175 -168
- package/dist/utils/swipe.d.mts +16 -0
- package/dist/utils/swipe.d.ts +16 -0
- package/dist/utils/swipe.js +100 -0
- package/dist/utils/swipe.mjs +93 -0
- package/package.json +8 -8
package/dist/toast.types.js
CHANGED
|
@@ -1,18 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
|
|
16
|
-
// src/toast.types.ts
|
|
17
|
-
var toast_types_exports = {};
|
|
18
|
-
module.exports = __toCommonJS(toast_types_exports);
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
package/dist/toast.types.mjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/toast.utils.d.mts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
declare
|
|
7
|
-
declare function
|
|
8
|
-
declare function
|
|
9
|
-
declare function
|
|
10
|
-
declare function
|
|
11
|
-
declare function getGhostAfterStyle(): Style;
|
|
12
|
-
|
|
13
|
-
export { defaultTimeouts, getGhostAfterStyle, getGhostBeforeStyle, getGroupPlacementStyle, getPlacementStyle, getToastDuration };
|
|
1
|
+
import { Placement, ToastGroupSchema, ToastGroupService, ToastHeight, ToastSchema, Type } from "./toast.types.mjs";
|
|
2
|
+
import { Service } from "@zag-js/core";
|
|
3
|
+
import { Style } from "@zag-js/types";
|
|
4
|
+
export declare const defaultTimeouts: Record<Type, number>;
|
|
5
|
+
export declare function getToastDuration(duration: number | undefined, type: Type): number;
|
|
6
|
+
export declare function getGroupPlacementStyle(service: ToastGroupService, placement: Placement): Style;
|
|
7
|
+
export declare function getPlacementStyle(service: Service<ToastSchema>, visible: boolean): Style;
|
|
8
|
+
export declare function getGhostBeforeStyle(service: Service<ToastSchema>, visible: boolean): Style;
|
|
9
|
+
export declare function getGhostAfterStyle(): Style;
|
|
10
|
+
export declare function setHeight(parent: Service<ToastGroupSchema>, item: ToastHeight): void;
|
package/dist/toast.utils.d.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Style } from
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
declare
|
|
7
|
-
declare function
|
|
8
|
-
declare function
|
|
9
|
-
declare function
|
|
10
|
-
declare function
|
|
11
|
-
declare function getGhostAfterStyle(): Style;
|
|
12
|
-
|
|
13
|
-
export { defaultTimeouts, getGhostAfterStyle, getGhostBeforeStyle, getGroupPlacementStyle, getPlacementStyle, getToastDuration };
|
|
1
|
+
import { Placement, ToastGroupSchema, ToastGroupService, ToastHeight, ToastSchema, Type } from "./toast.types.js";
|
|
2
|
+
import { Style } from "@zag-js/types";
|
|
3
|
+
import { Service } from "@zag-js/core";
|
|
4
|
+
export declare const defaultTimeouts: Record<Type, number>;
|
|
5
|
+
export declare function getToastDuration(duration: number | undefined, type: Type): number;
|
|
6
|
+
export declare function getGroupPlacementStyle(service: ToastGroupService, placement: Placement): Style;
|
|
7
|
+
export declare function getPlacementStyle(service: Service<ToastSchema>, visible: boolean): Style;
|
|
8
|
+
export declare function getGhostBeforeStyle(service: Service<ToastSchema>, visible: boolean): Style;
|
|
9
|
+
export declare function getGhostAfterStyle(): Style;
|
|
10
|
+
export declare function setHeight(parent: Service<ToastGroupSchema>, item: ToastHeight): void;
|
package/dist/toast.utils.js
CHANGED
|
@@ -1,210 +1,197 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/toast.utils.ts
|
|
21
|
-
var toast_utils_exports = {};
|
|
22
|
-
__export(toast_utils_exports, {
|
|
23
|
-
defaultTimeouts: () => defaultTimeouts,
|
|
24
|
-
getGhostAfterStyle: () => getGhostAfterStyle,
|
|
25
|
-
getGhostBeforeStyle: () => getGhostBeforeStyle,
|
|
26
|
-
getGroupPlacementStyle: () => getGroupPlacementStyle,
|
|
27
|
-
getPlacementStyle: () => getPlacementStyle,
|
|
28
|
-
getToastDuration: () => getToastDuration
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
29
4
|
});
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
5
|
+
let _zag_js_utils = require("@zag-js/utils");
|
|
6
|
+
// src/toast.utils.ts
|
|
7
|
+
const defaultTimeouts = {
|
|
8
|
+
info: 5e3,
|
|
9
|
+
error: 5e3,
|
|
10
|
+
success: 2e3,
|
|
11
|
+
loading: 1e400,
|
|
12
|
+
warning: 5e3,
|
|
13
|
+
DEFAULT: 5e3
|
|
39
14
|
};
|
|
40
15
|
function getToastDuration(duration, type) {
|
|
41
|
-
|
|
16
|
+
return duration ?? defaultTimeouts[type] ?? defaultTimeouts.DEFAULT;
|
|
42
17
|
}
|
|
43
|
-
|
|
18
|
+
const getOffsets = (offsets) => typeof offsets === "string" ? {
|
|
19
|
+
left: offsets,
|
|
20
|
+
right: offsets,
|
|
21
|
+
bottom: offsets,
|
|
22
|
+
top: offsets
|
|
23
|
+
} : offsets;
|
|
44
24
|
function getGroupPlacementStyle(service, placement) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
if (computedPlacement.includes("bottom")) {
|
|
75
|
-
const offset = computedOffset.bottom;
|
|
76
|
-
styles.bottom = `max(env(safe-area-inset-bottom, 0px), ${offset})`;
|
|
77
|
-
}
|
|
78
|
-
if (!computedPlacement.includes("left")) {
|
|
79
|
-
const offset = computedOffset.right;
|
|
80
|
-
styles.insetInlineEnd = `calc(env(safe-area-inset-right, 0px) + ${offset})`;
|
|
81
|
-
}
|
|
82
|
-
if (!computedPlacement.includes("right")) {
|
|
83
|
-
const offset = computedOffset.left;
|
|
84
|
-
styles.insetInlineStart = `calc(env(safe-area-inset-left, 0px) + ${offset})`;
|
|
85
|
-
}
|
|
86
|
-
return styles;
|
|
25
|
+
const { prop, computed, context } = service;
|
|
26
|
+
const { offsets, gap } = prop("store").attrs;
|
|
27
|
+
const heights = context.get("heights");
|
|
28
|
+
const computedOffset = getOffsets(offsets);
|
|
29
|
+
const rtl = prop("dir") === "rtl";
|
|
30
|
+
const computedPlacement = placement.replace("-start", rtl ? "-right" : "-left").replace("-end", rtl ? "-left" : "-right");
|
|
31
|
+
const isRighty = computedPlacement.includes("right");
|
|
32
|
+
const isLefty = computedPlacement.includes("left");
|
|
33
|
+
const styles = {
|
|
34
|
+
position: "fixed",
|
|
35
|
+
pointerEvents: computed("count") > 0 ? void 0 : "none",
|
|
36
|
+
display: "flex",
|
|
37
|
+
flexDirection: "column",
|
|
38
|
+
"--gap": (0, _zag_js_utils.toPx)(gap),
|
|
39
|
+
"--first-height": (0, _zag_js_utils.toPx)(heights[0]?.height || 0),
|
|
40
|
+
"--viewport-offset-left": computedOffset.left,
|
|
41
|
+
"--viewport-offset-right": computedOffset.right,
|
|
42
|
+
"--viewport-offset-top": computedOffset.top,
|
|
43
|
+
"--viewport-offset-bottom": computedOffset.bottom
|
|
44
|
+
};
|
|
45
|
+
let alignItems = "center";
|
|
46
|
+
if (isRighty) alignItems = "flex-end";
|
|
47
|
+
if (isLefty) alignItems = "flex-start";
|
|
48
|
+
styles.alignItems = alignItems;
|
|
49
|
+
if (computedPlacement.includes("top")) styles.top = `max(env(safe-area-inset-top, 0px), ${computedOffset.top})`;
|
|
50
|
+
if (computedPlacement.includes("bottom")) styles.bottom = `max(env(safe-area-inset-bottom, 0px), ${computedOffset.bottom})`;
|
|
51
|
+
if (!computedPlacement.includes("left")) styles.insetInlineEnd = `calc(env(safe-area-inset-right, 0px) + ${computedOffset.right})`;
|
|
52
|
+
if (!computedPlacement.includes("right")) styles.insetInlineStart = `calc(env(safe-area-inset-left, 0px) + ${computedOffset.left})`;
|
|
53
|
+
return styles;
|
|
87
54
|
}
|
|
88
55
|
function getPlacementStyle(service, visible) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
"--y": "calc(var(--lift) * var(--offset) + var(--lift) * -100%)"
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
if (frontmost && !visible) {
|
|
171
|
-
assign({
|
|
172
|
-
"--y": "calc(var(--lift) * -100%)"
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
return styles;
|
|
56
|
+
const { prop, context, computed } = service;
|
|
57
|
+
const parent = prop("parent");
|
|
58
|
+
const placement = parent.computed("placement");
|
|
59
|
+
const { gap } = parent.prop("store").attrs;
|
|
60
|
+
const [side] = placement.split("-");
|
|
61
|
+
const mounted = context.get("mounted");
|
|
62
|
+
const height = computed("height");
|
|
63
|
+
const frontmost = computed("frontmost");
|
|
64
|
+
const sibling = !frontmost;
|
|
65
|
+
const stacked = prop("parent").state.matches("stack");
|
|
66
|
+
const overlap = !stacked;
|
|
67
|
+
const type = prop("type");
|
|
68
|
+
const totalDuration = getToastDuration(prop("duration"), type);
|
|
69
|
+
const duration = type === "loading" || !Number.isFinite(totalDuration) ? Number.MAX_SAFE_INTEGER : totalDuration;
|
|
70
|
+
const offset = computed("heightIndex") * gap + computed("heightBefore");
|
|
71
|
+
const swipeOffset = context.get("swipeOffset");
|
|
72
|
+
const swipedOut = !visible ? context.get("swipeDirection") : null;
|
|
73
|
+
const exiting = !visible && !swipedOut;
|
|
74
|
+
const styles = {
|
|
75
|
+
position: "absolute",
|
|
76
|
+
pointerEvents: "auto",
|
|
77
|
+
"--opacity": "0",
|
|
78
|
+
"--remove-delay": `${prop("removeDelay")}ms`,
|
|
79
|
+
"--duration": `${duration}ms`,
|
|
80
|
+
"--initial-height": (0, _zag_js_utils.toPx)(height),
|
|
81
|
+
"--offset": (0, _zag_js_utils.toPx)(offset),
|
|
82
|
+
"--index": prop("index"),
|
|
83
|
+
"--z-index": computed("zIndex"),
|
|
84
|
+
"--lift-amount": "calc(var(--lift) * var(--gap))",
|
|
85
|
+
"--y": "100%",
|
|
86
|
+
"--x": "0px",
|
|
87
|
+
"--swipe-x": (0, _zag_js_utils.toPx)(swipeOffset.x),
|
|
88
|
+
"--swipe-y": (0, _zag_js_utils.toPx)(swipeOffset.y)
|
|
89
|
+
};
|
|
90
|
+
const assign = (overrides) => Object.assign(styles, overrides);
|
|
91
|
+
if (side === "top") assign({
|
|
92
|
+
top: "0",
|
|
93
|
+
"--sign": "-1",
|
|
94
|
+
"--y": "-100%",
|
|
95
|
+
"--lift": "1"
|
|
96
|
+
});
|
|
97
|
+
else if (side === "bottom") assign({
|
|
98
|
+
bottom: "0",
|
|
99
|
+
"--sign": "1",
|
|
100
|
+
"--y": "100%",
|
|
101
|
+
"--lift": "-1"
|
|
102
|
+
});
|
|
103
|
+
if (mounted) {
|
|
104
|
+
assign({
|
|
105
|
+
"--y": "0",
|
|
106
|
+
"--opacity": "1"
|
|
107
|
+
});
|
|
108
|
+
if (stacked) assign({
|
|
109
|
+
"--y": "calc(var(--lift) * var(--offset))",
|
|
110
|
+
"--height": "var(--initial-height)"
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
if (!visible) assign({
|
|
114
|
+
"--opacity": "0",
|
|
115
|
+
pointerEvents: "none"
|
|
116
|
+
});
|
|
117
|
+
if (sibling && overlap) {
|
|
118
|
+
assign({
|
|
119
|
+
"--base-scale": "var(--index) * 0.05 + 1",
|
|
120
|
+
"--y": "calc(var(--lift-amount) * var(--index))",
|
|
121
|
+
"--scale": "calc(-1 * var(--base-scale))",
|
|
122
|
+
"--height": "var(--first-height)"
|
|
123
|
+
});
|
|
124
|
+
if (exiting) assign({ "--y": "calc(var(--sign) * 40%)" });
|
|
125
|
+
}
|
|
126
|
+
if (sibling && stacked && exiting) assign({ "--y": "calc(var(--lift) * var(--offset) + var(--lift) * -100%)" });
|
|
127
|
+
if (frontmost && exiting) assign({ "--y": "calc(var(--lift) * -100%)" });
|
|
128
|
+
const [throwX, throwY] = swipedOut ? swipeThrow[swipedOut] : ["0px", "0px"];
|
|
129
|
+
assign({
|
|
130
|
+
"--x": `calc(${styles["--x"]} + var(--swipe-x) + ${throwX})`,
|
|
131
|
+
"--y": `calc(${styles["--y"]} + var(--swipe-y) + ${throwY})`
|
|
132
|
+
});
|
|
133
|
+
return styles;
|
|
176
134
|
}
|
|
135
|
+
const swipeThrow = {
|
|
136
|
+
up: ["0px", "-100%"],
|
|
137
|
+
down: ["0px", "100%"],
|
|
138
|
+
left: ["-100%", "0px"],
|
|
139
|
+
right: ["100%", "0px"]
|
|
140
|
+
};
|
|
177
141
|
function getGhostBeforeStyle(service, visible) {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
height: "calc(var(--initial-height) + 80%)"
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
return styles;
|
|
142
|
+
const { computed } = service;
|
|
143
|
+
const styles = {
|
|
144
|
+
position: "absolute",
|
|
145
|
+
inset: "0",
|
|
146
|
+
scale: "1 2",
|
|
147
|
+
pointerEvents: visible ? "none" : "auto"
|
|
148
|
+
};
|
|
149
|
+
const assign = (overrides) => Object.assign(styles, overrides);
|
|
150
|
+
if (computed("frontmost") && !visible) assign({ height: "calc(var(--initial-height) + 80%)" });
|
|
151
|
+
return styles;
|
|
192
152
|
}
|
|
193
153
|
function getGhostAfterStyle() {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
154
|
+
return {
|
|
155
|
+
position: "absolute",
|
|
156
|
+
left: "0",
|
|
157
|
+
height: "calc(var(--gap) + 2px)",
|
|
158
|
+
bottom: "100%",
|
|
159
|
+
width: "100%"
|
|
160
|
+
};
|
|
201
161
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
162
|
+
function setHeight(parent, item) {
|
|
163
|
+
const { id, height } = item;
|
|
164
|
+
parent.context.set("heights", (prev) => {
|
|
165
|
+
const existing = prev.find((i) => i.id === id);
|
|
166
|
+
if (existing) {
|
|
167
|
+
if (existing.height === height) return prev;
|
|
168
|
+
return prev.map((i) => i.id === id ? {
|
|
169
|
+
...i,
|
|
170
|
+
height
|
|
171
|
+
} : i);
|
|
172
|
+
}
|
|
173
|
+
const toasts = parent.context.get("toasts");
|
|
174
|
+
const rank = (id) => toasts.findIndex((t) => t.id === id);
|
|
175
|
+
const index = rank(id);
|
|
176
|
+
let insertAt = prev.findIndex((i) => {
|
|
177
|
+
const r = rank(i.id);
|
|
178
|
+
return r === -1 || r > index;
|
|
179
|
+
});
|
|
180
|
+
if (insertAt === -1) insertAt = prev.length;
|
|
181
|
+
return [
|
|
182
|
+
...prev.slice(0, insertAt),
|
|
183
|
+
{
|
|
184
|
+
id,
|
|
185
|
+
height
|
|
186
|
+
},
|
|
187
|
+
...prev.slice(insertAt)
|
|
188
|
+
];
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
exports.defaultTimeouts = defaultTimeouts;
|
|
192
|
+
exports.getGhostAfterStyle = getGhostAfterStyle;
|
|
193
|
+
exports.getGhostBeforeStyle = getGhostBeforeStyle;
|
|
194
|
+
exports.getGroupPlacementStyle = getGroupPlacementStyle;
|
|
195
|
+
exports.getPlacementStyle = getPlacementStyle;
|
|
196
|
+
exports.getToastDuration = getToastDuration;
|
|
197
|
+
exports.setHeight = setHeight;
|