@floegence/floe-webapp-core 0.101.13 → 0.101.14

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.
@@ -12,8 +12,8 @@ import { resolveFloatingWindowViewport as we, normalizeFloatingWindowRect as me,
12
12
  import { observeViewport as yt } from "../../viewport.js";
13
13
  import { createFloatingPresence as bt } from "./floatingPresence.js";
14
14
  import { LOCAL_INTERACTION_SURFACE_ATTR as Be } from "./localInteractionSurface.js";
15
- import { resolveFloatingBoundary as zt } from "./surfaceFloatingBoundary.js";
16
- import { SURFACE_PORTAL_LAYER_ATTR as pt, resolveSurfacePortalHost as _t } from "./dialogSurfaceScope.js";
15
+ import { resolveFloatingBoundary as pt } from "./surfaceFloatingBoundary.js";
16
+ import { SURFACE_PORTAL_LAYER_ATTR as zt, resolveSurfacePortalHost as _t } from "./dialogSurfaceScope.js";
17
17
  var $t = /* @__PURE__ */ a("<span hidden>"), St = /* @__PURE__ */ a("<h2 class=sr-only>"), Pt = /* @__PURE__ */ a('<div data-floe-floating-window-title-content=true class="flex h-full min-w-0 flex-1 items-center">'), It = /* @__PURE__ */ a('<div data-floe-floating-window-header-actions=true class="flex shrink-0 items-center gap-1"><span aria-hidden=true class="mx-2 h-4 w-px shrink-0 bg-border">'), Rt = /* @__PURE__ */ a('<div data-floe-floating-window-footer=true class="flex items-center justify-end gap-2 p-3 border-t border-[var(--floe-line)]">'), Ct = /* @__PURE__ */ a("<div data-floe-floating-window-resize-handle=n style=touch-action:none>"), At = /* @__PURE__ */ a("<div data-floe-floating-window-resize-handle=s style=touch-action:none>"), Et = /* @__PURE__ */ a("<div data-floe-floating-window-resize-handle=e style=touch-action:none>"), Mt = /* @__PURE__ */ a("<div data-floe-floating-window-resize-handle=w style=touch-action:none>"), Ft = /* @__PURE__ */ a("<div data-floe-floating-window-resize-handle=ne style=touch-action:none>"), kt = /* @__PURE__ */ a("<div data-floe-floating-window-resize-handle=nw style=touch-action:none>"), Ot = /* @__PURE__ */ a("<div data-floe-floating-window-resize-handle=se style=touch-action:none>"), Tt = /* @__PURE__ */ a("<div data-floe-floating-window-resize-handle=sw style=touch-action:none>"), Lt = /* @__PURE__ */ a('<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 h-full flex-1 min-w-0 items-center px-3"></div><div class="flex h-full shrink-0 items-stretch"></div></div><div data-floe-floating-window-content=true class="min-h-0 flex-1 overflow-auto overscroll-contain p-3">'), Bt = /* @__PURE__ */ a('<span data-floe-floating-window-title-icon=true aria-hidden=true class="flex size-4 shrink-0 items-center justify-center">'), Dt = /* @__PURE__ */ a('<h2 class="flex min-w-0 items-center gap-2 text-xs leading-none font-medium select-none"><span class="min-w-0 truncate">');
18
18
  function nn(i) {
19
19
  const ve = () => i.resizable ?? !0, K = () => i.maximizable ?? !0, xe = () => i.draggable ?? !0, q = () => i.minSize ?? {
@@ -31,7 +31,7 @@ function nn(i) {
31
31
  height: 0
32
32
  }, {
33
33
  equals: (e, t) => e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height
34
- }), [te, qe] = b(!0), v = () => !!(i.compactBelow && R().width < i.compactBelow), z = () => i.viewportInsets, T = () => O()?.fixedScale ?? 1, ne = (e) => ({
34
+ }), [te, qe] = b(!0), v = () => !!(i.compactBelow && R().width < i.compactBelow), p = () => i.viewportInsets, T = () => O()?.fixedScale ?? 1, ne = (e) => ({
35
35
  x: (e.x + (O()?.fixedOffset.left ?? 0)) / T(),
36
36
  y: (e.y + (O()?.fixedOffset.top ?? 0)) / T()
37
37
  }), He = () => i.zIndex ?? 100, Xe = st(), Ye = ct(), Ne = ut(), E = Ye?.isMobile ?? ft(() => Ne.config.layout.mobileQuery), X = 16, ie = () => `floating-window-${Xe}-title`, [Ve, je] = b(i.defaultPosition ?? {
@@ -44,7 +44,7 @@ function nn(i) {
44
44
  open: () => i.open,
45
45
  element: () => ae
46
46
  });
47
- let p = {
47
+ let z = {
48
48
  x: 0,
49
49
  y: 0
50
50
  }, F = {
@@ -52,30 +52,30 @@ function nn(i) {
52
52
  y: 0,
53
53
  width: 0,
54
54
  height: 0
55
- }, le = 32, ze = {
55
+ }, le = 32, pe = {
56
56
  x: 0,
57
57
  y: 0
58
- }, pe = {
58
+ }, ze = {
59
59
  x: 0,
60
60
  y: 0,
61
61
  width: 0,
62
62
  height: 0
63
- }, _e = "se", d, ae, se, h = null, N, f = null, C = {
63
+ }, _e = "se", s, ae, se, h = null, N, f = null, C = {
64
64
  x: 0,
65
65
  y: 0
66
- }, k = null, V = null, _, de = !1, s = {
66
+ }, k = null, V = null, _, de = !1, d = {
67
67
  x: i.defaultPosition?.x ?? 0,
68
68
  y: i.defaultPosition?.y ?? 0,
69
69
  width: i.defaultSize?.width ?? 400,
70
70
  height: i.defaultSize?.height ?? 300
71
71
  }, x = {
72
- ...s
72
+ ...d
73
73
  }, A;
74
74
  const $e = (e) => {
75
75
  x = {
76
76
  ...e
77
77
  };
78
- const t = we(R(), z());
78
+ const t = we(R(), p());
79
79
  A = {
80
80
  x: t.width > e.width ? (e.x - t.x) / (t.width - e.width) : A?.x ?? 0.5,
81
81
  y: t.height > e.height ? (e.y - t.y) / (t.height - e.height) : A?.y ?? 0.5
@@ -105,9 +105,9 @@ function nn(i) {
105
105
  lockDocumentStyles: f !== "drag"
106
106
  });
107
107
  }, j = (e) => {
108
- if ((e.x !== s.x || e.y !== s.y || e.width !== s.width || e.height !== s.height) && (_?.cancel(), _ = void 0), s = e, !d) return;
108
+ if ((e.x !== d.x || e.y !== d.y || e.width !== d.width || e.height !== d.height) && (_?.cancel(), _ = void 0), d = e, !s) return;
109
109
  const t = ne(e);
110
- d.style.transform = `translate3d(${t.x}px, ${t.y}px, 0)`, d.style.width = `${e.width / T()}px`, d.style.height = `${e.height / T()}px`;
110
+ s.style.transform = `translate3d(${t.x}px, ${t.y}px, 0)`, s.style.width = `${e.width / T()}px`, s.style.height = `${e.height / T()}px`;
111
111
  }, Se = () => {
112
112
  const e = Ve(), t = Ue();
113
113
  return {
@@ -117,7 +117,7 @@ function nn(i) {
117
117
  height: t.height
118
118
  };
119
119
  }, ue = (e) => {
120
- (e.x !== s.x || e.y !== s.y || e.width !== s.width || e.height !== s.height) && (_?.cancel(), _ = void 0), s = e, je((t) => t.x === e.x && t.y === e.y ? t : {
120
+ (e.x !== d.x || e.y !== d.y || e.width !== d.width || e.height !== d.height) && (_?.cancel(), _ = void 0), d = e, je((t) => t.x === e.x && t.y === e.y ? t : {
121
121
  x: e.x,
122
122
  y: e.y
123
123
  }), Ge((t) => t.width === e.width && t.height === e.height ? t : {
@@ -126,20 +126,23 @@ function nn(i) {
126
126
  });
127
127
  }, Je = () => {
128
128
  try {
129
- d?.focus({
129
+ s?.focus({
130
130
  preventScroll: !0
131
131
  });
132
132
  } catch {
133
133
  }
134
134
  }, Ke = (e) => {
135
- const t = e instanceof Element ? e : null;
136
- return t ? t.closest('button, input, select, textarea, a, [role="button"], [tabindex]:not([tabindex="-1"])') === null : !0;
137
- }, fe = (e) => !!d && e instanceof Node && d.contains(e), et = (e) => {
135
+ for (const t of e.composedPath()) {
136
+ if (t === s) break;
137
+ if (t instanceof Element && t.matches('button, input, select, textarea, a, [role="button"], [role="menu"], [role="menuitem"], [contenteditable="true"], [tabindex]:not([tabindex="-1"])')) return !1;
138
+ }
139
+ return !0;
140
+ }, fe = (e) => !!s && e instanceof Node && s.contains(e), et = (e) => {
138
141
  const o = (e instanceof Element ? e : null)?.closest('[role="menu"], [role="dialog"]')?.closest('[data-floe-surface-floating-layer="true"], [data-floe-dropdown]');
139
- return !!(o && d?.contains(o));
142
+ return !!(o && s?.contains(o));
140
143
  }, tt = () => {
141
- if (!d) return null;
142
- const e = d.getBoundingClientRect();
144
+ if (!s) return null;
145
+ const e = s.getBoundingClientRect();
143
146
  return {
144
147
  x: e.left,
145
148
  y: e.top,
@@ -149,35 +152,35 @@ function nn(i) {
149
152
  }, Pe = () => {
150
153
  if (i.open && !(h === null || f === null) && !(typeof window > "u")) {
151
154
  if (f === "drag" && u()) {
152
- if (Math.hypot(C.x - p.x, C.y - p.y) < 4) return;
155
+ if (Math.hypot(C.x - z.x, C.y - z.y) < 4) return;
153
156
  const e = me({
154
157
  rect: x,
155
158
  minSize: q(),
156
159
  maxSize: H(),
157
160
  viewport: R(),
158
- viewportInsets: z(),
161
+ viewportInsets: p(),
159
162
  mobile: i.boundary === void 0 && E(),
160
163
  mobilePadding: X
161
- }), t = Math.max(0, Math.min(1, (p.x - F.x) / Math.max(1, F.width))), r = Math.max(0, Math.min(le, p.y - F.y));
164
+ }), t = Math.max(0, Math.min(1, (z.x - F.x) / Math.max(1, F.width))), r = Math.max(0, Math.min(le, z.y - F.y));
162
165
  F = {
163
166
  ...e,
164
- x: p.x - e.width * t,
165
- y: p.y - r
167
+ x: z.x - e.width * t,
168
+ y: z.y - r
166
169
  }, oe(!1);
167
170
  }
168
171
  j(xt({
169
172
  mode: f,
170
173
  pointer: C,
171
- dragStartPos: p,
174
+ dragStartPos: z,
172
175
  dragStartRect: F,
173
176
  dragTitlebarHeight: le,
174
- resizeStartPos: ze,
175
- resizeStartRect: pe,
177
+ resizeStartPos: pe,
178
+ resizeStartRect: ze,
176
179
  resizeHandle: _e,
177
180
  minSize: q(),
178
181
  maxSize: H(),
179
182
  viewport: R(),
180
- viewportInsets: z(),
183
+ viewportInsets: p(),
181
184
  mobile: i.boundary === void 0 && E(),
182
185
  mobilePadding: X
183
186
  }));
@@ -186,7 +189,7 @@ function nn(i) {
186
189
  if (typeof window > "u") return;
187
190
  const t = R();
188
191
  if (u() || v()) {
189
- ue(we(t, z()));
192
+ ue(we(t, p()));
190
193
  return;
191
194
  }
192
195
  let r = me({
@@ -194,13 +197,13 @@ function nn(i) {
194
197
  minSize: q(),
195
198
  maxSize: H(),
196
199
  viewport: t,
197
- viewportInsets: z(),
200
+ viewportInsets: p(),
198
201
  mobile: i.boundary === void 0 && E(),
199
202
  mobilePadding: X,
200
203
  center: e?.center ?? !1
201
204
  });
202
205
  if (i.boundary !== void 0 && A && !e?.center) {
203
- const o = we(t, z());
206
+ const o = we(t, p());
204
207
  r = {
205
208
  ...r,
206
209
  x: o.x + A.x * Math.max(0, o.width - r.width),
@@ -216,12 +219,12 @@ function nn(i) {
216
219
  }
217
220
  }, Ie = (e) => {
218
221
  k !== null && typeof cancelAnimationFrame < "u" && (cancelAnimationFrame(k), k = null), e && Pe();
219
- const t = f === "drag", r = e && !(t && u()) ? tt() ?? s : null, o = r ? me({
222
+ const t = f === "drag", r = e && !(t && u()) ? tt() ?? d : null, o = r ? me({
220
223
  rect: r,
221
224
  minSize: q(),
222
225
  maxSize: H(),
223
226
  viewport: R(),
224
- viewportInsets: z(),
227
+ viewportInsets: p(),
225
228
  mobile: i.boundary === void 0 && E(),
226
229
  mobilePadding: X
227
230
  }) : null;
@@ -235,9 +238,9 @@ function nn(i) {
235
238
  $e(o), f === "drag" && Object.assign(x, P);
236
239
  }
237
240
  h = null, f = null, ye(!1), be(!1);
238
- }), ce(!1, ""), N = void 0, o && (j(o), t && r && d?.animate && (r.x !== o.x || r.y !== o.y) && !window.matchMedia?.("(prefers-reduced-motion: reduce)").matches)) {
241
+ }), ce(!1, ""), N = void 0, o && (j(o), t && r && s?.animate && (r.x !== o.x || r.y !== o.y) && !window.matchMedia?.("(prefers-reduced-motion: reduce)").matches)) {
239
242
  const P = ne(r), U = ne(o);
240
- _ = d.animate([{
243
+ _ = s.animate([{
241
244
  transform: `translate3d(${P.x}px, ${P.y}px, 0)`
242
245
  }, {
243
246
  transform: `translate3d(${U.x}px, ${U.y}px, 0)`
@@ -260,7 +263,7 @@ function nn(i) {
260
263
  mode: "global"
261
264
  } : _t({
262
265
  owner: ee
263
- }), o = zt(r, i.boundary, t?.safeArea);
266
+ }), o = pt(r, i.boundary, t?.safeArea);
264
267
  ge(() => {
265
268
  qe(!!(o && o.width > 16 && o.height > 16)), We(o ? {
266
269
  x: o.left,
@@ -303,7 +306,7 @@ function nn(i) {
303
306
  }
304
307
  requestAnimationFrame(t);
305
308
  }), I(() => {
306
- z(), R(), v(), !(!i.open || !de || h !== null) && W(() => B({
309
+ p(), R(), v(), !(!i.open || !de || h !== null) && W(() => B({
307
310
  center: !1
308
311
  }));
309
312
  }), I(() => {
@@ -341,24 +344,24 @@ function nn(i) {
341
344
  }), I(() => {
342
345
  if (!i.open) return;
343
346
  const e = Se();
344
- T(), O()?.fixedOffset, j(h === null ? e : s);
347
+ T(), O()?.fixedOffset, j(h === null ? e : d);
345
348
  });
346
349
  const nt = (e) => {
347
- !xe() || v() || h !== null || e.pointerType === "mouse" && e.button !== 0 || e.target?.closest('button, input, select, textarea, a, [role="button"], [role="tab"], [data-floe-interactive], [contenteditable="true"]') || (e.preventDefault(), _?.cancel(), _ = void 0, le = e.currentTarget instanceof HTMLElement && e.currentTarget.getBoundingClientRect().height || 32, h = e.pointerId, f = "drag", ye(!0), p = {
350
+ !xe() || v() || h !== null || e.pointerType === "mouse" && e.button !== 0 || e.target?.closest('button, input, select, textarea, a, [role="button"], [role="tab"], [data-floe-interactive], [contenteditable="true"]') || (e.preventDefault(), _?.cancel(), _ = void 0, le = e.currentTarget instanceof HTMLElement && e.currentTarget.getBoundingClientRect().height || 32, h = e.pointerId, f = "drag", ye(!0), z = {
348
351
  x: e.clientX,
349
352
  y: e.clientY
350
353
  }, F = {
351
- ...s
354
+ ...d
352
355
  }, C = {
353
356
  x: e.clientX,
354
357
  y: e.clientY
355
358
  }, ce(!0, "grabbing"), Ce(e));
356
359
  }, $ = (e) => (t) => {
357
- !ve() || u() || v() || h !== null || t.pointerType === "mouse" && t.button !== 0 || (t.preventDefault(), t.stopPropagation(), h = t.pointerId, f = "resize", be(!0), _e = e, ze = {
360
+ !ve() || u() || v() || h !== null || t.pointerType === "mouse" && t.button !== 0 || (t.preventDefault(), t.stopPropagation(), h = t.pointerId, f = "resize", be(!0), _e = e, pe = {
358
361
  x: t.clientX,
359
362
  y: t.clientY
360
- }, pe = {
361
- ...s
363
+ }, ze = {
364
+ ...d
362
365
  }, C = {
363
366
  x: t.clientX,
364
367
  y: t.clientY
@@ -380,7 +383,7 @@ function nn(i) {
380
383
  N = vt({
381
384
  pointerEvent: e,
382
385
  // Keep click/double-click targeting on the titlebar while retaining capture.
383
- captureEl: f === "drag" ? se : d,
386
+ captureEl: f === "drag" ? se : s,
384
387
  onMove: it,
385
388
  onEnd: ({
386
389
  commit: t,
@@ -398,7 +401,7 @@ function nn(i) {
398
401
  }, ot = (e) => {
399
402
  e.target?.closest('button, input, select, textarea, a, [role="button"], [role="tab"], [data-floe-interactive], [contenteditable="true"]') || Ae();
400
403
  }, rt = (e) => {
401
- Ke(e.target) && Je();
404
+ Ke(e) && Je();
402
405
  }, S = (e) => J("absolute z-10", {
403
406
  n: "cursor-ns-resize top-0 left-2 right-2 h-1",
404
407
  s: "cursor-ns-resize bottom-0 left-2 right-2 h-1",
@@ -421,7 +424,7 @@ function nn(i) {
421
424
  get children() {
422
425
  var e = Lt(), t = e.firstChild, r = t.firstChild, o = r.firstChild, P = o.nextSibling, U = r.nextSibling;
423
426
  Q((n) => {
424
- d = n, W(() => j(Se()));
427
+ s = n, W(() => j(Se()));
425
428
  }, e), ke(e, Oe({
426
429
  get "data-floating-presence"() {
427
430
  return M.state();
@@ -457,7 +460,7 @@ function nn(i) {
457
460
  }), !1, !0);
458
461
  var Ee = ae;
459
462
  typeof Ee == "function" ? Q(Ee, t) : ae = t, ke(t, Oe({
460
- [pt]: "true"
463
+ [zt]: "true"
461
464
  }, {
462
465
  "data-floe-floating-window-surface": "true",
463
466
  "data-floe-surface": "floating",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floegence/floe-webapp-core",
3
- "version": "0.101.13",
3
+ "version": "0.101.14",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",