@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.
Files changed (46) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +183 -0
  3. package/dist/bin/create-hua-ux.d.ts +9 -0
  4. package/dist/bin/create-hua-ux.d.ts.map +1 -0
  5. package/dist/bin/create-hua-ux.js +37 -0
  6. package/dist/constants/versions.d.ts +55 -0
  7. package/dist/constants/versions.d.ts.map +1 -0
  8. package/dist/constants/versions.js +57 -0
  9. package/dist/create-project.d.ts +18 -0
  10. package/dist/create-project.d.ts.map +1 -0
  11. package/dist/create-project.js +237 -0
  12. package/dist/doctor.d.ts +21 -0
  13. package/dist/doctor.d.ts.map +1 -0
  14. package/dist/doctor.js +259 -0
  15. package/dist/index.d.ts +9 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +177 -0
  18. package/dist/utils.d.ts +108 -0
  19. package/dist/utils.d.ts.map +1 -0
  20. package/dist/utils.js +896 -0
  21. package/dist/version.d.ts +9 -0
  22. package/dist/version.d.ts.map +1 -0
  23. package/dist/version.js +11 -0
  24. package/package.json +46 -0
  25. package/templates/nextjs/.claude/project-context.md +310 -0
  26. package/templates/nextjs/.claude/skills/hua-ux-framework/SKILL.md +187 -0
  27. package/templates/nextjs/.cursorrules +302 -0
  28. package/templates/nextjs/.eslintrc.json +1 -0
  29. package/templates/nextjs/README.md +431 -0
  30. package/templates/nextjs/ai-context.md +332 -0
  31. package/templates/nextjs/app/api/translations/[language]/[namespace]/route.ts +86 -0
  32. package/templates/nextjs/app/globals.css +24 -0
  33. package/templates/nextjs/app/layout-with-geo.example.tsx +106 -0
  34. package/templates/nextjs/app/layout.tsx +30 -0
  35. package/templates/nextjs/app/page-with-geo.example.tsx +80 -0
  36. package/templates/nextjs/app/page.tsx +28 -0
  37. package/templates/nextjs/components/I18nProviderWrapper.tsx +19 -0
  38. package/templates/nextjs/lib/i18n-setup.ts +11 -0
  39. package/templates/nextjs/middleware.ts.example +22 -0
  40. package/templates/nextjs/next.config.ts +36 -0
  41. package/templates/nextjs/postcss.config.js +6 -0
  42. package/templates/nextjs/store/useAppStore.ts +8 -0
  43. package/templates/nextjs/tailwind.config.js +8 -0
  44. package/templates/nextjs/translations/en/common.json +6 -0
  45. package/templates/nextjs/translations/ko/common.json +6 -0
  46. package/templates/nextjs/tsconfig.json +41 -0
