mn-angular-lib 2.0.34 → 2.0.35

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.
Files changed (52) hide show
  1. package/fesm2022/mn-angular-lib-alert.mjs +515 -527
  2. package/fesm2022/mn-angular-lib-alert.mjs.map +1 -1
  3. package/fesm2022/mn-angular-lib-bottom-sheet.mjs +264 -357
  4. package/fesm2022/mn-angular-lib-bottom-sheet.mjs.map +1 -1
  5. package/fesm2022/mn-angular-lib-button.mjs +819 -382
  6. package/fesm2022/mn-angular-lib-button.mjs.map +1 -1
  7. package/fesm2022/mn-angular-lib-calendar-core.mjs +240 -365
  8. package/fesm2022/mn-angular-lib-calendar-core.mjs.map +1 -1
  9. package/fesm2022/mn-angular-lib-calendar.mjs +1691 -1545
  10. package/fesm2022/mn-angular-lib-calendar.mjs.map +1 -1
  11. package/fesm2022/mn-angular-lib-collection.mjs +2367 -2796
  12. package/fesm2022/mn-angular-lib-collection.mjs.map +1 -1
  13. package/fesm2022/mn-angular-lib-core.mjs +693 -1241
  14. package/fesm2022/mn-angular-lib-core.mjs.map +1 -1
  15. package/fesm2022/mn-angular-lib-display.mjs +679 -712
  16. package/fesm2022/mn-angular-lib-display.mjs.map +1 -1
  17. package/fesm2022/mn-angular-lib-forms.mjs +3671 -4647
  18. package/fesm2022/mn-angular-lib-forms.mjs.map +1 -1
  19. package/fesm2022/mn-angular-lib-keyboard.mjs +221 -190
  20. package/fesm2022/mn-angular-lib-keyboard.mjs.map +1 -1
  21. package/fesm2022/mn-angular-lib-modal-core.mjs +711 -896
  22. package/fesm2022/mn-angular-lib-modal-core.mjs.map +1 -1
  23. package/fesm2022/mn-angular-lib-modal-ui.mjs +2089 -2035
  24. package/fesm2022/mn-angular-lib-modal-ui.mjs.map +1 -1
  25. package/fesm2022/mn-angular-lib-modal.mjs +76 -121
  26. package/fesm2022/mn-angular-lib-modal.mjs.map +1 -1
  27. package/fesm2022/mn-angular-lib-rich-text-editor.mjs +289 -277
  28. package/fesm2022/mn-angular-lib-rich-text-editor.mjs.map +1 -1
  29. package/fesm2022/mn-angular-lib-segmented.mjs +189 -241
  30. package/fesm2022/mn-angular-lib-segmented.mjs.map +1 -1
  31. package/fesm2022/mn-angular-lib-tab.mjs +409 -642
  32. package/fesm2022/mn-angular-lib-tab.mjs.map +1 -1
  33. package/fesm2022/mn-angular-lib.mjs +16 -29
  34. package/package.json +1 -1
  35. package/types/mn-angular-lib-alert.d.ts +239 -241
  36. package/types/mn-angular-lib-bottom-sheet.d.ts +190 -150
  37. package/types/mn-angular-lib-button.d.ts +319 -317
  38. package/types/mn-angular-lib-calendar-core.d.ts +199 -209
  39. package/types/mn-angular-lib-calendar.d.ts +656 -511
  40. package/types/mn-angular-lib-collection.d.ts +1649 -1585
  41. package/types/mn-angular-lib-core.d.ts +524 -535
  42. package/types/mn-angular-lib-display.d.ts +946 -886
  43. package/types/mn-angular-lib-forms.d.ts +3012 -3013
  44. package/types/mn-angular-lib-keyboard.d.ts +125 -85
  45. package/types/mn-angular-lib-modal-core.d.ts +978 -994
  46. package/types/mn-angular-lib-modal-ui.d.ts +541 -493
  47. package/types/mn-angular-lib-modal.d.ts +24 -27
  48. package/types/mn-angular-lib-rich-text-editor.d.ts +131 -98
  49. package/types/mn-angular-lib-segmented.d.ts +354 -341
  50. package/types/mn-angular-lib-tab.d.ts +345 -336
  51. package/types/mn-angular-lib.d.ts +16 -16
  52. package/fesm2022/mn-angular-lib.mjs.map +0 -1
@@ -1,71 +1,68 @@
1
- import * as _angular_core from '@angular/core';
2
- import { Signal, DoCheck, AfterViewInit, AfterViewChecked, OnDestroy, EventEmitter } from '@angular/core';
3
- import * as _lucide_angular from '@lucide/angular';
4
- import { MnCollectionState } from 'mn-angular-lib/collection';
5
-
1
+ import * as i0 from "@angular/core";
2
+ import { AfterViewChecked, AfterViewInit, DoCheck, EventEmitter, OnDestroy, Signal } from "@angular/core";
3
+ import { MnCollectionState } from "mn-angular-lib/collection";
6
4
  /**
7
5
  * Configuration for a single tab item.
8
6
  */
