@floegence/floe-webapp-core 0.36.16 → 0.36.17

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,28 +1,35 @@
1
- import { spread as O, mergeProps as tt, insert as c, createComponent as w, memo as et, template as G, use as it, delegateEvents as nt } from "solid-js/web";
2
- import { createSignal as F, onCleanup as ot, untrack as M, createMemo as m } from "solid-js";
3
- import { startHotInteraction as N } from "../../utils/hotInteraction.js";
4
- import { X as j, Minus as B, Maximize as V, GripVertical as at } from "../icons/index.js";
5
- import { CANVAS_WHEEL_INTERACTIVE_ATTR as rt, WORKBENCH_WIDGET_SHELL_ATTR as dt, resolveWorkbenchWidgetEventOwnership as lt } from "../ui/localInteractionSurface.js";
6
- import { createWorkbenchWidgetSurfaceMetrics as ct } from "./workbenchHelpers.js";
7
- var st = /* @__PURE__ */ G('<article class=workbench-widget data-floe-dialog-surface-host=true><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>'), wt = /* @__PURE__ */ G('<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">');
8
- const gt = 220, ht = 160, ut = '[data-floe-canvas-interactive="true"]', bt = '[data-floe-canvas-pan-surface="true"]';
9
- function kt(t) {
10
- const [v, y] = F(null), [$, C] = F(null);
11
- let u, b, _;
12
- ot(() => {
13
- u?.abort(), u = void 0, b?.abort(), b = void 0, M(v)?.stopInteraction(), M($)?.stopInteraction();
1
+ import { spread as H, mergeProps as et, insert as l, createComponent as c, memo as it, template as B, use as nt, delegateEvents as ot } from "solid-js/web";
2
+ import { createSignal as L, onCleanup as at, untrack as S, createMemo as _ } from "solid-js";
3
+ import { startHotInteraction as O } from "../../utils/hotInteraction.js";
4
+ import { X as F, Minus as N, Maximize as A, GripVertical as rt } from "../icons/index.js";
5
+ import { CANVAS_WHEEL_INTERACTIVE_ATTR as dt, WORKBENCH_WIDGET_SHELL_ATTR as lt, resolveWorkbenchWidgetEventOwnership as ct } from "../ui/localInteractionSurface.js";
6
+ import { startPointerSession as j } from "../ui/pointerSession.js";
7
+ import { createWorkbenchWidgetSurfaceMetrics as st } from "./workbenchHelpers.js";
8
+ var wt = /* @__PURE__ */ B('<article class=workbench-widget data-floe-dialog-surface-host=true><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>'), gt = /* @__PURE__ */ B('<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">');
9
+ const ht = 220, ut = 160, _t = '[data-floe-canvas-interactive="true"]', ft = '[data-floe-canvas-pan-surface="true"]';
10
+ function xt(t) {
11
+ const [f, I] = L(null), [b, x] = L(null);
12
+ let g, h, u;
13
+ at(() => {
14
+ g?.stop({
15
+ reason: "manual_stop",
16
+ commit: !1
17
+ }), g = void 0, h?.stop({
18
+ reason: "manual_stop",
19
+ commit: !1
20
+ }), h = void 0, S(f)?.stopInteraction(), S(b)?.stopInteraction();
14
21
  });
15
- const E = () => v() !== null, R = () => $() !== null, z = (e) => lt({
22
+ const C = () => f() !== null, W = () => b() !== null, E = (e) => ct({
16
23
  target: e,
17
- widgetRoot: _ ?? null,
18
- interactiveSelector: ut,
19
- panSurfaceSelector: bt
20
- }), Z = (e) => {
21
- e.button === 0 && (t.onSelect(t.widgetId), t.onCommitFront(t.widgetId), z(e.target) === "widget_shell" && _?.focus({
24
+ widgetRoot: u ?? null,
25
+ interactiveSelector: _t,
26
+ panSurfaceSelector: ft
27
+ }), V = (e) => {
28
+ e.button === 0 && (t.onSelect(t.widgetId), t.onCommitFront(t.widgetId), E(e.target) === "widget_shell" && u?.focus({
22
29
  preventScroll: !0
23
30
  }));
24
- }, I = m(() => {
25
- const e = v();
31
+ }, m = _(() => {
32
+ const e = f();
26
33
  return e ? {
27
34
  x: e.worldX,
28
35
  y: e.worldY
@@ -30,8 +37,8 @@ function kt(t) {
30
37
  x: t.x,
31
38
  y: t.y
32
39
  };
33
- }), k = m(() => {
34
- const e = $();
40
+ }), v = _(() => {
41
+ const e = b();
35
42
  return e ? {
36
43
  width: e.width,
37
44
  height: e.height
@@ -39,34 +46,34 @@ function kt(t) {
39
46
  width: t.width,
40
47
  height: t.height
41
48
  };
42
- }), p = m(() => {
49
+ }), R = _(() => {
43
50
  if (!(t.layoutMode !== "projected_surface" || !t.projectedViewport))
44
- return ct({
51
+ return st({
45
52
  widgetId: t.widgetId,
46
- worldX: I().x,
47
- worldY: I().y,
48
- worldWidth: k().width,
49
- worldHeight: k().height,
53
+ worldX: m().x,
54
+ worldY: m().y,
55
+ worldWidth: v().width,
56
+ worldHeight: v().height,
50
57
  viewport: t.projectedViewport,
51
58
  ready: t.surfaceReady ?? !0
52
59
  });
53
- }), q = m(() => {
60
+ }), G = _(() => {
54
61
  const e = t.itemSnapshot().z_index, i = Number.isFinite(e) ? Math.max(1, Math.min(99, Math.round(e))) : 1;
55
62
  return String(i).padStart(2, "0");
56
- }), D = (e) => {
63
+ }), z = (e) => {
57
64
  e.preventDefault(), e.stopPropagation(), t.onRequestOverview(t.itemSnapshot());
58
65
  }, T = (e) => {
59
66
  e.preventDefault(), e.stopPropagation(), t.onRequestFit(t.itemSnapshot());
60
- }, X = (e) => {
67
+ }, D = (e) => {
61
68
  e.preventDefault(), e.stopPropagation(), t.onRequestDelete(t.widgetId);
62
- }, K = m(() => {
69
+ }, Z = _(() => {
63
70
  const e = {
64
- width: `${k().width}px`,
65
- height: `${k().height}px`,
66
- "z-index": E() || R() || t.optimisticFront ? `${t.topRenderLayer + 1}` : `${t.renderLayer}`
71
+ width: `${v().width}px`,
72
+ height: `${v().height}px`,
73
+ "z-index": C() || W() || t.optimisticFront ? `${t.topRenderLayer + 1}` : `${t.renderLayer}`
67
74
  };
68
75
  if (t.layoutMode === "projected_surface") {
69
- const i = p()?.rect;
76
+ const i = R()?.rect;
70
77
  return {
71
78
  ...e,
72
79
  left: `${i?.screenX ?? 0}px`,
@@ -76,10 +83,10 @@ function kt(t) {
76
83
  }
77
84
  return {
78
85
  ...e,
79
- transform: `translate(${I().x}px, ${I().y}px)`
86
+ transform: `translate(${m().x}px, ${m().y}px)`
80
87
  };
81
- }), L = (e) => {
82
- const i = M(v);
88
+ }), q = (e) => {
89
+ const i = S(f);
83
90
  if (!i) return;
84
91
  const d = {
85
92
  x: i.worldX,
@@ -87,18 +94,21 @@ function kt(t) {
87
94
  }, r = {
88
95
  x: i.startWorldX,
89
96
  y: i.startWorldY
90
- }, s = e && (Math.abs(d.x - r.x) > 1 || Math.abs(d.y - r.y) > 1);
91
- t.onCommitFront(t.widgetId), s && t.onCommitMove(t.widgetId, d), i.stopInteraction(), y(null), u?.abort(), u = void 0;
92
- }, Y = (e) => {
97
+ }, a = e && (Math.abs(d.x - r.x) > 1 || Math.abs(d.y - r.y) > 1);
98
+ t.onCommitFront(t.widgetId), a && t.onCommitMove(t.widgetId, d), i.stopInteraction(), I(null), g = void 0;
99
+ }, X = (e) => {
93
100
  if (e.button !== 0 || t.locked) return;
94
- e.preventDefault(), e.stopPropagation(), u?.abort(), t.onSelect(t.widgetId), _?.focus({
101
+ e.preventDefault(), e.stopPropagation(), g?.stop({
102
+ reason: "manual_stop",
103
+ commit: !1
104
+ }), t.onSelect(t.widgetId), u?.focus({
95
105
  preventScroll: !0
96
106
  }), t.onStartOptimisticFront(t.widgetId);
97
- const i = N({
107
+ const i = O({
98
108
  kind: "drag",
99
109
  cursor: "grabbing"
100
110
  }), d = Math.max(t.viewportScale, 1e-3);
101
- y({
111
+ I({
102
112
  pointerId: e.pointerId,
103
113
  startClientX: e.clientX,
104
114
  startClientY: e.clientY,
@@ -111,46 +121,44 @@ function kt(t) {
111
121
  stopInteraction: i
112
122
  });
113
123
  const r = (a) => {
114
- y((n) => {
124
+ I((n) => {
115
125
  if (!n || n.pointerId !== a.pointerId) return n;
116
- const f = n.startWorldX + (a.clientX - n.startClientX) / n.scale, h = n.startWorldY + (a.clientY - n.startClientY) / n.scale;
126
+ const w = n.startWorldX + (a.clientX - n.startClientX) / n.scale, s = n.startWorldY + (a.clientY - n.startClientY) / n.scale;
117
127
  return {
118
128
  ...n,
119
- worldX: f,
120
- worldY: h,
121
- moved: n.moved || Math.abs(f - n.startWorldX) > 2 || Math.abs(h - n.startWorldY) > 2
129
+ worldX: w,
130
+ worldY: s,
131
+ moved: n.moved || Math.abs(w - n.startWorldX) > 2 || Math.abs(s - n.startWorldY) > 2
122
132
  };
123
133
  });
124
- }, s = (a) => {
125
- a.pointerId === e.pointerId && L(!0);
126
- }, g = (a) => {
127
- a.pointerId === e.pointerId && L(!1);
128
- }, l = new AbortController();
129
- u = l, window.addEventListener("pointermove", r, {
130
- signal: l.signal
131
- }), window.addEventListener("pointerup", s, {
132
- once: !0,
133
- signal: l.signal
134
- }), window.addEventListener("pointercancel", g, {
135
- once: !0,
136
- signal: l.signal
134
+ };
135
+ g = j({
136
+ pointerEvent: e,
137
+ captureEl: e.currentTarget,
138
+ onMove: r,
139
+ onEnd: ({
140
+ commit: a
141
+ }) => q(a)
137
142
  });
138
- }, P = (e) => {
139
- const i = M($);
143
+ }, K = (e) => {
144
+ const i = S(b);
140
145
  if (!i) return;
141
146
  const d = {
142
147
  width: i.width,
143
148
  height: i.height
144
149
  }, r = Math.abs(i.width - i.startWidth) > 1 || Math.abs(i.height - i.startHeight) > 1;
145
- e && r && t.onCommitResize(t.widgetId, d), i.stopInteraction(), C(null), b?.abort(), b = void 0;
150
+ e && r && t.onCommitResize(t.widgetId, d), i.stopInteraction(), x(null), h = void 0;
146
151
  }, U = (e) => {
147
152
  if (e.button !== 0 || t.locked) return;
148
- e.preventDefault(), e.stopPropagation(), b?.abort(), t.onStartOptimisticFront(t.widgetId);
149
- const i = N({
153
+ e.preventDefault(), e.stopPropagation(), h?.stop({
154
+ reason: "manual_stop",
155
+ commit: !1
156
+ }), t.onStartOptimisticFront(t.widgetId);
157
+ const i = O({
150
158
  kind: "drag",
151
159
  cursor: "nwse-resize"
152
160
  }), d = Math.max(t.viewportScale, 1e-3);
153
- C({
161
+ x({
154
162
  pointerId: e.pointerId,
155
163
  startClientX: e.clientX,
156
164
  startClientY: e.clientY,
@@ -162,38 +170,33 @@ function kt(t) {
162
170
  stopInteraction: i
163
171
  });
164
172
  const r = (a) => {
165
- C((n) => {
173
+ x((n) => {
166
174
  if (!n || n.pointerId !== a.pointerId) return n;
167
- const f = Math.max(gt, n.startWidth + (a.clientX - n.startClientX) / n.scale), h = Math.max(ht, n.startHeight + (a.clientY - n.startClientY) / n.scale);
175
+ const w = Math.max(ht, n.startWidth + (a.clientX - n.startClientX) / n.scale), s = Math.max(ut, n.startHeight + (a.clientY - n.startClientY) / n.scale);
168
176
  return {
169
177
  ...n,
170
- width: f,
171
- height: h
178
+ width: w,
179
+ height: s
172
180
  };
173
181
  });
174
- }, s = (a) => {
175
- a.pointerId === e.pointerId && P(!0);
176
- }, g = (a) => {
177
- a.pointerId === e.pointerId && P(!1);
178
- }, l = new AbortController();
179
- b = l, window.addEventListener("pointermove", r, {
180
- signal: l.signal
181
- }), window.addEventListener("pointerup", s, {
182
- once: !0,
183
- signal: l.signal
184
- }), window.addEventListener("pointercancel", g, {
185
- once: !0,
186
- signal: l.signal
182
+ };
183
+ h = j({
184
+ pointerEvent: e,
185
+ captureEl: e.currentTarget,
186
+ onMove: r,
187
+ onEnd: ({
188
+ commit: a
189
+ }) => K(a)
187
190
  });
188
191
  };
189
192
  return (() => {
190
- var e = st(), i = e.firstChild, d = i.firstChild, r = d.firstChild, s = r.nextSibling, g = s.nextSibling, l = d.nextSibling, a = l.nextSibling, n = a.nextSibling, f = n.firstChild, h = f.nextSibling, J = n.nextSibling, S = J.firstChild, x = S.nextSibling, W = x.nextSibling, Q = i.nextSibling, H = _;
191
- return typeof H == "function" ? it(H, e) : _ = e, O(e, tt({
193
+ var e = wt(), i = e.firstChild, d = i.firstChild, r = d.firstChild, a = r.nextSibling, n = a.nextSibling, w = d.nextSibling, s = w.nextSibling, M = s.nextSibling, J = M.firstChild, p = J.nextSibling, Q = M.nextSibling, $ = Q.firstChild, k = $.nextSibling, y = k.nextSibling, tt = i.nextSibling, P = u;
194
+ return typeof P == "function" ? nt(P, e) : u = e, H(e, et({
192
195
  get classList() {
193
196
  return {
194
197
  "is-selected": t.selected,
195
- "is-dragging": E(),
196
- "is-resizing": R(),
198
+ "is-dragging": C(),
199
+ "is-resizing": W(),
197
200
  "is-filtered-out": t.filtered,
198
201
  "is-projected-surface": t.layoutMode === "projected_surface",
199
202
  "is-locked": t.locked
@@ -209,49 +212,49 @@ function kt(t) {
209
212
  return t.layoutMode ?? "canvas_scaled";
210
213
  }
211
214
  }, () => ({
212
- [rt]: t.selected ? "true" : void 0
215
+ [dt]: t.selected ? "true" : void 0
213
216
  }), {
214
217
  tabIndex: 0,
215
- onPointerDown: Z,
218
+ onPointerDown: V,
216
219
  onFocus: () => {
217
220
  t.onSelect(t.widgetId);
218
221
  },
219
222
  onContextMenu: (o) => {
220
- z(o.target) === "widget_shell" && (o.preventDefault(), o.stopPropagation(), t.onContextMenu(o, t.itemSnapshot()));
223
+ E(o.target) === "widget_shell" && (o.preventDefault(), o.stopPropagation(), t.onContextMenu(o, t.itemSnapshot()));
221
224
  },
222
225
  get style() {
223
- return K();
226
+ return Z();
224
227
  }
225
- }), !1, !0), i.$$pointerdown = Y, O(i, {
226
- [dt]: "true"
227
- }, !1, !0), r.$$click = X, r.$$pointerdown = (o) => o.stopPropagation(), c(r, w(j, {
228
+ }), !1, !0), i.$$pointerdown = X, H(i, {
229
+ [lt]: "true"
230
+ }, !1, !0), r.$$click = D, r.$$pointerdown = (o) => o.stopPropagation(), l(r, c(F, {
228
231
  class: "workbench-widget__traffic-icon",
229
232
  "aria-hidden": "true"
230
- })), s.$$click = D, s.$$pointerdown = (o) => o.stopPropagation(), c(s, w(B, {
233
+ })), a.$$click = z, a.$$pointerdown = (o) => o.stopPropagation(), l(a, c(N, {
231
234
  class: "workbench-widget__traffic-icon",
232
235
  "aria-hidden": "true"
233
- })), g.$$click = T, g.$$pointerdown = (o) => o.stopPropagation(), c(g, w(V, {
236
+ })), n.$$click = T, n.$$pointerdown = (o) => o.stopPropagation(), l(n, c(A, {
234
237
  class: "workbench-widget__traffic-icon",
235
238
  "aria-hidden": "true"
236
- })), c(l, q), a.$$pointerdown = Y, c(a, w(at, {
239
+ })), l(w, G), s.$$pointerdown = X, l(s, c(rt, {
237
240
  class: "w-3.5 h-3.5"
238
- })), c(n, () => {
241
+ })), l(M, () => {
239
242
  const o = t.definition.icon;
240
- return w(o, {
243
+ return c(o, {
241
244
  class: "w-3.5 h-3.5"
242
245
  });
243
- }, h), c(h, () => t.widgetTitle), S.$$click = D, S.$$pointerdown = (o) => o.stopPropagation(), c(S, w(B, {
246
+ }, p), l(p, () => t.widgetTitle), $.$$click = z, $.$$pointerdown = (o) => o.stopPropagation(), l($, c(N, {
244
247
  class: "workbench-widget__window-control-icon",
245
248
  "aria-hidden": "true"
246
- })), x.$$click = T, x.$$pointerdown = (o) => o.stopPropagation(), c(x, w(V, {
249
+ })), k.$$click = T, k.$$pointerdown = (o) => o.stopPropagation(), l(k, c(A, {
247
250
  class: "workbench-widget__window-control-icon",
248
251
  "aria-hidden": "true"
249
- })), W.$$click = X, W.$$pointerdown = (o) => o.stopPropagation(), c(W, w(j, {
252
+ })), y.$$click = D, y.$$pointerdown = (o) => o.stopPropagation(), l(y, c(F, {
250
253
  class: "workbench-widget__window-control-icon",
251
254
  "aria-hidden": "true"
252
- })), c(Q, () => {
255
+ })), l(tt, () => {
253
256
  const o = t.definition.body;
254
- return w(o, {
257
+ return c(o, {
255
258
  get widgetId() {
256
259
  return t.widgetId;
257
260
  },
@@ -262,19 +265,19 @@ function kt(t) {
262
265
  return t.widgetType;
263
266
  },
264
267
  get surfaceMetrics() {
265
- return p();
268
+ return R();
266
269
  }
267
270
  });
268
- }), c(e, (() => {
269
- var o = et(() => !!t.locked);
271
+ }), l(e, (() => {
272
+ var o = it(() => !!t.locked);
270
273
  return () => o() ? null : (() => {
271
- var A = wt();
272
- return A.$$pointerdown = U, A;
274
+ var Y = gt();
275
+ return Y.$$pointerdown = U, Y;
273
276
  })();
274
277
  })(), null), e;
275
278
  })();
276
279
  }
277
- nt(["pointerdown", "click"]);
280
+ ot(["pointerdown", "click"]);
278
281
  export {
279
- kt as WorkbenchWidget
282
+ xt as WorkbenchWidget
280
283
  };