vibe-design-system 2.5.8 → 2.5.10
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/bin/init.js +27 -5
- package/package.json +1 -1
- package/vds-core-template/scan.mjs +30 -107
- package/vds-core-template/story-generator.mjs +3 -1
package/bin/init.js
CHANGED
|
@@ -22,6 +22,11 @@ const INSTALLER_ROOT = path.join(__dirname, "..");
|
|
|
22
22
|
const TEMPLATE_DIR = path.join(INSTALLER_ROOT, "vds-core-template");
|
|
23
23
|
|
|
24
24
|
const STORYBOOK_MAIN_TS = `import type { StorybookConfig } from "@storybook/react-vite";
|
|
25
|
+
import { mergeConfig } from "vite";
|
|
26
|
+
import path from "path";
|
|
27
|
+
import { fileURLToPath } from "url";
|
|
28
|
+
|
|
29
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
25
30
|
|
|
26
31
|
const config: StorybookConfig = {
|
|
27
32
|
stories: ["../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
|
|
@@ -31,11 +36,13 @@ const config: StorybookConfig = {
|
|
|
31
36
|
options: {},
|
|
32
37
|
},
|
|
33
38
|
async viteFinal(config) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
return mergeConfig(config, {
|
|
40
|
+
resolve: {
|
|
41
|
+
alias: {
|
|
42
|
+
"@": path.resolve(__dirname, "../src"),
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
});
|
|
39
46
|
},
|
|
40
47
|
};
|
|
41
48
|
|
|
@@ -50,6 +57,21 @@ import "../src/index.css";
|
|
|
50
57
|
const preview: Preview = {
|
|
51
58
|
parameters: {
|
|
52
59
|
layout: "fullscreen",
|
|
60
|
+
options: {
|
|
61
|
+
storySort: {
|
|
62
|
+
order: [
|
|
63
|
+
"Foundations",
|
|
64
|
+
["Introduction", "Page to Components", "Colors", "Typography", "Brand", "Icons", "Component Suggestions", "Changelog"],
|
|
65
|
+
"Layout",
|
|
66
|
+
["Navigation", "Footer", "ScrollToTop"],
|
|
67
|
+
"Components",
|
|
68
|
+
"Actions",
|
|
69
|
+
"Data Display",
|
|
70
|
+
"Examples",
|
|
71
|
+
["Pages"],
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
},
|
|
53
75
|
},
|
|
54
76
|
decorators: [
|
|
55
77
|
(Story) => React.createElement(MemoryRouter, null, React.createElement(Story, null)),
|
package/package.json
CHANGED
|
@@ -237,101 +237,11 @@ function compareComponents(prevList, newResults) {
|
|
|
237
237
|
return { added, removed, modified };
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
{
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
"figmalibrarygenerator",
|
|
246
|
-
"integrationguide",
|
|
247
|
-
"projectdropzone",
|
|
248
|
-
"repoconnect",
|
|
249
|
-
"tokensstudioguide",
|
|
250
|
-
],
|
|
251
|
-
group: "Sections",
|
|
252
|
-
category: "Features",
|
|
253
|
-
},
|
|
254
|
-
{ keywords: ["hover-card"], group: "Feedback", category: "Feedback" },
|
|
255
|
-
{
|
|
256
|
-
keywords: [
|
|
257
|
-
"card",
|
|
258
|
-
"table",
|
|
259
|
-
"list",
|
|
260
|
-
"badge",
|
|
261
|
-
"avatar",
|
|
262
|
-
"chart",
|
|
263
|
-
"accordion",
|
|
264
|
-
"tabs",
|
|
265
|
-
"collapsible",
|
|
266
|
-
"toggle-group",
|
|
267
|
-
"carousel",
|
|
268
|
-
"scroll-area",
|
|
269
|
-
],
|
|
270
|
-
group: "Data Display",
|
|
271
|
-
category: "Data Display",
|
|
272
|
-
},
|
|
273
|
-
{ keywords: ["toggle"], group: "Actions", category: "Toggle" },
|
|
274
|
-
{ keywords: ["button", "cta"], group: "Actions", category: "Button" },
|
|
275
|
-
{ keywords: ["drawer", "sheet"], group: "Feedback", category: "Overlay" },
|
|
276
|
-
{
|
|
277
|
-
keywords: [
|
|
278
|
-
"modal",
|
|
279
|
-
"dialog",
|
|
280
|
-
"alert",
|
|
281
|
-
"toast",
|
|
282
|
-
"toaster",
|
|
283
|
-
"sonner",
|
|
284
|
-
"tooltip",
|
|
285
|
-
"popover",
|
|
286
|
-
"hover-card",
|
|
287
|
-
"progress",
|
|
288
|
-
"skeleton",
|
|
289
|
-
],
|
|
290
|
-
group: "Feedback",
|
|
291
|
-
category: "Feedback",
|
|
292
|
-
},
|
|
293
|
-
{
|
|
294
|
-
keywords: [
|
|
295
|
-
"input",
|
|
296
|
-
"form",
|
|
297
|
-
"select",
|
|
298
|
-
"checkbox",
|
|
299
|
-
"textarea",
|
|
300
|
-
"label",
|
|
301
|
-
"switch",
|
|
302
|
-
"radio",
|
|
303
|
-
"slider",
|
|
304
|
-
"calendar",
|
|
305
|
-
"input-otp",
|
|
306
|
-
"command",
|
|
307
|
-
],
|
|
308
|
-
group: "Forms",
|
|
309
|
-
category: "Forms",
|
|
310
|
-
},
|
|
311
|
-
{
|
|
312
|
-
keywords: [
|
|
313
|
-
"nav",
|
|
314
|
-
"header",
|
|
315
|
-
"sidebar",
|
|
316
|
-
"menu",
|
|
317
|
-
"menubar",
|
|
318
|
-
"dropdown-menu",
|
|
319
|
-
"navigation-menu",
|
|
320
|
-
"context-menu",
|
|
321
|
-
"navlink",
|
|
322
|
-
"breadcrumb",
|
|
323
|
-
"pagination",
|
|
324
|
-
],
|
|
325
|
-
group: "Navigation",
|
|
326
|
-
category: "Navigation",
|
|
327
|
-
},
|
|
328
|
-
{ keywords: ["separator", "aspect-ratio", "resizable"], group: "Layout", category: "Layout" },
|
|
329
|
-
{
|
|
330
|
-
keywords: ["hero", "banner", "section", "pricing", "feature", "featuresgrid", "interactivedemo", "modernhero"],
|
|
331
|
-
group: "Sections",
|
|
332
|
-
category: "Sections",
|
|
333
|
-
},
|
|
334
|
-
];
|
|
240
|
+
/** Path-based classification: ui/ → shadcn, components root → Components, else Uncategorized. */
|
|
241
|
+
function classifyByPath(rel) {
|
|
242
|
+
if (rel.startsWith("ui/")) return { group: "shadcn", category: "UI" };
|
|
243
|
+
return { group: "Components", category: "Components" };
|
|
244
|
+
}
|
|
335
245
|
|
|
336
246
|
function getAllComponentFiles(dir, baseDir = dir) {
|
|
337
247
|
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
@@ -441,14 +351,6 @@ function extractVdsTags(content) {
|
|
|
441
351
|
return Object.keys(tags).length ? tags : null;
|
|
442
352
|
}
|
|
443
353
|
|
|
444
|
-
function classifyByFileName(filePath) {
|
|
445
|
-
const baseName = path.basename(filePath, path.extname(filePath)).toLowerCase();
|
|
446
|
-
for (const rule of CLASSIFICATION_RULES) {
|
|
447
|
-
const found = rule.keywords.some((kw) => baseName.includes(kw));
|
|
448
|
-
if (found) return { group: rule.group, category: rule.category };
|
|
449
|
-
}
|
|
450
|
-
return { group: "Uncategorized", category: "Uncategorized" };
|
|
451
|
-
}
|
|
452
354
|
|
|
453
355
|
function humanizeName(filePath) {
|
|
454
356
|
const base = path.basename(filePath, path.extname(filePath));
|
|
@@ -874,7 +776,7 @@ function parseCssVarBlock(block) {
|
|
|
874
776
|
|
|
875
777
|
/** Resolve Tailwind theme for boxShadow, spacing, screens, zIndex, motion. Uses resolveConfig when available. */
|
|
876
778
|
function getTailwindTheme() {
|
|
877
|
-
const empty = { shadows: {}, spacing: {}, breakpoints: {}, zIndex: {}, transitionDuration: {}, transitionTimingFunction: {}, animation: {} };
|
|
779
|
+
const empty = { shadows: {}, spacing: {}, breakpoints: {}, zIndex: {}, transitionDuration: {}, transitionTimingFunction: {}, animation: {}, colors: {} };
|
|
878
780
|
try {
|
|
879
781
|
const resolveConfig = projectRequire("tailwindcss/resolveConfig");
|
|
880
782
|
let config = { content: [{ raw: "", extension: "html" }], theme: {} };
|
|
@@ -896,6 +798,7 @@ function getTailwindTheme() {
|
|
|
896
798
|
const transitionDuration = theme.transitionDuration;
|
|
897
799
|
const transitionTimingFunction = theme.transitionTimingFunction;
|
|
898
800
|
const animation = theme.animation;
|
|
801
|
+
const themeColors = theme.colors;
|
|
899
802
|
const toObj = (v) => (v && typeof v === "object" && !Array.isArray(v) ? v : {});
|
|
900
803
|
return {
|
|
901
804
|
shadows: toObj(boxShadow),
|
|
@@ -905,6 +808,7 @@ function getTailwindTheme() {
|
|
|
905
808
|
transitionDuration: toObj(transitionDuration),
|
|
906
809
|
transitionTimingFunction: toObj(transitionTimingFunction),
|
|
907
810
|
animation: toObj(animation),
|
|
811
|
+
colors: toObj(themeColors),
|
|
908
812
|
};
|
|
909
813
|
} catch (_) {
|
|
910
814
|
return empty;
|
|
@@ -919,8 +823,15 @@ function extractFoundations() {
|
|
|
919
823
|
const borderRadiusScale = {};
|
|
920
824
|
const cssPath = path.join(PROJECT_ROOT, "src", "index.css");
|
|
921
825
|
const globalsCss = path.join(PROJECT_ROOT, "src", "globals.css");
|
|
826
|
+
const stylesGlobals = path.join(PROJECT_ROOT, "src", "styles", "globals.css");
|
|
922
827
|
const appGlobals = path.join(PROJECT_ROOT, "app", "globals.css");
|
|
923
|
-
const cssToRead = fs.existsSync(cssPath)
|
|
828
|
+
const cssToRead = fs.existsSync(cssPath)
|
|
829
|
+
? cssPath
|
|
830
|
+
: fs.existsSync(globalsCss)
|
|
831
|
+
? globalsCss
|
|
832
|
+
: fs.existsSync(stylesGlobals)
|
|
833
|
+
? stylesGlobals
|
|
834
|
+
: appGlobals;
|
|
924
835
|
|
|
925
836
|
try {
|
|
926
837
|
if (fs.existsSync(cssToRead)) {
|
|
@@ -1131,6 +1042,18 @@ function extractFoundations() {
|
|
|
1131
1042
|
if (Object.keys(colorsDark).length > 0) foundationsColors._dark = colorsDark;
|
|
1132
1043
|
|
|
1133
1044
|
const twTheme = getTailwindTheme();
|
|
1045
|
+
if (twTheme.colors && typeof twTheme.colors === "object") {
|
|
1046
|
+
for (const [key, val] of Object.entries(twTheme.colors)) {
|
|
1047
|
+
if (typeof val === "string" && (val.startsWith("#") || /^[a-z]/.test(val))) {
|
|
1048
|
+
foundationsColors[key] = { value: val, hex: val.startsWith("#") ? val : val };
|
|
1049
|
+
} else if (typeof val === "object" && val !== null && !Array.isArray(val)) {
|
|
1050
|
+
for (const [k, v] of Object.entries(val)) {
|
|
1051
|
+
if (typeof v === "string") foundationsColors[`${key}-${k}`] = { value: v, hex: v.startsWith("#") ? v : v };
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1134
1057
|
const normalizeThemeObj = (obj) => {
|
|
1135
1058
|
if (!obj || typeof obj !== "object") return {};
|
|
1136
1059
|
const out = {};
|
|
@@ -1173,7 +1096,7 @@ function scan() {
|
|
|
1173
1096
|
name = vdsTags.name ?? humanizeName(rel);
|
|
1174
1097
|
description = vdsTags.description ?? "";
|
|
1175
1098
|
} else {
|
|
1176
|
-
const classified =
|
|
1099
|
+
const classified = classifyByPath(rel);
|
|
1177
1100
|
group = classified.group;
|
|
1178
1101
|
category = classified.category;
|
|
1179
1102
|
name = humanizeName(rel);
|
|
@@ -1192,7 +1115,7 @@ function scan() {
|
|
|
1192
1115
|
results.push({
|
|
1193
1116
|
file: "pages/" + rel,
|
|
1194
1117
|
name,
|
|
1195
|
-
group: "
|
|
1118
|
+
group: "Pages",
|
|
1196
1119
|
category: "Pages",
|
|
1197
1120
|
description: "",
|
|
1198
1121
|
tokens,
|
|
@@ -958,9 +958,11 @@ function main() {
|
|
|
958
958
|
}
|
|
959
959
|
|
|
960
960
|
for (const comp of components) {
|
|
961
|
+
if (comp.group === "shadcn" || comp.group === "Uncategorized") continue;
|
|
962
|
+
if (comp.group !== "Components") continue;
|
|
963
|
+
|
|
961
964
|
const componentName = toSafeComponentName(comp.name, comp.file);
|
|
962
965
|
if (onlyName && componentName !== onlyName) continue;
|
|
963
|
-
if (!comp.file.startsWith("ui/") && !comp.file.startsWith("pages/")) continue;
|
|
964
966
|
|
|
965
967
|
const storyFileName = `${componentName}.stories.tsx`;
|
|
966
968
|
const storyPath = path.join(STORIES_DIR, storyFileName);
|