@hua-labs/create-hua-ux 0.1.0-alpha.0.1
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/LICENSE +21 -0
- package/README.md +183 -0
- package/dist/bin/create-hua-ux.d.ts +9 -0
- package/dist/bin/create-hua-ux.d.ts.map +1 -0
- package/dist/bin/create-hua-ux.js +37 -0
- package/dist/constants/versions.d.ts +55 -0
- package/dist/constants/versions.d.ts.map +1 -0
- package/dist/constants/versions.js +57 -0
- package/dist/create-project.d.ts +18 -0
- package/dist/create-project.d.ts.map +1 -0
- package/dist/create-project.js +237 -0
- package/dist/doctor.d.ts +21 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +259 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +177 -0
- package/dist/utils.d.ts +108 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +896 -0
- package/dist/version.d.ts +9 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +11 -0
- package/package.json +46 -0
- package/templates/nextjs/.claude/project-context.md +310 -0
- package/templates/nextjs/.claude/skills/hua-ux-framework/SKILL.md +187 -0
- package/templates/nextjs/.cursorrules +302 -0
- package/templates/nextjs/.eslintrc.json +1 -0
- package/templates/nextjs/README.md +431 -0
- package/templates/nextjs/ai-context.md +332 -0
- package/templates/nextjs/app/api/translations/[language]/[namespace]/route.ts +86 -0
- package/templates/nextjs/app/globals.css +24 -0
- package/templates/nextjs/app/layout-with-geo.example.tsx +106 -0
- package/templates/nextjs/app/layout.tsx +30 -0
- package/templates/nextjs/app/page-with-geo.example.tsx +80 -0
- package/templates/nextjs/app/page.tsx +28 -0
- package/templates/nextjs/components/I18nProviderWrapper.tsx +19 -0
- package/templates/nextjs/lib/i18n-setup.ts +11 -0
- package/templates/nextjs/middleware.ts.example +22 -0
- package/templates/nextjs/next.config.ts +36 -0
- package/templates/nextjs/postcss.config.js +6 -0
- package/templates/nextjs/store/useAppStore.ts +8 -0
- package/templates/nextjs/tailwind.config.js +8 -0
- package/templates/nextjs/translations/en/common.json +6 -0
- package/templates/nextjs/translations/ko/common.json +6 -0
- package/templates/nextjs/tsconfig.json +41 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is auto-generated at build time.
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
*
|
|
5
|
+
* Generated from: /home/runner/work/HUA-Labs-public/HUA-Labs-public/packages/hua-ux/package.json
|
|
6
|
+
* Source version: 0.1.0-alpha.0.1
|
|
7
|
+
*/
|
|
8
|
+
export declare const HUA_UX_VERSION = "^0.1.0-alpha.0.1";
|
|
9
|
+
//# sourceMappingURL=version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,cAAc,qBAAqB,CAAC"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file is auto-generated at build time.
|
|
4
|
+
* Do not edit manually.
|
|
5
|
+
*
|
|
6
|
+
* Generated from: /home/runner/work/HUA-Labs-public/HUA-Labs-public/packages/hua-ux/package.json
|
|
7
|
+
* Source version: 0.1.0-alpha.0.1
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.HUA_UX_VERSION = void 0;
|
|
11
|
+
exports.HUA_UX_VERSION = '^0.1.0-alpha.0.1';
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hua-labs/create-hua-ux",
|
|
3
|
+
"version": "0.1.0-alpha.0.1",
|
|
4
|
+
"description": "Scaffolding tool for creating hua-ux projects",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"@hua-labs/create-hua-ux": "./dist/bin/create-hua-ux.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"templates"
|
|
13
|
+
],
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"chalk": "^5.3.0",
|
|
16
|
+
"fs-extra": "^11.2.0",
|
|
17
|
+
"inquirer": "^9.2.15"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@types/fs-extra": "^11.0.4",
|
|
21
|
+
"@types/inquirer": "^9.0.7",
|
|
22
|
+
"@types/node": "^22.0.0",
|
|
23
|
+
"tsx": "^4.21.0",
|
|
24
|
+
"typescript": "^5.9.3"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"hua-ux",
|
|
28
|
+
"scaffolding",
|
|
29
|
+
"cli",
|
|
30
|
+
"nextjs"
|
|
31
|
+
],
|
|
32
|
+
"author": "HUA Labs",
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "https://github.com/HUA-Labs/HUA-Labs-public.git"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"prebuild": "tsx scripts/generate-version.ts",
|
|
40
|
+
"build": "node ../../node_modules/typescript/lib/tsc.js",
|
|
41
|
+
"dev": "tsx src/index.ts",
|
|
42
|
+
"test": "tsx src/index.ts test-project",
|
|
43
|
+
"test:cli": "bash scripts/test-cli.sh",
|
|
44
|
+
"clean": "rm -rf dist"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
# hua-ux Project Context
|
|
2
|
+
|
|
3
|
+
This document is a guide for Claude to understand the structure and usage of this project.
|
|
4
|
+
|
|
5
|
+
## Project Overview
|
|
6
|
+
|
|
7
|
+
This project uses the **hua-ux framework** for Next.js applications.
|
|
8
|
+
|
|
9
|
+
**Core Philosophy**: "You don't need to know Next.js. Just configure and tell AI what to do."
|
|
10
|
+
|
|
11
|
+
## Architecture Layers
|
|
12
|
+
|
|
13
|
+
### Top Layer: AI Context & CLI
|
|
14
|
+
- `.cursorrules`: Rules for Cursor IDE
|
|
15
|
+
- `.claude/project-context.md`: This document (for Claude)
|
|
16
|
+
- `ai-context.md`: General AI context
|
|
17
|
+
|
|
18
|
+
### Middle Layer: Framework & Config
|
|
19
|
+
- `hua-ux.config.ts`: Framework configuration
|
|
20
|
+
- `HuaUxLayout`: Automatic Provider setup
|
|
21
|
+
- `HuaUxPage`: Page wrapper (Motion, i18n, SEO automatically applied)
|
|
22
|
+
- `UnifiedProviders`: All Providers unified
|
|
23
|
+
|
|
24
|
+
### Bottom Layer: Core & Types
|
|
25
|
+
- `@hua-labs/state`: State management
|
|
26
|
+
- `@hua-labs/motion-core`: Motion/animations
|
|
27
|
+
- `@hua-labs/i18n-core`: Internationalization
|
|
28
|
+
- `@hua-labs/ui`: UI component library
|
|
29
|
+
|
|
30
|
+
## Project Structure
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
Project Root/
|
|
34
|
+
├── app/ # Next.js App Router pages
|
|
35
|
+
│ ├── layout.tsx # Root layout (uses HuaUxLayout)
|
|
36
|
+
│ ├── page.tsx # Home page (uses HuaUxPage)
|
|
37
|
+
│ └── api/ # API Routes
|
|
38
|
+
│ └── translations/ # i18n translation API
|
|
39
|
+
│ └── [language]/[namespace]/route.ts
|
|
40
|
+
├── components/ # Reusable components
|
|
41
|
+
├── lib/ # Utility functions
|
|
42
|
+
│ └── i18n-setup.ts # i18n setup
|
|
43
|
+
├── store/ # Zustand stores
|
|
44
|
+
│ └── useAppStore.ts # Global state
|
|
45
|
+
├── translations/ # Translation files
|
|
46
|
+
│ ├── ko/ # Korean
|
|
47
|
+
│ │ └── common.json # Common translations
|
|
48
|
+
│ └── en/ # English
|
|
49
|
+
│ └── common.json # Common translations
|
|
50
|
+
└── hua-ux.config.ts # Framework configuration
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Available Components
|
|
54
|
+
|
|
55
|
+
### @hua-labs/ui (Core Components)
|
|
56
|
+
|
|
57
|
+
**Core UI**: `Button`, `Action`, `Input`, `Link`, `Icon`, `Avatar`, `Modal`
|
|
58
|
+
|
|
59
|
+
**Layout**: `Container`, `Grid`, `Stack`, `Divider`, `Card` (CardHeader, CardTitle, CardDescription, CardContent, CardFooter), `Panel`, `ActionToolbar`, `ComponentLayout`
|
|
60
|
+
|
|
61
|
+
**Navigation**: `Navigation`, `Breadcrumb`, `Pagination`, `PageNavigation`, `PageTransition`
|
|
62
|
+
|
|
63
|
+
**Data Display**: `Table`, `Badge`, `Progress`, `Skeleton` (various variants)
|
|
64
|
+
|
|
65
|
+
**Feedback**: `Alert` (Success, Warning, Error, Info), `Toast` (ToastProvider, useToast), `LoadingSpinner`, `Tooltip`
|
|
66
|
+
|
|
67
|
+
**Overlay**: `Popover`, `Dropdown`, `Drawer`, `BottomSheet`, `ConfirmModal`
|
|
68
|
+
|
|
69
|
+
**Form**: `Form`, `Label`, `Checkbox`, `Radio`, `Select`, `Switch`, `Slider`, `Textarea`, `DatePicker`, `Upload`, `Autocomplete`
|
|
70
|
+
|
|
71
|
+
**Interactive**: `Accordion`, `Tabs`, `Menu`, `ContextMenu`, `Command`
|
|
72
|
+
|
|
73
|
+
**Specialized**: `ScrollArea`, `ScrollToTop`, `ThemeProvider`, `ThemeToggle`, `useTheme`
|
|
74
|
+
|
|
75
|
+
### @hua-labs/hua-ux/framework
|
|
76
|
+
|
|
77
|
+
**Framework Components**:
|
|
78
|
+
- `HuaUxLayout`: Automatic Provider setup
|
|
79
|
+
- `HuaUxPage`: Page wrapper (Motion, i18n, SEO automatically applied)
|
|
80
|
+
- `UnifiedProviders`: All Providers unified
|
|
81
|
+
- `BrandedButton`, `BrandedCard`: Components with automatic branding
|
|
82
|
+
- `ErrorBoundary`: Error boundary
|
|
83
|
+
|
|
84
|
+
**Hooks**:
|
|
85
|
+
- `useMotion`: Unified motion hook
|
|
86
|
+
- `useData`: Client data fetching
|
|
87
|
+
- `useFocusManagement`, `useFocusTrap`: Accessibility hooks
|
|
88
|
+
- `useDelayedLoading`, `useLoadingState`: Loading state hooks
|
|
89
|
+
- `useLiveRegion`: Screen reader support
|
|
90
|
+
|
|
91
|
+
**Utilities**:
|
|
92
|
+
- `fetchData`: Server data fetching
|
|
93
|
+
- `generatePageMetadata`: SEO metadata generation
|
|
94
|
+
- `generateGEOMetadata`: GEO metadata generation
|
|
95
|
+
- `createI18nMiddleware`: i18n middleware creation
|
|
96
|
+
|
|
97
|
+
### @hua-labs/motion-core
|
|
98
|
+
|
|
99
|
+
**Motion Hooks**:
|
|
100
|
+
- `useFadeIn`, `useSlideUp`, `useSlideLeft`, `useSlideRight`, `useScaleIn`, `useBounceIn`, `usePulse`, `useSpringMotion`
|
|
101
|
+
- `useHoverMotion`, `useClickToggle`, `useFocusToggle`
|
|
102
|
+
- `useScrollReveal`, `useScrollProgress`
|
|
103
|
+
|
|
104
|
+
### @hua-labs/i18n-core
|
|
105
|
+
|
|
106
|
+
**i18n Hooks**:
|
|
107
|
+
- `useTranslation`: Translation hook
|
|
108
|
+
- `useLanguage`: Language change hook
|
|
109
|
+
|
|
110
|
+
## Key Patterns
|
|
111
|
+
|
|
112
|
+
### 1. Page Creation Pattern
|
|
113
|
+
|
|
114
|
+
```tsx
|
|
115
|
+
// app/my-page/page.tsx
|
|
116
|
+
import { HuaUxPage } from '@hua-labs/hua-ux/framework';
|
|
117
|
+
import { useTranslation } from '@hua-labs/i18n-core';
|
|
118
|
+
|
|
119
|
+
export default function MyPage() {
|
|
120
|
+
const { t } = useTranslation('my-page');
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
<HuaUxPage title={t('title')} description={t('description')}>
|
|
124
|
+
<h1>{t('title')}</h1>
|
|
125
|
+
{/* content */}
|
|
126
|
+
</HuaUxPage>
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Important**:
|
|
132
|
+
- Wrapping with `HuaUxPage` automatically applies Motion, i18n, SEO
|
|
133
|
+
- Add translation keys to `translations/{language}/my-page.json`
|
|
134
|
+
- Create as Server Component (add `'use client'` only when client features are needed)
|
|
135
|
+
|
|
136
|
+
### 2. Client Component Creation Pattern
|
|
137
|
+
|
|
138
|
+
```tsx
|
|
139
|
+
// components/MyComponent.tsx
|
|
140
|
+
'use client';
|
|
141
|
+
|
|
142
|
+
import { Card, Button } from '@hua-labs/ui';
|
|
143
|
+
import { useMotion } from '@hua-labs/hua-ux/framework';
|
|
144
|
+
import { useTranslation } from '@hua-labs/i18n-core';
|
|
145
|
+
|
|
146
|
+
export function MyComponent() {
|
|
147
|
+
const { t } = useTranslation('my-component');
|
|
148
|
+
const motion = useMotion();
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
<Card ref={motion.ref} style={motion.style}>
|
|
152
|
+
<h2>{t('title')}</h2>
|
|
153
|
+
<Button>{t('button')}</Button>
|
|
154
|
+
</Card>
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**Important**:
|
|
160
|
+
- Client components require `'use client'`
|
|
161
|
+
- Utilize framework components (`@hua-labs/ui`, `@hua-labs/motion-core`)
|
|
162
|
+
- Consider applying motion
|
|
163
|
+
|
|
164
|
+
### 3. Data Fetching Pattern
|
|
165
|
+
|
|
166
|
+
**Server Component**:
|
|
167
|
+
```tsx
|
|
168
|
+
// app/data/page.tsx
|
|
169
|
+
import { fetchData } from '@hua-labs/hua-ux/framework';
|
|
170
|
+
|
|
171
|
+
export default async function DataPage() {
|
|
172
|
+
const data = await fetchData<DataType>('/api/data');
|
|
173
|
+
return <div>{/* display data */}</div>;
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**Client Component**:
|
|
178
|
+
```tsx
|
|
179
|
+
// components/DataComponent.tsx
|
|
180
|
+
'use client';
|
|
181
|
+
|
|
182
|
+
import { useData } from '@hua-labs/hua-ux/framework';
|
|
183
|
+
import { LoadingSpinner, AlertError } from '@hua-labs/ui';
|
|
184
|
+
|
|
185
|
+
export function DataComponent() {
|
|
186
|
+
const { data, isLoading, error } = useData<DataType>('/api/data');
|
|
187
|
+
|
|
188
|
+
if (isLoading) return <LoadingSpinner />;
|
|
189
|
+
if (error) return <AlertError>{error.message}</AlertError>;
|
|
190
|
+
return <div>{/* display data */}</div>;
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### 4. Translation File Pattern
|
|
195
|
+
|
|
196
|
+
```json
|
|
197
|
+
// translations/ko/my-page.json
|
|
198
|
+
{
|
|
199
|
+
"title": "Title",
|
|
200
|
+
"description": "Description",
|
|
201
|
+
"button": "Button"
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// translations/en/my-page.json
|
|
205
|
+
{
|
|
206
|
+
"title": "Title",
|
|
207
|
+
"description": "Description",
|
|
208
|
+
"button": "Button"
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
**Important**:
|
|
213
|
+
- Add all translation keys to both Korean and English
|
|
214
|
+
- Namespace should match page name
|
|
215
|
+
- Use `common` namespace for shared translations
|
|
216
|
+
|
|
217
|
+
## Understanding Configuration
|
|
218
|
+
|
|
219
|
+
### hua-ux.config.ts
|
|
220
|
+
|
|
221
|
+
```typescript
|
|
222
|
+
import { defineConfig } from '@hua-labs/hua-ux/framework';
|
|
223
|
+
|
|
224
|
+
export default defineConfig({
|
|
225
|
+
preset: 'product', // 'product' or 'marketing'
|
|
226
|
+
|
|
227
|
+
i18n: {
|
|
228
|
+
defaultLanguage: 'ko',
|
|
229
|
+
supportedLanguages: ['ko', 'en'],
|
|
230
|
+
fallbackLanguage: 'en',
|
|
231
|
+
namespaces: ['common'],
|
|
232
|
+
translationLoader: 'api',
|
|
233
|
+
translationApiPath: '/api/translations',
|
|
234
|
+
},
|
|
235
|
+
|
|
236
|
+
motion: {
|
|
237
|
+
defaultPreset: 'product',
|
|
238
|
+
enableAnimations: true,
|
|
239
|
+
},
|
|
240
|
+
|
|
241
|
+
state: {
|
|
242
|
+
persist: true,
|
|
243
|
+
ssr: true,
|
|
244
|
+
},
|
|
245
|
+
});
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
**Preset Selection**:
|
|
249
|
+
- `'product'`: For product pages (professional, efficient)
|
|
250
|
+
- `'marketing'`: For marketing pages (dramatic, eye-catching)
|
|
251
|
+
|
|
252
|
+
**Branding Configuration** (optional):
|
|
253
|
+
```typescript
|
|
254
|
+
branding: {
|
|
255
|
+
colors: {
|
|
256
|
+
primary: '#000000',
|
|
257
|
+
secondary: '#666666',
|
|
258
|
+
},
|
|
259
|
+
typography: {
|
|
260
|
+
fontFamily: {
|
|
261
|
+
sans: ['Pretendard', 'sans-serif'],
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
## Guidelines for Claude Code Generation
|
|
268
|
+
|
|
269
|
+
1. **When Creating Pages**:
|
|
270
|
+
- Wrap with `HuaUxPage`
|
|
271
|
+
- Generate translation files together
|
|
272
|
+
- Use `useTranslation` hook
|
|
273
|
+
- Prefer Server Components (add `'use client'` only when client features are needed)
|
|
274
|
+
|
|
275
|
+
2. **When Creating Components**:
|
|
276
|
+
- Add `'use client'` directive (for client components)
|
|
277
|
+
- Utilize framework components
|
|
278
|
+
- Consider applying motion
|
|
279
|
+
- Consider accessibility (aria-label, etc.)
|
|
280
|
+
|
|
281
|
+
3. **When Adding Translations**:
|
|
282
|
+
- Add both Korean and English
|
|
283
|
+
- Maintain namespace consistency
|
|
284
|
+
- Use `common` namespace for shared translations
|
|
285
|
+
|
|
286
|
+
4. **When Changing Configuration**:
|
|
287
|
+
- Only modify `hua-ux.config.ts`
|
|
288
|
+
- Prefer Preset (over manual configuration)
|
|
289
|
+
|
|
290
|
+
5. **When Fetching Data**:
|
|
291
|
+
- Use `fetchData` in Server Components
|
|
292
|
+
- Use `useData` in Client Components
|
|
293
|
+
- Error handling is required
|
|
294
|
+
|
|
295
|
+
## Vibe Coding Friendly
|
|
296
|
+
|
|
297
|
+
This project supports **vibe coding**:
|
|
298
|
+
|
|
299
|
+
- **Noun-centered configuration**: `preset: 'product'` (expresses intent)
|
|
300
|
+
- **Many decisions in one file**: `HuaUxPage` handles SEO, Motion, i18n all together
|
|
301
|
+
- **AI-friendly documentation**: Clear and comprehensive
|
|
302
|
+
|
|
303
|
+
## References
|
|
304
|
+
|
|
305
|
+
- `ai-context.md`: Detailed project structure explanation
|
|
306
|
+
- `.cursorrules`: Cursor IDE rules
|
|
307
|
+
- Framework docs: `node_modules/@hua-labs/hua-ux/README.md`
|
|
308
|
+
- UI components: `node_modules/@hua-labs/ui/README.md`
|
|
309
|
+
- Motion: `node_modules/@hua-labs/motion-core/README.md`
|
|
310
|
+
- i18n: `node_modules/@hua-labs/i18n-core-zustand/README.md`
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hua-ux Framework Usage
|
|
3
|
+
description: Guide for developing Next.js applications using the hua-ux framework
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility:
|
|
6
|
+
- claude
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# hua-ux Framework Usage Skill
|
|
10
|
+
|
|
11
|
+
This skill guides you on how to develop Next.js applications using the hua-ux framework.
|
|
12
|
+
|
|
13
|
+
## 🚨 Required Guidelines for Claude Assistants
|
|
14
|
+
|
|
15
|
+
### Required Checks Before Using Framework
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
IF (creating a new page or component) THEN
|
|
19
|
+
1. Use hua-ux framework components first
|
|
20
|
+
→ Wrap page with `HuaUxPage`
|
|
21
|
+
→ Use components from `@hua-labs/ui` first
|
|
22
|
+
2. Generate translation files together
|
|
23
|
+
→ `translations/ko/{namespace}.json`
|
|
24
|
+
→ `translations/en/{namespace}.json`
|
|
25
|
+
3. Prefer Server Components
|
|
26
|
+
→ Add `'use client'` only when client features are needed
|
|
27
|
+
END IF
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Core Philosophy
|
|
31
|
+
|
|
32
|
+
**"You don't need to know Next.js. Just configure and tell AI what to do."**
|
|
33
|
+
|
|
34
|
+
## Framework Structure
|
|
35
|
+
|
|
36
|
+
### Top Layer: Framework & Config
|
|
37
|
+
- `hua-ux.config.ts`: Framework configuration
|
|
38
|
+
- `HuaUxLayout`: Automatic Provider setup
|
|
39
|
+
- `HuaUxPage`: Page wrapper (Motion, i18n, SEO automatically applied)
|
|
40
|
+
|
|
41
|
+
### Bottom Layer: Core Packages
|
|
42
|
+
- `@hua-labs/ui`: UI component library
|
|
43
|
+
- `@hua-labs/motion-core`: Motion/animations
|
|
44
|
+
- `@hua-labs/i18n-core`: Internationalization
|
|
45
|
+
- `@hua-labs/state`: State management
|
|
46
|
+
|
|
47
|
+
## Key Patterns
|
|
48
|
+
|
|
49
|
+
### 1. Page Creation Pattern
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
// app/my-page/page.tsx
|
|
53
|
+
import { HuaUxPage } from '@hua-labs/hua-ux/framework';
|
|
54
|
+
import { useTranslation } from '@hua-labs/i18n-core';
|
|
55
|
+
|
|
56
|
+
export default function MyPage() {
|
|
57
|
+
const { t } = useTranslation('my-page');
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<HuaUxPage title={t('title')} description={t('description')}>
|
|
61
|
+
<h1>{t('title')}</h1>
|
|
62
|
+
{/* content */}
|
|
63
|
+
</HuaUxPage>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Important**:
|
|
69
|
+
- Wrapping with `HuaUxPage` automatically applies Motion, i18n, SEO
|
|
70
|
+
- Add translation keys to `translations/{language}/my-page.json`
|
|
71
|
+
- Create as Server Component (default)
|
|
72
|
+
|
|
73
|
+
### 2. Client Component Creation Pattern
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
// components/MyComponent.tsx
|
|
77
|
+
'use client';
|
|
78
|
+
|
|
79
|
+
import { Card, Button } from '@hua-labs/ui';
|
|
80
|
+
import { useMotion } from '@hua-labs/hua-ux/framework';
|
|
81
|
+
import { useTranslation } from '@hua-labs/i18n-core';
|
|
82
|
+
|
|
83
|
+
export function MyComponent() {
|
|
84
|
+
const { t } = useTranslation('my-component');
|
|
85
|
+
const motion = useMotion();
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<Card ref={motion.ref} style={motion.style}>
|
|
89
|
+
<h2>{t('title')}</h2>
|
|
90
|
+
<Button>{t('button')}</Button>
|
|
91
|
+
</Card>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Important**:
|
|
97
|
+
- Client components require `'use client'`
|
|
98
|
+
- Utilize framework components (`@hua-labs/ui`, `@hua-labs/motion-core`)
|
|
99
|
+
|
|
100
|
+
### 3. Translation File Pattern
|
|
101
|
+
|
|
102
|
+
```json
|
|
103
|
+
// translations/ko/my-page.json
|
|
104
|
+
{
|
|
105
|
+
"title": "Title",
|
|
106
|
+
"description": "Description",
|
|
107
|
+
"button": "Button"
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// translations/en/my-page.json
|
|
111
|
+
{
|
|
112
|
+
"title": "Title",
|
|
113
|
+
"description": "Description",
|
|
114
|
+
"button": "Button"
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Important**:
|
|
119
|
+
- Add all translation keys to both Korean and English
|
|
120
|
+
- Namespace should match page name
|
|
121
|
+
|
|
122
|
+
## Available Components
|
|
123
|
+
|
|
124
|
+
### @hua-labs/ui
|
|
125
|
+
- `Button`, `Card`, `Input`, `Modal`, `Alert`, `Toast`, `Table`, `Form`, etc.
|
|
126
|
+
- See `ai-context.md` for detailed list
|
|
127
|
+
|
|
128
|
+
### @hua-labs/hua-ux/framework
|
|
129
|
+
- `HuaUxPage`: Page wrapper
|
|
130
|
+
- `HuaUxLayout`: Layout
|
|
131
|
+
- `UnifiedProviders`: Provider unification
|
|
132
|
+
- `useMotion`: Unified motion hook
|
|
133
|
+
- `useData`: Client data fetching
|
|
134
|
+
- `fetchData`: Server data fetching
|
|
135
|
+
|
|
136
|
+
## Configuration File
|
|
137
|
+
|
|
138
|
+
### hua-ux.config.ts
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
import { defineConfig } from '@hua-labs/hua-ux/framework';
|
|
142
|
+
|
|
143
|
+
export default defineConfig({
|
|
144
|
+
preset: 'product', // 'product' or 'marketing'
|
|
145
|
+
|
|
146
|
+
i18n: {
|
|
147
|
+
defaultLanguage: 'ko',
|
|
148
|
+
supportedLanguages: ['ko', 'en'],
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
motion: {
|
|
152
|
+
defaultPreset: 'product',
|
|
153
|
+
enableAnimations: true,
|
|
154
|
+
},
|
|
155
|
+
});
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**Preset Selection**:
|
|
159
|
+
- `'product'`: For product pages (professional, efficient)
|
|
160
|
+
- `'marketing'`: For marketing pages (dramatic, eye-catching)
|
|
161
|
+
|
|
162
|
+
## Guidelines for Claude Code Generation
|
|
163
|
+
|
|
164
|
+
1. **When Creating Pages**:
|
|
165
|
+
- Wrap with `HuaUxPage`
|
|
166
|
+
- Generate translation files together
|
|
167
|
+
- Use `useTranslation` hook
|
|
168
|
+
- Prefer Server Components
|
|
169
|
+
|
|
170
|
+
2. **When Creating Components**:
|
|
171
|
+
- Add `'use client'` directive (for client components)
|
|
172
|
+
- Utilize framework components
|
|
173
|
+
- Consider applying motion
|
|
174
|
+
|
|
175
|
+
3. **When Adding Translations**:
|
|
176
|
+
- Add both Korean and English
|
|
177
|
+
- Maintain namespace consistency
|
|
178
|
+
|
|
179
|
+
4. **When Changing Configuration**:
|
|
180
|
+
- Only modify `hua-ux.config.ts`
|
|
181
|
+
- Prefer Preset (over manual configuration)
|
|
182
|
+
|
|
183
|
+
## References
|
|
184
|
+
|
|
185
|
+
- `ai-context.md`: Detailed project structure explanation
|
|
186
|
+
- `.cursorrules`: Cursor IDE rules
|
|
187
|
+
- Framework docs: `node_modules/@hua-labs/hua-ux/README.md`
|