@johly/vaul-svelte 1.0.0-next.21 → 1.0.0-next.23
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.
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare const DrawerNested: import("svelte").Component<Omit<import("./types").DrawerRootPropsWithoutHTML, "onRelease" | "nested" | "onClose">, {}, "open" | "activeSnapPoint">;
|
|
1
|
+
declare const DrawerNested: import("svelte").Component<Omit<import("./types.js").DrawerRootPropsWithoutHTML, "onRelease" | "nested" | "onClose">, {}, "open" | "activeSnapPoint">;
|
|
2
2
|
type DrawerNested = ReturnType<typeof DrawerNested>;
|
|
3
3
|
export default DrawerNested;
|
|
@@ -168,46 +168,46 @@
|
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
:global(
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
[data-vaul-drawer][data-vaul-snap-points="false"][data-vaul-drawer-direction="bottom"][data-state="open"]
|
|
172
|
+
) {
|
|
173
173
|
animation-name: slideFromBottom;
|
|
174
174
|
}
|
|
175
175
|
:global(
|
|
176
|
-
|
|
177
|
-
|
|
176
|
+
[data-vaul-drawer][data-vaul-snap-points="false"][data-vaul-drawer-direction="bottom"][data-state="closed"]
|
|
177
|
+
) {
|
|
178
178
|
animation-name: slideToBottom;
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
:global(
|
|
182
|
-
|
|
183
|
-
|
|
182
|
+
[data-vaul-drawer][data-vaul-snap-points="false"][data-vaul-drawer-direction="top"][data-state="open"]
|
|
183
|
+
) {
|
|
184
184
|
animation-name: slideFromTop;
|
|
185
185
|
}
|
|
186
186
|
:global(
|
|
187
|
-
|
|
188
|
-
|
|
187
|
+
[data-vaul-drawer][data-vaul-snap-points="false"][data-vaul-drawer-direction="top"][data-state="closed"]
|
|
188
|
+
) {
|
|
189
189
|
animation-name: slideToTop;
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
:global(
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
[data-vaul-drawer][data-vaul-snap-points="false"][data-vaul-drawer-direction="left"][data-state="open"]
|
|
194
|
+
) {
|
|
195
195
|
animation-name: slideFromLeft;
|
|
196
196
|
}
|
|
197
197
|
:global(
|
|
198
|
-
|
|
199
|
-
|
|
198
|
+
[data-vaul-drawer][data-vaul-snap-points="false"][data-vaul-drawer-direction="left"][data-state="closed"]
|
|
199
|
+
) {
|
|
200
200
|
animation-name: slideToLeft;
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
:global(
|
|
204
|
-
|
|
205
|
-
|
|
204
|
+
[data-vaul-drawer][data-vaul-snap-points="false"][data-vaul-drawer-direction="right"][data-state="open"]
|
|
205
|
+
) {
|
|
206
206
|
animation-name: slideFromRight;
|
|
207
207
|
}
|
|
208
208
|
:global(
|
|
209
|
-
|
|
210
|
-
|
|
209
|
+
[data-vaul-drawer][data-vaul-snap-points="false"][data-vaul-drawer-direction="right"][data-state="closed"]
|
|
210
|
+
) {
|
|
211
211
|
animation-name: slideToRight;
|
|
212
212
|
}
|
|
213
213
|
|
|
@@ -228,26 +228,26 @@
|
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
:global(
|
|
231
|
-
|
|
232
|
-
|
|
231
|
+
[data-vaul-drawer][data-vaul-delayed-snap-points="true"][data-vaul-drawer-direction="top"]
|
|
232
|
+
) {
|
|
233
233
|
transform: translate3d(0, var(--snap-point-height, 0), 0);
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
:global(
|
|
237
|
-
|
|
238
|
-
|
|
237
|
+
[data-vaul-drawer][data-vaul-delayed-snap-points="true"][data-vaul-drawer-direction="bottom"]
|
|
238
|
+
) {
|
|
239
239
|
transform: translate3d(0, var(--snap-point-height, 0), 0);
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
:global(
|
|
243
|
-
|
|
244
|
-
|
|
243
|
+
[data-vaul-drawer][data-vaul-delayed-snap-points="true"][data-vaul-drawer-direction="left"]
|
|
244
|
+
) {
|
|
245
245
|
transform: translate3d(var(--snap-point-height, 0), 0, 0);
|
|
246
246
|
}
|
|
247
247
|
|
|
248
248
|
:global(
|
|
249
|
-
|
|
250
|
-
|
|
249
|
+
[data-vaul-drawer][data-vaul-delayed-snap-points="true"][data-vaul-drawer-direction="right"]
|
|
250
|
+
) {
|
|
251
251
|
transform: translate3d(var(--snap-point-height, 0), 0, 0);
|
|
252
252
|
}
|
|
253
253
|
|
|
@@ -315,10 +315,10 @@
|
|
|
315
315
|
}
|
|
316
316
|
|
|
317
317
|
:global(
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
318
|
+
[data-vaul-overlay][data-vaul-snap-points="true"]:not(
|
|
319
|
+
[data-vaul-snap-points-overlay="true"]
|
|
320
|
+
):not([data-state="closed"])
|
|
321
|
+
) {
|
|
322
322
|
opacity: 0;
|
|
323
323
|
}
|
|
324
324
|
|
|
@@ -73,7 +73,6 @@ export function useDrawerRoot(opts) {
|
|
|
73
73
|
drawerWidth = drawerNode?.getBoundingClientRect().width || 0;
|
|
74
74
|
isDragging = true;
|
|
75
75
|
dragStartTime = new Date();
|
|
76
|
-
drawerNode?.classList.add(DRAG_CLASS);
|
|
77
76
|
// iOS doesn't trigger mouseUp after scrolling so we need to listen to touched in order to disallow dragging
|
|
78
77
|
if (isIOS()) {
|
|
79
78
|
on(window, "touchend", () => (isAllowedToDrag = false), { once: true });
|
|
@@ -171,6 +170,8 @@ export function useDrawerRoot(opts) {
|
|
|
171
170
|
}
|
|
172
171
|
if (!isAllowedToDrag && !shouldDrag(event.target, isDraggingInDirection))
|
|
173
172
|
return;
|
|
173
|
+
drawerNode.classList.add(DRAG_CLASS);
|
|
174
|
+
// If shouldDrag gave true once after pressing down on the drawer, we set isAllowedToDrag to true and it will remain true until we let go, there's no reason to disable dragging mid way, ever, and that's the solution to it
|
|
174
175
|
isAllowedToDrag = true;
|
|
175
176
|
set(drawerNode, {
|
|
176
177
|
transition: "none",
|
|
@@ -230,17 +231,6 @@ export function useDrawerRoot(opts) {
|
|
|
230
231
|
shouldAnimate = true;
|
|
231
232
|
});
|
|
232
233
|
});
|
|
233
|
-
$effect(() => {
|
|
234
|
-
if (!opts.open.current)
|
|
235
|
-
return;
|
|
236
|
-
const preventScrollDuringDrag = (e) => {
|
|
237
|
-
if (isDragging) {
|
|
238
|
-
e.preventDefault();
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
window.addEventListener("touchmove", preventScrollDuringDrag, { passive: false });
|
|
242
|
-
return () => window.removeEventListener("touchmove", preventScrollDuringDrag);
|
|
243
|
-
});
|
|
244
234
|
function onDialogOpenChange(o) {
|
|
245
235
|
if (!opts.dismissible.current && !o)
|
|
246
236
|
return;
|