@floegence/floe-webapp-core 0.51.0 → 0.52.1

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.
package/dist/floe.css CHANGED
@@ -490,6 +490,37 @@
490
490
  --floe-floating-exit-scale: 0.985;
491
491
  }
492
492
 
493
+ .floe-bottom-drawer-overlay {
494
+ padding: max(1.25rem, env(safe-area-inset-top, 0px))
495
+ max(1.5rem, env(safe-area-inset-right, 0px)) max(1.25rem, env(safe-area-inset-bottom, 0px))
496
+ max(1.5rem, env(safe-area-inset-left, 0px));
497
+ }
498
+
499
+ .floe-bottom-drawer-backdrop {
500
+ background: color-mix(in srgb, var(--foreground) 8%, transparent);
501
+ --floe-floating-enter-duration: 240ms;
502
+ --floe-floating-exit-duration: 180ms;
503
+ }
504
+
505
+ .floe-bottom-drawer-panel {
506
+ --floe-floating-enter-duration: 240ms;
507
+ --floe-floating-exit-duration: 180ms;
508
+ --floe-floating-enter-y: calc(100% + 1.25rem);
509
+ --floe-floating-exit-y: calc(100% + 1.25rem);
510
+ --floe-floating-enter-scale: 1;
511
+ --floe-floating-exit-scale: 1;
512
+ border-radius: 1rem;
513
+ overflow: hidden;
514
+ }
515
+
516
+ @media (max-width: 639px) {
517
+ .floe-bottom-drawer-overlay {
518
+ padding: max(0.75rem, env(safe-area-inset-top, 0px))
519
+ max(0.75rem, env(safe-area-inset-right, 0px)) max(0.75rem, env(safe-area-inset-bottom, 0px))
520
+ max(0.75rem, env(safe-area-inset-left, 0px));
521
+ }
522
+ }
523
+
493
524
  .floe-floating-menu {
494
525
  --floe-floating-enter-duration: 120ms;
495
526
  --floe-floating-exit-duration: 100ms;
@@ -1,128 +1,140 @@
1
- import { createEffect as N, onCleanup as q } from "solid-js";
2
- import { lockBodyStyle as j } from "../utils/bodyStyleLock.js";
3
- import { deferAfterPaint as M } from "../utils/defer.js";
4
- import { getFocusableElements as x, getFirstFocusableElement as z } from "../utils/focus.js";
5
- import { matchKeybind as R } from "../utils/keybind.js";
6
- function C(e) {
7
- return typeof Node < "u" && e instanceof Node;
1
+ import { createEffect as R, onCleanup as V } from "solid-js";
2
+ import { lockBodyStyle as G } from "../utils/bodyStyleLock.js";
3
+ import { deferAfterPaint as D } from "../utils/defer.js";
4
+ import { getFocusableElements as J, getFirstFocusableElement as Q } from "../utils/focus.js";
5
+ import { matchKeybind as U } from "../utils/keybind.js";
6
+ const S = /* @__PURE__ */ new WeakMap();
7
+ function K(t) {
8
+ return typeof Node < "u" && t instanceof Node;
8
9
  }
9
- function h(e, o, r) {
10
- return r ? r(o) : !e || !C(o) ? !1 : e.contains(o);
10
+ function p(t, o, r) {
11
+ return r ? r(o) : !t || !K(o) ? !1 : t.contains(o);
11
12
  }
12
- function O(e, o, r, s) {
13
- return r === "none" ? !1 : r === "all" ? !0 : !h(e, o, s);
13
+ function H(t, o, r, a) {
14
+ return r === "none" ? !1 : r === "all" ? !0 : !p(t, o, a);
14
15
  }
15
- function V(e) {
16
- return typeof e == "function" ? e() ?? [] : e ?? [];
16
+ function X(t) {
17
+ return typeof t == "function" ? t() ?? [] : t ?? [];
17
18
  }
18
- function c(e, o) {
19
- return typeof e == "function" ? e() ?? o : e ?? o;
19
+ function c(t, o) {
20
+ return typeof t == "function" ? t() ?? o : t ?? o;
20
21
  }
21
- function G(e, o) {
22
- for (const r of V(o)) {
23
- const s = r.trim();
24
- if (s && R(e, s))
22
+ function Y(t, o) {
23
+ for (const r of X(o)) {
24
+ const a = r.trim();
25
+ if (a && U(t, a))
25
26
  return !0;
26
27
  }
27
28
  return !1;
28
29
  }
29
- function _(e) {
30
- const o = () => c(e.lockBodyScroll, !0), r = () => c(e.trapFocus, !0), s = () => {
31
- const a = c(
32
- e.closeOnEscape,
30
+ function oe(t) {
31
+ const o = () => c(t.lockBodyScroll, !0), r = () => c(t.trapFocus, !0), a = () => {
32
+ const i = c(
33
+ t.closeOnEscape,
33
34
  !0
34
35
  );
35
- return a === !1 ? "none" : a === "inside" ? "inside" : a === "none" ? "none" : "always";
36
- }, P = () => c(e.blockHotkeys, !0), D = () => c(e.restoreFocus, !0), S = () => c(e.blockWheel, "none"), H = () => c(e.blockTouchMove, "none"), K = () => c(e.autoFocus, !0);
37
- N(() => {
38
- if (!e.open() || typeof document > "u") return;
39
- const a = o(), E = r(), l = s(), f = c(e.escapeKeyPhase, "capture"), W = P(), A = D(), m = S(), v = H(), y = K(), p = document.activeElement instanceof HTMLElement ? document.activeElement : null, I = a ? j({ overflow: "hidden" }) : null;
40
- M(() => {
41
- const t = e.root();
42
- if (!t || y === !1) return;
43
- const n = typeof y == "object" ? y.selector : void 0, i = (n ? t.querySelector(n) : null) ?? t.querySelector("[data-floe-autofocus]") ?? z(t) ?? t;
36
+ return i === !1 ? "none" : i === "inside" ? "inside" : i === "none" ? "none" : "always";
37
+ }, W = () => c(t.blockHotkeys, !0), A = () => c(t.restoreFocus, !0), x = () => c(t.blockWheel, "none"), I = () => c(t.blockTouchMove, "none"), N = () => c(t.autoFocus, !0);
38
+ R(() => {
39
+ if (!t.open() || typeof document > "u") return;
40
+ const i = o(), b = r(), d = a(), m = c(t.escapeKeyPhase, "capture"), q = W(), j = A(), h = x(), k = I(), E = N(), l = S.get(document) ?? [];
41
+ S.set(document, l);
42
+ const v = {
43
+ global: i || d === "always",
44
+ contains: (e) => p(t.root(), e, t.containsTarget)
45
+ };
46
+ l.push(v);
47
+ let w = !0;
48
+ const u = (e) => w && !l.slice(l.indexOf(v) + 1).some((n) => n.global || n.contains(e)), g = document.activeElement instanceof HTMLElement ? document.activeElement : null, z = i ? G({ overflow: "hidden" }) : null;
49
+ D(() => {
50
+ const e = t.root();
51
+ if (!e?.isConnected || !u(e) || E === !1 || v.contains(document.activeElement)) return;
52
+ const n = typeof E == "object" ? E.selector : void 0, y = (n ? e.querySelector(n) : null) ?? e.querySelector("[data-floe-autofocus]") ?? Q(e) ?? e;
44
53
  try {
45
- i.focus();
54
+ y.focus();
46
55
  } catch {
47
56
  }
48
57
  });
49
- const k = (t) => {
50
- if (t.key !== "Tab") return;
51
- const n = e.root();
58
+ const T = (e) => {
59
+ if (e.key !== "Tab" || !u(e.target)) return;
60
+ const n = t.root();
52
61
  if (!n) return;
53
- const u = x(n);
54
- if (!u.length) {
55
- t.preventDefault();
62
+ const s = J(n);
63
+ if (!s.length) {
64
+ e.preventDefault();
56
65
  try {
57
66
  n.focus();
58
67
  } catch {
59
68
  }
60
69
  return;
61
70
  }
62
- const i = u[0], F = u[u.length - 1], d = document.activeElement instanceof HTMLElement ? document.activeElement : null;
63
- if (t.shiftKey) {
64
- if (d === i || !d || !n.contains(d)) {
65
- t.preventDefault();
71
+ const y = s[0], P = s[s.length - 1], f = document.activeElement instanceof HTMLElement ? document.activeElement : null;
72
+ if (e.shiftKey) {
73
+ if (f === y || !f || !n.contains(f)) {
74
+ e.preventDefault();
66
75
  try {
67
- F.focus();
76
+ P.focus();
68
77
  } catch {
69
78
  }
70
79
  }
71
- } else if (d === F) {
72
- t.preventDefault();
80
+ } else if (f === P || !f || !n.contains(f)) {
81
+ e.preventDefault();
73
82
  try {
74
- i.focus();
83
+ y.focus();
75
84
  } catch {
76
85
  }
77
86
  }
78
- }, b = (t) => {
79
- if (t.key !== "Escape" || f === "bubble" && (t.defaultPrevented || t.isComposing) || l === "none") return;
80
- const n = e.root(), u = h(
87
+ }, L = (e) => {
88
+ if (e.key !== "Escape" || !u(e.target) || m === "bubble" && (e.defaultPrevented || e.isComposing) || d === "none") return;
89
+ const n = t.root(), s = p(
81
90
  n,
82
- C(t.target) ? t.target : document.activeElement,
83
- e.containsTarget
91
+ K(e.target) ? e.target : document.activeElement,
92
+ t.containsTarget
84
93
  );
85
- if (l === "inside") {
86
- if (u) {
87
- t.preventDefault(), t.stopImmediatePropagation(), e.onClose?.();
94
+ if (d === "inside") {
95
+ if (s) {
96
+ e.preventDefault(), e.stopImmediatePropagation(), t.onClose?.();
88
97
  return;
89
98
  }
90
- e.onEscapeOutside && (t.preventDefault(), t.stopImmediatePropagation(), e.onEscapeOutside());
99
+ t.onEscapeOutside && (e.preventDefault(), e.stopImmediatePropagation(), t.onEscapeOutside());
91
100
  return;
92
101
  }
93
- t.preventDefault(), t.stopImmediatePropagation(), e.onClose?.();
94
- }, g = (t) => {
95
- const n = e.root();
96
- n && W && h(n, t.target, e.containsTarget) && (G(t, e.allowHotkeys) || t.stopPropagation());
97
- }, w = (t) => {
98
- const n = e.root();
99
- O(n, t.target, m, e.containsTarget) && t.cancelable && t.preventDefault();
100
- }, L = (t) => {
101
- t.stopPropagation();
102
- }, T = (t) => {
103
- const n = e.root();
104
- O(n, t.target, v, e.containsTarget) && t.cancelable && t.preventDefault();
102
+ e.preventDefault(), e.stopImmediatePropagation(), t.onClose?.();
103
+ }, M = (e) => {
104
+ if (!u(e.target)) return;
105
+ const n = t.root();
106
+ n && q && p(n, e.target, t.containsTarget) && (Y(e, t.allowHotkeys) || e.stopPropagation());
107
+ }, O = (e) => {
108
+ if (!u(e.target)) return;
109
+ const n = t.root();
110
+ H(n, e.target, h, t.containsTarget) && e.cancelable && e.preventDefault();
111
+ }, B = (e) => {
112
+ u(e.target) && e.stopPropagation();
113
+ }, F = (e) => {
114
+ if (!u(e.target)) return;
115
+ const n = t.root();
116
+ H(n, e.target, k, t.containsTarget) && e.cancelable && e.preventDefault();
105
117
  };
106
- E && document.addEventListener("keydown", k, !0);
107
- const B = f === "capture" ? window : document;
108
- l !== "none" && B.addEventListener(
118
+ b && document.addEventListener("keydown", T, !0);
119
+ const C = m === "capture" ? window : document;
120
+ d !== "none" && C.addEventListener(
109
121
  "keydown",
110
- b,
111
- f === "capture"
112
- ), document.addEventListener("keydown", g), m !== "none" && (document.addEventListener("wheel", w, { capture: !0, passive: !1 }), document.addEventListener("wheel", L)), v !== "none" && document.addEventListener("touchmove", T, {
122
+ L,
123
+ m === "capture"
124
+ ), document.addEventListener("keydown", M), h !== "none" && (document.addEventListener("wheel", O, { capture: !0, passive: !1 }), document.addEventListener("wheel", B)), k !== "none" && document.addEventListener("touchmove", F, {
113
125
  capture: !0,
114
126
  passive: !1
115
- }), q(() => {
116
- E && document.removeEventListener("keydown", k, !0), l !== "none" && B.removeEventListener(
127
+ }), V(() => {
128
+ w = !1, l.splice(l.indexOf(v), 1), b && document.removeEventListener("keydown", T, !0), d !== "none" && C.removeEventListener(
117
129
  "keydown",
118
- b,
119
- f === "capture"
120
- ), document.removeEventListener("keydown", g), m !== "none" && (document.removeEventListener("wheel", w, !0), document.removeEventListener("wheel", L)), v !== "none" && document.removeEventListener("touchmove", T, !0), I?.(), A && p && p.isConnected && M(() => {
130
+ L,
131
+ m === "capture"
132
+ ), document.removeEventListener("keydown", M), h !== "none" && (document.removeEventListener("wheel", O, !0), document.removeEventListener("wheel", B)), k !== "none" && document.removeEventListener("touchmove", F, !0), z?.(), j && g && g.isConnected && D(() => {
121
133
  if (typeof document > "u") return;
122
- const t = document.activeElement;
123
- if (!(t && t !== document.body && t !== document.documentElement))
134
+ const e = document.activeElement;
135
+ if (!(e && e !== document.body && e !== document.documentElement))
124
136
  try {
125
- p.focus();
137
+ g.focus();
126
138
  } catch {
127
139
  }
128
140
  });
@@ -130,5 +142,5 @@ function _(e) {
130
142
  });
131
143
  }
132
144
  export {
133
- _ as useOverlayMask
145
+ oe as useOverlayMask
134
146
  };