@floegence/floe-webapp-core 0.92.0 → 0.93.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.
@@ -62,5 +62,7 @@ export interface PromptCardProps {
62
62
  class?: string;
63
63
  zIndex?: number;
64
64
  }
65
+ /** Capture the initiating control before a menu closes or asynchronous work starts. */
66
+ export declare function capturePromptCardAnchor(owner?: Element | null): PromptCardProps['anchor'];
65
67
  /** A short contextual input. The host owns the draft and asynchronous result. */
66
68
  export declare function PromptCard(props: PromptCardProps): JSX.Element;
@@ -1,97 +1,108 @@
1
- import { createComponent as u, Portal as xe, use as J, setAttribute as x, insert as c, spread as ye, mergeProps as we, effect as N, setStyleProperty as S, className as Ce, template as $, delegateEvents as Se } from "solid-js/web";
2
- import { createUniqueId as Me, createSignal as z, onCleanup as Z, createMemo as F, createEffect as W, untrack as p, Show as M } from "solid-js";
1
+ import { createComponent as u, Portal as we, use as ee, setAttribute as x, insert as c, spread as Ce, mergeProps as Se, effect as X, setStyleProperty as M, className as Me, template as D, delegateEvents as Ee } from "solid-js/web";
2
+ import { createUniqueId as Pe, createSignal as z, onCleanup as te, createMemo as F, untrack as K, createEffect as U, Show as E } from "solid-js";
3
3
  import { useOverlayMask as ke } from "../../hooks/useOverlayMask.js";
4
- import { deferAfterPaint as de } from "../../utils/defer.js";
5
- import { ensureSurfacePortalInteractionTracking as Pe, resolveSurfacePortalHost as $e, resolveSurfacePortalScale as Ee, resolveSurfacePortalBoundaryRect as De, projectSurfacePortalPosition as Le, readFreshInteractionSnapshot as Ae, resolveSurfacePortalMount as Te, isSurfacePortalMode as Oe } from "./dialogSurfaceScope.js";
6
- import { cn as ue } from "../../utils/cn.js";
4
+ import { deferAfterPaint as ue } from "../../utils/defer.js";
5
+ import { ensureSurfacePortalInteractionTracking as me, resolveSurfacePortalHost as $e, resolveSurfacePortalScale as De, resolveSurfacePortalBoundaryRect as Ae, projectSurfacePortalPosition as Le, readFreshInteractionSnapshot as he, resolveSurfacePortalMount as Te, isSurfacePortalMode as Oe } from "./dialogSurfaceScope.js";
6
+ import { cn as fe } from "../../utils/cn.js";
7
7
  import { readViewportSnapshot as Ie, observeViewport as ze } from "../../viewport.js";
8
8
  import { X as Fe, Plus as Be, ArrowUp as He } from "../icons/index.js";
9
- import { Button as ee } from "./Button.js";
9
+ import { Button as ne } from "./Button.js";
10
10
  import { Select as qe } from "./Select.js";
11
11
  import { createFloatingPresence as Re } from "./floatingPresence.js";
