react-os-shell 0.12.2 → 0.13.1

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
@@ -1481,7 +1481,7 @@ function WidgetManager({ open, onClose }) {
1481
1481
  }
1482
1482
 
1483
1483
  // src/version.ts
1484
- var VERSION = "0.12.2" ;
1484
+ var VERSION = "0.13.1" ;
1485
1485
  var APP_VERSION = VERSION;
1486
1486
 
1487
1487
  // src/changelog.ts
@@ -6375,6 +6375,46 @@ function Kanban({
6375
6375
  setDragId(null);
6376
6376
  setOver(null);
6377
6377
  };
6378
+ const boardRef = useRef(null);
6379
+ const prevRects = useRef(/* @__PURE__ */ new Map());
6380
+ useLayoutEffect(() => {
6381
+ if (dragId !== null) return;
6382
+ const board = boardRef.current;
6383
+ if (!board) return;
6384
+ const next = /* @__PURE__ */ new Map();
6385
+ const moved = [];
6386
+ board.querySelectorAll("[data-kanban-card]").forEach((el) => {
6387
+ const id = el.dataset.kanbanCard;
6388
+ const rect = el.getBoundingClientRect();
6389
+ next.set(id, rect);
6390
+ const prev = prevRects.current.get(id);
6391
+ if (prev) {
6392
+ const dx = prev.left - rect.left;
6393
+ const dy = prev.top - rect.top;
6394
+ if (dx || dy) moved.push([el, dx, dy]);
6395
+ }
6396
+ });
6397
+ prevRects.current = next;
6398
+ if (!moved.length) return;
6399
+ for (const [el, dx, dy] of moved) {
6400
+ el.style.transition = "none";
6401
+ el.style.transform = `translate(${dx}px, ${dy}px)`;
6402
+ }
6403
+ requestAnimationFrame(() => {
6404
+ for (const [el] of moved) {
6405
+ el.style.transition = "transform 200ms cubic-bezier(0.2, 0, 0, 1)";
6406
+ el.style.transform = "";
6407
+ el.addEventListener(
6408
+ "transitionend",
6409
+ () => {
6410
+ el.style.transition = "";
6411
+ el.style.transform = "";
6412
+ },
6413
+ { once: true }
6414
+ );
6415
+ }
6416
+ });
6417
+ }, [grouped, dragId]);
6378
6418
  const commitMove = (col) => {
6379
6419
  if (dragId && over && over.col === col) {
6380
6420
  const colItems = grouped[col] ?? [];
@@ -6392,7 +6432,7 @@ function Kanban({
6392
6432
  if (items.length === 0) {
6393
6433
  return /* @__PURE__ */ jsx(Fragment, { children: emptyState ?? /* @__PURE__ */ jsx("div", { className: "text-sm text-gray-500 p-4", children: "No items." }) });
6394
6434
  }
6395
- return /* @__PURE__ */ jsx("div", { className: "flex-1 overflow-x-auto grid-scroll", children: /* @__PURE__ */ jsx("div", { className: "flex gap-3 h-full min-w-max pb-2", children: columns.map((col) => {
6435
+ return /* @__PURE__ */ jsx("div", { ref: boardRef, className: "flex-1 overflow-x-auto grid-scroll", children: /* @__PURE__ */ jsx("div", { className: "flex gap-3 h-full min-w-max pb-2", children: columns.map((col) => {
6396
6436
  const colItems = grouped[col.value] ?? [];
6397
6437
  const isOver = over !== null && over.col === col.value;
6398
6438
  const dp = dragId !== null ? colItems.findIndex((it) => getId(it) === dragId) : -1;
@@ -6401,8 +6441,17 @@ function Kanban({
6401
6441
  "div",
6402
6442
  {
6403
6443
  className: `flex flex-col w-72 shrink-0 rounded-xl bg-gray-50 border transition-colors ${isOver ? "border-blue-400 ring-2 ring-blue-300/60" : "border-gray-200"}`,
6404
- onDragOver: (e) => e.preventDefault(),
6405
- onDrop: () => commitMove(col.value),
6444
+ onDragOver: (e) => {
6445
+ e.preventDefault();
6446
+ try {
6447
+ e.dataTransfer.dropEffect = "move";
6448
+ } catch {
6449
+ }
6450
+ },
6451
+ onDrop: (e) => {
6452
+ e.preventDefault();
6453
+ commitMove(col.value);
6454
+ },
6406
6455
  children: [
6407
6456
  /* @__PURE__ */ jsxs(
6408
6457
  "div",
@@ -6433,6 +6482,7 @@ function Kanban({
6433
6482
  /* @__PURE__ */ jsx(
6434
6483
  "div",
6435
6484
  {
6485
+ "data-kanban-card": id,
6436
6486
  draggable: true,
6437
6487
  onDragStart: (e) => {
6438
6488
  setDragId(id);