@adea-ai/app-framework 0.46.12 → 0.48.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 (65) hide show
  1. package/README.md +2 -1
  2. package/dist/app/application.d.ts +2 -1
  3. package/dist/app/application.js +27 -16
  4. package/dist/app/create-application.js +6 -3
  5. package/dist/appearance/appearance-host.d.ts +2 -1
  6. package/dist/appearance/appearance-host.js +28 -21
  7. package/dist/appearance/editor.js +21 -3
  8. package/dist/framework-source.json +1 -1
  9. package/dist/shell/app-shell.d.ts +1 -1
  10. package/dist/shell/app-shell.js +97 -87
  11. package/dist/shell/app-utilities.d.ts +1 -1
  12. package/dist/shell/app-utilities.js +42 -23
  13. package/dist/shell/media-query.js +12 -10
  14. package/dist/shell/navigation-drawer.d.ts +1 -1
  15. package/dist/shell/navigation-drawer.js +6 -4
  16. package/dist/shell/poll.js +9 -11
  17. package/dist/shell/settings-sections.d.ts +1 -1
  18. package/dist/views/app-about.d.ts +1 -1
  19. package/dist/views/app-about.js +1 -1
  20. package/dist/views/app-appearance.d.ts +2 -1
  21. package/dist/views/app-appearance.js +4 -4
  22. package/dist/views/app-help.d.ts +1 -1
  23. package/dist/views/app-help.js +1 -1
  24. package/dist/views/app-settings.d.ts +2 -1
  25. package/dist/views/app-settings.js +15 -10
  26. package/dist/views/appearance-surface.d.ts +1 -1
  27. package/dist/views/appearance-surface.js +116 -91
  28. package/dist/views/update-surface.d.ts +1 -1
  29. package/dist/views/update-surface.js +1 -1
  30. package/dist/voice/voice-build.d.ts +62 -0
  31. package/dist/voice/voice-build.js +247 -0
  32. package/dist/voice/voice-client.d.ts +130 -0
  33. package/dist/voice/voice-client.js +405 -0
  34. package/dist/voice/voice-controls.d.ts +43 -0
  35. package/dist/voice/voice-controls.js +313 -0
  36. package/dist/voice/voice-host.d.ts +29 -0
  37. package/dist/voice/voice-host.js +248 -0
  38. package/dist/voice/voice-protocol.d.ts +127 -0
  39. package/dist/voice/voice-protocol.js +120 -0
  40. package/dist/voice/voice-settings.d.ts +15 -0
  41. package/dist/voice/voice-settings.js +1095 -0
  42. package/dist/voice/voice.d.ts +5 -0
  43. package/dist/voice/voice.js +5 -0
  44. package/package.json +32 -14
  45. package/src/app/application.tsx +28 -32
  46. package/src/appearance/appearance-host.tsx +30 -19
  47. package/src/appearance/editor.ts +25 -3
  48. package/src/shell/app-shell.tsx +46 -37
  49. package/src/shell/app-utilities.tsx +38 -40
  50. package/src/shell/media-query.ts +15 -10
  51. package/src/shell/navigation-drawer.tsx +1 -1
  52. package/src/shell/poll.ts +9 -10
  53. package/src/shell/settings-sections.ts +1 -1
  54. package/src/views/app-appearance.tsx +4 -3
  55. package/src/views/app-settings.tsx +2 -1
  56. package/src/views/appearance-surface.tsx +46 -35
  57. package/src/voice/voice-client.ts +579 -0
  58. package/src/voice/voice-controls.tsx +354 -0
  59. package/src/voice/voice-protocol.ts +189 -0
  60. package/src/voice/voice-settings.tsx +879 -0
  61. package/src/voice/voice.ts +13 -0
  62. package/templates/application/AGENTS.md +29 -0
  63. package/templates/application/src/web/main.tsx +2 -2
  64. package/templates/application/tsconfig.json +1 -1
  65. package/templates/application/vite.config.ts +1 -1
