cloud-ide-layout 1.0.1 → 1.0.3

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.
@@ -7,9 +7,12 @@ export * from './lib/layout/shared/shared-wrapper/shared-wrapper.component';
7
7
  export * from './lib/layout/shared/shared.service';
8
8
  export * from './lib/cloud-ide-layout.routes';
9
9
  export * from './lib/utils';
10
+ export * from './lib/utils/custom-route-reuse-strategy';
10
11
  // App State Management
12
+ export * from './lib/services/app-state/app-state.service';
11
13
  export * from './lib/services/app-state';
12
14
  export * from './lib/services/user-status/user-status.service';
15
+ export * from './lib/services/theme/theme.service';
13
16
  // Modern Page Data Management (Legacy code removed)
14
17
  export * from './lib/services/cache-manager/cache-manager.service';
15
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL2Nsb3VkLWlkZS1sYXlvdXQvc3JjL3B1YmxpYy1hcGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7O0dBRUc7QUFFSCxjQUFjLGdDQUFnQyxDQUFDO0FBQy9DLGNBQWMsa0NBQWtDLENBQUM7QUFDakQsY0FBYyw2REFBNkQsQ0FBQztBQUM1RSxjQUFjLG9DQUFvQyxDQUFDO0FBQ25ELGNBQWMsK0JBQStCLENBQUM7QUFDOUMsY0FBYyxhQUFhLENBQUM7QUFFNUIsdUJBQXVCO0FBQ3ZCLGNBQWMsMEJBQTBCLENBQUM7QUFDekMsY0FBYyxnREFBZ0QsQ0FBQztBQUUvRCxvREFBb0Q7QUFDcEQsY0FBYyxvREFBb0QsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qXG4gKiBQdWJsaWMgQVBJIFN1cmZhY2Ugb2YgY2xvdWQtaWRlLWxheW91dFxuICovXG5cbmV4cG9ydCAqIGZyb20gJy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N0YXRlJztcbmV4cG9ydCAqIGZyb20gJy4vbGliL3NlcnZpY2VzL3VzZXItc3RhdHVzL3VzZXItc3RhdHVzLnNlcnZpY2UnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvc2VydmljZXMvdGhlbWUvdGhlbWUuc2VydmljZSc7XG5cbi8vIE1vZGVybiBQYWdlIERhdGEgTWFuYWdlbWVudCAoTGVnYWN5IGNvZGUgcmVtb3ZlZClcbmV4cG9ydCAqIGZyb20gJy4vbGliL3NlcnZpY2VzL2NhY2hlLW1hbmFnZXIvY2FjaGUtbWFuYWdlci5zZXJ2aWNlJzsiXX0=
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, inject, signal, computed, effect, Component, ElementRef, HostListener, ViewContainerRef, ViewChild, ViewChildren } from '@angular/core';
2
+ import { Injectable, inject, signal, computed, effect, Component, ElementRef, HostListener, ViewContainerRef, ViewChild, ViewChildren, InjectionToken, PLATFORM_ID } from '@angular/core';
3
3
  import { HttpClient } from '@angular/common/http';
4
4
  import { cidePath, hostManagerRoutesUrl, coreRoutesUrl, designConfigRoutesUrl } from 'cloud-ide-lms-model';
5
5
  import { throwError, of, BehaviorSubject, interval, take as take$1 } from 'rxjs';
@@ -9,7 +9,7 @@ import { Router, NavigationEnd, RouteReuseStrategy, RouterModule } from '@angula
9
9
  import { Title } from '@angular/platform-browser';
10
10
  import { CideElementsService, CideInputComponent, CideIconComponent, CideEleResizerDirective, TooltipDirective, CideSpinnerComponent, CideEleSkeletonLoaderComponent } from 'cloud-ide-element';
11
11
  import * as i2 from '@angular/common';
12
- import { CommonModule, NgClass, NgFor, NgIf } from '@angular/common';
12
+ import { CommonModule, NgClass, NgFor, NgIf, isPlatformBrowser } from '@angular/common';
13
13
  import { trigger, state, style, transition, animate } from '@angular/animations';
14
14
  import { merge } from 'lodash';
15
15
 
@@ -2407,8 +2407,8 @@ class CideLytSidedrawerWrapperComponent {
2407
2407
  }
2408
2408
  ngOnInit() {
2409
2409
  // Initialize the component map (You'd likely populate this from a config or service)
2410
- this.componentMap['drowar_notes'] = () => import('./cloud-ide-layout-sidedrawer-notes.component-ds12wZbh.mjs').then(m => m.CideLytSidedrawerNotesComponent);
2411
- this.componentMap['drawer_theme'] = () => import('./cloud-ide-layout-drawer-theme.component-xd8IG3WP.mjs').then(m => m.CideLytDrawerThemeComponent);
2410
+ this.componentMap['drowar_notes'] = () => import('./cloud-ide-layout-sidedrawer-notes.component-BWx03JYS.mjs').then(m => m.CideLytSidedrawerNotesComponent);
2411
+ this.componentMap['drawer_theme'] = () => import('./cloud-ide-layout-drawer-theme.component-BSUFE_o2.mjs').then(m => m.CideLytDrawerThemeComponent);
2412
2412
  }
