@fungi.computer/tourtois 0.12.18 → 0.12.20

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.js CHANGED
@@ -7,7 +7,8 @@ import { AppStatusBar, AppStatusItem, StatusBarChip, StatusBarPicker, } from "@f
7
7
  import { Sigil } from "@fungi.computer/sigils";
8
8
  import { describeAppError } from "@fungi.computer/agar/errors";
9
9
  import { WindowActions, WindowBody, WindowFrame, WindowHeader, } from "@fungi.computer/caps/components/window";
10
- import { Settings, ShieldCheck } from "lucide-react";
10
+ import { Ellipsis, Settings, ShieldCheck } from "lucide-react";
11
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "@fungi.computer/caps/components/dropdown-menu";
11
12
  import { WindowStatusItem } from "./status-bar.js";
12
13
  import { useLayer, useMaosaicoItem, useMaosaicoLayout, } from "@fungi.computer/maosaico";
13
14
  import { AppError, } from "@fungi.computer/agar";
@@ -22,11 +23,15 @@ import { launchComputerId } from "./app-launch.js";
22
23
  * The App's own path, commands and state, when it publishes them; an App
23
24
  * that publishes none keeps the title and subtitle in its header.
24
25
  */
25
- function headerContent(navigation, popover, activate) {
26
+ function headerContent(navigation, popover, activate, phone) {
26
27
  if (navigation?.crumbs === undefined || navigation.crumbs.length === 0)
27
28
  return {};
28
29
  let content = {
29
- crumbs: navigation.crumbs,
30
+ // Long App paths conventionally start with the App and Item, then view
31
+ // and version. Keep the Item and current place; the menu retains the rest.
32
+ crumbs: phone && navigation.crumbs.length > 3
33
+ ? [...navigation.crumbs.slice(1, 2), ...navigation.crumbs.slice(-1)]
34
+ : navigation.crumbs,
30
35
  popover,
31
36
  onCrumb: (crumbId, siblingId) => {
32
37
  activate(siblingId === undefined
@@ -38,13 +43,38 @@ function headerContent(navigation, popover, activate) {
38
43
  },
39
44
  };
40
45
  if (navigation.primary !== undefined)
41
- content = { ...content, primary: navigation.primary };
42
- if (navigation.menu !== undefined)
46
+ content = {
47
+ ...content,
48
+ primary: phone
49
+ ? navigation.primary.slice(0, 1).map((command) => {
50
+ const labelled = { ...command };
51
+ delete labelled.icon;
52
+ return labelled;
53
+ })
54
+ : navigation.primary,
55
+ };
56
+ if (!phone && navigation.menu !== undefined)
43
57
  content = { ...content, menu: navigation.menu };
44
58
  if (navigation.status !== undefined)
45
59
  content = { ...content, status: navigation.status };
46
60
  return content;
47
61
  }
62
+ /** The shell's phone breakpoint also selects its compact command presentation. */
63
+ function usePhone() {
64
+ const [phone, setPhone] = useState(false);
65
+ useEffect(() => {
66
+ const media = window.matchMedia("(max-width: 640px)");
67
+ const update = () => {
68
+ setPhone(media.matches);
69
+ };
70
+ update();
71
+ media.addEventListener("change", update);
72
+ return () => {
73
+ media.removeEventListener("change", update);
74
+ };
75
+ }, []);
76
+ return phone;
77
+ }
48
78
  /** The focused window's App-level settings; its Computer lives in its status bar. */
49
79
  export function FocusedWindowControls({ app, onOpenSettings, onOpenPermissions, projection, }) {
50
80
  if (!app)
@@ -61,7 +91,38 @@ function WindowFailure({ projection, onReopen, }) {
61
91
  window.location.reload();
62
92
  }, children: "Reload workspace" })] }) }));
63
93
  }
