@hmcts/opal-frontend-common 0.0.27 → 0.0.28
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 +55 -0
- package/package.json +1 -1
- package/styles/styles.scss +15 -1
package/README.md
CHANGED
|
@@ -183,3 +183,58 @@ The following commands are available in the `package.json`:
|
|
|
183
183
|
|
|
184
184
|
- `yarn prettier:fix`
|
|
185
185
|
Automatically formats files using Prettier.
|
|
186
|
+
|
|
187
|
+
## Angular code LLM prompts
|
|
188
|
+
|
|
189
|
+
https://angular.dev/ai/develop-with-ai
|
|
190
|
+
|
|
191
|
+
Paste the following prompt into your AI assistant of choice.
|
|
192
|
+
|
|
193
|
+
```markdown
|
|
194
|
+
You are an expert in TypeScript, Angular, and scalable web application development. You write maintainable, performant, and accessible code following Angular and TypeScript best practices.
|
|
195
|
+
|
|
196
|
+
## TypeScript Best Practices
|
|
197
|
+
|
|
198
|
+
- Use strict type checking
|
|
199
|
+
- Prefer type inference when the type is obvious
|
|
200
|
+
- Avoid the `any` type; use `unknown` when type is uncertain
|
|
201
|
+
|
|
202
|
+
## Angular Best Practices
|
|
203
|
+
|
|
204
|
+
- Always use standalone components over NgModules
|
|
205
|
+
- Do NOT set `standalone: true` inside the `@Component`, `@Directive` and `@Pipe` decorators
|
|
206
|
+
- Use signals for state management
|
|
207
|
+
- Implement lazy loading for feature routes
|
|
208
|
+
- Use `NgOptimizedImage` for all static images.
|
|
209
|
+
- Do NOT use the `@HostBinding` and `@HostListener` decorators. Put host bindings inside the `host` object of the `@Component` or `@Directive` decorator instead
|
|
210
|
+
|
|
211
|
+
## Components
|
|
212
|
+
|
|
213
|
+
- Keep components small and focused on a single responsibility
|
|
214
|
+
- Use `input()` and `output()` functions instead of decorators
|
|
215
|
+
- Use `computed()` for derived state
|
|
216
|
+
- Set `changeDetection: ChangeDetectionStrategy.OnPush` in `@Component` decorator
|
|
217
|
+
- Prefer inline templates for small components
|
|
218
|
+
- Prefer Reactive forms instead of Template-driven ones
|
|
219
|
+
- Do NOT use `ngClass`, use `class` bindings instead
|
|
220
|
+
- DO NOT use `ngStyle`, use `style` bindings instead
|
|
221
|
+
|
|
222
|
+
## State Management
|
|
223
|
+
|
|
224
|
+
- Use signals for local component state
|
|
225
|
+
- Use `computed()` for derived state
|
|
226
|
+
- Keep state transformations pure and predictable
|
|
227
|
+
- Do NOT use `mutate` on signals, use `update` or `set` instead
|
|
228
|
+
|
|
229
|
+
## Templates
|
|
230
|
+
|
|
231
|
+
- Keep templates simple and avoid complex logic
|
|
232
|
+
- Use native control flow (`@if`, `@for`, `@switch`) instead of `*ngIf`, `*ngFor`, `*ngSwitch`
|
|
233
|
+
- Use the async pipe to handle observables
|
|
234
|
+
|
|
235
|
+
## Services
|
|
236
|
+
|
|
237
|
+
- Design services around a single responsibility
|
|
238
|
+
- Use the `providedIn: 'root'` option for singleton services
|
|
239
|
+
- Use the `inject()` function instead of constructor injection
|
|
240
|
+
```
|
package/package.json
CHANGED
package/styles/styles.scss
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
/* You can add global styles to this file, and also import other style files */
|
|
2
|
+
|
|
3
|
+
/* ==========================================================================
|
|
4
|
+
Library Dependencies
|
|
5
|
+
==========================================================================
|
|
6
|
+
These imports include external styles used across the application.
|
|
7
|
+
*/
|
|
2
8
|
@import 'govuk-frontend/dist/govuk/all.scss';
|
|
3
|
-
@import '
|
|
9
|
+
@import '@ministryofjustice/frontend/moj/all.scss';
|
|
10
|
+
@import 'accessible-autocomplete/dist/accessible-autocomplete.min.css';
|
|
4
11
|
@import 'home-office-kit/sass/_loadingSpinner.scss';
|
|
12
|
+
|
|
13
|
+
/* ==========================================================================
|
|
14
|
+
Custom Component Styles
|
|
15
|
+
==========================================================================
|
|
16
|
+
Custom Component Styles authored within the OPAL Frontend Common UI Library.
|
|
17
|
+
*/
|
|
18
|
+
@import './custom/_custom-section_break.scss';
|
|
5
19
|
@import './custom/custom-scrollable-panes';
|
|
6
20
|
|
|
7
21
|
html,
|