@cngx/ui 0.1.0-rc.7 → 0.1.0-rc.9
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 +0 -1
- package/a11y/README.md +11 -5
- package/accordion/README.md +4 -2
- package/breadcrumb/README.md +262 -0
- package/collection/README.md +6 -0
- package/command-palette/README.md +227 -0
- package/data-grid-accordion/README.md +76 -2
- package/feedback/README.md +40 -0
- package/fesm2022/cngx-ui-a11y.mjs +189 -57
- package/fesm2022/cngx-ui-a11y.mjs.map +1 -1
- package/fesm2022/cngx-ui-accordion.mjs +120 -36
- package/fesm2022/cngx-ui-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-action-button.mjs +121 -56
- package/fesm2022/cngx-ui-action-button.mjs.map +1 -1
- package/fesm2022/cngx-ui-breadcrumb.mjs +228 -108
- package/fesm2022/cngx-ui-breadcrumb.mjs.map +1 -1
- package/fesm2022/cngx-ui-chart-panel.mjs +180 -23
- package/fesm2022/cngx-ui-chart-panel.mjs.map +1 -1
- package/fesm2022/cngx-ui-collection.mjs +204 -62
- package/fesm2022/cngx-ui-collection.mjs.map +1 -1
- package/fesm2022/cngx-ui-command-palette.mjs +395 -119
- package/fesm2022/cngx-ui-command-palette.mjs.map +1 -1
- package/fesm2022/cngx-ui-context-menu.mjs +209 -40
- package/fesm2022/cngx-ui-context-menu.mjs.map +1 -1
- package/fesm2022/cngx-ui-data-grid-accordion.mjs +498 -101
- package/fesm2022/cngx-ui-data-grid-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-empty-state.mjs +16 -6
- package/fesm2022/cngx-ui-empty-state.mjs.map +1 -1
- package/fesm2022/cngx-ui-feedback.mjs +1074 -460
- package/fesm2022/cngx-ui-feedback.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-accordion.mjs +76 -7
- package/fesm2022/cngx-ui-mat-accordion.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-paginator.mjs +67 -24
- package/fesm2022/cngx-ui-mat-paginator.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-stepper.mjs +72 -47
- package/fesm2022/cngx-ui-mat-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-mat-tabs.mjs +555 -204
- package/fesm2022/cngx-ui-mat-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui-overlay.mjs +69 -13
- package/fesm2022/cngx-ui-overlay.mjs.map +1 -1
- package/fesm2022/cngx-ui-paginator.mjs +553 -198
- package/fesm2022/cngx-ui-paginator.mjs.map +1 -1
- package/fesm2022/cngx-ui-sidenav.mjs +344 -109
- package/fesm2022/cngx-ui-sidenav.mjs.map +1 -1
- package/fesm2022/cngx-ui-skeleton.mjs +4 -16
- package/fesm2022/cngx-ui-skeleton.mjs.map +1 -1
- package/fesm2022/cngx-ui-speak.mjs +107 -8
- package/fesm2022/cngx-ui-speak.mjs.map +1 -1
- package/fesm2022/cngx-ui-stat-card.mjs +146 -46
- package/fesm2022/cngx-ui-stat-card.mjs.map +1 -1
- package/fesm2022/cngx-ui-stepper.mjs +234 -99
- package/fesm2022/cngx-ui-stepper.mjs.map +1 -1
- package/fesm2022/cngx-ui-tabs.mjs +88 -25
- package/fesm2022/cngx-ui-tabs.mjs.map +1 -1
- package/fesm2022/cngx-ui-timeline.mjs +98 -23
- package/fesm2022/cngx-ui-timeline.mjs.map +1 -1
- package/fesm2022/cngx-ui-toc.mjs +101 -33
- package/fesm2022/cngx-ui-toc.mjs.map +1 -1
- package/fesm2022/cngx-ui.mjs +15 -20
- package/fesm2022/cngx-ui.mjs.map +1 -1
- package/mat-paginator/README.md +9 -2
- package/mat-tabs/README.md +30 -6
- package/mat-tabs/styles/mat-tabs.css +188 -42
- package/overlay/README.md +9 -4
- package/package.json +31 -7
- package/paginator/README.md +8 -4
- package/schematics/collection.json +9 -0
- package/schematics/ng-add/index.js +9 -0
- package/schematics/ng-add/schema.json +91 -0
- package/schematics/package.json +3 -0
- package/sidenav/README.md +33 -11
- package/speak/README.md +3 -2
- package/stepper/README.md +14 -2
- package/timeline/README.md +1 -1
- package/toc/README.md +4 -1
- package/types/cngx-ui-a11y.d.ts +121 -30
- package/types/cngx-ui-accordion.d.ts +100 -28
- package/types/cngx-ui-action-button.d.ts +44 -3
- package/types/cngx-ui-breadcrumb.d.ts +167 -60
- package/types/cngx-ui-chart-panel.d.ts +122 -18
- package/types/cngx-ui-collection.d.ts +157 -55
- package/types/cngx-ui-command-palette.d.ts +297 -183
- package/types/cngx-ui-context-menu.d.ts +140 -10
- package/types/cngx-ui-data-grid-accordion.d.ts +278 -39
- package/types/cngx-ui-empty-state.d.ts +9 -2
- package/types/cngx-ui-feedback.d.ts +605 -59
- package/types/cngx-ui-mat-accordion.d.ts +30 -1
- package/types/cngx-ui-mat-paginator.d.ts +37 -8
- package/types/cngx-ui-mat-stepper.d.ts +23 -11
- package/types/cngx-ui-mat-tabs.d.ts +250 -34
- package/types/cngx-ui-overlay.d.ts +56 -10
- package/types/cngx-ui-paginator.d.ts +425 -136
- package/types/cngx-ui-sidenav.d.ts +248 -74
- package/types/cngx-ui-skeleton.d.ts +6 -7
- package/types/cngx-ui-speak.d.ts +118 -5
- package/types/cngx-ui-stat-card.d.ts +117 -33
- package/types/cngx-ui-stepper.d.ts +88 -49
- package/types/cngx-ui-tabs.d.ts +6 -4
- package/types/cngx-ui-timeline.d.ts +35 -11
- package/types/cngx-ui-toc.d.ts +93 -16
- package/types/cngx-ui.d.ts +7 -4
package/fesm2022/cngx-ui.mjs
CHANGED
|
@@ -8,32 +8,27 @@ export { CngxFailed, CngxPending, CngxSucceeded } from '@cngx/common/interactive
|
|
|
8
8
|
/**
|
|
9
9
|
* @cngx/ui
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* Organism layer of cngx: 26 secondary entry points (layout, overlay,
|
|
12
|
+
* feedback, stepper/mat-stepper, tabs/mat-tabs, accordion/mat-accordion,
|
|
13
|
+
* paginator/mat-paginator, sidenav, breadcrumb, timeline, toc,
|
|
14
|
+
* command-palette, context-menu, collection, stat-card, chart-panel,
|
|
15
|
+
* data-grid-accordion, empty-state, action-button, skeleton, speak, a11y).
|
|
16
|
+
* Import from the specific entry point; the root barrel keeps only a
|
|
17
|
+
* small backwards-compat set (see public-api.ts).
|
|
15
18
|
*/
|
|
16
19
|
/** @internal - replaced at publish time, not part of consumer API. */
|
|
17
|
-
const VERSION = makeVersion('0.1.0-rc.
|
|
20
|
+
const VERSION = makeVersion('0.1.0-rc.9');
|
|
18
21
|
|
|
19
22
|
/**
|
|
20
23
|
* Public API Surface of @cngx/ui
|
|
21
24
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* @cngx/ui/mat-stepper
|
|
30
|
-
* @cngx/ui/mat-tabs
|
|
31
|
-
* @cngx/ui/overlay
|
|
32
|
-
* @cngx/ui/sidenav
|
|
33
|
-
* @cngx/ui/skeleton
|
|
34
|
-
* @cngx/ui/speak
|
|
35
|
-
* @cngx/ui/stepper
|
|
36
|
-
* @cngx/ui/tabs
|
|
25
|
+
* The root entry is a small backwards-compat set only: it re-exports
|
|
26
|
+
* `action-button`, `sidenav`, `skeleton` and `speak` plus the three
|
|
27
|
+
* async-state directives that moved to `@cngx/common/interactive`.
|
|
28
|
+
* Everything else ships exclusively through its secondary entry point
|
|
29
|
+
* (`@cngx/ui/<entry>`, 26 entries) - deliberately not re-exported here so
|
|
30
|
+
* a root import can never pull Material or CDK into a bundle that does
|
|
31
|
+
* not use them.
|
|
37
32
|
*
|
|
38
33
|
* @module @cngx/ui
|
|
39
34
|
*/
|
package/fesm2022/cngx-ui.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cngx-ui.mjs","sources":["../../../projects/ui/ui.ts","../../../projects/ui/public-api.ts","../../../projects/ui/cngx-ui.ts"],"sourcesContent":["/**\n * @cngx/ui\n *\n *
|
|
1
|
+
{"version":3,"file":"cngx-ui.mjs","sources":["../../../projects/ui/ui.ts","../../../projects/ui/public-api.ts","../../../projects/ui/cngx-ui.ts"],"sourcesContent":["/**\n * @cngx/ui\n *\n * Organism layer of cngx: 26 secondary entry points (layout, overlay,\n * feedback, stepper/mat-stepper, tabs/mat-tabs, accordion/mat-accordion,\n * paginator/mat-paginator, sidenav, breadcrumb, timeline, toc,\n * command-palette, context-menu, collection, stat-card, chart-panel,\n * data-grid-accordion, empty-state, action-button, skeleton, speak, a11y).\n * Import from the specific entry point; the root barrel keeps only a\n * small backwards-compat set (see public-api.ts).\n */\n\nimport { makeVersion } from '@cngx/utils';\n\n/** @internal - replaced at publish time, not part of consumer API. */\nexport const VERSION = makeVersion('0.0.0-PLACEHOLDER');\n","/**\n * Public API Surface of @cngx/ui\n *\n * The root entry is a small backwards-compat set only: it re-exports\n * `action-button`, `sidenav`, `skeleton` and `speak` plus the three\n * async-state directives that moved to `@cngx/common/interactive`.\n * Everything else ships exclusively through its secondary entry point\n * (`@cngx/ui/<entry>`, 26 entries) - deliberately not re-exported here so\n * a root import can never pull Material or CDK into a bundle that does\n * not use them.\n *\n * @module @cngx/ui\n */\n\nexport * from './ui';\nexport * from '@cngx/ui/action-button';\nexport * from '@cngx/ui/sidenav';\nexport * from '@cngx/ui/skeleton';\nexport * from '@cngx/ui/speak';\n\n// Re-export from @cngx/common/interactive for backwards compatibility\nexport { CngxPending, CngxSucceeded, CngxFailed } from '@cngx/common/interactive';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;;;;AAUG;AAIH;MACa,OAAO,GAAG,WAAW,CAAC,mBAAmB;;ACftD;;;;;;;;;;;;AAYG;;ACZH;;AAEG;;;;"}
|
package/mat-paginator/README.md
CHANGED
|
@@ -72,8 +72,15 @@ every change-detection pass and would reset on each.
|
|
|
72
72
|
|
|
73
73
|
`<mat-paginator>` only relabels its own range text, which a screen reader does not
|
|
74
74
|
announce. With `[announce]` the bridge mounts a visually-hidden `aria-live`
|
|
75
|
-
region and speaks the new page
|
|
76
|
-
the
|
|
75
|
+
region and speaks the new page after every change. The default phrasing
|
|
76
|
+
resolves from the shared `CNGX_PAGINATOR_CONFIG` cascade
|
|
77
|
+
(`announcements.pageChange`, "Page N of M" in English), whose defaults are the
|
|
78
|
+
`paginator` section of the cngx language pack, so the announcement is translated
|
|
79
|
+
with the rest of the pack and `provideCngxPaginatorConfig(withPaginatorAnnouncements(...))`
|
|
80
|
+
overrides it together with the `CngxPaginator` organism. Material's own
|
|
81
|
+
`MatPaginatorIntl` stays responsible for the visible Material labels and range;
|
|
82
|
+
cngx never writes it. Bind `[announceLabel]` for a richer per-instance message -
|
|
83
|
+
its context also carries the visible item range.
|
|
77
84
|
|
|
78
85
|
```html
|
|
79
86
|
<mat-paginator cngxMatPaginator [total]="items().length" announce></mat-paginator>
|
package/mat-tabs/README.md
CHANGED
|
@@ -55,7 +55,7 @@ per-instance or globally via `--cngx-mat-tab-error-*`:
|
|
|
55
55
|
|-|-|-|
|
|
56
56
|
| `--cngx-mat-tab-error-color` | `var(--mat-sys-error, #c62828)` | Foreground / outline colour |
|
|
57
57
|
| `--cngx-mat-tab-error-outline` | `2px solid currentColor` | Full `outline` shorthand |
|
|
58
|
-
| `--cngx-mat-tab-error-outline-offset` | `
|
|
58
|
+
| `--cngx-mat-tab-error-outline-offset` | `-2px` | Outline inset; negative so the clipped label container keeps every edge |
|
|
59
59
|
| `--cngx-mat-tab-error-font-weight` | `600` | Label-glyph weight bump |
|
|
60
60
|
|
|
61
61
|
Three-tier fallback: consumer override → Material design token →
|
|
@@ -67,16 +67,22 @@ surface inherit the rejection skin automatically.
|
|
|
67
67
|
`[cngxMatTabs]` projects the `presenter.lastFailedIndex()` signal onto
|
|
68
68
|
the matching `.mat-mdc-tab` button via `Renderer2`:
|
|
69
69
|
|
|
70
|
-
- **Set**
|
|
70
|
+
- **Set** when a commit does not land (both optimistic and pessimistic
|
|
71
|
+
modes): a refusal (`commitAction` answered `false`) or a failure
|
|
72
|
+
(it threw, rejected or errored). `presenter.lastOutcome()` tells the
|
|
73
|
+
two apart; the descriptor reads the refused copy for a refusal and
|
|
74
|
+
the rolled-back copy for a failure, and the
|
|
75
|
+
`*cngxMatTabRejectionContent` context carries `reason`.
|
|
71
76
|
- **Cleared** on the next successful re-pick of the same tab.
|
|
72
77
|
- **Cleared** on programmatic `presenter.clearLastFailed()` call.
|
|
73
78
|
|
|
74
|
-
The decoration adds `class="cngx-mat-tab--error"` and
|
|
75
|
-
|
|
76
|
-
|
|
79
|
+
The decoration adds `class="cngx-mat-tab--error"` and an SR-only
|
|
80
|
+
descriptor span referenced from the tab's `aria-describedby` (no
|
|
81
|
+
`aria-invalid`: it is form-field vocabulary, not a tab state). For a richer announcement phrase, compose
|
|
77
82
|
`<cngx-toast-on />` next to `[cngxMatTabs]` on the `<mat-tab-group>`
|
|
78
83
|
element; the bridge reads the same `CNGX_STATEFUL` source as the
|
|
79
|
-
decoration
|
|
84
|
+
decoration and reacts to failures only (a refusal leaves the commit
|
|
85
|
+
state at `'idle'`).
|
|
80
86
|
|
|
81
87
|
## Per-tab error aggregation
|
|
82
88
|
|
|
@@ -111,6 +117,24 @@ commit-action rejection lifecycle - a tab can carry both
|
|
|
111
117
|
the `--has-errors` badge slightly when both classes co-occur so the
|
|
112
118
|
two signals read as distinct.
|
|
113
119
|
|
|
120
|
+
### Direct error flag
|
|
121
|
+
|
|
122
|
+
When one value already says "this tab is invalid", skip the
|
|
123
|
+
aggregator: `[cngxMatTabErrorFlag]` takes a `string | boolean`. It
|
|
124
|
+
lands the same `--has-errors` class, descriptor span and
|
|
125
|
+
`aria-describedby` token as `[cngxMatTabError]`. The descriptor text
|
|
126
|
+
resolves aggregator `announcement()` -> the flag's string -> the
|
|
127
|
+
`tabHasErrors(count)` phrase from `CNGX_TABS_I18N`, so a bare `true`
|
|
128
|
+
still reads "1 error". `false` or `''` clears everything. On
|
|
129
|
+
`<nav mat-tab-nav-bar cngxMatTabNav>` the `[error]` input of
|
|
130
|
+
`[cngxMatTabLink]` does the same for `.mat-mdc-tab-link`.
|
|
131
|
+
|
|
132
|
+
```html
|
|
133
|
+
<mat-tab label="Profile" [cngxMatTabErrorFlag]="nameInvalid() ? 'Name is required' : false">
|
|
134
|
+
…
|
|
135
|
+
</mat-tab>
|
|
136
|
+
```
|
|
137
|
+
|
|
114
138
|
## Smart overflow
|
|
115
139
|
|
|
116
140
|
`[cngxMatTabs]` ships a smart overflow story: when Material's tab
|
|
@@ -17,11 +17,20 @@
|
|
|
17
17
|
* - `.cngx-mat-tab--error` - rejected commit; tinted color, outline
|
|
18
18
|
* ring, font-weight bump. Specificity bump `.mat-mdc-tab.cngx-
|
|
19
19
|
* mat-tab--error` is load-bearing - Material 21's `.mdc-tab` sets
|
|
20
|
-
* `outline: none` at (0,1,0)
|
|
21
|
-
*
|
|
22
|
-
*
|
|
20
|
+
* `outline: none` at (0,1,0). `[data-reason="failed"]` stays in the
|
|
21
|
+
* error red; `[data-reason="refused"]` (the commit action answered
|
|
22
|
+
* `false`) takes the rejection amber and keeps the resting label colour
|
|
23
|
+
* - `.cngx-mat-tab__rejection-icon` - `aria-hidden` glyph disc the
|
|
24
|
+
* decoration appends to the rejected tab: `!` on a failed commit,
|
|
25
|
+
* `\2298` on a refused one, so the two never differ by colour alone.
|
|
26
|
+
* On its own it sits at the tab's trailing top corner, the spot and size
|
|
27
|
+
* of the has-errors badge; when the tab also carries that badge it drops
|
|
28
|
+
* back inline after the label, so the two discs never overlap
|
|
29
|
+
* - `.cngx-mat-tab--error` + `.mat-mdc-tab-disabled` - no extra rule:
|
|
30
|
+
* Material paints the disabled label colour and the error outline
|
|
31
|
+
* stays, so it does not pass for a healthy disabled tab
|
|
23
32
|
* - `.cngx-mat-tab--has-errors` - form-validation errors present;
|
|
24
|
-
* renders
|
|
33
|
+
* renders an `::after` red disc with an `!` glyph at the trailing
|
|
25
34
|
* corner. Distinct semantic from `--error` and the two coexist
|
|
26
35
|
* - `.cngx-mat-tab--error.cngx-mat-tab--has-errors` - co-occurrence;
|
|
27
36
|
* shifts the has-errors glyph inward via
|
|
@@ -43,9 +52,11 @@
|
|
|
43
52
|
* **Material wiring**
|
|
44
53
|
*
|
|
45
54
|
* Every `--cngx-mat-tab-*` token except the has-errors glyph size is
|
|
46
|
-
* `@property`-registered with a literal oklch initial value,
|
|
47
|
-
* value always wins over an inline `var()` fallback - this
|
|
48
|
-
* therefore carries no `--mat-sys-*` fallbacks of its own. The
|
|
55
|
+
* `@property`-registered, the colour tokens with a literal oklch initial value,
|
|
56
|
+
* so a registered value always wins over an inline `var()` fallback - this
|
|
57
|
+
* stylesheet therefore carries no `--mat-sys-*` fallbacks of its own. The two
|
|
58
|
+
* refused tokens register without an initial value, so their amber and
|
|
59
|
+
* resting-text fallbacks apply until a theme sets them. The size exception,
|
|
49
60
|
* `--cngx-mat-tab-has-errors-glyph-size`, is deliberately left unregistered so
|
|
50
61
|
* its `rem` fallback scales with text-only zoom (see its note below). The
|
|
51
62
|
* Material alignment is delivered by the
|
|
@@ -53,6 +64,7 @@
|
|
|
53
64
|
* which sets the colour tokens on `.mat-mdc-tab-group`:
|
|
54
65
|
*
|
|
55
66
|
* - `--cngx-mat-tab-error-color` <- `--mat-sys-error`
|
|
67
|
+
* - `--cngx-mat-tab-refused-color` <- `--mat-sys-tertiary`
|
|
56
68
|
* - `--cngx-mat-tab-has-errors-color` <- `--mat-sys-error`
|
|
57
69
|
* - `--cngx-mat-tab-has-errors-glyph-color` <- `--mat-sys-on-error`
|
|
58
70
|
* - `--cngx-mat-tabs-more-bg` <- `--mat-sys-surface`
|
|
@@ -84,6 +96,48 @@
|
|
|
84
96
|
initial-value: oklch(0.45 0.15 25);
|
|
85
97
|
}
|
|
86
98
|
|
|
99
|
+
/**
|
|
100
|
+
* Outline and glyph-disc colour of a refused tab (the commit action
|
|
101
|
+
* answered `false`). A refusal is no error, so it wears the rejection
|
|
102
|
+
* amber; a failed commit keeps `--cngx-mat-tab-error-color`. Registered
|
|
103
|
+
* without an initial value, so the amber fallback applies until a theme
|
|
104
|
+
* sets it. Wired to `--mat-sys-tertiary` by the
|
|
105
|
+
* `@cngx/themes/material/tabs-theme` bridge.
|
|
106
|
+
* @group State / Refused
|
|
107
|
+
*/
|
|
108
|
+
@property --cngx-mat-tab-refused-color {
|
|
109
|
+
syntax: '*';
|
|
110
|
+
inherits: true;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Text color of a refused tab. Defaults to the resting tab text colour:
|
|
115
|
+
* amber text would fall under the 4.5:1 text contrast.
|
|
116
|
+
* @group State / Refused
|
|
117
|
+
*/
|
|
118
|
+
@property --cngx-mat-tab-refused-text-color {
|
|
119
|
+
syntax: '*';
|
|
120
|
+
inherits: true;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Gap between a rejected tab's label and its rejection glyph disc when
|
|
125
|
+
* the disc sits inline (the tab also carries the has-errors badge, which
|
|
126
|
+
* keeps the corner), derived from the spacing scale (`--cngx-space-xs`)
|
|
127
|
+
* below. The disc itself shares `--cngx-mat-tab-has-errors-glyph-size`.
|
|
128
|
+
* @group State / Error
|
|
129
|
+
*/
|
|
130
|
+
@property --cngx-mat-tab-rejection-icon-gap {
|
|
131
|
+
syntax: '*';
|
|
132
|
+
inherits: false;
|
|
133
|
+
initial-value: 0.25rem;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/* Read on the glyph itself (inherits: false), so the scale SET lands there. */
|
|
137
|
+
.cngx-mat-tab__rejection-icon {
|
|
138
|
+
--cngx-mat-tab-rejection-icon-gap: var(--cngx-space-xs, 0.25rem);
|
|
139
|
+
}
|
|
140
|
+
|
|
87
141
|
/**
|
|
88
142
|
* Outline shorthand of a rejected tab.
|
|
89
143
|
* @group State / Error
|
|
@@ -95,13 +149,15 @@
|
|
|
95
149
|
}
|
|
96
150
|
|
|
97
151
|
/**
|
|
98
|
-
* Outline offset of the rejected-tab outline.
|
|
152
|
+
* Outline offset of the rejected-tab outline. Negative by default: the
|
|
153
|
+
* Material label container clips its overflow, so an outline outside the
|
|
154
|
+
* tab box would lose its top, bottom and trailing edges.
|
|
99
155
|
* @group State / Error
|
|
100
156
|
*/
|
|
101
157
|
@property --cngx-mat-tab-error-outline-offset {
|
|
102
158
|
syntax: '<length>';
|
|
103
159
|
inherits: false;
|
|
104
|
-
initial-value:
|
|
160
|
+
initial-value: -2px;
|
|
105
161
|
}
|
|
106
162
|
|
|
107
163
|
/**
|
|
@@ -151,7 +207,7 @@
|
|
|
151
207
|
* Background of the `has-errors` glyph disc. Wired to `--mat-sys-error`
|
|
152
208
|
* by the `@cngx/themes/material/tabs-theme` bridge; standalone it keeps
|
|
153
209
|
* the literal default below. Inherits so a host-level override reaches
|
|
154
|
-
* the `::
|
|
210
|
+
* the `::after` glyph.
|
|
155
211
|
* @group State / HasErrors
|
|
156
212
|
*/
|
|
157
213
|
@property --cngx-mat-tab-has-errors-color {
|
|
@@ -252,34 +308,60 @@
|
|
|
252
308
|
|
|
253
309
|
@layer cngx.components {
|
|
254
310
|
/*
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
* `
|
|
258
|
-
*
|
|
259
|
-
* the
|
|
260
|
-
* `angular.json` global styles when the component first renders,
|
|
261
|
-
* a same-specificity rule loses the cascade.
|
|
262
|
-
*
|
|
263
|
-
* `.mat-mdc-tab-link` carries the same decoration for the native
|
|
264
|
-
* `[cngxMatTabNav]` bridge - the link element is also (0,1,0), so the
|
|
265
|
-
* doubled selector wins identically.
|
|
311
|
+
* Rejection glyph. `::before` (Material's focus indicator) and `::after`
|
|
312
|
+
* (the has-errors badge) are taken, so the decoration appends this
|
|
313
|
+
* `aria-hidden` span to the tab element itself, next to its
|
|
314
|
+
* screen-reader descriptor. Laid out inline after the label row by
|
|
315
|
+
* default; the corner rule below lifts it out when the corner is free.
|
|
266
316
|
*/
|
|
267
|
-
.
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
317
|
+
.cngx-mat-tab__rejection-icon {
|
|
318
|
+
display: inline-flex;
|
|
319
|
+
align-items: center;
|
|
320
|
+
justify-content: center;
|
|
321
|
+
flex: 0 0 auto;
|
|
322
|
+
align-self: center;
|
|
323
|
+
width: var(--cngx-mat-tab-has-errors-glyph-size, 1rem);
|
|
324
|
+
height: var(--cngx-mat-tab-has-errors-glyph-size, 1rem);
|
|
325
|
+
margin-inline-start: var(--cngx-mat-tab-rejection-icon-gap, 0.25rem);
|
|
326
|
+
border-radius: 50%;
|
|
327
|
+
background: var(--cngx-mat-tab-error-color, oklch(0.45 0.15 25));
|
|
328
|
+
color: var(--cngx-mat-tab-has-errors-glyph-color, oklch(1 0 0));
|
|
329
|
+
font-size: calc(var(--cngx-mat-tab-has-errors-glyph-size, 1rem) * 0.75);
|
|
330
|
+
font-weight: var(--cngx-mat-tab-has-errors-font-weight, 700);
|
|
331
|
+
line-height: 1;
|
|
332
|
+
pointer-events: none;
|
|
273
333
|
}
|
|
274
334
|
|
|
275
|
-
.mat-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
335
|
+
.cngx-mat-tab__rejection-icon[data-reason='refused'] {
|
|
336
|
+
background: var(--cngx-mat-tab-refused-color, oklch(0.62 0.15 60));
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/*
|
|
340
|
+
* No has-errors badge on the tab: the disc takes the badge's corner.
|
|
341
|
+
* It resolves against the tab (Material's `.mdc-tab` is
|
|
342
|
+
* `position: relative`; set here too for a bare tab link), which is why
|
|
343
|
+
* the decoration never mounts it inside `.mdc-tab__content`, itself a
|
|
344
|
+
* positioning context.
|
|
345
|
+
*/
|
|
346
|
+
.mat-mdc-tab.cngx-mat-tab--error:not(.cngx-mat-tab--has-errors),
|
|
347
|
+
.mat-mdc-tab-link.cngx-mat-tab--error:not(.cngx-mat-tab--has-errors) {
|
|
348
|
+
position: relative;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.cngx-mat-tab--error:not(.cngx-mat-tab--has-errors) > .cngx-mat-tab__rejection-icon {
|
|
352
|
+
position: absolute;
|
|
353
|
+
top: var(--cngx-mat-tab-has-errors-glyph-offset, 4px);
|
|
354
|
+
inset-inline-end: var(--cngx-mat-tab-has-errors-glyph-offset, 4px);
|
|
355
|
+
margin: 0;
|
|
356
|
+
z-index: 1;
|
|
281
357
|
}
|
|
282
358
|
|
|
359
|
+
/*
|
|
360
|
+
* A disabled-and-rejected tab takes no fade: Material paints the
|
|
361
|
+
* disabled label colour, and the error outline above keeps it apart
|
|
362
|
+
* from a healthy disabled tab. Disabled is colour, never opacity.
|
|
363
|
+
*/
|
|
364
|
+
|
|
283
365
|
/*
|
|
284
366
|
* Per-tab form-error aggregation badge. Distinct semantic from
|
|
285
367
|
* `--error` - `--error` means "your last commit was refused";
|
|
@@ -292,13 +374,15 @@
|
|
|
292
374
|
}
|
|
293
375
|
|
|
294
376
|
/*
|
|
295
|
-
*
|
|
296
|
-
*
|
|
297
|
-
*
|
|
377
|
+
* The badge lives on `::after` because Material owns `::before` on every
|
|
378
|
+
* `.mat-focus-indicator` tab: with `mat.strong-focus-indicators()` its
|
|
379
|
+
* unlayered rule (`display`, `inset`, `border`, and `content: ''` on
|
|
380
|
+
* focus) beats any rule in this layer regardless of specificity, which
|
|
381
|
+
* hid the badge entirely and stole the focus ring's pseudo-element.
|
|
298
382
|
*/
|
|
299
|
-
.mat-mdc-tab.cngx-mat-tab--has-errors::
|
|
300
|
-
.mat-mdc-tab-link.cngx-mat-tab--has-errors::
|
|
301
|
-
content: '!';
|
|
383
|
+
.mat-mdc-tab.cngx-mat-tab--has-errors::after,
|
|
384
|
+
.mat-mdc-tab-link.cngx-mat-tab--has-errors::after {
|
|
385
|
+
content: '!' / '';
|
|
302
386
|
position: absolute;
|
|
303
387
|
top: var(--cngx-mat-tab-has-errors-glyph-offset, 4px);
|
|
304
388
|
inset-inline-end: var(--cngx-mat-tab-has-errors-glyph-offset, 4px);
|
|
@@ -325,10 +409,11 @@
|
|
|
325
409
|
* Co-occurrence: when a tab is BOTH rejected and carries form
|
|
326
410
|
* errors, the rejection outline already draws focus to the edges;
|
|
327
411
|
* shift the has-errors badge slightly inward so the two signals
|
|
328
|
-
* read as distinct rather than visually merging.
|
|
412
|
+
* read as distinct rather than visually merging. The rejection disc
|
|
413
|
+
* leaves the corner to the badge and sits inline after the label.
|
|
329
414
|
*/
|
|
330
|
-
.mat-mdc-tab.cngx-mat-tab--error.cngx-mat-tab--has-errors::
|
|
331
|
-
.mat-mdc-tab-link.cngx-mat-tab--error.cngx-mat-tab--has-errors::
|
|
415
|
+
.mat-mdc-tab.cngx-mat-tab--error.cngx-mat-tab--has-errors::after,
|
|
416
|
+
.mat-mdc-tab-link.cngx-mat-tab--error.cngx-mat-tab--has-errors::after {
|
|
332
417
|
top: var(--cngx-mat-tab-has-errors-glyph-offset-stacked, 6px);
|
|
333
418
|
inset-inline-end: var(--cngx-mat-tab-has-errors-glyph-offset-stacked, 6px);
|
|
334
419
|
}
|
|
@@ -378,3 +463,64 @@
|
|
|
378
463
|
border: 0;
|
|
379
464
|
}
|
|
380
465
|
}
|
|
466
|
+
|
|
467
|
+
/*
|
|
468
|
+
* Rejected-tab paint. Unlayered on purpose: Material ships its tab styles
|
|
469
|
+
* unlayered through the component decorator (`.mdc-tab { outline: none }`,
|
|
470
|
+
* the font-weight on `.mat-mdc-tab`), and an unlayered rule beats every
|
|
471
|
+
* layered one whatever its specificity, so inside `@layer cngx.components`
|
|
472
|
+
* the outline and the weight never painted. Out here the specificity bump to
|
|
473
|
+
* `.mat-mdc-tab.cngx-mat-tab--error` (0,2,0) decides against Material's
|
|
474
|
+
* (0,1,0) rules, which are injected after the global styles.
|
|
475
|
+
*
|
|
476
|
+
* `.mat-mdc-tab-link` carries the same decoration for the native
|
|
477
|
+
* `[cngxMatTabNav]` bridge - the link element is also (0,1,0), so the
|
|
478
|
+
* doubled selector wins identically.
|
|
479
|
+
*
|
|
480
|
+
* The label text is painted by Material on `.mdc-tab__text-label` from its
|
|
481
|
+
* own `--mat-tab-*-label-text-color` tokens, up to (0,4,0) for the active
|
|
482
|
+
* hovered tab, so a colour on the tab never reached it. A failed tab sets
|
|
483
|
+
* those tokens instead; the label inherits them past every Material state
|
|
484
|
+
* selector, and the disabled colour stays Material's.
|
|
485
|
+
*/
|
|
486
|
+
.mat-mdc-tab.cngx-mat-tab--error,
|
|
487
|
+
.mat-mdc-tab-link.cngx-mat-tab--error {
|
|
488
|
+
color: var(--cngx-mat-tab-error-color, oklch(0.45 0.15 25));
|
|
489
|
+
outline: var(--cngx-mat-tab-error-outline, 2px solid currentColor);
|
|
490
|
+
outline-offset: var(--cngx-mat-tab-error-outline-offset, -2px);
|
|
491
|
+
font-weight: var(--cngx-mat-tab-error-font-weight, 600);
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
.mat-mdc-tab.cngx-mat-tab--error:not([data-reason='refused']),
|
|
495
|
+
.mat-mdc-tab-link.cngx-mat-tab--error:not([data-reason='refused']) {
|
|
496
|
+
--mat-tab-inactive-label-text-color: var(--cngx-mat-tab-error-color, oklch(0.45 0.15 25));
|
|
497
|
+
--mat-tab-inactive-focus-label-text-color: var(--cngx-mat-tab-error-color, oklch(0.45 0.15 25));
|
|
498
|
+
--mat-tab-inactive-hover-label-text-color: var(--cngx-mat-tab-error-color, oklch(0.45 0.15 25));
|
|
499
|
+
--mat-tab-active-label-text-color: var(--cngx-mat-tab-error-color, oklch(0.45 0.15 25));
|
|
500
|
+
--mat-tab-active-focus-label-text-color: var(--cngx-mat-tab-error-color, oklch(0.45 0.15 25));
|
|
501
|
+
--mat-tab-active-hover-label-text-color: var(--cngx-mat-tab-error-color, oklch(0.45 0.15 25));
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
/*
|
|
505
|
+
* A refused commit is no error: the outline and the glyph disc take the
|
|
506
|
+
* rejection amber, the text keeps its resting colour (amber text would
|
|
507
|
+
* fall under the 4.5:1 text contrast), so its label keeps Material's
|
|
508
|
+
* tokens. A failed one stays red above.
|
|
509
|
+
*/
|
|
510
|
+
.mat-mdc-tab.cngx-mat-tab--error[data-reason='refused'],
|
|
511
|
+
.mat-mdc-tab-link.cngx-mat-tab--error[data-reason='refused'] {
|
|
512
|
+
color: var(--cngx-mat-tab-refused-text-color, currentColor);
|
|
513
|
+
outline-color: var(--cngx-mat-tab-refused-color, oklch(0.62 0.15 60));
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
/* forced-colors (WHCM): the glyph disc is a background fill, which the forced
|
|
517
|
+
* palette drops. Paint it in system colours so the refused and the failed
|
|
518
|
+
* glyph both keep their disc; the outline contour survives on its own.
|
|
519
|
+
* Unlayered to beat the layered component rule. */
|
|
520
|
+
@media (forced-colors: active) {
|
|
521
|
+
.cngx-mat-tab__rejection-icon {
|
|
522
|
+
forced-color-adjust: none;
|
|
523
|
+
background: CanvasText;
|
|
524
|
+
color: Canvas;
|
|
525
|
+
}
|
|
526
|
+
}
|
package/overlay/README.md
CHANGED
|
@@ -49,15 +49,20 @@ Key features:
|
|
|
49
49
|
```typescript
|
|
50
50
|
type CngxOverlayConfig = Partial<OverlayConfig>;
|
|
51
51
|
|
|
52
|
-
// Example
|
|
53
|
-
|
|
52
|
+
// Example. Position and scroll strategies come from CDK's own Overlay
|
|
53
|
+
// service - CngxOverlay wraps attachment and lifecycle, not strategy
|
|
54
|
+
// construction:
|
|
55
|
+
private readonly overlay = inject(CngxOverlay);
|
|
56
|
+
private readonly cdkOverlay = inject(Overlay); // @angular/cdk/overlay
|
|
57
|
+
|
|
58
|
+
const ref = this.overlay.open(MyComponent, {
|
|
54
59
|
hasBackdrop: true,
|
|
55
60
|
backdropClass: 'my-backdrop',
|
|
56
61
|
panelClass: 'my-panel',
|
|
57
62
|
maxHeight: '80vh',
|
|
58
63
|
width: '600px',
|
|
59
|
-
positionStrategy:
|
|
60
|
-
scrollStrategy:
|
|
64
|
+
positionStrategy: this.cdkOverlay.position().global().centerHorizontally(),
|
|
65
|
+
scrollStrategy: this.cdkOverlay.scrollStrategies.block(),
|
|
61
66
|
});
|
|
62
67
|
```
|
|
63
68
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cngx/ui",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.9",
|
|
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.1.0-rc.
|
|
28
|
-
"@cngx/core": "0.1.0-rc.
|
|
29
|
-
"@cngx/common": "0.1.0-rc.
|
|
30
|
-
"@angular/cdk": "
|
|
31
|
-
"@angular/common": "
|
|
32
|
-
"@angular/core": "
|
|
27
|
+
"@cngx/utils": "0.1.0-rc.9",
|
|
28
|
+
"@cngx/core": "0.1.0-rc.9",
|
|
29
|
+
"@cngx/common": "0.1.0-rc.9",
|
|
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"
|
|
@@ -149,6 +152,27 @@
|
|
|
149
152
|
"default": "./fesm2022/cngx-ui-toc.mjs"
|
|
150
153
|
}
|
|
151
154
|
},
|
|
155
|
+
"schematics": "./schematics/collection.json",
|
|
156
|
+
"ng-update": {
|
|
157
|
+
"packageGroup": [
|
|
158
|
+
"@cngx/utils",
|
|
159
|
+
"@cngx/core",
|
|
160
|
+
"@cngx/common",
|
|
161
|
+
"@cngx/interop",
|
|
162
|
+
"@cngx/forms",
|
|
163
|
+
"@cngx/data-display",
|
|
164
|
+
"@cngx/ui",
|
|
165
|
+
"@cngx/themes"
|
|
166
|
+
]
|
|
167
|
+
},
|
|
168
|
+
"peerDependenciesMeta": {
|
|
169
|
+
"@angular/router": {
|
|
170
|
+
"optional": true
|
|
171
|
+
},
|
|
172
|
+
"@angular/material": {
|
|
173
|
+
"optional": true
|
|
174
|
+
}
|
|
175
|
+
},
|
|
152
176
|
"module": "fesm2022/cngx-ui.mjs",
|
|
153
177
|
"typings": "types/cngx-ui.d.ts"
|
|
154
178
|
}
|
package/paginator/README.md
CHANGED
|
@@ -99,9 +99,11 @@ gates navigation, renders an indeterminate `cngx-progress` bar, flips
|
|
|
99
99
|
|
|
100
100
|
## Configuration
|
|
101
101
|
|
|
102
|
-
All accessible-name strings, announcement phrasing, the
|
|
103
|
-
default page-size choices cascade through `CNGX_PAGINATOR_CONFIG
|
|
104
|
-
defaults
|
|
102
|
+
All accessible-name strings, announcement phrasing, the readout formats, and the
|
|
103
|
+
default page-size choices cascade through `CNGX_PAGINATOR_CONFIG`. The copy
|
|
104
|
+
defaults are the `paginator` section of the language pack (English without one),
|
|
105
|
+
with numbers formatted for the locale; translate them with the language file.
|
|
106
|
+
Override single keys at the app root with `provideCngxPaginatorConfig(...)`, or
|
|
105
107
|
per region with `provideCngxPaginatorConfigAt(...)` in `viewProviders`.
|
|
106
108
|
|
|
107
109
|
```ts
|
|
@@ -131,4 +133,6 @@ without forking the shell. It mirrors the select family's
|
|
|
131
133
|
roving tab stop on the page row (arrows / Home / End); `aria-current="page"` on
|
|
132
134
|
the active page; a single computed `aria-busy` owner; live-region page-change,
|
|
133
135
|
clamp, and async announcements. A `total`-shrink clamp is never silent - the
|
|
134
|
-
clamped page is
|
|
136
|
+
clamped page is announced, and emitted back to the consumer once the state is
|
|
137
|
+
settled and non-empty (a transient total drop during a busy refetch is held
|
|
138
|
+
back, so it never pins a controlled consumer to page 0).
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";var ce=Object.create;var y=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var fe=Object.getOwnPropertyNames;var ge=Object.getPrototypeOf,me=Object.prototype.hasOwnProperty;var ye=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),xe=(n,e)=>{for(var r in e)y(n,r,{get:e[r],enumerable:!0})},M=(n,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of fe(e))!me.call(n,o)&&o!==r&&y(n,o,{get:()=>e[o],enumerable:!(t=ue(e,o))||t.enumerable});return n};var be=(n,e,r)=>(r=n!=null?ce(ge(n)):{},M(e||!n||!n.__esModule?y(r,"default",{value:n,enumerable:!0}):r,n)),he=n=>M(y({},"__esModule",{value:!0}),n);var oe=ye((cn,B)=>{"use strict";var O=process||{},re=O.argv||[],C=O.env||{},Fe=!(C.NO_COLOR||re.includes("--no-color"))&&(!!C.FORCE_COLOR||re.includes("--color")||O.platform==="win32"||(O.stdout||{}).isTTY&&C.TERM!=="dumb"||!!C.CI),Be=(n,e,r=n)=>t=>{let o=""+t,i=o.indexOf(e,n.length);return~i?n+_e(o,e,r,i)+e:n+o+e},_e=(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=Fe)=>{let e=n?Be:()=>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 Xe={};xe(Xe,{ngAdd:()=>I});module.exports=he(Xe);var R=require("@schematics/angular/utility");var U=require("@angular-devkit/schematics"),H=require("@schematics/angular/utility");function P(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function V(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 x(...n){return e=>{let r=e.exists(g)?e.readText(g):void 0;return(0,U.chain)([(0,H.addDependency)(...n),t=>{if(r===void 0||!t.exists(g))return;let o=t.readText(g),i=G(r),s=r.endsWith(`
|
|
5
|
+
`)&&!o.endsWith(`
|
|
6
|
+
`)?`${o}
|
|
7
|
+
`:o,d=i===`
|
|
8
|
+
`?s:s.replace(/\r?\n/g,i);d!==o&&t.overwrite(g,d)}])}}var w=require("node:fs"),Y=require("node:path"),v=require("@angular-devkit/schematics");function N(n){return P(n)?Object.fromEntries(Object.entries(n).filter(e=>typeof e[1]=="string")):{}}function Re(n){try{return JSON.parse(n)}catch(e){let r=e instanceof Error?e.message:String(e);throw new v.SchematicsException(`package.json is not valid JSON: ${r.replace(/\.$/,"")}.`)}}function f(n){let e=Re(n);if(!P(e))throw new v.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:N(e.dependencies),devDependencies:N(e.devDependencies),peerDependencies:N(e.peerDependencies)}}function q(n){let{version:e}=f((0,w.readFileSync)(b(n),"utf8"));if(e===void 0)throw new Error(`No version in ${b(n)}.`);return e}function W(n){let{name:e}=f((0,w.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 Se=/^[\s^~<>=v]*(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:-([0-9A-Za-z.-]+))?/;function J(n){let e=Se.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 Ee(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=J(n),t=J(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 d=r.prerelease[s],p=t.prerelease[s];if(d===void 0||p===void 0)return d===void 0?-1:1;let u=Ee(d,p);if(u!==0)return u}return 0}function h(n,e){let r=n.read(`node_modules/${e}/package.json`);if(r!==null)try{return f(r.toString("utf8")).version}catch{return}}var Te="package.json",Ce=/^[\s\d.^~<>=|xX*v-]+$/;function Oe(n,e){if(n!==void 0&&Ce.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 Q(n,e){return(r,t)=>{let o=e??t.logger,i=f(r.readText(Te));if(m(i,n)!==void 0)return;let s=Oe(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:R.InstallBehavior.None,existing:R.ExistingBehavior.Skip})}}var S=require("@schematics/angular/utility"),Z=require("@schematics/angular/utility/json-file");var K="package.json";function L(n,e,r=!1){return(t,o)=>{let i=m(f(t.readText(K)),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,K);s.remove(["dependencies",n]),s.remove(["devDependencies",n])}return x(n,e,{install:S.InstallBehavior.None,existing:S.ExistingBehavior.Replace})}}var Ae=["minimal","recommended","full"],E=["utils","core","common","interop","forms","data-display","ui"],Pe=["cngx","material","none"],Ne=["en","de"],we=["claude","cursor","vscode"];function T(n,e){return n.some(r=>r===e)}function ve(n,e){return Array.isArray(e)&&e.every(r=>T(n,r))}function Le(n){return typeof n=="boolean"}function k(n){return`--${n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}`}function $e(n,e){let r=e.length===1?"is":"are";return new Error(`"${e.join('", "')}" ${r} given more than once for ${k(n)}.`)}function ke(n,e){let r=k(n);return new Error(`${r} has an empty entry. Separate the values with single commas, for example ${r} ${e.slice(0,2).join(",")}.`)}function F(n,e,r){return new Error(`"${e.join('", "')}" is not a valid answer for ${k(n)}. Expected one of: ${r.join(", ")}.`)}var z=["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 ke(n,e);if(!ve(e,t))throw F(n,t.filter(i=>!T(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(!T(e,r))throw F(n,[r],e);return r}}function c(n,e){if(e===void 0||Le(e))return e;if(!T(z,e))throw F(n,[e],z);return e==="true"}function ne(n){return{project:n.project,preset:$("preset",Ae,n.preset),libs:ee("libs",E,n.libs),theme:$("theme",Pe,n.theme),i18n:$("i18n",Ne,n.i18n),runtimeSwitch:c("runtimeSwitch",n.runtimeSwitch),lint:c("lint",n.lint),a11yPreferences:c("a11yPreferences",n.a11yPreferences),feedback:c("feedback",n.feedback),floatingFallback:c("floatingFallback",n.floatingFallback),starter:c("starter",n.starter),aiTools:ee("aiTools",we,n.aiTools),yes:c("yes",n.yes),prompts:c("prompts",n.prompts),quiet:c("quiet",n.quiet)}}var l=require("@angular-devkit/schematics"),A=require("@angular-devkit/schematics/tasks");var ie=be(oe());function Ie(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=Ie(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 je(n){return ae(n.CI)===!0}function De(n,e){return ae(n.NG_FORCE_TTY)??(e.isTTY===!0&&!je(n))}function de(n,e,r,t){let o=De(n,e);return{isTTY:o,color:se(n,o),quiet:t,logger:r,terminal:o?Me(e):void 0}}function Me(n){if(n.write===void 0)return;let e=r=>{n.write?.(`${r}
|
|
9
|
+
`)};return{info:e,warn:e,error:e}}var Ve=["0.0.0","PLACEHOLDER"].join("-");function le(n){return n===Ve}var a="@cngx/core",Ge="@angular/cdk";function Ue(n){return n!=="@cngx/utils"}function He(n){return n instanceof Error&&n.constructor.name==="CollectionCannotBeResolvedException"}function _(n){try{n.engine.createCollection(a)}catch(e){let r=He(e)?"it cannot be resolved":V(e);throw new l.SchematicsException(`${a} is installed but its ng-add collection failed to load: ${r}`)}}function Je(n){return E.find(e=>`@cngx/${e}`===n)}function Ye(n,e){let r=Je(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 qe(n){let e=de(process.env,process.stdout,n.logger,!1);return e.terminal??e.logger}function We(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 I(n,e=__dirname){return(r,t)=>{let o=q(e),i=W(e),s=Ye(n,i),d=qe(t),p=h(r,a),u=p===void 0?void 0:X(p,o);if(le(o)){if(p===void 0)throw new l.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 d.info(`${i} is an unstamped local build (${o}); pinning nothing and following the installed ${a} ${p}.`),_(t),(0,l.externalSchematic)(a,"ng-add",s)}if(u!==void 0&&u>0)return d.info(`${a} ${p} is installed, newer than ${i} ${o}; following the installed core.`),_(t),(0,l.externalSchematic)(a,"ng-add",s);let j=(0,l.chain)([L(a,o,!0),L(i,o,!0)]);return u===0?(_(t),(0,l.chain)([j,(0,l.externalSchematic)(a,"ng-add",s)])):(d.info(We(p,u,i,o)),(0,l.chain)([j,...Ue(i)?[Q(Ge,d)]:[],(Qe,D)=>{let pe=D.addTask(new A.NodePackageInstallTask);D.addTask(new A.RunSchematicTask(a,"ng-add",{...s}),[pe])}]))}}0&&(module.exports={ngAdd});
|