vibe-design-system 2.5.4 → 2.5.5
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/package.json
CHANGED
|
@@ -22,7 +22,8 @@ const STORIES_DIR = path.join(SRC_DIR, "stories");
|
|
|
22
22
|
|
|
23
23
|
// CSS is loaded from .storybook/preview.tsx — never add CSS import to story files.
|
|
24
24
|
|
|
25
|
-
// Components we don't want to auto-generate stories for (project-specific dashboards, heavy UIs, etc.)
|
|
25
|
+
// Components we don't want to auto-generate import-based stories for (project-specific dashboards, heavy UIs, etc.)
|
|
26
|
+
// vds-generated/ is handled separately: placeholder stories only (no import of broken Figma/Make JSX).
|
|
26
27
|
const SKIP_LIST = [
|
|
27
28
|
"AnalysisDashboard",
|
|
28
29
|
"ComponentLibrary",
|
|
@@ -380,6 +381,33 @@ function capitalize(str) {
|
|
|
380
381
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
381
382
|
}
|
|
382
383
|
|
|
384
|
+
/** Placeholder story for vds-generated extracted patterns (no import; broken Figma/Make JSX is not loaded). */
|
|
385
|
+
function buildExtractedPlaceholderStory(comp) {
|
|
386
|
+
const componentName = toSafeComponentName(comp.name, comp.file);
|
|
387
|
+
const occurrenceCount = comp.occurrences ?? 0;
|
|
388
|
+
const title = `VDS Generated/${componentName}`;
|
|
389
|
+
return [
|
|
390
|
+
'import type { Meta, StoryObj } from "@storybook/react";',
|
|
391
|
+
"",
|
|
392
|
+
`const meta = { title: ${JSON.stringify(title)} } satisfies Meta;`,
|
|
393
|
+
"export default meta;",
|
|
394
|
+
"type Story = StoryObj;",
|
|
395
|
+
"",
|
|
396
|
+
"export const Default: Story = {",
|
|
397
|
+
" render: () => (",
|
|
398
|
+
" <div style={{ padding: 24, border: \"2px dashed #ccc\", borderRadius: 8 }}>",
|
|
399
|
+
" <p style={{ color: \"#999\", fontSize: 12 }}>EXTRACTED PATTERN</p>",
|
|
400
|
+
` <h3 style={{ margin: \"0 0 8px 0\" }}>${componentName}</h3>`,
|
|
401
|
+
" <p style={{ color: \"#666\", margin: 0 }}>",
|
|
402
|
+
` This pattern was detected ${occurrenceCount} times in src/pages/.`,
|
|
403
|
+
" Extract it as a proper component to see it rendered here.",
|
|
404
|
+
" </p>",
|
|
405
|
+
" </div>",
|
|
406
|
+
" ),",
|
|
407
|
+
"};",
|
|
408
|
+
].join("\n");
|
|
409
|
+
}
|
|
410
|
+
|
|
383
411
|
function detectExportStyle(source, componentName) {
|
|
384
412
|
if (!source) return "unknown";
|
|
385
413
|
const hasDefault = /export\s+default\b/.test(source);
|
|
@@ -960,12 +988,22 @@ function main() {
|
|
|
960
988
|
for (const comp of components) {
|
|
961
989
|
const componentName = toSafeComponentName(comp.name, comp.file);
|
|
962
990
|
if (onlyName && componentName !== onlyName) continue;
|
|
991
|
+
|
|
992
|
+
const storyFileName = `${componentName}.stories.tsx`;
|
|
993
|
+
const storyPath = path.join(STORIES_DIR, storyFileName);
|
|
994
|
+
|
|
995
|
+
if (comp.file.startsWith("vds-generated/")) {
|
|
996
|
+
const content = buildExtractedPlaceholderStory(comp);
|
|
997
|
+
fs.writeFileSync(storyPath, content, "utf-8");
|
|
998
|
+
console.log(`[VDS] Wrote ${path.relative(PROJECT_ROOT, storyPath)} (placeholder)`);
|
|
999
|
+
continue;
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
if (!comp.file.startsWith("ui/") && !comp.file.startsWith("pages/")) continue;
|
|
963
1003
|
if (SKIP_LIST.includes(componentName)) continue;
|
|
964
1004
|
const requiredCount = Array.isArray(comp.props) ? comp.props.filter((p) => p.required === true).length : 0;
|
|
965
1005
|
if (requiredCount > 3) continue;
|
|
966
1006
|
|
|
967
|
-
const storyFileName = `${componentName}.stories.tsx`;
|
|
968
|
-
const storyPath = path.join(STORIES_DIR, storyFileName);
|
|
969
1007
|
const content = buildStoryFileContent(comp);
|
|
970
1008
|
if (content == null) continue;
|
|
971
1009
|
fs.writeFileSync(storyPath, content, "utf-8");
|