vibe-design-system 2.5.40 → 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
|
@@ -498,6 +498,11 @@ const RENDER_ARGS_FALLBACKS = {
|
|
|
498
498
|
TaskEstimateInput: ", estimate: (args && args.estimate) ?? 0, value: (args && args.value) ?? 0, task: (args && args.task) ?? { id: \"1\", title: \"Example\", estimate: 0 }",
|
|
499
499
|
};
|
|
500
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 }`,
|
|
504
|
+
};
|
|
505
|
+
|
|
501
506
|
/** Recursive list of .tsx/.jsx file paths under dir (relative to dir). Index.tsx / index.tsx first for deterministic "first usage". */
|
|
502
507
|
function getAllTsxJsxUnderDir(dir) {
|
|
503
508
|
if (!fs.existsSync(dir)) return [];
|
|
@@ -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,13 +1098,15 @@ function buildStoryFileContent(comp) {
|
|
|
1087
1098
|
return lines.join("\n");
|
|
1088
1099
|
}
|
|
1089
1100
|
|
|
1090
|
-
//
|
|
1091
|
-
const
|
|
1092
|
-
const
|
|
1093
|
-
const
|
|
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");
|
|
1094
1107
|
const renderLine = useReactNodeChildrenRender
|
|
1095
|
-
? ` render: (args) => React.createElement(React.Suspense, { fallback: null }, React.createElement(
|
|
1096
|
-
: ` render: ${argsParam} => React.createElement(React.Suspense, { fallback: null }, React.createElement(
|
|
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})),`;
|
|
1097
1110
|
const childrenArgLine = (label) => (!omitChildren && !useReactNodeChildrenRender ? ` children: ${JSON.stringify(label)},` : null);
|
|
1098
1111
|
|
|
1099
1112
|
if (!variants.length) {
|