@floegence/floe-webapp-core 0.56.7 → 0.56.9

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,147 +1,153 @@
1
- import { spread as It, mergeProps as be, insert as f, createComponent as m, memo as ve, effect as Se, style as ke, template as Rt, use as $e, delegateEvents as ye } from "solid-js/web";
2
- import { createMemo as g, createSignal as $, onCleanup as Mt, untrack as y, createEffect as rt } from "solid-js";
3
- import { startHotInteraction as Pe } from "../../utils/hotInteraction.js";
4
- import { X as Tt, Minus as Et, Maximize as At, GripVertical as xe } from "../icons/index.js";
5
- import { CANVAS_WHEEL_INTERACTIVE_ATTR as We, WORKBENCH_WIDGET_SHELL_ATTR as Ce, resolveWorkbenchWidgetLocalTypingTarget as Ie, resolveWorkbenchWidgetTextSelectionTarget as Me, shouldActivateWorkbenchWidgetLocalTarget as Te } from "../ui/localInteractionSurface.js";
6
- import { startPointerSession as Lt } from "../ui/pointerSession.js";
7
- import { createWorkbenchWidgetSurfaceMetrics as Ee, resolveWorkbenchProjectedSurfaceScaleBehavior as Ae } from "./workbenchHelpers.js";
8
- import { createWorkbenchEdgeAutoPanController as Le, WORKBENCH_EDGE_AUTO_PAN_FRAME_SELECTOR as Re, frameFromElement as ze } from "./workbenchEdgeAutoPan.js";
9
- import { resolveWorkbenchInteractionAdapter as Xe } from "./workbenchInteractionAdapter.js";
10
- import { createOwnerSafePropAccessor as a } from "./workbenchOwnerSafeAccessors.js";
11
- var Ye = /* @__PURE__ */ Rt('<article class=workbench-widget data-floe-surface=floating><div class=workbench-widget__surface><header class=workbench-widget__header><span class=workbench-widget__traffic role=group aria-label="Window controls"><button type=button class="workbench-widget__traffic-dot workbench-widget__traffic-dot--close"aria-label="Close widget"title="Close widget"data-floe-canvas-interactive=true></button><button type=button class="workbench-widget__traffic-dot workbench-widget__traffic-dot--min"aria-label="Minimize widget to overview"title="Minimize widget to overview"data-floe-canvas-interactive=true></button><button type=button class="workbench-widget__traffic-dot workbench-widget__traffic-dot--max"aria-label="Zoom widget to fit viewport"title="Zoom widget to fit viewport"data-floe-canvas-interactive=true></button></span><span class=workbench-widget__badge aria-hidden=true></span><button type=button class=workbench-widget__drag aria-label="Drag widget"data-floe-canvas-interactive=true></button><div class=workbench-widget__title-area><span class=workbench-widget__title-dot aria-hidden=true></span><span class=workbench-widget__title></span></div><span class=workbench-widget__window-controls role=group aria-label="Window controls"><button type=button class="workbench-widget__window-control workbench-widget__window-control--min"aria-label="Minimize widget to overview"title="Minimize widget to overview"data-floe-canvas-interactive=true></button><button type=button class="workbench-widget__window-control workbench-widget__window-control--max"aria-label="Zoom widget to fit viewport"title="Zoom widget to fit viewport"data-floe-canvas-interactive=true></button><button type=button class="workbench-widget__window-control workbench-widget__window-control--close"aria-label="Remove widget"title="Remove widget"data-floe-canvas-interactive=true></button></span></header><div class=workbench-widget__body data-floe-canvas-interactive=true>'), De = /* @__PURE__ */ Rt('<div class=workbench-widget__resize aria-label="Resize widget"data-floe-canvas-interactive=true><svg class=workbench-widget__resize-glyph viewBox="0 0 12 12"aria-hidden=true><path d="M12 0 L0 12"></path><path d="M12 4 L4 12"></path><path d="M12 8 L8 12">');
12
- const Fe = 220, je = 160, Oe = 160;
13
- function Qe(i) {
14
- const N = a(() => i.definition), u = a(() => i.widgetId), at = a(() => i.widgetTitle), ct = a(() => i.widgetType), L = a(() => i.itemSnapshot), lt = a(() => i.renderLayer), zt = a(() => i.visualFront), st = a(() => i.motion ?? null), dt = a(() => i.topRenderLayer), Xt = a(() => i.viewport), G = a(() => i.onSelect), Yt = a(() => i.onActivate), Dt = a(() => i.onContextMenu), Z = a(() => i.onClaimVisualFrontOwner), K = a(() => i.onCommitFront), Ft = a(() => i.onCommitMove), jt = a(() => i.onCommitResize), Ot = a(() => i.onViewportCommit), Ht = a(() => i.onViewportInteractionStart), Vt = a(() => i.onRequestOverview), qt = a(() => i.onRequestFit), Bt = a(() => i.onRequestDelete), Nt = a(() => i.onLayoutInteractionStart), Gt = a(() => i.onLayoutInteractionEnd), h = g(() => Xe(i.interactionAdapter)), P = a(() => i.selected), v = a(() => i.locked), U = a(() => i.filtered), b = a(() => i.layoutMode ?? "canvas_scaled"), Zt = a(() => i.projectedViewport), Kt = a(() => i.surfaceReady ?? !0), ut = a(() => ({
15
- x: i.x,
16
- y: i.y
17
- })), wt = a(() => ({
18
- width: i.width,
19
- height: i.height
20
- })), J = a(() => Math.max(i.viewportScale, 1e-3)), [x, R] = $(null), [z, Q] = $(null), [Ut, Jt] = $(), [tt, W] = $(!1), [gt, ht] = $(!1), [ft, X] = $({
1
+ import { spread as Lt, mergeProps as $e, insert as u, createComponent as p, memo as ye, effect as Pe, style as We, setAttribute as xe, template as dt, use as Ce, delegateEvents as Te } from "solid-js/web";
2
+ import { createSignal as k, createMemo as h, onCleanup as Rt, untrack as v, createEffect as st, Show as Ie } from "solid-js";
3
+ import { startHotInteraction as Me } from "../../utils/hotInteraction.js";
4
+ import { X as zt, Minus as Xt, Maximize as Yt, GripVertical as Ee } from "../icons/index.js";
5
+ import { CANVAS_WHEEL_INTERACTIVE_ATTR as Ae, WORKBENCH_WIDGET_SHELL_ATTR as Le, resolveWorkbenchWidgetLocalTypingTarget as Re, resolveWorkbenchWidgetTextSelectionTarget as ze, shouldActivateWorkbenchWidgetLocalTarget as Xe } from "../ui/localInteractionSurface.js";
6
+ import { startPointerSession as Dt } from "../ui/pointerSession.js";
7
+ import { createWorkbenchWidgetSurfaceMetrics as Ye, resolveWorkbenchProjectedSurfaceScaleBehavior as De } from "./workbenchHelpers.js";
8
+ import { createWorkbenchEdgeAutoPanController as Fe, WORKBENCH_EDGE_AUTO_PAN_FRAME_SELECTOR as He, frameFromElement as je } from "./workbenchEdgeAutoPan.js";
9
+ import { resolveWorkbenchInteractionAdapter as Oe } from "./workbenchInteractionAdapter.js";
10
+ import { createOwnerSafePropAccessor as c } from "./workbenchOwnerSafeAccessors.js";
11
+ import { WorkbenchWidgetHeaderContext as Ve } from "./WorkbenchWidgetHeader.js";
12
+ var qe = /* @__PURE__ */ dt("<div class=workbench-widget__header-actions data-floe-workbench-header-actions=true data-floe-canvas-interactive=true>"), Be = /* @__PURE__ */ dt('<article class=workbench-widget data-floe-surface=floating><div class=workbench-widget__surface><header class=workbench-widget__header><span class=workbench-widget__traffic role=group aria-label="Window controls"><button type=button class="workbench-widget__traffic-dot workbench-widget__traffic-dot--close"aria-label="Close widget"title="Close widget"data-floe-canvas-interactive=true></button><button type=button class="workbench-widget__traffic-dot workbench-widget__traffic-dot--min"aria-label="Minimize widget to overview"title="Minimize widget to overview"data-floe-canvas-interactive=true></button><button type=button class="workbench-widget__traffic-dot workbench-widget__traffic-dot--max"aria-label="Zoom widget to fit viewport"title="Zoom widget to fit viewport"data-floe-canvas-interactive=true></button></span><span class=workbench-widget__badge aria-hidden=true></span><button type=button class=workbench-widget__drag aria-label="Drag widget"data-floe-canvas-interactive=true></button><div class=workbench-widget__title-area><span class=workbench-widget__title-dot aria-hidden=true></span><span class=workbench-widget__title></span></div><span class=workbench-widget__window-controls role=group aria-label="Window controls"><button type=button class="workbench-widget__window-control workbench-widget__window-control--min"aria-label="Minimize widget to overview"title="Minimize widget to overview"data-floe-canvas-interactive=true></button><button type=button class="workbench-widget__window-control workbench-widget__window-control--max"aria-label="Zoom widget to fit viewport"title="Zoom widget to fit viewport"data-floe-canvas-interactive=true></button><button type=button class="workbench-widget__window-control workbench-widget__window-control--close"aria-label="Remove widget"title="Remove widget"data-floe-canvas-interactive=true></button></span></header><div class=workbench-widget__body data-floe-canvas-interactive=true>'), Ne = /* @__PURE__ */ dt('<div class=workbench-widget__resize aria-label="Resize widget"data-floe-canvas-interactive=true><svg class=workbench-widget__resize-glyph viewBox="0 0 12 12"aria-hidden=true><path d="M12 0 L0 12"></path><path d="M12 4 L4 12"></path><path d="M12 8 L8 12">');
13
+ const Ge = 220, Ze = 160, Ke = 160;
14
+ function lo(r) {
15
+ const [W, ut] = k(), Ft = (t) => {
16
+ if (v(W)) throw new Error("A Workbench widget supports one header contribution");
17
+ return ut(t), () => {
18
+ v(W) === t && ut(void 0);
19
+ };
20
+ }, Z = c(() => r.definition), w = c(() => r.widgetId), K = c(() => r.widgetTitle), wt = c(() => r.widgetType), z = c(() => r.itemSnapshot), gt = c(() => r.renderLayer), Ht = c(() => r.visualFront), ht = c(() => r.motion ?? null), ft = c(() => r.topRenderLayer), jt = c(() => r.viewport), U = c(() => r.onSelect), Ot = c(() => r.onActivate), Vt = c(() => r.onContextMenu), J = c(() => r.onClaimVisualFrontOwner), Q = c(() => r.onCommitFront), qt = c(() => r.onCommitMove), Bt = c(() => r.onCommitResize), Nt = c(() => r.onViewportCommit), Gt = c(() => r.onViewportInteractionStart), Zt = c(() => r.onRequestOverview), Kt = c(() => r.onRequestFit), Ut = c(() => r.onRequestDelete), Jt = c(() => r.onLayoutInteractionStart), Qt = c(() => r.onLayoutInteractionEnd), f = h(() => Oe(r.interactionAdapter)), x = c(() => r.selected), $ = c(() => r.locked), tt = c(() => r.filtered), S = c(() => r.layoutMode ?? "canvas_scaled"), te = c(() => r.projectedViewport), ee = c(() => r.surfaceReady ?? !0), pt = c(() => ({
21
+ x: r.x,
22
+ y: r.y
23
+ })), mt = c(() => ({
24
+ width: r.width,
25
+ height: r.height
26
+ })), et = c(() => Math.max(r.viewportScale, 1e-3)), [C, X] = k(null), [Y, ot] = k(null), [oe, ne] = k(), [nt, T] = k(!1), [_t, bt] = k(!1), [vt, D] = k({
21
27
  enabled: !1,
22
28
  scale: 1
23
29
  });
24
- let C, I, M, Y = null, Qt = 0, te = 0, S = null, T;
25
- const E = /* @__PURE__ */ new Map();
26
- let w;
27
- const D = () => {
28
- typeof window > "u" || T === void 0 || (window.clearTimeout(T), T = void 0);
29
- }, pt = (t, e) => {
30
- const n = Pe({
30
+ let I, M, E, F = null, re = 0, ie = 0, y = null, A;
31
+ const L = /* @__PURE__ */ new Map();
32
+ let g;
33
+ const H = () => {
34
+ typeof window > "u" || A === void 0 || (window.clearTimeout(A), A = void 0);
35
+ }, St = (t, e) => {
36
+ const n = Me({
31
37
  kind: t,
32
38
  cursor: e
33
39
  });
34
40
  let o = !1;
35
- return y(() => Nt()?.()), () => {
36
- o || (o = !0, n(), y(() => Gt()?.()));
41
+ return v(() => Jt()?.()), () => {
42
+ o || (o = !0, n(), v(() => Qt()?.()));
37
43
  };
38
- }, mt = () => {
39
- M?.stop(), M = void 0, Y = null;
40
- }, ee = () => {
41
- const t = Xt(), e = Ot(), n = Ht();
42
- !t || !e || (Y = t, M?.stop(), M = Le({
44
+ }, kt = () => {
45
+ E?.stop(), E = void 0, F = null;
46
+ }, ae = () => {
47
+ const t = jt(), e = Nt(), n = Gt();
48
+ !t || !e || (F = t, E?.stop(), E = Fe({
43
49
  readFrame: () => {
44
- const o = w?.closest(Re);
45
- return o instanceof HTMLElement ? ze(o) : null;
50
+ const o = g?.closest(He);
51
+ return o instanceof HTMLElement ? je(o) : null;
46
52
  },
47
- readViewport: () => Y ?? t,
53
+ readViewport: () => F ?? t,
48
54
  commitViewport: (o) => {
49
- Y = o, e(o);
55
+ F = o, e(o);
50
56
  },
51
57
  onPanStart: () => n?.("pan"),
52
58
  onPan: (o) => {
53
- R((r) => r && {
54
- ...r,
55
- autoPanWorldX: r.autoPanWorldX + o.worldDeltaX,
56
- autoPanWorldY: r.autoPanWorldY + o.worldDeltaY,
57
- worldX: r.worldX + o.worldDeltaX,
58
- worldY: r.worldY + o.worldDeltaY,
59
+ X((i) => i && {
60
+ ...i,
61
+ autoPanWorldX: i.autoPanWorldX + o.worldDeltaX,
62
+ autoPanWorldY: i.autoPanWorldY + o.worldDeltaY,
63
+ worldX: i.worldX + o.worldDeltaX,
64
+ worldY: i.worldY + o.worldDeltaY,
59
65
  moved: !0
60
66
  });
61
67
  },
62
- shouldPan: () => x() !== null
68
+ shouldPan: () => C() !== null
63
69
  }));
64
70
  };
65
- Mt(() => {
66
- mt(), C?.stop({
71
+ Rt(() => {
72
+ kt(), I?.stop({
67
73
  reason: "manual_stop",
68
74
  commit: !1
69
- }), C = void 0, I?.stop({
75
+ }), I = void 0, M?.stop({
70
76
  reason: "manual_stop",
71
77
  commit: !1
72
- }), I = void 0, y(x)?.stopInteraction(), y(z)?.stopInteraction(), D();
78
+ }), M = void 0, v(C)?.stopInteraction(), v(Y)?.stopInteraction(), H();
73
79
  });
74
- const F = () => {
75
- const t = u(), e = Yt();
80
+ const j = () => {
81
+ const t = w(), e = Ot();
76
82
  if (e) {
77
- W(!0), ht(!0), e(t);
83
+ T(!0), bt(!0), e(t);
78
84
  return;
79
85
  }
80
- W(!1), G()(t), K()(t);
81
- }, oe = () => {
82
- if (lt() >= dt()) {
83
- Z()(u());
86
+ T(!1), U()(t), Q()(t);
87
+ }, ce = () => {
88
+ if (gt() >= ft()) {
89
+ J()(w());
84
90
  return;
85
91
  }
86
- K()(u());
87
- }, et = () => {
88
- W(!1);
89
- }, A = g(() => P() || tt());
90
- rt(() => {
91
- !gt() || !P() || (ht(!1), W(!1));
92
+ Q()(w());
93
+ }, rt = () => {
94
+ T(!1);
95
+ }, R = h(() => x() || nt());
96
+ st(() => {
97
+ !_t() || !x() || (bt(!1), T(!1));
92
98
  });
93
- const ne = (t, e, n) => {
99
+ const le = (t, e, n) => {
94
100
  const o = {
95
- token: ++te,
101
+ token: ++ie,
96
102
  wasSelected: e,
97
103
  ownership: n
98
104
  };
99
- E.set(t, o), !e && n === "widget_local" && W(!0), queueMicrotask(() => {
100
- E.get(t)?.token === o.token && E.delete(t);
105
+ L.set(t, o), !e && n === "widget_local" && T(!0), queueMicrotask(() => {
106
+ L.get(t)?.token === o.token && L.delete(t);
101
107
  });
102
- }, ie = (t) => {
103
- const e = E.get(t) ?? null;
104
- return e && E.delete(t), e;
108
+ }, se = (t) => {
109
+ const e = L.get(t) ?? null;
110
+ return e && L.delete(t), e;
105
111
  };
106
- rt(() => {
107
- const t = w;
112
+ st(() => {
113
+ const t = g;
108
114
  if (!t) return;
109
- const e = (r) => {
110
- r.button === 0 && ne(r.pointerId, A(), H(r.target));
111
- }, n = (r) => {
112
- if (r.button === 0 && H(r.target) === "widget_local") {
113
- if (tt()) {
114
- F();
115
+ const e = (i) => {
116
+ i.button === 0 && le(i.pointerId, R(), q(i.target));
117
+ }, n = (i) => {
118
+ if (i.button === 0 && q(i.target) === "widget_local") {
119
+ if (nt()) {
120
+ j();
115
121
  return;
116
122
  }
117
- P() && oe();
123
+ x() && ce();
118
124
  }
119
125
  }, o = () => {
120
126
  setTimeout(() => {
121
- P() || et();
127
+ x() || rt();
122
128
  }, 0);
123
129
  };
124
- t.addEventListener("pointerdown", e, !0), t.addEventListener("click", n, !0), t.addEventListener("pointerup", o), t.addEventListener("pointercancel", et), Mt(() => {
125
- t.removeEventListener("pointerdown", e, !0), t.removeEventListener("click", n, !0), t.removeEventListener("pointerup", o), t.removeEventListener("pointercancel", et);
130
+ t.addEventListener("pointerdown", e, !0), t.addEventListener("click", n, !0), t.addEventListener("pointerup", o), t.addEventListener("pointercancel", rt), Rt(() => {
131
+ t.removeEventListener("pointerdown", e, !0), t.removeEventListener("click", n, !0), t.removeEventListener("pointerup", o), t.removeEventListener("pointercancel", rt);
126
132
  });
127
133
  });
128
- const j = () => x() !== null, O = () => z() !== null, re = g(() => U() ? "cold" : A() ? "hot" : v() ? "cold" : "warm"), H = (t) => h().resolveWidgetEventOwnership({
134
+ const O = () => C() !== null, V = () => Y() !== null, de = h(() => tt() ? "cold" : R() ? "hot" : $() ? "cold" : "warm"), q = (t) => f().resolveWidgetEventOwnership({
129
135
  target: t,
130
- widgetRoot: w ?? null,
131
- interactiveSelector: h().interactiveSelector,
132
- panSurfaceSelector: h().panSurfaceSelector
133
- }), ae = (t) => {
134
- F(), t?.focus !== !1 && w?.focus({
136
+ widgetRoot: g ?? null,
137
+ interactiveSelector: f().interactiveSelector,
138
+ panSurfaceSelector: f().panSurfaceSelector
139
+ }), ue = (t) => {
140
+ j(), t?.focus !== !1 && g?.focus({
135
141
  preventScroll: !0
136
142
  });
137
- }, _t = (t) => {
138
- Jt((e) => ({
143
+ }, $t = (t) => {
144
+ ne((e) => ({
139
145
  seq: (e?.seq ?? 0) + 1,
140
146
  source: "local_pointer",
141
147
  pointerType: t
142
148
  }));
143
- }, ce = (t) => {
144
- if (!(!w || !t.isConnected || !w.contains(t)))
149
+ }, we = (t) => {
150
+ if (!(!g || !t.isConnected || !g.contains(t)))
145
151
  try {
146
152
  t.focus({
147
153
  preventScroll: !0
@@ -149,17 +155,17 @@ function Qe(i) {
149
155
  } catch {
150
156
  t.focus();
151
157
  }
152
- }, le = (t, e) => {
153
- S = {
154
- token: ++Qt,
158
+ }, ge = (t, e) => {
159
+ y = {
160
+ token: ++re,
155
161
  pointerId: t,
156
162
  target: e,
157
163
  timestamp: Date.now()
158
164
  };
159
- const n = S;
165
+ const n = y;
160
166
  queueMicrotask(() => {
161
167
  const o = () => {
162
- !n || S?.token !== n.token || (ce(n.target), S = null);
168
+ !n || y?.token !== n.token || (we(n.target), y = null);
163
169
  };
164
170
  if (typeof requestAnimationFrame == "function") {
165
171
  requestAnimationFrame(() => o());
@@ -167,102 +173,102 @@ function Qe(i) {
167
173
  }
168
174
  o();
169
175
  });
170
- }, se = (t) => {
171
- if (t.button !== 0 || v()) return;
172
- const e = ie(t.pointerId), n = e?.wasSelected ?? P(), o = e?.ownership ?? H(t.target), r = o === "widget_local" ? Ie({
176
+ }, he = (t) => {
177
+ if (t.button !== 0 || $()) return;
178
+ const e = se(t.pointerId), n = e?.wasSelected ?? x(), o = e?.ownership ?? q(t.target), i = o === "widget_local" ? Re({
173
179
  target: t.target,
174
- widgetRoot: w ?? null,
175
- interactiveSelector: h().interactiveSelector,
176
- panSurfaceSelector: h().panSurfaceSelector
177
- }) : null, s = o === "widget_local" ? Me({
180
+ widgetRoot: g ?? null,
181
+ interactiveSelector: f().interactiveSelector,
182
+ panSurfaceSelector: f().panSurfaceSelector
183
+ }) : null, s = o === "widget_local" ? ze({
178
184
  target: t.target,
179
- widgetRoot: w ?? null,
180
- interactiveSelector: h().interactiveSelector,
181
- panSurfaceSelector: h().panSurfaceSelector
182
- }) : null, c = o === "widget_local" && !r && !s && Te({
185
+ widgetRoot: g ?? null,
186
+ interactiveSelector: f().interactiveSelector,
187
+ panSurfaceSelector: f().panSurfaceSelector
188
+ }) : null, l = o === "widget_local" && !i && !s && Xe({
183
189
  target: t.target,
184
- widgetRoot: w ?? null,
185
- interactiveSelector: h().interactiveSelector,
186
- panSurfaceSelector: h().panSurfaceSelector
190
+ widgetRoot: g ?? null,
191
+ interactiveSelector: f().interactiveSelector,
192
+ panSurfaceSelector: f().panSurfaceSelector
187
193
  });
188
194
  if (o === "widget_shell") {
189
- F(), w?.focus({
195
+ j(), g?.focus({
190
196
  preventScroll: !0
191
197
  });
192
198
  return;
193
199
  }
194
200
  if (o === "widget_local") {
195
- if (r) {
196
- n || le(t.pointerId, r);
201
+ if (i) {
202
+ n || ge(t.pointerId, i);
197
203
  return;
198
204
  }
199
205
  if (s) {
200
- S = null;
206
+ y = null;
201
207
  return;
202
208
  }
203
- if (c) {
204
- if (S = null, n) {
205
- _t(t.pointerType || void 0);
209
+ if (l) {
210
+ if (y = null, n) {
211
+ $t(t.pointerType || void 0);
206
212
  return;
207
213
  }
208
- F(), _t(t.pointerType || void 0);
214
+ j(), $t(t.pointerType || void 0);
209
215
  }
210
216
  }
211
- }, V = g(() => {
212
- const t = x();
217
+ }, B = h(() => {
218
+ const t = C();
213
219
  return t ? {
214
220
  x: t.worldX,
215
221
  y: t.worldY
216
- } : ut();
217
- }), p = g(() => {
218
- const t = z();
222
+ } : pt();
223
+ }), m = h(() => {
224
+ const t = Y();
219
225
  return t ? {
220
226
  width: t.width,
221
227
  height: t.height
222
- } : wt();
223
- }), ot = g(() => {
224
- const t = Zt();
225
- if (!(b() !== "projected_surface" || !t))
226
- return Ee({
227
- widgetId: u(),
228
- worldX: V().x,
229
- worldY: V().y,
230
- worldWidth: p().width,
231
- worldHeight: p().height,
228
+ } : mt();
229
+ }), it = h(() => {
230
+ const t = te();
231
+ if (!(S() !== "projected_surface" || !t))
232
+ return Ye({
233
+ widgetId: w(),
234
+ worldX: B().x,
235
+ worldY: B().y,
236
+ worldWidth: m().width,
237
+ worldHeight: m().height,
232
238
  viewport: t(),
233
- ready: Kt()
239
+ ready: ee()
234
240
  });
235
- }), nt = g(() => ot()?.rect.viewportScale ?? J()), bt = g(() => b() === "projected_surface" && Ae(N()) === "settle_sharp_zoom"), vt = g(() => b() === "projected_surface" && bt() && ft().enabled && ft().scale > 1.001), de = g(() => {
236
- if (b() !== "projected_surface")
241
+ }), at = h(() => it()?.rect.viewportScale ?? et()), yt = h(() => S() === "projected_surface" && De(Z()) === "settle_sharp_zoom"), Pt = h(() => S() === "projected_surface" && yt() && vt().enabled && vt().scale > 1.001), fe = h(() => {
242
+ if (S() !== "projected_surface")
237
243
  return;
238
- const t = nt();
239
- return vt() ? {
240
- width: `${p().width}px`,
241
- height: `${p().height}px`,
244
+ const t = at();
245
+ return Pt() ? {
246
+ width: `${m().width}px`,
247
+ height: `${m().height}px`,
242
248
  zoom: `${t}`
243
249
  } : {
244
250
  width: "100%",
245
251
  height: "100%",
246
252
  zoom: "1"
247
253
  };
248
- }), ue = g(() => {
249
- const t = L()().z_index, e = Number.isFinite(t) ? Math.max(1, Math.min(99, Math.round(t))) : 1;
254
+ }), pe = h(() => {
255
+ const t = z()().z_index, e = Number.isFinite(t) ? Math.max(1, Math.min(99, Math.round(t))) : 1;
250
256
  return String(e).padStart(2, "0");
251
- }), St = (t) => {
252
- t.preventDefault(), t.stopPropagation(), Vt()(L()());
253
- }, kt = (t) => {
254
- t.preventDefault(), t.stopPropagation(), qt()(L()());
255
- }, $t = (t) => {
256
- t.preventDefault(), t.stopPropagation(), Bt()(u());
257
- }, we = g(() => {
257
+ }), Wt = (t) => {
258
+ t.preventDefault(), t.stopPropagation(), Zt()(z()());
259
+ }, xt = (t) => {
260
+ t.preventDefault(), t.stopPropagation(), Kt()(z()());
261
+ }, Ct = (t) => {
262
+ t.preventDefault(), t.stopPropagation(), Ut()(w());
263
+ }, me = h(() => {
258
264
  const t = {
259
- "z-index": j() || O() || zt() ? `${dt() + 1}` : `${lt()}`
265
+ "z-index": O() || V() || Ht() ? `${ft() + 1}` : `${gt()}`
260
266
  };
261
- if (b() === "projected_surface") {
262
- const e = ot()?.rect, n = nt(), o = vt(), r = o ? e?.screenWidth ?? p().width * n : p().width, s = o ? e?.screenHeight ?? p().height * n : p().height;
267
+ if (S() === "projected_surface") {
268
+ const e = it()?.rect, n = at(), o = Pt(), i = o ? e?.screenWidth ?? m().width * n : m().width, s = o ? e?.screenHeight ?? m().height * n : m().height;
263
269
  return {
264
270
  ...t,
265
- width: `${r}px`,
271
+ width: `${i}px`,
266
272
  height: `${s}px`,
267
273
  transform: o ? `translate(${e?.screenX ?? 0}px, ${e?.screenY ?? 0}px)` : `translate(${e?.screenX ?? 0}px, ${e?.screenY ?? 0}px) scale(${n})`,
268
274
  zoom: "1"
@@ -270,43 +276,43 @@ function Qe(i) {
270
276
  }
271
277
  return {
272
278
  ...t,
273
- width: `${p().width}px`,
274
- height: `${p().height}px`,
275
- transform: `translate(${V().x}px, ${V().y}px)`
279
+ width: `${m().width}px`,
280
+ height: `${m().height}px`,
281
+ transform: `translate(${B().x}px, ${B().y}px)`
276
282
  };
277
- }), yt = g(() => st()?.phase === "enter");
278
- rt(() => {
279
- if (!bt()) {
280
- D(), X({
283
+ }), Tt = h(() => ht()?.phase === "enter");
284
+ st(() => {
285
+ if (!yt()) {
286
+ H(), D({
281
287
  enabled: !1,
282
288
  scale: 1
283
289
  });
284
290
  return;
285
291
  }
286
- const t = nt();
287
- if (t <= 1.001 || j() || O()) {
288
- D(), X({
292
+ const t = at();
293
+ if (t <= 1.001 || O() || V()) {
294
+ H(), D({
289
295
  enabled: !1,
290
296
  scale: t
291
297
  });
292
298
  return;
293
299
  }
294
- if (X({
300
+ if (D({
295
301
  enabled: !1,
296
302
  scale: t
297
303
  }), typeof window > "u")
298
304
  return;
299
- D();
305
+ H();
300
306
  const e = t;
301
- T = window.setTimeout(() => {
302
- T = void 0, X((n) => Math.abs(n.scale - e) < 1e-3 ? {
307
+ A = window.setTimeout(() => {
308
+ A = void 0, D((n) => Math.abs(n.scale - e) < 1e-3 ? {
303
309
  enabled: !0,
304
310
  scale: e
305
311
  } : n);
306
- }, Oe);
312
+ }, Ke);
307
313
  });
308
- const ge = (t) => {
309
- const e = y(x);
314
+ const _e = (t) => {
315
+ const e = v(C);
310
316
  if (!e) return;
311
317
  const n = {
312
318
  x: e.worldX,
@@ -314,69 +320,69 @@ function Qe(i) {
314
320
  }, o = {
315
321
  x: e.startWorldX,
316
322
  y: e.startWorldY
317
- }, r = t && (Math.abs(n.x - o.x) > 1 || Math.abs(n.y - o.y) > 1), s = u();
318
- K()(s), r && Ft()(s, n), e.stopInteraction(), mt(), R(null), C = void 0;
319
- }, Pt = (t) => {
320
- if (t.button !== 0 || v()) return;
321
- t.preventDefault(), t.stopPropagation(), C?.stop({
323
+ }, i = t && (Math.abs(n.x - o.x) > 1 || Math.abs(n.y - o.y) > 1), s = w();
324
+ Q()(s), i && qt()(s, n), e.stopInteraction(), kt(), X(null), I = void 0;
325
+ }, It = (t) => {
326
+ if (t.button !== 0 || $()) return;
327
+ t.preventDefault(), t.stopPropagation(), I?.stop({
322
328
  reason: "manual_stop",
323
329
  commit: !1
324
330
  });
325
- const e = u();
326
- G()(e), w?.focus({
331
+ const e = w();
332
+ U()(e), g?.focus({
327
333
  preventScroll: !0
328
- }), Z()(e);
329
- const n = pt("drag", "grabbing"), o = J(), r = ut();
330
- R({
334
+ }), J()(e);
335
+ const n = St("drag", "grabbing"), o = et(), i = pt();
336
+ X({
331
337
  pointerId: t.pointerId,
332
338
  startClientX: t.clientX,
333
339
  startClientY: t.clientY,
334
- startWorldX: r.x,
335
- startWorldY: r.y,
336
- worldX: r.x,
337
- worldY: r.y,
340
+ startWorldX: i.x,
341
+ startWorldY: i.y,
342
+ worldX: i.x,
343
+ worldY: i.y,
338
344
  autoPanWorldX: 0,
339
345
  autoPanWorldY: 0,
340
346
  moved: !1,
341
347
  scale: o,
342
348
  stopInteraction: n
343
- }), ee();
344
- const s = (c) => {
345
- M?.updatePointer(c.clientX, c.clientY), R((d) => {
346
- if (!d || d.pointerId !== c.pointerId) return d;
347
- const _ = d.startWorldX + (c.clientX - d.startClientX) / d.scale + d.autoPanWorldX, k = d.startWorldY + (c.clientY - d.startClientY) / d.scale + d.autoPanWorldY;
349
+ }), ae();
350
+ const s = (l) => {
351
+ E?.updatePointer(l.clientX, l.clientY), X((d) => {
352
+ if (!d || d.pointerId !== l.pointerId) return d;
353
+ const _ = d.startWorldX + (l.clientX - d.startClientX) / d.scale + d.autoPanWorldX, P = d.startWorldY + (l.clientY - d.startClientY) / d.scale + d.autoPanWorldY;
348
354
  return {
349
355
  ...d,
350
356
  worldX: _,
351
- worldY: k,
352
- moved: d.moved || Math.abs(_ - d.startWorldX) > 2 || Math.abs(k - d.startWorldY) > 2
357
+ worldY: P,
358
+ moved: d.moved || Math.abs(_ - d.startWorldX) > 2 || Math.abs(P - d.startWorldY) > 2
353
359
  };
354
360
  });
355
361
  };
356
- C = Lt({
362
+ I = Dt({
357
363
  pointerEvent: t,
358
364
  captureEl: t.currentTarget,
359
365
  onMove: s,
360
366
  onEnd: ({
361
- commit: c
362
- }) => ge(c)
367
+ commit: l
368
+ }) => _e(l)
363
369
  });
364
- }, he = (t) => {
365
- const e = y(z);
370
+ }, be = (t) => {
371
+ const e = v(Y);
366
372
  if (!e) return;
367
373
  const n = {
368
374
  width: e.width,
369
375
  height: e.height
370
376
  }, o = Math.abs(e.width - e.startWidth) > 1 || Math.abs(e.height - e.startHeight) > 1;
371
- t && o && jt()(u(), n), e.stopInteraction(), Q(null), I = void 0;
372
- }, fe = (t) => {
373
- if (t.button !== 0 || v()) return;
374
- t.preventDefault(), t.stopPropagation(), I?.stop({
377
+ t && o && Bt()(w(), n), e.stopInteraction(), ot(null), M = void 0;
378
+ }, ve = (t) => {
379
+ if (t.button !== 0 || $()) return;
380
+ t.preventDefault(), t.stopPropagation(), M?.stop({
375
381
  reason: "manual_stop",
376
382
  commit: !1
377
- }), Z()(u());
378
- const e = pt("resize", "nwse-resize"), n = J(), o = wt();
379
- Q({
383
+ }), J()(w());
384
+ const e = St("resize", "nwse-resize"), n = et(), o = mt();
385
+ ot({
380
386
  pointerId: t.pointerId,
381
387
  startClientX: t.clientX,
382
388
  startClientY: t.clientY,
@@ -387,144 +393,163 @@ function Qe(i) {
387
393
  scale: n,
388
394
  stopInteraction: e
389
395
  });
390
- const r = (s) => {
391
- Q((c) => {
392
- if (!c || c.pointerId !== s.pointerId) return c;
393
- const d = Math.max(Fe, c.startWidth + (s.clientX - c.startClientX) / c.scale), _ = Math.max(je, c.startHeight + (s.clientY - c.startClientY) / c.scale);
396
+ const i = (s) => {
397
+ ot((l) => {
398
+ if (!l || l.pointerId !== s.pointerId) return l;
399
+ const d = Math.max(Ge, l.startWidth + (s.clientX - l.startClientX) / l.scale), _ = Math.max(Ze, l.startHeight + (s.clientY - l.startClientY) / l.scale);
394
400
  return {
395
- ...c,
401
+ ...l,
396
402
  width: d,
397
403
  height: _
398
404
  };
399
405
  });
400
406
  };
401
- I = Lt({
407
+ M = Dt({
402
408
  pointerEvent: t,
403
409
  captureEl: t.currentTarget,
404
- onMove: r,
410
+ onMove: i,
405
411
  onEnd: ({
406
412
  commit: s
407
- }) => he(s)
413
+ }) => be(s)
408
414
  });
409
415
  };
410
416
  return (() => {
411
- var t = Ye(), e = t.firstChild, n = e.firstChild, o = n.firstChild, r = o.firstChild, s = r.nextSibling, c = s.nextSibling, d = o.nextSibling, _ = d.nextSibling, k = _.nextSibling, pe = k.firstChild, xt = pe.nextSibling, me = k.nextSibling, q = me.firstChild, B = q.nextSibling, it = B.nextSibling, _e = n.nextSibling, Wt = w;
412
- return typeof Wt == "function" ? $e(Wt, t) : w = t, It(t, be({
417
+ var t = Be(), e = t.firstChild, n = e.firstChild, o = n.firstChild, i = o.firstChild, s = i.nextSibling, l = s.nextSibling, d = o.nextSibling, _ = d.nextSibling, P = _.nextSibling, Se = P.firstChild, ct = Se.nextSibling, Mt = P.nextSibling, N = Mt.firstChild, G = N.nextSibling, lt = G.nextSibling, ke = n.nextSibling, Et = g;
418
+ return typeof Et == "function" ? Ce(Et, t) : g = t, Lt(t, $e({
413
419
  get "data-floe-surface-interacting"() {
414
- return j() || O() ? "true" : void 0;
420
+ return O() || V() ? "true" : void 0;
415
421
  },
416
422
  get classList() {
417
423
  return {
418
- "is-selected": A(),
419
- "is-dragging": j(),
420
- "is-resizing": O(),
421
- "is-filtered-out": U(),
422
- "is-projected-surface": b() === "projected_surface",
423
- "is-locked": v(),
424
- "is-entering": yt()
424
+ "is-selected": R(),
425
+ "is-dragging": O(),
426
+ "is-resizing": V(),
427
+ "is-filtered-out": tt(),
428
+ "is-projected-surface": S() === "projected_surface",
429
+ "is-locked": $(),
430
+ "is-entering": Tt()
425
431
  };
426
432
  }
427
433
  }, () => ({
428
- [h().dialogSurfaceHostAttr]: "true"
434
+ [f().dialogSurfaceHostAttr]: "true"
429
435
  }), {
430
436
  get "data-floe-workbench-widget-id"() {
431
- return u();
437
+ return w();
432
438
  }
433
439
  }, () => ({
434
- [h().widgetRootAttr]: "true"
440
+ [f().widgetRootAttr]: "true"
435
441
  }), () => ({
436
- [h().widgetIdAttr]: u()
442
+ [f().widgetIdAttr]: w()
437
443
  }), {
438
444
  get "data-workbench-widget-type"() {
439
- return ct();
445
+ return wt();
440
446
  },
441
447
  get "data-floe-workbench-render-mode"() {
442
- return b();
448
+ return S();
443
449
  },
444
450
  get "data-workbench-widget-motion"() {
445
- return yt() ? "enter" : void 0;
451
+ return Tt() ? "enter" : void 0;
446
452
  }
447
453
  }, () => ({
448
- [We]: A() ? "true" : void 0
454
+ [Ae]: R() ? "true" : void 0
449
455
  }), {
450
456
  tabIndex: 0,
451
- onPointerDown: se,
457
+ onPointerDown: he,
452
458
  onFocus: () => {
453
- tt() || gt() || G()(u());
459
+ nt() || _t() || U()(w());
454
460
  },
455
- onContextMenu: (l) => {
456
- H(l.target) === "widget_shell" && (l.preventDefault(), l.stopPropagation(), Dt()(l, L()()));
461
+ onContextMenu: (a) => {
462
+ q(a.target) === "widget_shell" && (a.preventDefault(), a.stopPropagation(), Vt()(a, z()()));
457
463
  },
458
464
  get style() {
459
- return we();
465
+ return me();
460
466
  }
461
- }), !1, !0), n.$$pointerdown = Pt, It(n, {
462
- [Ce]: "true"
463
- }, !1, !0), r.$$click = $t, r.$$pointerdown = (l) => l.stopPropagation(), f(r, m(Tt, {
467
+ }), !1, !0), n.$$pointerdown = It, Lt(n, {
468
+ [Le]: "true"
469
+ }, !1, !0), i.$$click = Ct, i.$$pointerdown = (a) => a.stopPropagation(), u(i, p(zt, {
464
470
  class: "workbench-widget__traffic-icon",
465
471
  "aria-hidden": "true"
466
- })), s.$$click = St, s.$$pointerdown = (l) => l.stopPropagation(), f(s, m(Et, {
472
+ })), s.$$click = Wt, s.$$pointerdown = (a) => a.stopPropagation(), u(s, p(Xt, {
467
473
  class: "workbench-widget__traffic-icon",
468
474
  "aria-hidden": "true"
469
- })), c.$$click = kt, c.$$pointerdown = (l) => l.stopPropagation(), f(c, m(At, {
475
+ })), l.$$click = xt, l.$$pointerdown = (a) => a.stopPropagation(), u(l, p(Yt, {
470
476
  class: "workbench-widget__traffic-icon",
471
477
  "aria-hidden": "true"
472
- })), f(d, ue), _.$$pointerdown = Pt, f(_, m(xe, {
478
+ })), u(d, pe), _.$$pointerdown = It, u(_, p(Ee, {
473
479
  class: "w-3.5 h-3.5"
474
- })), f(k, () => {
475
- const l = N().icon;
476
- return m(l, {
480
+ })), u(P, () => {
481
+ const a = Z().icon;
482
+ return p(a, {
477
483
  class: "w-3.5 h-3.5"
478
484
  });
479
- }, xt), f(xt, at), q.$$click = St, q.$$pointerdown = (l) => l.stopPropagation(), f(q, m(Et, {
485
+ }, ct), u(ct, K), u(n, p(Ie, {
486
+ get when() {
487
+ return W()?.actions;
488
+ },
489
+ get children() {
490
+ var a = qe();
491
+ return a.$$dblclick = (b) => b.stopPropagation(), a.$$pointerdown = (b) => b.stopPropagation(), u(a, () => W()?.actions), a;
492
+ }
493
+ }), Mt), N.$$click = Wt, N.$$pointerdown = (a) => a.stopPropagation(), u(N, p(Xt, {
480
494
  class: "workbench-widget__window-control-icon",
481
495
  "aria-hidden": "true"
482
- })), B.$$click = kt, B.$$pointerdown = (l) => l.stopPropagation(), f(B, m(At, {
496
+ })), G.$$click = xt, G.$$pointerdown = (a) => a.stopPropagation(), u(G, p(Yt, {
483
497
  class: "workbench-widget__window-control-icon",
484
498
  "aria-hidden": "true"
485
- })), it.$$click = $t, it.$$pointerdown = (l) => l.stopPropagation(), f(it, m(Tt, {
499
+ })), lt.$$click = Ct, lt.$$pointerdown = (a) => a.stopPropagation(), u(lt, p(zt, {
486
500
  class: "workbench-widget__window-control-icon",
487
501
  "aria-hidden": "true"
488
- })), f(_e, () => {
489
- const l = N().body;
490
- return m(l, {
491
- get widgetId() {
492
- return u();
493
- },
494
- get title() {
495
- return at();
496
- },
497
- get type() {
498
- return ct();
499
- },
500
- surfaceMetrics: ot,
501
- get activation() {
502
- return Ut();
503
- },
504
- get lifecycle() {
505
- return re();
506
- },
507
- get motion() {
508
- return st();
509
- },
510
- get selected() {
511
- return A();
512
- },
513
- get filtered() {
514
- return U();
515
- },
516
- requestActivate: ae
517
- });
518
- }), f(e, (() => {
519
- var l = ve(() => !!v());
520
- return () => l() ? null : (() => {
521
- var Ct = De();
522
- return Ct.$$pointerdown = fe, Ct;
502
+ })), u(ke, p(Ve.Provider, {
503
+ value: Ft,
504
+ get children() {
505
+ return (() => {
506
+ const a = Z().body;
507
+ return p(a, {
508
+ get widgetId() {
509
+ return w();
510
+ },
511
+ get title() {
512
+ return K();
513
+ },
514
+ get type() {
515
+ return wt();
516
+ },
517
+ surfaceMetrics: it,
518
+ get activation() {
519
+ return oe();
520
+ },
521
+ get lifecycle() {
522
+ return de();
523
+ },
524
+ get motion() {
525
+ return ht();
526
+ },
527
+ get selected() {
528
+ return R();
529
+ },
530
+ get filtered() {
531
+ return tt();
532
+ },
533
+ requestActivate: ue
534
+ });
535
+ })();
536
+ }
537
+ })), u(e, (() => {
538
+ var a = ye(() => !!$());
539
+ return () => a() ? null : (() => {
540
+ var b = Ne();
541
+ return b.$$pointerdown = ve, b;
523
542
  })();
524
- })(), null), Se((l) => ke(e, de(), l)), t;
543
+ })(), null), Pe((a) => {
544
+ var b = fe(), At = W()?.titleTooltip || K();
545
+ return a.e = We(e, b, a.e), At !== a.t && xe(ct, "title", a.t = At), a;
546
+ }, {
547
+ e: void 0,
548
+ t: void 0
549
+ }), t;
525
550
  })();
526
551
  }
527
- ye(["pointerdown", "click"]);
552
+ Te(["pointerdown", "click", "dblclick"]);
528
553
  export {
529
- Qe as WorkbenchWidget
554
+ lo as WorkbenchWidget
530
555
  };