@floegence/floe-webapp-core 0.101.52 → 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/ui/ThemeFields.d.ts +18 -0
- package/dist/components/ui/ThemeFields.js +327 -0
- package/dist/components/ui/ThemeStudio.d.ts +11 -6
- package/dist/components/ui/ThemeStudio.js +229 -133
- package/dist/context/ThemeContext.js +41 -40
- 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.css +1 -1
- package/dist/surface.css +15 -15
- package/dist/themes/porcelain-light.css +2 -2
- package/dist/themes.d.ts +1 -0
- package/dist/themes.js +22 -14
- package/dist/ui.css +9 -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
|
@@ -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,11 +1,16 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
|
|
1
|
+
import { type JSX } from 'solid-js';
|
|
2
|
+
import { type FloeThemePreset, type PortableShellTheme } from '../../themes';
|
|
3
|
+
import { type ThemeFieldLabel } from './ThemeFields';
|
|
4
|
+
export type ThemeStudioLabel = ThemeFieldLabel | 'compare' | 'create' | 'edit' | 'import' | 'export' | 'generate' | 'name' | 'colors' | 'advanced' | 'save' | 'cancel' | 'invalid' | 'failed' | 'background' | 'foreground' | 'primary' | 'card' | 'sidebar' | 'border';
|
|
3
5
|
export interface ThemeStudioProps {
|
|
4
6
|
active: boolean;
|
|
5
|
-
current:
|
|
7
|
+
current: PortableShellTheme;
|
|
8
|
+
parts?: readonly string[];
|
|
9
|
+
features?: readonly string[];
|
|
10
|
+
renderPreview?: (preset: FloeThemePreset, inspect: (group: 'colors' | 'parts' | 'editor' | 'terminal', role: string) => void) => JSX.Element;
|
|
6
11
|
currentID?: string;
|
|
7
12
|
label: (key: ThemeStudioLabel) => string;
|
|
8
|
-
save: (document:
|
|
9
|
-
generate?: (base:
|
|
13
|
+
save: (document: PortableShellTheme, existingID?: string) => Promise<void>;
|
|
14
|
+
generate?: (base: PortableShellTheme) => void;
|
|
10
15
|
}
|
|
11
|
-
export declare function ThemeStudio(props: ThemeStudioProps):
|
|
16
|
+
export declare function ThemeStudio(props: ThemeStudioProps): JSX.Element;
|