@tanstack/cta-ui 0.10.0-alpha.24 → 0.10.0-alpha.27

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.
Files changed (80) hide show
  1. package/README.md +20 -0
  2. package/dist/assets/index-DSKioOfX.css +1 -0
  3. package/dist/assets/index-DWTDdndE.js +213 -0
  4. package/dist/assets/index-DWTDdndE.js.map +1 -0
  5. package/dist/favicon.ico +0 -0
  6. package/dist/index.html +19 -0
  7. package/dist/logo-color-100w.png +0 -0
  8. package/dist/logo192.png +0 -0
  9. package/dist/logo512.png +0 -0
  10. package/dist/manifest.json +25 -0
  11. package/dist/robots.txt +3 -0
  12. package/dist/tailwind.svg +1 -0
  13. package/dist/tanstack.png +0 -0
  14. package/dist/typescript.svg +1 -0
  15. package/index.html +18 -0
  16. package/lib/engine-handling/add-to-app-wrapper.ts +134 -0
  17. package/{src → lib}/engine-handling/create-app-wrapper.ts +48 -39
  18. package/{src → lib}/engine-handling/file-helpers.ts +4 -2
  19. package/{src → lib}/engine-handling/generate-initial-payload.ts +58 -51
  20. package/lib/engine-handling/server-environment.ts +37 -0
  21. package/lib/index.ts +150 -34
  22. package/lib/types.d.ts +20 -0
  23. package/lib-dist/engine-handling/add-to-app-wrapper.d.ts +14 -0
  24. package/lib-dist/engine-handling/add-to-app-wrapper.js +78 -0
  25. package/lib-dist/engine-handling/create-app-wrapper.d.ts +14 -0
  26. package/lib-dist/engine-handling/create-app-wrapper.js +70 -0
  27. package/lib-dist/engine-handling/file-helpers.d.ts +2 -0
  28. package/lib-dist/engine-handling/file-helpers.js +21 -0
  29. package/lib-dist/engine-handling/framework-registration.d.ts +1 -0
  30. package/lib-dist/engine-handling/framework-registration.js +10 -0
  31. package/lib-dist/engine-handling/generate-initial-payload.d.ts +32 -0
  32. package/lib-dist/engine-handling/generate-initial-payload.js +88 -0
  33. package/lib-dist/engine-handling/server-environment.d.ts +17 -0
  34. package/lib-dist/engine-handling/server-environment.js +18 -0
  35. package/lib-dist/index.d.ts +5 -7
  36. package/lib-dist/index.js +124 -18
  37. package/package.json +12 -12
  38. package/public/logo-color-100w.png +0 -0
  39. package/src/components/background-animation.tsx +229 -0
  40. package/src/components/cta-sidebar.tsx +28 -33
  41. package/src/components/file-navigator.tsx +72 -74
  42. package/src/components/header.tsx +31 -0
  43. package/src/components/sidebar-items/add-ons.tsx +48 -45
  44. package/src/components/sidebar-items/mode-selector.tsx +6 -4
  45. package/src/components/sidebar-items/project-name.tsx +4 -5
  46. package/src/components/sidebar-items/typescript-switch.tsx +3 -3
  47. package/src/components/startup-dialog.tsx +4 -6
  48. package/src/components/ui/switch.tsx +6 -6
  49. package/src/hooks/use-mounted.ts +9 -0
  50. package/src/hooks/use-preferred-reduced-motion.ts +27 -0
  51. package/src/index.tsx +48 -0
  52. package/src/lib/api.ts +10 -8
  53. package/src/main.tsx +12 -0
  54. package/src/store/project.ts +36 -20
  55. package/src/styles.css +90 -18
  56. package/src/types.d.ts +1 -1
  57. package/tailwind.config.cjs +47 -0
  58. package/vite.config.ts +16 -0
  59. package/app.config.js +0 -22
  60. package/src/api.ts +0 -6
  61. package/src/client.tsx +0 -8
  62. package/src/engine-handling/add-to-app-wrapper.ts +0 -114
  63. package/src/engine-handling/server-environment.ts +0 -30
  64. package/src/integrations/tanstack-query/layout.tsx +0 -5
  65. package/src/integrations/tanstack-query/root-provider.tsx +0 -15
  66. package/src/logo.svg +0 -44
  67. package/src/routeTree.gen.ts +0 -88
  68. package/src/router.tsx +0 -32
  69. package/src/routes/__root.tsx +0 -86
  70. package/src/routes/api/add-to-app.ts +0 -21
  71. package/src/routes/api/create-app.ts +0 -21
  72. package/src/routes/api/dry-run-add-to-app.ts +0 -16
  73. package/src/routes/api/dry-run-create-app.ts +0 -16
  74. package/src/routes/api/initial-payload.ts +0 -10
  75. package/src/routes/api/load-remote-add-on.ts +0 -42
  76. package/src/routes/api/load-starter.ts +0 -47
  77. package/src/routes/api/shutdown.ts +0 -11
  78. package/src/routes/index.tsx +0 -17
  79. package/src/ssr.tsx +0 -12
  80. /package/{src → lib}/engine-handling/framework-registration.ts +0 -0
