@behavioral-agentic-design-system/core 0.5.0 → 0.6.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.
Files changed (42) hide show
  1. package/package.json +15 -8
  2. package/scripts/build-fonts.cjs +90 -0
  3. package/scripts/build-tokens.cjs +84 -8
  4. package/src/api/brand-fonts.ts +280 -0
  5. package/src/api/brand-mark.ts +146 -0
  6. package/src/api/layers/file.ts +4 -2
  7. package/src/api/layers.ts +23 -1
  8. package/src/app/font-ready.tsx +1 -1
  9. package/src/app/layout.tsx +3 -9
  10. package/src/app/preview/cards/page.tsx +1 -1
  11. package/src/app/preview/login/page.tsx +5 -0
  12. package/src/app/shell.tsx +90 -29
  13. package/src/components/admin-menu.stories.tsx +68 -0
  14. package/src/components/admin-menu.tsx +59 -0
  15. package/src/components/brand-mark.tsx +64 -0
  16. package/src/components/customize/brand-mark-section.tsx +265 -0
  17. package/src/components/customize/font-pickers.tsx +293 -0
  18. package/src/components/customize/save-bar.tsx +11 -5
  19. package/src/components/customize-tab.tsx +329 -24
  20. package/src/components/dev-identity-badge.tsx +92 -0
  21. package/src/components/home-tab.tsx +1022 -374
  22. package/src/components/layers-tab.tsx +38 -9
  23. package/src/components/ui/alert.tsx +10 -2
  24. package/src/components/ui/button.tsx +1 -1
  25. package/src/components/ui/calendar.tsx +1 -1
  26. package/src/components/ui/chart.tsx +13 -3
  27. package/src/components/ui/checkbox.tsx +1 -1
  28. package/src/components/ui/radio-group.tsx +1 -1
  29. package/src/components/ui/sidebar.tsx +6 -1
  30. package/src/components/ui/sonner.tsx +18 -0
  31. package/src/components/ui/switch.tsx +7 -1
  32. package/src/components/ui/tabs.tsx +1 -1
  33. package/src/hooks/use-global-brand-mark.ts +64 -0
  34. package/src/hooks/use-global-mono-font.ts +13 -3
  35. package/src/hooks/use-global-primary-color.ts +145 -8
  36. package/src/hooks/use-global-sans-font.ts +5 -3
  37. package/src/hooks/use-global-serif-font.ts +14 -4
  38. package/src/lib/storage.ts +31 -2
  39. package/src/lib/svg-sanitize.ts +272 -0
  40. package/src/styles.css +76 -46
  41. package/src/tokens.default.json +4 -4
  42. package/src/tokens.json +172 -78
package/src/tokens.json CHANGED
@@ -68,12 +68,17 @@
68
68
  "300": {
69
69
  "$value": "#7292A1",
70
70
  "$type": "color",
71
- "$description": "Mid blue-gray — input borders on dark backgrounds"
71
+ "$description": "Mid blue-gray — focus rings and other lifted UI on dark backgrounds"
72
+ },
73
+ "400": {
74
+ "$value": "#527081",
75
+ "$type": "color",
76
+ "$description": "Slate-blue — default borders/dividers on dark backgrounds (oklch L 0.485). ~3.5:1 on card, ~3.7:1 on page bg. AAA non-text."
72
77
  },
73
78
  "500": {
74
79
  "$value": "#324852",
75
80
  "$type": "color",
76
- "$description": "Deep blue-gray — default borders/dividers on dark backgrounds"
81
+ "$description": "Deep blue-gray — reserved for darker UI accents, not the default border (that's slate.400)."
77
82
  }
78
83
  },
79
84
  "cream": {
@@ -158,14 +163,14 @@
158
163
  },
