@tanstack/cta-ui-base 0.15.4

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 (172) hide show
  1. package/LICENSE +21 -0
  2. package/components.json +21 -0
  3. package/dist/app.d.ts +1 -0
  4. package/dist/app.js +10 -0
  5. package/dist/components/add-on-info-dialog.d.ts +5 -0
  6. package/dist/components/add-on-info-dialog.js +5 -0
  7. package/dist/components/background-animation.d.ts +1 -0
  8. package/dist/components/background-animation.js +144 -0
  9. package/dist/components/cta-provider.d.ts +3 -0
  10. package/dist/components/cta-provider.js +11 -0
  11. package/dist/components/cta-sidebar.d.ts +1 -0
  12. package/dist/components/cta-sidebar.js +15 -0
  13. package/dist/components/custom-add-on-dialog.d.ts +1 -0
  14. package/dist/components/custom-add-on-dialog.js +38 -0
  15. package/dist/components/file-navigator.d.ts +2 -0
  16. package/dist/components/file-navigator.js +86 -0
  17. package/dist/components/file-tree.d.ts +5 -0
  18. package/dist/components/file-tree.js +14 -0
  19. package/dist/components/file-viewer.d.ts +5 -0
  20. package/dist/components/file-viewer.js +40 -0
  21. package/dist/components/header.d.ts +1 -0
  22. package/dist/components/header.js +5 -0
  23. package/dist/components/icons/tailwind.d.ts +3 -0
  24. package/dist/components/icons/tailwind.js +5 -0
  25. package/dist/components/icons/tanstack.d.ts +3 -0
  26. package/dist/components/icons/tanstack.js +5 -0
  27. package/dist/components/icons/typescript.d.ts +3 -0
  28. package/dist/components/icons/typescript.js +5 -0
  29. package/dist/components/query-provider.d.ts +3 -0
  30. package/dist/components/query-provider.js +7 -0
  31. package/dist/components/sidebar-items/add-ons.d.ts +1 -0
  32. package/dist/components/sidebar-items/add-ons.js +27 -0
  33. package/dist/components/sidebar-items/mode-selector.d.ts +1 -0
  34. package/dist/components/sidebar-items/mode-selector.js +19 -0
  35. package/dist/components/sidebar-items/project-name.d.ts +1 -0
  36. package/dist/components/sidebar-items/project-name.js +12 -0
  37. package/dist/components/sidebar-items/run-add-ons.d.ts +1 -0
  38. package/dist/components/sidebar-items/run-add-ons.js +25 -0
  39. package/dist/components/sidebar-items/run-create-app.d.ts +1 -0
  40. package/dist/components/sidebar-items/run-create-app.js +28 -0
  41. package/dist/components/sidebar-items/sidebar-container.d.ts +3 -0
  42. package/dist/components/sidebar-items/sidebar-container.js +4 -0
  43. package/dist/components/sidebar-items/sidebar-group.d.ts +3 -0
  44. package/dist/components/sidebar-items/sidebar-group.js +4 -0
  45. package/dist/components/sidebar-items/starter.d.ts +1 -0
  46. package/dist/components/sidebar-items/starter.js +42 -0
  47. package/dist/components/sidebar-items/typescript-switch.d.ts +1 -0
  48. package/dist/components/sidebar-items/typescript-switch.js +18 -0
  49. package/dist/components/starters-carousel.d.ts +3 -0
  50. package/dist/components/starters-carousel.js +12 -0
  51. package/dist/components/startup-dialog.d.ts +1 -0
  52. package/dist/components/startup-dialog.js +30 -0
  53. package/dist/components/status-list.d.ts +5 -0
  54. package/dist/components/status-list.js +4 -0
  55. package/dist/components/toaster.d.ts +4 -0
  56. package/dist/components/toaster.js +15 -0
  57. package/dist/components/ui/button.d.ts +10 -0
  58. package/dist/components/ui/button.js +32 -0
  59. package/dist/components/ui/carousel.d.ts +20 -0
  60. package/dist/components/ui/carousel.js +90 -0
  61. package/dist/components/ui/checkbox.d.ts +4 -0
  62. package/dist/components/ui/checkbox.js +9 -0
  63. package/dist/components/ui/dialog.d.ts +15 -0
  64. package/dist/components/ui/dialog.js +36 -0
  65. package/dist/components/ui/dropdown-menu.d.ts +25 -0
  66. package/dist/components/ui/dropdown-menu.js +51 -0
  67. package/dist/components/ui/input.d.ts +3 -0
  68. package/dist/components/ui/input.js +7 -0
  69. package/dist/components/ui/label.d.ts +4 -0
  70. package/dist/components/ui/label.js +8 -0
  71. package/dist/components/ui/popover.d.ts +7 -0
  72. package/dist/components/ui/popover.js +17 -0
  73. package/dist/components/ui/separator.d.ts +4 -0
  74. package/dist/components/ui/separator.js +9 -0
  75. package/dist/components/ui/sheet.d.ts +13 -0
  76. package/dist/components/ui/sheet.js +40 -0
  77. package/dist/components/ui/skeleton.d.ts +2 -0
  78. package/dist/components/ui/skeleton.js +6 -0
  79. package/dist/components/ui/sonner.d.ts +3 -0
  80. package/dist/components/ui/sonner.js +12 -0
  81. package/dist/components/ui/switch.d.ts +4 -0
  82. package/dist/components/ui/switch.js +8 -0
  83. package/dist/components/ui/table.d.ts +10 -0
  84. package/dist/components/ui/table.js +28 -0
  85. package/dist/components/ui/tabs.d.ts +7 -0
  86. package/dist/components/ui/tabs.js +17 -0
  87. package/dist/components/ui/toggle-group.d.ts +7 -0
  88. package/dist/components/ui/toggle-group.js +20 -0
  89. package/dist/components/ui/toggle.d.ts +9 -0
  90. package/dist/components/ui/toggle.js +27 -0
  91. package/dist/components/ui/tooltip.d.ts +7 -0
  92. package/dist/components/ui/tooltip.js +18 -0
  93. package/dist/components/ui/tree-view.d.ts +25 -0
  94. package/dist/components/ui/tree-view.js +151 -0
  95. package/dist/file-classes.d.ts +8 -0
  96. package/dist/file-classes.js +41 -0
  97. package/dist/hooks/use-mounted.d.ts +1 -0
  98. package/dist/hooks/use-mounted.js +8 -0
  99. package/dist/hooks/use-preferred-reduced-motion.d.ts +5 -0
  100. package/dist/hooks/use-preferred-reduced-motion.js +20 -0
  101. package/dist/hooks/use-streaming-status.d.ts +6 -0
  102. package/dist/hooks/use-streaming-status.js +55 -0
  103. package/dist/index.d.ts +20 -0
  104. package/dist/index.js +20 -0
  105. package/dist/lib/api.d.ts +14 -0
  106. package/dist/lib/api.js +74 -0
  107. package/dist/lib/utils.d.ts +2 -0
  108. package/dist/lib/utils.js +5 -0
  109. package/dist/store/add-ons.d.ts +7 -0
  110. package/dist/store/add-ons.js +59 -0
  111. package/dist/store/project.d.ts +76 -0
  112. package/dist/store/project.js +269 -0
  113. package/package.json +50 -0
  114. package/src/app.tsx +28 -0
  115. package/src/components/add-on-info-dialog.tsx +39 -0
  116. package/src/components/background-animation.tsx +224 -0
  117. package/src/components/cta-provider.tsx +22 -0
  118. package/src/components/cta-sidebar.tsx +43 -0
  119. package/src/components/custom-add-on-dialog.tsx +79 -0
  120. package/src/components/file-navigator.tsx +207 -0
  121. package/src/components/file-tree.tsx +35 -0
  122. package/src/components/file-viewer.tsx +67 -0
  123. package/src/components/header.tsx +29 -0
  124. package/src/components/icons/tailwind.tsx +26 -0
  125. package/src/components/icons/tanstack.tsx +338 -0
  126. package/src/components/icons/typescript.tsx +23 -0
  127. package/src/components/query-provider.tsx +10 -0
  128. package/src/components/sidebar-items/add-ons.tsx +94 -0
  129. package/src/components/sidebar-items/mode-selector.tsx +56 -0
  130. package/src/components/sidebar-items/project-name.tsx +32 -0
  131. package/src/components/sidebar-items/run-add-ons.tsx +71 -0
  132. package/src/components/sidebar-items/run-create-app.tsx +82 -0
  133. package/src/components/sidebar-items/sidebar-container.tsx +11 -0
  134. package/src/components/sidebar-items/sidebar-group.tsx +11 -0
  135. package/src/components/sidebar-items/starter.tsx +123 -0
  136. package/src/components/sidebar-items/typescript-switch.tsx +58 -0
  137. package/src/components/starters-carousel.tsx +41 -0
  138. package/src/components/startup-dialog.tsx +72 -0
  139. package/src/components/status-list.tsx +22 -0
  140. package/src/components/toaster.tsx +29 -0
  141. package/src/components/ui/button.tsx +61 -0
  142. package/src/components/ui/carousel.tsx +239 -0
  143. package/src/components/ui/checkbox.tsx +30 -0
  144. package/src/components/ui/dialog.tsx +138 -0
  145. package/src/components/ui/dropdown-menu.tsx +255 -0
  146. package/src/components/ui/input.tsx +21 -0
  147. package/src/components/ui/label.tsx +22 -0
  148. package/src/components/ui/popover.tsx +46 -0
  149. package/src/components/ui/separator.tsx +28 -0
  150. package/src/components/ui/sheet.tsx +137 -0
  151. package/src/components/ui/skeleton.tsx +13 -0
  152. package/src/components/ui/sonner.tsx +24 -0
  153. package/src/components/ui/switch.tsx +29 -0
  154. package/src/components/ui/table.tsx +114 -0
  155. package/src/components/ui/tabs.tsx +64 -0
  156. package/src/components/ui/toggle-group.tsx +72 -0
  157. package/src/components/ui/toggle.tsx +49 -0
  158. package/src/components/ui/tooltip.tsx +61 -0
  159. package/src/components/ui/tree-view.tsx +497 -0
  160. package/src/file-classes.ts +54 -0
  161. package/src/hooks/use-mounted.ts +9 -0
  162. package/src/hooks/use-preferred-reduced-motion.ts +27 -0
  163. package/src/hooks/use-streaming-status.ts +70 -0
  164. package/src/index.ts +44 -0
  165. package/src/lib/api.ts +100 -0
  166. package/src/lib/utils.ts +8 -0
  167. package/src/store/add-ons.ts +81 -0
  168. package/src/store/project.ts +345 -0
  169. package/src/types.d.ts +109 -0
  170. package/tests/store/add-ons.test.ts +222 -0
  171. package/tsconfig.json +25 -0
  172. package/vitest.config.ts +6 -0
