@squaredr/fieldcraft-pro 1.7.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +51 -51
- package/README.md +139 -139
- package/dist/{chunk-VEP3DOCQ.mjs → chunk-5QXKDYWY.mjs} +103 -19
- package/dist/{chunk-GZIV2XAD.mjs → chunk-7GPX3YIB.mjs} +146 -183
- package/dist/{chunk-J5V6OVZO.mjs → chunk-DWRLPGX5.mjs} +690 -211
- package/dist/{chunk-4TN6YJDF.mjs → chunk-KTIU7VCP.mjs} +971 -214
- package/dist/default-schema-BGxf9Jrg.d.ts +174 -0
- package/dist/default-schema-Bwq8FATF.d.mts +174 -0
- package/dist/form-builder/index.d.mts +14 -170
- package/dist/form-builder/index.d.ts +14 -170
- package/dist/form-builder/index.js +827 -326
- package/dist/form-builder/index.mjs +1 -1
- package/dist/index.d.mts +111 -10
- package/dist/index.d.ts +111 -10
- package/dist/index.js +3525 -971
- package/dist/index.mjs +1424 -124
- package/dist/response-viewer/index.d.mts +1 -1
- package/dist/response-viewer/index.d.ts +1 -1
- package/dist/response-viewer/index.js +146 -183
- package/dist/response-viewer/index.mjs +1 -1
- package/dist/styles.css +2 -2
- package/dist/templates/index.d.mts +1 -1
- package/dist/templates/index.d.ts +1 -1
- package/dist/templates/index.js +103 -19
- package/dist/templates/index.mjs +1 -1
- package/dist/theme-editor/index.d.mts +12 -7
- package/dist/theme-editor/index.d.ts +12 -7
- package/dist/theme-editor/index.js +971 -214
- package/dist/theme-editor/index.mjs +1 -1
- package/dist/{types-bFHsZT1n.d.mts → types-BQOeI3LX.d.mts} +1 -1
- package/dist/{types-bFHsZT1n.d.ts → types-BQOeI3LX.d.ts} +1 -1
- package/package.json +29 -18
- package/theme-editor/styles.css +497 -466
|
@@ -8,18 +8,23 @@ var PREVIEW_SCHEMA = {
|
|
|
8
8
|
id: "theme-preview",
|
|
9
9
|
version: "1.0.0",
|
|
10
10
|
title: "Theme Preview",
|
|
11
|
-
description: "See how your theme looks
|
|
11
|
+
description: "See how your theme looks across every field type.",
|
|
12
|
+
settings: {
|
|
13
|
+
displayMode: "classic",
|
|
14
|
+
showProgress: false
|
|
15
|
+
},
|
|
12
16
|
sections: [
|
|
13
17
|
{
|
|
14
|
-
id: "
|
|
15
|
-
title: "
|
|
18
|
+
id: "s-text",
|
|
19
|
+
title: "Text Inputs",
|
|
16
20
|
questions: [
|
|
17
21
|
{
|
|
18
22
|
id: "name",
|
|
19
23
|
type: "short_text",
|
|
20
24
|
label: "Full Name",
|
|
21
25
|
required: true,
|
|
22
|
-
placeholder: "Jane Doe"
|
|
26
|
+
placeholder: "Jane Doe",
|
|
27
|
+
helpText: "Enter your full legal name."
|
|
23
28
|
},
|
|
24
29
|
{
|
|
25
30
|
id: "email",
|
|
@@ -28,6 +33,31 @@ var PREVIEW_SCHEMA = {
|
|
|
28
33
|
required: true,
|
|
29
34
|
placeholder: "jane@example.com"
|
|
30
35
|
},
|
|
36
|
+
{
|
|
37
|
+
id: "phone",
|
|
38
|
+
type: "phone",
|
|
39
|
+
label: "Phone Number",
|
|
40
|
+
placeholder: "(555) 123-4567"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: "website",
|
|
44
|
+
type: "url",
|
|
45
|
+
label: "Website",
|
|
46
|
+
placeholder: "https://example.com"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: "bio",
|
|
50
|
+
type: "long_text",
|
|
51
|
+
label: "Bio / Notes",
|
|
52
|
+
placeholder: "Tell us about yourself...",
|
|
53
|
+
helpText: "Markdown is supported."
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: "s-selection",
|
|
59
|
+
title: "Selection Fields",
|
|
60
|
+
questions: [
|
|
31
61
|
{
|
|
32
62
|
id: "department",
|
|
33
63
|
type: "dropdown",
|
|
@@ -35,20 +65,184 @@ var PREVIEW_SCHEMA = {
|
|
|
35
65
|
options: [
|
|
36
66
|
{ label: "Engineering", value: "engineering" },
|
|
37
67
|
{ label: "Design", value: "design" },
|
|
38
|
-
{ label: "Marketing", value: "marketing" }
|
|
68
|
+
{ label: "Marketing", value: "marketing" },
|
|
69
|
+
{ label: "Sales", value: "sales" }
|
|
39
70
|
]
|
|
40
71
|
},
|
|
72
|
+
{
|
|
73
|
+
id: "role",
|
|
74
|
+
type: "single_select",
|
|
75
|
+
label: "Role",
|
|
76
|
+
helpText: "Select one option.",
|
|
77
|
+
options: [
|
|
78
|
+
{ label: "Individual Contributor", value: "ic" },
|
|
79
|
+
{ label: "Team Lead", value: "lead" },
|
|
80
|
+
{ label: "Manager", value: "manager" },
|
|
81
|
+
{ label: "Director", value: "director" }
|
|
82
|
+
],
|
|
83
|
+
config: { type: "single_select", layout: "vertical" }
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
id: "skills",
|
|
87
|
+
type: "multi_select",
|
|
88
|
+
label: "Skills",
|
|
89
|
+
helpText: "Select all that apply.",
|
|
90
|
+
options: [
|
|
91
|
+
{ label: "JavaScript", value: "js" },
|
|
92
|
+
{ label: "TypeScript", value: "ts" },
|
|
93
|
+
{ label: "Python", value: "py" },
|
|
94
|
+
{ label: "Rust", value: "rust" },
|
|
95
|
+
{ label: "Go", value: "go" }
|
|
96
|
+
],
|
|
97
|
+
config: { type: "multi_select", layout: "vertical" }
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
id: "newsletter",
|
|
101
|
+
type: "boolean",
|
|
102
|
+
label: "Subscribe to newsletter?",
|
|
103
|
+
config: { type: "boolean", style: "toggle" }
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
id: "s-numeric",
|
|
109
|
+
title: "Numeric & Rating",
|
|
110
|
+
questions: [
|
|
111
|
+
{
|
|
112
|
+
id: "age",
|
|
113
|
+
type: "number",
|
|
114
|
+
label: "Age",
|
|
115
|
+
placeholder: "25",
|
|
116
|
+
config: { type: "number", min: 0, max: 150 }
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
id: "satisfaction",
|
|
120
|
+
type: "slider",
|
|
121
|
+
label: "Satisfaction Level",
|
|
122
|
+
config: { type: "slider", min: 0, max: 100, step: 5 }
|
|
123
|
+
},
|
|
41
124
|
{
|
|
42
125
|
id: "rating",
|
|
43
126
|
type: "rating",
|
|
44
|
-
label: "
|
|
127
|
+
label: "Overall Rating",
|
|
45
128
|
config: { type: "rating", max: 5 }
|
|
46
129
|
},
|
|
47
130
|
{
|
|
48
|
-
id: "
|
|
49
|
-
type: "
|
|
50
|
-
label: "
|
|
51
|
-
|
|
131
|
+
id: "nps",
|
|
132
|
+
type: "nps",
|
|
133
|
+
label: "How likely are you to recommend us?"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
id: "opinion",
|
|
137
|
+
type: "opinion_scale",
|
|
138
|
+
label: "How do you feel about the onboarding?",
|
|
139
|
+
config: {
|
|
140
|
+
type: "opinion_scale",
|
|
141
|
+
min: 1,
|
|
142
|
+
max: 5,
|
|
143
|
+
minLabel: "Very Poor",
|
|
144
|
+
maxLabel: "Excellent"
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
id: "s-datetime",
|
|
151
|
+
title: "Date & Time",
|
|
152
|
+
questions: [
|
|
153
|
+
{
|
|
154
|
+
id: "dob",
|
|
155
|
+
type: "date",
|
|
156
|
+
label: "Date of Birth",
|
|
157
|
+
config: { type: "date", disableFuture: true }
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
id: "preferred_time",
|
|
161
|
+
type: "time",
|
|
162
|
+
label: "Preferred Time",
|
|
163
|
+
config: { type: "time", format: "12h" }
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
id: "travel_dates",
|
|
167
|
+
type: "date_range",
|
|
168
|
+
label: "Travel Dates"
|
|
169
|
+
}
|
|
170
|
+
]
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
id: "s-media",
|
|
174
|
+
title: "Media & Files",
|
|
175
|
+
questions: [
|
|
176
|
+
{
|
|
177
|
+
id: "resume",
|
|
178
|
+
type: "file_upload",
|
|
179
|
+
label: "Upload Resume",
|
|
180
|
+
helpText: "PDF or DOCX, max 10 MB.",
|
|
181
|
+
config: { type: "file_upload", maxFiles: 1, maxSizeMb: 10, accept: [".pdf", ".docx"] }
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
id: "signature",
|
|
185
|
+
type: "signature",
|
|
186
|
+
label: "Signature",
|
|
187
|
+
helpText: "Draw your signature below."
|
|
188
|
+
}
|
|
189
|
+
]
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
id: "s-advanced",
|
|
193
|
+
title: "Advanced Fields",
|
|
194
|
+
questions: [
|
|
195
|
+
{
|
|
196
|
+
id: "experience",
|
|
197
|
+
type: "likert",
|
|
198
|
+
label: "Rate the following aspects:",
|
|
199
|
+
config: {
|
|
200
|
+
type: "likert",
|
|
201
|
+
labels: ["Strongly Disagree", "Disagree", "Neutral", "Agree", "Strongly Agree"]
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
id: "country",
|
|
206
|
+
type: "country_select",
|
|
207
|
+
label: "Country",
|
|
208
|
+
config: { type: "country_select", showFlags: true }
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
id: "consent",
|
|
212
|
+
type: "consent",
|
|
213
|
+
label: "Terms & Conditions",
|
|
214
|
+
config: {
|
|
215
|
+
type: "consent",
|
|
216
|
+
text: "I agree to the Terms of Service and Privacy Policy.",
|
|
217
|
+
checkboxLabel: "I agree"
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
]
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
id: "s-content",
|
|
224
|
+
title: "Content & Visual",
|
|
225
|
+
questions: [
|
|
226
|
+
{
|
|
227
|
+
id: "info",
|
|
228
|
+
type: "info_block",
|
|
229
|
+
label: "This is an informational message block. It can be used to display important notices."
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
id: "warning_info",
|
|
233
|
+
type: "info_block",
|
|
234
|
+
label: "Please double-check all information before submitting."
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
id: "divider",
|
|
238
|
+
type: "divider",
|
|
239
|
+
label: ""
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
id: "section_head",
|
|
243
|
+
type: "section_header",
|
|
244
|
+
label: "Section Header Example",
|
|
245
|
+
config: { type: "section_header", level: "h3", showDivider: true }
|
|
52
246
|
}
|
|
53
247
|
]
|
|
54
248
|
}
|
|
@@ -225,16 +419,20 @@ function deepMerge(base, partial) {
|
|
|
225
419
|
|
|
226
420
|
// src/theme-editor/palette-generator.ts
|
|
227
421
|
function generatePalette(baseHex) {
|
|
422
|
+
const cleaned = baseHex.replace("#", "");
|
|
423
|
+
if (!/^[0-9a-fA-F]{3}$|^[0-9a-fA-F]{6}$/.test(cleaned)) {
|
|
424
|
+
return generatePalette("#6B7280");
|
|
425
|
+
}
|
|
228
426
|
const [h, s, l] = hexToHsl(baseHex);
|
|
229
427
|
const secH = (h + 180) % 360;
|
|
230
428
|
const isLightBase = l > 50;
|
|
231
429
|
return {
|
|
232
430
|
// Primary
|
|
233
431
|
primary: hslToHex(h, s, clamp(l, 30, 60)),
|
|
234
|
-
primaryForeground: isLightBase ? "#ffffff" : "#
|
|
432
|
+
primaryForeground: isLightBase ? "#ffffff" : "#000000",
|
|
235
433
|
// Secondary (complementary)
|
|
236
434
|
secondary: hslToHex(secH, Math.max(s - 15, 10), clamp(l, 35, 55)),
|
|
237
|
-
secondaryForeground: "#ffffff",
|
|
435
|
+
secondaryForeground: isLightBase ? "#ffffff" : "#000000",
|
|
238
436
|
// Surfaces
|
|
239
437
|
surface: hslToHex(h, Math.max(s - 35, 3), 97),
|
|
240
438
|
background: "#F4F7F8",
|
|
@@ -407,148 +605,458 @@ function PaletteGenerator({ theme, onApply, onClose }) {
|
|
|
407
605
|
}
|
|
408
606
|
|
|
409
607
|
// src/theme-editor/presets.ts
|
|
410
|
-
var
|
|
608
|
+
var cleanLight = {
|
|
411
609
|
colors: {
|
|
412
|
-
primary: "#
|
|
610
|
+
primary: "#2563EB",
|
|
413
611
|
primaryForeground: "#FFFFFF",
|
|
414
|
-
secondary: "#
|
|
415
|
-
secondaryForeground: "#
|
|
416
|
-
error: "#
|
|
612
|
+
secondary: "#DBEAFE",
|
|
613
|
+
secondaryForeground: "#1E3A5F",
|
|
614
|
+
error: "#DC2626",
|
|
417
615
|
errorForeground: "#FFFFFF",
|
|
418
|
-
warning: "#
|
|
419
|
-
success: "#
|
|
616
|
+
warning: "#D97706",
|
|
617
|
+
success: "#16A34A",
|
|
420
618
|
surface: "#FFFFFF",
|
|
421
|
-
background: "#
|
|
422
|
-
text: "#
|
|
423
|
-
textMuted: "#
|
|
424
|
-
textDisabled: "#
|
|
425
|
-
border: "#
|
|
426
|
-
borderFocus: "#
|
|
619
|
+
background: "#F8FAFC",
|
|
620
|
+
text: "#0F172A",
|
|
621
|
+
textMuted: "#64748B",
|
|
622
|
+
textDisabled: "#CBD5E1",
|
|
623
|
+
border: "#E2E8F0",
|
|
624
|
+
borderFocus: "#2563EB",
|
|
427
625
|
inputBackground: "#FFFFFF"
|
|
428
626
|
},
|
|
429
627
|
typography: {
|
|
430
628
|
fontFamily: "Inter, system-ui, sans-serif",
|
|
431
629
|
scale: "comfortable",
|
|
432
|
-
questionSize: "1.
|
|
630
|
+
questionSize: "1.0625rem",
|
|
433
631
|
labelSize: "0.875rem",
|
|
434
632
|
helpTextSize: "0.8125rem",
|
|
435
633
|
bodySize: "0.9375rem"
|
|
436
634
|
},
|
|
437
|
-
shape: { radius: "
|
|
635
|
+
shape: { radius: "sm", inputRadius: "6px", buttonRadius: "6px", cardRadius: "8px" },
|
|
438
636
|
spacing: { base: 16, sectionGap: 32, fieldGap: 24, inputPaddingX: 12, inputPaddingY: 10 },
|
|
439
|
-
layout: { maxWidth: "640px", alignment: "left", progressPosition: "top", sectionLayout: "
|
|
637
|
+
layout: { maxWidth: "640px", alignment: "left", progressPosition: "top", sectionLayout: "flat" }
|
|
440
638
|
};
|
|
441
|
-
var
|
|
639
|
+
var cleanDark = {
|
|
442
640
|
colors: {
|
|
443
|
-
primary: "#
|
|
444
|
-
primaryForeground: "#
|
|
445
|
-
secondary: "#
|
|
446
|
-
secondaryForeground: "#
|
|
447
|
-
error: "#
|
|
448
|
-
errorForeground: "#
|
|
449
|
-
warning: "#
|
|
450
|
-
success: "#
|
|
451
|
-
surface: "#
|
|
452
|
-
background: "#
|
|
453
|
-
text: "#
|
|
454
|
-
textMuted: "#
|
|
455
|
-
textDisabled: "#
|
|
456
|
-
border: "#
|
|
457
|
-
borderFocus: "#
|
|
458
|
-
inputBackground: "#
|
|
641
|
+
primary: "#60A5FA",
|
|
642
|
+
primaryForeground: "#0C1929",
|
|
643
|
+
secondary: "#1E3A5F",
|
|
644
|
+
secondaryForeground: "#DBEAFE",
|
|
645
|
+
error: "#F87171",
|
|
646
|
+
errorForeground: "#1C1917",
|
|
647
|
+
warning: "#FBBF24",
|
|
648
|
+
success: "#4ADE80",
|
|
649
|
+
surface: "#1E293B",
|
|
650
|
+
background: "#0F172A",
|
|
651
|
+
text: "#F1F5F9",
|
|
652
|
+
textMuted: "#94A3B8",
|
|
653
|
+
textDisabled: "#334155",
|
|
654
|
+
border: "#334155",
|
|
655
|
+
borderFocus: "#60A5FA",
|
|
656
|
+
inputBackground: "#1E293B"
|
|
459
657
|
},
|
|
460
658
|
typography: {
|
|
461
659
|
fontFamily: "Inter, system-ui, sans-serif",
|
|
462
660
|
scale: "comfortable",
|
|
463
|
-
questionSize: "1.
|
|
661
|
+
questionSize: "1.0625rem",
|
|
464
662
|
labelSize: "0.875rem",
|
|
465
663
|
helpTextSize: "0.8125rem",
|
|
466
664
|
bodySize: "0.9375rem"
|
|
467
665
|
},
|
|
468
|
-
shape: { radius: "
|
|
666
|
+
shape: { radius: "sm", inputRadius: "6px", buttonRadius: "6px", cardRadius: "8px" },
|
|
667
|
+
spacing: { base: 16, sectionGap: 32, fieldGap: 24, inputPaddingX: 12, inputPaddingY: 10 },
|
|
668
|
+
layout: { maxWidth: "640px", alignment: "left", progressPosition: "top", sectionLayout: "flat" }
|
|
669
|
+
};
|
|
670
|
+
var stripeLight = {
|
|
671
|
+
colors: {
|
|
672
|
+
primary: "#635BFF",
|
|
673
|
+
primaryForeground: "#FFFFFF",
|
|
674
|
+
secondary: "#E8E6FF",
|
|
675
|
+
secondaryForeground: "#32297D",
|
|
676
|
+
error: "#DF1B41",
|
|
677
|
+
errorForeground: "#FFFFFF",
|
|
678
|
+
warning: "#D97706",
|
|
679
|
+
success: "#30B130",
|
|
680
|
+
surface: "#FFFFFF",
|
|
681
|
+
background: "#F6F9FC",
|
|
682
|
+
text: "#1A1F36",
|
|
683
|
+
textMuted: "#697386",
|
|
684
|
+
textDisabled: "#C1C9D2",
|
|
685
|
+
border: "#E3E8EE",
|
|
686
|
+
borderFocus: "#635BFF",
|
|
687
|
+
inputBackground: "#FFFFFF"
|
|
688
|
+
},
|
|
689
|
+
typography: {
|
|
690
|
+
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
|
|
691
|
+
scale: "comfortable",
|
|
692
|
+
questionSize: "1rem",
|
|
693
|
+
labelSize: "0.875rem",
|
|
694
|
+
helpTextSize: "0.8125rem",
|
|
695
|
+
bodySize: "0.9375rem"
|
|
696
|
+
},
|
|
697
|
+
shape: { radius: "md", inputRadius: "8px", buttonRadius: "8px", cardRadius: "12px" },
|
|
469
698
|
spacing: { base: 16, sectionGap: 32, fieldGap: 24, inputPaddingX: 12, inputPaddingY: 10 },
|
|
470
699
|
layout: { maxWidth: "640px", alignment: "left", progressPosition: "top", sectionLayout: "card" }
|
|
471
700
|
};
|
|
472
|
-
var
|
|
701
|
+
var stripeDark = {
|
|
702
|
+
colors: {
|
|
703
|
+
primary: "#7A73FF",
|
|
704
|
+
primaryForeground: "#FFFFFF",
|
|
705
|
+
secondary: "#2D2A5E",
|
|
706
|
+
secondaryForeground: "#CBC8FF",
|
|
707
|
+
error: "#F93A5E",
|
|
708
|
+
errorForeground: "#FFFFFF",
|
|
709
|
+
warning: "#FBBF24",
|
|
710
|
+
success: "#4ADE80",
|
|
711
|
+
surface: "#1C2033",
|
|
712
|
+
background: "#0A0E1A",
|
|
713
|
+
text: "#E3E5EA",
|
|
714
|
+
textMuted: "#8992A7",
|
|
715
|
+
textDisabled: "#3C4257",
|
|
716
|
+
border: "#2C3046",
|
|
717
|
+
borderFocus: "#7A73FF",
|
|
718
|
+
inputBackground: "#1C2033"
|
|
719
|
+
},
|
|
720
|
+
typography: {
|
|
721
|
+
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
|
|
722
|
+
scale: "comfortable",
|
|
723
|
+
questionSize: "1rem",
|
|
724
|
+
labelSize: "0.875rem",
|
|
725
|
+
helpTextSize: "0.8125rem",
|
|
726
|
+
bodySize: "0.9375rem"
|
|
727
|
+
},
|
|
728
|
+
shape: { radius: "md", inputRadius: "8px", buttonRadius: "8px", cardRadius: "12px" },
|
|
729
|
+
spacing: { base: 16, sectionGap: 32, fieldGap: 24, inputPaddingX: 12, inputPaddingY: 10 },
|
|
730
|
+
layout: { maxWidth: "640px", alignment: "left", progressPosition: "top", sectionLayout: "card" }
|
|
731
|
+
};
|
|
732
|
+
var githubLight = {
|
|
733
|
+
colors: {
|
|
734
|
+
primary: "#1F6FEB",
|
|
735
|
+
primaryForeground: "#FFFFFF",
|
|
736
|
+
secondary: "#DDF4FF",
|
|
737
|
+
secondaryForeground: "#0550AE",
|
|
738
|
+
error: "#CF222E",
|
|
739
|
+
errorForeground: "#FFFFFF",
|
|
740
|
+
warning: "#9A6700",
|
|
741
|
+
success: "#1A7F37",
|
|
742
|
+
surface: "#FFFFFF",
|
|
743
|
+
background: "#F6F8FA",
|
|
744
|
+
text: "#1F2328",
|
|
745
|
+
textMuted: "#656D76",
|
|
746
|
+
textDisabled: "#B1BAC4",
|
|
747
|
+
border: "#D0D7DE",
|
|
748
|
+
borderFocus: "#1F6FEB",
|
|
749
|
+
inputBackground: "#FFFFFF"
|
|
750
|
+
},
|
|
751
|
+
typography: {
|
|
752
|
+
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif",
|
|
753
|
+
scale: "comfortable",
|
|
754
|
+
questionSize: "1rem",
|
|
755
|
+
labelSize: "0.875rem",
|
|
756
|
+
helpTextSize: "0.75rem",
|
|
757
|
+
bodySize: "0.875rem"
|
|
758
|
+
},
|
|
759
|
+
shape: { radius: "md", inputRadius: "6px", buttonRadius: "6px", cardRadius: "6px" },
|
|
760
|
+
spacing: { base: 16, sectionGap: 28, fieldGap: 20, inputPaddingX: 12, inputPaddingY: 8 },
|
|
761
|
+
layout: { maxWidth: "640px", alignment: "left", progressPosition: "top", sectionLayout: "bordered" }
|
|
762
|
+
};
|
|
763
|
+
var githubDark = {
|
|
764
|
+
colors: {
|
|
765
|
+
primary: "#58A6FF",
|
|
766
|
+
primaryForeground: "#0D1117",
|
|
767
|
+
secondary: "#172B4D",
|
|
768
|
+
secondaryForeground: "#A5D6FF",
|
|
769
|
+
error: "#F85149",
|
|
770
|
+
errorForeground: "#0D1117",
|
|
771
|
+
warning: "#E3B341",
|
|
772
|
+
success: "#3FB950",
|
|
773
|
+
surface: "#161B22",
|
|
774
|
+
background: "#0D1117",
|
|
775
|
+
text: "#E6EDF3",
|
|
776
|
+
textMuted: "#8B949E",
|
|
777
|
+
textDisabled: "#3D444D",
|
|
778
|
+
border: "#30363D",
|
|
779
|
+
borderFocus: "#58A6FF",
|
|
780
|
+
inputBackground: "#161B22"
|
|
781
|
+
},
|
|
782
|
+
typography: {
|
|
783
|
+
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif",
|
|
784
|
+
scale: "comfortable",
|
|
785
|
+
questionSize: "1rem",
|
|
786
|
+
labelSize: "0.875rem",
|
|
787
|
+
helpTextSize: "0.75rem",
|
|
788
|
+
bodySize: "0.875rem"
|
|
789
|
+
},
|
|
790
|
+
shape: { radius: "md", inputRadius: "6px", buttonRadius: "6px", cardRadius: "6px" },
|
|
791
|
+
spacing: { base: 16, sectionGap: 28, fieldGap: 20, inputPaddingX: 12, inputPaddingY: 8 },
|
|
792
|
+
layout: { maxWidth: "640px", alignment: "left", progressPosition: "top", sectionLayout: "bordered" }
|
|
793
|
+
};
|
|
794
|
+
var vercelLight = {
|
|
473
795
|
colors: {
|
|
474
|
-
primary: "#
|
|
475
|
-
primaryForeground: "#
|
|
476
|
-
secondary: "#
|
|
477
|
-
secondaryForeground: "#
|
|
478
|
-
error: "#
|
|
479
|
-
errorForeground: "#
|
|
480
|
-
warning: "#
|
|
481
|
-
success: "#
|
|
482
|
-
surface: "#
|
|
796
|
+
primary: "#000000",
|
|
797
|
+
primaryForeground: "#FFFFFF",
|
|
798
|
+
secondary: "#F5F5F5",
|
|
799
|
+
secondaryForeground: "#171717",
|
|
800
|
+
error: "#E5484D",
|
|
801
|
+
errorForeground: "#FFFFFF",
|
|
802
|
+
warning: "#F5A623",
|
|
803
|
+
success: "#45A557",
|
|
804
|
+
surface: "#FFFFFF",
|
|
483
805
|
background: "#FAFAFA",
|
|
484
|
-
text: "#
|
|
485
|
-
textMuted: "#
|
|
486
|
-
textDisabled: "#
|
|
487
|
-
border: "#
|
|
488
|
-
borderFocus: "#
|
|
489
|
-
inputBackground: "#
|
|
806
|
+
text: "#171717",
|
|
807
|
+
textMuted: "#666666",
|
|
808
|
+
textDisabled: "#C7C7C7",
|
|
809
|
+
border: "#EAEAEA",
|
|
810
|
+
borderFocus: "#000000",
|
|
811
|
+
inputBackground: "#FFFFFF"
|
|
490
812
|
},
|
|
491
813
|
typography: {
|
|
492
|
-
fontFamily: "'
|
|
814
|
+
fontFamily: "'Geist', Inter, -apple-system, sans-serif",
|
|
493
815
|
scale: "comfortable",
|
|
494
|
-
questionSize: "
|
|
816
|
+
questionSize: "1rem",
|
|
495
817
|
labelSize: "0.875rem",
|
|
496
818
|
helpTextSize: "0.8125rem",
|
|
497
|
-
bodySize: "
|
|
819
|
+
bodySize: "0.875rem"
|
|
498
820
|
},
|
|
499
|
-
shape: { radius: "
|
|
500
|
-
spacing: { base: 16, sectionGap:
|
|
501
|
-
layout: { maxWidth: "
|
|
821
|
+
shape: { radius: "md", inputRadius: "8px", buttonRadius: "8px", cardRadius: "12px" },
|
|
822
|
+
spacing: { base: 16, sectionGap: 32, fieldGap: 24, inputPaddingX: 12, inputPaddingY: 10 },
|
|
823
|
+
layout: { maxWidth: "600px", alignment: "left", progressPosition: "top", sectionLayout: "flat" }
|
|
824
|
+
};
|
|
825
|
+
var vercelDark = {
|
|
826
|
+
colors: {
|
|
827
|
+
primary: "#FFFFFF",
|
|
828
|
+
primaryForeground: "#000000",
|
|
829
|
+
secondary: "#1A1A1A",
|
|
830
|
+
secondaryForeground: "#EDEDED",
|
|
831
|
+
error: "#E5484D",
|
|
832
|
+
errorForeground: "#FFFFFF",
|
|
833
|
+
warning: "#F5A623",
|
|
834
|
+
success: "#45A557",
|
|
835
|
+
surface: "#111111",
|
|
836
|
+
background: "#000000",
|
|
837
|
+
text: "#EDEDED",
|
|
838
|
+
textMuted: "#888888",
|
|
839
|
+
textDisabled: "#444444",
|
|
840
|
+
border: "#333333",
|
|
841
|
+
borderFocus: "#FFFFFF",
|
|
842
|
+
inputBackground: "#111111"
|
|
843
|
+
},
|
|
844
|
+
typography: {
|
|
845
|
+
fontFamily: "'Geist', Inter, -apple-system, sans-serif",
|
|
846
|
+
scale: "comfortable",
|
|
847
|
+
questionSize: "1rem",
|
|
848
|
+
labelSize: "0.875rem",
|
|
849
|
+
helpTextSize: "0.8125rem",
|
|
850
|
+
bodySize: "0.875rem"
|
|
851
|
+
},
|
|
852
|
+
shape: { radius: "md", inputRadius: "8px", buttonRadius: "8px", cardRadius: "12px" },
|
|
853
|
+
spacing: { base: 16, sectionGap: 32, fieldGap: 24, inputPaddingX: 12, inputPaddingY: 10 },
|
|
854
|
+
layout: { maxWidth: "600px", alignment: "left", progressPosition: "top", sectionLayout: "flat" }
|
|
855
|
+
};
|
|
856
|
+
var shopifyLight = {
|
|
857
|
+
colors: {
|
|
858
|
+
primary: "#008060",
|
|
859
|
+
primaryForeground: "#FFFFFF",
|
|
860
|
+
secondary: "#E3F1DF",
|
|
861
|
+
secondaryForeground: "#1A4D2E",
|
|
862
|
+
error: "#D72C0D",
|
|
863
|
+
errorForeground: "#FFFFFF",
|
|
864
|
+
warning: "#B98900",
|
|
865
|
+
success: "#008060",
|
|
866
|
+
surface: "#FFFFFF",
|
|
867
|
+
background: "#F6F6F7",
|
|
868
|
+
text: "#202223",
|
|
869
|
+
textMuted: "#6D7175",
|
|
870
|
+
textDisabled: "#BABEC3",
|
|
871
|
+
border: "#C9CCCF",
|
|
872
|
+
borderFocus: "#008060",
|
|
873
|
+
inputBackground: "#FFFFFF"
|
|
874
|
+
},
|
|
875
|
+
typography: {
|
|
876
|
+
fontFamily: "Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
877
|
+
scale: "comfortable",
|
|
878
|
+
questionSize: "1rem",
|
|
879
|
+
labelSize: "0.875rem",
|
|
880
|
+
helpTextSize: "0.8125rem",
|
|
881
|
+
bodySize: "0.9375rem"
|
|
882
|
+
},
|
|
883
|
+
shape: { radius: "md", inputRadius: "8px", buttonRadius: "8px", cardRadius: "12px" },
|
|
884
|
+
spacing: { base: 16, sectionGap: 32, fieldGap: 24, inputPaddingX: 12, inputPaddingY: 10 },
|
|
885
|
+
layout: { maxWidth: "640px", alignment: "left", progressPosition: "top", sectionLayout: "card" }
|
|
886
|
+
};
|
|
887
|
+
var shopifyDark = {
|
|
888
|
+
colors: {
|
|
889
|
+
primary: "#36D399",
|
|
890
|
+
primaryForeground: "#0D2818",
|
|
891
|
+
secondary: "#1A3A2A",
|
|
892
|
+
secondaryForeground: "#B5E4CA",
|
|
893
|
+
error: "#FE6B6B",
|
|
894
|
+
errorForeground: "#1C1110",
|
|
895
|
+
warning: "#FFD60A",
|
|
896
|
+
success: "#36D399",
|
|
897
|
+
surface: "#1A1C1E",
|
|
898
|
+
background: "#111213",
|
|
899
|
+
text: "#E3E5E7",
|
|
900
|
+
textMuted: "#8C9196",
|
|
901
|
+
textDisabled: "#44474A",
|
|
902
|
+
border: "#333638",
|
|
903
|
+
borderFocus: "#36D399",
|
|
904
|
+
inputBackground: "#1A1C1E"
|
|
905
|
+
},
|
|
906
|
+
typography: {
|
|
907
|
+
fontFamily: "Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
908
|
+
scale: "comfortable",
|
|
909
|
+
questionSize: "1rem",
|
|
910
|
+
labelSize: "0.875rem",
|
|
911
|
+
helpTextSize: "0.8125rem",
|
|
912
|
+
bodySize: "0.9375rem"
|
|
913
|
+
},
|
|
914
|
+
shape: { radius: "md", inputRadius: "8px", buttonRadius: "8px", cardRadius: "12px" },
|
|
915
|
+
spacing: { base: 16, sectionGap: 32, fieldGap: 24, inputPaddingX: 12, inputPaddingY: 10 },
|
|
916
|
+
layout: { maxWidth: "640px", alignment: "left", progressPosition: "top", sectionLayout: "card" }
|
|
917
|
+
};
|
|
918
|
+
var slackLight = {
|
|
919
|
+
colors: {
|
|
920
|
+
primary: "#611F69",
|
|
921
|
+
primaryForeground: "#FFFFFF",
|
|
922
|
+
secondary: "#F3E8F5",
|
|
923
|
+
secondaryForeground: "#4A154B",
|
|
924
|
+
error: "#E01E5A",
|
|
925
|
+
errorForeground: "#FFFFFF",
|
|
926
|
+
warning: "#ECB22E",
|
|
927
|
+
success: "#2EB67D",
|
|
928
|
+
surface: "#FFFFFF",
|
|
929
|
+
background: "#F8F8F8",
|
|
930
|
+
text: "#1D1C1D",
|
|
931
|
+
textMuted: "#616061",
|
|
932
|
+
textDisabled: "#B9B9B9",
|
|
933
|
+
border: "#DDDDDD",
|
|
934
|
+
borderFocus: "#611F69",
|
|
935
|
+
inputBackground: "#FFFFFF"
|
|
936
|
+
},
|
|
937
|
+
typography: {
|
|
938
|
+
fontFamily: "'Lato', 'Helvetica Neue', Helvetica, sans-serif",
|
|
939
|
+
scale: "comfortable",
|
|
940
|
+
questionSize: "1.0625rem",
|
|
941
|
+
labelSize: "0.875rem",
|
|
942
|
+
helpTextSize: "0.8125rem",
|
|
943
|
+
bodySize: "0.9375rem"
|
|
944
|
+
},
|
|
945
|
+
shape: { radius: "md", inputRadius: "8px", buttonRadius: "8px", cardRadius: "10px" },
|
|
946
|
+
spacing: { base: 16, sectionGap: 32, fieldGap: 24, inputPaddingX: 12, inputPaddingY: 10 },
|
|
947
|
+
layout: { maxWidth: "640px", alignment: "left", progressPosition: "top", sectionLayout: "card" }
|
|
502
948
|
};
|
|
503
|
-
var
|
|
949
|
+
var slackDark = {
|
|
950
|
+
colors: {
|
|
951
|
+
primary: "#D4A8DB",
|
|
952
|
+
primaryForeground: "#1A0A1E",
|
|
953
|
+
secondary: "#2C1332",
|
|
954
|
+
secondaryForeground: "#E2C6E9",
|
|
955
|
+
error: "#F5638B",
|
|
956
|
+
errorForeground: "#1C0E14",
|
|
957
|
+
warning: "#F0CA4D",
|
|
958
|
+
success: "#4FCEA2",
|
|
959
|
+
surface: "#1A1D21",
|
|
960
|
+
background: "#0F1114",
|
|
961
|
+
text: "#D1D2D3",
|
|
962
|
+
textMuted: "#9B9C9E",
|
|
963
|
+
textDisabled: "#4D4D4F",
|
|
964
|
+
border: "#383A3E",
|
|
965
|
+
borderFocus: "#D4A8DB",
|
|
966
|
+
inputBackground: "#1A1D21"
|
|
967
|
+
},
|
|
968
|
+
typography: {
|
|
969
|
+
fontFamily: "'Lato', 'Helvetica Neue', Helvetica, sans-serif",
|
|
970
|
+
scale: "comfortable",
|
|
971
|
+
questionSize: "1.0625rem",
|
|
972
|
+
labelSize: "0.875rem",
|
|
973
|
+
helpTextSize: "0.8125rem",
|
|
974
|
+
bodySize: "0.9375rem"
|
|
975
|
+
},
|
|
976
|
+
shape: { radius: "md", inputRadius: "8px", buttonRadius: "8px", cardRadius: "10px" },
|
|
977
|
+
spacing: { base: 16, sectionGap: 32, fieldGap: 24, inputPaddingX: 12, inputPaddingY: 10 },
|
|
978
|
+
layout: { maxWidth: "640px", alignment: "left", progressPosition: "top", sectionLayout: "card" }
|
|
979
|
+
};
|
|
980
|
+
var tailwindLight = {
|
|
981
|
+
colors: {
|
|
982
|
+
primary: "#4F46E5",
|
|
983
|
+
primaryForeground: "#FFFFFF",
|
|
984
|
+
secondary: "#EEF2FF",
|
|
985
|
+
secondaryForeground: "#3730A3",
|
|
986
|
+
error: "#DC2626",
|
|
987
|
+
errorForeground: "#FFFFFF",
|
|
988
|
+
warning: "#D97706",
|
|
989
|
+
success: "#059669",
|
|
990
|
+
surface: "#FFFFFF",
|
|
991
|
+
background: "#F9FAFB",
|
|
992
|
+
text: "#111827",
|
|
993
|
+
textMuted: "#6B7280",
|
|
994
|
+
textDisabled: "#D1D5DB",
|
|
995
|
+
border: "#E5E7EB",
|
|
996
|
+
borderFocus: "#4F46E5",
|
|
997
|
+
inputBackground: "#FFFFFF"
|
|
998
|
+
},
|
|
999
|
+
typography: {
|
|
1000
|
+
fontFamily: "Inter, system-ui, sans-serif",
|
|
1001
|
+
scale: "comfortable",
|
|
1002
|
+
questionSize: "1rem",
|
|
1003
|
+
labelSize: "0.875rem",
|
|
1004
|
+
helpTextSize: "0.8125rem",
|
|
1005
|
+
bodySize: "0.875rem"
|
|
1006
|
+
},
|
|
1007
|
+
shape: { radius: "md", inputRadius: "8px", buttonRadius: "8px", cardRadius: "12px" },
|
|
1008
|
+
spacing: { base: 16, sectionGap: 32, fieldGap: 24, inputPaddingX: 14, inputPaddingY: 10 },
|
|
1009
|
+
layout: { maxWidth: "640px", alignment: "left", progressPosition: "top", sectionLayout: "card" }
|
|
1010
|
+
};
|
|
1011
|
+
var tailwindDark = {
|
|
504
1012
|
colors: {
|
|
505
1013
|
primary: "#818CF8",
|
|
506
1014
|
primaryForeground: "#1E1B4B",
|
|
507
|
-
secondary: "#
|
|
508
|
-
secondaryForeground: "#
|
|
509
|
-
error: "#
|
|
510
|
-
errorForeground: "#
|
|
1015
|
+
secondary: "#1E1B4B",
|
|
1016
|
+
secondaryForeground: "#C7D2FE",
|
|
1017
|
+
error: "#F87171",
|
|
1018
|
+
errorForeground: "#1C1917",
|
|
511
1019
|
warning: "#FBBF24",
|
|
512
|
-
success: "#
|
|
513
|
-
surface: "#
|
|
514
|
-
background: "#
|
|
515
|
-
text: "#
|
|
516
|
-
textMuted: "#
|
|
517
|
-
textDisabled: "#
|
|
518
|
-
border: "#
|
|
1020
|
+
success: "#34D399",
|
|
1021
|
+
surface: "#1F2937",
|
|
1022
|
+
background: "#111827",
|
|
1023
|
+
text: "#F9FAFB",
|
|
1024
|
+
textMuted: "#9CA3AF",
|
|
1025
|
+
textDisabled: "#374151",
|
|
1026
|
+
border: "#374151",
|
|
519
1027
|
borderFocus: "#818CF8",
|
|
520
|
-
inputBackground: "#
|
|
1028
|
+
inputBackground: "#1F2937"
|
|
521
1029
|
},
|
|
522
1030
|
typography: {
|
|
523
|
-
fontFamily: "
|
|
1031
|
+
fontFamily: "Inter, system-ui, sans-serif",
|
|
524
1032
|
scale: "comfortable",
|
|
525
|
-
questionSize: "
|
|
1033
|
+
questionSize: "1rem",
|
|
526
1034
|
labelSize: "0.875rem",
|
|
527
1035
|
helpTextSize: "0.8125rem",
|
|
528
|
-
bodySize: "
|
|
1036
|
+
bodySize: "0.875rem"
|
|
529
1037
|
},
|
|
530
|
-
shape: { radius: "
|
|
531
|
-
spacing: { base: 16, sectionGap:
|
|
532
|
-
layout: { maxWidth: "
|
|
1038
|
+
shape: { radius: "md", inputRadius: "8px", buttonRadius: "8px", cardRadius: "12px" },
|
|
1039
|
+
spacing: { base: 16, sectionGap: 32, fieldGap: 24, inputPaddingX: 14, inputPaddingY: 10 },
|
|
1040
|
+
layout: { maxWidth: "640px", alignment: "left", progressPosition: "top", sectionLayout: "card" }
|
|
533
1041
|
};
|
|
534
|
-
var
|
|
1042
|
+
var clinicalLight = {
|
|
535
1043
|
colors: {
|
|
536
|
-
primary: "#
|
|
537
|
-
primaryForeground: "#
|
|
538
|
-
secondary: "#
|
|
539
|
-
secondaryForeground: "#
|
|
540
|
-
error: "#
|
|
541
|
-
errorForeground: "#
|
|
542
|
-
warning: "#
|
|
543
|
-
success: "#
|
|
544
|
-
surface: "#
|
|
1044
|
+
primary: "#0369A1",
|
|
1045
|
+
primaryForeground: "#FFFFFF",
|
|
1046
|
+
secondary: "#E0F2FE",
|
|
1047
|
+
secondaryForeground: "#0C4A6E",
|
|
1048
|
+
error: "#B91C1C",
|
|
1049
|
+
errorForeground: "#FFFFFF",
|
|
1050
|
+
warning: "#B45309",
|
|
1051
|
+
success: "#15803D",
|
|
1052
|
+
surface: "#FFFFFF",
|
|
545
1053
|
background: "#F0F9FF",
|
|
546
1054
|
text: "#0C4A6E",
|
|
547
|
-
textMuted: "#
|
|
548
|
-
textDisabled: "#
|
|
1055
|
+
textMuted: "#4B6B82",
|
|
1056
|
+
textDisabled: "#BAD6E9",
|
|
549
1057
|
border: "#BAE6FD",
|
|
550
|
-
borderFocus: "#
|
|
551
|
-
inputBackground: "#
|
|
1058
|
+
borderFocus: "#0369A1",
|
|
1059
|
+
inputBackground: "#FFFFFF"
|
|
552
1060
|
},
|
|
553
1061
|
typography: {
|
|
554
1062
|
fontFamily: "'Source Sans 3', 'Segoe UI', system-ui, sans-serif",
|
|
@@ -562,22 +1070,22 @@ var clinicalPreset = {
|
|
|
562
1070
|
spacing: { base: 16, sectionGap: 28, fieldGap: 24, inputPaddingX: 12, inputPaddingY: 10 },
|
|
563
1071
|
layout: { maxWidth: "680px", alignment: "left", progressPosition: "top", sectionLayout: "bordered" }
|
|
564
1072
|
};
|
|
565
|
-
var
|
|
1073
|
+
var clinicalDark = {
|
|
566
1074
|
colors: {
|
|
567
1075
|
primary: "#38BDF8",
|
|
568
1076
|
primaryForeground: "#0C1929",
|
|
569
|
-
secondary: "#
|
|
570
|
-
secondaryForeground: "#
|
|
571
|
-
error: "#
|
|
572
|
-
errorForeground: "#
|
|
573
|
-
warning: "#
|
|
574
|
-
success: "#
|
|
1077
|
+
secondary: "#0C3554",
|
|
1078
|
+
secondaryForeground: "#BAE6FD",
|
|
1079
|
+
error: "#FCA5A5",
|
|
1080
|
+
errorForeground: "#1C1110",
|
|
1081
|
+
warning: "#FCD34D",
|
|
1082
|
+
success: "#6EE7B7",
|
|
575
1083
|
surface: "#0F2438",
|
|
576
|
-
background: "#
|
|
1084
|
+
background: "#0B1929",
|
|
577
1085
|
text: "#E0F2FE",
|
|
578
|
-
textMuted: "#
|
|
1086
|
+
textMuted: "#7DC4E8",
|
|
579
1087
|
textDisabled: "#1E3A5F",
|
|
580
|
-
border: "#
|
|
1088
|
+
border: "#1C3A5A",
|
|
581
1089
|
borderFocus: "#38BDF8",
|
|
582
1090
|
inputBackground: "#0F2438"
|
|
583
1091
|
},
|
|
@@ -593,86 +1101,210 @@ var clinicalDarkPreset = {
|
|
|
593
1101
|
spacing: { base: 16, sectionGap: 28, fieldGap: 24, inputPaddingX: 12, inputPaddingY: 10 },
|
|
594
1102
|
layout: { maxWidth: "680px", alignment: "left", progressPosition: "top", sectionLayout: "bordered" }
|
|
595
1103
|
};
|
|
596
|
-
var
|
|
1104
|
+
var notionLight = {
|
|
597
1105
|
colors: {
|
|
598
|
-
primary: "#
|
|
599
|
-
primaryForeground: "#
|
|
600
|
-
secondary: "#
|
|
601
|
-
secondaryForeground: "#
|
|
602
|
-
error: "#
|
|
603
|
-
errorForeground: "#
|
|
604
|
-
warning: "#
|
|
605
|
-
success: "#
|
|
606
|
-
surface: "#
|
|
607
|
-
background: "#
|
|
608
|
-
text: "#
|
|
1106
|
+
primary: "#2383E2",
|
|
1107
|
+
primaryForeground: "#FFFFFF",
|
|
1108
|
+
secondary: "#EBF5FB",
|
|
1109
|
+
secondaryForeground: "#1B4F7B",
|
|
1110
|
+
error: "#EB5757",
|
|
1111
|
+
errorForeground: "#FFFFFF",
|
|
1112
|
+
warning: "#CB912F",
|
|
1113
|
+
success: "#0F7B6C",
|
|
1114
|
+
surface: "#FFFFFF",
|
|
1115
|
+
background: "#FFFFFF",
|
|
1116
|
+
text: "#37352F",
|
|
1117
|
+
textMuted: "#787774",
|
|
1118
|
+
textDisabled: "#C3C2BF",
|
|
1119
|
+
border: "#E3E2E0",
|
|
1120
|
+
borderFocus: "#2383E2",
|
|
1121
|
+
inputBackground: "#F7F6F3"
|
|
1122
|
+
},
|
|
1123
|
+
typography: {
|
|
1124
|
+
fontFamily: "'Lyon Text', Georgia, 'Times New Roman', serif",
|
|
1125
|
+
scale: "comfortable",
|
|
1126
|
+
questionSize: "1.0625rem",
|
|
1127
|
+
labelSize: "0.875rem",
|
|
1128
|
+
helpTextSize: "0.8125rem",
|
|
1129
|
+
bodySize: "1rem"
|
|
1130
|
+
},
|
|
1131
|
+
shape: { radius: "sm", inputRadius: "4px", buttonRadius: "4px", cardRadius: "4px" },
|
|
1132
|
+
spacing: { base: 16, sectionGap: 32, fieldGap: 24, inputPaddingX: 12, inputPaddingY: 10 },
|
|
1133
|
+
layout: { maxWidth: "680px", alignment: "left", progressPosition: "top", sectionLayout: "flat" }
|
|
1134
|
+
};
|
|
1135
|
+
var notionDark = {
|
|
1136
|
+
colors: {
|
|
1137
|
+
primary: "#529CCA",
|
|
1138
|
+
primaryForeground: "#FFFFFF",
|
|
1139
|
+
secondary: "#143046",
|
|
1140
|
+
secondaryForeground: "#9ECBEB",
|
|
1141
|
+
error: "#FF6B6B",
|
|
1142
|
+
errorForeground: "#1C1210",
|
|
1143
|
+
warning: "#E0AD50",
|
|
1144
|
+
success: "#4DAB9A",
|
|
1145
|
+
surface: "#2F3437",
|
|
1146
|
+
background: "#191919",
|
|
1147
|
+
text: "#E6E3DD",
|
|
1148
|
+
textMuted: "#9B9A97",
|
|
1149
|
+
textDisabled: "#4F4F4F",
|
|
1150
|
+
border: "#434343",
|
|
1151
|
+
borderFocus: "#529CCA",
|
|
1152
|
+
inputBackground: "#2F3437"
|
|
1153
|
+
},
|
|
1154
|
+
typography: {
|
|
1155
|
+
fontFamily: "'Lyon Text', Georgia, 'Times New Roman', serif",
|
|
1156
|
+
scale: "comfortable",
|
|
1157
|
+
questionSize: "1.0625rem",
|
|
1158
|
+
labelSize: "0.875rem",
|
|
1159
|
+
helpTextSize: "0.8125rem",
|
|
1160
|
+
bodySize: "1rem"
|
|
1161
|
+
},
|
|
1162
|
+
shape: { radius: "sm", inputRadius: "4px", buttonRadius: "4px", cardRadius: "4px" },
|
|
1163
|
+
spacing: { base: 16, sectionGap: 32, fieldGap: 24, inputPaddingX: 12, inputPaddingY: 10 },
|
|
1164
|
+
layout: { maxWidth: "680px", alignment: "left", progressPosition: "top", sectionLayout: "flat" }
|
|
1165
|
+
};
|
|
1166
|
+
var sunsetLight = {
|
|
1167
|
+
colors: {
|
|
1168
|
+
primary: "#C2410C",
|
|
1169
|
+
primaryForeground: "#FFFFFF",
|
|
1170
|
+
secondary: "#FFF7ED",
|
|
1171
|
+
secondaryForeground: "#7C2D12",
|
|
1172
|
+
error: "#B91C1C",
|
|
1173
|
+
errorForeground: "#FFFFFF",
|
|
1174
|
+
warning: "#A16207",
|
|
1175
|
+
success: "#15803D",
|
|
1176
|
+
surface: "#FFFFFF",
|
|
1177
|
+
background: "#FFFBF5",
|
|
1178
|
+
text: "#292524",
|
|
609
1179
|
textMuted: "#78716C",
|
|
610
1180
|
textDisabled: "#D6D3D1",
|
|
611
|
-
border: "#
|
|
612
|
-
borderFocus: "#
|
|
613
|
-
inputBackground: "#
|
|
1181
|
+
border: "#E7E5E4",
|
|
1182
|
+
borderFocus: "#C2410C",
|
|
1183
|
+
inputBackground: "#FFFFFF"
|
|
614
1184
|
},
|
|
615
1185
|
typography: {
|
|
616
|
-
fontFamily: "'
|
|
617
|
-
scale: "
|
|
618
|
-
questionSize: "1.
|
|
619
|
-
labelSize: "0.
|
|
620
|
-
helpTextSize: "0.
|
|
621
|
-
bodySize: "
|
|
1186
|
+
fontFamily: "'DM Sans', Inter, system-ui, sans-serif",
|
|
1187
|
+
scale: "comfortable",
|
|
1188
|
+
questionSize: "1.125rem",
|
|
1189
|
+
labelSize: "0.875rem",
|
|
1190
|
+
helpTextSize: "0.8125rem",
|
|
1191
|
+
bodySize: "0.9375rem"
|
|
622
1192
|
},
|
|
623
|
-
shape: { radius: "
|
|
624
|
-
spacing: { base:
|
|
625
|
-
layout: { maxWidth: "
|
|
1193
|
+
shape: { radius: "lg", inputRadius: "10px", buttonRadius: "10px", cardRadius: "14px" },
|
|
1194
|
+
spacing: { base: 16, sectionGap: 36, fieldGap: 26, inputPaddingX: 14, inputPaddingY: 11 },
|
|
1195
|
+
layout: { maxWidth: "640px", alignment: "center", progressPosition: "top", sectionLayout: "card" }
|
|
626
1196
|
};
|
|
627
|
-
var
|
|
1197
|
+
var sunsetDark = {
|
|
628
1198
|
colors: {
|
|
629
|
-
primary: "#
|
|
630
|
-
primaryForeground: "#
|
|
631
|
-
secondary: "#
|
|
632
|
-
secondaryForeground: "#
|
|
1199
|
+
primary: "#FB923C",
|
|
1200
|
+
primaryForeground: "#1C1210",
|
|
1201
|
+
secondary: "#3D1F0E",
|
|
1202
|
+
secondaryForeground: "#FED7AA",
|
|
633
1203
|
error: "#FCA5A5",
|
|
634
|
-
errorForeground: "#
|
|
1204
|
+
errorForeground: "#1C1210",
|
|
635
1205
|
warning: "#FCD34D",
|
|
636
1206
|
success: "#6EE7B7",
|
|
637
|
-
surface: "#
|
|
638
|
-
background: "#
|
|
639
|
-
text: "#
|
|
640
|
-
textMuted: "#
|
|
641
|
-
textDisabled: "#
|
|
642
|
-
border: "#
|
|
643
|
-
borderFocus: "#
|
|
644
|
-
inputBackground: "#
|
|
1207
|
+
surface: "#292019",
|
|
1208
|
+
background: "#1C1510",
|
|
1209
|
+
text: "#F5F0EB",
|
|
1210
|
+
textMuted: "#B0A89E",
|
|
1211
|
+
textDisabled: "#4A413A",
|
|
1212
|
+
border: "#3D352D",
|
|
1213
|
+
borderFocus: "#FB923C",
|
|
1214
|
+
inputBackground: "#292019"
|
|
1215
|
+
},
|
|
1216
|
+
typography: {
|
|
1217
|
+
fontFamily: "'DM Sans', Inter, system-ui, sans-serif",
|
|
1218
|
+
scale: "comfortable",
|
|
1219
|
+
questionSize: "1.125rem",
|
|
1220
|
+
labelSize: "0.875rem",
|
|
1221
|
+
helpTextSize: "0.8125rem",
|
|
1222
|
+
bodySize: "0.9375rem"
|
|
1223
|
+
},
|
|
1224
|
+
shape: { radius: "lg", inputRadius: "10px", buttonRadius: "10px", cardRadius: "14px" },
|
|
1225
|
+
spacing: { base: 16, sectionGap: 36, fieldGap: 26, inputPaddingX: 14, inputPaddingY: 11 },
|
|
1226
|
+
layout: { maxWidth: "640px", alignment: "center", progressPosition: "top", sectionLayout: "card" }
|
|
1227
|
+
};
|
|
1228
|
+
var roseLight = {
|
|
1229
|
+
colors: {
|
|
1230
|
+
primary: "#BE185D",
|
|
1231
|
+
primaryForeground: "#FFFFFF",
|
|
1232
|
+
secondary: "#FFF1F2",
|
|
1233
|
+
secondaryForeground: "#881337",
|
|
1234
|
+
error: "#DC2626",
|
|
1235
|
+
errorForeground: "#FFFFFF",
|
|
1236
|
+
warning: "#D97706",
|
|
1237
|
+
success: "#059669",
|
|
1238
|
+
surface: "#FFFFFF",
|
|
1239
|
+
background: "#FFFBFB",
|
|
1240
|
+
text: "#1C1917",
|
|
1241
|
+
textMuted: "#737373",
|
|
1242
|
+
textDisabled: "#D4D4D4",
|
|
1243
|
+
border: "#FECDD3",
|
|
1244
|
+
borderFocus: "#BE185D",
|
|
1245
|
+
inputBackground: "#FFFFFF"
|
|
645
1246
|
},
|
|
646
1247
|
typography: {
|
|
647
|
-
fontFamily: "'
|
|
1248
|
+
fontFamily: "'Plus Jakarta Sans', Inter, system-ui, sans-serif",
|
|
648
1249
|
scale: "spacious",
|
|
649
|
-
questionSize: "1.
|
|
650
|
-
labelSize: "0.
|
|
651
|
-
helpTextSize: "0.
|
|
652
|
-
bodySize: "
|
|
1250
|
+
questionSize: "1.1875rem",
|
|
1251
|
+
labelSize: "0.875rem",
|
|
1252
|
+
helpTextSize: "0.8125rem",
|
|
1253
|
+
bodySize: "0.9375rem"
|
|
653
1254
|
},
|
|
654
|
-
shape: { radius: "
|
|
655
|
-
spacing: { base: 18, sectionGap: 36, fieldGap: 28, inputPaddingX:
|
|
656
|
-
layout: { maxWidth: "
|
|
1255
|
+
shape: { radius: "lg", inputRadius: "12px", buttonRadius: "12px", cardRadius: "16px" },
|
|
1256
|
+
spacing: { base: 18, sectionGap: 36, fieldGap: 28, inputPaddingX: 16, inputPaddingY: 12 },
|
|
1257
|
+
layout: { maxWidth: "640px", alignment: "center", progressPosition: "top", sectionLayout: "card" }
|
|
657
1258
|
};
|
|
658
|
-
var
|
|
1259
|
+
var roseDark = {
|
|
659
1260
|
colors: {
|
|
660
|
-
primary: "#
|
|
661
|
-
primaryForeground: "#
|
|
662
|
-
secondary: "#
|
|
663
|
-
secondaryForeground: "#
|
|
1261
|
+
primary: "#FB7185",
|
|
1262
|
+
primaryForeground: "#1C0A12",
|
|
1263
|
+
secondary: "#3B0A22",
|
|
1264
|
+
secondaryForeground: "#FECDD3",
|
|
1265
|
+
error: "#F87171",
|
|
1266
|
+
errorForeground: "#1C1210",
|
|
1267
|
+
warning: "#FBBF24",
|
|
1268
|
+
success: "#34D399",
|
|
1269
|
+
surface: "#1F1318",
|
|
1270
|
+
background: "#150D11",
|
|
1271
|
+
text: "#FAF0F2",
|
|
1272
|
+
textMuted: "#C9A4AE",
|
|
1273
|
+
textDisabled: "#4A3039",
|
|
1274
|
+
border: "#3D2030",
|
|
1275
|
+
borderFocus: "#FB7185",
|
|
1276
|
+
inputBackground: "#1F1318"
|
|
1277
|
+
},
|
|
1278
|
+
typography: {
|
|
1279
|
+
fontFamily: "'Plus Jakarta Sans', Inter, system-ui, sans-serif",
|
|
1280
|
+
scale: "spacious",
|
|
1281
|
+
questionSize: "1.1875rem",
|
|
1282
|
+
labelSize: "0.875rem",
|
|
1283
|
+
helpTextSize: "0.8125rem",
|
|
1284
|
+
bodySize: "0.9375rem"
|
|
1285
|
+
},
|
|
1286
|
+
shape: { radius: "lg", inputRadius: "12px", buttonRadius: "12px", cardRadius: "16px" },
|
|
1287
|
+
spacing: { base: 18, sectionGap: 36, fieldGap: 28, inputPaddingX: 16, inputPaddingY: 12 },
|
|
1288
|
+
layout: { maxWidth: "640px", alignment: "center", progressPosition: "top", sectionLayout: "card" }
|
|
1289
|
+
};
|
|
1290
|
+
var highContrastLight = {
|
|
1291
|
+
colors: {
|
|
1292
|
+
primary: "#0000CC",
|
|
1293
|
+
primaryForeground: "#FFFFFF",
|
|
1294
|
+
secondary: "#E6E6FF",
|
|
1295
|
+
secondaryForeground: "#000066",
|
|
664
1296
|
error: "#B91C1C",
|
|
665
|
-
errorForeground: "#
|
|
666
|
-
warning: "#
|
|
1297
|
+
errorForeground: "#FFFFFF",
|
|
1298
|
+
warning: "#854D0E",
|
|
667
1299
|
success: "#166534",
|
|
668
|
-
surface: "#
|
|
669
|
-
background: "#
|
|
1300
|
+
surface: "#FFFFFF",
|
|
1301
|
+
background: "#FFFFFF",
|
|
670
1302
|
text: "#000000",
|
|
671
|
-
textMuted: "#
|
|
672
|
-
textDisabled: "#
|
|
1303
|
+
textMuted: "#333333",
|
|
1304
|
+
textDisabled: "#888888",
|
|
673
1305
|
border: "#000000",
|
|
674
|
-
borderFocus: "#
|
|
675
|
-
inputBackground: "#
|
|
1306
|
+
borderFocus: "#0000CC",
|
|
1307
|
+
inputBackground: "#FFFFFF"
|
|
676
1308
|
},
|
|
677
1309
|
typography: {
|
|
678
1310
|
fontFamily: "Arial, Helvetica, sans-serif",
|
|
@@ -686,24 +1318,24 @@ var highContrastPreset = {
|
|
|
686
1318
|
spacing: { base: 20, sectionGap: 40, fieldGap: 32, inputPaddingX: 14, inputPaddingY: 12 },
|
|
687
1319
|
layout: { maxWidth: "720px", alignment: "left", progressPosition: "top", sectionLayout: "bordered" }
|
|
688
1320
|
};
|
|
689
|
-
var
|
|
1321
|
+
var highContrastDark = {
|
|
690
1322
|
colors: {
|
|
691
|
-
primary: "#
|
|
1323
|
+
primary: "#6CB4FF",
|
|
692
1324
|
primaryForeground: "#000000",
|
|
693
|
-
secondary: "#
|
|
694
|
-
secondaryForeground: "#
|
|
695
|
-
error: "#
|
|
1325
|
+
secondary: "#002255",
|
|
1326
|
+
secondaryForeground: "#99CCFF",
|
|
1327
|
+
error: "#FF8A8A",
|
|
696
1328
|
errorForeground: "#000000",
|
|
697
|
-
warning: "#
|
|
698
|
-
success: "#
|
|
699
|
-
surface: "#
|
|
1329
|
+
warning: "#FFD54F",
|
|
1330
|
+
success: "#69F0AE",
|
|
1331
|
+
surface: "#0A0A0A",
|
|
700
1332
|
background: "#000000",
|
|
701
1333
|
text: "#FFFFFF",
|
|
702
|
-
textMuted: "#
|
|
703
|
-
textDisabled: "#
|
|
1334
|
+
textMuted: "#CCCCCC",
|
|
1335
|
+
textDisabled: "#666666",
|
|
704
1336
|
border: "#FFFFFF",
|
|
705
|
-
borderFocus: "#
|
|
706
|
-
inputBackground: "#
|
|
1337
|
+
borderFocus: "#6CB4FF",
|
|
1338
|
+
inputBackground: "#0A0A0A"
|
|
707
1339
|
},
|
|
708
1340
|
typography: {
|
|
709
1341
|
fontFamily: "Arial, Helvetica, sans-serif",
|
|
@@ -718,11 +1350,18 @@ var highContrastDarkPreset = {
|
|
|
718
1350
|
layout: { maxWidth: "720px", alignment: "left", progressPosition: "top", sectionLayout: "bordered" }
|
|
719
1351
|
};
|
|
720
1352
|
var PRESET_FAMILIES = {
|
|
721
|
-
clean: { light:
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
1353
|
+
clean: { light: cleanLight, dark: cleanDark, label: "Clean" },
|
|
1354
|
+
stripe: { light: stripeLight, dark: stripeDark, label: "Stripe" },
|
|
1355
|
+
github: { light: githubLight, dark: githubDark, label: "GitHub" },
|
|
1356
|
+
vercel: { light: vercelLight, dark: vercelDark, label: "Vercel" },
|
|
1357
|
+
shopify: { light: shopifyLight, dark: shopifyDark, label: "Shopify" },
|
|
1358
|
+
slack: { light: slackLight, dark: slackDark, label: "Slack" },
|
|
1359
|
+
tailwind: { light: tailwindLight, dark: tailwindDark, label: "Tailwind" },
|
|
1360
|
+
clinical: { light: clinicalLight, dark: clinicalDark, label: "Clinical" },
|
|
1361
|
+
notion: { light: notionLight, dark: notionDark, label: "Notion" },
|
|
1362
|
+
sunset: { light: sunsetLight, dark: sunsetDark, label: "Sunset" },
|
|
1363
|
+
rose: { light: roseLight, dark: roseDark, label: "Rose" },
|
|
1364
|
+
"high-contrast": { light: highContrastLight, dark: highContrastDark, label: "High contrast" }
|
|
726
1365
|
};
|
|
727
1366
|
var COMPARISON_PRESETS = Object.fromEntries(
|
|
728
1367
|
Object.entries(PRESET_FAMILIES).map(([key, family]) => [
|
|
@@ -839,6 +1478,12 @@ function resolveThemeFromDOM() {
|
|
|
839
1478
|
const val = styles.getPropertyValue(prop).trim();
|
|
840
1479
|
return val || void 0;
|
|
841
1480
|
};
|
|
1481
|
+
const getNumber = (prop) => {
|
|
1482
|
+
const val = get(prop);
|
|
1483
|
+
if (val == null) return void 0;
|
|
1484
|
+
const num = parseFloat(val);
|
|
1485
|
+
return isNaN(num) ? void 0 : num;
|
|
1486
|
+
};
|
|
842
1487
|
return {
|
|
843
1488
|
colors: {
|
|
844
1489
|
primary: get("--primary"),
|
|
@@ -871,6 +1516,17 @@ function resolveThemeFromDOM() {
|
|
|
871
1516
|
inputRadius: get("--fc-radius-input"),
|
|
872
1517
|
buttonRadius: get("--fc-radius-button"),
|
|
873
1518
|
cardRadius: get("--fc-radius-card")
|
|
1519
|
+
},
|
|
1520
|
+
spacing: {
|
|
1521
|
+
base: getNumber("--fc-spacing-base"),
|
|
1522
|
+
sectionGap: getNumber("--fc-section-gap"),
|
|
1523
|
+
fieldGap: getNumber("--fc-field-gap"),
|
|
1524
|
+
inputPaddingX: getNumber("--fc-input-padding-x"),
|
|
1525
|
+
inputPaddingY: getNumber("--fc-input-padding-y")
|
|
1526
|
+
},
|
|
1527
|
+
layout: {
|
|
1528
|
+
maxWidth: get("--fc-max-width")
|
|
1529
|
+
// alignment, progressPosition, sectionLayout are enums — not resolvable from CSS
|
|
874
1530
|
}
|
|
875
1531
|
};
|
|
876
1532
|
}
|
|
@@ -900,13 +1556,34 @@ function ThemeEditorThemeProvider({ theme, children }) {
|
|
|
900
1556
|
}
|
|
901
1557
|
function isDarkTheme(theme) {
|
|
902
1558
|
const bg = theme.colors?.background ?? "#FFFFFF";
|
|
903
|
-
|
|
1559
|
+
let hex = bg.replace("#", "");
|
|
1560
|
+
if (hex.length === 3) {
|
|
1561
|
+
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
|
|
1562
|
+
}
|
|
904
1563
|
if (hex.length < 6) return false;
|
|
905
1564
|
const r = parseInt(hex.slice(0, 2), 16);
|
|
906
1565
|
const g = parseInt(hex.slice(2, 4), 16);
|
|
907
1566
|
const b = parseInt(hex.slice(4, 6), 16);
|
|
908
1567
|
return 0.299 * r + 0.587 * g + 0.114 * b < 128;
|
|
909
1568
|
}
|
|
1569
|
+
function detectPresetFamily(theme) {
|
|
1570
|
+
const c = theme.colors;
|
|
1571
|
+
if (!c) return null;
|
|
1572
|
+
for (const [key, family] of Object.entries(PRESET_FAMILIES)) {
|
|
1573
|
+
for (const variant of ["light", "dark"]) {
|
|
1574
|
+
const preset = family[variant];
|
|
1575
|
+
const pc = preset.colors;
|
|
1576
|
+
if (!pc) continue;
|
|
1577
|
+
if (c.primary?.toLowerCase() === pc.primary?.toLowerCase() && c.background?.toLowerCase() === pc.background?.toLowerCase() && c.surface?.toLowerCase() === pc.surface?.toLowerCase()) {
|
|
1578
|
+
return key;
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
return null;
|
|
1583
|
+
}
|
|
1584
|
+
function isValidHex(value) {
|
|
1585
|
+
return /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(value);
|
|
1586
|
+
}
|
|
910
1587
|
var SECTIONS = [
|
|
911
1588
|
{
|
|
912
1589
|
id: "colors",
|
|
@@ -1027,6 +1704,7 @@ var SECTIONS = [
|
|
|
1027
1704
|
];
|
|
1028
1705
|
function ThemeEditorInner({
|
|
1029
1706
|
initialTheme,
|
|
1707
|
+
initialPreset,
|
|
1030
1708
|
onChange,
|
|
1031
1709
|
onSave,
|
|
1032
1710
|
theme: chromeTheme,
|
|
@@ -1038,39 +1716,82 @@ function ThemeEditorInner({
|
|
|
1038
1716
|
}) {
|
|
1039
1717
|
const resolvedInitial = useMemo(
|
|
1040
1718
|
() => initialTheme ?? resolveThemeFromDOM(),
|
|
1041
|
-
|
|
1042
|
-
[]
|
|
1719
|
+
[initialTheme]
|
|
1043
1720
|
);
|
|
1044
1721
|
const [theme, setTheme] = useState(resolvedInitial);
|
|
1045
1722
|
const [activeSection, setActiveSection] = useState("colors");
|
|
1046
|
-
const
|
|
1723
|
+
const resolvedPresetInit = initialPreset ?? detectPresetFamily(resolvedInitial) ?? "custom";
|
|
1724
|
+
const [presetKey, setPresetKey] = useState(resolvedPresetInit);
|
|
1725
|
+
const presetKeyRef = useRef(presetKey);
|
|
1726
|
+
presetKeyRef.current = presetKey;
|
|
1047
1727
|
const [showPalette, setShowPalette] = useState(false);
|
|
1048
1728
|
const [showComparison, setShowComparison] = useState(false);
|
|
1049
1729
|
const themeRef = useRef(theme);
|
|
1050
1730
|
themeRef.current = theme;
|
|
1051
|
-
const
|
|
1731
|
+
const prevInitialRef = useRef(initialTheme);
|
|
1732
|
+
const prevPresetRef = useRef(initialPreset);
|
|
1733
|
+
useEffect(() => {
|
|
1734
|
+
if (!initialTheme) return;
|
|
1735
|
+
const themeChanged = JSON.stringify(initialTheme) !== JSON.stringify(prevInitialRef.current);
|
|
1736
|
+
const presetChanged = initialPreset !== prevPresetRef.current;
|
|
1737
|
+
if (!themeChanged && !presetChanged) return;
|
|
1738
|
+
prevInitialRef.current = initialTheme;
|
|
1739
|
+
prevPresetRef.current = initialPreset;
|
|
1740
|
+
setTheme(initialTheme);
|
|
1741
|
+
const resolvedPreset = initialPreset ?? detectPresetFamily(initialTheme) ?? "custom";
|
|
1742
|
+
setPresetKey(resolvedPreset);
|
|
1743
|
+
}, [initialTheme, initialPreset]);
|
|
1744
|
+
const mountReadyRef = useRef(false);
|
|
1052
1745
|
useEffect(() => {
|
|
1053
|
-
if (hasInitialTheme.current) return;
|
|
1054
1746
|
if (typeof window === "undefined") return;
|
|
1747
|
+
const initialAttr = document.documentElement.getAttribute("data-theme");
|
|
1748
|
+
const lastAttrRef = { current: initialAttr };
|
|
1749
|
+
const readyTimer = setTimeout(() => {
|
|
1750
|
+
mountReadyRef.current = true;
|
|
1751
|
+
}, 500);
|
|
1055
1752
|
const observer = new MutationObserver(() => {
|
|
1753
|
+
if (!mountReadyRef.current) return;
|
|
1754
|
+
const currentAttr = document.documentElement.getAttribute("data-theme");
|
|
1755
|
+
if (currentAttr === lastAttrRef.current) return;
|
|
1756
|
+
lastAttrRef.current = currentAttr;
|
|
1056
1757
|
requestAnimationFrame(() => {
|
|
1057
|
-
const
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1758
|
+
const variant = currentAttr === "dark" ? "dark" : "light";
|
|
1759
|
+
let key = presetKeyRef.current;
|
|
1760
|
+
if (key === "custom") {
|
|
1761
|
+
const detected = detectPresetFamily(themeRef.current);
|
|
1762
|
+
if (detected) {
|
|
1763
|
+
key = detected;
|
|
1764
|
+
setPresetKey(detected);
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
if (key !== "custom") {
|
|
1768
|
+
const family = PRESET_FAMILIES[key];
|
|
1769
|
+
if (family) {
|
|
1770
|
+
const preset = family[variant];
|
|
1771
|
+
setTheme(preset);
|
|
1772
|
+
onChange?.(preset, key);
|
|
1773
|
+
}
|
|
1774
|
+
} else {
|
|
1775
|
+
const resolved = resolveThemeFromDOM();
|
|
1776
|
+
setTheme(resolved);
|
|
1777
|
+
onChange?.(resolved, "custom");
|
|
1778
|
+
}
|
|
1061
1779
|
});
|
|
1062
1780
|
});
|
|
1063
1781
|
observer.observe(document.documentElement, {
|
|
1064
1782
|
attributes: true,
|
|
1065
1783
|
attributeFilter: ["data-theme", "class"]
|
|
1066
1784
|
});
|
|
1067
|
-
return () =>
|
|
1785
|
+
return () => {
|
|
1786
|
+
clearTimeout(readyTimer);
|
|
1787
|
+
observer.disconnect();
|
|
1788
|
+
};
|
|
1068
1789
|
}, [onChange]);
|
|
1069
1790
|
useEffect(() => {
|
|
1070
1791
|
function handleKeyDown(e) {
|
|
1071
1792
|
if ((e.metaKey || e.ctrlKey) && e.key === "s") {
|
|
1072
1793
|
e.preventDefault();
|
|
1073
|
-
onSave?.(themeRef.current);
|
|
1794
|
+
onSave?.(themeRef.current, presetKeyRef.current);
|
|
1074
1795
|
}
|
|
1075
1796
|
}
|
|
1076
1797
|
window.addEventListener("keydown", handleKeyDown);
|
|
@@ -1083,7 +1804,7 @@ function ThemeEditorInner({
|
|
|
1083
1804
|
...prev,
|
|
1084
1805
|
[section]: { ...prev[section], [key]: value }
|
|
1085
1806
|
};
|
|
1086
|
-
onChange?.(next);
|
|
1807
|
+
onChange?.(next, "custom");
|
|
1087
1808
|
return next;
|
|
1088
1809
|
});
|
|
1089
1810
|
setPresetKey("custom");
|
|
@@ -1094,11 +1815,12 @@ function ThemeEditorInner({
|
|
|
1094
1815
|
(key) => {
|
|
1095
1816
|
const family = PRESET_FAMILIES[key];
|
|
1096
1817
|
if (family) {
|
|
1097
|
-
const
|
|
1818
|
+
const htmlTheme = typeof document !== "undefined" ? document.documentElement.getAttribute("data-theme") : null;
|
|
1819
|
+
const variant = htmlTheme === "dark" ? "dark" : htmlTheme === "light" ? "light" : isDarkTheme(theme) ? "dark" : "light";
|
|
1098
1820
|
const preset = family[variant];
|
|
1099
1821
|
setTheme(preset);
|
|
1100
1822
|
setPresetKey(key);
|
|
1101
|
-
onChange?.(preset);
|
|
1823
|
+
onChange?.(preset, key);
|
|
1102
1824
|
}
|
|
1103
1825
|
},
|
|
1104
1826
|
[onChange, theme]
|
|
@@ -1112,6 +1834,7 @@ function ThemeEditorInner({
|
|
|
1112
1834
|
a.click();
|
|
1113
1835
|
URL.revokeObjectURL(url);
|
|
1114
1836
|
}, [theme]);
|
|
1837
|
+
const [importError, setImportError] = useState(null);
|
|
1115
1838
|
const importJson = useCallback(() => {
|
|
1116
1839
|
const input = document.createElement("input");
|
|
1117
1840
|
input.type = "file";
|
|
@@ -1123,10 +1846,16 @@ function ThemeEditorInner({
|
|
|
1123
1846
|
reader.onload = () => {
|
|
1124
1847
|
try {
|
|
1125
1848
|
const parsed = JSON.parse(reader.result);
|
|
1849
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed) || !("colors" in parsed || "typography" in parsed || "shape" in parsed || "spacing" in parsed || "layout" in parsed)) {
|
|
1850
|
+
setImportError("Invalid theme file: expected an object with colors, typography, shape, spacing, or layout.");
|
|
1851
|
+
return;
|
|
1852
|
+
}
|
|
1853
|
+
setImportError(null);
|
|
1126
1854
|
setTheme(parsed);
|
|
1127
1855
|
setPresetKey("custom");
|
|
1128
|
-
onChange?.(parsed);
|
|
1856
|
+
onChange?.(parsed, "custom");
|
|
1129
1857
|
} catch {
|
|
1858
|
+
setImportError("Failed to parse JSON file. Please check the file format.");
|
|
1130
1859
|
}
|
|
1131
1860
|
};
|
|
1132
1861
|
reader.readAsText(file);
|
|
@@ -1140,7 +1869,7 @@ function ThemeEditorInner({
|
|
|
1140
1869
|
importCssFile(theme, (merged) => {
|
|
1141
1870
|
setTheme(merged);
|
|
1142
1871
|
setPresetKey("custom");
|
|
1143
|
-
onChange?.(merged);
|
|
1872
|
+
onChange?.(merged, "custom");
|
|
1144
1873
|
});
|
|
1145
1874
|
}, [theme, onChange]);
|
|
1146
1875
|
const currentSection = useMemo(
|
|
@@ -1201,9 +1930,13 @@ function ThemeEditorInner({
|
|
|
1201
1930
|
children: "Compare"
|
|
1202
1931
|
}
|
|
1203
1932
|
),
|
|
1204
|
-
onSave && /* @__PURE__ */ jsx("button", { onClick: () => onSave(theme), className: "fcte-btn fcte-btn--primary", children: "Save" })
|
|
1933
|
+
onSave && /* @__PURE__ */ jsx("button", { onClick: () => onSave(theme, presetKey), className: "fcte-btn fcte-btn--primary", children: "Save" })
|
|
1205
1934
|
] })
|
|
1206
1935
|
] }),
|
|
1936
|
+
importError && /* @__PURE__ */ jsxs("div", { className: "fcte-import-error", role: "alert", children: [
|
|
1937
|
+
/* @__PURE__ */ jsx("span", { children: importError }),
|
|
1938
|
+
/* @__PURE__ */ jsx("button", { onClick: () => setImportError(null), className: "fcte-import-error__close", children: "\xD7" })
|
|
1939
|
+
] }),
|
|
1207
1940
|
showPalette && /* @__PURE__ */ jsx(
|
|
1208
1941
|
PaletteGenerator,
|
|
1209
1942
|
{
|
|
@@ -1211,7 +1944,7 @@ function ThemeEditorInner({
|
|
|
1211
1944
|
onApply: (newTheme) => {
|
|
1212
1945
|
setTheme(newTheme);
|
|
1213
1946
|
setPresetKey("custom");
|
|
1214
|
-
onChange?.(newTheme);
|
|
1947
|
+
onChange?.(newTheme, "custom");
|
|
1215
1948
|
setShowPalette(false);
|
|
1216
1949
|
},
|
|
1217
1950
|
onClose: () => setShowPalette(false)
|
|
@@ -1237,6 +1970,8 @@ function ThemeEditorInner({
|
|
|
1237
1970
|
/* @__PURE__ */ jsx("div", { className: "fcte-fields", children: currentSection.fields.map((field) => {
|
|
1238
1971
|
const val = sectionValues[field.key];
|
|
1239
1972
|
if (field.kind === "color") {
|
|
1973
|
+
const colorVal = typeof val === "string" ? val : "#000000";
|
|
1974
|
+
const isInvalid = colorVal.length > 0 && !isValidHex(colorVal);
|
|
1240
1975
|
return /* @__PURE__ */ jsxs("div", { className: "fcte-field", children: [
|
|
1241
1976
|
/* @__PURE__ */ jsx("label", { className: "fcte-field__label", children: field.label }),
|
|
1242
1977
|
/* @__PURE__ */ jsxs("div", { className: "fcte-field__color-row", children: [
|
|
@@ -1244,7 +1979,7 @@ function ThemeEditorInner({
|
|
|
1244
1979
|
"input",
|
|
1245
1980
|
{
|
|
1246
1981
|
type: "color",
|
|
1247
|
-
value:
|
|
1982
|
+
value: isValidHex(colorVal) ? colorVal : "#000000",
|
|
1248
1983
|
onChange: (e) => updateField(currentSection.themeKey, field.key, e.target.value),
|
|
1249
1984
|
className: "fcte-field__swatch"
|
|
1250
1985
|
}
|
|
@@ -1253,10 +1988,24 @@ function ThemeEditorInner({
|
|
|
1253
1988
|
"input",
|
|
1254
1989
|
{
|
|
1255
1990
|
type: "text",
|
|
1256
|
-
value:
|
|
1257
|
-
onChange: (e) =>
|
|
1258
|
-
|
|
1259
|
-
|
|
1991
|
+
value: colorVal,
|
|
1992
|
+
onChange: (e) => {
|
|
1993
|
+
const v = e.target.value;
|
|
1994
|
+
if (isValidHex(v)) {
|
|
1995
|
+
updateField(currentSection.themeKey, field.key, v);
|
|
1996
|
+
} else {
|
|
1997
|
+
setTheme((prev) => ({
|
|
1998
|
+
...prev,
|
|
1999
|
+
[currentSection.themeKey]: {
|
|
2000
|
+
...prev[currentSection.themeKey],
|
|
2001
|
+
[field.key]: v
|
|
2002
|
+
}
|
|
2003
|
+
}));
|
|
2004
|
+
}
|
|
2005
|
+
},
|
|
2006
|
+
className: `fcte-field__text${isInvalid ? " fcte-field__text--invalid" : ""}`,
|
|
2007
|
+
spellCheck: false,
|
|
2008
|
+
placeholder: "#RRGGBB"
|
|
1260
2009
|
}
|
|
1261
2010
|
)
|
|
1262
2011
|
] })
|
|
@@ -1285,9 +2034,16 @@ function ThemeEditorInner({
|
|
|
1285
2034
|
{
|
|
1286
2035
|
type: "number",
|
|
1287
2036
|
value: typeof val === "number" ? val : 0,
|
|
1288
|
-
onChange: (e) =>
|
|
2037
|
+
onChange: (e) => {
|
|
2038
|
+
let n = Math.round(Number(e.target.value));
|
|
2039
|
+
if (isNaN(n)) n = 0;
|
|
2040
|
+
if (field.min != null) n = Math.max(field.min, n);
|
|
2041
|
+
if (field.max != null) n = Math.min(field.max, n);
|
|
2042
|
+
updateField(currentSection.themeKey, field.key, n);
|
|
2043
|
+
},
|
|
1289
2044
|
min: field.min,
|
|
1290
2045
|
max: field.max,
|
|
2046
|
+
step: 1,
|
|
1291
2047
|
className: "fcte-field__number"
|
|
1292
2048
|
}
|
|
1293
2049
|
),
|
|
@@ -1305,7 +2061,8 @@ function ThemeEditorInner({
|
|
|
1305
2061
|
onChange: (e) => updateField(currentSection.themeKey, field.key, e.target.value),
|
|
1306
2062
|
placeholder: field.placeholder,
|
|
1307
2063
|
className: "fcte-field__text",
|
|
1308
|
-
spellCheck: false
|
|
2064
|
+
spellCheck: false,
|
|
2065
|
+
maxLength: 200
|
|
1309
2066
|
}
|
|
1310
2067
|
)
|
|
1311
2068
|
] }, field.key);
|