@@ -0,0 +1,5 @@
1
+ /** The renderer's voice API: the client, the service names, the settings section and controls. */
2
+ export * from './voice-client';
3
+ export { EVENTS_WAIT_MS, MAX_SPEAK_CHARACTERS, VOICE_SERVICES, type VoiceEvent, type VoiceEventBatch, type VoiceServiceName, type VoiceSpeechVoice, } from './voice-protocol';
4
+ export * from './voice-settings';
5
+ export * from './voice-controls';
@@ -0,0 +1,5 @@
1
+ import { createDesktopVoiceClient, createWebVoiceClient } from "./voice-client.js";
2
+ import { EVENTS_WAIT_MS, MAX_SPEAK_CHARACTERS, VOICE_SERVICES } from "./voice-protocol.js";
3
+ import { VOICE_COMMON_LOCALES, VoiceSettingsPanel, voiceSettingsSection } from "./voice-settings.js";
4
+ import { DictationButton, ReadAloudButton, createDictation } from "./voice-controls.js";
5
+ export { DictationButton, EVENTS_WAIT_MS, MAX_SPEAK_CHARACTERS, ReadAloudButton, VOICE_COMMON_LOCALES, VOICE_SERVICES, VoiceSettingsPanel, createDesktopVoiceClient, createDictation, createWebVoiceClient, voiceSettingsSection };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adea-ai/app-framework",
3
- "version": "0.46.12",
3
+ "version": "0.48.0",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -48,7 +48,10 @@
48
48
  "README.md",
49
49
  "LICENSE",
50
50
  "NOTICE",
51
- "templates"
51
+ "templates",
52
+ "src/voice",
53
+ "!src/voice/voice-host.ts",
54
+ "!src/voice/voice-build.ts"
52
55
  ],
53
56
  "type": "module",
54
57
  "sideEffects": false,
@@ -95,6 +98,19 @@
95
98
  "solid": "./src/views/app-settings.tsx",
96
99
  "import": "./dist/views/app-settings.js"
97
100
  },
101
+ "./voice": {
102
+ "types": "./dist/voice/voice.d.ts",
103
+ "solid": "./src/voice/voice.ts",
104
+ "import": "./dist/voice/voice.js"
105
+ },
106
+ "./voice-host": {
107
+ "types": "./dist/voice/voice-host.d.ts",
108
+ "import": "./dist/voice/voice-host.js"
109
+ },
110
+ "./voice-build": {
111
+ "types": "./dist/voice/voice-build.d.ts",
112
+ "import": "./dist/voice/voice-build.js"
113
+ },
98
114
  "./app-help": {
99
115
  "types": "./dist/views/app-help.d.ts",
100
116
  "solid": "./src/views/app-help.tsx",
@@ -425,40 +441,42 @@
425
441
  "test:generated": "bun run build && bun scripts/test-generated.ts"
426
442
  },
427
443
  "dependencies": {
444
+ "@adea-ai/voice": "0.4.0",
428
445
  "tar": "^7.5.22"
429
446
  },
430
447
  "devDependencies": {
431
- "@adea-ai/ui": "0.159.8",
448
+ "@adea-ai/ui": "0.160.1",
432
449
  "@babel/core": "8.1.0",
433
450
  "@babel/preset-typescript": "^8.0.7",
434
451
  "@happy-dom/global-registrator": "^21.0.4",
452
+ "@lucide/solid": "1.77.0",
435
453
  "@playwright/test": "1.65.0",
436
454
  "@shadcn/lint": "^0.2.5",
455
+ "@solidjs/compiler": "2.0.2",
456
+ "@solidjs/vite-plugin": "3.0.1",
457
+ "@solidjs/web": "2.0.3",
437
458
  "@tailwindcss/vite": "^4.3.5",
438
459
  "@types/bun": "^1.4.4",
439
460
  "@types/node": "^26.6.6",
440
- "babel-preset-solid": "^1.9.19",
461
+ "@ui-sdk/core": "0.1.0-beta.13",
462
+ "@ui-sdk/solid": "0.1.0-beta.13",
441
463
  "code-foundry": "1.54.1",
442
464
  "knip": "6.45.0",
443
- "lucide-solid": "^1.71.0",
444
465
  "oxfmt": "0.78.0",
445
466
  "oxlint": "1.93.0",
446
- "solid-js": "1.9.19",
467
+ "solid-js": "2.0.3",
447
468
  "typescript": "^7.0.2",
448
469
  "vite": "npm:@voidzero-dev/vite-plus-core@1.5.1",
449
- "vite-plugin-solid": "2.11.16",
450
470
  "vite-plus": "1.5.1"
451
471
  },
