@adea-ai/app-framework 0.46.12 → 0.47.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 (46) hide show
  1. package/README.md +1 -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/package.json +14 -13
  31. package/src/app/application.tsx +28 -32
  32. package/src/appearance/appearance-host.tsx +30 -19
  33. package/src/appearance/editor.ts +25 -3
  34. package/src/shell/app-shell.tsx +46 -37
  35. package/src/shell/app-utilities.tsx +38 -40
  36. package/src/shell/media-query.ts +15 -10
  37. package/src/shell/navigation-drawer.tsx +1 -1
  38. package/src/shell/poll.ts +9 -10
  39. package/src/shell/settings-sections.ts +1 -1
  40. package/src/views/app-appearance.tsx +4 -3
  41. package/src/views/app-settings.tsx +2 -1
  42. package/src/views/appearance-surface.tsx +46 -35
  43. package/templates/application/AGENTS.md +29 -0
  44. package/templates/application/src/web/main.tsx +2 -2
  45. package/templates/application/tsconfig.json +1 -1
  46. package/templates/application/vite.config.ts +1 -1
@@ -5,13 +5,13 @@ import { hasEditableKeyboardTarget } from "./keyboard-target.js";
5
5
  import { browserUpdateAdapter } from "../updates/update-adapter.js";
6
6
  import { DEFAULT_NARROW_QUERY, createMediaQuery } from "./media-query.js";
7
7
  import { createPoll } from "./poll.js";
8
- import { createComponent, memo, mergeProps, template } from "solid-js/web";
9
- import { Show, Suspense, createEffect, createMemo, createSignal, lazy, on, onCleanup, onMount } from "solid-js";
10
- import { Palette } from "lucide-solid";
8
+ import { createComponent, memo, mergeProps, template } from "@solidjs/web";
9
+ import { Loading, Show, createEffect, createMemo, createSignal, lazy, onSettled } from "solid-js";
10
+ import { Palette } from "@lucide/solid";
11
11
  import { AccountMenu, createAppMenuItems } from "@adea-ai/ui/components/composites/account-menu";
12
12
  import { ThemeProvider } from "@adea-ai/ui/components/theme/lazy";
13
13
  // src/shell/app-utilities.tsx
14
- var _tmpl$ = /*#__PURE__*/ template(`<span class=visually-hidden role=status>Loading`);
14
+ var _tmpl$ = /* @__PURE__ */ template(`<span class=visually-hidden role=status>Loading`);
15
15
  var AppearancePanel = lazy(() => import("@adea-ai/ui/components/theme").then((module) => ({ default: module.AppearancePanel })));
16
16
  var ApplicationAppearance = lazy(() => import("../views/app-appearance.js").then((module) => ({ default: module.ApplicationAppearance })));
17
17
  var ApplicationAbout = lazy(() => import("../views/app-about.js").then((module) => ({ default: module.ApplicationAbout })));
@@ -35,7 +35,12 @@ function placeAppearance(sections, appearance, position) {
35
35
  }
36
36
  /** Shared account menu and application dialogs. Mount inside ApplicationThemeProvider. */
