UNPKG

@cisstech/nge

Version:

NG Essentials is a collection of libraries for Angular developers.

72 lines (71 loc) 2.85 kB
import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; import { NgeMonacoContribution } from '../contributions/monaco-contribution'; import { NgeMonacoConfig } from '../monaco-config'; import * as i0 from "@angular/core"; export declare class NgeMonacoThemeService implements NgeMonacoContribution { private readonly http; private readonly config; private readonly themes; private readonly activeTheme; private themeService; constructor(http: HttpClient, config: NgeMonacoConfig); /** * Gets the current active theme of monaco editor (undefined if monaco editor is not loaded). */ get theme(): NgeMonacoTheme | undefined; /** * Gets an observable that emit each time monaco editor theme change. * * Note: The observable emits first with the current theme * the first time `subscribe()` method is called. */ get themeChanges(): Observable<NgeMonacoTheme | undefined>; /** * Gets an observable that emit each time monaco editor theme list change. */ get themesChanges(): Observable<string[]>; activate(): Promise<void>; /** * Switches monaco editor theme. * @param themeName The new theme to use. * */ setTheme(themeName: string): Promise<void>; /** * Gets the information about the given `themeName` * @param themeName The theme to get. * @returns A promise that resolves with the theme info. */ getTheme(themeName: string): Promise<NgeMonacoTheme>; /** * Defines a theme for the Monaco editor. * @remarks * - If the theme is already defined, this method does nothing. * @param themeName - The name of the theme to define. * @throws {ReferenceError} If the themeName argument is not provided. * @throws {Error} If the specified theme is missing. * @throws {Error} If HttpClientModule is missing in AppModule. * @returns A Promise that resolves when the theme is defined successfully. */ defineTheme(themeName: string): Promise<void>; private retrieveThemes; private themeNameFromPath; private decorateCreateEditorAPI; static ɵfac: i0.ɵɵFactoryDeclaration<NgeMonacoThemeService, [{ optional: true; }, { optional: true; }]>; static ɵprov: i0.ɵɵInjectableDeclaration<NgeMonacoThemeService>; } export interface NgeMonacoTheme { id: string; type: 'light' | 'dark' | 'hc'; colors: Map<string, any>; themeName: string; semanticHighlighting: boolean; themeData: monaco.editor.IStandaloneThemeData; defaultColors: Map<string, any>; defines(colorId: string): boolean; getColor(colorId: string, useDefault?: boolean): any; getColors(): Map<string, any>; } /** List of all custom themes from of the library */ export declare const NGE_MONACO_THEMES: string[];