@floegence/floe-webapp-core 0.101.30 → 0.101.33

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.
@@ -1,32 +1,32 @@
1
- import { insert as s, createComponent as c, memo as I, effect as k, className as A, setAttribute as v, template as y, use as L, Dynamic as T, setStyleProperty as w, delegateEvents as N } from "solid-js/web";
2
- import { createMemo as b, For as j, Show as M, onMount as X, onCleanup as Y } from "solid-js";
1
+ import { insert as g, createComponent as u, memo as I, effect as k, className as A, setAttribute as s, template as y, use as L, Dynamic as T, setStyleProperty as w, delegateEvents as N } from "solid-js/web";
2
+ import { createMemo as m, For as j, untrack as X, Show as M, onMount as Y, onCleanup as F } from "solid-js";
3
3
  import { cn as h } from "../../utils/cn.js";
4
- import { deferNonBlocking as F } from "../../utils/defer.js";
5
- import { Tooltip as H } from "../ui/Tooltip.js";
6
- import { createBarReorder as U, createBarLayoutMotion as V } from "./barReorder.js";
7
- import { resolveActivityBarClick as z } from "./activityBarBehavior.js";
8
- import { isBarItemContextMenuKey as G, keyboardBarItemContextMenuRequest as J } from "./barItemContextMenu.js";
9
- var O = /* @__PURE__ */ y('<div class="flex flex-col">'), Q = /* @__PURE__ */ y('<nav data-floe-shell-slot=activity-bar style=border-right-color:var(--activity-bar-border)><div class="flex flex-col min-h-0 overflow-y-auto overflow-x-hidden">'), W = /* @__PURE__ */ y("<span aria-hidden=true style=position:absolute;left:6px;right:6px;height:2px;background:var(--ring);border-radius:2px>"), Z = /* @__PURE__ */ y("<span>"), _ = /* @__PURE__ */ y("<button type=button data-floe-interactive=press><span aria-hidden=true>");
10
- function le(t) {
11
- let u;
12
- const d = /* @__PURE__ */ new Map(), g = b(() => new Map(t.items.map((i) => [i.id, i]))), l = U({
4
+ import { deferNonBlocking as H } from "../../utils/defer.js";
5
+ import { Tooltip as U } from "../ui/Tooltip.js";
6
+ import { createBarReorder as V, createBarLayoutMotion as z } from "./barReorder.js";
7
+ import { resolveActivityBarClick as G } from "./activityBarBehavior.js";
8
+ import { isBarItemContextMenuKey as J, keyboardBarItemContextMenuRequest as O } from "./barItemContextMenu.js";
9
+ var Q = /* @__PURE__ */ y('<div class="flex flex-col">'), W = /* @__PURE__ */ y('<nav data-floe-shell-slot=activity-bar style=border-right-color:var(--activity-bar-border)><div class="flex flex-col min-h-0 overflow-y-auto overflow-x-hidden">'), Z = /* @__PURE__ */ y("<span aria-hidden=true style=position:absolute;left:6px;right:6px;height:2px;background:var(--ring);border-radius:2px>"), _ = /* @__PURE__ */ y("<span>"), p = /* @__PURE__ */ y("<button type=button data-floe-interactive=press><span aria-hidden=true>");
10
+ function de(t) {
11
+ let v;
12
+ const c = /* @__PURE__ */ new Map(), b = m(() => new Map(t.items.map((i) => [i.id, i]))), d = V({
13
13
  keys: () => t.items.filter((i) => i.reorderable !== !1).map((i) => i.id),
14
- elements: d,
15
- container: () => u,
14
+ elements: c,
15
+ container: () => v,
16
16
  onReorder: () => t.onReorder
17
17
  });
18
- V({
18
+ z({
19
19
  keys: () => t.items.map((i) => i.id),
20
- elements: d,
21
- preview: () => l.position()?.order,
20
+ elements: c,
21
+ preview: () => d.position()?.order,
22
22
  axis: "y"
23
23
  });
24
- const f = b(() => t.activeId), B = b(() => t.collapsed ?? !1), x = b(() => t.onActiveChange), r = b(() => t.onCollapsedChange), C = (i) => {
24
+ const f = m(() => t.activeId), B = m(() => t.collapsed ?? !1), x = m(() => t.onActiveChange), r = m(() => t.onCollapsedChange), C = (i) => {
25
25
  if (i.onClick) {
26
- F(() => i.onClick());
26
+ H(() => i.onClick());
27
27
  return;
28
28
  }
29
- const e = z({
29
+ const e = G({
30
30
  clickedId: i.id,
31
31
  activeId: f(),
32
32
  collapsed: B(),
@@ -37,47 +37,50 @@ function le(t) {
37
37
  }) : x()(e.nextActiveId)), typeof e.nextCollapsed == "boolean" && r()?.(e.nextCollapsed);
38
38
  };
39
39
  return (() => {
40
- var i = Q(), e = i.firstChild, a = u;
41
- return typeof a == "function" ? L(a, e) : u = e, s(e, c(j, {
40
+ var i = W(), e = i.firstChild, l = v;
41
+ return typeof l == "function" ? L(l, e) : v = e, g(e, u(j, {
42
42
  get each() {
43
43
  return t.items.map((n) => n.id);
44
44
  },
45
- children: (n) => c(q, {
46
- get item() {
47
- return g().get(n);
48
- },
49
- get isActive() {
50
- return f() === n;
51
- },
52
- onClick: () => {
53
- l.consumeClick() || C(g().get(n));
54
- },
55
- elementRef: (o) => {
56
- o ? d.set(n, o) : d.delete(n);
57
- },
58
- onPointerDown: (o) => l.begin(n, o),
59
- onReorderKey: (o) => l.keyDown(n, o),
60
- get reorderable() {
61
- return I(() => !!t.onReorder)() && g().get(n)?.reorderable !== !1;
62
- },
63
- get dragging() {
64
- return l.dragging() === n;
65
- },
66
- get dropEdge() {
67
- return I(() => l.position()?.key === n)() ? l.position()?.edge : void 0;
68
- }
69
- })
70
- })), s(i, c(M, {
45
+ children: (n) => {
46
+ const o = m((a) => b().get(n) ?? a, X(() => b().get(n)));
47
+ return u(q, {
48
+ get item() {
49
+ return o();
50
+ },
51
+ get isActive() {
52
+ return f() === n;
53
+ },
54
+ onClick: () => {
55
+ d.consumeClick() || C(o());
56
+ },
57
+ elementRef: (a) => {
58
+ a ? c.set(n, a) : c.delete(n);
59
+ },
60
+ onPointerDown: (a) => d.begin(n, a),
61
+ onReorderKey: (a) => d.keyDown(n, a),
62
+ get reorderable() {
63
+ return I(() => !!t.onReorder)() && o().reorderable !== !1;
64
+ },
65
+ get dragging() {
66
+ return d.dragging() === n;
67
+ },
68
+ get dropEdge() {
69
+ return I(() => d.position()?.key === n)() ? d.position()?.edge : void 0;
70
+ }
71
+ });
72
+ }
73
+ })), g(i, u(M, {
71
74
  get when() {
72
75
  return t.bottomItems?.length;
73
76
  },
74
77
  get children() {
75
- var n = O();
76
- return s(n, c(j, {
78
+ var n = Q();
79
+ return g(n, u(j, {
77
80
  get each() {
78
81
  return t.bottomItems;
79
82
  },
80
- children: (o) => c(q, {
83
+ children: (o) => u(q, {
81
84
  item: o,
82
85
  get isActive() {
83
86
  return f() === o.id;
@@ -87,8 +90,8 @@ function le(t) {
87
90
  })), n;
88
91
  }
89
92
  }), null), k((n) => {
90
- var o = h("w-10 md:w-12 flex flex-col justify-between shrink-0 min-h-0", "bg-activity-bar border-r border-[var(--floe-line-quiet)]", t.class), m = t.ariaLabel;
91
- return o !== n.e && A(i, n.e = o), m !== n.t && v(i, "aria-label", n.t = m), n;
93
+ var o = h("w-10 md:w-12 flex flex-col justify-between shrink-0 min-h-0", "bg-activity-bar border-r border-[var(--floe-line-quiet)]", t.class), a = t.ariaLabel;
94
+ return o !== n.e && A(i, n.e = o), a !== n.t && s(i, "aria-label", n.t = a), n;
92
95
  }, {
93
96
  e: void 0,
94
97
  t: void 0
@@ -96,15 +99,15 @@ function le(t) {
96
99
  })();
97
100
  }
98
101
  function q(t) {
99
- let u;
100
- const d = () => typeof t.item.badge == "function" ? t.item.badge() : t.item.badge, g = () => typeof t.item.ariaExpanded == "function" ? t.item.ariaExpanded() : t.item.ariaExpanded, l = () => t.isActive || g() === !0;
102
+ let v;
103
+ const c = () => typeof t.item.badge == "function" ? t.item.badge() : t.item.badge, b = () => typeof t.item.ariaExpanded == "function" ? t.item.ariaExpanded() : t.item.ariaExpanded, d = () => t.isActive || b() === !0;
101
104
  let f;
102
- X(() => {
105
+ Y(() => {
103
106
  const r = t.item.buttonRef;
104
- r?.(u ?? null), t.elementRef?.(u ?? null), f = () => {
107
+ r?.(v ?? null), t.elementRef?.(v ?? null), f = () => {
105
108
  r?.(null), t.elementRef?.(null);
106
109
  };
107
- }), Y(() => f?.());
110
+ }), F(() => f?.());
108
111
  const B = (r) => {
109
112
  t.item.onContextMenu && (r.preventDefault(), r.stopPropagation(), t.item.onContextMenu({
110
113
  trigger: r.currentTarget,
@@ -113,56 +116,58 @@ function q(t) {
113
116
  source: "pointer"
114
117
  }));
115
118
  }, x = (r) => {
116
- t.onReorderKey?.(r), !(r.defaultPrevented || !t.item.onContextMenu || !G(r)) && (r.preventDefault(), r.stopPropagation(), t.item.onContextMenu(J(r.currentTarget)));
119
+ t.onReorderKey?.(r), !(r.defaultPrevented || !t.item.onContextMenu || !J(r)) && (r.preventDefault(), r.stopPropagation(), t.item.onContextMenu(O(r.currentTarget)));
117
120
  };
118
- return c(H, {
121
+ return u(U, {
119
122
  get content() {
120
123
  return t.item.label;
121
124
  },
122
125
  placement: "right",
123
126
  delay: 0,
127
+ triggerClass: "shrink-0",
128
+ portalScope: "viewport",
124
129
  get children() {
125
- var r = _(), C = r.firstChild;
130
+ var r = p(), C = r.firstChild;
126
131
  r.$$keydown = x, r.$$contextmenu = B, r.$$click = () => t.onClick(), r.addEventListener("dragstart", (e) => e.preventDefault()), r.$$pointerdown = (e) => t.onPointerDown?.(e);
127
- var i = u;
128
- return typeof i == "function" ? L(i, r) : u = r, s(r, c(T, {
132
+ var i = v;
133
+ return typeof i == "function" ? L(i, r) : v = r, g(r, u(T, {
129
134
  get component() {
130
135
  return t.item.icon;
131
136
  },
132
137
  get active() {
133
- return l();
138
+ return d();
134
139
  },
135
140
  get class() {
136
- return h("relative w-5 h-5 transition-colors duration-[var(--floe-duration-fast)] ease-[var(--floe-ease-out)]", l() ? "text-activity-bar-foreground-active" : "group-hover/activity-item:text-activity-bar-foreground-active");
141
+ return h("relative w-5 h-5 transition-colors duration-[var(--floe-duration-fast)] ease-[var(--floe-ease-out)]", d() ? "text-activity-bar-foreground-active" : "group-hover/activity-item:text-activity-bar-foreground-active");
137
142
  }
138
- }), null), s(r, c(M, {
143
+ }), null), g(r, u(M, {
139
144
  get when() {
140
145
  return t.dropEdge;
141
146
  },
142
147
  get children() {
143
- var e = W();
144
- return k((a) => {
148
+ var e = Z();
149
+ return k((l) => {
145
150
  var n = t.dropEdge === "before" ? "0" : void 0, o = t.dropEdge === "after" ? "0" : void 0;
146
- return n !== a.e && w(e, "top", a.e = n), o !== a.t && w(e, "bottom", a.t = o), a;
151
+ return n !== l.e && w(e, "top", l.e = n), o !== l.t && w(e, "bottom", l.t = o), l;
147
152
  }, {
148
153
  e: void 0,
149
154
  t: void 0
150
155
  }), e;
151
156
  }
152
- }), null), s(r, c(M, {
157
+ }), null), g(r, u(M, {
153
158
  get when() {
154
- return d();
159
+ return c();
155
160
  },
156
161
  get children() {
157
- var e = Z();
158
- return s(e, (() => {
159
- var a = I(() => typeof d() == "number" && d() > 99);
160
- return () => a() ? "99+" : d();
162
+ var e = _();
163
+ return g(e, (() => {
164
+ var l = I(() => typeof c() == "number" && c() > 99);
165
+ return () => l() ? "99+" : c();
161
166
  })()), k(() => A(e, h("absolute top-0.5 right-0.5 min-w-3.5 h-3.5 px-1", "flex items-center justify-center", "text-[length:var(--floe-type-caption)] font-medium rounded-full", "bg-activity-bar-badge text-activity-bar-badge-foreground"))), e;
162
167
  }
163
168
  }), null), k((e) => {
164
- var a = t.item.id, n = t.reorderable ? "Alt+Shift+ArrowUp Alt+Shift+ArrowDown" : void 0, o = t.reorderable ? "none" : void 0, m = t.dragging ? 0.5 : void 0, R = h("group/activity-item relative w-full shrink-0 aspect-square flex items-center justify-center cursor-pointer", "focus:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-inset", "text-activity-bar-foreground", l() && "text-activity-bar-foreground-active"), D = t.item.label, E = t.isActive, $ = g(), P = t.item.ariaControls, S = t.item.ariaHasPopup ?? (t.item.onContextMenu ? "menu" : void 0), K = h("absolute inset-1 rounded-md", "transition-colors duration-[var(--floe-duration-fast)] ease-[var(--floe-ease-out)]", l() ? "bg-[var(--floe-state-selected)]" : "bg-transparent group-hover/activity-item:bg-[var(--floe-state-hover)]");
165
- return a !== e.e && v(r, "data-floe-bar-key", e.e = a), n !== e.t && v(r, "aria-keyshortcuts", e.t = n), o !== e.a && w(r, "touch-action", e.a = o), m !== e.o && w(r, "opacity", e.o = m), R !== e.i && A(r, e.i = R), D !== e.n && v(r, "aria-label", e.n = D), E !== e.s && v(r, "aria-pressed", e.s = E), $ !== e.h && v(r, "aria-expanded", e.h = $), P !== e.r && v(r, "aria-controls", e.r = P), S !== e.d && v(r, "aria-haspopup", e.d = S), K !== e.l && A(C, e.l = K), e;
169
+ var l = t.item.id, n = t.reorderable ? "Alt+Shift+ArrowUp Alt+Shift+ArrowDown" : void 0, o = t.reorderable ? "none" : void 0, a = t.dragging ? 0.5 : void 0, R = h("group/activity-item relative w-full shrink-0 aspect-square flex items-center justify-center cursor-pointer", "focus:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-inset", "text-activity-bar-foreground", d() && "text-activity-bar-foreground-active"), D = t.item.label, E = t.isActive, S = b(), $ = t.item.ariaControls, P = t.item.ariaHasPopup ?? (t.item.onContextMenu ? "menu" : void 0), K = h("absolute inset-1 rounded-md", "transition-colors duration-[var(--floe-duration-fast)] ease-[var(--floe-ease-out)]", d() ? "bg-[var(--floe-state-selected)]" : "bg-transparent group-hover/activity-item:bg-[var(--floe-state-hover)]");
170
+ return l !== e.e && s(r, "data-floe-bar-key", e.e = l), n !== e.t && s(r, "aria-keyshortcuts", e.t = n), o !== e.a && w(r, "touch-action", e.a = o), a !== e.o && w(r, "opacity", e.o = a), R !== e.i && A(r, e.i = R), D !== e.n && s(r, "aria-label", e.n = D), E !== e.s && s(r, "aria-pressed", e.s = E), S !== e.h && s(r, "aria-expanded", e.h = S), $ !== e.r && s(r, "aria-controls", e.r = $), P !== e.d && s(r, "aria-haspopup", e.d = P), K !== e.l && A(C, e.l = K), e;
166
171
  }, {
167
172
  e: void 0,
168
173
  t: void 0,
@@ -181,5 +186,5 @@ function q(t) {
181
186
  }
182
187
  N(["pointerdown", "click", "contextmenu", "keydown"]);
183
188
  export {
184
- le as ActivityBar
189
+ de as ActivityBar
185
190
  };
@@ -1,114 +1,132 @@
1
- import { createSignal as w, createEffect as b, onCleanup as D } from "solid-js";
2
- import { startPointerSession as k } from "../ui/pointerSession.js";
3
- function C(n, d, o, p, l) {
4
- const r = n.filter((e) => e !== d && o.has(e));
5
- if (!n.includes(d) || !r.length) return;
6
- let s = r.findIndex((e) => {
7
- const f = o.get(e), t = f.getBoundingClientRect(), i = getComputedStyle(f).transform, c = typeof DOMMatrix == "function" ? new DOMMatrix(i === "none" ? void 0 : i) : void 0;
8
- return l < (p === "x" ? t.left - (c?.m41 ?? 0) + t.width / 2 : t.top - (c?.m42 ?? 0) + t.height / 2);
1
+ import { createSignal as D, createEffect as R, onCleanup as v } from "solid-js";
2
+ import { startPointerSession as T } from "../ui/pointerSession.js";
3
+ function A(n, m, i, y, h) {
4
+ const t = n.filter((p) => p !== m && i.has(p));
5
+ if (!n.includes(m) || !t.length) return;
6
+ let a = t.findIndex((p) => {
7
+ const x = i.get(p), e = x.getBoundingClientRect(), o = getComputedStyle(x).transform, r = typeof DOMMatrix == "function" ? new DOMMatrix(o === "none" ? void 0 : o) : void 0;
8
+ return h < (y === "x" ? e.left - (r?.m41 ?? 0) + e.width / 2 : e.top - (r?.m42 ?? 0) + e.height / 2);
9
9
  });
10
- s < 0 && (s = r.length);
11
- const a = [...r];
12
- return a.splice(s, 0, d), { key: r[Math.min(s, r.length - 1)], edge: s === r.length ? "after" : "before", order: a };
10
+ a < 0 && (a = t.length);
11
+ const u = [...t];
12
+ return u.splice(a, 0, m), { key: t[Math.min(a, t.length - 1)], edge: a === t.length ? "after" : "before", order: u };
13
13
  }
14
- function R(n, d, o, p) {
15
- if (!o.altKey || !o.shiftKey || o.ctrlKey || o.metaKey || o.isComposing) return;
16
- const l = o.key === (p === "x" ? "ArrowLeft" : "ArrowUp") ? -1 : o.key === (p === "x" ? "ArrowRight" : "ArrowDown") ? 1 : 0, r = n.indexOf(d);
17
- if (!l || r < 0) return;
18
- o.preventDefault(), o.stopPropagation();
19
- const s = Math.max(0, Math.min(n.length - 1, r + l));
20
- if (r === s) return;
21
- const a = [...n];
22
- return a.splice(r, 1), a.splice(s, 0, d), a;
14
+ function B(n, m, i, y) {
15
+ if (!i.altKey || !i.shiftKey || i.ctrlKey || i.metaKey || i.isComposing) return;
16
+ const h = i.key === (y === "x" ? "ArrowLeft" : "ArrowUp") ? -1 : i.key === (y === "x" ? "ArrowRight" : "ArrowDown") ? 1 : 0, t = n.indexOf(m);
17
+ if (!h || t < 0) return;
18
+ i.preventDefault(), i.stopPropagation();
19
+ const a = Math.max(0, Math.min(n.length - 1, t + h));
20
+ if (t === a) return;
21
+ const u = [...n];
22
+ return u.splice(t, 1), u.splice(a, 0, m), u;
23
23
  }
24
- function O(n) {
25
- const [d, o] = w(), [p, l] = w();
26
- let r, s = !1, a;
27
- const e = (t) => {
28
- t.key !== "Escape" || !r || (t.preventDefault(), t.stopPropagation(), r.stop({ commit: !1 }));
24
+ function Y(n) {
25
+ const [m, i] = D(), [y, h] = D();
26
+ let t, a = !1, u = 0, p;
27
+ const x = (o) => {
28
+ o.key !== "Escape" || !t || (o.preventDefault(), o.stopPropagation(), t.stop({ commit: !1 }));
29
29
  };
30
- b(() => {
31
- n.keys(), n.onReorder(), r?.stop({ commit: !1 });
32
- }), D(() => {
33
- r?.stop({ commit: !1 }), a && clearTimeout(a);
30
+ R(() => {
31
+ n.keys(), n.onReorder(), t?.stop({ commit: !1 });
32
+ }), v(() => {
33
+ t?.stop({ commit: !1 }), p && clearTimeout(p);
34
34
  });
35
- const f = (t, i) => {
36
- n.onReorder()?.(i), n.elements.get(t)?.focus({ preventScroll: !0 });
35
+ const e = (o, r) => {
36
+ n.onReorder()?.(r), n.elements.get(o)?.focus({ preventScroll: !0 });
37
37
  };
38
38
  return {
39
- dragging: d,
40
- position: p,
41
- keyDown(t, i) {
39
+ dragging: m,
40
+ position: y,
41
+ keyDown(o, r) {
42
42
  if (!n.onReorder()) return;
43
- const c = R(n.keys(), t, i, "y");
44
- c && f(t, c);
43
+ const l = B(n.keys(), o, r, "y");
44
+ l && e(o, l);
45
45
  },
46
46
  consumeClick() {
47
- return s ? (s = !1, !0) : !1;
47
+ return a ? (a = !1, !0) : !1;
48
48
  },
49
- begin(t, i) {
50
- if (i.button !== 0 || !n.onReorder() || !n.keys().includes(t)) return;
51
- r?.stop({ commit: !1 });
52
- const c = i.currentTarget, M = i.clientY, x = i.clientX;
53
- let g = !1;
54
- const h = (m, u) => {
55
- if (g ||= Math.hypot(m - x, u - M) >= 5, !g) return;
56
- o(t);
57
- const y = n.container()?.getBoundingClientRect();
58
- l(y && m >= y.left - 24 && m <= y.right + 24 && u >= y.top && u <= y.bottom ? C(n.keys(), t, n.elements, "y", u) : void 0);
49
+ begin(o, r) {
50
+ if (r.button !== 0 || !n.onReorder() || !n.keys().includes(o)) return;
51
+ t?.stop({ commit: !1 });
52
+ const l = r.currentTarget, M = r.clientY, w = r.clientX;
53
+ let d = w, c = M, b = !1;
54
+ const k = (f, s) => {
55
+ if (d = f, c = s, b ||= Math.hypot(f - w, s - M) >= 5, !b) return;
56
+ i(o);
57
+ const g = n.container()?.getBoundingClientRect();
58
+ h(g && f >= g.left - 24 && f <= g.right + 24 && s >= g.top && s <= g.bottom ? A(n.keys(), o, n.elements, "y", s) : void 0);
59
+ }, C = () => {
60
+ const f = n.container();
61
+ if (b && f) {
62
+ const s = f.getBoundingClientRect(), g = c < s.top + 28 ? c - s.top - 28 : c > s.bottom - 28 ? c - s.bottom + 28 : 0;
63
+ if (d >= s.left - 24 && d <= s.right + 24 && c >= s.top - 24 && c <= s.bottom + 24 && g) {
64
+ const E = f.scrollTop;
65
+ f.scrollTop += Math.sign(g) * Math.min(10, Math.abs(g) / 3), f.scrollTop !== E && k(d, c);
66
+ }
67
+ }
68
+ u = requestAnimationFrame(C);
59
69
  };
60
- c.ownerDocument.addEventListener("keydown", e, !0), r = k({
61
- pointerEvent: i,
62
- captureEl: c,
63
- onMove: (m) => h(m.clientX, m.clientY),
64
- onEnd: ({ commit: m, snapshot: u }) => {
65
- h(u.latestClientX, u.latestClientY);
66
- const y = p();
67
- r = void 0, c.ownerDocument.removeEventListener("keydown", e, !0), o(void 0), l(void 0), g && (s = !0, a && clearTimeout(a), a = setTimeout(() => {
68
- s = !1;
69
- }, 0)), m && g && y && f(t, y.order);
70
+ u = requestAnimationFrame(C), l.ownerDocument.addEventListener("keydown", x, !0), t = T({
71
+ pointerEvent: r,
72
+ captureEl: l,
73
+ onMove: (f) => k(f.clientX, f.clientY),
74
+ onEnd: ({ commit: f, snapshot: s }) => {
75
+ k(s.latestClientX, s.latestClientY);
76
+ const g = y();
77
+ cancelAnimationFrame(u), t = void 0, l.ownerDocument.removeEventListener("keydown", x, !0), i(void 0), h(void 0), b && (a = !0, p && clearTimeout(p), p = setTimeout(() => {
78
+ a = !1;
79
+ }, 0)), f && b && g && e(o, g.order);
70
80
  }
71
81
  });
72
82
  }
73
83
  };
74
84
  }
75
- function B(n) {
76
- const d = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
77
- let p = !1;
78
- b(() => {
79
- const l = [...n.keys()], r = n.preview(), s = typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches, a = new Map(l.flatMap((e) => {
80
- const f = n.elements.get(e);
81
- if (!f) return [];
82
- const t = f.getBoundingClientRect(), i = getComputedStyle(f).transform, c = typeof DOMMatrix == "function" ? new DOMMatrix(i === "none" ? void 0 : i) : void 0;
83
- return [[e, { left: t.left - (c?.m41 ?? 0), top: t.top - (c?.m42 ?? 0), dx: c?.m41 ?? 0, dy: c?.m42 ?? 0 }]];
84
- }));
85
- for (const e of l) {
86
- const f = n.elements.get(e), t = a.get(e);
87
- if (!f || !t) continue;
88
- const i = d.get(e), c = r ? l[r.indexOf(e)] : e, M = a.get(c) ?? t, x = n.axis === "x" ? M.left - t.left : 0, g = n.axis === "y" ? M.top - t.top : 0;
89
- if (o.get(e)?.cancel(), o.delete(e), f.style.transform = x || g ? `translate3d(${x}px, ${g}px, 0)` : "", !s && p && typeof f.animate == "function") {
90
- const h = i ? i.left - t.left + t.dx : x, m = i ? i.top - t.top + t.dy : g;
91
- if (!i || Math.abs(h - x) + Math.abs(m - g) > 0.5) {
92
- const u = f.animate([
93
- { transform: `translate3d(${h}px, ${m}px, 0)`, opacity: i ? 1 : 0 },
94
- { transform: `translate3d(${x}px, ${g}px, 0)`, opacity: 1 }
95
- ], { duration: 180, easing: "cubic-bezier(0.33, 1, 0.68, 1)" });
96
- o.set(e, u), u.onfinish = () => {
97
- o.get(e) === u && o.delete(e);
98
- };
85
+ function $(n) {
86
+ const m = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
87
+ let y = !1, h = 0;
88
+ R(() => {
89
+ const t = [...n.keys()], a = n.preview(), u = ++h;
90
+ queueMicrotask(() => {
91
+ if (h !== u) return;
92
+ const p = typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches, x = new Map(t.flatMap((e) => {
93
+ const o = n.elements.get(e);
94
+ if (!o) return [];
95
+ const r = o.getBoundingClientRect(), l = getComputedStyle(o).transform, M = typeof DOMMatrix == "function" ? new DOMMatrix(l === "none" ? void 0 : l) : void 0;
96
+ let w = 0, d = 0;
97
+ for (let c = o.parentElement; c; c = c.parentElement)
98
+ w += c.scrollLeft, d += c.scrollTop;
99
+ return [[e, { left: r.left + w - (M?.m41 ?? 0), top: r.top + d - (M?.m42 ?? 0), dx: M?.m41 ?? 0, dy: M?.m42 ?? 0 }]];
100
+ }));
101
+ for (const e of t) {
102
+ const o = n.elements.get(e), r = x.get(e);
103
+ if (!o || !r) continue;
104
+ const l = m.get(e), M = a ? t[a.indexOf(e)] : e, w = x.get(M) ?? r, d = n.axis === "x" ? w.left - r.left : 0, c = n.axis === "y" ? w.top - r.top : 0;
105
+ if (i.get(e)?.cancel(), i.delete(e), o.style.transform = d || c ? `translate3d(${d}px, ${c}px, 0)` : "", !p && y && typeof o.animate == "function") {
106
+ const b = l ? l.left - r.left + r.dx : d, k = l ? l.top - r.top + r.dy : c;
107
+ if (!l || Math.abs(b - d) + Math.abs(k - c) > 0.5) {
108
+ const C = o.animate([
109
+ { transform: `translate3d(${b}px, ${k}px, 0)`, opacity: l ? 1 : 0 },
110
+ { transform: `translate3d(${d}px, ${c}px, 0)`, opacity: 1 }
111
+ ], { duration: 180, easing: "cubic-bezier(0.33, 1, 0.68, 1)" });
112
+ i.set(e, C), C.onfinish = () => {
113
+ i.get(e) === C && i.delete(e);
114
+ };
115
+ }
99
116
  }
117
+ m.set(e, { left: r.left, top: r.top });
100
118
  }
101
- d.set(e, { left: t.left, top: t.top });
102
- }
103
- for (const e of d.keys()) l.includes(e) || (d.delete(e), o.get(e)?.cancel(), o.delete(e));
104
- p = !0;
105
- }), D(() => {
106
- for (const l of o.values()) l.cancel();
119
+ for (const e of m.keys()) t.includes(e) || (m.delete(e), i.get(e)?.cancel(), i.delete(e));
120
+ y = !0;
121
+ });
122
+ }), v(() => {
123
+ h += 1;
124
+ for (const t of i.values()) t.cancel();
107
125
  });
108
126
  }
109
127
  export {
110
- C as barDropPosition,
111
- B as createBarLayoutMotion,
112
- O as createBarReorder,
113
- R as keyboardBarOrder
128
+ A as barDropPosition,
129
+ $ as createBarLayoutMotion,
130
+ Y as createBarReorder,
131
+ B as keyboardBarOrder
114
132
  };