@floegence/floe-webapp-core 0.102.0 → 0.102.1
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type JSX } from 'solid-js';
|
|
2
2
|
import { type FloeThemePreset, type PortableShellTheme } from '../../themes';
|
|
3
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';
|
|
4
|
+
export type ThemeStudioLabel = ThemeFieldLabel | 'blank' | 'light' | 'dark' | 'compare' | 'create' | 'edit' | 'import' | 'export' | 'generate' | 'name' | 'colors' | 'advanced' | 'save' | 'cancel' | 'invalid' | 'failed' | 'background' | 'foreground' | 'primary' | 'card' | 'sidebar' | 'border';
|
|
5
5
|
export interface ThemeStudioProps {
|
|
6
6
|
active: boolean;
|
|
7
7
|
current: PortableShellTheme;
|
|
@@ -1,115 +1,118 @@
|
|
|
1
|
-
import { insert as
|
|
2
|
-
import { createSignal as
|
|
3
|
-
import { Plus as
|
|
4
|
-
import { Button as
|
|
5
|
-
import { Input as Ie, Textarea as
|
|
6
|
-
import { Dialog as
|
|
7
|
-
import { readPortableShellTheme as
|
|
8
|
-
import { ThemeFields as
|
|
9
|
-
var
|
|
10
|
-
function
|
|
11
|
-
const [
|
|
12
|
-
let
|
|
13
|
-
const [
|
|
14
|
-
t !==
|
|
15
|
-
},
|
|
16
|
-
const t =
|
|
17
|
-
t !== void 0 && (
|
|
18
|
-
},
|
|
19
|
-
const t =
|
|
20
|
-
t !== void 0 && (
|
|
1
|
+
import { insert as l, createComponent as n, memo as B, effect as O, setAttribute as $e, setStyleProperty as w, template as $, use as we, delegateEvents as ye } from "solid-js/web";
|
|
2
|
+
import { createSignal as f, createEffect as le, onCleanup as Ce, createMemo as U, Show as k, For as W } from "solid-js";
|
|
3
|
+
import { Plus as Se, Pencil as Te, Upload as xe, Download as Ee, Sparkles as ie, ChevronLeft as Oe, ChevronRight as Le, Eye as ze, Check as Ne } from "../icons/index.js";
|
|
4
|
+
import { Button as v } from "./Button.js";
|
|
5
|
+
import { Input as Ie, Textarea as Je } from "./Input.js";
|
|
6
|
+
import { Dialog as Pe } from "./Dialog.js";
|
|
7
|
+
import { readPortableShellTheme as ae, resolvePortableShellTheme as Re, portableContrastIssue as je, PORTABLE_THEME_LIMIT as Fe, createBlankShellTheme as Be } from "../../styles/themes/portableTheme.js";
|
|
8
|
+
import { ThemeFields as Ue } from "./ThemeFields.js";
|
|
9
|
+
var Ae = /* @__PURE__ */ $("<div class=floe-theme-studio__actions><input hidden type=file accept=.json,application/json>"), ce = /* @__PURE__ */ $("<p role=alert class=floe-theme-picker__error>"), De = /* @__PURE__ */ $("<div class=floe-theme-studio__actions><select>"), Me = /* @__PURE__ */ $("<div class=floe-theme-studio__body><label></label><fieldset><legend></legend><div class=floe-theme-studio__swatches></div></fieldset><div class=floe-theme-studio__actions></div><details><summary>"), He = /* @__PURE__ */ $("<option>"), Ke = /* @__PURE__ */ $("<div class=floe-theme-studio__sample aria-hidden=true><aside><i></i><i></i><i></i></aside><div><strong>Aa</strong><span></span><section>"), qe = /* @__PURE__ */ $("<i>"), Ge = /* @__PURE__ */ $("<label><input type=color>");
|
|
10
|
+
function tt(e) {
|
|
11
|
+
const [L, C] = f(!1), [u, X] = f(!1), [m, z] = f(""), [A, oe] = f(), [N, S] = f(""), [D, M] = f(""), [de, ue] = f(), [H, Y] = f(!1), [se, Z] = f();
|
|
12
|
+
let K, _ = 0;
|
|
13
|
+
const [T, I] = f([]), [J, P] = f([]), y = (t) => {
|
|
14
|
+
t !== m() && (I([...T().slice(-39), m()]), P([]), z(t));
|
|
15
|
+
}, ge = () => {
|
|
16
|
+
const t = T().at(-1);
|
|
17
|
+
t !== void 0 && (P([...J(), m()]), I(T().slice(0, -1)), z(t));
|
|
18
|
+
}, ve = () => {
|
|
19
|
+
const t = J().at(-1);
|
|
20
|
+
t !== void 0 && (I([...T(), m()]), P(J().slice(0, -1)), z(t));
|
|
21
21
|
};
|
|
22
|
-
|
|
23
|
-
e.active || (
|
|
24
|
-
}),
|
|
25
|
-
|
|
22
|
+
le(() => {
|
|
23
|
+
e.active || (_++, C(!1), S(""));
|
|
24
|
+
}), Ce(() => {
|
|
25
|
+
_++;
|
|
26
26
|
});
|
|
27
|
-
const
|
|
27
|
+
const g = U(() => {
|
|
28
28
|
try {
|
|
29
29
|
return {
|
|
30
|
-
doc:
|
|
30
|
+
doc: ae(m())
|
|
31
31
|
};
|
|
32
32
|
} catch (t) {
|
|
33
33
|
return {
|
|
34
34
|
issue: t instanceof SyntaxError ? "JSON" : t.message
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
}),
|
|
38
|
-
const t =
|
|
39
|
-
return t &&
|
|
37
|
+
}), h = U(() => {
|
|
38
|
+
const t = H() ? de() : g().doc;
|
|
39
|
+
return t && Re("draft", t);
|
|
40
40
|
});
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
le(() => {
|
|
42
|
+
m(), M("");
|
|
43
43
|
});
|
|
44
|
-
const
|
|
45
|
-
const t =
|
|
46
|
-
return
|
|
47
|
-
}),
|
|
44
|
+
const R = U(() => {
|
|
45
|
+
const t = g().doc;
|
|
46
|
+
return D() || (t ? je(t) : g().issue);
|
|
47
|
+
}), j = U(() => {
|
|
48
48
|
try {
|
|
49
|
-
return JSON.parse(
|
|
49
|
+
return JSON.parse(m());
|
|
50
50
|
} catch {
|
|
51
51
|
return null;
|
|
52
52
|
}
|
|
53
|
-
}),
|
|
54
|
-
|
|
55
|
-
},
|
|
53
|
+
}), q = (t, i) => {
|
|
54
|
+
I([]), P([]), M(""), ue(t), Y(!1), Z(void 0), oe(i), z(JSON.stringify(t, null, 2)), S(""), C(!0);
|
|
55
|
+
}, be = async (t) => {
|
|
56
56
|
if (!t || !e.active) return;
|
|
57
|
-
const i = ++
|
|
57
|
+
const i = ++_;
|
|
58
58
|
try {
|
|
59
|
-
if (t.size >
|
|
60
|
-
const
|
|
61
|
-
i ===
|
|
62
|
-
} catch (
|
|
63
|
-
i ===
|
|
59
|
+
if (t.size > Fe) throw new Error("128 KiB");
|
|
60
|
+
const o = ae(await t.text());
|
|
61
|
+
i === _ && e.active && q(o);
|
|
62
|
+
} catch (o) {
|
|
63
|
+
i === _ && S(`${e.label("invalid")}: ${o instanceof SyntaxError ? "JSON" : o.message}`);
|
|
64
64
|
}
|
|
65
65
|
}, fe = () => {
|
|
66
66
|
const t = e.current, i = URL.createObjectURL(new Blob([JSON.stringify(t, null, 2) + `
|
|
67
67
|
`], {
|
|
68
68
|
type: "application/json"
|
|
69
|
-
})),
|
|
70
|
-
|
|
71
|
-
},
|
|
72
|
-
const t =
|
|
73
|
-
if (!t ||
|
|
74
|
-
|
|
75
|
-
const i =
|
|
69
|
+
})), o = document.createElement("a");
|
|
70
|
+
o.download = `${t.name.replace(/[^\p{L}\p{N}_-]+/gu, "-").slice(0, 64)}.floe-theme.json`, o.href = i, o.click(), setTimeout(() => URL.revokeObjectURL(i), 1e3);
|
|
71
|
+
}, he = async () => {
|
|
72
|
+
const t = g().doc;
|
|
73
|
+
if (!t || R() || !L() || !e.active || u()) return;
|
|
74
|
+
X(!0), S("");
|
|
75
|
+
const i = _;
|
|
76
76
|
try {
|
|
77
|
-
await e.save(t,
|
|
77
|
+
await e.save(t, A()), i === _ && C(!1);
|
|
78
78
|
} catch {
|
|
79
|
-
i ===
|
|
79
|
+
i === _ && S(e.label("failed"));
|
|
80
80
|
} finally {
|
|
81
|
-
|
|
81
|
+
X(!1);
|
|
82
82
|
}
|
|
83
|
-
},
|
|
83
|
+
}, me = ["background", "card", "sidebar", "foreground", "primary", "border"], G = (t) => {
|
|
84
|
+
const i = g().doc;
|
|
85
|
+
e.active && L() && !u() && i && !D() && t(i);
|
|
86
|
+
};
|
|
84
87
|
return [(() => {
|
|
85
|
-
var t =
|
|
86
|
-
i.addEventListener("change", (
|
|
87
|
-
const
|
|
88
|
-
|
|
88
|
+
var t = Ae(), i = t.firstChild;
|
|
89
|
+
i.addEventListener("change", (x) => {
|
|
90
|
+
const Q = x.currentTarget.files?.[0];
|
|
91
|
+
x.currentTarget.value = "", be(Q);
|
|
89
92
|
});
|
|
90
|
-
var
|
|
91
|
-
return typeof
|
|
93
|
+
var o = K;
|
|
94
|
+
return typeof o == "function" ? we(o, i) : K = i, l(t, n(v, {
|
|
92
95
|
size: "sm",
|
|
93
|
-
icon:
|
|
96
|
+
icon: Se,
|
|
94
97
|
variant: "outline",
|
|
95
98
|
get disabled() {
|
|
96
99
|
return !e.active;
|
|
97
100
|
},
|
|
98
|
-
onClick: () =>
|
|
101
|
+
onClick: () => q({
|
|
99
102
|
...e.current,
|
|
100
103
|
name: e.label("create")
|
|
101
104
|
}),
|
|
102
105
|
get children() {
|
|
103
106
|
return e.label("create");
|
|
104
107
|
}
|
|
105
|
-
}), null),
|
|
108
|
+
}), null), l(t, n(k, {
|
|
106
109
|
get when() {
|
|
107
110
|
return e.currentID;
|
|
108
111
|
},
|
|
109
112
|
get children() {
|
|
110
|
-
return
|
|
113
|
+
return n(v, {
|
|
111
114
|
size: "icon",
|
|
112
|
-
icon:
|
|
115
|
+
icon: Te,
|
|
113
116
|
get disabled() {
|
|
114
117
|
return !e.active;
|
|
115
118
|
},
|
|
@@ -120,12 +123,12 @@ function Xe(e) {
|
|
|
120
123
|
get title() {
|
|
121
124
|
return e.label("edit");
|
|
122
125
|
},
|
|
123
|
-
onClick: () =>
|
|
126
|
+
onClick: () => q(e.current, e.currentID)
|
|
124
127
|
});
|
|
125
128
|
}
|
|
126
|
-
}), null),
|
|
129
|
+
}), null), l(t, n(v, {
|
|
127
130
|
size: "icon",
|
|
128
|
-
icon:
|
|
131
|
+
icon: xe,
|
|
129
132
|
get disabled() {
|
|
130
133
|
return !e.active;
|
|
131
134
|
},
|
|
@@ -136,10 +139,10 @@ function Xe(e) {
|
|
|
136
139
|
get title() {
|
|
137
140
|
return e.label("import");
|
|
138
141
|
},
|
|
139
|
-
onClick: () =>
|
|
140
|
-
}), null),
|
|
142
|
+
onClick: () => K.click()
|
|
143
|
+
}), null), l(t, n(v, {
|
|
141
144
|
size: "icon",
|
|
142
|
-
icon:
|
|
145
|
+
icon: Ee,
|
|
143
146
|
get disabled() {
|
|
144
147
|
return !e.active;
|
|
145
148
|
},
|
|
@@ -151,14 +154,14 @@ function Xe(e) {
|
|
|
151
154
|
return e.label("export");
|
|
152
155
|
},
|
|
153
156
|
onClick: fe
|
|
154
|
-
}), null),
|
|
157
|
+
}), null), l(t, n(k, {
|
|
155
158
|
get when() {
|
|
156
159
|
return e.generate;
|
|
157
160
|
},
|
|
158
161
|
get children() {
|
|
159
|
-
return
|
|
162
|
+
return n(v, {
|
|
160
163
|
size: "sm",
|
|
161
|
-
icon:
|
|
164
|
+
icon: ie,
|
|
162
165
|
get disabled() {
|
|
163
166
|
return !e.active;
|
|
164
167
|
},
|
|
@@ -170,48 +173,48 @@ function Xe(e) {
|
|
|
170
173
|
});
|
|
171
174
|
}
|
|
172
175
|
}), null), t;
|
|
173
|
-
})(),
|
|
176
|
+
})(), n(k, {
|
|
174
177
|
get when() {
|
|
175
|
-
return
|
|
178
|
+
return B(() => !!N())() && !L();
|
|
176
179
|
},
|
|
177
180
|
get children() {
|
|
178
|
-
var t =
|
|
179
|
-
return
|
|
181
|
+
var t = ce();
|
|
182
|
+
return l(t, N), t;
|
|
180
183
|
}
|
|
181
|
-
}),
|
|
184
|
+
}), n(Pe, {
|
|
182
185
|
class: "floe-theme-studio",
|
|
183
186
|
get open() {
|
|
184
|
-
return
|
|
187
|
+
return B(() => !!e.active)() && L();
|
|
185
188
|
},
|
|
186
189
|
get title() {
|
|
187
|
-
return e.label(
|
|
190
|
+
return e.label(A() ? "edit" : "create");
|
|
188
191
|
},
|
|
189
192
|
get closeLabel() {
|
|
190
193
|
return e.label("cancel");
|
|
191
194
|
},
|
|
192
195
|
onOpenChange: (t) => {
|
|
193
|
-
|
|
196
|
+
u() || C(t);
|
|
194
197
|
},
|
|
195
198
|
get footer() {
|
|
196
|
-
return [
|
|
199
|
+
return [n(v, {
|
|
197
200
|
variant: "ghost",
|
|
198
201
|
get disabled() {
|
|
199
|
-
return
|
|
202
|
+
return u();
|
|
200
203
|
},
|
|
201
|
-
onClick: () =>
|
|
204
|
+
onClick: () => C(!1),
|
|
202
205
|
get children() {
|
|
203
206
|
return e.label("cancel");
|
|
204
207
|
}
|
|
205
|
-
}),
|
|
206
|
-
icon:
|
|
208
|
+
}), n(v, {
|
|
209
|
+
icon: Ne,
|
|
207
210
|
get loading() {
|
|
208
|
-
return
|
|
211
|
+
return u();
|
|
209
212
|
},
|
|
210
213
|
get disabled() {
|
|
211
|
-
return !!
|
|
214
|
+
return !!R();
|
|
212
215
|
},
|
|
213
216
|
onClick: () => {
|
|
214
|
-
|
|
217
|
+
he();
|
|
215
218
|
},
|
|
216
219
|
get children() {
|
|
217
220
|
return e.label("save");
|
|
@@ -219,40 +222,76 @@ function Xe(e) {
|
|
|
219
222
|
})];
|
|
220
223
|
},
|
|
221
224
|
get children() {
|
|
222
|
-
var t =
|
|
223
|
-
return
|
|
225
|
+
var t = Me(), i = t.firstChild, o = i.nextSibling, x = o.firstChild, Q = x.nextSibling, F = o.nextSibling, V = F.nextSibling, _e = V.firstChild;
|
|
226
|
+
return l(i, () => e.label("name"), null), l(i, n(Ie, {
|
|
224
227
|
maxLength: 80,
|
|
225
228
|
get value() {
|
|
226
|
-
return
|
|
229
|
+
return B(() => typeof j()?.name == "string")() ? j().name : "";
|
|
227
230
|
},
|
|
228
231
|
get disabled() {
|
|
229
|
-
return
|
|
232
|
+
return u() || !j();
|
|
230
233
|
},
|
|
231
|
-
onInput: (
|
|
232
|
-
const
|
|
233
|
-
|
|
234
|
-
...
|
|
235
|
-
name:
|
|
234
|
+
onInput: (r) => {
|
|
235
|
+
const c = j();
|
|
236
|
+
c && y(JSON.stringify({
|
|
237
|
+
...c,
|
|
238
|
+
name: r.currentTarget.value
|
|
236
239
|
}, null, 2));
|
|
237
240
|
}
|
|
238
|
-
}), null),
|
|
241
|
+
}), null), l(t, n(k, {
|
|
242
|
+
get when() {
|
|
243
|
+
return !A();
|
|
244
|
+
},
|
|
245
|
+
get children() {
|
|
246
|
+
var r = De(), c = r.firstChild;
|
|
247
|
+
return c.addEventListener("change", (a) => {
|
|
248
|
+
const s = a.currentTarget.value;
|
|
249
|
+
(s === "light" || s === "dark") && G((b) => y(JSON.stringify({
|
|
250
|
+
...b,
|
|
251
|
+
mode: s
|
|
252
|
+
}, null, 2)));
|
|
253
|
+
}), l(c, n(W, {
|
|
254
|
+
each: ["light", "dark"],
|
|
255
|
+
children: (a) => (() => {
|
|
256
|
+
var s = He();
|
|
257
|
+
return s.value = a, l(s, () => e.label(a)), s;
|
|
258
|
+
})()
|
|
259
|
+
})), l(r, n(v, {
|
|
260
|
+
size: "sm",
|
|
261
|
+
variant: "ghost",
|
|
262
|
+
get disabled() {
|
|
263
|
+
return u() || !g().doc;
|
|
264
|
+
},
|
|
265
|
+
onClick: () => G((a) => y(JSON.stringify(Be(a.mode, a.name), null, 2))),
|
|
266
|
+
get children() {
|
|
267
|
+
return e.label("blank");
|
|
268
|
+
}
|
|
269
|
+
}), null), O((a) => {
|
|
270
|
+
var s = e.label("settings"), b = u() || !g().doc;
|
|
271
|
+
return s !== a.e && $e(c, "aria-label", a.e = s), b !== a.t && (c.disabled = a.t = b), a;
|
|
272
|
+
}, {
|
|
273
|
+
e: void 0,
|
|
274
|
+
t: void 0
|
|
275
|
+
}), O(() => c.value = g().doc?.mode), r;
|
|
276
|
+
}
|
|
277
|
+
}), o), l(t, n(k, {
|
|
239
278
|
get when() {
|
|
240
|
-
return
|
|
279
|
+
return B(() => !!e.renderPreview)() && h();
|
|
241
280
|
},
|
|
242
281
|
get fallback() {
|
|
243
282
|
return (() => {
|
|
244
|
-
var
|
|
245
|
-
return
|
|
283
|
+
var r = Ke(), c = r.firstChild, a = c.nextSibling, s = a.firstChild, b = s.nextSibling, ke = b.nextSibling;
|
|
284
|
+
return l(ke, n(W, {
|
|
246
285
|
get each() {
|
|
247
|
-
return
|
|
286
|
+
return h()?.preview?.colors;
|
|
248
287
|
},
|
|
249
|
-
children: (
|
|
250
|
-
var
|
|
251
|
-
return
|
|
288
|
+
children: (d) => (() => {
|
|
289
|
+
var E = qe();
|
|
290
|
+
return w(E, "background", d), E;
|
|
252
291
|
})()
|
|
253
|
-
})),
|
|
254
|
-
var
|
|
255
|
-
return
|
|
292
|
+
})), O((d) => {
|
|
293
|
+
var E = h()?.preview?.background, p = h()?.semanticTokens?.["--foreground"], ee = h()?.preview?.border, te = h()?.preview?.sidebar, ne = h()?.preview?.surface, re = h()?.preview?.primary;
|
|
294
|
+
return E !== d.e && w(r, "background", d.e = E), p !== d.t && w(r, "color", d.t = p), ee !== d.a && w(r, "border-color", d.a = ee), te !== d.o && w(c, "background", d.o = te), ne !== d.i && w(a, "background", d.i = ne), re !== d.n && w(b, "background", d.n = re), d;
|
|
256
295
|
}, {
|
|
257
296
|
e: void 0,
|
|
258
297
|
t: void 0,
|
|
@@ -260,31 +299,31 @@ function Xe(e) {
|
|
|
260
299
|
o: void 0,
|
|
261
300
|
i: void 0,
|
|
262
301
|
n: void 0
|
|
263
|
-
}),
|
|
302
|
+
}), r;
|
|
264
303
|
})();
|
|
265
304
|
},
|
|
266
|
-
children: (
|
|
267
|
-
group:
|
|
268
|
-
role:
|
|
305
|
+
children: (r) => e.renderPreview(r(), (c, a) => Z({
|
|
306
|
+
group: c,
|
|
307
|
+
role: a
|
|
269
308
|
}))
|
|
270
|
-
}),
|
|
271
|
-
each:
|
|
272
|
-
children: (
|
|
273
|
-
var
|
|
274
|
-
return
|
|
275
|
-
const
|
|
276
|
-
|
|
277
|
-
...
|
|
309
|
+
}), o), l(x, () => e.label("colors")), l(Q, n(W, {
|
|
310
|
+
each: me,
|
|
311
|
+
children: (r) => (() => {
|
|
312
|
+
var c = Ge(), a = c.firstChild;
|
|
313
|
+
return a.$$input = (s) => {
|
|
314
|
+
const b = g().doc;
|
|
315
|
+
b && y(JSON.stringify({
|
|
316
|
+
...b,
|
|
278
317
|
colors: {
|
|
279
|
-
...
|
|
280
|
-
[`--${
|
|
318
|
+
...b.colors,
|
|
319
|
+
[`--${r}`]: s.currentTarget.value
|
|
281
320
|
}
|
|
282
321
|
}, null, 2));
|
|
283
|
-
},
|
|
322
|
+
}, l(c, () => e.label(r), null), O(() => a.value = h()?.semanticTokens?.[`--${r}`]?.slice(0, 7)), c;
|
|
284
323
|
})()
|
|
285
|
-
})),
|
|
324
|
+
})), l(F, n(v, {
|
|
286
325
|
size: "icon",
|
|
287
|
-
icon:
|
|
326
|
+
icon: Oe,
|
|
288
327
|
variant: "ghost",
|
|
289
328
|
get title() {
|
|
290
329
|
return e.label("undo");
|
|
@@ -293,12 +332,12 @@ function Xe(e) {
|
|
|
293
332
|
return e.label("undo");
|
|
294
333
|
},
|
|
295
334
|
get disabled() {
|
|
296
|
-
return
|
|
335
|
+
return u() || !T().length;
|
|
297
336
|
},
|
|
298
|
-
onClick:
|
|
299
|
-
}), null),
|
|
337
|
+
onClick: ge
|
|
338
|
+
}), null), l(F, n(v, {
|
|
300
339
|
size: "icon",
|
|
301
|
-
icon:
|
|
340
|
+
icon: Le,
|
|
302
341
|
variant: "ghost",
|
|
303
342
|
get title() {
|
|
304
343
|
return e.label("redo");
|
|
@@ -307,12 +346,12 @@ function Xe(e) {
|
|
|
307
346
|
return e.label("redo");
|
|
308
347
|
},
|
|
309
348
|
get disabled() {
|
|
310
|
-
return
|
|
349
|
+
return u() || !J().length;
|
|
311
350
|
},
|
|
312
|
-
onClick:
|
|
313
|
-
}), null),
|
|
351
|
+
onClick: ve
|
|
352
|
+
}), null), l(F, n(v, {
|
|
314
353
|
size: "icon",
|
|
315
|
-
icon:
|
|
354
|
+
icon: ze,
|
|
316
355
|
variant: "ghost",
|
|
317
356
|
get "aria-label"() {
|
|
318
357
|
return e.label("compare");
|
|
@@ -321,16 +360,16 @@ function Xe(e) {
|
|
|
321
360
|
return e.label("compare");
|
|
322
361
|
},
|
|
323
362
|
get "aria-pressed"() {
|
|
324
|
-
return
|
|
363
|
+
return H();
|
|
325
364
|
},
|
|
326
|
-
onClick: () =>
|
|
327
|
-
}), null),
|
|
365
|
+
onClick: () => Y(!H())
|
|
366
|
+
}), null), l(t, n(k, {
|
|
328
367
|
get when() {
|
|
329
|
-
return
|
|
368
|
+
return g().doc;
|
|
330
369
|
},
|
|
331
|
-
children: (
|
|
370
|
+
children: (r) => n(Ue, {
|
|
332
371
|
get document() {
|
|
333
|
-
return
|
|
372
|
+
return r();
|
|
334
373
|
},
|
|
335
374
|
get parts() {
|
|
336
375
|
return e.parts;
|
|
@@ -339,43 +378,61 @@ function Xe(e) {
|
|
|
339
378
|
return e.features;
|
|
340
379
|
},
|
|
341
380
|
get inspect() {
|
|
342
|
-
return
|
|
381
|
+
return se();
|
|
343
382
|
},
|
|
344
383
|
get disabled() {
|
|
345
|
-
return
|
|
384
|
+
return u();
|
|
346
385
|
},
|
|
347
386
|
get label() {
|
|
348
387
|
return e.label;
|
|
349
388
|
},
|
|
350
|
-
invalid:
|
|
351
|
-
update: (
|
|
389
|
+
invalid: M,
|
|
390
|
+
update: (c) => y(JSON.stringify(c, null, 2))
|
|
352
391
|
})
|
|
353
|
-
}),
|
|
392
|
+
}), V), l(_e, () => e.label("advanced")), l(V, n(Je, {
|
|
354
393
|
get "aria-label"() {
|
|
355
394
|
return e.label("advanced");
|
|
356
395
|
},
|
|
357
396
|
get value() {
|
|
358
|
-
return
|
|
397
|
+
return m();
|
|
359
398
|
},
|
|
360
399
|
rows: 9,
|
|
361
400
|
spellcheck: !1,
|
|
362
401
|
get disabled() {
|
|
363
|
-
return
|
|
402
|
+
return u();
|
|
364
403
|
},
|
|
365
|
-
onInput: (
|
|
366
|
-
}), null),
|
|
404
|
+
onInput: (r) => y(r.currentTarget.value)
|
|
405
|
+
}), null), l(t, n(k, {
|
|
406
|
+
get when() {
|
|
407
|
+
return e.generate;
|
|
408
|
+
},
|
|
409
|
+
get children() {
|
|
410
|
+
return n(v, {
|
|
411
|
+
icon: ie,
|
|
412
|
+
size: "sm",
|
|
413
|
+
variant: "ghost",
|
|
414
|
+
get disabled() {
|
|
415
|
+
return !g().doc || !!D() || u();
|
|
416
|
+
},
|
|
417
|
+
onClick: () => G((r) => e.generate?.(r)),
|
|
418
|
+
get children() {
|
|
419
|
+
return e.label("generate");
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
}), null), l(t, n(k, {
|
|
367
424
|
get when() {
|
|
368
|
-
return
|
|
425
|
+
return N() || R();
|
|
369
426
|
},
|
|
370
427
|
get children() {
|
|
371
|
-
var
|
|
372
|
-
return
|
|
428
|
+
var r = ce();
|
|
429
|
+
return l(r, () => N() || `${e.label("invalid")}: ${R()}`), r;
|
|
373
430
|
}
|
|
374
|
-
}), null),
|
|
431
|
+
}), null), O(() => o.disabled = u() || !g().doc), t;
|
|
375
432
|
}
|
|
376
433
|
})];
|
|
377
434
|
}
|
|
378
|
-
|
|
435
|
+
ye(["input"]);
|
|
379
436
|
export {
|
|
380
|
-
|
|
437
|
+
tt as ThemeStudio
|
|
381
438
|
};
|
|
@@ -27,4 +27,5 @@ export declare function exportShellTheme(preset: FloeThemePreset): PortableShell
|
|
|
27
27
|
export declare function readPortableShellTheme(source: unknown): PortableShellTheme;
|
|
28
28
|
export declare function portableContrastIssue(doc: PortableShellTheme): string | undefined;
|
|
29
29
|
export declare function resolvePortableShellTheme(id: string, input: PortableShellTheme): FloeThemePreset;
|
|
30
|
+
export declare function createBlankShellTheme(mode: 'light' | 'dark', name: string): PortableShellTheme;
|
|
30
31
|
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { builtInShellThemePresets as z, REQUIRED_SHELL_THEME_TOKENS as
|
|
2
|
-
import { resolveFloeThemeDocument as
|
|
3
|
-
const
|
|
1
|
+
import { builtInShellThemePresets as z, REQUIRED_SHELL_THEME_TOKENS as M } from "./presets.js";
|
|
2
|
+
import { resolveFloeThemeDocument as C, readFloeThemeDocument as F } from "./themeDocument.js";
|
|
3
|
+
const O = 128 * 1024, h = "--floe-window-shadow", B = [
|
|
4
4
|
...new Set(
|
|
5
5
|
z.flatMap((t) => Object.keys(t.semanticTokens ?? {}))
|
|
6
6
|
)
|
|
7
|
-
].filter((t) => t !== h).sort(),
|
|
7
|
+
].filter((t) => t !== h).sort(), T = new Set(B), A = [
|
|
8
8
|
"background",
|
|
9
9
|
"foreground",
|
|
10
10
|
"cursor",
|
|
@@ -15,7 +15,7 @@ const x = 128 * 1024, h = "--floe-window-shadow", C = [
|
|
|
15
15
|
t,
|
|
16
16
|
`bright${t[0].toUpperCase()}${t.slice(1)}`
|
|
17
17
|
])
|
|
18
|
-
],
|
|
18
|
+
], I = /* @__PURE__ */ new Set([
|
|
19
19
|
"--background",
|
|
20
20
|
"--foreground",
|
|
21
21
|
"--primary",
|
|
@@ -31,39 +31,42 @@ const x = 128 * 1024, h = "--floe-window-shadow", C = [
|
|
|
31
31
|
"--warning",
|
|
32
32
|
"--error",
|
|
33
33
|
"--info"
|
|
34
|
-
]),
|
|
34
|
+
]), R = M.filter((t) => t !== h), L = /^(?:100(?:\.0+)?|\d{1,2}(?:\.\d+)?)%$/, S = /^#[a-f\d]{6}(?:[a-f\d]{2})?$/i, E = /^rgb\((?:\d{1,3} ){2}\d{1,3}(?: \/ (?:100|\d{1,2})%)?\)$/, W = /^(?:hsl\(\d{1,3} \d{1,3}% \d{1,3}%\)|oklch\((?:0(?:\.\d+)?|1) 0(?:\.\d+)? \d{1,3}\))$/, _ = /^var\((--[a-z0-9-]+)\)$/, K = /^color-mix\(in srgb, (var\(--[a-z0-9-]+\)|#[a-fA-F0-9]{6}) (\d{1,3}%), (var\(--[a-z0-9-]+\)|white|#[a-fA-F0-9]{6})\)$/, c = (t) => {
|
|
35
35
|
throw new Error(t);
|
|
36
|
-
}, w = (t) => !!t && typeof t == "object" && !Array.isArray(t),
|
|
37
|
-
for (const
|
|
38
|
-
r.includes(
|
|
36
|
+
}, w = (t) => !!t && typeof t == "object" && !Array.isArray(t), x = (t, r, o) => {
|
|
37
|
+
for (const n of Object.keys(t))
|
|
38
|
+
r.includes(n) || c(`${o}.${n.slice(0, 80)}`);
|
|
39
39
|
}, $ = (t) => t === 0 ? "0" : `${t}px`;
|
|
40
|
-
function
|
|
40
|
+
function P(t) {
|
|
41
41
|
return t === "none" ? [] : t.split(", ").map((r) => {
|
|
42
|
-
const
|
|
42
|
+
const o = /^(-?\d+)(?:px)? (-?\d+)(?:px)? (\d+)(?:px)?(?: (-?\d+)(?:px)?)? (.+)$/.exec(
|
|
43
43
|
r
|
|
44
44
|
);
|
|
45
|
-
return
|
|
46
|
-
x: +
|
|
47
|
-
y: +
|
|
48
|
-
blur: +
|
|
49
|
-
spread: Number(
|
|
50
|
-
color:
|
|
51
|
-
} :
|
|
45
|
+
return o ? {
|
|
46
|
+
x: +o[1],
|
|
47
|
+
y: +o[2],
|
|
48
|
+
blur: +o[3],
|
|
49
|
+
spread: Number(o[4] ?? 0),
|
|
50
|
+
color: o[5]
|
|
51
|
+
} : c(h);
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
54
|
+
const N = /* @__PURE__ */ new WeakMap();
|
|
55
|
+
function v(t) {
|
|
56
|
+
const r = N.get(t);
|
|
57
|
+
if (r) return structuredClone(r);
|
|
58
|
+
const o = t.mode;
|
|
59
|
+
if (o !== "light" && o !== "dark") return c("mode");
|
|
60
|
+
const n = t.monaco?.[o];
|
|
61
|
+
if (!n) return c("editor");
|
|
62
|
+
const a = Object.fromEntries(
|
|
60
63
|
Object.entries(t.semanticTokens ?? {}).filter(
|
|
61
|
-
(
|
|
64
|
+
(f) => typeof f[1] == "string"
|
|
62
65
|
)
|
|
63
|
-
), d =
|
|
64
|
-
delete
|
|
65
|
-
const
|
|
66
|
-
for (const [
|
|
66
|
+
), d = P(a[h] ?? "none");
|
|
67
|
+
delete a[h];
|
|
68
|
+
const i = { ...n.colors };
|
|
69
|
+
for (const [f, u] of Object.entries({
|
|
67
70
|
"editor.background": "background",
|
|
68
71
|
"editorGutter.background": "background",
|
|
69
72
|
"editor.foreground": "foreground",
|
|
@@ -71,86 +74,86 @@ function P(t) {
|
|
|
71
74
|
"editor.selectionBackground": "selection-bg",
|
|
72
75
|
"editor.selectionForeground": "selection-fg"
|
|
73
76
|
}))
|
|
74
|
-
|
|
77
|
+
i[f] === a[`--${u}`] && (i[f] = `@${u}`);
|
|
75
78
|
return {
|
|
76
79
|
version: 2,
|
|
77
80
|
name: t.displayName,
|
|
78
|
-
mode:
|
|
81
|
+
mode: o,
|
|
79
82
|
features: [...t.features ?? []],
|
|
80
83
|
palette: {},
|
|
81
|
-
colors:
|
|
84
|
+
colors: a,
|
|
82
85
|
shadow: d,
|
|
83
|
-
editor:
|
|
84
|
-
syntax: n.rules.map((
|
|
86
|
+
editor: i,
|
|
87
|
+
syntax: n.rules.map((f) => ({ ...f }))
|
|
85
88
|
};
|
|
86
89
|
}
|
|
87
|
-
function b(t, r,
|
|
88
|
-
return !w(t) || Object.keys(t).length >
|
|
89
|
-
Object.entries(t).map(([
|
|
90
|
+
function b(t, r, o, n) {
|
|
91
|
+
return !w(t) || Object.keys(t).length > n ? c(r) : Object.fromEntries(
|
|
92
|
+
Object.entries(t).map(([a, d]) => !o(a) || typeof d != "string" || d.length > 256 ? c(`${r}.${a.slice(0, 80)}`) : [a, d])
|
|
90
93
|
);
|
|
91
94
|
}
|
|
92
|
-
function
|
|
93
|
-
const r = /* @__PURE__ */ new Map(),
|
|
95
|
+
function j(t) {
|
|
96
|
+
const r = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), n = (e, s) => {
|
|
94
97
|
if (!e.startsWith("$") && !e.startsWith("@")) return e;
|
|
95
98
|
const m = r.get(e);
|
|
96
99
|
if (m !== void 0) return m;
|
|
97
100
|
const l = e.startsWith("$") ? t.palette : t.colors, y = (e.startsWith("@") ? "--" : "") + e.slice(1);
|
|
98
|
-
if (!Object.hasOwn(l, y) ||
|
|
99
|
-
|
|
100
|
-
const p =
|
|
101
|
-
return
|
|
102
|
-
},
|
|
103
|
-
const l =
|
|
104
|
-
return
|
|
101
|
+
if (!Object.hasOwn(l, y) || o.has(e)) return c(`${s}: ${e}`);
|
|
102
|
+
o.add(e);
|
|
103
|
+
const p = n(l[y], s);
|
|
104
|
+
return o.delete(e), r.set(e, p), p;
|
|
105
|
+
}, a = (e, s, m) => {
|
|
106
|
+
const l = n(e, s);
|
|
107
|
+
return S.test(l) || m && (E.test(l) || W.test(l) || _.test(l) || K.test(l)) ? l : c(s);
|
|
105
108
|
};
|
|
106
|
-
for (const [e,
|
|
107
|
-
const
|
|
108
|
-
Object.entries(t.colors).map(([e,
|
|
109
|
+
for (const [e, s] of Object.entries(t.palette)) a(s, `palette.${e}`, !1);
|
|
110
|
+
const d = Object.fromEntries(
|
|
111
|
+
Object.entries(t.colors).map(([e, s]) => [
|
|
109
112
|
e,
|
|
110
|
-
e === "--floe-progress-primary-white-mix" ?
|
|
113
|
+
e === "--floe-progress-primary-white-mix" ? L.test(s) ? s : c(e) : a(s, `colors.${e}`, !I.has(e))
|
|
111
114
|
])
|
|
112
115
|
);
|
|
113
|
-
for (const [e,
|
|
114
|
-
|
|
115
|
-
|
|
116
|
+
for (const [e, s] of Object.entries(t.terminal ?? {}))
|
|
117
|
+
d[`--terminal-${e.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`)}`] = a(
|
|
118
|
+
s,
|
|
116
119
|
`terminal.${e}`,
|
|
117
120
|
!1
|
|
118
121
|
);
|
|
119
|
-
for (const [e,
|
|
120
|
-
|
|
122
|
+
for (const [e, s] of Object.entries(t.parts ?? {}))
|
|
123
|
+
d[`--theme-part-${e}`] = a(s, `parts.${e}`, !1);
|
|
121
124
|
const i = /* @__PURE__ */ new Set(), f = (e) => {
|
|
122
125
|
if (!i.has(e)) {
|
|
123
|
-
(
|
|
124
|
-
for (const
|
|
125
|
-
|
|
126
|
+
(o.has(e) || !Object.hasOwn(d, e)) && c(`colors.${e}`), o.add(e);
|
|
127
|
+
for (const s of d[e].matchAll(/var\((--[a-z0-9-]+)\)/g)) f(s[1]);
|
|
128
|
+
o.delete(e), i.add(e);
|
|
126
129
|
}
|
|
127
130
|
};
|
|
128
|
-
for (const e of Object.keys(
|
|
129
|
-
|
|
130
|
-
const k =
|
|
131
|
-
return !
|
|
131
|
+
for (const e of Object.keys(d)) f(e);
|
|
132
|
+
d[h] = t.shadow.map(({ x: e, y: s, blur: m, spread: l, color: y }, p) => {
|
|
133
|
+
const k = n(y, `shadow.${p}.color`);
|
|
134
|
+
return !S.test(k) && !E.test(k) && c(`shadow.${p}.color`), [
|
|
132
135
|
$(e),
|
|
133
|
-
$(
|
|
136
|
+
$(s),
|
|
134
137
|
$(m),
|
|
135
138
|
...l ? [$(l)] : [],
|
|
136
139
|
k
|
|
137
140
|
].join(" ");
|
|
138
141
|
}).join(", ") || "none";
|
|
139
142
|
const u = Object.fromEntries(
|
|
140
|
-
Object.entries(t.editor).map(([e,
|
|
141
|
-
), g = t.syntax.map((e,
|
|
142
|
-
const m =
|
|
143
|
-
return m.length !== 7 &&
|
|
143
|
+
Object.entries(t.editor).map(([e, s]) => [e, a(s, `editor.${e}`, !1)])
|
|
144
|
+
), g = t.syntax.map((e, s) => {
|
|
145
|
+
const m = a(e.foreground, `syntax.${s}.foreground`, !1);
|
|
146
|
+
return m.length !== 7 && c(`syntax.${s}.foreground`), { ...e, foreground: m };
|
|
144
147
|
});
|
|
145
|
-
return { tokens:
|
|
148
|
+
return { tokens: d, editor: u, syntax: g };
|
|
146
149
|
}
|
|
147
|
-
function
|
|
148
|
-
typeof t == "string" && (t.length >
|
|
150
|
+
function D(t) {
|
|
151
|
+
typeof t == "string" && (t.length > O || new TextEncoder().encode(t).length > O) && c("128 KiB");
|
|
149
152
|
const r = typeof t == "string" ? JSON.parse(t) : t;
|
|
150
|
-
if (!w(r)) return
|
|
153
|
+
if (!w(r)) return c("theme");
|
|
151
154
|
if (r.version === 1)
|
|
152
|
-
return
|
|
153
|
-
if (
|
|
155
|
+
return v(C("migration", F(r)));
|
|
156
|
+
if (x(
|
|
154
157
|
r,
|
|
155
158
|
[
|
|
156
159
|
"version",
|
|
@@ -166,37 +169,37 @@ function W(t) {
|
|
|
166
169
|
"parts"
|
|
167
170
|
],
|
|
168
171
|
"theme"
|
|
169
|
-
), r.version !== 2) return
|
|
172
|
+
), r.version !== 2) return c("version");
|
|
170
173
|
if (typeof r.name != "string" || !r.name.trim() || r.name.length > 80 || /[\p{Cc}\p{Cf}]/u.test(r.name))
|
|
171
|
-
return
|
|
172
|
-
if (r.mode !== "light" && r.mode !== "dark") return
|
|
174
|
+
return c("name");
|
|
175
|
+
if (r.mode !== "light" && r.mode !== "dark") return c("mode");
|
|
173
176
|
if (!Array.isArray(r.features) || r.features.length > 32 || r.features.some(
|
|
174
177
|
(e) => typeof e != "string" || !/^[a-z][a-z0-9-]{0,63}$/.test(e)
|
|
175
178
|
) || new Set(r.features).size !== r.features.length)
|
|
176
|
-
return
|
|
177
|
-
const
|
|
179
|
+
return c("features");
|
|
180
|
+
const o = b(
|
|
178
181
|
r.palette,
|
|
179
182
|
"palette",
|
|
180
183
|
(e) => /^[a-z][a-z0-9-]{0,63}$/.test(e),
|
|
181
184
|
256
|
|
182
|
-
),
|
|
183
|
-
for (const e of
|
|
184
|
-
if (!Array.isArray(r.shadow) || r.shadow.length > 8) return
|
|
185
|
-
const
|
|
186
|
-
if (!w(e)) return
|
|
187
|
-
|
|
185
|
+
), n = b(r.colors, "colors", (e) => T.has(e), T.size);
|
|
186
|
+
for (const e of R) Object.hasOwn(n, e) || c(`colors.${e}`);
|
|
187
|
+
if (!Array.isArray(r.shadow) || r.shadow.length > 8) return c("shadow");
|
|
188
|
+
const a = r.shadow.map((e, s) => {
|
|
189
|
+
if (!w(e)) return c(`shadow.${s}`);
|
|
190
|
+
x(e, ["x", "y", "blur", "spread", "color"], `shadow.${s}`);
|
|
188
191
|
for (const m of ["x", "y", "blur", "spread"]) {
|
|
189
192
|
const l = e[m];
|
|
190
|
-
(typeof l != "number" || !Number.isFinite(l) || Math.abs(l) > 256 || m === "blur" && l < 0) &&
|
|
193
|
+
(typeof l != "number" || !Number.isFinite(l) || Math.abs(l) > 256 || m === "blur" && l < 0) && c(`shadow.${s}.${m}`);
|
|
191
194
|
}
|
|
192
|
-
return typeof e.color != "string" || e.color.length > 100 ?
|
|
195
|
+
return typeof e.color != "string" || e.color.length > 100 ? c(`shadow.${s}.color`) : {
|
|
193
196
|
x: Number(e.x),
|
|
194
197
|
y: Number(e.y),
|
|
195
198
|
blur: Number(e.blur),
|
|
196
199
|
spread: Number(e.spread),
|
|
197
200
|
color: e.color
|
|
198
201
|
};
|
|
199
|
-
}),
|
|
202
|
+
}), d = b(
|
|
200
203
|
r.editor,
|
|
201
204
|
"editor",
|
|
202
205
|
(e) => /^[a-zA-Z][\w-]{0,79}(?:\.[\w-]{1,80}){1,5}$/.test(e),
|
|
@@ -204,11 +207,11 @@ function W(t) {
|
|
|
204
207
|
), i = r.terminal === void 0 ? void 0 : b(
|
|
205
208
|
r.terminal,
|
|
206
209
|
"terminal",
|
|
207
|
-
(e) =>
|
|
208
|
-
|
|
210
|
+
(e) => A.includes(e),
|
|
211
|
+
A.length
|
|
209
212
|
), f = r.parts === void 0 ? void 0 : b(r.parts, "parts", (e) => /^[a-z][a-z0-9-]{0,79}$/.test(e), 256);
|
|
210
|
-
if (!Array.isArray(r.syntax) || r.syntax.length > 512) return
|
|
211
|
-
const u = r.syntax.map((e,
|
|
213
|
+
if (!Array.isArray(r.syntax) || r.syntax.length > 512) return c("syntax");
|
|
214
|
+
const u = r.syntax.map((e, s) => !w(e) || typeof e.token != "string" || !/^[\w.-]{0,128}$/.test(e.token) || typeof e.foreground != "string" || e.foreground.length > 128 ? c(`syntax.${s}`) : (x(e, ["token", "foreground", "fontStyle"], `syntax.${s}`), e.fontStyle !== void 0 && (typeof e.fontStyle != "string" || !/^(?:(?:bold|italic|underline|strikethrough)(?: |$)){0,4}$/.test(e.fontStyle)) ? c(`syntax.${s}.fontStyle`) : {
|
|
212
215
|
token: e.token,
|
|
213
216
|
foreground: e.foreground,
|
|
214
217
|
...typeof e.fontStyle == "string" ? { fontStyle: e.fontStyle } : {}
|
|
@@ -217,73 +220,84 @@ function W(t) {
|
|
|
217
220
|
name: r.name.trim(),
|
|
218
221
|
mode: r.mode,
|
|
219
222
|
features: [...r.features],
|
|
220
|
-
palette:
|
|
221
|
-
colors:
|
|
222
|
-
shadow:
|
|
223
|
-
editor:
|
|
223
|
+
palette: o,
|
|
224
|
+
colors: n,
|
|
225
|
+
shadow: a,
|
|
226
|
+
editor: d,
|
|
224
227
|
syntax: u,
|
|
225
228
|
...i && { terminal: i },
|
|
226
229
|
...f && { parts: f }
|
|
227
230
|
};
|
|
228
231
|
return new TextEncoder().encode(JSON.stringify(g, null, 2) + `
|
|
229
|
-
`).length >
|
|
232
|
+
`).length > O && c("128 KiB"), j(g), g;
|
|
230
233
|
}
|
|
231
|
-
function
|
|
232
|
-
const { tokens: r } =
|
|
234
|
+
function U(t) {
|
|
235
|
+
const { tokens: r } = j(t), o = (i) => [1, 3, 5, 7].map(
|
|
233
236
|
(f, u) => u === 3 && i.length === 7 ? 1 : parseInt(i.slice(f, f + 2), 16) / 255
|
|
234
|
-
),
|
|
237
|
+
), n = (i, f) => i.slice(0, 3).map((u, g) => u * i[3] + f[g] * (1 - i[3])), a = (i) => i.reduce(
|
|
235
238
|
(f, u, g) => f + [0.2126, 0.7152, 0.0722][g] * (u <= 0.04045 ? u / 12.92 : ((u + 0.055) / 1.055) ** 2.4),
|
|
236
239
|
0
|
|
237
|
-
),
|
|
240
|
+
), d = n(o(r["--background"]), Array(3).fill(t.mode === "light" ? 1 : 0));
|
|
238
241
|
for (const [i, f] of [
|
|
239
242
|
["--background", "--foreground"],
|
|
240
243
|
["--card", "--card-foreground"],
|
|
241
244
|
["--primary", "--primary-foreground"],
|
|
242
245
|
["--sidebar", "--sidebar-foreground"]
|
|
243
246
|
]) {
|
|
244
|
-
const u = i === "--background" ?
|
|
245
|
-
if (
|
|
247
|
+
const u = i === "--background" ? d : n(o(r[i]), d), g = a(u), e = a(n(o(r[f]), u)), s = (Math.max(g, e) + 0.05) / (Math.min(g, e) + 0.05);
|
|
248
|
+
if (s < 4.5) return `${f} / ${i}: ${s.toFixed(2)}:1 < 4.5:1`;
|
|
246
249
|
}
|
|
247
250
|
}
|
|
248
|
-
function
|
|
249
|
-
const
|
|
250
|
-
return {
|
|
251
|
+
function Z(t, r) {
|
|
252
|
+
const o = D(r), { tokens: n, editor: a, syntax: d } = j(o), i = {
|
|
251
253
|
name: t,
|
|
252
|
-
displayName:
|
|
253
|
-
mode:
|
|
254
|
-
features:
|
|
255
|
-
semanticTokens:
|
|
256
|
-
tokens: { [
|
|
254
|
+
displayName: o.name,
|
|
255
|
+
mode: o.mode,
|
|
256
|
+
features: o.features,
|
|
257
|
+
semanticTokens: n,
|
|
258
|
+
tokens: { [o.mode]: n },
|
|
257
259
|
preview: {
|
|
258
|
-
background:
|
|
259
|
-
surface:
|
|
260
|
-
sidebar:
|
|
261
|
-
primary:
|
|
262
|
-
border:
|
|
260
|
+
background: n["--background"],
|
|
261
|
+
surface: n["--card"],
|
|
262
|
+
sidebar: n["--sidebar"],
|
|
263
|
+
primary: n["--primary"],
|
|
264
|
+
border: n["--border"],
|
|
263
265
|
colors: [
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
266
|
+
n["--chart-1"],
|
|
267
|
+
n["--chart-2"],
|
|
268
|
+
n["--chart-3"],
|
|
269
|
+
n["--chart-4"],
|
|
270
|
+
n["--chart-5"]
|
|
269
271
|
]
|
|
270
272
|
},
|
|
271
273
|
monaco: {
|
|
272
|
-
[
|
|
273
|
-
base:
|
|
274
|
+
[o.mode]: {
|
|
275
|
+
base: o.mode === "light" ? "vs" : "vs-dark",
|
|
274
276
|
inherit: !0,
|
|
275
|
-
colors:
|
|
276
|
-
rules:
|
|
277
|
+
colors: a,
|
|
278
|
+
rules: d
|
|
277
279
|
}
|
|
278
280
|
}
|
|
279
281
|
};
|
|
282
|
+
return N.set(i, o), i;
|
|
283
|
+
}
|
|
284
|
+
function q(t, r) {
|
|
285
|
+
const o = z.find((a) => a.mode === t && a.inheritsBaseTokens), n = v(o);
|
|
286
|
+
n.name = r;
|
|
287
|
+
for (const [a, d] of Object.entries(n.colors)) {
|
|
288
|
+
if (!S.test(d)) continue;
|
|
289
|
+
const i = a.slice(2);
|
|
290
|
+
n.palette[i] = d, n.colors[a] = `$${i}`;
|
|
291
|
+
}
|
|
292
|
+
return n;
|
|
280
293
|
}
|
|
281
294
|
export {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
295
|
+
O as PORTABLE_THEME_LIMIT,
|
|
296
|
+
q as createBlankShellTheme,
|
|
297
|
+
v as exportShellTheme,
|
|
298
|
+
U as portableContrastIssue,
|
|
299
|
+
D as readPortableShellTheme,
|
|
300
|
+
Z as resolvePortableShellTheme,
|
|
301
|
+
B as shellColorRoles,
|
|
302
|
+
A as terminalThemeRoles
|
|
289
303
|
};
|
package/dist/themes.js
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
import { FLOE_THEME_FILE_LIMIT as o, floeThemeContrastIssue as r, readFloeThemeDocument as t, resolveFloeThemeDocument as s } from "./styles/themes/themeDocument.js";
|
|
2
|
-
import { PORTABLE_THEME_LIMIT as m, exportShellTheme as
|
|
3
|
-
import { BUILT_IN_SHELL_THEME_DEFAULTS as
|
|
2
|
+
import { PORTABLE_THEME_LIMIT as h, createBlankShellTheme as m, exportShellTheme as E, portableContrastIssue as a, readPortableShellTheme as S, resolvePortableShellTheme as _, shellColorRoles as I, terminalThemeRoles as L } from "./styles/themes/portableTheme.js";
|
|
3
|
+
import { BUILT_IN_SHELL_THEME_DEFAULTS as p, REQUIRED_SHELL_THEME_TOKENS as M, assertUniqueThemePresetNames as u, builtInShellThemePresets as P, getShellThemePresetsForMode as F, normalizeShellThemeSelection as H, presetSupportsMode as i, resolveShellThemePresetName as R } from "./styles/themes/presets.js";
|
|
4
4
|
export {
|
|
5
|
-
|
|
5
|
+
p as BUILT_IN_SHELL_THEME_DEFAULTS,
|
|
6
6
|
o as FLOE_THEME_FILE_LIMIT,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
h as PORTABLE_THEME_LIMIT,
|
|
8
|
+
M as REQUIRED_SHELL_THEME_TOKENS,
|
|
9
|
+
u as assertUniqueThemePresetNames,
|
|
10
|
+
P as builtInShellThemePresets,
|
|
11
|
+
m as createBlankShellTheme,
|
|
12
|
+
E as exportShellTheme,
|
|
12
13
|
r as floeThemeContrastIssue,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
F as getShellThemePresetsForMode,
|
|
15
|
+
H as normalizeShellThemeSelection,
|
|
16
|
+
a as portableContrastIssue,
|
|
17
|
+
i as presetSupportsMode,
|
|
17
18
|
t as readFloeThemeDocument,
|
|
18
19
|
S as readPortableShellTheme,
|
|
19
20
|
s as resolveFloeThemeDocument,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
_ as resolvePortableShellTheme,
|
|
22
|
+
R as resolveShellThemePresetName,
|
|
23
|
+
I as shellColorRoles,
|
|
24
|
+
L as terminalThemeRoles
|
|
24
25
|
};
|