@mcp-b/react-components 0.64.1 → 0.66.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.
Files changed (116) hide show
  1. package/dist/AgentComputer-2uYB8kmu.js +8084 -0
  2. package/dist/{ExecutionResult-CXnGcmM4.js → ExecutionResult-C7SzVquo.js} +1 -1
  3. package/dist/WallpaperPicker-C-FItmDS.d.ts +34 -0
  4. package/dist/WorkspaceBrowser-Dz48H-7X.d.ts +89 -0
  5. package/dist/{WorkspaceFileCommands-SNIjRgtU.d.ts → WorkspaceFileCommands-1s9Ol8CG.d.ts} +11 -3
  6. package/dist/{WorkspaceMessageResponse-CXGOQgpo.js → WorkspaceMessageResponse-BoeeltJM.js} +1 -1
  7. package/dist/assets/wallpapers/README.md +31 -0
  8. package/dist/assets/wallpapers/alpine.webp +0 -0
  9. package/dist/assets/wallpapers/dusk.webp +0 -0
  10. package/dist/assets/wallpapers/ember.webp +0 -0
  11. package/dist/assets/wallpapers/graphite.webp +0 -0
  12. package/dist/assets/wallpapers/sigvelo.webp +0 -0
  13. package/dist/assets/wallpapers/tide.webp +0 -0
  14. package/dist/automations-host-DPORjdc7.js +17 -0
  15. package/dist/components/agents-sdk/AgentComputer.d.ts +7 -1
  16. package/dist/components/agents-sdk/AgentComputer.js +1 -8044
  17. package/dist/components/agents-sdk/AgentScreenSwitcher.js +1 -0
  18. package/dist/components/agents-sdk/BrowserLiveScreen.d.ts +7 -1
  19. package/dist/components/agents-sdk/BrowserLiveScreen.js +259 -257
  20. package/dist/components/agents-sdk/BrowserRunPanel.d.ts +2 -0
  21. package/dist/components/agents-sdk/BrowserRunPanel.js +1 -0
  22. package/dist/components/agents-sdk/ComputerAutomations.d.ts +70 -0
  23. package/dist/components/agents-sdk/ComputerAutomations.js +1410 -0
  24. package/dist/components/agents-sdk/ComputerCalendar.d.ts +7 -0
  25. package/dist/components/agents-sdk/ComputerCalendar.js +1344 -0
  26. package/dist/components/agents-sdk/ComputerFiles.d.ts +153 -0
  27. package/dist/components/agents-sdk/ComputerFiles.js +2401 -0
  28. package/dist/components/agents-sdk/ComputerHome.d.ts +15 -0
  29. package/dist/components/agents-sdk/ComputerHome.js +90 -0
  30. package/dist/components/agents-sdk/ComputerNotifications.d.ts +54 -0
  31. package/dist/components/agents-sdk/ComputerNotifications.js +692 -0
  32. package/dist/components/agents-sdk/ComputerScreen.d.ts +78 -0
  33. package/dist/components/agents-sdk/ComputerScreen.js +750 -0
  34. package/dist/components/agents-sdk/ComputerSettings.d.ts +69 -0
  35. package/dist/components/agents-sdk/ComputerSettings.js +1371 -0
  36. package/dist/components/agents-sdk/ComputerSpotlight.d.ts +29 -0
  37. package/dist/components/agents-sdk/ComputerSpotlight.js +232 -0
  38. package/dist/components/agents-sdk/ComputerViewer.d.ts +51 -0
  39. package/dist/components/agents-sdk/ComputerViewer.js +339 -0
  40. package/dist/components/agents-sdk/ComputerWallpapers.d.ts +11 -0
  41. package/dist/components/agents-sdk/ComputerWallpapers.js +43 -0
  42. package/dist/components/agents-sdk/EmployeeApp.js +1 -1
  43. package/dist/components/agents-sdk/EmployeeChat.js +1 -1
  44. package/dist/components/agents-sdk/EmployeeChrome.js +4 -4
  45. package/dist/components/agents-sdk/EmployeeSchedules.js +3 -3
  46. package/dist/components/agents-sdk/EmployeeStartScreen.js +1 -1
  47. package/dist/components/agents-sdk/ExecutionBoard.js +1 -1
  48. package/dist/components/agents-sdk/ManagerOffice.js +1 -1
  49. package/dist/components/agents-sdk/ManagerOfficeScreens.js +1 -1
  50. package/dist/components/agents-sdk/McpPluginCatalog.js +1 -1
  51. package/dist/components/agents-sdk/ModelSelector.js +1 -1
  52. package/dist/components/agents-sdk/ThinkChat.js +1 -1
  53. package/dist/components/agents-sdk/ThinkChatActivitySummary.js +1 -1
  54. package/dist/components/agents-sdk/ThinkChatToolPanels.js +5 -5
  55. package/dist/components/agents-sdk/ThinkExecutionWorkbench.js +3 -3
  56. package/dist/components/agents-sdk/ThinkFullApp.d.ts +13 -0
  57. package/dist/components/agents-sdk/ThinkFullApp.js +13 -0
  58. package/dist/components/agents-sdk/ThinkScheduleActions.js +1 -1
  59. package/dist/components/agents-sdk/ThinkScheduleDetail.js +3 -3
  60. package/dist/components/agents-sdk/ThinkScheduleForm.js +4 -4
  61. package/dist/components/agents-sdk/WorkspaceAutomation.js +4 -4
  62. package/dist/components/agents-sdk/WorkspaceAutomationTable.js +1 -1
  63. package/dist/components/agents-sdk/WorkspaceBrowser.d.ts +2 -88
  64. package/dist/components/agents-sdk/WorkspaceCorrespondence.js +1 -1
  65. package/dist/components/agents-sdk/WorkspaceDesktop.d.ts +1 -1
  66. package/dist/components/agents-sdk/WorkspaceDocumentFrame.d.ts +17 -0
  67. package/dist/components/agents-sdk/WorkspaceDocumentFrame.js +90 -0
  68. package/dist/components/agents-sdk/WorkspaceExplorer.d.ts +4 -1
  69. package/dist/components/agents-sdk/WorkspaceExplorer.js +70 -66
  70. package/dist/components/agents-sdk/WorkspaceFileCommands.d.ts +2 -2
  71. package/dist/components/agents-sdk/WorkspaceFileCommands.js +346 -316
  72. package/dist/components/agents-sdk/WorkspaceFileView.d.ts +7 -1
  73. package/dist/components/agents-sdk/WorkspaceFileView.js +83 -71
  74. package/dist/components/agents-sdk/WorkspaceLink.js +1 -1
  75. package/dist/components/agents-sdk/WorkspaceLive.d.ts +2 -4
  76. package/dist/components/agents-sdk/WorkspaceLive.js +18 -11
  77. package/dist/components/agents-sdk/WorkspaceMessageResponse.js +1 -1
  78. package/dist/components/agents-sdk/WorkspaceProject.d.ts +2 -1
  79. package/dist/components/agents-sdk/WorkspaceProject.js +7 -4
  80. package/dist/components/ai-sdk/ConnectedAppCards.js +1 -1
  81. package/dist/components/ai-sdk/Goal.d.ts +1 -2
  82. package/dist/components/ai-sdk/Goal.js +1 -2
  83. package/dist/components/extension/FirstRunSetup.d.ts +132 -37
  84. package/dist/components/extension/FirstRunSetup.js +1920 -1567
  85. package/dist/components/general-purpose/CommandPalette.d.ts +6 -1
  86. package/dist/components/general-purpose/CommandPalette.js +90 -82
  87. package/dist/components/general-purpose/ResponsiveSidebarShell.js +1 -1
  88. package/dist/components/general-purpose/StatusScreen.d.ts +6 -1
  89. package/dist/components/general-purpose/StatusScreen.js +44 -36
  90. package/dist/components/general-purpose/ThemeModeControl.js +1 -1
  91. package/dist/components/general-purpose/WallpaperPicker.d.ts +2 -33
  92. package/dist/components/nanites/AgentConnection.js +1 -1
  93. package/dist/parts-BxJC0QVb.js +112 -0
  94. package/dist/styles/agent-computer.css +28 -0
  95. package/dist/styles/base.css +6 -0
  96. package/dist/styles/chatgpt-sign-in-screen.css +2 -0
  97. package/dist/styles/computer-app-tile.css +20 -0
  98. package/dist/styles/computer-automations.css +454 -0
  99. package/dist/styles/computer-calendar.css +648 -0
  100. package/dist/styles/computer-files.css +566 -0
  101. package/dist/styles/computer-home.css +90 -0
  102. package/dist/styles/computer-notifications.css +242 -0
  103. package/dist/styles/computer-screen.css +89 -0
  104. package/dist/styles/computer-settings.css +550 -0
  105. package/dist/styles/computer-spotlight.css +7 -0
  106. package/dist/styles/computer-viewer.css +130 -0
  107. package/dist/styles/first-run-setup.css +107 -96
  108. package/dist/styles/index.css +11 -0
  109. package/dist/styles/recipes.css +42 -0
  110. package/dist/styles/select.css +2 -1
  111. package/dist/styles/switch.css +20 -5
  112. package/dist/styles/workspace-document-frame.css +31 -0
  113. package/package.json +2 -2
  114. package/dist/{ManagerOffice-T79utm-P.js → ManagerOffice-kSK7vTBl.js} +1 -1
  115. package/dist/{WorkspaceLink-DDkj-Tq5.js → WorkspaceLink-DK9kdMUH.js} +1 -1
  116. package/dist/{connected-app-drafts-Bocdg3Z-.js → connected-app-drafts-C49343p9.js} +1 -1