159
164
  "fontFamily": {
160
165
  "sans": {
161
- "$value": "'Hyperlegible Sans', ui-sans-serif, sans-serif, system-ui",
166
+ "$value": "'Season', 'Hyperlegible Sans', ui-sans-serif, sans-serif, system-ui",
162
167
  "$type": "fontFamily",
163
- "$description": "Primary sans (body, UI). Hyperlegible Sans is the BADS default — production-safe and accessibility-friendly. Override per client."
168
+ "$description": "Primary sans (body, UI). Season is the Swimtopia default — brand-forward with Hyperlegible Sans as the safe fallback."
164
169
  },
165
170
  "serif": {
166
- "$value": "ui-serif, Georgia, serif",
171
+ "$value": "'Season Serif', 'Season', ui-serif, Georgia, serif",
167
172
  "$type": "fontFamily",
168
- "$description": "Display/serif fallback stack. No default brand serif — clients should override."
173
+ "$description": "Primary serif stack. Season Serif is the Swimtopia default display face."
169
174
  },
170
175
  "mono": {
171
176
  "$value": "'JetBrains Mono', ui-monospace, monospace",
@@ -754,7 +759,7 @@
754
759
  "$type": "color"
755
760
  },
756
761
  "primary": {
757
- "$value": "#1F1F1F",
762
+ "$value": "#025FFF",
758
763
  "$type": "color",
759
764
  "$description": "Primary brand. Override per client. Default = shadcn near-black."
760
765
  },
@@ -763,6 +768,11 @@
763
768
  "$type": "color",
764
769
  "$description": "Text on primary. Auto-derived from luminance for custom colors."
765
770
  },
771
+ "link": {
772
+ "$value": "var(--primary)",
773
+ "$type": "color",
774
+ "$description": "Inline link / Button variant=link color. Defaults to --primary so links inherit the brand. Forks whose brand primary fails contrast against the surface (e.g. blurple primary on dark background) can override --link in their theme without monkey-patching the Button component."
775
+ },
766
776
  "secondary": {
767
777
  "$value": "oklch(0.9700 0 0)",
768
778
  "$type": "color"
@@ -814,33 +824,34 @@
814
824
  "$description": "Focus ring base. AAA non-text + 2.4.13: ≥3:1 on every surface. Tracks --primary when brand color changes (luminance-clamped to keep 3:1)."
815
825
  },
816
826
  "chart-1": {
817
- "$value": "oklch(0.6200 0.2000 220)",
827
+ "$value": "oklch(0.5836 0.2469 264.05)",
818
828
  "$type": "color",
819
- "$description": "Tuned for AAA 3:1 on white card. Electric cyan-blue."
829
+ "$description": "Static fallback for series 1 — Pool Blue. Runtime derives from --primary; this value is the literal pool blue and is what audit/legacy browsers see."
820
830
  },
821
831
  "chart-2": {
822
- "$value": "oklch(0.6200 0.2200 145)",
832
+ "$value": "oklch(0.5000 0.2345 264.05)",
823
833
  "$type": "color",
824
- "$description": "Tuned for AAA 3:1 on white card. Spring green."
834
+ "$description": "Static fallback for series 2 — pool blue darkened (L 0.50, chroma * 0.95)."
825
835
  },
826
836
  "chart-3": {
827
- "$value": "oklch(0.6500 0.1800 88)",
837
+ "$value": "oklch(0.4200 0.1975 264.05)",
828
838
  "$type": "color",
829
- "$description": "Tuned for AAA 3:1 on white card. Bright gold."
839
+ "$description": "Static fallback for series 3 — pool blue darkened (L 0.42, chroma * 0.80)."
830
840
  },
831
841
  "chart-4": {
832
- "$value": "oklch(0.6000 0.2600 340)",
842
+ "$value": "oklch(0.3400 0.1481 264.05)",
833
843
  "$type": "color",
834
- "$description": "Tuned for AAA 3:1 on white card. Hot fuchsia."
844
+ "$description": "Static fallback for series 4 — pool blue darkened (L 0.34, chroma * 0.60)."
835
845
  },
