@mcp-b/react-components 0.70.0 → 0.71.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AgentComputer-CpS9R2KG.d.ts +305 -0
- package/dist/{AgentComputer-CFJxjMFE.js → AgentComputer-CsWDnHwj.js} +1859 -478
- package/dist/CommandPalette-DDctKdpC.d.ts +53 -0
- package/dist/ComputerCalendar-Z6k_DVJF.js +1360 -0
- package/dist/ComputerCustomWallpaper-CnGQYHp0.js +518 -0
- package/dist/ComputerCustomWallpaper-D4lgwj2k.d.ts +18 -0
- package/dist/ComputerNotifications-q7eeELZ8.d.ts +41 -0
- package/dist/ComputerPresentation-BEQKYAjc.js +888 -0
- package/dist/{ExecutionResult-C7SzVquo.js → ExecutionResult-CXnGcmM4.js} +1 -1
- package/dist/{WorkspaceBrowser-ojoZy0uO.js → WorkspaceBrowser-mRScUczT.js} +5 -5
- package/dist/WorkspaceFileTransfer-D2cOoVyO.js +1625 -0
- package/dist/{WorkspaceMessageResponse-BoeeltJM.js → WorkspaceMessageResponse-CXGOQgpo.js} +1 -1
- package/dist/components/agents-sdk/AgentComputer.d.ts +2 -276
- package/dist/components/agents-sdk/AgentComputer.js +1 -1
- package/dist/components/agents-sdk/BrowserReplay.js +1 -1
- package/dist/components/agents-sdk/ComputerAutomations.d.ts +5 -15
- package/dist/components/agents-sdk/ComputerAutomations.js +164 -145
- package/dist/components/agents-sdk/ComputerCalendar.d.ts +1 -1
- package/dist/components/agents-sdk/ComputerCalendar.js +1 -1344
- package/dist/components/agents-sdk/ComputerCustomWallpaper.d.ts +2 -39
- package/dist/components/agents-sdk/ComputerCustomWallpaper.js +2 -522
- package/dist/components/agents-sdk/ComputerFiles.d.ts +18 -81
- package/dist/components/agents-sdk/ComputerFiles.js +386 -98
- package/dist/components/agents-sdk/ComputerHome.d.ts +6 -11
- package/dist/components/agents-sdk/ComputerHome.js +1 -89
- package/dist/components/agents-sdk/ComputerHost.d.ts +43 -0
- package/dist/components/agents-sdk/ComputerHost.js +97 -0
- package/dist/components/agents-sdk/ComputerLayout.d.ts +1 -1
- package/dist/components/agents-sdk/ComputerNotifications.d.ts +2 -54
- package/dist/components/agents-sdk/ComputerNotifications.js +1 -668
- package/dist/components/agents-sdk/ComputerPresentation.d.ts +2 -0
- package/dist/components/agents-sdk/ComputerPresentation.js +2 -0
- package/dist/components/agents-sdk/ComputerScreen.d.ts +14 -14
- package/dist/components/agents-sdk/ComputerScreen.js +109 -50
- package/dist/components/agents-sdk/ComputerSettings.d.ts +12 -40
- package/dist/components/agents-sdk/ComputerSettings.js +249 -1038
- package/dist/components/agents-sdk/ComputerSpotlight.d.ts +13 -15
- package/dist/components/agents-sdk/ComputerSpotlight.js +1 -231
- package/dist/components/agents-sdk/ComputerViewer.d.ts +13 -17
- package/dist/components/agents-sdk/ComputerViewer.js +176 -187
- package/dist/components/agents-sdk/ComputerWallpapers.d.ts +1 -1
- package/dist/components/agents-sdk/EmployeeChat.js +2 -2
- package/dist/components/agents-sdk/EmployeeChrome.js +3 -3
- package/dist/components/agents-sdk/EmployeeSchedules.js +2 -2
- package/dist/components/agents-sdk/ExecutionBoard.js +1 -1
- package/dist/components/agents-sdk/ManagerOffice.js +1 -1
- package/dist/components/agents-sdk/ManagerOfficeScreens.js +2 -2
- package/dist/components/agents-sdk/McpPluginCatalog.js +1 -1
- package/dist/components/agents-sdk/ThinkChat.js +1 -1
- package/dist/components/agents-sdk/ThinkChatToolPanels.js +3 -3
- package/dist/components/agents-sdk/ThinkExecutionDetail.js +1 -1
- package/dist/components/agents-sdk/ThinkExecutionWorkbench.js +2 -2
- package/dist/components/agents-sdk/ThinkScheduleActions.js +1 -1
- package/dist/components/agents-sdk/ThinkScheduleBrowser.js +1 -1
- package/dist/components/agents-sdk/ThinkScheduleDetail.js +4 -4
- package/dist/components/agents-sdk/ThinkScheduleForm.js +3 -3
- package/dist/components/agents-sdk/WorkspaceAutomation.js +3 -3
- package/dist/components/agents-sdk/WorkspaceAutomationTable.js +1 -1
- package/dist/components/agents-sdk/WorkspaceBrowser.js +1 -1
- package/dist/components/agents-sdk/WorkspaceDesktop.d.ts +1 -5
- package/dist/components/agents-sdk/WorkspaceDesktop.js +53 -41
- package/dist/components/agents-sdk/WorkspaceExplorer.js +3 -3
- package/dist/components/agents-sdk/WorkspaceFileCommands.js +1 -924
- package/dist/components/agents-sdk/WorkspaceFileDetails.js +1 -1
- package/dist/components/agents-sdk/WorkspaceFileTransfer.js +1 -504
- package/dist/components/agents-sdk/WorkspaceFileView.js +6 -6
- package/dist/components/agents-sdk/WorkspaceLink.js +1 -1
- package/dist/components/agents-sdk/WorkspaceLive.d.ts +9 -0
- package/dist/components/agents-sdk/WorkspaceLive.js +2 -177
- package/dist/components/agents-sdk/WorkspaceMessageResponse.js +1 -1
- package/dist/components/agents-sdk/WorkspaceMountManager.js +1 -1
- package/dist/components/ai-sdk/Context.js +1 -1
- package/dist/components/ai-sdk/PromptInput.js +1 -1
- package/dist/components/extension/FirstRunSetup.js +2 -2
- package/dist/components/foundations/ThemeProvider.d.ts +2 -0
- package/dist/components/foundations/ThemeProvider.js +2 -1
- package/dist/components/general-purpose/CommandPalette.d.ts +2 -52
- package/dist/components/general-purpose/ResponsiveSidebarShell.js +1 -1
- package/dist/components/general-purpose/WallpaperPicker.d.ts +33 -2
- package/dist/components/nanites/AgentConnection.js +1 -1
- package/dist/components/nanites/AgentToolDetail.js +1 -1
- package/dist/context-BWJpR084.js +94 -0
- package/dist/{parts-CPVz9l31.js → parts-BFK5iocu.js} +1 -1
- package/dist/styles/agent-computer.css +16 -0
- package/dist/styles/computer-files.css +5 -0
- package/dist/styles/computer-notifications.css +1 -0
- package/dist/{workspace-drag-B6hMXUNt.js → workspace-drag-BNhZIN8F.js} +1 -1
- package/dist/{workspace-quick-look-DODjsfhH.js → workspace-quick-look-8cbGu1Xf.js} +2 -2
- package/package.json +2 -2
- package/dist/WallpaperPicker-C-FItmDS.d.ts +0 -34
- package/dist/automations-host-DPORjdc7.js +0 -17
- package/dist/context-Ddsp8HgD.js +0 -43
- package/dist/minute-clock-CXpRGCMF.js +0 -35
- package/dist/{Context-DQDumCV8.js → Context-CYUxZrwW.js} +1 -1
- package/dist/{ManagerOffice-kSK7vTBl.js → ManagerOffice-BJ2vs-Lr.js} +2 -2
- package/dist/{WorkspaceLink-DK9kdMUH.js → WorkspaceLink-DDkj-Tq5.js} +1 -1
|
@@ -1,925 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Button } from "../foundations/Button.js";
|
|
3
|
-
import { AlertDialog } from "../foundations/AlertDialog.js";
|
|
4
|
-
import { a as workspaceDirname, i as workspaceBasename, r as joinWorkspacePath } from "../../workspace-path-TZggP-u4.js";
|
|
5
|
-
import { availableWorkspacePath, useWorkspaceTransfer } from "./WorkspaceFileTransfer.js";
|
|
6
|
-
import { c } from "react/compiler-runtime";
|
|
7
|
-
import * as React from "react";
|
|
8
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
-
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
10
|
-
//#region src/components/agents-sdk/WorkspaceFileCommands.tsx
|
|
11
|
-
/**
|
|
12
|
-
* Every file shortcut, first one per command shown in menus. macOS's own key
|
|
13
|
-
* is used wherever Chrome lets a page have it; New Folder (⇧⌘N, which opens
|
|
14
|
-
* an Incognito window) takes ⌥⌘N instead.
|
|
15
|
-
*/
|
|
16
|
-
const SHORTCUTS = [
|
|
17
|
-
{
|
|
18
|
-
command: "open",
|
|
19
|
-
key: "KeyO",
|
|
20
|
-
mod: true,
|
|
21
|
-
glyph: "⌘O",
|
|
22
|
-
aria: "Meta+O"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
command: "open",
|
|
26
|
-
key: "ArrowDown",
|
|
27
|
-
mod: true,
|
|
28
|
-
glyph: "⌘↓",
|
|
29
|
-
aria: "Meta+ArrowDown"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
command: "quick-look",
|
|
33
|
-
key: "KeyY",
|
|
34
|
-
mod: true,
|
|
35
|
-
glyph: "⌘Y",
|
|
36
|
-
aria: "Meta+Y"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
command: "trash",
|
|
40
|
-
key: "Backspace",
|
|
41
|
-
mod: true,
|
|
42
|
-
glyph: "⌘⌫",
|
|
43
|
-
aria: "Meta+Backspace"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
command: "trash",
|
|
47
|
-
key: "Delete",
|
|
48
|
-
mod: true,
|
|
49
|
-
glyph: "⌘⌦",
|
|
50
|
-
aria: "Meta+Delete"
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
command: "put-back",
|
|
54
|
-
key: "Backspace",
|
|
55
|
-
mod: true,
|
|
56
|
-
glyph: "⌘⌫",
|
|
57
|
-
aria: "Meta+Backspace"
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
command: "empty-trash",
|
|
61
|
-
key: "Backspace",
|
|
62
|
-
mod: true,
|
|
63
|
-
shift: true,
|
|
64
|
-
glyph: "⇧⌘⌫",
|
|
65
|
-
aria: "Shift+Meta+Backspace"
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
command: "get-info",
|
|
69
|
-
key: "KeyI",
|
|
70
|
-
mod: true,
|
|
71
|
-
glyph: "⌘I",
|
|
72
|
-
aria: "Meta+I"
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
command: "rename",
|
|
76
|
-
key: "Enter",
|
|
77
|
-
mod: false,
|
|
78
|
-
glyph: "↩",
|
|
79
|
-
aria: "Enter"
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
command: "duplicate",
|
|
83
|
-
key: "KeyD",
|
|
84
|
-
mod: true,
|
|
85
|
-
glyph: "⌘D",
|
|
86
|
-
aria: "Meta+D"
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
command: "cut",
|
|
90
|
-
key: "KeyX",
|
|
91
|
-
mod: true,
|
|
92
|
-
glyph: "⌘X",
|
|
93
|
-
aria: "Meta+X"
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
command: "copy",
|
|
97
|
-
key: "KeyC",
|
|
98
|
-
mod: true,
|
|
99
|
-
glyph: "⌘C",
|
|
100
|
-
aria: "Meta+C"
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
command: "paste",
|
|
104
|
-
key: "KeyV",
|
|
105
|
-
mod: true,
|
|
106
|
-
glyph: "⌘V",
|
|
107
|
-
aria: "Meta+V"
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
command: "move-here",
|
|
111
|
-
key: "KeyV",
|
|
112
|
-
mod: true,
|
|
113
|
-
alt: true,
|
|
114
|
-
glyph: "⌥⌘V",
|
|
115
|
-
aria: "Alt+Meta+V"
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
command: "new-folder",
|
|
119
|
-
key: "KeyN",
|
|
120
|
-
mod: true,
|
|
121
|
-
alt: true,
|
|
122
|
-
glyph: "⌥⌘N",
|
|
123
|
-
aria: "Alt+Meta+N"
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
command: "select-all",
|
|
127
|
-
key: "KeyA",
|
|
128
|
-
mod: true,
|
|
129
|
-
glyph: "⌘A",
|
|
130
|
-
aria: "Meta+A"
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
command: "undo",
|
|
134
|
-
key: "KeyZ",
|
|
135
|
-
mod: true,
|
|
136
|
-
glyph: "⌘Z",
|
|
137
|
-
aria: "Meta+Z"
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
command: "redo",
|
|
141
|
-
key: "KeyZ",
|
|
142
|
-
mod: true,
|
|
143
|
-
shift: true,
|
|
144
|
-
glyph: "⇧⌘Z",
|
|
145
|
-
aria: "Shift+Meta+Z"
|
|
146
|
-
}
|
|
147
|
-
];
|
|
148
|
-
/**
|
|
149
|
-
* A command's shortcut, for a host menu bar's item that runs it through
|
|
150
|
-
* `WorkspaceBrowserActions`: the glyphs it shows and its `aria-keyshortcuts`.
|
|
151
|
-
*/
|
|
152
|
-
function workspaceFileShortcut(command) {
|
|
153
|
-
return SHORTCUTS.find((shortcut) => shortcut.command === command);
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* The command a keydown names, or null. Command and Control both count as
|
|
157
|
-
* the modifier, so the same keys work off a Mac. Keys typed into a field, or
|
|
158
|
-
* mid-composition, are never commands.
|
|
159
|
-
*/
|
|
160
|
-
function workspaceFileCommandForKey(event) {
|
|
161
|
-
if (event.isComposing) return null;
|
|
162
|
-
const target = event.target;
|
|
163
|
-
if (target instanceof Element && target.closest("input, textarea, select, [contenteditable]:not([contenteditable='false'])")) return null;
|
|
164
|
-
const mod = event.metaKey || event.ctrlKey;
|
|
165
|
-
return SHORTCUTS.find((shortcut) => (shortcut.key === event.code || shortcut.key === event.key) && shortcut.mod === mod && Boolean(shortcut.shift) === event.shiftKey && Boolean(shortcut.alt) === event.altKey)?.command ?? null;
|
|
166
|
-
}
|
|
167
|
-
/** The folder each workspace volume keeps its Trash in. */
|
|
168
|
-
const WORKSPACE_TRASH = "/.Trash";
|
|
169
|
-
/** Where the Trash records each item's original location, so Put Back survives a reload. */
|
|
170
|
-
const PUT_BACK_RECORD = `${WORKSPACE_TRASH}/.put-back.json`;
|
|
171
|
-
/** Finder hides names that start with a dot, the Trash among them. */
|
|
172
|
-
function isHiddenWorkspaceEntry(entry) {
|
|
173
|
-
return entry.name.startsWith(".");
|
|
174
|
-
}
|
|
175
|
-
/** Whether `path` is in the Trash (the Trash itself excluded). */
|
|
176
|
-
function isInWorkspaceTrash(path) {
|
|
177
|
-
return path.startsWith(`${WORKSPACE_TRASH}/`);
|
|
178
|
-
}
|
|
179
|
-
/** The Trash's record of where each item came from, by its name in the Trash. */
|
|
180
|
-
async function readPutBackRecord(source) {
|
|
181
|
-
const text = await source.readFile(PUT_BACK_RECORD);
|
|
182
|
-
if (!text) return {};
|
|
183
|
-
try {
|
|
184
|
-
const parsed = JSON.parse(text);
|
|
185
|
-
return parsed && typeof parsed === "object" ? parsed : {};
|
|
186
|
-
} catch {
|
|
187
|
-
return {};
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
async function writePutBackRecord(source, record) {
|
|
191
|
-
await source.writeFile(PUT_BACK_RECORD, JSON.stringify(record), "application/json");
|
|
192
|
-
}
|
|
193
|
-
/** Whether a volume's Trash is full, as the Dock's bin shows it. */
|
|
194
|
-
function workspaceTrashQueryKey(sourceKey) {
|
|
195
|
-
return [
|
|
196
|
-
"workspace",
|
|
197
|
-
sourceKey,
|
|
198
|
-
"trash"
|
|
199
|
-
];
|
|
200
|
-
}
|
|
201
|
-
/** Whether the volume's Trash holds anything: the Dock's full or empty Trash. */
|
|
202
|
-
async function workspaceTrashIsFull(source) {
|
|
203
|
-
if (!await source.exists("/.Trash")) return false;
|
|
204
|
-
return (await source.readDir(WORKSPACE_TRASH)).some((entry) => !isHiddenWorkspaceEntry(entry));
|
|
205
|
-
}
|
|
206
|
-
/** Deletes everything in the Trash for good. */
|
|
207
|
-
async function emptyWorkspaceTrash(source) {
|
|
208
|
-
if (!await source.exists("/.Trash")) return;
|
|
209
|
-
for (const entry of await source.readDir(WORKSPACE_TRASH)) await source.rm(entry.path, {
|
|
210
|
-
recursive: true,
|
|
211
|
-
force: true
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
async function runOperation(source, operation) {
|
|
215
|
-
const folder = async (path) => (await source.stat(path))?.type === "directory";
|
|
216
|
-
if (operation.kind === "move") {
|
|
217
|
-
const { from, to } = operation;
|
|
218
|
-
if (!await source.exists(from)) throw new Error(`“${workspaceBasename(from)}” is no longer available.`);
|
|
219
|
-
if (await source.exists(to)) throw new Error(`An item named “${workspaceBasename(to)}” already exists in this location.`);
|
|
220
|
-
await source.mv(from, to, { recursive: true });
|
|
221
|
-
return {
|
|
222
|
-
kind: "move",
|
|
223
|
-
from: to,
|
|
224
|
-
to: from
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
if (operation.kind === "trash") {
|
|
228
|
-
const { path } = operation;
|
|
229
|
-
if (!await source.exists(path)) throw new Error(`“${workspaceBasename(path)}” is no longer available.`);
|
|
230
|
-
await source.mkdir(WORKSPACE_TRASH, { recursive: true });
|
|
231
|
-
const to = await availableWorkspacePath(source, WORKSPACE_TRASH, workspaceBasename(path), {
|
|
232
|
-
folder: await folder(path),
|
|
233
|
-
copy: false
|
|
234
|
-
});
|
|
235
|
-
await source.mv(path, to, { recursive: true });
|
|
236
|
-
const record = await readPutBackRecord(source);
|
|
237
|
-
record[workspaceBasename(to)] = path;
|
|
238
|
-
await writePutBackRecord(source, record);
|
|
239
|
-
return {
|
|
240
|
-
kind: "put-back",
|
|
241
|
-
path: to
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
const { path } = operation;
|
|
245
|
-
if (!await source.exists(path)) throw new Error(`“${workspaceBasename(path)}” is no longer in the Trash.`);
|
|
246
|
-
const record = await readPutBackRecord(source);
|
|
247
|
-
const origin = record[workspaceBasename(path)] ?? joinWorkspacePath("/", workspaceBasename(path));
|
|
248
|
-
const directory = workspaceDirname(origin);
|
|
249
|
-
await source.mkdir(directory, { recursive: true });
|
|
250
|
-
const to = await source.exists(origin) ? await availableWorkspacePath(source, directory, workspaceBasename(origin), {
|
|
251
|
-
folder: await folder(path),
|
|
252
|
-
copy: false
|
|
253
|
-
}) : origin;
|
|
254
|
-
await source.mv(path, to, { recursive: true });
|
|
255
|
-
delete record[workspaceBasename(path)];
|
|
256
|
-
await writePutBackRecord(source, record);
|
|
257
|
-
return {
|
|
258
|
-
kind: "trash",
|
|
259
|
-
path: to
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* Applies `operations` in order and resolves to the operations that reverse
|
|
264
|
-
* them, already in the order to apply: undoing is running the result, and
|
|
265
|
-
* redoing is running what that run returns. Stops at the first failure,
|
|
266
|
-
* with the operations before it applied.
|
|
267
|
-
*/
|
|
268
|
-
async function runWorkspaceFileOperations(source, operations) {
|
|
269
|
-
const inverses = [];
|
|
270
|
-
for (const operation of operations) inverses.unshift(await runOperation(source, operation));
|
|
271
|
-
return inverses;
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* Where the objects are after a run, read from the operations that run
|
|
275
|
-
* returned (its inverses): what to select afterwards.
|
|
276
|
-
*/
|
|
277
|
-
function workspaceFileOperationPaths(operations) {
|
|
278
|
-
return operations.flatMap((operation) => operation.kind === "move" ? [operation.from] : operation.kind === "trash" ? [operation.path] : []);
|
|
279
|
-
}
|
|
280
|
-
/**
|
|
281
|
-
* Where a rename lands, checked as the Finder checks it. Rejects with the
|
|
282
|
-
* alert's words for a name that cannot be used or is taken.
|
|
283
|
-
*/
|
|
284
|
-
async function workspaceRenameTarget(source, path, name) {
|
|
285
|
-
const trimmed = name.trim();
|
|
286
|
-
if (!trimmed) throw new Error("A name can’t be empty.");
|
|
287
|
-
if (trimmed.includes("/")) throw new Error("A name can’t contain “/”.");
|
|
288
|
-
if (trimmed.startsWith(".")) throw new Error("Names that begin with a dot are reserved for the system.");
|
|
289
|
-
const to = joinWorkspacePath(workspaceDirname(path), trimmed);
|
|
290
|
-
if (to === path) return null;
|
|
291
|
-
if (await source.exists(to)) throw new Error(`The name “${trimmed}” is already taken. Please choose a different name.`);
|
|
292
|
-
return to;
|
|
293
|
-
}
|
|
294
|
-
/** Whether `path` is `folder` or inside it. */
|
|
295
|
-
function isWithin(path, folder) {
|
|
296
|
-
return folder === "/" || path === folder || path.startsWith(`${folder}/`);
|
|
297
|
-
}
|
|
298
|
-
/** "untitled folder", or the first free "untitled folder 2"… in `directory`. */
|
|
299
|
-
function newWorkspaceFolderPath(source, directory) {
|
|
300
|
-
return availableWorkspacePath(source, directory, "untitled folder", {
|
|
301
|
-
folder: true,
|
|
302
|
-
copy: false
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
|
-
const IMAGE = /\.(png|jpe?g|gif|webp|svg)$/i;
|
|
306
|
-
/** “name” for one object, "N Items" for more: the Finder's menu subject. */
|
|
307
|
-
function subject(paths) {
|
|
308
|
-
return paths.length === 1 ? `“${workspaceBasename(paths[0])}”` : `${paths.length} Items`;
|
|
309
|
-
}
|
|
310
|
-
/** An image file as PNG, the one image type Chrome writes to the system clipboard. */
|
|
311
|
-
async function pngOf(source, path) {
|
|
312
|
-
const info = await source.stat(path);
|
|
313
|
-
const bytes = await source.readFileBytes(path);
|
|
314
|
-
if (!info || !bytes) throw new Error("The image is no longer available.");
|
|
315
|
-
const blob = new Blob([Uint8Array.from(bytes).buffer], { type: info.mimeType });
|
|
316
|
-
if (info.mimeType === "image/png") return blob;
|
|
317
|
-
const url = URL.createObjectURL(blob);
|
|
318
|
-
const image = new Image();
|
|
319
|
-
image.src = url;
|
|
320
|
-
await image.decode().finally(() => URL.revokeObjectURL(url));
|
|
321
|
-
const canvas = new OffscreenCanvas(image.naturalWidth || 512, image.naturalHeight || 512);
|
|
322
|
-
canvas.getContext("2d").drawImage(image, 0, 0, canvas.width, canvas.height);
|
|
323
|
-
return canvas.convertToBlob({ type: "image/png" });
|
|
324
|
-
}
|
|
325
|
-
/**
|
|
326
|
-
* What the computer's clipboard can carry from a copy: the names as text, and
|
|
327
|
-
* one image as PNG. Must run in the copy's own event, which grants the write.
|
|
328
|
-
*/
|
|
329
|
-
function writeSystemClipboard(source, paths) {
|
|
330
|
-
const names = paths.map(workspaceBasename).join("\n");
|
|
331
|
-
const image = paths.length === 1 && IMAGE.test(paths[0]);
|
|
332
|
-
const item = new ClipboardItem(image ? {
|
|
333
|
-
"text/plain": names,
|
|
334
|
-
"image/png": pngOf(source, paths[0])
|
|
335
|
-
} : { "text/plain": names });
|
|
336
|
-
navigator.clipboard.write([item]).catch(() => image ? navigator.clipboard.writeText(names) : void 0).catch(() => void 0);
|
|
337
|
-
}
|
|
338
|
-
/**
|
|
339
|
-
* One computer's file commands, shared by its desktop and every browser
|
|
340
|
-
* window: the clipboard, Undo and Redo, the Trash, and the alerts they ask.
|
|
341
|
-
* Drops, pastes and imports run through {@link useWorkspaceTransfer}, so a
|
|
342
|
-
* drag, a shortcut and a menu item do the same thing.
|
|
343
|
-
*
|
|
344
|
-
* ```tsx
|
|
345
|
-
* const files = useWorkspaceFileCommands({ home, openFolder });
|
|
346
|
-
* <WorkspaceDesktop commands={files.commands(home, "desktop")} … />
|
|
347
|
-
* {files.dialogs}
|
|
348
|
-
* ```
|
|
349
|
-
*/
|
|
350
|
-
function useWorkspaceFileCommands(t0) {
|
|
351
|
-
const $ = c(111);
|
|
352
|
-
const { home, readOnly: t1, openFolder, getInfo, onStatus } = t0;
|
|
353
|
-
let t2;
|
|
354
|
-
if ($[0] !== t1) {
|
|
355
|
-
t2 = t1 === void 0 ? [] : t1;
|
|
356
|
-
$[0] = t1;
|
|
357
|
-
$[1] = t2;
|
|
358
|
-
} else t2 = $[1];
|
|
359
|
-
const readOnly = t2;
|
|
360
|
-
const queryClient = useQueryClient();
|
|
361
|
-
let t3;
|
|
362
|
-
if ($[2] !== onStatus) {
|
|
363
|
-
t3 = { onStatus };
|
|
364
|
-
$[2] = onStatus;
|
|
365
|
-
$[3] = t3;
|
|
366
|
-
} else t3 = $[3];
|
|
367
|
-
const transfer = useWorkspaceTransfer(t3);
|
|
368
|
-
const [clipboard, setClipboard] = React.useState(null);
|
|
369
|
-
let t4;
|
|
370
|
-
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
371
|
-
t4 = [];
|
|
372
|
-
$[4] = t4;
|
|
373
|
-
} else t4 = $[4];
|
|
374
|
-
const [undoStack, setUndoStack] = React.useState(t4);
|
|
375
|
-
let t5;
|
|
376
|
-
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
377
|
-
t5 = [];
|
|
378
|
-
$[5] = t5;
|
|
379
|
-
} else t5 = $[5];
|
|
380
|
-
const [redoStack, setRedoStack] = React.useState(t5);
|
|
381
|
-
const [confirm, setConfirm] = React.useState(null);
|
|
382
|
-
const busy = React.useRef(false);
|
|
383
|
-
const trashFull = useQuery({
|
|
384
|
-
queryKey: workspaceTrashQueryKey(home.sourceKey),
|
|
385
|
-
queryFn: () => workspaceTrashIsFull(home.source),
|
|
386
|
-
staleTime: Infinity
|
|
387
|
-
}).data ?? false;
|
|
388
|
-
let t6;
|
|
389
|
-
if ($[6] !== home.sourceKey || $[7] !== readOnly) {
|
|
390
|
-
t6 = (volume, path) => volume.sourceKey === home.sourceKey && readOnly.some((folder) => isWithin(path, folder));
|
|
391
|
-
$[6] = home.sourceKey;
|
|
392
|
-
$[7] = readOnly;
|
|
393
|
-
$[8] = t6;
|
|
394
|
-
} else t6 = $[8];
|
|
395
|
-
const locked = t6;
|
|
396
|
-
let t7;
|
|
397
|
-
if ($[9] !== queryClient) {
|
|
398
|
-
t7 = (volume_0) => queryClient.invalidateQueries({ queryKey: ["workspace", volume_0.sourceKey] });
|
|
399
|
-
$[9] = queryClient;
|
|
400
|
-
$[10] = t7;
|
|
401
|
-
} else t7 = $[10];
|
|
402
|
-
const reload = t7;
|
|
403
|
-
let t8;
|
|
404
|
-
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
405
|
-
t8 = function record(entry) {
|
|
406
|
-
if (!entry.operations.length) return;
|
|
407
|
-
setUndoStack((stack) => [...stack, entry]);
|
|
408
|
-
setRedoStack([]);
|
|
409
|
-
};
|
|
410
|
-
$[11] = t8;
|
|
411
|
-
} else t8 = $[11];
|
|
412
|
-
const record = t8;
|
|
413
|
-
let t9;
|
|
414
|
-
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
415
|
-
t9 = function ask(question) {
|
|
416
|
-
return new Promise((resolve) => setConfirm({
|
|
417
|
-
...question,
|
|
418
|
-
resolve
|
|
419
|
-
}));
|
|
420
|
-
};
|
|
421
|
-
$[12] = t9;
|
|
422
|
-
} else t9 = $[12];
|
|
423
|
-
const ask = t9;
|
|
424
|
-
let t10;
|
|
425
|
-
if ($[13] !== confirm) {
|
|
426
|
-
t10 = function answer(confirmed) {
|
|
427
|
-
confirm?.resolve(confirmed);
|
|
428
|
-
setConfirm(null);
|
|
429
|
-
};
|
|
430
|
-
$[13] = confirm;
|
|
431
|
-
$[14] = t10;
|
|
432
|
-
} else t10 = $[14];
|
|
433
|
-
const answer = t10;
|
|
434
|
-
let t11;
|
|
435
|
-
if ($[15] !== transfer) {
|
|
436
|
-
t11 = async function exclusive(title, work) {
|
|
437
|
-
if (busy.current) return;
|
|
438
|
-
busy.current = true;
|
|
439
|
-
const result = await work().then(_temp, _temp2);
|
|
440
|
-
busy.current = false;
|
|
441
|
-
if ("error" in result) {
|
|
442
|
-
transfer.alert({
|
|
443
|
-
title,
|
|
444
|
-
detail: formatOperationError(result.error)
|
|
445
|
-
});
|
|
446
|
-
return;
|
|
447
|
-
}
|
|
448
|
-
return result.value;
|
|
449
|
-
};
|
|
450
|
-
$[15] = transfer;
|
|
451
|
-
$[16] = t11;
|
|
452
|
-
} else t11 = $[16];
|
|
453
|
-
const exclusive = t11;
|
|
454
|
-
let t12;
|
|
455
|
-
if ($[17] !== exclusive || $[18] !== reload) {
|
|
456
|
-
t12 = async function apply(volume_1, label, operations) {
|
|
457
|
-
const inverse = await exclusive(`${label} couldn’t be completed`, () => runWorkspaceFileOperations(volume_1.source, operations));
|
|
458
|
-
await reload(volume_1);
|
|
459
|
-
if (!inverse) return [];
|
|
460
|
-
record({
|
|
461
|
-
label,
|
|
462
|
-
volume: volume_1,
|
|
463
|
-
operations: inverse
|
|
464
|
-
});
|
|
465
|
-
return workspaceFileOperationPaths(inverse);
|
|
466
|
-
};
|
|
467
|
-
$[17] = exclusive;
|
|
468
|
-
$[18] = reload;
|
|
469
|
-
$[19] = t12;
|
|
470
|
-
} else t12 = $[19];
|
|
471
|
-
const apply = t12;
|
|
472
|
-
let t13;
|
|
473
|
-
if ($[20] !== apply || $[21] !== exclusive || $[22] !== locked || $[23] !== reload) {
|
|
474
|
-
t13 = async function trash(volume_2, all) {
|
|
475
|
-
const paths = all.filter((path_0) => !locked(volume_2, path_0));
|
|
476
|
-
if (!paths.length) return;
|
|
477
|
-
if (!volume_2.linked) {
|
|
478
|
-
await apply(volume_2, `Move of ${subject(paths)}`, paths.map(_temp3));
|
|
479
|
-
return;
|
|
480
|
-
}
|
|
481
|
-
if (!await ask({
|
|
482
|
-
title: paths.length === 1 ? `Are you sure you want to delete ${subject(paths)}?` : `Are you sure you want to delete these ${paths.length} items?`,
|
|
483
|
-
detail: `${paths.length === 1 ? "This item" : "These items"} will be deleted immediately. You can’t undo this action.`,
|
|
484
|
-
action: "Delete"
|
|
485
|
-
})) return;
|
|
486
|
-
await exclusive("The items couldn’t be deleted", async () => {
|
|
487
|
-
for (const path_2 of paths) await volume_2.source.rm(path_2, {
|
|
488
|
-
recursive: true,
|
|
489
|
-
force: true
|
|
490
|
-
});
|
|
491
|
-
});
|
|
492
|
-
await reload(volume_2);
|
|
493
|
-
};
|
|
494
|
-
$[20] = apply;
|
|
495
|
-
$[21] = exclusive;
|
|
496
|
-
$[22] = locked;
|
|
497
|
-
$[23] = reload;
|
|
498
|
-
$[24] = t13;
|
|
499
|
-
} else t13 = $[24];
|
|
500
|
-
const trash = t13;
|
|
501
|
-
let t14;
|
|
502
|
-
if ($[25] !== exclusive || $[26] !== home || $[27] !== reload) {
|
|
503
|
-
t14 = async function emptyTrash() {
|
|
504
|
-
if (!await ask({
|
|
505
|
-
title: "Are you sure you want to permanently erase the items in the Trash?",
|
|
506
|
-
detail: "You can’t undo this action.",
|
|
507
|
-
action: "Empty Trash"
|
|
508
|
-
})) return;
|
|
509
|
-
await exclusive("The Trash couldn’t be emptied", () => emptyWorkspaceTrash(home.source));
|
|
510
|
-
await reload(home);
|
|
511
|
-
};
|
|
512
|
-
$[25] = exclusive;
|
|
513
|
-
$[26] = home;
|
|
514
|
-
$[27] = reload;
|
|
515
|
-
$[28] = t14;
|
|
516
|
-
} else t14 = $[28];
|
|
517
|
-
const emptyTrash = t14;
|
|
518
|
-
let t15;
|
|
519
|
-
if ($[29] !== home || $[30] !== locked || $[31] !== transfer || $[32] !== trash) {
|
|
520
|
-
t15 = async function drop(volume_3, dropped, directory, requested, label_0) {
|
|
521
|
-
if (locked(volume_3, directory)) return [];
|
|
522
|
-
const operation = dropped.kind === "workspace" && dropped.sourceKey === home.sourceKey && dropped.paths.some((path_3) => locked(home, path_3)) ? "copy" : requested;
|
|
523
|
-
if (dropped.kind === "workspace" && dropped.sourceKey === volume_3.sourceKey && !volume_3.linked && directory === "/.Trash") {
|
|
524
|
-
await trash(volume_3, dropped.paths);
|
|
525
|
-
return [];
|
|
526
|
-
}
|
|
527
|
-
const result_0 = await transfer.run({
|
|
528
|
-
drop: dropped,
|
|
529
|
-
destination: volume_3.source,
|
|
530
|
-
destinationKey: volume_3.sourceKey,
|
|
531
|
-
directory,
|
|
532
|
-
operation
|
|
533
|
-
});
|
|
534
|
-
if (!result_0) return [];
|
|
535
|
-
const moved = dropped.kind === "workspace" && dropped.sourceKey === volume_3.sourceKey;
|
|
536
|
-
const operations_0 = result_0.landed.flatMap((t16) => {
|
|
537
|
-
const { from, path: path_4 } = t16;
|
|
538
|
-
return moved && operation === "move" && from ? [{
|
|
539
|
-
kind: "move",
|
|
540
|
-
from: path_4,
|
|
541
|
-
to: from
|
|
542
|
-
}] : volume_3.linked ? [] : [{
|
|
543
|
-
kind: "trash",
|
|
544
|
-
path: path_4
|
|
545
|
-
}];
|
|
546
|
-
});
|
|
547
|
-
const paths_0 = result_0.landed.map(_temp4);
|
|
548
|
-
record({
|
|
549
|
-
label: label_0 ?? `${moved && operation === "move" ? "Move" : "Copy"} of ${subject(paths_0)}`,
|
|
550
|
-
volume: volume_3,
|
|
551
|
-
operations: operations_0.toReversed()
|
|
552
|
-
});
|
|
553
|
-
return paths_0;
|
|
554
|
-
};
|
|
555
|
-
$[29] = home;
|
|
556
|
-
$[30] = locked;
|
|
557
|
-
$[31] = transfer;
|
|
558
|
-
$[32] = trash;
|
|
559
|
-
$[33] = t15;
|
|
560
|
-
} else t15 = $[33];
|
|
561
|
-
const drop = t15;
|
|
562
|
-
let t16;
|
|
563
|
-
if ($[34] !== exclusive || $[35] !== redoStack || $[36] !== reload || $[37] !== undoStack) {
|
|
564
|
-
t16 = async function step(direction) {
|
|
565
|
-
const [from_0, setFrom, setTo] = direction === "undo" ? [
|
|
566
|
-
undoStack,
|
|
567
|
-
setUndoStack,
|
|
568
|
-
setRedoStack
|
|
569
|
-
] : [
|
|
570
|
-
redoStack,
|
|
571
|
-
setRedoStack,
|
|
572
|
-
setUndoStack
|
|
573
|
-
];
|
|
574
|
-
const entry_0 = from_0.at(-1);
|
|
575
|
-
if (!entry_0) return [];
|
|
576
|
-
const inverse_0 = await exclusive(`${direction === "undo" ? "Undo" : "Redo"} ${entry_0.label} couldn’t be completed`, () => runWorkspaceFileOperations(entry_0.volume.source, entry_0.operations));
|
|
577
|
-
await reload(entry_0.volume);
|
|
578
|
-
setFrom(_temp5);
|
|
579
|
-
if (!inverse_0) return [];
|
|
580
|
-
setTo((stack_1) => [...stack_1, {
|
|
581
|
-
...entry_0,
|
|
582
|
-
operations: inverse_0
|
|
583
|
-
}]);
|
|
584
|
-
return workspaceFileOperationPaths(inverse_0);
|
|
585
|
-
};
|
|
586
|
-
$[34] = exclusive;
|
|
587
|
-
$[35] = redoStack;
|
|
588
|
-
$[36] = reload;
|
|
589
|
-
$[37] = undoStack;
|
|
590
|
-
$[38] = t16;
|
|
591
|
-
} else t16 = $[38];
|
|
592
|
-
const step = t16;
|
|
593
|
-
let t17;
|
|
594
|
-
if ($[39] !== apply || $[40] !== clipboard || $[41] !== drop || $[42] !== emptyTrash || $[43] !== exclusive || $[44] !== getInfo || $[45] !== locked || $[46] !== openFolder || $[47] !== redoStack.length || $[48] !== reload || $[49] !== step || $[50] !== transfer || $[51] !== trash || $[52] !== trashFull || $[53] !== undoStack.length) {
|
|
595
|
-
t17 = function commands(volume_4, surface) {
|
|
596
|
-
const canRun = (command, target) => {
|
|
597
|
-
const inTrash = !volume_4.linked && target.directory === "/.Trash";
|
|
598
|
-
const some = target.paths.length > 0;
|
|
599
|
-
const fixed = target.paths.some((path_6) => locked(volume_4, path_6));
|
|
600
|
-
const closed = locked(volume_4, target.directory);
|
|
601
|
-
switch (command) {
|
|
602
|
-
case "open":
|
|
603
|
-
case "quick-look":
|
|
604
|
-
case "copy": return some;
|
|
605
|
-
case "cut": return some && !fixed;
|
|
606
|
-
case "get-info": return getInfo !== void 0;
|
|
607
|
-
case "select-all": return true;
|
|
608
|
-
case "rename": return target.paths.length === 1 && !inTrash && !fixed;
|
|
609
|
-
case "duplicate": return some && !inTrash && !closed;
|
|
610
|
-
case "trash": return some && !inTrash && !fixed;
|
|
611
|
-
case "paste": return !inTrash && !closed && (clipboard !== null || Boolean(target.files?.length));
|
|
612
|
-
case "move-here": return !inTrash && !closed && clipboard !== null;
|
|
613
|
-
case "new-folder": return !inTrash && !closed;
|
|
614
|
-
case "put-back": return some && inTrash;
|
|
615
|
-
case "empty-trash": return inTrash && trashFull;
|
|
616
|
-
case "show-in-finder": return surface === "desktop" && some;
|
|
617
|
-
case "undo": return undoStack.length > 0;
|
|
618
|
-
case "redo": return redoStack.length > 0;
|
|
619
|
-
}
|
|
620
|
-
};
|
|
621
|
-
return {
|
|
622
|
-
canRun,
|
|
623
|
-
pasteLabel: clipboard ? `Paste ${clipboard.paths.length === 1 ? "Item" : `${clipboard.paths.length} Items`}` : null,
|
|
624
|
-
rename: async (path_7, name) => {
|
|
625
|
-
if (locked(volume_4, path_7)) return path_7;
|
|
626
|
-
const to = await workspaceRenameTarget(volume_4.source, path_7, name).catch((error_0) => {
|
|
627
|
-
transfer.alert({
|
|
628
|
-
title: "That name can’t be used",
|
|
629
|
-
detail: formatOperationError(error_0)
|
|
630
|
-
});
|
|
631
|
-
throw error_0;
|
|
632
|
-
});
|
|
633
|
-
if (!to) return path_7;
|
|
634
|
-
return (await apply(volume_4, "Rename", [{
|
|
635
|
-
kind: "move",
|
|
636
|
-
from: path_7,
|
|
637
|
-
to
|
|
638
|
-
}])).length ? to : path_7;
|
|
639
|
-
},
|
|
640
|
-
run: async (command_0, target_0) => {
|
|
641
|
-
if (!canRun(command_0, target_0)) return;
|
|
642
|
-
const { paths: paths_1, directory: directory_0 } = target_0;
|
|
643
|
-
switch (command_0) {
|
|
644
|
-
case "copy":
|
|
645
|
-
case "cut":
|
|
646
|
-
writeSystemClipboard(volume_4.source, paths_1);
|
|
647
|
-
setClipboard({
|
|
648
|
-
volume: volume_4,
|
|
649
|
-
paths: paths_1,
|
|
650
|
-
cut: command_0 === "cut"
|
|
651
|
-
});
|
|
652
|
-
return;
|
|
653
|
-
case "paste":
|
|
654
|
-
case "move-here": {
|
|
655
|
-
if (target_0.files?.length) return drop(volume_4, {
|
|
656
|
-
kind: "files",
|
|
657
|
-
items: target_0.files.map(_temp6)
|
|
658
|
-
}, directory_0, "copy");
|
|
659
|
-
if (!clipboard) return;
|
|
660
|
-
const move = command_0 === "move-here" || clipboard.cut;
|
|
661
|
-
const landed = await drop(volume_4, {
|
|
662
|
-
kind: "workspace",
|
|
663
|
-
...clipboard.volume,
|
|
664
|
-
paths: clipboard.paths
|
|
665
|
-
}, directory_0, move ? "move" : "copy");
|
|
666
|
-
if (move) setClipboard(null);
|
|
667
|
-
return landed;
|
|
668
|
-
}
|
|
669
|
-
case "duplicate": return drop(volume_4, {
|
|
670
|
-
kind: "workspace",
|
|
671
|
-
...volume_4,
|
|
672
|
-
paths: paths_1
|
|
673
|
-
}, directory_0, "copy", `Duplicate of ${subject(paths_1)}`);
|
|
674
|
-
case "new-folder": {
|
|
675
|
-
const path_10 = await exclusive("The folder couldn’t be created", async () => {
|
|
676
|
-
const path_9 = await newWorkspaceFolderPath(volume_4.source, directory_0);
|
|
677
|
-
await volume_4.source.mkdir(path_9);
|
|
678
|
-
return path_9;
|
|
679
|
-
});
|
|
680
|
-
await reload(volume_4);
|
|
681
|
-
if (!path_10) return;
|
|
682
|
-
if (!volume_4.linked) record({
|
|
683
|
-
label: "New Folder",
|
|
684
|
-
volume: volume_4,
|
|
685
|
-
operations: [{
|
|
686
|
-
kind: "trash",
|
|
687
|
-
path: path_10
|
|
688
|
-
}]
|
|
689
|
-
});
|
|
690
|
-
return [path_10];
|
|
691
|
-
}
|
|
692
|
-
case "trash": return trash(volume_4, paths_1);
|
|
693
|
-
case "put-back": return apply(volume_4, "Put Back", paths_1.map(_temp7));
|
|
694
|
-
case "empty-trash": return emptyTrash();
|
|
695
|
-
case "get-info": return getInfo?.(volume_4, paths_1.length ? paths_1 : [directory_0]);
|
|
696
|
-
case "show-in-finder":
|
|
697
|
-
openFolder(workspaceDirname(paths_1.at(-1)));
|
|
698
|
-
return;
|
|
699
|
-
case "undo":
|
|
700
|
-
case "redo": return step(command_0);
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
};
|
|
704
|
-
};
|
|
705
|
-
$[39] = apply;
|
|
706
|
-
$[40] = clipboard;
|
|
707
|
-
$[41] = drop;
|
|
708
|
-
$[42] = emptyTrash;
|
|
709
|
-
$[43] = exclusive;
|
|
710
|
-
$[44] = getInfo;
|
|
711
|
-
$[45] = locked;
|
|
712
|
-
$[46] = openFolder;
|
|
713
|
-
$[47] = redoStack.length;
|
|
714
|
-
$[48] = reload;
|
|
715
|
-
$[49] = step;
|
|
716
|
-
$[50] = transfer;
|
|
717
|
-
$[51] = trash;
|
|
718
|
-
$[52] = trashFull;
|
|
719
|
-
$[53] = undoStack.length;
|
|
720
|
-
$[54] = t17;
|
|
721
|
-
} else t17 = $[54];
|
|
722
|
-
const commands = t17;
|
|
723
|
-
const t18 = confirm !== null;
|
|
724
|
-
let t19;
|
|
725
|
-
if ($[55] !== answer) {
|
|
726
|
-
t19 = (open) => !open && answer(false);
|
|
727
|
-
$[55] = answer;
|
|
728
|
-
$[56] = t19;
|
|
729
|
-
} else t19 = $[56];
|
|
730
|
-
let t20;
|
|
731
|
-
if ($[57] === Symbol.for("react.memo_cache_sentinel")) {
|
|
732
|
-
t20 = /* @__PURE__ */ jsx(AlertDialog.Backdrop, {});
|
|
733
|
-
$[57] = t20;
|
|
734
|
-
} else t20 = $[57];
|
|
735
|
-
const t21 = confirm?.title;
|
|
736
|
-
let t22;
|
|
737
|
-
if ($[58] !== t21) {
|
|
738
|
-
t22 = /* @__PURE__ */ jsx(AlertDialog.Title, { children: t21 });
|
|
739
|
-
$[58] = t21;
|
|
740
|
-
$[59] = t22;
|
|
741
|
-
} else t22 = $[59];
|
|
742
|
-
const t23 = confirm?.detail;
|
|
743
|
-
let t24;
|
|
744
|
-
if ($[60] !== t23) {
|
|
745
|
-
t24 = /* @__PURE__ */ jsx(AlertDialog.Description, { children: t23 });
|
|
746
|
-
$[60] = t23;
|
|
747
|
-
$[61] = t24;
|
|
748
|
-
} else t24 = $[61];
|
|
749
|
-
let t25;
|
|
750
|
-
if ($[62] !== t22 || $[63] !== t24) {
|
|
751
|
-
t25 = /* @__PURE__ */ jsxs(AlertDialog.Header, { children: [t22, t24] });
|
|
752
|
-
$[62] = t22;
|
|
753
|
-
$[63] = t24;
|
|
754
|
-
$[64] = t25;
|
|
755
|
-
} else t25 = $[64];
|
|
756
|
-
let t26;
|
|
757
|
-
if ($[65] === Symbol.for("react.memo_cache_sentinel")) {
|
|
758
|
-
t26 = /* @__PURE__ */ jsx(AlertDialog.Close, { children: "Cancel" });
|
|
759
|
-
$[65] = t26;
|
|
760
|
-
} else t26 = $[65];
|
|
761
|
-
let t27;
|
|
762
|
-
if ($[66] !== answer) {
|
|
763
|
-
t27 = () => answer(true);
|
|
764
|
-
$[66] = answer;
|
|
765
|
-
$[67] = t27;
|
|
766
|
-
} else t27 = $[67];
|
|
767
|
-
const t28 = confirm?.action;
|
|
768
|
-
let t29;
|
|
769
|
-
if ($[68] !== t27 || $[69] !== t28) {
|
|
770
|
-
t29 = /* @__PURE__ */ jsxs(AlertDialog.Footer, { children: [t26, /* @__PURE__ */ jsx(Button, {
|
|
771
|
-
color: "destructive",
|
|
772
|
-
onClick: t27,
|
|
773
|
-
children: t28
|
|
774
|
-
})] });
|
|
775
|
-
$[68] = t27;
|
|
776
|
-
$[69] = t28;
|
|
777
|
-
$[70] = t29;
|
|
778
|
-
} else t29 = $[70];
|
|
779
|
-
let t30;
|
|
780
|
-
if ($[71] !== t25 || $[72] !== t29) {
|
|
781
|
-
t30 = /* @__PURE__ */ jsxs(AlertDialog.Portal, { children: [t20, /* @__PURE__ */ jsx(AlertDialog.Viewport, { children: /* @__PURE__ */ jsxs(AlertDialog.Popup, {
|
|
782
|
-
size: "sm",
|
|
783
|
-
children: [t25, t29]
|
|
784
|
-
}) })] });
|
|
785
|
-
$[71] = t25;
|
|
786
|
-
$[72] = t29;
|
|
787
|
-
$[73] = t30;
|
|
788
|
-
} else t30 = $[73];
|
|
789
|
-
let t31;
|
|
790
|
-
if ($[74] !== t18 || $[75] !== t19 || $[76] !== t30) {
|
|
791
|
-
t31 = /* @__PURE__ */ jsx(AlertDialog.Root, {
|
|
792
|
-
open: t18,
|
|
793
|
-
onOpenChange: t19,
|
|
794
|
-
children: t30
|
|
795
|
-
});
|
|
796
|
-
$[74] = t18;
|
|
797
|
-
$[75] = t19;
|
|
798
|
-
$[76] = t30;
|
|
799
|
-
$[77] = t31;
|
|
800
|
-
} else t31 = $[77];
|
|
801
|
-
let t32;
|
|
802
|
-
if ($[78] !== t31 || $[79] !== transfer.dialogs) {
|
|
803
|
-
t32 = /* @__PURE__ */ jsxs(Fragment, { children: [transfer.dialogs, t31] });
|
|
804
|
-
$[78] = t31;
|
|
805
|
-
$[79] = transfer.dialogs;
|
|
806
|
-
$[80] = t32;
|
|
807
|
-
} else t32 = $[80];
|
|
808
|
-
const dialogs = t32;
|
|
809
|
-
let t33;
|
|
810
|
-
if ($[81] !== undoStack) {
|
|
811
|
-
t33 = undoStack.at(-1)?.label ?? null;
|
|
812
|
-
$[81] = undoStack;
|
|
813
|
-
$[82] = t33;
|
|
814
|
-
} else t33 = $[82];
|
|
815
|
-
let t34;
|
|
816
|
-
if ($[83] !== redoStack) {
|
|
817
|
-
t34 = redoStack.at(-1)?.label ?? null;
|
|
818
|
-
$[83] = redoStack;
|
|
819
|
-
$[84] = t34;
|
|
820
|
-
} else t34 = $[84];
|
|
821
|
-
let t35;
|
|
822
|
-
let t36;
|
|
823
|
-
if ($[85] !== step) {
|
|
824
|
-
t35 = () => void step("undo");
|
|
825
|
-
t36 = () => void step("redo");
|
|
826
|
-
$[85] = step;
|
|
827
|
-
$[86] = t35;
|
|
828
|
-
$[87] = t36;
|
|
829
|
-
} else {
|
|
830
|
-
t35 = $[86];
|
|
831
|
-
t36 = $[87];
|
|
832
|
-
}
|
|
833
|
-
let t37;
|
|
834
|
-
if ($[88] !== emptyTrash) {
|
|
835
|
-
t37 = () => void emptyTrash();
|
|
836
|
-
$[88] = emptyTrash;
|
|
837
|
-
$[89] = t37;
|
|
838
|
-
} else t37 = $[89];
|
|
839
|
-
let t38;
|
|
840
|
-
if ($[90] !== home.source || $[91] !== openFolder) {
|
|
841
|
-
t38 = () => void home.source.mkdir(WORKSPACE_TRASH, { recursive: true }).then(() => openFolder(WORKSPACE_TRASH));
|
|
842
|
-
$[90] = home.source;
|
|
843
|
-
$[91] = openFolder;
|
|
844
|
-
$[92] = t38;
|
|
845
|
-
} else t38 = $[92];
|
|
846
|
-
let t39;
|
|
847
|
-
if ($[93] !== home || $[94] !== trash) {
|
|
848
|
-
t39 = (t40) => {
|
|
849
|
-
const { sourceKey, paths: paths_2 } = t40;
|
|
850
|
-
if (sourceKey === home.sourceKey) trash(home, paths_2);
|
|
851
|
-
};
|
|
852
|
-
$[93] = home;
|
|
853
|
-
$[94] = trash;
|
|
854
|
-
$[95] = t39;
|
|
855
|
-
} else t39 = $[95];
|
|
856
|
-
let t40;
|
|
857
|
-
if ($[96] !== commands || $[97] !== dialogs || $[98] !== drop || $[99] !== home || $[100] !== t33 || $[101] !== t34 || $[102] !== t35 || $[103] !== t36 || $[104] !== t37 || $[105] !== t38 || $[106] !== t39 || $[107] !== transfer.cancel || $[108] !== transfer.transferring || $[109] !== trashFull) {
|
|
858
|
-
t40 = {
|
|
859
|
-
home,
|
|
860
|
-
commands,
|
|
861
|
-
drop,
|
|
862
|
-
undoLabel: t33,
|
|
863
|
-
redoLabel: t34,
|
|
864
|
-
undo: t35,
|
|
865
|
-
redo: t36,
|
|
866
|
-
trashFull,
|
|
867
|
-
emptyTrash: t37,
|
|
868
|
-
openTrash: t38,
|
|
869
|
-
trashDrop: t39,
|
|
870
|
-
transferring: transfer.transferring,
|
|
871
|
-
cancelTransfer: transfer.cancel,
|
|
872
|
-
dialogs
|
|
873
|
-
};
|
|
874
|
-
$[96] = commands;
|
|
875
|
-
$[97] = dialogs;
|
|
876
|
-
$[98] = drop;
|
|
877
|
-
$[99] = home;
|
|
878
|
-
$[100] = t33;
|
|
879
|
-
$[101] = t34;
|
|
880
|
-
$[102] = t35;
|
|
881
|
-
$[103] = t36;
|
|
882
|
-
$[104] = t37;
|
|
883
|
-
$[105] = t38;
|
|
884
|
-
$[106] = t39;
|
|
885
|
-
$[107] = transfer.cancel;
|
|
886
|
-
$[108] = transfer.transferring;
|
|
887
|
-
$[109] = trashFull;
|
|
888
|
-
$[110] = t40;
|
|
889
|
-
} else t40 = $[110];
|
|
890
|
-
return t40;
|
|
891
|
-
}
|
|
892
|
-
function _temp7(path_8) {
|
|
893
|
-
return {
|
|
894
|
-
kind: "put-back",
|
|
895
|
-
path: path_8
|
|
896
|
-
};
|
|
897
|
-
}
|
|
898
|
-
function _temp6(file) {
|
|
899
|
-
return {
|
|
900
|
-
kind: "file",
|
|
901
|
-
name: file.name,
|
|
902
|
-
file
|
|
903
|
-
};
|
|
904
|
-
}
|
|
905
|
-
function _temp5(stack_0) {
|
|
906
|
-
return stack_0.slice(0, -1);
|
|
907
|
-
}
|
|
908
|
-
function _temp4(t0) {
|
|
909
|
-
const { path: path_5 } = t0;
|
|
910
|
-
return path_5;
|
|
911
|
-
}
|
|
912
|
-
function _temp3(path_1) {
|
|
913
|
-
return {
|
|
914
|
-
kind: "trash",
|
|
915
|
-
path: path_1
|
|
916
|
-
};
|
|
917
|
-
}
|
|
918
|
-
function _temp2(error) {
|
|
919
|
-
return { error };
|
|
920
|
-
}
|
|
921
|
-
function _temp(value) {
|
|
922
|
-
return { value };
|
|
923
|
-
}
|
|
924
|
-
//#endregion
|
|
1
|
+
import { _ as workspaceFileShortcut, d as isHiddenWorkspaceEntry, f as isInWorkspaceTrash, g as workspaceFileCommandForKey, h as useWorkspaceFileCommands, m as runWorkspaceFileOperations, p as isWithin, u as WORKSPACE_TRASH, v as workspaceRenameTarget, y as workspaceTrashIsFull } from "../../WorkspaceFileTransfer-D2cOoVyO.js";
|
|
925
2
|
export { WORKSPACE_TRASH, isHiddenWorkspaceEntry, isInWorkspaceTrash, isWithin, runWorkspaceFileOperations, useWorkspaceFileCommands, workspaceFileCommandForKey, workspaceFileShortcut, workspaceRenameTarget, workspaceTrashIsFull };
|