@asymmetric-effort/specifyjs 0.2.140 → 0.2.143
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/esm/components-barrel.js +822 -60
- package/dist/specifyjs-components.cjs.js +3 -3
- package/dist/specifyjs-components.esm.js +822 -60
- package/dist/types/components/layout/app-drag-drop/src/DragDrop.d.ts +60 -0
- package/dist/types/components/layout/app-drag-drop/src/index.d.ts +2 -0
- package/dist/types/components/layout/app-message-bus/src/MessageBus.d.ts +43 -0
- package/dist/types/components/layout/app-message-bus/src/index.d.ts +2 -0
- package/dist/types/components/layout/window-manager/src/WindowManager.d.ts +32 -0
- package/dist/types/components/layout/window-manager/src/index.d.ts +1 -1
- package/dist/types/components/nav/dock/src/Dock.d.ts +4 -0
- package/dist/types/components/nav/system-tray/src/SystemTray.d.ts +23 -0
- package/dist/types/components/nav/system-tray/src/index.d.ts +1 -1
- package/dist/types/components/page/unity-desktop/src/UnityApp.d.ts +7 -0
- package/dist/types/components/page/unity-desktop/src/index.d.ts +4 -0
- package/package.json +2 -2
|
@@ -11896,7 +11896,15 @@ var WindowManagerContext = createContext({
|
|
|
11896
11896
|
},
|
|
11897
11897
|
minimizeAll: () => {
|
|
11898
11898
|
},
|
|
11899
|
-
focusedWindowId: null
|
|
11899
|
+
focusedWindowId: null,
|
|
11900
|
+
setMenuBar: () => {
|
|
11901
|
+
},
|
|
11902
|
+
clearMenuBar: () => {
|
|
11903
|
+
},
|
|
11904
|
+
activeMenuBar: null,
|
|
11905
|
+
signalDock: () => {
|
|
11906
|
+
},
|
|
11907
|
+
dockSignals: /* @__PURE__ */ new Map()
|
|
11900
11908
|
});
|
|
11901
11909
|
var DEFAULT_WINDOW_SIZE = { width: 600, height: 400 };
|
|
11902
11910
|
var DEFAULT_CASCADE_OFFSET = { x: 30, y: 30 };
|
|
@@ -12001,6 +12009,22 @@ function WindowManagerProvider(props) {
|
|
|
12001
12009
|
const closeWindow = useCallback(
|
|
12002
12010
|
((...args) => {
|
|
12003
12011
|
const id = args[0];
|
|
12012
|
+
setMenuBars((prev) => {
|
|
12013
|
+
if (prev[id]) {
|
|
12014
|
+
const next = { ...prev };
|
|
12015
|
+
delete next[id];
|
|
12016
|
+
return next;
|
|
12017
|
+
}
|
|
12018
|
+
return prev;
|
|
12019
|
+
});
|
|
12020
|
+
setDockSignals((prev) => {
|
|
12021
|
+
if (prev.has(id)) {
|
|
12022
|
+
const next = new Map(prev);
|
|
12023
|
+
next.delete(id);
|
|
12024
|
+
return next;
|
|
12025
|
+
}
|
|
12026
|
+
return prev;
|
|
12027
|
+
});
|
|
12004
12028
|
setWindows((prev) => {
|
|
12005
12029
|
const closing = prev.find((w) => w.id === id);
|
|
12006
12030
|
if (!closing) return prev;
|
|
@@ -12255,6 +12279,46 @@ function WindowManagerProvider(props) {
|
|
|
12255
12279
|
const focused = windows.find((w) => w.focused);
|
|
12256
12280
|
return focused ? focused.id : null;
|
|
12257
12281
|
}, [windows]);
|
|
12282
|
+
const [menuBars, setMenuBars] = useState({});
|
|
12283
|
+
const [dockSignals, setDockSignals] = useState(/* @__PURE__ */ new Map());
|
|
12284
|
+
const setMenuBar = useCallback(
|
|
12285
|
+
((...args) => {
|
|
12286
|
+
const appId = args[0];
|
|
12287
|
+
const menuBar = args[1];
|
|
12288
|
+
setMenuBars((prev) => ({ ...prev, [appId]: menuBar }));
|
|
12289
|
+
}),
|
|
12290
|
+
[]
|
|
12291
|
+
);
|
|
12292
|
+
const clearMenuBar = useCallback(
|
|
12293
|
+
((...args) => {
|
|
12294
|
+
const appId = args[0];
|
|
12295
|
+
setMenuBars((prev) => {
|
|
12296
|
+
const next = { ...prev };
|
|
12297
|
+
delete next[appId];
|
|
12298
|
+
return next;
|
|
12299
|
+
});
|
|
12300
|
+
}),
|
|
12301
|
+
[]
|
|
12302
|
+
);
|
|
12303
|
+
const activeMenuBar = useMemo(() => {
|
|
12304
|
+
if (focusedWindowId && menuBars[focusedWindowId]) {
|
|
12305
|
+
return menuBars[focusedWindowId];
|
|
12306
|
+
}
|
|
12307
|
+
return null;
|
|
12308
|
+
}, [focusedWindowId, menuBars]);
|
|
12309
|
+
const signalDock = useCallback(
|
|
12310
|
+
((...args) => {
|
|
12311
|
+
const appId = args[0];
|
|
12312
|
+
const signal = args[1];
|
|
12313
|
+
setDockSignals((prev) => {
|
|
12314
|
+
const next = new Map(prev);
|
|
12315
|
+
const existing = next.get(appId);
|
|
12316
|
+
next.set(appId, { ...existing, ...signal });
|
|
12317
|
+
return next;
|
|
12318
|
+
});
|
|
12319
|
+
}),
|
|
12320
|
+
[]
|
|
12321
|
+
);
|
|
12258
12322
|
const value = useMemo(
|
|
12259
12323
|
() => ({
|
|
12260
12324
|
windows,
|
|
@@ -12269,7 +12333,12 @@ function WindowManagerProvider(props) {
|
|
|
12269
12333
|
tileWindows,
|
|
12270
12334
|
cascadeWindows,
|
|
12271
12335
|
minimizeAll,
|
|
12272
|
-
focusedWindowId
|
|
12336
|
+
focusedWindowId,
|
|
12337
|
+
setMenuBar,
|
|
12338
|
+
clearMenuBar,
|
|
12339
|
+
activeMenuBar,
|
|
12340
|
+
signalDock,
|
|
12341
|
+
dockSignals
|
|
12273
12342
|
}),
|
|
12274
12343
|
[
|
|
12275
12344
|
windows,
|
|
@@ -12284,7 +12353,12 @@ function WindowManagerProvider(props) {
|
|
|
12284
12353
|
tileWindows,
|
|
12285
12354
|
cascadeWindows,
|
|
12286
12355
|
minimizeAll,
|
|
12287
|
-
focusedWindowId
|
|
12356
|
+
focusedWindowId,
|
|
12357
|
+
setMenuBar,
|
|
12358
|
+
clearMenuBar,
|
|
12359
|
+
activeMenuBar,
|
|
12360
|
+
signalDock,
|
|
12361
|
+
dockSignals
|
|
12288
12362
|
]
|
|
12289
12363
|
);
|
|
12290
12364
|
return createElement(WindowManagerContext.Provider, { value }, props.children);
|
|
@@ -12293,6 +12367,336 @@ function useWindowManager() {
|
|
|
12293
12367
|
return useContext(WindowManagerContext);
|
|
12294
12368
|
}
|
|
12295
12369
|
|
|
12370
|
+
// ../components/layout/app-message-bus/src/MessageBus.ts
|
|
12371
|
+
var AppContext = createContext({
|
|
12372
|
+
appId: ""
|
|
12373
|
+
});
|
|
12374
|
+
function AppContextProvider(props) {
|
|
12375
|
+
const value = useMemo(() => ({ appId: props.appId }), [props.appId]);
|
|
12376
|
+
return createElement(AppContext.Provider, { value }, props.children);
|
|
12377
|
+
}
|
|
12378
|
+
function useAppId() {
|
|
12379
|
+
const ctx = useContext(AppContext);
|
|
12380
|
+
return ctx.appId;
|
|
12381
|
+
}
|
|
12382
|
+
var MessageBusContext = createContext({
|
|
12383
|
+
publish: () => {
|
|
12384
|
+
},
|
|
12385
|
+
subscribe: () => () => {
|
|
12386
|
+
},
|
|
12387
|
+
subscribeAll: () => () => {
|
|
12388
|
+
}
|
|
12389
|
+
});
|
|
12390
|
+
function MessageBusProvider(props) {
|
|
12391
|
+
const channelSubsRef = useRef([]);
|
|
12392
|
+
const globalSubsRef = useRef([]);
|
|
12393
|
+
const publish = useCallback(
|
|
12394
|
+
((...args) => {
|
|
12395
|
+
const channel = args[0];
|
|
12396
|
+
const payload = args[1];
|
|
12397
|
+
const to = args[2];
|
|
12398
|
+
const from = args[3] || "";
|
|
12399
|
+
const message = {
|
|
12400
|
+
channel,
|
|
12401
|
+
from,
|
|
12402
|
+
to: to || null,
|
|
12403
|
+
payload,
|
|
12404
|
+
timestamp: Date.now()
|
|
12405
|
+
};
|
|
12406
|
+
const channelSubs = channelSubsRef.current;
|
|
12407
|
+
for (let i = 0; i < channelSubs.length; i++) {
|
|
12408
|
+
const sub = channelSubs[i];
|
|
12409
|
+
if (sub.channel !== channel) continue;
|
|
12410
|
+
if (message.to && sub.appId !== message.to) continue;
|
|
12411
|
+
if (!message.to && sub.appId === from) continue;
|
|
12412
|
+
sub.handler(message);
|
|
12413
|
+
}
|
|
12414
|
+
const globalSubs = globalSubsRef.current;
|
|
12415
|
+
for (let i = 0; i < globalSubs.length; i++) {
|
|
12416
|
+
globalSubs[i].handler(message);
|
|
12417
|
+
}
|
|
12418
|
+
}),
|
|
12419
|
+
[]
|
|
12420
|
+
);
|
|
12421
|
+
const subscribe = useCallback(
|
|
12422
|
+
((...args) => {
|
|
12423
|
+
const channel = args[0];
|
|
12424
|
+
const handler = args[1];
|
|
12425
|
+
const appId = args[2] || "";
|
|
12426
|
+
const sub = { channel, handler, appId };
|
|
12427
|
+
channelSubsRef.current = [...channelSubsRef.current, sub];
|
|
12428
|
+
return () => {
|
|
12429
|
+
channelSubsRef.current = channelSubsRef.current.filter(
|
|
12430
|
+
(s) => s !== sub
|
|
12431
|
+
);
|
|
12432
|
+
};
|
|
12433
|
+
}),
|
|
12434
|
+
[]
|
|
12435
|
+
);
|
|
12436
|
+
const subscribeAll = useCallback(
|
|
12437
|
+
((...args) => {
|
|
12438
|
+
const handler = args[0];
|
|
12439
|
+
const sub = { handler };
|
|
12440
|
+
globalSubsRef.current = [...globalSubsRef.current, sub];
|
|
12441
|
+
return () => {
|
|
12442
|
+
globalSubsRef.current = globalSubsRef.current.filter(
|
|
12443
|
+
(s) => s !== sub
|
|
12444
|
+
);
|
|
12445
|
+
};
|
|
12446
|
+
}),
|
|
12447
|
+
[]
|
|
12448
|
+
);
|
|
12449
|
+
const value = useMemo(
|
|
12450
|
+
() => ({ publish, subscribe, subscribeAll }),
|
|
12451
|
+
[publish, subscribe, subscribeAll]
|
|
12452
|
+
);
|
|
12453
|
+
return createElement(MessageBusContext.Provider, { value }, props.children);
|
|
12454
|
+
}
|
|
12455
|
+
function useMessageBus() {
|
|
12456
|
+
const ctx = useContext(MessageBusContext);
|
|
12457
|
+
const appId = useAppId();
|
|
12458
|
+
const publish = useCallback(
|
|
12459
|
+
((...args) => {
|
|
12460
|
+
const channel = args[0];
|
|
12461
|
+
const payload = args[1];
|
|
12462
|
+
const to = args[2];
|
|
12463
|
+
ctx.publish(channel, payload, to, appId);
|
|
12464
|
+
}),
|
|
12465
|
+
[ctx.publish, appId]
|
|
12466
|
+
);
|
|
12467
|
+
const subscribe = useCallback(
|
|
12468
|
+
((...args) => {
|
|
12469
|
+
const channel = args[0];
|
|
12470
|
+
const handler = args[1];
|
|
12471
|
+
return ctx.subscribe(channel, handler, appId);
|
|
12472
|
+
}),
|
|
12473
|
+
[ctx.subscribe, appId]
|
|
12474
|
+
);
|
|
12475
|
+
return useMemo(
|
|
12476
|
+
() => ({ publish, subscribe, subscribeAll: ctx.subscribeAll }),
|
|
12477
|
+
[publish, subscribe, ctx.subscribeAll]
|
|
12478
|
+
);
|
|
12479
|
+
}
|
|
12480
|
+
function useChannel(channel, handler) {
|
|
12481
|
+
const bus = useMessageBus();
|
|
12482
|
+
const handlerRef = useRef(handler);
|
|
12483
|
+
handlerRef.current = handler;
|
|
12484
|
+
useEffect(() => {
|
|
12485
|
+
const unsubscribe = bus.subscribe(channel, (msg) => {
|
|
12486
|
+
handlerRef.current(msg);
|
|
12487
|
+
});
|
|
12488
|
+
return unsubscribe;
|
|
12489
|
+
}, [bus, channel]);
|
|
12490
|
+
}
|
|
12491
|
+
|
|
12492
|
+
// ../components/layout/app-drag-drop/src/DragDrop.ts
|
|
12493
|
+
var DragDropContext = createContext({
|
|
12494
|
+
startDrag: () => {
|
|
12495
|
+
},
|
|
12496
|
+
cancelDrag: () => {
|
|
12497
|
+
},
|
|
12498
|
+
registerDropZone: () => () => {
|
|
12499
|
+
},
|
|
12500
|
+
currentDrag: null,
|
|
12501
|
+
isDragging: false
|
|
12502
|
+
});
|
|
12503
|
+
function DragDropProvider(props) {
|
|
12504
|
+
const [currentDrag, setCurrentDrag] = useState(null);
|
|
12505
|
+
const [mousePos, setMousePos] = useState({ x: 0, y: 0 });
|
|
12506
|
+
const dropZonesRef = useRef(/* @__PURE__ */ new Map());
|
|
12507
|
+
const activeZoneRef = useRef(null);
|
|
12508
|
+
const isDragging = currentDrag !== null;
|
|
12509
|
+
const startDrag = useCallback(
|
|
12510
|
+
((...args) => {
|
|
12511
|
+
const payload = args[0];
|
|
12512
|
+
setCurrentDrag(payload);
|
|
12513
|
+
}),
|
|
12514
|
+
[]
|
|
12515
|
+
);
|
|
12516
|
+
const cancelDrag = useCallback(
|
|
12517
|
+
((..._args) => {
|
|
12518
|
+
if (activeZoneRef.current) {
|
|
12519
|
+
const zone = dropZonesRef.current.get(activeZoneRef.current);
|
|
12520
|
+
if (zone && zone.onDragLeave) {
|
|
12521
|
+
zone.onDragLeave();
|
|
12522
|
+
}
|
|
12523
|
+
activeZoneRef.current = null;
|
|
12524
|
+
}
|
|
12525
|
+
setCurrentDrag(null);
|
|
12526
|
+
}),
|
|
12527
|
+
[]
|
|
12528
|
+
);
|
|
12529
|
+
const registerDropZone = useCallback(
|
|
12530
|
+
((...args) => {
|
|
12531
|
+
const zoneId = args[0];
|
|
12532
|
+
const zone = args[1];
|
|
12533
|
+
dropZonesRef.current = new Map(dropZonesRef.current);
|
|
12534
|
+
dropZonesRef.current.set(zoneId, zone);
|
|
12535
|
+
return () => {
|
|
12536
|
+
dropZonesRef.current = new Map(dropZonesRef.current);
|
|
12537
|
+
dropZonesRef.current.delete(zoneId);
|
|
12538
|
+
if (activeZoneRef.current === zoneId) {
|
|
12539
|
+
activeZoneRef.current = null;
|
|
12540
|
+
}
|
|
12541
|
+
};
|
|
12542
|
+
}),
|
|
12543
|
+
[]
|
|
12544
|
+
);
|
|
12545
|
+
useEffect(() => {
|
|
12546
|
+
if (!isDragging) return;
|
|
12547
|
+
const handleMouseMove = (e) => {
|
|
12548
|
+
const me = e;
|
|
12549
|
+
setMousePos({ x: me.clientX, y: me.clientY });
|
|
12550
|
+
const elementAtPoint = document.elementFromPoint(me.clientX, me.clientY);
|
|
12551
|
+
if (!elementAtPoint) return;
|
|
12552
|
+
let foundZoneId = null;
|
|
12553
|
+
const zones = dropZonesRef.current;
|
|
12554
|
+
zones.forEach((_zone, zoneId) => {
|
|
12555
|
+
const zoneEl = document.querySelector(`[data-dropzone-id="${zoneId}"]`);
|
|
12556
|
+
if (zoneEl && zoneEl.contains(elementAtPoint)) {
|
|
12557
|
+
foundZoneId = zoneId;
|
|
12558
|
+
}
|
|
12559
|
+
});
|
|
12560
|
+
const prevZoneId = activeZoneRef.current;
|
|
12561
|
+
if (foundZoneId !== prevZoneId) {
|
|
12562
|
+
if (prevZoneId) {
|
|
12563
|
+
const prevZone = zones.get(prevZoneId);
|
|
12564
|
+
if (prevZone && prevZone.onDragLeave) {
|
|
12565
|
+
prevZone.onDragLeave();
|
|
12566
|
+
}
|
|
12567
|
+
}
|
|
12568
|
+
if (foundZoneId) {
|
|
12569
|
+
const newZone = zones.get(foundZoneId);
|
|
12570
|
+
if (newZone && newZone.onDragEnter && currentDrag) {
|
|
12571
|
+
if (newZone.acceptTypes.indexOf(currentDrag.type) !== -1) {
|
|
12572
|
+
newZone.onDragEnter(currentDrag);
|
|
12573
|
+
}
|
|
12574
|
+
}
|
|
12575
|
+
}
|
|
12576
|
+
activeZoneRef.current = foundZoneId;
|
|
12577
|
+
}
|
|
12578
|
+
};
|
|
12579
|
+
const handleMouseUp = (_e) => {
|
|
12580
|
+
const activeId = activeZoneRef.current;
|
|
12581
|
+
if (activeId && currentDrag) {
|
|
12582
|
+
const zone = dropZonesRef.current.get(activeId);
|
|
12583
|
+
if (zone && zone.acceptTypes.indexOf(currentDrag.type) !== -1) {
|
|
12584
|
+
zone.onDrop(currentDrag);
|
|
12585
|
+
}
|
|
12586
|
+
}
|
|
12587
|
+
activeZoneRef.current = null;
|
|
12588
|
+
setCurrentDrag(null);
|
|
12589
|
+
};
|
|
12590
|
+
const handleKeyDown = (e) => {
|
|
12591
|
+
const ke = e;
|
|
12592
|
+
if (ke.key === "Escape") {
|
|
12593
|
+
cancelDrag();
|
|
12594
|
+
}
|
|
12595
|
+
};
|
|
12596
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
12597
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
12598
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
12599
|
+
return () => {
|
|
12600
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
12601
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
12602
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
12603
|
+
};
|
|
12604
|
+
}, [isDragging, currentDrag, cancelDrag]);
|
|
12605
|
+
const value = useMemo(
|
|
12606
|
+
() => ({
|
|
12607
|
+
startDrag,
|
|
12608
|
+
cancelDrag,
|
|
12609
|
+
registerDropZone,
|
|
12610
|
+
currentDrag,
|
|
12611
|
+
isDragging
|
|
12612
|
+
}),
|
|
12613
|
+
[startDrag, cancelDrag, registerDropZone, currentDrag, isDragging]
|
|
12614
|
+
);
|
|
12615
|
+
const previewEl = isDragging ? createElement(
|
|
12616
|
+
"div",
|
|
12617
|
+
{
|
|
12618
|
+
className: "drag-drop-preview",
|
|
12619
|
+
style: {
|
|
12620
|
+
position: "fixed",
|
|
12621
|
+
left: `${mousePos.x + 12}px`,
|
|
12622
|
+
top: `${mousePos.y + 12}px`,
|
|
12623
|
+
pointerEvents: "none",
|
|
12624
|
+
zIndex: "10000",
|
|
12625
|
+
opacity: "0.8",
|
|
12626
|
+
padding: "6px 10px",
|
|
12627
|
+
backgroundColor: "rgba(50, 50, 50, 0.9)",
|
|
12628
|
+
color: "#ffffff",
|
|
12629
|
+
borderRadius: "4px",
|
|
12630
|
+
fontSize: "12px",
|
|
12631
|
+
boxShadow: "0 4px 12px rgba(0,0,0,0.3)",
|
|
12632
|
+
whiteSpace: "nowrap"
|
|
12633
|
+
}
|
|
12634
|
+
},
|
|
12635
|
+
currentDrag && currentDrag.preview ? String(currentDrag.preview) : `Dragging ${currentDrag ? currentDrag.type : ""}`
|
|
12636
|
+
) : null;
|
|
12637
|
+
return createElement(
|
|
12638
|
+
DragDropContext.Provider,
|
|
12639
|
+
{ value },
|
|
12640
|
+
props.children,
|
|
12641
|
+
previewEl
|
|
12642
|
+
);
|
|
12643
|
+
}
|
|
12644
|
+
function useDragDrop() {
|
|
12645
|
+
return useContext(DragDropContext);
|
|
12646
|
+
}
|
|
12647
|
+
function useDraggable(type, data) {
|
|
12648
|
+
const ctx = useDragDrop();
|
|
12649
|
+
const appId = useAppId();
|
|
12650
|
+
const dataRef = useRef(data);
|
|
12651
|
+
dataRef.current = data;
|
|
12652
|
+
const onMouseDown = useCallback(
|
|
12653
|
+
(e) => {
|
|
12654
|
+
e.preventDefault();
|
|
12655
|
+
ctx.startDrag({
|
|
12656
|
+
type,
|
|
12657
|
+
data: dataRef.current,
|
|
12658
|
+
sourceAppId: appId || ""
|
|
12659
|
+
});
|
|
12660
|
+
},
|
|
12661
|
+
[ctx, type, appId]
|
|
12662
|
+
);
|
|
12663
|
+
const isDragging = ctx.isDragging && ctx.currentDrag !== null && ctx.currentDrag.type === type;
|
|
12664
|
+
return useMemo(
|
|
12665
|
+
() => ({ onMouseDown, isDragging }),
|
|
12666
|
+
[onMouseDown, isDragging]
|
|
12667
|
+
);
|
|
12668
|
+
}
|
|
12669
|
+
function useDropZone(config) {
|
|
12670
|
+
const ctx = useDragDrop();
|
|
12671
|
+
const [isOver, setIsOver] = useState(false);
|
|
12672
|
+
const zoneIdRef = useRef(config.zoneId || `zone-${Math.random().toString(36).slice(2, 10)}`);
|
|
12673
|
+
const configRef = useRef(config);
|
|
12674
|
+
configRef.current = config;
|
|
12675
|
+
useEffect(() => {
|
|
12676
|
+
const cleanup = ctx.registerDropZone(zoneIdRef.current, {
|
|
12677
|
+
acceptTypes: configRef.current.acceptTypes,
|
|
12678
|
+
onDragEnter: (payload) => {
|
|
12679
|
+
setIsOver(true);
|
|
12680
|
+
if (configRef.current.onDragEnter) configRef.current.onDragEnter(payload);
|
|
12681
|
+
},
|
|
12682
|
+
onDragLeave: () => {
|
|
12683
|
+
setIsOver(false);
|
|
12684
|
+
if (configRef.current.onDragLeave) configRef.current.onDragLeave();
|
|
12685
|
+
},
|
|
12686
|
+
onDrop: (payload) => {
|
|
12687
|
+
setIsOver(false);
|
|
12688
|
+
configRef.current.onDrop(payload);
|
|
12689
|
+
}
|
|
12690
|
+
});
|
|
12691
|
+
return cleanup;
|
|
12692
|
+
}, [ctx]);
|
|
12693
|
+
const canDrop = ctx.isDragging && ctx.currentDrag !== null && config.acceptTypes.indexOf(ctx.currentDrag.type) !== -1;
|
|
12694
|
+
return useMemo(
|
|
12695
|
+
() => ({ isOver, canDrop, zoneId: zoneIdRef.current }),
|
|
12696
|
+
[isOver, canDrop]
|
|
12697
|
+
);
|
|
12698
|
+
}
|
|
12699
|
+
|
|
12296
12700
|
// ../components/nav/system-tray/src/SystemTray.ts
|
|
12297
12701
|
var DAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
12298
12702
|
var MONTHS = [
|
|
@@ -12634,10 +13038,154 @@ function UserMenu(props) {
|
|
|
12634
13038
|
dropdown
|
|
12635
13039
|
);
|
|
12636
13040
|
}
|
|
13041
|
+
function AppMenuDropdown(props) {
|
|
13042
|
+
const { menu } = props;
|
|
13043
|
+
const { hover, onMouseEnter, onMouseLeave } = useHover();
|
|
13044
|
+
const [open, setOpen] = useState(false);
|
|
13045
|
+
const containerRef = useRef(null);
|
|
13046
|
+
const handleToggle = useCallback(() => {
|
|
13047
|
+
setOpen((prev) => !prev);
|
|
13048
|
+
}, []);
|
|
13049
|
+
const handleClose = useCallback(() => {
|
|
13050
|
+
setOpen(false);
|
|
13051
|
+
}, []);
|
|
13052
|
+
const handleKeyDown = useCallback((e) => {
|
|
13053
|
+
const ke = e;
|
|
13054
|
+
if (ke.key === "Enter" || ke.key === " ") {
|
|
13055
|
+
ke.preventDefault();
|
|
13056
|
+
setOpen((prev) => !prev);
|
|
13057
|
+
}
|
|
13058
|
+
if (ke.key === "Escape") {
|
|
13059
|
+
setOpen(false);
|
|
13060
|
+
}
|
|
13061
|
+
}, []);
|
|
13062
|
+
useEffect(() => {
|
|
13063
|
+
if (!open) return;
|
|
13064
|
+
const handleDocClick = (e) => {
|
|
13065
|
+
const container = containerRef.current;
|
|
13066
|
+
if (container && !container.contains(e.target)) {
|
|
13067
|
+
setOpen(false);
|
|
13068
|
+
}
|
|
13069
|
+
};
|
|
13070
|
+
document.addEventListener("click", handleDocClick, true);
|
|
13071
|
+
return () => {
|
|
13072
|
+
document.removeEventListener("click", handleDocClick, true);
|
|
13073
|
+
};
|
|
13074
|
+
}, [open]);
|
|
13075
|
+
const dropdown = open && menu.items.length > 0 ? createElement(
|
|
13076
|
+
"div",
|
|
13077
|
+
{
|
|
13078
|
+
role: "menu",
|
|
13079
|
+
"aria-label": menu.label + " menu",
|
|
13080
|
+
style: {
|
|
13081
|
+
position: "absolute",
|
|
13082
|
+
top: "100%",
|
|
13083
|
+
left: "0",
|
|
13084
|
+
marginTop: "2px",
|
|
13085
|
+
backgroundColor: "var(--panel-bg, #2c2c2c)",
|
|
13086
|
+
border: "1px solid var(--panel-divider, #555555)",
|
|
13087
|
+
borderRadius: "6px",
|
|
13088
|
+
boxShadow: "0 4px 12px rgba(0,0,0,0.3)",
|
|
13089
|
+
padding: "4px 0",
|
|
13090
|
+
minWidth: "180px",
|
|
13091
|
+
zIndex: "1000"
|
|
13092
|
+
}
|
|
13093
|
+
},
|
|
13094
|
+
...menu.items.map(
|
|
13095
|
+
(item, i) => {
|
|
13096
|
+
if (item.divider) {
|
|
13097
|
+
return createElement("div", {
|
|
13098
|
+
key: "div-" + String(i),
|
|
13099
|
+
role: "separator",
|
|
13100
|
+
style: {
|
|
13101
|
+
height: "1px",
|
|
13102
|
+
backgroundColor: "var(--panel-divider, #555555)",
|
|
13103
|
+
margin: "4px 0"
|
|
13104
|
+
}
|
|
13105
|
+
});
|
|
13106
|
+
}
|
|
13107
|
+
return createElement(
|
|
13108
|
+
"button",
|
|
13109
|
+
{
|
|
13110
|
+
key: String(i),
|
|
13111
|
+
type: "button",
|
|
13112
|
+
role: "menuitem",
|
|
13113
|
+
tabIndex: -1,
|
|
13114
|
+
disabled: item.disabled ?? false,
|
|
13115
|
+
onClick: () => {
|
|
13116
|
+
if (item.onClick) item.onClick();
|
|
13117
|
+
handleClose();
|
|
13118
|
+
},
|
|
13119
|
+
style: {
|
|
13120
|
+
display: "flex",
|
|
13121
|
+
alignItems: "center",
|
|
13122
|
+
justifyContent: "space-between",
|
|
13123
|
+
width: "100%",
|
|
13124
|
+
padding: "6px 16px",
|
|
13125
|
+
border: "none",
|
|
13126
|
+
outline: "none",
|
|
13127
|
+
backgroundColor: "transparent",
|
|
13128
|
+
color: item.disabled ? "rgba(255,255,255,0.4)" : "var(--panel-text, #ffffff)",
|
|
13129
|
+
fontFamily: "inherit",
|
|
13130
|
+
fontSize: "13px",
|
|
13131
|
+
textAlign: "left",
|
|
13132
|
+
cursor: item.disabled ? "default" : "pointer",
|
|
13133
|
+
boxSizing: "border-box"
|
|
13134
|
+
}
|
|
13135
|
+
},
|
|
13136
|
+
createElement(
|
|
13137
|
+
"span",
|
|
13138
|
+
null,
|
|
13139
|
+
item.checked ? "\u2713 " : "",
|
|
13140
|
+
item.label || ""
|
|
13141
|
+
),
|
|
13142
|
+
item.shortcut ? createElement("span", {
|
|
13143
|
+
style: { fontSize: "11px", opacity: "0.6", marginLeft: "16px" }
|
|
13144
|
+
}, item.shortcut) : null
|
|
13145
|
+
);
|
|
13146
|
+
}
|
|
13147
|
+
)
|
|
13148
|
+
) : null;
|
|
13149
|
+
return createElement(
|
|
13150
|
+
"div",
|
|
13151
|
+
{
|
|
13152
|
+
ref: containerRef,
|
|
13153
|
+
className: "system-tray__app-menu",
|
|
13154
|
+
style: { position: "relative", display: "inline-flex", height: "100%" }
|
|
13155
|
+
},
|
|
13156
|
+
createElement("button", {
|
|
13157
|
+
type: "button",
|
|
13158
|
+
"aria-haspopup": "true",
|
|
13159
|
+
"aria-expanded": String(open),
|
|
13160
|
+
tabIndex: 0,
|
|
13161
|
+
onClick: handleToggle,
|
|
13162
|
+
onKeyDown: handleKeyDown,
|
|
13163
|
+
onMouseEnter,
|
|
13164
|
+
onMouseLeave,
|
|
13165
|
+
style: {
|
|
13166
|
+
display: "inline-flex",
|
|
13167
|
+
alignItems: "center",
|
|
13168
|
+
padding: "0 10px",
|
|
13169
|
+
height: "100%",
|
|
13170
|
+
border: "none",
|
|
13171
|
+
outline: "none",
|
|
13172
|
+
backgroundColor: hover || open ? "rgba(255,255,255,0.15)" : "transparent",
|
|
13173
|
+
color: "inherit",
|
|
13174
|
+
fontFamily: "inherit",
|
|
13175
|
+
fontSize: "13px",
|
|
13176
|
+
fontWeight: "500",
|
|
13177
|
+
cursor: "pointer",
|
|
13178
|
+
transition: "background-color 0.15s"
|
|
13179
|
+
}
|
|
13180
|
+
}, menu.label),
|
|
13181
|
+
dropdown
|
|
13182
|
+
);
|
|
13183
|
+
}
|
|
12637
13184
|
function SystemTray(props) {
|
|
12638
13185
|
const {
|
|
12639
13186
|
activeAppName,
|
|
12640
13187
|
activitiesButton,
|
|
13188
|
+
appMenuBar,
|
|
12641
13189
|
clockFormat = "24h",
|
|
12642
13190
|
showSeconds = true,
|
|
12643
13191
|
showDate = true,
|
|
@@ -12674,6 +13222,16 @@ function SystemTray(props) {
|
|
|
12674
13222
|
}, activeAppName)
|
|
12675
13223
|
);
|
|
12676
13224
|
}
|
|
13225
|
+
if (appMenuBar && appMenuBar.menus.length > 0) {
|
|
13226
|
+
for (let mi = 0; mi < appMenuBar.menus.length; mi++) {
|
|
13227
|
+
leftChildren.push(
|
|
13228
|
+
createElement(AppMenuDropdown, {
|
|
13229
|
+
key: "appmenu-" + String(mi),
|
|
13230
|
+
menu: appMenuBar.menus[mi]
|
|
13231
|
+
})
|
|
13232
|
+
);
|
|
13233
|
+
}
|
|
13234
|
+
}
|
|
12677
13235
|
const leftSection = createElement("div", {
|
|
12678
13236
|
style: {
|
|
12679
13237
|
display: "flex",
|
|
@@ -12933,6 +13491,33 @@ function DockItemComponent(props) {
|
|
|
12933
13491
|
},
|
|
12934
13492
|
"aria-hidden": "true"
|
|
12935
13493
|
}) : null;
|
|
13494
|
+
const progressEl = item.progress != null && item.progress > 0 ? createElement(
|
|
13495
|
+
"div",
|
|
13496
|
+
{
|
|
13497
|
+
style: {
|
|
13498
|
+
position: "absolute",
|
|
13499
|
+
bottom: "2px",
|
|
13500
|
+
left: "6px",
|
|
13501
|
+
right: "6px",
|
|
13502
|
+
height: "3px",
|
|
13503
|
+
backgroundColor: "rgba(255,255,255,0.2)",
|
|
13504
|
+
borderRadius: "2px",
|
|
13505
|
+
overflow: "hidden",
|
|
13506
|
+
pointerEvents: "none",
|
|
13507
|
+
zIndex: "2"
|
|
13508
|
+
},
|
|
13509
|
+
"aria-hidden": "true"
|
|
13510
|
+
},
|
|
13511
|
+
createElement("div", {
|
|
13512
|
+
style: {
|
|
13513
|
+
width: `${Math.min(1, Math.max(0, item.progress)) * 100}%`,
|
|
13514
|
+
height: "100%",
|
|
13515
|
+
backgroundColor: "var(--dock-progress-color, #3b82f6)",
|
|
13516
|
+
borderRadius: "2px",
|
|
13517
|
+
transition: "width 200ms ease"
|
|
13518
|
+
}
|
|
13519
|
+
})
|
|
13520
|
+
) : null;
|
|
12936
13521
|
const tooltipEl = hover ? createElement("div", {
|
|
12937
13522
|
role: "tooltip",
|
|
12938
13523
|
style: {
|
|
@@ -12962,7 +13547,8 @@ function DockItemComponent(props) {
|
|
|
12962
13547
|
transition: "transform 100ms, background-color 100ms",
|
|
12963
13548
|
borderRadius: "8px",
|
|
12964
13549
|
outline: "none",
|
|
12965
|
-
...hover && !disabled ? { transform: "scale(1.1)", backgroundColor: "rgba(255,255,255,0.15)" } : {}
|
|
13550
|
+
...hover && !disabled ? { transform: "scale(1.1)", backgroundColor: "rgba(255,255,255,0.15)" } : {},
|
|
13551
|
+
...item.urgent && !disabled ? { animation: "dock-urgent-pulse 0.6s ease-in-out infinite alternate" } : {}
|
|
12966
13552
|
};
|
|
12967
13553
|
return createElement(
|
|
12968
13554
|
"button",
|
|
@@ -12978,11 +13564,13 @@ function DockItemComponent(props) {
|
|
|
12978
13564
|
onContextMenu: handleContextMenu,
|
|
12979
13565
|
onMouseEnter: handleMouseEnter,
|
|
12980
13566
|
onMouseLeave: handleMouseLeave,
|
|
12981
|
-
"data-dock-item-id": item.id
|
|
13567
|
+
"data-dock-item-id": item.id,
|
|
13568
|
+
"data-urgent": item.urgent ? "true" : void 0
|
|
12982
13569
|
},
|
|
12983
13570
|
iconEl,
|
|
12984
13571
|
badgeEl,
|
|
12985
13572
|
activeDotEl,
|
|
13573
|
+
progressEl,
|
|
12986
13574
|
tooltipEl
|
|
12987
13575
|
);
|
|
12988
13576
|
}
|
|
@@ -15917,6 +16505,102 @@ function ToastContainer2(props) {
|
|
|
15917
16505
|
"aria-label": "Notifications"
|
|
15918
16506
|
}, ...toastEls);
|
|
15919
16507
|
}
|
|
16508
|
+
function TerminalContent() {
|
|
16509
|
+
const bus = useMessageBus();
|
|
16510
|
+
const publishedRef = useRef(false);
|
|
16511
|
+
useEffect(() => {
|
|
16512
|
+
if (!publishedRef.current) {
|
|
16513
|
+
publishedRef.current = true;
|
|
16514
|
+
bus.publish("terminal-output", { text: "Terminal session started", pid: 1 });
|
|
16515
|
+
}
|
|
16516
|
+
}, [bus]);
|
|
16517
|
+
const contentStyle = {
|
|
16518
|
+
padding: "16px",
|
|
16519
|
+
fontSize: "12px",
|
|
16520
|
+
color: "#00ff41",
|
|
16521
|
+
height: "100%",
|
|
16522
|
+
overflow: "auto",
|
|
16523
|
+
backgroundColor: "#1a1a2e",
|
|
16524
|
+
fontFamily: "monospace"
|
|
16525
|
+
};
|
|
16526
|
+
return createElement(
|
|
16527
|
+
"div",
|
|
16528
|
+
{ style: contentStyle },
|
|
16529
|
+
createElement("div", null, "$ whoami"),
|
|
16530
|
+
createElement("div", null, "operator"),
|
|
16531
|
+
createElement("div", null, "$ uname -a"),
|
|
16532
|
+
createElement("div", null, "Linux specifyjs 6.1.0 #1 SMP x86_64 GNU/Linux"),
|
|
16533
|
+
createElement(
|
|
16534
|
+
"div",
|
|
16535
|
+
{ style: { opacity: "0.6", marginTop: "8px", fontSize: "10px" } },
|
|
16536
|
+
"[Published terminal-output message]"
|
|
16537
|
+
),
|
|
16538
|
+
createElement("div", null, "$ _")
|
|
16539
|
+
);
|
|
16540
|
+
}
|
|
16541
|
+
function FilesContent() {
|
|
16542
|
+
const [messages, setMessages] = useState([]);
|
|
16543
|
+
const dragDrop = useDragDrop();
|
|
16544
|
+
useChannel("terminal-output", (msg) => {
|
|
16545
|
+
setMessages((prev) => [...prev, `[terminal] ${msg.payload.text}`]);
|
|
16546
|
+
});
|
|
16547
|
+
const handleDragFile = useCallback((e) => {
|
|
16548
|
+
e.preventDefault();
|
|
16549
|
+
dragDrop.startDrag({
|
|
16550
|
+
type: "application/file",
|
|
16551
|
+
data: { name: "readme.txt", size: 1024 },
|
|
16552
|
+
sourceAppId: "files",
|
|
16553
|
+
preview: "readme.txt"
|
|
16554
|
+
});
|
|
16555
|
+
}, [dragDrop]);
|
|
16556
|
+
const contentStyle = {
|
|
16557
|
+
padding: "16px",
|
|
16558
|
+
fontSize: "13px",
|
|
16559
|
+
color: "var(--color-text, #333)",
|
|
16560
|
+
height: "100%",
|
|
16561
|
+
overflow: "auto"
|
|
16562
|
+
};
|
|
16563
|
+
return createElement(
|
|
16564
|
+
"div",
|
|
16565
|
+
{ style: contentStyle },
|
|
16566
|
+
createElement("div", { style: { fontWeight: "600", marginBottom: "12px" } }, "Home"),
|
|
16567
|
+
createElement(
|
|
16568
|
+
"div",
|
|
16569
|
+
{ style: { display: "flex", flexDirection: "column", gap: "6px" } },
|
|
16570
|
+
...["\u{1F4C1} Documents", "\u{1F4C1} Downloads", "\u{1F4C1} Music", "\u{1F4C1} Pictures", "\u{1F4C1} Videos"].map(
|
|
16571
|
+
(f) => createElement("span", { style: { cursor: "pointer" } }, f)
|
|
16572
|
+
),
|
|
16573
|
+
createElement("span", {
|
|
16574
|
+
style: {
|
|
16575
|
+
cursor: "grab",
|
|
16576
|
+
padding: "4px 8px",
|
|
16577
|
+
border: "1px dashed #94a3b8",
|
|
16578
|
+
borderRadius: "4px",
|
|
16579
|
+
backgroundColor: "rgba(148, 163, 184, 0.1)"
|
|
16580
|
+
},
|
|
16581
|
+
onMouseDown: handleDragFile,
|
|
16582
|
+
"aria-label": "Drag readme.txt"
|
|
16583
|
+
}, "\u{1F4C4} readme.txt (drag me)")
|
|
16584
|
+
),
|
|
16585
|
+
messages.length > 0 ? createElement(
|
|
16586
|
+
"div",
|
|
16587
|
+
{
|
|
16588
|
+
style: {
|
|
16589
|
+
marginTop: "12px",
|
|
16590
|
+
padding: "8px",
|
|
16591
|
+
backgroundColor: "rgba(0,0,0,0.05)",
|
|
16592
|
+
borderRadius: "4px",
|
|
16593
|
+
fontSize: "11px",
|
|
16594
|
+
fontFamily: "monospace"
|
|
16595
|
+
}
|
|
16596
|
+
},
|
|
16597
|
+
createElement("div", { style: { fontWeight: "600", marginBottom: "4px" } }, "Messages received:"),
|
|
16598
|
+
...messages.map(
|
|
16599
|
+
(m, i) => createElement("div", { key: String(i), style: { color: "#64748b" } }, m)
|
|
16600
|
+
)
|
|
16601
|
+
) : null
|
|
16602
|
+
);
|
|
16603
|
+
}
|
|
15920
16604
|
function getMockContent(title) {
|
|
15921
16605
|
const contentStyle = {
|
|
15922
16606
|
padding: "16px",
|
|
@@ -15928,24 +16612,15 @@ function getMockContent(title) {
|
|
|
15928
16612
|
switch (title) {
|
|
15929
16613
|
case "Files":
|
|
15930
16614
|
return createElement(
|
|
15931
|
-
|
|
15932
|
-
{
|
|
15933
|
-
createElement(
|
|
15934
|
-
createElement(
|
|
15935
|
-
"div",
|
|
15936
|
-
{ style: { display: "flex", flexDirection: "column", gap: "6px" } },
|
|
15937
|
-
...["\u{1F4C1} Documents", "\u{1F4C1} Downloads", "\u{1F4C1} Music", "\u{1F4C1} Pictures", "\u{1F4C1} Videos", "\u{1F4C4} readme.txt"].map((f) => createElement("span", { style: { cursor: "pointer" } }, f))
|
|
15938
|
-
)
|
|
16615
|
+
AppContextProvider,
|
|
16616
|
+
{ appId: "files" },
|
|
16617
|
+
createElement(FilesContent, null)
|
|
15939
16618
|
);
|
|
15940
16619
|
case "Terminal":
|
|
15941
16620
|
return createElement(
|
|
15942
|
-
|
|
15943
|
-
{
|
|
15944
|
-
createElement(
|
|
15945
|
-
createElement("div", null, "operator"),
|
|
15946
|
-
createElement("div", null, "$ uname -a"),
|
|
15947
|
-
createElement("div", null, "Linux specifyjs 6.1.0 #1 SMP x86_64 GNU/Linux"),
|
|
15948
|
-
createElement("div", null, "$ _")
|
|
16621
|
+
AppContextProvider,
|
|
16622
|
+
{ appId: "terminal" },
|
|
16623
|
+
createElement(TerminalContent, null)
|
|
15949
16624
|
);
|
|
15950
16625
|
case "Browser":
|
|
15951
16626
|
return createElement(
|
|
@@ -15988,6 +16663,9 @@ function getMockContent(title) {
|
|
|
15988
16663
|
}
|
|
15989
16664
|
function UnityDesktopInner(props) {
|
|
15990
16665
|
const { apps, user, onAppOpen, onLogout, theme = "dark", children } = props;
|
|
16666
|
+
const wm = useWindowManager();
|
|
16667
|
+
const wmActiveMenuBar = wm.activeMenuBar;
|
|
16668
|
+
const wmDockSignals = wm.dockSignals;
|
|
15991
16669
|
const [openWindows, setOpenWindows] = useState([]);
|
|
15992
16670
|
const [toasts, setToasts] = useState([]);
|
|
15993
16671
|
const [showAppsGrid, setShowAppsGrid] = useState(false);
|
|
@@ -16040,16 +16718,54 @@ function UnityDesktopInner(props) {
|
|
|
16040
16718
|
};
|
|
16041
16719
|
return [...prev.map((w) => ({ ...w, focused: false })), newWin];
|
|
16042
16720
|
});
|
|
16721
|
+
if (id === "files") {
|
|
16722
|
+
wm.setMenuBar("files", {
|
|
16723
|
+
menus: [
|
|
16724
|
+
{
|
|
16725
|
+
label: "File",
|
|
16726
|
+
items: [
|
|
16727
|
+
{ label: "New", shortcut: "Ctrl+N", onClick: () => {
|
|
16728
|
+
} },
|
|
16729
|
+
{ label: "Open", shortcut: "Ctrl+O", onClick: () => {
|
|
16730
|
+
} },
|
|
16731
|
+
{ label: "Save", shortcut: "Ctrl+S", onClick: () => {
|
|
16732
|
+
} }
|
|
16733
|
+
]
|
|
16734
|
+
},
|
|
16735
|
+
{
|
|
16736
|
+
label: "Edit",
|
|
16737
|
+
items: [
|
|
16738
|
+
{ label: "Cut", shortcut: "Ctrl+X", onClick: () => {
|
|
16739
|
+
} },
|
|
16740
|
+
{ label: "Copy", shortcut: "Ctrl+C", onClick: () => {
|
|
16741
|
+
} },
|
|
16742
|
+
{ label: "Paste", shortcut: "Ctrl+V", onClick: () => {
|
|
16743
|
+
} }
|
|
16744
|
+
]
|
|
16745
|
+
}
|
|
16746
|
+
]
|
|
16747
|
+
});
|
|
16748
|
+
}
|
|
16749
|
+
if (id === "terminal") {
|
|
16750
|
+
wm.signalDock("terminal", { badge: 3 });
|
|
16751
|
+
}
|
|
16043
16752
|
if (onAppOpenRef.current) onAppOpenRef.current(id);
|
|
16044
|
-
}, []);
|
|
16753
|
+
}, [wm]);
|
|
16045
16754
|
const dockItems = apps.map((app) => {
|
|
16046
16755
|
const isRunning = openWindows.some((w) => w.id === app.id);
|
|
16047
|
-
|
|
16756
|
+
const signal = wmDockSignals.get(app.id);
|
|
16757
|
+
const item = {
|
|
16048
16758
|
id: app.id,
|
|
16049
16759
|
icon: app.icon,
|
|
16050
|
-
label: app.label,
|
|
16760
|
+
label: signal?.tooltip || app.label,
|
|
16051
16761
|
active: isRunning
|
|
16052
16762
|
};
|
|
16763
|
+
if (signal) {
|
|
16764
|
+
if (signal.badge != null) item.badge = signal.badge > 0 ? signal.badge : void 0;
|
|
16765
|
+
if (signal.progress != null) item.progress = signal.progress > 0 ? signal.progress : void 0;
|
|
16766
|
+
if (signal.urgent) item.urgent = true;
|
|
16767
|
+
}
|
|
16768
|
+
return item;
|
|
16053
16769
|
});
|
|
16054
16770
|
const focusedWindow = openWindows.find((w) => w.focused);
|
|
16055
16771
|
const activeAppName = focusedWindow ? focusedWindow.title : void 0;
|
|
@@ -16111,6 +16827,7 @@ function UnityDesktopInner(props) {
|
|
|
16111
16827
|
const systemTrayEl = createElement(SystemTray, {
|
|
16112
16828
|
activeAppName,
|
|
16113
16829
|
activitiesButton: { label: "Activities", onClick: toggleAppsGrid },
|
|
16830
|
+
appMenuBar: wmActiveMenuBar || void 0,
|
|
16114
16831
|
clockFormat: "24h",
|
|
16115
16832
|
showSeconds: true,
|
|
16116
16833
|
showDate: true,
|
|
@@ -16365,14 +17082,22 @@ function UnityDesktop(props) {
|
|
|
16365
17082
|
{
|
|
16366
17083
|
onWindowOpen: onAppOpen
|
|
16367
17084
|
},
|
|
16368
|
-
createElement(
|
|
16369
|
-
|
|
16370
|
-
|
|
16371
|
-
|
|
16372
|
-
|
|
16373
|
-
|
|
16374
|
-
|
|
16375
|
-
|
|
17085
|
+
createElement(
|
|
17086
|
+
MessageBusProvider,
|
|
17087
|
+
null,
|
|
17088
|
+
createElement(
|
|
17089
|
+
DragDropProvider,
|
|
17090
|
+
null,
|
|
17091
|
+
createElement(UnityDesktopInner, {
|
|
17092
|
+
apps,
|
|
17093
|
+
user,
|
|
17094
|
+
onAppOpen,
|
|
17095
|
+
onLogout,
|
|
17096
|
+
theme,
|
|
17097
|
+
children
|
|
17098
|
+
})
|
|
17099
|
+
)
|
|
17100
|
+
)
|
|
16376
17101
|
);
|
|
16377
17102
|
}
|
|
16378
17103
|
|
|
@@ -16387,22 +17112,36 @@ function UnityApp(props) {
|
|
|
16387
17112
|
minSize,
|
|
16388
17113
|
resizable = true,
|
|
16389
17114
|
onClose,
|
|
17115
|
+
menuBar,
|
|
17116
|
+
onActivate,
|
|
17117
|
+
onDeactivate,
|
|
16390
17118
|
children
|
|
16391
17119
|
} = props;
|
|
16392
17120
|
const windowManager = useWindowManager();
|
|
16393
17121
|
const windowState = useMemo(() => {
|
|
16394
17122
|
return windowManager.windows.find((w) => w.id === id);
|
|
16395
17123
|
}, [windowManager.windows, id]);
|
|
16396
|
-
|
|
16397
|
-
|
|
16398
|
-
id,
|
|
16399
|
-
|
|
16400
|
-
|
|
16401
|
-
|
|
16402
|
-
|
|
16403
|
-
|
|
16404
|
-
|
|
16405
|
-
}
|
|
17124
|
+
useEffect(() => {
|
|
17125
|
+
if (menuBar) {
|
|
17126
|
+
windowManager.setMenuBar(id, menuBar);
|
|
17127
|
+
} else {
|
|
17128
|
+
windowManager.clearMenuBar(id);
|
|
17129
|
+
}
|
|
17130
|
+
return () => {
|
|
17131
|
+
windowManager.clearMenuBar(id);
|
|
17132
|
+
};
|
|
17133
|
+
}, [menuBar, id, windowManager]);
|
|
17134
|
+
const wasFocusedRef = useRef(false);
|
|
17135
|
+
const isFocused = windowState ? windowState.focused : false;
|
|
17136
|
+
useEffect(() => {
|
|
17137
|
+
const wasFocused = wasFocusedRef.current;
|
|
17138
|
+
wasFocusedRef.current = isFocused;
|
|
17139
|
+
if (isFocused && !wasFocused) {
|
|
17140
|
+
if (onActivate) onActivate();
|
|
17141
|
+
} else if (!isFocused && wasFocused) {
|
|
17142
|
+
if (onDeactivate) onDeactivate();
|
|
17143
|
+
}
|
|
17144
|
+
}, [isFocused, onActivate, onDeactivate]);
|
|
16406
17145
|
const handleClose = useCallback(() => {
|
|
16407
17146
|
windowManager.closeWindow(id);
|
|
16408
17147
|
if (onClose) onClose();
|
|
@@ -16426,25 +17165,39 @@ function UnityApp(props) {
|
|
|
16426
17165
|
windowManager.maximizeWindow(id);
|
|
16427
17166
|
}
|
|
16428
17167
|
}, [windowManager, id, windowState]);
|
|
16429
|
-
|
|
16430
|
-
|
|
16431
|
-
|
|
16432
|
-
|
|
16433
|
-
|
|
16434
|
-
|
|
16435
|
-
|
|
16436
|
-
|
|
16437
|
-
|
|
16438
|
-
|
|
16439
|
-
|
|
16440
|
-
|
|
16441
|
-
|
|
16442
|
-
|
|
16443
|
-
|
|
16444
|
-
|
|
16445
|
-
|
|
16446
|
-
|
|
16447
|
-
|
|
17168
|
+
if (!windowState) {
|
|
17169
|
+
windowManager.openWindow({
|
|
17170
|
+
id,
|
|
17171
|
+
title,
|
|
17172
|
+
icon,
|
|
17173
|
+
position: defaultPosition,
|
|
17174
|
+
size: defaultSize
|
|
17175
|
+
});
|
|
17176
|
+
return null;
|
|
17177
|
+
}
|
|
17178
|
+
return createElement(
|
|
17179
|
+
AppContextProvider,
|
|
17180
|
+
{ appId: id },
|
|
17181
|
+
createElement(DraggableWindow, {
|
|
17182
|
+
id,
|
|
17183
|
+
title,
|
|
17184
|
+
icon,
|
|
17185
|
+
defaultPosition: windowState.position,
|
|
17186
|
+
defaultSize: windowState.size,
|
|
17187
|
+
minSize,
|
|
17188
|
+
resizable,
|
|
17189
|
+
windowState: windowState.windowState,
|
|
17190
|
+
focused: windowState.focused,
|
|
17191
|
+
zIndex: windowState.zIndex,
|
|
17192
|
+
onClose: handleClose,
|
|
17193
|
+
onFocus: handleFocus,
|
|
17194
|
+
onMove: handleMove,
|
|
17195
|
+
onResize: handleResize,
|
|
17196
|
+
onMinimize: handleMinimize,
|
|
17197
|
+
onMaximize: handleMaximize,
|
|
17198
|
+
children
|
|
17199
|
+
})
|
|
17200
|
+
);
|
|
16448
17201
|
}
|
|
16449
17202
|
|
|
16450
17203
|
// ../components/form/button/src/Button.ts
|
|
@@ -25569,6 +26322,7 @@ export {
|
|
|
25569
26322
|
Accordion,
|
|
25570
26323
|
Alert,
|
|
25571
26324
|
AnalogClock,
|
|
26325
|
+
AppContextProvider,
|
|
25572
26326
|
Avatar,
|
|
25573
26327
|
Badge,
|
|
25574
26328
|
BarGraph,
|
|
@@ -25593,6 +26347,7 @@ export {
|
|
|
25593
26347
|
DecompositionTree,
|
|
25594
26348
|
DigitalClock,
|
|
25595
26349
|
DiscreteCartesian2D,
|
|
26350
|
+
DragDropProvider,
|
|
25596
26351
|
Drawer,
|
|
25597
26352
|
Dropdown,
|
|
25598
26353
|
EmptyState,
|
|
@@ -25618,6 +26373,7 @@ export {
|
|
|
25618
26373
|
LollipopChart,
|
|
25619
26374
|
Matrix,
|
|
25620
26375
|
Menubar,
|
|
26376
|
+
MessageBusProvider,
|
|
25621
26377
|
Modal,
|
|
25622
26378
|
MultilineField,
|
|
25623
26379
|
NavWrapper,
|
|
@@ -25685,9 +26441,15 @@ export {
|
|
|
25685
26441
|
numRotationAngles,
|
|
25686
26442
|
projectTo2D,
|
|
25687
26443
|
transformVec,
|
|
26444
|
+
useAppId,
|
|
25688
26445
|
useBarGraphScales,
|
|
26446
|
+
useChannel,
|
|
26447
|
+
useDragDrop,
|
|
26448
|
+
useDraggable,
|
|
26449
|
+
useDropZone,
|
|
25689
26450
|
useHover,
|
|
25690
26451
|
useHypercube,
|
|
25691
26452
|
useLineGraphScales,
|
|
26453
|
+
useMessageBus,
|
|
25692
26454
|
useToast
|
|
25693
26455
|
};
|