@@ -1,88 +0,0 @@
1
- /* eslint-disable */
2
-
3
- // @ts-nocheck
4
-
5
- // noinspection JSUnusedGlobalSymbols
6
-
7
- // This file was automatically generated by TanStack Router.
8
- // You should NOT make any changes in this file as it will be overwritten.
9
- // Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
10
-
11
- // Import Routes
12
-
13
- import { Route as rootRoute } from './routes/__root'
14
- import { Route as IndexImport } from './routes/index'
15
-
16
- // Create/Update Routes
17
-
18
- const IndexRoute = IndexImport.update({
19
- id: '/',
20
- path: '/',
21
- getParentRoute: () => rootRoute,
22
- } as any)
23
-
24
- // Populate the FileRoutesByPath interface
25
-
26
- declare module '@tanstack/react-router' {
27
- interface FileRoutesByPath {
28
- '/': {
29
- id: '/'
30
- path: '/'
31
- fullPath: '/'
32
- preLoaderRoute: typeof IndexImport
33
- parentRoute: typeof rootRoute
34
- }
35
- }
36
- }
37
-
38
- // Create and export the route tree
39
-
40
- export interface FileRoutesByFullPath {
41
- '/': typeof IndexRoute
42
- }
43
-
44
- export interface FileRoutesByTo {
45
- '/': typeof IndexRoute
46
- }
47
-
48
- export interface FileRoutesById {
49
- __root__: typeof rootRoute
50
- '/': typeof IndexRoute
51
- }
52
-
53
- export interface FileRouteTypes {
54
- fileRoutesByFullPath: FileRoutesByFullPath
55
- fullPaths: '/'
56
- fileRoutesByTo: FileRoutesByTo
57
- to: '/'
58
- id: '__root__' | '/'
59
- fileRoutesById: FileRoutesById
60
- }
61
-
62
- export interface RootRouteChildren {
63
- IndexRoute: typeof IndexRoute
64
- }
65
-
66
- const rootRouteChildren: RootRouteChildren = {
67
- IndexRoute: IndexRoute,
68
- }
69
-
70
- export const routeTree = rootRoute
71
- ._addFileChildren(rootRouteChildren)
72
- ._addFileTypes<FileRouteTypes>()
73
-
74
- /* ROUTE_MANIFEST_START
75
- {
76
- "routes": {
77
- "__root__": {
78
- "filePath": "__root.tsx",
79
- "children": [
80
- "/"
81
- ]
82
- },
83
- "/": {
84
- "filePath": "index.tsx"
85
- }
86
- }
87
- }
88
- ROUTE_MANIFEST_END */
package/src/router.tsx DELETED
@@ -1,32 +0,0 @@
1
- import { createRouter as createTanstackRouter } from '@tanstack/react-router'
2
- import { routerWithQueryClient } from '@tanstack/react-router-with-query'
3
- import * as TanstackQuery from './integrations/tanstack-query/root-provider'
4
-
5
- // Import the generated route tree
6
- import { routeTree } from './routeTree.gen'
7
-
8
- import './styles.css'
9
-
10
- // Create a new router instance
11
- export const createRouter = () => {
12
- const router = routerWithQueryClient(
13
- createTanstackRouter({
14
- routeTree,
15
- context: {
16
- ...TanstackQuery.getContext(),
17
- },
18
- scrollRestoration: true,
19
- defaultPreloadStaleTime: 0,
20
- }),
21
- TanstackQuery.getContext().queryClient,
22
- )
23
-
24
- return router
25
- }
26
-
27
- // Register the router instance for type safety
28
- declare module '@tanstack/react-router' {
29
- interface Register {
30
- router: ReturnType<typeof createRouter>
31
- }
32
- }
@@ -1,86 +0,0 @@
1
- import {
2
- HeadContent,
3
- Outlet,
4
- Scripts,
5
- createRootRouteWithContext,
6
- } from '@tanstack/react-router'
7
-
8
- import appCss from '../styles.css?url'
9
-
10
- import type { QueryClient } from '@tanstack/react-query'
11
-
12
- import {
13
- SidebarProvider,
14
- SidebarTrigger,
15
- useSidebar,
16
- } from '@/components/ui/sidebar'
17
- import { Toaster } from '@/components/toaster'
18
-
19
- import { AppSidebar } from '@/components/cta-sidebar'
20
-
21
- interface MyRouterContext {
22
- queryClient: QueryClient
23
- }
24
-
25
- function Content() {
26
- const { open } = useSidebar()
27
-
28
- return (
29
- <main
30
- className={
31
- open ? 'w-full max-w-[calc(100%-370px)]' : 'w-full max-w-[100%]'
32
- }
33
- >
34
- <SidebarTrigger className="m-2" />
35
- <Outlet />
36
- </main>
37
- )
38
- }
39
- export const Route = createRootRouteWithContext<MyRouterContext>()({
40
- head: () => ({
41
- meta: [
42
- {
43
- charSet: 'utf-8',
44
- },
45
- {
46
- name: 'viewport',
47
- content: 'width=device-width, initial-scale=1',
48
- },
49
- {
50
- title: 'TanStack CTA',
51
- },
52
- ],
53
- links: [
54
- {
55
- rel: 'stylesheet',
56
- href: appCss,
57
- },
58
- ],
59
- }),
60
-
61
- component: () => {
62
- return (
63
- <RootDocument>
64
- <SidebarProvider>
65
- <AppSidebar />
66
- <Content />
67
- <Toaster />
68
- </SidebarProvider>
69
- </RootDocument>
70
- )
71
- },
72
- })
73
-
74
- function RootDocument({ children }: { children: React.ReactNode }) {
75
- return (
76
- <html lang="en">
77
- <head>
78
- <HeadContent />
79
- </head>
80
- <body className="dark">
81
- {children}
82
- <Scripts />
83
- </body>
84
- </html>
85
- )
86
- }
@@ -1,21 +0,0 @@
1
- import { createAPIFileRoute } from '@tanstack/react-start/api'
2
-
3
- import { addToAppWrapper } from '@/engine-handling/add-to-app-wrapper'
4
-
5
- export const APIRoute = createAPIFileRoute('/api/add-to-app')({
6
- POST: async ({ request }) => {
7
- const { addOns } = await request.json()
8
-
9
- const stream = await addToAppWrapper(addOns, {
10
- stream: true,
11
- })
12
-
13
- return new Response(stream as ReadableStream, {
14
- headers: {
15
- 'Content-Type': 'text/event-stream',
16
- 'Cache-Control': 'no-cache',
17
- Connection: 'keep-alive',
18
- },
19
- })
20
- },
21
- })
@@ -1,21 +0,0 @@
1
- import { createAPIFileRoute } from '@tanstack/react-start/api'
2
-
3
- import { createAppWrapper } from '@/engine-handling/create-app-wrapper'
4
-
5
- export const APIRoute = createAPIFileRoute('/api/create-app')({
6
- POST: async ({ request }) => {
7
- const { options: serializedOptions } = await request.json()
8
-
9
- const stream = await createAppWrapper(serializedOptions, {
10
- stream: true,
11
- })
12
-
13
- return new Response(stream as ReadableStream, {
14
- headers: {
15
- 'Content-Type': 'text/event-stream',
16
- 'Cache-Control': 'no-cache',
17
- Connection: 'keep-alive',
18
- },
19
- })
20
- },
21
- })
@@ -1,16 +0,0 @@
1
- import { json } from '@tanstack/react-start'
2
- import { createAPIFileRoute } from '@tanstack/react-start/api'
3
-
4
- import { addToAppWrapper } from '@/engine-handling/add-to-app-wrapper'
5
-
6
- export const APIRoute = createAPIFileRoute('/api/dry-run-add-to-app')({
7
- POST: async ({ request }) => {
8
- const { addOns } = await request.json()
9
-
10
- return json(
11
- await addToAppWrapper(addOns, {
12
- dryRun: true,
13
- }),
14
- )
15
- },
16
- })
@@ -1,16 +0,0 @@
1
- import { json } from '@tanstack/react-start'
2
- import { createAPIFileRoute } from '@tanstack/react-start/api'
3
-
4
- import { createAppWrapper } from '@/engine-handling/create-app-wrapper'
5
-
6
- export const APIRoute = createAPIFileRoute('/api/dry-run-create-app')({
7
- POST: async ({ request }) => {
8
- const { options: serializedOptions } = await request.json()
9
-
10
- return json(
11
- await createAppWrapper(serializedOptions, {
12
- dryRun: true,
13
- }),
14
- )
15
- },
16
- })
@@ -1,10 +0,0 @@
1
- import { json } from '@tanstack/react-start'
2
- import { createAPIFileRoute } from '@tanstack/react-start/api'
3
-
4
- import { generateInitialPayload } from '@/engine-handling/generate-initial-payload'
5
-
6
- export const APIRoute = createAPIFileRoute('/api/initial-payload')({
7
- GET: async () => {
8
- return json(await generateInitialPayload())
9
- },
10
- })
@@ -1,42 +0,0 @@
1
- import { json } from '@tanstack/react-start'
2
- import { createAPIFileRoute } from '@tanstack/react-start/api'
3
-
4
- import { AddOnCompiledSchema } from '@tanstack/cta-engine'
5
-
6
- export const APIRoute = createAPIFileRoute('/api/load-remote-add-on')({
7
- GET: async ({ request }) => {
8
- const incomingUrl = new URL(request.url)
9
- const url = incomingUrl.searchParams.get('url')
10
-
11
- if (!url) {
12
- return json({ error: 'url is required' }, { status: 400 })
13
- }
14
-
15
- try {
16
- const response = await fetch(url)
17
- const data = await response.json()
18
-
19
- const parsed = AddOnCompiledSchema.safeParse(data)
20
-
21
- if (!parsed.success) {
22
- return json({ error: 'Invalid add-on data' }, { status: 400 })
23
- }
24
-
25
- return json({
26
- id: url,
27
- name: parsed.data.name,
28
- description: parsed.data.description,
29
- version: parsed.data.version,
30
- author: parsed.data.author,
31
- license: parsed.data.license,
32
- link: parsed.data.link,
33
- smallLogo: parsed.data.smallLogo,
34
- logo: parsed.data.logo,
35
- type: parsed.data.type,
36
- modes: parsed.data.modes,
37
- })
38
- } catch {
39
- return json({ error: 'Failed to load add-on' }, { status: 500 })
40
- }
41
- },
42
- })
@@ -1,47 +0,0 @@
1
- import { json } from '@tanstack/react-start'
2
- import { createAPIFileRoute } from '@tanstack/react-start/api'
3
-
4
- import { StarterCompiledSchema } from '@tanstack/cta-engine'
5
-
6
- export const APIRoute = createAPIFileRoute('/api/load-starter')({
7
- GET: async ({ request }) => {
8
- const incomingUrl = new URL(request.url)
9
- const url = incomingUrl.searchParams.get('url')
10
-
11
- if (!url) {
12
- return json({ error: 'url is required' }, { status: 400 })
13
- }
14
-
15
- try {
16
- const response = await fetch(url)
17
- const data = await response.json()
18
-
19
- const parsed = StarterCompiledSchema.safeParse(data)
20
-
21
- if (!parsed.success) {
22
- return json({ error: 'Invalid starter data' }, { status: 400 })
23
- }
24
-
25
- return json({
26
- url,
27
-
28
- id: parsed.data.id,
29
- name: parsed.data.name,
30
- description: parsed.data.description,
31
- version: parsed.data.version,
32
- author: parsed.data.author,
33
- license: parsed.data.license,
34
- dependsOn: parsed.data.dependsOn,
35
-
36
- mode: parsed.data.mode,
37
- typescript: parsed.data.typescript,
38
- tailwind: parsed.data.tailwind,
39
- banner: parsed.data.banner
40
- ? url.replace('starter.json', parsed.data.banner)
41
- : undefined,
42
- })
43
- } catch {
44
- return json({ error: 'Failed to load starter' }, { status: 500 })
45
- }
46
- },
47
- })
@@ -1,11 +0,0 @@
1
- import { json } from '@tanstack/react-start'
2
- import { createAPIFileRoute } from '@tanstack/react-start/api'
3
-
4
- export const APIRoute = createAPIFileRoute('/api/shutdown')({
5
- POST: () => {
6
- setTimeout(() => {
7
- process.exit(0)
8
- }, 50)
9
- return json({ shutdown: true })
10
- },
11
- })
@@ -1,17 +0,0 @@
1
- import { createFileRoute } from '@tanstack/react-router'
2
-
3
- import FileNavigator from '@/components/file-navigator'
4
- import StartupDialog from '@/components/startup-dialog'
5
-
6
- export const Route = createFileRoute('/')({
7
- component: App,
8
- })
9
-
10
- function App() {
11
- return (
12
- <div className="pl-3">
13
- <FileNavigator />
14
- <StartupDialog />
15
- </div>
16
- )
17
- }
package/src/ssr.tsx DELETED
@@ -1,12 +0,0 @@
1
- import {
2
- createStartHandler,
3
- defaultStreamHandler,
4
- } from '@tanstack/react-start/server'
5
- import { getRouterManifest } from '@tanstack/react-start/router-manifest'
6
-
7
- import { createRouter } from './router'
8
-
9
- export default createStartHandler({
10
- createRouter,
11
- getRouterManifest,
12
- })(defaultStreamHandler)