@nice2dev/ui 1.3.16 → 1.3.17
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/CHANGELOG.md +67 -0
- package/dist/NiceEventOrchestrator.doc-Dwtq2s_L.cjs +6 -0
- package/dist/docs/NiceEventOrchestrator.doc.json.mjs +19 -19
- package/dist/index.cjs +221 -221
- package/dist/index.d.ts +81 -48
- package/dist/index.mjs +912 -910
- package/dist/style.css +1 -1
- package/dist/tools/NiceThemeDesigner.mjs +1359 -900
- package/dist/tools/NiceThemePreview.mjs +18 -18
- package/dist/tools/themeCatalog.mjs +50 -0
- package/dist/workflow/NiceWorkflowDesigner.mjs +452 -898
- package/package.json +4 -4
- package/dist/NiceEventOrchestrator.doc-CxjsLxBG.cjs +0 -6
|
@@ -1,33 +1,36 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useNiceTranslation as
|
|
3
|
-
import {
|
|
4
|
-
import { forwardRef as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { downloadBlob as
|
|
13
|
-
import { NiceThemePreview as
|
|
14
|
-
|
|
1
|
+
import { jsxs as h, jsx as r, Fragment as Ye } from "react/jsx-runtime";
|
|
2
|
+
import { useNiceTranslation as Ge } from "@nice2dev/i18n";
|
|
3
|
+
import { useControlId as st, niceThemeLight as Ke, NiceIcon as I, NiceTutorialButton as ot, resolveTutorial as lt, deserializeTheme as ct, useRovingFocus as mt, NiceThemeContext as dt, applyTheme as ht, serializeTheme as Ue, themeToCssVars as je, NICE_DISPLAY_STYLES as ut } from "@nice2dev/ui-core";
|
|
4
|
+
import { forwardRef as pt, useState as E, useCallback as f, useRef as O, useMemo as ee, useEffect as de, useContext as bt } from "react";
|
|
5
|
+
import { NiceTreeGrid as gt } from "../data/NiceTreeGrid.mjs";
|
|
6
|
+
import { NiceNumberInput as De } from "../editors/inputs/NiceNumberInput.mjs";
|
|
7
|
+
import { NiceSelect as Ae } from "../editors/inputs/NiceSelect.mjs";
|
|
8
|
+
import { NiceTextInput as We } from "../editors/inputs/NiceTextInput.mjs";
|
|
9
|
+
import { NiceColorPalette as ft } from "../editors/pickers/NiceColorPalette.mjs";
|
|
10
|
+
import { NiceColorPicker as Xe } from "../editors/pickers/NiceColorPicker.mjs";
|
|
11
|
+
import { NiceConfirmDialog as Ze } from "../feedback/NiceConfirmDialog.mjs";
|
|
12
|
+
import { downloadBlob as yt } from "./NiceExport.mjs";
|
|
13
|
+
import { NiceThemePreview as Qe } from "./NiceThemePreview.mjs";
|
|
14
|
+
import { NICE_THEME_CATALOG as Ne } from "./themeCatalog.mjs";
|
|
15
|
+
const et = {
|
|
16
|
+
target: ".nice-theme-builder",
|
|
17
|
+
titleKey: "tutorial.themeBuilder.intro.title",
|
|
18
|
+
title: "Theme builder",
|
|
19
|
+
contentKey: "tutorial.themeBuilder.intro.content",
|
|
20
|
+
content: "Start from a preset, tweak colors, typography and other tokens by section, preview live, then apply or export the theme.",
|
|
21
|
+
placement: "auto"
|
|
22
|
+
}, vt = [
|
|
23
|
+
et,
|
|
15
24
|
{
|
|
16
|
-
target: ".nice-theme-
|
|
17
|
-
titleKey: "tutorial.themeBuilder.intro.title",
|
|
18
|
-
title: "Theme builder",
|
|
19
|
-
contentKey: "tutorial.themeBuilder.intro.content",
|
|
20
|
-
content: "Start from a preset, tweak colors, typography and other tokens by section, preview live, then apply or export the theme.",
|
|
21
|
-
placement: "auto"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
target: ".nice-theme-builder__preset-bar",
|
|
25
|
+
target: ".nice-theme-builder__tree",
|
|
25
26
|
titleKey: "tutorial.themeBuilder.presets.title",
|
|
26
27
|
title: "Presets",
|
|
27
28
|
contentKey: "tutorial.themeBuilder.presets.content",
|
|
28
29
|
content: "Start from a built-in preset, then customise — the fastest way to a coherent palette.",
|
|
29
|
-
placement: "
|
|
30
|
-
}
|
|
30
|
+
placement: "right"
|
|
31
|
+
}
|
|
32
|
+
], _t = [
|
|
33
|
+
et,
|
|
31
34
|
{
|
|
32
35
|
target: ".nice-theme-builder__tabs",
|
|
33
36
|
titleKey: "tutorial.themeBuilder.sections.title",
|
|
@@ -53,939 +56,1395 @@ const at = [
|
|
|
53
56
|
placement: "bottom"
|
|
54
57
|
}
|
|
55
58
|
];
|
|
56
|
-
function
|
|
57
|
-
return
|
|
59
|
+
function St(s) {
|
|
60
|
+
return s.startsWith("colors.") ? "colors" : s.startsWith("backgrounds.") ? "backgrounds" : s.startsWith("backgroundImage.") ? "background-image" : s.startsWith("text.") ? "text" : s.startsWith("borders.") ? "borders" : s.startsWith("spacing.") ? "spacing" : s.startsWith("typography.") ? "typography" : s.startsWith("shadows.") ? "shadows" : s.startsWith("transitions.") ? "transitions" : s === "name" || s === "darkMode" || s === "darkThemeName" || s === "recommendedDisplayStyle" ? "general" : null;
|
|
58
61
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
62
|
+
function Je(s, d) {
|
|
63
|
+
if (!d.has(s))
|
|
64
|
+
return s;
|
|
65
|
+
for (let u = 2; ; u++) {
|
|
66
|
+
const T = `${s} ${u}`;
|
|
67
|
+
if (!d.has(T))
|
|
68
|
+
return T;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function tt(s) {
|
|
72
|
+
if (!s || typeof s != "object")
|
|
73
|
+
return null;
|
|
74
|
+
const d = s;
|
|
75
|
+
return typeof d.name != "string" ? null : { ...Ke, ...d };
|
|
76
|
+
}
|
|
77
|
+
function nt(s, d) {
|
|
78
|
+
if (s)
|
|
79
|
+
try {
|
|
80
|
+
const u = window.localStorage.getItem(`${s}:${d}`);
|
|
81
|
+
return u ? JSON.parse(u) : void 0;
|
|
82
|
+
} catch {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function qe(s, d, u) {
|
|
87
|
+
if (s)
|
|
88
|
+
try {
|
|
89
|
+
window.localStorage.setItem(`${s}:${d}`, JSON.stringify(u));
|
|
90
|
+
} catch {
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function Nt(s) {
|
|
94
|
+
const d = nt(s, "themes");
|
|
95
|
+
return Array.isArray(d) ? d.map(tt).filter((u) => u !== null) : [];
|
|
96
|
+
}
|
|
97
|
+
function wt(s) {
|
|
98
|
+
const d = nt(s, "favorites");
|
|
99
|
+
return Array.isArray(d) ? d.filter((u) => typeof u == "string") : [];
|
|
100
|
+
}
|
|
101
|
+
function rt(s, d) {
|
|
102
|
+
const u = new FileReader();
|
|
103
|
+
u.onload = () => {
|
|
104
|
+
try {
|
|
105
|
+
const T = String(u.result ?? "");
|
|
106
|
+
let z;
|
|
107
|
+
try {
|
|
108
|
+
z = ct(T);
|
|
109
|
+
} catch {
|
|
110
|
+
z = JSON.parse(T);
|
|
111
|
+
}
|
|
112
|
+
const N = tt(z);
|
|
113
|
+
N && d(N);
|
|
114
|
+
} catch {
|
|
115
|
+
}
|
|
116
|
+
}, u.readAsText(s);
|
|
117
|
+
}
|
|
118
|
+
function Tt(s) {
|
|
119
|
+
if (!s)
|
|
120
|
+
return Ne;
|
|
121
|
+
const d = /* @__PURE__ */ new Map(), u = [
|
|
122
|
+
...Ne.filter((N) => !N.entries.some((w) => w.pack)),
|
|
123
|
+
...Ne.filter((N) => N.entries.some((w) => w.pack))
|
|
124
|
+
];
|
|
125
|
+
for (const N of u)
|
|
126
|
+
for (const w of N.entries)
|
|
127
|
+
d.has(w.name) || d.set(w.name, N.id);
|
|
128
|
+
const T = /* @__PURE__ */ new Map();
|
|
129
|
+
for (const N of s) {
|
|
130
|
+
const w = d.get(N.name) ?? "presets";
|
|
131
|
+
let g = T.get(w);
|
|
132
|
+
if (!g) {
|
|
133
|
+
const P = Ne.find((R) => R.id === w);
|
|
134
|
+
g = { id: w, label: P?.label ?? "Presets", entries: [] }, T.set(w, g);
|
|
135
|
+
}
|
|
136
|
+
g.entries.push({ name: N.name, theme: N, category: w });
|
|
137
|
+
}
|
|
138
|
+
const z = (N) => {
|
|
139
|
+
const w = Ne.findIndex((g) => g.id === N);
|
|
140
|
+
return w < 0 ? Number.MAX_SAFE_INTEGER : w;
|
|
141
|
+
};
|
|
142
|
+
return [...T.values()].sort((N, w) => z(N.id) - z(w.id));
|
|
143
|
+
}
|
|
144
|
+
const kt = 1e3;
|
|
145
|
+
function Ct(s) {
|
|
146
|
+
const [d, u] = E(() => ({
|
|
147
|
+
past: [],
|
|
148
|
+
present: s,
|
|
149
|
+
future: [],
|
|
150
|
+
lastKey: null,
|
|
151
|
+
lastAt: 0
|
|
152
|
+
})), T = f(
|
|
153
|
+
(g, P) => {
|
|
154
|
+
u((R) => {
|
|
155
|
+
const V = typeof g == "function" ? g(R.present) : g;
|
|
156
|
+
if (V === R.present)
|
|
157
|
+
return R;
|
|
158
|
+
const j = Date.now();
|
|
159
|
+
return {
|
|
160
|
+
past: P !== null && P === R.lastKey && j - R.lastAt < kt ? R.past : [...R.past, R.present].slice(-100),
|
|
161
|
+
present: V,
|
|
162
|
+
future: [],
|
|
163
|
+
lastKey: P,
|
|
164
|
+
lastAt: j
|
|
165
|
+
};
|
|
166
|
+
});
|
|
167
|
+
},
|
|
168
|
+
[]
|
|
169
|
+
), z = f(() => {
|
|
170
|
+
u(
|
|
171
|
+
(g) => g.past.length === 0 ? g : {
|
|
172
|
+
past: g.past.slice(0, -1),
|
|
173
|
+
present: g.past[g.past.length - 1],
|
|
174
|
+
future: [g.present, ...g.future],
|
|
175
|
+
lastKey: null,
|
|
176
|
+
lastAt: 0
|
|
177
|
+
}
|
|
112
178
|
);
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
),
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
179
|
+
}, []), N = f(() => {
|
|
180
|
+
u(
|
|
181
|
+
(g) => g.future.length === 0 ? g : {
|
|
182
|
+
past: [...g.past, g.present],
|
|
183
|
+
present: g.future[0],
|
|
184
|
+
future: g.future.slice(1),
|
|
185
|
+
lastKey: null,
|
|
186
|
+
lastAt: 0
|
|
187
|
+
}
|
|
188
|
+
);
|
|
189
|
+
}, []), w = f((g) => {
|
|
190
|
+
u((P) => ({ ...P, present: g, lastKey: null, lastAt: 0 }));
|
|
191
|
+
}, []);
|
|
192
|
+
return {
|
|
193
|
+
theme: d.present,
|
|
194
|
+
canUndo: d.past.length > 0,
|
|
195
|
+
canRedo: d.future.length > 0,
|
|
196
|
+
commit: T,
|
|
197
|
+
undo: z,
|
|
198
|
+
redo: N,
|
|
199
|
+
replace: w
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
function xt({
|
|
203
|
+
controlId: s,
|
|
204
|
+
original: d,
|
|
205
|
+
own: u,
|
|
206
|
+
groupLabel: T,
|
|
207
|
+
allSections: z,
|
|
208
|
+
showPreview: N,
|
|
209
|
+
onTogglePreview: w,
|
|
210
|
+
onBack: g,
|
|
211
|
+
onSave: P,
|
|
212
|
+
onSaveCopy: R,
|
|
213
|
+
onChange: V,
|
|
214
|
+
onApply: j,
|
|
215
|
+
onExport: Y,
|
|
216
|
+
livePreview: Te,
|
|
217
|
+
focusedToken: he
|
|
218
|
+
}) {
|
|
219
|
+
const { t: e } = Ge(), ke = O(null);
|
|
220
|
+
mt(ke, { orientation: "horizontal", wrap: !0, activateOnMove: !0 });
|
|
221
|
+
const { theme: m, canUndo: Be, canRedo: Me, commit: B, undo: te, redo: ue, replace: ne } = Ct(d), [pe, be] = E("colors"), [p, U] = E(!1), ge = O(null), fe = O(null), X = ee(
|
|
222
|
+
() => m !== d && JSON.stringify(m) !== JSON.stringify(d),
|
|
223
|
+
[m, d]
|
|
224
|
+
), Ce = O(V);
|
|
225
|
+
de(() => {
|
|
226
|
+
Ce.current = V;
|
|
227
|
+
});
|
|
228
|
+
const xe = O(m);
|
|
229
|
+
de(() => {
|
|
230
|
+
m !== xe.current && (xe.current = m, Ce.current?.(m));
|
|
231
|
+
}, [m]);
|
|
232
|
+
const J = O(null), C = O(null), W = f(
|
|
233
|
+
(i) => {
|
|
234
|
+
const n = St(i);
|
|
235
|
+
n && z.includes(n) && (be(n), requestAnimationFrame(() => {
|
|
236
|
+
requestAnimationFrame(() => {
|
|
237
|
+
if (!ge.current)
|
|
238
|
+
return;
|
|
239
|
+
const a = ge.current.querySelector(
|
|
240
|
+
`[data-token="${i}"]`
|
|
241
|
+
);
|
|
242
|
+
if (!a)
|
|
243
|
+
return;
|
|
244
|
+
a.scrollIntoView({ behavior: "smooth", block: "center" }), a.querySelector("input, select, textarea")?.focus(), C.current?.classList.remove("nice-theme-builder__field--targeted"), a.classList.add("nice-theme-builder__field--targeted"), C.current = a, J.current && clearTimeout(J.current), J.current = setTimeout(() => {
|
|
245
|
+
a.classList.remove("nice-theme-builder__field--targeted"), C.current = null, J.current = null;
|
|
246
|
+
}, 1500);
|
|
147
247
|
});
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
248
|
+
}));
|
|
249
|
+
},
|
|
250
|
+
[z]
|
|
251
|
+
);
|
|
252
|
+
de(
|
|
253
|
+
() => () => {
|
|
254
|
+
J.current && clearTimeout(J.current);
|
|
255
|
+
},
|
|
256
|
+
[]
|
|
257
|
+
), de(() => {
|
|
258
|
+
he && W(he);
|
|
259
|
+
}, [he, W]);
|
|
260
|
+
const ye = bt(dt)?.setTheme, re = f(
|
|
261
|
+
(i) => ye ? ye(i) : ht(i),
|
|
262
|
+
[ye]
|
|
263
|
+
), D = O(m);
|
|
264
|
+
de(() => {
|
|
265
|
+
Te && m !== D.current && re(m);
|
|
266
|
+
}, [Te, m, re]);
|
|
267
|
+
const H = f(
|
|
268
|
+
(i) => {
|
|
269
|
+
B((n) => ({ ...n, ...i }), Object.keys(i).join(","));
|
|
270
|
+
},
|
|
271
|
+
[B]
|
|
272
|
+
), M = f(
|
|
273
|
+
(i, n, a) => {
|
|
274
|
+
B(
|
|
275
|
+
(_) => {
|
|
276
|
+
const y = _[i], t = typeof y == "object" && y !== null ? y : {};
|
|
277
|
+
return { ..._, [i]: { ...t, [n]: a } };
|
|
278
|
+
},
|
|
279
|
+
`${String(i)}.${n}`
|
|
280
|
+
);
|
|
281
|
+
},
|
|
282
|
+
[B]
|
|
283
|
+
), $e = f(
|
|
284
|
+
(i) => {
|
|
285
|
+
const n = i.target.files?.[0];
|
|
286
|
+
i.target.value = "", n && rt(n, (a) => B(a, null));
|
|
287
|
+
},
|
|
288
|
+
[B]
|
|
289
|
+
), ie = f(() => {
|
|
290
|
+
re(m), j?.(m);
|
|
291
|
+
}, [m, j, re]), ae = f(() => {
|
|
292
|
+
const i = Ue(m);
|
|
293
|
+
if (Y) {
|
|
294
|
+
Y(i, je(m));
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
const n = (m.name ?? "").trim().replace(/[^\w.-]+/g, "-") || "theme";
|
|
298
|
+
yt(new Blob([i], { type: "application/json;charset=utf-8" }), `${n}.json`);
|
|
299
|
+
}, [m, Y]), ve = f(() => ne(P(m)), [P, ne, m]), _e = f(
|
|
300
|
+
() => ne(R(m)),
|
|
301
|
+
[R, ne, m]
|
|
302
|
+
), Ie = f(() => B(d, null), [B, d]), se = f(
|
|
303
|
+
() => X ? U(!0) : g(),
|
|
304
|
+
[X, g]
|
|
305
|
+
), x = O(null);
|
|
306
|
+
de(() => {
|
|
307
|
+
const i = x.current;
|
|
308
|
+
if (!i)
|
|
309
|
+
return;
|
|
310
|
+
const n = (a) => {
|
|
311
|
+
if (!(a.ctrlKey || a.metaKey) || a.altKey)
|
|
157
312
|
return;
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
|
|
313
|
+
const _ = a.key.toLowerCase();
|
|
314
|
+
_ === "z" && !a.shiftKey ? (a.preventDefault(), te()) : (_ === "z" && a.shiftKey || _ === "y") && (a.preventDefault(), ue());
|
|
315
|
+
};
|
|
316
|
+
return i.addEventListener("keydown", n), () => i.removeEventListener("keydown", n);
|
|
317
|
+
}, [te, ue]);
|
|
318
|
+
const Oe = ee(() => {
|
|
319
|
+
const i = je(m);
|
|
320
|
+
return Object.entries(i).map(([n, a]) => ` ${n}: ${a};`).join(`
|
|
321
|
+
`);
|
|
322
|
+
}, [m]), b = (i, n, a) => {
|
|
323
|
+
const _ = m[i] ?? {}, y = `${i}.${n}`;
|
|
324
|
+
return /* @__PURE__ */ r(
|
|
325
|
+
"div",
|
|
326
|
+
{
|
|
327
|
+
className: "nice-theme-builder__field nice-theme-builder__field--color",
|
|
328
|
+
"data-token": y,
|
|
329
|
+
children: /* @__PURE__ */ r(
|
|
330
|
+
Xe,
|
|
331
|
+
{
|
|
332
|
+
id: `${s}-${i}-${n}`,
|
|
333
|
+
label: a,
|
|
334
|
+
labelPlacement: "left",
|
|
335
|
+
size: "sm",
|
|
336
|
+
compact: !0,
|
|
337
|
+
value: _[n] || "",
|
|
338
|
+
onChange: (t) => M(i, n, t)
|
|
180
339
|
}
|
|
181
|
-
|
|
340
|
+
)
|
|
182
341
|
},
|
|
183
|
-
|
|
184
|
-
)
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
342
|
+
n
|
|
343
|
+
);
|
|
344
|
+
}, l = (i, n, a) => {
|
|
345
|
+
const _ = m[i] ?? {}, y = `${i}.${n}`;
|
|
346
|
+
return /* @__PURE__ */ r("div", { className: "nice-theme-builder__field", "data-token": y, children: /* @__PURE__ */ r(
|
|
347
|
+
We,
|
|
348
|
+
{
|
|
349
|
+
id: `${s}-${i}-${n}`,
|
|
350
|
+
label: a,
|
|
351
|
+
labelPlacement: "left",
|
|
352
|
+
size: "sm",
|
|
353
|
+
value: _[n] || "",
|
|
354
|
+
onChange: (t) => M(i, n, t)
|
|
196
355
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
356
|
+
) }, n);
|
|
357
|
+
}, $ = (i, n, a) => {
|
|
358
|
+
const _ = m[i] ?? {}, y = `${i}.${n}`;
|
|
359
|
+
return /* @__PURE__ */ r("div", { className: "nice-theme-builder__field", "data-token": y, children: /* @__PURE__ */ r(
|
|
360
|
+
De,
|
|
361
|
+
{
|
|
362
|
+
id: `${s}-${i}-${n}`,
|
|
363
|
+
label: a,
|
|
364
|
+
labelPlacement: "left",
|
|
365
|
+
size: "sm",
|
|
366
|
+
value: _[n] ?? 0,
|
|
367
|
+
onChange: (t) => M(i, n, typeof t == "number" ? t : parseFloat(String(t)) || 0),
|
|
368
|
+
showStepper: !0
|
|
369
|
+
}
|
|
370
|
+
) }, n);
|
|
371
|
+
}, G = (i, n, a, _) => {
|
|
372
|
+
const y = m[i], t = `${i}.${n}`, o = y?.[n] ?? "";
|
|
373
|
+
return /* @__PURE__ */ r("div", { className: "nice-theme-builder__field", "data-token": t, children: /* @__PURE__ */ r(
|
|
374
|
+
Ae,
|
|
375
|
+
{
|
|
376
|
+
id: `${s}-${i}-${n}`,
|
|
377
|
+
label: a,
|
|
378
|
+
labelPlacement: "left",
|
|
379
|
+
size: "sm",
|
|
380
|
+
clearable: !0,
|
|
381
|
+
value: o,
|
|
382
|
+
onChange: (c) => M(i, n, Array.isArray(c) ? c[0] ?? "" : c),
|
|
383
|
+
options: _.map((c) => ({ value: c, label: c }))
|
|
384
|
+
}
|
|
385
|
+
) }, n);
|
|
386
|
+
}, Z = (i, n, a, _ = !0) => {
|
|
387
|
+
const y = m[i] ?? "", t = String(i);
|
|
388
|
+
return /* @__PURE__ */ r("div", { className: "nice-theme-builder__field", "data-token": t, children: /* @__PURE__ */ r(
|
|
389
|
+
Ae,
|
|
390
|
+
{
|
|
391
|
+
id: `${s}-${t}`,
|
|
392
|
+
label: n,
|
|
393
|
+
labelPlacement: "left",
|
|
394
|
+
size: "sm",
|
|
395
|
+
clearable: _,
|
|
396
|
+
value: y,
|
|
397
|
+
onChange: (o) => {
|
|
398
|
+
const c = Array.isArray(o) ? o[0] ?? "" : o;
|
|
399
|
+
H({ [i]: c || void 0 });
|
|
225
400
|
},
|
|
226
|
-
|
|
401
|
+
options: a.map((o) => ({ value: o, label: o }))
|
|
402
|
+
}
|
|
403
|
+
) }, t);
|
|
404
|
+
}, oe = (i, n) => {
|
|
405
|
+
const a = m[i] ?? "", _ = String(i);
|
|
406
|
+
return /* @__PURE__ */ r("div", { className: "nice-theme-builder__field", "data-token": _, children: /* @__PURE__ */ r(
|
|
407
|
+
We,
|
|
408
|
+
{
|
|
409
|
+
id: `${s}-${_}`,
|
|
410
|
+
label: n,
|
|
411
|
+
labelPlacement: "left",
|
|
412
|
+
size: "sm",
|
|
413
|
+
value: a,
|
|
414
|
+
onChange: (y) => H({ [i]: y || void 0 })
|
|
415
|
+
}
|
|
416
|
+
) }, _);
|
|
417
|
+
}, Pe = (i, n, a, _ = 0, y = 1, t = 0.05) => {
|
|
418
|
+
const o = m[i], c = `${i}.${n}`, L = o?.[n] ?? y;
|
|
419
|
+
return /* @__PURE__ */ r("div", { className: "nice-theme-builder__field", "data-token": c, children: /* @__PURE__ */ r(
|
|
420
|
+
De,
|
|
421
|
+
{
|
|
422
|
+
id: `${s}-${i}-${n}`,
|
|
423
|
+
label: a,
|
|
424
|
+
labelPlacement: "left",
|
|
425
|
+
size: "sm",
|
|
426
|
+
min: _,
|
|
427
|
+
max: y,
|
|
428
|
+
step: t,
|
|
429
|
+
precision: 2,
|
|
430
|
+
value: Number(L),
|
|
431
|
+
onChange: (k) => M(i, n, typeof k == "number" ? k : parseFloat(String(k)) || 0),
|
|
432
|
+
showStepper: !0
|
|
433
|
+
}
|
|
434
|
+
) }, n);
|
|
435
|
+
}, [F, le] = E("sidebar"), A = m.nesting?.[F] ?? {}, Fe = Math.max(1, Math.min(10, A.levels ?? 5)), q = f(
|
|
436
|
+
(i, n) => {
|
|
437
|
+
B(
|
|
438
|
+
(a) => ({
|
|
439
|
+
...a,
|
|
440
|
+
nesting: {
|
|
441
|
+
...a.nesting ?? {},
|
|
442
|
+
[i]: { ...(a.nesting ?? {})[i] ?? {}, ...n }
|
|
443
|
+
}
|
|
444
|
+
}),
|
|
445
|
+
`nesting.${i}.${Object.keys(n).join(",")}`
|
|
227
446
|
);
|
|
228
|
-
},
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
447
|
+
},
|
|
448
|
+
[B]
|
|
449
|
+
), Le = f(
|
|
450
|
+
(i, n, a) => {
|
|
451
|
+
const y = { ...((m.nesting ?? {})[i] ?? {}).overrides ?? {} };
|
|
452
|
+
a === null ? delete y[n] : y[n] = { ...y[n] ?? {}, ...a }, q(i, { overrides: y });
|
|
453
|
+
},
|
|
454
|
+
[m.nesting, q]
|
|
455
|
+
), ce = () => {
|
|
456
|
+
const i = [
|
|
457
|
+
{ key: "background", label: e("theme.background", "Background") },
|
|
458
|
+
{ key: "text", label: e("theme.text", "Text") },
|
|
459
|
+
{ key: "hoverBackground", label: e("theme.hoverBg", "Hover bg") },
|
|
460
|
+
{ key: "activeBackground", label: e("theme.activeBg", "Active bg") },
|
|
461
|
+
{ key: "border", label: e("theme.border", "Border") }
|
|
462
|
+
];
|
|
463
|
+
return /* @__PURE__ */ h("div", { className: "nice-theme-builder__grid", children: [
|
|
464
|
+
/* @__PURE__ */ r("div", { className: "nice-theme-builder__field", children: /* @__PURE__ */ r(
|
|
465
|
+
Ae,
|
|
232
466
|
{
|
|
233
|
-
|
|
234
|
-
label: n,
|
|
467
|
+
label: e("theme.nestingSurface", "Surface"),
|
|
235
468
|
labelPlacement: "left",
|
|
236
469
|
size: "sm",
|
|
237
|
-
value:
|
|
238
|
-
onChange: (
|
|
470
|
+
value: F,
|
|
471
|
+
onChange: (n) => {
|
|
472
|
+
const a = Array.isArray(n) ? n[0] : n;
|
|
473
|
+
(a === "sidebar" || a === "menu" || a === "tree") && le(a);
|
|
474
|
+
},
|
|
475
|
+
options: [
|
|
476
|
+
{ value: "sidebar", label: e("theme.sidebar", "Sidebar") },
|
|
477
|
+
{ value: "menu", label: e("theme.menu", "Menu") },
|
|
478
|
+
{ value: "tree", label: e("theme.tree", "Tree") }
|
|
479
|
+
]
|
|
239
480
|
}
|
|
240
|
-
) },
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
return /* @__PURE__ */ i("div", { className: "nice-theme-builder__field", "data-token": s, children: /* @__PURE__ */ i(
|
|
244
|
-
M,
|
|
481
|
+
) }),
|
|
482
|
+
/* @__PURE__ */ r("div", { className: "nice-theme-builder__field", children: /* @__PURE__ */ r(
|
|
483
|
+
De,
|
|
245
484
|
{
|
|
246
|
-
|
|
247
|
-
label: n,
|
|
485
|
+
label: e("theme.nestingLevels", "Levels"),
|
|
248
486
|
labelPlacement: "left",
|
|
249
487
|
size: "sm",
|
|
250
|
-
|
|
251
|
-
|
|
488
|
+
min: 1,
|
|
489
|
+
max: 10,
|
|
490
|
+
step: 1,
|
|
491
|
+
precision: 0,
|
|
492
|
+
value: Fe,
|
|
493
|
+
onChange: (n) => {
|
|
494
|
+
const a = typeof n == "number" ? n : Number(n);
|
|
495
|
+
Number.isFinite(a) && q(F, { levels: Math.max(1, Math.min(10, Math.round(a))) });
|
|
496
|
+
},
|
|
252
497
|
showStepper: !0
|
|
253
498
|
}
|
|
254
|
-
) },
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
return /* @__PURE__ */ i("div", { className: "nice-theme-builder__field", "data-token": d, children: /* @__PURE__ */ i(
|
|
258
|
-
D,
|
|
499
|
+
) }),
|
|
500
|
+
/* @__PURE__ */ r("div", { className: "nice-theme-builder__field", children: /* @__PURE__ */ r(
|
|
501
|
+
Ae,
|
|
259
502
|
{
|
|
260
|
-
|
|
261
|
-
label: n,
|
|
503
|
+
label: e("theme.nestingDerivation", "Bg derivation"),
|
|
262
504
|
labelPlacement: "left",
|
|
263
505
|
size: "sm",
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
}
|
|
269
|
-
) }, r);
|
|
270
|
-
}, me = (t, r, n, m = !0) => {
|
|
271
|
-
const s = o[t] ?? "", d = String(t);
|
|
272
|
-
return /* @__PURE__ */ i("div", { className: "nice-theme-builder__field", "data-token": d, children: /* @__PURE__ */ i(
|
|
273
|
-
D,
|
|
274
|
-
{
|
|
275
|
-
id: `${g}-${d}`,
|
|
276
|
-
label: r,
|
|
277
|
-
labelPlacement: "left",
|
|
278
|
-
size: "sm",
|
|
279
|
-
clearable: m,
|
|
280
|
-
value: s,
|
|
281
|
-
onChange: (u) => {
|
|
282
|
-
const y = Array.isArray(u) ? u[0] ?? "" : u;
|
|
283
|
-
P({ [t]: y || void 0 });
|
|
506
|
+
value: A.bgDerivation ?? "tint",
|
|
507
|
+
onChange: (n) => {
|
|
508
|
+
const a = Array.isArray(n) ? n[0] : n;
|
|
509
|
+
(a === "tint" || a === "shade" || a === "mix-surface" || a === "palette") && q(F, { bgDerivation: a });
|
|
284
510
|
},
|
|
285
|
-
options:
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
value: n,
|
|
298
|
-
onChange: (s) => P({ [t]: s || void 0 })
|
|
511
|
+
options: [
|
|
512
|
+
{
|
|
513
|
+
value: "tint",
|
|
514
|
+
label: e("theme.tintLighterPerLevel", "Tint (lighter per level)")
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
value: "shade",
|
|
518
|
+
label: e("theme.shadeDarkerPerLevel", "Shade (darker per level)")
|
|
519
|
+
},
|
|
520
|
+
{ value: "mix-surface", label: e("theme.mixWithSurface", "Mix with surface") },
|
|
521
|
+
{ value: "palette", label: e("theme.cyclePalette", "Cycle palette") }
|
|
522
|
+
]
|
|
299
523
|
}
|
|
300
|
-
) },
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
return /* @__PURE__ */ i("div", { className: "nice-theme-builder__field", "data-token": y, children: /* @__PURE__ */ i(
|
|
304
|
-
M,
|
|
524
|
+
) }),
|
|
525
|
+
/* @__PURE__ */ r("div", { className: "nice-theme-builder__field", children: /* @__PURE__ */ r(
|
|
526
|
+
De,
|
|
305
527
|
{
|
|
306
|
-
|
|
307
|
-
label: n,
|
|
528
|
+
label: e("theme.nestingStep", "Step"),
|
|
308
529
|
labelPlacement: "left",
|
|
309
530
|
size: "sm",
|
|
310
|
-
min:
|
|
311
|
-
max:
|
|
312
|
-
step:
|
|
531
|
+
min: 0,
|
|
532
|
+
max: 0.5,
|
|
533
|
+
step: 0.02,
|
|
313
534
|
precision: 2,
|
|
314
|
-
value:
|
|
315
|
-
onChange: (
|
|
535
|
+
value: A.bgStep ?? 0.06,
|
|
536
|
+
onChange: (n) => {
|
|
537
|
+
const a = typeof n == "number" ? n : Number(n);
|
|
538
|
+
Number.isFinite(a) && q(F, { bgStep: Math.max(0, Math.min(0.5, a)) });
|
|
539
|
+
},
|
|
316
540
|
showStepper: !0
|
|
317
541
|
}
|
|
318
|
-
) },
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
nesting: {
|
|
324
|
-
...o.nesting ?? {},
|
|
325
|
-
[t]: { ...n, ...r }
|
|
326
|
-
}
|
|
327
|
-
};
|
|
328
|
-
P(m);
|
|
329
|
-
},
|
|
330
|
-
[o, P]
|
|
331
|
-
), he = p(
|
|
332
|
-
(t, r, n) => {
|
|
333
|
-
const s = { ...((o.nesting ?? {})[t] ?? {}).overrides ?? {} };
|
|
334
|
-
n === null ? delete s[r] : s[r] = { ...s[r] ?? {}, ...n }, x(t, { overrides: s });
|
|
335
|
-
},
|
|
336
|
-
[o.nesting, x]
|
|
337
|
-
), De = () => {
|
|
338
|
-
const t = [
|
|
339
|
-
{ key: "background", label: e("theme.background", "Background") },
|
|
340
|
-
{ key: "text", label: e("theme.text", "Text") },
|
|
341
|
-
{ key: "hoverBackground", label: e("theme.hoverBg", "Hover bg") },
|
|
342
|
-
{ key: "activeBackground", label: e("theme.activeBg", "Active bg") },
|
|
343
|
-
{ key: "border", label: e("theme.border", "Border") }
|
|
344
|
-
];
|
|
345
|
-
return /* @__PURE__ */ l("div", { className: "nice-theme-builder__grid", children: [
|
|
346
|
-
/* @__PURE__ */ i("div", { className: "nice-theme-builder__field", children: /* @__PURE__ */ i(
|
|
347
|
-
D,
|
|
542
|
+
) }),
|
|
543
|
+
/* @__PURE__ */ h("div", { className: "nice-theme-builder__field", style: { gridColumn: "1 / -1" }, children: [
|
|
544
|
+
/* @__PURE__ */ r("div", { style: { fontSize: 12, fontWeight: 600, marginBottom: 4 }, children: e("theme.nestingPalette", "Base palette") }),
|
|
545
|
+
/* @__PURE__ */ r(
|
|
546
|
+
ft,
|
|
348
547
|
{
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
{ value: "sidebar", label: e("theme.sidebar", "Sidebar") },
|
|
359
|
-
{ value: "menu", label: e("theme.menu", "Menu") },
|
|
360
|
-
{ value: "tree", label: e("theme.tree", "Tree") }
|
|
361
|
-
]
|
|
548
|
+
value: A.palette ?? [],
|
|
549
|
+
onChange: (n) => q(F, { palette: n }),
|
|
550
|
+
minColors: 1,
|
|
551
|
+
maxColors: 10,
|
|
552
|
+
showWheel: !0,
|
|
553
|
+
showContrast: !1,
|
|
554
|
+
showInfo: !1,
|
|
555
|
+
showVariations: !1,
|
|
556
|
+
showPresets: !1
|
|
362
557
|
}
|
|
363
|
-
)
|
|
364
|
-
|
|
365
|
-
|
|
558
|
+
)
|
|
559
|
+
] }),
|
|
560
|
+
/* @__PURE__ */ h("details", { className: "nice-theme-builder__field", style: { gridColumn: "1 / -1" }, children: [
|
|
561
|
+
/* @__PURE__ */ r(
|
|
562
|
+
"summary",
|
|
366
563
|
{
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
step: 1,
|
|
373
|
-
precision: 0,
|
|
374
|
-
value: de,
|
|
375
|
-
onChange: (r) => {
|
|
376
|
-
const n = typeof r == "number" ? r : Number(r);
|
|
377
|
-
Number.isFinite(n) && x(_, { levels: Math.max(1, Math.min(10, Math.round(n))) });
|
|
564
|
+
style: {
|
|
565
|
+
cursor: "pointer",
|
|
566
|
+
fontSize: 12,
|
|
567
|
+
fontWeight: 600,
|
|
568
|
+
padding: "6px 0"
|
|
378
569
|
},
|
|
379
|
-
|
|
570
|
+
children: e("theme.nestingOverrides", "Per-level overrides")
|
|
380
571
|
}
|
|
381
|
-
)
|
|
382
|
-
/* @__PURE__ */
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
{
|
|
395
|
-
value: "tint",
|
|
396
|
-
label: e("theme.tintLighterPerLevel", "Tint (lighter per level)")
|
|
397
|
-
},
|
|
398
|
-
{
|
|
399
|
-
value: "shade",
|
|
400
|
-
label: e("theme.shadeDarkerPerLevel", "Shade (darker per level)")
|
|
572
|
+
),
|
|
573
|
+
/* @__PURE__ */ r("div", { style: { display: "flex", flexDirection: "column", gap: 8, marginTop: 8 }, children: Array.from({ length: Fe }, (n, a) => a + 1).map((n) => {
|
|
574
|
+
const a = A.overrides?.[n] ?? {}, _ = Object.keys(a).length > 0;
|
|
575
|
+
return /* @__PURE__ */ h(
|
|
576
|
+
"div",
|
|
577
|
+
{
|
|
578
|
+
style: {
|
|
579
|
+
border: "1px solid var(--nice-border-color)",
|
|
580
|
+
borderRadius: 6,
|
|
581
|
+
padding: 8,
|
|
582
|
+
display: "flex",
|
|
583
|
+
flexDirection: "column",
|
|
584
|
+
gap: 6
|
|
401
585
|
},
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
586
|
+
children: [
|
|
587
|
+
/* @__PURE__ */ h("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
|
|
588
|
+
/* @__PURE__ */ r("strong", { style: { flex: 1 }, children: e("theme.level", "Level {level}").replace("{level}", String(n)) }),
|
|
589
|
+
_ && /* @__PURE__ */ r(
|
|
590
|
+
"button",
|
|
591
|
+
{
|
|
592
|
+
type: "button",
|
|
593
|
+
className: "nice-btn nice-btn--outline nice-btn--xs",
|
|
594
|
+
onClick: () => Le(F, n, null),
|
|
595
|
+
children: e("themeBuilder.resetToDerived", "Reset to derived")
|
|
596
|
+
}
|
|
597
|
+
)
|
|
598
|
+
] }),
|
|
599
|
+
/* @__PURE__ */ r("div", { style: { display: "grid", gridTemplateColumns: "repeat(2, 1fr)", gap: 6 }, children: i.map((y) => /* @__PURE__ */ r(
|
|
600
|
+
Xe,
|
|
601
|
+
{
|
|
602
|
+
label: y.label,
|
|
603
|
+
labelPlacement: "left",
|
|
604
|
+
size: "sm",
|
|
605
|
+
value: a[y.key] ?? "",
|
|
606
|
+
onChange: (t) => Le(F, n, { [y.key]: t })
|
|
607
|
+
},
|
|
608
|
+
y.key
|
|
609
|
+
)) })
|
|
610
|
+
]
|
|
421
611
|
},
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
) })
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
612
|
+
n
|
|
613
|
+
);
|
|
614
|
+
}) })
|
|
615
|
+
] })
|
|
616
|
+
] });
|
|
617
|
+
}, Se = {
|
|
618
|
+
general: () => /* @__PURE__ */ h("div", { className: "nice-theme-builder__grid", children: [
|
|
619
|
+
/* @__PURE__ */ r("div", { className: "nice-theme-builder__field", "data-token": "name", children: /* @__PURE__ */ r(
|
|
620
|
+
We,
|
|
621
|
+
{
|
|
622
|
+
id: `${s}-name`,
|
|
623
|
+
label: e("theme.name", "Theme Name"),
|
|
624
|
+
labelPlacement: "left",
|
|
625
|
+
size: "sm",
|
|
626
|
+
value: m.name ?? "",
|
|
627
|
+
onChange: (i) => H({ name: i })
|
|
628
|
+
}
|
|
629
|
+
) }, "name"),
|
|
630
|
+
oe("darkThemeName", e("theme.darkThemeName", "Paired Dark Theme Name")),
|
|
631
|
+
Z("darkMode", e("theme.darkMode", "Dark Mode"), [
|
|
632
|
+
"light",
|
|
633
|
+
"dark",
|
|
634
|
+
"auto"
|
|
635
|
+
]),
|
|
636
|
+
Z(
|
|
637
|
+
"recommendedDisplayStyle",
|
|
638
|
+
e("theme.recommendedDisplayStyle", "Recommended Display Style"),
|
|
639
|
+
ut
|
|
640
|
+
)
|
|
641
|
+
] }),
|
|
642
|
+
colors: () => /* @__PURE__ */ h("div", { className: "nice-theme-builder__grid", children: [
|
|
643
|
+
b("colors", "primary", e("theme.primary", "Primary")),
|
|
644
|
+
b("colors", "primaryHover", e("theme.primaryHover", "Primary Hover")),
|
|
645
|
+
b("colors", "accent", e("theme.accent", "Accent")),
|
|
646
|
+
b("colors", "accentHover", e("theme.accentHover", "Accent Hover")),
|
|
647
|
+
b("colors", "success", e("theme.success", "Success")),
|
|
648
|
+
b("colors", "warning", e("theme.warning", "Warning")),
|
|
649
|
+
b("colors", "error", e("theme.error", "Error")),
|
|
650
|
+
b("colors", "info", e("theme.info", "Info")),
|
|
651
|
+
b("colors", "link", e("theme.link", "Link")),
|
|
652
|
+
b("colors", "linkHover", e("theme.linkHover", "Link Hover")),
|
|
653
|
+
b("colors", "focus", e("theme.focus", "Focus Ring")),
|
|
654
|
+
b("colors", "overlay", e("theme.overlay", "Overlay / Backdrop")),
|
|
655
|
+
b("colors", "surface", e("theme.surface", "Surface")),
|
|
656
|
+
b("colors", "surfaceHover", e("theme.surfaceHover", "Surface Hover")),
|
|
657
|
+
b("colors", "disabled", e("theme.disabled", "Disabled")),
|
|
658
|
+
b("colors", "disabledText", e("theme.disabledText", "Disabled Text"))
|
|
659
|
+
] }),
|
|
660
|
+
backgrounds: () => /* @__PURE__ */ h("div", { className: "nice-theme-builder__grid", children: [
|
|
661
|
+
b("backgrounds", "primary", e("theme.bgPrimary", "Primary Background")),
|
|
662
|
+
b(
|
|
663
|
+
"backgrounds",
|
|
664
|
+
"secondary",
|
|
665
|
+
e("theme.bgSecondary", "Secondary Background")
|
|
666
|
+
),
|
|
667
|
+
b("backgrounds", "tertiary", e("theme.bgTertiary", "Tertiary Background")),
|
|
668
|
+
b("backgrounds", "hover", e("theme.bgHover", "Hover Background")),
|
|
669
|
+
b("backgrounds", "elevated", e("theme.bgElevated", "Elevated Surface")),
|
|
670
|
+
b("backgrounds", "inset", e("theme.bgInset", "Inset Surface")),
|
|
671
|
+
b("backgrounds", "canvas", e("theme.bgCanvas", "Canvas / Body"))
|
|
672
|
+
] }),
|
|
673
|
+
"background-image": () => /* @__PURE__ */ h("div", { className: "nice-theme-builder__grid", children: [
|
|
674
|
+
G("backgroundImage", "type", e("theme.bgiType", "Background Type"), [
|
|
675
|
+
"none",
|
|
676
|
+
"solid",
|
|
677
|
+
"gradient",
|
|
678
|
+
"image",
|
|
679
|
+
"pattern"
|
|
680
|
+
]),
|
|
681
|
+
l(
|
|
682
|
+
"backgroundImage",
|
|
683
|
+
"gradient",
|
|
684
|
+
e("theme.bgiGradient", "CSS Gradient")
|
|
685
|
+
),
|
|
686
|
+
l(
|
|
687
|
+
"backgroundImage",
|
|
688
|
+
"imageUrl",
|
|
689
|
+
e("theme.bgiImageUrl", "Image URL")
|
|
690
|
+
),
|
|
691
|
+
l(
|
|
692
|
+
"backgroundImage",
|
|
693
|
+
"imageSize",
|
|
694
|
+
e("theme.bgiImageSize", "Image Size (cover/contain/…)")
|
|
695
|
+
),
|
|
696
|
+
l(
|
|
697
|
+
"backgroundImage",
|
|
698
|
+
"imagePosition",
|
|
699
|
+
e("theme.bgiImagePosition", "Image Position")
|
|
700
|
+
),
|
|
701
|
+
G(
|
|
702
|
+
"backgroundImage",
|
|
703
|
+
"imageAttachment",
|
|
704
|
+
e("theme.bgiImageAttachment", "Image Attachment"),
|
|
705
|
+
["scroll", "fixed", "local"]
|
|
706
|
+
),
|
|
707
|
+
G(
|
|
708
|
+
"backgroundImage",
|
|
709
|
+
"imageRepeat",
|
|
710
|
+
e("theme.bgiImageRepeat", "Image Repeat"),
|
|
711
|
+
["repeat", "no-repeat", "repeat-x", "repeat-y"]
|
|
712
|
+
),
|
|
713
|
+
l(
|
|
714
|
+
"backgroundImage",
|
|
715
|
+
"pattern",
|
|
716
|
+
e("theme.bgiPattern", "Named Pattern (dots/grid/…)")
|
|
717
|
+
),
|
|
718
|
+
Pe("backgroundImage", "opacity", e("theme.bgiOpacity", "Pattern Opacity")),
|
|
719
|
+
l(
|
|
720
|
+
"backgroundImage",
|
|
721
|
+
"blendMode",
|
|
722
|
+
e("theme.bgiBlendMode", "Blend Mode")
|
|
723
|
+
)
|
|
724
|
+
] }),
|
|
725
|
+
text: () => /* @__PURE__ */ h("div", { className: "nice-theme-builder__grid", children: [
|
|
726
|
+
b("text", "primary", e("theme.textPrimary", "Primary Text")),
|
|
727
|
+
b("text", "secondary", e("theme.textSecondary", "Secondary Text")),
|
|
728
|
+
b("text", "muted", e("theme.textMuted", "Muted Text")),
|
|
729
|
+
b("text", "inverse", e("theme.textInverse", "Inverse Text")),
|
|
730
|
+
b("text", "onPrimary", e("theme.textOnPrimary", "Text on Primary")),
|
|
731
|
+
b("text", "onAccent", e("theme.textOnAccent", "Text on Accent"))
|
|
732
|
+
] }),
|
|
733
|
+
borders: () => /* @__PURE__ */ h("div", { className: "nice-theme-builder__grid", children: [
|
|
734
|
+
b("borders", "color", e("theme.borderColor", "Border Color")),
|
|
735
|
+
b("borders", "focusColor", e("theme.borderFocus", "Focus Border Color")),
|
|
736
|
+
b("borders", "divider", e("theme.borderDivider", "Divider Color")),
|
|
737
|
+
l("borders", "width", e("theme.borderWidth", "Border Width")),
|
|
738
|
+
l("borders", "radiusSm", e("theme.radiusSm", "Radius Small")),
|
|
739
|
+
l("borders", "radiusMd", e("theme.radiusMd", "Radius Medium")),
|
|
740
|
+
l("borders", "radiusLg", e("theme.radiusLg", "Radius Large")),
|
|
741
|
+
l("borders", "radiusXl", e("theme.radiusXl", "Radius XL")),
|
|
742
|
+
l("borders", "radiusFull", e("theme.radiusFull", "Radius Full"))
|
|
743
|
+
] }),
|
|
744
|
+
spacing: () => /* @__PURE__ */ h("div", { className: "nice-theme-builder__grid", children: [
|
|
745
|
+
l("spacing", "space1", "Space 1"),
|
|
746
|
+
l("spacing", "space2", "Space 2"),
|
|
747
|
+
l("spacing", "space3", "Space 3"),
|
|
748
|
+
l("spacing", "space4", "Space 4"),
|
|
749
|
+
l("spacing", "space5", "Space 5"),
|
|
750
|
+
l("spacing", "space6", "Space 6"),
|
|
751
|
+
l("spacing", "space8", "Space 8"),
|
|
752
|
+
l("spacing", "space10", "Space 10"),
|
|
753
|
+
l("spacing", "space12", "Space 12"),
|
|
754
|
+
l("spacing", "space16", "Space 16")
|
|
755
|
+
] }),
|
|
756
|
+
typography: () => /* @__PURE__ */ h("div", { className: "nice-theme-builder__grid", children: [
|
|
757
|
+
l("typography", "fontFamily", e("theme.fontFamily", "Body Font Family")),
|
|
758
|
+
l(
|
|
759
|
+
"typography",
|
|
760
|
+
"headingFontFamily",
|
|
761
|
+
e("theme.headingFontFamily", "Heading Font Family")
|
|
762
|
+
),
|
|
763
|
+
l(
|
|
764
|
+
"typography",
|
|
765
|
+
"monoFontFamily",
|
|
766
|
+
e("theme.monoFontFamily", "Monospace Font Family")
|
|
767
|
+
),
|
|
768
|
+
l("typography", "fontSizeXs", "Font Size XS"),
|
|
769
|
+
l("typography", "fontSizeSm", "Font Size SM"),
|
|
770
|
+
l("typography", "fontSizeMd", "Font Size MD"),
|
|
771
|
+
l("typography", "fontSizeLg", "Font Size LG"),
|
|
772
|
+
l("typography", "fontSizeXl", "Font Size XL"),
|
|
773
|
+
l("typography", "fontSize2xl", "Font Size 2XL"),
|
|
774
|
+
l("typography", "fontSize3xl", "Font Size 3XL"),
|
|
775
|
+
$("typography", "fontWeightNormal", "Weight Normal"),
|
|
776
|
+
$("typography", "fontWeightMedium", "Weight Medium"),
|
|
777
|
+
$("typography", "fontWeightSemibold", "Weight Semibold"),
|
|
778
|
+
$("typography", "fontWeightBold", "Weight Bold"),
|
|
779
|
+
$("typography", "lineHeight", "Line Height"),
|
|
780
|
+
l("typography", "letterSpacing", e("theme.letterSpacing", "Letter Spacing")),
|
|
781
|
+
l(
|
|
782
|
+
"typography",
|
|
783
|
+
"headingLetterSpacing",
|
|
784
|
+
e("theme.headingLetterSpacing", "Heading Letter Spacing")
|
|
785
|
+
)
|
|
786
|
+
] }),
|
|
787
|
+
shadows: () => /* @__PURE__ */ h("div", { className: "nice-theme-builder__grid", children: [
|
|
788
|
+
l("shadows", "sm", "Shadow SM"),
|
|
789
|
+
l("shadows", "md", "Shadow MD"),
|
|
790
|
+
l("shadows", "lg", "Shadow LG"),
|
|
791
|
+
l("shadows", "xl", "Shadow XL"),
|
|
792
|
+
l("shadows", "inner", e("theme.shadowInner", "Inner Shadow")),
|
|
793
|
+
l("shadows", "glow", e("theme.shadowGlow", "Glow Shadow"))
|
|
794
|
+
] }),
|
|
795
|
+
transitions: () => /* @__PURE__ */ h("div", { className: "nice-theme-builder__grid", children: [
|
|
796
|
+
l("transitions", "fast", e("theme.transitionFast", "Transition Fast")),
|
|
797
|
+
l("transitions", "normal", e("theme.transitionNormal", "Transition Normal")),
|
|
798
|
+
l("transitions", "slow", e("theme.transitionSlow", "Transition Slow"))
|
|
799
|
+
] }),
|
|
800
|
+
nesting: () => ce()
|
|
801
|
+
}, Ee = {
|
|
802
|
+
general: e("theme.general", "General"),
|
|
803
|
+
colors: e("theme.colors", "Colors"),
|
|
804
|
+
backgrounds: e("theme.backgrounds", "Backgrounds"),
|
|
805
|
+
"background-image": e("theme.backgroundImage", "Background Image"),
|
|
806
|
+
text: e("theme.text", "Text"),
|
|
807
|
+
borders: e("theme.borders", "Borders"),
|
|
808
|
+
spacing: e("theme.spacing", "Spacing"),
|
|
809
|
+
typography: e("theme.typography", "Typography"),
|
|
810
|
+
shadows: e("theme.shadows", "Shadows"),
|
|
811
|
+
transitions: e("theme.transitions", "Transitions"),
|
|
812
|
+
nesting: e("theme.nesting", "Nesting")
|
|
813
|
+
}, ze = e("theme.undo", "Undo"), Re = e("theme.redo", "Redo");
|
|
814
|
+
return /* @__PURE__ */ h(Ye, { children: [
|
|
815
|
+
/* @__PURE__ */ h("div", { className: "nice-theme-builder__main", ref: x, children: [
|
|
816
|
+
/* @__PURE__ */ r("div", { className: "nice-theme-builder__header", children: /* @__PURE__ */ h("div", { className: "nice-theme-builder__header-row", children: [
|
|
817
|
+
/* @__PURE__ */ h("div", { className: "nice-theme-builder__crumbs", children: [
|
|
818
|
+
/* @__PURE__ */ h(
|
|
819
|
+
"button",
|
|
429
820
|
{
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
showPresets: !1
|
|
821
|
+
type: "button",
|
|
822
|
+
className: "nice-theme-builder__btn",
|
|
823
|
+
onClick: se,
|
|
824
|
+
title: e("theme.back", "Back to themes"),
|
|
825
|
+
children: [
|
|
826
|
+
/* @__PURE__ */ r(I, { name: "arrow-left", size: "sm" }),
|
|
827
|
+
e("theme.themes", "Themes")
|
|
828
|
+
]
|
|
439
829
|
}
|
|
440
|
-
)
|
|
830
|
+
),
|
|
831
|
+
/* @__PURE__ */ r("span", { className: "nice-theme-builder__crumb", children: T }),
|
|
832
|
+
/* @__PURE__ */ r(I, { name: "chevron-right", size: "sm" }),
|
|
833
|
+
/* @__PURE__ */ r("strong", { className: "nice-theme-builder__crumb nice-theme-builder__crumb--current", children: m.name?.trim() || e("theme.untitled", "Untitled") }),
|
|
834
|
+
X && /* @__PURE__ */ r("span", { className: "nice-theme-builder__dirty", children: e("theme.unsaved", "Unsaved changes") })
|
|
441
835
|
] }),
|
|
442
|
-
/* @__PURE__ */
|
|
443
|
-
/* @__PURE__ */
|
|
444
|
-
"
|
|
836
|
+
/* @__PURE__ */ h("div", { className: "nice-theme-builder__toolbar", children: [
|
|
837
|
+
/* @__PURE__ */ r(
|
|
838
|
+
"button",
|
|
445
839
|
{
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
}
|
|
452
|
-
children:
|
|
840
|
+
type: "button",
|
|
841
|
+
className: "nice-theme-builder__btn",
|
|
842
|
+
onClick: te,
|
|
843
|
+
disabled: !Be,
|
|
844
|
+
"aria-label": ze,
|
|
845
|
+
title: `${ze} (Ctrl+Z)`,
|
|
846
|
+
children: /* @__PURE__ */ r(I, { name: "undo", size: "sm" })
|
|
453
847
|
}
|
|
454
848
|
),
|
|
455
|
-
/* @__PURE__ */
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
"
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
849
|
+
/* @__PURE__ */ r(
|
|
850
|
+
"button",
|
|
851
|
+
{
|
|
852
|
+
type: "button",
|
|
853
|
+
className: "nice-theme-builder__btn",
|
|
854
|
+
onClick: ue,
|
|
855
|
+
disabled: !Me,
|
|
856
|
+
"aria-label": Re,
|
|
857
|
+
title: `${Re} (Ctrl+Y)`,
|
|
858
|
+
children: /* @__PURE__ */ r(I, { name: "redo", size: "sm" })
|
|
859
|
+
}
|
|
860
|
+
),
|
|
861
|
+
u && /* @__PURE__ */ h(
|
|
862
|
+
"button",
|
|
863
|
+
{
|
|
864
|
+
type: "button",
|
|
865
|
+
className: "nice-theme-builder__btn nice-theme-builder__btn--apply",
|
|
866
|
+
onClick: ve,
|
|
867
|
+
disabled: !X,
|
|
868
|
+
children: [
|
|
869
|
+
/* @__PURE__ */ r(I, { name: "save", size: "sm" }),
|
|
870
|
+
e("theme.save", "Save")
|
|
871
|
+
]
|
|
872
|
+
}
|
|
873
|
+
),
|
|
874
|
+
/* @__PURE__ */ h("button", { type: "button", className: "nice-theme-builder__btn", onClick: _e, children: [
|
|
875
|
+
/* @__PURE__ */ r(I, { name: "copy", size: "sm" }),
|
|
876
|
+
e("theme.saveCopy", "Save as copy")
|
|
877
|
+
] }),
|
|
878
|
+
/* @__PURE__ */ r(
|
|
879
|
+
"button",
|
|
880
|
+
{
|
|
881
|
+
type: "button",
|
|
882
|
+
className: "nice-theme-builder__btn",
|
|
883
|
+
onClick: Ie,
|
|
884
|
+
disabled: !X,
|
|
885
|
+
children: e("theme.discard", "Discard changes")
|
|
886
|
+
}
|
|
887
|
+
),
|
|
888
|
+
/* @__PURE__ */ h(
|
|
889
|
+
"button",
|
|
890
|
+
{
|
|
891
|
+
type: "button",
|
|
892
|
+
className: "nice-theme-builder__btn",
|
|
893
|
+
onClick: () => fe.current?.click(),
|
|
894
|
+
title: e("theme.import", "Import"),
|
|
895
|
+
children: [
|
|
896
|
+
/* @__PURE__ */ r(I, { name: "upload", size: "sm" }),
|
|
897
|
+
e("theme.import", "Import")
|
|
898
|
+
]
|
|
899
|
+
}
|
|
900
|
+
),
|
|
901
|
+
/* @__PURE__ */ r(
|
|
902
|
+
"input",
|
|
903
|
+
{
|
|
904
|
+
ref: fe,
|
|
905
|
+
type: "file",
|
|
906
|
+
accept: "application/json,.json",
|
|
907
|
+
style: { display: "none" },
|
|
908
|
+
onChange: $e
|
|
909
|
+
}
|
|
910
|
+
),
|
|
911
|
+
/* @__PURE__ */ r(it, { showPreview: N, onToggle: w })
|
|
497
912
|
] })
|
|
498
|
-
] })
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
"
|
|
504
|
-
"
|
|
505
|
-
"
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
c("colors", "accentHover", e("theme.accentHover", "Accent Hover")),
|
|
518
|
-
c("colors", "success", e("theme.success", "Success")),
|
|
519
|
-
c("colors", "warning", e("theme.warning", "Warning")),
|
|
520
|
-
c("colors", "error", e("theme.error", "Error")),
|
|
521
|
-
c("colors", "info", e("theme.info", "Info")),
|
|
522
|
-
c("colors", "link", e("theme.link", "Link")),
|
|
523
|
-
c("colors", "linkHover", e("theme.linkHover", "Link Hover")),
|
|
524
|
-
c("colors", "focus", e("theme.focus", "Focus Ring")),
|
|
525
|
-
c("colors", "overlay", e("theme.overlay", "Overlay / Backdrop")),
|
|
526
|
-
c("colors", "surface", e("theme.surface", "Surface")),
|
|
527
|
-
c("colors", "surfaceHover", e("theme.surfaceHover", "Surface Hover")),
|
|
528
|
-
c("colors", "disabled", e("theme.disabled", "Disabled")),
|
|
529
|
-
c("colors", "disabledText", e("theme.disabledText", "Disabled Text"))
|
|
530
|
-
] }),
|
|
531
|
-
backgrounds: () => /* @__PURE__ */ l("div", { className: "nice-theme-builder__grid", children: [
|
|
532
|
-
c("backgrounds", "primary", e("theme.bgPrimary", "Primary Background")),
|
|
533
|
-
c(
|
|
534
|
-
"backgrounds",
|
|
535
|
-
"secondary",
|
|
536
|
-
e("theme.bgSecondary", "Secondary Background")
|
|
537
|
-
),
|
|
538
|
-
c(
|
|
539
|
-
"backgrounds",
|
|
540
|
-
"tertiary",
|
|
541
|
-
e("theme.bgTertiary", "Tertiary Background")
|
|
542
|
-
),
|
|
543
|
-
c("backgrounds", "hover", e("theme.bgHover", "Hover Background")),
|
|
544
|
-
c("backgrounds", "elevated", e("theme.bgElevated", "Elevated Surface")),
|
|
545
|
-
c("backgrounds", "inset", e("theme.bgInset", "Inset Surface")),
|
|
546
|
-
c("backgrounds", "canvas", e("theme.bgCanvas", "Canvas / Body"))
|
|
547
|
-
] }),
|
|
548
|
-
"background-image": () => /* @__PURE__ */ l("div", { className: "nice-theme-builder__grid", children: [
|
|
549
|
-
q("backgroundImage", "type", e("theme.bgiType", "Background Type"), [
|
|
550
|
-
"none",
|
|
551
|
-
"solid",
|
|
552
|
-
"gradient",
|
|
553
|
-
"image",
|
|
554
|
-
"pattern"
|
|
555
|
-
]),
|
|
556
|
-
a(
|
|
557
|
-
"backgroundImage",
|
|
558
|
-
"gradient",
|
|
559
|
-
e("theme.bgiGradient", "CSS Gradient")
|
|
560
|
-
),
|
|
561
|
-
a(
|
|
562
|
-
"backgroundImage",
|
|
563
|
-
"imageUrl",
|
|
564
|
-
e("theme.bgiImageUrl", "Image URL")
|
|
565
|
-
),
|
|
566
|
-
a(
|
|
567
|
-
"backgroundImage",
|
|
568
|
-
"imageSize",
|
|
569
|
-
e("theme.bgiImageSize", "Image Size (cover/contain/…)")
|
|
570
|
-
),
|
|
571
|
-
a(
|
|
572
|
-
"backgroundImage",
|
|
573
|
-
"imagePosition",
|
|
574
|
-
e("theme.bgiImagePosition", "Image Position")
|
|
575
|
-
),
|
|
576
|
-
q(
|
|
577
|
-
"backgroundImage",
|
|
578
|
-
"imageAttachment",
|
|
579
|
-
e("theme.bgiImageAttachment", "Image Attachment"),
|
|
580
|
-
["scroll", "fixed", "local"]
|
|
581
|
-
),
|
|
582
|
-
q(
|
|
583
|
-
"backgroundImage",
|
|
584
|
-
"imageRepeat",
|
|
585
|
-
e("theme.bgiImageRepeat", "Image Repeat"),
|
|
586
|
-
["repeat", "no-repeat", "repeat-x", "repeat-y"]
|
|
587
|
-
),
|
|
588
|
-
a(
|
|
589
|
-
"backgroundImage",
|
|
590
|
-
"pattern",
|
|
591
|
-
e("theme.bgiPattern", "Named Pattern (dots/grid/…)")
|
|
592
|
-
),
|
|
593
|
-
Le(
|
|
594
|
-
"backgroundImage",
|
|
595
|
-
"opacity",
|
|
596
|
-
e("theme.bgiOpacity", "Pattern Opacity")
|
|
597
|
-
),
|
|
598
|
-
a(
|
|
599
|
-
"backgroundImage",
|
|
600
|
-
"blendMode",
|
|
601
|
-
e("theme.bgiBlendMode", "Blend Mode")
|
|
602
|
-
)
|
|
603
|
-
] }),
|
|
604
|
-
text: () => /* @__PURE__ */ l("div", { className: "nice-theme-builder__grid", children: [
|
|
605
|
-
c("text", "primary", e("theme.textPrimary", "Primary Text")),
|
|
606
|
-
c("text", "secondary", e("theme.textSecondary", "Secondary Text")),
|
|
607
|
-
c("text", "muted", e("theme.textMuted", "Muted Text")),
|
|
608
|
-
c("text", "inverse", e("theme.textInverse", "Inverse Text")),
|
|
609
|
-
c("text", "onPrimary", e("theme.textOnPrimary", "Text on Primary")),
|
|
610
|
-
c("text", "onAccent", e("theme.textOnAccent", "Text on Accent"))
|
|
611
|
-
] }),
|
|
612
|
-
borders: () => /* @__PURE__ */ l("div", { className: "nice-theme-builder__grid", children: [
|
|
613
|
-
c("borders", "color", e("theme.borderColor", "Border Color")),
|
|
614
|
-
c("borders", "focusColor", e("theme.borderFocus", "Focus Border Color")),
|
|
615
|
-
c("borders", "divider", e("theme.borderDivider", "Divider Color")),
|
|
616
|
-
a("borders", "width", e("theme.borderWidth", "Border Width")),
|
|
617
|
-
a("borders", "radiusSm", e("theme.radiusSm", "Radius Small")),
|
|
618
|
-
a("borders", "radiusMd", e("theme.radiusMd", "Radius Medium")),
|
|
619
|
-
a("borders", "radiusLg", e("theme.radiusLg", "Radius Large")),
|
|
620
|
-
a("borders", "radiusXl", e("theme.radiusXl", "Radius XL")),
|
|
621
|
-
a("borders", "radiusFull", e("theme.radiusFull", "Radius Full"))
|
|
622
|
-
] }),
|
|
623
|
-
spacing: () => /* @__PURE__ */ l("div", { className: "nice-theme-builder__grid", children: [
|
|
624
|
-
a("spacing", "space1", "Space 1"),
|
|
625
|
-
a("spacing", "space2", "Space 2"),
|
|
626
|
-
a("spacing", "space3", "Space 3"),
|
|
627
|
-
a("spacing", "space4", "Space 4"),
|
|
628
|
-
a("spacing", "space5", "Space 5"),
|
|
629
|
-
a("spacing", "space6", "Space 6"),
|
|
630
|
-
a("spacing", "space8", "Space 8"),
|
|
631
|
-
a("spacing", "space10", "Space 10"),
|
|
632
|
-
a("spacing", "space12", "Space 12"),
|
|
633
|
-
a("spacing", "space16", "Space 16")
|
|
913
|
+
] }) }),
|
|
914
|
+
/* @__PURE__ */ r("div", { className: "nice-theme-builder__tabs", ref: ke, role: "tablist", children: z.map((i) => /* @__PURE__ */ r(
|
|
915
|
+
"button",
|
|
916
|
+
{
|
|
917
|
+
type: "button",
|
|
918
|
+
role: "tab",
|
|
919
|
+
"aria-selected": i === pe,
|
|
920
|
+
className: `nice-theme-builder__tab${i === pe ? " nice-theme-builder__tab--active" : ""}`,
|
|
921
|
+
onClick: () => be(i),
|
|
922
|
+
children: Ee[i]
|
|
923
|
+
},
|
|
924
|
+
i
|
|
925
|
+
)) }),
|
|
926
|
+
/* @__PURE__ */ r("div", { className: "nice-theme-builder__body", role: "tabpanel", ref: ge, children: Se[pe]?.() }),
|
|
927
|
+
/* @__PURE__ */ h("details", { className: "nice-theme-builder__preview", children: [
|
|
928
|
+
/* @__PURE__ */ r("summary", { className: "nice-theme-builder__preview-toggle", children: e("theme.preview", "CSS Variables Preview") }),
|
|
929
|
+
/* @__PURE__ */ r("pre", { className: "nice-theme-builder__preview-code", children: `:root {
|
|
930
|
+
${Oe}
|
|
931
|
+
}` })
|
|
634
932
|
] }),
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
933
|
+
/* @__PURE__ */ h("div", { className: "nice-theme-builder__actions", children: [
|
|
934
|
+
/* @__PURE__ */ h(
|
|
935
|
+
"button",
|
|
936
|
+
{
|
|
937
|
+
type: "button",
|
|
938
|
+
className: "nice-theme-builder__btn nice-theme-builder__btn--apply",
|
|
939
|
+
onClick: ie,
|
|
940
|
+
children: [
|
|
941
|
+
/* @__PURE__ */ r(I, { name: "check", size: "sm" }),
|
|
942
|
+
e("theme.apply", "Apply Theme")
|
|
943
|
+
]
|
|
944
|
+
}
|
|
646
945
|
),
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
I("typography", "lineHeight", "Line Height"),
|
|
659
|
-
a(
|
|
660
|
-
"typography",
|
|
661
|
-
"letterSpacing",
|
|
662
|
-
e("theme.letterSpacing", "Letter Spacing")
|
|
946
|
+
/* @__PURE__ */ h(
|
|
947
|
+
"button",
|
|
948
|
+
{
|
|
949
|
+
type: "button",
|
|
950
|
+
className: "nice-theme-builder__btn nice-theme-builder__btn--export",
|
|
951
|
+
onClick: ae,
|
|
952
|
+
children: [
|
|
953
|
+
/* @__PURE__ */ r(I, { name: "download", size: "sm" }),
|
|
954
|
+
e("theme.export", "Export JSON")
|
|
955
|
+
]
|
|
956
|
+
}
|
|
663
957
|
),
|
|
664
|
-
|
|
665
|
-
"
|
|
666
|
-
|
|
667
|
-
|
|
958
|
+
/* @__PURE__ */ h(
|
|
959
|
+
"button",
|
|
960
|
+
{
|
|
961
|
+
type: "button",
|
|
962
|
+
className: "nice-theme-builder__btn",
|
|
963
|
+
onClick: () => {
|
|
964
|
+
const i = Ue(m), n = Object.entries(je(m)).map(([_, y]) => ` ${_}: ${y};`).join(`
|
|
965
|
+
`), a = `/* Nice2Dev Theme: ${m.name} */
|
|
966
|
+
:root {
|
|
967
|
+
${n}
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
/* JSON */
|
|
971
|
+
/* ${i} */`;
|
|
972
|
+
navigator.clipboard?.writeText(a);
|
|
973
|
+
},
|
|
974
|
+
children: [
|
|
975
|
+
/* @__PURE__ */ r(I, { name: "copy", size: "sm" }),
|
|
976
|
+
e("theme.copy", "Copy to Clipboard")
|
|
977
|
+
]
|
|
978
|
+
}
|
|
668
979
|
)
|
|
669
|
-
] })
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
a("shadows", "xl", "Shadow XL"),
|
|
675
|
-
a("shadows", "inner", e("theme.shadowInner", "Inner Shadow")),
|
|
676
|
-
a("shadows", "glow", e("theme.shadowGlow", "Glow Shadow"))
|
|
677
|
-
] }),
|
|
678
|
-
transitions: () => /* @__PURE__ */ l("div", { className: "nice-theme-builder__grid", children: [
|
|
679
|
-
a("transitions", "fast", e("theme.transitionFast", "Transition Fast")),
|
|
680
|
-
a(
|
|
681
|
-
"transitions",
|
|
682
|
-
"normal",
|
|
683
|
-
e("theme.transitionNormal", "Transition Normal")
|
|
684
|
-
),
|
|
685
|
-
a("transitions", "slow", e("theme.transitionSlow", "Transition Slow"))
|
|
686
|
-
] }),
|
|
687
|
-
nesting: () => De()
|
|
688
|
-
}, Ae = {
|
|
689
|
-
general: e("theme.general", "General"),
|
|
690
|
-
colors: e("theme.colors", "Colors"),
|
|
691
|
-
backgrounds: e("theme.backgrounds", "Backgrounds"),
|
|
692
|
-
"background-image": e("theme.backgroundImage", "Background Image"),
|
|
693
|
-
text: e("theme.text", "Text"),
|
|
694
|
-
borders: e("theme.borders", "Borders"),
|
|
695
|
-
spacing: e("theme.spacing", "Spacing"),
|
|
696
|
-
typography: e("theme.typography", "Typography"),
|
|
697
|
-
shadows: e("theme.shadows", "Shadows"),
|
|
698
|
-
transitions: e("theme.transitions", "Transitions"),
|
|
699
|
-
nesting: e("theme.nesting", "Nesting")
|
|
700
|
-
};
|
|
701
|
-
return /* @__PURE__ */ l(
|
|
702
|
-
"div",
|
|
980
|
+
] })
|
|
981
|
+
] }),
|
|
982
|
+
N && /* @__PURE__ */ r("div", { className: "nice-theme-builder__preview-pane", children: /* @__PURE__ */ r(Qe, { theme: m, onTokenClick: W }) }),
|
|
983
|
+
/* @__PURE__ */ r(
|
|
984
|
+
Ze,
|
|
703
985
|
{
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
986
|
+
visible: p,
|
|
987
|
+
variant: "warning",
|
|
988
|
+
header: e("theme.unsaved", "Unsaved changes"),
|
|
989
|
+
message: e("theme.leaveConfirm", "Leave without saving? Your changes will be lost."),
|
|
990
|
+
acceptLabel: e("theme.leave", "Leave"),
|
|
991
|
+
rejectLabel: e("theme.cancel", "Cancel"),
|
|
992
|
+
onAccept: () => {
|
|
993
|
+
U(!1), g();
|
|
994
|
+
},
|
|
995
|
+
onReject: () => U(!1)
|
|
996
|
+
}
|
|
997
|
+
)
|
|
998
|
+
] });
|
|
999
|
+
}
|
|
1000
|
+
function it({ showPreview: s, onToggle: d }) {
|
|
1001
|
+
const { t: u } = Ge(), T = s ? u("theme.hidePreview", "Hide preview") : u("theme.showPreview", "Show preview");
|
|
1002
|
+
return /* @__PURE__ */ h(
|
|
1003
|
+
"button",
|
|
1004
|
+
{
|
|
1005
|
+
type: "button",
|
|
1006
|
+
className: `nice-theme-builder__btn nice-theme-builder__btn--preview-toggle${s ? " nice-theme-builder__btn--active" : ""}`,
|
|
1007
|
+
onClick: d,
|
|
1008
|
+
title: T,
|
|
1009
|
+
"aria-pressed": s,
|
|
1010
|
+
children: [
|
|
1011
|
+
/* @__PURE__ */ r(I, { name: s ? "eye-off" : "eye", size: "sm" }),
|
|
1012
|
+
T
|
|
1013
|
+
]
|
|
1014
|
+
}
|
|
1015
|
+
);
|
|
1016
|
+
}
|
|
1017
|
+
const He = "favorites", Q = "mine", Ve = (s) => `catalog:${s}`, we = (s, d) => `${s}::${d}`;
|
|
1018
|
+
function at(s, d) {
|
|
1019
|
+
if (!d)
|
|
1020
|
+
return null;
|
|
1021
|
+
for (const u of s) {
|
|
1022
|
+
if (u.id === d)
|
|
1023
|
+
return u;
|
|
1024
|
+
const T = u.children ? at(u.children, d) : null;
|
|
1025
|
+
if (T)
|
|
1026
|
+
return T;
|
|
1027
|
+
}
|
|
1028
|
+
return null;
|
|
1029
|
+
}
|
|
1030
|
+
function $t({ theme: s }) {
|
|
1031
|
+
return /* @__PURE__ */ h(
|
|
1032
|
+
"span",
|
|
1033
|
+
{
|
|
1034
|
+
className: "nice-theme-builder__swatch",
|
|
1035
|
+
style: { background: s.backgrounds?.primary, borderColor: s.borders?.color },
|
|
1036
|
+
"aria-hidden": "true",
|
|
1037
|
+
children: [
|
|
1038
|
+
/* @__PURE__ */ r("span", { style: { background: s.colors?.primary } }),
|
|
1039
|
+
/* @__PURE__ */ r("span", { style: { background: s.colors?.accent ?? s.text?.primary } })
|
|
1040
|
+
]
|
|
1041
|
+
}
|
|
1042
|
+
);
|
|
1043
|
+
}
|
|
1044
|
+
const Ht = /* @__PURE__ */ Object.assign(
|
|
1045
|
+
/* @__PURE__ */ pt((s, d) => {
|
|
1046
|
+
const {
|
|
1047
|
+
theme: u,
|
|
1048
|
+
presets: T,
|
|
1049
|
+
themes: z,
|
|
1050
|
+
onThemesChange: N,
|
|
1051
|
+
favorites: w,
|
|
1052
|
+
onFavoritesChange: g,
|
|
1053
|
+
storageKey: P = "nice-theme-designer",
|
|
1054
|
+
allowDelete: R = !1,
|
|
1055
|
+
startScreen: V = "browser",
|
|
1056
|
+
onSave: j,
|
|
1057
|
+
sections: Y,
|
|
1058
|
+
onChange: Te,
|
|
1059
|
+
onApply: he,
|
|
1060
|
+
onExport: e,
|
|
1061
|
+
livePreview: ke = !1,
|
|
1062
|
+
focusedToken: m,
|
|
1063
|
+
showPreview: Be = !0,
|
|
1064
|
+
previewPlacement: Me = "right",
|
|
1065
|
+
tutorial: B,
|
|
1066
|
+
className: te,
|
|
1067
|
+
style: ue,
|
|
1068
|
+
id: ne,
|
|
1069
|
+
...pe
|
|
1070
|
+
} = s, be = st(ne), { t: p } = Ge(), [U, ge] = E(Be), fe = f(() => ge((t) => !t), []), X = O(null), Ce = ee(
|
|
1071
|
+
() => Y ?? [
|
|
1072
|
+
"general",
|
|
1073
|
+
"colors",
|
|
1074
|
+
"backgrounds",
|
|
1075
|
+
"background-image",
|
|
1076
|
+
"text",
|
|
1077
|
+
"borders",
|
|
1078
|
+
"spacing",
|
|
1079
|
+
"typography",
|
|
1080
|
+
"shadows",
|
|
1081
|
+
"transitions"
|
|
1082
|
+
],
|
|
1083
|
+
[Y]
|
|
1084
|
+
), [xe, J] = E(() => Nt(P)), C = z ?? xe, W = f(
|
|
1085
|
+
(t) => {
|
|
1086
|
+
z === void 0 && (J(t), qe(P, "themes", t)), N?.(t);
|
|
1087
|
+
},
|
|
1088
|
+
[z, P, N]
|
|
1089
|
+
), [ye, re] = E(
|
|
1090
|
+
() => wt(P)
|
|
1091
|
+
), D = w ?? ye, H = f(
|
|
1092
|
+
(t) => {
|
|
1093
|
+
w === void 0 && (re(t), qe(P, "favorites", t)), g?.(t);
|
|
1094
|
+
},
|
|
1095
|
+
[w, P, g]
|
|
1096
|
+
), M = ee(() => Tt(T), [T]), $e = f(
|
|
1097
|
+
(t) => p(`theme.category.${t.id}`, t.label),
|
|
1098
|
+
[p]
|
|
1099
|
+
), ie = ee(() => {
|
|
1100
|
+
const t = /* @__PURE__ */ new Map();
|
|
1101
|
+
for (const o of M)
|
|
1102
|
+
for (const c of o.entries)
|
|
1103
|
+
t.has(c.name) || t.set(c.name, c.theme);
|
|
1104
|
+
return t;
|
|
1105
|
+
}, [M]), ae = ee(() => {
|
|
1106
|
+
const t = (v, S, K) => ({
|
|
1107
|
+
id: we(v, S.name),
|
|
1108
|
+
label: S.name,
|
|
1109
|
+
kind: "theme",
|
|
1110
|
+
group: v,
|
|
1111
|
+
depth: 1,
|
|
1112
|
+
theme: S,
|
|
1113
|
+
own: K
|
|
1114
|
+
}), o = (v, S, K) => ({
|
|
1115
|
+
id: v,
|
|
1116
|
+
label: S,
|
|
1117
|
+
kind: "group",
|
|
1118
|
+
group: v,
|
|
1119
|
+
depth: 0,
|
|
1120
|
+
count: K.length,
|
|
1121
|
+
children: K
|
|
1122
|
+
}), c = [];
|
|
1123
|
+
for (const v of new Set(D)) {
|
|
1124
|
+
const S = C.find((me) => me.name === v), K = S ?? ie.get(v);
|
|
1125
|
+
K && c.push(t(He, K, !!S));
|
|
1126
|
+
}
|
|
1127
|
+
const L = /* @__PURE__ */ new Set(), k = C.filter((v) => !L.has(v.name) && L.add(v.name)).map((v) => t(Q, v, !0));
|
|
1128
|
+
return [
|
|
1129
|
+
o(He, p("theme.favorites", "Favorites"), c),
|
|
1130
|
+
o(Q, p("theme.myThemes", "My themes"), k),
|
|
1131
|
+
...M.map((v) => {
|
|
1132
|
+
const S = Ve(v.id), K = /* @__PURE__ */ new Set();
|
|
1133
|
+
return o(
|
|
1134
|
+
S,
|
|
1135
|
+
$e(v),
|
|
1136
|
+
v.entries.filter((me) => !K.has(me.name) && K.add(me.name)).map((me) => t(S, me.theme, !1))
|
|
1137
|
+
);
|
|
1138
|
+
})
|
|
1139
|
+
];
|
|
1140
|
+
}, [D, C, ie, M, $e, p]), ve = f(
|
|
1141
|
+
(t) => ae.find((o) => o.id === t)?.label ?? p("theme.themes", "Themes"),
|
|
1142
|
+
[ae, p]
|
|
1143
|
+
), _e = f(
|
|
1144
|
+
(t) => {
|
|
1145
|
+
if (!t)
|
|
1146
|
+
return null;
|
|
1147
|
+
if (C.some((c) => c.name === t.name))
|
|
1148
|
+
return we(Q, t.name);
|
|
1149
|
+
const o = M.find((c) => c.entries.some((L) => L.name === t.name));
|
|
1150
|
+
return o ? we(Ve(o.id), t.name) : null;
|
|
1151
|
+
},
|
|
1152
|
+
[C, M]
|
|
1153
|
+
), [Ie, se] = E(() => _e(u)), x = at(ae, Ie), [Oe, b] = E(() => {
|
|
1154
|
+
const t = [He, Q], c = _e(u)?.split("::")[0];
|
|
1155
|
+
return c && !t.includes(c) ? [...t, c] : t;
|
|
1156
|
+
}), l = f((t) => {
|
|
1157
|
+
se(t);
|
|
1158
|
+
const o = t.split("::")[0];
|
|
1159
|
+
b((c) => c.includes(o) ? c : [...c, o]);
|
|
1160
|
+
}, []), [$, G] = E(() => {
|
|
1161
|
+
if (V !== "edit")
|
|
1162
|
+
return null;
|
|
1163
|
+
const t = u ?? Ke, o = _e(t), c = o?.startsWith(`${Q}::`) ?? !1;
|
|
1164
|
+
return {
|
|
1165
|
+
original: t,
|
|
1166
|
+
ownName: c ? t.name : null,
|
|
1167
|
+
groupLabel: o ? ve(o.split("::")[0]) : p("theme.themes", "Themes"),
|
|
1168
|
+
session: 0
|
|
1169
|
+
};
|
|
1170
|
+
}), Z = O(0), oe = f(
|
|
1171
|
+
(t) => {
|
|
1172
|
+
t.theme && (Z.current += 1, se(t.id), G({
|
|
1173
|
+
original: t.theme,
|
|
1174
|
+
ownName: t.own ? t.theme.name : null,
|
|
1175
|
+
groupLabel: ve(t.group),
|
|
1176
|
+
session: Z.current
|
|
1177
|
+
}));
|
|
1178
|
+
},
|
|
1179
|
+
[ve]
|
|
1180
|
+
), Pe = f(
|
|
1181
|
+
(t) => H(
|
|
1182
|
+
D.includes(t) ? D.filter((o) => o !== t) : [...D, t]
|
|
1183
|
+
),
|
|
1184
|
+
[D, H]
|
|
1185
|
+
), F = p("theme.untitled", "Untitled"), le = p("theme.copySuffix", "copy"), A = f(
|
|
1186
|
+
(t, o) => {
|
|
1187
|
+
const c = Je(o, new Set(C.map((k) => k.name))), L = { ...t, name: c };
|
|
1188
|
+
return W([...C, L]), l(we(Q, c)), L;
|
|
1189
|
+
},
|
|
1190
|
+
[C, W, l]
|
|
1191
|
+
), Fe = f(() => {
|
|
1192
|
+
const t = A(x?.theme ?? Ke, p("theme.myThemeName", "My theme"));
|
|
1193
|
+
Z.current += 1, G({
|
|
1194
|
+
original: t,
|
|
1195
|
+
ownName: t.name,
|
|
1196
|
+
groupLabel: p("theme.myThemes", "My themes"),
|
|
1197
|
+
session: Z.current
|
|
1198
|
+
});
|
|
1199
|
+
}, [A, x, p]), q = f(() => {
|
|
1200
|
+
x?.theme && A(x.theme, `${x.theme.name.trim() || F} ${le}`);
|
|
1201
|
+
}, [A, x, F, le]), Le = f(
|
|
1202
|
+
(t) => {
|
|
1203
|
+
const o = t.target.files?.[0];
|
|
1204
|
+
t.target.value = "", o && rt(o, (c) => A(c, c.name.trim() || F));
|
|
1205
|
+
},
|
|
1206
|
+
[A, F]
|
|
1207
|
+
), [ce, Se] = E(null), Ee = f(() => {
|
|
1208
|
+
const t = ce;
|
|
1209
|
+
Se(null), t !== null && (W(C.filter((o) => o.name !== t)), D.includes(t) && !ie.has(t) && H(D.filter((o) => o !== t)), se(null));
|
|
1210
|
+
}, [ce, C, W, D, H, ie]), ze = f(
|
|
1211
|
+
(t) => {
|
|
1212
|
+
const o = $?.ownName ?? t.name, c = C.some((S) => S.name === o), L = new Set(C.filter((S) => S.name !== o).map((S) => S.name)), k = Je(t.name.trim() || F, L), v = k === t.name ? t : { ...t, name: k };
|
|
1213
|
+
return W(
|
|
1214
|
+
c ? C.map((S) => S.name === o ? v : S) : [...C, v]
|
|
1215
|
+
), k !== o && D.includes(o) && H(D.map((S) => S === o ? k : S)), G((S) => S && { ...S, original: v, ownName: k }), l(we(Q, k)), j?.(v), v;
|
|
1216
|
+
},
|
|
1217
|
+
[$, C, W, D, H, l, j, F]
|
|
1218
|
+
), Re = f(
|
|
1219
|
+
(t) => {
|
|
1220
|
+
const o = t.name.trim() || F, c = new Set(C.map((v) => v.name)), L = $ && o !== $.original.name && !c.has(o), k = A(t, L ? o : `${o} ${le}`);
|
|
1221
|
+
return G(
|
|
1222
|
+
(v) => v && {
|
|
1223
|
+
...v,
|
|
1224
|
+
original: k,
|
|
1225
|
+
ownName: k.name,
|
|
1226
|
+
groupLabel: p("theme.myThemes", "My themes")
|
|
1227
|
+
}
|
|
1228
|
+
), j?.(k), k;
|
|
1229
|
+
},
|
|
1230
|
+
[$, C, A, j, F, le, p]
|
|
1231
|
+
), i = f(() => G(null), []), n = ee(
|
|
1232
|
+
() => [
|
|
1233
|
+
{
|
|
1234
|
+
field: "label",
|
|
1235
|
+
header: p("theme.name", "Theme Name"),
|
|
1236
|
+
render: (t, o) => o.kind === "group" ? /* @__PURE__ */ h("span", { className: "nice-theme-builder__tree-group", children: [
|
|
1237
|
+
o.label,
|
|
1238
|
+
/* @__PURE__ */ r("span", { className: "nice-theme-builder__tree-count", children: o.count })
|
|
1239
|
+
] }) : /* @__PURE__ */ h(
|
|
1240
|
+
"span",
|
|
1241
|
+
{
|
|
1242
|
+
className: "nice-theme-builder__tree-theme",
|
|
1243
|
+
onDoubleClick: () => oe(o),
|
|
1244
|
+
children: [
|
|
1245
|
+
o.theme && /* @__PURE__ */ r($t, { theme: o.theme }),
|
|
1246
|
+
/* @__PURE__ */ r("span", { className: "nice-theme-builder__tree-label", title: o.label, children: o.label })
|
|
1247
|
+
]
|
|
1248
|
+
}
|
|
1249
|
+
)
|
|
1250
|
+
},
|
|
1251
|
+
{
|
|
1252
|
+
field: "actions",
|
|
1253
|
+
header: "",
|
|
1254
|
+
width: 72,
|
|
1255
|
+
align: "right",
|
|
1256
|
+
render: (t, o) => {
|
|
1257
|
+
if (o.kind !== "theme" || !o.theme)
|
|
1258
|
+
return null;
|
|
1259
|
+
const c = o.theme.name, L = D.includes(c), k = L ? p("theme.removeFavorite", "Remove from favorites") : p("theme.addFavorite", "Add to favorites");
|
|
1260
|
+
return /* @__PURE__ */ h("span", { className: "nice-theme-builder__row-actions", children: [
|
|
1261
|
+
/* @__PURE__ */ r(
|
|
953
1262
|
"button",
|
|
954
1263
|
{
|
|
955
1264
|
type: "button",
|
|
956
|
-
className:
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
1265
|
+
className: `nice-theme-builder__icon-btn nice-theme-builder__star${L ? " nice-theme-builder__star--on" : ""}`,
|
|
1266
|
+
"aria-pressed": L,
|
|
1267
|
+
"aria-label": `${k}: ${c}`,
|
|
1268
|
+
title: k,
|
|
1269
|
+
onClick: (v) => {
|
|
1270
|
+
v.stopPropagation(), Pe(c);
|
|
1271
|
+
},
|
|
1272
|
+
children: /* @__PURE__ */ r(I, { name: "star", size: 14 })
|
|
962
1273
|
}
|
|
963
1274
|
),
|
|
964
|
-
/* @__PURE__ */
|
|
1275
|
+
/* @__PURE__ */ r(
|
|
965
1276
|
"button",
|
|
966
1277
|
{
|
|
967
1278
|
type: "button",
|
|
968
|
-
className: "nice-theme-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
${r}
|
|
974
|
-
}
|
|
975
|
-
|
|
976
|
-
/* JSON */
|
|
977
|
-
/* ${t} */`;
|
|
978
|
-
navigator.clipboard?.writeText(n);
|
|
1279
|
+
className: "nice-theme-builder__icon-btn",
|
|
1280
|
+
"aria-label": `${p("theme.edit", "Edit")}: ${c}`,
|
|
1281
|
+
title: p("theme.edit", "Edit"),
|
|
1282
|
+
onClick: (v) => {
|
|
1283
|
+
v.stopPropagation(), oe(o);
|
|
979
1284
|
},
|
|
980
|
-
children:
|
|
981
|
-
/* @__PURE__ */ i(v, { name: "copy", size: "sm" }),
|
|
982
|
-
e("theme.copy", "Copy to Clipboard")
|
|
983
|
-
]
|
|
1285
|
+
children: /* @__PURE__ */ r(I, { name: "edit", size: 14 })
|
|
984
1286
|
}
|
|
985
1287
|
)
|
|
986
|
-
] })
|
|
987
|
-
|
|
988
|
-
|
|
1288
|
+
] });
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
],
|
|
1292
|
+
[D, oe, Pe, p]
|
|
1293
|
+
), a = R && !!x?.own && !!x.theme, _ = /* @__PURE__ */ h("div", { className: "nice-theme-builder__toolbar", children: [
|
|
1294
|
+
/* @__PURE__ */ h(
|
|
1295
|
+
"button",
|
|
1296
|
+
{
|
|
1297
|
+
type: "button",
|
|
1298
|
+
className: "nice-theme-builder__btn nice-theme-builder__btn--new",
|
|
1299
|
+
onClick: Fe,
|
|
1300
|
+
children: [
|
|
1301
|
+
/* @__PURE__ */ r(I, { name: "plus", size: "sm" }),
|
|
1302
|
+
p("theme.newTheme", "New")
|
|
1303
|
+
]
|
|
1304
|
+
}
|
|
1305
|
+
),
|
|
1306
|
+
/* @__PURE__ */ h(
|
|
1307
|
+
"button",
|
|
1308
|
+
{
|
|
1309
|
+
type: "button",
|
|
1310
|
+
className: "nice-theme-builder__btn",
|
|
1311
|
+
onClick: q,
|
|
1312
|
+
disabled: !x?.theme,
|
|
1313
|
+
children: [
|
|
1314
|
+
/* @__PURE__ */ r(I, { name: "copy", size: "sm" }),
|
|
1315
|
+
p("theme.duplicate", "Duplicate")
|
|
1316
|
+
]
|
|
1317
|
+
}
|
|
1318
|
+
),
|
|
1319
|
+
/* @__PURE__ */ h(
|
|
1320
|
+
"button",
|
|
1321
|
+
{
|
|
1322
|
+
type: "button",
|
|
1323
|
+
className: "nice-theme-builder__btn",
|
|
1324
|
+
onClick: () => x && oe(x),
|
|
1325
|
+
disabled: !x?.theme,
|
|
1326
|
+
children: [
|
|
1327
|
+
/* @__PURE__ */ r(I, { name: "edit", size: "sm" }),
|
|
1328
|
+
p("theme.edit", "Edit")
|
|
1329
|
+
]
|
|
1330
|
+
}
|
|
1331
|
+
),
|
|
1332
|
+
/* @__PURE__ */ h(
|
|
1333
|
+
"button",
|
|
1334
|
+
{
|
|
1335
|
+
type: "button",
|
|
1336
|
+
className: "nice-theme-builder__btn",
|
|
1337
|
+
onClick: () => X.current?.click(),
|
|
1338
|
+
children: [
|
|
1339
|
+
/* @__PURE__ */ r(I, { name: "upload", size: "sm" }),
|
|
1340
|
+
p("theme.import", "Import")
|
|
1341
|
+
]
|
|
1342
|
+
}
|
|
1343
|
+
),
|
|
1344
|
+
/* @__PURE__ */ r(
|
|
1345
|
+
"input",
|
|
1346
|
+
{
|
|
1347
|
+
ref: X,
|
|
1348
|
+
type: "file",
|
|
1349
|
+
accept: "application/json,.json",
|
|
1350
|
+
style: { display: "none" },
|
|
1351
|
+
onChange: Le
|
|
1352
|
+
}
|
|
1353
|
+
),
|
|
1354
|
+
R && /* @__PURE__ */ h(
|
|
1355
|
+
"button",
|
|
1356
|
+
{
|
|
1357
|
+
type: "button",
|
|
1358
|
+
className: "nice-theme-builder__btn nice-theme-builder__btn--danger",
|
|
1359
|
+
onClick: () => x?.theme && Se(x.theme.name),
|
|
1360
|
+
disabled: !a,
|
|
1361
|
+
children: [
|
|
1362
|
+
/* @__PURE__ */ r(I, { name: "trash", size: "sm" }),
|
|
1363
|
+
p("theme.delete", "Delete")
|
|
1364
|
+
]
|
|
1365
|
+
}
|
|
1366
|
+
),
|
|
1367
|
+
/* @__PURE__ */ r(it, { showPreview: U, onToggle: fe })
|
|
1368
|
+
] }), y = $ ? "edit" : "browser";
|
|
1369
|
+
return /* @__PURE__ */ h(
|
|
1370
|
+
"div",
|
|
1371
|
+
{
|
|
1372
|
+
ref: d,
|
|
1373
|
+
id: be,
|
|
1374
|
+
className: `nice-theme-builder nice-theme-builder--${y}${U ? ` nice-theme-builder--with-preview nice-theme-builder--preview-${Me}` : ""}${te ? ` ${te}` : ""}`,
|
|
1375
|
+
style: { position: "relative", ...ue },
|
|
1376
|
+
"data-testid": pe["data-testid"] ?? "nice-theme-builder",
|
|
1377
|
+
"data-screen": y,
|
|
1378
|
+
children: [
|
|
1379
|
+
/* @__PURE__ */ r("span", { style: { position: "absolute", top: 6, right: 6, zIndex: 20 }, children: /* @__PURE__ */ r(
|
|
1380
|
+
ot,
|
|
1381
|
+
{
|
|
1382
|
+
steps: lt(B, $ ? _t : vt)
|
|
1383
|
+
}
|
|
1384
|
+
) }),
|
|
1385
|
+
$ ? /* @__PURE__ */ r(
|
|
1386
|
+
xt,
|
|
1387
|
+
{
|
|
1388
|
+
controlId: be,
|
|
1389
|
+
original: $.original,
|
|
1390
|
+
own: $.ownName !== null,
|
|
1391
|
+
groupLabel: $.groupLabel,
|
|
1392
|
+
allSections: Ce,
|
|
1393
|
+
showPreview: U,
|
|
1394
|
+
onTogglePreview: fe,
|
|
1395
|
+
onBack: i,
|
|
1396
|
+
onSave: ze,
|
|
1397
|
+
onSaveCopy: Re,
|
|
1398
|
+
onChange: Te,
|
|
1399
|
+
onApply: he,
|
|
1400
|
+
onExport: e,
|
|
1401
|
+
livePreview: ke,
|
|
1402
|
+
focusedToken: m
|
|
1403
|
+
},
|
|
1404
|
+
$.session
|
|
1405
|
+
) : /* @__PURE__ */ h(Ye, { children: [
|
|
1406
|
+
/* @__PURE__ */ r("div", { className: "nice-theme-builder__main nice-theme-builder__browser", children: /* @__PURE__ */ r("div", { className: "nice-theme-builder__tree", children: /* @__PURE__ */ r(
|
|
1407
|
+
gt,
|
|
1408
|
+
{
|
|
1409
|
+
data: ae,
|
|
1410
|
+
nested: !0,
|
|
1411
|
+
keyField: "id",
|
|
1412
|
+
childrenField: "children",
|
|
1413
|
+
columns: n,
|
|
1414
|
+
sortable: !1,
|
|
1415
|
+
compact: !0,
|
|
1416
|
+
searchable: !0,
|
|
1417
|
+
searchFields: ["label"],
|
|
1418
|
+
searchKeepDescendants: !0,
|
|
1419
|
+
searchPlaceholder: p("theme.search", "Search themes"),
|
|
1420
|
+
toolbar: _,
|
|
1421
|
+
toolbarActions: ["collapseAll"],
|
|
1422
|
+
expandedKeys: Oe,
|
|
1423
|
+
onExpandedChange: b,
|
|
1424
|
+
onRowClick: (t) => t.kind === "theme" && se(t.id),
|
|
1425
|
+
rowClassName: (t) => t.kind === "group" ? "nice-theme-builder__tree-row--group" : t.id === Ie ? "nice-theme-builder__tree-row--selected" : void 0,
|
|
1426
|
+
"aria-label": p("theme.themes", "Themes"),
|
|
1427
|
+
"data-testid": "nice-theme-designer-tree"
|
|
1428
|
+
}
|
|
1429
|
+
) }) }),
|
|
1430
|
+
U && /* @__PURE__ */ r("div", { className: "nice-theme-builder__preview-pane", children: x?.theme ? /* @__PURE__ */ r(Qe, { theme: x.theme }) : /* @__PURE__ */ r("div", { className: "nice-theme-builder__empty", children: p("theme.noSelection", "Select a theme to preview it") }) }),
|
|
1431
|
+
/* @__PURE__ */ r(
|
|
1432
|
+
Ze,
|
|
1433
|
+
{
|
|
1434
|
+
visible: ce !== null,
|
|
1435
|
+
variant: "error",
|
|
1436
|
+
header: p("theme.delete", "Delete"),
|
|
1437
|
+
message: p(
|
|
1438
|
+
"theme.deleteConfirm",
|
|
1439
|
+
'Delete the theme "{name}"? This cannot be undone.'
|
|
1440
|
+
).replace("{name}", ce ?? ""),
|
|
1441
|
+
acceptLabel: p("theme.delete", "Delete"),
|
|
1442
|
+
rejectLabel: p("theme.cancel", "Cancel"),
|
|
1443
|
+
onAccept: Ee,
|
|
1444
|
+
onReject: () => Se(null)
|
|
1445
|
+
}
|
|
1446
|
+
)
|
|
1447
|
+
] })
|
|
989
1448
|
]
|
|
990
1449
|
}
|
|
991
1450
|
);
|
|
@@ -993,5 +1452,5 @@ ${r}
|
|
|
993
1452
|
{ displayName: "NiceThemeDesigner" }
|
|
994
1453
|
);
|
|
995
1454
|
export {
|
|
996
|
-
|
|
1455
|
+
Ht as NiceThemeDesigner
|
|
997
1456
|
};
|