@memberjunction/ng-explorer-core 6.3.0-edge.0 → 6.3.0-edge.1

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 (117) hide show
  1. package/dist/app-routing.module.d.ts.map +1 -1
  2. package/dist/app-routing.module.js +42 -7
  3. package/dist/app-routing.module.js.map +1 -1
  4. package/dist/generated/lazy-feature-config.d.ts +1 -1
  5. package/dist/generated/lazy-feature-config.d.ts.map +1 -1
  6. package/dist/generated/lazy-feature-config.js +55 -3
  7. package/dist/generated/lazy-feature-config.js.map +1 -1
  8. package/dist/lib/about/about-dialog.component.d.ts +2 -0
  9. package/dist/lib/about/about-dialog.component.d.ts.map +1 -1
  10. package/dist/lib/about/about-dialog.component.js +11 -2
  11. package/dist/lib/about/about-dialog.component.js.map +1 -1
  12. package/dist/lib/guards/moved-nav-item-redirect.d.ts +10 -0
  13. package/dist/lib/guards/moved-nav-item-redirect.d.ts.map +1 -1
  14. package/dist/lib/guards/moved-nav-item-redirect.js +20 -0
  15. package/dist/lib/guards/moved-nav-item-redirect.js.map +1 -1
  16. package/dist/lib/omnibar/index.d.ts +1 -0
  17. package/dist/lib/omnibar/index.d.ts.map +1 -1
  18. package/dist/lib/omnibar/index.js +1 -0
  19. package/dist/lib/omnibar/index.js.map +1 -1
  20. package/dist/lib/omnibar/omnibar-palette.component.d.ts +2 -0
  21. package/dist/lib/omnibar/omnibar-palette.component.d.ts.map +1 -1
  22. package/dist/lib/omnibar/omnibar-palette.component.js +49 -1
  23. package/dist/lib/omnibar/omnibar-palette.component.js.map +1 -1
  24. package/dist/lib/omnibar/omnibar-provider.d.ts +6 -0
  25. package/dist/lib/omnibar/omnibar-provider.d.ts.map +1 -1
  26. package/dist/lib/omnibar/omnibar-provider.js.map +1 -1
  27. package/dist/lib/omnibar/omnibar-semantic-index.service.d.ts +106 -0
  28. package/dist/lib/omnibar/omnibar-semantic-index.service.d.ts.map +1 -0
  29. package/dist/lib/omnibar/omnibar-semantic-index.service.js +362 -0
  30. package/dist/lib/omnibar/omnibar-semantic-index.service.js.map +1 -0
  31. package/dist/lib/omnibar/providers/omnibar-search.provider.d.ts +9 -0
  32. package/dist/lib/omnibar/providers/omnibar-search.provider.d.ts.map +1 -1
  33. package/dist/lib/omnibar/providers/omnibar-search.provider.js +75 -8
  34. package/dist/lib/omnibar/providers/omnibar-search.provider.js.map +1 -1
  35. package/dist/lib/profile/profile-dialog.component.js +4 -4
  36. package/dist/lib/profile/profile-dialog.component.js.map +1 -1
  37. package/dist/lib/public-guest/public-artifact-guest.component.d.ts +94 -0
  38. package/dist/lib/public-guest/public-artifact-guest.component.d.ts.map +1 -0
  39. package/dist/lib/public-guest/public-artifact-guest.component.js +691 -0
  40. package/dist/lib/public-guest/public-artifact-guest.component.js.map +1 -0
  41. package/dist/lib/resource-wrappers/artifact-resource.component.d.ts +31 -4
  42. package/dist/lib/resource-wrappers/artifact-resource.component.d.ts.map +1 -1
  43. package/dist/lib/resource-wrappers/artifact-resource.component.js +154 -20
  44. package/dist/lib/resource-wrappers/artifact-resource.component.js.map +1 -1
  45. package/dist/lib/resource-wrappers/chat-collections-resource.component.d.ts +9 -190
  46. package/dist/lib/resource-wrappers/chat-collections-resource.component.d.ts.map +1 -1
  47. package/dist/lib/resource-wrappers/chat-collections-resource.component.js +40 -580
  48. package/dist/lib/resource-wrappers/chat-collections-resource.component.js.map +1 -1
  49. package/dist/lib/resource-wrappers/chat-conversations-resource.component.d.ts +10 -1
  50. package/dist/lib/resource-wrappers/chat-conversations-resource.component.d.ts.map +1 -1
  51. package/dist/lib/resource-wrappers/chat-conversations-resource.component.js +95 -18
  52. package/dist/lib/resource-wrappers/chat-conversations-resource.component.js.map +1 -1
  53. package/dist/lib/resource-wrappers/chat-export-artifact-link.d.ts +17 -0
  54. package/dist/lib/resource-wrappers/chat-export-artifact-link.d.ts.map +1 -0
  55. package/dist/lib/resource-wrappers/chat-export-artifact-link.js +28 -0
  56. package/dist/lib/resource-wrappers/chat-export-artifact-link.js.map +1 -0
  57. package/dist/lib/resource-wrappers/chat-search-routing.d.ts +1 -1
  58. package/dist/lib/resource-wrappers/chat-search-routing.d.ts.map +1 -1
  59. package/dist/lib/resource-wrappers/chat-search-routing.js +2 -2
  60. package/dist/lib/resource-wrappers/chat-search-routing.js.map +1 -1
  61. package/dist/lib/resource-wrappers/chat-tasks-resource.component.d.ts +20 -10
  62. package/dist/lib/resource-wrappers/chat-tasks-resource.component.d.ts.map +1 -1
  63. package/dist/lib/resource-wrappers/chat-tasks-resource.component.js +43 -21
  64. package/dist/lib/resource-wrappers/chat-tasks-resource.component.js.map +1 -1
  65. package/dist/lib/resource-wrappers/dashboard-resource.component.d.ts +1 -1
  66. package/dist/lib/resource-wrappers/dashboard-resource.component.d.ts.map +1 -1
  67. package/dist/lib/resource-wrappers/dashboard-resource.component.js +2 -2
  68. package/dist/lib/resource-wrappers/dashboard-resource.component.js.map +1 -1
  69. package/dist/lib/resource-wrappers/human-handoff-console-resource.component.js +3 -3
  70. package/dist/lib/resource-wrappers/library-agent-context.d.ts +42 -0
  71. package/dist/lib/resource-wrappers/library-agent-context.d.ts.map +1 -0
  72. package/dist/lib/resource-wrappers/library-agent-context.js +296 -0
  73. package/dist/lib/resource-wrappers/library-agent-context.js.map +1 -0
  74. package/dist/lib/resource-wrappers/library-resource.component.d.ts +58 -0
  75. package/dist/lib/resource-wrappers/library-resource.component.d.ts.map +1 -0
  76. package/dist/lib/resource-wrappers/library-resource.component.js +326 -0
  77. package/dist/lib/resource-wrappers/library-resource.component.js.map +1 -0
  78. package/dist/lib/resource-wrappers/livekit-lazy-config.d.ts +8 -0
  79. package/dist/lib/resource-wrappers/livekit-lazy-config.d.ts.map +1 -0
  80. package/dist/lib/resource-wrappers/livekit-lazy-config.js +17 -0
  81. package/dist/lib/resource-wrappers/livekit-lazy-config.js.map +1 -0
  82. package/dist/lib/resource-wrappers/livekit-resources.module.d.ts +23 -0
  83. package/dist/lib/resource-wrappers/livekit-resources.module.d.ts.map +1 -0
  84. package/dist/lib/resource-wrappers/livekit-resources.module.js +68 -0
  85. package/dist/lib/resource-wrappers/livekit-resources.module.js.map +1 -0
  86. package/dist/lib/shell/components/header/app-switcher.component.js +2 -2
  87. package/dist/lib/shell/components/header/app-switcher.component.js.map +1 -1
  88. package/dist/lib/shell/components/tabs/component-cache-manager.d.ts +7 -0
  89. package/dist/lib/shell/components/tabs/component-cache-manager.d.ts.map +1 -1
  90. package/dist/lib/shell/components/tabs/component-cache-manager.js +14 -5
  91. package/dist/lib/shell/components/tabs/component-cache-manager.js.map +1 -1
  92. package/dist/lib/shell/components/tabs/tab-container.component.d.ts +41 -0
  93. package/dist/lib/shell/components/tabs/tab-container.component.d.ts.map +1 -1
  94. package/dist/lib/shell/components/tabs/tab-container.component.js +198 -3
  95. package/dist/lib/shell/components/tabs/tab-container.component.js.map +1 -1
  96. package/dist/lib/shell/services/sharing-center-dialog-host.component.d.ts.map +1 -1
  97. package/dist/lib/shell/services/sharing-center-dialog-host.component.js +2 -1
  98. package/dist/lib/shell/services/sharing-center-dialog-host.component.js.map +1 -1
  99. package/dist/lib/shell/shell.component.d.ts.map +1 -1
  100. package/dist/lib/shell/shell.component.js +26 -8
  101. package/dist/lib/shell/shell.component.js.map +1 -1
  102. package/dist/lib/shell/shell.module.d.ts +2 -2
  103. package/dist/lib/shell/shell.module.js +4 -4
  104. package/dist/lib/shell/shell.module.js.map +1 -1
  105. package/dist/lib/user-notifications/user-notifications.component.d.ts +13 -0
  106. package/dist/lib/user-notifications/user-notifications.component.d.ts.map +1 -1
  107. package/dist/lib/user-notifications/user-notifications.component.js +35 -9
  108. package/dist/lib/user-notifications/user-notifications.component.js.map +1 -1
  109. package/dist/module.d.ts +57 -63
  110. package/dist/module.d.ts.map +1 -1
  111. package/dist/module.js +21 -45
  112. package/dist/module.js.map +1 -1
  113. package/dist/public-api.d.ts +5 -1
  114. package/dist/public-api.d.ts.map +1 -1
  115. package/dist/public-api.js +5 -1
  116. package/dist/public-api.js.map +1 -1
  117. package/package.json +60 -59
