@industry-theme/theme-editor-panel 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,972 @@
1
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
+ import React2, { createContext, useState, useEffect, useContext, forwardRef, createElement, useRef, useLayoutEffect, useCallback, useMemo } from "react";
3
+ var terminalTheme = {
4
+ space: [0, 4, 8, 16, 32, 64, 128, 256, 512],
5
+ fonts: {
6
+ body: '"SF Mono", "Monaco", "Inconsolata", "Fira Code", monospace',
7
+ heading: '"SF Mono", "Monaco", "Inconsolata", "Fira Code", monospace',
8
+ monospace: '"SF Mono", "Monaco", "Inconsolata", "Fira Code", monospace'
9
+ },
10
+ fontSizes: [12, 14, 16, 18, 20, 24, 32, 48, 64, 96],
11
+ fontScale: 1,
12
+ fontWeights: {
13
+ body: 400,
14
+ heading: 500,
15
+ bold: 600,
16
+ light: 300,
17
+ medium: 500,
18
+ semibold: 600
19
+ },
20
+ lineHeights: {
21
+ body: 1.6,
22
+ heading: 1.3,
23
+ tight: 1.4,
24
+ relaxed: 1.8
25
+ },
26
+ breakpoints: ["640px", "768px", "1024px", "1280px"],
27
+ sizes: [16, 32, 64, 128, 256, 512, 768, 1024, 1536],
28
+ radii: [0, 2, 4, 6, 8, 12, 16, 24],
29
+ shadows: [
30
+ "none",
31
+ "0 1px 2px 0 rgba(0, 0, 0, 0.05)",
32
+ "0 2px 4px 0 rgba(0, 0, 0, 0.06)",
33
+ "0 4px 6px 0 rgba(0, 0, 0, 0.07)",
34
+ "0 8px 12px 0 rgba(0, 0, 0, 0.08)",
35
+ "0 16px 24px 0 rgba(0, 0, 0, 0.10)"
36
+ ],
37
+ zIndices: [0, 1, 10, 20, 30, 40, 50],
38
+ colors: {
39
+ text: "#e4e4e4",
40
+ background: "rgba(10, 10, 10, 0.85)",
41
+ primary: "#66b3ff",
42
+ secondary: "#80c4ff",
43
+ accent: "#66ff99",
44
+ highlight: "rgba(102, 179, 255, 0.15)",
45
+ muted: "rgba(26, 26, 26, 0.8)",
46
+ success: "#66ff99",
47
+ warning: "#ffcc66",
48
+ error: "#ff6666",
49
+ info: "#66b3ff",
50
+ border: "rgba(255, 255, 255, 0.1)",
51
+ backgroundSecondary: "rgba(15, 15, 15, 0.9)",
52
+ backgroundTertiary: "rgba(20, 20, 20, 0.9)",
53
+ backgroundLight: "rgba(255, 255, 255, 0.05)",
54
+ backgroundHover: "rgba(102, 179, 255, 0.08)",
55
+ surface: "rgba(15, 15, 15, 0.95)",
56
+ textSecondary: "rgba(255, 255, 255, 0.7)",
57
+ textTertiary: "rgba(255, 255, 255, 0.5)",
58
+ textMuted: "rgba(255, 255, 255, 0.4)",
59
+ highlightBg: "rgba(255, 235, 59, 0.25)",
60
+ highlightBorder: "rgba(255, 235, 59, 0.5)"
61
+ },
62
+ modes: {
63
+ light: {
64
+ text: "#1a1a1a",
65
+ background: "rgba(255, 255, 255, 0.9)",
66
+ primary: "#0066cc",
67
+ secondary: "#0052a3",
68
+ accent: "#00cc88",
69
+ highlight: "rgba(0, 102, 204, 0.08)",
70
+ muted: "rgba(245, 245, 245, 0.8)",
71
+ success: "#00cc88",
72
+ warning: "#ffaa00",
73
+ error: "#ff3333",
74
+ info: "#0066cc",
75
+ border: "rgba(0, 0, 0, 0.1)",
76
+ backgroundSecondary: "rgba(250, 250, 250, 0.9)",
77
+ backgroundTertiary: "rgba(245, 245, 245, 0.9)",
78
+ backgroundLight: "rgba(0, 0, 0, 0.02)",
79
+ backgroundHover: "rgba(0, 102, 204, 0.04)",
80
+ surface: "rgba(255, 255, 255, 0.95)",
81
+ textSecondary: "rgba(0, 0, 0, 0.6)",
82
+ textTertiary: "rgba(0, 0, 0, 0.4)",
83
+ textMuted: "rgba(0, 0, 0, 0.3)",
84
+ highlightBg: "rgba(255, 235, 59, 0.3)",
85
+ highlightBorder: "rgba(255, 235, 59, 0.6)"
86
+ }
87
+ },
88
+ buttons: {
89
+ primary: {
90
+ color: "white",
91
+ bg: "primary",
92
+ borderWidth: 0,
93
+ "&:hover": {
94
+ bg: "secondary"
95
+ }
96
+ },
97
+ secondary: {
98
+ color: "primary",
99
+ bg: "transparent",
100
+ borderWidth: 1,
101
+ borderStyle: "solid",
102
+ borderColor: "primary",
103
+ "&:hover": {
104
+ bg: "highlight"
105
+ }
106
+ },
107
+ ghost: {
108
+ color: "text",
109
+ bg: "transparent",
110
+ "&:hover": {
111
+ bg: "backgroundHover"
112
+ }
113
+ }
114
+ },
115
+ text: {
116
+ heading: {
117
+ fontFamily: "heading",
118
+ fontWeight: "heading",
119
+ lineHeight: "heading"
120
+ },
121
+ body: {
122
+ fontFamily: "body",
123
+ fontWeight: "body",
124
+ lineHeight: "body"
125
+ },
126
+ caption: {
127
+ fontSize: 1,
128
+ color: "textSecondary"
129
+ }
130
+ },
131
+ cards: {
132
+ primary: {
133
+ bg: "surface",
134
+ border: "1px solid",
135
+ borderColor: "border",
136
+ borderRadius: 1
137
+ },
138
+ secondary: {
139
+ bg: "backgroundSecondary",
140
+ border: "1px solid",
141
+ borderColor: "border",
142
+ borderRadius: 1
143
+ }
144
+ }
145
+ };
146
+ function getMode(theme2, mode) {
147
+ if (!mode || !theme2.modes || !theme2.modes[mode]) {
148
+ return theme2.colors;
149
+ }
150
+ return {
151
+ ...theme2.colors,
152
+ ...theme2.modes[mode]
153
+ };
154
+ }
155
+ var ThemeContext;
156
+ var getThemeContext = () => {
157
+ if (typeof window !== "undefined") {
158
+ const globalWindow = window;
159
+ if (!globalWindow.__principlemd_theme_context__) {
160
+ globalWindow.__principlemd_theme_context__ = createContext(void 0);
161
+ }
162
+ return globalWindow.__principlemd_theme_context__;
163
+ } else {
164
+ if (!ThemeContext) {
165
+ ThemeContext = createContext(void 0);
166
+ }
167
+ return ThemeContext;
168
+ }
169
+ };
170
+ var ThemeContextSingleton = getThemeContext();
171
+ var useTheme = () => {
172
+ const context = useContext(ThemeContextSingleton);
173
+ if (!context) {
174
+ throw new Error("useTheme must be used within a ThemeProvider");
175
+ }
176
+ return context;
177
+ };
178
+ var ThemeProvider = ({
179
+ children,
180
+ theme: customTheme = theme,
181
+ initialMode
182
+ }) => {
183
+ const [mode, setMode] = useState(initialMode);
184
+ const activeTheme = React2.useMemo(() => {
185
+ if (!mode || !customTheme.modes || !customTheme.modes[mode]) {
186
+ return customTheme;
187
+ }
188
+ return {
189
+ ...customTheme,
190
+ colors: getMode(customTheme, mode)
191
+ };
192
+ }, [customTheme, mode]);
193
+ useEffect(() => {
194
+ if (!initialMode) {
195
+ const savedMode = localStorage.getItem("principlemd-theme-mode");
196
+ if (savedMode) {
197
+ setMode(savedMode);
198
+ }
199
+ }
200
+ }, [initialMode]);
201
+ useEffect(() => {
202
+ if (mode) {
203
+ localStorage.setItem("principlemd-theme-mode", mode);
204
+ } else {
205
+ localStorage.removeItem("principlemd-theme-mode");
206
+ }
207
+ }, [mode]);
208
+ const value = {
209
+ theme: activeTheme,
210
+ mode,
211
+ setMode
212
+ };
213
+ return /* @__PURE__ */ React2.createElement(ThemeContextSingleton.Provider, {
214
+ value
215
+ }, children);
216
+ };
217
+ var theme = terminalTheme;
218
+ /**
219
+ * @license lucide-react v0.552.0 - ISC
220
+ *
221
+ * This source code is licensed under the ISC license.
222
+ * See the LICENSE file in the root directory of this source tree.
223
+ */
224
+ const toKebabCase = (string) => string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
225
+ const toCamelCase = (string) => string.replace(
226
+ /^([A-Z])|[\s-_]+(\w)/g,
227
+ (match, p1, p2) => p2 ? p2.toUpperCase() : p1.toLowerCase()
228
+ );
229
+ const toPascalCase = (string) => {
230
+ const camelCase = toCamelCase(string);
231
+ return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
232
+ };
233
+ const mergeClasses = (...classes) => classes.filter((className, index, array) => {
234
+ return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
235
+ }).join(" ").trim();
236
+ const hasA11yProp = (props) => {
237
+ for (const prop in props) {
238
+ if (prop.startsWith("aria-") || prop === "role" || prop === "title") {
239
+ return true;
240
+ }
241
+ }
242
+ };
243
+ /**
244
+ * @license lucide-react v0.552.0 - ISC
245
+ *
246
+ * This source code is licensed under the ISC license.
247
+ * See the LICENSE file in the root directory of this source tree.
248
+ */
249
+ var defaultAttributes = {
250
+ xmlns: "http://www.w3.org/2000/svg",
251
+ width: 24,
252
+ height: 24,
253
+ viewBox: "0 0 24 24",
254
+ fill: "none",
255
+ stroke: "currentColor",
256
+ strokeWidth: 2,
257
+ strokeLinecap: "round",
258
+ strokeLinejoin: "round"
259
+ };
260
+ /**
261
+ * @license lucide-react v0.552.0 - ISC
262
+ *
263
+ * This source code is licensed under the ISC license.
264
+ * See the LICENSE file in the root directory of this source tree.
265
+ */
266
+ const Icon = forwardRef(
267
+ ({
268
+ color = "currentColor",
269
+ size = 24,
270
+ strokeWidth = 2,
271
+ absoluteStrokeWidth,
272
+ className = "",
273
+ children,
274
+ iconNode,
275
+ ...rest
276
+ }, ref) => createElement(
277
+ "svg",
278
+ {
279
+ ref,
280
+ ...defaultAttributes,
281
+ width: size,
282
+ height: size,
283
+ stroke: color,
284
+ strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
285
+ className: mergeClasses("lucide", className),
286
+ ...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
287
+ ...rest
288
+ },
289
+ [
290
+ ...iconNode.map(([tag, attrs]) => createElement(tag, attrs)),
291
+ ...Array.isArray(children) ? children : [children]
292
+ ]
293
+ )
294
+ );
295
+ /**
296
+ * @license lucide-react v0.552.0 - ISC
297
+ *
298
+ * This source code is licensed under the ISC license.
299
+ * See the LICENSE file in the root directory of this source tree.
300
+ */
301
+ const createLucideIcon = (iconName, iconNode) => {
302
+ const Component = forwardRef(
303
+ ({ className, ...props }, ref) => createElement(Icon, {
304
+ ref,
305
+ iconNode,
306
+ className: mergeClasses(
307
+ `lucide-${toKebabCase(toPascalCase(iconName))}`,
308
+ `lucide-${iconName}`,
309
+ className
310
+ ),
311
+ ...props
312
+ })
313
+ );
314
+ Component.displayName = toPascalCase(iconName);
315
+ return Component;
316
+ };
317
+ /**
318
+ * @license lucide-react v0.552.0 - ISC
319
+ *
320
+ * This source code is licensed under the ISC license.
321
+ * See the LICENSE file in the root directory of this source tree.
322
+ */
323
+ const __iconNode$2 = [
324
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
325
+ ["path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3", key: "1u773s" }],
326
+ ["path", { d: "M12 17h.01", key: "p32p05" }]
327
+ ];
328
+ const CircleQuestionMark = createLucideIcon("circle-question-mark", __iconNode$2);
329
+ /**
330
+ * @license lucide-react v0.552.0 - ISC
331
+ *
332
+ * This source code is licensed under the ISC license.
333
+ * See the LICENSE file in the root directory of this source tree.
334
+ */
335
+ const __iconNode$1 = [
336
+ [
337
+ "path",
338
+ {
339
+ d: "M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",
340
+ key: "e79jfc"
341
+ }
342
+ ],
343
+ ["circle", { cx: "13.5", cy: "6.5", r: ".5", fill: "currentColor", key: "1okk4w" }],
344
+ ["circle", { cx: "17.5", cy: "10.5", r: ".5", fill: "currentColor", key: "f64h9f" }],
345
+ ["circle", { cx: "6.5", cy: "12.5", r: ".5", fill: "currentColor", key: "qy21gx" }],
346
+ ["circle", { cx: "8.5", cy: "7.5", r: ".5", fill: "currentColor", key: "fotxhn" }]
347
+ ];
348
+ const Palette = createLucideIcon("palette", __iconNode$1);
349
+ /**
350
+ * @license lucide-react v0.552.0 - ISC
351
+ *
352
+ * This source code is licensed under the ISC license.
353
+ * See the LICENSE file in the root directory of this source tree.
354
+ */
355
+ const __iconNode = [
356
+ ["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
357
+ ["path", { d: "M3 3v5h5", key: "1xhq8a" }]
358
+ ];
359
+ const RotateCcw = createLucideIcon("rotate-ccw", __iconNode);
360
+ function u() {
361
+ return (u = Object.assign || function(e) {
362
+ for (var r = 1; r < arguments.length; r++) {
363
+ var t = arguments[r];
364
+ for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && (e[n] = t[n]);
365
+ }
366
+ return e;
367
+ }).apply(this, arguments);
368
+ }
369
+ function c(e, r) {
370
+ if (null == e) return {};
371
+ var t, n, o = {}, a = Object.keys(e);
372
+ for (n = 0; n < a.length; n++) r.indexOf(t = a[n]) >= 0 || (o[t] = e[t]);
373
+ return o;
374
+ }
375
+ function i(e) {
376
+ var t = useRef(e), n = useRef(function(e2) {
377
+ t.current && t.current(e2);
378
+ });
379
+ return t.current = e, n.current;
380
+ }
381
+ var s = function(e, r, t) {
382
+ return void 0 === r && (r = 0), void 0 === t && (t = 1), e > t ? t : e < r ? r : e;
383
+ }, f = function(e) {
384
+ return "touches" in e;
385
+ }, v = function(e) {
386
+ return e && e.ownerDocument.defaultView || self;
387
+ }, d = function(e, r, t) {
388
+ var n = e.getBoundingClientRect(), o = f(r) ? (function(e2, r2) {
389
+ for (var t2 = 0; t2 < e2.length; t2++) if (e2[t2].identifier === r2) return e2[t2];
390
+ return e2[0];
391
+ })(r.touches, t) : r;
392
+ return { left: s((o.pageX - (n.left + v(e).pageXOffset)) / n.width), top: s((o.pageY - (n.top + v(e).pageYOffset)) / n.height) };
393
+ }, h = function(e) {
394
+ !f(e) && e.preventDefault();
395
+ }, m = React2.memo(function(o) {
396
+ var a = o.onMove, l = o.onKey, s2 = c(o, ["onMove", "onKey"]), m2 = useRef(null), g2 = i(a), p2 = i(l), b2 = useRef(null), _ = useRef(false), x2 = useMemo(function() {
397
+ var e = function(e2) {
398
+ h(e2), (f(e2) ? e2.touches.length > 0 : e2.buttons > 0) && m2.current ? g2(d(m2.current, e2, b2.current)) : t(false);
399
+ }, r = function() {
400
+ return t(false);
401
+ };
402
+ function t(t2) {
403
+ var n = _.current, o2 = v(m2.current), a2 = t2 ? o2.addEventListener : o2.removeEventListener;
404
+ a2(n ? "touchmove" : "mousemove", e), a2(n ? "touchend" : "mouseup", r);
405
+ }
406
+ return [function(e2) {
407
+ var r2 = e2.nativeEvent, n = m2.current;
408
+ if (n && (h(r2), !(function(e3, r3) {
409
+ return r3 && !f(e3);
410
+ })(r2, _.current) && n)) {
411
+ if (f(r2)) {
412
+ _.current = true;
413
+ var o2 = r2.changedTouches || [];
414
+ o2.length && (b2.current = o2[0].identifier);
415
+ }
416
+ n.focus(), g2(d(n, r2, b2.current)), t(true);
417
+ }
418
+ }, function(e2) {
419
+ var r2 = e2.which || e2.keyCode;
420
+ r2 < 37 || r2 > 40 || (e2.preventDefault(), p2({ left: 39 === r2 ? 0.05 : 37 === r2 ? -0.05 : 0, top: 40 === r2 ? 0.05 : 38 === r2 ? -0.05 : 0 }));
421
+ }, t];
422
+ }, [p2, g2]), C2 = x2[0], E = x2[1], H = x2[2];
423
+ return useEffect(function() {
424
+ return H;
425
+ }, [H]), React2.createElement("div", u({}, s2, { onTouchStart: C2, onMouseDown: C2, className: "react-colorful__interactive", ref: m2, onKeyDown: E, tabIndex: 0, role: "slider" }));
426
+ }), g = function(e) {
427
+ return e.filter(Boolean).join(" ");
428
+ }, p = function(r) {
429
+ var t = r.color, n = r.left, o = r.top, a = void 0 === o ? 0.5 : o, l = g(["react-colorful__pointer", r.className]);
430
+ return React2.createElement("div", { className: l, style: { top: 100 * a + "%", left: 100 * n + "%" } }, React2.createElement("div", { className: "react-colorful__pointer-fill", style: { backgroundColor: t } }));
431
+ }, b = function(e, r, t) {
432
+ return void 0 === r && (r = 0), void 0 === t && (t = Math.pow(10, r)), Math.round(t * e) / t;
433
+ }, x = function(e) {
434
+ return L(C(e));
435
+ }, C = function(e) {
436
+ return "#" === e[0] && (e = e.substring(1)), e.length < 6 ? { r: parseInt(e[0] + e[0], 16), g: parseInt(e[1] + e[1], 16), b: parseInt(e[2] + e[2], 16), a: 4 === e.length ? b(parseInt(e[3] + e[3], 16) / 255, 2) : 1 } : { r: parseInt(e.substring(0, 2), 16), g: parseInt(e.substring(2, 4), 16), b: parseInt(e.substring(4, 6), 16), a: 8 === e.length ? b(parseInt(e.substring(6, 8), 16) / 255, 2) : 1 };
437
+ }, w = function(e) {
438
+ return K(I(e));
439
+ }, y = function(e) {
440
+ var r = e.s, t = e.v, n = e.a, o = (200 - r) * t / 100;
441
+ return { h: b(e.h), s: b(o > 0 && o < 200 ? r * t / 100 / (o <= 100 ? o : 200 - o) * 100 : 0), l: b(o / 2), a: b(n, 2) };
442
+ }, q = function(e) {
443
+ var r = y(e);
444
+ return "hsl(" + r.h + ", " + r.s + "%, " + r.l + "%)";
445
+ }, I = function(e) {
446
+ var r = e.h, t = e.s, n = e.v, o = e.a;
447
+ r = r / 360 * 6, t /= 100, n /= 100;
448
+ var a = Math.floor(r), l = n * (1 - t), u2 = n * (1 - (r - a) * t), c2 = n * (1 - (1 - r + a) * t), i2 = a % 6;
449
+ return { r: b(255 * [n, u2, l, l, c2, n][i2]), g: b(255 * [c2, n, n, u2, l, l][i2]), b: b(255 * [l, l, c2, n, n, u2][i2]), a: b(o, 2) };
450
+ }, D = function(e) {
451
+ var r = e.toString(16);
452
+ return r.length < 2 ? "0" + r : r;
453
+ }, K = function(e) {
454
+ var r = e.r, t = e.g, n = e.b, o = e.a, a = o < 1 ? D(b(255 * o)) : "";
455
+ return "#" + D(r) + D(t) + D(n) + a;
456
+ }, L = function(e) {
457
+ var r = e.r, t = e.g, n = e.b, o = e.a, a = Math.max(r, t, n), l = a - Math.min(r, t, n), u2 = l ? a === r ? (t - n) / l : a === t ? 2 + (n - r) / l : 4 + (r - t) / l : 0;
458
+ return { h: b(60 * (u2 < 0 ? u2 + 6 : u2)), s: b(a ? l / a * 100 : 0), v: b(a / 255 * 100), a: o };
459
+ }, S = React2.memo(function(r) {
460
+ var t = r.hue, n = r.onChange, o = g(["react-colorful__hue", r.className]);
461
+ return React2.createElement("div", { className: o }, React2.createElement(m, { onMove: function(e) {
462
+ n({ h: 360 * e.left });
463
+ }, onKey: function(e) {
464
+ n({ h: s(t + 360 * e.left, 0, 360) });
465
+ }, "aria-label": "Hue", "aria-valuenow": b(t), "aria-valuemax": "360", "aria-valuemin": "0" }, React2.createElement(p, { className: "react-colorful__hue-pointer", left: t / 360, color: q({ h: t, s: 100, v: 100, a: 1 }) })));
466
+ }), T = React2.memo(function(r) {
467
+ var t = r.hsva, n = r.onChange, o = { backgroundColor: q({ h: t.h, s: 100, v: 100, a: 1 }) };
468
+ return React2.createElement("div", { className: "react-colorful__saturation", style: o }, React2.createElement(m, { onMove: function(e) {
469
+ n({ s: 100 * e.left, v: 100 - 100 * e.top });
470
+ }, onKey: function(e) {
471
+ n({ s: s(t.s + 100 * e.left, 0, 100), v: s(t.v - 100 * e.top, 0, 100) });
472
+ }, "aria-label": "Color", "aria-valuetext": "Saturation " + b(t.s) + "%, Brightness " + b(t.v) + "%" }, React2.createElement(p, { className: "react-colorful__saturation-pointer", top: 1 - t.v / 100, left: t.s / 100, color: q(t) })));
473
+ }), F = function(e, r) {
474
+ if (e === r) return true;
475
+ for (var t in e) if (e[t] !== r[t]) return false;
476
+ return true;
477
+ }, X = function(e, r) {
478
+ return e.toLowerCase() === r.toLowerCase() || F(C(e), C(r));
479
+ };
480
+ function Y(e, t, l) {
481
+ var u2 = i(l), c2 = useState(function() {
482
+ return e.toHsva(t);
483
+ }), s2 = c2[0], f2 = c2[1], v2 = useRef({ color: t, hsva: s2 });
484
+ useEffect(function() {
485
+ if (!e.equal(t, v2.current.color)) {
486
+ var r = e.toHsva(t);
487
+ v2.current = { hsva: r, color: t }, f2(r);
488
+ }
489
+ }, [t, e]), useEffect(function() {
490
+ var r;
491
+ F(s2, v2.current.hsva) || e.equal(r = e.fromHsva(s2), v2.current.color) || (v2.current = { hsva: s2, color: r }, u2(r));
492
+ }, [s2, e, u2]);
493
+ var d2 = useCallback(function(e2) {
494
+ f2(function(r) {
495
+ return Object.assign({}, r, e2);
496
+ });
497
+ }, []);
498
+ return [s2, d2];
499
+ }
500
+ var V = "undefined" != typeof window ? useLayoutEffect : useEffect, $ = function() {
501
+ return "undefined" != typeof __webpack_nonce__ ? __webpack_nonce__ : void 0;
502
+ }, J = /* @__PURE__ */ new Map(), Q = function(e) {
503
+ V(function() {
504
+ var r = e.current ? e.current.ownerDocument : document;
505
+ if (void 0 !== r && !J.has(r)) {
506
+ var t = r.createElement("style");
507
+ t.innerHTML = `.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`, J.set(r, t);
508
+ var n = $();
509
+ n && t.setAttribute("nonce", n), r.head.appendChild(t);
510
+ }
511
+ }, []);
512
+ }, U = function(t) {
513
+ var n = t.className, o = t.colorModel, a = t.color, l = void 0 === a ? o.defaultColor : a, i2 = t.onChange, s2 = c(t, ["className", "colorModel", "color", "onChange"]), f2 = useRef(null);
514
+ Q(f2);
515
+ var v2 = Y(o, l, i2), d2 = v2[0], h2 = v2[1], m2 = g(["react-colorful", n]);
516
+ return React2.createElement("div", u({}, s2, { ref: f2, className: m2 }), React2.createElement(T, { hsva: d2, onChange: h2 }), React2.createElement(S, { hue: d2.h, onChange: h2, className: "react-colorful__last-control" }));
517
+ }, W = { defaultColor: "000", toHsva: x, fromHsva: function(e) {
518
+ return w({ h: e.h, s: e.s, v: e.v, a: 1 });
519
+ }, equal: X }, Z = function(r) {
520
+ return React2.createElement(U, u({}, r, { colorModel: W }));
521
+ };
522
+ const ColorPickerInput = ({
523
+ label,
524
+ value,
525
+ onChange,
526
+ onReset,
527
+ defaultValue
528
+ }) => {
529
+ const { theme: theme2 } = useTheme();
530
+ const [showPicker, setShowPicker] = useState(false);
531
+ const [inputValue, setInputValue] = useState(value);
532
+ const pickerRef = useRef(null);
533
+ useEffect(() => {
534
+ setInputValue(value);
535
+ }, [value]);
536
+ useEffect(() => {
537
+ const handleClickOutside = (event) => {
538
+ if (pickerRef.current && !pickerRef.current.contains(event.target)) {
539
+ setShowPicker(false);
540
+ }
541
+ };
542
+ if (showPicker) {
543
+ document.addEventListener("mousedown", handleClickOutside);
544
+ return () => document.removeEventListener("mousedown", handleClickOutside);
545
+ }
546
+ }, [showPicker]);
547
+ const handleInputChange = (e) => {
548
+ const newColor = e.target.value;
549
+ setInputValue(newColor);
550
+ if (/^#[0-9A-Fa-f]{6}$/.test(newColor)) {
551
+ onChange(newColor);
552
+ }
553
+ };
554
+ const handlePickerChange = (newColor) => {
555
+ setInputValue(newColor);
556
+ onChange(newColor);
557
+ };
558
+ const pickerColor = /^#[0-9A-Fa-f]{6}$/.test(value) ? value : "#000000";
559
+ return /* @__PURE__ */ jsxs(
560
+ "div",
561
+ {
562
+ style: {
563
+ display: "flex",
564
+ alignItems: "center",
565
+ gap: "8px",
566
+ marginBottom: "12px",
567
+ position: "relative",
568
+ minWidth: 0
569
+ },
570
+ children: [
571
+ /* @__PURE__ */ jsx(
572
+ "div",
573
+ {
574
+ style: {
575
+ flex: "0 0 40%",
576
+ maxWidth: "40%",
577
+ fontSize: "13px",
578
+ color: theme2.colors.textSecondary,
579
+ overflow: "hidden",
580
+ textOverflow: "ellipsis",
581
+ whiteSpace: "nowrap"
582
+ },
583
+ children: label
584
+ }
585
+ ),
586
+ /* @__PURE__ */ jsx(
587
+ "div",
588
+ {
589
+ onClick: () => setShowPicker(!showPicker),
590
+ style: {
591
+ flex: "0 0 auto",
592
+ width: "32px",
593
+ height: "32px",
594
+ borderRadius: "6px",
595
+ border: `2px solid ${theme2.colors.border}`,
596
+ backgroundColor: pickerColor,
597
+ cursor: "pointer",
598
+ transition: "transform 0.15s",
599
+ boxShadow: `0 2px 4px rgba(0, 0, 0, 0.2)`
600
+ },
601
+ onMouseEnter: (e) => {
602
+ e.currentTarget.style.transform = "scale(1.1)";
603
+ },
604
+ onMouseLeave: (e) => {
605
+ e.currentTarget.style.transform = "scale(1)";
606
+ }
607
+ }
608
+ ),
609
+ /* @__PURE__ */ jsx(
610
+ "input",
611
+ {
612
+ type: "text",
613
+ value: inputValue,
614
+ onChange: handleInputChange,
615
+ placeholder: "#000000",
616
+ style: {
617
+ flex: "1 1 auto",
618
+ minWidth: "90px",
619
+ padding: "8px 10px",
620
+ borderRadius: "6px",
621
+ border: `1px solid ${theme2.colors.border}`,
622
+ backgroundColor: theme2.colors.background,
623
+ color: theme2.colors.text,
624
+ fontSize: "13px",
625
+ fontFamily: "monospace",
626
+ boxSizing: "border-box"
627
+ }
628
+ }
629
+ ),
630
+ onReset && defaultValue && value !== defaultValue && /* @__PURE__ */ jsx(
631
+ "button",
632
+ {
633
+ onClick: onReset,
634
+ title: "Reset to default",
635
+ style: {
636
+ flex: "0 0 auto",
637
+ padding: "8px",
638
+ borderRadius: "6px",
639
+ border: `1px solid ${theme2.colors.border}`,
640
+ backgroundColor: theme2.colors.background,
641
+ color: theme2.colors.textSecondary,
642
+ cursor: "pointer",
643
+ display: "flex",
644
+ alignItems: "center",
645
+ justifyContent: "center",
646
+ transition: "all 0.15s"
647
+ },
648
+ onMouseEnter: (e) => {
649
+ e.currentTarget.style.backgroundColor = theme2.colors.backgroundSecondary;
650
+ e.currentTarget.style.color = theme2.colors.text;
651
+ },
652
+ onMouseLeave: (e) => {
653
+ e.currentTarget.style.backgroundColor = theme2.colors.background;
654
+ e.currentTarget.style.color = theme2.colors.textSecondary;
655
+ },
656
+ children: /* @__PURE__ */ jsx(RotateCcw, { size: 16 })
657
+ }
658
+ ),
659
+ showPicker && /* @__PURE__ */ jsx(
660
+ "div",
661
+ {
662
+ ref: pickerRef,
663
+ style: {
664
+ position: "absolute",
665
+ top: "100%",
666
+ left: "0",
667
+ marginTop: "8px",
668
+ zIndex: 1e3,
669
+ padding: "12px",
670
+ borderRadius: "12px",
671
+ backgroundColor: theme2.colors.backgroundSecondary,
672
+ border: `1px solid ${theme2.colors.border}`,
673
+ boxShadow: `0 8px 24px rgba(0, 0, 0, 0.4)`
674
+ },
675
+ children: /* @__PURE__ */ jsx(Z, { color: pickerColor, onChange: handlePickerChange })
676
+ }
677
+ )
678
+ ]
679
+ }
680
+ );
681
+ };
682
+ const HelpContent = () => {
683
+ const { theme: theme2 } = useTheme();
684
+ return /* @__PURE__ */ jsxs(
685
+ "div",
686
+ {
687
+ style: {
688
+ maxWidth: "600px",
689
+ margin: "0 auto",
690
+ width: "100%"
691
+ },
692
+ children: [
693
+ /* @__PURE__ */ jsx(
694
+ "p",
695
+ {
696
+ style: {
697
+ margin: "0 0 24px 0",
698
+ fontSize: "15px",
699
+ lineHeight: "1.6",
700
+ color: theme2.colors.text
701
+ },
702
+ children: "Customize the Industry theme colors to match your preferences. Changes will be saved automatically."
703
+ }
704
+ ),
705
+ /* @__PURE__ */ jsxs(
706
+ "div",
707
+ {
708
+ style: {
709
+ padding: "20px",
710
+ backgroundColor: theme2.colors.backgroundSecondary,
711
+ borderRadius: "8px",
712
+ border: `1px solid ${theme2.colors.border}`
713
+ },
714
+ children: [
715
+ /* @__PURE__ */ jsx(
716
+ "h4",
717
+ {
718
+ style: {
719
+ margin: "0 0 16px 0",
720
+ fontSize: theme2.fontSizes[3],
721
+ color: theme2.colors.text,
722
+ fontWeight: 600
723
+ },
724
+ children: "How to Use"
725
+ }
726
+ ),
727
+ /* @__PURE__ */ jsxs(
728
+ "ul",
729
+ {
730
+ style: {
731
+ margin: 0,
732
+ paddingLeft: "20px",
733
+ fontSize: "14px",
734
+ color: theme2.colors.textSecondary,
735
+ lineHeight: "1.8"
736
+ },
737
+ children: [
738
+ /* @__PURE__ */ jsx("li", { children: "Click the color square to open the color picker" }),
739
+ /* @__PURE__ */ jsx("li", { children: "Enter hex values directly in the input field" }),
740
+ /* @__PURE__ */ jsx("li", { children: "Use the reset button to revert individual colors" }),
741
+ /* @__PURE__ */ jsx("li", { children: "All changes are applied immediately" })
742
+ ]
743
+ }
744
+ )
745
+ ]
746
+ }
747
+ )
748
+ ]
749
+ }
750
+ );
751
+ };
752
+ const COLOR_GROUPS = {
753
+ "Primary Colors": [
754
+ { label: "Primary", path: "colors.primary" },
755
+ { label: "Secondary", path: "colors.secondary" },
756
+ { label: "Accent", path: "colors.accent" }
757
+ ],
758
+ "Background Colors": [
759
+ { label: "BG Default", path: "colors.background" },
760
+ { label: "BG Light", path: "colors.backgroundLight" },
761
+ { label: "BG Dark", path: "colors.backgroundDark" },
762
+ { label: "BG Secondary", path: "colors.backgroundSecondary" },
763
+ { label: "BG Tertiary", path: "colors.backgroundTertiary" }
764
+ ],
765
+ "Text Colors": [
766
+ { label: "Text", path: "colors.text" },
767
+ { label: "Text Secondary", path: "colors.textSecondary" },
768
+ { label: "Text Tertiary", path: "colors.textTertiary" }
769
+ ],
770
+ "UI Colors": [
771
+ { label: "Border", path: "colors.border" },
772
+ { label: "Border Light", path: "colors.borderLight" },
773
+ { label: "Border Dark", path: "colors.borderDark" }
774
+ ],
775
+ "Status Colors": [
776
+ { label: "Success", path: "colors.success" },
777
+ { label: "Warning", path: "colors.warning" },
778
+ { label: "Error", path: "colors.error" },
779
+ { label: "Info", path: "colors.info" }
780
+ ]
781
+ };
782
+ const ThemeEditorPanelContent = () => {
783
+ const { theme: theme2 } = useTheme();
784
+ const [showHelp, setShowHelp] = useState(false);
785
+ const handleColorChange = async (path, newValue) => {
786
+ console.log(`Update ${path} to ${newValue}`);
787
+ };
788
+ const handleResetColor = async (path) => {
789
+ console.log(`Reset ${path}`);
790
+ };
791
+ const getColorValue = (path) => {
792
+ const parts = path.split(".");
793
+ let value = theme2;
794
+ for (const part of parts) {
795
+ if (value && typeof value === "object" && part in value) {
796
+ value = value[part];
797
+ } else {
798
+ return "#000000";
799
+ }
800
+ }
801
+ return typeof value === "string" ? value : "#000000";
802
+ };
803
+ return /* @__PURE__ */ jsxs(
804
+ "div",
805
+ {
806
+ style: {
807
+ fontFamily: theme2.fonts.body,
808
+ height: "100%",
809
+ display: "flex",
810
+ flexDirection: "column",
811
+ backgroundColor: theme2.colors.background,
812
+ color: theme2.colors.text,
813
+ overflow: "hidden",
814
+ position: "relative"
815
+ },
816
+ children: [
817
+ /* @__PURE__ */ jsx(
818
+ "div",
819
+ {
820
+ style: {
821
+ padding: "20px",
822
+ borderBottom: `1px solid ${theme2.colors.border}`,
823
+ flex: "0 0 auto"
824
+ },
825
+ children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "12px", justifyContent: "space-between" }, children: [
826
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "12px" }, children: [
827
+ /* @__PURE__ */ jsx(Palette, { size: 24, color: theme2.colors.primary }),
828
+ /* @__PURE__ */ jsx(
829
+ "h2",
830
+ {
831
+ style: {
832
+ margin: 0,
833
+ fontSize: theme2.fontSizes[4],
834
+ color: theme2.colors.text
835
+ },
836
+ children: "Theme Editor"
837
+ }
838
+ )
839
+ ] }),
840
+ /* @__PURE__ */ jsx(
841
+ "button",
842
+ {
843
+ onClick: () => setShowHelp(!showHelp),
844
+ title: "Help",
845
+ style: {
846
+ padding: "8px",
847
+ borderRadius: "6px",
848
+ border: `1px solid ${theme2.colors.border}`,
849
+ backgroundColor: showHelp ? theme2.colors.backgroundSecondary : theme2.colors.background,
850
+ color: theme2.colors.text,
851
+ cursor: "pointer",
852
+ display: "flex",
853
+ alignItems: "center",
854
+ justifyContent: "center",
855
+ transition: "all 0.15s"
856
+ },
857
+ onMouseEnter: (e) => {
858
+ if (!showHelp) {
859
+ e.currentTarget.style.backgroundColor = theme2.colors.backgroundSecondary;
860
+ }
861
+ },
862
+ onMouseLeave: (e) => {
863
+ if (!showHelp) {
864
+ e.currentTarget.style.backgroundColor = theme2.colors.background;
865
+ }
866
+ },
867
+ children: /* @__PURE__ */ jsx(CircleQuestionMark, { size: 18 })
868
+ }
869
+ )
870
+ ] })
871
+ }
872
+ ),
873
+ /* @__PURE__ */ jsx(
874
+ "div",
875
+ {
876
+ style: {
877
+ flex: "1 1 auto",
878
+ overflowY: "auto",
879
+ padding: "20px",
880
+ display: "flex",
881
+ flexDirection: "column",
882
+ gap: "16px"
883
+ },
884
+ children: showHelp ? /* @__PURE__ */ jsx(HelpContent, {}) : (
885
+ /* Color Groups */
886
+ /* @__PURE__ */ jsx(Fragment, { children: Object.entries(COLOR_GROUPS).map(([groupName, colors]) => /* @__PURE__ */ jsxs(
887
+ "section",
888
+ {
889
+ style: {
890
+ padding: "16px",
891
+ background: theme2.colors.backgroundSecondary,
892
+ borderRadius: theme2.radii[2],
893
+ border: `1px solid ${theme2.colors.border}`,
894
+ flex: "0 0 auto"
895
+ },
896
+ children: [
897
+ /* @__PURE__ */ jsx(
898
+ "h3",
899
+ {
900
+ style: {
901
+ margin: "0 0 16px 0",
902
+ fontSize: theme2.fontSizes[3],
903
+ color: theme2.colors.text,
904
+ fontWeight: 600
905
+ },
906
+ children: groupName
907
+ }
908
+ ),
909
+ colors.map((color) => /* @__PURE__ */ jsx(
910
+ ColorPickerInput,
911
+ {
912
+ label: color.label,
913
+ value: getColorValue(color.path),
914
+ onChange: (newValue) => handleColorChange(color.path, newValue),
915
+ onReset: () => handleResetColor(color.path),
916
+ defaultValue: getColorValue(color.path)
917
+ },
918
+ color.path
919
+ ))
920
+ ]
921
+ },
922
+ groupName
923
+ )) })
924
+ )
925
+ }
926
+ )
927
+ ]
928
+ }
929
+ );
930
+ };
931
+ const ThemeEditorPanel = (props) => {
932
+ return /* @__PURE__ */ jsx(ThemeProvider, { children: /* @__PURE__ */ jsx(ThemeEditorPanelContent, { ...props }) });
933
+ };
934
+ const panels = [
935
+ {
936
+ metadata: {
937
+ id: "industry-theme.theme-editor",
938
+ name: "Theme Editor",
939
+ icon: "🎨",
940
+ version: "0.1.0",
941
+ author: "Principal ADE",
942
+ description: "Customize Industry theme colors and appearance",
943
+ slices: []
944
+ // This panel doesn't need data slices
945
+ },
946
+ component: ThemeEditorPanel,
947
+ // Optional: Called when this specific panel is mounted
948
+ onMount: async (context) => {
949
+ var _a;
950
+ console.log(
951
+ "Theme Editor Panel mounted",
952
+ (_a = context.currentScope.repository) == null ? void 0 : _a.path
953
+ );
954
+ },
955
+ // Optional: Called when this specific panel is unmounted
956
+ onUnmount: async (_context) => {
957
+ console.log("Theme Editor Panel unmounting");
958
+ }
959
+ }
960
+ ];
961
+ const onPackageLoad = async () => {
962
+ console.log("Panel package loaded - Example Panel Extension");
963
+ };
964
+ const onPackageUnload = async () => {
965
+ console.log("Panel package unloading - Example Panel Extension");
966
+ };
967
+ export {
968
+ onPackageLoad,
969
+ onPackageUnload,
970
+ panels
971
+ };
972
+ //# sourceMappingURL=panels.bundle.js.map