37
37
  function ApplicationUtilities(props) {
38
- const [dialog, setDialog] = createSignal();
38
+ const [dialog, setDialogSignal] = createSignal();
39
+ let currentDialog;
40
+ const setDialog = (value) => {
41
+ currentDialog = value;
42
+ setDialogSignal(() => value);
43
+ };
39
44
  const [mounted, setMounted] = createSignal(/* @__PURE__ */ new Set());
40
45
  const [localSection, setLocalSection] = createSignal();
41
46
  let opener;
@@ -74,10 +79,10 @@ function ApplicationUtilities(props) {
74
79
  const updatesAlways = createMemo(() => props.accountMenu?.updates === "always");
75
80
  const updateAdapter = createMemo(() => props.updater ?? browserUpdateAdapter(props.identity.version));
76
81
  const markMounted = (value) => {
77
- if (!mounted().has(value)) setMounted((current) => new Set(current).add(value));
82
+ setMounted((current) => current.has(value) ? current : new Set(current).add(value));
78
83
  };
79
84
  const show = (value) => {
80
- const wasOpen = settingsOpen();
85
+ const wasOpen = props.settings?.open !== void 0 ? props.settings.open : currentDialog === "settings";
81
86
  if (value) markMounted(value);
82
87
  setDialog(value);
83
88
  const isOpen = value === "settings";
@@ -105,20 +110,24 @@ function ApplicationUtilities(props) {
105
110
  if (props.onUpdates) props.onUpdates(target);
106
111
  else open("updates", target);
107
112
  };
108
- createEffect(on(() => props.settings?.open, (value) => {
109
- if (value === false && dialog() === "settings") setDialog(void 0);
110
- if (!value || !settingsSections()) return;
113
+ createEffect(() => ({
114
+ open: props.settings?.open,
115
+ ready: Boolean(settingsSections())
116
+ }), ({ open: value, ready }) => {
117
+ if (value === false && currentDialog === "settings") setDialog(void 0);
118
+ if (!value || !ready) return;
111
119
  if (!opener) opener = document.activeElement ?? void 0;
112
120
  markMounted("settings");
113
- if (dialog() !== "settings") setDialog("settings");
114
- }));
115
- props.commands?.(Object.freeze({
121
+ if (currentDialog !== "settings") setDialog("settings");
122
+ });
123
+ const commands = Object.freeze({
116
124
  openSettings: (id) => openSettings(id),
117
125
  openAppearance: () => openAppearance(),
118
126
  openAbout: () => open("about"),
119
127
  openHelp: () => open("help"),
120
128
  openUpdates: () => openUpdates()
121
- }));
129
+ });
130
+ createMemo(() => props.commands?.(commands));
122
131
  const settingsKeyshortcuts = createMemo(() => {
123
132
  const value = props.accountMenu?.settingsKeyshortcuts ?? "Meta+, Control+,";
124
133
  return {
@@ -138,14 +147,14 @@ function ApplicationUtilities(props) {
138
147
  const id = settingsSectionFromHash(window.location.hash, sections, defaultSection());
139
148
  if (id) openSettings(id);
140
149
  };
141
- onMount(() => {
150
+ onSettled(() => {
142
151
  onHash();
143
152
  window.addEventListener("keydown", onKeyDown);
144
153
  window.addEventListener("hashchange", onHash);
145
- onCleanup(() => {
154
+ return () => {
146
155
  window.removeEventListener("keydown", onKeyDown);
147
156
  window.removeEventListener("hashchange", onHash);
148
- });
157
+ };
149
158
  });
150
159
  const close = () => show(void 0);
151
160
  const menuSettingsShortcut = createMemo(() => props.accountMenu?.settingsShortcut);
@@ -220,9 +229,11 @@ function ApplicationUtilities(props) {
220
229
  placement: "right-end",
221
230
  gutter: 4,
222
231
  hideArrow: true
223
- }), createComponent(Suspense, {
232
+ }), createComponent(Loading, {
224
233
  get fallback() {
225
- return memo(() => !!dialog())() ? _tmpl$() : null;
234
+ return memo(() => {
235
+ return !!dialog();
236
+ })() ? _tmpl$() : null;
226
237
  },
227
238
  get children() {
228
239
  return [
@@ -245,7 +256,9 @@ function ApplicationUtilities(props) {
245
256
  }),
246
257
  createComponent(Show, {
247
258
  get when() {
248
- return memo(() => !!mounted().has("settings"))() && settingsSections();
259
+ return memo(() => {
260
+ return !!mounted().has("settings");
261
+ })() ? settingsSections() : mounted().has("settings");
249
262
  },
250
263
  children: (sections) => createComponent(ApplicationSettings, {
251
264
  get open() {
@@ -267,7 +280,9 @@ function ApplicationUtilities(props) {
267
280
  }),
268
281
  createComponent(Show, {
269
282
  get when() {
270
- return memo(() => !!mounted().has("help"))() && props.help;
283
+ return memo(() => {
284
+ return !!mounted().has("help");
285
+ })() ? props.help : mounted().has("help");
271
286
  },
272
287
  children: (help) => createComponent(ApplicationHelp, {
273
288
  get open() {
@@ -323,7 +338,9 @@ function ApplicationUtilities(props) {
323
338
  }),
324
339
  createComponent(Show, {
325
340
  get when() {
326
- return memo(() => !!mounted().has("updates"))() && (props.updater || updatesAlways());
341
+ return memo(() => {
342
+ return !!mounted().has("updates");
343
+ })() ? props.updater || updatesAlways() : mounted().has("updates");
327
344
  },
328
345
  get children() {
329
346
  return createComponent(UpdateSurface, {
@@ -334,7 +351,9 @@ function ApplicationUtilities(props) {
334
351
  return props.identity;
335
352
  },
336
353
  get channel() {
337
- return memo(() => !!props.updater)() ? props.channel : void 0;
354
+ return memo(() => {
355
+ return !!props.updater;
356
+ })() ? props.channel : void 0;
338
357
  },
339
358
  get onUpdateState() {
340
359
  return props.onUpdateState;
@@ -1,10 +1,10 @@
1
- import { createComputed, createSignal, onCleanup } from "solid-js";
1
+ import { createEffect, createSignal } from "solid-js";
2
2
  // src/shell/media-query.ts
3
3
  /** When the application shell counts a window as narrow. */
4
4
  var DEFAULT_NARROW_QUERY = "(max-width: 799px)";
5
5
  var shared = /* @__PURE__ */ new Map();
6
6
  var supported = () => typeof window !== "undefined" && typeof window.matchMedia === "function";
7
- function subscribe(query, subscriber) {
7
+ function entryFor(query) {
8
8
  let entry = shared.get(query);
9
9
  if (!entry) {
10
10
  const list = window.matchMedia(query);
@@ -20,7 +20,10 @@ function subscribe(query, subscriber) {
20
20
  };
21
21
  shared.set(query, entry);
22
22
  }
23
- const current = entry;
23
+ return entry;
24
+ }
25
+ function subscribe(query, subscriber) {
26
+ const current = entryFor(query);
24
27
  current.subscribers.add(subscriber);
25
28
  subscriber(current.list.matches);
26
29
  return () => {
@@ -38,14 +41,13 @@ function subscribe(query, subscriber) {
38
41
  */
39
42
  function createMediaQuery(query) {
40
43
  const text = typeof query === "function" ? query : () => query;
41
- const [matches, setMatches] = createSignal(false);
42
- createComputed(() => {
44
+ const [matches, setMatches] = createSignal(() => {
43
45
  const value = text();
44
- if (!value || !supported()) {
45
- setMatches(false);
46
- return;
47
- }
48
- onCleanup(subscribe(value, setMatches));
46
+ return Boolean(value) && supported() && entryFor(value).list.matches;
47
+ });
48
+ createEffect(text, (value) => {
49
+ if (!value || !supported()) return;
50
+ return subscribe(value, setMatches);
49
51
  });
50
52
  return matches;
51
53
  }
@@ -1,4 +1,4 @@
1
- import type { JSX } from 'solid-js';
1
+ import type { JSX } from '@solidjs/web';
2
2
  /**
3
3
  * The narrow-window navigation drawer. The shell loads it the first time the window is
4
4
  * narrow, so wide windows never fetch the dialog primitives behind the sheet.
@@ -1,4 +1,4 @@
1
- import { createComponent, memo } from "solid-js/web";
1
+ import { createComponent, memo } from "@solidjs/web";
2
2
  import { Sheet, SheetContent, SheetHeader, SheetTitle } from "@adea-ai/ui/components/ui/sheet";
3
3
  // src/shell/navigation-drawer.tsx
4
4
  /**
@@ -18,7 +18,7 @@ function NavigationDrawer(props) {
18
18
  "data-mobile": "true",
19
19
  side: "start",
20
20
  closeButton: false,
21
- "class": "w-72 max-w-full",
21
+ class: "w-72 max-w-full",
22
22
  onCloseAutoFocus: (event) => {
23
23
  const target = props.restoreFocus();
24
24
  if (!target) return;
@@ -27,13 +27,15 @@ function NavigationDrawer(props) {
27
27
  },
28
28
  get children() {
29
29
  return [createComponent(SheetHeader, {
30
- "class": "sr-only",
30
+ class: "sr-only",
31
31
  get children() {
32
32
  return createComponent(SheetTitle, { get children() {
33
33
  return `${props.name} navigation`;
34
34
  } });
35
35
  }
36
- }), memo(() => props.children)];
36
+ }), memo(() => {
37
+ return props.children;
38
+ })];
37
39
  }
38
40
  });
39
41
  }
@@ -1,4 +1,4 @@
1
- import { createEffect, getOwner, onCleanup, untrack } from "solid-js";
1
+ import { createEffect, getOwner, onSettled } from "solid-js";
2
2
  // src/shell/poll.ts
3
3
  var hidden = () => typeof document !== "undefined" && document.visibilityState === "hidden";
4
4
  /**
@@ -65,16 +65,14 @@ function createPoll(options) {
65
65
  running = false;
66
66
  if (typeof document !== "undefined") document.removeEventListener("visibilitychange", onVisibility);
67
67
  };
68
- if (options.enabled) {
69
- const enabled = options.enabled;
70
- createEffect(() => {
71
- if (!enabled()) return;
72
- untrack(start);
73
- onCleanup(stop);
74
- });
75
- } else if (getOwner()) createEffect(() => {
76
- untrack(start);
77
- onCleanup(stop);
68
+ if (options.enabled) createEffect(options.enabled, (enabled) => {
69
+ if (!enabled) return;
70
+ start();
71
+ return stop;
72
+ });
73
+ else if (getOwner()) onSettled(() => {
74
+ start();
75
+ return stop;
78
76
  });
79
77
  else start();
80
78
  return {
@@ -1,4 +1,4 @@
1
- import type { JSX } from 'solid-js';
1
+ import type { JSX } from '@solidjs/web';
2
2
  /** One settings destination. The framework owns layout and navigation; the app owns the panel. */
3
3
  export type ApplicationSettingsSection = Readonly<{
4
4
  id: string;
@@ -19,4 +19,4 @@ export type ApplicationAboutProps = {
19
19
  restoreFocusRef?: Accessor<HTMLElement | undefined>;
20
20
  };
21
21
  /** The shared About dialog, usable without `ApplicationUtilities`. Load it lazily. */
22
- export declare function ApplicationAbout(props: ApplicationAboutProps): import("solid-js").JSX.Element;
22
+ export declare function ApplicationAbout(props: ApplicationAboutProps): import("@solidjs/web").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { createComponent } from "solid-js/web";
1
+ import { createComponent } from "@solidjs/web";
2
2
  import { AboutDialog } from "@adea-ai/ui/components/composites/about-dialog";
3
3
  // src/views/app-about.tsx
4
4
  /** The shared About dialog, usable without `ApplicationUtilities`. Load it lazily. */
@@ -1,4 +1,5 @@
1
- import { type Accessor, type JSX } from 'solid-js';
1
+ import { type Accessor } from 'solid-js';
2
+ import type { JSX } from '@solidjs/web';
2
3
  export type ApplicationAppearanceProps = {
3
4
  open: boolean;
4
5
  onClose(): void;
@@ -1,8 +1,8 @@
1
- import { createComponent, template } from "solid-js/web";
2
- import { Show, Suspense, lazy } from "solid-js";
1
+ import { createComponent, template } from "@solidjs/web";
2
+ import { Loading, Show, lazy } from "solid-js";
3
3
  import { ModalDialog } from "@adea-ai/ui/components/ui/modal-dialog";
4
4
  // src/views/app-appearance.tsx
5
- var _tmpl$ = /*#__PURE__*/ template(`<span role=status>Loading appearance…`);
5
+ var _tmpl$ = /* @__PURE__ */ template(`<span role=status>Loading appearance…`);
6
6
  var AppearancePanel = lazy(() => import("@adea-ai/ui/components/theme").then((module) => ({ default: module.AppearancePanel })));
7
7
  /** The shared Appearance dialog, usable without `ApplicationUtilities`. Load it lazily. */
8
8
  function ApplicationAppearance(props) {
@@ -21,7 +21,7 @@ function ApplicationAppearance(props) {
21
21
  return props.restoreFocusRef;
22
22
  },
23
23
  get children() {
24
- return createComponent(Suspense, {
24
+ return createComponent(Loading, {
25
25
  get fallback() {
26
26
  return _tmpl$();
27
27
  },
@@ -14,4 +14,4 @@ export type ApplicationHelpProps = {
14
14
  restoreFocusRef?: Accessor<HTMLElement | undefined>;
15
15
  };
16
16
  /** The shared Help Center dialog: the app's real shortcuts and project resources. */
17
- export declare function ApplicationHelp(props: ApplicationHelpProps): import("solid-js").JSX.Element;
17
+ export declare function ApplicationHelp(props: ApplicationHelpProps): import("@solidjs/web").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import { standardShortcuts } from "../shell/help-shortcuts.js";
2
- import { createComponent } from "solid-js/web";
2
+ import { createComponent } from "@solidjs/web";
3
3
  import { ModalDialog } from "@adea-ai/ui/components/ui/modal-dialog";
4
4
  import { HelpCenter } from "@adea-ai/ui/components/composites/help-center";
5
5
  // src/views/app-help.tsx
@@ -1,4 +1,5 @@
1
- import { type Accessor, type JSX } from 'solid-js';
1
+ import { type Accessor } from 'solid-js';
2
+ import type { JSX } from '@solidjs/web';
2
3
  import { type ApplicationSettingsSection } from '../shell/settings-sections';
3
4
  export * from '../shell/settings-sections';
4
5
  export type ApplicationSettingsProps = {
@@ -1,12 +1,12 @@
1
1
  import { defineSettingsSections, isSettingsHash, settingsGroups, settingsHash, settingsSectionFromHash } from "../shell/settings-sections.js";
2
- import { createComponent, insert, memo, template } from "solid-js/web";
2
+ import { createComponent, insert, memo, template } from "@solidjs/web";
3
3
  import { For, Show, createMemo, untrack } from "solid-js";
4
4
  import { ModalDialog } from "@adea-ai/ui/components/ui/modal-dialog";
5
5
  import { SettingsLayout } from "@adea-ai/ui/components/composites/settings";
6
6
  import { TabsContent } from "@adea-ai/ui/components/ui/tabs";
7
7
  import { Text } from "@adea-ai/ui/components/ui/typography";
8
8
  // src/views/app-settings.tsx
9
- var _tmpl$ = /*#__PURE__*/ template(`<div class="flex min-w-0 flex-col gap-4">`);
9
+ var _tmpl$ = /* @__PURE__ */ template(`<div class="flex min-w-0 flex-col gap-4"><!><!>`);
10
10
  /**
11
11
  * Grouped settings navigation beside the selected app-owned panel, for an app that shows
12
12
  * settings as a page. `ApplicationSettings` shows the same panel in a dialog.
@@ -25,12 +25,13 @@ function ApplicationSettingsPanel(props) {
25
25
  return createComponent(TabsContent, {
26
26
  value: id,
27
27
  get children() {
28
- return createComponent(Show, {
29
- get when() {
28
+ return memo(() => {
29
+ return memo(() => {
30
30
  return active()?.id === id;
31
- },
32
- get children() {
31
+ })() ? (() => {
33
32
  var _el$ = _tmpl$();
33
+ var _el$2 = _el$.firstChild;
34
+ var _el$3 = _el$2.nextSibling;
34
35
  insert(_el$, createComponent(Show, {
35
36
  get when() {
36
37
  return section()?.description;
@@ -41,10 +42,12 @@ function ApplicationSettingsPanel(props) {
41
42
  return description();
42
43
  }
43
44
  })
44
- }), null);
45
- insert(_el$, () => untrack(() => section()?.render()), null);
45
+ }), _el$2);
46
+ insert(_el$, () => {
47
+ return untrack(() => section()?.render());
48
+ }, _el$3);
46
49
  return _el$;
47
- }
50
+ })() : void 0;
48
51
  });
49
52
  }
50
53
  });
@@ -62,7 +65,9 @@ function ApplicationSettingsPanel(props) {
62
65
  return props.onSectionChange;
63
66
  },
64
67
  get children() {
65
- return memo(() => !!props.wrap)() ? props.wrap(panels()) : panels();
68
+ return memo(() => {
69
+ return !!props.wrap;
70
+ })() ? props.wrap(panels()) : panels();
66
71
  }
67
72
  });
68
73
  }
@@ -1,5 +1,5 @@
1
1
  import { type AppearanceEditorTab } from '@adea-ai/ui/components/composites/appearance-editor';
2
- import { type JSX } from 'solid-js';
2
+ import type { JSX } from '@solidjs/web';
3
3
  export type AppearanceControlTab = AppearanceEditorTab;
4
4
  type AppearanceControlProps = {
5
5
  open: boolean;