@floegence/floe-webapp-core 0.52.8 → 0.52.10

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.
@@ -10,6 +10,8 @@ export interface BottomBarCompanionProps {
10
10
  id: string;
11
11
  label: string;
12
12
  children?: JSX.Element;
13
+ /** Preferred expanded width in pixels; defaults to the anchor width and respects maxWidth. */
14
+ expandedWidth?: number;
13
15
  maxWidth?: number;
14
16
  maxHeight?: number;
15
17
  viewportPadding?: number;
@@ -1,14 +1,14 @@
1
- import { createComponent as Z, Portal as ce, use as $, insert as le, effect as ue, setAttribute as R, className as p, style as de, memo as fe, template as me } from "solid-js/web";
2
- import { createSignal as N, createEffect as k, untrack as G, onCleanup as U, Show as he } from "solid-js";
3
- import { cn as ee } from "../../utils/cn.js";
1
+ import { createComponent as p, Portal as ce, use as ee, insert as le, effect as ue, setAttribute as V, className as te, style as de, memo as fe, template as me } from "solid-js/web";
2
+ import { createSignal as x, createEffect as G, untrack as U, onCleanup as _, Show as he } from "solid-js";
3
+ import { cn as ne } from "../../utils/cn.js";
4
4
  var ve = /* @__PURE__ */ me("<section role=region data-floe-bottom-bar-companion=true><div data-floe-bottom-bar-companion-content=true>");
5
- const we = 544, be = 544, ge = 12, z = {
5
+ const we = 544, be = 544, ge = 12, q = {
6
6
  top: "--floe-bottom-bar-companion-safe-area-top",
7
7
  right: "--floe-bottom-bar-companion-safe-area-right",
8
8
  bottom: "--floe-bottom-bar-companion-safe-area-bottom",
9
9
  left: "--floe-bottom-bar-companion-safe-area-left"
10
10
  };
11
- function te(e, a) {
11
+ function X(e, a) {
12
12
  const l = Number(e);
13
13
  return Number.isFinite(l) && l > 0 ? l : a;
14
14
  }
@@ -16,7 +16,7 @@ function Ce(e, a) {
16
16
  const l = Number(e);
17
17
  return Number.isFinite(l) && l >= 0 ? l : a;
18
18
  }
19
- function ne(e) {
19
+ function oe(e) {
20
20
  if (!e?.isConnected) return null;
21
21
  const a = e.getBoundingClientRect();
22
22
  return !Number.isFinite(a.left) || !Number.isFinite(a.top) || a.width <= 0 || a.height <= 0 ? null : {
@@ -26,7 +26,7 @@ function ne(e) {
26
26
  height: a.height
27
27
  };
28
28
  }
29
- function B(e, a) {
29
+ function k(e, a) {
30
30
  const l = e.ownerDocument.defaultView;
31
31
  if (!l) return 0;
32
32
  const m = Number.parseFloat(l.getComputedStyle(e).getPropertyValue(a));
@@ -34,19 +34,19 @@ function B(e, a) {
34
34
  }
35
35
  function Fe(e) {
36
36
  return {
37
- top: B(e, z.top),
38
- right: B(e, z.right),
39
- bottom: B(e, z.bottom),
40
- left: B(e, z.left)
37
+ top: k(e, q.top),
38
+ right: k(e, q.right),
39
+ bottom: k(e, q.bottom),
40
+ left: k(e, q.left)
41
41
  };
42
42
  }
43
- function ye(e, a, l, m, C) {
44
- const F = a.ownerDocument.defaultView, y = F?.visualViewport, v = y?.offsetLeft ?? 0, D = y?.offsetTop ?? 0, q = y?.width ?? F?.innerWidth ?? e.left + e.width, H = y?.height ?? F?.innerHeight ?? e.top + e.height, E = Fe(a), W = v + E.left + C, w = v + q - E.right - C, b = D + E.top + C, h = D + H - E.bottom - C, g = Math.max(0, w - W), d = Math.min(e.width, l, g), P = e.left + (e.width - d) / 2, M = Math.max(W, Math.min(P, w - d)), L = Math.min(e.top + e.height, h), V = Math.max(e.height, L - b), x = Math.min(m, V);
43
+ function ye(e, a, l, m, R, F) {
44
+ const E = a.ownerDocument.defaultView, f = E?.visualViewport, A = f?.offsetLeft ?? 0, z = f?.offsetTop ?? 0, N = f?.width ?? E?.innerWidth ?? e.left + e.width, H = f?.height ?? E?.innerHeight ?? e.top + e.height, P = Fe(a), b = A + P.left + F, h = A + N - P.right - F, v = z + P.top + F, g = z + H - P.bottom, w = Math.max(0, h - b), C = Math.min(l, m, w), L = e.left + (e.width - C) / 2, M = Math.max(b, Math.min(L, h - C)), D = Math.min(e.top + e.height, g), S = Math.max(e.height, D - v), B = Math.min(R, S);
45
45
  return {
46
46
  left: M,
47
- top: L - x,
48
- width: d,
49
- height: x
47
+ top: D - B,
48
+ width: C,
49
+ height: B
50
50
  };
51
51
  }
52
52
  function Ee(e, a) {
@@ -61,157 +61,157 @@ function Ae(e) {
61
61
  } : {};
62
62
  }
63
63
  function Me(e) {
64
- const [a, l] = N(null), [m, C] = N(!1), [F, y] = N(!1), [v, D] = N(null), [q, H] = N(null), [E, W] = N("collapsed");
65
- let w = null, b = 0, h = 0, g = null, d = null, P = null, M = !1, L = !1;
66
- const V = (i) => {
67
- E() !== i && (W(i), e.onPhaseChange?.(i));
68
- }, x = () => a()?.ownerDocument.defaultView ?? e.anchor?.ownerDocument.defaultView ?? null, oe = () => x()?.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? !1, _ = (i) => {
64
+ const [a, l] = x(null), [m, R] = x(!1), [F, E] = x(!1), [f, A] = x(null), [z, N] = x(null), [H, P] = x("collapsed");
65
+ let b = null, h = 0, v = 0, g = null, w = null, C = null, L = !1, M = !1;
66
+ const D = (i) => {
67
+ H() !== i && (P(i), e.onPhaseChange?.(i));
68
+ }, S = () => a()?.ownerDocument.defaultView ?? e.anchor?.ownerDocument.defaultView ?? null, B = () => S()?.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? !1, K = (i) => {
69
69
  const t = e.mount, r = e.anchor, n = !!(t?.isConnected && i && r?.ownerDocument === t.ownerDocument);
70
70
  n && l(t);
71
71
  const c = a();
72
72
  if (c) {
73
- C(c.isConnected);
73
+ R(c.isConnected);
74
74
  const o = !!(n && c === t);
75
- return y(o), {
75
+ return E(o), {
76
76
  mount: c,
77
77
  ready: o
78
78
  };
79
79
  }
80
- return C(!1), y(!1), {
80
+ return R(!1), E(!1), {
81
81
  mount: null,
82
82
  ready: !1
83
83
  };
84
84
  }, ie = (i) => {
85
- const t = ne(e.anchor);
86
- t && H(t);
85
+ const t = oe(e.anchor);
86
+ t && N(t);
87
87
  const {
88
88
  mount: r,
89
89
  ready: n
90
- } = _(t), c = t ?? q();
91
- return !c || !r || !n ? null : i ? ye(c, r, te(e.maxWidth, we), te(e.maxHeight, be), Ce(e.viewportPadding, ge)) : c;
92
- }, X = () => {
93
- b && g && g.cancelAnimationFrame(b), h && d && d.cancelAnimationFrame(h), b = 0, h = 0, g = null, d = null, P = null;
94
- }, K = (i, t) => {
90
+ } = K(t), c = t ?? z();
91
+ return !c || !r || !n ? null : i ? ye(c, r, X(e.expandedWidth, c.width), X(e.maxWidth, we), X(e.maxHeight, be), Ce(e.viewportPadding, ge)) : c;
92
+ }, j = () => {
93
+ h && g && g.cancelAnimationFrame(h), v && w && w.cancelAnimationFrame(v), h = 0, v = 0, g = null, w = null, C = null;
94
+ }, J = (i, t) => {
95
95
  const r = ie(i);
96
96
  if (!r) return;
97
- const n = v(), c = i ? "expanded" : "collapsed";
98
- if (!t || oe() || Ee(n, r)) {
99
- D(r), P = null, V(c);
97
+ const n = f(), c = i ? "expanded" : "collapsed";
98
+ if (!t || B() || Ee(n, r)) {
99
+ A(r), C = null, D(c);
100
100
  return;
101
101
  }
102
- P = ["height", "width", "top", "left"].find((u) => n?.[u] !== r[u]) ?? null, V(i ? "expanding" : "collapsing");
103
- const o = x();
102
+ C = ["height", "width", "top", "left"].find((u) => n?.[u] !== r[u]) ?? null, D(i ? "expanding" : "collapsing");
103
+ const o = S();
104
104
  if (!o) {
105
- D(r), V(c);
105
+ A(r), D(c);
106
106
  return;
107
107
  }
108
- h = o.requestAnimationFrame(() => {
109
- h = 0, d = null, D(r);
110
- }), d = o;
111
- }, j = (i, t) => {
112
- const r = x();
108
+ v = o.requestAnimationFrame(() => {
109
+ v = 0, w = null, A(r);
110
+ }), w = o;
111
+ }, Q = (i, t) => {
112
+ const r = S();
113
113
  if (!r) {
114
- K(t, i);
114
+ J(t, i);
115
115
  return;
116
116
  }
117
- b && g && g.cancelAnimationFrame(b), h && d && d.cancelAnimationFrame(h), h = 0, d = null, b = r.requestAnimationFrame(() => {
118
- b = 0, g = null, G(() => K(t, i));
117
+ h && g && g.cancelAnimationFrame(h), v && w && w.cancelAnimationFrame(v), v = 0, w = null, h = r.requestAnimationFrame(() => {
118
+ h = 0, g = null, U(() => J(t, i));
119
119
  }), g = r;
120
120
  };
121
- k(() => {
121
+ G(() => {
122
122
  const i = e.retained, t = e.visible, r = e.open;
123
- if (e.anchor, e.mount, e.maxWidth, e.maxHeight, e.viewportPadding, !i) {
124
- X(), l(null), C(!1), y(!1), D(null), H(null), w = null, e.surfaceRef?.(null), e.contentHostRef?.(null), M = !1, L = r;
123
+ if (e.anchor, e.mount, e.expandedWidth, e.maxWidth, e.maxHeight, e.viewportPadding, !i) {
124
+ j(), l(null), R(!1), E(!1), A(null), N(null), b = null, e.surfaceRef?.(null), e.contentHostRef?.(null), L = !1, M = r;
125
125
  return;
126
126
  }
127
- const n = ne(e.anchor);
128
- if (n && H(n), _(n), !t) {
129
- M = !1, L = r;
127
+ const n = oe(e.anchor);
128
+ if (n && N(n), K(n), !t) {
129
+ L = !1, M = r;
130
130
  return;
131
131
  }
132
- const c = !M, o = L !== r;
133
- M = !0, L = r, j(!c && o, r);
134
- }), k(() => {
132
+ const c = !L, o = M !== r;
133
+ L = !0, M = r, Q(!c && o, r);
134
+ }), G(() => {
135
135
  if (!e.retained) return;
136
136
  const i = e.anchor, t = a(), r = e.mount, n = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set();
137
137
  for (const s of [i, t, r]) {
138
138
  if (!s) continue;
139
139
  n.add(s.ownerDocument);
140
- const f = s.ownerDocument.defaultView;
141
- f && c.add(f);
140
+ const d = s.ownerDocument.defaultView;
141
+ d && c.add(d);
142
142
  }
143
143
  if (c.size === 0 || n.size === 0) return;
144
- const o = () => j(!1, G(() => e.open)), u = [];
144
+ const o = () => Q(!1, U(() => e.open)), u = [];
145
145
  for (const s of /* @__PURE__ */ new Set([i, t, r])) {
146
- const f = s?.ownerDocument.defaultView;
147
- if (!s || !f || typeof f.ResizeObserver != "function") continue;
148
- const A = new f.ResizeObserver(o);
149
- A.observe(s), u.push(A);
146
+ const d = s?.ownerDocument.defaultView;
147
+ if (!s || !d || typeof d.ResizeObserver != "function") continue;
148
+ const y = new d.ResizeObserver(o);
149
+ y.observe(s), u.push(y);
150
150
  }
151
- let S = i?.isConnected ?? !1, T = t?.isConnected ?? !1, I = r?.isConnected ?? !1;
151
+ let T = i?.isConnected ?? !1, W = t?.isConnected ?? !1, I = r?.isConnected ?? !1;
152
152
  const O = [];
153
153
  for (const s of n) {
154
- const f = s.defaultView;
155
- if (!f || typeof f.MutationObserver != "function" || !s.documentElement) continue;
156
- const A = new f.MutationObserver(() => {
157
- const J = i?.isConnected ?? !1, Q = t?.isConnected ?? !1, Y = r?.isConnected ?? !1;
158
- S === J && T === Q && I === Y || (S = J, T = Q, I = Y, G(o));
154
+ const d = s.defaultView;
155
+ if (!d || typeof d.MutationObserver != "function" || !s.documentElement) continue;
156
+ const y = new d.MutationObserver(() => {
157
+ const Y = i?.isConnected ?? !1, Z = t?.isConnected ?? !1, $ = r?.isConnected ?? !1;
158
+ T === Y && W === Z && I === $ || (T = Y, W = Z, I = $, U(o));
159
159
  });
160
- A.observe(s.documentElement, {
160
+ y.observe(s.documentElement, {
161
161
  childList: !0,
162
162
  subtree: !0
163
- }), O.push(A);
163
+ }), O.push(y);
164
164
  }
165
165
  for (const s of c)
166
166
  s.addEventListener("resize", o), s.visualViewport?.addEventListener("resize", o), s.visualViewport?.addEventListener("scroll", o);
167
- U(() => {
167
+ _(() => {
168
168
  for (const s of u) s.disconnect();
169
169
  for (const s of O) s.disconnect();
170
170
  for (const s of c)
171
171
  s.removeEventListener("resize", o), s.visualViewport?.removeEventListener("resize", o), s.visualViewport?.removeEventListener("scroll", o);
172
172
  });
173
- }), k(() => {
174
- if (!e.retained || !e.visible || !e.open || !m() || !F() || !v()) return;
173
+ }), G(() => {
174
+ if (!e.retained || !e.visible || !e.open || !m() || !F() || !f()) return;
175
175
  const t = a()?.ownerDocument;
176
176
  if (!t) return;
177
177
  const r = (o) => {
178
178
  const u = typeof o.composedPath == "function" ? o.composedPath() : [];
179
- return w && u.includes(w) || e.anchor && u.includes(e.anchor) ? !0 : e.isOwnedInteraction?.(o) ?? !1;
179
+ return b && u.includes(b) || e.anchor && u.includes(e.anchor) ? !0 : e.isOwnedInteraction?.(o) ?? !1;
180
180
  }, n = (o) => {
181
181
  r(o) || e.onDismiss?.("outside-pointer");
182
182
  }, c = (o) => {
183
183
  if (o.key !== "Escape" || o.defaultPrevented || o.isComposing || o.keyCode === 229) return;
184
184
  const u = t.activeElement;
185
- !w?.contains(u) && !e.isOwnedInteraction?.(o) || (o.preventDefault(), e.onDismiss?.("escape"));
185
+ !b?.contains(u) && !e.isOwnedInteraction?.(o) || (o.preventDefault(), e.onDismiss?.("escape"));
186
186
  };
187
- t.addEventListener("pointerdown", n, !0), t.addEventListener("keydown", c), U(() => {
187
+ t.addEventListener("pointerdown", n, !0), t.addEventListener("keydown", c), _(() => {
188
188
  t.removeEventListener("pointerdown", n, !0), t.removeEventListener("keydown", c);
189
189
  });
190
- }), U(() => {
191
- X(), e.surfaceRef?.(null), e.contentHostRef?.(null);
190
+ }), _(() => {
191
+ j(), e.surfaceRef?.(null), e.contentHostRef?.(null);
192
192
  });
193
193
  const re = (i) => {
194
- w = i, e.surfaceRef?.(i);
194
+ b = i, e.surfaceRef?.(i);
195
195
  }, ae = (i) => {
196
196
  e.contentHostRef?.(i);
197
197
  }, se = (i) => {
198
- if (i.target !== w || i.propertyName !== P) return;
198
+ if (i.target !== b || i.propertyName !== C) return;
199
199
  const t = e.open ? "expanding" : "collapsing";
200
- E() === t && (P = null, V(e.open ? "expanded" : "collapsed"));
200
+ H() === t && (C = null, D(e.open ? "expanded" : "collapsed"));
201
201
  };
202
- return Z(he, {
202
+ return p(he, {
203
203
  get when() {
204
204
  return fe(() => !!e.retained)() && a();
205
205
  },
206
- children: (i) => Z(ce, {
206
+ children: (i) => p(ce, {
207
207
  get mount() {
208
208
  return i();
209
209
  },
210
210
  get children() {
211
211
  var t = ve(), r = t.firstChild;
212
- return t.addEventListener("transitionend", se), $((n) => re(n), t), $((n) => ae(n), r), le(r, () => e.children), ue((n) => {
213
- var c = e.id, o = e.label, u = !e.visible || !m() || !F() || !v() ? "true" : void 0, S = !e.visible || !m() || !F() || !v(), T = ee("floe-bottom-bar-companion", e.class), I = E(), O = e.visible && m() && F() ? "visible" : "hidden", s = v() ? "true" : "false", f = Ae(v()), A = ee("floe-bottom-bar-companion__content", e.contentClass);
214
- return c !== n.e && R(t, "id", n.e = c), o !== n.t && R(t, "aria-label", n.t = o), u !== n.a && R(t, "aria-hidden", n.a = u), S !== n.o && (t.inert = n.o = S), T !== n.i && p(t, n.i = T), I !== n.n && R(t, "data-companion-phase", n.n = I), O !== n.s && R(t, "data-companion-visibility", n.s = O), s !== n.h && R(t, "data-companion-frame-ready", n.h = s), n.r = de(t, f, n.r), A !== n.d && p(r, n.d = A), n;
212
+ return t.addEventListener("transitionend", se), ee((n) => re(n), t), ee((n) => ae(n), r), le(r, () => e.children), ue((n) => {
213
+ var c = e.id, o = e.label, u = !e.visible || !m() || !F() || !f() ? "true" : void 0, T = !e.visible || !m() || !F() || !f(), W = ne("floe-bottom-bar-companion", e.class), I = H(), O = e.visible && m() && F() ? "visible" : "hidden", s = f() ? "true" : "false", d = Ae(f()), y = ne("floe-bottom-bar-companion__content", e.contentClass);
214
+ return c !== n.e && V(t, "id", n.e = c), o !== n.t && V(t, "aria-label", n.t = o), u !== n.a && V(t, "aria-hidden", n.a = u), T !== n.o && (t.inert = n.o = T), W !== n.i && te(t, n.i = W), I !== n.n && V(t, "data-companion-phase", n.n = I), O !== n.s && V(t, "data-companion-visibility", n.s = O), s !== n.h && V(t, "data-companion-frame-ready", n.h = s), n.r = de(t, d, n.r), y !== n.d && te(r, n.d = y), n;
215
215
  }, {
216
216
  e: void 0,
217
217
  t: void 0,
@@ -21,6 +21,7 @@ export type ResolvedSurfacePortalHost = ResolvedDialogSurfaceHost;
21
21
  export type SurfacePortalBoundaryRect = SurfacePortalRect;
22
22
  export type { SurfacePortalRect };
23
23
  export type SurfacePortalHostResolutionOptions = Readonly<{
24
+ /** A supplied owner fixes scope, including when it belongs to the global surface. */
24
25
  owner?: Element | null;
25
26
  }>;
26
27
  export declare function ensureDialogSurfaceInteractionTracking(): void;
@@ -44,7 +44,7 @@ function v(t) {
44
44
  }
45
45
  function C(t = {}) {
46
46
  p();
47
- const e = A(), n = l(t.owner ?? null) ?? l(e?.target ?? null) ?? l(e?.activeElement ?? null);
47
+ const e = A(), n = t.owner ? l(t.owner) : l(e?.target ?? null) ?? l(e?.activeElement ?? null);
48
48
  return n ? {
49
49
  host: n,
50
50
  boundaryHost: n,
package/dist/floe.css CHANGED
@@ -735,15 +735,15 @@
735
735
  pointer-events: auto;
736
736
  transform-origin: bottom center;
737
737
  transition:
738
- left 240ms cubic-bezier(0.22, 1, 0.36, 1),
739
- top 240ms cubic-bezier(0.22, 1, 0.36, 1),
740
- width 240ms cubic-bezier(0.22, 1, 0.36, 1),
741
- height 240ms cubic-bezier(0.22, 1, 0.36, 1),
738
+ left 360ms cubic-bezier(0.22, 0.8, 0.24, 1),
739
+ top 360ms cubic-bezier(0.22, 0.8, 0.24, 1),
740
+ width 360ms cubic-bezier(0.22, 0.8, 0.24, 1),
741
+ height 360ms cubic-bezier(0.22, 0.8, 0.24, 1),
742
742
  border-radius 200ms ease,
743
743
  border-color 180ms ease,
744
+ background-color 200ms ease,
744
745
  box-shadow 200ms ease,
745
746
  opacity 120ms ease;
746
- will-change: left, top, width, height;
747
747
  }
748
748
 
749
749
  .floe-bottom-bar-companion[data-companion-phase='expanding'],
@@ -755,8 +755,9 @@
755
755
  0 6px 18px -12px color-mix(in srgb, var(--foreground) 24%, transparent);
756
756
  }
757
757
 
758
+ .floe-bottom-bar-companion[data-companion-phase='expanding'],
758
759
  .floe-bottom-bar-companion[data-companion-phase='collapsing'] {
759
- transition-duration: 180ms, 180ms, 180ms, 180ms, 160ms, 140ms, 160ms, 100ms;
760
+ will-change: left, top, width, height;
760
761
  }
761
762
 
762
763
  .floe-bottom-bar-companion[data-companion-visibility='hidden'],