452
472
  "peerDependencies": {
453
- "@adea-ai/ui": "^0.159.8",
454
- "lucide-solid": "^1.51.0",
455
- "solid-js": "^1.9.15"
473
+ "@adea-ai/ui": "^0.160.1",
474
+ "@lucide/solid": "^1.77.0",
475
+ "@solidjs/web": "^2.0.3",
476
+ "solid-js": "^2.0.3"
456
477
  },
457
478
  "overrides": {
458
479
  "vite": "npm:@voidzero-dev/vite-plus-core@1.5.1"
459
480
  },
460
- "packageManager": "bun@1.4.4",
461
- "patchedDependencies": {
462
- "@kobalte/core@0.13.14": "patches/@kobalte%2Fcore@0.13.14.patch"
463
- }
481
+ "packageManager": "bun@1.4.4"
464
482
  }
@@ -1,12 +1,5 @@
1
- import {
2
- createEffect,
3
- createMemo,
4
- createSignal,
5
- onCleanup,
6
- type Component,
7
- type JSX,
8
- type ParentProps,
9
- } from 'solid-js'
1
+ import { createEffect, createMemo, createSignal, type Component, type ParentProps } from 'solid-js'
2
+ import { Dynamic, type JSX } from '@solidjs/web'
10
3
  import type { ContextualSidebarProps } from '@adea-ai/ui/components/layout/contextual-sidebar'
11
4
  import type { ThemeProviderProps } from '@adea-ai/ui/components/theme/lazy'
12
5
  import { ApplicationShell } from '../shell/app-shell'
