@floegence/floe-webapp-core 0.36.37 → 0.36.39

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