@adea-ai/ui 0.61.1 → 0.63.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 (130) hide show
  1. package/README.md +94 -6
  2. package/dist/LICENSE +201 -0
  3. package/dist/NOTICE +101 -0
  4. package/dist/components/composites/account-menu/index.js +2 -0
  5. package/dist/components/composites/appearance-editor/appearance-choices.d.ts +5 -0
  6. package/dist/components/composites/appearance-editor/appearance-choices.d.ts.map +1 -0
  7. package/dist/components/composites/appearance-editor/appearance-choices.js +211 -0
  8. package/dist/components/composites/appearance-editor/appearance-choices.js.map +1 -0
  9. package/dist/components/composites/appearance-editor/appearance-editor.d.ts +15 -0
  10. package/dist/components/composites/appearance-editor/appearance-editor.d.ts.map +1 -0
  11. package/dist/components/composites/appearance-editor/appearance-editor.js +280 -0
  12. package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -0
  13. package/dist/components/composites/appearance-editor/appearance-rows.d.ts +18 -0
  14. package/dist/components/composites/appearance-editor/appearance-rows.d.ts.map +1 -0
  15. package/dist/components/composites/appearance-editor/appearance-rows.js +101 -0
  16. package/dist/components/composites/appearance-editor/appearance-rows.js.map +1 -0
  17. package/dist/components/composites/appearance-editor/appearance-types.d.ts +42 -0
  18. package/dist/components/composites/appearance-editor/appearance-types.d.ts.map +1 -0
  19. package/dist/components/composites/appearance-editor/index.d.ts +4 -0
  20. package/dist/components/composites/appearance-editor/index.d.ts.map +1 -0
  21. package/dist/components/composites/appearance-editor/index.js +3 -0
  22. package/dist/components/composites/appearance-editor/theme-preview.d.ts +17 -0
  23. package/dist/components/composites/appearance-editor/theme-preview.d.ts.map +1 -0
  24. package/dist/components/composites/appearance-editor/theme-preview.js +158 -0
  25. package/dist/components/composites/appearance-editor/theme-preview.js.map +1 -0
  26. package/dist/components/composites/list-row/index.js +2 -0
  27. package/dist/components/composites/settings/index.js +2 -0
  28. package/dist/components/composites/stat/index.js +2 -0
  29. package/dist/components/composites/update-dialog/index.js +2 -0
  30. package/dist/components/composites/workspace-mark/index.js +2 -0
  31. package/dist/components/conversation/index.js +6 -0
  32. package/dist/components/layout/app-shell/index.js +2 -0
  33. package/dist/components/layout/page/index.js +2 -0
  34. package/dist/components/layout/panel/index.js +2 -0
  35. package/dist/components/layout/side-rail/index.js +3 -0
  36. package/dist/components/layout/sidebar-nav/index.js +2 -0
  37. package/dist/components/layout/status-bar/index.js +2 -0
  38. package/dist/components/layout/top-bar/index.js +2 -0
  39. package/dist/components/motion/index.js +2 -2
  40. package/dist/components/theme/index.js +5 -0
  41. package/dist/components/ui/accordion/index.js +2 -0
  42. package/dist/components/ui/alert/index.js +2 -0
  43. package/dist/components/ui/alert-dialog/index.js +2 -0
  44. package/dist/components/ui/aspect-ratio/index.js +2 -0
  45. package/dist/components/ui/avatar/index.js +2 -0
  46. package/dist/components/ui/badge/index.js +2 -0
  47. package/dist/components/ui/board/index.js +2 -0
  48. package/dist/components/ui/breadcrumb/index.js +2 -0
  49. package/dist/components/ui/button/index.js +2 -0
  50. package/dist/components/ui/button-group/index.js +2 -0
  51. package/dist/components/ui/calendar/index.js +2 -0
  52. package/dist/components/ui/card/index.js +2 -0
  53. package/dist/components/ui/carousel/index.js +2 -0
  54. package/dist/components/ui/chart/index.js +2 -0
  55. package/dist/components/ui/checkbox/index.js +2 -0
  56. package/dist/components/ui/code-block/index.js +2 -0
  57. package/dist/components/ui/collapsible/index.js +2 -0
  58. package/dist/components/ui/combobox/index.js +2 -0
  59. package/dist/components/ui/command/index.js +2 -0
  60. package/dist/components/ui/context-menu/index.js +2 -0
  61. package/dist/components/ui/detail-panel/index.js +2 -0
  62. package/dist/components/ui/dialog/index.js +2 -0
  63. package/dist/components/ui/diff-block/index.js +2 -0
  64. package/dist/components/ui/drawer/index.js +2 -0
  65. package/dist/components/ui/dropdown-menu/index.js +2 -0
  66. package/dist/components/ui/empty/index.js +2 -0
  67. package/dist/components/ui/entity-icon/index.js +2 -0
  68. package/dist/components/ui/field/index.js +2 -0
  69. package/dist/components/ui/hover-card/index.js +2 -0
  70. package/dist/components/ui/input/index.js +2 -0
  71. package/dist/components/ui/input-group/index.js +2 -0
  72. package/dist/components/ui/input-otp/index.js +2 -0
  73. package/dist/components/ui/item/index.js +2 -0
  74. package/dist/components/ui/kbd/index.js +2 -0
  75. package/dist/components/ui/label/index.js +2 -0
  76. package/dist/components/ui/menubar/index.js +2 -0
  77. package/dist/components/ui/modal-dialog/index.js +2 -0
  78. package/dist/components/ui/navigation-menu/index.js +2 -0
  79. package/dist/components/ui/pagination/index.js +2 -0
  80. package/dist/components/ui/popover/index.js +2 -0
  81. package/dist/components/ui/progress/index.js +2 -0
  82. package/dist/components/ui/radio-group/index.js +2 -0
  83. package/dist/components/ui/resizable/index.js +2 -0
  84. package/dist/components/ui/scroll-area/index.js +2 -0
  85. package/dist/components/ui/select/index.js +2 -0
  86. package/dist/components/ui/select/select.d.ts +5 -1
  87. package/dist/components/ui/select/select.d.ts.map +1 -1
  88. package/dist/components/ui/select/select.js +24 -20
  89. package/dist/components/ui/select/select.js.map +1 -1
  90. package/dist/components/ui/separator/index.js +2 -0
  91. package/dist/components/ui/sheet/index.js +2 -0
  92. package/dist/components/ui/skeleton/index.js +2 -0
  93. package/dist/components/ui/slider/index.js +2 -0
  94. package/dist/components/ui/spinner/index.js +2 -0
  95. package/dist/components/ui/status-chip/index.js +2 -0
  96. package/dist/components/ui/switch/index.js +2 -0
  97. package/dist/components/ui/table/index.js +2 -0
  98. package/dist/components/ui/tabs/index.js +2 -0
  99. package/dist/components/ui/textarea/index.js +2 -0
  100. package/dist/components/ui/toast/index.js +2 -0
  101. package/dist/components/ui/toggle/index.js +2 -0
  102. package/dist/components/ui/toggle-group/index.js +2 -0
  103. package/dist/components/ui/tooltip/index.js +2 -0
  104. package/dist/index.d.ts +3 -4
  105. package/dist/index.d.ts.map +1 -1
  106. package/dist/index.js +3 -3
  107. package/dist/r/appearance-editor.json +51 -0
  108. package/dist/r/lib.json +1 -1
  109. package/dist/r/registry.json +52 -1
  110. package/dist/r/src/components/composites/appearance-editor/appearance-choices.tsx +173 -0
  111. package/dist/r/src/components/composites/appearance-editor/appearance-editor.tsx +239 -0
  112. package/dist/r/src/components/composites/appearance-editor/appearance-rows.tsx +122 -0
  113. package/dist/r/src/components/composites/appearance-editor/appearance-types.ts +40 -0
  114. package/dist/r/src/components/composites/appearance-editor/index.ts +12 -0
  115. package/dist/r/src/components/composites/appearance-editor/theme-preview.tsx +128 -0
  116. package/dist/r/src/components/ui/select/select.tsx +8 -3
  117. package/package.json +11 -9
  118. package/registry.json +52 -1
  119. package/src/components/composites/appearance-editor/appearance-choices.tsx +173 -0
  120. package/src/components/composites/appearance-editor/appearance-editor.tsx +239 -0
  121. package/src/components/composites/appearance-editor/appearance-rows.tsx +122 -0
  122. package/src/components/composites/appearance-editor/appearance-types.ts +40 -0
  123. package/src/components/composites/appearance-editor/index.ts +12 -0
  124. package/src/components/composites/appearance-editor/theme-preview.tsx +128 -0
  125. package/src/components/ui/select/select.tsx +8 -3
  126. package/src/index.ts +3 -4
  127. package/dist/components/ui/diff-block/diff-block.test.d.ts +0 -2
  128. package/dist/components/ui/diff-block/diff-block.test.d.ts.map +0 -1
  129. package/dist/lib/keyed-rows.test.d.ts +0 -2
  130. package/dist/lib/keyed-rows.test.d.ts.map +0 -1
