@floegence/floe-webapp-core 0.36.12 → 0.36.15

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,24 +1,25 @@
1
- import { createComponent as a, Portal as Ee, spread as ae, mergeProps as se, memo as de, insert as g, effect as u, setAttribute as Ae, addEventListener as m, className as c, template as s, use as Me, delegateEvents as Fe } from "solid-js/web";
2
- import { createUniqueId as Le, createSignal as v, onMount as De, onCleanup as T, createEffect as S, Show as y, batch as ke } from "solid-js";
3
- import { cn as _ } from "../../utils/cn.js";
4
- import { useLayout as We } from "../../context/LayoutContext.js";
1
+ import { createComponent as a, Portal as Ee, spread as ae, mergeProps as se, memo as de, insert as g, effect as u, setAttribute as Ae, addEventListener as m, className as c, template as s, use as Le, delegateEvents as Fe } from "solid-js/web";
2
+ import { createUniqueId as Me, createSignal as v, onMount as De, onCleanup as O, createEffect as S, Show as y, batch as Te } from "solid-js";
3
+ import { cn as R } from "../../utils/cn.js";
4
+ import { useLayout as ke } from "../../context/LayoutContext.js";
5
5
  import { Button as ue } from "./Button.js";
6
- import { Restore as Oe, Maximize as Te, X as He } from "../icons/index.js";
7
- import { startHotInteraction as Xe } from "../../utils/hotInteraction.js";
8
- import { normalizeFloatingWindowRect as ce, resolveFloatingWindowRect as Ue } from "./floatingWindowGeometry.js";
6
+ import { Restore as We, Maximize as Oe, X as He } from "../icons/index.js";
7
+ import { startHotInteraction as Ue } from "../../utils/hotInteraction.js";
8
+ import { normalizeFloatingWindowRect as ce, resolveFloatingWindowRect as Xe } from "./floatingWindowGeometry.js";
9
9
  import { LOCAL_INTERACTION_SURFACE_ATTR as fe } from "./localInteractionSurface.js";
