create-sidekick-app 0.0.0-stage → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +202 -0
- package/NOTICE +27 -0
- package/README.md +30 -2
- package/dist/index.js +59 -0
- package/package.json +69 -3
- package/template/base/ai-chat/.env.example +6 -0
- package/template/base/ai-chat/.prettierignore +2 -0
- package/template/base/ai-chat/.prettierrc.json +5 -0
- package/template/base/ai-chat/README.md +38 -0
- package/template/base/ai-chat/_gitignore +41 -0
- package/template/base/ai-chat/components.json +23 -0
- package/template/base/ai-chat/next.config.ts +5 -0
- package/template/base/ai-chat/package.json +61 -0
- package/template/base/ai-chat/postcss.config.mjs +5 -0
- package/template/base/ai-chat/src/app/api/chat/route.ts +141 -0
- package/template/base/ai-chat/src/app/api/instant/route.ts +5 -0
- package/template/base/ai-chat/src/app/chat/[id]/page.tsx +20 -0
- package/template/base/ai-chat/src/app/globals.css +124 -0
- package/template/base/ai-chat/src/app/layout.tsx +34 -0
- package/template/base/ai-chat/src/app/page.tsx +6 -0
- package/template/base/ai-chat/src/components/AuthGate.tsx +15 -0
- package/template/base/ai-chat/src/components/Chat.tsx +228 -0
- package/template/base/ai-chat/src/components/InstantProvider.tsx +18 -0
- package/template/base/ai-chat/src/components/Login.tsx +163 -0
- package/template/base/ai-chat/src/components/Sidebar.tsx +100 -0
- package/template/base/ai-chat/src/components/ai-elements/agent.tsx +142 -0
- package/template/base/ai-chat/src/components/ai-elements/artifact.tsx +149 -0
- package/template/base/ai-chat/src/components/ai-elements/attachments.tsx +427 -0
- package/template/base/ai-chat/src/components/ai-elements/audio-player.tsx +229 -0
- package/template/base/ai-chat/src/components/ai-elements/canvas.tsx +26 -0
- package/template/base/ai-chat/src/components/ai-elements/chain-of-thought.tsx +223 -0
- package/template/base/ai-chat/src/components/ai-elements/checkpoint.tsx +72 -0
- package/template/base/ai-chat/src/components/ai-elements/code-block.tsx +556 -0
- package/template/base/ai-chat/src/components/ai-elements/commit.tsx +449 -0
- package/template/base/ai-chat/src/components/ai-elements/confirmation.tsx +173 -0
- package/template/base/ai-chat/src/components/ai-elements/connection.tsx +28 -0
- package/template/base/ai-chat/src/components/ai-elements/context.tsx +410 -0
- package/template/base/ai-chat/src/components/ai-elements/controls.tsx +19 -0
- package/template/base/ai-chat/src/components/ai-elements/conversation.tsx +167 -0
- package/template/base/ai-chat/src/components/ai-elements/edge.tsx +144 -0
- package/template/base/ai-chat/src/components/ai-elements/environment-variables.tsx +325 -0
- package/template/base/ai-chat/src/components/ai-elements/file-tree.tsx +298 -0
- package/template/base/ai-chat/src/components/ai-elements/image.tsx +25 -0
- package/template/base/ai-chat/src/components/ai-elements/inline-citation.tsx +294 -0
- package/template/base/ai-chat/src/components/ai-elements/jsx-preview.tsx +250 -0
- package/template/base/ai-chat/src/components/ai-elements/message.tsx +356 -0
- package/template/base/ai-chat/src/components/ai-elements/mic-selector.tsx +372 -0
- package/template/base/ai-chat/src/components/ai-elements/model-selector.tsx +214 -0
- package/template/base/ai-chat/src/components/ai-elements/node.tsx +72 -0
- package/template/base/ai-chat/src/components/ai-elements/open-in-chat.tsx +367 -0
- package/template/base/ai-chat/src/components/ai-elements/package-info.tsx +235 -0
- package/template/base/ai-chat/src/components/ai-elements/panel.tsx +16 -0
- package/template/base/ai-chat/src/components/ai-elements/persona.tsx +280 -0
- package/template/base/ai-chat/src/components/ai-elements/plan.tsx +144 -0
- package/template/base/ai-chat/src/components/ai-elements/prompt-input.tsx +1341 -0
- package/template/base/ai-chat/src/components/ai-elements/queue.tsx +275 -0
- package/template/base/ai-chat/src/components/ai-elements/reasoning.tsx +229 -0
- package/template/base/ai-chat/src/components/ai-elements/sandbox.tsx +128 -0
- package/template/base/ai-chat/src/components/ai-elements/schema-display.tsx +473 -0
- package/template/base/ai-chat/src/components/ai-elements/shimmer.tsx +78 -0
- package/template/base/ai-chat/src/components/ai-elements/snippet.tsx +141 -0
- package/template/base/ai-chat/src/components/ai-elements/sources.tsx +78 -0
- package/template/base/ai-chat/src/components/ai-elements/speech-input.tsx +324 -0
- package/template/base/ai-chat/src/components/ai-elements/stack-trace.tsx +531 -0
- package/template/base/ai-chat/src/components/ai-elements/suggestion.tsx +55 -0
- package/template/base/ai-chat/src/components/ai-elements/task.tsx +88 -0
- package/template/base/ai-chat/src/components/ai-elements/terminal.tsx +277 -0
- package/template/base/ai-chat/src/components/ai-elements/test-results.tsx +497 -0
- package/template/base/ai-chat/src/components/ai-elements/tool.tsx +174 -0
- package/template/base/ai-chat/src/components/ai-elements/toolbar.tsx +17 -0
- package/template/base/ai-chat/src/components/ai-elements/transcription.tsx +126 -0
- package/template/base/ai-chat/src/components/ai-elements/voice-selector.tsx +525 -0
- package/template/base/ai-chat/src/components/ai-elements/web-preview.tsx +282 -0
- package/template/base/ai-chat/src/components/ui/accordion.tsx +66 -0
- package/template/base/ai-chat/src/components/ui/alert.tsx +66 -0
- package/template/base/ai-chat/src/components/ui/avatar.tsx +109 -0
- package/template/base/ai-chat/src/components/ui/badge.tsx +48 -0
- package/template/base/ai-chat/src/components/ui/button-group.tsx +83 -0
- package/template/base/ai-chat/src/components/ui/button.tsx +64 -0
- package/template/base/ai-chat/src/components/ui/card.tsx +92 -0
- package/template/base/ai-chat/src/components/ui/carousel.tsx +241 -0
- package/template/base/ai-chat/src/components/ui/collapsible.tsx +33 -0
- package/template/base/ai-chat/src/components/ui/command.tsx +184 -0
- package/template/base/ai-chat/src/components/ui/dialog.tsx +158 -0
- package/template/base/ai-chat/src/components/ui/dropdown-menu.tsx +257 -0
- package/template/base/ai-chat/src/components/ui/hover-card.tsx +44 -0
- package/template/base/ai-chat/src/components/ui/input-group.tsx +170 -0
- package/template/base/ai-chat/src/components/ui/input.tsx +21 -0
- package/template/base/ai-chat/src/components/ui/popover.tsx +89 -0
- package/template/base/ai-chat/src/components/ui/progress.tsx +31 -0
- package/template/base/ai-chat/src/components/ui/scroll-area.tsx +58 -0
- package/template/base/ai-chat/src/components/ui/select.tsx +190 -0
- package/template/base/ai-chat/src/components/ui/separator.tsx +28 -0
- package/template/base/ai-chat/src/components/ui/spinner.tsx +16 -0
- package/template/base/ai-chat/src/components/ui/switch.tsx +35 -0
- package/template/base/ai-chat/src/components/ui/tabs.tsx +91 -0
- package/template/base/ai-chat/src/components/ui/textarea.tsx +18 -0
- package/template/base/ai-chat/src/components/ui/tooltip.tsx +57 -0
- package/template/base/ai-chat/src/instant.perms.ts +34 -0
- package/template/base/ai-chat/src/instant.schema.ts +107 -0
- package/template/base/ai-chat/src/lib/adminDb.ts +8 -0
- package/template/base/ai-chat/src/lib/db.ts +8 -0
- package/template/base/ai-chat/src/lib/mockModel.ts +119 -0
- package/template/base/ai-chat/src/lib/utils.ts +6 -0
- package/template/base/ai-chat/tsconfig.json +33 -0
- package/template/base/bun-react/.env.example +2 -0
- package/template/base/bun-react/README.md +12 -0
- package/template/base/bun-react/_gitignore +34 -0
- package/template/base/bun-react/bun-env.d.ts +17 -0
- package/template/base/bun-react/bunfig.toml +4 -0
- package/template/base/bun-react/package.json +22 -0
- package/template/base/bun-react/src/App.tsx +168 -0
- package/template/base/bun-react/src/frontend.tsx +20 -0
- package/template/base/bun-react/src/getUnusedPort.ts +32 -0
- package/template/base/bun-react/src/index.css +25 -0
- package/template/base/bun-react/src/index.html +13 -0
- package/template/base/bun-react/src/index.ts +21 -0
- package/template/base/bun-react/src/instant.perms.ts +24 -0
- package/template/base/bun-react/src/instant.schema.ts +46 -0
- package/template/base/bun-react/src/lib/db.ts +8 -0
- package/template/base/bun-react/src/logo.svg +1 -0
- package/template/base/bun-react/tsconfig.json +36 -0
- package/template/base/expo/.env.example +2 -0
- package/template/base/expo/README.md +18 -0
- package/template/base/expo/_gitignore +41 -0
- package/template/base/expo/app/+not-found.tsx +16 -0
- package/template/base/expo/app/_layout.tsx +37 -0
- package/template/base/expo/app/index.tsx +64 -0
- package/template/base/expo/app.json +42 -0
- package/template/base/expo/assets/fonts/SpaceMono-Regular.ttf +0 -0
- package/template/base/expo/assets/images/adaptive-icon.png +0 -0
- package/template/base/expo/assets/images/favicon.png +0 -0
- package/template/base/expo/assets/images/icon.png +0 -0
- package/template/base/expo/assets/images/partial-react-logo.png +0 -0
- package/template/base/expo/assets/images/react-logo.png +0 -0
- package/template/base/expo/assets/images/react-logo@2x.png +0 -0
- package/template/base/expo/assets/images/react-logo@3x.png +0 -0
- package/template/base/expo/assets/images/splash-icon.png +0 -0
- package/template/base/expo/babel.config.js +12 -0
- package/template/base/expo/constants/Colors.ts +26 -0
- package/template/base/expo/eslint.config.js +10 -0
- package/template/base/expo/global.css +3 -0
- package/template/base/expo/hooks/useColorScheme.ts +1 -0
- package/template/base/expo/hooks/useColorScheme.web.ts +21 -0
- package/template/base/expo/hooks/useThemeColor.ts +21 -0
- package/template/base/expo/instant.perms.ts +24 -0
- package/template/base/expo/instant.schema.ts +44 -0
- package/template/base/expo/lib/db.ts +7 -0
- package/template/base/expo/metro.config.js +6 -0
- package/template/base/expo/nativewind-env.d.ts +1 -0
- package/template/base/expo/package.json +57 -0
- package/template/base/expo/scripts/reset-project.js +112 -0
- package/template/base/expo/tailwind.config.js +9 -0
- package/template/base/expo/tsconfig.json +18 -0
- package/template/base/next-js-app-dir/.env.example +2 -0
- package/template/base/next-js-app-dir/README.md +18 -0
- package/template/base/next-js-app-dir/_gitignore +41 -0
- package/template/base/next-js-app-dir/next.config.ts +7 -0
- package/template/base/next-js-app-dir/package.json +27 -0
- package/template/base/next-js-app-dir/postcss.config.mjs +5 -0
- package/template/base/next-js-app-dir/public/file.svg +1 -0
- package/template/base/next-js-app-dir/public/globe.svg +1 -0
- package/template/base/next-js-app-dir/public/next.svg +1 -0
- package/template/base/next-js-app-dir/public/vercel.svg +1 -0
- package/template/base/next-js-app-dir/public/window.svg +1 -0
- package/template/base/next-js-app-dir/src/app/favicon.ico +0 -0
- package/template/base/next-js-app-dir/src/app/globals.css +26 -0
- package/template/base/next-js-app-dir/src/app/layout.tsx +34 -0
- package/template/base/next-js-app-dir/src/app/page.tsx +169 -0
- package/template/base/next-js-app-dir/src/instant.perms.ts +24 -0
- package/template/base/next-js-app-dir/src/instant.schema.ts +50 -0
- package/template/base/next-js-app-dir/src/lib/db.ts +8 -0
- package/template/base/next-js-app-dir/tsconfig.json +41 -0
- package/template/base/solidjs-vite/README.md +15 -0
- package/template/base/solidjs-vite/_gitignore +25 -0
- package/template/base/solidjs-vite/index.html +15 -0
- package/template/base/solidjs-vite/package.json +25 -0
- package/template/base/solidjs-vite/src/App.tsx +171 -0
- package/template/base/solidjs-vite/src/index.css +25 -0
- package/template/base/solidjs-vite/src/index.tsx +16 -0
- package/template/base/solidjs-vite/src/instant.perms.ts +24 -0
- package/template/base/solidjs-vite/src/instant.schema.ts +46 -0
- package/template/base/solidjs-vite/src/lib/db.ts +8 -0
- package/template/base/solidjs-vite/tsconfig.json +20 -0
- package/template/base/solidjs-vite/vite.config.ts +11 -0
- package/template/base/sveltekit/README.md +15 -0
- package/template/base/sveltekit/_gitignore +26 -0
- package/template/base/sveltekit/package.json +25 -0
- package/template/base/sveltekit/src/app.css +25 -0
- package/template/base/sveltekit/src/app.html +11 -0
- package/template/base/sveltekit/src/instant.perms.ts +24 -0
- package/template/base/sveltekit/src/instant.schema.ts +46 -0
- package/template/base/sveltekit/src/lib/db.ts +8 -0
- package/template/base/sveltekit/src/routes/+layout.svelte +6 -0
- package/template/base/sveltekit/src/routes/+page.svelte +236 -0
- package/template/base/sveltekit/src/routes/+page.ts +1 -0
- package/template/base/sveltekit/svelte.config.js +10 -0
- package/template/base/sveltekit/tsconfig.json +14 -0
- package/template/base/sveltekit/vite.config.ts +7 -0
- package/template/base/tanstack-start/.cta.json +12 -0
- package/template/base/tanstack-start/README.md +17 -0
- package/template/base/tanstack-start/_gitignore +13 -0
- package/template/base/tanstack-start/package.json +43 -0
- package/template/base/tanstack-start/public/favicon.ico +0 -0
- package/template/base/tanstack-start/public/logo192.png +0 -0
- package/template/base/tanstack-start/public/logo512.png +0 -0
- package/template/base/tanstack-start/public/manifest.json +25 -0
- package/template/base/tanstack-start/public/robots.txt +3 -0
- package/template/base/tanstack-start/public/tanstack-circle-logo.png +0 -0
- package/template/base/tanstack-start/public/tanstack-word-logo-white.svg +1 -0
- package/template/base/tanstack-start/src/components/Header.tsx +21 -0
- package/template/base/tanstack-start/src/instant.perms.ts +24 -0
- package/template/base/tanstack-start/src/instant.schema.ts +50 -0
- package/template/base/tanstack-start/src/lib/adminDb.ts +12 -0
- package/template/base/tanstack-start/src/lib/db.ts +9 -0
- package/template/base/tanstack-start/src/logo.svg +12 -0
- package/template/base/tanstack-start/src/routeTree.gen.ts +104 -0
- package/template/base/tanstack-start/src/router.tsx +22 -0
- package/template/base/tanstack-start/src/routes/__root.tsx +70 -0
- package/template/base/tanstack-start/src/routes/api/instant.ts +18 -0
- package/template/base/tanstack-start/src/routes/index.tsx +238 -0
- package/template/base/tanstack-start/src/routes/login.tsx +140 -0
- package/template/base/tanstack-start/src/styles.css +18 -0
- package/template/base/tanstack-start/tsconfig.json +28 -0
- package/template/base/tanstack-start/vite.config.ts +33 -0
- package/template/base/tanstack-start-with-tanstack-query/.cta.json +12 -0
- package/template/base/tanstack-start-with-tanstack-query/README.md +18 -0
- package/template/base/tanstack-start-with-tanstack-query/_gitignore +13 -0
- package/template/base/tanstack-start-with-tanstack-query/package.json +46 -0
- package/template/base/tanstack-start-with-tanstack-query/public/favicon.ico +0 -0
- package/template/base/tanstack-start-with-tanstack-query/public/logo192.png +0 -0
- package/template/base/tanstack-start-with-tanstack-query/public/logo512.png +0 -0
- package/template/base/tanstack-start-with-tanstack-query/public/manifest.json +25 -0
- package/template/base/tanstack-start-with-tanstack-query/public/robots.txt +3 -0
- package/template/base/tanstack-start-with-tanstack-query/public/tanstack-circle-logo.png +0 -0
- package/template/base/tanstack-start-with-tanstack-query/public/tanstack-word-logo-white.svg +1 -0
- package/template/base/tanstack-start-with-tanstack-query/src/components/Header.tsx +21 -0
- package/template/base/tanstack-start-with-tanstack-query/src/instant.perms.ts +24 -0
- package/template/base/tanstack-start-with-tanstack-query/src/instant.schema.ts +50 -0
- package/template/base/tanstack-start-with-tanstack-query/src/lib/adminDb.ts +9 -0
- package/template/base/tanstack-start-with-tanstack-query/src/lib/db.ts +11 -0
- package/template/base/tanstack-start-with-tanstack-query/src/lib/instantQuery.ts +93 -0
- package/template/base/tanstack-start-with-tanstack-query/src/logo.svg +12 -0
- package/template/base/tanstack-start-with-tanstack-query/src/routeTree.gen.ts +104 -0
- package/template/base/tanstack-start-with-tanstack-query/src/router.tsx +108 -0
- package/template/base/tanstack-start-with-tanstack-query/src/routes/__root.tsx +76 -0
- package/template/base/tanstack-start-with-tanstack-query/src/routes/api/instant.ts +16 -0
- package/template/base/tanstack-start-with-tanstack-query/src/routes/index.tsx +231 -0
- package/template/base/tanstack-start-with-tanstack-query/src/routes/login.tsx +140 -0
- package/template/base/tanstack-start-with-tanstack-query/src/styles.css +17 -0
- package/template/base/tanstack-start-with-tanstack-query/tsconfig.json +28 -0
- package/template/base/tanstack-start-with-tanstack-query/vite.config.ts +33 -0
- package/template/base/vite-react/README.md +16 -0
- package/template/base/vite-react/_gitignore +26 -0
- package/template/base/vite-react/eslint.config.js +23 -0
- package/template/base/vite-react/index.html +13 -0
- package/template/base/vite-react/package.json +35 -0
- package/template/base/vite-react/public/favicon.svg +1 -0
- package/template/base/vite-react/src/App.tsx +167 -0
- package/template/base/vite-react/src/index.css +1 -0
- package/template/base/vite-react/src/instant.perms.ts +24 -0
- package/template/base/vite-react/src/instant.schema.ts +51 -0
- package/template/base/vite-react/src/lib/db.ts +8 -0
- package/template/base/vite-react/src/main.tsx +10 -0
- package/template/base/vite-react/tsconfig.app.json +25 -0
- package/template/base/vite-react/tsconfig.json +7 -0
- package/template/base/vite-react/tsconfig.node.json +24 -0
- package/template/base/vite-react/vite.config.ts +8 -0
- package/template/base/vite-vanilla/.env.example +2 -0
- package/template/base/vite-vanilla/README.md +17 -0
- package/template/base/vite-vanilla/_gitignore +25 -0
- package/template/base/vite-vanilla/index.html +13 -0
- package/template/base/vite-vanilla/package.json +20 -0
- package/template/base/vite-vanilla/pnpm-lock.yaml +707 -0
- package/template/base/vite-vanilla/public/vite.svg +1 -0
- package/template/base/vite-vanilla/src/instant.perms.ts +24 -0
- package/template/base/vite-vanilla/src/instant.schema.ts +50 -0
- package/template/base/vite-vanilla/src/lib/db.ts +11 -0
- package/template/base/vite-vanilla/src/main.ts +242 -0
- package/template/base/vite-vanilla/src/style.css +96 -0
- package/template/base/vite-vanilla/src/typescript.svg +1 -0
- package/template/base/vite-vanilla/src/vite-env.d.ts +1 -0
- package/template/base/vite-vanilla/tsconfig.json +24 -0
- package/template/base/vue-vite/README.md +15 -0
- package/template/base/vue-vite/_gitignore +43 -0
- package/template/base/vue-vite/env.d.ts +1 -0
- package/template/base/vue-vite/index.html +12 -0
- package/template/base/vue-vite/package.json +34 -0
- package/template/base/vue-vite/src/App.vue +238 -0
- package/template/base/vue-vite/src/assets/main.css +25 -0
- package/template/base/vue-vite/src/instant.perms.ts +24 -0
- package/template/base/vue-vite/src/instant.schema.ts +46 -0
- package/template/base/vue-vite/src/lib/db.ts +8 -0
- package/template/base/vue-vite/src/main.ts +6 -0
- package/template/base/vue-vite/tsconfig.app.json +15 -0
- package/template/base/vue-vite/tsconfig.json +11 -0
- package/template/base/vue-vite/tsconfig.node.json +27 -0
- package/template/base/vue-vite/vite.config.ts +16 -0
- package/template/rules/AGENTS.md +436 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<meta name="theme-color" content="#000000" />
|
|
7
|
+
<title>SidekickDB + Solid + Vite</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
11
|
+
<div id="root"></div>
|
|
12
|
+
|
|
13
|
+
<script src="/src/index.tsx" type="module"></script>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "solidjs-vite",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "SidekickDB + Solid + Vite example",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"start": "vite",
|
|
8
|
+
"dev": "vite",
|
|
9
|
+
"build": "vite build",
|
|
10
|
+
"serve": "vite preview"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@tailwindcss/vite": "^4.1.13",
|
|
14
|
+
"solid-devtools": "^0.34.3",
|
|
15
|
+
"tailwindcss": "^4.1.13",
|
|
16
|
+
"typescript": "^5.9.2",
|
|
17
|
+
"vite": "^7.1.4",
|
|
18
|
+
"vite-plugin-solid": "^2.11.8"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@sidekickdb/solidjs": "latest",
|
|
22
|
+
"solid-js": "^1.9.9"
|
|
23
|
+
},
|
|
24
|
+
"packageManager": "pnpm@10.17.0+sha512.fce8a3dd29a4ed2ec566fb53efbb04d8c44a0f05bc6f24a73046910fb9c3ce7afa35a0980500668fa3573345bd644644fa98338fa168235c80f4aa17aa17fbef"
|
|
25
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { id, type InstaQLEntity } from "@sidekickdb/solidjs";
|
|
2
|
+
import { createSignal, For, Show, type Component } from "solid-js";
|
|
3
|
+
import { db } from "./lib/db";
|
|
4
|
+
import type { AppSchema } from "./instant.schema";
|
|
5
|
+
|
|
6
|
+
type Todo = InstaQLEntity<AppSchema, "todos">;
|
|
7
|
+
|
|
8
|
+
const App: Component = () => {
|
|
9
|
+
const state = db.useQuery({ todos: {} });
|
|
10
|
+
const todos = () => state().data?.todos ?? [];
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<Show when={!state().isLoading}>
|
|
14
|
+
<Show
|
|
15
|
+
when={!state().error}
|
|
16
|
+
fallback={
|
|
17
|
+
<div class="text-red-500 p-4">Error: {state().error?.message}</div>
|
|
18
|
+
}
|
|
19
|
+
>
|
|
20
|
+
<div class="p-8 grid-cols-2 items-start gap-2 grid">
|
|
21
|
+
<Welcome />
|
|
22
|
+
<div class="bg-white rounded-lg p-6 border border-neutral-200 shadow flex flex-col">
|
|
23
|
+
<h2 class="tracking-wide text-[#F54A00] text-2xl">Todos</h2>
|
|
24
|
+
<div class="text-xs pb-4">
|
|
25
|
+
Open another tab to see todos update in realtime!
|
|
26
|
+
</div>
|
|
27
|
+
<div class="border rounded border-neutral-300">
|
|
28
|
+
<TodoForm />
|
|
29
|
+
<TodoList todos={todos()} />
|
|
30
|
+
<ActionBar todos={todos()} />
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
</Show>
|
|
35
|
+
</Show>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
function addTodo(text: string) {
|
|
40
|
+
db.transact(
|
|
41
|
+
db.tx.todos[id()].update({
|
|
42
|
+
text,
|
|
43
|
+
done: false,
|
|
44
|
+
createdAt: Date.now(),
|
|
45
|
+
}),
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function deleteTodo(todo: Todo) {
|
|
50
|
+
db.transact(db.tx.todos[todo.id].delete());
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function toggleDone(todo: Todo) {
|
|
54
|
+
db.transact(db.tx.todos[todo.id].update({ done: !todo.done }));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function deleteCompleted(todos: Todo[]) {
|
|
58
|
+
const completed = todos.filter((todo) => todo.done);
|
|
59
|
+
if (completed.length === 0) return;
|
|
60
|
+
const txs = completed.map((todo) => db.tx.todos[todo.id].delete());
|
|
61
|
+
db.transact(txs);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function TodoForm() {
|
|
65
|
+
const [text, setText] = createSignal("");
|
|
66
|
+
return (
|
|
67
|
+
<div class="flex items-center h-10 border-neutral-300">
|
|
68
|
+
<form
|
|
69
|
+
class="flex-1 h-full"
|
|
70
|
+
onSubmit={(e) => {
|
|
71
|
+
e.preventDefault();
|
|
72
|
+
if (!text()) return;
|
|
73
|
+
addTodo(text());
|
|
74
|
+
setText("");
|
|
75
|
+
}}
|
|
76
|
+
>
|
|
77
|
+
<input
|
|
78
|
+
value={text()}
|
|
79
|
+
onInput={(e) => setText(e.currentTarget.value)}
|
|
80
|
+
class="w-full h-full placeholder-neutral-300 px-2 outline-none bg-transparent"
|
|
81
|
+
autofocus
|
|
82
|
+
placeholder="What needs to be done?"
|
|
83
|
+
type="text"
|
|
84
|
+
name="input"
|
|
85
|
+
/>
|
|
86
|
+
</form>
|
|
87
|
+
</div>
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function TodoList(props: { todos: Todo[] }) {
|
|
92
|
+
return (
|
|
93
|
+
<div class="divide-y divide-neutral-300">
|
|
94
|
+
<For each={props.todos}>
|
|
95
|
+
{(todo) => (
|
|
96
|
+
<div class="flex items-center h-10">
|
|
97
|
+
<div class="h-full px-2 flex items-center justify-center">
|
|
98
|
+
<div class="w-5 h-5 flex items-center justify-center">
|
|
99
|
+
<input
|
|
100
|
+
type="checkbox"
|
|
101
|
+
class="cursor-pointer"
|
|
102
|
+
checked={todo.done}
|
|
103
|
+
onChange={() => toggleDone(todo)}
|
|
104
|
+
/>
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
<div class="flex-1 px-2 overflow-hidden flex items-center">
|
|
108
|
+
<span classList={{ "line-through": todo.done }}>{todo.text}</span>
|
|
109
|
+
</div>
|
|
110
|
+
<button
|
|
111
|
+
class="h-full px-2 flex items-center justify-center text-neutral-300 hover:text-neutral-500"
|
|
112
|
+
onClick={() => deleteTodo(todo)}
|
|
113
|
+
>
|
|
114
|
+
X
|
|
115
|
+
</button>
|
|
116
|
+
</div>
|
|
117
|
+
)}
|
|
118
|
+
</For>
|
|
119
|
+
</div>
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function ActionBar(props: { todos: Todo[] }) {
|
|
124
|
+
return (
|
|
125
|
+
<div class="flex justify-between items-center h-10 px-2 text-xs border-t border-neutral-300">
|
|
126
|
+
<div>
|
|
127
|
+
Remaining todos: {props.todos.filter((todo) => !todo.done).length}
|
|
128
|
+
</div>
|
|
129
|
+
<button
|
|
130
|
+
class=" text-neutral-300 hover:text-neutral-500"
|
|
131
|
+
onClick={() => deleteCompleted(props.todos)}
|
|
132
|
+
>
|
|
133
|
+
Delete Completed
|
|
134
|
+
</button>
|
|
135
|
+
</div>
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function Welcome() {
|
|
140
|
+
return (
|
|
141
|
+
<div class="bg-white p-6 rounded-lg border border-neutral-200 shadow flex justify-center flex-col gap-2">
|
|
142
|
+
<h2 class="tracking-wide text-[#F54A00] text-2xl text-center">
|
|
143
|
+
Solid + Vite + SidekickDB
|
|
144
|
+
</h2>
|
|
145
|
+
<div class="grid grid-cols-1 md:grid-cols-2 grow gap-2">
|
|
146
|
+
<a
|
|
147
|
+
href="https://docs.solidjs.com/"
|
|
148
|
+
target="_blank"
|
|
149
|
+
rel="noopener noreferrer"
|
|
150
|
+
class="border hover:bg-neutral-100 py-8 shadow flex flex-col gap-2 items-center justify-center font-semibold border-neutral-200 rounded"
|
|
151
|
+
>
|
|
152
|
+
<img
|
|
153
|
+
src="https://www.solidjs.com/img/logo/without-wordmark/logo.svg"
|
|
154
|
+
width={34}
|
|
155
|
+
/>
|
|
156
|
+
Solid Docs
|
|
157
|
+
</a>
|
|
158
|
+
<a
|
|
159
|
+
target="_blank"
|
|
160
|
+
href="https://sidekickdb.co/docs"
|
|
161
|
+
rel="noopener noreferrer"
|
|
162
|
+
class="border shadow flex flex-col py-8 gap-2 hover:bg-neutral-100 items-center justify-center font-semibold border-neutral-200 rounded"
|
|
163
|
+
>
|
|
164
|
+
SidekickDB Docs
|
|
165
|
+
</a>
|
|
166
|
+
</div>
|
|
167
|
+
</div>
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export default App;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
|
|
3
|
+
@layer base {
|
|
4
|
+
:root {
|
|
5
|
+
@apply font-sans;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
body {
|
|
9
|
+
background: linear-gradient(
|
|
10
|
+
120deg,
|
|
11
|
+
#e7e7e7 40%,
|
|
12
|
+
#fee7de 70%,
|
|
13
|
+
#e4e4e4 100%
|
|
14
|
+
);
|
|
15
|
+
min-height: 100dvh;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@media (prefers-reduced-motion) {
|
|
20
|
+
*,
|
|
21
|
+
::before,
|
|
22
|
+
::after {
|
|
23
|
+
animation: none !important;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* @refresh reload */
|
|
2
|
+
import './index.css';
|
|
3
|
+
import { render } from 'solid-js/web';
|
|
4
|
+
import 'solid-devtools';
|
|
5
|
+
|
|
6
|
+
import App from './App';
|
|
7
|
+
|
|
8
|
+
const root = document.getElementById('root');
|
|
9
|
+
|
|
10
|
+
if (import.meta.env.DEV && !(root instanceof HTMLElement)) {
|
|
11
|
+
throw new Error(
|
|
12
|
+
'Root element not found. Did you forget to add it to your index.html? Or maybe the id attribute got misspelled?',
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
render(() => <App />, root!);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Docs: https://sidekickdb.co/docs/permissions
|
|
2
|
+
|
|
3
|
+
import type { InstantRules } from "@sidekickdb/core";
|
|
4
|
+
|
|
5
|
+
const rules = {
|
|
6
|
+
/**
|
|
7
|
+
* Welcome to SidekickDB's permission system!
|
|
8
|
+
* Right now your rules are empty. To start filling them in, check out the docs:
|
|
9
|
+
* https://sidekickdb.co/docs/permissions
|
|
10
|
+
*
|
|
11
|
+
* Here's an example to give you a feel:
|
|
12
|
+
* posts: {
|
|
13
|
+
* allow: {
|
|
14
|
+
* view: "true",
|
|
15
|
+
* create: "isOwner",
|
|
16
|
+
* update: "isOwner",
|
|
17
|
+
* delete: "isOwner",
|
|
18
|
+
* },
|
|
19
|
+
* bind: {"isOwner": "auth.id != null && auth.id == data.ownerId"},
|
|
20
|
+
* },
|
|
21
|
+
*/
|
|
22
|
+
} satisfies InstantRules;
|
|
23
|
+
|
|
24
|
+
export default rules;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Docs: https://sidekickdb.co/docs/modeling-data
|
|
2
|
+
|
|
3
|
+
import { i } from "@sidekickdb/solidjs";
|
|
4
|
+
|
|
5
|
+
const _schema = i.schema({
|
|
6
|
+
entities: {
|
|
7
|
+
$files: i.entity({
|
|
8
|
+
path: i.string().unique().indexed(),
|
|
9
|
+
url: i.string(),
|
|
10
|
+
}),
|
|
11
|
+
$users: i.entity({
|
|
12
|
+
email: i.string().unique().indexed().optional(),
|
|
13
|
+
imageURL: i.string().optional(),
|
|
14
|
+
type: i.string().optional(),
|
|
15
|
+
}),
|
|
16
|
+
todos: i.entity({
|
|
17
|
+
createdAt: i.number(),
|
|
18
|
+
done: i.boolean(),
|
|
19
|
+
text: i.string(),
|
|
20
|
+
}),
|
|
21
|
+
},
|
|
22
|
+
links: {
|
|
23
|
+
$usersLinkedPrimaryUser: {
|
|
24
|
+
forward: {
|
|
25
|
+
on: "$users",
|
|
26
|
+
has: "one",
|
|
27
|
+
label: "linkedPrimaryUser",
|
|
28
|
+
onDelete: "cascade",
|
|
29
|
+
},
|
|
30
|
+
reverse: {
|
|
31
|
+
on: "$users",
|
|
32
|
+
has: "many",
|
|
33
|
+
label: "linkedGuestUsers",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
rooms: {},
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// This helps TypeScript display nicer intellisense
|
|
41
|
+
type _AppSchema = typeof _schema;
|
|
42
|
+
interface AppSchema extends _AppSchema {}
|
|
43
|
+
const schema: AppSchema = _schema;
|
|
44
|
+
|
|
45
|
+
export type { AppSchema };
|
|
46
|
+
export default schema;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
// General
|
|
4
|
+
"jsx": "preserve",
|
|
5
|
+
"jsxImportSource": "solid-js",
|
|
6
|
+
"target": "ESNext",
|
|
7
|
+
|
|
8
|
+
// Modules
|
|
9
|
+
"allowSyntheticDefaultImports": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"isolatedModules": true,
|
|
12
|
+
"module": "ESNext",
|
|
13
|
+
"moduleResolution": "bundler",
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
|
|
16
|
+
// Type Checking & Safety
|
|
17
|
+
"strict": true,
|
|
18
|
+
"types": ["vite/client"]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import tailwindcss from "@tailwindcss/vite";
|
|
2
|
+
import { defineConfig } from "vite";
|
|
3
|
+
import solidPlugin from "vite-plugin-solid";
|
|
4
|
+
import devtools from "solid-devtools/vite";
|
|
5
|
+
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
plugins: [devtools(), solidPlugin(), tailwindcss()],
|
|
8
|
+
build: {
|
|
9
|
+
target: "esnext",
|
|
10
|
+
},
|
|
11
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Welcome to your SidekickDB SvelteKit app
|
|
2
|
+
|
|
3
|
+
To install dependencies:
|
|
4
|
+
`npm install`
|
|
5
|
+
|
|
6
|
+
To run the development server:
|
|
7
|
+
`npm run dev`
|
|
8
|
+
|
|
9
|
+
To push schema changes:
|
|
10
|
+
`npx @sidekickdb/cli push`
|
|
11
|
+
|
|
12
|
+
To pull schema changes:
|
|
13
|
+
`npx @sidekickdb/cli pull`
|
|
14
|
+
|
|
15
|
+
Set `VITE_INSTANT_APP_ID` in an `.env` file before running the app.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
dist
|
|
2
|
+
.svelte-kit
|
|
3
|
+
.wrangler
|
|
4
|
+
.output
|
|
5
|
+
.vercel
|
|
6
|
+
.netlify
|
|
7
|
+
.vinxi
|
|
8
|
+
app.config.timestamp_*.js
|
|
9
|
+
|
|
10
|
+
# Environment
|
|
11
|
+
.env
|
|
12
|
+
.env*.local
|
|
13
|
+
|
|
14
|
+
# dependencies
|
|
15
|
+
/node_modules
|
|
16
|
+
|
|
17
|
+
# IDEs and editors
|
|
18
|
+
/.idea
|
|
19
|
+
.project
|
|
20
|
+
.classpath
|
|
21
|
+
*.launch
|
|
22
|
+
.settings/
|
|
23
|
+
|
|
24
|
+
# System Files
|
|
25
|
+
.DS_Store
|
|
26
|
+
Thumbs.db
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sveltekit",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "SidekickDB + SvelteKit example",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"prepare": "svelte-kit sync",
|
|
8
|
+
"dev": "vite dev",
|
|
9
|
+
"build": "vite build",
|
|
10
|
+
"preview": "vite preview"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"@sveltejs/adapter-auto": "^7.0.0",
|
|
14
|
+
"@sveltejs/kit": "^2.16.0",
|
|
15
|
+
"@sveltejs/vite-plugin-svelte": "^5.0.0",
|
|
16
|
+
"@tailwindcss/vite": "^4.1.13",
|
|
17
|
+
"svelte": "^5.0.0",
|
|
18
|
+
"tailwindcss": "^4.1.13",
|
|
19
|
+
"typescript": "^5.9.2",
|
|
20
|
+
"vite": "^6.0.0"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@sidekickdb/svelte": "latest"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
@import "tailwindcss";
|
|
2
|
+
|
|
3
|
+
@layer base {
|
|
4
|
+
:root {
|
|
5
|
+
@apply font-sans;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
body {
|
|
9
|
+
background: linear-gradient(
|
|
10
|
+
120deg,
|
|
11
|
+
#e7e7e7 40%,
|
|
12
|
+
#fee7de 70%,
|
|
13
|
+
#e4e4e4 100%
|
|
14
|
+
);
|
|
15
|
+
min-height: 100dvh;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@media (prefers-reduced-motion) {
|
|
20
|
+
*,
|
|
21
|
+
::before,
|
|
22
|
+
::after {
|
|
23
|
+
animation: none !important;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Docs: https://sidekickdb.co/docs/permissions
|
|
2
|
+
|
|
3
|
+
import type { InstantRules } from "@sidekickdb/svelte";
|
|
4
|
+
|
|
5
|
+
const rules = {
|
|
6
|
+
/**
|
|
7
|
+
* Welcome to SidekickDB's permission system!
|
|
8
|
+
* Right now your rules are empty. To start filling them in, check out the docs:
|
|
9
|
+
* https://sidekickdb.co/docs/permissions
|
|
10
|
+
*
|
|
11
|
+
* Here's an example to give you a feel:
|
|
12
|
+
* posts: {
|
|
13
|
+
* allow: {
|
|
14
|
+
* view: "true",
|
|
15
|
+
* create: "isOwner",
|
|
16
|
+
* update: "isOwner",
|
|
17
|
+
* delete: "isOwner",
|
|
18
|
+
* },
|
|
19
|
+
* bind: {"isOwner": "auth.id != null && auth.id == data.ownerId"},
|
|
20
|
+
* },
|
|
21
|
+
*/
|
|
22
|
+
} satisfies InstantRules;
|
|
23
|
+
|
|
24
|
+
export default rules;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Docs: https://sidekickdb.co/docs/modeling-data
|
|
2
|
+
|
|
3
|
+
import { i } from "@sidekickdb/svelte";
|
|
4
|
+
|
|
5
|
+
const _schema = i.schema({
|
|
6
|
+
entities: {
|
|
7
|
+
$files: i.entity({
|
|
8
|
+
path: i.string().unique().indexed(),
|
|
9
|
+
url: i.string(),
|
|
10
|
+
}),
|
|
11
|
+
$users: i.entity({
|
|
12
|
+
email: i.string().unique().indexed().optional(),
|
|
13
|
+
imageURL: i.string().optional(),
|
|
14
|
+
type: i.string().optional(),
|
|
15
|
+
}),
|
|
16
|
+
todos: i.entity({
|
|
17
|
+
createdAt: i.number(),
|
|
18
|
+
done: i.boolean(),
|
|
19
|
+
text: i.string(),
|
|
20
|
+
}),
|
|
21
|
+
},
|
|
22
|
+
links: {
|
|
23
|
+
$usersLinkedPrimaryUser: {
|
|
24
|
+
forward: {
|
|
25
|
+
on: "$users",
|
|
26
|
+
has: "one",
|
|
27
|
+
label: "linkedPrimaryUser",
|
|
28
|
+
onDelete: "cascade",
|
|
29
|
+
},
|
|
30
|
+
reverse: {
|
|
31
|
+
on: "$users",
|
|
32
|
+
has: "many",
|
|
33
|
+
label: "linkedGuestUsers",
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
rooms: {},
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// This helps TypeScript display nicer intellisense
|
|
41
|
+
type _AppSchema = typeof _schema;
|
|
42
|
+
interface AppSchema extends _AppSchema {}
|
|
43
|
+
const schema: AppSchema = _schema;
|
|
44
|
+
|
|
45
|
+
export type { AppSchema };
|
|
46
|
+
export default schema;
|