@ojiepermana/angular 22.2.5 → 22.2.6

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 (12) hide show
  1. package/fesm2022/{ojiepermana-angular-navigation-navigation-badge-count.component-BYN_Vxm3.mjs → ojiepermana-angular-navigation-navigation-badge-count.component-D-WgBF6d.mjs} +98 -24
  2. package/fesm2022/{ojiepermana-angular-navigation-navigation-dockbar-menu.component-Dlyt6eZr.mjs → ojiepermana-angular-navigation-navigation-dockbar-menu.component-UrcWBqBk.mjs} +12 -10
  3. package/fesm2022/{ojiepermana-angular-navigation-navigation-entry-grid.component-DeF_s1vE.mjs → ojiepermana-angular-navigation-navigation-entry-grid.component-1WiRlut1.mjs} +13 -4
  4. package/fesm2022/{ojiepermana-angular-navigation-navigation-flyout-menu.component-BOGL8MY0.mjs → ojiepermana-angular-navigation-navigation-flyout-menu.component-dAVUnvwq.mjs} +2 -2
  5. package/fesm2022/{ojiepermana-angular-navigation-navigation-horizontal.component-Cb4bHM58.mjs → ojiepermana-angular-navigation-navigation-horizontal.component-OD_cAkg8.mjs} +6 -4
  6. package/fesm2022/{ojiepermana-angular-navigation-navigation-item.component-DLgcJQOC.mjs → ojiepermana-angular-navigation-navigation-item.component-6mJbQ94G.mjs} +74 -23
  7. package/fesm2022/{ojiepermana-angular-navigation-navigation-list.component-BYc3WCt8.mjs → ojiepermana-angular-navigation-navigation-list.component-DefF7_rB.mjs} +1 -1
  8. package/fesm2022/ojiepermana-angular-navigation.mjs +39 -14
  9. package/navigation/README.md +58 -2
  10. package/package.json +2 -2
  11. package/types/ojiepermana-angular-navigation.d.ts +1 -0
  12. package/types/ojiepermana-angular-theme-layout-wrapper.d.ts +1 -1
@@ -1,9 +1,8 @@
1
1
  import * as i0 from "@angular/core";
2
- import { Component, computed, input, isSignal } from "@angular/core";
2
+ import { Component, DestroyRef, InjectionToken, computed, effect, inject, input, signal, untracked } from "@angular/core";
3
3
  import { cn } from "@ojiepermana/angular/component/utils/core";
4
+ import { Subscription, catchError, isObservable, of, shareReplay } from "rxjs";
4
5
  import { formatNavigationBadgeCount } from "@ojiepermana/angular/navigation/types";
5
- import { toObservable, toSignal } from "@angular/core/rxjs-interop";
6
- import { catchError, isObservable, map, of, switchMap } from "rxjs";
7
6
  var __defProp = Object.defineProperty;
8
7
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9
8
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -28,31 +27,91 @@ var __copyProps = (to, from, except, desc) => {
28
27
  return to;
29
28
  };
30
29
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
30
+ const NAVIGATION_BADGE_STREAMS = new InjectionToken("NavigationBadgeStreams");
31
+ function normalizeNavigationBadgeCount(value) {
32
+ return value === null || value === void 0 || !Number.isFinite(value) ? 0 : Math.max(Math.trunc(value), 0);
33
+ }
34
+ function injectNavigationBadgeTotal(sources) {
35
+ const shared = inject(NAVIGATION_BADGE_STREAMS, { optional: true });
36
+ const snapshots = signal(/* @__PURE__ */ new Map(), ...ngDevMode ? [{ debugName: "snapshots" }] : /* istanbul ignore next */ []);
37
+ const subscriptions = /* @__PURE__ */ new Map();
38
+ effect(() => {
39
+ const streams = new Set(sources().map((source) => source.value).filter((value) => isObservable(value)));
40
+ untracked(() => {
41
+ for (const [stream, subscription] of subscriptions) if (!streams.has(stream)) {
42
+ subscription.unsubscribe();
43
+ subscriptions.delete(stream);
44
+ snapshots.update((previous) => {
45
+ const next = new Map(previous);
46
+ next.delete(stream);
47
+ return next;
48
+ });
49
+ }
50
+ for (const stream of streams) {
51
+ if (subscriptions.has(stream)) continue;
52
+ let resolved = shared?.get(stream);
53
+ if (!resolved) {
54
+ resolved = {
55
+ value: stream.pipe(catchError(() => of(null)), shareReplay({
56
+ bufferSize: 1,
57
+ refCount: true
58
+ })),
59
+ references: 0
60
+ };
61
+ shared?.set(stream, resolved);
62
+ }
63
+ const entry = resolved;
64
+ entry.references++;
65
+ const subscription = new Subscription(() => {
66
+ entry.references--;
67
+ if (entry.references === 0) shared?.delete(stream);
68
+ });
69
+ subscription.add(entry.value.subscribe((value) => {
70
+ snapshots.update((previous) => new Map(previous).set(stream, value));
71
+ }));
72
+ subscriptions.set(stream, subscription);
73
+ }
74
+ });
75
+ });
76
+ inject(DestroyRef).onDestroy(() => {
77
+ for (const subscription of subscriptions.values()) subscription.unsubscribe();
78
+ });
79
+ return () => sources().reduce((total, source) => {
80
+ const value = source.value;
81
+ return total + normalizeNavigationBadgeCount(isObservable(value) ? snapshots().get(value) : typeof value === "function" ? value() : value);
82
+ }, 0);
83
+ }
84
+ function navigationBadgeSourceKeys(items) {
85
+ const keys = /* @__PURE__ */ new Set();
86
+ const visit = (entries) => {
87
+ for (const item of entries) {
88
+ if (item.type === "divider" || item.type === "spacer") continue;
89
+ if (item.badge?.source) keys.add(item.badge.source);
90
+ visit(item.children);
91
+ }
92
+ };
93
+ visit(items);
94
+ return keys;
95
+ }
96
+ function hasNavigationCountBadge(item) {
97
+ return !!item.badge?.source || !item.badge?.title && navigationBadgeSourceKeys(item.children).size > 0;
98
+ }
99
+ function navigationDescendantBadgeSources(badge, children, context) {
100
+ if (badge?.source || badge?.title) return [];
101
+ return [...navigationBadgeSourceKeys(children)].filter((key) => Object.hasOwn(context, key) && context[key] != null).map((key) => context[key]);
102
+ }
31
103
  var navigation_badge_count_component_exports = /* @__PURE__ */ __exportAll({ NavigationBadgeCountComponent: () => NavigationBadgeCountComponent });