10
- var Ye = /* @__PURE__ */ s('<h2 class="text-sm font-medium truncate select-none">'), qe = /* @__PURE__ */ s('<div class="flex items-center justify-end gap-2 p-3 border-t border-border">'), Ne = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=n style=touch-action:none>"), Be = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=s style=touch-action:none>"), je = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=e style=touch-action:none>"), Ge = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=w style=touch-action:none>"), Ve = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=ne style=touch-action:none>"), Ze = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=nw style=touch-action:none>"), Je = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=se style=touch-action:none>"), Ke = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=sw style=touch-action:none>"), Qe = /* @__PURE__ */ s('<div data-floe-geometry-surface=floating-window><div data-floe-dialog-surface-host=true data-floe-floating-window-surface=true><div data-floe-floating-window-titlebar=true style=touch-action:none><div class="flex-1 min-w-0"></div><div class="flex items-center gap-0.5 -mr-1"></div></div><div class="flex-1 overflow-auto p-3">');
11
- function dt(i) {
12
- const H = () => i.resizable ?? !0, X = () => i.draggable ?? !0, R = () => i.minSize ?? {
10
+ import { SURFACE_PORTAL_LAYER_ATTR as Ye } from "./dialogSurfaceScope.js";
11
+ var qe = /* @__PURE__ */ s('<h2 class="text-sm font-medium truncate select-none">'), Ne = /* @__PURE__ */ s('<div class="flex items-center justify-end gap-2 p-3 border-t border-border">'), Be = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=n style=touch-action:none>"), je = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=s style=touch-action:none>"), Ge = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=e style=touch-action:none>"), Ve = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=w style=touch-action:none>"), Ze = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=ne style=touch-action:none>"), Je = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=nw style=touch-action:none>"), Ke = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=se style=touch-action:none>"), Qe = /* @__PURE__ */ s("<div data-floe-floating-window-resize-handle=sw style=touch-action:none>"), et = /* @__PURE__ */ s('<div data-floe-geometry-surface=floating-window><div data-floe-dialog-surface-host=true><div data-floe-floating-window-titlebar=true style=touch-action:none><div class="flex-1 min-w-0"></div><div class="flex items-center gap-0.5 -mr-1"></div></div><div class="flex-1 overflow-auto p-3">');
12
+ function ct(i) {
13
+ const H = () => i.resizable ?? !0, U = () => i.draggable ?? !0, I = () => i.minSize ?? {
13
14
  width: 200,
14
15
  height: 150
15
16
  }, C = () => i.maxSize ?? {
16
17
  width: 1 / 0,
17
18
  height: 1 / 0
18
- }, he = () => i.zIndex ?? 100, we = Le(), ge = We(), b = () => ge.isMobile(), E = 16, U = () => `floating-window-${we}-title`, [A, me] = v(i.defaultPosition ?? {
19
+ }, he = () => i.zIndex ?? 100, we = Me(), ge = ke(), b = () => ge.isMobile(), E = 16, X = () => `floating-window-${we}-title`, [A, me] = v(i.defaultPosition ?? {
19
20
  x: 0,
20
21
  y: 0
21
- }), [M, pe] = v(i.defaultSize ?? {
22
+ }), [L, pe] = v(i.defaultSize ?? {
22
23
  width: 400,
23
24
  height: 300
24
25
  }), [d, Y] = v(!1), [q, N] = v(!1), [B, j] = v(!1), [ve, F] = v(!1), [xe, ze] = v(null);
@@ -41,7 +42,7 @@ function dt(i) {
41
42
  }, K = "se", r, l = null, p = null, P = {
42
43
  x: 0,
43
44
  y: 0
44
- }, x = null, I = null, Q = !1, z = {
45
+ }, x = null, _ = null, Q = !1, z = {
45
46
  x: i.defaultPosition?.x ?? 0,
46
47
  y: i.defaultPosition?.y ?? 0,
47
48
  width: i.defaultSize?.width ?? 400,
@@ -56,12 +57,12 @@ function dt(i) {
56
57
  nw: "nwse-resize",
57
58
  se: "nwse-resize",
58
59
  sw: "nesw-resize"
59
- }, L = (e, t) => {
60
+ }, M = (e, t) => {
60
61
  if (!e) {
61
- I?.(), I = null;
62
+ _?.(), _ = null;
62
63
  return;
63
64
  }
64
- I?.(), I = Xe({
65
+ _?.(), _ = Ue({
65
66
  kind: p === "resize" ? "resize" : "drag",
66
67
  cursor: t,
67
68
  lockUserSelect: !0
@@ -69,7 +70,7 @@ function dt(i) {
69
70
  }, ee = (e) => {
70
71
  z = e, r && (r.style.transform = `translate3d(${e.x}px, ${e.y}px, 0)`, r.style.width = `${e.width}px`, r.style.height = `${e.height}px`);
71
72
  }, D = () => {
72
- const e = A(), t = M();
73
+ const e = A(), t = L();
73
74
  return {
74
75
  x: e.x,
75
76
  y: e.y,
@@ -94,7 +95,7 @@ function dt(i) {
94
95
  }, Pe = (e) => {
95
96
  const t = e instanceof Element ? e : null;
96
97
  return t ? t.closest('button, input, select, textarea, a, [role="button"], [tabindex]:not([tabindex="-1"])') === null : !0;
97
- }, k = (e) => !!r && e instanceof Node && r.contains(e), $e = () => {
98
+ }, T = (e) => !!r && e instanceof Node && r.contains(e), $e = () => {
98
99
  if (!r) return null;
99
100
  const e = r.getBoundingClientRect();
100
101
  return {
@@ -104,7 +105,7 @@ function dt(i) {
104
105
  height: e.height
105
106
  };
106
107
  }, te = () => {
107
- i.open && (l === null || p === null || typeof window > "u" || ee(Ue({
108
+ i.open && (l === null || p === null || typeof window > "u" || ee(Xe({
108
109
  mode: p,
109
110
  pointer: P,
110
111
  dragStartPos: G,
@@ -112,7 +113,7 @@ function dt(i) {
112
113
  resizeStartPos: Z,
113
114
  resizeStartRect: J,
114
115
  resizeHandle: K,
115
- minSize: R(),
116
+ minSize: I(),
116
117
  maxSize: C(),
117
118
  viewport: {
118
119
  width: window.innerWidth,
@@ -121,7 +122,7 @@ function dt(i) {
121
122
  mobile: b(),
122
123
  mobilePadding: E
123
124
  })));
124
- }, W = (e) => {
125
+ }, k = (e) => {
125
126
  if (typeof window > "u") return;
126
127
  const t = {
127
128
  width: window.innerWidth,
@@ -138,14 +139,14 @@ function dt(i) {
138
139
  }
139
140
  $(ce({
140
141
  rect: D(),
141
- minSize: R(),
142
+ minSize: I(),
142
143
  maxSize: C(),
143
144
  viewport: t,
144
145
  mobile: b(),
145
146
  mobilePadding: E,
146
147
  center: e?.center ?? !1
147
148
  }));
148
- }, O = (e, t = !0) => {
149
+ }, W = (e, t = !0) => {
149
150
  x !== null && typeof cancelAnimationFrame < "u" && (cancelAnimationFrame(x), x = null), t && te();
150
151
  const o = t ? $e() ?? z : null;
151
152
  if (e !== void 0)
@@ -153,25 +154,25 @@ function dt(i) {
153
154
  typeof r?.releasePointerCapture == "function" && r.releasePointerCapture(e);
154
155
  } catch {
155
156
  }
156
- ke(() => {
157
+ Te(() => {
157
158
  o && $(o), l = null, p = null, N(!1), j(!1);
158
- }), L(!1, "");
159
+ }), M(!1, "");
159
160
  };
160
161
  De(() => {
161
- i.open || W({
162
+ i.open || k({
162
163
  center: !i.defaultPosition
163
164
  });
164
165
  const e = () => {
165
- l === null && W({
166
+ l === null && k({
166
167
  center: !1
167
168
  });
168
169
  };
169
- window.addEventListener("resize", e), T(() => window.removeEventListener("resize", e));
170
+ window.addEventListener("resize", e), O(() => window.removeEventListener("resize", e));
170
171
  }), S(() => {
171
172
  if (!i.open) return;
172
173
  b();
173
174
  const e = !Q && !i.defaultPosition, t = () => {
174
- W({
175
+ k({
175
176
  center: e
176
177
  }), Q = !0;
177
178
  };
@@ -185,25 +186,25 @@ function dt(i) {
185
186
  const e = (t) => {
186
187
  if (t.key !== "Escape") return;
187
188
  const o = typeof document < "u" ? document.activeElement : null;
188
- !k(t.target) && !k(o) || (t.preventDefault(), typeof t.stopImmediatePropagation == "function" ? t.stopImmediatePropagation() : t.stopPropagation(), i.onOpenChange(!1));
189
+ !T(t.target) && !T(o) || (t.preventDefault(), typeof t.stopImmediatePropagation == "function" ? t.stopImmediatePropagation() : t.stopPropagation(), i.onOpenChange(!1));
189
190
  };
190
- document.addEventListener("keydown", e, !0), T(() => document.removeEventListener("keydown", e, !0));
191
+ document.addEventListener("keydown", e, !0), O(() => document.removeEventListener("keydown", e, !0));
191
192
  }), S(() => {
192
193
  if (!i.open) {
193
- F(!1), O(l ?? void 0, !1);
194
+ F(!1), W(l ?? void 0, !1);
194
195
  return;
195
196
  }
196
197
  F(!0);
197
198
  }), S(() => {
198
199
  if (!i.open) return;
199
200
  const e = (w) => {
200
- F(k(w));
201
+ F(T(w));
201
202
  }, t = (w) => {
202
203
  e(w.target);
203
204
  }, o = (w) => {
204
205
  e(w.target);
205
206
  };
206
- document.addEventListener("pointerdown", t), document.addEventListener("focusin", o), T(() => {
207
+ document.addEventListener("pointerdown", t), document.addEventListener("focusin", o), O(() => {
207
208
  document.removeEventListener("pointerdown", t), document.removeEventListener("focusin", o);
208
209
  });
209
210
  }), S(() => {
@@ -212,7 +213,7 @@ function dt(i) {
212
213
  l === null ? ee(e) : z = e;
213
214
  });
214
215
  const Se = (e) => {
215
- !X() || d() || e.pointerType === "mouse" && e.button !== 0 || e.target?.closest('button, input, select, textarea, a, [role="button"]') || (e.preventDefault(), l = e.pointerId, p = "drag", N(!0), G = {
216
+ !U() || d() || e.pointerType === "mouse" && e.button !== 0 || e.target?.closest('button, input, select, textarea, a, [role="button"]') || (e.preventDefault(), l = e.pointerId, p = "drag", N(!0), G = {
216
217
  x: e.clientX,
217
218
  y: e.clientY
218
219
  }, V = {
@@ -220,7 +221,7 @@ function dt(i) {
220
221
  }, P = {
221
222
  x: e.clientX,
222
223
  y: e.clientY
223
- }, L(!0, "grabbing"), typeof r?.setPointerCapture == "function" && r.setPointerCapture(e.pointerId));
224
+ }, M(!0, "grabbing"), typeof r?.setPointerCapture == "function" && r.setPointerCapture(e.pointerId));
224
225
  }, f = (e) => (t) => {
225
226
  !H() || d() || t.pointerType === "mouse" && t.button !== 0 || (t.preventDefault(), t.stopPropagation(), l = t.pointerId, p = "resize", j(!0), K = e, Z = {
226
227
  x: t.clientX,
@@ -230,10 +231,10 @@ function dt(i) {
230
231
  }, P = {
231
232
  x: t.clientX,
232
233
  y: t.clientY
233
- }, L(!0, ye[e]), typeof r?.setPointerCapture == "function" && r.setPointerCapture(t.pointerId));
234
+ }, M(!0, ye[e]), typeof r?.setPointerCapture == "function" && r.setPointerCapture(t.pointerId));
234
235
  }, ne = () => {
235
236
  x = null, te();
236
- }, Ie = (e) => {
237
+ }, _e = (e) => {
237
238
  if (!(l === null || e.pointerId !== l) && p !== null && (P = {
238
239
  x: e.clientX,
239
240
  y: e.clientY
@@ -248,9 +249,9 @@ function dt(i) {
248
249
  l === null || e.pointerId !== l || (P = {
249
250
  x: e.clientX,
250
251
  y: e.clientY
251
- }, O(e.pointerId));
252
+ }, W(e.pointerId));
252
253
  }, re = () => {
253
- if (l !== null && O(l, !0), d()) {
254
+ if (l !== null && W(l, !0), d()) {
254
255
  const t = xe();
255
256
  t && $(ce({
256
257
  rect: {
@@ -259,7 +260,7 @@ function dt(i) {
259
260
  width: t.size.width,
260
261
  height: t.size.height
261
262
  },
262
- minSize: R(),
263
+ minSize: I(),
263
264
  maxSize: C(),
264
265
  viewport: {
265
266
  width: window.innerWidth,
@@ -287,11 +288,11 @@ function dt(i) {
287
288
  width: window.innerWidth,
288
289
  height: window.innerHeight
289
290
  }), Y(!0);
290
- }, _e = () => {
291
+ }, Re = () => {
291
292
  re();
292
- }, Re = (e) => {
293
+ }, Ie = (e) => {
293
294
  Pe(e.target) && be();
294
- }, h = (e) => _("absolute z-10", {
295
+ }, h = (e) => R("absolute z-10", {
295
296
  n: "cursor-ns-resize top-0 left-2 right-2 h-1",
296
297
  s: "cursor-ns-resize bottom-0 left-2 right-2 h-1",
297
298
  e: "cursor-ew-resize right-0 top-2 bottom-2 w-1",
@@ -308,32 +309,35 @@ function dt(i) {
308
309
  get children() {
309
310
  return a(Ee, {
310
311
  get children() {
311
- var e = Qe(), t = e.firstChild, o = t.firstChild, w = o.firstChild, oe = w.nextSibling, Ce = o.nextSibling, le = r;
312
- return typeof le == "function" ? Me(le, e) : r = e, ae(e, se({
312
+ var e = et(), t = e.firstChild, o = t.firstChild, w = o.firstChild, oe = w.nextSibling, Ce = o.nextSibling, le = r;
313
+ return typeof le == "function" ? Le(le, e) : r = e, ae(e, se({
313
314
  [fe]: "true"
314
315
  }, {
315
316
  get class() {
316
- return _("fixed left-0 top-0 z-[100] flex flex-col", (q() || B()) && "select-none");
317
+ return R("fixed left-0 top-0 z-[100] flex flex-col", (q() || B()) && "select-none");
317
318
  },
318
319
  get style() {
319
320
  return {
320
- width: `${M().width}px`,
321
- height: `${M().height}px`,
321
+ width: `${L().width}px`,
322
+ height: `${L().height}px`,
322
323
  transform: `translate3d(${A().x}px, ${A().y}px, 0)`,
323
324
  "z-index": he(),
324
325
  "will-change": q() ? "transform" : B() ? "transform, width, height" : void 0
325
326
  };
326
327
  },
327
- onPointerMove: Ie,
328
+ onPointerMove: _e,
328
329
  onPointerUp: ie,
329
330
  onPointerCancel: ie,
330
331
  role: "dialog",
331
332
  get "aria-labelledby"() {
332
- return de(() => !!i.title)() ? U() : void 0;
333
+ return de(() => !!i.title)() ? X() : void 0;
333
334
  },
334
335
  tabIndex: -1,
335
- onPointerDown: Re
336
+ onPointerDown: Ie
336
337
  }), !1, !0), ae(t, se({
338
+ [Ye]: "true"
339
+ }, {
340
+ "data-floe-floating-window-surface": "true",
337
341
  get "data-floe-floating-window-state"() {
338
342
  return ve() ? "active" : "inactive";
339
343
  }
@@ -341,15 +345,15 @@ function dt(i) {
341
345
  [fe]: "true"
342
346
  }, {
343
347
  get class() {
344
- return _("relative flex h-full w-full flex-col overflow-hidden", "text-card-foreground rounded-md", "border", "animate-in fade-in duration-150", d() && "rounded-none", i.class);
348
+ return R("relative flex h-full w-full flex-col overflow-hidden", "text-card-foreground rounded-md", "border", "animate-in fade-in duration-150", d() && "rounded-none", i.class);
345
349
  }
346
- }), !1, !0), o.$$dblclick = _e, o.$$pointerdown = Se, g(w, a(y, {
350
+ }), !1, !0), o.$$dblclick = Re, o.$$pointerdown = Se, g(w, a(y, {
347
351
  get when() {
348
352
  return i.title;
349
353
  },
350
354
  get children() {
351
- var n = Ye();
352
- return g(n, () => i.title), u(() => Ae(n, "id", U())), n;
355
+ var n = qe();
356
+ return g(n, () => i.title), u(() => Ae(n, "id", X())), n;
353
357
  }
354
358
  })), g(oe, a(ue, {
355
359
  variant: "ghost",
@@ -367,12 +371,12 @@ function dt(i) {
367
371
  return d();
368
372
  },
369
373
  get fallback() {
370
- return a(Te, {
374
+ return a(Oe, {
371
375
  class: "w-3 h-3"
372
376
  });
373
377
  },
374
378
  get children() {
375
- return a(Oe, {
379
+ return a(We, {
376
380
  class: "w-3 h-3"
377
381
  });
378
382
  }
@@ -396,7 +400,7 @@ function dt(i) {
396
400
  return i.footer;
397
401
  },
398
402
  get children() {
399
- var n = qe();
403
+ var n = Ne();
400
404
  return g(n, () => i.footer), n;
401
405
  }
402
406
  }), null), g(t, a(y, {
@@ -405,10 +409,10 @@ function dt(i) {
405
409
  },
406
410
  get children() {
407
411
  return [(() => {
408
- var n = Ne();
412
+ var n = Be();
409
413
  return m(n, "pointerdown", f("n"), !0), u(() => c(n, h("n"))), n;
410
414
  })(), (() => {
411
- var n = Be();
415
+ var n = je();
412
416
  return m(n, "pointerdown", f("s"), !0), u(() => c(n, h("s"))), n;
413
417
  })(), a(y, {
414
418
  get when() {
@@ -416,28 +420,28 @@ function dt(i) {
416
420
  },
417
421
  get children() {
418
422
  return [(() => {
419
- var n = je();
423
+ var n = Ge();
420
424
  return m(n, "pointerdown", f("e"), !0), u(() => c(n, h("e"))), n;
421
425
  })(), (() => {
422
- var n = Ge();
426
+ var n = Ve();
423
427
  return m(n, "pointerdown", f("w"), !0), u(() => c(n, h("w"))), n;
424
428
  })(), (() => {
425
- var n = Ve();
429
+ var n = Ze();
426
430
  return m(n, "pointerdown", f("ne"), !0), u(() => c(n, h("ne"))), n;
427
431
  })(), (() => {
428
- var n = Ze();
432
+ var n = Je();
429
433
  return m(n, "pointerdown", f("nw"), !0), u(() => c(n, h("nw"))), n;
430
434
  })(), (() => {
431
- var n = Je();
435
+ var n = Ke();
432
436
  return m(n, "pointerdown", f("se"), !0), u(() => c(n, h("se"))), n;
433
437
  })(), (() => {
434
- var n = Ke();
438
+ var n = Qe();
435
439
  return m(n, "pointerdown", f("sw"), !0), u(() => c(n, h("sw"))), n;
436
440
  })()];
437
441
  }
438
442
  })];
439
443
  }
440
- }), null), u(() => c(o, _("flex items-center justify-between h-9 px-3", "border-b", d() ? "rounded-none" : "rounded-t-md", X() && !d() && "cursor-move"))), e;
444
+ }), null), u(() => c(o, R("flex items-center justify-between h-9 px-3", "border-b", d() ? "rounded-none" : "rounded-t-md", U() && !d() && "cursor-move"))), e;
441
445
  }
442
446
  });
443
447
  }
@@ -445,5 +449,5 @@ function dt(i) {
445
449
  }
446
450
  Fe(["pointerdown", "dblclick"]);
447
451
  export {
448
- dt as FloatingWindow
452
+ ct as FloatingWindow
449
453
  };
@@ -17,6 +17,7 @@ export interface InfiniteCanvasProps {
17
17
  overlay?: (viewport: InfiniteCanvasPoint) => JSX.Element;
18
18
  viewport: InfiniteCanvasPoint;
19
19
  onViewportChange?: (viewport: InfiniteCanvasPoint) => void;
20
+ onViewportInteractionStart?: (kind: 'wheel' | 'pan') => void;
20
21
  onCanvasContextMenu?: (event: InfiniteCanvasContextMenuEvent) => void;
21
22
  ariaLabel?: string;
22
23
  class?: string;