@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
|
@@ -309,18 +309,23 @@ var PREVIEW_SCHEMA = {
|
|
|
309
309
|
id: "theme-preview",
|
|
310
310
|
version: "1.0.0",
|
|
311
311
|
title: "Theme Preview",
|
|
312
|
-
description: "See how your theme looks
|
|
312
|
+
description: "See how your theme looks across every field type.",
|
|
313
|
+
settings: {
|
|
314
|
+
displayMode: "classic",
|
|
315
|
+
showProgress: false
|
|
316
|
+
},
|
|
313
317
|
sections: [
|
|
314
318
|
{
|
|
315
|
-
id: "
|
|
316
|
-
title: "
|
|
319
|
+
id: "s-text",
|
|
320
|
+
title: "Text Inputs",
|
|
317
321
|
questions: [
|
|
318
322
|
{
|
|
319
323
|
id: "name",
|
|
320
324
|
type: "short_text",
|
|
321
325
|
label: "Full Name",
|
|
322
326
|
required: true,
|
|
323
|
-
placeholder: "Jane Doe"
|
|
327
|
+
placeholder: "Jane Doe",
|
|
328
|
+
helpText: "Enter your full legal name."
|
|
324
329
|
},
|
|
325
330
|
{
|
|
326
331
|
id: "email",
|
|
@@ -329,6 +334,31 @@ var PREVIEW_SCHEMA = {
|
|
|
329
334
|
required: true,
|
|
330
335
|
placeholder: "jane@example.com"
|
|
331
336
|
},
|
|
337
|
+
{
|
|
338
|
+
id: "phone",
|
|
339
|
+
type: "phone",
|
|
340
|
+
label: "Phone Number",
|
|
341
|
+
placeholder: "(555) 123-4567"
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
id: "website",
|
|
345
|
+
type: "url",
|
|
346
|
+
label: "Website",
|
|
347
|
+
placeholder: "https://example.com"
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
id: "bio",
|
|
351
|
+
type: "long_text",
|
|
352
|
+
label: "Bio / Notes",
|
|
353
|
+
placeholder: "Tell us about yourself...",
|
|
354
|
+
helpText: "Markdown is supported."
|
|
355
|
+
}
|
|
356
|
+
]
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
id: "s-selection",
|
|
360
|
+
title: "Selection Fields",
|
|
361
|
+
questions: [
|
|
332
362
|
{
|
|
333
363
|
id: "department",
|
|
334
364
|
type: "dropdown",
|
|
@@ -336,20 +366,184 @@ var PREVIEW_SCHEMA = {
|
|
|
336
366
|
options: [
|
|
337
367
|
{ label: "Engineering", value: "engineering" },
|
|
338
368
|
{ label: "Design", value: "design" },
|
|
339
|
-
{ label: "Marketing", value: "marketing" }
|
|
369
|
+
{ label: "Marketing", value: "marketing" },
|
|
370
|
+
{ label: "Sales", value: "sales" }
|
|
340
371
|
]
|
|
341
372
|
},
|
|
373
|
+
{
|
|
374
|
+
id: "role",
|
|
375
|
+
type: "single_select",
|
|
376
|
+
label: "Role",
|
|
377
|
+
helpText: "Select one option.",
|
|
378
|
+
options: [
|
|
379
|
+
{ label: "Individual Contributor", value: "ic" },
|
|
380
|
+
{ label: "Team Lead", value: "lead" },
|
|
381
|
+
{ label: "Manager", value: "manager" },
|
|
382
|
+
{ label: "Director", value: "director" }
|
|
383
|
+
],
|
|
384
|
+
config: { type: "single_select", layout: "vertical" }
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
id: "skills",
|
|
388
|
+
type: "multi_select",
|
|
389
|
+
label: "Skills",
|
|
390
|
+
helpText: "Select all that apply.",
|
|
391
|
+
options: [
|
|
392
|
+
{ label: "JavaScript", value: "js" },
|
|
393
|
+
{ label: "TypeScript", value: "ts" },
|
|
394
|
+
{ label: "Python", value: "py" },
|
|
395
|
+
{ label: "Rust", value: "rust" },
|
|
396
|
+
{ label: "Go", value: "go" }
|
|
397
|
+
],
|
|
398
|
+
config: { type: "multi_select", layout: "vertical" }
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
id: "newsletter",
|
|
402
|
+
type: "boolean",
|
|
403
|
+
label: "Subscribe to newsletter?",
|
|
404
|
+
config: { type: "boolean", style: "toggle" }
|
|
405
|
+
}
|
|
406
|
+
]
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
id: "s-numeric",
|
|
410
|
+
title: "Numeric & Rating",
|
|
411
|
+
questions: [
|
|
412
|
+
{
|
|
413
|
+
id: "age",
|
|
414
|
+
type: "number",
|
|
415
|
+
label: "Age",
|
|
416
|
+
placeholder: "25",
|
|
417
|
+
config: { type: "number", min: 0, max: 150 }
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
id: "satisfaction",
|
|
421
|
+
type: "slider",
|
|
422
|
+
label: "Satisfaction Level",
|
|
423
|
+
config: { type: "slider", min: 0, max: 100, step: 5 }
|
|
424
|
+
},
|
|
342
425
|
{
|
|
343
426
|
id: "rating",
|
|
344
427
|
type: "rating",
|
|
345
|
-
label: "
|
|
428
|
+
label: "Overall Rating",
|
|
346
429
|
config: { type: "rating", max: 5 }
|
|
347
430
|
},
|
|
348
431
|
{
|
|
349
|
-
id: "
|
|
350
|
-
type: "
|
|
351
|
-
label: "
|
|
352
|
-
|
|
432
|
+
id: "nps",
|
|
433
|
+
type: "nps",
|
|
434
|
+
label: "How likely are you to recommend us?"
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
id: "opinion",
|
|
438
|
+
type: "opinion_scale",
|
|
439
|
+
label: "How do you feel about the onboarding?",
|
|
440
|
+
config: {
|
|
441
|
+
type: "opinion_scale",
|
|
442
|
+
min: 1,
|
|
443
|
+
max: 5,
|
|
444
|
+
minLabel: "Very Poor",
|
|
445
|
+
maxLabel: "Excellent"
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
]
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
id: "s-datetime",
|
|
452
|
+
title: "Date & Time",
|
|
453
|
+
questions: [
|
|
454
|
+
{
|
|
455
|
+
id: "dob",
|
|
456
|
+
type: "date",
|
|
457
|
+
label: "Date of Birth",
|
|
458
|
+
config: { type: "date", disableFuture: true }
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
id: "preferred_time",
|
|
462
|
+
type: "time",
|
|
463
|
+
label: "Preferred Time",
|
|
464
|
+
config: { type: "time", format: "12h" }
|
|
465
|
+
},
|
|
466
|
+
{
|
|
467
|
+
id: "travel_dates",
|
|
468
|
+
type: "date_range",
|
|
469
|
+
label: "Travel Dates"
|
|
470
|
+
}
|
|
471
|
+
]
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
id: "s-media",
|
|
475
|
+
title: "Media & Files",
|
|
476
|
+
questions: [
|
|
477
|
+
{
|
|
478
|
+
id: "resume",
|
|
479
|
+
type: "file_upload",
|
|
480
|
+
label: "Upload Resume",
|
|
481
|
+
helpText: "PDF or DOCX, max 10 MB.",
|
|
482
|
+
config: { type: "file_upload", maxFiles: 1, maxSizeMb: 10, accept: [".pdf", ".docx"] }
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
id: "signature",
|
|
486
|
+
type: "signature",
|
|
487
|
+
label: "Signature",
|
|
488
|
+
helpText: "Draw your signature below."
|
|
489
|
+
}
|
|
490
|
+
]
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
id: "s-advanced",
|
|
494
|
+
title: "Advanced Fields",
|
|
495
|
+
questions: [
|
|
496
|
+
{
|
|
497
|
+
id: "experience",
|
|
498
|
+
type: "likert",
|
|
499
|
+
label: "Rate the following aspects:",
|
|
500
|
+
config: {
|
|
501
|
+
type: "likert",
|
|
502
|
+
labels: ["Strongly Disagree", "Disagree", "Neutral", "Agree", "Strongly Agree"]
|
|
503
|
+
}
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
id: "country",
|
|
507
|
+
type: "country_select",
|
|
508
|
+
label: "Country",
|
|
509
|
+
config: { type: "country_select", showFlags: true }
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
id: "consent",
|
|
513
|
+
type: "consent",
|
|
514
|
+
label: "Terms & Conditions",
|
|
515
|
+
config: {
|
|
516
|
+
type: "consent",
|
|
517
|
+
text: "I agree to the Terms of Service and Privacy Policy.",
|
|
518
|
+
checkboxLabel: "I agree"
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
]
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
id: "s-content",
|
|
525
|
+
title: "Content & Visual",
|
|
526
|
+
questions: [
|
|
527
|
+
{
|
|
528
|
+
id: "info",
|
|
529
|
+
type: "info_block",
|
|
530
|
+
label: "This is an informational message block. It can be used to display important notices."
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
id: "warning_info",
|
|
534
|
+
type: "info_block",
|
|
535
|
+
label: "Please double-check all information before submitting."
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
id: "divider",
|
|
539
|
+
type: "divider",
|
|
540
|
+
label: ""
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
id: "section_head",
|
|
544
|
+
type: "section_header",
|
|
545
|
+
label: "Section Header Example",
|
|
546
|
+
config: { type: "section_header", level: "h3", showDivider: true }
|
|
353
547
|
}
|
|
354
548
|
]
|
|
355
549
|
}
|
|
@@ -526,16 +720,20 @@ function deepMerge(base, partial) {
|
|
|
526
720
|
|
|
527
721
|
// src/theme-editor/palette-generator.ts
|
|
528
722
|
function generatePalette(baseHex) {
|
|
723
|
+
const cleaned = baseHex.replace("#", "");
|
|
724
|
+
if (!/^[0-9a-fA-F]{3}$|^[0-9a-fA-F]{6}$/.test(cleaned)) {
|
|
725
|
+
return generatePalette("#6B7280");
|
|
726
|
+
}
|
|
529
727
|
const [h, s, l] = hexToHsl(baseHex);
|
|
530
728
|
const secH = (h + 180) % 360;
|
|
531
729
|
const isLightBase = l > 50;
|
|
532
730
|
return {
|
|
533
731
|
// Primary
|
|
534
732
|
primary: hslToHex(h, s, clamp(l, 30, 60)),
|
|
535
|
-
primaryForeground: isLightBase ? "#ffffff" : "#
|
|
733
|
+
primaryForeground: isLightBase ? "#ffffff" : "#000000",
|
|
536
734
|
// Secondary (complementary)
|
|
537
735
|
secondary: hslToHex(secH, Math.max(s - 15, 10), clamp(l, 35, 55)),
|
|
538
|
-
secondaryForeground: "#ffffff",
|
|
736
|
+
secondaryForeground: isLightBase ? "#ffffff" : "#000000",
|
|
539
737
|
// Surfaces
|
|
540
738
|
surface: hslToHex(h, Math.max(s - 35, 3), 97),
|
|
541
739
|
background: "#F4F7F8",
|
|
@@ -708,148 +906,458 @@ function PaletteGenerator({ theme, onApply, onClose }) {
|
|
|
708
906
|
}
|
|
709
907
|
|
|
710
908
|
// src/theme-editor/presets.ts
|
|
711
|
-
var
|
|
909
|
+
var cleanLight = {
|
|
712
910
|
colors: {
|
|
713
|
-
primary: "#
|
|
911
|
+
primary: "#2563EB",
|
|
714
912
|
primaryForeground: "#FFFFFF",
|
|
715
|
-
secondary: "#
|
|
716
|
-
secondaryForeground: "#
|
|
717
|
-
error: "#
|
|
913
|
+
secondary: "#DBEAFE",
|
|
914
|
+
secondaryForeground: "#1E3A5F",
|
|
915
|
+
error: "#DC2626",
|
|
718
916
|
errorForeground: "#FFFFFF",
|
|
719
|
-
warning: "#
|
|
720
|
-
success: "#
|
|
917
|
+
warning: "#D97706",
|
|
918
|
+
success: "#16A34A",
|
|
721
919
|
surface: "#FFFFFF",
|
|
722
|
-
background: "#
|
|
723
|
-
text: "#
|
|
724
|
-
textMuted: "#
|
|
725
|
-
textDisabled: "#
|
|
726
|
-
border: "#
|
|
727
|
-
borderFocus: "#
|
|
920
|
+
background: "#F8FAFC",
|
|
921
|
+
text: "#0F172A",
|
|
922
|
+
textMuted: "#64748B",
|
|
923
|
+
textDisabled: "#CBD5E1",
|
|
924
|
+
border: "#E2E8F0",
|
|
925
|
+
borderFocus: "#2563EB",
|
|
728
926
|
inputBackground: "#FFFFFF"
|
|
729
927
|
},
|
|
730
928
|
typography: {
|
|
731
929
|
fontFamily: "Inter, system-ui, sans-serif",
|
|
732
930
|
scale: "comfortable",
|
|
733
|
-
questionSize: "1.
|
|
931
|
+
questionSize: "1.0625rem",
|
|
734
932
|
labelSize: "0.875rem",
|
|
735
933
|
helpTextSize: "0.8125rem",
|
|
736
934
|
bodySize: "0.9375rem"
|
|
737
935
|
},
|
|
738
|
-
shape: { radius: "
|
|
936
|
+
shape: { radius: "sm", inputRadius: "6px", buttonRadius: "6px", cardRadius: "8px" },
|
|
739
937
|
spacing: { base: 16, sectionGap: 32, fieldGap: 24, inputPaddingX: 12, inputPaddingY: 10 },
|
|
740
|
-
layout: { maxWidth: "640px", alignment: "left", progressPosition: "top", sectionLayout: "
|
|
938
|
+
layout: { maxWidth: "640px", alignment: "left", progressPosition: "top", sectionLayout: "flat" }
|
|
741
939
|
};
|
|
742
|
-
var
|
|
940
|
+
var cleanDark = {
|
|
743
941
|
colors: {
|
|
744
|
-
primary: "#
|
|
745
|
-
primaryForeground: "#
|
|
746
|
-
secondary: "#
|
|
747
|
-
secondaryForeground: "#
|
|
748
|
-
error: "#
|
|
749
|
-
errorForeground: "#
|
|
750
|
-
warning: "#
|
|
751
|
-
success: "#
|
|
752
|
-
surface: "#
|
|
753
|
-
background: "#
|
|
754
|
-
text: "#
|
|
755
|
-
textMuted: "#
|
|
756
|
-
textDisabled: "#
|
|
757
|
-
border: "#
|
|
758
|
-
borderFocus: "#
|
|
759
|
-
inputBackground: "#
|
|
942
|
+
primary: "#60A5FA",
|
|
943
|
+
primaryForeground: "#0C1929",
|
|
944
|
+
secondary: "#1E3A5F",
|
|
945
|
+
secondaryForeground: "#DBEAFE",
|
|
946
|
+
error: "#F87171",
|
|
947
|
+
errorForeground: "#1C1917",
|
|
948
|
+
warning: "#FBBF24",
|
|
949
|
+
success: "#4ADE80",
|
|
950
|
+
surface: "#1E293B",
|
|
951
|
+
background: "#0F172A",
|
|
952
|
+
text: "#F1F5F9",
|
|
953
|
+
textMuted: "#94A3B8",
|
|
954
|
+
textDisabled: "#334155",
|
|
955
|
+
border: "#334155",
|
|
956
|
+
borderFocus: "#60A5FA",
|
|
957
|
+
inputBackground: "#1E293B"
|
|
760
958
|
},
|
|
761
959
|
typography: {
|
|
762
960
|
fontFamily: "Inter, system-ui, sans-serif",
|
|
763
961
|
scale: "comfortable",
|
|
764
|
-
questionSize: "1.
|
|
962
|
+
questionSize: "1.0625rem",
|
|
765
963
|
labelSize: "0.875rem",
|
|
766
964
|
helpTextSize: "0.8125rem",
|
|
767
965
|
bodySize: "0.9375rem"
|
|
768
966
|
},
|
|
769
|
-
shape: { radius: "
|
|
967
|
+
shape: { radius: "sm", inputRadius: "6px", buttonRadius: "6px", cardRadius: "8px" },
|
|
968
|
+
spacing: { base: 16, sectionGap: 32, fieldGap: 24, inputPaddingX: 12, inputPaddingY: 10 },
|
|
969
|
+
layout: { maxWidth: "640px", alignment: "left", progressPosition: "top", sectionLayout: "flat" }
|
|
970
|
+
};
|
|
971
|
+
var stripeLight = {
|
|
972
|
+
colors: {
|
|
973
|
+
primary: "#635BFF",
|
|
974
|
+
primaryForeground: "#FFFFFF",
|
|
975
|
+
secondary: "#E8E6FF",
|
|
976
|
+
secondaryForeground: "#32297D",
|
|
977
|
+
error: "#DF1B41",
|
|
978
|
+
errorForeground: "#FFFFFF",
|
|
979
|
+
warning: "#D97706",
|
|
980
|
+
success: "#30B130",
|
|
981
|
+
surface: "#FFFFFF",
|
|
982
|
+
background: "#F6F9FC",
|
|
983
|
+
text: "#1A1F36",
|
|
984
|
+
textMuted: "#697386",
|
|
985
|
+
textDisabled: "#C1C9D2",
|
|
986
|
+
border: "#E3E8EE",
|
|
987
|
+
borderFocus: "#635BFF",
|
|
988
|
+
inputBackground: "#FFFFFF"
|
|
989
|
+
},
|
|
990
|
+
typography: {
|
|
991
|
+
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
|
|
992
|
+
scale: "comfortable",
|
|
993
|
+
questionSize: "1rem",
|
|
994
|
+
labelSize: "0.875rem",
|
|
995
|
+
helpTextSize: "0.8125rem",
|
|
996
|
+
bodySize: "0.9375rem"
|
|
997
|
+
},
|
|
998
|
+
shape: { radius: "md", inputRadius: "8px", buttonRadius: "8px", cardRadius: "12px" },
|
|
770
999
|
spacing: { base: 16, sectionGap: 32, fieldGap: 24, inputPaddingX: 12, inputPaddingY: 10 },
|
|
771
1000
|
layout: { maxWidth: "640px", alignment: "left", progressPosition: "top", sectionLayout: "card" }
|
|
772
1001
|
};
|
|
773
|
-
var
|
|
1002
|
+
var stripeDark = {
|
|
1003
|
+
colors: {
|
|
1004
|
+
primary: "#7A73FF",
|
|
1005
|
+
primaryForeground: "#FFFFFF",
|
|
1006
|
+
secondary: "#2D2A5E",
|
|
1007
|
+
secondaryForeground: "#CBC8FF",
|
|
1008
|
+
error: "#F93A5E",
|
|
1009
|
+
errorForeground: "#FFFFFF",
|
|
1010
|
+
warning: "#FBBF24",
|
|
1011
|
+
success: "#4ADE80",
|
|
1012
|
+
surface: "#1C2033",
|
|
1013
|
+
background: "#0A0E1A",
|
|
1014
|
+
text: "#E3E5EA",
|
|
1015
|
+
textMuted: "#8992A7",
|
|
1016
|
+
textDisabled: "#3C4257",
|
|
1017
|
+
border: "#2C3046",
|
|
1018
|
+
borderFocus: "#7A73FF",
|
|
1019
|
+
inputBackground: "#1C2033"
|
|
1020
|
+
},
|
|
1021
|
+
typography: {
|
|
1022
|
+
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif",
|
|
1023
|
+
scale: "comfortable",
|
|
1024
|
+
questionSize: "1rem",
|
|
1025
|
+
labelSize: "0.875rem",
|
|
1026
|
+
helpTextSize: "0.8125rem",
|
|
1027
|
+
bodySize: "0.9375rem"
|
|
1028
|
+
},
|
|
1029
|
+
shape: { radius: "md", inputRadius: "8px", buttonRadius: "8px", cardRadius: "12px" },
|
|
1030
|
+
spacing: { base: 16, sectionGap: 32, fieldGap: 24, inputPaddingX: 12, inputPaddingY: 10 },
|
|
1031
|
+
layout: { maxWidth: "640px", alignment: "left", progressPosition: "top", sectionLayout: "card" }
|
|
1032
|
+
};
|
|
1033
|
+
var githubLight = {
|
|
1034
|
+
colors: {
|
|
1035
|
+
primary: "#1F6FEB",
|
|
1036
|
+
primaryForeground: "#FFFFFF",
|
|
1037
|
+
secondary: "#DDF4FF",
|
|
1038
|
+
secondaryForeground: "#0550AE",
|
|
1039
|
+
error: "#CF222E",
|
|
1040
|
+
errorForeground: "#FFFFFF",
|
|
1041
|
+
warning: "#9A6700",
|
|
1042
|
+
success: "#1A7F37",
|
|
1043
|
+
surface: "#FFFFFF",
|
|
1044
|
+
background: "#F6F8FA",
|
|
1045
|
+
text: "#1F2328",
|
|
1046
|
+
textMuted: "#656D76",
|
|
1047
|
+
textDisabled: "#B1BAC4",
|
|
1048
|
+
border: "#D0D7DE",
|
|
1049
|
+
borderFocus: "#1F6FEB",
|
|
1050
|
+
inputBackground: "#FFFFFF"
|
|
1051
|
+
},
|
|
1052
|
+
typography: {
|
|
1053
|
+
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif",
|
|
1054
|
+
scale: "comfortable",
|
|
1055
|
+
questionSize: "1rem",
|
|
1056
|
+
labelSize: "0.875rem",
|
|
1057
|
+
helpTextSize: "0.75rem",
|
|
1058
|
+
bodySize: "0.875rem"
|
|
1059
|
+
},
|
|
1060
|
+
shape: { radius: "md", inputRadius: "6px", buttonRadius: "6px", cardRadius: "6px" },
|
|
1061
|
+
spacing: { base: 16, sectionGap: 28, fieldGap: 20, inputPaddingX: 12, inputPaddingY: 8 },
|
|
1062
|
+
layout: { maxWidth: "640px", alignment: "left", progressPosition: "top", sectionLayout: "bordered" }
|
|
1063
|
+
};
|
|
1064
|
+
var githubDark = {
|
|
1065
|
+
colors: {
|
|
1066
|
+
primary: "#58A6FF",
|
|
1067
|
+
primaryForeground: "#0D1117",
|
|
1068
|
+
secondary: "#172B4D",
|
|
1069
|
+
secondaryForeground: "#A5D6FF",
|
|
1070
|
+
error: "#F85149",
|
|
1071
|
+
errorForeground: "#0D1117",
|
|
1072
|
+
warning: "#E3B341",
|
|
1073
|
+
success: "#3FB950",
|
|
1074
|
+
surface: "#161B22",
|
|
1075
|
+
background: "#0D1117",
|
|
1076
|
+
text: "#E6EDF3",
|
|
1077
|
+
textMuted: "#8B949E",
|
|
1078
|
+
textDisabled: "#3D444D",
|
|
1079
|
+
border: "#30363D",
|
|
1080
|
+
borderFocus: "#58A6FF",
|
|
1081
|
+
inputBackground: "#161B22"
|
|
1082
|
+
},
|
|
1083
|
+
typography: {
|
|
1084
|
+
fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif",
|
|
1085
|
+
scale: "comfortable",
|
|
1086
|
+
questionSize: "1rem",
|
|
1087
|
+
labelSize: "0.875rem",
|
|
1088
|
+
helpTextSize: "0.75rem",
|
|
1089
|
+
bodySize: "0.875rem"
|
|
1090
|
+
},
|
|
1091
|
+
shape: { radius: "md", inputRadius: "6px", buttonRadius: "6px", cardRadius: "6px" },
|
|
1092
|
+
spacing: { base: 16, sectionGap: 28, fieldGap: 20, inputPaddingX: 12, inputPaddingY: 8 },
|
|
1093
|
+
layout: { maxWidth: "640px", alignment: "left", progressPosition: "top", sectionLayout: "bordered" }
|
|
1094
|
+
};
|
|
1095
|
+
var vercelLight = {
|
|
774
1096
|
colors: {
|
|
775
|
-
primary: "#
|
|
776
|
-
primaryForeground: "#
|
|
777
|
-
secondary: "#
|
|
778
|
-
secondaryForeground: "#
|
|
779
|
-
error: "#
|
|
780
|
-
errorForeground: "#
|
|
781
|
-
warning: "#
|
|
782
|
-
success: "#
|
|
783
|
-
surface: "#
|
|
1097
|
+
primary: "#000000",
|
|
1098
|
+
primaryForeground: "#FFFFFF",
|
|
1099
|
+
secondary: "#F5F5F5",
|
|
1100
|
+
secondaryForeground: "#171717",
|
|
1101
|
+
error: "#E5484D",
|
|
1102
|
+
errorForeground: "#FFFFFF",
|
|
1103
|
+
warning: "#F5A623",
|
|
1104
|
+
success: "#45A557",
|
|
1105
|
+
surface: "#FFFFFF",
|
|
784
1106
|
background: "#FAFAFA",
|
|
785
|
-
text: "#
|
|
786
|
-
textMuted: "#
|
|
787
|
-
textDisabled: "#
|
|
788
|
-
border: "#
|
|
789
|
-
borderFocus: "#
|
|
790
|
-
inputBackground: "#
|
|
1107
|
+
text: "#171717",
|
|
1108
|
+
textMuted: "#666666",
|
|
1109
|
+
textDisabled: "#C7C7C7",
|
|
1110
|
+
border: "#EAEAEA",
|
|
1111
|
+
borderFocus: "#000000",
|
|
1112
|
+
inputBackground: "#FFFFFF"
|
|
791
1113
|
},
|
|
792
1114
|
typography: {
|
|
793
|
-
fontFamily: "'
|
|
1115
|
+
fontFamily: "'Geist', Inter, -apple-system, sans-serif",
|
|
794
1116
|
scale: "comfortable",
|
|
795
|
-
questionSize: "
|
|
1117
|
+
questionSize: "1rem",
|
|
796
1118
|
labelSize: "0.875rem",
|
|
797
1119
|
helpTextSize: "0.8125rem",
|
|
798
|
-
bodySize: "
|
|
1120
|
+
bodySize: "0.875rem"
|
|
799
1121
|
},
|
|
800
|
-
shape: { radius: "
|
|
801
|
-
spacing: { base: 16, sectionGap:
|
|
802
|
-
layout: { maxWidth: "
|
|
1122
|
+
shape: { radius: "md", inputRadius: "8px", buttonRadius: "8px", cardRadius: "12px" },
|
|
1123
|
+
spacing: { base: 16, sectionGap: 32, fieldGap: 24, inputPaddingX: 12, inputPaddingY: 10 },
|
|
1124
|
+
layout: { maxWidth: "600px", alignment: "left", progressPosition: "top", sectionLayout: "flat" }
|
|
1125
|
+
};
|
|
1126
|
+
var vercelDark = {
|
|
1127
|
+
colors: {
|
|
1128
|
+
primary: "#FFFFFF",
|
|
1129
|
+
primaryForeground: "#000000",
|
|
1130
|
+
secondary: "#1A1A1A",
|
|
1131
|
+
secondaryForeground: "#EDEDED",
|
|
1132
|
+
error: "#E5484D",
|
|
1133
|
+
errorForeground: "#FFFFFF",
|
|
1134
|
+
warning: "#F5A623",
|
|
1135
|
+
success: "#45A557",
|
|
1136
|
+
surface: "#111111",
|
|
1137
|
+
background: "#000000",
|
|
1138
|
+
text: "#EDEDED",
|
|
1139
|
+
textMuted: "#888888",
|
|
1140
|
+
textDisabled: "#444444",
|
|
1141
|
+
border: "#333333",
|
|
1142
|
+
borderFocus: "#FFFFFF",
|
|
1143
|
+
inputBackground: "#111111"
|
|
1144
|
+
},
|
|
1145
|
+
typography: {
|
|
1146
|
+
fontFamily: "'Geist', Inter, -apple-system, sans-serif",
|
|
1147
|
+
scale: "comfortable",
|
|
1148
|
+
questionSize: "1rem",
|
|
1149
|
+
labelSize: "0.875rem",
|
|
1150
|
+
helpTextSize: "0.8125rem",
|
|
1151
|
+
bodySize: "0.875rem"
|
|
1152
|
+
},
|
|
1153
|
+
shape: { radius: "md", inputRadius: "8px", buttonRadius: "8px", cardRadius: "12px" },
|
|
1154
|
+
spacing: { base: 16, sectionGap: 32, fieldGap: 24, inputPaddingX: 12, inputPaddingY: 10 },
|
|
1155
|
+
layout: { maxWidth: "600px", alignment: "left", progressPosition: "top", sectionLayout: "flat" }
|
|
1156
|
+
};
|
|
1157
|
+
var shopifyLight = {
|
|
1158
|
+
colors: {
|
|
1159
|
+
primary: "#008060",
|
|
1160
|
+
primaryForeground: "#FFFFFF",
|
|
1161
|
+
secondary: "#E3F1DF",
|
|
1162
|
+
secondaryForeground: "#1A4D2E",
|
|
1163
|
+
error: "#D72C0D",
|
|
1164
|
+
errorForeground: "#FFFFFF",
|
|
1165
|
+
warning: "#B98900",
|
|
1166
|
+
success: "#008060",
|
|
1167
|
+
surface: "#FFFFFF",
|
|
1168
|
+
background: "#F6F6F7",
|
|
1169
|
+
text: "#202223",
|
|
1170
|
+
textMuted: "#6D7175",
|
|
1171
|
+
textDisabled: "#BABEC3",
|
|
1172
|
+
border: "#C9CCCF",
|
|
1173
|
+
borderFocus: "#008060",
|
|
1174
|
+
inputBackground: "#FFFFFF"
|
|
1175
|
+
},
|
|
1176
|
+
typography: {
|
|
1177
|
+
fontFamily: "Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
1178
|
+
scale: "comfortable",
|
|
1179
|
+
questionSize: "1rem",
|
|
1180
|
+
labelSize: "0.875rem",
|
|
1181
|
+
helpTextSize: "0.8125rem",
|
|
1182
|
+
bodySize: "0.9375rem"
|
|
1183
|
+
},
|
|
1184
|
+
shape: { radius: "md", inputRadius: "8px", buttonRadius: "8px", cardRadius: "12px" },
|
|
1185
|
+
spacing: { base: 16, sectionGap: 32, fieldGap: 24, inputPaddingX: 12, inputPaddingY: 10 },
|
|
1186
|
+
layout: { maxWidth: "640px", alignment: "left", progressPosition: "top", sectionLayout: "card" }
|
|
1187
|
+
};
|
|
1188
|
+
var shopifyDark = {
|
|
1189
|
+
colors: {
|
|
1190
|
+
primary: "#36D399",
|
|
1191
|
+
primaryForeground: "#0D2818",
|
|
1192
|
+
secondary: "#1A3A2A",
|
|
1193
|
+
secondaryForeground: "#B5E4CA",
|
|
1194
|
+
error: "#FE6B6B",
|
|
1195
|
+
errorForeground: "#1C1110",
|
|
1196
|
+
warning: "#FFD60A",
|
|
1197
|
+
success: "#36D399",
|
|
1198
|
+
surface: "#1A1C1E",
|
|
1199
|
+
background: "#111213",
|
|
1200
|
+
text: "#E3E5E7",
|
|
1201
|
+
textMuted: "#8C9196",
|
|
1202
|
+
textDisabled: "#44474A",
|
|
1203
|
+
border: "#333638",
|
|
1204
|
+
borderFocus: "#36D399",
|
|
1205
|
+
inputBackground: "#1A1C1E"
|
|
1206
|
+
},
|
|
1207
|
+
typography: {
|
|
1208
|
+
fontFamily: "Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif",
|
|
1209
|
+
scale: "comfortable",
|
|
1210
|
+
questionSize: "1rem",
|
|
1211
|
+
labelSize: "0.875rem",
|
|
1212
|
+
helpTextSize: "0.8125rem",
|
|
1213
|
+
bodySize: "0.9375rem"
|
|
1214
|
+
},
|
|
1215
|
+
shape: { radius: "md", inputRadius: "8px", buttonRadius: "8px", cardRadius: "12px" },
|
|
1216
|
+
spacing: { base: 16, sectionGap: 32, fieldGap: 24, inputPaddingX: 12, inputPaddingY: 10 },
|
|
1217
|
+
layout: { maxWidth: "640px", alignment: "left", progressPosition: "top", sectionLayout: "card" }
|
|
1218
|
+
};
|
|
1219
|
+
var slackLight = {
|
|
1220
|
+
colors: {
|
|
1221
|
+
primary: "#611F69",
|
|
1222
|
+
primaryForeground: "#FFFFFF",
|
|
1223
|
+
secondary: "#F3E8F5",
|
|
1224
|
+
secondaryForeground: "#4A154B",
|
|
1225
|
+
error: "#E01E5A",
|
|
1226
|
+
errorForeground: "#FFFFFF",
|
|
1227
|
+
warning: "#ECB22E",
|
|
1228
|
+
success: "#2EB67D",
|
|
1229
|
+
surface: "#FFFFFF",
|
|
1230
|
+
background: "#F8F8F8",
|
|
1231
|
+
text: "#1D1C1D",
|
|
1232
|
+
textMuted: "#616061",
|
|
1233
|
+
textDisabled: "#B9B9B9",
|
|
1234
|
+
border: "#DDDDDD",
|
|
1235
|
+
borderFocus: "#611F69",
|
|
1236
|
+
inputBackground: "#FFFFFF"
|
|
1237
|
+
},
|
|
1238
|
+
typography: {
|
|
1239
|
+
fontFamily: "'Lato', 'Helvetica Neue', Helvetica, sans-serif",
|
|
1240
|
+
scale: "comfortable",
|
|
1241
|
+
questionSize: "1.0625rem",
|
|
1242
|
+
labelSize: "0.875rem",
|
|
1243
|
+
helpTextSize: "0.8125rem",
|
|
1244
|
+
bodySize: "0.9375rem"
|
|
1245
|
+
},
|
|
1246
|
+
shape: { radius: "md", inputRadius: "8px", buttonRadius: "8px", cardRadius: "10px" },
|
|
1247
|
+
spacing: { base: 16, sectionGap: 32, fieldGap: 24, inputPaddingX: 12, inputPaddingY: 10 },
|
|
1248
|
+
layout: { maxWidth: "640px", alignment: "left", progressPosition: "top", sectionLayout: "card" }
|
|
803
1249
|
};
|
|
804
|
-
var
|
|
1250
|
+
var slackDark = {
|
|
1251
|
+
colors: {
|
|
1252
|
+
primary: "#D4A8DB",
|
|
1253
|
+
primaryForeground: "#1A0A1E",
|
|
1254
|
+
secondary: "#2C1332",
|
|
1255
|
+
secondaryForeground: "#E2C6E9",
|
|
1256
|
+
error: "#F5638B",
|
|
1257
|
+
errorForeground: "#1C0E14",
|
|
1258
|
+
warning: "#F0CA4D",
|
|
1259
|
+
success: "#4FCEA2",
|
|
1260
|
+
surface: "#1A1D21",
|
|
1261
|
+
background: "#0F1114",
|
|
1262
|
+
text: "#D1D2D3",
|
|
1263
|
+
textMuted: "#9B9C9E",
|
|
1264
|
+
textDisabled: "#4D4D4F",
|
|
1265
|
+
border: "#383A3E",
|
|
1266
|
+
borderFocus: "#D4A8DB",
|
|
1267
|
+
inputBackground: "#1A1D21"
|
|
1268
|
+
},
|
|
1269
|
+
typography: {
|
|
1270
|
+
fontFamily: "'Lato', 'Helvetica Neue', Helvetica, sans-serif",
|
|
1271
|
+
scale: "comfortable",
|
|
1272
|
+
questionSize: "1.0625rem",
|
|
1273
|
+
labelSize: "0.875rem",
|
|
1274
|
+
helpTextSize: "0.8125rem",
|
|
1275
|
+
bodySize: "0.9375rem"
|
|
1276
|
+
},
|
|
1277
|
+
shape: { radius: "md", inputRadius: "8px", buttonRadius: "8px", cardRadius: "10px" },
|
|
1278
|
+
spacing: { base: 16, sectionGap: 32, fieldGap: 24, inputPaddingX: 12, inputPaddingY: 10 },
|
|
1279
|
+
layout: { maxWidth: "640px", alignment: "left", progressPosition: "top", sectionLayout: "card" }
|
|
1280
|
+
};
|
|
1281
|
+
var tailwindLight = {
|
|
1282
|
+
colors: {
|
|
1283
|
+
primary: "#4F46E5",
|
|
1284
|
+
primaryForeground: "#FFFFFF",
|
|
1285
|
+
secondary: "#EEF2FF",
|
|
1286
|
+
secondaryForeground: "#3730A3",
|
|
1287
|
+
error: "#DC2626",
|
|
1288
|
+
errorForeground: "#FFFFFF",
|
|
1289
|
+
warning: "#D97706",
|
|
1290
|
+
success: "#059669",
|
|
1291
|
+
surface: "#FFFFFF",
|
|
1292
|
+
background: "#F9FAFB",
|
|
1293
|
+
text: "#111827",
|
|
1294
|
+
textMuted: "#6B7280",
|
|
1295
|
+
textDisabled: "#D1D5DB",
|
|
1296
|
+
border: "#E5E7EB",
|
|
1297
|
+
borderFocus: "#4F46E5",
|
|
1298
|
+
inputBackground: "#FFFFFF"
|
|
1299
|
+
},
|
|
1300
|
+
typography: {
|
|
1301
|
+
fontFamily: "Inter, system-ui, sans-serif",
|
|
1302
|
+
scale: "comfortable",
|
|
1303
|
+
questionSize: "1rem",
|
|
1304
|
+
labelSize: "0.875rem",
|
|
1305
|
+
helpTextSize: "0.8125rem",
|
|
1306
|
+
bodySize: "0.875rem"
|
|
1307
|
+
},
|
|
1308
|
+
shape: { radius: "md", inputRadius: "8px", buttonRadius: "8px", cardRadius: "12px" },
|
|
1309
|
+
spacing: { base: 16, sectionGap: 32, fieldGap: 24, inputPaddingX: 14, inputPaddingY: 10 },
|
|
1310
|
+
layout: { maxWidth: "640px", alignment: "left", progressPosition: "top", sectionLayout: "card" }
|
|
1311
|
+
};
|
|
1312
|
+
var tailwindDark = {
|
|
805
1313
|
colors: {
|
|
806
1314
|
primary: "#818CF8",
|
|
807
1315
|
primaryForeground: "#1E1B4B",
|
|
808
|
-
secondary: "#
|
|
809
|
-
secondaryForeground: "#
|
|
810
|
-
error: "#
|
|
811
|
-
errorForeground: "#
|
|
1316
|
+
secondary: "#1E1B4B",
|
|
1317
|
+
secondaryForeground: "#C7D2FE",
|
|
1318
|
+
error: "#F87171",
|
|
1319
|
+
errorForeground: "#1C1917",
|
|
812
1320
|
warning: "#FBBF24",
|
|
813
|
-
success: "#
|
|
814
|
-
surface: "#
|
|
815
|
-
background: "#
|
|
816
|
-
text: "#
|
|
817
|
-
textMuted: "#
|
|
818
|
-
textDisabled: "#
|
|
819
|
-
border: "#
|
|
1321
|
+
success: "#34D399",
|
|
1322
|
+
surface: "#1F2937",
|
|
1323
|
+
background: "#111827",
|
|
1324
|
+
text: "#F9FAFB",
|
|
1325
|
+
textMuted: "#9CA3AF",
|
|
1326
|
+
textDisabled: "#374151",
|
|
1327
|
+
border: "#374151",
|
|
820
1328
|
borderFocus: "#818CF8",
|
|
821
|
-
inputBackground: "#
|
|
1329
|
+
inputBackground: "#1F2937"
|
|
822
1330
|
},
|
|
823
1331
|
typography: {
|
|
824
|
-
fontFamily: "
|
|
1332
|
+
fontFamily: "Inter, system-ui, sans-serif",
|
|
825
1333
|
scale: "comfortable",
|
|
826
|
-
questionSize: "
|
|
1334
|
+
questionSize: "1rem",
|
|
827
1335
|
labelSize: "0.875rem",
|
|
828
1336
|
helpTextSize: "0.8125rem",
|
|
829
|
-
bodySize: "
|
|
1337
|
+
bodySize: "0.875rem"
|
|
830
1338
|
},
|
|
831
|
-
shape: { radius: "
|
|
832
|
-
spacing: { base: 16, sectionGap:
|
|
833
|
-
layout: { maxWidth: "
|
|
1339
|
+
shape: { radius: "md", inputRadius: "8px", buttonRadius: "8px", cardRadius: "12px" },
|
|
1340
|
+
spacing: { base: 16, sectionGap: 32, fieldGap: 24, inputPaddingX: 14, inputPaddingY: 10 },
|
|
1341
|
+
layout: { maxWidth: "640px", alignment: "left", progressPosition: "top", sectionLayout: "card" }
|
|
834
1342
|
};
|
|
835
|
-
var
|
|
1343
|
+
var clinicalLight = {
|
|
836
1344
|
colors: {
|
|
837
|
-
primary: "#
|
|
838
|
-
primaryForeground: "#
|
|
839
|
-
secondary: "#
|
|
840
|
-
secondaryForeground: "#
|
|
841
|
-
error: "#
|
|
842
|
-
errorForeground: "#
|
|
843
|
-
warning: "#
|
|
844
|
-
success: "#
|
|
845
|
-
surface: "#
|
|
1345
|
+
primary: "#0369A1",
|
|
1346
|
+
primaryForeground: "#FFFFFF",
|
|
1347
|
+
secondary: "#E0F2FE",
|
|
1348
|
+
secondaryForeground: "#0C4A6E",
|
|
1349
|
+
error: "#B91C1C",
|
|
1350
|
+
errorForeground: "#FFFFFF",
|
|
1351
|
+
warning: "#B45309",
|
|
1352
|
+
success: "#15803D",
|
|
1353
|
+
surface: "#FFFFFF",
|
|
846
1354
|
background: "#F0F9FF",
|
|
847
1355
|
text: "#0C4A6E",
|
|
848
|
-
textMuted: "#
|
|
849
|
-
textDisabled: "#
|
|
1356
|
+
textMuted: "#4B6B82",
|
|
1357
|
+
textDisabled: "#BAD6E9",
|
|
850
1358
|
border: "#BAE6FD",
|
|
851
|
-
borderFocus: "#
|
|
852
|
-
inputBackground: "#
|
|
1359
|
+
borderFocus: "#0369A1",
|
|
1360
|
+
inputBackground: "#FFFFFF"
|
|
853
1361
|
},
|
|
854
1362
|
typography: {
|
|
855
1363
|
fontFamily: "'Source Sans 3', 'Segoe UI', system-ui, sans-serif",
|
|
@@ -863,22 +1371,22 @@ var clinicalPreset = {
|
|
|
863
1371
|
spacing: { base: 16, sectionGap: 28, fieldGap: 24, inputPaddingX: 12, inputPaddingY: 10 },
|
|
864
1372
|
layout: { maxWidth: "680px", alignment: "left", progressPosition: "top", sectionLayout: "bordered" }
|
|
865
1373
|
};
|
|
866
|
-
var
|
|
1374
|
+
var clinicalDark = {
|
|
867
1375
|
colors: {
|
|
868
1376
|
primary: "#38BDF8",
|
|
869
1377
|
primaryForeground: "#0C1929",
|
|
870
|
-
secondary: "#
|
|
871
|
-
secondaryForeground: "#
|
|
872
|
-
error: "#
|
|
873
|
-
errorForeground: "#
|
|
874
|
-
warning: "#
|
|
875
|
-
success: "#
|
|
1378
|
+
secondary: "#0C3554",
|
|
1379
|
+
secondaryForeground: "#BAE6FD",
|
|
1380
|
+
error: "#FCA5A5",
|
|
1381
|
+
errorForeground: "#1C1110",
|
|
1382
|
+
warning: "#FCD34D",
|
|
1383
|
+
success: "#6EE7B7",
|
|
876
1384
|
surface: "#0F2438",
|
|
877
|
-
background: "#
|
|
1385
|
+
background: "#0B1929",
|
|
878
1386
|
text: "#E0F2FE",
|
|
879
|
-
textMuted: "#
|
|
1387
|
+
textMuted: "#7DC4E8",
|
|
880
1388
|
textDisabled: "#1E3A5F",
|
|
881
|
-
border: "#
|
|
1389
|
+
border: "#1C3A5A",
|
|
882
1390
|
borderFocus: "#38BDF8",
|
|
883
1391
|
inputBackground: "#0F2438"
|
|
884
1392
|
},
|
|
@@ -894,86 +1402,210 @@ var clinicalDarkPreset = {
|
|
|
894
1402
|
spacing: { base: 16, sectionGap: 28, fieldGap: 24, inputPaddingX: 12, inputPaddingY: 10 },
|
|
895
1403
|
layout: { maxWidth: "680px", alignment: "left", progressPosition: "top", sectionLayout: "bordered" }
|
|
896
1404
|
};
|
|
897
|
-
var
|
|
1405
|
+
var notionLight = {
|
|
898
1406
|
colors: {
|
|
899
|
-
primary: "#
|
|
900
|
-
primaryForeground: "#
|
|
901
|
-
secondary: "#
|
|
902
|
-
secondaryForeground: "#
|
|
903
|
-
error: "#
|
|
904
|
-
errorForeground: "#
|
|
905
|
-
warning: "#
|
|
906
|
-
success: "#
|
|
907
|
-
surface: "#
|
|
908
|
-
background: "#
|
|
909
|
-
text: "#
|
|
1407
|
+
primary: "#2383E2",
|
|
1408
|
+
primaryForeground: "#FFFFFF",
|
|
1409
|
+
secondary: "#EBF5FB",
|
|
1410
|
+
secondaryForeground: "#1B4F7B",
|
|
1411
|
+
error: "#EB5757",
|
|
1412
|
+
errorForeground: "#FFFFFF",
|
|
1413
|
+
warning: "#CB912F",
|
|
1414
|
+
success: "#0F7B6C",
|
|
1415
|
+
surface: "#FFFFFF",
|
|
1416
|
+
background: "#FFFFFF",
|
|
1417
|
+
text: "#37352F",
|
|
1418
|
+
textMuted: "#787774",
|
|
1419
|
+
textDisabled: "#C3C2BF",
|
|
1420
|
+
border: "#E3E2E0",
|
|
1421
|
+
borderFocus: "#2383E2",
|
|
1422
|
+
inputBackground: "#F7F6F3"
|
|
1423
|
+
},
|
|
1424
|
+
typography: {
|
|
1425
|
+
fontFamily: "'Lyon Text', Georgia, 'Times New Roman', serif",
|
|
1426
|
+
scale: "comfortable",
|
|
1427
|
+
questionSize: "1.0625rem",
|
|
1428
|
+
labelSize: "0.875rem",
|
|
1429
|
+
helpTextSize: "0.8125rem",
|
|
1430
|
+
bodySize: "1rem"
|
|
1431
|
+
},
|
|
1432
|
+
shape: { radius: "sm", inputRadius: "4px", buttonRadius: "4px", cardRadius: "4px" },
|
|
1433
|
+
spacing: { base: 16, sectionGap: 32, fieldGap: 24, inputPaddingX: 12, inputPaddingY: 10 },
|
|
1434
|
+
layout: { maxWidth: "680px", alignment: "left", progressPosition: "top", sectionLayout: "flat" }
|
|
1435
|
+
};
|
|
1436
|
+
var notionDark = {
|
|
1437
|
+
colors: {
|
|
1438
|
+
primary: "#529CCA",
|
|
1439
|
+
primaryForeground: "#FFFFFF",
|
|
1440
|
+
secondary: "#143046",
|
|
1441
|
+
secondaryForeground: "#9ECBEB",
|
|
1442
|
+
error: "#FF6B6B",
|
|
1443
|
+
errorForeground: "#1C1210",
|
|
1444
|
+
warning: "#E0AD50",
|
|
1445
|
+
success: "#4DAB9A",
|
|
1446
|
+
surface: "#2F3437",
|
|
1447
|
+
background: "#191919",
|
|
1448
|
+
text: "#E6E3DD",
|
|
1449
|
+
textMuted: "#9B9A97",
|
|
1450
|
+
textDisabled: "#4F4F4F",
|
|
1451
|
+
border: "#434343",
|
|
1452
|
+
borderFocus: "#529CCA",
|
|
1453
|
+
inputBackground: "#2F3437"
|
|
1454
|
+
},
|
|
1455
|
+
typography: {
|
|
1456
|
+
fontFamily: "'Lyon Text', Georgia, 'Times New Roman', serif",
|
|
1457
|
+
scale: "comfortable",
|
|
1458
|
+
questionSize: "1.0625rem",
|
|
1459
|
+
labelSize: "0.875rem",
|
|
1460
|
+
helpTextSize: "0.8125rem",
|
|
1461
|
+
bodySize: "1rem"
|
|
1462
|
+
},
|
|
1463
|
+
shape: { radius: "sm", inputRadius: "4px", buttonRadius: "4px", cardRadius: "4px" },
|
|
1464
|
+
spacing: { base: 16, sectionGap: 32, fieldGap: 24, inputPaddingX: 12, inputPaddingY: 10 },
|
|
1465
|
+
layout: { maxWidth: "680px", alignment: "left", progressPosition: "top", sectionLayout: "flat" }
|
|
1466
|
+
};
|
|
1467
|
+
var sunsetLight = {
|
|
1468
|
+
colors: {
|
|
1469
|
+
primary: "#C2410C",
|
|
1470
|
+
primaryForeground: "#FFFFFF",
|
|
1471
|
+
secondary: "#FFF7ED",
|
|
1472
|
+
secondaryForeground: "#7C2D12",
|
|
1473
|
+
error: "#B91C1C",
|
|
1474
|
+
errorForeground: "#FFFFFF",
|
|
1475
|
+
warning: "#A16207",
|
|
1476
|
+
success: "#15803D",
|
|
1477
|
+
surface: "#FFFFFF",
|
|
1478
|
+
background: "#FFFBF5",
|
|
1479
|
+
text: "#292524",
|
|
910
1480
|
textMuted: "#78716C",
|
|
911
1481
|
textDisabled: "#D6D3D1",
|
|
912
|
-
border: "#
|
|
913
|
-
borderFocus: "#
|
|
914
|
-
inputBackground: "#
|
|
1482
|
+
border: "#E7E5E4",
|
|
1483
|
+
borderFocus: "#C2410C",
|
|
1484
|
+
inputBackground: "#FFFFFF"
|
|
915
1485
|
},
|
|
916
1486
|
typography: {
|
|
917
|
-
fontFamily: "'
|
|
918
|
-
scale: "
|
|
919
|
-
questionSize: "1.
|
|
920
|
-
labelSize: "0.
|
|
921
|
-
helpTextSize: "0.
|
|
922
|
-
bodySize: "
|
|
1487
|
+
fontFamily: "'DM Sans', Inter, system-ui, sans-serif",
|
|
1488
|
+
scale: "comfortable",
|
|
1489
|
+
questionSize: "1.125rem",
|
|
1490
|
+
labelSize: "0.875rem",
|
|
1491
|
+
helpTextSize: "0.8125rem",
|
|
1492
|
+
bodySize: "0.9375rem"
|
|
923
1493
|
},
|
|
924
|
-
shape: { radius: "
|
|
925
|
-
spacing: { base:
|
|
926
|
-
layout: { maxWidth: "
|
|
1494
|
+
shape: { radius: "lg", inputRadius: "10px", buttonRadius: "10px", cardRadius: "14px" },
|
|
1495
|
+
spacing: { base: 16, sectionGap: 36, fieldGap: 26, inputPaddingX: 14, inputPaddingY: 11 },
|
|
1496
|
+
layout: { maxWidth: "640px", alignment: "center", progressPosition: "top", sectionLayout: "card" }
|
|
927
1497
|
};
|
|
928
|
-
var
|
|
1498
|
+
var sunsetDark = {
|
|
929
1499
|
colors: {
|
|
930
|
-
primary: "#
|
|
931
|
-
primaryForeground: "#
|
|
932
|
-
secondary: "#
|
|
933
|
-
secondaryForeground: "#
|
|
1500
|
+
primary: "#FB923C",
|
|
1501
|
+
primaryForeground: "#1C1210",
|
|
1502
|
+
secondary: "#3D1F0E",
|
|
1503
|
+
secondaryForeground: "#FED7AA",
|
|
934
1504
|
error: "#FCA5A5",
|
|
935
|
-
errorForeground: "#
|
|
1505
|
+
errorForeground: "#1C1210",
|
|
936
1506
|
warning: "#FCD34D",
|
|
937
1507
|
success: "#6EE7B7",
|
|
938
|
-
surface: "#
|
|
939
|
-
background: "#
|
|
940
|
-
text: "#
|
|
941
|
-
textMuted: "#
|
|
942
|
-
textDisabled: "#
|
|
943
|
-
border: "#
|
|
944
|
-
borderFocus: "#
|
|
945
|
-
inputBackground: "#
|
|
1508
|
+
surface: "#292019",
|
|
1509
|
+
background: "#1C1510",
|
|
1510
|
+
text: "#F5F0EB",
|
|
1511
|
+
textMuted: "#B0A89E",
|
|
1512
|
+
textDisabled: "#4A413A",
|
|
1513
|
+
border: "#3D352D",
|
|
1514
|
+
borderFocus: "#FB923C",
|
|
1515
|
+
inputBackground: "#292019"
|
|
1516
|
+
},
|
|
1517
|
+
typography: {
|
|
1518
|
+
fontFamily: "'DM Sans', Inter, system-ui, sans-serif",
|
|
1519
|
+
scale: "comfortable",
|
|
1520
|
+
questionSize: "1.125rem",
|
|
1521
|
+
labelSize: "0.875rem",
|
|
1522
|
+
helpTextSize: "0.8125rem",
|
|
1523
|
+
bodySize: "0.9375rem"
|
|
1524
|
+
},
|
|
1525
|
+
shape: { radius: "lg", inputRadius: "10px", buttonRadius: "10px", cardRadius: "14px" },
|
|
1526
|
+
spacing: { base: 16, sectionGap: 36, fieldGap: 26, inputPaddingX: 14, inputPaddingY: 11 },
|
|
1527
|
+
layout: { maxWidth: "640px", alignment: "center", progressPosition: "top", sectionLayout: "card" }
|
|
1528
|
+
};
|
|
1529
|
+
var roseLight = {
|
|
1530
|
+
colors: {
|
|
1531
|
+
primary: "#BE185D",
|
|
1532
|
+
primaryForeground: "#FFFFFF",
|
|
1533
|
+
secondary: "#FFF1F2",
|
|
1534
|
+
secondaryForeground: "#881337",
|
|
1535
|
+
error: "#DC2626",
|
|
1536
|
+
errorForeground: "#FFFFFF",
|
|
1537
|
+
warning: "#D97706",
|
|
1538
|
+
success: "#059669",
|
|
1539
|
+
surface: "#FFFFFF",
|
|
1540
|
+
background: "#FFFBFB",
|
|
1541
|
+
text: "#1C1917",
|
|
1542
|
+
textMuted: "#737373",
|
|
1543
|
+
textDisabled: "#D4D4D4",
|
|
1544
|
+
border: "#FECDD3",
|
|
1545
|
+
borderFocus: "#BE185D",
|
|
1546
|
+
inputBackground: "#FFFFFF"
|
|
946
1547
|
},
|
|
947
1548
|
typography: {
|
|
948
|
-
fontFamily: "'
|
|
1549
|
+
fontFamily: "'Plus Jakarta Sans', Inter, system-ui, sans-serif",
|
|
949
1550
|
scale: "spacious",
|
|
950
|
-
questionSize: "1.
|
|
951
|
-
labelSize: "0.
|
|
952
|
-
helpTextSize: "0.
|
|
953
|
-
bodySize: "
|
|
1551
|
+
questionSize: "1.1875rem",
|
|
1552
|
+
labelSize: "0.875rem",
|
|
1553
|
+
helpTextSize: "0.8125rem",
|
|
1554
|
+
bodySize: "0.9375rem"
|
|
954
1555
|
},
|
|
955
|
-
shape: { radius: "
|
|
956
|
-
spacing: { base: 18, sectionGap: 36, fieldGap: 28, inputPaddingX:
|
|
957
|
-
layout: { maxWidth: "
|
|
1556
|
+
shape: { radius: "lg", inputRadius: "12px", buttonRadius: "12px", cardRadius: "16px" },
|
|
1557
|
+
spacing: { base: 18, sectionGap: 36, fieldGap: 28, inputPaddingX: 16, inputPaddingY: 12 },
|
|
1558
|
+
layout: { maxWidth: "640px", alignment: "center", progressPosition: "top", sectionLayout: "card" }
|
|
958
1559
|
};
|
|
959
|
-
var
|
|
1560
|
+
var roseDark = {
|
|
960
1561
|
colors: {
|
|
961
|
-
primary: "#
|
|
962
|
-
primaryForeground: "#
|
|
963
|
-
secondary: "#
|
|
964
|
-
secondaryForeground: "#
|
|
1562
|
+
primary: "#FB7185",
|
|
1563
|
+
primaryForeground: "#1C0A12",
|
|
1564
|
+
secondary: "#3B0A22",
|
|
1565
|
+
secondaryForeground: "#FECDD3",
|
|
1566
|
+
error: "#F87171",
|
|
1567
|
+
errorForeground: "#1C1210",
|
|
1568
|
+
warning: "#FBBF24",
|
|
1569
|
+
success: "#34D399",
|
|
1570
|
+
surface: "#1F1318",
|
|
1571
|
+
background: "#150D11",
|
|
1572
|
+
text: "#FAF0F2",
|
|
1573
|
+
textMuted: "#C9A4AE",
|
|
1574
|
+
textDisabled: "#4A3039",
|
|
1575
|
+
border: "#3D2030",
|
|
1576
|
+
borderFocus: "#FB7185",
|
|
1577
|
+
inputBackground: "#1F1318"
|
|
1578
|
+
},
|
|
1579
|
+
typography: {
|
|
1580
|
+
fontFamily: "'Plus Jakarta Sans', Inter, system-ui, sans-serif",
|
|
1581
|
+
scale: "spacious",
|
|
1582
|
+
questionSize: "1.1875rem",
|
|
1583
|
+
labelSize: "0.875rem",
|
|
1584
|
+
helpTextSize: "0.8125rem",
|
|
1585
|
+
bodySize: "0.9375rem"
|
|
1586
|
+
},
|
|
1587
|
+
shape: { radius: "lg", inputRadius: "12px", buttonRadius: "12px", cardRadius: "16px" },
|
|
1588
|
+
spacing: { base: 18, sectionGap: 36, fieldGap: 28, inputPaddingX: 16, inputPaddingY: 12 },
|
|
1589
|
+
layout: { maxWidth: "640px", alignment: "center", progressPosition: "top", sectionLayout: "card" }
|
|
1590
|
+
};
|
|
1591
|
+
var highContrastLight = {
|
|
1592
|
+
colors: {
|
|
1593
|
+
primary: "#0000CC",
|
|
1594
|
+
primaryForeground: "#FFFFFF",
|
|
1595
|
+
secondary: "#E6E6FF",
|
|
1596
|
+
secondaryForeground: "#000066",
|
|
965
1597
|
error: "#B91C1C",
|
|
966
|
-
errorForeground: "#
|
|
967
|
-
warning: "#
|
|
1598
|
+
errorForeground: "#FFFFFF",
|
|
1599
|
+
warning: "#854D0E",
|
|
968
1600
|
success: "#166534",
|
|
969
|
-
surface: "#
|
|
970
|
-
background: "#
|
|
1601
|
+
surface: "#FFFFFF",
|
|
1602
|
+
background: "#FFFFFF",
|
|
971
1603
|
text: "#000000",
|
|
972
|
-
textMuted: "#
|
|
973
|
-
textDisabled: "#
|
|
1604
|
+
textMuted: "#333333",
|
|
1605
|
+
textDisabled: "#888888",
|
|
974
1606
|
border: "#000000",
|
|
975
|
-
borderFocus: "#
|
|
976
|
-
inputBackground: "#
|
|
1607
|
+
borderFocus: "#0000CC",
|
|
1608
|
+
inputBackground: "#FFFFFF"
|
|
977
1609
|
},
|
|
978
1610
|
typography: {
|
|
979
1611
|
fontFamily: "Arial, Helvetica, sans-serif",
|
|
@@ -987,24 +1619,24 @@ var highContrastPreset = {
|
|
|
987
1619
|
spacing: { base: 20, sectionGap: 40, fieldGap: 32, inputPaddingX: 14, inputPaddingY: 12 },
|
|
988
1620
|
layout: { maxWidth: "720px", alignment: "left", progressPosition: "top", sectionLayout: "bordered" }
|
|
989
1621
|
};
|
|
990
|
-
var
|
|
1622
|
+
var highContrastDark = {
|
|
991
1623
|
colors: {
|
|
992
|
-
primary: "#
|
|
1624
|
+
primary: "#6CB4FF",
|
|
993
1625
|
primaryForeground: "#000000",
|
|
994
|
-
secondary: "#
|
|
995
|
-
secondaryForeground: "#
|
|
996
|
-
error: "#
|
|
1626
|
+
secondary: "#002255",
|
|
1627
|
+
secondaryForeground: "#99CCFF",
|
|
1628
|
+
error: "#FF8A8A",
|
|
997
1629
|
errorForeground: "#000000",
|
|
998
|
-
warning: "#
|
|
999
|
-
success: "#
|
|
1000
|
-
surface: "#
|
|
1630
|
+
warning: "#FFD54F",
|
|
1631
|
+
success: "#69F0AE",
|
|
1632
|
+
surface: "#0A0A0A",
|
|
1001
1633
|
background: "#000000",
|
|
1002
1634
|
text: "#FFFFFF",
|
|
1003
|
-
textMuted: "#
|
|
1004
|
-
textDisabled: "#
|
|
1635
|
+
textMuted: "#CCCCCC",
|
|
1636
|
+
textDisabled: "#666666",
|
|
1005
1637
|
border: "#FFFFFF",
|
|
1006
|
-
borderFocus: "#
|
|
1007
|
-
inputBackground: "#
|
|
1638
|
+
borderFocus: "#6CB4FF",
|
|
1639
|
+
inputBackground: "#0A0A0A"
|
|
1008
1640
|
},
|
|
1009
1641
|
typography: {
|
|
1010
1642
|
fontFamily: "Arial, Helvetica, sans-serif",
|
|
@@ -1019,11 +1651,18 @@ var highContrastDarkPreset = {
|
|
|
1019
1651
|
layout: { maxWidth: "720px", alignment: "left", progressPosition: "top", sectionLayout: "bordered" }
|
|
1020
1652
|
};
|
|
1021
1653
|
var PRESET_FAMILIES = {
|
|
1022
|
-
clean: { light:
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1654
|
+
clean: { light: cleanLight, dark: cleanDark, label: "Clean" },
|
|
1655
|
+
stripe: { light: stripeLight, dark: stripeDark, label: "Stripe" },
|
|
1656
|
+
github: { light: githubLight, dark: githubDark, label: "GitHub" },
|
|
1657
|
+
vercel: { light: vercelLight, dark: vercelDark, label: "Vercel" },
|
|
1658
|
+
shopify: { light: shopifyLight, dark: shopifyDark, label: "Shopify" },
|
|
1659
|
+
slack: { light: slackLight, dark: slackDark, label: "Slack" },
|
|
1660
|
+
tailwind: { light: tailwindLight, dark: tailwindDark, label: "Tailwind" },
|
|
1661
|
+
clinical: { light: clinicalLight, dark: clinicalDark, label: "Clinical" },
|
|
1662
|
+
notion: { light: notionLight, dark: notionDark, label: "Notion" },
|
|
1663
|
+
sunset: { light: sunsetLight, dark: sunsetDark, label: "Sunset" },
|
|
1664
|
+
rose: { light: roseLight, dark: roseDark, label: "Rose" },
|
|
1665
|
+
"high-contrast": { light: highContrastLight, dark: highContrastDark, label: "High contrast" }
|
|
1027
1666
|
};
|
|
1028
1667
|
var COMPARISON_PRESETS = Object.fromEntries(
|
|
1029
1668
|
Object.entries(PRESET_FAMILIES).map(([key, family]) => [
|
|
@@ -1140,6 +1779,12 @@ function resolveThemeFromDOM() {
|
|
|
1140
1779
|
const val = styles.getPropertyValue(prop).trim();
|
|
1141
1780
|
return val || void 0;
|
|
1142
1781
|
};
|
|
1782
|
+
const getNumber = (prop) => {
|
|
1783
|
+
const val = get(prop);
|
|
1784
|
+
if (val == null) return void 0;
|
|
1785
|
+
const num = parseFloat(val);
|
|
1786
|
+
return isNaN(num) ? void 0 : num;
|
|
1787
|
+
};
|
|
1143
1788
|
return {
|
|
1144
1789
|
colors: {
|
|
1145
1790
|
primary: get("--primary"),
|
|
@@ -1172,6 +1817,17 @@ function resolveThemeFromDOM() {
|
|
|
1172
1817
|
inputRadius: get("--fc-radius-input"),
|
|
1173
1818
|
buttonRadius: get("--fc-radius-button"),
|
|
1174
1819
|
cardRadius: get("--fc-radius-card")
|
|
1820
|
+
},
|
|
1821
|
+
spacing: {
|
|
1822
|
+
base: getNumber("--fc-spacing-base"),
|
|
1823
|
+
sectionGap: getNumber("--fc-section-gap"),
|
|
1824
|
+
fieldGap: getNumber("--fc-field-gap"),
|
|
1825
|
+
inputPaddingX: getNumber("--fc-input-padding-x"),
|
|
1826
|
+
inputPaddingY: getNumber("--fc-input-padding-y")
|
|
1827
|
+
},
|
|
1828
|
+
layout: {
|
|
1829
|
+
maxWidth: get("--fc-max-width")
|
|
1830
|
+
// alignment, progressPosition, sectionLayout are enums — not resolvable from CSS
|
|
1175
1831
|
}
|
|
1176
1832
|
};
|
|
1177
1833
|
}
|
|
@@ -1201,13 +1857,34 @@ function ThemeEditorThemeProvider({ theme, children }) {
|
|
|
1201
1857
|
}
|
|
1202
1858
|
function isDarkTheme(theme) {
|
|
1203
1859
|
const bg = theme.colors?.background ?? "#FFFFFF";
|
|
1204
|
-
|
|
1860
|
+
let hex = bg.replace("#", "");
|
|
1861
|
+
if (hex.length === 3) {
|
|
1862
|
+
hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2];
|
|
1863
|
+
}
|
|
1205
1864
|
if (hex.length < 6) return false;
|
|
1206
1865
|
const r = parseInt(hex.slice(0, 2), 16);
|
|
1207
1866
|
const g = parseInt(hex.slice(2, 4), 16);
|
|
1208
1867
|
const b = parseInt(hex.slice(4, 6), 16);
|
|
1209
1868
|
return 0.299 * r + 0.587 * g + 0.114 * b < 128;
|
|
1210
1869
|
}
|
|
1870
|
+
function detectPresetFamily(theme) {
|
|
1871
|
+
const c = theme.colors;
|
|
1872
|
+
if (!c) return null;
|
|
1873
|
+
for (const [key, family] of Object.entries(PRESET_FAMILIES)) {
|
|
1874
|
+
for (const variant of ["light", "dark"]) {
|
|
1875
|
+
const preset = family[variant];
|
|
1876
|
+
const pc = preset.colors;
|
|
1877
|
+
if (!pc) continue;
|
|
1878
|
+
if (c.primary?.toLowerCase() === pc.primary?.toLowerCase() && c.background?.toLowerCase() === pc.background?.toLowerCase() && c.surface?.toLowerCase() === pc.surface?.toLowerCase()) {
|
|
1879
|
+
return key;
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1883
|
+
return null;
|
|
1884
|
+
}
|
|
1885
|
+
function isValidHex(value) {
|
|
1886
|
+
return /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(value);
|
|
1887
|
+
}
|
|
1211
1888
|
var SECTIONS = [
|
|
1212
1889
|
{
|
|
1213
1890
|
id: "colors",
|
|
@@ -1328,6 +2005,7 @@ var SECTIONS = [
|
|
|
1328
2005
|
];
|
|
1329
2006
|
function ThemeEditorInner({
|
|
1330
2007
|
initialTheme,
|
|
2008
|
+
initialPreset,
|
|
1331
2009
|
onChange,
|
|
1332
2010
|
onSave,
|
|
1333
2011
|
theme: chromeTheme,
|
|
@@ -1339,39 +2017,82 @@ function ThemeEditorInner({
|
|
|
1339
2017
|
}) {
|
|
1340
2018
|
const resolvedInitial = react.useMemo(
|
|
1341
2019
|
() => initialTheme ?? resolveThemeFromDOM(),
|
|
1342
|
-
|
|
1343
|
-
[]
|
|
2020
|
+
[initialTheme]
|
|
1344
2021
|
);
|
|
1345
2022
|
const [theme, setTheme] = react.useState(resolvedInitial);
|
|
1346
2023
|
const [activeSection, setActiveSection] = react.useState("colors");
|
|
1347
|
-
const
|
|
2024
|
+
const resolvedPresetInit = initialPreset ?? detectPresetFamily(resolvedInitial) ?? "custom";
|
|
2025
|
+
const [presetKey, setPresetKey] = react.useState(resolvedPresetInit);
|
|
2026
|
+
const presetKeyRef = react.useRef(presetKey);
|
|
2027
|
+
presetKeyRef.current = presetKey;
|
|
1348
2028
|
const [showPalette, setShowPalette] = react.useState(false);
|
|
1349
2029
|
const [showComparison, setShowComparison] = react.useState(false);
|
|
1350
2030
|
const themeRef = react.useRef(theme);
|
|
1351
2031
|
themeRef.current = theme;
|
|
1352
|
-
const
|
|
2032
|
+
const prevInitialRef = react.useRef(initialTheme);
|
|
2033
|
+
const prevPresetRef = react.useRef(initialPreset);
|
|
2034
|
+
react.useEffect(() => {
|
|
2035
|
+
if (!initialTheme) return;
|
|
2036
|
+
const themeChanged = JSON.stringify(initialTheme) !== JSON.stringify(prevInitialRef.current);
|
|
2037
|
+
const presetChanged = initialPreset !== prevPresetRef.current;
|
|
2038
|
+
if (!themeChanged && !presetChanged) return;
|
|
2039
|
+
prevInitialRef.current = initialTheme;
|
|
2040
|
+
prevPresetRef.current = initialPreset;
|
|
2041
|
+
setTheme(initialTheme);
|
|
2042
|
+
const resolvedPreset = initialPreset ?? detectPresetFamily(initialTheme) ?? "custom";
|
|
2043
|
+
setPresetKey(resolvedPreset);
|
|
2044
|
+
}, [initialTheme, initialPreset]);
|
|
2045
|
+
const mountReadyRef = react.useRef(false);
|
|
1353
2046
|
react.useEffect(() => {
|
|
1354
|
-
if (hasInitialTheme.current) return;
|
|
1355
2047
|
if (typeof window === "undefined") return;
|
|
2048
|
+
const initialAttr = document.documentElement.getAttribute("data-theme");
|
|
2049
|
+
const lastAttrRef = { current: initialAttr };
|
|
2050
|
+
const readyTimer = setTimeout(() => {
|
|
2051
|
+
mountReadyRef.current = true;
|
|
2052
|
+
}, 500);
|
|
1356
2053
|
const observer = new MutationObserver(() => {
|
|
2054
|
+
if (!mountReadyRef.current) return;
|
|
2055
|
+
const currentAttr = document.documentElement.getAttribute("data-theme");
|
|
2056
|
+
if (currentAttr === lastAttrRef.current) return;
|
|
2057
|
+
lastAttrRef.current = currentAttr;
|
|
1357
2058
|
requestAnimationFrame(() => {
|
|
1358
|
-
const
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
2059
|
+
const variant = currentAttr === "dark" ? "dark" : "light";
|
|
2060
|
+
let key = presetKeyRef.current;
|
|
2061
|
+
if (key === "custom") {
|
|
2062
|
+
const detected = detectPresetFamily(themeRef.current);
|
|
2063
|
+
if (detected) {
|
|
2064
|
+
key = detected;
|
|
2065
|
+
setPresetKey(detected);
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
2068
|
+
if (key !== "custom") {
|
|
2069
|
+
const family = PRESET_FAMILIES[key];
|
|
2070
|
+
if (family) {
|
|
2071
|
+
const preset = family[variant];
|
|
2072
|
+
setTheme(preset);
|
|
2073
|
+
onChange?.(preset, key);
|
|
2074
|
+
}
|
|
2075
|
+
} else {
|
|
2076
|
+
const resolved = resolveThemeFromDOM();
|
|
2077
|
+
setTheme(resolved);
|
|
2078
|
+
onChange?.(resolved, "custom");
|
|
2079
|
+
}
|
|
1362
2080
|
});
|
|
1363
2081
|
});
|
|
1364
2082
|
observer.observe(document.documentElement, {
|
|
1365
2083
|
attributes: true,
|
|
1366
2084
|
attributeFilter: ["data-theme", "class"]
|
|
1367
2085
|
});
|
|
1368
|
-
return () =>
|
|
2086
|
+
return () => {
|
|
2087
|
+
clearTimeout(readyTimer);
|
|
2088
|
+
observer.disconnect();
|
|
2089
|
+
};
|
|
1369
2090
|
}, [onChange]);
|
|
1370
2091
|
react.useEffect(() => {
|
|
1371
2092
|
function handleKeyDown(e) {
|
|
1372
2093
|
if ((e.metaKey || e.ctrlKey) && e.key === "s") {
|
|
1373
2094
|
e.preventDefault();
|
|
1374
|
-
onSave?.(themeRef.current);
|
|
2095
|
+
onSave?.(themeRef.current, presetKeyRef.current);
|
|
1375
2096
|
}
|
|
1376
2097
|
}
|
|
1377
2098
|
window.addEventListener("keydown", handleKeyDown);
|
|
@@ -1384,7 +2105,7 @@ function ThemeEditorInner({
|
|
|
1384
2105
|
...prev,
|
|
1385
2106
|
[section]: { ...prev[section], [key]: value }
|
|
1386
2107
|
};
|
|
1387
|
-
onChange?.(next);
|
|
2108
|
+
onChange?.(next, "custom");
|
|
1388
2109
|
return next;
|
|
1389
2110
|
});
|
|
1390
2111
|
setPresetKey("custom");
|
|
@@ -1395,11 +2116,12 @@ function ThemeEditorInner({
|
|
|
1395
2116
|
(key) => {
|
|
1396
2117
|
const family = PRESET_FAMILIES[key];
|
|
1397
2118
|
if (family) {
|
|
1398
|
-
const
|
|
2119
|
+
const htmlTheme = typeof document !== "undefined" ? document.documentElement.getAttribute("data-theme") : null;
|
|
2120
|
+
const variant = htmlTheme === "dark" ? "dark" : htmlTheme === "light" ? "light" : isDarkTheme(theme) ? "dark" : "light";
|
|
1399
2121
|
const preset = family[variant];
|
|
1400
2122
|
setTheme(preset);
|
|
1401
2123
|
setPresetKey(key);
|
|
1402
|
-
onChange?.(preset);
|
|
2124
|
+
onChange?.(preset, key);
|
|
1403
2125
|
}
|
|
1404
2126
|
},
|
|
1405
2127
|
[onChange, theme]
|
|
@@ -1413,6 +2135,7 @@ function ThemeEditorInner({
|
|
|
1413
2135
|
a.click();
|
|
1414
2136
|
URL.revokeObjectURL(url);
|
|
1415
2137
|
}, [theme]);
|
|
2138
|
+
const [importError, setImportError] = react.useState(null);
|
|
1416
2139
|
const importJson = react.useCallback(() => {
|
|
1417
2140
|
const input = document.createElement("input");
|
|
1418
2141
|
input.type = "file";
|
|
@@ -1424,10 +2147,16 @@ function ThemeEditorInner({
|
|
|
1424
2147
|
reader.onload = () => {
|
|
1425
2148
|
try {
|
|
1426
2149
|
const parsed = JSON.parse(reader.result);
|
|
2150
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed) || !("colors" in parsed || "typography" in parsed || "shape" in parsed || "spacing" in parsed || "layout" in parsed)) {
|
|
2151
|
+
setImportError("Invalid theme file: expected an object with colors, typography, shape, spacing, or layout.");
|
|
2152
|
+
return;
|
|
2153
|
+
}
|
|
2154
|
+
setImportError(null);
|
|
1427
2155
|
setTheme(parsed);
|
|
1428
2156
|
setPresetKey("custom");
|
|
1429
|
-
onChange?.(parsed);
|
|
2157
|
+
onChange?.(parsed, "custom");
|
|
1430
2158
|
} catch {
|
|
2159
|
+
setImportError("Failed to parse JSON file. Please check the file format.");
|
|
1431
2160
|
}
|
|
1432
2161
|
};
|
|
1433
2162
|
reader.readAsText(file);
|
|
@@ -1441,7 +2170,7 @@ function ThemeEditorInner({
|
|
|
1441
2170
|
importCssFile(theme, (merged) => {
|
|
1442
2171
|
setTheme(merged);
|
|
1443
2172
|
setPresetKey("custom");
|
|
1444
|
-
onChange?.(merged);
|
|
2173
|
+
onChange?.(merged, "custom");
|
|
1445
2174
|
});
|
|
1446
2175
|
}, [theme, onChange]);
|
|
1447
2176
|
const currentSection = react.useMemo(
|
|
@@ -1502,9 +2231,13 @@ function ThemeEditorInner({
|
|
|
1502
2231
|
children: "Compare"
|
|
1503
2232
|
}
|
|
1504
2233
|
),
|
|
1505
|
-
onSave && /* @__PURE__ */ jsxRuntime.jsx("button", { onClick: () => onSave(theme), className: "fcte-btn fcte-btn--primary", children: "Save" })
|
|
2234
|
+
onSave && /* @__PURE__ */ jsxRuntime.jsx("button", { onClick: () => onSave(theme, presetKey), className: "fcte-btn fcte-btn--primary", children: "Save" })
|
|
1506
2235
|
] })
|
|
1507
2236
|
] }),
|
|
2237
|
+
importError && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "fcte-import-error", role: "alert", children: [
|
|
2238
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: importError }),
|
|
2239
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { onClick: () => setImportError(null), className: "fcte-import-error__close", children: "\xD7" })
|
|
2240
|
+
] }),
|
|
1508
2241
|
showPalette && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1509
2242
|
PaletteGenerator,
|
|
1510
2243
|
{
|
|
@@ -1512,7 +2245,7 @@ function ThemeEditorInner({
|
|
|
1512
2245
|
onApply: (newTheme) => {
|
|
1513
2246
|
setTheme(newTheme);
|
|
1514
2247
|
setPresetKey("custom");
|
|
1515
|
-
onChange?.(newTheme);
|
|
2248
|
+
onChange?.(newTheme, "custom");
|
|
1516
2249
|
setShowPalette(false);
|
|
1517
2250
|
},
|
|
1518
2251
|
onClose: () => setShowPalette(false)
|
|
@@ -1538,6 +2271,8 @@ function ThemeEditorInner({
|
|
|
1538
2271
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "fcte-fields", children: currentSection.fields.map((field) => {
|
|
1539
2272
|
const val = sectionValues[field.key];
|
|
1540
2273
|
if (field.kind === "color") {
|
|
2274
|
+
const colorVal = typeof val === "string" ? val : "#000000";
|
|
2275
|
+
const isInvalid = colorVal.length > 0 && !isValidHex(colorVal);
|
|
1541
2276
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "fcte-field", children: [
|
|
1542
2277
|
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "fcte-field__label", children: field.label }),
|
|
1543
2278
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "fcte-field__color-row", children: [
|
|
@@ -1545,7 +2280,7 @@ function ThemeEditorInner({
|
|
|
1545
2280
|
"input",
|
|
1546
2281
|
{
|
|
1547
2282
|
type: "color",
|
|
1548
|
-
value:
|
|
2283
|
+
value: isValidHex(colorVal) ? colorVal : "#000000",
|
|
1549
2284
|
onChange: (e) => updateField(currentSection.themeKey, field.key, e.target.value),
|
|
1550
2285
|
className: "fcte-field__swatch"
|
|
1551
2286
|
}
|
|
@@ -1554,10 +2289,24 @@ function ThemeEditorInner({
|
|
|
1554
2289
|
"input",
|
|
1555
2290
|
{
|
|
1556
2291
|
type: "text",
|
|
1557
|
-
value:
|
|
1558
|
-
onChange: (e) =>
|
|
1559
|
-
|
|
1560
|
-
|
|
2292
|
+
value: colorVal,
|
|
2293
|
+
onChange: (e) => {
|
|
2294
|
+
const v = e.target.value;
|
|
2295
|
+
if (isValidHex(v)) {
|
|
2296
|
+
updateField(currentSection.themeKey, field.key, v);
|
|
2297
|
+
} else {
|
|
2298
|
+
setTheme((prev) => ({
|
|
2299
|
+
...prev,
|
|
2300
|
+
[currentSection.themeKey]: {
|
|
2301
|
+
...prev[currentSection.themeKey],
|
|
2302
|
+
[field.key]: v
|
|
2303
|
+
}
|
|
2304
|
+
}));
|
|
2305
|
+
}
|
|
2306
|
+
},
|
|
2307
|
+
className: `fcte-field__text${isInvalid ? " fcte-field__text--invalid" : ""}`,
|
|
2308
|
+
spellCheck: false,
|
|
2309
|
+
placeholder: "#RRGGBB"
|
|
1561
2310
|
}
|
|
1562
2311
|
)
|
|
1563
2312
|
] })
|
|
@@ -1586,9 +2335,16 @@ function ThemeEditorInner({
|
|
|
1586
2335
|
{
|
|
1587
2336
|
type: "number",
|
|
1588
2337
|
value: typeof val === "number" ? val : 0,
|
|
1589
|
-
onChange: (e) =>
|
|
2338
|
+
onChange: (e) => {
|
|
2339
|
+
let n = Math.round(Number(e.target.value));
|
|
2340
|
+
if (isNaN(n)) n = 0;
|
|
2341
|
+
if (field.min != null) n = Math.max(field.min, n);
|
|
2342
|
+
if (field.max != null) n = Math.min(field.max, n);
|
|
2343
|
+
updateField(currentSection.themeKey, field.key, n);
|
|
2344
|
+
},
|
|
1590
2345
|
min: field.min,
|
|
1591
2346
|
max: field.max,
|
|
2347
|
+
step: 1,
|
|
1592
2348
|
className: "fcte-field__number"
|
|
1593
2349
|
}
|
|
1594
2350
|
),
|
|
@@ -1606,7 +2362,8 @@ function ThemeEditorInner({
|
|
|
1606
2362
|
onChange: (e) => updateField(currentSection.themeKey, field.key, e.target.value),
|
|
1607
2363
|
placeholder: field.placeholder,
|
|
1608
2364
|
className: "fcte-field__text",
|
|
1609
|
-
spellCheck: false
|
|
2365
|
+
spellCheck: false,
|
|
2366
|
+
maxLength: 200
|
|
1610
2367
|
}
|
|
1611
2368
|
)
|
|
1612
2369
|
] }, field.key);
|