vibe-design-system 2.5.37 → 2.5.39
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
|
@@ -478,6 +478,26 @@ const REACTNODE_PLACEHOLDER_TEXT = {
|
|
|
478
478
|
children: "Example content",
|
|
479
479
|
};
|
|
480
480
|
|
|
481
|
+
/** Component adına göre ekstra args (toString/undefined hatalarını önlemek için; her prop güvenli değer alır). */
|
|
482
|
+
const COMPONENT_EXTRA_ARGS = {
|
|
483
|
+
TaskEstimateInput: [
|
|
484
|
+
" task: { id: \"1\", title: \"Example\", estimate: 0, description: \"\" },",
|
|
485
|
+
" estimate: 0,",
|
|
486
|
+
" value: 0,",
|
|
487
|
+
" initialValue: 0,",
|
|
488
|
+
" defaultValue: 0,",
|
|
489
|
+
" min: 0,",
|
|
490
|
+
" max: 100,",
|
|
491
|
+
" step: 1,",
|
|
492
|
+
" taskId: \"1\",",
|
|
493
|
+
],
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
/** Render'da args'a uygulanacak fallback (useState(estimate.toString()) gibi kullanımlar için; Controls undefined yapsa bile). */
|
|
497
|
+
const RENDER_ARGS_FALLBACKS = {
|
|
498
|
+
TaskEstimateInput: ", estimate: args.estimate ?? 0, value: args.value ?? 0, task: args.task ?? { id: \"1\", title: \"Example\", estimate: 0 }",
|
|
499
|
+
};
|
|
500
|
+
|
|
481
501
|
/** Recursive list of .tsx/.jsx file paths under dir (relative to dir). Index.tsx / index.tsx first for deterministic "first usage". */
|
|
482
502
|
function getAllTsxJsxUnderDir(dir) {
|
|
483
503
|
if (!fs.existsSync(dir)) return [];
|
|
@@ -734,6 +754,29 @@ function buildDefaultArgsForRequiredProps(props, usageFromPages = null, componen
|
|
|
734
754
|
added.add(key);
|
|
735
755
|
}
|
|
736
756
|
}
|
|
757
|
+
// Component-specific extra args (COMPONENT_EXTRA_ARGS) — tüm olası proplar güvenli değer alsın
|
|
758
|
+
const extraLines = componentName && COMPONENT_EXTRA_ARGS[componentName];
|
|
759
|
+
if (extraLines) {
|
|
760
|
+
for (const line of extraLines) {
|
|
761
|
+
const keyMatch = line.match(/^\s*(\w+)\s*:/);
|
|
762
|
+
const key = keyMatch ? keyMatch[1] : null;
|
|
763
|
+
if (key && !added.has(key)) {
|
|
764
|
+
argLines.push(line);
|
|
765
|
+
added.add(key);
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
// COMPONENT_EXTRA_ARGS: props listesi boş olsa bile (örn. parse edilemeyen component) uygula
|
|
771
|
+
if (componentName && COMPONENT_EXTRA_ARGS[componentName]) {
|
|
772
|
+
for (const line of COMPONENT_EXTRA_ARGS[componentName]) {
|
|
773
|
+
const keyMatch = line.match(/^\s*(\w+)\s*:/);
|
|
774
|
+
const key = keyMatch ? keyMatch[1] : null;
|
|
775
|
+
if (key && !added.has(key)) {
|
|
776
|
+
argLines.push(line);
|
|
777
|
+
added.add(key);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
737
780
|
}
|
|
738
781
|
for (const name of Object.keys(fromPages)) {
|
|
739
782
|
if (added.has(name)) continue;
|
|
@@ -1045,9 +1088,11 @@ function buildStoryFileContent(comp) {
|
|
|
1045
1088
|
}
|
|
1046
1089
|
|
|
1047
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";
|
|
1048
1093
|
const renderLine = useReactNodeChildrenRender
|
|
1049
1094
|
? ` render: (args) => React.createElement(React.Suspense, { fallback: null }, React.createElement(ComponentRef, { ...args, children: args.children || React.createElement('span', null, 'Example') })),`
|
|
1050
|
-
: ` render: (args) => React.createElement(React.Suspense, { fallback: null }, React.createElement(ComponentRef,
|
|
1095
|
+
: ` render: (args) => React.createElement(React.Suspense, { fallback: null }, React.createElement(ComponentRef, ${propsArg})),`;
|
|
1051
1096
|
const childrenArgLine = (label) => (!omitChildren && !useReactNodeChildrenRender ? ` children: ${JSON.stringify(label)},` : null);
|
|
1052
1097
|
|
|
1053
1098
|
if (!variants.length) {
|