create-better-t-stack 3.13.2 → 3.14.1
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/dist/cli.mjs +1 -1
- package/dist/index.d.mts +29 -33
- package/dist/index.mjs +2 -2
- package/dist/{src-kvJQuDe_.mjs → src-CSz9J82Z.mjs} +432 -3588
- package/dist/virtual.d.mts +4 -0
- package/dist/virtual.mjs +4 -0
- package/package.json +9 -5
- package/templates/addons/biome/biome.json.hbs +0 -96
- package/templates/addons/husky/.husky/pre-commit +0 -1
- package/templates/addons/pwa/apps/web/next/public/favicon/apple-touch-icon.png +0 -0
- package/templates/addons/pwa/apps/web/next/public/favicon/favicon-96x96.png +0 -0
- package/templates/addons/pwa/apps/web/next/public/favicon/favicon.svg +0 -6
- package/templates/addons/pwa/apps/web/next/public/favicon/site.webmanifest.hbs +0 -21
- package/templates/addons/pwa/apps/web/next/public/favicon/web-app-manifest-192x192.png +0 -0
- package/templates/addons/pwa/apps/web/next/public/favicon/web-app-manifest-512x512.png +0 -0
- package/templates/addons/pwa/apps/web/next/src/app/manifest.ts.hbs +0 -26
- package/templates/addons/pwa/apps/web/vite/public/logo.png +0 -0
- package/templates/addons/pwa/apps/web/vite/pwa-assets.config.ts.hbs +0 -12
- package/templates/addons/ruler/.ruler/bts.md.hbs +0 -142
- package/templates/addons/ruler/.ruler/ruler.toml.hbs +0 -80
- package/templates/addons/turborepo/turbo.json.hbs +0 -74
- package/templates/addons/ultracite/biome.json.hbs +0 -26
- package/templates/api/orpc/fullstack/next/src/app/api/rpc/[[...rest]]/route.ts.hbs +0 -50
- package/templates/api/orpc/fullstack/tanstack-start/src/routes/api/rpc/$.ts.hbs +0 -58
- package/templates/api/orpc/native/utils/orpc.ts.hbs +0 -39
- package/templates/api/orpc/server/_gitignore +0 -34
- package/templates/api/orpc/server/package.json.hbs +0 -15
- package/templates/api/orpc/server/src/context.ts.hbs +0 -148
- package/templates/api/orpc/server/src/index.ts.hbs +0 -21
- package/templates/api/orpc/server/src/routers/index.ts.hbs +0 -55
- package/templates/api/orpc/server/tsconfig.json.hbs +0 -10
- package/templates/api/orpc/web/nuxt/app/plugins/orpc.ts.hbs +0 -32
- package/templates/api/orpc/web/nuxt/app/plugins/vue-query.ts.hbs +0 -44
- package/templates/api/orpc/web/react/base/src/utils/orpc.ts.hbs +0 -113
- package/templates/api/orpc/web/solid/src/utils/orpc.ts.hbs +0 -30
- package/templates/api/orpc/web/svelte/src/lib/orpc.ts.hbs +0 -30
- package/templates/api/trpc/fullstack/next/src/app/api/trpc/[trpc]/route.ts.hbs +0 -14
- package/templates/api/trpc/fullstack/tanstack-start/src/routes/api/trpc/$.ts.hbs +0 -22
- package/templates/api/trpc/native/utils/trpc.ts.hbs +0 -37
- package/templates/api/trpc/server/_gitignore +0 -34
- package/templates/api/trpc/server/package.json.hbs +0 -14
- package/templates/api/trpc/server/src/context.ts.hbs +0 -148
- package/templates/api/trpc/server/src/index.ts.hbs +0 -26
- package/templates/api/trpc/server/src/routers/index.ts.hbs +0 -55
- package/templates/api/trpc/server/tsconfig.json.hbs +0 -10
- package/templates/api/trpc/web/react/base/src/utils/trpc.ts.hbs +0 -97
- package/templates/auth/better-auth/convex/backend/convex/auth.config.ts.hbs +0 -6
- package/templates/auth/better-auth/convex/backend/convex/auth.ts.hbs +0 -68
- package/templates/auth/better-auth/convex/backend/convex/http.ts.hbs +0 -12
- package/templates/auth/better-auth/convex/backend/convex/privateData.ts.hbs +0 -17
- package/templates/auth/better-auth/convex/native/bare/components/sign-in.tsx.hbs +0 -127
- package/templates/auth/better-auth/convex/native/bare/components/sign-up.tsx.hbs +0 -138
- package/templates/auth/better-auth/convex/native/base/lib/auth-client.ts.hbs +0 -18
- package/templates/auth/better-auth/convex/native/unistyles/components/sign-in.tsx.hbs +0 -127
- package/templates/auth/better-auth/convex/native/unistyles/components/sign-up.tsx.hbs +0 -145
- package/templates/auth/better-auth/convex/native/uniwind/components/sign-in.tsx.hbs +0 -73
- package/templates/auth/better-auth/convex/native/uniwind/components/sign-up.tsx.hbs +0 -85
- package/templates/auth/better-auth/convex/web/react/next/src/app/api/auth/[...all]/route.ts.hbs +0 -3
- package/templates/auth/better-auth/convex/web/react/next/src/app/dashboard/page.tsx.hbs +0 -40
- package/templates/auth/better-auth/convex/web/react/next/src/components/sign-in-form.tsx.hbs +0 -129
- package/templates/auth/better-auth/convex/web/react/next/src/components/sign-up-form.tsx.hbs +0 -154
- package/templates/auth/better-auth/convex/web/react/next/src/components/user-menu.tsx.hbs +0 -48
- package/templates/auth/better-auth/convex/web/react/next/src/lib/auth-client.ts.hbs +0 -6
- package/templates/auth/better-auth/convex/web/react/next/src/lib/auth-server.ts.hbs +0 -16
- package/templates/auth/better-auth/convex/web/react/tanstack-router/src/components/sign-in-form.tsx.hbs +0 -133
- package/templates/auth/better-auth/convex/web/react/tanstack-router/src/components/sign-up-form.tsx.hbs +0 -158
- package/templates/auth/better-auth/convex/web/react/tanstack-router/src/components/user-menu.tsx.hbs +0 -52
- package/templates/auth/better-auth/convex/web/react/tanstack-router/src/lib/auth-client.ts.hbs +0 -11
- package/templates/auth/better-auth/convex/web/react/tanstack-router/src/routes/dashboard.tsx.hbs +0 -43
- package/templates/auth/better-auth/convex/web/react/tanstack-start/src/components/sign-in-form.tsx.hbs +0 -133
- package/templates/auth/better-auth/convex/web/react/tanstack-start/src/components/sign-up-form.tsx.hbs +0 -158
- package/templates/auth/better-auth/convex/web/react/tanstack-start/src/components/user-menu.tsx.hbs +0 -47
- package/templates/auth/better-auth/convex/web/react/tanstack-start/src/lib/auth-client.ts.hbs +0 -6
- package/templates/auth/better-auth/convex/web/react/tanstack-start/src/lib/auth-server.ts.hbs +0 -13
- package/templates/auth/better-auth/convex/web/react/tanstack-start/src/routes/api/auth/$.ts.hbs +0 -11
- package/templates/auth/better-auth/convex/web/react/tanstack-start/src/routes/dashboard.tsx.hbs +0 -43
- package/templates/auth/better-auth/fullstack/next/src/app/api/auth/[...all]/route.ts.hbs +0 -4
- package/templates/auth/better-auth/fullstack/tanstack-start/src/routes/api/auth/$.ts.hbs +0 -15
- package/templates/auth/better-auth/native/bare/app/(drawer)/index.tsx.hbs +0 -186
- package/templates/auth/better-auth/native/bare/components/sign-in.tsx.hbs +0 -131
- package/templates/auth/better-auth/native/bare/components/sign-up.tsx.hbs +0 -150
- package/templates/auth/better-auth/native/base/lib/auth-client.ts.hbs +0 -16
- package/templates/auth/better-auth/native/unistyles/app/(drawer)/index.tsx.hbs +0 -187
- package/templates/auth/better-auth/native/unistyles/components/sign-in.tsx.hbs +0 -139
- package/templates/auth/better-auth/native/unistyles/components/sign-up.tsx.hbs +0 -157
- package/templates/auth/better-auth/native/uniwind/app/(drawer)/index.tsx.hbs +0 -123
- package/templates/auth/better-auth/native/uniwind/components/sign-in.tsx.hbs +0 -87
- package/templates/auth/better-auth/native/uniwind/components/sign-up.tsx.hbs +0 -128
- package/templates/auth/better-auth/server/base/_gitignore +0 -34
- package/templates/auth/better-auth/server/base/package.json.hbs +0 -14
- package/templates/auth/better-auth/server/base/src/index.ts.hbs +0 -304
- package/templates/auth/better-auth/server/base/tsconfig.json.hbs +0 -10
- package/templates/auth/better-auth/server/db/drizzle/mysql/src/schema/auth.ts.hbs +0 -100
- package/templates/auth/better-auth/server/db/drizzle/postgres/src/schema/auth.ts.hbs +0 -93
- package/templates/auth/better-auth/server/db/drizzle/sqlite/src/schema/auth.ts.hbs +0 -107
- package/templates/auth/better-auth/server/db/mongoose/mongodb/src/models/auth.model.ts.hbs +0 -68
- package/templates/auth/better-auth/server/db/prisma/mongodb/prisma/schema/auth.prisma.hbs +0 -62
- package/templates/auth/better-auth/server/db/prisma/mysql/prisma/schema/auth.prisma.hbs +0 -62
- package/templates/auth/better-auth/server/db/prisma/postgres/prisma/schema/auth.prisma.hbs +0 -62
- package/templates/auth/better-auth/server/db/prisma/sqlite/prisma/schema/auth.prisma.hbs +0 -62
- package/templates/auth/better-auth/web/nuxt/app/components/SignInForm.vue.hbs +0 -82
- package/templates/auth/better-auth/web/nuxt/app/components/SignUpForm.vue.hbs +0 -91
- package/templates/auth/better-auth/web/nuxt/app/components/UserMenu.vue.hbs +0 -42
- package/templates/auth/better-auth/web/nuxt/app/middleware/auth.ts.hbs +0 -14
- package/templates/auth/better-auth/web/nuxt/app/pages/dashboard.vue.hbs +0 -99
- package/templates/auth/better-auth/web/nuxt/app/pages/login.vue.hbs +0 -27
- package/templates/auth/better-auth/web/nuxt/app/plugins/auth-client.ts.hbs +0 -21
- package/templates/auth/better-auth/web/react/base/src/lib/auth-client.ts.hbs +0 -16
- package/templates/auth/better-auth/web/react/next/src/app/dashboard/dashboard.tsx.hbs +0 -60
- package/templates/auth/better-auth/web/react/next/src/app/dashboard/page.tsx.hbs +0 -42
- package/templates/auth/better-auth/web/react/next/src/app/login/page.tsx.hbs +0 -16
- package/templates/auth/better-auth/web/react/next/src/components/sign-in-form.tsx.hbs +0 -135
- package/templates/auth/better-auth/web/react/next/src/components/sign-up-form.tsx.hbs +0 -160
- package/templates/auth/better-auth/web/react/next/src/components/user-menu.tsx.hbs +0 -62
- package/templates/auth/better-auth/web/react/react-router/src/components/sign-in-form.tsx.hbs +0 -135
- package/templates/auth/better-auth/web/react/react-router/src/components/sign-up-form.tsx.hbs +0 -160
- package/templates/auth/better-auth/web/react/react-router/src/components/user-menu.tsx.hbs +0 -61
- package/templates/auth/better-auth/web/react/react-router/src/routes/dashboard.tsx.hbs +0 -80
- package/templates/auth/better-auth/web/react/react-router/src/routes/login.tsx.hbs +0 -13
- package/templates/auth/better-auth/web/react/tanstack-router/src/components/sign-in-form.tsx.hbs +0 -135
- package/templates/auth/better-auth/web/react/tanstack-router/src/components/sign-up-form.tsx.hbs +0 -160
- package/templates/auth/better-auth/web/react/tanstack-router/src/components/user-menu.tsx.hbs +0 -63
- package/templates/auth/better-auth/web/react/tanstack-router/src/routes/dashboard.tsx.hbs +0 -71
- package/templates/auth/better-auth/web/react/tanstack-router/src/routes/login.tsx.hbs +0 -18
- package/templates/auth/better-auth/web/react/tanstack-start/src/components/sign-in-form.tsx.hbs +0 -135
- package/templates/auth/better-auth/web/react/tanstack-start/src/components/sign-up-form.tsx.hbs +0 -160
- package/templates/auth/better-auth/web/react/tanstack-start/src/components/user-menu.tsx.hbs +0 -63
- package/templates/auth/better-auth/web/react/tanstack-start/src/functions/get-user.ts.hbs +0 -6
- package/templates/auth/better-auth/web/react/tanstack-start/src/middleware/auth.ts.hbs +0 -31
- package/templates/auth/better-auth/web/react/tanstack-start/src/routes/dashboard.tsx.hbs +0 -84
- package/templates/auth/better-auth/web/react/tanstack-start/src/routes/login.tsx.hbs +0 -18
- package/templates/auth/better-auth/web/solid/src/components/sign-in-form.tsx.hbs +0 -124
- package/templates/auth/better-auth/web/solid/src/components/sign-up-form.tsx.hbs +0 -148
- package/templates/auth/better-auth/web/solid/src/components/user-menu.tsx.hbs +0 -55
- package/templates/auth/better-auth/web/solid/src/lib/auth-client.ts.hbs +0 -12
- package/templates/auth/better-auth/web/solid/src/routes/dashboard.tsx.hbs +0 -67
- package/templates/auth/better-auth/web/solid/src/routes/login.tsx.hbs +0 -23
- package/templates/auth/better-auth/web/svelte/src/components/SignInForm.svelte.hbs +0 -109
- package/templates/auth/better-auth/web/svelte/src/components/SignUpForm.svelte.hbs +0 -142
- package/templates/auth/better-auth/web/svelte/src/components/UserMenu.svelte.hbs +0 -52
- package/templates/auth/better-auth/web/svelte/src/lib/auth-client.ts.hbs +0 -12
- package/templates/auth/better-auth/web/svelte/src/routes/dashboard/+page.svelte.hbs +0 -59
- package/templates/auth/better-auth/web/svelte/src/routes/login/+page.svelte.hbs +0 -12
- package/templates/auth/clerk/convex/backend/convex/auth.config.ts.hbs +0 -12
- package/templates/auth/clerk/convex/backend/convex/privateData.ts.hbs +0 -16
- package/templates/auth/clerk/convex/native/base/app/(auth)/_layout.tsx.hbs +0 -12
- package/templates/auth/clerk/convex/native/base/app/(auth)/sign-in.tsx.hbs +0 -67
- package/templates/auth/clerk/convex/native/base/app/(auth)/sign-up.tsx.hbs +0 -110
- package/templates/auth/clerk/convex/native/base/components/sign-out-button.tsx.hbs +0 -27
- package/templates/auth/clerk/convex/web/react/next/src/app/dashboard/page.tsx.hbs +0 -29
- package/templates/auth/clerk/convex/web/react/next/src/middleware.ts.hbs +0 -12
- package/templates/auth/clerk/convex/web/react/react-router/src/routes/dashboard.tsx.hbs +0 -32
- package/templates/auth/clerk/convex/web/react/tanstack-router/src/routes/dashboard.tsx.hbs +0 -37
- package/templates/auth/clerk/convex/web/react/tanstack-start/src/routes/dashboard.tsx.hbs +0 -37
- package/templates/auth/clerk/convex/web/react/tanstack-start/src/start.ts.hbs +0 -8
- package/templates/backend/convex/packages/backend/_gitignore +0 -2
- package/templates/backend/convex/packages/backend/convex/README.md +0 -90
- package/templates/backend/convex/packages/backend/convex/convex.config.ts.hbs +0 -17
- package/templates/backend/convex/packages/backend/convex/healthCheck.ts.hbs +0 -7
- package/templates/backend/convex/packages/backend/convex/schema.ts.hbs +0 -11
- package/templates/backend/convex/packages/backend/convex/tsconfig.json.hbs +0 -25
- package/templates/backend/convex/packages/backend/package.json.hbs +0 -15
- package/templates/backend/server/base/_gitignore +0 -55
- package/templates/backend/server/base/package.json.hbs +0 -17
- package/templates/backend/server/base/tsconfig.json.hbs +0 -13
- package/templates/backend/server/base/tsdown.config.ts.hbs +0 -9
- package/templates/backend/server/elysia/src/index.ts.hbs +0 -122
- package/templates/backend/server/express/src/index.ts.hbs +0 -126
- package/templates/backend/server/fastify/src/index.ts.hbs +0 -187
- package/templates/backend/server/hono/src/index.ts.hbs +0 -171
- package/templates/base/_gitignore +0 -50
- package/templates/base/package.json.hbs +0 -10
- package/templates/base/tsconfig.json.hbs +0 -3
- package/templates/db/base/_gitignore +0 -35
- package/templates/db/base/package.json.hbs +0 -14
- package/templates/db/base/tsconfig.json.hbs +0 -10
- package/templates/db/drizzle/base/src/schema/index.ts.hbs +0 -7
- package/templates/db/drizzle/mysql/drizzle.config.ts.hbs +0 -19
- package/templates/db/drizzle/mysql/src/index.ts.hbs +0 -54
- package/templates/db/drizzle/postgres/drizzle.config.ts.hbs +0 -19
- package/templates/db/drizzle/postgres/src/index.ts.hbs +0 -44
- package/templates/db/drizzle/sqlite/drizzle.config.ts.hbs +0 -28
- package/templates/db/drizzle/sqlite/src/index.ts.hbs +0 -39
- package/templates/db/mongoose/mongodb/src/index.ts.hbs +0 -10
- package/templates/db/prisma/mongodb/prisma/schema/schema.prisma.hbs +0 -19
- package/templates/db/prisma/mongodb/prisma.config.ts.hbs +0 -18
- package/templates/db/prisma/mongodb/src/index.ts.hbs +0 -5
- package/templates/db/prisma/mysql/prisma/schema/schema.prisma.hbs +0 -21
- package/templates/db/prisma/mysql/prisma.config.ts.hbs +0 -21
- package/templates/db/prisma/mysql/src/index.ts.hbs +0 -55
- package/templates/db/prisma/postgres/prisma/schema/schema.prisma.hbs +0 -21
- package/templates/db/prisma/postgres/prisma.config.ts.hbs +0 -21
- package/templates/db/prisma/postgres/src/index.ts.hbs +0 -69
- package/templates/db/prisma/sqlite/prisma/schema/schema.prisma.hbs +0 -18
- package/templates/db/prisma/sqlite/prisma.config.ts.hbs +0 -25
- package/templates/db/prisma/sqlite/src/index.ts.hbs +0 -25
- package/templates/db-setup/docker-compose/mongodb/docker-compose.yml.hbs +0 -23
- package/templates/db-setup/docker-compose/mysql/docker-compose.yml.hbs +0 -24
- package/templates/db-setup/docker-compose/postgres/docker-compose.yml.hbs +0 -23
- package/templates/examples/ai/convex/packages/backend/convex/agent.ts.hbs +0 -9
- package/templates/examples/ai/convex/packages/backend/convex/chat.ts.hbs +0 -67
- package/templates/examples/ai/fullstack/next/src/app/api/ai/route.ts.hbs +0 -20
- package/templates/examples/ai/fullstack/tanstack-start/src/routes/api/ai/$.ts.hbs +0 -36
- package/templates/examples/ai/native/bare/app/(drawer)/ai.tsx.hbs +0 -586
- package/templates/examples/ai/native/bare/polyfills.js +0 -25
- package/templates/examples/ai/native/unistyles/app/(drawer)/ai.tsx.hbs +0 -588
- package/templates/examples/ai/native/unistyles/polyfills.js +0 -22
- package/templates/examples/ai/native/uniwind/app/(drawer)/ai.tsx.hbs +0 -331
- package/templates/examples/ai/native/uniwind/polyfills.js +0 -22
- package/templates/examples/ai/web/nuxt/app/pages/ai.vue.hbs +0 -54
- package/templates/examples/ai/web/react/next/src/app/ai/page.tsx.hbs +0 -267
- package/templates/examples/ai/web/react/react-router/src/routes/ai.tsx.hbs +0 -235
- package/templates/examples/ai/web/react/tanstack-router/src/routes/ai.tsx.hbs +0 -242
- package/templates/examples/ai/web/react/tanstack-start/src/routes/ai.tsx.hbs +0 -243
- package/templates/examples/ai/web/svelte/src/routes/ai/+page.svelte.hbs +0 -107
- package/templates/examples/todo/convex/packages/backend/convex/todos.ts.hbs +0 -42
- package/templates/examples/todo/native/bare/app/(drawer)/todos.tsx.hbs +0 -521
- package/templates/examples/todo/native/unistyles/app/(drawer)/todos.tsx.hbs +0 -340
- package/templates/examples/todo/native/uniwind/app/(drawer)/todos.tsx.hbs +0 -282
- package/templates/examples/todo/server/drizzle/base/src/routers/todo.ts.hbs +0 -75
- package/templates/examples/todo/server/drizzle/mysql/src/schema/todo.ts +0 -7
- package/templates/examples/todo/server/drizzle/postgres/src/schema/todo.ts +0 -7
- package/templates/examples/todo/server/drizzle/sqlite/src/schema/todo.ts +0 -7
- package/templates/examples/todo/server/mongoose/base/src/routers/todo.ts.hbs +0 -66
- package/templates/examples/todo/server/mongoose/mongodb/src/models/todo.model.ts.hbs +0 -24
- package/templates/examples/todo/server/prisma/base/src/routers/todo.ts.hbs +0 -116
- package/templates/examples/todo/server/prisma/mongodb/prisma/schema/todo.prisma.hbs +0 -7
- package/templates/examples/todo/server/prisma/mysql/prisma/schema/todo.prisma.hbs +0 -7
- package/templates/examples/todo/server/prisma/postgres/prisma/schema/todo.prisma.hbs +0 -7
- package/templates/examples/todo/server/prisma/sqlite/prisma/schema/todo.prisma.hbs +0 -7
- package/templates/examples/todo/web/nuxt/app/pages/todos.vue.hbs +0 -220
- package/templates/examples/todo/web/react/next/src/app/todos/page.tsx.hbs +0 -245
- package/templates/examples/todo/web/react/react-router/src/routes/todos.tsx.hbs +0 -242
- package/templates/examples/todo/web/react/tanstack-router/src/routes/todos.tsx.hbs +0 -247
- package/templates/examples/todo/web/react/tanstack-start/src/routes/todos.tsx.hbs +0 -272
- package/templates/examples/todo/web/solid/src/routes/todos.tsx.hbs +0 -132
- package/templates/examples/todo/web/svelte/src/routes/todos/+page.svelte.hbs +0 -317
- package/templates/extras/_npmrc.hbs +0 -5
- package/templates/extras/bunfig.toml.hbs +0 -6
- package/templates/extras/pnpm-workspace.yaml +0 -3
- package/templates/frontend/native/bare/_gitignore +0 -18
- package/templates/frontend/native/bare/app/(drawer)/(tabs)/_layout.tsx.hbs +0 -41
- package/templates/frontend/native/bare/app/(drawer)/(tabs)/index.tsx.hbs +0 -43
- package/templates/frontend/native/bare/app/(drawer)/(tabs)/two.tsx.hbs +0 -43
- package/templates/frontend/native/bare/app/(drawer)/_layout.tsx.hbs +0 -90
- package/templates/frontend/native/bare/app/(drawer)/index.tsx.hbs +0 -234
- package/templates/frontend/native/bare/app/+not-found.tsx.hbs +0 -65
- package/templates/frontend/native/bare/app/_layout.tsx.hbs +0 -165
- package/templates/frontend/native/bare/app/modal.tsx.hbs +0 -34
- package/templates/frontend/native/bare/app.json.hbs +0 -50
- package/templates/frontend/native/bare/components/container.tsx.hbs +0 -25
- package/templates/frontend/native/bare/components/header-button.tsx.hbs +0 -47
- package/templates/frontend/native/bare/components/tabbar-icon.tsx.hbs +0 -9
- package/templates/frontend/native/bare/lib/android-navigation-bar.tsx.hbs +0 -12
- package/templates/frontend/native/bare/lib/constants.ts.hbs +0 -19
- package/templates/frontend/native/bare/lib/use-color-scheme.ts.hbs +0 -20
- package/templates/frontend/native/bare/metro.config.js.hbs +0 -9
- package/templates/frontend/native/bare/package.json.hbs +0 -51
- package/templates/frontend/native/bare/tsconfig.json.hbs +0 -11
- package/templates/frontend/native/base/assets/images/android-icon-background.png +0 -0
- package/templates/frontend/native/base/assets/images/android-icon-foreground.png +0 -0
- package/templates/frontend/native/base/assets/images/android-icon-monochrome.png +0 -0
- package/templates/frontend/native/base/assets/images/favicon.png +0 -0
- package/templates/frontend/native/base/assets/images/icon.png +0 -0
- package/templates/frontend/native/base/assets/images/partial-react-logo.png +0 -0
- package/templates/frontend/native/base/assets/images/react-logo.png +0 -0
- package/templates/frontend/native/base/assets/images/react-logo@2x.png +0 -0
- package/templates/frontend/native/base/assets/images/react-logo@3x.png +0 -0
- package/templates/frontend/native/base/assets/images/splash-icon.png +0 -0
- package/templates/frontend/native/unistyles/_gitignore +0 -24
- package/templates/frontend/native/unistyles/app/(drawer)/(tabs)/_layout.tsx.hbs +0 -39
- package/templates/frontend/native/unistyles/app/(drawer)/(tabs)/index.tsx.hbs +0 -37
- package/templates/frontend/native/unistyles/app/(drawer)/(tabs)/two.tsx.hbs +0 -37
- package/templates/frontend/native/unistyles/app/(drawer)/_layout.tsx.hbs +0 -87
- package/templates/frontend/native/unistyles/app/(drawer)/index.tsx.hbs +0 -333
- package/templates/frontend/native/unistyles/app/+not-found.tsx.hbs +0 -65
- package/templates/frontend/native/unistyles/app/_layout.tsx.hbs +0 -169
- package/templates/frontend/native/unistyles/app/modal.tsx.hbs +0 -33
- package/templates/frontend/native/unistyles/app.json.hbs +0 -49
- package/templates/frontend/native/unistyles/babel.config.js.hbs +0 -21
- package/templates/frontend/native/unistyles/breakpoints.ts.hbs +0 -9
- package/templates/frontend/native/unistyles/components/container.tsx.hbs +0 -15
- package/templates/frontend/native/unistyles/components/header-button.tsx.hbs +0 -36
- package/templates/frontend/native/unistyles/components/tabbar-icon.tsx.hbs +0 -8
- package/templates/frontend/native/unistyles/index.js.hbs +0 -2
- package/templates/frontend/native/unistyles/metro.config.js.hbs +0 -5
- package/templates/frontend/native/unistyles/package.json.hbs +0 -51
- package/templates/frontend/native/unistyles/theme.ts.hbs +0 -98
- package/templates/frontend/native/unistyles/tsconfig.json.hbs +0 -12
- package/templates/frontend/native/unistyles/unistyles.ts.hbs +0 -27
- package/templates/frontend/native/uniwind/_gitignore +0 -21
- package/templates/frontend/native/uniwind/app/(drawer)/(tabs)/_layout.tsx.hbs +0 -46
- package/templates/frontend/native/uniwind/app/(drawer)/(tabs)/index.tsx.hbs +0 -15
- package/templates/frontend/native/uniwind/app/(drawer)/(tabs)/two.tsx.hbs +0 -15
- package/templates/frontend/native/uniwind/app/(drawer)/_layout.tsx.hbs +0 -91
- package/templates/frontend/native/uniwind/app/(drawer)/index.tsx.hbs +0 -191
- package/templates/frontend/native/uniwind/app/+not-found.tsx.hbs +0 -27
- package/templates/frontend/native/uniwind/app/_layout.tsx.hbs +0 -132
- package/templates/frontend/native/uniwind/app/modal.tsx.hbs +0 -37
- package/templates/frontend/native/uniwind/app.json.hbs +0 -19
- package/templates/frontend/native/uniwind/components/container.tsx.hbs +0 -33
- package/templates/frontend/native/uniwind/components/theme-toggle.tsx.hbs +0 -35
- package/templates/frontend/native/uniwind/contexts/app-theme-context.tsx.hbs +0 -62
- package/templates/frontend/native/uniwind/global.css +0 -5
- package/templates/frontend/native/uniwind/metro.config.js.hbs +0 -13
- package/templates/frontend/native/uniwind/package.json.hbs +0 -54
- package/templates/frontend/native/uniwind/tsconfig.json.hbs +0 -14
- package/templates/frontend/nuxt/_gitignore +0 -27
- package/templates/frontend/nuxt/app/app.config.ts.hbs +0 -15
- package/templates/frontend/nuxt/app/app.vue.hbs +0 -17
- package/templates/frontend/nuxt/app/assets/css/main.css +0 -2
- package/templates/frontend/nuxt/app/components/Header.vue.hbs +0 -40
- package/templates/frontend/nuxt/app/layouts/default.vue.hbs +0 -10
- package/templates/frontend/nuxt/app/pages/index.vue.hbs +0 -97
- package/templates/frontend/nuxt/nuxt.config.ts.hbs +0 -29
- package/templates/frontend/nuxt/package.json.hbs +0 -24
- package/templates/frontend/nuxt/public/favicon.ico +0 -0
- package/templates/frontend/nuxt/public/robots.txt +0 -2
- package/templates/frontend/nuxt/server/tsconfig.json +0 -3
- package/templates/frontend/nuxt/tsconfig.json.hbs +0 -18
- package/templates/frontend/react/next/next-env.d.ts.hbs +0 -5
- package/templates/frontend/react/next/next.config.ts.hbs +0 -22
- package/templates/frontend/react/next/package.json.hbs +0 -34
- package/templates/frontend/react/next/postcss.config.mjs.hbs +0 -5
- package/templates/frontend/react/next/src/app/favicon.ico +0 -0
- package/templates/frontend/react/next/src/app/layout.tsx.hbs +0 -76
- package/templates/frontend/react/next/src/app/page.tsx.hbs +0 -79
- package/templates/frontend/react/next/src/components/mode-toggle.tsx.hbs +0 -37
- package/templates/frontend/react/next/src/components/providers.tsx.hbs +0 -89
- package/templates/frontend/react/next/src/components/theme-provider.tsx.hbs +0 -11
- package/templates/frontend/react/next/tsconfig.json.hbs +0 -41
- package/templates/frontend/react/react-router/package.json.hbs +0 -42
- package/templates/frontend/react/react-router/public/favicon.ico +0 -0
- package/templates/frontend/react/react-router/react-router.config.ts +0 -6
- package/templates/frontend/react/react-router/src/components/mode-toggle.tsx.hbs +0 -29
- package/templates/frontend/react/react-router/src/components/theme-provider.tsx.hbs +0 -11
- package/templates/frontend/react/react-router/src/root.tsx.hbs +0 -190
- package/templates/frontend/react/react-router/src/routes/_index.tsx.hbs +0 -85
- package/templates/frontend/react/react-router/src/routes.ts +0 -4
- package/templates/frontend/react/react-router/tsconfig.json.hbs +0 -27
- package/templates/frontend/react/react-router/vite.config.ts.hbs +0 -12
- package/templates/frontend/react/tanstack-router/index.html.hbs +0 -13
- package/templates/frontend/react/tanstack-router/package.json.hbs +0 -41
- package/templates/frontend/react/tanstack-router/src/components/mode-toggle.tsx.hbs +0 -29
- package/templates/frontend/react/tanstack-router/src/components/theme-provider.tsx.hbs +0 -11
- package/templates/frontend/react/tanstack-router/src/main.tsx.hbs +0 -90
- package/templates/frontend/react/tanstack-router/src/routes/__root.tsx.hbs +0 -103
- package/templates/frontend/react/tanstack-router/src/routes/index.tsx.hbs +0 -85
- package/templates/frontend/react/tanstack-router/tsconfig.json.hbs +0 -18
- package/templates/frontend/react/tanstack-router/vite.config.ts.hbs +0 -21
- package/templates/frontend/react/tanstack-start/package.json.hbs +0 -43
- package/templates/frontend/react/tanstack-start/public/robots.txt +0 -3
- package/templates/frontend/react/tanstack-start/src/router.tsx.hbs +0 -144
- package/templates/frontend/react/tanstack-start/src/routes/__root.tsx.hbs +0 -208
- package/templates/frontend/react/tanstack-start/src/routes/index.tsx.hbs +0 -85
- package/templates/frontend/react/tanstack-start/tsconfig.json.hbs +0 -28
- package/templates/frontend/react/tanstack-start/vite.config.ts.hbs +0 -22
- package/templates/frontend/react/web-base/_gitignore +0 -60
- package/templates/frontend/react/web-base/components.json +0 -24
- package/templates/frontend/react/web-base/src/components/header.tsx.hbs +0 -78
- package/templates/frontend/react/web-base/src/components/loader.tsx.hbs +0 -9
- package/templates/frontend/react/web-base/src/components/ui/button.tsx.hbs +0 -57
- package/templates/frontend/react/web-base/src/components/ui/card.tsx.hbs +0 -103
- package/templates/frontend/react/web-base/src/components/ui/checkbox.tsx.hbs +0 -26
- package/templates/frontend/react/web-base/src/components/ui/dropdown-menu.tsx.hbs +0 -262
- package/templates/frontend/react/web-base/src/components/ui/input.tsx.hbs +0 -20
- package/templates/frontend/react/web-base/src/components/ui/label.tsx.hbs +0 -20
- package/templates/frontend/react/web-base/src/components/ui/skeleton.tsx.hbs +0 -13
- package/templates/frontend/react/web-base/src/components/ui/sonner.tsx.hbs +0 -44
- package/templates/frontend/react/web-base/src/index.css.hbs +0 -131
- package/templates/frontend/react/web-base/src/lib/utils.ts.hbs +0 -6
- package/templates/frontend/solid/_gitignore +0 -11
- package/templates/frontend/solid/index.html +0 -13
- package/templates/frontend/solid/package.json.hbs +0 -24
- package/templates/frontend/solid/public/robots.txt +0 -3
- package/templates/frontend/solid/src/components/header.tsx.hbs +0 -38
- package/templates/frontend/solid/src/components/loader.tsx +0 -9
- package/templates/frontend/solid/src/main.tsx.hbs +0 -41
- package/templates/frontend/solid/src/routes/__root.tsx.hbs +0 -34
- package/templates/frontend/solid/src/routes/index.tsx.hbs +0 -72
- package/templates/frontend/solid/src/styles.css +0 -5
- package/templates/frontend/solid/tsconfig.json.hbs +0 -29
- package/templates/frontend/solid/vite.config.ts.hbs +0 -21
- package/templates/frontend/svelte/_gitignore +0 -24
- package/templates/frontend/svelte/_npmrc +0 -1
- package/templates/frontend/svelte/package.json.hbs +0 -27
- package/templates/frontend/svelte/src/app.css +0 -5
- package/templates/frontend/svelte/src/app.d.ts +0 -13
- package/templates/frontend/svelte/src/app.html +0 -12
- package/templates/frontend/svelte/src/components/Header.svelte.hbs +0 -40
- package/templates/frontend/svelte/src/lib/index.ts +0 -2
- package/templates/frontend/svelte/src/routes/+layout.svelte.hbs +0 -54
- package/templates/frontend/svelte/src/routes/+page.svelte.hbs +0 -92
- package/templates/frontend/svelte/static/favicon.png +0 -0
- package/templates/frontend/svelte/svelte.config.js.hbs +0 -18
- package/templates/frontend/svelte/tsconfig.json.hbs +0 -19
- package/templates/frontend/svelte/vite.config.ts.hbs +0 -7
- package/templates/packages/config/package.json.hbs +0 -5
- package/templates/packages/config/tsconfig.base.json.hbs +0 -33
- package/templates/packages/env/env.d.ts.hbs +0 -16
- package/templates/packages/env/package.json.hbs +0 -7
- package/templates/packages/env/src/native.ts.hbs +0 -21
- package/templates/packages/env/src/server.ts.hbs +0 -39
- package/templates/packages/env/src/web.ts.hbs +0 -98
- package/templates/packages/env/tsconfig.json.hbs +0 -3
- package/templates/packages/infra/alchemy.run.ts.hbs +0 -271
- package/templates/packages/infra/package.json.hbs +0 -10
- package/templates/payments/polar/server/base/src/lib/payments.ts.hbs +0 -7
- package/templates/payments/polar/web/nuxt/app/pages/success.vue.hbs +0 -11
- package/templates/payments/polar/web/react/next/src/app/success/page.tsx.hbs +0 -15
- package/templates/payments/polar/web/react/react-router/src/routes/success.tsx.hbs +0 -13
- package/templates/payments/polar/web/react/tanstack-router/src/routes/success.tsx.hbs +0 -19
- package/templates/payments/polar/web/react/tanstack-start/src/functions/get-payment.ts.hbs +0 -15
- package/templates/payments/polar/web/react/tanstack-start/src/routes/success.tsx.hbs +0 -19
- package/templates/payments/polar/web/solid/src/routes/success.tsx.hbs +0 -23
- package/templates/payments/polar/web/svelte/src/routes/success/+page.svelte.hbs +0 -12
- /package/dist/{chunk-Dt3mZKp0.mjs → chunk-DPg_XC7m.mjs} +0 -0
|
@@ -1,586 +0,0 @@
|
|
|
1
|
-
{{#if (eq backend "convex")}}
|
|
2
|
-
import { Ionicons } from "@expo/vector-icons";
|
|
3
|
-
import {
|
|
4
|
-
useUIMessages,
|
|
5
|
-
useSmoothText,
|
|
6
|
-
type UIMessage,
|
|
7
|
-
} from "@convex-dev/agent/react";
|
|
8
|
-
import { api } from "@{{projectName}}/backend/convex/_generated/api";
|
|
9
|
-
import { useMutation } from "convex/react";
|
|
10
|
-
import { useRef, useEffect, useState } from "react";
|
|
11
|
-
import {
|
|
12
|
-
View,
|
|
13
|
-
Text,
|
|
14
|
-
TextInput,
|
|
15
|
-
TouchableOpacity,
|
|
16
|
-
ScrollView,
|
|
17
|
-
KeyboardAvoidingView,
|
|
18
|
-
Platform,
|
|
19
|
-
StyleSheet,
|
|
20
|
-
ActivityIndicator,
|
|
21
|
-
} from "react-native";
|
|
22
|
-
|
|
23
|
-
import { Container } from "@/components/container";
|
|
24
|
-
import { useColorScheme } from "@/lib/use-color-scheme";
|
|
25
|
-
import { NAV_THEME } from "@/lib/constants";
|
|
26
|
-
|
|
27
|
-
function MessageContent({
|
|
28
|
-
text,
|
|
29
|
-
isStreaming,
|
|
30
|
-
textColor,
|
|
31
|
-
}: {
|
|
32
|
-
text: string;
|
|
33
|
-
isStreaming: boolean;
|
|
34
|
-
textColor: string;
|
|
35
|
-
}) {
|
|
36
|
-
const [visibleText] = useSmoothText(text, {
|
|
37
|
-
startStreaming: isStreaming,
|
|
38
|
-
});
|
|
39
|
-
return <Text style={[styles.messageText, { color: textColor }]}>{visibleText}</Text>;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export default function AIScreen() {
|
|
43
|
-
const { colorScheme } = useColorScheme();
|
|
44
|
-
const theme = colorScheme === "dark" ? NAV_THEME.dark : NAV_THEME.light;
|
|
45
|
-
const [input, setInput] = useState("");
|
|
46
|
-
const [threadId, setThreadId] = useState<string | null>(null);
|
|
47
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
48
|
-
const scrollViewRef = useRef<ScrollView>(null);
|
|
49
|
-
|
|
50
|
-
const createThread = useMutation(api.chat.createNewThread);
|
|
51
|
-
const sendMessage = useMutation(api.chat.sendMessage);
|
|
52
|
-
|
|
53
|
-
const { results: messages } = useUIMessages(
|
|
54
|
-
api.chat.listMessages,
|
|
55
|
-
threadId ? { threadId } : "skip",
|
|
56
|
-
{ initialNumItems: 50, stream: true },
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
const hasStreamingMessage = messages?.some(
|
|
60
|
-
(m: UIMessage) => m.status === "streaming",
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
useEffect(() => {
|
|
64
|
-
scrollViewRef.current?.scrollToEnd({ animated: true });
|
|
65
|
-
}, [messages]);
|
|
66
|
-
|
|
67
|
-
async function onSubmit() {
|
|
68
|
-
const value = input.trim();
|
|
69
|
-
if (!value || isLoading) return;
|
|
70
|
-
|
|
71
|
-
setIsLoading(true);
|
|
72
|
-
setInput("");
|
|
73
|
-
|
|
74
|
-
try {
|
|
75
|
-
let currentThreadId = threadId;
|
|
76
|
-
if (!currentThreadId) {
|
|
77
|
-
currentThreadId = await createThread();
|
|
78
|
-
setThreadId(currentThreadId);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
await sendMessage({ threadId: currentThreadId, prompt: value });
|
|
82
|
-
} catch (error) {
|
|
83
|
-
console.error("Failed to send message:", error);
|
|
84
|
-
} finally {
|
|
85
|
-
setIsLoading(false);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return (
|
|
90
|
-
<Container>
|
|
91
|
-
<KeyboardAvoidingView
|
|
92
|
-
style={styles.container}
|
|
93
|
-
behavior={Platform.OS === "ios" ? "padding" : "height"}
|
|
94
|
-
>
|
|
95
|
-
<View style={styles.content}>
|
|
96
|
-
<View style={styles.header}>
|
|
97
|
-
<Text style={[styles.headerTitle, { color: theme.text }]}>
|
|
98
|
-
AI Chat
|
|
99
|
-
</Text>
|
|
100
|
-
<Text style={[styles.headerSubtitle, { color: theme.text, opacity: 0.7 }]}>
|
|
101
|
-
Chat with our AI assistant
|
|
102
|
-
</Text>
|
|
103
|
-
</View>
|
|
104
|
-
<ScrollView
|
|
105
|
-
ref={scrollViewRef}
|
|
106
|
-
style={styles.scrollView}
|
|
107
|
-
showsVerticalScrollIndicator={false}
|
|
108
|
-
>
|
|
109
|
-
{!messages || messages.length === 0 ? (
|
|
110
|
-
<View style={styles.emptyContainer}>
|
|
111
|
-
<Text style={[styles.emptyText, { color: theme.text, opacity: 0.7 }]}>
|
|
112
|
-
Ask me anything to get started!
|
|
113
|
-
</Text>
|
|
114
|
-
</View>
|
|
115
|
-
) : (
|
|
116
|
-
<View style={styles.messagesList}>
|
|
117
|
-
{messages.map((message: UIMessage) => (
|
|
118
|
-
<View
|
|
119
|
-
key={message.key}
|
|
120
|
-
style={[
|
|
121
|
-
styles.messageCard,
|
|
122
|
-
{
|
|
123
|
-
backgroundColor: message.role === "user"
|
|
124
|
-
? theme.primary + "20"
|
|
125
|
-
: theme.card,
|
|
126
|
-
borderColor: theme.border,
|
|
127
|
-
alignSelf: message.role === "user" ? "flex-end" : "flex-start",
|
|
128
|
-
marginLeft: message.role === "user" ? 32 : 0,
|
|
129
|
-
marginRight: message.role === "user" ? 0 : 32,
|
|
130
|
-
},
|
|
131
|
-
]}
|
|
132
|
-
>
|
|
133
|
-
<Text style={[styles.messageRole, { color: theme.text }]}>
|
|
134
|
-
{message.role === "user" ? "You" : "AI Assistant"}
|
|
135
|
-
</Text>
|
|
136
|
-
<MessageContent
|
|
137
|
-
text={message.text ?? ""}
|
|
138
|
-
isStreaming={message.status === "streaming"}
|
|
139
|
-
textColor={theme.text}
|
|
140
|
-
/>
|
|
141
|
-
</View>
|
|
142
|
-
))}
|
|
143
|
-
{isLoading && !hasStreamingMessage && (
|
|
144
|
-
<View
|
|
145
|
-
style={[
|
|
146
|
-
styles.messageCard,
|
|
147
|
-
{
|
|
148
|
-
backgroundColor: theme.card,
|
|
149
|
-
borderColor: theme.border,
|
|
150
|
-
alignSelf: "flex-start",
|
|
151
|
-
marginRight: 32,
|
|
152
|
-
},
|
|
153
|
-
]}
|
|
154
|
-
>
|
|
155
|
-
<Text style={[styles.messageRole, { color: theme.text }]}>
|
|
156
|
-
AI Assistant
|
|
157
|
-
</Text>
|
|
158
|
-
<View style={styles.loadingContainer}>
|
|
159
|
-
<ActivityIndicator size="small" color={theme.primary} />
|
|
160
|
-
<Text style={[styles.loadingText, { color: theme.text, opacity: 0.7 }]}>
|
|
161
|
-
Thinking...
|
|
162
|
-
</Text>
|
|
163
|
-
</View>
|
|
164
|
-
</View>
|
|
165
|
-
)}
|
|
166
|
-
</View>
|
|
167
|
-
)}
|
|
168
|
-
</ScrollView>
|
|
169
|
-
<View style={[styles.inputContainer, { borderTopColor: theme.border }]}>
|
|
170
|
-
<View style={styles.inputRow}>
|
|
171
|
-
<TextInput
|
|
172
|
-
value={input}
|
|
173
|
-
onChangeText={setInput}
|
|
174
|
-
placeholder="Type your message..."
|
|
175
|
-
placeholderTextColor={theme.text}
|
|
176
|
-
style={[
|
|
177
|
-
styles.input,
|
|
178
|
-
{
|
|
179
|
-
color: theme.text,
|
|
180
|
-
borderColor: theme.border,
|
|
181
|
-
backgroundColor: theme.background,
|
|
182
|
-
},
|
|
183
|
-
]}
|
|
184
|
-
onSubmitEditing={(e) => {
|
|
185
|
-
e.preventDefault();
|
|
186
|
-
onSubmit();
|
|
187
|
-
}}
|
|
188
|
-
editable={!isLoading}
|
|
189
|
-
autoFocus={true}
|
|
190
|
-
multiline
|
|
191
|
-
/>
|
|
192
|
-
<TouchableOpacity
|
|
193
|
-
onPress={onSubmit}
|
|
194
|
-
disabled={!input.trim() || isLoading}
|
|
195
|
-
style={[
|
|
196
|
-
styles.sendButton,
|
|
197
|
-
{
|
|
198
|
-
backgroundColor: input.trim() && !isLoading ? theme.primary : theme.border,
|
|
199
|
-
opacity: input.trim() && !isLoading ? 1 : 0.5,
|
|
200
|
-
},
|
|
201
|
-
]}
|
|
202
|
-
>
|
|
203
|
-
<Ionicons
|
|
204
|
-
name="send"
|
|
205
|
-
size={20}
|
|
206
|
-
color="#ffffff"
|
|
207
|
-
/>
|
|
208
|
-
</TouchableOpacity>
|
|
209
|
-
</View>
|
|
210
|
-
</View>
|
|
211
|
-
</View>
|
|
212
|
-
</KeyboardAvoidingView>
|
|
213
|
-
</Container>
|
|
214
|
-
);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
const styles = StyleSheet.create({
|
|
218
|
-
container: {
|
|
219
|
-
flex: 1,
|
|
220
|
-
},
|
|
221
|
-
content: {
|
|
222
|
-
flex: 1,
|
|
223
|
-
padding: 16,
|
|
224
|
-
},
|
|
225
|
-
header: {
|
|
226
|
-
marginBottom: 16,
|
|
227
|
-
},
|
|
228
|
-
headerTitle: {
|
|
229
|
-
fontSize: 20,
|
|
230
|
-
fontWeight: "bold",
|
|
231
|
-
marginBottom: 4,
|
|
232
|
-
},
|
|
233
|
-
headerSubtitle: {
|
|
234
|
-
fontSize: 14,
|
|
235
|
-
},
|
|
236
|
-
scrollView: {
|
|
237
|
-
flex: 1,
|
|
238
|
-
marginBottom: 16,
|
|
239
|
-
},
|
|
240
|
-
emptyContainer: {
|
|
241
|
-
flex: 1,
|
|
242
|
-
justifyContent: "center",
|
|
243
|
-
alignItems: "center",
|
|
244
|
-
},
|
|
245
|
-
emptyText: {
|
|
246
|
-
fontSize: 16,
|
|
247
|
-
textAlign: "center",
|
|
248
|
-
},
|
|
249
|
-
messagesList: {
|
|
250
|
-
gap: 8,
|
|
251
|
-
paddingBottom: 16,
|
|
252
|
-
},
|
|
253
|
-
messageCard: {
|
|
254
|
-
borderWidth: 1,
|
|
255
|
-
padding: 12,
|
|
256
|
-
maxWidth: "80%",
|
|
257
|
-
},
|
|
258
|
-
messageRole: {
|
|
259
|
-
fontSize: 12,
|
|
260
|
-
fontWeight: "bold",
|
|
261
|
-
marginBottom: 4,
|
|
262
|
-
},
|
|
263
|
-
messageText: {
|
|
264
|
-
fontSize: 14,
|
|
265
|
-
lineHeight: 20,
|
|
266
|
-
},
|
|
267
|
-
loadingContainer: {
|
|
268
|
-
flexDirection: "row",
|
|
269
|
-
alignItems: "center",
|
|
270
|
-
gap: 8,
|
|
271
|
-
},
|
|
272
|
-
loadingText: {
|
|
273
|
-
fontSize: 14,
|
|
274
|
-
},
|
|
275
|
-
inputContainer: {
|
|
276
|
-
borderTopWidth: 1,
|
|
277
|
-
paddingTop: 12,
|
|
278
|
-
},
|
|
279
|
-
inputRow: {
|
|
280
|
-
flexDirection: "row",
|
|
281
|
-
alignItems: "flex-end",
|
|
282
|
-
gap: 8,
|
|
283
|
-
},
|
|
284
|
-
input: {
|
|
285
|
-
flex: 1,
|
|
286
|
-
borderWidth: 1,
|
|
287
|
-
padding: 8,
|
|
288
|
-
fontSize: 14,
|
|
289
|
-
minHeight: 36,
|
|
290
|
-
maxHeight: 100,
|
|
291
|
-
},
|
|
292
|
-
sendButton: {
|
|
293
|
-
padding: 8,
|
|
294
|
-
justifyContent: "center",
|
|
295
|
-
alignItems: "center",
|
|
296
|
-
},
|
|
297
|
-
});
|
|
298
|
-
{{else}}
|
|
299
|
-
import { useRef, useEffect, useState } from "react";
|
|
300
|
-
import {
|
|
301
|
-
View,
|
|
302
|
-
Text,
|
|
303
|
-
TextInput,
|
|
304
|
-
TouchableOpacity,
|
|
305
|
-
ScrollView,
|
|
306
|
-
KeyboardAvoidingView,
|
|
307
|
-
Platform,
|
|
308
|
-
StyleSheet,
|
|
309
|
-
} from "react-native";
|
|
310
|
-
import { useChat } from "@ai-sdk/react";
|
|
311
|
-
import { DefaultChatTransport } from "ai";
|
|
312
|
-
import { fetch as expoFetch } from "expo/fetch";
|
|
313
|
-
import { Ionicons } from "@expo/vector-icons";
|
|
314
|
-
import { Container } from "@/components/container";
|
|
315
|
-
import { useColorScheme } from "@/lib/use-color-scheme";
|
|
316
|
-
import { NAV_THEME } from "@/lib/constants";
|
|
317
|
-
import { env } from "@{{projectName}}/env/native";
|
|
318
|
-
|
|
319
|
-
const generateAPIUrl = (relativePath: string) => {
|
|
320
|
-
const serverUrl = env.EXPO_PUBLIC_SERVER_URL;
|
|
321
|
-
if (!serverUrl) {
|
|
322
|
-
throw new Error(
|
|
323
|
-
"EXPO_PUBLIC_SERVER_URL environment variable is not defined"
|
|
324
|
-
);
|
|
325
|
-
}
|
|
326
|
-
const path = relativePath.startsWith("/") ? relativePath : `/${relativePath}`;
|
|
327
|
-
return serverUrl.concat(path);
|
|
328
|
-
};
|
|
329
|
-
|
|
330
|
-
export default function AIScreen() {
|
|
331
|
-
const { colorScheme } = useColorScheme();
|
|
332
|
-
const theme = colorScheme === "dark" ? NAV_THEME.dark : NAV_THEME.light;
|
|
333
|
-
const [input, setInput] = useState("");
|
|
334
|
-
const { messages, error, sendMessage } = useChat({
|
|
335
|
-
transport: new DefaultChatTransport({
|
|
336
|
-
fetch: expoFetch as unknown as typeof globalThis.fetch,
|
|
337
|
-
api: generateAPIUrl("/ai"),
|
|
338
|
-
}),
|
|
339
|
-
onError: (error) => console.error(error, "AI Chat Error"),
|
|
340
|
-
});
|
|
341
|
-
const scrollViewRef = useRef<ScrollView>(null);
|
|
342
|
-
|
|
343
|
-
useEffect(() => {
|
|
344
|
-
scrollViewRef.current?.scrollToEnd({ animated: true });
|
|
345
|
-
}, [messages]);
|
|
346
|
-
|
|
347
|
-
function onSubmit() {
|
|
348
|
-
const value = input.trim();
|
|
349
|
-
if (value) {
|
|
350
|
-
sendMessage({ text: value });
|
|
351
|
-
setInput("");
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
if (error) {
|
|
356
|
-
return (
|
|
357
|
-
<Container>
|
|
358
|
-
<View style={styles.errorContainer}>
|
|
359
|
-
<View style={[styles.errorCard, { backgroundColor: theme.notification + "20", borderColor: theme.notification }]}>
|
|
360
|
-
<Text style={[styles.errorTitle, { color: theme.notification }]}>
|
|
361
|
-
Error: {error.message}
|
|
362
|
-
</Text>
|
|
363
|
-
<Text style={[styles.errorText, { color: theme.text, opacity: 0.7 }]}>
|
|
364
|
-
Please check your connection and try again.
|
|
365
|
-
</Text>
|
|
366
|
-
</View>
|
|
367
|
-
</View>
|
|
368
|
-
</Container>
|
|
369
|
-
);
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
return (
|
|
373
|
-
<Container>
|
|
374
|
-
<KeyboardAvoidingView
|
|
375
|
-
style={styles.container}
|
|
376
|
-
behavior={Platform.OS === "ios" ? "padding" : "height"}
|
|
377
|
-
>
|
|
378
|
-
<View style={styles.content}>
|
|
379
|
-
<View style={styles.header}>
|
|
380
|
-
<Text style={[styles.headerTitle, { color: theme.text }]}>
|
|
381
|
-
AI Chat
|
|
382
|
-
</Text>
|
|
383
|
-
<Text style={[styles.headerSubtitle, { color: theme.text, opacity: 0.7 }]}>
|
|
384
|
-
Chat with our AI assistant
|
|
385
|
-
</Text>
|
|
386
|
-
</View>
|
|
387
|
-
<ScrollView
|
|
388
|
-
ref={scrollViewRef}
|
|
389
|
-
style={styles.scrollView}
|
|
390
|
-
showsVerticalScrollIndicator={false}
|
|
391
|
-
>
|
|
392
|
-
{messages.length === 0 ? (
|
|
393
|
-
<View style={styles.emptyContainer}>
|
|
394
|
-
<Text style={[styles.emptyText, { color: theme.text, opacity: 0.7 }]}>
|
|
395
|
-
Ask me anything to get started!
|
|
396
|
-
</Text>
|
|
397
|
-
</View>
|
|
398
|
-
) : (
|
|
399
|
-
<View style={styles.messagesList}>
|
|
400
|
-
{messages.map((message) => (
|
|
401
|
-
<View
|
|
402
|
-
key={message.id}
|
|
403
|
-
style={[
|
|
404
|
-
styles.messageCard,
|
|
405
|
-
{
|
|
406
|
-
backgroundColor: message.role === "user"
|
|
407
|
-
? theme.primary + "20"
|
|
408
|
-
: theme.card,
|
|
409
|
-
borderColor: theme.border,
|
|
410
|
-
alignSelf: message.role === "user" ? "flex-end" : "flex-start",
|
|
411
|
-
marginLeft: message.role === "user" ? 32 : 0,
|
|
412
|
-
marginRight: message.role === "user" ? 0 : 32,
|
|
413
|
-
},
|
|
414
|
-
]}
|
|
415
|
-
>
|
|
416
|
-
<Text style={[styles.messageRole, { color: theme.text }]}>
|
|
417
|
-
{message.role === "user" ? "You" : "AI Assistant"}
|
|
418
|
-
</Text>
|
|
419
|
-
<View style={styles.messageParts}>
|
|
420
|
-
{message.parts.map((part, i) =>
|
|
421
|
-
part.type === "text" ? (
|
|
422
|
-
<Text
|
|
423
|
-
key={`${message.id}-${i}`}
|
|
424
|
-
style={[styles.messageText, { color: theme.text }]}
|
|
425
|
-
>
|
|
426
|
-
{part.text}
|
|
427
|
-
</Text>
|
|
428
|
-
) : (
|
|
429
|
-
<Text
|
|
430
|
-
key={`${message.id}-${i}`}
|
|
431
|
-
style={[styles.messageText, { color: theme.text }]}
|
|
432
|
-
>
|
|
433
|
-
{JSON.stringify(part)}
|
|
434
|
-
</Text>
|
|
435
|
-
)
|
|
436
|
-
)}
|
|
437
|
-
</View>
|
|
438
|
-
</View>
|
|
439
|
-
))}
|
|
440
|
-
</View>
|
|
441
|
-
)}
|
|
442
|
-
</ScrollView>
|
|
443
|
-
<View style={[styles.inputContainer, { borderTopColor: theme.border }]}>
|
|
444
|
-
<View style={styles.inputRow}>
|
|
445
|
-
<TextInput
|
|
446
|
-
value={input}
|
|
447
|
-
onChangeText={setInput}
|
|
448
|
-
placeholder="Type your message..."
|
|
449
|
-
placeholderTextColor={theme.text}
|
|
450
|
-
style={[
|
|
451
|
-
styles.input,
|
|
452
|
-
{
|
|
453
|
-
color: theme.text,
|
|
454
|
-
borderColor: theme.border,
|
|
455
|
-
backgroundColor: theme.background,
|
|
456
|
-
},
|
|
457
|
-
]}
|
|
458
|
-
onSubmitEditing={(e) => {
|
|
459
|
-
e.preventDefault();
|
|
460
|
-
onSubmit();
|
|
461
|
-
}}
|
|
462
|
-
autoFocus={true}
|
|
463
|
-
multiline
|
|
464
|
-
/>
|
|
465
|
-
<TouchableOpacity
|
|
466
|
-
onPress={onSubmit}
|
|
467
|
-
disabled={!input.trim()}
|
|
468
|
-
style={[
|
|
469
|
-
styles.sendButton,
|
|
470
|
-
{
|
|
471
|
-
backgroundColor: input.trim() ? theme.primary : theme.border,
|
|
472
|
-
opacity: input.trim() ? 1 : 0.5,
|
|
473
|
-
},
|
|
474
|
-
]}
|
|
475
|
-
>
|
|
476
|
-
<Ionicons
|
|
477
|
-
name="send"
|
|
478
|
-
size={20}
|
|
479
|
-
color="#ffffff"
|
|
480
|
-
/>
|
|
481
|
-
</TouchableOpacity>
|
|
482
|
-
</View>
|
|
483
|
-
</View>
|
|
484
|
-
</View>
|
|
485
|
-
</KeyboardAvoidingView>
|
|
486
|
-
</Container>
|
|
487
|
-
);
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
const styles = StyleSheet.create({
|
|
491
|
-
container: {
|
|
492
|
-
flex: 1,
|
|
493
|
-
},
|
|
494
|
-
content: {
|
|
495
|
-
flex: 1,
|
|
496
|
-
padding: 16,
|
|
497
|
-
},
|
|
498
|
-
header: {
|
|
499
|
-
marginBottom: 16,
|
|
500
|
-
},
|
|
501
|
-
headerTitle: {
|
|
502
|
-
fontSize: 20,
|
|
503
|
-
fontWeight: "bold",
|
|
504
|
-
marginBottom: 4,
|
|
505
|
-
},
|
|
506
|
-
headerSubtitle: {
|
|
507
|
-
fontSize: 14,
|
|
508
|
-
},
|
|
509
|
-
scrollView: {
|
|
510
|
-
flex: 1,
|
|
511
|
-
marginBottom: 16,
|
|
512
|
-
},
|
|
513
|
-
emptyContainer: {
|
|
514
|
-
flex: 1,
|
|
515
|
-
justifyContent: "center",
|
|
516
|
-
alignItems: "center",
|
|
517
|
-
},
|
|
518
|
-
emptyText: {
|
|
519
|
-
fontSize: 16,
|
|
520
|
-
textAlign: "center",
|
|
521
|
-
},
|
|
522
|
-
messagesList: {
|
|
523
|
-
gap: 8,
|
|
524
|
-
paddingBottom: 16,
|
|
525
|
-
},
|
|
526
|
-
messageCard: {
|
|
527
|
-
borderWidth: 1,
|
|
528
|
-
padding: 12,
|
|
529
|
-
maxWidth: "80%",
|
|
530
|
-
},
|
|
531
|
-
messageRole: {
|
|
532
|
-
fontSize: 12,
|
|
533
|
-
fontWeight: "bold",
|
|
534
|
-
marginBottom: 4,
|
|
535
|
-
},
|
|
536
|
-
messageParts: {
|
|
537
|
-
gap: 4,
|
|
538
|
-
},
|
|
539
|
-
messageText: {
|
|
540
|
-
fontSize: 14,
|
|
541
|
-
lineHeight: 20,
|
|
542
|
-
},
|
|
543
|
-
inputContainer: {
|
|
544
|
-
borderTopWidth: 1,
|
|
545
|
-
paddingTop: 12,
|
|
546
|
-
},
|
|
547
|
-
inputRow: {
|
|
548
|
-
flexDirection: "row",
|
|
549
|
-
alignItems: "flex-end",
|
|
550
|
-
gap: 8,
|
|
551
|
-
},
|
|
552
|
-
input: {
|
|
553
|
-
flex: 1,
|
|
554
|
-
borderWidth: 1,
|
|
555
|
-
padding: 8,
|
|
556
|
-
fontSize: 14,
|
|
557
|
-
minHeight: 36,
|
|
558
|
-
maxHeight: 100,
|
|
559
|
-
},
|
|
560
|
-
sendButton: {
|
|
561
|
-
padding: 8,
|
|
562
|
-
justifyContent: "center",
|
|
563
|
-
alignItems: "center",
|
|
564
|
-
},
|
|
565
|
-
errorContainer: {
|
|
566
|
-
flex: 1,
|
|
567
|
-
justifyContent: "center",
|
|
568
|
-
alignItems: "center",
|
|
569
|
-
padding: 16,
|
|
570
|
-
},
|
|
571
|
-
errorCard: {
|
|
572
|
-
borderWidth: 1,
|
|
573
|
-
padding: 16,
|
|
574
|
-
},
|
|
575
|
-
errorTitle: {
|
|
576
|
-
fontSize: 16,
|
|
577
|
-
fontWeight: "bold",
|
|
578
|
-
marginBottom: 8,
|
|
579
|
-
textAlign: "center",
|
|
580
|
-
},
|
|
581
|
-
errorText: {
|
|
582
|
-
fontSize: 14,
|
|
583
|
-
textAlign: "center",
|
|
584
|
-
},
|
|
585
|
-
});
|
|
586
|
-
{{/if}}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Platform } from 'react-native';
|
|
2
|
-
import structuredClone from '@ungap/structured-clone';
|
|
3
|
-
|
|
4
|
-
if (Platform.OS !== 'web') {
|
|
5
|
-
const setupPolyfills = async () => {
|
|
6
|
-
const { polyfillGlobal } = await import(
|
|
7
|
-
'react-native/Libraries/Utilities/PolyfillFunctions'
|
|
8
|
-
);
|
|
9
|
-
|
|
10
|
-
const { TextEncoderStream, TextDecoderStream } = await import(
|
|
11
|
-
'@stardazed/streams-text-encoding'
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
if (!('structuredClone' in global)) {
|
|
15
|
-
polyfillGlobal('structuredClone', () => structuredClone);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
polyfillGlobal('TextEncoderStream', () => TextEncoderStream);
|
|
19
|
-
polyfillGlobal('TextDecoderStream', () => TextDecoderStream);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
setupPolyfills();
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export {};
|