vibe-design-system 2.8.70 → 2.8.71

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.8.70",
3
+ "version": "2.8.71",
4
4
  "description": "Auto-generate design systems for vibe coding projects",
5
5
  "homepage": "https://vibedesign.tech",
6
6
  "repository": {
@@ -4099,9 +4099,11 @@ function writeComponentInventoryStory(components, foundations) {
4099
4099
  }
4100
4100
 
4101
4101
  const { actualExport, isDefault } = exportInfo;
4102
- importInfoMap[comp.name] = { identifier, importAlias, isDefault, actualExport, skip: false };
4102
+ const isShadcn = (comp.group || '').toLowerCase() === 'shadcn';
4103
+ importInfoMap[comp.name] = { identifier, importAlias, isDefault, actualExport, skip: false, isShadcn };
4103
4104
 
4104
- if (!seenAliases.has(importAlias)) {
4105
+ // Only import shadcn UI primitives — project components are shown via story iframes
4106
+ if (isShadcn && !seenAliases.has(importAlias)) {
4105
4107
  seenAliases.add(importAlias);
4106
4108
  orderedImports.push({ identifier, importAlias, isDefault, actualExport });
4107
4109
  }
@@ -4186,10 +4188,13 @@ function writeComponentInventoryStory(components, foundations) {
4186
4188
  return `import { ${namedPart} } from "${imp.importAlias}";`;
4187
4189
  });
4188
4190
 
4189
- // ── PREVIEWS map entries (only for non-skipped components) ─────────────────
4191
+ // ── PREVIEWS map: only shadcn UI primitives (safe to render with no props) ──
4190
4192
  const TEXT_CHILD_NAMES = new Set(['button','badge','toggle','label','link','chip','tag','pill']);
4191
4193
  const previewEntries = components
4192
- .filter(comp => importInfoMap[comp.name] && !importInfoMap[comp.name].skip)
4194
+ .filter(comp => {
4195
+ const info = importInfoMap[comp.name];
4196
+ return info && !info.skip && info.isShadcn;
4197
+ })
4193
4198
  .map(comp => {
4194
4199
  const { identifier } = importInfoMap[comp.name];
4195
4200
  const hasText = TEXT_CHILD_NAMES.has(identifier.toLowerCase());
@@ -4199,6 +4204,26 @@ function writeComponentInventoryStory(components, foundations) {
4199
4204
  return ` ${JSON.stringify(comp.name)}: ${call}`;
4200
4205
  });
4201
4206
 
4207
+ // ── STORY_IDS map: project components get embedded as story iframes ─────────
4208
+ // Story ID = "{category}/{name}" → lowercase, spaces/slashes → hyphens → "--default"
4209
+ function toStoryId(category, name) {
4210
+ return [category, name].join('/')
4211
+ .toLowerCase().replace(/[^a-z0-9/]+/g, '-').replace(/-*\/+/g, '-')
4212
+ .replace(/-+/g, '-').replace(/^-|-$/g, '') + '--default';
4213
+ }
4214
+ const storyIdEntries = components
4215
+ .filter(comp => {
4216
+ const info = importInfoMap[comp.name];
4217
+ return info && !info.isShadcn; // project (non-shadcn) components only
4218
+ })
4219
+ .map(comp => {
4220
+ // Find the category for this component from categorized
4221
+ const cat = Object.keys(categorized).find(c => categorized[c].some(x => x.name === comp.name));
4222
+ if (!cat) return null;
4223
+ return ` ${JSON.stringify(comp.name)}: ${JSON.stringify(toStoryId(cat, comp.name))}`;
4224
+ })
4225
+ .filter(Boolean);
4226
+
4202
4227
  // ── Generate story file ────────────────────────────────────────────────────
4203
4228
  const content = [
4204
4229
  `import React from "react";`,
@@ -4224,10 +4249,14 @@ function writeComponentInventoryStory(components, foundations) {
4224
4249
  ] : [
4225
4250
  `const _PW = ({ children }: { children: React.ReactNode }) => React.createElement(React.Fragment, null, children) as React.ReactElement;`,
4226
4251
  ]),
4227
- // PREVIEWS: each component renders via its real import; ErrorBoundary catches failures
4252
+ // PREVIEWS: shadcn UI primitives rendered directly (safe with no props)
4228
4253
  `const PREVIEWS: Record<string, () => React.ReactElement> = {`,
4229
4254
  ...previewEntries.map(e => e + ','),
4230
4255
  `};`,
4256
+ // STORY_IDS: project components shown via their own story iframe
4257
+ `const STORY_IDS: Record<string, string> = {`,
4258
+ ...storyIdEntries.map(e => e + ','),
4259
+ `};`,
4231
4260
  ``,
4232
4261
  // Inventory data (metadata only — visual rendering is done at runtime via PREVIEWS)
4233
4262
  `const inventoryData: { category: string; components: { name: string; group: string; tokenCount: number; propCount: number; colorSwatches: { token: string; hex: string }[]; previewHtml: string; previewScale: number; active: boolean }[] }[] = ${JSON.stringify(inventoryData)};`,
@@ -4235,30 +4264,44 @@ function writeComponentInventoryStory(components, foundations) {
4235
4264
  `const activeComponents = ${activeComponents};`,
4236
4265
  `const uniqueTokens = ${uniqueTokens};`,
4237
4266
  ``,
4238
- // CardPreview: renders the actual component at the right scale, falls back to shape HTML
4267
+ // CardPreview: shadcn direct render; project story iframe; else shape HTML
4239
4268
  `const _InvPreview = ({ comp }: { comp: any }) => {`,
4240
- ` const s: number = comp.previewScale || 0.4;`,
4241
- ` const centered = s >= 0.9;`,
4242
4269
  ` const fn = PREVIEWS[comp.name];`,
4270
+ ` const storyId = STORY_IDS[comp.name];`,
4243
4271
  ` const shapeHtml = (`,
4244
4272
  ` <div style={{ width: "100%", height: "100%", display: "flex", alignItems: "center", justifyContent: "center" }}`,
4245
4273
  ` dangerouslySetInnerHTML={{ __html: comp.previewHtml }} />`,
4246
4274
  ` );`,
4247
- ` const wPct = (+(100 / s).toFixed(1)) + "%";`,
4248
- ` const innerStyle: React.CSSProperties = centered`,
4249
- ` ? { position: "absolute", top: "50%", left: "50%",`,
4250
- ` transform: "translate(-50%, -50%) scale(" + s + ")",`,
4251
- ` transformOrigin: "center center", pointerEvents: "none" }`,
4252
- ` : { position: "absolute", top: 0, left: 0, width: wPct,`,
4253
- ` transform: "scale(" + s + ")",`,
4254
- ` transformOrigin: "top left", pointerEvents: "none" };`,
4255
- ` return (`,
4256
- ` <div style={{ height: 96, overflow: "hidden", position: "relative", background: "#fff" }}>`,
4257
- ` <_EB fallback={shapeHtml}>`,
4258
- ` {fn ? <_PW><div style={innerStyle}>{fn()}</div></_PW> : shapeHtml}`,
4259
- ` </_EB>`,
4260
- ` </div>`,
4261
- ` );`,
4275
+ ` // Shadcn primitives: render directly with scale`,
4276
+ ` if (fn) {`,
4277
+ ` const s: number = comp.previewScale || 0.65;`,
4278
+ ` const centered = s >= 0.9;`,
4279
+ ` const wPct = (+(100 / s).toFixed(1)) + "%";`,
4280
+ ` const innerStyle: React.CSSProperties = centered`,
4281
+ ` ? { position: "absolute", top: "50%", left: "50%", transform: "translate(-50%, -50%) scale(" + s + ")", transformOrigin: "center center", pointerEvents: "none" }`,
4282
+ ` : { position: "absolute", top: 0, left: 0, width: wPct, transform: "scale(" + s + ")", transformOrigin: "top left", pointerEvents: "none" };`,
4283
+ ` return (`,
4284
+ ` <div style={{ height: 140, overflow: "hidden", position: "relative", background: "#fff" }}>`,
4285
+ ` <_EB fallback={shapeHtml}>`,
4286
+ ` <_PW><div style={innerStyle}>{fn()}</div></_PW>`,
4287
+ ` </_EB>`,
4288
+ ` </div>`,
4289
+ ` );`,
4290
+ ` }`,
4291
+ ` // Project components: embed their own story as iframe`,
4292
+ ` if (storyId) {`,
4293
+ ` return (`,
4294
+ ` <div style={{ height: 140, overflow: "hidden", position: "relative", background: "#fff" }}>`,
4295
+ ` <iframe`,
4296
+ ` src={"/iframe.html?id=" + storyId + "&viewMode=story"}`,
4297
+ ` style={{ width: "300%", height: "424px", transform: "scale(0.333)", transformOrigin: "top left", border: "none", pointerEvents: "none", display: "block" }}`,
4298
+ ` loading="lazy"`,
4299
+ ` />`,
4300
+ ` </div>`,
4301
+ ` );`,
4302
+ ` }`,
4303
+ ` // Fallback: shape HTML`,
4304
+ ` return <div style={{ height: 140, display: "flex", alignItems: "center", justifyContent: "center" }} dangerouslySetInnerHTML={{ __html: comp.previewHtml }} />;`,
4262
4305
  `};`,
4263
4306
  `const InventoryCard = ({ comp }: { comp: any }) => (`,
4264
4307
  ` <div style={{ border: "1px solid " + (comp.active ? "#e5e7eb" : "#f0f0f0"), borderRadius: 10, overflow: "hidden", background: comp.active ? "#fff" : "#fafafa", display: "flex", flexDirection: "column" as any, boxShadow: comp.active ? "0 1px 3px rgba(0,0,0,0.05)" : "none", opacity: comp.active ? 1 : 0.55 }}>`,