@tutti-os/workbench-surface 0.0.11 → 0.0.13
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/index.js +366 -12
- package/dist/index.js.map +1 -1
- package/dist/styles/workbench.css +25 -3
- package/dist/styles/workbenchStyle.test.ts +21 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -2643,6 +2643,14 @@ function resolveWorkbenchCaptureElement(windowElement) {
|
|
|
2643
2643
|
'[data-workbench-window-capture="true"]'
|
|
2644
2644
|
) ?? windowElement.querySelector(".workbench-window") ?? windowElement;
|
|
2645
2645
|
}
|
|
2646
|
+
function waitForNextAnimationFrame() {
|
|
2647
|
+
return new Promise((resolve) => {
|
|
2648
|
+
window.requestAnimationFrame(() => resolve());
|
|
2649
|
+
});
|
|
2650
|
+
}
|
|
2651
|
+
function isFocusedWorkbenchNode(controller, nodeID) {
|
|
2652
|
+
return controller.getSnapshot().nodeStack.at(-1) === nodeID;
|
|
2653
|
+
}
|
|
2646
2654
|
function shouldReduceMotion() {
|
|
2647
2655
|
return window.matchMedia?.("(prefers-reduced-motion: reduce)").matches === true;
|
|
2648
2656
|
}
|
|
@@ -3113,9 +3121,7 @@ function useWorkbenchGenieAnimation({
|
|
|
3113
3121
|
showNodeForGenie(nodeID);
|
|
3114
3122
|
return;
|
|
3115
3123
|
}
|
|
3116
|
-
await
|
|
3117
|
-
window.requestAnimationFrame(() => resolve());
|
|
3118
|
-
});
|
|
3124
|
+
await waitForNextAnimationFrame();
|
|
3119
3125
|
if (generation !== animationGenerationRef.current) {
|
|
3120
3126
|
return;
|
|
3121
3127
|
}
|
|
@@ -3218,6 +3224,16 @@ function useWorkbenchGenieAnimation({
|
|
|
3218
3224
|
}
|
|
3219
3225
|
const runMinimize = minimize ?? (() => controller.commands.minimizeNode(nodeID));
|
|
3220
3226
|
if (shouldReduceMotion()) {
|
|
3227
|
+
const wasFocusedForCapture2 = isFocusedWorkbenchNode(
|
|
3228
|
+
controller,
|
|
3229
|
+
nodeID
|
|
3230
|
+
);
|
|
3231
|
+
if (!wasFocusedForCapture2) {
|
|
3232
|
+
flushSync(() => {
|
|
3233
|
+
controller.commands.focusNode(nodeID);
|
|
3234
|
+
});
|
|
3235
|
+
await waitForNextAnimationFrame();
|
|
3236
|
+
}
|
|
3221
3237
|
await captureWorkbenchNodePreviewImageForNode(target, {
|
|
3222
3238
|
captureNodePreviewImage,
|
|
3223
3239
|
dockPreviewCache,
|
|
@@ -3239,6 +3255,16 @@ function useWorkbenchGenieAnimation({
|
|
|
3239
3255
|
runMinimize();
|
|
3240
3256
|
return;
|
|
3241
3257
|
}
|
|
3258
|
+
const wasFocusedForCapture = isFocusedWorkbenchNode(controller, nodeID);
|
|
3259
|
+
if (!wasFocusedForCapture) {
|
|
3260
|
+
flushSync(() => {
|
|
3261
|
+
controller.commands.focusNode(nodeID);
|
|
3262
|
+
});
|
|
3263
|
+
await waitForNextAnimationFrame();
|
|
3264
|
+
if (generation !== animationGenerationRef.current) {
|
|
3265
|
+
return;
|
|
3266
|
+
}
|
|
3267
|
+
}
|
|
3242
3268
|
const previewImageUrlPromise = Promise.resolve(
|
|
3243
3269
|
captureNodePreviewImage?.(target) ?? null
|
|
3244
3270
|
).catch(() => null);
|
|
@@ -3288,9 +3314,7 @@ function useWorkbenchGenieAnimation({
|
|
|
3288
3314
|
hideNodeForGenie(nodeID);
|
|
3289
3315
|
runMinimize();
|
|
3290
3316
|
});
|
|
3291
|
-
await
|
|
3292
|
-
window.requestAnimationFrame(() => resolve());
|
|
3293
|
-
});
|
|
3317
|
+
await waitForNextAnimationFrame();
|
|
3294
3318
|
if (generation !== animationGenerationRef.current) {
|
|
3295
3319
|
releaseMinimizedDockEnterAnimation(nodeID);
|
|
3296
3320
|
return;
|
|
@@ -5332,7 +5356,7 @@ function useWorkbenchHostRuntime({
|
|
|
5332
5356
|
snapshotRepository,
|
|
5333
5357
|
workspaceId
|
|
5334
5358
|
}) {
|
|
5335
|
-
const [, bumpExternalStateRevision] = useState5(0);
|
|
5359
|
+
const [externalStateRevision, bumpExternalStateRevision] = useState5(0);
|
|
5336
5360
|
const [, bumpHydrationRevision] = useState5(0);
|
|
5337
5361
|
const hostSession = useMemo4(() => {
|
|
5338
5362
|
logWorkbenchHostDebug("create-session", debugDiagnostics, {
|
|
@@ -5436,6 +5460,7 @@ function useWorkbenchHostRuntime({
|
|
|
5436
5460
|
}, [externalStateSource, workspaceId]);
|
|
5437
5461
|
return {
|
|
5438
5462
|
chromeContext,
|
|
5463
|
+
externalStateRevision,
|
|
5439
5464
|
hostI18n,
|
|
5440
5465
|
isHydrating,
|
|
5441
5466
|
hostSession,
|
|
@@ -7281,6 +7306,7 @@ function WorkbenchHostDock({
|
|
|
7281
7306
|
);
|
|
7282
7307
|
const pendingDockStateRefreshRef = useRef8(false);
|
|
7283
7308
|
const slotRefs = useRef8(/* @__PURE__ */ new Map());
|
|
7309
|
+
const wallpaperToneElementRefs = useRef8(/* @__PURE__ */ new Map());
|
|
7284
7310
|
const dockSlotRefCallbacksRef = useRef8(
|
|
7285
7311
|
/* @__PURE__ */ new Map()
|
|
7286
7312
|
);
|
|
@@ -7461,6 +7487,15 @@ function WorkbenchHostDock({
|
|
|
7461
7487
|
dockItems,
|
|
7462
7488
|
(nodeId) => context.genie.shouldAnimateMinimizedDockEnter(nodeId)
|
|
7463
7489
|
);
|
|
7490
|
+
const presentDockItemKeys = useMemo5(
|
|
7491
|
+
() => presentDockItems.map((item) => item.key).join("\n"),
|
|
7492
|
+
[presentDockItems]
|
|
7493
|
+
);
|
|
7494
|
+
const wallpaperTones = useDockWallpaperTones({
|
|
7495
|
+
dockItemsRef,
|
|
7496
|
+
elementRefs: wallpaperToneElementRefs,
|
|
7497
|
+
itemKeys: presentDockItemKeys
|
|
7498
|
+
});
|
|
7464
7499
|
const dockWidth = useMemo5(
|
|
7465
7500
|
() => resolveWorkbenchHostDockItemsWidth(dockItems),
|
|
7466
7501
|
[dockItems]
|
|
@@ -7490,6 +7525,16 @@ function WorkbenchHostDock({
|
|
|
7490
7525
|
registerDockAnchorRef.current = (anchorKey, element) => {
|
|
7491
7526
|
context.genie.registerDockAnchor(anchorKey, element);
|
|
7492
7527
|
};
|
|
7528
|
+
const registerWallpaperToneElement = useCallback10(
|
|
7529
|
+
(key) => (element) => {
|
|
7530
|
+
if (element) {
|
|
7531
|
+
wallpaperToneElementRefs.current.set(key, element);
|
|
7532
|
+
return;
|
|
7533
|
+
}
|
|
7534
|
+
wallpaperToneElementRefs.current.delete(key);
|
|
7535
|
+
},
|
|
7536
|
+
[]
|
|
7537
|
+
);
|
|
7493
7538
|
const setDockHoverPanelOpen = useCallback10((open) => {
|
|
7494
7539
|
if (open) {
|
|
7495
7540
|
dockMeasureRef.current?.setAttribute(
|
|
@@ -7947,8 +7992,10 @@ function WorkbenchHostDock({
|
|
|
7947
7992
|
const callback = (element) => {
|
|
7948
7993
|
if (element) {
|
|
7949
7994
|
slotRefs.current.set(anchorKey, element);
|
|
7995
|
+
wallpaperToneElementRefs.current.set(anchorKey, element);
|
|
7950
7996
|
} else {
|
|
7951
7997
|
slotRefs.current.delete(anchorKey);
|
|
7998
|
+
wallpaperToneElementRefs.current.delete(anchorKey);
|
|
7952
7999
|
if (!dockMeasureRef.current?.hasAttribute("data-dock-pointer-active")) {
|
|
7953
8000
|
clearSlotMagnificationRef.current(anchorKey);
|
|
7954
8001
|
}
|
|
@@ -8028,9 +8075,11 @@ function WorkbenchHostDock({
|
|
|
8028
8075
|
return /* @__PURE__ */ jsx10(
|
|
8029
8076
|
"span",
|
|
8030
8077
|
{
|
|
8078
|
+
ref: registerWallpaperToneElement(dockItem.key),
|
|
8031
8079
|
className: "desktop-dock__separator",
|
|
8032
8080
|
"aria-hidden": "true",
|
|
8033
|
-
"data-presence": dockItem.presence
|
|
8081
|
+
"data-presence": dockItem.presence,
|
|
8082
|
+
"data-wallpaper-tone": wallpaperTones.get(dockItem.key)
|
|
8034
8083
|
},
|
|
8035
8084
|
dockItem.key
|
|
8036
8085
|
);
|
|
@@ -8187,6 +8236,7 @@ function WorkbenchHostDock({
|
|
|
8187
8236
|
"data-popup-active": currentPopup ? "true" : void 0,
|
|
8188
8237
|
"data-presence": dockItem.presence,
|
|
8189
8238
|
"data-section-id": entry.sectionId,
|
|
8239
|
+
"data-wallpaper-tone": wallpaperTones.get(anchorKey),
|
|
8190
8240
|
onBlur: (event) => {
|
|
8191
8241
|
if (hasHoverPanel && !event.currentTarget.contains(event.relatedTarget)) {
|
|
8192
8242
|
closeHoverPanelImmediate(entry.id);
|
|
@@ -9106,6 +9156,257 @@ function useDockPresenceItems(items, shouldAnimateMinimizedDockEnter) {
|
|
|
9106
9156
|
return latestItem ? { ...presentItem, item: latestItem } : presentItem;
|
|
9107
9157
|
});
|
|
9108
9158
|
}
|
|
9159
|
+
function useDockWallpaperTones({
|
|
9160
|
+
dockItemsRef,
|
|
9161
|
+
elementRefs,
|
|
9162
|
+
itemKeys
|
|
9163
|
+
}) {
|
|
9164
|
+
const [tones, setTones] = useState8(
|
|
9165
|
+
() => /* @__PURE__ */ new Map()
|
|
9166
|
+
);
|
|
9167
|
+
useLayoutEffect5(() => {
|
|
9168
|
+
if (typeof window === "undefined") {
|
|
9169
|
+
return void 0;
|
|
9170
|
+
}
|
|
9171
|
+
let canceled = false;
|
|
9172
|
+
let frameId = null;
|
|
9173
|
+
const updateTones = () => {
|
|
9174
|
+
frameId = null;
|
|
9175
|
+
void resolveDockWallpaperTones({
|
|
9176
|
+
dockItemsElement: dockItemsRef.current,
|
|
9177
|
+
elements: elementRefs.current
|
|
9178
|
+
}).then((nextTones) => {
|
|
9179
|
+
if (canceled) {
|
|
9180
|
+
return;
|
|
9181
|
+
}
|
|
9182
|
+
setTones(
|
|
9183
|
+
(current) => dockWallpaperToneMapsEqual(current, nextTones) ? current : nextTones
|
|
9184
|
+
);
|
|
9185
|
+
});
|
|
9186
|
+
};
|
|
9187
|
+
const scheduleUpdate = () => {
|
|
9188
|
+
if (frameId !== null) {
|
|
9189
|
+
return;
|
|
9190
|
+
}
|
|
9191
|
+
frameId = window.requestAnimationFrame(updateTones);
|
|
9192
|
+
};
|
|
9193
|
+
scheduleUpdate();
|
|
9194
|
+
window.addEventListener("resize", scheduleUpdate);
|
|
9195
|
+
const resizeObserver = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(scheduleUpdate);
|
|
9196
|
+
if (dockItemsRef.current) {
|
|
9197
|
+
resizeObserver?.observe(dockItemsRef.current);
|
|
9198
|
+
}
|
|
9199
|
+
const wallpaperElement = dockItemsRef.current?.closest(".workbench-surface")?.querySelector(".workbench-surface__wallpaper");
|
|
9200
|
+
if (wallpaperElement instanceof HTMLElement) {
|
|
9201
|
+
resizeObserver?.observe(wallpaperElement);
|
|
9202
|
+
}
|
|
9203
|
+
return () => {
|
|
9204
|
+
canceled = true;
|
|
9205
|
+
if (frameId !== null) {
|
|
9206
|
+
window.cancelAnimationFrame(frameId);
|
|
9207
|
+
}
|
|
9208
|
+
resizeObserver?.disconnect();
|
|
9209
|
+
window.removeEventListener("resize", scheduleUpdate);
|
|
9210
|
+
};
|
|
9211
|
+
}, [dockItemsRef, elementRefs, itemKeys]);
|
|
9212
|
+
return tones;
|
|
9213
|
+
}
|
|
9214
|
+
async function resolveDockWallpaperTones({
|
|
9215
|
+
dockItemsElement,
|
|
9216
|
+
elements
|
|
9217
|
+
}) {
|
|
9218
|
+
const wallpaperElement = dockItemsElement?.closest(".workbench-surface")?.querySelector(".workbench-surface__wallpaper");
|
|
9219
|
+
if (!(wallpaperElement instanceof HTMLElement)) {
|
|
9220
|
+
return /* @__PURE__ */ new Map();
|
|
9221
|
+
}
|
|
9222
|
+
const wallpaperStyle = window.getComputedStyle(wallpaperElement);
|
|
9223
|
+
const wallpaperUrl = parseDockWallpaperCssUrl(wallpaperStyle.backgroundImage);
|
|
9224
|
+
if (!wallpaperUrl) {
|
|
9225
|
+
return /* @__PURE__ */ new Map();
|
|
9226
|
+
}
|
|
9227
|
+
const wallpaperImage = await loadDockWallpaperImage(wallpaperUrl);
|
|
9228
|
+
if (!wallpaperImage) {
|
|
9229
|
+
return /* @__PURE__ */ new Map();
|
|
9230
|
+
}
|
|
9231
|
+
const sampleCanvas = createDockWallpaperSampleCanvas(wallpaperImage);
|
|
9232
|
+
if (!sampleCanvas) {
|
|
9233
|
+
return /* @__PURE__ */ new Map();
|
|
9234
|
+
}
|
|
9235
|
+
const wallpaperRect = wallpaperElement.getBoundingClientRect();
|
|
9236
|
+
const renderedImageRect = resolveDockWallpaperRenderedImageRect({
|
|
9237
|
+
containerHeight: wallpaperRect.height,
|
|
9238
|
+
containerWidth: wallpaperRect.width,
|
|
9239
|
+
imageHeight: wallpaperImage.naturalHeight,
|
|
9240
|
+
imageWidth: wallpaperImage.naturalWidth,
|
|
9241
|
+
positionX: wallpaperStyle.backgroundPositionX,
|
|
9242
|
+
positionY: wallpaperStyle.backgroundPositionY,
|
|
9243
|
+
size: wallpaperStyle.backgroundSize
|
|
9244
|
+
});
|
|
9245
|
+
const nextTones = /* @__PURE__ */ new Map();
|
|
9246
|
+
for (const [key, element] of elements) {
|
|
9247
|
+
const luminance = sampleDockWallpaperLuminanceAtElement({
|
|
9248
|
+
elementRect: element.getBoundingClientRect(),
|
|
9249
|
+
renderedImageRect,
|
|
9250
|
+
sampleCanvas,
|
|
9251
|
+
wallpaperRect
|
|
9252
|
+
});
|
|
9253
|
+
if (luminance === null) {
|
|
9254
|
+
continue;
|
|
9255
|
+
}
|
|
9256
|
+
nextTones.set(
|
|
9257
|
+
key,
|
|
9258
|
+
luminance < dockWallpaperDarkLuminanceThreshold ? "dark" : "light"
|
|
9259
|
+
);
|
|
9260
|
+
}
|
|
9261
|
+
return nextTones;
|
|
9262
|
+
}
|
|
9263
|
+
function parseDockWallpaperCssUrl(backgroundImage) {
|
|
9264
|
+
const match = /^url\((['"]?)(.*)\1\)$/u.exec(backgroundImage.trim());
|
|
9265
|
+
return match?.[2] ? match[2] : null;
|
|
9266
|
+
}
|
|
9267
|
+
var dockWallpaperImageCache = /* @__PURE__ */ new Map();
|
|
9268
|
+
function loadDockWallpaperImage(url) {
|
|
9269
|
+
const cached = dockWallpaperImageCache.get(url);
|
|
9270
|
+
if (cached) {
|
|
9271
|
+
return cached;
|
|
9272
|
+
}
|
|
9273
|
+
const promise = new Promise((resolve) => {
|
|
9274
|
+
const image = new Image();
|
|
9275
|
+
image.decoding = "async";
|
|
9276
|
+
image.onload = () => resolve(image);
|
|
9277
|
+
image.onerror = () => resolve(null);
|
|
9278
|
+
image.src = url;
|
|
9279
|
+
});
|
|
9280
|
+
dockWallpaperImageCache.set(url, promise);
|
|
9281
|
+
return promise;
|
|
9282
|
+
}
|
|
9283
|
+
function createDockWallpaperSampleCanvas(image) {
|
|
9284
|
+
if (image.naturalWidth <= 0 || image.naturalHeight <= 0) {
|
|
9285
|
+
return null;
|
|
9286
|
+
}
|
|
9287
|
+
const canvas = document.createElement("canvas");
|
|
9288
|
+
const scale = dockWallpaperSampleCanvasMaxSizePx / Math.max(image.naturalWidth, image.naturalHeight);
|
|
9289
|
+
canvas.width = Math.max(1, Math.round(image.naturalWidth * scale));
|
|
9290
|
+
canvas.height = Math.max(1, Math.round(image.naturalHeight * scale));
|
|
9291
|
+
const context = canvas.getContext("2d", { willReadFrequently: true });
|
|
9292
|
+
if (!context) {
|
|
9293
|
+
return null;
|
|
9294
|
+
}
|
|
9295
|
+
try {
|
|
9296
|
+
context.drawImage(image, 0, 0, canvas.width, canvas.height);
|
|
9297
|
+
context.getImageData(0, 0, 1, 1);
|
|
9298
|
+
} catch {
|
|
9299
|
+
return null;
|
|
9300
|
+
}
|
|
9301
|
+
return canvas;
|
|
9302
|
+
}
|
|
9303
|
+
function resolveDockWallpaperRenderedImageRect({
|
|
9304
|
+
containerHeight,
|
|
9305
|
+
containerWidth,
|
|
9306
|
+
imageHeight,
|
|
9307
|
+
imageWidth,
|
|
9308
|
+
positionX,
|
|
9309
|
+
positionY,
|
|
9310
|
+
size
|
|
9311
|
+
}) {
|
|
9312
|
+
const imageAspect = imageWidth / imageHeight;
|
|
9313
|
+
const containerAspect = containerWidth / containerHeight;
|
|
9314
|
+
let width = containerWidth;
|
|
9315
|
+
let height = containerHeight;
|
|
9316
|
+
if (size === "cover") {
|
|
9317
|
+
if (containerAspect > imageAspect) {
|
|
9318
|
+
height = containerWidth / imageAspect;
|
|
9319
|
+
} else {
|
|
9320
|
+
width = containerHeight * imageAspect;
|
|
9321
|
+
}
|
|
9322
|
+
} else if (size === "contain") {
|
|
9323
|
+
if (containerAspect > imageAspect) {
|
|
9324
|
+
width = containerHeight * imageAspect;
|
|
9325
|
+
} else {
|
|
9326
|
+
height = containerWidth / imageAspect;
|
|
9327
|
+
}
|
|
9328
|
+
} else if (size !== "100% 100%") {
|
|
9329
|
+
width = imageWidth;
|
|
9330
|
+
height = imageHeight;
|
|
9331
|
+
}
|
|
9332
|
+
return {
|
|
9333
|
+
height,
|
|
9334
|
+
left: resolveDockWallpaperPositionOffset(positionX, containerWidth - width),
|
|
9335
|
+
top: resolveDockWallpaperPositionOffset(
|
|
9336
|
+
positionY,
|
|
9337
|
+
containerHeight - height
|
|
9338
|
+
),
|
|
9339
|
+
width
|
|
9340
|
+
};
|
|
9341
|
+
}
|
|
9342
|
+
function resolveDockWallpaperPositionOffset(value, availableSpace) {
|
|
9343
|
+
const trimmed = value.trim();
|
|
9344
|
+
if (trimmed.endsWith("%")) {
|
|
9345
|
+
const percentage = Number.parseFloat(trimmed);
|
|
9346
|
+
return Number.isFinite(percentage) ? availableSpace * percentage / 100 : availableSpace / 2;
|
|
9347
|
+
}
|
|
9348
|
+
if (trimmed.endsWith("px")) {
|
|
9349
|
+
const px = Number.parseFloat(trimmed);
|
|
9350
|
+
return Number.isFinite(px) ? px : availableSpace / 2;
|
|
9351
|
+
}
|
|
9352
|
+
if (trimmed === "left" || trimmed === "top") {
|
|
9353
|
+
return 0;
|
|
9354
|
+
}
|
|
9355
|
+
if (trimmed === "right" || trimmed === "bottom") {
|
|
9356
|
+
return availableSpace;
|
|
9357
|
+
}
|
|
9358
|
+
return availableSpace / 2;
|
|
9359
|
+
}
|
|
9360
|
+
function sampleDockWallpaperLuminanceAtElement({
|
|
9361
|
+
elementRect,
|
|
9362
|
+
renderedImageRect,
|
|
9363
|
+
sampleCanvas,
|
|
9364
|
+
wallpaperRect
|
|
9365
|
+
}) {
|
|
9366
|
+
const context = sampleCanvas.getContext("2d", { willReadFrequently: true });
|
|
9367
|
+
if (!context) {
|
|
9368
|
+
return null;
|
|
9369
|
+
}
|
|
9370
|
+
const isVerticalElement = elementRect.height >= elementRect.width;
|
|
9371
|
+
let luminanceSum = 0;
|
|
9372
|
+
let samples = 0;
|
|
9373
|
+
for (let index = 0; index < dockWallpaperToneSampleCount; index += 1) {
|
|
9374
|
+
const ratio = index / (dockWallpaperToneSampleCount - 1);
|
|
9375
|
+
const clientX = isVerticalElement ? elementRect.left + elementRect.width / 2 : elementRect.left + elementRect.width * ratio;
|
|
9376
|
+
const clientY = isVerticalElement ? elementRect.top + elementRect.height * ratio : elementRect.top + elementRect.height / 2;
|
|
9377
|
+
const imageX = (clientX - wallpaperRect.left - renderedImageRect.left) / renderedImageRect.width;
|
|
9378
|
+
const imageY = (clientY - wallpaperRect.top - renderedImageRect.top) / renderedImageRect.height;
|
|
9379
|
+
if (imageX < 0 || imageX > 1 || imageY < 0 || imageY > 1) {
|
|
9380
|
+
continue;
|
|
9381
|
+
}
|
|
9382
|
+
const canvasX = Math.min(
|
|
9383
|
+
sampleCanvas.width - 1,
|
|
9384
|
+
Math.max(0, Math.round(imageX * (sampleCanvas.width - 1)))
|
|
9385
|
+
);
|
|
9386
|
+
const canvasY = Math.min(
|
|
9387
|
+
sampleCanvas.height - 1,
|
|
9388
|
+
Math.max(0, Math.round(imageY * (sampleCanvas.height - 1)))
|
|
9389
|
+
);
|
|
9390
|
+
const pixel = context.getImageData(canvasX, canvasY, 1, 1).data;
|
|
9391
|
+
const red = pixel[0] ?? 0;
|
|
9392
|
+
const green = pixel[1] ?? 0;
|
|
9393
|
+
const blue = pixel[2] ?? 0;
|
|
9394
|
+
luminanceSum += 0.2126 * red + 0.7152 * green + 0.0722 * blue;
|
|
9395
|
+
samples += 1;
|
|
9396
|
+
}
|
|
9397
|
+
return samples > 0 ? luminanceSum / samples : null;
|
|
9398
|
+
}
|
|
9399
|
+
function dockWallpaperToneMapsEqual(left, right) {
|
|
9400
|
+
if (left.size !== right.size) {
|
|
9401
|
+
return false;
|
|
9402
|
+
}
|
|
9403
|
+
for (const [key, value] of left) {
|
|
9404
|
+
if (right.get(key) !== value) {
|
|
9405
|
+
return false;
|
|
9406
|
+
}
|
|
9407
|
+
}
|
|
9408
|
+
return true;
|
|
9409
|
+
}
|
|
9109
9410
|
var DOCK_BOUNCE_MS = 600;
|
|
9110
9411
|
function useDockBounce(slotRefs) {
|
|
9111
9412
|
const timeoutsRef = useRef8(/* @__PURE__ */ new Map());
|
|
@@ -9171,6 +9472,9 @@ var dockHoverPanelHitSlopPx = 12;
|
|
|
9171
9472
|
var dockHoverPanelBridgeSlopPx = 6;
|
|
9172
9473
|
var dockHoverPanelPointerRestTolerancePx = 4;
|
|
9173
9474
|
var DOCK_MAGNIFIED_TOOLTIP_SIDE_OFFSET = 40;
|
|
9475
|
+
var dockWallpaperSampleCanvasMaxSizePx = 192;
|
|
9476
|
+
var dockWallpaperToneSampleCount = 7;
|
|
9477
|
+
var dockWallpaperDarkLuminanceThreshold = 132;
|
|
9174
9478
|
function rectContainsPoint(rect, clientX, clientY, slopPx = 0) {
|
|
9175
9479
|
return clientX >= rect.left - slopPx && clientX <= rect.right + slopPx && clientY >= rect.top - slopPx && clientY <= rect.bottom + slopPx;
|
|
9176
9480
|
}
|
|
@@ -9346,7 +9650,7 @@ function WorkbenchHostWindowActions({
|
|
|
9346
9650
|
}
|
|
9347
9651
|
|
|
9348
9652
|
// src/host/useWorkbenchHostSurfaceRenderers.tsx
|
|
9349
|
-
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
9653
|
+
import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
9350
9654
|
function useWorkbenchHostSurfaceRenderers(input) {
|
|
9351
9655
|
const renderBottomChrome = useMemo6(() => {
|
|
9352
9656
|
const renderChrome = input.renderBottomChrome;
|
|
@@ -9506,7 +9810,7 @@ function useWorkbenchHostSurfaceRenderers(input) {
|
|
|
9506
9810
|
{
|
|
9507
9811
|
debugDiagnostics: input.debugDiagnostics,
|
|
9508
9812
|
node: context.node,
|
|
9509
|
-
resetKey: `${context.node.id}:${context.node.data.typeId}`,
|
|
9813
|
+
resetKey: `${context.node.id}:${context.node.data.typeId}:${input.externalStateRevision}`,
|
|
9510
9814
|
workspaceId: input.workspaceId,
|
|
9511
9815
|
children: /* @__PURE__ */ jsx12(
|
|
9512
9816
|
WorkbenchHostNodeBodyRenderer,
|
|
@@ -9521,6 +9825,7 @@ function useWorkbenchHostSurfaceRenderers(input) {
|
|
|
9521
9825
|
[
|
|
9522
9826
|
input.debugDiagnostics,
|
|
9523
9827
|
input.externalStateSource,
|
|
9828
|
+
input.externalStateRevision,
|
|
9524
9829
|
input.hostSession,
|
|
9525
9830
|
input.nodeDefinitionByType,
|
|
9526
9831
|
input.workspaceId
|
|
@@ -9558,6 +9863,7 @@ function useWorkbenchHostSurfaceRenderers(input) {
|
|
|
9558
9863
|
},
|
|
9559
9864
|
[
|
|
9560
9865
|
input.externalStateSource,
|
|
9866
|
+
input.externalStateRevision,
|
|
9561
9867
|
input.hostSession,
|
|
9562
9868
|
input.nodeDefinitionByType,
|
|
9563
9869
|
input.workspaceId
|
|
@@ -9715,11 +10021,57 @@ var WorkbenchHostNodeRenderErrorBoundary = class extends Component {
|
|
|
9715
10021
|
}
|
|
9716
10022
|
render() {
|
|
9717
10023
|
if (this.state.hasError) {
|
|
9718
|
-
return /* @__PURE__ */
|
|
10024
|
+
return /* @__PURE__ */ jsxs8(
|
|
9719
10025
|
"div",
|
|
9720
10026
|
{
|
|
9721
10027
|
"data-workbench-node-render-error": "true",
|
|
9722
|
-
style: {
|
|
10028
|
+
style: {
|
|
10029
|
+
alignItems: "center",
|
|
10030
|
+
boxSizing: "border-box",
|
|
10031
|
+
color: "var(--text-secondary, #6b7280)",
|
|
10032
|
+
display: "flex",
|
|
10033
|
+
flexDirection: "column",
|
|
10034
|
+
gap: 8,
|
|
10035
|
+
height: "100%",
|
|
10036
|
+
justifyContent: "center",
|
|
10037
|
+
padding: 24,
|
|
10038
|
+
textAlign: "center",
|
|
10039
|
+
width: "100%"
|
|
10040
|
+
},
|
|
10041
|
+
children: [
|
|
10042
|
+
/* @__PURE__ */ jsx12(
|
|
10043
|
+
"div",
|
|
10044
|
+
{
|
|
10045
|
+
"data-workbench-node-render-error-message": "true",
|
|
10046
|
+
style: {
|
|
10047
|
+
color: "var(--text-primary, #111827)",
|
|
10048
|
+
fontSize: 14,
|
|
10049
|
+
fontWeight: 600
|
|
10050
|
+
},
|
|
10051
|
+
children: "This workspace view failed to render."
|
|
10052
|
+
}
|
|
10053
|
+
),
|
|
10054
|
+
/* @__PURE__ */ jsx12("div", { style: { fontSize: 12 }, children: "Try selecting another conversation or reopen the window." }),
|
|
10055
|
+
/* @__PURE__ */ jsx12(
|
|
10056
|
+
"button",
|
|
10057
|
+
{
|
|
10058
|
+
type: "button",
|
|
10059
|
+
onClick: () => this.setState({ hasError: false }),
|
|
10060
|
+
style: {
|
|
10061
|
+
border: "1px solid var(--line-2, #d1d5db)",
|
|
10062
|
+
borderRadius: 6,
|
|
10063
|
+
background: "var(--background-fronted, #ffffff)",
|
|
10064
|
+
color: "var(--text-primary, #111827)",
|
|
10065
|
+
cursor: "pointer",
|
|
10066
|
+
fontSize: 12,
|
|
10067
|
+
fontWeight: 600,
|
|
10068
|
+
marginTop: 4,
|
|
10069
|
+
padding: "6px 10px"
|
|
10070
|
+
},
|
|
10071
|
+
children: "Try again"
|
|
10072
|
+
}
|
|
10073
|
+
)
|
|
10074
|
+
]
|
|
9723
10075
|
}
|
|
9724
10076
|
);
|
|
9725
10077
|
}
|
|
@@ -9799,6 +10151,7 @@ function WorkbenchHost({
|
|
|
9799
10151
|
const missionControlEnabled = missionControlMode !== null || onMissionControlAdapterReady !== void 0;
|
|
9800
10152
|
const {
|
|
9801
10153
|
chromeContext,
|
|
10154
|
+
externalStateRevision,
|
|
9802
10155
|
hostI18n,
|
|
9803
10156
|
hostSession,
|
|
9804
10157
|
isHydrating,
|
|
@@ -9829,6 +10182,7 @@ function WorkbenchHost({
|
|
|
9829
10182
|
dockStateSource,
|
|
9830
10183
|
dockEntries: hostDockEntries,
|
|
9831
10184
|
externalStateSource: hostRuntimeConfig.externalStateSource,
|
|
10185
|
+
externalStateRevision,
|
|
9832
10186
|
hostI18n,
|
|
9833
10187
|
hostSession,
|
|
9834
10188
|
nodeDefinitionByType,
|