@shival99/z-ui-svelte 0.1.6 → 0.1.7
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.
|
@@ -30,6 +30,14 @@
|
|
|
30
30
|
// Plain bookkeeping that is never rendered from, so it is deliberately not reactive.
|
|
31
31
|
// eslint-disable-next-line svelte/prefer-svelte-reactivity
|
|
32
32
|
const wrappers = new Map<ZToastId, HTMLElement>();
|
|
33
|
+
// The slot each card last had. An `out:` transition reads its options after the card's block is destroyed, and
|
|
34
|
+
// reading a `{@const}` then logs derived_inert: it reads this copy instead.
|
|
35
|
+
// eslint-disable-next-line svelte/prefer-svelte-reactivity
|
|
36
|
+
const lastSlot = new Map<ZToastId, { y: number; scale: number; opacity: number; from: number }>();
|
|
37
|
+
function remember(id: ZToastId, fx: { y: number; scale: number; opacity: number; from: number }) {
|
|
38
|
+
lastSlot.set(id, fx);
|
|
39
|
+
return fx;
|
|
40
|
+
}
|
|
33
41
|
const open = $derived(pointing || focused || holding);
|
|
34
42
|
const piled = $derived(cards.length > 1 && !open);
|
|
35
43
|
const paused = $derived(open || hidden);
|
|
@@ -185,6 +193,7 @@
|
|
|
185
193
|
{@const capWidth = behind && deck ? deck.width : box?.width}
|
|
186
194
|
{@const capHeight = behind && deck ? deck.height : box?.height}
|
|
187
195
|
{@const y = (slot.y + drop) * fall}
|
|
196
|
+
{@const ride = remember(note.id, { y, scale: slot.scale, opacity: slot.opacity, from: (slot.y + drop - 8) * fall })}
|
|
188
197
|
<div
|
|
189
198
|
class={['absolute inset-x-0 flex justify-center px-4', side === 'top' ? 'top-0' : 'bottom-0']}
|
|
190
199
|
style:z-index={note.order ?? cards.length - index}
|
|
@@ -192,9 +201,10 @@
|
|
|
192
201
|
style:transform="translateY({y}px) scale({slot.scale})"
|
|
193
202
|
style:opacity={slot.opacity}
|
|
194
203
|
style:transition="transform {Z_TOAST_PILL_MORPH_MS}ms {Z_TOAST_PILL_EASE}, opacity {Z_TOAST_PILL_MORPH_MS}ms {Z_TOAST_PILL_EASE}"
|
|
204
|
+
style:--z-pill-slot={ride.y}
|
|
195
205
|
aria-hidden={slot.opacity === 0 || undefined}
|
|
196
|
-
in:zPillSlot={
|
|
197
|
-
out:zPillSlot={
|
|
206
|
+
in:zPillSlot={ride}
|
|
207
|
+
out:zPillSlot={lastSlot.get(note.id) ?? ride}
|
|
198
208
|
>
|
|
199
209
|
<div
|
|
200
210
|
class="relative flex flex-col"
|