@brimveyn/aimux 1.7.0 → 1.7.2

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.
Files changed (57) hide show
  1. package/package.json +3 -4
  2. package/src/app-runtime/pty-write.ts +8 -3
  3. package/src/app-runtime/side-effects.ts +10 -2
  4. package/src/app-runtime/use-renderer-bindings.ts +2 -1
  5. package/src/app.tsx +5 -8
  6. package/src/config.ts +2 -10
  7. package/src/input/modes/bridge.ts +1 -1
  8. package/src/input/modes/types.ts +6 -1
  9. package/src/input/raw-input-handler.ts +12 -3
  10. package/src/ipc/manager-protocol.ts +2 -2
  11. package/src/ipc/protocol.ts +2 -2
  12. package/src/pty/terminal-snapshot.ts +4 -4
  13. package/src/session-backend/bootstrap.ts +21 -1
  14. package/src/state/reducers/modal-state.ts +3 -2
  15. package/src/state/reducers/session-state.ts +0 -7
  16. package/src/state/types.ts +7 -1
  17. package/src/ui/components/bare-input.tsx +5 -5
  18. package/src/ui/components/context-menu-box.tsx +21 -0
  19. package/src/ui/components/context-menu-overlay.tsx +114 -0
  20. package/src/ui/components/create-session-modal.tsx +12 -41
  21. package/src/ui/components/diff-renderer/fold-strip.tsx +7 -7
  22. package/src/ui/components/diff-renderer/highlight.ts +6 -10
  23. package/src/ui/components/diff-renderer/pierre-diff.tsx +3 -3
  24. package/src/ui/components/diff-renderer/prepare-diff.ts +2 -3
  25. package/src/ui/components/diff-renderer/split-view.tsx +22 -29
  26. package/src/ui/components/diff-renderer/stacked-view.tsx +18 -31
  27. package/src/ui/components/diff-renderer/use-diff-prefetch.ts +0 -1
  28. package/src/ui/components/diff-renderer/use-diff-preparation.ts +1 -1
  29. package/src/ui/components/git-commit-modal.tsx +4 -16
  30. package/src/ui/components/git-panel.tsx +37 -73
  31. package/src/ui/components/git-view.tsx +17 -19
  32. package/src/ui/components/help-modal.tsx +5 -13
  33. package/src/ui/components/input-field.tsx +5 -7
  34. package/src/ui/components/list-item.tsx +3 -11
  35. package/src/ui/components/modal-keybinds-overlay.tsx +4 -4
  36. package/src/ui/components/modal-shell.tsx +6 -11
  37. package/src/ui/components/new-tab-modal.tsx +7 -15
  38. package/src/ui/components/pending-chord-overlay.tsx +5 -5
  39. package/src/ui/components/picker.tsx +6 -6
  40. package/src/ui/components/session-bar.tsx +34 -20
  41. package/src/ui/components/session-picker-modal.tsx +7 -20
  42. package/src/ui/components/sidebar.tsx +36 -35
  43. package/src/ui/components/snippet-editor-modal.tsx +4 -18
  44. package/src/ui/components/snippet-picker-modal.tsx +5 -9
  45. package/src/ui/components/split-layout.tsx +3 -3
  46. package/src/ui/components/status-bar.tsx +12 -13
  47. package/src/ui/components/surface.tsx +8 -11
  48. package/src/ui/components/tab-item.tsx +54 -29
  49. package/src/ui/components/terminal-pane.tsx +59 -25
  50. package/src/ui/components/theme-picker-modal.tsx +7 -21
  51. package/src/ui/components/update-available-modal.tsx +3 -13
  52. package/src/ui/context-menu/controller.ts +34 -0
  53. package/src/ui/root.tsx +5 -2
  54. package/src/ui/shiki.ts +29 -21
  55. package/src/ui/theme-store.ts +110 -21
  56. package/src/ui/theme.ts +6 -3
  57. package/src/ui/themes.ts +18 -13
@@ -4,7 +4,8 @@ import type { TabSession } from '../../state/types'
4
4
 
5
5
  import { dispatchGlobal, runSideEffectGlobal } from '../../state/dispatch-ref'
6
6
  import { useBusySpinner } from '../hooks/use-busy-spinner'
7
- import { getCurrentTheme, useTheme } from '../theme'
7
+ import { getCurrentTokens, useTokens } from '../theme'
8
+ import { ContextMenuBox } from './context-menu-box'
8
9
 