836
846
  "chart-5": {
837
- "$value": "oklch(0.6200 0.2200 25)",
847
+ "$value": "oklch(0.2700 0.0988 264.05)",
838
848
  "$type": "color",
839
- "$description": "Tuned for AAA 3:1 on white card. Coral."
849
+ "$description": "Static fallback for series 5 — lands near brand Navy (L 0.27, chroma * 0.40)."
840
850
  },
841
851
  "sidebar": {
842
- "$value": "oklch(0.9850 0 0)",
843
- "$type": "color"
852
+ "$value": "oklch(0.9700 0 0)",
853
+ "$type": "color",
854
+ "$description": "Light mode sidebar surface — slightly darker than page background (1.0) so the sidebar reads as a distinct panel, not blank space. Matches --muted for a calm off-white."
844
855
  },
845
856
  "sidebar-foreground": {
846
857
  "$value": "oklch(0.1450 0 0)",
@@ -923,27 +934,31 @@
923
934
  },
924
935
  "dark": {
925
936
  "background": {
926
- "$value": "oklch(0.1450 0 0)",
927
- "$type": "color"
937
+ "$value": "#040D20",
938
+ "$type": "color",
939
+ "$description": "Page background — deepest brand blue (blue.950). Swimtopia brand surfaces are navy-tinted, not charcoal; black is reserved for text."
928
940
  },
929
941
  "foreground": {
930
- "$value": "oklch(0.9850 0 0)",
931
- "$type": "color"
942
+ "$value": "#FAFCFC",
943
+ "$type": "color",
944
+ "$description": "Default text on dark navy surfaces (off-white, neutral.50)."
932
945
  },
933
946
  "card": {
934
- "$value": "oklch(0.2050 0 0)",
935
- "$type": "color"
947
+ "$value": "#09142A",
948
+ "$type": "color",
949
+ "$description": "Card surface — deep navy (blue.850), one step lighter than page bg for elevation."
936
950
  },
937
951
  "card-foreground": {
938
- "$value": "oklch(0.9850 0 0)",
952
+ "$value": "#FAFCFC",
939
953
  "$type": "color"
940
954
  },
941
955
  "popover": {
942
- "$value": "oklch(0.2690 0 0)",
943
- "$type": "color"
956
+ "$value": "#0E295E",
957
+ "$type": "color",
958
+ "$description": "Popover/overlay surface — navy (blue.700), lifted from card for layered overlays."
944
959
  },
945
960
  "popover-foreground": {
946
- "$value": "oklch(0.9850 0 0)",
961
+ "$value": "#FAFCFC",
947
962
  "$type": "color"
948
963
  },
949
964
  "primary": {
@@ -956,29 +971,37 @@
956
971
  "$type": "color",
957
972
  "$description": "Near-black text on the inverted dark-mode primary surface."
958
973
  },
974
+ "link": {
975
+ "$value": "var(--primary)",
976
+ "$type": "color",
977
+ "$description": "See light-mode --link. In dark mode --primary is near-white (#FAFAFA), so the default link reads at ~19:1 on the dark background. Forks with a dark-mode brand primary that fails contrast (e.g. mid-saturation blurple) should override --link to a lifted variant."
978
+ },
959
979
  "secondary": {
960
- "$value": "oklch(0.2690 0 0)",
961
- "$type": "color"
980
+ "$value": "#0A1D42",
981
+ "$type": "color",
982
+ "$description": "Secondary surface — mid-deep navy (blue.800)."
962
983
  },
963
984
  "secondary-foreground": {
964
- "$value": "oklch(0.9850 0 0)",
985
+ "$value": "#FAFCFC",
965
986
  "$type": "color"
966
987
  },
967
988
  "muted": {
968
- "$value": "oklch(0.2690 0 0)",
969
- "$type": "color"
989
+ "$value": "#0A1D42",
990
+ "$type": "color",
991
+ "$description": "Muted surface — mid-deep navy (blue.800), same family as secondary."
970
992
  },
971
993
  "muted-foreground": {
972
- "$value": "oklch(0.7800 0 0)",
994
+ "$value": "#B8D6E5",
973
995
  "$type": "color",
974
- "$description": "Captions, labels, secondary text. ~9:1 on dark bg (AAA)."
996
+ "$description": "Captions, labels, secondary text — slate.100. 12.5:1 on background (AAA)."
975
997
  },
976
998
  "accent": {
977
- "$value": "oklch(0.3710 0 0)",
978
- "$type": "color"
999
+ "$value": "#0E295E",
1000
+ "$type": "color",
1001
+ "$description": "Accent surface — navy (blue.700)."
979
1002
  },
980
1003
  "accent-foreground": {
981
- "$value": "oklch(0.9850 0 0)",
1004
+ "$value": "#FAFCFC",
982
1005
  "$type": "color"
983
1006
  },
984
1007
  "destructive": {
@@ -992,51 +1015,52 @@
992
1015
  "$description": "Dark text on light-red destructive surface for AAA 7:1 in dark mode."
993
1016
  },
994
1017
  "border": {
995
- "$value": "oklch(0.5500 0 0)",
1018
+ "$value": "rgb(255 255 255 / 0.10)",
996
1019
  "$type": "color",
997
- "$description": "AAA non-text: ≥3:1 on dark background AND card."
1020
+ "$description": "Default borders/dividers on dark navy surfaces. Transparent white so it reads as a quiet inner edge on any dark surface — matches the swimtopia-prototypes `ring-white/10` chrome treatment. Composites to ~#222C3F over the dark card bg. (Below WCAG AAA 3:1 against the card; intentional — borders here are decorative chrome, not interactive affordances.)"
998
1021
  },
999
1022
  "input": {
1000
- "$value": "oklch(0.5500 0 0)",
1023
+ "$value": "rgb(255 255 255 / 0.10)",
1001
1024
  "$type": "color",
1002
- "$description": "AAA non-text: ≥3:1 on dark card."
1025
+ "$description": "Input borders on dark navy — same transparent-white treatment as `border` so form fields read as quiet inner edges. Inputs that need stronger affordance use the focus ring (--ring) on interaction."
1003
1026
  },
1004
1027
  "ring": {
1005
- "$value": "oklch(0.7000 0 0)",
1028
+ "$value": "#B8D6E5",
1006
1029
  "$type": "color",
1007
- "$description": "Focus ring base, dark mode. AAA non-text 3:1 on dark."
1030
+ "$description": "Focus ring base, dark mode — slate.100. 12.5:1 on background (well above AAA non-text floor)."
1008
1031
  },
1009
1032
  "chart-1": {
1010
- "$value": "oklch(0.7800 0.1800 220)",
1033
+ "$value": "oklch(0.7800 0.1850 264.05)",
1011
1034
  "$type": "color",
1012
- "$description": "Tuned for AAA 3:1 on dark card. Bright cyan-blue."
1035
+ "$description": "Static fallback for series 1 — light pool blue tint (dark mode anchor)."
1013
1036
  },
1014
1037
  "chart-2": {
1015
- "$value": "oklch(0.8000 0.2000 145)",
1038
+ "$value": "oklch(0.7000 0.2100 264.05)",
1016
1039
  "$type": "color",
1017
- "$description": "Tuned for AAA 3:1 on dark card. Bright spring green."
1040
+ "$description": "Static fallback for series 2 — pool blue (L 0.70, chroma * 0.95)."
1018
1041
  },
1019
1042
  "chart-3": {
1020
- "$value": "oklch(0.8500 0.1700 90)",
1043
+ "$value": "oklch(0.6200 0.1975 264.05)",
1021
1044
  "$type": "color",
1022
- "$description": "Tuned for AAA 3:1 on dark card. Bright gold."
1045
+ "$description": "Static fallback for series 3 — pool blue darkened (L 0.62, chroma * 0.80)."
1023
1046
  },
1024
1047
  "chart-4": {
1025
- "$value": "oklch(0.7600 0.2200 340)",
1048
+ "$value": "oklch(0.5600 0.1481 264.05)",
1026
1049
  "$type": "color",
1027
- "$description": "Tuned for AAA 3:1 on dark card. Bright fuchsia."
1050
+ "$description": "Static fallback for series 4 — pool blue darkened (L 0.56, chroma * 0.60)."
1028
1051
  },
1029
1052
  "chart-5": {
1030
- "$value": "oklch(0.7800 0.1800 25)",
1053
+ "$value": "oklch(0.5200 0.0988 264.05)",
1031
1054
  "$type": "color",
1032
- "$description": "Tuned for AAA 3:1 on dark card. Bright coral."
1055
+ "$description": "Static fallback for series 5 — darkest pool blue that still hits AAA 3:1 on dark card (L 0.52, chroma * 0.40)."
1033
1056
  },
1034
1057
  "sidebar": {
1035
- "$value": "oklch(0.2050 0 0)",
1036
- "$type": "color"
1058
+ "$value": "#09142A",
1059
+ "$type": "color",
1060
+ "$description": "Sidebar surface — deep navy (blue.850), matches card so the sidebar reads as a peer surface."
1037
1061
  },
1038
1062
  "sidebar-foreground": {
1039
- "$value": "oklch(0.9850 0 0)",
1063
+ "$value": "#FAFCFC",
1040
1064
  "$type": "color"
1041
1065
  },
1042
1066
  "sidebar-primary": {
@@ -1045,26 +1069,27 @@
1045
1069
  "$description": "Tuned for AAA 7:1 with white foreground."
1046
1070
  },
1047
1071
  "sidebar-primary-foreground": {
1048
- "$value": "oklch(0.9850 0 0)",
1072
+ "$value": "#FAFCFC",
1049
1073
  "$type": "color"
1050
1074
  },
1051
1075
  "sidebar-accent": {
1052
- "$value": "oklch(0.2690 0 0)",
1053
- "$type": "color"
1076
+ "$value": "#0E295E",
1077
+ "$type": "color",
1078
+ "$description": "Sidebar accent surface — navy (blue.700)."
1054
1079
  },
1055
1080
  "sidebar-accent-foreground": {
1056
- "$value": "oklch(0.9850 0 0)",
1081
+ "$value": "#FAFCFC",
1057
1082
  "$type": "color"
1058
1083
  },
1059
1084
  "sidebar-border": {
1060
- "$value": "oklch(0.5500 0 0)",
1085
+ "$value": "{color.primitive.slate.400}",
1061
1086
  "$type": "color",
1062
- "$description": "AAA non-text 3:1 on dark sidebar."
1087
+ "$description": "AAA non-text ≥3:1 on dark sidebar — aliased to slate.400."
1063
1088
  },
1064
1089
  "sidebar-ring": {
1065
- "$value": "oklch(0.7000 0 0)",
1090
+ "$value": "#B8D6E5",
1066
1091
  "$type": "color",
1067
- "$description": "AAA non-text 3:1 on dark sidebar."
1092
+ "$description": "Focus ring on dark sidebar — slate.100, well above AAA non-text floor."
1068
1093
  }
1069
1094
  }
