@cngx/common 0.0.1-rc.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/LICENSE +21 -0
- package/README.md +18 -0
- package/a11y/README.md +77 -0
- package/card/README.md +79 -0
- package/chart/README.md +31 -0
- package/data/README.md +883 -0
- package/dialog/README.md +84 -0
- package/display/README.md +30 -0
- package/fesm2022/cngx-common-a11y.mjs +1260 -0
- package/fesm2022/cngx-common-a11y.mjs.map +1 -0
- package/fesm2022/cngx-common-card.mjs +765 -0
- package/fesm2022/cngx-common-card.mjs.map +1 -0
- package/fesm2022/cngx-common-chart.mjs +2943 -0
- package/fesm2022/cngx-common-chart.mjs.map +1 -0
- package/fesm2022/cngx-common-data.mjs +2886 -0
- package/fesm2022/cngx-common-data.mjs.map +1 -0
- package/fesm2022/cngx-common-dialog.mjs +1366 -0
- package/fesm2022/cngx-common-dialog.mjs.map +1 -0
- package/fesm2022/cngx-common-display.mjs +1603 -0
- package/fesm2022/cngx-common-display.mjs.map +1 -0
- package/fesm2022/cngx-common-interactive.mjs +8185 -0
- package/fesm2022/cngx-common-interactive.mjs.map +1 -0
- package/fesm2022/cngx-common-layout.mjs +1335 -0
- package/fesm2022/cngx-common-layout.mjs.map +1 -0
- package/fesm2022/cngx-common-popover.mjs +1200 -0
- package/fesm2022/cngx-common-popover.mjs.map +1 -0
- package/fesm2022/cngx-common-stepper.mjs +1350 -0
- package/fesm2022/cngx-common-stepper.mjs.map +1 -0
- package/fesm2022/cngx-common-tabs.mjs +1551 -0
- package/fesm2022/cngx-common-tabs.mjs.map +1 -0
- package/fesm2022/cngx-common.mjs +34 -0
- package/fesm2022/cngx-common.mjs.map +1 -0
- package/interactive/README.md +211 -0
- package/layout/README.md +117 -0
- package/package.json +100 -0
- package/popover/README.md +218 -0
- package/stepper/README.md +102 -0
- package/tabs/README.md +32 -0
- package/types/cngx-common-a11y.d.ts +616 -0
- package/types/cngx-common-card.d.ts +413 -0
- package/types/cngx-common-chart.d.ts +1081 -0
- package/types/cngx-common-data.d.ts +1460 -0
- package/types/cngx-common-dialog.d.ts +772 -0
- package/types/cngx-common-display.d.ts +1136 -0
- package/types/cngx-common-interactive.d.ts +5013 -0
- package/types/cngx-common-layout.d.ts +737 -0
- package/types/cngx-common-popover.d.ts +520 -0
- package/types/cngx-common-stepper.d.ts +982 -0
- package/types/cngx-common-tabs.d.ts +1237 -0
- package/types/cngx-common.d.ts +13 -0
|
@@ -0,0 +1,1237 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Signal, InjectionToken, ModelSignal, TemplateRef, EnvironmentProviders, Provider, Injector } from '@angular/core';
|
|
3
|
+
import { CngxAsyncState, StatusTransition } from '@cngx/core/utils';
|
|
4
|
+
import { Observable } from 'rxjs';
|
|
5
|
+
import { CngxErrorAggregatorContract } from '@cngx/common/interactive';
|
|
6
|
+
import { CngxCommitController } from '@cngx/common/data';
|
|
7
|
+
import { CngxActiveDescendant, ActiveDescendantItem } from '@cngx/common/a11y';
|
|
8
|
+
import { CngxPopover } from '@cngx/common/popover';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Registration handle a `CngxTab` atom passes to its presenter via
|
|
12
|
+
* {@link CngxTabGroupHost.register}. Fields are exposed by reference
|
|
13
|
+
* so subsequent input changes propagate without re-registration.
|
|
14
|
+
* `errorAggregator` is a `Signal<...>` slot so consumer aggregators
|
|
15
|
+
* resolved via `viewChild` after first registration still bind.
|
|
16
|
+
*/
|
|
17
|
+
interface CngxTabHandle {
|
|
18
|
+
readonly id: string;
|
|
19
|
+
readonly label: Signal<string | undefined>;
|
|
20
|
+
readonly disabled: Signal<boolean>;
|
|
21
|
+
readonly errorAggregator: Signal<CngxErrorAggregatorContract | undefined>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Contract atoms see when they inject the presenter via
|
|
25
|
+
* {@link CNGX_TAB_GROUP_HOST}. Atoms never reach into the concrete
|
|
26
|
+
* class — keeps layering cycle-free and the decompose schematic clean.
|
|
27
|
+
*/
|
|
28
|
+
interface CngxTabGroupHost {
|
|
29
|
+
readonly tabs: Signal<readonly CngxTabHandle[]>;
|
|
30
|
+
readonly activeIndex: ModelSignal<number>;
|
|
31
|
+
readonly activeId: Signal<string | null>;
|
|
32
|
+
readonly orientation: Signal<'horizontal' | 'vertical'>;
|
|
33
|
+
readonly loop: Signal<boolean>;
|
|
34
|
+
readonly commitState: CngxAsyncState<number | undefined>;
|
|
35
|
+
readonly intendedIndex: Signal<number | undefined>;
|
|
36
|
+
/**
|
|
37
|
+
* Reactive current/previous pair for the commit-state status. Lets
|
|
38
|
+
* organisms and skin sub-components derive transition-driven
|
|
39
|
+
* announcements (`pending` → `success`, `pending` → `error`, sync
|
|
40
|
+
* `idle` → `error`) from a single tracker.
|
|
41
|
+
*/
|
|
42
|
+
readonly commitTransition: StatusTransition;
|
|
43
|
+
/**
|
|
44
|
+
* Tab index of the last refused commit (both optimistic and
|
|
45
|
+
* pessimistic modes). Cleared on next successful re-pick of the
|
|
46
|
+
* same index or via {@link clearLastFailed}. Drives the persistent
|
|
47
|
+
* rejection-icon decoration.
|
|
48
|
+
*
|
|
49
|
+
* @remarks
|
|
50
|
+
* The `pending → error` pulse keyframe (`cngx-tab-pulse-error`)
|
|
51
|
+
* does not retrigger on rapid supersede sequences — CSS animations
|
|
52
|
+
* only fire on fresh class application. See `tabs-accepted-debt §3`;
|
|
53
|
+
* the persistent icon plus static red outline carry the durable
|
|
54
|
+
* signal in the no-pulse case.
|
|
55
|
+
*/
|
|
56
|
+
readonly lastFailedIndex: Signal<number | undefined>;
|
|
57
|
+
/**
|
|
58
|
+
* Safe-harbour origin index captured at the start of an active
|
|
59
|
+
* commit window. Written when `select()` opens a transition under
|
|
60
|
+
* `commitAction`; retained on `error` so the live-region phrase
|
|
61
|
+
* can resolve the origin label; cleared on `success`. Outside the
|
|
62
|
+
* commit window the slot may carry a stale value — consumers must
|
|
63
|
+
* gate reads by joining with `lastFailedIndex`. The origin is
|
|
64
|
+
* meaningful only when `lastFailedIndex !== undefined`.
|
|
65
|
+
*/
|
|
66
|
+
readonly originIndexDuringCommit: Signal<number | undefined>;
|
|
67
|
+
register(handle: CngxTabHandle): void;
|
|
68
|
+
unregister(id: string): void;
|
|
69
|
+
select(index: number): void;
|
|
70
|
+
selectNext(): void;
|
|
71
|
+
selectPrevious(): void;
|
|
72
|
+
selectById(id: string): void;
|
|
73
|
+
/**
|
|
74
|
+
* Clear {@link lastFailedIndex} without unwinding
|
|
75
|
+
* {@link originIndexDuringCommit} (consumers gate reads on
|
|
76
|
+
* `lastFailedIndex` anyway). Call when the bound data source
|
|
77
|
+
* changes and the rollback marker is no longer meaningful.
|
|
78
|
+
*/
|
|
79
|
+
clearLastFailed(): void;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* DI token for the tab presenter's contract. Presenter provides via
|
|
83
|
+
* `useExisting`; `CngxTab` injects to register; the organism injects
|
|
84
|
+
* to forward keyboard nav from `CngxRovingTabindex`.
|
|
85
|
+
*/
|
|
86
|
+
declare const CNGX_TAB_GROUP_HOST: InjectionToken<CngxTabGroupHost>;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Async-commit action shape for tab transitions. Receives origin
|
|
90
|
+
* and target indices; resolves `true` to commit, `false` to refuse.
|
|
91
|
+
* `Observable | Promise | sync` union mirrors the rest of the cngx
|
|
92
|
+
* commit-action family.
|
|
93
|
+
*/
|
|
94
|
+
type CngxTabsCommitAction = (fromIndex: number, toIndex: number) => boolean | Promise<boolean> | Observable<boolean>;
|
|
95
|
+
/**
|
|
96
|
+
* Tab-group presenter — brain of every cngx tab flow. Owns the
|
|
97
|
+
* active-index model, the tab registry, orientation, loop policy,
|
|
98
|
+
* and the commit-controller lifecycle. Provides
|
|
99
|
+
* {@link CNGX_TAB_GROUP_HOST} for atoms and {@link CNGX_STATEFUL}
|
|
100
|
+
* so `<cngx-toast-on />` / `<cngx-banner-on />` compose without
|
|
101
|
+
* `[state]` wiring.
|
|
102
|
+
*
|
|
103
|
+
* **Layer:** `@cngx/common/tabs` (Level 2). Directive-only —
|
|
104
|
+
* organisms compose via `hostDirectives`, consumers attach
|
|
105
|
+
* `[cngxTabGroup]` directly.
|
|
106
|
+
*/
|
|
107
|
+
declare class CngxTabGroupPresenter implements CngxTabGroupHost {
|
|
108
|
+
readonly activeIndex: i0.ModelSignal<number>;
|
|
109
|
+
readonly orientation: i0.InputSignal<"horizontal" | "vertical">;
|
|
110
|
+
readonly loop: i0.InputSignal<boolean>;
|
|
111
|
+
/**
|
|
112
|
+
* Async-commit action gating the transition. When non-null,
|
|
113
|
+
* `select(...)` routes through {@link CngxTabsCommitHandler}; the
|
|
114
|
+
* action's resolution decides whether the change lands. Supersede
|
|
115
|
+
* semantics come from the commit-controller — a rapid second
|
|
116
|
+
* `select(...)` cancels the in-flight runner.
|
|
117
|
+
*/
|
|
118
|
+
readonly commitAction: i0.InputSignal<CngxTabsCommitAction | null>;
|
|
119
|
+
/**
|
|
120
|
+
* Default `'optimistic'` — tab change is navigation, not a save,
|
|
121
|
+
* so eager visual feedback matches the user's mental model.
|
|
122
|
+
* Switch to `'pessimistic'` when the new tab must wait for the
|
|
123
|
+
* action to confirm.
|
|
124
|
+
*/
|
|
125
|
+
readonly commitMode: i0.InputSignal<"optimistic" | "pessimistic">;
|
|
126
|
+
private readonly genericFactory;
|
|
127
|
+
private readonly commitController;
|
|
128
|
+
private readonly commitHandler;
|
|
129
|
+
/** Producer surface for the `CNGX_STATEFUL` bridge contract. */
|
|
130
|
+
readonly state: CngxAsyncState<number | undefined>;
|
|
131
|
+
readonly commitState: CngxAsyncState<number | undefined>;
|
|
132
|
+
/**
|
|
133
|
+
* Index the user is currently trying to commit to. Tracked
|
|
134
|
+
* separately from `state.data()` (which only updates on success)
|
|
135
|
+
* to drive per-tab `aria-busy`.
|
|
136
|
+
*/
|
|
137
|
+
readonly intendedIndex: Signal<number | undefined>;
|
|
138
|
+
/**
|
|
139
|
+
* Current/previous pair for `commitState.status()`. Skin
|
|
140
|
+
* sub-components feed `<span cngxLiveRegion>` from this tracker
|
|
141
|
+
* for declarative SR announcements. Shared across consumers so
|
|
142
|
+
* the tracker's `linkedSignal` is allocated once per presenter.
|
|
143
|
+
*/
|
|
144
|
+
readonly commitTransition: StatusTransition;
|
|
145
|
+
private readonly lastFailedIndexState;
|
|
146
|
+
private readonly originIndexDuringCommitState;
|
|
147
|
+
/** {@inheritDoc CngxTabGroupHost.lastFailedIndex} */
|
|
148
|
+
readonly lastFailedIndex: Signal<number | undefined>;
|
|
149
|
+
/** {@inheritDoc CngxTabGroupHost.originIndexDuringCommit} */
|
|
150
|
+
readonly originIndexDuringCommit: Signal<number | undefined>;
|
|
151
|
+
private readonly tabsState;
|
|
152
|
+
readonly tabs: Signal<readonly CngxTabHandle[]>;
|
|
153
|
+
private readonly clampedIndex;
|
|
154
|
+
readonly activeId: Signal<string | null>;
|
|
155
|
+
register(handle: CngxTabHandle): void;
|
|
156
|
+
unregister(id: string): void;
|
|
157
|
+
/** {@inheritDoc CngxTabGroupHost.clearLastFailed} */
|
|
158
|
+
clearLastFailed(): void;
|
|
159
|
+
select(index: number): void;
|
|
160
|
+
selectNext(): void;
|
|
161
|
+
selectPrevious(): void;
|
|
162
|
+
selectById(id: string): void;
|
|
163
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTabGroupPresenter, never>;
|
|
164
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTabGroupPresenter, "[cngxTabGroup]", ["cngxTabGroup"], { "activeIndex": { "alias": "activeIndex"; "required": false; "isSignal": true; }; "orientation": { "alias": "orientation"; "required": false; "isSignal": true; }; "loop": { "alias": "loop"; "required": false; "isSignal": true; }; "commitAction": { "alias": "commitAction"; "required": false; "isSignal": true; }; "commitMode": { "alias": "commitMode"; "required": false; "isSignal": true; }; }, { "activeIndex": "activeIndexChange"; }, never, never, true, never>;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Read-mostly panel-surface contract for the overflow molecule, skin
|
|
169
|
+
* sub-components, and future panel-level helpers. Narrower than
|
|
170
|
+
* {@link CngxTabGroupHost} — register / unregister stay on the brain.
|
|
171
|
+
*
|
|
172
|
+
* The single write path is `selectById`; routing back through the
|
|
173
|
+
* presenter preserves clamping, disabled-skip, and commit-action
|
|
174
|
+
* gating. Template resolvers let skin sub-components project the
|
|
175
|
+
* `*cngxTabLabel` / `*cngxTabContent` slots without depending on the
|
|
176
|
+
* concrete `CngxTabGroup` class.
|
|
177
|
+
*/
|
|
178
|
+
interface CngxTabPanelHost {
|
|
179
|
+
readonly tabs: Signal<readonly CngxTabHandle[]>;
|
|
180
|
+
readonly activeId: Signal<string | null>;
|
|
181
|
+
readonly orientation: Signal<'horizontal' | 'vertical'>;
|
|
182
|
+
selectById(id: string): void;
|
|
183
|
+
/** Resolves a tab id to its `*cngxTabLabel` template (consumer-supplied). */
|
|
184
|
+
labelTemplateFor(id: string): TemplateRef<unknown> | null;
|
|
185
|
+
/** Resolves a tab id to its `*cngxTabContent` template (consumer-supplied). */
|
|
186
|
+
contentTemplateFor(id: string): TemplateRef<unknown> | null;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* DI token the organism provides via `useExisting`. The overflow
|
|
190
|
+
* molecule and consumer-authored skin sub-components inject this
|
|
191
|
+
* instead of the concrete component class.
|
|
192
|
+
*/
|
|
193
|
+
declare const CNGX_TAB_PANEL_HOST: InjectionToken<CngxTabPanelHost>;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Structural slot directive marking the per-tab panel-body template.
|
|
197
|
+
* Discovered by `<cngx-tab-group>` via `contentChild` on each
|
|
198
|
+
* `CngxTab` and projected into the matching `role="tabpanel"`.
|
|
199
|
+
*
|
|
200
|
+
* ```html
|
|
201
|
+
* <div cngxTab id="settings">
|
|
202
|
+
* <ng-template cngxTabLabel>Settings</ng-template>
|
|
203
|
+
* <ng-template cngxTabContent>
|
|
204
|
+
* <p>Settings panel body…</p>
|
|
205
|
+
* </ng-template>
|
|
206
|
+
* </div>
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
declare class CngxTabContent {
|
|
210
|
+
readonly templateRef: TemplateRef<any>;
|
|
211
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTabContent, never>;
|
|
212
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTabContent, "ng-template[cngxTabContent]", ["cngxTabContent"], {}, {}, never, never, true, never>;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Structural slot directive marking the per-tab label template.
|
|
217
|
+
* Discovered by `<cngx-tab-group>` via `contentChild` on each
|
|
218
|
+
* `CngxTab` and projected into the tab strip.
|
|
219
|
+
*
|
|
220
|
+
* ```html
|
|
221
|
+
* <div cngxTab id="settings">
|
|
222
|
+
* <ng-template cngxTabLabel>Settings</ng-template>
|
|
223
|
+
* <ng-template cngxTabContent>...</ng-template>
|
|
224
|
+
* </div>
|
|
225
|
+
* ```
|
|
226
|
+
*/
|
|
227
|
+
declare class CngxTabLabel {
|
|
228
|
+
readonly templateRef: TemplateRef<any>;
|
|
229
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTabLabel, never>;
|
|
230
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTabLabel, "ng-template[cngxTabLabel]", ["cngxTabLabel"], {}, {}, never, never, true, never>;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Single-tab atom. Registers with the enclosing presenter via
|
|
235
|
+
* {@link CNGX_TAB_GROUP_HOST} on construction; deregisters via
|
|
236
|
+
* {@link DestroyRef} on teardown. The presenter holds the atom's
|
|
237
|
+
* input signals by reference, so input changes propagate without
|
|
238
|
+
* re-registration. `labelTemplate` / `contentTemplate` are projected
|
|
239
|
+
* by the organism — the atom carries no rendering logic.
|
|
240
|
+
*/
|
|
241
|
+
declare class CngxTab {
|
|
242
|
+
readonly id: i0.InputSignal<string>;
|
|
243
|
+
readonly disabled: i0.InputSignal<boolean>;
|
|
244
|
+
readonly label: i0.InputSignal<string | undefined>;
|
|
245
|
+
readonly errorAggregator: i0.InputSignal<CngxErrorAggregatorContract | undefined>;
|
|
246
|
+
readonly labelTemplate: Signal<CngxTabLabel | undefined>;
|
|
247
|
+
readonly contentTemplate: Signal<CngxTabContent | undefined>;
|
|
248
|
+
private readonly host;
|
|
249
|
+
/** `true` when the presenter's `activeId` equals this tab's id. */
|
|
250
|
+
readonly selected: Signal<boolean>;
|
|
251
|
+
constructor();
|
|
252
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTab, never>;
|
|
253
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTab, "[cngxTab]", ["cngxTab"], { "id": { "alias": "id"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "errorAggregator": { "alias": "errorAggregator"; "required": false; "isSignal": true; }; }, {}, ["labelTemplate", "contentTemplate"], never, true, never>;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* URL deep-linking for tab groups. Bidirectional sync between
|
|
258
|
+
* `activeId` and a URL fragment or query-param. Opt-in via
|
|
259
|
+
* `[cngxTabsFragmentSync]` on the presenter element.
|
|
260
|
+
*
|
|
261
|
+
* - `mode = 'fragment'` (default) → `#tab=settings`
|
|
262
|
+
* - `mode = 'queryParam'` with `paramName = 'tab'` → `?tab=settings`
|
|
263
|
+
*
|
|
264
|
+
* `Router` is optional — without it the directive logs a dev warning
|
|
265
|
+
* via `afterNextRender` and becomes a no-op. Every `router.navigate`
|
|
266
|
+
* and `host.selectById` inside the effects sits in `untracked()`.
|
|
267
|
+
*/
|
|
268
|
+
declare class CngxTabsFragmentSync {
|
|
269
|
+
readonly mode: i0.InputSignal<"fragment" | "queryParam">;
|
|
270
|
+
readonly paramName: i0.InputSignal<string>;
|
|
271
|
+
private readonly host;
|
|
272
|
+
private readonly router;
|
|
273
|
+
constructor();
|
|
274
|
+
private readUrlValue;
|
|
275
|
+
private parseFragment;
|
|
276
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTabsFragmentSync, never>;
|
|
277
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTabsFragmentSync, "[cngxTabsFragmentSync]", ["cngxTabsFragmentSync"], { "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "paramName": { "alias": "paramName"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Context for the `*cngxTabOverflowItem` template. Replaces the
|
|
282
|
+
* default `tab.label() ?? tab.id` text inside the More popover; the
|
|
283
|
+
* surrounding `<li role="menuitem">` shell (`aria-disabled`, click
|
|
284
|
+
* handler, `data-tab-id`) stays library-owned.
|
|
285
|
+
*/
|
|
286
|
+
interface CngxTabOverflowItemContext {
|
|
287
|
+
/** Convenience alias for `tab` — usable as `let-tab` shorthand. */
|
|
288
|
+
readonly $implicit: CngxTabHandle;
|
|
289
|
+
/** The hidden tab the row represents. */
|
|
290
|
+
readonly tab: CngxTabHandle;
|
|
291
|
+
/**
|
|
292
|
+
* Commit-aware select. Routes through `panelHost.selectById(tab.id)`
|
|
293
|
+
* and dismisses the popover; no-op when `disabled`.
|
|
294
|
+
*/
|
|
295
|
+
readonly pick: () => void;
|
|
296
|
+
/** Mirrors `tab.disabled()` — pre-resolved for consumer convenience. */
|
|
297
|
+
readonly disabled: boolean;
|
|
298
|
+
/** Row index inside `hiddenTabs()`, starting at 0. */
|
|
299
|
+
readonly index: number;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Structural slot for the per-row body inside the More popover.
|
|
303
|
+
* 3-stage cascade: per-instance directive >
|
|
304
|
+
* `CNGX_TABS_CONFIG.templates.overflowItem` > built-in label text.
|
|
305
|
+
*
|
|
306
|
+
* ```html
|
|
307
|
+
* <cngx-tab-overflow>
|
|
308
|
+
* <ng-template cngxTabOverflowItem let-tab let-disabled="disabled">
|
|
309
|
+
* <my-icon [name]="tab.id" />
|
|
310
|
+
* <span class="row-label" [class.is-muted]="disabled">
|
|
311
|
+
* {{ tab.label() }}
|
|
312
|
+
* </span>
|
|
313
|
+
* </ng-template>
|
|
314
|
+
* </cngx-tab-overflow>
|
|
315
|
+
* ```
|
|
316
|
+
*/
|
|
317
|
+
declare class CngxTabOverflowItem {
|
|
318
|
+
readonly templateRef: TemplateRef<CngxTabOverflowItemContext>;
|
|
319
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTabOverflowItem, never>;
|
|
320
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTabOverflowItem, "ng-template[cngxTabOverflowItem]", ["cngxTabOverflowItem"], {}, {}, never, never, true, never>;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Context for the `*cngxTabOverflowTrigger` template. Replaces the
|
|
325
|
+
* default `i18n.moreTabsLabel(count)` text on the More button; the
|
|
326
|
+
* surrounding `<button cngxPopoverTrigger>` shell (`aria-haspopup`,
|
|
327
|
+
* `aria-expanded`, click handler, hidden binding) stays library-owned.
|
|
328
|
+
*/
|
|
329
|
+
interface CngxTabOverflowTriggerContext {
|
|
330
|
+
/** Convenience alias for `count` — usable as `let-count` shorthand. */
|
|
331
|
+
readonly $implicit: number;
|
|
332
|
+
/** Number of hidden tabs currently surfaced through the overflow popover. */
|
|
333
|
+
readonly count: number;
|
|
334
|
+
/** Hidden tabs, in the order they appear in `presenter.tabs()`. */
|
|
335
|
+
readonly hiddenTabs: readonly CngxTabHandle[];
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Structural slot for the More-button label. 3-stage cascade:
|
|
339
|
+
* per-instance directive >
|
|
340
|
+
* `CNGX_TABS_CONFIG.templates.overflowTrigger` >
|
|
341
|
+
* `i18n.moreTabsLabel(count)`.
|
|
342
|
+
*
|
|
343
|
+
* ```html
|
|
344
|
+
* <cngx-tab-overflow>
|
|
345
|
+
* <ng-template cngxTabOverflowTrigger let-count>
|
|
346
|
+
* <my-icon name="dots" /> +{{ count }}
|
|
347
|
+
* </ng-template>
|
|
348
|
+
* </cngx-tab-overflow>
|
|
349
|
+
* ```
|
|
350
|
+
*/
|
|
351
|
+
declare class CngxTabOverflowTrigger {
|
|
352
|
+
readonly templateRef: TemplateRef<CngxTabOverflowTriggerContext>;
|
|
353
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTabOverflowTrigger, never>;
|
|
354
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTabOverflowTrigger, "ng-template[cngxTabOverflowTrigger]", ["cngxTabOverflowTrigger"], {}, {}, never, never, true, never>;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Context for the `*cngxTabBusySpinner` template. Renders only on
|
|
359
|
+
* the in-flight commit target (matches `presenter.intendedIndex()`
|
|
360
|
+
* with `commitState.status() === 'pending'`); the visibility gate
|
|
361
|
+
* stays library-owned. `intendedIndex` is exposed so positional
|
|
362
|
+
* variants (progress bars, step counters) read the same source.
|
|
363
|
+
*/
|
|
364
|
+
interface CngxTabBusySpinnerContext {
|
|
365
|
+
/** The tab handle carrying id / label / disabled / aggregator signals. */
|
|
366
|
+
readonly tab: CngxTabHandle;
|
|
367
|
+
/** The flat-index of the in-flight commit target. */
|
|
368
|
+
readonly intendedIndex: number;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Structural slot for the busy-spinner template. 3-stage cascade:
|
|
372
|
+
* per-instance directive >
|
|
373
|
+
* `CNGX_TABS_CONFIG.templates.busySpinner` > built-in pulse span.
|
|
374
|
+
*
|
|
375
|
+
* ```html
|
|
376
|
+
* <cngx-tab-group>
|
|
377
|
+
* <ng-template cngxTabBusySpinner>
|
|
378
|
+
* <my-spinner size="sm" />
|
|
379
|
+
* </ng-template>
|
|
380
|
+
* </cngx-tab-group>
|
|
381
|
+
* ```
|
|
382
|
+
*/
|
|
383
|
+
declare class CngxTabBusySpinner {
|
|
384
|
+
readonly templateRef: TemplateRef<CngxTabBusySpinnerContext>;
|
|
385
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTabBusySpinner, never>;
|
|
386
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTabBusySpinner, "ng-template[cngxTabBusySpinner]", ["cngxTabBusySpinner"], {}, {}, never, never, true, never>;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* Context for the `*cngxTabErrorBadge` template. Renders only when
|
|
391
|
+
* the tab's `errorAggregator?.shouldShow()` is `true`; the visibility
|
|
392
|
+
* gate stays library-owned. Sibling shape to `CngxStepBadgeContext`.
|
|
393
|
+
*/
|
|
394
|
+
interface CngxTabErrorBadgeContext {
|
|
395
|
+
/** The tab handle carrying id / label / disabled / aggregator signals. */
|
|
396
|
+
readonly tab: CngxTabHandle;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Structural slot for the error-badge template. 3-stage cascade:
|
|
400
|
+
* per-instance directive >
|
|
401
|
+
* `CNGX_TABS_CONFIG.templates.errorBadge` >
|
|
402
|
+
* `CNGX_TABS_GLYPHS.errorBadge`.
|
|
403
|
+
*
|
|
404
|
+
* ```html
|
|
405
|
+
* <cngx-tab-group>
|
|
406
|
+
* <ng-template cngxTabErrorBadge let-tab="tab">
|
|
407
|
+
* <span class="my-badge-pill">
|
|
408
|
+
* {{ tab.errorAggregator()?.count() }}
|
|
409
|
+
* </span>
|
|
410
|
+
* </ng-template>
|
|
411
|
+
* </cngx-tab-group>
|
|
412
|
+
* ```
|
|
413
|
+
*/
|
|
414
|
+
declare class CngxTabErrorBadge {
|
|
415
|
+
readonly templateRef: TemplateRef<CngxTabErrorBadgeContext>;
|
|
416
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTabErrorBadge, never>;
|
|
417
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTabErrorBadge, "ng-template[cngxTabErrorBadge]", ["cngxTabErrorBadge"], {}, {}, never, never, true, never>;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Context for the `*cngxTabRejectionIcon` template. Renders only on
|
|
422
|
+
* the tab matching `presenter.lastFailedIndex()`; the visibility
|
|
423
|
+
* gate stays library-owned. `originLabel` is the safe-harbour tab,
|
|
424
|
+
* derived from `presenter.originIndexDuringCommit()` — `undefined`
|
|
425
|
+
* for the synchronous-rejection edge case. Sibling shape to
|
|
426
|
+
* `CngxStepRejectionContext`.
|
|
427
|
+
*/
|
|
428
|
+
interface CngxTabRejectionIconContext {
|
|
429
|
+
/** Flat-index of the rejected tab (`presenter.lastFailedIndex()`). */
|
|
430
|
+
readonly failedIndex: number;
|
|
431
|
+
/** Resolved label of the safe-harbour tab, when derivable. */
|
|
432
|
+
readonly originLabel: string | undefined;
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Structural slot for the rejection-decoration template. 3-stage
|
|
436
|
+
* cascade: per-instance directive >
|
|
437
|
+
* `CNGX_TABS_CONFIG.templates.rejectionIcon` >
|
|
438
|
+
* `CNGX_TABS_GLYPHS.rejectionIcon`.
|
|
439
|
+
*
|
|
440
|
+
* ```html
|
|
441
|
+
* <cngx-tab-group>
|
|
442
|
+
* <ng-template
|
|
443
|
+
* cngxTabRejectionIcon
|
|
444
|
+
* let-failedIndex="failedIndex"
|
|
445
|
+
* let-originLabel="originLabel"
|
|
446
|
+
* >
|
|
447
|
+
* <my-icon name="rollback" />
|
|
448
|
+
* @if (originLabel) {
|
|
449
|
+
* <span class="cngx-sr-only">Rolled back to {{ originLabel }}</span>
|
|
450
|
+
* }
|
|
451
|
+
* </ng-template>
|
|
452
|
+
* </cngx-tab-group>
|
|
453
|
+
* ```
|
|
454
|
+
*/
|
|
455
|
+
declare class CngxTabRejectionIcon {
|
|
456
|
+
readonly templateRef: TemplateRef<CngxTabRejectionIconContext>;
|
|
457
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CngxTabRejectionIcon, never>;
|
|
458
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<CngxTabRejectionIcon, "ng-template[cngxTabRejectionIcon]", ["cngxTabRejectionIcon"], {}, {}, never, never, true, never>;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Aria-label overrides for the tab-group landmark region. Library
|
|
463
|
+
* defaults are English; consumers override via
|
|
464
|
+
* {@link withTabsAriaLabels}.
|
|
465
|
+
*
|
|
466
|
+
* Per-tab nav phrasing (`previousTab`, `nextTab`) lives in
|
|
467
|
+
* {@link CngxTabsI18n}, not here — landmark naming and SR phrasing
|
|
468
|
+
* stay on separate override paths.
|
|
469
|
+
*/
|
|
470
|
+
interface CngxTabsAriaLabels {
|
|
471
|
+
readonly tabsRegion?: string;
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Fallback labels for derived strings (role descriptions, badge SR
|
|
475
|
+
* announcements). Library defaults are English; consumers override
|
|
476
|
+
* per locale.
|
|
477
|
+
*/
|
|
478
|
+
interface CngxTabsFallbackLabels {
|
|
479
|
+
readonly tabRoleDescription?: string;
|
|
480
|
+
readonly tabPanelRoleDescription?: string;
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* App-wide template overrides for `<cngx-tab-group>` and
|
|
484
|
+
* `<cngx-tab-overflow>` skin regions. Middle tier of the 3-stage
|
|
485
|
+
* cascade — per-instance directive > this field > built-in markup.
|
|
486
|
+
* Apply via the matching `with*Template` builders. Shape mirrors
|
|
487
|
+
* `CngxStepperTemplates` so consumer templates port across
|
|
488
|
+
* families.
|
|
489
|
+
*/
|
|
490
|
+
interface CngxTabsTemplates {
|
|
491
|
+
readonly overflowTrigger?: TemplateRef<CngxTabOverflowTriggerContext>;
|
|
492
|
+
readonly overflowItem?: TemplateRef<CngxTabOverflowItemContext>;
|
|
493
|
+
readonly errorBadge?: TemplateRef<CngxTabErrorBadgeContext>;
|
|
494
|
+
readonly rejectionIcon?: TemplateRef<CngxTabRejectionIconContext>;
|
|
495
|
+
readonly busySpinner?: TemplateRef<CngxTabBusySpinnerContext>;
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* Tab-group config surface. Resolution priority: per-instance Input
|
|
499
|
+
* → `provideTabsConfigAt` (viewProviders) → `provideTabsConfig`
|
|
500
|
+
* (root) → library default.
|
|
501
|
+
*/
|
|
502
|
+
interface CngxTabsConfig {
|
|
503
|
+
readonly defaultOrientation?: 'horizontal' | 'vertical';
|
|
504
|
+
readonly defaultLoop?: boolean;
|
|
505
|
+
readonly defaultCommitMode?: 'optimistic' | 'pessimistic';
|
|
506
|
+
readonly routerSyncMode?: 'fragment' | 'queryParam';
|
|
507
|
+
readonly routerSyncParam?: string;
|
|
508
|
+
readonly ariaLabels?: CngxTabsAriaLabels;
|
|
509
|
+
readonly fallbackLabels?: CngxTabsFallbackLabels;
|
|
510
|
+
/**
|
|
511
|
+
* Quiescence window (ms) for the overflow IO debounce. Burst
|
|
512
|
+
* emissions during strip animations collapse to one write; the
|
|
513
|
+
* More counter re-renders once IO has been quiet this long.
|
|
514
|
+
* Default 100ms. Capped by {@link overflowMaxDeferMs}.
|
|
515
|
+
*/
|
|
516
|
+
readonly overflowStabilizeMs?: number;
|
|
517
|
+
/**
|
|
518
|
+
* Hard ceiling (ms) on commit deferral while IO bursts keep
|
|
519
|
+
* arriving — without it, sustained churn (momentum scroll,
|
|
520
|
+
* continuous resize) would clear the stabilize timer forever and
|
|
521
|
+
* the More counter would freeze on a stale value, breaking
|
|
522
|
+
* Pillar 2. Default 250ms.
|
|
523
|
+
*/
|
|
524
|
+
readonly overflowMaxDeferMs?: number;
|
|
525
|
+
/**
|
|
526
|
+
* App-wide template overrides for `<cngx-tab-overflow>` regions.
|
|
527
|
+
* Middle tier of the family-standard 3-stage cascade. See
|
|
528
|
+
* {@link CngxTabsTemplates}.
|
|
529
|
+
*/
|
|
530
|
+
readonly templates?: CngxTabsTemplates;
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* DI token for the resolved tabs config. `providedIn: 'root'` with
|
|
534
|
+
* the library defaults; override via {@link provideTabsConfig}
|
|
535
|
+
* (root) or {@link provideTabsConfigAt} (component scope).
|
|
536
|
+
*/
|
|
537
|
+
declare const CNGX_TABS_CONFIG: InjectionToken<CngxTabsConfig>;
|
|
538
|
+
/**
|
|
539
|
+
* Feature signature for `with*` config builders. The hidden
|
|
540
|
+
* `_target` discriminator lets {@link provideCngxTabs} dispatch
|
|
541
|
+
* config features to {@link provideTabsConfig} while i18n features
|
|
542
|
+
* route to {@link provideTabsI18n}.
|
|
543
|
+
*/
|
|
544
|
+
type CngxTabsConfigFeature = ((config: CngxTabsConfig) => CngxTabsConfig) & {
|
|
545
|
+
readonly _target: 'config';
|
|
546
|
+
};
|
|
547
|
+
/**
|
|
548
|
+
* Override the default orientation. Per-instance `[orientation]`
|
|
549
|
+
* still wins; this changes the cascade default only.
|
|
550
|
+
*/
|
|
551
|
+
declare function withTabsDefaultOrientation(orientation: 'horizontal' | 'vertical'): CngxTabsConfigFeature;
|
|
552
|
+
/**
|
|
553
|
+
* @deprecated Use {@link withTabsDefaultOrientation}. The unprefixed name
|
|
554
|
+
* collides with the stepper family's identical symbol when both libs
|
|
555
|
+
* are auto-imported. The alias stays for one minor release before
|
|
556
|
+
* removal.
|
|
557
|
+
*/
|
|
558
|
+
declare const withDefaultOrientation: typeof withTabsDefaultOrientation;
|
|
559
|
+
/**
|
|
560
|
+
* Override whether roving-tabindex navigation loops from last back to
|
|
561
|
+
* first (and vice versa). Per-instance `[loop]` Input still wins.
|
|
562
|
+
*/
|
|
563
|
+
declare function withTabsRovingLoop(loop: boolean): CngxTabsConfigFeature;
|
|
564
|
+
/**
|
|
565
|
+
* Override the default commit mode for async tab transitions.
|
|
566
|
+
* `'optimistic'` activates the tab on action dispatch and rolls back
|
|
567
|
+
* on error; `'pessimistic'` waits for success. Per-instance
|
|
568
|
+
* `[commitMode]` Input still wins.
|
|
569
|
+
*/
|
|
570
|
+
declare function withTabsCommitMode(mode: 'optimistic' | 'pessimistic'): CngxTabsConfigFeature;
|
|
571
|
+
/**
|
|
572
|
+
* Configure router synchronisation for the active tab. `mode` chooses
|
|
573
|
+
* the URL surface (URL fragment or query parameter); `param` names
|
|
574
|
+
* the key (default `'tab'`).
|
|
575
|
+
*/
|
|
576
|
+
declare function withTabsRouterSync(mode: 'fragment' | 'queryParam', param?: string): CngxTabsConfigFeature;
|
|
577
|
+
/**
|
|
578
|
+
* Merge ARIA labels into the cascade. Keys not provided keep their
|
|
579
|
+
* library defaults; per-instance overrides on the tab group still win.
|
|
580
|
+
*/
|
|
581
|
+
declare function withTabsAriaLabels(labels: CngxTabsAriaLabels): CngxTabsConfigFeature;
|
|
582
|
+
/**
|
|
583
|
+
* Merge text fallback labels (overflow trigger, busy / rejection text)
|
|
584
|
+
* into the cascade. Used when a slot directive is not present.
|
|
585
|
+
*/
|
|
586
|
+
declare function withTabsFallbackLabels(labels: CngxTabsFallbackLabels): CngxTabsConfigFeature;
|
|
587
|
+
/**
|
|
588
|
+
* Override the IO-debounce window (ms). See
|
|
589
|
+
* {@link CngxTabsConfig.overflowStabilizeMs}.
|
|
590
|
+
*/
|
|
591
|
+
declare function withTabOverflowStabilizeMs(ms: number): CngxTabsConfigFeature;
|
|
592
|
+
/**
|
|
593
|
+
* Override the worst-case staleness ceiling on the visibility-map
|
|
594
|
+
* commit. See {@link CngxTabsConfig.overflowMaxDeferMs}.
|
|
595
|
+
*/
|
|
596
|
+
declare function withTabOverflowMaxDeferMs(ms: number): CngxTabsConfigFeature;
|
|
597
|
+
/**
|
|
598
|
+
* App-wide override for the More-button label. Middle tier;
|
|
599
|
+
* per-instance `*cngxTabOverflowTrigger` still wins.
|
|
600
|
+
*
|
|
601
|
+
* ```ts
|
|
602
|
+
* @ViewChild('moreTrigger', { static: true, read: TemplateRef })
|
|
603
|
+
* moreTrigger!: TemplateRef<CngxTabOverflowTriggerContext>;
|
|
604
|
+
*
|
|
605
|
+
* providers: [provideTabsConfig(withTabOverflowTriggerTemplate(this.moreTrigger))]
|
|
606
|
+
* ```
|
|
607
|
+
*/
|
|
608
|
+
declare function withTabOverflowTriggerTemplate(template: TemplateRef<CngxTabOverflowTriggerContext>): CngxTabsConfigFeature;
|
|
609
|
+
/**
|
|
610
|
+
* App-wide override for each row inside the overflow popover.
|
|
611
|
+
* Middle tier; per-instance `*cngxTabOverflowItem` still wins.
|
|
612
|
+
*/
|
|
613
|
+
declare function withTabOverflowItemTemplate(template: TemplateRef<CngxTabOverflowItemContext>): CngxTabsConfigFeature;
|
|
614
|
+
/**
|
|
615
|
+
* App-wide override for the error-badge decoration. Middle tier;
|
|
616
|
+
* per-instance `*cngxTabErrorBadge` still wins. Sibling of the
|
|
617
|
+
* stepper family's `withStepBadgeTemplate`.
|
|
618
|
+
*/
|
|
619
|
+
declare function withTabErrorBadgeTemplate(template: TemplateRef<CngxTabErrorBadgeContext>): CngxTabsConfigFeature;
|
|
620
|
+
/**
|
|
621
|
+
* App-wide override for the rejection-icon decoration. Middle
|
|
622
|
+
* tier; per-instance `*cngxTabRejectionIcon` still wins. Sibling
|
|
623
|
+
* of {@link withStepRejectionTemplate}.
|
|
624
|
+
*/
|
|
625
|
+
declare function withTabRejectionIconTemplate(template: TemplateRef<CngxTabRejectionIconContext>): CngxTabsConfigFeature;
|
|
626
|
+
/**
|
|
627
|
+
* App-wide override for the commit-pending busy-spinner overlay.
|
|
628
|
+
* Middle tier; per-instance `*cngxTabBusySpinner` still wins.
|
|
629
|
+
* Sibling of {@link withStepBusySpinnerTemplate}.
|
|
630
|
+
*/
|
|
631
|
+
declare function withTabBusySpinnerTemplate(template: TemplateRef<CngxTabBusySpinnerContext>): CngxTabsConfigFeature;
|
|
632
|
+
/**
|
|
633
|
+
* Root-level provider. Apply once in `bootstrapApplication` /
|
|
634
|
+
* `appConfig.providers`. Returns {@link EnvironmentProviders} per
|
|
635
|
+
* the canonical cngx config-cascade signature.
|
|
636
|
+
*/
|
|
637
|
+
declare function provideTabsConfig(...features: readonly CngxTabsConfigFeature[]): EnvironmentProviders;
|
|
638
|
+
/**
|
|
639
|
+
* Component-scoped override. Returns `Provider[]` (not
|
|
640
|
+
* {@link EnvironmentProviders}) because `viewProviders` rejects
|
|
641
|
+
* opaque environment providers. Resolution priority: per-instance
|
|
642
|
+
* Input > viewProviders (`At`) > root > default.
|
|
643
|
+
*
|
|
644
|
+
* ```ts
|
|
645
|
+
* @Component({
|
|
646
|
+
* viewProviders: [...provideTabsConfigAt(withTabsDefaultOrientation('vertical'))],
|
|
647
|
+
* })
|
|
648
|
+
* ```
|
|
649
|
+
*/
|
|
650
|
+
declare function provideTabsConfigAt(...features: readonly CngxTabsConfigFeature[]): Provider[];
|
|
651
|
+
/**
|
|
652
|
+
* Inject the resolved tabs config in an injection context.
|
|
653
|
+
*/
|
|
654
|
+
declare function injectTabsConfig(): CngxTabsConfig;
|
|
655
|
+
|
|
656
|
+
/**
|
|
657
|
+
* Tabs i18n surface. Library defaults are English; consumers
|
|
658
|
+
* override via {@link provideTabsI18n}. Sibling to
|
|
659
|
+
* `CNGX_STEPPER_I18N` and `CNGX_CHART_I18N`.
|
|
660
|
+
*/
|
|
661
|
+
interface CngxTabsI18n {
|
|
662
|
+
readonly tabsLabel: string;
|
|
663
|
+
readonly selectedTab: (label: string, position: number, count: number) => string;
|
|
664
|
+
readonly tabHasErrors: (count: number) => string;
|
|
665
|
+
readonly moreTabsLabel: (count: number) => string;
|
|
666
|
+
readonly previousTab: string;
|
|
667
|
+
readonly nextTab: string;
|
|
668
|
+
/**
|
|
669
|
+
* @deprecated Superseded by {@link commitRolledBackTo}. Retained as
|
|
670
|
+
* the defensive fallback in `liveAnnouncement` when the origin
|
|
671
|
+
* label is unresolvable — fires for unlabeled tabs or programmatic
|
|
672
|
+
* `commitState` writes that bypass `select()`. See
|
|
673
|
+
* `tabs-accepted-debt §4`.
|
|
674
|
+
*/
|
|
675
|
+
readonly commitFailedRetry: string;
|
|
676
|
+
readonly commitInFlight: string;
|
|
677
|
+
/**
|
|
678
|
+
* Origin-aware rollback announcement. Receives the safe-harbour
|
|
679
|
+
* tab label and yields the rollback phrase. Read on the
|
|
680
|
+
* `pending → error` transition when both `lastFailedIndex` and
|
|
681
|
+
* `originIndexDuringCommit` are set.
|
|
682
|
+
*/
|
|
683
|
+
readonly commitRolledBackTo: (originLabel: string) => string;
|
|
684
|
+
}
|
|
685
|
+
/**
|
|
686
|
+
* DI token for the tabs i18n bundle. `providedIn: 'root'` with
|
|
687
|
+
* English defaults.
|
|
688
|
+
*/
|
|
689
|
+
declare const CNGX_TABS_I18N: InjectionToken<CngxTabsI18n>;
|
|
690
|
+
/**
|
|
691
|
+
* Branded feature-fn for {@link provideTabsI18n} and
|
|
692
|
+
* {@link provideCngxTabs}. The hidden `_target` discriminator routes
|
|
693
|
+
* i18n features to `provideTabsI18n` and config features to
|
|
694
|
+
* `provideTabsConfig` from the unified aggregator.
|
|
695
|
+
*/
|
|
696
|
+
type CngxTabsI18nFeature = ((bundle: CngxTabsI18n) => CngxTabsI18n) & {
|
|
697
|
+
readonly _target: 'i18n';
|
|
698
|
+
};
|
|
699
|
+
/**
|
|
700
|
+
* Override i18n labels via a partial bundle — unset keys keep the
|
|
701
|
+
* English default. Same shape as `withTabsAriaLabels` /
|
|
702
|
+
* `withTabsFallbackLabels` so `provideCngxTabs` composes both
|
|
703
|
+
* surfaces uniformly.
|
|
704
|
+
*/
|
|
705
|
+
declare function withTabsI18nLabels(overrides: Partial<CngxTabsI18n>): CngxTabsI18nFeature;
|
|
706
|
+
/**
|
|
707
|
+
* Provider for the tabs i18n bundle. Compose `withTabsI18nLabels(...)`
|
|
708
|
+
* (and future i18n `with*` features); unset keys fall back to the
|
|
709
|
+
* English default.
|
|
710
|
+
*
|
|
711
|
+
* ```ts
|
|
712
|
+
* bootstrapApplication(AppComponent, {
|
|
713
|
+
* providers: [
|
|
714
|
+
* provideTabsI18n(
|
|
715
|
+
* withTabsI18nLabels({ tabsLabel: 'Reiter', previousTab: 'Vorheriger' }),
|
|
716
|
+
* ),
|
|
717
|
+
* ],
|
|
718
|
+
* });
|
|
719
|
+
* ```
|
|
720
|
+
*/
|
|
721
|
+
declare function provideTabsI18n(...features: readonly CngxTabsI18nFeature[]): Provider;
|
|
722
|
+
/**
|
|
723
|
+
* Inject the resolved tabs i18n bundle.
|
|
724
|
+
*/
|
|
725
|
+
declare function injectTabsI18n(): CngxTabsI18n;
|
|
726
|
+
|
|
727
|
+
/**
|
|
728
|
+
* Union of feature kinds the tabs aggregator accepts. Today: config
|
|
729
|
+
* + i18n; future surfaces widen the union and dispatch via the
|
|
730
|
+
* hidden `_target` discriminator.
|
|
731
|
+
*/
|
|
732
|
+
type CngxTabsFeature = CngxTabsConfigFeature | CngxTabsI18nFeature;
|
|
733
|
+
/**
|
|
734
|
+
* Unified aggregator for tabs configuration. Routes features by
|
|
735
|
+
* `_target` to {@link provideTabsConfig} and {@link provideTabsI18n}.
|
|
736
|
+
* Sibling to `provideCngxMenu` and `provideCngxSelect`; apply once in
|
|
737
|
+
* the app providers array. Returns {@link EnvironmentProviders}; for
|
|
738
|
+
* `viewProviders` use {@link provideCngxTabsAt} — opaque
|
|
739
|
+
* `EnvironmentProviders` cannot live there.
|
|
740
|
+
*
|
|
741
|
+
* ```ts
|
|
742
|
+
* bootstrapApplication(AppComponent, {
|
|
743
|
+
* providers: [
|
|
744
|
+
* provideCngxTabs(
|
|
745
|
+
* withTabsDefaultOrientation('vertical'),
|
|
746
|
+
* withTabsAriaLabels({ tabsRegion: 'Bereiche' }),
|
|
747
|
+
* withTabsI18nLabels({ tabsLabel: 'Bereiche', moreTabsLabel: (n) => `${n} mehr` }),
|
|
748
|
+
* withTabOverflowStabilizeMs(150),
|
|
749
|
+
* ),
|
|
750
|
+
* ],
|
|
751
|
+
* });
|
|
752
|
+
* ```
|
|
753
|
+
*/
|
|
754
|
+
declare function provideCngxTabs(...features: readonly CngxTabsFeature[]): EnvironmentProviders;
|
|
755
|
+
/**
|
|
756
|
+
* Component-scoped twin of {@link provideCngxTabs}. Returns
|
|
757
|
+
* `Provider[]` for `viewProviders`/`providers`; same dispatch
|
|
758
|
+
* semantics, different scope.
|
|
759
|
+
*
|
|
760
|
+
* ```ts
|
|
761
|
+
* @Component({
|
|
762
|
+
* viewProviders: [
|
|
763
|
+
* ...provideCngxTabsAt(
|
|
764
|
+
* withTabsDefaultOrientation('vertical'),
|
|
765
|
+
* withTabsI18nLabels({ tabsLabel: 'Bereiche' }),
|
|
766
|
+
* ),
|
|
767
|
+
* ],
|
|
768
|
+
* })
|
|
769
|
+
* ```
|
|
770
|
+
*/
|
|
771
|
+
declare function provideCngxTabsAt(...features: readonly CngxTabsFeature[]): Provider[];
|
|
772
|
+
|
|
773
|
+
/**
|
|
774
|
+
* Adapts the shared commit-controller to the tabs action shape. The
|
|
775
|
+
* presenter delegates to {@link beginTransition} when `commitAction`
|
|
776
|
+
* is bound.
|
|
777
|
+
*/
|
|
778
|
+
interface CngxTabsCommitHandler {
|
|
779
|
+
/**
|
|
780
|
+
* Start a tab-transition commit. Returns synchronously — read the
|
|
781
|
+
* controller's `state` signal for in-flight status. `onResolve`
|
|
782
|
+
* fires once with `accept = true` on success or `false` on
|
|
783
|
+
* rejection; skipped on supersede.
|
|
784
|
+
*/
|
|
785
|
+
beginTransition(fromIndex: number, toIndex: number, action: CngxTabsCommitAction, onResolve: (accept: boolean) => void): void;
|
|
786
|
+
/** Cancel the in-flight transition without firing callbacks. */
|
|
787
|
+
cancel(): void;
|
|
788
|
+
/** Live `pending` flag from the controller. */
|
|
789
|
+
readonly isCommitting: Signal<boolean>;
|
|
790
|
+
}
|
|
791
|
+
/**
|
|
792
|
+
* Options for {@link createTabsCommitHandler}.
|
|
793
|
+
*/
|
|
794
|
+
interface CngxTabsCommitHandlerOptions {
|
|
795
|
+
readonly controller: CngxCommitController<number>;
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* Wraps a {@link CngxCommitController} with the action-shape adapter
|
|
799
|
+
* that collapses `Observable<boolean>` / `Promise<boolean>` /
|
|
800
|
+
* `boolean` returns into a single `accept: boolean` outcome.
|
|
801
|
+
*/
|
|
802
|
+
declare function createTabsCommitHandler(opts: CngxTabsCommitHandlerOptions): CngxTabsCommitHandler;
|
|
803
|
+
/**
|
|
804
|
+
* Factory signature for {@link CNGX_TABS_COMMIT_HANDLER_FACTORY}.
|
|
805
|
+
* Override to wrap the default with retry-with-backoff, telemetry,
|
|
806
|
+
* or offline queues.
|
|
807
|
+
*/
|
|
808
|
+
type CngxTabsCommitHandlerFactory = (opts: CngxTabsCommitHandlerOptions) => CngxTabsCommitHandler;
|
|
809
|
+
/**
|
|
810
|
+
* DI token for the commit-handler factory. Defaults to
|
|
811
|
+
* {@link createTabsCommitHandler}. Sibling to
|
|
812
|
+
* `CNGX_ARRAY_COMMIT_HANDLER_FACTORY` (select) and
|
|
813
|
+
* `CNGX_STEPPER_COMMIT_HANDLER_FACTORY`.
|
|
814
|
+
*/
|
|
815
|
+
declare const CNGX_TABS_COMMIT_HANDLER_FACTORY: InjectionToken<CngxTabsCommitHandlerFactory>;
|
|
816
|
+
|
|
817
|
+
/**
|
|
818
|
+
* Resolves the DOM elements `<cngx-tab-overflow>` observes. cngx-native
|
|
819
|
+
* keys by `[id="${handle.id}-header"]`; the Material twin keys by
|
|
820
|
+
* positional index into `.mat-mdc-tab` (handle ids never appear on
|
|
821
|
+
* Material's rendered DOM). The molecule is variant-agnostic and
|
|
822
|
+
* consumes whichever adapter
|
|
823
|
+
* {@link CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY} provides.
|
|
824
|
+
*/
|
|
825
|
+
interface CngxTabOverflowDomAdapter {
|
|
826
|
+
/**
|
|
827
|
+
* Resolve the IntersectionObserver root — the scroll viewport the
|
|
828
|
+
* molecule observes. Returning `null` short-circuits the attach;
|
|
829
|
+
* the molecule's rAF retry loop polls again next frame.
|
|
830
|
+
*/
|
|
831
|
+
resolveStripRoot(panelHost: CngxTabPanelHost, host: HTMLElement): HTMLElement | null;
|
|
832
|
+
/**
|
|
833
|
+
* Resolve the rendered button for `handle` inside `root`. cngx-native
|
|
834
|
+
* keys by `handle.id`; Material adapters key by `idx`.
|
|
835
|
+
*/
|
|
836
|
+
resolveTabButton(handle: CngxTabHandle, root: HTMLElement, idx: number): HTMLElement | null;
|
|
837
|
+
}
|
|
838
|
+
/**
|
|
839
|
+
* Factory signature for {@link CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY}.
|
|
840
|
+
*/
|
|
841
|
+
type CngxTabOverflowDomAdapterFactory = () => CngxTabOverflowDomAdapter;
|
|
842
|
+
/**
|
|
843
|
+
* Default adapter for the cngx-native `<cngx-tab-group>` strip:
|
|
844
|
+
* walks `host.closest('.cngx-tabs__strip-wrapper')` for the IO root,
|
|
845
|
+
* then `[id="${handle.id}-header"]` for each button.
|
|
846
|
+
*/
|
|
847
|
+
declare function createCngxTabOverflowDefaultDomAdapter(): CngxTabOverflowDomAdapter;
|
|
848
|
+
/**
|
|
849
|
+
* DI token for the overflow molecule's DOM-resolution strategy.
|
|
850
|
+
* Override at directive `providers` or component `viewProviders` to
|
|
851
|
+
* swap in a Material, custom-skin, or test-double adapter without
|
|
852
|
+
* forking the molecule. Defaults to
|
|
853
|
+
* {@link createCngxTabOverflowDefaultDomAdapter}.
|
|
854
|
+
*/
|
|
855
|
+
declare const CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY: InjectionToken<CngxTabOverflowDomAdapterFactory>;
|
|
856
|
+
|
|
857
|
+
/**
|
|
858
|
+
* Outcome reported by an `attempt` callback. `true` halts the loop
|
|
859
|
+
* (success); `false` or `null` schedules another tick.
|
|
860
|
+
*/
|
|
861
|
+
type CngxDomAnchorRetryResult = true | false | null;
|
|
862
|
+
/**
|
|
863
|
+
* Configuration for {@link createDomAnchorRetry}.
|
|
864
|
+
*/
|
|
865
|
+
interface CngxDomAnchorRetryOptions {
|
|
866
|
+
/**
|
|
867
|
+
* Per-attempt callback. `true` halts; `false`/`null` schedules
|
|
868
|
+
* another attempt.
|
|
869
|
+
*/
|
|
870
|
+
readonly attempt: () => CngxDomAnchorRetryResult;
|
|
871
|
+
/**
|
|
872
|
+
* Cap on unsuccessful attempts before {@link onGiveUp} fires.
|
|
873
|
+
* The first synchronous call counts as attempt #1 — `5` permits
|
|
874
|
+
* four scheduled retries after the initial.
|
|
875
|
+
*/
|
|
876
|
+
readonly maxAttempts: number;
|
|
877
|
+
/**
|
|
878
|
+
* Schedules the next attempt (rAF / `afterNextRender` /
|
|
879
|
+
* `setTimeout` / `queueMicrotask`). Returns a cancellation
|
|
880
|
+
* closure — return a noop when the scheduler doesn't expose one.
|
|
881
|
+
*/
|
|
882
|
+
readonly schedule: (cb: () => void) => () => void;
|
|
883
|
+
/** Fires once after the `maxAttempts`-th unsuccessful attempt. */
|
|
884
|
+
readonly onGiveUp?: () => void;
|
|
885
|
+
}
|
|
886
|
+
/**
|
|
887
|
+
* Imperative handle returned by {@link createDomAnchorRetry}.
|
|
888
|
+
*/
|
|
889
|
+
interface CngxDomAnchorRetryHandle {
|
|
890
|
+
/** Begin (or restart) the retry loop. Resets the attempt counter. */
|
|
891
|
+
start(): void;
|
|
892
|
+
/** Stop the retry loop and cancel any pending scheduled attempt. */
|
|
893
|
+
cancel(): void;
|
|
894
|
+
}
|
|
895
|
+
/**
|
|
896
|
+
* Bounded retry loop for DOM-anchoring patterns — shared
|
|
897
|
+
* attempt-counter + give-up + cancellation contract. Used by
|
|
898
|
+
* `<cngx-tab-overflow>`'s rAF strip-attach loop and `[cngxMatTabs]`'s
|
|
899
|
+
* `afterNextRender` header-anchor loop. Consumer-supplied scheduler
|
|
900
|
+
* lets different timing primitives flow through one counter.
|
|
901
|
+
*
|
|
902
|
+
* ```ts
|
|
903
|
+
* const retry = createDomAnchorRetry({
|
|
904
|
+
* attempt: () => {
|
|
905
|
+
* const root = host.closest('.strip-wrapper');
|
|
906
|
+
* if (!root) return null;
|
|
907
|
+
* observer.observe(root);
|
|
908
|
+
* return true;
|
|
909
|
+
* },
|
|
910
|
+
* maxAttempts: 60,
|
|
911
|
+
* schedule: (cb) => {
|
|
912
|
+
* const h = requestAnimationFrame(cb);
|
|
913
|
+
* return () => cancelAnimationFrame(h);
|
|
914
|
+
* },
|
|
915
|
+
* onGiveUp: () => console.warn('strip wrapper not found'),
|
|
916
|
+
* });
|
|
917
|
+
* afterNextRender(() => retry.start());
|
|
918
|
+
* destroyRef.onDestroy(() => retry.cancel());
|
|
919
|
+
* ```
|
|
920
|
+
*/
|
|
921
|
+
declare function createDomAnchorRetry(options: CngxDomAnchorRetryOptions): CngxDomAnchorRetryHandle;
|
|
922
|
+
/**
|
|
923
|
+
* Factory signature for {@link CNGX_DOM_ANCHOR_RETRY_FACTORY} —
|
|
924
|
+
* matches {@link createDomAnchorRetry} for drop-in overrides.
|
|
925
|
+
*/
|
|
926
|
+
type CngxDomAnchorRetryFactory = (options: CngxDomAnchorRetryOptions) => CngxDomAnchorRetryHandle;
|
|
927
|
+
/**
|
|
928
|
+
* DI token for the DOM-anchor retry policy. Default
|
|
929
|
+
* {@link createDomAnchorRetry}. Two real consumers today —
|
|
930
|
+
* `<cngx-tab-overflow>`'s rAF strip-attach loop and
|
|
931
|
+
* `[cngxMatTabs]`'s `afterNextRender` header-anchor loop. Override
|
|
932
|
+
* via `providers` / `viewProviders` for retry-with-backoff,
|
|
933
|
+
* telemetry on give-up, etc. Symmetric to
|
|
934
|
+
* `CNGX_OVERFLOW_POPOVER_HIGHLIGHT_FACTORY`,
|
|
935
|
+
* `CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY`, and
|
|
936
|
+
* `CNGX_TABS_COMMIT_HANDLER_FACTORY`.
|
|
937
|
+
*/
|
|
938
|
+
declare const CNGX_DOM_ANCHOR_RETRY_FACTORY: InjectionToken<CngxDomAnchorRetryFactory>;
|
|
939
|
+
|
|
940
|
+
/**
|
|
941
|
+
* Inputs to {@link createTabGroupTemplateBindings}. The organism owns
|
|
942
|
+
* the `contentChild()` queries (NG8110 — must run in component
|
|
943
|
+
* injection context) and the resolved {@link CngxTabsConfig}; the
|
|
944
|
+
* factory runs the 3-stage cascade per slot key. Sibling shape to
|
|
945
|
+
* `createStepperTemplateBindings`.
|
|
946
|
+
*/
|
|
947
|
+
interface CngxTabGroupTemplateBindingsOptions {
|
|
948
|
+
readonly errorBadgeSlot: Signal<CngxTabErrorBadge | undefined>;
|
|
949
|
+
readonly rejectionIconSlot: Signal<CngxTabRejectionIcon | undefined>;
|
|
950
|
+
readonly busySpinnerSlot: Signal<CngxTabBusySpinner | undefined>;
|
|
951
|
+
readonly config: CngxTabsConfig;
|
|
952
|
+
}
|
|
953
|
+
/**
|
|
954
|
+
* Output of {@link createTabGroupTemplateBindings}. One resolved
|
|
955
|
+
* `Signal<TemplateRef | null>` per slot; `null` means the organism
|
|
956
|
+
* renders its built-in default.
|
|
957
|
+
*/
|
|
958
|
+
interface CngxTabGroupTemplateBindings {
|
|
959
|
+
readonly errorBadge: Signal<TemplateRef<CngxTabErrorBadgeContext> | null>;
|
|
960
|
+
readonly rejectionIcon: Signal<TemplateRef<CngxTabRejectionIconContext> | null>;
|
|
961
|
+
readonly busySpinner: Signal<TemplateRef<CngxTabBusySpinnerContext> | null>;
|
|
962
|
+
}
|
|
963
|
+
/**
|
|
964
|
+
* Wires the 3-stage template cascade for the three `<cngx-tab-group>`
|
|
965
|
+
* skin slots:
|
|
966
|
+
* per-instance directive >
|
|
967
|
+
* `CNGX_TABS_CONFIG.templates.<key>` >
|
|
968
|
+
* `null` (built-in default).
|
|
969
|
+
*
|
|
970
|
+
* Pure — no DI, no side effects. Safe in field-init. Sibling to
|
|
971
|
+
* `createStepperTemplateBindings` and `createTabOverflowTemplateBindings`.
|
|
972
|
+
*
|
|
973
|
+
* Single-consumer today: `[cngxMatTabs]` does not consume this —
|
|
974
|
+
* Material owns the rendered tab-button chrome via its own MDC
|
|
975
|
+
* template, leaving no DOM seam. See `tabs-accepted-debt §9`.
|
|
976
|
+
*/
|
|
977
|
+
declare function createTabGroupTemplateBindings(opts: CngxTabGroupTemplateBindingsOptions): CngxTabGroupTemplateBindings;
|
|
978
|
+
|
|
979
|
+
/**
|
|
980
|
+
* Inputs the announcements bundle reads from the host organism.
|
|
981
|
+
* Passing presenter / i18n / config in (instead of re-injecting)
|
|
982
|
+
* keeps the factory pure — one call returns the bundle, no
|
|
983
|
+
* injection context required.
|
|
984
|
+
*/
|
|
985
|
+
interface CngxTabGroupAnnouncementsOptions {
|
|
986
|
+
readonly presenter: CngxTabGroupHost;
|
|
987
|
+
readonly i18n: CngxTabsI18n;
|
|
988
|
+
readonly config: CngxTabsConfig;
|
|
989
|
+
/** Per-instance `aria-label` Input on the organism. */
|
|
990
|
+
readonly ariaLabel: Signal<string | undefined>;
|
|
991
|
+
/** Per-instance `aria-labelledby` Input on the organism. */
|
|
992
|
+
readonly ariaLabelledBy: Signal<string | undefined>;
|
|
993
|
+
}
|
|
994
|
+
/**
|
|
995
|
+
* Resolved bundle returned by {@link createTabGroupAnnouncements}.
|
|
996
|
+
* Host bindings and template outlets read these directly. Owns one
|
|
997
|
+
* internal `linkedSignal` slot (prior-active-index tracker driving
|
|
998
|
+
* the success-arm direction prefix); consumers never touch it.
|
|
999
|
+
*/
|
|
1000
|
+
interface CngxTabGroupAnnouncements {
|
|
1001
|
+
/**
|
|
1002
|
+
* Tablist `aria-roledescription`. Cascades through
|
|
1003
|
+
* `CngxTabsFallbackLabels.tabRoleDescription` → `'tab list'`.
|
|
1004
|
+
* Distinct from `i18n.tabsLabel` (which feeds `aria-label`) so
|
|
1005
|
+
* AT does not read the same word twice.
|
|
1006
|
+
*/
|
|
1007
|
+
readonly tabsRoleDescription: Signal<string>;
|
|
1008
|
+
/**
|
|
1009
|
+
* Tab-panel `aria-roledescription`. Cascades through
|
|
1010
|
+
* `CngxTabsFallbackLabels.tabPanelRoleDescription` → `'tab panel'`.
|
|
1011
|
+
*/
|
|
1012
|
+
readonly tabPanelRoleDescription: Signal<string>;
|
|
1013
|
+
/**
|
|
1014
|
+
* Wrapper `aria-label`. Resolution: per-instance Input →
|
|
1015
|
+
* `ariaLabels.tabsRegion` → `i18n.tabsLabel`. Returns `null` when
|
|
1016
|
+
* `aria-labelledby` is bound (mutually exclusive per WAI-ARIA).
|
|
1017
|
+
*/
|
|
1018
|
+
readonly resolvedAriaLabel: Signal<string | null>;
|
|
1019
|
+
/**
|
|
1020
|
+
* Polite live-region content — declarative, never an imperative
|
|
1021
|
+
* `announce()`. Empty between transitions so the region stays
|
|
1022
|
+
* quiet on no-op ticks.
|
|
1023
|
+
*
|
|
1024
|
+
* Error arm: `commitRolledBackTo(originLabel)` when origin
|
|
1025
|
+
* resolves; otherwise `commitFailedRetry`.
|
|
1026
|
+
*
|
|
1027
|
+
* Success arm: `${previousTab|nextTab}: selectedTab(...)` when
|
|
1028
|
+
* the index moved; bare `selectedTab(...)` when it didn't (initial
|
|
1029
|
+
* mount, or commit-success that lands on the same tab).
|
|
1030
|
+
*/
|
|
1031
|
+
readonly liveAnnouncement: Signal<string>;
|
|
1032
|
+
/**
|
|
1033
|
+
* SR descriptor phrase for a tab's `cngx-sr-only` span.
|
|
1034
|
+
* `aggregator.announcement()` when bound + revealed; falls back
|
|
1035
|
+
* to `i18n.tabHasErrors(errorCount)` on empty; empty string when
|
|
1036
|
+
* nothing wants reveal. The span itself is always rendered (cngx
|
|
1037
|
+
* ARIA-by-value rule); this returns its content.
|
|
1038
|
+
*/
|
|
1039
|
+
statusPhrase(tab: CngxTabHandle): string;
|
|
1040
|
+
/**
|
|
1041
|
+
* Verbose tab-button `aria-label` — `selectedTab(label, position,
|
|
1042
|
+
* count)` so AT hears "Tab 2 of 5: Settings" instead of inferring
|
|
1043
|
+
* position from tablist enumeration. The visual span keeps the
|
|
1044
|
+
* bare label.
|
|
1045
|
+
*/
|
|
1046
|
+
tabAriaLabel(tab: CngxTabHandle, position: number): string;
|
|
1047
|
+
}
|
|
1048
|
+
/**
|
|
1049
|
+
* Pure factory bundling the `<cngx-tab-group>` AT-announcement +
|
|
1050
|
+
* descriptor surfaces. Owns one internal `linkedSignal`
|
|
1051
|
+
* (prior-active-index, drives the success-arm direction prefix) —
|
|
1052
|
+
* lazy by `linkedSignal` semantics, so the organism reads
|
|
1053
|
+
* `liveAnnouncement` once at construction to seed it.
|
|
1054
|
+
*/
|
|
1055
|
+
declare function createTabGroupAnnouncements(options: CngxTabGroupAnnouncementsOptions): CngxTabGroupAnnouncements;
|
|
1056
|
+
|
|
1057
|
+
/**
|
|
1058
|
+
* Default glyph fallbacks for `<cngx-tab-group>` skin slots. Read by
|
|
1059
|
+
* the organism when neither a per-instance slot directive nor
|
|
1060
|
+
* `CNGX_TABS_CONFIG.templates.<key>` is bound. Sibling to
|
|
1061
|
+
* `CNGX_SELECT_GLYPHS` and `CNGX_STEPPER_GLYPHS`. Exported because
|
|
1062
|
+
* Sheriff forbids deep-relative imports across library boundaries;
|
|
1063
|
+
* `@internal` enforces consumer intent. Consumers customise via slot
|
|
1064
|
+
* directives or `withTab*Template` config features.
|
|
1065
|
+
*
|
|
1066
|
+
* @internal
|
|
1067
|
+
*/
|
|
1068
|
+
declare const CNGX_TABS_GLYPHS: {
|
|
1069
|
+
/** Default visual for `*cngxTabErrorBadge` when no override is bound. */
|
|
1070
|
+
readonly errorBadge: "!";
|
|
1071
|
+
/** Default visual for `*cngxTabRejectionIcon` when no override is bound. */
|
|
1072
|
+
readonly rejectionIcon: "!";
|
|
1073
|
+
};
|
|
1074
|
+
|
|
1075
|
+
/**
|
|
1076
|
+
* DOM `id` for a hidden-tab option row in the overflow listbox.
|
|
1077
|
+
* Stable across CD passes so `aria-activedescendant` resolves to
|
|
1078
|
+
* the same `<li>`. `-overflow-option` suffix avoids collision with
|
|
1079
|
+
* the strip-button (`-header`) and per-tab descriptor (`-desc`).
|
|
1080
|
+
*/
|
|
1081
|
+
declare function tabOverflowOptionId(tab: CngxTabHandle): string;
|
|
1082
|
+
/**
|
|
1083
|
+
* Inputs to {@link createTabOverflowTemplateBindings}. The molecule
|
|
1084
|
+
* runs the `contentChild()` queries (injection-context-only) and
|
|
1085
|
+
* supplies the reactive sources; the factory owns cascade
|
|
1086
|
+
* resolution and per-context builders.
|
|
1087
|
+
*/
|
|
1088
|
+
interface CngxTabOverflowTemplateBindingsOptions {
|
|
1089
|
+
/** `contentChild(CngxTabOverflowTrigger)` from the molecule. */
|
|
1090
|
+
readonly triggerSlot: Signal<CngxTabOverflowTrigger | undefined>;
|
|
1091
|
+
/** `contentChild(CngxTabOverflowItem)` from the molecule. */
|
|
1092
|
+
readonly itemSlot: Signal<CngxTabOverflowItem | undefined>;
|
|
1093
|
+
/** Resolved {@link CngxTabsConfig} (the middle cascade tier). */
|
|
1094
|
+
readonly config: CngxTabsConfig;
|
|
1095
|
+
/** Live count of hidden tabs (drives `triggerContext.count`). */
|
|
1096
|
+
readonly hiddenCount: Signal<number>;
|
|
1097
|
+
/** Live hidden-tab list (drives `triggerContext.hiddenTabs`). */
|
|
1098
|
+
readonly hiddenTabs: Signal<readonly CngxTabHandle[]>;
|
|
1099
|
+
/** Commit-aware select callback — invoked from `itemContext.pick`. */
|
|
1100
|
+
readonly pickTab: (tab: CngxTabHandle) => void;
|
|
1101
|
+
}
|
|
1102
|
+
/**
|
|
1103
|
+
* Output of {@link createTabOverflowTemplateBindings}. Carries the two
|
|
1104
|
+
* resolved templates plus a stable trigger-context signal and an
|
|
1105
|
+
* imperative item-context builder.
|
|
1106
|
+
*/
|
|
1107
|
+
interface CngxTabOverflowTemplateBindings {
|
|
1108
|
+
readonly triggerTemplate: Signal<TemplateRef<CngxTabOverflowTriggerContext> | null>;
|
|
1109
|
+
readonly itemTemplate: Signal<TemplateRef<CngxTabOverflowItemContext> | null>;
|
|
1110
|
+
readonly triggerContext: Signal<CngxTabOverflowTriggerContext>;
|
|
1111
|
+
readonly buildItemContext: (tab: CngxTabHandle, index: number) => CngxTabOverflowItemContext;
|
|
1112
|
+
/**
|
|
1113
|
+
* `ActiveDescendantItem[]` projection of `hiddenTabs()` for
|
|
1114
|
+
* `CngxActiveDescendant.items`. Each entry's `id` matches the
|
|
1115
|
+
* row's `<li>` (see {@link tabOverflowOptionId}); `value` carries
|
|
1116
|
+
* the tab handle so AD's `(activated)` payload casts back without
|
|
1117
|
+
* a registry lookup. Structural equal guards against no-op IO
|
|
1118
|
+
* cascades. Mutable array shape because
|
|
1119
|
+
* `CngxActiveDescendant.items` declares the input that way; the
|
|
1120
|
+
* array is rebuilt each computed run so callers can't mutate the
|
|
1121
|
+
* live source.
|
|
1122
|
+
*/
|
|
1123
|
+
readonly adItems: Signal<ActiveDescendantItem[]>;
|
|
1124
|
+
}
|
|
1125
|
+
/**
|
|
1126
|
+
* Wires the 3-stage template cascade for the overflow molecule's
|
|
1127
|
+
* two visible regions: per-instance directive >
|
|
1128
|
+
* `CNGX_TABS_CONFIG.templates.overflow*` > built-in markup
|
|
1129
|
+
* (template-outlet returns `null`).
|
|
1130
|
+
*
|
|
1131
|
+
* Pure — no DI, no side effects, no destroy hooks. Safe to call
|
|
1132
|
+
* from a component's field-init block. Mirrors the select-family
|
|
1133
|
+
* `createTemplateRegistry` pattern.
|
|
1134
|
+
*/
|
|
1135
|
+
declare function createTabOverflowTemplateBindings(opts: CngxTabOverflowTemplateBindingsOptions): CngxTabOverflowTemplateBindings;
|
|
1136
|
+
/**
|
|
1137
|
+
* Resets the AD highlight on popover close. Keyboard-open paths
|
|
1138
|
+
* (ArrowDown / End / typeahead on the closed trigger) set
|
|
1139
|
+
* `activeIndex` via AD's own keydown listener before opening —
|
|
1140
|
+
* unaffected. Mouse-open leaves `activeIndex === -1` so the popover
|
|
1141
|
+
* renders unhighlighted. Without this reset, the next open would
|
|
1142
|
+
* inherit a stale index from the prior keyboard session.
|
|
1143
|
+
*
|
|
1144
|
+
* Must run in injection context.
|
|
1145
|
+
*/
|
|
1146
|
+
declare function createOverflowPopoverHighlightSync(popover: Signal<CngxPopover>, ad: Signal<CngxActiveDescendant>): void;
|
|
1147
|
+
/**
|
|
1148
|
+
* Factory signature for {@link CNGX_OVERFLOW_POPOVER_HIGHLIGHT_FACTORY}.
|
|
1149
|
+
*/
|
|
1150
|
+
type CngxOverflowPopoverHighlightSyncFactory = (popover: Signal<CngxPopover>, ad: Signal<CngxActiveDescendant>) => void;
|
|
1151
|
+
/**
|
|
1152
|
+
* DI token for the overflow popover highlight-sync policy.
|
|
1153
|
+
* Default {@link createOverflowPopoverHighlightSync}. Override via
|
|
1154
|
+
* `providers` / `viewProviders` for last-index preservation,
|
|
1155
|
+
* telemetry on close, custom highlight rules. Symmetric to
|
|
1156
|
+
* `CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY` and
|
|
1157
|
+
* `CNGX_TABS_COMMIT_HANDLER_FACTORY`.
|
|
1158
|
+
*/
|
|
1159
|
+
declare const CNGX_OVERFLOW_POPOVER_HIGHLIGHT_FACTORY: InjectionToken<CngxOverflowPopoverHighlightSyncFactory>;
|
|
1160
|
+
|
|
1161
|
+
/**
|
|
1162
|
+
* Options for {@link createOrganismScrollSync}.
|
|
1163
|
+
*/
|
|
1164
|
+
interface CngxOrganismScrollSyncOptions {
|
|
1165
|
+
/** Reactive source for the active item id; tracked by the effect. */
|
|
1166
|
+
readonly activeId: Signal<string | null>;
|
|
1167
|
+
/**
|
|
1168
|
+
* Host element containing the per-item buttons. Items must carry
|
|
1169
|
+
* `id="${itemId}-header"` — the convention used by
|
|
1170
|
+
* `<cngx-tab-group>` and `<cngx-stepper>`.
|
|
1171
|
+
*/
|
|
1172
|
+
readonly hostElement: HTMLElement;
|
|
1173
|
+
/**
|
|
1174
|
+
* Forwarded to `Element.scrollIntoView`. Default: smooth-center
|
|
1175
|
+
* along the inline axis. Override for vertical or instant scroll.
|
|
1176
|
+
*/
|
|
1177
|
+
readonly scrollOptions?: ScrollIntoViewOptions;
|
|
1178
|
+
/** Injector for installing the effect. */
|
|
1179
|
+
readonly injector: Injector;
|
|
1180
|
+
}
|
|
1181
|
+
/**
|
|
1182
|
+
* Scroll-into-view effect for any strip-based organism (tabs,
|
|
1183
|
+
* stepper headers, future scrolling lists). Tracks `activeId` and
|
|
1184
|
+
* scrolls the matching `[id="<itemId>-header"]` into view.
|
|
1185
|
+
*
|
|
1186
|
+
* The DOM call sits in `untracked()` (only `activeId` is tracked).
|
|
1187
|
+
* `scrollIntoView` is missing in jsdom — guarded with optional chain.
|
|
1188
|
+
*/
|
|
1189
|
+
declare function createOrganismScrollSync(opts: CngxOrganismScrollSyncOptions): void;
|
|
1190
|
+
/**
|
|
1191
|
+
* Factory signature for {@link CNGX_ORGANISM_SCROLL_SYNC_FACTORY}.
|
|
1192
|
+
*/
|
|
1193
|
+
type CngxOrganismScrollSyncFactory = (opts: CngxOrganismScrollSyncOptions) => void;
|
|
1194
|
+
/**
|
|
1195
|
+
* DI token for the active-item scroll-into-view policy. Defaults to
|
|
1196
|
+
* {@link createOrganismScrollSync}. Override for instant scroll,
|
|
1197
|
+
* custom selector, telemetry, or `prefers-reduced-motion` opt-out.
|
|
1198
|
+
* Sibling to `CNGX_DOM_ANCHOR_RETRY_FACTORY` and
|
|
1199
|
+
* `CNGX_OVERFLOW_POPOVER_HIGHLIGHT_FACTORY`.
|
|
1200
|
+
*/
|
|
1201
|
+
declare const CNGX_ORGANISM_SCROLL_SYNC_FACTORY: InjectionToken<CngxOrganismScrollSyncFactory>;
|
|
1202
|
+
|
|
1203
|
+
/**
|
|
1204
|
+
* Options for {@link createDirectiveByIdMap}.
|
|
1205
|
+
*/
|
|
1206
|
+
interface CngxDirectiveByIdMapOptions<T extends {
|
|
1207
|
+
id: () => string;
|
|
1208
|
+
}> {
|
|
1209
|
+
/** Reactive source — typically `contentChildren(...)`. */
|
|
1210
|
+
readonly source: Signal<readonly T[]>;
|
|
1211
|
+
}
|
|
1212
|
+
/**
|
|
1213
|
+
* Build a `Signal<Map<string, T>>` from a `Signal<readonly T[]>` of
|
|
1214
|
+
* directives keyed by `id()`. Structural equal prevents cascade when
|
|
1215
|
+
* `contentChildren` re-emits an unchanged child set. Shared by
|
|
1216
|
+
* `<cngx-tab-group>`, `<cngx-stepper>`, and `<cngx-mat-stepper>`.
|
|
1217
|
+
*/
|
|
1218
|
+
declare function createDirectiveByIdMap<T extends {
|
|
1219
|
+
id: () => string;
|
|
1220
|
+
}>(opts: CngxDirectiveByIdMapOptions<T>): Signal<Map<string, T>>;
|
|
1221
|
+
/**
|
|
1222
|
+
* Factory signature for {@link CNGX_DIRECTIVE_BY_ID_MAP_FACTORY}.
|
|
1223
|
+
*/
|
|
1224
|
+
type CngxDirectiveByIdMapFactory = <T extends {
|
|
1225
|
+
id: () => string;
|
|
1226
|
+
}>(opts: CngxDirectiveByIdMapOptions<T>) => Signal<Map<string, T>>;
|
|
1227
|
+
/**
|
|
1228
|
+
* DI token for the per-id directive-resolution policy. Defaults to
|
|
1229
|
+
* {@link createDirectiveByIdMap}. Override for WeakMap resolution,
|
|
1230
|
+
* telemetry, or custom equality. Sibling to
|
|
1231
|
+
* `CNGX_DOM_ANCHOR_RETRY_FACTORY` and
|
|
1232
|
+
* `CNGX_ORGANISM_SCROLL_SYNC_FACTORY`.
|
|
1233
|
+
*/
|
|
1234
|
+
declare const CNGX_DIRECTIVE_BY_ID_MAP_FACTORY: InjectionToken<CngxDirectiveByIdMapFactory>;
|
|
1235
|
+
|
|
1236
|
+
export { CNGX_DIRECTIVE_BY_ID_MAP_FACTORY, CNGX_DOM_ANCHOR_RETRY_FACTORY, CNGX_ORGANISM_SCROLL_SYNC_FACTORY, CNGX_OVERFLOW_POPOVER_HIGHLIGHT_FACTORY, CNGX_TABS_COMMIT_HANDLER_FACTORY, CNGX_TABS_CONFIG, CNGX_TABS_GLYPHS, CNGX_TABS_I18N, CNGX_TAB_GROUP_HOST, CNGX_TAB_OVERFLOW_DOM_ADAPTER_FACTORY, CNGX_TAB_PANEL_HOST, CngxTab, CngxTabBusySpinner, CngxTabContent, CngxTabErrorBadge, CngxTabGroupPresenter, CngxTabLabel, CngxTabOverflowItem, CngxTabOverflowTrigger, CngxTabRejectionIcon, CngxTabsFragmentSync, createCngxTabOverflowDefaultDomAdapter, createDirectiveByIdMap, createDomAnchorRetry, createOrganismScrollSync, createOverflowPopoverHighlightSync, createTabGroupAnnouncements, createTabGroupTemplateBindings, createTabOverflowTemplateBindings, createTabsCommitHandler, injectTabsConfig, injectTabsI18n, provideCngxTabs, provideCngxTabsAt, provideTabsConfig, provideTabsConfigAt, provideTabsI18n, tabOverflowOptionId, withDefaultOrientation, withTabBusySpinnerTemplate, withTabErrorBadgeTemplate, withTabOverflowItemTemplate, withTabOverflowMaxDeferMs, withTabOverflowStabilizeMs, withTabOverflowTriggerTemplate, withTabRejectionIconTemplate, withTabsAriaLabels, withTabsCommitMode, withTabsDefaultOrientation, withTabsFallbackLabels, withTabsI18nLabels, withTabsRouterSync, withTabsRovingLoop };
|
|
1237
|
+
export type { CngxDirectiveByIdMapFactory, CngxDirectiveByIdMapOptions, CngxDomAnchorRetryFactory, CngxDomAnchorRetryHandle, CngxDomAnchorRetryOptions, CngxDomAnchorRetryResult, CngxOrganismScrollSyncFactory, CngxOrganismScrollSyncOptions, CngxOverflowPopoverHighlightSyncFactory, CngxTabBusySpinnerContext, CngxTabErrorBadgeContext, CngxTabGroupAnnouncements, CngxTabGroupAnnouncementsOptions, CngxTabGroupHost, CngxTabGroupTemplateBindings, CngxTabGroupTemplateBindingsOptions, CngxTabHandle, CngxTabOverflowDomAdapter, CngxTabOverflowDomAdapterFactory, CngxTabOverflowItemContext, CngxTabOverflowTemplateBindings, CngxTabOverflowTemplateBindingsOptions, CngxTabOverflowTriggerContext, CngxTabPanelHost, CngxTabRejectionIconContext, CngxTabsAriaLabels, CngxTabsCommitAction, CngxTabsCommitHandler, CngxTabsCommitHandlerFactory, CngxTabsCommitHandlerOptions, CngxTabsConfig, CngxTabsConfigFeature, CngxTabsFallbackLabels, CngxTabsFeature, CngxTabsI18n, CngxTabsI18nFeature, CngxTabsTemplates };
|