32
104
  var NavigationBadgeCountComponent = class NavigationBadgeCountComponent {
33
105
  badge = input(null, ...ngDevMode ? [{ debugName: "badge" }] : /* istanbul ignore next */ []);
34
106
  class = input("", ...ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []);
35
- observableSource = computed(() => {
36
- const value = this.badge()?.value;
37
- return isObservable(value) ? value : of(null);
38
- }, ...ngDevMode ? [{ debugName: "observableSource" }] : /* istanbul ignore next */ []);
39
- observableValue = toSignal(toObservable(this.observableSource).pipe(switchMap((source) => source.pipe(catchError(() => of(null)), map((value) => ({
40
- source,
41
- value
42
- }))))), { initialValue: null });
43
- rawValue() {
44
- const value = this.badge()?.value;
45
- if (isObservable(value)) {
46
- const snapshot = this.observableValue();
47
- return snapshot?.source === value ? snapshot.value : null;
48
- }
49
- if (isSignal(value)) return value();
50
- if (typeof value === "function") return value();
51
- return value;
52
- }
107
+ sources = input(null, ...ngDevMode ? [{ debugName: "sources" }] : /* istanbul ignore next */ []);
108
+ selectedSources = computed(() => {
109
+ const badge = this.badge();
110
+ return this.sources() ?? (badge ? [badge] : []);
111
+ }, ...ngDevMode ? [{ debugName: "selectedSources" }] : /* istanbul ignore next */ []);
112
+ total = injectNavigationBadgeTotal(this.selectedSources);
53
113
  resolvedBadge() {
54
- const value = this.rawValue();
55
- const count = value === null || value === void 0 || !Number.isFinite(value) ? 0 : Math.max(Math.trunc(value), 0);
114
+ const count = this.total();
56
115
  const display = formatNavigationBadgeCount(count);
57
116
  if (display === null) return null;
58
117
  const label = this.badge()?.ariaLabel;
@@ -91,6 +150,13 @@ var NavigationBadgeCountComponent = class NavigationBadgeCountComponent {
91
150
  isSignal: true,
92
151
  isRequired: false,
93
152
  transformFunction: null
153
+ },
154
+ sources: {
155
+ classPropertyName: "sources",
156
+ publicName: "sources",
157
+ isSignal: true,
158
+ isRequired: false,
159
+ transformFunction: null
94
160
  }
95
161
  },
96
162
  host: { classAttribute: "contents" },
@@ -154,7 +220,15 @@ i0.ɵɵngDeclareClassMetadata({
154
220
  alias: "class",
155
221
  required: false
156
222
  }]
223
+ }],
224
+ sources: [{
225
+ type: i0.Input,
226
+ args: [{
227
+ isSignal: true,
228
+ alias: "sources",
229
+ required: false
230
+ }]
157
231
  }]
158
232
  }
159
233
  });
160
- export { __reExport as i, navigation_badge_count_component_exports as n, __exportAll as r, NavigationBadgeCountComponent as t };
234
+ export { injectNavigationBadgeTotal as a, __exportAll as c, hasNavigationCountBadge as i, __reExport as l, navigation_badge_count_component_exports as n, navigationBadgeSourceKeys as o, NAVIGATION_BADGE_STREAMS as r, navigationDescendantBadgeSources as s, NavigationBadgeCountComponent as t };
@@ -1,5 +1,6 @@
1
- import { n as NAVIGATION_SHELL, t as NavigationListComponent } from "./ojiepermana-angular-navigation-navigation-list.component-BYc3WCt8.mjs";
2
- import { r as NavigationItemContentComponent, t as NavigationItemComponent } from "./ojiepermana-angular-navigation-navigation-item.component-DLgcJQOC.mjs";
1
+ import { i as hasNavigationCountBadge } from "./ojiepermana-angular-navigation-navigation-badge-count.component-D-WgBF6d.mjs";
2
+ import { n as NAVIGATION_SHELL, t as NavigationListComponent } from "./ojiepermana-angular-navigation-navigation-list.component-DefF7_rB.mjs";
3
+ import { r as NavigationItemContentComponent, t as NavigationItemComponent } from "./ojiepermana-angular-navigation-navigation-item.component-6mJbQ94G.mjs";
3
4
  import * as i0 from "@angular/core";
4
5
  import { Component, ElementRef, Injector, afterNextRender, computed, inject, input, output, signal } from "@angular/core";
5
6
  import { cn } from "@ojiepermana/angular/component/utils/core";
@@ -10,6 +11,7 @@ import { IconComponent, provideIcons } from "@ojiepermana/angular/component/icon
10
11
  import { TooltipDirective } from "@ojiepermana/angular/component/tooltip";
11
12
  const EMPTY_NAVIGATION_BADGE_CONTEXT = Object.freeze({});
12
13
  var NavigationDockbarMenuComponent = class NavigationDockbarMenuComponent {
14
+ hasCountBadge = hasNavigationCountBadge;
13
15
  nav = inject(NAVIGATION_ADAPTER);
14
16
  host = inject(ElementRef);
15
17
  injector = inject(Injector);
@@ -312,7 +314,7 @@ var NavigationDockbarMenuComponent = class NavigationDockbarMenuComponent {
312
314
  [attr.aria-expanded]="isGroupOpen(entry)"
313
315
  [attr.aria-controls]="asideId()"
314
316
  [attr.aria-label]="
315
- entry.badge?.source ? null : (entry.tooltip ?? entry.title ?? null)
317
+ hasCountBadge(entry) ? null : (entry.tooltip ?? entry.title ?? null)
316
318
  "
317
319
  [attr.title]="isGroupOpen(entry) ? null : (entry.tooltip ?? entry.title ?? null)"
318
320
  [Tooltip]="entry.tooltip ?? entry.title ?? ''"
@@ -369,11 +371,11 @@ var NavigationDockbarMenuComponent = class NavigationDockbarMenuComponent {
369
371
  }
370
372
 
371
373
  <!-- Drawer non-modal: rail tetap interaktif di atas backdrop, jadi tanpa aria-modal. -->
372
- <aside
374
+ <div
373
375
  [id]="asideId()"
374
376
  [class]="asideClasses()"
375
377
  data-navigation-dockbar-aside="true"
376
- [attr.role]="isDrawerMode() ? 'dialog' : null"
378
+ [attr.role]="isDrawerMode() ? 'dialog' : 'complementary'"
377
379
  [attr.aria-labelledby]="asideHeadingId()"
378
380
  >
379
381
  <header
@@ -435,7 +437,7 @@ var NavigationDockbarMenuComponent = class NavigationDockbarMenuComponent {
435
437
  />
436
438
  </footer>
437
439
  }
438
- </aside>
440
+ </div>
439
441
  }
440
442
  `,
441
443
  isInline: true,
@@ -578,7 +580,7 @@ i0.ɵɵngDeclareClassMetadata({
578
580
  [attr.aria-expanded]="isGroupOpen(entry)"
579
581
  [attr.aria-controls]="asideId()"
580
582
  [attr.aria-label]="
581
- entry.badge?.source ? null : (entry.tooltip ?? entry.title ?? null)
583
+ hasCountBadge(entry) ? null : (entry.tooltip ?? entry.title ?? null)
582
584
  "
583
585
  [attr.title]="isGroupOpen(entry) ? null : (entry.tooltip ?? entry.title ?? null)"
584
586
  [Tooltip]="entry.tooltip ?? entry.title ?? ''"
@@ -635,11 +637,11 @@ i0.ɵɵngDeclareClassMetadata({
635
637
  }
636
638
 
637
639
  <!-- Drawer non-modal: rail tetap interaktif di atas backdrop, jadi tanpa aria-modal. -->
638
- <aside
640
+ <div
639
641
  [id]="asideId()"
640
642
  [class]="asideClasses()"
641
643
  data-navigation-dockbar-aside="true"
642
- [attr.role]="isDrawerMode() ? 'dialog' : null"
644
+ [attr.role]="isDrawerMode() ? 'dialog' : 'complementary'"
643
645
  [attr.aria-labelledby]="asideHeadingId()"
644
646
  >
645
647
  <header
@@ -701,7 +703,7 @@ i0.ɵɵngDeclareClassMetadata({
701
703
  />
702
704
  </footer>
703
705
  }
704
- </aside>
706
+ </div>
705
707
  }
706
708
  `
707
709
  }]
