@fungi.computer/tourtois 0.9.3 → 0.11.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.
- package/dist/AppAccessConsent.d.ts +10 -2
- package/dist/AppAccessConsent.js +50 -41
- package/dist/AppPane.js +10 -2
- package/dist/AppWorkbench.js +57 -6
- package/dist/DesktopMenuBar.d.ts +2 -1
- package/dist/DesktopMenuBar.js +3 -1
- package/dist/TeamDesktop.js +2 -1
- package/dist/WorkbenchAppBar.js +2 -2
- package/dist/chrome.css +4 -18
- package/dist/desktop/Desktop.js +122 -50
- package/dist/desktop/arrange-toolbar.d.ts +19 -0
- package/dist/desktop/arrange-toolbar.js +63 -0
- package/dist/desktop/arrange.css +145 -0
- package/dist/desktop/launcher-gill.js +9 -2
- package/dist/desktop/row-gill.js +5 -1
- package/dist/desktop/welcome.css +70 -0
- package/dist/desktop/welcome.d.ts +20 -0
- package/dist/desktop/welcome.js +61 -0
- package/dist/desktop/widget-picker.d.ts +19 -0
- package/dist/desktop/widget-picker.js +40 -0
- package/dist/desktop-layout.d.ts +1 -0
- package/dist/desktop-layout.js +11 -2
- package/dist/layers.d.ts +5 -0
- package/dist/layers.js +10 -2
- package/dist/oyster-platform-controls.js +22 -1
- package/dist/oyster-setup.d.ts +41 -0
- package/dist/oyster-setup.js +39 -0
- package/dist/platform-controls.d.ts +2 -0
- package/dist/platform-controls.js +11 -2
- package/dist/shell.css +29 -20
- package/dist/status-bar.js +20 -19
- package/package.json +22 -15
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useCallback, useContext, useMemo, } from "react";
|
|
3
|
+
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { Button } from "@fungi.computer/caps/components/button";
|
|
6
|
+
import { Keycap } from "@fungi.computer/caps/components/keycap";
|
|
7
|
+
import { ShiitakeAvatar } from "@fungi.computer/parakeet/agent-head";
|
|
8
|
+
const welcomeKey = "welcome";
|
|
9
|
+
const dismissedSchema = z.object({ dismissed: z.literal(true) });
|
|
10
|
+
const hidden = { visible: false, dismiss: () => undefined };
|
|
11
|
+
const WelcomeContext = createContext(hidden);
|
|
12
|
+
/** The per-member first-run welcome, remembered in the member's own storage layer. */
|
|
13
|
+
export function WelcomeProvider({ teamId, storage, children, }) {
|
|
14
|
+
const client = useQueryClient();
|
|
15
|
+
const queryKey = useMemo(() => ["tourtois", "welcome", teamId], [teamId]);
|
|
16
|
+
const { data } = useQuery({
|
|
17
|
+
queryKey,
|
|
18
|
+
queryFn: async () => {
|
|
19
|
+
const resolved = await storage.read(welcomeKey);
|
|
20
|
+
return {
|
|
21
|
+
revision: resolved.member?.revision ?? null,
|
|
22
|
+
dismissed: dismissedSchema.safeParse(resolved.member?.value).success,
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
const dismiss = useCallback(() => {
|
|
27
|
+
client.setQueryData(queryKey, {
|
|
28
|
+
revision: data?.revision ?? null,
|
|
29
|
+
dismissed: true,
|
|
30
|
+
});
|
|
31
|
+
void storage
|
|
32
|
+
.write({
|
|
33
|
+
key: welcomeKey,
|
|
34
|
+
scope: "member",
|
|
35
|
+
basedOn: data?.revision ?? null,
|
|
36
|
+
value: { dismissed: true },
|
|
37
|
+
})
|
|
38
|
+
.catch((cause) => {
|
|
39
|
+
console.error("Welcome dismissal was not saved", cause);
|
|
40
|
+
});
|
|
41
|
+
}, [client, data?.revision, queryKey, storage]);
|
|
42
|
+
const value = useMemo(() => ({ visible: data !== undefined && !data.dismissed, dismiss }), [data, dismiss]);
|
|
43
|
+
return (_jsx(WelcomeContext.Provider, { value: value, children: children }));
|
|
44
|
+
}
|
|
45
|
+
export const useWelcome = () => useContext(WelcomeContext);
|
|
46
|
+
const isMac = () => /Mac|iPhone|iPad/u.test(navigator.userAgent);
|
|
47
|
+
/** Starters are matched by their App id in the launcher's `app:<surface>` ids. */
|
|
48
|
+
const starter = (items, appId) => items.find((item) => item.id === `app:${appId}`);
|
|
49
|
+
/** Says what this place is and points at the one thing to do next. */
|
|
50
|
+
export function FirstRunWelcome({ items, onDismiss, }) {
|
|
51
|
+
const hello = starter(items, "hello");
|
|
52
|
+
const first = starter(items, "grove") ?? items.find((item) => item !== hello);
|
|
53
|
+
if (!first && !hello)
|
|
54
|
+
return null;
|
|
55
|
+
const lead = first ?? hello;
|
|
56
|
+
if (!lead)
|
|
57
|
+
return null;
|
|
58
|
+
return (_jsxs("section", { className: "tourtois-welcome", "aria-labelledby": "tourtois-welcome-title", children: [_jsx("span", { className: "tourtois-welcome-mascot", "aria-hidden": "true", children: _jsx(ShiitakeAvatar, { className: "h-full w-full", state: { activity: "idle", expression: "normal" } }) }), _jsxs("div", { className: "tourtois-welcome-text", children: [_jsx("h3", { id: "tourtois-welcome-title", children: "This is your Oyster" }), _jsx("p", { children: "Apps open here as windows." }), _jsxs("p", { className: "tourtois-welcome-hint", children: [_jsx(Keycap, { size: "hint", children: isMac() ? "⌘" : "Ctrl" }), " ", _jsx(Keycap, { size: "hint", children: "K" }), " then ", _jsx(Keycap, { size: "hint", children: "O" }), " ", "opens any App"] })] }), _jsxs("div", { className: "tourtois-welcome-actions", children: [_jsxs(Button, { size: "sm", variant: "primary", onClick: () => {
|
|
59
|
+
lead.onSelect();
|
|
60
|
+
}, children: ["Open ", lead.label] }), _jsx(Button, { size: "sm", variant: "ghost", onClick: onDismiss, children: "Not now" })] })] }));
|
|
61
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { DesktopGill } from "../desktop-layout.js";
|
|
3
|
+
/** One placeable widget, with the App that owns it. */
|
|
4
|
+
export type WidgetChoice = Readonly<{
|
|
5
|
+
gill: DesktopGill;
|
|
6
|
+
appName: string;
|
|
7
|
+
/** Already on the desktop; still choosable, listed after the rest. */
|
|
8
|
+
placed: boolean;
|
|
9
|
+
icon: ReactNode;
|
|
10
|
+
}>;
|
|
11
|
+
/**
|
|
12
|
+
* A floating, searchable list of widgets. It never takes the page's focus
|
|
13
|
+
* away from its search box and stays open so several can be added in a row.
|
|
14
|
+
*/
|
|
15
|
+
export declare function WidgetPicker({ choices, disabled, onChoose, }: {
|
|
16
|
+
choices: readonly WidgetChoice[];
|
|
17
|
+
disabled: boolean;
|
|
18
|
+
onChoose: (gill: DesktopGill) => void;
|
|
19
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Input } from "@fungi.computer/caps/components/input";
|
|
4
|
+
import { Popover, PopoverOption, } from "@fungi.computer/caps/components/popover";
|
|
5
|
+
/**
|
|
6
|
+
* A floating, searchable list of widgets. It never takes the page's focus
|
|
7
|
+
* away from its search box and stays open so several can be added in a row.
|
|
8
|
+
*/
|
|
9
|
+
export function WidgetPicker({ choices, disabled, onChoose, }) {
|
|
10
|
+
const [query, setQuery] = useState("");
|
|
11
|
+
const [active, setActive] = useState(0);
|
|
12
|
+
const needle = query.trim().toLowerCase();
|
|
13
|
+
const shown = choices
|
|
14
|
+
.filter((choice) => `${choice.gill.title} ${choice.appName}`.toLowerCase().includes(needle))
|
|
15
|
+
.sort((a, b) => Number(a.placed) - Number(b.placed));
|
|
16
|
+
const current = Math.min(active, Math.max(0, shown.length - 1));
|
|
17
|
+
const choose = (choice) => {
|
|
18
|
+
if (choice && !disabled)
|
|
19
|
+
onChoose(choice.gill);
|
|
20
|
+
};
|
|
21
|
+
return (_jsxs(Popover, { open: true, side: "top", className: "tourtois-widget-picker", "aria-label": "Add widget", children: [_jsx(Input, { autoFocus: true, "aria-label": "Search widgets", placeholder: "Search widgets", value: query, onChange: (event) => {
|
|
22
|
+
setQuery(event.currentTarget.value);
|
|
23
|
+
setActive(0);
|
|
24
|
+
}, onKeyDown: (event) => {
|
|
25
|
+
if (event.key === "ArrowDown") {
|
|
26
|
+
event.preventDefault();
|
|
27
|
+
setActive(Math.min(shown.length - 1, current + 1));
|
|
28
|
+
}
|
|
29
|
+
else if (event.key === "ArrowUp") {
|
|
30
|
+
event.preventDefault();
|
|
31
|
+
setActive(Math.max(0, current - 1));
|
|
32
|
+
}
|
|
33
|
+
else if (event.key === "Enter") {
|
|
34
|
+
event.preventDefault();
|
|
35
|
+
choose(shown[current]);
|
|
36
|
+
}
|
|
37
|
+
} }), _jsxs("div", { role: "listbox", "aria-label": "Widgets", className: "tourtois-widget-list", children: [shown.map((choice, index) => (_jsxs(PopoverOption, { active: index === current, "aria-label": `${choice.gill.title}, ${choice.appName}`, onClick: () => {
|
|
38
|
+
choose(choice);
|
|
39
|
+
}, children: [_jsx("span", { "aria-hidden": "true", className: "tourtois-widget-icon", children: choice.icon }), _jsxs("span", { className: "tourtois-widget-text", children: [_jsx("span", { children: choice.gill.title }), _jsx("small", { children: choice.appName })] }), choice.placed ? _jsx("small", { children: "On desktop" }) : null] }, `${choice.gill.surfaceId}:${choice.gill.gillId}`))), shown.length === 0 ? (_jsx("p", { className: "tourtois-widget-none", children: "No widgets match." })) : null] })] }));
|
|
40
|
+
}
|
package/dist/desktop-layout.d.ts
CHANGED
|
@@ -92,6 +92,7 @@ export declare const desktopArrangeResultSchema: z.ZodDiscriminatedUnion<[z.ZodO
|
|
|
92
92
|
unknown_app: "unknown_app";
|
|
93
93
|
size_not_allowed: "size_not_allowed";
|
|
94
94
|
unknown_item: "unknown_item";
|
|
95
|
+
last_launcher: "last_launcher";
|
|
95
96
|
too_many: "too_many";
|
|
96
97
|
conflict: "conflict";
|
|
97
98
|
too_large: "too_large";
|
package/dist/desktop-layout.js
CHANGED
|
@@ -78,6 +78,7 @@ export const desktopArrangeResultSchema = z.discriminatedUnion("kind", [
|
|
|
78
78
|
"unknown_app",
|
|
79
79
|
"size_not_allowed",
|
|
80
80
|
"unknown_item",
|
|
81
|
+
"last_launcher",
|
|
81
82
|
"too_many",
|
|
82
83
|
"conflict",
|
|
83
84
|
"too_large",
|
|
@@ -147,8 +148,9 @@ export function initialDesktopLayout(catalog, inboxSurfaceId) {
|
|
|
147
148
|
id: "launcher",
|
|
148
149
|
surfaceId: "tourtois",
|
|
149
150
|
gillId: "launcher",
|
|
150
|
-
|
|
151
|
-
|
|
151
|
+
// Alone, the Launcher is the desktop: wide and centred in four columns.
|
|
152
|
+
size: inbox ? "M" : "L",
|
|
153
|
+
col: inbox ? 2 : 1,
|
|
152
154
|
row: 0,
|
|
153
155
|
},
|
|
154
156
|
],
|
|
@@ -212,6 +214,13 @@ export function applyDesktopOps(current, ops, catalog, launchableAppIds, createI
|
|
|
212
214
|
if (!item)
|
|
213
215
|
return { kind: "rejected", code: "unknown_item" };
|
|
214
216
|
if (op.kind === "remove") {
|
|
217
|
+
// The Launcher is the desktop's one route to every App.
|
|
218
|
+
const isLauncher = (entry) => catalog.some((gill) => gill.kind === "launcher" &&
|
|
219
|
+
gill.surfaceId === entry.surfaceId &&
|
|
220
|
+
gill.gillId === entry.gillId);
|
|
221
|
+
if (isLauncher(item) &&
|
|
222
|
+
!layout.items.some((entry) => entry.id !== item.id && isLauncher(entry)))
|
|
223
|
+
return { kind: "rejected", code: "last_launcher" };
|
|
215
224
|
layout = compactDesktopLayout({
|
|
216
225
|
...layout,
|
|
217
226
|
items: layout.items.filter((entry) => entry.id !== op.id),
|
package/dist/layers.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Close every transient popover through the overlay dismiss channel. A window
|
|
4
|
+
* bar calls this as one of its popovers opens, so two never stack.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useDismissOverlays(): () => void;
|
|
2
7
|
/** Tourtois composes Caps portal destinations with Maosaico's ordered roots. */
|
|
3
8
|
export declare function TourtoisLayers({ children }: {
|
|
4
9
|
children?: ReactNode;
|
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 { useMemo } from "react";
|
|
4
|
+
import { createContext, useContext, useMemo } from "react";
|
|
5
5
|
function OverlayContainers({ children, subscribeDismiss, }) {
|
|
6
6
|
const popover = useLayer("popover");
|
|
7
7
|
const dialog = useLayer("dialog");
|
|
@@ -10,6 +10,14 @@ function OverlayContainers({ children, subscribeDismiss, }) {
|
|
|
10
10
|
const containers = useMemo(() => ({ popover, dialog, toast, tooltip }), [popover, dialog, toast, tooltip]);
|
|
11
11
|
return (_jsx(OverlayRoot, { containers: containers, subscribeDismiss: subscribeDismiss, children: children }));
|
|
12
12
|
}
|
|
13
|
+
const DismissContext = createContext(() => undefined);
|
|
14
|
+
/**
|
|
15
|
+
* Close every transient popover through the overlay dismiss channel. A window
|
|
16
|
+
* bar calls this as one of its popovers opens, so two never stack.
|
|
17
|
+
*/
|
|
18
|
+
export function useDismissOverlays() {
|
|
19
|
+
return useContext(DismissContext);
|
|
20
|
+
}
|
|
13
21
|
/** Tourtois composes Caps portal destinations with Maosaico's ordered roots. */
|
|
14
22
|
export function TourtoisLayers({ children }) {
|
|
15
23
|
const dismissal = useMemo(() => {
|
|
@@ -27,5 +35,5 @@ export function TourtoisLayers({ children }) {
|
|
|
27
35
|
},
|
|
28
36
|
};
|
|
29
37
|
}, []);
|
|
30
|
-
return (_jsx(MaosaicoLayers, { onDismiss: dismissal.dismiss, children: _jsx(OverlayContainers, { subscribeDismiss: dismissal.subscribe, children: children }) }));
|
|
38
|
+
return (_jsx(MaosaicoLayers, { onDismiss: dismissal.dismiss, children: _jsx(DismissContext.Provider, { value: dismissal.dismiss, children: _jsx(OverlayContainers, { subscribeDismiss: dismissal.subscribe, children: children }) }) }));
|
|
31
39
|
}
|
|
@@ -14,6 +14,7 @@ import { z } from "zod";
|
|
|
14
14
|
import { useEffect, useRef, useState } from "react";
|
|
15
15
|
import { createRoot } from "react-dom/client";
|
|
16
16
|
import { connectionAddedSchema, connectionsViewSchema, connectionToolsSchema, createPlatformControls, PlatformControlsView, } from "./platform-controls.js";
|
|
17
|
+
import { createOysterSetupPort, oysterSetupSchema } from "./oyster-setup.js";
|
|
17
18
|
import { modelKeysViewSchema } from "./ModelKeys.js";
|
|
18
19
|
import { settingsLocationSchema } from "./settings-routes.js";
|
|
19
20
|
import { OysterComputers, createOysterComputersPort, } from "./OysterComputers.js";
|
|
@@ -281,6 +282,25 @@ export const mountPlatformControls = (root, input) => {
|
|
|
281
282
|
const computers = () => (_jsx(OysterComputers, { teamId: input.teamId, port: computersPort, onChanged: controls.changed }));
|
|
282
283
|
const websitesPort = createOysterWebsiteChannelsPort(new URL(window.location.origin));
|
|
283
284
|
const channels = () => (_jsx(WebsiteChannels, { port: websitesPort, copy: oysterWebsiteCopy }));
|
|
285
|
+
const setup = createOysterSetupPort({
|
|
286
|
+
readFacts: async () => oysterSetupSchema.parse(await json("/api/setup")),
|
|
287
|
+
openSettings: (location) => {
|
|
288
|
+
controls.openSettings(location, { restoreFocus: false });
|
|
289
|
+
},
|
|
290
|
+
subscribeSettingsClosed: controls.subscribeSettingsClosed,
|
|
291
|
+
});
|
|
292
|
+
// A key added or removed changes what is ready before Settings closes.
|
|
293
|
+
const trackedModelKeys = {
|
|
294
|
+
...modelKeys,
|
|
295
|
+
addKey: async (draft) => {
|
|
296
|
+
await modelKeys.addKey(draft);
|
|
297
|
+
setup.changed();
|
|
298
|
+
},
|
|
299
|
+
removeKey: async (keyId) => {
|
|
300
|
+
await modelKeys.removeKey(keyId);
|
|
301
|
+
setup.changed();
|
|
302
|
+
},
|
|
303
|
+
};
|
|
284
304
|
const client = createQueryClient();
|
|
285
305
|
const settings = createRoot(root);
|
|
286
306
|
settings.render(_jsx(QueryClientProvider, { client: client, children: _jsx(PlatformControlsView, { teamId: input.teamId, controls: controls, data: {
|
|
@@ -289,13 +309,14 @@ export const mountPlatformControls = (root, input) => {
|
|
|
289
309
|
computers,
|
|
290
310
|
channels,
|
|
291
311
|
keys,
|
|
292
|
-
modelKeys,
|
|
312
|
+
modelKeys: trackedModelKeys,
|
|
293
313
|
requestAppAccess,
|
|
294
314
|
appPermissions: OysterAppPermissions,
|
|
295
315
|
} }) }));
|
|
296
316
|
return Promise.resolve({
|
|
297
317
|
controls: {
|
|
298
318
|
...controls,
|
|
319
|
+
setup,
|
|
299
320
|
parseSettings: (value) => S.decodeUnknownSync(S.Json)(settingsLocationSchema.parse(value)),
|
|
300
321
|
openSettings: (value, options) => {
|
|
301
322
|
controls.openSettings(settingsLocationSchema.parse(value), options);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { AppSetup, SetupNeed } from "@fungi.computer/agar";
|
|
2
|
+
import type { WorkbenchSetupPort } from "@fungi.computer/nacre/workbench";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import type { SettingsLocation } from "./settings-routes.js";
|
|
5
|
+
/** The owner-direct `/api/setup` reply, decoded before any App sees it. */
|
|
6
|
+
export declare const oysterSetupSchema: z.ZodObject<{
|
|
7
|
+
models: z.ZodEnum<{
|
|
8
|
+
missing: "missing";
|
|
9
|
+
ready: "ready";
|
|
10
|
+
unknown: "unknown";
|
|
11
|
+
}>;
|
|
12
|
+
media: z.ZodEnum<{
|
|
13
|
+
missing: "missing";
|
|
14
|
+
ready: "ready";
|
|
15
|
+
unknown: "unknown";
|
|
16
|
+
}>;
|
|
17
|
+
git: z.ZodEnum<{
|
|
18
|
+
missing: "missing";
|
|
19
|
+
ready: "ready";
|
|
20
|
+
unknown: "unknown";
|
|
21
|
+
}>;
|
|
22
|
+
terminal: z.ZodEnum<{
|
|
23
|
+
missing: "missing";
|
|
24
|
+
ready: "ready";
|
|
25
|
+
unknown: "unknown";
|
|
26
|
+
"exec-only": "exec-only";
|
|
27
|
+
}>;
|
|
28
|
+
}, z.core.$strict>;
|
|
29
|
+
/** Where each need is fixed in this host's Settings. */
|
|
30
|
+
export declare function settingsForNeed(need: SetupNeed): SettingsLocation;
|
|
31
|
+
export type OysterSetupDeps = Readonly<{
|
|
32
|
+
/** The host facts, already decoded with `oysterSetupSchema`. */
|
|
33
|
+
readFacts(): Promise<AppSetup>;
|
|
34
|
+
openSettings(location: SettingsLocation): void;
|
|
35
|
+
/** Settings closing is when a freshly added key becomes visible. */
|
|
36
|
+
subscribeSettingsClosed(listener: () => void): () => void;
|
|
37
|
+
}>;
|
|
38
|
+
/** The setup port: facts read live, plus the Settings page for each need. */
|
|
39
|
+
export declare function createOysterSetupPort(deps: OysterSetupDeps): WorkbenchSetupPort & Readonly<{
|
|
40
|
+
changed(): void;
|
|
41
|
+
}>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const state = z.enum(["ready", "missing", "unknown"]);
|
|
3
|
+
/** The owner-direct `/api/setup` reply, decoded before any App sees it. */
|
|
4
|
+
export const oysterSetupSchema = z.strictObject({
|
|
5
|
+
models: state,
|
|
6
|
+
media: state,
|
|
7
|
+
git: state,
|
|
8
|
+
terminal: z.enum(["ready", "exec-only", "missing", "unknown"]),
|
|
9
|
+
});
|
|
10
|
+
/** Where each need is fixed in this host's Settings. */
|
|
11
|
+
export function settingsForNeed(need) {
|
|
12
|
+
// Models and media both come from a key; git and a runtime from Computers.
|
|
13
|
+
return need === "model" || need === "media"
|
|
14
|
+
? { category: "keys" }
|
|
15
|
+
: { category: "computers" };
|
|
16
|
+
}
|
|
17
|
+
/** The setup port: facts read live, plus the Settings page for each need. */
|
|
18
|
+
export function createOysterSetupPort(deps) {
|
|
19
|
+
const listeners = new Set();
|
|
20
|
+
const changed = () => {
|
|
21
|
+
for (const listener of listeners)
|
|
22
|
+
listener();
|
|
23
|
+
};
|
|
24
|
+
deps.subscribeSettingsClosed(changed);
|
|
25
|
+
return {
|
|
26
|
+
read: () => deps.readFacts(),
|
|
27
|
+
subscribe: (listener) => {
|
|
28
|
+
listeners.add(listener);
|
|
29
|
+
return () => {
|
|
30
|
+
listeners.delete(listener);
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
open: (need) => {
|
|
34
|
+
deps.openSettings(settingsForNeed(need));
|
|
35
|
+
return Promise.resolve("opened");
|
|
36
|
+
},
|
|
37
|
+
changed,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -18,6 +18,8 @@ export { type KeyAppOption, type KeyGrantOption, type KeyGrantPreviewProps, type
|
|
|
18
18
|
*/
|
|
19
19
|
export type PlatformControls = Readonly<{
|
|
20
20
|
openSettings: (location: SettingsLocation) => void;
|
|
21
|
+
/** Settings the host backs with real data; undefined means all of them. */
|
|
22
|
+
sections?: readonly SettingsLocation["category"][] | undefined;
|
|
21
23
|
registerDesktopSettings: (handler: WorkbenchDesktopSettings) => Promise<WorkbenchDesktopRegistration>;
|
|
22
24
|
/** Observe Team App changes these controls made, to refresh a directory. */
|
|
23
25
|
subscribeChanges: (listener: () => void) => () => void;
|
|
@@ -225,7 +225,14 @@ export function PlatformControlsView({ teamId, controls, data, }) {
|
|
|
225
225
|
},
|
|
226
226
|
};
|
|
227
227
|
const requestAppAccess = data.requestAppAccess;
|
|
228
|
-
|
|
228
|
+
const refreshAfterGrant = async (outcome) => {
|
|
229
|
+
const settled = await outcome;
|
|
230
|
+
// The admitted App re-reads its grants and context without a reload.
|
|
231
|
+
if (settled === "granted")
|
|
232
|
+
controls.changed();
|
|
233
|
+
return settled;
|
|
234
|
+
};
|
|
235
|
+
const ask = requestAppAccess === undefined
|
|
229
236
|
? async (target, input) => {
|
|
230
237
|
const current = await data.directory();
|
|
231
238
|
const app = current.apps.find((candidate) => candidate.surfaceId === target.surfaceId);
|
|
@@ -251,7 +258,9 @@ export function PlatformControlsView({ teamId, controls, data, }) {
|
|
|
251
258
|
});
|
|
252
259
|
return outcome === "customize" ? openSettings() : outcome;
|
|
253
260
|
}
|
|
254
|
-
: (target, input) => requestAppAccess(target, input, dialog)
|
|
261
|
+
: (target, input) => requestAppAccess(target, input, dialog);
|
|
262
|
+
const attached = controls.attach((target, input) => refreshAfterGrant(ask(target, input)));
|
|
263
|
+
return attached;
|
|
255
264
|
}, [controls, data]);
|
|
256
265
|
const settings = (_jsxs(_Fragment, { children: [_jsx(RouterProvider, { router: controls.router }), _jsx(AppAccessConsent, { request: consent }), _jsx(DeferredSystemSettings, { location: location, sections: controls.sections, onNavigate: (next) => {
|
|
257
266
|
controls.navigate(next);
|
package/dist/shell.css
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
@import "./chrome.css";
|
|
2
2
|
@import "./spa.css";
|
|
3
3
|
@import "./settings-navigation.css";
|
|
4
|
+
@import "./desktop/arrange.css";
|
|
5
|
+
@import "./desktop/welcome.css";
|
|
4
6
|
|
|
5
7
|
/* SH-1: a 32px desktop menu bar on desktop widths, matching the window
|
|
6
8
|
title bar and footer so the three chrome bars read as one system.
|
|
@@ -101,6 +103,26 @@
|
|
|
101
103
|
padding: var(--spacing-md);
|
|
102
104
|
}
|
|
103
105
|
|
|
106
|
+
.tourtois-app-consent-rights {
|
|
107
|
+
margin: 0;
|
|
108
|
+
padding-inline-start: var(--spacing-lg);
|
|
109
|
+
list-style: disc;
|
|
110
|
+
display: flex;
|
|
111
|
+
flex-direction: column;
|
|
112
|
+
gap: var(--spacing-xs);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.tourtois-app-consent-footer {
|
|
116
|
+
justify-content: space-between;
|
|
117
|
+
align-items: center;
|
|
118
|
+
margin-top: var(--spacing-sm);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.tourtois-app-consent-decision {
|
|
122
|
+
display: flex;
|
|
123
|
+
gap: var(--spacing-sm);
|
|
124
|
+
}
|
|
125
|
+
|
|
104
126
|
.tourtois-settings-layout {
|
|
105
127
|
display: grid;
|
|
106
128
|
grid-template-columns: 9rem minmax(0, 1fr);
|
|
@@ -734,24 +756,14 @@
|
|
|
734
756
|
overflow: auto;
|
|
735
757
|
padding: 16px;
|
|
736
758
|
}
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
}
|
|
743
|
-
.tourtois-desktop-controls {
|
|
744
|
-
margin-bottom: 16px;
|
|
745
|
-
}
|
|
746
|
-
.tourtois-desktop-add-gill {
|
|
747
|
-
width: 11rem;
|
|
748
|
-
flex: 0 0 auto;
|
|
759
|
+
/* The recovery card sits mid-desktop, bounded like any panel EmptyState. */
|
|
760
|
+
.tourtois-desktop-empty {
|
|
761
|
+
display: grid;
|
|
762
|
+
place-items: center;
|
|
763
|
+
min-height: 60%;
|
|
749
764
|
}
|
|
750
|
-
.tourtois-
|
|
751
|
-
|
|
752
|
-
flex-wrap: nowrap;
|
|
753
|
-
align-items: center;
|
|
754
|
-
gap: 4px;
|
|
765
|
+
.tourtois-desktop-empty > .empty-state {
|
|
766
|
+
width: min(100%, 32rem);
|
|
755
767
|
}
|
|
756
768
|
.tourtois-gill-sizes {
|
|
757
769
|
display: inline-flex;
|
|
@@ -806,9 +818,6 @@
|
|
|
806
818
|
}
|
|
807
819
|
|
|
808
820
|
@media (max-width: 640px), (any-pointer: coarse) {
|
|
809
|
-
.tourtois-gill-sizes {
|
|
810
|
-
gap: 20px;
|
|
811
|
-
}
|
|
812
821
|
/* Reset Caps join composition when its expanded touch targets apply. */
|
|
813
822
|
.tourtois-gill-sizes > .join-item {
|
|
814
823
|
--join-ss: initial;
|
package/dist/status-bar.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { AppStatusItem } from "@fungi.computer/caps/blocks/app-status-bar";
|
|
4
|
-
import { Button, } from "@fungi.computer/caps/components/button";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useDismissOverlays } from "./layers.js";
|
|
3
|
+
import { AppStatusItem, StatusBarChip, } from "@fungi.computer/caps/blocks/app-status-bar";
|
|
5
4
|
import { CountBadge } from "@fungi.computer/caps/components/count-badge";
|
|
6
5
|
import { Status } from "@fungi.computer/caps/components/status";
|
|
7
6
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "@fungi.computer/caps/components/dropdown-menu";
|
|
@@ -12,14 +11,6 @@ const statusIcons = {
|
|
|
12
11
|
processes: _jsx(Activity, { "aria-hidden": "true" }),
|
|
13
12
|
access: _jsx(ShieldCheck, { "aria-hidden": "true" }),
|
|
14
13
|
};
|
|
15
|
-
/**
|
|
16
|
-
* The one control every App status action draws with: a flat chip beside
|
|
17
|
-
* the Computer picker, never a raised key. Caps' status-bar chip replaces
|
|
18
|
-
* this composition when it ships.
|
|
19
|
-
*/
|
|
20
|
-
const StatusBarButton = forwardRef(function StatusBarButton({ label, icon, count, light, pressed, expanded, ...props }, ref) {
|
|
21
|
-
return (_jsxs(Button, { ...props, ref: ref, variant: "ghost", size: "xs", className: "caps-status-bar-picker tourtois-status-chip", ...(pressed === undefined ? {} : { "aria-pressed": pressed }), ...(expanded === undefined ? {} : { "aria-expanded": expanded }), children: [icon, light, _jsx("span", { className: "caps-status-bar-picker-label tourtois-status-chip-label", children: label }), count] }));
|
|
22
|
-
});
|
|
23
14
|
/** One App-declared status item, drawn by the shell as a flat status chip. */
|
|
24
15
|
export function WindowStatusItem({ item, container, onAction, anchorFor, }) {
|
|
25
16
|
const count = (item.kind === "button" || item.kind === "menu") &&
|
|
@@ -31,23 +22,33 @@ export function WindowStatusItem({ item, container, onAction, anchorFor, }) {
|
|
|
31
22
|
case "text":
|
|
32
23
|
return item.tone === undefined ? (_jsx(AppStatusItem, { role: "status", children: item.text })) : (_jsx(Status, { size: "compact", tone: item.tone, label: item.text }));
|
|
33
24
|
case "button":
|
|
34
|
-
return (_jsx(
|
|
25
|
+
return (_jsx(StatusBarChip, { label: item.text, icon: item.icon === undefined && light === undefined ? undefined : (_jsxs(_Fragment, { children: [item.icon === undefined ? null : statusIcons[item.icon], light] })), readout: count, title: item.title ?? item.text, disabled: item.disabled, "aria-haspopup": item.opens, ...(item.expanded === undefined ? {} : { expanded: item.expanded }), onClick: (event) => {
|
|
35
26
|
const anchor = anchorFor(event.currentTarget);
|
|
36
27
|
onAction(anchor === undefined
|
|
37
28
|
? { itemId: item.id }
|
|
38
29
|
: { itemId: item.id, anchor });
|
|
39
30
|
} }));
|
|
40
31
|
case "toggle":
|
|
41
|
-
return (_jsx(
|
|
32
|
+
return (_jsx(StatusBarChip, { label: item.text, pressed: item.pressed, onClick: () => {
|
|
42
33
|
onAction({ itemId: item.id });
|
|
43
34
|
} }));
|
|
44
35
|
case "menu":
|
|
45
36
|
// An App's menu is a plain chip: only the host's picker wears the
|
|
46
37
|
// up-down mark, so an App can't pass a menu off as the Computer.
|
|
47
|
-
return (
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
onAction({ itemId: item.id, optionId: option.id });
|
|
51
|
-
}, children: [_jsx("span", { className: "flex-1", children: option.text }), option.checked === true ? (_jsx(Check, { "aria-hidden": "true", size: 16 })) : null] }, option.id))) })] }));
|
|
38
|
+
return (_jsx(StatusMenu, { label: item.text, readout: count, title: item.title, container: container, options: item.options, onSelect: (optionId) => {
|
|
39
|
+
onAction({ itemId: item.id, optionId });
|
|
40
|
+
} }));
|
|
52
41
|
}
|
|
53
42
|
}
|
|
43
|
+
/** An App's menu chip; it shares the bar's one-open-popover rule. */
|
|
44
|
+
function StatusMenu({ label, readout, title, container, options, onSelect, }) {
|
|
45
|
+
const dismissOthers = useDismissOverlays();
|
|
46
|
+
return (_jsxs(DropdownMenu, { modal: false, onOpenChange: (open) => {
|
|
47
|
+
if (open)
|
|
48
|
+
dismissOthers();
|
|
49
|
+
}, children: [_jsx(DropdownMenuTrigger, { render: _jsx(StatusBarChip, { label: label, readout: readout, title: title }) }), _jsx(DropdownMenuContent, { container: container, align: "start", children: options.map((option) => (_jsxs(DropdownMenuItem, { disabled: option.disabled, ...(option.checked === undefined
|
|
50
|
+
? {}
|
|
51
|
+
: { role: "menuitemradio", "aria-checked": option.checked }), onSelect: () => {
|
|
52
|
+
onSelect(option.id);
|
|
53
|
+
}, children: [_jsx("span", { className: "flex-1", children: option.text }), option.checked === true ? (_jsx(Check, { "aria-hidden": "true", size: 16 })) : null] }, option.id))) })] }));
|
|
54
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/tourtois",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
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,18 +77,18 @@
|
|
|
77
77
|
"LICENSE"
|
|
78
78
|
],
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@fungi.computer/agar": "0.
|
|
80
|
+
"@fungi.computer/agar": "0.9.0",
|
|
81
81
|
"@fungi.computer/cairn": "0.1.0",
|
|
82
|
-
"@fungi.computer/caps": "0.
|
|
82
|
+
"@fungi.computer/caps": "0.9.0",
|
|
83
83
|
"@fungi.computer/ear-tag": "0.1.0",
|
|
84
|
-
"@fungi.computer/gills": "0.
|
|
84
|
+
"@fungi.computer/gills": "0.3.0",
|
|
85
85
|
"@fungi.computer/maosaico": "0.1.1",
|
|
86
|
-
"@fungi.computer/parakeet": "0.
|
|
87
|
-
"@fungi.computer/puffball": "0.5.
|
|
88
|
-
"@fungi.computer/shiitake": "0.12.
|
|
86
|
+
"@fungi.computer/parakeet": "0.10.0",
|
|
87
|
+
"@fungi.computer/puffball": "0.5.5",
|
|
88
|
+
"@fungi.computer/shiitake": "0.12.3",
|
|
89
89
|
"@fungi.computer/sigils": "0.3.0",
|
|
90
|
-
"@fungi.computer/sprite": "0.2.
|
|
91
|
-
"@fungi.computer/sprite-zdog": "0.3.
|
|
90
|
+
"@fungi.computer/sprite": "0.2.2",
|
|
91
|
+
"@fungi.computer/sprite-zdog": "0.3.2",
|
|
92
92
|
"@fungi.computer/whistle": "0.3.0",
|
|
93
93
|
"@tanstack/history": "1.162.1",
|
|
94
94
|
"@tanstack/react-form": "1.33.2",
|
|
@@ -100,16 +100,16 @@
|
|
|
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.
|
|
103
|
+
"@fungi.computer/nacre": "0.3.0"
|
|
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.16.0",
|
|
110
110
|
"@cloudflare/workers-types": "5.20260828.1",
|
|
111
|
-
"@fungi.computer/forage": "0.3.
|
|
112
|
-
"@fungi.computer/mycelium": "0.3.
|
|
111
|
+
"@fungi.computer/forage": "0.3.5",
|
|
112
|
+
"@fungi.computer/mycelium": "0.3.8",
|
|
113
113
|
"@ladle/react": "5.1.1",
|
|
114
114
|
"@types/react": "18.3.3",
|
|
115
115
|
"@vitejs/plugin-react": "6.1.1",
|
|
@@ -147,6 +147,13 @@
|
|
|
147
147
|
"member"
|
|
148
148
|
],
|
|
149
149
|
"maxBytes": 16384
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"key": "welcome",
|
|
153
|
+
"scopes": [
|
|
154
|
+
"member"
|
|
155
|
+
],
|
|
156
|
+
"maxBytes": 256
|
|
150
157
|
}
|
|
151
158
|
],
|
|
152
159
|
"backend": {
|
|
@@ -233,14 +240,14 @@
|
|
|
233
240
|
"clean": "node --input-type=module --eval \"import { rm } from 'node:fs/promises'; await rm('dist', { recursive: true, force: true });\"",
|
|
234
241
|
"lint": "eslint src backend test workbench .ladle --max-warnings=0 && oxlint --config ../../oxlint.config.ts --deny-warnings src backend test workbench .ladle",
|
|
235
242
|
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.workbench.json && tsc -p backend/tsconfig.json && tsc -p test/workerd/tsconfig.json",
|
|
236
|
-
"build": "pnpm run clean && tsc -p tsconfig.build.json && cp src/shell.css src/chrome.css src/spa.css src/settings-navigation.css dist/",
|
|
243
|
+
"build": "pnpm run clean && tsc -p tsconfig.build.json && cp src/shell.css src/chrome.css src/spa.css src/settings-navigation.css dist/ && mkdir -p dist/desktop && cp src/desktop/arrange.css src/desktop/welcome.css dist/desktop/",
|
|
237
244
|
"build:spa": "vite build",
|
|
238
245
|
"dev": "vite",
|
|
239
246
|
"workbench": "ladle serve --host 127.0.0.1 --port 61001",
|
|
240
247
|
"workbench:build": "ladle build --outDir ../../.botanical/tourtois-ladle",
|
|
241
248
|
"test:overlay-layering": "node test/overlay-layering.browser.mjs",
|
|
242
249
|
"test:window-new-version": "node test/window-new-version.browser.mjs",
|
|
243
|
-
"test:workbench": "node test/workbench.browser.mjs && node test/desktop-gills.browser.mjs && node test/app-directory-isolation.browser.mjs && node test/workflows-launcher-icon.browser.mjs && node test/landing-bugs.browser.mjs && node test/show-desktop.browser.mjs && node test/window-stack.browser.mjs && node test/window-chrome-back.browser.mjs && node test/app-bar-menu.browser.mjs && node test/launcher-gill.browser.mjs && node test/desktop-storage.browser.mjs && node test/desktop-method-editing.browser.mjs && node test/phone-layout.browser.mjs && node test/phone-app-switcher.browser.mjs && node test/computer-choice.browser.mjs && node test/window-resize.browser.mjs",
|
|
250
|
+
"test:workbench": "node test/workbench.browser.mjs && node test/desktop-gills.browser.mjs && node test/app-directory-isolation.browser.mjs && node test/workflows-launcher-icon.browser.mjs && node test/landing-bugs.browser.mjs && node test/show-desktop.browser.mjs && node test/window-stack.browser.mjs && node test/window-chrome-back.browser.mjs && node test/app-bar-menu.browser.mjs && node test/launcher-gill.browser.mjs && node test/desktop-storage.browser.mjs && node test/desktop-method-editing.browser.mjs && node test/arrange-layout-shift.browser.mjs && node test/phone-layout.browser.mjs && node test/phone-app-switcher.browser.mjs && node test/computer-choice.browser.mjs && node test/window-resize.browser.mjs",
|
|
244
251
|
"test": "pnpm run test:unit && pnpm run test:merge",
|
|
245
252
|
"test:settings-icons": "node --import tsx ../../tooling/repository/scripts/workbench-proofs.mjs --output ../../.botanical/tourtois-ladle --origin-env TOURTOIS_WORKBENCH_URL test/settings-icons.browser.mjs",
|
|
246
253
|
"format:check": "node ../../tooling/repository/scripts/format-package-check.mjs",
|