File tree Expand file tree Collapse file tree 6 files changed +55
-50
lines changed Expand file tree Collapse file tree 6 files changed +55
-50
lines changed Original file line number Diff line number Diff line change 1
1
<script lang =" ts" >
2
- import { DropdownMenu as DropdownMenuPrimitive , type WithoutChild } from " bits-ui" ;
2
+ import { DropdownMenu as DropdownMenuPrimitive , type WithoutChildrenOrChild } from " bits-ui" ;
3
3
import Check from " lucide-svelte/icons/check" ;
4
4
import Minus from " lucide-svelte/icons/minus" ;
5
5
import { cn } from " $lib/utils.js" ;
6
+ import type { Snippet } from " svelte" ;
6
7
7
8
let {
8
9
ref = $bindable (null ),
9
10
checked = $bindable (false ),
11
+ indeterminate = $bindable (false ),
10
12
class : className,
11
13
children : childrenProp,
12
14
... restProps
13
- }: WithoutChild <DropdownMenuPrimitive .CheckboxItemProps > = $props ();
15
+ }: WithoutChildrenOrChild <DropdownMenuPrimitive .CheckboxItemProps > & {
16
+ children? : Snippet ;
17
+ } = $props ();
14
18
</script >
15
19
16
20
<DropdownMenuPrimitive .CheckboxItem
17
21
bind:ref
18
22
bind:checked
23
+ bind:indeterminate
19
24
class ={cn (
20
25
" data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50" ,
21
26
className
22
27
)}
23
28
{...restProps }
24
29
>
25
- {#snippet children ({ checked })}
30
+ {#snippet children ({ checked , indeterminate })}
26
31
<span class =" absolute left-2 flex size-3.5 items-center justify-center" >
27
- {#if checked === " indeterminate" }
32
+ {#if indeterminate }
28
33
<Minus class =" size-4" />
29
34
{:else }
30
35
<Check class ={cn (" size-4" , ! checked && " text-transparent" )} />
31
36
{/if }
32
37
</span >
33
- {@render childrenProp ?.({ checked } )}
38
+ {@render childrenProp ?.()}
34
39
{/ snippet }
35
40
</DropdownMenuPrimitive .CheckboxItem >
Original file line number Diff line number Diff line change 1
1
<script lang =" ts" >
2
- import { Menubar as MenubarPrimitive , type WithoutChild } from " bits-ui" ;
2
+ import { Menubar as MenubarPrimitive , type WithoutChildrenOrChild } from " bits-ui" ;
3
3
import Check from " lucide-svelte/icons/check" ;
4
4
import Minus from " lucide-svelte/icons/minus" ;
5
5
import { cn } from " $lib/utils.js" ;
6
+ import type { Snippet } from " svelte" ;
6
7
7
8
let {
8
9
ref = $bindable (null ),
9
10
class : className,
10
11
checked = $bindable (false ),
12
+ indeterminate = $bindable (false ),
11
13
children : childrenProp,
12
14
... restProps
13
- }: WithoutChild <MenubarPrimitive .CheckboxItemProps > = $props ();
15
+ }: WithoutChildrenOrChild <MenubarPrimitive .CheckboxItemProps > & {
16
+ children? : Snippet ;
17
+ } = $props ();
14
18
</script >
15
19
16
20
<MenubarPrimitive .CheckboxItem
17
21
bind:ref
18
22
bind:checked
23
+ bind:indeterminate
19
24
class ={cn (
20
25
" data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50" ,
21
26
className
22
27
)}
23
28
{...restProps }
24
29
>
25
- {#snippet children ({ checked })}
30
+ {#snippet children ({ checked , indeterminate })}
26
31
<span class =" absolute left-2 flex size-3.5 items-center justify-center" >
27
- {#if checked === " indeterminate" }
32
+ {#if indeterminate }
28
33
<Minus class =" size-4" />
29
34
{:else }
30
35
<Check class ={cn (" size-4" , ! checked && " text-transparent" )} />
31
36
{/if }
32
37
</span >
33
- {@render childrenProp ?.({ checked } )}
38
+ {@render childrenProp ?.()}
34
39
{/ snippet }
35
40
</MenubarPrimitive .CheckboxItem >
Original file line number Diff line number Diff line change 11
11
12
12
<MenubarPrimitive .Root
13
13
bind:ref
14
- class ={cn (" bg-background flex h-16 items-center space-x-1 rounded-md border p-1" , className )}
14
+ class ={cn (" bg-background flex h-10 items-center space-x-1 rounded-md border p-1" , className )}
15
15
{...restProps }
16
16
/>
Original file line number Diff line number Diff line change 1
1
<script lang =" ts" >
2
- import { Toaster as Sonner , type ToasterProps as SonnerProps } from ' svelte-sonner' ;
3
- import { ColorSchemeStore } from ' $lib/stores/ColorSchemeStore' ;
2
+ import { Toaster as Sonner , type ToasterProps as SonnerProps } from " svelte-sonner" ;
3
+ import { ColorSchemeStore } from ' $lib/stores/ColorSchemeStore' ;
4
4
5
- let restProps: SonnerProps = $props ();
5
+ let restProps: SonnerProps = $props ();
6
6
</script >
7
7
8
8
<Sonner
9
- theme ={$ColorSchemeStore }
10
- class =" toaster group"
11
- toastOptions ={{
12
- classes : {
13
- toast :
14
- ' group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg' ,
15
- description : ' group-[.toast]:text-muted-foreground' ,
16
- actionButton : ' group-[.toast]:bg-primary group-[.toast]:text-primary-foreground' ,
17
- cancelButton : ' group-[.toast]:bg-muted group-[.toast]:text-muted-foreground' ,
18
- },
19
- }}
20
- {...restProps }
9
+ theme ={$ColorSchemeStore }
10
+ class =" toaster group"
11
+ toastOptions ={{
12
+ classes : {
13
+ toast : " group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg" ,
14
+ description : " group-[.toast]:text-muted-foreground" ,
15
+ actionButton : " group-[.toast]:bg-primary group-[.toast]:text-primary-foreground" ,
16
+ cancelButton : " group-[.toast]:bg-muted group-[.toast]:text-muted-foreground" ,
17
+ },
18
+ }}
19
+ {...restProps }
21
20
/>
Original file line number Diff line number Diff line change 11
11
}: WithElementRef <HTMLAttributes <HTMLTableSectionElement >> = $props ();
12
12
</script >
13
13
14
- <tfoot
15
- bind:this ={ref }
16
- class ={cn (" bg-muted/50 text-primary-foreground font-medium" , className )}
17
- {...restProps }
18
- >
14
+ <tfoot bind:this ={ref } class ={cn (" bg-muted/50 font-medium" , className )} {...restProps }>
19
15
{@render children ?.()}
20
16
</tfoot >
Original file line number Diff line number Diff line change @@ -3,25 +3,25 @@ import { untrack } from "svelte";
3
3
const MOBILE_BREAKPOINT = 768 ;
4
4
5
5
export class IsMobile {
6
- #current = $state < boolean > ( false ) ;
6
+ #current = $state < boolean > ( false ) ;
7
7
8
- constructor ( ) {
9
- $effect ( ( ) => {
10
- return untrack ( ( ) => {
11
- const mql = window . matchMedia ( `(max-width: ${ MOBILE_BREAKPOINT - 1 } px)` ) ;
12
- const onChange = ( ) => {
13
- this . #current = window . innerWidth < MOBILE_BREAKPOINT ;
14
- } ;
15
- mql . addEventListener ( "change" , onChange ) ;
16
- onChange ( ) ;
17
- return ( ) => {
18
- mql . removeEventListener ( "change" , onChange ) ;
19
- } ;
20
- } ) ;
21
- } ) ;
22
- }
8
+ constructor ( ) {
9
+ $effect ( ( ) => {
10
+ return untrack ( ( ) => {
11
+ const mql = window . matchMedia ( `(max-width: ${ MOBILE_BREAKPOINT - 1 } px)` ) ;
12
+ const onChange = ( ) => {
13
+ this . #current = window . innerWidth < MOBILE_BREAKPOINT ;
14
+ } ;
15
+ mql . addEventListener ( "change" , onChange ) ;
16
+ onChange ( ) ;
17
+ return ( ) => {
18
+ mql . removeEventListener ( "change" , onChange ) ;
19
+ } ;
20
+ } ) ;
21
+ } ) ;
22
+ }
23
23
24
- get current ( ) {
25
- return this . #current;
26
- }
24
+ get current ( ) {
25
+ return this . #current;
26
+ }
27
27
}
You can’t perform that action at this time.
0 commit comments