react-os-shell 0.1.48 → 0.1.50
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/{Browser-B3XVP6HC.js → Browser-34KKFXNU.js} +3 -3
- package/dist/{Browser-B3XVP6HC.js.map → Browser-34KKFXNU.js.map} +1 -1
- package/dist/{Calculator-HJKPXY2B.js → Calculator-LJMNOIS6.js} +4 -4
- package/dist/{Calculator-HJKPXY2B.js.map → Calculator-LJMNOIS6.js.map} +1 -1
- package/dist/{Calendar-GCQIWTU3.js → Calendar-L5FHOXDG.js} +4 -4
- package/dist/{Calendar-GCQIWTU3.js.map → Calendar-L5FHOXDG.js.map} +1 -1
- package/dist/{CurrencyConverter-FYF4JLKZ.js → CurrencyConverter-HFPJAIPX.js} +4 -4
- package/dist/{CurrencyConverter-FYF4JLKZ.js.map → CurrencyConverter-HFPJAIPX.js.map} +1 -1
- package/dist/{Documents-NTWVLYXJ.js → Documents-3UPQ5QTF.js} +3 -3
- package/dist/{Documents-NTWVLYXJ.js.map → Documents-3UPQ5QTF.js.map} +1 -1
- package/dist/{Email-3B63P7ML.js → Email-YPLU6HJL.js} +3 -3
- package/dist/{Email-3B63P7ML.js.map → Email-YPLU6HJL.js.map} +1 -1
- package/dist/Files-N3QQLSXV.js +7 -0
- package/dist/Files-N3QQLSXV.js.map +1 -0
- package/dist/{Minesweeper-MAA4NIV4.js → Minesweeper-UUHQCDAC.js} +3 -3
- package/dist/{Minesweeper-MAA4NIV4.js.map → Minesweeper-UUHQCDAC.js.map} +1 -1
- package/dist/{Notepad-2K6HQ2WA.js → Notepad-W2PKOGWE.js} +4 -4
- package/dist/{Notepad-2K6HQ2WA.js.map → Notepad-W2PKOGWE.js.map} +1 -1
- package/dist/{PomodoroTimer-IJUONN6I.js → PomodoroTimer-4ZYITLNH.js} +4 -4
- package/dist/{PomodoroTimer-IJUONN6I.js.map → PomodoroTimer-4ZYITLNH.js.map} +1 -1
- package/dist/Preview-IEPHQIJE.js +6 -0
- package/dist/{Preview-SEQ5NHLQ.js.map → Preview-IEPHQIJE.js.map} +1 -1
- package/dist/{Spreadsheet-W7F6IMTJ.js → Spreadsheet-QIBLYKVF.js} +3 -3
- package/dist/{Spreadsheet-W7F6IMTJ.js.map → Spreadsheet-QIBLYKVF.js.map} +1 -1
- package/dist/{Weather-MDTM6OEL.js → Weather-ZJE7DNKB.js} +4 -4
- package/dist/{Weather-MDTM6OEL.js.map → Weather-ZJE7DNKB.js.map} +1 -1
- package/dist/apps/index.d.ts +2 -1
- package/dist/apps/index.js +16 -15
- package/dist/apps/index.js.map +1 -1
- package/dist/{chunk-UD2TKHR2.js → chunk-53CE7OVT.js} +129 -6
- package/dist/chunk-53CE7OVT.js.map +1 -0
- package/dist/{Files-JYXO4AXI.js → chunk-CEBFLP6R.js} +195 -42
- package/dist/chunk-CEBFLP6R.js.map +1 -0
- package/dist/{chunk-VEEO4U4E.js → chunk-K6COBRQA.js} +3 -3
- package/dist/{chunk-VEEO4U4E.js.map → chunk-K6COBRQA.js.map} +1 -1
- package/dist/{chunk-IMHD23FR.js → chunk-OZFHOQYG.js} +3 -3
- package/dist/{chunk-IMHD23FR.js.map → chunk-OZFHOQYG.js.map} +1 -1
- package/dist/index.js +28 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/Files-JYXO4AXI.js.map +0 -1
- package/dist/Preview-SEQ5NHLQ.js +0 -6
- package/dist/chunk-UD2TKHR2.js.map +0 -1
|
@@ -396,6 +396,95 @@ function deactivateAllModals() {
|
|
|
396
396
|
activeListeners.forEach((fn) => fn());
|
|
397
397
|
window.dispatchEvent(new CustomEvent("modal-reorder"));
|
|
398
398
|
}
|
|
399
|
+
var EDGE_THRESHOLD = 8;
|
|
400
|
+
var CORNER_THRESHOLD = 32;
|
|
401
|
+
function workArea() {
|
|
402
|
+
const taskbarH = parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-height")) || 0;
|
|
403
|
+
const taskbarW = parseInt(getComputedStyle(document.documentElement).getPropertyValue("--taskbar-width")) || 0;
|
|
404
|
+
const tbPos = getComputedStyle(document.documentElement).getPropertyValue("--taskbar-position")?.trim() || "bottom";
|
|
405
|
+
const x = tbPos === "left" ? taskbarW : 0;
|
|
406
|
+
const y = tbPos === "top" ? taskbarH : 0;
|
|
407
|
+
const w = window.innerWidth - (tbPos === "left" || tbPos === "right" ? taskbarW : 0);
|
|
408
|
+
const h = window.innerHeight - (tbPos === "top" || tbPos === "bottom" ? taskbarH : 0);
|
|
409
|
+
return { x, y, w, h };
|
|
410
|
+
}
|
|
411
|
+
function calcSnapBox(zone) {
|
|
412
|
+
const a = workArea();
|
|
413
|
+
const halfW = Math.floor(a.w / 2);
|
|
414
|
+
const halfH = Math.floor(a.h / 2);
|
|
415
|
+
switch (zone) {
|
|
416
|
+
case "top":
|
|
417
|
+
return { x: a.x, y: a.y, w: a.w, h: a.h };
|
|
418
|
+
case "left":
|
|
419
|
+
return { x: a.x, y: a.y, w: halfW, h: a.h };
|
|
420
|
+
case "right":
|
|
421
|
+
return { x: a.x + halfW, y: a.y, w: a.w - halfW, h: a.h };
|
|
422
|
+
case "tl":
|
|
423
|
+
return { x: a.x, y: a.y, w: halfW, h: halfH };
|
|
424
|
+
case "tr":
|
|
425
|
+
return { x: a.x + halfW, y: a.y, w: a.w - halfW, h: halfH };
|
|
426
|
+
case "bl":
|
|
427
|
+
return { x: a.x, y: a.y + halfH, w: halfW, h: a.h - halfH };
|
|
428
|
+
case "br":
|
|
429
|
+
return { x: a.x + halfW, y: a.y + halfH, w: a.w - halfW, h: a.h - halfH };
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
function detectSnapZone(clientX, clientY) {
|
|
433
|
+
const a = workArea();
|
|
434
|
+
const nearLeft = clientX <= a.x + EDGE_THRESHOLD;
|
|
435
|
+
const nearRight = clientX >= a.x + a.w - EDGE_THRESHOLD;
|
|
436
|
+
const nearTop = clientY <= a.y + EDGE_THRESHOLD;
|
|
437
|
+
const nearBottom = clientY >= a.y + a.h - EDGE_THRESHOLD;
|
|
438
|
+
const cornerLeft = clientX <= a.x + CORNER_THRESHOLD;
|
|
439
|
+
const cornerRight = clientX >= a.x + a.w - CORNER_THRESHOLD;
|
|
440
|
+
const cornerTop = clientY <= a.y + CORNER_THRESHOLD;
|
|
441
|
+
const cornerBottom = clientY >= a.y + a.h - CORNER_THRESHOLD;
|
|
442
|
+
if (nearTop && cornerLeft) return "tl";
|
|
443
|
+
if (nearTop && cornerRight) return "tr";
|
|
444
|
+
if (nearBottom && cornerLeft) return "bl";
|
|
445
|
+
if (nearBottom && cornerRight) return "br";
|
|
446
|
+
if (cornerTop && nearLeft) return "tl";
|
|
447
|
+
if (cornerTop && nearRight) return "tr";
|
|
448
|
+
if (cornerBottom && nearLeft) return "bl";
|
|
449
|
+
if (cornerBottom && nearRight) return "br";
|
|
450
|
+
if (nearTop) return "top";
|
|
451
|
+
if (nearLeft) return "left";
|
|
452
|
+
if (nearRight) return "right";
|
|
453
|
+
return null;
|
|
454
|
+
}
|
|
455
|
+
var snapPreviewEl = null;
|
|
456
|
+
function getSnapPreviewEl() {
|
|
457
|
+
if (!snapPreviewEl) {
|
|
458
|
+
snapPreviewEl = document.createElement("div");
|
|
459
|
+
snapPreviewEl.style.cssText = [
|
|
460
|
+
"position: fixed",
|
|
461
|
+
"pointer-events: none",
|
|
462
|
+
"z-index: 40",
|
|
463
|
+
"border-radius: 8px",
|
|
464
|
+
"background: rgba(59, 130, 246, 0.18)",
|
|
465
|
+
"border: 2px solid rgb(59, 130, 246)",
|
|
466
|
+
"transition: left 120ms ease, top 120ms ease, width 120ms ease, height 120ms ease, opacity 120ms ease",
|
|
467
|
+
"opacity: 0",
|
|
468
|
+
"display: none"
|
|
469
|
+
].join(";");
|
|
470
|
+
document.body.appendChild(snapPreviewEl);
|
|
471
|
+
}
|
|
472
|
+
return snapPreviewEl;
|
|
473
|
+
}
|
|
474
|
+
function showSnapPreview(box) {
|
|
475
|
+
const el = getSnapPreviewEl();
|
|
476
|
+
el.style.display = "block";
|
|
477
|
+
el.style.left = `${box.x}px`;
|
|
478
|
+
el.style.top = `${box.y}px`;
|
|
479
|
+
el.style.width = `${box.w}px`;
|
|
480
|
+
el.style.height = `${box.h}px`;
|
|
481
|
+
el.style.opacity = "1";
|
|
482
|
+
}
|
|
483
|
+
function hideSnapPreview() {
|
|
484
|
+
if (!snapPreviewEl) return;
|
|
485
|
+
snapPreviewEl.style.opacity = "0";
|
|
486
|
+
snapPreviewEl.style.display = "none";
|
|
487
|
+
}
|
|
399
488
|
window.addEventListener("deactivate-all-modals", deactivateAllModals);
|
|
400
489
|
function getZForModal(id) {
|
|
401
490
|
const idx = activationOrder.indexOf(id);
|
|
@@ -700,6 +789,7 @@ function Modal({ open, onClose, title, icon, copyText, size = "lg", dirty = fals
|
|
|
700
789
|
}
|
|
701
790
|
onClose();
|
|
702
791
|
}, [isDirty, onClose]);
|
|
792
|
+
const preSnapBoxRef = useRef(null);
|
|
703
793
|
const startDrag = useCallback((e) => {
|
|
704
794
|
if (e.button !== 0) return;
|
|
705
795
|
if (e.target.closest("button, input, a, kbd, select, textarea")) return;
|
|
@@ -709,11 +799,30 @@ function Modal({ open, onClose, title, icon, copyText, size = "lg", dirty = fals
|
|
|
709
799
|
const sx = e.clientX, sy = e.clientY;
|
|
710
800
|
const panel = panelRef.current;
|
|
711
801
|
const rect = panel?.getBoundingClientRect();
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
802
|
+
let ox, oy, actualH, actualW;
|
|
803
|
+
if (preSnapBoxRef.current) {
|
|
804
|
+
const restore = preSnapBoxRef.current;
|
|
805
|
+
preSnapBoxRef.current = null;
|
|
806
|
+
actualW = restore.w;
|
|
807
|
+
actualH = restore.h;
|
|
808
|
+
const offsetX = rect ? Math.min(Math.max(20, e.clientX - rect.left), restore.w - 20) : restore.w / 2;
|
|
809
|
+
ox = e.clientX - offsetX;
|
|
810
|
+
oy = e.clientY - 12;
|
|
811
|
+
if (panel) {
|
|
812
|
+
panel.style.width = `${actualW}px`;
|
|
813
|
+
panel.style.height = `${actualH}px`;
|
|
814
|
+
panel.style.left = `${ox}px`;
|
|
815
|
+
panel.style.top = `${oy}px`;
|
|
816
|
+
}
|
|
817
|
+
} else {
|
|
818
|
+
ox = rect ? rect.left : boxRef.current.x;
|
|
819
|
+
oy = rect ? rect.top : boxRef.current.y;
|
|
820
|
+
actualH = rect ? rect.height : boxRef.current.h;
|
|
821
|
+
actualW = rect ? rect.width : boxRef.current.w;
|
|
822
|
+
}
|
|
715
823
|
setMaximized(false);
|
|
716
|
-
setBox((b) => ({ ...b, x: ox, y: oy, h: actualH }));
|
|
824
|
+
setBox((b) => ({ ...b, x: ox, y: oy, w: actualW, h: actualH }));
|
|
825
|
+
let currentZone = null;
|
|
717
826
|
const move = (ev) => {
|
|
718
827
|
const nx = ox + ev.clientX - sx;
|
|
719
828
|
const ny = Math.max(0, oy + ev.clientY - sy);
|
|
@@ -722,11 +831,25 @@ function Modal({ open, onClose, title, icon, copyText, size = "lg", dirty = fals
|
|
|
722
831
|
panel.style.top = `${ny}px`;
|
|
723
832
|
}
|
|
724
833
|
boxRef.current = { ...boxRef.current, x: nx, y: ny };
|
|
834
|
+
if (!widget) {
|
|
835
|
+
const zone = detectSnapZone(ev.clientX, ev.clientY);
|
|
836
|
+
if (zone !== currentZone) {
|
|
837
|
+
currentZone = zone;
|
|
838
|
+
if (zone) showSnapPreview(calcSnapBox(zone));
|
|
839
|
+
else hideSnapPreview();
|
|
840
|
+
}
|
|
841
|
+
}
|
|
725
842
|
};
|
|
726
843
|
const up = () => {
|
|
727
844
|
window.removeEventListener("pointermove", move);
|
|
728
845
|
window.removeEventListener("pointerup", up);
|
|
846
|
+
hideSnapPreview();
|
|
729
847
|
const finalBox = { ...boxRef.current };
|
|
848
|
+
if (!widget && currentZone) {
|
|
849
|
+
preSnapBoxRef.current = { x: ox, y: oy, w: actualW, h: actualH };
|
|
850
|
+
setBox(calcSnapBox(currentZone));
|
|
851
|
+
return;
|
|
852
|
+
}
|
|
730
853
|
if (widget) {
|
|
731
854
|
const centerX = finalBox.x + finalBox.w / 2;
|
|
732
855
|
const mid = window.innerWidth / 2;
|
|
@@ -1723,5 +1846,5 @@ function WindowManagerProvider({ children }) {
|
|
|
1723
1846
|
}
|
|
1724
1847
|
|
|
1725
1848
|
export { CancelButton, CopyButton, DocFavStar, GLASS_DIVIDER, GLASS_INPUT_BG, Modal, ModalActions, PopupMenu, PopupMenuDivider, PopupMenuItem, PopupMenuLabel, WindowManagerProvider, WindowTitle, client_default, getActiveModalId, glassStyle, isEntityEntry, isPageEntry, isSection, navIcons, navSections, sectionIcons, setShellApiClient, setShellNavIcons, setShellWindowRegistry, startMenuCategories, useModalActive, useWidgetSettings, useWindowManager, useWindowMenuItem, useWindowTitle };
|
|
1726
|
-
//# sourceMappingURL=chunk-
|
|
1727
|
-
//# sourceMappingURL=chunk-
|
|
1849
|
+
//# sourceMappingURL=chunk-53CE7OVT.js.map
|
|
1850
|
+
//# sourceMappingURL=chunk-53CE7OVT.js.map
|