@floegence/floe-webapp-core 0.42.4 → 0.43.0

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