@ojiepermana/angular 22.2.5 → 22.2.7

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-DqomVKM3.mjs} +12 -10
  3. package/fesm2022/{ojiepermana-angular-navigation-navigation-entry-grid.component-DeF_s1vE.mjs → ojiepermana-angular-navigation-navigation-entry-grid.component-nge3WGLa.mjs} +13 -4
  4. package/fesm2022/{ojiepermana-angular-navigation-navigation-flyout-menu.component-BOGL8MY0.mjs → ojiepermana-angular-navigation-navigation-flyout-menu.component-CeoyWTbP.mjs} +2 -2
  5. package/fesm2022/{ojiepermana-angular-navigation-navigation-horizontal.component-Cb4bHM58.mjs → ojiepermana-angular-navigation-navigation-horizontal.component-BhE_XVog.mjs} +6 -4
  6. package/fesm2022/{ojiepermana-angular-navigation-navigation-item.component-DLgcJQOC.mjs → ojiepermana-angular-navigation-navigation-item.component-2R9tPqQK.mjs} +86 -25
  7. package/fesm2022/{ojiepermana-angular-navigation-navigation-list.component-BYc3WCt8.mjs → ojiepermana-angular-navigation-navigation-list.component-DO_eoMWG.mjs} +3 -4
  8. package/fesm2022/ojiepermana-angular-navigation.mjs +40 -14
  9. package/navigation/README.md +64 -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 { a as NAVIGATION_SHELL, r as NavigationItemContentComponent, t as NavigationItemComponent } from "./ojiepermana-angular-navigation-navigation-item.component-2R9tPqQK.mjs";
3
+ import { t as NavigationListComponent } from "./ojiepermana-angular-navigation-navigation-list.component-DO_eoMWG.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-2R9tPqQK.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-2R9tPqQK.mjs";
2
+ import { t as NavigationEntryGridComponent } from "./ojiepermana-angular-navigation-navigation-entry-grid.component-nge3WGLa.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-2R9tPqQK.mjs";
3
+ import { t as NavigationEntryGridComponent } from "./ojiepermana-angular-navigation-navigation-entry-grid.component-nge3WGLa.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,6 +1,6 @@
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
- import { Component, computed, inject, input, output, signal } from "@angular/core";
3
+ import { Component, InjectionToken, computed, inject, input, output, signal } from "@angular/core";
4
4
  import { ActivatedRoute, Router, RouterLink } from "@angular/router";
5
5
  import { cn } from "@ojiepermana/angular/component/utils/core";
6
6
  import { NAVIGATION_ADAPTER, NAVIGATION_ROUTE_CONTEXT_ADAPTER } from "@ojiepermana/angular/navigation/core";
@@ -8,12 +8,15 @@ import { NgTemplateOutlet } from "@angular/common";
8
8
  import { LucideChevronRight } from "@lucide/angular";
9
9
  import { IconComponent, provideIcons } from "@ojiepermana/angular/component/icon";
10
10
  import { TooltipDirective } from "@ojiepermana/angular/component/tooltip";
