@rt-tools/agent-kit 0.24.0 → 0.26.0
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/assets/agents/business-analyst.md +51 -50
- package/assets/agents/conscience.md +37 -35
- package/assets/agents/project-manager.md +49 -48
- package/assets/agents/prose-editor.md +31 -29
- package/assets/agents/qa-engineer.md +50 -48
- package/assets/agents/rules-reviewer.md +63 -58
- package/assets/agents/skill-curator.md +83 -78
- package/assets/agents/spec-critic.md +34 -29
- package/assets/agents/spec-writer.md +35 -32
- package/assets/agents/strict-teacher.md +39 -37
- package/assets/checks/archive-age.mjs +48 -28
- package/assets/checks/archive-prune.mjs +16 -14
- package/assets/checks/board-epics.github.mjs +75 -41
- package/assets/checks/board-folders.mjs +61 -0
- package/assets/checks/board-gh.github.mjs +35 -26
- package/assets/checks/board-long-work.github.mjs +24 -24
- package/assets/checks/board-paths.github.mjs +21 -16
- package/assets/checks/board-runs.github.mjs +45 -43
- package/assets/checks/board-titles.github.mjs +19 -17
- package/assets/checks/board.github.mjs +149 -127
- package/assets/checks/check-archive-age.mjs +23 -19
- package/assets/checks/check-board.github.mjs +172 -164
- package/assets/checks/check-descriptions.mjs +30 -29
- package/assets/checks/check-doc-paths.mjs +91 -88
- package/assets/checks/check-dupes.mjs +84 -80
- package/assets/checks/check-file-size.mjs +74 -71
- package/assets/checks/check-glossary.mjs +47 -37
- package/assets/checks/check-hook-scope.mjs +30 -27
- package/assets/checks/check-lib-layers.mjs +22 -21
- package/assets/checks/check-profile-drift.mjs +48 -43
- package/assets/checks/check-prose-style.mjs +120 -37
- package/assets/checks/check-push-gate.mjs +53 -50
- package/assets/checks/check-reuse.mjs +50 -40
- package/assets/checks/check-schema-drift.mjs +87 -83
- package/assets/checks/check-specs.mjs +155 -134
- package/assets/checks/check-state-next.mjs +66 -52
- package/assets/checks/check-states.mjs +32 -30
- package/assets/checks/check-styles.mjs +52 -51
- package/assets/checks/check-turn-map.mjs +54 -46
- package/assets/checks/lib-boundaries.mjs +32 -30
- package/assets/checks/lib-common.mjs +30 -29
- package/assets/checks/lib-domains.mjs +34 -34
- package/assets/checks/lib-manifests.mjs +17 -15
- package/assets/checks/lib-reexports.mjs +18 -18
- package/assets/checks/rt-kit-checks.config.mjs +174 -142
- package/assets/checks/signals.mjs +43 -39
- package/assets/checks/spec-anchors.mjs +114 -87
- package/assets/checks/spec-common.mjs +128 -84
- package/assets/checks/spec-contract.mjs +30 -30
- package/assets/checks/spec-proposed.mjs +27 -24
- package/assets/checks/spec-scenarios.mjs +51 -28
- package/assets/checks/task-new.github.mjs +85 -56
- package/assets/commands/feedback.md +65 -59
- package/assets/commands/next-session.md +64 -57
- package/assets/commands/skill-curator.md +83 -79
- package/assets/defaults/gate-map.sh +108 -97
- package/assets/defaults/project.sh +225 -185
- package/assets/defaults/shell.sh +73 -68
- package/assets/defaults/turn-map.md +45 -44
- package/assets/docs/GLOSSARY.md +142 -65
- package/assets/hooks/browser-device-id.sh +12 -12
- package/assets/hooks/browser-guard-device-id.sh +30 -28
- package/assets/hooks/browser-guard-no-asking.sh +5 -4
- package/assets/hooks/browser-guard-no-listing.sh +12 -11
- package/assets/hooks/browser-guard-no-other-drivers.sh +48 -42
- package/assets/hooks/browser-guard-require-select.sh +34 -23
- package/assets/hooks/claim-guard.sh +62 -56
- package/assets/hooks/commit-msg.sh +11 -10
- package/assets/hooks/conscience-guard.sh +91 -45
- package/assets/hooks/constitution-index.sh +16 -16
- package/assets/hooks/deny-tail.sh +28 -26
- package/assets/hooks/dev-server-guard.sh +46 -43
- package/assets/hooks/dispatch.sh +60 -46
- package/assets/hooks/docs-guard.sh +100 -91
- package/assets/hooks/exam-guard.sh +105 -93
- package/assets/hooks/git-guard-delivery-conflict.sh +38 -36
- package/assets/hooks/git-guard-delivery-draft.sh +45 -38
- package/assets/hooks/git-guard-delivery-folder.sh +50 -43
- package/assets/hooks/git-guard-delivery-signature.sh +88 -52
- package/assets/hooks/git-guard-delivery.sh +196 -180
- package/assets/hooks/git-guard-main.sh +38 -34
- package/assets/hooks/git-guard-push-tests.sh +99 -87
- package/assets/hooks/glossary-load.sh +23 -22
- package/assets/hooks/grill-gate-ask.sh +12 -11
- package/assets/hooks/grill-gate.sh +94 -87
- package/assets/hooks/guard-note.sh +20 -19
- package/assets/hooks/handoff-entry-guard.sh +26 -24
- package/assets/hooks/handoff-write.sh +74 -67
- package/assets/hooks/hook-input.sh +67 -58
- package/assets/hooks/lint-after-edit.sh +95 -61
- package/assets/hooks/observe.sh +28 -26
- package/assets/hooks/override-write-guard.sh +23 -21
- package/assets/hooks/postmortem-guard.sh +42 -39
- package/assets/hooks/profile-check.sh +22 -20
- package/assets/hooks/proposal-guard.sh +57 -49
- package/assets/hooks/prose-style-guard.sh +19 -17
- package/assets/hooks/qa-dataid-guard.sh +52 -49
- package/assets/hooks/rerun-guard.sh +31 -30
- package/assets/hooks/reuse-first-guard.sh +108 -87
- package/assets/hooks/roles.sh +14 -14
- package/assets/hooks/rule-article.sh +36 -34
- package/assets/hooks/rule-source-guard.sh +47 -42
- package/assets/hooks/skill-gate-layers.sh +59 -57
- package/assets/hooks/skill-gate-rearm.sh +15 -8
- package/assets/hooks/skill-gate.sh +89 -81
- package/assets/hooks/skill-loaded.sh +6 -6
- package/assets/hooks/sql-guard-parse.sh +68 -66
- package/assets/hooks/sql-guard-request.sh +48 -46
- package/assets/hooks/sql-guard-target.sh +57 -51
- package/assets/hooks/sql-guard-write.sh +84 -79
- package/assets/hooks/sql-guard.sh +52 -47
- package/assets/hooks/stand-login-guard.sh +40 -37
- package/assets/hooks/task-context-load.sh +60 -55
- package/assets/hooks/task-flow-context.sh +87 -69
- package/assets/hooks/task-flow-draft-guard.sh +55 -48
- package/assets/hooks/task-flow-guard.sh +67 -64
- package/assets/hooks/turn-entry-load.sh +39 -32
- package/assets/hooks/turn-exit-guard.sh +256 -204
- package/assets/hooks/turn-exit-patterns.sh +53 -0
- package/assets/hooks/utf8.sh +11 -11
- package/assets/hooks/waiting-turn-guard.sh +94 -94
- package/assets/hooks/window-fill-guard.sh +70 -62
- package/assets/hooks/work-start-guard.sh +52 -49
- package/assets/hooks/write-targets.sh +96 -44
- package/assets/laws/autonomous-work.md +29 -27
- package/assets/laws/code-structure.md +31 -30
- package/assets/laws/delivery.md +148 -137
- package/assets/laws/entity-editing.md +52 -50
- package/assets/laws/entity-models.md +14 -13
- package/assets/laws/frontend-application.md +39 -38
- package/assets/laws/lib-imports.md +27 -27
- package/assets/laws/lists.md +31 -29
- package/assets/laws/navigation.md +37 -37
- package/assets/laws/observability.md +41 -40
- package/assets/laws/project-documentation.md +106 -99
- package/assets/laws/reuse-first.md +31 -29
- package/assets/laws/shared-code.md +27 -27
- package/assets/laws/verifiability.md +131 -124
- package/assets/laws/work-conduct.md +250 -244
- package/assets/patterns/admin-lists-screen.md +72 -69
- package/assets/patterns/admin-nav-item.md +51 -46
- package/assets/patterns/angular-patterns-state.md +32 -31
- package/assets/patterns/api-layer-pair.md +33 -31
- package/assets/patterns/autonomous-work-run.md +50 -49
- package/assets/patterns/browser-verification-measure.md +124 -88
- package/assets/patterns/browser-verification-stand.md +169 -157
- package/assets/patterns/component-structure-new.md +51 -42
- package/assets/patterns/dependencies-upgrade.md +55 -39
- package/assets/patterns/doc-style-human.md +55 -37
- package/assets/patterns/doc-style-sweep.md +82 -79
- package/assets/patterns/doc-style-trace.md +87 -81
- package/assets/patterns/doc-style-write.md +130 -122
- package/assets/patterns/entity-aside.md +77 -63
- package/assets/patterns/entity-models-new.md +37 -37
- package/assets/patterns/entity-store.md +33 -33
- package/assets/patterns/git-workflow-commit.azure.md +93 -86
- package/assets/patterns/git-workflow-commit.github.md +152 -141
- package/assets/patterns/git-workflow-commit.gitlab.md +95 -89
- package/assets/patterns/git-workflow-docker.md +165 -147
- package/assets/patterns/git-workflow-freshness.md +45 -45
- package/assets/patterns/git-workflow-merge.md +98 -93
- package/assets/patterns/git-workflow-migration.md +54 -52
- package/assets/patterns/git-workflow-pr-ready.md +57 -56
- package/assets/patterns/git-workflow-pr.azure.md +126 -121
- package/assets/patterns/git-workflow-pr.github.md +179 -175
- package/assets/patterns/git-workflow-pr.gitlab.md +138 -131
- package/assets/patterns/git-workflow-restart.md +35 -31
- package/assets/patterns/git-workflow-secrets.md +80 -73
- package/assets/patterns/git-workflow-stack.md +131 -106
- package/assets/patterns/lib-layers-move.md +62 -53
- package/assets/patterns/lib-layers-new.md +59 -45
- package/assets/patterns/observability-record.md +72 -67
- package/assets/patterns/platform-access-di.md +31 -29
- package/assets/patterns/reuse-first-extend.md +66 -61
- package/assets/patterns/shared-code-new.md +39 -38
- package/assets/patterns/spec-driven-domain.md +161 -151
- package/assets/patterns/spec-driven-rule.md +179 -168
- package/assets/patterns/spec-driven-sweep.md +41 -39
- package/assets/patterns/status-report-table.github.md +37 -36
- package/assets/patterns/styling-bem-component.md +42 -42
- package/assets/patterns/styling-bem-layout.md +39 -34
- package/assets/patterns/styling-bem-sheet.md +59 -58
- package/assets/patterns/task-flow-archive.md +222 -215
- package/assets/patterns/task-flow-close.md +215 -203
- package/assets/patterns/task-flow-handoff.md +154 -145
- package/assets/patterns/task-flow-resume.md +138 -133
- package/assets/patterns/task-flow-start.md +204 -192
- package/assets/patterns/testing-e2e.md +102 -101
- package/assets/patterns/testing-unit.md +77 -70
- package/assets/patterns/ts-procedure.md +32 -29
- package/assets/patterns/turn-entry-map.md +50 -48
- package/assets/pitfalls/agent-kit.md +152 -141
- package/assets/pitfalls/doc-style.md +96 -91
- package/assets/pitfalls/git-workflow.azure.md +49 -46
- package/assets/pitfalls/git-workflow.github.md +264 -234
- package/assets/pitfalls/git-workflow.gitlab.md +49 -45
- package/assets/pitfalls/spec-driven.md +73 -71
- package/assets/pitfalls/styling-bem.md +46 -40
- package/assets/pitfalls/task-flow.md +262 -246
- package/assets/pitfalls/testing.md +99 -92
- package/assets/pitfalls/turn-conduct.md +96 -81
- package/assets/rules/angular-patterns.md +81 -80
- package/assets/rules/api-layer.md +77 -74
- package/assets/rules/autonomous-work.md +75 -74
- package/assets/rules/browser-verification.md +223 -214
- package/assets/rules/component-structure.md +72 -69
- package/assets/rules/dependencies.md +74 -67
- package/assets/rules/deploy-flow.azure.md +118 -108
- package/assets/rules/deploy-flow.github.md +145 -135
- package/assets/rules/deploy-flow.gitlab.md +120 -110
- package/assets/rules/doc-style.md +198 -173
- package/assets/rules/entity-conventions.needs-admin.md +81 -79
- package/assets/rules/entity-models.md +73 -70
- package/assets/rules/git-workflow.azure.md +224 -228
- package/assets/rules/git-workflow.github.md +250 -239
- package/assets/rules/git-workflow.gitlab.md +218 -217
- package/assets/rules/lib-layers.md +85 -86
- package/assets/rules/lists.md +101 -97
- package/assets/rules/navigation.md +78 -78
- package/assets/rules/observability.needs-app.md +165 -153
- package/assets/rules/platform-access.md +76 -75
- package/assets/rules/reuse-first.md +153 -143
- package/assets/rules/shared-code.md +82 -79
- package/assets/rules/spec-driven.md +272 -260
- package/assets/rules/status-report.md +55 -58
- package/assets/rules/styling-bem.md +81 -77
- package/assets/rules/task-flow.md +282 -270
- package/assets/rules/testing.md +224 -209
- package/assets/rules/turn-conduct.md +255 -258
- package/assets/rules/turn-entry.md +92 -87
- package/assets/rules/typescript-conventions.md +94 -88
- package/assets/samples/specs/_template/spec.md +47 -47
- package/assets/samples/tasks/_template/grill.md +20 -20
- package/assets/samples/tasks/_template/plan.md +32 -30
- package/assets/samples/tasks/_template/progress.md +16 -16
- package/assets/skills/agent-kit-extend.md +129 -113
- package/assets/skills/agent-kit.md +235 -211
- package/assets/skills/write-a-skill.md +76 -71
- package/assets/templates/findings.md +19 -19
- package/assets/templates/gate-map.sh +16 -14
- package/assets/templates/implementation.md +28 -27
- package/assets/templates/pattern.md +17 -17
- package/assets/templates/pitfalls.md +6 -6
- package/assets/templates/postmortem.md +24 -23
- package/assets/templates/project.sh +24 -24
- package/assets/templates/proposal.md +62 -60
- package/assets/templates/rule.md +38 -38
- package/assets/workflows/feature.js +46 -46
- package/assets/workflows/plan.js +54 -54
- package/lib/catalog.d.ts +2 -0
- package/lib/catalog.d.ts.map +1 -1
- package/lib/catalog.js +4 -3
- package/lib/catalog.js.map +1 -1
- package/lib/commands.d.ts.map +1 -1
- package/lib/commands.js +5 -2
- package/lib/commands.js.map +1 -1
- package/lib/companion.js +3 -2
- package/lib/companion.js.map +1 -1
- package/lib/enroll.d.ts +7 -1
- package/lib/enroll.d.ts.map +1 -1
- package/lib/enroll.js +12 -3
- package/lib/enroll.js.map +1 -1
- package/lib/plan.d.ts +11 -0
- package/lib/plan.d.ts.map +1 -1
- package/lib/plan.js +10 -1
- package/lib/plan.js.map +1 -1
- package/lib/ship.d.ts +0 -7
- package/lib/ship.d.ts.map +1 -1
- package/lib/ship.js +10 -2
- package/lib/ship.js.map +1 -1
- package/lib/shipment.d.ts.map +1 -1
- package/lib/shipment.js +6 -2
- package/lib/shipment.js.map +1 -1
- package/lib/sync.d.ts.map +1 -1
- package/lib/sync.js +45 -11
- package/lib/sync.js.map +1 -1
- package/package.json +1 -1
- package/rt-tools-agent-kit-0.26.0.tgz +0 -0
- package/rt-tools-agent-kit-0.24.0.tgz +0 -0
|
@@ -2,141 +2,144 @@
|
|
|
2
2
|
name: admin-lists-screen
|
|
3
3
|
kind: pattern
|
|
4
4
|
rule: lists
|
|
5
|
-
description:
|
|
5
|
+
description: Pattern of rule lists. Load when assembling or editing an admin list screen — the ready-made order of blocks, the <prefix>-table markup, row click, row menu with an actions column and a row predicate, sortable header, toolbar slots, failure toast.
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
#
|
|
8
|
+
# Assembling a list screen
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Pattern of the rule `lists`. What must be true — the law
|
|
11
11
|
`docs/constitution/lists.md`.
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## When to use
|
|
14
14
|
|
|
15
|
-
-
|
|
16
|
-
-
|
|
15
|
+
- A new screen with a list of records is created.
|
|
16
|
+
- An existing one is edited: columns, row menu, toolbar, sorting.
|
|
17
17
|
|
|
18
|
-
##
|
|
18
|
+
## Order of blocks
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
The layout comes from the shared block `<prefix>-page` of the application layer, not from the
|
|
21
|
+
screen's styles. The screen answers for the order:
|
|
22
22
|
|
|
23
23
|
```html
|
|
24
|
-
<ng-container rtBlock="
|
|
24
|
+
<ng-container rtBlock="<prefix>-page">
|
|
25
25
|
<header rtElem="header">
|
|
26
|
-
<!-- div rtElem="header-main"
|
|
27
|
-
|
|
28
|
-
<!--
|
|
26
|
+
<!-- div rtElem="header-main" with h1 rtElem="title" + p rtElem="hint" -->
|
|
27
|
+
<<prefix>-toolbar>
|
|
28
|
+
<!-- <prefix>ToolbarLeft / <prefix>ToolbarRight -->
|
|
29
29
|
<div rtElem="scroll">
|
|
30
30
|
<!-- overflow-x: auto -->
|
|
31
|
-
|
|
31
|
+
<<prefix>-table rtElem="table">
|
|
32
32
|
<!-- min-width: max-content -->
|
|
33
|
-
|
|
33
|
+
<<prefix>-pagination>
|
|
34
34
|
</div>
|
|
35
35
|
</header>
|
|
36
36
|
</ng-container>
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
Both scrolling rules are needed together: with the container alone the columns shrink instead of
|
|
40
|
+
shifting. The toolbar and the pagination carry no classes of their own — the gap is set by
|
|
41
|
+
`<prefix>-page` itself.
|
|
41
42
|
|
|
42
|
-
##
|
|
43
|
+
## The table
|
|
43
44
|
|
|
44
45
|
```html
|
|
45
|
-
|
|
46
|
+
<<prefix>-table #rowsTable="<prefix>Table" rtElem="table" clickable [ariaLabel]="'recordsTableAria' | transloco"
|
|
46
47
|
[emptyMessage]="'recordsEmpty' | transloco" [tableId]="tableId" [dataSource]="rows()" [columnsConfig]="columnsConfig()"
|
|
47
48
|
[rowHasActions]="hasRowActions" [loading]="loading()">
|
|
48
49
|
```
|
|
49
50
|
|
|
50
|
-
- `tableId` —
|
|
51
|
-
- `[columnsConfig]`,
|
|
52
|
-
|
|
51
|
+
- `tableId` — the key under which the column choice is stored; it also goes to the settings aside.
|
|
52
|
+
- `[columnsConfig]`, not a bare list of keys: the captions for the settings panel and for the
|
|
53
|
+
cards on a narrow screen are taken from it.
|
|
53
54
|
|
|
54
|
-
##
|
|
55
|
+
## Row click
|
|
55
56
|
|
|
56
57
|
```html
|
|
57
58
|
<tr
|
|
58
59
|
*cdkRowDef="let row; columns: rowsTable.displayedColumns()"
|
|
59
60
|
cdk-row
|
|
60
61
|
qa-dataid="records-row"
|
|
61
|
-
|
|
62
|
+
<prefix>TableRow
|
|
62
63
|
(activated)="openAside(row)"></tr>
|
|
63
64
|
```
|
|
64
65
|
|
|
65
|
-
|
|
66
|
+
Rows are declared on `rowsTable.displayedColumns()`: the column with the menu the table adds
|
|
67
|
+
itself.
|
|
66
68
|
|
|
67
|
-
##
|
|
69
|
+
## Row menu
|
|
68
70
|
|
|
69
71
|
```html
|
|
70
|
-
|
|
71
|
-
<ng-template
|
|
72
|
+
<<prefix>-table … [showRowActions]="true" [rowHasActions]="hasRowActions" [loading]="loading()">
|
|
73
|
+
<ng-template <prefix>TableRowActions let-row [<prefix>TableRowActionsRowType]="rows()"></ng-template>
|
|
72
74
|
```
|
|
73
75
|
|
|
74
76
|
```typescript
|
|
75
|
-
protected readonly hasRowActions: I
|
|
77
|
+
protected readonly hasRowActions: I<Prefix>Table.RowActionsPredicate<IRecord.Row> = recordRowHasActions;
|
|
76
78
|
```
|
|
77
79
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
There are two inputs, and they do not replace each other. `showRowActions` creates the actions
|
|
81
|
+
column itself — by default it is omitted, and without it the table draws only the declared
|
|
82
|
+
columns: neither the actions template nor the predicate adds the column. `rowHasActions` decides
|
|
83
|
+
whether to show the button on a particular row, and creates no column at all. That is how the
|
|
84
|
+
roles screen came out with four columns and unreachable actions: the build, the lint and the
|
|
85
|
+
units on the row rules were green, and it was found by the end-to-end run.
|
|
84
86
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
+
The actions cell is hidden until the pointer is on the row — the end-to-end test hovers the row
|
|
88
|
+
before pressing.
|
|
87
89
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
Action availability lies in a row field (`canConfirm`, `canReject`), not in a call of a component
|
|
91
|
+
method. An action the record cannot take is removed from the menu entirely. An irreversible one
|
|
92
|
+
carries `danger`, `confirmTitle` and `confirmMessage` with the consequence — not "Are you sure?",
|
|
93
|
+
but what exactly will happen.
|
|
92
94
|
|
|
93
|
-
##
|
|
95
|
+
## Sortable header
|
|
94
96
|
|
|
95
97
|
```html
|
|
96
|
-
<th *cdkHeaderCellDef cdk-header-cell
|
|
98
|
+
<th *cdkHeaderCellDef cdk-header-cell <prefix>SortHeader="createdAt">{{ 'recordsCreatedAt' | transloco }}</th>
|
|
97
99
|
```
|
|
98
100
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
The column is marked `sortable: true` in `columnsConfig`. The header cycles the sort and hands
|
|
102
|
+
the chosen one out by the `(sortChange)` event; the query itself is done by the screen. The
|
|
103
|
+
caption stays inside the button — the accessible name is taken from it.
|
|
102
104
|
|
|
103
|
-
|
|
104
|
-
`[sort]="sortModel()"
|
|
105
|
-
|
|
105
|
+
The list arrives already sorted, so the screen passes the table the current sort —
|
|
106
|
+
`[sort]="sortModel()"` — and the arrow stands on the right column at once, before the first
|
|
107
|
+
press. Without it the list looks unsorted while it is sorted.
|
|
106
108
|
|
|
107
|
-
##
|
|
109
|
+
## Toolbar
|
|
108
110
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
+
The toolbar is split in two by slots: `<prefix>ToolbarLeft` — what changes the query,
|
|
112
|
+
`<prefix>ToolbarRight` — actions on the list. The screen sets up no layout of its own inside the
|
|
113
|
+
toolbar.
|
|
111
114
|
|
|
112
|
-
|
|
113
|
-
`tooltip` + `ariaLabel`
|
|
114
|
-
|
|
115
|
+
The left slot — filters and search. The right — `<prefix>-icon-button variant="primary"` icons
|
|
116
|
+
with a pair `tooltip` + `ariaLabel` of the same text: refresh (`sync`), column settings
|
|
117
|
+
(`sliders-v`), create (`plus`). If the list failed to load, the retry is the same refresh button.
|
|
115
118
|
|
|
116
|
-
##
|
|
119
|
+
## Loading refusal
|
|
117
120
|
|
|
118
121
|
```typescript
|
|
119
122
|
this.#notifications.error(this.#transloco.translate(this.#store.errorKey() ?? 'recordsLoadFailed'));
|
|
120
123
|
```
|
|
121
124
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
+
The key is read right after the request, not by subscribing to the store signal: the store is
|
|
126
|
+
shared by the list and the edit panel, and a subscription would show one refusal twice. No
|
|
127
|
+
`<p role="alert">` lines above the table.
|
|
125
128
|
|
|
126
|
-
##
|
|
129
|
+
## Check
|
|
127
130
|
|
|
128
131
|
```bash
|
|
129
132
|
npx nx build admin
|
|
130
133
|
```
|
|
131
134
|
|
|
132
|
-
|
|
133
|
-
`unknown`,
|
|
135
|
+
The production build is mandatory: without `[<prefix>TableRowActionsRowType]` the type of
|
|
136
|
+
`let-row` is inferred as `unknown`, and only that build fails — units and the dev server pass.
|
|
134
137
|
|
|
135
|
-
##
|
|
138
|
+
## Common misses
|
|
136
139
|
|
|
137
|
-
-
|
|
138
|
-
-
|
|
139
|
-
-
|
|
140
|
-
- `[rowHasActions]`
|
|
141
|
-
-
|
|
142
|
-
- `qa-dataid`
|
|
140
|
+
- An own `@if (rows().length === 0)` — the screen was assembled bypassing the table.
|
|
141
|
+
- An own column list instead of `displayedColumns()` — the column with the menu disappears.
|
|
142
|
+
- Action availability computed by a component method — recomputed on every check.
|
|
143
|
+
- `[rowHasActions]` not set — the "…" button hangs on a row without actions.
|
|
144
|
+
- The title nested in the toolbar instead of its own `<header>`.
|
|
145
|
+
- `qa-dataid` not set on the table, the row, the cells and the toolbar elements.
|
|
@@ -2,70 +2,75 @@
|
|
|
2
2
|
name: admin-nav-item
|
|
3
3
|
kind: pattern
|
|
4
4
|
rule: navigation
|
|
5
|
-
description:
|
|
5
|
+
description: Pattern of rule navigation. Load when creating an admin menu item, a section with a panel or a new section address — one declaration per item and route, the flag of a section without a screen, address nesting, a hint on an unavailable item. Not for the record edit panel — pattern entity-aside.
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
#
|
|
8
|
+
# A menu item and a section address
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Pattern of the rule `navigation`. What must be true — the law
|
|
11
11
|
`docs/constitution/navigation.md`.
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## When to use
|
|
14
14
|
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
15
|
+
- An admin menu item or a section with a panel is created.
|
|
16
|
+
- A new screen appears that needs an address.
|
|
17
|
+
- An item has to be shown while there is no screen under it yet.
|
|
18
18
|
|
|
19
|
-
##
|
|
19
|
+
## One declaration per item and route
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
`libs/admin/common/container/util`
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
The menu declaration is data: addresses, dictionary keys, rights and the section flag. It lives
|
|
22
|
+
in `libs/admin/common/container/util` and serves as the source of both the items and the route
|
|
23
|
+
gating. A second declaration next to the routes would drift from the first, and the result would
|
|
24
|
+
be "the item is not visible, but the page opens".
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
The declaration imports no `shell`: otherwise the graph closes into a cycle and
|
|
27
|
+
`npm run check:layers` stops.
|
|
28
28
|
|
|
29
|
-
##
|
|
29
|
+
## An item without a screen
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
Declared **without rights and without an address**: a right opens the screen, and there is no
|
|
32
|
+
screen. It is visible to everyone all the while. When the screen appears, the flag is removed and
|
|
33
|
+
the rights are added; nothing else in the declaration needs editing.
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
The caption is visible, a press does nothing, the hint explains why. The carrier of the hint is
|
|
36
|
+
a wrapper around the button, and the item itself is switched off by `aria-disabled`, not by the
|
|
37
|
+
native `disabled`: a natively disabled button takes no focus, and from the keyboard the
|
|
38
|
+
explanation is unreachable.
|
|
37
39
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
`aria-disabled` always goes with a paired style rule `[aria-disabled='true']` — the browser does
|
|
41
|
+
not draw this attribute itself. Such an item has no click handler at all.
|
|
40
42
|
|
|
41
|
-
##
|
|
43
|
+
## The address repeats the section
|
|
42
44
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
`shell`
|
|
45
|
+
Everything that stands in a section lies under its segment: a screen from "Settings" — under
|
|
46
|
+
`/settings`. The nesting is done in `apps/admin/src/app/app.routes.ts` through `children` of the
|
|
47
|
+
section segment; the domain's `shell` is mounted inside. No lib of its own is needed for a
|
|
48
|
+
section.
|
|
46
49
|
|
|
47
|
-
|
|
48
|
-
|
|
50
|
+
Highlighting of the active section is counted by address prefix, and no list of exceptions is
|
|
51
|
+
kept for it.
|
|
49
52
|
|
|
50
|
-
##
|
|
53
|
+
## Domain data comes into the header by a token
|
|
51
54
|
|
|
52
|
-
|
|
53
|
-
`libs/admin/common/container/util`,
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
Unread counters are declared by an interface and an `InjectionToken` in
|
|
56
|
+
`libs/admin/common/container/util`, and the composition root (`provideAdminEnvironment`) ties
|
|
57
|
+
the token to the implementation. Only the root gets rights to a foreign lib — by one line in its
|
|
58
|
+
boundaries config.
|
|
56
59
|
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
The sign reaches the kit as a predicate by the item id, not as a field of its own in the
|
|
61
|
+
declaration: a domain section is named by the id of its item.
|
|
59
62
|
|
|
60
|
-
##
|
|
63
|
+
## Common misses
|
|
61
64
|
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
|
|
65
|
-
-
|
|
66
|
-
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
|
|
70
|
-
-
|
|
71
|
-
|
|
65
|
+
- A second declaration of rights next to the routes.
|
|
66
|
+
- A section with a panel that was given an address of its own: only items have addresses, and a
|
|
67
|
+
section is visible if at least one item inside is visible.
|
|
68
|
+
- Walking only the top row when looking for the owner of an address: sections are walked
|
|
69
|
+
together with the items of their panels, otherwise a nested screen is left without gating.
|
|
70
|
+
- A hint on an available item: it repeats the caption next to it word for word and adds nothing.
|
|
71
|
+
- `<prefix>PopoverTrigger` not set explicitly: the popup directive opens by press by default, and
|
|
72
|
+
two neighbouring elements of one row behave differently.
|
|
73
|
+
- An address move without editing the end-to-end tests: they walk by addresses, and the run goes
|
|
74
|
+
red.
|
|
75
|
+
- An icon picked as "similar": a missing one is added to the sprite and to
|
|
76
|
+
`<prefix>-icon-names.ts`.
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
name: angular-patterns-state
|
|
3
3
|
kind: pattern
|
|
4
4
|
rule: angular-patterns
|
|
5
|
-
description:
|
|
5
|
+
description: Pattern of rule angular-patterns. Load when declaring state and streams in an Angular class — ready-made signals, derived values, service state, a long-lived subscription with an action source. Not for the layout of a component file — that is rule component-structure.
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
#
|
|
8
|
+
# State and streams
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Pattern of the rule `angular-patterns`. What must be true — the law
|
|
11
11
|
`docs/constitution/frontend-application.md`.
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## When to use
|
|
14
14
|
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
15
|
+
- The state of a component or a service is declared.
|
|
16
|
+
- A stream appears that has to be subscribed to.
|
|
17
|
+
- A value is computed from another value.
|
|
18
18
|
|
|
19
|
-
##
|
|
19
|
+
## The signal input and output API
|
|
20
20
|
|
|
21
21
|
```typescript
|
|
22
22
|
public readonly data: InputSignal<Item[]> = input.required<Item[]>();
|
|
@@ -26,10 +26,10 @@ public readonly save: OutputEmitterRef<void> = output<void>();
|
|
|
26
26
|
protected readonly myButton: Signal<ElementRef | undefined> = viewChild<ElementRef>('button');
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
The decorators `@Input()`, `@Output()`, `@ViewChild()`, `@ContentChild()` and their plural pairs
|
|
30
|
+
are not in the tree.
|
|
31
31
|
|
|
32
|
-
##
|
|
32
|
+
## A derived value — `computed`, not an effect
|
|
33
33
|
|
|
34
34
|
```typescript
|
|
35
35
|
protected readonly items: WritableSignal<Item[]> = signal<Item[]>([]);
|
|
@@ -42,12 +42,12 @@ protected readonly hasItems: Signal<boolean> = computed((): boolean => this.item
|
|
|
42
42
|
✓ protected readonly count: Signal<number> = computed((): number => this.items().length);
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
No getter in a component: it is recomputed on every redraw, and its cost is visible nowhere in
|
|
46
|
+
the code.
|
|
47
47
|
|
|
48
|
-
##
|
|
48
|
+
## Service state
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
Outward — reading only:
|
|
51
51
|
|
|
52
52
|
```typescript
|
|
53
53
|
@Injectable({ providedIn: 'root' })
|
|
@@ -63,9 +63,9 @@ export class DomainStateService {
|
|
|
63
63
|
}
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
-
##
|
|
66
|
+
## A subscription is declared once
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
The action method pushes a value into the source, the subscription lives in the constructor:
|
|
69
69
|
|
|
70
70
|
```typescript
|
|
71
71
|
readonly #loadSource: Subject<void> = new Subject<void>();
|
|
@@ -85,17 +85,18 @@ protected reload(): void {
|
|
|
85
85
|
}
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
-
|
|
89
|
-
(`switchMap`),
|
|
90
|
-
(`mergeMap`).
|
|
91
|
-
|
|
92
|
-
##
|
|
93
|
-
|
|
94
|
-
- `.subscribe()`
|
|
95
|
-
|
|
96
|
-
-
|
|
97
|
-
|
|
98
|
-
-
|
|
99
|
-
|
|
100
|
-
- `
|
|
101
|
-
|
|
88
|
+
The operator is chosen by what to do with the previous request: a list takes the last response
|
|
89
|
+
(`switchMap`), a button does not spawn duplicates (`exhaustMap`), neighbouring rows go
|
|
90
|
+
independently (`mergeMap`).
|
|
91
|
+
|
|
92
|
+
## Common misses
|
|
93
|
+
|
|
94
|
+
- `.subscribe()` inside a method: the linter rule refuses it, and with it the race of responses
|
|
95
|
+
on fast presses is refused too.
|
|
96
|
+
- A subscription without `takeUntilDestroyed`: it outlives its owner and keeps the destroyed
|
|
97
|
+
screen in memory.
|
|
98
|
+
- A stream field without the suffix `Source`: the stream and the value cannot be told apart in
|
|
99
|
+
code.
|
|
100
|
+
- `inject()` instead of constructor parameters — everywhere, including base classes.
|
|
101
|
+
- `untracked()` where the effect needs no dependency on a signal: without it the effect wakes on
|
|
102
|
+
every foreign change.
|
|
@@ -2,24 +2,24 @@
|
|
|
2
2
|
name: api-layer-pair
|
|
3
3
|
kind: pattern
|
|
4
4
|
rule: api-layer
|
|
5
|
-
description:
|
|
5
|
+
description: Pattern of rule api-layer. Load when creating or editing the api layer of a frontend domain — ready-made facade and service, the query input, the page converter, order and filter types in the entity namespace. Not for the model and its mapper — that is pattern entity-models-new.
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
#
|
|
8
|
+
# The facade and the service of a domain
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Pattern of the rule `api-layer`. What must be true — the law
|
|
11
11
|
`docs/constitution/frontend-application.md`.
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## When to use
|
|
14
14
|
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
15
|
+
- The `api` layer of a new domain is created.
|
|
16
|
+
- A list is moved onto the shared query.
|
|
17
|
+
- A new procedure appears that a screen calls.
|
|
18
18
|
|
|
19
|
-
##
|
|
19
|
+
## The facade
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
Takes a contract request, returns a contract response, wraps the wait into a stream. Neither the
|
|
22
|
+
query nor the model translation is in it:
|
|
23
23
|
|
|
24
24
|
```typescript
|
|
25
25
|
@Injectable({ providedIn: 'root' })
|
|
@@ -36,11 +36,12 @@ export class PromoCodeApiFacade implements IListApiFacade<
|
|
|
36
36
|
}
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
A method the domain does not have is not declared: everyone reads the list, not everyone edits.
|
|
40
40
|
|
|
41
|
-
##
|
|
41
|
+
## The service
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
Takes domain models, returns the same. A type from the contract does not reach the store and
|
|
44
|
+
the template:
|
|
44
45
|
|
|
45
46
|
```typescript
|
|
46
47
|
export class PromoCodeApiService implements IListApiService<
|
|
@@ -61,28 +62,29 @@ export class PromoCodeApiService implements IListApiService<
|
|
|
61
62
|
}
|
|
62
63
|
```
|
|
63
64
|
|
|
64
|
-
`getList`
|
|
65
|
-
|
|
65
|
+
`getList` takes the query and nothing else: the object the list is bound to, the feed type, the
|
|
66
|
+
subscription state — those are filter conditions, and they lie in `filterModel`.
|
|
66
67
|
|
|
67
|
-
##
|
|
68
|
+
## Query types in the entity namespace
|
|
68
69
|
|
|
69
70
|
```typescript
|
|
70
71
|
export type Query = IList.Query.State<EPromoCodeSortProperty, EPromoCodeFilterProperty>;
|
|
71
72
|
export type ListResult = IList.Result.State<IPromoCode.State, EPromoCodeSortProperty, EPromoCodeFilterProperty>;
|
|
72
73
|
```
|
|
73
74
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
##
|
|
78
|
-
|
|
79
|
-
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
-
|
|
88
|
-
-
|
|
75
|
+
The enums `EPromoCodeSortProperty` and `EPromoCodeFilterProperty` are declared in the model next
|
|
76
|
+
to the entity and repeat the set of names by which the server of this domain sorts and filters.
|
|
77
|
+
|
|
78
|
+
## Common misses
|
|
79
|
+
|
|
80
|
+
- An intermediate object between the response and the model: the response goes into the
|
|
81
|
+
converter whole.
|
|
82
|
+
- The query from its own request instead of the applied one from the response: otherwise the
|
|
83
|
+
screen will not see the server default and a condition the server dropped.
|
|
84
|
+
- A second input next to the query (`propertyId`, `feedType`): a filter living apart is seen by
|
|
85
|
+
neither the store nor the address.
|
|
86
|
+
- A bare `string` in the order field: a name the server does not sort by compiles and fails as a
|
|
87
|
+
request.
|
|
88
|
+
- One class for two entities: replacing the source of one drags an edit of the other along.
|
|
89
|
+
- A promise service in a new store: the base of the list store works with streams.
|
|
90
|
+
- An own copy of the shared page, order and filter mappers — caught by `npm run check:dupes`.
|