diff --git a/bun.lockb b/bun.lockb index 87c3dab..4aba811 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/components.json b/components.json index 20958c8..6ffaef8 100644 --- a/components.json +++ b/components.json @@ -1,5 +1,5 @@ { - "$schema": "https://shadcn-svelte.com/schema.json", + "$schema": "https://next.shadcn-svelte.com/schema.json", "style": "new-york", "tailwind": { "config": "tailwind.config.ts", @@ -8,7 +8,10 @@ }, "aliases": { "components": "$lib/components", - "utils": "$lib/utils" + "utils": "$lib/utils", + "ui": "$lib/components/ui", + "hooks": "$lib/hooks" }, - "typescript": true + "typescript": true, + "registry": "https://next.shadcn-svelte.com/registry" } diff --git a/package.json b/package.json index dfc67e2..abb5003 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "prettier-plugin-tailwindcss": "^0.6.11", "svelte": "^5.0.0", "svelte-check": "^4.0.0", + "tailwindcss-animate": "^1.0.7", "typescript": "^5.0.0", "typescript-eslint": "^8.20.0" }, @@ -49,11 +50,11 @@ "autoprefixer": "^10.4.20", "better-auth": "^1.1.16", "better-sqlite3": "^11.8.1", - "bits-ui": "0.22.0", + "bits-ui": "^1.3.5", "cassandra-driver": "^4.7.2", "dotenv": "^16.4.7", "express": "^4.21.2", - "lucide-svelte": "^0.474.0", + "lucide-svelte": "^0.477.0", "markdown-it": "^14.1.0", "markdown-it-highlightjs": "^4.2.0", "markdown-it-link-attributes": "^4.0.1", @@ -63,7 +64,7 @@ "socket.io-client": "^4.8.1", "svelte-radix": "^2.0.1", "sveltekit-superforms": "^2.23.1", - "tailwind-merge": "^3.0.1", + "tailwind-merge": "^3.0.2", "tailwind-variants": "^0.3.1", "tailwindcss": "^3.4.17", "tsm": "^2.3.0", diff --git a/src/app.css b/src/app.css index e496cfd..a7811ca 100644 --- a/src/app.css +++ b/src/app.css @@ -1,5 +1,3 @@ -@import '../node_modules/highlight.js/styles/github-dark.min.css'; - @tailwind base; @tailwind components; @tailwind utilities; @@ -15,45 +13,62 @@ :root { --background: 0 0% 100%; --foreground: 20 14.3% 4.1%; - --card: 0 0% 100%; - --card-foreground: 20 14.3% 4.1%; - --popover: 0 0% 100%; - --popover-foreground: 20 14.3% 4.1%; - --primary: 24 9.8% 10%; - --primary-foreground: 60 9.1% 97.8%; - --secondary: 240 6% 90%; - --secondary-foreground: 24 9.8% 10%; --muted: 60 4.8% 95.9%; --muted-foreground: 25 5.3% 44.7%; - --accent: 60 4.8% 95.9%; - --accent-foreground: 24 9.8% 10%; - --destructive: 0 72.22% 50.59%; - --destructive-foreground: 60 9.1% 97.8%; + --popover: 0 0% 100%; + --popover-foreground: 20 14.3% 4.1%; + --card: 0 0% 100%; + --card-foreground: 20 14.3% 4.1%; --border: 20 5.9% 90%; --input: 20 5.9% 90%; + --primary: 24 9.8% 10%; + --primary-foreground: 60 9.1% 97.8%; + --secondary: 60 4.8% 95.9%; + --secondary-foreground: 24 9.8% 10%; + --accent: 60 4.8% 95.9%; + --accent-foreground: 24 9.8% 10%; + --destructive: 0 72.2% 50.6%; + --destructive-foreground: 60 9.1% 97.8%; --ring: 20 14.3% 4.1%; --radius: 0.5rem; + --sidebar-background: 0 0% 98%; + --sidebar-foreground: 240 5.3% 26.1%; + --sidebar-primary: 240 5.9% 10%; + --sidebar-primary-foreground: 0 0% 98%; + --sidebar-accent: 240 4.8% 95.9%; + --sidebar-accent-foreground: 240 5.9% 10%; + --sidebar-border: 220 13% 91%; + --sidebar-ring: 217.2 91.2% 59.8%; } + .dark { --background: 20 14.3% 4.1%; --foreground: 60 9.1% 97.8%; - --card: 20 14.3% 4.1%; - --card-foreground: 60 9.1% 97.8%; + --muted: 12 6.5% 15.1%; + --muted-foreground: 24 5.4% 63.9%; --popover: 20 14.3% 4.1%; --popover-foreground: 60 9.1% 97.8%; + --card: 20 14.3% 4.1%; + --card-foreground: 60 9.1% 97.8%; + --border: 12 6.5% 15.1%; + --input: 12 6.5% 15.1%; --primary: 60 9.1% 97.8%; --primary-foreground: 24 9.8% 10%; --secondary: 12 6.5% 15.1%; --secondary-foreground: 60 9.1% 97.8%; - --muted: 12 6.5% 15.1%; - --muted-foreground: 24 5.4% 63.9%; --accent: 12 6.5% 15.1%; --accent-foreground: 60 9.1% 97.8%; --destructive: 0 62.8% 30.6%; --destructive-foreground: 60 9.1% 97.8%; - --border: 12 6.5% 15.1%; - --input: 12 6.5% 15.1%; --ring: 24 5.7% 82.9%; + --sidebar-background: 240 5.9% 10%; + --sidebar-foreground: 240 4.8% 95.9%; + --sidebar-primary: 224.3 76.3% 48%; + --sidebar-primary-foreground: 0 0% 100%; + --sidebar-accent: 240 3.7% 15.9%; + --sidebar-accent-foreground: 240 4.8% 95.9%; + --sidebar-border: 240 3.7% 15.9%; + --sidebar-ring: 217.2 91.2% 59.8%; } } diff --git a/src/lib/components/message.svelte b/src/lib/components/message.svelte index 0220cf8..1ab6f29 100644 --- a/src/lib/components/message.svelte +++ b/src/lib/components/message.svelte @@ -15,7 +15,7 @@ i: number; } - let { message, imageSrc, user, timestamp, uid, open = $bindable(), closeDialogs, i }: TypeMessage & Props = $props(); + let { message, imageSrc, user, timestamp, uid, open = $bindable(false), closeDialogs, i }: TypeMessage & Props = $props(); function copy(itemName: string, content: string | number) { navigator.clipboard diff --git a/src/lib/components/modeSwitcher.svelte b/src/lib/components/modeSwitcher.svelte index 5ebd49a..1f5a228 100644 --- a/src/lib/components/modeSwitcher.svelte +++ b/src/lib/components/modeSwitcher.svelte @@ -6,14 +6,16 @@ import { toggleMode } from 'mode-watcher'; - - -
- - -
-
- -

Toggle theme

-
-
+ + + +
+ + +
+
+ +

Toggle theme

+
+
+
diff --git a/src/lib/components/prose.svelte b/src/lib/components/prose.svelte index a0e860e..17d1f71 100644 --- a/src/lib/components/prose.svelte +++ b/src/lib/components/prose.svelte @@ -9,6 +9,6 @@ const { children, class: className = '' }: Props = $props(); -
+
{@render children()}
diff --git a/src/lib/components/ui/badge/badge.svelte b/src/lib/components/ui/badge/badge.svelte index c2eae1c..cec53de 100644 --- a/src/lib/components/ui/badge/badge.svelte +++ b/src/lib/components/ui/badge/badge.svelte @@ -1,13 +1,40 @@ - - - + + + + {@render children?.()} diff --git a/src/lib/components/ui/badge/index.ts b/src/lib/components/ui/badge/index.ts index 502ad3e..f05fb87 100644 --- a/src/lib/components/ui/badge/index.ts +++ b/src/lib/components/ui/badge/index.ts @@ -1,19 +1,2 @@ -import { type VariantProps, tv } from 'tailwind-variants'; - export { default as Badge } from './badge.svelte'; -export const badgeVariants = tv({ - base: 'focus:ring-ring inline-flex select-none items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2', - variants: { - variant: { - default: 'bg-primary text-primary-foreground hover:bg-primary/80 border-transparent shadow', - secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80 border-transparent', - destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/80 border-transparent shadow', - outline: 'text-foreground', - }, - }, - defaultVariants: { - variant: 'default', - }, -}); - -export type Variant = VariantProps['variant']; +export { badgeVariants, type BadgeVariant } from './badge.svelte'; diff --git a/src/lib/components/ui/button/button.svelte b/src/lib/components/ui/button/button.svelte index 2e4b156..c327632 100644 --- a/src/lib/components/ui/button/button.svelte +++ b/src/lib/components/ui/button/button.svelte @@ -1,18 +1,63 @@ - - - - + + +{#if href} + + {@render children?.()} + +{:else} + +{/if} diff --git a/src/lib/components/ui/button/index.ts b/src/lib/components/ui/button/index.ts index affba83..7ceb12a 100644 --- a/src/lib/components/ui/button/index.ts +++ b/src/lib/components/ui/button/index.ts @@ -1,48 +1,12 @@ -import type { Button as ButtonPrimitive } from 'bits-ui'; -import { type VariantProps, tv } from 'tailwind-variants'; -import Root from './button.svelte'; - -const buttonVariants = tv({ - base: 'focus-visible:ring-ring inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 disabled:pointer-events-none disabled:opacity-50', - variants: { - variant: { - default: 'bg-primary text-primary-foreground hover:bg-primary/90 shadow', - destructive: 'bg-destructive text-destructive-foreground hover:bg-destructive/90 shadow-sm', - outline: 'border-input bg-background hover:bg-accent hover:text-accent-foreground border shadow-sm', - secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80 shadow-sm', - ghost: 'hover:bg-accent hover:text-accent-foreground', - link: 'text-primary underline-offset-4 hover:underline', - }, - size: { - default: 'h-9 px-4 py-2', - sm: 'h-8 rounded-md px-3 text-xs', - lg: 'h-10 rounded-md px-8', - icon: 'h-9 w-9', - }, - }, - defaultVariants: { - variant: 'default', - size: 'default', - }, -}); - -type Variant = VariantProps['variant']; -type Size = VariantProps['size']; - -type Props = ButtonPrimitive.Props & { - variant?: Variant; - size?: Size; -}; - -type Events = ButtonPrimitive.Events; +import Root, { type ButtonProps, type ButtonSize, type ButtonVariant, buttonVariants } from './button.svelte'; export { Root, - type Props, - type Events, + type ButtonProps as Props, // Root as Button, - type Props as ButtonProps, - type Events as ButtonEvents, buttonVariants, + type ButtonProps, + type ButtonSize, + type ButtonVariant, }; diff --git a/src/lib/components/ui/card/card-content.svelte b/src/lib/components/ui/card/card-content.svelte index e2dce55..efe3f66 100644 --- a/src/lib/components/ui/card/card-content.svelte +++ b/src/lib/components/ui/card/card-content.svelte @@ -1,13 +1,11 @@ -
- +
+ {@render children?.()}
diff --git a/src/lib/components/ui/card/card-description.svelte b/src/lib/components/ui/card/card-description.svelte index bbe3e27..17c4c59 100644 --- a/src/lib/components/ui/card/card-description.svelte +++ b/src/lib/components/ui/card/card-description.svelte @@ -1,13 +1,11 @@ -

- +

+ {@render children?.()}

diff --git a/src/lib/components/ui/card/card-footer.svelte b/src/lib/components/ui/card/card-footer.svelte index 3d6a4b6..3235d77 100644 --- a/src/lib/components/ui/card/card-footer.svelte +++ b/src/lib/components/ui/card/card-footer.svelte @@ -1,13 +1,11 @@ -
- +
+ {@render children?.()}
diff --git a/src/lib/components/ui/card/card-header.svelte b/src/lib/components/ui/card/card-header.svelte index c9822c5..53f03c2 100644 --- a/src/lib/components/ui/card/card-header.svelte +++ b/src/lib/components/ui/card/card-header.svelte @@ -1,13 +1,11 @@ -
- +
+ {@render children?.()}
diff --git a/src/lib/components/ui/card/card-title.svelte b/src/lib/components/ui/card/card-title.svelte index bed9ca4..203ca81 100644 --- a/src/lib/components/ui/card/card-title.svelte +++ b/src/lib/components/ui/card/card-title.svelte @@ -1,17 +1,19 @@ - - - +
+ {@render children?.()} +
diff --git a/src/lib/components/ui/card/card.svelte b/src/lib/components/ui/card/card.svelte index 617e8d8..ec7e90a 100644 --- a/src/lib/components/ui/card/card.svelte +++ b/src/lib/components/ui/card/card.svelte @@ -1,22 +1,11 @@ - -
- +
+ {@render children?.()}
diff --git a/src/lib/components/ui/card/index.ts b/src/lib/components/ui/card/index.ts index 1432839..e59c113 100644 --- a/src/lib/components/ui/card/index.ts +++ b/src/lib/components/ui/card/index.ts @@ -20,5 +20,3 @@ export { Header as CardHeader, Title as CardTitle, }; - -export type HeadingLevel = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'; diff --git a/src/lib/components/ui/context-menu/context-menu-checkbox-item.svelte b/src/lib/components/ui/context-menu/context-menu-checkbox-item.svelte index 2a9dd32..84e6718 100644 --- a/src/lib/components/ui/context-menu/context-menu-checkbox-item.svelte +++ b/src/lib/components/ui/context-menu/context-menu-checkbox-item.svelte @@ -1,35 +1,40 @@ - - - - - - + {#snippet children({ checked, indeterminate })} + + {#if indeterminate} + + {:else} + + {/if} + + {@render childrenProp?.()} + {/snippet} diff --git a/src/lib/components/ui/context-menu/context-menu-content.svelte b/src/lib/components/ui/context-menu/context-menu-content.svelte index 1854d60..9d0797f 100644 --- a/src/lib/components/ui/context-menu/context-menu-content.svelte +++ b/src/lib/components/ui/context-menu/context-menu-content.svelte @@ -1,21 +1,21 @@ - - - + + + diff --git a/src/lib/components/ui/context-menu/context-menu-group-heading.svelte b/src/lib/components/ui/context-menu/context-menu-group-heading.svelte new file mode 100644 index 0000000..fcbd758 --- /dev/null +++ b/src/lib/components/ui/context-menu/context-menu-group-heading.svelte @@ -0,0 +1,19 @@ + + + diff --git a/src/lib/components/ui/context-menu/context-menu-item.svelte b/src/lib/components/ui/context-menu/context-menu-item.svelte index 3116b73..bb166be 100644 --- a/src/lib/components/ui/context-menu/context-menu-item.svelte +++ b/src/lib/components/ui/context-menu/context-menu-item.svelte @@ -2,14 +2,14 @@ import { ContextMenu as ContextMenuPrimitive } from 'bits-ui'; import { cn } from '$lib/utils.js'; - type $$Props = ContextMenuPrimitive.ItemProps & { + let { + ref = $bindable(null), + class: className, + inset, + ...restProps + }: ContextMenuPrimitive.ItemProps & { inset?: boolean; - }; - type $$Events = ContextMenuPrimitive.ItemEvents; - - let className: $$Props['class'] = undefined; - export let inset: $$Props['inset'] = undefined; - export { className as class }; + } = $props(); - - + bind:ref + {...restProps} +/> diff --git a/src/lib/components/ui/context-menu/context-menu-radio-item.svelte b/src/lib/components/ui/context-menu/context-menu-radio-item.svelte index d54c2df..a368982 100644 --- a/src/lib/components/ui/context-menu/context-menu-radio-item.svelte +++ b/src/lib/components/ui/context-menu/context-menu-radio-item.svelte @@ -1,35 +1,25 @@ - - - - - - + {#snippet children({ checked })} + + {#if checked} + + {/if} + + {@render childrenProp?.({ checked })} + {/snippet} diff --git a/src/lib/components/ui/context-menu/context-menu-separator.svelte b/src/lib/components/ui/context-menu/context-menu-separator.svelte index c09b2a6..a946601 100644 --- a/src/lib/components/ui/context-menu/context-menu-separator.svelte +++ b/src/lib/components/ui/context-menu/context-menu-separator.svelte @@ -2,10 +2,7 @@ import { ContextMenu as ContextMenuPrimitive } from 'bits-ui'; import { cn } from '$lib/utils.js'; - type $$Props = ContextMenuPrimitive.SeparatorProps; - - let className: $$Props['class'] = undefined; - export { className as class }; + let { ref = $bindable(null), class: className, ...restProps }: ContextMenuPrimitive.SeparatorProps = $props(); - + diff --git a/src/lib/components/ui/context-menu/context-menu-shortcut.svelte b/src/lib/components/ui/context-menu/context-menu-shortcut.svelte index 0d54df5..5b82690 100644 --- a/src/lib/components/ui/context-menu/context-menu-shortcut.svelte +++ b/src/lib/components/ui/context-menu/context-menu-shortcut.svelte @@ -1,13 +1,11 @@ - - + + {@render children?.()} diff --git a/src/lib/components/ui/context-menu/context-menu-sub-content.svelte b/src/lib/components/ui/context-menu/context-menu-sub-content.svelte index 424570a..a8647d7 100644 --- a/src/lib/components/ui/context-menu/context-menu-sub-content.svelte +++ b/src/lib/components/ui/context-menu/context-menu-sub-content.svelte @@ -1,23 +1,12 @@ - - + {...restProps} +/> diff --git a/src/lib/components/ui/context-menu/context-menu-sub-trigger.svelte b/src/lib/components/ui/context-menu/context-menu-sub-trigger.svelte index dfca522..cc8fe7f 100644 --- a/src/lib/components/ui/context-menu/context-menu-sub-trigger.svelte +++ b/src/lib/components/ui/context-menu/context-menu-sub-trigger.svelte @@ -1,32 +1,28 @@ - - + {@render children?.()} + diff --git a/src/lib/components/ui/context-menu/index.ts b/src/lib/components/ui/context-menu/index.ts index 20b7e98..420c577 100644 --- a/src/lib/components/ui/context-menu/index.ts +++ b/src/lib/components/ui/context-menu/index.ts @@ -1,32 +1,32 @@ import { ContextMenu as ContextMenuPrimitive } from 'bits-ui'; import Item from './context-menu-item.svelte'; -import Label from './context-menu-label.svelte'; +import GroupHeading from './context-menu-group-heading.svelte'; import Content from './context-menu-content.svelte'; import Shortcut from './context-menu-shortcut.svelte'; import RadioItem from './context-menu-radio-item.svelte'; import Separator from './context-menu-separator.svelte'; -import RadioGroup from './context-menu-radio-group.svelte'; import SubContent from './context-menu-sub-content.svelte'; import SubTrigger from './context-menu-sub-trigger.svelte'; import CheckboxItem from './context-menu-checkbox-item.svelte'; -const Sub = ContextMenuPrimitive.Sub; -const Root = ContextMenuPrimitive.Root; -const Trigger = ContextMenuPrimitive.Trigger; -const Group = ContextMenuPrimitive.Group; +const Sub: typeof ContextMenuPrimitive.Sub = ContextMenuPrimitive.Sub; +const Root: typeof ContextMenuPrimitive.Root = ContextMenuPrimitive.Root; +const Trigger: typeof ContextMenuPrimitive.Trigger = ContextMenuPrimitive.Trigger; +const Group: typeof ContextMenuPrimitive.Group = ContextMenuPrimitive.Group; +const RadioGroup: typeof ContextMenuPrimitive.RadioGroup = ContextMenuPrimitive.RadioGroup; export { Sub, Root, Item, - Label, Group, Trigger, Content, Shortcut, Separator, RadioItem, + GroupHeading, SubContent, SubTrigger, RadioGroup, @@ -35,13 +35,13 @@ export { Root as ContextMenu, Sub as ContextMenuSub, Item as ContextMenuItem, - Label as ContextMenuLabel, Group as ContextMenuGroup, Content as ContextMenuContent, Trigger as ContextMenuTrigger, Shortcut as ContextMenuShortcut, RadioItem as ContextMenuRadioItem, Separator as ContextMenuSeparator, + GroupHeading as ContextMenuGroupHeading, RadioGroup as ContextMenuRadioGroup, SubContent as ContextMenuSubContent, SubTrigger as ContextMenuSubTrigger, diff --git a/src/lib/components/ui/dialog/dialog-content.svelte b/src/lib/components/ui/dialog/dialog-content.svelte index aa38f4b..bcba3da 100644 --- a/src/lib/components/ui/dialog/dialog-content.svelte +++ b/src/lib/components/ui/dialog/dialog-content.svelte @@ -1,35 +1,37 @@ - + - + {@render children?.()} - + Close diff --git a/src/lib/components/ui/dialog/dialog-description.svelte b/src/lib/components/ui/dialog/dialog-description.svelte index de03478..2734fac 100644 --- a/src/lib/components/ui/dialog/dialog-description.svelte +++ b/src/lib/components/ui/dialog/dialog-description.svelte @@ -2,12 +2,7 @@ import { Dialog as DialogPrimitive } from 'bits-ui'; import { cn } from '$lib/utils.js'; - type $$Props = DialogPrimitive.DescriptionProps; - - let className: $$Props['class'] = undefined; - export { className as class }; + let { ref = $bindable(null), class: className, ...restProps }: DialogPrimitive.DescriptionProps = $props(); - - - + diff --git a/src/lib/components/ui/dialog/dialog-footer.svelte b/src/lib/components/ui/dialog/dialog-footer.svelte index c625327..9807551 100644 --- a/src/lib/components/ui/dialog/dialog-footer.svelte +++ b/src/lib/components/ui/dialog/dialog-footer.svelte @@ -1,13 +1,11 @@ -
- +
+ {@render children?.()}
diff --git a/src/lib/components/ui/dialog/dialog-header.svelte b/src/lib/components/ui/dialog/dialog-header.svelte index c0a1367..78b6848 100644 --- a/src/lib/components/ui/dialog/dialog-header.svelte +++ b/src/lib/components/ui/dialog/dialog-header.svelte @@ -1,13 +1,11 @@ -
- +
+ {@render children?.()}
diff --git a/src/lib/components/ui/dialog/dialog-overlay.svelte b/src/lib/components/ui/dialog/dialog-overlay.svelte index bdf250c..0384cdf 100644 --- a/src/lib/components/ui/dialog/dialog-overlay.svelte +++ b/src/lib/components/ui/dialog/dialog-overlay.svelte @@ -1,21 +1,15 @@ diff --git a/src/lib/components/ui/dialog/dialog-title.svelte b/src/lib/components/ui/dialog/dialog-title.svelte index c514c31..be3b676 100644 --- a/src/lib/components/ui/dialog/dialog-title.svelte +++ b/src/lib/components/ui/dialog/dialog-title.svelte @@ -2,12 +2,7 @@ import { Dialog as DialogPrimitive } from 'bits-ui'; import { cn } from '$lib/utils.js'; - type $$Props = DialogPrimitive.TitleProps; - - let className: $$Props['class'] = undefined; - export { className as class }; + let { ref = $bindable(null), class: className, ...restProps }: DialogPrimitive.TitleProps = $props(); - - - + diff --git a/src/lib/components/ui/dialog/index.ts b/src/lib/components/ui/dialog/index.ts index 707a04e..0c8f363 100644 --- a/src/lib/components/ui/dialog/index.ts +++ b/src/lib/components/ui/dialog/index.ts @@ -1,16 +1,16 @@ import { Dialog as DialogPrimitive } from 'bits-ui'; import Title from './dialog-title.svelte'; -import Portal from './dialog-portal.svelte'; import Footer from './dialog-footer.svelte'; import Header from './dialog-header.svelte'; import Overlay from './dialog-overlay.svelte'; import Content from './dialog-content.svelte'; import Description from './dialog-description.svelte'; -const Root = DialogPrimitive.Root; -const Trigger = DialogPrimitive.Trigger; -const Close = DialogPrimitive.Close; +const Root: typeof DialogPrimitive.Root = DialogPrimitive.Root; +const Trigger: typeof DialogPrimitive.Trigger = DialogPrimitive.Trigger; +const Close: typeof DialogPrimitive.Close = DialogPrimitive.Close; +const Portal: typeof DialogPrimitive.Portal = DialogPrimitive.Portal; export { Root, diff --git a/src/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte b/src/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte index 09e492b..e8ddeda 100644 --- a/src/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +++ b/src/lib/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte @@ -1,35 +1,40 @@ - - - - - - + {#snippet children({ checked, indeterminate })} + + {#if indeterminate} + + {:else} + + {/if} + + {@render childrenProp?.()} + {/snippet} diff --git a/src/lib/components/ui/dropdown-menu/dropdown-menu-content.svelte b/src/lib/components/ui/dropdown-menu/dropdown-menu-content.svelte index c1df3d6..bf00726 100644 --- a/src/lib/components/ui/dropdown-menu/dropdown-menu-content.svelte +++ b/src/lib/components/ui/dropdown-menu/dropdown-menu-content.svelte @@ -1,23 +1,27 @@ - - - + + + diff --git a/src/lib/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte b/src/lib/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte new file mode 100644 index 0000000..cb923b1 --- /dev/null +++ b/src/lib/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte @@ -0,0 +1,15 @@ + + + diff --git a/src/lib/components/ui/dropdown-menu/dropdown-menu-item.svelte b/src/lib/components/ui/dropdown-menu/dropdown-menu-item.svelte index 070937e..a69fe56 100644 --- a/src/lib/components/ui/dropdown-menu/dropdown-menu-item.svelte +++ b/src/lib/components/ui/dropdown-menu/dropdown-menu-item.svelte @@ -1,31 +1,23 @@ svg]:size-4 [&>svg]:shrink-0', inset && 'pl-8', className, )} - on:click - on:keydown - on:focusin - on:focusout - on:pointerdown - on:pointerleave - on:pointermove - {...$$restProps} -> - - + {...restProps} +/> diff --git a/src/lib/components/ui/dropdown-menu/dropdown-menu-label.svelte b/src/lib/components/ui/dropdown-menu/dropdown-menu-label.svelte index 37647b6..f47636f 100644 --- a/src/lib/components/ui/dropdown-menu/dropdown-menu-label.svelte +++ b/src/lib/components/ui/dropdown-menu/dropdown-menu-label.svelte @@ -1,16 +1,19 @@ - - - +
+ {@render children?.()} +
diff --git a/src/lib/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte b/src/lib/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte index dcf0e96..e7694a7 100644 --- a/src/lib/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte +++ b/src/lib/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte @@ -1,35 +1,30 @@ - - - - - - + {#snippet children({ checked })} + + {#if checked} + + {/if} + + {@render childrenProp?.({ checked })} + {/snippet} diff --git a/src/lib/components/ui/dropdown-menu/dropdown-menu-separator.svelte b/src/lib/components/ui/dropdown-menu/dropdown-menu-separator.svelte index dbf2184..8aaff32 100644 --- a/src/lib/components/ui/dropdown-menu/dropdown-menu-separator.svelte +++ b/src/lib/components/ui/dropdown-menu/dropdown-menu-separator.svelte @@ -2,10 +2,7 @@ import { DropdownMenu as DropdownMenuPrimitive } from 'bits-ui'; import { cn } from '$lib/utils.js'; - type $$Props = DropdownMenuPrimitive.SeparatorProps; - - let className: $$Props['class'] = undefined; - export { className as class }; + let { ref = $bindable(null), class: className, ...restProps }: DropdownMenuPrimitive.SeparatorProps = $props(); - + diff --git a/src/lib/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte b/src/lib/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte index 454af6c..bc5acb0 100644 --- a/src/lib/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte +++ b/src/lib/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte @@ -1,13 +1,11 @@ - - + + {@render children?.()} diff --git a/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte b/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte index 08402a9..087e948 100644 --- a/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte +++ b/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-content.svelte @@ -1,26 +1,12 @@ - - + {...restProps} +/> diff --git a/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte b/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte index bf826c9..f26e730 100644 --- a/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte +++ b/src/lib/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte @@ -1,32 +1,28 @@ - - + {@render children?.()} + diff --git a/src/lib/components/ui/dropdown-menu/index.ts b/src/lib/components/ui/dropdown-menu/index.ts index 22001e4..d3fe7c9 100644 --- a/src/lib/components/ui/dropdown-menu/index.ts +++ b/src/lib/components/ui/dropdown-menu/index.ts @@ -1,48 +1,50 @@ import { DropdownMenu as DropdownMenuPrimitive } from 'bits-ui'; +import CheckboxItem from './dropdown-menu-checkbox-item.svelte'; +import Content from './dropdown-menu-content.svelte'; +import GroupHeading from './dropdown-menu-group-heading.svelte'; import Item from './dropdown-menu-item.svelte'; import Label from './dropdown-menu-label.svelte'; -import Content from './dropdown-menu-content.svelte'; -import Shortcut from './dropdown-menu-shortcut.svelte'; import RadioItem from './dropdown-menu-radio-item.svelte'; import Separator from './dropdown-menu-separator.svelte'; -import RadioGroup from './dropdown-menu-radio-group.svelte'; +import Shortcut from './dropdown-menu-shortcut.svelte'; import SubContent from './dropdown-menu-sub-content.svelte'; import SubTrigger from './dropdown-menu-sub-trigger.svelte'; -import CheckboxItem from './dropdown-menu-checkbox-item.svelte'; const Sub = DropdownMenuPrimitive.Sub; const Root = DropdownMenuPrimitive.Root; const Trigger = DropdownMenuPrimitive.Trigger; const Group = DropdownMenuPrimitive.Group; +const RadioGroup = DropdownMenuPrimitive.RadioGroup; export { - Sub, - Root, - Item, - Label, - Group, - Trigger, - Content, - Shortcut, - Separator, - RadioItem, - SubContent, - SubTrigger, - RadioGroup, CheckboxItem, - // + Content, Root as DropdownMenu, - Sub as DropdownMenuSub, + CheckboxItem as DropdownMenuCheckboxItem, + Content as DropdownMenuContent, + Group as DropdownMenuGroup, + GroupHeading as DropdownMenuGroupHeading, Item as DropdownMenuItem, Label as DropdownMenuLabel, - Group as DropdownMenuGroup, - Content as DropdownMenuContent, - Trigger as DropdownMenuTrigger, - Shortcut as DropdownMenuShortcut, + RadioGroup as DropdownMenuRadioGroup, RadioItem as DropdownMenuRadioItem, Separator as DropdownMenuSeparator, - RadioGroup as DropdownMenuRadioGroup, + Shortcut as DropdownMenuShortcut, + Sub as DropdownMenuSub, SubContent as DropdownMenuSubContent, SubTrigger as DropdownMenuSubTrigger, - CheckboxItem as DropdownMenuCheckboxItem, + Trigger as DropdownMenuTrigger, + Group, + GroupHeading, + Item, + Label, + RadioGroup, + RadioItem, + Root, + Separator, + Shortcut, + Sub, + SubContent, + SubTrigger, + Trigger, }; diff --git a/src/lib/components/ui/input/index.ts b/src/lib/components/ui/input/index.ts index 1d669f9..0888f0e 100644 --- a/src/lib/components/ui/input/index.ts +++ b/src/lib/components/ui/input/index.ts @@ -1,27 +1,5 @@ import Root from './input.svelte'; -export type FormInputEvent = T & { - currentTarget: EventTarget & HTMLInputElement; -}; -export type InputEvents = { - blur: FormInputEvent; - change: FormInputEvent; - click: FormInputEvent; - focus: FormInputEvent; - focusin: FormInputEvent; - focusout: FormInputEvent; - keydown: FormInputEvent; - keypress: FormInputEvent; - keyup: FormInputEvent; - mouseover: FormInputEvent; - mouseenter: FormInputEvent; - mouseleave: FormInputEvent; - mousemove: FormInputEvent; - paste: FormInputEvent; - input: FormInputEvent; - wheel: FormInputEvent; -}; - export { Root, // diff --git a/src/lib/components/ui/input/input.svelte b/src/lib/components/ui/input/input.svelte index eaf3844..29a4ea6 100644 --- a/src/lib/components/ui/input/input.svelte +++ b/src/lib/components/ui/input/input.svelte @@ -1,42 +1,36 @@ - +{#if type === 'file'} + +{:else} + +{/if} diff --git a/src/lib/components/ui/label/label.svelte b/src/lib/components/ui/label/label.svelte index 55573a5..0500d9b 100644 --- a/src/lib/components/ui/label/label.svelte +++ b/src/lib/components/ui/label/label.svelte @@ -2,15 +2,11 @@ import { Label as LabelPrimitive } from 'bits-ui'; import { cn } from '$lib/utils.js'; - type $$Props = LabelPrimitive.Props; - - let className: $$Props['class'] = undefined; - export { className as class }; + let { ref = $bindable(null), class: className, ...restProps }: LabelPrimitive.RootProps = $props(); - - + {...restProps} +/> diff --git a/src/lib/components/ui/select/index.ts b/src/lib/components/ui/select/index.ts index d672aa6..4aa4c5f 100644 --- a/src/lib/components/ui/select/index.ts +++ b/src/lib/components/ui/select/index.ts @@ -1,34 +1,34 @@ import { Select as SelectPrimitive } from 'bits-ui'; -import Label from './select-label.svelte'; +import GroupHeading from './select-group-heading.svelte'; import Item from './select-item.svelte'; import Content from './select-content.svelte'; import Trigger from './select-trigger.svelte'; import Separator from './select-separator.svelte'; +import ScrollDownButton from './select-scroll-down-button.svelte'; +import ScrollUpButton from './select-scroll-up-button.svelte'; const Root = SelectPrimitive.Root; const Group = SelectPrimitive.Group; -const Input = SelectPrimitive.Input; -const Value = SelectPrimitive.Value; export { Root, Item, Group, - Input, - Label, - Value, + GroupHeading, Content, Trigger, Separator, + ScrollDownButton, + ScrollUpButton, // Root as Select, Item as SelectItem, Group as SelectGroup, - Input as SelectInput, - Label as SelectLabel, - Value as SelectValue, + GroupHeading as SelectGroupHeading, Content as SelectContent, Trigger as SelectTrigger, Separator as SelectSeparator, + ScrollDownButton as SelectScrollDownButton, + ScrollUpButton as SelectScrollUpButton, }; diff --git a/src/lib/components/ui/select/select-content.svelte b/src/lib/components/ui/select/select-content.svelte index c7183c4..a2feeb9 100644 --- a/src/lib/components/ui/select/select-content.svelte +++ b/src/lib/components/ui/select/select-content.svelte @@ -1,36 +1,34 @@ - -
- -
-
+ + + + + {@render children?.()} + + + + diff --git a/src/lib/components/ui/select/select-group-heading.svelte b/src/lib/components/ui/select/select-group-heading.svelte new file mode 100644 index 0000000..1f801b6 --- /dev/null +++ b/src/lib/components/ui/select/select-group-heading.svelte @@ -0,0 +1,8 @@ + + + diff --git a/src/lib/components/ui/select/select-item.svelte b/src/lib/components/ui/select/select-item.svelte index 5314c33..aad5286 100644 --- a/src/lib/components/ui/select/select-item.svelte +++ b/src/lib/components/ui/select/select-item.svelte @@ -1,37 +1,37 @@ - - - - - - - {label || value} - + {#snippet children({ selected, highlighted })} + + {#if selected} + + {/if} + + {#if childrenProp} + {@render childrenProp({ selected, highlighted })} + {:else} + {label || value} + {/if} + {/snippet} diff --git a/src/lib/components/ui/select/select-scroll-down-button.svelte b/src/lib/components/ui/select/select-scroll-down-button.svelte new file mode 100644 index 0000000..866364b --- /dev/null +++ b/src/lib/components/ui/select/select-scroll-down-button.svelte @@ -0,0 +1,11 @@ + + + + + diff --git a/src/lib/components/ui/select/select-scroll-up-button.svelte b/src/lib/components/ui/select/select-scroll-up-button.svelte new file mode 100644 index 0000000..171228c --- /dev/null +++ b/src/lib/components/ui/select/select-scroll-up-button.svelte @@ -0,0 +1,11 @@ + + + + + diff --git a/src/lib/components/ui/select/select-separator.svelte b/src/lib/components/ui/select/select-separator.svelte index 743a5ab..f4af89d 100644 --- a/src/lib/components/ui/select/select-separator.svelte +++ b/src/lib/components/ui/select/select-separator.svelte @@ -1,11 +1,9 @@ - + diff --git a/src/lib/components/ui/select/select-trigger.svelte b/src/lib/components/ui/select/select-trigger.svelte index bbc4722..ba3a768 100644 --- a/src/lib/components/ui/select/select-trigger.svelte +++ b/src/lib/components/ui/select/select-trigger.svelte @@ -1,24 +1,19 @@ span]:line-clamp-1 data-[placeholder]:[&>span]:text-muted-foreground', + 'flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[placeholder]:text-muted-foreground [&>span]:line-clamp-1', className, )} - {...$$restProps} + {...restProps} > - -
- -
+ {@render children?.()} +
diff --git a/src/lib/components/ui/separator/index.ts b/src/lib/components/ui/separator/index.ts new file mode 100644 index 0000000..56b2767 --- /dev/null +++ b/src/lib/components/ui/separator/index.ts @@ -0,0 +1,7 @@ +import Root from './separator.svelte'; + +export { + Root, + // + Root as Separator, +}; diff --git a/src/lib/components/ui/separator/separator.svelte b/src/lib/components/ui/separator/separator.svelte new file mode 100644 index 0000000..52d7e39 --- /dev/null +++ b/src/lib/components/ui/separator/separator.svelte @@ -0,0 +1,13 @@ + + + diff --git a/src/lib/components/ui/sheet/index.ts b/src/lib/components/ui/sheet/index.ts index ffd7444..36744d2 100644 --- a/src/lib/components/ui/sheet/index.ts +++ b/src/lib/components/ui/sheet/index.ts @@ -1,7 +1,5 @@ import { Dialog as SheetPrimitive } from 'bits-ui'; -import { type VariantProps, tv } from 'tailwind-variants'; -import Portal from './sheet-portal.svelte'; import Overlay from './sheet-overlay.svelte'; import Content from './sheet-content.svelte'; import Header from './sheet-header.svelte'; @@ -12,6 +10,7 @@ import Description from './sheet-description.svelte'; const Root = SheetPrimitive.Root; const Close = SheetPrimitive.Close; const Trigger = SheetPrimitive.Trigger; +const Portal = SheetPrimitive.Portal; export { Root, @@ -36,71 +35,3 @@ export { Title as SheetTitle, Description as SheetDescription, }; - -export const sheetVariants = tv({ - base: 'bg-background fixed z-50 gap-4 p-6 shadow-lg', - variants: { - side: { - top: 'inset-x-0 top-0 border-b ', - bottom: 'inset-x-0 bottom-0 border-t', - left: 'inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm', - right: 'inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm', - }, - }, - defaultVariants: { - side: 'right', - }, -}); - -export const sheetTransitions = { - top: { - in: { - y: '-100%', - duration: 500, - opacity: 1, - }, - out: { - y: '-100%', - duration: 300, - opacity: 1, - }, - }, - bottom: { - in: { - y: '100%', - duration: 500, - opacity: 1, - }, - out: { - y: '100%', - duration: 300, - opacity: 1, - }, - }, - left: { - in: { - x: '-100%', - duration: 500, - opacity: 1, - }, - out: { - x: '-100%', - duration: 300, - opacity: 1, - }, - }, - right: { - in: { - x: '100%', - duration: 500, - opacity: 1, - }, - out: { - x: '100%', - duration: 300, - opacity: 1, - }, - }, -}; - -export type Side = VariantProps['side']; diff --git a/src/lib/components/ui/sheet/sheet-content.svelte b/src/lib/components/ui/sheet/sheet-content.svelte index 4075dd6..cffc4d5 100644 --- a/src/lib/components/ui/sheet/sheet-content.svelte +++ b/src/lib/components/ui/sheet/sheet-content.svelte @@ -1,39 +1,54 @@ - - + + + - - + + {@render children?.()} - + Close - + diff --git a/src/lib/components/ui/sheet/sheet-description.svelte b/src/lib/components/ui/sheet/sheet-description.svelte index 99ed1b9..316e1de 100644 --- a/src/lib/components/ui/sheet/sheet-description.svelte +++ b/src/lib/components/ui/sheet/sheet-description.svelte @@ -2,12 +2,7 @@ import { Dialog as SheetPrimitive } from 'bits-ui'; import { cn } from '$lib/utils.js'; - type $$Props = SheetPrimitive.DescriptionProps; - - let className: $$Props['class'] = undefined; - export { className as class }; + let { ref = $bindable(null), class: className, ...restProps }: SheetPrimitive.DescriptionProps = $props(); - - - + diff --git a/src/lib/components/ui/sheet/sheet-footer.svelte b/src/lib/components/ui/sheet/sheet-footer.svelte index c625327..9807551 100644 --- a/src/lib/components/ui/sheet/sheet-footer.svelte +++ b/src/lib/components/ui/sheet/sheet-footer.svelte @@ -1,13 +1,11 @@ -
- +
+ {@render children?.()}
diff --git a/src/lib/components/ui/sheet/sheet-header.svelte b/src/lib/components/ui/sheet/sheet-header.svelte index ac2ca13..f504415 100644 --- a/src/lib/components/ui/sheet/sheet-header.svelte +++ b/src/lib/components/ui/sheet/sheet-header.svelte @@ -1,13 +1,11 @@ -
- +
+ {@render children?.()}
diff --git a/src/lib/components/ui/sheet/sheet-overlay.svelte b/src/lib/components/ui/sheet/sheet-overlay.svelte index 4aa6d29..4c195f3 100644 --- a/src/lib/components/ui/sheet/sheet-overlay.svelte +++ b/src/lib/components/ui/sheet/sheet-overlay.svelte @@ -1,21 +1,15 @@ diff --git a/src/lib/components/ui/sheet/sheet-title.svelte b/src/lib/components/ui/sheet/sheet-title.svelte index 11267e6..844f367 100644 --- a/src/lib/components/ui/sheet/sheet-title.svelte +++ b/src/lib/components/ui/sheet/sheet-title.svelte @@ -2,12 +2,7 @@ import { Dialog as SheetPrimitive } from 'bits-ui'; import { cn } from '$lib/utils.js'; - type $$Props = SheetPrimitive.TitleProps; - - let className: $$Props['class'] = undefined; - export { className as class }; + let { ref = $bindable(null), class: className, ...restProps }: SheetPrimitive.TitleProps = $props(); - - - + diff --git a/src/lib/components/ui/tooltip/index.ts b/src/lib/components/ui/tooltip/index.ts index 7e883a8..9e66d3a 100644 --- a/src/lib/components/ui/tooltip/index.ts +++ b/src/lib/components/ui/tooltip/index.ts @@ -3,13 +3,16 @@ import Content from './tooltip-content.svelte'; const Root = TooltipPrimitive.Root; const Trigger = TooltipPrimitive.Trigger; +const Provider = TooltipPrimitive.Provider; export { Root, Trigger, Content, + Provider, // Root as Tooltip, Content as TooltipContent, Trigger as TooltipTrigger, + Provider as TooltipProvider, }; diff --git a/src/lib/components/ui/tooltip/tooltip-content.svelte b/src/lib/components/ui/tooltip/tooltip-content.svelte index d4b55a7..accf202 100644 --- a/src/lib/components/ui/tooltip/tooltip-content.svelte +++ b/src/lib/components/ui/tooltip/tooltip-content.svelte @@ -1,25 +1,16 @@ - - + class={cn( + 'z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2', + className, + )} + {...restProps} +/> diff --git a/src/lib/components/user.svelte b/src/lib/components/user.svelte index 37d6559..0a883b6 100644 --- a/src/lib/components/user.svelte +++ b/src/lib/components/user.svelte @@ -18,13 +18,15 @@

{data.user.username}

- - - - - -

Account Settings

-
-
+ + + + + + +

Account Settings

+
+
+
{/if} diff --git a/src/lib/utils.ts b/src/lib/utils.ts index c41f31e..9ad0df4 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -1,53 +1,6 @@ import { type ClassValue, clsx } from 'clsx'; -import { cubicOut } from 'svelte/easing'; -import type { TransitionConfig } from 'svelte/transition'; import { twMerge } from 'tailwind-merge'; export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); } - -type FlyAndScaleParams = { - y?: number; - x?: number; - start?: number; - duration?: number; -}; - -export const flyAndScale = (node: Element, params: FlyAndScaleParams = { y: -8, x: 0, start: 0.95, duration: 150 }): TransitionConfig => { - const style = getComputedStyle(node); - const transform = style.transform === 'none' ? '' : style.transform; - - const scaleConversion = (valueA: number, scaleA: [number, number], scaleB: [number, number]) => { - const [minA, maxA] = scaleA; - const [minB, maxB] = scaleB; - - const percentage = (valueA - minA) / (maxA - minA); - const valueB = percentage * (maxB - minB) + minB; - - return valueB; - }; - - const styleToString = (style: Record): string => { - return Object.keys(style).reduce((str, key) => { - if (style[key] === undefined) return str; - return str + `${key}:${style[key]};`; - }, ''); - }; - - return { - duration: params.duration ?? 200, - delay: 0, - css: (t) => { - const y = scaleConversion(t, [0, 1], [params.y ?? 5, 0]); - const x = scaleConversion(t, [0, 1], [params.x ?? 0, 0]); - const scale = scaleConversion(t, [0, 1], [params.start ?? 0.95, 1]); - - return styleToString({ - transform: `${transform} translate3d(${x}px, ${y}px, 0) scale(${scale})`, - opacity: t, - }); - }, - easing: cubicOut, - }; -}; diff --git a/src/routes/(main)/channel/[channel]/+page.svelte b/src/routes/(main)/channel/[channel]/+page.svelte index 3257a5e..db81cc6 100644 --- a/src/routes/(main)/channel/[channel]/+page.svelte +++ b/src/routes/(main)/channel/[channel]/+page.svelte @@ -20,7 +20,14 @@ const channel: string = $derived(page.params.channel); let textareaRef: HTMLTextAreaElement | undefined = $state(); let formref: HTMLFormElement | undefined = $state(); - let contextMenus: boolean[] = $state([]); + let contextMenus: boolean[] = $state(Array(data.messages.length).fill(false)); + + $effect(() => { + const totalMessages = (socket?.messages?.length || 0) + data.messages.length; + if (contextMenus.length !== totalMessages) { + contextMenus = Array(totalMessages).fill(false); + } + }); function askNotificationPermission() { // Check if the browser supports notifications @@ -84,19 +91,21 @@
{#if data.messages.length != 0 || socket?.messages.length != 0}
- - {#each [...(socket?.messages ?? []), ...data.messages] as message, i} - - {/each} + {#if contextMenus.length === (socket?.messages?.length || 0) + data.messages.length} + + {#each [...(socket?.messages ?? []), ...data.messages] as message, i} + + {/each} + {/if}
{:else} @@ -112,13 +121,15 @@ shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50" > - - - - - -

Send

-
-
+ + + + + + +

Send

+
+
+
diff --git a/tailwind.config.ts b/tailwind.config.ts index f2ec7f9..4e96cd4 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -1,6 +1,6 @@ import { fontFamily } from 'tailwindcss/defaultTheme'; import type { Config } from 'tailwindcss'; -import typography from '@tailwindcss/typography'; +import tailwindcssAnimate from 'tailwindcss-animate'; const config: Config = { darkMode: ['class'], @@ -49,31 +49,48 @@ const config: Config = { DEFAULT: 'hsl(var(--card) / )', foreground: 'hsl(var(--card-foreground) / )', }, + sidebar: { + DEFAULT: 'hsl(var(--sidebar-background))', + foreground: 'hsl(var(--sidebar-foreground))', + primary: 'hsl(var(--sidebar-primary))', + 'primary-foreground': 'hsl(var(--sidebar-primary-foreground))', + accent: 'hsl(var(--sidebar-accent))', + 'accent-foreground': 'hsl(var(--sidebar-accent-foreground))', + border: 'hsl(var(--sidebar-border))', + ring: 'hsl(var(--sidebar-ring))', + }, }, borderRadius: { + xl: 'calc(var(--radius) + 4px)', lg: 'var(--radius)', md: 'calc(var(--radius) - 2px)', - 'background-color': '#22272E', sm: 'calc(var(--radius) - 4px)', }, fontFamily: { sans: [...fontFamily.sans], }, - typography: () => ({ - DEFAULT: { - css: { - pre: { - 'background-color': '#22272E', - code: { - 'background-color': '#22272E', - }, - }, - }, + keyframes: { + 'accordion-down': { + from: { height: '0' }, + to: { height: 'var(--bits-accordion-content-height)' }, }, - }), + 'accordion-up': { + from: { height: 'var(--bits-accordion-content-height)' }, + to: { height: '0' }, + }, + 'caret-blink': { + '0%,70%,100%': { opacity: '1' }, + '20%,50%': { opacity: '0' }, + }, + }, + animation: { + 'accordion-down': 'accordion-down 0.2s ease-out', + 'accordion-up': 'accordion-up 0.2s ease-out', + 'caret-blink': 'caret-blink 1.25s ease-out infinite', + }, }, }, - plugins: [typography], + plugins: [tailwindcssAnimate], }; export default config;