1070
1095
  },
@@ -1073,43 +1098,112 @@
1073
1098
  "light": {
1074
1099
  "$value": "0.58",
1075
1100
  "$type": "number",
1076
- "$description": "Absolute L for chart series in light mode (oklch). Tuned so all five series sit at readable contrast on white card surfaces."
1101
+ "$description": "Fallback absolute L for chart series in light mode (oklch). Used only when lightnessSteps is not defined."
1077
1102
  },
1078
1103
  "dark": {
1079
1104
  "$value": "0.78",
1080
1105
  "$type": "number",
1081
- "$description": "Absolute L for chart series in dark mode. Lifted from light so charts stay legible on near-black backgrounds."
1106
+ "$description": "Fallback absolute L for chart series in dark mode. Used only when lightnessSteps is not defined."
1107
+ }
1108
+ },
1109
+ "lightnessSteps": {
1110
+ "$description": "Per-series absolute L in oklch. When defined, overrides chart.lightness for monochromatic ramp palettes. Light mode starts at brand L and gets darker; dark mode starts at the lightest readable tint and gets darker within the AAA-readable range.",
1111
+ "light": {
1112
+ "step1": {
1113
+ "$value": "0.58",
1114
+ "$type": "number"
1115
+ },
1116
+ "step2": {
1117
+ "$value": "0.50",
1118
+ "$type": "number"
1119
+ },
1120
+ "step3": {
1121
+ "$value": "0.42",
1122
+ "$type": "number"
1123
+ },
1124
+ "step4": {
1125
+ "$value": "0.34",
1126
+ "$type": "number"
1127
+ },
1128
+ "step5": {
1129
+ "$value": "0.27",
1130
+ "$type": "number"
1131
+ }
1132
+ },
1133
+ "dark": {
1134
+ "step1": {
1135
+ "$value": "0.78",
1136
+ "$type": "number"
1137
+ },
1138
+ "step2": {
1139
+ "$value": "0.70",
1140
+ "$type": "number"
1141
+ },
1142
+ "step3": {
1143
+ "$value": "0.62",
1144
+ "$type": "number"
1145
+ },
1146
+ "step4": {
1147
+ "$value": "0.56",
1148
+ "$type": "number"
1149
+ },
1150
+ "step5": {
1151
+ "$value": "0.52",
1152
+ "$type": "number",
1153
+ "$description": "Floor — any lower fails AAA 3:1 on the dark card."
1154
+ }
1082
1155
  }
1083
1156
  },
