@designa8/vibedesign-v6 1.20.20 → 2.1.2

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 (125) hide show
  1. package/README.md +1 -1
  2. package/dist/fonts/plusjakartasans/PlusJakartaSans-Italic[wght].ttf +0 -0
  3. package/dist/fonts/plusjakartasans/PlusJakartaSans[wght].ttf +0 -0
  4. package/dist/index.cjs +12027 -4942
  5. package/dist/index.js +12089 -5004
  6. package/dist/styles.css +1393 -97
  7. package/package.json +116 -1
  8. package/src/atoms/AgentQuestionCard/AgentQuestionCard.tsx +567 -0
  9. package/src/atoms/AgentQuestionCard/index.ts +6 -0
  10. package/src/atoms/AgentQuestionCard/preview.tsx +199 -0
  11. package/src/atoms/AppLayout/AppLayout.tsx +85 -22
  12. package/src/atoms/AppLayout/preview.tsx +4 -0
  13. package/src/atoms/AppSidebar/AppSidebar.tsx +224 -138
  14. package/src/atoms/AppSidebar/index.ts +1 -1
  15. package/src/atoms/AppSidebar/preview.tsx +61 -8
  16. package/src/atoms/AppSidebarMobile/AppSidebarMobile.tsx +242 -173
  17. package/src/atoms/AppSidebarMobile/preview.tsx +59 -89
  18. package/src/atoms/AuthLogin/AuthLogin.tsx +86 -49
  19. package/src/atoms/AuthLogin/preview.tsx +16 -0
  20. package/src/atoms/AuthSignUp/AuthSignUp.tsx +206 -126
  21. package/src/atoms/AuthSignUp/preview.tsx +10 -0
  22. package/src/atoms/BottomSheet/BottomSheet.tsx +199 -0
  23. package/src/atoms/BottomSheet/index.ts +2 -0
  24. package/src/atoms/BottomSheet/preview.tsx +50 -0
  25. package/src/atoms/Button/Button.tsx +19 -3
  26. package/src/atoms/Button/preview.tsx +2 -1
  27. package/src/atoms/ChatHistorySidebar/ChatHistorySidebar.tsx +160 -84
  28. package/src/atoms/ChatHistorySidebar/preview.tsx +81 -42
  29. package/src/atoms/ChatScreen/ChatScreen.tsx +298 -33
  30. package/src/atoms/ChatScreen/preview.tsx +54 -90
  31. package/src/atoms/Chip/Chip.tsx +81 -33
  32. package/src/atoms/Chip/preview.tsx +39 -21
  33. package/src/atoms/CodeEditor/CodeEditor.tsx +10 -4
  34. package/src/atoms/ComponentActionsSheet/ComponentActionsSheet.tsx +165 -0
  35. package/src/atoms/ComponentActionsSheet/index.ts +7 -0
  36. package/src/atoms/ComponentActionsSheet/preview.tsx +67 -0
  37. package/src/atoms/ComponentCard/ComponentCard.tsx +17 -35
  38. package/src/atoms/ComponentCard/preview.tsx +9 -9
  39. package/src/atoms/DesignSystemLoader/DesignSystemLoader.tsx +153 -0
  40. package/src/atoms/DesignSystemLoader/index.ts +2 -0
  41. package/src/atoms/DesignSystemLoader/preview.tsx +19 -0
  42. package/src/atoms/DesignSystemShowcase/DesignSystemShowcase.tsx +410 -0
  43. package/src/atoms/DesignSystemShowcase/index.ts +6 -0
  44. package/src/atoms/DesignSystemShowcase/preview.tsx +22 -0
  45. package/src/atoms/DesignTokensPanel/DesignTokensPanel.data.ts +254 -0
  46. package/src/atoms/DesignTokensPanel/DesignTokensPanel.tsx +946 -0
  47. package/src/atoms/DesignTokensPanel/index.ts +9 -0
  48. package/src/atoms/DesignTokensPanel/preview.tsx +39 -0
  49. package/src/atoms/ExpandableMessage/ExpandableMessage.tsx +239 -0
  50. package/src/atoms/ExpandableMessage/fix-link-note.txt +3 -0
  51. package/src/atoms/ExpandableMessage/index.ts +2 -0
  52. package/src/atoms/ExpandableMessage/markdown.tsx +310 -0
  53. package/src/atoms/ExpandableMessage/preview.tsx +83 -0
  54. package/src/atoms/ExportDesignMdModal/ExportDesignMdModal.tsx +6 -1
  55. package/src/atoms/FilterTabBar/FilterTabBar.tsx +2 -2
  56. package/src/atoms/FontCombobox/FontCombobox.tsx +655 -0
  57. package/src/atoms/FontCombobox/index.ts +6 -0
  58. package/src/atoms/FontCombobox/preview.tsx +111 -0
  59. package/src/atoms/HomePageTemplate/HomePageTemplate.tsx +894 -96
  60. package/src/atoms/HomePageTemplate/preview.tsx +4 -0
  61. package/src/atoms/Icon/Icon.tsx +17 -11
  62. package/src/atoms/Icon/icons.data.ts +34 -0
  63. package/src/atoms/Input/Input.tsx +37 -21
  64. package/src/atoms/LandingHero/LandingHero.tsx +545 -0
  65. package/src/atoms/LandingHero/index.ts +6 -0
  66. package/src/atoms/LandingHero/preview.tsx +88 -0
  67. package/src/atoms/MarketingFooter/MarketingFooter.tsx +215 -0
  68. package/src/atoms/MarketingFooter/index.ts +7 -0
  69. package/src/atoms/MarketingFooter/preview.tsx +28 -0
  70. package/src/atoms/MarketingNavbar/MarketingNavbar.tsx +451 -0
  71. package/src/atoms/MarketingNavbar/index.ts +7 -0
  72. package/src/atoms/MarketingNavbar/preview.tsx +109 -0
  73. package/src/atoms/Menu/Menu.tsx +1 -1
  74. package/src/atoms/MobileActionsDrawer/MobileActionsDrawer.tsx +548 -0
  75. package/src/atoms/MobileActionsDrawer/index.ts +9 -0
  76. package/src/atoms/MobileActionsDrawer/preview.tsx +109 -0
  77. package/src/atoms/Modal/Modal.tsx +77 -28
  78. package/src/atoms/PreviewDock/PreviewDock.tsx +119 -0
  79. package/src/atoms/PreviewDock/index.ts +2 -0
  80. package/src/atoms/PreviewDock/preview.tsx +30 -0
  81. package/src/atoms/PreviewToolbar/PreviewToolbar.tsx +47 -30
  82. package/src/atoms/PricingCard/PricingCard.tsx +15 -4
  83. package/src/atoms/PricingPageTemplate/PricingPageTemplate.tsx +109 -89
  84. package/src/atoms/ProjectSettingsModal/ProjectSettingsModal.tsx +314 -0
  85. package/src/atoms/ProjectSettingsModal/index.ts +2 -0
  86. package/src/atoms/ProjectSettingsModal/preview.tsx +130 -0
  87. package/src/atoms/ProjectSettingsModal/switch.snippet.txt +8 -0
  88. package/src/atoms/PromptInputBar/PromptInputBar.tsx +750 -302
  89. package/src/atoms/PromptInputBar/preview.tsx +64 -64
  90. package/src/atoms/SettingsPageTemplate/SettingsPageTemplate.tsx +272 -0
  91. package/src/atoms/SettingsPageTemplate/index.ts +2 -0
  92. package/src/atoms/SettingsPageTemplate/preview.tsx +29 -0
  93. package/src/atoms/SidebarUpgradeBanner/SidebarUpgradeBanner.tsx +178 -0
  94. package/src/atoms/SidebarUpgradeBanner/index.ts +2 -0
  95. package/src/atoms/SidebarUpgradeBanner/preview.tsx +47 -0
  96. package/src/atoms/SkeletonChip/SkeletonChip.tsx +198 -0
  97. package/src/atoms/SkeletonChip/index.ts +2 -0
  98. package/src/atoms/SkeletonChip/preview.tsx +44 -0
  99. package/src/atoms/TemplateHeader/TemplateHeader.tsx +129 -0
  100. package/src/atoms/TemplateHeader/index.ts +2 -0
  101. package/src/atoms/TemplateHeader/preview.tsx +39 -0
  102. package/src/atoms/TemplateHero/TemplateHero.tsx +286 -0
  103. package/src/atoms/TemplateHero/index.ts +2 -0
  104. package/src/atoms/TemplateHero/preview.tsx +32 -0
  105. package/src/atoms/TemplateSummary/TemplateSummary.tsx +85 -0
  106. package/src/atoms/TemplateSummary/index.ts +2 -0
  107. package/src/atoms/TemplateSummary/preview.tsx +10 -0
  108. package/src/atoms/Toast/Toast.tsx +178 -0
  109. package/src/atoms/Toast/index.ts +2 -0
  110. package/src/atoms/Toast/preview.tsx +100 -0
  111. package/src/atoms/TopNavbar/TopNavbar.tsx +145 -67
  112. package/src/atoms/TopNavbar/preview.tsx +13 -7
  113. package/src/atoms/TopupModal/TopupModal.tsx +94 -0
  114. package/src/atoms/TopupModal/index.ts +2 -0
  115. package/src/atoms/TopupModal/preview.tsx +22 -0
  116. package/src/atoms/UpgradeCard/UpgradeCard.tsx +124 -43
  117. package/src/atoms/UpgradeCard/index.ts +1 -1
  118. package/src/atoms/UpgradeCard/preview.tsx +7 -14
  119. package/src/atoms/UpgradeModal/UpgradeModal.tsx +192 -0
  120. package/src/atoms/UpgradeModal/index.ts +2 -0
  121. package/src/atoms/UpgradeModal/preview.tsx +41 -0
  122. package/src/index.ts +23 -0
  123. package/src/tokens.css +45 -7
  124. package/dist/fonts/inter/Inter-Italic[opsz,wght].ttf +0 -0
  125. package/dist/fonts/inter/Inter[opsz,wght].ttf +0 -0
