@floegence/floe-webapp-core 0.101.29 → 0.101.33

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