vibe-design-system 2.5.30 → 2.5.32

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 CHANGED
@@ -84,11 +84,10 @@ export default preview;
84
84
  `;
85
85
 
86
86
  const CURSORRULES = `# VDS — Vibe Design System
87
- Bu proje VDS kullanıyor. Komutlar:
88
- - npm run vds → projeyi tara
89
- - npm run vds:stories → Storybook story'lerini üret
90
- - npm run vds:watch → değişiklikleri izle
87
+ Bu proje VDS kullanıyor. Tek komut yeterli:
88
+ - npm run vds:stories → projeyi tara, story'leri üret, provider'ları ayarla (hepsi tek seferde)
91
89
  - npm run storybook → design system'ı aç (localhost:6006)
90
+ - npm run vds:watch → değişiklikleri izle (tarama + story otomatik)
92
91
 
93
92
  Geliştirme kuralları:
94
93
  - UI component'leri src/components/ui/ altına koy
@@ -254,7 +253,7 @@ function addScripts(projectRoot) {
254
253
  changed = true;
255
254
  }
256
255
  if (!scripts["vds:stories"]) {
257
- scripts["vds:stories"] = "node vds-core/story-generator.mjs";
256
+ scripts["vds:stories"] = "node vds-core/scan.mjs && node vds-core/story-generator.mjs && node vds-core/setup-storybook-providers.mjs";
258
257
  changed = true;
259
258
  }
