@coze-arch/cli 0.0.1-alpha.de5a13 → 0.0.1-alpha.deaedf

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 (143) hide show
  1. package/README.md +1 -0
  2. package/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +1 -1
  3. package/lib/__templates__/expo/client/components/Screen.tsx +2 -2
  4. package/lib/__templates__/expo/client/eslint.config.mjs +7 -0
  5. package/lib/__templates__/expo/client/metro.config.js +3 -0
  6. package/lib/__templates__/expo/client/scripts/install-missing-deps.js +10 -10
  7. package/lib/__templates__/expo/eslint-plugins/forbid-emoji/index.js +9 -0
  8. package/lib/__templates__/expo/eslint-plugins/forbid-emoji/rule.js +112 -0
  9. package/lib/__templates__/expo/eslint-plugins/forbid-emoji/tech.md +94 -0
  10. package/lib/__templates__/expo/eslint-plugins/restrict-linear-gradient/index.js +9 -0
  11. package/lib/__templates__/expo/eslint-plugins/restrict-linear-gradient/rule.js +120 -0
  12. package/lib/__templates__/expo/eslint-plugins/restrict-linear-gradient/tech.md +58 -0
  13. package/lib/__templates__/expo/pnpm-lock.yaml +8 -5
  14. package/lib/__templates__/expo/server/package.json +1 -1
  15. package/lib/__templates__/native-static/.coze +11 -0
  16. package/lib/__templates__/native-static/index.html +33 -0
  17. package/lib/__templates__/native-static/styles/main.css +136 -0
  18. package/lib/__templates__/native-static/template.config.js +22 -0
  19. package/lib/__templates__/nextjs/.babelrc +3 -0
  20. package/lib/__templates__/nextjs/README.md +5 -0
  21. package/lib/__templates__/nextjs/eslint.config.mjs +5 -0
  22. package/lib/__templates__/nextjs/next.config.ts +1 -2
  23. package/lib/__templates__/nextjs/package.json +3 -6
  24. package/lib/__templates__/nextjs/pnpm-lock.yaml +1036 -10
  25. package/lib/__templates__/nextjs/scripts/build.sh +4 -1
  26. package/lib/__templates__/nextjs/scripts/dev.sh +8 -2
  27. package/lib/__templates__/nextjs/scripts/start.sh +7 -1
  28. package/lib/__templates__/nextjs/src/app/layout.tsx +1 -1
  29. package/lib/__templates__/nextjs/src/app/page.tsx +1 -2
  30. package/lib/__templates__/nextjs/src/server.ts +35 -0
  31. package/lib/__templates__/nextjs/tsconfig.json +1 -1
  32. package/lib/__templates__/nuxt-vue/.coze +12 -0
  33. package/lib/__templates__/nuxt-vue/README.md +73 -0
  34. package/lib/__templates__/nuxt-vue/_gitignore +24 -0
  35. package/lib/__templates__/nuxt-vue/_npmrc +23 -0
  36. package/lib/__templates__/nuxt-vue/app/app.vue +6 -0
  37. package/lib/__templates__/nuxt-vue/app/pages/index.vue +23 -0
  38. package/lib/__templates__/nuxt-vue/assets/css/main.css +24 -0
  39. package/lib/__templates__/nuxt-vue/nuxt.config.ts +116 -0
  40. package/lib/__templates__/nuxt-vue/package.json +35 -0
  41. package/lib/__templates__/nuxt-vue/pnpm-lock.yaml +8759 -0
  42. package/lib/__templates__/nuxt-vue/postcss.config.mjs +8 -0
  43. package/lib/__templates__/nuxt-vue/public/favicon.ico +0 -0
  44. package/lib/__templates__/nuxt-vue/public/robots.txt +2 -0
  45. package/lib/__templates__/nuxt-vue/scripts/build.sh +14 -0
  46. package/lib/__templates__/nuxt-vue/scripts/dev.sh +39 -0
  47. package/lib/__templates__/nuxt-vue/scripts/prepare.sh +14 -0
  48. package/lib/__templates__/nuxt-vue/scripts/start.sh +21 -0
  49. package/lib/__templates__/nuxt-vue/server/api/hello.ts +10 -0
  50. package/lib/__templates__/nuxt-vue/server/middleware/logger.ts +10 -0
  51. package/lib/__templates__/nuxt-vue/server/routes/health.ts +10 -0
  52. package/lib/__templates__/nuxt-vue/tailwind.config.js +13 -0
  53. package/lib/__templates__/nuxt-vue/template.config.js +87 -0
  54. package/lib/__templates__/nuxt-vue/tsconfig.json +18 -0
  55. package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +107 -37
  56. package/lib/__templates__/taro/.cozeproj/scripts/pack.sh +24 -1
  57. package/lib/__templates__/taro/README.md +138 -62
  58. package/lib/__templates__/taro/config/index.ts +105 -41
  59. package/lib/__templates__/taro/config/prod.ts +4 -5
  60. package/lib/__templates__/taro/eslint.config.mjs +82 -4
  61. package/lib/__templates__/taro/package.json +23 -7
  62. package/lib/__templates__/taro/patches/@tarojs__plugin-mini-ci@4.1.9.patch +30 -0
  63. package/lib/__templates__/taro/pnpm-lock.yaml +1198 -214
  64. package/lib/__templates__/taro/server/package.json +3 -1
  65. package/lib/__templates__/taro/src/app.css +140 -47
  66. package/lib/__templates__/taro/src/app.tsx +9 -0
  67. package/lib/__templates__/taro/src/components/ui/accordion.tsx +159 -0
  68. package/lib/__templates__/taro/src/components/ui/alert-dialog.tsx +260 -0
  69. package/lib/__templates__/taro/src/components/ui/alert.tsx +60 -0
  70. package/lib/__templates__/taro/src/components/ui/aspect-ratio.tsx +36 -0
  71. package/lib/__templates__/taro/src/components/ui/avatar.tsx +84 -0
  72. package/lib/__templates__/taro/src/components/ui/badge.tsx +37 -0
  73. package/lib/__templates__/taro/src/components/ui/breadcrumb.tsx +117 -0
  74. package/lib/__templates__/taro/src/components/ui/button-group.tsx +83 -0
  75. package/lib/__templates__/taro/src/components/ui/button.tsx +67 -0
  76. package/lib/__templates__/taro/src/components/ui/calendar.tsx +394 -0
  77. package/lib/__templates__/taro/src/components/ui/card.tsx +108 -0
  78. package/lib/__templates__/taro/src/components/ui/carousel.tsx +228 -0
  79. package/lib/__templates__/taro/src/components/ui/checkbox.tsx +58 -0
  80. package/lib/__templates__/taro/src/components/ui/code-block.tsx +169 -0
  81. package/lib/__templates__/taro/src/components/ui/collapsible.tsx +71 -0
  82. package/lib/__templates__/taro/src/components/ui/command.tsx +385 -0
  83. package/lib/__templates__/taro/src/components/ui/context-menu.tsx +614 -0
  84. package/lib/__templates__/taro/src/components/ui/dialog.tsx +256 -0
  85. package/lib/__templates__/taro/src/components/ui/drawer.tsx +192 -0
  86. package/lib/__templates__/taro/src/components/ui/dropdown-menu.tsx +561 -0
  87. package/lib/__templates__/taro/src/components/ui/field.tsx +228 -0
  88. package/lib/__templates__/taro/src/components/ui/hover-card.tsx +282 -0
  89. package/lib/__templates__/taro/src/components/ui/input-group.tsx +197 -0
  90. package/lib/__templates__/taro/src/components/ui/input-otp.tsx +136 -0
  91. package/lib/__templates__/taro/src/components/ui/input.tsx +56 -0
  92. package/lib/__templates__/taro/src/components/ui/label.tsx +24 -0
  93. package/lib/__templates__/taro/src/components/ui/menubar.tsx +595 -0
  94. package/lib/__templates__/taro/src/components/ui/navigation-menu.tsx +264 -0
  95. package/lib/__templates__/taro/src/components/ui/pagination.tsx +118 -0
  96. package/lib/__templates__/taro/src/components/ui/popover.tsx +291 -0
  97. package/lib/__templates__/taro/src/components/ui/portal.tsx +19 -0
  98. package/lib/__templates__/taro/src/components/ui/progress.tsx +28 -0
  99. package/lib/__templates__/taro/src/components/ui/radio-group.tsx +64 -0
  100. package/lib/__templates__/taro/src/components/ui/resizable.tsx +346 -0
  101. package/lib/__templates__/taro/src/components/ui/scroll-area.tsx +34 -0
  102. package/lib/__templates__/taro/src/components/ui/select.tsx +438 -0
  103. package/lib/__templates__/taro/src/components/ui/separator.tsx +30 -0
  104. package/lib/__templates__/taro/src/components/ui/sheet.tsx +262 -0
  105. package/lib/__templates__/taro/src/components/ui/skeleton.tsx +17 -0
  106. package/lib/__templates__/taro/src/components/ui/slider.tsx +203 -0
  107. package/lib/__templates__/taro/src/components/ui/sonner.tsx +1 -0
  108. package/lib/__templates__/taro/src/components/ui/switch.tsx +55 -0
  109. package/lib/__templates__/taro/src/components/ui/table.tsx +142 -0
  110. package/lib/__templates__/taro/src/components/ui/tabs.tsx +114 -0
  111. package/lib/__templates__/taro/src/components/ui/textarea.tsx +54 -0
  112. package/lib/__templates__/taro/src/components/ui/toast.tsx +517 -0
  113. package/lib/__templates__/taro/src/components/ui/toggle-group.tsx +120 -0
  114. package/lib/__templates__/taro/src/components/ui/toggle.tsx +77 -0
  115. package/lib/__templates__/taro/src/components/ui/tooltip.tsx +455 -0
  116. package/lib/__templates__/taro/src/lib/hooks/use-keyboard-offset.ts +37 -0
  117. package/lib/__templates__/taro/src/lib/measure.ts +115 -0
  118. package/lib/__templates__/taro/src/lib/platform.ts +12 -0
  119. package/lib/__templates__/taro/src/lib/utils.ts +6 -0
  120. package/lib/__templates__/taro/src/presets/dev-debug.ts +23 -0
  121. package/lib/__templates__/taro/src/presets/h5-container.tsx +15 -0
  122. package/lib/__templates__/taro/src/presets/h5-navbar.tsx +238 -0
  123. package/lib/__templates__/taro/src/presets/h5-styles.ts +220 -0
  124. package/lib/__templates__/taro/src/presets/index.tsx +18 -0
  125. package/lib/__templates__/templates.json +43 -0
  126. package/lib/__templates__/vite/README.md +190 -11
  127. package/lib/__templates__/vite/_gitignore +1 -0
  128. package/lib/__templates__/vite/eslint.config.mjs +6 -1
  129. package/lib/__templates__/vite/package.json +14 -5
  130. package/lib/__templates__/vite/pnpm-lock.yaml +768 -24
  131. package/lib/__templates__/vite/scripts/build.sh +4 -1
  132. package/lib/__templates__/vite/scripts/dev.sh +9 -2
  133. package/lib/__templates__/vite/scripts/start.sh +9 -3
  134. package/lib/__templates__/vite/server/routes/index.ts +31 -0
  135. package/lib/__templates__/vite/server/server.ts +65 -0
  136. package/lib/__templates__/vite/server/vite.ts +67 -0
  137. package/lib/__templates__/vite/tsconfig.json +4 -3
  138. package/lib/__templates__/vite/vite.config.ts +5 -0
  139. package/lib/cli.js +124 -103
  140. package/package.json +7 -3
  141. package/lib/__templates__/taro/src/app.ts +0 -14
  142. package/lib/__templates__/taro/src/utils/h5-styles.ts +0 -22
  143. package/lib/__templates__/taro/src/utils/wx-debug.ts +0 -23
