vibe-design-system 2.5.16 → 2.5.18
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 +4 -0
- package/package.json +1 -1
- package/vds-core-template/story-generator.mjs +24 -26
package/bin/init.js
CHANGED
|
@@ -49,6 +49,7 @@ export default config;
|
|
|
49
49
|
const STORYBOOK_PREVIEW_TS = `import type { Preview } from "@storybook/react";
|
|
50
50
|
import React from "react";
|
|
51
51
|
import { MemoryRouter } from "react-router-dom";
|
|
52
|
+
// Uygulamanızla aynı stiller için: index.css + kullandığınız diğer global CSS dosyalarını ekleyin (örn. "../src/App.css").
|
|
52
53
|
import "../src/index.css";
|
|
53
54
|
|
|
54
55
|
const withRouter = (Story: any) => {
|
|
@@ -94,6 +95,8 @@ Geliştirme kuralları:
|
|
|
94
95
|
- Variant'lar için cva() kullan
|
|
95
96
|
- Tailwind CSS kullan
|
|
96
97
|
- Named export veya default export — ikisi de çalışır
|
|
98
|
+
|
|
99
|
+
Storybook stilleri sayfalardan farklıysa: .storybook/preview.ts içinde uygulamanızın kullandığı tüm global CSS dosyalarını import edin (index.css dışında App.css, globals.css vb.).
|
|
97
100
|
`;
|
|
98
101
|
|
|
99
102
|
const WATCH_MJS = `#!/usr/bin/env node
|
|
@@ -175,6 +178,7 @@ function installStorybook(projectRoot) {
|
|
|
175
178
|
[
|
|
176
179
|
"install",
|
|
177
180
|
"--save-dev",
|
|
181
|
+
"--save-exact",
|
|
178
182
|
`storybook@${STORYBOOK_VERSION}`,
|
|
179
183
|
`@storybook/react-vite@${STORYBOOK_VERSION}`,
|
|
180
184
|
`@storybook/react@${STORYBOOK_VERSION}`,
|
package/package.json
CHANGED
|
@@ -445,6 +445,19 @@ function parsePropsFromSource(source) {
|
|
|
445
445
|
/** Default icon for LucideIcon prop when name is generic (icon, leftIcon, etc.). */
|
|
446
446
|
const LUCIDE_ICON_DEFAULT = "Star";
|
|
447
447
|
|
|
448
|
+
/** Yaygın required string prop isimleri için anlamlı varsayılan metin (component'in boş/Example yerine görünür render etmesi için). */
|
|
449
|
+
const DEFAULT_STRINGS_BY_PROP_NAME = {
|
|
450
|
+
eyebrow: "Label",
|
|
451
|
+
title: "Section title",
|
|
452
|
+
description: "Short description for the section.",
|
|
453
|
+
value: "100",
|
|
454
|
+
name: "Example",
|
|
455
|
+
heading: "Heading",
|
|
456
|
+
subtitle: "Subtitle text",
|
|
457
|
+
text: "Sample text",
|
|
458
|
+
label: "Label",
|
|
459
|
+
};
|
|
460
|
+
|
|
448
461
|
/** Build default args lines and lucide-react imports for required props (LucideIcon → icon component, X[] → example item). */
|
|
449
462
|
function buildDefaultArgsForRequiredProps(props) {
|
|
450
463
|
const argLines = [];
|
|
@@ -459,10 +472,13 @@ function buildDefaultArgsForRequiredProps(props) {
|
|
|
459
472
|
lucideImports.add(iconName);
|
|
460
473
|
argLines.push(` ${name}: ${iconName},`);
|
|
461
474
|
} else if (/\[\]/.test(type)) {
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
475
|
+
if (/string\s*\[\]/.test(type)) {
|
|
476
|
+
argLines.push(` ${name}: ["Example"],`);
|
|
477
|
+
} else {
|
|
478
|
+
argLines.push(` ${name}: [],`);
|
|
479
|
+
}
|
|
480
|
+
} else if (/string/.test(type) && DEFAULT_STRINGS_BY_PROP_NAME[name] !== undefined) {
|
|
481
|
+
argLines.push(` ${name}: ${JSON.stringify(DEFAULT_STRINGS_BY_PROP_NAME[name])},`);
|
|
466
482
|
}
|
|
467
483
|
}
|
|
468
484
|
return { argLines, lucideImports: [...lucideImports] };
|
|
@@ -591,19 +607,15 @@ function buildRecipeStoryContent(comp, componentName, importPath, title, source,
|
|
|
591
607
|
lines.push(`import { ${lucideImports.join(", ")} } from "lucide-react";`);
|
|
592
608
|
}
|
|
593
609
|
|
|
594
|
-
|
|
610
|
+
// Card: compound component (Header/Content) bazı projelerde yok; displayName hatasını önlemek için her zaman basit fallback kullanıyoruz.
|
|
611
|
+
const isCard = componentName === "Card";
|
|
595
612
|
let effectiveRecipe = recipe;
|
|
596
|
-
if (
|
|
613
|
+
if (isCard) {
|
|
597
614
|
effectiveRecipe = {
|
|
598
615
|
imports: [],
|
|
599
616
|
render: `(args) => (
|
|
600
617
|
<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>
|
|
618
|
+
<p>Card content</p>
|
|
607
619
|
</ComponentRef>
|
|
608
620
|
)`,
|
|
609
621
|
};
|
|
@@ -630,18 +642,11 @@ function buildRecipeStoryContent(comp, componentName, importPath, title, source,
|
|
|
630
642
|
lines.push(`import { ${ext.names.join(", ")} } from "${ext.from}";`);
|
|
631
643
|
}
|
|
632
644
|
|
|
633
|
-
const needsRouterDecorator = hasToOrHrefProp(comp, source);
|
|
634
|
-
if (needsRouterDecorator) {
|
|
635
|
-
lines.push(`import { MemoryRouter } from "react-router-dom";`);
|
|
636
|
-
}
|
|
637
645
|
lines.push("");
|
|
638
646
|
lines.push(`const meta = {`);
|
|
639
647
|
lines.push(` title: ${JSON.stringify(title)},`);
|
|
640
648
|
lines.push(` component: ComponentRef,`);
|
|
641
649
|
lines.push(` tags: ["autodocs"],`);
|
|
642
|
-
if (needsRouterDecorator) {
|
|
643
|
-
lines.push(` decorators: [(Story) => <MemoryRouter><Story /></MemoryRouter>],`);
|
|
644
|
-
}
|
|
645
650
|
lines.push(`} satisfies Meta<typeof ComponentRef>;`);
|
|
646
651
|
lines.push("");
|
|
647
652
|
lines.push(`export default meta;`);
|
|
@@ -757,18 +762,11 @@ function buildStoryFileContent(comp) {
|
|
|
757
762
|
lines.push(`const ComponentRef = ${namedAlias} ?? ${defaultAlias};`);
|
|
758
763
|
}
|
|
759
764
|
|
|
760
|
-
const needsRouterDecorator = hasToOrHrefProp(comp, source);
|
|
761
|
-
if (needsRouterDecorator) {
|
|
762
|
-
lines.push(`import { MemoryRouter } from "react-router-dom";`);
|
|
763
|
-
}
|
|
764
765
|
lines.push("");
|
|
765
766
|
lines.push(`const meta = {`);
|
|
766
767
|
lines.push(` title: ${JSON.stringify(title)},`);
|
|
767
768
|
lines.push(` component: ComponentRef,`);
|
|
768
769
|
lines.push(` tags: ["autodocs"],`);
|
|
769
|
-
if (needsRouterDecorator) {
|
|
770
|
-
lines.push(` decorators: [(Story) => <MemoryRouter><Story /></MemoryRouter>],`);
|
|
771
|
-
}
|
|
772
770
|
lines.push(`} satisfies Meta<typeof ComponentRef>;`);
|
|
773
771
|
lines.push("");
|
|
774
772
|
lines.push(`export default meta;`);
|