@@ -1 +1 @@
1
- {"version":3,"file":"app-switcher.component.js","sourceRoot":"","sources":["../../../../../src/lib/shell/components/header/app-switcher.component.ts","../../../../../src/lib/shell/components/header/app-switcher.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAoD,MAAM,eAAe,CAAC;AAEpI,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,6BAA6B,EAAE,MAAM,sCAAsC,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;;;;;;;;;;;;ICIpC,uBAAuF;;;IAGvF,wBAC+D;;;IAD3C,8FAA+C;IACjE,sFAAqC;;;;IAsCnC,+BAA+C;IAC7C,wBAAmE;IACnE,gCAA0B;IAAA,yCAAyB;IAAA,iBAAO;IAC1D,kCAAuE;IAA3B,qNAAS,uBAAgB,KAAC;IAAC,uBAAO;IAAA,iBAAS;IACvF,kCAAqD;IAA1B,qNAAS,sBAAe,KAAC;IAAC,4BAAY;IACnE,AADmE,iBAAS,EACtE;;;;IAdN,AADF,+BAAiD,iBACyD;IAAlC,uMAAS,8BAAuB,KAAC;IACrG,wBAAyD;IAC3D,iBAAS;IACT,8BAAyD;IAAA,8BAAc;IAAA,iBAAK;IAC5E,kCAA+G;IAA1B,uMAAS,sBAAe,KAAC;IAC5G,wBAAoD;IAExD,AADE,iBAAS,EACL;IACN,mHAAsB;IAQtB,sDAIwC;IAAtC,AADA,2NAAS,uBAAgB,KAAC,sNACb,8BAAuB,KAAC;IACvC,iBAA6B;;;IAb7B,eAOC;IAPD,gDAOC;IAGC,cAAqB;IAArB,0CAAqB;;;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,oBAAoB;mDAiDpB,6BAA6B;;;;;;;;YC9GxC,AADF,8BAAgE,gBAOjC;YAA3B,8FAAS,oBAAgB,IAAC;YAE1B,oFAAiB;YAGjB,oFAAkB;YAKlB,+BAAwB;YAAA,YAAkB;YAAA,iBAAO;YACjD,uBAA0E;YAC5E,iBAAM;YAEN,0FAAoB;YA4HtB,iBAAM;YAKN,uHAA4C;;YAtJR,wCAA2B;YAG3D,cAAgC;YAAhC,kDAAgC;;YAMhC,eAEC;YAFD,wCAEC;YACD,cAGC;YAHD,yCAGC;YAEuB,eAAkB;YAAlB,sCAAkB;YAI5C,eA2HC;YA3HD,2CA2HC;;;iFDlFU,oBAAoB;cANhC,SAAS;6BACI,KAAK,YACP,iBAAiB;;kBAM1B,KAAK;;kBAGL,KAAK;;kBAOL,KAAK;;kBAGL,KAAK;;kBAQL,KAAK;;kBAGL,KAAK;;kBAQL,KAAK;;kBACL,MAAM;;kBASN,MAAM;;kBAEN,SAAS;mBAAC,aAAa;;kBACvB,SAAS;mBAAC,SAAS;;kBACnB,SAAS;mBAAC,OAAO;;kBACjB,SAAS;mBAAC,6BAA6B;;kFAjD7B,oBAAoB","sourcesContent":["import { Component, Input, Output, EventEmitter, ViewChild, ElementRef, OnInit, OnDestroy, ChangeDetectorRef } from '@angular/core';\nimport { ApplicationManager, BaseApplication } from '@memberjunction/ng-base-application';\nimport { BaseAngularComponent } from '@memberjunction/ng-base-types';\nimport { UserAppConfigContentComponent } from '@memberjunction/ng-explorer-settings';\nimport { UUIDsEqual, NormalizeUUID } from '@memberjunction/global';\nimport { UserInfoEngine } from '@memberjunction/core-entities';\nimport { Subject, takeUntil } from 'rxjs';\n\n/** UserInfoEngine setting key holding the recently-switched-to apps */\nconst RECENT_APPS_KEY = 'mj.shell.recentApps.v1';\n/** UserInfoEngine setting key for the launcher's All-apps sort preference */\nconst LAUNCHER_SORT_KEY = 'mj.shell.launcherSort.v1';\n/** How many recent entries to persist (display shows fewer) */\nconst RECENT_STORE_MAX = 8;\n/** How many recent cards to display */\nconst RECENT_DISPLAY_MAX = 3;\n/** 'auto' style: below this many apps the compact anchored panel is used */\nconst COMPACT_AUTO_THRESHOLD = 8;\n/** Compact mode: the filter input appears only at or above this many apps */\nconst COMPACT_FILTER_THRESHOLD = 10;\n\n/**\n * Presentation style for the app switcher, resolved from the\n * `Shell.AppSwitcher.Style` instance-config key:\n * - 'launcher': always the centered card launcher\n * - 'compact': always the anchored compact panel (dropdown-like)\n * - 'auto' (default): compact below {@link COMPACT_AUTO_THRESHOLD} apps\n */\nexport type AppSwitcherStyle = 'launcher' | 'compact' | 'auto';\n\ninterface RecentAppEntry {\n id: string;\n ts: number;\n}\n\n/**\n * App switcher in the header: the trigger shows the active app's identity\n * glyph; activating it opens a centered launcher overlay — a filterable grid\n * of app cards (identity glyph + name + Description summary), with the user's\n * most recently used apps surfaced first.\n *\n * Rendering model: the panel is a native <dialog> opened with showModal(),\n * so it lives in the browser's TOP LAYER — above every stacking context in\n * the app (the shell header's z-index:500 context, chat FAB, toasts). The\n * modal state also makes the rest of the document inert (focus cannot\n * escape) and the browser restores focus to the trigger on close.\n *\n * Accessibility model: every app card is a real focusable control (via\n * mjClickable), so Tab walks filter → close → cards → Configure, and\n * Enter/Space activate the focused card. Arrow keys are the fast path:\n * ArrowDown from the filter focuses the first card; arrows move between\n * cards; ArrowUp from the first card returns to the filter. Escape layers:\n * discard-bar → config view → filter → close. Exiting the config view with\n * unsaved changes shows an inline discard bar (a body-appended confirm\n * dialog would be inert/beneath the top layer).\n */\n@Component({\n standalone: false,\n selector: 'mj-app-switcher',\n templateUrl: './app-switcher.component.html',\n styleUrls: ['./app-switcher.component.css']\n})\nexport class AppSwitcherComponent extends BaseAngularComponent implements OnInit, OnDestroy {\n private destroy$ = new Subject<void>();\n @Input() ActiveApp: BaseApplication | null = null;\n\n /** @deprecated Use {@link ActiveApp}. */\n @Input() set activeApp(value: BaseApplication | null) {\n this.ActiveApp = value;\n }\n /** @deprecated Use {@link ActiveApp}. */\n get activeApp(): BaseApplication | null {\n return this.ActiveApp;\n }\n @Input() IsViewingSystemTab = false;\n\n /** @deprecated Use {@link IsViewingSystemTab}. */\n @Input() set isViewingSystemTab(value: AppSwitcherComponent['IsViewingSystemTab']) {\n this.IsViewingSystemTab = value;\n }\n /** @deprecated Use {@link IsViewingSystemTab}. */\n get isViewingSystemTab(): AppSwitcherComponent['IsViewingSystemTab'] {\n return this.IsViewingSystemTab;\n }\n /** ID of the app currently being loaded (shows loading indicator) */\n @Input() LoadingAppId: string | null = null;\n\n /** @deprecated Use {@link LoadingAppId}. */\n @Input() set loadingAppId(value: string | null) {\n this.LoadingAppId = value;\n }\n /** @deprecated Use {@link LoadingAppId}. */\n get loadingAppId(): string | null {\n return this.LoadingAppId;\n }\n /** Presentation style (from Shell.AppSwitcher.Style instance config) */\n @Input() SwitcherStyle: AppSwitcherStyle = 'auto';\n @Output() AppSelected = new EventEmitter<string>();\n\n /**\n * @deprecated Use {@link AppSelected}.\n *\n * The same emitter under the old binding name, so a template still binding\n * (appSelected) keeps working. Must stay AFTER AppSelected: class fields\n * initialise in order, and the other way round this captures undefined.\n */\n @Output() appSelected = this.AppSelected;\n\n @ViewChild('filterInput') private filterInputRef?: ElementRef<HTMLInputElement>;\n @ViewChild('trigger') private triggerRef?: ElementRef<HTMLElement>;\n @ViewChild('panel') private panelRef?: ElementRef<HTMLDialogElement>;\n @ViewChild(UserAppConfigContentComponent) private configContent?: UserAppConfigContentComponent;\n\n ShowDropdown = false;\n\n /** @deprecated Use {@link ShowDropdown}. */\n get showDropdown() {\n return this.ShowDropdown;\n }\n /** @deprecated Use {@link ShowDropdown}. */\n set showDropdown(value) {\n this.ShowDropdown = value;\n }\n /** When true, the launcher body shows the app-configuration view instead of the card grid */\n public ConfigMode = false;\n /** Pending action awaiting the inline unsaved-changes discard bar ('exit' = back to grid, 'close' = close launcher) */\n public PendingDiscard: 'exit' | 'close' | null = null;\n /** True when the panel renders as the compact anchored dropdown (few apps) */\n public CompactMode = false;\n /** All-apps sort: the user's configured order ('custom') or A–Z ('alpha').\n * Per-user preference, persisted via UserInfoEngine. */\n public SortMode: 'custom' | 'alpha' = 'custom';\n /** Anchor position for the compact panel (px, from the trigger's rect) */\n public AnchorLeft = 0;\n public AnchorTop = 0;\n\n /** Live filter text — matches app names AND Description summaries */\n public FilterText = '';\n\n private recentEntries: RecentAppEntry[] = [];\n\n constructor(private appManager: ApplicationManager, private cdr: ChangeDetectorRef) {\n super();\n }\n\n /**\n * UserInfoEngine scoped to this component's provider (multi-provider rule:\n * never reach for the global singleton in per-provider code paths). For the\n * default single-provider shell this resolves to the already-loaded engine\n * registered under the default connection. When no provider is available at\n * all (test environments), fall back to the global singleton rather than\n * letting GetProviderInstance construct a fresh unloaded engine.\n */\n private get userInfoEngine(): UserInfoEngine {\n const provider = this.ProviderToUse;\n return provider\n ? UserInfoEngine.GetProviderInstance<UserInfoEngine>(provider, UserInfoEngine) as UserInfoEngine\n : UserInfoEngine.Instance;\n }\n\n ngOnInit(): void {\n // The launcher's presentation (compact vs full, filter visibility) is\n // resolved from the app COUNT — which can change while the panel is open\n // (the user saves config changes that cross the auto threshold). React to\n // the same stream the app list uses so the presentation can't go stale.\n // Optional-chained: lightweight test stubs may not provide the observable.\n this.appManager.Applications?.pipe(takeUntil(this.destroy$)).subscribe(() => {\n if (this.ShowDropdown) {\n this.RefreshPresentation();\n }\n });\n }\n\n ngOnDestroy(): void {\n this.destroy$.next();\n this.destroy$.complete();\n }\n\n /**\n * Re-resolve the presentation for the CURRENT app count. No-op while the\n * config view is open (the panel is promoted to full size there anyway);\n * called when the app stream emits and when the config view exits.\n */\n RefreshPresentation(): void {\n if (this.ConfigMode) {\n return;\n }\n const wasCompact = this.CompactMode;\n this.CompactMode = this.resolveCompactMode();\n if (this.CompactMode && !wasCompact) {\n this.computeCompactAnchor();\n }\n // Mode flips can add/remove the filter input — if the focused element got\n // torn out of the DOM, focus would drop into the inert background. Re-home\n // it after the view settles.\n // Zoneless: an RxJS-driven mutation needs an explicit CD kick (same\n // pattern as AppNavComponent's workspace subscription).\n this.cdr.markForCheck();\n try {\n this.cdr.detectChanges();\n } catch {\n // Re-entrant CD — harmless.\n }\n if (wasCompact !== this.CompactMode) {\n requestAnimationFrame(() => {\n const panel = this.panelRef?.nativeElement;\n if (panel && !panel.contains(document.activeElement)) {\n if (this.ShowFilter) {\n this.filterInputRef?.nativeElement?.focus();\n } else {\n panel.querySelector<HTMLElement>('.app-card')?.focus();\n }\n }\n });\n }\n }\n\n /** Template handler for the filter input's input event */\n OnFilterInput(event: Event): void {\n this.FilterText = (event.target as HTMLInputElement).value;\n this.OnFilterChange();\n }\n\n /**\n * Check if the app switcher should show loading state\n */\n get isLoading(): boolean {\n return this.LoadingAppId !== null;\n }\n\n /**\n * Visible trigger label: the current app's name, or \"Apps\" when there's no\n * app context (system tabs, nothing active yet).\n */\n get TriggerLabel(): string {\n return this.ActiveApp && !this.IsViewingSystemTab ? this.ActiveApp.Name : 'Apps';\n }\n\n /** Accessible name for the trigger — names the control AND the current app */\n get TriggerAriaLabel(): string {\n return this.ActiveApp && !this.IsViewingSystemTab\n ? `Switch application — current: ${this.ActiveApp.Name}`\n : 'Switch application';\n }\n\n /**\n * Get applications that should appear in the app switcher\n * (NavigationStyle = 'App Switcher' or 'Both')\n */\n get Apps(): BaseApplication[] {\n return this.appManager.GetAppSwitcherApps();\n }\n\n /** @deprecated Use {@link Apps}. */\n get apps(): BaseApplication[] {\n return this.Apps;\n }\n\n /** Recently-used apps (persisted per user), newest first, capped for display.\n * Compact mode skips the Recent section — with a handful of apps it's noise. */\n get RecentApps(): BaseApplication[] {\n if (this.CompactMode) {\n return [];\n }\n const byId = new Map(this.Apps.map(a => [NormalizeUUID(a.ID), a]));\n const result: BaseApplication[] = [];\n for (const entry of this.recentEntries) {\n const app = byId.get(NormalizeUUID(entry.id));\n if (app) {\n result.push(app);\n if (result.length >= RECENT_DISPLAY_MAX) {\n break;\n }\n }\n }\n return this.applyFilter(result);\n }\n\n /** All switcher apps in the user's chosen sort (custom Sequence order or A–Z) */\n private get sortedApps(): BaseApplication[] {\n return this.SortMode === 'alpha'\n ? [...this.Apps].sort((a, b) => a.Name.localeCompare(b.Name))\n : this.Apps;\n }\n\n /** The complete \"All apps\" section, in the user's chosen sort. Apps shown in\n * Recent appear here TOO — being recently used must not make an app vanish\n * from its expected place in the full list. */\n get OtherApps(): BaseApplication[] {\n return this.applyFilter(this.sortedApps);\n }\n\n /** Flat visible list in RENDERED card order — the keyboard-navigation index\n * space. Filtering collapses the sections into one deduplicated list;\n * otherwise it's Recent followed by the full All-apps list (a recent app\n * intentionally appears twice, matching the two cards on screen). */\n get VisibleApps(): BaseApplication[] {\n if (this.IsFiltering) {\n return this.applyFilter(this.sortedApps);\n }\n return [...this.RecentApps, ...this.OtherApps];\n }\n\n /** Distinct app count for the screen-reader status (VisibleApps can contain\n * the same app twice when it's in both Recent and All apps) */\n get AnnouncedAppCount(): number {\n return this.IsFiltering ? this.VisibleApps.length : this.applyFilter(this.Apps).length;\n }\n\n /** True when a filter is active (sections collapse into one result list) */\n get IsFiltering(): boolean {\n return this.FilterText.trim().length > 0;\n }\n\n /** Compact mode hides the filter under a handful of apps — it's noise there */\n get ShowFilter(): boolean {\n return !this.CompactMode || this.Apps.length >= COMPACT_FILTER_THRESHOLD;\n }\n\n private applyFilter(apps: BaseApplication[]): BaseApplication[] {\n const q = this.FilterText.trim().toLowerCase();\n if (!q) {\n return apps;\n }\n return apps.filter(a =>\n a.Name.toLowerCase().includes(q) || (a.Description || '').toLowerCase().includes(q));\n }\n\n /** Stable DOM id for a card (arrow-key focus target) */\n OptionId(index: number): string {\n return `mj-launcher-opt-${index}`;\n }\n\n /** Trigger handler: open the launcher panel, or close it if already open */\n ToggleLauncher(): void {\n if (this.ShowDropdown) {\n this.closeLauncher();\n } else {\n this.openLauncher();\n }\n }\n\n /** Flip the All-apps sort and persist it (fail-silent, like recents) */\n ToggleSortMode(): void {\n this.SortMode = this.SortMode === 'alpha' ? 'custom' : 'alpha';\n try {\n this.userInfoEngine.SetSettingDebounced(LAUNCHER_SORT_KEY, this.SortMode);\n } catch {\n // Preference persistence must never break the launcher\n }\n }\n\n private loadSortMode(): void {\n try {\n this.SortMode = this.userInfoEngine.GetSetting(LAUNCHER_SORT_KEY) === 'alpha' ? 'alpha' : 'custom';\n } catch {\n this.SortMode = 'custom';\n }\n }\n\n private openLauncher(): void {\n this.loadRecents();\n this.loadSortMode();\n this.FilterText = '';\n this.ConfigMode = false;\n this.PendingDiscard = null;\n this.CompactMode = this.resolveCompactMode();\n if (this.CompactMode) {\n this.computeCompactAnchor();\n }\n this.ShowDropdown = true;\n // The dialog element renders under @if next frame: put it in the top\n // layer via showModal() (jsdom fallback: plain open attribute), then\n // focus the filter (or the first card when compact mode hides it).\n requestAnimationFrame(() => {\n const dialog = this.panelRef?.nativeElement;\n if (dialog && !dialog.open) {\n if (typeof dialog.showModal === 'function') {\n dialog.showModal();\n } else {\n dialog.setAttribute('open', '');\n }\n }\n if (this.ShowFilter) {\n this.filterInputRef?.nativeElement?.focus();\n } else {\n dialog?.querySelector<HTMLElement>('.app-card')?.focus();\n }\n });\n }\n\n /** Resolve the presentation for this open (auto = compact under the threshold) */\n private resolveCompactMode(): boolean {\n if (this.SwitcherStyle === 'compact') {\n return true;\n }\n if (this.SwitcherStyle === 'launcher') {\n return false;\n }\n return this.Apps.length < COMPACT_AUTO_THRESHOLD;\n }\n\n /** Anchor the compact panel under the trigger, clamped to the viewport */\n private computeCompactAnchor(): void {\n const rect = this.triggerRef?.nativeElement?.getBoundingClientRect();\n if (!rect) {\n return;\n }\n const panelWidth = 320; // Keep in sync with .launcher-panel--compact width\n const margin = 8;\n this.AnchorLeft = Math.max(margin, Math.min(rect.left, window.innerWidth - panelWidth - margin));\n this.AnchorTop = rect.bottom + margin;\n }\n\n private closeLauncher(restoreFocus = true): void {\n const dialog = this.panelRef?.nativeElement;\n if (dialog?.open && typeof dialog.close === 'function') {\n dialog.close(); // Browser restores focus to the trigger automatically\n }\n this.ShowDropdown = false;\n this.FilterText = '';\n this.ConfigMode = false;\n this.PendingDiscard = null;\n if (restoreFocus) {\n requestAnimationFrame(() => {\n this.triggerRef?.nativeElement?.focus();\n });\n }\n }\n\n /** Guarded close for template paths (backdrop / close button): unsaved\n * config changes surface the inline discard bar instead of closing. */\n CloseLauncher(): void {\n if (this.ConfigMode && this.configContent?.HasChanges()) {\n this.PendingDiscard = 'close';\n return;\n }\n this.closeLauncher();\n }\n\n /** Backdrop clicks arrive as clicks on the <dialog> element itself */\n OnDialogClick(event: MouseEvent): void {\n if (event.target === this.panelRef?.nativeElement) {\n this.CloseLauncher();\n }\n }\n\n /** Native cancel (Esc while the browser owns the dialog) — route through\n * our layered Escape handling instead of closing unconditionally. */\n OnDialogCancel(event: Event): void {\n event.preventDefault();\n this.handleEscape();\n }\n\n /** Inline discard bar: confirm — perform the pending action, dropping changes */\n ConfirmDiscard(): void {\n const action = this.PendingDiscard;\n this.PendingDiscard = null;\n if (action === 'close') {\n this.closeLauncher();\n } else if (action === 'exit') {\n this.ExitConfigMode();\n }\n }\n\n /** Inline discard bar: keep editing */\n CancelDiscard(): void {\n this.PendingDiscard = null;\n }\n\n OnFilterChange(): void {\n // Filtering re-renders the card set; nothing else to sync — focus stays\n // in the input and Tab/arrows reach the new result set naturally.\n }\n\n /** Keyboard model on the filter input */\n OnFilterKeydown(event: KeyboardEvent): void {\n const visible = this.VisibleApps;\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n this.focusCard(0);\n break;\n case 'Enter':\n event.preventDefault();\n // While filtering, Enter opens the top result (omnibar semantics —\n // the footer advertises \"↵ open\"); unfiltered it needs an unambiguous\n // single app.\n if (this.IsFiltering && visible.length > 0) {\n this.SelectApp(visible[0]);\n } else if (visible.length === 1) {\n this.SelectApp(visible[0]);\n }\n break;\n case 'Escape':\n event.preventDefault();\n // Stop the bubble: the panel's own Escape handler would otherwise\n // re-evaluate AFTER we've mutated state and double-handle the key.\n event.stopPropagation();\n this.handleEscape();\n break;\n }\n }\n\n /** Arrow-key navigation between focused cards */\n OnCardKeydown(index: number, event: KeyboardEvent): void {\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowRight':\n event.preventDefault();\n this.focusCard(index + 1);\n break;\n case 'ArrowUp':\n case 'ArrowLeft':\n event.preventDefault();\n if (index === 0) {\n this.filterInputRef?.nativeElement?.focus();\n } else {\n this.focusCard(index - 1);\n }\n break;\n case 'Home':\n event.preventDefault();\n this.focusCard(0);\n break;\n case 'End':\n event.preventDefault();\n this.focusCard(this.VisibleApps.length - 1);\n break;\n }\n }\n\n /** Move DOM focus to the card at the given VisibleApps index (clamped) */\n private focusCard(index: number): void {\n const count = this.VisibleApps.length;\n if (count === 0) {\n return;\n }\n const clamped = Math.min(count - 1, Math.max(0, index));\n const el = document.getElementById(this.OptionId(clamped));\n if (el) {\n el.focus();\n // jsdom (unit tests) doesn't implement scrollIntoView — guard it.\n if (typeof el.scrollIntoView === 'function') {\n el.scrollIntoView({ block: 'nearest' });\n }\n }\n }\n\n /** Keep Tab cycling within the launcher's real focusables (filter, close, Configure) */\n /** Escape layering: discard bar → config view (guarded) → filter → close.\n * Tab is NOT manually trapped — showModal() makes the background inert,\n * which is a real trap (no leak when focus sits on a non-focusable). */\n OnPanelKeydown(event: KeyboardEvent): void {\n if (event.key === 'Escape') {\n event.preventDefault();\n event.stopPropagation();\n this.handleEscape();\n }\n }\n\n private handleEscape(): void {\n if (this.PendingDiscard) {\n this.CancelDiscard();\n } else if (this.ConfigMode) {\n this.RequestExitConfigMode();\n } else if (this.IsFiltering) {\n this.FilterText = '';\n this.filterInputRef?.nativeElement?.focus();\n } else {\n this.closeLauncher();\n }\n }\n\n /**\n * Select an application.\n * When viewing a system tab, always emit to allow returning to the app.\n */\n SelectApp(app: BaseApplication): void {\n this.recordRecent(app);\n this.closeLauncher(false); // Focus moves into the app, not back to the trigger\n if (!UUIDsEqual(app.ID, this.ActiveApp?.ID) || this.IsViewingSystemTab) {\n this.AppSelected.emit(app.ID);\n }\n }\n\n /** @deprecated Use {@link SelectApp}. */\n selectApp(app: BaseApplication): void {\n return this.SelectApp(app);\n }\n\n /** Case-insensitive UUID check whether an app is the currently active app. */\n IsActiveApp(app: BaseApplication): boolean {\n return UUIDsEqual(app.ID, this.ActiveApp?.ID);\n }\n\n /** Case-insensitive UUID check whether an app is the one currently loading. */\n IsLoadingApp(app: BaseApplication): boolean {\n return UUIDsEqual(app.ID, this.LoadingAppId);\n }\n\n // ---- Recents persistence (MJ: User Settings via UserInfoEngine) ----\n\n private loadRecents(): void {\n try {\n const raw = this.userInfoEngine.GetSetting(RECENT_APPS_KEY);\n const parsed = raw ? JSON.parse(raw) : [];\n this.recentEntries = Array.isArray(parsed)\n ? parsed.filter((e: RecentAppEntry) => e && typeof e.id === 'string' && typeof e.ts === 'number')\n : [];\n } catch {\n this.recentEntries = [];\n }\n }\n\n private recordRecent(app: BaseApplication): void {\n const id = NormalizeUUID(app.ID);\n this.recentEntries = [\n { id, ts: Date.now() },\n ...this.recentEntries.filter(e => NormalizeUUID(e.id) !== id)\n ].slice(0, RECENT_STORE_MAX);\n try {\n this.userInfoEngine.SetSettingDebounced(RECENT_APPS_KEY, JSON.stringify(this.recentEntries));\n } catch {\n // Settings persistence must never block app switching (e.g. engine not\n // configured in tests or permission-constrained sessions).\n }\n }\n\n /**\n * Swap the launcher body to the app-configuration view (in-panel, seamless —\n * no separate dialog). The embedded mj-user-app-config-content loads on\n * creation.\n */\n EnterConfigMode(): void {\n this.ConfigMode = true;\n this.FilterText = '';\n this.PendingDiscard = null;\n // Move focus into the config view (the back button is its first focusable)\n requestAnimationFrame(() => {\n this.panelRef?.nativeElement\n ?.querySelector<HTMLElement>('.launcher-back')?.focus();\n });\n }\n\n /** Guarded exit from the config view: unsaved changes surface the inline\n * discard bar instead of silently dropping the user's edits. */\n RequestExitConfigMode(): void {\n if (this.configContent?.HasChanges()) {\n this.PendingDiscard = 'exit';\n return;\n }\n this.ExitConfigMode();\n }\n\n /**\n * Return from the configuration view to the app grid.\n * The app list refreshes reactively after a save: each UserApplication save\n * fires a BaseEntity event, UserInfoEngine's debounced refresh emits\n * DataChange$, and ApplicationManager.syncFromEngine() pushes the new list\n * to applications$, which the `apps` getter reads. No explicit reload needed.\n */\n ExitConfigMode(): void {\n this.ConfigMode = false;\n // The config session may have changed the app count across the compact\n // threshold — re-resolve the presentation for the view we're returning to.\n // (The Applications stream also triggers this when the post-save engine\n // refresh lands, whichever comes last wins with the freshest count.)\n this.RefreshPresentation();\n requestAnimationFrame(() => {\n if (this.ShowFilter) {\n this.filterInputRef?.nativeElement?.focus();\n } else {\n this.panelRef?.nativeElement?.querySelector<HTMLElement>('.app-card')?.focus();\n }\n });\n }\n}\n","<div class=\"app-switcher-container\" [class.loading]=\"isLoading\">\n <div class=\"app-switcher-button\"\n #trigger\n [mjClickable]=\"TriggerAriaLabel\"\n testId=\"app-switcher-trigger\"\n [attr.aria-haspopup]=\"'dialog'\"\n [attr.aria-expanded]=\"showDropdown\"\n (click)=\"ToggleLauncher()\">\n <!-- Show spinner when loading, otherwise show app icon -->\n @if (isLoading) {\n <i class=\"app-icon loading-spinner fa-solid fa-spinner fa-spin\" aria-hidden=\"true\"></i>\n }\n @if (!isLoading) {\n <i class=\"app-icon\" [class]=\"activeApp?.Icon || 'fa-solid fa-cube'\"\n [style.color]=\"activeApp?.GetColor()\" aria-hidden=\"true\"></i>\n }\n <!-- Current app name; hidden at the mobile breakpoint (icon-only trigger) -->\n <span class=\"app-label\">{{ TriggerLabel }}</span>\n <i class=\"dropdown-arrow fa-solid fa-chevron-down\" aria-hidden=\"true\"></i>\n </div>\n\n @if (showDropdown) {\n <!-- Native <dialog> + showModal(): lives in the browser TOP LAYER (above\n every app stacking context — chat FAB, toasts), background is inert\n (real focus trap), and focus restores to the trigger on close. The\n backdrop is ::backdrop; clicks on it arrive as clicks on the dialog\n element itself (OnDialogClick). -->\n <dialog class=\"launcher-panel\"\n #panel\n role=\"dialog\"\n aria-modal=\"true\"\n [class.launcher-panel--compact]=\"CompactMode && !ConfigMode\"\n [style.--anchor-left]=\"AnchorLeft + 'px'\"\n [style.--anchor-top]=\"AnchorTop + 'px'\"\n [attr.aria-label]=\"ConfigMode ? null : 'Application launcher'\"\n [attr.aria-labelledby]=\"ConfigMode ? 'mj-launcher-config-title' : null\"\n (click)=\"OnDialogClick($event)\"\n (cancel)=\"OnDialogCancel($event)\"\n (keydown)=\"OnPanelKeydown($event)\">\n\n @if (ConfigMode) {\n <!-- Configuration view: same panel, body swapped -->\n <div class=\"launcher-head launcher-head--config\">\n <button class=\"launcher-back\" type=\"button\" aria-label=\"Back to apps\" (click)=\"RequestExitConfigMode()\">\n <i class=\"fa-solid fa-arrow-left\" aria-hidden=\"true\"></i>\n </button>\n <h2 class=\"launcher-title\" id=\"mj-launcher-config-title\">Configure apps</h2>\n <button class=\"launcher-close\" type=\"button\" aria-label=\"Close application launcher\" (click)=\"CloseLauncher()\">\n <i class=\"fa-solid fa-xmark\" aria-hidden=\"true\"></i>\n </button>\n </div>\n @if (PendingDiscard) {\n <div class=\"launcher-discard-bar\" role=\"alert\">\n <i class=\"fa-solid fa-triangle-exclamation\" aria-hidden=\"true\"></i>\n <span class=\"discard-msg\">You have unsaved changes.</span>\n <button mjButton variant=\"danger\" size=\"sm\" (click)=\"ConfirmDiscard()\">Discard</button>\n <button mjButton size=\"sm\" (click)=\"CancelDiscard()\">Keep editing</button>\n </div>\n }\n <mj-user-app-config-content\n class=\"launcher-config-body\"\n [Provider]=\"Provider\"\n (Saved)=\"ExitConfigMode()\"\n (Cancelled)=\"RequestExitConfigMode()\">\n </mj-user-app-config-content>\n } @else {\n @if (ShowFilter) {\n <div class=\"launcher-head\">\n <div class=\"launcher-filter\">\n <i class=\"fa-solid fa-magnifying-glass\" aria-hidden=\"true\"></i>\n <input\n #filterInput\n type=\"text\"\n placeholder=\"Find an app…\"\n aria-label=\"Find an app\"\n [value]=\"FilterText\"\n (input)=\"OnFilterInput($event)\"\n (keydown)=\"OnFilterKeydown($event)\"\n autocomplete=\"off\"\n spellcheck=\"false\" />\n </div>\n <button class=\"launcher-close\" type=\"button\" aria-label=\"Close application launcher\" (click)=\"CloseLauncher()\">\n <i class=\"fa-solid fa-xmark\" aria-hidden=\"true\"></i>\n </button>\n </div>\n }\n\n <div class=\"launcher-scroll\">\n @if (IsFiltering) {\n <div class=\"launcher-grid\">\n @for (app of VisibleApps; track app.ID; let i = $index) {\n <ng-container *ngTemplateOutlet=\"appCard; context: { $implicit: app, idx: i }\"></ng-container>\n }\n </div>\n @if (VisibleApps.length === 0) {\n <div class=\"launcher-empty\">No apps match \"{{ FilterText }}\"</div>\n }\n } @else {\n @if (RecentApps.length > 0) {\n <div class=\"launcher-sect\">Recent</div>\n <div class=\"launcher-grid\" role=\"group\" aria-label=\"Recent applications\">\n @for (app of RecentApps; track app.ID; let i = $index) {\n <ng-container *ngTemplateOutlet=\"appCard; context: { $implicit: app, idx: i }\"></ng-container>\n }\n </div>\n }\n <div class=\"launcher-sect launcher-sect--row\">\n <span>All apps</span>\n <button class=\"launcher-sort-toggle\" type=\"button\"\n [attr.aria-pressed]=\"SortMode === 'alpha'\"\n [attr.aria-label]=\"SortMode === 'alpha' ? 'Sorted alphabetically — switch to your custom order' : 'Sorted by your custom order — switch to alphabetical'\"\n [title]=\"SortMode === 'alpha' ? 'Sorted A–Z — click for your custom order' : 'Custom order — click for A–Z'\"\n (click)=\"ToggleSortMode()\">\n <i [class]=\"SortMode === 'alpha' ? 'fa-solid fa-arrow-down-a-z' : 'fa-solid fa-bars-staggered'\" aria-hidden=\"true\"></i>\n </button>\n </div>\n <div class=\"launcher-grid\" role=\"group\" aria-label=\"All applications\">\n @for (app of OtherApps; track app.ID; let i = $index) {\n <ng-container *ngTemplateOutlet=\"appCard; context: { $implicit: app, idx: i + RecentApps.length }\"></ng-container>\n }\n </div>\n @if (VisibleApps.length === 0) {\n <div class=\"launcher-empty\">\n No applications are enabled for you yet — use Configure… below to add some.\n </div>\n }\n }\n </div>\n\n <div class=\"launcher-foot\">\n <span class=\"launcher-kbd-hints\" aria-hidden=\"true\">\n <span><kbd>↑</kbd><kbd>↓</kbd> navigate</span>\n <span><kbd>↵</kbd> open</span>\n <span><kbd>esc</kbd> close</span>\n </span>\n <button class=\"launcher-configure\" type=\"button\" testId=\"app-switcher-configure\" (click)=\"EnterConfigMode()\">\n <i class=\"fa-solid fa-gear\" aria-hidden=\"true\"></i>\n <span>Configure…</span>\n </button>\n </div>\n\n <span class=\"sr-only\" role=\"status\">{{ AnnouncedAppCount }} applications available</span>\n }\n </dialog>\n }\n</div>\n\n<!-- Shared app-card template: each card is a real focusable control (mjClickable\n adds role, tabindex 0, aria-label, and Enter/Space activation), so Tab walks\n the cards and arrow keys are the fast path. -->\n<ng-template #appCard let-app let-idx=\"idx\">\n <div class=\"app-card\"\n [id]=\"OptionId(idx)\"\n [mjClickable]=\"app.Name\"\n role=\"link\"\n [testId]=\"'app-switcher-item-' + app.Name\"\n [attr.aria-current]=\"IsActiveApp(app) ? 'true' : null\"\n [attr.aria-describedby]=\"app.Description ? OptionId(idx) + '-desc' : null\"\n [class.active]=\"IsActiveApp(app)\"\n [class.loading]=\"IsLoadingApp(app)\"\n [style.--app-color]=\"app.GetColor()\"\n (click)=\"selectApp(app)\"\n (keydown)=\"OnCardKeydown(idx, $event)\">\n <div class=\"app-card-glyph\">\n @if (IsLoadingApp(app)) {\n <i class=\"fa-solid fa-spinner fa-spin\" aria-hidden=\"true\"></i>\n } @else {\n <i [class]=\"app.Icon || 'fa-solid fa-cube'\" aria-hidden=\"true\"></i>\n }\n </div>\n <div class=\"app-card-text\">\n <div class=\"app-card-name\">\n <span class=\"app-card-name-label\">{{ app.Name }}</span>\n </div>\n @if (app.Description) {\n <div class=\"app-card-desc\" [id]=\"OptionId(idx) + '-desc'\">{{ app.Description }}</div>\n }\n </div>\n </div>\n</ng-template>\n\n"]}
1
+ {"version":3,"file":"app-switcher.component.js","sourceRoot":"","sources":["../../../../../src/lib/shell/components/header/app-switcher.component.ts","../../../../../src/lib/shell/components/header/app-switcher.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAoD,MAAM,eAAe,CAAC;AAEpI,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,6BAA6B,EAAE,MAAM,2DAA2D,CAAC;AAC1G,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;;;;;;;;;;;;ICIpC,uBAAuF;;;IAGvF,wBAC+D;;;IAD3C,8FAA+C;IACjE,sFAAqC;;;;IAsCnC,+BAA+C;IAC7C,wBAAmE;IACnE,gCAA0B;IAAA,yCAAyB;IAAA,iBAAO;IAC1D,kCAAuE;IAA3B,qNAAS,uBAAgB,KAAC;IAAC,uBAAO;IAAA,iBAAS;IACvF,kCAAqD;IAA1B,qNAAS,sBAAe,KAAC;IAAC,4BAAY;IACnE,AADmE,iBAAS,EACtE;;;;IAdN,AADF,+BAAiD,iBACyD;IAAlC,uMAAS,8BAAuB,KAAC;IACrG,wBAAyD;IAC3D,iBAAS;IACT,8BAAyD;IAAA,8BAAc;IAAA,iBAAK;IAC5E,kCAA+G;IAA1B,uMAAS,sBAAe,KAAC;IAC5G,wBAAoD;IAExD,AADE,iBAAS,EACL;IACN,mHAAsB;IAQtB,sDAIwC;IAAtC,AADA,2NAAS,uBAAgB,KAAC,sNACb,8BAAuB,KAAC;IACvC,iBAA6B;;;IAb7B,eAOC;IAPD,gDAOC;IAGC,cAAqB;IAArB,0CAAqB;;;;IAOvB,AADF,+BAA2B,cACI;IAC3B,wBAA+D;IAC/D,oCASuB;IAFrB,AADA,0NAAS,4BAAqB,K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gB,IAAC;YAE1B,oFAAiB;YAGjB,oFAAkB;YAKlB,+BAAwB;YAAA,YAAkB;YAAA,iBAAO;YACjD,uBAA0E;YAC5E,iBAAM;YAEN,0FAAoB;YA4HtB,iBAAM;YAKN,uHAA4C;;YAtJR,wCAA2B;YAG3D,cAAgC;YAAhC,kDAAgC;;YAMhC,eAEC;YAFD,wCAEC;YACD,cAGC;YAHD,yCAGC;YAEuB,eAAkB;YAAlB,sCAAkB;YAI5C,eA2HC;YA3HD,2CA2HC;;;iFDlFU,oBAAoB;cANhC,SAAS;6BACI,KAAK,YACP,iBAAiB;;kBAM1B,KAAK;;kBAGL,KAAK;;kBAOL,KAAK;;kBAGL,KAAK;;kBAQL,KAAK;;kBAGL,KAAK;;kBAQL,KAAK;;kBACL,MAAM;;kBASN,MAAM;;kBAEN,SAAS;mBAAC,aAAa;;kBACvB,SAAS;mBAAC,SAAS;;kBACnB,SAAS;mBAAC,OAAO;;kBACjB,SAAS;mBAAC,6BAA6B;;kFAjD7B,oBAAoB","sourcesContent":["import { Component, Input, Output, EventEmitter, ViewChild, ElementRef, OnInit, OnDestroy, ChangeDetectorRef } from '@angular/core';\nimport { ApplicationManager, BaseApplication } from '@memberjunction/ng-base-application';\nimport { BaseAngularComponent } from '@memberjunction/ng-base-types';\nimport { UserAppConfigContentComponent } from '@memberjunction/ng-explorer-settings/user-settings.module';\nimport { UUIDsEqual, NormalizeUUID } from '@memberjunction/global';\nimport { UserInfoEngine } from '@memberjunction/core-entities';\nimport { Subject, takeUntil } from 'rxjs';\n\n/** UserInfoEngine setting key holding the recently-switched-to apps */\nconst RECENT_APPS_KEY = 'mj.shell.recentApps.v1';\n/** UserInfoEngine setting key for the launcher's All-apps sort preference */\nconst LAUNCHER_SORT_KEY = 'mj.shell.launcherSort.v1';\n/** How many recent entries to persist (display shows fewer) */\nconst RECENT_STORE_MAX = 8;\n/** How many recent cards to display */\nconst RECENT_DISPLAY_MAX = 3;\n/** 'auto' style: below this many apps the compact anchored panel is used */\nconst COMPACT_AUTO_THRESHOLD = 8;\n/** Compact mode: the filter input appears only at or above this many apps */\nconst COMPACT_FILTER_THRESHOLD = 10;\n\n/**\n * Presentation style for the app switcher, resolved from the\n * `Shell.AppSwitcher.Style` instance-config key:\n * - 'launcher': always the centered card launcher\n * - 'compact': always the anchored compact panel (dropdown-like)\n * - 'auto' (default): compact below {@link COMPACT_AUTO_THRESHOLD} apps\n */\nexport type AppSwitcherStyle = 'launcher' | 'compact' | 'auto';\n\ninterface RecentAppEntry {\n id: string;\n ts: number;\n}\n\n/**\n * App switcher in the header: the trigger shows the active app's identity\n * glyph; activating it opens a centered launcher overlay — a filterable grid\n * of app cards (identity glyph + name + Description summary), with the user's\n * most recently used apps surfaced first.\n *\n * Rendering model: the panel is a native <dialog> opened with showModal(),\n * so it lives in the browser's TOP LAYER — above every stacking context in\n * the app (the shell header's z-index:500 context, chat FAB, toasts). The\n * modal state also makes the rest of the document inert (focus cannot\n * escape) and the browser restores focus to the trigger on close.\n *\n * Accessibility model: every app card is a real focusable control (via\n * mjClickable), so Tab walks filter → close → cards → Configure, and\n * Enter/Space activate the focused card. Arrow keys are the fast path:\n * ArrowDown from the filter focuses the first card; arrows move between\n * cards; ArrowUp from the first card returns to the filter. Escape layers:\n * discard-bar → config view → filter → close. Exiting the config view with\n * unsaved changes shows an inline discard bar (a body-appended confirm\n * dialog would be inert/beneath the top layer).\n */\n@Component({\n standalone: false,\n selector: 'mj-app-switcher',\n templateUrl: './app-switcher.component.html',\n styleUrls: ['./app-switcher.component.css']\n})\nexport class AppSwitcherComponent extends BaseAngularComponent implements OnInit, OnDestroy {\n private destroy$ = new Subject<void>();\n @Input() ActiveApp: BaseApplication | null = null;\n\n /** @deprecated Use {@link ActiveApp}. */\n @Input() set activeApp(value: BaseApplication | null) {\n this.ActiveApp = value;\n }\n /** @deprecated Use {@link ActiveApp}. */\n get activeApp(): BaseApplication | null {\n return this.ActiveApp;\n }\n @Input() IsViewingSystemTab = false;\n\n /** @deprecated Use {@link IsViewingSystemTab}. */\n @Input() set isViewingSystemTab(value: AppSwitcherComponent['IsViewingSystemTab']) {\n this.IsViewingSystemTab = value;\n }\n /** @deprecated Use {@link IsViewingSystemTab}. */\n get isViewingSystemTab(): AppSwitcherComponent['IsViewingSystemTab'] {\n return this.IsViewingSystemTab;\n }\n /** ID of the app currently being loaded (shows loading indicator) */\n @Input() LoadingAppId: string | null = null;\n\n /** @deprecated Use {@link LoadingAppId}. */\n @Input() set loadingAppId(value: string | null) {\n this.LoadingAppId = value;\n }\n /** @deprecated Use {@link LoadingAppId}. */\n get loadingAppId(): string | null {\n return this.LoadingAppId;\n }\n /** Presentation style (from Shell.AppSwitcher.Style instance config) */\n @Input() SwitcherStyle: AppSwitcherStyle = 'auto';\n @Output() AppSelected = new EventEmitter<string>();\n\n /**\n * @deprecated Use {@link AppSelected}.\n *\n * The same emitter under the old binding name, so a template still binding\n * (appSelected) keeps working. Must stay AFTER AppSelected: class fields\n * initialise in order, and the other way round this captures undefined.\n */\n @Output() appSelected = this.AppSelected;\n\n @ViewChild('filterInput') private filterInputRef?: ElementRef<HTMLInputElement>;\n @ViewChild('trigger') private triggerRef?: ElementRef<HTMLElement>;\n @ViewChild('panel') private panelRef?: ElementRef<HTMLDialogElement>;\n @ViewChild(UserAppConfigContentComponent) private configContent?: UserAppConfigContentComponent;\n\n ShowDropdown = false;\n\n /** @deprecated Use {@link ShowDropdown}. */\n get showDropdown() {\n return this.ShowDropdown;\n }\n /** @deprecated Use {@link ShowDropdown}. */\n set showDropdown(value) {\n this.ShowDropdown = value;\n }\n /** When true, the launcher body shows the app-configuration view instead of the card grid */\n public ConfigMode = false;\n /** Pending action awaiting the inline unsaved-changes discard bar ('exit' = back to grid, 'close' = close launcher) */\n public PendingDiscard: 'exit' | 'close' | null = null;\n /** True when the panel renders as the compact anchored dropdown (few apps) */\n public CompactMode = false;\n /** All-apps sort: the user's configured order ('custom') or A–Z ('alpha').\n * Per-user preference, persisted via UserInfoEngine. */\n public SortMode: 'custom' | 'alpha' = 'custom';\n /** Anchor position for the compact panel (px, from the trigger's rect) */\n public AnchorLeft = 0;\n public AnchorTop = 0;\n\n /** Live filter text — matches app names AND Description summaries */\n public FilterText = '';\n\n private recentEntries: RecentAppEntry[] = [];\n\n constructor(private appManager: ApplicationManager, private cdr: ChangeDetectorRef) {\n super();\n }\n\n /**\n * UserInfoEngine scoped to this component's provider (multi-provider rule:\n * never reach for the global singleton in per-provider code paths). For the\n * default single-provider shell this resolves to the already-loaded engine\n * registered under the default connection. When no provider is available at\n * all (test environments), fall back to the global singleton rather than\n * letting GetProviderInstance construct a fresh unloaded engine.\n */\n private get userInfoEngine(): UserInfoEngine {\n const provider = this.ProviderToUse;\n return provider\n ? UserInfoEngine.GetProviderInstance<UserInfoEngine>(provider, UserInfoEngine) as UserInfoEngine\n : UserInfoEngine.Instance;\n }\n\n ngOnInit(): void {\n // The launcher's presentation (compact vs full, filter visibility) is\n // resolved from the app COUNT — which can change while the panel is open\n // (the user saves config changes that cross the auto threshold). React to\n // the same stream the app list uses so the presentation can't go stale.\n // Optional-chained: lightweight test stubs may not provide the observable.\n this.appManager.Applications?.pipe(takeUntil(this.destroy$)).subscribe(() => {\n if (this.ShowDropdown) {\n this.RefreshPresentation();\n }\n });\n }\n\n ngOnDestroy(): void {\n this.destroy$.next();\n this.destroy$.complete();\n }\n\n /**\n * Re-resolve the presentation for the CURRENT app count. No-op while the\n * config view is open (the panel is promoted to full size there anyway);\n * called when the app stream emits and when the config view exits.\n */\n RefreshPresentation(): void {\n if (this.ConfigMode) {\n return;\n }\n const wasCompact = this.CompactMode;\n this.CompactMode = this.resolveCompactMode();\n if (this.CompactMode && !wasCompact) {\n this.computeCompactAnchor();\n }\n // Mode flips can add/remove the filter input — if the focused element got\n // torn out of the DOM, focus would drop into the inert background. Re-home\n // it after the view settles.\n // Zoneless: an RxJS-driven mutation needs an explicit CD kick (same\n // pattern as AppNavComponent's workspace subscription).\n this.cdr.markForCheck();\n try {\n this.cdr.detectChanges();\n } catch {\n // Re-entrant CD — harmless.\n }\n if (wasCompact !== this.CompactMode) {\n requestAnimationFrame(() => {\n const panel = this.panelRef?.nativeElement;\n if (panel && !panel.contains(document.activeElement)) {\n if (this.ShowFilter) {\n this.filterInputRef?.nativeElement?.focus();\n } else {\n panel.querySelector<HTMLElement>('.app-card')?.focus();\n }\n }\n });\n }\n }\n\n /** Template handler for the filter input's input event */\n OnFilterInput(event: Event): void {\n this.FilterText = (event.target as HTMLInputElement).value;\n this.OnFilterChange();\n }\n\n /**\n * Check if the app switcher should show loading state\n */\n get isLoading(): boolean {\n return this.LoadingAppId !== null;\n }\n\n /**\n * Visible trigger label: the current app's name, or \"Apps\" when there's no\n * app context (system tabs, nothing active yet).\n */\n get TriggerLabel(): string {\n return this.ActiveApp && !this.IsViewingSystemTab ? this.ActiveApp.Name : 'Apps';\n }\n\n /** Accessible name for the trigger — names the control AND the current app */\n get TriggerAriaLabel(): string {\n return this.ActiveApp && !this.IsViewingSystemTab\n ? `Switch application — current: ${this.ActiveApp.Name}`\n : 'Switch application';\n }\n\n /**\n * Get applications that should appear in the app switcher\n * (NavigationStyle = 'App Switcher' or 'Both')\n */\n get Apps(): BaseApplication[] {\n return this.appManager.GetAppSwitcherApps();\n }\n\n /** @deprecated Use {@link Apps}. */\n get apps(): BaseApplication[] {\n return this.Apps;\n }\n\n /** Recently-used apps (persisted per user), newest first, capped for display.\n * Compact mode skips the Recent section — with a handful of apps it's noise. */\n get RecentApps(): BaseApplication[] {\n if (this.CompactMode) {\n return [];\n }\n const byId = new Map(this.Apps.map(a => [NormalizeUUID(a.ID), a]));\n const result: BaseApplication[] = [];\n for (const entry of this.recentEntries) {\n const app = byId.get(NormalizeUUID(entry.id));\n if (app) {\n result.push(app);\n if (result.length >= RECENT_DISPLAY_MAX) {\n break;\n }\n }\n }\n return this.applyFilter(result);\n }\n\n /** All switcher apps in the user's chosen sort (custom Sequence order or A–Z) */\n private get sortedApps(): BaseApplication[] {\n return this.SortMode === 'alpha'\n ? [...this.Apps].sort((a, b) => a.Name.localeCompare(b.Name))\n : this.Apps;\n }\n\n /** The complete \"All apps\" section, in the user's chosen sort. Apps shown in\n * Recent appear here TOO — being recently used must not make an app vanish\n * from its expected place in the full list. */\n get OtherApps(): BaseApplication[] {\n return this.applyFilter(this.sortedApps);\n }\n\n /** Flat visible list in RENDERED card order — the keyboard-navigation index\n * space. Filtering collapses the sections into one deduplicated list;\n * otherwise it's Recent followed by the full All-apps list (a recent app\n * intentionally appears twice, matching the two cards on screen). */\n get VisibleApps(): BaseApplication[] {\n if (this.IsFiltering) {\n return this.applyFilter(this.sortedApps);\n }\n return [...this.RecentApps, ...this.OtherApps];\n }\n\n /** Distinct app count for the screen-reader status (VisibleApps can contain\n * the same app twice when it's in both Recent and All apps) */\n get AnnouncedAppCount(): number {\n return this.IsFiltering ? this.VisibleApps.length : this.applyFilter(this.Apps).length;\n }\n\n /** True when a filter is active (sections collapse into one result list) */\n get IsFiltering(): boolean {\n return this.FilterText.trim().length > 0;\n }\n\n /** Compact mode hides the filter under a handful of apps — it's noise there */\n get ShowFilter(): boolean {\n return !this.CompactMode || this.Apps.length >= COMPACT_FILTER_THRESHOLD;\n }\n\n private applyFilter(apps: BaseApplication[]): BaseApplication[] {\n const q = this.FilterText.trim().toLowerCase();\n if (!q) {\n return apps;\n }\n return apps.filter(a =>\n a.Name.toLowerCase().includes(q) || (a.Description || '').toLowerCase().includes(q));\n }\n\n /** Stable DOM id for a card (arrow-key focus target) */\n OptionId(index: number): string {\n return `mj-launcher-opt-${index}`;\n }\n\n /** Trigger handler: open the launcher panel, or close it if already open */\n ToggleLauncher(): void {\n if (this.ShowDropdown) {\n this.closeLauncher();\n } else {\n this.openLauncher();\n }\n }\n\n /** Flip the All-apps sort and persist it (fail-silent, like recents) */\n ToggleSortMode(): void {\n this.SortMode = this.SortMode === 'alpha' ? 'custom' : 'alpha';\n try {\n this.userInfoEngine.SetSettingDebounced(LAUNCHER_SORT_KEY, this.SortMode);\n } catch {\n // Preference persistence must never break the launcher\n }\n }\n\n private loadSortMode(): void {\n try {\n this.SortMode = this.userInfoEngine.GetSetting(LAUNCHER_SORT_KEY) === 'alpha' ? 'alpha' : 'custom';\n } catch {\n this.SortMode = 'custom';\n }\n }\n\n private openLauncher(): void {\n this.loadRecents();\n this.loadSortMode();\n this.FilterText = '';\n this.ConfigMode = false;\n this.PendingDiscard = null;\n this.CompactMode = this.resolveCompactMode();\n if (this.CompactMode) {\n this.computeCompactAnchor();\n }\n this.ShowDropdown = true;\n // The dialog element renders under @if next frame: put it in the top\n // layer via showModal() (jsdom fallback: plain open attribute), then\n // focus the filter (or the first card when compact mode hides it).\n requestAnimationFrame(() => {\n const dialog = this.panelRef?.nativeElement;\n if (dialog && !dialog.open) {\n if (typeof dialog.showModal === 'function') {\n dialog.showModal();\n } else {\n dialog.setAttribute('open', '');\n }\n }\n if (this.ShowFilter) {\n this.filterInputRef?.nativeElement?.focus();\n } else {\n dialog?.querySelector<HTMLElement>('.app-card')?.focus();\n }\n });\n }\n\n /** Resolve the presentation for this open (auto = compact under the threshold) */\n private resolveCompactMode(): boolean {\n if (this.SwitcherStyle === 'compact') {\n return true;\n }\n if (this.SwitcherStyle === 'launcher') {\n return false;\n }\n return this.Apps.length < COMPACT_AUTO_THRESHOLD;\n }\n\n /** Anchor the compact panel under the trigger, clamped to the viewport */\n private computeCompactAnchor(): void {\n const rect = this.triggerRef?.nativeElement?.getBoundingClientRect();\n if (!rect) {\n return;\n }\n const panelWidth = 320; // Keep in sync with .launcher-panel--compact width\n const margin = 8;\n this.AnchorLeft = Math.max(margin, Math.min(rect.left, window.innerWidth - panelWidth - margin));\n this.AnchorTop = rect.bottom + margin;\n }\n\n private closeLauncher(restoreFocus = true): void {\n const dialog = this.panelRef?.nativeElement;\n if (dialog?.open && typeof dialog.close === 'function') {\n dialog.close(); // Browser restores focus to the trigger automatically\n }\n this.ShowDropdown = false;\n this.FilterText = '';\n this.ConfigMode = false;\n this.PendingDiscard = null;\n if (restoreFocus) {\n requestAnimationFrame(() => {\n this.triggerRef?.nativeElement?.focus();\n });\n }\n }\n\n /** Guarded close for template paths (backdrop / close button): unsaved\n * config changes surface the inline discard bar instead of closing. */\n CloseLauncher(): void {\n if (this.ConfigMode && this.configContent?.HasChanges()) {\n this.PendingDiscard = 'close';\n return;\n }\n this.closeLauncher();\n }\n\n /** Backdrop clicks arrive as clicks on the <dialog> element itself */\n OnDialogClick(event: MouseEvent): void {\n if (event.target === this.panelRef?.nativeElement) {\n this.CloseLauncher();\n }\n }\n\n /** Native cancel (Esc while the browser owns the dialog) — route through\n * our layered Escape handling instead of closing unconditionally. */\n OnDialogCancel(event: Event): void {\n event.preventDefault();\n this.handleEscape();\n }\n\n /** Inline discard bar: confirm — perform the pending action, dropping changes */\n ConfirmDiscard(): void {\n const action = this.PendingDiscard;\n this.PendingDiscard = null;\n if (action === 'close') {\n this.closeLauncher();\n } else if (action === 'exit') {\n this.ExitConfigMode();\n }\n }\n\n /** Inline discard bar: keep editing */\n CancelDiscard(): void {\n this.PendingDiscard = null;\n }\n\n OnFilterChange(): void {\n // Filtering re-renders the card set; nothing else to sync — focus stays\n // in the input and Tab/arrows reach the new result set naturally.\n }\n\n /** Keyboard model on the filter input */\n OnFilterKeydown(event: KeyboardEvent): void {\n const visible = this.VisibleApps;\n switch (event.key) {\n case 'ArrowDown':\n event.preventDefault();\n this.focusCard(0);\n break;\n case 'Enter':\n event.preventDefault();\n // While filtering, Enter opens the top result (omnibar semantics —\n // the footer advertises \"↵ open\"); unfiltered it needs an unambiguous\n // single app.\n if (this.IsFiltering && visible.length > 0) {\n this.SelectApp(visible[0]);\n } else if (visible.length === 1) {\n this.SelectApp(visible[0]);\n }\n break;\n case 'Escape':\n event.preventDefault();\n // Stop the bubble: the panel's own Escape handler would otherwise\n // re-evaluate AFTER we've mutated state and double-handle the key.\n event.stopPropagation();\n this.handleEscape();\n break;\n }\n }\n\n /** Arrow-key navigation between focused cards */\n OnCardKeydown(index: number, event: KeyboardEvent): void {\n switch (event.key) {\n case 'ArrowDown':\n case 'ArrowRight':\n event.preventDefault();\n this.focusCard(index + 1);\n break;\n case 'ArrowUp':\n case 'ArrowLeft':\n event.preventDefault();\n if (index === 0) {\n this.filterInputRef?.nativeElement?.focus();\n } else {\n this.focusCard(index - 1);\n }\n break;\n case 'Home':\n event.preventDefault();\n this.focusCard(0);\n break;\n case 'End':\n event.preventDefault();\n this.focusCard(this.VisibleApps.length - 1);\n break;\n }\n }\n\n /** Move DOM focus to the card at the given VisibleApps index (clamped) */\n private focusCard(index: number): void {\n const count = this.VisibleApps.length;\n if (count === 0) {\n return;\n }\n const clamped = Math.min(count - 1, Math.max(0, index));\n const el = document.getElementById(this.OptionId(clamped));\n if (el) {\n el.focus();\n // jsdom (unit tests) doesn't implement scrollIntoView — guard it.\n if (typeof el.scrollIntoView === 'function') {\n el.scrollIntoView({ block: 'nearest' });\n }\n }\n }\n\n /** Keep Tab cycling within the launcher's real focusables (filter, close, Configure) */\n /** Escape layering: discard bar → config view (guarded) → filter → close.\n * Tab is NOT manually trapped — showModal() makes the background inert,\n * which is a real trap (no leak when focus sits on a non-focusable). */\n OnPanelKeydown(event: KeyboardEvent): void {\n if (event.key === 'Escape') {\n event.preventDefault();\n event.stopPropagation();\n this.handleEscape();\n }\n }\n\n private handleEscape(): void {\n if (this.PendingDiscard) {\n this.CancelDiscard();\n } else if (this.ConfigMode) {\n this.RequestExitConfigMode();\n } else if (this.IsFiltering) {\n this.FilterText = '';\n this.filterInputRef?.nativeElement?.focus();\n } else {\n this.closeLauncher();\n }\n }\n\n /**\n * Select an application.\n * When viewing a system tab, always emit to allow returning to the app.\n */\n SelectApp(app: BaseApplication): void {\n this.recordRecent(app);\n this.closeLauncher(false); // Focus moves into the app, not back to the trigger\n if (!UUIDsEqual(app.ID, this.ActiveApp?.ID) || this.IsViewingSystemTab) {\n this.AppSelected.emit(app.ID);\n }\n }\n\n /** @deprecated Use {@link SelectApp}. */\n selectApp(app: BaseApplication): void {\n return this.SelectApp(app);\n }\n\n /** Case-insensitive UUID check whether an app is the currently active app. */\n IsActiveApp(app: BaseApplication): boolean {\n return UUIDsEqual(app.ID, this.ActiveApp?.ID);\n }\n\n /** Case-insensitive UUID check whether an app is the one currently loading. */\n IsLoadingApp(app: BaseApplication): boolean {\n return UUIDsEqual(app.ID, this.LoadingAppId);\n }\n\n // ---- Recents persistence (MJ: User Settings via UserInfoEngine) ----\n\n private loadRecents(): void {\n try {\n const raw = this.userInfoEngine.GetSetting(RECENT_APPS_KEY);\n const parsed = raw ? JSON.parse(raw) : [];\n this.recentEntries = Array.isArray(parsed)\n ? parsed.filter((e: RecentAppEntry) => e && typeof e.id === 'string' && typeof e.ts === 'number')\n : [];\n } catch {\n this.recentEntries = [];\n }\n }\n\n private recordRecent(app: BaseApplication): void {\n const id = NormalizeUUID(app.ID);\n this.recentEntries = [\n { id, ts: Date.now() },\n ...this.recentEntries.filter(e => NormalizeUUID(e.id) !== id)\n ].slice(0, RECENT_STORE_MAX);\n try {\n this.userInfoEngine.SetSettingDebounced(RECENT_APPS_KEY, JSON.stringify(this.recentEntries));\n } catch {\n // Settings persistence must never block app switching (e.g. engine not\n // configured in tests or permission-constrained sessions).\n }\n }\n\n /**\n * Swap the launcher body to the app-configuration view (in-panel, seamless —\n * no separate dialog). The embedded mj-user-app-config-content loads on\n * creation.\n */\n EnterConfigMode(): void {\n this.ConfigMode = true;\n this.FilterText = '';\n this.PendingDiscard = null;\n // Move focus into the config view (the back button is its first focusable)\n requestAnimationFrame(() => {\n this.panelRef?.nativeElement\n ?.querySelector<HTMLElement>('.launcher-back')?.focus();\n });\n }\n\n /** Guarded exit from the config view: unsaved changes surface the inline\n * discard bar instead of silently dropping the user's edits. */\n RequestExitConfigMode(): void {\n if (this.configContent?.HasChanges()) {\n this.PendingDiscard = 'exit';\n return;\n }\n this.ExitConfigMode();\n }\n\n /**\n * Return from the configuration view to the app grid.\n * The app list refreshes reactively after a save: each UserApplication save\n * fires a BaseEntity event, UserInfoEngine's debounced refresh emits\n * DataChange$, and ApplicationManager.syncFromEngine() pushes the new list\n * to applications$, which the `apps` getter reads. No explicit reload needed.\n */\n ExitConfigMode(): void {\n this.ConfigMode = false;\n // The config session may have changed the app count across the compact\n // threshold — re-resolve the presentation for the view we're returning to.\n // (The Applications stream also triggers this when the post-save engine\n // refresh lands, whichever comes last wins with the freshest count.)\n this.RefreshPresentation();\n requestAnimationFrame(() => {\n if (this.ShowFilter) {\n this.filterInputRef?.nativeElement?.focus();\n } else {\n this.panelRef?.nativeElement?.querySelector<HTMLElement>('.app-card')?.focus();\n }\n });\n }\n}\n","<div class=\"app-switcher-container\" [class.loading]=\"isLoading\">\n <div class=\"app-switcher-button\"\n #trigger\n [mjClickable]=\"TriggerAriaLabel\"\n testId=\"app-switcher-trigger\"\n [attr.aria-haspopup]=\"'dialog'\"\n [attr.aria-expanded]=\"showDropdown\"\n (click)=\"ToggleLauncher()\">\n <!-- Show spinner when loading, otherwise show app icon -->\n @if (isLoading) {\n <i class=\"app-icon loading-spinner fa-solid fa-spinner fa-spin\" aria-hidden=\"true\"></i>\n }\n @if (!isLoading) {\n <i class=\"app-icon\" [class]=\"activeApp?.Icon || 'fa-solid fa-cube'\"\n [style.color]=\"activeApp?.GetColor()\" aria-hidden=\"true\"></i>\n }\n <!-- Current app name; hidden at the mobile breakpoint (icon-only trigger) -->\n <span class=\"app-label\">{{ TriggerLabel }}</span>\n <i class=\"dropdown-arrow fa-solid fa-chevron-down\" aria-hidden=\"true\"></i>\n </div>\n\n @if (showDropdown) {\n <!-- Native <dialog> + showModal(): lives in the browser TOP LAYER (above\n every app stacking context — chat FAB, toasts), background is inert\n (real focus trap), and focus restores to the trigger on close. The\n backdrop is ::backdrop; clicks on it arrive as clicks on the dialog\n element itself (OnDialogClick). -->\n <dialog class=\"launcher-panel\"\n #panel\n role=\"dialog\"\n aria-modal=\"true\"\n [class.launcher-panel--compact]=\"CompactMode && !ConfigMode\"\n [style.--anchor-left]=\"AnchorLeft + 'px'\"\n [style.--anchor-top]=\"AnchorTop + 'px'\"\n [attr.aria-label]=\"ConfigMode ? null : 'Application launcher'\"\n [attr.aria-labelledby]=\"ConfigMode ? 'mj-launcher-config-title' : null\"\n (click)=\"OnDialogClick($event)\"\n (cancel)=\"OnDialogCancel($event)\"\n (keydown)=\"OnPanelKeydown($event)\">\n\n @if (ConfigMode) {\n <!-- Configuration view: same panel, body swapped -->\n <div class=\"launcher-head launcher-head--config\">\n <button class=\"launcher-back\" type=\"button\" aria-label=\"Back to apps\" (click)=\"RequestExitConfigMode()\">\n <i class=\"fa-solid fa-arrow-left\" aria-hidden=\"true\"></i>\n </button>\n <h2 class=\"launcher-title\" id=\"mj-launcher-config-title\">Configure apps</h2>\n <button class=\"launcher-close\" type=\"button\" aria-label=\"Close application launcher\" (click)=\"CloseLauncher()\">\n <i class=\"fa-solid fa-xmark\" aria-hidden=\"true\"></i>\n </button>\n </div>\n @if (PendingDiscard) {\n <div class=\"launcher-discard-bar\" role=\"alert\">\n <i class=\"fa-solid fa-triangle-exclamation\" aria-hidden=\"true\"></i>\n <span class=\"discard-msg\">You have unsaved changes.</span>\n <button mjButton variant=\"danger\" size=\"sm\" (click)=\"ConfirmDiscard()\">Discard</button>\n <button mjButton size=\"sm\" (click)=\"CancelDiscard()\">Keep editing</button>\n </div>\n }\n <mj-user-app-config-content\n class=\"launcher-config-body\"\n [Provider]=\"Provider\"\n (Saved)=\"ExitConfigMode()\"\n (Cancelled)=\"RequestExitConfigMode()\">\n </mj-user-app-config-content>\n } @else {\n @if (ShowFilter) {\n <div class=\"launcher-head\">\n <div class=\"launcher-filter\">\n <i class=\"fa-solid fa-magnifying-glass\" aria-hidden=\"true\"></i>\n <input\n #filterInput\n type=\"text\"\n placeholder=\"Find an app…\"\n aria-label=\"Find an app\"\n [value]=\"FilterText\"\n (input)=\"OnFilterInput($event)\"\n (keydown)=\"OnFilterKeydown($event)\"\n autocomplete=\"off\"\n spellcheck=\"false\" />\n </div>\n <button class=\"launcher-close\" type=\"button\" aria-label=\"Close application launcher\" (click)=\"CloseLauncher()\">\n <i class=\"fa-solid fa-xmark\" aria-hidden=\"true\"></i>\n </button>\n </div>\n }\n\n <div class=\"launcher-scroll\">\n @if (IsFiltering) {\n <div class=\"launcher-grid\">\n @for (app of VisibleApps; track app.ID; let i = $index) {\n <ng-container *ngTemplateOutlet=\"appCard; context: { $implicit: app, idx: i }\"></ng-container>\n }\n </div>\n @if (VisibleApps.length === 0) {\n <div class=\"launcher-empty\">No apps match \"{{ FilterText }}\"</div>\n }\n } @else {\n @if (RecentApps.length > 0) {\n <div class=\"launcher-sect\">Recent</div>\n <div class=\"launcher-grid\" role=\"group\" aria-label=\"Recent applications\">\n @for (app of RecentApps; track app.ID; let i = $index) {\n <ng-container *ngTemplateOutlet=\"appCard; context: { $implicit: app, idx: i }\"></ng-container>\n }\n </div>\n }\n <div class=\"launcher-sect launcher-sect--row\">\n <span>All apps</span>\n <button class=\"launcher-sort-toggle\" type=\"button\"\n [attr.aria-pressed]=\"SortMode === 'alpha'\"\n [attr.aria-label]=\"SortMode === 'alpha' ? 'Sorted alphabetically — switch to your custom order' : 'Sorted by your custom order — switch to alphabetical'\"\n [title]=\"SortMode === 'alpha' ? 'Sorted A–Z — click for your custom order' : 'Custom order — click for A–Z'\"\n (click)=\"ToggleSortMode()\">\n <i [class]=\"SortMode === 'alpha' ? 'fa-solid fa-arrow-down-a-z' : 'fa-solid fa-bars-staggered'\" aria-hidden=\"true\"></i>\n </button>\n </div>\n <div class=\"launcher-grid\" role=\"group\" aria-label=\"All applications\">\n @for (app of OtherApps; track app.ID; let i = $index) {\n <ng-container *ngTemplateOutlet=\"appCard; context: { $implicit: app, idx: i + RecentApps.length }\"></ng-container>\n }\n </div>\n @if (VisibleApps.length === 0) {\n <div class=\"launcher-empty\">\n No applications are enabled for you yet — use Configure… below to add some.\n </div>\n }\n }\n </div>\n\n <div class=\"launcher-foot\">\n <span class=\"launcher-kbd-hints\" aria-hidden=\"true\">\n <span><kbd>↑</kbd><kbd>↓</kbd> navigate</span>\n <span><kbd>↵</kbd> open</span>\n <span><kbd>esc</kbd> close</span>\n </span>\n <button class=\"launcher-configure\" type=\"button\" testId=\"app-switcher-configure\" (click)=\"EnterConfigMode()\">\n <i class=\"fa-solid fa-gear\" aria-hidden=\"true\"></i>\n <span>Configure…</span>\n </button>\n </div>\n\n <span class=\"sr-only\" role=\"status\">{{ AnnouncedAppCount }} applications available</span>\n }\n </dialog>\n }\n</div>\n\n<!-- Shared app-card template: each card is a real focusable control (mjClickable\n adds role, tabindex 0, aria-label, and Enter/Space activation), so Tab walks\n the cards and arrow keys are the fast path. -->\n<ng-template #appCard let-app let-idx=\"idx\">\n <div class=\"app-card\"\n [id]=\"OptionId(idx)\"\n [mjClickable]=\"app.Name\"\n role=\"link\"\n [testId]=\"'app-switcher-item-' + app.Name\"\n [attr.aria-current]=\"IsActiveApp(app) ? 'true' : null\"\n [attr.aria-describedby]=\"app.Description ? OptionId(idx) + '-desc' : null\"\n [class.active]=\"IsActiveApp(app)\"\n [class.loading]=\"IsLoadingApp(app)\"\n [style.--app-color]=\"app.GetColor()\"\n (click)=\"selectApp(app)\"\n (keydown)=\"OnCardKeydown(idx, $event)\">\n <div class=\"app-card-glyph\">\n @if (IsLoadingApp(app)) {\n <i class=\"fa-solid fa-spinner fa-spin\" aria-hidden=\"true\"></i>\n } @else {\n <i [class]=\"app.Icon || 'fa-solid fa-cube'\" aria-hidden=\"true\"></i>\n }\n </div>\n <div class=\"app-card-text\">\n <div class=\"app-card-name\">\n <span class=\"app-card-name-label\">{{ app.Name }}</span>\n </div>\n @if (app.Description) {\n <div class=\"app-card-desc\" [id]=\"OptionId(idx) + '-desc'\">{{ app.Description }}</div>\n }\n </div>\n </div>\n</ng-template>\n\n"]}
@@ -74,6 +74,13 @@ export declare class ComponentCacheManager {
74
74
  * shares one key. A reload from `#Accounts` to `#Contacts` would then get a cache hit on the
75
75
  * Accounts component, which never has its `Data` rebound, so the tab keeps showing Accounts
76
76
  * and the tab-container's entity check fires again on every emission.
77
+ * - **RecordResource / Records (IS-A hierarchies)** — parent and child entities (e.g.
78
+ * `MJ_BizApps_Tasks: Tasks` and `MJ_BizApps_Tasks_GitHub: Git Hub Pull Request Tasks`) share
79
+ * the exact same primary key (`recordId`). Without the entity discriminator in the key,
80
+ * navigating between parent and child entity records hands back the component just detached,
81
+ * whose `Data` reports the other entity, causing an infinite synchronous reload loop that freezes
82
+ * the browser tab.
83
+ * - **AlternateBaseView overrides** — views with different `?abv=` values do not collide.
77
84
  *
78
85
  * Passing the entity name as discriminator keeps them separate. Whatever the tab-container's
79
86
  * reload check compares has to be part of this key, or a reload is handed back the component
@@ -1 +1 @@
1
- {"version":3,"file":"component-cache-manager.d.ts","sourceRoot":"","sources":["../../../../../src/lib/shell/components/tabs/component-cache-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAElC,YAAY,EAAE,YAAY,CAAC,qBAAqB,CAAC,CAAC;IAGlD,cAAc,EAAE,WAAW,CAAC;IAG5B,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IAMtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAG1B,UAAU,EAAE,OAAO,CAAC;IACpB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAG/B,QAAQ,EAAE,IAAI,CAAC;IACf,SAAS,EAAE,IAAI,CAAC;IAGhB,YAAY,EAAE,YAAY,CAAC;IAK3B,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAK1C,YAAY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lB,0CAA0C;IAC1C,UAAU,IAAI,IAAI;IAIlB;;;;;;;;;OASG;IACH,qBAAqB,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,OAAO,GAAG,MAAM;IAoBhF;;OAEG;IACH,aAAa,IAAI;QACf,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACrC;IAsBD,6CAA6C;IAC7C,aAAa,IAAI;QACf,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACrC;CAGF"}
1
+ {"version":3,"file":"component-cache-manager.d.ts","sourceRoot":"","sources":["../../../../../src/lib/shell/components/tabs/component-cache-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACrF,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAElC,YAAY,EAAE,YAAY,CAAC,qBAAqB,CAAC,CAAC;IAGlD,cAAc,EAAE,WAAW,CAAC;IAG5B,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IAMtB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAG1B,UAAU,EAAE,OAAO,CAAC;IACpB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAG/B,QAAQ,EAAE,IAAI,CAAC;IACf,SAAS,EAAE,IAAI,CAAC;IAGhB,YAAY,EAAE,YAAY,CAAC;IAK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BAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI5C;;;OAGG;IACH,UAAU,IAAI,IAAI;IAQlB,0CAA0C;IAC1C,UAAU,IAAI,IAAI;IAIlB;;;;;;;;;OASG;IACH,qBAAqB,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,OAAO,GAAG,MAAM;IAoBhF;;OAEG;IACH,aAAa,IAAI;QACf,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACrC;IAsBD,6CAA6C;IAC7C,aAAa,IAAI;QACf,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC;QACjB,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACrC;CAGF"}
@@ -50,6 +50,13 @@ export class ComponentCacheManager {
50
50
  * shares one key. A reload from `#Accounts` to `#Contacts` would then get a cache hit on the
51
51
  * Accounts component, which never has its `Data` rebound, so the tab keeps showing Accounts
52
52
  * and the tab-container's entity check fires again on every emission.
53
+ * - **RecordResource / Records (IS-A hierarchies)** — parent and child entities (e.g.
54
+ * `MJ_BizApps_Tasks: Tasks` and `MJ_BizApps_Tasks_GitHub: Git Hub Pull Request Tasks`) share
55
+ * the exact same primary key (`recordId`). Without the entity discriminator in the key,
56
+ * navigating between parent and child entity records hands back the component just detached,
57
+ * whose `Data` reports the other entity, causing an infinite synchronous reload loop that freezes
58
+ * the browser tab.
59
+ * - **AlternateBaseView overrides** — views with different `?abv=` values do not collide.
53
60
  *
54
61
  * Passing the entity name as discriminator keeps them separate. Whatever the tab-container's
55
62
  * reload check compares has to be part of this key, or a reload is handed back the component
@@ -57,13 +64,14 @@ export class ComponentCacheManager {
57
64
  */
58
65
  getCacheKey(resourceType, recordId, appId, discriminator) {
59
66
  let normalizedRecordId;
67
+ const isRecord = (resourceType ?? '').toLowerCase() === 'recordresource' || (resourceType ?? '').toLowerCase() === 'records';
60
68
  if (!recordId) {
61
69
  normalizedRecordId = discriminator ? `__new__::${discriminator}` : '__no_record__';
62
70
  }
63
71
  else if (discriminator && ComponentCacheManager.IsDynamicViewMarker(recordId)) {
64
72
  normalizedRecordId = `dynamic::${discriminator}`;
65
73
  }
66
- else if (discriminator && discriminator.includes('abv:')) {
74
+ else if (discriminator && (isRecord || discriminator.includes('abv:'))) {
67
75
  normalizedRecordId = `${recordId}::${discriminator}`;
68
76
  }
69
77
  else {
@@ -216,14 +224,15 @@ export class ComponentCacheManager {
216
224
  if (!info) {
217
225
  return false;
218
226
  }
219
- // Once a record has a real id, the discriminator no longer matters (the id is unique).
220
- // Default the new discriminator to undefined unless explicitly provided.
221
- const newKey = this.getCacheKey(resourceType, newRecordId, appId, newDiscriminator);
227
+ // Default the new discriminator to oldDiscriminator so record entities retain their entity
228
+ // discriminator (e.g. In IS-A hierarchies) after transitioning from new to saved.
229
+ const effectiveNewDiscriminator = newDiscriminator ?? oldDiscriminator;
230
+ const newKey = this.getCacheKey(resourceType, newRecordId, appId, effectiveNewDiscriminator);
222
231
  if (oldKey === newKey) {
223
232
  return false;
224
233
  }
225
234
  info.resourceRecordId = newRecordId;
226
- info.keyDiscriminator = newDiscriminator;
235
+ info.keyDiscriminator = effectiveNewDiscriminator;
227
236
  info.lastUsed = new Date();
228
237
  if (info.resourceData) {
229
238
  info.resourceData.ResourceRecordID = newRecordId;
@@ -1 +1 @@
1
- {"version":3,"file":"component-cache-manager.js","sourceRoot":"","sources":["../../../../../src/lib/shell/components/tabs/component-cache-manager.ts"],"names":[],"mappings":"AAkDA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,qBAAqB;IAiBZ;IAAgC;IAhB5C,KAAK,GAAG,IAAI,GAAG,EAA+B,CAAC;IAEvD;;;;OAIG;IACI,MAAM,CAAC,qB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CAAC;IAED;;OAEG;IACH,aAAa;QAMX,MAAM,KAAK,GAAG;YACZ,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI;YACtB,QAAQ,EAAE,CAAC;YACX,QAAQ,EAAE,CAAC;YACX,cAAc,EAAE,IAAI,GAAG,EAAkB;SAC1C,CAAC;QAEF,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACxB,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;gBACpB,KAAK,CAAC,QAAQ,EAAE,CAAC;YACnB,CAAC;iBAAM,CAAC;gBACN,KAAK,CAAC,QAAQ,EAAE,CAAC;YACnB,CAAC;YAED,MAAM,KAAK,GAAG,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;YAC/D,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC;IACf,CAAC;IAED,6CAA6C;IAC7C,aAAa;QAMX,OAAO,IAAI,CAAC,aAAa,EAAE,CAAC;IAC9B,CAAC","sourcesContent":["import { ComponentRef, ApplicationRef } from '@angular/core';\nimport { BaseResourceComponent, NavigationService } from '@memberjunction/ng-shared';\nimport { ResourceData } from '@memberjunction/core-entities';\n\n/**\n * Metadata about a cached component\n */\nexport interface CachedComponentInfo {\n // The Angular component reference\n componentRef: ComponentRef<BaseResourceComponent>; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub\n\n // The wrapper DOM element (for detaching/reattaching)\n wrapperElement: HTMLElement; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub\n\n // Resource identity (the ONLY key used for cache operations)\n resourceType: string; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub\n resourceRecordId: string; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub\n applicationId: string; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub\n\n // Optional tiebreaker used when recordId is empty (e.g., \"new record\" tabs for\n // different entities all have recordId='' but must NOT share a cache entry).\n // For entity-record resources this is the entity name; null/undefined for\n // resource types that don't need disambiguation.\n keyDiscriminator?: string; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub\n\n // Usage tracking\n isAttached: boolean; // Currently attached to a tab/container? — case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub\n attachedToTabId: string | null; // Which tab is it attached to? (metadata only, NOT used for lookup) — case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub\n\n // Lifecycle tracking\n lastUsed: Date; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub\n createdAt: Date; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub\n\n // Resource data snapshot (for comparison)\n resourceData: ResourceData; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub\n\n // Saved query params from the tab config at detach time.\n // Restored to the tab config when the component is reattached,\n // so the URL reflects the component's preserved state.\n savedQueryParams?: Record<string, string>; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub\n\n // Not written or read by the cache manager. Tools are replayed on reattach by\n // NavigationService.NotifyResourceReattached; a component that publishes agent context keeps\n // it itself and publishes it again on reattach (NavigationService.ResourceReattached$).\n AgentContext?: Record<string, unknown>;\n\n // Not written or read by the cache manager; see AgentContext.\n AgentClientTools?: { Name: string; Description: string; ParameterSchema: Record<string, unknown>; Handler: (params: Record<string, unknown>) => Promise<unknown> }[];\n}\n\n/**\n * Smart component cache manager that preserves component state across tab switches.\n *\n * ALL cache operations use a consistent identity key: `appId::resourceType::recordId`.\n * This key is the same regardless of whether the component is in Golden Layout (tabbed)\n * mode or Single Resource mode, ensuring components are reusable across both modes.\n *\n * The `attachedToTabId` field is metadata for debugging/display — it is NEVER used\n * as a lookup key. This prevents bugs where multiple resources sharing the same tab ID\n * (e.g., nav items within a single-resource app) interfere with each other's cache state.\n *\n * Features:\n * - Caches components by resource identity (appId + resourceType + recordId)\n * - Tracks component usage to prevent double-attachment\n * - Detaches/reattaches DOM elements without destroying Angular components\n * - LRU eviction when detached component count exceeds MaxDetachedComponents\n */\nexport class ComponentCacheManager {\n private cache = new Map<string, CachedComponentInfo>();\n\n /**\n * Maximum number of detached (not currently visible) components to keep\n * cached. When exceeded, least-recently-used detached components are\n * evicted. Set to 0 to disable eviction (legacy behavior). Default: 20.\n */\n public static MaxDetachedComponents: number = 20;\n\n /**\n * @param navigationService Optional — when provided, the cache manager keeps the AI agent's live\n * client-tool set in sync with the attached surface: it replays a reattached component's tools\n * ({@link NavigationService.NotifyResourceReattached}) and clears them on detach\n * ({@link NavigationService.NotifyResourceDetached}), since cached components don't re-run\n * `ngAfterViewInit`. Centralizing it here covers BOTH single-resource and Golden Layout paths.\n */\n constructor(private appRef: ApplicationRef, private navigationService?: NavigationService) {}\n\n /**\n * Generate a unique cache key from resource identity.\n * This is the ONE canonical key format used by ALL cache operations.\n *\n * `discriminator` is appended into the recordId slot when the recordId alone does not\n * identify the resource:\n * - **Empty recordId** — distinct \"new record\" tabs, e.g. a new MJ:Companies form and a new\n * MJ:Employees form, would otherwise both cache at `appId::RecordResource::__no_record__`\n * and clobber each other.\n * - **The `'dynamic'` view marker** — `NavigationService.OpenDynamicView` stamps every\n * dynamic view with that same recordId, so without the entity every dynamic view in an app\n * shares one key. A reload from `#Accounts` to `#Contacts` would then get a cache hit on the\n * Accounts component, which never has its `Data` rebound, so the tab keeps showing Accounts\n * and the tab-container's entity check fires again on every emission.\n *\n * Passing the entity name as discriminator keeps them separate. Whatever the tab-container's\n * reload check compares has to be part of this key, or a reload is handed back the component\n * it just detached.\n */\n private getCacheKey(resourceType: string, recordId: string, appId: string, discriminator?: string): string {\n let normalizedRecordId: string;\n if (!recordId) {\n normalizedRecordId = discriminator ? `__new__::${discriminator}` : '__no_record__';\n } else if (discriminator && ComponentCacheManager.IsDynamicViewMarker(recordId)) {\n normalizedRecordId = `dynamic::${discriminator}`;\n } else if (discriminator && discriminator.includes('abv:')) {\n normalizedRecordId = `${recordId}::${discriminator}`;\n } else {\n normalizedRecordId = recordId;\n }\n return `${appId}::${resourceType}::${normalizedRecordId}`;\n }\n\n /**\n * Computes the cache discriminator for a resource configuration, combining `Entity` and any\n * `AlternateBaseView` override so dynamic or saved views opened with different `?abv=` values\n * do not collide in the component cache.\n */\n public static GetCacheDiscriminator(configuration?: Record<string, unknown> | null): string | undefined {\n const entity = configuration?.Entity as string | undefined;\n const abv = (configuration?.AlternateBaseView ?? configuration?.alternateBaseView) as string | undefined;\n if (entity && abv) {\n return `${entity}|abv:${abv}`;\n }\n return entity || (abv ? `abv:${abv}` : undefined);\n }\n\n /**\n * Whether a recordId is the `'dynamic'` marker `NavigationService.OpenDynamicView` stamps on a\n * dynamic view, which is not a saved-view ID. Matched the way `ViewResourceComponent` matches it\n * (trimmed, case-insensitive), so the cache and the view agree on what counts as dynamic.\n */\n public static IsDynamicViewMarker(recordId: string | null | undefined): boolean {\n return typeof recordId === 'string' && recordId.trim().toLowerCase() === 'dynamic';\n }\n\n /**\n * Check if a component exists in cache and is available for reuse.\n */\n HasAvailableComponent(resourceType: string, recordId: string, appId: string, discriminator?: string): boolean {\n const key = this.getCacheKey(resourceType, recordId, appId, discriminator);\n const info = this.cache.get(key);\n return info !== undefined && !info.isAttached;\n }\n\n /** @deprecated Use {@link HasAvailableComponent}. */\n hasAvailableComponent(resourceType: string, recordId: string, appId: string, discriminator?: string): boolean {\n return this.HasAvailableComponent(resourceType, recordId, appId, discriminator);\n }\n\n /**\n * Get a cached component if available (not currently attached).\n * Lookup is by resource identity, not tab ID.\n */\n GetCachedComponent(resourceType: string, recordId: string, appId: string, discriminator?: string): CachedComponentInfo | null {\n const key = this.getCacheKey(resourceType, recordId, appId, discriminator);\n const info = this.cache.get(key);\n\n if (!info) {\n return null;\n }\n\n // Can only reuse if not currently attached elsewhere\n if (info.isAttached) {\n return null;\n }\n\n return info;\n }\n\n /** @deprecated Use {@link GetCachedComponent}. */\n getCachedComponent(resourceType: string, recordId: string, appId: string, discriminator?: string): CachedComponentInfo | null {\n return this.GetCachedComponent(resourceType, recordId, appId, discriminator);\n }\n\n /**\n * Store a component in the cache and mark as attached.\n */\n CacheComponent(\n componentRef: ComponentRef<BaseResourceComponent>,\n wrapperElement: HTMLElement,\n resourceData: ResourceData,\n tabId: string\n ): void {\n // Use driverClass (the actual component class name) as the resourceType for the cache key,\n // NOT resourceData.ResourceType (which is often just \"Custom\" for dashboard resources).\n // This must match the lookup key used in getCachedComponent/markAsAttached/markAsDetached.\n const resolvedResourceType = resourceData.Configuration?.resourceTypeDriverClass\n || resourceData.Configuration?.driverClass\n || resourceData.ResourceType;\n // Entity name (plus any AlternateBaseView) discriminates between distinct \"new record\" or dynamic view tabs.\n const discriminator = ComponentCacheManager.GetCacheDiscriminator(resourceData.Configuration);\n const key = this.getCacheKey(\n resolvedResourceType,\n resourceData.ResourceRecordID || '',\n resourceData.Configuration?.applicationId || '',\n discriminator\n );\n\n const info: CachedComponentInfo = {\n componentRef,\n wrapperElement,\n resourceType: resolvedResourceType,\n resourceRecordId: resourceData.ResourceRecordID || '',\n applicationId: resourceData.Configuration?.applicationId || '',\n keyDiscriminator: discriminator,\n isAttached: true,\n attachedToTabId: tabId,\n lastUsed: new Date(),\n createdAt: new Date(),\n resourceData\n };\n\n this.cache.set(key, info);\n }\n\n /** @deprecated Use {@link CacheComponent}. */\n cacheComponent(\n componentRef: ComponentRef<BaseResourceComponent>,\n wrapperElement: HTMLElement,\n resourceData: ResourceData,\n tabId: string\n ): void {\n return this.CacheComponent(componentRef, wrapperElement, resourceData, tabId);\n }\n\n /**\n * Mark a component as attached. Lookup by resource identity.\n */\n MarkAsAttached(resourceType: string, recordId: string, appId: string, tabId: string, discriminator?: string): void {\n const key = this.getCacheKey(resourceType, recordId, appId, discriminator);\n const info = this.cache.get(key);\n\n if (info) {\n info.isAttached = true;\n info.attachedToTabId = tabId;\n info.lastUsed = new Date();\n // Replay this surface's agent client tools to the AI agent on reattach (cached components keep\n // their instance but never re-run ngAfterViewInit, so they don't re-register on their own).\n this.navigationService?.NotifyResourceReattached(info.componentRef.instance);\n }\n }\n\n /** @deprecated Use {@link MarkAsAttached}. */\n markAsAttached(resourceType: string, recordId: string, appId: string, tabId: string, discriminator?: string): void {\n return this.MarkAsAttached(resourceType, recordId, appId, tabId, discriminator);\n }\n\n /**\n * Mark a component as detached (available for reuse). Lookup by resource identity.\n *\n * This is the ONLY way to detach a component. Both single-resource mode and\n * Golden Layout mode use this same method to ensure consistent cache behavior.\n */\n MarkAsDetached(resourceType: string, recordId: string, appId: string, discriminator?: string): CachedComponentInfo | null {\n const key = this.getCacheKey(resourceType, recordId, appId, discriminator);\n const info = this.cache.get(key);\n if (!info) return null;\n\n info.isAttached = false;\n info.attachedToTabId = null;\n info.lastUsed = new Date();\n // Clear this surface's agent client tools on detach so the previous app's tools aren't offered to\n // the AI agent on the next surface. NotifyResourceReattached replays them if the user returns.\n this.navigationService?.NotifyResourceDetached(info.componentRef.instance);\n this.evictIfNeeded();\n return info;\n }\n\n /** @deprecated Use {@link MarkAsDetached}. */\n markAsDetached(resourceType: string, recordId: string, appId: string, discriminator?: string): CachedComponentInfo | null {\n return this.MarkAsDetached(resourceType, recordId, appId, discriminator);\n }\n\n /**\n * Re-key a cached component when its underlying record identity changes.\n *\n * Used when a \"new record\" component (cached at `recordId = ''`) becomes a saved record\n * (now identified by its new PK). Without re-keying, the next \"new record\" request would\n * still resolve to this same cache entry, surfacing the previously-saved record on a form\n * the user expects to be blank.\n *\n * Preserves the live component instance — only the cache key + stored identity change.\n * Returns true if a matching entry was found and re-keyed, false otherwise.\n */\n RekeyComponent(\n resourceType: string,\n oldRecordId: string,\n newRecordId: string,\n appId: string,\n oldDiscriminator?: string,\n newDiscriminator?: string\n ): boolean {\n const oldKey = this.getCacheKey(resourceType, oldRecordId, appId, oldDiscriminator);\n const info = this.cache.get(oldKey);\n if (!info) {\n return false;\n }\n\n // Once a record has a real id, the discriminator no longer matters (the id is unique).\n // Default the new discriminator to undefined unless explicitly provided.\n const newKey = this.getCacheKey(resourceType, newRecordId, appId, newDiscriminator);\n if (oldKey === newKey) {\n return false;\n }\n\n info.resourceRecordId = newRecordId;\n info.keyDiscriminator = newDiscriminator;\n info.lastUsed = new Date();\n if (info.resourceData) {\n info.resourceData.ResourceRecordID = newRecordId;\n }\n\n this.cache.delete(oldKey);\n this.cache.set(newKey, info);\n return true;\n }\n\n /** @deprecated Use {@link RekeyComponent}. */\n rekeyComponent(\n resourceType: string,\n oldRecordId: string,\n newRecordId: string,\n appId: string,\n oldDiscriminator?: string,\n newDiscriminator?: string\n ): boolean {\n return this.RekeyComponent(resourceType, oldRecordId, newRecordId, appId, oldDiscriminator, newDiscriminator);\n }\n\n /**\n * Find a cached component by tab ID and detach it.\n * This is a convenience wrapper for callers that only know the tab ID\n * (e.g., Golden Layout tab close events). It resolves the tab ID to\n * resource identity, then delegates to the identity-based markAsDetached.\n */\n FindAndDetachByTabId(tabId: string): CachedComponentInfo | null {\n const entry = Array.from(this.cache.entries())\n .find(([_, info]) => info.attachedToTabId === tabId);\n\n if (!entry) return null;\n\n const [_, info] = entry;\n return this.MarkAsDetached(info.resourceType, info.resourceRecordId, info.applicationId, info.keyDiscriminator);\n }\n\n /** @deprecated Use {@link FindAndDetachByTabId}. */\n findAndDetachByTabId(tabId: string): CachedComponentInfo | null {\n return this.FindAndDetachByTabId(tabId);\n }\n\n /**\n * Evict least-recently-used detached components when over the limit.\n * Only evicts components that are not currently attached.\n */\n private evictIfNeeded(): void {\n if (ComponentCacheManager.MaxDetachedComponents <= 0) return;\n\n const detached = Array.from(this.cache.entries())\n .filter(([_, info]) => !info.isAttached)\n .sort((a, b) => a[1].lastUsed.getTime() - b[1].lastUsed.getTime());\n\n while (detached.length > ComponentCacheManager.MaxDetachedComponents) {\n const [key, info] = detached.shift()!;\n // Drop the destroyed component's cached agent tools so the registry doesn't retain a dead ref.\n this.navigationService?.ForgetResource(info.componentRef.instance);\n this.appRef.detachView(info.componentRef.hostView);\n info.componentRef.destroy();\n this.cache.delete(key);\n }\n }\n\n /**\n * Get component info by tab ID (for finding what's attached to a tab).\n * Uses linear scan since tabId is metadata, not a key.\n */\n GetComponentByTabId(tabId: string): CachedComponentInfo | null {\n const entry = Array.from(this.cache.entries())\n .find(([_, info]) => info.attachedToTabId === tabId);\n\n return entry ? entry[1] : null;\n }\n\n /** @deprecated Use {@link GetComponentByTabId}. */\n getComponentByTabId(tabId: string): CachedComponentInfo | null {\n return this.GetComponentByTabId(tabId);\n }\n\n /**\n * Remove and destroy a specific component from cache by resource identity.\n */\n DestroyComponent(resourceType: string, recordId: string, appId: string, discriminator?: string): void {\n const key = this.getCacheKey(resourceType, recordId, appId, discriminator);\n const info = this.cache.get(key);\n\n if (!info) return;\n\n this.navigationService?.ForgetResource(info.componentRef.instance);\n this.appRef.detachView(info.componentRef.hostView);\n info.componentRef.destroy();\n this.cache.delete(key);\n }\n\n /** @deprecated Use {@link DestroyComponent}. */\n destroyComponent(resourceType: string, recordId: string, appId: string, discriminator?: string): void {\n return this.DestroyComponent(resourceType, recordId, appId, discriminator);\n }\n\n /**\n * Remove and destroy component by tab ID (convenience for Golden Layout tab close).\n */\n DestroyComponentByTabId(tabId: string): void {\n const entry = Array.from(this.cache.entries())\n .find(([_, info]) => info.attachedToTabId === tabId);\n\n if (!entry) return;\n\n const [key, info] = entry;\n this.appRef.detachView(info.componentRef.hostView);\n info.componentRef.destroy();\n this.cache.delete(key);\n }\n\n /** @deprecated Use {@link DestroyComponentByTabId}. */\n destroyComponentByTabId(tabId: string): void {\n return this.DestroyComponentByTabId(tabId);\n }\n\n /**\n * Clear the entire cache, destroying all components.\n * Call this on user logout or app shutdown.\n */\n ClearCache(): void {\n this.cache.forEach(info => {\n this.appRef.detachView(info.componentRef.hostView);\n info.componentRef.destroy();\n });\n this.cache.clear();\n }\n\n /** @deprecated Use {@link ClearCache}. */\n clearCache(): void {\n return this.ClearCache();\n }\n\n /**\n * Selectively clear cached components matching a predicate.\n * Components that match are destroyed; those that don't are kept.\n *\n * Use this for tenant switching: clear org-scoped components while\n * keeping system/global components alive.\n *\n * @param predicate Return true for components that should be destroyed.\n * @returns Number of components destroyed.\n */\n ClearCacheByPredicate(predicate: (info: CachedComponentInfo) => boolean): number {\n let destroyed = 0;\n const toRemove: string[] = [];\n\n this.cache.forEach((info, key) => {\n if (predicate(info)) {\n this.appRef.detachView(info.componentRef.hostView);\n info.componentRef.destroy();\n toRemove.push(key);\n destroyed++;\n }\n });\n\n for (const key of toRemove) {\n this.cache.delete(key);\n }\n\n return destroyed;\n }\n\n /**\n * Get cache statistics for debugging.\n */\n GetCacheStats(): {\n total: number;\n attached: number;\n detached: number;\n byResourceType: Map<string, number>;\n } {\n const stats = {\n total: this.cache.size,\n attached: 0,\n detached: 0,\n byResourceType: new Map<string, number>()\n };\n\n this.cache.forEach(info => {\n if (info.isAttached) {\n stats.attached++;\n } else {\n stats.detached++;\n }\n\n const count = stats.byResourceType.get(info.resourceType) || 0;\n stats.byResourceType.set(info.resourceType, count + 1);\n });\n\n return stats;\n }\n\n /** @deprecated Use {@link GetCacheStats}. */\n getCacheStats(): {\n total: number;\n attached: number;\n detached: number;\n byResourceType: Map<string, number>;\n } {\n return this.GetCacheStats();\n }\n}\n"]}
1
+ {"version":3,"file":"component-cache-manager.js","sourceRoot":"","sources":["../../../../../src/lib/shell/components/tabs/component-cache-manager.ts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ent, NavigationService } from '@memberjunction/ng-shared';\nimport { ResourceData } from '@memberjunction/core-entities';\n\n/**\n * Metadata about a cached component\n */\nexport interface CachedComponentInfo {\n // The Angular component reference\n componentRef: ComponentRef<BaseResourceComponent>; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub\n\n // The wrapper DOM element (for detaching/reattaching)\n wrapperElement: HTMLElement; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub\n\n // Resource identity (the ONLY key used for cache operations)\n resourceType: string; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub\n resourceRecordId: string; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub\n applicationId: string; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub\n\n // Optional tiebreaker used when recordId is empty (e.g., \"new record\" tabs for\n // different entities all have recordId='' but must NOT share a cache entry).\n // For entity-record resources this is the entity name; null/undefined for\n // resource types that don't need disambiguation.\n keyDiscriminator?: string; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub\n\n // Usage tracking\n isAttached: boolean; // Currently attached to a tab/container? — case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub\n attachedToTabId: string | null; // Which tab is it attached to? (metadata only, NOT used for lookup) — case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub\n\n // Lifecycle tracking\n lastUsed: Date; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub\n createdAt: Date; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub\n\n // Resource data snapshot (for comparison)\n resourceData: ResourceData; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub\n\n // Saved query params from the tab config at detach time.\n // Restored to the tab config when the component is reattached,\n // so the URL reflects the component's preserved state.\n savedQueryParams?: Record<string, string>; // case-violation-ok-legacy-back-compat: the type is named in an exported signature, so consumers build object literals against it; an interface has no runtime carrier for a stub\n\n // Not written or read by the cache manager. Tools are replayed on reattach by\n // NavigationService.NotifyResourceReattached; a component that publishes agent context keeps\n // it itself and publishes it again on reattach (NavigationService.ResourceReattached$).\n AgentContext?: Record<string, unknown>;\n\n // Not written or read by the cache manager; see AgentContext.\n AgentClientTools?: { Name: string; Description: string; ParameterSchema: Record<string, unknown>; Handler: (params: Record<string, unknown>) => Promise<unknown> }[];\n}\n\n/**\n * Smart component cache manager that preserves component state across tab switches.\n *\n * ALL cache operations use a consistent identity key: `appId::resourceType::recordId`.\n * This key is the same regardless of whether the component is in Golden Layout (tabbed)\n * mode or Single Resource mode, ensuring components are reusable across both modes.\n *\n * The `attachedToTabId` field is metadata for debugging/display — it is NEVER used\n * as a lookup key. This prevents bugs where multiple resources sharing the same tab ID\n * (e.g., nav items within a single-resource app) interfere with each other's cache state.\n *\n * Features:\n * - Caches components by resource identity (appId + resourceType + recordId)\n * - Tracks component usage to prevent double-attachment\n * - Detaches/reattaches DOM elements without destroying Angular components\n * - LRU eviction when detached component count exceeds MaxDetachedComponents\n */\nexport class ComponentCacheManager {\n private cache = new Map<string, CachedComponentInfo>();\n\n /**\n * Maximum number of detached (not currently visible) components to keep\n * cached. When exceeded, least-recently-used detached components are\n * evicted. Set to 0 to disable eviction (legacy behavior). Default: 20.\n */\n public static MaxDetachedComponents: number = 20;\n\n /**\n * @param navigationService Optional — when provided, the cache manager keeps the AI agent's live\n * client-tool set in sync with the attached surface: it replays a reattached component's tools\n * ({@link NavigationService.NotifyResourceReattached}) and clears them on detach\n * ({@link NavigationService.NotifyResourceDetached}), since cached components don't re-run\n * `ngAfterViewInit`. Centralizing it here covers BOTH single-resource and Golden Layout paths.\n */\n constructor(private appRef: ApplicationRef, private navigationService?: NavigationService) {}\n\n /**\n * Generate a unique cache key from resource identity.\n * This is the ONE canonical key format used by ALL cache operations.\n *\n * `discriminator` is appended into the recordId slot when the recordId alone does not\n * identify the resource:\n * - **Empty recordId** — distinct \"new record\" tabs, e.g. a new MJ:Companies form and a new\n * MJ:Employees form, would otherwise both cache at `appId::RecordResource::__no_record__`\n * and clobber each other.\n * - **The `'dynamic'` view marker** — `NavigationService.OpenDynamicView` stamps every\n * dynamic view with that same recordId, so without the entity every dynamic view in an app\n * shares one key. A reload from `#Accounts` to `#Contacts` would then get a cache hit on the\n * Accounts component, which never has its `Data` rebound, so the tab keeps showing Accounts\n * and the tab-container's entity check fires again on every emission.\n * - **RecordResource / Records (IS-A hierarchies)** — parent and child entities (e.g.\n * `MJ_BizApps_Tasks: Tasks` and `MJ_BizApps_Tasks_GitHub: Git Hub Pull Request Tasks`) share\n * the exact same primary key (`recordId`). Without the entity discriminator in the key,\n * navigating between parent and child entity records hands back the component just detached,\n * whose `Data` reports the other entity, causing an infinite synchronous reload loop that freezes\n * the browser tab.\n * - **AlternateBaseView overrides** — views with different `?abv=` values do not collide.\n *\n * Passing the entity name as discriminator keeps them separate. Whatever the tab-container's\n * reload check compares has to be part of this key, or a reload is handed back the component\n * it just detached.\n */\n private getCacheKey(resourceType: string, recordId: string, appId: string, discriminator?: string): string {\n let normalizedRecordId: string;\n const isRecord = (resourceType ?? '').toLowerCase() === 'recordresource' || (resourceType ?? '').toLowerCase() === 'records';\n if (!recordId) {\n normalizedRecordId = discriminator ? `__new__::${discriminator}` : '__no_record__';\n } else if (discriminator && ComponentCacheManager.IsDynamicViewMarker(recordId)) {\n normalizedRecordId = `dynamic::${discriminator}`;\n } else if (discriminator && (isRecord || discriminator.includes('abv:'))) {\n normalizedRecordId = `${recordId}::${discriminator}`;\n } else {\n normalizedRecordId = recordId;\n }\n return `${appId}::${resourceType}::${normalizedRecordId}`;\n }\n\n /**\n * Computes the cache discriminator for a resource configuration, combining `Entity` and any\n * `AlternateBaseView` override so dynamic or saved views opened with different `?abv=` values\n * do not collide in the component cache.\n */\n public static GetCacheDiscriminator(configuration?: Record<string, unknown> | null): string | undefined {\n const entity = configuration?.Entity as string | undefined;\n const abv = (configuration?.AlternateBaseView ?? configuration?.alternateBaseView) as string | undefined;\n if (entity && abv) {\n return `${entity}|abv:${abv}`;\n }\n return entity || (abv ? `abv:${abv}` : undefined);\n }\n\n /**\n * Whether a recordId is the `'dynamic'` marker `NavigationService.OpenDynamicView` stamps on a\n * dynamic view, which is not a saved-view ID. Matched the way `ViewResourceComponent` matches it\n * (trimmed, case-insensitive), so the cache and the view agree on what counts as dynamic.\n */\n public static IsDynamicViewMarker(recordId: string | null | undefined): boolean {\n return typeof recordId === 'string' && recordId.trim().toLowerCase() === 'dynamic';\n }\n\n /**\n * Check if a component exists in cache and is available for reuse.\n */\n HasAvailableComponent(resourceType: string, recordId: string, appId: string, discriminator?: string): boolean {\n const key = this.getCacheKey(resourceType, recordId, appId, discriminator);\n const info = this.cache.get(key);\n return info !== undefined && !info.isAttached;\n }\n\n /** @deprecated Use {@link HasAvailableComponent}. */\n hasAvailableComponent(resourceType: string, recordId: string, appId: string, discriminator?: string): boolean {\n return this.HasAvailableComponent(resourceType, recordId, appId, discriminator);\n }\n\n /**\n * Get a cached component if available (not currently attached).\n * Lookup is by resource identity, not tab ID.\n */\n GetCachedComponent(resourceType: string, recordId: string, appId: string, discriminator?: string): CachedComponentInfo | null {\n const key = this.getCacheKey(resourceType, recordId, appId, discriminator);\n const info = this.cache.get(key);\n\n if (!info) {\n return null;\n }\n\n // Can only reuse if not currently attached elsewhere\n if (info.isAttached) {\n return null;\n }\n\n return info;\n }\n\n /** @deprecated Use {@link GetCachedComponent}. */\n getCachedComponent(resourceType: string, recordId: string, appId: string, discriminator?: string): CachedComponentInfo | null {\n return this.GetCachedComponent(resourceType, recordId, appId, discriminator);\n }\n\n /**\n * Store a component in the cache and mark as attached.\n */\n CacheComponent(\n componentRef: ComponentRef<BaseResourceComponent>,\n wrapperElement: HTMLElement,\n resourceData: ResourceData,\n tabId: string\n ): void {\n // Use driverClass (the actual component class name) as the resourceType for the cache key,\n // NOT resourceData.ResourceType (which is often just \"Custom\" for dashboard resources).\n // This must match the lookup key used in getCachedComponent/markAsAttached/markAsDetached.\n const resolvedResourceType = resourceData.Configuration?.resourceTypeDriverClass\n || resourceData.Configuration?.driverClass\n || resourceData.ResourceType;\n // Entity name (plus any AlternateBaseView) discriminates between distinct \"new record\" or dynamic view tabs.\n const discriminator = ComponentCacheManager.GetCacheDiscriminator(resourceData.Configuration);\n const key = this.getCacheKey(\n resolvedResourceType,\n resourceData.ResourceRecordID || '',\n resourceData.Configuration?.applicationId || '',\n discriminator\n );\n\n const info: CachedComponentInfo = {\n componentRef,\n wrapperElement,\n resourceType: resolvedResourceType,\n resourceRecordId: resourceData.ResourceRecordID || '',\n applicationId: resourceData.Configuration?.applicationId || '',\n keyDiscriminator: discriminator,\n isAttached: true,\n attachedToTabId: tabId,\n lastUsed: new Date(),\n createdAt: new Date(),\n resourceData\n };\n\n this.cache.set(key, info);\n }\n\n /** @deprecated Use {@link CacheComponent}. */\n cacheComponent(\n componentRef: ComponentRef<BaseResourceComponent>,\n wrapperElement: HTMLElement,\n resourceData: ResourceData,\n tabId: string\n ): void {\n return this.CacheComponent(componentRef, wrapperElement, resourceData, tabId);\n }\n\n /**\n * Mark a component as attached. Lookup by resource identity.\n */\n MarkAsAttached(resourceType: string, recordId: string, appId: string, tabId: string, discriminator?: string): void {\n const key = this.getCacheKey(resourceType, recordId, appId, discriminator);\n const info = this.cache.get(key);\n\n if (info) {\n info.isAttached = true;\n info.attachedToTabId = tabId;\n info.lastUsed = new Date();\n // Replay this surface's agent client tools to the AI agent on reattach (cached components keep\n // their instance but never re-run ngAfterViewInit, so they don't re-register on their own).\n this.navigationService?.NotifyResourceReattached(info.componentRef.instance);\n }\n }\n\n /** @deprecated Use {@link MarkAsAttached}. */\n markAsAttached(resourceType: string, recordId: string, appId: string, tabId: string, discriminator?: string): void {\n return this.MarkAsAttached(resourceType, recordId, appId, tabId, discriminator);\n }\n\n /**\n * Mark a component as detached (available for reuse). Lookup by resource identity.\n *\n * This is the ONLY way to detach a component. Both single-resource mode and\n * Golden Layout mode use this same method to ensure consistent cache behavior.\n */\n MarkAsDetached(resourceType: string, recordId: string, appId: string, discriminator?: string): CachedComponentInfo | null {\n const key = this.getCacheKey(resourceType, recordId, appId, discriminator);\n const info = this.cache.get(key);\n if (!info) return null;\n\n info.isAttached = false;\n info.attachedToTabId = null;\n info.lastUsed = new Date();\n // Clear this surface's agent client tools on detach so the previous app's tools aren't offered to\n // the AI agent on the next surface. NotifyResourceReattached replays them if the user returns.\n this.navigationService?.NotifyResourceDetached(info.componentRef.instance);\n this.evictIfNeeded();\n return info;\n }\n\n /** @deprecated Use {@link MarkAsDetached}. */\n markAsDetached(resourceType: string, recordId: string, appId: string, discriminator?: string): CachedComponentInfo | null {\n return this.MarkAsDetached(resourceType, recordId, appId, discriminator);\n }\n\n /**\n * Re-key a cached component when its underlying record identity changes.\n *\n * Used when a \"new record\" component (cached at `recordId = ''`) becomes a saved record\n * (now identified by its new PK). Without re-keying, the next \"new record\" request would\n * still resolve to this same cache entry, surfacing the previously-saved record on a form\n * the user expects to be blank.\n *\n * Preserves the live component instance — only the cache key + stored identity change.\n * Returns true if a matching entry was found and re-keyed, false otherwise.\n */\n RekeyComponent(\n resourceType: string,\n oldRecordId: string,\n newRecordId: string,\n appId: string,\n oldDiscriminator?: string,\n newDiscriminator?: string\n ): boolean {\n const oldKey = this.getCacheKey(resourceType, oldRecordId, appId, oldDiscriminator);\n const info = this.cache.get(oldKey);\n if (!info) {\n return false;\n }\n\n // Default the new discriminator to oldDiscriminator so record entities retain their entity\n // discriminator (e.g. In IS-A hierarchies) after transitioning from new to saved.\n const effectiveNewDiscriminator = newDiscriminator ?? oldDiscriminator;\n const newKey = this.getCacheKey(resourceType, newRecordId, appId, effectiveNewDiscriminator);\n if (oldKey === newKey) {\n return false;\n }\n\n info.resourceRecordId = newRecordId;\n info.keyDiscriminator = effectiveNewDiscriminator;\n info.lastUsed = new Date();\n if (info.resourceData) {\n info.resourceData.ResourceRecordID = newRecordId;\n }\n\n this.cache.delete(oldKey);\n this.cache.set(newKey, info);\n return true;\n }\n\n /** @deprecated Use {@link RekeyComponent}. */\n rekeyComponent(\n resourceType: string,\n oldRecordId: string,\n newRecordId: string,\n appId: string,\n oldDiscriminator?: string,\n newDiscriminator?: string\n ): boolean {\n return this.RekeyComponent(resourceType, oldRecordId, newRecordId, appId, oldDiscriminator, newDiscriminator);\n }\n\n /**\n * Find a cached component by tab ID and detach it.\n * This is a convenience wrapper for callers that only know the tab ID\n * (e.g., Golden Layout tab close events). It resolves the tab ID to\n * resource identity, then delegates to the identity-based markAsDetached.\n */\n FindAndDetachByTabId(tabId: string): CachedComponentInfo | null {\n const entry = Array.from(this.cache.entries())\n .find(([_, info]) => info.attachedToTabId === tabId);\n\n if (!entry) return null;\n\n const [_, info] = entry;\n return this.MarkAsDetached(info.resourceType, info.resourceRecordId, info.applicationId, info.keyDiscriminator);\n }\n\n /** @deprecated Use {@link FindAndDetachByTabId}. */\n findAndDetachByTabId(tabId: string): CachedComponentInfo | null {\n return this.FindAndDetachByTabId(tabId);\n }\n\n /**\n * Evict least-recently-used detached components when over the limit.\n * Only evicts components that are not currently attached.\n */\n private evictIfNeeded(): void {\n if (ComponentCacheManager.MaxDetachedComponents <= 0) return;\n\n const detached = Array.from(this.cache.entries())\n .filter(([_, info]) => !info.isAttached)\n .sort((a, b) => a[1].lastUsed.getTime() - b[1].lastUsed.getTime());\n\n while (detached.length > ComponentCacheManager.MaxDetachedComponents) {\n const [key, info] = detached.shift()!;\n // Drop the destroyed component's cached agent tools so the registry doesn't retain a dead ref.\n this.navigationService?.ForgetResource(info.componentRef.instance);\n this.appRef.detachView(info.componentRef.hostView);\n info.componentRef.destroy();\n this.cache.delete(key);\n }\n }\n\n /**\n * Get component info by tab ID (for finding what's attached to a tab).\n * Uses linear scan since tabId is metadata, not a key.\n */\n GetComponentByTabId(tabId: string): CachedComponentInfo | null {\n const entry = Array.from(this.cache.entries())\n .find(([_, info]) => info.attachedToTabId === tabId);\n\n return entry ? entry[1] : null;\n }\n\n /** @deprecated Use {@link GetComponentByTabId}. */\n getComponentByTabId(tabId: string): CachedComponentInfo | null {\n return this.GetComponentByTabId(tabId);\n }\n\n /**\n * Remove and destroy a specific component from cache by resource identity.\n */\n DestroyComponent(resourceType: string, recordId: string, appId: string, discriminator?: string): void {\n const key = this.getCacheKey(resourceType, recordId, appId, discriminator);\n const info = this.cache.get(key);\n\n if (!info) return;\n\n this.navigationService?.ForgetResource(info.componentRef.instance);\n this.appRef.detachView(info.componentRef.hostView);\n info.componentRef.destroy();\n this.cache.delete(key);\n }\n\n /** @deprecated Use {@link DestroyComponent}. */\n destroyComponent(resourceType: string, recordId: string, appId: string, discriminator?: string): void {\n return this.DestroyComponent(resourceType, recordId, appId, discriminator);\n }\n\n /**\n * Remove and destroy component by tab ID (convenience for Golden Layout tab close).\n */\n DestroyComponentByTabId(tabId: string): void {\n const entry = Array.from(this.cache.entries())\n .find(([_, info]) => info.attachedToTabId === tabId);\n\n if (!entry) return;\n\n const [key, info] = entry;\n this.appRef.detachView(info.componentRef.hostView);\n info.componentRef.destroy();\n this.cache.delete(key);\n }\n\n /** @deprecated Use {@link DestroyComponentByTabId}. */\n destroyComponentByTabId(tabId: string): void {\n return this.DestroyComponentByTabId(tabId);\n }\n\n /**\n * Clear the entire cache, destroying all components.\n * Call this on user logout or app shutdown.\n */\n ClearCache(): void {\n this.cache.forEach(info => {\n this.appRef.detachView(info.componentRef.hostView);\n info.componentRef.destroy();\n });\n this.cache.clear();\n }\n\n /** @deprecated Use {@link ClearCache}. */\n clearCache(): void {\n return this.ClearCache();\n }\n\n /**\n * Selectively clear cached components matching a predicate.\n * Components that match are destroyed; those that don't are kept.\n *\n * Use this for tenant switching: clear org-scoped components while\n * keeping system/global components alive.\n *\n * @param predicate Return true for components that should be destroyed.\n * @returns Number of components destroyed.\n */\n ClearCacheByPredicate(predicate: (info: CachedComponentInfo) => boolean): number {\n let destroyed = 0;\n const toRemove: string[] = [];\n\n this.cache.forEach((info, key) => {\n if (predicate(info)) {\n this.appRef.detachView(info.componentRef.hostView);\n info.componentRef.destroy();\n toRemove.push(key);\n destroyed++;\n }\n });\n\n for (const key of toRemove) {\n this.cache.delete(key);\n }\n\n return destroyed;\n }\n\n /**\n * Get cache statistics for debugging.\n */\n GetCacheStats(): {\n total: number;\n attached: number;\n detached: number;\n byResourceType: Map<string, number>;\n } {\n const stats = {\n total: this.cache.size,\n attached: 0,\n detached: 0,\n byResourceType: new Map<string, number>()\n };\n\n this.cache.forEach(info => {\n if (info.isAttached) {\n stats.attached++;\n } else {\n stats.detached++;\n }\n\n const count = stats.byResourceType.get(info.resourceType) || 0;\n stats.byResourceType.set(info.resourceType, count + 1);\n });\n\n return stats;\n }\n\n /** @deprecated Use {@link GetCacheStats}. */\n getCacheStats(): {\n total: number;\n attached: number;\n detached: number;\n byResourceType: Map<string, number>;\n } {\n return this.GetCacheStats();\n }\n}\n"]}
@@ -255,6 +255,47 @@ export declare class TabContainerComponent extends BaseAngularComponent implemen
255
255
  * inconsistency #4345 set out to remove.
256
256
  */
257
257
  private promoteIfReattachedEditing;
258
+ private hiddenTabIds?;
259
+ private wiredContainers?;
260
+ private getHiddenTabIds;
261
+ private getWiredContainers;
262
+ /**
263
+ * Determines whether a tab's pane is currently visible on screen, accounting for:
264
+ * - Active tab focus
265
+ * - Side-by-side Golden Layout split panes (`glContainer.isHidden === false`)
266
+ * - Stacked background tabs (`glContainer.isHidden === true` or `hide` event)
267
+ * - Dual Main/Records region visibility (`ShowRecordsRegion`)
268
+ */
269
+ private isTabCurrentlyVisible;
270
+ /**
271
+ * Deactivates change detection for a hidden or inactive tab view.
272
+ * Detaches the component's ChangeDetectorRef so background/idle tabs
273
+ * do not participate in Angular change detection passes.
274
+ */
275
+ DeactivateTabView(tabId: string): void;
276
+ /** @deprecated Use {@link DeactivateTabView}. */
277
+ deactivateTabView(tabId: string): void;
278
+ /**
279
+ * Activates change detection for a visible/active tab view.
280
+ * Reattaches the component's ChangeDetectorRef and triggers markForCheck()
281
+ * so updates accumulated while inactive are rendered immediately.
282
+ */
283
+ ActivateTabView(tabId: string): void;
284
+ /** @deprecated Use {@link ActivateTabView}. */
285
+ activateTabView(tabId: string): void;
286
+ /**
287
+ * Synchronizes change detection across all tab components.
288
+ * Reattaches the active tab AND any visible side-by-side split-pane tabs in the active
289
+ * region, while detaching hidden/stacked tabs and tabs in the inactive region.
290
+ */
291
+ SyncTabChangeDetection(activeTabId: string | null): void;
292
+ /** @deprecated Use {@link SyncTabChangeDetection}. */
293
+ syncTabChangeDetection(activeTabId: string | null): void;
294
+ /**
295
+ * Wires Golden Layout container show/hide events to activate/deactivate
296
+ * the component's Angular change detection when tabs are hidden or shown.
297
+ */
298
+ private wireContainerVisibilityEvents;
258
299
  /**
259
300
  * Records-region mirror of the main sync path's `needsReload` check (see
260
301
  * {@link syncTabsWithConfiguration}). Temp-tab consumption overwrites a