260
259
  if (!scripts["vds:watch"]) {
@@ -398,6 +397,7 @@ runSetupStorybookProviders(projectRoot);
398
397
 
399
398
  // ADIM 8
400
399
  console.log("\n✅ VDS kuruldu!");
401
- console.log("→ npm run storybook ile design system'ını aç");
400
+ console.log("→ npm run storybook ile design system'ı (localhost:6006)");
401
+ console.log("→ Yeni component ekledikten sonra: npm run vds:stories (tek komut: tarama + story + provider)");
402
402
  console.log("→ npm run vds:watch ile otomatik güncellemeyi başlat");
403
403
  console.log("\nNot: Storybook başlarken (Node 24+) DEP0190 uyarısı çıkarsa Storybook kaynaklıdır, güvenle yok sayabilirsiniz.\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibe-design-system",
3
- "version": "2.5.30",
3
+ "version": "2.5.32",
4
4
  "description": "Auto-generate design systems for vibe coding projects",
5
5
  "type": "module",
6
6
  "bin": {
@@ -47,22 +47,32 @@ To see **live renders** of components in the dashboard (isolated, no app chrome)
47
47
 
48
48
  ## Storybook
49
49
 
50
- 1. **Generate stories** (after `npm run vds`):
50
+ **Tek komut** (tarama + story + provider hepsi birlikte):
51
51
  ```bash
52
52
  npm run vds:stories
53
53
  ```
54
- Add to `package.json` if missing:
55
- ```json
56
- "vds:stories": "node vds-core/story-generator.mjs"
57
- ```
54
+ Script (`package.json`): `node vds-core/scan.mjs && node vds-core/story-generator.mjs && node vds-core/setup-storybook-providers.mjs`
55
+
56
+ - **Provider'lar:** `vds:stories` içinde zaten çalışır; ayrıca `node vds-core/setup-storybook-providers.mjs` çalıştırmanıza gerek yok. Hooks (useTimer, useSidebar, useCircles, useAuth, useSearch) and inject the matching providers into `.storybook/preview.ts`. Kalan "undefined (reading 'x')" hatalarında ilgili story'de args veya mock state ekleyin.
57
+
58
+ - **Icons:** The Foundations/Icons story lists only icons that are imported from `lucide-react` in your app code (src/, excluding `src/stories`), so it reflects real usage.
59
+
60
+ ## Son hal / Final state
61
+
62
+ VDS, **tek komutla** projenizin design system'ını Storybook'ta stilleriyle eşitlemeyi hedefler:
63
+
64
+ 1. **Kurulum (bir kez):** `npx vibe-design-system init` — Storybook, vds-core, scriptler ve ilk tarama + story + provider ayarı yapılır.
65
+ 2. **Güncelleme:** Yeni component ekledikten veya projeyi değiştirdikten sonra sadece `npm run vds:stories` çalıştırın; tarama, story üretimi ve provider enjeksiyonu otomatik yapılır.
66
+ 3. **Görüntüleme:** `npm run storybook` ile tüm component'lar stilleriyle (index.css vb. preview'da import edildiği için) listelenir.
58
67
 
59
- 2. **Context providers:** Run `node vds-core/setup-storybook-providers.mjs` to detect hooks (useTimer, useSidebar, useCircles, useAuth, useSearch) and inject the matching providers into `.storybook/preview.ts`. The script prefers the provider from the same file as the hook (e.g. `context/SidebarContext.tsx` for useSidebar over `components/ui/sidebar`). If a component still errors with "Cannot read properties of undefined (reading 'x')", add default args or mock context state in that component’s story.
68
+ Kullanıcının her projede ayrı ayrı provider eklemesi, manuel story düzeltmesi veya birden fazla komut çalıştırması gerekmez. Nadir kalan hatalar (belirli bir component'ın özel context'i) story dosyasında args/mock ile giderilir.
60
69
 
61
- 3. **Icons:** The Foundations/Icons story lists only icons that are imported from `lucide-react` in your app code (src/, excluding `src/stories`), so it reflects real usage.
70
+ **"Failed to fetch dynamically imported module"** genelde o story veya component dosyasındaki hatalı/eksik import'tan kaynaklanır; ilgili .stories.tsx veya component'ı kontrol edin veya o component'ı VDS skip listesine ekleyin.
62
71
 
63
72
  ## Layout
64
73
 
65
- - `vds-core/scan.mjs` — Node script; scans `src/components`, CSS, Tailwind config. Writes `vds-output.json` and `public/vds-output.json`. Paths are relative to **project root** (parent of `vds-core`).
66
- - `vds-core/story-generator.mjs` — Reads `vds-output.json`, writes Storybook stories under `src/stories`.
67
- - `vds-core/VdsPreview.tsx` — Optional; mount at `/vds-preview` so the dashboard can show live component renders.
68
- - Dashboard UI reads `/vds-output.json`, renders Foundations + Component Library.
74
+ - `vds-core/scan.mjs` — Projeyi tarar (src/components, CSS, Tailwind). `vds-output.json` ve `public/vds-output.json` yazar.
75
+ - `vds-core/story-generator.mjs` — `vds-output.json`'dan story'leri üretir; varsayılan args: filters/dateRange, sayı, tarih, modal/drawer için isOpen/open: true, onClose/onSave vb. no-op, circle/user/nav/allocation mock objeleri (visibility, path hatalarını önler).
76
+ - `vds-core/setup-storybook-providers.mjs` — Hook ve react-dnd kullanımını tespit eder, `.storybook/preview` decorator'larına provider ekler.
77
+ - `vds-core/VdsPreview.tsx` İsteğe bağlı; `/vds-preview` ile dashboard canlı component önizlemesi yapar.
78
+ - Dashboard UI `/vds-output.json` okur; Foundations + Component Library gösterir.
@@ -613,6 +613,10 @@ function buildDefaultArgsForRequiredProps(props, usageFromPages = null, componen
613
613
  return JSON.stringify("Example");
614
614
  };
615
615
 
616
+ const HANDLER_PROPS = new Set(["onClose", "onOpenChange", "onSave", "onDelete", "onBudgetCreated", "onTaskCreated", "onOpenChange"]);
617
+ const OPEN_PROPS = new Set(["isOpen", "open"]);
618
+ const isFunctionType = (t) => /=>\s*void|\(\s*\)\s*=>|function\s*\(/.test(t) || /^\([^)]*\)\s*=>\s*void/.test(t);
619
+
616
620
  if (Array.isArray(props) && props.length > 0) {
617
621
  for (const p of props) {
618
622
  const type = String(p.type || "").trim();
@@ -626,6 +630,26 @@ function buildDefaultArgsForRequiredProps(props, usageFromPages = null, componen
626
630
  added.add(name);
627
631
  continue;
628
632
  }
633
+ if (OPEN_PROPS.has(name)) {
634
+ argLines.push(` ${name}: true,`);
635
+ added.add(name);
636
+ continue;
637
+ }
638
+ if (HANDLER_PROPS.has(name) && isFunctionType(type)) {
639
+ argLines.push(` ${name}: () => {},`);
640
+ added.add(name);
641
+ continue;
642
+ }
643
+ if (name === "allocation" && (/object|union|Allocation/.test(type) || !type)) {
644
+ argLines.push(` ${name}: { id: "1", resourceId: "1", budget: 0, used: 0 },`);
645
+ added.add(name);
646
+ continue;
647
+ }
648
+ if (name === "user" && (/object|any|User/.test(type) || !type)) {
649
+ argLines.push(` ${name}: { id: "1", name: "User", email: "user@example.com" },`);
650
+ added.add(name);
651
+ continue;
652
+ }
629
653
  if (!required) continue;
630
654
  if (/LucideIcon|lucide-react/.test(type)) {
631
655
  const iconName = LUCIDE_ICON_DEFAULT;
@@ -670,6 +694,27 @@ function buildDefaultArgsForRequiredProps(props, usageFromPages = null, componen
670
694
  } else if (/number/.test(type) || NUMBER_LIKE_OPTIONAL.has(name)) {
671
695
  argLines.push(` ${name}: ${name === "visibility" ? "1" : "0"},`);
672
696
  added.add(name);
697
+ } else if (OPEN_PROPS.has(name)) {
698
+ argLines.push(` ${name}: true,`);
699
+ added.add(name);
700
+ } else if (HANDLER_PROPS.has(name)) {
701
+ argLines.push(` ${name}: () => {},`);
702
+ added.add(name);
703
+ } else if (name === "circle" || /Circle\b/.test(type)) {
704
+ argLines.push(` ${name}: { id: "1", name: "Example", visibility: 1 },`);
705
+ added.add(name);
706
+ } else if (name === "item" || name === "navItem" || /NavItem|Nav.*Item/.test(type)) {
707
+ argLines.push(` ${name}: { path: "/", label: "Example", id: "1" },`);
708
+ added.add(name);
709
+ } else if (name === "allocation") {
710
+ argLines.push(` ${name}: { id: "1", resourceId: "1", budget: 0, used: 0 },`);
711
+ added.add(name);
712
+ } else if (name === "user") {
713
+ argLines.push(` ${name}: { id: "1", name: "User", email: "user@example.com" },`);
714
+ added.add(name);
715
+ } else if (name === "defaultProjectId") {
716
+ argLines.push(` ${name}: "1",`);
717
+ added.add(name);
673
718
  }
674
719
  }
675
720
  }
@@ -13,6 +13,7 @@ function run() {
13
13
  try {
14
14
  execSync('node vds-core/scan.mjs', { stdio: 'inherit', cwd: ROOT });
15
15
  execSync('node vds-core/story-generator.mjs', { stdio: 'inherit', cwd: ROOT });
16
+ execSync('node vds-core/setup-storybook-providers.mjs', { stdio: 'inherit', cwd: ROOT });
16
17
  console.log(`[VDS ${ts}] ✅ Design system güncellendi.`);
17
18
  } catch (e) {
18
19
  console.error(`[VDS ${ts}] ❌ Hata:`, e.message);