cloud-ide-layout 1.0.97 → 1.0.99

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 (15) hide show
  1. package/fesm2022/{cloud-ide-layout-cloud-ide-layout-Dg7fq9kJ.mjs → cloud-ide-layout-cloud-ide-layout-CqBW0oD-.mjs} +90 -19
  2. package/fesm2022/cloud-ide-layout-cloud-ide-layout-CqBW0oD-.mjs.map +1 -0
  3. package/fesm2022/cloud-ide-layout-drawer-theme.component-BQolR62u.mjs +304 -0
  4. package/fesm2022/cloud-ide-layout-drawer-theme.component-BQolR62u.mjs.map +1 -0
  5. package/fesm2022/{cloud-ide-layout-floating-entity-selection.component-Dn1cKdzo.mjs → cloud-ide-layout-floating-entity-selection.component-Pdw896P2.mjs} +2 -2
  6. package/fesm2022/{cloud-ide-layout-floating-entity-selection.component-Dn1cKdzo.mjs.map → cloud-ide-layout-floating-entity-selection.component-Pdw896P2.mjs.map} +1 -1
  7. package/fesm2022/{cloud-ide-layout-home-wrapper.component-HMzOqbNa.mjs → cloud-ide-layout-home-wrapper.component-JL-5QSMB.mjs} +2 -2
  8. package/fesm2022/{cloud-ide-layout-home-wrapper.component-HMzOqbNa.mjs.map → cloud-ide-layout-home-wrapper.component-JL-5QSMB.mjs.map} +1 -1
  9. package/fesm2022/{cloud-ide-layout-sidedrawer-notes.component-Dk2Sy2GX.mjs → cloud-ide-layout-sidedrawer-notes.component-DjTuogGp.mjs} +2 -2
  10. package/fesm2022/{cloud-ide-layout-sidedrawer-notes.component-Dk2Sy2GX.mjs.map → cloud-ide-layout-sidedrawer-notes.component-DjTuogGp.mjs.map} +1 -1
  11. package/fesm2022/cloud-ide-layout.mjs +1 -1
  12. package/package.json +1 -1
  13. package/fesm2022/cloud-ide-layout-cloud-ide-layout-Dg7fq9kJ.mjs.map +0 -1
  14. package/fesm2022/cloud-ide-layout-drawer-theme.component-KK9MzKPu.mjs +0 -304
  15. package/fesm2022/cloud-ide-layout-drawer-theme.component-KK9MzKPu.mjs.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, inject, signal, computed, effect, DestroyRef, ViewChild, Component, ElementRef, HostListener, ChangeDetectionStrategy, ViewContainerRef, ViewChildren, viewChild, input, InjectionToken, PLATFORM_ID, output } from '@angular/core';
2
+ import { Injectable, inject, signal, computed, effect, DestroyRef, ViewChild, Component, ElementRef, HostListener, ChangeDetectionStrategy, ComponentRef, ViewContainerRef, ViewChildren, viewChild, input, InjectionToken, PLATFORM_ID, output } from '@angular/core';
3
3
  import { HttpClient } from '@angular/common/http';
4
4
  import { cidePath, hostManagerRoutesUrl, coreRoutesUrl, commonRoutesUrl, designConfigRoutesUrl, generateStringFromObject } from 'cloud-ide-lms-model';
5
5
  import { Observable, throwError, of, BehaviorSubject, interval, take as take$1, firstValueFrom } from 'rxjs';
@@ -1266,7 +1266,7 @@ class CideLytFloatingEntitySelectionService {
1266
1266
  }
