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