nexus-shell 0.2.3 → 0.2.4
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.
- package/README.md +2 -1
- package/dist/components/widgets/SettingsPanel.d.ts +6 -1
- package/dist/components/widgets/ThemeSwitcher.d.ts +7 -2
- package/dist/core/Boot.d.ts +1 -1
- package/dist/core/services/ThemeService.d.ts +10 -1
- package/dist/index.d.ts +1 -0
- package/dist/lib/themes.d.ts +57 -0
- package/dist/nexus-shell.es.js +541 -506
- package/dist/nexus-shell.umd.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -133,7 +133,8 @@ shell's own frame and keep every registration working.
|
|
|
133
133
|
|
|
134
134
|
## Theming
|
|
135
135
|
|
|
136
|
-
|
|
136
|
+
Four themes ship in the stylesheet: `theme-light`, `theme-dark`, `theme-gt`
|
|
137
|
+
(Georgia Tech) and `theme-tamu` (Texas A&M).
|
|
137
138
|
Colors are CSS custom properties scoped to those classes, so switching themes is
|
|
138
139
|
a class on an ancestor — no React context, no provider.
|
|
139
140
|
|
|
@@ -6,13 +6,18 @@ export interface ISettingsThemeOption<T extends string = string> {
|
|
|
6
6
|
label: string;
|
|
7
7
|
icon: LucideIcon;
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* The themes bundled in the library stylesheet, with their full labels.
|
|
11
|
+
* Derived from the theme registry, so a new bundled theme appears here without
|
|
12
|
+
* a code change.
|
|
13
|
+
*/
|
|
9
14
|
export declare const DEFAULT_SETTINGS_THEMES: ISettingsThemeOption[];
|
|
10
15
|
export interface SettingsPanelProps<T extends string = string> {
|
|
11
16
|
/** Currently selected theme id. */
|
|
12
17
|
theme: T;
|
|
13
18
|
/** Called with the newly selected theme id. */
|
|
14
19
|
onThemeChange: (theme: T) => void;
|
|
15
|
-
/** Theme choices to offer. Defaults to
|
|
20
|
+
/** Theme choices to offer. Defaults to every bundled theme. */
|
|
16
21
|
themes?: ISettingsThemeOption<T>[];
|
|
17
22
|
/** Extra classes merged onto the root element. */
|
|
18
23
|
className?: string;
|
|
@@ -5,6 +5,11 @@ export interface IThemeOption<T extends string = string> {
|
|
|
5
5
|
/** Short label shown on the segment. Kept terse — segments are compact. */
|
|
6
6
|
label: string;
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* The themes bundled in the library stylesheet, using their abbreviated labels
|
|
10
|
+
* because the segments are narrow. Derived from the theme registry, so a new
|
|
11
|
+
* bundled theme appears here without a code change.
|
|
12
|
+
*/
|
|
8
13
|
export declare const DEFAULT_THEME_OPTIONS: IThemeOption[];
|
|
9
14
|
export interface ThemeSwitcherProps<T extends string = string> {
|
|
10
15
|
/** Currently selected theme id. */
|
|
@@ -12,8 +17,8 @@ export interface ThemeSwitcherProps<T extends string = string> {
|
|
|
12
17
|
/** Called with the newly selected theme id. */
|
|
13
18
|
onChange: (theme: T) => void;
|
|
14
19
|
/**
|
|
15
|
-
* Selectable themes. Defaults to
|
|
16
|
-
*
|
|
20
|
+
* Selectable themes. Defaults to every theme bundled in the library's
|
|
21
|
+
* stylesheet. Supply your own to offer a different set.
|
|
17
22
|
*/
|
|
18
23
|
options?: IThemeOption<T>[];
|
|
19
24
|
/** Extra classes merged onto the root element. */
|
package/dist/core/Boot.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export interface InitializeShellOptions {
|
|
|
31
31
|
defaultMenus?: boolean;
|
|
32
32
|
}
|
|
33
33
|
/** The command ids `initializeShell` registers unless told not to. */
|
|
34
|
-
export declare const DEFAULT_COMMAND_IDS: readonly ["view.toggleTerminal", "view.toggleChat", "view.toggleSidebar",
|
|
34
|
+
export declare const DEFAULT_COMMAND_IDS: readonly ["view.toggleTerminal", "view.toggleChat", "view.toggleSidebar", ...string[]];
|
|
35
35
|
/**
|
|
36
36
|
* Boot the shell: register commands, menus, panels and status bar items into
|
|
37
37
|
* the shell registries and stores.
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import { BundledThemeId } from '../../lib/themes';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A theme id.
|
|
5
|
+
*
|
|
6
|
+
* The bundled ids are suggested by autocomplete, but any string is accepted:
|
|
7
|
+
* define a `.theme-yourname` block with the same custom properties and it works
|
|
8
|
+
* exactly like the built-ins.
|
|
9
|
+
*/
|
|
10
|
+
export type ThemeType = BundledThemeId | (string & {});
|
|
2
11
|
interface ThemeState {
|
|
3
12
|
theme: ThemeType;
|
|
4
13
|
setTheme: (theme: ThemeType) => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -57,3 +57,4 @@ export { ThemeSwitcher, type ThemeSwitcherProps, type IThemeOption, DEFAULT_THEM
|
|
|
57
57
|
export { TreeWidget, type TreeWidgetProps, type ITreeNode, type ITreeAction, type ITreeContext } from './components/widgets/TreeWidget';
|
|
58
58
|
export { UserProfile, type UserProfileProps, type IUserProfile, type IUserProfileAction } from './components/widgets/UserProfile';
|
|
59
59
|
export { cn } from './lib/cn';
|
|
60
|
+
export { BUNDLED_THEMES, BUNDLED_THEME_CLASSES, themeClass, type IBundledTheme, type BundledThemeId, } from './lib/themes';
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The themes bundled in the library's stylesheet.
|
|
3
|
+
*
|
|
4
|
+
* This is the single source of truth. `ThemeService` derives its union type and
|
|
5
|
+
* its class-swapping from it, `ThemeSwitcher` and `SettingsPanel` derive their
|
|
6
|
+
* default options, `initializeShell` derives its theme commands and View menu,
|
|
7
|
+
* and Storybook derives its toolbar. Adding a theme is a block in `index.css`
|
|
8
|
+
* plus one entry here.
|
|
9
|
+
*
|
|
10
|
+
* It lives in `lib/` rather than `core/services/` because the presentational
|
|
11
|
+
* components need it, and they are forbidden from importing stores.
|
|
12
|
+
*
|
|
13
|
+
* Themes are not a closed set — see {@link ThemeSwitcher}'s `options` prop and
|
|
14
|
+
* {@link SettingsPanel}'s `themes` prop for supplying your own.
|
|
15
|
+
*/
|
|
16
|
+
export interface IBundledTheme {
|
|
17
|
+
/** Matches the `.theme-<id>` class in the stylesheet. */
|
|
18
|
+
id: string;
|
|
19
|
+
/** Full name, for menus and the settings panel. */
|
|
20
|
+
label: string;
|
|
21
|
+
/** Abbreviated name, for the compact segmented switcher. */
|
|
22
|
+
shortLabel: string;
|
|
23
|
+
/** One line on what the theme is, used in documentation. */
|
|
24
|
+
description: string;
|
|
25
|
+
}
|
|
26
|
+
export declare const BUNDLED_THEMES: readonly [{
|
|
27
|
+
readonly id: "light";
|
|
28
|
+
readonly label: "Light";
|
|
29
|
+
readonly shortLabel: "Light";
|
|
30
|
+
readonly description: "Neutral light theme. The default.";
|
|
31
|
+
}, {
|
|
32
|
+
readonly id: "dark";
|
|
33
|
+
readonly label: "Dark";
|
|
34
|
+
readonly shortLabel: "Dark";
|
|
35
|
+
readonly description: "Low-glare dark theme on a soft grey base.";
|
|
36
|
+
}, {
|
|
37
|
+
readonly id: "gt";
|
|
38
|
+
readonly label: "Georgia Tech";
|
|
39
|
+
readonly shortLabel: "GT";
|
|
40
|
+
readonly description: "Buzz Gold (#EAAA00) on Tech Tower White.";
|
|
41
|
+
}, {
|
|
42
|
+
readonly id: "tamu";
|
|
43
|
+
readonly label: "Texas A&M";
|
|
44
|
+
readonly shortLabel: "TAMU";
|
|
45
|
+
readonly description: "Aggie Maroon (#500000) on white.";
|
|
46
|
+
}];
|
|
47
|
+
/** Ids of the themes that ship in the stylesheet. */
|
|
48
|
+
export type BundledThemeId = (typeof BUNDLED_THEMES)[number]['id'];
|
|
49
|
+
/** Every bundled theme's class name, e.g. `["theme-light", …]`. */
|
|
50
|
+
export declare const BUNDLED_THEME_CLASSES: string[];
|
|
51
|
+
/**
|
|
52
|
+
* The class name for a theme id.
|
|
53
|
+
*
|
|
54
|
+
* Accepts any string, not just a bundled id, so an app that defines its own
|
|
55
|
+
* `.theme-*` block can use it too.
|
|
56
|
+
*/
|
|
57
|
+
export declare const themeClass: (id: string) => string;
|