@cngx/common 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/a11y/README.md +15 -2
- package/button/README.md +258 -0
- package/command/README.md +42 -2
- package/data/README.md +15 -12
- package/fesm2022/cngx-common-a11y.mjs +1076 -319
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-audio.mjs +99 -77
- package/fesm2022/cngx-common-audio.mjs.map +1 -1
- package/fesm2022/cngx-common-button.mjs +1084 -0
- package/fesm2022/cngx-common-button.mjs.map +1 -0
- package/fesm2022/cngx-common-card.mjs +138 -78
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +799 -327
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-command.mjs +101 -25
- package/fesm2022/cngx-common-command.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +861 -423
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-dialog.mjs +198 -160
- package/fesm2022/cngx-common-dialog.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +693 -329
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +7303 -2774
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +2174 -442
- package/fesm2022/cngx-common-layout.mjs.map +1 -1
- package/fesm2022/cngx-common-menu-button.mjs +557 -0
- package/fesm2022/cngx-common-menu-button.mjs.map +1 -0
- package/fesm2022/cngx-common-popover.mjs +2109 -557
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +548 -419
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +442 -331
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common-timeline.mjs +44 -71
- package/fesm2022/cngx-common-timeline.mjs.map +1 -1
- package/fesm2022/cngx-common.mjs +10 -10
- package/fesm2022/cngx-common.mjs.map +1 -1
- package/interactive/README.md +30 -19
- package/layout/README.md +17 -1
- package/menu-button/README.md +234 -0
- package/package.json +31 -8
- package/popover/README.md +81 -4
- package/popover/tooltip-indicator.scss +52 -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/stepper/README.md +5 -5
- package/theming/components/cngx-accordion.css +36 -7
- package/theming/components/cngx-async.css +185 -37
- package/theming/components/cngx-backdrop.css +3 -1
- package/theming/components/cngx-badge.css +20 -5
- package/theming/components/cngx-bottom-sheet.css +2 -0
- package/theming/components/cngx-breadcrumb.css +3 -1
- package/theming/components/cngx-button-group.css +325 -0
- package/theming/components/cngx-button-toggle.css +55 -23
- package/theming/components/cngx-button.css +975 -0
- package/theming/components/cngx-data-grid.css +2 -0
- package/theming/components/cngx-dialog.css +3 -1
- package/theming/components/cngx-divider.css +24 -9
- package/theming/components/cngx-drawer.css +153 -0
- package/theming/components/cngx-icon-glyph.css +76 -0
- package/theming/components/cngx-listbox.css +79 -25
- package/theming/components/cngx-menu.css +112 -52
- package/theming/components/cngx-nav.css +1220 -0
- package/theming/components/cngx-popover-sheet.css +434 -0
- package/theming/components/cngx-popover.css +37 -9
- package/theming/components/cngx-recycler-placeholder.css +2 -0
- package/theming/components/cngx-ripple.css +74 -16
- package/theming/components/cngx-sidebar.css +71 -0
- package/theming/components/cngx-slider.css +3 -1
- package/theming/components/cngx-tooltip.css +2 -0
- package/timeline/README.md +2 -2
- package/types/cngx-common-a11y.d.ts +488 -112
- package/types/cngx-common-audio.d.ts +60 -88
- package/types/cngx-common-button.d.ts +698 -0
- package/types/cngx-common-card.d.ts +104 -78
- package/types/cngx-common-chart.d.ts +677 -389
- package/types/cngx-common-command.d.ts +55 -41
- package/types/cngx-common-data.d.ts +506 -360
- package/types/cngx-common-dialog.d.ts +94 -127
- package/types/cngx-common-display.d.ts +475 -300
- package/types/cngx-common-interactive.d.ts +4383 -1721
- package/types/cngx-common-layout.d.ts +1399 -288
- package/types/cngx-common-menu-button.d.ts +382 -0
- package/types/cngx-common-popover.d.ts +990 -268
- package/types/cngx-common-stepper.d.ts +374 -465
- package/types/cngx-common-tabs.d.ts +309 -403
- package/types/cngx-common-timeline.d.ts +50 -109
|
@@ -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
|
+
}
|
package/stepper/README.md
CHANGED
|
@@ -30,7 +30,7 @@ The presenter is a pure-derivation host directive - every visible piece of state
|
|
|
30
30
|
| `CNGX_STEP_PANEL_HOST` | Rendering-surface contract for organisms. Provides `flatSteps` / `activeStepIndex` / `activeStepId` Signals plus `labelTemplateFor(id)` / `contentTemplateFor(id)` template lookups. |
|
|
31
31
|
| `CNGX_STEPPER_CONFIG` | App-wide stepper configuration token (defaults, ARIA labels, fallback labels, router-sync mode). |
|
|
32
32
|
| `CNGX_STEPPER_I18N` | I18n bundle token, a `Signal` (default English; consumers override via `provideStepperI18n`). |
|
|
33
|
-
| `CNGX_STEPPER_COMMIT_HANDLER_FACTORY` | Pluggable async-commit handler factory. Default: `createStepperCommitHandler`. Override for telemetry / retry / offline-queue without forking. |
|
|
33
|
+
| `CNGX_STEPPER_COMMIT_HANDLER_FACTORY` | Pluggable async-commit handler factory. Default: `createStepperCommitHandler`. Override for telemetry / retry / offline-queue without forking. A handler calls `onResolve('accepted' \| 'refused' \| 'failed')`: `true` accepts, `false` refuses, a throw / rejection / error fails. |
|
|
34
34
|
|
|
35
35
|
### Configuration cascade
|
|
36
36
|
|
|
@@ -45,7 +45,6 @@ Resolution priority: per-instance Input → `viewProviders` → root provider
|
|
|
45
45
|
| `withStepperLinear(boolean)` | Default linear-mode flag. |
|
|
46
46
|
| `withStepperCommitMode('optimistic' \| 'pessimistic')` | Default commit mode. |
|
|
47
47
|
| `withStepperRouterSync(mode, paramName?)` | Default router-sync `mode` + `paramName`. |
|
|
48
|
-
| `withStepperAriaLabels({ stepperRegion?, ... })` | App-wide ARIA-label overrides (consumer locale). |
|
|
49
48
|
| `withStepperFallbackLabels({ groupRoleDescription?, stepRoleDescription?, ... })` | App-wide role-description overrides. |
|
|
50
49
|
|
|
51
50
|
### I18n
|
|
@@ -62,7 +61,8 @@ To translate the whole app, set a language pack with `provideCngxI18n(withPack(.
|
|
|
62
61
|
|
|
63
62
|
| Export | Description |
|
|
64
63
|
|-|-|
|
|
65
|
-
| `createStepperCommitHandler({ controller })` | Factory for the async-commit state-machine adapter. Default `CNGX_STEPPER_COMMIT_HANDLER_FACTORY`. |
|
|
64
|
+
| `createStepperCommitHandler({ controller })` | Factory for the async-commit state-machine adapter. Default `CNGX_STEPPER_COMMIT_HANDLER_FACTORY`. Routes a `false` answer to the controller's refusal path, so the commit state goes `'idle'` and keeps its data. |
|
|
65
|
+
| `CngxStepperCommitResolution` | `'accepted' \| 'refused' \| 'failed'`, the outcome a commit handler reports. |
|
|
66
66
|
|
|
67
67
|
## Usage
|
|
68
68
|
|
|
@@ -98,7 +98,7 @@ class WizardCmp {
|
|
|
98
98
|
| `withStepperMobileCollapse(mode)` | Choose the auto-collapse target for a narrow **container** (below `30rem` of the stepper's own width, not the viewport): `'text'` (default, renders `<cngx-text-stepper>`) / `'dots'` (renders `<cngx-dot-stepper>`) / `'off'` (keep the classic strip at every width). The threshold itself is a `@container` rule in `stepper-base.css`, overridable in consumer CSS - see the `@cngx/ui/stepper` README. The Material twin ignores this setting. |
|
|
99
99
|
| `withStepperHeaderNavigation(mode)` | Set the header-navigation policy: `'none'` (inert label headers, footer-only navigation) / `'visited'` (default - focusable header buttons gated by `linear`). Per-instance `[headerNavigation]` wins. |
|
|
100
100
|
| `withStepErrorTemplate(tpl)` | App-wide default for the `*cngxStepError` slot - the per-step validation message rendered in a row below the strip. Per-instance `*cngxStepError` directive wins. |
|
|
101
|
-
| `withStepperI18nLabels({ statusLabels })` | Override the per-state pill labels
|
|
101
|
+
| `withStepperI18nLabels({ statusLabels })` | Override the per-state status words: `{ done, inProgress, upNext, errored, refused }`. The first four are the pill labels of the `stripe-status-rich` skin; `refused` names a refused step in its accessible name and in the minimal skins' error line. Partial overrides keep unset keys at the English default. |
|
|
102
102
|
| `withStepperI18nLabels({ textStepperFormat })` | Override the short format used by `CngxProgressBarStepper`'s caption and by `CngxTextStepper`. Signature: `(current: number, total: number) => string`; default `(c, t) => 'Step ' + c + ' of ' + t`. |
|
|
103
103
|
|
|
104
104
|
```ts
|
|
@@ -147,6 +147,6 @@ bootstrapApplication(AppComponent, {
|
|
|
147
147
|
A step carries an error through two independent channels:
|
|
148
148
|
|
|
149
149
|
- **Validation** - a direct `[error]` input on `cngxStep` (`true` or a message string), or an `[errorAggregator]` for genuine multi-source forms. Both fold into the step's `state` (`'error'`) with no async machine. The state shows on every skin via the indicator / badge; the reason text surfaces in a row below the strip via the `*cngxStepError` slot (or the aggregate line on the text / dot / progress variants), but only for a real message - a bare `[error]="true"` shows state only. `[error]="'message'"` wins over the first aggregator label, which wins over the i18n `errored` word.
|
|
150
|
-
- **Commit / async** - a `commitAction` that rejects
|
|
150
|
+
- **Commit / async** - a `commitAction` that answers `false` refuses the step change, one that throws, rejects or errors fails it. Both roll the step back, set `lastFailedIndex` and decorate the step via `*cngxStepRejection` (its context carries `reason: 'refused' | 'failed'`); `lastOutcome()` tells them apart. A failure leaves `commitState` at `'error'` and reaches the `CngxToastOn` / `CngxBannerOn` bridges. A refusal is not a failure: `commitState` goes `'idle'` and keeps its data, the bridges stay silent, and the stepper speaks `commitRefused` once. An app that wants a toast for a refusal shows it from its own `commitAction` (for example `severity: 'warning'`) before it returns `false`. The stepper keeps only the outcome of the most recent commit, not a history: `lastOutcome()` and the rejection marker describe the latest attempt, and the next attempt replaces them. When that attempt lands or refuses, the commit state leaves `'error'`, so the earlier error and its `CngxBannerOn` banner clear as well; when it fails, the new failure takes their place. `reset()` clears the outcome, `clearLastFailed()` clears only the marker. A state that must stay on a step until it is fixed is a validation error (`[error]` or an `[errorAggregator]`), which every step holds independently.
|
|
151
151
|
|
|
152
152
|
The two never collide: validation owns `*cngxStepError`, commit owns `*cngxStepRejection`. The `[error]` input replaces the old `<fieldset cngxErrorAggregator><input cngxErrorSource>` boilerplate for the common "this step is invalid" case; the aggregator stays the power path. See `@cngx/ui/stepper` for the per-skin text-surface table.
|
|
@@ -7,6 +7,11 @@
|
|
|
7
7
|
* the panel opens, and the region its padding. Without it the accordion renders
|
|
8
8
|
* as bare stacked buttons.
|
|
9
9
|
*
|
|
10
|
+
* Opt-in: the classes `.cngx-accordion`, `.cngx-accordion__header` and
|
|
11
|
+
* `.cngx-accordion__region` switch the skin on, not the directive attributes,
|
|
12
|
+
* so organisms that compose the directives (`CngxAccordionItem`, the data-grid
|
|
13
|
+
* accordion rows) keep their own look.
|
|
14
|
+
*
|
|
10
15
|
* Markup the default skin expects (header buttons are direct children of the
|
|
11
16
|
* `cngxAccordion` element so the roving host can find them):
|
|
12
17
|
*
|
|
@@ -25,12 +30,14 @@
|
|
|
25
30
|
* - hover tint -> `--cngx-color-primary` (low alpha)
|
|
26
31
|
* - dividers -> `--cngx-color-border`
|
|
27
32
|
* - focus ring -> `--cngx-color-primary` (contrast >= 3:1)
|
|
33
|
+
*
|
|
34
|
+
* @themes CngxAccordion, CngxAccordionPanel
|
|
28
35
|
*/
|
|
29
36
|
|
|
30
37
|
@layer cngx.tokens {
|
|
31
38
|
/**
|
|
32
39
|
* Header button padding. The pixel `initial-value` is only the un-set
|
|
33
|
-
* fallback; the standalone `
|
|
40
|
+
* fallback; the standalone `.cngx-accordion` host SETs this from
|
|
34
41
|
* `--cngx-space-*` (below) so a global `[data-density]` re-scales a bare
|
|
35
42
|
* `@cngx/common` accordion, and the `@cngx/ui/accordion` organism SETs the
|
|
36
43
|
* same tokens at its group default. Never put `var()` in the `initial-value`
|
|
@@ -86,7 +93,7 @@
|
|
|
86
93
|
}
|
|
87
94
|
|
|
88
95
|
@layer cngx.components {
|
|
89
|
-
|
|
96
|
+
.cngx-accordion {
|
|
90
97
|
/* Derive header + region padding from the scale so a bare @cngx/common
|
|
91
98
|
accordion densifies at its own default host - standalone use must not
|
|
92
99
|
depend on the @cngx/ui/accordion organism (which SETs the same tokens at
|
|
@@ -100,10 +107,12 @@
|
|
|
100
107
|
display: block;
|
|
101
108
|
border: 1px solid var(--cngx-accordion-border-color, oklch(0.88 0.005 250));
|
|
102
109
|
border-radius: var(--cngx-radius-md, 0.375rem);
|
|
110
|
+
/* Radius inside the 1px border, for the headers that touch a rounded edge. */
|
|
111
|
+
--_cngx-accordion-inner-radius: calc(var(--cngx-radius-md, 0.375rem) - 1px);
|
|
103
112
|
overflow: hidden;
|
|
104
113
|
}
|
|
105
114
|
|
|
106
|
-
|
|
115
|
+
.cngx-accordion__header {
|
|
107
116
|
display: flex;
|
|
108
117
|
align-items: center;
|
|
109
118
|
justify-content: space-between;
|
|
@@ -122,7 +131,22 @@
|
|
|
122
131
|
cursor: pointer;
|
|
123
132
|
}
|
|
124
133
|
|
|
125
|
-
|
|
134
|
+
/* A header on a rounded edge takes the inner radius, so its focus outline
|
|
135
|
+
follows the curve instead of being clipped by the host's overflow. The last
|
|
136
|
+
header only sits on the edge while its region is closed; there the host
|
|
137
|
+
border is its bottom line, so it drops its own. */
|
|
138
|
+
.cngx-accordion__header:first-of-type {
|
|
139
|
+
border-start-start-radius: var(--_cngx-accordion-inner-radius, 0);
|
|
140
|
+
border-start-end-radius: var(--_cngx-accordion-inner-radius, 0);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.cngx-accordion__header:last-of-type:not([aria-expanded='true']) {
|
|
144
|
+
border-end-start-radius: var(--_cngx-accordion-inner-radius, 0);
|
|
145
|
+
border-end-end-radius: var(--_cngx-accordion-inner-radius, 0);
|
|
146
|
+
border-block-end: 0;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.cngx-accordion__header:hover {
|
|
126
150
|
background: color-mix(
|
|
127
151
|
in oklch,
|
|
128
152
|
var(--cngx-color-primary, oklch(0.66 0.19 50)) 6%,
|
|
@@ -130,7 +154,7 @@
|
|
|
130
154
|
);
|
|
131
155
|
}
|
|
132
156
|
|
|
133
|
-
|
|
157
|
+
.cngx-accordion__header:focus-visible {
|
|
134
158
|
outline: 2px solid var(--cngx-color-primary, oklch(0.66 0.19 50));
|
|
135
159
|
outline-offset: -2px;
|
|
136
160
|
}
|
|
@@ -138,7 +162,7 @@
|
|
|
138
162
|
/* Twisty: a CSS-drawn chevron after the label that rotates when the panel
|
|
139
163
|
* opens. A skin projecting its own icon hides it via
|
|
140
164
|
* `--cngx-accordion-twisty-display: none` on the header. */
|
|
141
|
-
|
|
165
|
+
.cngx-accordion__header::after {
|
|
142
166
|
content: '';
|
|
143
167
|
display: var(--cngx-accordion-twisty-display, block);
|
|
144
168
|
flex: 0 0 auto;
|
|
@@ -150,7 +174,7 @@
|
|
|
150
174
|
transition: rotate var(--cngx-duration-fast, 150ms) ease;
|
|
151
175
|
}
|
|
152
176
|
|
|
153
|
-
[
|
|
177
|
+
.cngx-accordion__header[aria-expanded='true']::after {
|
|
154
178
|
rotate: 225deg;
|
|
155
179
|
}
|
|
156
180
|
|
|
@@ -158,4 +182,9 @@
|
|
|
158
182
|
padding: var(--cngx-accordion-region-padding, 0.75rem 1rem);
|
|
159
183
|
border-block-end: 1px solid var(--cngx-accordion-border-color, oklch(0.88 0.005 250));
|
|
160
184
|
}
|
|
185
|
+
|
|
186
|
+
/* The open last region sits on the host's bottom border. */
|
|
187
|
+
.cngx-accordion__region:last-child {
|
|
188
|
+
border-block-end: 0;
|
|
189
|
+
}
|
|
161
190
|
}
|
|
@@ -4,71 +4,219 @@
|
|
|
4
4
|
* (`@cngx/common/interactive`). The directive toggles
|
|
5
5
|
* `cngx-async--pending`, `cngx-async--success`, `cngx-async--error`
|
|
6
6
|
* on its host as the async action progresses; this stylesheet
|
|
7
|
-
* paints the three phases
|
|
7
|
+
* paints the three phases on hosts without their own paint, such as a bare
|
|
8
|
+
* `<button cngxAsyncClick>` or an anchor.
|
|
9
|
+
*
|
|
10
|
+
* Every host also carries the stable `cngx-async` class, whatever its
|
|
11
|
+
* phase: `[cngxAsyncClick]` is a property binding and leaves no attribute to
|
|
12
|
+
* select on. The colour tokens inherit, so a theme sets them on an ancestor;
|
|
13
|
+
* the Material bridge sets them on its theme host, not per host.
|
|
14
|
+
* `--cngx-async-pending-opacity` belongs to
|
|
15
|
+
* the host: a theme rule on `.cngx-async` would outrank a host that turns the
|
|
16
|
+
* dim off on itself.
|
|
17
|
+
*
|
|
18
|
+
* **Scope**
|
|
19
|
+
*
|
|
20
|
+
* The state rules sit at zero specificity (`:where()`), so a host with its own
|
|
21
|
+
* paint wins by specificity and keeps it through every phase. Such a host
|
|
22
|
+
* sets `--cngx-async-pending-opacity: 1` on itself and reverts the
|
|
23
|
+
* forced-colors outline in its own unlayered rule; the button family does,
|
|
24
|
+
* and shows its own busy treatment and settle result instead.
|
|
8
25
|
*
|
|
9
26
|
* **State modifiers**
|
|
10
27
|
*
|
|
11
|
-
* - `--pending` - dimmed opacity + `cursor: wait
|
|
12
|
-
*
|
|
13
|
-
*
|
|
28
|
+
* - `--pending` - dimmed opacity + `cursor: wait`. Follows the directive's
|
|
29
|
+
* `busyVisible` gate (`CNGX_LOADING_CONFIG` show delay and min-dwell,
|
|
30
|
+
* `[showDelay]` / `[minDwell]` per instance), so a fast run never gets
|
|
31
|
+
* it; `aria-busy` is immediate. `--success` / `--error` wait until the
|
|
32
|
+
* gate releases, so a host never wears two modifiers
|
|
33
|
+
* - `--success` - success-tinted surface, border, text; under forced colors
|
|
34
|
+
* a 2px solid outline
|
|
35
|
+
* - `--error` - danger-tinted surface, border, text; under forced colors a
|
|
36
|
+
* 2px dashed outline
|
|
14
37
|
*
|
|
15
38
|
* **Inheritance**
|
|
16
39
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
40
|
+
* The colour tokens are registered without an initial value, so until a
|
|
41
|
+
* theme sets them each one falls through to the semantic palette and
|
|
42
|
+
* follows the colour scheme:
|
|
20
43
|
*
|
|
21
|
-
* - `--cngx-
|
|
22
|
-
* - `--cngx-
|
|
23
|
-
*
|
|
24
|
-
* - `--cngx-
|
|
44
|
+
* - `--cngx-async-success-bg` -> 12% `--cngx-color-success`
|
|
45
|
+
* - `--cngx-async-success-color` -> `--cngx-color-success` mixed toward
|
|
46
|
+
* `--cngx-color-text`
|
|
47
|
+
* - `--cngx-async-success-border` -> `--cngx-color-success`
|
|
48
|
+
* - `--cngx-async-error-bg` -> 12% `--cngx-color-danger`
|
|
49
|
+
* - `--cngx-async-error-color` -> `--cngx-color-danger-text`
|
|
50
|
+
* - `--cngx-async-error-border` -> `--cngx-color-danger`
|
|
25
51
|
*
|
|
26
52
|
* **Notes**
|
|
27
53
|
*
|
|
28
54
|
* - Lives under `theming/components` because `styleUrl` is
|
|
29
55
|
* `@Component`-only; the directive's state classes must remain
|
|
30
56
|
* globally available.
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* Tracked as a separate fix.
|
|
57
|
+
*
|
|
58
|
+
* @themes CngxAsyncClick
|
|
34
59
|
*/
|
|
35
60
|
|
|
61
|
+
@layer cngx.tokens {
|
|
62
|
+
/**
|
|
63
|
+
* Transition shorthand for the background-color / color / border-color /
|
|
64
|
+
* opacity changes between async states.
|
|
65
|
+
*
|
|
66
|
+
* Derives from the `--cngx-duration-base` rung of the motion scale; a
|
|
67
|
+
* `--cngx-duration-*` brand override re-times it library-wide.
|
|
68
|
+
* @group Motion
|
|
69
|
+
* @relatedTo provideMotion, CngxMotionScope, injectMotion
|
|
70
|
+
*/
|
|
71
|
+
@property --cngx-async-transition {
|
|
72
|
+
syntax: '*';
|
|
73
|
+
inherits: true;
|
|
74
|
+
initial-value: 0.2s ease;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* Derive the duration segment from the motion scale; easing stays literal.
|
|
78
|
+
* SET on the state hosts, which read the transition. Layer cngx.tokens keeps
|
|
79
|
+
* a Material bridge winning for the Material path. 0.2s -> base. */
|
|
80
|
+
:where(.cngx-async--pending, .cngx-async--success, .cngx-async--error) {
|
|
81
|
+
--cngx-async-transition: var(--cngx-duration-base) ease;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Opacity applied while `cngxAsyncClick` reports `pending`. Combined
|
|
86
|
+
* with `cursor: wait` on the same state. A host with its own busy
|
|
87
|
+
* treatment sets it to `1`.
|
|
88
|
+
* @group State / Pending
|
|
89
|
+
*/
|
|
90
|
+
@property --cngx-async-pending-opacity {
|
|
91
|
+
syntax: '<number>';
|
|
92
|
+
inherits: true;
|
|
93
|
+
initial-value: 0.7;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Background tint after a successful async commit. Unset by default:
|
|
98
|
+
* 12% `--cngx-color-success`.
|
|
99
|
+
* @group State / Success
|
|
100
|
+
*/
|
|
101
|
+
@property --cngx-async-success-bg {
|
|
102
|
+
syntax: '*';
|
|
103
|
+
inherits: true;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Text color after a successful async commit. Unset by default:
|
|
108
|
+
* `--cngx-color-success` mixed 75% toward `--cngx-color-text`, so it
|
|
109
|
+
* reads as text in both schemes.
|
|
110
|
+
* @group State / Success
|
|
111
|
+
*/
|
|
112
|
+
@property --cngx-async-success-color {
|
|
113
|
+
syntax: '*';
|
|
114
|
+
inherits: true;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Border color after a successful async commit. Unset by default:
|
|
119
|
+
* `--cngx-color-success`.
|
|
120
|
+
* @group State / Success
|
|
121
|
+
*/
|
|
122
|
+
@property --cngx-async-success-border {
|
|
123
|
+
syntax: '*';
|
|
124
|
+
inherits: true;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Background tint after a failed async commit. Unset by default:
|
|
129
|
+
* 12% `--cngx-color-danger`.
|
|
130
|
+
* @group State / Error
|
|
131
|
+
*/
|
|
132
|
+
@property --cngx-async-error-bg {
|
|
133
|
+
syntax: '*';
|
|
134
|
+
inherits: true;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Text color after a failed async commit. Unset by default:
|
|
139
|
+
* `--cngx-color-danger-text`.
|
|
140
|
+
* @group State / Error
|
|
141
|
+
*/
|
|
142
|
+
@property --cngx-async-error-color {
|
|
143
|
+
syntax: '*';
|
|
144
|
+
inherits: true;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Border color after a failed async commit. Unset by default:
|
|
149
|
+
* `--cngx-color-danger`.
|
|
150
|
+
* @group State / Error
|
|
151
|
+
*/
|
|
152
|
+
@property --cngx-async-error-border {
|
|
153
|
+
syntax: '*';
|
|
154
|
+
inherits: true;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
36
158
|
@layer cngx.components {
|
|
37
|
-
.cngx-async--pending {
|
|
38
|
-
opacity: var(--cngx-
|
|
159
|
+
:where(.cngx-async--pending) {
|
|
160
|
+
opacity: var(--cngx-async-pending-opacity, 0.7);
|
|
39
161
|
cursor: wait;
|
|
40
|
-
transition: opacity var(--cngx-
|
|
162
|
+
transition: opacity var(--cngx-async-transition, 0.2s ease);
|
|
41
163
|
}
|
|
42
164
|
|
|
43
|
-
.cngx-async--
|
|
165
|
+
:where(.cngx-async--success) {
|
|
44
166
|
background-color: var(
|
|
45
|
-
--cngx-
|
|
46
|
-
var(--cngx-color-success, oklch(0.
|
|
167
|
+
--cngx-async-success-bg,
|
|
168
|
+
color-mix(in oklab, var(--cngx-color-success, oklch(0.6 0.15 145)) 12%, transparent)
|
|
47
169
|
);
|
|
48
|
-
color: var(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
170
|
+
color: var(
|
|
171
|
+
--cngx-async-success-color,
|
|
172
|
+
color-mix(
|
|
173
|
+
in oklab,
|
|
174
|
+
var(--cngx-color-success, oklch(0.6 0.15 145)) 75%,
|
|
175
|
+
var(--cngx-color-text, oklch(0.2 0.01 250))
|
|
176
|
+
)
|
|
52
177
|
);
|
|
178
|
+
border-color: var(--cngx-async-success-border, var(--cngx-color-success, oklch(0.6 0.15 145)));
|
|
53
179
|
transition:
|
|
54
|
-
background-color var(--cngx-
|
|
55
|
-
color var(--cngx-
|
|
56
|
-
border-color var(--cngx-
|
|
180
|
+
background-color var(--cngx-async-transition, 0.2s ease),
|
|
181
|
+
color var(--cngx-async-transition, 0.2s ease),
|
|
182
|
+
border-color var(--cngx-async-transition, 0.2s ease),
|
|
183
|
+
opacity var(--cngx-async-transition, 0.2s ease);
|
|
57
184
|
}
|
|
58
185
|
|
|
59
|
-
.cngx-async--
|
|
186
|
+
:where(.cngx-async--error) {
|
|
60
187
|
background-color: var(
|
|
61
|
-
--cngx-
|
|
62
|
-
var(--cngx-color-danger, oklch(0.
|
|
188
|
+
--cngx-async-error-bg,
|
|
189
|
+
color-mix(in oklab, var(--cngx-color-danger, oklch(0.6 0.18 25)) 12%, transparent)
|
|
63
190
|
);
|
|
64
|
-
color: var(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
191
|
+
color: var(
|
|
192
|
+
--cngx-async-error-color,
|
|
193
|
+
var(
|
|
194
|
+
--cngx-color-danger-text,
|
|
195
|
+
oklch(from var(--cngx-color-danger, oklch(0.6 0.18 25)) 0.46 c h)
|
|
196
|
+
)
|
|
68
197
|
);
|
|
198
|
+
border-color: var(--cngx-async-error-border, var(--cngx-color-danger, oklch(0.6 0.18 25)));
|
|
69
199
|
transition:
|
|
70
|
-
background-color var(--cngx-
|
|
71
|
-
color var(--cngx-
|
|
72
|
-
border-color var(--cngx-
|
|
200
|
+
background-color var(--cngx-async-transition, 0.2s ease),
|
|
201
|
+
color var(--cngx-async-transition, 0.2s ease),
|
|
202
|
+
border-color var(--cngx-async-transition, 0.2s ease),
|
|
203
|
+
opacity var(--cngx-async-transition, 0.2s ease);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/* Forced colors drop the tints, so success and error differ by an outline's
|
|
208
|
+
* style; its colour is left to the UA's system colour. An outline takes no
|
|
209
|
+
* layout space, so the host keeps its box size when the cue appears.
|
|
210
|
+
* Unlayered, so a consumer outline reset does not hide the cue on a bare host;
|
|
211
|
+
* a host with its own cue reverts it in a more specific unlayered rule. A
|
|
212
|
+
* focused host keeps its focus ring. */
|
|
213
|
+
@media (forced-colors: active) {
|
|
214
|
+
:where(.cngx-async--success):not(:focus-visible) {
|
|
215
|
+
outline: 2px solid;
|
|
216
|
+
outline-offset: -2px;
|
|
217
|
+
}
|
|
218
|
+
:where(.cngx-async--error):not(:focus-visible) {
|
|
219
|
+
outline: 2px dashed;
|
|
220
|
+
outline-offset: -2px;
|
|
73
221
|
}
|
|
74
222
|
}
|
|
@@ -20,6 +20,8 @@
|
|
|
20
20
|
* **Pair with**
|
|
21
21
|
*
|
|
22
22
|
* - `@cngx/themes/material/backdrop-theme` - Material 3 scrim surface
|
|
23
|
+
*
|
|
24
|
+
* @themes CngxBackdrop
|
|
23
25
|
*/
|
|
24
26
|
|
|
25
27
|
@layer cngx.tokens {
|
|
@@ -70,7 +72,7 @@
|
|
|
70
72
|
|
|
71
73
|
/* Themable - token-driven, three-tier overridable */
|
|
72
74
|
background: var(--cngx-backdrop-bg, oklch(0 0 0 / 0.5));
|
|
73
|
-
transition: opacity var(--cngx-backdrop-transition-duration
|
|
75
|
+
transition: opacity var(--cngx-backdrop-transition-duration);
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
/* Visible state - class is toggled by the directive. `:scope` form
|
|
@@ -45,6 +45,8 @@
|
|
|
45
45
|
* cut-out ring via `--cngx-badge-border-dark` / `-light`. Default
|
|
46
46
|
* border is `0` (no ring), so the dark-mode block is a no-op until
|
|
47
47
|
* a consumer sets the ring tokens.
|
|
48
|
+
*
|
|
49
|
+
* @themes CngxBadge
|
|
48
50
|
*/
|
|
49
51
|
|
|
50
52
|
@layer cngx.tokens {
|
|
@@ -144,11 +146,11 @@
|
|
|
144
146
|
* `--cngx-color-primary`.
|
|
145
147
|
* @group Variant / Primary
|
|
146
148
|
* @see [[--cngx-color-primary]]
|
|
149
|
+
* @default var(--cngx-color-primary)
|
|
147
150
|
*/
|
|
148
151
|
@property --cngx-badge-primary-bg {
|
|
149
|
-
syntax: '
|
|
152
|
+
syntax: '*';
|
|
150
153
|
inherits: true;
|
|
151
|
-
initial-value: oklch(0.66 0.19 50);
|
|
152
154
|
}
|
|
153
155
|
|
|
154
156
|
/**
|
|
@@ -246,6 +248,19 @@
|
|
|
246
248
|
.light {
|
|
247
249
|
--cngx-badge-border: var(--cngx-badge-border-light, var(--cngx-badge-border, 0));
|
|
248
250
|
}
|
|
251
|
+
|
|
252
|
+
/* Derive the radius and the error and warning fills from the theme: the
|
|
253
|
+
* registered initial defeats a use-site fallback, so the default lives in a
|
|
254
|
+
* SET. The fills inherit and SET on the badge host; the radius does not and
|
|
255
|
+
* SETs on the indicator. Kept in this layer so a Material bridge and a
|
|
256
|
+
* consumer override still win. */
|
|
257
|
+
.cngx-badge-host {
|
|
258
|
+
--cngx-badge-error-bg: var(--cngx-color-danger);
|
|
259
|
+
--cngx-badge-warning-bg: var(--cngx-color-warning);
|
|
260
|
+
}
|
|
261
|
+
.cngx-badge-indicator {
|
|
262
|
+
--cngx-badge-radius: var(--cngx-radius-pill);
|
|
263
|
+
}
|
|
249
264
|
}
|
|
250
265
|
|
|
251
266
|
@layer cngx.components {
|
|
@@ -273,7 +288,7 @@
|
|
|
273
288
|
min-width: var(--cngx-badge-size, 16px);
|
|
274
289
|
height: var(--cngx-badge-size, 16px);
|
|
275
290
|
padding: 0 var(--cngx-badge-padding-inline, 3px);
|
|
276
|
-
border-radius: var(--cngx-badge-radius
|
|
291
|
+
border-radius: var(--cngx-badge-radius);
|
|
277
292
|
font-size: var(--cngx-badge-font-size, 0.6875rem);
|
|
278
293
|
font-weight: var(--cngx-badge-font-weight, 600);
|
|
279
294
|
line-height: 1;
|
|
@@ -301,11 +316,11 @@
|
|
|
301
316
|
color: var(--cngx-badge-primary-color, oklch(1 0 0));
|
|
302
317
|
}
|
|
303
318
|
:scope.cngx-badge-indicator--error {
|
|
304
|
-
background: var(--cngx-badge-error-bg
|
|
319
|
+
background: var(--cngx-badge-error-bg);
|
|
305
320
|
color: var(--cngx-badge-error-color, oklch(1 0 0));
|
|
306
321
|
}
|
|
307
322
|
:scope.cngx-badge-indicator--warning {
|
|
308
|
-
background: var(--cngx-badge-warning-bg
|
|
323
|
+
background: var(--cngx-badge-warning-bg);
|
|
309
324
|
color: var(--cngx-badge-warning-color, oklch(0.2 0.01 250));
|
|
310
325
|
}
|
|
311
326
|
:scope.cngx-badge-indicator--neutral {
|
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
* - link colour -> `--cngx-color-primary`
|
|
25
25
|
* - terminal crumb -> `--cngx-color-text`
|
|
26
26
|
* - separator -> `--cngx-color-text-muted`
|
|
27
|
+
*
|
|
28
|
+
* @themes CngxBreadcrumb, CngxBreadcrumbItem, CngxBreadcrumbSeparator
|
|
27
29
|
*/
|
|
28
30
|
|
|
29
31
|
@layer cngx.tokens {
|
|
@@ -67,7 +69,7 @@
|
|
|
67
69
|
display: flex;
|
|
68
70
|
flex-wrap: wrap;
|
|
69
71
|
align-items: center;
|
|
70
|
-
gap: var(--cngx-breadcrumb-gap
|
|
72
|
+
gap: var(--cngx-breadcrumb-gap);
|
|
71
73
|
margin: 0;
|
|
72
74
|
padding: 0;
|
|
73
75
|
list-style: none;
|