12
- var Ve = /* @__PURE__ */ $("<span class=floe-prompt-card-icon aria-hidden=true>"), _e = /* @__PURE__ */ $("<div class=floe-prompt-card-question>"), Ne = /* @__PURE__ */ $("<div class=floe-prompt-card-references>"), We = /* @__PURE__ */ $("<input type=file multiple hidden tabindex=-1>"), Xe = /* @__PURE__ */ $("<div class=floe-prompt-card-feedback>"), Ke = /* @__PURE__ */ $("<div class=floe-prompt-card-positioner><div role=dialog aria-modal=false tabindex=-1 data-floe-prompt-card data-floe-input-surface data-floe-surface=floating data-floe-local-interaction-surface=true><header class=floe-prompt-card-header><h2></h2></header><div><div class=floe-prompt-card-composer><div class=floe-prompt-card-field><textarea class=floe-prompt-card-input rows=2></textarea></div><div class=floe-prompt-card-actions><div class=floe-prompt-card-tools>");
13
- function at(t) {
14
- Pe();
15
- const te = Me(), [fe, ne] = z(!1), [me, ae] = z(!1), l = () => t.busy || fe();
16
- let X = !1;
17
- Z(() => {
18
- X = !0;
12
+ var Ve = /* @__PURE__ */ D("<span class=floe-prompt-card-icon aria-hidden=true>"), _e = /* @__PURE__ */ D("<div class=floe-prompt-card-question>"), Ne = /* @__PURE__ */ D("<div class=floe-prompt-card-references>"), We = /* @__PURE__ */ D("<input type=file multiple hidden tabindex=-1>"), Xe = /* @__PURE__ */ D("<div class=floe-prompt-card-feedback>"), Ke = /* @__PURE__ */ D("<div class=floe-prompt-card-positioner><div role=dialog aria-modal=false tabindex=-1 data-floe-prompt-card data-floe-input-surface data-floe-surface=floating data-floe-local-interaction-surface=true><header class=floe-prompt-card-header><h2></h2></header><div><div class=floe-prompt-card-composer><div class=floe-prompt-card-field><textarea class=floe-prompt-card-input rows=2></textarea></div><div class=floe-prompt-card-actions><div class=floe-prompt-card-tools>");
13
+ function Ue(t) {
14
+ if (typeof document > "u") return null;
15
+ me();
16
+ const y = t ?? he()?.target ?? document.activeElement;
17
+ if (!y?.isConnected || y === document.body || y === document.documentElement) return null;
18
+ const P = y.getBoundingClientRect();
19
+ return P.width > 0 && P.height > 0 ? {
20
+ x: P.left,
21
+ y: P.bottom
22
+ } : null;
23
+ }
24
+ function it(t) {
25
+ me();
26
+ const y = Pe(), [P, ae] = z(!1), [ge, ie] = z(!1), l = () => t.busy || P();
27
+ let j = !1;
28
+ te(() => {
29
+ j = !0;
19
30
  });
20
- const [g, he] = z(Ie(window)), [E, ge] = z(), [K, ve] = z({
31
+ const [g, ve] = z(Ie(window)), [A, be] = z(), [Q, xe] = z({
21
32
  width: 0,
22
33
  height: 0
23
- }), be = F((n) => t.open ? t.anchor : n), y = Re({
34
+ }), ye = F((n) => t.open ? t.anchor ?? K(() => Ue(t.owner)) : n), w = Re({
24
35
  open: () => t.open,
25
- element: E
36
+ element: A
26
37
  });
27
- let v, U, D = !1, j, B;
28
- const Q = () => queueMicrotask(() => {
29
- !X && t.open && !l() && !t.inputDisabled && v?.isConnected && v.focus({
38
+ let v, Y, L = !1, p, B;
39
+ const G = () => queueMicrotask(() => {
40
+ !j && t.open && !l() && !t.inputDisabled && v?.isConnected && v.focus({
30
41
  preventScroll: !0
31
42
  });
32
- }), Y = (n) => {
33
- t.open && !l() && !t.inputDisabled && n.length && (t.attachment?.onFiles(n), Q());
43
+ }), J = (n) => {
44
+ t.open && !l() && !t.inputDisabled && n.length && (t.attachment?.onFiles(n), G());
34
45
  };
35
- W(() => {
36
- (!t.open || l() || t.inputDisabled) && ae(!1);
46
+ U(() => {
47
+ (!t.open || l() || t.inputDisabled) && ie(!1);
37
48
  });
38
- const L = F(() => !y.mounted() || t.portalScope === "viewport" ? {
49
+ const T = F(() => !w.mounted() || t.portalScope === "viewport" ? {
39
50
  host: null,
40
51
  boundaryHost: null,
41
52
  mountHost: null,
42
53
  mode: "global"
43
54
  } : $e({
44
55
  owner: t.owner
45
- })), H = () => Oe(L()), A = F(() => (g(), K(), H() ? Ee(L()) : {
56
+ })), H = () => Oe(T()), O = F(() => (g(), Q(), H() ? De(T()) : {
46
57
  x: g().fixedScale,
47
58
  y: g().fixedScale
48
59
  }));
49
- W(() => {
50
- y.mounted() && Z(ze(window, he));
51
- }), W(() => {
52
- const n = E();
53
- if (!y.mounted() || !n) return;
54
- const i = () => ve((s) => {
60
+ U(() => {
61
+ w.mounted() && te(ze(window, ve));
62
+ }), U(() => {
63
+ const n = A();
64
+ if (!w.mounted() || !n) return;
65
+ const i = () => xe((s) => {
55
66
  const f = n.offsetWidth, d = n.offsetHeight;
56
67
  return s.width === f && s.height === d ? s : {
57
68
  width: f,
58
69
  height: d
59
70
  };
60
71
  }), r = new ResizeObserver(i);
61
- r.observe(n), i(), Z(() => r.disconnect());
72
+ r.observe(n), i(), te(() => r.disconnect());
62
73
  });
63
- const w = F(() => {
64
- const n = g(), i = H() ? De(L()) : n.visible, r = n.visible.width < 640 ? 8 : 12, s = t.viewportInsets, f = Math.max(n.visible.left, i.left) + Math.max(n.safeArea.left, s?.left ?? 0) + r, d = Math.max(n.visible.top, i.top) + Math.max(n.safeArea.top, s?.top ?? 0) + r, k = Math.min(n.visible.right, i.right) - Math.max(n.safeArea.right, s?.right ?? 0) - r, o = Math.min(n.visible.bottom, i.bottom) - Math.max(n.safeArea.bottom, s?.bottom ?? 0) - r, P = Math.max(0, k - f), C = Math.min(K().width * A().x, P), e = Math.max(0, o - d), m = Math.min(K().height * A().y, e), a = be(), h = (R, V, _) => Math.max(V, Math.min(R, _)), b = h(a ? a.x + 8 : f + (P - C) / 2, f, k - C), T = !a || a.y + 8 + m <= o, O = a ? T ? a.y + 8 : a.y - m - 8 : d + Math.max(0, (e - m) * 0.32), I = h(O, d, o - m);
74
+ const C = F(() => {
75
+ const n = g(), i = H() ? Ae(T()) : n.visible, r = n.visible.width < 640 ? 8 : 12, s = t.viewportInsets, f = Math.max(n.visible.left, i.left) + Math.max(n.safeArea.left, s?.left ?? 0) + r, d = Math.max(n.visible.top, i.top) + Math.max(n.safeArea.top, s?.top ?? 0) + r, k = Math.min(n.visible.right, i.right) - Math.max(n.safeArea.right, s?.right ?? 0) - r, o = Math.min(n.visible.bottom, i.bottom) - Math.max(n.safeArea.bottom, s?.bottom ?? 0) - r, $ = Math.max(0, k - f), S = Math.min(Q().width * O().x, $), e = Math.max(0, o - d), m = Math.min(Q().height * O().y, e), a = ye(), h = (_, N, W) => Math.max(N, Math.min(_, W)), b = h(a ? a.x + 8 : f + ($ - S) / 2, f, k - S), I = !a || a.y + 8 + m <= o, R = a ? I ? a.y + 8 : a.y - m - 8 : d + Math.max(0, (e - m) * 0.32), V = h(R, d, o - m);
65
76
  return {
66
77
  x: b,
67
- y: I,
68
- availableWidth: P,
78
+ y: V,
79
+ availableWidth: $,
69
80
  maxHeight: e,
70
- side: !a || I !== O ? "edge" : T ? "bottom" : "top",
71
- originX: a ? h(a.x - b, 16, C - 16) : C / 2
81
+ side: a ? I ? "bottom" : "top" : "edge",
82
+ originX: a ? h(a.x - b, 16, S - 16) : S / 2
72
83
  };
73
- }), ie = F(() => H() ? Le(w(), L()) : {
74
- x: (w().x + g().fixedOffset.left) / g().fixedScale,
75
- y: (w().y + g().fixedOffset.top) / g().fixedScale
84
+ }), re = F(() => H() ? Le(C(), T()) : {
85
+ x: (C().x + g().fixedOffset.left) / g().fixedScale,
86
+ y: (C().y + g().fixedOffset.top) / g().fixedScale
76
87
  }), q = (n) => {
77
- l() || !t.open || D || (t.onClose(), n && de(() => p(() => {
78
- !t.open && U?.isConnected && U.focus({
88
+ l() || !t.open || L || (t.onClose(), n && ue(() => K(() => {
89
+ !t.open && Y?.isConnected && Y.focus({
79
90
  preventScroll: !0
80
91
  });
81
92
  })));
82
93
  };
83
- W(() => {
94
+ U(() => {
84
95
  if (!t.open) return;
85
- const n = document.activeElement, r = t.owner ?? Ae()?.target?.closest("button, a[href], input, [tabindex]") ?? (n instanceof HTMLElement && n !== document.body ? n : void 0);
86
- r && !p(E)?.contains(r) && !t.containsTarget?.(r) && (U = r), queueMicrotask(() => {
96
+ const n = document.activeElement, r = t.owner ?? he()?.target?.closest("button, a[href], input, [tabindex]") ?? (n instanceof HTMLElement && n !== document.body ? n : void 0);
97
+ r && !K(A)?.contains(r) && !t.containsTarget?.(r) && (Y = r), queueMicrotask(() => {
87
98
  !t.open || t.autoFocus === !1 || !v?.isConnected || (v.focus({
88
99
  preventScroll: !0
89
100
  }), v.setSelectionRange(v.value.length, v.value.length));
90
101
  });
91
102
  }), ke({
92
103
  open: () => t.open,
93
- root: E,
94
- containsTarget: (n) => !!(n instanceof Node && E()?.contains(n)) || !!t.containsTarget?.(n) || !!(n instanceof Node && document.getElementById(B?.getAttribute("aria-controls") ?? "")?.parentElement?.contains(n)),
104
+ root: A,
105
+ containsTarget: (n) => !!(n instanceof Node && A()?.contains(n)) || !!t.containsTarget?.(n) || !!(n instanceof Node && document.getElementById(B?.getAttribute("aria-controls") ?? "")?.parentElement?.contains(n)),
95
106
  onClose: () => q(!0),
96
107
  onInteractOutside: (n) => {
97
108
  n.type === "pointerdown" && q(!1);
@@ -105,30 +116,30 @@ function at(t) {
105
116
  restoreFocus: !1,
106
117
  blockHotkeys: !1
107
118
  });
108
- const re = () => {
109
- !t.open || l() || t.submitDisabled || (ne(!0), de(() => p(() => {
110
- if (!X)
119
+ const oe = () => {
120
+ !t.open || l() || t.submitDisabled || (ae(!0), ue(() => K(() => {
121
+ if (!j)
111
122
  try {
112
123
  t.open && t.onSubmit();
113
124
  } finally {
114
- ne(!1);
125
+ ae(!1);
115
126
  }
116
127
  })));
117
128
  };
118
- return u(M, {
129
+ return u(E, {
119
130
  get when() {
120
- return y.mounted();
131
+ return w.mounted();
121
132
  },
122
133
  get children() {
123
- return u(xe, {
134
+ return u(we, {
124
135
  get mount() {
125
- return Te(L());
136
+ return Te(T());
126
137
  },
127
138
  get children() {
128
- var n = Ke(), i = n.firstChild, r = i.firstChild, s = r.firstChild, f = r.nextSibling, d = f.firstChild, k = d.firstChild, o = k.firstChild, P = k.nextSibling, C = P.firstChild;
139
+ var n = Ke(), i = n.firstChild, r = i.firstChild, s = r.firstChild, f = r.nextSibling, d = f.firstChild, k = d.firstChild, o = k.firstChild, $ = k.nextSibling, S = $.firstChild;
129
140
  return i.$$keydown = (e) => {
130
- e.key !== "Escape" || e.defaultPrevented || e.isComposing || D || B?.getAttribute("aria-expanded") === "true" && B.contains(e.target) || (e.preventDefault(), e.stopPropagation(), q(!0));
131
- }, i.$$focusin = () => t.onActivate?.(), i.$$pointerdown = () => t.onActivate?.(), J(ge, i), x(i, "aria-labelledby", te), c(r, u(M, {
141
+ e.key !== "Escape" || e.defaultPrevented || e.isComposing || L || B?.getAttribute("aria-expanded") === "true" && B.contains(e.target) || (e.preventDefault(), e.stopPropagation(), q(!0));
142
+ }, i.$$focusin = () => t.onActivate?.(), i.$$pointerdown = () => t.onActivate?.(), ee(be, i), x(i, "aria-labelledby", y), c(r, u(E, {
132
143
  get when() {
133
144
  return t.icon;
134
145
  },
@@ -136,7 +147,7 @@ function at(t) {
136
147
  var e = Ve();
137
148
  return c(e, () => t.icon), e;
138
149
  }
139
- }), s), x(s, "id", te), c(s, () => t.title), c(r, u(ee, {
150
+ }), s), x(s, "id", y), c(s, () => t.title), c(r, u(ne, {
140
151
  variant: "ghost",
141
152
  size: "icon",
142
153
  icon: Fe,
@@ -151,11 +162,11 @@ function at(t) {
151
162
  return t.closeLabel;
152
163
  },
153
164
  onClick: () => q(!0)
154
- }), null), ye(f, we(() => t.bodyProps, {
165
+ }), null), Ce(f, Se(() => t.bodyProps, {
155
166
  get class() {
156
- return ue("floe-prompt-card-body", t.bodyProps?.class);
167
+ return fe("floe-prompt-card-body", t.bodyProps?.class);
157
168
  }
158
- }), !1, !0), c(f, u(M, {
169
+ }), !1, !0), c(f, u(E, {
159
170
  get when() {
160
171
  return t.question;
161
172
  },
@@ -164,28 +175,28 @@ function at(t) {
164
175
  return c(e, () => t.question), e;
165
176
  }
166
177
  }), d), d.addEventListener("drop", (e) => {
167
- !t.attachment || !e.dataTransfer?.files.length || (e.preventDefault(), Y(Array.from(e.dataTransfer.files)));
178
+ !t.attachment || !e.dataTransfer?.files.length || (e.preventDefault(), J(Array.from(e.dataTransfer.files)));
168
179
  }), d.addEventListener("dragover", (e) => {
169
180
  t.attachment && !l() && !t.inputDisabled && e.dataTransfer?.types.includes("Files") && e.preventDefault();
170
- }), c(d, u(M, {
181
+ }), c(d, u(E, {
171
182
  get when() {
172
183
  return t.references;
173
184
  },
174
185
  get children() {
175
186
  var e = Ne();
176
- return c(e, () => t.references), N(() => e.inert = !!l()), e;
187
+ return c(e, () => t.references), X(() => e.inert = !!l()), e;
177
188
  }
178
189
  }), k), o.$$keydown = (e) => {
179
- e.key === "Enter" && !e.shiftKey && !e.isComposing && !D && (e.preventDefault(), re());
190
+ e.key === "Enter" && !e.shiftKey && !e.isComposing && !L && (e.preventDefault(), oe());
180
191
  }, o.addEventListener("compositionend", (e) => {
181
- D = !1, t.onValueChange(e.currentTarget.value);
192
+ L = !1, t.onValueChange(e.currentTarget.value);
182
193
  }), o.addEventListener("compositionupdate", (e) => t.onValueChange(e.currentTarget.value)), o.addEventListener("compositionstart", () => {
183
- D = !0;
194
+ L = !0;
184
195
  }), o.$$input = (e) => t.onValueChange(e.currentTarget.value), o.addEventListener("paste", (e) => {
185
- !t.attachment || !e.clipboardData?.files.length || (e.preventDefault(), Y(Array.from(e.clipboardData.files)));
186
- }), J((e) => {
196
+ !t.attachment || !e.clipboardData?.files.length || (e.preventDefault(), J(Array.from(e.clipboardData.files)));
197
+ }), ee((e) => {
187
198
  v = e, t.editorRef?.(e);
188
- }, o), c(C, u(M, {
199
+ }, o), c(S, u(E, {
189
200
  get when() {
190
201
  return t.attachment;
191
202
  },
@@ -193,17 +204,17 @@ function at(t) {
193
204
  return [(() => {
194
205
  var e = We();
195
206
  e.addEventListener("change", (a) => {
196
- Y(Array.from(a.currentTarget.files ?? [])), a.currentTarget.value = "";
197
- }), e.addEventListener("cancel", Q);
198
- var m = j;
199
- return typeof m == "function" ? J(m, e) : j = e, N((a) => {
207
+ J(Array.from(a.currentTarget.files ?? [])), a.currentTarget.value = "";
208
+ }), e.addEventListener("cancel", G);
209
+ var m = p;
210
+ return typeof m == "function" ? ee(m, e) : p = e, X((a) => {
200
211
  var h = t.attachment?.accept, b = l() || t.inputDisabled;
201
212
  return h !== a.e && x(e, "accept", a.e = h), b !== a.t && (e.disabled = a.t = b), a;
202
213
  }, {
203
214
  e: void 0,
204
215
  t: void 0
205
216
  }), e;
206
- })(), u(ee, {
217
+ })(), u(ne, {
207
218
  variant: "ghost",
208
219
  size: "icon",
209
220
  icon: Be,
@@ -217,10 +228,10 @@ function at(t) {
217
228
  get title() {
218
229
  return t.attachment?.label;
219
230
  },
220
- onClick: () => j?.click()
231
+ onClick: () => p?.click()
221
232
  })];
222
233
  }
223
- }), null), c(C, u(M, {
234
+ }), null), c(S, u(E, {
224
235
  get when() {
225
236
  return t.selection;
226
237
  },
@@ -231,10 +242,10 @@ function at(t) {
231
242
  },
232
243
  class: "floe-prompt-card-selection",
233
244
  get open() {
234
- return me();
245
+ return ge();
235
246
  },
236
- onOpenChange: ae,
237
- onOptionSelect: Q,
247
+ onOpenChange: ie,
248
+ onOptionSelect: G,
238
249
  get zIndex() {
239
250
  return (t.zIndex ?? 100) + 1;
240
251
  },
@@ -274,7 +285,7 @@ function at(t) {
274
285
  }
275
286
  });
276
287
  }
277
- }), null), c(P, u(ee, {
288
+ }), null), c($, u(ne, {
278
289
  variant: "primary",
279
290
  size: "icon",
280
291
  icon: He,
@@ -294,8 +305,8 @@ function at(t) {
294
305
  get "aria-label"() {
295
306
  return t.submitLabel;
296
307
  },
297
- onClick: re
298
- }), null), c(f, u(M, {
308
+ onClick: oe
309
+ }), null), c(f, u(E, {
299
310
  get when() {
300
311
  return t.feedback;
301
312
  },
@@ -303,9 +314,9 @@ function at(t) {
303
314
  var e = Xe();
304
315
  return c(e, () => t.feedback), e;
305
316
  }
306
- }), null), N((e) => {
307
- var m = H() ? "absolute" : "fixed", a = `${ie().x}px`, h = `${ie().y}px`, b = `${w().availableWidth / A().x}px`, T = `${w().maxHeight / A().y}px`, O = `${w().originX / A().x}px`, I = t.zIndex ?? 100, G = ue("floe-prompt-card floe-floating-presence", t.class), R = w().side, V = y.state(), _ = y.exiting(), oe = y.exiting() ? "true" : void 0, le = t.inputLabel, ce = t.placeholder, se = l() || t.inputDisabled;
308
- return m !== e.e && S(n, "position", e.e = m), a !== e.t && S(n, "left", e.t = a), h !== e.a && S(n, "top", e.a = h), b !== e.o && S(n, "--floe-prompt-max-width", e.o = b), T !== e.i && S(n, "--floe-prompt-max-height", e.i = T), O !== e.n && S(n, "--floe-prompt-origin-x", e.n = O), I !== e.s && S(n, "z-index", e.s = I), G !== e.h && Ce(i, e.h = G), R !== e.r && x(i, "data-floating-side", e.r = R), V !== e.d && x(i, "data-floating-presence", e.d = V), _ !== e.l && (i.inert = e.l = _), oe !== e.u && x(i, "aria-hidden", e.u = oe), le !== e.c && x(o, "aria-label", e.c = le), ce !== e.w && x(o, "placeholder", e.w = ce), se !== e.m && (o.disabled = e.m = se), e;
317
+ }), null), X((e) => {
318
+ var m = H() ? "absolute" : "fixed", a = `${re().x}px`, h = `${re().y}px`, b = `${C().availableWidth / O().x}px`, I = `${C().maxHeight / O().y}px`, R = `${C().originX / O().x}px`, V = t.zIndex ?? 100, Z = fe("floe-prompt-card floe-floating-presence", t.class), _ = C().side, N = w.state(), W = w.exiting(), le = w.exiting() ? "true" : void 0, ce = t.inputLabel, se = t.placeholder, de = l() || t.inputDisabled;
319
+ return m !== e.e && M(n, "position", e.e = m), a !== e.t && M(n, "left", e.t = a), h !== e.a && M(n, "top", e.a = h), b !== e.o && M(n, "--floe-prompt-max-width", e.o = b), I !== e.i && M(n, "--floe-prompt-max-height", e.i = I), R !== e.n && M(n, "--floe-prompt-origin-x", e.n = R), V !== e.s && M(n, "z-index", e.s = V), Z !== e.h && Me(i, e.h = Z), _ !== e.r && x(i, "data-floating-side", e.r = _), N !== e.d && x(i, "data-floating-presence", e.d = N), W !== e.l && (i.inert = e.l = W), le !== e.u && x(i, "aria-hidden", e.u = le), ce !== e.c && x(o, "aria-label", e.c = ce), se !== e.w && x(o, "placeholder", e.w = se), de !== e.m && (o.disabled = e.m = de), e;
309
320
  }, {
310
321
  e: void 0,
311
322
  t: void 0,
@@ -322,13 +333,14 @@ function at(t) {
322
333
  c: void 0,
323
334
  w: void 0,
324
335
  m: void 0
325
- }), N(() => o.value = t.value), n;
336
+ }), X(() => o.value = t.value), n;
326
337
  }
327
338
  });
328
339
  }
329
340
  });
330
341
  }
331
- Se(["pointerdown", "focusin", "keydown", "input"]);
342
+ Ee(["pointerdown", "focusin", "keydown", "input"]);
332
343
  export {
333
- at as PromptCard
344
+ it as PromptCard,
345
+ Ue as capturePromptCardAnchor
334
346
  };
@@ -1,10 +1,10 @@
1
- import { createMemo as q, untrack as u, createSignal as P, createEffect as w, onCleanup as A } from "solid-js";
1
+ import { createMemo as q, untrack as f, createSignal as L, createEffect as w, onCleanup as A } from "solid-js";
2
2
  const O = 120;
3
- function v() {
3
+ function N() {
4
4
  const e = globalThis.matchMedia;
5
5
  return typeof e != "function" ? !1 : e.call(globalThis, "(prefers-reduced-motion: reduce)").matches;
6
6
  }
7
- function p(e) {
7
+ function d(e) {
8
8
  const t = globalThis.requestAnimationFrame;
9
9
  return typeof t == "function" ? t.call(globalThis, e) : globalThis.setTimeout(e, 16);
10
10
  }
@@ -25,77 +25,82 @@ function W(e) {
25
25
  function _(e) {
26
26
  const t = globalThis.getComputedStyle;
27
27
  if (!e || typeof t != "function") return null;
28
- const i = t.call(globalThis, e), c = i.transitionDuration.split(","), a = { properties: /* @__PURE__ */ new Set(), longestMs: 0 };
29
- return i.transitionProperty.split(",").forEach((f, l) => {
30
- const n = f.trim();
28
+ const i = t.call(globalThis, e), c = i.transitionDuration.split(","), l = { properties: /* @__PURE__ */ new Set(), longestMs: 0 };
29
+ return i.transitionProperty.split(",").forEach((m, a) => {
30
+ const n = m.trim();
31
31
  if (n === "" || n === "none") return;
32
- const r = W(c[l % c.length] ?? "0s");
33
- r === null || r <= 1 || (a.properties.add(n), a.longestMs = Math.max(a.longestMs, r));
34
- }), a.properties.size > 0 ? a : null;
32
+ const r = W(c[a % c.length] ?? "0s");
33
+ r === null || r <= 1 || (l.properties.add(n), l.longestMs = Math.max(l.longestMs, r));
34
+ }), l.properties.size > 0 ? l : null;
35
35
  }
36
36
  function z(e) {
37
- const t = q(() => e.open()), i = u(t), [c, a] = P(i), [f, l] = P(i ? "entering" : "exiting");
38
- let n = null, r = null, d = null;
37
+ const t = q(() => e.open()), i = f(t), [c, l] = L(i), [m, a] = L(
38
+ i ? "entering" : "exiting"
39
+ );
40
+ let n = null, r = null, g = null;
39
41
  const h = () => {
40
42
  n !== null && (R(n), n = null);
41
- }, g = () => {
42
- r !== null && (globalThis.clearTimeout(r), r = null), d?.(), d = null;
43
+ }, T = () => {
44
+ r !== null && (globalThis.clearTimeout(r), r = null), g?.(), g = null;
43
45
  };
44
46
  return w(() => {
45
47
  if (t()) {
46
- if (h(), g(), u(c) && u(f) === "exiting") {
47
- l("open");
48
+ if (h(), T(), f(c) && f(m) === "exiting") {
49
+ a("open");
48
50
  return;
49
51
  }
50
- a(!0), l("entering"), n = p(() => {
51
- n = null, u(t) && l("open");
52
+ l(!0), a("entering"), n = d(() => {
53
+ if (n = null, f(t)) {
54
+ const u = e.element?.();
55
+ u?.isConnected && globalThis.getComputedStyle?.(u).opacity, a("open");
56
+ }
52
57
  });
53
58
  return;
54
59
  }
55
- if (h(), !u(c)) {
56
- l("exiting");
60
+ if (h(), !f(c)) {
61
+ a("exiting");
57
62
  return;
58
63
  }
59
- l("exiting");
60
- const T = () => {
61
- n = null, g(), u(t) || a(!1);
62
- }, o = e.element?.(), x = v() ? null : _(o);
63
- if (o && x) {
64
- const b = /* @__PURE__ */ new Set(), E = /* @__PURE__ */ new Set();
64
+ a("exiting");
65
+ const x = () => {
66
+ n = null, T(), f(t) || l(!1);
67
+ }, o = e.element?.(), M = N() ? null : _(o);
68
+ if (o && M) {
69
+ const u = /* @__PURE__ */ new Set(), E = /* @__PURE__ */ new Set();
65
70
  let F = !1;
66
71
  const S = () => {
67
- F || (F = !0, T());
68
- }, L = (s) => s.target === o && x.properties.has(s.propertyName), N = (s) => {
69
- L(s) && b.add(s.propertyName);
70
- }, m = (s) => {
71
- if (L(s)) {
72
- b.add(s.propertyName), E.add(s.propertyName);
73
- for (const C of b)
74
- if (!E.has(C)) return;
72
+ F || (F = !0, x());
73
+ }, v = (s) => s.target === o && M.properties.has(s.propertyName), C = (s) => {
74
+ v(s) && u.add(s.propertyName);
75
+ }, p = (s) => {
76
+ if (v(s)) {
77
+ u.add(s.propertyName), E.add(s.propertyName);
78
+ for (const D of u)
79
+ if (!E.has(D)) return;
75
80
  S();
76
81
  }
77
82
  };
78
- o.addEventListener("transitionrun", N), o.addEventListener("transitionend", m), o.addEventListener("transitioncancel", m), d = () => {
79
- o.removeEventListener("transitionrun", N), o.removeEventListener("transitionend", m), o.removeEventListener("transitioncancel", m);
83
+ o.addEventListener("transitionrun", C), o.addEventListener("transitionend", p), o.addEventListener("transitioncancel", p), g = () => {
84
+ o.removeEventListener("transitionrun", C), o.removeEventListener("transitionend", p), o.removeEventListener("transitioncancel", p);
80
85
  };
81
- const D = Math.max(x.longestMs, e.exitDurationMs ?? 0) + O;
82
- r = globalThis.setTimeout(S, D);
86
+ const P = Math.max(M.longestMs, e.exitDurationMs ?? 0) + O;
87
+ r = globalThis.setTimeout(S, P);
83
88
  return;
84
89
  }
85
- const M = v() ? Math.max(0, e.reducedMotionExitDurationMs ?? 1) : Math.max(0, e.exitDurationMs ?? 160), y = () => {
90
+ const y = N() ? Math.max(0, e.reducedMotionExitDurationMs ?? 1) : Math.max(0, e.exitDurationMs ?? 160), b = () => {
86
91
  n = null, r = globalThis.setTimeout(() => {
87
- r = null, M <= 1 ? T() : n = p(T);
88
- }, M);
92
+ r = null, y <= 1 ? x() : n = d(x);
93
+ }, y);
89
94
  };
90
- M <= 1 ? y() : n = p(() => {
91
- n = p(y);
95
+ y <= 1 ? b() : n = d(() => {
96
+ n = d(b);
92
97
  });
93
98
  }), A(() => {
94
- h(), g();
99
+ h(), T();
95
100
  }), {
96
101
  mounted: c,
97
- state: f,
98
- exiting: () => f() === "exiting"
102
+ state: m,
103
+ exiting: () => m() === "exiting"
99
104
  };
100
105
  }
101
106
  export {
@@ -1,4 +1,4 @@
1
- export { PromptCard, type PromptCardProps } from './PromptCard';
1
+ export { PromptCard, capturePromptCardAnchor, type PromptCardProps } from './PromptCard';
2
2
  export { FeedbackIndicator, type FeedbackIndicatorProps, type FeedbackIndicatorEntry } from './FeedbackIndicator';
3
3
  export { Button, type ButtonProps, type ButtonVariant, type ButtonSize } from './Button';
4
4
  export { StableText, type StableTextProps } from './StableText';
package/dist/floe.css CHANGED
@@ -1007,12 +1007,12 @@
1007
1007
  * positioning layer never animates, and typing never schedules a motion loop. */
1008
1008
  .floe-prompt-card-positioner { position: fixed; pointer-events: none; width: min(24rem, var(--floe-prompt-max-width)); }
1009
1009
  .floe-prompt-card {
1010
- --floe-floating-enter-duration: var(--floe-duration-base);
1010
+ --floe-floating-enter-duration: var(--floe-duration-slow);
1011
1011
  --floe-floating-exit-duration: var(--floe-duration-fast);
1012
- --floe-floating-enter-y: -0.25rem;
1013
- --floe-floating-exit-y: -0.125rem;
1014
- --floe-floating-enter-scale: 0.985;
1015
- --floe-floating-exit-scale: 0.995;
1012
+ --floe-floating-enter-y: -0.75rem;
1013
+ --floe-floating-exit-y: -0.375rem;
1014
+ --floe-floating-enter-scale: 0.975;
1015
+ --floe-floating-exit-scale: 0.985;
1016
1016
  --floe-floating-origin: var(--floe-prompt-origin-x) top;
1017
1017
  display: flex; flex-direction: column; min-width: 0;
1018
1018
  max-height: var(--floe-prompt-max-height);
@@ -1026,15 +1026,14 @@
1026
1026
  line-height: var(--floe-line-body);
1027
1027
  }
1028
1028
  .floe-prompt-card[data-floating-side='top'] {
1029
- --floe-floating-enter-y: 0.25rem;
1030
- --floe-floating-exit-y: 0.125rem;
1029
+ --floe-floating-enter-y: 0.75rem;
1030
+ --floe-floating-exit-y: 0.375rem;
1031
1031
  --floe-floating-origin: var(--floe-prompt-origin-x) bottom;
1032
1032
  }
1033
1033
  .floe-prompt-card[data-floating-side='edge'] {
1034
- --floe-floating-enter-y: 0;
1035
- --floe-floating-exit-y: 0;
1036
- --floe-floating-enter-scale: 1;
1037
- --floe-floating-exit-scale: 1;
1034
+ --floe-floating-enter-y: 0.5rem;
1035
+ --floe-floating-exit-y: 0.25rem;
1036
+ --floe-floating-origin: center;
1038
1037
  }
1039
1038
  .floe-prompt-card-header {
1040
1039
  display: flex; align-items: center; flex-shrink: 0;