Skip to content

Commit

Permalink
Update all Svelte transitions with |local modifier for better Svelt…
Browse files Browse the repository at this point in the history
…eKit compatibility
  • Loading branch information
techniq committed Apr 4, 2023
1 parent e16a530 commit fd05524
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/lib/components/Backdrop.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
on:click
on:mousedown
on:mouseup
transition:fade={fadeParams}
transition:fade|local={fadeParams}
class:blur
use:portalAction={{ enabled: portal }}
>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/Dialog.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
$$props.class
)}
style={$$props.style}
transition:scale={{ duration: 150, easing: quadIn }}
transition:scale|local={{ duration: 150, easing: quadIn }}
on:introstart
on:outrostart
on:introend
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/Drawer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
$$props.class
)}
style={$$props.style}
transition:fly={{
transition:fly|local={{
x: left ? '-100%' : right ? '100%' : 0,
y: top ? '-100%' : bottom ? '100%' : 0,
}}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/Menu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
// Do not allow event to reach Popover's on:mouseup (clickOutside)
e.stopPropagation();
}}
transition:transition={transitionParams}
transition:transition|local={transitionParams}
use:focusMove={{ disabled: !moveFocus }}
>
<slot {close} />
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/Month.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@
{#key startOfMonth.valueOf()}
<div
class="col-span-full row-span-full grid grid-cols-7 grid-rows-6 gap-y-4"
in:fly={{ x: '-100%' }}
out:fly={{ x: '100%' }}
in:fly|local={{ x: '-100%' }}
out:fly|local={{ x: '100%' }}
>
{#each monthDaysByWeek ?? [] as week, weekIndex (weekIndex)}
{#each week ?? [] as day (day.valueOf())}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/Notification.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
{#if open}
<div
class="notification rounded-lg border bg-white shadow-lg z-10"
transition:fly={{ duration: 200, easing: quadIn, x: 100 }}
transition:fly|local={{ duration: 200, easing: quadIn, x: 100 }}
on:outroend={() => dispatch('close')}
on:click={onClick}
bind:this={notificationEl}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/RangeSlider.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@
<output
style="left: calc(var(--start) * 100%);"
class="value absolute top-1/2 -translate-x-1/2 -translate-y-[180%] text-xs text-white bg-accent-500 rounded-full px-2 shadow"
transition:fly={{ y: 4, duration: 300 }}
transition:fly|local={{ y: 4, duration: 300 }}
>
{value[0]}
</output>
Expand All @@ -314,7 +314,7 @@
<output
style="left: calc(var(--end) * 100%);"
class="value absolute top-1/2 -translate-x-1/2 -translate-y-[180%] text-xs text-white bg-accent-500 rounded-full px-2 shadow"
transition:fly={{ y: 4, duration: 300 }}
transition:fly|local={{ y: 4, duration: 300 }}
>
{value[1]}
</output>
Expand Down
24 changes: 11 additions & 13 deletions src/lib/components/Tooltip.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
}
</script>

{#if enabled}
{#if enabled && (title || $$slots.title)}
<Popover
anchorEl={containerEl?.firstElementChild}
{placement}
Expand All @@ -65,18 +65,16 @@
{...$$restProps}
>
<slot name="title">
{#if title}
<div
class="text-white text-xs bg-gray-900/90 px-2 py-1 rounded whitespace-nowrap"
transition:fly={{
x: placement === 'left' ? 6 : placement === 'right' ? -6 : 0,
y: placement === 'top' ? 6 : placement === 'bottom' ? -6 : 0,
duration: 300,
}}
>
{title}
</div>
{/if}
<div
class="text-white text-xs bg-gray-900/90 px-2 py-1 rounded whitespace-nowrap"
transition:fly|local={{
x: placement === 'left' ? 6 : placement === 'right' ? -6 : 0,
y: placement === 'top' ? 6 : placement === 'bottom' ? -6 : 0,
duration: 300,
}}
>
{title}
</div>
</slot>
</Popover>
{/if}
Expand Down

0 comments on commit fd05524

Please sign in to comment.