@@ -0,0 +1,302 @@
1
+ # hua-ux Project Cursor Rules
2
+
3
+ This project uses the **hua-ux framework** for Next.js applications.
4
+
5
+ ## Core Philosophy
6
+
7
+ **"You don't need to know Next.js. Just configure and tell AI what to do."**
8
+
9
+ ## Project Structure
10
+
11
+ - `app/`: Next.js App Router pages (use HuaUxPage)
12
+ - `components/`: Reusable components
13
+ - `lib/`: Utility functions
14
+ - `store/`: Zustand stores
15
+ - `translations/`: Translation files (ko/, en/)
16
+ - `hua-ux.config.ts`: Framework configuration
17
+
18
+ ## Available Components
19
+
20
+ ### @hua-labs/ui (Core Components)
21
+
22
+ **Core UI**:
23
+ - `Button`, `Action`, `Input`, `Link`, `Icon`, `Avatar`, `Modal`
24
+
25
+ **Layout**:
26
+ - `Container`, `Grid`, `Stack`, `Divider`, `Card` (CardHeader, CardTitle, CardDescription, CardContent, CardFooter), `Panel`, `ActionToolbar`, `ComponentLayout`
27
+
28
+ **Navigation**:
29
+ - `Navigation`, `Breadcrumb`, `Pagination`, `PageNavigation`, `PageTransition`
30
+
31
+ **Data Display**:
32
+ - `Table`, `Badge`, `Progress`, `Skeleton` (various variants)
33
+
34
+ **Feedback**:
35
+ - `Alert` (Success, Warning, Error, Info), `Toast` (ToastProvider, useToast), `LoadingSpinner`, `Tooltip`
36
+
37
+ **Overlay**:
38
+ - `Popover`, `Dropdown`, `Drawer`, `BottomSheet`, `ConfirmModal`
39
+
40
+ **Form**:
41
+ - `Form`, `Label`, `Checkbox`, `Radio`, `Select`, `Switch`, `Slider`, `Textarea`, `DatePicker`, `Upload`, `Autocomplete`
42
+
43
+ **Interactive**:
44
+ - `Accordion`, `Tabs`, `Menu`, `ContextMenu`, `Command`
45
+
46
+ **Specialized**:
47
+ - `ScrollArea`, `ScrollToTop`, `ThemeProvider`, `ThemeToggle`, `useTheme`
48
+
49
+ **Icons**:
50
+ - `Icon`, `EmotionIcon`, `StatusIcon`, `LoadingIcon`, `SuccessIcon`, `ErrorIcon`
51
+ - Icon providers: Phosphor Icons (default), Lucide React
52
+
53
+ ### @hua-labs/hua-ux/framework
54
+
55
+ **Framework Components**:
56
+ - `HuaUxLayout`: Automatic Provider setup
57
+ - `HuaUxPage`: Page wrapper (Motion, i18n, SEO automatically applied)
58
+ - `UnifiedProviders`: All Providers unified
59
+ - `BrandedButton`, `BrandedCard`: Components with automatic branding
60
+ - `ErrorBoundary`: Error boundary
61
+
62
+ **Hooks**:
63
+ - `useMotion`: Unified motion hook
64
+ - `useData`: Client data fetching
65
+ - `useFocusManagement`, `useFocusTrap`: Accessibility hooks
66
+ - `useDelayedLoading`, `useLoadingState`: Loading state hooks
67
+ - `useLiveRegion`: Screen reader support
68
+
69
+ **Utilities**:
70
+ - `fetchData`: Server data fetching
71
+ - `generatePageMetadata`: SEO metadata generation
72
+ - `generateGEOMetadata`: GEO metadata generation
73
+ - `createI18nMiddleware`: i18n middleware creation
74
+
75
+ **Configuration**:
76
+ - `defineConfig`: Framework configuration definition
77
+ - `getConfig`: Get configuration
78
+
79
+ ### @hua-labs/motion-core
80
+
81
+ **Motion Hooks**:
82
+ - `useFadeIn`, `useSlideUp`, `useSlideLeft`, `useSlideRight`, `useScaleIn`, `useBounceIn`, `usePulse`, `useSpringMotion`
83
+ - `useHoverMotion`, `useClickToggle`, `useFocusToggle`
84
+ - `useScrollReveal`, `useScrollProgress`
85
+
86
+ ### @hua-labs/i18n-core
87
+
88
+ **i18n Hooks**:
89
+ - `useTranslation`: Translation hook
90
+ - `useLanguage`: Language change hook
91
+
92
+ ## Code Generation Rules
93
+
94
+ ### When Creating Pages
95
+
96
+ 1. **Always wrap with `HuaUxPage`**:
97
+ ```tsx
98
+ import { HuaUxPage } from '@hua-labs/hua-ux/framework';
99
+ import { useTranslation } from '@hua-labs/i18n-core';
100
+
101
+ export default function MyPage() {
102
+ const { t } = useTranslation('my-page');
103
+
104
+ return (
105
+ <HuaUxPage
106
+ title={t('title')}
107
+ description={t('description')}
108
+ // SEO metadata is automatically generated
109
+ >
110
+ <h1>{t('title')}</h1>
111
+ {/* content */}
112
+ </HuaUxPage>
113
+ );
114
+ }
115
+ ```
116
+
117
+ 2. **Generate translation files too**:
118
+ - `translations/ko/my-page.json`
119
+ - `translations/en/my-page.json`
120
+
121
+ ```json
122
+ {
123
+ "title": "Page Title",
124
+ "description": "Page Description"
125
+ }
126
+ ```
127
+
128
+ 3. **Prefer Server Components**:
129
+ - Create as Server Component by default
130
+ - Add `'use client'` only when client features are needed
131
+
132
+ ### When Creating Components
133
+
134
+ 1. **Client components require `'use client'`**
135
+ 2. **Use framework components**:
136
+ ```tsx
137
+ 'use client';
138
+
139
+ import { Card, Button } from '@hua-labs/ui';
140
+ import { useFadeIn } from '@hua-labs/motion-core';
141
+ import { useTranslation } from '@hua-labs/i18n-core';
142
+
143
+ export function MyComponent() {
144
+ const { t } = useTranslation('my-component');
145
+ const motion = useFadeIn();
146
+
147
+ return (
148
+ <Card ref={motion.ref} style={motion.style}>
149
+ <h2>{t('title')}</h2>
150
+ <Button>{t('button')}</Button>
151
+ </Card>
152
+ );
153
+ }
154
+ ```
155
+
156
+ 3. **Consider motion**:
157
+ - Wrapping with `HuaUxPage` automatically applies motion
158
+ - Individual components can use `useMotion` or individual motion hooks
159
+
160
+ ### When Adding Translations
161
+
162
+ 1. **Add both Korean and English**
163
+ 2. **Maintain namespace consistency**
164
+ 3. **File name matches page/component name**
165
+ 4. **Use `common` namespace for shared translations**
166
+
167
+ ### When Changing Configuration
168
+
169
+ 1. **Only modify `hua-ux.config.ts`**
170
+ 2. **Prefer Preset over manual configuration**:
171
+ ```typescript
172
+ // Good: Use Preset
173
+ export default defineConfig({
174
+ preset: 'product', // or 'marketing'
175
+ });
176
+
177
+ // Avoid: Direct configuration (only when needed)
178
+ export default defineConfig({
179
+ motion: { /* ... */ },
180
+ i18n: { /* ... */ },
181
+ });
182
+ ```
183
+
184
+ ## Key Patterns
185
+
186
+ ### Preset System
187
+
188
+ - `'product'`: For product pages (professional, efficient)
189
+ - `'marketing'`: For marketing pages (dramatic, eye-catching)
190
+
191
+ ### Branding
192
+
193
+ - Customize colors and typography with `branding` setting in `hua-ux.config.ts`
194
+ - All components automatically apply branding
195
+ - `BrandedButton`, `BrandedCard` automatically apply branding
196
+
197
+ ### Motion
198
+
199
+ - Wrapping with `HuaUxPage` automatically applies motion
200
+ - Can be disabled with `enableMotion={false}`
201
+ - Individual components can use `useMotion` or individual motion hooks
202
+
203
+ ### i18n / Internationalization
204
+
205
+ - Use `useTranslation` hook for translations
206
+ - Translation files are in `translations/{language}/{namespace}.json`
207
+ - API Route: `/api/translations/{language}/{namespace}`
208
+
209
+ ### SEO / Search Engine Optimization
210
+
211
+ - Providing `title` and `description` to `HuaUxPage` automatically generates SEO metadata
212
+ - Can generate GEO metadata with `generateGEOMetadata`
213
+
214
+ ## When AI Generates Code
215
+
216
+ 1. **Prefer framework components**
217
+ - Use components from `@hua-labs/ui` first
218
+ - Utilize framework components from `@hua-labs/hua-ux/framework`
219
+
220
+ 2. **Auto-apply based on config**
221
+ - Settings in `hua-ux.config.ts` are automatically applied
222
+ - Preset usage recommended
223
+
224
+ 3. **Always generate translation keys together**
225
+ - Generate translation files when creating pages/components
226
+ - Provide both Korean and English
227
+
228
+ 4. **Maintain type safety**
229
+ - Explicitly specify TypeScript types
230
+ - Avoid using `any`
231
+
232
+ 5. **Prefer Server Components**
233
+ - Add `'use client'` only when client features are needed
234
+
235
+ 6. **Consider accessibility**
236
+ - Use `aria-label`, `aria-describedby` appropriately
237
+ - Support keyboard navigation
238
+
239
+ ## Common Patterns
240
+
241
+ ### Page Creation Pattern
242
+ ```tsx
243
+ import { HuaUxPage } from '@hua-labs/hua-ux/framework';
244
+ import { useTranslation } from '@hua-labs/i18n-core';
245
+
246
+ export default function MyPage() {
247
+ const { t } = useTranslation('my-page');
248
+ return (
249
+ <HuaUxPage title={t('title')} description={t('description')}>
250
+ {/* content */}
251
+ </HuaUxPage>
252
+ );
253
+ }
254
+ ```
255
+
256
+ ### Client Component Pattern
257
+ ```tsx
258
+ 'use client';
259
+
260
+ import { Card, Button } from '@hua-labs/ui';
261
+ import { useMotion } from '@hua-labs/hua-ux/framework';
262
+
263
+ export function MyComponent() {
264
+ const motion = useMotion();
265
+ return (
266
+ <Card ref={motion.ref} style={motion.style}>
267
+ {/* content */}
268
+ </Card>
269
+ );
270
+ }
271
+ ```
272
+
273
+ ### Data Fetching Pattern
274
+ ```tsx
275
+ // Server Component
276
+ import { fetchData } from '@hua-labs/hua-ux/framework';
277
+
278
+ export default async function MyPage() {
279
+ const data = await fetchData<MyDataType>('/api/data');
280
+ return <div>{/* display data */}</div>;
281
+ }
282
+
283
+ // Client Component
284
+ 'use client';
285
+ import { useData } from '@hua-labs/hua-ux/framework';
286
+
287
+ export function MyComponent() {
288
+ const { data, isLoading, error } = useData<MyDataType>('/api/data');
289
+ if (isLoading) return <LoadingSpinner />;
290
+ if (error) return <AlertError>{error.message}</AlertError>;
291
+ return <div>{/* display data */}</div>;
292
+ }
293
+ ```
294
+
295
+ ## References
296
+
297
+ - `ai-context.md`: Detailed project structure explanation
298
+ - `hua-ux.config.ts`: Framework configuration file
299
+ - Framework docs: `node_modules/@hua-labs/hua-ux/README.md`
300
+ - UI components: `node_modules/@hua-labs/ui/README.md`
301
+ - Motion: `node_modules/@hua-labs/motion-core/README.md`
302
+ - i18n: `node_modules/@hua-labs/i18n-core-zustand/README.md`
@@ -0,0 +1 @@
1
+ {"extends": "next/core-web-vitals"}