@fungi.computer/tourtois 0.13.4 → 0.14.1

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/AppPane.d.ts CHANGED
@@ -8,7 +8,7 @@ export declare function FocusedWindowControls({ app, onOpenSettings, onOpenPermi
8
8
  onOpenPermissions: () => void;
9
9
  projection: AppWindowProjection;
10
10
  }): import("react/jsx-runtime").JSX.Element | null;
11
- export declare function AppPane({ projection, nextLaunch, icon, manager, onError, index, focusWindow, afterHide, onBack, onSelectComputer, onChooseComputer, }: {
11
+ export declare function AppPane({ projection, nextLaunch, icon, manager, onError, index, focusWindow, afterHide, onBack, onForward, onSelectComputer, onChooseComputer, }: {
12
12
  projection: AppWindowProjection;
13
13
  nextLaunch?: AppLaunchDescriptor | null;
14
14
  icon: string | null | undefined;
@@ -18,6 +18,7 @@ export declare function AppPane({ projection, nextLaunch, icon, manager, onError
18
18
  focusWindow: (id: string) => void;
19
19
  afterHide: (id: string) => void;
20
20
  onBack: (id: string) => void;
21
+ onForward: (id: string) => void;
21
22
  /** The person chose another of this window's offered Computers. */
22
23
  onSelectComputer: (windowId: string, computerId: string) => void;
23
24
  /** No Computer is granted: open the App's permissions to grant one. */
package/dist/AppPane.js CHANGED
@@ -15,7 +15,7 @@ import { AppError, } from "@fungi.computer/agar";
15
15
  import { useEffect, useRef, useState } from "react";
16
16
  import { AppIcon } from "./app-icon.js";
17
17
  import { useWindowMotion } from "./use-window-motion.js";
18
- import { backHint } from "./shell-commands.js";
18
+ import { backHint, forwardHint } from "./shell-commands.js";
19
19
  import { createAppWindowManager, } from "./app-windows.js";
20
20
  import { useDismissOverlays } from "./layers.js";
21
21
  import { launchComputerId } from "./app-launch.js";
@@ -121,7 +121,29 @@ function AppWindowControls({ phone, navigation, onAction, popover, ...actions })
121
121
  onAction({ kind: "action", actionId: command.id });
122
122
  }, children: command.label }, command.id))), actions.onPromote ? (_jsx(DropdownMenuItem, { onSelect: actions.onPromote, children: "Make main window" })) : null, _jsx(DropdownMenuItem, { onSelect: actions.onToggleMaximize, children: actions.maximized ? "Restore window" : "Maximize window" }), _jsx(DropdownMenuItem, { onSelect: actions.onMinimize, children: "Minimize window" }), _jsx(DropdownMenuItem, { variant: "destructive", onSelect: actions.onClose, children: "Close window" })] })] }));
123
123
  }