@@ -0,0 +1,136 @@
1
+ import * as React from "react"
2
+ import { View, Input } from "@tarojs/components"
3
+ import { Dot } from "lucide-react-taro"
4
+ import { cn } from "@/lib/utils"
5
+
6
+ const InputOTPContext = React.createContext<{
7
+ value: string
8
+ maxLength: number
9
+ isFocused: boolean
10
+ } | null>(null)
11
+
12
+ const InputOTP = React.forwardRef<
13
+ any,
14
+ {
15
+ value?: string
16
+ defaultValue?: string
17
+ onChange?: (value: string) => void
18
+ maxLength: number
19
+ containerClassName?: string
20
+ className?: string
21
+ disabled?: boolean
22
+ autoFocus?: boolean
23
+ children: React.ReactNode
24
+ }
25
+ >(({ value: valueProp, defaultValue, onChange, maxLength, containerClassName, className, disabled, autoFocus, children }, ref) => {
26
+ const [valueState, setValueState] = React.useState(defaultValue || "")
27
+ const [isFocused, setIsFocused] = React.useState(false)
28
+ const value = valueProp !== undefined ? valueProp : valueState
29
+
30
+ const handleChange = (e: any) => {
31
+ const newValue = e.detail.value
32
+ if (newValue.length <= maxLength) {
33
+ if (valueProp === undefined) {
34
+ setValueState(newValue)
35
+ }
36
+ onChange?.(newValue)
37
+ }
38
+ }
39
+
40
+ return (
41
+ <InputOTPContext.Provider value={{ value, maxLength, isFocused }}>
42
+ <View
43
+ className={cn(
44
+ "relative flex items-center gap-2",
45
+ disabled && "opacity-50",
46
+ containerClassName
47
+ )}
48
+ >
49
+ <Input
50
+ className="z-10 taro-otp-hidden-input"
51
+ style={{
52
+ position: "absolute",
53
+ left: 0,
54
+ top: 0,
55
+ width: "100%",
56
+ height: "100%",
57
+ opacity: 0,
58
+ zIndex: 10,
59
+ backgroundColor: "transparent",
60
+ borderWidth: 0,
61
+ padding: 0,
62
+ margin: 0,
63
+ outline: "none",
64
+ color: "transparent",
65
+ caretColor: "transparent",
66
+ }}
67
+ value={value}
68
+ onInput={handleChange}
69
+ onFocus={() => setIsFocused(true)}
70
+ onBlur={() => setIsFocused(false)}
71
+ maxlength={maxLength}
72
+ type="number"
73
+ disabled={disabled}
74
+ focus={autoFocus}
75
+ ref={ref}
76
+ />
77
+ <View className={cn("flex items-center gap-2", className)}>
78
+ {children}
79
+ </View>
80
+ </View>
81
+ </InputOTPContext.Provider>
82
+ )
83
+ })
84
+ InputOTP.displayName = "InputOTP"
85
+
86
+ const InputOTPGroup = React.forwardRef<
87
+ React.ElementRef<typeof View>,
88
+ React.ComponentPropsWithoutRef<typeof View>
89
+ >(({ className, ...props }, ref) => (
90
+ <View ref={ref} className={cn("flex items-center", className)} {...props} />
91
+ ))
92
+ InputOTPGroup.displayName = "InputOTPGroup"
93
+
94
+ const InputOTPSlot = React.forwardRef<
95
+ React.ElementRef<typeof View>,
96
+ React.ComponentPropsWithoutRef<typeof View> & { index: number }
97
+ >(({ index, className, ...props }, ref) => {
98
+ const context = React.useContext(InputOTPContext)
99
+ if (!context) return null
100
+
101
+ const char = context.value[index]
102
+ const isActive = context.isFocused && context.value.length === index
103
+ const hasFakeCaret = isActive
104
+
105
+ return (
106
+ <View
107
+ ref={ref}
108
+ className={cn(
109
+ "relative flex h-10 w-10 items-center justify-center border-y border-r border-input text-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md",
110
+ isActive && "z-10 ring-2 ring-ring ring-offset-background",
111
+ className
112
+ )}
113
+ {...props}
114
+ >
115
+ <View>{char}</View>
116
+ {hasFakeCaret && (
117
+ <View className="pointer-events-none absolute inset-0 flex items-center justify-center">
118
+ <View className="h-4 w-px animate-caret-blink bg-foreground duration-1000" />
119
+ </View>
120
+ )}
121
+ </View>
122
+ )
123
+ })
124
+ InputOTPSlot.displayName = "InputOTPSlot"
125
+
126
+ const InputOTPSeparator = React.forwardRef<
127
+ React.ElementRef<typeof View>,
128
+ React.ComponentPropsWithoutRef<typeof View>
129
+ >(({ ...props }, ref) => (
130
+ <View ref={ref} {...props}>
131
+ <Dot />
132
+ </View>
133
+ ))
134
+ InputOTPSeparator.displayName = "InputOTPSeparator"
135
+
136
+ export { InputOTP, InputOTPGroup, InputOTPSlot, InputOTPSeparator }
@@ -0,0 +1,56 @@
1
+ import * as React from "react"
2
+ import { Input as TaroInput, View } from "@tarojs/components"
3
+ import { cn } from "@/lib/utils"
4
+
5
+ export interface InputProps
6
+ extends React.ComponentPropsWithoutRef<typeof TaroInput> {
7
+ className?: string
8
+ type?: React.ComponentProps<typeof TaroInput>['type']
9
+ autoFocus?: boolean
10
+ }
11
+
12
+ const Input = React.forwardRef<React.ElementRef<typeof TaroInput>, InputProps>(
13
+ ({ className, type, autoFocus, focus, onFocus, onBlur, ...props }, ref) => {
14
+ const [isFocused, setIsFocused] = React.useState(false)
15
+ const disabled = !!(props as any).disabled
16
+
17
+ React.useEffect(() => {
18
+ if (autoFocus || focus) setIsFocused(true)
19
+ }, [autoFocus, focus])
20
+
21
+ return (
22
+ <View
23
+ className={cn(
24
+ "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus-within:border-ring focus-within:ring-4 focus-within:ring-ring focus-within:ring-offset-2 focus-within:ring-offset-background",
25
+ isFocused &&
26
+ "border-ring ring-4 ring-ring ring-offset-2 ring-offset-background",
27
+ className
28
+ )}
29
+ onTouchStart={() => {
30
+ if (disabled) return
31
+ setIsFocused(true)
32
+ }}
33
+ >
34
+ <TaroInput
35
+ type={type}
36
+ className="w-full flex-1 bg-transparent text-sm text-foreground focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 selection:bg-selection selection:text-selection-foreground"
37
+ placeholderClass="text-muted-foreground"
38
+ ref={ref}
39
+ focus={autoFocus || focus}
40
+ onFocus={(e) => {
41
+ setIsFocused(true)
42
+ onFocus?.(e)
43
+ }}
44
+ onBlur={(e) => {
45
+ setIsFocused(false)
46
+ onBlur?.(e)
47
+ }}
48
+ {...props}
49
+ />
50
+ </View>
51
+ )
52
+ }
53
+ )
54
+ Input.displayName = "Input"
55
+
56
+ export { Input }
@@ -0,0 +1,24 @@
1
+ import * as React from "react"
2
+ import { Label as TaroLabel } from "@tarojs/components"
3
+ import { cva, type VariantProps } from "class-variance-authority"
4
+
5
+ import { cn } from "@/lib/utils"
6
+
7
+ const labelVariants = cva(
8
+ "text-sm font-medium leading-none"
9
+ )
10
+
11
+ const Label = React.forwardRef<
12
+ React.ElementRef<typeof TaroLabel>,
13
+ React.ComponentPropsWithoutRef<typeof TaroLabel> &
14
+ VariantProps<typeof labelVariants>
15
+ >(({ className, ...props }, ref) => (
16
+ <TaroLabel
17
+ ref={ref}
18
+ className={cn(labelVariants(), className)}
19
+ {...props}
20
+ />
21
+ ))
22
+ Label.displayName = "Label"
23
+
24
+ export { Label }