@@ -1,4 +1,4 @@
1
- import { i as NavigationItemBadgeComponent, n as navigationPanelId, t as NavigationItemComponent } from "./ojiepermana-angular-navigation-navigation-item.component-DLgcJQOC.mjs";
1
+ import { i as NavigationItemBadgeComponent, n as navigationPanelId, t as NavigationItemComponent } from "./ojiepermana-angular-navigation-navigation-item.component-6mJbQ94G.mjs";
2
2
  import * as i0 from "@angular/core";
3
3
  import { Component, computed, inject, input, output, signal } from "@angular/core";
4
4
  import { ActivatedRoute, Router, RouterLink } from "@angular/router";
@@ -411,7 +411,11 @@ var NavigationEntryGridComponent = class NavigationEntryGridComponent {
411
411
  }
412
412
  </span>
413
413
 
414
- <NavigationItemBadge [itemBadge]="child.badge" [badgeContext]="badgeContext()" />
414
+ <NavigationItemBadge
415
+ [children]="child.children"
416
+ [itemBadge]="child.badge"
417
+ [badgeContext]="badgeContext()"
418
+ />
415
419
  </ng-template>
416
420
  `,
417
421
  isInline: true,
@@ -491,7 +495,8 @@ var NavigationEntryGridComponent = class NavigationEntryGridComponent {
491
495
  "staticClass",
492
496
  "compact",
493
497
  "itemBadge",
494
- "badgeContext"
498
+ "badgeContext",
499
+ "children"
495
500
  ]
496
501
  }
497
502
  ]
@@ -715,7 +720,11 @@ i0.ɵɵngDeclareClassMetadata({
715
720
  }
716
721
  </span>
717
722
 
718
- <NavigationItemBadge [itemBadge]="child.badge" [badgeContext]="badgeContext()" />
723
+ <NavigationItemBadge
724
+ [children]="child.children"
725
+ [itemBadge]="child.badge"
726
+ [badgeContext]="badgeContext()"
727
+ />
719
728
  </ng-template>
720
729
  `
721
730
  }]
@@ -1,5 +1,5 @@
1
- import { r as NavigationItemContentComponent, t as NavigationItemComponent } from "./ojiepermana-angular-navigation-navigation-item.component-DLgcJQOC.mjs";
2
- import { t as NavigationEntryGridComponent } from "./ojiepermana-angular-navigation-navigation-entry-grid.component-DeF_s1vE.mjs";
1
+ import { r as NavigationItemContentComponent, t as NavigationItemComponent } from "./ojiepermana-angular-navigation-navigation-item.component-6mJbQ94G.mjs";
2
+ import { t as NavigationEntryGridComponent } from "./ojiepermana-angular-navigation-navigation-entry-grid.component-1WiRlut1.mjs";
3
3
  import * as i0 from "@angular/core";
4
4
  import { Component, ElementRef, Injector, afterNextRender, computed, effect, inject, input, output, signal } from "@angular/core";
5
5
  import { cn } from "@ojiepermana/angular/component/utils/core";
@@ -1,11 +1,13 @@
1
- import { n as navigationPanelId, r as NavigationItemContentComponent, t as NavigationItemComponent } from "./ojiepermana-angular-navigation-navigation-item.component-DLgcJQOC.mjs";
2
- import { t as NavigationEntryGridComponent } from "./ojiepermana-angular-navigation-navigation-entry-grid.component-DeF_s1vE.mjs";
1
+ import { i as hasNavigationCountBadge } from "./ojiepermana-angular-navigation-navigation-badge-count.component-D-WgBF6d.mjs";
2
+ import { n as navigationPanelId, r as NavigationItemContentComponent, t as NavigationItemComponent } from "./ojiepermana-angular-navigation-navigation-item.component-6mJbQ94G.mjs";
3
+ import { t as NavigationEntryGridComponent } from "./ojiepermana-angular-navigation-navigation-entry-grid.component-1WiRlut1.mjs";
3
4
  import * as i0 from "@angular/core";
4
5
  import { Component, ElementRef, Injector, afterNextRender, computed, effect, inject, input, output, signal } from "@angular/core";
5
6
  import { cn } from "@ojiepermana/angular/component/utils/core";
6
7
  import { NAVIGATION_ADAPTER } from "@ojiepermana/angular/navigation/core";
7
8
  import { DOCUMENT, NgTemplateOutlet } from "@angular/common";