1084
1157
  "hueRotation": {
1085
1158
  "step1": {
1086
1159
  "$value": "0",
1087
1160
  "$type": "number",
1088
- "$description": "Series 1 — hue inherited from --primary as-is."
1161
+ "$description": "Monochromatic ramp — all five series inherit --primary's hue."
1089
1162
  },
1090
1163
  "step2": {
1091
- "$value": "35",
1092
- "$type": "number",
1093
- "$description": "Series 2 — primary hue + 35deg, chroma damped to 0.65× for pairing."
1164
+ "$value": "0",
1165
+ "$type": "number"
1094
1166
  },
1095
1167
  "step3": {
1096
- "$value": "70",
1168
+ "$value": "0",
1097
1169
  "$type": "number"
1098
1170
  },
1099
1171
  "step4": {
1100
- "$value": "105",
1172
+ "$value": "0",
1101
1173
  "$type": "number"
1102
1174
  },
1103
1175
  "step5": {
1104
- "$value": "140",
1105
- "$type": "number",
1106
- "$description": "Series 5 — final hue rotation, max separation from primary."
1176
+ "$value": "0",
1177
+ "$type": "number"
1178
+ }
1179
+ },
1180
+ "chromaSteps": {
1181
+ "$description": "Per-series chroma multiplier on --primary's chroma. Tapers saturation as L drops so deep shades don't go neon and out-of-gamut.",
1182
+ "step1": {
1183
+ "$value": "1.00",
1184
+ "$type": "number"
1185
+ },
1186
+ "step2": {
1187
+ "$value": "0.95",
1188
+ "$type": "number"
1189
+ },
1190
+ "step3": {
1191
+ "$value": "0.80",
1192
+ "$type": "number"
1193
+ },
1194
+ "step4": {
1195
+ "$value": "0.60",
1196
+ "$type": "number"
1197
+ },
1198
+ "step5": {
1199
+ "$value": "0.40",
1200
+ "$type": "number"
1107
1201
  }
1108
1202
  },
1109
1203
  "chroma2Damping": {
1110
1204
  "$value": "0.65",
1111
1205
  "$type": "number",
1112
- "$description": "Chroma multiplier on series 2 only (others inherit primary chroma)."
1206
+ "$description": "Legacy chroma multiplier on series 2 only. Ignored when chromaSteps is defined."
1113
1207
  }
1114
1208
  }
1115
1209
  }