2413
2413
  async loadComponent(configFor) {
2414
2414
  console.log('🔍 SIDEDRAWER - Loading component:', configFor, 'Current tab:', this.currentTabId);
@@ -2777,7 +2777,7 @@ const layoutControlPannelChildRoutes = [{
2777
2777
  },
2778
2778
  {
2779
2779
  path: "home",
2780
- loadComponent: () => import('./cloud-ide-layout-home-wrapper.component-DEdsEiaq.mjs').then(c => c.CideLytHomeWrapperComponent),
2780
+ loadComponent: () => import('./cloud-ide-layout-home-wrapper.component-Dr4MO4MB.mjs').then(c => c.CideLytHomeWrapperComponent),
2781
2781
  data: {
2782
2782
  reuseTab: true, // For CustomRouteReuseStrategy
2783
2783
  sypg_page_code: "cide_lyt_home" // Used by RequestService to fetch tab properties
@@ -2793,6 +2793,150 @@ const layoutControlPannelChildRoutes = [{
2793
2793
  // }];
2794
2794
  // ]
2795
2795
 
2796
+ // Define an InjectionToken for the environment configuration
2797
+ // This is needed to inject environment variables into services provided in 'root'
2798
+ const ENVIRONMENT_CONFIG = new InjectionToken('ENVIRONMENT_CONFIG');
2799
+ /**
2800
+ * Utility function to convert database format keys to CSS format and handle units
2801
+ * @param key - The database format key (e.g., 'font_size_xxxl')
2802
+ * @param value - The value to be set
2803
+ * @returns Object with cssVarName and processed value
2804
+ */
2805
+ function processThemeVariable(key, value) {
2806
+ // 1. Convert the key from the DB format to the CSS format.
2807
+ const cssVarName = `${key.replace(/_/g, '-')}`;
2808
+ // 2. Append the font_size and line_height value to rem
2809
+ let processedValue = value;
2810
+ if (cssVarName.includes('font-size') || cssVarName.includes('line-height')) {
2811
+ processedValue = parseFloat(value) + 'rem';
2812
+ }
2813
+ return { cssVarName, processedValue: processedValue };
2814
+ }
2815
+ /**
2816
+ * Sets a single CSS variable on the document root element
2817
+ * @param key - The database format key (e.g., 'font_size_xxxl')
2818
+ * @param value - The value to be set
2819
+ * @param platformId - Platform ID for browser check
2820
+ */
2821
+ function setCSSVariable(key, value, platformId) {
2822
+ if (isPlatformBrowser(platformId)) {
2823
+ const { cssVarName, processedValue } = processThemeVariable(key, value);
2824
+ const root = document.documentElement;
2825
+ root.style.setProperty(cssVarName, processedValue);
2826
+ }
2827
+ }
2828
+ class CideLytThemeService {
2829
+ constructor() {
2830
+ // Modern Angular signals for reactive state management
2831
+ this.selectedThemeSignal = signal("");
2832
+ this.selectedTheme = this.selectedThemeSignal.asReadonly();
2833
+ // Modern dependency injection
2834
+ this.http = inject(HttpClient);
2835
+ this.platformId = inject(PLATFORM_ID);
2836
+ this.environment = inject(ENVIRONMENT_CONFIG);
2837
+ }
2838
+ /**
2839
+ * Fetches the theme from the API and applies it to the document.
2840
+ * This method is intended to be called when the theme should actually be applied.
2841
+ */
2842
+ fetchAndApplyTheme() {
2843
+ console.log('Fetching and applying theme via CideLytThemeService...');
2844
+ return this.loadTheme(); // Use the existing loadTheme logic
2845
+ }
2846
+ /**
2847
+ * Fetches the list of system themes from the API.
2848
+ */
2849
+ fetchSystemThemesList() {
2850
+ return this.http.get(cidePath.join([
2851
+ hostManagerRoutesUrl.cideSuiteHost,
2852
+ designConfigRoutesUrl?.module,
2853
+ designConfigRoutesUrl?.getSystemThemesList
2854
+ ]));
2855
+ }
2856
+ /**
2857
+ * Internal method to fetch the theme from the API and apply it.
2858
+ */
2859
+ loadTheme() {
2860
+ return this.http.post(cidePath.join([hostManagerRoutesUrl.cideSuiteHost, designConfigRoutesUrl?.module, designConfigRoutesUrl?.getSystemTheme]), { syupth_user_id_user: "659a7ea0a1f0e08246661766" }).pipe(tap(theme => {
2861
+ console.log("Applying theme:", theme);
2862
+ this.applyTheme(theme?.data);
2863
+ }));
2864
+ }
2865
+ /**
2866
+ * Sets the CSS variables on the root element.
2867
+ * @param theme - An object where keys are CSS variable names (e.g., '--color-text-body')
2868
+ * and values are the color strings (e.g., '#ffffff').
2869
+ */
2870
+ applyTheme(theme) {
2871
+ console.log("Applying theme:", theme);
2872
+ let merged = {};
2873
+ if (theme?.core_system_themes?.syth_properties) {
2874
+ merged = { ...merged, ...theme.core_system_themes.syth_properties };
2875
+ this.selectedThemeSignal.set(theme.core_system_themes._id);
2876
+ }
2877
+ if (theme?.core_system_organization_themes?.syoth_overrides) {
2878
+ merged = { ...merged, ...theme.core_system_organization_themes.syoth_overrides };
2879
+ }
2880
+ if (theme?.core_system_theme_user_preferences?.syupth_overrides) {
2881
+ merged = { ...merged, ...theme.core_system_theme_user_preferences.syupth_overrides };
2882
+ }
2883
+ console.log("Merged theme:", merged);
2884
+ // Check if the code is running in a browser environment.
2885
+ if (isPlatformBrowser(this.platformId)) {
2886
+ const root = document.documentElement;
2887
+ for (const [key, value] of Object.entries(merged)) {
2888
+ const { cssVarName, processedValue } = processThemeVariable(key, value);
2889
+ // Set the CSS custom property on the root element.
2890
+ root.style.setProperty(cssVarName, processedValue);
2891
+ }
2892
+ }
2893
+ }
2894
+ /**
2895
+ * Saves the system theme user preferences.
2896
+ * @param themeVars - The theme variables to save.
2897
+ * @returns An observable of the system theme user preferences.
2898
+ */
2899
+ saveSystemThemeUserPreferences(themeVars) {
2900
+ return this.http.post(cidePath.join([hostManagerRoutesUrl.cideSuiteHost, designConfigRoutesUrl?.module, designConfigRoutesUrl?.systemThemeUserPreferences]), themeVars);
2901
+ }
2902
+ /**
2903
+ * Updates a single CSS variable using the utility function
2904
+ * @param key - The database format key (e.g., 'font_size_xxxl')
2905
+ * @param value - The value to be set
2906
+ */
2907
+ updateCSSVariable(key, value) {
2908
+ setCSSVariable(key, value, this.platformId);
2909
+ }
2910
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: CideLytThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
2911
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: CideLytThemeService, providedIn: 'root' }); }
2912
+ }
2913
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: CideLytThemeService, decorators: [{
2914
+ type: Injectable,
2915
+ args: [{
2916
+ providedIn: 'root'
2917
+ }]
2918
+ }] });
2919
+ /**
2920
+ * Factory function for APP_INITIALIZER.
2921
+ * This function is used in your app.config.ts.
2922
+ * It conditionally triggers theme loading based on the environment setting.
2923
+ */
2924
+ function themeFactory(themeService, environmentConfig) {
2925
+ return () => {
2926
+ if (!environmentConfig.applyThemeOnLogin) {
2927
+ // If theme should be applied on app initialize, fetch and apply it.
2928
+ console.log('APP_INITIALIZER: Applying theme...');
2929
+ return themeService.fetchAndApplyTheme();
2930
+ }
2931
+ else {
2932
+ // If theme should be applied on login, APP_INITIALIZER does nothing for the theme.
2933
+ // We return an observable that immediately completes.
2934
+ console.log('APP_INITIALIZER: Theme application deferred to after login (per environment config).');
2935
+ return of(undefined); // Return an observable that completes immediately
2936
+ }
2937
+ };
2938
+ }
2939
+
2796
2940
  class CacheManagerService {
2797
2941
  constructor() {
2798
2942
  this.sharedService = inject(CideLytSharedService);
@@ -2910,5 +3054,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.7", ngImpor
2910
3054
  * Generated bundle index. Do not edit.
2911
3055
  */
2912
3056
 
2913
- export { AppStateHelperService as A, CideLytSharedWrapperComponent as C, CideLytSidebarService as a, CideLytRequestService as b, CideLytSidedrawerService as c, CloudIdeLayoutService as d, CloudIdeLayoutComponent as e, CideLytSharedService as f, layoutControlPannelChildRoutes as g, CustomRouteReuseStrategy as h, AppStateService as i, CideLytUserStatusService as j, CacheManagerService as k, layoutRoutes as l };
2914
- //# sourceMappingURL=cloud-ide-layout-cloud-ide-layout-DqL3A73V.mjs.map
3057
+ export { AppStateHelperService as A, CideLytSharedWrapperComponent as C, ENVIRONMENT_CONFIG as E, CideLytSidebarService as a, CideLytRequestService as b, CideLytSidedrawerService as c, CideLytThemeService as d, CloudIdeLayoutService as e, CloudIdeLayoutComponent as f, CideLytSharedService as g, layoutControlPannelChildRoutes as h, CustomRouteReuseStrategy as i, AppStateService as j, CideLytUserStatusService as k, layoutRoutes as l, CacheManagerService as m, processThemeVariable as p, setCSSVariable as s, themeFactory as t };
3058
+ //# sourceMappingURL=cloud-ide-layout-cloud-ide-layout-D3xzVSNA.mjs.map