8
9
  var NavigationHorizontalComponent = class NavigationHorizontalComponent {
10
+ hasCountBadge = hasNavigationCountBadge;
9
11
  nav = inject(NAVIGATION_ADAPTER);
10
12
  host = inject(ElementRef);
11
13
  injector = inject(Injector);
@@ -326,7 +328,7 @@ var NavigationHorizontalComponent = class NavigationHorizontalComponent {
326
328
  [attr.aria-expanded]="isPanelOpen(item)"
327
329
  [attr.aria-controls]="isPanelOpen(item) ? panelIdFor(item) : null"
328
330
  [attr.aria-haspopup]="'menu'"
329
- [attr.aria-label]="item.badge?.source ? null : compactLabel(item)"
331
+ [attr.aria-label]="hasCountBadge(item) ? null : compactLabel(item)"
330
332
  [attr.title]="titleFor(item)"
331
333
  [disabled]="item.disabled || null"
332
334
  (click)="togglePanel(item)"
@@ -520,7 +522,7 @@ i0.ɵɵngDeclareClassMetadata({
520
522
  [attr.aria-expanded]="isPanelOpen(item)"
521
523
  [attr.aria-controls]="isPanelOpen(item) ? panelIdFor(item) : null"
522
524
  [attr.aria-haspopup]="'menu'"
523
- [attr.aria-label]="item.badge?.source ? null : compactLabel(item)"
525
+ [attr.aria-label]="hasCountBadge(item) ? null : compactLabel(item)"
524
526
  [attr.title]="titleFor(item)"
525
527
  [disabled]="item.disabled || null"
526
528
  (click)="togglePanel(item)"
@@ -1,4 +1,4 @@
1
- import { t as NavigationBadgeCountComponent } from "./ojiepermana-angular-navigation-navigation-badge-count.component-BYN_Vxm3.mjs";
1
+ import { i as hasNavigationCountBadge, s as navigationDescendantBadgeSources, t as NavigationBadgeCountComponent } from "./ojiepermana-angular-navigation-navigation-badge-count.component-D-WgBF6d.mjs";
2
2
  import * as i0 from "@angular/core";
3
3
  import { Component, computed, inject, input, output, signal } from "@angular/core";
4
4
  import { ActivatedRoute, Router, RouterLink } from "@angular/router";
@@ -14,6 +14,8 @@ var NavigationItemBadgeComponent = class NavigationItemBadgeComponent {
14
14
  countClasses = computed(() => cn(this.compact() && "nav-count-overlay", this.itemBadge()?.classes), ...ngDevMode ? [{ debugName: "countClasses" }] : /* istanbul ignore next */ []);
15
15
  itemBadge = input(...ngDevMode ? [void 0, { debugName: "itemBadge" }] : /* istanbul ignore next */ []);
16
16
  badgeContext = input({}, ...ngDevMode ? [{ debugName: "badgeContext" }] : /* istanbul ignore next */ []);
17
+ children = input([], ...ngDevMode ? [{ debugName: "children" }] : /* istanbul ignore next */ []);
18
+ descendantSources = computed(() => navigationDescendantBadgeSources(this.itemBadge(), this.children(), this.badgeContext()), ...ngDevMode ? [{ debugName: "descendantSources" }] : /* istanbul ignore next */ []);
17
19
  source = computed(() => {
18
20
  const key = this.itemBadge()?.source;
19
21
  return key && Object.hasOwn(this.badgeContext(), key) ? this.badgeContext()[key] : null;
@@ -60,13 +62,24 @@ var NavigationItemBadgeComponent = class NavigationItemBadgeComponent {
60
62
  isSignal: true,
61
63
  isRequired: false,
62
64
  transformFunction: null
65
+ },
66
+ children: {
67
+ classPropertyName: "children",
68
+ publicName: "children",
69
+ isSignal: true,
70
+ isRequired: false,
71
+ transformFunction: null
63
72
  }
64
73
  },
65
74
  host: { classAttribute: "contents" },
66
75
  ngImport: i0,
67
76
  template: `
68
- @if (itemBadge()?.source) {
69
- <NavigationBadgeCount [badge]="source()" [class]="countClasses()" />
77
+ @if (itemBadge()?.source || descendantSources().length) {
78
+ <NavigationBadgeCount
79
+ [badge]="source()"
80
+ [sources]="itemBadge()?.source ? null : descendantSources()"
81
+ [class]="countClasses()"
82
+ />
70
83
  } @else if (!compact() && itemBadge()?.title; as title) {
71
84
  <span data-navigation-badge-text="true" [class]="itemBadge()?.classes ?? staticClass()">{{
72
85
  title
@@ -78,7 +91,11 @@ var NavigationItemBadgeComponent = class NavigationItemBadgeComponent {
78
91
  kind: "component",
79
92
  type: NavigationBadgeCountComponent,
80
93
  selector: "NavigationBadgeCount",
81
- inputs: ["badge", "class"]
94
+ inputs: [
95
+ "badge",
96
+ "class",
97
+ "sources"
98
+ ]
82
99
  }]
83
100
  });
84
101
  };
@@ -94,8 +111,12 @@ i0.ɵɵngDeclareClassMetadata({
94
111
  imports: [NavigationBadgeCountComponent],
95
112
  host: { class: "contents" },
96
113
  template: `
97
- @if (itemBadge()?.source) {
98
- <NavigationBadgeCount [badge]="source()" [class]="countClasses()" />
114
+ @if (itemBadge()?.source || descendantSources().length) {
115
+ <NavigationBadgeCount
116
+ [badge]="source()"
117
+ [sources]="itemBadge()?.source ? null : descendantSources()"
118
+ [class]="countClasses()"
119
+ />
99
120
  } @else if (!compact() && itemBadge()?.title; as title) {
100
121
  <span data-navigation-badge-text="true" [class]="itemBadge()?.classes ?? staticClass()">{{
101
122
  title
@@ -136,10 +157,19 @@ i0.ɵɵngDeclareClassMetadata({
136
157
  alias: "badgeContext",
137
158
  required: false
138
159
  }]
160
+ }],
161
+ children: [{
162
+ type: i0.Input,
163
+ args: [{
164
+ isSignal: true,
165
+ alias: "children",
166
+ required: false
167
+ }]
139
168
  }]
140
169
  }
141
170
  });
142
171
  var NavigationItemContentComponent = class NavigationItemContentComponent {
172
+ hasCountBadge = hasNavigationCountBadge;
143
173
  nav = inject(NAVIGATION_ADAPTER);
144
174
  badgeContext = input({}, ...ngDevMode ? [{ debugName: "badgeContext" }] : /* istanbul ignore next */ []);
145
175
  item = input.required(...ngDevMode ? [{ debugName: "item" }] : /* istanbul ignore next */ []);
@@ -148,7 +178,7 @@ var NavigationItemContentComponent = class NavigationItemContentComponent {
148
178
  orientation = input("vertical", ...ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []);
149
179
  level = input(0, ...ngDevMode ? [{ debugName: "level" }] : /* istanbul ignore next */ []);
150
180
  iconTemplate = input(void 0, ...ngDevMode ? [{ debugName: "iconTemplate" }] : /* istanbul ignore next */ []);
151
- hasIconSlot = computed(() => !!this.item().icon || !!this.item().badge?.source, ...ngDevMode ? [{ debugName: "hasIconSlot" }] : /* istanbul ignore next */ []);
181
+ hasIconSlot = computed(() => !!this.item().icon || hasNavigationCountBadge(this.item()), ...ngDevMode ? [{ debugName: "hasIconSlot" }] : /* istanbul ignore next */ []);
152
182
  iconSlotClasses = computed(() => cn("relative z-10 inline-flex shrink-0 items-center justify-center transition-colors duration-normal", this.compact() && "mx-auto", this.active() ? "text-current" : "text-muted-foreground group-hover/nav:text-current"), ...ngDevMode ? [{ debugName: "iconSlotClasses" }] : /* istanbul ignore next */ []);
153
183
  titleClasses = computed(() => cn("block truncate", this.active() && "text-foreground", this.item().classes?.title), ...ngDevMode ? [{ debugName: "titleClasses" }] : /* istanbul ignore next */ []);
154
184
  showSubtitle = computed(() => !!this.item().subtitle && !(this.orientation() === "horizontal" && this.level() === 0), ...ngDevMode ? [{ debugName: "showSubtitle" }] : /* istanbul ignore next */ []);
@@ -234,7 +264,7 @@ var NavigationItemContentComponent = class NavigationItemContentComponent {
234
264
  [attr.data-navigation-icon-slot]="compact() && hasIconSlot() ? 'true' : null"
235
265
  [class]="compact() && hasIconSlot() ? iconSlotClasses() : 'contents'"
236
266
  >
237
- @if (compact() && item().badge?.source) {
267
+ @if (compact() && hasCountBadge(item())) {
238
268
  <span class="sr-only">{{ item().tooltip ?? item().title }}</span>
239
269
  }
240
270
  @if (item().icon; as iconName) {
@@ -263,6 +293,7 @@ var NavigationItemContentComponent = class NavigationItemContentComponent {
263
293
  <span aria-hidden="true" [class]="compactFallbackClasses()">{{ compactFallback() }}</span>
264
294
  }
265
295
  <NavigationItemBadge
296
+ [children]="item().children"
266
297
  [itemBadge]="item().badge"
267
298
  [badgeContext]="badgeContext()"
268
299
  [compact]="compact()"
@@ -302,7 +333,8 @@ var NavigationItemContentComponent = class NavigationItemContentComponent {
302
333
  "staticClass",
303
334
  "compact",
304
335
  "itemBadge",
305
- "badgeContext"
336
+ "badgeContext",
337
+ "children"
306
338
  ]
307
339
  }
308
340
  ]
@@ -330,7 +362,7 @@ i0.ɵɵngDeclareClassMetadata({
330
362
  [attr.data-navigation-icon-slot]="compact() && hasIconSlot() ? 'true' : null"
331
363
  [class]="compact() && hasIconSlot() ? iconSlotClasses() : 'contents'"
332
364
  >
333
- @if (compact() && item().badge?.source) {
365
+ @if (compact() && hasCountBadge(item())) {
334
366
  <span class="sr-only">{{ item().tooltip ?? item().title }}</span>
335
367
  }
336
368
  @if (item().icon; as iconName) {
@@ -359,6 +391,7 @@ i0.ɵɵngDeclareClassMetadata({
359
391
  <span aria-hidden="true" [class]="compactFallbackClasses()">{{ compactFallback() }}</span>
360
392
  }
361
393
  <NavigationItemBadge
394
+ [children]="item().children"
362
395
  [itemBadge]="item().badge"
363
396
  [badgeContext]="badgeContext()"
364
397
  [compact]="compact()"
@@ -437,6 +470,7 @@ function safeNavId(value) {
437
470
  return value.trim().toLowerCase().replace(/[^a-z0-9_-]+/g, "-") || "default";
438
471
  }
439
472
  var NavigationItemComponent = class NavigationItemComponent {
473
+ hasCountBadge = hasNavigationCountBadge;
440
474
  nav = inject(NAVIGATION_ADAPTER);
441
475
  routeContext = inject(NAVIGATION_ROUTE_CONTEXT_ADAPTER);
442
476
  router = inject(Router, { optional: true });
@@ -762,7 +796,11 @@ var NavigationItemComponent = class NavigationItemComponent {
762
796
  </span>
763
797
  }
764
798
  </span>
765
- <NavigationItemBadge [itemBadge]="item().badge" [badgeContext]="badgeContext()" />
799
+ <NavigationItemBadge
800
+ [children]="item().children"
801
+ [itemBadge]="item().badge"
802
+ [badgeContext]="badgeContext()"
803
+ />
766
804
  </div>
767
805
  }
768
806
 
@@ -781,7 +819,7 @@ var NavigationItemComponent = class NavigationItemComponent {
781
819
  [class]="triggerClasses(isActive())"
782
820
  [attr.aria-expanded]="showChildren()"
783
821
  [attr.aria-controls]="showChildren() ? panelId() : null"
784
- [attr.aria-label]="item().badge?.source ? null : compactLabel()"
822
+ [attr.aria-label]="hasCountBadge(item()) ? null : compactLabel()"
785
823
  [attr.title]="titleFor()"
786
824
  [Tooltip]="compact() ? (titleFor() ?? '') : ''"
787
825
  [TooltipPosition]="tooltipPosition()"
@@ -814,7 +852,11 @@ var NavigationItemComponent = class NavigationItemComponent {
814
852
  @if (!compact() && item().title) {
815
853
  <div [id]="headingId()" [class]="groupHeadingClasses()">
816
854
  <span class="min-w-0 flex-1 truncate">{{ item().title }}</span>
817
- <NavigationItemBadge [itemBadge]="item().badge" [badgeContext]="badgeContext()" />
855
+ <NavigationItemBadge
856
+ [children]="item().children"
857
+ [itemBadge]="item().badge"
858
+ [badgeContext]="badgeContext()"
859
+ />
818
860
  </div>
819
861
  }
820
862
 
@@ -841,7 +883,7 @@ var NavigationItemComponent = class NavigationItemComponent {
841
883
  [attr.aria-current]="isRouterItemActive() ? 'page' : null"
842
884
  [attr.aria-disabled]="item().disabled || null"
843
885
  [attr.tabindex]="leafTabIndex()"
844
- [attr.aria-label]="item().badge?.source ? null : compactLabel()"
886
+ [attr.aria-label]="hasCountBadge(item()) ? null : compactLabel()"
845
887
  [attr.title]="titleFor()"
846
888
  [Tooltip]="compact() ? (titleFor() ?? '') : ''"
847
889
  [TooltipPosition]="tooltipPosition()"
@@ -868,7 +910,7 @@ var NavigationItemComponent = class NavigationItemComponent {
868
910
  [attr.aria-current]="isActive() ? 'page' : null"
869
911
  [attr.aria-disabled]="item().disabled || null"
870
912
  [attr.tabindex]="leafTabIndex()"
871
- [attr.aria-label]="item().badge?.source ? null : compactLabel()"
913
+ [attr.aria-label]="hasCountBadge(item()) ? null : compactLabel()"
872
914
  [attr.title]="titleFor()"
873
915
  [Tooltip]="compact() ? (titleFor() ?? '') : ''"
874
916
  [TooltipPosition]="tooltipPosition()"
@@ -892,7 +934,7 @@ var NavigationItemComponent = class NavigationItemComponent {
892
934
  [class]="leafClasses(isActive())"
893
935
  [disabled]="item().disabled || null"
894
936
  [attr.aria-current]="isActive() ? 'page' : null"
895
- [attr.aria-label]="item().badge?.source ? null : compactLabel()"
937
+ [attr.aria-label]="hasCountBadge(item()) ? null : compactLabel()"
896
938
  [attr.title]="titleFor()"
897
939
  [Tooltip]="compact() ? (titleFor() ?? '') : ''"
898
940
  [TooltipPosition]="tooltipPosition()"
@@ -1015,7 +1057,8 @@ var NavigationItemComponent = class NavigationItemComponent {
1015
1057
  "staticClass",
1016
1058
  "compact",
1017
1059
  "itemBadge",
1018
- "badgeContext"
1060
+ "badgeContext",
1061
+ "children"
1019
1062
  ]
1020
1063
  },
1021
1064
  {
@@ -1110,7 +1153,11 @@ i0.ɵɵngDeclareClassMetadata({
1110
1153
  </span>
1111
1154
  }
1112
1155
  </span>
1113
- <NavigationItemBadge [itemBadge]="item().badge" [badgeContext]="badgeContext()" />
1156
+ <NavigationItemBadge
1157
+ [children]="item().children"
1158
+ [itemBadge]="item().badge"
1159
+ [badgeContext]="badgeContext()"
1160
+ />
1114
1161
  </div>
1115
1162
  }
1116
1163
 
@@ -1129,7 +1176,7 @@ i0.ɵɵngDeclareClassMetadata({
1129
1176
  [class]="triggerClasses(isActive())"
1130
1177
  [attr.aria-expanded]="showChildren()"
1131
1178
  [attr.aria-controls]="showChildren() ? panelId() : null"
1132
- [attr.aria-label]="item().badge?.source ? null : compactLabel()"
1179
+ [attr.aria-label]="hasCountBadge(item()) ? null : compactLabel()"
1133
1180
  [attr.title]="titleFor()"
1134
1181
  [Tooltip]="compact() ? (titleFor() ?? '') : ''"
1135
1182
  [TooltipPosition]="tooltipPosition()"
@@ -1162,7 +1209,11 @@ i0.ɵɵngDeclareClassMetadata({
1162
1209
  @if (!compact() && item().title) {
1163
1210
  <div [id]="headingId()" [class]="groupHeadingClasses()">
1164
1211
  <span class="min-w-0 flex-1 truncate">{{ item().title }}</span>
1165
- <NavigationItemBadge [itemBadge]="item().badge" [badgeContext]="badgeContext()" />
1212
+ <NavigationItemBadge
1213
+ [children]="item().children"
1214
+ [itemBadge]="item().badge"
1215
+ [badgeContext]="badgeContext()"
1216
+ />
1166
1217
  </div>
1167
1218
  }
1168
1219
 
@@ -1189,7 +1240,7 @@ i0.ɵɵngDeclareClassMetadata({
1189
1240
  [attr.aria-current]="isRouterItemActive() ? 'page' : null"
1190
1241
  [attr.aria-disabled]="item().disabled || null"
1191
1242
  [attr.tabindex]="leafTabIndex()"
1192
- [attr.aria-label]="item().badge?.source ? null : compactLabel()"
1243
+ [attr.aria-label]="hasCountBadge(item()) ? null : compactLabel()"
1193
1244
  [attr.title]="titleFor()"
1194
1245
  [Tooltip]="compact() ? (titleFor() ?? '') : ''"
1195
1246
  [TooltipPosition]="tooltipPosition()"
@@ -1216,7 +1267,7 @@ i0.ɵɵngDeclareClassMetadata({
1216
1267
  [attr.aria-current]="isActive() ? 'page' : null"
1217
1268
  [attr.aria-disabled]="item().disabled || null"
1218
1269
  [attr.tabindex]="leafTabIndex()"
1219
- [attr.aria-label]="item().badge?.source ? null : compactLabel()"
1270
+ [attr.aria-label]="hasCountBadge(item()) ? null : compactLabel()"
1220
1271
  [attr.title]="titleFor()"
1221
1272
  [Tooltip]="compact() ? (titleFor() ?? '') : ''"
1222
1273
  [TooltipPosition]="tooltipPosition()"
@@ -1240,7 +1291,7 @@ i0.ɵɵngDeclareClassMetadata({
1240
1291
  [class]="leafClasses(isActive())"
1241
1292
  [disabled]="item().disabled || null"
1242
1293
  [attr.aria-current]="isActive() ? 'page' : null"
1243
- [attr.aria-label]="item().badge?.source ? null : compactLabel()"
1294
+ [attr.aria-label]="hasCountBadge(item()) ? null : compactLabel()"
1244
1295
  [attr.title]="titleFor()"
1245
1296
  [Tooltip]="compact() ? (titleFor() ?? '') : ''"
1246
1297
  [TooltipPosition]="tooltipPosition()"
@@ -1,4 +1,4 @@
1
- import { t as NavigationItemComponent } from "./ojiepermana-angular-navigation-navigation-item.component-DLgcJQOC.mjs";
1
+ import { t as NavigationItemComponent } from "./ojiepermana-angular-navigation-navigation-item.component-6mJbQ94G.mjs";
2
2
  import * as i0 from "@angular/core";
3
3
  import { Component, InjectionToken, computed, input, output } from "@angular/core";
4
4
  import { cn } from "@ojiepermana/angular/component/utils/core";
@@ -1,5 +1,5 @@
1
- import "./ojiepermana-angular-navigation-navigation-badge-count.component-BYN_Vxm3.mjs";
2
- import { n as NAVIGATION_SHELL, t as NavigationListComponent } from "./ojiepermana-angular-navigation-navigation-list.component-BYc3WCt8.mjs";
1
+ import { a as injectNavigationBadgeTotal, o as navigationBadgeSourceKeys, r as NAVIGATION_BADGE_STREAMS, s as navigationDescendantBadgeSources } from "./ojiepermana-angular-navigation-navigation-badge-count.component-D-WgBF6d.mjs";
2
+ import { n as NAVIGATION_SHELL, t as NavigationListComponent } from "./ojiepermana-angular-navigation-navigation-list.component-DefF7_rB.mjs";
3
3
  import * as i0 from "@angular/core";
4
4
  import { Component, DestroyRef, Directive, ElementRef, Injector, TemplateRef, ViewContainerRef, afterNextRender, booleanAttribute, computed, contentChild, effect, forwardRef, inject, input, isDevMode, model, output, signal } from "@angular/core";
5
5
  import { ActivatedRoute } from "@angular/router";
@@ -252,6 +252,12 @@ var NavigationContainerComponent = class NavigationContainerComponent {
252
252
  if (!this.motionArmed()) this.motionArmed.set(true);
253
253
  }
254
254
  constructor() {
255
+ injectNavigationBadgeTotal(computed(() => {
256
+ const context = this.resolvedBadgeContext();
257
+ const sources = [...navigationBadgeSourceKeys(this.normalizedItems())].filter((key) => Object.hasOwn(context, key) && context[key] != null).map((key) => context[key]);
258
+ const headerBadge = this.dockbarRouteHeaderVisible() ? this.dockbarRouteHeader()?.badge : null;
259
+ return headerBadge ? [...sources, headerBadge] : sources;
260
+ }));
255
261
  effect((onCleanup) => {
256
262
  const dataId = this.resolvedDataId();
257
263
  this.nav.publishData(dataId, this.data(), this.dataOwner);
@@ -447,6 +453,9 @@ var NavigationContainerComponent = class NavigationContainerComponent {
447
453
  }
448
454
  },
449
455
  providers: [{
456
+ provide: NAVIGATION_BADGE_STREAMS,
457
+ useFactory: () => /* @__PURE__ */ new WeakMap()
458
+ }, {
450
459
  provide: NAVIGATION_SHELL,
451
460
  useExisting: forwardRef(() => NavigationContainerComponent)
452
461
  }],
@@ -472,6 +481,9 @@ i0.ɵɵngDeclareClassMetadata({
472
481
  args: [{
473
482
  selector: "Navigation",
474
483
  providers: [{
484
+ provide: NAVIGATION_BADGE_STREAMS,
485
+ useFactory: () => /* @__PURE__ */ new WeakMap()
486
+ }, {
475
487
  provide: NAVIGATION_SHELL,
476
488
  useExisting: forwardRef(() => NavigationContainerComponent)
477
489
  }],
@@ -788,9 +800,9 @@ var NavigationContentComponent = class NavigationContentComponent {
788
800
  outputs: ["openedIdsChange", "itemSelected"]
789
801
  }],
790
802
  deferBlockDependencies: [
791
- () => [import("./ojiepermana-angular-navigation-navigation-flyout-menu.component-BOGL8MY0.mjs").then((m) => m.NavigationFlyoutMenuComponent)],
792
- () => [import("./ojiepermana-angular-navigation-navigation-horizontal.component-Cb4bHM58.mjs").then((m) => m.NavigationHorizontalComponent)],
793
- () => [import("./ojiepermana-angular-navigation-navigation-dockbar-menu.component-Dlyt6eZr.mjs").then((m) => m.NavigationDockbarMenuComponent)]
803
+ () => [import("./ojiepermana-angular-navigation-navigation-flyout-menu.component-dAVUnvwq.mjs").then((m) => m.NavigationFlyoutMenuComponent)],
804
+ () => [import("./ojiepermana-angular-navigation-navigation-horizontal.component-OD_cAkg8.mjs").then((m) => m.NavigationHorizontalComponent)],
805
+ () => [import("./ojiepermana-angular-navigation-navigation-dockbar-menu.component-UrcWBqBk.mjs").then((m) => m.NavigationDockbarMenuComponent)]
794
806
  ]
795
807
  });
796
808
  };
@@ -800,9 +812,9 @@ i0.ɵɵngDeclareClassMetadataAsync({
800
812
  ngImport: i0,
801
813
  type: NavigationContentComponent,
802
814
  resolveDeferredDeps: () => [
803
- import("./ojiepermana-angular-navigation-navigation-flyout-menu.component-BOGL8MY0.mjs").then((m) => m.NavigationFlyoutMenuComponent),
804
- import("./ojiepermana-angular-navigation-navigation-horizontal.component-Cb4bHM58.mjs").then((m) => m.NavigationHorizontalComponent),
805
- import("./ojiepermana-angular-navigation-navigation-dockbar-menu.component-Dlyt6eZr.mjs").then((m) => m.NavigationDockbarMenuComponent)
815
+ import("./ojiepermana-angular-navigation-navigation-flyout-menu.component-dAVUnvwq.mjs").then((m) => m.NavigationFlyoutMenuComponent),
816
+ import("./ojiepermana-angular-navigation-navigation-horizontal.component-OD_cAkg8.mjs").then((m) => m.NavigationHorizontalComponent),
817
+ import("./ojiepermana-angular-navigation-navigation-dockbar-menu.component-UrcWBqBk.mjs").then((m) => m.NavigationDockbarMenuComponent)
806
818
  ],
807
819
  resolveMetadata: (NavigationFlyoutMenuComponent, NavigationHorizontalComponent, NavigationDockbarMenuComponent) => ({
808
820
  decorators: [{
@@ -1454,6 +1466,11 @@ var NavigationDockbarComponent = class NavigationDockbarComponent {
1454
1466
  contentSlot = contentChild(NavigationContentComponent, ...ngDevMode ? [{ debugName: "contentSlot" }] : /* istanbul ignore next */ []);
1455
1467
  footerSlot = contentChild(NavigationFooterComponent, ...ngDevMode ? [{ debugName: "footerSlot" }] : /* istanbul ignore next */ []);
1456
1468
  asideFooterSlot = contentChild(NavigationAsideFooterDirective, ...ngDevMode ? [{ debugName: "asideFooterSlot" }] : /* istanbul ignore next */ []);
1469
+ headerDescendantSources = computed(() => {
1470
+ const entry = this.container.dockbarRouteHeader()?.activeEntry;
1471
+ if (!entry || this.container.dockbarResolvedRouteContext().badge) return [];
1472
+ return navigationDescendantBadgeSources(entry.badge, entry.children, this.container.resolvedBadgeContext());
1473
+ }, ...ngDevMode ? [{ debugName: "headerDescendantSources" }] : /* istanbul ignore next */ []);
1457
1474
  routeContextEnabled = computed(() => {
1458
1475
  const context = this.routeContext();
1459
1476
  return context !== null && context !== false;
@@ -1610,9 +1627,13 @@ var NavigationDockbarComponent = class NavigationDockbarComponent {
1610
1627
  }
1611
1628
  </span>
1612
1629
 
1613
- @if (routeHeader.badge; as badge) {
1630
+ @if (routeHeader.badge || headerDescendantSources().length) {
1614
1631
  @defer (on immediate) {
1615
- <NavigationBadgeCount [badge]="badge" [class]="routeHeader.badgeClass" />
1632
+ <NavigationBadgeCount
1633
+ [badge]="routeHeader.badge"
1634
+ [sources]="routeHeader.badge ? null : headerDescendantSources()"
1635
+ [class]="routeHeader.badgeClass"
1636
+ />
1616
1637
  }
1617
1638
  }
1618
1639
  </ng-template>
@@ -1707,7 +1728,7 @@ var NavigationDockbarComponent = class NavigationDockbarComponent {
1707
1728
  exportAs: ["Tooltip"]
1708
1729
  }
1709
1730
  ],
1710
- deferBlockDependencies: [() => [import("./ojiepermana-angular-navigation-navigation-badge-count.component-BYN_Vxm3.mjs").then((n) => n.n).then((m) => m.NavigationBadgeCountComponent)]]
1731
+ deferBlockDependencies: [() => [import("./ojiepermana-angular-navigation-navigation-badge-count.component-D-WgBF6d.mjs").then((n) => n.n).then((m) => m.NavigationBadgeCountComponent)]]
1711
1732
  });
1712
1733
  };
1713
1734
  i0.ɵɵngDeclareClassMetadataAsync({
@@ -1715,7 +1736,7 @@ i0.ɵɵngDeclareClassMetadataAsync({
1715
1736
  version: "22.2.3",
1716
1737
  ngImport: i0,
1717
1738
  type: NavigationDockbarComponent,
1718
- resolveDeferredDeps: () => [import("./ojiepermana-angular-navigation-navigation-badge-count.component-BYN_Vxm3.mjs").then((n) => n.n).then((m) => m.NavigationBadgeCountComponent)],
1739
+ resolveDeferredDeps: () => [import("./ojiepermana-angular-navigation-navigation-badge-count.component-D-WgBF6d.mjs").then((n) => n.n).then((m) => m.NavigationBadgeCountComponent)],
1719
1740
  resolveMetadata: (NavigationBadgeCountComponent) => ({
1720
1741
  decorators: [{
1721
1742
  type: Component,
@@ -1755,9 +1776,13 @@ i0.ɵɵngDeclareClassMetadataAsync({
1755
1776
  }
1756
1777
  </span>
1757
1778
 
1758
- @if (routeHeader.badge; as badge) {
1779
+ @if (routeHeader.badge || headerDescendantSources().length) {
1759
1780
  @defer (on immediate) {
1760
- <NavigationBadgeCount [badge]="badge" [class]="routeHeader.badgeClass" />
1781
+ <NavigationBadgeCount
1782
+ [badge]="routeHeader.badge"
1783
+ [sources]="routeHeader.badge ? null : headerDescendantSources()"
1784
+ [class]="routeHeader.badgeClass"
1785
+ />
1761
1786
  }
1762
1787
  }
1763
1788
  </ng-template>
@@ -485,8 +485,15 @@ Observable errors hide the badge. Source replacement unsubscribes the previous O
485
485
  never renders its cached count for the replacement. Destroying a badge view unsubscribes it.
486
486
  Changing a sidebar between labelled, collapsed, hover, and keyboard preview layouts keeps the same
487
487
  badge view and subscription, including the last emission from a non-replaying Observable.
488
- Each visible badge owns its subscription; use `shareReplay({ bufferSize: 1, refCount: true })` in
489
- the consumer when several views use a cold Observable and should share its work.
488
+ Within one `Navigation`, badges share one upstream subscription per Observable identity, including
489
+ parent totals and child badges. Sources referenced by the visible normalized navigation tree or
490
+ built-in route header stay subscribed while their data remains available, including while panels
491
+ are closed or an active root moves between rail and header. Unreferenced registry keys are ignored.
492
+ Removing the last data and view reference discards its cached replay, including completed cold
493
+ Observables, so restoring navigation data reads fresh counts. Replacing sources unsubscribes the
494
+ old stream, and destroying the navigation releases all subscriptions. Sources that remain in use
495
+ retain their last emission when another descendant changes. Separate `Navigation` instances have separate lifetimes;
496
+ use `shareReplay({ bufferSize: 1, refCount: true })` in the consumer to share work across instances.
490
497
 
491
498
  Labelled items reserve space at the right for a nonshrinking red pill. Count badges use
492
499
  `destructive` / `destructive-foreground`, 20px minimum width and height, 10px type, and 4px inline
@@ -496,6 +503,55 @@ the labelled version, with one badge per item. Geometry follows the theme space
496
503
  `--nav-count-height`, `--nav-count-compact-height`, `--nav-count-padding`, and `--nav-count-offset`;
497
504
  font size uses `--nav-count-font-size`. Static text badges retain their existing styling.
498
505
 
506
+ ### Parent totals
507
+
508
+ Parents without their own badge automatically sum the unique `badge.source` keys anywhere in their
509
+ visible descendant tree, after `isHidden` filtering. A hidden branch contributes nothing, including
510
+ its children. Missing keys and invalid counts contribute zero. Each count is normalized before
511
+ addition, so negative or fractional invalid values cannot cancel other sources. A total of zero
512
+ hides the badge. A total of 120 displays `99+` with the accessible label `120 items`.
513
+
514
+ ```ts
515
+ readonly taskCount = signal(3);
516
+ readonly reviewCount = signal(5);
517
+ readonly badgeContext: NavigationBadgeContext = {
518
+ tasks: { value: this.taskCount, ariaLabel: count => `${count} tugas` },
519
+ reviews: { value: this.reviewCount }, // Observable and callback readers work here too.
520
+ management: { value: 4 },
521
+ };
522
+ readonly navigation: readonly NavigationItem[] = [{
523
+ id: 'management', title: 'Manajemen', icon: 'folder',
524
+ children: [
525
+ { title: 'Tugas', badge: { source: 'tasks' }, link: '/tasks' },
526
+ { title: 'Review', badge: { source: 'reviews' }, link: '/reviews' },
527
+ { title: 'Tugas lainnya', badge: { source: 'tasks' }, link: '/other-tasks' },
528
+ ],
529
+ }];
530
+ // Manajemen displays 8, counting tasks once.
531
+ // this.reviewCount.set(0) changes the total to 3.
532
+ // this.reviewCount.set(117) changes it to 99+ (accessible label: 120 items).
533
+ ```
534
+
535
+ Priority applies independently at each parent:
536
+
537
+ 1. `badge: { source: 'management' }` displays only that source, here `4`, without adding children.
538
+ A missing or zero own source hides the badge; it does not fall back to descendants.
539
+ 2. `badge: { title: 'New' }` keeps the existing static text badge instead of replacing it with a total.
540
+ 3. Otherwise, descendant source keys produce the automatic total. Ancestors still collect source
541
+ keys throughout their descendant tree, rather than summing already accumulated parent badges.
542
+
543
+ Automatic totals use the shared red count pill and the default `<total> items` accessible label;
544
+ child labels and source style overrides do not override the aggregate label or color. To supply a
545
+ custom aggregate label or business total, compute it in the consumer and bind it as the parent's own
546
+ source. The consumer continues to own data fetching and updates; the library does no requests or polling.
547
+
548
+ Expanded sidebar, navbar, and flyout parents place the count after their label, including submenu
549
+ triggers. Collapsed sidebar and dockbar group triggers place it over the icon corner. Opening a
550
+ dockbar panel keeps each child's own badge. With `dockbar-route-context`, an active group keeps its
551
+ total when its icon moves from the rail to the built-in route header. Existing explicit route metadata
552
+ badge keys keep their fallback priority in that header. Minidock accepts flat items only, so it never renders
553
+ parent totals. `toMinidockItems()` preserves individual leaf badges without copying parent totals.
554
+
499
555
  ### Migration
500
556
 
501
557
  Existing `<NavigationDockbar [dockbar-badge]="registry" />` continues to work, including its
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ojiepermana/angular",
3
- "version": "22.2.5",
3
+ "version": "22.2.6",
4
4
  "description": "Accessible, tree-shakable Angular 22 design system from ojiepermana: UI components, charts, navigation shells, theme tokens, and an OpenAPI SDK generator.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -503,5 +503,5 @@
503
503
  "module": "fesm2022/ojiepermana-angular.mjs",
504
504
  "typings": "types/ojiepermana-angular.d.ts",
505
505
  "type": "module",
506
- "gitHead": "0f9117817faca017f5aab776cf340eb939fee4ba"
506
+ "gitHead": "36761836fcc9ad9cd75bca17dc88834061ea4572"
507
507
  }
@@ -419,6 +419,7 @@ export declare class NavigationDockbarComponent {
419
419
  protected readonly contentSlot: import("@angular/core").Signal<NavigationContentComponent | undefined>;
420
420
  protected readonly footerSlot: import("@angular/core").Signal<NavigationFooterComponent | undefined>;
421
421
  protected readonly asideFooterSlot: import("@angular/core").Signal<NavigationAsideFooterDirective | undefined>;
422
+ protected readonly headerDescendantSources: import("@angular/core").Signal<readonly import("@ojiepermana/angular/navigation").NavigationBadgeSource[]>;
422
423
  private readonly routeContextEnabled;
423
424
  protected readonly hostClasses: import("@angular/core").Signal<string>;
424
425
  constructor();
@@ -555,7 +555,7 @@ export declare class LayoutWrapperDefault {
555
555
  /** Minidock only accepts flat data, so grouped data is flattened before it reaches the rail. */
556
556
  private readonly minidockData;
557
557
  /** Data id of the desktop `<Navigation>`; its state id stays `main` for persistence. */
558
- protected readonly desktopDataId: import("@angular/core").Signal<"main-minidock" | "main">;
558
+ protected readonly desktopDataId: import("@angular/core").Signal<"main" | "main-minidock">;
559
559
  /** Data of the desktop `<Navigation>`: flattened for minidock, unfiltered for every other type. */
560
560
  protected readonly desktopData: import("@angular/core").Signal<readonly NavigationItem[]>;
561
561
  /** Lebar host `<Navigation>`: penuh-tinggi (vertical) atau penuh-lebar (horizontal). */