@@ -0,0 +1,29 @@
1
+ import { AgentComputerApp } from "./AgentComputer.js";
2
+ import { CommandPaletteCommand } from "../general-purpose/CommandPalette.js";
3
+ import * as React from "react";
4
+ //#region src/components/agents-sdk/ComputerSpotlight.d.ts
5
+ /** ⌘K, and ⌥Space standing in for Spotlight's ⌘Space, which macOS keeps. */
6
+ export declare const COMPUTER_SPOTLIGHT_SHORTCUT: {
7
+ glyph: string;
8
+ aria: string;
9
+ };
10
+ export interface ComputerSpotlightProps {
11
+ /** The computer's apps, listed first. Windows owned by another app and hidden apps are left out. */
12
+ apps: readonly AgentComputerApp[];
13
+ /**
14
+ * The host's results for this query: files, conversations, actions. Called
15
+ * when search opens and as the query changes; the latest call wins, and a
16
+ * rejection offers a retry. Results still pass the palette's own match, so
17
+ * each names what matched in its label, description or keywords.
18
+ */
19
+ search: (query: string) => Promise<readonly CommandPaletteCommand[]>;
20
+ open: boolean;
21
+ onOpenChange: (open: boolean) => void;
22
+ }
23
+ /**
24
+ * Spotlight for `AgentComputer`'s `status`: a menu-bar trigger, the ⌘K, ⌃K and
25
+ * ⌥Space shortcuts within this computer, and `CommandPalette` over the apps
26
+ * and the host's results. It centres on this screen and blocks only it.
27
+ */
28
+ export declare function ComputerSpotlight({ apps, search, open, onOpenChange }: ComputerSpotlightProps): React.JSX.Element;
29
+ //#endregion
@@ -0,0 +1,232 @@
1
+ import { tt as SearchIcon } from "../../icons-nLTnB9kd.js";
2
+ import { Button } from "../foundations/Button.js";
3
+ import { IconButton } from "../foundations/IconButton.js";
4
+ import { AppIcon } from "../foundations/AppIcon.js";
5
+ import { i as useAgentComputerPortalContainer, n as useAgentComputerActions } from "../../AgentComputer-2uYB8kmu.js";
6
+ import { CommandPalette } from "../general-purpose/CommandPalette.js";
7
+ import { c } from "react/compiler-runtime";
8
+ import * as React from "react";
9
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
+ //#region src/components/agents-sdk/ComputerSpotlight.tsx
11
+ /** ⌘K, and ⌥Space standing in for Spotlight's ⌘Space, which macOS keeps. */
12
+ const COMPUTER_SPOTLIGHT_SHORTCUT = {
13
+ glyph: "⌘K or ⌥Space",
14
+ aria: "Meta+K Control+K Alt+Space"
15
+ };
16
+ /**
17
+ * Spotlight for `AgentComputer`'s `status`: a menu-bar trigger, the ⌘K, ⌃K and
18
+ * ⌥Space shortcuts within this computer, and `CommandPalette` over the apps
19
+ * and the host's results. It centres on this screen and blocks only it.
20
+ */
21
+ function ComputerSpotlight(t0) {
22
+ const $ = c(42);
23
+ const { apps, search, open, onOpenChange } = t0;
24
+ const { openApp } = useAgentComputerActions();
25
+ const container = useAgentComputerPortalContainer();
26
+ const trigger = React.useRef(null);
27
+ const [query, setQuery] = React.useState("");
28
+ const [attempt, setAttempt] = React.useState(0);
29
+ let t1;
30
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
31
+ t1 = {
32
+ request: null,
33
+ status: "done",
34
+ commands: []
35
+ };
36
+ $[0] = t1;
37
+ } else t1 = $[0];
38
+ const [results, setResults] = React.useState(t1);
39
+ const request = `${attempt}:${query}`;
40
+ const status = results.request === request ? results.status : "loading";
41
+ let t2;
42
+ if ($[1] !== query || $[2] !== request || $[3] !== search) {
43
+ t2 = (signal) => {
44
+ search(query).then((commands) => !signal.stale && setResults({
45
+ request,
46
+ status: "done",
47
+ commands
48
+ }), () => !signal.stale && setResults((current) => ({
49
+ request,
50
+ status: "error",
51
+ commands: current.commands
52
+ })));
53
+ };
54
+ $[1] = query;
55
+ $[2] = request;
56
+ $[3] = search;
57
+ $[4] = t2;
58
+ } else t2 = $[4];
59
+ const run = React.useEffectEvent(t2);
60
+ let t3;
61
+ if ($[5] !== open || $[6] !== run) {
62
+ t3 = () => {
63
+ if (!open) return;
64
+ const signal_0 = { stale: false };
65
+ run(signal_0);
66
+ return () => {
67
+ signal_0.stale = true;
68
+ };
69
+ };
70
+ $[5] = open;
71
+ $[6] = run;
72
+ $[7] = t3;
73
+ } else t3 = $[7];
74
+ let t4;
75
+ if ($[8] !== open || $[9] !== request) {
76
+ t4 = [open, request];
77
+ $[8] = open;
78
+ $[9] = request;
79
+ $[10] = t4;
80
+ } else t4 = $[10];
81
+ React.useEffect(t3, t4);
82
+ let t5;
83
+ if ($[11] !== open) {
84
+ t5 = () => open;
85
+ $[11] = open;
86
+ $[12] = t5;
87
+ } else t5 = $[12];
88
+ const isOpen = React.useEffectEvent(t5);
89
+ let t6;
90
+ if ($[13] !== onOpenChange || $[14] !== open) {
91
+ t6 = () => onOpenChange(!open);
92
+ $[13] = onOpenChange;
93
+ $[14] = open;
94
+ $[15] = t6;
95
+ } else t6 = $[15];
96
+ const toggle = React.useEffectEvent(t6);
97
+ let t7;
98
+ if ($[16] !== isOpen || $[17] !== toggle) {
99
+ t7 = () => {
100
+ const computer = trigger.current?.closest("[data-slot=\"agent-computer\"]");
101
+ if (!computer) return;
102
+ const doc = computer.ownerDocument;
103
+ const shortcut = function shortcut(event) {
104
+ const commandK = !event.altKey && (event.ctrlKey || event.metaKey) && event.key.toLowerCase() === "k";
105
+ const spotlight = event.altKey && !event.ctrlKey && !event.metaKey && event.code === "Space";
106
+ if (event.defaultPrevented || event.isComposing || event.shiftKey || !(commandK || spotlight)) return;
107
+ const target = event.target;
108
+ if (!(target instanceof HTMLElement)) return;
109
+ const inPalette = isOpen() && target.closest("[data-command-palette]");
110
+ if (!computer.contains(target) && target !== doc.body && !inPalette) return;
111
+ if (target.closest("[role=\"dialog\"], [role=\"menu\"]") && !inPalette) return;
112
+ event.preventDefault();
113
+ toggle();
114
+ };
115
+ doc.addEventListener("keydown", shortcut);
116
+ return () => doc.removeEventListener("keydown", shortcut);
117
+ };
118
+ $[16] = isOpen;
119
+ $[17] = toggle;
120
+ $[18] = t7;
121
+ } else t7 = $[18];
122
+ let t8;
123
+ if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
124
+ t8 = [];
125
+ $[19] = t8;
126
+ } else t8 = $[19];
127
+ React.useEffect(t7, t8);
128
+ let t9;
129
+ if ($[20] !== apps || $[21] !== openApp || $[22] !== results.commands) {
130
+ let t10;
131
+ if ($[24] !== openApp) {
132
+ t10 = (app_0) => ({
133
+ id: `app:${app_0.id}`,
134
+ label: app_0.label,
135
+ group: "Applications",
136
+ icon: /* @__PURE__ */ jsx(AppIcon.Root, {
137
+ size: "sm",
138
+ "aria-hidden": "true",
139
+ children: app_0.icon
140
+ }),
141
+ onSelect: () => void openApp(app_0.id),
142
+ preload: app_0.preload
143
+ });
144
+ $[24] = openApp;
145
+ $[25] = t10;
146
+ } else t10 = $[25];
147
+ t9 = [...apps.filter(_temp).map(t10), ...results.commands];
148
+ $[20] = apps;
149
+ $[21] = openApp;
150
+ $[22] = results.commands;
151
+ $[23] = t9;
152
+ } else t9 = $[23];
153
+ const commands_0 = t9;
154
+ let t10;
155
+ if ($[26] !== onOpenChange) {
156
+ t10 = () => onOpenChange(true);
157
+ $[26] = onOpenChange;
158
+ $[27] = t10;
159
+ } else t10 = $[27];
160
+ let t11;
161
+ if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
162
+ t11 = /* @__PURE__ */ jsx(SearchIcon, {});
163
+ $[28] = t11;
164
+ } else t11 = $[28];
165
+ let t12;
166
+ if ($[29] !== t10) {
167
+ t12 = /* @__PURE__ */ jsx(IconButton, {
168
+ ref: trigger,
169
+ label: "Search workspace",
170
+ tooltip: `Search workspace (${COMPUTER_SPOTLIGHT_SHORTCUT.glyph})`,
171
+ "aria-keyshortcuts": COMPUTER_SPOTLIGHT_SHORTCUT.aria,
172
+ variant: "ghost",
173
+ color: "neutral",
174
+ className: "computer-spotlight__trigger",
175
+ onClick: t10,
176
+ children: t11
177
+ });
178
+ $[29] = t10;
179
+ $[30] = t12;
180
+ } else t12 = $[30];
181
+ let t13;
182
+ if ($[31] !== status) {
183
+ t13 = status === "error" ? /* @__PURE__ */ jsxs("p", {
184
+ role: "status",
185
+ children: [
186
+ "The workspace couldn’t be searched.",
187
+ " ",
188
+ /* @__PURE__ */ jsx(Button, {
189
+ size: "sm",
190
+ variant: "ghost",
191
+ onClick: () => setAttempt(_temp2),
192
+ children: "Retry search"
193
+ })
194
+ ]
195
+ }) : status === "loading" ? /* @__PURE__ */ jsx("p", { children: "Searching the workspace…" }) : null;
196
+ $[31] = status;
197
+ $[32] = t13;
198
+ } else t13 = $[32];
199
+ let t14;
200
+ if ($[33] !== commands_0 || $[34] !== container || $[35] !== onOpenChange || $[36] !== open || $[37] !== t13) {
201
+ t14 = /* @__PURE__ */ jsx(CommandPalette, {
202
+ commands: commands_0,
203
+ open,
204
+ onOpenChange,
205
+ onQueryChange: setQuery,
206
+ container,
207
+ children: t13
208
+ });
209
+ $[33] = commands_0;
210
+ $[34] = container;
211
+ $[35] = onOpenChange;
212
+ $[36] = open;
213
+ $[37] = t13;
214
+ $[38] = t14;
215
+ } else t14 = $[38];
216
+ let t15;
217
+ if ($[39] !== t12 || $[40] !== t14) {
218
+ t15 = /* @__PURE__ */ jsxs(Fragment, { children: [t12, t14] });
219
+ $[39] = t12;
220
+ $[40] = t14;
221
+ $[41] = t15;
222
+ } else t15 = $[41];
223
+ return t15;
224
+ }
225
+ function _temp2(count) {
226
+ return count + 1;
227
+ }
228
+ function _temp(app) {
229
+ return !app.owner && app.launcher !== "hidden";
230
+ }
231
+ //#endregion
232
+ export { COMPUTER_SPOTLIGHT_SHORTCUT, ComputerSpotlight };
@@ -0,0 +1,51 @@
1
+ import { t as Button } from "../../Button-DIn-0P-0.js";
2
+ import * as React from "react";
3
+ //#region src/components/agents-sdk/ComputerViewer.d.ts
4
+ export interface ComputerViewerActions {
5
+ /**
6
+ * Bring the computer forward: where the conversation covers it, hide the
7
+ * conversation; where they sit side by side, nothing changes. `open` stays
8
+ * as it was, so a viewer widened later shows the conversation beside again.
9
+ */
10
+ showComputer: () => void;
11
+ /** Show the conversation, over a narrow computer or beside a wide one, whether or not it was wanted before. */
12
+ showConversation: () => void;
13
+ }
14
+ export interface ComputerViewerProps {
15
+ /** The conversation region's name: the employee's. */
16
+ label: string;
17
+ /** The `AgentComputer`. */
18
+ computer: React.ReactNode;
19
+ /** The conversation, whose composer is its one `role="textbox"`. */
20
+ conversation: React.ReactNode;
21
+ /** Whether the conversation is wanted: beside a wide computer, over a narrow one. */
22
+ open: boolean;
23
+ /** Hide (Escape, the hide button, the home indicator) or show the conversation. */
24
+ onOpenChange: (open: boolean) => void;
25
+ /** The phone's home indicator under a full-screen conversation was used: go Home. */
26
+ onHome: () => void;
27
+ /** `showComputer()`, for host controls outside the viewer. */
28
+ actionsRef?: React.Ref<ComputerViewerActions>;
29
+ }
30
+ /**
31
+ * The computer and its conversation, side by side above 74.75rem of viewer
32
+ * (a 48rem computer, a `--sigvelo-layout-conversation` column and their
33
+ * insets), one over the other below it. CSS owns that breakpoint; the viewer
34
+ * observes the same decision for inert, ARIA and focus. The viewer owns focus
35
+ * across the conversation's edge: showing it focuses its composer, hiding it
36
+ * returns focus to what opened it.
37
+ */
38
+ export declare function ComputerViewer({ label, computer, conversation, open, onOpenChange, onHome, actionsRef }: ComputerViewerProps): React.JSX.Element;
39
+ /**
40
+ * The computer's control for the conversation, typically a menu-bar extra. It
41
+ * shows the conversation, over a narrow computer or beside a wide one; the
42
+ * conversation's own top bar hides it. The viewer fills in what it controls and
43
+ * whether that is showing, and returns focus here when the conversation hides.
44
+ */
45
+ export declare function ComputerViewerToggle({ onClick, ...props }: Omit<React.ComponentProps<typeof Button>, "ref" | "aria-expanded" | "aria-controls">): React.JSX.Element;
46
+ /**
47
+ * The conversation's own way out, for its top bar: "Hide conversation" beside
48
+ * the computer, "Show desktop" over it.
49
+ */
50
+ export declare function ComputerViewerHideButton(): React.JSX.Element;
51
+ //#endregion
@@ -0,0 +1,339 @@
1
+ import { W as MonitorIcon, gt as XIcon } from "../../icons-nLTnB9kd.js";
2
+ import { Button } from "../foundations/Button.js";
3
+ import { AppTopBar } from "../general-purpose/AppTopBar.js";
4
+ import { c } from "react/compiler-runtime";
5
+ import * as React from "react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ //#region src/components/agents-sdk/ComputerViewer.tsx
8
+ const ViewerContext = React.createContext(null);
9
+ function useViewer() {
10
+ const viewer = React.use(ViewerContext);
11
+ if (!viewer) throw new Error("ComputerViewer parts must render inside ComputerViewer.");
12
+ return viewer;
13
+ }
14
+ /** The control a focus that leaves the conversation returns to: its toggle, or the key window. */
15
+ function computerFocusTarget(toggle, computer) {
16
+ return toggle?.getClientRects().length ? toggle : computer?.querySelector("[data-slot=\"computer-window\"][data-active]");
17
+ }
18
+ /**
19
+ * The computer and its conversation, side by side above 74.75rem of viewer
20
+ * (a 48rem computer, a `--sigvelo-layout-conversation` column and their
21
+ * insets), one over the other below it. CSS owns that breakpoint; the viewer
22
+ * observes the same decision for inert, ARIA and focus. The viewer owns focus
23
+ * across the conversation's edge: showing it focuses its composer, hiding it
24
+ * returns focus to what opened it.
25
+ */
26
+ function ComputerViewer(t0) {
27
+ const $ = c(48);
28
+ const { label, computer, conversation, open, onOpenChange, onHome, actionsRef } = t0;
29
+ const id = React.useId();
30
+ const layoutRef = React.useRef(null);
31
+ const computerRef = React.useRef(null);
32
+ const conversationRef = React.useRef(null);
33
+ const toggleRef = React.useRef(null);
34
+ const opener = React.useRef(null);
35
+ const [split, setSplit] = React.useState(false);
36
+ const [computerInFront, setComputerInFront] = React.useState(false);
37
+ const [wasOpen, setWasOpen] = React.useState(open);
38
+ if (open !== wasOpen) {
39
+ setWasOpen(open);
40
+ setComputerInFront(false);
41
+ }
42
+ const visible = open && (split || !computerInFront);
43
+ let t1;
44
+ if ($[0] !== onOpenChange) {
45
+ t1 = () => {
46
+ setComputerInFront(false);
47
+ onOpenChange(true);
48
+ };
49
+ $[0] = onOpenChange;
50
+ $[1] = t1;
51
+ } else t1 = $[1];
52
+ const showConversation = t1;
53
+ let t2;
54
+ if ($[2] !== showConversation) {
55
+ t2 = () => ({
56
+ showComputer: () => setComputerInFront(true),
57
+ showConversation
58
+ });
59
+ $[2] = showConversation;
60
+ $[3] = t2;
61
+ } else t2 = $[3];
62
+ React.useImperativeHandle(actionsRef, t2);
63
+ const resizeFocus = React.useRef(null);
64
+ let t3;
65
+ if ($[4] !== computerInFront || $[5] !== open || $[6] !== split) {
66
+ t3 = (layout) => {
67
+ const next = getComputedStyle(layout).getPropertyValue("--computer-viewer-split").trim() === "1";
68
+ if (next === split) return;
69
+ const conversationShown = open && (next || !computerInFront);
70
+ const focused = document.activeElement;
71
+ if (focused && (!conversationShown && conversationRef.current?.contains(focused) || !next && conversationShown && computerRef.current?.contains(focused))) resizeFocus.current = {
72
+ previous: focused,
73
+ conversation: conversationShown
74
+ };
75
+ setSplit(next);
76
+ };
77
+ $[4] = computerInFront;
78
+ $[5] = open;
79
+ $[6] = split;
80
+ $[7] = t3;
81
+ } else t3 = $[7];
82
+ const syncLayout = React.useEffectEvent(t3);
83
+ let t4;
84
+ if ($[8] !== syncLayout) {
85
+ t4 = () => {
86
+ const layout_0 = layoutRef.current;
87
+ syncLayout(layout_0);
88
+ const observer = new ResizeObserver(() => syncLayout(layout_0));
89
+ observer.observe(layout_0);
90
+ return () => observer.disconnect();
91
+ };
92
+ $[8] = syncLayout;
93
+ $[9] = t4;
94
+ } else t4 = $[9];
95
+ let t5;
96
+ if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
97
+ t5 = [];
98
+ $[10] = t5;
99
+ } else t5 = $[10];
100
+ React.useLayoutEffect(t4, t5);
101
+ let t6;
102
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
103
+ t6 = () => {
104
+ const pending = resizeFocus.current;
105
+ resizeFocus.current = null;
106
+ if (!pending || document.activeElement !== pending.previous && document.activeElement !== document.body) return;
107
+ (pending.conversation ? conversationRef.current?.querySelector("[role=\"textbox\"]") : computerFocusTarget(toggleRef.current, computerRef.current))?.focus({ preventScroll: true });
108
+ };
109
+ $[11] = t6;
110
+ } else t6 = $[11];
111
+ let t7;
112
+ if ($[12] !== split) {
113
+ t7 = [split];
114
+ $[12] = split;
115
+ $[13] = t7;
116
+ } else t7 = $[13];
117
+ React.useLayoutEffect(t6, t7);
118
+ const wasVisible = React.useRef(visible);
119
+ const wasSplit = React.useRef(split);
120
+ let t8;
121
+ let t9;
122
+ if ($[14] !== split || $[15] !== visible) {
123
+ t8 = () => {
124
+ const resized = split !== wasSplit.current;
125
+ wasSplit.current = split;
126
+ if (visible === wasVisible.current) return;
127
+ wasVisible.current = visible;
128
+ if (resized) return;
129
+ const focused_0 = document.activeElement;
130
+ if (visible) {
131
+ if (focused_0 instanceof HTMLElement && computerRef.current?.contains(focused_0)) opener.current = focused_0;
132
+ const frame = requestAnimationFrame(() => conversationRef.current?.querySelector("[role=\"textbox\"]")?.focus({ preventScroll: true }));
133
+ return () => cancelAnimationFrame(frame);
134
+ }
135
+ if (focused_0 !== document.body && !conversationRef.current?.contains(focused_0)) return;
136
+ const frame_0 = requestAnimationFrame(() => {
137
+ const now = document.activeElement;
138
+ if (now !== document.body && !conversationRef.current?.contains(now)) return;
139
+ const previous = opener.current;
140
+ (previous?.isConnected && !previous.closest("[inert]") && previous.getClientRects().length ? previous : computerFocusTarget(toggleRef.current, computerRef.current))?.focus({ preventScroll: true });
141
+ });
142
+ return () => cancelAnimationFrame(frame_0);
143
+ };
144
+ t9 = [visible, split];
145
+ $[14] = split;
146
+ $[15] = visible;
147
+ $[16] = t8;
148
+ $[17] = t9;
149
+ } else {
150
+ t8 = $[16];
151
+ t9 = $[17];
152
+ }
153
+ React.useLayoutEffect(t8, t9);
154
+ let t10;
155
+ if ($[18] !== id || $[19] !== onOpenChange || $[20] !== showConversation || $[21] !== split || $[22] !== visible) {
156
+ t10 = {
157
+ id,
158
+ split,
159
+ visible,
160
+ toggleRef,
161
+ onOpenChange,
162
+ showConversation
163
+ };
164
+ $[18] = id;
165
+ $[19] = onOpenChange;
166
+ $[20] = showConversation;
167
+ $[21] = split;
168
+ $[22] = visible;
169
+ $[23] = t10;
170
+ } else t10 = $[23];
171
+ const t11 = open ? "" : void 0;
172
+ const t12 = !split && visible;
173
+ let t13;
174
+ if ($[24] !== computer || $[25] !== t12) {
175
+ t13 = /* @__PURE__ */ jsx("div", {
176
+ ref: computerRef,
177
+ className: "computer-viewer__computer",
178
+ inert: t12,
179
+ children: computer
180
+ });
181
+ $[24] = computer;
182
+ $[25] = t12;
183
+ $[26] = t13;
184
+ } else t13 = $[26];
185
+ const t14 = !visible;
186
+ const t15 = !visible;
187
+ let t16;
188
+ if ($[27] !== onOpenChange || $[28] !== split) {
189
+ t16 = (event) => {
190
+ if (event.key !== "Escape" || event.defaultPrevented || split || !event.currentTarget.contains(event.target)) return;
191
+ event.preventDefault();
192
+ onOpenChange(false);
193
+ };
194
+ $[27] = onOpenChange;
195
+ $[28] = split;
196
+ $[29] = t16;
197
+ } else t16 = $[29];
198
+ let t17;
199
+ if ($[30] !== onHome || $[31] !== onOpenChange) {
200
+ t17 = /* @__PURE__ */ jsx("button", {
201
+ type: "button",
202
+ className: "computer-viewer__home-indicator",
203
+ "aria-label": "Show home",
204
+ onPointerDown: _temp,
205
+ onClick: () => {
206
+ onHome();
207
+ onOpenChange(false);
208
+ }
209
+ });
210
+ $[30] = onHome;
211
+ $[31] = onOpenChange;
212
+ $[32] = t17;
213
+ } else t17 = $[32];
214
+ let t18;
215
+ if ($[33] !== conversation || $[34] !== id || $[35] !== label || $[36] !== t14 || $[37] !== t15 || $[38] !== t16 || $[39] !== t17) {
216
+ t18 = /* @__PURE__ */ jsxs("section", {
217
+ ref: conversationRef,
218
+ id,
219
+ className: "computer-viewer__conversation",
220
+ "aria-label": label,
221
+ hidden: t14,
222
+ inert: t15,
223
+ onKeyDown: t16,
224
+ children: [conversation, t17]
225
+ });
226
+ $[33] = conversation;
227
+ $[34] = id;
228
+ $[35] = label;
229
+ $[36] = t14;
230
+ $[37] = t15;
231
+ $[38] = t16;
232
+ $[39] = t17;
233
+ $[40] = t18;
234
+ } else t18 = $[40];
235
+ let t19;
236
+ if ($[41] !== t11 || $[42] !== t13 || $[43] !== t18) {
237
+ t19 = /* @__PURE__ */ jsx("div", {
238
+ className: "computer-viewer",
239
+ children: /* @__PURE__ */ jsxs("div", {
240
+ ref: layoutRef,
241
+ className: "computer-viewer__layout",
242
+ "data-conversation-open": t11,
243
+ children: [t13, t18]
244
+ })
245
+ });
246
+ $[41] = t11;
247
+ $[42] = t13;
248
+ $[43] = t18;
249
+ $[44] = t19;
250
+ } else t19 = $[44];
251
+ let t20;
252
+ if ($[45] !== t10 || $[46] !== t19) {
253
+ t20 = /* @__PURE__ */ jsx(ViewerContext, {
254
+ value: t10,
255
+ children: t19
256
+ });
257
+ $[45] = t10;
258
+ $[46] = t19;
259
+ $[47] = t20;
260
+ } else t20 = $[47];
261
+ return t20;
262
+ }
263
+ function _temp(event_0) {
264
+ return event_0.currentTarget.setPointerCapture(event_0.pointerId);
265
+ }
266
+ /**
267
+ * The computer's control for the conversation, typically a menu-bar extra. It
268
+ * shows the conversation, over a narrow computer or beside a wide one; the
269
+ * conversation's own top bar hides it. The viewer fills in what it controls and
270
+ * whether that is showing, and returns focus here when the conversation hides.
271
+ */
272
+ function ComputerViewerToggle(t0) {
273
+ const $ = c(12);
274
+ let onClick;
275
+ let props;
276
+ if ($[0] !== t0) {
277
+ ({onClick, ...props} = t0);
278
+ $[0] = t0;
279
+ $[1] = onClick;
280
+ $[2] = props;
281
+ } else {
282
+ onClick = $[1];
283
+ props = $[2];
284
+ }
285
+ const { id, visible, toggleRef, showConversation } = useViewer();
286
+ let t1;
287
+ if ($[3] !== onClick || $[4] !== showConversation) {
288
+ t1 = (event) => {
289
+ onClick?.(event);
290
+ if (!event.defaultPrevented) showConversation();
291
+ };
292
+ $[3] = onClick;
293
+ $[4] = showConversation;
294
+ $[5] = t1;
295
+ } else t1 = $[5];
296
+ let t2;
297
+ if ($[6] !== id || $[7] !== props || $[8] !== t1 || $[9] !== toggleRef || $[10] !== visible) {
298
+ t2 = /* @__PURE__ */ jsx(Button, {
299
+ ...props,
300
+ ref: toggleRef,
301
+ "aria-expanded": visible,
302
+ "aria-controls": id,
303
+ onClick: t1
304
+ });
305
+ $[6] = id;
306
+ $[7] = props;
307
+ $[8] = t1;
308
+ $[9] = toggleRef;
309
+ $[10] = visible;
310
+ $[11] = t2;
311
+ } else t2 = $[11];
312
+ return t2;
313
+ }
314
+ /**
315
+ * The conversation's own way out, for its top bar: "Hide conversation" beside
316
+ * the computer, "Show desktop" over it.
317
+ */
318
+ function ComputerViewerHideButton() {
319
+ const $ = c(3);
320
+ const { split, onOpenChange } = useViewer();
321
+ let t0;
322
+ if ($[0] !== onOpenChange || $[1] !== split) {
323
+ t0 = split ? /* @__PURE__ */ jsx(AppTopBar.Button, {
324
+ label: "Hide conversation",
325
+ onClick: () => onOpenChange(false),
326
+ children: /* @__PURE__ */ jsx(XIcon, {})
327
+ }) : /* @__PURE__ */ jsx(AppTopBar.Button, {
328
+ label: "Show desktop",
329
+ onClick: () => onOpenChange(false),
330
+ children: /* @__PURE__ */ jsx(MonitorIcon, {})
331
+ });
332
+ $[0] = onOpenChange;
333
+ $[1] = split;
334
+ $[2] = t0;
335
+ } else t0 = $[2];
336
+ return t0;
337
+ }
338
+ //#endregion
339
+ export { ComputerViewer, ComputerViewerHideButton, ComputerViewerToggle };
@@ -0,0 +1,11 @@
1
+ import { t as WallpaperOption } from "../../WallpaperPicker-C-FItmDS.js";
2
+ //#region src/components/agents-sdk/ComputerWallpapers.d.ts
3
+ /**
4
+ * The computer's own backgrounds: original pictures, the same in light and
5
+ * dark, shipped with the package. Pass one to `AgentComputer`'s `wallpaper`
6
+ * and the list to `ComputerSettings.Host`'s `wallpapers`.
7
+ */
8
+ export declare const COMPUTER_WALLPAPERS: readonly WallpaperOption[];
9
+ /** The wallpaper a computer shows until its person chooses another. */
10
+ export declare const DEFAULT_COMPUTER_WALLPAPER = "sigvelo";
11
+ //#endregion