create-huenei-template 0.2.2 → 0.2.4

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 (87) hide show
  1. package/dist/config/templates.js +3 -3
  2. package/dist/templates/frontend/angular-base/.cursor/skills/angular-component/SKILL.md +288 -0
  3. package/dist/templates/frontend/angular-base/.cursor/skills/angular-component/references/component-patterns.md +358 -0
  4. package/dist/templates/frontend/angular-base/.cursor/skills/angular-di/SKILL.md +387 -0
  5. package/dist/templates/frontend/angular-base/.cursor/skills/angular-di/references/di-patterns.md +519 -0
  6. package/dist/templates/frontend/angular-base/.cursor/skills/angular-directives/SKILL.md +437 -0
  7. package/dist/templates/frontend/angular-base/.cursor/skills/angular-directives/references/directive-patterns.md +570 -0
  8. package/dist/templates/frontend/angular-base/.cursor/skills/angular-forms/SKILL.md +434 -0
  9. package/dist/templates/frontend/angular-base/.cursor/skills/angular-forms/references/form-patterns.md +398 -0
  10. package/dist/templates/frontend/angular-base/.cursor/skills/angular-http/SKILL.md +366 -0
  11. package/dist/templates/frontend/angular-base/.cursor/skills/angular-http/references/http-patterns.md +448 -0
  12. package/dist/templates/frontend/angular-base/.cursor/skills/angular-routing/SKILL.md +395 -0
  13. package/dist/templates/frontend/angular-base/.cursor/skills/angular-routing/references/routing-patterns.md +472 -0
  14. package/dist/templates/frontend/angular-base/.cursor/skills/angular-signals/SKILL.md +302 -0
  15. package/dist/templates/frontend/angular-base/.cursor/skills/angular-signals/references/signal-patterns.md +404 -0
  16. package/dist/templates/frontend/angular-base/.cursor/skills/angular-ssr/SKILL.md +435 -0
  17. package/dist/templates/frontend/angular-base/.cursor/skills/angular-ssr/references/ssr-patterns.md +497 -0
  18. package/dist/templates/frontend/angular-base/.cursor/skills/angular-testing/SKILL.md +660 -0
  19. package/dist/templates/frontend/angular-base/.cursor/skills/angular-testing/references/testing-patterns.md +707 -0
  20. package/dist/templates/frontend/angular-base/.cursor/skills/angular-tooling/SKILL.md +352 -0
  21. package/dist/templates/frontend/angular-base/.cursor/skills/angular-tooling/references/tooling-patterns.md +448 -0
  22. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-accessibility/SKILL.md +780 -0
  23. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-components/SKILL.md +718 -0
  24. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-design-systems/SKILL.md +612 -0
  25. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-layouts/SKILL.md +594 -0
  26. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/SKILL.md +432 -0
  27. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/references/animation-patterns.md +427 -0
  28. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/SKILL.md +354 -0
  29. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/references/troubleshooting-guide.md +306 -0
  30. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/SKILL.md +578 -0
  31. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/references/react-patterns.md +353 -0
  32. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/SKILL.md +608 -0
  33. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/advanced-theme-patterns.md +215 -0
  34. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/custom-utilities-guide.md +281 -0
  35. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-mobile-first/SKILL.md +768 -0
  36. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/SKILL.md +374 -0
  37. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/references/bundle-optimization.md +244 -0
  38. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-plugins/SKILL.md +505 -0
  39. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/SKILL.md +601 -0
  40. package/dist/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/references/advanced-responsive-patterns.md +485 -0
  41. package/dist/templates/frontend/angular-base/.cursor/skills/web-design-guidelines/SKILL.md +39 -0
  42. package/dist/templates/frontend/angular-base/package.json +0 -1
  43. package/dist/templates/frontend/angular-base/pnpm-lock.yaml +8183 -0
  44. package/package.json +1 -1
  45. package/templates/frontend/angular-base/.cursor/skills/angular-component/SKILL.md +288 -0
  46. package/templates/frontend/angular-base/.cursor/skills/angular-component/references/component-patterns.md +358 -0
  47. package/templates/frontend/angular-base/.cursor/skills/angular-di/SKILL.md +387 -0
  48. package/templates/frontend/angular-base/.cursor/skills/angular-di/references/di-patterns.md +519 -0
  49. package/templates/frontend/angular-base/.cursor/skills/angular-directives/SKILL.md +437 -0
  50. package/templates/frontend/angular-base/.cursor/skills/angular-directives/references/directive-patterns.md +570 -0
  51. package/templates/frontend/angular-base/.cursor/skills/angular-forms/SKILL.md +434 -0
  52. package/templates/frontend/angular-base/.cursor/skills/angular-forms/references/form-patterns.md +398 -0
  53. package/templates/frontend/angular-base/.cursor/skills/angular-http/SKILL.md +366 -0
  54. package/templates/frontend/angular-base/.cursor/skills/angular-http/references/http-patterns.md +448 -0
  55. package/templates/frontend/angular-base/.cursor/skills/angular-routing/SKILL.md +395 -0
  56. package/templates/frontend/angular-base/.cursor/skills/angular-routing/references/routing-patterns.md +472 -0
  57. package/templates/frontend/angular-base/.cursor/skills/angular-signals/SKILL.md +302 -0
  58. package/templates/frontend/angular-base/.cursor/skills/angular-signals/references/signal-patterns.md +404 -0
  59. package/templates/frontend/angular-base/.cursor/skills/angular-ssr/SKILL.md +435 -0
  60. package/templates/frontend/angular-base/.cursor/skills/angular-ssr/references/ssr-patterns.md +497 -0
  61. package/templates/frontend/angular-base/.cursor/skills/angular-testing/SKILL.md +660 -0
  62. package/templates/frontend/angular-base/.cursor/skills/angular-testing/references/testing-patterns.md +707 -0
  63. package/templates/frontend/angular-base/.cursor/skills/angular-tooling/SKILL.md +352 -0
  64. package/templates/frontend/angular-base/.cursor/skills/angular-tooling/references/tooling-patterns.md +448 -0
  65. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-accessibility/SKILL.md +780 -0
  66. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-components/SKILL.md +718 -0
  67. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-design-systems/SKILL.md +612 -0
  68. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-advanced-layouts/SKILL.md +594 -0
  69. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/SKILL.md +432 -0
  70. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-animations/references/animation-patterns.md +427 -0
  71. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/SKILL.md +354 -0
  72. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-debugging/references/troubleshooting-guide.md +306 -0
  73. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/SKILL.md +578 -0
  74. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-framework-integration/references/react-patterns.md +353 -0
  75. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/SKILL.md +608 -0
  76. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/advanced-theme-patterns.md +215 -0
  77. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-fundamentals-v4/references/custom-utilities-guide.md +281 -0
  78. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-mobile-first/SKILL.md +768 -0
  79. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/SKILL.md +374 -0
  80. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-performance/references/bundle-optimization.md +244 -0
  81. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-plugins/SKILL.md +505 -0
  82. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/SKILL.md +601 -0
  83. package/templates/frontend/angular-base/.cursor/skills/tailwindcss-responsive-darkmode/references/advanced-responsive-patterns.md +485 -0
  84. package/templates/frontend/angular-base/.cursor/skills/web-design-guidelines/SKILL.md +39 -0
  85. package/templates/frontend/angular-base/package.json +0 -1
  86. package/templates/frontend/angular-base/pnpm-lock.yaml +8183 -0
  87. package/templates/frontend/angular-base/package-lock.json +0 -13321
