@nice2dev/ui 1.3.15 → 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.
Files changed (38) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/dist/{NiceDataGrid-BwiBkE3u.cjs → NiceDataGrid-aNPAHsWy.cjs} +1 -1
  3. package/dist/NiceEventOrchestrator.doc-Dwtq2s_L.cjs +6 -0
  4. package/dist/{NiceForm-Cxvh2O6y.cjs → NiceForm-BtRBLffD.cjs} +1 -1
  5. package/dist/{NiceMention-CYTx04JY.cjs → NiceMention-CMqAGvO0.cjs} +1 -1
  6. package/dist/NiceModuleLifecyclePanel-ugNtHimh.cjs +1 -0
  7. package/dist/{NicePagination-CKsAP38Q.cjs → NicePagination-D7XxeNFz.cjs} +1 -1
  8. package/dist/{NiceSavedQueryPanel-CN1rCPFs.cjs → NiceSavedQueryPanel-JHrSlHAV.cjs} +1 -1
  9. package/dist/{NiceScheduler-K8ZAqFCQ.cjs → NiceScheduler-2TwOZq-y.cjs} +1 -1
  10. package/dist/{core-lazy-DfNWyf__.cjs → core-lazy-Cda-D35m.cjs} +1 -1
  11. package/dist/data.cjs +1 -1
  12. package/dist/docs/NiceEventOrchestrator.doc.json.mjs +19 -19
  13. package/dist/editors/inputs/NiceNumberInput.mjs +27 -27
  14. package/dist/editors.cjs +1 -1
  15. package/dist/index.cjs +220 -220
  16. package/dist/index.d.ts +129 -62
  17. package/dist/index.mjs +912 -910
  18. package/dist/lazy.cjs +1 -1
  19. package/dist/navigation/NiceFirstRunPreferences.mjs +55 -54
  20. package/dist/navigation/NiceNavShell.mjs +429 -429
  21. package/dist/navigation/NiceSetupWizard.mjs +333 -317
  22. package/dist/navigation/NiceSidebarNav.mjs +1111 -1039
  23. package/dist/navigation/menuBuilderModel.mjs +1 -1
  24. package/dist/navigation/sidebarColors.mjs +67 -39
  25. package/dist/navigation/sidebarNavTypes.mjs +16 -14
  26. package/dist/navigation/sidebarPrefs/NiceSidebarPrefsDisplay.mjs +120 -42
  27. package/dist/navigation.cjs +1 -1
  28. package/dist/navigation.d.ts +32 -6
  29. package/dist/{no-code-BQqK8mvU.cjs → no-code-B3BHeyG-.cjs} +1 -1
  30. package/dist/no-code.cjs +1 -1
  31. package/dist/style.css +2 -2
  32. package/dist/tools/NiceThemeDesigner.mjs +1359 -900
  33. package/dist/tools/NiceThemePreview.mjs +18 -18
  34. package/dist/tools/themeCatalog.mjs +50 -0
  35. package/dist/workflow/NiceWorkflowDesigner.mjs +452 -898
  36. package/package.json +5 -5
  37. package/dist/NiceEventOrchestrator.doc-CxjsLxBG.cjs +0 -6
  38. package/dist/NiceModuleLifecyclePanel-DHHAjwQx.cjs +0 -1
