vibe-design-system 2.5.16 → 2.5.17
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 +1 -0
- package/package.json +1 -1
- package/vds-core-template/story-generator.mjs +10 -26
package/bin/init.js
CHANGED
package/package.json
CHANGED
|
@@ -459,10 +459,12 @@ function buildDefaultArgsForRequiredProps(props) {
|
|
|
459
459
|
lucideImports.add(iconName);
|
|
460
460
|
argLines.push(` ${name}: ${iconName},`);
|
|
461
461
|
} else if (/\[\]/.test(type)) {
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
462
|
+
if (/string\s*\[\]/.test(type)) {
|
|
463
|
+
argLines.push(` ${name}: ["Example"],`);
|
|
464
|
+
} else {
|
|
465
|
+
// Object arrays ({ label, value } vb.) birçok component'te doğrudan child olarak render edilince hata verir; güvenli varsayılan boş dizi.
|
|
466
|
+
argLines.push(` ${name}: [],`);
|
|
467
|
+
}
|
|
466
468
|
}
|
|
467
469
|
}
|
|
468
470
|
return { argLines, lucideImports: [...lucideImports] };
|
|
@@ -591,19 +593,15 @@ function buildRecipeStoryContent(comp, componentName, importPath, title, source,
|
|
|
591
593
|
lines.push(`import { ${lucideImports.join(", ")} } from "lucide-react";`);
|
|
592
594
|
}
|
|
593
595
|
|
|
594
|
-
|
|
596
|
+
// Card: compound component (Header/Content) bazı projelerde yok; displayName hatasını önlemek için her zaman basit fallback kullanıyoruz.
|
|
597
|
+
const isCard = componentName === "Card";
|
|
595
598
|
let effectiveRecipe = recipe;
|
|
596
|
-
if (
|
|
599
|
+
if (isCard) {
|
|
597
600
|
effectiveRecipe = {
|
|
598
601
|
imports: [],
|
|
599
602
|
render: `(args) => (
|
|
600
603
|
<ComponentRef className="w-[340px]" {...args}>
|
|
601
|
-
<
|
|
602
|
-
<ComponentRef.Title>Card title</ComponentRef.Title>
|
|
603
|
-
<ComponentRef.Description>Short description.</ComponentRef.Description>
|
|
604
|
-
</ComponentRef.Header>
|
|
605
|
-
<ComponentRef.Content><p>Card body content here.</p></ComponentRef.Content>
|
|
606
|
-
<ComponentRef.Footer>Footer</ComponentRef.Footer>
|
|
604
|
+
<p>Card content</p>
|
|
607
605
|
</ComponentRef>
|
|
608
606
|
)`,
|
|
609
607
|
};
|
|
@@ -630,18 +628,11 @@ function buildRecipeStoryContent(comp, componentName, importPath, title, source,
|
|
|
630
628
|
lines.push(`import { ${ext.names.join(", ")} } from "${ext.from}";`);
|
|
631
629
|
}
|
|
632
630
|
|
|
633
|
-
const needsRouterDecorator = hasToOrHrefProp(comp, source);
|
|
634
|
-
if (needsRouterDecorator) {
|
|
635
|
-
lines.push(`import { MemoryRouter } from "react-router-dom";`);
|
|
636
|
-
}
|
|
637
631
|
lines.push("");
|
|
638
632
|
lines.push(`const meta = {`);
|
|
639
633
|
lines.push(` title: ${JSON.stringify(title)},`);
|
|
640
634
|
lines.push(` component: ComponentRef,`);
|
|
641
635
|
lines.push(` tags: ["autodocs"],`);
|
|
642
|
-
if (needsRouterDecorator) {
|
|
643
|
-
lines.push(` decorators: [(Story) => <MemoryRouter><Story /></MemoryRouter>],`);
|
|
644
|
-
}
|
|
645
636
|
lines.push(`} satisfies Meta<typeof ComponentRef>;`);
|
|
646
637
|
lines.push("");
|
|
647
638
|
lines.push(`export default meta;`);
|
|
@@ -757,18 +748,11 @@ function buildStoryFileContent(comp) {
|
|
|
757
748
|
lines.push(`const ComponentRef = ${namedAlias} ?? ${defaultAlias};`);
|
|
758
749
|
}
|
|
759
750
|
|
|
760
|
-
const needsRouterDecorator = hasToOrHrefProp(comp, source);
|
|
761
|
-
if (needsRouterDecorator) {
|
|
762
|
-
lines.push(`import { MemoryRouter } from "react-router-dom";`);
|
|
763
|
-
}
|
|
764
751
|
lines.push("");
|
|
765
752
|
lines.push(`const meta = {`);
|
|
766
753
|
lines.push(` title: ${JSON.stringify(title)},`);
|
|
767
754
|
lines.push(` component: ComponentRef,`);
|
|
768
755
|
lines.push(` tags: ["autodocs"],`);
|
|
769
|
-
if (needsRouterDecorator) {
|
|
770
|
-
lines.push(` decorators: [(Story) => <MemoryRouter><Story /></MemoryRouter>],`);
|
|
771
|
-
}
|
|
772
756
|
lines.push(`} satisfies Meta<typeof ComponentRef>;`);
|
|
773
757
|
lines.push("");
|
|
774
758
|
lines.push(`export default meta;`);
|