@coze-arch/cli 0.0.1-beta.5 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/lib/__templates__/expo/.coze +7 -2
- package/lib/__templates__/expo/.cozeproj/scripts/dev_build.sh +46 -0
- package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +229 -0
- package/lib/__templates__/expo/.cozeproj/scripts/prod_build.sh +47 -0
- package/lib/__templates__/expo/.cozeproj/scripts/prod_run.sh +34 -0
- package/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +46 -0
- package/lib/__templates__/expo/README.md +68 -7
- package/lib/__templates__/expo/_gitignore +1 -1
- package/lib/__templates__/{react-rsbuild → expo}/_npmrc +4 -5
- package/lib/__templates__/expo/client/app/+not-found.tsx +15 -64
- package/lib/__templates__/expo/client/app/_layout.tsx +15 -12
- package/lib/__templates__/expo/client/app/index.tsx +1 -0
- package/lib/__templates__/expo/client/app.config.ts +76 -0
- package/lib/__templates__/expo/client/components/Screen.tsx +22 -38
- package/lib/__templates__/expo/client/components/ThemedText.tsx +33 -0
- package/lib/__templates__/expo/client/components/ThemedView.tsx +37 -0
- package/lib/__templates__/expo/client/constants/theme.ts +117 -58
- package/lib/__templates__/expo/client/contexts/AuthContext.tsx +14 -107
- package/lib/__templates__/expo/client/declarations.d.ts +5 -0
- package/lib/__templates__/expo/{eslint.config.mjs → client/eslint.config.mjs} +40 -10
- package/lib/__templates__/expo/client/hooks/useColorScheme.tsx +48 -0
- package/lib/__templates__/expo/client/hooks/useSafeRouter.ts +152 -0
- package/lib/__templates__/expo/client/hooks/useTheme.ts +26 -6
- package/lib/__templates__/expo/client/metro.config.js +124 -0
- package/lib/__templates__/expo/client/package.json +95 -0
- package/lib/__templates__/expo/client/screens/demo/index.tsx +25 -0
- package/lib/__templates__/expo/client/screens/demo/styles.ts +28 -0
- package/lib/__templates__/expo/client/scripts/install-missing-deps.js +47 -22
- package/lib/__templates__/expo/client/tsconfig.json +24 -0
- package/lib/__templates__/expo/client/utils/index.ts +23 -2
- package/lib/__templates__/expo/eslint-plugins/fontawesome6/index.js +9 -0
- package/lib/__templates__/expo/eslint-plugins/fontawesome6/names.js +1889 -0
- package/lib/__templates__/expo/eslint-plugins/fontawesome6/rule.js +174 -0
- package/lib/__templates__/expo/eslint-plugins/fontawesome6/v5-only-names.js +388 -0
- package/lib/__templates__/expo/eslint-plugins/forbid-emoji/index.js +9 -0
- package/lib/__templates__/expo/eslint-plugins/forbid-emoji/rule.js +112 -0
- package/lib/__templates__/expo/eslint-plugins/forbid-emoji/tech.md +94 -0
- package/lib/__templates__/expo/eslint-plugins/react-native/index.js +9 -0
- package/lib/__templates__/expo/eslint-plugins/react-native/rule.js +64 -0
- package/lib/__templates__/expo/eslint-plugins/reanimated/index.js +9 -0
- package/lib/__templates__/expo/eslint-plugins/reanimated/rule.js +88 -0
- package/lib/__templates__/expo/eslint-plugins/restrict-linear-gradient/index.js +9 -0
- package/lib/__templates__/expo/eslint-plugins/restrict-linear-gradient/rule.js +120 -0
- package/lib/__templates__/expo/eslint-plugins/restrict-linear-gradient/tech.md +58 -0
- package/lib/__templates__/expo/package.json +16 -91
- package/lib/__templates__/expo/patches/expo@54.0.33.patch +45 -0
- package/lib/__templates__/expo/pnpm-lock.yaml +1805 -3126
- package/lib/__templates__/expo/pnpm-workspace.yaml +3 -0
- package/lib/__templates__/expo/server/build.js +21 -0
- package/lib/__templates__/expo/server/package.json +34 -0
- package/lib/__templates__/expo/server/src/index.ts +20 -0
- package/lib/__templates__/expo/server/tsconfig.json +24 -0
- package/lib/__templates__/expo/template.config.js +58 -1
- package/lib/__templates__/expo/tsconfig.json +1 -24
- package/lib/__templates__/native-static/.coze +11 -0
- package/lib/__templates__/native-static/index.html +33 -0
- package/lib/__templates__/native-static/styles/main.css +136 -0
- package/lib/__templates__/native-static/template.config.js +22 -0
- package/lib/__templates__/nextjs/.babelrc +15 -0
- package/lib/__templates__/nextjs/.coze +4 -3
- package/lib/__templates__/nextjs/README.md +346 -19
- package/lib/__templates__/nextjs/_npmrc +2 -1
- package/lib/__templates__/nextjs/components.json +21 -0
- package/lib/__templates__/nextjs/eslint.config.mjs +5 -0
- package/lib/__templates__/nextjs/next.config.ts +11 -0
- package/lib/__templates__/nextjs/package.json +63 -2
- package/lib/__templates__/nextjs/pnpm-lock.yaml +10053 -1710
- package/lib/__templates__/nextjs/scripts/build.sh +4 -1
- package/lib/__templates__/nextjs/scripts/dev.sh +15 -27
- package/lib/__templates__/{react-rsbuild/scripts/build.sh → nextjs/scripts/prepare.sh} +0 -5
- package/lib/__templates__/nextjs/scripts/start.sh +7 -1
- package/lib/__templates__/nextjs/src/app/globals.css +124 -13
- package/lib/__templates__/nextjs/src/app/layout.tsx +56 -16
- package/lib/__templates__/nextjs/src/app/page.tsx +18 -49
- package/lib/__templates__/nextjs/src/app/robots.ts +11 -0
- package/lib/__templates__/nextjs/src/components/ui/accordion.tsx +66 -0
- package/lib/__templates__/nextjs/src/components/ui/alert-dialog.tsx +157 -0
- package/lib/__templates__/nextjs/src/components/ui/alert.tsx +66 -0
- package/lib/__templates__/nextjs/src/components/ui/aspect-ratio.tsx +11 -0
- package/lib/__templates__/nextjs/src/components/ui/avatar.tsx +53 -0
- package/lib/__templates__/nextjs/src/components/ui/badge.tsx +46 -0
- package/lib/__templates__/nextjs/src/components/ui/breadcrumb.tsx +109 -0
- package/lib/__templates__/nextjs/src/components/ui/button-group.tsx +83 -0
- package/lib/__templates__/nextjs/src/components/ui/button.tsx +62 -0
- package/lib/__templates__/nextjs/src/components/ui/calendar.tsx +220 -0
- package/lib/__templates__/nextjs/src/components/ui/card.tsx +92 -0
- package/lib/__templates__/nextjs/src/components/ui/carousel.tsx +241 -0
- package/lib/__templates__/nextjs/src/components/ui/chart.tsx +357 -0
- package/lib/__templates__/nextjs/src/components/ui/checkbox.tsx +32 -0
- package/lib/__templates__/nextjs/src/components/ui/collapsible.tsx +33 -0
- package/lib/__templates__/nextjs/src/components/ui/command.tsx +184 -0
- package/lib/__templates__/nextjs/src/components/ui/context-menu.tsx +252 -0
- package/lib/__templates__/nextjs/src/components/ui/dialog.tsx +143 -0
- package/lib/__templates__/nextjs/src/components/ui/drawer.tsx +135 -0
- package/lib/__templates__/nextjs/src/components/ui/dropdown-menu.tsx +257 -0
- package/lib/__templates__/nextjs/src/components/ui/empty.tsx +104 -0
- package/lib/__templates__/nextjs/src/components/ui/field.tsx +248 -0
- package/lib/__templates__/nextjs/src/components/ui/form.tsx +167 -0
- package/lib/__templates__/nextjs/src/components/ui/hover-card.tsx +44 -0
- package/lib/__templates__/nextjs/src/components/ui/input-group.tsx +170 -0
- package/lib/__templates__/nextjs/src/components/ui/input-otp.tsx +77 -0
- package/lib/__templates__/nextjs/src/components/ui/input.tsx +21 -0
- package/lib/__templates__/nextjs/src/components/ui/item.tsx +193 -0
- package/lib/__templates__/nextjs/src/components/ui/kbd.tsx +28 -0
- package/lib/__templates__/nextjs/src/components/ui/label.tsx +24 -0
- package/lib/__templates__/nextjs/src/components/ui/menubar.tsx +276 -0
- package/lib/__templates__/nextjs/src/components/ui/navigation-menu.tsx +168 -0
- package/lib/__templates__/nextjs/src/components/ui/pagination.tsx +127 -0
- package/lib/__templates__/nextjs/src/components/ui/popover.tsx +48 -0
- package/lib/__templates__/nextjs/src/components/ui/progress.tsx +31 -0
- package/lib/__templates__/nextjs/src/components/ui/radio-group.tsx +45 -0
- package/lib/__templates__/nextjs/src/components/ui/resizable.tsx +63 -0
- package/lib/__templates__/nextjs/src/components/ui/scroll-area.tsx +58 -0
- package/lib/__templates__/nextjs/src/components/ui/select.tsx +190 -0
- package/lib/__templates__/nextjs/src/components/ui/separator.tsx +28 -0
- package/lib/__templates__/nextjs/src/components/ui/sheet.tsx +139 -0
- package/lib/__templates__/nextjs/src/components/ui/sidebar.tsx +724 -0
- package/lib/__templates__/nextjs/src/components/ui/skeleton.tsx +13 -0
- package/lib/__templates__/nextjs/src/components/ui/slider.tsx +63 -0
- package/lib/__templates__/nextjs/src/components/ui/sonner.tsx +40 -0
- package/lib/__templates__/nextjs/src/components/ui/spinner.tsx +16 -0
- package/lib/__templates__/nextjs/src/components/ui/switch.tsx +31 -0
- package/lib/__templates__/nextjs/src/components/ui/table.tsx +116 -0
- package/lib/__templates__/nextjs/src/components/ui/tabs.tsx +66 -0
- package/lib/__templates__/nextjs/src/components/ui/textarea.tsx +18 -0
- package/lib/__templates__/nextjs/src/components/ui/toggle-group.tsx +83 -0
- package/lib/__templates__/nextjs/src/components/ui/toggle.tsx +47 -0
- package/lib/__templates__/nextjs/src/components/ui/tooltip.tsx +61 -0
- package/lib/__templates__/nextjs/src/hooks/use-mobile.ts +19 -0
- package/lib/__templates__/nextjs/src/lib/utils.ts +6 -0
- package/lib/__templates__/nextjs/src/server.ts +35 -0
- package/lib/__templates__/nextjs/template.config.js +70 -5
- package/lib/__templates__/nextjs/tsconfig.json +1 -1
- package/lib/__templates__/nuxt-vue/.coze +12 -0
- package/lib/__templates__/nuxt-vue/README.md +73 -0
- package/lib/__templates__/nuxt-vue/_gitignore +24 -0
- package/lib/__templates__/{rsbuild → nuxt-vue}/_npmrc +2 -1
- package/lib/__templates__/nuxt-vue/app/app.vue +6 -0
- package/lib/__templates__/nuxt-vue/app/pages/index.vue +23 -0
- package/lib/__templates__/{rsbuild/src/index.css → nuxt-vue/assets/css/main.css} +7 -4
- package/lib/__templates__/nuxt-vue/nuxt.config.ts +116 -0
- package/lib/__templates__/nuxt-vue/package.json +35 -0
- package/lib/__templates__/nuxt-vue/pnpm-lock.yaml +8759 -0
- package/lib/__templates__/nuxt-vue/postcss.config.mjs +8 -0
- package/lib/__templates__/nuxt-vue/public/favicon.ico +0 -0
- package/lib/__templates__/nuxt-vue/public/robots.txt +2 -0
- package/lib/__templates__/{rsbuild → nuxt-vue}/scripts/build.sh +2 -2
- package/lib/__templates__/nuxt-vue/scripts/dev.sh +39 -0
- package/lib/__templates__/nuxt-vue/scripts/prepare.sh +14 -0
- package/lib/__templates__/nuxt-vue/scripts/start.sh +21 -0
- package/lib/__templates__/nuxt-vue/server/api/hello.ts +10 -0
- package/lib/__templates__/nuxt-vue/server/middleware/logger.ts +10 -0
- package/lib/__templates__/nuxt-vue/server/routes/health.ts +10 -0
- package/lib/__templates__/nuxt-vue/tailwind.config.js +13 -0
- package/lib/__templates__/nuxt-vue/template.config.js +87 -0
- package/lib/__templates__/nuxt-vue/tsconfig.json +18 -0
- package/lib/__templates__/taro/.coze +14 -0
- package/lib/__templates__/taro/.cozeproj/scripts/deploy_build.sh +19 -0
- package/lib/__templates__/taro/.cozeproj/scripts/deploy_run.sh +14 -0
- package/lib/__templates__/taro/.cozeproj/scripts/dev_build.sh +2 -0
- package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +151 -0
- package/lib/__templates__/taro/.cozeproj/scripts/init_env.sh +5 -0
- package/lib/__templates__/taro/.cozeproj/scripts/pack.sh +24 -0
- package/lib/__templates__/taro/README.md +763 -0
- package/lib/__templates__/taro/_gitignore +40 -0
- package/lib/__templates__/taro/_npmrc +18 -0
- package/lib/__templates__/taro/babel.config.js +12 -0
- package/lib/__templates__/taro/config/dev.ts +9 -0
- package/lib/__templates__/taro/config/index.ts +238 -0
- package/lib/__templates__/taro/config/prod.ts +34 -0
- package/lib/__templates__/taro/eslint.config.mjs +135 -0
- package/lib/__templates__/taro/key/private.appid.key +0 -0
- package/lib/__templates__/taro/package.json +112 -0
- package/lib/__templates__/taro/patches/@tarojs__plugin-mini-ci@4.1.9.patch +30 -0
- package/lib/__templates__/taro/pnpm-lock.yaml +23412 -0
- package/lib/__templates__/taro/pnpm-workspace.yaml +2 -0
- package/lib/__templates__/taro/project.config.json +15 -0
- package/lib/__templates__/taro/server/nest-cli.json +10 -0
- package/lib/__templates__/taro/server/package.json +40 -0
- package/lib/__templates__/taro/server/src/app.controller.ts +23 -0
- package/lib/__templates__/taro/server/src/app.module.ts +10 -0
- package/lib/__templates__/taro/server/src/app.service.ts +8 -0
- package/lib/__templates__/taro/server/src/interceptors/http-status.interceptor.ts +23 -0
- package/lib/__templates__/taro/server/src/main.ts +49 -0
- package/lib/__templates__/taro/server/tsconfig.json +24 -0
- package/lib/__templates__/taro/src/app.config.ts +11 -0
- package/lib/__templates__/taro/src/app.css +156 -0
- package/lib/__templates__/taro/src/app.tsx +9 -0
- package/lib/__templates__/taro/src/components/ui/accordion.tsx +159 -0
- package/lib/__templates__/taro/src/components/ui/alert-dialog.tsx +260 -0
- package/lib/__templates__/taro/src/components/ui/alert.tsx +60 -0
- package/lib/__templates__/taro/src/components/ui/aspect-ratio.tsx +36 -0
- package/lib/__templates__/taro/src/components/ui/avatar.tsx +84 -0
- package/lib/__templates__/taro/src/components/ui/badge.tsx +37 -0
- package/lib/__templates__/taro/src/components/ui/breadcrumb.tsx +117 -0
- package/lib/__templates__/taro/src/components/ui/button-group.tsx +83 -0
- package/lib/__templates__/taro/src/components/ui/button.tsx +67 -0
- package/lib/__templates__/taro/src/components/ui/calendar.tsx +394 -0
- package/lib/__templates__/taro/src/components/ui/card.tsx +108 -0
- package/lib/__templates__/taro/src/components/ui/carousel.tsx +228 -0
- package/lib/__templates__/taro/src/components/ui/checkbox.tsx +58 -0
- package/lib/__templates__/taro/src/components/ui/code-block.tsx +169 -0
- package/lib/__templates__/taro/src/components/ui/collapsible.tsx +71 -0
- package/lib/__templates__/taro/src/components/ui/command.tsx +385 -0
- package/lib/__templates__/taro/src/components/ui/context-menu.tsx +614 -0
- package/lib/__templates__/taro/src/components/ui/dialog.tsx +256 -0
- package/lib/__templates__/taro/src/components/ui/drawer.tsx +192 -0
- package/lib/__templates__/taro/src/components/ui/dropdown-menu.tsx +561 -0
- package/lib/__templates__/taro/src/components/ui/field.tsx +228 -0
- package/lib/__templates__/taro/src/components/ui/hover-card.tsx +282 -0
- package/lib/__templates__/taro/src/components/ui/input-group.tsx +197 -0
- package/lib/__templates__/taro/src/components/ui/input-otp.tsx +136 -0
- package/lib/__templates__/taro/src/components/ui/input.tsx +56 -0
- package/lib/__templates__/taro/src/components/ui/label.tsx +24 -0
- package/lib/__templates__/taro/src/components/ui/menubar.tsx +595 -0
- package/lib/__templates__/taro/src/components/ui/navigation-menu.tsx +264 -0
- package/lib/__templates__/taro/src/components/ui/pagination.tsx +118 -0
- package/lib/__templates__/taro/src/components/ui/popover.tsx +291 -0
- package/lib/__templates__/taro/src/components/ui/portal.tsx +19 -0
- package/lib/__templates__/taro/src/components/ui/progress.tsx +28 -0
- package/lib/__templates__/taro/src/components/ui/radio-group.tsx +64 -0
- package/lib/__templates__/taro/src/components/ui/resizable.tsx +346 -0
- package/lib/__templates__/taro/src/components/ui/scroll-area.tsx +34 -0
- package/lib/__templates__/taro/src/components/ui/select.tsx +438 -0
- package/lib/__templates__/taro/src/components/ui/separator.tsx +30 -0
- package/lib/__templates__/taro/src/components/ui/sheet.tsx +262 -0
- package/lib/__templates__/taro/src/components/ui/skeleton.tsx +17 -0
- package/lib/__templates__/taro/src/components/ui/slider.tsx +203 -0
- package/lib/__templates__/taro/src/components/ui/sonner.tsx +1 -0
- package/lib/__templates__/taro/src/components/ui/switch.tsx +55 -0
- package/lib/__templates__/taro/src/components/ui/table.tsx +142 -0
- package/lib/__templates__/taro/src/components/ui/tabs.tsx +114 -0
- package/lib/__templates__/taro/src/components/ui/textarea.tsx +54 -0
- package/lib/__templates__/taro/src/components/ui/toast.tsx +517 -0
- package/lib/__templates__/taro/src/components/ui/toggle-group.tsx +120 -0
- package/lib/__templates__/taro/src/components/ui/toggle.tsx +77 -0
- package/lib/__templates__/taro/src/components/ui/tooltip.tsx +455 -0
- package/lib/__templates__/taro/src/index.html +39 -0
- package/lib/__templates__/taro/src/lib/hooks/use-keyboard-offset.ts +37 -0
- package/lib/__templates__/taro/src/lib/measure.ts +115 -0
- package/lib/__templates__/taro/src/lib/platform.ts +12 -0
- package/lib/__templates__/taro/src/lib/utils.ts +6 -0
- package/lib/__templates__/taro/src/network.ts +39 -0
- package/lib/__templates__/taro/src/pages/index/index.config.ts +3 -0
- package/lib/__templates__/taro/src/pages/index/index.css +1 -0
- package/lib/__templates__/taro/src/pages/index/index.tsx +33 -0
- package/lib/__templates__/taro/src/presets/dev-debug.ts +23 -0
- package/lib/__templates__/taro/src/presets/h5-container.tsx +15 -0
- package/lib/__templates__/taro/src/presets/h5-navbar.tsx +238 -0
- package/lib/__templates__/taro/src/presets/h5-styles.ts +220 -0
- package/lib/__templates__/taro/src/presets/index.tsx +18 -0
- package/lib/__templates__/taro/stylelint.config.mjs +4 -0
- package/lib/__templates__/taro/template.config.js +68 -0
- package/lib/__templates__/taro/tsconfig.json +29 -0
- package/lib/__templates__/taro/types/global.d.ts +32 -0
- package/lib/__templates__/templates.json +126 -64
- package/lib/__templates__/vite/.coze +4 -3
- package/lib/__templates__/vite/README.md +383 -26
- package/lib/__templates__/vite/_gitignore +1 -0
- package/lib/__templates__/vite/_npmrc +2 -1
- package/lib/__templates__/vite/eslint.config.mjs +14 -0
- package/lib/__templates__/vite/package.json +23 -3
- package/lib/__templates__/vite/pnpm-lock.yaml +2509 -293
- package/lib/__templates__/vite/scripts/build.sh +4 -1
- package/lib/__templates__/vite/scripts/dev.sh +16 -28
- package/lib/__templates__/vite/scripts/prepare.sh +9 -0
- package/lib/__templates__/vite/scripts/start.sh +9 -3
- package/lib/__templates__/vite/server/routes/index.ts +31 -0
- package/lib/__templates__/vite/server/server.ts +65 -0
- package/lib/__templates__/vite/server/vite.ts +67 -0
- package/lib/__templates__/vite/src/main.ts +17 -48
- package/lib/__templates__/vite/template.config.js +82 -10
- package/lib/__templates__/vite/tsconfig.json +4 -3
- package/lib/__templates__/vite/vite.config.ts +8 -3
- package/lib/cli.js +1544 -488
- package/package.json +18 -7
- package/lib/__templates__/expo/.cozeproj/scripts/deploy_build.sh +0 -109
- package/lib/__templates__/expo/.cozeproj/scripts/deploy_run.sh +0 -257
- package/lib/__templates__/expo/app.json +0 -63
- package/lib/__templates__/expo/babel.config.js +0 -9
- package/lib/__templates__/expo/client/app/(tabs)/_layout.tsx +0 -43
- package/lib/__templates__/expo/client/app/(tabs)/home.tsx +0 -1
- package/lib/__templates__/expo/client/app/(tabs)/index.tsx +0 -7
- package/lib/__templates__/expo/client/hooks/useColorScheme.ts +0 -1
- package/lib/__templates__/expo/client/index.js +0 -11
- package/lib/__templates__/expo/client/screens/home/index.tsx +0 -54
- package/lib/__templates__/expo/client/screens/home/styles.ts +0 -332
- package/lib/__templates__/expo/metro.config.js +0 -53
- package/lib/__templates__/expo/src/index.ts +0 -12
- package/lib/__templates__/nextjs/.vscode/settings.json +0 -121
- package/lib/__templates__/react-rsbuild/.coze +0 -11
- package/lib/__templates__/react-rsbuild/.vscode/settings.json +0 -121
- package/lib/__templates__/react-rsbuild/README.md +0 -61
- package/lib/__templates__/react-rsbuild/_gitignore +0 -97
- package/lib/__templates__/react-rsbuild/package.json +0 -31
- package/lib/__templates__/react-rsbuild/pnpm-lock.yaml +0 -997
- package/lib/__templates__/react-rsbuild/rsbuild.config.ts +0 -13
- package/lib/__templates__/react-rsbuild/scripts/dev.sh +0 -51
- package/lib/__templates__/react-rsbuild/scripts/start.sh +0 -15
- package/lib/__templates__/react-rsbuild/src/App.tsx +0 -60
- package/lib/__templates__/react-rsbuild/src/index.css +0 -21
- package/lib/__templates__/react-rsbuild/src/index.html +0 -12
- package/lib/__templates__/react-rsbuild/src/index.tsx +0 -16
- package/lib/__templates__/react-rsbuild/tailwind.config.js +0 -9
- package/lib/__templates__/react-rsbuild/template.config.js +0 -54
- package/lib/__templates__/react-rsbuild/tsconfig.json +0 -17
- package/lib/__templates__/rsbuild/.coze +0 -11
- package/lib/__templates__/rsbuild/.vscode/settings.json +0 -7
- package/lib/__templates__/rsbuild/README.md +0 -61
- package/lib/__templates__/rsbuild/_gitignore +0 -97
- package/lib/__templates__/rsbuild/package.json +0 -24
- package/lib/__templates__/rsbuild/pnpm-lock.yaml +0 -888
- package/lib/__templates__/rsbuild/rsbuild.config.ts +0 -12
- package/lib/__templates__/rsbuild/scripts/dev.sh +0 -51
- package/lib/__templates__/rsbuild/scripts/start.sh +0 -15
- package/lib/__templates__/rsbuild/src/index.html +0 -12
- package/lib/__templates__/rsbuild/src/index.ts +0 -5
- package/lib/__templates__/rsbuild/src/main.ts +0 -65
- package/lib/__templates__/rsbuild/tailwind.config.js +0 -9
- package/lib/__templates__/rsbuild/template.config.js +0 -54
- package/lib/__templates__/rsbuild/tsconfig.json +0 -16
- package/lib/__templates__/vite/.vscode/settings.json +0 -7
- /package/lib/__templates__/expo/{eslint-formatter-simple.mjs → client/eslint-formatter-simple.mjs} +0 -0
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { View } from "@tarojs/components"
|
|
3
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
4
|
+
import { X } from "lucide-react-taro"
|
|
5
|
+
|
|
6
|
+
import { cn } from "@/lib/utils"
|
|
7
|
+
import { Portal } from "@/components/ui/portal"
|
|
8
|
+
|
|
9
|
+
const SheetContext = React.createContext<{
|
|
10
|
+
open?: boolean
|
|
11
|
+
onOpenChange?: (open: boolean) => void
|
|
12
|
+
} | null>(null)
|
|
13
|
+
|
|
14
|
+
const usePresence = (open: boolean | undefined, durationMs: number) => {
|
|
15
|
+
const [present, setPresent] = React.useState(!!open)
|
|
16
|
+
const timeoutRef = React.useRef<ReturnType<typeof setTimeout> | null>(null)
|
|
17
|
+
|
|
18
|
+
React.useEffect(() => {
|
|
19
|
+
if (open) {
|
|
20
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current)
|
|
21
|
+
timeoutRef.current = null
|
|
22
|
+
setPresent(true)
|
|
23
|
+
return
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
timeoutRef.current = setTimeout(() => setPresent(false), durationMs)
|
|
27
|
+
return () => {
|
|
28
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current)
|
|
29
|
+
timeoutRef.current = null
|
|
30
|
+
}
|
|
31
|
+
}, [open, durationMs])
|
|
32
|
+
|
|
33
|
+
return present
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface SheetProps {
|
|
37
|
+
children: React.ReactNode
|
|
38
|
+
open?: boolean
|
|
39
|
+
defaultOpen?: boolean
|
|
40
|
+
onOpenChange?: (open: boolean) => void
|
|
41
|
+
modal?: boolean
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const Sheet = ({ children, open: openProp, defaultOpen, onOpenChange }: SheetProps) => {
|
|
45
|
+
const [openState, setOpenState] = React.useState(defaultOpen || false)
|
|
46
|
+
const open = openProp !== undefined ? openProp : openState
|
|
47
|
+
|
|
48
|
+
const handleOpenChange = (newOpen: boolean) => {
|
|
49
|
+
if (openProp === undefined) {
|
|
50
|
+
setOpenState(newOpen)
|
|
51
|
+
}
|
|
52
|
+
onOpenChange?.(newOpen)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<SheetContext.Provider value={{ open, onOpenChange: handleOpenChange }}>
|
|
57
|
+
{children}
|
|
58
|
+
</SheetContext.Provider>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const SheetTrigger = React.forwardRef<
|
|
63
|
+
React.ElementRef<typeof View>,
|
|
64
|
+
React.ComponentPropsWithoutRef<typeof View> & { asChild?: boolean }
|
|
65
|
+
>(({ className, children, asChild, ...props }, ref) => {
|
|
66
|
+
const context = React.useContext(SheetContext)
|
|
67
|
+
return (
|
|
68
|
+
<View
|
|
69
|
+
ref={ref}
|
|
70
|
+
className={cn("w-fit", className)}
|
|
71
|
+
onClick={(e) => {
|
|
72
|
+
e.stopPropagation()
|
|
73
|
+
context?.onOpenChange?.(true)
|
|
74
|
+
}}
|
|
75
|
+
{...props}
|
|
76
|
+
>
|
|
77
|
+
{children}
|
|
78
|
+
</View>
|
|
79
|
+
)
|
|
80
|
+
})
|
|
81
|
+
SheetTrigger.displayName = "SheetTrigger"
|
|
82
|
+
|
|
83
|
+
const SheetClose = React.forwardRef<
|
|
84
|
+
React.ElementRef<typeof View>,
|
|
85
|
+
React.ComponentPropsWithoutRef<typeof View> & { asChild?: boolean }
|
|
86
|
+
>(({ className, children, asChild, ...props }, ref) => {
|
|
87
|
+
const context = React.useContext(SheetContext)
|
|
88
|
+
return (
|
|
89
|
+
<View
|
|
90
|
+
ref={ref}
|
|
91
|
+
className={className}
|
|
92
|
+
onClick={(e) => {
|
|
93
|
+
e.stopPropagation()
|
|
94
|
+
context?.onOpenChange?.(false)
|
|
95
|
+
}}
|
|
96
|
+
{...props}
|
|
97
|
+
>
|
|
98
|
+
{children}
|
|
99
|
+
</View>
|
|
100
|
+
)
|
|
101
|
+
})
|
|
102
|
+
SheetClose.displayName = "SheetClose"
|
|
103
|
+
|
|
104
|
+
const SheetPortal = ({ children }: { children: React.ReactNode }) => {
|
|
105
|
+
const context = React.useContext(SheetContext)
|
|
106
|
+
const present = usePresence(context?.open, 300)
|
|
107
|
+
if (!present) return null
|
|
108
|
+
return <Portal>{children}</Portal>
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const SheetOverlay = React.forwardRef<
|
|
112
|
+
React.ElementRef<typeof View>,
|
|
113
|
+
React.ComponentPropsWithoutRef<typeof View>
|
|
114
|
+
>(({ className, onClick, ...props }, ref) => {
|
|
115
|
+
const context = React.useContext(SheetContext)
|
|
116
|
+
const state = context?.open ? "open" : "closed"
|
|
117
|
+
return (
|
|
118
|
+
<View
|
|
119
|
+
data-state={state}
|
|
120
|
+
className={cn(
|
|
121
|
+
"fixed inset-0 isolate z-50 bg-black bg-opacity-10 transition-opacity duration-100 supports-[backdrop-filter]:backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
122
|
+
className
|
|
123
|
+
)}
|
|
124
|
+
{...props}
|
|
125
|
+
ref={ref}
|
|
126
|
+
onClick={(e) => {
|
|
127
|
+
e.stopPropagation()
|
|
128
|
+
onClick?.(e)
|
|
129
|
+
context?.onOpenChange?.(false)
|
|
130
|
+
}}
|
|
131
|
+
/>
|
|
132
|
+
)
|
|
133
|
+
})
|
|
134
|
+
SheetOverlay.displayName = "SheetOverlay"
|
|
135
|
+
|
|
136
|
+
const sheetVariants = cva(
|
|
137
|
+
"fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
|
|
138
|
+
{
|
|
139
|
+
variants: {
|
|
140
|
+
side: {
|
|
141
|
+
top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
|
|
142
|
+
bottom:
|
|
143
|
+
"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
|
|
144
|
+
left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
|
|
145
|
+
right:
|
|
146
|
+
"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
defaultVariants: {
|
|
150
|
+
side: "right",
|
|
151
|
+
},
|
|
152
|
+
}
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
interface SheetContentProps
|
|
156
|
+
extends React.ComponentPropsWithoutRef<typeof View>,
|
|
157
|
+
VariantProps<typeof sheetVariants> {}
|
|
158
|
+
|
|
159
|
+
const SheetContent = React.forwardRef<
|
|
160
|
+
React.ElementRef<typeof View>,
|
|
161
|
+
SheetContentProps
|
|
162
|
+
>(({ side = "right", className, children, ...props }, ref) => {
|
|
163
|
+
const context = React.useContext(SheetContext)
|
|
164
|
+
const state = context?.open ? "open" : "closed"
|
|
165
|
+
return (
|
|
166
|
+
<SheetPortal>
|
|
167
|
+
<View
|
|
168
|
+
className="fixed inset-0 z-50"
|
|
169
|
+
onClick={() => context?.onOpenChange?.(false)}
|
|
170
|
+
>
|
|
171
|
+
<SheetOverlay />
|
|
172
|
+
<View
|
|
173
|
+
ref={ref}
|
|
174
|
+
className={cn(sheetVariants({ side }), "sheet-content", className)}
|
|
175
|
+
data-state={state}
|
|
176
|
+
data-side={side}
|
|
177
|
+
onClick={(e) => e.stopPropagation()}
|
|
178
|
+
{...props}
|
|
179
|
+
>
|
|
180
|
+
{children}
|
|
181
|
+
<View
|
|
182
|
+
className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary"
|
|
183
|
+
data-state={state}
|
|
184
|
+
onClick={(e) => {
|
|
185
|
+
e.stopPropagation()
|
|
186
|
+
context?.onOpenChange?.(false)
|
|
187
|
+
}}
|
|
188
|
+
>
|
|
189
|
+
<X size={16} />
|
|
190
|
+
<View className="sr-only">Close</View>
|
|
191
|
+
</View>
|
|
192
|
+
</View>
|
|
193
|
+
</View>
|
|
194
|
+
</SheetPortal>
|
|
195
|
+
)
|
|
196
|
+
})
|
|
197
|
+
SheetContent.displayName = "SheetContent"
|
|
198
|
+
|
|
199
|
+
const SheetHeader = ({
|
|
200
|
+
className,
|
|
201
|
+
...props
|
|
202
|
+
}: React.ComponentPropsWithoutRef<typeof View>) => (
|
|
203
|
+
<View
|
|
204
|
+
className={cn(
|
|
205
|
+
"flex flex-col space-y-2 text-center sm:text-left",
|
|
206
|
+
className
|
|
207
|
+
)}
|
|
208
|
+
{...props}
|
|
209
|
+
/>
|
|
210
|
+
)
|
|
211
|
+
SheetHeader.displayName = "SheetHeader"
|
|
212
|
+
|
|
213
|
+
const SheetFooter = ({
|
|
214
|
+
className,
|
|
215
|
+
...props
|
|
216
|
+
}: React.ComponentPropsWithoutRef<typeof View>) => (
|
|
217
|
+
<View
|
|
218
|
+
className={cn(
|
|
219
|
+
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
220
|
+
className
|
|
221
|
+
)}
|
|
222
|
+
{...props}
|
|
223
|
+
/>
|
|
224
|
+
)
|
|
225
|
+
SheetFooter.displayName = "SheetFooter"
|
|
226
|
+
|
|
227
|
+
const SheetTitle = React.forwardRef<
|
|
228
|
+
React.ElementRef<typeof View>,
|
|
229
|
+
React.ComponentPropsWithoutRef<typeof View>
|
|
230
|
+
>(({ className, ...props }, ref) => (
|
|
231
|
+
<View
|
|
232
|
+
ref={ref}
|
|
233
|
+
className={cn("text-lg font-semibold text-foreground", className)}
|
|
234
|
+
{...props}
|
|
235
|
+
/>
|
|
236
|
+
))
|
|
237
|
+
SheetTitle.displayName = "SheetTitle"
|
|
238
|
+
|
|
239
|
+
const SheetDescription = React.forwardRef<
|
|
240
|
+
React.ElementRef<typeof View>,
|
|
241
|
+
React.ComponentPropsWithoutRef<typeof View>
|
|
242
|
+
>(({ className, ...props }, ref) => (
|
|
243
|
+
<View
|
|
244
|
+
ref={ref}
|
|
245
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
246
|
+
{...props}
|
|
247
|
+
/>
|
|
248
|
+
))
|
|
249
|
+
SheetDescription.displayName = "SheetDescription"
|
|
250
|
+
|
|
251
|
+
export {
|
|
252
|
+
Sheet,
|
|
253
|
+
SheetPortal,
|
|
254
|
+
SheetOverlay,
|
|
255
|
+
SheetTrigger,
|
|
256
|
+
SheetClose,
|
|
257
|
+
SheetContent,
|
|
258
|
+
SheetHeader,
|
|
259
|
+
SheetFooter,
|
|
260
|
+
SheetTitle,
|
|
261
|
+
SheetDescription,
|
|
262
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { View } from "@tarojs/components"
|
|
2
|
+
|
|
3
|
+
import { cn } from "@/lib/utils"
|
|
4
|
+
|
|
5
|
+
function Skeleton({
|
|
6
|
+
className,
|
|
7
|
+
...props
|
|
8
|
+
}: React.ComponentPropsWithoutRef<typeof View>) {
|
|
9
|
+
return (
|
|
10
|
+
<View
|
|
11
|
+
className={cn("animate-pulse rounded-md bg-muted", className)}
|
|
12
|
+
{...props}
|
|
13
|
+
/>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { Skeleton }
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { View } from "@tarojs/components"
|
|
3
|
+
import Taro from "@tarojs/taro"
|
|
4
|
+
|
|
5
|
+
import { cn } from "@/lib/utils"
|
|
6
|
+
|
|
7
|
+
const Slider = React.forwardRef<
|
|
8
|
+
React.ElementRef<typeof View>,
|
|
9
|
+
Omit<React.ComponentPropsWithoutRef<typeof View>, "value" | "onChange"> & {
|
|
10
|
+
value?: number[]
|
|
11
|
+
defaultValue?: number[]
|
|
12
|
+
min?: number
|
|
13
|
+
max?: number
|
|
14
|
+
step?: number
|
|
15
|
+
onValueChange?: (value: number[]) => void
|
|
16
|
+
disabled?: boolean
|
|
17
|
+
orientation?: "horizontal" | "vertical"
|
|
18
|
+
trackClassName?: string
|
|
19
|
+
rangeClassName?: string
|
|
20
|
+
thumbClassName?: string
|
|
21
|
+
}
|
|
22
|
+
>(({ className, trackClassName, rangeClassName, thumbClassName, value: valueProp, defaultValue, min = 0, max = 100, step = 1, onValueChange, disabled, orientation = "horizontal", ...props }, ref) => {
|
|
23
|
+
const [localValue, setLocalValue] = React.useState<number[]>(
|
|
24
|
+
valueProp || defaultValue || [min]
|
|
25
|
+
)
|
|
26
|
+
const [isDragging, setIsDragging] = React.useState(false)
|
|
27
|
+
const [rect, setRect] = React.useState<{ left: number; top: number; width: number; height: number } | null>(null)
|
|
28
|
+
const rectRef = React.useRef<{ left: number; top: number; width: number; height: number } | null>(null)
|
|
29
|
+
const idRef = React.useRef(`slider-${Math.random().toString(36).substr(2, 9)}`)
|
|
30
|
+
|
|
31
|
+
const value = valueProp !== undefined ? valueProp : localValue
|
|
32
|
+
const currentValue = value[0] ?? min
|
|
33
|
+
|
|
34
|
+
React.useEffect(() => {
|
|
35
|
+
rectRef.current = rect
|
|
36
|
+
}, [rect])
|
|
37
|
+
|
|
38
|
+
React.useEffect(() => {
|
|
39
|
+
// Delay measurement to ensure the component is mounted and layout is ready
|
|
40
|
+
const timer = setTimeout(() => {
|
|
41
|
+
const query = Taro.createSelectorQuery()
|
|
42
|
+
query
|
|
43
|
+
.select(`#${idRef.current}`)
|
|
44
|
+
.boundingClientRect((res) => {
|
|
45
|
+
const measuredRect = Array.isArray(res) ? res[0] : res
|
|
46
|
+
if (measuredRect) {
|
|
47
|
+
setRect({ left: measuredRect.left, top: measuredRect.top, width: measuredRect.width, height: measuredRect.height })
|
|
48
|
+
rectRef.current = { left: measuredRect.left, top: measuredRect.top, width: measuredRect.width, height: measuredRect.height }
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
.exec()
|
|
52
|
+
}, 100)
|
|
53
|
+
return () => clearTimeout(timer)
|
|
54
|
+
}, [])
|
|
55
|
+
|
|
56
|
+
const updateValue = (pageX: number, pageY: number, passedRect?: { left: number; top: number; width: number; height: number } | null) => {
|
|
57
|
+
const currentRect = passedRect || rectRef.current
|
|
58
|
+
if (!currentRect || disabled) return
|
|
59
|
+
|
|
60
|
+
let percentage = 0
|
|
61
|
+
if (orientation === "horizontal") {
|
|
62
|
+
const { left, width } = currentRect
|
|
63
|
+
percentage = Math.min(Math.max((pageX - left) / width, 0), 1)
|
|
64
|
+
} else {
|
|
65
|
+
const { top, height } = currentRect
|
|
66
|
+
percentage = Math.min(Math.max(1 - (pageY - top) / height, 0), 1)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const rawValue = min + percentage * (max - min)
|
|
70
|
+
const steppedValue = Math.round((rawValue - min) / step) * step + min
|
|
71
|
+
const newValue = Math.min(Math.max(steppedValue, min), max)
|
|
72
|
+
|
|
73
|
+
if (newValue !== currentValue) {
|
|
74
|
+
const nextValue = [newValue]
|
|
75
|
+
if (valueProp === undefined) {
|
|
76
|
+
setLocalValue(nextValue)
|
|
77
|
+
}
|
|
78
|
+
onValueChange?.(nextValue)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const handleTouchStart = (e: any) => {
|
|
83
|
+
if (disabled) return
|
|
84
|
+
setIsDragging(true)
|
|
85
|
+
// Try to update rect on touch start in case of layout changes
|
|
86
|
+
const query = Taro.createSelectorQuery()
|
|
87
|
+
query
|
|
88
|
+
.select(`#${idRef.current}`)
|
|
89
|
+
.boundingClientRect((res) => {
|
|
90
|
+
const measuredRect = Array.isArray(res) ? res[0] : res
|
|
91
|
+
if (measuredRect) {
|
|
92
|
+
setRect({ left: measuredRect.left, top: measuredRect.top, width: measuredRect.width, height: measuredRect.height })
|
|
93
|
+
rectRef.current = { left: measuredRect.left, top: measuredRect.top, width: measuredRect.width, height: measuredRect.height }
|
|
94
|
+
// If we have a touch event, update value immediately after getting fresh rect
|
|
95
|
+
const touch = e.touches[0] || e.changedTouches[0]
|
|
96
|
+
if (touch) {
|
|
97
|
+
updateValue(touch.pageX, touch.pageY, rectRef.current)
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
.exec()
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const handleMouseDown = (e: React.MouseEvent) => {
|
|
105
|
+
if (disabled) return
|
|
106
|
+
setIsDragging(true)
|
|
107
|
+
|
|
108
|
+
const query = Taro.createSelectorQuery()
|
|
109
|
+
query
|
|
110
|
+
.select(`#${idRef.current}`)
|
|
111
|
+
.boundingClientRect((res) => {
|
|
112
|
+
const measuredRect = Array.isArray(res) ? res[0] : res
|
|
113
|
+
if (measuredRect) {
|
|
114
|
+
setRect({ left: measuredRect.left, top: measuredRect.top, width: measuredRect.width, height: measuredRect.height })
|
|
115
|
+
rectRef.current = { left: measuredRect.left, top: measuredRect.top, width: measuredRect.width, height: measuredRect.height }
|
|
116
|
+
updateValue(e.pageX, e.pageY, rectRef.current)
|
|
117
|
+
}
|
|
118
|
+
})
|
|
119
|
+
.exec()
|
|
120
|
+
|
|
121
|
+
const onMouseMove = (moveEvent: MouseEvent) => {
|
|
122
|
+
updateValue(moveEvent.pageX, moveEvent.pageY)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const onMouseUp = (upEvent: MouseEvent) => {
|
|
126
|
+
setIsDragging(false)
|
|
127
|
+
updateValue(upEvent.pageX, upEvent.pageY)
|
|
128
|
+
document.removeEventListener('mousemove', onMouseMove)
|
|
129
|
+
document.removeEventListener('mouseup', onMouseUp)
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (typeof document !== 'undefined') {
|
|
133
|
+
document.addEventListener('mousemove', onMouseMove)
|
|
134
|
+
document.addEventListener('mouseup', onMouseUp)
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const handleTouchMove = (e: any) => {
|
|
139
|
+
if (disabled) return
|
|
140
|
+
const touch = e.touches[0] || e.changedTouches[0]
|
|
141
|
+
if (touch) {
|
|
142
|
+
updateValue(touch.pageX, touch.pageY)
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const handleTouchEnd = (e: any) => {
|
|
147
|
+
if (disabled) return
|
|
148
|
+
setIsDragging(false)
|
|
149
|
+
const touch = e.touches[0] || e.changedTouches[0]
|
|
150
|
+
if (touch) {
|
|
151
|
+
updateValue(touch.pageX, touch.pageY)
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const percentage = ((currentValue - min) / (max - min)) * 100
|
|
156
|
+
|
|
157
|
+
return (
|
|
158
|
+
<View
|
|
159
|
+
ref={ref}
|
|
160
|
+
id={idRef.current}
|
|
161
|
+
className={cn(
|
|
162
|
+
"relative flex touch-none select-none items-center",
|
|
163
|
+
orientation === "horizontal" ? "w-full py-4" : "h-full flex-col px-4",
|
|
164
|
+
className
|
|
165
|
+
)}
|
|
166
|
+
onTouchStart={handleTouchStart}
|
|
167
|
+
onTouchMove={handleTouchMove}
|
|
168
|
+
onTouchEnd={handleTouchEnd}
|
|
169
|
+
// @ts-ignore
|
|
170
|
+
onMouseDown={handleMouseDown}
|
|
171
|
+
{...props}
|
|
172
|
+
>
|
|
173
|
+
<View
|
|
174
|
+
className={cn(
|
|
175
|
+
"relative grow overflow-hidden rounded-full bg-secondary",
|
|
176
|
+
orientation === "horizontal" ? "h-1 w-full" : "w-1 h-full",
|
|
177
|
+
trackClassName
|
|
178
|
+
)}
|
|
179
|
+
>
|
|
180
|
+
<View
|
|
181
|
+
className={cn("absolute bg-primary", orientation === "horizontal" ? "h-full" : "w-full bottom-0", rangeClassName)}
|
|
182
|
+
style={orientation === "horizontal" ? { width: `${percentage}%` } : { height: `${percentage}%` }}
|
|
183
|
+
/>
|
|
184
|
+
</View>
|
|
185
|
+
<View
|
|
186
|
+
className={cn(
|
|
187
|
+
"absolute block h-3 w-3 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors disabled:pointer-events-none disabled:opacity-50",
|
|
188
|
+
isDragging && "ring-4 ring-primary ring-opacity-30",
|
|
189
|
+
disabled && "opacity-50",
|
|
190
|
+
thumbClassName
|
|
191
|
+
)}
|
|
192
|
+
style={
|
|
193
|
+
orientation === "horizontal"
|
|
194
|
+
? { left: `${percentage}%`, transform: 'translateX(-50%)' }
|
|
195
|
+
: { bottom: `${percentage}%`, transform: 'translateY(50%)' }
|
|
196
|
+
}
|
|
197
|
+
/>
|
|
198
|
+
</View>
|
|
199
|
+
)
|
|
200
|
+
})
|
|
201
|
+
Slider.displayName = "Slider"
|
|
202
|
+
|
|
203
|
+
export { Slider }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./toast"
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { View } from "@tarojs/components"
|
|
3
|
+
import { cn } from "@/lib/utils"
|
|
4
|
+
|
|
5
|
+
const Switch = React.forwardRef<
|
|
6
|
+
React.ElementRef<typeof View>,
|
|
7
|
+
React.ComponentPropsWithoutRef<typeof View> & {
|
|
8
|
+
checked?: boolean
|
|
9
|
+
defaultChecked?: boolean
|
|
10
|
+
onCheckedChange?: (checked: boolean) => void
|
|
11
|
+
disabled?: boolean
|
|
12
|
+
}
|
|
13
|
+
>(({ className, checked, defaultChecked, onCheckedChange, disabled, ...props }, ref) => {
|
|
14
|
+
const [localChecked, setLocalChecked] = React.useState(defaultChecked || false)
|
|
15
|
+
const isControlled = checked !== undefined
|
|
16
|
+
const currentChecked = isControlled ? checked : localChecked
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<View
|
|
20
|
+
className={cn(
|
|
21
|
+
"inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background [-webkit-tap-highlight-color:transparent]",
|
|
22
|
+
disabled && "cursor-not-allowed opacity-50",
|
|
23
|
+
currentChecked ? "bg-primary" : "bg-input",
|
|
24
|
+
className
|
|
25
|
+
)}
|
|
26
|
+
data-state={currentChecked ? "checked" : "unchecked"}
|
|
27
|
+
hoverClass={
|
|
28
|
+
disabled
|
|
29
|
+
? undefined
|
|
30
|
+
: "border-ring ring-2 ring-ring ring-offset-2 ring-offset-background"
|
|
31
|
+
}
|
|
32
|
+
{...props}
|
|
33
|
+
ref={ref}
|
|
34
|
+
onClick={(e) => {
|
|
35
|
+
if (disabled) return
|
|
36
|
+
e.stopPropagation()
|
|
37
|
+
const newChecked = !currentChecked
|
|
38
|
+
if (!isControlled) {
|
|
39
|
+
setLocalChecked(newChecked)
|
|
40
|
+
}
|
|
41
|
+
onCheckedChange?.(newChecked)
|
|
42
|
+
}}
|
|
43
|
+
>
|
|
44
|
+
<View
|
|
45
|
+
className={cn(
|
|
46
|
+
"pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform",
|
|
47
|
+
currentChecked ? "translate-x-5" : "translate-x-0"
|
|
48
|
+
)}
|
|
49
|
+
/>
|
|
50
|
+
</View>
|
|
51
|
+
)
|
|
52
|
+
})
|
|
53
|
+
Switch.displayName = "Switch"
|
|
54
|
+
|
|
55
|
+
export { Switch }
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { View } from "@tarojs/components"
|
|
3
|
+
|
|
4
|
+
import { cn } from "@/lib/utils"
|
|
5
|
+
|
|
6
|
+
const Table = React.forwardRef<
|
|
7
|
+
React.ElementRef<typeof View>,
|
|
8
|
+
React.ComponentPropsWithoutRef<typeof View>
|
|
9
|
+
>(({ className, ...props }, ref) => (
|
|
10
|
+
<View className="relative w-full overflow-auto">
|
|
11
|
+
<View
|
|
12
|
+
ref={ref}
|
|
13
|
+
className={cn("w-full caption-bottom text-sm", className)}
|
|
14
|
+
{...props}
|
|
15
|
+
/>
|
|
16
|
+
</View>
|
|
17
|
+
))
|
|
18
|
+
Table.displayName = "Table"
|
|
19
|
+
|
|
20
|
+
const TableHeader = React.forwardRef<
|
|
21
|
+
React.ElementRef<typeof View>,
|
|
22
|
+
React.ComponentPropsWithoutRef<typeof View>
|
|
23
|
+
>(({ className, ...props }, ref) => (
|
|
24
|
+
<View ref={ref} className={cn("[&>view]:border-b", className)} {...props} />
|
|
25
|
+
))
|
|
26
|
+
TableHeader.displayName = "TableHeader"
|
|
27
|
+
|
|
28
|
+
const TableBody = React.forwardRef<
|
|
29
|
+
React.ElementRef<typeof View>,
|
|
30
|
+
React.ComponentPropsWithoutRef<typeof View>
|
|
31
|
+
>(({ className, ...props }, ref) => (
|
|
32
|
+
<View
|
|
33
|
+
ref={ref}
|
|
34
|
+
className={cn("[&>view:last-child]:border-b-0", className)}
|
|
35
|
+
{...props}
|
|
36
|
+
/>
|
|
37
|
+
))
|
|
38
|
+
TableBody.displayName = "TableBody"
|
|
39
|
+
|
|
40
|
+
const TableFooter = React.forwardRef<
|
|
41
|
+
React.ElementRef<typeof View>,
|
|
42
|
+
React.ComponentPropsWithoutRef<typeof View>
|
|
43
|
+
>(({ className, ...props }, ref) => (
|
|
44
|
+
<View
|
|
45
|
+
ref={ref}
|
|
46
|
+
className={cn(
|
|
47
|
+
"border-t bg-muted bg-opacity-50 font-medium [&>view:last-child]:border-b-0",
|
|
48
|
+
className
|
|
49
|
+
)}
|
|
50
|
+
{...props}
|
|
51
|
+
/>
|
|
52
|
+
))
|
|
53
|
+
TableFooter.displayName = "TableFooter"
|
|
54
|
+
|
|
55
|
+
const TableRow = React.forwardRef<
|
|
56
|
+
React.ElementRef<typeof View>,
|
|
57
|
+
React.ComponentPropsWithoutRef<typeof View>
|
|
58
|
+
>(({ className, ...props }, ref) => (
|
|
59
|
+
<View
|
|
60
|
+
ref={ref}
|
|
61
|
+
className={cn(
|
|
62
|
+
"border-b transition-colors hover:bg-muted hover:bg-opacity-50 data-[state=selected]:bg-muted flex flex-row",
|
|
63
|
+
className
|
|
64
|
+
)}
|
|
65
|
+
{...props}
|
|
66
|
+
/>
|
|
67
|
+
))
|
|
68
|
+
TableRow.displayName = "TableRow"
|
|
69
|
+
|
|
70
|
+
const TableHead = React.forwardRef<
|
|
71
|
+
React.ElementRef<typeof View>,
|
|
72
|
+
React.ComponentPropsWithoutRef<typeof View>
|
|
73
|
+
>(({ className, ...props }, ref) => (
|
|
74
|
+
<View
|
|
75
|
+
ref={ref}
|
|
76
|
+
className={cn(
|
|
77
|
+
"h-12 px-4 text-left align-middle font-medium text-muted-foreground flex flex-1 basis-0 min-w-0 items-center justify-start",
|
|
78
|
+
typeof className === "string" && /(^|\s)text-right(\s|$)/.test(className)
|
|
79
|
+
? "justify-end"
|
|
80
|
+
: null,
|
|
81
|
+
typeof className === "string" && /(^|\s)w-/.test(className)
|
|
82
|
+
? "flex-none basis-auto"
|
|
83
|
+
: null,
|
|
84
|
+
className
|
|
85
|
+
)}
|
|
86
|
+
{...props}
|
|
87
|
+
/>
|
|
88
|
+
))
|
|
89
|
+
TableHead.displayName = "TableHead"
|
|
90
|
+
|
|
91
|
+
const TableCell = React.forwardRef<
|
|
92
|
+
React.ElementRef<typeof View>,
|
|
93
|
+
React.ComponentPropsWithoutRef<typeof View> & { colSpan?: number }
|
|
94
|
+
>(({ className, colSpan, style, ...props }, ref) => (
|
|
95
|
+
<View
|
|
96
|
+
ref={ref}
|
|
97
|
+
style={
|
|
98
|
+
colSpan != null &&
|
|
99
|
+
typeof style === "object" &&
|
|
100
|
+
style != null &&
|
|
101
|
+
!Array.isArray(style) &&
|
|
102
|
+
!(typeof className === "string" && /(^|\s)w-/.test(className))
|
|
103
|
+
? { ...(style as React.CSSProperties), flexGrow: colSpan }
|
|
104
|
+
: style
|
|
105
|
+
}
|
|
106
|
+
className={cn(
|
|
107
|
+
"p-4 align-middle flex flex-1 basis-0 min-w-0 items-center justify-start",
|
|
108
|
+
typeof className === "string" && /(^|\s)text-right(\s|$)/.test(className)
|
|
109
|
+
? "justify-end"
|
|
110
|
+
: null,
|
|
111
|
+
typeof className === "string" && /(^|\s)w-/.test(className)
|
|
112
|
+
? "flex-none basis-auto"
|
|
113
|
+
: null,
|
|
114
|
+
className
|
|
115
|
+
)}
|
|
116
|
+
{...props}
|
|
117
|
+
/>
|
|
118
|
+
))
|
|
119
|
+
TableCell.displayName = "TableCell"
|
|
120
|
+
|
|
121
|
+
const TableCaption = React.forwardRef<
|
|
122
|
+
React.ElementRef<typeof View>,
|
|
123
|
+
React.ComponentPropsWithoutRef<typeof View>
|
|
124
|
+
>(({ className, ...props }, ref) => (
|
|
125
|
+
<View
|
|
126
|
+
ref={ref}
|
|
127
|
+
className={cn("mt-4 text-sm text-muted-foreground", className)}
|
|
128
|
+
{...props}
|
|
129
|
+
/>
|
|
130
|
+
))
|
|
131
|
+
TableCaption.displayName = "TableCaption"
|
|
132
|
+
|
|
133
|
+
export {
|
|
134
|
+
Table,
|
|
135
|
+
TableHeader,
|
|
136
|
+
TableBody,
|
|
137
|
+
TableFooter,
|
|
138
|
+
TableHead,
|
|
139
|
+
TableRow,
|
|
140
|
+
TableCell,
|
|
141
|
+
TableCaption,
|
|
142
|
+
}
|