@@ -0,0 +1,254 @@
1
+ export type ThemeId = "light" | "dark";
2
+ export type ThemeColors = Record<ThemeId, Record<string, string>>;
3
+
4
+ export interface ColorTokenDef {
5
+ id: string;
6
+ label: string;
7
+ description: string;
8
+ /** Token id this color is contrast-checked against. */
9
+ against?: string;
10
+ }
11
+
12
+ export interface ColorGroupDef {
13
+ id: string;
14
+ label: string;
15
+ against: string;
16
+ tokens: ColorTokenDef[];
17
+ }
18
+
19
+ export const COLOR_GROUPS: ColorGroupDef[] = [
20
+ {
21
+ id: "brand",
22
+ label: "Brand & accent",
23
+ against: "on-primary",
24
+ tokens: [
25
+ { id: "primary", label: "Primary", description: "Used for primary actions, links, and focused elements." },
26
+ { id: "primary-hover", label: "Primary hover", description: "Hover state of primary actions." },
27
+ { id: "primary-active", label: "Primary active", description: "Pressed state of primary actions." },
28
+ { id: "primary-disabled", label: "Primary disabled", description: "Disabled primary actions." },
29
+ { id: "primary-soft", label: "Primary soft", description: "Tinted fills behind selected items.", against: "ink" },
30
+ ],
31
+ },
32
+ {
33
+ id: "surface",
34
+ label: "Surface",
35
+ against: "ink",
36
+ tokens: [
37
+ { id: "canvas", label: "Canvas", description: "Page background." },
38
+ { id: "surface", label: "Surface", description: "Cards and panels." },
39
+ { id: "surface-soft", label: "Surface soft", description: "Inputs and hovered rows." },
40
+ { id: "surface-strong", label: "Surface strong", description: "Tracks, dividers and chips." },
41
+ ],
42
+ },
43
+ {
44
+ id: "text",
45
+ label: "Text",
46
+ against: "canvas",
47
+ tokens: [
48
+ { id: "ink", label: "Ink", description: "Headings and primary text." },
49
+ { id: "body", label: "Body", description: "Paragraph text." },
50
+ { id: "muted", label: "Muted", description: "Secondary text and labels." },
51
+ { id: "muted-soft", label: "Muted soft", description: "Placeholders and disabled text." },
52
+ ],
53
+ },
54
+ {
55
+ id: "border",
56
+ label: "Border",
57
+ against: "canvas",
58
+ tokens: [
59
+ { id: "hairline", label: "Hairline", description: "Default borders." },
60
+ { id: "hairline-soft", label: "Hairline soft", description: "Subtle separators." },
61
+ { id: "hairline-strong", label: "Hairline strong", description: "Emphasised borders." },
62
+ ],
63
+ },
64
+ {
65
+ id: "semantic",
66
+ label: "Semantic",
67
+ against: "canvas",
68
+ tokens: [
69
+ { id: "semantic-success", label: "Success", description: "Positive status." },
70
+ { id: "semantic-warning", label: "Warning", description: "Cautionary status." },
71
+ { id: "semantic-error", label: "Error", description: "Errors and destructive actions." },
72
+ { id: "semantic-info", label: "Info", description: "Informational status." },
73
+ ],
74
+ },
75
+ ];
76
+
77
+ /** Every token id the panel edits (plus the contrast partner `on-primary`). */
78
+ export const COLOR_TOKEN_IDS: string[] = [
79
+ "on-primary",
80
+ ...COLOR_GROUPS.flatMap((g) => g.tokens.map((t) => t.id)),
81
+ ];
82
+
83
+ /* ------------------------------------------------------------------ */
84
+ /* Typography */
85
+ /* ------------------------------------------------------------------ */
86
+
87
+ export interface TypeStyle {
88
+ fontSize: number;
89
+ fontWeight: number;
90
+ lineHeight: number;
91
+ letterSpacing: number;
92
+ /** Which font slot the role inherits. */
93
+ slot: "heading" | "body";
94
+ }
95
+
96
+ export type TypeScale = Record<string, TypeStyle>;
97
+
98
+ export const DEFAULT_TYPE_SCALE: TypeScale = {
99
+ "display-lg": { fontSize: 48, fontWeight: 700, lineHeight: 1.1, letterSpacing: -0.5, slot: "heading" },
100
+ "heading-lg": { fontSize: 32, fontWeight: 700, lineHeight: 1.2, letterSpacing: -0.25, slot: "heading" },
101
+ "heading-md": { fontSize: 24, fontWeight: 600, lineHeight: 1.3, letterSpacing: 0, slot: "heading" },
102
+ "heading-sm": { fontSize: 18, fontWeight: 600, lineHeight: 1.4, letterSpacing: 0, slot: "heading" },
103
+ "body-lg": { fontSize: 18, fontWeight: 400, lineHeight: 1.6, letterSpacing: 0, slot: "body" },
104
+ "body-md": { fontSize: 16, fontWeight: 500, lineHeight: 1.5, letterSpacing: 0, slot: "body" },
105
+ "body-sm": { fontSize: 14, fontWeight: 400, lineHeight: 1.5, letterSpacing: 0, slot: "body" },
106
+ caption: { fontSize: 12, fontWeight: 400, lineHeight: 1.4, letterSpacing: 0, slot: "body" },
107
+ };
108
+
109
+ export const FONT_OPTIONS: { label: string; value: string }[] = [
110
+ { label: "Plus Jakarta Sans", value: "Plus Jakarta Sans" },
111
+ { label: "DM Sans", value: "DM Sans" },
112
+ { label: "Manrope", value: "Manrope" },
113
+ { label: "Inter", value: "Inter" },
114
+ { label: "Lora", value: "Lora" },
115
+ { label: "Playfair Display", value: "Playfair Display" },
116
+ { label: "JetBrains Mono", value: "JetBrains Mono" },
117
+ ];
118
+
119
+ /* ------------------------------------------------------------------ */
120
+ /* Color math */
121
+ /* ------------------------------------------------------------------ */
122
+
123
+ export interface Hsv {
124
+ h: number;
125
+ s: number;
126
+ v: number;
127
+ }
128
+
129
+ export function clamp(n: number, min: number, max: number): number {
130
+ return Math.min(max, Math.max(min, n));
131
+ }
132
+
133
+ /** Returns "#RRGGBB" uppercase, or null when the text isn't a valid hex. */
134
+ export function parseHex(text: string, allowShort: boolean): string | null {
135
+ const t = text.trim().replace(/^#/, "");
136
+ if (/^[0-9a-fA-F]{6}$/.test(t)) return `#${t.toUpperCase()}`;
137
+ if (allowShort && /^[0-9a-fA-F]{3}$/.test(t)) {
138
+ return `#${t
139
+ .split("")
140
+ .map((c) => c + c)
141
+ .join("")
142
+ .toUpperCase()}`;
143
+ }
144
+ return null;
145
+ }
146
+
147
+ export function hexToRgb(hex: string): [number, number, number] {
148
+ const n = parseInt(hex.replace("#", ""), 16);
149
+ return [(n >> 16) & 255, (n >> 8) & 255, n & 255];
150
+ }
151
+
152
+ export function rgbToHex(r: number, g: number, b: number): string {
153
+ const to = (x: number) => Math.round(clamp(x, 0, 255)).toString(16).padStart(2, "0");
154
+ return `#${to(r)}${to(g)}${to(b)}`.toUpperCase();
155
+ }
156
+
157
+ export function hexToHsv(hex: string): Hsv {
158
+ const [r, g, b] = hexToRgb(hex).map((c) => c / 255);
159
+ const max = Math.max(r, g, b);
160
+ const min = Math.min(r, g, b);
161
+ const d = max - min;
162
+ let h = 0;
163
+ if (d !== 0) {
164
+ if (max === r) h = ((g - b) / d) % 6;
165
+ else if (max === g) h = (b - r) / d + 2;
166
+ else h = (r - g) / d + 4;
167
+ h *= 60;
168
+ if (h < 0) h += 360;
169
+ }
170
+ return { h, s: max === 0 ? 0 : (d / max) * 100, v: max * 100 };
171
+ }
172
+
173
+ export function hsvToHex({ h, s, v }: Hsv): string {
174
+ const S = s / 100;
175
+ const V = v / 100;
176
+ const c = V * S;
177
+ const x = c * (1 - Math.abs(((h / 60) % 2) - 1));
178
+ const m = V - c;
179
+ let rgb: [number, number, number] = [0, 0, 0];
180
+ if (h < 60) rgb = [c, x, 0];
181
+ else if (h < 120) rgb = [x, c, 0];
182
+ else if (h < 180) rgb = [0, c, x];
183
+ else if (h < 240) rgb = [0, x, c];
184
+ else if (h < 300) rgb = [x, 0, c];
185
+ else rgb = [c, 0, x];
186
+ return rgbToHex((rgb[0] + m) * 255, (rgb[1] + m) * 255, (rgb[2] + m) * 255);
187
+ }
188
+
189
+ function luminance(hex: string): number {
190
+ const [r, g, b] = hexToRgb(hex).map((c) => {
191
+ const x = c / 255;
192
+ return x <= 0.03928 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
193
+ });
194
+ return 0.2126 * r + 0.7152 * g + 0.0722 * b;
195
+ }
196
+
197
+ export function contrastRatio(a: string, b: string): number {
198
+ const la = luminance(a);
199
+ const lb = luminance(b);
200
+ return (Math.max(la, lb) + 0.05) / (Math.min(la, lb) + 0.05);
201
+ }
202
+
203
+ export type ContrastTone = "pass" | "large" | "fail";
204
+
205
+ export function contrastRating(ratio: number): { label: string; tone: ContrastTone } {
206
+ const text = `${ratio.toFixed(1)}:1`;
207
+ if (ratio >= 7) return { label: `AAA ${text}`, tone: "pass" };
208
+ if (ratio >= 4.5) return { label: `AA ${text}`, tone: "pass" };
209
+ if (ratio >= 3) return { label: `AA Large ${text}`, tone: "large" };
210
+ return { label: `Fails AA ${text}`, tone: "fail" };
211
+ }
212
+
213
+ /* ------------------------------------------------------------------ */
214
+ /* Reading the live project tokens */
215
+ /* ------------------------------------------------------------------ */
216
+
217
+ /** Normalises any computed CSS color ("#abc", "rgb(…)") to "#RRGGBB". */
218
+ function toHex(raw: string, fallback: string): string {
219
+ const v = raw.trim();
220
+ const direct = parseHex(v, true);
221
+ if (direct) return direct;
222
+ const m = v.match(/rgba?\(\s*([\d.]+)[ ,]+([\d.]+)[ ,]+([\d.]+)/i);
223
+ if (m) return rgbToHex(Number(m[1]), Number(m[2]), Number(m[3]));
224
+ return fallback;
225
+ }
226
+
227
+ /**
228
+ * Reads the project's real color tokens for both themes straight from the
229
+ * generated CSS variables, by probing a throw-away element under each
230
+ * `data-theme`. The panel therefore always starts from the live values.
231
+ */
232
+ export function readThemeColors(): ThemeColors {
233
+ const result: ThemeColors = { light: {}, dark: {} };
234
+ const fallback = rgbToHex(128, 128, 128);
235
+ if (typeof document === "undefined") {
236
+ COLOR_TOKEN_IDS.forEach((id) => {
237
+ result.light[id] = fallback;
238
+ result.dark[id] = fallback;
239
+ });
240
+ return result;
241
+ }
242
+ (["light", "dark"] as ThemeId[]).forEach((theme) => {
243
+ const probe = document.createElement("div");
244
+ probe.setAttribute("data-theme", theme);
245
+ probe.style.display = "none";
246
+ document.body.appendChild(probe);
247
+ const cs = getComputedStyle(probe);
248
+ COLOR_TOKEN_IDS.forEach((id) => {
249
+ result[theme][id] = toHex(cs.getPropertyValue(`--color-${id}`), fallback);
250
+ });
251
+ document.body.removeChild(probe);
252
+ });
253
+ return result;
254
+ }