ng-hub-ui-nav 22.11.1 → 22.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -187,7 +187,7 @@ A toggle button ships on the outer edge of the primary column: an arrow inside a
187
187
  | `config` | `Partial<HubNavConfig>` | `{}` | Per-instance config merged with global defaults. |
188
188
  | `navClass` | `string` | `''` | Additional class applied to the internal `<nav>`. |
189
189
  | `itemTemplate` | `TemplateRef<unknown> \| null` | `null` | Optional custom item template. |
190
- | `autoOpenFromRoute` | `boolean` | `false` | Opens matching dropdowns/panels from the current route. |
190
+ | `autoOpenFromRoute` | `boolean` | `false` | Opens matching dropdowns/panels from the current route. It also re-derives the stack when the viewport comes back above `collapseBreakpoint`; with the input off, a stack opened by hand survives that round trip. |
191
191
  | `rail` | `boolean` (two-way `model`) | `false` | Desktop-only icon rail for vertical navs. Ignored below `collapseBreakpoint`. Bind with `[(rail)]`. |
192
192
  | `variant` | `'primary' \| 'success' \| 'danger' \| 'warning' \| 'info' \| string` | `'primary'` | Semantic accent for the hover/active affordances. Built-in values render with the design-system tints; any custom string resolves through `--hub-sys-color-<variant>`. |
193
193
 
@@ -3188,9 +3188,36 @@ class HubNavComponent {
3188
3188
  this.state.setCollapsed(belowBreakpoint);
3189
3189
  if (!belowBreakpoint) {
3190
3190
  this.state.closeAllDropdowns();
3191
- this.state.closeAllPanels();
3192
3191
  this.mobileToggle.emit(false);
3192
+ this.restorePanelsAfterExpand();
3193
+ }
3194
+ }
3195
+ /**
3196
+ * Rebuilds the panel stack when the viewport comes back above the breakpoint.
3197
+ *
3198
+ * Crossing back up used to empty the stack, and nothing refilled it: panels are derived from
3199
+ * the route only on navigation, so a sidebar that had been narrowed to mobile came back
3200
+ * expanded but with no section panel until the user navigated somewhere else. Host apps key
3201
+ * their own layout off that panel — hiding their in-page section index while the nav shows
3202
+ * one — so its absence unfolds a full-height menu over the page the user was reading.
3203
+ *
3204
+ * Rebuilding rather than simply not clearing, because the stack can be stale: while collapsed
3205
+ * the offcanvas menu navigates without touching the panels (they are not rendered in that
3206
+ * mode), so a surviving stack would describe the page the user left. Deriving it again from
3207
+ * the current URL is the only answer that holds whether or not the route moved meanwhile.
3208
+ *
3209
+ * Only when the route owns the panels. Without `autoOpenFromRoute` the stack is whatever the
3210
+ * user opened by hand and nothing can re-derive it, so it is left untouched — which is also
3211
+ * what makes the narrow/widen round trip end exactly where it started.
3212
+ */
3213
+ restorePanelsAfterExpand() {
3214
+ if (!this.autoOpenFromRoute()) {
3215
+ return;
3193
3216
  }
3217
+ // Forget the last synced path first: its guard would otherwise read a stack built for
3218
+ // another URL as one already in sync with this one, and skip the rebuild.
3219
+ this._lastSyncedPath = '';
3220
+ this.syncFromRoute(this.items(), this.currentUrl());
3194
3221
  }
3195
3222
  /**
3196
3223
  * Recomputes the collapsed state from the current viewport width.