1 | import { IChangedArgs } from '@jupyterlab/coreutils';
|
2 | import { ISettingRegistry } from '@jupyterlab/settingregistry';
|
3 | import { ITranslator } from '@jupyterlab/translation';
|
4 | import { IDisposable } from '@lumino/disposable';
|
5 | import { ISignal } from '@lumino/signaling';
|
6 | import { Widget } from '@lumino/widgets';
|
7 | import { ISplashScreen } from './splash';
|
8 | import { IThemeManager } from './tokens';
|
9 |
|
10 |
|
11 |
|
12 | export declare class ThemeManager implements IThemeManager {
|
13 | |
14 |
|
15 |
|
16 | constructor(options: ThemeManager.IOptions);
|
17 | /**
|
18 | * Get the name of the current theme.
|
19 | */
|
20 | get theme(): string | null;
|
21 | /**
|
22 | * The names of the registered themes.
|
23 | */
|
24 | get themes(): ReadonlyArray<string>;
|
25 | /**
|
26 | * A signal fired when the application theme changes.
|
27 | */
|
28 | get themeChanged(): ISignal<this, IChangedArgs<string, string | null>>;
|
29 | /**
|
30 | * Get the value of a CSS variable from its key.
|
31 | *
|
32 | * @param key - A Jupyterlab CSS variable, without the leading '--jp-'.
|
33 | *
|
34 | * @return value - The current value of the Jupyterlab CSS variable
|
35 | */
|
36 | getCSS(key: string): string;
|
37 | /**
|
38 | * Load a theme CSS file by path.
|
39 | *
|
40 | * @param path - The path of the file to load.
|
41 | */
|
42 | loadCSS(path: string): Promise<void>;
|
43 | /**
|
44 | * Loads all current CSS overrides from settings. If an override has been
|
45 | * removed or is invalid, this function unloads it instead.
|
46 | */
|
47 | loadCSSOverrides(): void;
|
48 | /**
|
49 | * Validate a CSS value w.r.t. a key
|
50 | *
|
51 | * @param key - A Jupyterlab CSS variable, without the leading '--jp-'.
|
52 | *
|
53 | * @param val - A candidate CSS value
|
54 | */
|
55 | validateCSS(key: string, val: string): boolean;
|
56 | /**
|
57 | * Register a theme with the theme manager.
|
58 | *
|
59 | * @param theme - The theme to register.
|
60 | *
|
61 | * @returns A disposable that can be used to unregister the theme.
|
62 | */
|
63 | register(theme: IThemeManager.ITheme): IDisposable;
|
64 | /**
|
65 | * Add a CSS override to the settings.
|
66 | */
|
67 | setCSSOverride(key: string, value: string): Promise<void>;
|
68 | /**
|
69 | * Set the current theme.
|
70 | */
|
71 | setTheme(name: string): Promise<void>;
|
72 | /**
|
73 | * Test whether a given theme is light.
|
74 | */
|
75 | isLight(name: string): boolean;
|
76 | /**
|
77 | * Increase a font size w.r.t. its current setting or its value in the
|
78 | * current theme.
|
79 | *
|
80 | * @param key - A Jupyterlab font size CSS variable, without the leading '--jp-'.
|
81 | */
|
82 | incrFontSize(key: string): Promise<void>;
|
83 | /**
|
84 | * Decrease a font size w.r.t. its current setting or its value in the
|
85 | * current theme.
|
86 | *
|
87 | * @param key - A Jupyterlab font size CSS variable, without the leading '--jp-'.
|
88 | */
|
89 | decrFontSize(key: string): Promise<void>;
|
90 | /**
|
91 | * Test whether a given theme styles scrollbars,
|
92 | * and if the user has scrollbar styling enabled.
|
93 | */
|
94 | themeScrollbars(name: string): boolean;
|
95 | /**
|
96 | * Test if the user has scrollbar styling enabled.
|
97 | */
|
98 | isToggledThemeScrollbars(): boolean;
|
99 | /**
|
100 | * Toggle the `theme-scrollbars` setting.
|
101 | */
|
102 | toggleThemeScrollbars(): Promise<void>;
|
103 | /**
|
104 | * Get the display name of the theme.
|
105 | */
|
106 | getDisplayName(name: string): string;
|
107 | /**
|
108 | * Change a font size by a positive or negative increment.
|
109 | */
|
110 | private _incrFontSize;
|
111 | /**
|
112 | * Initialize the key -> property dict for the overrides
|
113 | */
|
114 | private _initOverrideProps;
|
115 | /**
|
116 | * Handle the current settings.
|
117 | */
|
118 | private _loadSettings;
|
119 | /**
|
120 | * Load the theme.
|
121 | *
|
122 | * #### Notes
|
123 | * This method assumes that the `theme` exists.
|
124 | */
|
125 | private _loadTheme;
|
126 | /**
|
127 | * Handle a theme error.
|
128 | */
|
129 | private _onError;
|
130 | protected translator: ITranslator;
|
131 | private _trans;
|
132 | private _base;
|
133 | private _current;
|
134 | private _host;
|
135 | private _links;
|
136 | private _overrides;
|
137 | private _overrideProps;
|
138 | private _outstanding;
|
139 | private _pending;
|
140 | private _requests;
|
141 | private _settings;
|
142 | private _splash;
|
143 | private _themes;
|
144 | private _themeChanged;
|
145 | }
|
146 | export declare namespace ThemeManager {
|
147 | |
148 |
|
149 |
|
150 | interface IOptions {
|
151 | |
152 |
|
153 |
|
154 | host: Widget;
|
155 | |
156 |
|
157 |
|
158 | key: string;
|
159 | |
160 |
|
161 |
|
162 | settings: ISettingRegistry;
|
163 | |
164 |
|
165 |
|
166 | splash?: ISplashScreen;
|
167 | |
168 |
|
169 |
|
170 | url: string;
|
171 | |
172 |
|
173 |
|
174 | translator?: ITranslator;
|
175 | }
|
176 | }
|