react-os-shell 0.1.50 → 0.1.52

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 CHANGED
@@ -651,7 +651,7 @@ function StatusBadge({ status }) {
651
651
  }
652
652
 
653
653
  // src/version.ts
654
- var VERSION = "0.1.50" ;
654
+ var VERSION = "0.1.51" ;
655
655
  var APP_VERSION = VERSION;
656
656
 
657
657
  // src/changelog.ts
@@ -1499,28 +1499,80 @@ function Desktop({ profile }) {
1499
1499
  setContextMenu(null);
1500
1500
  },
1501
1501
  children: [
1502
- /* @__PURE__ */ jsx(
1503
- "div",
1504
- {
1505
- "data-desktop-icon": "trash",
1506
- style: { position: "absolute", right: 20, bottom: 20, zIndex: 1 },
1507
- onPointerDown: (e) => e.stopPropagation(),
1508
- onClick: (e) => e.stopPropagation(),
1509
- onContextMenu: (e) => e.preventDefault(),
1510
- onDoubleClick: (e) => {
1511
- e.stopPropagation();
1512
- window.__REACT_OS_SHELL_FILES_VIEW__ = "trash";
1513
- window.dispatchEvent(new CustomEvent("react-os-shell:files-show-trash"));
1514
- openPage("/files");
1515
- },
1516
- className: "cursor-default select-none",
1517
- title: "Trash \u2014 double-click to open",
1518
- children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1 w-20 p-2", children: [
1519
- /* @__PURE__ */ jsx("div", { className: "w-12 h-12 flex items-center justify-center", children: /* @__PURE__ */ jsx("svg", { className: "h-12 w-12 drop-shadow-[0_2px_3px_rgba(0,0,0,0.4)] text-gray-100", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", strokeWidth: 1.5, children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" }) }) }),
1520
- /* @__PURE__ */ jsx("span", { className: "text-[10px] font-medium text-center leading-tight text-white drop-shadow-[0_1px_2px_rgba(0,0,0,0.8)]", children: "Trash" })
1521
- ] })
1522
- }
1523
- ),
1502
+ (() => {
1503
+ const cs = typeof document !== "undefined" ? getComputedStyle(document.documentElement) : null;
1504
+ const tbH = parseInt(cs?.getPropertyValue("--taskbar-height") || "0") || 0;
1505
+ const tbW = parseInt(cs?.getPropertyValue("--taskbar-width") || "0") || 0;
1506
+ const tbPos = (cs?.getPropertyValue("--taskbar-position") || "bottom").trim();
1507
+ const defaultRight = 20 + (tbPos === "right" ? tbW : 0);
1508
+ const defaultBottom = 20 + (tbPos === "bottom" ? tbH : 0);
1509
+ const trashPos = prefs.desktop_trash_position;
1510
+ const right = trashPos?.right ?? defaultRight;
1511
+ const bottom = trashPos?.bottom ?? defaultBottom;
1512
+ const startTrashDrag = (e) => {
1513
+ if (e.button !== 0) return;
1514
+ e.preventDefault();
1515
+ e.stopPropagation();
1516
+ const el = e.currentTarget;
1517
+ const startX = e.clientX, startY = e.clientY;
1518
+ let moved = false;
1519
+ const move = (ev) => {
1520
+ const dx = ev.clientX - startX;
1521
+ const dy = ev.clientY - startY;
1522
+ if (!moved && (Math.abs(dx) > 3 || Math.abs(dy) > 3)) moved = true;
1523
+ if (!moved) return;
1524
+ el.style.right = `${right - dx}px`;
1525
+ el.style.bottom = `${bottom - dy}px`;
1526
+ el.style.opacity = "0.7";
1527
+ el.style.zIndex = "100";
1528
+ };
1529
+ const up = (ev) => {
1530
+ window.removeEventListener("pointermove", move);
1531
+ window.removeEventListener("pointerup", up);
1532
+ el.style.opacity = "";
1533
+ el.style.zIndex = "";
1534
+ if (!moved) return;
1535
+ const newRight = Math.max(0, right - (ev.clientX - startX));
1536
+ const newBottom = Math.max(0, bottom - (ev.clientY - startY));
1537
+ saveShellPrefs({ desktop_trash_position: { right: newRight, bottom: newBottom } });
1538
+ };
1539
+ window.addEventListener("pointermove", move);
1540
+ window.addEventListener("pointerup", up);
1541
+ };
1542
+ return /* @__PURE__ */ jsx(
1543
+ "div",
1544
+ {
1545
+ "data-desktop-icon": "trash",
1546
+ style: { position: "absolute", right, bottom, zIndex: 1 },
1547
+ onPointerDown: startTrashDrag,
1548
+ onClick: (e) => e.stopPropagation(),
1549
+ onContextMenu: (e) => e.preventDefault(),
1550
+ onDoubleClick: (e) => {
1551
+ e.stopPropagation();
1552
+ window.__REACT_OS_SHELL_FILES_VIEW__ = "trash";
1553
+ window.dispatchEvent(new CustomEvent("react-os-shell:files-show-trash"));
1554
+ openPage("/files");
1555
+ },
1556
+ className: "cursor-default select-none",
1557
+ title: "Trash \u2014 double-click to open, drag to move",
1558
+ children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1 w-20 p-2", children: [
1559
+ /* @__PURE__ */ jsx("div", { className: "w-12 h-12 flex items-center justify-center", children: /* @__PURE__ */ jsx("svg", { className: "h-12 w-12 drop-shadow-[0_2px_3px_rgba(0,0,0,0.4)]", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx(
1560
+ "path",
1561
+ {
1562
+ fill: "#c0c4cc",
1563
+ stroke: "#5f6677",
1564
+ strokeWidth: "0.6",
1565
+ strokeLinejoin: "round",
1566
+ fillRule: "evenodd",
1567
+ clipRule: "evenodd",
1568
+ d: "M16.5 4.478v.227a48.816 48.816 0 013.878.512.75.75 0 11-.256 1.478l-.209-.035-1.005 13.07a3 3 0 01-2.991 2.77H8.084a3 3 0 01-2.991-2.77L4.087 6.66l-.209.035a.75.75 0 01-.256-1.478A48.567 48.567 0 017.5 4.705v-.227c0-1.564 1.213-2.9 2.816-2.951a52.662 52.662 0 014.368 0c1.603.051 2.816 1.387 2.816 2.951zm-6.136-1.452a51.196 51.196 0 013.273 0C14.39 3.05 15 3.684 15 4.478v.113a49.488 49.488 0 00-6 0v-.113c0-.794.609-1.428 1.364-1.452zm-.355 5.945a.75.75 0 10-1.5.058l.347 9a.75.75 0 101.499-.058l-.346-9zm5.48.058a.75.75 0 10-1.498-.058l-.347 9a.75.75 0 001.5.058l.346-9z"
1569
+ }
1570
+ ) }) }),
1571
+ /* @__PURE__ */ jsx("span", { className: "text-[10px] font-medium text-center leading-tight text-white drop-shadow-[0_1px_2px_rgba(0,0,0,0.8)]", children: "Trash" })
1572
+ ] })
1573
+ }
1574
+ );
1575
+ })(),
1524
1576
  desktopItems.map((doc, i) => {
1525
1577
  const docIdx = favDocs.indexOf(doc);
1526
1578
  const pos = localPositions[`item-${docIdx}`] || getItemPos(doc, i);