@cngx/common 0.1.0-rc.0 → 0.1.0-rc.2
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/fesm2022/cngx-common-a11y.mjs +24 -11
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +64 -48
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +45 -11
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +559 -38
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +1394 -160
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common.mjs +1 -1
- package/package.json +3 -3
- package/stepper/README.md +16 -9
- package/theming/components/cngx-badge.css +1 -1
- package/theming/components/cngx-menu.css +1 -1
- package/types/cngx-common-a11y.d.ts +23 -2
- package/types/cngx-common-data.d.ts +46 -33
- package/types/cngx-common-interactive.d.ts +20 -2
- package/types/cngx-common-stepper.d.ts +604 -17
- package/types/cngx-common-tabs.d.ts +1363 -159
- package/tabs/README.md +0 -32
package/fesm2022/cngx-common.mjs
CHANGED
|
@@ -8,7 +8,7 @@ export * from '@cngx/common/popover';
|
|
|
8
8
|
import { makeVersion } from '@cngx/utils';
|
|
9
9
|
|
|
10
10
|
/** @internal — replaced at publish time, not part of consumer API. */
|
|
11
|
-
const VERSION = makeVersion('0.1.0-rc.
|
|
11
|
+
const VERSION = makeVersion('0.1.0-rc.2');
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Public API Surface of @cngx/common
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cngx/common",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
4
|
-
"description": "Atoms and molecules (a11y, interactive, layout, dialog, popover, display) for the
|
|
3
|
+
"version": "0.1.0-rc.2",
|
|
4
|
+
"description": "Atoms and molecules (a11y, interactive, layout, dialog, popover, display) for the CNGX Angular component library.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cngx",
|
|
7
7
|
"angular",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"directives",
|
|
12
12
|
"components"
|
|
13
13
|
],
|
|
14
|
-
"author": "Christian Weiss <
|
|
14
|
+
"author": "Christian Weiss <info@cngx.dev>",
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"homepage": "https://github.com/cngxjs/cngx#readme",
|
|
17
17
|
"bugs": {
|
package/stepper/README.md
CHANGED
|
@@ -94,6 +94,8 @@ class WizardCmp {
|
|
|
94
94
|
|-|-|
|
|
95
95
|
| `withStepperSkin(name)` | Select the visual skin for `<cngx-stepper>`: `'classic'` (default) / `'linear-minimal'` / `'stripe-status-rich'` / `'path-chevron'` / `'pill-segment'`. Thematic only - structure, slots, ARIA, and keyboard behaviour are identical across skins. The Material twin `<cngx-mat-stepper>` ignores this setting. |
|
|
96
96
|
| `withStepperMobileCollapse(mode)` | Choose the auto-collapse target for narrow viewports (`max-width: 480px`): `'text'` (default, renders `<cngx-text-stepper>`) / `'dots'` (renders `<cngx-dot-stepper>`) / `'off'` (keep the classic strip on every viewport). The Material twin ignores this setting. |
|
|
97
|
+
| `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. |
|
|
98
|
+
| `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. |
|
|
97
99
|
| `withStepperI18nLabels({ statusLabels })` | Override the per-state pill labels surfaced by the `stripe-status-rich` skin: `{ done, inProgress, upNext, errored }`. Partial overrides keep unset keys at the English default. |
|
|
98
100
|
| `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`. |
|
|
99
101
|
|
|
@@ -129,15 +131,20 @@ bootstrapApplication(AppComponent, {
|
|
|
129
131
|
|
|
130
132
|
`CngxStepperPresenter` also emits a dev-mode warning when a stepper has more than 6 leaf steps at the same depth with no `<cngx-step-group>` wrapper, guiding consumers toward logical grouping for better UX. The warning is one-shot per presenter instance (via `afterNextRender`) and no-ops in production builds.
|
|
131
133
|
|
|
132
|
-
##
|
|
134
|
+
## Header navigation
|
|
133
135
|
|
|
134
|
-
-
|
|
135
|
-
- **Pillar 2** (`Kommunikation als First-Class`): host contracts (`CNGX_STEPPER_HOST` / `CNGX_STEP_PANEL_HOST`) expose ARIA-relevant state as `Signal<T>` so organisms can wire reactive `aria-current` / `aria-busy` / `aria-describedby` from day one.
|
|
136
|
-
- **Pillar 3** (`Komposition statt Konfiguration`): step content is content-projected (`<cngxStep>` atoms), not configured via an options array. Organisms compose the presenter via `hostDirectives` rather than extending it.
|
|
137
|
-
- **Memory hygiene**: every atom registers a `DestroyRef.onDestroy` unregister hook; the router-sync directive uses `takeUntilDestroyed` for its `NavigationEnd` stream.
|
|
136
|
+
`headerNavigation` is a two-value policy - `'none'` or `'visited'` - that decides whether step headers are controls or pure indicators. It folds into the existing `linear` axis instead of adding a third value:
|
|
138
137
|
|
|
139
|
-
|
|
138
|
+
- `'none'`: headers render as inert labels (no `<button>`, no roving, no click); the footer is the sole navigation control.
|
|
139
|
+
- `'visited'` (default): headers are focusable buttons. `linear="false"` allows free click-through; `linear="true"` reaches only visited steps and marks forward-incomplete headers `aria-disabled` (focusable, so the gate is announced).
|
|
140
140
|
|
|
141
|
-
- `@cngx/ui/stepper`
|
|
142
|
-
|
|
143
|
-
|
|
141
|
+
"Free navigation" is `'visited'` + `linear="false"` - there is no discrete `'free'` value. Resolve via the cascade: per-instance `[headerNavigation]` input ?? `withStepperHeaderNavigation(...)` config ?? `'visited'`. See `@cngx/ui/stepper` for the full table and migration note.
|
|
142
|
+
|
|
143
|
+
## Error channels
|
|
144
|
+
|
|
145
|
+
A step carries an error through two independent channels:
|
|
146
|
+
|
|
147
|
+
- **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.
|
|
148
|
+
- **Commit / async** - a `commitAction` that rejects sets `lastFailedIndex`; the rolled-back step decorates via `*cngxStepRejection` and announces through the `CngxToastOn` / `CngxBannerOn` bridges.
|
|
149
|
+
|
|
150
|
+
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.
|
|
@@ -159,6 +159,22 @@ declare class CngxAutofocus {
|
|
|
159
159
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxAutofocus, "[cngxAutofocus]", ["cngxAutofocus"], { "when": { "alias": "cngxAutofocus"; "required": false; "isSignal": true; }; "delay": { "alias": "autofocusDelay"; "required": false; "isSignal": true; }; "options": { "alias": "autofocusOptions"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
+
/**
|
|
163
|
+
* CSS selector matching natively-focusable elements: links with an
|
|
164
|
+
* `href`, the enabled form controls, and anything with an explicit
|
|
165
|
+
* non-negative `tabindex`. Form controls carry `:not(:disabled)` because
|
|
166
|
+
* a disabled control is not in the tab order - without it a descendant
|
|
167
|
+
* probe would count a disabled button as focusable and a restore target
|
|
168
|
+
* could land on an unfocusable element. Single source of truth for "is
|
|
169
|
+
* this focusable" - the element-level {@link CngxFocusRestore} predicate
|
|
170
|
+
* matches against it, and descendant probes (e.g. "does this panel
|
|
171
|
+
* contain a focusable child?") query against it. Keeping one selector
|
|
172
|
+
* stops the two uses from drifting apart.
|
|
173
|
+
*
|
|
174
|
+
* @category common/a11y
|
|
175
|
+
* @since 0.1.0
|
|
176
|
+
*/
|
|
177
|
+
declare const CNGX_FOCUSABLE_SELECTOR = "a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex=\"-1\"])";
|
|
162
178
|
/**
|
|
163
179
|
* Stores the previously focused element and restores focus on destroy.
|
|
164
180
|
*
|
|
@@ -218,7 +234,12 @@ declare class CngxFocusRestore {
|
|
|
218
234
|
private resolveTarget;
|
|
219
235
|
/** Traverses up the DOM tree looking for the first natively focusable element. */
|
|
220
236
|
private findFocusableAncestor;
|
|
221
|
-
/**
|
|
237
|
+
/**
|
|
238
|
+
* Checks if an element is natively focusable (tabindex, links, form
|
|
239
|
+
* controls). Element-level predicate over the shared
|
|
240
|
+
* {@link CNGX_FOCUSABLE_SELECTOR}, so it never drifts from the
|
|
241
|
+
* descendant-query callers.
|
|
242
|
+
*/
|
|
222
243
|
private isFocusable;
|
|
223
244
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxFocusRestore, never>;
|
|
224
245
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxFocusRestore, "[cngxFocusRestore]", ["cngxFocusRestore"], { "restoreOnDestroy": { "alias": "restoreOnDestroy"; "required": false; "isSignal": true; }; "fallback": { "alias": "fallback"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
@@ -712,5 +733,5 @@ declare class CngxReducedMotion {
|
|
|
712
733
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<CngxReducedMotion, "[cngxReducedMotion]", ["cngxReducedMotion"], {}, {}, never, never, true, never>;
|
|
713
734
|
}
|
|
714
735
|
|
|
715
|
-
export { CNGX_AD_ITEM, CngxActiveDescendant, CngxAriaExpanded, CngxAutofocus, CngxFocusRestore, CngxFocusTrap, CngxFocusVisible, CngxLiveRegion, CngxReducedMotion, CngxRovingItem, CngxRovingTabindex };
|
|
736
|
+
export { CNGX_AD_ITEM, CNGX_FOCUSABLE_SELECTOR, CngxActiveDescendant, CngxAriaExpanded, CngxAutofocus, CngxFocusRestore, CngxFocusTrap, CngxFocusVisible, CngxLiveRegion, CngxReducedMotion, CngxRovingItem, CngxRovingTabindex };
|
|
716
737
|
export type { ActiveDescendantItem, CngxAdItemHandle };
|
|
@@ -1584,9 +1584,8 @@ declare const CNGX_COMMIT_CONTROLLER_FACTORY: InjectionToken<CngxCommitControlle
|
|
|
1584
1584
|
*
|
|
1585
1585
|
* Material types never enter this surface. The caller maps Material's
|
|
1586
1586
|
* own event/property shape to a host-agnostic `Signal<number>` /
|
|
1587
|
-
* `Observable<number>` / getter / setter at the directive boundary.
|
|
1588
|
-
* That keeps `@cngx/common/data` independent of `@angular/material
|
|
1589
|
-
* (Sheriff Level-2 invariant).
|
|
1587
|
+
* `Observable<number>` / getter / setter at the directive boundary. \
|
|
1588
|
+
* That keeps `@cngx/common/data` independent of `@angular/material`.
|
|
1590
1589
|
*
|
|
1591
1590
|
* @category common/data/material-bridge
|
|
1592
1591
|
*/
|
|
@@ -1629,6 +1628,22 @@ interface CngxMaterialBidirectionalSyncOptions {
|
|
|
1629
1628
|
/** DestroyRef used to clean up the effect and the subscription. */
|
|
1630
1629
|
readonly destroyRef: DestroyRef;
|
|
1631
1630
|
}
|
|
1631
|
+
/**
|
|
1632
|
+
* Handle returned by {@link createMaterialBidirectionalSync}.
|
|
1633
|
+
*
|
|
1634
|
+
* @category common/data/material-bridge
|
|
1635
|
+
*/
|
|
1636
|
+
interface CngxMaterialBidirectionalSyncHandle {
|
|
1637
|
+
/**
|
|
1638
|
+
* Force Material's selected index to the presenter's current index,
|
|
1639
|
+
* routed through the factory's self-echo suppression so it never
|
|
1640
|
+
* re-enters the Material→presenter path. Hosts call this from their
|
|
1641
|
+
* commit lifecycle when a pessimistic commit settles WITHOUT advancing
|
|
1642
|
+
* the presenter (a rejected switch), which leaves Material eager-
|
|
1643
|
+
* advanced on the refused tab. A no-op when already in sync.
|
|
1644
|
+
*/
|
|
1645
|
+
readonly reconcile: () => void;
|
|
1646
|
+
}
|
|
1632
1647
|
/**
|
|
1633
1648
|
* Single shared bidirectional-sync factory for cngx organisms /
|
|
1634
1649
|
* directives that bridge a cngx presenter against a Material parent
|
|
@@ -1654,39 +1669,37 @@ interface CngxMaterialBidirectionalSyncOptions {
|
|
|
1654
1669
|
*
|
|
1655
1670
|
* Both sides clean up via `destroyRef`.
|
|
1656
1671
|
*
|
|
1657
|
-
* **Pessimistic-commit gate (deliberately absent).** An earlier draft
|
|
1658
|
-
* carried a third option `commitState: CngxAsyncState<unknown>` that
|
|
1659
|
-
* gated the Material write while `commitState.isPending()`. The plan
|
|
1660
|
-
* (`global-material-bridge-and-architecture-hardening-plan` §54)
|
|
1661
|
-
* specified this gate "for the pessimistic flow." Implementation
|
|
1662
|
-
* showed the gate is redundant: cngx commit handlers already keep
|
|
1663
|
-
* `presenter.activeIndex` at the origin during pessimistic-pending,
|
|
1664
|
-
* so the equality guard alone suppresses the Material write.
|
|
1665
|
-
* Conversely, in optimistic mode the presenter advances IMMEDIATELY
|
|
1666
|
-
* (before the commit settles); a `pending`-keyed gate would suppress
|
|
1667
|
-
* that legitimate advance and break the optimistic UX. Dropping the
|
|
1668
|
-
* gate makes both modes work via the simple presenter→Material
|
|
1669
|
-
* mirror — same outcome as the gate version for pessimistic, and the
|
|
1670
|
-
* correct outcome for optimistic.
|
|
1671
|
-
*
|
|
1672
1672
|
* **Material-eager-advance reconciliation.** Material's MDC click
|
|
1673
|
-
* handler advances `selectedIndex`
|
|
1674
|
-
*
|
|
1675
|
-
* `
|
|
1676
|
-
*
|
|
1677
|
-
*
|
|
1678
|
-
*
|
|
1679
|
-
*
|
|
1680
|
-
*
|
|
1681
|
-
*
|
|
1682
|
-
*
|
|
1683
|
-
*
|
|
1684
|
-
*
|
|
1685
|
-
*
|
|
1673
|
+
* handler advances `selectedIndex` *before* the Material→presenter
|
|
1674
|
+
* subscription forwards the click. When the presenter HOLDS its index
|
|
1675
|
+
* (pessimistic mode + bound `commitAction`), the subscriber does NOT
|
|
1676
|
+
* write Material back: on a SUCCESSFUL commit the presenter later
|
|
1677
|
+
* advances to the clicked target and Material is already there, so the
|
|
1678
|
+
* mirror effect is a no-op (no flash); on a REJECTED commit the presenter
|
|
1679
|
+
* never moves, leaving Material eager-advanced on the refused tab. The
|
|
1680
|
+
* host detects the rejection through its own commit lifecycle and calls
|
|
1681
|
+
* {@link CngxMaterialBidirectionalSyncHandle.reconcile} to snap Material
|
|
1682
|
+
* back. Writing from inside the subscriber instead is unsafe: Material's
|
|
1683
|
+
* `selectedIndex` read-back lags a programmatic write, so the mirror
|
|
1684
|
+
* effect's equality guard reads a stale value and skips the corrective
|
|
1685
|
+
* write, sticking the visual on the wrong tab.
|
|
1686
|
+
*
|
|
1687
|
+
* **Self-echo suppression (loop-safety).** Every programmatic
|
|
1688
|
+
* `selectedIndex` write makes Material re-emit `selectionChange`. The
|
|
1689
|
+
* factory records each value it writes and drops the matching echo
|
|
1690
|
+
* (`indexOf` + splice, which also prunes earlier writes whose echo
|
|
1691
|
+
* Material coalesced away) before any other processing. This is
|
|
1692
|
+
* load-bearing for an ASYNC commit-action: Material emits the echo a
|
|
1693
|
+
* microtask later, by which point the commit may have advanced
|
|
1694
|
+
* `presenterIndex`, so an equality-only guard (`presenterIndex() ===
|
|
1695
|
+
* idx`) would FAIL to drop the echo — it would re-enter the subscriber
|
|
1696
|
+
* and ping-pong against the in-flight navigation (the demo freezes).
|
|
1697
|
+
* Matching the echo by the value we wrote drops it regardless of where
|
|
1698
|
+
* the presenter has moved.
|
|
1686
1699
|
*
|
|
1687
1700
|
* @category common/data/material-bridge
|
|
1688
1701
|
*/
|
|
1689
|
-
declare function createMaterialBidirectionalSync(opts: CngxMaterialBidirectionalSyncOptions):
|
|
1702
|
+
declare function createMaterialBidirectionalSync(opts: CngxMaterialBidirectionalSyncOptions): CngxMaterialBidirectionalSyncHandle;
|
|
1690
1703
|
|
|
1691
1704
|
export { CNGX_COMMIT_CONTROLLER_FACTORY, CNGX_RECYCLER_I18N, CngxAsync, CngxDataSource, CngxFilter, CngxFilterChip, CngxFilterChips, CngxMeasure, CngxMetric, CngxPaginate, CngxRecyclerAnnouncer, CngxSmartDataSource, CngxSort, CngxSortHeader, CngxTrend, CngxVirtualItem, connectRecyclerToActiveDescendant, connectRecyclerToRoving, createAsyncState, createCommitController, createManualState, createMaterialBidirectionalSync, injectAsyncState, injectDataSource, injectRecycler, injectSmartDataSource, provideRecyclerI18n, resolveAsyncView };
|
|
1692
|
-
export type { AsyncView, CngxAsyncContext, CngxCommitBeginHandlers, CngxCommitController, CngxCommitControllerFactory, CngxCommitHandle, CngxCommitRunner, CngxFilterChipContext, CngxMaterialBidirectionalSyncOptions, CngxRecycler, CngxSmartDataSourceOptions, InjectAsyncStateOptions, ManualAsyncState, MutableAsyncState, ReactiveAsyncState, RecyclerConfig, RecyclerI18n, SortEntry };
|
|
1705
|
+
export type { AsyncView, CngxAsyncContext, CngxCommitBeginHandlers, CngxCommitController, CngxCommitControllerFactory, CngxCommitHandle, CngxCommitRunner, CngxFilterChipContext, CngxMaterialBidirectionalSyncHandle, CngxMaterialBidirectionalSyncOptions, CngxRecycler, CngxSmartDataSourceOptions, InjectAsyncStateOptions, ManualAsyncState, MutableAsyncState, ReactiveAsyncState, RecyclerConfig, RecyclerI18n, SortEntry };
|
|
@@ -3362,10 +3362,28 @@ declare class CngxSwipe {
|
|
|
3362
3362
|
readonly swipeProgress: _angular_core.Signal<number>;
|
|
3363
3363
|
/** Dominant direction of the in-flight gesture, or `null` when idle. */
|
|
3364
3364
|
readonly swipeDirection: _angular_core.Signal<SwipeDirection | null>;
|
|
3365
|
+
/**
|
|
3366
|
+
* The `touch-action` the host should advertise, derived from `axis`.
|
|
3367
|
+
* A pinned axis hands the orthogonal direction back to native
|
|
3368
|
+
* scrolling (`x` -> `pan-y`, `y` -> `pan-x`); `both` claims the
|
|
3369
|
+
* whole surface (`none`). When disabled, no value is written so the
|
|
3370
|
+
* element keeps its native scroll behaviour untouched.
|
|
3371
|
+
*/
|
|
3372
|
+
protected readonly touchAction: _angular_core.Signal<string | null>;
|
|
3365
3373
|
constructor();
|
|
3366
3374
|
/**
|
|
3367
|
-
* Resolve the
|
|
3368
|
-
*
|
|
3375
|
+
* Resolve the swipe direction + distance for a pointer delta.
|
|
3376
|
+
*
|
|
3377
|
+
* When `axis` is pinned, only that axis's delta decides direction
|
|
3378
|
+
* and distance - the orthogonal component is irrelevant, not an
|
|
3379
|
+
* abort reason. The previous endpoint-dominance check (`|dx| >= |dy|`)
|
|
3380
|
+
* discarded a clearly horizontal drag the moment a natural thumb arc
|
|
3381
|
+
* left `|dy|` slightly larger at release, which made a pinned swipe
|
|
3382
|
+
* register only on a near-perfect straight line. `touch-action`
|
|
3383
|
+
* (advertised from the same `axis`) is the real guard against an
|
|
3384
|
+
* orthogonal scroll firing the gesture: the browser cancels the
|
|
3385
|
+
* pointer before pointerup, so a clean cycle reaching here is already
|
|
3386
|
+
* the intended direction. `both` keeps the dominant-axis heuristic.
|
|
3369
3387
|
*/
|
|
3370
3388
|
private read;
|
|
3371
3389
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<CngxSwipe, never>;
|