Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ node_modules/
.temp/
*.tgz
.vscode/launch.json

# environment variables
**.env
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"scripts": {
"doc": "pnpm --filter @skeletonlabs/skeleton.dev",
"themes": "pnpm --filter @skeletonlabs/themes.skeleton.dev",
"plus": "pnpm --filter @skeletonlabs/plus.skeleton.dev",
"svelte": "pnpm --filter @skeletonlabs/playground-skeleton-svelte",
"react": "pnpm --filter @skeletonlabs/playground-skeleton-react",
"test": "vitest run",
Expand Down
149 changes: 148 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ catalog:
'@shikijs/transformers': 4.0.2
'@shikijs/types': 4.0.2
'@stackblitz/sdk': 1.11.0
'@supabase/ssr': 0.10.0
'@supabase/supabase-js': 2.101.1
'@sveltejs/adapter-auto': 7.0.1
'@sveltejs/adapter-vercel': 6.3.3
'@sveltejs/kit': 2.55.0
Expand Down
2 changes: 2 additions & 0 deletions sites/plus.skeleton.dev/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PUBLIC_SUPABASE_URL=
PUBLIC_SUPABASE_PUBLISHABLE_KEY=
29 changes: 29 additions & 0 deletions sites/plus.skeleton.dev/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "@skeletonlabs/plus.skeleton.dev",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "vite dev",
"build": "vite build",
"check": "svelte-check --tsconfig ./tsconfig.json",
"postinstall": "svelte-kit sync"
},
"devDependencies": {
"@skeletonlabs/skeleton": "workspace:*",
"@skeletonlabs/skeleton-svelte": "workspace:*",
"@supabase/ssr": "catalog:",
"@supabase/supabase-js": "catalog:",
"@sveltejs/adapter-auto": "^7.0.0",
"@sveltejs/kit": "^2.50.2",
"@sveltejs/vite-plugin-svelte": "^6.2.4",
"@tailwindcss/forms": "^0.5.11",
"@tailwindcss/vite": "^4.1.18",
"svelte": "^5.54.0",
"svelte-check": "^4.4.2",
"tailwindcss": "^4.1.18",
"typescript": "^5.9.3",
"vite": "^7.3.1",
"vite-plugin-transform-lucide-imports": "catalog:"
},
"type": "module"
}
21 changes: 21 additions & 0 deletions sites/plus.skeleton.dev/src/app.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { Session, SupabaseClient, User } from '@supabase/supabase-js';
import type { Database } from './database.types.ts';

declare global {
namespace App {
// interface Error {}
interface Locals {
supabase: SupabaseClient<Database>;
safeGetSession: () => Promise<{ session: Session | null; user: User | null }>;
session: Session | null;
user: User | null;
}
interface PageData {
session: Session | null;
}
// interface PageState {}
// interface Platform {}
}
}

export {};
12 changes: 12 additions & 0 deletions sites/plus.skeleton.dev/src/app.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="text-scale" content="scale" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>
56 changes: 56 additions & 0 deletions sites/plus.skeleton.dev/src/hooks.server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_PUBLISHABLE_KEY } from '$env/static/public';
import { createServerClient } from '@supabase/ssr';
import type { Handle } from '@sveltejs/kit';

export const handle: Handle = async ({ event, resolve }) => {
event.locals.supabase = createServerClient(PUBLIC_SUPABASE_URL, PUBLIC_SUPABASE_PUBLISHABLE_KEY, {
cookies: {
getAll() {
return event.cookies.getAll();
},
setAll(cookiesToSet, headers) {
/**
* Note: You have to add the `path` variable to the
* set and remove method due to sveltekit's cookie API
* requiring this to be set, setting the path to an empty string
* will replicate previous/standard behavior (https://kit.svelte.dev/docs/types#public-types-cookies)
*/
cookiesToSet.forEach(({ name, value, options }) => event.cookies.set(name, value, { ...options, path: '/' }));
if (Object.keys(headers).length > 0) {
event.setHeaders(headers);
}
},
},
});

/**
* Unlike `supabase.auth.getSession()`, which returns the session _without_
* validating the JWT, this function also calls `getUser()` to validate the
* JWT before returning the session.
*/
event.locals.safeGetSession = async () => {
const {
data: { session },
} = await event.locals.supabase.auth.getSession();
if (!session) {
return { session: null, user: null };
}

const {
data: { user },
error,
} = await event.locals.supabase.auth.getUser();
if (error) {
// JWT validation has failed
return { session: null, user: null };
}

return { session, user };
};

return resolve(event, {
filterSerializedResponseHeaders(name) {
return name === 'content-range' || name === 'x-supabase-api-version';
},
});
};
9 changes: 9 additions & 0 deletions sites/plus.skeleton.dev/src/routes/+layout.server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export const load = async (event) => {
const { session, user } = await event.locals.safeGetSession();

return {
session,
user,
cookies: event.cookies.getAll(),
};
};
7 changes: 7 additions & 0 deletions sites/plus.skeleton.dev/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<script lang="ts">
import './layout.css';
let { children } = $props();
</script>

{@render children()}
Loading
Loading