@fungi.computer/tourtois 0.20.13 → 0.20.15
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
|
@@ -88,7 +88,7 @@ function WindowFailure({ projection, onReopen, }) {
|
|
|
88
88
|
const lost = projection.error instanceof AppError &&
|
|
89
89
|
projection.error.code === "DISCONNECTED";
|
|
90
90
|
const described = describeAppError(projection.error);
|
|
91
|
-
return (_jsx(ResultState, { className: "tourtois-window-failure", tone: "failed", headingLevel: 3, title: lost ? "This App lost its connection" : described.title, description: _jsxs(_Fragment, { children: [lost ? `${appTitle} stopped answering.` : described.message, _jsx("span", { className: "tourtois-window-failure-note", children: "A request may have finished even if its reply did not arrive, so check before repeating it." })] }), actions: _jsxs(_Fragment, { children: [_jsxs(Button, { type: "button", variant: "primary", onClick: onReopen, children: ["Reopen ", appTitle] }), _jsx(Button, { type: "button", variant: "outline", onClick: () => {
|
|
91
|
+
return (_jsx(ResultState, { className: "tourtois-window-failure", role: "alert", tone: "failed", headingLevel: 3, title: lost ? "This App lost its connection" : described.title, description: _jsxs(_Fragment, { children: [lost ? `${appTitle} stopped answering.` : described.message, _jsx("span", { className: "tourtois-window-failure-note", children: "A request may have finished even if its reply did not arrive, so check before repeating it." })] }), actions: _jsxs(_Fragment, { children: [_jsxs(Button, { type: "button", variant: "primary", onClick: onReopen, children: ["Reopen ", appTitle] }), _jsx(Button, { type: "button", variant: "outline", onClick: () => {
|
|
92
92
|
window.location.reload();
|
|
93
93
|
}, children: "Reload workspace" })] }) }));
|
|
94
94
|
}
|
package/dist/desktop/Desktop.js
CHANGED
|
@@ -90,7 +90,6 @@ function ArrangedDesktop({ owner, ...props }) {
|
|
|
90
90
|
const visibleItems = availableDesktopLayout(snapshot.layout, catalog).items;
|
|
91
91
|
const { editing, onEditingChange } = props;
|
|
92
92
|
const [configuration, setConfiguration] = useState(null);
|
|
93
|
-
const [error, setError] = useState(null);
|
|
94
93
|
const [saving, setSaving] = useState(false);
|
|
95
94
|
const [saved, setSaved] = useState(false);
|
|
96
95
|
const stage = useRef(null);
|
|
@@ -132,6 +131,11 @@ function ArrangedDesktop({ owner, ...props }) {
|
|
|
132
131
|
: cell;
|
|
133
132
|
});
|
|
134
133
|
const placements = arrangeBento(projected, columns);
|
|
134
|
+
// Each failure is reported once, as a toast; nothing renders above the stage.
|
|
135
|
+
const reportFailure = (message) => {
|
|
136
|
+
setSaved(false);
|
|
137
|
+
toast.error(message, { toasterId: WORKBENCH_NOTICES });
|
|
138
|
+
};
|
|
135
139
|
const save = async (method, input, scope = "member") => {
|
|
136
140
|
setSaving(true);
|
|
137
141
|
try {
|
|
@@ -142,14 +146,16 @@ function ArrangedDesktop({ owner, ...props }) {
|
|
|
142
146
|
});
|
|
143
147
|
if (result.kind !== "accepted")
|
|
144
148
|
console.error("Desktop change refused", result.code);
|
|
145
|
-
|
|
146
|
-
if (result.kind === "accepted")
|
|
149
|
+
if (result.kind === "accepted") {
|
|
147
150
|
setSaved(true);
|
|
148
|
-
|
|
151
|
+
return true;
|
|
152
|
+
}
|
|
153
|
+
reportFailure(refusalMessage(result.code));
|
|
154
|
+
return false;
|
|
149
155
|
}
|
|
150
156
|
catch (cause) {
|
|
151
157
|
console.error("Desktop arrangement update failed", cause);
|
|
152
|
-
|
|
158
|
+
reportFailure("Your desktop change could not be confirmed.");
|
|
153
159
|
return false;
|
|
154
160
|
}
|
|
155
161
|
finally {
|
|
@@ -267,7 +273,7 @@ function ArrangedDesktop({ owner, ...props }) {
|
|
|
267
273
|
onEditingChange(false);
|
|
268
274
|
};
|
|
269
275
|
const longPress = useRef(undefined);
|
|
270
|
-
return (_jsxs(_Fragment, { children: [snapshot.refreshFailure ? (_jsx(Alert, { tone: "warning", description: snapshot.refreshFailure.message })) : null, editing ? (_jsx(ArrangeToolbar, { phone: props.phone, status: saving ? "saving" : saved ? "saved" : "idle",
|
|
276
|
+
return (_jsxs(_Fragment, { children: [snapshot.refreshFailure ? (_jsx(Alert, { tone: "warning", description: snapshot.refreshFailure.message })) : null, editing ? (_jsx(ArrangeToolbar, { phone: props.phone, status: saving ? "saving" : saved ? "saved" : "idle", canWriteTeam: snapshot.canWriteTeam, choices: choices, saving: saving, onChoose: addWidget, onReset: async () => {
|
|
271
277
|
if (!(await save("layout.reset", {})))
|
|
272
278
|
throw new Error("The layout was not reset");
|
|
273
279
|
}, onSaveTeam: () => {
|
|
@@ -306,7 +312,7 @@ function ArrangedDesktop({ owner, ...props }) {
|
|
|
306
312
|
});
|
|
307
313
|
else
|
|
308
314
|
void save("layout.reset", {});
|
|
309
|
-
}, children: "Restore Launcher" }) }) })) : null,
|
|
315
|
+
}, children: "Restore Launcher" }) }) })) : null, _jsx("div", { ref: stage, className: "tourtois-desktop-stage", style: { height }, "data-desktop-columns": columns, "data-preview": binding.preview, "data-arranging": editing ? "" : undefined, children: visibleItems.map((item) => {
|
|
310
316
|
const frame = binding.frames.get(item.id);
|
|
311
317
|
const gill = catalog.find((gill) => gill.surfaceId === item.surfaceId && gill.gillId === item.gillId);
|
|
312
318
|
if (!frame || !gill)
|
|
@@ -5,10 +5,9 @@ export type ArrangeStatus = "idle" | "saving" | "saved";
|
|
|
5
5
|
* Arrange's floating controls. They live in the chrome layer, take no flow
|
|
6
6
|
* space, and stay above every window.
|
|
7
7
|
*/
|
|
8
|
-
export declare function ArrangeToolbar({ phone, status,
|
|
8
|
+
export declare function ArrangeToolbar({ phone, status, canWriteTeam, choices, saving, onChoose, onReset, onSaveTeam, onDone, }: {
|
|
9
9
|
phone: boolean;
|
|
10
10
|
status: ArrangeStatus;
|
|
11
|
-
error: string | null;
|
|
12
11
|
canWriteTeam: boolean;
|
|
13
12
|
choices: readonly WidgetChoice[];
|
|
14
13
|
saving: boolean;
|
|
@@ -25,7 +25,7 @@ function restoreFocus(origin) {
|
|
|
25
25
|
* Arrange's floating controls. They live in the chrome layer, take no flow
|
|
26
26
|
* space, and stay above every window.
|
|
27
27
|
*/
|
|
28
|
-
export function ArrangeToolbar({ phone, status,
|
|
28
|
+
export function ArrangeToolbar({ phone, status, canWriteTeam, choices, saving, onChoose, onReset, onSaveTeam, onDone, }) {
|
|
29
29
|
const chrome = useLayer("chrome");
|
|
30
30
|
const [pickerOpen, setPickerOpen] = useState(false);
|
|
31
31
|
const [resetOpen, setResetOpen] = useState(false);
|
|
@@ -56,7 +56,7 @@ export function ArrangeToolbar({ phone, status, error, canWriteTeam, choices, sa
|
|
|
56
56
|
setPickerOpen(!pickerOpen);
|
|
57
57
|
}, children: [_jsx(Plus, { "aria-hidden": "true", size: 16 }), phone ? "Add" : "Add widget"] })] }), _jsxs(DropdownMenu, { modal: false, children: [_jsx(DropdownMenuTrigger, { render: _jsx(IconButton, { size: "sm", variant: "ghost", icon: _jsx(MoreHorizontal, {}), "aria-label": "More layout actions", title: "More layout actions" }) }), _jsxs(DropdownMenuContent, { container: chrome, align: "end", side: "top", children: [_jsx(DropdownMenuItem, { onSelect: () => {
|
|
58
58
|
setResetOpen(true);
|
|
59
|
-
}, children: "Reset layout\u2026" }), canWriteTeam ? (_jsx(DropdownMenuItem, { onSelect: onSaveTeam, children: "Save as Team default" })) : null] })] }), _jsx("span", { className: "tourtois-arrange-state", role: "status", "data-empty":
|
|
59
|
+
}, children: "Reset layout\u2026" }), canWriteTeam ? (_jsx(DropdownMenuItem, { onSelect: onSaveTeam, children: "Save as Team default" })) : null] })] }), _jsx("span", { className: "tourtois-arrange-state", role: "status", "data-empty": status !== "idle" ? undefined : "", children: status === "saving" ? (_jsx(Status, { glyph: "arc", tone: "info", label: "Saving\u2026" })) : status === "saved" ? (_jsx(Status, { glyph: "check", tone: "success", label: "Saved" })) : null }), _jsx(Button, { size: "sm", variant: "primary", "aria-label": "Done arranging", onClick: onDone, children: "Done" }), _jsx(Dialog, { open: resetOpen, onOpenChange: setResetOpen, children: _jsxs(DialogContent, { children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Reset layout" }), _jsx(DialogDescription, { children: "Your widgets go back to the default desktop." })] }), _jsx(ConfirmAction, { mode: "hold", label: "Reset layout", confirmLabel: "Hold to reset the layout", onConfirm: async () => {
|
|
60
60
|
await onReset();
|
|
61
61
|
setResetOpen(false);
|
|
62
62
|
} })] }) })] }), chrome);
|
package/dist/layers.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { OverlayRoot } from "@fungi.computer/caps/components/overlay-root";
|
|
3
3
|
import { MaosaicoLayers, useLayer } from "@fungi.computer/maosaico";
|
|
4
|
-
import { createContext, useContext, useMemo } from "react";
|
|
4
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, } from "react";
|
|
5
5
|
function OverlayContainers({ children, subscribeDismiss, }) {
|
|
6
6
|
const popover = useLayer("popover");
|
|
7
7
|
const dialog = useLayer("dialog");
|
|
@@ -18,8 +18,62 @@ const DismissContext = createContext(() => undefined);
|
|
|
18
18
|
export function useDismissOverlays() {
|
|
19
19
|
return useContext(DismissContext);
|
|
20
20
|
}
|
|
21
|
+
const windows = '[data-maosaico-layer="windows"]';
|
|
22
|
+
/**
|
|
23
|
+
* Whether focus landing in an App's frame is the person's doing. A click in a
|
|
24
|
+
* frame is invisible to this document except as the pointer resting on the
|
|
25
|
+
* frame (this document sees it enter the frame element, then nothing) or on
|
|
26
|
+
* a window, and Tab leaves a key press behind. An App that focuses itself while it loads has
|
|
27
|
+
* neither, so it must not close a menu the person just opened. The menu keeps
|
|
28
|
+
* the keyboard too: focus goes back to where it was in this document.
|
|
29
|
+
*/
|
|
30
|
+
function usePersonDrivenFocus() {
|
|
31
|
+
const overFrame = useRef(false);
|
|
32
|
+
const tabbed = useRef(false);
|
|
33
|
+
const heldFocus = useRef(null);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
const pointer = (event) => {
|
|
36
|
+
overFrame.current =
|
|
37
|
+
event.target instanceof Element &&
|
|
38
|
+
event.target.closest(`iframe, ${windows}`) !== null;
|
|
39
|
+
tabbed.current = false;
|
|
40
|
+
};
|
|
41
|
+
const key = (event) => {
|
|
42
|
+
tabbed.current = event.key === "Tab";
|
|
43
|
+
};
|
|
44
|
+
const focused = (event) => {
|
|
45
|
+
if (event.target instanceof HTMLElement &&
|
|
46
|
+
event.target.closest(`iframe, ${windows}`) === null)
|
|
47
|
+
heldFocus.current = event.target;
|
|
48
|
+
};
|
|
49
|
+
document.addEventListener("pointerover", pointer, true);
|
|
50
|
+
document.addEventListener("pointerdown", pointer, true);
|
|
51
|
+
document.addEventListener("keydown", key, true);
|
|
52
|
+
document.addEventListener("focusin", focused, true);
|
|
53
|
+
return () => {
|
|
54
|
+
document.removeEventListener("pointerover", pointer, true);
|
|
55
|
+
document.removeEventListener("pointerdown", pointer, true);
|
|
56
|
+
document.removeEventListener("keydown", key, true);
|
|
57
|
+
document.removeEventListener("focusin", focused, true);
|
|
58
|
+
};
|
|
59
|
+
}, []);
|
|
60
|
+
return useCallback(() => {
|
|
61
|
+
const person = overFrame.current || tabbed.current;
|
|
62
|
+
tabbed.current = false;
|
|
63
|
+
if (!person) {
|
|
64
|
+
const held = heldFocus.current;
|
|
65
|
+
const menuOpen = document.querySelector('[data-maosaico-layer="popover"] [data-open]') !== null;
|
|
66
|
+
if (menuOpen && held?.isConnected === true)
|
|
67
|
+
queueMicrotask(() => {
|
|
68
|
+
held.focus({ preventScroll: true });
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return person;
|
|
72
|
+
}, []);
|
|
73
|
+
}
|
|
21
74
|
/** Tourtois composes Caps portal destinations with Maosaico's ordered roots. */
|
|
22
75
|
export function TourtoisLayers({ children }) {
|
|
76
|
+
const personDriven = usePersonDrivenFocus();
|
|
23
77
|
const dismissal = useMemo(() => {
|
|
24
78
|
const listeners = new Set();
|
|
25
79
|
return {
|
|
@@ -35,5 +89,9 @@ export function TourtoisLayers({ children }) {
|
|
|
35
89
|
},
|
|
36
90
|
};
|
|
37
91
|
}, []);
|
|
38
|
-
|
|
92
|
+
const onDismiss = useCallback(() => {
|
|
93
|
+
if (personDriven())
|
|
94
|
+
dismissal.dismiss();
|
|
95
|
+
}, [personDriven, dismissal]);
|
|
96
|
+
return (_jsx(MaosaicoLayers, { onDismiss: onDismiss, children: _jsx(DismissContext.Provider, { value: dismissal.dismiss, children: _jsx(OverlayContainers, { subscribeDismiss: dismissal.subscribe, children: children }) }) }));
|
|
39
97
|
}
|
|
@@ -21,7 +21,8 @@ function shellOverlays() {
|
|
|
21
21
|
const find = (name) => document.querySelector(`[data-maosaico-layer="${name}"]`) ??
|
|
22
22
|
document.body;
|
|
23
23
|
return {
|
|
24
|
-
|
|
24
|
+
// Settings are dialogs: their menus and pickers must paint above them.
|
|
25
|
+
popover: find("dialog"),
|
|
25
26
|
dialog: find("dialog"),
|
|
26
27
|
toast: find("toast"),
|
|
27
28
|
tooltip: find("tooltip"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/tourtois",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.15",
|
|
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.18.
|
|
80
|
+
"@fungi.computer/agar": "0.18.1",
|
|
81
81
|
"@fungi.computer/cairn": "0.1.0",
|
|
82
82
|
"@fungi.computer/caps": "0.11.7",
|
|
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.
|
|
86
|
+
"@fungi.computer/parakeet": "0.12.1",
|
|
87
87
|
"@fungi.computer/puffball": "0.9.0",
|
|
88
|
-
"@fungi.computer/shiitake": "0.18.
|
|
88
|
+
"@fungi.computer/shiitake": "0.18.3",
|
|
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",
|
|
@@ -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.6.
|
|
103
|
+
"@fungi.computer/nacre": "0.6.7"
|
|
104
104
|
},
|
|
105
105
|
"peerDependencies": {
|
|
106
106
|
"react": "^18.3.1 || ^19.2.0"
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
|
-
"@fungi.computer/oyster": "0.
|
|
109
|
+
"@fungi.computer/oyster": "0.33.0",
|
|
110
110
|
"@cloudflare/workers-types": "5.20260828.1",
|
|
111
111
|
"@fungi.computer/forage": "0.3.9",
|
|
112
112
|
"@fungi.computer/mycelium": "0.4.0",
|