94
+ /** Places folded out of a phone's trail stay available in the same menu. */
95
+ function PhonePathMenu({ crumbs, onAction, }) {
96
+ if (crumbs === undefined || crumbs.length <= 3)
97
+ return null;
98
+ return crumbs.flatMap((crumb, index) => index === 1 || index === crumbs.length - 1
99
+ ? []
100
+ : [
101
+ _jsx(DropdownMenuItem, { onSelect: () => {
102
+ onAction({ kind: "crumb", crumbId: crumb.id });
103
+ }, children: crumb.label }, `crumb:${crumb.id}`),
104
+ ...(crumb.siblings ?? []).map((sibling) => (_jsxs(DropdownMenuItem, { onSelect: () => {
105
+ onAction({
106
+ kind: "crumb",
107
+ crumbId: crumb.id,
108
+ siblingId: sibling.id,
109
+ });
110
+ }, children: [crumb.label, " \u00B7 ", sibling.label] }, `crumb:${crumb.id}:${sibling.id}`))),
111
+ ]);
112
+ }
113
+ /** One maintained command menu on phones; ordinary window keys on desktop. */
114
+ function AppWindowControls({ phone, navigation, onAction, popover, ...actions }) {
115
+ if (!phone)
116
+ return _jsx(WindowActions, { ...actions });
117
+ return (_jsxs(DropdownMenu, { modal: false, children: [_jsx(DropdownMenuTrigger, { render: _jsx(IconButton, { icon: _jsx(Ellipsis, {}), "aria-label": `More for ${actions.title}` }) }), _jsxs(DropdownMenuContent, { align: "end", container: popover, children: [_jsx(PhonePathMenu, { crumbs: navigation?.crumbs, onAction: onAction }), [
118
+ ...(navigation?.primary?.slice(1) ?? []),
119
+ ...(navigation?.menu ?? []),
120
+ ].map((command) => (_jsx(DropdownMenuItem, { disabled: command.disabled === true, variant: command.tone === "destructive" ? "destructive" : "default", onSelect: () => {
121
+ onAction({ kind: "action", actionId: command.id });
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
+ }
64
124
  export function AppPane({ projection, nextLaunch, icon, manager, onError, index, focusWindow, afterHide, onBack, onSelectComputer, onChooseComputer, }) {
125
+ const phone = usePhone();
65
126
  const containerRef = useRef(null);
66
127
  const popover = useLayer("popover");
67
128
  const [computerPickerOpen, setComputerPickerOpen] = useState(false);
@@ -136,7 +197,7 @@ export function AppPane({ projection, nextLaunch, icon, manager, onError, index,
136
197
  return;
137
198
  event.preventDefault();
138
199
  onBack(projection.windowId);
139
- }, style: binding.stackingStyle, children: [_jsx(WindowHeader, { title: projection.launch.title, ...(projection.navigation?.title === undefined
200
+ }, style: binding.stackingStyle, children: [_jsx(WindowHeader, { title: projection.launch.title, "data-phone-compact": phone || undefined, ...(projection.navigation?.title === undefined
140
201
  ? {}
141
202
  : { subtitle: projection.navigation.title }), ...headerContent(projection.navigation, popover, (activation) => {
142
203
  void manager
@@ -145,7 +206,7 @@ export function AppPane({ projection, nextLaunch, icon, manager, onError, index,
145
206
  console.error("App workbench operation failed", cause);
146
207
  onError("App could not handle that action.");
147
208
  });
148
- }), density: layout.mode === "tiled" ? "compact" : "regular", icon: _jsx(AppIcon, { roles: projection.launch.roles, icon: icon }), ...(projection.navigation?.canGoBack === true
209
+ }, phone), density: layout.mode === "tiled" ? "compact" : "regular", icon: _jsx(AppIcon, { roles: projection.launch.roles, icon: icon }), ...(projection.navigation?.canGoBack === true
149
210
  ? {
150
211
  back: {
151
212
  label: `Back in ${projection.launch.title}`,
@@ -159,27 +220,34 @@ export function AppPane({ projection, nextLaunch, icon, manager, onError, index,
159
220
  ...binding.props,
160
221
  onClick: binding.focus,
161
222
  onDoubleClick: zoom,
162
- }, actions: _jsx(_Fragment, { children: _jsx(WindowActions, { title: projection.launch.title, maximized: zoomed, ...(layout.mode === "tiled" &&
163
- layout.order[0] !== projection.windowId
164
- ? {
165
- onPromote: () => {
166
- const main = layout.order[0];
167
- if (main)
168
- layout.swap(projection.windowId, main);
169
- focusWindow(projection.windowId);
170
- },
171
- }
172
- : {}), onToggleMaximize: zoom, onMinimize: () => {
173
- void manager
174
- .minimize(projection.windowId)
175
- .then(() => {
176
- afterHide(projection.windowId);
177
- })
178
- .catch((cause) => {
179
- console.error("App workbench operation failed", cause);
180
- onError("App could not be minimized.");
181
- });
182
- }, onClose: close }) }) }), projection.status === "loading" ||
223
+ }, actions: _jsx(AppWindowControls, { phone: phone, navigation: projection.navigation, popover: popover, onAction: (activation) => {
224
+ void manager
225
+ .activateNavigation(projection.windowId, activation)
226
+ .catch((cause) => {
227
+ console.error("App workbench operation failed", cause);
228
+ onError("App could not handle that action.");
229
+ });
230
+ }, title: projection.launch.title, maximized: zoomed, ...(layout.mode === "tiled" &&
231
+ layout.order[0] !== projection.windowId
232
+ ? {
233
+ onPromote: () => {
234
+ const main = layout.order[0];
235
+ if (main)
236
+ layout.swap(projection.windowId, main);
237
+ focusWindow(projection.windowId);
238
+ },
239
+ }
240
+ : {}), onToggleMaximize: zoom, onMinimize: () => {
241
+ void manager
242
+ .minimize(projection.windowId)
243
+ .then(() => {
244
+ afterHide(projection.windowId);
245
+ })
246
+ .catch((cause) => {
247
+ console.error("App workbench operation failed", cause);
248
+ onError("App could not be minimized.");
249
+ });
250
+ }, onClose: close }) }), projection.status === "loading" ||
183
251
  projection.status === "getting-ready" ? (_jsx(LoadingState, { className: "tourtois-app-loading", framed: false, icon: _jsx(AppIcon, { roles: projection.launch.roles, icon: icon }), variant: projection.status === "getting-ready" ? "square" : "line", message: projection.status === "getting-ready"
184
252
  ? `Getting ${projection.launch.title} ready…`
185
253
  : `Opening ${projection.launch.title}…`, detail: "Preparing this App for your workspace." })) : null, projection.status === "error" ? (_jsx("div", { className: "tourtois-window-status", children: _jsx(WindowFailure, { projection: projection, onReopen: () => {
@@ -227,19 +295,7 @@ export function AppPane({ projection, nextLaunch, icon, manager, onError, index,
227
295
  */
228
296
  export function WindowStatusBar({ projection, onSelectComputer, onAction, surface, computerPickerOpen, onComputerPickerOpenChange, onReload, onChooseComputer, }) {
229
297
  const popover = useLayer("popover");
230
- const [phone, setPhone] = useState(false);
231
- useEffect(() => {
232
- // Match Caps' phone status-bar breakpoint, including its touch targets.
233
- const media = window.matchMedia("(max-width: 640px)");
234
- const update = () => {
235
- setPhone(media.matches);
236
- };
237
- update();
238
- media.addEventListener("change", update);
239
- return () => {
240
- media.removeEventListener("change", update);
241
- };
242
- }, []);
298
+ const phone = usePhone();
243
299
  const { computers, title } = projection.launch;
244
300
  const items = projection.statusItems;
245
301
  if (computers === undefined && items.length === 0 && !onReload)
@@ -313,7 +313,7 @@ function ArrangedDesktop({ owner, ...props }) {
313
313
  left: frame.x,
314
314
  top: frame.y,
315
315
  width: frame.width,
316
- height: frame.height,
316
+ height: Math.min(contentHeights.get(item.id) ?? frame.height, frame.height),
317
317
  }, onPointerDown: (event) => {
318
318
  // Touch has no menu to reach Arrange from: a long press enters it.
319
319
  if (editing || event.pointerType !== "touch")
@@ -72,7 +72,7 @@ export function LauncherGill({ items, size = "M", onAllApps, loading = false, un
72
72
  },
73
73
  } })) : null, items.length > 0 ||
74
74
  pendingTiles.length > 0 ||
75
- warnings.length > 0 ? (_jsx(AppGrid, { "aria-label": "Apps", items: [
75
+ warnings.length > 0 ? (_jsx(AppGrid, { className: "tourtois-launcher-grid", "aria-label": "Apps", items: [
76
76
  ...tiles,
77
77
  ...pendingTiles,
78
78
  ...warnings,
package/dist/shell.css CHANGED
@@ -908,3 +908,18 @@
908
908
  height: 7rem;
909
909
  }
910
910
  }
911
+
912
+ /* Keep the launcher keys' existing material at a compact widget scale. */
913
+ .tourtois-launcher-grid[data-size="lg"] {
914
+ grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr));
915
+ }
916
+ .tourtois-launcher-grid[data-size="lg"] .caps-app-grid-icon {
917
+ width: 4rem;
918
+ height: 4rem;
919
+ }
920
+ .tourtois-gill-frame > .caps-card-header {
921
+ padding: var(--spacing-lg);
922
+ }
923
+ .tourtois-gill-frame > .caps-card-content {
924
+ padding: 0 var(--spacing-lg) var(--spacing-lg);
925
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fungi.computer/tourtois",
3
- "version": "0.12.18",
3
+ "version": "0.12.20",
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",
@@ -79,13 +79,13 @@
79
79
  "dependencies": {
80
80
  "@fungi.computer/agar": "0.9.1",
81
81
  "@fungi.computer/cairn": "0.1.0",
82
- "@fungi.computer/caps": "0.10.4",
82
+ "@fungi.computer/caps": "0.10.5",
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.9",
86
+ "@fungi.computer/parakeet": "0.11.11",
87
87
  "@fungi.computer/puffball": "0.5.5",
88
- "@fungi.computer/shiitake": "0.12.4",
88
+ "@fungi.computer/shiitake": "0.13.0",
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",
@@ -106,7 +106,7 @@
106
106
  "react": "^18.3.1 || ^19.2.0"
107
107
  },
108
108
  "devDependencies": {
109
- "@fungi.computer/oyster": "0.19.32",
109
+ "@fungi.computer/oyster": "0.20.0",
110
110
  "@cloudflare/workers-types": "5.20260828.1",
111
111
  "@fungi.computer/forage": "0.3.5",
112
112
  "@fungi.computer/mycelium": "0.3.8",