@floegence/floe-webapp-core 0.101.48 → 0.101.52
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/media/ImageAnnotationSurface.js +109 -100
- package/dist/components/ui/PromptCard.d.ts +3 -0
- package/dist/components/ui/PromptCard.js +131 -120
- package/dist/components/ui/ThemePicker.d.ts +2 -0
- package/dist/components/ui/ThemePicker.js +43 -37
- package/dist/components/ui/ThemeStudio.d.ts +11 -0
- package/dist/components/ui/ThemeStudio.js +285 -0
- package/dist/components/ui/promptCardPlacement.d.ts +24 -0
- package/dist/components/ui/promptCardPlacement.js +12 -0
- package/dist/context/FloeConfigContext.d.ts +1 -0
- package/dist/context/ThemeContext.js +43 -43
- package/dist/styles/themes/themeDocument.d.ts +13 -0
- package/dist/styles/themes/themeDocument.js +65 -0
- package/dist/styles.css +1 -1
- package/dist/themes.d.ts +1 -0
- package/dist/themes.js +14 -9
- package/dist/ui.css +18 -0
- package/package.json +1 -1
|
@@ -1,111 +1,122 @@
|
|
|
1
|
-
import { createComponent as
|
|
2
|
-
import { createUniqueId as
|
|
1
|
+
import { createComponent as f, Portal as we, use as te, setAttribute as x, insert as c, spread as Ce, mergeProps as Se, effect as U, setStyleProperty as P, className as Me, template as A, delegateEvents as Pe } from "solid-js/web";
|
|
2
|
+
import { createUniqueId as Ee, createSignal as z, onCleanup as ne, createMemo as F, untrack as j, createEffect as Q, Show as E } from "solid-js";
|
|
3
3
|
import { useOverlayMask as ke } from "../../hooks/useOverlayMask.js";
|
|
4
4
|
import { deferAfterPaint as ue } from "../../utils/defer.js";
|
|
5
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
6
|
import { cn as fe } from "../../utils/cn.js";
|
|
7
7
|
import { readViewportSnapshot as Ie, observeViewport as ze } from "../../viewport.js";
|
|
8
|
-
import { X as Fe, Plus as Be, ArrowUp as
|
|
9
|
-
import { Button as
|
|
10
|
-
import { Select as
|
|
11
|
-
import { createFloatingPresence as
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
import { X as Fe, Plus as Be, ArrowUp as Re } from "../icons/index.js";
|
|
9
|
+
import { Button as ae } from "./Button.js";
|
|
10
|
+
import { Select as He } from "./Select.js";
|
|
11
|
+
import { createFloatingPresence as qe } from "./floatingPresence.js";
|
|
12
|
+
import { avoidPromptCardRegions as Ve } from "./promptCardPlacement.js";
|
|
13
|
+
var _e = /* @__PURE__ */ A("<span class=floe-prompt-card-icon aria-hidden=true>"), Ne = /* @__PURE__ */ A("<div class=floe-prompt-card-question>"), We = /* @__PURE__ */ A("<div class=floe-prompt-card-references>"), Xe = /* @__PURE__ */ A("<input type=file multiple hidden tabindex=-1>"), Ke = /* @__PURE__ */ A("<div class=floe-prompt-card-feedback>"), Ue = /* @__PURE__ */ A("<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>");
|
|
14
|
+
function je(t) {
|
|
14
15
|
if (typeof document > "u") return null;
|
|
15
16
|
me();
|
|
16
|
-
const
|
|
17
|
-
if (!
|
|
18
|
-
const
|
|
19
|
-
return
|
|
20
|
-
x:
|
|
21
|
-
y:
|
|
17
|
+
const y = t ?? he()?.target ?? document.activeElement;
|
|
18
|
+
if (!y?.isConnected || y === document.body || y === document.documentElement) return null;
|
|
19
|
+
const k = y.getBoundingClientRect();
|
|
20
|
+
return k.width > 0 && k.height > 0 ? {
|
|
21
|
+
x: k.left,
|
|
22
|
+
y: k.bottom
|
|
22
23
|
} : null;
|
|
23
24
|
}
|
|
24
|
-
function
|
|
25
|
+
function ot(t) {
|
|
25
26
|
me();
|
|
26
|
-
const
|
|
27
|
-
let
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
const y = Ee(), [k, ie] = z(!1), [ge, re] = z(!1), l = () => t.busy || k();
|
|
28
|
+
let Y = !1;
|
|
29
|
+
ne(() => {
|
|
30
|
+
Y = !0;
|
|
30
31
|
});
|
|
31
|
-
const [
|
|
32
|
+
const [v, ve] = z(Ie(window)), [L, be] = z(), [G, xe] = z({
|
|
32
33
|
width: 0,
|
|
33
34
|
height: 0
|
|
34
|
-
}), ye = F((n) => t.open ? t.anchor ??
|
|
35
|
+
}), ye = F((n) => t.open ? t.anchor ?? j(() => je(t.owner)) : n), w = qe({
|
|
35
36
|
open: () => t.open,
|
|
36
|
-
element:
|
|
37
|
+
element: L
|
|
37
38
|
});
|
|
38
|
-
let
|
|
39
|
-
const
|
|
40
|
-
!
|
|
39
|
+
let b, J, T = !1, Z, B;
|
|
40
|
+
const p = () => queueMicrotask(() => {
|
|
41
|
+
!Y && t.open && !l() && !t.inputDisabled && b?.isConnected && b.focus({
|
|
41
42
|
preventScroll: !0
|
|
42
43
|
});
|
|
43
|
-
}),
|
|
44
|
-
t.open && !l() && !t.inputDisabled && n.length && (t.attachment?.onFiles(n),
|
|
44
|
+
}), ee = (n) => {
|
|
45
|
+
t.open && !l() && !t.inputDisabled && n.length && (t.attachment?.onFiles(n), p());
|
|
45
46
|
};
|
|
46
|
-
|
|
47
|
-
(!t.open || l() || t.inputDisabled) &&
|
|
47
|
+
Q(() => {
|
|
48
|
+
(!t.open || l() || t.inputDisabled) && re(!1);
|
|
48
49
|
});
|
|
49
|
-
const
|
|
50
|
+
const O = F(() => !w.mounted() || t.portalScope === "viewport" ? {
|
|
50
51
|
host: null,
|
|
51
52
|
boundaryHost: null,
|
|
52
53
|
mountHost: null,
|
|
53
54
|
mode: "global"
|
|
54
55
|
} : $e({
|
|
55
56
|
owner: t.owner
|
|
56
|
-
})),
|
|
57
|
-
x:
|
|
58
|
-
y:
|
|
57
|
+
})), R = () => Oe(O()), I = F(() => (v(), G(), R() ? De(O()) : {
|
|
58
|
+
x: v().fixedScale,
|
|
59
|
+
y: v().fixedScale
|
|
59
60
|
}));
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}),
|
|
63
|
-
const n =
|
|
64
|
-
if (!
|
|
65
|
-
const i = () => xe((
|
|
66
|
-
const
|
|
67
|
-
return
|
|
68
|
-
width:
|
|
69
|
-
height:
|
|
61
|
+
Q(() => {
|
|
62
|
+
w.mounted() && ne(ze(window, ve));
|
|
63
|
+
}), Q(() => {
|
|
64
|
+
const n = L();
|
|
65
|
+
if (!w.mounted() || !n) return;
|
|
66
|
+
const i = () => xe((d) => {
|
|
67
|
+
const u = n.offsetWidth, s = n.offsetHeight;
|
|
68
|
+
return d.width === u && d.height === s ? d : {
|
|
69
|
+
width: u,
|
|
70
|
+
height: s
|
|
70
71
|
};
|
|
71
72
|
}), r = new ResizeObserver(i);
|
|
72
|
-
r.observe(n), i(),
|
|
73
|
+
r.observe(n), i(), ne(() => r.disconnect());
|
|
73
74
|
});
|
|
74
|
-
const
|
|
75
|
-
const n =
|
|
75
|
+
const C = F(() => {
|
|
76
|
+
const n = v(), i = R() ? Ae(O()) : n.visible, r = n.visible.width < 640 ? 8 : 12, d = t.viewportInsets, u = Math.max(n.visible.left, i.left) + Math.max(n.safeArea.left, d?.left ?? 0) + r, s = Math.max(n.visible.top, i.top) + Math.max(n.safeArea.top, d?.top ?? 0) + r, S = Math.min(n.visible.right, i.right) - Math.max(n.safeArea.right, d?.right ?? 0) - r, o = Math.min(n.visible.bottom, i.bottom) - Math.max(n.safeArea.bottom, d?.bottom ?? 0) - r, $ = Math.max(0, S - u), h = Math.min(G().width * I().x, $), e = Math.max(0, o - s), m = Math.min(G().height * I().y, e), a = ye(), g = (W, X, K) => Math.max(X, Math.min(W, K)), M = g(a ? a.x + 8 : u + ($ - h) / 2, u, S - h), q = !a || a.y + 8 + m <= o, V = a ? q ? a.y + 8 : a.y - m - 8 : s + Math.max(0, (e - m) * 0.32), _ = g(V, s, o - m), D = Ve({
|
|
77
|
+
x: M,
|
|
78
|
+
y: _
|
|
79
|
+
}, {
|
|
80
|
+
width: h,
|
|
81
|
+
height: m
|
|
82
|
+
}, {
|
|
83
|
+
left: u,
|
|
84
|
+
top: s,
|
|
85
|
+
right: S,
|
|
86
|
+
bottom: o
|
|
87
|
+
}, t.avoidRegions ?? []), N = a ? D.y >= a.y ? "bottom" : "top" : "edge";
|
|
76
88
|
return {
|
|
77
|
-
|
|
78
|
-
y: V,
|
|
89
|
+
...D,
|
|
79
90
|
availableWidth: $,
|
|
80
91
|
maxHeight: e,
|
|
81
|
-
side:
|
|
82
|
-
originX: a ?
|
|
92
|
+
side: N,
|
|
93
|
+
originX: a ? g(a.x - D.x, 16, h - 16) : h / 2
|
|
83
94
|
};
|
|
84
|
-
}),
|
|
85
|
-
x: (
|
|
86
|
-
y: (
|
|
87
|
-
}),
|
|
88
|
-
l() || !t.open ||
|
|
89
|
-
!t.open &&
|
|
95
|
+
}), oe = F(() => R() ? Le(C(), O()) : {
|
|
96
|
+
x: (C().x + v().fixedOffset.left) / v().fixedScale,
|
|
97
|
+
y: (C().y + v().fixedOffset.top) / v().fixedScale
|
|
98
|
+
}), H = (n) => {
|
|
99
|
+
l() || !t.open || T || (t.onClose(), n && ue(() => j(() => {
|
|
100
|
+
!t.open && J?.isConnected && J.focus({
|
|
90
101
|
preventScroll: !0
|
|
91
102
|
});
|
|
92
103
|
})));
|
|
93
104
|
};
|
|
94
|
-
|
|
105
|
+
Q(() => {
|
|
95
106
|
if (!t.open) return;
|
|
96
107
|
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 && !
|
|
98
|
-
!t.open || t.autoFocus === !1 || !
|
|
108
|
+
r && !j(L)?.contains(r) && !t.containsTarget?.(r) && (J = r), queueMicrotask(() => {
|
|
109
|
+
!t.open || t.autoFocus === !1 || !b?.isConnected || (b.focus({
|
|
99
110
|
preventScroll: !0
|
|
100
|
-
}),
|
|
111
|
+
}), b.setSelectionRange(b.value.length, b.value.length));
|
|
101
112
|
});
|
|
102
113
|
}), ke({
|
|
103
114
|
open: () => t.open,
|
|
104
|
-
root:
|
|
105
|
-
containsTarget: (n) => !!(n instanceof Node &&
|
|
106
|
-
onClose: () =>
|
|
115
|
+
root: L,
|
|
116
|
+
containsTarget: (n) => !!(n instanceof Node && L()?.contains(n)) || !!t.containsTarget?.(n) || !!(n instanceof Node && document.getElementById(B?.getAttribute("aria-controls") ?? "")?.parentElement?.contains(n)),
|
|
117
|
+
onClose: () => H(!0),
|
|
107
118
|
onInteractOutside: (n) => {
|
|
108
|
-
n.type === "pointerdown" && n.button === 0 &&
|
|
119
|
+
n.type === "pointerdown" && n.button === 0 && H(!1);
|
|
109
120
|
},
|
|
110
121
|
// Related previews belong to pointer ownership, but own their Escape command.
|
|
111
122
|
closeOnEscape: "none",
|
|
@@ -116,38 +127,38 @@ function it(t) {
|
|
|
116
127
|
restoreFocus: !1,
|
|
117
128
|
blockHotkeys: !1
|
|
118
129
|
});
|
|
119
|
-
const
|
|
120
|
-
!t.open || l() || t.submitDisabled || (
|
|
121
|
-
if (!
|
|
130
|
+
const le = () => {
|
|
131
|
+
!t.open || l() || t.submitDisabled || (ie(!0), ue(() => j(() => {
|
|
132
|
+
if (!Y)
|
|
122
133
|
try {
|
|
123
134
|
t.open && t.onSubmit();
|
|
124
135
|
} finally {
|
|
125
|
-
|
|
136
|
+
ie(!1);
|
|
126
137
|
}
|
|
127
138
|
})));
|
|
128
139
|
};
|
|
129
|
-
return
|
|
140
|
+
return f(E, {
|
|
130
141
|
get when() {
|
|
131
|
-
return
|
|
142
|
+
return w.mounted();
|
|
132
143
|
},
|
|
133
144
|
get children() {
|
|
134
|
-
return
|
|
145
|
+
return f(we, {
|
|
135
146
|
get mount() {
|
|
136
|
-
return Te(
|
|
147
|
+
return Te(O());
|
|
137
148
|
},
|
|
138
149
|
get children() {
|
|
139
|
-
var n =
|
|
150
|
+
var n = Ue(), i = n.firstChild, r = i.firstChild, d = r.firstChild, u = r.nextSibling, s = u.firstChild, S = s.firstChild, o = S.firstChild, $ = S.nextSibling, h = $.firstChild;
|
|
140
151
|
return i.$$keydown = (e) => {
|
|
141
|
-
e.key !== "Escape" || e.defaultPrevented || e.isComposing ||
|
|
142
|
-
}, i.$$focusin = () => t.onActivate?.(), i.$$pointerdown = () => t.onActivate?.(),
|
|
152
|
+
e.key !== "Escape" || e.defaultPrevented || e.isComposing || T || B?.getAttribute("aria-expanded") === "true" && B.contains(e.target) || (e.preventDefault(), e.stopPropagation(), H(!0));
|
|
153
|
+
}, i.$$focusin = () => t.onActivate?.(), i.$$pointerdown = () => t.onActivate?.(), te(be, i), x(i, "aria-labelledby", y), c(r, f(E, {
|
|
143
154
|
get when() {
|
|
144
155
|
return t.icon;
|
|
145
156
|
},
|
|
146
157
|
get children() {
|
|
147
|
-
var e =
|
|
158
|
+
var e = _e();
|
|
148
159
|
return c(e, () => t.icon), e;
|
|
149
160
|
}
|
|
150
|
-
}),
|
|
161
|
+
}), d), x(d, "id", y), c(d, () => t.title), c(r, f(ae, {
|
|
151
162
|
variant: "ghost",
|
|
152
163
|
size: "icon",
|
|
153
164
|
icon: Fe,
|
|
@@ -161,60 +172,60 @@ function it(t) {
|
|
|
161
172
|
get "aria-label"() {
|
|
162
173
|
return t.closeLabel;
|
|
163
174
|
},
|
|
164
|
-
onClick: () =>
|
|
165
|
-
}), null), Ce(
|
|
175
|
+
onClick: () => H(!0)
|
|
176
|
+
}), null), Ce(u, Se(() => t.bodyProps, {
|
|
166
177
|
get class() {
|
|
167
178
|
return fe("floe-prompt-card-body", t.bodyProps?.class);
|
|
168
179
|
}
|
|
169
|
-
}), !1, !0), c(
|
|
180
|
+
}), !1, !0), c(u, f(E, {
|
|
170
181
|
get when() {
|
|
171
182
|
return t.question;
|
|
172
183
|
},
|
|
173
184
|
get children() {
|
|
174
|
-
var e =
|
|
185
|
+
var e = Ne();
|
|
175
186
|
return c(e, () => t.question), e;
|
|
176
187
|
}
|
|
177
|
-
}),
|
|
178
|
-
!t.attachment || !e.dataTransfer?.files.length || (e.preventDefault(),
|
|
179
|
-
}),
|
|
188
|
+
}), s), s.addEventListener("drop", (e) => {
|
|
189
|
+
!t.attachment || !e.dataTransfer?.files.length || (e.preventDefault(), ee(Array.from(e.dataTransfer.files)));
|
|
190
|
+
}), s.addEventListener("dragover", (e) => {
|
|
180
191
|
t.attachment && !l() && !t.inputDisabled && e.dataTransfer?.types.includes("Files") && e.preventDefault();
|
|
181
|
-
}), c(
|
|
192
|
+
}), c(s, f(E, {
|
|
182
193
|
get when() {
|
|
183
194
|
return t.references;
|
|
184
195
|
},
|
|
185
196
|
get children() {
|
|
186
|
-
var e =
|
|
187
|
-
return c(e, () => t.references),
|
|
197
|
+
var e = We();
|
|
198
|
+
return c(e, () => t.references), U(() => e.inert = !!l()), e;
|
|
188
199
|
}
|
|
189
|
-
}),
|
|
190
|
-
e.key === "Enter" && !e.shiftKey && !e.isComposing && !
|
|
200
|
+
}), S), o.$$keydown = (e) => {
|
|
201
|
+
e.key === "Enter" && !e.shiftKey && !e.isComposing && !T && (e.preventDefault(), le());
|
|
191
202
|
}, o.addEventListener("compositionend", (e) => {
|
|
192
|
-
|
|
203
|
+
T = !1, t.onValueChange(e.currentTarget.value);
|
|
193
204
|
}), o.addEventListener("compositionupdate", (e) => t.onValueChange(e.currentTarget.value)), o.addEventListener("compositionstart", () => {
|
|
194
|
-
|
|
205
|
+
T = !0;
|
|
195
206
|
}), o.$$input = (e) => t.onValueChange(e.currentTarget.value), o.addEventListener("paste", (e) => {
|
|
196
|
-
!t.attachment || !e.clipboardData?.files.length || (e.preventDefault(),
|
|
197
|
-
}),
|
|
198
|
-
|
|
199
|
-
}, o), c(
|
|
207
|
+
!t.attachment || !e.clipboardData?.files.length || (e.preventDefault(), ee(Array.from(e.clipboardData.files)));
|
|
208
|
+
}), te((e) => {
|
|
209
|
+
b = e, t.editorRef?.(e);
|
|
210
|
+
}, o), c(h, f(E, {
|
|
200
211
|
get when() {
|
|
201
212
|
return t.attachment;
|
|
202
213
|
},
|
|
203
214
|
get children() {
|
|
204
215
|
return [(() => {
|
|
205
|
-
var e =
|
|
216
|
+
var e = Xe();
|
|
206
217
|
e.addEventListener("change", (a) => {
|
|
207
|
-
|
|
208
|
-
}), e.addEventListener("cancel",
|
|
209
|
-
var m =
|
|
210
|
-
return typeof m == "function" ?
|
|
211
|
-
var
|
|
212
|
-
return
|
|
218
|
+
ee(Array.from(a.currentTarget.files ?? [])), a.currentTarget.value = "";
|
|
219
|
+
}), e.addEventListener("cancel", p);
|
|
220
|
+
var m = Z;
|
|
221
|
+
return typeof m == "function" ? te(m, e) : Z = e, U((a) => {
|
|
222
|
+
var g = t.attachment?.accept, M = l() || t.inputDisabled;
|
|
223
|
+
return g !== a.e && x(e, "accept", a.e = g), M !== a.t && (e.disabled = a.t = M), a;
|
|
213
224
|
}, {
|
|
214
225
|
e: void 0,
|
|
215
226
|
t: void 0
|
|
216
227
|
}), e;
|
|
217
|
-
})(),
|
|
228
|
+
})(), f(ae, {
|
|
218
229
|
variant: "ghost",
|
|
219
230
|
size: "icon",
|
|
220
231
|
icon: Be,
|
|
@@ -228,15 +239,15 @@ function it(t) {
|
|
|
228
239
|
get title() {
|
|
229
240
|
return t.attachment?.label;
|
|
230
241
|
},
|
|
231
|
-
onClick: () =>
|
|
242
|
+
onClick: () => Z?.click()
|
|
232
243
|
})];
|
|
233
244
|
}
|
|
234
|
-
}), null), c(
|
|
245
|
+
}), null), c(h, () => t.tools, null), c(h, f(E, {
|
|
235
246
|
get when() {
|
|
236
247
|
return t.selection;
|
|
237
248
|
},
|
|
238
249
|
get children() {
|
|
239
|
-
return
|
|
250
|
+
return f(He, {
|
|
240
251
|
ref: (e) => {
|
|
241
252
|
B = e;
|
|
242
253
|
},
|
|
@@ -244,8 +255,8 @@ function it(t) {
|
|
|
244
255
|
get open() {
|
|
245
256
|
return ge();
|
|
246
257
|
},
|
|
247
|
-
onOpenChange:
|
|
248
|
-
onOptionSelect:
|
|
258
|
+
onOpenChange: re,
|
|
259
|
+
onOptionSelect: p,
|
|
249
260
|
get zIndex() {
|
|
250
261
|
return (t.zIndex ?? 100) + 1;
|
|
251
262
|
},
|
|
@@ -285,10 +296,10 @@ function it(t) {
|
|
|
285
296
|
}
|
|
286
297
|
});
|
|
287
298
|
}
|
|
288
|
-
}), null), c($,
|
|
299
|
+
}), null), c($, f(ae, {
|
|
289
300
|
variant: "primary",
|
|
290
301
|
size: "icon",
|
|
291
|
-
icon:
|
|
302
|
+
icon: Re,
|
|
292
303
|
class: "floe-prompt-card-submit",
|
|
293
304
|
get disabled() {
|
|
294
305
|
return t.submitDisabled;
|
|
@@ -305,18 +316,18 @@ function it(t) {
|
|
|
305
316
|
get "aria-label"() {
|
|
306
317
|
return t.submitLabel;
|
|
307
318
|
},
|
|
308
|
-
onClick:
|
|
309
|
-
}), null), c(
|
|
319
|
+
onClick: le
|
|
320
|
+
}), null), c(u, f(E, {
|
|
310
321
|
get when() {
|
|
311
322
|
return t.feedback;
|
|
312
323
|
},
|
|
313
324
|
get children() {
|
|
314
|
-
var e =
|
|
325
|
+
var e = Ke();
|
|
315
326
|
return c(e, () => t.feedback), e;
|
|
316
327
|
}
|
|
317
|
-
}), null),
|
|
318
|
-
var m =
|
|
319
|
-
return m !== e.e &&
|
|
328
|
+
}), null), U((e) => {
|
|
329
|
+
var m = R() ? "absolute" : "fixed", a = `${oe().x}px`, g = `${oe().y}px`, M = `${C().availableWidth / I().x}px`, q = `${C().maxHeight / I().y}px`, V = `${C().originX / I().x}px`, _ = t.zIndex ?? 100, D = fe("floe-prompt-card floe-floating-presence", t.class), N = C().side, W = w.state(), X = w.exiting(), K = w.exiting() ? "true" : void 0, ce = t.inputLabel, se = t.placeholder, de = l() || t.inputDisabled;
|
|
330
|
+
return m !== e.e && P(n, "position", e.e = m), a !== e.t && P(n, "left", e.t = a), g !== e.a && P(n, "top", e.a = g), M !== e.o && P(n, "--floe-prompt-max-width", e.o = M), q !== e.i && P(n, "--floe-prompt-max-height", e.i = q), V !== e.n && P(n, "--floe-prompt-origin-x", e.n = V), _ !== e.s && P(n, "z-index", e.s = _), D !== e.h && Me(i, e.h = D), N !== e.r && x(i, "data-floating-side", e.r = N), W !== e.d && x(i, "data-floating-presence", e.d = W), X !== e.l && (i.inert = e.l = X), K !== e.u && x(i, "aria-hidden", e.u = K), 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;
|
|
320
331
|
}, {
|
|
321
332
|
e: void 0,
|
|
322
333
|
t: void 0,
|
|
@@ -333,14 +344,14 @@ function it(t) {
|
|
|
333
344
|
c: void 0,
|
|
334
345
|
w: void 0,
|
|
335
346
|
m: void 0
|
|
336
|
-
}),
|
|
347
|
+
}), U(() => o.value = t.value), n;
|
|
337
348
|
}
|
|
338
349
|
});
|
|
339
350
|
}
|
|
340
351
|
});
|
|
341
352
|
}
|
|
342
|
-
|
|
353
|
+
Pe(["pointerdown", "focusin", "keydown", "input"]);
|
|
343
354
|
export {
|
|
344
|
-
|
|
345
|
-
|
|
355
|
+
ot as PromptCard,
|
|
356
|
+
je as capturePromptCardAnchor
|
|
346
357
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type JSX } from 'solid-js';
|
|
2
2
|
import type { FloeThemePreset } from '../../themes';
|
|
3
|
+
import { type ThemeStudioProps } from './ThemeStudio';
|
|
3
4
|
export interface ThemePickerProps {
|
|
5
|
+
studio?: ThemeStudioProps;
|
|
4
6
|
mode: string;
|
|
5
7
|
modes: readonly {
|
|
6
8
|
value: string;
|
|
@@ -1,35 +1,36 @@
|
|
|
1
|
-
import { insert as d, createComponent as
|
|
2
|
-
import { createUniqueId as
|
|
3
|
-
import { Check as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { insert as d, createComponent as u, effect as y, setAttribute as o, memo as z, mergeProps as B, setStyleProperty as v, template as f, use as J, delegateEvents as K } from "solid-js/web";
|
|
2
|
+
import { createUniqueId as N, onCleanup as Q, createEffect as V, For as x, Show as I } from "solid-js";
|
|
3
|
+
import { Check as W } from "../icons/index.js";
|
|
4
|
+
import { ThemeStudio as X } from "./ThemeStudio.js";
|
|
5
|
+
var Y = /* @__PURE__ */ f("<p role=alert class=floe-theme-picker__error>"), Z = /* @__PURE__ */ f("<div class=floe-theme-picker><div class=floe-theme-picker__toolbar><div role=radiogroup class=floe-theme-picker__modes></div><span role=status aria-live=polite class=floe-theme-picker__status></span></div><div role=radiogroup class=floe-theme-picker__presets>"), p = /* @__PURE__ */ f("<button type=button role=radio>"), ee = /* @__PURE__ */ f("<button type=button role=radio><span class=floe-theme-picker__preview aria-hidden=true><span class=floe-theme-picker__preview-sidebar></span><span class=floe-theme-picker__preview-body><i></i><span></span></span></span><span class=floe-theme-picker__caption><span></span><span class=floe-theme-picker__check aria-hidden=true>"), re = /* @__PURE__ */ f("<i>");
|
|
6
|
+
function ne(t) {
|
|
7
|
+
const O = N();
|
|
8
|
+
let $, g, S = !1;
|
|
9
|
+
Q(() => {
|
|
10
|
+
S = !0;
|
|
11
|
+
}), V(() => {
|
|
12
|
+
const n = t.presets.map((l) => l.name);
|
|
13
|
+
!g || n.includes(g) || queueMicrotask(() => {
|
|
14
|
+
if (S) return;
|
|
14
15
|
$?.querySelector('[aria-checked="true"]')?.focus({
|
|
15
16
|
preventScroll: !0
|
|
16
17
|
});
|
|
17
18
|
});
|
|
18
19
|
});
|
|
19
|
-
const
|
|
20
|
-
const
|
|
20
|
+
const C = (n) => {
|
|
21
|
+
const l = [...n.currentTarget.querySelectorAll('[role="radio"]')], c = l.indexOf(n.target);
|
|
21
22
|
if (c < 0) return;
|
|
22
|
-
const
|
|
23
|
-
|
|
23
|
+
const h = n.key === "Home" ? 0 : n.key === "End" ? l.length - 1 : ["ArrowRight", "ArrowDown"].includes(n.key) ? (c + 1) % l.length : ["ArrowLeft", "ArrowUp"].includes(n.key) ? (c - 1 + l.length) % l.length : null;
|
|
24
|
+
h !== null && (n.preventDefault(), l[h]?.focus(), l[h]?.click());
|
|
24
25
|
};
|
|
25
26
|
return (() => {
|
|
26
|
-
var
|
|
27
|
-
c.$$keydown =
|
|
27
|
+
var n = Z(), l = n.firstChild, c = l.firstChild, h = c.nextSibling, s = l.nextSibling;
|
|
28
|
+
c.$$keydown = C, d(c, u(x, {
|
|
28
29
|
get each() {
|
|
29
30
|
return t.modes;
|
|
30
31
|
},
|
|
31
32
|
children: (e) => (() => {
|
|
32
|
-
var i =
|
|
33
|
+
var i = p();
|
|
33
34
|
return i.$$click = () => {
|
|
34
35
|
t.pending || t.onModeChange(e.value);
|
|
35
36
|
}, d(i, () => e.label), y((a) => {
|
|
@@ -42,34 +43,39 @@ function ie(t) {
|
|
|
42
43
|
o: void 0
|
|
43
44
|
}), i;
|
|
44
45
|
})()
|
|
45
|
-
})), d(
|
|
46
|
-
var e =
|
|
46
|
+
})), d(h, (() => {
|
|
47
|
+
var e = z(() => !!t.pending);
|
|
47
48
|
return () => e() ? t.pendingLabel : "";
|
|
48
|
-
})()),
|
|
49
|
+
})()), d(l, u(I, {
|
|
50
|
+
get when() {
|
|
51
|
+
return t.studio;
|
|
52
|
+
},
|
|
53
|
+
children: (e) => u(X, B(e))
|
|
54
|
+
}), null), s.$$keydown = C, s.$$focusout = (e) => {
|
|
49
55
|
e.relatedTarget && !e.currentTarget.contains(e.relatedTarget) && (g = void 0);
|
|
50
56
|
}, s.$$focusin = (e) => {
|
|
51
57
|
g = e.target.closest("[data-theme-preset]")?.dataset.themePreset;
|
|
52
58
|
};
|
|
53
59
|
var P = $;
|
|
54
|
-
return typeof P == "function" ?
|
|
60
|
+
return typeof P == "function" ? J(P, s) : $ = s, d(s, u(x, {
|
|
55
61
|
get each() {
|
|
56
62
|
return t.presets;
|
|
57
63
|
},
|
|
58
64
|
children: (e) => (() => {
|
|
59
|
-
var i =
|
|
65
|
+
var i = ee(), a = i.firstChild, b = a.firstChild, k = b.nextSibling, _ = k.firstChild, w = _.nextSibling, R = a.nextSibling, A = R.firstChild, j = A.nextSibling;
|
|
60
66
|
return i.$$click = () => {
|
|
61
67
|
t.pending || t.onPresetChange(e);
|
|
62
|
-
}, d(w,
|
|
68
|
+
}, d(w, u(x, {
|
|
63
69
|
get each() {
|
|
64
70
|
return e.preview?.colors?.slice(0, 4);
|
|
65
71
|
},
|
|
66
72
|
children: (r) => (() => {
|
|
67
|
-
var
|
|
68
|
-
return
|
|
73
|
+
var m = re();
|
|
74
|
+
return v(m, "background", r), m;
|
|
69
75
|
})()
|
|
70
|
-
})), d(A, () => t.presetLabel(e)), d(
|
|
71
|
-
var
|
|
72
|
-
return
|
|
76
|
+
})), d(A, () => t.presetLabel(e)), d(j, u(W, {})), y((r) => {
|
|
77
|
+
var m = e.name, L = t.presetLabel(e), T = t.selectedPreset === e.name, q = t.selectedPreset === e.name ? 0 : -1, E = !!t.pending, D = t.pending === e.name, M = e.preview?.background, U = e.preview?.surface, F = e.preview?.sidebar, G = e.preview?.border, H = e.preview?.primary;
|
|
78
|
+
return m !== r.e && o(i, "data-theme-preset", r.e = m), L !== r.t && o(i, "aria-label", r.t = L), T !== r.a && o(i, "aria-checked", r.a = T), q !== r.o && o(i, "tabindex", r.o = q), E !== r.i && o(i, "aria-disabled", r.i = E), D !== r.n && o(i, "aria-busy", r.n = D), M !== r.s && v(a, "--theme-preview-bg", r.s = M), U !== r.h && v(a, "--theme-preview-surface", r.h = U), F !== r.r && v(a, "--theme-preview-sidebar", r.r = F), G !== r.d && v(a, "--theme-preview-border", r.d = G), H !== r.l && v(a, "--theme-preview-primary", r.l = H), r;
|
|
73
79
|
}, {
|
|
74
80
|
e: void 0,
|
|
75
81
|
t: void 0,
|
|
@@ -84,13 +90,13 @@ function ie(t) {
|
|
|
84
90
|
l: void 0
|
|
85
91
|
}), i;
|
|
86
92
|
})()
|
|
87
|
-
})), d(
|
|
93
|
+
})), d(n, u(I, {
|
|
88
94
|
get when() {
|
|
89
95
|
return t.error;
|
|
90
96
|
},
|
|
91
97
|
get children() {
|
|
92
|
-
var e =
|
|
93
|
-
return o(e, "id", `${
|
|
98
|
+
var e = Y();
|
|
99
|
+
return o(e, "id", `${O}-error`), d(e, () => t.error), e;
|
|
94
100
|
}
|
|
95
101
|
}), null), y((e) => {
|
|
96
102
|
var i = t.modeLabel, a = t.presetsLabel;
|
|
@@ -98,10 +104,10 @@ function ie(t) {
|
|
|
98
104
|
}, {
|
|
99
105
|
e: void 0,
|
|
100
106
|
t: void 0
|
|
101
|
-
}),
|
|
107
|
+
}), n;
|
|
102
108
|
})();
|
|
103
109
|
}
|
|
104
|
-
|
|
110
|
+
K(["keydown", "focusin", "focusout", "click"]);
|
|
105
111
|
export {
|
|
106
|
-
|
|
112
|
+
ne as ThemePicker
|
|
107
113
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type FloeThemeDocument } from '../../themes';
|
|
2
|
+
export type ThemeStudioLabel = 'create' | 'edit' | 'import' | 'export' | 'generate' | 'name' | 'colors' | 'advanced' | 'save' | 'cancel' | 'invalid' | 'failed' | 'background' | 'foreground' | 'primary' | 'card' | 'sidebar' | 'border';
|
|
3
|
+
export interface ThemeStudioProps {
|
|
4
|
+
active: boolean;
|
|
5
|
+
current: FloeThemeDocument;
|
|
6
|
+
currentID?: string;
|
|
7
|
+
label: (key: ThemeStudioLabel) => string;
|
|
8
|
+
save: (document: FloeThemeDocument, existingID?: string) => Promise<void>;
|
|
9
|
+
generate?: (base: FloeThemeDocument) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function ThemeStudio(props: ThemeStudioProps): import("solid-js").JSX.Element;
|