@@ -0,0 +1,67 @@
1
+ import CodeMirror from '@uiw/react-codemirror'
2
+ import CodeMirrorMerge from 'react-codemirror-merge'
3
+
4
+ import { javascript } from '@codemirror/lang-javascript'
5
+ import { json } from '@codemirror/lang-json'
6
+ import { css } from '@codemirror/lang-css'
7
+ import { html } from '@codemirror/lang-html'
8
+
9
+ import { githubDarkInit } from '@uiw/codemirror-theme-github'
10
+
11
+ const theme = githubDarkInit({
12
+ settings: {
13
+ background: 'oklch(0.07 0.005 285.823)',
14
+ foreground: '#c9d1d9',
15
+ gutterBackground: 'oklch(0.22 0.005 285.823)',
16
+ },
17
+ })
18
+
19
+ export default function FileViewer({
20
+ originalFile,
21
+ modifiedFile,
22
+ filePath,
23
+ }: {
24
+ originalFile?: string
25
+ modifiedFile: string
26
+ filePath: string
27
+ }) {
28
+ function getLanguage(file: string) {
29
+ if (file.endsWith('.js') || file.endsWith('.jsx')) {
30
+ return javascript({ jsx: true })
31
+ }
32
+ if (file.endsWith('.ts') || file.endsWith('.tsx')) {
33
+ return javascript({ typescript: true, jsx: true })
34
+ }
35
+ if (file.endsWith('.json')) {
36
+ return json()
37
+ }
38
+ if (file.endsWith('.css')) {
39
+ return css()
40
+ }
41
+ if (file.endsWith('.html')) {
42
+ return html()
43
+ }
44
+ return javascript()
45
+ }
46
+ const language = getLanguage(filePath)
47
+
48
+ if (!originalFile || originalFile === modifiedFile) {
49
+ return (
50
+ <CodeMirror
51
+ value={modifiedFile}
52
+ theme={theme}
53
+ height="100vh"
54
+ width="100%"
55
+ readOnly
56
+ extensions={[language]}
57
+ className="text-lg"
58
+ />
59
+ )
60
+ }
61
+ return (
62
+ <CodeMirrorMerge orientation="a-b" theme={theme} className="text-lg">
63
+ <CodeMirrorMerge.Original value={originalFile} extensions={[language]} />
64
+ <CodeMirrorMerge.Modified value={modifiedFile} extensions={[language]} />
65
+ </CodeMirrorMerge>
66
+ )
67
+ }
@@ -0,0 +1,29 @@
1
+ import Logo from './icons/tanstack'
2
+
3
+ export function AppHeader() {
4
+ return (
5
+ <div className="bg-white dark:bg-black/50 rounded-lg p-2 sm:p-4 flex items-center gap-2 text-lg sm:text-xl shadow-xl">
6
+ <div className="flex items-center gap-1.5">
7
+ <Logo />
8
+ <div className="font-black text-xl uppercase">TanStack</div>
9
+ </div>
10
+ <svg
11
+ stroke="currentColor"
12
+ fill="currentColor"
13
+ stroke-width="0"
14
+ viewBox="0 0 256 512"
15
+ height="1em"
16
+ width="1em"
17
+ xmlns="http://www.w3.org/2000/svg"
18
+ >
19
+ <path d="M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"></path>
20
+ </svg>
21
+ <div className="hover:text-blue-500 flex items-center gap-2">
22
+ Create TanStack App{' '}
23
+ <span className="bg-gradient-to-r from-blue-500 to-cyan-500 text-white text-xs font-bold px-2 py-0.5 rounded">
24
+ ALPHA
25
+ </span>
26
+ </div>
27
+ </div>
28
+ )
29
+ }
@@ -0,0 +1,26 @@
1
+ import { cn } from '../../lib/utils'
2
+
3
+ export default function Tailwind({ className }: { className?: string }) {
4
+ return (
5
+ <svg
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ fill="none"
8
+ viewBox="0 0 54 33"
9
+ className={cn('w-10 h-10', className)}
10
+ >
11
+ <g clip-path="url(#a)">
12
+ <path
13
+ fill="#38bdf8"
14
+ fill-rule="evenodd"
15
+ d="M27 0c-7.2 0-11.7 3.6-13.5 10.8 2.7-3.6 5.85-4.95 9.45-4.05 2.054.513 3.522 2.004 5.147 3.653C30.744 13.09 33.808 16.2 40.5 16.2c7.2 0 11.7-3.6 13.5-10.8-2.7 3.6-5.85 4.95-9.45 4.05-2.054-.513-3.522-2.004-5.147-3.653C36.756 3.11 33.692 0 27 0zM13.5 16.2C6.3 16.2 1.8 19.8 0 27c2.7-3.6 5.85-4.95 9.45-4.05 2.054.514 3.522 2.004 5.147 3.653C17.244 29.29 20.308 32.4 27 32.4c7.2 0 11.7-3.6 13.5-10.8-2.7 3.6-5.85 4.95-9.45 4.05-2.054-.513-3.522-2.004-5.147-3.653C23.256 19.31 20.192 16.2 13.5 16.2z"
16
+ clip-rule="evenodd"
17
+ />
18
+ </g>
19
+ <defs>
20
+ <clipPath id="a">
21
+ <path fill="#fff" d="M0 0h54v32.4H0z" />
22
+ </clipPath>
23
+ </defs>
24
+ </svg>
25
+ )
26
+ }
@@ -0,0 +1,338 @@
1
+ import { cn } from '../../lib/utils'
2
+
3
+ export default function Logo({ className }: { className?: string }) {
4
+ return (
5
+ <svg
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ xmlnsXlink="http://www.w3.org/1999/xlink"
8
+ viewBox="0 0 633 633"
9
+ className={cn('w-10 h-10', className)}
10
+ >
11
+ <defs>
12
+ <linearGradient id="b" x1="50%" x2="50%" y1="0%" y2="71.65%">
13
+ <stop offset="0%" stopColor="#6BDAFF" />
14
+ <stop offset="31.922%" stopColor="#F9FFB5" />
15
+ <stop offset="70.627%" stopColor="#FFA770" />
16
+ <stop offset="100%" stopColor="#FF7373" />
17
+ </linearGradient>
18
+ <linearGradient
19
+ id="d"
20
+ x1="43.996%"
21
+ x2="53.441%"
22
+ y1="8.54%"
23
+ y2="93.872%"
24
+ >
25
+ <stop offset="0%" stopColor="#673800" />
26
+ <stop offset="100%" stopColor="#B65E00" />
27
+ </linearGradient>
28
+ <linearGradient id="e" x1="50%" x2="50%" y1="0%" y2="100%">
29
+ <stop offset="0%" stopColor="#2F8A00" />
30
+ <stop offset="100%" stopColor="#90FF57" />
31
+ </linearGradient>
32
+ <linearGradient id="f" x1="50%" x2="50%" y1="0%" y2="100%">
33
+ <stop offset="0%" stopColor="#2F8A00" />
34
+ <stop offset="100%" stopColor="#90FF57" />
35
+ </linearGradient>
36
+ <linearGradient id="g" x1="50%" x2="50%" y1="0%" y2="100%">
37
+ <stop offset="0%" stopColor="#2F8A00" />
38
+ <stop offset="100%" stopColor="#90FF57" />
39
+ </linearGradient>
40
+ <linearGradient id="h" x1="50%" x2="50%" y1="0%" y2="100%">
41
+ <stop offset="0%" stopColor="#2F8A00" />
42
+ <stop offset="100%" stopColor="#90FF57" />
43
+ </linearGradient>
44
+ <linearGradient id="i" x1="50%" x2="50%" y1="0%" y2="100%">
45
+ <stop offset="0%" stopColor="#2F8A00" />
46
+ <stop offset="100%" stopColor="#90FF57" />
47
+ </linearGradient>
48
+ <linearGradient id="j" x1="50%" x2="50%" y1="0%" y2="100%">
49
+ <stop offset="0%" stopColor="#2F8A00" />
50
+ <stop offset="100%" stopColor="#90FF57" />
51
+ </linearGradient>
52
+ <linearGradient id="k" x1="92.9%" x2="8.641%" y1="45.768%" y2="54.892%">
53
+ <stop offset="0%" stopColor="#EE2700" />
54
+ <stop offset="100%" stopColor="#FF008E" />
55
+ </linearGradient>
56
+ <linearGradient
57
+ id="l"
58
+ x1="61.109%"
59
+ x2="43.717%"
60
+ y1="3.633%"
61
+ y2="43.072%"
62
+ >
63
+ <stop offset="0%" stopColor="#FFF400" />
64
+ <stop offset="100%" stopColor="#3C8700" />
65
+ </linearGradient>
66
+ <linearGradient id="m" x1="50%" x2="50%" y1="0%" y2="100%">
67
+ <stop offset="0%" stopColor="#FFDF00" />
68
+ <stop offset="100%" stopColor="#FF9D00" />
69
+ </linearGradient>
70
+ <linearGradient id="n" x1="127.279%" x2="0%" y1="49.778%" y2="50.222%">
71
+ <stop offset="0%" stopColor="#FFA400" />
72
+ <stop offset="100%" stopColor="#FF5E00" />
73
+ </linearGradient>
74
+ <linearGradient id="o" x1="127.279%" x2="0%" y1="47.531%" y2="52.469%">
75
+ <stop offset="0%" stopColor="#FFA400" />
76
+ <stop offset="100%" stopColor="#FF5E00" />
77
+ </linearGradient>
78
+ <linearGradient id="p" x1="127.279%" x2="0%" y1="46.195%" y2="53.805%">
79
+ <stop offset="0%" stopColor="#FFA400" />
80
+ <stop offset="100%" stopColor="#FF5E00" />
81
+ </linearGradient>
82
+ <linearGradient id="q" x1="127.279%" x2="0%" y1="35.33%" y2="64.67%">
83
+ <stop offset="0%" stopColor="#FFA400" />
84
+ <stop offset="100%" stopColor="#FF5E00" />
85
+ </linearGradient>
86
+ <linearGradient id="r" x1="127.279%" x2="0%" y1="4.875%" y2="95.125%">
87
+ <stop offset="0%" stopColor="#FFA400" />
88
+ <stop offset="100%" stopColor="#FF5E00" />
89
+ </linearGradient>
90
+ <linearGradient id="s" x1="78.334%" x2="31.668%" y1="0%" y2="100%">
91
+ <stop offset="0%" stopColor="#FFA400" />
92
+ <stop offset="100%" stopColor="#FF5E00" />
93
+ </linearGradient>
94
+ <linearGradient id="t" x1="57.913%" x2="44.88%" y1="0%" y2="100%">
95
+ <stop offset="0%" stopColor="#FFA400" />
96
+ <stop offset="100%" stopColor="#FF5E00" />
97
+ </linearGradient>
98
+ <linearGradient id="u" x1="50.495%" x2="49.68%" y1="0%" y2="100%">
99
+ <stop offset="0%" stopColor="#FFA400" />
100
+ <stop offset="100%" stopColor="#FF5E00" />
101
+ </linearGradient>
102
+ <circle id="a" cx="308.5" cy="308.5" r="308.5" />
103
+ <circle id="v" cx="307.5" cy="308.5" r="316.5" />
104
+ </defs>
105
+ <g fill="none" fillRule="evenodd" transform="translate(9 8)">
106
+ <mask id="c" fill="#fff">
107
+ <use xlinkHref="#a" />
108
+ </mask>
109
+ <use xlinkHref="#a" fill="url(#b)" />
110
+ <ellipse
111
+ cx="81.5"
112
+ cy="602.5"
113
+ fill="#015064"
114
+ stroke="#00CFE2"
115
+ strokeWidth="25"
116
+ mask="url(#c)"
117
+ rx="214.5"
118
+ ry="185.968"
119
+ />
120
+ <ellipse
121
+ cx="535.5"
122
+ cy="602.5"
123
+ fill="#015064"
124
+ stroke="#00CFE2"
125
+ strokeWidth="25"
126
+ mask="url(#c)"
127
+ rx="214.5"
128
+ ry="185.968"
129
+ />
130
+ <ellipse
131
+ cx="81.5"
132
+ cy="640.5"
133
+ fill="#015064"
134
+ stroke="#00A8B8"
135
+ strokeWidth="25"
136
+ mask="url(#c)"
137
+ rx="214.5"
138
+ ry="185.968"
139
+ />
140
+ <ellipse
141
+ cx="535.5"
142
+ cy="640.5"
143
+ fill="#015064"
144
+ stroke="#00A8B8"
145
+ strokeWidth="25"
146
+ mask="url(#c)"
147
+ rx="214.5"
148
+ ry="185.968"
149
+ />
150
+ <ellipse
151
+ cx="81.5"
152
+ cy="676.5"
153
+ fill="#015064"
154
+ stroke="#007782"
155
+ strokeWidth="25"
156
+ mask="url(#c)"
157
+ rx="214.5"
158
+ ry="185.968"
159
+ />
160
+ <ellipse
161
+ cx="535.5"
162
+ cy="676.5"
163
+ fill="#015064"
164
+ stroke="#007782"
165
+ strokeWidth="25"
166
+ mask="url(#c)"
167
+ rx="214.5"
168
+ ry="185.968"
169
+ />
170
+ <g mask="url(#c)">
171
+ <path
172
+ fill="url(#d)"
173
+ stroke="#6E3A00"
174
+ strokeWidth="6.088"
175
+ d="M98.318 88.007c7.691 37.104 16.643 72.442 26.856 106.013 10.212 33.571 25.57 68.934 46.07 106.088l-51.903 11.67c-10.057-60.01-17.232-99.172-21.525-117.487-4.293-18.315-10.989-51.434-20.089-99.357l20.591-6.927"
176
+ transform="scale(-1 1) rotate(25 -300.37 -553.013)"
177
+ />
178
+ <g stroke="#2F8A00">
179
+ <path
180
+ fill="url(#e)"
181
+ strokeWidth="9.343"
182
+ d="M108.544 66.538s-13.54-21.305-37.417-27.785c-15.917-4.321-33.933.31-54.048 13.892C33.464 65.975 47.24 73.52 58.405 75.28c16.749 2.64 50.14-8.74 50.14-8.74Z"
183
+ transform="rotate(1 -6061.691 5926.397)"
184
+ />
185
+ <path
186
+ fill="url(#f)"
187
+ strokeWidth="9.343"
188
+ d="M108.544 67.138s-47.187-5.997-81.077 19.936C4.873 104.362-3.782 137.794 1.502 187.369c28.42-29.22 48.758-50.836 61.016-64.846 18.387-21.016 46.026-55.385 46.026-55.385Z"
189
+ transform="rotate(1 -6061.691 5926.397)"
190
+ />
191
+ <path
192
+ fill="url(#g)"
193
+ strokeWidth="9.343"
194
+ d="M108.544 66.538c-1.96-21.705 3.98-38.018 17.82-48.94C140.203 6.674 154.85.808 170.303 0c-4.865 21.527-12.373 36.314-22.524 44.361-10.151 8.048-23.23 15.44-39.236 22.177Z"
195
+ transform="rotate(1 -6061.691 5926.397)"
196
+ />
197
+ <path
198
+ fill="url(#h)"
199
+ strokeWidth="9.343"
200
+ d="M108.544 67.138c29.838-31.486 61.061-42.776 93.669-33.869C234.82 42.176 253.749 60.785 259 89.096c-34.898-3.657-59.974-6.343-75.228-8.058-15.254-1.716-40.33-6.349-75.228-13.9Z"
201
+ transform="rotate(1 -6061.691 5926.397)"
202
+ />
203
+ <path
204
+ fill="url(#i)"
205
+ strokeWidth="9.343"
206
+ d="M108.544 67.138c34.868-9.381 64.503-3.658 88.905 17.17 24.402 20.829 39.656 46.686 45.762 77.571-39.626-7.574-68.4-20.115-86.322-37.624a395.051 395.051 0 0 1-48.345-57.117Z"
207
+ transform="rotate(1 -6061.691 5926.397)"
208
+ />
209
+ <path
210
+ fill="url(#j)"
211
+ strokeWidth="9.343"
212
+ d="M108.544 67.138C76.206 82.6 57.608 105.366 52.75 135.436c-4.858 30.07-.292 62.89 13.698 98.462 24.873-41.418 38.905-71.368 42.096-89.849 3.191-18.48 3.191-44.118 0-76.91Z"
213
+ transform="rotate(1 -6061.691 5926.397)"
214
+ />
215
+ <path
216
+ strokeLinecap="round"
217
+ strokeWidth="5.91"
218
+ d="M211.284 173.477c-13.851 21.992-23.291 42.022-28.32 60.093-5.03 18.071-8.175 33.143-9.436 45.216"
219
+ />
220
+ <path
221
+ strokeLinecap="round"
222
+ strokeWidth="5.91"
223
+ d="M209.814 176.884c-23.982 2.565-42.792 10.469-56.428 23.714-13.639 13.245-23.483 26.136-29.536 38.674M219.045 167.299c29.028-7.723 50.972-10.173 65.831-7.352 14.859 2.822 26.807 7.659 35.842 14.51M211.31 172.618c20.29 9.106 38.353 19.052 54.186 29.837 15.833 10.786 27.714 20.99 35.643 30.617"
224
+ />
225
+ </g>
226
+ <path
227
+ stroke="#830305"
228
+ strokeLinecap="round"
229
+ strokeLinejoin="bevel"
230
+ strokeWidth="6.937"
231
+ d="m409.379 398.157-23.176 18.556M328.04 375.516l-22.313 28.398M312.904 353.698l53.18 59.816"
232
+ />
233
+ <path
234
+ fill="url(#k)"
235
+ d="M67.585 27.463H5.68C1.893 28.148 0 30.38 0 34.16c0 3.78 1.893 6.211 5.68 7.293h67.17l41.751-30.356c2.488-2.646 2.794-5.315.92-8.006s-4.6-3.626-8.177-2.803l-39.76 27.174Z"
236
+ transform="scale(-1 1) rotate(-9 2092.128 2856.854)"
237
+ />
238
+ <path
239
+ fill="#D8D8D8"
240
+ stroke="#FFF"
241
+ strokeLinecap="round"
242
+ strokeLinejoin="bevel"
243
+ strokeWidth="4.414"
244
+ d="m402.861 391.51.471-4.088M382.21 388.752l.472-4.087M361.546 385.404l.485-3.845M337.59 371.883l2.56-2.498M324.276 359.567l2.56-2.497"
245
+ />
246
+ </g>
247
+ <ellipse
248
+ cx="308.5"
249
+ cy="720.5"
250
+ fill="url(#l)"
251
+ mask="url(#c)"
252
+ rx="266"
253
+ ry="316.5"
254
+ />
255
+ <ellipse
256
+ cx="308.5"
257
+ cy="720.5"
258
+ stroke="#6DA300"
259
+ strokeOpacity=".502"
260
+ strokeWidth="26"
261
+ mask="url(#c)"
262
+ rx="253"
263
+ ry="303.5"
264
+ />
265
+ <g mask="url(#c)">
266
+ <g transform="translate(389 -32)">
267
+ <circle cx="168.5" cy="113.5" r="113.5" fill="url(#m)" />
268
+ <circle
269
+ cx="168.5"
270
+ cy="113.5"
271
+ r="106"
272
+ stroke="#FFC900"
273
+ strokeOpacity=".529"
274
+ strokeWidth="15"
275
+ />
276
+ <path
277
+ stroke="url(#n)"
278
+ strokeLinecap="round"
279
+ strokeLinejoin="bevel"
280
+ strokeWidth="12"
281
+ d="M30 113H0"
282
+ />
283
+ <path
284
+ stroke="url(#o)"
285
+ strokeLinecap="round"
286
+ strokeLinejoin="bevel"
287
+ strokeWidth="12"
288
+ d="M33.5 79.5 7 74"
289
+ />
290
+ <path
291
+ stroke="url(#p)"
292
+ strokeLinecap="round"
293
+ strokeLinejoin="bevel"
294
+ strokeWidth="12"
295
+ d="m34 146-29 8"
296
+ />
297
+ <path
298
+ stroke="url(#q)"
299
+ strokeLinecap="round"
300
+ strokeLinejoin="bevel"
301
+ strokeWidth="12"
302
+ d="m45 177-24 13"
303
+ />
304
+ <path
305
+ stroke="url(#r)"
306
+ strokeLinecap="round"
307
+ strokeLinejoin="bevel"
308
+ strokeWidth="12"
309
+ d="m67 204-20 19"
310
+ />
311
+ <path
312
+ stroke="url(#s)"
313
+ strokeLinecap="round"
314
+ strokeLinejoin="bevel"
315
+ strokeWidth="12"
316
+ d="m94.373 227-13.834 22.847"
317
+ />
318
+ <path
319
+ stroke="url(#t)"
320
+ strokeLinecap="round"
321
+ strokeLinejoin="bevel"
322
+ strokeWidth="12"
323
+ d="M127.5 243.5 120 268"
324
+ />
325
+ <path
326
+ stroke="url(#u)"
327
+ strokeLinecap="round"
328
+ strokeLinejoin="bevel"
329
+ strokeWidth="12"
330
+ d="m167.5 252.5.5 24.5"
331
+ />
332
+ </g>
333
+ </g>
334
+ <circle cx="307.5" cy="308.5" r="304" stroke="#000" strokeWidth="25" />
335
+ </g>
336
+ </svg>
337
+ )
338
+ }
@@ -0,0 +1,23 @@
1
+ import { cn } from '../../lib/utils'
2
+
3
+ export default function Typescript({ className }: { className?: string }) {
4
+ return (
5
+ <svg
6
+ viewBox="0 0 256 256"
7
+ width="256"
8
+ height="256"
9
+ xmlns="http://www.w3.org/2000/svg"
10
+ preserveAspectRatio="xMidYMid"
11
+ className={cn('w-10 h-10', className)}
12
+ >
13
+ <path
14
+ d="M20 0h216c11.046 0 20 8.954 20 20v216c0 11.046-8.954 20-20 20H20c-11.046 0-20-8.954-20-20V20C0 8.954 8.954 0 20 0Z"
15
+ fill="#3178C6"
16
+ />
17
+ <path
18
+ d="M150.518 200.475v27.62c4.492 2.302 9.805 4.028 15.938 5.179 6.133 1.151 12.597 1.726 19.393 1.726 6.622 0 12.914-.633 18.874-1.899 5.96-1.266 11.187-3.352 15.678-6.257 4.492-2.906 8.048-6.704 10.669-11.394 2.62-4.689 3.93-10.486 3.93-17.391 0-5.006-.749-9.394-2.246-13.163a30.748 30.748 0 0 0-6.479-10.055c-2.821-2.935-6.205-5.567-10.149-7.898-3.945-2.33-8.394-4.531-13.347-6.602-3.628-1.497-6.881-2.949-9.761-4.359-2.879-1.41-5.327-2.848-7.342-4.316-2.016-1.467-3.571-3.021-4.665-4.661-1.094-1.64-1.641-3.495-1.641-5.567 0-1.899.489-3.61 1.468-5.135s2.362-2.834 4.147-3.927c1.785-1.094 3.973-1.942 6.565-2.547 2.591-.604 5.471-.906 8.638-.906 2.304 0 4.737.173 7.299.518 2.563.345 5.14.877 7.732 1.597a53.669 53.669 0 0 1 7.558 2.719 41.7 41.7 0 0 1 6.781 3.797v-25.807c-4.204-1.611-8.797-2.805-13.778-3.582-4.981-.777-10.697-1.165-17.147-1.165-6.565 0-12.784.705-18.658 2.115-5.874 1.409-11.043 3.61-15.506 6.602-4.463 2.993-7.99 6.805-10.582 11.437-2.591 4.632-3.887 10.17-3.887 16.615 0 8.228 2.375 15.248 7.127 21.06 4.751 5.811 11.963 10.731 21.638 14.759a291.458 291.458 0 0 1 10.625 4.575c3.283 1.496 6.119 3.049 8.509 4.66 2.39 1.611 4.276 3.366 5.658 5.265 1.382 1.899 2.073 4.057 2.073 6.474a9.901 9.901 0 0 1-1.296 4.963c-.863 1.524-2.174 2.848-3.93 3.97-1.756 1.122-3.945 1.999-6.565 2.632-2.62.633-5.687.95-9.2.95-5.989 0-11.92-1.05-17.794-3.151-5.875-2.1-11.317-5.25-16.327-9.451Zm-46.036-68.733H140V109H41v22.742h35.345V233h28.137V131.742Z"
19
+ fill="#FFF"
20
+ />
21
+ </svg>
22
+ )
23
+ }
@@ -0,0 +1,10 @@
1
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
2
+ import { useState } from 'react'
3
+
4
+ export function QueryProvider({ children }: { children: React.ReactNode }) {
5
+ const [queryClient] = useState(() => new QueryClient())
6
+
7
+ return (
8
+ <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
9
+ )
10
+ }
@@ -0,0 +1,94 @@
1
+ import { Fragment, useMemo, useState } from 'react'
2
+ import { InfoIcon } from 'lucide-react'
3
+
4
+ import { Switch } from '../ui/switch'
5
+ import { Label } from '../ui/label'
6
+
7
+ import { useAddOns } from '../../store/project'
8
+
9
+ import ImportCustomAddOn from '../custom-add-on-dialog'
10
+ import AddOnInfoDialog from '../add-on-info-dialog'
11
+
12
+ import type { AddOnInfo } from '../../types'
13
+
14
+ const addOnTypeLabels: Record<string, string> = {
15
+ toolchain: 'Toolchain',
16
+ 'add-on': 'Add-on',
17
+ example: 'Example',
18
+ }
19
+
20
+ export default function SelectedAddOns() {
21
+ const { availableAddOns, addOnState, toggleAddOn } = useAddOns()
22
+
23
+ const sortedAddOns = useMemo(() => {
24
+ return availableAddOns.sort((a, b) => {
25
+ return a.name.localeCompare(b.name)
26
+ })
27
+ }, [availableAddOns])
28
+
29
+ const [infoAddOn, setInfoAddOn] = useState<AddOnInfo>()
30
+
31
+ return (
32
+ <>
33
+ <AddOnInfoDialog
34
+ addOn={infoAddOn}
35
+ onClose={() => setInfoAddOn(undefined)}
36
+ />
37
+ {Object.keys(addOnTypeLabels).map((type) => (
38
+ <Fragment key={type}>
39
+ {sortedAddOns.filter((addOn) => addOn.type === type).length > 0 && (
40
+ <div
41
+ key={`${type}-add-ons`}
42
+ className="block p-4 bg-gray-500/10 hover:bg-gray-500/20 rounded-lg transition-colors space-y-4 active"
43
+ >
44
+ <h3 className="font-medium">{addOnTypeLabels[type]}</h3>
45
+ <div className="flex flex-row flex-wrap">
46
+ {sortedAddOns
47
+ .filter((addOn) => addOn.type === type)
48
+ .map((addOn) => (
49
+ <div
50
+ key={addOn.id}
51
+ className="w-1/2 flex flex-row justify-between pr-4"
52
+ >
53
+ <div className="p-1 flex flex-row items-center">
54
+ <Switch
55
+ id={addOn.id}
56
+ checked={addOnState[addOn.id].selected}
57
+ disabled={!addOnState[addOn.id].enabled}
58
+ onCheckedChange={() => {
59
+ toggleAddOn(addOn.id)
60
+ }}
61
+ />
62
+ <Label
63
+ htmlFor={addOn.id}
64
+ className="pl-2 font-semibold text-gray-300"
65
+ >
66
+ {addOn.smallLogo && (
67
+ <img
68
+ src={`data:image/svg+xml,${encodeURIComponent(
69
+ addOn.smallLogo,
70
+ )}`}
71
+ alt={addOn.name}
72
+ className="w-5"
73
+ />
74
+ )}
75
+ {addOn.name}
76
+ </Label>
77
+ <InfoIcon
78
+ className="ml-2 w-4 text-gray-600"
79
+ onClick={() => setInfoAddOn(addOn)}
80
+ />
81
+ </div>
82
+ </div>
83
+ ))}
84
+ </div>
85
+ </div>
86
+ )}
87
+ </Fragment>
88
+ ))}
89
+ <div className="mt-4">
90
+ <ImportCustomAddOn />
91
+ </div>
92
+ </>
93
+ )
94
+ }
@@ -0,0 +1,56 @@
1
+ import { CodeIcon } from 'lucide-react'
2
+
3
+ import { ToggleGroup, ToggleGroupItem } from '../ui/toggle-group'
4
+
5
+ import {
6
+ setRouterMode,
7
+ useApplicationMode,
8
+ useModeEditable,
9
+ useRouterMode,
10
+ useSupportedModes,
11
+ } from '../../store/project'
12
+
13
+ import SidebarContainer from './sidebar-container'
14
+
15
+ export default function ModeSelector() {
16
+ const mode = useApplicationMode()
17
+ const enableMode = useModeEditable()
18
+ const routerMode = useRouterMode()
19
+ const supportedModes = useSupportedModes()
20
+
21
+ if (mode !== 'setup' || Object.keys(supportedModes ?? {}).length < 2) {
22
+ return null
23
+ }
24
+
25
+ return (
26
+ <SidebarContainer>
27
+ <div className="flex flex-col @md:flex-row @md:items-center gap-2 items-start">
28
+ <h3 className="font-medium whitespace-nowrap">Router Mode</h3>
29
+ <div className="flex flex-row justify-center items-center">
30
+ <ToggleGroup
31
+ type="single"
32
+ value={routerMode}
33
+ onValueChange={(v: string) => {
34
+ if (v) {
35
+ setRouterMode(v)
36
+ }
37
+ }}
38
+ className="rounded-md border-2 border-gray-500/10"
39
+ >
40
+ {Object.keys(supportedModes ?? {}).map((mode) => (
41
+ <ToggleGroupItem
42
+ key={mode}
43
+ value={mode}
44
+ className="px-4"
45
+ disabled={!enableMode}
46
+ >
47
+ <CodeIcon className="w-4 h-4" />
48
+ {supportedModes?.[mode].displayName}
49
+ </ToggleGroupItem>
50
+ ))}
51
+ </ToggleGroup>
52
+ </div>
53
+ </div>
54
+ </SidebarContainer>
55
+ )
56
+ }