1267
1267
  try {
1268
1268
  // Use relative import to avoid circular dependency
1269
- const module = await import('./cloud-ide-layout-floating-entity-selection.component-Dn1cKdzo.mjs');
1269
+ const module = await import('./cloud-ide-layout-floating-entity-selection.component-Pdw896P2.mjs');
1270
1270
  if (module.CideLytFloatingEntitySelectionComponent) {
1271
1271
  this.containerService.registerComponent('entity-selection-header', module.CideLytFloatingEntitySelectionComponent);
1272
1272
  console.log('✅ Entity selection component registered successfully');
@@ -3346,7 +3346,19 @@ class CustomRouteReuseStrategy {
3346
3346
  if (!pathKey || !this.storedRoutes[pathKey]) {
3347
3347
  return null;
3348
3348
  }
3349
- return this.storedRoutes[pathKey];
3349
+ const handle = this.storedRoutes[pathKey];
3350
+ // Verify the handle is still valid (not destroyed)
3351
+ // If the component was destroyed, remove it from stored routes
3352
+ if (handle && typeof handle === 'object') {
3353
+ const handleAny = handle;
3354
+ // Check if ComponentRef is destroyed
3355
+ if (handleAny.destroyed === true || (handleAny.hostView && handleAny.hostView.destroyed)) {
3356
+ console.log(`⚠️ Stored route handle for ${pathKey} is already destroyed, removing from cache`);
3357
+ delete this.storedRoutes[pathKey];
3358
+ return null;
3359
+ }
3360
+ }
3361
+ return handle;
3350
3362
  }
3351
3363
  // Determines if a route should be reused.
3352
3364
  shouldReuseRoute(future, curr) {
@@ -3361,27 +3373,70 @@ class CustomRouteReuseStrategy {
3361
3373
  // Properly destroy the component instance to prevent memory leaks
3362
3374
  // and ensure clean state when the route is reopened
3363
3375
  try {
3364
- // The handle contains the component instance and view container
3365
- // We need to destroy it properly to clean up resources
3366
- if (handle && typeof handle === 'object' && 'componentRef' in handle) {
3367
- const componentRef = handle.componentRef;
3368
- if (componentRef && typeof componentRef.destroy === 'function') {
3376
+ // In Angular, DetachedRouteHandle is typically a ComponentRef
3377
+ // We need to destroy it to remove the component from DOM and clean up resources
3378
+ // Method 1: Check if handle is a ComponentRef directly
3379
+ if (handle && typeof handle.destroy === 'function') {
3380
+ const componentRef = handle;
3381
+ // Verify it has hostView (ComponentRef signature)
3382
+ if (componentRef.hostView || componentRef.location) {
3383
+ console.log(`🗑️ Destroying component instance (ComponentRef) for route: ${pathKey}`);
3369
3384
  componentRef.destroy();
3370
3385
  }
3371
3386
  }
3372
- // Also destroy the view container if it exists
3373
- if (handle && typeof handle === 'object' && 'viewContainerRef' in handle) {
3374
- const viewContainerRef = handle.viewContainerRef;
3375
- if (viewContainerRef && typeof viewContainerRef.clear === 'function') {
3376
- viewContainerRef.clear();
3387
+ // Method 2: Check if handle is a ViewContainerRef
3388
+ if (handle && typeof handle.clear === 'function' && typeof handle.length === 'number') {
3389
+ const viewContainerRef = handle;
3390
+ console.log(`🗑️ Clearing view container for route: ${pathKey}`);
3391
+ viewContainerRef.clear();
3392
+ }
3393
+ // Method 3: Check if handle is an object with nested ComponentRef
3394
+ if (handle && typeof handle === 'object' && !(handle instanceof ComponentRef) && !(handle instanceof ViewContainerRef)) {
3395
+ const handleObj = handle;
3396
+ // Try to find and destroy ComponentRef from various possible properties
3397
+ let componentRef = null;
3398
+ // Check common property names
3399
+ if (handleObj.componentRef && typeof handleObj.componentRef.destroy === 'function') {
3400
+ componentRef = handleObj.componentRef;
3401
+ }
3402
+ else if (handleObj.component && typeof handleObj.component.destroy === 'function') {
3403
+ componentRef = handleObj.component;
3404
+ }
3405
+ else if (handleObj.context && typeof handleObj.context.destroy === 'function') {
3406
+ componentRef = handleObj.context;
3407
+ }
3408
+ else if (handleObj._componentRef && typeof handleObj._componentRef.destroy === 'function') {
3409
+ componentRef = handleObj._componentRef;
3410
+ }
3411
+ if (componentRef) {
3412
+ console.log(`🗑️ Destroying component instance from handle object for route: ${pathKey}`);
3413
+ componentRef.destroy();
3414
+ }
3415
+ // Also try to clear view container if it exists
3416
+ if (handleObj.viewContainerRef && typeof handleObj.viewContainerRef.clear === 'function') {
3417
+ console.log(`🗑️ Clearing view container from handle object for route: ${pathKey}`);
3418
+ handleObj.viewContainerRef.clear();
3419
+ }
3420
+ // Try to destroy any nested components
3421
+ if (handleObj.components && Array.isArray(handleObj.components)) {
3422
+ handleObj.components.forEach((comp, index) => {
3423
+ if (comp && typeof comp.destroy === 'function') {
3424
+ console.log(`🗑️ Destroying nested component ${index} for route: ${pathKey}`);
3425
+ comp.destroy();
3426
+ }
3427
+ });
3377
3428
  }
3378
3429
  }
3379
3430
  }
3380
3431
  catch (error) {
3381
- console.warn('Error destroying route handle:', error);
3432
+ console.warn(`⚠️ Error destroying route handle for ${pathKey}:`, error);
3382
3433
  }
3383
- // Remove from stored routes
3434
+ // Remove from stored routes - this ensures shouldAttach will return false for this route
3384
3435
  delete this.storedRoutes[pathKey];
3436
+ console.log(`✅ Cleared stored route: ${pathKey} (removed from storedRoutes map)`);
3437
+ }
3438
+ else {
3439
+ console.log(`ℹ️ No stored route found for: ${pathKey}`);
3385
3440
  }
3386
3441
  }
3387
3442
  // Clears all stored routes (useful for cleanup)
@@ -3685,7 +3740,11 @@ class CideLytRequestService {
3685
3740
  this.tabStateService.removeTab(id);
3686
3741
  // Clear stored route from strategy and ensure proper component cleanup
3687
3742
  if (this.routeReuseStrategy instanceof CustomRouteReuseStrategy) {
3743
+ // Generate pathKey in the same format as CustomRouteReuseStrategy.getPathKey()
3744
+ // Remove leading slash to match the format used by getPathKey
3688
3745
  let pathKey = tabToClose.route.startsWith('/') ? tabToClose.route.substring(1) : tabToClose.route;
3746
+ // Only add query params if the route is marked for reuse (matching getPathKey logic)
3747
+ // But we'll try to clear with both formats to be safe
3689
3748
  if (tabToClose.params && Object.keys(tabToClose.params).length > 0) {
3690
3749
  const queryParamsString = Object.keys(tabToClose.params)
3691
3750
  .sort()
@@ -3695,9 +3754,21 @@ class CideLytRequestService {
3695
3754
  }
3696
3755
  // Clear the stored route and destroy the component instance
3697
3756
  this.routeReuseStrategy.clearStoredRoute(pathKey);
3757
+ // Also try clearing without query params in case the route wasn't marked for reuse
3758
+ // This ensures we catch all possible pathKey variations
3759
+ const pathKeyWithoutParams = tabToClose.route.startsWith('/') ? tabToClose.route.substring(1) : tabToClose.route;
3760
+ if (pathKeyWithoutParams !== pathKey) {
3761
+ this.routeReuseStrategy.clearStoredRoute(pathKeyWithoutParams);
3762
+ }
3698
3763
  // Force a route refresh to ensure clean component state
3699
3764
  // This prevents old data from persisting when the same route is reopened
3700
3765
  console.log(`🧹 REQUEST SERVICE: Cleared stored route for ${pathKey} and destroyed component instance`);
3766
+ // If this was the active tab, navigate away to ensure component is removed from DOM
3767
+ if (wasActive) {
3768
+ // The navigation to the new active tab will happen below, which will properly clear the router outlet
3769
+ // But we also want to ensure the component is removed immediately
3770
+ console.log(`🧹 REQUEST SERVICE: Active tab closed, component will be removed on navigation`);
3771
+ }
3701
3772
  }
3702
3773
  // Remove the tab from this service's list
3703
3774
  const newTabs = currentTabs.filter((tab) => tab.id !== id);
@@ -3880,8 +3951,8 @@ class CideLytSidedrawerWrapperComponent {
3880
3951
  }
3881
3952
  ngOnInit() {
3882
3953
  // Initialize the component map (You'd likely populate this from a config or service)
3883
- this.componentMap['drowar_notes'] = () => import('./cloud-ide-layout-sidedrawer-notes.component-Dk2Sy2GX.mjs').then(m => m.CideLytSidedrawerNotesComponent);
3884
- this.componentMap['drawer_theme'] = () => import('./cloud-ide-layout-drawer-theme.component-KK9MzKPu.mjs').then(m => m.CideLytDrawerThemeComponent);
3954
+ this.componentMap['drowar_notes'] = () => import('./cloud-ide-layout-sidedrawer-notes.component-DjTuogGp.mjs').then(m => m.CideLytSidedrawerNotesComponent);
3955
+ this.componentMap['drawer_theme'] = () => import('./cloud-ide-layout-drawer-theme.component-BQolR62u.mjs').then(m => m.CideLytDrawerThemeComponent);
3885
3956
  }
3886
3957
  async loadComponent(configFor) {
3887
3958
  console.log('🔍 SIDEDRAWER - Loading component:', configFor, 'Current tab:', this.currentTabId);
@@ -4404,7 +4475,7 @@ const layoutControlPannelChildRoutes = [{
4404
4475
  },
4405
4476
  {
4406
4477
  path: "home",
4407
- loadComponent: () => import('./cloud-ide-layout-home-wrapper.component-HMzOqbNa.mjs').then(c => c.CideLytHomeWrapperComponent),
4478
+ loadComponent: () => import('./cloud-ide-layout-home-wrapper.component-JL-5QSMB.mjs').then(c => c.CideLytHomeWrapperComponent),
4408
4479
  canActivate: [authGuard],
4409
4480
  data: {
4410
4481
  reuseTab: true, // For CustomRouteReuseStrategy
@@ -5972,4 +6043,4 @@ var floatingEntityRightsSharing_component = /*#__PURE__*/Object.freeze({
5972
6043
  */
5973
6044
 
5974
6045
  export { AppStateHelperService as A, CideLytSharedWrapperComponent as C, ENVIRONMENT_CONFIG as E, CideLytSidebarService as a, CideLytRequestService as b, CideLytSidedrawerService as c, CideLytThemeService as d, AppStateService as e, CloudIdeLayoutService as f, CloudIdeLayoutComponent as g, CideLytSharedService as h, layoutControlPannelChildRoutes as i, CustomRouteReuseStrategy as j, CideLytUserStatusService as k, layoutRoutes as l, CacheManagerService as m, CideLytFileManagerService as n, CideLytFloatingEntityRightsSharingComponent as o, processThemeVariable as p, CideLytFloatingEntityRightsSharingService as q, setCSSVariable as s, themeFactory as t };
5975
- //# sourceMappingURL=cloud-ide-layout-cloud-ide-layout-Dg7fq9kJ.mjs.map
6046
+ //# sourceMappingURL=cloud-ide-layout-cloud-ide-layout-CqBW0oD-.mjs.map