@floegence/floe-webapp-core 0.71.0 → 0.73.0

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,12 +1,13 @@
1
- import { createComponent as m, Portal as y, use as S, spread as v, mergeProps as h, insert as P, template as R } from "solid-js/web";
2
- import { splitProps as g, createMemo as n } from "solid-js";
3
- import { cn as A } from "../../utils/cn.js";
4
- import { LOCAL_INTERACTION_SURFACE_ATTR as _ } from "./localInteractionSurface.js";
5
- import { clampMenuPosition as b } from "./menuUtils.js";
6
- import { readSurfaceSafeArea as T, resolveFloatingBoundary as z } from "./surfaceFloatingBoundary.js";
7
- import { resolveSurfacePortalHost as C, SURFACE_FLOATING_LAYER_ATTR as w, resolveSurfacePortalMount as x, resolveSurfacePortalBoundaryRect as F, isSurfacePortalMode as L, projectSurfacePortalPosition as M } from "./dialogSurfaceScope.js";
8
- var $ = /* @__PURE__ */ R("<div>");
9
- function B() {
1
+ import { createComponent as S, Portal as v, use as h, spread as g, mergeProps as A, insert as P, template as R } from "solid-js/web";
2
+ import { observeViewport as w } from "../../viewport.js";
3
+ import { splitProps as _, createSignal as b, onMount as x, onCleanup as C, createMemo as s } from "solid-js";
4
+ import { cn as T } from "../../utils/cn.js";
5
+ import { LOCAL_INTERACTION_SURFACE_ATTR as z } from "./localInteractionSurface.js";
6
+ import { clampMenuPosition as M } from "./menuUtils.js";
7
+ import { readSurfaceSafeArea as F, resolveFloatingBoundary as L } from "./surfaceFloatingBoundary.js";
8
+ import { resolveSurfacePortalHost as $, SURFACE_FLOATING_LAYER_ATTR as E, resolveSurfacePortalMount as O, isSurfacePortalMode as B, projectSurfacePortalPosition as I } from "./dialogSurfaceScope.js";
9
+ var N = /* @__PURE__ */ R("<div>");
10
+ function j() {
10
11
  return {
11
12
  left: 0,
12
13
  top: 0,
@@ -16,42 +17,50 @@ function B() {
16
17
  height: 0
17
18
  };
18
19
  }
19
- function G(l) {
20
- const [e, c] = g(l, ["position", "owner", "boundary", "estimatedSize", "clamp", "class", "style", "children", "layerRef"]), o = n(() => C({
20
+ function J(c) {
21
+ const [e, f] = _(c, ["position", "owner", "boundary", "estimatedSize", "clamp", "class", "style", "children", "layerRef"]), [a, p] = b();
22
+ x(() => C(w(window, p)));
23
+ const r = s(() => $({
21
24
  owner: e.owner ?? null
22
- })), i = () => L(o()), u = n(() => (e.position, T())), r = () => e.boundary === void 0 ? F(o()) : z(o(), e.boundary, u()) ?? B(), d = () => e.clamp !== !1 && !!e.estimatedSize, f = n(() => {
25
+ })), n = () => B(r()), u = s(() => (e.position, a()?.safeArea ?? F())), i = () => L(r(), e.boundary, u()) ?? j(), m = () => e.clamp !== !1 && !!e.estimatedSize, d = s(() => {
23
26
  const t = e.position;
24
- return !d() || !e.estimatedSize ? t : b(t, e.estimatedSize, r());
25
- }), a = () => M(f(), o()), p = () => ({
27
+ return !m() || !e.estimatedSize ? t : M(t, e.estimatedSize, i());
28
+ }), l = () => {
29
+ const t = I(d(), r()), o = a()?.fixedOffset;
30
+ return n() || !o ? t : {
31
+ x: t.x + o.left,
32
+ y: t.y + o.top
33
+ };
34
+ }, y = () => ({
26
35
  ...e.style ?? {},
27
- ...e.boundary !== void 0 && (r().width <= 16 || r().height <= 16) ? {
36
+ ...e.boundary !== void 0 && (i().width <= 16 || i().height <= 16) ? {
28
37
  visibility: "hidden",
29
38
  "pointer-events": "none"
30
39
  } : {},
31
- left: `${a().x}px`,
32
- top: `${a().y}px`
40
+ left: `${l().x}px`,
41
+ top: `${l().y}px`
33
42
  });
34
- return m(y, {
43
+ return S(v, {
35
44
  get mount() {
36
- return x(o());
45
+ return O(r());
37
46
  },
38
47
  get children() {
39
- var t = $(), s = e.layerRef;
40
- return typeof s == "function" ? S(s, t) : e.layerRef = t, v(t, h(c, {
48
+ var t = N(), o = e.layerRef;
49
+ return typeof o == "function" ? h(o, t) : e.layerRef = t, g(t, A(f, {
41
50
  get class() {
42
- return A(i() ? "absolute z-20" : "fixed z-50", e.class);
51
+ return T(n() ? "absolute z-20" : "fixed z-50", e.class);
43
52
  },
44
53
  get style() {
45
- return p();
54
+ return y();
46
55
  }
47
56
  }, {
48
- [w]: "true"
57
+ [E]: "true"
49
58
  }, () => ({
50
- [_]: i() ? "true" : void 0
59
+ [z]: n() ? "true" : void 0
51
60
  })), !1, !0), P(t, () => e.children), t;
52
61
  }
53
62
  });
54
63
  }
55
64
  export {
56
- G as SurfaceFloatingLayer
65
+ J as SurfaceFloatingLayer
57
66
  };
@@ -35,7 +35,10 @@ interface ResolveFloatingWindowRectOptions {
35
35
  resizeHandle: FloatingWindowResizeHandle;
36
36
  minSize: Size;
37
37
  maxSize: Size;
38
- viewport: Size;
38
+ viewport: Size & {
39
+ x?: number;
40
+ y?: number;
41
+ };
39
42
  viewportInsets?: FloatingWindowViewportInsets;
40
43
  mobile: boolean;
41
44
  mobilePadding: number;
@@ -44,13 +47,19 @@ interface NormalizeFloatingWindowRectOptions {
44
47
  rect: FloatingWindowRect;
45
48
  minSize: Size;
46
49
  maxSize: Size;
47
- viewport: Size;
50
+ viewport: Size & {
51
+ x?: number;
52
+ y?: number;
53
+ };
48
54
  viewportInsets?: FloatingWindowViewportInsets;
49
55
  mobile: boolean;
50
56
  mobilePadding: number;
51
57
  center?: boolean;
52
58
  }
53
- export declare function resolveFloatingWindowViewport(viewport: Size, insets?: FloatingWindowViewportInsets): FloatingWindowViewport;
59
+ export declare function resolveFloatingWindowViewport(viewport: Size & {
60
+ x?: number;
61
+ y?: number;
62
+ }, insets?: FloatingWindowViewportInsets): FloatingWindowViewport;
54
63
  export declare function resolveFloatingWindowRect(options: ResolveFloatingWindowRectOptions): FloatingWindowRect;
55
64
  export declare function normalizeFloatingWindowRect(options: NormalizeFloatingWindowRectOptions): FloatingWindowRect;
56
65
  export {};
@@ -1,37 +1,37 @@
1
- function x(e, i, m) {
2
- return Math.max(i, Math.min(m, e));
1
+ function x(n, i, m) {
2
+ return Math.max(i, Math.min(m, n));
3
3
  }
4
- function l(e, i, m) {
5
- const s = Math.max(0, m), o = Math.min(e, s), c = Math.max(o, Math.min(i, s));
4
+ function l(n, i, m) {
5
+ const s = Math.max(0, m), o = Math.min(n, s), c = Math.max(o, Math.min(i, s));
6
6
  return { min: o, max: c };
7
7
  }
8
- function z(e) {
9
- const i = Number(e);
8
+ function v(n) {
9
+ const i = Number(n);
10
10
  return Number.isFinite(i) && i > 0 ? i : 0;
11
11
  }
12
- function X(e, i = {}) {
13
- const m = Math.max(0, e.width), s = Math.max(0, e.height), o = Math.min(z(i.left), m), c = Math.min(z(i.top), s), n = Math.min(z(i.right), Math.max(0, m - o)), d = Math.min(z(i.bottom), Math.max(0, s - c));
12
+ function X(n, i = {}) {
13
+ const m = Math.max(0, n.width), s = Math.max(0, n.height), o = Math.min(v(i.left), m), c = Math.min(v(i.top), s), e = Math.min(v(i.right), Math.max(0, m - o)), d = Math.min(v(i.bottom), Math.max(0, s - c));
14
14
  return {
15
- x: o,
16
- y: c,
17
- width: Math.max(0, m - o - n),
15
+ x: (n.x ?? 0) + o,
16
+ y: (n.y ?? 0) + c,
17
+ width: Math.max(0, m - o - e),
18
18
  height: Math.max(0, s - c - d)
19
19
  };
20
20
  }
21
- function Y(e) {
22
- return e.x + e.width;
21
+ function Y(n) {
22
+ return n.x + n.width;
23
23
  }
24
- function H(e) {
25
- return e.y + e.height;
24
+ function H(n) {
25
+ return n.y + n.height;
26
26
  }
27
- function I(e) {
27
+ function I(n) {
28
28
  const {
29
29
  mode: i,
30
30
  pointer: m,
31
31
  dragStartPos: s,
32
32
  dragStartRect: o,
33
33
  resizeStartPos: c,
34
- resizeStartRect: n,
34
+ resizeStartRect: e,
35
35
  resizeHandle: d,
36
36
  minSize: r,
37
37
  maxSize: t,
@@ -39,55 +39,55 @@ function I(e) {
39
39
  viewportInsets: S,
40
40
  mobile: y,
41
41
  mobilePadding: f
42
- } = e, a = X(R, S), g = Y(a), w = H(a), u = m.x - (i === "drag" ? s.x : c.x), p = m.y - (i === "drag" ? s.y : c.y);
42
+ } = n, a = X(R, S), g = Y(a), M = H(a), u = m.x - (i === "drag" ? s.x : c.x), p = m.y - (i === "drag" ? s.y : c.y);
43
43
  if (i === "drag") {
44
- const h = Math.max(a.x, g - o.width), M = Math.max(a.y, w - o.height);
44
+ const h = Math.max(a.x, g - o.width), w = Math.max(a.y, M - o.height);
45
45
  return {
46
46
  ...o,
47
47
  x: x(y ? a.x + f : o.x + u, a.x, h),
48
- y: x(o.y + p, a.y, M)
48
+ y: x(o.y + p, a.y, w)
49
49
  };
50
50
  }
51
- let b = n.width, v = n.height, W = n.x, F = n.y;
51
+ let b = e.width, z = e.height, W = e.x, F = e.y;
52
52
  if (!y && d.includes("e")) {
53
- const h = l(r.width, t.width, g - n.x);
54
- b = x(n.width + u, h.min, h.max);
53
+ const h = l(r.width, t.width, g - e.x);
54
+ b = x(e.width + u, h.min, h.max);
55
55
  }
56
56
  if (!y && d.includes("w")) {
57
- const h = n.x + n.width, M = l(r.width, t.width, h - a.x), B = h - M.max, P = Math.max(B, h - M.min);
58
- W = x(n.x + u, B, P), b = Math.max(0, h - W);
57
+ const h = e.x + e.width, w = l(r.width, t.width, h - a.x), B = h - w.max, P = Math.max(B, h - w.min);
58
+ W = x(e.x + u, B, P), b = Math.max(0, h - W);
59
59
  }
60
60
  if (d.includes("s")) {
61
- const h = l(r.height, t.height, w - n.y);
62
- v = x(n.height + p, h.min, h.max);
61
+ const h = l(r.height, t.height, M - e.y);
62
+ z = x(e.height + p, h.min, h.max);
63
63
  }
64
64
  if (d.includes("n")) {
65
- const h = n.y + n.height, M = l(r.height, t.height, h - a.y), B = h - M.max, P = Math.max(B, h - M.min);
66
- F = x(n.y + p, B, P), v = Math.max(0, h - F);
65
+ const h = e.y + e.height, w = l(r.height, t.height, h - a.y), B = h - w.max, P = Math.max(B, h - w.min);
66
+ F = x(e.y + p, B, P), z = Math.max(0, h - F);
67
67
  }
68
68
  return {
69
69
  x: x(W, a.x, Math.max(a.x, g - b)),
70
- y: x(F, a.y, Math.max(a.y, w - v)),
70
+ y: x(F, a.y, Math.max(a.y, M - z)),
71
71
  width: b,
72
- height: v
72
+ height: z
73
73
  };
74
74
  }
75
- function V(e) {
75
+ function V(n) {
76
76
  const {
77
77
  rect: i,
78
78
  minSize: m,
79
79
  maxSize: s,
80
80
  viewport: o,
81
81
  viewportInsets: c,
82
- mobile: n,
82
+ mobile: e,
83
83
  mobilePadding: d,
84
84
  center: r = !1
85
- } = e, t = X(o, c), R = Y(t), S = H(t), y = n ? Math.max(0, t.width - d * 2) : t.width, f = l(m.width, s.width, y), a = l(m.height, s.height, t.height), g = n ? f.max : x(i.width, f.min, f.max), w = x(i.height, a.min, a.max), u = Math.max(t.x, R - g), p = Math.max(t.y, S - w);
85
+ } = n, t = X(o, c), R = Y(t), S = H(t), y = e ? Math.max(0, t.width - d * 2) : t.width, f = l(m.width, s.width, y), a = l(m.height, s.height, t.height), g = e ? f.max : x(i.width, f.min, f.max), M = x(i.height, a.min, a.max), u = Math.max(t.x, R - g), p = Math.max(t.y, S - M);
86
86
  return {
87
- x: n ? x(t.x + d, t.x, u) : r ? Math.max(t.x, Math.round(t.x + (t.width - g) / 2)) : x(i.x, t.x, u),
88
- y: r ? Math.max(t.y, Math.round(t.y + (t.height - w) / 2)) : x(i.y, t.y, p),
87
+ x: e ? x(t.x + d, t.x, u) : r ? Math.max(t.x, Math.round(t.x + (t.width - g) / 2)) : x(i.x, t.x, u),
88
+ y: r ? Math.max(t.y, Math.round(t.y + (t.height - M) / 2)) : x(i.y, t.y, p),
89
89
  width: g,
90
- height: w
90
+ height: M
91
91
  };
92
92
  }
93
93
  export {
@@ -1,53 +1,44 @@
1
- import { resolveMobileKeyboardViewportMetrics as l } from "./mobileKeyboardViewport.js";
2
- import { isSurfacePortalMode as d, resolveSurfacePortalBoundaryRect as p } from "./dialogSurfaceScope.js";
3
- function m(...e) {
4
- const t = Math.max(...e.map((r) => r.left)), i = Math.max(...e.map((r) => r.top)), o = Math.max(t, Math.min(...e.map((r) => r.right))), a = Math.max(i, Math.min(...e.map((r) => r.bottom)));
5
- return { left: t, top: i, right: o, bottom: a, width: o - t, height: a - i };
1
+ import { readViewportSnapshot as f } from "../../viewport.js";
2
+ import { isSurfacePortalMode as l, resolveSurfacePortalBoundaryRect as h } from "./dialogSurfaceScope.js";
3
+ function m(...i) {
4
+ const e = Math.max(...i.map((t) => t.left)), n = Math.max(...i.map((t) => t.top)), o = Math.max(e, Math.min(...i.map((t) => t.right))), r = Math.max(n, Math.min(...i.map((t) => t.bottom)));
5
+ return { left: e, top: n, right: o, bottom: r, width: o - e, height: r - n };
6
6
  }
7
- function s() {
8
- if (typeof document > "u") return { top: 0, right: 0, bottom: 0, left: 0 };
9
- const e = document.createElement("div");
10
- e.style.cssText = "position:fixed;visibility:hidden;pointer-events:none;padding:env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px)", document.documentElement.append(e);
11
- const t = getComputedStyle(e), i = (a) => Math.max(0, Number.parseFloat(a) || 0), o = {
12
- top: i(t.paddingTop),
13
- right: i(t.paddingRight),
14
- bottom: i(t.paddingBottom),
15
- left: i(t.paddingLeft)
16
- };
17
- return e.remove(), o;
7
+ function p() {
8
+ return typeof window > "u" ? { top: 0, right: 0, bottom: 0, left: 0 } : f(window).safeArea;
18
9
  }
19
- function c(e, t, i = { top: 0, right: 0, bottom: 0, left: 0 }) {
20
- if (t === null || typeof window > "u" || e.mode === "surface" && !d(e)) return null;
21
- const o = l(window), a = window.innerHeight - o.bottomPx - o.heightPx, r = {
22
- left: o.leftPx + i.left,
23
- top: a + i.top,
24
- right: o.leftPx + o.widthPx - i.right,
25
- bottom: a + o.heightPx - i.bottom,
26
- width: o.widthPx,
27
- height: o.heightPx
10
+ function c(i, e, n = { top: 0, right: 0, bottom: 0, left: 0 }) {
11
+ if (e === null || typeof window > "u" || i.mode === "surface" && !l(i)) return null;
12
+ const { visible: o } = f(window), r = {
13
+ left: o.left + n.left,
14
+ top: o.top + n.top,
15
+ right: o.right - n.right,
16
+ bottom: o.bottom - n.bottom,
17
+ width: o.width,
18
+ height: o.height
28
19
  };
29
- let n;
30
- if (t instanceof HTMLElement) {
31
- if (!t.isConnected || t.closest('[inert], [hidden], [aria-hidden="true"]'))
20
+ let t;
21
+ if (e instanceof HTMLElement) {
22
+ if (!e.isConnected || e.closest('[inert], [hidden], [aria-hidden="true"]'))
32
23
  return null;
33
- n = t.getBoundingClientRect();
24
+ t = e.getBoundingClientRect();
34
25
  } else
35
- n = t;
36
- return n && ![
37
- n.left,
38
- n.top,
39
- n.right,
40
- n.bottom,
41
- n.width,
42
- n.height
26
+ t = e;
27
+ return t && ![
28
+ t.left,
29
+ t.top,
30
+ t.right,
31
+ t.bottom,
32
+ t.width,
33
+ t.height
43
34
  ].every(Number.isFinite) ? null : m(
44
35
  r,
45
- p(e),
46
- ...n ? [n] : []
36
+ ...l(i) ? [h(i)] : [],
37
+ ...t ? [t] : []
47
38
  );
48
39
  }
49
40
  export {
50
41
  m as intersectSurfaceRects,
51
- s as readSurfaceSafeArea,
42
+ p as readSurfaceSafeArea,
52
43
  c as resolveFloatingBoundary
53
44
  };
package/dist/floe.css CHANGED
@@ -455,10 +455,29 @@
455
455
  --floe-floating-exit-scale: 1;
456
456
  }
457
457
 
458
+ .floe-side-drawer-overlay {
459
+ --floe-dialog-gap-y: 0px;
460
+ --floe-dialog-gap-x: 0px;
461
+ padding: 0;
462
+ }
463
+
464
+ .floe-side-drawer-panel {
465
+ height: 100%;
466
+ border-top-right-radius: 0;
467
+ border-bottom-right-radius: 0;
468
+ --floe-floating-enter-x: min(8rem, 18vw);
469
+ --floe-floating-exit-x: min(6rem, 14vw);
470
+ --floe-floating-enter-y: 0;
471
+ --floe-floating-exit-y: 0;
472
+ --floe-floating-enter-scale: 1;
473
+ --floe-floating-exit-scale: 1;
474
+ --floe-floating-origin: right center;
475
+ }
476
+
458
477
  .floe-bottom-drawer-overlay {
459
- padding: max(1.25rem, env(safe-area-inset-top, 0px))
460
- max(1.5rem, env(safe-area-inset-right, 0px)) max(1.25rem, env(safe-area-inset-bottom, 0px))
461
- max(1.5rem, env(safe-area-inset-left, 0px));
478
+ --floe-dialog-gap-y: 1.25rem;
479
+ --floe-dialog-gap-x: 1.5rem;
480
+ padding: var(--floe-dialog-gap-y) var(--floe-dialog-gap-x);
462
481
  }
463
482
 
464
483
  .floe-bottom-drawer-backdrop {
@@ -480,9 +499,8 @@
480
499
 
481
500
  @media (max-width: 639px) {
482
501
  .floe-bottom-drawer-overlay {
483
- padding: max(0.75rem, env(safe-area-inset-top, 0px))
484
- max(0.75rem, env(safe-area-inset-right, 0px)) max(0.75rem, env(safe-area-inset-bottom, 0px))
485
- max(0.75rem, env(safe-area-inset-left, 0px));
502
+ --floe-dialog-gap-y: 0.75rem;
503
+ --floe-dialog-gap-x: 0.75rem;
486
504
  }
487
505
  }
488
506
 
@@ -707,10 +725,6 @@
707
725
  pointer-events: auto;
708
726
  transform-origin: bottom center;
709
727
  transition:
710
- left 360ms cubic-bezier(0.22, 0.8, 0.24, 1),
711
- top 360ms cubic-bezier(0.22, 0.8, 0.24, 1),
712
- width 360ms cubic-bezier(0.22, 0.8, 0.24, 1),
713
- height 360ms cubic-bezier(0.22, 0.8, 0.24, 1),
714
728
  border-radius 200ms ease,
715
729
  border-color 180ms ease,
716
730
  opacity 120ms ease;
@@ -728,6 +742,12 @@
728
742
  .floe-bottom-bar-companion[data-companion-phase='expanding'],
729
743
  .floe-bottom-bar-companion[data-companion-phase='collapsing'] {
730
744
  will-change: left, top, width, height;
745
+ transition:
746
+ left 360ms cubic-bezier(0.22, 0.8, 0.24, 1),
747
+ top 360ms cubic-bezier(0.22, 0.8, 0.24, 1),
748
+ width 360ms cubic-bezier(0.22, 0.8, 0.24, 1),
749
+ height 360ms cubic-bezier(0.22, 0.8, 0.24, 1),
750
+ border-radius 200ms ease, border-color 180ms ease, opacity 120ms ease;
731
751
  }
732
752
 
733
753
  .floe-bottom-bar-companion[data-companion-visibility='hidden'],