@adea-ai/ui 0.157.0 → 0.158.0

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 (64) hide show
  1. package/dist/components/composites/appearance-editor/appearance-editor.d.ts +1 -1
  2. package/dist/components/composites/appearance-editor/appearance-editor.d.ts.map +1 -1
  3. package/dist/components/composites/appearance-editor/appearance-editor.js +305 -172
  4. package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
  5. package/dist/components/composites/appearance-editor/appearance-rows.d.ts +6 -0
  6. package/dist/components/composites/appearance-editor/appearance-rows.d.ts.map +1 -1
  7. package/dist/components/composites/appearance-editor/appearance-rows.js +2 -2
  8. package/dist/components/composites/appearance-editor/appearance-rows.js.map +1 -1
  9. package/dist/components/composites/appearance-editor/appearance-types.d.ts +26 -0
  10. package/dist/components/composites/appearance-editor/appearance-types.d.ts.map +1 -1
  11. package/dist/components/composites/appearance-editor/appearance-types.js +10 -0
  12. package/dist/components/composites/appearance-editor/appearance-types.js.map +1 -0
  13. package/dist/components/composites/appearance-editor/font-settings-group.d.ts +13 -1
  14. package/dist/components/composites/appearance-editor/font-settings-group.d.ts.map +1 -1
  15. package/dist/components/composites/appearance-editor/font-settings-group.js +51 -15
  16. package/dist/components/composites/appearance-editor/font-settings-group.js.map +1 -1
  17. package/dist/components/composites/appearance-editor/index.d.ts +2 -1
  18. package/dist/components/composites/appearance-editor/index.d.ts.map +1 -1
  19. package/dist/components/composites/appearance-editor/index.js +3 -2
  20. package/dist/components/ui/tooltip/tooltip.d.ts.map +1 -1
  21. package/dist/components/ui/tooltip/tooltip.js +4 -18
  22. package/dist/components/ui/tooltip/tooltip.js.map +1 -1
  23. package/dist/index.js +3 -2
  24. package/dist/lib/appearance-font-settings.d.ts +18 -4
  25. package/dist/lib/appearance-font-settings.d.ts.map +1 -1
  26. package/dist/lib/appearance-font-settings.js +24 -6
  27. package/dist/lib/appearance-font-settings.js.map +1 -1
  28. package/dist/lib/font-catalog.d.ts +5 -0
  29. package/dist/lib/font-catalog.d.ts.map +1 -1
  30. package/dist/lib/font-catalog.js +10 -5
  31. package/dist/lib/font-catalog.js.map +1 -1
  32. package/dist/lib/font-zoom.d.ts +1 -1
  33. package/dist/lib/font-zoom.d.ts.map +1 -1
  34. package/dist/lib/font-zoom.js +5 -1
  35. package/dist/lib/font-zoom.js.map +1 -1
  36. package/dist/lib/tokens.d.ts.map +1 -1
  37. package/dist/lib/tokens.js +17 -2
  38. package/dist/lib/tokens.js.map +1 -1
  39. package/dist/r/appearance-editor.json +1 -0
  40. package/dist/r/registry.json +1 -0
  41. package/dist/r/src/components/composites/appearance-editor/appearance-editor.tsx +202 -110
  42. package/dist/r/src/components/composites/appearance-editor/appearance-rows.tsx +11 -1
  43. package/dist/r/src/components/composites/appearance-editor/appearance-types.ts +27 -0
  44. package/dist/r/src/components/composites/appearance-editor/font-settings-group.tsx +50 -10
  45. package/dist/r/src/components/composites/appearance-editor/index.ts +3 -0
  46. package/dist/r/src/components/ui/tooltip/tooltip.tsx +9 -18
  47. package/dist/r/src/lib/appearance-font-settings.ts +43 -7
  48. package/dist/r/src/lib/font-catalog.ts +5 -0
  49. package/dist/r/src/lib/font-zoom.ts +3 -0
  50. package/dist/r/src/lib/tokens.ts +17 -2
  51. package/dist/r/src/styles/appearance-font-settings.css +2 -0
  52. package/package.json +1 -1
  53. package/registry.json +1 -0
  54. package/src/components/composites/appearance-editor/appearance-editor.tsx +202 -110
  55. package/src/components/composites/appearance-editor/appearance-rows.tsx +11 -1
  56. package/src/components/composites/appearance-editor/appearance-types.ts +27 -0
  57. package/src/components/composites/appearance-editor/font-settings-group.tsx +50 -10
  58. package/src/components/composites/appearance-editor/index.ts +3 -0
  59. package/src/components/ui/tooltip/tooltip.tsx +9 -18
  60. package/src/lib/appearance-font-settings.ts +43 -7
  61. package/src/lib/font-catalog.ts +5 -0
  62. package/src/lib/font-zoom.ts +3 -0
  63. package/src/lib/tokens.ts +17 -2
  64. package/src/styles/appearance-font-settings.css +2 -0
@@ -37,13 +37,16 @@ import {
37
37
  PanelsTopLeft as LucidePanelsTopLeft,
38
38
  SlidersHorizontal as LucideSlidersHorizontal,
39
39
  } from 'lucide-solid'
40
- import { Show, createSignal, createUniqueId } from 'solid-js'
40
+ import { For, Show, createSignal, createUniqueId } from 'solid-js'
41
41
  import { cn } from '../../../lib/utils'
42
42
  import { ActionButton } from '../action-button'
43
43
  import { Button } from '../../ui/button'
44
44
  import { Input } from '../../ui/input'
45
45
  import { AppearanceFontSettingsGroup } from './font-settings-group'
46
- import { DEFAULT_APPEARANCE_EDITOR_FONT_SETTINGS } from '../../../lib/appearance-font-settings'
46
+ import {
47
+ DEFAULT_APPEARANCE_EDITOR_FONT_SETTINGS,
48
+ type AppearanceEditorFontAxis,
49
+ } from '../../../lib/appearance-font-settings'
47
50
  import { THEME_DEFAULT_ID } from '../../../lib/theme-defaults'
48
51
 
49
52
  import { Switch } from '../../ui/switch'
@@ -57,10 +60,16 @@ import {
57
60
  SheetTitle,
58
61
  SheetTrigger,
59
62
  } from '../../ui/sheet'
60
- import type { AppearanceEditorProps, AppearancePopoverProps } from './appearance-types'
63
+ import {
64
+ APPEARANCE_EDITOR_TABS,
65
+ type AppearanceEditorProps,
66
+ type AppearanceEditorTab,
67
+ type AppearancePopoverProps,
68
+ } from './appearance-types'
61
69
  import { ModeChoices, AccentChoices, GlassChoices, isCustomAccent } from './appearance-choices'
62
70
  import { CodeRow, SettingsRow, TerminalRow, ThemeRow } from './appearance-rows'
63
71
  import { fastIcon } from '../../../lib/fast-icon'
72
+ import { Tabs, TabsContent, TabsList, TabsTrigger } from '../../ui/tabs'
64
73
 
65
74
  // lucide icons drawn from a cloned template (see fastIcon).
66
75
  const EyeOff = fastIcon(LucideEyeOff)
@@ -99,8 +108,35 @@ export function AppearanceEditor(props: AppearanceEditorProps) {
99
108
  : props.draft.surface === 'frosted'
100
109
  ? 'Theme-colored glass where supported.'
101
110
  : (props.surfaceCapability.themeDefaultDescription ?? "Uses this theme's default surface.")
111
+ // One list when no section is asked for; otherwise only that section's rows.
112
+ const shows = (section: AppearanceEditorTab) =>
113
+ props.section === undefined || props.section === section
114
+ const sectionFonts = (): readonly AppearanceEditorFontAxis[] =>
115
+ props.section === 'global'
116
+ ? ['ui', 'content']
117
+ : props.section === 'terminal'
118
+ ? ['terminal']
119
+ : props.section === 'code'
120
+ ? ['code']
121
+ : ['ui', 'content', 'code']
122
+ const fontRows = () => (
123
+ <AppearanceFontSettingsGroup
124
+ settings={props.draft.fonts ?? DEFAULT_APPEARANCE_EDITOR_FONT_SETTINGS}
125
+ menuPortalMount={props.menuPortalMount}
126
+ disabled={props.saving}
127
+ axes={sectionFonts()}
128
+ sectioned={props.section === 'terminal' || props.section === 'code'}
129
+ onChange={(fonts) => props.onChange({ fonts })}
130
+ />
131
+ )
132
+ const previewTheme = () =>
133
+ props.resolvedAppearance === 'dark' ? props.darkTheme : props.lightTheme
102
134
  return (
103
- <div data-appearance-editor class={cn('min-w-0', props.class)}>
135
+ <div
136
+ data-appearance-editor
137
+ data-appearance-section={props.section}
138
+ class={cn('min-w-0', props.class)}
139
+ >
104
140
  <Show when={props.recoveryNotice}>
105
141
  {(recoveryNoticeSlot) => (
106
142
  <p role="status" class="px-4 py-2 text-sm text-muted-foreground">
@@ -108,130 +144,136 @@ export function AppearanceEditor(props: AppearanceEditorProps) {
108
144
  </p>
109
145
  )}
110
146
  </Show>
111
- <ModeChoices {...props} />
147
+ <Show when={shows('global')}>
148
+ <ModeChoices {...props} />
149
+ </Show>
112
150
  <div class="divide-y divide-border rounded-lg border">
113
- <ThemeRow
114
- appearance="light"
115
- selectedId={props.draft.lightThemeId}
116
- preview={props.lightTheme}
117
- themes={props.themes}
118
- disabled={props.saving}
119
- onSelect={(lightThemeId) => props.onChange({ lightThemeId })}
120
- />
121
- <ThemeRow
122
- appearance="dark"
123
- selectedId={props.draft.darkThemeId}
124
- preview={props.darkTheme}
125
- themes={props.themes}
126
- disabled={props.saving}
127
- onSelect={(darkThemeId) => props.onChange({ darkThemeId })}
128
- />
151
+ <Show when={shows('global')}>
152
+ <ThemeRow
153
+ appearance="light"
154
+ selectedId={props.draft.lightThemeId}
155
+ preview={props.lightTheme}
156
+ themes={props.themes}
157
+ disabled={props.saving}
158
+ onSelect={(lightThemeId) => props.onChange({ lightThemeId })}
159
+ />
160
+ <ThemeRow
161
+ appearance="dark"
162
+ selectedId={props.draft.darkThemeId}
163
+ preview={props.darkTheme}
164
+ themes={props.themes}
165
+ disabled={props.saving}
166
+ onSelect={(darkThemeId) => props.onChange({ darkThemeId })}
167
+ />
168
+ </Show>
129
169
  {/* The row exists only when the host carries a terminal preference:
130
170
  the draft field is the show/hide switch, so the editor can never
131
171
  render a terminal row that writes nothing. */}
132
- <Show when={props.draft.terminalThemeId !== undefined}>
172
+ <Show when={shows('terminal') && props.draft.terminalThemeId !== undefined}>
133
173
  <TerminalRow
174
+ sectioned={props.section !== undefined}
134
175
  selectedId={props.draft.terminalThemeId ?? THEME_DEFAULT_ID}
135
- preview={props.resolvedAppearance === 'dark' ? props.darkTheme : props.lightTheme}
176
+ preview={previewTheme()}
136
177
  themes={props.themes}
137
178
  disabled={props.saving}
138
179
  onSelect={(terminalThemeId) => props.onChange({ terminalThemeId })}
139
180
  />
140
181
  </Show>
182
+ <Show when={props.section === 'terminal'}>
183
+ {fontRows()}
184
+ {props.terminalRows}
185
+ </Show>
141
186
  {/* The same switch for code: the row exists only when the host stores it. */}
142
- <Show when={props.draft.codeThemeId !== undefined}>
187
+ <Show when={shows('code') && props.draft.codeThemeId !== undefined}>
143
188
  <CodeRow
189
+ sectioned={props.section !== undefined}
144
190
  selectedId={props.draft.codeThemeId ?? THEME_DEFAULT_ID}
145
- preview={props.resolvedAppearance === 'dark' ? props.darkTheme : props.lightTheme}
191
+ preview={previewTheme()}
146
192
  themes={props.themes}
147
193
  disabled={props.saving}
148
194
  onSelect={(codeThemeId) => props.onChange({ codeThemeId })}
149
195
  />
150
196
  </Show>
151
- <SettingsRow title="Accent" icon={<SlidersHorizontal />} description={accentDescription()}>
152
- <AccentChoices {...props} />
153
- </SettingsRow>
154
- <Show when={custom()}>
155
- <div class="px-4 py-3">
156
- <label class="mb-2 block text-xs font-medium" for={`${errorId}-input`}>
157
- Custom accent
158
- </label>
159
- <Input
160
- id={`${errorId}-input`}
161
- value={props.draft.accent}
197
+ <Show when={props.section === 'code'}>
198
+ {fontRows()}
199
+ {props.codeRows}
200
+ </Show>
201
+ <Show when={shows('global')}>
202
+ <SettingsRow
203
+ title="Accent"
204
+ icon={<SlidersHorizontal />}
205
+ description={accentDescription()}
206
+ >
207
+ <AccentChoices {...props} />
208
+ </SettingsRow>
209
+ <Show when={custom()}>
210
+ <div class="px-4 py-3">
211
+ <label class="mb-2 block text-xs font-medium" for={`${errorId}-input`}>
212
+ Custom accent
213
+ </label>
214
+ <Input
215
+ id={`${errorId}-input`}
216
+ value={props.draft.accent}
217
+ disabled={props.saving}
218
+ aria-invalid={!!props.customAccentError}
219
+ aria-describedby={props.customAccentError ? errorId : undefined}
220
+ onInput={(event) => props.onChange({ accent: event.currentTarget.value })}
221
+ />
222
+ <Show when={props.customAccentError}>
223
+ {(customAccentErrorSlot) => (
224
+ <p id={errorId} role="alert" class="mt-1 text-xs text-foreground">
225
+ {customAccentErrorSlot()}
226
+ </p>
227
+ )}
228
+ </Show>
229
+ </div>
230
+ </Show>
231
+ {/* Inline, the typefaces read as one more palette choice; `end` hands
232
+ the closing slot to them for hosts whose order is palette and
233
+ surface first, text last. */}
234
+ <Show when={props.fontSettingsPlacement !== 'end'}>{fontRows()}</Show>
235
+ <SettingsRow title="Glass" icon={<PanelsTopLeft />} description={glassDescription()}>
236
+ <GlassChoices {...props} />
237
+ </SettingsRow>
238
+ <Show when={!props.surfaceCapability.frosted && props.surfaceCapability.reason}>
239
+ <p role="status" class="px-4 py-2 text-xs text-muted-foreground">
240
+ {props.surfaceCapability.reason}
241
+ </p>
242
+ </Show>
243
+ <SettingsRow
244
+ title="Reduce transparency"
245
+ icon={<EyeOff />}
246
+ description="Prefer solid surfaces, including during live preview."
247
+ >
248
+ <Switch
249
+ checked={props.draft.reduceTransparency}
162
250
  disabled={props.saving}
163
- aria-invalid={!!props.customAccentError}
164
- aria-describedby={props.customAccentError ? errorId : undefined}
165
- onInput={(event) => props.onChange({ accent: event.currentTarget.value })}
251
+ onChange={(reduceTransparency: boolean) => props.onChange({ reduceTransparency })}
252
+ aria-label="Reduce transparency"
166
253
  />
167
- <Show when={props.customAccentError}>
168
- {(customAccentErrorSlot) => (
169
- <p id={errorId} role="alert" class="mt-1 text-xs text-foreground">
170
- {customAccentErrorSlot()}
171
- </p>
172
- )}
173
- </Show>
174
- </div>
175
- </Show>
176
- {/* Inline, the typefaces read as one more palette choice; `end` hands
177
- the closing slot to them for hosts whose order is palette and
178
- surface first, text last. */}
179
- <Show when={props.fontSettingsPlacement !== 'end'}>
180
- <AppearanceFontSettingsGroup
181
- settings={props.draft.fonts ?? DEFAULT_APPEARANCE_EDITOR_FONT_SETTINGS}
182
- menuPortalMount={props.menuPortalMount}
183
- disabled={props.saving}
184
- onChange={(fonts) => props.onChange({ fonts })}
185
- />
186
- </Show>
187
- <SettingsRow title="Glass" icon={<PanelsTopLeft />} description={glassDescription()}>
188
- <GlassChoices {...props} />
189
- </SettingsRow>
190
- <Show when={!props.surfaceCapability.frosted && props.surfaceCapability.reason}>
191
- <p role="status" class="px-4 py-2 text-xs text-muted-foreground">
192
- {props.surfaceCapability.reason}
193
- </p>
194
- </Show>
195
- <SettingsRow
196
- title="Reduce transparency"
197
- icon={<EyeOff />}
198
- description="Prefer solid surfaces, including during live preview."
199
- >
200
- <Switch
201
- checked={props.draft.reduceTransparency}
202
- disabled={props.saving}
203
- onChange={(reduceTransparency: boolean) => props.onChange({ reduceTransparency })}
204
- aria-label="Reduce transparency"
205
- />
206
- </SettingsRow>
207
- <SettingsRow
208
- title="Theme library"
209
- icon={<Palette />}
210
- description={
211
- props.onManageThemes
212
- ? 'Manage themes through the application.'
213
- : 'Theme import is unavailable.'
214
- }
215
- >
216
- <Button
217
- type="button"
218
- size="sm"
219
- variant="outline"
220
- disabled={!props.onManageThemes || props.saving}
221
- onClick={() => props.onManageThemes?.()}
254
+ </SettingsRow>
255
+ <SettingsRow
256
+ title="Theme library"
257
+ icon={<Palette />}
258
+ description={
259
+ props.onManageThemes
260
+ ? 'Manage themes through the application.'
261
+ : 'Theme import is unavailable.'
262
+ }
222
263
  >
223
- Manage themes
224
- </Button>
225
- </SettingsRow>
226
- <Show when={props.fontSettingsPlacement === 'end'}>
227
- <AppearanceFontSettingsGroup
228
- settings={props.draft.fonts ?? DEFAULT_APPEARANCE_EDITOR_FONT_SETTINGS}
229
- menuPortalMount={props.menuPortalMount}
230
- disabled={props.saving}
231
- onChange={(fonts) => props.onChange({ fonts })}
232
- />
264
+ <Button
265
+ type="button"
266
+ size="sm"
267
+ variant="outline"
268
+ disabled={!props.onManageThemes || props.saving}
269
+ onClick={() => props.onManageThemes?.()}
270
+ >
271
+ Manage themes
272
+ </Button>
273
+ </SettingsRow>
274
+ <Show when={props.fontSettingsPlacement === 'end'}>{fontRows()}</Show>
275
+ {props.extraRows}
233
276
  </Show>
234
- {props.extraRows}
235
277
  </div>
236
278
  <Show when={!props.hideActions}>
237
279
  {/* Sticky so Save/Cancel stay reachable in a tall scroll container: the
@@ -305,11 +347,26 @@ export function AppearanceEditorActions(props: AppearanceEditorProps) {
305
347
  )
306
348
  }
307
349
 
350
+ const TAB_LABELS: Readonly<Record<AppearanceEditorTab, string>> = {
351
+ global: 'Global',
352
+ terminal: 'Terminal',
353
+ code: 'Code',
354
+ }
355
+
308
356
  /** The editor in an inset Sheet docked beside the main view: the body scrolls and
309
357
  * Reset/Cancel/Save sit in the panel's full-width footer, always reachable.
310
358
  * Dismissal (Escape, the close button, an outside click) is `onDismiss`. */
311
359
  export function AppearancePopover(props: AppearancePopoverProps) {
312
360
  const [menuPortalMount, setMenuPortalMount] = createSignal<HTMLElement>()
361
+ const [ownTab, setOwnTab] = createSignal<AppearanceEditorTab>('global')
362
+ const tabbed = () => props.tabs === true || props.tab !== undefined
363
+ const tab = () => props.tab ?? ownTab()
364
+ const selectTab = (value: string) => {
365
+ const next = APPEARANCE_EDITOR_TABS.find((candidate) => candidate === value)
366
+ if (!next) return
367
+ setOwnTab(next)
368
+ props.onTabChange?.(next)
369
+ }
313
370
 
314
371
  return (
315
372
  <Sheet open={props.open} onOpenChange={(open) => (open ? props.onOpen() : props.onDismiss())}>
@@ -333,13 +390,48 @@ export function AppearancePopover(props: AppearancePopoverProps) {
333
390
  <SheetContent side="end" closeLabel="Close appearance settings" ref={setMenuPortalMount}>
334
391
  <SheetHeader>
335
392
  <SheetTitle>Appearance</SheetTitle>
336
- <SheetDescription>
337
- Changes preview immediately. Save keeps them; Cancel restores the previous appearance.
393
+ {/* One short line on the caption rung, the size other panel headers
394
+ use for their detail line. */}
395
+ <SheetDescription class="truncate text-xs">
396
+ {props.description ?? 'Changes preview live. Save keeps them.'}
338
397
  </SheetDescription>
339
398
  </SheetHeader>
340
- <SheetBody>
341
- <AppearanceEditor {...props} menuPortalMount={menuPortalMount()} hideActions />
342
- </SheetBody>
399
+ <Show
400
+ when={tabbed()}
401
+ fallback={
402
+ <SheetBody>
403
+ <AppearanceEditor {...props} menuPortalMount={menuPortalMount()} hideActions />
404
+ </SheetBody>
405
+ }
406
+ >
407
+ <Tabs value={tab()} onChange={selectTab} class="min-h-0 flex-1 gap-0">
408
+ <div class="shrink-0 border-b border-border px-4 py-2">
409
+ <TabsList appearance="segmented" fill aria-label="Appearance section">
410
+ <For each={APPEARANCE_EDITOR_TABS}>
411
+ {(value) => (
412
+ <TabsTrigger appearance="segmented" value={value} class="flex-1">
413
+ {TAB_LABELS[value]}
414
+ </TabsTrigger>
415
+ )}
416
+ </For>
417
+ </TabsList>
418
+ </div>
419
+ <SheetBody>
420
+ <For each={APPEARANCE_EDITOR_TABS}>
421
+ {(value) => (
422
+ <TabsContent value={value}>
423
+ <AppearanceEditor
424
+ {...props}
425
+ section={value}
426
+ menuPortalMount={menuPortalMount()}
427
+ hideActions
428
+ />
429
+ </TabsContent>
430
+ )}
431
+ </For>
432
+ </SheetBody>
433
+ </Tabs>
434
+ </Show>
343
435
  <SheetFooter>
344
436
  <AppearanceEditorActions {...props} />
345
437
  </SheetFooter>
@@ -376,6 +376,12 @@ type PinnedThemeRowProps = {
376
376
  preview: AdeaTheme
377
377
  themes: readonly AdeaThemeRecord[]
378
378
  disabled?: boolean
379
+ /**
380
+ * The row sits under a tab that already names its subject, so it is titled
381
+ * for what it sets ("Theme") and carries no description. The menu keeps the
382
+ * subject in its accessible name.
383
+ */
384
+ sectioned?: boolean
379
385
  onSelect: (id: string) => void
380
386
  }
381
387
 
@@ -407,7 +413,11 @@ function PinnedThemeRow(
407
413
  : `${props.subject} follows the interface theme.`
408
414
  }
409
415
  return (
410
- <SettingsRow title={props.title} icon={props.icon} description={description()}>
416
+ <SettingsRow
417
+ title={props.sectioned ? 'Theme' : props.title}
418
+ icon={props.icon}
419
+ description={props.sectioned ? undefined : description()}
420
+ >
411
421
  <ThemeSelectMenu
412
422
  label={props.title}
413
423
  selectedId={props.selectedId}
@@ -31,6 +31,10 @@ export type AppearanceDraft = Readonly<{
31
31
  reduceTransparency: boolean
32
32
  }>
33
33
 
34
+ /** The sections a tabbed appearance surface splits its rows into. */
35
+ export const APPEARANCE_EDITOR_TABS = ['global', 'terminal', 'code'] as const
36
+ export type AppearanceEditorTab = (typeof APPEARANCE_EDITOR_TABS)[number]
37
+
34
38
  export type AppearanceEditorProps = {
35
39
  draft: AppearanceDraft
36
40
  /** Resolved preview themes, including the host's validated accent overlay. */
@@ -68,6 +72,19 @@ export type AppearanceEditorProps = {
68
72
  * row anatomy (glyph tile, title, description, trailing control).
69
73
  */
70
74
  extraRows?: JSX.Element
75
+ /**
76
+ * Draw one section of the option list instead of all of it. `global` holds
77
+ * the mode, the light and dark themes, accent, glass, reduced transparency,
78
+ * the theme library and the UI and Content typefaces. `terminal` holds the
79
+ * terminal palette and typeface, then `terminalRows`. `code` holds the code
80
+ * palette and typeface, then `codeRows`. Omitted, every row is drawn in one
81
+ * list as before, with no Terminal typeface row.
82
+ */
83
+ section?: AppearanceEditorTab
84
+ /** Host rows closing the Terminal section, composed like `extraRows`. */
85
+ terminalRows?: JSX.Element
86
+ /** Host rows closing the Code section, composed like `extraRows`. */
87
+ codeRows?: JSX.Element
71
88
  /** Leave Reset/Cancel/Save to the host, which renders `AppearanceEditorActions`. */
72
89
  hideActions?: boolean
73
90
  /**
@@ -121,4 +138,14 @@ export type AppearancePopoverProps = AppearanceEditorProps & {
121
138
  * the palette glyph the other toolbar actions carry.
122
139
  */
123
140
  triggerVariant?: 'ghost' | 'toolbar'
141
+ /**
142
+ * Split the sheet into Global, Terminal and Code tabs under its header.
143
+ * `tab` selects one; with `tabs` set and no `tab`, the sheet keeps its own
144
+ * selection and opens on Global.
145
+ */
146
+ tabs?: boolean
147
+ tab?: AppearanceEditorTab
148
+ onTabChange?: (tab: AppearanceEditorTab) => void
149
+ /** Replaces the line under the title. */
150
+ description?: JSX.Element
124
151
  }
@@ -3,8 +3,9 @@ import {
3
3
  ChevronDown as LucideChevronDown,
4
4
  Code2 as LucideCode2,
5
5
  PanelsTopLeft as LucidePanelsTopLeft,
6
+ SquareTerminal as LucideSquareTerminal,
6
7
  } from 'lucide-solid'
7
- import { For, createMemo, createSignal, createUniqueId } from 'solid-js'
8
+ import { For, Show, createMemo, createSignal, createUniqueId } from 'solid-js'
8
9
  import { DEFAULT_FONT_ID, fontOptions } from '../../../lib/font-catalog'
9
10
  import { Button } from '../../ui/button'
10
11
  import {
@@ -22,6 +23,7 @@ import {
22
23
  APPEARANCE_EDITOR_FONT_SIZE_MIN,
23
24
  normalizeAppearanceEditorFontSettings,
24
25
  normalizeAppearanceEditorFontSize,
26
+ resolveAppearanceEditorFontSettings,
25
27
  type AppearanceEditorFontAxis,
26
28
  type AppearanceEditorFontFamilyId,
27
29
  type AppearanceEditorFontSettings,
@@ -33,14 +35,29 @@ const BookOpen = fastIcon(LucideBookOpen)
33
35
  const ChevronDown = fastIcon(LucideChevronDown)
34
36
  const Code2 = fastIcon(LucideCode2)
35
37
  const PanelsTopLeft = fastIcon(LucidePanelsTopLeft)
38
+ const SquareTerminal = fastIcon(LucideSquareTerminal)
36
39
 
37
40
  export type AppearanceFontSettingsGroupProps = {
38
41
  settings: AppearanceEditorFontSettings
39
42
  menuPortalMount?: HTMLElement
40
43
  onChange: (settings: AppearanceEditorFontSettings) => void
41
44
  disabled?: boolean
45
+ /**
46
+ * The axes to draw, in the catalogue's order. The default is UI, Content and
47
+ * Code: with no terminal row the terminal keeps following Code. A host that
48
+ * lists `terminal` lets it be set apart; until it is, the row shows Code's value.
49
+ */
50
+ axes?: readonly AppearanceEditorFontAxis[]
51
+ /**
52
+ * The rows sit under a tab that already names their subject: each is titled
53
+ * "Font" and carries no description. Controls keep the axis in their
54
+ * accessible names.
55
+ */
56
+ sectioned?: boolean
42
57
  }
43
58
 
59
+ const DEFAULT_FONT_ROW_AXES: readonly AppearanceEditorFontAxis[] = ['ui', 'content', 'code']
60
+
44
61
  const FONT_ROWS = [
45
62
  {
46
63
  axis: 'ui',
@@ -57,9 +74,15 @@ const FONT_ROWS = [
57
74
  {
58
75
  axis: 'code',
59
76
  label: 'Code',
60
- description: 'Code, terminals, and file paths.',
77
+ description: 'Code, diffs, and file paths.',
61
78
  icon: Code2,
62
79
  },
80
+ {
81
+ axis: 'terminal',
82
+ label: 'Terminal',
83
+ description: 'Terminals and agent CLIs.',
84
+ icon: SquareTerminal,
85
+ },
63
86
  ] as const satisfies readonly {
64
87
  axis: AppearanceEditorFontAxis
65
88
  label: string
@@ -71,6 +94,7 @@ const catalogFontOptions = fontOptions.filter((option) => option.id !== DEFAULT_
71
94
 
72
95
  function FontFamilyMenu(props: {
73
96
  label: string
97
+ axis: AppearanceEditorFontAxis
74
98
  family: AppearanceEditorFontFamilyId
75
99
  menuPortalMount?: HTMLElement
76
100
  disabled?: boolean
@@ -85,6 +109,12 @@ function FontFamilyMenu(props: {
85
109
  fontOptions.find((option) => option.id === DEFAULT_FONT_ID)?.label ??
86
110
  'System'
87
111
 
112
+ const selectedFamilyVariable = () =>
113
+ (
114
+ fontOptions.find((option) => option.id === props.family) ??
115
+ fontOptions.find((option) => option.id === DEFAULT_FONT_ID)
116
+ )?.familyVariables[props.axis] ?? '--font-family-system'
117
+
88
118
  return (
89
119
  <DropdownMenu
90
120
  modal={false}
@@ -103,7 +133,11 @@ function FontFamilyMenu(props: {
103
133
  disabled={props.disabled}
104
134
  class="w-32 max-w-full justify-between"
105
135
  >
106
- <span class="truncate">{selectedLabel()}</span>
136
+ {/* The choice is drawn in its own face: a preview, and the face is fetched as soon as
137
+ it is picked even when nothing else on screen uses this axis yet. */}
138
+ <span class="truncate" style={{ 'font-family': `var(${selectedFamilyVariable()})` }}>
139
+ {selectedLabel()}
140
+ </span>
107
141
  <ChevronDown aria-hidden="true" class="ms-2 size-4 shrink-0 text-muted-foreground" />
108
142
  </DropdownMenuTrigger>
109
143
  <DropdownMenuContent
@@ -198,6 +232,9 @@ export function AppearanceFontSettingsGroup(props: AppearanceFontSettingsGroupPr
198
232
  >({})
199
233
  const sizeHintPrefix = createUniqueId()
200
234
  const settings = createMemo(() => normalizeAppearanceEditorFontSettings(props.settings).settings)
235
+ const resolved = createMemo(() => resolveAppearanceEditorFontSettings(settings()))
236
+ const axes = () => props.axes ?? DEFAULT_FONT_ROW_AXES
237
+ const rows = createMemo(() => FONT_ROWS.filter((row) => axes().includes(row.axis)))
201
238
 
202
239
  const updateAxis = (
203
240
  axis: AppearanceEditorFontAxis,
@@ -207,7 +244,7 @@ export function AppearanceFontSettingsGroup(props: AppearanceFontSettingsGroupPr
207
244
  props.onChange({
208
245
  ...current,
209
246
  [axis]: {
210
- ...current[axis],
247
+ ...resolved()[axis],
211
248
  ...patch,
212
249
  },
213
250
  })
@@ -216,21 +253,21 @@ export function AppearanceFontSettingsGroup(props: AppearanceFontSettingsGroupPr
216
253
  const commitSize = (axis: AppearanceEditorFontAxis) => {
217
254
  const input = sizeDrafts()[axis]
218
255
  if (input === undefined) return
219
- const size = normalizeAppearanceEditorFontSize(input, settings()[axis].size)
256
+ const size = normalizeAppearanceEditorFontSize(input, resolved()[axis].size)
220
257
  setSizeDrafts((current) => {
221
258
  const next = { ...current }
222
259
  delete next[axis]
223
260
  return next
224
261
  })
225
- if (size !== settings()[axis].size) updateAxis(axis, { size })
262
+ if (size !== resolved()[axis].size) updateAxis(axis, { size })
226
263
  }
227
264
 
228
265
  return (
229
266
  <div class="global-appearance-font-settings">
230
- <For each={FONT_ROWS}>
267
+ <For each={rows()}>
231
268
  {(row) => {
232
269
  const Icon = row.icon
233
- const value = () => settings()[row.axis]
270
+ const value = () => resolved()[row.axis]
234
271
  const inputValue = () => sizeDrafts()[row.axis] ?? String(value().size)
235
272
  const sizeHintId = `${sizeHintPrefix}-${row.axis}-font-size-help`
236
273
  const sizeIsInvalid = () => {
@@ -257,12 +294,15 @@ export function AppearanceFontSettingsGroup(props: AppearanceFontSettingsGroupPr
257
294
  and the title/subtitle stay aligned. The compact widths keep
258
295
  that true at the appearance sheet's own width. */}
259
296
  <div class="min-w-0 flex-1">
260
- <h3 class="text-sm font-medium">{row.label}</h3>
261
- <div class="mt-0.5 truncate text-xs text-muted-foreground">{row.description}</div>
297
+ <h3 class="text-sm font-medium">{props.sectioned ? 'Font' : row.label}</h3>
298
+ <Show when={!props.sectioned}>
299
+ <div class="mt-0.5 truncate text-xs text-muted-foreground">{row.description}</div>
300
+ </Show>
262
301
  </div>
263
302
  <div class="flex shrink-0 items-center gap-2">
264
303
  <FontFamilyMenu
265
304
  label={row.label}
305
+ axis={row.axis}
266
306
  family={value().family}
267
307
  menuPortalMount={props.menuPortalMount}
268
308
  disabled={props.disabled}
@@ -14,12 +14,15 @@ export {
14
14
  fontSettingsBootstrapScript,
15
15
  normalizeAppearanceEditorFontSettings,
16
16
  normalizeAppearanceEditorFontSize,
17
+ resolveAppearanceEditorFontSettings,
17
18
  type AppearanceEditorFontAxis,
18
19
  type AppearanceEditorFontFamilyId,
19
20
  type AppearanceEditorFontSetting,
20
21
  type AppearanceEditorFontSettings,
21
22
  type NormalizedAppearanceEditorFontSettings,
23
+ type ResolvedAppearanceEditorFontSettings,
22
24
  } from '../../../lib/appearance-font-settings'
25
+ export { APPEARANCE_EDITOR_TABS, type AppearanceEditorTab } from './appearance-types'
23
26
  export type {
24
27
  AppearanceDraft,
25
28
  AppearanceEditorProps,