124
- export function AppPane({ projection, nextLaunch, icon, manager, onError, index, focusWindow, afterHide, onBack, onSelectComputer, onChooseComputer, }) {
124
+ /**
125
+ * Back and Forward for an App that publishes navigation, disabled while it
126
+ * cannot move, so the title keeps its place; none for one that never does.
127
+ */
128
+ function historyProps(navigation, title, onBack, onForward) {
129
+ if (navigation === null)
130
+ return {};
131
+ return {
132
+ back: {
133
+ label: `Back in ${title}`,
134
+ hint: backHint(),
135
+ disabled: !navigation.canGoBack,
136
+ onBack,
137
+ },
138
+ forward: {
139
+ label: `Forward in ${title}`,
140
+ hint: forwardHint(),
141
+ disabled: !navigation.canGoForward,
142
+ onForward,
143
+ },
144
+ };
145
+ }
146
+ export function AppPane({ projection, nextLaunch, icon, manager, onError, index, focusWindow, afterHide, onBack, onForward, onSelectComputer, onChooseComputer, }) {
125
147
  const phone = usePhone();
126
148
  const containerRef = useRef(null);
127
149
  const popover = useLayer("popover");
@@ -190,13 +212,18 @@ export function AppPane({ projection, nextLaunch, icon, manager, onError, index,
190
212
  }, onPointerDownCapture: () => {
191
213
  binding.focus();
192
214
  },
193
- // The mouse back button over this window's chrome is its App's Back;
194
- // inside the App, Agar maps it the same way.
215
+ // The mouse back and forward buttons over this window's chrome are its
216
+ // App's Back and Forward; inside the App, Agar maps them the same way.
195
217
  onMouseUp: (event) => {
196
- if (event.button !== 3 || projection.navigation?.canGoBack !== true)
197
- return;
198
- event.preventDefault();
199
- onBack(projection.windowId);
218
+ if (event.button === 3 && projection.navigation?.canGoBack === true) {
219
+ event.preventDefault();
220
+ onBack(projection.windowId);
221
+ }
222
+ else if (event.button === 4 &&
223
+ projection.navigation?.canGoForward === true) {
224
+ event.preventDefault();
225
+ onForward(projection.windowId);
226
+ }
200
227
  }, style: binding.stackingStyle, children: [_jsx(WindowHeader, { title: projection.launch.title, "data-phone-compact": phone || undefined, ...(projection.navigation?.title === undefined
201
228
  ? {}
202
229
  : { subtitle: projection.navigation.title }), ...headerContent(projection.navigation, popover, (activation) => {
@@ -206,17 +233,11 @@ export function AppPane({ projection, nextLaunch, icon, manager, onError, index,
206
233
  console.error("App workbench operation failed", cause);
207
234
  onError("App could not handle that action.");
208
235
  });
209
- }, phone), density: layout.mode === "tiled" ? "compact" : "regular", icon: _jsx(AppIcon, { roles: projection.launch.roles, icon: icon }), ...(projection.navigation?.canGoBack === true
210
- ? {
211
- back: {
212
- label: `Back in ${projection.launch.title}`,
213
- hint: backHint(),
214
- onBack: () => {
215
- onBack(projection.windowId);
216
- },
217
- },
218
- }
219
- : {}), handleProps: {
236
+ }, phone), density: layout.mode === "tiled" ? "compact" : "regular", icon: _jsx(AppIcon, { roles: projection.launch.roles, icon: icon }), ...historyProps(projection.navigation, projection.launch.title, () => {
237
+ onBack(projection.windowId);
238
+ }, () => {
239
+ onForward(projection.windowId);
240
+ }), handleProps: {
220
241
  ...binding.props,
221
242
  onClick: binding.focus,
222
243
  onDoubleClick: zoom,
@@ -202,6 +202,11 @@ export function AppWorkbench({ paneLayerRef, phone, teamId, teamName, initialCom
202
202
  console.error("App workbench operation failed", cause);
203
203
  });
204
204
  };
205
+ const goForward = (windowId) => {
206
+ void appWindows.forward(windowId).catch((cause) => {
207
+ console.error("App workbench operation failed", cause);
208
+ });
209
+ };
205
210
  // The shell's window keys run through Whistle so /keys, the `:` line and
206
211
  // which-key list them; these are the behaviors behind those commands.
207
212
  const stepTarget = (step) => order.length < 2
@@ -280,6 +285,10 @@ export function AppWorkbench({ paneLayerRef, phone, teamId, teamName, initialCom
280
285
  if (activeId)
281
286
  goBack(activeId);
282
287
  },
288
+ forward: () => {
289
+ if (activeId)
290
+ goForward(activeId);
291
+ },
283
292
  });
284
293
  useEffect(() => {
285
294
  appSurfaceHost?.focus?.(activeSurfaceId);
@@ -606,7 +615,7 @@ export function AppWorkbench({ paneLayerRef, phone, teamId, teamName, initialCom
606
615
  void appsQuery.refetch();
607
616
  } }) }), _jsxs(MaosaicoRegion, { layer: "windows", style: { height: "100%", pointerEvents: "none" }, ref: paneLayerRef, className: "tourtois-pane-layer", "data-layout-mode": mode, children: [appProjection.windows.map((projection, index) => {
608
617
  const app = directory.find((item) => item.surfaceId === projection.launch.surfaceId);
609
- return (_jsx(AppPane, { index: index, focusWindow: focusWindow, afterHide: afterHide, onBack: goBack, manager: appWindows, projection: projection, nextLaunch: app ? launchFor(app, projection.launch) : null, icon: app?.icon, onError: setAppStatus, onSelectComputer: (windowId, computerId) => {
618
+ return (_jsx(AppPane, { index: index, focusWindow: focusWindow, afterHide: afterHide, onBack: goBack, onForward: goForward, manager: appWindows, projection: projection, nextLaunch: app ? launchFor(app, projection.launch) : null, icon: app?.icon, onError: setAppStatus, onSelectComputer: (windowId, computerId) => {
610
619
  void selectWindowComputer(windowId, computerId);
611
620
  }, onChooseComputer: openAppPermissions }, projection.windowId));
612
621
  }), extraPanes?.({ activeId, order, focus }), layout.snapPreview && (_jsx(WindowSnapPreview, { "data-snap-side": layout.snapPreview.side, style: {
@@ -98,6 +98,7 @@ export declare const hasVisibleAppWindows: (projection: Readonly<{
98
98
  cleanupError?: unknown;
99
99
  navigation: Readonly<{
100
100
  canGoBack: boolean;
101
+ canGoForward: boolean;
101
102
  title?: string;
102
103
  crumbs?: readonly Readonly<{
103
104
  id: string;
@@ -1,14 +1,17 @@
1
1
  import { CommandDialogs, type ShellCommandState } from "./command-dialogs.js";
2
2
  import { type ShellActions } from "@fungi.computer/nacre/commands";
3
3
  import type { TourtoisAppSurfaceHost } from "./app-surface.js";
4
- /** The Back hint for this platform, e.g. "Back (Ctrl K, then [)". */
4
+ /** The Back hint for this platform. */
5
5
  export declare function backHint(): string;
6
+ /** The Forward hint for this platform, the matching chord to Back's. */
7
+ export declare function forwardHint(): string;
6
8
  /**
7
9
  * Register the shell's commands, dispatch their direct chords from the host
8
10
  * document, and own the which-key and `:` line open state.
9
11
  */
10
- export declare function useShellCommands(host: TourtoisAppSurfaceHost | null, actions: Omit<ShellActions, "showKeys" | "showCommandLine" | "back"> & Readonly<{
12
+ export declare function useShellCommands(host: TourtoisAppSurfaceHost | null, actions: Omit<ShellActions, "showKeys" | "showCommandLine" | "back" | "forward"> & Readonly<{
11
13
  back: () => void;
14
+ forward: () => void;
12
15
  showDesktop: () => Promise<void>;
13
16
  }>): ShellCommandState;
14
17
  /** Draw the shared shell dialogs in Tourtois's dialog layer. */
@@ -2,14 +2,22 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { CommandDialogs } from "./command-dialogs.js";
3
3
  import { useLayer } from "@fungi.computer/maosaico";
4
4
  import { Sigil, isSigilName } from "@fungi.computer/sigils";
5
- import { backBinding, shellCommands, } from "@fungi.computer/nacre/commands";
5
+ import { backBinding, forwardBinding, shellCommands, } from "@fungi.computer/nacre/commands";
6
6
  import { useEffect, useMemo, useRef, useState, useSyncExternalStore, } from "react";
7
7
  import { AppIcon } from "./app-icon.js";
8
8
  import { installShellKeys } from "@fungi.computer/nacre/keys";
9
- /** The Back hint for this platform, e.g. "Back (Ctrl K, then [)". */
9
+ /** A tooltip naming the leader chord for `binding`, e.g. "Back (Ctrl K, then [)". */
10
+ function chordHint(name, binding) {
11
+ const key = binding.slice("<leader>".length);
12
+ return `${name} (${isMac() ? "⌘K" : "Ctrl K"}, then ${key})`;
13
+ }
14
+ /** The Back hint for this platform. */
10
15
  export function backHint() {
11
- const key = backBinding.slice("<leader>".length);
12
- return `Back (${isMac() ? "⌘K" : "Ctrl K"}, then ${key})`;
16
+ return chordHint("Back", backBinding);
17
+ }
18
+ /** The Forward hint for this platform, the matching chord to Back's. */
19
+ export function forwardHint() {
20
+ return chordHint("Forward", forwardBinding);
13
21
  }
14
22
  const emptySnapshot = Object.freeze({
15
23
  bindings: Object.freeze([]),
@@ -66,6 +74,9 @@ export function useShellCommands(host, actions) {
66
74
  back: () => {
67
75
  latest.current.back();
68
76
  },
77
+ forward: () => {
78
+ latest.current.forward();
79
+ },
69
80
  }),
70
81
  {
71
82
  id: "desktop.show",
@@ -73,9 +84,9 @@ export function useShellCommands(host, actions) {
73
84
  category: "Window",
74
85
  description: "Hide visible Apps, or restore the Apps hidden by Show desktop.",
75
86
  projections: {
76
- bindings: { values: ["<leader>d"], order: 8 },
87
+ bindings: { values: ["<leader>d"], order: 9 },
77
88
  palette: { order: 18 },
78
- help: { order: 8 },
89
+ help: { order: 9 },
79
90
  },
80
91
  handler: async () => {
81
92
  setKeysOpen(false);
@@ -55,6 +55,7 @@ const relayCommands = (maximum) => z
55
55
  const navigationRelaySchema = z
56
56
  .strictObject({
57
57
  canGoBack: z.boolean(),
58
+ canGoForward: z.boolean(),
58
59
  title: z.string().trim().min(1).max(APP_NAVIGATION_TITLE_MAX).optional(),
59
60
  crumbs: z
60
61
  .array(z.strictObject({
@@ -87,7 +88,10 @@ function parseNavigationRelay(value) {
87
88
  const state = navigationRelaySchema.parse(value);
88
89
  if (state === null)
89
90
  return null;
90
- let parsed = { canGoBack: state.canGoBack };
91
+ let parsed = {
92
+ canGoBack: state.canGoBack,
93
+ canGoForward: state.canGoForward,
94
+ };
91
95
  if (state.title !== undefined)
92
96
  parsed = { ...parsed, title: state.title };
93
97
  if (state.crumbs !== undefined)
@@ -238,6 +242,7 @@ export function createTourtoisShell(workbench) {
238
242
  reconfigure: (nextLaunch) => handle.reconfigure(childLaunch(nextLaunch)),
239
243
  requestClose: () => handle.requestClose(),
240
244
  requestBack: () => handle.requestBack(),
245
+ requestForward: () => handle.requestForward(),
241
246
  activateNavigation: (activation) => handle.activateNavigation(activation),
242
247
  activateStatus: (action) => handle.activateStatus(action),
243
248
  dispose: close,
@@ -253,6 +253,7 @@ export declare function useAppWindowManager(host: TourtoisAppSurfaceHost | null,
253
253
  }>[];
254
254
  }>) => Promise<void>;
255
255
  back: (windowId: string) => Promise<boolean>;
256
+ forward: (windowId: string) => Promise<boolean>;
256
257
  activateNavigation: (windowId: string, activation: import("@fungi.computer/agar").AppNavigationActivation) => Promise<boolean>;
257
258
  activateStatus: (windowId: string, action: import("@fungi.computer/agar").AppStatusAction) => Promise<boolean>;
258
259
  registerComputerChoice: (windowId: string, handler: () => void) => () => void;
@@ -315,6 +316,7 @@ export declare function useAppWindowManager(host: TourtoisAppSurfaceHost | null,
315
316
  cleanupError?: unknown;
316
317
  navigation: Readonly<{
317
318
  canGoBack: boolean;
319
+ canGoForward: boolean;
318
320
  title?: string;
319
321
  crumbs?: readonly Readonly<{
320
322
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fungi.computer/tourtois",
3
- "version": "0.13.4",
3
+ "version": "0.14.1",
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",
@@ -77,15 +77,15 @@
77
77
  "LICENSE"
78
78
  ],
79
79
  "dependencies": {
80
- "@fungi.computer/agar": "0.9.1",
80
+ "@fungi.computer/agar": "0.10.0",
81
81
  "@fungi.computer/cairn": "0.1.0",
82
- "@fungi.computer/caps": "0.10.8",
82
+ "@fungi.computer/caps": "0.11.1",
83
83
  "@fungi.computer/ear-tag": "0.1.0",
84
84
  "@fungi.computer/gills": "0.3.0",
85
85
  "@fungi.computer/maosaico": "0.1.2",
86
- "@fungi.computer/parakeet": "0.11.17",
86
+ "@fungi.computer/parakeet": "0.11.19",
87
87
  "@fungi.computer/puffball": "0.5.5",
88
- "@fungi.computer/shiitake": "0.13.0",
88
+ "@fungi.computer/shiitake": "0.13.1",
89
89
  "@fungi.computer/sigils": "0.3.1",
90
90
  "@fungi.computer/sprite": "0.2.2",
91
91
  "@fungi.computer/sprite-zdog": "0.3.2",
@@ -100,13 +100,13 @@
100
100
  "lucide-react": "0.460.0",
101
101
  "react-dom": "18.3.1",
102
102
  "zod": "4.4.3",
103
- "@fungi.computer/nacre": "0.4.6"
103
+ "@fungi.computer/nacre": "0.5.1"
104
104
  },
105
105
  "peerDependencies": {
106
106
  "react": "^18.3.1 || ^19.2.0"
107
107
  },
108
108
  "devDependencies": {
109
- "@fungi.computer/oyster": "0.20.9",
109
+ "@fungi.computer/oyster": "0.21.1",
110
110
  "@cloudflare/workers-types": "5.20260828.1",
111
111
  "@fungi.computer/forage": "0.3.5",
112
112
  "@fungi.computer/mycelium": "0.3.8",