@floegence/floe-webapp-core 0.91.2 → 0.91.4
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.js +14 -14
- package/dist/components/ui/SegmentedControl.js +38 -38
- package/dist/floe.css +2 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { createComponent as u, Portal as xe, use as Y, setAttribute as x, insert as d, spread as ye, mergeProps as we, effect as N, setStyleProperty as C, className as Se, template as O, delegateEvents as Ce } from "solid-js/web";
|
|
2
|
-
import { createUniqueId as Me, createSignal as z, onCleanup as
|
|
2
|
+
import { createUniqueId as Me, createSignal as z, onCleanup as G, createMemo as F, createEffect as W, untrack as J, Show as $ } from "solid-js";
|
|
3
3
|
import { useOverlayMask as Pe } from "../../hooks/useOverlayMask.js";
|
|
4
4
|
import { deferAfterPaint as de } from "../../utils/defer.js";
|
|
5
5
|
import { ensureSurfacePortalInteractionTracking as ke, resolveSurfacePortalHost as $e, resolveSurfacePortalScale as De, resolveSurfacePortalBoundaryRect as Ee, projectSurfacePortalPosition as Ae, readFreshInteractionSnapshot as Le, resolveSurfacePortalMount as Te, isSurfacePortalMode as Ie } from "./dialogSurfaceScope.js";
|
|
6
6
|
import { cn as ue } from "../../utils/cn.js";
|
|
7
7
|
import { readViewportSnapshot as ze, observeViewport as Fe } from "../../viewport.js";
|
|
8
|
-
import { X as Oe,
|
|
9
|
-
import { Button as
|
|
8
|
+
import { X as Oe, Plus as Be, ArrowUp as He } from "../icons/index.js";
|
|
9
|
+
import { Button as Z } from "./Button.js";
|
|
10
10
|
import { Select as Re } from "./Select.js";
|
|
11
11
|
import { createFloatingPresence as Ve } from "./floatingPresence.js";
|
|
12
12
|
var qe = /* @__PURE__ */ O("<span class=floe-prompt-card-icon aria-hidden=true>"), _e = /* @__PURE__ */ O("<div class=floe-prompt-card-references>"), Ne = /* @__PURE__ */ O("<input type=file multiple hidden tabindex=-1>"), We = /* @__PURE__ */ O("<div class=floe-prompt-card-feedback>"), Xe = /* @__PURE__ */ O("<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-question></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
13
|
function nt(t) {
|
|
14
14
|
ke();
|
|
15
|
-
const
|
|
15
|
+
const p = Me(), [fe, ee] = z(!1), [me, te] = z(!1), c = () => t.busy || fe();
|
|
16
16
|
let ne = !1;
|
|
17
|
-
|
|
17
|
+
G(() => {
|
|
18
18
|
ne = !0;
|
|
19
19
|
});
|
|
20
20
|
const [h, he] = z(ze(window)), [D, ge] = z(), [X, ve] = z({
|
|
@@ -43,7 +43,7 @@ function nt(t) {
|
|
|
43
43
|
y: h().fixedScale
|
|
44
44
|
}));
|
|
45
45
|
W(() => {
|
|
46
|
-
y.mounted() &&
|
|
46
|
+
y.mounted() && G(Fe(window, he));
|
|
47
47
|
}), W(() => {
|
|
48
48
|
const n = D();
|
|
49
49
|
if (!y.mounted() || !n) return;
|
|
@@ -54,7 +54,7 @@ function nt(t) {
|
|
|
54
54
|
height: m
|
|
55
55
|
};
|
|
56
56
|
}), i = new ResizeObserver(a);
|
|
57
|
-
i.observe(n), a(),
|
|
57
|
+
i.observe(n), a(), G(() => i.disconnect());
|
|
58
58
|
});
|
|
59
59
|
const w = F(() => {
|
|
60
60
|
const n = h(), a = H() ? Ee(A()) : n.visible, i = n.visible.width < 640 ? 8 : 12, s = t.viewportInsets, f = Math.max(n.visible.left, a.left) + Math.max(n.safeArea.left, s?.left ?? 0) + i, m = Math.max(n.visible.top, a.top) + Math.max(n.safeArea.top, s?.top ?? 0) + i, S = Math.min(n.visible.right, a.right) - Math.max(n.safeArea.right, s?.right ?? 0) - i, P = Math.min(n.visible.bottom, a.bottom) - Math.max(n.safeArea.bottom, s?.bottom ?? 0) - i, o = Math.max(0, S - f), g = Math.min(X().width * L().x, o), k = Math.max(0, P - m), e = Math.min(X().height * L().y, k), r = be(), l = (V, q, _) => Math.max(q, Math.min(V, _)), v = l(r ? r.x + 8 : f + (o - g) / 2, f, S - g), b = !r || r.y + 8 + e <= P, T = r ? b ? r.y + 8 : r.y - e - 8 : m + Math.max(0, (k - e) * 0.32), I = l(T, m, P - e);
|
|
@@ -70,7 +70,7 @@ function nt(t) {
|
|
|
70
70
|
x: (w().x + h().fixedOffset.left) / h().fixedScale,
|
|
71
71
|
y: (w().y + h().fixedOffset.top) / h().fixedScale
|
|
72
72
|
}), R = (n) => {
|
|
73
|
-
c() || !t.open || E || (t.onClose(), n && de(() =>
|
|
73
|
+
c() || !t.open || E || (t.onClose(), n && de(() => J(() => {
|
|
74
74
|
!t.open && K?.isConnected && K.focus({
|
|
75
75
|
preventScroll: !0
|
|
76
76
|
});
|
|
@@ -79,7 +79,7 @@ function nt(t) {
|
|
|
79
79
|
W(() => {
|
|
80
80
|
if (!t.open) return;
|
|
81
81
|
const n = document.activeElement, i = t.owner ?? Le()?.target?.closest("button, a[href], input, [tabindex]") ?? (n instanceof HTMLElement && n !== document.body ? n : void 0);
|
|
82
|
-
i && !
|
|
82
|
+
i && !J(D)?.contains(i) && !t.containsTarget?.(i) && (K = i), queueMicrotask(() => {
|
|
83
83
|
!t.open || t.autoFocus === !1 || !M?.isConnected || (M.focus({
|
|
84
84
|
preventScroll: !0
|
|
85
85
|
}), M.setSelectionRange(M.value.length, M.value.length));
|
|
@@ -102,7 +102,7 @@ function nt(t) {
|
|
|
102
102
|
blockHotkeys: !1
|
|
103
103
|
});
|
|
104
104
|
const ie = () => {
|
|
105
|
-
!t.open || c() || t.submitDisabled || (ee(!0), de(() =>
|
|
105
|
+
!t.open || c() || t.submitDisabled || (ee(!0), de(() => J(() => {
|
|
106
106
|
if (!ne)
|
|
107
107
|
try {
|
|
108
108
|
t.open && t.onSubmit();
|
|
@@ -124,7 +124,7 @@ function nt(t) {
|
|
|
124
124
|
var n = Xe(), a = n.firstChild, i = a.firstChild, s = i.firstChild, f = i.nextSibling, m = f.firstChild, S = m.nextSibling, P = S.firstChild, o = P.firstChild, g = P.nextSibling, k = g.firstChild;
|
|
125
125
|
return a.$$keydown = (e) => {
|
|
126
126
|
e.key !== "Escape" || e.defaultPrevented || e.isComposing || E || B?.getAttribute("aria-expanded") === "true" && B.contains(e.target) || (e.preventDefault(), e.stopPropagation(), R(!0));
|
|
127
|
-
}, a.$$focusin = () => t.onActivate?.(), a.$$pointerdown = () => t.onActivate?.(), Y(ge, a), x(a, "aria-labelledby",
|
|
127
|
+
}, a.$$focusin = () => t.onActivate?.(), a.$$pointerdown = () => t.onActivate?.(), Y(ge, a), x(a, "aria-labelledby", p), d(i, u($, {
|
|
128
128
|
get when() {
|
|
129
129
|
return t.icon;
|
|
130
130
|
},
|
|
@@ -132,7 +132,7 @@ function nt(t) {
|
|
|
132
132
|
var e = qe();
|
|
133
133
|
return d(e, () => t.icon), e;
|
|
134
134
|
}
|
|
135
|
-
}), s), x(s, "id",
|
|
135
|
+
}), s), x(s, "id", p), d(s, () => t.title), d(i, u(Z, {
|
|
136
136
|
variant: "ghost",
|
|
137
137
|
size: "icon",
|
|
138
138
|
icon: Oe,
|
|
@@ -191,7 +191,7 @@ function nt(t) {
|
|
|
191
191
|
e: void 0,
|
|
192
192
|
t: void 0
|
|
193
193
|
}), e;
|
|
194
|
-
})(), u(
|
|
194
|
+
})(), u(Z, {
|
|
195
195
|
variant: "ghost",
|
|
196
196
|
size: "icon",
|
|
197
197
|
icon: Be,
|
|
@@ -252,7 +252,7 @@ function nt(t) {
|
|
|
252
252
|
}
|
|
253
253
|
});
|
|
254
254
|
}
|
|
255
|
-
}), null), d(g, u(
|
|
255
|
+
}), null), d(g, u(Z, {
|
|
256
256
|
variant: "primary",
|
|
257
257
|
size: "icon",
|
|
258
258
|
icon: He,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { use as
|
|
2
|
-
import { splitProps as I, createSignal as J, createEffect as K, onMount as Q, onCleanup as
|
|
1
|
+
import { use as k, spread as V, mergeProps as q, insert as $, createComponent as E, memo as B, effect as N, setAttribute as p, className as T, setStyleProperty as x, template as A, delegateEvents as G } from "solid-js/web";
|
|
2
|
+
import { splitProps as I, createSignal as J, createEffect as K, onMount as Q, onCleanup as j, For as U, untrack as X } from "solid-js";
|
|
3
3
|
import { cn as z } from "../../utils/cn.js";
|
|
4
|
-
var Y = /* @__PURE__ */
|
|
4
|
+
var Y = /* @__PURE__ */ A("<div role=group data-floe-surface=inset data-floe-surface-part=rail><span aria-hidden=true>"), Z = /* @__PURE__ */ A('<button type=button role=radio data-floe-surface-part=segment data-floe-interactive=item><span class="inline-flex items-center gap-1.5"><span class=floe-segmented-control__label>');
|
|
5
5
|
const ee = {
|
|
6
6
|
sm: {
|
|
7
7
|
container: "p-0.5 gap-0.5",
|
|
@@ -19,18 +19,18 @@ const ee = {
|
|
|
19
19
|
icon: "w-4 h-4"
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
|
-
function ne(
|
|
23
|
-
const [r,
|
|
24
|
-
let
|
|
22
|
+
function ne(D) {
|
|
23
|
+
const [r, H] = I(D, ["value", "onChange", "options", "size", "disabled", "class"]);
|
|
24
|
+
let c, f;
|
|
25
25
|
const h = /* @__PURE__ */ new Map(), [s, S] = J();
|
|
26
|
-
let
|
|
26
|
+
let u, m, b;
|
|
27
27
|
const y = () => {
|
|
28
28
|
const o = h.get(r.value);
|
|
29
|
-
if (!
|
|
30
|
-
|
|
29
|
+
if (!c || !o) {
|
|
30
|
+
m?.cancel(), S(void 0), b = void 0;
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
-
if (!o.offsetWidth || !
|
|
33
|
+
if (!o.offsetWidth || !c.getClientRects().length) return;
|
|
34
34
|
const n = {
|
|
35
35
|
x: o.offsetLeft,
|
|
36
36
|
y: o.offsetTop,
|
|
@@ -38,40 +38,40 @@ function ne(L) {
|
|
|
38
38
|
height: o.offsetHeight
|
|
39
39
|
}, v = X(s);
|
|
40
40
|
if (v && Object.keys(n).every((a) => n[a] === v[a]) && b === r.value) return;
|
|
41
|
-
const e = v && b !== r.value &&
|
|
41
|
+
const e = v && b !== r.value && f && !window.matchMedia("(prefers-reduced-motion: reduce), (forced-colors: active)").matches ? getComputedStyle(f) : void 0, l = e ? {
|
|
42
42
|
transform: e.transform,
|
|
43
43
|
width: e.width
|
|
44
44
|
} : void 0;
|
|
45
|
-
if (
|
|
46
|
-
const a = getComputedStyle(d);
|
|
47
|
-
|
|
45
|
+
if (m?.cancel(), S(n), b = r.value, l && f) {
|
|
46
|
+
const a = getComputedStyle(c), i = a.getPropertyValue("--floe-duration-slow").trim(), d = parseFloat(i) * (i.endsWith("ms") ? 1 : 1e3);
|
|
47
|
+
m = f.animate([l, {
|
|
48
48
|
transform: `translate(${n.x}px, ${n.y}px)`,
|
|
49
49
|
width: `${n.width}px`
|
|
50
50
|
}], {
|
|
51
51
|
// Position changes need visible travel: the fast entrance curve
|
|
52
52
|
// covers almost 90% of this short rail in its first 60ms.
|
|
53
|
-
duration:
|
|
53
|
+
duration: Number.isFinite(d) ? d : 280,
|
|
54
54
|
easing: a.getPropertyValue("--floe-ease-in-out").trim() || "ease-in-out"
|
|
55
|
-
}),
|
|
55
|
+
}), m.id = "floe-segmented-selection";
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
58
|
K(() => {
|
|
59
59
|
r.value, r.options, r.size, y();
|
|
60
60
|
}), Q(() => {
|
|
61
61
|
if (typeof ResizeObserver < "u") {
|
|
62
|
-
|
|
63
|
-
for (const o of h.values())
|
|
62
|
+
u = new ResizeObserver(y), u.observe(c);
|
|
63
|
+
for (const o of h.values()) u.observe(o);
|
|
64
64
|
}
|
|
65
65
|
y();
|
|
66
|
-
}),
|
|
67
|
-
|
|
66
|
+
}), j(() => {
|
|
67
|
+
u?.disconnect(), m?.cancel();
|
|
68
68
|
});
|
|
69
|
-
const P = () => r.size ?? "md", w = () => ee[P()],
|
|
69
|
+
const P = () => r.size ?? "md", w = () => ee[P()], L = (o, n) => {
|
|
70
70
|
r.disabled || n || o !== r.value && r.onChange(o);
|
|
71
71
|
};
|
|
72
72
|
return (() => {
|
|
73
|
-
var o = Y(), n = o.firstChild, v =
|
|
74
|
-
typeof v == "function" ?
|
|
73
|
+
var o = Y(), n = o.firstChild, v = c;
|
|
74
|
+
typeof v == "function" ? k(v, o) : c = o, V(o, q({
|
|
75
75
|
get "data-floe-segmented-pill"() {
|
|
76
76
|
return s() ? "true" : void 0;
|
|
77
77
|
},
|
|
@@ -81,30 +81,30 @@ function ne(L) {
|
|
|
81
81
|
get class() {
|
|
82
82
|
return z("floe-segmented-control relative inline-flex items-center border", "rounded-group", "text-[length:var(--floe-type-control)] leading-[var(--floe-line-control)]", w().container, r.disabled && "opacity-50 pointer-events-none", r.class);
|
|
83
83
|
}
|
|
84
|
-
},
|
|
85
|
-
var C =
|
|
86
|
-
return typeof C == "function" ?
|
|
84
|
+
}, H), !1, !0);
|
|
85
|
+
var C = f;
|
|
86
|
+
return typeof C == "function" ? k(C, n) : f = n, $(o, E(U, {
|
|
87
87
|
get each() {
|
|
88
88
|
return r.options;
|
|
89
89
|
},
|
|
90
90
|
children: (e) => {
|
|
91
91
|
const l = () => r.value === e.value, a = () => r.disabled || e.disabled;
|
|
92
92
|
return (() => {
|
|
93
|
-
var i = Z(),
|
|
94
|
-
return i.$$click = () =>
|
|
95
|
-
h.set(e.value, t),
|
|
96
|
-
|
|
93
|
+
var i = Z(), d = i.firstChild, g = d.firstChild;
|
|
94
|
+
return i.$$click = () => L(e.value, e.disabled), k((t) => {
|
|
95
|
+
h.set(e.value, t), u?.observe(t), j(() => {
|
|
96
|
+
u?.unobserve(t), h.delete(e.value);
|
|
97
97
|
});
|
|
98
|
-
}, i),
|
|
98
|
+
}, i), $(d, (() => {
|
|
99
99
|
var t = B(() => !!e.icon);
|
|
100
|
-
return () => t() &&
|
|
100
|
+
return () => t() && E(e.icon, {
|
|
101
101
|
get class() {
|
|
102
102
|
return w().icon;
|
|
103
103
|
}
|
|
104
104
|
});
|
|
105
|
-
})(),
|
|
106
|
-
var _ = e.label,
|
|
107
|
-
return _ !== t.e && p(i, "aria-label", t.e = _),
|
|
105
|
+
})(), g), $(g, () => e.label), N((t) => {
|
|
106
|
+
var _ = e.label, F = e.label, M = l() ? "raised" : "flat", O = l(), R = a(), W = z("floe-segmented-control__item relative font-medium cursor-pointer border", "transition-[background-color,border-color,color,box-shadow] duration-[var(--floe-duration-fast)] ease-[var(--floe-ease-out)]", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-[var(--floe-plane)]", w().button, l() ? "text-[var(--primary-foreground)]" : "text-[var(--floe-ink-soft)] hover:text-foreground", a() && "cursor-not-allowed opacity-50");
|
|
107
|
+
return _ !== t.e && p(i, "aria-label", t.e = _), F !== t.t && p(i, "title", t.t = F), M !== t.a && p(i, "data-floe-surface", t.a = M), O !== t.o && p(i, "aria-checked", t.o = O), R !== t.i && (i.disabled = t.i = R), W !== t.n && T(i, t.n = W), t;
|
|
108
108
|
}, {
|
|
109
109
|
e: void 0,
|
|
110
110
|
t: void 0,
|
|
@@ -115,9 +115,9 @@ function ne(L) {
|
|
|
115
115
|
}), i;
|
|
116
116
|
})();
|
|
117
117
|
}
|
|
118
|
-
}), null),
|
|
119
|
-
var l = z("floe-segmented-control__pill", P() === "lg" ? "rounded-md" : "rounded-sm"), a = s() ? "visible" : "hidden", i = `translate(${s()?.x ?? 0}px, ${s()?.y ?? 0}px)`,
|
|
120
|
-
return l !== e.e &&
|
|
118
|
+
}), null), N((e) => {
|
|
119
|
+
var l = z("floe-segmented-control__pill", P() === "lg" ? "rounded-md" : "rounded-sm"), a = s() ? "visible" : "hidden", i = `translate(${s()?.x ?? 0}px, ${s()?.y ?? 0}px)`, d = `${s()?.width ?? 0}px`, g = `${s()?.height ?? 0}px`;
|
|
120
|
+
return l !== e.e && T(n, e.e = l), a !== e.t && x(n, "visibility", e.t = a), i !== e.a && x(n, "transform", e.a = i), d !== e.o && x(n, "width", e.o = d), g !== e.i && x(n, "height", e.i = g), e;
|
|
121
121
|
}, {
|
|
122
122
|
e: void 0,
|
|
123
123
|
t: void 0,
|
package/dist/floe.css
CHANGED
|
@@ -1019,7 +1019,8 @@
|
|
|
1019
1019
|
overflow: hidden; pointer-events: auto;
|
|
1020
1020
|
border: 0;
|
|
1021
1021
|
border-radius: var(--floe-radius-card);
|
|
1022
|
-
|
|
1022
|
+
/* A contextual editor must separate from both the page and content cards. */
|
|
1023
|
+
background: color-mix(in srgb, var(--floe-ink) 10%, var(--floe-plane-float));
|
|
1023
1024
|
color: var(--floe-ink);
|
|
1024
1025
|
font-size: var(--floe-type-body);
|
|
1025
1026
|
line-height: var(--floe-line-body);
|