9
- type MnTabItem = {
10
- /** Translation key or label text for the tab. */
11
- label: string;
12
- /**
13
- * Stable value this tab is written as in the URL while the tab bar mirrors
14
- * its selection there (see {@link MnTabDataSource.urlParam}).
15
- *
16
- * Defaults to a slug of the last segment of {@link label}
17
- * (`matches.hub.tab.entrants` → `entrants`, `members.tabMembers` →
18
- * `tab-members`). Set it when that slug is not the URL you want to hand out,
19
- * or when the label key may be renamed — a shared link is only as stable as
20
- * the value in it.
21
- */
22
- id?: string;
23
- /** Callback invoked when this tab becomes active. */
24
- onClick?: () => void;
25
- /** Callback invoked when this tab is deactivated. */
26
- onDeactivate?: () => void;
27
- /** Optional notification count shown as a badge on the tab. Accepts a plain number or a Signal<number>. Hidden when 0 or absent. */
28
- badge?: number | Signal<number>;
7
+ export type MnTabItem = {
8
+ /** Translation key or label text for the tab. */
9
+ label: string;
10
+ /**
11
+ * Stable value this tab is written as in the URL while the tab bar mirrors
12
+ * its selection there (see {@link MnTabDataSource.urlParam}).
13
+ *
14
+ * Defaults to a slug of the last segment of {@link label}
15
+ * (`matches.hub.tab.entrants` → `entrants`, `members.tabMembers` →
16
+ * `tab-members`). Set it when that slug is not the URL you want to hand out,
17
+ * or when the label key may be renamed — a shared link is only as stable as
18
+ * the value in it.
19
+ */
20
+ id?: string;
21
+ /** Callback invoked when this tab becomes active. */
22
+ onClick?: () => void;
23
+ /** Callback invoked when this tab is deactivated. */
24
+ onDeactivate?: () => void;
25
+ /** Optional notification count shown as a badge on the tab. Accepts a plain number or a Signal<number>. Hidden when 0 or absent. */
26
+ badge?: number | Signal<number>;
29
27
  };
30
28
  /**
31
29
  * Data source configuration for the mn-tab component.
32
30
  */
33
- type MnTabDataSource = {
34
- /** List of tab items to display. */
35
- items: MnTabItem[];
36
- /** Index of the tab that should be active by default. */
37
- defaultActive: number;
38
- /**
39
- * Lifecycle state of the tab set. When {@link MnCollectionState.LOADING} the tab
40
- * bar renders a loading skeleton; any other state renders the real tabs.
41
- */
42
- state?: MnCollectionState;
43
- /**
44
- * Number of placeholder tabs to render while {@link state} is LOADING.
45
- * Defaults to the number of known `items`, falling back to 3 when no items are
46
- * known yet. Set this only when the real tabs are not yet known at load time
47
- * (e.g. tabs that depend on data being fetched) to predict the final count.
48
- */
49
- skeletonCount?: number;
50
- /**
51
- * Query parameter the active tab is mirrored in, so a reload or a shared
52
- * link lands on the tab the user was looking at. Defaults to `'tab'`; pass
53
- * `false` to keep this tab bar out of the URL.
54
- *
55
- * Each tab bar that can be on screen at the same time as another needs its
56
- * own parameter name — two bars sharing one name fight over it. Turn it off
57
- * for a tab bar whose selection is not worth sharing, such as one inside a
58
- * modal, which would otherwise write to the URL of the page behind it.
59
- *
60
- * Only user selections are written, so a page nobody has clicked a tab on
61
- * keeps a clean URL and falls back to {@link defaultActive}. Restoring a tab
62
- * from the URL runs that tab's {@link MnTabItem.onClick} and emits
63
- * `activeChange`, so a consumer tracking the active tab itself hears about
64
- * the restored one.
65
- */
66
- urlParam?: string | false;
31
+ export type MnTabDataSource = {
32
+ /** List of tab items to display. */
33
+ items: MnTabItem[];
34
+ /** Index of the tab that should be active by default. */
35
+ defaultActive: number;
36
+ /**
37
+ * Lifecycle state of the tab set. When {@link MnCollectionState.LOADING} the tab
38
+ * bar renders a loading skeleton; any other state renders the real tabs.
39
+ */
40
+ state?: MnCollectionState;
41
+ /**
42
+ * Number of placeholder tabs to render while {@link state} is LOADING.
43
+ * Defaults to the number of known `items`, falling back to 3 when no items are
44
+ * known yet. Set this only when the real tabs are not yet known at load time
45
+ * (e.g. tabs that depend on data being fetched) to predict the final count.
46
+ */
47
+ skeletonCount?: number;
48
+ /**
49
+ * Query parameter the active tab is mirrored in, so a reload or a shared
50
+ * link lands on the tab the user was looking at. Defaults to `'tab'`; pass
51
+ * `false` to keep this tab bar out of the URL.
52
+ *
53
+ * Each tab bar that can be on screen at the same time as another needs its
54
+ * own parameter name — two bars sharing one name fight over it. Turn it off
55
+ * for a tab bar whose selection is not worth sharing, such as one inside a
56
+ * modal, which would otherwise write to the URL of the page behind it.
57
+ *
58
+ * Only user selections are written, so a page nobody has clicked a tab on
59
+ * keeps a clean URL and falls back to {@link defaultActive}. Restoring a tab
60
+ * from the URL runs that tab's {@link MnTabItem.onClick} and emits
61
+ * `activeChange`, so a consumer tracking the active tab itself hears about
62
+ * the restored one.
63
+ */
64
+ urlParam?: string | false;
67
65
  };
68
-
69
66
  /**
70
67
  * Tab component that renders a horizontal tab bar.
71
68
  * Supports translation keys for labels via MnTranslatePipe.
@@ -74,279 +71,291 @@ type MnTabDataSource = {
74
71
  * a back button or a shared link lands on the same tab; see
75
72
  * {@link MnTabDataSource.urlParam} to rename that parameter or switch it off.
76
73
  */
77
- declare class MnTabComponent implements DoCheck, AfterViewInit, AfterViewChecked, OnDestroy {
78
- /**
79
- * Router the active tab is written to. Optional: a tab bar used outside a
80
- * routed application still works, it just has no URL to mirror into.
81
- */
82
- private readonly router;
83
- /** Route the tab value is read back from; absent for the same reason as {@link router}. */
84
- private readonly route;
85
- /**
86
- * Marks the view whenever {@link currentActive} moves. The selection changes from three
87
- * places Angular does not notice under OnPush: the query-parameter subscription, the
88
- * {@link ngDoCheck} re-resolve, and a stale item being dropped — only a click arrives
89
- * through a listener that dirties the view by itself.
90
- */
91
- private readonly cdr;
92
- /** Watches the URL so a deep link, a back button or an in-app link moves the tab bar. */
93
- private readonly queryParamsSub?;
94
- /**
95
- * URL keys of the current items, memoised on the items array so a slug is
96
- * computed once per tab set rather than on every change-detection pass.
97
- */
98
- private urlKeyCache?;
99
- /** URL key of {@link currentActive}, so a rebuilt tab set can be recognised as the same tab. */
100
- private currentKey?;
101
- /**
102
- * Key of a selection whose URL write has not landed yet. Navigation is
103
- * asynchronous, so a consumer that rebuilds its tabs in response to the click
104
- * can be resolved against a URL that still names the previous tab; until the
105
- * write completes, this is the truth about what the user picked.
106
- */
107
- private pendingKey?;
108
- /** Set on destroy so a deferred restore can't announce a tab nobody is showing. */
109
- private destroyed;
110
- /** The horizontally-scrolling wrapper the edge fade is painted onto. */
111
- private scrollContainer?;
112
- /** The tab row; queried for the active tab so the indicator can measure it. */
113
- private tabList?;
114
- /** The shared underline that slides to the active tab. */
115
- private indicator?;
116
- /** Pending indicator remeasure, cancelled on destroy so a post-destroy frame can't read a detached ref. */
117
- private indicatorFrame?;
118
- /**
119
- * True while a click-initiated slide is animating. The active tab's
120
- * `font-bold` widens the row, which fires {@link resizeObserver}; without
121
- * this guard the observer's snap ({@link updateIndicator} with `animate:
122
- * false`) would land the indicator at its target the same frame the slide
123
- * starts, so the transition never paints. Set synchronously in
124
- * {@link setActive} — before the frame runs — so the guard doesn't depend on
125
- * rAF-vs-ResizeObserver callback ordering.
126
- */
127
- private sliding;
128
- /** Clears {@link sliding} after the slide finishes; re-armed per click, cancelled on destroy. */
129
- private slidingTimer?;
130
- /** Slide duration in ms; matches the indicator's `duration-300` transition. */
131
- private static readonly SLIDE_MS;
132
- /** How far the fade reaches in from each overflowing edge. */
133
- private static readonly FADE;
134
- /** Data source containing tab items and default active index. */
135
- dataSource: MnTabDataSource;
136
- /**
137
- * Whether to enable horizontal scrolling when items overflow.
138
- * When true, tabs scroll horizontally instead of overflowing their container.
139
- *
140
- * Defaults to `true`: the tab bar never wraps (`flex-nowrap`), so without
141
- * scrolling an overflowing bar would clip its last tabs or push the page width
142
- * on narrow screens. When the tabs already fit, `overflow-x-auto` is a no-op,
143
- * so this default only ever changes behaviour for the overflow case it fixes.
144
- */
145
- scrollable: boolean;
146
- /**
147
- * Whether tabs should stretch to fill the available width.
148
- * Defaults to false, so tabs only take as much space as their content.
149
- */
150
- justified: boolean;
151
- /** Icons rendered by the template. */
152
- protected readonly icons: Record<"ChevronLeft" | "ChevronRight", _lucide_angular.LucideIconData>;
153
- /**
154
- * Whether tabs are scrolled out of view past the start edge, which shows the start chevron.
155
- * A signal, so a write from the scroll handler or the resize observer marks the view by itself.
156
- */
157
- readonly canScrollStart: _angular_core.WritableSignal<boolean>;
158
- /** Whether tabs are hidden past the end edge, which shows the end chevron. */
159
- readonly canScrollEnd: _angular_core.WritableSignal<boolean>;
160
- /** Emits the newly activated tab item whenever the active tab changes. */
161
- activeChange: EventEmitter<MnTabItem>;
162
- /** The currently active tab item. */
163
- currentActive?: MnTabItem;
164
- /** Watches the wrapper and the tab row so the fade re-evaluates on width or content changes. */
165
- private resizeObserver?;
166
- /**
167
- * Whether the tab bar is loading and should render skeleton tabs, from
168
- * {@link MnTabDataSource.state}.
169
- */
170
- get isLoadingState(): boolean;
171
- /**
172
- * Index array sizing the loading skeleton: `skeletonCount` when provided,
173
- * otherwise the number of known items, falling back to a default when none.
174
- */
175
- get skeletonTabs(): number[];
176
- constructor();
177
- /**
178
- * Re-resolves the active tab on every change-detection pass.
179
- *
180
- * The data source is often populated or rebuilt asynchronously (tabs that
181
- * depend on fetched data or permissions). Resolving the active tab only once
182
- * at init would leave {@link currentActive} pointing at a stale item — the
183
- * tab bar would then highlight nothing and swallow the first click — so the
184
- * selection is kept in sync with whatever the data source currently holds.
185
- */
186
- ngDoCheck(): void;
187
- /**
188
- * Starts watching the scroll wrapper so the edge fade stays honest. A scroll
189
- * moves the fade to whichever side now hides tabs; a resize (viewport change)
190
- * or a change to the tab row's width (tabs added, relabelled, skeleton →
191
- * loaded) re-checks whether either edge overflows at all.
192
- */
193
- ngAfterViewInit(): void;
194
- /** Wrapper geometry (`scrollWidth:clientWidth`) at the last fade evaluation. */
195
- private lastFadeGeometry;
196
- /**
197
- * Re-evaluates the edge fade when the wrapper's scrollable extent changes without its box
198
- * changing. {@link resizeObserver} only sees border-box changes, and the tab row is a
199
- * block-level flex container that keeps its parent's width while its tabs overflow inside it,
200
- * so tabs that arrive after init (permission-gated tabs, badge counts, skeleton → loaded) grow
201
- * `scrollWidth` without firing it; until a resize or scroll the fade stayed off. Two property
202
- * reads per pass; the repaint only runs when they moved.
203
- */
204
- ngAfterViewChecked(): void;
205
- ngOnDestroy(): void;
206
- /**
207
- * Paints a fade over whichever edge has tabs scrolled out of view — a soft
208
- * dissolve that reads as "more this way", the affordance a hidden scrollbar
209
- * otherwise costs us. Uses a mask (content → transparent) rather than a
210
- * background-coloured overlay, so it needs no knowledge of the theme.
211
- *
212
- * The fade alone only reads as "more" when it dissolves a tab cut off
213
- * mid-label. When a tab boundary lands exactly on the edge it merely softens
214
- * a complete label and the hidden tabs go unnoticed, so the same overflow
215
- * also shows a chevron in the faded strip ({@link canScrollStart},
216
- * {@link canScrollEnd}).
217
- */
218
- updateEdgeFades(): void;
219
- /**
220
- * Scrolls the bar by most of its visible width towards one edge, from a chevron press. The
221
- * scroll event that follows moves the fade and hides the chevron whose edge has been reached.
222
- * Jumps instead of gliding for a user who asked for reduced motion.
223
- * @param direction - -1 towards the start, 1 towards the end.
224
- */
225
- scrollTabs(direction: -1 | 1): void;
226
- /**
227
- * Sets the given tab item as active, invoking deactivate/activate callbacks,
228
- * and records the selection in the URL so it survives a reload or a share.
229
- * @param item - The tab item to activate.
230
- */
231
- setActive(item: MnTabItem): void;
232
- /**
233
- * Whether a tab is the bar's single Tab stop: the active tab, or the first tab while none is
234
- * active yet. Every other tab is reached with the arrow keys, so Tab leaves the bar in one press.
235
- * @param item - The tab to check.
236
- * @returns True for the one tab that keeps `tabindex="0"`.
237
- */
238
- isTabStop(item: MnTabItem): boolean;
239
- /**
240
- * Keyboard handling on a tab. Left and Right move to the previous or next tab and wrap at the
241
- * ends, Home and End jump to the first and last; the tab moved to is activated at once
242
- * (automatic activation) and receives focus. Enter and Space activate the focused tab, handled
243
- * on keydown so Space does not scroll the page first. Other keys are left alone.
244
- * @param event - The keydown on a tab.
245
- * @param item - The tab the key was pressed on.
246
- */
247
- onTabKeydown(event: KeyboardEvent, item: MnTabItem): void;
248
- /**
249
- * Moves focus to the tab at `index` and scrolls it into view inside a scrollable bar. Focusing
250
- * works before change detection has moved `tabindex="0"` onto it, because a script may focus an
251
- * element with `tabindex="-1"`.
252
- * @param index - Position of the tab in the data source's items.
253
- */
254
- private focusTab;
255
- /**
256
- * Moves the selection to `item` and tells the consumer about it: the
257
- * deactivate/activate/emit sequence a click produces, shared by the click
258
- * path and the URL-driven ones (deep link, back button), which owe the
259
- * consumer the same notifications.
260
- * @param item - The tab item to activate.
261
- */
262
- private activate;
263
- /**
264
- * Marks a click-driven slide as in progress and schedules the guard to lift
265
- * once the transition has finished. A timeout (not `transitionend`) so the
266
- * flag still clears under `motion-reduce`, where no transition event fires.
267
- */
268
- private beginSlide;
269
- /**
270
- * Moves the shared underline to the active tab. When `animate` is false the
271
- * move is snapped (no slide) by disabling the transition for one reflow —
272
- * used on init, async selection and resize, where a slide would read as jank.
273
- * @param animate - Whether the move should slide (true) or snap (false).
274
- */
275
- private updateIndicator;
276
- /**
277
- * Scrolls the strip so the active tab is fully in view, clear of the 2rem edge the fade and
278
- * the scroll chevron cover. Only keyboard focus used to scroll, so a deep link to a tab past
279
- * the fold ("?tab=results" on a phone) opened with the strip at its start and the selected
280
- * tab out of sight. Sets scrollLeft on the strip itself rather than calling scrollIntoView,
281
- * which would scroll the page too.
282
- * @param active - The selected tab element.
283
- */
284
- private revealActiveTab;
285
- /**
286
- * Remeasures the indicator on the next animation frame, so the read happens
287
- * after layout reflects the latest active-tab classes. Coalesces bursts and
288
- * is cancellable on destroy.
289
- * @param animate - Whether the resulting move should slide.
290
- */
291
- private scheduleIndicator;
292
- /**
293
- * Returns the resolved badge value for a tab item, supporting both plain numbers and Signal<number>.
294
- * @param item - The tab item whose badge to resolve.
295
- */
296
- getBadge(item: MnTabItem): number | undefined;
297
- /**
298
- * Ensures {@link currentActive} references a tab that still exists in the data
299
- * source, preferring the tab named in the URL and falling back to the
300
- * configured default tab when the current selection is missing or stale
301
- * (e.g. after the items array is replaced).
302
- */
303
- private syncActiveTab;
304
- /**
305
- * Records `item` as the selection, remembering its URL key so the same tab is
306
- * recognised after the consumer rebuilds the items array.
307
- * @param item - The newly selected tab.
308
- */
309
- private select;
310
- /**
311
- * Runs the restored tab's callbacks a change-detection pass later, unless the
312
- * selection moved on in the meantime (a click, or another tab set arriving).
313
- * @param item - The tab restored from the URL.
314
- */
315
- private announceRestored;
316
- /**
317
- * Activates the tab a URL value names, when it is not the tab already on
318
- * screen. Values naming no known tab are ignored: another tab bar on the page
319
- * may own that parameter, and a stale link should leave the default standing.
320
- * @param key - The value read from the query parameter, if any.
321
- */
322
- private activateUrlKey;
323
- /**
324
- * The query parameter this tab bar mirrors into, or undefined when there is
325
- * nothing to mirror into (no router) or the consumer switched it off.
326
- */
327
- private urlParam;
328
- /**
329
- * The tab the current URL asks for, if it names one of `items`.
330
- * @param items - The tab set to resolve the URL value against.
331
- */
332
- private itemFromUrl;
333
- /**
334
- * Records the active tab in the query string, replacing the current history
335
- * entry: switching tabs is not a navigation to walk back through, and back
336
- * should leave the page rather than retrace its tabs.
337
- * @param item - The tab that just became active.
338
- */
339
- private writeUrl;
340
- /**
341
- * The URL key of every tab, in item order: the item's `id`, else a slug of
342
- * its label. Repeats are numbered so each tab still round-trips through the
343
- * URL; give such tabs an explicit `id` to choose the value yourself.
344
- * @param items - The tab set to key.
345
- */
346
- private urlKeys;
347
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<MnTabComponent, never>;
348
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<MnTabComponent, "mn-tab", never, { "dataSource": { "alias": "dataSource"; "required": false; }; "scrollable": { "alias": "scrollable"; "required": false; }; "justified": { "alias": "justified"; "required": false; }; }, { "activeChange": "activeChange"; }, never, never, true, never>;
349
- }
350
-
351
- export { MnTabComponent };
352
- export type { MnTabDataSource, MnTabItem };
74
+ export declare class MnTabComponent implements DoCheck, AfterViewInit, AfterViewChecked, OnDestroy {
75
+ /**
76
+ * Router the active tab is written to. Optional: a tab bar used outside a
77
+ * routed application still works, it just has no URL to mirror into.
78
+ */
79
+ private readonly router;
80
+ /** Route the tab value is read back from; absent for the same reason as {@link router}. */
81
+ private readonly route;
82
+ /**
83
+ * Marks the view whenever {@link currentActive} moves. The selection changes from three
84
+ * places Angular does not notice under OnPush: the query-parameter subscription, the
85
+ * {@link ngDoCheck} re-resolve, and a stale item being dropped — only a click arrives
86
+ * through a listener that dirties the view by itself.
87
+ */
88
+ private readonly cdr;
89
+ /** Watches the URL so a deep link, a back button or an in-app link moves the tab bar. */
90
+ private readonly queryParamsSub?;
91
+ /**
92
+ * URL keys of the current items, memoised on the items array so a slug is
93
+ * computed once per tab set rather than on every change-detection pass.
94
+ */
95
+ private urlKeyCache?;
96
+ /** URL key of {@link currentActive}, so a rebuilt tab set can be recognised as the same tab. */
97
+ private currentKey?;
98
+ /**
99
+ * Key of a selection whose URL write has not landed yet. Navigation is
100
+ * asynchronous, so a consumer that rebuilds its tabs in response to the click
101
+ * can be resolved against a URL that still names the previous tab; until the
102
+ * write completes, this is the truth about what the user picked.
103
+ */
104
+ private pendingKey?;
105
+ /** Set on destroy so a deferred restore can't announce a tab nobody is showing. */
106
+ private destroyed;
107
+ /** The horizontally-scrolling wrapper the edge fade is painted onto. */
108
+ private scrollContainer?;
109
+ /** The tab row; queried for the active tab so the indicator can measure it. */
110
+ private tabList?;
111
+ /** The shared underline that slides to the active tab. */
112
+ private indicator?;
113
+ /** Pending indicator remeasure, cancelled on destroy so a post-destroy frame can't read a detached ref. */
114
+ private indicatorFrame?;
115
+ /**
116
+ * True while a click-initiated slide is animating. The active tab's
117
+ * `font-bold` widens the row, which fires {@link resizeObserver}; without
118
+ * this guard the observer's snap ({@link updateIndicator} with `animate:
119
+ * false`) would land the indicator at its target the same frame the slide
120
+ * starts, so the transition never paints. Set synchronously in
121
+ * {@link setActive} — before the frame runs — so the guard doesn't depend on
122
+ * rAF-vs-ResizeObserver callback ordering.
123
+ */
124
+ private sliding;
125
+ /** Clears {@link sliding} after the slide finishes; re-armed per click, cancelled on destroy. */
126
+ private slidingTimer?;
127
+ /** Slide duration in ms; matches the indicator's `duration-300` transition. */
128
+ private static readonly SLIDE_MS;
129
+ /** How far the fade reaches in from each overflowing edge. */
130
+ private static readonly FADE;
131
+ /** Data source containing tab items and default active index. */
132
+ dataSource: MnTabDataSource;
133
+ /**
134
+ * Whether to enable horizontal scrolling when items overflow.
135
+ * When true, tabs scroll horizontally instead of overflowing their container.
136
+ *
137
+ * Defaults to `true`: the tab bar never wraps (`flex-nowrap`), so without
138
+ * scrolling an overflowing bar would clip its last tabs or push the page width
139
+ * on narrow screens. When the tabs already fit, `overflow-x-auto` is a no-op,
140
+ * so this default only ever changes behaviour for the overflow case it fixes.
141
+ */
142
+ scrollable: boolean;
143
+ /**
144
+ * Whether tabs should stretch to fill the available width.
145
+ * Defaults to false, so tabs only take as much space as their content.
146
+ */
147
+ justified: boolean;
148
+ /** Icons rendered by the template. */
149
+ protected readonly icons: Record<"ChevronLeft" | "ChevronRight", import("@lucide/angular").LucideIconData>;
150
+ /**
151
+ * Whether tabs are scrolled out of view past the start edge, which shows the start chevron.
152
+ * A signal, so a write from the scroll handler or the resize observer marks the view by itself.
153
+ */
154
+ readonly canScrollStart: import("@angular/core").WritableSignal<boolean>;
155
+ /** Whether tabs are hidden past the end edge, which shows the end chevron. */
156
+ readonly canScrollEnd: import("@angular/core").WritableSignal<boolean>;
157
+ /** Emits the newly activated tab item whenever the active tab changes. */
158
+ activeChange: EventEmitter<MnTabItem>;
159
+ /** The currently active tab item. */
160
+ currentActive?: MnTabItem;
161
+ /** Watches the wrapper and the tab row so the fade re-evaluates on width or content changes. */
162
+ private resizeObserver?;
163
+ /**
164
+ * Whether the tab bar is loading and should render skeleton tabs, from
165
+ * {@link MnTabDataSource.state}.
166
+ */
167
+ get isLoadingState(): boolean;
168
+ /**
169
+ * Index array sizing the loading skeleton: `skeletonCount` when provided,
170
+ * otherwise the number of known items, falling back to a default when none.
171
+ */
172
+ get skeletonTabs(): number[];
173
+ constructor();
174
+ /**
175
+ * Re-resolves the active tab on every change-detection pass.
176
+ *
177
+ * The data source is often populated or rebuilt asynchronously (tabs that
178
+ * depend on fetched data or permissions). Resolving the active tab only once
179
+ * at init would leave {@link currentActive} pointing at a stale item — the
180
+ * tab bar would then highlight nothing and swallow the first click — so the
181
+ * selection is kept in sync with whatever the data source currently holds.
182
+ */
183
+ ngDoCheck(): void;
184
+ /**
185
+ * Starts watching the scroll wrapper so the edge fade stays honest. A scroll
186
+ * moves the fade to whichever side now hides tabs; a resize (viewport change)
187
+ * or a change to the tab row's width (tabs added, relabelled, skeleton →
188
+ * loaded) re-checks whether either edge overflows at all.
189
+ */
190
+ ngAfterViewInit(): void;
191
+ /** Wrapper geometry (`scrollWidth:clientWidth`) at the last fade evaluation. */
192
+ private lastFadeGeometry;
193
+ /**
194
+ * Re-evaluates the edge fade when the wrapper's scrollable extent changes without its box
195
+ * changing. {@link resizeObserver} only sees border-box changes, and the tab row is a
196
+ * block-level flex container that keeps its parent's width while its tabs overflow inside it,
197
+ * so tabs that arrive after init (permission-gated tabs, badge counts, skeleton → loaded) grow
198
+ * `scrollWidth` without firing it; until a resize or scroll the fade stayed off. Two property
199
+ * reads per pass; the repaint only runs when they moved.
200
+ */
201
+ ngAfterViewChecked(): void;
202
+ ngOnDestroy(): void;
203
+ /**
204
+ * Paints a fade over whichever edge has tabs scrolled out of view — a soft
205
+ * dissolve that reads as "more this way", the affordance a hidden scrollbar
206
+ * otherwise costs us. Uses a mask (content → transparent) rather than a
207
+ * background-coloured overlay, so it needs no knowledge of the theme.
208
+ *
209
+ * The fade alone only reads as "more" when it dissolves a tab cut off
210
+ * mid-label. When a tab boundary lands exactly on the edge it merely softens
211
+ * a complete label and the hidden tabs go unnoticed, so the same overflow
212
+ * also shows a chevron in the faded strip ({@link canScrollStart},
213
+ * {@link canScrollEnd}).
214
+ */
215
+ updateEdgeFades(): void;
216
+ /**
217
+ * Scrolls the bar by most of its visible width towards one edge, from a chevron press. The
218
+ * scroll event that follows moves the fade and hides the chevron whose edge has been reached.
219
+ * Jumps instead of gliding for a user who asked for reduced motion.
220
+ * @param direction - -1 towards the start, 1 towards the end.
221
+ */
222
+ scrollTabs(direction: -1 | 1): void;
223
+ /**
224
+ * Sets the given tab item as active, invoking deactivate/activate callbacks,
225
+ * and records the selection in the URL so it survives a reload or a share.
226
+ * @param item - The tab item to activate.
227
+ */
228
+ setActive(item: MnTabItem): void;
229
+ /**
230
+ * Whether a tab is the bar's single Tab stop: the active tab, or the first tab while none is
231
+ * active yet. Every other tab is reached with the arrow keys, so Tab leaves the bar in one press.
232
+ * @param item - The tab to check.
233
+ * @returns True for the one tab that keeps `tabindex="0"`.
234
+ */
235
+ isTabStop(item: MnTabItem): boolean;
236
+ /**
237
+ * Keyboard handling on a tab. Left and Right move to the previous or next tab and wrap at the
238
+ * ends, Home and End jump to the first and last; the tab moved to is activated at once
239
+ * (automatic activation) and receives focus. Enter and Space activate the focused tab, handled
240
+ * on keydown so Space does not scroll the page first. Other keys are left alone.
241
+ * @param event - The keydown on a tab.
242
+ * @param item - The tab the key was pressed on.
243
+ */
244
+ onTabKeydown(event: KeyboardEvent, item: MnTabItem): void;
245
+ /**
246
+ * Moves focus to the tab at `index` and scrolls it into view inside a scrollable bar. Focusing
247
+ * works before change detection has moved `tabindex="0"` onto it, because a script may focus an
248
+ * element with `tabindex="-1"`.
249
+ * @param index - Position of the tab in the data source's items.
250
+ */
251
+ private focusTab;
252
+ /**
253
+ * Moves the selection to `item` and tells the consumer about it: the
254
+ * deactivate/activate/emit sequence a click produces, shared by the click
255
+ * path and the URL-driven ones (deep link, back button), which owe the
256
+ * consumer the same notifications.
257
+ * @param item - The tab item to activate.
258
+ */
259
+ private activate;
260
+ /**
261
+ * Marks a click-driven slide as in progress and schedules the guard to lift
262
+ * once the transition has finished. A timeout (not `transitionend`) so the
263
+ * flag still clears under `motion-reduce`, where no transition event fires.
264
+ */
265
+ private beginSlide;
266
+ /**
267
+ * Moves the shared underline to the active tab. When `animate` is false the
268
+ * move is snapped (no slide) by disabling the transition for one reflow —
269
+ * used on init, async selection and resize, where a slide would read as jank.
270
+ * @param animate - Whether the move should slide (true) or snap (false).
271
+ */
272
+ private updateIndicator;
273
+ /**
274
+ * Scrolls the strip so the active tab is fully in view, clear of the 2rem edge the fade and
275
+ * the scroll chevron cover. Only keyboard focus used to scroll, so a deep link to a tab past
276
+ * the fold ("?tab=results" on a phone) opened with the strip at its start and the selected
277
+ * tab out of sight. Sets scrollLeft on the strip itself rather than calling scrollIntoView,
278
+ * which would scroll the page too.
279
+ * @param active - The selected tab element.
280
+ */
281
+ private revealActiveTab;
282
+ /**
283
+ * Remeasures the indicator on the next animation frame, so the read happens
284
+ * after layout reflects the latest active-tab classes. Coalesces bursts and
285
+ * is cancellable on destroy.
286
+ * @param animate - Whether the resulting move should slide.
287
+ */
288
+ private scheduleIndicator;
289
+ /**
290
+ * Returns the resolved badge value for a tab item, supporting both plain numbers and Signal<number>.
291
+ * @param item - The tab item whose badge to resolve.
292
+ */
293
+ getBadge(item: MnTabItem): number | undefined;
294
+ /**
295
+ * Ensures {@link currentActive} references a tab that still exists in the data
296
+ * source, preferring the tab named in the URL and falling back to the
297
+ * configured default tab when the current selection is missing or stale
298
+ * (e.g. after the items array is replaced).
299
+ */
300
+ private syncActiveTab;
301
+ /**
302
+ * Records `item` as the selection, remembering its URL key so the same tab is
303
+ * recognised after the consumer rebuilds the items array.
304
+ * @param item - The newly selected tab.
305
+ */
306
+ private select;
307
+ /**
308
+ * Runs the restored tab's callbacks a change-detection pass later, unless the
309
+ * selection moved on in the meantime (a click, or another tab set arriving).
310
+ * @param item - The tab restored from the URL.
311
+ */
312
+ private announceRestored;
313
+ /**
314
+ * Activates the tab a URL value names, when it is not the tab already on
315
+ * screen. Values naming no known tab are ignored: another tab bar on the page
316
+ * may own that parameter, and a stale link should leave the default standing.
317
+ * @param key - The value read from the query parameter, if any.
318
+ */
319
+ private activateUrlKey;
320
+ /**
321
+ * The query parameter this tab bar mirrors into, or undefined when there is
322
+ * nothing to mirror into (no router) or the consumer switched it off.
323
+ */
324
+ private urlParam;
325
+ /**
326
+ * The tab the current URL asks for, if it names one of `items`.
327
+ * @param items - The tab set to resolve the URL value against.
328
+ */
329
+ private itemFromUrl;
330
+ /**
331
+ * Records the active tab in the query string, replacing the current history
332
+ * entry: switching tabs is not a navigation to walk back through, and back
333
+ * should leave the page rather than retrace its tabs.
334
+ * @param item - The tab that just became active.
335
+ */
336
+ private writeUrl;
337
+ /**
338
+ * The URL key of every tab, in item order: the item's `id`, else a slug of
339
+ * its label. Repeats are numbered so each tab still round-trips through the
340
+ * URL; give such tabs an explicit `id` to choose the value yourself.
341
+ * @param items - The tab set to key.
342
+ */
343
+ private urlKeys;
344
+ static ɵfac: i0.ɵɵFactoryDeclaration<MnTabComponent, never>;
345
+ static ɵcmp: i0.ɵɵComponentDeclaration<MnTabComponent, "mn-tab", never, {
346
+ "dataSource": {
347
+ "alias": "dataSource";
348
+ "required": false;
349
+ };
350
+ "scrollable": {
351
+ "alias": "scrollable";
352
+ "required": false;
353
+ };
354
+ "justified": {
355
+ "alias": "justified";
356
+ "required": false;
357
+ };
358
+ }, {
359
+ "activeChange": "activeChange";
360
+ }, never, never, true, never>;
361
+ }