@@ -1,33 +1,36 @@
1
- import { jsxs as l, jsx as i } from "react/jsx-runtime";
2
- import { useNiceTranslation as He } from "@nice2dev/i18n";
3
- import { useRovingFocus as Oe, NICE_THEME_PRESETS as Ee, useControlId as je, niceThemeLight as Ke, NiceThemeContext as Xe, applyTheme as Ge, deserializeTheme as Ue, useMenuButton as Ve, serializeTheme as ue, themeToCssVars as Y, NiceTutorialButton as qe, resolveTutorial as Je, NiceIcon as v, NICE_DISPLAY_STYLES as Ye } from "@nice2dev/ui-core";
4
- import { forwardRef as Qe, useRef as f, useState as w, useMemo as Q, useCallback as p, useEffect as Z, useContext as Ze } from "react";
5
- import { NiceNumberInput as M } from "../editors/inputs/NiceNumberInput.mjs";
6
- import { NiceSelect as D } from "../editors/inputs/NiceSelect.mjs";
7
- import { NiceTextInput as pe } from "../editors/inputs/NiceTextInput.mjs";
8
- import { NiceColorPalette as et } from "../editors/pickers/NiceColorPalette.mjs";
9
- import { NiceColorPicker as be } from "../editors/pickers/NiceColorPicker.mjs";
10
- import { NiceThemePicker as tt } from "../editors/pickers/NiceThemePicker.mjs";
11
- import { toThemeDescriptor as rt } from "../editors/pickers/themePickerHelpers.mjs";
12
- import { downloadBlob as nt } from "./NiceExport.mjs";
13
- import { NiceThemePreview as it } from "./NiceThemePreview.mjs";
14
- const at = [
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-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
- },
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: "bottom"
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 ot(h) {
57
- return h.startsWith("colors.") ? "colors" : h.startsWith("backgrounds.") ? "backgrounds" : h.startsWith("backgroundImage.") ? "background-image" : h.startsWith("text.") ? "text" : h.startsWith("borders.") ? "borders" : h.startsWith("spacing.") ? "spacing" : h.startsWith("typography.") ? "typography" : h.startsWith("shadows.") ? "shadows" : h.startsWith("transitions.") ? "transitions" : h === "name" || h === "darkMode" || h === "darkThemeName" || h === "recommendedDisplayStyle" ? "general" : null;
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
- const _t = /* @__PURE__ */ Object.assign(
60
- /* @__PURE__ */ Qe((h, ge) => {
61
- const ee = f(null);
62
- Oe(ee, { orientation: "horizontal", wrap: !0, activateOnMove: !0 });
63
- const {
64
- theme: ye,
65
- presets: B = Ee,
66
- sections: te,
67
- onChange: b,
68
- onApply: re,
69
- onExport: R,
70
- livePreview: ne = !1,
71
- focusedToken: A,
72
- showPreview: ve = !0,
73
- previewPlacement: fe = "right",
74
- tutorial: _e,
75
- className: ie,
76
- style: Ne,
77
- id: we,
78
- ...Se
79
- } = h, g = je(we), { t: e } = He(), [o, T] = w(ye ?? Ke), [W, ae] = w("colors"), [xe, k] = w(!1), [C, H] = w(""), [N, Te] = w(ve), [O, E] = w(!1), ke = f(null), j = f(null), oe = f(null), K = Q(
80
- () => te ?? [
81
- "general",
82
- "colors",
83
- "backgrounds",
84
- "background-image",
85
- "text",
86
- "borders",
87
- "spacing",
88
- "typography",
89
- "shadows",
90
- "transitions"
91
- ],
92
- [te]
93
- ), S = f(null), X = f(null), G = p(
94
- (t) => {
95
- const r = ot(t);
96
- r && K.includes(r) && (ae(r), requestAnimationFrame(() => {
97
- requestAnimationFrame(() => {
98
- if (!j.current)
99
- return;
100
- const n = j.current.querySelector(
101
- `[data-token="${t}"]`
102
- );
103
- if (!n)
104
- return;
105
- n.scrollIntoView({ behavior: "smooth", block: "center" }), n.querySelector("input, select, textarea")?.focus(), X.current?.classList.remove("nice-theme-builder__field--targeted"), n.classList.add("nice-theme-builder__field--targeted"), X.current = n, S.current && clearTimeout(S.current), S.current = setTimeout(() => {
106
- n.classList.remove("nice-theme-builder__field--targeted"), X.current = null, S.current = null;
107
- }, 1500);
108
- });
109
- }));
110
- },
111
- [K]
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
- Z(
114
- () => () => {
115
- S.current && clearTimeout(S.current);
116
- },
117
- []
118
- ), Z(() => {
119
- A && G(A);
120
- }, [A, G]);
121
- const U = Q(
122
- () => B.map(rt),
123
- [B]
124
- ), V = Ze(Xe)?.setTheme, F = p(
125
- (t) => V ? V(t) : Ge(t),
126
- [V]
127
- ), Ce = f(o);
128
- Z(() => {
129
- ne && o !== Ce.current && F(o);
130
- }, [ne, o, F]);
131
- const P = p(
132
- (t) => {
133
- T((r) => {
134
- const n = { ...r, ...t };
135
- return b?.(n), n;
136
- });
137
- },
138
- [b]
139
- ), $ = p(
140
- (t, r, n) => {
141
- T((m) => {
142
- const s = m[t], d = typeof s == "object" && s !== null ? s : {}, u = {
143
- ...m,
144
- [t]: { ...d, [r]: n }
145
- };
146
- return b?.(u), u;
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
- [b]
150
- ), L = p(
151
- (t) => {
152
- T(t), b?.(t);
153
- },
154
- [b]
155
- ), le = p(() => {
156
- if (!C.trim())
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 t = { ...o, name: C.trim() };
159
- T(t), b?.(t), k(!1), H("");
160
- }, [C, o, b]), Pe = p(() => {
161
- const t = o.name?.trim() || e("theme.untitled", "Untitled"), r = { ...o, name: `${t} ${e("theme.copySuffix", "copy")}` };
162
- T(r), b?.(r);
163
- }, [o, b, e]), $e = p(
164
- (t) => {
165
- const r = t.target.files?.[0];
166
- if (t.target.value = "", !r)
167
- return;
168
- const n = new FileReader();
169
- n.onload = () => {
170
- try {
171
- const m = String(n.result ?? "");
172
- let s;
173
- try {
174
- s = Ue(m);
175
- } catch {
176
- s = JSON.parse(m);
177
- }
178
- L(s);
179
- } catch {
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
- }, n.readAsText(r);
340
+ )
182
341
  },
183
- [L]
184
- ), se = f(null), ce = f(null);
185
- Ve(se, ce, {
186
- open: O,
187
- onOpenChange: E
188
- });
189
- const Ie = p(() => {
190
- F(o), re?.(o);
191
- }, [o, re, F]), ze = p(() => {
192
- const t = ue(o);
193
- if (R) {
194
- R(t, Y(o));
195
- return;
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
- const r = (o.name ?? "").trim().replace(/[^\w.-]+/g, "-") || "theme";
198
- nt(
199
- new Blob([t], { type: "application/json;charset=utf-8" }),
200
- `${r}.json`
201
- );
202
- }, [o, R]), Be = Q(() => {
203
- const t = Y(o);
204
- return Object.entries(t).map(([r, n]) => ` ${r}: ${n};`).join(`
205
- `);
206
- }, [o]), c = (t, r, n) => {
207
- const m = o[t] ?? {}, s = `${t}.${r}`;
208
- return /* @__PURE__ */ i(
209
- "div",
210
- {
211
- className: "nice-theme-builder__field nice-theme-builder__field--color",
212
- "data-token": s,
213
- children: /* @__PURE__ */ i(
214
- be,
215
- {
216
- id: `${g}-${t}-${r}`,
217
- label: n,
218
- labelPlacement: "left",
219
- size: "sm",
220
- compact: !0,
221
- value: m[r] || "",
222
- onChange: (d) => $(t, r, d)
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
- r
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
- }, a = (t, r, n) => {
229
- const m = o[t] ?? {}, s = `${t}.${r}`;
230
- return /* @__PURE__ */ i("div", { className: "nice-theme-builder__field", "data-token": s, children: /* @__PURE__ */ i(
231
- pe,
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
- id: `${g}-${t}-${r}`,
234
- label: n,
467
+ label: e("theme.nestingSurface", "Surface"),
235
468
  labelPlacement: "left",
236
469
  size: "sm",
237
- value: m[r] || "",
238
- onChange: (d) => $(t, r, d)
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
- ) }, r);
241
- }, I = (t, r, n) => {
242
- const m = o[t] ?? {}, s = `${t}.${r}`;
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
- id: `${g}-${t}-${r}`,
247
- label: n,
485
+ label: e("theme.nestingLevels", "Levels"),
248
486
  labelPlacement: "left",
249
487
  size: "sm",
250
- value: m[r] ?? 0,
251
- onChange: (d) => $(t, r, typeof d == "number" ? d : parseFloat(String(d)) || 0),
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
- ) }, r);
255
- }, q = (t, r, n, m) => {
256
- const s = o[t], d = `${t}.${r}`, u = s?.[r] ?? "";
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
- id: `${g}-${t}-${r}`,
261
- label: n,
503
+ label: e("theme.nestingDerivation", "Bg derivation"),
262
504
  labelPlacement: "left",
263
505
  size: "sm",
264
- clearable: !0,
265
- value: u,
266
- onChange: (y) => $(t, r, Array.isArray(y) ? y[0] ?? "" : y),
267
- options: m.map((y) => ({ value: y, label: y }))
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: n.map((u) => ({ value: u, label: u }))
286
- }
287
- ) }, d);
288
- }, Fe = (t, r) => {
289
- const n = o[t] ?? "", m = String(t);
290
- return /* @__PURE__ */ i("div", { className: "nice-theme-builder__field", "data-token": m, children: /* @__PURE__ */ i(
291
- pe,
292
- {
293
- id: `${g}-${m}`,
294
- label: r,
295
- labelPlacement: "left",
296
- size: "sm",
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
- ) }, m);
301
- }, Le = (t, r, n, m = 0, s = 1, d = 0.05) => {
302
- const u = o[t], y = `${t}.${r}`, We = u?.[r] ?? s;
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
- id: `${g}-${t}-${r}`,
307
- label: n,
528
+ label: e("theme.nestingStep", "Step"),
308
529
  labelPlacement: "left",
309
530
  size: "sm",
310
- min: m,
311
- max: s,
312
- step: d,
531
+ min: 0,
532
+ max: 0.5,
533
+ step: 0.02,
313
534
  precision: 2,
314
- value: Number(We),
315
- onChange: (J) => $(t, r, typeof J == "number" ? J : parseFloat(String(J)) || 0),
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
- ) }, r);
319
- }, [_, Me] = w("sidebar"), z = o.nesting?.[_] ?? {}, de = Math.max(1, Math.min(10, z.levels ?? 5)), x = p(
320
- (t, r) => {
321
- const n = (o.nesting ?? {})[t] ?? {}, m = {
322
- ...o,
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
- label: e("theme.nestingSurface", "Surface"),
350
- labelPlacement: "left",
351
- size: "sm",
352
- value: _,
353
- onChange: (r) => {
354
- const n = Array.isArray(r) ? r[0] : r;
355
- (n === "sidebar" || n === "menu" || n === "tree") && Me(n);
356
- },
357
- options: [
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
- /* @__PURE__ */ i("div", { className: "nice-theme-builder__field", children: /* @__PURE__ */ i(
365
- M,
558
+ )
559
+ ] }),
560
+ /* @__PURE__ */ h("details", { className: "nice-theme-builder__field", style: { gridColumn: "1 / -1" }, children: [
561
+ /* @__PURE__ */ r(
562
+ "summary",
366
563
  {
367
- label: e("theme.nestingLevels", "Levels"),
368
- labelPlacement: "left",
369
- size: "sm",
370
- min: 1,
371
- max: 10,
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
- showStepper: !0
570
+ children: e("theme.nestingOverrides", "Per-level overrides")
380
571
  }
381
- ) }),
382
- /* @__PURE__ */ i("div", { className: "nice-theme-builder__field", children: /* @__PURE__ */ i(
383
- D,
384
- {
385
- label: e("theme.nestingDerivation", "Bg derivation"),
386
- labelPlacement: "left",
387
- size: "sm",
388
- value: z.bgDerivation ?? "tint",
389
- onChange: (r) => {
390
- const n = Array.isArray(r) ? r[0] : r;
391
- (n === "tint" || n === "shade" || n === "mix-surface" || n === "palette") && x(_, { bgDerivation: n });
392
- },
393
- options: [
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
- { value: "mix-surface", label: e("theme.mixWithSurface", "Mix with surface") },
403
- { value: "palette", label: e("theme.cyclePalette", "Cycle palette") }
404
- ]
405
- }
406
- ) }),
407
- /* @__PURE__ */ i("div", { className: "nice-theme-builder__field", children: /* @__PURE__ */ i(
408
- M,
409
- {
410
- label: e("theme.nestingStep", "Step"),
411
- labelPlacement: "left",
412
- size: "sm",
413
- min: 0,
414
- max: 0.5,
415
- step: 0.02,
416
- precision: 2,
417
- value: z.bgStep ?? 0.06,
418
- onChange: (r) => {
419
- const n = typeof r == "number" ? r : Number(r);
420
- Number.isFinite(n) && x(_, { bgStep: Math.max(0, Math.min(0.5, n)) });
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
- showStepper: !0
423
- }
424
- ) }),
425
- /* @__PURE__ */ l("div", { className: "nice-theme-builder__field", style: { gridColumn: "1 / -1" }, children: [
426
- /* @__PURE__ */ i("div", { style: { fontSize: 12, fontWeight: 600, marginBottom: 4 }, children: e("theme.nestingPalette", "Base palette") }),
427
- /* @__PURE__ */ i(
428
- et,
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
- value: z.palette ?? [],
431
- onChange: (r) => x(_, { palette: r }),
432
- minColors: 1,
433
- maxColors: 10,
434
- showWheel: !0,
435
- showContrast: !1,
436
- showInfo: !1,
437
- showVariations: !1,
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__ */ l("details", { className: "nice-theme-builder__field", style: { gridColumn: "1 / -1" }, children: [
443
- /* @__PURE__ */ i(
444
- "summary",
836
+ /* @__PURE__ */ h("div", { className: "nice-theme-builder__toolbar", children: [
837
+ /* @__PURE__ */ r(
838
+ "button",
445
839
  {
446
- style: {
447
- cursor: "pointer",
448
- fontSize: 12,
449
- fontWeight: 600,
450
- padding: "6px 0"
451
- },
452
- children: e("theme.nestingOverrides", "Per-level overrides")
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__ */ i("div", { style: { display: "flex", flexDirection: "column", gap: 8, marginTop: 8 }, children: Array.from({ length: de }, (r, n) => n + 1).map((r) => {
456
- const n = z.overrides?.[r] ?? {}, m = Object.keys(n).length > 0;
457
- return /* @__PURE__ */ l(
458
- "div",
459
- {
460
- style: {
461
- border: "1px solid var(--nice-border-color)",
462
- borderRadius: 6,
463
- padding: 8,
464
- display: "flex",
465
- flexDirection: "column",
466
- gap: 6
467
- },
468
- children: [
469
- /* @__PURE__ */ l("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
470
- /* @__PURE__ */ i("strong", { style: { flex: 1 }, children: e("theme.level", "Level {level}").replace("{level}", String(r)) }),
471
- m && /* @__PURE__ */ i(
472
- "button",
473
- {
474
- type: "button",
475
- className: "nice-btn nice-btn--outline nice-btn--xs",
476
- onClick: () => he(_, r, null),
477
- children: e("themeBuilder.resetToDerived", "Reset to derived")
478
- }
479
- )
480
- ] }),
481
- /* @__PURE__ */ i("div", { style: { display: "grid", gridTemplateColumns: "repeat(2, 1fr)", gap: 6 }, children: t.map((s) => /* @__PURE__ */ i(
482
- be,
483
- {
484
- label: s.label,
485
- labelPlacement: "left",
486
- size: "sm",
487
- value: n[s.key] ?? "",
488
- onChange: (d) => he(_, r, { [s.key]: d })
489
- },
490
- s.key
491
- )) })
492
- ]
493
- },
494
- r
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
- }, Re = {
500
- general: () => /* @__PURE__ */ l("div", { className: "nice-theme-builder__grid", children: [
501
- Fe("darkThemeName", e("theme.darkThemeName", "Paired Dark Theme Name")),
502
- me("darkMode", e("theme.darkMode", "Dark Mode"), [
503
- "light",
504
- "dark",
505
- "auto"
506
- ]),
507
- me(
508
- "recommendedDisplayStyle",
509
- e("theme.recommendedDisplayStyle", "Recommended Display Style"),
510
- Ye
511
- )
512
- ] }),
513
- colors: () => /* @__PURE__ */ l("div", { className: "nice-theme-builder__grid", children: [
514
- c("colors", "primary", e("theme.primary", "Primary")),
515
- c("colors", "primaryHover", e("theme.primaryHover", "Primary Hover")),
516
- c("colors", "accent", e("theme.accent", "Accent")),
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
- typography: () => /* @__PURE__ */ l("div", { className: "nice-theme-builder__grid", children: [
636
- a("typography", "fontFamily", e("theme.fontFamily", "Body Font Family")),
637
- a(
638
- "typography",
639
- "headingFontFamily",
640
- e("theme.headingFontFamily", "Heading Font Family")
641
- ),
642
- a(
643
- "typography",
644
- "monoFontFamily",
645
- e("theme.monoFontFamily", "Monospace Font Family")
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
- a("typography", "fontSizeXs", "Font Size XS"),
648
- a("typography", "fontSizeSm", "Font Size SM"),
649
- a("typography", "fontSizeMd", "Font Size MD"),
650
- a("typography", "fontSizeLg", "Font Size LG"),
651
- a("typography", "fontSizeXl", "Font Size XL"),
652
- a("typography", "fontSize2xl", "Font Size 2XL"),
653
- a("typography", "fontSize3xl", "Font Size 3XL"),
654
- I("typography", "fontWeightNormal", "Weight Normal"),
655
- I("typography", "fontWeightMedium", "Weight Medium"),
656
- I("typography", "fontWeightSemibold", "Weight Semibold"),
657
- I("typography", "fontWeightBold", "Weight Bold"),
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
- a(
665
- "typography",
666
- "headingLetterSpacing",
667
- e("theme.headingLetterSpacing", "Heading Letter Spacing")
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
- shadows: () => /* @__PURE__ */ l("div", { className: "nice-theme-builder__grid", children: [
671
- a("shadows", "sm", "Shadow SM"),
672
- a("shadows", "md", "Shadow MD"),
673
- a("shadows", "lg", "Shadow LG"),
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
- ref: ge,
705
- id: g,
706
- className: `nice-theme-builder${N ? ` nice-theme-builder--with-preview nice-theme-builder--preview-${fe}` : ""}${ie ? ` ${ie}` : ""}`,
707
- style: { position: "relative", ...Ne },
708
- "data-testid": Se["data-testid"] ?? "nice-theme-builder",
709
- children: [
710
- /* @__PURE__ */ i("span", { style: { position: "absolute", top: 6, right: 6, zIndex: 20 }, children: /* @__PURE__ */ i(qe, { steps: Je(_e, at) }) }),
711
- /* @__PURE__ */ l("div", { className: "nice-theme-builder__main", children: [
712
- /* @__PURE__ */ i("div", { className: "nice-theme-builder__header", children: /* @__PURE__ */ l("div", { className: "nice-theme-builder__header-row", children: [
713
- /* @__PURE__ */ l("div", { className: "nice-theme-builder__name-row", children: [
714
- /* @__PURE__ */ i("label", { className: "nice-theme-builder__label", htmlFor: `${g}-name`, children: e("theme.name", "Theme Name") }),
715
- /* @__PURE__ */ i(
716
- "input",
717
- {
718
- type: "text",
719
- id: `${g}-name`,
720
- value: o.name,
721
- onChange: (t) => P({ name: t.target.value }),
722
- className: "nice-theme-builder__input"
723
- }
724
- )
725
- ] }),
726
- /* @__PURE__ */ l("div", { className: "nice-theme-builder__preset-bar", children: [
727
- /* @__PURE__ */ i("div", { className: "nice-theme-builder__preset-dropdown", ref: ke, children: /* @__PURE__ */ i(
728
- tt,
729
- {
730
- themes: U,
731
- value: o.name,
732
- onChange: (t) => {
733
- if (!t)
734
- return;
735
- const r = B.find((n) => n.name === t.id);
736
- r && L(r);
737
- },
738
- showSearch: !0,
739
- edit: {
740
- enabled: !0,
741
- editorRoute: "#",
742
- navigate: () => k(!0),
743
- addNew: {
744
- enabled: !0,
745
- label: `+ ${e("theme.newTheme", "Add theme")}`
746
- }
747
- }
748
- }
749
- ) }),
750
- /* @__PURE__ */ l("div", { className: "nice-theme-builder__toolbar", children: [
751
- /* @__PURE__ */ l(
752
- "button",
753
- {
754
- type: "button",
755
- className: "nice-theme-builder__btn nice-theme-builder__btn--new",
756
- onClick: () => k(!0),
757
- title: e("theme.newTheme", "New"),
758
- children: [
759
- /* @__PURE__ */ i(v, { name: "plus", size: "sm" }),
760
- e("theme.newTheme", "New")
761
- ]
762
- }
763
- ),
764
- /* @__PURE__ */ l(
765
- "button",
766
- {
767
- type: "button",
768
- className: "nice-theme-builder__btn",
769
- onClick: Pe,
770
- title: e("theme.clone", "Clone"),
771
- children: [
772
- /* @__PURE__ */ i(v, { name: "copy", size: "sm" }),
773
- e("theme.clone", "Clone")
774
- ]
775
- }
776
- ),
777
- /* @__PURE__ */ l("div", { className: "nice-theme-builder__open-wrap", children: [
778
- /* @__PURE__ */ l(
779
- "button",
780
- {
781
- ref: se,
782
- type: "button",
783
- className: "nice-theme-builder__btn",
784
- onClick: () => E((t) => !t),
785
- title: e("theme.open", "Open"),
786
- "aria-haspopup": "menu",
787
- "aria-expanded": O,
788
- children: [
789
- /* @__PURE__ */ i(v, { name: "folder", size: "sm" }),
790
- e("theme.open", "Open"),
791
- /* @__PURE__ */ i(v, { name: "chevron-down", size: "sm" })
792
- ]
793
- }
794
- ),
795
- O && /* @__PURE__ */ l("div", { className: "nice-theme-builder__open-menu", role: "menu", ref: ce, children: [
796
- U.length === 0 && /* @__PURE__ */ i("div", { className: "nice-theme-builder__open-empty", children: e("theme.noPresets", "No presets available") }),
797
- U.map((t) => /* @__PURE__ */ l(
798
- "button",
799
- {
800
- type: "button",
801
- role: "menuitem",
802
- className: `nice-theme-builder__open-item${t.id === o.name ? " nice-theme-builder__open-item--active" : ""}`,
803
- onClick: () => {
804
- const r = B.find((n) => n.name === t.id);
805
- r && L(r), E(!1);
806
- },
807
- children: [
808
- t.preview?.primary && /* @__PURE__ */ i(
809
- "span",
810
- {
811
- className: "nice-theme-builder__open-dot",
812
- style: { background: t.preview.primary }
813
- }
814
- ),
815
- /* @__PURE__ */ i("span", { className: "nice-theme-builder__open-label", children: t.nativeName ?? t.name })
816
- ]
817
- },
818
- t.id
819
- ))
820
- ] })
821
- ] }),
822
- /* @__PURE__ */ l(
823
- "button",
824
- {
825
- type: "button",
826
- className: "nice-theme-builder__btn",
827
- onClick: () => oe.current?.click(),
828
- title: e("theme.import", "Import"),
829
- children: [
830
- /* @__PURE__ */ i(v, { name: "upload", size: "sm" }),
831
- e("theme.import", "Import")
832
- ]
833
- }
834
- ),
835
- /* @__PURE__ */ i(
836
- "input",
837
- {
838
- ref: oe,
839
- type: "file",
840
- accept: "application/json,.json",
841
- style: { display: "none" },
842
- onChange: $e
843
- }
844
- ),
845
- /* @__PURE__ */ l(
846
- "button",
847
- {
848
- type: "button",
849
- className: `nice-theme-builder__btn nice-theme-builder__btn--preview-toggle${N ? " nice-theme-builder__btn--active" : ""}`,
850
- onClick: () => Te((t) => !t),
851
- title: N ? e("theme.hidePreview", "Hide preview") : e("theme.showPreview", "Show preview"),
852
- "aria-pressed": N,
853
- children: [
854
- /* @__PURE__ */ i(v, { name: N ? "eye-off" : "eye", size: "sm" }),
855
- N ? e("theme.hidePreview", "Hide preview") : e("theme.showPreview", "Show preview")
856
- ]
857
- }
858
- )
859
- ] })
860
- ] })
861
- ] }) }),
862
- xe && /* @__PURE__ */ i(
863
- "div",
864
- {
865
- role: "presentation",
866
- className: "nice-theme-builder__dialog-overlay",
867
- onClick: () => k(!1),
868
- children: /* @__PURE__ */ l(
869
- "div",
870
- {
871
- role: "presentation",
872
- className: "nice-theme-builder__dialog",
873
- onClick: (t) => t.stopPropagation(),
874
- children: [
875
- /* @__PURE__ */ i("h3", { className: "nice-theme-builder__dialog-title", children: e("theme.createNew", "Create New Theme") }),
876
- /* @__PURE__ */ i("p", { className: "nice-theme-builder__dialog-desc", children: e(
877
- "theme.createNewDesc",
878
- "A copy of the current theme will be created with the new name."
879
- ) }),
880
- /* @__PURE__ */ i(
881
- "input",
882
- {
883
- type: "text",
884
- className: "nice-theme-builder__input",
885
- placeholder: e("theme.namePlaceholder", "My Custom Theme"),
886
- value: C,
887
- onChange: (t) => H(t.target.value),
888
- onKeyDown: (t) => t.key === "Enter" && le(),
889
- autoFocus: !0
890
- }
891
- ),
892
- /* @__PURE__ */ l("div", { className: "nice-theme-builder__dialog-actions", children: [
893
- /* @__PURE__ */ i(
894
- "button",
895
- {
896
- type: "button",
897
- className: "nice-theme-builder__btn",
898
- onClick: () => {
899
- k(!1), H("");
900
- },
901
- children: e("theme.cancel", "Cancel")
902
- }
903
- ),
904
- /* @__PURE__ */ i(
905
- "button",
906
- {
907
- type: "button",
908
- className: "nice-theme-builder__btn nice-theme-builder__btn--apply",
909
- onClick: le,
910
- disabled: !C.trim(),
911
- children: e("theme.create", "Create")
912
- }
913
- )
914
- ] })
915
- ]
916
- }
917
- )
918
- }
919
- ),
920
- /* @__PURE__ */ i("div", { className: "nice-theme-builder__tabs", ref: ee, role: "tablist", children: K.map((t) => /* @__PURE__ */ i(
921
- "button",
922
- {
923
- type: "button",
924
- role: "tab",
925
- "aria-selected": t === W,
926
- className: `nice-theme-builder__tab${t === W ? " nice-theme-builder__tab--active" : ""}`,
927
- onClick: () => ae(t),
928
- children: Ae[t]
929
- },
930
- t
931
- )) }),
932
- /* @__PURE__ */ i("div", { className: "nice-theme-builder__body", role: "tabpanel", ref: j, children: Re[W]?.() }),
933
- /* @__PURE__ */ l("details", { className: "nice-theme-builder__preview", children: [
934
- /* @__PURE__ */ i("summary", { className: "nice-theme-builder__preview-toggle", children: e("theme.preview", "CSS Variables Preview") }),
935
- /* @__PURE__ */ i("pre", { className: "nice-theme-builder__preview-code", children: `:root {
936
- ${Be}
937
- }` })
938
- ] }),
939
- /* @__PURE__ */ l("div", { className: "nice-theme-builder__actions", children: [
940
- /* @__PURE__ */ l(
941
- "button",
942
- {
943
- type: "button",
944
- className: "nice-theme-builder__btn nice-theme-builder__btn--apply",
945
- onClick: Ie,
946
- children: [
947
- /* @__PURE__ */ i(v, { name: "check", size: "sm" }),
948
- e("theme.apply", "Apply Theme")
949
- ]
950
- }
951
- ),
952
- /* @__PURE__ */ l(
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: "nice-theme-builder__btn nice-theme-builder__btn--export",
957
- onClick: ze,
958
- children: [
959
- /* @__PURE__ */ i(v, { name: "download", size: "sm" }),
960
- e("theme.export", "Export JSON")
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__ */ l(
1275
+ /* @__PURE__ */ r(
965
1276
  "button",
966
1277
  {
967
1278
  type: "button",
968
- className: "nice-theme-builder__btn",
969
- onClick: () => {
970
- const t = ue(o), r = Object.entries(Y(o)).map(([m, s]) => ` ${m}: ${s};`).join(`
971
- `), n = `/* Nice2Dev Theme: ${o.name} */
972
- :root {
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
- N && /* @__PURE__ */ i("div", { className: "nice-theme-builder__preview-pane", children: /* @__PURE__ */ i(it, { theme: o, onTokenClick: G }) })
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
- _t as NiceThemeDesigner
1455
+ Ht as NiceThemeDesigner
997
1456
  };