11
+ const NAVIGATION_SHELL = new InjectionToken("NAVIGATION_SHELL");
11
12
  var NavigationItemBadgeComponent = class NavigationItemBadgeComponent {
12
13
  staticClass = input("nav-badge ml-auto inline-flex h-5 shrink-0 items-center self-center rounded-full bg-muted px-2 text-muted-foreground", ...ngDevMode ? [{ debugName: "staticClass" }] : /* istanbul ignore next */ []);
13
14
  compact = input(false, ...ngDevMode ? [{ debugName: "compact" }] : /* istanbul ignore next */ []);
14
15
  countClasses = computed(() => cn(this.compact() && "nav-count-overlay", this.itemBadge()?.classes), ...ngDevMode ? [{ debugName: "countClasses" }] : /* istanbul ignore next */ []);
15
16
  itemBadge = input(...ngDevMode ? [void 0, { debugName: "itemBadge" }] : /* istanbul ignore next */ []);
16
17
  badgeContext = input({}, ...ngDevMode ? [{ debugName: "badgeContext" }] : /* istanbul ignore next */ []);
18
+ children = input([], ...ngDevMode ? [{ debugName: "children" }] : /* istanbul ignore next */ []);
19
+ descendantSources = computed(() => navigationDescendantBadgeSources(this.itemBadge(), this.children(), this.badgeContext()), ...ngDevMode ? [{ debugName: "descendantSources" }] : /* istanbul ignore next */ []);
17
20
  source = computed(() => {
18
21
  const key = this.itemBadge()?.source;
19
22
  return key && Object.hasOwn(this.badgeContext(), key) ? this.badgeContext()[key] : null;
@@ -60,13 +63,24 @@ var NavigationItemBadgeComponent = class NavigationItemBadgeComponent {
60
63
  isSignal: true,
61
64
  isRequired: false,
62
65
  transformFunction: null
66
+ },
67
+ children: {
68
+ classPropertyName: "children",
69
+ publicName: "children",
70
+ isSignal: true,
71
+ isRequired: false,
72
+ transformFunction: null
63
73
  }
64
74
  },
65
75
  host: { classAttribute: "contents" },
66
76
  ngImport: i0,
67
77
  template: `
68
- @if (itemBadge()?.source) {
69
- <NavigationBadgeCount [badge]="source()" [class]="countClasses()" />
78
+ @if (itemBadge()?.source || descendantSources().length) {
79
+ <NavigationBadgeCount
80
+ [badge]="source()"
81
+ [sources]="itemBadge()?.source ? null : descendantSources()"
82
+ [class]="countClasses()"
83
+ />
70
84
  } @else if (!compact() && itemBadge()?.title; as title) {
71
85
  <span data-navigation-badge-text="true" [class]="itemBadge()?.classes ?? staticClass()">{{
72
86
  title
@@ -78,7 +92,11 @@ var NavigationItemBadgeComponent = class NavigationItemBadgeComponent {
78
92
  kind: "component",
79
93
  type: NavigationBadgeCountComponent,
80
94
  selector: "NavigationBadgeCount",
81
- inputs: ["badge", "class"]
95
+ inputs: [
96
+ "badge",
97
+ "class",
98
+ "sources"
99
+ ]
82
100
  }]
83
101
  });
84
102
  };
@@ -94,8 +112,12 @@ i0.ɵɵngDeclareClassMetadata({
94
112
  imports: [NavigationBadgeCountComponent],
95
113
  host: { class: "contents" },
96
114
  template: `
97
- @if (itemBadge()?.source) {
98
- <NavigationBadgeCount [badge]="source()" [class]="countClasses()" />
115
+ @if (itemBadge()?.source || descendantSources().length) {
116
+ <NavigationBadgeCount
117
+ [badge]="source()"
118
+ [sources]="itemBadge()?.source ? null : descendantSources()"
119
+ [class]="countClasses()"
120
+ />
99
121
  } @else if (!compact() && itemBadge()?.title; as title) {
100
122
  <span data-navigation-badge-text="true" [class]="itemBadge()?.classes ?? staticClass()">{{
101
123
  title
@@ -136,10 +158,19 @@ i0.ɵɵngDeclareClassMetadata({
136
158
  alias: "badgeContext",
137
159
  required: false
138
160
  }]
161
+ }],
162
+ children: [{
163
+ type: i0.Input,
164
+ args: [{
165
+ isSignal: true,
166
+ alias: "children",
167
+ required: false
168
+ }]
139
169
  }]
140
170
  }
141
171
  });
142
172
  var NavigationItemContentComponent = class NavigationItemContentComponent {
173
+ hasCountBadge = hasNavigationCountBadge;
143
174
  nav = inject(NAVIGATION_ADAPTER);
144
175
  badgeContext = input({}, ...ngDevMode ? [{ debugName: "badgeContext" }] : /* istanbul ignore next */ []);
145
176
  item = input.required(...ngDevMode ? [{ debugName: "item" }] : /* istanbul ignore next */ []);
@@ -148,7 +179,7 @@ var NavigationItemContentComponent = class NavigationItemContentComponent {
148
179
  orientation = input("vertical", ...ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []);
149
180
  level = input(0, ...ngDevMode ? [{ debugName: "level" }] : /* istanbul ignore next */ []);
150
181
  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 */ []);
182
+ hasIconSlot = computed(() => !!this.item().icon || hasNavigationCountBadge(this.item()), ...ngDevMode ? [{ debugName: "hasIconSlot" }] : /* istanbul ignore next */ []);
152
183
  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
184
  titleClasses = computed(() => cn("block truncate", this.active() && "text-foreground", this.item().classes?.title), ...ngDevMode ? [{ debugName: "titleClasses" }] : /* istanbul ignore next */ []);
154
185
  showSubtitle = computed(() => !!this.item().subtitle && !(this.orientation() === "horizontal" && this.level() === 0), ...ngDevMode ? [{ debugName: "showSubtitle" }] : /* istanbul ignore next */ []);
@@ -234,7 +265,7 @@ var NavigationItemContentComponent = class NavigationItemContentComponent {
234
265
  [attr.data-navigation-icon-slot]="compact() && hasIconSlot() ? 'true' : null"
235
266
  [class]="compact() && hasIconSlot() ? iconSlotClasses() : 'contents'"
236
267
  >
237
- @if (compact() && item().badge?.source) {
268
+ @if (compact() && hasCountBadge(item())) {
238
269
  <span class="sr-only">{{ item().tooltip ?? item().title }}</span>
239
270
  }
240
271
  @if (item().icon; as iconName) {
@@ -263,6 +294,7 @@ var NavigationItemContentComponent = class NavigationItemContentComponent {
263
294
  <span aria-hidden="true" [class]="compactFallbackClasses()">{{ compactFallback() }}</span>
264
295
  }
265
296
  <NavigationItemBadge
297
+ [children]="item().children"
266
298
  [itemBadge]="item().badge"
267
299
  [badgeContext]="badgeContext()"
268
300
  [compact]="compact()"
@@ -302,7 +334,8 @@ var NavigationItemContentComponent = class NavigationItemContentComponent {
302
334
  "staticClass",
303
335
  "compact",
304
336
  "itemBadge",
305
- "badgeContext"
337
+ "badgeContext",
338
+ "children"
306
339
  ]
307
340
  }
308
341
  ]
@@ -330,7 +363,7 @@ i0.ɵɵngDeclareClassMetadata({
330
363
  [attr.data-navigation-icon-slot]="compact() && hasIconSlot() ? 'true' : null"
331
364
  [class]="compact() && hasIconSlot() ? iconSlotClasses() : 'contents'"
332
365
  >
333
- @if (compact() && item().badge?.source) {
366
+ @if (compact() && hasCountBadge(item())) {
334
367
  <span class="sr-only">{{ item().tooltip ?? item().title }}</span>
335
368
  }
336
369
  @if (item().icon; as iconName) {
@@ -359,6 +392,7 @@ i0.ɵɵngDeclareClassMetadata({
359
392
  <span aria-hidden="true" [class]="compactFallbackClasses()">{{ compactFallback() }}</span>
360
393
  }
361
394
  <NavigationItemBadge
395
+ [children]="item().children"
362
396
  [itemBadge]="item().badge"
363
397
  [badgeContext]="badgeContext()"
364
398
  [compact]="compact()"
@@ -437,7 +471,9 @@ function safeNavId(value) {
437
471
  return value.trim().toLowerCase().replace(/[^a-z0-9_-]+/g, "-") || "default";
438
472
  }
439
473
  var NavigationItemComponent = class NavigationItemComponent {
474
+ hasCountBadge = hasNavigationCountBadge;
440
475
  nav = inject(NAVIGATION_ADAPTER);
476
+ shell = inject(NAVIGATION_SHELL, { optional: true });
441
477
  routeContext = inject(NAVIGATION_ROUTE_CONTEXT_ADAPTER);
442
478
  router = inject(Router, { optional: true });
443
479
  activatedRoute = inject(ActivatedRoute, { optional: true });
@@ -464,6 +500,10 @@ var NavigationItemComponent = class NavigationItemComponent {
464
500
  openedIds = input([], ...ngDevMode ? [{ debugName: "openedIds" }] : /* istanbul ignore next */ []);
465
501
  openedIdsChange = output();
466
502
  itemSelected = output();
503
+ showGroupBadge = computed(() => {
504
+ const badge = this.item().badge;
505
+ return this.shell?.displayState().type !== "sidebar" || !badge?.source && !!badge?.title;
506
+ }, ...ngDevMode ? [{ debugName: "showGroupBadge" }] : /* istanbul ignore next */ []);
467
507
  openedIdSet = computed(() => new Set(this.openedIds()), ...ngDevMode ? [{ debugName: "openedIdSet" }] : /* istanbul ignore next */ []);
468
508
  listedAsOpen = computed(() => this.openedIdSet().has(this.item().stateId) || this.openedIdSet().has(this.item().key), ...ngDevMode ? [{ debugName: "listedAsOpen" }] : /* istanbul ignore next */ []);
469
509
  userToggled = signal(false, ...ngDevMode ? [{ debugName: "userToggled" }] : /* istanbul ignore next */ []);
@@ -762,7 +802,13 @@ var NavigationItemComponent = class NavigationItemComponent {
762
802
  </span>
763
803
  }
764
804
  </span>
765
- <NavigationItemBadge [itemBadge]="item().badge" [badgeContext]="badgeContext()" />
805
+ @if (showGroupBadge()) {
806
+ <NavigationItemBadge
807
+ [children]="item().children"
808
+ [itemBadge]="item().badge"
809
+ [badgeContext]="badgeContext()"
810
+ />
811
+ }
766
812
  </div>
767
813
  }
768
814
 
@@ -781,7 +827,7 @@ var NavigationItemComponent = class NavigationItemComponent {
781
827
  [class]="triggerClasses(isActive())"
782
828
  [attr.aria-expanded]="showChildren()"
783
829
  [attr.aria-controls]="showChildren() ? panelId() : null"
784
- [attr.aria-label]="item().badge?.source ? null : compactLabel()"
830
+ [attr.aria-label]="hasCountBadge(item()) ? null : compactLabel()"
785
831
  [attr.title]="titleFor()"
786
832
  [Tooltip]="compact() ? (titleFor() ?? '') : ''"
787
833
  [TooltipPosition]="tooltipPosition()"
@@ -814,7 +860,11 @@ var NavigationItemComponent = class NavigationItemComponent {
814
860
  @if (!compact() && item().title) {
815
861
  <div [id]="headingId()" [class]="groupHeadingClasses()">
816
862
  <span class="min-w-0 flex-1 truncate">{{ item().title }}</span>
817
- <NavigationItemBadge [itemBadge]="item().badge" [badgeContext]="badgeContext()" />
863
+ <NavigationItemBadge
864
+ [children]="item().children"
865
+ [itemBadge]="item().badge"
866
+ [badgeContext]="badgeContext()"
867
+ />
818
868
  </div>
819
869
  }
820
870
 
@@ -841,7 +891,7 @@ var NavigationItemComponent = class NavigationItemComponent {
841
891
  [attr.aria-current]="isRouterItemActive() ? 'page' : null"
842
892
  [attr.aria-disabled]="item().disabled || null"
843
893
  [attr.tabindex]="leafTabIndex()"
844
- [attr.aria-label]="item().badge?.source ? null : compactLabel()"
894
+ [attr.aria-label]="hasCountBadge(item()) ? null : compactLabel()"
845
895
  [attr.title]="titleFor()"
846
896
  [Tooltip]="compact() ? (titleFor() ?? '') : ''"
847
897
  [TooltipPosition]="tooltipPosition()"
@@ -868,7 +918,7 @@ var NavigationItemComponent = class NavigationItemComponent {
868
918
  [attr.aria-current]="isActive() ? 'page' : null"
869
919
  [attr.aria-disabled]="item().disabled || null"
870
920
  [attr.tabindex]="leafTabIndex()"
871
- [attr.aria-label]="item().badge?.source ? null : compactLabel()"
921
+ [attr.aria-label]="hasCountBadge(item()) ? null : compactLabel()"
872
922
  [attr.title]="titleFor()"
873
923
  [Tooltip]="compact() ? (titleFor() ?? '') : ''"
874
924
  [TooltipPosition]="tooltipPosition()"
@@ -892,7 +942,7 @@ var NavigationItemComponent = class NavigationItemComponent {
892
942
  [class]="leafClasses(isActive())"
893
943
  [disabled]="item().disabled || null"
894
944
  [attr.aria-current]="isActive() ? 'page' : null"
895
- [attr.aria-label]="item().badge?.source ? null : compactLabel()"
945
+ [attr.aria-label]="hasCountBadge(item()) ? null : compactLabel()"
896
946
  [attr.title]="titleFor()"
897
947
  [Tooltip]="compact() ? (titleFor() ?? '') : ''"
898
948
  [TooltipPosition]="tooltipPosition()"
@@ -1015,7 +1065,8 @@ var NavigationItemComponent = class NavigationItemComponent {
1015
1065
  "staticClass",
1016
1066
  "compact",
1017
1067
  "itemBadge",
1018
- "badgeContext"
1068
+ "badgeContext",
1069
+ "children"
1019
1070
  ]
1020
1071
  },
1021
1072
  {
@@ -1110,7 +1161,13 @@ i0.ɵɵngDeclareClassMetadata({
1110
1161
  </span>
1111
1162
  }
1112
1163
  </span>
1113
- <NavigationItemBadge [itemBadge]="item().badge" [badgeContext]="badgeContext()" />
1164
+ @if (showGroupBadge()) {
1165
+ <NavigationItemBadge
1166
+ [children]="item().children"
1167
+ [itemBadge]="item().badge"
1168
+ [badgeContext]="badgeContext()"
1169
+ />
1170
+ }
1114
1171
  </div>
1115
1172
  }
1116
1173
 
@@ -1129,7 +1186,7 @@ i0.ɵɵngDeclareClassMetadata({
1129
1186
  [class]="triggerClasses(isActive())"
1130
1187
  [attr.aria-expanded]="showChildren()"
1131
1188
  [attr.aria-controls]="showChildren() ? panelId() : null"
1132
- [attr.aria-label]="item().badge?.source ? null : compactLabel()"
1189
+ [attr.aria-label]="hasCountBadge(item()) ? null : compactLabel()"
1133
1190
  [attr.title]="titleFor()"
1134
1191
  [Tooltip]="compact() ? (titleFor() ?? '') : ''"
1135
1192
  [TooltipPosition]="tooltipPosition()"
@@ -1162,7 +1219,11 @@ i0.ɵɵngDeclareClassMetadata({
1162
1219
  @if (!compact() && item().title) {
1163
1220
  <div [id]="headingId()" [class]="groupHeadingClasses()">
1164
1221
  <span class="min-w-0 flex-1 truncate">{{ item().title }}</span>
1165
- <NavigationItemBadge [itemBadge]="item().badge" [badgeContext]="badgeContext()" />
1222
+ <NavigationItemBadge
1223
+ [children]="item().children"
1224
+ [itemBadge]="item().badge"
1225
+ [badgeContext]="badgeContext()"
1226
+ />
1166
1227
  </div>
1167
1228
  }
1168
1229
 
@@ -1189,7 +1250,7 @@ i0.ɵɵngDeclareClassMetadata({
1189
1250
  [attr.aria-current]="isRouterItemActive() ? 'page' : null"
1190
1251
  [attr.aria-disabled]="item().disabled || null"
1191
1252
  [attr.tabindex]="leafTabIndex()"
1192
- [attr.aria-label]="item().badge?.source ? null : compactLabel()"
1253
+ [attr.aria-label]="hasCountBadge(item()) ? null : compactLabel()"
1193
1254
  [attr.title]="titleFor()"
1194
1255
  [Tooltip]="compact() ? (titleFor() ?? '') : ''"
1195
1256
  [TooltipPosition]="tooltipPosition()"
@@ -1216,7 +1277,7 @@ i0.ɵɵngDeclareClassMetadata({
1216
1277
  [attr.aria-current]="isActive() ? 'page' : null"
1217
1278
  [attr.aria-disabled]="item().disabled || null"
1218
1279
  [attr.tabindex]="leafTabIndex()"
1219
- [attr.aria-label]="item().badge?.source ? null : compactLabel()"
1280
+ [attr.aria-label]="hasCountBadge(item()) ? null : compactLabel()"
1220
1281
  [attr.title]="titleFor()"
1221
1282
  [Tooltip]="compact() ? (titleFor() ?? '') : ''"
1222
1283
  [TooltipPosition]="tooltipPosition()"
@@ -1240,7 +1301,7 @@ i0.ɵɵngDeclareClassMetadata({
1240
1301
  [class]="leafClasses(isActive())"
1241
1302
  [disabled]="item().disabled || null"
1242
1303
  [attr.aria-current]="isActive() ? 'page' : null"
1243
- [attr.aria-label]="item().badge?.source ? null : compactLabel()"
1304
+ [attr.aria-label]="hasCountBadge(item()) ? null : compactLabel()"
1244
1305
  [attr.title]="titleFor()"
1245
1306
  [Tooltip]="compact() ? (titleFor() ?? '') : ''"
1246
1307
  [TooltipPosition]="tooltipPosition()"
@@ -1458,4 +1519,4 @@ i0.ɵɵngDeclareClassMetadata({
1458
1519
  }]
1459
1520
  }
1460
1521
  });
1461
- export { NavigationItemBadgeComponent as i, navigationPanelId as n, NavigationItemContentComponent as r, NavigationItemComponent as t };
1522
+ export { NAVIGATION_SHELL as a, NavigationItemBadgeComponent as i, navigationPanelId as n, NavigationItemContentComponent as r, NavigationItemComponent as t };
@@ -1,8 +1,7 @@
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-2R9tPqQK.mjs";
2
2
  import * as i0 from "@angular/core";
3
- import { Component, InjectionToken, computed, input, output } from "@angular/core";
3
+ import { Component, computed, input, output } from "@angular/core";
4
4
  import { cn } from "@ojiepermana/angular/component/utils/core";
5
- const NAVIGATION_SHELL = new InjectionToken("NAVIGATION_SHELL");
6
5
  var NavigationListComponent = class NavigationListComponent {
7
6
  badgeContext = input({}, ...ngDevMode ? [{ debugName: "badgeContext" }] : /* istanbul ignore next */ []);
8
7
  navId = input("default", ...ngDevMode ? [{ debugName: "navId" }] : /* istanbul ignore next */ []);
@@ -344,4 +343,4 @@ i0.ɵɵngDeclareClassMetadata({
344
343
  }]
345
344
  }
346
345
  });
347
- export { NAVIGATION_SHELL as n, NavigationListComponent as t };
346
+ export { NavigationListComponent as t };
@@ -1,5 +1,6 @@
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 { a as NAVIGATION_SHELL } from "./ojiepermana-angular-navigation-navigation-item.component-2R9tPqQK.mjs";
3
+ import { t as NavigationListComponent } from "./ojiepermana-angular-navigation-navigation-list.component-DO_eoMWG.mjs";
3
4
  import * as i0 from "@angular/core";
4
5
  import { Component, DestroyRef, Directive, ElementRef, Injector, TemplateRef, ViewContainerRef, afterNextRender, booleanAttribute, computed, contentChild, effect, forwardRef, inject, input, isDevMode, model, output, signal } from "@angular/core";
5
6
  import { ActivatedRoute } from "@angular/router";
@@ -252,6 +253,12 @@ var NavigationContainerComponent = class NavigationContainerComponent {
252
253
  if (!this.motionArmed()) this.motionArmed.set(true);
253
254
  }
254
255
  constructor() {
256
+ injectNavigationBadgeTotal(computed(() => {
257
+ const context = this.resolvedBadgeContext();
258
+ const sources = [...navigationBadgeSourceKeys(this.normalizedItems())].filter((key) => Object.hasOwn(context, key) && context[key] != null).map((key) => context[key]);
259
+ const headerBadge = this.dockbarRouteHeaderVisible() ? this.dockbarRouteHeader()?.badge : null;
260
+ return headerBadge ? [...sources, headerBadge] : sources;
261
+ }));
255
262
  effect((onCleanup) => {
256
263
  const dataId = this.resolvedDataId();
257
264
  this.nav.publishData(dataId, this.data(), this.dataOwner);
@@ -447,6 +454,9 @@ var NavigationContainerComponent = class NavigationContainerComponent {
447
454
  }
448
455
  },
449
456
  providers: [{
457
+ provide: NAVIGATION_BADGE_STREAMS,
458
+ useFactory: () => /* @__PURE__ */ new WeakMap()
459
+ }, {
450
460
  provide: NAVIGATION_SHELL,
451
461
  useExisting: forwardRef(() => NavigationContainerComponent)
452
462
  }],
@@ -472,6 +482,9 @@ i0.ɵɵngDeclareClassMetadata({
472
482
  args: [{
473
483
  selector: "Navigation",
474
484
  providers: [{
485
+ provide: NAVIGATION_BADGE_STREAMS,
486
+ useFactory: () => /* @__PURE__ */ new WeakMap()
487
+ }, {
475
488
  provide: NAVIGATION_SHELL,
476
489
  useExisting: forwardRef(() => NavigationContainerComponent)
477
490
  }],
@@ -788,9 +801,9 @@ var NavigationContentComponent = class NavigationContentComponent {
788
801
  outputs: ["openedIdsChange", "itemSelected"]
789
802
  }],
790
803
  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)]
804
+ () => [import("./ojiepermana-angular-navigation-navigation-flyout-menu.component-CeoyWTbP.mjs").then((m) => m.NavigationFlyoutMenuComponent)],
805
+ () => [import("./ojiepermana-angular-navigation-navigation-horizontal.component-BhE_XVog.mjs").then((m) => m.NavigationHorizontalComponent)],
806
+ () => [import("./ojiepermana-angular-navigation-navigation-dockbar-menu.component-DqomVKM3.mjs").then((m) => m.NavigationDockbarMenuComponent)]
794
807
  ]
795
808
  });
796
809
  };
@@ -800,9 +813,9 @@ i0.ɵɵngDeclareClassMetadataAsync({
800
813
  ngImport: i0,
801
814
  type: NavigationContentComponent,
802
815
  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)
816
+ import("./ojiepermana-angular-navigation-navigation-flyout-menu.component-CeoyWTbP.mjs").then((m) => m.NavigationFlyoutMenuComponent),
817
+ import("./ojiepermana-angular-navigation-navigation-horizontal.component-BhE_XVog.mjs").then((m) => m.NavigationHorizontalComponent),
818
+ import("./ojiepermana-angular-navigation-navigation-dockbar-menu.component-DqomVKM3.mjs").then((m) => m.NavigationDockbarMenuComponent)
806
819
  ],
807
820
  resolveMetadata: (NavigationFlyoutMenuComponent, NavigationHorizontalComponent, NavigationDockbarMenuComponent) => ({
808
821
  decorators: [{
@@ -1454,6 +1467,11 @@ var NavigationDockbarComponent = class NavigationDockbarComponent {
1454
1467
  contentSlot = contentChild(NavigationContentComponent, ...ngDevMode ? [{ debugName: "contentSlot" }] : /* istanbul ignore next */ []);
1455
1468
  footerSlot = contentChild(NavigationFooterComponent, ...ngDevMode ? [{ debugName: "footerSlot" }] : /* istanbul ignore next */ []);
1456
1469
  asideFooterSlot = contentChild(NavigationAsideFooterDirective, ...ngDevMode ? [{ debugName: "asideFooterSlot" }] : /* istanbul ignore next */ []);
1470
+ headerDescendantSources = computed(() => {
1471
+ const entry = this.container.dockbarRouteHeader()?.activeEntry;
1472
+ if (!entry || this.container.dockbarResolvedRouteContext().badge) return [];
1473
+ return navigationDescendantBadgeSources(entry.badge, entry.children, this.container.resolvedBadgeContext());
1474
+ }, ...ngDevMode ? [{ debugName: "headerDescendantSources" }] : /* istanbul ignore next */ []);
1457
1475
  routeContextEnabled = computed(() => {
1458
1476
  const context = this.routeContext();
1459
1477
  return context !== null && context !== false;
@@ -1610,9 +1628,13 @@ var NavigationDockbarComponent = class NavigationDockbarComponent {
1610
1628
  }
1611
1629
  </span>
1612
1630
 
1613
- @if (routeHeader.badge; as badge) {
1631
+ @if (routeHeader.badge || headerDescendantSources().length) {
1614
1632
  @defer (on immediate) {
1615
- <NavigationBadgeCount [badge]="badge" [class]="routeHeader.badgeClass" />
1633
+ <NavigationBadgeCount
1634
+ [badge]="routeHeader.badge"
1635
+ [sources]="routeHeader.badge ? null : headerDescendantSources()"
1636
+ [class]="routeHeader.badgeClass"
1637
+ />
1616
1638
  }
1617
1639
  }
1618
1640
  </ng-template>
@@ -1707,7 +1729,7 @@ var NavigationDockbarComponent = class NavigationDockbarComponent {
1707
1729
  exportAs: ["Tooltip"]
1708
1730
  }
1709
1731
  ],
1710
- deferBlockDependencies: [() => [import("./ojiepermana-angular-navigation-navigation-badge-count.component-BYN_Vxm3.mjs").then((n) => n.n).then((m) => m.NavigationBadgeCountComponent)]]
1732
+ deferBlockDependencies: [() => [import("./ojiepermana-angular-navigation-navigation-badge-count.component-D-WgBF6d.mjs").then((n) => n.n).then((m) => m.NavigationBadgeCountComponent)]]
1711
1733
  });
1712
1734
  };
1713
1735
  i0.ɵɵngDeclareClassMetadataAsync({
@@ -1715,7 +1737,7 @@ i0.ɵɵngDeclareClassMetadataAsync({
1715
1737
  version: "22.2.3",
1716
1738
  ngImport: i0,
1717
1739
  type: NavigationDockbarComponent,
1718
- resolveDeferredDeps: () => [import("./ojiepermana-angular-navigation-navigation-badge-count.component-BYN_Vxm3.mjs").then((n) => n.n).then((m) => m.NavigationBadgeCountComponent)],
1740
+ resolveDeferredDeps: () => [import("./ojiepermana-angular-navigation-navigation-badge-count.component-D-WgBF6d.mjs").then((n) => n.n).then((m) => m.NavigationBadgeCountComponent)],
1719
1741
  resolveMetadata: (NavigationBadgeCountComponent) => ({
1720
1742
  decorators: [{
1721
1743
  type: Component,
@@ -1755,9 +1777,13 @@ i0.ɵɵngDeclareClassMetadataAsync({
1755
1777
  }
1756
1778
  </span>
1757
1779
 
1758
- @if (routeHeader.badge; as badge) {
1780
+ @if (routeHeader.badge || headerDescendantSources().length) {
1759
1781
  @defer (on immediate) {
1760
- <NavigationBadgeCount [badge]="badge" [class]="routeHeader.badgeClass" />
1782
+ <NavigationBadgeCount
1783
+ [badge]="routeHeader.badge"
1784
+ [sources]="routeHeader.badge ? null : headerDescendantSources()"
1785
+ [class]="routeHeader.badgeClass"
1786
+ />
1761
1787
  }
1762
1788
  }
1763
1789
  </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,61 @@ 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
+
555
+ Sidebar items with `type: 'group'` are section headings and never display count badges, including
556
+ their own `badge.source` or an automatic descendant total. Their children keep individual counts,
557
+ and a text-only `badge.title` on the heading still displays. Sidebar collapsible parents and group
558
+ items in dockbar, navbar, and flyout retain the count behavior described above. Toggle **Group heading**
559
+ in the showcase's **Parent totals** example to compare these cases.
560
+
499
561
  ### Migration
500
562
 
501
563
  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.7",
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": "73ac415b1ff31412df76197c72e648694f9c63e8"
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). */