@mcp-b/react-components 0.69.0 → 0.71.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/AgentComputer-CpS9R2KG.d.ts +305 -0
- package/dist/{AgentComputer-CFJxjMFE.js → AgentComputer-DZCyQkcE.js} +1850 -478
- package/dist/CommandPalette-DDctKdpC.d.ts +53 -0
- package/dist/ComputerCalendar-Ci7tLASe.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/Context-CYUxZrwW.js +918 -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 +365 -89
- 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 -842
- package/dist/components/ai-sdk/Plan.d.ts +33 -9
- package/dist/components/ai-sdk/Plan.js +336 -107
- 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-DuT5-rDz.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/styles/plan.css +160 -23
- 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/progress-ring-BO649JA9.js +0 -79
- package/dist/{ManagerOffice-kSK7vTBl.js → ManagerOffice-BJ2vs-Lr.js} +2 -2
- package/dist/{WorkspaceLink-DK9kdMUH.js → WorkspaceLink-DDkj-Tq5.js} +1 -1
|
@@ -1,39 +1,2 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
|
|
3
|
-
//#region src/components/agents-sdk/ComputerCustomWallpaper.d.ts
|
|
4
|
-
/** A person's own background image, prepared for bounded browser storage. */
|
|
5
|
-
export interface CustomWallpaper {
|
|
6
|
-
label: string;
|
|
7
|
-
dataUrl: string;
|
|
8
|
-
fit: "fill" | "fit";
|
|
9
|
-
x: number;
|
|
10
|
-
y: number;
|
|
11
|
-
}
|
|
12
|
-
/** The chosen background, and the person's own image if they added one. */
|
|
13
|
-
export interface ComputerWallpaper {
|
|
14
|
-
value: string;
|
|
15
|
-
custom: CustomWallpaper | null;
|
|
16
|
-
}
|
|
17
|
-
/** A saved background, or null when it names no wallpaper this desktop has. */
|
|
18
|
-
export declare function readWallpaper(value: unknown): ComputerWallpaper | null;
|
|
19
|
-
export interface UseComputerWallpaperOptions {
|
|
20
|
-
/** The saved choice; `readWallpaper` validates one from storage. */
|
|
21
|
-
wallpaper: ComputerWallpaper;
|
|
22
|
-
/** Saves a new choice, including the prepared image and its placement. */
|
|
23
|
-
onChange: (next: ComputerWallpaper) => void;
|
|
24
|
-
/** Where the choice is kept, under the controls. */
|
|
25
|
-
hint: ReactNode;
|
|
26
|
-
}
|
|
27
|
-
/** The desktop background with a person's own image: `AgentComputer`'s wallpaper and Settings' fields. */
|
|
28
|
-
export declare function useComputerWallpaper({ wallpaper, onChange, hint }: UseComputerWallpaperOptions): {
|
|
29
|
-
/** The background the computer shows, for `AgentComputer`'s `wallpaper`. */
|
|
30
|
-
selected: WallpaperOption;
|
|
31
|
-
/** ComputerSettings.Host's wallpaper fields. */
|
|
32
|
-
settings: {
|
|
33
|
-
wallpapers: readonly WallpaperOption[];
|
|
34
|
-
wallpaper: string;
|
|
35
|
-
onWallpaperChange: (next: string) => void;
|
|
36
|
-
display: import("react").JSX.Element;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
//#endregion
|
|
1
|
+
import { n as CustomWallpaper, r as readWallpaper, t as ComputerWallpaper } from "../../ComputerCustomWallpaper-D4lgwj2k.js";
|
|
2
|
+
export { ComputerWallpaper, CustomWallpaper, readWallpaper };
|
|
@@ -1,522 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { Slider } from "../foundations/Slider.js";
|
|
4
|
-
import { Radio, RadioGroup } from "../foundations/RadioGroup.js";
|
|
5
|
-
import { c } from "react/compiler-runtime";
|
|
6
|
-
import { useEffect, useEffectEvent, useId, useRef, useState } from "react";
|
|
7
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
-
//#region src/components/agents-sdk/ComputerCustomWallpaper.tsx
|
|
9
|
-
const JPEG_PREFIX = "data:image/jpeg;base64,";
|
|
10
|
-
const MAX_IMAGE_BYTES = 10485760;
|
|
11
|
-
const MAX_STORED_IMAGE_LENGTH = 75e4;
|
|
12
|
-
function readCustomWallpaper(image) {
|
|
13
|
-
if (!image || typeof image !== "object" || !("label" in image && "dataUrl" in image && "fit" in image && "x" in image && "y" in image) || typeof image.label !== "string" || !image.label.trim() || image.label.length > 240 || typeof image.dataUrl !== "string" || image.dataUrl.length > MAX_STORED_IMAGE_LENGTH || !/^data:image\/jpeg;base64,[a-z0-9+/]+=*$/i.test(image.dataUrl) || image.fit !== "fill" && image.fit !== "fit" || ![image.x, image.y].every((position) => typeof position === "number" && Number.isFinite(position) && position >= 0 && position <= 100)) return null;
|
|
14
|
-
const header = atob(image.dataUrl.slice(23, 31));
|
|
15
|
-
if (header.charCodeAt(0) !== 255 || header.charCodeAt(1) !== 216 || header.charCodeAt(2) !== 255) return null;
|
|
16
|
-
const { label, dataUrl, fit } = image;
|
|
17
|
-
return {
|
|
18
|
-
label,
|
|
19
|
-
dataUrl,
|
|
20
|
-
fit,
|
|
21
|
-
x: image.x,
|
|
22
|
-
y: image.y
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
/** A saved background, or null when it names no wallpaper this desktop has. */
|
|
26
|
-
function readWallpaper(value) {
|
|
27
|
-
if (!value || typeof value !== "object" || !("value" in value) || !("custom" in value)) return null;
|
|
28
|
-
const custom = value.custom === null ? null : readCustomWallpaper(value.custom);
|
|
29
|
-
if (value.custom !== null && !custom) return null;
|
|
30
|
-
if (value.value === "custom" ? !custom : !COMPUTER_WALLPAPERS.some((w) => w.value === value.value)) return null;
|
|
31
|
-
return {
|
|
32
|
-
value: value.value,
|
|
33
|
-
custom
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
async function prepareWallpaper(file) {
|
|
37
|
-
if (!file.size || file.size > MAX_IMAGE_BYTES) throw new Error("Choose an image smaller than 10 MB.");
|
|
38
|
-
const bytes = new Uint8Array(await file.slice(0, 12).arrayBuffer());
|
|
39
|
-
const isPng = [
|
|
40
|
-
137,
|
|
41
|
-
80,
|
|
42
|
-
78,
|
|
43
|
-
71,
|
|
44
|
-
13,
|
|
45
|
-
10,
|
|
46
|
-
26,
|
|
47
|
-
10
|
|
48
|
-
].every((byte, index) => bytes[index] === byte);
|
|
49
|
-
const isJpeg = bytes[0] === 255 && bytes[1] === 216 && bytes[2] === 255;
|
|
50
|
-
const isWebp = [
|
|
51
|
-
82,
|
|
52
|
-
73,
|
|
53
|
-
70,
|
|
54
|
-
70
|
|
55
|
-
].every((byte, index) => bytes[index] === byte) && [
|
|
56
|
-
87,
|
|
57
|
-
69,
|
|
58
|
-
66,
|
|
59
|
-
80
|
|
60
|
-
].every((byte, index) => bytes[index + 8] === byte);
|
|
61
|
-
if (!(file.type === "image/png" && isPng || file.type === "image/jpeg" && isJpeg || file.type === "image/webp" && isWebp)) throw new Error("Choose a PNG, JPEG, or WebP image.");
|
|
62
|
-
let bitmap;
|
|
63
|
-
try {
|
|
64
|
-
bitmap = await createImageBitmap(file);
|
|
65
|
-
} catch {
|
|
66
|
-
throw new Error("This image couldn’t be opened. Choose another image.");
|
|
67
|
-
}
|
|
68
|
-
try {
|
|
69
|
-
if (!bitmap.width || !bitmap.height || bitmap.width * bitmap.height > 4e7) throw new Error("Choose an image with fewer than 40 million pixels.");
|
|
70
|
-
const canvas = document.createElement("canvas");
|
|
71
|
-
const context = canvas.getContext("2d");
|
|
72
|
-
if (!context) throw new Error("Your browser couldn’t prepare this image.");
|
|
73
|
-
for (const edge of [
|
|
74
|
-
1600,
|
|
75
|
-
1200,
|
|
76
|
-
800
|
|
77
|
-
]) {
|
|
78
|
-
const scale = Math.min(1, edge / Math.max(bitmap.width, bitmap.height));
|
|
79
|
-
canvas.width = Math.max(1, Math.round(bitmap.width * scale));
|
|
80
|
-
canvas.height = Math.max(1, Math.round(bitmap.height * scale));
|
|
81
|
-
context.fillStyle = "#171c22";
|
|
82
|
-
context.fillRect(0, 0, canvas.width, canvas.height);
|
|
83
|
-
context.drawImage(bitmap, 0, 0, canvas.width, canvas.height);
|
|
84
|
-
const dataUrl = canvas.toDataURL("image/jpeg", .82);
|
|
85
|
-
if (dataUrl.startsWith(JPEG_PREFIX) && dataUrl.length <= MAX_STORED_IMAGE_LENGTH) return {
|
|
86
|
-
label: file.name.trim().slice(0, 240) || "Custom image",
|
|
87
|
-
dataUrl,
|
|
88
|
-
fit: "fill",
|
|
89
|
-
x: 50,
|
|
90
|
-
y: 50
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
throw new Error("This image is too detailed to save. Choose a smaller image.");
|
|
94
|
-
} finally {
|
|
95
|
-
bitmap.close();
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
function customOption(image) {
|
|
99
|
-
return {
|
|
100
|
-
value: "custom",
|
|
101
|
-
label: image.label,
|
|
102
|
-
background: `url("${image.dataUrl}") ${image.x}% ${image.y}% / ${image.fit === "fill" ? "cover" : "contain"} no-repeat #171c22`
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
/** The desktop background with a person's own image: `AgentComputer`'s wallpaper and Settings' fields. */
|
|
106
|
-
function useComputerWallpaper(t0) {
|
|
107
|
-
const $ = c(83);
|
|
108
|
-
const { wallpaper, onChange, hint } = t0;
|
|
109
|
-
const uploadButtonId = useId();
|
|
110
|
-
const uploadInput = useRef(null);
|
|
111
|
-
const helpId = useId();
|
|
112
|
-
const errorId = useId();
|
|
113
|
-
const uploadRevision = useRef(0);
|
|
114
|
-
const [uploading, setUploading] = useState(false);
|
|
115
|
-
const [uploadError, setUploadError] = useState("");
|
|
116
|
-
const { value, custom: saved } = wallpaper;
|
|
117
|
-
const [position, setPosition] = useState(null);
|
|
118
|
-
let t1;
|
|
119
|
-
if ($[0] !== position || $[1] !== saved) {
|
|
120
|
-
t1 = saved && position?.dataUrl === saved.dataUrl ? {
|
|
121
|
-
...saved,
|
|
122
|
-
x: position.x ?? saved.x,
|
|
123
|
-
y: position.y ?? saved.y
|
|
124
|
-
} : saved;
|
|
125
|
-
$[0] = position;
|
|
126
|
-
$[1] = saved;
|
|
127
|
-
$[2] = t1;
|
|
128
|
-
} else t1 = $[2];
|
|
129
|
-
const custom = t1;
|
|
130
|
-
const customUrl = saved?.dataUrl;
|
|
131
|
-
let t2;
|
|
132
|
-
if ($[3] !== onChange || $[4] !== value) {
|
|
133
|
-
t2 = () => {
|
|
134
|
-
onChange({
|
|
135
|
-
value: value === "custom" ? DEFAULT_COMPUTER_WALLPAPER : value,
|
|
136
|
-
custom: null
|
|
137
|
-
});
|
|
138
|
-
setUploadError("The saved image couldn’t be opened. Choose a new image.");
|
|
139
|
-
};
|
|
140
|
-
$[3] = onChange;
|
|
141
|
-
$[4] = value;
|
|
142
|
-
$[5] = t2;
|
|
143
|
-
} else t2 = $[5];
|
|
144
|
-
const dropUnreadable = useEffectEvent(t2);
|
|
145
|
-
let t3;
|
|
146
|
-
if ($[6] !== customUrl || $[7] !== dropUnreadable) {
|
|
147
|
-
t3 = () => {
|
|
148
|
-
if (!customUrl) return;
|
|
149
|
-
let active = true;
|
|
150
|
-
const image = new Image();
|
|
151
|
-
image.src = customUrl;
|
|
152
|
-
image.decode().catch(() => {
|
|
153
|
-
if (!active) return;
|
|
154
|
-
dropUnreadable();
|
|
155
|
-
});
|
|
156
|
-
return () => {
|
|
157
|
-
active = false;
|
|
158
|
-
};
|
|
159
|
-
};
|
|
160
|
-
$[6] = customUrl;
|
|
161
|
-
$[7] = dropUnreadable;
|
|
162
|
-
$[8] = t3;
|
|
163
|
-
} else t3 = $[8];
|
|
164
|
-
let t4;
|
|
165
|
-
if ($[9] !== customUrl) {
|
|
166
|
-
t4 = [customUrl];
|
|
167
|
-
$[9] = customUrl;
|
|
168
|
-
$[10] = t4;
|
|
169
|
-
} else t4 = $[10];
|
|
170
|
-
useEffect(t3, t4);
|
|
171
|
-
let t5;
|
|
172
|
-
let t6;
|
|
173
|
-
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
174
|
-
t5 = () => () => {
|
|
175
|
-
uploadRevision.current = uploadRevision.current + 1;
|
|
176
|
-
};
|
|
177
|
-
t6 = [];
|
|
178
|
-
$[11] = t5;
|
|
179
|
-
$[12] = t6;
|
|
180
|
-
} else {
|
|
181
|
-
t5 = $[11];
|
|
182
|
-
t6 = $[12];
|
|
183
|
-
}
|
|
184
|
-
useEffect(t5, t6);
|
|
185
|
-
const customLabel = custom?.label;
|
|
186
|
-
const customFit = custom?.fit;
|
|
187
|
-
const customX = custom?.x;
|
|
188
|
-
const customY = custom?.y;
|
|
189
|
-
let t7;
|
|
190
|
-
if ($[13] !== customFit || $[14] !== customLabel || $[15] !== customUrl || $[16] !== customX || $[17] !== customY) {
|
|
191
|
-
t7 = customUrl !== void 0 && customLabel !== void 0 && customFit !== void 0 && customX !== void 0 && customY !== void 0 ? [...COMPUTER_WALLPAPERS, customOption({
|
|
192
|
-
dataUrl: customUrl,
|
|
193
|
-
label: customLabel,
|
|
194
|
-
fit: customFit,
|
|
195
|
-
x: customX,
|
|
196
|
-
y: customY
|
|
197
|
-
})] : COMPUTER_WALLPAPERS;
|
|
198
|
-
$[13] = customFit;
|
|
199
|
-
$[14] = customLabel;
|
|
200
|
-
$[15] = customUrl;
|
|
201
|
-
$[16] = customX;
|
|
202
|
-
$[17] = customY;
|
|
203
|
-
$[18] = t7;
|
|
204
|
-
} else t7 = $[18];
|
|
205
|
-
const wallpapers = t7;
|
|
206
|
-
let t8;
|
|
207
|
-
if ($[19] !== value || $[20] !== wallpapers) {
|
|
208
|
-
let t9;
|
|
209
|
-
if ($[22] !== value) {
|
|
210
|
-
t9 = (wallpaper_0) => wallpaper_0.value === value;
|
|
211
|
-
$[22] = value;
|
|
212
|
-
$[23] = t9;
|
|
213
|
-
} else t9 = $[23];
|
|
214
|
-
t8 = wallpapers.find(t9);
|
|
215
|
-
$[19] = value;
|
|
216
|
-
$[20] = wallpapers;
|
|
217
|
-
$[21] = t8;
|
|
218
|
-
} else t8 = $[21];
|
|
219
|
-
const selected = t8;
|
|
220
|
-
let t9;
|
|
221
|
-
if ($[24] !== onChange) {
|
|
222
|
-
t9 = function save(next, image_0) {
|
|
223
|
-
setPosition(null);
|
|
224
|
-
onChange({
|
|
225
|
-
value: next,
|
|
226
|
-
custom: image_0
|
|
227
|
-
});
|
|
228
|
-
};
|
|
229
|
-
$[24] = onChange;
|
|
230
|
-
$[25] = t9;
|
|
231
|
-
} else t9 = $[25];
|
|
232
|
-
const save = t9;
|
|
233
|
-
let t10;
|
|
234
|
-
if ($[26] !== save || $[27] !== saved || $[28] !== wallpapers) {
|
|
235
|
-
t10 = function select(next_0) {
|
|
236
|
-
if (!wallpapers.some((wallpaper_1) => wallpaper_1.value === next_0)) return;
|
|
237
|
-
uploadRevision.current = uploadRevision.current + 1;
|
|
238
|
-
setUploading(false);
|
|
239
|
-
save(next_0, saved);
|
|
240
|
-
};
|
|
241
|
-
$[26] = save;
|
|
242
|
-
$[27] = saved;
|
|
243
|
-
$[28] = wallpapers;
|
|
244
|
-
$[29] = t10;
|
|
245
|
-
} else t10 = $[29];
|
|
246
|
-
const select = t10;
|
|
247
|
-
let t11;
|
|
248
|
-
if ($[30] !== save || $[31] !== saved) {
|
|
249
|
-
t11 = function updateCustom(patch, t12) {
|
|
250
|
-
const persist = t12 === void 0 ? true : t12;
|
|
251
|
-
if (!saved) return;
|
|
252
|
-
if (persist) save("custom", {
|
|
253
|
-
...saved,
|
|
254
|
-
...patch
|
|
255
|
-
});
|
|
256
|
-
else setPosition((current) => ({
|
|
257
|
-
...current,
|
|
258
|
-
...patch,
|
|
259
|
-
dataUrl: saved.dataUrl
|
|
260
|
-
}));
|
|
261
|
-
};
|
|
262
|
-
$[30] = save;
|
|
263
|
-
$[31] = saved;
|
|
264
|
-
$[32] = t11;
|
|
265
|
-
} else t11 = $[32];
|
|
266
|
-
const updateCustom = t11;
|
|
267
|
-
let t12;
|
|
268
|
-
if ($[33] !== save) {
|
|
269
|
-
t12 = async function upload(file) {
|
|
270
|
-
const revision = uploadRevision.current = uploadRevision.current + 1;
|
|
271
|
-
setUploading(true);
|
|
272
|
-
setUploadError("");
|
|
273
|
-
const prepared = await prepareWallpaper(file).then(_temp, _temp2);
|
|
274
|
-
if (revision !== uploadRevision.current) return;
|
|
275
|
-
if ("image" in prepared) save("custom", prepared.image);
|
|
276
|
-
else setUploadError(prepared.error instanceof Error ? prepared.error.message : "This image couldn’t be opened.");
|
|
277
|
-
setUploading(false);
|
|
278
|
-
};
|
|
279
|
-
$[33] = save;
|
|
280
|
-
$[34] = t12;
|
|
281
|
-
} else t12 = $[34];
|
|
282
|
-
const upload = t12;
|
|
283
|
-
const t13 = `${helpId}${uploadError ? ` ${errorId}` : ""}`;
|
|
284
|
-
let t14;
|
|
285
|
-
if ($[35] === Symbol.for("react.memo_cache_sentinel")) {
|
|
286
|
-
t14 = () => uploadInput.current?.click();
|
|
287
|
-
$[35] = t14;
|
|
288
|
-
} else t14 = $[35];
|
|
289
|
-
let t15;
|
|
290
|
-
if ($[36] !== t13 || $[37] !== uploadButtonId || $[38] !== uploading) {
|
|
291
|
-
t15 = /* @__PURE__ */ jsx(Button, {
|
|
292
|
-
id: uploadButtonId,
|
|
293
|
-
size: "xs",
|
|
294
|
-
variant: "surface",
|
|
295
|
-
color: "neutral",
|
|
296
|
-
disabled: uploading,
|
|
297
|
-
"aria-describedby": t13,
|
|
298
|
-
onClick: t14,
|
|
299
|
-
children: "Use your own image…"
|
|
300
|
-
});
|
|
301
|
-
$[36] = t13;
|
|
302
|
-
$[37] = uploadButtonId;
|
|
303
|
-
$[38] = uploading;
|
|
304
|
-
$[39] = t15;
|
|
305
|
-
} else t15 = $[39];
|
|
306
|
-
let t16;
|
|
307
|
-
if ($[40] !== uploading) {
|
|
308
|
-
t16 = uploading ? /* @__PURE__ */ jsx("p", {
|
|
309
|
-
role: "status",
|
|
310
|
-
children: "Preparing background…"
|
|
311
|
-
}) : null;
|
|
312
|
-
$[40] = uploading;
|
|
313
|
-
$[41] = t16;
|
|
314
|
-
} else t16 = $[41];
|
|
315
|
-
let t17;
|
|
316
|
-
if ($[42] !== errorId || $[43] !== uploadError) {
|
|
317
|
-
t17 = uploadError ? /* @__PURE__ */ jsx("p", {
|
|
318
|
-
id: errorId,
|
|
319
|
-
role: "alert",
|
|
320
|
-
children: uploadError
|
|
321
|
-
}) : null;
|
|
322
|
-
$[42] = errorId;
|
|
323
|
-
$[43] = uploadError;
|
|
324
|
-
$[44] = t17;
|
|
325
|
-
} else t17 = $[44];
|
|
326
|
-
let t18;
|
|
327
|
-
if ($[45] !== t15 || $[46] !== t16 || $[47] !== t17) {
|
|
328
|
-
t18 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
329
|
-
t15,
|
|
330
|
-
t16,
|
|
331
|
-
t17
|
|
332
|
-
] });
|
|
333
|
-
$[45] = t15;
|
|
334
|
-
$[46] = t16;
|
|
335
|
-
$[47] = t17;
|
|
336
|
-
$[48] = t18;
|
|
337
|
-
} else t18 = $[48];
|
|
338
|
-
const uploadControls = t18;
|
|
339
|
-
const t19 = Boolean(uploadError);
|
|
340
|
-
const t20 = `${helpId}${uploadError ? ` ${errorId}` : ""}`;
|
|
341
|
-
let t21;
|
|
342
|
-
if ($[49] !== upload) {
|
|
343
|
-
t21 = (event) => {
|
|
344
|
-
const file_0 = event.currentTarget.files?.[0];
|
|
345
|
-
event.currentTarget.value = "";
|
|
346
|
-
if (file_0) upload(file_0);
|
|
347
|
-
};
|
|
348
|
-
$[49] = upload;
|
|
349
|
-
$[50] = t21;
|
|
350
|
-
} else t21 = $[50];
|
|
351
|
-
let t22;
|
|
352
|
-
if ($[51] !== t19 || $[52] !== t20 || $[53] !== t21 || $[54] !== uploadButtonId || $[55] !== uploading) {
|
|
353
|
-
t22 = /* @__PURE__ */ jsx("input", {
|
|
354
|
-
ref: uploadInput,
|
|
355
|
-
hidden: true,
|
|
356
|
-
"aria-labelledby": uploadButtonId,
|
|
357
|
-
type: "file",
|
|
358
|
-
accept: "image/png,image/jpeg,image/webp",
|
|
359
|
-
disabled: uploading,
|
|
360
|
-
"aria-invalid": t19,
|
|
361
|
-
"aria-describedby": t20,
|
|
362
|
-
onChange: t21
|
|
363
|
-
});
|
|
364
|
-
$[51] = t19;
|
|
365
|
-
$[52] = t20;
|
|
366
|
-
$[53] = t21;
|
|
367
|
-
$[54] = uploadButtonId;
|
|
368
|
-
$[55] = uploading;
|
|
369
|
-
$[56] = t22;
|
|
370
|
-
} else t22 = $[56];
|
|
371
|
-
let t23;
|
|
372
|
-
if ($[57] !== helpId) {
|
|
373
|
-
t23 = /* @__PURE__ */ jsx("p", {
|
|
374
|
-
id: helpId,
|
|
375
|
-
className: "sigvelo-visually-hidden",
|
|
376
|
-
children: "PNG, JPEG, or WebP, up to 10 MB. Images are dimmed to keep desktop labels readable."
|
|
377
|
-
});
|
|
378
|
-
$[57] = helpId;
|
|
379
|
-
$[58] = t23;
|
|
380
|
-
} else t23 = $[58];
|
|
381
|
-
let t24;
|
|
382
|
-
if ($[59] !== custom || $[60] !== save || $[61] !== updateCustom || $[62] !== uploadButtonId || $[63] !== value) {
|
|
383
|
-
t24 = custom ? /* @__PURE__ */ jsxs("section", {
|
|
384
|
-
className: "computer-wallpapers__custom",
|
|
385
|
-
"aria-label": "Custom background",
|
|
386
|
-
children: [value === "custom" ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(RadioGroup.Root, {
|
|
387
|
-
className: "computer-wallpapers__placement",
|
|
388
|
-
value: custom.fit,
|
|
389
|
-
onValueChange: (fit) => {
|
|
390
|
-
if (fit === "fill" || fit === "fit") updateCustom({ fit });
|
|
391
|
-
},
|
|
392
|
-
"aria-label": "Image placement",
|
|
393
|
-
children: [/* @__PURE__ */ jsxs("label", {
|
|
394
|
-
className: "computer-wallpapers__choice",
|
|
395
|
-
children: [/* @__PURE__ */ jsx(Radio.Root, {
|
|
396
|
-
value: "fill",
|
|
397
|
-
children: /* @__PURE__ */ jsx(Radio.Indicator, {})
|
|
398
|
-
}), "Fill the screen (crop edges)"]
|
|
399
|
-
}), /* @__PURE__ */ jsxs("label", {
|
|
400
|
-
className: "computer-wallpapers__choice",
|
|
401
|
-
children: [/* @__PURE__ */ jsx(Radio.Root, {
|
|
402
|
-
value: "fit",
|
|
403
|
-
children: /* @__PURE__ */ jsx(Radio.Indicator, {})
|
|
404
|
-
}), "Fit the entire image"]
|
|
405
|
-
})]
|
|
406
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
407
|
-
className: "computer-wallpapers__crop",
|
|
408
|
-
children: ["x", "y"].map((axis) => /* @__PURE__ */ jsxs(Slider.Root, {
|
|
409
|
-
value: custom[axis],
|
|
410
|
-
min: 0,
|
|
411
|
-
max: 100,
|
|
412
|
-
step: 1,
|
|
413
|
-
onValueChange: (position_0) => updateCustom({ [axis]: position_0 }, false),
|
|
414
|
-
onValueCommitted: (position_1) => updateCustom({ [axis]: position_1 }),
|
|
415
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
416
|
-
className: "computer-wallpapers__crop-label",
|
|
417
|
-
children: [/* @__PURE__ */ jsx(Slider.Label, { children: axis === "x" ? "Horizontal position" : "Vertical position" }), /* @__PURE__ */ jsxs("span", { children: [custom[axis], "%"] })]
|
|
418
|
-
}), /* @__PURE__ */ jsx(Slider.Control, {
|
|
419
|
-
className: "computer-wallpapers__crop-control",
|
|
420
|
-
children: /* @__PURE__ */ jsxs(Slider.Track, { children: [/* @__PURE__ */ jsx(Slider.Indicator, {}), /* @__PURE__ */ jsx(Slider.Thumb, {})] })
|
|
421
|
-
})]
|
|
422
|
-
}, axis))
|
|
423
|
-
})] }) : null, /* @__PURE__ */ jsxs("div", {
|
|
424
|
-
className: "computer-wallpapers__actions",
|
|
425
|
-
children: [value === "custom" ? /* @__PURE__ */ jsx(Button, {
|
|
426
|
-
variant: "surface",
|
|
427
|
-
color: "neutral",
|
|
428
|
-
onClick: () => updateCustom({
|
|
429
|
-
x: 50,
|
|
430
|
-
y: 50
|
|
431
|
-
}),
|
|
432
|
-
children: "Center image"
|
|
433
|
-
}) : null, /* @__PURE__ */ jsx(Button, {
|
|
434
|
-
variant: "surface",
|
|
435
|
-
color: "neutral",
|
|
436
|
-
onClick: () => {
|
|
437
|
-
uploadRevision.current = uploadRevision.current + 1;
|
|
438
|
-
setUploading(false);
|
|
439
|
-
setUploadError("");
|
|
440
|
-
save(DEFAULT_COMPUTER_WALLPAPER, null);
|
|
441
|
-
requestAnimationFrame(() => uploadInput.current?.ownerDocument.getElementById(uploadButtonId)?.focus());
|
|
442
|
-
},
|
|
443
|
-
children: "Remove custom image"
|
|
444
|
-
})]
|
|
445
|
-
})]
|
|
446
|
-
}) : null;
|
|
447
|
-
$[59] = custom;
|
|
448
|
-
$[60] = save;
|
|
449
|
-
$[61] = updateCustom;
|
|
450
|
-
$[62] = uploadButtonId;
|
|
451
|
-
$[63] = value;
|
|
452
|
-
$[64] = t24;
|
|
453
|
-
} else t24 = $[64];
|
|
454
|
-
let t25;
|
|
455
|
-
if ($[65] !== hint) {
|
|
456
|
-
t25 = /* @__PURE__ */ jsx("p", {
|
|
457
|
-
className: "computer-wallpapers__hint",
|
|
458
|
-
role: "status",
|
|
459
|
-
children: hint
|
|
460
|
-
});
|
|
461
|
-
$[65] = hint;
|
|
462
|
-
$[66] = t25;
|
|
463
|
-
} else t25 = $[66];
|
|
464
|
-
let t26;
|
|
465
|
-
if ($[67] !== t22 || $[68] !== t23 || $[69] !== t24 || $[70] !== t25) {
|
|
466
|
-
t26 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
467
|
-
t22,
|
|
468
|
-
t23,
|
|
469
|
-
t24,
|
|
470
|
-
t25
|
|
471
|
-
] });
|
|
472
|
-
$[67] = t22;
|
|
473
|
-
$[68] = t23;
|
|
474
|
-
$[69] = t24;
|
|
475
|
-
$[70] = t25;
|
|
476
|
-
$[71] = t26;
|
|
477
|
-
} else t26 = $[71];
|
|
478
|
-
const details = t26;
|
|
479
|
-
let t27;
|
|
480
|
-
if ($[72] !== details || $[73] !== uploadControls) {
|
|
481
|
-
t27 = /* @__PURE__ */ jsxs("div", {
|
|
482
|
-
className: "computer-wallpapers__controls",
|
|
483
|
-
children: [uploadControls, details]
|
|
484
|
-
});
|
|
485
|
-
$[72] = details;
|
|
486
|
-
$[73] = uploadControls;
|
|
487
|
-
$[74] = t27;
|
|
488
|
-
} else t27 = $[74];
|
|
489
|
-
let t28;
|
|
490
|
-
if ($[75] !== select || $[76] !== t27 || $[77] !== value || $[78] !== wallpapers) {
|
|
491
|
-
t28 = {
|
|
492
|
-
wallpapers,
|
|
493
|
-
wallpaper: value,
|
|
494
|
-
onWallpaperChange: select,
|
|
495
|
-
display: t27
|
|
496
|
-
};
|
|
497
|
-
$[75] = select;
|
|
498
|
-
$[76] = t27;
|
|
499
|
-
$[77] = value;
|
|
500
|
-
$[78] = wallpapers;
|
|
501
|
-
$[79] = t28;
|
|
502
|
-
} else t28 = $[79];
|
|
503
|
-
let t29;
|
|
504
|
-
if ($[80] !== selected || $[81] !== t28) {
|
|
505
|
-
t29 = {
|
|
506
|
-
selected,
|
|
507
|
-
settings: t28
|
|
508
|
-
};
|
|
509
|
-
$[80] = selected;
|
|
510
|
-
$[81] = t28;
|
|
511
|
-
$[82] = t29;
|
|
512
|
-
} else t29 = $[82];
|
|
513
|
-
return t29;
|
|
514
|
-
}
|
|
515
|
-
function _temp2(error) {
|
|
516
|
-
return { error };
|
|
517
|
-
}
|
|
518
|
-
function _temp(image_1) {
|
|
519
|
-
return { image: image_1 };
|
|
520
|
-
}
|
|
521
|
-
//#endregion
|
|
522
|
-
export { readWallpaper, useComputerWallpaper };
|
|
1
|
+
import { t as readWallpaper } from "../../ComputerCustomWallpaper-CnGQYHp0.js";
|
|
2
|
+
export { readWallpaper };
|