@fungi.computer/tourtois 0.30.4 → 0.30.6

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.
@@ -172,7 +172,10 @@ export function AppWorkbench({ paneLayerRef, phone, teamId, teamName, initialCom
172
172
  }
173
173
  };
174
174
  const reconciledDirectoryRef = useRef(null);
175
+ // The stored-window restore yields to the latest request in this page.
176
+ const focusRequest = useRef(null);
175
177
  const focusWindow = useCallback((id) => {
178
+ focusRequest.current = { windowId: id };
176
179
  focus(id);
177
180
  requestAnimationFrame(() => {
178
181
  // Focus the person moved into an open App dial since this request must
@@ -480,6 +483,7 @@ export function AppWorkbench({ paneLayerRef, phone, teamId, teamName, initialCom
480
483
  phone,
481
484
  onTiledChange: onLayoutChange,
482
485
  focusWindow,
486
+ focusRequest: () => focusRequest.current,
483
487
  onError: setAppStatus,
484
488
  });
485
489
  /** An App that is already open comes forward instead of opening twice. */
package/dist/shell.css CHANGED
@@ -3,14 +3,14 @@
3
3
  @import "./settings-navigation.css";
4
4
  @import "./desktop/arrange.css";
5
5
 
6
- /* SH-1: a 32px desktop menu bar on desktop widths, matching the window
7
- title bar and footer so the three chrome bars read as one system.
8
- chrome.css keeps its documented 48px/40px-mascot base (Caps' own
6
+ /* SH-1: a 32px desktop menu bar, matching the window title bar and footer
7
+ so the three chrome bars read as one system, at every width. chrome.css
8
+ keeps its documented 48px/40px-mascot base (Caps' own
9
9
  `.caps-app-bar-launcher-button` default) for every other caller; this
10
10
  override lives only here, scoped to the Tourtois desktop shell, and never
11
- touches packages/caps. Phone keeps the existing 48px bar and its
12
- touch-target launcher sizing below, untouched. */
13
- @media (min-width: 541px) {
11
+ touches packages/caps. Only a touch-first device (`pointer: coarse`) keeps
12
+ the 48px bar and its 44px launcher; a narrow window is not a phone. */
13
+ @media not (pointer: coarse) {
14
14
  .tourtois-desktop-menu {
15
15
  flex: 0 0 var(--spacing-2xl);
16
16
  height: var(--spacing-2xl);
@@ -692,7 +692,10 @@
692
692
  .tourtois-desktop-menu .tourtois-team-name {
693
693
  display: none;
694
694
  }
695
- /* The running-App menu and mascot each occupy one phone touch slot. */
695
+ }
696
+ /* On a touch-first device the running-App menu and mascot each occupy one
697
+ touch slot. With a mouse they stay in the 32px bar at every width. */
698
+ @media (pointer: coarse) {
696
699
  .tourtois-desktop-menu > .caps-app-bar {
697
700
  min-inline-size: calc(var(--caps-touch-target) + var(--spacing-sm));
698
701
  }
@@ -50,6 +50,30 @@ export declare function restorableLaunches<App extends Readonly<{
50
50
  frame: WindowPlacement;
51
51
  minimized: boolean;
52
52
  }>[];
53
+ /** The workbench's latest focus request in this page, or null for none yet. */
54
+ export type FocusRequest = Readonly<{
55
+ windowId: string;
56
+ }> | null;
57
+ /**
58
+ * Reopen the stored windows one by one and name the window to focus. The
59
+ * restore runs once per page and waits for the stored session, so the person
60
+ * may open or bring forward an App before it starts or while it runs; their
61
+ * latest choice in this page keeps focus over the stored active window.
62
+ */
63
+ export declare function restoreWindows<Launch extends Readonly<{
64
+ windowId: string;
65
+ }>>(launches: readonly Readonly<{
66
+ launch: Launch;
67
+ minimized: boolean;
68
+ }>[], storedActive: string | null, manager: Readonly<{
69
+ read: () => Readonly<{
70
+ windows: readonly Readonly<{
71
+ windowId: string;
72
+ }>[];
73
+ }>;
74
+ open: (launch: Launch) => Promise<void>;
75
+ minimize: (windowId: string) => Promise<void>;
76
+ }>, focusRequest: () => FocusRequest): Promise<string | null>;
53
77
  /** Reads and writes the session through the member's storage layer. */
54
78
  export declare function createWindowSessionStore(storage: AppStorage): {
55
79
  load(): Promise<WindowSession | null>;
@@ -66,6 +90,8 @@ export type WindowSessionInput = Readonly<{
66
90
  phone: boolean;
67
91
  onTiledChange: ((tiled: boolean) => void) | undefined;
68
92
  focusWindow: (windowId: string) => void;
93
+ /** The workbench's latest focus request, mid-restore ones included. */
94
+ focusRequest: () => FocusRequest;
69
95
  /** Shown to the person as a toast; the session is never lost silently. */
70
96
  onError: (message: string) => void;
71
97
  }>;
@@ -57,6 +57,27 @@ export function restorableLaunches(session, apps, launchFor) {
57
57
  : [];
58
58
  });
59
59
  }
60
+ /**
61
+ * Reopen the stored windows one by one and name the window to focus. The
62
+ * restore runs once per page and waits for the stored session, so the person
63
+ * may open or bring forward an App before it starts or while it runs; their
64
+ * latest choice in this page keeps focus over the stored active window.
65
+ */
66
+ export async function restoreWindows(launches, storedActive, manager, focusRequest) {
67
+ const isOpen = (windowId) => manager.read().windows.some((item) => item.windowId === windowId);
68
+ for (const { launch, minimized } of launches) {
69
+ if (isOpen(launch.windowId))
70
+ continue;
71
+ await manager.open(launch);
72
+ if (minimized)
73
+ await manager.minimize(launch.windowId);
74
+ }
75
+ const chosen = focusRequest();
76
+ if (chosen !== null && isOpen(chosen.windowId))
77
+ return chosen.windowId;
78
+ const active = storedActive && windowIdFor(storedActive);
79
+ return active && isOpen(active) ? active : null;
80
+ }
60
81
  /** Reads and writes the session through the member's storage layer. */
61
82
  export function createWindowSessionStore(storage) {
62
83
  let revision = null;
@@ -129,19 +150,9 @@ export function useWindowSession(input) {
129
150
  const launches = restorableLaunches(session, current.apps, current.launchFor);
130
151
  for (const { launch, frame } of launches)
131
152
  seeds.current.set(launch.windowId, frame);
132
- for (const { launch, minimized } of launches) {
133
- if (current.manager
134
- .read()
135
- .windows.some((item) => item.windowId === launch.windowId))
136
- continue;
137
- await current.manager.open(launch);
138
- if (minimized)
139
- await current.manager.minimize(launch.windowId);
140
- }
141
- const active = session.active && windowIdFor(session.active);
142
- if (active &&
143
- current.manager.read().windows.some((w) => w.windowId === active))
144
- latest.current.focusWindow(active);
153
+ const focused = await restoreWindows(launches, session.active, current.manager, current.focusRequest);
154
+ if (focused)
155
+ latest.current.focusWindow(focused);
145
156
  }
146
157
  catch (cause) {
147
158
  console.error("Open windows could not be restored", cause);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fungi.computer/tourtois",
3
- "version": "0.30.4",
3
+ "version": "0.30.6",
4
4
  "author": "Levi <levi@technomancy.dev>",
5
5
  "description": "Tourtois: the trusted desktop shell for Oyster and Fungi, with host-supplied Settings sections",
6
6
  "type": "module",
@@ -83,9 +83,9 @@
83
83
  "@fungi.computer/ear-tag": "0.1.0",
84
84
  "@fungi.computer/gills": "0.4.0",
85
85
  "@fungi.computer/maosaico": "0.1.2",
86
- "@fungi.computer/parakeet": "0.16.6",
86
+ "@fungi.computer/parakeet": "0.16.7",
87
87
  "@fungi.computer/puffball": "0.13.0",
88
- "@fungi.computer/shiitake": "0.21.14",
88
+ "@fungi.computer/shiitake": "0.21.15",
89
89
  "@fungi.computer/sigils": "0.3.2",
90
90
  "@fungi.computer/sprite": "0.2.2",
91
91
  "@fungi.computer/sprite-zdog": "0.3.2",
@@ -106,7 +106,7 @@
106
106
  "react": "^18.3.1 || ^19.2.0"
107
107
  },
108
108
  "devDependencies": {
109
- "@fungi.computer/oyster": "0.51.0",
109
+ "@fungi.computer/oyster": "0.52.1",
110
110
  "@cloudflare/workers-types": "5.20260828.1",
111
111
  "@fungi.computer/forage": "0.4.0",
112
112
  "@fungi.computer/mycelium": "0.4.8",