9
10
  interface TabItemProps {
10
11
  id?: string
@@ -15,15 +16,16 @@ interface TabItemProps {
15
16
  }
16
17
 
17
18
  function getStatusColor(status: TabSession['status']): string {
19
+ const t = getCurrentTokens()
18
20
  switch (status) {
19
21
  case 'running':
20
- return getCurrentTheme().colors['gitDecoration.addedResourceForeground']
22
+ return t.palette.success
21
23
  case 'disconnected':
22
- return getCurrentTheme().colors['editorWarning.foreground']
24
+ return t.palette.warning
23
25
  case 'error':
24
- return getCurrentTheme().colors['editorError.foreground']
26
+ return t.palette.error
25
27
  default:
26
- return getCurrentTheme().colors['descriptionForeground']
28
+ return t.muted
27
29
  }
28
30
  }
29
31
 
@@ -36,36 +38,33 @@ function getIndicator(active: boolean, focused: boolean, inLayout: boolean): str
36
38
  }
37
39
 
38
40
  function getIndicatorColor(active: boolean, focused: boolean, inLayout: boolean): string {
41
+ const t = getCurrentTokens()
39
42
  if (active) {
40
- return focused
41
- ? getCurrentTheme().colors['textLink.foreground']
42
- : getCurrentTheme().colors['terminal.ansiMagenta']
43
+ return focused ? t.palette.primary : t.accent
43
44
  }
44
45
 
45
- return inLayout
46
- ? getCurrentTheme().colors['descriptionForeground']
47
- : getCurrentTheme().colors['editor.lineHighlightBackground']
46
+ return inLayout ? t.muted : t.hover
48
47
  }
49
48
 
50
49
  function BusyIndicator() {
51
- const theme = useTheme()
50
+ const t = useTokens()
52
51
  const frame = useBusySpinner()
53
- return <text fg={theme.colors['textLink.foreground']}>{frame} working</text>
52
+ return <text fg={t.palette.primary}>{frame} working</text>
54
53
  }
55
54
 
56
55
  function WaitingIndicator() {
57
- const theme = useTheme()
58
- return <text fg={theme.colors['editorWarning.foreground']}>? waiting</text>
56
+ const t = useTokens()
57
+ return <text fg={t.palette.warning}>? waiting</text>
59
58
  }
60
59
 
