@timmo001/groundwork-tui 0.10.3 → 0.10.6

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 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",
3
+ "version": "0.10.6",
4
4
  "description": "Groundwork's terminal components: OpenTUI renderables on the terminal tokens",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -30,15 +30,15 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@opentui/core": "0.8.2",
33
- "@timmo001/groundwork-tokens": "0.10.3",
33
+ "@timmo001/groundwork-tokens": "0.10.6",
34
34
  "effect": "4.1.2",
35
35
  "fuse.js": "7.5.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@oxlint/plugins": "1.91.0",
38
+ "@oxlint/plugins": "1.92.0",
39
39
  "@timmo001/oxlint-rules": "0.6.4",
40
40
  "@types/bun": "1.4.4",
41
- "oxlint": "1.91.0",
41
+ "oxlint": "1.92.0",
42
42
  "oxlint-tsgolint": "7.0.2006",
43
43
  "prettier": "3.9.10",
44
44
  "typescript": "7.0.2"
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
- type RoleName = keyof (typeof opentuiThemes)["base"]["dark"];
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. A theme solved at
59
- * runtime has the same roles; Base's dark fills any it lacks.
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 {