@floegence/floe-webapp-core 0.101.50 → 0.102.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/media/ImageAnnotationSurface.js +99 -92
- package/dist/components/ui/ThemeFields.d.ts +18 -0
- package/dist/components/ui/ThemeFields.js +327 -0
- package/dist/components/ui/ThemePicker.d.ts +2 -0
- package/dist/components/ui/ThemePicker.js +43 -37
- package/dist/components/ui/ThemeStudio.d.ts +16 -0
- package/dist/components/ui/ThemeStudio.js +381 -0
- package/dist/context/FloeConfigContext.d.ts +1 -0
- package/dist/context/ThemeContext.js +57 -56
- package/dist/floe.css +1 -1
- package/dist/styles/themes/index.d.ts +1 -0
- package/dist/styles/themes/portableTheme.d.ts +30 -0
- package/dist/styles/themes/portableTheme.js +289 -0
- package/dist/styles/themes/presets.d.ts +3 -0
- package/dist/styles/themes/presets.js +3 -0
- 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/surface.css +15 -15
- package/dist/themes/porcelain-light.css +2 -2
- package/dist/themes.d.ts +2 -0
- package/dist/themes.js +22 -9
- package/dist/ui.css +27 -0
- package/dist/workbench-composition.css +2 -2
- package/dist/workbench-themes.css +1 -1
- package/dist/workbench.css +1 -1
- package/package.json +1 -1
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
import { use as W, insert as j, createComponent as D, effect as
|
|
1
|
+
import { use as W, insert as j, createComponent as D, effect as N, setAttribute as c, setStyleProperty as k, memo as G, className as tt, template as Y, delegateEvents as et } from "solid-js/web";
|
|
2
2
|
import { createSignal as J, createMemo as it, onMount as nt, onCleanup as at, For as Q, Show as V } from "solid-js";
|
|
3
|
-
import { imageAnnotationMarkup as Z, validateImageAnnotation as
|
|
4
|
-
var rt = /* @__PURE__ */
|
|
3
|
+
import { imageAnnotationMarkup as Z, validateImageAnnotation as X, imagePointFromClient as ot } from "./imageAnnotation.js";
|
|
4
|
+
var rt = /* @__PURE__ */ Y("<div data-floe-image-annotation style=width:100%;height:100%;overscroll-behavior:contain><div style=display:grid;place-items:center><svg xmlns=http://www.w3.org/2000/svg role=img style=display:block;user-select:none;flex:none><image></image><g data-annotation-target>"), dt = /* @__PURE__ */ Y("<svg><g style=pointer-events:none></svg>", !1, !0, !1), lt = /* @__PURE__ */ Y("<svg><rect data-annotation-target fill=white stroke=#111827></svg>", !1, !0, !1);
|
|
5
5
|
function gt(e) {
|
|
6
|
-
let
|
|
6
|
+
let f, v;
|
|
7
7
|
const [P, $] = J({
|
|
8
8
|
width: 1,
|
|
9
9
|
height: 1
|
|
10
|
-
}), [
|
|
11
|
-
let
|
|
12
|
-
const L = () =>
|
|
10
|
+
}), [F, M] = J();
|
|
11
|
+
let x, m;
|
|
12
|
+
const L = () => F() ?? e.annotation, w = it(() => Math.min(P().width / e.width, P().height / e.height) * Math.max(1, e.zoom ?? 1)), _ = () => e.showAnnotation !== !1 && L() && X(e, L()) ? Z(e, L(), e.marker ?? (e.activeIndex !== void 0 ? e.activeIndex + 1 : 1)) : "";
|
|
13
13
|
nt(() => {
|
|
14
14
|
let i = 0;
|
|
15
|
-
const
|
|
15
|
+
const o = () => {
|
|
16
16
|
i = 0;
|
|
17
|
-
const
|
|
18
|
-
$((
|
|
19
|
-
width:
|
|
20
|
-
height:
|
|
17
|
+
const d = f.clientWidth, h = f.clientHeight;
|
|
18
|
+
$((g) => g.width === d && g.height === h ? g : {
|
|
19
|
+
width: d,
|
|
20
|
+
height: h
|
|
21
21
|
});
|
|
22
|
-
},
|
|
23
|
-
i || (i = requestAnimationFrame(
|
|
22
|
+
}, n = new ResizeObserver(() => {
|
|
23
|
+
i || (i = requestAnimationFrame(o));
|
|
24
24
|
});
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
n.observe(f), o(), at(() => {
|
|
26
|
+
n.disconnect(), cancelAnimationFrame(i);
|
|
27
27
|
});
|
|
28
28
|
});
|
|
29
|
-
const T = (i,
|
|
29
|
+
const T = (i, o = !1) => ot(e, v.getBoundingClientRect(), {
|
|
30
30
|
x: i.clientX,
|
|
31
31
|
y: i.clientY
|
|
32
|
-
},
|
|
33
|
-
if (
|
|
34
|
-
|
|
32
|
+
}, o), y = () => !!e.onChange && !e.disabled && !e.panning, B = (i) => {
|
|
33
|
+
if (m?.id === i.pointerId) {
|
|
34
|
+
f.scrollLeft = m.left + m.x - i.clientX, f.scrollTop = m.top + m.y - i.clientY;
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
|
-
const
|
|
38
|
-
if (!
|
|
39
|
-
const
|
|
40
|
-
if (!
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
43
|
-
const
|
|
37
|
+
const o = x;
|
|
38
|
+
if (!o || o.id !== i.pointerId || o.src !== e.src || !y()) return;
|
|
39
|
+
const n = T(i, !0);
|
|
40
|
+
if (!n) return;
|
|
41
|
+
const d = o.original;
|
|
42
|
+
if (d && o.corner === void 0) {
|
|
43
|
+
const h = d.kind === "rectangle" ? d.width : 0, g = d.kind === "rectangle" ? d.height : 0;
|
|
44
44
|
M({
|
|
45
|
-
...
|
|
46
|
-
x: Math.max(0, Math.min(e.width -
|
|
47
|
-
y: Math.max(0, Math.min(e.height -
|
|
45
|
+
...d,
|
|
46
|
+
x: Math.max(0, Math.min(e.width - h, d.x + n.x - o.start.x)),
|
|
47
|
+
y: Math.max(0, Math.min(e.height - g, d.y + n.y - o.start.y))
|
|
48
48
|
});
|
|
49
49
|
} else {
|
|
50
|
-
const
|
|
51
|
-
x:
|
|
52
|
-
y:
|
|
53
|
-
} :
|
|
54
|
-
Math.hypot(i.clientX -
|
|
50
|
+
const h = d?.kind === "rectangle" && o.corner !== void 0 ? {
|
|
51
|
+
x: d.x + (o.corner % 2 ? 0 : d.width),
|
|
52
|
+
y: d.y + (o.corner < 2 ? d.height : 0)
|
|
53
|
+
} : o.start, g = Math.abs(n.x - h.x), I = Math.abs(n.y - h.y);
|
|
54
|
+
Math.hypot(i.clientX - o.client.x, i.clientY - o.client.y) >= 5 && (o.dragged = !0), !o.dragged && !d ? M(o.pin ? void 0 : {
|
|
55
55
|
kind: "point",
|
|
56
|
-
...
|
|
57
|
-
}) :
|
|
56
|
+
...h
|
|
57
|
+
}) : g > 0 && I > 0 && M({
|
|
58
58
|
kind: "rectangle",
|
|
59
|
-
x: Math.min(
|
|
60
|
-
y: Math.min(
|
|
61
|
-
width:
|
|
59
|
+
x: Math.min(h.x, n.x),
|
|
60
|
+
y: Math.min(h.y, n.y),
|
|
61
|
+
width: g,
|
|
62
62
|
height: I
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
|
-
}, E = (i,
|
|
66
|
-
if (
|
|
67
|
-
|
|
65
|
+
}, E = (i, o = !1) => {
|
|
66
|
+
if (m?.id === i.pointerId) {
|
|
67
|
+
m = void 0, v.hasPointerCapture(i.pointerId) && v.releasePointerCapture(i.pointerId);
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
|
-
const
|
|
71
|
-
if (!
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
|
|
70
|
+
const n = x;
|
|
71
|
+
if (!n || n.id !== i.pointerId) return;
|
|
72
|
+
o || B(i);
|
|
73
|
+
const d = F();
|
|
74
|
+
x = void 0, M(void 0), v.hasPointerCapture(i.pointerId) && v.releasePointerCapture(i.pointerId), !(o || n.src !== e.src || !y()) && (n.pin && !n.dragged ? e.annotations?.[n.pin.index] === n.pin.annotation && e.onSelect?.(n.pin.index) : d && X(e, d) && e.onChange?.(d));
|
|
75
75
|
}, p = () => {
|
|
76
76
|
const i = L();
|
|
77
77
|
return i?.kind === "rectangle" ? [{
|
|
@@ -89,11 +89,11 @@ function gt(e) {
|
|
|
89
89
|
}] : [];
|
|
90
90
|
};
|
|
91
91
|
return (() => {
|
|
92
|
-
var i = rt(),
|
|
93
|
-
typeof
|
|
94
|
-
if (!
|
|
92
|
+
var i = rt(), o = i.firstChild, n = o.firstChild, d = n.firstChild, h = d.nextSibling, g = f;
|
|
93
|
+
typeof g == "function" ? W(g, i) : f = i, n.$$keydown = (t) => {
|
|
94
|
+
if (!y()) return;
|
|
95
95
|
if (t.key === "Escape") {
|
|
96
|
-
|
|
96
|
+
x = void 0, M(void 0);
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
99
99
|
const l = {
|
|
@@ -104,81 +104,88 @@ function gt(e) {
|
|
|
104
104
|
}[t.key];
|
|
105
105
|
if (!l && t.key !== "Enter" && t.key !== " ") return;
|
|
106
106
|
t.preventDefault();
|
|
107
|
-
const
|
|
107
|
+
const r = e.annotation ?? {
|
|
108
108
|
kind: "point",
|
|
109
109
|
x: e.width / 2,
|
|
110
110
|
y: e.height / 2
|
|
111
|
-
},
|
|
111
|
+
}, a = t.shiftKey ? 10 : 1;
|
|
112
112
|
e.onChange?.({
|
|
113
|
-
...
|
|
114
|
-
x: Math.max(0, Math.min(e.width - (
|
|
115
|
-
y: Math.max(0, Math.min(e.height - (
|
|
113
|
+
...r,
|
|
114
|
+
x: Math.max(0, Math.min(e.width - (r.kind === "rectangle" ? r.width : 0), r.x + (l?.[0] ?? 0) * a)),
|
|
115
|
+
y: Math.max(0, Math.min(e.height - (r.kind === "rectangle" ? r.height : 0), r.y + (l?.[1] ?? 0) * a))
|
|
116
116
|
});
|
|
117
|
-
},
|
|
118
|
-
if (e.panning && t.button === 0 && !
|
|
119
|
-
|
|
117
|
+
}, n.addEventListener("lostpointercapture", (t) => E(t, !0)), n.addEventListener("pointercancel", (t) => E(t, !0)), n.$$pointerup = (t) => E(t), n.$$pointermove = B, n.$$pointerdown = (t) => {
|
|
118
|
+
if (e.panning && t.button === 0 && !m) {
|
|
119
|
+
m = {
|
|
120
120
|
id: t.pointerId,
|
|
121
121
|
x: t.clientX,
|
|
122
122
|
y: t.clientY,
|
|
123
|
-
left:
|
|
124
|
-
top:
|
|
125
|
-
},
|
|
123
|
+
left: f.scrollLeft,
|
|
124
|
+
top: f.scrollTop
|
|
125
|
+
}, v.setPointerCapture(t.pointerId), t.preventDefault();
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
|
-
if (!
|
|
128
|
+
if (!y() || t.button !== 0 || x) return;
|
|
129
129
|
const l = T(t);
|
|
130
130
|
if (!l) return;
|
|
131
|
-
const
|
|
132
|
-
if (
|
|
133
|
-
e.onSelect?.(Number(
|
|
131
|
+
const r = t.target, a = r.closest("[data-annotation-index]")?.getAttribute("data-annotation-index"), s = a == null ? void 0 : e.annotations?.[Number(a)];
|
|
132
|
+
if (s && (e.annotation || e.activeIndex !== void 0)) {
|
|
133
|
+
e.onSelect?.(Number(a)), t.preventDefault();
|
|
134
134
|
return;
|
|
135
135
|
}
|
|
136
|
-
const
|
|
137
|
-
|
|
136
|
+
const u = r.getAttribute("data-corner");
|
|
137
|
+
x = {
|
|
138
138
|
id: t.pointerId,
|
|
139
139
|
start: l,
|
|
140
140
|
client: {
|
|
141
141
|
x: t.clientX,
|
|
142
142
|
y: t.clientY
|
|
143
143
|
},
|
|
144
|
+
dragged: !1,
|
|
144
145
|
src: e.src,
|
|
145
|
-
...
|
|
146
|
+
...s ? {
|
|
147
|
+
pin: {
|
|
148
|
+
index: Number(a),
|
|
149
|
+
annotation: s
|
|
150
|
+
}
|
|
151
|
+
} : {},
|
|
152
|
+
...r.closest("[data-annotation-target]") ? {
|
|
146
153
|
original: e.annotation
|
|
147
154
|
} : {},
|
|
148
|
-
...
|
|
149
|
-
corner: Number(
|
|
155
|
+
...u !== null ? {
|
|
156
|
+
corner: Number(u)
|
|
150
157
|
} : {}
|
|
151
|
-
}, M(
|
|
158
|
+
}, M(x.pin ? void 0 : x.original ?? {
|
|
152
159
|
kind: "point",
|
|
153
160
|
...l
|
|
154
|
-
}),
|
|
161
|
+
}), v.setPointerCapture(t.pointerId), v.focus({
|
|
155
162
|
preventScroll: !0
|
|
156
163
|
}), t.preventDefault();
|
|
157
164
|
};
|
|
158
|
-
var I =
|
|
159
|
-
return typeof I == "function" ? W(I,
|
|
165
|
+
var I = v;
|
|
166
|
+
return typeof I == "function" ? W(I, n) : v = n, j(n, D(Q, {
|
|
160
167
|
get each() {
|
|
161
168
|
return e.annotations?.slice(0, 99);
|
|
162
169
|
},
|
|
163
170
|
children: (t, l) => D(V, {
|
|
164
171
|
get when() {
|
|
165
|
-
return G(() => e.showAnnotation !== !1 && l() !== e.activeIndex)() &&
|
|
172
|
+
return G(() => e.showAnnotation !== !1 && l() !== e.activeIndex)() && X(e, t);
|
|
166
173
|
},
|
|
167
174
|
get children() {
|
|
168
|
-
var
|
|
169
|
-
return
|
|
170
|
-
var
|
|
171
|
-
return
|
|
175
|
+
var r = dt();
|
|
176
|
+
return N((a) => {
|
|
177
|
+
var s = l(), u = Z(e, t, l() + 1), b = e.cursor ?? (e.onSelect ? "pointer" : void 0);
|
|
178
|
+
return s !== a.e && c(r, "data-annotation-index", a.e = s), u !== a.t && (r.innerHTML = a.t = u), b !== a.a && k(r, "cursor", a.a = b), a;
|
|
172
179
|
}, {
|
|
173
180
|
e: void 0,
|
|
174
181
|
t: void 0,
|
|
175
182
|
a: void 0
|
|
176
|
-
}),
|
|
183
|
+
}), r;
|
|
177
184
|
}
|
|
178
185
|
})
|
|
179
|
-
}),
|
|
186
|
+
}), h), j(n, D(V, {
|
|
180
187
|
get when() {
|
|
181
|
-
return G(() => !!
|
|
188
|
+
return G(() => !!y())() && e.showAnnotation !== !1;
|
|
182
189
|
},
|
|
183
190
|
get children() {
|
|
184
191
|
return D(Q, {
|
|
@@ -186,10 +193,10 @@ function gt(e) {
|
|
|
186
193
|
return p();
|
|
187
194
|
},
|
|
188
195
|
children: (t, l) => (() => {
|
|
189
|
-
var
|
|
190
|
-
return
|
|
191
|
-
var
|
|
192
|
-
return
|
|
196
|
+
var r = lt();
|
|
197
|
+
return N((a) => {
|
|
198
|
+
var s = l(), u = t.x - 5 / w(), b = t.y - 5 / w(), C = 10 / w(), A = 10 / w(), S = 1 / w(), z = e.cursor ?? (l() === 0 || l() === 3 ? "nwse-resize" : "nesw-resize");
|
|
199
|
+
return s !== a.e && c(r, "data-corner", a.e = s), u !== a.t && c(r, "x", a.t = u), b !== a.a && c(r, "y", a.a = b), C !== a.o && c(r, "width", a.o = C), A !== a.i && c(r, "height", a.i = A), S !== a.n && c(r, "stroke-width", a.n = S), z !== a.s && k(r, "cursor", a.s = z), a;
|
|
193
200
|
}, {
|
|
194
201
|
e: void 0,
|
|
195
202
|
t: void 0,
|
|
@@ -198,13 +205,13 @@ function gt(e) {
|
|
|
198
205
|
i: void 0,
|
|
199
206
|
n: void 0,
|
|
200
207
|
s: void 0
|
|
201
|
-
}),
|
|
208
|
+
}), r;
|
|
202
209
|
})()
|
|
203
210
|
});
|
|
204
211
|
}
|
|
205
|
-
}), null),
|
|
206
|
-
var l = e.class,
|
|
207
|
-
return l !== t.e && tt(i, t.e = l),
|
|
212
|
+
}), null), N((t) => {
|
|
213
|
+
var l = e.class, r = (e.zoom ?? 1) > 1 ? "auto" : "hidden", a = (e.zoom ?? 1) > 1 ? "stable" : "auto", s = `${Math.max(P().width, e.width * w())}px`, u = `${Math.max(P().height, e.height * w())}px`, b = e.width * w(), C = e.height * w(), A = `0 0 ${e.width} ${e.height}`, S = e.label, z = y() ? 0 : void 0, H = y() || e.panning ? "none" : "auto", R = e.cursor ?? (e.panning ? "grab" : y() ? "crosshair" : "default"), q = e.src, K = e.width, O = e.height, U = _();
|
|
214
|
+
return l !== t.e && tt(i, t.e = l), r !== t.t && k(i, "overflow", t.t = r), a !== t.a && k(i, "scrollbar-gutter", t.a = a), s !== t.o && k(o, "width", t.o = s), u !== t.i && k(o, "height", t.i = u), b !== t.n && c(n, "width", t.n = b), C !== t.s && c(n, "height", t.s = C), A !== t.h && c(n, "viewBox", t.h = A), S !== t.r && c(n, "aria-label", t.r = S), z !== t.d && c(n, "tabindex", t.d = z), H !== t.l && k(n, "touch-action", t.l = H), R !== t.u && k(n, "cursor", t.u = R), q !== t.c && c(d, "href", t.c = q), K !== t.w && c(d, "width", t.w = K), O !== t.m && c(d, "height", t.m = O), U !== t.f && (h.innerHTML = t.f = U), t;
|
|
208
215
|
}, {
|
|
209
216
|
e: void 0,
|
|
210
217
|
t: void 0,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type PortableShellTheme } from '../../themes';
|
|
2
|
+
declare const groups: readonly ["colors", "palette", "editor", "syntax", "terminal", "parts", "shadow", "features"];
|
|
3
|
+
type Group = (typeof groups)[number];
|
|
4
|
+
export type ThemeFieldLabel = Group | 'settings' | 'search' | 'add' | 'remove' | 'up' | 'down' | 'undo' | 'redo' | 'invalid' | 'name';
|
|
5
|
+
export declare function ThemeFields(props: {
|
|
6
|
+
document: PortableShellTheme;
|
|
7
|
+
parts?: readonly string[];
|
|
8
|
+
features?: readonly string[];
|
|
9
|
+
inspect?: {
|
|
10
|
+
group: Group;
|
|
11
|
+
role: string;
|
|
12
|
+
};
|
|
13
|
+
disabled: boolean;
|
|
14
|
+
label: (key: ThemeFieldLabel) => string;
|
|
15
|
+
update: (doc: PortableShellTheme) => void;
|
|
16
|
+
invalid: (message: string) => void;
|
|
17
|
+
}): import("solid-js").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import { insert as r, createComponent as n, setAttribute as U, effect as y, template as g, use as X, delegateEvents as Y } from "solid-js/web";
|
|
2
|
+
import { createSignal as S, createEffect as Z, For as f, Show as v, Index as V } from "solid-js";
|
|
3
|
+
import { Plus as O, ArrowUp as p, ArrowDown as ee, Trash as H } from "../icons/index.js";
|
|
4
|
+
import { Button as b } from "./Button.js";
|
|
5
|
+
import { Input as _ } from "./Input.js";
|
|
6
|
+
import { shellColorRoles as te, terminalThemeRoles as le, readPortableShellTheme as re } from "../../styles/themes/portableTheme.js";
|
|
7
|
+
var ne = /* @__PURE__ */ g("<div class=floe-theme-fields__tools>"), ae = /* @__PURE__ */ g("<p role=alert>"), ue = /* @__PURE__ */ g("<details class=floe-theme-fields><summary></summary><fieldset><div class=floe-theme-fields__tools><select></select></div><div class=floe-theme-fields__list></div><datalist id=floe-theme-references>"), A = /* @__PURE__ */ g("<option>"), ce = /* @__PURE__ */ g("<label class=floe-theme-fields__row><span></span><input type=color>"), J = /* @__PURE__ */ g("<label><input type=checkbox>"), M = /* @__PURE__ */ g("<div class=floe-theme-fields__rule>"), ie = /* @__PURE__ */ g("<label>");
|
|
8
|
+
const oe = ["colors", "palette", "editor", "syntax", "terminal", "parts", "shadow", "features"];
|
|
9
|
+
function ve(t) {
|
|
10
|
+
const [d, R] = S("colors"), [F, z] = S(""), [C, P] = S(""), [q, E] = S("");
|
|
11
|
+
let k;
|
|
12
|
+
Z(() => {
|
|
13
|
+
const a = t.inspect;
|
|
14
|
+
a && k && (k.open = !0, R(a.group), z(a.role), k.scrollIntoView({
|
|
15
|
+
block: "nearest"
|
|
16
|
+
}));
|
|
17
|
+
});
|
|
18
|
+
const h = (a) => {
|
|
19
|
+
try {
|
|
20
|
+
t.update(re({
|
|
21
|
+
...t.document,
|
|
22
|
+
...a
|
|
23
|
+
})), E(""), t.invalid("");
|
|
24
|
+
} catch (s) {
|
|
25
|
+
const i = s.message;
|
|
26
|
+
E(i), t.invalid(i);
|
|
27
|
+
}
|
|
28
|
+
}, $ = () => {
|
|
29
|
+
const a = d();
|
|
30
|
+
return a === "syntax" || a === "shadow" || a === "features" ? {} : t.document[a] ?? {};
|
|
31
|
+
}, L = (a) => a.toLowerCase().includes(F().trim().toLowerCase()), Q = () => [.../* @__PURE__ */ new Set([...Object.keys($()), ...d() === "colors" ? te : d() === "terminal" ? le : d() === "parts" ? t.parts ?? [] : []])].filter(L).sort(), j = (a, s) => {
|
|
32
|
+
const i = {
|
|
33
|
+
...$()
|
|
34
|
+
};
|
|
35
|
+
s ? i[a] = s : delete i[a], h({
|
|
36
|
+
[d()]: i
|
|
37
|
+
});
|
|
38
|
+
}, I = (a, s) => h({
|
|
39
|
+
syntax: t.document.syntax.map((i, m) => m === a ? {
|
|
40
|
+
...i,
|
|
41
|
+
...s
|
|
42
|
+
} : i)
|
|
43
|
+
}), B = (a, s) => {
|
|
44
|
+
const i = [...t.document.syntax];
|
|
45
|
+
i.splice(a + s, 0, ...i.splice(a, 1)), h({
|
|
46
|
+
syntax: i
|
|
47
|
+
});
|
|
48
|
+
}, D = (a, s) => h({
|
|
49
|
+
shadow: t.document.shadow.map((i, m) => m === a ? {
|
|
50
|
+
...i,
|
|
51
|
+
...s
|
|
52
|
+
} : i)
|
|
53
|
+
});
|
|
54
|
+
return (() => {
|
|
55
|
+
var a = ue(), s = a.firstChild, i = s.nextSibling, m = i.firstChild, x = m.firstChild, w = m.nextSibling, G = w.nextSibling, K = k;
|
|
56
|
+
return typeof K == "function" ? X(K, a) : k = a, r(s, () => t.label("settings")), x.addEventListener("change", (e) => {
|
|
57
|
+
R(e.currentTarget.value), E(""), z(""), P("");
|
|
58
|
+
}), r(x, n(f, {
|
|
59
|
+
each: oe,
|
|
60
|
+
children: (e) => (() => {
|
|
61
|
+
var l = A();
|
|
62
|
+
return l.value = e, r(l, () => t.label(e)), l;
|
|
63
|
+
})()
|
|
64
|
+
})), r(m, n(_, {
|
|
65
|
+
type: "search",
|
|
66
|
+
get "aria-label"() {
|
|
67
|
+
return t.label("search");
|
|
68
|
+
},
|
|
69
|
+
get placeholder() {
|
|
70
|
+
return t.label("search");
|
|
71
|
+
},
|
|
72
|
+
get value() {
|
|
73
|
+
return F();
|
|
74
|
+
},
|
|
75
|
+
onInput: (e) => z(e.currentTarget.value)
|
|
76
|
+
}), null), r(w, n(v, {
|
|
77
|
+
get when() {
|
|
78
|
+
return !["syntax", "shadow", "features"].includes(d());
|
|
79
|
+
},
|
|
80
|
+
get children() {
|
|
81
|
+
return n(f, {
|
|
82
|
+
get each() {
|
|
83
|
+
return Q();
|
|
84
|
+
},
|
|
85
|
+
children: (e) => (() => {
|
|
86
|
+
var l = ce(), c = l.firstChild, u = c.nextSibling;
|
|
87
|
+
return r(c, e), u.$$input = (o) => j(e, o.currentTarget.value), U(u, "aria-label", e), r(l, n(_, {
|
|
88
|
+
"aria-label": e,
|
|
89
|
+
list: "floe-theme-references",
|
|
90
|
+
get value() {
|
|
91
|
+
return $()[e] ?? "";
|
|
92
|
+
},
|
|
93
|
+
onChange: (o) => j(e, o.currentTarget.value)
|
|
94
|
+
}), null), y(() => u.value = /^#[a-f\d]{6}/i.test($()[e] ?? "") ? $()[e].slice(0, 7) : "#808080"), l;
|
|
95
|
+
})()
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}), null), r(w, n(v, {
|
|
99
|
+
get when() {
|
|
100
|
+
return d() === "palette" || d() === "editor";
|
|
101
|
+
},
|
|
102
|
+
get children() {
|
|
103
|
+
var e = ne();
|
|
104
|
+
return r(e, n(_, {
|
|
105
|
+
get value() {
|
|
106
|
+
return C();
|
|
107
|
+
},
|
|
108
|
+
get "aria-label"() {
|
|
109
|
+
return t.label("name");
|
|
110
|
+
},
|
|
111
|
+
onInput: (l) => P(l.currentTarget.value)
|
|
112
|
+
}), null), r(e, n(b, {
|
|
113
|
+
size: "icon",
|
|
114
|
+
icon: O,
|
|
115
|
+
get "aria-label"() {
|
|
116
|
+
return t.label("add");
|
|
117
|
+
},
|
|
118
|
+
get disabled() {
|
|
119
|
+
return !C() || Object.hasOwn($(), C());
|
|
120
|
+
},
|
|
121
|
+
onClick: () => j(C(), "#808080")
|
|
122
|
+
}), null), e;
|
|
123
|
+
}
|
|
124
|
+
}), null), r(w, n(v, {
|
|
125
|
+
get when() {
|
|
126
|
+
return d() === "features";
|
|
127
|
+
},
|
|
128
|
+
get children() {
|
|
129
|
+
return n(f, {
|
|
130
|
+
get each() {
|
|
131
|
+
return [.../* @__PURE__ */ new Set(["high-contrast", "opaque-muted-ink", ...t.features ?? [], ...t.document.features])].filter(L);
|
|
132
|
+
},
|
|
133
|
+
children: (e) => (() => {
|
|
134
|
+
var l = J(), c = l.firstChild;
|
|
135
|
+
return c.addEventListener("change", (u) => h({
|
|
136
|
+
features: u.currentTarget.checked ? [...t.document.features, e] : t.document.features.filter((o) => o !== e)
|
|
137
|
+
})), r(l, e, null), y(() => c.checked = t.document.features.includes(e)), l;
|
|
138
|
+
})()
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}), null), r(w, n(v, {
|
|
142
|
+
get when() {
|
|
143
|
+
return d() === "syntax";
|
|
144
|
+
},
|
|
145
|
+
get children() {
|
|
146
|
+
return [n(V, {
|
|
147
|
+
get each() {
|
|
148
|
+
return t.document.syntax;
|
|
149
|
+
},
|
|
150
|
+
children: (e, l) => n(v, {
|
|
151
|
+
get when() {
|
|
152
|
+
return L(e().token);
|
|
153
|
+
},
|
|
154
|
+
get children() {
|
|
155
|
+
var c = M();
|
|
156
|
+
return r(c, n(_, {
|
|
157
|
+
"aria-label": "token",
|
|
158
|
+
get value() {
|
|
159
|
+
return e().token;
|
|
160
|
+
},
|
|
161
|
+
onChange: (u) => I(l, {
|
|
162
|
+
token: u.currentTarget.value
|
|
163
|
+
})
|
|
164
|
+
}), null), r(c, n(_, {
|
|
165
|
+
"aria-label": "foreground",
|
|
166
|
+
list: "floe-theme-references",
|
|
167
|
+
get value() {
|
|
168
|
+
return e().foreground;
|
|
169
|
+
},
|
|
170
|
+
onChange: (u) => I(l, {
|
|
171
|
+
foreground: u.currentTarget.value
|
|
172
|
+
})
|
|
173
|
+
}), null), r(c, n(f, {
|
|
174
|
+
each: ["bold", "italic", "underline", "strikethrough"],
|
|
175
|
+
children: (u) => (() => {
|
|
176
|
+
var o = J(), T = o.firstChild;
|
|
177
|
+
return T.addEventListener("change", (W) => I(l, {
|
|
178
|
+
fontStyle: [...e().fontStyle?.split(" ").filter((N) => N && N !== u) ?? [], ...W.currentTarget.checked ? [u] : []].join(" ")
|
|
179
|
+
})), r(o, u, null), y(() => T.checked = e().fontStyle?.split(" ").includes(u) ?? !1), o;
|
|
180
|
+
})()
|
|
181
|
+
}), null), r(c, n(b, {
|
|
182
|
+
size: "icon",
|
|
183
|
+
icon: p,
|
|
184
|
+
get "aria-label"() {
|
|
185
|
+
return t.label("up");
|
|
186
|
+
},
|
|
187
|
+
disabled: !l,
|
|
188
|
+
onClick: () => B(l, -1)
|
|
189
|
+
}), null), r(c, n(b, {
|
|
190
|
+
size: "icon",
|
|
191
|
+
icon: ee,
|
|
192
|
+
get "aria-label"() {
|
|
193
|
+
return t.label("down");
|
|
194
|
+
},
|
|
195
|
+
get disabled() {
|
|
196
|
+
return l === t.document.syntax.length - 1;
|
|
197
|
+
},
|
|
198
|
+
onClick: () => B(l, 1)
|
|
199
|
+
}), null), r(c, n(b, {
|
|
200
|
+
size: "icon",
|
|
201
|
+
icon: H,
|
|
202
|
+
get "aria-label"() {
|
|
203
|
+
return t.label("remove");
|
|
204
|
+
},
|
|
205
|
+
onClick: () => h({
|
|
206
|
+
syntax: t.document.syntax.filter((u, o) => o !== l)
|
|
207
|
+
})
|
|
208
|
+
}), null), c;
|
|
209
|
+
}
|
|
210
|
+
})
|
|
211
|
+
}), n(b, {
|
|
212
|
+
size: "sm",
|
|
213
|
+
icon: O,
|
|
214
|
+
onClick: () => h({
|
|
215
|
+
syntax: [...t.document.syntax, {
|
|
216
|
+
token: "",
|
|
217
|
+
foreground: "@foreground"
|
|
218
|
+
}]
|
|
219
|
+
}),
|
|
220
|
+
get children() {
|
|
221
|
+
return t.label("add");
|
|
222
|
+
}
|
|
223
|
+
})];
|
|
224
|
+
}
|
|
225
|
+
}), null), r(w, n(v, {
|
|
226
|
+
get when() {
|
|
227
|
+
return d() === "shadow";
|
|
228
|
+
},
|
|
229
|
+
get children() {
|
|
230
|
+
return [n(V, {
|
|
231
|
+
get each() {
|
|
232
|
+
return t.document.shadow;
|
|
233
|
+
},
|
|
234
|
+
children: (e, l) => (() => {
|
|
235
|
+
var c = M();
|
|
236
|
+
return r(c, n(f, {
|
|
237
|
+
each: ["x", "y", "blur", "spread"],
|
|
238
|
+
children: (u) => (() => {
|
|
239
|
+
var o = ie();
|
|
240
|
+
return r(o, u, null), r(o, n(_, {
|
|
241
|
+
type: "number",
|
|
242
|
+
min: u === "blur" ? 0 : -256,
|
|
243
|
+
max: 256,
|
|
244
|
+
get value() {
|
|
245
|
+
return e()[u];
|
|
246
|
+
},
|
|
247
|
+
onChange: (T) => D(l, {
|
|
248
|
+
[u]: T.currentTarget.valueAsNumber
|
|
249
|
+
})
|
|
250
|
+
}), null), o;
|
|
251
|
+
})()
|
|
252
|
+
}), null), r(c, n(_, {
|
|
253
|
+
"aria-label": "color",
|
|
254
|
+
get value() {
|
|
255
|
+
return e().color;
|
|
256
|
+
},
|
|
257
|
+
onChange: (u) => D(l, {
|
|
258
|
+
color: u.currentTarget.value
|
|
259
|
+
})
|
|
260
|
+
}), null), r(c, n(b, {
|
|
261
|
+
size: "icon",
|
|
262
|
+
icon: H,
|
|
263
|
+
get "aria-label"() {
|
|
264
|
+
return t.label("remove");
|
|
265
|
+
},
|
|
266
|
+
onClick: () => h({
|
|
267
|
+
shadow: t.document.shadow.filter((u, o) => o !== l)
|
|
268
|
+
})
|
|
269
|
+
}), null), c;
|
|
270
|
+
})()
|
|
271
|
+
}), n(b, {
|
|
272
|
+
size: "sm",
|
|
273
|
+
icon: O,
|
|
274
|
+
get disabled() {
|
|
275
|
+
return t.document.shadow.length >= 8;
|
|
276
|
+
},
|
|
277
|
+
onClick: () => h({
|
|
278
|
+
shadow: [...t.document.shadow, {
|
|
279
|
+
x: 0,
|
|
280
|
+
y: 2,
|
|
281
|
+
blur: 6,
|
|
282
|
+
spread: 0,
|
|
283
|
+
color: "#00000033"
|
|
284
|
+
}]
|
|
285
|
+
}),
|
|
286
|
+
get children() {
|
|
287
|
+
return t.label("add");
|
|
288
|
+
}
|
|
289
|
+
})];
|
|
290
|
+
}
|
|
291
|
+
}), null), r(G, n(f, {
|
|
292
|
+
get each() {
|
|
293
|
+
return Object.keys(t.document.palette);
|
|
294
|
+
},
|
|
295
|
+
children: (e) => (() => {
|
|
296
|
+
var l = A();
|
|
297
|
+
return l.value = `$${e}`, l;
|
|
298
|
+
})()
|
|
299
|
+
}), null), r(G, n(f, {
|
|
300
|
+
get each() {
|
|
301
|
+
return Object.keys(t.document.colors);
|
|
302
|
+
},
|
|
303
|
+
children: (e) => (() => {
|
|
304
|
+
var l = A();
|
|
305
|
+
return y(() => l.value = `@${e.slice(2)}`), l;
|
|
306
|
+
})()
|
|
307
|
+
}), null), r(i, n(v, {
|
|
308
|
+
get when() {
|
|
309
|
+
return q();
|
|
310
|
+
},
|
|
311
|
+
get children() {
|
|
312
|
+
var e = ae();
|
|
313
|
+
return r(e, q), e;
|
|
314
|
+
}
|
|
315
|
+
}), null), y((e) => {
|
|
316
|
+
var l = t.disabled, c = t.label("settings");
|
|
317
|
+
return l !== e.e && (i.disabled = e.e = l), c !== e.t && U(x, "aria-label", e.t = c), e;
|
|
318
|
+
}, {
|
|
319
|
+
e: void 0,
|
|
320
|
+
t: void 0
|
|
321
|
+
}), y(() => x.value = d()), a;
|
|
322
|
+
})();
|
|
323
|
+
}
|
|
324
|
+
Y(["input"]);
|
|
325
|
+
export {
|
|
326
|
+
ve as ThemeFields
|
|
327
|
+
};
|
|
@@ -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;
|