@@ -95,24 +88,28 @@ export type ApplicationProps = {
95
88
 
96
89
  /** Mount shared UI chrome from an app's own views and identity. */
97
90
  export function Application(props: ApplicationProps) {
98
- const [localView, setLocalView] = createSignal(props.definition.initialView)
91
+ // Unset until the app navigates, so the initial view is read where it is used rather
92
+ // than once at the top of the component.
93
+ const [localView, setLocalView] = createSignal<string>()
99
94
  const [routerRevision, setRouterRevision] = createSignal(0)
100
- createEffect(() => {
101
- const router = props.router
102
- if (!router?.subscribe) return
95
+ createEffect(
96
+ () => props.router,
97
+ (router) => {
98
+ if (!router?.subscribe) return
103
99
 
104
- let active = true
105
- const unsubscribe = router.subscribe(() => {
106
- if (active) setRouterRevision((revision) => revision + 1)
107
- })
108
- onCleanup(() => {
109
- active = false
110
- unsubscribe()
111
- })
112
- })
100
+ let active = true
101
+ const unsubscribe = router.subscribe(() => {
102
+ if (active) setRouterRevision((revision) => revision + 1)
103
+ })
104
+ return () => {
105
+ active = false
106
+ unsubscribe()
107
+ }
108
+ }
109
+ )
113
110
  const view = createMemo(() => {
114
111
  routerRevision()
115
- const selected = props.router?.current() ?? localView()
112
+ const selected = props.router?.current() ?? localView() ?? props.definition.initialView
116
113
  return (
117
114
  props.definition.views.find((item) => item.id === selected) ??
118
115
  props.definition.views.find((item) => item.id === props.definition.initialView)!
@@ -130,13 +127,12 @@ export function Application(props: ApplicationProps) {
130
127
  setRouterRevision((revision) => revision + 1)
131
128
  }
132
129
  }
133
- const Theme =
134
- props.themeProvider ??
135
- ((providerProps: ParentProps) => (
136
- <ApplicationThemeProvider {...props.theme} storageKey={props.definition.storageKey}>
137
- {providerProps.children}
138
- </ApplicationThemeProvider>
139
- ))
130
+ const DefaultTheme = (providerProps: ParentProps) => (
131
+ <ApplicationThemeProvider {...props.theme} storageKey={props.definition.storageKey}>
132
+ {providerProps.children}
133
+ </ApplicationThemeProvider>
134
+ )
135
+ const theme = createMemo(() => props.themeProvider ?? DefaultTheme)
140
136
  // The shell reads these props many times, and a getter would rebuild them on every read.
141
137
  // The memos live under the theme provider so view code sees its context.
142
138
  const Shell = () => {
@@ -182,8 +178,8 @@ export function Application(props: ApplicationProps) {
182
178
  )
183
179
  }
184
180
  return (
185
- <Theme>
181
+ <Dynamic component={theme()}>
186
182
  <Shell />
187
- </Theme>
183
+ </Dynamic>
188
184
  )
189
185
  }
@@ -15,9 +15,9 @@ import {
15
15
  createSignal,
16
16
  useContext,
17
17
  type Context,
18
- type JSX,
19
18
  type ParentProps,
20
19
  } from 'solid-js'
20
+ import type { JSX } from '@solidjs/web'
21
21
 
22
22
  import {
23
23
  ThemeProvider as UiThemeProvider,
@@ -140,21 +140,29 @@ export function createAppearanceContext(ui: UiThemeContextValue): AppearanceCont
140
140
 
141
141
  // The shared provider ends a preview when the selection is committed. The editor's
142
142
  // draft is still open, though, so it keeps showing until the editor ends it.
143
- createEffect(() => {
144
- ui.selection()
145
- if (draft !== undefined && !ui.previewing()) ui.preview(previewSelection(draft))
146
- })
147
-
148
- return {
149
- ...ui,
150
- // `themes` is a live getter on the shared provider. Spreading the context
151
- // would otherwise capture only the initial catalogue snapshot.
152
- get themes() {
153
- return ui.themes
143
+ createEffect(
144
+ () => {
145
+ ui.selection()
146
+ return ui.previewing()
154
147
  },
155
- update: (patch) => ui.setSelection(selectionFromPreferences(patch)),
156
- preview,
157
- }
148
+ (previewing) => {
149
+ if (draft !== undefined && !previewing) ui.preview(previewSelection(draft))
150
+ }
151
+ )
152
+
153
+ // Copy the shared context's properties as descriptors, not by spreading: a spread reads
154
+ // every getter (`themes` among them) once, here, outside any tracking scope, and keeps
155
+ // that first snapshot.
156
+ const update: AppearanceContextValue['update'] = (patch) =>
157
+ ui.setSelection(selectionFromPreferences(patch))
158
+ return Object.defineProperties(
159
+ {},
160
+ {
161
+ ...Object.getOwnPropertyDescriptors(ui),
162
+ update: { value: update, enumerable: true },
163
+ preview: { value: preview, enumerable: true },
164
+ }
165
+ ) as AppearanceContextValue
158
166
  }
159
167
 
160
168
  /*
@@ -163,18 +171,21 @@ export function createAppearanceContext(ui: UiThemeContextValue): AppearanceCont
163
171
  * copy and a reader from the other two different context objects.
164
172
  */
165
173
  const CONTEXT_KEY = Symbol.for('adea.app.theme')
166
- type ContextHost = { [CONTEXT_KEY]?: Context<AppearanceContextValue | undefined> }
174
+ type ContextHost = { [CONTEXT_KEY]?: Context<AppearanceContextValue | null> }
167
175
 
168
- function appearanceContext(): Context<AppearanceContextValue | undefined> {
176
+ // `null` is the default so that reading outside a provider returns it instead of throwing
177
+ // Solid's ContextNotFoundError; `useTheme` throws its own, clearer error.
178
+ function appearanceContext(): Context<AppearanceContextValue | null> {
169
179
  const host = globalThis as ContextHost
170
- return (host[CONTEXT_KEY] ??= createContext<AppearanceContextValue>())
180
+ return (host[CONTEXT_KEY] ??= createContext<AppearanceContextValue | null>(null))
171
181
  }
172
182
 
173
183
  function AppearanceBridge(props: ParentProps) {
174
184
  const ui = useOptionalUiTheme()
175
185
  if (!ui) throw new Error('The appearance bridge must render inside the shared ThemeProvider.')
176
186
  const Context = appearanceContext()
177
- return <Context.Provider value={createAppearanceContext(ui)}>{props.children}</Context.Provider>
187
+ const value = createAppearanceContext(ui)
188
+ return <Context value={value}>{props.children}</Context>
178
189
  }
179
190
 
180
191
  type ThemeProviderProps = ParentProps<{
@@ -87,9 +87,31 @@ function sameOptionalFont(
87
87
  export function createAppearanceEditor(
88
88
  committed: AppearancePreferencesV2 = defaultAppearancePreferences
89
89
  ): AppearanceEditor {
90
- const [draft, setDraft] = createSignal<AppearancePreferencesV2>(committed)
91
- const [snapshot, setSnapshot] = createSignal<AppearancePreferencesV2>(committed)
92
- const [resetAll, setResetAll] = createSignal(false)
90
+ // Solid 2 shows a write to readers only after the next flush, but the editor is a
91
+ // synchronous state machine: a handler sets several fields and then reads the result
92
+ // (Save merges, a custom accent validates against the theme the same patch chose). The
93
+ // plain variables are the state; the signals only tell reactive readers it changed.
94
+ let draftValue = committed
95
+ let snapshotValue = committed
96
+ let resetValue = false
97
+ const [draftChanged, setDraftChanged] = createSignal(committed)
98
+ const [snapshotChanged, setSnapshotChanged] = createSignal(committed)
99
+ const [resetChanged, setResetChanged] = createSignal(false)
100
+ const draft = () => (draftChanged(), draftValue)
101
+ const snapshot = () => (snapshotChanged(), snapshotValue)
102
+ const resetAll = () => (resetChanged(), resetValue)
103
+ const setDraft = (value: AppearancePreferencesV2) => {
104
+ draftValue = value
105
+ setDraftChanged(() => value)
106
+ }
107
+ const setSnapshot = (value: AppearancePreferencesV2) => {
108
+ snapshotValue = value
109
+ setSnapshotChanged(() => value)
110
+ }
111
+ const setResetAll = (value: boolean) => {
112
+ resetValue = value
113
+ setResetChanged(value)
114
+ }
93
115
 
94
116
  return {
95
117
  draft,
@@ -16,24 +16,22 @@ import { ShellTopBar } from '@adea-ai/ui/components/layout/shell-top-bar'
16
16
  import { SideRailItem, SideRailSection } from '@adea-ai/ui/components/layout/side-rail'
17
17
  import { ActionButton } from '@adea-ai/ui/components/composites/action-button'
18
18
  import { TooltipProvider } from '@adea-ai/ui/components/ui/tooltip'
19
- import { PanelLeftClose, PanelLeftIcon, PanelLeftOpen } from 'lucide-solid'
19
+ import { PanelLeftClose, PanelLeftIcon, PanelLeftOpen } from '@lucide/solid'
20
20
  import { hasEditableKeyboardTarget } from './keyboard-target'
21
21
  import { createMediaQuery, DEFAULT_NARROW_QUERY } from './media-query'
22
22
  import {
23
23
  For,
24
+ Loading,
24
25
  Show,
25
- Suspense,
26
26
  children,
27
- createComputed,
28
27
  createEffect,
29
28
  createMemo,
29
+ createRenderEffect,
30
30
  createSignal,
31
31
  lazy,
32
- onCleanup,
33
- onMount,
34
- untrack,
35
- type JSX,
32
+ onSettled,
36
33
  } from 'solid-js'
34
+ import type { JSX } from '@solidjs/web'
37
35
 
38
36
  const NavigationDrawer = lazy(() =>
39
37
  import('./navigation-drawer').then((module) => ({ default: module.NavigationDrawer }))
@@ -124,16 +122,18 @@ export function ApplicationShell(props: ApplicationShellProps) {
124
122
  // The shared callback's cleanup supplies the mode but not the detached element.
125
123
  const sidebarElements = new Map<boolean, HTMLElement>()
126
124
  const sidebarElementCallbacks = new Map<boolean, ContextualSidebarProps['onSidebarElement']>()
127
- createEffect(() => {
128
- const nextCallback = sidebarProps()?.onSidebarElement
129
- for (const [mobile, element] of sidebarElements) {
130
- const previousCallback = sidebarElementCallbacks.get(mobile)
131
- if (previousCallback === nextCallback) continue
132
- previousCallback?.(undefined, mobile)
133
- nextCallback?.(element, mobile)
134
- sidebarElementCallbacks.set(mobile, nextCallback)
125
+ createEffect(
126
+ () => sidebarProps()?.onSidebarElement,
127
+ (nextCallback) => {
128
+ for (const [mobile, element] of sidebarElements) {
129
+ const previousCallback = sidebarElementCallbacks.get(mobile)
130
+ if (previousCallback === nextCallback) continue
131
+ previousCallback?.(undefined, mobile)
132
+ nextCallback?.(element, mobile)
133
+ sidebarElementCallbacks.set(mobile, nextCallback)
134
+ }
135
135
  }
136
- })
136
+ )
137
137
  const isSidebarMobile = () => {
138
138
  const mountedMode = sidebarElementMobile()
139
139
  if (mountedMode !== undefined) return mountedMode
@@ -142,36 +142,45 @@ export function ApplicationShell(props: ApplicationShellProps) {
142
142
  if (mode === 'desktop') return false
143
143
  return sidebarMobile()
144
144
  }
145
- const restoreSidebarFocus = (sidebar: HTMLElement | undefined) => {
145
+ const restoreSidebarFocus = (
146
+ sidebar: HTMLElement | undefined,
147
+ current: ContextualSidebarProps | undefined
148
+ ) => {
146
149
  const active = sidebar?.ownerDocument.activeElement
147
150
  if (
148
- !sidebarProps() ||
151
+ !current ||
149
152
  sidebar?.dataset.open !== 'true' ||
150
153
  !sidebar.isConnected ||
151
154
  !active ||
152
155
  !sidebar.contains(active)
153
156
  )
154
157
  return
155
- const restoreFocusRef = sidebarProps()?.restoreFocusRef
158
+ const restoreFocusRef = current.restoreFocusRef
156
159
  const target = restoreFocusRef ? restoreFocusRef() : sidebarToggle
157
160
  if (target?.isConnected) target.focus({ preventScroll: true })
158
161
  }
162
+ // A forced switch to mobile hides the desktop sidebar, so focus inside it goes back to the
163
+ // toggle first. This runs in the render phase, before the desktop sidebar is hidden; a user
164
+ // effect would run after it, when the focused element has already left the page.
159
165
  let requestedModeInitialized = false
160
166
  let previousRequestedMode: ReturnType<typeof getSidebarResponsiveMode>
161
- createComputed(() => {
162
- const next = getSidebarResponsiveMode(sidebarProps())
163
- const shouldRestore =
164
- requestedModeInitialized && next === 'mobile' && previousRequestedMode !== 'mobile'
165
- previousRequestedMode = next
166
- requestedModeInitialized = true
167
- if (shouldRestore) untrack(() => restoreSidebarFocus(sidebarElements.get(false)))
168
- })
167
+ createRenderEffect(
168
+ () => sidebarProps(),
169
+ (current) => {
170
+ const next = getSidebarResponsiveMode(current)
171
+ const shouldRestore =
172
+ requestedModeInitialized && next === 'mobile' && previousRequestedMode !== 'mobile'
173
+ previousRequestedMode = next
174
+ requestedModeInitialized = true
175
+ if (shouldRestore) restoreSidebarFocus(sidebarElements.get(false), current)
176
+ }
177
+ )
169
178
  const handleSidebarModeTransition: NonNullable<
170
179
  ContextualSidebarProps['onResponsiveModeTransition']
171
180
  > = (event) => {
172
181
  sidebarProps()?.onResponsiveModeTransition?.(event)
173
182
  if (event.phase === 'before' && event.from === 'desktop' && event.to === 'mobile')
174
- restoreSidebarFocus(event.desktopSidebar)
183
+ restoreSidebarFocus(event.desktopSidebar, sidebarProps())
175
184
  }
176
185
  const handleSidebarElement: NonNullable<ContextualSidebarProps['onSidebarElement']> = (
177
186
  element,
@@ -196,8 +205,8 @@ export function ApplicationShell(props: ApplicationShellProps) {
196
205
  // The drawer mounts (and its chunk loads) the first time the window is narrow, and
197
206
  // stays mounted after that so its close animation and focus return keep working.
198
207
  const [drawerMounted, setDrawerMounted] = createSignal(false)
199
- createEffect(() => {
200
- if (narrow()) setDrawerMounted(true)
208
+ createEffect(narrow, (isNarrow) => {
209
+ if (isNarrow) setDrawerMounted(true)
201
210
  else setDrawerOpen(false)
202
211
  })
203
212
  const leading = () => sidebarProps() ?? props.pane
@@ -240,13 +249,13 @@ export function ApplicationShell(props: ApplicationShellProps) {
240
249
  event.preventDefault()
241
250
  if (!event.repeat) props.onSearch()
242
251
  }
243
- onMount(() => {
252
+ onSettled(() => {
244
253
  window.addEventListener('keydown', handleSearch)
245
254
  window.addEventListener('keydown', handleToggle)
246
- onCleanup(() => {
255
+ return () => {
247
256
  window.removeEventListener('keydown', handleSearch)
248
257
  window.removeEventListener('keydown', handleToggle)
249
- })
258
+ }
250
259
  })
251
260
  // The rail slot resolves once, and only while the rail shows: reading a JSX prop in both a
252
261
  // `when` and the body would build the app's rail twice.
@@ -265,7 +274,7 @@ export function ApplicationShell(props: ApplicationShellProps) {
265
274
  label={item.label}
266
275
  aria-label={item.label}
267
276
  active={props.activeDestination === item.id}
268
- aria-pressed={props.activeDestination === item.id}
277
+ aria-pressed={props.activeDestination === item.id ? 'true' : 'false'}
269
278
  onClick={() => props.onNavigate(item.id)}
270
279
  >
271
280
  {item.icon}
@@ -304,7 +313,7 @@ export function ApplicationShell(props: ApplicationShellProps) {
304
313
  variant="toolbar"
305
314
  tooltip={toggleLabel()}
306
315
  aria-label={toggleLabel()}
307
- aria-expanded={expanded()}
316
+ aria-expanded={expanded() ? 'true' : 'false'}
308
317
  aria-controls={narrow() || sidebarProps() ? undefined : props.pane?.id}
309
318
  onClick={toggle}
310
319
  >
@@ -380,7 +389,7 @@ export function ApplicationShell(props: ApplicationShellProps) {
380
389
  </AppShell>
381
390
  <Show when={drawerMounted() && props.drawer}>
382
391
  {(drawer) => (
383
- <Suspense>
392
+ <Loading>
384
393
  <NavigationDrawer
385
394
  name={props.name}
386
395
  open={narrow() && drawerOpen()}
@@ -389,7 +398,7 @@ export function ApplicationShell(props: ApplicationShellProps) {
389
398
  >
390
399
  {drawer()(() => setDrawerOpen(false))}
391
400
  </NavigationDrawer>
392
- </Suspense>
401
+ </Loading>
393
402
  )}
394
403
  </Show>
395
404
  </div>
@@ -5,19 +5,9 @@ import {
5
5
  } from '@adea-ai/ui/components/composites/account-menu'
6
6
  import type { UpdateAdapter, UpdateState } from '@adea-ai/ui/components/composites/update-dialog'
7
7
  import { ThemeProvider, type ThemeProviderProps } from '@adea-ai/ui/components/theme/lazy'
8
- import { Palette } from 'lucide-solid'
9
- import {
10
- createEffect,
11
- createMemo,
12
- createSignal,
13
- lazy,
14
- on,
15
- onCleanup,
16
- onMount,
17
- Show,
18
- Suspense,
19
- type JSX,
20
- } from 'solid-js'
8
+ import { Palette } from '@lucide/solid'
9
+ import { createEffect, createMemo, createSignal, lazy, Loading, onSettled, Show } from 'solid-js'
10
+ import type { JSX } from '@solidjs/web'
21
11
  import { DEFAULT_SETTINGS_KEYSHORTCUTS, type HelpLink, type HelpShortcut } from './help-shortcuts'
22
12
  import { matchesSettingsKeyshortcuts, parseSettingsKeyshortcuts } from './settings-shortcuts'
23
13
  import {
@@ -198,7 +188,15 @@ function placeAppearance(
198
188
  /** Shared account menu and application dialogs. Mount inside ApplicationThemeProvider. */
199
189
  export function ApplicationUtilities(props: ApplicationUtilitiesProps) {
200
190
  type Surface = 'appearance' | 'about' | 'updates' | 'settings' | 'help'
201
- const [dialog, setDialog] = createSignal<Surface>()
191
+ const [dialog, setDialogSignal] = createSignal<Surface>()
192
+ // The open surface as of the last write. Solid 2 shows a write to readers on the next
193
+ // flush, and the controlled-open effect below must act on the surface a handler in the
194
+ // same frame just chose, without re-running whenever it changes.
195
+ let currentDialog: Surface | undefined
196
+ const setDialog = (value: Surface | undefined) => {
197
+ currentDialog = value
198
+ setDialogSignal(() => value)
199
+ }
202
200
  const [mounted, setMounted] = createSignal<ReadonlySet<Surface>>(new Set())
203
201
  const [localSection, setLocalSection] = createSignal<string>()
204
202
  let opener: HTMLElement | undefined
@@ -247,10 +245,11 @@ export function ApplicationUtilities(props: ApplicationUtilitiesProps) {
247
245
  () => props.updater ?? browserUpdateAdapter(props.identity.version)
248
246
  )
249
247
  const markMounted = (value: Surface) => {
250
- if (!mounted().has(value)) setMounted((current) => new Set(current).add(value))
248
+ setMounted((current) => (current.has(value) ? current : new Set(current).add(value)))
251
249
  }
252
250
  const show = (value: Surface | undefined) => {
253
- const wasOpen = settingsOpen()
251
+ const wasOpen =
252
+ props.settings?.open !== undefined ? props.settings.open : currentDialog === 'settings'
254
253
  if (value) markMounted(value)
255
254
  setDialog(value)
256
255
  const isOpen = value === 'settings'
@@ -280,26 +279,25 @@ export function ApplicationUtilities(props: ApplicationUtilitiesProps) {
280
279
  }
281
280
  // A controlled open from the app's own store mounts the dialog it opens.
282
281
  createEffect(
283
- on(
284
- () => props.settings?.open,
285
- (value) => {
286
- if (value === false && dialog() === 'settings') setDialog(undefined)
287
- if (!value || !settingsSections()) return
288
- if (!opener) opener = (document.activeElement as HTMLElement | null) ?? undefined
289
- markMounted('settings')
290
- if (dialog() !== 'settings') setDialog('settings')
291
- }
292
- )
293
- )
294
- props.commands?.(
295
- Object.freeze({
296
- openSettings: (id?: string) => openSettings(id),
297
- openAppearance: () => openAppearance(),
298
- openAbout: () => open('about'),
299
- openHelp: () => open('help'),
300
- openUpdates: () => openUpdates(),
301
- })
282
+ () => ({ open: props.settings?.open, ready: Boolean(settingsSections()) }),
283
+ ({ open: value, ready }) => {
284
+ if (value === false && currentDialog === 'settings') setDialog(undefined)
285
+ if (!value || !ready) return
286
+ if (!opener) opener = (document.activeElement as HTMLElement | null) ?? undefined
287
+ markMounted('settings')
288
+ if (currentDialog !== 'settings') setDialog('settings')
289
+ }
302
290
  )
291
+ const commands: ApplicationCommands = Object.freeze({
292
+ openSettings: (id?: string) => openSettings(id),
293
+ openAppearance: () => openAppearance(),
294
+ openAbout: () => open('about'),
295
+ openHelp: () => open('help'),
296
+ openUpdates: () => openUpdates(),
297
+ })
298
+ // Hand the commands over in an owned scope, so a receiver can register `onCleanup` (to
299
+ // disconnect a native menu channel, say), and again if the app passes a new receiver.
300
+ createMemo(() => props.commands?.(commands))
303
301
  const settingsKeyshortcuts = createMemo(() => {
304
302
  const value = props.accountMenu?.settingsKeyshortcuts ?? DEFAULT_SETTINGS_KEYSHORTCUTS
305
303
  return { value, chords: parseSettingsKeyshortcuts(value) }
@@ -325,14 +323,14 @@ export function ApplicationUtilities(props: ApplicationUtilitiesProps) {
325
323
  const id = settingsSectionFromHash(window.location.hash, sections, defaultSection())
326
324
  if (id) openSettings(id)
327
325
  }
328
- onMount(() => {
326
+ onSettled(() => {
329
327
  onHash()
330
328
  window.addEventListener('keydown', onKeyDown)
331
329
  window.addEventListener('hashchange', onHash)
332
- onCleanup(() => {
330
+ return () => {
333
331
  window.removeEventListener('keydown', onKeyDown)
334
332
  window.removeEventListener('hashchange', onHash)
335
- })
333
+ }
336
334
  })
337
335
  const close = () => show(undefined)
338
336
  // Menu inputs as separate memos: an app that passes `accountMenu` as an inline object (say,
@@ -396,7 +394,7 @@ export function ApplicationUtilities(props: ApplicationUtilitiesProps) {
396
394
  />
397
395
  {/* A dialog loading here must not draw text in the rail under the avatar: the wait is
398
396
  announced to screen readers only, and the dialog appears in place once it loads. */}
399
- <Suspense
397
+ <Loading
400
398
  fallback={
401
399
  dialog() ? (
402
400
  <span class="visually-hidden" role="status">
@@ -468,7 +466,7 @@ export function ApplicationUtilities(props: ApplicationUtilitiesProps) {
468
466
  restoreFocusRef={() => opener}
469
467
  />
470
468
  </Show>
471
- </Suspense>
469
+ </Loading>
472
470
  </>
473
471
  )
474
472
  }