@lark-apaas/coding-templates 0.1.3 → 0.1.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 (261) hide show
  1. package/package.json +2 -3
  2. package/template-vite-react/_gitignore +24 -0
  3. package/template-vite-react/client/index.html +13 -0
  4. package/template-vite-react/client/public/favicon.svg +1 -0
  5. package/template-vite-react/client/public/icons.svg +24 -0
  6. package/template-vite-react/client/src/api/index.ts +7 -0
  7. package/template-vite-react/client/src/app.tsx +17 -0
  8. package/{template-nextjs-static → template-vite-react/client}/src/components/header.tsx +5 -13
  9. package/template-vite-react/client/src/components/layout.tsx +13 -0
  10. package/template-vite-react/client/src/components/theme-provider.tsx +45 -0
  11. package/template-vite-react/client/src/components/ui/accordion.tsx +72 -0
  12. package/template-vite-react/client/src/components/ui/alert-dialog.tsx +187 -0
  13. package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/alert.tsx +15 -10
  14. package/template-vite-react/client/src/components/ui/aspect-ratio.tsx +22 -0
  15. package/template-vite-react/client/src/components/ui/avatar.tsx +109 -0
  16. package/template-vite-react/client/src/components/ui/badge.tsx +52 -0
  17. package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/breadcrumb.tsx +39 -23
  18. package/template-vite-react/client/src/components/ui/button.tsx +58 -0
  19. package/{template-nextjs-static → template-vite-react/client}/src/components/ui/calendar.tsx +43 -37
  20. package/template-vite-react/client/src/components/ui/card.tsx +103 -0
  21. package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/carousel.tsx +8 -7
  22. package/{template-nextjs-static → template-vite-react/client}/src/components/ui/chart.tsx +49 -35
  23. package/template-vite-react/client/src/components/ui/checkbox.tsx +29 -0
  24. package/template-vite-react/client/src/components/ui/collapsible.tsx +19 -0
  25. package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/command.tsx +40 -52
  26. package/template-vite-react/client/src/components/ui/context-menu.tsx +271 -0
  27. package/template-vite-react/client/src/components/ui/dialog.tsx +158 -0
  28. package/{template-nextjs-static → template-vite-react/client}/src/components/ui/drawer.tsx +9 -12
  29. package/template-vite-react/client/src/components/ui/dropdown-menu.tsx +268 -0
  30. package/template-vite-react/client/src/components/ui/hover-card.tsx +49 -0
  31. package/template-vite-react/client/src/components/ui/input-group.tsx +156 -0
  32. package/{template-nextjs-static → template-vite-react/client}/src/components/ui/input-otp.tsx +17 -7
  33. package/template-vite-react/client/src/components/ui/input.tsx +20 -0
  34. package/template-vite-react/client/src/components/ui/label.tsx +18 -0
  35. package/template-vite-react/client/src/components/ui/menubar.tsx +280 -0
  36. package/template-vite-react/client/src/components/ui/navigation-menu.tsx +168 -0
  37. package/{template-nextjs-static → template-vite-react/client}/src/components/ui/pagination.tsx +35 -32
  38. package/template-vite-react/client/src/components/ui/popover.tsx +90 -0
  39. package/template-vite-react/client/src/components/ui/progress.tsx +81 -0
  40. package/template-vite-react/client/src/components/ui/radio-group.tsx +38 -0
  41. package/template-vite-react/client/src/components/ui/resizable.tsx +48 -0
  42. package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/scroll-area.tsx +10 -13
  43. package/template-vite-react/client/src/components/ui/select.tsx +199 -0
  44. package/template-vite-react/client/src/components/ui/separator.tsx +25 -0
  45. package/template-vite-react/client/src/components/ui/sheet.tsx +138 -0
  46. package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/sidebar.tsx +156 -162
  47. package/{template-nextjs-static → template-vite-react/client}/src/components/ui/skeleton.tsx +1 -1
  48. package/template-vite-react/client/src/components/ui/slider.tsx +57 -0
  49. package/template-vite-react/client/src/components/ui/sonner.tsx +49 -0
  50. package/template-vite-react/client/src/components/ui/switch.tsx +30 -0
  51. package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/table.tsx +5 -5
  52. package/template-vite-react/client/src/components/ui/tabs.tsx +80 -0
  53. package/template-vite-react/client/src/components/ui/textarea.tsx +18 -0
  54. package/template-vite-react/client/src/components/ui/toggle-group.tsx +89 -0
  55. package/template-vite-react/client/src/components/ui/toggle.tsx +44 -0
  56. package/template-vite-react/client/src/components/ui/tooltip.tsx +64 -0
  57. package/template-vite-react/client/src/index.css +1 -0
  58. package/template-vite-react/client/src/main.tsx +13 -0
  59. package/template-vite-react/client/src/pages/home/index.tsx +12 -0
  60. package/template-vite-react/client/src/pages/not-found/index.tsx +11 -0
  61. package/template-vite-react/client/src/types/index.ts +1 -0
  62. package/{template-nextjs-static → template-vite-react}/components.json +2 -2
  63. package/template-vite-react/eslint.config.js +23 -0
  64. package/template-vite-react/package.json +58 -0
  65. package/template-vite-react/scripts/build.sh +40 -0
  66. package/template-vite-react/shared/types.ts +1 -0
  67. package/template-vite-react/tsconfig.app.json +33 -0
  68. package/template-vite-react/tsconfig.json +14 -0
  69. package/template-vite-react/tsconfig.node.json +26 -0
  70. package/template-vite-react/vite.config.ts +17 -0
  71. package/template-nextjs-fullstack/README.md +0 -169
  72. package/template-nextjs-fullstack/_env.local.example +0 -1
  73. package/template-nextjs-fullstack/_gitignore +0 -41
  74. package/template-nextjs-fullstack/components.json +0 -25
  75. package/template-nextjs-fullstack/drizzle.config.ts +0 -10
  76. package/template-nextjs-fullstack/eslint.config.js +0 -15
  77. package/template-nextjs-fullstack/next.config.ts +0 -5
  78. package/template-nextjs-fullstack/package.json +0 -85
  79. package/template-nextjs-fullstack/postcss.config.js +0 -8
  80. package/template-nextjs-fullstack/scripts/build.sh +0 -37
  81. package/template-nextjs-fullstack/src/app/favicon.ico +0 -0
  82. package/template-nextjs-fullstack/src/app/globals.css +0 -130
  83. package/template-nextjs-fullstack/src/app/layout.tsx +0 -24
  84. package/template-nextjs-fullstack/src/app/page.tsx +0 -69
  85. package/template-nextjs-fullstack/src/app/todos/actions.ts +0 -37
  86. package/template-nextjs-fullstack/src/app/todos/page.tsx +0 -26
  87. package/template-nextjs-fullstack/src/app/todos/todo-form.tsx +0 -27
  88. package/template-nextjs-fullstack/src/app/todos/todo-list.tsx +0 -44
  89. package/template-nextjs-fullstack/src/components/header.tsx +0 -32
  90. package/template-nextjs-fullstack/src/components/theme-provider.tsx +0 -8
  91. package/template-nextjs-fullstack/src/components/ui/README.md +0 -134
  92. package/template-nextjs-fullstack/src/components/ui/accordion.tsx +0 -66
  93. package/template-nextjs-fullstack/src/components/ui/alert-dialog.tsx +0 -157
  94. package/template-nextjs-fullstack/src/components/ui/aspect-ratio.tsx +0 -11
  95. package/template-nextjs-fullstack/src/components/ui/avatar.tsx +0 -53
  96. package/template-nextjs-fullstack/src/components/ui/badge.tsx +0 -42
  97. package/template-nextjs-fullstack/src/components/ui/button.tsx +0 -69
  98. package/template-nextjs-fullstack/src/components/ui/calendar.tsx +0 -213
  99. package/template-nextjs-fullstack/src/components/ui/card.tsx +0 -82
  100. package/template-nextjs-fullstack/src/components/ui/chart.tsx +0 -357
  101. package/template-nextjs-fullstack/src/components/ui/checkbox.tsx +0 -32
  102. package/template-nextjs-fullstack/src/components/ui/collapsible.tsx +0 -33
  103. package/template-nextjs-fullstack/src/components/ui/context-menu.tsx +0 -324
  104. package/template-nextjs-fullstack/src/components/ui/dialog.tsx +0 -143
  105. package/template-nextjs-fullstack/src/components/ui/drawer.tsx +0 -135
  106. package/template-nextjs-fullstack/src/components/ui/dropdown-menu.tsx +0 -329
  107. package/template-nextjs-fullstack/src/components/ui/hover-card.tsx +0 -44
  108. package/template-nextjs-fullstack/src/components/ui/input-group.tsx +0 -166
  109. package/template-nextjs-fullstack/src/components/ui/input-otp.tsx +0 -77
  110. package/template-nextjs-fullstack/src/components/ui/input.tsx +0 -21
  111. package/template-nextjs-fullstack/src/components/ui/label.tsx +0 -24
  112. package/template-nextjs-fullstack/src/components/ui/menubar.tsx +0 -348
  113. package/template-nextjs-fullstack/src/components/ui/navigation-menu.tsx +0 -168
  114. package/template-nextjs-fullstack/src/components/ui/pagination.tsx +0 -127
  115. package/template-nextjs-fullstack/src/components/ui/popover.tsx +0 -48
  116. package/template-nextjs-fullstack/src/components/ui/progress.tsx +0 -31
  117. package/template-nextjs-fullstack/src/components/ui/radio-group.tsx +0 -45
  118. package/template-nextjs-fullstack/src/components/ui/resizable.tsx +0 -56
  119. package/template-nextjs-fullstack/src/components/ui/select.tsx +0 -243
  120. package/template-nextjs-fullstack/src/components/ui/separator.tsx +0 -28
  121. package/template-nextjs-fullstack/src/components/ui/sheet.tsx +0 -139
  122. package/template-nextjs-fullstack/src/components/ui/skeleton.tsx +0 -13
  123. package/template-nextjs-fullstack/src/components/ui/slider.tsx +0 -87
  124. package/template-nextjs-fullstack/src/components/ui/sonner.tsx +0 -67
  125. package/template-nextjs-fullstack/src/components/ui/switch.tsx +0 -31
  126. package/template-nextjs-fullstack/src/components/ui/tabs.tsx +0 -66
  127. package/template-nextjs-fullstack/src/components/ui/textarea.tsx +0 -18
  128. package/template-nextjs-fullstack/src/components/ui/toggle-group.tsx +0 -83
  129. package/template-nextjs-fullstack/src/components/ui/toggle.tsx +0 -47
  130. package/template-nextjs-fullstack/src/components/ui/tooltip.tsx +0 -61
  131. package/template-nextjs-fullstack/src/db/index.ts +0 -8
  132. package/template-nextjs-fullstack/src/db/schema.ts +0 -11
  133. package/template-nextjs-fullstack/tailwind.config.ts +0 -10
  134. package/template-nextjs-fullstack/tsconfig.json +0 -34
  135. package/template-nextjs-static/README.md +0 -80
  136. package/template-nextjs-static/_gitignore +0 -41
  137. package/template-nextjs-static/eslint.config.js +0 -15
  138. package/template-nextjs-static/next.config.ts +0 -8
  139. package/template-nextjs-static/package.json +0 -77
  140. package/template-nextjs-static/postcss.config.js +0 -8
  141. package/template-nextjs-static/public/favicon.ico +0 -0
  142. package/template-nextjs-static/scripts/build.sh +0 -36
  143. package/template-nextjs-static/src/components/theme-provider.tsx +0 -6
  144. package/template-nextjs-static/src/components/ui/README.md +0 -134
  145. package/template-nextjs-static/src/components/ui/accordion.tsx +0 -66
  146. package/template-nextjs-static/src/components/ui/alert-dialog.tsx +0 -157
  147. package/template-nextjs-static/src/components/ui/alert.tsx +0 -71
  148. package/template-nextjs-static/src/components/ui/aspect-ratio.tsx +0 -11
  149. package/template-nextjs-static/src/components/ui/avatar.tsx +0 -53
  150. package/template-nextjs-static/src/components/ui/badge.tsx +0 -42
  151. package/template-nextjs-static/src/components/ui/breadcrumb.tsx +0 -109
  152. package/template-nextjs-static/src/components/ui/button-group.tsx +0 -83
  153. package/template-nextjs-static/src/components/ui/button.tsx +0 -69
  154. package/template-nextjs-static/src/components/ui/card.tsx +0 -82
  155. package/template-nextjs-static/src/components/ui/carousel.tsx +0 -241
  156. package/template-nextjs-static/src/components/ui/checkbox.tsx +0 -32
  157. package/template-nextjs-static/src/components/ui/collapsible.tsx +0 -33
  158. package/template-nextjs-static/src/components/ui/command.tsx +0 -208
  159. package/template-nextjs-static/src/components/ui/context-menu.tsx +0 -324
  160. package/template-nextjs-static/src/components/ui/dialog.tsx +0 -143
  161. package/template-nextjs-static/src/components/ui/dropdown-menu.tsx +0 -329
  162. package/template-nextjs-static/src/components/ui/empty.tsx +0 -104
  163. package/template-nextjs-static/src/components/ui/field.tsx +0 -248
  164. package/template-nextjs-static/src/components/ui/form.tsx +0 -167
  165. package/template-nextjs-static/src/components/ui/hover-card.tsx +0 -44
  166. package/template-nextjs-static/src/components/ui/icons/file-ae-colorful-icon.tsx +0 -21
  167. package/template-nextjs-static/src/components/ui/icons/file-ai-colorful-icon.tsx +0 -36
  168. package/template-nextjs-static/src/components/ui/icons/file-android-colorful-icon.tsx +0 -33
  169. package/template-nextjs-static/src/components/ui/icons/file-audio-colorful-icon.tsx +0 -21
  170. package/template-nextjs-static/src/components/ui/icons/file-code-colorful-icon.tsx +0 -28
  171. package/template-nextjs-static/src/components/ui/icons/file-csv-colorful-icon.tsx +0 -21
  172. package/template-nextjs-static/src/components/ui/icons/file-eml-colorful-icon.tsx +0 -29
  173. package/template-nextjs-static/src/components/ui/icons/file-ios-colorful-icon.tsx +0 -25
  174. package/template-nextjs-static/src/components/ui/icons/file-keynote-colorful-icon.tsx +0 -29
  175. package/template-nextjs-static/src/components/ui/icons/file-pages-colorful-icon.tsx +0 -29
  176. package/template-nextjs-static/src/components/ui/icons/file-ps-colorful-icon.tsx +0 -21
  177. package/template-nextjs-static/src/components/ui/icons/file-sketch-colorful-icon.tsx +0 -21
  178. package/template-nextjs-static/src/components/ui/icons/file-slide-colorful-icon.tsx +0 -21
  179. package/template-nextjs-static/src/components/ui/icons/file-vcf-colorful-icon.tsx +0 -29
  180. package/template-nextjs-static/src/components/ui/icons/file-wiki-excel-colorful-icon.tsx +0 -23
  181. package/template-nextjs-static/src/components/ui/icons/file-wiki-image-colorful-icon.tsx +0 -27
  182. package/template-nextjs-static/src/components/ui/icons/file-wiki-pdf-colorful-icon.tsx +0 -20
  183. package/template-nextjs-static/src/components/ui/icons/file-wiki-ppt-colorful-icon.tsx +0 -21
  184. package/template-nextjs-static/src/components/ui/icons/file-wiki-text-colorful-icon.tsx +0 -12
  185. package/template-nextjs-static/src/components/ui/icons/file-wiki-unknown-colorful-icon.tsx +0 -14
  186. package/template-nextjs-static/src/components/ui/icons/file-wiki-video-colorful-icon.tsx +0 -23
  187. package/template-nextjs-static/src/components/ui/icons/file-wiki-word-colorful-icon.tsx +0 -38
  188. package/template-nextjs-static/src/components/ui/icons/file-wiki-zip-colorful-icon.tsx +0 -21
  189. package/template-nextjs-static/src/components/ui/image.tsx +0 -183
  190. package/template-nextjs-static/src/components/ui/input-group.tsx +0 -166
  191. package/template-nextjs-static/src/components/ui/input.tsx +0 -21
  192. package/template-nextjs-static/src/components/ui/item.tsx +0 -193
  193. package/template-nextjs-static/src/components/ui/kbd.tsx +0 -28
  194. package/template-nextjs-static/src/components/ui/label.tsx +0 -24
  195. package/template-nextjs-static/src/components/ui/menubar.tsx +0 -348
  196. package/template-nextjs-static/src/components/ui/native-select.tsx +0 -48
  197. package/template-nextjs-static/src/components/ui/navigation-menu.tsx +0 -168
  198. package/template-nextjs-static/src/components/ui/popover.tsx +0 -48
  199. package/template-nextjs-static/src/components/ui/progress.tsx +0 -31
  200. package/template-nextjs-static/src/components/ui/radio-group.tsx +0 -45
  201. package/template-nextjs-static/src/components/ui/resizable.tsx +0 -56
  202. package/template-nextjs-static/src/components/ui/scroll-area.tsx +0 -58
  203. package/template-nextjs-static/src/components/ui/select.tsx +0 -243
  204. package/template-nextjs-static/src/components/ui/separator.tsx +0 -28
  205. package/template-nextjs-static/src/components/ui/sheet.tsx +0 -139
  206. package/template-nextjs-static/src/components/ui/sidebar.tsx +0 -727
  207. package/template-nextjs-static/src/components/ui/slider.tsx +0 -87
  208. package/template-nextjs-static/src/components/ui/sonner.tsx +0 -67
  209. package/template-nextjs-static/src/components/ui/spinner.tsx +0 -16
  210. package/template-nextjs-static/src/components/ui/streamdown.tsx +0 -186
  211. package/template-nextjs-static/src/components/ui/switch.tsx +0 -31
  212. package/template-nextjs-static/src/components/ui/table.tsx +0 -116
  213. package/template-nextjs-static/src/components/ui/tabs.tsx +0 -66
  214. package/template-nextjs-static/src/components/ui/textarea.tsx +0 -18
  215. package/template-nextjs-static/src/components/ui/toggle-group.tsx +0 -83
  216. package/template-nextjs-static/src/components/ui/toggle.tsx +0 -47
  217. package/template-nextjs-static/src/components/ui/tooltip.tsx +0 -61
  218. package/template-nextjs-static/src/hooks/use-mobile.ts +0 -19
  219. package/template-nextjs-static/src/lib/utils.ts +0 -6
  220. package/template-nextjs-static/src/pages/_app.tsx +0 -11
  221. package/template-nextjs-static/src/pages/_document.tsx +0 -13
  222. package/template-nextjs-static/src/pages/hello.tsx +0 -32
  223. package/template-nextjs-static/src/pages/index.tsx +0 -76
  224. package/template-nextjs-static/src/styles/globals.css +0 -143
  225. package/template-nextjs-static/tailwind.config.ts +0 -10
  226. package/template-nextjs-static/tsconfig.json +0 -34
  227. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/button-group.tsx +0 -0
  228. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/empty.tsx +0 -0
  229. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/field.tsx +0 -0
  230. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/form.tsx +0 -0
  231. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-ae-colorful-icon.tsx +0 -0
  232. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-ai-colorful-icon.tsx +0 -0
  233. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-android-colorful-icon.tsx +0 -0
  234. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-audio-colorful-icon.tsx +0 -0
  235. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-code-colorful-icon.tsx +0 -0
  236. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-csv-colorful-icon.tsx +0 -0
  237. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-eml-colorful-icon.tsx +0 -0
  238. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-ios-colorful-icon.tsx +0 -0
  239. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-keynote-colorful-icon.tsx +0 -0
  240. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-pages-colorful-icon.tsx +0 -0
  241. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-ps-colorful-icon.tsx +0 -0
  242. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-sketch-colorful-icon.tsx +0 -0
  243. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-slide-colorful-icon.tsx +0 -0
  244. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-vcf-colorful-icon.tsx +0 -0
  245. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-wiki-excel-colorful-icon.tsx +0 -0
  246. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-wiki-image-colorful-icon.tsx +0 -0
  247. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-wiki-pdf-colorful-icon.tsx +0 -0
  248. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-wiki-ppt-colorful-icon.tsx +0 -0
  249. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-wiki-text-colorful-icon.tsx +0 -0
  250. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-wiki-unknown-colorful-icon.tsx +0 -0
  251. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-wiki-video-colorful-icon.tsx +0 -0
  252. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-wiki-word-colorful-icon.tsx +0 -0
  253. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-wiki-zip-colorful-icon.tsx +0 -0
  254. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/image.tsx +0 -0
  255. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/item.tsx +0 -0
  256. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/kbd.tsx +0 -0
  257. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/native-select.tsx +0 -0
  258. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/spinner.tsx +0 -0
  259. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/streamdown.tsx +0 -0
  260. /package/{template-nextjs-fullstack → template-vite-react/client}/src/hooks/use-mobile.ts +0 -0
  261. /package/{template-nextjs-fullstack → template-vite-react/client}/src/lib/utils.ts +0 -0
