chore(example): fix SvelteKit example (#1742)

* refactor: upgrade Svelte, Vite and related packages

* refactor: replace no longer supported `body.callbackURL` with `onSuccess`

* fix: add missing `svelte-kit sync` on `prepare`

* fix: add missing `import`s

* chore(svelte-kit-example): show message & redirect to index after sign up

* chore: add npm script to migrate database

* doc: add more commands to set up

* chore: explicitly disable verification email on sign up

The example does not work if you set `sendOnSignUp: true` without setting up the email server.

* refactor(svelte-kit-example): add type for hooks

* chore(svelte-kit-example): redirect to sign in page if users open dashboard without log in

* chore: diable some rules for svelte-kit-example due to Biome's limited Svelte support

* style: fix format

* chore: update pnpm-lock.yaml

* chore: fix lock file

---------

Co-authored-by: Bereket Engida <Bekacru@gmail.com>
This commit is contained in:
Jumpei Ogawa
2025-07-26 05:32:17 +09:00
committed by GitHub
parent f99305b29e
commit 40cefe99b1
73 changed files with 628 additions and 472 deletions

View File

@@ -27,6 +27,18 @@
} }
} }
}, },
"overrides": [
{
"include": ["examples/svelte-kit-example/**"],
"linter": {
"rules": {
"correctness": {
"noUnusedImports": "off"
}
}
}
}
],
"files": { "files": {
"ignore": [ "ignore": [
"dist", "dist",

View File

@@ -19,3 +19,8 @@ Thumbs.db
# Vite # Vite
vite.config.js.timestamp-* vite.config.js.timestamp-*
vite.config.ts.timestamp-* vite.config.ts.timestamp-*
# You cannot create root page under (protected)/ route
# because it is not protected by authwall.
./src/routes/(protected)/+page.*
./src/routes/(protected)/+server.*

View File

@@ -12,7 +12,11 @@ Email & Password . <u>Social Sign-in with Google</u> . Passkeys . Email Verifica
2. Move .env.example to .env and provide necessary variables 2. Move .env.example to .env and provide necessary variables
3. Run the following commands 3. Run the following commands
```bash ```bash
cd /path/to/better-auth/ # Project root of this better-auth repo, not the root of this example
pnpm install pnpm install
pnpm build
cd ./examples/svelte-kit-example/ # The root of this example project
pnpm migrate
pnpm dev pnpm dev
``` ```
4. Open the browser and navigate to `http://localhost:3000` 4. Open the browser and navigate to `http://localhost:3000`

View File

@@ -5,21 +5,24 @@
"scripts": { "scripts": {
"dev": "vite dev --port 3000", "dev": "vite dev --port 3000",
"build": "vite build", "build": "vite build",
"migrate": "pnpx @better-auth/cli migrate",
"preview": "vite preview", "preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json", "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch" "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"prepare": "svelte-kit sync"
}, },
"devDependencies": { "devDependencies": {
"@sveltejs/adapter-auto": "^3.3.1", "@better-auth/cli": "workspace:*",
"@sveltejs/adapter-auto": "^4.0.0",
"@sveltejs/kit": "^2.9.0", "@sveltejs/kit": "^2.9.0",
"@sveltejs/vite-plugin-svelte": "^3.1.2", "@sveltejs/vite-plugin-svelte": "^5.0.3",
"@tailwindcss/typography": "^0.5.15", "@tailwindcss/typography": "^0.5.15",
"autoprefixer": "^10.4.20", "autoprefixer": "^10.4.20",
"svelte": "^4.2.19", "svelte": "^5.22.5",
"svelte-check": "^4.1.1", "svelte-check": "^4.1.1",
"tailwindcss": "^3.4.16", "tailwindcss": "^3.4.16",
"typescript": "^5.7.2", "typescript": "^5.7.2",
"vite": "^5.4.19" "vite": "^6.3.0"
}, },
"type": "module", "type": "module",
"dependencies": { "dependencies": {
@@ -34,7 +37,7 @@
"formsnap": "^1.0.1", "formsnap": "^1.0.1",
"mode-watcher": "^0.4.1", "mode-watcher": "^0.4.1",
"paneforge": "^0.0.6", "paneforge": "^0.0.6",
"svelte-radix": "^1.1.1", "svelte-radix": "^2.0.1",
"svelte-sonner": "^0.3.28", "svelte-sonner": "^0.3.28",
"sveltekit-superforms": "^2.21.1", "sveltekit-superforms": "^2.21.1",
"tailwind-merge": "^2.5.5", "tailwind-merge": "^2.5.5",

View File

@@ -2,8 +2,11 @@
// for information about these interfaces // for information about these interfaces
declare global { declare global {
namespace App { namespace App {
interface Locals {
session?: Session;
user?: User;
}
// interface Error {} // interface Error {}
// interface Locals {}
// interface PageData {} // interface PageData {}
// interface PageState {} // interface PageState {}
// interface Platform {} // interface Platform {}

View File

@@ -1,6 +1,22 @@
import { auth } from "$lib/auth"; import { auth } from "$lib/auth";
import { redirect, type Handle } from "@sveltejs/kit";
import { svelteKitHandler } from "better-auth/svelte-kit"; import { svelteKitHandler } from "better-auth/svelte-kit";
export async function handle({ event, resolve }) { export const handle: Handle = async ({ event, resolve }) => {
if (event.route.id?.startsWith("/(protected)/")) {
const session = await auth.api.getSession({
headers: event.request.headers,
});
if (session) {
event.locals.session = session?.session;
event.locals.user = session?.user;
return svelteKitHandler({ event, resolve, auth }); return svelteKitHandler({ event, resolve, auth });
} } else {
redirect(307, "/sign-in");
}
} else {
return svelteKitHandler({ event, resolve, auth });
}
};

View File

@@ -16,4 +16,10 @@ export const auth = betterAuth({
console.log("Reset password url:", url); console.log("Reset password url:", url);
}, },
}, },
emailVerification: {
sendOnSignUp: false, // TODO enable this option to send email to the user on sign up
// sendVerificationEmail: async ({ user, url, token }, request) => {
// // TODO add function(s) to send verification email.
// },
},
}); });

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { AlertDialog as AlertDialogPrimitive } from "bits-ui"; import { AlertDialog as AlertDialogPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = AlertDialogPrimitive.CancelProps; type $$Props = AlertDialogPrimitive.CancelProps;
type $$Events = AlertDialogPrimitive.CancelEvents; type $$Events = AlertDialogPrimitive.CancelEvents;

View File

@@ -1,6 +1,8 @@
<script lang="ts"> <script lang="ts">
import { AlertDialog as AlertDialogPrimitive } from "bits-ui"; import { AlertDialog as AlertDialogPrimitive } from "bits-ui";
import { flyAndScale } from "$lib/utils.js"; import { cn, flyAndScale } from "$lib/utils.js";
import AlertDialogOverlay from "./alert-dialog-overlay.svelte";
import AlertDialogPortal from "./alert-dialog-portal.svelte";
type $$Props = AlertDialogPrimitive.ContentProps; type $$Props = AlertDialogPrimitive.ContentProps;
@@ -10,8 +12,8 @@ export let transitionConfig: $$Props["transitionConfig"] = undefined;
export { className as class }; export { className as class };
</script> </script>
<AlertDialog.Portal> <AlertDialogPortal>
<AlertDialog.Overlay /> <AlertDialogOverlay />
<AlertDialogPrimitive.Content <AlertDialogPrimitive.Content
{transition} {transition}
{transitionConfig} {transitionConfig}
@@ -23,4 +25,4 @@ export { className as class };
> >
<slot /> <slot />
</AlertDialogPrimitive.Content> </AlertDialogPrimitive.Content>
</AlertDialog.Portal> </AlertDialogPortal>

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Avatar as AvatarPrimitive } from "bits-ui"; import { Avatar as AvatarPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = AvatarPrimitive.FallbackProps; type $$Props = AvatarPrimitive.FallbackProps;

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Avatar as AvatarPrimitive } from "bits-ui"; import { Avatar as AvatarPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = AvatarPrimitive.ImageProps; type $$Props = AvatarPrimitive.ImageProps;

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Avatar as AvatarPrimitive } from "bits-ui"; import { Avatar as AvatarPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = AvatarPrimitive.Props; type $$Props = AvatarPrimitive.Props;

View File

@@ -1,5 +1,7 @@
<script lang="ts"> <script lang="ts">
import { type Events, type Props } from "./index.js"; import { Button as ButtonPrimitive } from "bits-ui";
import { buttonVariants, type Events, type Props } from "./index.js";
import { cn } from "$lib/utils.js";
type $$Props = Props; type $$Props = Props;
type $$Events = Events; type $$Events = Events;

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Calendar as CalendarPrimitive } from "bits-ui"; import { Calendar as CalendarPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = CalendarPrimitive.NextButtonProps; type $$Props = CalendarPrimitive.NextButtonProps;
type $$Events = CalendarPrimitive.NextButtonEvents; type $$Events = CalendarPrimitive.NextButtonEvents;

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Calendar as CalendarPrimitive } from "bits-ui"; import { Calendar as CalendarPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = CalendarPrimitive.PrevButtonProps; type $$Props = CalendarPrimitive.PrevButtonProps;
type $$Events = CalendarPrimitive.PrevButtonEvents; type $$Events = CalendarPrimitive.PrevButtonEvents;

View File

@@ -1,5 +1,18 @@
<script lang="ts"> <script lang="ts">
import { Calendar as CalendarPrimitive } from "bits-ui"; import { Calendar as CalendarPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
import CalendarCell from "./calendar-cell.svelte";
import CalendarDay from "./calendar-day.svelte";
import CalendarGridBody from "./calendar-grid-body.svelte";
import CalendarGridHead from "./calendar-grid-head.svelte";
import CalendarGridRow from "./calendar-grid-row.svelte";
import CalendarGrid from "./calendar-grid.svelte";
import CalendarHeadCell from "./calendar-head-cell.svelte";
import CalendarHeader from "./calendar-header.svelte";
import CalendarHeading from "./calendar-heading.svelte";
import CalendarMonths from "./calendar-months.svelte";
import CalendarNextButton from "./calendar-next-button.svelte";
import CalendarPrevButton from "./calendar-prev-button.svelte";
type $$Props = CalendarPrimitive.Props; type $$Props = CalendarPrimitive.Props;
type $$Events = CalendarPrimitive.Events; type $$Events = CalendarPrimitive.Events;
@@ -22,35 +35,35 @@ export { className as class };
let:months let:months
let:weekdays let:weekdays
> >
<Calendar.Header> <CalendarHeader>
<Calendar.PrevButton /> <CalendarPrevButton />
<Calendar.Heading /> <CalendarHeading />
<Calendar.NextButton /> <CalendarNextButton />
</Calendar.Header> </CalendarHeader>
<Calendar.Months> <CalendarMonths>
{#each months as month} {#each months as month}
<Calendar.Grid> <CalendarGrid>
<Calendar.GridHead> <CalendarGridHead>
<Calendar.GridRow class="flex"> <CalendarGridRow class="flex">
{#each weekdays as weekday} {#each weekdays as weekday}
<Calendar.HeadCell> <CalendarHeadCell>
{weekday.slice(0, 2)} {weekday.slice(0, 2)}
</Calendar.HeadCell> </CalendarHeadCell>
{/each} {/each}
</Calendar.GridRow> </CalendarGridRow>
</Calendar.GridHead> </CalendarGridHead>
<Calendar.GridBody> <CalendarGridBody>
{#each month.weeks as weekDates} {#each month.weeks as weekDates}
<Calendar.GridRow class="mt-2 w-full"> <CalendarGridRow class="mt-2 w-full">
{#each weekDates as date} {#each weekDates as date}
<Calendar.Cell {date}> <CalendarCell {date}>
<Calendar.Day {date} month={month.value} /> <CalendarDay {date} month={month.value} />
</Calendar.Cell> </CalendarCell>
{/each} {/each}
</Calendar.GridRow> </CalendarGridRow>
{/each} {/each}
</Calendar.GridBody> </CalendarGridBody>
</Calendar.Grid> </CalendarGrid>
{/each} {/each}
</Calendar.Months> </CalendarMonths>
</CalendarPrimitive.Root> </CalendarPrimitive.Root>

View File

@@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import { cn } from "$lib/utils.js";
import type { HTMLAttributes } from "svelte/elements"; import type { HTMLAttributes } from "svelte/elements";
type $$Props = HTMLAttributes<HTMLDivElement>; type $$Props = HTMLAttributes<HTMLDivElement>;

View File

@@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import { cn } from "$lib/utils.js";
import type { HTMLAttributes } from "svelte/elements"; import type { HTMLAttributes } from "svelte/elements";
type $$Props = HTMLAttributes<HTMLParagraphElement>; type $$Props = HTMLAttributes<HTMLParagraphElement>;

View File

@@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import { cn } from "$lib/utils.js";
import type { HTMLAttributes } from "svelte/elements"; import type { HTMLAttributes } from "svelte/elements";
type $$Props = HTMLAttributes<HTMLDivElement>; type $$Props = HTMLAttributes<HTMLDivElement>;

View File

@@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import { cn } from "$lib/utils.js";
import type { HTMLAttributes } from "svelte/elements"; import type { HTMLAttributes } from "svelte/elements";
type $$Props = HTMLAttributes<HTMLDivElement>; type $$Props = HTMLAttributes<HTMLDivElement>;

View File

@@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import { cn } from "$lib/utils.js";
import type { HTMLAttributes } from "svelte/elements"; import type { HTMLAttributes } from "svelte/elements";
import type { HeadingLevel } from "./index.js"; import type { HeadingLevel } from "./index.js";

View File

@@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import { cn } from "$lib/utils.js";
import type { HTMLAttributes } from "svelte/elements"; import type { HTMLAttributes } from "svelte/elements";
type $$Props = HTMLAttributes<HTMLDivElement>; type $$Props = HTMLAttributes<HTMLDivElement>;

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { ContextMenu as ContextMenuPrimitive } from "bits-ui"; import { ContextMenu as ContextMenuPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = ContextMenuPrimitive.CheckboxItemProps; type $$Props = ContextMenuPrimitive.CheckboxItemProps;
type $$Events = ContextMenuPrimitive.CheckboxItemEvents; type $$Events = ContextMenuPrimitive.CheckboxItemEvents;

View File

@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { ContextMenu as ContextMenuPrimitive } from "bits-ui"; import { ContextMenu as ContextMenuPrimitive } from "bits-ui";
import { flyAndScale } from "$lib/utils.js"; import { cn, flyAndScale } from "$lib/utils.js";
type $$Props = ContextMenuPrimitive.ContentProps; type $$Props = ContextMenuPrimitive.ContentProps;

View File

@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { ContextMenu as ContextMenuPrimitive } from "bits-ui"; import { ContextMenu as ContextMenuPrimitive } from "bits-ui";
import { flyAndScale } from "$lib/utils.js"; import { cn, flyAndScale } from "$lib/utils.js";
type $$Props = ContextMenuPrimitive.SubContentProps; type $$Props = ContextMenuPrimitive.SubContentProps;

View File

@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Dialog as DialogPrimitive } from "bits-ui"; import { Dialog as DialogPrimitive } from "bits-ui";
import { flyAndScale } from "$lib/utils.js"; import { cn, flyAndScale } from "$lib/utils.js";
type $$Props = DialogPrimitive.ContentProps; type $$Props = DialogPrimitive.ContentProps;

View File

@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { DropdownMenu as DropdownMenuPrimitive } from "bits-ui"; import { DropdownMenu as DropdownMenuPrimitive } from "bits-ui";
import { flyAndScale } from "$lib/utils.js"; import { cn, flyAndScale } from "$lib/utils.js";
type $$Props = DropdownMenuPrimitive.ContentProps; type $$Props = DropdownMenuPrimitive.ContentProps;

View File

@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { DropdownMenu as DropdownMenuPrimitive } from "bits-ui"; import { DropdownMenu as DropdownMenuPrimitive } from "bits-ui";
import { flyAndScale } from "$lib/utils.js"; import { cn, flyAndScale } from "$lib/utils.js";
type $$Props = DropdownMenuPrimitive.SubContentProps; type $$Props = DropdownMenuPrimitive.SubContentProps;

View File

@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { LinkPreview as HoverCardPrimitive } from "bits-ui"; import { LinkPreview as HoverCardPrimitive } from "bits-ui";
import { flyAndScale } from "$lib/utils.js"; import { cn, flyAndScale } from "$lib/utils.js";
type $$Props = HoverCardPrimitive.ContentProps; type $$Props = HoverCardPrimitive.ContentProps;

View File

@@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import { cn } from "$lib/utils.js";
import type { HTMLInputAttributes } from "svelte/elements"; import type { HTMLInputAttributes } from "svelte/elements";
import type { InputEvents } from "./index.js"; import type { InputEvents } from "./index.js";

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Label as LabelPrimitive } from "bits-ui"; import { Label as LabelPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = LabelPrimitive.Props; type $$Props = LabelPrimitive.Props;

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Menubar as MenubarPrimitive } from "bits-ui"; import { Menubar as MenubarPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = MenubarPrimitive.CheckboxItemProps; type $$Props = MenubarPrimitive.CheckboxItemProps;
let className: $$Props["class"] = undefined; let className: $$Props["class"] = undefined;

View File

@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Menubar as MenubarPrimitive } from "bits-ui"; import { Menubar as MenubarPrimitive } from "bits-ui";
import { flyAndScale } from "$lib/utils.js"; import { cn, flyAndScale } from "$lib/utils.js";
type $$Props = MenubarPrimitive.ContentProps; type $$Props = MenubarPrimitive.ContentProps;
let className: $$Props["class"] = undefined; let className: $$Props["class"] = undefined;

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Menubar as MenubarPrimitive } from "bits-ui"; import { Menubar as MenubarPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = MenubarPrimitive.ItemProps & { type $$Props = MenubarPrimitive.ItemProps & {
inset?: boolean; inset?: boolean;

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Menubar as MenubarPrimitive } from "bits-ui"; import { Menubar as MenubarPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = MenubarPrimitive.LabelProps & { type $$Props = MenubarPrimitive.LabelProps & {
inset?: boolean; inset?: boolean;

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Menubar as MenubarPrimitive } from "bits-ui"; import { Menubar as MenubarPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = MenubarPrimitive.RadioItemProps; type $$Props = MenubarPrimitive.RadioItemProps;
type $$Events = MenubarPrimitive.RadioItemEvents; type $$Events = MenubarPrimitive.RadioItemEvents;

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Menubar as MenubarPrimitive } from "bits-ui"; import { Menubar as MenubarPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = MenubarPrimitive.SeparatorProps; type $$Props = MenubarPrimitive.SeparatorProps;
let className: $$Props["class"] = undefined; let className: $$Props["class"] = undefined;

View File

@@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import { cn } from "$lib/utils.js";
import type { HTMLAttributes } from "svelte/elements"; import type { HTMLAttributes } from "svelte/elements";
type $$Props = HTMLAttributes<HTMLSpanElement>; type $$Props = HTMLAttributes<HTMLSpanElement>;

View File

@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Menubar as MenubarPrimitive } from "bits-ui"; import { Menubar as MenubarPrimitive } from "bits-ui";
import { flyAndScale } from "$lib/utils.js"; import { cn, flyAndScale } from "$lib/utils.js";
type $$Props = MenubarPrimitive.SubContentProps; type $$Props = MenubarPrimitive.SubContentProps;
let className: $$Props["class"] = undefined; let className: $$Props["class"] = undefined;

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Menubar as MenubarPrimitive } from "bits-ui"; import { Menubar as MenubarPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = MenubarPrimitive.SubTriggerProps & { type $$Props = MenubarPrimitive.SubTriggerProps & {
inset?: boolean; inset?: boolean;

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Menubar as MenubarPrimitive } from "bits-ui"; import { Menubar as MenubarPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = MenubarPrimitive.TriggerProps; type $$Props = MenubarPrimitive.TriggerProps;
type $$Events = MenubarPrimitive.TriggerEvents; type $$Events = MenubarPrimitive.TriggerEvents;

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Menubar as MenubarPrimitive } from "bits-ui"; import { Menubar as MenubarPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = MenubarPrimitive.Props; type $$Props = MenubarPrimitive.Props;

View File

@@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import { cn } from "$lib/utils.js";
import type { HTMLAttributes } from "svelte/elements"; import type { HTMLAttributes } from "svelte/elements";
type $$Props = HTMLAttributes<HTMLUListElement>; type $$Props = HTMLAttributes<HTMLUListElement>;

View File

@@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import { cn } from "$lib/utils.js";
import type { HTMLAttributes } from "svelte/elements"; import type { HTMLAttributes } from "svelte/elements";
type $$Props = HTMLAttributes<HTMLSpanElement>; type $$Props = HTMLAttributes<HTMLSpanElement>;

View File

@@ -1,4 +1,5 @@
<script lang="ts"> <script lang="ts">
import { cn } from "$lib/utils.js";
import type { HTMLAttributes } from "svelte/elements"; import type { HTMLAttributes } from "svelte/elements";
type $$Props = HTMLAttributes<HTMLLIElement>; type $$Props = HTMLAttributes<HTMLLIElement>;

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Pagination as PaginationPrimitive } from "bits-ui"; import { Pagination as PaginationPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
import { type Props } from "$lib/components/ui/button/index.js"; import { type Props } from "$lib/components/ui/button/index.js";
type $$Props = PaginationPrimitive.PageProps & type $$Props = PaginationPrimitive.PageProps &

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Pagination as PaginationPrimitive } from "bits-ui"; import { Pagination as PaginationPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = PaginationPrimitive.Props; type $$Props = PaginationPrimitive.Props;
type $$Events = PaginationPrimitive.Events; type $$Events = PaginationPrimitive.Events;

View File

@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Popover as PopoverPrimitive } from "bits-ui"; import { Popover as PopoverPrimitive } from "bits-ui";
import { flyAndScale } from "$lib/utils.js"; import { cn, flyAndScale } from "$lib/utils.js";
type $$Props = PopoverPrimitive.ContentProps; type $$Props = PopoverPrimitive.ContentProps;

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Progress as ProgressPrimitive } from "bits-ui"; import { Progress as ProgressPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = ProgressPrimitive.Props; type $$Props = ProgressPrimitive.Props;

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { RadioGroup as RadioGroupPrimitive } from "bits-ui"; import { RadioGroup as RadioGroupPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = RadioGroupPrimitive.ItemProps & { type $$Props = RadioGroupPrimitive.ItemProps & {
value: string; value: string;

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { RadioGroup as RadioGroupPrimitive } from "bits-ui"; import { RadioGroup as RadioGroupPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = RadioGroupPrimitive.Props; type $$Props = RadioGroupPrimitive.Props;

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui"; import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = RangeCalendarPrimitive.CellProps; type $$Props = RangeCalendarPrimitive.CellProps;

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui"; import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = RangeCalendarPrimitive.DayProps; type $$Props = RangeCalendarPrimitive.DayProps;
type $$Events = RangeCalendarPrimitive.DayEvents; type $$Events = RangeCalendarPrimitive.DayEvents;

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui"; import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = RangeCalendarPrimitive.GridBodyProps; type $$Props = RangeCalendarPrimitive.GridBodyProps;

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui"; import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = RangeCalendarPrimitive.GridHeadProps; type $$Props = RangeCalendarPrimitive.GridHeadProps;

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui"; import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = RangeCalendarPrimitive.GridRowProps; type $$Props = RangeCalendarPrimitive.GridRowProps;

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui"; import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = RangeCalendarPrimitive.GridProps; type $$Props = RangeCalendarPrimitive.GridProps;

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui"; import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = RangeCalendarPrimitive.HeadCellProps; type $$Props = RangeCalendarPrimitive.HeadCellProps;

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui"; import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = RangeCalendarPrimitive.HeaderProps; type $$Props = RangeCalendarPrimitive.HeaderProps;

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui"; import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = RangeCalendarPrimitive.HeadingProps; type $$Props = RangeCalendarPrimitive.HeadingProps;

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import type { HTMLAttributes } from "svelte/elements"; import type { HTMLAttributes } from "svelte/elements";
import { cn } from "$lib/utils.js";
type $$Props = HTMLAttributes<HTMLDivElement>; type $$Props = HTMLAttributes<HTMLDivElement>;

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui"; import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = RangeCalendarPrimitive.NextButtonProps; type $$Props = RangeCalendarPrimitive.NextButtonProps;
type $$Events = RangeCalendarPrimitive.NextButtonEvents; type $$Events = RangeCalendarPrimitive.NextButtonEvents;

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui"; import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = RangeCalendarPrimitive.PrevButtonProps; type $$Props = RangeCalendarPrimitive.PrevButtonProps;
type $$Events = RangeCalendarPrimitive.PrevButtonEvents; type $$Events = RangeCalendarPrimitive.PrevButtonEvents;

View File

@@ -1,5 +1,6 @@
<script lang="ts"> <script lang="ts">
import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui"; import { RangeCalendar as RangeCalendarPrimitive } from "bits-ui";
import { cn } from "$lib/utils.js";
type $$Props = RangeCalendarPrimitive.Props; type $$Props = RangeCalendarPrimitive.Props;
type $$Events = RangeCalendarPrimitive.Events; type $$Events = RangeCalendarPrimitive.Events;

View File

@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { Select as SelectPrimitive } from "bits-ui"; import { Select as SelectPrimitive } from "bits-ui";
import { scale } from "svelte/transition"; import { scale } from "svelte/transition";
import { flyAndScale } from "$lib/utils.js"; import { cn, flyAndScale } from "$lib/utils.js";
type $$Props = SelectPrimitive.ContentProps; type $$Props = SelectPrimitive.ContentProps;

View File

@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { Tooltip as TooltipPrimitive } from "bits-ui"; import { Tooltip as TooltipPrimitive } from "bits-ui";
import { flyAndScale } from "$lib/utils.js"; import { cn, flyAndScale } from "$lib/utils.js";
type $$Props = TooltipPrimitive.ContentProps; type $$Props = TooltipPrimitive.ContentProps;

View File

@@ -1,7 +1,15 @@
<script> <script>
import { goto } from "$app/navigation";
import { client } from "$lib/auth-client"; import { client } from "$lib/auth-client";
import * as Avatar from "$lib/components/ui/avatar";
import { Button } from "$lib/components/ui/button";
import * as Card from "$lib/components/ui/card";
const session = client.useSession(); const session = client.useSession();
if (!session) {
goto("/sign-in");
}
</script> </script>
<Card.Root class="w-[350px]"> <Card.Root class="w-[350px]">
@@ -33,9 +41,7 @@ const session = client.useSession();
on:click={() => { on:click={() => {
client.signOut({ client.signOut({
fetchOptions: { fetchOptions: {
body: { onSuccess: () => goto("/auth"),
callbackURL: "/",
},
}, },
}); });
}}>Sign Out</Button }}>Sign Out</Button

View File

@@ -1,5 +1,7 @@
<script> <script>
import { client } from "$lib/auth-client"; import { client } from "$lib/auth-client";
import Button from "$lib/components/ui/button/button.svelte";
const features = [ const features = [
"social sign-in", "social sign-in",
"email and password", "email and password",

View File

@@ -1,5 +1,10 @@
<script lang="ts"> <script lang="ts">
import { writable } from "svelte/store"; import { writable } from "svelte/store";
import { client } from "$lib/auth-client.js";
import { Button } from "$lib/components/ui/button";
import * as Card from "$lib/components/ui/card";
import { Input } from "$lib/components/ui/input";
import { Label } from "$lib/components/ui/label";
const email = writable(""); const email = writable("");
</script> </script>

View File

@@ -1,5 +1,10 @@
<script> <script>
import { writable } from "svelte/store"; import { writable } from "svelte/store";
import { client } from "$lib/auth-client.js";
import { Button } from "$lib/components/ui/button";
import * as Card from "$lib/components/ui/card";
import { Input } from "$lib/components/ui/input";
import { Label } from "$lib/components/ui/label";
const confirmPassword = writable(""); const confirmPassword = writable("");
const password = writable(""); const password = writable("");

View File

@@ -1,6 +1,10 @@
<script lang="ts"> <script lang="ts">
import { signIn } from "$lib/auth-client"; import { signIn } from "$lib/auth-client";
import { writable } from "svelte/store"; import { writable } from "svelte/store";
import { Button } from "$lib/components/ui/button";
import * as Card from "$lib/components/ui/card";
import { Input } from "$lib/components/ui/input";
import { Label } from "$lib/components/ui/label";
const email = writable(""); const email = writable("");
const password = writable(""); const password = writable("");

View File

@@ -1,6 +1,11 @@
<script lang="ts"> <script lang="ts">
import { goto } from "$app/navigation";
import { signUp } from "$lib/auth-client"; import { signUp } from "$lib/auth-client";
import { writable } from "svelte/store"; import { writable } from "svelte/store";
import { Button } from "$lib/components/ui/button";
import * as Card from "$lib/components/ui/card";
import { Input } from "$lib/components/ui/input";
import { Label } from "$lib/components/ui/label";
// Create writable stores for form fields // Create writable stores for form fields
const firstName = writable(""); const firstName = writable("");
@@ -22,6 +27,10 @@ const handleSignUp = async () => {
name: `${user.firstName} ${user.lastName}`, name: `${user.firstName} ${user.lastName}`,
callbackURL: "/", callbackURL: "/",
fetchOptions: { fetchOptions: {
onSuccess() {
alert("Your account has been created.");
goto("/dashboard");
},
onError(context) { onError(context) {
alert(context.error.message); alert(context.error.message);
}, },

856
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff