@adea-ai/ui 0.157.0 → 0.159.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.
- package/dist/components/composites/action-button/action-button.d.ts +6 -0
- package/dist/components/composites/action-button/action-button.d.ts.map +1 -1
- package/dist/components/composites/action-button/action-button.js +29 -2
- package/dist/components/composites/action-button/action-button.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-editor.d.ts +1 -1
- package/dist/components/composites/appearance-editor/appearance-editor.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-editor.js +305 -172
- package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-rows.d.ts +6 -0
- package/dist/components/composites/appearance-editor/appearance-rows.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-rows.js +2 -2
- package/dist/components/composites/appearance-editor/appearance-rows.js.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-types.d.ts +26 -0
- package/dist/components/composites/appearance-editor/appearance-types.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/appearance-types.js +10 -0
- package/dist/components/composites/appearance-editor/appearance-types.js.map +1 -0
- package/dist/components/composites/appearance-editor/font-settings-group.d.ts +13 -1
- package/dist/components/composites/appearance-editor/font-settings-group.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/font-settings-group.js +51 -15
- package/dist/components/composites/appearance-editor/font-settings-group.js.map +1 -1
- package/dist/components/composites/appearance-editor/index.d.ts +2 -1
- package/dist/components/composites/appearance-editor/index.d.ts.map +1 -1
- package/dist/components/composites/appearance-editor/index.js +3 -2
- package/dist/components/composites/model-selector/index.d.ts +1 -1
- package/dist/components/composites/model-selector/index.d.ts.map +1 -1
- package/dist/components/composites/model-selector/model-selector.d.ts +22 -0
- package/dist/components/composites/model-selector/model-selector.d.ts.map +1 -1
- package/dist/components/composites/model-selector/model-selector.js +191 -46
- package/dist/components/composites/model-selector/model-selector.js.map +1 -1
- package/dist/components/ui/tooltip/tooltip.d.ts.map +1 -1
- package/dist/components/ui/tooltip/tooltip.js +4 -18
- package/dist/components/ui/tooltip/tooltip.js.map +1 -1
- package/dist/index.js +5 -4
- package/dist/lib/appearance-font-settings.d.ts +18 -4
- package/dist/lib/appearance-font-settings.d.ts.map +1 -1
- package/dist/lib/appearance-font-settings.js +24 -6
- package/dist/lib/appearance-font-settings.js.map +1 -1
- package/dist/lib/font-catalog.d.ts +5 -0
- package/dist/lib/font-catalog.d.ts.map +1 -1
- package/dist/lib/font-catalog.js +10 -5
- package/dist/lib/font-catalog.js.map +1 -1
- package/dist/lib/font-zoom.d.ts +1 -1
- package/dist/lib/font-zoom.d.ts.map +1 -1
- package/dist/lib/font-zoom.js +5 -1
- package/dist/lib/font-zoom.js.map +1 -1
- package/dist/lib/tokens.d.ts.map +1 -1
- package/dist/lib/tokens.js +17 -2
- package/dist/lib/tokens.js.map +1 -1
- package/dist/r/action-button.json +1 -0
- package/dist/r/appearance-editor.json +1 -0
- package/dist/r/registry.json +2 -0
- package/dist/r/src/components/composites/action-button/action-button.tsx +17 -1
- package/dist/r/src/components/composites/appearance-editor/appearance-editor.tsx +202 -110
- package/dist/r/src/components/composites/appearance-editor/appearance-rows.tsx +11 -1
- package/dist/r/src/components/composites/appearance-editor/appearance-types.ts +27 -0
- package/dist/r/src/components/composites/appearance-editor/font-settings-group.tsx +50 -10
- package/dist/r/src/components/composites/appearance-editor/index.ts +3 -0
- package/dist/r/src/components/composites/model-selector/index.ts +1 -1
- package/dist/r/src/components/composites/model-selector/model-selector.tsx +155 -10
- package/dist/r/src/components/ui/tooltip/tooltip.tsx +9 -18
- package/dist/r/src/lib/appearance-font-settings.ts +43 -7
- package/dist/r/src/lib/font-catalog.ts +5 -0
- package/dist/r/src/lib/font-zoom.ts +3 -0
- package/dist/r/src/lib/tokens.ts +17 -2
- package/dist/r/src/styles/appearance-font-settings.css +2 -0
- package/package.json +1 -1
- package/registry.json +2 -0
- package/src/components/composites/action-button/action-button.tsx +17 -1
- package/src/components/composites/appearance-editor/appearance-editor.tsx +202 -110
- package/src/components/composites/appearance-editor/appearance-rows.tsx +11 -1
- package/src/components/composites/appearance-editor/appearance-types.ts +27 -0
- package/src/components/composites/appearance-editor/font-settings-group.tsx +50 -10
- package/src/components/composites/appearance-editor/index.ts +3 -0
- package/src/components/composites/model-selector/index.ts +1 -1
- package/src/components/composites/model-selector/model-selector.tsx +155 -10
- package/src/components/ui/tooltip/tooltip.tsx +9 -18
- package/src/lib/appearance-font-settings.ts +43 -7
- package/src/lib/font-catalog.ts +5 -0
- package/src/lib/font-zoom.ts +3 -0
- package/src/lib/tokens.ts +17 -2
- package/src/styles/appearance-font-settings.css +2 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
For,
|
|
2
3
|
Show,
|
|
3
4
|
createRoot,
|
|
4
5
|
mergeProps,
|
|
@@ -13,6 +14,7 @@ import { callHandler } from '../../../lib/events'
|
|
|
13
14
|
import { Polymorphic } from '@kobalte/core/polymorphic'
|
|
14
15
|
import { buttonVariants, type ButtonProps } from '../../ui/button'
|
|
15
16
|
import { cn } from '../../../lib/utils'
|
|
17
|
+
import { Kbd, KbdGroup } from '../../ui/kbd'
|
|
16
18
|
import { Spinner } from '../../ui/spinner'
|
|
17
19
|
import { createDeferredTooltip, Tooltip, TooltipContent, TooltipTrigger } from '../../ui/tooltip'
|
|
18
20
|
|
|
@@ -44,6 +46,12 @@ export type ActionButtonProps<T extends ValidComponent = 'button'> = ButtonProps
|
|
|
44
46
|
* lacks. Size it by leaving the svg bare; the slot fixes it to control size.
|
|
45
47
|
*/
|
|
46
48
|
tooltipIcon?: JSX.Element
|
|
49
|
+
/**
|
|
50
|
+
* The action's keyboard chord, one entry per key (`['⇧', '⌘', 'D']`), drawn as keys after the
|
|
51
|
+
* explanation. Decorative like the rest of the tip: put the parseable chord on the control
|
|
52
|
+
* itself with `aria-keyshortcuts`.
|
|
53
|
+
*/
|
|
54
|
+
tooltipShortcut?: readonly string[]
|
|
47
55
|
/** Disables the action and announces the busy label through a polite status region. */
|
|
48
56
|
busy?: boolean
|
|
49
57
|
/** The activity announced while busy. The Button's accessible name stays unchanged. */
|
|
@@ -103,6 +111,7 @@ export function ActionButton<T extends ValidComponent = 'button'>(props: ActionB
|
|
|
103
111
|
'tooltip',
|
|
104
112
|
'tooltipSide',
|
|
105
113
|
'tooltipIcon',
|
|
114
|
+
'tooltipShortcut',
|
|
106
115
|
'busy',
|
|
107
116
|
'busyLabel',
|
|
108
117
|
// Split, not read from `rest`: mergeProps falls back to an earlier source when a
|
|
@@ -256,7 +265,14 @@ export function ActionButton<T extends ValidComponent = 'button'>(props: ActionB
|
|
|
256
265
|
>
|
|
257
266
|
<TooltipTrigger as={deferred.Target} />
|
|
258
267
|
<TooltipContent id={tooltipId} icon={local.tooltipIcon}>
|
|
259
|
-
{tooltipSlot()}
|
|
268
|
+
<Show when={local.tooltipShortcut?.length} fallback={tooltipSlot()}>
|
|
269
|
+
<span class="inline-flex items-center gap-2 whitespace-nowrap">
|
|
270
|
+
{tooltipSlot()}
|
|
271
|
+
<KbdGroup data-slot="action-button-shortcut" aria-hidden="true">
|
|
272
|
+
<For each={local.tooltipShortcut}>{(key) => <Kbd>{key}</Kbd>}</For>
|
|
273
|
+
</KbdGroup>
|
|
274
|
+
</span>
|
|
275
|
+
</Show>
|
|
260
276
|
</TooltipContent>
|
|
261
277
|
</Tooltip>
|
|
262
278
|
)}
|
|
@@ -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 {
|
|
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
|
|
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
|
|
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
|
-
<
|
|
147
|
+
<Show when={shows('global')}>
|
|
148
|
+
<ModeChoices {...props} />
|
|
149
|
+
</Show>
|
|
112
150
|
<div class="divide-y divide-border rounded-lg border">
|
|
113
|
-
<
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
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={
|
|
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={
|
|
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
|
-
<
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
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
|
-
|
|
164
|
-
aria-
|
|
165
|
-
onInput={(event) => props.onChange({ accent: event.currentTarget.value })}
|
|
251
|
+
onChange={(reduceTransparency: boolean) => props.onChange({ reduceTransparency })}
|
|
252
|
+
aria-label="Reduce transparency"
|
|
166
253
|
/>
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
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
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
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
|
-
|
|
337
|
-
|
|
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
|
-
<
|
|
341
|
-
|
|
342
|
-
|
|
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
|
|
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
|
}
|