@floegence/floe-webapp-core 0.36.43 → 0.36.45

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