@coze-arch/cli 0.0.1-alpha.fc5c04 → 0.0.1-alpha.ff3d06
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/_npmrc +1 -0
- package/lib/__templates__/expo/client/components/Screen.tsx +2 -2
- package/lib/__templates__/expo/client/eslint.config.mjs +7 -0
- package/lib/__templates__/expo/client/scripts/install-missing-deps.js +10 -10
- 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/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__/nextjs/AGENTS.md +54 -0
- package/lib/__templates__/nextjs/README.md +5 -0
- package/lib/__templates__/nextjs/eslint.config.mjs +5 -0
- package/lib/__templates__/nextjs/next.config.ts +1 -2
- package/lib/__templates__/nextjs/package.json +2 -5
- package/lib/__templates__/nextjs/pnpm-lock.yaml +1028 -5
- package/lib/__templates__/nextjs/scripts/build.sh +4 -1
- package/lib/__templates__/nextjs/scripts/dev.sh +8 -2
- package/lib/__templates__/nextjs/scripts/start.sh +7 -1
- package/lib/__templates__/nextjs/src/app/layout.tsx +1 -1
- package/lib/__templates__/nextjs/src/app/page.tsx +1 -2
- package/lib/__templates__/nextjs/src/server.ts +35 -0
- package/lib/__templates__/nextjs/tsconfig.json +1 -1
- package/lib/__templates__/nuxt-vue/AGENTS.md +42 -0
- package/lib/__templates__/nuxt-vue/README.md +73 -0
- package/lib/__templates__/nuxt-vue/_gitignore +24 -0
- package/lib/__templates__/nuxt-vue/app/app.vue +6 -0
- package/lib/__templates__/nuxt-vue/app/pages/index.vue +23 -0
- package/lib/__templates__/{vite-vue/src/index.css → nuxt-vue/assets/css/main.css} +6 -11
- 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__/{vite-vue → nuxt-vue}/postcss.config.mjs +3 -1
- package/lib/__templates__/nuxt-vue/public/favicon.ico +0 -0
- package/lib/__templates__/nuxt-vue/public/robots.txt +2 -0
- package/lib/__templates__/{vite-vue → nuxt-vue}/scripts/build.sh +2 -2
- package/lib/__templates__/{vite-vue → nuxt-vue}/scripts/dev.sh +9 -2
- 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/README.md +57 -45
- package/lib/__templates__/taro/config/index.ts +45 -30
- package/lib/__templates__/taro/eslint.config.mjs +61 -6
- package/lib/__templates__/taro/package.json +8 -3
- package/lib/__templates__/taro/pnpm-lock.yaml +515 -203
- package/lib/__templates__/taro/src/app.css +140 -36
- 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/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/presets/h5-navbar.tsx +49 -12
- package/lib/__templates__/taro/src/presets/h5-styles.ts +78 -0
- package/lib/__templates__/templates.json +17 -17
- package/lib/__templates__/vite/AGENTS.md +41 -0
- package/lib/__templates__/vite/README.md +190 -11
- package/lib/__templates__/vite/_gitignore +1 -0
- package/lib/__templates__/vite/eslint.config.mjs +6 -1
- package/lib/__templates__/vite/package.json +10 -3
- package/lib/__templates__/vite/pnpm-lock.yaml +755 -15
- package/lib/__templates__/vite/scripts/build.sh +4 -1
- package/lib/__templates__/vite/scripts/dev.sh +9 -2
- 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/tsconfig.json +4 -3
- package/lib/__templates__/vite/vite.config.ts +4 -0
- package/lib/cli.js +3251 -768
- package/package.json +9 -3
- package/lib/__templates__/vite-vue/README.md +0 -451
- package/lib/__templates__/vite-vue/_gitignore +0 -66
- package/lib/__templates__/vite-vue/eslint.config.mjs +0 -9
- package/lib/__templates__/vite-vue/index.html +0 -13
- package/lib/__templates__/vite-vue/package.json +0 -38
- package/lib/__templates__/vite-vue/pnpm-lock.yaml +0 -3132
- package/lib/__templates__/vite-vue/scripts/prepare.sh +0 -9
- package/lib/__templates__/vite-vue/scripts/start.sh +0 -15
- package/lib/__templates__/vite-vue/src/App.vue +0 -6
- package/lib/__templates__/vite-vue/src/main.ts +0 -8
- package/lib/__templates__/vite-vue/src/router/index.ts +0 -17
- package/lib/__templates__/vite-vue/src/views/Home.vue +0 -38
- package/lib/__templates__/vite-vue/src/vite-env.d.ts +0 -8
- package/lib/__templates__/vite-vue/tailwind.config.js +0 -9
- package/lib/__templates__/vite-vue/template.config.js +0 -127
- package/lib/__templates__/vite-vue/tsconfig.json +0 -17
- package/lib/__templates__/vite-vue/vite.config.ts +0 -28
- /package/lib/__templates__/{vite-vue → nuxt-vue}/.coze +0 -0
- /package/lib/__templates__/{vite-vue → nuxt-vue}/_npmrc +0 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import Taro from '@tarojs/taro'
|
|
2
|
+
import { canUseDOM, isH5 } from './platform'
|
|
3
|
+
|
|
4
|
+
export type Rect = { left: number; top: number; width: number; height: number }
|
|
5
|
+
|
|
6
|
+
const toNumber = (v: unknown) => {
|
|
7
|
+
if (typeof v === 'number') return v
|
|
8
|
+
if (typeof v === 'string') {
|
|
9
|
+
const n = parseFloat(v)
|
|
10
|
+
return Number.isFinite(n) ? n : 0
|
|
11
|
+
}
|
|
12
|
+
return 0
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const normalizeRect = (r: any): Rect | null => {
|
|
16
|
+
if (!r) return null
|
|
17
|
+
return {
|
|
18
|
+
left: toNumber(r.left),
|
|
19
|
+
top: toNumber(r.top),
|
|
20
|
+
width: toNumber(r.width),
|
|
21
|
+
height: toNumber(r.height),
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const getViewport = () => {
|
|
26
|
+
if (isH5() && canUseDOM()) {
|
|
27
|
+
return { width: window.innerWidth, height: window.innerHeight }
|
|
28
|
+
}
|
|
29
|
+
try {
|
|
30
|
+
const info = Taro.getSystemInfoSync()
|
|
31
|
+
return {
|
|
32
|
+
width: toNumber(info.windowWidth),
|
|
33
|
+
height: toNumber(info.windowHeight),
|
|
34
|
+
}
|
|
35
|
+
} catch {
|
|
36
|
+
return { width: 375, height: 667 }
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const getRectH5 = (id: string): Rect | null => {
|
|
41
|
+
if (!isH5() || !canUseDOM()) return null
|
|
42
|
+
const el = document.getElementById(id)
|
|
43
|
+
if (!el) return null
|
|
44
|
+
const r = el.getBoundingClientRect()
|
|
45
|
+
return normalizeRect(r)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const getRectById = (id: string): Promise<Rect | null> => {
|
|
49
|
+
const h5Rect = getRectH5(id)
|
|
50
|
+
if (h5Rect) return Promise.resolve(h5Rect)
|
|
51
|
+
return new Promise(resolve => {
|
|
52
|
+
const query = Taro.createSelectorQuery()
|
|
53
|
+
query
|
|
54
|
+
.select(`#${id}`)
|
|
55
|
+
.boundingClientRect(res => {
|
|
56
|
+
const rect = Array.isArray(res) ? res[0] : res
|
|
57
|
+
resolve(normalizeRect(rect))
|
|
58
|
+
})
|
|
59
|
+
.exec()
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const computePosition = (params: {
|
|
64
|
+
triggerRect: Rect
|
|
65
|
+
contentRect: Rect
|
|
66
|
+
align: 'start' | 'center' | 'end'
|
|
67
|
+
side: 'top' | 'bottom' | 'left' | 'right'
|
|
68
|
+
sideOffset: number
|
|
69
|
+
}) => {
|
|
70
|
+
const { triggerRect, contentRect, align, side, sideOffset } = params
|
|
71
|
+
const { width: vw, height: vh } = getViewport()
|
|
72
|
+
const margin = 8
|
|
73
|
+
|
|
74
|
+
const crossStart =
|
|
75
|
+
side === 'left' || side === 'right' ? triggerRect.top : triggerRect.left
|
|
76
|
+
const crossSize =
|
|
77
|
+
side === 'left' || side === 'right'
|
|
78
|
+
? triggerRect.height
|
|
79
|
+
: triggerRect.width
|
|
80
|
+
const contentCrossSize =
|
|
81
|
+
side === 'left' || side === 'right'
|
|
82
|
+
? contentRect.height
|
|
83
|
+
: contentRect.width
|
|
84
|
+
|
|
85
|
+
const cross = (() => {
|
|
86
|
+
if (align === 'start') return crossStart
|
|
87
|
+
if (align === 'end') return crossStart + crossSize - contentCrossSize
|
|
88
|
+
return crossStart + crossSize / 2 - contentCrossSize / 2
|
|
89
|
+
})()
|
|
90
|
+
|
|
91
|
+
let left = 0
|
|
92
|
+
let top = 0
|
|
93
|
+
|
|
94
|
+
if (side === 'bottom' || side === 'top') {
|
|
95
|
+
left = cross
|
|
96
|
+
top =
|
|
97
|
+
side === 'bottom'
|
|
98
|
+
? triggerRect.top + triggerRect.height + sideOffset
|
|
99
|
+
: triggerRect.top - contentRect.height - sideOffset
|
|
100
|
+
} else {
|
|
101
|
+
top = cross
|
|
102
|
+
left =
|
|
103
|
+
side === 'right'
|
|
104
|
+
? triggerRect.left + triggerRect.width + sideOffset
|
|
105
|
+
: triggerRect.left - contentRect.width - sideOffset
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const maxLeft = Math.max(margin, vw - contentRect.width - margin)
|
|
109
|
+
const maxTop = Math.max(margin, vh - contentRect.height - margin)
|
|
110
|
+
|
|
111
|
+
left = Math.min(Math.max(left, margin), maxLeft)
|
|
112
|
+
top = Math.min(Math.max(top, margin), maxTop)
|
|
113
|
+
|
|
114
|
+
return { left, top }
|
|
115
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Taro from "@tarojs/taro"
|
|
2
|
+
|
|
3
|
+
export const canUseDOM = () => typeof window !== "undefined" && typeof document !== "undefined"
|
|
4
|
+
|
|
5
|
+
export const isH5 = () => {
|
|
6
|
+
try {
|
|
7
|
+
return Taro.getEnv() === Taro.ENV_TYPE.WEB
|
|
8
|
+
} catch {
|
|
9
|
+
return canUseDOM()
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
@@ -49,16 +49,26 @@ const getTabBarPages = (): Set<string> => {
|
|
|
49
49
|
);
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
+
const getHomePage = (): string => {
|
|
53
|
+
const app = Taro.getApp();
|
|
54
|
+
return app?.config?.pages?.[0] || 'pages/index/index';
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const cleanPath = (path: string): string => path.replace(/^\//, '');
|
|
58
|
+
|
|
52
59
|
const computeLeftIcon = (
|
|
53
60
|
route: string,
|
|
54
61
|
tabBarPages: Set<string>,
|
|
55
62
|
historyLength: number,
|
|
63
|
+
homePage: string,
|
|
56
64
|
): LeftIcon => {
|
|
57
65
|
if (!route) return LeftIcon.None;
|
|
58
66
|
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
const
|
|
67
|
+
const cleanRoute = cleanPath(route);
|
|
68
|
+
const cleanHomePage = cleanPath(homePage);
|
|
69
|
+
const isHomePage = cleanRoute === cleanHomePage;
|
|
70
|
+
const isTabBarPage =
|
|
71
|
+
tabBarPages.has(cleanRoute) || tabBarPages.has(`/${cleanRoute}`);
|
|
62
72
|
const hasHistory = historyLength > 1;
|
|
63
73
|
|
|
64
74
|
if (isTabBarPage || isHomePage) return LeftIcon.None;
|
|
@@ -72,15 +82,27 @@ export const H5NavBar = () => {
|
|
|
72
82
|
|
|
73
83
|
const updateNavState = useCallback(() => {
|
|
74
84
|
const pages = Taro.getCurrentPages();
|
|
85
|
+
if (pages.length === 0) {
|
|
86
|
+
setNavState(prev => ({ ...prev, visible: false }));
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
75
90
|
const currentPage = pages[pages.length - 1];
|
|
76
91
|
const route = currentPage?.route || '';
|
|
92
|
+
if (!route) return;
|
|
93
|
+
|
|
77
94
|
const pageConfig: NavConfig = (currentPage as any)?.config || {};
|
|
78
95
|
const globalConfig = getGlobalWindowConfig();
|
|
79
96
|
const tabBarPages = getTabBarPages();
|
|
97
|
+
const homePage = getHomePage();
|
|
98
|
+
|
|
99
|
+
const cleanRoute = cleanPath(route);
|
|
100
|
+
const cleanHomePage = cleanPath(homePage);
|
|
101
|
+
|
|
102
|
+
const isHomePage = cleanRoute === cleanHomePage;
|
|
103
|
+
const isTabBarPage =
|
|
104
|
+
tabBarPages.has(cleanRoute) || tabBarPages.has(`/${cleanRoute}`);
|
|
80
105
|
|
|
81
|
-
const isHomePage =
|
|
82
|
-
route === 'pages/index/index' || route === '/pages/index/index';
|
|
83
|
-
const isTabBarPage = tabBarPages.has(route);
|
|
84
106
|
const shouldHideNav =
|
|
85
107
|
tabBarPages.size <= 1 &&
|
|
86
108
|
pages.length <= 1 &&
|
|
@@ -89,6 +111,7 @@ export const H5NavBar = () => {
|
|
|
89
111
|
setNavState({
|
|
90
112
|
visible: !shouldHideNav,
|
|
91
113
|
title:
|
|
114
|
+
document.title ||
|
|
92
115
|
pageConfig.navigationBarTitleText ||
|
|
93
116
|
globalConfig.navigationBarTitleText ||
|
|
94
117
|
'',
|
|
@@ -106,7 +129,7 @@ export const H5NavBar = () => {
|
|
|
106
129
|
pageConfig.transparentTitle || globalConfig.transparentTitle || 'none',
|
|
107
130
|
leftIcon: shouldHideNav
|
|
108
131
|
? LeftIcon.None
|
|
109
|
-
: computeLeftIcon(
|
|
132
|
+
: computeLeftIcon(cleanRoute, tabBarPages, pages.length, cleanHomePage),
|
|
110
133
|
});
|
|
111
134
|
}, []);
|
|
112
135
|
|
|
@@ -123,15 +146,26 @@ export const H5NavBar = () => {
|
|
|
123
146
|
useEffect(() => {
|
|
124
147
|
if (TARO_ENV !== 'h5') return;
|
|
125
148
|
|
|
126
|
-
|
|
127
|
-
const observer = new MutationObserver(() =>
|
|
128
|
-
|
|
149
|
+
let timer: NodeJS.Timeout | null = null;
|
|
150
|
+
const observer = new MutationObserver(() => {
|
|
151
|
+
if (timer) clearTimeout(timer);
|
|
152
|
+
timer = setTimeout(() => {
|
|
153
|
+
updateNavState();
|
|
154
|
+
}, 50);
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
observer.observe(document.head, {
|
|
129
158
|
subtree: true,
|
|
130
159
|
childList: true,
|
|
131
160
|
characterData: true,
|
|
132
161
|
});
|
|
133
162
|
|
|
134
|
-
|
|
163
|
+
updateNavState();
|
|
164
|
+
|
|
165
|
+
return () => {
|
|
166
|
+
observer.disconnect();
|
|
167
|
+
if (timer) clearTimeout(timer);
|
|
168
|
+
};
|
|
135
169
|
}, [updateNavState]);
|
|
136
170
|
|
|
137
171
|
const shouldRender =
|
|
@@ -165,7 +199,10 @@ export const H5NavBar = () => {
|
|
|
165
199
|
};
|
|
166
200
|
|
|
167
201
|
const handleBack = () => Taro.navigateBack();
|
|
168
|
-
const handleGoHome = () =>
|
|
202
|
+
const handleGoHome = () => {
|
|
203
|
+
const homePage = getHomePage();
|
|
204
|
+
Taro.reLaunch({ url: `/${homePage}` });
|
|
205
|
+
};
|
|
169
206
|
|
|
170
207
|
return (
|
|
171
208
|
<>
|
|
@@ -52,6 +52,72 @@ vite-error-overlay::part(window) {
|
|
|
52
52
|
body.h5-navbar-visible .taro_page {
|
|
53
53
|
padding-top: 44px;
|
|
54
54
|
}
|
|
55
|
+
|
|
56
|
+
body.h5-navbar-visible .toaster[data-position^="top"] {
|
|
57
|
+
top: 44px !important;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* Sheet 组件在 H5 导航栏下的位置修正 */
|
|
61
|
+
body.h5-navbar-visible .sheet-content:not([data-side="bottom"]) {
|
|
62
|
+
top: 44px !important;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/*
|
|
66
|
+
* H5 端 rem 适配:与小程序 rpx 缩放一致
|
|
67
|
+
* 375px 屏幕:1rem = 16px,小程序 32rpx = 16px
|
|
68
|
+
*/
|
|
69
|
+
html {
|
|
70
|
+
font-size: 4vw !important;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* H5 端组件默认样式修复 */
|
|
74
|
+
taro-view-core {
|
|
75
|
+
display: block;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
taro-text-core {
|
|
79
|
+
display: inline;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
taro-input-core {
|
|
83
|
+
display: block;
|
|
84
|
+
width: 100%;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
taro-input-core input {
|
|
88
|
+
width: 100%;
|
|
89
|
+
background: transparent;
|
|
90
|
+
border: none;
|
|
91
|
+
outline: none;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
taro-input-core.taro-otp-hidden-input input {
|
|
95
|
+
color: transparent;
|
|
96
|
+
caret-color: transparent;
|
|
97
|
+
-webkit-text-fill-color: transparent;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/* 全局按钮样式重置 */
|
|
101
|
+
taro-button-core,
|
|
102
|
+
button {
|
|
103
|
+
margin: 0 !important;
|
|
104
|
+
padding: 0 !important;
|
|
105
|
+
line-height: inherit;
|
|
106
|
+
display: flex;
|
|
107
|
+
align-items: center;
|
|
108
|
+
justify-content: center;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
taro-button-core::after,
|
|
112
|
+
button::after {
|
|
113
|
+
border: none;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
taro-textarea-core > textarea,
|
|
117
|
+
.taro-textarea,
|
|
118
|
+
textarea.taro-textarea {
|
|
119
|
+
resize: none !important;
|
|
120
|
+
}
|
|
55
121
|
`;
|
|
56
122
|
|
|
57
123
|
const PC_WIDESCREEN_STYLES = `
|
|
@@ -93,6 +159,18 @@ const PC_WIDESCREEN_PHONE_FRAME = `
|
|
|
93
159
|
}
|
|
94
160
|
}
|
|
95
161
|
|
|
162
|
+
/* PC 宽屏适配 - Toast 定位到手机框范围内 */
|
|
163
|
+
@media (min-width: 769px) {
|
|
164
|
+
body .toaster {
|
|
165
|
+
left: 50% !important;
|
|
166
|
+
right: auto !important;
|
|
167
|
+
width: 375px !important;
|
|
168
|
+
max-width: 375px !important;
|
|
169
|
+
transform: translateX(-50%) !important;
|
|
170
|
+
box-sizing: border-box !important;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
96
174
|
/* PC 宽屏适配 - 手机框样式(无 TabBar 页面,通过 JS 添加 no-tabbar 类) */
|
|
97
175
|
@media (min-width: 769px) {
|
|
98
176
|
body.no-tabbar #app {
|
|
@@ -63,9 +63,9 @@
|
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
|
-
"name": "
|
|
67
|
-
"description": "
|
|
68
|
-
"location": "./
|
|
66
|
+
"name": "nuxt-vue",
|
|
67
|
+
"description": "Nuxt.js(服务端 + Vue):`coze init ${COZE_WORKSPACE_PATH} --template nuxt-vue`\n- 适用:全栈应用、需要服务端接口能力的 Vue 项目\n- 特点:\n - **服务端能力**:内置服务端 API 路由,可直接创建后端接口\n - **Vue 3**:基于最新的 Vue 3 Composition API\n - **Vite**:使用 Vite 作为构建工具,开发体验极佳\n - **TypeScript**:完整的 TypeScript 支持\n - **文件路由**:基于文件系统的自动路由\n - **项目理解加速**:可依赖项目下 `package.json` 和 `nuxt.config.ts` 理解项目配置",
|
|
68
|
+
"location": "./nuxt-vue",
|
|
69
69
|
"paramsSchema": {
|
|
70
70
|
"type": "object",
|
|
71
71
|
"properties": {
|
|
@@ -80,14 +80,14 @@
|
|
|
80
80
|
"default": 5000,
|
|
81
81
|
"minimum": 1024,
|
|
82
82
|
"maximum": 65535,
|
|
83
|
-
"description": "
|
|
83
|
+
"description": "Development server port (for Nuxt dev server)"
|
|
84
84
|
},
|
|
85
|
-
"
|
|
85
|
+
"hmrPort": {
|
|
86
86
|
"type": "number",
|
|
87
|
-
"default":
|
|
87
|
+
"default": 6000,
|
|
88
88
|
"minimum": 1024,
|
|
89
89
|
"maximum": 65535,
|
|
90
|
-
"description": "
|
|
90
|
+
"description": "Hot Module Replacement (HMR) port"
|
|
91
91
|
}
|
|
92
92
|
},
|
|
93
93
|
"required": [],
|
|
@@ -95,9 +95,9 @@
|
|
|
95
95
|
}
|
|
96
96
|
},
|
|
97
97
|
{
|
|
98
|
-
"name": "
|
|
99
|
-
"description": "
|
|
100
|
-
"location": "./
|
|
98
|
+
"name": "taro",
|
|
99
|
+
"description": "Taro(小程序 + H5):`coze init ${COZE_WORKSPACE_PATH} --template taro`\n- 适用:微信小程序、H5 跨端应用\n- 前后端分离架构:Taro 4 + NestJS\n- 支持微信小程序和 H5 双端构建\n- 使用 TailwindCSS + weapp-tailwindcss 实现跨端样式",
|
|
100
|
+
"location": "./taro",
|
|
101
101
|
"paramsSchema": {
|
|
102
102
|
"type": "object",
|
|
103
103
|
"properties": {
|
|
@@ -112,14 +112,14 @@
|
|
|
112
112
|
"default": 5000,
|
|
113
113
|
"minimum": 1024,
|
|
114
114
|
"maximum": 65535,
|
|
115
|
-
"description": "
|
|
115
|
+
"description": "H5 development server port"
|
|
116
116
|
},
|
|
117
|
-
"
|
|
117
|
+
"serverPort": {
|
|
118
118
|
"type": "number",
|
|
119
|
-
"default":
|
|
119
|
+
"default": 3000,
|
|
120
120
|
"minimum": 1024,
|
|
121
121
|
"maximum": 65535,
|
|
122
|
-
"description": "
|
|
122
|
+
"description": "NestJS backend server port"
|
|
123
123
|
}
|
|
124
124
|
},
|
|
125
125
|
"required": [],
|
|
@@ -127,9 +127,9 @@
|
|
|
127
127
|
}
|
|
128
128
|
},
|
|
129
129
|
{
|
|
130
|
-
"name": "vite
|
|
131
|
-
"description": "Vite
|
|
132
|
-
"location": "./vite
|
|
130
|
+
"name": "vite",
|
|
131
|
+
"description": "Vite(简单项目):`coze init ${COZE_WORKSPACE_PATH} --template vite`\n- 适用:轻量级 SPA、纯前端交互、仪表盘等轻量级项目。",
|
|
132
|
+
"location": "./vite",
|
|
133
133
|
"paramsSchema": {
|
|
134
134
|
"type": "object",
|
|
135
135
|
"properties": {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# 项目上下文
|
|
2
|
+
|
|
3
|
+
## 技术栈
|
|
4
|
+
|
|
5
|
+
- **核心**: Vite 7, TypeScript, Express
|
|
6
|
+
- **UI**: Tailwind CSS
|
|
7
|
+
|
|
8
|
+
## 目录结构
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
├── scripts/ # 构建与启动脚本
|
|
12
|
+
│ ├── build.sh # 构建脚本
|
|
13
|
+
│ ├── dev.sh # 开发环境启动脚本
|
|
14
|
+
│ ├── prepare.sh # 预处理脚本
|
|
15
|
+
│ └── start.sh # 生产环境启动脚本
|
|
16
|
+
├── server/ # 服务端逻辑
|
|
17
|
+
│ ├── routes/ # API 路由
|
|
18
|
+
│ ├── server.ts # Express 服务入口
|
|
19
|
+
│ └── vite.ts # Vite 中间件集成
|
|
20
|
+
├── src/ # 前端源码
|
|
21
|
+
│ ├── index.css # 全局样式
|
|
22
|
+
│ ├── index.ts # 客户端入口
|
|
23
|
+
│ └── main.ts # 主逻辑
|
|
24
|
+
├── index.html # 入口 HTML
|
|
25
|
+
├── package.json # 项目依赖管理
|
|
26
|
+
├── tsconfig.json # TypeScript 配置
|
|
27
|
+
└── vite.config.ts # Vite 配置
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## 包管理规范
|
|
31
|
+
|
|
32
|
+
**仅允许使用 pnpm** 作为包管理器,**严禁使用 npm 或 yarn**。
|
|
33
|
+
**常用命令**:
|
|
34
|
+
- 安装依赖:`pnpm add <package>`
|
|
35
|
+
- 安装开发依赖:`pnpm add -D <package>`
|
|
36
|
+
- 安装所有依赖:`pnpm install`
|
|
37
|
+
- 移除依赖:`pnpm remove <package>`
|
|
38
|
+
|
|
39
|
+
## 开发规范
|
|
40
|
+
|
|
41
|
+
- 使用 Tailwind CSS 进行样式开发
|