@timmo001/groundwork-tui 0.10.5 → 0.10.7
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/package.json +2 -2
- package/src/index.ts +2 -0
- package/src/theme.ts +6 -4
package/README.md
CHANGED
|
@@ -11,7 +11,8 @@ import { AppHeader, formatHelpBar, loadTheme } from "@timmo001/groundwork-tui";
|
|
|
11
11
|
- `loadTheme` reads `GW_THEME` and `GW_MODE`. Without `GW_THEME` it's the
|
|
12
12
|
desktop's Omarchy theme where there is one, otherwise Base and dark.
|
|
13
13
|
`themeFor` picks a theme and mode directly, and `omarchyThemeFor` maps an
|
|
14
|
-
Omarchy `colors.toml`.
|
|
14
|
+
Omarchy `colors.toml`. `fromRoles` takes any theme's terminal roles, such as
|
|
15
|
+
an app's own theme solved with `runtimeTheme` and `hexModes`.
|
|
15
16
|
- `AppHeader` and `PaneHeader` are one-row titles. `HeaderBlock` is the
|
|
16
17
|
app's name as ASCII art over `formatHeaderBar`, a breadcrumb with a status
|
|
17
18
|
dot and details that drop off when the terminal is narrow.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@timmo001/groundwork-tui",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.7",
|
|
4
4
|
"description": "Groundwork's terminal components: OpenTUI renderables on the terminal tokens",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@opentui/core": "0.8.2",
|
|
33
|
-
"@timmo001/groundwork-tokens": "0.10.
|
|
33
|
+
"@timmo001/groundwork-tokens": "0.10.7",
|
|
34
34
|
"effect": "4.1.2",
|
|
35
35
|
"fuse.js": "7.5.0"
|
|
36
36
|
},
|
package/src/index.ts
CHANGED
|
@@ -75,11 +75,13 @@ export { surfaceBackground } from "./styles.ts";
|
|
|
75
75
|
|
|
76
76
|
export {
|
|
77
77
|
DEFAULT_THEME,
|
|
78
|
+
fromRoles,
|
|
78
79
|
loadTheme,
|
|
79
80
|
omarchyThemeFor,
|
|
80
81
|
resolveTheme,
|
|
81
82
|
themeFor,
|
|
82
83
|
themeOptions,
|
|
84
|
+
type RoleName,
|
|
83
85
|
type Theme,
|
|
84
86
|
type ThemeOption,
|
|
85
87
|
type ThemePick,
|
package/src/theme.ts
CHANGED
|
@@ -52,13 +52,15 @@ export interface Theme {
|
|
|
52
52
|
|
|
53
53
|
type ThemeId = keyof typeof opentuiThemes;
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
/** A terminal role's name, such as `surface-lower` or `accent`. */
|
|
56
|
+
export type RoleName = keyof (typeof opentuiThemes)["base"]["dark"];
|
|
56
57
|
|
|
57
58
|
/**
|
|
58
|
-
* Places a theme's terminal roles into the TUI's slots
|
|
59
|
-
*
|
|
59
|
+
* Places a theme's terminal roles into the TUI's slots, such as an app's own
|
|
60
|
+
* theme's from `hexModes(runtimeTheme(document).theme)` in one mode. Base's
|
|
61
|
+
* dark fills any it lacks.
|
|
60
62
|
*/
|
|
61
|
-
const fromRoles = (roles: Partial<Record<RoleName, string>>): Theme => {
|
|
63
|
+
export const fromRoles = (roles: Partial<Record<RoleName, string>>): Theme => {
|
|
62
64
|
const role = (name: RoleName) => roles[name] ?? opentuiThemes.base.dark[name];
|
|
63
65
|
|
|
64
66
|
return {
|