@floegence/floe-webapp-core 0.101.37 → 0.101.38

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