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,387 @@
1
+ ---
2
+ name: angular-di
3
+ description: Implement dependency injection in Angular v20+ using inject(), injection tokens, and provider configuration. Use for service architecture, providing dependencies at different levels, creating injectable tokens, and managing singleton vs scoped services. Triggers on service creation, configuring providers, using injection tokens, or understanding DI hierarchy.
4
+ ---
5
+
6
+ # Angular Dependency Injection
7
+
8
+ Configure and use dependency injection in Angular v20+ with `inject()` and providers.
9
+
10
+ ## Basic Injection
11
+
12
+ ### Using inject()
13
+
14
+ Prefer `inject()` over constructor injection:
15
+
16
+ ```typescript
17
+ import { Component, inject } from '@angular/core';
18
+ import { HttpClient } from '@angular/common/http';
19
+ import { User } from './user.service';
20
+
21
+ @Component({
22
+ selector: 'app-user-list',
23
+ template: `...`,
24
+ })
25
+ export class UserList {
26
+ // Inject dependencies
27
+ private http = inject(HttpClient);
28
+ private userService = inject(User);
29
+
30
+ // Can use immediately
31
+ users = this.userService.getUsers();
32
+ }
33
+ ```
34
+
35
+ ### Injectable Services
36
+
37
+ ```typescript
38
+ import { Injectable, inject, signal } from '@angular/core';
39
+ import { HttpClient } from '@angular/common/http';
40
+
41
+ @Injectable({
42
+ providedIn: 'root', // Singleton at root level
43
+ })
44
+ export class User {
45
+ private http = inject(HttpClient);
46
+
47
+ private users = signal<User[]>([]);
48
+ readonly users$ = this.users.asReadonly();
49
+
50
+ async loadUsers() {
51
+ const users = await firstValueFrom(
52
+ this.http.get<User[]>('/api/users')
53
+ );
54
+ this.users.set(users);
55
+ }
56
+ }
57
+ ```
58
+
59
+ ## Provider Scopes
60
+
61
+ ### Root Level (Singleton)
62
+
63
+ ```typescript
64
+ // Recommended: providedIn
65
+ @Injectable({
66
+ providedIn: 'root',
67
+ })
68
+ export class Auth {}
69
+
70
+ // Alternative: in app.config.ts
71
+ export const appConfig: ApplicationConfig = {
72
+ providers: [
73
+ Auth,
74
+ ],
75
+ };
76
+ ```
77
+
78
+ ### Component Level (Instance per Component)
79
+
80
+ ```typescript
81
+ @Component({
82
+ selector: 'app-editor',
83
+ providers: [EditorState], // New instance for each component
84
+ template: `...`,
85
+ })
86
+ export class Editor {
87
+ private editorState = inject(EditorState);
88
+ }
89
+ ```
90
+
91
+ ### Route Level
92
+
93
+ ```typescript
94
+ export const routes: Routes = [
95
+ {
96
+ path: 'admin',
97
+ providers: [Admin], // Shared within this route tree
98
+ children: [
99
+ { path: '', component: AdminDashboard },
100
+ { path: 'users', component: AdminUsers },
101
+ ],
102
+ },
103
+ ];
104
+ ```
105
+
106
+ ## Injection Tokens
107
+
108
+ ### Creating Tokens
109
+
110
+ ```typescript
111
+ import { InjectionToken } from '@angular/core';
112
+
113
+ // Simple value token
114
+ export const API_URL = new InjectionToken<string>('API_URL');
115
+
116
+ // Object token
117
+ export interface AppConfig {
118
+ apiUrl: string;
119
+ features: {
120
+ darkMode: boolean;
121
+ analytics: boolean;
122
+ };
123
+ }
124
+
125
+ export const APP_CONFIG = new InjectionToken<AppConfig>('APP_CONFIG');
126
+
127
+ // Token with factory (self-providing)
128
+ export const WINDOW = new InjectionToken<Window>('Window', {
129
+ providedIn: 'root',
130
+ factory: () => window,
131
+ });
132
+
133
+ export const LOCAL_STORAGE = new InjectionToken<Storage>('LocalStorage', {
134
+ providedIn: 'root',
135
+ factory: () => localStorage,
136
+ });
137
+ ```
138
+
139
+ ### Providing Token Values
140
+
141
+ ```typescript
142
+ // app.config.ts
143
+ export const appConfig: ApplicationConfig = {
144
+ providers: [
145
+ { provide: API_URL, useValue: 'https://api.example.com' },
146
+ {
147
+ provide: APP_CONFIG,
148
+ useValue: {
149
+ apiUrl: 'https://api.example.com',
150
+ features: { darkMode: true, analytics: true },
151
+ },
152
+ },
153
+ ],
154
+ };
155
+ ```
156
+
157
+ ### Injecting Tokens
158
+
159
+ ```typescript
160
+ @Injectable({ providedIn: 'root' })
161
+ export class Api {
162
+ private apiUrl = inject(API_URL);
163
+ private config = inject(APP_CONFIG);
164
+ private window = inject(WINDOW);
165
+
166
+ getBaseUrl(): string {
167
+ return this.apiUrl;
168
+ }
169
+ }
170
+ ```
171
+
172
+ ## Provider Types
173
+
174
+ ### useClass
175
+
176
+ ```typescript
177
+ // Provide implementation
178
+ { provide: Logger, useClass: ConsoleLogger }
179
+
180
+ // Conditional implementation
181
+ {
182
+ provide: Logger,
183
+ useClass: environment.production
184
+ ? ProductionLogger
185
+ : ConsoleLogger,
186
+ }
187
+ ```
188
+
189
+ ### useValue
190
+
191
+ ```typescript
192
+ // Static values
193
+ { provide: API_URL, useValue: 'https://api.example.com' }
194
+
195
+ // Configuration objects
196
+ { provide: APP_CONFIG, useValue: { theme: 'dark', language: 'en' } }
197
+ ```
198
+
199
+ ### useFactory
200
+
201
+ ```typescript
202
+ // Factory with dependencies
203
+ {
204
+ provide: User,
205
+ useFactory: (http: HttpClient, config: AppConfig) => {
206
+ return new User(http, config.apiUrl);
207
+ },
208
+ deps: [HttpClient, APP_CONFIG],
209
+ }
210
+
211
+ // Async factory (not recommended - use provideAppInitializer)
212
+ {
213
+ provide: CONFIG,
214
+ useFactory: () => fetch('/config.json').then(r => r.json()),
215
+ }
216
+ ```
217
+
218
+ ### useExisting
219
+
220
+ ```typescript
221
+ // Alias to existing provider
222
+ { provide: AbstractLogger, useExisting: ConsoleLogger }
223
+
224
+ // Multiple tokens pointing to same instance
225
+ providers: [
226
+ ConsoleLogger,
227
+ { provide: Logger, useExisting: ConsoleLogger },
228
+ { provide: ErrorLogger, useExisting: ConsoleLogger },
229
+ ]
230
+ ```
231
+
232
+ ## Injection Options
233
+
234
+ ### Optional Injection
235
+
236
+ ```typescript
237
+ @Component({...})
238
+ export class My {
239
+ // Returns null if not provided
240
+ private analytics = inject(Analytics, { optional: true });
241
+
242
+ trackEvent(name: string) {
243
+ this.analytics?.track(name);
244
+ }
245
+ }
246
+ ```
247
+
248
+ ### Self, SkipSelf, Host
249
+
250
+ ```typescript
251
+ @Component({
252
+ providers: [Local],
253
+ })
254
+ export class Parent {
255
+ // Only look in this component's injector
256
+ private local = inject(Local, { self: true });
257
+ }
258
+
259
+ @Component({...})
260
+ export class Child {
261
+ // Skip this component, look in parent
262
+ private parentService = inject(ParentSvc, { skipSelf: true });
263
+
264
+ // Only look up to host component
265
+ private hostService = inject(Host, { host: true });
266
+ }
267
+ ```
268
+
269
+ ## Multi Providers
270
+
271
+ Collect multiple values for same token:
272
+
273
+ ```typescript
274
+ // Token for multiple validators
275
+ export const VALIDATORS = new InjectionToken<Validator[]>('Validators');
276
+
277
+ // Provide multiple values
278
+ providers: [
279
+ { provide: VALIDATORS, useClass: RequiredValidator, multi: true },
280
+ { provide: VALIDATORS, useClass: EmailValidator, multi: true },
281
+ { provide: VALIDATORS, useClass: MinLengthValidator, multi: true },
282
+ ]
283
+
284
+ // Inject as array
285
+ @Injectable()
286
+ export class Validation {
287
+ private validators = inject(VALIDATORS); // Validator[]
288
+
289
+ validate(value: string): ValidationError[] {
290
+ return this.validators
291
+ .map(v => v.validate(value))
292
+ .filter(Boolean);
293
+ }
294
+ }
295
+ ```
296
+
297
+ ### HTTP Interceptors (Multi Provider)
298
+
299
+ ```typescript
300
+ // Interceptors use multi providers internally
301
+ export const appConfig: ApplicationConfig = {
302
+ providers: [
303
+ provideHttpClient(
304
+ withInterceptors([
305
+ authInterceptor,
306
+ loggingInterceptor,
307
+ errorInterceptor,
308
+ ])
309
+ ),
310
+ ],
311
+ };
312
+ ```
313
+
314
+ ## App Initializers
315
+
316
+ Run async code before app starts using `provideAppInitializer`:
317
+
318
+ ```typescript
319
+ import { provideAppInitializer, inject } from '@angular/core';
320
+
321
+ export const appConfig: ApplicationConfig = {
322
+ providers: [
323
+ Config,
324
+ provideAppInitializer(() => {
325
+ const configService = inject(Config);
326
+ return configService.loadConfig();
327
+ }),
328
+ ],
329
+ };
330
+ ```
331
+
332
+ ### Multiple Initializers
333
+
334
+ ```typescript
335
+ providers: [
336
+ provideAppInitializer(() => {
337
+ const config = inject(Config);
338
+ return config.load();
339
+ }),
340
+ provideAppInitializer(() => {
341
+ const auth = inject(Auth);
342
+ return auth.checkSession();
343
+ }),
344
+ ]
345
+ ```
346
+
347
+ ## Environment Injector
348
+
349
+ Create injectors programmatically:
350
+
351
+ ```typescript
352
+ import { createEnvironmentInjector, EnvironmentInjector, inject } from '@angular/core';
353
+
354
+ @Injectable({ providedIn: 'root' })
355
+ export class Plugin {
356
+ private parentInjector = inject(EnvironmentInjector);
357
+
358
+ loadPlugin(providers: Provider[]): EnvironmentInjector {
359
+ return createEnvironmentInjector(providers, this.parentInjector);
360
+ }
361
+ }
362
+ ```
363
+
364
+ ## runInInjectionContext
365
+
366
+ Run code with injection context:
367
+
368
+ ```typescript
369
+ import { runInInjectionContext, EnvironmentInjector, inject } from '@angular/core';
370
+
371
+ @Injectable({ providedIn: 'root' })
372
+ export class Utility {
373
+ private injector = inject(EnvironmentInjector);
374
+
375
+ executeWithDI<T>(fn: () => T): T {
376
+ return runInInjectionContext(this.injector, fn);
377
+ }
378
+ }
379
+
380
+ // Usage
381
+ utilityService.executeWithDI(() => {
382
+ const http = inject(HttpClient);
383
+ // Use http...
384
+ });
385
+ ```
386
+
387
+ For advanced patterns, see [references/di-patterns.md](references/di-patterns.md).