mn-angular-lib 1.0.155 → 1.0.156

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/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "mn-angular-lib",
3
- "version": "1.0.155",
3
+ "version": "1.0.156",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^21.1.3",
6
6
  "@angular/core": "^21.1.3",
7
+ "@angular/router": "^21.1.3",
7
8
  "@lucide/angular": "^1.18.0",
8
9
  "quill": "^2.0.3"
9
10
  },
@@ -7473,6 +7473,7 @@ declare class CalendarViewComponent implements OnInit, OnDestroy {
7473
7473
  private readonly mnConfigRef;
7474
7474
  private readonly destroyRef;
7475
7475
  private readonly lang;
7476
+ private readonly cdr;
7476
7477
  constructor();
7477
7478
  onResize(): void;
7478
7479
  ngOnInit(): void;
@@ -7678,6 +7679,7 @@ declare class CalendarDayComponent implements OnInit, OnDestroy {
7678
7679
  */
7679
7680
  declare class CalendarMonthComponent implements OnInit, OnDestroy {
7680
7681
  private readonly lang;
7682
+ private readonly cdr;
7681
7683
  /**
7682
7684
  * Accessible name for this control. Resolved through the conventional
7683
7685
  * `mnCalendar.monthView` key so an app can translate it, falling back to English when the
@@ -7772,6 +7774,7 @@ declare class CalendarEventDefaultComponent implements CalendarEventData, OnInit
7772
7774
  */
7773
7775
  declare class UpcomingEventsComponent implements OnInit, OnChanges, OnDestroy {
7774
7776
  private readonly lang;
7777
+ private readonly cdr;
7775
7778
  /**
7776
7779
  * Accessible name for this control. Resolved through the conventional
7777
7780
  * `mnCalendar.upcomingEvents` key so an app can translate it, falling back to English when the
@@ -7963,6 +7966,17 @@ declare class CalendarUtility {
7963
7966
  type MnTabItem = {
7964
7967
  /** Translation key or label text for the tab. */
7965
7968
  label: string;
7969
+ /**
7970
+ * Stable value this tab is written as in the URL while the tab bar mirrors
7971
+ * its selection there (see {@link MnTabDataSource.urlParam}).
7972
+ *
7973
+ * Defaults to a slug of the last segment of {@link label}
7974
+ * (`matches.hub.tab.entrants` → `entrants`, `members.tabMembers` →
7975
+ * `tab-members`). Set it when that slug is not the URL you want to hand out,
7976
+ * or when the label key may be renamed — a shared link is only as stable as
7977
+ * the value in it.
7978
+ */
7979
+ id?: string;
7966
7980
  /** Callback invoked when this tab becomes active. */
7967
7981
  onClick?: () => void;
7968
7982
  /** Callback invoked when this tab is deactivated. */
@@ -7990,13 +8004,59 @@ type MnTabDataSource = {
7990
8004
  * (e.g. tabs that depend on data being fetched) to predict the final count.
7991
8005
  */
7992
8006
  skeletonCount?: number;
8007
+ /**
8008
+ * Query parameter the active tab is mirrored in, so a reload or a shared
8009
+ * link lands on the tab the user was looking at. Defaults to `'tab'`; pass
8010
+ * `false` to keep this tab bar out of the URL.
8011
+ *
8012
+ * Each tab bar that can be on screen at the same time as another needs its
8013
+ * own parameter name — two bars sharing one name fight over it. Turn it off
8014
+ * for a tab bar whose selection is not worth sharing, such as one inside a
8015
+ * modal, which would otherwise write to the URL of the page behind it.
8016
+ *
8017
+ * Only user selections are written, so a page nobody has clicked a tab on
8018
+ * keeps a clean URL and falls back to {@link defaultActive}. Restoring a tab
8019
+ * from the URL runs that tab's {@link MnTabItem.onClick} and emits
8020
+ * `activeChange`, so a consumer tracking the active tab itself hears about
8021
+ * the restored one.
8022
+ */
8023
+ urlParam?: string | false;
7993
8024
  };
7994
8025
 
7995
8026
  /**
7996
8027
  * Tab component that renders a horizontal tab bar.
7997
8028
  * Supports translation keys for labels via MnTranslatePipe.
8029
+ *
8030
+ * The active tab is mirrored in the URL query string by default, so a reload,
8031
+ * a back button or a shared link lands on the same tab; see
8032
+ * {@link MnTabDataSource.urlParam} to rename that parameter or switch it off.
7998
8033
  */
7999
8034
  declare class MnTabComponent implements DoCheck, AfterViewInit, OnDestroy {
8035
+ /**
8036
+ * Router the active tab is written to. Optional: a tab bar used outside a
8037
+ * routed application still works, it just has no URL to mirror into.
8038
+ */
8039
+ private readonly router;
8040
+ /** Route the tab value is read back from; absent for the same reason as {@link router}. */
8041
+ private readonly route;
8042
+ /** Watches the URL so a deep link, a back button or an in-app link moves the tab bar. */
8043
+ private readonly queryParamsSub?;
8044
+ /**
8045
+ * URL keys of the current items, memoised on the items array so a slug is
8046
+ * computed once per tab set rather than on every change-detection pass.
8047
+ */
8048
+ private urlKeyCache?;
8049
+ /** URL key of {@link currentActive}, so a rebuilt tab set can be recognised as the same tab. */
8050
+ private currentKey?;
8051
+ /**
8052
+ * Key of a selection whose URL write has not landed yet. Navigation is
8053
+ * asynchronous, so a consumer that rebuilds its tabs in response to the click
8054
+ * can be resolved against a URL that still names the previous tab; until the
8055
+ * write completes, this is the truth about what the user picked.
8056
+ */
8057
+ private pendingKey?;
8058
+ /** Set on destroy so a deferred restore can't announce a tab nobody is showing. */
8059
+ private destroyed;
8000
8060
  /** The horizontally-scrolling wrapper the edge fade is painted onto. */
8001
8061
  private scrollContainer?;
8002
8062
  /** The tab row; queried for the active tab so the indicator can measure it. */
@@ -8054,6 +8114,7 @@ declare class MnTabComponent implements DoCheck, AfterViewInit, OnDestroy {
8054
8114
  * otherwise the number of known items, falling back to a default when none.
8055
8115
  */
8056
8116
  get skeletonTabs(): number[];
8117
+ constructor();
8057
8118
  /**
8058
8119
  * Re-resolves the active tab on every change-detection pass.
8059
8120
  *
@@ -8080,10 +8141,19 @@ declare class MnTabComponent implements DoCheck, AfterViewInit, OnDestroy {
8080
8141
  */
8081
8142
  updateEdgeFades(): void;
8082
8143
  /**
8083
- * Sets the given tab item as active, invoking deactivate/activate callbacks.
8144
+ * Sets the given tab item as active, invoking deactivate/activate callbacks,
8145
+ * and records the selection in the URL so it survives a reload or a share.
8084
8146
  * @param item - The tab item to activate.
8085
8147
  */
8086
8148
  setActive(item: MnTabItem): void;
8149
+ /**
8150
+ * Moves the selection to `item` and tells the consumer about it: the
8151
+ * deactivate/activate/emit sequence a click produces, shared by the click
8152
+ * path and the URL-driven ones (deep link, back button), which owe the
8153
+ * consumer the same notifications.
8154
+ * @param item - The tab item to activate.
8155
+ */
8156
+ private activate;
8087
8157
  /**
8088
8158
  * Marks a click-driven slide as in progress and schedules the guard to lift
8089
8159
  * once the transition has finished. A timeout (not `transitionend`) so the
@@ -8111,10 +8181,54 @@ declare class MnTabComponent implements DoCheck, AfterViewInit, OnDestroy {
8111
8181
  getBadge(item: MnTabItem): number | undefined;
8112
8182
  /**
8113
8183
  * Ensures {@link currentActive} references a tab that still exists in the data
8114
- * source, falling back to the configured default tab when the current
8115
- * selection is missing or stale (e.g. after the items array is replaced).
8184
+ * source, preferring the tab named in the URL and falling back to the
8185
+ * configured default tab when the current selection is missing or stale
8186
+ * (e.g. after the items array is replaced).
8116
8187
  */
8117
8188
  private syncActiveTab;
8189
+ /**
8190
+ * Records `item` as the selection, remembering its URL key so the same tab is
8191
+ * recognised after the consumer rebuilds the items array.
8192
+ * @param item - The newly selected tab.
8193
+ */
8194
+ private select;
8195
+ /**
8196
+ * Runs the restored tab's callbacks a change-detection pass later, unless the
8197
+ * selection moved on in the meantime (a click, or another tab set arriving).
8198
+ * @param item - The tab restored from the URL.
8199
+ */
8200
+ private announceRestored;
8201
+ /**
8202
+ * Activates the tab a URL value names, when it is not the tab already on
8203
+ * screen. Values naming no known tab are ignored: another tab bar on the page
8204
+ * may own that parameter, and a stale link should leave the default standing.
8205
+ * @param key - The value read from the query parameter, if any.
8206
+ */
8207
+ private activateUrlKey;
8208
+ /**
8209
+ * The query parameter this tab bar mirrors into, or undefined when there is
8210
+ * nothing to mirror into (no router) or the consumer switched it off.
8211
+ */
8212
+ private urlParam;
8213
+ /**
8214
+ * The tab the current URL asks for, if it names one of `items`.
8215
+ * @param items - The tab set to resolve the URL value against.
8216
+ */
8217
+ private itemFromUrl;
8218
+ /**
8219
+ * Records the active tab in the query string, replacing the current history
8220
+ * entry: switching tabs is not a navigation to walk back through, and back
8221
+ * should leave the page rather than retrace its tabs.
8222
+ * @param item - The tab that just became active.
8223
+ */
8224
+ private writeUrl;
8225
+ /**
8226
+ * The URL key of every tab, in item order: the item's `id`, else a slug of
8227
+ * its label. Repeats are numbered so each tab still round-trips through the
8228
+ * URL; give such tabs an explicit `id` to choose the value yourself.
8229
+ * @param items - The tab set to key.
8230
+ */
8231
+ private urlKeys;
8118
8232
  static ɵfac: i0.ɵɵFactoryDeclaration<MnTabComponent, never>;
8119
8233
  static ɵcmp: i0.ɵɵ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>;
8120
8234
  }