@floegence/floe-webapp-core 0.101.36 → 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,35 +1,36 @@
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";
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
- 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) {
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 _ } 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
- const c = /* @__PURE__ */ new Map(), b = m(() => new Map(t.items.map((i) => [i.id, i]))), d = V({
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),
14
14
  elements: c,
15
15
  container: () => v,
16
16
  onReorder: () => t.onReorder
17
17
  });
18
- z({
18
+ V({
19
19
  keys: () => t.items.map((i) => i.id),
20
20
  elements: c,
21
- preview: () => d.position()?.order,
21
+ preview: () => l.position()?.order,
22
+ drag: l.translation,
22
23
  axis: "y"
23
24
  });
24
- 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) => {
25
26
  if (i.onClick) {
26
- H(() => i.onClick());
27
+ F(() => i.onClick());
27
28
  return;
28
29
  }
29
- const e = G({
30
+ const e = _({
30
31
  clickedId: i.id,
31
32
  activeId: f(),
32
- collapsed: B(),
33
+ collapsed: A(),
33
34
  behavior: i.collapseBehavior
34
35
  });
35
36
  e.nextActiveId !== f() && (typeof e.openSidebar == "boolean" ? x()(e.nextActiveId, {
@@ -37,14 +38,14 @@ function de(t) {
37
38
  }) : x()(e.nextActiveId)), typeof e.nextCollapsed == "boolean" && r()?.(e.nextCollapsed);
38
39
  };
39
40
  return (() => {
40
- var i = W(), e = i.firstChild, l = v;
41
- return typeof l == "function" ? L(l, 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, {
42
43
  get each() {
43
44
  return t.items.map((n) => n.id);
44
45
  },
45
46
  children: (n) => {
46
- const o = m((a) => b().get(n) ?? a, X(() => b().get(n)));
47
- return u(q, {
47
+ const o = m((a) => b().get(n) ?? a, N(() => b().get(n)));
48
+ return u(j, {
48
49
  get item() {
49
50
  return o();
50
51
  },
@@ -52,21 +53,21 @@ function de(t) {
52
53
  return f() === n;
53
54
  },
54
55
  onClick: (a) => {
55
- d.consumeClick(a) || C(o());
56
+ l.consumeClick(a) || C(o());
56
57
  },
57
58
  elementRef: (a) => {
58
59
  a ? c.set(n, a) : c.delete(n);
59
60
  },
60
- onPointerDown: (a) => d.begin(n, a),
61
- onReorderKey: (a) => d.keyDown(n, a),
61
+ onPointerDown: (a) => l.begin(n, a),
62
+ onReorderKey: (a) => l.keyDown(n, a),
62
63
  get reorderable() {
63
64
  return I(() => !!t.onReorder)() && o().reorderable !== !1;
64
65
  },
65
66
  get dragging() {
66
- return d.dragging() === n;
67
+ return l.dragging() === n;
67
68
  },
68
69
  get dropEdge() {
69
- return I(() => d.position()?.key === n)() ? d.position()?.edge : void 0;
70
+ return I(() => l.position()?.key === n)() ? l.position()?.edge : void 0;
70
71
  }
71
72
  });
72
73
  }
@@ -75,12 +76,12 @@ function de(t) {
75
76
  return t.bottomItems?.length;
76
77
  },
77
78
  get children() {
78
- var n = Q();
79
- return g(n, u(j, {
79
+ var n = J();
80
+ return g(n, u(K, {
80
81
  get each() {
81
82
  return t.bottomItems;
82
83
  },
83
- children: (o) => u(q, {
84
+ children: (o) => u(j, {
84
85
  item: o,
85
86
  get isActive() {
86
87
  return f() === o.id;
@@ -89,26 +90,26 @@ function de(t) {
89
90
  })
90
91
  })), n;
91
92
  }
92
- }), null), k((n) => {
93
+ }), null), w((n) => {
93
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;
94
- 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;
95
96
  }, {
96
97
  e: void 0,
97
98
  t: void 0
98
99
  }), i;
99
100
  })();
100
101
  }
101
- function q(t) {
102
+ function j(t) {
102
103
  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;
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;
104
105
  let f;
105
- Y(() => {
106
+ X(() => {
106
107
  const r = t.item.buttonRef;
107
108
  r?.(v ?? null), t.elementRef?.(v ?? null), f = () => {
108
109
  r?.(null), t.elementRef?.(null);
109
110
  };
110
- }), F(() => f?.());
111
- const B = (r) => {
111
+ }), Y(() => f?.());
112
+ const A = (r) => {
112
113
  t.item.onContextMenu && (r.preventDefault(), r.stopPropagation(), t.item.onContextMenu({
113
114
  trigger: r.currentTarget,
114
115
  clientX: r.clientX,
@@ -116,9 +117,9 @@ function q(t) {
116
117
  source: "pointer"
117
118
  }));
118
119
  }, x = (r) => {
119
- 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)));
120
121
  };
121
- return u(U, {
122
+ return u(H, {
122
123
  get content() {
123
124
  return t.item.label;
124
125
  },
@@ -127,28 +128,28 @@ function q(t) {
127
128
  triggerClass: "shrink-0",
128
129
  portalScope: "viewport",
129
130
  get children() {
130
- var r = p(), C = r.firstChild;
131
- 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);
132
133
  var i = v;
133
- 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, {
134
135
  get component() {
135
136
  return t.item.icon;
136
137
  },
137
138
  get active() {
138
- return d();
139
+ return l();
139
140
  },
140
141
  get class() {
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");
142
+ 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");
142
143
  }
143
144
  }), null), g(r, u(M, {
144
145
  get when() {
145
146
  return t.dropEdge;
146
147
  },
147
148
  get children() {
148
- var e = Z();
149
- return k((l) => {
149
+ var e = Q();
150
+ return w((d) => {
150
151
  var n = t.dropEdge === "before" ? "0" : void 0, o = t.dropEdge === "after" ? "0" : void 0;
151
- return n !== l.e && w(e, "top", l.e = n), o !== l.t && w(e, "bottom", l.t = o), l;
152
+ return n !== d.e && B(e, "top", d.e = n), o !== d.t && B(e, "bottom", d.t = o), d;
152
153
  }, {
153
154
  e: void 0,
154
155
  t: void 0
@@ -159,15 +160,15 @@ function q(t) {
159
160
  return c();
160
161
  },
161
162
  get children() {
162
- var e = _();
163
+ var e = W();
163
164
  return g(e, (() => {
164
- var l = I(() => typeof c() == "number" && c() > 99);
165
- return () => l() ? "99+" : c();
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;
165
+ var d = I(() => typeof c() == "number" && c() > 99);
166
+ return () => d() ? "99+" : c();
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;
167
168
  }
168
- }), null), 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;
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;
171
172
  }, {
172
173
  e: void 0,
173
174
  t: void 0,
@@ -178,13 +179,12 @@ function q(t) {
178
179
  s: void 0,
179
180
  h: void 0,
180
181
  r: void 0,
181
- d: void 0,
182
- l: void 0
182
+ d: void 0
183
183
  }), r;
184
184
  }
185
185
  });
186
186
  }
187
- N(["pointerdown", "click", "contextmenu", "keydown"]);
187
+ T(["pointerdown", "click", "contextmenu", "keydown"]);
188
188
  export {
189
- de as ActivityBar
189
+ le as ActivityBar
190
190
  };
@@ -3,8 +3,16 @@ export type BarDropPosition = Readonly<{
3
3
  edge: 'before' | 'after';
4
4
  order: string[];
5
5
  }>;
6
+ export type BarDragTranslation = Readonly<{
7
+ key: string;
8
+ x: number;
9
+ y: number;
10
+ }>;
11
+ export declare const sameBarDropPosition: (a: BarDropPosition | undefined, b: BarDropPosition | undefined) => boolean;
12
+ /** Read untransformed slots once per gesture, never from animated neighbors on each move. */
13
+ export declare function measureBarSlots(elements: ReadonlyMap<string, HTMLElement>, axis: 'x' | 'y'): ReadonlyMap<string, number>;
6
14
  /** A placement proposal only; owners commit order after a completed gesture. */
7
- export declare function barDropPosition(keys: readonly string[], source: string, elements: ReadonlyMap<string, HTMLElement>, axis: 'x' | 'y', coordinate: number): BarDropPosition | undefined;
15
+ export declare function barDropPosition(keys: readonly string[], source: string, elements: ReadonlyMap<string, HTMLElement>, axis: 'x' | 'y', coordinate: number, slots?: ReadonlyMap<string, number>): BarDropPosition | undefined;
8
16
  export declare function keyboardBarOrder(keys: readonly string[], source: string, event: KeyboardEvent, axis: 'x' | 'y'): string[] | undefined;
9
17
  /** Activity rails own their pointer session; Dock shares the proposal with its canvas gesture. */
10
18
  export declare function createBarReorder(options: {
@@ -19,6 +27,11 @@ export declare function createBarReorder(options: {
19
27
  edge: "before" | "after";
20
28
  order: string[];
21
29
  }> | undefined>;
30
+ translation: import("solid-js").Accessor<Readonly<{
31
+ key: string;
32
+ x: number;
33
+ y: number;
34
+ }> | undefined>;
22
35
  keyDown(key: string, event: KeyboardEvent): void;
23
36
  consumeClick(event: MouseEvent): boolean;
24
37
  begin(key: string, event: PointerEvent): void;
@@ -29,4 +42,5 @@ export declare function createBarLayoutMotion(options: {
29
42
  elements: Map<string, HTMLElement>;
30
43
  preview: () => readonly string[] | undefined;
31
44
  axis: 'x' | 'y';
45
+ drag?: () => BarDragTranslation | undefined;
32
46
  }): void;
@@ -1,129 +1,168 @@
1
- import { createSignal as D, createEffect as k, onCleanup as R } from "solid-js";
2
- import { startPointerSession as E } from "../ui/pointerSession.js";
3
- function A(n, m, o, h, g) {
4
- const e = n.filter((M) => M !== m && o.has(M));
5
- if (!n.includes(m) || !e.length) return;
6
- let f = e.findIndex((M) => {
7
- const w = o.get(M), t = w.getBoundingClientRect(), r = getComputedStyle(w).transform, i = typeof DOMMatrix == "function" ? new DOMMatrix(r === "none" ? void 0 : r) : void 0;
8
- return g < (h === "x" ? t.left - (i?.m41 ?? 0) + t.width / 2 : t.top - (i?.m42 ?? 0) + t.height / 2);
1
+ import { createSignal as $, createEffect as S, onCleanup as X, createMemo as L, untrack as K } from "solid-js";
2
+ import { startPointerSession as P } from "../ui/pointerSession.js";
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
+ return new Map([...t].map(([e, p]) => {
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
+ }));
9
+ }
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);
9
17
  });
10
- f < 0 && (f = e.length);
11
- const u = [...e];
12
- return u.splice(f, 0, m), { key: e[Math.min(f, e.length - 1)], edge: f === e.length ? "after" : "before", order: u };
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 };
13
21
  }
14
- function B(n, m, o, h) {
15
- if (!o.altKey || !o.shiftKey || o.ctrlKey || o.metaKey || o.isComposing) return;
16
- const g = o.key === (h === "x" ? "ArrowLeft" : "ArrowUp") ? -1 : o.key === (h === "x" ? "ArrowRight" : "ArrowDown") ? 1 : 0, e = n.indexOf(m);
17
- if (!g || e < 0) return;
18
- o.preventDefault(), o.stopPropagation();
19
- const f = Math.max(0, Math.min(n.length - 1, e + g));
20
- if (e === f) return;
21
- const u = [...n];
22
- return u.splice(e, 1), u.splice(f, 0, m), u;
22
+ function F(t, s, e, p) {
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(s);
25
+ if (!g || y < 0) return;
26
+ e.preventDefault(), e.stopPropagation();
27
+ const l = Math.max(0, Math.min(t.length - 1, y + g));
28
+ if (y === l) return;
29
+ const a = [...t];
30
+ return a.splice(y, 1), a.splice(l, 0, s), a;
23
31
  }
24
- function Y(n) {
25
- const [m, o] = D(), [h, g] = D();
26
- let e, f = !1, u = 0;
27
- const M = (t) => {
28
- t.key !== "Escape" || !e || (t.preventDefault(), t.stopPropagation(), e.stop({ commit: !1 }));
32
+ function U(t) {
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 }));
29
37
  };
30
- k(() => {
31
- n.keys(), n.onReorder(), e?.stop({ commit: !1 });
32
- }), R(() => e?.stop({ commit: !1 }));
33
- const w = (t, r) => {
34
- n.onReorder()?.(r), n.elements.get(t)?.focus({ preventScroll: !0 });
38
+ S(() => {
39
+ t.keys(), t.onReorder(), a?.stop({ commit: !1 });
40
+ }), X(() => a?.stop({ commit: !1 }));
41
+ const i = (c, m) => {
42
+ t.onReorder()?.(m), t.elements.get(c)?.focus({ preventScroll: !0 });
35
43
  };
36
44
  return {
37
- dragging: m,
38
- position: h,
39
- keyDown(t, r) {
40
- if (!n.onReorder()) return;
41
- const i = B(n.keys(), t, r, "y");
42
- i && w(t, i);
45
+ dragging: s,
46
+ position: p,
47
+ translation: y,
48
+ keyDown(c, m) {
49
+ if (!t.onReorder()) return;
50
+ const o = F(t.keys(), c, m, "y");
51
+ o && i(c, o);
43
52
  },
44
- consumeClick(t) {
45
- const r = f && t.detail !== 0;
46
- return f = !1, r;
53
+ consumeClick(c) {
54
+ const m = r && c.detail !== 0;
55
+ return r = !1, m;
47
56
  },
48
- begin(t, r) {
49
- if (r.button !== 0 || (f = !1, !n.onReorder() || !n.keys().includes(t))) return;
50
- e?.stop({ commit: !1 });
51
- const i = r.currentTarget, d = r.clientY, x = r.clientX;
52
- let y = x, c = d, a = !1;
53
- const b = (s, l) => {
54
- if (y = s, c = l, a ||= Math.hypot(s - x, l - d) >= 5, !a) return;
55
- o(t);
56
- const p = n.container()?.getBoundingClientRect();
57
- g(p && s >= p.left - 24 && s <= p.right + 24 && l >= p.top && l <= p.bottom ? A(n.keys(), t, n.elements, "y", l) : void 0);
58
- }, C = () => {
59
- const s = n.container();
60
- if (a && s) {
61
- const l = s.getBoundingClientRect(), p = c < l.top + 28 ? c - l.top - 28 : c > l.bottom - 28 ? c - l.bottom + 28 : 0;
62
- if (y >= l.left - 24 && y <= l.right + 24 && c >= l.top - 24 && c <= l.bottom + 24 && p) {
63
- const v = s.scrollTop;
64
- s.scrollTop += Math.sign(p) * Math.min(10, Math.abs(p) / 3), s.scrollTop !== v && b(y, c);
57
+ begin(c, m) {
58
+ if (m.button !== 0 || (r = !1, !t.onReorder() || !t.keys().includes(c))) return;
59
+ a?.stop({ commit: !1 });
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
+ let R = d, v = x, O = !1;
62
+ const Y = (u, f) => {
63
+ if (R = u, v = f, O ||= Math.hypot(u - d, f - x) >= 5, !O) return;
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
+ }, T = () => {
68
+ const u = t.container();
69
+ if (O && u) {
70
+ const f = u.getBoundingClientRect(), h = v < f.top + 28 ? v - f.top - 28 : v > f.bottom - 28 ? v - f.bottom + 28 : 0;
71
+ if (R >= f.left - 24 && R <= f.right + 24 && v >= f.top - 24 && v <= f.bottom + 24 && h) {
72
+ const B = u.scrollTop;
73
+ u.scrollTop += Math.sign(h) * Math.min(10, Math.abs(h) / 3), u.scrollTop !== B && Y(R, v);
65
74
  }
66
75
  }
67
- u = requestAnimationFrame(C);
76
+ n = requestAnimationFrame(T);
68
77
  };
69
- u = requestAnimationFrame(C), i.ownerDocument.addEventListener("keydown", M, !0), e = E({
70
- pointerEvent: r,
71
- captureEl: i,
72
- onMove: (s) => b(s.clientX, s.clientY),
73
- onEnd: ({ commit: s, snapshot: l }) => {
74
- b(l.latestClientX, l.latestClientY);
75
- const p = h();
76
- cancelAnimationFrame(u), e = void 0, i.ownerDocument.removeEventListener("keydown", M, !0), o(void 0), g(void 0), f = a || !s, s && a && p && w(t, p.order);
78
+ n = requestAnimationFrame(T), o.ownerDocument.addEventListener("keydown", w, !0), a = P({
79
+ pointerEvent: m,
80
+ captureEl: o,
81
+ onMove: (u) => Y(u.clientX, u.clientY),
82
+ onEnd: ({ commit: u, snapshot: f, reason: h }) => {
83
+ u &&= h === "pointer_up" || h === "buttons_released", Y(f.latestClientX, f.latestClientY);
84
+ const B = p();
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);
77
86
  }
78
87
  });
79
88
  }
80
89
  };
81
90
  }
82
- function $(n) {
83
- const m = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
84
- let h = !1, g = 0;
85
- k(() => {
86
- const e = [...n.keys()], f = n.preview(), u = ++g;
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
+ }
102
+ };
103
+ typeof document < "u" && (document.addEventListener("scroll", g, !0), X(() => document.removeEventListener("scroll", g, !0)));
104
+ let y = !1, l = 0;
105
+ const a = L(() => t.drag?.()?.key);
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;
87
120
  queueMicrotask(() => {
88
- if (g !== u) return;
89
- const M = typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches, w = new Map(e.flatMap((t) => {
90
- const r = n.elements.get(t);
91
- if (!r) return [];
92
- const i = r.getBoundingClientRect(), d = getComputedStyle(r).transform, x = typeof DOMMatrix == "function" ? new DOMMatrix(d === "none" ? void 0 : d) : void 0;
93
- let y = 0, c = 0;
94
- for (let a = r.parentElement; a; a = a.parentElement)
95
- y += a.scrollLeft, c += a.scrollTop;
96
- return [[t, { left: i.left + y - (x?.m41 ?? 0), top: i.top + c - (x?.m42 ?? 0), dx: x?.m41 ?? 0, dy: x?.m42 ?? 0 }]];
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);
124
+ if (!x) return [];
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 }]];
97
127
  }));
98
- for (const t of e) {
99
- const r = n.elements.get(t), i = w.get(t);
100
- if (!r || !i) continue;
101
- const d = m.get(t), x = f ? e[f.indexOf(t)] : t, y = w.get(x) ?? i, c = n.axis === "x" ? y.left - i.left : 0, a = n.axis === "y" ? y.top - i.top : 0;
102
- if (o.get(t)?.cancel(), o.delete(t), r.style.transform = c || a ? `translate3d(${c}px, ${a}px, 0)` : "", !M && h && typeof r.animate == "function") {
103
- const b = d ? d.left - i.left + i.dx : c, C = d ? d.top - i.top + i.dy : a;
104
- if (!d || Math.abs(b - c) + Math.abs(C - a) > 0.5) {
105
- const s = r.animate([
106
- { transform: `translate3d(${b}px, ${C}px, 0)`, ...d ? {} : { opacity: 0 } },
107
- { transform: `translate3d(${c}px, ${a}px, 0)`, ...d ? {} : { opacity: 1 } }
128
+ for (const o of r) {
129
+ const x = t.elements.get(o), d = m.get(o);
130
+ if (!x || !d) continue;
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)`);
136
+ continue;
137
+ }
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) {
142
+ const v = x.animate([
143
+ { transform: `translate3d(${b}px, ${R}px, 0)`, ...M ? {} : { opacity: 0 } },
144
+ { transform: `translate3d(${D}px, ${E}px, 0)`, ...M ? {} : { opacity: 1 } }
108
145
  ], { duration: 180, easing: "cubic-bezier(0.33, 1, 0.68, 1)" });
109
- o.set(t, s), s.onfinish = () => {
110
- o.get(t) === s && o.delete(t);
146
+ e.set(o, v), v.onfinish = () => {
147
+ e.get(o) === v && e.delete(o);
111
148
  };
112
149
  }
113
150
  }
114
- m.set(t, { left: i.left, top: i.top });
151
+ s.set(o, d);
115
152
  }
116
- for (const t of m.keys()) e.includes(t) || (m.delete(t), o.get(t)?.cancel(), o.delete(t));
117
- h = !0;
153
+ for (const o of s.keys()) r.includes(o) || (s.delete(o), e.get(o)?.cancel(), e.delete(o));
154
+ y = !0;
118
155
  });
119
- }), R(() => {
120
- g += 1;
121
- for (const e of o.values()) e.cancel();
156
+ }), X(() => {
157
+ l += 1;
158
+ for (const r of e.values()) r.cancel();
122
159
  });
123
160
  }
124
161
  export {
125
- A as barDropPosition,
126
- $ as createBarLayoutMotion,
127
- Y as createBarReorder,
128
- B as keyboardBarOrder
162
+ q as barDropPosition,
163
+ Z as createBarLayoutMotion,
164
+ U as createBarReorder,
165
+ F as keyboardBarOrder,
166
+ I as measureBarSlots,
167
+ z as sameBarDropPosition
129
168
  };
@@ -1,4 +1,5 @@
1
1
  import { type Component, type JSX } from 'solid-js';
2
+ import { type PointerSessionEndReason } from '../ui/pointerSession';
2
3
  import { type BarItemContextMenuHandler, type BarItemContextMenuRequest } from '../layout/barItemContextMenu';
3
4
  import { type WorkbenchWidgetFrame } from './workbenchHelpers';
4
5
  import { type WorkbenchEdgeAutoPanFrame } from './workbenchEdgeAutoPan';
@@ -55,6 +56,16 @@ export type WorkbenchDockEntry = Readonly<{
55
56
  activate: (trigger: HTMLButtonElement) => void;
56
57
  /** Focuses this entry after the host restores its visibility. */
57
58
  focus: () => void;
59
+ /** Uses the Dock's canvas gesture from a host-owned overflow row. Click remains host-owned. */
60
+ beginDrag?: (event: PointerEvent, lifecycle: WorkbenchDockOverflowDragLifecycle) => void;
61
+ }>;
62
+ export type WorkbenchDockOverflowDragLifecycle = Readonly<{
63
+ /** Fires only after the drag threshold, while capture is held by the stable Dock. */
64
+ onStart: () => void;
65
+ onEnd: (result: Readonly<{
66
+ dropped: boolean;
67
+ reason: PointerSessionEndReason;
68
+ }>) => void;
58
69
  }>;
59
70
  export type WorkbenchDockCustomization = Readonly<{
60
71
  order?: readonly string[];