@@ -0,0 +1,30 @@
1
+ import { Switch as SwitchPrimitive } from "@base-ui/react/switch"
2
+
3
+ import { cn } from "@/lib/utils"
4
+
5
+ function Switch({
6
+ className,
7
+ size = "default",
8
+ ...props
9
+ }: SwitchPrimitive.Root.Props & {
10
+ size?: "sm" | "default"
11
+ }) {
12
+ return (
13
+ <SwitchPrimitive.Root
14
+ data-slot="switch"
15
+ data-size={size}
16
+ className={cn(
17
+ "peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",
18
+ className
19
+ )}
20
+ {...props}
21
+ >
22
+ <SwitchPrimitive.Thumb
23
+ data-slot="switch-thumb"
24
+ className="pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"
25
+ />
26
+ </SwitchPrimitive.Root>
27
+ )
28
+ }
29
+
30
+ export { Switch }
@@ -44,7 +44,7 @@ function TableFooter({ className, ...props }: React.ComponentProps<"tfoot">) {
44
44
  <tfoot
45
45
  data-slot="table-footer"
46
46
  className={cn(
47
- "bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",
47
+ "border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
48
48
  className
49
49
  )}
50
50
  {...props}
@@ -57,7 +57,7 @@ function TableRow({ className, ...props }: React.ComponentProps<"tr">) {
57
57
  <tr
58
58
  data-slot="table-row"
59
59
  className={cn(
60
- "hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",
60
+ "border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
61
61
  className
62
62
  )}
63
63
  {...props}
@@ -70,7 +70,7 @@ function TableHead({ className, ...props }: React.ComponentProps<"th">) {
70
70
  <th
71
71
  data-slot="table-head"
72
72
  className={cn(
73
- "text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
73
+ "h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0",
74
74
  className
75
75
  )}
76
76
  {...props}
@@ -83,7 +83,7 @@ function TableCell({ className, ...props }: React.ComponentProps<"td">) {
83
83
  <td
84
84
  data-slot="table-cell"
85
85
  className={cn(
86
- "p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
86
+ "p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",
87
87
  className
88
88
  )}
89
89
  {...props}
@@ -98,7 +98,7 @@ function TableCaption({
98
98
  return (
99
99
  <caption
100
100
  data-slot="table-caption"
101
- className={cn("text-muted-foreground mt-4 text-sm", className)}
101
+ className={cn("mt-4 text-sm text-muted-foreground", className)}
102
102
  {...props}
103
103
  />
104
104
  )
@@ -0,0 +1,80 @@
1
+ import { Tabs as TabsPrimitive } from "@base-ui/react/tabs"
2
+ import { cva, type VariantProps } from "class-variance-authority"
3
+
4
+ import { cn } from "@/lib/utils"
5
+
6
+ function Tabs({
7
+ className,
8
+ orientation = "horizontal",
9
+ ...props
10
+ }: TabsPrimitive.Root.Props) {
11
+ return (
12
+ <TabsPrimitive.Root
13
+ data-slot="tabs"
14
+ data-orientation={orientation}
15
+ className={cn(
16
+ "group/tabs flex gap-2 data-horizontal:flex-col",
17
+ className
18
+ )}
19
+ {...props}
20
+ />
21
+ )
22
+ }
23
+
24
+ const tabsListVariants = cva(
25
+ "group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none",
26
+ {
27
+ variants: {
28
+ variant: {
29
+ default: "bg-muted",
30
+ line: "gap-1 bg-transparent",
31
+ },
32
+ },
33
+ defaultVariants: {
34
+ variant: "default",
35
+ },
36
+ }
37
+ )
38
+
39
+ function TabsList({
40
+ className,
41
+ variant = "default",
42
+ ...props
43
+ }: TabsPrimitive.List.Props & VariantProps<typeof tabsListVariants>) {
44
+ return (
45
+ <TabsPrimitive.List
46
+ data-slot="tabs-list"
47
+ data-variant={variant}
48
+ className={cn(tabsListVariants({ variant }), className)}
49
+ {...props}
50
+ />
51
+ )
52
+ }
53
+
54
+ function TabsTrigger({ className, ...props }: TabsPrimitive.Tab.Props) {
55
+ return (
56
+ <TabsPrimitive.Tab
57
+ data-slot="tabs-trigger"
58
+ className={cn(
59
+ "relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
60
+ "group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent",
61
+ "data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground",
62
+ "after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100",
63
+ className
64
+ )}
65
+ {...props}
66
+ />
67
+ )
68
+ }
69
+
70
+ function TabsContent({ className, ...props }: TabsPrimitive.Panel.Props) {
71
+ return (
72
+ <TabsPrimitive.Panel
73
+ data-slot="tabs-content"
74
+ className={cn("flex-1 text-sm outline-none", className)}
75
+ {...props}
76
+ />
77
+ )
78
+ }
79
+
80
+ export { Tabs, TabsList, TabsTrigger, TabsContent, tabsListVariants }
@@ -0,0 +1,18 @@
1
+ import * as React from "react"
2
+
3
+ import { cn } from "@/lib/utils"
4
+
5
+ function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
6
+ return (
7
+ <textarea
8
+ data-slot="textarea"
9
+ className={cn(
10
+ "flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",
11
+ className
12
+ )}
13
+ {...props}
14
+ />
15
+ )
16
+ }
17
+
18
+ export { Textarea }
@@ -0,0 +1,89 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { Toggle as TogglePrimitive } from "@base-ui/react/toggle"
5
+ import { ToggleGroup as ToggleGroupPrimitive } from "@base-ui/react/toggle-group"
6
+ import { type VariantProps } from "class-variance-authority"
7
+
8
+ import { cn } from "@/lib/utils"
9
+ import { toggleVariants } from "@/components/ui/toggle"
10
+
11
+ const ToggleGroupContext = React.createContext<
12
+ VariantProps<typeof toggleVariants> & {
13
+ spacing?: number
14
+ orientation?: "horizontal" | "vertical"
15
+ }
16
+ >({
17
+ size: "default",
18
+ variant: "default",
19
+ spacing: 0,
20
+ orientation: "horizontal",
21
+ })
22
+
23
+ function ToggleGroup({
24
+ className,
25
+ variant,
26
+ size,
27
+ spacing = 0,
28
+ orientation = "horizontal",
29
+ children,
30
+ ...props
31
+ }: ToggleGroupPrimitive.Props &
32
+ VariantProps<typeof toggleVariants> & {
33
+ spacing?: number
34
+ orientation?: "horizontal" | "vertical"
35
+ }) {
36
+ return (
37
+ <ToggleGroupPrimitive
38
+ data-slot="toggle-group"
39
+ data-variant={variant}
40
+ data-size={size}
41
+ data-spacing={spacing}
42
+ data-orientation={orientation}
43
+ style={{ "--gap": spacing } as React.CSSProperties}
44
+ className={cn(
45
+ "group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch",
46
+ className
47
+ )}
48
+ {...props}
49
+ >
50
+ <ToggleGroupContext.Provider
51
+ value={{ variant, size, spacing, orientation }}
52
+ >
53
+ {children}
54
+ </ToggleGroupContext.Provider>
55
+ </ToggleGroupPrimitive>
56
+ )
57
+ }
58
+
59
+ function ToggleGroupItem({
60
+ className,
61
+ children,
62
+ variant = "default",
63
+ size = "default",
64
+ ...props
65
+ }: TogglePrimitive.Props & VariantProps<typeof toggleVariants>) {
66
+ const context = React.useContext(ToggleGroupContext)
67
+
68
+ return (
69
+ <TogglePrimitive
70
+ data-slot="toggle-group-item"
71
+ data-variant={context.variant || variant}
72
+ data-size={context.size || size}
73
+ data-spacing={context.spacing}
74
+ className={cn(
75
+ "shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t",
76
+ toggleVariants({
77
+ variant: context.variant || variant,
78
+ size: context.size || size,
79
+ }),
80
+ className
81
+ )}
82
+ {...props}
83
+ >
84
+ {children}
85
+ </TogglePrimitive>
86
+ )
87
+ }
88
+
89
+ export { ToggleGroup, ToggleGroupItem }
@@ -0,0 +1,44 @@
1
+ "use client"
2
+
3
+ import { Toggle as TogglePrimitive } from "@base-ui/react/toggle"
4
+ import { cva, type VariantProps } from "class-variance-authority"
5
+
6
+ import { cn } from "@/lib/utils"
7
+
8
+ const toggleVariants = cva(
9
+ "group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
10
+ {
11
+ variants: {
12
+ variant: {
13
+ default: "bg-transparent",
14
+ outline: "border border-input bg-transparent hover:bg-muted",
15
+ },
16
+ size: {
17
+ default: "h-8 min-w-8 px-2",
18
+ sm: "h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-1.5 text-[0.8rem]",
19
+ lg: "h-9 min-w-9 px-2.5",
20
+ },
21
+ },
22
+ defaultVariants: {
23
+ variant: "default",
24
+ size: "default",
25
+ },
26
+ }
27
+ )
28
+
29
+ function Toggle({
30
+ className,
31
+ variant = "default",
32
+ size = "default",
33
+ ...props
34
+ }: TogglePrimitive.Props & VariantProps<typeof toggleVariants>) {
35
+ return (
36
+ <TogglePrimitive
37
+ data-slot="toggle"
38
+ className={cn(toggleVariants({ variant, size, className }))}
39
+ {...props}
40
+ />
41
+ )
42
+ }
43
+
44
+ export { Toggle, toggleVariants }
@@ -0,0 +1,64 @@
1
+ import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip"
2
+
3
+ import { cn } from "@/lib/utils"
4
+
5
+ function TooltipProvider({
6
+ delay = 0,
7
+ ...props
8
+ }: TooltipPrimitive.Provider.Props) {
9
+ return (
10
+ <TooltipPrimitive.Provider
11
+ data-slot="tooltip-provider"
12
+ delay={delay}
13
+ {...props}
14
+ />
15
+ )
16
+ }
17
+
18
+ function Tooltip({ ...props }: TooltipPrimitive.Root.Props) {
19
+ return <TooltipPrimitive.Root data-slot="tooltip" {...props} />
20
+ }
21
+
22
+ function TooltipTrigger({ ...props }: TooltipPrimitive.Trigger.Props) {
23
+ return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />
24
+ }
25
+
26
+ function TooltipContent({
27
+ className,
28
+ side = "top",
29
+ sideOffset = 4,
30
+ align = "center",
31
+ alignOffset = 0,
32
+ children,
33
+ ...props
34
+ }: TooltipPrimitive.Popup.Props &
35
+ Pick<
36
+ TooltipPrimitive.Positioner.Props,
37
+ "align" | "alignOffset" | "side" | "sideOffset"
38
+ >) {
39
+ return (
40
+ <TooltipPrimitive.Portal>
41
+ <TooltipPrimitive.Positioner
42
+ align={align}
43
+ alignOffset={alignOffset}
44
+ side={side}
45
+ sideOffset={sideOffset}
46
+ className="isolate z-50"
47
+ >
48
+ <TooltipPrimitive.Popup
49
+ data-slot="tooltip-content"
50
+ className={cn(
51
+ "z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
52
+ className
53
+ )}
54
+ {...props}
55
+ >
56
+ {children}
57
+ <TooltipPrimitive.Arrow className="z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5" />
58
+ </TooltipPrimitive.Popup>
59
+ </TooltipPrimitive.Positioner>
60
+ </TooltipPrimitive.Portal>
61
+ )
62
+ }
63
+
64
+ export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
@@ -0,0 +1 @@
1
+ @import "tailwindcss";
@@ -0,0 +1,13 @@
1
+ import { StrictMode } from "react";
2
+ import { createRoot } from "react-dom/client";
3
+ import { ThemeProvider } from "@/components/theme-provider";
4
+ import App from "./app";
5
+ import "./index.css";
6
+
7
+ createRoot(document.getElementById("root")!).render(
8
+ <StrictMode>
9
+ <ThemeProvider defaultTheme="light">
10
+ <App />
11
+ </ThemeProvider>
12
+ </StrictMode>,
13
+ );
@@ -0,0 +1,12 @@
1
+ export default function HomePage() {
2
+ return (
3
+ <div className="py-16 text-center">
4
+ <h1 className="text-4xl font-bold tracking-tight sm:text-6xl mb-6">
5
+ Welcome to OpenClaw
6
+ </h1>
7
+ <p className="text-lg text-muted-foreground max-w-2xl mx-auto">
8
+ Vite + React + Tailwind + shadcn/ui
9
+ </p>
10
+ </div>
11
+ );
12
+ }
@@ -0,0 +1,11 @@
1
+ import { Link } from "react-router-dom";
2
+
3
+ export default function NotFoundPage() {
4
+ return (
5
+ <div className="flex flex-col items-center justify-center py-24">
6
+ <h1 className="text-6xl font-bold mb-4">404</h1>
7
+ <p className="text-lg text-muted-foreground mb-8">页面不存在</p>
8
+ <Link to="/" className="text-primary hover:underline">返回首页</Link>
9
+ </div>
10
+ );
11
+ }
@@ -0,0 +1 @@
1
+ // 全局类型定义
@@ -4,8 +4,8 @@
4
4
  "rsc": false,
5
5
  "tsx": true,
6
6
  "tailwind": {
7
- "config": "tailwind.config.ts",
8
- "css": "src/styles/globals.css",
7
+ "config": "",
8
+ "css": "client/src/index.css",
9
9
  "baseColor": "neutral",
10
10
  "cssVariables": true,
11
11
  "prefix": ""
@@ -0,0 +1,23 @@
1
+ import js from '@eslint/js'
2
+ import globals from 'globals'
3
+ import reactHooks from 'eslint-plugin-react-hooks'
4
+ import reactRefresh from 'eslint-plugin-react-refresh'
5
+ import tseslint from 'typescript-eslint'
6
+ import { defineConfig, globalIgnores } from 'eslint/config'
7
+
8
+ export default defineConfig([
9
+ globalIgnores(['dist']),
10
+ {
11
+ files: ['**/*.{ts,tsx}'],
12
+ extends: [
13
+ js.configs.recommended,
14
+ tseslint.configs.recommended,
15
+ reactHooks.configs.flat.recommended,
16
+ reactRefresh.configs.vite,
17
+ ],
18
+ languageOptions: {
19
+ ecmaVersion: 2020,
20
+ globals: globals.browser,
21
+ },
22
+ },
23
+ ])
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "{{projectName}}",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "mclaw": {
7
+ "stack": "vite-react",
8
+ "stackVersion": "0.1.0"
9
+ },
10
+ "scripts": {
11
+ "dev": "vite",
12
+ "build": "bash scripts/build.sh",
13
+ "lint": "npm run lint:client",
14
+ "lint:client": "eslint client/src",
15
+ "preview": "vite preview"
16
+ },
17
+ "dependencies": {
18
+ "@base-ui/react": "^1.3.0",
19
+ "@radix-ui/react-label": "^2.1.7",
20
+ "@radix-ui/react-slot": "^1.2.3",
21
+ "@hookform/resolvers": "^5.2.2",
22
+ "@tailwindcss/vite": "^4.2.2",
23
+ "class-variance-authority": "^0.7.1",
24
+ "clsx": "^2.1.1",
25
+ "cmdk": "^1.1.1",
26
+ "date-fns": "^4.1.0",
27
+ "embla-carousel-react": "^8.6.0",
28
+ "input-otp": "^1.4.2",
29
+ "lucide-react": "^1.7.0",
30
+ "next-themes": "^0.4.6",
31
+ "react": "^19.2.4",
32
+ "react-day-picker": "^9.14.0",
33
+ "react-dom": "^19.2.4",
34
+ "react-hook-form": "^7.72.0",
35
+ "react-resizable-panels": "^4.7.6",
36
+ "react-router-dom": "^7.13.2",
37
+ "recharts": "^3.8.0",
38
+ "sonner": "^2.0.7",
39
+ "tailwind-merge": "^3.5.0",
40
+ "tailwindcss": "^4.2.2",
41
+ "vaul": "^1.1.2",
42
+ "zod": "^4.3.6"
43
+ },
44
+ "devDependencies": {
45
+ "@eslint/js": "^9",
46
+ "@types/node": "^24",
47
+ "@types/react": "^19",
48
+ "@types/react-dom": "^19",
49
+ "@vitejs/plugin-react": "^6",
50
+ "eslint": "^9",
51
+ "eslint-plugin-react-hooks": "^7",
52
+ "eslint-plugin-react-refresh": "^0.5",
53
+ "globals": "^17",
54
+ "typescript": "~5.9",
55
+ "typescript-eslint": "^8",
56
+ "vite": "^8"
57
+ }
58
+ }
@@ -0,0 +1,40 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
5
+ OUTPUT="$ROOT/dist/output"
6
+ OUTPUT_RESOURCE="$ROOT/dist/output_resource"
7
+ OUTPUT_STATIC="$ROOT/dist/output_static"
8
+
9
+ # 清理
10
+ rm -rf "$ROOT/dist"
11
+
12
+ # 1. Vite 构建 → dist/client/(相对于项目根目录输出)
13
+ npx vite build --outDir "$ROOT/dist/client" --emptyOutDir
14
+
15
+ # 2. HTML → dist/output/
16
+ mkdir -p "$OUTPUT"
17
+ find "$ROOT/dist/client" -maxdepth 1 -name '*.html' -exec cp {} "$OUTPUT/" \;
18
+
19
+ # 生成 routes.json
20
+ echo '{ "version": 1, "type": "vite-react", "fallback": "index.html" }' > "$OUTPUT/routes.json"
21
+
22
+ # 3. assets/ → dist/output_resource/(JS/CSS/字体,上传到 CDN)
23
+ if [ -d "$ROOT/dist/client/assets" ]; then
24
+ mkdir -p "$OUTPUT_RESOURCE"
25
+ cp -r "$ROOT/dist/client/assets" "$OUTPUT_RESOURCE/"
26
+ fi
27
+
28
+ # 4. 私有静态资源 → dist/output_static/(排除代码文件)
29
+ if [ -d "$ROOT/shared/static" ]; then
30
+ mkdir -p "$OUTPUT_STATIC"
31
+ rsync -a --exclude='*.ts' --exclude='*.tsx' --exclude='*.js' --exclude='*.jsx' "$ROOT/shared/static/" "$OUTPUT_STATIC/"
32
+ fi
33
+
34
+ # 清理中间产物
35
+ rm -rf "$ROOT/dist/client"
36
+
37
+ echo "Build complete"
38
+ echo " HTML → dist/output/"
39
+ [ -d "$OUTPUT_RESOURCE" ] && echo " Resource → dist/output_resource/" || true
40
+ [ -d "$OUTPUT_STATIC" ] && echo " Static → dist/output_static/" || true
@@ -0,0 +1 @@
1
+ // 前后端共享类型定义
@@ -0,0 +1,33 @@
1
+ {
2
+ "compilerOptions": {
3
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
4
+ "target": "ES2023",
5
+ "useDefineForClassFields": true,
6
+ "lib": ["ES2023", "DOM", "DOM.Iterable"],
7
+ "module": "ESNext",
8
+ "types": ["vite/client"],
9
+ "skipLibCheck": true,
10
+
11
+ /* Bundler mode */
12
+ "moduleResolution": "bundler",
13
+ "allowImportingTsExtensions": true,
14
+ "verbatimModuleSyntax": true,
15
+ "moduleDetection": "force",
16
+ "noEmit": true,
17
+ "jsx": "react-jsx",
18
+
19
+ /* Linting */
20
+ "strict": true,
21
+ "noUnusedLocals": true,
22
+ "noUnusedParameters": true,
23
+ "erasableSyntaxOnly": true,
24
+ "noFallthroughCasesInSwitch": true,
25
+ "noUncheckedSideEffectImports": true,
26
+ "baseUrl": ".",
27
+ "paths": {
28
+ "@/*": ["./client/src/*"],
29
+ "@shared/*": ["./shared/*"]
30
+ }
31
+ },
32
+ "include": ["client/src", "shared"]
33
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "baseUrl": ".",
4
+ "paths": {
5
+ "@/*": ["./client/src/*"],
6
+ "@shared/*": ["./shared/*"]
7
+ }
8
+ },
9
+ "files": [],
10
+ "references": [
11
+ { "path": "./tsconfig.app.json" },
12
+ { "path": "./tsconfig.node.json" }
13
+ ]
14
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "compilerOptions": {
3
+ "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
4
+ "target": "ES2023",
5
+ "lib": ["ES2023"],
6
+ "module": "ESNext",
7
+ "types": ["node"],
8
+ "skipLibCheck": true,
9
+
10
+ /* Bundler mode */
11
+ "moduleResolution": "bundler",
12
+ "allowImportingTsExtensions": true,
13
+ "verbatimModuleSyntax": true,
14
+ "moduleDetection": "force",
15
+ "noEmit": true,
16
+
17
+ /* Linting */
18
+ "strict": true,
19
+ "noUnusedLocals": true,
20
+ "noUnusedParameters": true,
21
+ "erasableSyntaxOnly": true,
22
+ "noFallthroughCasesInSwitch": true,
23
+ "noUncheckedSideEffectImports": true
24
+ },
25
+ "include": ["vite.config.ts"]
26
+ }
@@ -0,0 +1,17 @@
1
+ import path from 'path'
2
+ import { defineConfig } from 'vite'
3
+ import react from '@vitejs/plugin-react'
4
+ import tailwindcss from '@tailwindcss/vite'
5
+
6
+ // https://vite.dev/config/
7
+ export default defineConfig({
8
+ root: path.resolve(__dirname, 'client'),
9
+ base: process.env.MCLAW_CDN_DOMAIN || '/',
10
+ plugins: [react(), tailwindcss()],
11
+ resolve: {
12
+ alias: {
13
+ '@': path.resolve(__dirname, 'client/src'),
14
+ '@shared': path.resolve(__dirname, 'shared'),
15
+ },
16
+ },
17
+ })