@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.
- package/dist/components/layout/ActivityBar.js +56 -56
- package/dist/components/layout/barReorder.d.ts +15 -1
- package/dist/components/layout/barReorder.js +140 -101
- package/dist/components/workbench/WorkbenchFilterBar.d.ts +11 -0
- package/dist/components/workbench/WorkbenchFilterBar.js +476 -439
- package/dist/components/workbench/index.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,35 +1,36 @@
|
|
|
1
|
-
import { insert as g, createComponent as u, memo as I, effect as
|
|
2
|
-
import { createMemo as m, For as
|
|
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
|
|
5
|
-
import { Tooltip as
|
|
6
|
-
import { createBarReorder as
|
|
7
|
-
import { resolveActivityBarClick as
|
|
8
|
-
import { isBarItemContextMenuKey as
|
|
9
|
-
var
|
|
10
|
-
function
|
|
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]))),
|
|
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
|
-
|
|
18
|
+
V({
|
|
19
19
|
keys: () => t.items.map((i) => i.id),
|
|
20
20
|
elements: c,
|
|
21
|
-
preview: () =>
|
|
21
|
+
preview: () => l.position()?.order,
|
|
22
|
+
drag: l.translation,
|
|
22
23
|
axis: "y"
|
|
23
24
|
});
|
|
24
|
-
const f = m(() => t.activeId),
|
|
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
|
-
|
|
27
|
+
F(() => i.onClick());
|
|
27
28
|
return;
|
|
28
29
|
}
|
|
29
|
-
const e =
|
|
30
|
+
const e = _({
|
|
30
31
|
clickedId: i.id,
|
|
31
32
|
activeId: f(),
|
|
32
|
-
collapsed:
|
|
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 =
|
|
41
|
-
return typeof
|
|
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,
|
|
47
|
-
return u(
|
|
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
|
-
|
|
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) =>
|
|
61
|
-
onReorderKey: (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
|
|
67
|
+
return l.dragging() === n;
|
|
67
68
|
},
|
|
68
69
|
get dropEdge() {
|
|
69
|
-
return I(() =>
|
|
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 =
|
|
79
|
-
return g(n, u(
|
|
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(
|
|
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),
|
|
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 &&
|
|
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
|
|
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,
|
|
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
|
-
|
|
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
|
-
}),
|
|
111
|
-
const
|
|
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 || !
|
|
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(
|
|
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 =
|
|
131
|
-
r.$$keydown = x, r.$$contextmenu =
|
|
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" ?
|
|
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
|
|
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)]",
|
|
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 =
|
|
149
|
-
return
|
|
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 !==
|
|
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
|
|
165
|
-
return () =>
|
|
166
|
-
})()),
|
|
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),
|
|
169
|
-
var
|
|
170
|
-
return
|
|
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
|
-
|
|
187
|
+
T(["pointerdown", "click", "contextmenu", "keydown"]);
|
|
188
188
|
export {
|
|
189
|
-
|
|
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
|
|
2
|
-
import { startPointerSession as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
11
|
-
const
|
|
12
|
-
return
|
|
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
|
|
15
|
-
if (!
|
|
16
|
-
const g =
|
|
17
|
-
if (!g ||
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
if (
|
|
21
|
-
const
|
|
22
|
-
return
|
|
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
|
|
25
|
-
const [
|
|
26
|
-
let
|
|
27
|
-
const
|
|
28
|
-
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
}),
|
|
33
|
-
const
|
|
34
|
-
|
|
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:
|
|
38
|
-
position:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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(
|
|
45
|
-
const
|
|
46
|
-
return
|
|
53
|
+
consumeClick(c) {
|
|
54
|
+
const m = r && c.detail !== 0;
|
|
55
|
+
return r = !1, m;
|
|
47
56
|
},
|
|
48
|
-
begin(
|
|
49
|
-
if (
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
let
|
|
53
|
-
const
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
g(
|
|
58
|
-
},
|
|
59
|
-
const
|
|
60
|
-
if (
|
|
61
|
-
const
|
|
62
|
-
if (
|
|
63
|
-
const
|
|
64
|
-
|
|
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
|
-
|
|
76
|
+
n = requestAnimationFrame(T);
|
|
68
77
|
};
|
|
69
|
-
|
|
70
|
-
pointerEvent:
|
|
71
|
-
captureEl:
|
|
72
|
-
onMove: (
|
|
73
|
-
onEnd: ({ commit:
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
cancelAnimationFrame(
|
|
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
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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 (
|
|
89
|
-
const
|
|
90
|
-
const
|
|
91
|
-
if (!
|
|
92
|
-
const
|
|
93
|
-
|
|
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
|
|
99
|
-
const
|
|
100
|
-
if (!
|
|
101
|
-
const
|
|
102
|
-
if (
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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
|
-
|
|
110
|
-
|
|
146
|
+
e.set(o, v), v.onfinish = () => {
|
|
147
|
+
e.get(o) === v && e.delete(o);
|
|
111
148
|
};
|
|
112
149
|
}
|
|
113
150
|
}
|
|
114
|
-
|
|
151
|
+
s.set(o, d);
|
|
115
152
|
}
|
|
116
|
-
for (const
|
|
117
|
-
|
|
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
|
-
}),
|
|
120
|
-
|
|
121
|
-
for (const
|
|
156
|
+
}), X(() => {
|
|
157
|
+
l += 1;
|
|
158
|
+
for (const r of e.values()) r.cancel();
|
|
122
159
|
});
|
|
123
160
|
}
|
|
124
161
|
export {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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[];
|