@@ -0,0 +1,395 @@
1
+ ---
2
+ name: angular-routing
3
+ description: Implement routing in Angular v20+ applications with lazy loading, functional guards, resolvers, and route parameters. Use for navigation setup, protected routes, route-based data loading, and nested routing. Triggers on route configuration, adding authentication guards, implementing lazy loading, or reading route parameters with signals.
4
+ ---
5
+
6
+ # Angular Routing
7
+
8
+ Configure routing in Angular v20+ with lazy loading, functional guards, and signal-based route parameters.
9
+
10
+ ## Basic Setup
11
+
12
+ ```typescript
13
+ // app.routes.ts
14
+ import { Routes } from '@angular/router';
15
+
16
+ export const routes: Routes = [
17
+ { path: '', redirectTo: '/home', pathMatch: 'full' },
18
+ { path: 'home', component: Home },
19
+ { path: 'about', component: About },
20
+ { path: '**', component: NotFound },
21
+ ];
22
+
23
+ // app.config.ts
24
+ import { ApplicationConfig } from '@angular/core';
25
+ import { provideRouter } from '@angular/router';
26
+ import { routes } from './app.routes';
27
+
28
+ export const appConfig: ApplicationConfig = {
29
+ providers: [
30
+ provideRouter(routes),
31
+ ],
32
+ };
33
+
34
+ // app.component.ts
35
+ import { Component } from '@angular/core';
36
+ import { RouterOutlet, RouterLink, RouterLinkActive } from '@angular/router';
37
+
38
+ @Component({
39
+ selector: 'app-root',
40
+ imports: [RouterOutlet, RouterLink, RouterLinkActive],
41
+ template: `
42
+ <nav>
43
+ <a routerLink="/home" routerLinkActive="active">Home</a>
44
+ <a routerLink="/about" routerLinkActive="active">About</a>
45
+ </nav>
46
+ <router-outlet />
47
+ `,
48
+ })
49
+ export class App {}
50
+ ```
51
+
52
+ ## Lazy Loading
53
+
54
+ Load feature modules on demand:
55
+
56
+ ```typescript
57
+ // app.routes.ts
58
+ export const routes: Routes = [
59
+ { path: '', redirectTo: '/home', pathMatch: 'full' },
60
+ { path: 'home', component: Home },
61
+
62
+ // Lazy load entire feature
63
+ {
64
+ path: 'admin',
65
+ loadChildren: () => import('./admin/admin.routes').then(m => m.adminRoutes),
66
+ },
67
+
68
+ // Lazy load single component
69
+ {
70
+ path: 'settings',
71
+ loadComponent: () => import('./settings/settings.component').then(m => m.Settings),
72
+ },
73
+ ];
74
+
75
+ // admin/admin.routes.ts
76
+ export const adminRoutes: Routes = [
77
+ { path: '', component: AdminDashboard },
78
+ { path: 'users', component: AdminUsers },
79
+ { path: 'settings', component: AdminSettings },
80
+ ];
81
+ ```
82
+
83
+ ## Route Parameters
84
+
85
+ ### With Signal Inputs (Recommended)
86
+
87
+ ```typescript
88
+ // Route config
89
+ { path: 'users/:id', component: UserDetail }
90
+
91
+ // Component - use input() for route params
92
+ import { Component, input, computed } from '@angular/core';
93
+
94
+ @Component({
95
+ selector: 'app-user-detail',
96
+ template: `
97
+ <h1>User {{ id() }}</h1>
98
+ `,
99
+ })
100
+ export class UserDetail {
101
+ // Route param as signal input
102
+ id = input.required<string>();
103
+
104
+ // Computed based on route param
105
+ userId = computed(() => parseInt(this.id(), 10));
106
+ }
107
+ ```
108
+
109
+ Enable with `withComponentInputBinding()`:
110
+
111
+ ```typescript
112
+ // app.config.ts
113
+ import { provideRouter, withComponentInputBinding } from '@angular/router';
114
+
115
+ export const appConfig: ApplicationConfig = {
116
+ providers: [
117
+ provideRouter(routes, withComponentInputBinding()),
118
+ ],
119
+ };
120
+ ```
121
+
122
+ ### Query Parameters
123
+
124
+ ```typescript
125
+ // Route: /search?q=angular&page=1
126
+
127
+ @Component({...})
128
+ export class Search {
129
+ // Query params as inputs
130
+ q = input<string>('');
131
+ page = input<string>('1');
132
+
133
+ currentPage = computed(() => parseInt(this.page(), 10));
134
+ }
135
+ ```
136
+
137
+ ### With ActivatedRoute (Alternative)
138
+
139
+ ```typescript
140
+ import { Component, inject } from '@angular/core';
141
+ import { ActivatedRoute } from '@angular/router';
142
+ import { toSignal } from '@angular/core/rxjs-interop';
143
+ import { map } from 'rxjs';
144
+
145
+ @Component({...})
146
+ export class UserDetail {
147
+ private route = inject(ActivatedRoute);
148
+
149
+ // Convert route params to signal
150
+ id = toSignal(
151
+ this.route.paramMap.pipe(map(params => params.get('id'))),
152
+ { initialValue: null }
153
+ );
154
+
155
+ // Query params
156
+ query = toSignal(
157
+ this.route.queryParamMap.pipe(map(params => params.get('q'))),
158
+ { initialValue: '' }
159
+ );
160
+ }
161
+ ```
162
+
163
+ ## Functional Guards
164
+
165
+ ### Auth Guard
166
+
167
+ ```typescript
168
+ // guards/auth.guard.ts
169
+ import { inject } from '@angular/core';
170
+ import { CanActivateFn, Router } from '@angular/router';
171
+
172
+ export const authGuard: CanActivateFn = (route, state) => {
173
+ const authService = inject(Auth);
174
+ const router = inject(Router);
175
+
176
+ if (authService.isAuthenticated()) {
177
+ return true;
178
+ }
179
+
180
+ // Redirect to login with return URL
181
+ return router.createUrlTree(['/login'], {
182
+ queryParams: { returnUrl: state.url },
183
+ });
184
+ };
185
+
186
+ // Usage in routes
187
+ {
188
+ path: 'dashboard',
189
+ component: Dashboard,
190
+ canActivate: [authGuard],
191
+ }
192
+ ```
193
+
194
+ ### Role Guard
195
+
196
+ ```typescript
197
+ export const roleGuard = (allowedRoles: string[]): CanActivateFn => {
198
+ return (route, state) => {
199
+ const authService = inject(Auth);
200
+ const router = inject(Router);
201
+
202
+ const userRole = authService.currentUser()?.role;
203
+
204
+ if (userRole && allowedRoles.includes(userRole)) {
205
+ return true;
206
+ }
207
+
208
+ return router.createUrlTree(['/unauthorized']);
209
+ };
210
+ };
211
+
212
+ // Usage
213
+ {
214
+ path: 'admin',
215
+ component: Admin,
216
+ canActivate: [authGuard, roleGuard(['admin', 'superadmin'])],
217
+ }
218
+ ```
219
+
220
+ ### Can Deactivate Guard
221
+
222
+ ```typescript
223
+ export interface CanDeactivate {
224
+ canDeactivate: () => boolean | Promise<boolean>;
225
+ }
226
+
227
+ export const unsavedChangesGuard: CanDeactivateFn<CanDeactivate> = (component) => {
228
+ if (component.canDeactivate()) {
229
+ return true;
230
+ }
231
+
232
+ return confirm('You have unsaved changes. Leave anyway?');
233
+ };
234
+
235
+ // Component implementation
236
+ @Component({...})
237
+ export class Edit implements CanDeactivate {
238
+ form = inject(FormBuilder).group({...});
239
+
240
+ canDeactivate(): boolean {
241
+ return !this.form.dirty;
242
+ }
243
+ }
244
+
245
+ // Route
246
+ {
247
+ path: 'edit/:id',
248
+ component: Edit,
249
+ canDeactivate: [unsavedChangesGuard],
250
+ }
251
+ ```
252
+
253
+ ## Resolvers
254
+
255
+ Pre-fetch data before route activation:
256
+
257
+ ```typescript
258
+ // resolvers/user.resolver.ts
259
+ import { inject } from '@angular/core';
260
+ import { ResolveFn } from '@angular/router';
261
+
262
+ export const userResolver: ResolveFn<User> = (route) => {
263
+ const userService = inject(User);
264
+ const id = route.paramMap.get('id')!;
265
+ return userService.getById(id);
266
+ };
267
+
268
+ // Route config
269
+ {
270
+ path: 'users/:id',
271
+ component: UserDetail,
272
+ resolve: { user: userResolver },
273
+ }
274
+
275
+ // Component - access resolved data via input
276
+ @Component({...})
277
+ export class UserDetail {
278
+ user = input.required<User>();
279
+ }
280
+ ```
281
+
282
+ ## Nested Routes
283
+
284
+ ```typescript
285
+ // Parent route with children
286
+ export const routes: Routes = [
287
+ {
288
+ path: 'products',
289
+ component: ProductsLayout,
290
+ children: [
291
+ { path: '', component: ProductList },
292
+ { path: ':id', component: ProductDetail },
293
+ { path: ':id/edit', component: ProductEdit },
294
+ ],
295
+ },
296
+ ];
297
+
298
+ // ProductsLayout
299
+ @Component({
300
+ imports: [RouterOutlet],
301
+ template: `
302
+ <h1>Products</h1>
303
+ <router-outlet /> <!-- Child routes render here -->
304
+ `,
305
+ })
306
+ export class ProductsLayout {}
307
+ ```
308
+
309
+ ## Programmatic Navigation
310
+
311
+ ```typescript
312
+ import { Component, inject } from '@angular/core';
313
+ import { Router } from '@angular/router';
314
+
315
+ @Component({...})
316
+ export class Product {
317
+ private router = inject(Router);
318
+
319
+ // Navigate to route
320
+ goToProducts() {
321
+ this.router.navigate(['/products']);
322
+ }
323
+
324
+ // Navigate with params
325
+ goToProduct(id: string) {
326
+ this.router.navigate(['/products', id]);
327
+ }
328
+
329
+ // Navigate with query params
330
+ search(query: string) {
331
+ this.router.navigate(['/search'], {
332
+ queryParams: { q: query, page: 1 },
333
+ });
334
+ }
335
+
336
+ // Navigate relative to current route
337
+ goToEdit() {
338
+ this.router.navigate(['edit'], { relativeTo: this.route });
339
+ }
340
+
341
+ // Replace current history entry
342
+ replaceUrl() {
343
+ this.router.navigate(['/new-page'], { replaceUrl: true });
344
+ }
345
+ }
346
+ ```
347
+
348
+ ## Route Data
349
+
350
+ ```typescript
351
+ // Static route data
352
+ {
353
+ path: 'admin',
354
+ component: Admin,
355
+ data: {
356
+ title: 'Admin Dashboard',
357
+ roles: ['admin'],
358
+ },
359
+ }
360
+
361
+ // Access in component
362
+ @Component({...})
363
+ export class AdminCmpt {
364
+ title = input<string>(); // From route data
365
+ roles = input<string[]>(); // From route data
366
+ }
367
+
368
+ // Or via ActivatedRoute
369
+ private route = inject(ActivatedRoute);
370
+ data = toSignal(this.route.data);
371
+ ```
372
+
373
+ ## Router Events
374
+
375
+ ```typescript
376
+ import { Router, NavigationStart, NavigationEnd } from '@angular/router';
377
+ import { filter } from 'rxjs';
378
+
379
+ @Component({...})
380
+ export class AppMain {
381
+ private router = inject(Router);
382
+
383
+ isNavigating = signal(false);
384
+
385
+ constructor() {
386
+ this.router.events.pipe(
387
+ filter(e => e instanceof NavigationStart || e instanceof NavigationEnd)
388
+ ).subscribe(event => {
389
+ this.isNavigating.set(event instanceof NavigationStart);
390
+ });
391
+ }
392
+ }
393
+ ```
394
+
395
+ For advanced patterns, see [references/routing-patterns.md](references/routing-patterns.md).