61
60
  function ActivityIndicator({ tab }: { tab: TabSession }) {
62
- const theme = useTheme()
61
+ const t = useTokens()
63
62
  if (tab.status === 'error') {
64
- return <text fg={theme.colors['editorError.foreground']}>✗ error</text>
63
+ return <text fg={t.palette.error}>✗ error</text>
65
64
  }
66
65
 
67
66
  if (tab.status === 'disconnected') {
68
- return <text fg={theme.colors['editorWarning.foreground']}>⏸ restore</text>
67
+ return <text fg={t.palette.warning}>⏸ restore</text>
69
68
  }
70
69
 
71
70
  if (tab.activity === 'working') {
@@ -77,14 +76,14 @@ function ActivityIndicator({ tab }: { tab: TabSession }) {
77
76
  }
78
77
 
79
78
  if (tab.activity === 'idle') {
80
- return <text fg={theme.colors['gitDecoration.addedResourceForeground']}>● idle</text>
79
+ return <text fg={t.palette.success}>● idle</text>
81
80
  }
82
81
 
83
82
  return <text fg={getStatusColor(tab.status)}>{tab.status}</text>
84
83
  }
85
84
 
86
85
  export function TabItem({ active, focused, id, inLayout, tab }: TabItemProps) {
87
- const theme = useTheme()
86
+ const t = useTokens()
88
87
  const label = tab.command.split(' ')[0]
89
88
  const isInLayout = inLayout ?? false
90
89
  const indicator = getIndicator(active, focused, isInLayout)
@@ -92,7 +91,7 @@ export function TabItem({ active, focused, id, inLayout, tab }: TabItemProps) {
92
91
  const [hovered, setHovered] = useState(false)
93
92
 
94
93
  return (
95
- <box
94
+ <ContextMenuBox
96
95
  id={id}
97
96
  paddingLeft={1}
98
97
  paddingRight={1}
@@ -100,17 +99,43 @@ export function TabItem({ active, focused, id, inLayout, tab }: TabItemProps) {
100
99
  paddingBottom={0}
101
100
  flexDirection="column"
102
101
  gap={0}
102
+ rightClickMenu={[
103
+ [
104
+ 'Rename',
105
+ () => {
106
+ dispatchGlobal({ tabId: tab.id, type: 'set-active-tab' })
107
+ dispatchGlobal({ type: 'open-rename-tab-modal' })
108
+ },
109
+ ],
110
+ [
111
+ 'Close',
112
+ () => {
113
+ dispatchGlobal({ tabId: tab.id, type: 'close-tab' })
114
+ runSideEffectGlobal({ tabId: tab.id, type: 'close-tab' })
115
+ },
116
+ ],
117
+ [
118
+ 'Move up',
119
+ () => {
120
+ dispatchGlobal({ tabId: tab.id, type: 'set-active-tab' })
121
+ dispatchGlobal({ delta: -1, type: 'reorder-active-tab' })
122
+ },
123
+ ],
124
+ [
125
+ 'Move down',
126
+ () => {
127
+ dispatchGlobal({ tabId: tab.id, type: 'set-active-tab' })
128
+ dispatchGlobal({ delta: 1, type: 'reorder-active-tab' })
129
+ },
130
+ ],
131
+ ]}
103
132
  onMouseOver={() => setHovered(true)}
104
133
  onMouseOut={() => setHovered(false)}
105
134
  >
106
135
  <box flexDirection="row" alignItems="center">
107
136
  <text fg={indicatorColor}>{indicator} </text>
108
137
  <box flexGrow={1}>
109
- <text
110
- fg={active ? theme.colors['editor.foreground'] : theme.colors['descriptionForeground']}
111
- >
112
- {tab.title}
113
- </text>
138
+ <text fg={active ? t.palette.ink : t.muted}>{tab.title}</text>
114
139
  </box>
115
140
  {hovered ? (
116
141
  <box
@@ -120,14 +145,14 @@ export function TabItem({ active, focused, id, inLayout, tab }: TabItemProps) {
120
145
  runSideEffectGlobal({ tabId: tab.id, type: 'close-tab' })
121
146
  }}
122
147
  >
123
- <text fg={theme.colors['descriptionForeground']}>×</text>
148
+ <text fg={t.muted}>×</text>
124
149
  </box>
125
150
  ) : null}
126
151
  </box>
127
152
  <box flexDirection="row">
128
- <text fg={theme.colors['descriptionForeground']}> {label} </text>
153
+ <text fg={t.muted}> {label} </text>
129
154
  <ActivityIndicator tab={tab} />
130
155
  </box>
131
- </box>
156
+ </ContextMenuBox>
132
157
  )
133
158
  }
@@ -6,7 +6,10 @@ import type { TerminalContentOrigin } from '../../input/raw-input-handler'
6
6
  import type { TabSession, TerminalSnapshot, TerminalSpan } from '../../state/types'
7
7
 
8
8
  import { logInputDebug } from '../../debug/input-log'
9
- import { getCurrentTheme, useBg, useTheme } from '../theme'
9
+ import { dispatchGlobal, runSideEffectGlobal } from '../../state/dispatch-ref'
10
+ import { type ContextMenuItem, openContextMenu } from '../context-menu/controller'
11
+ import { getCurrentTokens, useBg, useTokens } from '../theme'
12
+ import { ContextMenuBox } from './context-menu-box'
10
13
 
11
14
  interface TerminalPaneProps {
12
15
  tab?: TabSession
@@ -45,15 +48,16 @@ function getTitle(
45
48
  }
46
49
 
47
50
  function getBorderColor(isActive: boolean, focusMode: TerminalPaneProps['focusMode']): string {
51
+ const t = getCurrentTokens()
48
52
  if (isActive && focusMode === 'terminal-input') {
49
- return getCurrentTheme().colors['focusBorder']
53
+ return t.palette.primary
50
54
  }
51
55
 
52
56
  if (isActive) {
53
- return getCurrentTheme().colors['terminal.ansiMagenta']
57
+ return t.accent
54
58
  }
55
59
 
56
- return getCurrentTheme().colors['editor.lineHighlightBackground']
60
+ return t.hover
57
61
  }
58
62
 
59
63
  function renderSpan(span: TerminalSpan, key: string): ReactNode {
@@ -72,7 +76,7 @@ function renderSpan(span: TerminalSpan, key: string): ReactNode {
72
76
  }
73
77
 
74
78
  return (
75
- <span key={key} fg={span.fg ?? getCurrentTheme().colors['editor.foreground']} bg={span.bg}>
79
+ <span key={key} fg={span.fg ?? getCurrentTokens().palette.ink} bg={span.bg}>
76
80
  {node}
77
81
  </span>
78
82
  )
@@ -87,11 +91,11 @@ const TerminalViewport = memo(function TerminalViewport({
87
91
  buffer,
88
92
  viewport,
89
93
  }: TerminalViewportProps) {
90
- const theme = useTheme()
94
+ const t = useTokens()
91
95
  if (viewport && viewport.lines.length > 0) {
92
96
  const lines = viewport.lines
93
97
  return (
94
- <text fg={theme.colors['editor.foreground']}>
98
+ <text fg={t.palette.ink}>
95
99
  {lines.map((line, lineIndex) => (
96
100
  <span key={`line-${lineIndex}`}>
97
101
  {line.spans.map((span, spanIndex) => renderSpan(span, `s-${spanIndex}`))}
@@ -103,9 +107,7 @@ const TerminalViewport = memo(function TerminalViewport({
103
107
  }
104
108
 
105
109
  return (
106
- <text fg={theme.colors['editor.foreground']}>
107
- {buffer.length > 0 ? buffer : 'Waiting for session output...'}
108
- </text>
110
+ <text fg={t.palette.ink}>{buffer.length > 0 ? buffer : 'Waiting for session output...'}</text>
109
111
  )
110
112
  })
111
113
 
@@ -124,12 +126,47 @@ export function TerminalPane({
124
126
  tab,
125
127
  tabId,
126
128
  }: TerminalPaneProps) {
127
- const theme = useTheme()
128
- const editorBg = useBg('editor.background')
129
+ const t = useTokens()
130
+ const editorBg = useBg('base')
129
131
  const paneIsActive = isActive ?? true
130
132
  const canForwardMouse = focusMode === 'terminal-input' && !!tab && mouseForwardingEnabled
131
133
  const canUseLocalScrollback = focusMode === 'terminal-input' && !!tab && localScrollbackEnabled
134
+ const rightClickMenu: ContextMenuItem[] | undefined = tabId
135
+ ? [
136
+ [
137
+ 'Split vertically',
138
+ () =>
139
+ runSideEffectGlobal({
140
+ direction: 'vertical',
141
+ sourceTabId: tabId,
142
+ type: 'split-pane',
143
+ }),
144
+ ],
145
+ [
146
+ 'Split horizontally',
147
+ () =>
148
+ runSideEffectGlobal({
149
+ direction: 'horizontal',
150
+ sourceTabId: tabId,
151
+ type: 'split-pane',
152
+ }),
153
+ ],
154
+ [
155
+ 'Close pane',
156
+ () => {
157
+ dispatchGlobal({ tabId, type: 'close-pane' })
158
+ runSideEffectGlobal({ tabId, type: 'close-tab' })
159
+ },
160
+ ],
161
+ ]
162
+ : undefined
132
163
  const forwardMouseEvent = (event: OtuiMouseEvent) => {
164
+ if (event.type === 'down' && event.button === 2 && rightClickMenu) {
165
+ event.preventDefault()
166
+ event.stopPropagation()
167
+ openContextMenu(event.x, event.y, rightClickMenu)
168
+ return
169
+ }
133
170
  if (event.type === 'down') {
134
171
  logInputDebug('pane.mouseDown', {
135
172
  button: event.button,
@@ -179,7 +216,7 @@ export function TerminalPane({
179
216
  }
180
217
  return (
181
218
  <box flexDirection="column" flexGrow={1} gap={0}>
182
- <box
219
+ <ContextMenuBox
183
220
  border
184
221
  borderColor={getBorderColor(paneIsActive, focusMode)}
185
222
  title={getTitle(tab, paneIsActive, focusMode)}
@@ -187,6 +224,7 @@ export function TerminalPane({
187
224
  flexDirection="column"
188
225
  flexGrow={1}
189
226
  backgroundColor={editorBg}
227
+ rightClickMenu={rightClickMenu}
190
228
  onMouseDown={forwardMouseEvent}
191
229
  onMouseDrag={forwardMouseEvent}
192
230
  onMouseScroll={forwardScrollEvent}
@@ -194,12 +232,12 @@ export function TerminalPane({
194
232
  >
195
233
  {!tab ? (
196
234
  <box flexGrow={1} justifyContent="center" alignItems="center" flexDirection="column">
197
- <text fg={theme.colors['editor.lineHighlightBackground']}>· · ·</text>
198
- <text fg={theme.colors['descriptionForeground']}> </text>
235
+ <text fg={t.hover}>· · ·</text>
236
+ <text fg={t.muted}> </text>
199
237
  <box flexDirection="row">
200
- <text fg={theme.colors['descriptionForeground']}>Press </text>
201
- <text fg={theme.colors['textLink.foreground']}>Ctrl+n</text>
202
- <text fg={theme.colors['descriptionForeground']}> to launch an assistant</text>
238
+ <text fg={t.muted}>Press </text>
239
+ <text fg={t.palette.primary}>Ctrl+n</text>
240
+ <text fg={t.muted}> to launch an assistant</text>
203
241
  </box>
204
242
  </box>
205
243
  ) : (
@@ -218,15 +256,11 @@ export function TerminalPane({
218
256
  <TerminalViewport viewport={tab.viewport} buffer={tab.buffer} />
219
257
  </box>
220
258
  )}
221
- </box>
259
+ </ContextMenuBox>
222
260
  {tab?.status === 'disconnected' ? (
223
- <text fg={theme.colors['editorWarning.foreground']}>
224
- Restored snapshot. Press Ctrl+r to restart this session.
225
- </text>
226
- ) : null}
227
- {tab?.errorMessage ? (
228
- <text fg={theme.colors['editorError.foreground']}>{tab.errorMessage}</text>
261
+ <text fg={t.palette.warning}>Restored snapshot. Press Ctrl+r to restart this session.</text>
229
262
  ) : null}
263
+ {tab?.errorMessage ? <text fg={t.palette.error}>{tab.errorMessage}</text> : null}
230
264
  </box>
231
265
  )
232
266
  }
@@ -2,7 +2,7 @@ import { useLayoutEffect, useMemo } from 'react'
2
2
 
3
3
  import { dispatchGlobal, runSideEffectGlobal } from '../../state/dispatch-ref'
4
4
  import { filterThemeIds } from '../filter-themes'
5
- import { useTheme, useTransparent } from '../theme'
5
+ import { useTokens, useTransparent } from '../theme'
6
6
  import { type ThemeId, THEMES } from '../themes'
7
7
  import { uiTokens } from '../ui-tokens'
8
8
  import { Picker, type PickerItem } from './picker'
@@ -25,7 +25,7 @@ export function ThemePickerModal({
25
25
  filter,
26
26
  selectedIndex,
27
27
  }: ThemePickerModalProps) {
28
- const theme = useTheme()
28
+ const t = useTokens()
29
29
  const transparent = useTransparent()
30
30
  const filtered = useMemo(() => filterThemeIds(filter), [filter])
31
31
 
@@ -47,16 +47,8 @@ export function ThemePickerModal({
47
47
  dispatchGlobal({ type: 'close-modal' })
48
48
  runSideEffectGlobal({ action: 'confirm', type: 'apply-theme' })
49
49
  },
50
- title: (
51
- <text
52
- fg={active ? theme.colors['editor.foreground'] : theme.colors['descriptionForeground']}
53
- >
54
- {entry.name}
55
- </text>
56
- ),
57
- trailing: isCurrent ? (
58
- <text fg={theme.colors['textLink.foreground']}>current</text>
59
- ) : undefined,
50
+ title: <text fg={active ? t.palette.ink : t.muted}>{entry.displayName}</text>,
51
+ trailing: isCurrent ? <text fg={t.palette.primary}>current</text> : undefined,
60
52
  },
61
53
  ]
62
54
  })
@@ -70,21 +62,15 @@ export function ThemePickerModal({
70
62
  cursorPos={cursorPos}
71
63
  footer={
72
64
  <box flexDirection="column" gap={0}>
73
- <text fg={theme.colors['editor.lineHighlightBackground']}>
65
+ <text fg={t.hover}>
74
66
  {filtered.length === 0 ? '' : ` ${effectiveIndex + 1} / ${filtered.length}`}
75
67
  </text>
76
- <text fg={theme.colors['descriptionForeground']}>
77
- {` transparent: ${transparent ? 'on' : 'off'} (ctrl-t)`}
78
- </text>
68
+ <text fg={t.muted}>{` transparent: ${transparent ? 'on' : 'off'} (ctrl-t)`}</text>
79
69
  </box>
80
70
  }
81
71
  items={items}
82
72
  selectedIndex={effectiveIndex}
83
- emptyState={
84
- <text fg={theme.colors['descriptionForeground']}>
85
- {filter ? 'No matching themes.' : 'No themes available.'}
86
- </text>
87
- }
73
+ emptyState={<text fg={t.muted}>No themes available.</text>}
88
74
  onHover={(index) => dispatchGlobal({ index, type: 'set-modal-selection-index' })}
89
75
  />
90
76
  )
@@ -1,4 +1,4 @@
1
- import { useTheme } from '../theme'
1
+ import { useTokens } from '../theme'
2
2
  import { uiTokens } from '../ui-tokens'
3
3
  import { ListItem } from './list-item'
4
4
  import { ModalShell } from './modal-shell'
@@ -19,7 +19,7 @@ export function UpdateAvailableModal({
19
19
  latestVersion,
20
20
  selectedIndex,
21
21
  }: UpdateAvailableModalProps) {
22
- const theme = useTheme()
22
+ const t = useTokens()
23
23
  return (
24
24
  <ModalShell
25
25
  title="Update available"
@@ -36,17 +36,7 @@ export function UpdateAvailableModal({
36
36
  key={option.label}
37
37
  active={active}
38
38
  direction="row"
39
- title={
40
- <text
41
- fg={
42
- active
43
- ? theme.colors['editor.foreground']
44
- : theme.colors['descriptionForeground']
45
- }
46
- >
47
- {option.label}
48
- </text>
49
- }
39
+ title={<text fg={active ? t.palette.ink : t.muted}>{option.label}</text>}
50
40
  />
51
41
  )
52
42
  })}
@@ -0,0 +1,34 @@
1
+ export type ContextMenuItem = [label: string, onSelect: () => void]
2
+
3
+ export interface ContextMenuState {
4
+ anchorX: number
5
+ anchorY: number
6
+ items: ContextMenuItem[]
7
+ }
8
+
9
+ type Listener = (state: ContextMenuState | null) => void
10
+
11
+ let current: ContextMenuState | null = null
12
+ const listeners = new Set<Listener>()
13
+
14
+ export function openContextMenu(anchorX: number, anchorY: number, items: ContextMenuItem[]): void {
15
+ if (items.length === 0) {
16
+ closeContextMenu()
17
+ return
18
+ }
19
+ current = { anchorX, anchorY, items }
20
+ for (const l of listeners) l(current)
21
+ }
22
+
23
+ export function closeContextMenu(): void {
24
+ if (current === null) return
25
+ current = null
26
+ for (const l of listeners) l(null)
27
+ }
28
+
29
+ export function subscribeContextMenu(listener: Listener): () => void {
30
+ listeners.add(listener)
31
+ return () => {
32
+ listeners.delete(listener)
33
+ }
34
+ }
package/src/ui/root.tsx CHANGED
@@ -6,6 +6,7 @@ import type { ThemeId } from './themes'
6
6
 
7
7
  import { useAppStore } from '../state/app-store'
8
8
  import { getTreeForTab, PANE_BORDER, type SplitDirection } from '../state/layout-tree'
9
+ import { ContextMenuOverlay } from './components/context-menu-overlay'
9
10
  import { CreateSessionModal } from './components/create-session-modal'
10
11
  import { GitCommitModal } from './components/git-commit-modal'
11
12
  import { GitPaneWidget } from './components/git-pane-widget'
@@ -222,7 +223,7 @@ export function RootView({
222
223
  terminalRows,
223
224
  themeId,
224
225
  }: RootViewProps) {
225
- const editorBg = useBg('editor.background')
226
+ const editorBg = useBg('base')
226
227
  const tabs = useAppStore((s) => s.tabs)
227
228
  const activeTabId = useAppStore((s) => s.activeTabId)
228
229
  const layoutTrees = useAppStore((s) => s.layoutTrees)
@@ -252,6 +253,7 @@ export function RootView({
252
253
  <GitView themeId={themeId} />
253
254
  <StatusBar />
254
255
  <PendingChordOverlay />
256
+ <ContextMenuOverlay />
255
257
  {renderModal(modal, {
256
258
  createSessionFields,
257
259
  currentSessionId,
@@ -325,6 +327,7 @@ export function RootView({
325
327
  {sessionBarPosition === 'bottom' && <SessionBar />}
326
328
  <StatusBar />
327
329
  <PendingChordOverlay />
330
+ <ContextMenuOverlay />
328
331
  {renderModal(modal, {
329
332
  createSessionFields,
330
333
  currentSessionId,
@@ -340,7 +343,7 @@ export function RootView({
340
343
  }
341
344
 
342
345
  function GitPaneInPaneMode({ ratio }: { ratio: number }) {
343
- const bg = useBg('sideBar.background')
346
+ const bg = useBg('elevated')
344
347
  // Ratio maps to a fixed column count (20..80), mirroring the reservation in
345
348
  // use-terminal-resize so the terminal-content area stays in sync.
346
349
  const width = Math.max(20, Math.min(80, Math.round(ratio * 80)))
package/src/ui/shiki.ts CHANGED
@@ -1,16 +1,27 @@
1
- import { type BundledLanguage, type BundledTheme, createHighlighter, type Highlighter } from 'shiki'
2
-
3
- import { THEMES } from './themes'
4
-
5
- // Shiki's highlighter is created with at least one real shiki-bundled theme so
6
- // its worker can warm up. House and user themes load on demand.
7
- const WARM_THEME: BundledTheme = 'catppuccin-mocha'
1
+ import {
2
+ type BundledLanguage,
3
+ createHighlighter,
4
+ type Highlighter,
5
+ type ThemeRegistrationRaw,
6
+ } from 'shiki'
7
+
8
+ import { getCurrentTheme } from './theme-store'
9
+ import { paletteToShikiTheme } from './themes'
10
+
11
+ function buildActiveTheme(): { id: string; raw: ThemeRegistrationRaw } {
12
+ const theme = getCurrentTheme()
13
+ const id = `${theme.name}-${theme.mode}`
14
+ return { id, raw: paletteToShikiTheme({ mode: theme.mode, name: id, palette: theme.palette }) }
15
+ }
8
16
 
9
17
  let highlighterPromise: Promise<Highlighter> | null = null
18
+ let activeThemeId: string | null = null
10
19
 
11
20
  export async function getShikiHighlighter(): Promise<Highlighter> {
12
21
  if (!highlighterPromise) {
13
- highlighterPromise = createHighlighter({ langs: [], themes: [WARM_THEME] })
22
+ const initial = buildActiveTheme()
23
+ activeThemeId = initial.id
24
+ highlighterPromise = createHighlighter({ langs: [], themes: [initial.raw] })
14
25
  }
15
26
  return highlighterPromise
16
27
  }
@@ -28,22 +39,19 @@ export async function ensureShikiLang(h: Highlighter, lang: string): Promise<boo
28
39
  }
29
40
  }
30
41
 
31
- const loadedThemes = new Set<string>([WARM_THEME])
32
-
33
42
  /**
34
- * Load the theme keyed by `id` into the shiki highlighter. The same object
35
- * powers the UI palette and the code highlighter no synthesis, no mapping.
43
+ * Make sure the active aimux theme (light or dark, with any palette overrides)
44
+ * is loaded into the highlighter. Returns the registered theme name so the
45
+ * caller can pass it to `codeToTokens`.
36
46
  */
37
- export async function ensureShikiTheme(h: Highlighter, id: string): Promise<boolean> {
38
- if (loadedThemes.has(id)) return true
39
- const entry = THEMES[id]
40
- if (!entry) return false
47
+ export async function ensureActiveShikiTheme(h: Highlighter): Promise<string> {
48
+ const { id, raw } = buildActiveTheme()
49
+ if (id === activeThemeId) return id
41
50
  try {
42
- // eslint-disable-next-line typescript/no-explicit-any
43
- await h.loadTheme(entry as any)
44
- loadedThemes.add(id)
45
- return true
51
+ await h.loadTheme(raw)
52
+ activeThemeId = id
46
53
  } catch {
47
- return false
54
+ // Reloading the theme is best-effort; on failure we keep using the prior id.
48
55
  }
56
+ return activeThemeId ?? id
49
57
  }