@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,76 +1,76 @@
1
- import { insert as h, createComponent as g, effect as H, setAttribute as T, memo as I, Dynamic as $e, className as Ve, template as Y, use as Le, setStyleProperty as se, Portal as Ue, delegateEvents as qe } from "solid-js/web";
2
- import { createSignal as oe, onCleanup as j, createEffect as q, createMemo as L, Show as X, For as Pe, untrack as je, onMount as Je } from "solid-js";
3
- import { Motion as ie } from "../../node_modules/.pnpm/solid-motionone@1.0.4_solid-js@1.9.17/node_modules/solid-motionone/dist/index.js";
4
- import { createBarLayoutMotion as Qe, keyboardBarOrder as Ze, barDropPosition as pe } from "../layout/barReorder.js";
5
- import { easing as re, duration as ae } from "../../utils/animations.js";
6
- import { Plus as et } from "../icons/index.js";
7
- import { startHotInteraction as tt } from "../../utils/hotInteraction.js";
8
- import { startPointerSession as nt } from "../ui/pointerSession.js";
9
- import { clientToCanvasWorld as ot } from "../ui/canvasGeometry.js";
10
- import { isBarItemContextMenuKey as it, keyboardBarItemContextMenuRequest as rt } from "../layout/barItemContextMenu.js";
11
- import { createWorkbenchWidgetFrame as at } from "./workbenchHelpers.js";
12
- import { getWidgetEntry as ct } from "./widgets/widgetRegistry.js";
13
- import { WORKBENCH_EDGE_AUTO_PAN_FRAME_SELECTOR as Oe, frameFromElement as Ae, createWorkbenchEdgeAutoPanController as lt } from "./workbenchEdgeAutoPan.js";
14
- import { DockLayoutDashboard as dt, DockLayers as st, DockRegion as ut, DockText as vt, DockMessageSquare as gt } from "../icons/DockIcons.js";
15
- var ft = /* @__PURE__ */ Y("<span aria-hidden=true style=position:absolute;top:8px;bottom:8px;width:2px;background:var(--ring);border-radius:2px>"), kt = /* @__PURE__ */ Y("<button type=button class=workbench-dock__item style=touch-action:none>"), mt = /* @__PURE__ */ Y("<span class=workbench-dock__external-placeholder aria-hidden=true>"), wt = /* @__PURE__ */ Y('<div class=workbench-dock__mode-popover role=menu aria-label="Canvas mode">'), ht = /* @__PURE__ */ Y('<div data-floe-canvas-interactive=true><div class=workbench-dock__mode-switcher><button type=button class="workbench-dock__item workbench-dock__mode-trigger"aria-label="Switch canvas mode"aria-haspopup=menu>'), bt = /* @__PURE__ */ Y("<button type=button class=workbench-dock__mode-option role=menuitemradio><span class=workbench-dock__mode-option-icon></span><span class=workbench-dock__mode-option-copy><span class=workbench-dock__mode-option-label></span><span class=workbench-dock__mode-option-description>"), _t = /* @__PURE__ */ Y("<span class=workbench-dock__divider aria-hidden=true>"), Et = /* @__PURE__ */ Y("<div class=workbench-dock-ghost aria-hidden=true><div class=workbench-dock-ghost__halo></div><div class=workbench-dock-ghost__card><div class=workbench-dock-ghost__icon></div><div class=workbench-dock-ghost__copy><div class=workbench-dock-ghost__title></div><div class=workbench-dock-ghost__hint><span>");
16
- const Me = 5, Ct = 1e3, yt = ".workbench-dock", Dt = [{
1
+ import { insert as h, createComponent as f, effect as V, setAttribute as T, memo as $, Dynamic as Le, className as Je, template as Y, use as Te, setStyleProperty as ge, Portal as Qe, delegateEvents as Ze } from "solid-js/web";
2
+ import { createSignal as ie, onCleanup as Q, createEffect as J, createMemo as S, Show as X, For as Se, untrack as pe, onMount as et } from "solid-js";
3
+ import { Motion as ae } from "../../node_modules/.pnpm/solid-motionone@1.0.4_solid-js@1.9.17/node_modules/solid-motionone/dist/index.js";
4
+ import { sameBarDropPosition as tt, createBarLayoutMotion as nt, measureBarSlots as ot, keyboardBarOrder as rt, barDropPosition as it } from "../layout/barReorder.js";
5
+ import { easing as ce, duration as le } from "../../utils/animations.js";
6
+ import { Plus as at } from "../icons/index.js";
7
+ import { startHotInteraction as ct } from "../../utils/hotInteraction.js";
8
+ import { startPointerSession as lt } from "../ui/pointerSession.js";
9
+ import { clientToCanvasWorld as dt } from "../ui/canvasGeometry.js";
10
+ import { isBarItemContextMenuKey as st, keyboardBarItemContextMenuRequest as ut } from "../layout/barItemContextMenu.js";
11
+ import { createWorkbenchWidgetFrame as vt } from "./workbenchHelpers.js";
12
+ import { getWidgetEntry as ft } from "./widgets/widgetRegistry.js";
13
+ import { WORKBENCH_EDGE_AUTO_PAN_FRAME_SELECTOR as Ae, frameFromElement as Xe, createWorkbenchEdgeAutoPanController as gt } from "./workbenchEdgeAutoPan.js";
14
+ import { DockLayoutDashboard as mt, DockLayers as kt, DockRegion as wt, DockText as ht, DockMessageSquare as bt } from "../icons/DockIcons.js";
15
+ var _t = /* @__PURE__ */ Y("<span aria-hidden=true style=position:absolute;top:8px;bottom:8px;width:2px;background:var(--ring);border-radius:2px>"), Et = /* @__PURE__ */ Y("<button type=button class=workbench-dock__item style=touch-action:none>"), Ct = /* @__PURE__ */ Y("<span class=workbench-dock__external-placeholder aria-hidden=true>"), Dt = /* @__PURE__ */ Y('<div class=workbench-dock__mode-popover role=menu aria-label="Canvas mode">'), yt = /* @__PURE__ */ Y('<div data-floe-canvas-interactive=true><div class=workbench-dock__mode-switcher><button type=button class="workbench-dock__item workbench-dock__mode-trigger"aria-label="Switch canvas mode"aria-haspopup=menu>'), xt = /* @__PURE__ */ Y("<button type=button class=workbench-dock__mode-option role=menuitemradio><span class=workbench-dock__mode-option-icon></span><span class=workbench-dock__mode-option-copy><span class=workbench-dock__mode-option-label></span><span class=workbench-dock__mode-option-description>"), Pt = /* @__PURE__ */ Y("<span class=workbench-dock__divider aria-hidden=true>"), Mt = /* @__PURE__ */ Y("<div class=workbench-dock-ghost aria-hidden=true><div class=workbench-dock-ghost__halo></div><div class=workbench-dock-ghost__card><div class=workbench-dock-ghost__icon></div><div class=workbench-dock-ghost__copy><div class=workbench-dock-ghost__title></div><div class=workbench-dock-ghost__hint><span>");
16
+ const Ie = 5, St = 1e3, It = ".workbench-dock", Ot = [{
17
17
  mode: "work",
18
18
  label: "Work Mode",
19
19
  description: "Operate windows and sticky notes",
20
- icon: dt
20
+ icon: mt
21
21
  }, {
22
22
  mode: "background",
23
23
  label: "Composition Mode",
24
24
  description: "Arrange regions and canvas text",
25
- icon: st
26
- }], xt = [{
25
+ icon: kt
26
+ }], $t = [{
27
27
  tool: "sticky-note",
28
28
  label: "Sticky",
29
- icon: gt
30
- }], Pt = [{
29
+ icon: bt
30
+ }], Lt = [{
31
31
  tool: "background-region",
32
32
  label: "Region",
33
- icon: ut
33
+ icon: wt
34
34
  }, {
35
35
  tool: "text",
36
36
  label: "Text",
37
- icon: vt
37
+ icon: ht
38
38
  }];
39
- function Mt(e) {
40
- const s = e?.closest(".workbench-surface")?.querySelector(Oe);
41
- return s instanceof HTMLElement ? Ae(s) : null;
39
+ function Tt(e) {
40
+ const u = e?.closest(".workbench-surface")?.querySelector(Ae);
41
+ return u instanceof HTMLElement ? Xe(u) : null;
42
42
  }
43
- function ue(e, m, s) {
44
- return e >= s.left && e <= s.right && m >= s.top && m <= s.bottom;
43
+ function me(e, g, u) {
44
+ return e >= u.left && e <= u.right && g >= u.top && g <= u.bottom;
45
45
  }
46
- function It(e, m, s) {
47
- return s ? ue(e, m, s) : !1;
46
+ function At(e, g, u) {
47
+ return u ? me(e, g, u) : !1;
48
48
  }
49
- function Ie(e, m, s) {
50
- return Math.min(s, Math.max(m, e));
49
+ function Oe(e, g, u) {
50
+ return Math.min(u, Math.max(g, e));
51
51
  }
52
- function St(e, m, s, u, _) {
52
+ function Xt(e, g, u, d, b) {
53
53
  if (!e) return !1;
54
- if (ue(m, s, e) || ue(u, _, e))
54
+ if (me(g, u, e) || me(d, b, e))
55
55
  return !0;
56
- const C = u - m, S = _ - s;
57
- let $ = 0, D = 1;
58
- const i = (b, r) => {
59
- if (b === 0) return r >= 0;
60
- const l = r / b;
61
- return b < 0 ? l > D ? !1 : (l > $ && ($ = l), !0) : l < $ ? !1 : (l < D && (D = l), !0);
56
+ const _ = d - g, I = b - u;
57
+ let O = 0, x = 1;
58
+ const r = (w, i) => {
59
+ if (w === 0) return i >= 0;
60
+ const s = i / w;
61
+ return w < 0 ? s > x ? !1 : (s > O && (O = s), !0) : s < O ? !1 : (s < x && (x = s), !0);
62
62
  };
63
- return i(-C, m - e.left) && i(C, e.right - m) && i(-S, s - e.top) && i(S, e.bottom - s);
63
+ return r(-_, g - e.left) && r(_, e.right - g) && r(-I, u - e.top) && r(I, e.bottom - u);
64
64
  }
65
- function Se(e, m, s) {
66
- if (!s || typeof document.elementFromPoint != "function") return !1;
67
- const u = document.elementFromPoint(e, m);
68
- return u instanceof Element && u.closest(yt) === s;
65
+ function $e(e, g, u) {
66
+ if (!u || typeof document.elementFromPoint != "function") return !1;
67
+ const d = document.elementFromPoint(e, g);
68
+ return d instanceof Element && d.closest(It) === u;
69
69
  }
70
- function $t(e) {
71
- let m;
72
- Je(() => e.buttonRef?.(m ?? null)), j(() => e.buttonRef?.(null));
73
- const s = () => e.kind === "action" ? {
70
+ function Rt(e) {
71
+ let g;
72
+ et(() => e.buttonRef?.(g ?? null)), Q(() => e.buttonRef?.(null));
73
+ const u = () => e.kind === "action" ? {
74
74
  scale: 1,
75
75
  y: 0,
76
76
  x: 0
@@ -90,80 +90,80 @@ function $t(e) {
90
90
  scale: 1,
91
91
  y: 0,
92
92
  x: 0
93
- }, u = () => e.hoverOffset === -1, _ = (i) => {
94
- i.button !== 0 || e.kind === "action" && !e.reorderable || e.onDragBegin(i, e.kind, e.id, e.label, e.icon, i.currentTarget, e.canvasPlacement, null);
95
- }, C = (i) => {
96
- e.onContextMenu && (i.preventDefault(), i.stopPropagation(), e.onContextMenu({
97
- trigger: i.currentTarget,
98
- clientX: i.clientX,
99
- clientY: i.clientY,
93
+ }, d = () => e.hoverOffset === -1, b = (r) => {
94
+ r.button !== 0 || e.kind === "action" && !e.reorderable || e.onDragBegin(r, e.kind, e.id, e.label, e.icon, r.currentTarget, e.canvasPlacement, null);
95
+ }, _ = (r) => {
96
+ e.onContextMenu && (r.preventDefault(), r.stopPropagation(), e.onContextMenu({
97
+ trigger: r.currentTarget,
98
+ clientX: r.clientX,
99
+ clientY: r.clientY,
100
100
  source: "pointer"
101
101
  }));
102
- }, S = (i) => {
103
- e.onReorderKey?.(i), !(i.defaultPrevented || !e.onContextMenu || !it(i)) && (i.preventDefault(), i.stopPropagation(), e.onContextMenu(rt(i.currentTarget)));
104
- }, $ = (i) => {
105
- i.detail !== 0 && !(e.kind === "action" && !e.reorderable) || e.onKeyboardActivate(i.currentTarget);
106
- }, D = () => {
107
- const i = e.presentation;
108
- return i ? i.count === 0 ? `${e.label} +` : i.active && i.currentIndex !== null ? `${e.label} ${i.currentIndex + 1}/${i.count}` : i.count > 1 ? `${e.label} ${i.count}` : e.label : e.label;
102
+ }, I = (r) => {
103
+ e.onReorderKey?.(r), !(r.defaultPrevented || !e.onContextMenu || !st(r)) && (r.preventDefault(), r.stopPropagation(), e.onContextMenu(ut(r.currentTarget)));
104
+ }, O = (r) => {
105
+ r.detail !== 0 && !(e.kind === "action" && !e.reorderable) || e.onKeyboardActivate(r.currentTarget);
106
+ }, x = () => {
107
+ const r = e.presentation;
108
+ return r ? r.count === 0 ? `${e.label} +` : r.active && r.currentIndex !== null ? `${e.label} ${r.currentIndex + 1}/${r.count}` : r.count > 1 ? `${e.label} ${r.count}` : e.label : e.label;
109
109
  };
110
110
  return (() => {
111
- var i = kt();
112
- i.$$keydown = S, i.$$contextmenu = C, i.$$click = $, i.$$pointerdown = _, i.addEventListener("pointerleave", () => e.onLeave()), i.addEventListener("pointerenter", () => e.onEnter()), i.addEventListener("dragstart", (r) => r.preventDefault());
113
- var b = m;
114
- return typeof b == "function" ? Le(b, i) : m = i, h(i, g(X, {
111
+ var r = Et();
112
+ r.$$keydown = I, r.$$contextmenu = _, r.$$click = O, r.$$pointerdown = b, r.addEventListener("pointerleave", () => e.onLeave()), r.addEventListener("pointerenter", () => e.onEnter()), r.addEventListener("dragstart", (i) => i.preventDefault());
113
+ var w = g;
114
+ return typeof w == "function" ? Te(w, r) : g = r, h(r, f(X, {
115
115
  get when() {
116
116
  return e.dropEdge;
117
117
  },
118
118
  get children() {
119
- var r = ft();
120
- return H((l) => {
121
- var E = e.dropEdge === "before" ? "-3px" : void 0, P = e.dropEdge === "after" ? "-3px" : void 0;
122
- return E !== l.e && se(r, "left", l.e = E), P !== l.t && se(r, "right", l.t = P), l;
119
+ var i = _t();
120
+ return V((s) => {
121
+ var E = e.dropEdge === "before" ? "-3px" : void 0, M = e.dropEdge === "after" ? "-3px" : void 0;
122
+ return E !== s.e && ge(i, "left", s.e = E), M !== s.t && ge(i, "right", s.t = M), s;
123
123
  }, {
124
124
  e: void 0,
125
125
  t: void 0
126
- }), r;
126
+ }), i;
127
127
  }
128
- }), null), h(i, g(ie.span, {
128
+ }), null), h(r, f(ae.span, {
129
129
  class: "workbench-dock__tile",
130
130
  get animate() {
131
- return s();
131
+ return u();
132
132
  },
133
133
  get transition() {
134
134
  return {
135
- duration: ae.fast,
136
- easing: re.easeOut
135
+ duration: le.fast,
136
+ easing: ce.easeOut
137
137
  };
138
138
  },
139
139
  get children() {
140
- return g($e, {
140
+ return f(Le, {
141
141
  get component() {
142
142
  return e.icon;
143
143
  },
144
144
  class: "workbench-dock__icon"
145
145
  });
146
146
  }
147
- }), null), h(i, g(ie.span, {
147
+ }), null), h(r, f(ae.span, {
148
148
  class: "workbench-dock__tooltip",
149
149
  get animate() {
150
150
  return {
151
- opacity: u() ? 1 : 0,
152
- y: u() ? -6 : 0
151
+ opacity: d() ? 1 : 0,
152
+ y: d() ? -6 : 0
153
153
  };
154
154
  },
155
155
  get transition() {
156
156
  return {
157
- duration: ae.fast,
158
- easing: re.easeOut
157
+ duration: le.fast,
158
+ easing: ce.easeOut
159
159
  };
160
160
  },
161
161
  get children() {
162
- return I(() => e.activationMode === "focus-cycle")() ? D() : e.label;
162
+ return $(() => e.activationMode === "focus-cycle")() ? x() : e.label;
163
163
  }
164
- }), null), H((r) => {
165
- var l = `${e.kind}:${e.id}`, E = e.kind === "action" ? e.id : void 0, P = e.reorderable ? "Alt+Shift+ArrowLeft Alt+Shift+ArrowRight" : void 0, R = e.kind === "host" ? e.id : void 0, J = e.kind === "widget" || e.kind === "tool" ? e.id : void 0, Q = !!e.active, Z = !!(e.filterable && !e.visible), B = !!u(), p = !!e.isDragging, W = e.kind === "action", G = e.kind === "action" ? e.label : e.activationMode === "focus-cycle" && e.presentation ? D() : e.filterable ? `${e.label} — click to solo, drag to canvas to create` : `${e.label} — drag to canvas to create`, ee = e.activationMode === "focus-cycle" && e.presentation ? e.presentation.active : e.active, te = e.onContextMenu ? "menu" : void 0;
166
- return l !== r.e && T(i, "data-floe-bar-key", r.e = l), E !== r.t && T(i, "data-workbench-dock-action", r.t = E), P !== r.a && T(i, "aria-keyshortcuts", r.a = P), R !== r.o && T(i, "data-workbench-dock-item", r.o = R), J !== r.i && T(i, "data-workbench-dock-component", r.i = J), Q !== r.n && i.classList.toggle("is-active", r.n = Q), Z !== r.s && i.classList.toggle("is-filter-muted", r.s = Z), B !== r.h && i.classList.toggle("is-hovered", r.h = B), p !== r.r && i.classList.toggle("is-source-dragging", r.r = p), W !== r.d && i.classList.toggle("workbench-dock__action", r.d = W), G !== r.l && T(i, "aria-label", r.l = G), ee !== r.u && T(i, "aria-pressed", r.u = ee), te !== r.c && T(i, "aria-haspopup", r.c = te), r;
164
+ }), null), V((i) => {
165
+ var s = `${e.kind}:${e.id}`, E = e.kind === "action" ? e.id : void 0, M = e.reorderable ? "Alt+Shift+ArrowLeft Alt+Shift+ArrowRight" : void 0, R = e.kind === "host" ? e.id : void 0, Z = e.kind === "widget" || e.kind === "tool" ? e.id : void 0, p = !!e.active, ee = !!(e.filterable && !e.visible), B = !!d(), q = !!e.isDragging, te = e.kind === "action", N = e.kind === "action" ? e.label : e.activationMode === "focus-cycle" && e.presentation ? x() : e.filterable ? `${e.label} — click to solo, drag to canvas to create` : `${e.label} — drag to canvas to create`, U = e.activationMode === "focus-cycle" && e.presentation ? e.presentation.active : e.active, ne = e.onContextMenu ? "menu" : void 0;
166
+ return s !== i.e && T(r, "data-floe-bar-key", i.e = s), E !== i.t && T(r, "data-workbench-dock-action", i.t = E), M !== i.a && T(r, "aria-keyshortcuts", i.a = M), R !== i.o && T(r, "data-workbench-dock-item", i.o = R), Z !== i.i && T(r, "data-workbench-dock-component", i.i = Z), p !== i.n && r.classList.toggle("is-active", i.n = p), ee !== i.s && r.classList.toggle("is-filter-muted", i.s = ee), B !== i.h && r.classList.toggle("is-hovered", i.h = B), q !== i.r && r.classList.toggle("is-source-dragging", i.r = q), te !== i.d && r.classList.toggle("workbench-dock__action", i.d = te), N !== i.l && T(r, "aria-label", i.l = N), U !== i.u && T(r, "aria-pressed", i.u = U), ne !== i.c && T(r, "aria-haspopup", i.c = ne), i;
167
167
  }, {
168
168
  e: void 0,
169
169
  t: void 0,
@@ -178,576 +178,613 @@ function $t(e) {
178
178
  l: void 0,
179
179
  u: void 0,
180
180
  c: void 0
181
- }), i;
181
+ }), r;
182
182
  })();
183
183
  }
184
- function Vt(e) {
185
- const [m, s] = oe(null), [u, _] = oe(null), C = /* @__PURE__ */ new Map(), [S, $] = oe(), [D, i] = oe(!1);
186
- let b, r, l, E, P = null;
184
+ function Zt(e) {
185
+ const [g, u] = ie(null), [d, b] = ie(null), _ = /* @__PURE__ */ new Map(), [I, O] = ie(void 0, {
186
+ equals: tt
187
+ }), [x, r] = ie(!1);
188
+ let w, i, s, E, M = null;
187
189
  const R = () => e.activationMode === "focus-cycle" ? "focus-cycle" : "solo-filter";
188
- j(() => {
189
- E?.stop(), r?.stop({
190
+ Q(() => {
191
+ E?.stop(), i?.stop({
190
192
  reason: "manual_stop",
191
193
  commit: !1
192
- }), r = void 0, l?.clear(), l = void 0, u()?.stopInteraction(), e.onDragPreviewChange?.(null), e.registerExternalDockDragController?.(null);
193
- }), q(() => {
194
- e.onDragPreviewChange?.(u()?.preview ?? null);
195
- }), q(() => {
196
- const t = (n) => {
197
- n.key !== "Escape" || !u() || (n.preventDefault(), r?.stop({
194
+ }), i = void 0, s?.clear(), s = void 0, d()?.stopInteraction(), e.onDragPreviewChange?.(null), e.registerExternalDockDragController?.(null);
195
+ }), J(() => {
196
+ e.onDragPreviewChange?.(d()?.preview ?? null);
197
+ }), J(() => {
198
+ const n = (o) => {
199
+ o.key !== "Escape" || !d() || (o.preventDefault(), i?.stop({
198
200
  reason: "manual_stop",
199
201
  commit: !1
200
202
  }));
201
203
  };
202
- window.addEventListener("keydown", t, !0), j(() => window.removeEventListener("keydown", t, !0));
203
- }), q(() => {
204
- if (!D() || typeof window > "u") return;
205
- const t = (o) => {
206
- b && o.target instanceof Node && b.contains(o.target) || i(!1);
207
- }, n = (o) => {
208
- o.key === "Escape" && i(!1);
204
+ window.addEventListener("keydown", n, !0), Q(() => window.removeEventListener("keydown", n, !0));
205
+ }), J(() => {
206
+ if (!x() || typeof window > "u") return;
207
+ const n = (t) => {
208
+ w && t.target instanceof Node && w.contains(t.target) || r(!1);
209
+ }, o = (t) => {
210
+ t.key === "Escape" && r(!1);
209
211
  };
210
- window.addEventListener("pointerdown", t, !0), window.addEventListener("keydown", n, !0), j(() => {
211
- window.removeEventListener("pointerdown", t, !0), window.removeEventListener("keydown", n, !0);
212
+ window.addEventListener("pointerdown", n, !0), window.addEventListener("keydown", o, !0), Q(() => {
213
+ window.removeEventListener("pointerdown", n, !0), window.removeEventListener("keydown", o, !0);
212
214
  });
213
215
  });
214
- const J = (t) => {
215
- const n = m();
216
- return n === null || F()[n - 1]?.kind === "action" ? 0 : n === t ? -1 : n === t + 1 ? -2 : n === t - 1 ? 1 : 0;
217
- }, Q = () => {
218
- E?.stop(), E = void 0, P = null;
219
- }, Z = () => {
220
- !e.viewport || !e.onViewportCommit || (P = e.viewport, E?.stop(), E = lt({
216
+ const Z = (n) => {
217
+ const o = g();
218
+ return o === null || F()[o - 1]?.kind === "action" ? 0 : o === n ? -1 : o === n + 1 ? -2 : o === n - 1 ? 1 : 0;
219
+ }, p = () => {
220
+ E?.stop(), E = void 0, M = null;
221
+ }, ee = () => {
222
+ !e.viewport || !e.onViewportCommit || (M = e.viewport, E?.stop(), E = gt({
221
223
  readFrame: () => {
222
- const n = b?.closest(".workbench-surface")?.querySelector(Oe);
223
- return n instanceof HTMLElement ? Ae(n) : null;
224
+ const o = w?.closest(".workbench-surface")?.querySelector(Ae);
225
+ return o instanceof HTMLElement ? Xe(o) : null;
224
226
  },
225
- readViewport: () => P ?? e.viewport ?? null,
226
- commitViewport: (t) => {
227
- P = t, e.onViewportCommit?.(t);
227
+ readViewport: () => M ?? e.viewport ?? null,
228
+ commitViewport: (n) => {
229
+ M = n, e.onViewportCommit?.(n);
228
230
  },
229
231
  onPanStart: () => e.onViewportInteractionStart?.("pan"),
230
232
  shouldPan: () => {
231
- const t = u();
232
- return !!(t?.moved && t.hasEnteredCanvas && !Se(t.clientX, t.clientY, b));
233
+ const n = d();
234
+ return !!(n?.moved && n.hasEnteredCanvas && !$e(n.clientX, n.clientY, w));
233
235
  }
234
236
  }));
235
- }, B = (t, n, o, d) => {
237
+ }, B = (n, o, t, c) => {
236
238
  if (e.onDockActivation?.({
237
- kind: t,
238
- id: String(n)
239
- }), t === "external") return;
240
- if (t === "action") {
241
- e.dockActions?.find((v) => v.id === n)?.onActivate(d);
239
+ kind: n,
240
+ id: String(o)
241
+ }), n === "external") return;
242
+ if (n === "action") {
243
+ e.dockActions?.find((v) => v.id === o)?.onActivate(c);
242
244
  return;
243
245
  }
244
- if (t === "host") {
245
- e.dockItems?.find((v) => v.id === n)?.onActivate?.(d);
246
+ if (n === "host") {
247
+ e.dockItems?.find((v) => v.id === o)?.onActivate?.(c);
246
248
  return;
247
249
  }
248
- const c = {
249
- kind: t,
250
- id: n,
251
- label: o,
252
- trigger: d
250
+ const a = {
251
+ kind: n,
252
+ id: o,
253
+ label: t,
254
+ trigger: c
253
255
  };
254
- if (!e.onItemClick?.(c)) {
256
+ if (!e.onItemClick?.(a)) {
255
257
  if (R() === "focus-cycle") {
256
- e.onFocusCycleItem?.(c);
258
+ e.onFocusCycleItem?.(a);
257
259
  return;
258
260
  }
259
- y() !== "background" && e.onSoloFilter(String(n), we());
261
+ C() !== "background" && e.onSoloFilter(String(o), Ee());
260
262
  }
261
- }, p = (t) => {
262
- const n = u();
263
- if (!n) return;
264
- const o = !n.moved, d = P ?? e.viewport;
265
- n.stopInteraction(), Q();
266
- const c = S();
267
- if ($(void 0), _(null), r = void 0, n.kind === "external" && n.moved && l?.expire(), !!t) {
268
- if (o) {
269
- if (n.kind === "external" || !(n.trigger instanceof HTMLButtonElement)) return;
270
- B(n.kind, n.id, n.label, n.trigger);
271
- return;
272
- }
273
- if (n.overDock && n.kind !== "external" && c && e.customization?.onOrderChange) {
274
- e.customization.onOrderChange(c.order), C.get(`${n.kind}:${n.id}`)?.focus({
275
- preventScroll: !0
276
- });
277
- return;
278
- }
279
- if (t && n.overDock && n.dockDrop) {
280
- n.dockDrop();
281
- return;
282
- }
283
- if (t && n.overCanvas && n.canvasPlacement) {
284
- const v = n.canvasFrame && d ? ot(n.canvasFrame, d, {
285
- clientX: n.clientX,
286
- clientY: n.clientY
287
- }) : null, a = n.canvasFrame ? {
288
- dropAllowed: n.overCanvas,
289
- canvasFrame: n.canvasFrame,
290
- ...v ? {
291
- worldPoint: v
292
- } : {}
293
- } : void 0;
294
- n.canvasPlacement.onDrop(n.clientX, n.clientY, a);
295
- }
263
+ }, q = (n) => {
264
+ s?.clear();
265
+ let o;
266
+ const t = () => {
267
+ o !== void 0 && window.clearTimeout(o), n.removeEventListener("click", c, !0), window.removeEventListener("pointerdown", a, !0), s?.clear === t && (s = void 0);
268
+ }, c = (l) => {
269
+ l.preventDefault(), l.stopImmediatePropagation(), t();
270
+ }, a = () => t(), v = () => {
271
+ o !== void 0 && window.clearTimeout(o), o = window.setTimeout(t, St);
272
+ };
273
+ n.addEventListener("click", c, !0), window.addEventListener("pointerdown", a, !0), s = {
274
+ clear: t,
275
+ expire: v
276
+ };
277
+ }, te = (n, o) => {
278
+ const t = d();
279
+ if (!t) return;
280
+ const c = !t.moved, a = M ?? e.viewport;
281
+ t.stopInteraction(), p();
282
+ const v = I();
283
+ O(void 0), b(null), i = void 0, (t.kind === "external" || t.overflow) && t.moved && s?.expire();
284
+ const l = t.moved ? t.overflow : void 0, D = (P) => {
285
+ l?.onEnd({
286
+ dropped: P,
287
+ reason: o
288
+ });
289
+ };
290
+ if (!n) {
291
+ t.overflow && !t.moved && (q(t.trigger), s?.expire()), D(!1);
292
+ return;
293
+ }
294
+ if (c) {
295
+ if (t.kind === "external" || t.overflow || !(t.trigger instanceof HTMLButtonElement)) return;
296
+ B(t.kind, t.id, t.label, t.trigger);
297
+ return;
296
298
  }
297
- }, W = (t, n, o, d, c, v, a, M, O = "before-components") => {
298
- t.preventDefault(), r?.stop({
299
+ if (t.overDock && t.kind !== "external" && v && e.customization?.onOrderChange) {
300
+ e.customization.onOrderChange(v.order), _.get(`${t.kind}:${t.id}`)?.focus({
301
+ preventScroll: !0
302
+ });
303
+ return;
304
+ }
305
+ if (n && t.overDock && t.dockDrop) {
306
+ t.dockDrop();
307
+ return;
308
+ }
309
+ if (n && t.overCanvas && t.canvasPlacement) {
310
+ const P = t.canvasFrame && a ? dt(t.canvasFrame, a, {
311
+ clientX: t.clientX,
312
+ clientY: t.clientY
313
+ }) : null, A = t.canvasFrame ? {
314
+ dropAllowed: t.overCanvas,
315
+ canvasFrame: t.canvasFrame,
316
+ ...P ? {
317
+ worldPoint: P
318
+ } : {}
319
+ } : void 0;
320
+ t.canvasPlacement.onDrop(t.clientX, t.clientY, A), D(!0);
321
+ return;
322
+ }
323
+ D(!1);
324
+ }, N = (n, o, t, c, a, v, l, D, P = "before-components", A) => {
325
+ n.preventDefault(), i?.stop({
299
326
  reason: "manual_stop",
300
327
  commit: !1
301
- }), Z();
302
- const V = Mt(b);
303
- _({
304
- kind: n,
305
- id: o,
306
- label: d,
307
- icon: c,
308
- pointerId: t.pointerId,
309
- startClientX: t.clientX,
310
- startClientY: t.clientY,
311
- clientX: t.clientX,
312
- clientY: t.clientY,
328
+ }), ee();
329
+ const y = Tt(w), oe = getComputedStyle(v).transform, z = typeof DOMMatrix == "function" ? new DOMMatrix(oe === "none" ? void 0 : oe).m41 : 0;
330
+ b({
331
+ kind: o,
332
+ id: t,
333
+ label: c,
334
+ icon: a,
335
+ pointerId: n.pointerId,
336
+ startClientX: n.clientX,
337
+ startClientY: n.clientY,
338
+ startTranslateX: z,
339
+ clientX: n.clientX,
340
+ clientY: n.clientY,
313
341
  moved: !1,
314
342
  overCanvas: !1,
315
343
  hasEnteredCanvas: !1,
316
- canvasFrame: V,
344
+ canvasFrame: y,
317
345
  preview: null,
318
- canvasPlacement: a,
319
- dockDrop: M,
320
- dockPlacement: O,
321
- stopInteraction: tt({
346
+ canvasPlacement: l,
347
+ dockDrop: D,
348
+ dockPlacement: P,
349
+ stopInteraction: ct({
322
350
  kind: "drag",
323
351
  cursor: "grabbing"
324
352
  }),
325
353
  trigger: v,
326
- overDock: !1
354
+ overDock: !1,
355
+ overflow: A
327
356
  });
328
- const w = (f) => {
329
- let x = !1;
330
- _((k) => {
331
- if (!k || k.pointerId !== f.pointerId) return k;
332
- const ne = f.clientX - k.startClientX, Ke = f.clientY - k.startClientY, z = k.moved || Math.abs(ne) > Me || Math.abs(Ke) > Me;
333
- if (k.kind === "external" && z && !k.moved) {
334
- let K;
335
- const U = () => {
336
- K !== void 0 && window.clearTimeout(K), k.trigger.removeEventListener("click", ye, !0), window.removeEventListener("pointerdown", De, !0), l?.clear === U && (l = void 0);
337
- }, ye = (xe) => {
338
- xe.preventDefault(), xe.stopImmediatePropagation(), U();
339
- }, De = () => U(), Ge = () => {
340
- K !== void 0 && window.clearTimeout(K), K = window.setTimeout(U, Ct);
341
- };
342
- k.trigger.addEventListener("click", ye, !0), window.addEventListener("pointerdown", De, !0), l = {
343
- clear: U,
344
- expire: Ge
345
- };
346
- }
347
- const N = Se(f.clientX, f.clientY, b);
348
- $(z && N && k.kind !== "external" && e.customization?.onOrderChange ? pe(F().map((K) => K.key), `${k.kind}:${k.id}`, C, "x", f.clientX) : void 0);
349
- const A = k.canvasFrame, _e = z && It(f.clientX, f.clientY, A), Ee = _e && !N, Ne = z && !N && St(A, k.clientX, k.clientY, f.clientX, f.clientY), Ce = k.hasEnteredCanvas || _e || Ne;
350
- x = z && Ce && !N;
351
- const He = A ? Ie(f.clientX, A.left, A.right) : f.clientX, We = A ? Ie(f.clientY, A.top, A.bottom) : f.clientY;
357
+ const re = ot(_, "x"), j = (k) => {
358
+ let W = !1;
359
+ b((m) => {
360
+ if (!m || m.pointerId !== k.pointerId) return m;
361
+ const We = k.clientX - m.startClientX, Ge = k.clientY - m.startClientY, H = m.moved || Math.abs(We) > Ie || Math.abs(Ge) > Ie;
362
+ (m.kind === "external" || m.overflow) && H && !m.moved && q(m.trigger);
363
+ const G = $e(k.clientX, k.clientY, w);
364
+ O(H && G && m.kind !== "external" && e.customization?.onOrderChange ? it(F().map((je) => je.key), `${m.kind}:${m.id}`, _, "x", k.clientX, re) : void 0);
365
+ const L = m.canvasFrame, xe = H && At(k.clientX, k.clientY, L), Pe = xe && !G, Ve = H && !G && Xt(L, m.clientX, m.clientY, k.clientX, k.clientY), Me = m.hasEnteredCanvas || xe || Ve;
366
+ W = H && Me && !G;
367
+ const qe = L ? Oe(k.clientX, L.left, L.right) : k.clientX, Ue = L ? Oe(k.clientY, L.top, L.bottom) : k.clientY;
352
368
  return {
353
- ...k,
354
- clientX: f.clientX,
355
- clientY: f.clientY,
356
- moved: z,
357
- overDock: N,
358
- overCanvas: Ee,
359
- hasEnteredCanvas: Ce,
360
- preview: z && (!N || !e.customization?.onOrderChange) && A && k.canvasPlacement?.preview ? {
361
- kind: k.canvasPlacement.preview.kind,
362
- id: k.canvasPlacement.preview.id,
363
- label: k.label,
364
- clientX: He,
365
- clientY: We,
366
- dropAllowed: Ee,
367
- canvasFrame: A
369
+ ...m,
370
+ clientX: k.clientX,
371
+ clientY: k.clientY,
372
+ moved: H,
373
+ overDock: G,
374
+ overCanvas: Pe,
375
+ hasEnteredCanvas: Me,
376
+ preview: H && (!G || !e.customization?.onOrderChange) && L && m.canvasPlacement?.preview ? {
377
+ kind: m.canvasPlacement.preview.kind,
378
+ id: m.canvasPlacement.preview.id,
379
+ label: m.label,
380
+ clientX: qe,
381
+ clientY: Ue,
382
+ dropAllowed: Pe,
383
+ canvasFrame: L
368
384
  } : null
369
385
  };
370
- }), x && E?.updatePointer(f.clientX, f.clientY);
386
+ });
387
+ const K = d();
388
+ K?.moved && K.overflow && !ye && (ye = !0, i?.capturePointer(), K.overflow.onStart()), W && E?.updatePointer(k.clientX, k.clientY);
371
389
  };
372
- r = nt({
373
- pointerEvent: t,
374
- captureEl: t.currentTarget,
375
- onMove: w,
390
+ let ye = !1;
391
+ i = lt({
392
+ pointerEvent: n,
393
+ captureEl: A ? w : n.currentTarget,
394
+ capturePointer: !A,
395
+ onMove: j,
376
396
  onEnd: ({
377
- commit: f,
378
- snapshot: x
397
+ commit: k,
398
+ snapshot: W,
399
+ reason: K
379
400
  }) => {
380
- w({
381
- pointerId: x.pointerId,
382
- clientX: x.latestClientX,
383
- clientY: x.latestClientY
384
- }), p(f);
401
+ j({
402
+ pointerId: W.pointerId,
403
+ clientX: W.latestClientX,
404
+ clientY: W.latestClientY
405
+ }), te(k && (K === "pointer_up" || K === "buttons_released"), K);
385
406
  }
386
407
  });
387
- }, G = (t) => t ? {
408
+ }, U = (n) => n ? {
388
409
  preview: {
389
410
  kind: "widget",
390
- id: t.widgetType
411
+ id: n.widgetType
391
412
  },
392
- onDrop: (n, o, d) => {
393
- if (!d?.worldPoint) return;
394
- const c = ct(t.widgetType, e.widgetDefinitions);
395
- t.onDrop({
396
- widgetType: t.widgetType,
397
- centerWorld: d.worldPoint,
398
- frame: at(c, {
413
+ onDrop: (o, t, c) => {
414
+ if (!c?.worldPoint) return;
415
+ const a = ft(n.widgetType, e.widgetDefinitions);
416
+ n.onDrop({
417
+ widgetType: n.widgetType,
418
+ centerWorld: c.worldPoint,
419
+ frame: vt(a, {
399
420
  anchor: "center",
400
- worldX: d.worldPoint.worldX,
401
- worldY: d.worldPoint.worldY
421
+ worldX: c.worldPoint.worldX,
422
+ worldY: c.worldPoint.worldY
402
423
  })
403
424
  });
404
425
  }
405
- } : null, ee = (t, n) => {
406
- t.button !== 0 || !(t.currentTarget instanceof HTMLElement) || (l?.clear(), l = void 0, W(t, "external", n.id, n.label, n.icon, t.currentTarget, G(n.canvasPlacement), n.onDropToDock ?? null, n.dockPlacement ?? "before-components"));
426
+ } : null, ne = (n, o) => {
427
+ n.button !== 0 || !(n.currentTarget instanceof HTMLElement) || (s?.clear(), s = void 0, N(n, "external", o.id, o.label, o.icon, n.currentTarget, U(o.canvasPlacement), o.onDropToDock ?? null, o.dockPlacement ?? "before-components"));
407
428
  };
408
- q(() => {
429
+ J(() => {
409
430
  e.registerExternalDockDragController?.({
410
- begin: ee
411
- }), j(() => e.registerExternalDockDragController?.(null));
431
+ begin: ne
432
+ }), Q(() => e.registerExternalDockDragController?.(null));
412
433
  });
413
- const te = () => u()?.kind === "external" ? u()?.icon : void 0, y = () => e.mode === "background" || e.mode === "annotation" ? "background" : "work", ce = L(() => Dt.map((t) => ({
414
- ...t,
415
- icon: e.modeIcons?.[t.mode] ?? t.icon
416
- }))), ve = L(() => ce().find((t) => t.mode === y()) ?? ce()[0]), ge = L(() => {
417
- if (y() === "background")
418
- return Pt.map((o) => ({
419
- id: o.tool,
434
+ const Re = () => d()?.kind === "external" ? d()?.icon : void 0, C = () => e.mode === "background" || e.mode === "annotation" ? "background" : "work", de = S(() => Ot.map((n) => ({
435
+ ...n,
436
+ icon: e.modeIcons?.[n.mode] ?? n.icon
437
+ }))), ke = S(() => de().find((n) => n.mode === C()) ?? de()[0]), we = S(() => {
438
+ if (C() === "background")
439
+ return Lt.map((t) => ({
440
+ id: t.tool,
420
441
  kind: "tool",
421
- label: o.label,
422
- icon: o.icon
442
+ label: t.label,
443
+ icon: t.icon
423
444
  }));
424
- const t = [...xt.map((o) => ({
425
- id: o.tool,
445
+ const n = [...$t.map((t) => ({
446
+ id: t.tool,
426
447
  kind: "tool",
427
- label: o.label,
428
- icon: o.icon
429
- })), ...e.widgetDefinitions.map((o) => ({
430
- id: o.type,
448
+ label: t.label,
449
+ icon: t.icon
450
+ })), ...e.widgetDefinitions.map((t) => ({
451
+ id: t.type,
431
452
  kind: "widget",
432
- label: o.label,
433
- icon: o.icon
434
- }))], n = new Map(e.componentOrder?.map((o, d) => [o, d]));
435
- return t.sort((o, d) => (n.get(o.id) ?? Number.MAX_SAFE_INTEGER) - (n.get(d.id) ?? Number.MAX_SAFE_INTEGER));
436
- }), Te = L(() => y() === "background" ? [] : [...e.dockItems ?? []]), Xe = L(() => y() === "background" ? [] : [...e.dockActions ?? []]), fe = L(() => {
437
- const t = [...Xe().map((o) => ({
438
- ...o,
439
- action: o,
453
+ label: t.label,
454
+ icon: t.icon
455
+ }))], o = new Map(e.componentOrder?.map((t, c) => [t, c]));
456
+ return n.sort((t, c) => (o.get(t.id) ?? Number.MAX_SAFE_INTEGER) - (o.get(c.id) ?? Number.MAX_SAFE_INTEGER));
457
+ }), Fe = S(() => C() === "background" ? [] : [...e.dockItems ?? []]), Ye = S(() => C() === "background" ? [] : [...e.dockActions ?? []]), se = (n) => n.host ? U(n.host.canvasPlacement) : n.kind === "action" ? null : {
458
+ preview: {
459
+ kind: n.kind,
460
+ id: n.id
461
+ },
462
+ onDrop: (o, t, c) => n.kind === "widget" ? e.onCreateAt?.(n.id, o, t, c) : e.onCreateToolAt?.(n.id, o, t, c)
463
+ }, he = S(() => {
464
+ const n = [...Ye().map((t) => ({
465
+ ...t,
466
+ action: t,
440
467
  kind: "action",
441
- key: `action:${o.id}`,
442
- group: o.dockPlacement === "after-components" ? 3 : 0,
443
- focus: () => C.get(`action:${o.id}`)?.focus({
468
+ key: `action:${t.id}`,
469
+ group: t.dockPlacement === "after-components" ? 3 : 0,
470
+ focus: () => _.get(`action:${t.id}`)?.focus({
444
471
  preventScroll: !0
445
472
  }),
446
- activate: (d) => B("action", o.id, o.label, d)
447
- })), ...Te().map((o) => ({
448
- ...o,
449
- host: o,
473
+ activate: (c) => B("action", t.id, t.label, c)
474
+ })), ...Fe().map((t) => ({
475
+ ...t,
476
+ host: t,
450
477
  kind: "host",
451
- key: `host:${o.id}`,
452
- group: o.dockPlacement === "after-components" ? 4 : 1,
453
- focus: () => C.get(`host:${o.id}`)?.focus({
478
+ key: `host:${t.id}`,
479
+ group: t.dockPlacement === "after-components" ? 4 : 1,
480
+ focus: () => _.get(`host:${t.id}`)?.focus({
454
481
  preventScroll: !0
455
482
  }),
456
- activate: (d) => B("host", o.id, o.label, d)
457
- })), ...ge().map((o) => ({
458
- ...o,
459
- key: `${o.kind}:${o.id}`,
483
+ activate: (c) => B("host", t.id, t.label, c)
484
+ })), ...we().map((t) => ({
485
+ ...t,
486
+ key: `${t.kind}:${t.id}`,
460
487
  group: 2,
461
- focus: () => C.get(`${o.kind}:${o.id}`)?.focus({
488
+ focus: () => _.get(`${t.kind}:${t.id}`)?.focus({
462
489
  preventScroll: !0
463
490
  }),
464
- activate: (d) => B(o.kind, o.id, o.label, d)
491
+ activate: (c) => B(t.kind, t.id, t.label, c)
465
492
  }))];
466
- t.sort((o, d) => o.group - d.group);
467
- const n = y() === "work" ? e.customization?.order : void 0;
468
- return n && t.sort((o, d) => {
469
- const c = n.indexOf(o.key), v = n.indexOf(d.key);
470
- return (c < 0 ? 1 / 0 : c) - (v < 0 ? 1 / 0 : v);
471
- }), t;
472
- }), ke = L(() => y() === "work" && e.customization?.overflow ? fe().filter((t) => e.customization?.hidden?.includes(t.key)) : []), F = L(() => fe().filter((t) => !ke().includes(t)));
473
- Qe({
474
- keys: () => F().map((t) => t.key),
475
- elements: C,
476
- preview: () => S()?.order,
493
+ n.sort((t, c) => t.group - c.group);
494
+ const o = C() === "work" ? e.customization?.order : void 0;
495
+ return o && n.sort((t, c) => {
496
+ const a = o.indexOf(t.key), v = o.indexOf(c.key);
497
+ return (a < 0 ? 1 / 0 : a) - (v < 0 ? 1 / 0 : v);
498
+ }), n.map((t) => ({
499
+ ...t,
500
+ beginDrag: se(t) ? (c, a) => {
501
+ c.button !== 0 || !(c.currentTarget instanceof HTMLElement) || N(c, t.kind, t.id, t.label, t.icon, c.currentTarget, se(t), null, "before-components", a);
502
+ } : void 0
503
+ }));
504
+ }), be = S(() => C() === "work" && e.customization?.overflow ? he().filter((n) => e.customization?.hidden?.includes(n.key)) : []), F = S(() => he().filter((n) => !be().includes(n))), ue = S(() => {
505
+ const n = d();
506
+ return n?.moved && n.overDock && !n.overflow && n.kind !== "external" && e.customization?.onOrderChange ? `${n.kind}:${n.id}` : void 0;
507
+ });
508
+ nt({
509
+ keys: () => F().map((n) => n.key),
510
+ elements: _,
511
+ preview: () => I()?.order,
512
+ drag: () => {
513
+ const n = ue(), o = d();
514
+ return n && o ? {
515
+ key: n,
516
+ x: o.clientX - o.startClientX + o.startTranslateX,
517
+ y: 0
518
+ } : void 0;
519
+ },
477
520
  axis: "x"
478
521
  });
479
- const me = L(() => new Map(F().map((t) => [t.key, t]))), Re = (t, n) => {
480
- if (y() !== "work" || !e.customization?.onOrderChange) return;
481
- const o = Ze(F().map((d) => d.key), t, n, "x");
482
- o && (e.customization.onOrderChange(o), C.get(t)?.focus({
522
+ const _e = S(() => new Map(F().map((n) => [n.key, n]))), Be = (n, o) => {
523
+ if (C() !== "work" || !e.customization?.onOrderChange) return;
524
+ const t = rt(F().map((c) => c.key), n, o, "x");
525
+ t && (e.customization.onOrderChange(t), _.get(n)?.focus({
483
526
  preventScroll: !0
484
527
  }));
485
528
  };
486
- q(() => {
487
- F().map((t) => t.key).join("\0"), r && r.stop({
529
+ J(() => {
530
+ F().map((n) => n.key).join("\0"), i && i.stop({
488
531
  commit: !1
489
532
  });
490
533
  });
491
- const we = L(() => ge().map((t) => String(t.id))), le = () => y() !== "background", Fe = (t) => !le() || e.filters[t] !== !1, Ye = (t) => {
492
- if (!le())
534
+ const Ee = S(() => we().map((n) => String(n.id))), ve = () => C() !== "background", ze = (n) => !ve() || e.filters[n] !== !1, Ke = (n) => {
535
+ if (!ve())
493
536
  return !1;
494
- const n = we();
495
- return n.length > 1 && n.every((o) => e.filters[o] !== !1 == (o === t));
496
- }, Be = (t, n) => R() === "focus-cycle" ? e.resolveItemPresentation?.({
497
- kind: t,
498
- id: n
499
- }) : void 0, de = () => m() === 0, ze = () => ({
537
+ const o = Ee();
538
+ return o.length > 1 && o.every((t) => e.filters[t] !== !1 == (t === n));
539
+ }, He = (n, o) => R() === "focus-cycle" ? e.resolveItemPresentation?.({
540
+ kind: n,
541
+ id: o
542
+ }) : void 0, fe = () => g() === 0, Ne = () => ({
500
543
  scale: 1,
501
544
  y: 0,
502
545
  x: 0
503
- }), he = (t) => {
504
- const n = u();
505
- return !!(n?.kind === "external" && n.moved && n.dockPlacement === t);
506
- }, be = () => (() => {
507
- var t = mt();
508
- return h(t, g(X, {
546
+ }), Ce = (n) => {
547
+ const o = d();
548
+ return !!(o?.kind === "external" && o.moved && o.dockPlacement === n);
549
+ }, De = () => (() => {
550
+ var n = Ct();
551
+ return h(n, f(X, {
509
552
  get when() {
510
- return te();
553
+ return Re();
511
554
  },
512
- children: (n) => {
513
- const o = n();
514
- return g(o, {
555
+ children: (o) => {
556
+ const t = o();
557
+ return f(t, {
515
558
  class: "workbench-dock__icon"
516
559
  });
517
560
  }
518
- })), H(() => t.classList.toggle("is-drop-allowed", !!u()?.overDock)), t;
561
+ })), V(() => n.classList.toggle("is-drop-allowed", !!d()?.overDock)), n;
519
562
  })();
520
563
  return [(() => {
521
- var t = ht(), n = t.firstChild, o = n.firstChild;
522
- t.addEventListener("pointerleave", () => s(null));
523
- var d = b;
524
- return typeof d == "function" ? Le(d, t) : b = t, o.$$click = () => {
564
+ var n = yt(), o = n.firstChild, t = o.firstChild;
565
+ n.addEventListener("pointerleave", () => u(null));
566
+ var c = w;
567
+ return typeof c == "function" ? Te(c, n) : w = n, t.$$click = () => {
525
568
  e.onDockActivation?.({
526
569
  kind: "mode",
527
- id: y()
528
- }), i((c) => !c);
529
- }, o.addEventListener("pointerleave", () => s((c) => c === 0 ? null : c)), o.addEventListener("pointerenter", () => s(0)), h(o, g(ie.span, {
570
+ id: C()
571
+ }), r((a) => !a);
572
+ }, t.addEventListener("pointerleave", () => u((a) => a === 0 ? null : a)), t.addEventListener("pointerenter", () => u(0)), h(t, f(ae.span, {
530
573
  class: "workbench-dock__tile",
531
574
  get animate() {
532
- return ze();
575
+ return Ne();
533
576
  },
534
577
  get transition() {
535
578
  return {
536
- duration: ae.fast,
537
- easing: re.easeOut
579
+ duration: le.fast,
580
+ easing: ce.easeOut
538
581
  };
539
582
  },
540
583
  get children() {
541
584
  return (() => {
542
- const c = ve().icon;
543
- return g(c, {
585
+ const a = ke().icon;
586
+ return f(a, {
544
587
  class: "workbench-dock__icon"
545
588
  });
546
589
  })();
547
590
  }
548
- }), null), h(o, g(ie.span, {
591
+ }), null), h(t, f(ae.span, {
549
592
  class: "workbench-dock__tooltip",
550
593
  get animate() {
551
594
  return {
552
- opacity: de() && !D() ? 1 : 0,
553
- y: de() && !D() ? -6 : 0
595
+ opacity: fe() && !x() ? 1 : 0,
596
+ y: fe() && !x() ? -6 : 0
554
597
  };
555
598
  },
556
599
  get transition() {
557
600
  return {
558
- duration: ae.fast,
559
- easing: re.easeOut
601
+ duration: le.fast,
602
+ easing: ce.easeOut
560
603
  };
561
604
  },
562
605
  get children() {
563
- return ve().label;
606
+ return ke().label;
564
607
  }
565
- }), null), h(n, g(X, {
608
+ }), null), h(o, f(X, {
566
609
  get when() {
567
- return D();
610
+ return x();
568
611
  },
569
612
  get children() {
570
- var c = wt();
571
- return h(c, g(Pe, {
613
+ var a = Dt();
614
+ return h(a, f(Se, {
572
615
  get each() {
573
- return ce();
616
+ return de();
574
617
  },
575
618
  children: (v) => {
576
- const a = v.icon;
619
+ const l = v.icon;
577
620
  return (() => {
578
- var M = bt(), O = M.firstChild, V = O.nextSibling, w = V.firstChild, f = w.nextSibling;
579
- return M.$$click = () => {
621
+ var D = xt(), P = D.firstChild, A = P.nextSibling, y = A.firstChild, oe = y.nextSibling;
622
+ return D.$$click = () => {
580
623
  e.onDockActivation?.({
581
624
  kind: "mode",
582
625
  id: v.mode
583
- }), e.onSelectMode?.(v.mode), i(!1);
584
- }, h(O, g(a, {
626
+ }), e.onSelectMode?.(v.mode), r(!1);
627
+ }, h(P, f(l, {
585
628
  class: "workbench-dock__mode-icon"
586
- })), h(w, () => v.label), h(f, () => v.description), H((x) => {
587
- var k = y() === v.mode, ne = y() === v.mode;
588
- return k !== x.e && M.classList.toggle("is-active", x.e = k), ne !== x.t && T(M, "aria-checked", x.t = ne), x;
629
+ })), h(y, () => v.label), h(oe, () => v.description), V((z) => {
630
+ var re = C() === v.mode, j = C() === v.mode;
631
+ return re !== z.e && D.classList.toggle("is-active", z.e = re), j !== z.t && T(D, "aria-checked", z.t = j), z;
589
632
  }, {
590
633
  e: void 0,
591
634
  t: void 0
592
- }), M;
635
+ }), D;
593
636
  })();
594
637
  }
595
- })), c;
638
+ })), a;
596
639
  }
597
- }), null), h(t, g(X, {
640
+ }), null), h(n, f(X, {
598
641
  get when() {
599
- return he("before-components");
642
+ return Ce("before-components");
600
643
  },
601
644
  get children() {
602
- return g(be, {});
645
+ return f(De, {});
603
646
  }
604
- }), null), h(t, g(Pe, {
647
+ }), null), h(n, f(Se, {
605
648
  get each() {
606
- return F().map((c) => c.key);
649
+ return F().map((a) => a.key);
607
650
  },
608
- children: (c, v) => {
609
- const a = L((w) => me().get(c) ?? w, je(() => me().get(c))), M = a().action?.buttonRef, O = () => a().kind === "widget" || a().kind === "tool" ? Be(a().kind, a().id) : void 0, V = () => a().host?.onContextMenu ?? a().action?.onContextMenu ?? (e.customization?.onContextMenu && y() === "work" ? (w) => e.customization?.onContextMenu?.(a(), w) : void 0);
610
- return [g(X, {
651
+ children: (a, v) => {
652
+ const l = S((y) => _e().get(a) ?? y, pe(() => _e().get(a))), D = l().action?.buttonRef, P = () => l().kind === "widget" || l().kind === "tool" ? He(l().kind, l().id) : void 0, A = () => l().host?.onContextMenu ?? l().action?.onContextMenu ?? (e.customization?.onContextMenu && C() === "work" ? (y) => e.customization?.onContextMenu?.(l(), y) : void 0);
653
+ return [f(X, {
611
654
  get when() {
612
- return I(() => !!e.customization)() ? v() === 0 : I(() => a().group === 2 || a().group === 4)() && F()[v() - 1]?.group !== a().group;
655
+ return $(() => !!e.customization)() ? v() === 0 : $(() => l().group === 2 || l().group === 4)() && F()[v() - 1]?.group !== l().group;
613
656
  },
614
657
  get children() {
615
- return _t();
658
+ return Pt();
616
659
  }
617
- }), g($t, {
660
+ }), f(Rt, {
618
661
  get id() {
619
- return a().id;
662
+ return l().id;
620
663
  },
621
664
  get kind() {
622
- return a().kind;
665
+ return l().kind;
623
666
  },
624
667
  get label() {
625
- return a().label;
668
+ return l().label;
626
669
  },
627
670
  get icon() {
628
- return a().icon;
671
+ return l().icon;
629
672
  },
630
673
  get active() {
631
- return I(() => !!a().action)() ? !!a().action.active : I(() => !!a().host)() ? !!a().host.active : O()?.active ?? Ye(a().id);
674
+ return $(() => !!l().action)() ? !!l().action.active : $(() => !!l().host)() ? !!l().host.active : P()?.active ?? Ke(l().id);
632
675
  },
633
676
  get visible() {
634
- return a().group !== 2 || R() === "focus-cycle" || Fe(a().id);
677
+ return l().group !== 2 || R() === "focus-cycle" || ze(l().id);
635
678
  },
636
679
  get filterable() {
637
- return I(() => a().group === 2 && R() === "solo-filter")() && le();
680
+ return $(() => l().group === 2 && R() === "solo-filter")() && ve();
638
681
  },
639
682
  get activationMode() {
640
683
  return R();
641
684
  },
642
685
  get presentation() {
643
- return O();
686
+ return P();
644
687
  },
645
688
  get hoverOffset() {
646
- return J(v() + 1);
689
+ return $(() => !!d()?.moved)() ? 0 : Z(v() + 1);
647
690
  },
648
691
  get isDragging() {
649
- return I(() => u()?.kind === a().kind)() && u()?.id === a().id;
692
+ return $(() => !ue() && d()?.kind === l().kind)() && d()?.id === l().id;
650
693
  },
651
694
  get canvasPlacement() {
652
- return I(() => !!a().host)() ? G(a().host.canvasPlacement) : I(() => a().kind === "action")() ? null : {
653
- preview: {
654
- kind: a().kind,
655
- id: a().id
656
- },
657
- onDrop: (w, f, x) => a().kind === "widget" ? e.onCreateAt?.(a().id, w, f, x) : e.onCreateToolAt?.(a().id, w, f, x)
658
- };
695
+ return se(l());
659
696
  },
660
- buttonRef: (w) => {
661
- w ? C.set(c, w) : C.delete(c), M?.(w);
697
+ buttonRef: (y) => {
698
+ y ? _.set(a, y) : _.delete(a), D?.(y);
662
699
  },
663
700
  get onContextMenu() {
664
- return V();
701
+ return A();
665
702
  },
666
- onKeyboardActivate: (w) => a().activate(w),
667
- onEnter: () => s(v() + 1),
668
- onLeave: () => s(null),
669
- onDragBegin: W,
670
- onReorderKey: (w) => Re(c, w),
703
+ onKeyboardActivate: (y) => l().activate(y),
704
+ onEnter: () => u(v() + 1),
705
+ onLeave: () => u(null),
706
+ onDragBegin: N,
707
+ onReorderKey: (y) => Be(a, y),
671
708
  get reorderable() {
672
- return I(() => y() === "work")() && !!e.customization?.onOrderChange;
709
+ return $(() => C() === "work")() && !!e.customization?.onOrderChange;
673
710
  },
674
711
  get dropEdge() {
675
- return I(() => S()?.key === c)() ? S()?.edge : void 0;
712
+ return $(() => I()?.key === a)() ? I()?.edge : void 0;
676
713
  }
677
714
  })];
678
715
  }
679
- }), null), h(t, g(X, {
716
+ }), null), h(n, f(X, {
680
717
  get when() {
681
- return he("after-components");
718
+ return Ce("after-components");
682
719
  },
683
720
  get children() {
684
- return g(be, {});
721
+ return f(De, {});
685
722
  }
686
- }), null), h(t, g(X, {
723
+ }), null), h(n, f(X, {
687
724
  get when() {
688
- return I(() => y() === "work")() && e.customization?.overflow;
725
+ return $(() => C() === "work")() && e.customization?.overflow;
689
726
  },
690
727
  get children() {
691
- return g($e, {
728
+ return f(Le, {
692
729
  get component() {
693
730
  return e.customization?.overflow;
694
731
  },
695
732
  get entries() {
696
- return ke();
733
+ return be();
697
734
  }
698
735
  });
699
736
  }
700
- }), null), H((c) => {
701
- var v = `workbench-dock workbench-dock-material${u()?.kind === "external" && u()?.moved ? " is-external-drop-target" : ""}${u()?.kind === "external" && u()?.overDock ? " is-external-drop-allowed" : ""}`, a = y() === "background", M = !!(de() || D()), O = D();
702
- return v !== c.e && Ve(t, c.e = v), a !== c.t && o.classList.toggle("is-active", c.t = a), M !== c.a && o.classList.toggle("is-hovered", c.a = M), O !== c.o && T(o, "aria-expanded", c.o = O), c;
737
+ }), null), V((a) => {
738
+ var v = `workbench-dock workbench-dock-material${d()?.kind === "external" && d()?.moved ? " is-external-drop-target" : ""}${d()?.kind === "external" && d()?.overDock ? " is-external-drop-allowed" : ""}`, l = C() === "background", D = !!(fe() || x()), P = x();
739
+ return v !== a.e && Je(n, a.e = v), l !== a.t && t.classList.toggle("is-active", a.t = l), D !== a.a && t.classList.toggle("is-hovered", a.a = D), P !== a.o && T(t, "aria-expanded", a.o = P), a;
703
740
  }, {
704
741
  e: void 0,
705
742
  t: void 0,
706
743
  a: void 0,
707
744
  o: void 0
708
- }), t;
709
- })(), g(X, {
745
+ }), n;
746
+ })(), f(X, {
710
747
  get when() {
711
- return !!(u()?.moved && !u()?.preview);
748
+ return !!(d()?.moved && !d()?.preview && !ue());
712
749
  },
713
750
  get children() {
714
- return g(Lt, {
715
- state: u
751
+ return f(Ft, {
752
+ state: d
716
753
  });
717
754
  }
718
755
  })];
719
756
  }
720
- function Lt(e) {
721
- const m = () => {
722
- const _ = e.state();
723
- return _ ? `translate3d(${_.clientX + 14}px, ${_.clientY - 56}px, 0)` : "translate3d(0px, 0px, 0)";
724
- }, s = () => e.state()?.label ?? "", u = () => e.state()?.icon;
725
- return g(Ue, {
757
+ function Ft(e) {
758
+ const g = () => {
759
+ const b = e.state();
760
+ return b ? `translate3d(${b.clientX + 14}px, ${b.clientY - 56}px, 0)` : "translate3d(0px, 0px, 0)";
761
+ }, u = () => e.state()?.label ?? "", d = () => e.state()?.icon;
762
+ return f(Qe, {
726
763
  get children() {
727
- var _ = Et(), C = _.firstChild, S = C.nextSibling, $ = S.firstChild, D = $.nextSibling, i = D.firstChild, b = i.nextSibling, r = b.firstChild;
728
- return h($, g(X, {
764
+ var b = Mt(), _ = b.firstChild, I = _.nextSibling, O = I.firstChild, x = O.nextSibling, r = x.firstChild, w = r.nextSibling, i = w.firstChild;
765
+ return h(O, f(X, {
729
766
  get when() {
730
- return u();
767
+ return d();
731
768
  },
732
- children: (l) => {
733
- const E = l();
734
- return g(E, {
769
+ children: (s) => {
770
+ const E = s();
771
+ return f(E, {
735
772
  class: "w-4 h-4"
736
773
  });
737
774
  }
738
- })), h(i, s), h(b, g(et, {
775
+ })), h(r, u), h(w, f(at, {
739
776
  class: "w-3 h-3"
740
- }), r), h(r, () => e.state()?.kind === "external" ? "Pin to Dock" : "Drag onto canvas"), H((l) => {
741
- var E = !!(e.state()?.kind === "external" && e.state()?.overDock), P = m();
742
- return E !== l.e && _.classList.toggle("is-over-dock", l.e = E), P !== l.t && se(_, "transform", l.t = P), l;
777
+ }), i), h(i, () => e.state()?.kind === "external" ? "Pin to Dock" : "Drag onto canvas"), V((s) => {
778
+ var E = !!(e.state()?.kind === "external" && e.state()?.overDock), M = g();
779
+ return E !== s.e && b.classList.toggle("is-over-dock", s.e = E), M !== s.t && ge(b, "transform", s.t = M), s;
743
780
  }, {
744
781
  e: void 0,
745
782
  t: void 0
746
- }), _;
783
+ }), b;
747
784
  }
748
785
  });
749
786
  }
750
- qe(["pointerdown", "click", "contextmenu", "keydown"]);
787
+ Ze(["pointerdown", "click", "contextmenu", "keydown"]);
751
788
  export {
752
- Vt as WorkbenchDock
789
+ Zt as WorkbenchDock
753
790
  };