@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.
- package/dist/components/ui/PromptCard.d.ts +2 -0
- package/dist/components/ui/PromptCard.js +103 -91
- package/dist/components/ui/floatingPresence.js +50 -45
- package/dist/components/ui/index.d.ts +1 -1
- package/dist/floe.css +10 -11
- package/dist/full.js +294 -293
- package/dist/styles.css +1 -1
- package/dist/ui.js +148 -147
- package/package.json +1 -1
|
@@ -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
|
|
2
|
-
import { createUniqueId as
|
|
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
|
|
5
|
-
import { ensureSurfacePortalInteractionTracking as
|
|
6
|
-
import { cn as
|
|
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
|
|
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__ */
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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,
|
|
31
|
+
const [g, ve] = z(Ie(window)), [A, be] = z(), [Q, xe] = z({
|
|
21
32
|
width: 0,
|
|
22
33
|
height: 0
|
|
23
|
-
}),
|
|
34
|
+
}), ye = F((n) => t.open ? t.anchor ?? K(() => Ue(t.owner)) : n), w = Re({
|
|
24
35
|
open: () => t.open,
|
|
25
|
-
element:
|
|
36
|
+
element: A
|
|
26
37
|
});
|
|
27
|
-
let v,
|
|
28
|
-
const
|
|
29
|
-
!
|
|
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
|
-
}),
|
|
33
|
-
t.open && !l() && !t.inputDisabled && n.length && (t.attachment?.onFiles(n),
|
|
43
|
+
}), J = (n) => {
|
|
44
|
+
t.open && !l() && !t.inputDisabled && n.length && (t.attachment?.onFiles(n), G());
|
|
34
45
|
};
|
|
35
|
-
|
|
36
|
-
(!t.open || l() || t.inputDisabled) &&
|
|
46
|
+
U(() => {
|
|
47
|
+
(!t.open || l() || t.inputDisabled) && ie(!1);
|
|
37
48
|
});
|
|
38
|
-
const
|
|
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(
|
|
56
|
+
})), H = () => Oe(T()), O = F(() => (g(), Q(), H() ? De(T()) : {
|
|
46
57
|
x: g().fixedScale,
|
|
47
58
|
y: g().fixedScale
|
|
48
59
|
}));
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}),
|
|
52
|
-
const n =
|
|
53
|
-
if (!
|
|
54
|
-
const i = () =>
|
|
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(),
|
|
72
|
+
r.observe(n), i(), te(() => r.disconnect());
|
|
62
73
|
});
|
|
63
|
-
const
|
|
64
|
-
const n = g(), i = H() ?
|
|
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:
|
|
68
|
-
availableWidth:
|
|
78
|
+
y: V,
|
|
79
|
+
availableWidth: $,
|
|
69
80
|
maxHeight: e,
|
|
70
|
-
side:
|
|
71
|
-
originX: a ? h(a.x - b, 16,
|
|
81
|
+
side: a ? I ? "bottom" : "top" : "edge",
|
|
82
|
+
originX: a ? h(a.x - b, 16, S - 16) : S / 2
|
|
72
83
|
};
|
|
73
|
-
}),
|
|
74
|
-
x: (
|
|
75
|
-
y: (
|
|
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 ||
|
|
78
|
-
!t.open &&
|
|
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
|
-
|
|
94
|
+
U(() => {
|
|
84
95
|
if (!t.open) return;
|
|
85
|
-
const n = document.activeElement, r = t.owner ??
|
|
86
|
-
r && !
|
|
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:
|
|
94
|
-
containsTarget: (n) => !!(n instanceof Node &&
|
|
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
|
|
109
|
-
!t.open || l() || t.submitDisabled || (
|
|
110
|
-
if (!
|
|
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
|
-
|
|
125
|
+
ae(!1);
|
|
115
126
|
}
|
|
116
127
|
})));
|
|
117
128
|
};
|
|
118
|
-
return u(
|
|
129
|
+
return u(E, {
|
|
119
130
|
get when() {
|
|
120
|
-
return
|
|
131
|
+
return w.mounted();
|
|
121
132
|
},
|
|
122
133
|
get children() {
|
|
123
|
-
return u(
|
|
134
|
+
return u(we, {
|
|
124
135
|
get mount() {
|
|
125
|
-
return Te(
|
|
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,
|
|
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 ||
|
|
131
|
-
}, i.$$focusin = () => t.onActivate?.(), i.$$pointerdown = () => t.onActivate?.(),
|
|
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",
|
|
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),
|
|
165
|
+
}), null), Ce(f, Se(() => t.bodyProps, {
|
|
155
166
|
get class() {
|
|
156
|
-
return
|
|
167
|
+
return fe("floe-prompt-card-body", t.bodyProps?.class);
|
|
157
168
|
}
|
|
158
|
-
}), !1, !0), c(f, u(
|
|
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(),
|
|
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(
|
|
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),
|
|
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 && !
|
|
190
|
+
e.key === "Enter" && !e.shiftKey && !e.isComposing && !L && (e.preventDefault(), oe());
|
|
180
191
|
}, o.addEventListener("compositionend", (e) => {
|
|
181
|
-
|
|
192
|
+
L = !1, t.onValueChange(e.currentTarget.value);
|
|
182
193
|
}), o.addEventListener("compositionupdate", (e) => t.onValueChange(e.currentTarget.value)), o.addEventListener("compositionstart", () => {
|
|
183
|
-
|
|
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(),
|
|
186
|
-
}),
|
|
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(
|
|
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
|
-
|
|
197
|
-
}), e.addEventListener("cancel",
|
|
198
|
-
var m =
|
|
199
|
-
return typeof m == "function" ?
|
|
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(
|
|
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: () =>
|
|
231
|
+
onClick: () => p?.click()
|
|
221
232
|
})];
|
|
222
233
|
}
|
|
223
|
-
}), null), c(
|
|
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
|
|
245
|
+
return ge();
|
|
235
246
|
},
|
|
236
|
-
onOpenChange:
|
|
237
|
-
onOptionSelect:
|
|
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(
|
|
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:
|
|
298
|
-
}), null), c(f, u(
|
|
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),
|
|
307
|
-
var m = H() ? "absolute" : "fixed", a = `${
|
|
308
|
-
return m !== e.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
|
-
}),
|
|
336
|
+
}), X(() => o.value = t.value), n;
|
|
326
337
|
}
|
|
327
338
|
});
|
|
328
339
|
}
|
|
329
340
|
});
|
|
330
341
|
}
|
|
331
|
-
|
|
342
|
+
Ee(["pointerdown", "focusin", "keydown", "input"]);
|
|
332
343
|
export {
|
|
333
|
-
|
|
344
|
+
it as PromptCard,
|
|
345
|
+
Ue as capturePromptCardAnchor
|
|
334
346
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { createMemo as q, untrack as
|
|
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
|
|
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
|
|
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(","),
|
|
29
|
-
return i.transitionProperty.split(",").forEach((
|
|
30
|
-
const n =
|
|
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[
|
|
33
|
-
r === null || r <= 1 || (
|
|
34
|
-
}),
|
|
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 =
|
|
38
|
-
|
|
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
|
-
},
|
|
42
|
-
r !== null && (globalThis.clearTimeout(r), r = 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(),
|
|
47
|
-
|
|
48
|
+
if (h(), T(), f(c) && f(m) === "exiting") {
|
|
49
|
+
a("open");
|
|
48
50
|
return;
|
|
49
51
|
}
|
|
50
|
-
|
|
51
|
-
n = null,
|
|
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(), !
|
|
56
|
-
|
|
60
|
+
if (h(), !f(c)) {
|
|
61
|
+
a("exiting");
|
|
57
62
|
return;
|
|
58
63
|
}
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
n = null,
|
|
62
|
-
}, o = e.element?.(),
|
|
63
|
-
if (o &&
|
|
64
|
-
const
|
|
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,
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
},
|
|
71
|
-
if (
|
|
72
|
-
|
|
73
|
-
for (const
|
|
74
|
-
if (!E.has(
|
|
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",
|
|
79
|
-
o.removeEventListener("transitionrun",
|
|
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
|
|
82
|
-
r = globalThis.setTimeout(S,
|
|
86
|
+
const P = Math.max(M.longestMs, e.exitDurationMs ?? 0) + O;
|
|
87
|
+
r = globalThis.setTimeout(S, P);
|
|
83
88
|
return;
|
|
84
89
|
}
|
|
85
|
-
const
|
|
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,
|
|
88
|
-
},
|
|
92
|
+
r = null, y <= 1 ? x() : n = d(x);
|
|
93
|
+
}, y);
|
|
89
94
|
};
|
|
90
|
-
|
|
91
|
-
n =
|
|
95
|
+
y <= 1 ? b() : n = d(() => {
|
|
96
|
+
n = d(b);
|
|
92
97
|
});
|
|
93
98
|
}), A(() => {
|
|
94
|
-
h(),
|
|
99
|
+
h(), T();
|
|
95
100
|
}), {
|
|
96
101
|
mounted: c,
|
|
97
|
-
state:
|
|
98
|
-
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-
|
|
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.
|
|
1013
|
-
--floe-floating-exit-y: -0.
|
|
1014
|
-
--floe-floating-enter-scale: 0.
|
|
1015
|
-
--floe-floating-exit-scale: 0.
|
|
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.
|
|
1030
|
-
--floe-floating-exit-y: 0.
|
|
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-
|
|
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;
|