fuma 2.0.29 → 2.0.30

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,23 +1,14 @@
1
1
  <script lang="ts" context="module">
2
2
  import { createSingleton, type TippyInstance } from '../../utils/tippy.js'
3
+ import type { CreateSingletonInstance } from 'tippy.js'
3
4
 
4
- const sigleton = browser
5
- ? createSingleton([], {
6
- theme: 'dropdown',
7
- arrow: false,
8
- moveTransition: 'transform 0.1s ease-out',
9
- interactive: true,
10
- interactiveDebounce: 50
11
- })
12
- : null
13
-
5
+ let sigleton: CreateSingletonInstance | null = null
14
6
  const tips: TippyInstance[] = []
15
7
  </script>
16
8
 
17
9
  <script lang="ts">
18
10
  import { tippy, type TippyProps } from '../../utils/tippy.js'
19
11
  import { onMount } from 'svelte'
20
- import { browser } from '$app/environment'
21
12
  import { beforeNavigate } from '$app/navigation'
22
13
  import './dropdown.css'
23
14
 
@@ -56,6 +47,7 @@
56
47
  trigger: 'click focus',
57
48
  interactive: true,
58
49
  interactiveDebounce: 50,
50
+ moveTransition: 'transform 0.1s ease-out',
59
51
  appendTo: 'parent',
60
52
  onShown() {
61
53
  if (autofocus) focusables[0]?.select()
@@ -65,7 +57,11 @@
65
57
 
66
58
  if (useSingleton && tip) {
67
59
  tips.push(tip)
68
- sigleton?.setInstances(tips)
60
+ if (!sigleton) {
61
+ sigleton = createSingleton(tips)
62
+ } else {
63
+ sigleton?.setInstances(tips)
64
+ }
69
65
  }
70
66
 
71
67
  const lastFocusable = focusables.at(-1)
@@ -76,6 +72,10 @@
76
72
  if (useSingleton && tip) {
77
73
  tips.splice(tips.indexOf(tip), 1)
78
74
  tip.destroy()
75
+ if (tips.length === 0) {
76
+ sigleton?.destroy()
77
+ sigleton = null
78
+ }
79
79
  }
80
80
  }
81
81
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fuma",
3
- "version": "2.0.29",
3
+ "version": "2.0.30",
4
4
  "description": "My fullstack material build with sveltekit, daisyui, zod, prisma, lucia",
5
5
  "author": {
6
6
  "name": "Jonas Voisard",