From 579e6c7724779190630c5c03b757ff2bb40a18fd Mon Sep 17 00:00:00 2001 From: WarningImHack3r <43064022+WarningImHack3r@users.noreply.github.com> Date: Thu, 16 Jan 2025 23:32:03 +0100 Subject: [PATCH 1/8] Update shadcn-svelte config --- components.json | 10 +++++--- package.json | 1 + pnpm-lock.yaml | 12 ++++++++++ src/app.pcss | 2 ++ src/lib/utils.ts | 58 +--------------------------------------------- tailwind.config.ts | 39 +++++++++++++++++++++++++++---- 6 files changed, 58 insertions(+), 64 deletions(-) diff --git a/components.json b/components.json index 8250277..ac2f0ef 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": "default", "tailwind": { "config": "tailwind.config.ts", @@ -8,6 +8,10 @@ }, "aliases": { "components": "$lib/components", - "utils": "$lib/utils" - } + "utils": "$lib/utils", + "ui": "$lib/components/ui", + "hooks": "$lib/hooks" + }, + "typescript": true, + "registry": "https://next.shadcn-svelte.com/registry" } diff --git a/package.json b/package.json index 15bbc50..0f328a5 100644 --- a/package.json +++ b/package.json @@ -50,6 +50,7 @@ "tailwind-variants": "^0.3.0", "tailwindcss": "^3.4.17", "tailwindcss-3d": "^1.0.7", + "tailwindcss-animate": "^1.0.7", "tslib": "^2.8.1", "typescript": "^5.7.3", "typescript-eslint": "^8.20.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f629357..63b9570 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -107,6 +107,9 @@ importers: tailwindcss-3d: specifier: ^1.0.7 version: 1.0.7(tailwindcss@3.4.17) + tailwindcss-animate: + specifier: ^1.0.7 + version: 1.0.7(tailwindcss@3.4.17) tslib: specifier: ^2.8.1 version: 2.8.1 @@ -2297,6 +2300,11 @@ packages: peerDependencies: tailwindcss: '>=3.2.0' + tailwindcss-animate@1.0.7: + resolution: {integrity: sha512-bl6mpH3T7I3UFxuvDEXLxy/VuFxBk5bbzplh7tXI68mwMokNYd1t9qPBHlnyTwfa4JGC4zP516I1hYYtQ/vspA==} + peerDependencies: + tailwindcss: '>=3.0.0 || insiders' + tailwindcss@3.4.17: resolution: {integrity: sha512-w33E2aCvSDP0tW9RZuNXadXlkHXqFzSkQew/aIa2i/Sj8fThxwovwlXHSPXTbAHwEIhBFXAedUhP2tueAKP8Og==} engines: {node: '>=14.0.0'} @@ -4601,6 +4609,10 @@ snapshots: lodash: 4.17.21 tailwindcss: 3.4.17 + tailwindcss-animate@1.0.7(tailwindcss@3.4.17): + dependencies: + tailwindcss: 3.4.17 + tailwindcss@3.4.17: dependencies: '@alloc/quick-lru': 5.2.0 diff --git a/src/app.pcss b/src/app.pcss index a961af6..20feda1 100644 --- a/src/app.pcss +++ b/src/app.pcss @@ -25,6 +25,7 @@ --ring: 142.1 76.2% 36.3%; --radius: 0.5rem; } + .dark { --background: 20 14.3% 4.1%; --foreground: 0 0% 95%; @@ -56,6 +57,7 @@ * { @apply border-border; } + body { @apply bg-background text-foreground; } diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 230a1fb..ac680b3 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -1,62 +1,6 @@ import { type ClassValue, clsx } from "clsx"; import { twMerge } from "tailwind-merge"; -import { cubicOut } from "svelte/easing"; -import type { TransitionConfig } from "svelte/transition"; export function cn(...inputs: ClassValue[]) { - return twMerge(clsx(inputs)); + 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 - }; -}; \ No newline at end of file diff --git a/tailwind.config.ts b/tailwind.config.ts index 08b00bc..8825ade 100644 --- a/tailwind.config.ts +++ b/tailwind.config.ts @@ -1,6 +1,7 @@ import type { Config } from "tailwindcss"; -import { fontFamily, screens } from "tailwindcss/defaultTheme"; +import defaultTheme from "tailwindcss/defaultTheme"; import tailwindCss3d from "tailwindcss-3d"; +import tailwindcssAnimate from "tailwindcss-animate"; export default { darkMode: ["class"], @@ -16,7 +17,7 @@ export default { }, screens: { xs: "475px", - ...screens + ...defaultTheme.screens }, extend: { colors: { @@ -52,19 +53,49 @@ export default { card: { 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)", sm: "calc(var(--radius) - 4px)" }, fontFamily: { - sans: [...fontFamily.sans] + sans: [...defaultTheme.fontFamily.sans] + }, + 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: [tailwindCss3d], + plugins: [tailwindcssAnimate, tailwindCss3d], future: { hoverOnlyWhenSupported: true } From 82e47e017eaba4354956dfb85db9f66e06dea7f7 Mon Sep 17 00:00:00 2001 From: WarningImHack3r <43064022+WarningImHack3r@users.noreply.github.com> Date: Thu, 16 Jan 2025 23:35:17 +0100 Subject: [PATCH 2/8] Finish shadcn-svelte upgrade --- package.json | 4 +- pnpm-lock.yaml | 212 ++++++------------ .../alert-dialog/alert-dialog-action.svelte | 20 +- .../alert-dialog/alert-dialog-cancel.svelte | 20 +- .../alert-dialog/alert-dialog-content.svelte | 38 ++-- .../alert-dialog-description.svelte | 16 +- .../alert-dialog/alert-dialog-footer.svelte | 16 +- .../alert-dialog/alert-dialog-header.svelte | 19 +- .../alert-dialog/alert-dialog-overlay.svelte | 24 +- .../ui/alert-dialog/alert-dialog-title.svelte | 20 +- src/lib/components/ui/alert-dialog/index.ts | 3 +- src/lib/components/ui/button/button.svelte | 89 ++++++-- src/lib/components/ui/button/index.ts | 52 +---- .../components/ui/card/card-content.svelte | 15 +- .../ui/card/card-description.svelte | 15 +- src/lib/components/ui/card/card-footer.svelte | 15 +- src/lib/components/ui/card/card-header.svelte | 15 +- src/lib/components/ui/card/card-title.svelte | 32 +-- src/lib/components/ui/card/card.svelte | 16 +- src/lib/components/ui/card/index.ts | 2 - .../components/ui/checkbox/checkbox.svelte | 42 ++-- .../ui/command/command-dialog.svelte | 38 ++-- .../ui/command/command-empty.svelte | 14 +- .../ui/command/command-group.svelte | 31 ++- .../ui/command/command-input.svelte | 22 +- .../components/ui/command/command-item.svelte | 25 +-- .../ui/command/command-link-item.svelte | 19 ++ .../components/ui/command/command-list.svelte | 17 +- .../ui/command/command-separator.svelte | 12 +- .../ui/command/command-shortcut.svelte | 16 +- src/lib/components/ui/command/command.svelte | 21 +- src/lib/components/ui/command/index.ts | 5 +- .../ui/dialog/dialog-content.svelte | 38 ++-- .../ui/dialog/dialog-description.svelte | 16 +- .../components/ui/dialog/dialog-footer.svelte | 16 +- .../components/ui/dialog/dialog-header.svelte | 19 +- .../ui/dialog/dialog-overlay.svelte | 24 +- .../components/ui/dialog/dialog-title.svelte | 16 +- src/lib/components/ui/dialog/index.ts | 2 +- .../dropdown-menu-checkbox-item.svelte | 47 ++-- .../dropdown-menu-content.svelte | 43 ++-- .../dropdown-menu-group-heading.svelte | 19 ++ .../dropdown-menu/dropdown-menu-item.svelte | 32 +-- .../dropdown-menu/dropdown-menu-label.svelte | 26 ++- .../dropdown-menu-radio-item.svelte | 39 ++-- .../dropdown-menu-separator.svelte | 12 +- .../dropdown-menu-shortcut.svelte | 19 +- .../dropdown-menu-sub-content.svelte | 29 +-- .../dropdown-menu-sub-trigger.svelte | 30 ++- src/lib/components/ui/dropdown-menu/index.ts | 52 ++--- src/lib/components/ui/input/index.ts | 22 -- src/lib/components/ui/input/input.svelte | 40 +--- src/lib/components/ui/label/label.svelte | 18 +- .../ui/pagination/pagination-content.svelte | 15 +- .../ui/pagination/pagination-ellipsis.svelte | 19 +- .../ui/pagination/pagination-item.svelte | 17 +- .../ui/pagination/pagination-link.svelte | 36 +-- .../pagination/pagination-next-button.svelte | 44 ++-- .../pagination/pagination-prev-button.svelte | 44 ++-- .../ui/pagination/pagination.svelte | 34 ++- .../ui/popover/popover-content.svelte | 40 ++-- .../components/ui/separator/separator.svelte | 16 +- .../components/ui/skeleton/skeleton.svelte | 16 +- src/lib/components/ui/slider/slider.svelte | 43 ++-- src/lib/components/ui/sonner/sonner.svelte | 4 +- src/lib/components/ui/table/table-body.svelte | 15 +- .../components/ui/table/table-caption.svelte | 15 +- src/lib/components/ui/table/table-cell.svelte | 18 +- .../components/ui/table/table-footer.svelte | 15 +- src/lib/components/ui/table/table-head.svelte | 16 +- .../components/ui/table/table-header.svelte | 16 +- src/lib/components/ui/table/table-row.svelte | 20 +- src/lib/components/ui/table/table.svelte | 15 +- .../components/ui/tabs/tabs-content.svelte | 18 +- src/lib/components/ui/tabs/tabs-list.svelte | 16 +- .../components/ui/tabs/tabs-trigger.svelte | 20 +- src/lib/components/ui/tooltip/index.ts | 3 + .../ui/tooltip/tooltip-content.svelte | 29 +-- 78 files changed, 1014 insertions(+), 994 deletions(-) create mode 100644 src/lib/components/ui/command/command-link-item.svelte create mode 100644 src/lib/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte diff --git a/package.json b/package.json index 0f328a5..ba2ddf9 100644 --- a/package.json +++ b/package.json @@ -25,9 +25,8 @@ "@unovis/svelte": "^1.5.0", "@vercel/speed-insights": "^1.1.0", "autoprefixer": "^10.4.20", - "bits-ui": "^0.22.0", + "bits-ui": "1.0.0-next.77", "clsx": "^2.1.1", - "cmdk-sv": "^0.0.18", "eslint": "^9.18.0", "eslint-config-prettier": "^10.0.1", "eslint-plugin-svelte": "^2.46.1", @@ -44,7 +43,6 @@ "svelte": "^5.18.0", "svelte-check": "^4.1.4", "svelte-dnd-action": "^0.9.54", - "svelte-headless-table": "^0.18.3", "svelte-sonner": "^0.3.28", "tailwind-merge": "^2.6.0", "tailwind-variants": "^0.3.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 63b9570..b43fe4f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -33,14 +33,11 @@ importers: specifier: ^10.4.20 version: 10.4.20(postcss@8.5.1) bits-ui: - specifier: ^0.22.0 - version: 0.22.0(svelte@5.18.0) + specifier: 1.0.0-next.77 + version: 1.0.0-next.77(svelte@5.18.0) clsx: specifier: ^2.1.1 version: 2.1.1 - cmdk-sv: - specifier: ^0.0.18 - version: 0.0.18(svelte@5.18.0) eslint: specifier: ^9.18.0 version: 9.18.0(jiti@1.21.6) @@ -89,9 +86,6 @@ importers: svelte-dnd-action: specifier: ^0.9.54 version: 0.9.54(svelte@5.18.0) - svelte-headless-table: - specifier: ^0.18.3 - version: 0.18.3(svelte@5.18.0) svelte-sonner: specifier: ^0.3.28 version: 0.3.28(svelte@5.18.0) @@ -382,14 +376,14 @@ packages: resolution: {integrity: sha512-lB05FkqEdUg2AA0xEbUz0SnkXT1LcCTa438W4IWTUh4hdOnVbQyOJ81OrDXsJk/LSiJHubgGEFoR5EHq1NsH1A==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@floating-ui/core@1.5.1': - resolution: {integrity: sha512-QgcKYwzcc8vvZ4n/5uklchy8KVdjJwcOeI+HnnTNclJjs2nYsy23DOCf+sSV1kBwD9yDAoVKCkv/gEPzgQU3Pw==} + '@floating-ui/core@1.6.9': + resolution: {integrity: sha512-uMXCuQ3BItDUbAMhIXw7UPXRfAlOAvZzdK9BWpE60MCn+Svt3aLn9jsPTi/WNGlRUu2uI0v5S7JiIUsbsvh3fw==} - '@floating-ui/dom@1.5.3': - resolution: {integrity: sha512-ClAbQnEqJAKCJOEbbLo5IUlZHkNszqhuxS4fHAVxRPXPya6Ysf2G8KypnYcOTpx6I8xcgF9bbHb6g/2KpbV8qA==} + '@floating-ui/dom@1.6.13': + resolution: {integrity: sha512-umqzocjDgNRGTuO7Q8CU32dkHkECqI8ZdMZ5Swb6QAM0t5rnlrN3lGo1hdpscRd3WS8T6DKYK4ephgIH9iRh3w==} - '@floating-ui/utils@0.1.6': - resolution: {integrity: sha512-OfX7E2oUDYxtBvsuS4e/jSn4Q9Qb6DzgeYtsAdkPZ47znpoNsMgZw0+tVijiv3uGNR6dgNlty6r9rzIzHjtd/A==} + '@floating-ui/utils@0.2.9': + resolution: {integrity: sha512-MDWhGtE+eHw5JW7lq4qhc5yRLS11ERl1c7Z6Xd0a58DozHES6EnNNwUWbMiG4J9Cgj053Bhk8zvlhFYKVhULwg==} '@humanfs/core@0.19.1': resolution: {integrity: sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==} @@ -411,8 +405,8 @@ packages: resolution: {integrity: sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==} engines: {node: '>=18.18'} - '@internationalized/date@3.5.1': - resolution: {integrity: sha512-LUQIfwU9e+Fmutc/DpRTGXSdgYZLBegi4wygCWDSVmUdLTaMHsQyASDiJtREwanwKuQLq0hY76fCJ9J/9I2xOQ==} + '@internationalized/date@3.7.0': + resolution: {integrity: sha512-VJ5WS3fcVx0bejE/YHfbDKR/yawZgKqn/if+oEeLqNwBtPzVB06olkfcnojTmEMX+gTpH+FlQ69SHNitJ8/erQ==} '@isaacs/cliui@8.0.2': resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} @@ -483,11 +477,6 @@ packages: resolution: {integrity: sha512-Es6WcD0nO5l+2BOQS4uLfNPYQaNDfbot3X1XUoloz+x0mPDS3eeORZJl06HXjwBG1fOGwCRnzK88LMdxKRrd6Q==} engines: {node: '>=6.0.0'} - '@melt-ui/svelte@0.76.2': - resolution: {integrity: sha512-7SbOa11tXUS95T3fReL+dwDs5FyJtCEqrqG3inRziDws346SYLsxOQ6HmX+4BkIsQh1R8U3XNa+EMmdMt38lMA==} - peerDependencies: - svelte: '>=3 <5' - '@neoconfetti/svelte@2.2.1': resolution: {integrity: sha512-2Ts0Rxaf6clW2qG+AKhTwpl01AAyZEAe03XeuQ7Vp+qYIaM3ycuI94j546fmEkUxwACwGI3Zl2cZ/pncTuNcJg==} @@ -631,9 +620,6 @@ packages: '@swc/helpers@0.5.12': resolution: {integrity: sha512-KMZNXiGibsW9kvZAO1Pam2JPTDBm+KSHMMHWdsyI/1DbIZjT2A6Gy3hblVXUMEDvUAKq+e0vL0X0o54owWji7g==} - '@swc/helpers@0.5.8': - resolution: {integrity: sha512-lruDGw3pnfM3wmZHeW7JuhkGQaJjPyiKjxeGhdmfoOT53Ic9qb5JLDNaK2HUdl1zLDeX28H221UvKjfdvSLVMg==} - '@total-typescript/ts-reset@0.6.1': resolution: {integrity: sha512-cka47fVSo6lfQDIATYqb/vO1nvFfbPw7uWLayIXIhGETj0wcOOlrlkobOMDNQOFr9QOafegUPq13V2+6vtD7yg==} @@ -982,15 +968,11 @@ packages: bindings@1.5.0: resolution: {integrity: sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==} - bits-ui@0.21.16: - resolution: {integrity: sha512-XFZ7/bK7j/K+5iktxX/ZpmoFHjYjpPzP5EOO/4bWiaFg5TG1iMcfjDhlBTQnJxD6BoVoHuqeZPHZvaTgF4Iv3Q==} - peerDependencies: - svelte: ^4.0.0 || ^5.0.0-next.118 - - bits-ui@0.22.0: - resolution: {integrity: sha512-r7Fw1HNgA4YxZBRcozl7oP0bheQ8EHh+kfMBZJgyFISix8t4p/nqDcHLmBgIiJ3T5XjYnJRorYDjIWaCfhb5fw==} + bits-ui@1.0.0-next.77: + resolution: {integrity: sha512-IV0AyVEvsRkXv4s/fl4iea5E9W2b9EBf98s9mRMKMc1xHxM9MmtM2r6MZMqftHQ/c+gHTIt3A9EKuTlh7uay8w==} + engines: {node: '>=18', pnpm: '>=8.7.0'} peerDependencies: - svelte: ^4.0.0 || ^5.0.0 + svelte: ^5.11.0 brace-expansion@1.1.11: resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} @@ -1042,11 +1024,6 @@ packages: resolution: {integrity: sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==} engines: {node: '>=6'} - cmdk-sv@0.0.18: - resolution: {integrity: sha512-istixiQSy9Ez/mQ4VXWB69btqNyDZckbd1XFEwR46Vw+n5zjdmvoWAcOTj0uX3FZXtw9ikwLVmfoW2nwwMClRg==} - peerDependencies: - svelte: ^4.0.0 || ^5.0.0-next.1 - color-convert@1.9.3: resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} @@ -1282,10 +1259,6 @@ packages: delaunator@5.0.1: resolution: {integrity: sha512-8nvh+XBe96aCESrGOqMp/84b13H9cdKbG5P2ejQCh4d4sK9RL4371qou9drQjMhvnPmhWl5hnmqbEE0fXr9Xnw==} - dequal@2.0.3: - resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==} - engines: {node: '>=6'} - detect-libc@2.0.2: resolution: {integrity: sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==} engines: {node: '>=8'} @@ -1467,9 +1440,6 @@ packages: flatted@3.2.9: resolution: {integrity: sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==} - focus-trap@7.5.4: - resolution: {integrity: sha512-N7kHdlgsO/v+iD/dMoJKtsSqs5Dz/dXZVebRgJw23LDk+jMi/974zyiOYDziY2JPp8xivq9BmUGwIJMiuSBi7w==} - foreground-child@3.3.0: resolution: {integrity: sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==} engines: {node: '>=14'} @@ -1595,6 +1565,9 @@ packages: ini@1.3.8: resolution: {integrity: sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==} + inline-style-parser@0.2.4: + resolution: {integrity: sha512-0aO8FkhNZlj/ZIbNi7Lxxr12obT7cL1moPfE4tg1LkX7LlLfC6DeX4l2ZEud1ukP9jNQyNnfzQVqwbwmAATY4Q==} + internmap@1.0.1: resolution: {integrity: sha512-lDB5YccMydFBtasVtxnZ3MRBHuaoE8GKsppq+EchKL2U4nK/DmEpPHNH8MZe5HkMtpSiTSOZwfN0tzYjO/lJEw==} @@ -1793,16 +1766,6 @@ packages: engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true - nanoid@5.0.6: - resolution: {integrity: sha512-rRq0eMHoGZxlvaFOUdK1Ev83Bd1IgzzR+WJ3IbDJ7QOSdAxYjlurSPqFs9s4lJg29RT6nPwizFtJhQS6V5xgiA==} - engines: {node: ^18 || >=20} - hasBin: true - - nanoid@5.0.7: - resolution: {integrity: sha512-oLxFY2gd2IqnjcYyOXD8XGCftpGtZP2AbHbOkthDkvRywH5ayNtPVy9YlOPcHckXzbLTCHpkb7FB+yuxKV13pQ==} - engines: {node: ^18 || >=20} - hasBin: true - natural-compare@1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} @@ -2144,6 +2107,16 @@ packages: run-parallel@1.2.0: resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} + runed@0.20.0: + resolution: {integrity: sha512-YqPxaUdWL5nUXuSF+/v8a+NkVN8TGyEGbQwTA25fLY35MR/2bvZ1c6sCbudoo1kT4CAJPh4kUkcgGVxW127WKw==} + peerDependencies: + svelte: ^5.7.0 + + runed@0.22.0: + resolution: {integrity: sha512-ZWVXWhOr0P5xdNgtviz6D1ivLUDWKLCbeC5SUEJ3zBkqLReVqWHenFxMNFeFaiC5bfxhFxyxzyzB+98uYFtwdA==} + peerDependencies: + svelte: ^5.7.0 + rw@1.3.3: resolution: {integrity: sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ==} @@ -2209,6 +2182,9 @@ packages: striptags@3.2.0: resolution: {integrity: sha512-g45ZOGzHDMe2bdYMdIvdAfCQkCTDMGBazSw1ypMowwGIee7ZQ5dU0rBJ8Jqgl+jAKIv4dbeE1jscZq9wid1Tkw==} + style-to-object@1.0.8: + resolution: {integrity: sha512-xT47I/Eo0rwJmaXC4oilDGDWLohVhR6o/xAQcPQN8q6QBuZVL8qMYL85kLmST5cPjAorwvqIA4qXTRQoYHaL6g==} + stylis@4.2.0: resolution: {integrity: sha512-Orov6g6BB1sDfYgzWfTHDOxamtX1bE/zo104Dh9e6fqJ3PooipYyfJ0pUmrZO2wAvO8YbEyeFrkV91XTsGMSrw==} @@ -2254,38 +2230,21 @@ packages: svelte: optional: true - svelte-headless-table@0.18.3: - resolution: {integrity: sha512-1zVnqXW0dvn6ZceYa94k+ziK+w5Dj9nlWYTQGXBv2JhM0resj9w7CWpclZK1TJwAALfEeH4InPBPO87L5fr+nQ==} - peerDependencies: - svelte: ^4.0.0 - - svelte-keyed@2.0.0: - resolution: {integrity: sha512-7TeEn+QbJC2OJrHiuM0T8vMBkms3DNpTE+Ir+NtnVBnBMA78aL4f1ft9t0Hn/pBbD/TnIXi4YfjFRAgtN+DZ5g==} - peerDependencies: - svelte: ^4.0.0 - - svelte-render@2.0.1: - resolution: {integrity: sha512-RpB0SurwXm4xhjvHHtjeqMmvd645FURb79GFOotScOSqnKK5vpqBgoBPGC0pp+E/eZgDSQ9rRAdn/+N4ys1mXQ==} - peerDependencies: - svelte: ^4.0.0 - svelte-sonner@0.3.28: resolution: {integrity: sha512-K3AmlySeFifF/cKgsYNv5uXqMVNln0NBAacOYgmkQStLa/UoU0LhfAACU6Gr+YYC8bOCHdVmFNoKuDbMEsppJg==} peerDependencies: svelte: ^3.0.0 || ^4.0.0 || ^5.0.0-next.1 - svelte-subscribe@2.0.1: - resolution: {integrity: sha512-eKXIjLxB4C7eQWPqKEdxcGfNXm2g/qJ67zmEZK/GigCZMfrTR3m7DPY93R6MX+5uoqM1FRYxl8LZ1oy4URWi2A==} + svelte-toolbelt@0.7.0: + resolution: {integrity: sha512-i/Tv4NwAWWqJnK5H0F8y/ubDnogDYlwwyzKhrspTUFzrFuGnYshqd2g4/R43ds841wmaFiSW/HsdsdWhPOlrAA==} + engines: {node: '>=18', pnpm: '>=8.7.0'} peerDependencies: - svelte: ^4.0.0 + svelte: ^5.0.0 svelte@5.18.0: resolution: {integrity: sha512-/Eb81lB8bVUxQPmkPVNBYrU9cZ544+9hE91ZUUXTMf7eWcGW84N1hS3gvv/XsUNOWLLg3IicXP2qa8W3KpTUHA==} engines: {node: '>=18'} - tabbable@6.2.0: - resolution: {integrity: sha512-Cat63mxsVJlzYvN51JmVXIgNoUokrIaT2zLclCXjRd8boZ0004U4KCs/sToJ75C6sdlByWxpYnb5Boif1VSFew==} - tailwind-merge@2.6.0: resolution: {integrity: sha512-P+Vu1qXfzediirmHOC3xKGAYeZtPcV9g76X+xg2FD4tYgR71ewMA35Y3sCz3zhiN/dwefRpJX0yBcgwi1fXNQA==} @@ -2705,16 +2664,16 @@ snapshots: '@eslint/core': 0.10.0 levn: 0.4.1 - '@floating-ui/core@1.5.1': + '@floating-ui/core@1.6.9': dependencies: - '@floating-ui/utils': 0.1.6 + '@floating-ui/utils': 0.2.9 - '@floating-ui/dom@1.5.3': + '@floating-ui/dom@1.6.13': dependencies: - '@floating-ui/core': 1.5.1 - '@floating-ui/utils': 0.1.6 + '@floating-ui/core': 1.6.9 + '@floating-ui/utils': 0.2.9 - '@floating-ui/utils@0.1.6': {} + '@floating-ui/utils@0.2.9': {} '@humanfs/core@0.19.1': {} @@ -2729,9 +2688,9 @@ snapshots: '@humanwhocodes/retry@0.4.1': {} - '@internationalized/date@3.5.1': + '@internationalized/date@3.7.0': dependencies: - '@swc/helpers': 0.5.8 + '@swc/helpers': 0.5.12 '@isaacs/cliui@8.0.2': dependencies: @@ -2807,16 +2766,6 @@ snapshots: '@mapbox/whoots-js@3.1.0': {} - '@melt-ui/svelte@0.76.2(svelte@5.18.0)': - dependencies: - '@floating-ui/core': 1.5.1 - '@floating-ui/dom': 1.5.3 - '@internationalized/date': 3.5.1 - dequal: 2.0.3 - focus-trap: 7.5.4 - nanoid: 5.0.7 - svelte: 5.18.0 - '@neoconfetti/svelte@2.2.1': {} '@nodelib/fs.scandir@2.1.5': @@ -2946,10 +2895,6 @@ snapshots: dependencies: tslib: 2.8.1 - '@swc/helpers@0.5.8': - dependencies: - tslib: 2.8.1 - '@total-typescript/ts-reset@0.6.1': {} '@types/cookie@0.6.0': {} @@ -3372,19 +3317,15 @@ snapshots: dependencies: file-uri-to-path: 1.0.0 - bits-ui@0.21.16(svelte@5.18.0): + bits-ui@1.0.0-next.77(svelte@5.18.0): dependencies: - '@internationalized/date': 3.5.1 - '@melt-ui/svelte': 0.76.2(svelte@5.18.0) - nanoid: 5.0.6 - svelte: 5.18.0 - - bits-ui@0.22.0(svelte@5.18.0): - dependencies: - '@internationalized/date': 3.5.1 - '@melt-ui/svelte': 0.76.2(svelte@5.18.0) - nanoid: 5.0.7 + '@floating-ui/core': 1.6.9 + '@floating-ui/dom': 1.6.13 + '@internationalized/date': 3.7.0 + esm-env: 1.2.2 + runed: 0.22.0(svelte@5.18.0) svelte: 5.18.0 + svelte-toolbelt: 0.7.0(svelte@5.18.0) brace-expansion@1.1.11: dependencies: @@ -3443,12 +3384,6 @@ snapshots: clsx@2.1.1: {} - cmdk-sv@0.0.18(svelte@5.18.0): - dependencies: - bits-ui: 0.21.16(svelte@5.18.0) - nanoid: 5.0.7 - svelte: 5.18.0 - color-convert@1.9.3: dependencies: color-name: 1.1.3 @@ -3688,8 +3623,6 @@ snapshots: dependencies: robust-predicates: 3.0.2 - dequal@2.0.3: {} - detect-libc@2.0.2: {} devalue@5.1.1: {} @@ -3909,10 +3842,6 @@ snapshots: flatted@3.2.9: {} - focus-trap@7.5.4: - dependencies: - tabbable: 6.2.0 - foreground-child@3.3.0: dependencies: cross-spawn: 7.0.6 @@ -4022,6 +3951,8 @@ snapshots: ini@1.3.8: {} + inline-style-parser@0.2.4: {} + internmap@1.0.1: {} internmap@2.0.3: {} @@ -4202,10 +4133,6 @@ snapshots: nanoid@3.3.8: {} - nanoid@5.0.6: {} - - nanoid@5.0.7: {} - natural-compare@1.4.0: {} node-fetch@2.7.0: @@ -4447,6 +4374,16 @@ snapshots: dependencies: queue-microtask: 1.2.3 + runed@0.20.0(svelte@5.18.0): + dependencies: + esm-env: 1.2.2 + svelte: 5.18.0 + + runed@0.22.0(svelte@5.18.0): + dependencies: + esm-env: 1.2.2 + svelte: 5.18.0 + rw@1.3.3: {} sade@1.8.1: @@ -4501,6 +4438,10 @@ snapshots: striptags@3.2.0: {} + style-to-object@1.0.8: + dependencies: + inline-style-parser: 0.2.4 + stylis@4.2.0: {} sucrase@3.35.0: @@ -4553,28 +4494,15 @@ snapshots: optionalDependencies: svelte: 5.18.0 - svelte-headless-table@0.18.3(svelte@5.18.0): - dependencies: - svelte: 5.18.0 - svelte-keyed: 2.0.0(svelte@5.18.0) - svelte-render: 2.0.1(svelte@5.18.0) - svelte-subscribe: 2.0.1(svelte@5.18.0) - - svelte-keyed@2.0.0(svelte@5.18.0): - dependencies: - svelte: 5.18.0 - - svelte-render@2.0.1(svelte@5.18.0): - dependencies: - svelte: 5.18.0 - svelte-subscribe: 2.0.1(svelte@5.18.0) - svelte-sonner@0.3.28(svelte@5.18.0): dependencies: svelte: 5.18.0 - svelte-subscribe@2.0.1(svelte@5.18.0): + svelte-toolbelt@0.7.0(svelte@5.18.0): dependencies: + clsx: 2.1.1 + runed: 0.20.0(svelte@5.18.0) + style-to-object: 1.0.8 svelte: 5.18.0 svelte@5.18.0: @@ -4594,8 +4522,6 @@ snapshots: magic-string: 0.30.11 zimmerframe: 1.1.2 - tabbable@6.2.0: {} - tailwind-merge@2.6.0: {} tailwind-variants@0.3.0(tailwindcss@3.4.17): diff --git a/src/lib/components/ui/alert-dialog/alert-dialog-action.svelte b/src/lib/components/ui/alert-dialog/alert-dialog-action.svelte index 57d643b..95ccd3b 100644 --- a/src/lib/components/ui/alert-dialog/alert-dialog-action.svelte +++ b/src/lib/components/ui/alert-dialog/alert-dialog-action.svelte @@ -3,19 +3,11 @@ import { buttonVariants } from "$lib/components/ui/button/index.js"; import { cn } from "$lib/utils.js"; - type $$Props = AlertDialogPrimitive.ActionProps; - type $$Events = AlertDialogPrimitive.ActionEvents; - - let className: $$Props["class"] = undefined; - export { className as class }; + let { + ref = $bindable(null), + class: className, + ...restProps + }: AlertDialogPrimitive.ActionProps = $props(); - - - + diff --git a/src/lib/components/ui/alert-dialog/alert-dialog-cancel.svelte b/src/lib/components/ui/alert-dialog/alert-dialog-cancel.svelte index ef0a953..7015a89 100644 --- a/src/lib/components/ui/alert-dialog/alert-dialog-cancel.svelte +++ b/src/lib/components/ui/alert-dialog/alert-dialog-cancel.svelte @@ -3,19 +3,15 @@ import { buttonVariants } from "$lib/components/ui/button/index.js"; import { cn } from "$lib/utils.js"; - type $$Props = AlertDialogPrimitive.CancelProps; - type $$Events = AlertDialogPrimitive.CancelEvents; - - let className: $$Props["class"] = undefined; - export { className as class }; + let { + ref = $bindable(null), + class: className, + ...restProps + }: AlertDialogPrimitive.CancelProps = $props(); - - + {...restProps} +/> diff --git a/src/lib/components/ui/alert-dialog/alert-dialog-content.svelte b/src/lib/components/ui/alert-dialog/alert-dialog-content.svelte index 28ecc39..858b8bc 100644 --- a/src/lib/components/ui/alert-dialog/alert-dialog-content.svelte +++ b/src/lib/components/ui/alert-dialog/alert-dialog-content.svelte @@ -1,28 +1,26 @@ - - + + - - - + {...restProps} + /> + diff --git a/src/lib/components/ui/alert-dialog/alert-dialog-description.svelte b/src/lib/components/ui/alert-dialog/alert-dialog-description.svelte index f35ac20..3e136da 100644 --- a/src/lib/components/ui/alert-dialog/alert-dialog-description.svelte +++ b/src/lib/components/ui/alert-dialog/alert-dialog-description.svelte @@ -2,15 +2,15 @@ import { AlertDialog as AlertDialogPrimitive } from "bits-ui"; import { cn } from "$lib/utils.js"; - type $$Props = AlertDialogPrimitive.DescriptionProps; - - let className: $$Props["class"] = undefined; - export { className as class }; + let { + ref = $bindable(null), + class: className, + ...restProps + }: AlertDialogPrimitive.DescriptionProps = $props(); - - + {...restProps} +/> diff --git a/src/lib/components/ui/alert-dialog/alert-dialog-footer.svelte b/src/lib/components/ui/alert-dialog/alert-dialog-footer.svelte index a235d1f..91ecaba 100644 --- a/src/lib/components/ui/alert-dialog/alert-dialog-footer.svelte +++ b/src/lib/components/ui/alert-dialog/alert-dialog-footer.svelte @@ -1,16 +1,20 @@
- + {@render children?.()}
diff --git a/src/lib/components/ui/alert-dialog/alert-dialog-header.svelte b/src/lib/components/ui/alert-dialog/alert-dialog-header.svelte index 2650ef9..44a7b08 100644 --- a/src/lib/components/ui/alert-dialog/alert-dialog-header.svelte +++ b/src/lib/components/ui/alert-dialog/alert-dialog-header.svelte @@ -1,13 +1,20 @@ -
- +
+ {@render children?.()}
diff --git a/src/lib/components/ui/alert-dialog/alert-dialog-overlay.svelte b/src/lib/components/ui/alert-dialog/alert-dialog-overlay.svelte index edf4840..bb76e7a 100644 --- a/src/lib/components/ui/alert-dialog/alert-dialog-overlay.svelte +++ b/src/lib/components/ui/alert-dialog/alert-dialog-overlay.svelte @@ -1,21 +1,19 @@ diff --git a/src/lib/components/ui/alert-dialog/alert-dialog-title.svelte b/src/lib/components/ui/alert-dialog/alert-dialog-title.svelte index 7f98004..c7811db 100644 --- a/src/lib/components/ui/alert-dialog/alert-dialog-title.svelte +++ b/src/lib/components/ui/alert-dialog/alert-dialog-title.svelte @@ -2,13 +2,17 @@ import { AlertDialog as AlertDialogPrimitive } from "bits-ui"; import { cn } from "$lib/utils.js"; - type $$Props = AlertDialogPrimitive.TitleProps; - - let className: $$Props["class"] = undefined; - export let level: $$Props["level"] = "h3"; - export { className as class }; + let { + ref = $bindable(null), + class: className, + level = 3, + ...restProps + }: AlertDialogPrimitive.TitleProps = $props(); - - - + diff --git a/src/lib/components/ui/alert-dialog/index.ts b/src/lib/components/ui/alert-dialog/index.ts index be56dd7..d06201d 100644 --- a/src/lib/components/ui/alert-dialog/index.ts +++ b/src/lib/components/ui/alert-dialog/index.ts @@ -1,9 +1,7 @@ import { AlertDialog as AlertDialogPrimitive } from "bits-ui"; - import Title from "./alert-dialog-title.svelte"; import Action from "./alert-dialog-action.svelte"; import Cancel from "./alert-dialog-cancel.svelte"; -import Portal from "./alert-dialog-portal.svelte"; import Footer from "./alert-dialog-footer.svelte"; import Header from "./alert-dialog-header.svelte"; import Overlay from "./alert-dialog-overlay.svelte"; @@ -12,6 +10,7 @@ import Description from "./alert-dialog-description.svelte"; const Root = AlertDialogPrimitive.Root; const Trigger = AlertDialogPrimitive.Trigger; +const Portal = AlertDialogPrimitive.Portal; export { Root, diff --git a/src/lib/components/ui/button/button.svelte b/src/lib/components/ui/button/button.svelte index 86827f3..22ab2d0 100644 --- a/src/lib/components/ui/button/button.svelte +++ b/src/lib/components/ui/button/button.svelte @@ -1,25 +1,74 @@ + + - - - +{#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 af1e188..fb585d7 100644 --- a/src/lib/components/ui/button/index.ts +++ b/src/lib/components/ui/button/index.ts @@ -1,49 +1,17 @@ -import { type VariantProps, tv } from "tailwind-variants"; -import type { Button as ButtonPrimitive } from "bits-ui"; -import Root from "./button.svelte"; - -const buttonVariants = tv({ - base: "ring-offset-background 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-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", - variants: { - variant: { - default: "bg-primary text-primary-foreground hover:bg-primary/90", - destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90", - outline: - "border-input bg-background hover:bg-accent hover:text-accent-foreground border", - secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80", - ghost: "hover:bg-accent hover:text-accent-foreground", - link: "text-primary underline-offset-4 hover:underline", - }, - size: { - default: "h-10 px-4 py-2", - sm: "h-9 rounded-md px-3", - lg: "h-11 rounded-md px-8", - icon: "h-10 w-10", - }, - }, - 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 748c644..1f52856 100644 --- a/src/lib/components/ui/card/card-content.svelte +++ b/src/lib/components/ui/card/card-content.svelte @@ -1,13 +1,16 @@ -
- +
+ {@render children?.()}
diff --git a/src/lib/components/ui/card/card-description.svelte b/src/lib/components/ui/card/card-description.svelte index f65821d..da02664 100644 --- a/src/lib/components/ui/card/card-description.svelte +++ b/src/lib/components/ui/card/card-description.svelte @@ -1,13 +1,16 @@ -

- +

+ {@render children?.()}

diff --git a/src/lib/components/ui/card/card-footer.svelte b/src/lib/components/ui/card/card-footer.svelte index 32f90bb..6894149 100644 --- a/src/lib/components/ui/card/card-footer.svelte +++ b/src/lib/components/ui/card/card-footer.svelte @@ -1,13 +1,16 @@ -
- +
+ {@render children?.()}
diff --git a/src/lib/components/ui/card/card-header.svelte b/src/lib/components/ui/card/card-header.svelte index 9c65185..1baa92c 100644 --- a/src/lib/components/ui/card/card-header.svelte +++ b/src/lib/components/ui/card/card-header.svelte @@ -1,13 +1,16 @@ -
- +
+ {@render children?.()}
diff --git a/src/lib/components/ui/card/card-title.svelte b/src/lib/components/ui/card/card-title.svelte index 719808e..f7d59c1 100644 --- a/src/lib/components/ui/card/card-title.svelte +++ b/src/lib/components/ui/card/card-title.svelte @@ -1,21 +1,25 @@ - - - + {@render children?.()} +
diff --git a/src/lib/components/ui/card/card.svelte b/src/lib/components/ui/card/card.svelte index b69c15c..3e3a4ed 100644 --- a/src/lib/components/ui/card/card.svelte +++ b/src/lib/components/ui/card/card.svelte @@ -1,16 +1,20 @@
- + {@render children?.()}
diff --git a/src/lib/components/ui/card/index.ts b/src/lib/components/ui/card/index.ts index bcc031d..0f9084d 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/checkbox/checkbox.svelte b/src/lib/components/ui/checkbox/checkbox.svelte index f4b906f..79f9911 100644 --- a/src/lib/components/ui/checkbox/checkbox.svelte +++ b/src/lib/components/ui/checkbox/checkbox.svelte @@ -1,35 +1,35 @@ - - {#if isChecked} - - {:else if isIndeterminate} - - {/if} - + {#snippet children({ checked, indeterminate })} +
+ {#if indeterminate} + + {:else} + + {/if} +
+ {/snippet}
diff --git a/src/lib/components/ui/command/command-dialog.svelte b/src/lib/components/ui/command/command-dialog.svelte index 68398a8..ca9908f 100644 --- a/src/lib/components/ui/command/command-dialog.svelte +++ b/src/lib/components/ui/command/command-dialog.svelte @@ -1,23 +1,35 @@ - - + + - - + bind:ref + {children} + /> diff --git a/src/lib/components/ui/command/command-empty.svelte b/src/lib/components/ui/command/command-empty.svelte index 3a0819d..5d86afe 100644 --- a/src/lib/components/ui/command/command-empty.svelte +++ b/src/lib/components/ui/command/command-empty.svelte @@ -1,12 +1,12 @@ - - - + diff --git a/src/lib/components/ui/command/command-group.svelte b/src/lib/components/ui/command/command-group.svelte index 22f49a4..6feb450 100644 --- a/src/lib/components/ui/command/command-group.svelte +++ b/src/lib/components/ui/command/command-group.svelte @@ -1,18 +1,29 @@ - + {#if heading} + + {heading} + + {/if} + diff --git a/src/lib/components/ui/command/command-input.svelte b/src/lib/components/ui/command/command-input.svelte index 3c50f23..5b356aa 100644 --- a/src/lib/components/ui/command/command-input.svelte +++ b/src/lib/components/ui/command/command-input.svelte @@ -1,23 +1,25 @@ -
- +
+
diff --git a/src/lib/components/ui/command/command-item.svelte b/src/lib/components/ui/command/command-item.svelte index a75acc8..3738ff2 100644 --- a/src/lib/components/ui/command/command-item.svelte +++ b/src/lib/components/ui/command/command-item.svelte @@ -1,24 +1,19 @@ - - + bind:ref + {...restProps} +/> diff --git a/src/lib/components/ui/command/command-link-item.svelte b/src/lib/components/ui/command/command-link-item.svelte new file mode 100644 index 0000000..9bdded2 --- /dev/null +++ b/src/lib/components/ui/command/command-link-item.svelte @@ -0,0 +1,19 @@ + + + diff --git a/src/lib/components/ui/command/command-list.svelte b/src/lib/components/ui/command/command-list.svelte index 8ceda03..4a07321 100644 --- a/src/lib/components/ui/command/command-list.svelte +++ b/src/lib/components/ui/command/command-list.svelte @@ -1,15 +1,16 @@ - - + {...restProps} + bind:ref +/> diff --git a/src/lib/components/ui/command/command-separator.svelte b/src/lib/components/ui/command/command-separator.svelte index 71688b8..526777b 100644 --- a/src/lib/components/ui/command/command-separator.svelte +++ b/src/lib/components/ui/command/command-separator.svelte @@ -1,10 +1,12 @@ - + diff --git a/src/lib/components/ui/command/command-shortcut.svelte b/src/lib/components/ui/command/command-shortcut.svelte index c89bd61..f09693d 100644 --- a/src/lib/components/ui/command/command-shortcut.svelte +++ b/src/lib/components/ui/command/command-shortcut.svelte @@ -1,16 +1,20 @@ - + {@render children?.()} diff --git a/src/lib/components/ui/command/command.svelte b/src/lib/components/ui/command/command.svelte index 3889696..feff690 100644 --- a/src/lib/components/ui/command/command.svelte +++ b/src/lib/components/ui/command/command.svelte @@ -1,13 +1,13 @@ - - + bind:ref + {...restProps} +/> diff --git a/src/lib/components/ui/command/index.ts b/src/lib/components/ui/command/index.ts index d8a2e7c..d3dbade 100644 --- a/src/lib/components/ui/command/index.ts +++ b/src/lib/components/ui/command/index.ts @@ -1,4 +1,4 @@ -import { Command as CommandPrimitive } from "cmdk-sv"; +import { Command as CommandPrimitive } from "bits-ui"; import Root from "./command.svelte"; import Dialog from "./command-dialog.svelte"; @@ -9,6 +9,7 @@ import Input from "./command-input.svelte"; import List from "./command-list.svelte"; import Separator from "./command-separator.svelte"; import Shortcut from "./command-shortcut.svelte"; +import LinkItem from "./command-link-item.svelte"; const Loading = CommandPrimitive.Loading; @@ -18,6 +19,7 @@ export { Empty, Group, Item, + LinkItem, Input, List, Separator, @@ -29,6 +31,7 @@ export { Empty as CommandEmpty, Group as CommandGroup, Item as CommandItem, + LinkItem as CommandLinkItem, Input as CommandInput, List as CommandList, Separator as CommandSeparator, diff --git a/src/lib/components/ui/dialog/dialog-content.svelte b/src/lib/components/ui/dialog/dialog-content.svelte index a06ccb2..7e9868c 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 8bc70cc..bc048e4 100644 --- a/src/lib/components/ui/dialog/dialog-description.svelte +++ b/src/lib/components/ui/dialog/dialog-description.svelte @@ -2,15 +2,15 @@ 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(); - - + {...restProps} +/> diff --git a/src/lib/components/ui/dialog/dialog-footer.svelte b/src/lib/components/ui/dialog/dialog-footer.svelte index a235d1f..91ecaba 100644 --- a/src/lib/components/ui/dialog/dialog-footer.svelte +++ b/src/lib/components/ui/dialog/dialog-footer.svelte @@ -1,16 +1,20 @@
- + {@render children?.()}
diff --git a/src/lib/components/ui/dialog/dialog-header.svelte b/src/lib/components/ui/dialog/dialog-header.svelte index 6b4448c..8d1abfc 100644 --- a/src/lib/components/ui/dialog/dialog-header.svelte +++ b/src/lib/components/ui/dialog/dialog-header.svelte @@ -1,13 +1,20 @@ -
- +
+ {@render children?.()}
diff --git a/src/lib/components/ui/dialog/dialog-overlay.svelte b/src/lib/components/ui/dialog/dialog-overlay.svelte index 1d376e4..05c30ac 100644 --- a/src/lib/components/ui/dialog/dialog-overlay.svelte +++ b/src/lib/components/ui/dialog/dialog-overlay.svelte @@ -1,21 +1,19 @@ diff --git a/src/lib/components/ui/dialog/dialog-title.svelte b/src/lib/components/ui/dialog/dialog-title.svelte index 06574f3..9cf592c 100644 --- a/src/lib/components/ui/dialog/dialog-title.svelte +++ b/src/lib/components/ui/dialog/dialog-title.svelte @@ -2,15 +2,15 @@ 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(); - - + {...restProps} +/> diff --git a/src/lib/components/ui/dialog/index.ts b/src/lib/components/ui/dialog/index.ts index b17ba5e..3286ab7 100644 --- a/src/lib/components/ui/dialog/index.ts +++ b/src/lib/components/ui/dialog/index.ts @@ -1,7 +1,6 @@ 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"; @@ -11,6 +10,7 @@ import Description from "./dialog-description.svelte"; const Root = DialogPrimitive.Root; const Trigger = DialogPrimitive.Trigger; const Close = DialogPrimitive.Close; +const 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 6f1595f..20e3777 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 d6af313..fdbaa47 100644 --- a/src/lib/components/ui/dropdown-menu/dropdown-menu-content.svelte +++ b/src/lib/components/ui/dropdown-menu/dropdown-menu-content.svelte @@ -1,27 +1,26 @@ - - - + + + 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..84d5cca --- /dev/null +++ b/src/lib/components/ui/dropdown-menu/dropdown-menu-group-heading.svelte @@ -0,0 +1,19 @@ + + + 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 c99fff2..70a5236 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 @@ - - + {...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 43f1527..9837d5a 100644 --- a/src/lib/components/ui/dropdown-menu/dropdown-menu-label.svelte +++ b/src/lib/components/ui/dropdown-menu/dropdown-menu-label.svelte @@ -1,19 +1,23 @@ - - - + {@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 ea3c441..0f219da 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 8b16e03..32fac4b 100644 --- a/src/lib/components/ui/dropdown-menu/dropdown-menu-separator.svelte +++ b/src/lib/components/ui/dropdown-menu/dropdown-menu-separator.svelte @@ -2,13 +2,15 @@ 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 d8c7378..053e2a2 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,20 @@ - - + + {@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 034ed06..0bb6eea 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,30 +1,19 @@ - - + {...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 7f368ce..c2dcd32 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 @@ -3,30 +3,26 @@ import ChevronRight from "lucide-svelte/icons/chevron-right"; import { cn } from "$lib/utils.js"; - type $$Props = DropdownMenuPrimitive.SubTriggerProps & { + let { + ref = $bindable(null), + class: className, + inset, + children, + ...restProps + }: DropdownMenuPrimitive.SubTriggerProps & { inset?: boolean; - }; - type $$Events = DropdownMenuPrimitive.SubTriggerEvents; - - let className: $$Props["class"] = undefined; - export let inset: $$Props["inset"] = undefined; - export { className as class }; + } = $props(); - - + {@render children?.()} + diff --git a/src/lib/components/ui/dropdown-menu/index.ts b/src/lib/components/ui/dropdown-menu/index.ts index c1749e9..40c4502 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 75e3bc2..f47b6d3 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 cab1457..328634f 100644 --- a/src/lib/components/ui/input/input.svelte +++ b/src/lib/components/ui/input/input.svelte @@ -1,42 +1,22 @@ diff --git a/src/lib/components/ui/label/label.svelte b/src/lib/components/ui/label/label.svelte index 2a7d479..247d23c 100644 --- a/src/lib/components/ui/label/label.svelte +++ b/src/lib/components/ui/label/label.svelte @@ -2,20 +2,18 @@ import { Label as LabelPrimitive } from "bits-ui"; import { cn } from "$lib/utils.js"; - type $$Props = LabelPrimitive.Props; - type $$Events = LabelPrimitive.Events; - - 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/pagination/pagination-content.svelte b/src/lib/components/ui/pagination/pagination-content.svelte index 9279558..6ba3cd3 100644 --- a/src/lib/components/ui/pagination/pagination-content.svelte +++ b/src/lib/components/ui/pagination/pagination-content.svelte @@ -1,13 +1,16 @@ -
    - +
      + {@render children?.()}
    diff --git a/src/lib/components/ui/pagination/pagination-ellipsis.svelte b/src/lib/components/ui/pagination/pagination-ellipsis.svelte index e0fb97c..7cb7fb1 100644 --- a/src/lib/components/ui/pagination/pagination-ellipsis.svelte +++ b/src/lib/components/ui/pagination/pagination-ellipsis.svelte @@ -1,19 +1,22 @@ - + More pages diff --git a/src/lib/components/ui/pagination/pagination-item.svelte b/src/lib/components/ui/pagination/pagination-item.svelte index 009ad17..09c1076 100644 --- a/src/lib/components/ui/pagination/pagination-item.svelte +++ b/src/lib/components/ui/pagination/pagination-item.svelte @@ -1,13 +1,14 @@ -
  • - +
  • + {@render children?.()}
  • diff --git a/src/lib/components/ui/pagination/pagination-link.svelte b/src/lib/components/ui/pagination/pagination-link.svelte index 74dbc23..4a41b47 100644 --- a/src/lib/components/ui/pagination/pagination-link.svelte +++ b/src/lib/components/ui/pagination/pagination-link.svelte @@ -3,23 +3,27 @@ import { cn } from "$lib/utils.js"; import { type Props, buttonVariants } from "$lib/components/ui/button/index.js"; - type $$Props = PaginationPrimitive.PageProps & + let { + ref = $bindable(null), + class: className, + size = "icon", + isActive = false, + page, + children, + ...restProps + }: PaginationPrimitive.PageProps & Props & { isActive: boolean; - }; - - type $$Events = PaginationPrimitive.PageEvents; - - let className: $$Props["class"] = undefined; - export let page: $$Props["page"]; - export let size: $$Props["size"] = "icon"; - export let isActive: $$Props["isActive"] = false; - - export { className as class }; + } = $props(); +{#snippet Fallback()} + {page.value} +{/snippet} + - {page.value} - + children={children || Fallback} + {...restProps} +/> diff --git a/src/lib/components/ui/pagination/pagination-next-button.svelte b/src/lib/components/ui/pagination/pagination-next-button.svelte index f9d6c13..a1c9692 100644 --- a/src/lib/components/ui/pagination/pagination-next-button.svelte +++ b/src/lib/components/ui/pagination/pagination-next-button.svelte @@ -1,27 +1,31 @@ - - - +{#snippet Fallback()} + Next + +{/snippet} + + diff --git a/src/lib/components/ui/pagination/pagination-prev-button.svelte b/src/lib/components/ui/pagination/pagination-prev-button.svelte index 411d2aa..0413148 100644 --- a/src/lib/components/ui/pagination/pagination-prev-button.svelte +++ b/src/lib/components/ui/pagination/pagination-prev-button.svelte @@ -1,27 +1,31 @@ - - - +{#snippet Fallback()} + + Previous +{/snippet} + + diff --git a/src/lib/components/ui/pagination/pagination.svelte b/src/lib/components/ui/pagination/pagination.svelte index 1cbcce3..4cdc9b1 100644 --- a/src/lib/components/ui/pagination/pagination.svelte +++ b/src/lib/components/ui/pagination/pagination.svelte @@ -3,31 +3,23 @@ import { cn } from "$lib/utils.js"; - type $$Props = PaginationPrimitive.Props; - type $$Events = PaginationPrimitive.Events; - - let className: $$Props["class"] = undefined; - export let count: $$Props["count"] = 0; - export let perPage: $$Props["perPage"] = 10; - export let page: $$Props["page"] = 1; - export let siblingCount: $$Props["siblingCount"] = 1; - export { className as class }; - - $: currentPage = page; + let { + ref = $bindable(null), + class: className, + count = 0, + perPage = 10, + page = $bindable(1), + siblingCount = 1, + ...restProps + }: PaginationPrimitive.RootProps = $props(); - - + {...restProps} +/> diff --git a/src/lib/components/ui/popover/popover-content.svelte b/src/lib/components/ui/popover/popover-content.svelte index 1d86206..d2fbace 100644 --- a/src/lib/components/ui/popover/popover-content.svelte +++ b/src/lib/components/ui/popover/popover-content.svelte @@ -1,22 +1,28 @@ - - - + + + diff --git a/src/lib/components/ui/separator/separator.svelte b/src/lib/components/ui/separator/separator.svelte index aa61f69..839494d 100644 --- a/src/lib/components/ui/separator/separator.svelte +++ b/src/lib/components/ui/separator/separator.svelte @@ -2,21 +2,21 @@ import { Separator as SeparatorPrimitive } from "bits-ui"; import { cn } from "$lib/utils.js"; - type $$Props = SeparatorPrimitive.Props; - - let className: $$Props["class"] = undefined; - export let orientation: $$Props["orientation"] = "horizontal"; - export let decorative: $$Props["decorative"] = undefined; - export { className as class }; + let { + ref = $bindable(null), + class: className, + orientation = "horizontal", + ...restProps + }: SeparatorPrimitive.RootProps = $props(); diff --git a/src/lib/components/ui/skeleton/skeleton.svelte b/src/lib/components/ui/skeleton/skeleton.svelte index 7e5d18b..4089b49 100644 --- a/src/lib/components/ui/skeleton/skeleton.svelte +++ b/src/lib/components/ui/skeleton/skeleton.svelte @@ -1,11 +1,17 @@ -
    +
    diff --git a/src/lib/components/ui/slider/slider.svelte b/src/lib/components/ui/slider/slider.svelte index 2a94368..2f8b6e1 100644 --- a/src/lib/components/ui/slider/slider.svelte +++ b/src/lib/components/ui/slider/slider.svelte @@ -1,27 +1,34 @@ + - - - - {#each thumbs as thumb} - - {/each} + {#snippet children({ thumbs })} + + + + {#each thumbs as thumb} + + {/each} + {/snippet} diff --git a/src/lib/components/ui/sonner/sonner.svelte b/src/lib/components/ui/sonner/sonner.svelte index 7d5b2f1..8050e04 100644 --- a/src/lib/components/ui/sonner/sonner.svelte +++ b/src/lib/components/ui/sonner/sonner.svelte @@ -2,7 +2,7 @@ import { Toaster as Sonner, type ToasterProps as SonnerProps } from "svelte-sonner"; import { mode } from "mode-watcher"; - type $$Props = SonnerProps; + let restProps: SonnerProps = $props(); diff --git a/src/lib/components/ui/table/table-body.svelte b/src/lib/components/ui/table/table-body.svelte index f2109d6..6c20c01 100644 --- a/src/lib/components/ui/table/table-body.svelte +++ b/src/lib/components/ui/table/table-body.svelte @@ -1,13 +1,16 @@ - - + + {@render children?.()} diff --git a/src/lib/components/ui/table/table-caption.svelte b/src/lib/components/ui/table/table-caption.svelte index b838270..2b0cba5 100644 --- a/src/lib/components/ui/table/table-caption.svelte +++ b/src/lib/components/ui/table/table-caption.svelte @@ -1,13 +1,16 @@ - - + + {@render children?.()} diff --git a/src/lib/components/ui/table/table-cell.svelte b/src/lib/components/ui/table/table-cell.svelte index fcb04f6..0536552 100644 --- a/src/lib/components/ui/table/table-cell.svelte +++ b/src/lib/components/ui/table/table-cell.svelte @@ -1,18 +1,20 @@ - + {@render children?.()} diff --git a/src/lib/components/ui/table/table-footer.svelte b/src/lib/components/ui/table/table-footer.svelte index c6c1570..0267c47 100644 --- a/src/lib/components/ui/table/table-footer.svelte +++ b/src/lib/components/ui/table/table-footer.svelte @@ -1,13 +1,16 @@ - - + + {@render children?.()} diff --git a/src/lib/components/ui/table/table-head.svelte b/src/lib/components/ui/table/table-head.svelte index 49ab7a9..5300ce6 100644 --- a/src/lib/components/ui/table/table-head.svelte +++ b/src/lib/components/ui/table/table-head.svelte @@ -1,19 +1,23 @@ - + {@render children?.()} diff --git a/src/lib/components/ui/table/table-header.svelte b/src/lib/components/ui/table/table-header.svelte index a3e59ee..684a57b 100644 --- a/src/lib/components/ui/table/table-header.svelte +++ b/src/lib/components/ui/table/table-header.svelte @@ -1,14 +1,16 @@ - - - + + {@render children?.()} diff --git a/src/lib/components/ui/table/table-row.svelte b/src/lib/components/ui/table/table-row.svelte index 731c5d5..9e693bc 100644 --- a/src/lib/components/ui/table/table-row.svelte +++ b/src/lib/components/ui/table/table-row.svelte @@ -1,23 +1,23 @@ - + {@render children?.()} diff --git a/src/lib/components/ui/table/table.svelte b/src/lib/components/ui/table/table.svelte index 788d4ee..e3a95b6 100644 --- a/src/lib/components/ui/table/table.svelte +++ b/src/lib/components/ui/table/table.svelte @@ -1,15 +1,18 @@
    - - +
    + {@render children?.()}
    diff --git a/src/lib/components/ui/tabs/tabs-content.svelte b/src/lib/components/ui/tabs/tabs-content.svelte index b611559..f1c0515 100644 --- a/src/lib/components/ui/tabs/tabs-content.svelte +++ b/src/lib/components/ui/tabs/tabs-content.svelte @@ -2,20 +2,18 @@ import { Tabs as TabsPrimitive } from "bits-ui"; import { cn } from "$lib/utils.js"; - type $$Props = TabsPrimitive.ContentProps; - - let className: $$Props["class"] = undefined; - export let value: $$Props["value"]; - export { className as class }; + let { + ref = $bindable(null), + class: className, + ...restProps + }: TabsPrimitive.ContentProps = $props(); - - + {...restProps} +/> diff --git a/src/lib/components/ui/tabs/tabs-list.svelte b/src/lib/components/ui/tabs/tabs-list.svelte index 773c754..f03e5fc 100644 --- a/src/lib/components/ui/tabs/tabs-list.svelte +++ b/src/lib/components/ui/tabs/tabs-list.svelte @@ -2,18 +2,18 @@ import { Tabs as TabsPrimitive } from "bits-ui"; import { cn } from "$lib/utils.js"; - type $$Props = TabsPrimitive.ListProps; - - let className: $$Props["class"] = undefined; - export { className as class }; + let { + ref = $bindable(null), + class: className, + ...restProps + }: TabsPrimitive.ListProps = $props(); - - + {...restProps} +/> diff --git a/src/lib/components/ui/tabs/tabs-trigger.svelte b/src/lib/components/ui/tabs/tabs-trigger.svelte index b99358d..f1f5825 100644 --- a/src/lib/components/ui/tabs/tabs-trigger.svelte +++ b/src/lib/components/ui/tabs/tabs-trigger.svelte @@ -2,22 +2,18 @@ import { Tabs as TabsPrimitive } from "bits-ui"; import { cn } from "$lib/utils.js"; - type $$Props = TabsPrimitive.TriggerProps; - type $$Events = TabsPrimitive.TriggerEvents; - - let className: $$Props["class"] = undefined; - export let value: $$Props["value"]; - export { className as class }; + let { + ref = $bindable(null), + class: className, + ...restProps + }: TabsPrimitive.TriggerProps = $props(); - - + {...restProps} +/> diff --git a/src/lib/components/ui/tooltip/index.ts b/src/lib/components/ui/tooltip/index.ts index 7d0444d..e9e1fd7 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 af9d1ff..68ff232 100644 --- a/src/lib/components/ui/tooltip/tooltip-content.svelte +++ b/src/lib/components/ui/tooltip/tooltip-content.svelte @@ -1,28 +1,21 @@ - - + {...restProps} +/> From feb4e3e043b95179f34e26aecb0e18030d0c8d10 Mon Sep 17 00:00:00 2001 From: WarningImHack3r <43064022+WarningImHack3r@users.noreply.github.com> Date: Sat, 1 Feb 2025 20:58:47 +0100 Subject: [PATCH 3/8] Update data table --- package.json | 4 +- pnpm-lock.yaml | 47 ++- .../ui/data-table/data-table.svelte.ts | 112 ++++++ .../ui/data-table/flex-render.svelte | 43 ++ src/lib/components/ui/data-table/index.ts | 3 + .../ui/data-table/render-helpers.ts | 111 ++++++ .../productivity-dashboard/DataTable.svelte | 373 ++++++++++-------- 7 files changed, 504 insertions(+), 189 deletions(-) create mode 100644 src/lib/components/ui/data-table/data-table.svelte.ts create mode 100644 src/lib/components/ui/data-table/flex-render.svelte create mode 100644 src/lib/components/ui/data-table/index.ts create mode 100644 src/lib/components/ui/data-table/render-helpers.ts diff --git a/package.json b/package.json index ba2ddf9..6eac0da 100644 --- a/package.json +++ b/package.json @@ -21,11 +21,12 @@ "@sveltejs/adapter-vercel": "^5.5.2", "@sveltejs/kit": "^2.15.3", "@sveltejs/vite-plugin-svelte": "^5.0.3", + "@tanstack/table-core": "^8.20.5", "@total-typescript/ts-reset": "^0.6.1", "@unovis/svelte": "^1.5.0", "@vercel/speed-insights": "^1.1.0", "autoprefixer": "^10.4.20", - "bits-ui": "1.0.0-next.77", + "bits-ui": "1.0.0-next.84", "clsx": "^2.1.1", "eslint": "^9.18.0", "eslint-config-prettier": "^10.0.1", @@ -57,7 +58,6 @@ }, "pnpm": { "onlyBuiltDependencies": [ - "@sveltejs/kit", "@vercel/speed-insights", "esbuild" ] diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b43fe4f..d44202b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,6 +20,9 @@ importers: '@sveltejs/vite-plugin-svelte': specifier: ^5.0.3 version: 5.0.3(svelte@5.18.0)(vite@6.0.7(jiti@1.21.6)) + '@tanstack/table-core': + specifier: ^8.20.5 + version: 8.20.5 '@total-typescript/ts-reset': specifier: ^0.6.1 version: 0.6.1 @@ -33,8 +36,8 @@ importers: specifier: ^10.4.20 version: 10.4.20(postcss@8.5.1) bits-ui: - specifier: 1.0.0-next.77 - version: 1.0.0-next.77(svelte@5.18.0) + specifier: 1.0.0-next.84 + version: 1.0.0-next.84(svelte@5.18.0) clsx: specifier: ^2.1.1 version: 2.1.1 @@ -620,6 +623,10 @@ packages: '@swc/helpers@0.5.12': resolution: {integrity: sha512-KMZNXiGibsW9kvZAO1Pam2JPTDBm+KSHMMHWdsyI/1DbIZjT2A6Gy3hblVXUMEDvUAKq+e0vL0X0o54owWji7g==} + '@tanstack/table-core@8.20.5': + resolution: {integrity: sha512-P9dF7XbibHph2PFRz8gfBKEXEY/HJPOhym8CHmjF8y3q5mWpKx9xtZapXQUWCgkqvsK0R46Azuz+VaxD4Xl+Tg==} + engines: {node: '>=12'} + '@total-typescript/ts-reset@0.6.1': resolution: {integrity: sha512-cka47fVSo6lfQDIATYqb/vO1nvFfbPw7uWLayIXIhGETj0wcOOlrlkobOMDNQOFr9QOafegUPq13V2+6vtD7yg==} @@ -968,8 +975,8 @@ packages: bindings@1.5.0: resolution: {integrity: sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==} - bits-ui@1.0.0-next.77: - resolution: {integrity: sha512-IV0AyVEvsRkXv4s/fl4iea5E9W2b9EBf98s9mRMKMc1xHxM9MmtM2r6MZMqftHQ/c+gHTIt3A9EKuTlh7uay8w==} + bits-ui@1.0.0-next.84: + resolution: {integrity: sha512-ZXsPfh/fOU1E2XvP8gRGk2G6c2vMWylDm3bCP888gwViI2lnwxz7D/fMuzBp3oKzovNxWMr8GR27yJQVOd9/jg==} engines: {node: '>=18', pnpm: '>=8.7.0'} peerDependencies: svelte: ^5.11.0 @@ -2107,13 +2114,8 @@ packages: run-parallel@1.2.0: resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} - runed@0.20.0: - resolution: {integrity: sha512-YqPxaUdWL5nUXuSF+/v8a+NkVN8TGyEGbQwTA25fLY35MR/2bvZ1c6sCbudoo1kT4CAJPh4kUkcgGVxW127WKw==} - peerDependencies: - svelte: ^5.7.0 - - runed@0.22.0: - resolution: {integrity: sha512-ZWVXWhOr0P5xdNgtviz6D1ivLUDWKLCbeC5SUEJ3zBkqLReVqWHenFxMNFeFaiC5bfxhFxyxzyzB+98uYFtwdA==} + runed@0.23.2: + resolution: {integrity: sha512-AhHCb5/B+YQW6ar1pzhGQOQy+byfjCH63ofuhrexSWwQKhC0EbQ60Z/wMYwETLo3ZubhwlNryxBt0seOMOrVFQ==} peerDependencies: svelte: ^5.7.0 @@ -2235,8 +2237,8 @@ packages: peerDependencies: svelte: ^3.0.0 || ^4.0.0 || ^5.0.0-next.1 - svelte-toolbelt@0.7.0: - resolution: {integrity: sha512-i/Tv4NwAWWqJnK5H0F8y/ubDnogDYlwwyzKhrspTUFzrFuGnYshqd2g4/R43ds841wmaFiSW/HsdsdWhPOlrAA==} + svelte-toolbelt@0.7.1: + resolution: {integrity: sha512-HcBOcR17Vx9bjaOceUvxkY3nGmbBmCBBbuWLLEWO6jtmWH8f/QoWmbyUfQZrpDINH39en1b8mptfPQT9VKQ1xQ==} engines: {node: '>=18', pnpm: '>=8.7.0'} peerDependencies: svelte: ^5.0.0 @@ -2895,6 +2897,8 @@ snapshots: dependencies: tslib: 2.8.1 + '@tanstack/table-core@8.20.5': {} + '@total-typescript/ts-reset@0.6.1': {} '@types/cookie@0.6.0': {} @@ -3317,15 +3321,15 @@ snapshots: dependencies: file-uri-to-path: 1.0.0 - bits-ui@1.0.0-next.77(svelte@5.18.0): + bits-ui@1.0.0-next.84(svelte@5.18.0): dependencies: '@floating-ui/core': 1.6.9 '@floating-ui/dom': 1.6.13 '@internationalized/date': 3.7.0 esm-env: 1.2.2 - runed: 0.22.0(svelte@5.18.0) + runed: 0.23.2(svelte@5.18.0) svelte: 5.18.0 - svelte-toolbelt: 0.7.0(svelte@5.18.0) + svelte-toolbelt: 0.7.1(svelte@5.18.0) brace-expansion@1.1.11: dependencies: @@ -4374,12 +4378,7 @@ snapshots: dependencies: queue-microtask: 1.2.3 - runed@0.20.0(svelte@5.18.0): - dependencies: - esm-env: 1.2.2 - svelte: 5.18.0 - - runed@0.22.0(svelte@5.18.0): + runed@0.23.2(svelte@5.18.0): dependencies: esm-env: 1.2.2 svelte: 5.18.0 @@ -4498,10 +4497,10 @@ snapshots: dependencies: svelte: 5.18.0 - svelte-toolbelt@0.7.0(svelte@5.18.0): + svelte-toolbelt@0.7.1(svelte@5.18.0): dependencies: clsx: 2.1.1 - runed: 0.20.0(svelte@5.18.0) + runed: 0.23.2(svelte@5.18.0) style-to-object: 1.0.8 svelte: 5.18.0 diff --git a/src/lib/components/ui/data-table/data-table.svelte.ts b/src/lib/components/ui/data-table/data-table.svelte.ts new file mode 100644 index 0000000..b4834ce --- /dev/null +++ b/src/lib/components/ui/data-table/data-table.svelte.ts @@ -0,0 +1,112 @@ +import { + type RowData, + type TableOptions, + type TableOptionsResolved, + type TableState, + createTable, +} from "@tanstack/table-core"; + +/** + * Creates a reactive TanStack table object for Svelte. + * @param options Table options to create the table with. + * @returns A reactive table object. + * @example + * ```svelte + * + * + * + * + * {#each table.getHeaderGroups() as headerGroup} + * + * {#each headerGroup.headers as header} + * + * {/each} + * + * {/each} + * + * + *
    + * + *
    + * ``` + */ +export function createSvelteTable(options: TableOptions) { + const resolvedOptions: TableOptionsResolved = mergeObjects( + { + state: {}, + onStateChange() {}, + renderFallbackValue: null, + mergeOptions: ( + defaultOptions: TableOptions, + options: Partial> + ) => { + return mergeObjects(defaultOptions, options); + }, + }, + options + ); + + const table = createTable(resolvedOptions); + let state = $state>(table.initialState); + + function updateOptions() { + table.setOptions((prev) => { + return mergeObjects(prev, options, { + state: mergeObjects(state, options.state || {}), + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + onStateChange: (updater: any) => { + if (updater instanceof Function) state = updater(state); + else state = mergeObjects(state, updater); + + options.onStateChange?.(updater); + }, + }); + }); + } + + updateOptions(); + + $effect.pre(() => { + updateOptions(); + }); + + return table; +} + +/** + * Merges objects together while keeping their getters alive. + * Taken from SolidJS: {@link https://github.com/solidjs/solid/blob/24abc825c0996fd2bc8c1de1491efe9a7e743aff/packages/solid/src/server/rendering.ts#L82-L115} + */ +function mergeObjects(source: T): T; +function mergeObjects(source: T, source1: U): T & U; +function mergeObjects(source: T, source1: U, source2: V): T & U & V; +function mergeObjects(source: T, source1: U, source2: V, source3: W): T & U & V & W; +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function mergeObjects(...sources: any): any { + const target = {}; + for (let i = 0; i < sources.length; i++) { + let source = sources[i]; + if (typeof source === "function") source = source(); + if (source) { + const descriptors = Object.getOwnPropertyDescriptors(source); + for (const key in descriptors) { + if (key in target) continue; + Object.defineProperty(target, key, { + enumerable: true, + get() { + for (let i = sources.length - 1; i >= 0; i--) { + let s = sources[i]; + if (typeof s === "function") s = s(); + const v = (s || {})[key]; + if (v !== undefined) return v; + } + }, + }); + } + } + } + return target; +} diff --git a/src/lib/components/ui/data-table/flex-render.svelte b/src/lib/components/ui/data-table/flex-render.svelte new file mode 100644 index 0000000..de3563f --- /dev/null +++ b/src/lib/components/ui/data-table/flex-render.svelte @@ -0,0 +1,43 @@ + + + + +{#if typeof content === "string"} + {content} +{:else if content instanceof Function} + + + {@const result = content(context as any)} + {#if result instanceof RenderComponentConfig} + {@const { component: Component, props } = result} + + {:else if result instanceof RenderSnippetConfig} + {@const { snippet, params } = result} + {@render snippet(params)} + {:else} + {result} + {/if} +{/if} diff --git a/src/lib/components/ui/data-table/index.ts b/src/lib/components/ui/data-table/index.ts new file mode 100644 index 0000000..5f4e77e --- /dev/null +++ b/src/lib/components/ui/data-table/index.ts @@ -0,0 +1,3 @@ +export { default as FlexRender } from "./flex-render.svelte"; +export { renderComponent, renderSnippet } from "./render-helpers.js"; +export { createSvelteTable } from "./data-table.svelte.js"; diff --git a/src/lib/components/ui/data-table/render-helpers.ts b/src/lib/components/ui/data-table/render-helpers.ts new file mode 100644 index 0000000..1984642 --- /dev/null +++ b/src/lib/components/ui/data-table/render-helpers.ts @@ -0,0 +1,111 @@ +import type { Component, ComponentProps, Snippet } from "svelte"; + +/** + * A helper class to make it easy to identify Svelte components in + * `columnDef.cell` and `columnDef.header` properties. + * + * > NOTE: This class should only be used internally by the adapter. If you're + * reading this and you don't know what this is for, you probably don't need it. + * + * @example + * ```svelte + * {@const result = content(context as any)} + * {#if result instanceof RenderComponentConfig} + * {@const { component: Component, props } = result} + * + * {/if} + * ``` + */ +export class RenderComponentConfig { + component: TComponent; + props: ComponentProps | Record; + constructor( + component: TComponent, + props: ComponentProps | Record = {} + ) { + this.component = component; + this.props = props; + } +} + +/** + * A helper class to make it easy to identify Svelte Snippets in `columnDef.cell` and `columnDef.header` properties. + * + * > NOTE: This class should only be used internally by the adapter. If you're + * reading this and you don't know what this is for, you probably don't need it. + * + * @example + * ```svelte + * {@const result = content(context as any)} + * {#if result instanceof RenderSnippetConfig} + * {@const { snippet, params } = result} + * {@render snippet(params)} + * {/if} + * ``` + */ +export class RenderSnippetConfig { + snippet: Snippet<[TProps]>; + params: TProps; + constructor(snippet: Snippet<[TProps]>, params: TProps) { + this.snippet = snippet; + this.params = params; + } +} + +/** + * A helper function to help create cells from Svelte components through ColumnDef's `cell` and `header` properties. + * + * This is only to be used with Svelte Components - use `renderSnippet` for Svelte Snippets. + * + * @param component A Svelte component + * @param props The props to pass to `component` + * @returns A `RenderComponentConfig` object that helps svelte-table know how to render the header/cell component. + * @example + * ```ts + * // +page.svelte + * const defaultColumns = [ + * columnHelper.accessor('name', { + * header: header => renderComponent(SortHeader, { label: 'Name', header }), + * }), + * columnHelper.accessor('state', { + * header: header => renderComponent(SortHeader, { label: 'State', header }), + * }), + * ] + * ``` + * @see {@link https://tanstack.com/table/latest/docs/guide/column-defs} + */ +export function renderComponent< + // eslint-disable-next-line @typescript-eslint/no-explicit-any + T extends Component, + Props extends ComponentProps, +>(component: T, props: Props) { + return new RenderComponentConfig(component, props); +} + +/** + * A helper function to help create cells from Svelte Snippets through ColumnDef's `cell` and `header` properties. + * + * The snippet must only take one parameter. + * + * This is only to be used with Snippets - use `renderComponent` for Svelte Components. + * + * @param snippet + * @param params + * @returns - A `RenderSnippetConfig` object that helps svelte-table know how to render the header/cell snippet. + * @example + * ```ts + * // +page.svelte + * const defaultColumns = [ + * columnHelper.accessor('name', { + * cell: cell => renderSnippet(nameSnippet, { name: cell.row.name }), + * }), + * columnHelper.accessor('state', { + * cell: cell => renderSnippet(stateSnippet, { state: cell.row.state }), + * }), + * ] + * ``` + * @see {@link https://tanstack.com/table/latest/docs/guide/column-defs} + */ +export function renderSnippet(snippet: Snippet<[TProps]>, params: TProps) { + return new RenderSnippetConfig(snippet, params); +} diff --git a/src/routes/2023/productivity-dashboard/DataTable.svelte b/src/routes/2023/productivity-dashboard/DataTable.svelte index a301f8c..e18b792 100644 --- a/src/routes/2023/productivity-dashboard/DataTable.svelte +++ b/src/routes/2023/productivity-dashboard/DataTable.svelte @@ -1,12 +1,16 @@
    - + { + table.getColumn("elf")?.setFilterValue(e.currentTarget.value); + }} + oninput={e => { + table.getColumn("elf")?.setFilterValue(e.currentTarget.value); + }} + /> - - + + {#snippet child({ props })} + + {/snippet} - - {#each flatColumns as col} - {#if hidableCols.includes(col.id)} - - {col.header} - - {/if} + + {#each table.getAllColumns().filter(col => col.getCanHide()) as column (column.id)} + column.getIsVisible(), v => column.toggleVisibility(!!v)} + > + {column.id} + {/each}
    - + - {#each $headerRows as headerRow} - - - {#each headerRow.cells as cell (cell.id)} - - - - - - {/each} - - + {#each table.getHeaderGroups() as headerGroup (headerGroup.id)} + + {#each headerGroup.headers as header (header.id)} + + {#if !header.isPlaceholder} + + {/if} + + {/each} + {/each} - - {#each $pageRows as row (row.id)} - - - {#each row.cells as cell (cell.id)} - - - {#if cell.id === "elf"} -
    - -
    - {:else if cell.id === "task"} -
    - -
    - {:else} - - {/if} -
    -
    - {/each} -
    -
    + + {#each table.getRowModel().rows as row (row.id)} + + {#each row.getVisibleCells() as cell (cell.id)} + + + + {/each} + + {:else} + + No results. + {/each}
    - {#if $filterValue} - {$rows.length} out of {tableData.length} rows + {#if table.getColumn("elf")?.getFilterValue()} + {table.getPaginationRowModel().rows.length} out of + {tableData.length} rows {:else} - {$rows.length} rows + {table.getRowCount()} rows {/if}
    ($pageIndex = page - 1)} - let:pages - let:currentPage + count={tableData.length} + perPage={pagination.pageSize} > - - - - - - - - {#each pages as page (page.key)} - {#if page.type === "ellipsis"} - - - - {:else} - - - {page.value} - - - {/if} - {/each} - - - - - - - + {#snippet children({ pages, currentPage })} + + + + + + + + {#each pages as page (page.key)} + {#if page.type === "ellipsis"} + + + + {:else} + + + {page.value} + + + {/if} + {/each} + + + + + + + + {/snippet}
    From c2d1c0dbeb71c53af24d534545b4ee02dae4c3ca Mon Sep 17 00:00:00 2001 From: WarningImHack3r <43064022+WarningImHack3r@users.noreply.github.com> Date: Sat, 1 Feb 2025 21:12:19 +0100 Subject: [PATCH 4/8] Remove useless shadcn components --- .../ui/alert-dialog/alert-dialog-portal.svelte | 9 --------- src/lib/components/ui/dialog/dialog-portal.svelte | 8 -------- .../ui/dropdown-menu/dropdown-menu-radio-group.svelte | 11 ----------- 3 files changed, 28 deletions(-) delete mode 100644 src/lib/components/ui/alert-dialog/alert-dialog-portal.svelte delete mode 100644 src/lib/components/ui/dialog/dialog-portal.svelte delete mode 100644 src/lib/components/ui/dropdown-menu/dropdown-menu-radio-group.svelte diff --git a/src/lib/components/ui/alert-dialog/alert-dialog-portal.svelte b/src/lib/components/ui/alert-dialog/alert-dialog-portal.svelte deleted file mode 100644 index e227219..0000000 --- a/src/lib/components/ui/alert-dialog/alert-dialog-portal.svelte +++ /dev/null @@ -1,9 +0,0 @@ - - - - - diff --git a/src/lib/components/ui/dialog/dialog-portal.svelte b/src/lib/components/ui/dialog/dialog-portal.svelte deleted file mode 100644 index eb5d0a5..0000000 --- a/src/lib/components/ui/dialog/dialog-portal.svelte +++ /dev/null @@ -1,8 +0,0 @@ - - - - - diff --git a/src/lib/components/ui/dropdown-menu/dropdown-menu-radio-group.svelte b/src/lib/components/ui/dropdown-menu/dropdown-menu-radio-group.svelte deleted file mode 100644 index 1c74ae1..0000000 --- a/src/lib/components/ui/dropdown-menu/dropdown-menu-radio-group.svelte +++ /dev/null @@ -1,11 +0,0 @@ - - - - - From a98493f58992da8928c072c40513848d1bc98696 Mon Sep 17 00:00:00 2001 From: WarningImHack3r <43064022+WarningImHack3r@users.noreply.github.com> Date: Sat, 1 Feb 2025 22:10:50 +0100 Subject: [PATCH 5/8] Runes migration --- src/lib/components/Snowflakes.svelte | 17 +- src/lib/components/days/2023/Day1.svelte | 102 ++++++----- src/lib/components/days/2023/Day11.svelte | 16 +- src/lib/components/days/2023/Day15.svelte | 16 +- src/lib/components/days/2023/Day2.svelte | 8 +- src/lib/components/days/2023/Day3.svelte | 80 +++++---- src/lib/components/days/2023/Day4.svelte | 4 +- src/lib/components/days/2023/Day5.svelte | 112 ++++++------ src/lib/components/days/2023/Day6.svelte | 15 +- src/lib/components/days/2023/Day7.svelte | 25 +-- src/lib/components/days/2023/Day8.svelte | 4 +- src/lib/components/days/2023/Day9.svelte | 8 +- src/routes/+layout.svelte | 119 +++++++------ src/routes/2023/+page.svelte | 8 +- src/routes/2023/diy/+page.svelte | 6 +- src/routes/2023/diy/card-creator/+page.svelte | 148 ++++++++------- .../2023/diy/snow-globe-creator/+page.svelte | 26 +-- src/routes/2023/memory-game/+page.svelte | 168 ++++++++++-------- .../2023/productivity-dashboard/+page.svelte | 27 +-- 19 files changed, 506 insertions(+), 403 deletions(-) diff --git a/src/lib/components/Snowflakes.svelte b/src/lib/components/Snowflakes.svelte index 36dced2..e65fb58 100644 --- a/src/lib/components/Snowflakes.svelte +++ b/src/lib/components/Snowflakes.svelte @@ -1,4 +1,4 @@ - - + - + diff --git a/src/lib/components/days/2023/Day1.svelte b/src/lib/components/days/2023/Day1.svelte index 6e7d3b3..5b030ee 100644 --- a/src/lib/components/days/2023/Day1.svelte +++ b/src/lib/components/days/2023/Day1.svelte @@ -8,9 +8,13 @@ import * as Command from "$lib/components/ui/command"; import * as Popover from "$lib/components/ui/popover"; - export let kids: Promise<{ name: string; tally: number }[]>; - let search = ""; - let open = false; + type Props = { + kids: Promise<{ name: string; tally: number }[]>; + }; + + let { kids }: Props = $props(); + let search = $state(""); + let open = $state(false); // We want to refocus the trigger button when the user selects // an item from the list so users can continue navigating the @@ -43,51 +47,55 @@
{:then kids} - - -
- -

- - {kids.filter(f => f.tally > 0).length} - - nice children •{" "} - - {kids.filter(f => f.tally < 0).length} - naughty children -

-
-
- - - - No child found. - - {#each kids as kid} - { - search = currentValue; - closeAndFocusTrigger(ids.trigger); - }} + + {#snippet children({ ids })} + + {#snippet children({ builder })} +
+ +

+ + {kids.filter(f => f.tally > 0).length} + + nice children •{" "} + + {kids.filter(f => f.tally < 0).length} + naughty children +

+
+ {/snippet} +
+ + + + No child found. + + {#each kids as kid} + { + search = currentValue; + closeAndFocusTrigger(ids.trigger); + }} + > + + {kid.name} + {kid.tally} + + {/each} + + + + {/snippet}
{#if search} {@const tally = kids.find(f => f.name === search)?.tally ?? 0} diff --git a/src/lib/components/days/2023/Day11.svelte b/src/lib/components/days/2023/Day11.svelte index b0d34d6..8140bd7 100644 --- a/src/lib/components/days/2023/Day11.svelte +++ b/src/lib/components/days/2023/Day11.svelte @@ -7,13 +7,9 @@ let firstNames: string[] = []; let lastNames: string[] = []; - let realName = ""; - $: if (realName) { - error = ""; - elfName = ""; - } - let error = ""; - let elfName = ""; + let realName = $state(""); + let error = $state(""); + let elfName = $state(""); function generateName() { const [firstName, lastName] = realName.split(" "); @@ -62,7 +58,7 @@
{ + onsubmit={e => { e.preventDefault(); if (realName.length < 1) { @@ -80,6 +76,10 @@ placeholder="Your first and last name" class="flex-1 bg-background" bind:value={realName} + oninput={() => { + error = ""; + elfName = ""; + }} />