@floegence/floe-webapp-core 0.36.24 → 0.36.26

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,381 +1,405 @@
1
- import { spread as j, mergeProps as ut, insert as c, createComponent as w, memo as ht, template as K, use as ft, delegateEvents as _t } from "solid-js/web";
2
- import { createMemo as h, createSignal as p, onCleanup as bt, untrack as f } from "solid-js";
3
- import { startHotInteraction as mt } from "../../utils/hotInteraction.js";
4
- import { X as N, Minus as V, Maximize as Z, GripVertical as vt } from "../icons/index.js";
5
- import { CANVAS_WHEEL_INTERACTIVE_ATTR as St, WORKBENCH_WIDGET_SHELL_ATTR as kt, resolveWorkbenchWidgetLocalTypingTarget as $t, shouldActivateWorkbenchWidgetLocalTarget as yt } from "../ui/localInteractionSurface.js";
6
- import { startPointerSession as G } from "../ui/pointerSession.js";
7
- import { createWorkbenchWidgetSurfaceMetrics as It } from "./workbenchHelpers.js";
8
- import { resolveWorkbenchInteractionAdapter as xt } from "./workbenchInteractionAdapter.js";
9
- var Mt = /* @__PURE__ */ K('<article class=workbench-widget><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>'), Tt = /* @__PURE__ */ K('<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 Ct = 220, Wt = 160;
11
- function Pt(t) {
12
- const d = h(() => xt(t.interactionAdapter)), [S, M] = p(null), [k, T] = p(null), [J, Q] = p();
13
- let _, b, z = 0, m = null, v = null, s;
14
- const R = (e, i) => {
15
- const o = mt({
16
- kind: e,
1
+ import { spread as G, mergeProps as kt, insert as l, createComponent as w, memo as $t, template as et, use as yt, delegateEvents as pt } from "solid-js/web";
2
+ import { createMemo as g, createSignal as T, onCleanup as K, untrack as f, createEffect as It } from "solid-js";
3
+ import { startHotInteraction as xt } from "../../utils/hotInteraction.js";
4
+ import { X as U, Minus as J, Maximize as Q, GripVertical as Mt } from "../icons/index.js";
5
+ import { CANVAS_WHEEL_INTERACTIVE_ATTR as Ct, WORKBENCH_WIDGET_SHELL_ATTR as Tt, resolveWorkbenchWidgetLocalTypingTarget as Wt, shouldActivateWorkbenchWidgetLocalTarget as Lt } from "../ui/localInteractionSurface.js";
6
+ import { startPointerSession as tt } from "../ui/pointerSession.js";
7
+ import { createWorkbenchWidgetSurfaceMetrics as Pt } from "./workbenchHelpers.js";
8
+ import { resolveWorkbenchInteractionAdapter as zt } from "./workbenchInteractionAdapter.js";
9
+ var Et = /* @__PURE__ */ et('<article class=workbench-widget><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>'), Rt = /* @__PURE__ */ et('<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 At = 220, Dt = 160;
11
+ function Nt(e) {
12
+ const s = g(() => zt(e.interactionAdapter)), [k, W] = T(null), [$, L] = T(null), [it, nt] = T(), [P, z] = T(!1);
13
+ let m, _, ot = 0, rt = 0, b = null;
14
+ const v = /* @__PURE__ */ new Map();
15
+ let d;
16
+ const D = (t, i) => {
17
+ const a = xt({
18
+ kind: t,
17
19
  cursor: i
18
20
  });
19
- let a = !1;
20
- return f(() => t.onLayoutInteractionStart?.()), () => {
21
- a || (a = !0, o(), f(() => t.onLayoutInteractionEnd?.()));
21
+ let n = !1;
22
+ return f(() => e.onLayoutInteractionStart?.()), () => {
23
+ n || (n = !0, a(), f(() => e.onLayoutInteractionEnd?.()));
22
24
  };
23
25
  };
24
- bt(() => {
25
- _?.stop({
26
+ K(() => {
27
+ m?.stop({
26
28
  reason: "manual_stop",
27
29
  commit: !1
28
- }), _ = void 0, b?.stop({
30
+ }), m = void 0, _?.stop({
29
31
  reason: "manual_stop",
30
32
  commit: !1
31
- }), b = void 0, f(S)?.stopInteraction(), f(k)?.stopInteraction();
33
+ }), _ = void 0, f(k)?.stopInteraction(), f($)?.stopInteraction();
32
34
  });
33
- const A = () => S() !== null, D = () => k() !== null, U = h(() => t.filtered ? "cold" : t.selected ? "hot" : "warm"), L = (e) => d().resolveWidgetEventOwnership({
34
- target: e,
35
- widgetRoot: s ?? null,
36
- interactiveSelector: d().interactiveSelector,
37
- panSurfaceSelector: d().panSurfaceSelector
38
- }), tt = () => {
39
- t.onSelect(t.widgetId), t.onCommitFront(t.widgetId), s?.focus({
35
+ const y = () => {
36
+ z(!1), e.onSelect(e.widgetId), e.onCommitFront(e.widgetId);
37
+ }, E = () => {
38
+ z(!1);
39
+ }, S = g(() => e.selected || P()), at = (t, i, a) => {
40
+ const n = {
41
+ token: ++rt,
42
+ wasSelected: i,
43
+ ownership: a
44
+ };
45
+ v.set(t, n), !i && a === "widget_local" && z(!0), queueMicrotask(() => {
46
+ v.get(t)?.token === n.token && v.delete(t);
47
+ });
48
+ }, ct = (t) => {
49
+ const i = v.get(t) ?? null;
50
+ return i && v.delete(t), i;
51
+ };
52
+ It(() => {
53
+ const t = d;
54
+ if (!t) return;
55
+ const i = (o) => {
56
+ o.button === 0 && at(o.pointerId, S(), p(o.target));
57
+ }, a = (o) => {
58
+ o.button === 0 && P() && p(o.target) === "widget_local" && y();
59
+ }, n = () => {
60
+ setTimeout(() => {
61
+ e.selected || E();
62
+ }, 0);
63
+ };
64
+ t.addEventListener("pointerdown", i, !0), t.addEventListener("click", a, !0), t.addEventListener("pointerup", n), t.addEventListener("pointercancel", E), K(() => {
65
+ t.removeEventListener("pointerdown", i, !0), t.removeEventListener("click", a, !0), t.removeEventListener("pointerup", n), t.removeEventListener("pointercancel", E);
66
+ });
67
+ });
68
+ const X = () => k() !== null, Y = () => $() !== null, lt = g(() => e.filtered ? "cold" : S() ? "hot" : "warm"), p = (t) => s().resolveWidgetEventOwnership({
69
+ target: t,
70
+ widgetRoot: d ?? null,
71
+ interactiveSelector: s().interactiveSelector,
72
+ panSurfaceSelector: s().panSurfaceSelector
73
+ }), dt = () => {
74
+ y(), d?.focus({
40
75
  preventScroll: !0
41
76
  });
42
- }, X = (e) => {
43
- Q((i) => ({
77
+ }, F = (t) => {
78
+ nt((i) => ({
44
79
  seq: (i?.seq ?? 0) + 1,
45
80
  source: "local_pointer",
46
- pointerType: e
81
+ pointerType: t
47
82
  }));
48
- }, et = (e) => {
49
- if (!(!s || !e.isConnected || !s.contains(e)))
83
+ }, st = (t) => {
84
+ if (!(!d || !t.isConnected || !d.contains(t)))
50
85
  try {
51
- e.focus({
86
+ t.focus({
52
87
  preventScroll: !0
53
88
  });
54
89
  } catch {
55
- e.focus();
90
+ t.focus();
56
91
  }
57
- }, it = (e, i) => {
58
- m = {
59
- token: ++z,
60
- pointerId: e,
61
- pointerType: i,
62
- timestamp: Date.now()
63
- };
64
- const o = m;
65
- queueMicrotask(() => {
66
- !o || m?.token !== o.token || (X(o.pointerType), m = null);
67
- });
68
- }, nt = (e, i) => {
69
- v = {
70
- token: ++z,
71
- pointerId: e,
92
+ }, wt = (t, i) => {
93
+ b = {
94
+ token: ++ot,
95
+ pointerId: t,
72
96
  target: i,
73
97
  timestamp: Date.now()
74
98
  };
75
- const o = v;
99
+ const a = b;
76
100
  queueMicrotask(() => {
77
- const a = () => {
78
- !o || v?.token !== o.token || (et(o.target), v = null);
101
+ const n = () => {
102
+ !a || b?.token !== a.token || (st(a.target), b = null);
79
103
  };
80
104
  if (typeof requestAnimationFrame == "function") {
81
- requestAnimationFrame(() => a());
105
+ requestAnimationFrame(() => n());
82
106
  return;
83
107
  }
84
- a();
108
+ n();
85
109
  });
86
- }, ot = (e) => {
87
- if (e.button !== 0) return;
88
- const i = t.selected, o = L(e.target), a = o === "widget_local" ? $t({
89
- target: e.target,
90
- widgetRoot: s ?? null,
91
- interactiveSelector: d().interactiveSelector,
92
- panSurfaceSelector: d().panSurfaceSelector
93
- }) : null, l = o === "widget_local" && !a && yt({
94
- target: e.target,
95
- widgetRoot: s ?? null,
96
- interactiveSelector: d().interactiveSelector,
97
- panSurfaceSelector: d().panSurfaceSelector
110
+ }, ut = (t) => {
111
+ if (t.button !== 0) return;
112
+ const i = ct(t.pointerId), a = i?.wasSelected ?? e.selected, n = i?.ownership ?? p(t.target), o = n === "widget_local" ? Wt({
113
+ target: t.target,
114
+ widgetRoot: d ?? null,
115
+ interactiveSelector: s().interactiveSelector,
116
+ panSurfaceSelector: s().panSurfaceSelector
117
+ }) : null, r = n === "widget_local" && !o && Lt({
118
+ target: t.target,
119
+ widgetRoot: d ?? null,
120
+ interactiveSelector: s().interactiveSelector,
121
+ panSurfaceSelector: s().panSurfaceSelector
98
122
  });
99
- if (t.onSelect(t.widgetId), t.onCommitFront(t.widgetId), o === "widget_shell") {
100
- s?.focus({
123
+ if (n === "widget_shell") {
124
+ y(), d?.focus({
101
125
  preventScroll: !0
102
126
  });
103
127
  return;
104
128
  }
105
- if (o === "widget_local") {
106
- if (a) {
107
- m = null, i || nt(e.pointerId, a);
129
+ if (n === "widget_local") {
130
+ if (o) {
131
+ a || wt(t.pointerId, o);
108
132
  return;
109
133
  }
110
- if (l) {
111
- if (v = null, i) {
112
- X(e.pointerType || void 0);
134
+ if (r) {
135
+ if (b = null, a) {
136
+ F(t.pointerType || void 0);
113
137
  return;
114
138
  }
115
- it(e.pointerId, e.pointerType || void 0);
139
+ y(), F(t.pointerType || void 0);
116
140
  }
117
141
  }
118
- }, $ = h(() => {
119
- const e = S();
120
- return e ? {
121
- x: e.worldX,
122
- y: e.worldY
142
+ }, I = g(() => {
143
+ const t = k();
144
+ return t ? {
145
+ x: t.worldX,
146
+ y: t.worldY
123
147
  } : {
124
- x: t.x,
125
- y: t.y
148
+ x: e.x,
149
+ y: e.y
126
150
  };
127
- }), y = h(() => {
128
- const e = k();
129
- return e ? {
130
- width: e.width,
131
- height: e.height
132
- } : {
151
+ }), x = g(() => {
152
+ const t = $();
153
+ return t ? {
133
154
  width: t.width,
134
155
  height: t.height
156
+ } : {
157
+ width: e.width,
158
+ height: e.height
135
159
  };
136
- }), Y = h(() => {
137
- if (!(t.layoutMode !== "projected_surface" || !t.projectedViewport))
138
- return It({
139
- widgetId: t.widgetId,
140
- worldX: $().x,
141
- worldY: $().y,
142
- worldWidth: y().width,
143
- worldHeight: y().height,
144
- viewport: t.projectedViewport(),
145
- ready: t.surfaceReady ?? !0
160
+ }), H = g(() => {
161
+ if (!(e.layoutMode !== "projected_surface" || !e.projectedViewport))
162
+ return Pt({
163
+ widgetId: e.widgetId,
164
+ worldX: I().x,
165
+ worldY: I().y,
166
+ worldWidth: x().width,
167
+ worldHeight: x().height,
168
+ viewport: e.projectedViewport(),
169
+ ready: e.surfaceReady ?? !0
146
170
  });
147
- }), at = h(() => {
148
- const e = t.itemSnapshot().z_index, i = Number.isFinite(e) ? Math.max(1, Math.min(99, Math.round(e))) : 1;
171
+ }), gt = g(() => {
172
+ const t = e.itemSnapshot().z_index, i = Number.isFinite(t) ? Math.max(1, Math.min(99, Math.round(t))) : 1;
149
173
  return String(i).padStart(2, "0");
150
- }), P = (e) => {
151
- e.preventDefault(), e.stopPropagation(), t.onRequestOverview(t.itemSnapshot());
152
- }, E = (e) => {
153
- e.preventDefault(), e.stopPropagation(), t.onRequestFit(t.itemSnapshot());
154
- }, F = (e) => {
155
- e.preventDefault(), e.stopPropagation(), t.onRequestDelete(t.widgetId);
156
- }, rt = h(() => {
157
- const e = {
158
- width: `${y().width}px`,
159
- height: `${y().height}px`,
160
- "z-index": A() || D() || t.optimisticFront ? `${t.topRenderLayer + 1}` : `${t.renderLayer}`
174
+ }), O = (t) => {
175
+ t.preventDefault(), t.stopPropagation(), e.onRequestOverview(e.itemSnapshot());
176
+ }, q = (t) => {
177
+ t.preventDefault(), t.stopPropagation(), e.onRequestFit(e.itemSnapshot());
178
+ }, j = (t) => {
179
+ t.preventDefault(), t.stopPropagation(), e.onRequestDelete(e.widgetId);
180
+ }, ht = g(() => {
181
+ const t = {
182
+ width: `${x().width}px`,
183
+ height: `${x().height}px`,
184
+ "z-index": X() || Y() || e.optimisticFront ? `${e.topRenderLayer + 1}` : `${e.renderLayer}`
161
185
  };
162
- if (t.layoutMode === "projected_surface") {
163
- const i = Y()?.rect;
186
+ if (e.layoutMode === "projected_surface") {
187
+ const i = H()?.rect;
164
188
  return {
165
- ...e,
166
- transform: `translate3d(${i?.screenX ?? 0}px, ${i?.screenY ?? 0}px, 0) scale(${i?.viewportScale ?? Math.max(t.viewportScale, 1e-3)})`
189
+ ...t,
190
+ transform: `translate3d(${i?.screenX ?? 0}px, ${i?.screenY ?? 0}px, 0) scale(${i?.viewportScale ?? Math.max(e.viewportScale, 1e-3)})`
167
191
  };
168
192
  }
169
193
  return {
170
- ...e,
171
- transform: `translate(${$().x}px, ${$().y}px)`
194
+ ...t,
195
+ transform: `translate(${I().x}px, ${I().y}px)`
172
196
  };
173
- }), lt = (e) => {
174
- const i = f(S);
197
+ }), ft = (t) => {
198
+ const i = f(k);
175
199
  if (!i) return;
176
- const o = {
200
+ const a = {
177
201
  x: i.worldX,
178
202
  y: i.worldY
179
- }, a = {
203
+ }, n = {
180
204
  x: i.startWorldX,
181
205
  y: i.startWorldY
182
- }, l = e && (Math.abs(o.x - a.x) > 1 || Math.abs(o.y - a.y) > 1);
183
- t.onCommitFront(t.widgetId), l && t.onCommitMove(t.widgetId, o), i.stopInteraction(), M(null), _ = void 0;
184
- }, H = (e) => {
185
- if (e.button !== 0 || t.locked) return;
186
- e.preventDefault(), e.stopPropagation(), _?.stop({
206
+ }, o = t && (Math.abs(a.x - n.x) > 1 || Math.abs(a.y - n.y) > 1);
207
+ e.onCommitFront(e.widgetId), o && e.onCommitMove(e.widgetId, a), i.stopInteraction(), W(null), m = void 0;
208
+ }, B = (t) => {
209
+ if (t.button !== 0 || e.locked) return;
210
+ t.preventDefault(), t.stopPropagation(), m?.stop({
187
211
  reason: "manual_stop",
188
212
  commit: !1
189
- }), t.onSelect(t.widgetId), s?.focus({
213
+ }), e.onSelect(e.widgetId), d?.focus({
190
214
  preventScroll: !0
191
- }), t.onStartOptimisticFront(t.widgetId);
192
- const i = R("drag", "grabbing"), o = Math.max(t.viewportScale, 1e-3);
193
- M({
194
- pointerId: e.pointerId,
195
- startClientX: e.clientX,
196
- startClientY: e.clientY,
197
- startWorldX: t.x,
198
- startWorldY: t.y,
199
- worldX: t.x,
200
- worldY: t.y,
215
+ }), e.onStartOptimisticFront(e.widgetId);
216
+ const i = D("drag", "grabbing"), a = Math.max(e.viewportScale, 1e-3);
217
+ W({
218
+ pointerId: t.pointerId,
219
+ startClientX: t.clientX,
220
+ startClientY: t.clientY,
221
+ startWorldX: e.x,
222
+ startWorldY: e.y,
223
+ worldX: e.x,
224
+ worldY: e.y,
201
225
  moved: !1,
202
- scale: o,
226
+ scale: a,
203
227
  stopInteraction: i
204
228
  });
205
- const a = (l) => {
206
- M((n) => {
207
- if (!n || n.pointerId !== l.pointerId) return n;
208
- const u = n.startWorldX + (l.clientX - n.startClientX) / n.scale, g = n.startWorldY + (l.clientY - n.startClientY) / n.scale;
229
+ const n = (o) => {
230
+ W((r) => {
231
+ if (!r || r.pointerId !== o.pointerId) return r;
232
+ const h = r.startWorldX + (o.clientX - r.startClientX) / r.scale, u = r.startWorldY + (o.clientY - r.startClientY) / r.scale;
209
233
  return {
210
- ...n,
211
- worldX: u,
212
- worldY: g,
213
- moved: n.moved || Math.abs(u - n.startWorldX) > 2 || Math.abs(g - n.startWorldY) > 2
234
+ ...r,
235
+ worldX: h,
236
+ worldY: u,
237
+ moved: r.moved || Math.abs(h - r.startWorldX) > 2 || Math.abs(u - r.startWorldY) > 2
214
238
  };
215
239
  });
216
240
  };
217
- _ = G({
218
- pointerEvent: e,
219
- captureEl: e.currentTarget,
220
- onMove: a,
241
+ m = tt({
242
+ pointerEvent: t,
243
+ captureEl: t.currentTarget,
244
+ onMove: n,
221
245
  onEnd: ({
222
- commit: l
223
- }) => lt(l)
246
+ commit: o
247
+ }) => ft(o)
224
248
  });
225
- }, ct = (e) => {
226
- const i = f(k);
249
+ }, mt = (t) => {
250
+ const i = f($);
227
251
  if (!i) return;
228
- const o = {
252
+ const a = {
229
253
  width: i.width,
230
254
  height: i.height
231
- }, a = Math.abs(i.width - i.startWidth) > 1 || Math.abs(i.height - i.startHeight) > 1;
232
- e && a && t.onCommitResize(t.widgetId, o), i.stopInteraction(), T(null), b = void 0;
233
- }, dt = (e) => {
234
- if (e.button !== 0 || t.locked) return;
235
- e.preventDefault(), e.stopPropagation(), b?.stop({
255
+ }, n = Math.abs(i.width - i.startWidth) > 1 || Math.abs(i.height - i.startHeight) > 1;
256
+ t && n && e.onCommitResize(e.widgetId, a), i.stopInteraction(), L(null), _ = void 0;
257
+ }, _t = (t) => {
258
+ if (t.button !== 0 || e.locked) return;
259
+ t.preventDefault(), t.stopPropagation(), _?.stop({
236
260
  reason: "manual_stop",
237
261
  commit: !1
238
- }), t.onStartOptimisticFront(t.widgetId);
239
- const i = R("resize", "nwse-resize"), o = Math.max(t.viewportScale, 1e-3);
240
- T({
241
- pointerId: e.pointerId,
242
- startClientX: e.clientX,
243
- startClientY: e.clientY,
244
- startWidth: t.width,
245
- startHeight: t.height,
246
- width: t.width,
247
- height: t.height,
248
- scale: o,
262
+ }), e.onStartOptimisticFront(e.widgetId);
263
+ const i = D("resize", "nwse-resize"), a = Math.max(e.viewportScale, 1e-3);
264
+ L({
265
+ pointerId: t.pointerId,
266
+ startClientX: t.clientX,
267
+ startClientY: t.clientY,
268
+ startWidth: e.width,
269
+ startHeight: e.height,
270
+ width: e.width,
271
+ height: e.height,
272
+ scale: a,
249
273
  stopInteraction: i
250
274
  });
251
- const a = (l) => {
252
- T((n) => {
253
- if (!n || n.pointerId !== l.pointerId) return n;
254
- const u = Math.max(Ct, n.startWidth + (l.clientX - n.startClientX) / n.scale), g = Math.max(Wt, n.startHeight + (l.clientY - n.startClientY) / n.scale);
275
+ const n = (o) => {
276
+ L((r) => {
277
+ if (!r || r.pointerId !== o.pointerId) return r;
278
+ const h = Math.max(At, r.startWidth + (o.clientX - r.startClientX) / r.scale), u = Math.max(Dt, r.startHeight + (o.clientY - r.startClientY) / r.scale);
255
279
  return {
256
- ...n,
257
- width: u,
258
- height: g
280
+ ...r,
281
+ width: h,
282
+ height: u
259
283
  };
260
284
  });
261
285
  };
262
- b = G({
263
- pointerEvent: e,
264
- captureEl: e.currentTarget,
265
- onMove: a,
286
+ _ = tt({
287
+ pointerEvent: t,
288
+ captureEl: t.currentTarget,
289
+ onMove: n,
266
290
  onEnd: ({
267
- commit: l
268
- }) => ct(l)
291
+ commit: o
292
+ }) => mt(o)
269
293
  });
270
294
  };
271
295
  return (() => {
272
- var e = Mt(), i = e.firstChild, o = i.firstChild, a = o.firstChild, l = a.nextSibling, n = l.nextSibling, u = o.nextSibling, g = u.nextSibling, C = g.nextSibling, st = C.firstChild, q = st.nextSibling, wt = C.nextSibling, I = wt.firstChild, x = I.nextSibling, W = x.nextSibling, gt = i.nextSibling, B = s;
273
- return typeof B == "function" ? ft(B, e) : s = e, j(e, ut({
296
+ var t = Et(), i = t.firstChild, a = i.firstChild, n = a.firstChild, o = n.nextSibling, r = o.nextSibling, h = a.nextSibling, u = h.nextSibling, R = u.nextSibling, bt = R.firstChild, N = bt.nextSibling, vt = R.nextSibling, M = vt.firstChild, C = M.nextSibling, A = C.nextSibling, St = i.nextSibling, V = d;
297
+ return typeof V == "function" ? yt(V, t) : d = t, G(t, kt({
274
298
  get classList() {
275
299
  return {
276
- "is-selected": t.selected,
277
- "is-dragging": A(),
278
- "is-resizing": D(),
279
- "is-filtered-out": t.filtered,
280
- "is-projected-surface": t.layoutMode === "projected_surface",
281
- "is-locked": t.locked
300
+ "is-selected": S(),
301
+ "is-dragging": X(),
302
+ "is-resizing": Y(),
303
+ "is-filtered-out": e.filtered,
304
+ "is-projected-surface": e.layoutMode === "projected_surface",
305
+ "is-locked": e.locked
282
306
  };
283
307
  }
284
308
  }, () => ({
285
- [d().dialogSurfaceHostAttr]: "true"
309
+ [s().dialogSurfaceHostAttr]: "true"
286
310
  }), {
287
311
  get "data-floe-workbench-widget-id"() {
288
- return t.widgetId;
312
+ return e.widgetId;
289
313
  }
290
314
  }, () => ({
291
- [d().widgetRootAttr]: "true"
315
+ [s().widgetRootAttr]: "true"
292
316
  }), () => ({
293
- [d().widgetIdAttr]: t.widgetId
317
+ [s().widgetIdAttr]: e.widgetId
294
318
  }), {
295
319
  get "data-workbench-widget-type"() {
296
- return t.widgetType;
320
+ return e.widgetType;
297
321
  },
298
322
  get "data-floe-workbench-render-mode"() {
299
- return t.layoutMode ?? "canvas_scaled";
323
+ return e.layoutMode ?? "canvas_scaled";
300
324
  }
301
325
  }, () => ({
302
- [St]: t.selected ? "true" : void 0
326
+ [Ct]: S() ? "true" : void 0
303
327
  }), {
304
328
  tabIndex: 0,
305
- onPointerDown: ot,
329
+ onPointerDown: ut,
306
330
  onFocus: () => {
307
- t.onSelect(t.widgetId);
331
+ P() || e.onSelect(e.widgetId);
308
332
  },
309
- onContextMenu: (r) => {
310
- L(r.target) === "widget_shell" && (r.preventDefault(), r.stopPropagation(), t.onContextMenu(r, t.itemSnapshot()));
333
+ onContextMenu: (c) => {
334
+ p(c.target) === "widget_shell" && (c.preventDefault(), c.stopPropagation(), e.onContextMenu(c, e.itemSnapshot()));
311
335
  },
312
336
  get style() {
313
- return rt();
337
+ return ht();
314
338
  }
315
- }), !1, !0), i.$$pointerdown = H, j(i, {
316
- [kt]: "true"
317
- }, !1, !0), a.$$click = F, a.$$pointerdown = (r) => r.stopPropagation(), c(a, w(N, {
339
+ }), !1, !0), i.$$pointerdown = B, G(i, {
340
+ [Tt]: "true"
341
+ }, !1, !0), n.$$click = j, n.$$pointerdown = (c) => c.stopPropagation(), l(n, w(U, {
318
342
  class: "workbench-widget__traffic-icon",
319
343
  "aria-hidden": "true"
320
- })), l.$$click = P, l.$$pointerdown = (r) => r.stopPropagation(), c(l, w(V, {
344
+ })), o.$$click = O, o.$$pointerdown = (c) => c.stopPropagation(), l(o, w(J, {
321
345
  class: "workbench-widget__traffic-icon",
322
346
  "aria-hidden": "true"
323
- })), n.$$click = E, n.$$pointerdown = (r) => r.stopPropagation(), c(n, w(Z, {
347
+ })), r.$$click = q, r.$$pointerdown = (c) => c.stopPropagation(), l(r, w(Q, {
324
348
  class: "workbench-widget__traffic-icon",
325
349
  "aria-hidden": "true"
326
- })), c(u, at), g.$$pointerdown = H, c(g, w(vt, {
350
+ })), l(h, gt), u.$$pointerdown = B, l(u, w(Mt, {
327
351
  class: "w-3.5 h-3.5"
328
- })), c(C, () => {
329
- const r = t.definition.icon;
330
- return w(r, {
352
+ })), l(R, () => {
353
+ const c = e.definition.icon;
354
+ return w(c, {
331
355
  class: "w-3.5 h-3.5"
332
356
  });
333
- }, q), c(q, () => t.widgetTitle), I.$$click = P, I.$$pointerdown = (r) => r.stopPropagation(), c(I, w(V, {
357
+ }, N), l(N, () => e.widgetTitle), M.$$click = O, M.$$pointerdown = (c) => c.stopPropagation(), l(M, w(J, {
334
358
  class: "workbench-widget__window-control-icon",
335
359
  "aria-hidden": "true"
336
- })), x.$$click = E, x.$$pointerdown = (r) => r.stopPropagation(), c(x, w(Z, {
360
+ })), C.$$click = q, C.$$pointerdown = (c) => c.stopPropagation(), l(C, w(Q, {
337
361
  class: "workbench-widget__window-control-icon",
338
362
  "aria-hidden": "true"
339
- })), W.$$click = F, W.$$pointerdown = (r) => r.stopPropagation(), c(W, w(N, {
363
+ })), A.$$click = j, A.$$pointerdown = (c) => c.stopPropagation(), l(A, w(U, {
340
364
  class: "workbench-widget__window-control-icon",
341
365
  "aria-hidden": "true"
342
- })), c(gt, () => {
343
- const r = t.definition.body;
344
- return w(r, {
366
+ })), l(St, () => {
367
+ const c = e.definition.body;
368
+ return w(c, {
345
369
  get widgetId() {
346
- return t.widgetId;
370
+ return e.widgetId;
347
371
  },
348
372
  get title() {
349
- return t.widgetTitle;
373
+ return e.widgetTitle;
350
374
  },
351
375
  get type() {
352
- return t.widgetType;
376
+ return e.widgetType;
353
377
  },
354
- surfaceMetrics: Y,
378
+ surfaceMetrics: H,
355
379
  get activation() {
356
- return J();
380
+ return it();
357
381
  },
358
382
  get lifecycle() {
359
- return U();
383
+ return lt();
360
384
  },
361
385
  get selected() {
362
- return t.selected;
386
+ return S();
363
387
  },
364
388
  get filtered() {
365
- return t.filtered;
389
+ return e.filtered;
366
390
  },
367
- requestActivate: tt
391
+ requestActivate: dt
368
392
  });
369
- }), c(e, (() => {
370
- var r = ht(() => !!t.locked);
371
- return () => r() ? null : (() => {
372
- var O = Tt();
373
- return O.$$pointerdown = dt, O;
393
+ }), l(t, (() => {
394
+ var c = $t(() => !!e.locked);
395
+ return () => c() ? null : (() => {
396
+ var Z = Rt();
397
+ return Z.$$pointerdown = _t, Z;
374
398
  })();
375
- })(), null), e;
399
+ })(), null), t;
376
400
  })();
377
401
  }
378
- _t(["pointerdown", "click"]);
402
+ pt(["pointerdown", "click"]);
379
403
  export {
380
- Pt as WorkbenchWidget
404
+ Nt as WorkbenchWidget
381
405
  };
@@ -1,103 +1,112 @@
1
- import { isTypingElement as R } from "../../utils/dom.js";
2
- import { DEFAULT_CANVAS_WHEEL_INTERACTIVE_SELECTOR as v, resolveWorkbenchWidgetEventOwnership as W, DEFAULT_WORKBENCH_WIDGET_SHELL_SELECTOR as I, resolveSurfaceInteractionTargetRole as T, resolveSurfaceWheelRouting as A } from "../ui/localInteractionSurface.js";
3
- const _ = "data-floe-workbench-surface-root", a = "data-floe-workbench-widget-root", s = "data-floe-workbench-widget-id", h = "data-floe-dialog-surface-host";
4
- function m(e) {
1
+ import { isTypingElement as E } from "../../utils/dom.js";
2
+ import { DEFAULT_CANVAS_WHEEL_INTERACTIVE_SELECTOR as R, resolveWorkbenchWidgetEventOwnership as v, DEFAULT_WORKBENCH_WIDGET_SHELL_SELECTOR as _, resolveSurfaceInteractionTargetRole as T, resolveSurfaceWheelRouting as A } from "../ui/localInteractionSurface.js";
3
+ const m = "data-floe-workbench-surface-root", a = "data-floe-workbench-widget-root", s = "data-floe-workbench-widget-id", h = "data-floe-dialog-surface-host";
4
+ function W(e) {
5
5
  return typeof Element < "u" && e instanceof Element ? e : typeof Node < "u" && e instanceof Node ? e.parentElement : null;
6
6
  }
7
- function g(e, t = s) {
8
- const r = (e?.getAttribute(t) ?? "").trim();
7
+ function S(e, n = s) {
8
+ const r = (e?.getAttribute(n) ?? "").trim();
9
9
  return r.length > 0 ? r : null;
10
10
  }
11
- function O(e, t = a) {
12
- if (!(e instanceof Element)) return null;
13
- const o = e.closest(`[${t}="true"]`);
14
- return o instanceof HTMLElement ? o : null;
11
+ function O(e, n = a) {
12
+ const o = W(e);
13
+ if (!o) return null;
14
+ const r = o.closest(`[${n}="true"]`);
15
+ return r instanceof HTMLElement ? r : null;
15
16
  }
16
17
  function k(e) {
17
18
  const {
18
- root: t,
19
+ root: n,
19
20
  widgetId: o,
20
21
  widgetRootAttr: r = a,
21
- readWidgetId: c = (i) => g(i, s)
22
+ readWidgetId: c = (i) => S(i, s)
22
23
  } = e;
23
- if (!t || typeof t.querySelectorAll != "function") return null;
24
- const l = t.querySelectorAll(`[${r}="true"]`);
24
+ if (!n || typeof n.querySelectorAll != "function") return null;
25
+ const l = n.querySelectorAll(`[${r}="true"]`);
25
26
  for (const i of l)
26
27
  if (i instanceof HTMLElement && c(i) === o)
27
28
  return i;
28
29
  return null;
29
30
  }
30
31
  function b(e) {
31
- const t = k(e);
32
- return t ? (t.focus({ preventScroll: !0 }), !0) : !1;
32
+ const n = k(e);
33
+ return n ? (n.focus({ preventScroll: !0 }), !0) : !1;
33
34
  }
34
- function d(e) {
35
+ function g(e) {
35
36
  return { kind: "canvas", reason: e };
36
37
  }
37
- function C(e, t) {
38
- return { kind: "widget", widgetId: e, reason: t };
38
+ function p(e, n) {
39
+ return { kind: "widget", widgetId: e, reason: n };
39
40
  }
40
- function H(e) {
41
- const t = A({
41
+ function C(e) {
42
+ const n = e.findWidgetRoot(e.target);
43
+ if (n) {
44
+ const r = e.readWidgetId(n);
45
+ return r !== null && r === e.selectedWidgetId ? { kind: "local_surface", reason: "selected_widget" } : e.disablePanZoom ? { kind: "ignore", reason: "pan_zoom_disabled" } : { kind: "canvas_zoom" };
46
+ }
47
+ const o = A({
42
48
  target: e.target,
43
49
  disablePanZoom: e.disablePanZoom,
44
50
  wheelInteractiveSelector: e.wheelInteractiveSelector
45
51
  });
46
- return t.kind === "canvas_zoom" ? t : t.kind === "local_surface" ? { kind: "local_surface", reason: t.reason } : { kind: "ignore", reason: t.reason };
52
+ return o.kind === "canvas_zoom" ? o : o.kind === "local_surface" ? { kind: "local_surface", reason: o.reason } : { kind: "ignore", reason: o.reason };
47
53
  }
48
54
  function D(e) {
49
- const t = e?.surfaceRootAttr ?? _, o = e?.widgetRootAttr ?? a, r = e?.widgetIdAttr ?? s, c = e?.dialogSurfaceHostAttr ?? h, l = e?.interactiveSelector ?? '[data-floe-canvas-interactive="true"]', i = e?.panSurfaceSelector ?? '[data-floe-canvas-pan-surface="true"]', S = e?.wheelInteractiveSelector ?? v, f = e?.readWidgetId ?? ((n) => g(n, r)), E = e?.findWidgetRoot ?? ((n) => O(n, o)), w = e?.focusWidgetElement ?? ((n, u) => b({
50
- root: n,
55
+ const n = e?.surfaceRootAttr ?? m, o = e?.widgetRootAttr ?? a, r = e?.widgetIdAttr ?? s, c = e?.dialogSurfaceHostAttr ?? h, l = e?.interactiveSelector ?? '[data-floe-canvas-interactive="true"]', i = e?.panSurfaceSelector ?? '[data-floe-canvas-pan-surface="true"]', w = e?.wheelInteractiveSelector ?? R, d = e?.readWidgetId ?? ((t) => S(t, r)), f = e?.findWidgetRoot ?? ((t) => O(t, o)), I = e?.focusWidgetElement ?? ((t, u) => b({
56
+ root: t,
51
57
  widgetId: u,
52
58
  widgetRootAttr: o,
53
- readWidgetId: f
59
+ readWidgetId: d
54
60
  }));
55
61
  return {
56
62
  ...e,
57
- surfaceRootAttr: t,
63
+ surfaceRootAttr: n,
58
64
  widgetRootAttr: o,
59
65
  widgetIdAttr: r,
60
66
  dialogSurfaceHostAttr: c,
61
67
  interactiveSelector: l,
62
68
  panSurfaceSelector: i,
63
- wheelInteractiveSelector: S,
64
- createInitialInputOwner: e?.createInitialInputOwner ?? (() => d("initial")),
65
- createCanvasInputOwner: e?.createCanvasInputOwner ?? d,
66
- createWidgetInputOwner: e?.createWidgetInputOwner ?? C,
67
- readWidgetId: f,
68
- findWidgetRoot: E,
69
- focusWidgetElement: w,
70
- resolveSurfaceTargetRole: e?.resolveSurfaceTargetRole ?? ((n) => T({
71
- target: n.target,
72
- interactiveSelector: n.interactiveSelector,
73
- panSurfaceSelector: n.panSurfaceSelector
69
+ wheelInteractiveSelector: w,
70
+ createInitialInputOwner: e?.createInitialInputOwner ?? (() => g("initial")),
71
+ createCanvasInputOwner: e?.createCanvasInputOwner ?? g,
72
+ createWidgetInputOwner: e?.createWidgetInputOwner ?? p,
73
+ readWidgetId: d,
74
+ findWidgetRoot: f,
75
+ focusWidgetElement: I,
76
+ resolveSurfaceTargetRole: e?.resolveSurfaceTargetRole ?? ((t) => T({
77
+ target: t.target,
78
+ interactiveSelector: t.interactiveSelector,
79
+ panSurfaceSelector: t.panSurfaceSelector
74
80
  })),
75
- resolveWidgetEventOwnership: e?.resolveWidgetEventOwnership ?? ((n) => W({
76
- target: n.target,
77
- widgetRoot: n.widgetRoot,
78
- interactiveSelector: n.interactiveSelector,
79
- panSurfaceSelector: n.panSurfaceSelector,
80
- shellSelector: I
81
+ resolveWidgetEventOwnership: e?.resolveWidgetEventOwnership ?? ((t) => v({
82
+ target: t.target,
83
+ widgetRoot: t.widgetRoot,
84
+ interactiveSelector: t.interactiveSelector,
85
+ panSurfaceSelector: t.panSurfaceSelector,
86
+ shellSelector: _
81
87
  })),
82
- resolveWheelRouting: e?.resolveWheelRouting ?? ((n) => H({
83
- target: n.target,
84
- disablePanZoom: n.disablePanZoom,
85
- wheelInteractiveSelector: n.wheelInteractiveSelector
88
+ resolveWheelRouting: e?.resolveWheelRouting ?? ((t) => C({
89
+ target: t.target,
90
+ disablePanZoom: t.disablePanZoom,
91
+ selectedWidgetId: t.selectedWidgetId,
92
+ wheelInteractiveSelector: t.wheelInteractiveSelector,
93
+ findWidgetRoot: f,
94
+ readWidgetId: d
86
95
  })),
87
- shouldBypassGlobalHotkeys: e?.shouldBypassGlobalHotkeys ?? ((n) => {
88
- const u = m(n.target);
89
- return R(u);
96
+ shouldBypassGlobalHotkeys: e?.shouldBypassGlobalHotkeys ?? ((t) => {
97
+ const u = W(t.target);
98
+ return E(u);
90
99
  })
91
100
  };
92
101
  }
93
102
  export {
94
103
  h as DEFAULT_WORKBENCH_DIALOG_SURFACE_HOST_ATTR,
95
- _ as DEFAULT_WORKBENCH_SURFACE_ROOT_ATTR,
104
+ m as DEFAULT_WORKBENCH_SURFACE_ROOT_ATTR,
96
105
  s as DEFAULT_WORKBENCH_WIDGET_ID_ATTR,
97
106
  a as DEFAULT_WORKBENCH_WIDGET_ROOT_ATTR,
98
107
  k as findWorkbenchWidgetElement,
99
108
  O as findWorkbenchWidgetRoot,
100
109
  b as focusWorkbenchWidgetElement,
101
- g as readWorkbenchWidgetId,
110
+ S as readWorkbenchWidgetId,
102
111
  D as resolveWorkbenchInteractionAdapter
103
112
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/floe-webapp-core",
3
- "version": "0.36.24",
3
+ "version": "0.36.26",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",