vibe-design-system 2.5.39 → 2.5.41

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.39",
3
+ "version": "2.5.41",
4
4
  "description": "Auto-generate design systems for vibe coding projects",
5
5
  "type": "module",
6
6
  "bin": {
@@ -493,9 +493,14 @@ const COMPONENT_EXTRA_ARGS = {
493
493
  ],
494
494
  };
495
495
 
496
- /** Render'da args'a uygulanacak fallback (useState(estimate.toString()) gibi kullanımlar için; Controls undefined yapsa bile). */
496
+ /** Render'da args'a uygulanacak fallback (useState(estimate.toString()) gibi kullanımlar için; args/Controls undefined yapsa bile). */
497
497
  const RENDER_ARGS_FALLBACKS = {
498
- TaskEstimateInput: ", estimate: args.estimate ?? 0, value: args.value ?? 0, task: args.task ?? { id: \"1\", title: \"Example\", estimate: 0 }",
498
+ TaskEstimateInput: ", estimate: (args && args.estimate) ?? 0, value: (args && args.value) ?? 0, task: (args && args.task) ?? { id: \"1\", title: \"Example\", estimate: 0 }",
499
+ };
500
+
501
+ /** Kalıcı çözüm: Storybook Docs/Controls args'ı geçmezse bile component'a güvenli props veren wrapper. Önce safeDefaults uygulanır, sonra gelen props. */
502
+ const SAFE_WRAPPER_DEFAULTS = {
503
+ TaskEstimateInput: `{ estimate: 0, onUpdate: () => {}, value: 0, task: { id: "1", title: "Example", estimate: 0 }, compact: false }`,
499
504
  };
500
505
 
501
506
  /** Recursive list of .tsx/.jsx file paths under dir (relative to dir). Index.tsx / index.tsx first for deterministic "first usage". */
@@ -1063,6 +1068,12 @@ function buildStoryFileContent(comp) {
1063
1068
  lines.push(`const ComponentRef = React.lazy(() => import(/* @vite-ignore */ "${importPath}").then(${getDefault}).catch(() => ({ default: ${loadFallback} })));`);
1064
1069
  lines.push("");
1065
1070
 
1071
+ const safeDefaultsObj = componentName && SAFE_WRAPPER_DEFAULTS[componentName];
1072
+ if (safeDefaultsObj) {
1073
+ lines.push(`const safeDefaults = ${safeDefaultsObj};`);
1074
+ lines.push(`const SafeWrapper = (props) => React.createElement(ComponentRef, { ...safeDefaults, ...(props || {}) });`);
1075
+ lines.push("");
1076
+ }
1066
1077
  lines.push(`const meta = {`);
1067
1078
  lines.push(` title: ${JSON.stringify(title)},`);
1068
1079
  lines.push(` component: ComponentRef,`);
@@ -1087,12 +1098,15 @@ function buildStoryFileContent(comp) {
1087
1098
  return lines.join("\n");
1088
1099
  }
1089
1100
 
1090
- // Wrap in Suspense so lazy load errors render fallback instead of crashing
1091
- const argsFallback = (componentName && RENDER_ARGS_FALLBACKS[componentName]) || "";
1092
- const propsArg = argsFallback ? `{ ...args${argsFallback} }` : "args";
1101
+ // Kalıcı çözüm: SafeWrapper varsa her zaman onu kullan (Docs/Controls args geçmese bile safeDefaults uygulanır)
1102
+ const useSafeWrapper = componentName && SAFE_WRAPPER_DEFAULTS[componentName];
1103
+ const RenderTarget = useSafeWrapper ? "SafeWrapper" : "ComponentRef";
1104
+ const argsFallback = !useSafeWrapper && (componentName && RENDER_ARGS_FALLBACKS[componentName]) || "";
1105
+ const argsParam = (useSafeWrapper || argsFallback) ? "(args = {})" : "(args)";
1106
+ const propsArg = argsFallback ? `{ ...args${argsFallback} }` : (useSafeWrapper ? "args" : "args");
1093
1107
  const renderLine = useReactNodeChildrenRender
1094
- ? ` render: (args) => React.createElement(React.Suspense, { fallback: null }, React.createElement(ComponentRef, { ...args, children: args.children || React.createElement('span', null, 'Example') })),`
1095
- : ` render: (args) => React.createElement(React.Suspense, { fallback: null }, React.createElement(ComponentRef, ${propsArg})),`;
1108
+ ? ` render: (args) => React.createElement(React.Suspense, { fallback: null }, React.createElement(${RenderTarget}, { ...args, children: args.children || React.createElement('span', null, 'Example') })),`
1109
+ : ` render: ${argsParam} => React.createElement(React.Suspense, { fallback: null }, React.createElement(${RenderTarget}, ${propsArg})),`;
1096
1110
  const childrenArgLine = (label) => (!omitChildren && !useReactNodeChildrenRender ? ` children: ${JSON.stringify(label)},` : null);
1097
1111
 
1098
1112
  if (!variants.length) {