vibe-design-system 2.5.24 → 2.5.25

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibe-design-system",
3
- "version": "2.5.24",
3
+ "version": "2.5.25",
4
4
  "description": "Auto-generate design systems for vibe coding projects",
5
5
  "type": "module",
6
6
  "bin": {
@@ -45,8 +45,24 @@ To see **live renders** of components in the dashboard (isolated, no app chrome)
45
45
  VDS_PREVIEW_URL=http://localhost:3000 node vds-core/dashboard-server.mjs
46
46
  ```
47
47
 
48
+ ## Storybook
49
+
50
+ 1. **Generate stories** (after `npm run vds`):
51
+ ```bash
52
+ npm run vds:stories
53
+ ```
54
+ Add to `package.json` if missing:
55
+ ```json
56
+ "vds:stories": "node vds-core/story-generator.mjs"
57
+ ```
58
+
59
+ 2. **Context providers:** If components use React context (e.g. `useTimer`, `useSidebar`, `useCircles`, drag-drop context), they will error in Storybook unless wrapped with the right providers. In your project, add decorators in `.storybook/preview.tsx` to wrap all stories (or per-story) with your app’s providers (e.g. `TimerProvider`, `SidebarProvider`, `CirclesProvider`). See [Storybook decorators](https://storybook.js.org/docs/writing-stories/decorators).
60
+
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.
62
+
48
63
  ## Layout
49
64
 
50
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`.
51
67
  - `vds-core/VdsPreview.tsx` — Optional; mount at `/vds-preview` so the dashboard can show live component renders.
52
68
  - Dashboard UI reads `/vds-output.json`, renders Foundations + Component Library.
@@ -316,9 +316,10 @@ function extractBrandAssets() {
316
316
  return assets;
317
317
  }
318
318
 
319
- /** Extract icon names from `import { A, B, C } from "lucide-react"` (or 'lucide-react'). Returns unique list. */
319
+ /** Extract icon names from `import { A, B, C } from "lucide-react"` in app code only (exclude stories so generated Star/defaults don't pollute). */
320
320
  function extractLucideIconsUsed(srcDir) {
321
- const files = getAllTsxJsxInDir(srcDir);
321
+ const allFiles = getAllTsxJsxInDir(srcDir);
322
+ const files = allFiles.filter((rel) => !/^stories[/\\]/.test(rel.replace(/\\/g, "/")));
322
323
  const names = new Set();
323
324
  const importRe = /import\s*\{([^}]+)\}\s*from\s*["']lucide-react["']/g;
324
325
  for (const rel of files) {
@@ -542,17 +542,26 @@ function getItemTypeFieldsFromSource(source, itemTypeName) {
542
542
  return fields;
543
543
  }
544
544
 
545
- /** Build 2-3 mock items for array prop from component source (item type fields). */
545
+ /** Whether a field name is date/time-like (for safe mock values and avoiding "Invalid time value"). */
546
+ function isDateLikeField(name) {
547
+ if (!name || typeof name !== "string") return false;
548
+ const n = name.toLowerCase();
549
+ return /date|time|start|end|created|updated|timeline/.test(n);
550
+ }
551
+
552
+ /** Build 2-3 mock items for array prop from component source (item type fields). Uses valid ISO date strings for date-like fields to avoid "Invalid time value". */
546
553
  function buildMockArrayItems(componentSource, itemTypeName, propName) {
547
554
  const fields = getItemTypeFieldsFromSource(componentSource, itemTypeName);
548
555
  const defaultFields = ["label", "value", "title", "id", "name", "description"];
549
556
  const useFields = fields.length ? fields : defaultFields;
550
557
  const items = [];
558
+ const baseDate = new Date("2024-01-15T12:00:00.000Z").getTime();
551
559
  for (let i = 1; i <= 3; i++) {
552
560
  const item = {};
553
561
  for (const f of useFields) {
554
562
  if (f === "id") item[f] = String(i);
555
563
  else if (f === "value") item[f] = String(100 - i * 25);
564
+ else if (isDateLikeField(f)) item[f] = new Date(baseDate + i * 86400000).toISOString();
556
565
  else item[f] = `Example ${i}`;
557
566
  }
558
567
  items.push(item);
@@ -637,6 +646,9 @@ function buildDefaultArgsForRequiredProps(props, usageFromPages = null, componen
637
646
  } else if (fromPages[name] !== undefined && fromPages[name] !== null) {
638
647
  argLines.push(` ${name}: ${JSON.stringify(String(fromPages[name]))},`);
639
648
  added.add(name);
649
+ } else if (/Date\b/.test(type) || /^(currentDate|startDate|endDate|date)$/.test(name)) {
650
+ argLines.push(` ${name}: ${JSON.stringify(new Date().toISOString())},`);
651
+ added.add(name);
640
652
  } else if (/string/.test(type)) {
641
653
  argLines.push(` ${name}: ${stringFallback(name)},`);
642
654
  added.add(name);
@@ -1138,7 +1150,9 @@ function writeFoundationsStories(foundations) {
1138
1150
  "",
1139
1151
  "export const Default: Story = {",
1140
1152
  " render: () => (",
1141
- " <div style={{ display: \"grid\", gridTemplateColumns: \"repeat(auto-fill, minmax(100px, 1fr))\", gap: 16, padding: 24 }}>",
1153
+ " <div style={{ padding: 24 }}>",
1154
+ " <p style={{ marginBottom: 16, color: \"#888\", fontSize: 14 }}>Icons imported from lucide-react in app code (src/, excluding stories).</p>",
1155
+ " <div style={{ display: \"grid\", gridTemplateColumns: \"repeat(auto-fill, minmax(100px, 1fr))\", gap: 16 }}>",
1142
1156
  " {iconNames.map((name) => {",
1143
1157
  " const Icon = Lucide[name];",
1144
1158
  " if (!Icon) return null;",
@@ -1149,6 +1163,7 @@ function writeFoundationsStories(foundations) {
1149
1163
  " </div>",
1150
1164
  " );",
1151
1165
  " })}",
1166
+ " </div>",
1152
1167
  " </div>",
1153
1168
  " ),",
1154
1169
  "};",