@@ -0,0 +1,173 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2026 Wing
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+ // Pinned mode-card, accent-swatch, and glass-chip composition. Kobalte replaces
25
+ // the app port's manual roving focus; it does not replace the donor hierarchy.
26
+ import { RadioGroup as Radio } from '@kobalte/core/radio-group'
27
+ import { For, Show } from 'solid-js'
28
+ import type { AppearanceEditorProps } from './appearance-types'
29
+ import { ThemeMiniature, ThemeMiniatureSplit } from './theme-preview'
30
+
31
+ const MODES = [
32
+ { value: 'system', label: 'System' },
33
+ { value: 'light', label: 'Light' },
34
+ { value: 'dark', label: 'Dark' },
35
+ ] as const
36
+ const SURFACES = [
37
+ { value: 'theme', label: 'Theme default' },
38
+ { value: 'frosted', label: 'Frosted' },
39
+ { value: 'opaque', label: 'Opaque' },
40
+ ] as const
41
+
42
+ export function ModeChoices(props: AppearanceEditorProps) {
43
+ return (
44
+ <Radio
45
+ value={props.draft.mode}
46
+ disabled={props.saving}
47
+ orientation="horizontal"
48
+ aria-label="Appearance mode"
49
+ onChange={(mode) => {
50
+ const option = MODES.find((candidate) => candidate.value === mode)
51
+ if (option) props.onChange({ mode: option.value })
52
+ }}
53
+ class="grid grid-cols-1 gap-3 px-4 py-4 sm:grid-cols-3"
54
+ >
55
+ <For each={MODES}>
56
+ {(option) => (
57
+ <Radio.Item
58
+ value={option.value}
59
+ data-mode={option.value}
60
+ class="min-w-0 rounded-lg focus-within:ring-3 focus-within:ring-ring/50"
61
+ >
62
+ <Radio.ItemInput />
63
+ <Radio.ItemLabel class="flex cursor-pointer flex-col gap-2 rounded-lg border p-2 text-center text-xs data-[checked]:border-primary data-[checked]:ring-1 data-[checked]:ring-primary data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50">
64
+ <span class="block h-20 w-full">
65
+ <Show
66
+ when={option.value === 'system'}
67
+ fallback={
68
+ <ThemeMiniature
69
+ theme={option.value === 'light' ? props.lightTheme : props.darkTheme}
70
+ />
71
+ }
72
+ >
73
+ <ThemeMiniatureSplit light={props.lightTheme} dark={props.darkTheme} />
74
+ </Show>
75
+ </span>
76
+ <span>{option.label}</span>
77
+ </Radio.ItemLabel>
78
+ </Radio.Item>
79
+ )}
80
+ </For>
81
+ </Radio>
82
+ )
83
+ }
84
+
85
+ export function AccentChoices(props: AppearanceEditorProps) {
86
+ const custom = () =>
87
+ props.draft.accent !== 'theme' &&
88
+ !props.accentOptions.some((option) => option.id === props.draft.accent)
89
+ const accentSelection = () => (custom() ? 'custom' : props.draft.accent)
90
+ return (
91
+ <Radio
92
+ value={accentSelection()}
93
+ disabled={props.saving}
94
+ orientation="horizontal"
95
+ aria-label="Accent"
96
+ class="flex flex-wrap items-center gap-2"
97
+ onChange={(accent) =>
98
+ props.onChange({
99
+ accent: accent === 'custom' ? (props.customAccentValue ?? '') : accent,
100
+ })
101
+ }
102
+ >
103
+ <Radio.Item value="theme">
104
+ <Radio.ItemInput />
105
+ <Radio.ItemLabel class="flex h-7 cursor-pointer items-center rounded-md border px-2 text-xs data-[checked]:border-primary data-[checked]:ring-1 data-[checked]:ring-primary">
106
+ Theme default
107
+ </Radio.ItemLabel>
108
+ </Radio.Item>
109
+ <For each={props.accentOptions}>
110
+ {(option) => (
111
+ <Radio.Item
112
+ value={option.id}
113
+ class="rounded-full focus-within:ring-3 focus-within:ring-ring/50"
114
+ >
115
+ <Radio.ItemInput />
116
+ <Radio.ItemLabel class="block size-7 cursor-pointer rounded-full border p-0.5 data-[checked]:border-primary data-[checked]:ring-1 data-[checked]:ring-primary">
117
+ <span
118
+ class="block size-full rounded-full"
119
+ aria-hidden="true"
120
+ style={{
121
+ 'background-color':
122
+ (props.draft.mode === 'system'
123
+ ? props.resolvedAppearance
124
+ : props.draft.mode) === 'light'
125
+ ? option.light
126
+ : option.dark,
127
+ }}
128
+ />
129
+ <span class="sr-only">{option.label}</span>
130
+ </Radio.ItemLabel>
131
+ </Radio.Item>
132
+ )}
133
+ </For>
134
+ <Radio.Item value="custom">
135
+ <Radio.ItemInput />
136
+ <Radio.ItemLabel class="flex h-7 cursor-pointer items-center rounded-md border px-2 text-xs data-[checked]:border-primary data-[checked]:ring-1 data-[checked]:ring-primary">
137
+ Custom
138
+ </Radio.ItemLabel>
139
+ </Radio.Item>
140
+ </Radio>
141
+ )
142
+ }
143
+
144
+ export function GlassChoices(props: AppearanceEditorProps) {
145
+ return (
146
+ <Radio
147
+ value={props.draft.surface}
148
+ disabled={props.saving}
149
+ orientation="horizontal"
150
+ aria-label="Glass"
151
+ class="flex flex-wrap gap-1"
152
+ onChange={(surface) => {
153
+ const option = SURFACES.find((candidate) => candidate.value === surface)
154
+ if (option) props.onChange({ surface: option.value })
155
+ }}
156
+ >
157
+ <For each={SURFACES}>
158
+ {(option) => (
159
+ <Radio.Item
160
+ value={option.value}
161
+ disabled={option.value === 'frosted' && !props.surfaceCapability.frosted}
162
+ class="rounded-md focus-within:ring-3 focus-within:ring-ring/50"
163
+ >
164
+ <Radio.ItemInput />
165
+ <Radio.ItemLabel class="flex h-7 cursor-pointer items-center rounded-md border px-2 text-xs data-[checked]:border-primary data-[checked]:ring-1 data-[checked]:ring-primary data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50">
166
+ {option.label}
167
+ </Radio.ItemLabel>
168
+ </Radio.Item>
169
+ )}
170
+ </For>
171
+ </Radio>
172
+ )
173
+ }
@@ -0,0 +1,239 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2026 Wing
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+ /*
25
+ * Composition substantially translated from Zeron settings/appearance.rs and
26
+ * settings/widgets.rs, pinned at 30a9a9537c5ec96226c87f4bf349b6f77c5dfb59,
27
+ * preserving Adea's existing appearance-surface.tsx port: System/Light/Dark
28
+ * miniatures, compact independent theme rows, accent swatches and helper copy,
29
+ * glass chips, and theme library affordance. Kobalte replaces the port's manual
30
+ * radio keyboard model. The controlled draft and explicit action ports replace
31
+ * GPUI globals and app-specific storage/native authority. Save/Cancel/Reset and
32
+ * custom accent/reduced-transparency are accepted Adea divergences (#425).
33
+ */
34
+ import { EyeOff, Palette, PanelsTopLeft, SlidersHorizontal } from 'lucide-solid'
35
+ import { Show, createUniqueId } from 'solid-js'
36
+ import { cn } from '#lib/utils'
37
+ import { Button } from '../../ui/button/button'
38
+ import { Input } from '../../ui/input/input'
39
+
40
+ import { Switch } from '../../ui/switch/switch'
41
+ import {
42
+ Popover,
43
+ PopoverContent,
44
+ PopoverDescription,
45
+ PopoverTitle,
46
+ PopoverTrigger,
47
+ } from '../../ui/popover/popover'
48
+ import type { AppearanceEditorProps, AppearancePopoverProps } from './appearance-types'
49
+ import { ModeChoices, AccentChoices, GlassChoices } from './appearance-choices'
50
+ import { SettingsRow, ThemeRow } from './appearance-rows'
51
+
52
+ /**
53
+ * A live editor whose persistence and preview authority belong to its host.
54
+ * No ThemeProvider is required, and no catalogue, renderer engine or storage is
55
+ * imported. Hosts normalize unknown IDs and custom colors, report recovery,
56
+ * snapshot on open, preview on changes, commit on Save, and restore on dismissal.
57
+ * Both theme rows remain mounted when mode changes. Typeface/density axes are
58
+ * deliberately absent from Adea #425's accepted surface.
59
+ */
60
+ export function AppearanceEditor(props: AppearanceEditorProps) {
61
+ const errorId = createUniqueId()
62
+ const saveReasonId = createUniqueId()
63
+ const custom = () =>
64
+ props.draft.accent !== 'theme' &&
65
+ !props.accentOptions.some((option) => option.id === props.draft.accent)
66
+ const accentDescription = () => {
67
+ if (props.draft.accent === 'theme') return "Theme default · Uses the palette's intended color."
68
+ const name = props.accentOptions.find((option) => option.id === props.draft.accent)?.label
69
+ return `${name ?? 'Custom'} · Controls, glyphs, selections, code, and activity.`
70
+ }
71
+ const glassDescription = () =>
72
+ props.draft.surface === 'opaque'
73
+ ? 'Solid surfaces for every theme.'
74
+ : props.draft.surface === 'frosted'
75
+ ? 'Theme-colored glass where supported.'
76
+ : (props.surfaceCapability.themeDefaultDescription ?? "Uses this theme's default surface.")
77
+ return (
78
+ <div data-appearance-editor class={cn('min-w-0', props.class)}>
79
+ <Show when={props.recoveryNotice}>
80
+ <p role="status" class="px-4 py-2 text-sm text-muted-foreground">
81
+ {props.recoveryNotice}
82
+ </p>
83
+ </Show>
84
+ <ModeChoices {...props} />
85
+ <div class="divide-y divide-border rounded-lg border">
86
+ <ThemeRow
87
+ appearance="light"
88
+ selectedId={props.draft.lightThemeId}
89
+ preview={props.lightTheme}
90
+ themes={props.themes}
91
+ disabled={props.saving}
92
+ onSelect={(lightThemeId) => props.onChange({ lightThemeId })}
93
+ />
94
+ <ThemeRow
95
+ appearance="dark"
96
+ selectedId={props.draft.darkThemeId}
97
+ preview={props.darkTheme}
98
+ themes={props.themes}
99
+ disabled={props.saving}
100
+ onSelect={(darkThemeId) => props.onChange({ darkThemeId })}
101
+ />
102
+ <SettingsRow
103
+ stacked
104
+ title="Accent"
105
+ icon={<SlidersHorizontal />}
106
+ description={accentDescription()}
107
+ >
108
+ <AccentChoices {...props} />
109
+ </SettingsRow>
110
+ <Show when={custom()}>
111
+ <div class="px-4 py-3">
112
+ <label class="mb-2 block text-xs font-medium" for={`${errorId}-input`}>
113
+ Custom accent
114
+ </label>
115
+ <Input
116
+ id={`${errorId}-input`}
117
+ value={props.draft.accent}
118
+ disabled={props.saving}
119
+ aria-invalid={!!props.customAccentError}
120
+ aria-describedby={props.customAccentError ? errorId : undefined}
121
+ onInput={(event) => props.onChange({ accent: event.currentTarget.value })}
122
+ />
123
+ <Show when={props.customAccentError}>
124
+ <p id={errorId} role="alert" class="mt-1 text-xs text-destructive">
125
+ {props.customAccentError}
126
+ </p>
127
+ </Show>
128
+ </div>
129
+ </Show>
130
+ <SettingsRow title="Glass" icon={<PanelsTopLeft />} description={glassDescription()}>
131
+ <GlassChoices {...props} />
132
+ </SettingsRow>
133
+ <Show when={!props.surfaceCapability.frosted && props.surfaceCapability.reason}>
134
+ <p role="status" class="px-4 py-2 text-xs text-muted-foreground">
135
+ {props.surfaceCapability.reason}
136
+ </p>
137
+ </Show>
138
+ <SettingsRow
139
+ title="Reduce transparency"
140
+ icon={<EyeOff />}
141
+ description="Prefer solid surfaces, including during live preview."
142
+ >
143
+ <Switch
144
+ checked={props.draft.reduceTransparency}
145
+ disabled={props.saving}
146
+ onChange={(reduceTransparency: boolean) => props.onChange({ reduceTransparency })}
147
+ aria-label="Reduce transparency"
148
+ />
149
+ </SettingsRow>
150
+ <SettingsRow
151
+ title="Theme library"
152
+ icon={<Palette />}
153
+ description={
154
+ props.onManageThemes
155
+ ? 'Manage themes through the application.'
156
+ : 'Theme import is unavailable.'
157
+ }
158
+ >
159
+ <Button
160
+ type="button"
161
+ size="sm"
162
+ variant="outline"
163
+ disabled={!props.onManageThemes || props.saving}
164
+ onClick={() => props.onManageThemes?.()}
165
+ >
166
+ Manage themes
167
+ </Button>
168
+ </SettingsRow>
169
+ </div>
170
+ <Show when={props.saveDisabledReason}>
171
+ <p id={saveReasonId} role="status" class="px-4 pt-3 text-xs text-muted-foreground">
172
+ {props.saveDisabledReason}
173
+ </p>
174
+ </Show>
175
+ <div class="flex flex-wrap items-center gap-2 px-4 py-4">
176
+ <Button
177
+ type="button"
178
+ size="sm"
179
+ variant="ghost"
180
+ disabled={props.saving}
181
+ onClick={() => props.onReset()}
182
+ >
183
+ Reset
184
+ </Button>
185
+ <div class="ml-auto flex gap-2">
186
+ <Button
187
+ type="button"
188
+ size="sm"
189
+ variant="outline"
190
+ disabled={props.saving}
191
+ onClick={() => props.onCancel()}
192
+ >
193
+ Cancel
194
+ </Button>
195
+ <Button
196
+ type="button"
197
+ size="sm"
198
+ disabled={props.saving || !!props.customAccentError || !!props.saveDisabledReason}
199
+ aria-busy={props.saving}
200
+ aria-describedby={props.saveDisabledReason ? saveReasonId : undefined}
201
+ onClick={() => props.onSave()}
202
+ >
203
+ {props.saving ? 'Saving…' : 'Save'}
204
+ </Button>
205
+ </div>
206
+ </div>
207
+ </div>
208
+ )
209
+ }
210
+
211
+ /** Modal anchoring/dismissal and nested-listbox behavior come from Kobalte.
212
+ * Its measured available height also bounds scrolling, keeping footer actions
213
+ * reachable when a narrow popup begins below its trigger. */
214
+ export function AppearancePopover(props: AppearancePopoverProps) {
215
+ return (
216
+ <Popover
217
+ open={props.open}
218
+ modal
219
+ onOpenChange={(open) => (open ? props.onOpen() : props.onDismiss())}
220
+ >
221
+ <PopoverTrigger
222
+ as={Button}
223
+ type="button"
224
+ variant="ghost"
225
+ size="icon-sm"
226
+ aria-label="Appearance settings"
227
+ >
228
+ <Palette />
229
+ </PopoverTrigger>
230
+ <PopoverContent class="w-lg max-w-[calc(100vw-2rem)] max-h-(--kb-popper-content-available-height) overflow-y-auto">
231
+ <PopoverTitle>Appearance</PopoverTitle>
232
+ <PopoverDescription>
233
+ Changes preview immediately. Save keeps them; Cancel restores the previous appearance.
234
+ </PopoverDescription>
235
+ <AppearanceEditor {...props} />
236
+ </PopoverContent>
237
+ </Popover>
238
+ )
239
+ }
@@ -0,0 +1,122 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2026 Wing
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+ // Retains the compact divided row and palette-preview selector from the pinned
25
+ // Zeron/Adea composition; Kobalte owns option navigation and nested dismissal.
26
+ import type { AdeaTheme, AdeaThemeRecord } from '@adea-ai/themes'
27
+ import { Show, createMemo, createSignal, type JSX } from 'solid-js'
28
+ import { Palette } from 'lucide-solid'
29
+ import { cn } from '#lib/utils'
30
+ import {
31
+ Select,
32
+ SelectContent,
33
+ SelectItem,
34
+ SelectTrigger,
35
+ SelectValue,
36
+ } from '../../ui/select/select'
37
+ import { PalettePreview } from './theme-preview'
38
+
39
+ export function SettingsRow(props: {
40
+ title: string
41
+ icon: JSX.Element
42
+ description?: JSX.Element
43
+ stacked?: boolean
44
+ children: JSX.Element
45
+ }) {
46
+ return (
47
+ <section
48
+ class={cn('flex flex-col gap-3 px-4 py-4', { 'sm:flex-row sm:items-center': !props.stacked })}
49
+ >
50
+ <div class="flex min-w-0 flex-1 items-center gap-3">
51
+ <span
52
+ class="flex size-9 shrink-0 items-center justify-center rounded-lg border bg-foreground/5 text-muted-foreground [&_svg]:size-4"
53
+ aria-hidden="true"
54
+ >
55
+ {props.icon}
56
+ </span>
57
+ <div class="min-w-0">
58
+ <h3 class="text-sm font-medium">{props.title}</h3>
59
+ <Show when={props.description}>
60
+ <div class="mt-0.5 text-xs text-muted-foreground">{props.description}</div>
61
+ </Show>
62
+ </div>
63
+ </div>
64
+ <div class="min-w-0 shrink-0">{props.children}</div>
65
+ </section>
66
+ )
67
+ }
68
+
69
+ export function ThemeRow(props: {
70
+ appearance: 'light' | 'dark'
71
+ selectedId: string
72
+ preview: AdeaTheme
73
+ themes: readonly AdeaThemeRecord[]
74
+ disabled?: boolean
75
+ onSelect: (id: string) => void
76
+ }) {
77
+ const [portalMount, setPortalMount] = createSignal<HTMLDivElement>()
78
+ const options = createMemo(() =>
79
+ props.themes.filter((theme) => theme.appearance === props.appearance)
80
+ )
81
+ const selected = createMemo(
82
+ () =>
83
+ options().find((theme) => theme.id === props.selectedId) ??
84
+ options().find((theme) => theme.id === props.preview.id)
85
+ )
86
+ const label = () => (props.appearance === 'light' ? 'Light theme' : 'Dark theme')
87
+ return (
88
+ <SettingsRow title={label()} icon={<Palette />}>
89
+ <div ref={setPortalMount}>
90
+ <Select
91
+ modal={false}
92
+ options={options()}
93
+ value={selected()}
94
+ optionValue="id"
95
+ optionTextValue="name"
96
+ disabled={props.disabled || options().length === 0}
97
+ onChange={(theme) => {
98
+ if (theme) props.onSelect(theme.id)
99
+ }}
100
+ itemComponent={(item) => (
101
+ <SelectItem item={item.item}>
102
+ <PalettePreview theme={item.item.rawValue} />
103
+ {item.item.rawValue.name}
104
+ </SelectItem>
105
+ )}
106
+ >
107
+ <SelectTrigger size="sm" aria-label={label()} class="w-full sm:w-52">
108
+ <SelectValue>
109
+ {() => (
110
+ <>
111
+ <PalettePreview theme={props.preview} />
112
+ <span>{selected()?.name ?? props.preview.name}</span>
113
+ </>
114
+ )}
115
+ </SelectValue>
116
+ </SelectTrigger>
117
+ <SelectContent portalMount={portalMount()} />
118
+ </Select>
119
+ </div>
120
+ </SettingsRow>
121
+ )
122
+ }
@@ -0,0 +1,40 @@
1
+ import type { AccentPreset, AdeaTheme, AdeaThemeRecord } from '@adea-ai/themes'
2
+
3
+ export type AppearanceDraft = Readonly<{
4
+ mode: 'system' | 'light' | 'dark'
5
+ lightThemeId: string
6
+ darkThemeId: string
7
+ /** Theme default, a canonical preset id, or the host's custom accent draft. */
8
+ accent: string
9
+ surface: 'theme' | 'frosted' | 'opaque'
10
+ reduceTransparency: boolean
11
+ }>
12
+
13
+ export type AppearanceEditorProps = {
14
+ draft: AppearanceDraft
15
+ /** Resolved preview themes, including the host's validated accent overlay. */
16
+ lightTheme: AdeaTheme
17
+ darkTheme: AdeaTheme
18
+ resolvedAppearance: 'light' | 'dark'
19
+ themes: readonly AdeaThemeRecord[]
20
+ accentOptions: readonly AccentPreset[]
21
+ onChange: (patch: Partial<AppearanceDraft>) => void
22
+ onSave: () => void
23
+ onCancel: () => void
24
+ onReset: () => void
25
+ customAccentError?: string
26
+ customAccentValue?: string
27
+ saveDisabledReason?: string
28
+ saving?: boolean
29
+ recoveryNotice?: string
30
+ surfaceCapability: { frosted: boolean; reason?: string; themeDefaultDescription?: string }
31
+ /** Undefined means theme import is unavailable, never a working-looking action. */
32
+ onManageThemes?: () => void
33
+ class?: string
34
+ }
35
+
36
+ export type AppearancePopoverProps = AppearanceEditorProps & {
37
+ open: boolean
38
+ onOpen: () => void
39
+ onDismiss: () => void
40
+ }
@@ -0,0 +1,12 @@
1
+ export { AppearanceEditor, AppearancePopover } from './appearance-editor'
2
+ export type {
3
+ AppearanceDraft,
4
+ AppearanceEditorProps,
5
+ AppearancePopoverProps,
6
+ } from './appearance-types'
7
+ export {
8
+ ThemeMiniature,
9
+ ThemeMiniatureSplit,
10
+ PalettePreview,
11
+ type ThemeMiniatureProps,
12
+ } from './theme-preview'