@shival99/z-ui-svelte 0.1.6 → 0.1.8

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.
@@ -7,12 +7,12 @@
7
7
  import ZIconAnimated from './ZIconAnimated.svelte';
8
8
  import ZIconCustom from './ZIconCustom.svelte';
9
9
  import { zGetIcon, zLoadIcon } from './z-icon.loader.svelte';
10
- import type { ZIcon, ZIconAnimationTrigger, ZIconSize } from './z-icon.types';
10
+ import type { ZIcon as ZIconName, ZIconAnimationTrigger, ZIconSize } from './z-icon.types';
11
11
 
12
12
  interface Props extends Omit<HTMLAttributes<HTMLSpanElement>, 'class'> {
13
13
  class?: ClassValue;
14
14
  /** Named icon from any supported family (`lucideX`, `saxHomeBold`, `tablerHeart`, …). */
15
- zType?: ZIcon;
15
+ zType?: ZIconName;
16
16
  /** Animated icon (kebab-case, e.g. `bell`). Takes precedence over `zType`. */
17
17
  zAnimatedType?: ZAnimatedIcon;
18
18
  /** Keep the animated icon looping. */
@@ -1,11 +1,11 @@
1
1
  import type { HTMLAttributes } from 'svelte/elements';
2
2
  import type { ClassValue } from 'clsx';
3
3
  import type { ZAnimatedIcon } from './animated';
4
- import type { ZIcon, ZIconAnimationTrigger, ZIconSize } from './z-icon.types';
4
+ import type { ZIcon as ZIconName, ZIconAnimationTrigger, ZIconSize } from './z-icon.types';
5
5
  interface Props extends Omit<HTMLAttributes<HTMLSpanElement>, 'class'> {
6
6
  class?: ClassValue;
7
7
  /** Named icon from any supported family (`lucideX`, `saxHomeBold`, `tablerHeart`, …). */
8
- zType?: ZIcon;
8
+ zType?: ZIconName;
9
9
  /** Animated icon (kebab-case, e.g. `bell`). Takes precedence over `zType`. */
10
10
  zAnimatedType?: ZAnimatedIcon;
11
11
  /** Keep the animated icon looping. */
@@ -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={{ y, scale: slot.scale, opacity: slot.opacity, from: (slot.y + drop - 8) * fall }}
197
- out:zPillSlot={{ y, scale: slot.scale, opacity: slot.opacity, from: (slot.y + drop - 8) * fall }}
206
+ in:zPillSlot={ride}
207
+ out:zPillSlot={lastSlot.get(note.id) ?? ride}
198
208
  >
199
209
  <div
200
210
  class="relative flex flex-col"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shival99/z-ui-svelte",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Z-UI component library for Svelte 5 (runes, no CDK).",
5
5
  "license": "MIT",
6
6
  "type": "module",