cloud-ide-layout 1.0.181 → 1.0.182

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 (14) hide show
  1. package/fesm2022/{cloud-ide-layout-cloud-ide-layout-BlLjLM3N.mjs → cloud-ide-layout-cloud-ide-layout-l6s-ph1q.mjs} +107 -68
  2. package/fesm2022/cloud-ide-layout-cloud-ide-layout-l6s-ph1q.mjs.map +1 -0
  3. package/fesm2022/{cloud-ide-layout-dashboard-manager.component-DWxN9ReS.mjs → cloud-ide-layout-dashboard-manager.component-BFmWPx5q.mjs} +2 -2
  4. package/fesm2022/{cloud-ide-layout-dashboard-manager.component-DWxN9ReS.mjs.map → cloud-ide-layout-dashboard-manager.component-BFmWPx5q.mjs.map} +1 -1
  5. package/fesm2022/{cloud-ide-layout-drawer-theme.component-D4qmt25K.mjs → cloud-ide-layout-drawer-theme.component-HsFPpuk1.mjs} +2 -2
  6. package/fesm2022/{cloud-ide-layout-drawer-theme.component-D4qmt25K.mjs.map → cloud-ide-layout-drawer-theme.component-HsFPpuk1.mjs.map} +1 -1
  7. package/fesm2022/{cloud-ide-layout-home-wrapper.component-DeR1T21C.mjs → cloud-ide-layout-home-wrapper.component-C9F3Ph0U.mjs} +2 -2
  8. package/fesm2022/{cloud-ide-layout-home-wrapper.component-DeR1T21C.mjs.map → cloud-ide-layout-home-wrapper.component-C9F3Ph0U.mjs.map} +1 -1
  9. package/fesm2022/{cloud-ide-layout-sidedrawer-notes.component-BuDfM6ms.mjs → cloud-ide-layout-sidedrawer-notes.component-9ZGNNWMi.mjs} +2 -2
  10. package/fesm2022/{cloud-ide-layout-sidedrawer-notes.component-BuDfM6ms.mjs.map → cloud-ide-layout-sidedrawer-notes.component-9ZGNNWMi.mjs.map} +1 -1
  11. package/fesm2022/cloud-ide-layout.mjs +1 -1
  12. package/index.d.ts +10 -0
  13. package/package.json +1 -1
  14. package/fesm2022/cloud-ide-layout-cloud-ide-layout-BlLjLM3N.mjs.map +0 -1
