@cngx/ui 0.1.0-rc.8 → 0.3.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/README.md +118 -59
- package/action-button/README.md +170 -53
- package/breadcrumb/README.md +5 -6
- package/collection/README.md +1 -1
- package/command-palette/README.md +9 -5
- package/data-grid-accordion/README.md +1 -1
- package/empty-state/README.md +2 -3
- package/feedback/README.md +1 -1
- package/fesm2022/cngx-ui-a11y.mjs +13 -23
- package/fesm2022/cngx-ui-a11y.mjs.map +1 -1
- package/fesm2022/cngx-ui-accordion.mjs +55 -60
- package/fesm2022/cngx-ui-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-action-button.mjs +220 -339
- package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
- package/fesm2022/cngx-ui-breadcrumb.mjs +100 -80
- package/fesm2022/cngx-ui-breadcrumb.mjs.map +1 -1
- package/fesm2022/cngx-ui-chart-panel.mjs +18 -31
- package/fesm2022/cngx-ui-chart-panel.mjs.map +1 -1
- package/fesm2022/cngx-ui-collection.mjs +28 -34
- package/fesm2022/cngx-ui-collection.mjs.map +1 -1
- package/fesm2022/cngx-ui-command-palette.mjs +29 -51
- package/fesm2022/cngx-ui-command-palette.mjs.map +1 -1
- package/fesm2022/cngx-ui-context-menu.mjs +138 -89
- package/fesm2022/cngx-ui-context-menu.mjs.map +1 -1
- package/fesm2022/cngx-ui-data-grid-accordion.mjs +135 -77
- package/fesm2022/cngx-ui-data-grid-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-empty-state.mjs +17 -44
- package/fesm2022/cngx-ui-empty-state.mjs.map +1 -1
- package/fesm2022/cngx-ui-feedback.mjs +648 -495
- package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
- package/fesm2022/cngx-ui-layout.mjs +17 -13
- package/fesm2022/cngx-ui-layout.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-accordion.mjs +6 -7
- package/fesm2022/cngx-ui-mat-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-paginator.mjs +5 -9
- package/fesm2022/cngx-ui-mat-paginator.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-stepper.mjs +6 -9
- package/fesm2022/cngx-ui-mat-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-tabs.mjs +315 -134
- package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui-nav-rail.mjs +440 -0
- package/fesm2022/cngx-ui-nav-rail.mjs.map +1 -0
- package/fesm2022/cngx-ui-overlay.mjs +9 -10
- package/fesm2022/cngx-ui-overlay.mjs.map +1 -1
- package/fesm2022/cngx-ui-paginator.mjs +212 -188
- package/fesm2022/cngx-ui-paginator.mjs.map +1 -1
- package/fesm2022/cngx-ui-sidenav.mjs +872 -721
- package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
- package/fesm2022/cngx-ui-skeleton.mjs +17 -19
- package/fesm2022/cngx-ui-skeleton.mjs.map +1 -1
- package/fesm2022/cngx-ui-speak.mjs +21 -74
- package/fesm2022/cngx-ui-speak.mjs.map +1 -1
- package/fesm2022/cngx-ui-stat-card.mjs +39 -62
- package/fesm2022/cngx-ui-stat-card.mjs.map +1 -1
- package/fesm2022/cngx-ui-stepper.mjs +259 -130
- package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-tabs.mjs +148 -50
- package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui-timeline.mjs +48 -32
- package/fesm2022/cngx-ui-timeline.mjs.map +1 -1
- package/fesm2022/cngx-ui-toc.mjs +59 -48
- package/fesm2022/cngx-ui-toc.mjs.map +1 -1
- package/fesm2022/cngx-ui.mjs +5 -5
- package/fesm2022/cngx-ui.mjs.map +1 -1
- package/mat-tabs/README.md +57 -19
- package/mat-tabs/styles/mat-tabs.css +285 -163
- package/nav-rail/README.md +325 -0
- package/package.json +37 -8
- package/paginator/README.md +10 -0
- package/schematics/collection.json +9 -0
- package/schematics/ng-add/index.js +9 -0
- package/schematics/ng-add/schema.json +96 -0
- package/schematics/package.json +3 -0
- package/sidenav/README.md +150 -55
- package/skeleton/README.md +1 -1
- package/speak/README.md +1 -2
- package/stepper/README.md +20 -5
- package/tabs/README.md +13 -0
- package/timeline/README.md +1 -1
- package/toc/README.md +1 -1
- package/types/cngx-ui-a11y.d.ts +20 -38
- package/types/cngx-ui-accordion.d.ts +46 -71
- package/types/cngx-ui-action-button.d.ts +113 -151
- package/types/cngx-ui-breadcrumb.d.ts +60 -85
- package/types/cngx-ui-chart-panel.d.ts +22 -40
- package/types/cngx-ui-collection.d.ts +30 -43
- package/types/cngx-ui-command-palette.d.ts +40 -64
- package/types/cngx-ui-context-menu.d.ts +109 -48
- package/types/cngx-ui-data-grid-accordion.d.ts +50 -75
- package/types/cngx-ui-empty-state.d.ts +18 -8
- package/types/cngx-ui-feedback.d.ts +275 -292
- package/types/cngx-ui-layout.d.ts +4 -12
- package/types/cngx-ui-mat-accordion.d.ts +5 -5
- package/types/cngx-ui-mat-paginator.d.ts +4 -10
- package/types/cngx-ui-mat-stepper.d.ts +5 -10
- package/types/cngx-ui-mat-tabs.d.ts +86 -89
- package/types/cngx-ui-nav-rail.d.ts +416 -0
- package/types/cngx-ui-overlay.d.ts +4 -13
- package/types/cngx-ui-paginator.d.ts +186 -161
- package/types/cngx-ui-sidenav.d.ts +557 -437
- package/types/cngx-ui-skeleton.d.ts +7 -13
- package/types/cngx-ui-speak.d.ts +40 -24
- package/types/cngx-ui-stat-card.d.ts +45 -36
- package/types/cngx-ui-stepper.d.ts +205 -84
- package/types/cngx-ui-tabs.d.ts +104 -28
- package/types/cngx-ui-timeline.d.ts +31 -51
- package/types/cngx-ui-toc.d.ts +43 -54
- package/types/cngx-ui.d.ts +1 -1
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
# CngxNavRail
|
|
2
|
+
|
|
3
|
+
A narrow, always-collapsed column of navigation rows for apps whose primary
|
|
4
|
+
navigation never expands.
|
|
5
|
+
|
|
6
|
+
## Import
|
|
7
|
+
|
|
8
|
+
```typescript
|
|
9
|
+
import { CngxNavRail } from '@cngx/ui/nav-rail';
|
|
10
|
+
import {
|
|
11
|
+
CngxNavFooter,
|
|
12
|
+
CngxNavGroup,
|
|
13
|
+
CngxNavGroupContent,
|
|
14
|
+
CngxNavHeader,
|
|
15
|
+
CngxNavIcon,
|
|
16
|
+
CngxNavLink,
|
|
17
|
+
CngxNavMark,
|
|
18
|
+
} from '@cngx/common/interactive';
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Sidebar, drawer, sidenav or nav rail
|
|
22
|
+
|
|
23
|
+
| Artifact | Role | Owns | Does not do | Pick when |
|
|
24
|
+
|-|-|-|-|-|
|
|
25
|
+
| `[cngxSidebar]` (`@cngx/common/layout`) | A side region that stays in the layout | Expanded, rail and hidden state, the reserved inline size, the hover peek, `inert` and `aria-hidden` while hidden | No overlay, scrim or focus trap; no navigation rows | You build your own app shell around a persistent panel |
|
|
26
|
+
| `[cngxDrawer]` (`@cngx/common/layout`) | A panel that opens for a moment, over (`over`) or beside (`push`) the content | Open state, modality (`page`, `contained`, `none`): focus trap, `inert`, scroll lock, Escape and outside-press dismissal; the scrim with `class="cngx-drawer"` | No resting rail, no reserved space while closed | Navigation or filters that appear on demand, a mobile menu |
|
|
27
|
+
| `cngx-sidenav` (`@cngx/ui/sidenav`) | The finished navigation organism on a composed sidebar | Header and footer slots, width classes (drawer below 48rem, rail with the full nav as an overlay from 48rem, docked from 64rem), rail tooltip and group flyout, resize, shortcut, router sync | No rail that stays a rail on every layout | The app navigation that expands, collapses to a rail and turns into a drawer on narrow layouts |
|
|
28
|
+
| `cngx-nav-rail` (`@cngx/ui/nav-rail`) | A navigation column that is only ever a rail | Icon rows with the label as a tooltip or below the icon, groups as flyouts, the side | No open state, backdrop, focus trap, expand or peek | Primary navigation with a few top-level sections that never needs full-width labels |
|
|
29
|
+
|
|
30
|
+
`cngx-nav-rail` has no open state, no backdrop and no focus trap. It is a
|
|
31
|
+
`navigation` landmark with rows in it. `@cngx/ui/nav-rail` imports nothing from
|
|
32
|
+
`@cngx/ui/sidenav`; the other way round, a `cngx-sidenav` resting as a rail
|
|
33
|
+
uses the same tooltip and flyout (`CNGX_NAV_RAIL_TOOLTIP_FACTORY`,
|
|
34
|
+
`CNGX_NAV_RAIL_FLYOUT_FACTORY`, both in `@cngx/common/interactive`) and the
|
|
35
|
+
same tooltip config, so one override or one `withNavRailTooltip` reaches both.
|
|
36
|
+
|
|
37
|
+
## Quick start
|
|
38
|
+
|
|
39
|
+
```html
|
|
40
|
+
<cngx-nav-rail>
|
|
41
|
+
<cngx-nav-header>
|
|
42
|
+
<img cngxNavMark src="/logo.svg" alt="" />
|
|
43
|
+
</cngx-nav-header>
|
|
44
|
+
|
|
45
|
+
<a cngxNavLink routerLink="/inbox" routerLinkActive #inbox="routerLinkActive"
|
|
46
|
+
[active]="inbox.isActive">
|
|
47
|
+
<cngx-icon cngxNavIcon><mat-icon>inbox</mat-icon></cngx-icon>
|
|
48
|
+
Inbox
|
|
49
|
+
</a>
|
|
50
|
+
|
|
51
|
+
<button type="button" cngxNavGroup #reports="cngxNavGroup">
|
|
52
|
+
<cngx-icon cngxNavIcon><mat-icon>bar_chart</mat-icon></cngx-icon>
|
|
53
|
+
Reports
|
|
54
|
+
</button>
|
|
55
|
+
<div [cngxNavGroupContent]="reports">
|
|
56
|
+
<div>
|
|
57
|
+
<a cngxNavLink [depth]="1" routerLink="/reports/weekly">Weekly</a>
|
|
58
|
+
<a cngxNavLink [depth]="1" routerLink="/reports/monthly">Monthly</a>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
<cngx-nav-footer>
|
|
63
|
+
<img cngxNavMark src="/avatar.png" alt="" />
|
|
64
|
+
</cngx-nav-footer>
|
|
65
|
+
</cngx-nav-rail>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The rows are the nav atoms of `@cngx/common/interactive`, skinned by
|
|
69
|
+
`cngx-nav.css` (loaded by `cngx.css`). The rail sets their tokens and its own
|
|
70
|
+
width; it adds no row markup of its own.
|
|
71
|
+
|
|
72
|
+
## Looks
|
|
73
|
+
|
|
74
|
+
`labelPlacement` picks one of two looks, reflected as `data-label-placement`
|
|
75
|
+
on the host.
|
|
76
|
+
|
|
77
|
+
- `'end'` (default) - icon only. Each row keeps its full label; the label
|
|
78
|
+
starts at the row's inline-end padding edge and clips there, so it paints
|
|
79
|
+
nothing but stays the accessible name. A tooltip shows the label on hover
|
|
80
|
+
(after 300ms, see Configuration) and at once on keyboard focus. `[tooltip]`
|
|
81
|
+
or `withNavRailTooltip(false)` switches it off.
|
|
82
|
+
- `'below'` - the icon stacked over a short, centred, wrapping label. No
|
|
83
|
+
tooltip.
|
|
84
|
+
|
|
85
|
+
In both looks a badge sits on the icon's top inline-end corner, and section
|
|
86
|
+
labels (`cngxNavLabel`) keep their text for assistive technology but paint
|
|
87
|
+
nothing, in every colour mode.
|
|
88
|
+
|
|
89
|
+
A row without `cngxNavIcon` draws its first letter in the icon box, as in the
|
|
90
|
+
sidenav.
|
|
91
|
+
|
|
92
|
+
### Side
|
|
93
|
+
|
|
94
|
+
`side` names the edge the rail sits on, `'start'` (default) or `'end'`,
|
|
95
|
+
reflected as `data-side` on the host. It is logical: `'end'` is the right edge
|
|
96
|
+
in LTR and the left edge under `dir="rtl"`. `side` does not move the rail; its
|
|
97
|
+
place is its DOM order (put it after the content for an end rail). It turns
|
|
98
|
+
the side-dependent parts: the border goes on the rail's inner edge, and the
|
|
99
|
+
group flyout and the label tooltip open away from the rail, into the page.
|
|
100
|
+
|
|
101
|
+
Unbound, `[ariaLabel]` names an end rail by the `endAriaLabel` copy (English:
|
|
102
|
+
`Secondary navigation`) instead of `ariaLabel`, so a start rail and an end rail
|
|
103
|
+
on one page never share a landmark name. A lone end rail that is the main
|
|
104
|
+
navigation names itself through `[ariaLabel]`.
|
|
105
|
+
|
|
106
|
+
```html
|
|
107
|
+
<main>...</main>
|
|
108
|
+
<cngx-nav-rail side="end" ariaLabel="Tools">...</cngx-nav-rail>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Slots
|
|
112
|
+
|
|
113
|
+
| Slot | Position |
|
|
114
|
+
|-|-|
|
|
115
|
+
| `cngx-nav-header` / `[cngxNavHeader]` | above the rows, does not scroll |
|
|
116
|
+
| default content | the rows, scrolls on overflow |
|
|
117
|
+
| `cngx-nav-footer` / `[cngxNavFooter]` | below the rows, does not scroll |
|
|
118
|
+
|
|
119
|
+
Put `[cngxNavMark]` in the header or footer: it sits at the row icon x, so a
|
|
120
|
+
logo or avatar lines up with the icons.
|
|
121
|
+
|
|
122
|
+
## Groups as flyouts
|
|
123
|
+
|
|
124
|
+
A `cngxNavGroup` with its `cngxNavGroupContent` opens as a flyout beside the
|
|
125
|
+
head, in both looks. The flyout is a native `popover="manual"` positioned with
|
|
126
|
+
CSS anchor positioning at the head's inline end, or its inline start on an
|
|
127
|
+
end-side rail (flips at the viewport edge).
|
|
128
|
+
|
|
129
|
+
- `aria-expanded` on the head stays the one state; the flyout is open exactly
|
|
130
|
+
while the group is.
|
|
131
|
+
- It is a disclosure, not a menu: the links keep their link role and Tab walks
|
|
132
|
+
them in DOM order, head first.
|
|
133
|
+
- Escape on the head or inside the flyout closes it and moves focus to the
|
|
134
|
+
head; an Escape elsewhere on the page is left alone. Focus moving outside
|
|
135
|
+
the head and the flyout, or a press outside both, closes it. It also
|
|
136
|
+
closes when the rail turns `inert`, for example under a modal dialog.
|
|
137
|
+
|
|
138
|
+
CSS anchor positioning has no fallback here. In a browser without it the
|
|
139
|
+
flyout opens at the popover's default position.
|
|
140
|
+
|
|
141
|
+
## Accessibility
|
|
142
|
+
|
|
143
|
+
- The host is a `navigation` landmark. Its name is `[ariaLabel]` or, unbound,
|
|
144
|
+
the `navRail` section of the language pack (English: `Navigation`, or
|
|
145
|
+
`Secondary navigation` for `side="end"`). Name it apart from any other
|
|
146
|
+
navigation landmark on the page.
|
|
147
|
+
- The clipped label is the row's accessible name; the tooltip is
|
|
148
|
+
`aria-hidden` and only repeats it visually.
|
|
149
|
+
- Mark the active row with `[active]` on `cngxNavLink`; it sets
|
|
150
|
+
`aria-current="page"`.
|
|
151
|
+
|
|
152
|
+
## i18n
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
import { provideNavRailI18n, withNavRailI18nLabels } from '@cngx/ui/nav-rail';
|
|
156
|
+
|
|
157
|
+
bootstrapApplication(App, {
|
|
158
|
+
providers: [provideNavRailI18n(withNavRailI18nLabels({ ariaLabel: 'Hauptnavigation' }))],
|
|
159
|
+
});
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Resolution order: `[ariaLabel]`, then `CNGX_NAV_RAIL_I18N` (`ariaLabel`, or
|
|
163
|
+
`endAriaLabel` for an end-side rail), then the English default. `withNavRailI18nLabels` also takes a `Signal`, so the name follows a
|
|
164
|
+
language switch.
|
|
165
|
+
|
|
166
|
+
## Configuration
|
|
167
|
+
|
|
168
|
+
```typescript
|
|
169
|
+
import {
|
|
170
|
+
provideNavRailConfig,
|
|
171
|
+
withNavRailLabelPlacement,
|
|
172
|
+
withNavRailSide,
|
|
173
|
+
withNavRailTooltipDelay,
|
|
174
|
+
} from '@cngx/ui/nav-rail';
|
|
175
|
+
|
|
176
|
+
bootstrapApplication(App, {
|
|
177
|
+
providers: [
|
|
178
|
+
provideNavRailConfig(
|
|
179
|
+
withNavRailLabelPlacement('below'),
|
|
180
|
+
withNavRailSide('end'),
|
|
181
|
+
withNavRailTooltipDelay(500),
|
|
182
|
+
),
|
|
183
|
+
],
|
|
184
|
+
});
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
| Feature | Key | Default |
|
|
188
|
+
|-|-|-|
|
|
189
|
+
| `withNavRailLabelPlacement(placement)` | `labelPlacement` | `'end'` |
|
|
190
|
+
| `withNavRailSide(side)` | `side` | `'start'` |
|
|
191
|
+
| `withNavRailTooltip(enabled)` | `tooltip` | `true` (only the `'end'` look has a tooltip) |
|
|
192
|
+
| `withNavRailTooltipDelay(ms)` | `tooltipDelay` | `300` |
|
|
193
|
+
|
|
194
|
+
`[labelPlacement]`, `[side]` and `[tooltip]` win over the config, the config over the
|
|
195
|
+
default. With the tooltip off, no tooltip element exists and no listener is
|
|
196
|
+
attached; flipping it at runtime sets the tooltip up or tears it down.
|
|
197
|
+
`provideNavRailConfigAt(...)` in a component's `viewProviders` merges over the
|
|
198
|
+
parent scope. `injectNavRailConfig()` returns the configuration in scope with
|
|
199
|
+
every key resolved, defaults included. Both organisms pass `tooltipDelay` to
|
|
200
|
+
`injectNavRailTooltip` as `hoverDelay`, so the delay reaches both.
|
|
201
|
+
|
|
202
|
+
## Theming
|
|
203
|
+
|
|
204
|
+
Rail tokens (`nav-rail.css`):
|
|
205
|
+
|
|
206
|
+
| Token | Default |
|
|
207
|
+
|-|-|
|
|
208
|
+
| `--cngx-nav-rail-size` | `2 * (row inset + row inline padding) + icon size + border width`, so the icon box sits centred |
|
|
209
|
+
| `--cngx-nav-rail-below-size` | `5rem` |
|
|
210
|
+
| `--cngx-nav-rail-below-font-size` | `0.75rem` |
|
|
211
|
+
| `--cngx-nav-rail-bg` | `--cngx-color-surface` |
|
|
212
|
+
| `--cngx-nav-rail-color` | `--cngx-color-text`, the ink rows, header and footer inherit |
|
|
213
|
+
| `--cngx-nav-rail-border-color` | `--cngx-color-border`, the border on the rail's inner edge |
|
|
214
|
+
| `--cngx-nav-rail-row-gap` | half of `--cngx-space-xs`, the gap between body rows |
|
|
215
|
+
| `--cngx-nav-rail-border-width` | `1px`, the border on the rail's inner edge |
|
|
216
|
+
| `--cngx-nav-tooltip-offset` | `--cngx-space-sm`, the gap between a row and its label tooltip |
|
|
217
|
+
|
|
218
|
+
Flyout tokens (`cngx-nav.css`): `--cngx-nav-flyout-bg`, `-color`,
|
|
219
|
+
`-border-color`, `-border-width`, `-shadow`, `-radius`, `-padding`, `-min-inline-size`,
|
|
220
|
+
`-offset`. The rail sets `--cngx-nav-flyout-offset` so the flyout clears the
|
|
221
|
+
rail edge. The tooltip uses the `cngx-tooltip` skin; `cngx-nav.css` places it
|
|
222
|
+
`--cngx-nav-tooltip-offset` past the row, so the placement also reaches an organism that calls `injectNavRailTooltip` without
|
|
223
|
+
loading `nav-rail.css`.
|
|
224
|
+
|
|
225
|
+
Row tokens (`--cngx-nav-link-*`, `--cngx-nav-icon-size`) come from the nav
|
|
226
|
+
atoms and follow density.
|
|
227
|
+
|
|
228
|
+
### Material
|
|
229
|
+
|
|
230
|
+
```scss
|
|
231
|
+
@use '@angular/material' as mat;
|
|
232
|
+
@use '@cngx/themes/material/nav-rail-theme' as nav-rail;
|
|
233
|
+
|
|
234
|
+
html {
|
|
235
|
+
@include nav-rail.theme($theme);
|
|
236
|
+
}
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
`theme()` bridges the rail surface (`surface`), the flyout (`surface-container`,
|
|
240
|
+
level 2), the stacked label size (`label-medium`), the M3 rail metrics and the
|
|
241
|
+
rows, header and footer. The aggregate `@cngx/themes/material/theme` includes the rail through
|
|
242
|
+
`nav-rail.surface()`, since its sidenav bridge already covers the rows. The
|
|
243
|
+
label tooltip takes `tooltip-theme`.
|
|
244
|
+
|
|
245
|
+
Under an M3 theme the rail is the M3 navigation rail:
|
|
246
|
+
|
|
247
|
+
| Look | M3 value | Tokens |
|
|
248
|
+
|-|-|-|
|
|
249
|
+
| Both | 80px wide, no divider | `--cngx-nav-link-inset`, `--cngx-nav-link-padding`, `--cngx-nav-icon-size`, `--cngx-nav-icon-gap`, `--cngx-nav-rail-border-width` |
|
|
250
|
+
| `'end'` | the 56px row with the full pill radius is the round indicator | `--cngx-nav-link-radius` |
|
|
251
|
+
| `'below'` | 56px destination, 56 x 32 indicator pill behind the icon, label-medium label 4px under it, 500 at rest and 700 active | `--cngx-nav-rail-below-font-size`, `--cngx-nav-link-line-height`, `-letter-spacing`, `-font-weight`, `-active-font-weight` |
|
|
252
|
+
|
|
253
|
+
The metrics are rungs and `calc()`s of `--cngx-space-*`, so density re-scales
|
|
254
|
+
the rail like the sidenav rows. The `'below'` pill is drawn by the bridge, not
|
|
255
|
+
by `nav-rail.css`: without Material the row fill stays the indicator. Under
|
|
256
|
+
forced colours the `'below'` row keeps its M3 metrics and type and drops only
|
|
257
|
+
the pill; the active row signals in `Highlight` like every nav row.
|
|
258
|
+
|
|
259
|
+
## A rail beside a secondary sidebar
|
|
260
|
+
|
|
261
|
+
Apps with many sections often pair a rail of sections with a sidebar of the
|
|
262
|
+
pages in the current section. Put the rail and a `cngx-sidenav-layout` side
|
|
263
|
+
by side; the sidenav carries the section's pages and can collapse on its own.
|
|
264
|
+
|
|
265
|
+
```html
|
|
266
|
+
<div class="shell">
|
|
267
|
+
<cngx-nav-rail ariaLabel="Sections">
|
|
268
|
+
<a cngxNavLink routerLink="/mail" [active]="section() === 'mail'">
|
|
269
|
+
<cngx-icon cngxNavIcon><mat-icon>mail</mat-icon></cngx-icon>
|
|
270
|
+
Mail
|
|
271
|
+
</a>
|
|
272
|
+
<a cngxNavLink routerLink="/calendar" [active]="section() === 'calendar'">
|
|
273
|
+
<cngx-icon cngxNavIcon><mat-icon>event</mat-icon></cngx-icon>
|
|
274
|
+
Calendar
|
|
275
|
+
</a>
|
|
276
|
+
</cngx-nav-rail>
|
|
277
|
+
|
|
278
|
+
<cngx-sidenav-layout>
|
|
279
|
+
<cngx-sidenav mode="side" [opened]="true" ariaLabel="Mail">
|
|
280
|
+
<a cngxNavLink routerLink="/mail/inbox">Inbox</a>
|
|
281
|
+
<a cngxNavLink routerLink="/mail/sent">Sent</a>
|
|
282
|
+
</cngx-sidenav>
|
|
283
|
+
<cngx-sidenav-content>
|
|
284
|
+
<router-outlet />
|
|
285
|
+
</cngx-sidenav-content>
|
|
286
|
+
</cngx-sidenav-layout>
|
|
287
|
+
</div>
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
```css
|
|
291
|
+
.shell {
|
|
292
|
+
display: flex;
|
|
293
|
+
block-size: 100dvh;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.shell > cngx-sidenav-layout {
|
|
297
|
+
flex: 1 1 auto;
|
|
298
|
+
min-inline-size: 0;
|
|
299
|
+
}
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
Give the two landmarks different names, as above.
|
|
303
|
+
|
|
304
|
+
## Lower-level pieces
|
|
305
|
+
|
|
306
|
+
`CngxNavRail` is built on two injection functions of the nav atoms in
|
|
307
|
+
`@cngx/common/interactive` (see the
|
|
308
|
+
[nav README](../../common/interactive/nav/README.md)), which you can call in
|
|
309
|
+
your own organism:
|
|
310
|
+
|
|
311
|
+
Both are behind swap tokens: `CNGX_NAV_RAIL_TOOLTIP_FACTORY` and
|
|
312
|
+
`CNGX_NAV_RAIL_FLYOUT_FACTORY` default to the two functions; `cngx-nav-rail`
|
|
313
|
+
calls the provided factory in its own injection context. Provide `() => {}` to
|
|
314
|
+
drop one. The tooltip factory receives `railed` with the `[tooltip]` switch
|
|
315
|
+
already folded in. Both take one sources object, and `side` (`'start'` or
|
|
316
|
+
`'end'`) tells them which way to open.
|
|
317
|
+
|
|
318
|
+
- `injectNavRailTooltip({ railed, side, hoverDelay })` - the label tooltip for
|
|
319
|
+
clipped rows, shown after `hoverDelay()` ms under the pointer; while
|
|
320
|
+
`railed()` is `false` no tooltip element or listener exists.
|
|
321
|
+
- `injectNavRailFlyout({ railed, side, groups, groupElements, contents, contentElements })` -
|
|
322
|
+
nav groups as anchored flyouts while `railed()` is `true`; `groups` and
|
|
323
|
+
`contents` are your content queries for `CngxNavGroup` and
|
|
324
|
+
`CngxNavGroupContent`, `groupElements` and `contentElements` the same
|
|
325
|
+
queries with `read: ElementRef`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cngx/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Organism layer (layout, overlay, feedback, stepper, tabs) for the CNGX Angular component library. Material opt-in (mat-stepper, mat-tabs, material).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cngx",
|
|
@@ -24,12 +24,15 @@
|
|
|
24
24
|
"directory": "projects/ui"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"@cngx/utils": "0.
|
|
28
|
-
"@cngx/core": "0.
|
|
29
|
-
"@cngx/common": "0.
|
|
30
|
-
"@angular/cdk": "
|
|
31
|
-
"@angular/common": "
|
|
32
|
-
"@angular/core": "
|
|
27
|
+
"@cngx/utils": "0.3.0",
|
|
28
|
+
"@cngx/core": "0.3.0",
|
|
29
|
+
"@cngx/common": "0.3.0",
|
|
30
|
+
"@angular/cdk": ">=21.1.0 <23.0.0",
|
|
31
|
+
"@angular/common": ">=21.1.0 <23.0.0",
|
|
32
|
+
"@angular/core": ">=21.1.0 <23.0.0",
|
|
33
|
+
"rxjs": "^7.8.0",
|
|
34
|
+
"@angular/router": ">=21.1.0 <23.0.0",
|
|
35
|
+
"@angular/material": ">=21.1.0 <23.0.0"
|
|
33
36
|
},
|
|
34
37
|
"dependencies": {
|
|
35
38
|
"tslib": "^2.3.0"
|
|
@@ -108,6 +111,10 @@
|
|
|
108
111
|
"types": "./types/cngx-ui-mat-tabs.d.ts",
|
|
109
112
|
"default": "./fesm2022/cngx-ui-mat-tabs.mjs"
|
|
110
113
|
},
|
|
114
|
+
"./nav-rail": {
|
|
115
|
+
"types": "./types/cngx-ui-nav-rail.d.ts",
|
|
116
|
+
"default": "./fesm2022/cngx-ui-nav-rail.mjs"
|
|
117
|
+
},
|
|
111
118
|
"./overlay": {
|
|
112
119
|
"types": "./types/cngx-ui-overlay.d.ts",
|
|
113
120
|
"default": "./fesm2022/cngx-ui-overlay.mjs"
|
|
@@ -149,6 +156,28 @@
|
|
|
149
156
|
"default": "./fesm2022/cngx-ui-toc.mjs"
|
|
150
157
|
}
|
|
151
158
|
},
|
|
159
|
+
"schematics": "./schematics/collection.json",
|
|
160
|
+
"ng-update": {
|
|
161
|
+
"packageGroup": [
|
|
162
|
+
"@cngx/utils",
|
|
163
|
+
"@cngx/core",
|
|
164
|
+
"@cngx/common",
|
|
165
|
+
"@cngx/interop",
|
|
166
|
+
"@cngx/forms",
|
|
167
|
+
"@cngx/data-display",
|
|
168
|
+
"@cngx/ui",
|
|
169
|
+
"@cngx/themes"
|
|
170
|
+
]
|
|
171
|
+
},
|
|
172
|
+
"peerDependenciesMeta": {
|
|
173
|
+
"@angular/router": {
|
|
174
|
+
"optional": true
|
|
175
|
+
},
|
|
176
|
+
"@angular/material": {
|
|
177
|
+
"optional": true
|
|
178
|
+
}
|
|
179
|
+
},
|
|
152
180
|
"module": "fesm2022/cngx-ui.mjs",
|
|
153
|
-
"typings": "types/cngx-ui.d.ts"
|
|
181
|
+
"typings": "types/cngx-ui.d.ts",
|
|
182
|
+
"type": "module"
|
|
154
183
|
}
|
package/paginator/README.md
CHANGED
|
@@ -68,6 +68,16 @@ context needs.
|
|
|
68
68
|
are identical across all seven. `density` (`compact` / `default` / `comfortable`)
|
|
69
69
|
is orthogonal.
|
|
70
70
|
|
|
71
|
+
The buttons do not ripple by default, like every cngx button. Co-host
|
|
72
|
+
`cngxRipple` (`@cngx/common/interactive`) on a single-button segment and its
|
|
73
|
+
button ripples, clipped to the button radius:
|
|
74
|
+
|
|
75
|
+
```html
|
|
76
|
+
<cngx-pgn-prev cngxRipple [rippleCentered]="true" />
|
|
77
|
+
<cngx-pgn-next cngxRipple [rippleCentered]="true" />
|
|
78
|
+
<cngx-pgn-load-more cngxRipple />
|
|
79
|
+
```
|
|
80
|
+
|
|
71
81
|
## Reset and deep-linking
|
|
72
82
|
|
|
73
83
|
`[resetOn]` jumps to the first page whenever its bound value changes - bind the
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";var fe=Object.create;var y=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var ge=Object.getOwnPropertyNames;var me=Object.getPrototypeOf,ye=Object.prototype.hasOwnProperty;var xe=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),be=(n,e)=>{for(var r in e)y(n,r,{get:e[r],enumerable:!0})},V=(n,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of ge(e))!ye.call(n,o)&&o!==r&&y(n,o,{get:()=>e[o],enumerable:!(t=ue(e,o))||t.enumerable});return n};var he=(n,e,r)=>(r=n!=null?fe(me(n)):{},V(e||!n||!n.__esModule?y(r,"default",{value:n,enumerable:!0}):r,n)),Se=n=>V(y({},"__esModule",{value:!0}),n);var oe=xe((mn,B)=>{"use strict";var A=process||{},re=A.argv||[],O=A.env||{},je=!(O.NO_COLOR||re.includes("--no-color"))&&(!!O.FORCE_COLOR||re.includes("--color")||A.platform==="win32"||(A.stdout||{}).isTTY&&O.TERM!=="dumb"||!!O.CI),De=(n,e,r=n)=>t=>{let o=""+t,i=o.indexOf(e,n.length);return~i?n+Ve(o,e,r,i)+e:n+o+e},Ve=(n,e,r,t)=>{let o="",i=0;do o+=n.substring(i,t)+r,i=t+e.length,t=n.indexOf(e,i);while(~t);return o+n.substring(i)},te=(n=je)=>{let e=n?De:()=>String;return{isColorSupported:n,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};B.exports=te();B.exports.createColors=te});var Qe={};be(Qe,{ngAdd:()=>j});module.exports=Se(Qe);var S=require("@schematics/angular/utility");var U=require("@angular-devkit/schematics"),J=require("@schematics/angular/utility");function P(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function M(n){return n instanceof Error?n.message:String(n)}function G(n){return n.includes(`\r
|
|
2
|
+
`)?`\r
|
|
3
|
+
`:`
|
|
4
|
+
`}var g="package.json";function Re(n){return/\n([ \t]+)\S/.exec(n)?.[1]??" "}function Te(n,e){return JSON.stringify(JSON.parse(n),null," ").replace(/^\t+/gm,r=>e.repeat(r.length))}function x(...n){return e=>{let r=e.exists(g)?e.readText(g):void 0;return(0,U.chain)([(0,J.addDependency)(...n),t=>{if(r===void 0||!t.exists(g))return;let o=t.readText(g);if(o===r)return;let i=Re(r),s=i===" "?o:Te(o,i),l=G(r),d=r.endsWith(`
|
|
5
|
+
`)&&!s.endsWith(`
|
|
6
|
+
`)?`${s}
|
|
7
|
+
`:s,c=l===`
|
|
8
|
+
`?d:d.replace(/\r?\n/g,l);c!==o&&t.overwrite(g,c)}])}}var v=require("node:fs"),Y=require("node:path"),L=require("@angular-devkit/schematics");function w(n){return P(n)?Object.fromEntries(Object.entries(n).filter(e=>typeof e[1]=="string")):{}}function Ee(n){try{return JSON.parse(n)}catch(e){let r=e instanceof Error?e.message:String(e);throw new L.SchematicsException(`package.json is not valid JSON: ${r.replace(/\.$/,"")}.`)}}function u(n){let e=Ee(n);if(!P(e))throw new L.SchematicsException("package.json is not a JSON object.");return{name:typeof e.name=="string"?e.name:void 0,version:typeof e.version=="string"?e.version:void 0,dependencies:w(e.dependencies),devDependencies:w(e.devDependencies),peerDependencies:w(e.peerDependencies)}}function W(n){let{version:e}=u((0,v.readFileSync)(b(n),"utf8"));if(e===void 0)throw new Error(`No version in ${b(n)}.`);return e}function q(n){let{name:e}=u((0,v.readFileSync)(b(n),"utf8"));if(e===void 0)throw new Error(`No name in ${b(n)}.`);return e}function b(n){return(0,Y.join)(n,"..","..","package.json")}function m(n,e){return n.dependencies[e]??n.devDependencies[e]}var Ce=/^[\s^~<>=v]*(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:-([0-9A-Za-z.-]+))?/;function H(n){let e=Ce.exec(n??"");if(e===null)return;let[,r,t="0",o="0",i]=e;return{major:Number(r),minor:Number(t),patch:Number(o),prerelease:i===void 0?[]:i.split(".").map(s=>/^\d+$/.test(s)?Number(s):s)}}function Oe(n,e){return typeof n=="number"&&typeof e=="number"?n-e:typeof n=="number"?-1:typeof e=="number"?1:n===e?0:n<e?-1:1}function X(n,e){let r=H(n),t=H(e);if(r===void 0||t===void 0)return;let o=r.major-t.major||r.minor-t.minor||r.patch-t.patch;if(o!==0)return o;if(r.prerelease.length===0||t.prerelease.length===0)return t.prerelease.length-r.prerelease.length;let i=Math.max(r.prerelease.length,t.prerelease.length);for(let s=0;s<i;s++){let l=r.prerelease[s],d=t.prerelease[s];if(l===void 0||d===void 0)return l===void 0?-1:1;let c=Oe(l,d);if(c!==0)return c}return 0}function h(n,e){let r=n.read(`node_modules/${e}/package.json`);if(r!==null)try{return u(r.toString("utf8")).version}catch{return}}var Ae="package.json",Ne=/^[\s\d.^~<>=|xX*v-]+$/;function Pe(n,e){if(n!==void 0&&Ne.test(n)&&/\d/.test(n))return n;let r=/^(\d+)\.(\d+)\.\d+(-.+)?/.exec(e??"");if(r!==null)return r[3]===void 0?`^${r[1]}.${r[2]}.0`:`^${e}`}function K(n,e){return(r,t)=>{let o=e??t.logger,i=u(r.readText(Ae));if(m(i,n)!==void 0)return;let s=Pe(m(i,"@angular/core"),h(r,"@angular/core"));if(s===void 0){o.info(`Add ${n} matching your @angular/core yourself; cngx cannot read an Angular version to match it to.`);return}return o.info(`Adding ${n}@${s} to match @angular/core, so the install does not pick the ${n} of a newer Angular.`),x(n,s,{install:S.InstallBehavior.None,existing:S.ExistingBehavior.Skip})}}var R=require("@schematics/angular/utility"),z=require("@schematics/angular/utility/json-file");var Z="package.json";function k(n,e,r=!1){return(t,o)=>{let i=m(u(t.readText(Z)),n);if(i!==void 0&&i!==e){r&&o.logger.info(`Replacing ${n}@${i} with ${e} so every @cngx package stays on one version.`);let s=new z.JSONFile(t,Z);s.remove(["dependencies",n]),s.remove(["devDependencies",n])}return x(n,e,{install:R.InstallBehavior.None,existing:R.ExistingBehavior.Replace})}}var T=require("@angular-devkit/schematics"),we=["minimal","recommended","full"],E=["utils","core","common","interop","forms","data-display","ui"],ve=["cngx","material","none"],Le=["en","de"],ke=["claude","cursor","vscode"];function C(n,e){return n.some(r=>r===e)}function $e(n,e){return Array.isArray(e)&&e.every(r=>C(n,r))}function Fe(n){return typeof n=="boolean"}function F(n){return`--${n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}`}function _e(n,e){let r=e.length===1?"is":"are";return new T.SchematicsException(`"${e.join('", "')}" ${r} given more than once for ${F(n)}.`)}function Be(n,e){let r=F(n);return new T.SchematicsException(`${r} has an empty entry. Separate the values with single commas, for example ${r} ${e.slice(0,2).join(",")}.`)}function _(n,e,r){return new T.SchematicsException(`"${e.join('", "')}" is not a valid answer for ${F(n)}. Expected one of: ${r.join(", ")}.`)}var Q=["true","false"];function ee(n,e,r){if(r===void 0)return;let t=typeof r=="string"?r.split(",").map(i=>i.trim()):r;if(t.length===0)return;if(t.includes(""))throw Be(n,e);if(!$e(e,t))throw _(n,t.filter(i=>!C(e,i)),e);let o=t.filter((i,s)=>t.indexOf(i)!==s);if(o.length>0)throw _e(n,[...new Set(o)]);return t}function $(n,e,r){if(r!==void 0){if(!C(e,r))throw _(n,[r],e);return r}}function f(n,e){if(e===void 0||Fe(e))return e;if(!C(Q,e))throw _(n,[e],Q);return e==="true"}function Ie(n){return(typeof n=="string"?n.split(",").map(r=>r.trim()):Array.isArray(n)?n:void 0)?.filter(r=>typeof r=="string"&&r.startsWith("@cngx/"))}function ne(n){return{project:n.project,preset:$("preset",we,n.preset),libs:ee("libs",E,n.libs),theme:$("theme",ve,n.theme),i18n:$("i18n",Le,n.i18n),runtimeSwitch:f("runtimeSwitch",n.runtimeSwitch),lint:f("lint",n.lint),a11yPreferences:f("a11yPreferences",n.a11yPreferences),feedback:f("feedback",n.feedback),floatingFallback:f("floatingFallback",n.floatingFallback),starter:f("starter",n.starter),aiTools:ee("aiTools",ke,n.aiTools),yes:f("yes",n.yes),prompts:f("prompts",n.prompts),quiet:f("quiet",n.quiet),pins:Ie(n.pins)}}var p=require("@angular-devkit/schematics"),N=require("@angular-devkit/schematics/tasks");var ie=he(oe());function Me(n,e){if(n.NO_COLOR!==void 0&&n.NO_COLOR!=="")return!1;let r=n.FORCE_COLOR;return r!==void 0?r!=="0"&&r!=="false":e}function se(n,e){let r=Me(n,e),t=(0,ie.createColors)(r);return{enabled:r,bold:t.bold,dim:t.dim,green:t.green,yellow:t.yellow,red:t.red}}function ae(n){let e=n?.toLowerCase();return e==="1"||e==="true"?!0:e==="0"||e==="false"?!1:void 0}function Ge(n){return ae(n.CI)===!0}function Ue(n,e){return ae(n.NG_FORCE_TTY)??(e.isTTY===!0&&!Ge(n))}function de(n,e,r,t,o){let i=Ue(n,e);return{isTTY:i,color:se(n,i),quiet:o,logger:t,terminal:i?Je(e,r):void 0}}function Je(n,e){if(n.write===void 0)return;let r=o=>i=>{o.write?.(`${i}
|
|
9
|
+
`)},t=r(e.write===void 0?n:e);return{info:r(n),warn:t,error:t}}var He=["0.0.0","PLACEHOLDER"].join("-");function le(n){return n===He}var a="@cngx/core",Ye="@angular/cdk";function We(n){return n!=="@cngx/utils"}function qe(n){return n instanceof Error&&n.constructor.name==="CollectionCannotBeResolvedException"}function I(n){try{n.engine.createCollection(a)}catch(e){let r=qe(e)?"it cannot be resolved":M(e);throw new p.SchematicsException(`${a} is installed but its ng-add collection failed to load: ${r}`)}}function Xe(n){return E.find(e=>`@cngx/${e}`===n)}function Ke(n,e){let r=Xe(e),t=ne({libs:n.libs}).libs;if(t===void 0||r===void 0)return n;let o=new Set([...t,r]);return{...n,libs:E.filter(i=>o.has(i))}}function Ze(n){let e=de(process.env,process.stdout,process.stderr,n.logger,!1);return e.terminal??e.logger}function ze(n,e,r,t){return n===void 0?`${a} is not installed yet; installing it before its ng-add runs.`:e===void 0?`${a} ${n} is installed with a version cngx cannot read; installing ${t} before its ng-add runs.`:`${a} ${n} is installed, older than ${r} ${t}; installing ${t} before its ng-add runs.`}function j(n,e=__dirname){return(r,t)=>{let o=W(e),i=q(e),s=Ke(n,i),l=Ze(t),d=h(r,a),c=d===void 0?void 0:X(d,o);if(le(o)){if(d===void 0)throw new p.SchematicsException(`${i} is an unstamped local build (${o}) and ${a} is not installed; pack the libs with node scripts/pack-libs.mjs and install the tarballs.`);return l.info(`${i} is an unstamped local build (${o}); pinning nothing and following the installed ${a} ${d}.`),I(t),(0,p.externalSchematic)(a,"ng-add",s)}if(c!==void 0&&c>0)return l.info(`${a} ${d} is installed, newer than ${i} ${o}; following the installed core.`),I(t),(0,p.externalSchematic)(a,"ng-add",s);if(c===0)return I(t),(0,p.externalSchematic)(a,"ng-add",{...s,pins:[a,i]});let ce=(0,p.chain)([k(a,o,!0),k(i,o,!0)]);return l.info(ze(d,c,i,o)),(0,p.chain)([ce,...We(i)?[K(Ye,l)]:[],(en,D)=>{let pe=D.addTask(new N.NodePackageInstallTask);D.addTask(new N.RunSchematicTask(a,"ng-add",{...s}),[pe])}])}}0&&(module.exports={ngAdd});
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "CngxNgAdd",
|
|
4
|
+
"title": "cngx ng-add",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"project": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The project to add cngx to.",
|
|
10
|
+
"$default": {
|
|
11
|
+
"$source": "projectName"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"preset": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"description": "How much of the onboarding to apply. Asked first when a terminal is attached, after the preflight checklist; default recommended.",
|
|
17
|
+
"enum": ["minimal", "recommended", "full"]
|
|
18
|
+
},
|
|
19
|
+
"libs": {
|
|
20
|
+
"description": "The @cngx packages to install, comma-separated (--libs core,forms); their @cngx peers follow. Asked when a terminal is attached, otherwise every package.",
|
|
21
|
+
"oneOf": [
|
|
22
|
+
{ "type": "string" },
|
|
23
|
+
{
|
|
24
|
+
"type": "array",
|
|
25
|
+
"items": { "type": "string", "enum": ["utils", "core", "common", "interop", "forms", "data-display", "ui"] },
|
|
26
|
+
"uniqueItems": true
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
"theme": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"description": "The generated theme file: the cngx default, the Angular Material bridge, or none.",
|
|
33
|
+
"enum": ["cngx", "material", "none"]
|
|
34
|
+
},
|
|
35
|
+
"i18n": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"description": "The built-in copy: English only, or the German pack as well.",
|
|
38
|
+
"enum": ["en", "de"]
|
|
39
|
+
},
|
|
40
|
+
"runtimeSwitch": {
|
|
41
|
+
"oneOf": [{ "type": "boolean" }, { "type": "string", "enum": ["true", "false"] }],
|
|
42
|
+
"description": "Wire the language pack for switching at runtime instead of a fixed language."
|
|
43
|
+
},
|
|
44
|
+
"lint": {
|
|
45
|
+
"oneOf": [{ "type": "boolean" }, { "type": "string", "enum": ["true", "false"] }],
|
|
46
|
+
"description": "Add @cngx/eslint-plugin to the eslint flat config when one exists."
|
|
47
|
+
},
|
|
48
|
+
"a11yPreferences": {
|
|
49
|
+
"oneOf": [{ "type": "boolean" }, { "type": "string", "enum": ["true", "false"] }],
|
|
50
|
+
"description": "Provide the accessibility preference axes (density, text scale, motion, contrast) with persistence."
|
|
51
|
+
},
|
|
52
|
+
"feedback": {
|
|
53
|
+
"oneOf": [{ "type": "boolean" }, { "type": "string", "enum": ["true", "false"] }],
|
|
54
|
+
"description": "Provide toasts, alerts and banners at the root when @cngx/ui is installed."
|
|
55
|
+
},
|
|
56
|
+
"floatingFallback": {
|
|
57
|
+
"oneOf": [{ "type": "boolean" }, { "type": "string", "enum": ["true", "false"] }],
|
|
58
|
+
"description": "Install @floating-ui/dom and provide the popover positioning fallback for browsers without CSS anchor positioning."
|
|
59
|
+
},
|
|
60
|
+
"starter": {
|
|
61
|
+
"oneOf": [{ "type": "boolean" }, { "type": "string", "enum": ["true", "false"] }],
|
|
62
|
+
"description": "Replace the Angular welcome page of an untouched ng new standalone app with a cngx starter page that shows what was installed. Default true for --preset=full, false otherwise; --no-starter keeps the welcome page."
|
|
63
|
+
},
|
|
64
|
+
"aiTools": {
|
|
65
|
+
"description": "The editors to set up the cngx MCP server for, comma-separated (--ai-tools claude,vscode): the server entry in their project MCP config, a marked cngx block in the agent instructions (AGENTS.md, or CLAUDE.md for Claude Code) and .cngx/README.md. Asked when a terminal is attached. --preset=full preselects the detected editors (CLAUDE.md or .claude, .cursorrules or .cursor, .vscode) and sets them up without a terminal too; the other presets preselect none.",
|
|
66
|
+
"oneOf": [
|
|
67
|
+
{ "type": "string" },
|
|
68
|
+
{
|
|
69
|
+
"type": "array",
|
|
70
|
+
"items": { "type": "string", "enum": ["claude", "cursor", "vscode"] },
|
|
71
|
+
"uniqueItems": true
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
"yes": {
|
|
76
|
+
"oneOf": [{ "type": "boolean" }, { "type": "string", "enum": ["true", "false"] }],
|
|
77
|
+
"description": "Apply the plan to an existing app without asking for confirmation first."
|
|
78
|
+
},
|
|
79
|
+
"prompts": {
|
|
80
|
+
"oneOf": [{ "type": "boolean" }, { "type": "string", "enum": ["true", "false"] }],
|
|
81
|
+
"description": "Ask the detection-dependent questions when a terminal is attached. Pass false in CI runs under a pseudo-terminal; flags, the recorded answers of a re-run and the preset defaults answer instead.",
|
|
82
|
+
"default": true
|
|
83
|
+
},
|
|
84
|
+
"quiet": {
|
|
85
|
+
"oneOf": [{ "type": "boolean" }, { "type": "string", "enum": ["true", "false"] }],
|
|
86
|
+
"description": "Print only the summary, not the planned changes.",
|
|
87
|
+
"default": false
|
|
88
|
+
},
|
|
89
|
+
"pins": {
|
|
90
|
+
"oneOf": [{ "type": "string" }, { "type": "array", "items": { "type": "string" } }],
|
|
91
|
+
"description": "Set by a @cngx package shim that delegates in the same run: the @cngx packages core's plan pins beside the selected ones.",
|
|
92
|
+
"visible": false
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
"required": []
|
|
96
|
+
}
|