@adea-ai/app-framework 0.30.0 → 0.31.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/app/application.js +4 -2
- package/dist/appearance/appearance-host.js +6 -0
- package/dist/appearance/appearance-preferences.js +6 -2
- package/dist/appearance/composition.d.ts +1 -1
- package/dist/appearance/custom-theme-import.js +12 -19
- package/dist/appearance/custom-theme-library.d.ts +5 -4
- package/dist/appearance/custom-theme-library.js +20 -2
- package/dist/appearance/editor.js +4 -1
- package/dist/appearance/legacy-imported-theme-token-projection.d.ts +84 -0
- package/dist/appearance/legacy-imported-theme-token-projection.js +142 -0
- package/dist/appearance/theme-record-adapter.js +37 -9
- package/dist/framework-source.json +1 -1
- package/dist/shell/app-shell.js +76 -48
- package/dist/shell/app-utilities.d.ts +5 -3
- package/dist/shell/app-utilities.js +15 -7
- package/dist/shell/help-shortcuts.d.ts +4 -0
- package/dist/shell/help-shortcuts.js +38 -7
- package/dist/shell/keyboard-target.d.ts +2 -0
- package/dist/shell/keyboard-target.js +54 -0
- package/dist/shell/settings-sections.d.ts +5 -0
- package/dist/shell/settings-shortcuts.d.ts +10 -0
- package/dist/shell/settings-shortcuts.js +67 -0
- package/dist/views/app-help.js +2 -1
- package/dist/views/app-settings.js +5 -2
- package/dist/views/appearance-surface.js +33 -19
- package/package.json +6 -4
- package/src/app/application.tsx +3 -1
- package/src/appearance/appearance-host.tsx +6 -0
- package/src/appearance/appearance-preferences.ts +7 -1
- package/src/appearance/composition.ts +3 -1
- package/src/appearance/custom-theme-import.ts +21 -37
- package/src/appearance/custom-theme-library.ts +21 -5
- package/src/appearance/editor.ts +7 -6
- package/src/appearance/legacy-imported-theme-token-projection.ts +51 -0
- package/src/appearance/theme-record-adapter.ts +58 -11
- package/src/shell/app-shell.tsx +88 -58
- package/src/shell/app-utilities.tsx +29 -17
- package/src/shell/help-shortcuts.ts +77 -6
- package/src/shell/keyboard-target.ts +74 -0
- package/src/shell/settings-sections.ts +5 -0
- package/src/shell/settings-shortcuts.ts +116 -0
- package/src/views/app-settings.tsx +5 -3
- package/src/views/appearance-surface.tsx +63 -27
|
@@ -32,10 +32,18 @@ import { Button } from '@adea-ai/ui/components/ui/button'
|
|
|
32
32
|
import { Input } from '@adea-ai/ui/components/ui/input'
|
|
33
33
|
import { ModalDialog } from '@adea-ai/ui/components/ui/modal-dialog'
|
|
34
34
|
import { Heading } from '@adea-ai/ui/components/ui/typography'
|
|
35
|
-
import {
|
|
35
|
+
import {
|
|
36
|
+
batch,
|
|
37
|
+
createEffect,
|
|
38
|
+
createMemo,
|
|
39
|
+
createSignal,
|
|
40
|
+
For,
|
|
41
|
+
onCleanup,
|
|
42
|
+
onMount,
|
|
43
|
+
Show,
|
|
44
|
+
untrack,
|
|
45
|
+
} from 'solid-js'
|
|
36
46
|
import { MonitorCog } from 'lucide-solid'
|
|
37
|
-
|
|
38
|
-
import { For, Show } from 'solid-js'
|
|
39
47
|
import { themeAccentsForRecords } from '@adea-ai/ui/lib/theme-projection'
|
|
40
48
|
|
|
41
49
|
import { draftVariants } from '../appearance/composition'
|
|
@@ -100,7 +108,6 @@ function AppearanceHost(props: { popover?: AppearanceControlProps }) {
|
|
|
100
108
|
const [accentStatus, setAccentStatus] = createSignal('')
|
|
101
109
|
const [libraryOpen, setLibraryOpen] = createSignal(false)
|
|
102
110
|
|
|
103
|
-
const miniatures = createMemo(() => draftVariants(editor.draft()))
|
|
104
111
|
// Imported themes: refreshed through the registry subscription so the
|
|
105
112
|
// picker and this dialog track imports and removals without prop drilling.
|
|
106
113
|
const [library, setLibrary] = createSignal(readCustomThemeLibrary(defaultPreferenceStorage()))
|
|
@@ -110,12 +117,19 @@ function AppearanceHost(props: { popover?: AppearanceControlProps }) {
|
|
|
110
117
|
subscribeCustomThemes(() => setLibrary(readCustomThemeLibrary(defaultPreferenceStorage())))
|
|
111
118
|
)
|
|
112
119
|
})
|
|
113
|
-
//
|
|
114
|
-
//
|
|
115
|
-
const themes = () => {
|
|
120
|
+
// Imported records are a projection of the library, not of the draft. Keep
|
|
121
|
+
// the catalogue stable while controls update; imports and removals invalidate it.
|
|
122
|
+
const themes = createMemo(() => {
|
|
116
123
|
library()
|
|
117
124
|
return allThemeRecords()
|
|
118
|
-
}
|
|
125
|
+
})
|
|
126
|
+
const lightThemeId = createMemo(() => editor.draft().lightThemeId)
|
|
127
|
+
const darkThemeId = createMemo(() => editor.draft().darkThemeId)
|
|
128
|
+
const miniatures = createMemo(() => {
|
|
129
|
+
// A selected imported theme can arrive, change, or disappear in another context.
|
|
130
|
+
library()
|
|
131
|
+
return draftVariants({ lightThemeId: lightThemeId(), darkThemeId: darkThemeId() })
|
|
132
|
+
})
|
|
119
133
|
const [importStatus, setImportStatus] = createSignal('')
|
|
120
134
|
const [importPending, setImportPending] = createSignal(false)
|
|
121
135
|
const themeActionFence = createThemeLibraryActionFence(setImportStatus)
|
|
@@ -166,10 +180,11 @@ function AppearanceHost(props: { popover?: AppearanceControlProps }) {
|
|
|
166
180
|
}
|
|
167
181
|
|
|
168
182
|
const themeAccentOptions = createMemo(() => {
|
|
169
|
-
const draft = editor.draft()
|
|
170
183
|
const records = themes()
|
|
171
|
-
const
|
|
172
|
-
const
|
|
184
|
+
const lightId = lightThemeId()
|
|
185
|
+
const darkId = darkThemeId()
|
|
186
|
+
const light = records.find((record) => record.id === lightId)
|
|
187
|
+
const dark = records.find((record) => record.id === darkId)
|
|
173
188
|
return light && dark ? themeAccentsForRecords(light, dark) : []
|
|
174
189
|
})
|
|
175
190
|
|
|
@@ -193,9 +208,13 @@ function AppearanceHost(props: { popover?: AppearanceControlProps }) {
|
|
|
193
208
|
const mode = editor.draft().mode
|
|
194
209
|
if (mode === 'light') return variants.light
|
|
195
210
|
if (mode === 'dark') return variants.dark
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
211
|
+
// The document may still show the prior preview during a batched switch
|
|
212
|
+
// to System. Resolve the requested mode the same way the provider does.
|
|
213
|
+
const systemIsDark =
|
|
214
|
+
typeof window !== 'undefined' &&
|
|
215
|
+
typeof window.matchMedia === 'function' &&
|
|
216
|
+
window.matchMedia('(prefers-color-scheme: dark)').matches
|
|
217
|
+
return systemIsDark ? variants.dark : variants.light
|
|
199
218
|
}
|
|
200
219
|
|
|
201
220
|
const preview = () => appearance.preview(editor.draft())
|
|
@@ -214,7 +233,11 @@ function AppearanceHost(props: { popover?: AppearanceControlProps }) {
|
|
|
214
233
|
preview()
|
|
215
234
|
}
|
|
216
235
|
|
|
217
|
-
const setAccent = (value: string) => {
|
|
236
|
+
const setAccent = (value: string, otherChanges: Partial<AppearancePreferencesV2>) => {
|
|
237
|
+
// Apply the other fields first so custom-accent validation uses the theme
|
|
238
|
+
// selected by the same patch. Publish only the resulting combined draft.
|
|
239
|
+
const before = editor.draft()
|
|
240
|
+
editor.set(otherChanges)
|
|
218
241
|
if (value === 'theme' || accentPresetById(value) || isThemeAccentId(value)) {
|
|
219
242
|
setCustomAccent('')
|
|
220
243
|
setRawCustomAccent('')
|
|
@@ -229,6 +252,7 @@ function AppearanceHost(props: { popover?: AppearanceControlProps }) {
|
|
|
229
252
|
// in the controlled published editor for correction and recovery.
|
|
230
253
|
setRawCustomAccent(value)
|
|
231
254
|
setAccentStatus(validation.error ?? 'Invalid custom accent.')
|
|
255
|
+
if (editor.draft() !== before) preview()
|
|
232
256
|
return
|
|
233
257
|
}
|
|
234
258
|
setCustomAccent(validation.value)
|
|
@@ -237,17 +261,21 @@ function AppearanceHost(props: { popover?: AppearanceControlProps }) {
|
|
|
237
261
|
setDraft({ accent: validation.value })
|
|
238
262
|
}
|
|
239
263
|
|
|
240
|
-
const onChange = (patch: Partial<AppearanceDraft>) =>
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
264
|
+
const onChange = (patch: Partial<AppearanceDraft>) =>
|
|
265
|
+
batch(() => {
|
|
266
|
+
const { accent, surface, ...rest } = patch
|
|
267
|
+
const otherChanges: Partial<AppearancePreferencesV2> = {
|
|
268
|
+
...rest,
|
|
269
|
+
...(surface === undefined
|
|
270
|
+
? {}
|
|
271
|
+
: { surface: surface === 'theme' ? 'translucent' : surface }),
|
|
272
|
+
}
|
|
273
|
+
if (accent !== undefined) {
|
|
274
|
+
setAccent(accent, otherChanges)
|
|
275
|
+
return
|
|
276
|
+
}
|
|
277
|
+
setDraft(otherChanges)
|
|
278
|
+
})
|
|
251
279
|
|
|
252
280
|
const save = () => {
|
|
253
281
|
// The embedded section's published action stays disabled until the draft
|
|
@@ -301,7 +329,15 @@ function AppearanceHost(props: { popover?: AppearanceControlProps }) {
|
|
|
301
329
|
return appearanceThemeForPreview(miniatures().dark, editor.draft().accent, editor.draft())
|
|
302
330
|
},
|
|
303
331
|
get resolvedAppearance() {
|
|
304
|
-
|
|
332
|
+
// The editor's `system` draft previews the appearance the provider is
|
|
333
|
+
// currently showing. `resolvedAppearance()` remains committed by contract;
|
|
334
|
+
// older shared UI releases and context mocks do not expose the additive API.
|
|
335
|
+
const shownAppearance = (
|
|
336
|
+
appearance as typeof appearance & {
|
|
337
|
+
shownAppearance?: () => 'light' | 'dark'
|
|
338
|
+
}
|
|
339
|
+
).shownAppearance
|
|
340
|
+
return shownAppearance?.() ?? appearance.resolvedAppearance()
|
|
305
341
|
},
|
|
306
342
|
get themes() {
|
|
307
343
|
return themes()
|