@@ -4734,11 +4734,82 @@ class CustomRouteReuseStrategy {
4734
4734
  shouldReuseRoute(future, curr) {
4735
4735
  return future.routeConfig === curr.routeConfig;
4736
4736
  }
4737
- // Clears a stored route, typically when a tab is closed.
4738
- // This method now properly destroys the component instance to prevent memory leaks
4739
- // and ensure old data doesn't persist when reopening the same route.
4740
- clearStoredRoute(pathKey) {
4741
- const handle = this.storedRoutes[pathKey];
4737
+ /**
4738
+ * Clears a stored route by path and optional parameters.
4739
+ * This method attempts to find a matching stored route using a robust matching algorithm.
4740
+ */
4741
+ clearRoute(path, params) {
4742
+ // 1. Try to construct the exact key first
4743
+ let exactKey = path;
4744
+ // Normalize path: remove leading slash if present
4745
+ if (exactKey.startsWith('/')) {
4746
+ exactKey = exactKey.substring(1);
4747
+ }
4748
+ // Attempt to construct key with params if they exist
4749
+ let exactKeyWithParams = exactKey;
4750
+ if (params && Object.keys(params).length > 0) {
4751
+ const queryParams = Object.keys(params)
4752
+ .sort()
4753
+ .map(key => `${key}=${params[key]}`)
4754
+ .join('&');
4755
+ exactKeyWithParams += '?' + queryParams;
4756
+ }
4757
+ // Check strict match first
4758
+ if (this.storedRoutes[exactKeyWithParams]) {
4759
+ console.log(`🎯 [RouteReuseStrategy] Found exact match for clearing: ${exactKeyWithParams}`);
4760
+ this.destroyAndRemove(exactKeyWithParams);
4761
+ return;
4762
+ }
4763
+ // Check if the key exists without params (sometimes stored without them if no reuseTab data at that moment)
4764
+ if (this.storedRoutes[exactKey]) {
4765
+ console.log(`🎯 [RouteReuseStrategy] Found path-only match for clearing: ${exactKey}`);
4766
+ this.destroyAndRemove(exactKey);
4767
+ return;
4768
+ }
4769
+ // 2. Fuzzy Match: Iterate through all keys to find a substantial match
4770
+ // This handles cases where params might be string vs number, or order differences not caught by simple sort
4771
+ console.log(`🔍 [RouteReuseStrategy] No exact match for ${exactKeyWithParams}. Searching candidates...`);
4772
+ const candidates = Object.keys(this.storedRoutes);
4773
+ for (const startKey of candidates) {
4774
+ // Check if the path part matches
4775
+ const [storedPath, storedQuery] = startKey.split('?');
4776
+ if (storedPath === exactKey || storedPath === '/' + exactKey) {
4777
+ // Path matches. Now check params if requested
4778
+ if (!params || Object.keys(params).length === 0) {
4779
+ // If we didn't ask for specific params, and we found a path match, this is likely it
4780
+ // BUT be careful not to delete a specific parameterized tab if we meant a generic one
4781
+ // For safety, if the stored route HAS params, but we didn't specify any, strictness might be needed.
4782
+ // For now, let's assume if path matches and we have no params, it's a match.
4783
+ console.log(`⚠️ [RouteReuseStrategy] Fuzzy match (Path match, input has no params): ${startKey}`);
4784
+ this.destroyAndRemove(startKey);
4785
+ return;
4786
+ }
4787
+ // Both have params, compare them
4788
+ if (storedQuery) {
4789
+ const storedParams = new URLSearchParams(storedQuery);
4790
+ let allParamsMatch = true;
4791
+ for (const key of Object.keys(params)) {
4792
+ const val = params[key];
4793
+ const storedVal = storedParams.get(key);
4794
+ // Loose equality for string/number match
4795
+ if (storedVal != val) {
4796
+ allParamsMatch = false;
4797
+ break;
4798
+ }
4799
+ }
4800
+ if (allParamsMatch) {
4801
+ console.log(`⚠️ [RouteReuseStrategy] Fuzzy match (Params match loose equality): ${startKey}`);
4802
+ this.destroyAndRemove(startKey);
4803
+ return;
4804
+ }
4805
+ }
4806
+ }
4807
+ }
4808
+ console.warn(`❌ [RouteReuseStrategy] Could not find route to clear for: ${path}`, params);
4809
+ }
4810
+ // Private helper to destroy component and remove from map
4811
+ destroyAndRemove(key) {
4812
+ const handle = this.storedRoutes[key];
4742
4813
  if (handle) {
4743
4814
  // Properly destroy the component instance to prevent memory leaks
4744
4815
  // and ensure clean state when the route is reopened
@@ -4750,14 +4821,14 @@ class CustomRouteReuseStrategy {
4750
4821
  const componentRef = handle;
4751
4822
  // Verify it has hostView (ComponentRef signature)
4752
4823
  if (componentRef.hostView || componentRef.location) {
4753
- console.log(`🗑️ Destroying component instance (ComponentRef) for route: ${pathKey}`);
4824
+ console.log(`🗑️ Destroying component instance (ComponentRef) for route: ${key}`);
4754
4825
  componentRef.destroy();
4755
4826
  }
4756
4827
  }
4757
4828
  // Method 2: Check if handle is a ViewContainerRef
4758
4829
  if (handle && typeof handle.clear === 'function' && typeof handle.length === 'number') {
4759
4830
  const viewContainerRef = handle;
4760
- console.log(`🗑️ Clearing view container for route: ${pathKey}`);
4831
+ console.log(`🗑️ Clearing view container for route: ${key}`);
4761
4832
  viewContainerRef.clear();
4762
4833
  }
4763
4834
  // Method 3: Check if handle is an object with nested ComponentRef
@@ -4779,19 +4850,19 @@ class CustomRouteReuseStrategy {
4779
4850
  componentRef = handleObj._componentRef;
4780
4851
  }
4781
4852
  if (componentRef) {
4782
- console.log(`🗑️ Destroying component instance from handle object for route: ${pathKey}`);
4853
+ console.log(`🗑️ Destroying component instance from handle object for route: ${key}`);
4783
4854
  componentRef.destroy();
4784
4855
  }
4785
4856
  // Also try to clear view container if it exists
4786
4857
  if (handleObj.viewContainerRef && typeof handleObj.viewContainerRef.clear === 'function') {
4787
- console.log(`🗑️ Clearing view container from handle object for route: ${pathKey}`);
4858
+ console.log(`🗑️ Clearing view container from handle object for route: ${key}`);
4788
4859
  handleObj.viewContainerRef.clear();
4789
4860
  }
4790
4861
  // Try to destroy any nested components
4791
4862
  if (handleObj.components && Array.isArray(handleObj.components)) {
4792
4863
  handleObj.components.forEach((comp, index) => {
4793
4864
  if (comp && typeof comp.destroy === 'function') {
4794
- console.log(`🗑️ Destroying nested component ${index} for route: ${pathKey}`);
4865
+ console.log(`🗑️ Destroying nested component ${index} for route: ${key}`);
4795
4866
  comp.destroy();
4796
4867
  }
4797
4868
  });
@@ -4799,16 +4870,23 @@ class CustomRouteReuseStrategy {
4799
4870
  }
4800
4871
  }
4801
4872
  catch (error) {
4802
- console.warn(`⚠️ Error destroying route handle for ${pathKey}:`, error);
4873
+ console.warn(`⚠️ Error destroying route handle for ${key}:`, error);
4803
4874
  }
4804
4875
  // Remove from stored routes - this ensures shouldAttach will return false for this route
4805
- delete this.storedRoutes[pathKey];
4806
- console.log(`✅ Cleared stored route: ${pathKey} (removed from storedRoutes map)`);
4876
+ delete this.storedRoutes[key];
4877
+ console.log(`✅ Cleared stored route: ${key} (removed from storedRoutes map)`);
4807
4878
  }
4808
4879
  else {
4809
- console.log(`ℹ️ No stored route found for: ${pathKey}`);
4880
+ console.log(`ℹ️ No stored route found for: ${key}`);
4810
4881
  }
4811
4882
  }
4883
+ /**
4884
+ * Legacy method for backward compatibility, redirects to new clearRoute or destroys directly if key provided
4885
+ * @deprecated Use clearRoute instead
4886
+ */
4887
+ clearStoredRoute(pathKey) {
4888
+ this.destroyAndRemove(pathKey);
4889
+ }
4812
4890
  // Clears all stored routes (useful for cleanup)
4813
4891
  // This method ensures all component instances are destroyed and removed from DOM
4814
4892
  clearAllStoredRoutes() {
@@ -5080,21 +5158,10 @@ class CideLytRequestService {
5080
5158
  console.warn('⚠️ Tab not found:', tabId);
5081
5159
  return;
5082
5160
  }
5083
- // Before navigating, ensure the route is fresh by clearing any cached state
5084
- // This prevents old component data from persisting when reopening a tab
5085
- if (this.routeReuseStrategy instanceof CustomRouteReuseStrategy) {
5086
- let pathKey = tabToActivate.route.startsWith('/') ? tabToActivate.route.substring(1) : tabToActivate.route;
5087
- if (tabToActivate.params && Object.keys(tabToActivate.params).length > 0) {
5088
- const queryParamsString = Object.keys(tabToActivate.params)
5089
- .sort()
5090
- .map(key => `${key}=${tabToActivate.params[key]}`)
5091
- .join('&');
5092
- pathKey += '?' + queryParamsString;
5093
- }
5094
- // Clear any cached route to ensure fresh component state
5095
- this.routeReuseStrategy.clearStoredRoute(pathKey);
5096
- console.log(`🔄 REQUEST SERVICE: Cleared cached route ${pathKey} before activating tab`);
5097
- }
5161
+ // NOTE: Removed route clearing on activation.
5162
+ // We want to reuse the stored component state when switching tabs.
5163
+ // Clearing is only done when EXPLICITLY closing a tab or force refreshing.
5164
+ console.log(`🔄 REQUEST SERVICE: Resuming tab ${tabToActivate.title}`);
5098
5165
  // Update tabs: deactivate all, then activate the target
5099
5166
  const updatedTabs = tabs.map(tab => ({
5100
5167
  ...tab,
@@ -5122,30 +5189,11 @@ class CideLytRequestService {
5122
5189
  // Sync with TabStateService by removing the tab state
5123
5190
  this.tabStateService.removeTab(id);
5124
5191
  // Clear stored route from strategy and ensure proper component cleanup
5192
+ // Clear stored route from strategy and ensure proper component cleanup
5125
5193
  if (this.routeReuseStrategy instanceof CustomRouteReuseStrategy) {
5126
- // Generate pathKey in the same format as CustomRouteReuseStrategy.getPathKey()
5127
- // Remove leading slash to match the format used by getPathKey
5128
- let pathKey = tabToClose.route.startsWith('/') ? tabToClose.route.substring(1) : tabToClose.route;
5129
- // Only add query params if the route is marked for reuse (matching getPathKey logic)
5130
- // But we'll try to clear with both formats to be safe
5131
- if (tabToClose.params && Object.keys(tabToClose.params).length > 0) {
5132
- const queryParamsString = Object.keys(tabToClose.params)
5133
- .sort()
5134
- .map(key => `${key}=${tabToClose.params[key]}`)
5135
- .join('&');
5136
- pathKey += '?' + queryParamsString;
5137
- }
5138
- // Clear the stored route and destroy the component instance
5139
- this.routeReuseStrategy.clearStoredRoute(pathKey);
5140
- // Also try clearing without query params in case the route wasn't marked for reuse
5141
- // This ensures we catch all possible pathKey variations
5142
- const pathKeyWithoutParams = tabToClose.route.startsWith('/') ? tabToClose.route.substring(1) : tabToClose.route;
5143
- if (pathKeyWithoutParams !== pathKey) {
5144
- this.routeReuseStrategy.clearStoredRoute(pathKeyWithoutParams);
5145
- }
5146
- // Force a route refresh to ensure clean component state
5147
- // This prevents old data from persisting when the same route is reopened
5148
- console.log(`🧹 REQUEST SERVICE: Cleared stored route for ${pathKey} and destroyed component instance`);
5194
+ // Use the new robust clearRoute method
5195
+ this.routeReuseStrategy.clearRoute(tabToClose.route, tabToClose.params);
5196
+ console.log(`🧹 REQUEST SERVICE: Cleared stored route for closed tab ${tabToClose.title}`);
5149
5197
  // If this was the active tab, navigate away to ensure component is removed from DOM
5150
5198
  if (wasActive) {
5151
5199
  // The navigation to the new active tab will happen below, which will properly clear the router outlet
@@ -5257,17 +5305,8 @@ class CideLytRequestService {
5257
5305
  */
5258
5306
  forceRefreshRoute(route, params) {
5259
5307
  if (this.routeReuseStrategy instanceof CustomRouteReuseStrategy) {
5260
- let pathKey = route.startsWith('/') ? route.substring(1) : route;
5261
- if (params && Object.keys(params).length > 0) {
5262
- const queryParamsString = Object.keys(params)
5263
- .sort()
5264
- .map(key => `${key}=${params[key]}`)
5265
- .join('&');
5266
- pathKey += '?' + queryParamsString;
5267
- }
5268
- // Clear the stored route to force a fresh component instance
5269
- this.routeReuseStrategy.clearStoredRoute(pathKey);
5270
- console.log(`🔄 REQUEST SERVICE: Force refreshed route ${pathKey}`);
5308
+ this.routeReuseStrategy.clearRoute(route, params);
5309
+ console.log(`🔄 REQUEST SERVICE: Force refreshed route ${route}`);
5271
5310
  }
5272
5311
  }
5273
5312
  /**
@@ -5373,8 +5412,8 @@ class CideLytSidedrawerWrapperComponent {
5373
5412
  }
5374
5413
  ngOnInit() {
5375
5414
  // Initialize the component map (You'd likely populate this from a config or service)
5376
- this.componentMap['drowar_notes'] = () => import('./cloud-ide-layout-sidedrawer-notes.component-BuDfM6ms.mjs').then(m => m.CideLytSidedrawerNotesComponent);
5377
- this.componentMap['drawer_theme'] = () => import('./cloud-ide-layout-drawer-theme.component-D4qmt25K.mjs').then(m => m.CideLytDrawerThemeComponent);
5415
+ this.componentMap['drowar_notes'] = () => import('./cloud-ide-layout-sidedrawer-notes.component-9ZGNNWMi.mjs').then(m => m.CideLytSidedrawerNotesComponent);
5416
+ this.componentMap['drawer_theme'] = () => import('./cloud-ide-layout-drawer-theme.component-HsFPpuk1.mjs').then(m => m.CideLytDrawerThemeComponent);
5378
5417
  }
5379
5418
  async loadComponent(configFor) {
5380
5419
  console.log('🔍 SIDEDRAWER - Loading component:', configFor, 'Current tab:', this.currentTabId);
@@ -7066,7 +7105,7 @@ const layoutControlPannelChildRoutes = [{
7066
7105
  },
7067
7106
  {
7068
7107
  path: "home",
7069
- loadComponent: () => import('./cloud-ide-layout-home-wrapper.component-DeR1T21C.mjs').then(c => c.CideLytHomeWrapperComponent),
7108
+ loadComponent: () => import('./cloud-ide-layout-home-wrapper.component-C9F3Ph0U.mjs').then(c => c.CideLytHomeWrapperComponent),
7070
7109
  canActivate: [authGuard],
7071
7110
  data: {
7072
7111
  sypg_page_code: "cide_lyt_home" // Used by RequestService to fetch tab properties
@@ -7074,7 +7113,7 @@ const layoutControlPannelChildRoutes = [{
7074
7113
  },
7075
7114
  {
7076
7115
  path: "dashboard-manager",
7077
- loadComponent: () => import('./cloud-ide-layout-dashboard-manager.component-DWxN9ReS.mjs').then(c => c.DashboardManagerComponent),
7116
+ loadComponent: () => import('./cloud-ide-layout-dashboard-manager.component-BFmWPx5q.mjs').then(c => c.DashboardManagerComponent),
7078
7117
  canActivate: [authGuard],
7079
7118
  data: {
7080
7119
  sypg_page_code: "cide_lyt_dashboard_manager"
@@ -8898,4 +8937,4 @@ var floatingEntitySelection_component = /*#__PURE__*/Object.freeze({
8898
8937
  */
8899
8938
 
8900
8939
  export { AppStateHelperService as A, CideLytSharedWrapperComponent as C, ENVIRONMENT_CONFIG as E, NotificationSettingsService as N, RightsService as R, CideLytSidebarService as a, CideLytSidedrawerService as b, CideLytThemeService as c, CloudIdeLayoutService as d, CloudIdeLayoutComponent as e, CideLytSharedService as f, ComponentContextService as g, layoutControlPannelChildRoutes as h, CustomRouteReuseStrategy as i, AppStateService as j, CideLytUserStatusService as k, layoutRoutes as l, CacheManagerService as m, CideLytFileManagerService as n, CideLytFloatingEntityRightsSharingComponent as o, processThemeVariable as p, CideLytFloatingEntityRightsSharingService as q, CideLytFloatingEntitySelectionComponent as r, setCSSVariable as s, themeFactory as t, CideLytFloatingEntitySelectionService as u };
8901
- //# sourceMappingURL=cloud-ide-layout-cloud-ide-layout-BlLjLM3N.mjs.map
8940
+ //# sourceMappingURL=cloud-ide-layout-cloud-ide-layout-l6s-ph1q.mjs.map