vibe-design-system 2.5.36 → 2.5.38
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,21 @@ 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
|
+
|
|
481
496
|
/** Recursive list of .tsx/.jsx file paths under dir (relative to dir). Index.tsx / index.tsx first for deterministic "first usage". */
|
|
482
497
|
function getAllTsxJsxUnderDir(dir) {
|
|
483
498
|
if (!fs.existsSync(dir)) return [];
|
|
@@ -687,7 +702,7 @@ function buildDefaultArgsForRequiredProps(props, usageFromPages = null, componen
|
|
|
687
702
|
}
|
|
688
703
|
}
|
|
689
704
|
// Optional props that often cause "reading X of undefined" or "reading 'toString'" in Storybook if missing
|
|
690
|
-
const NUMBER_LIKE_OPTIONAL = new Set(["value", "amount", "total", "count", "hours", "minutes", "progress", "percent", "visibility", "estimate"]);
|
|
705
|
+
const NUMBER_LIKE_OPTIONAL = new Set(["value", "amount", "total", "count", "hours", "minutes", "progress", "percent", "visibility", "estimate", "initialValue", "defaultValue", "currentValue", "initialEstimate", "defaultEstimate"]);
|
|
691
706
|
const DATE_RANGE_DEFAULT = `{ dateRange: { from: new Date().toISOString(), to: new Date().toISOString() } }`;
|
|
692
707
|
for (const p of props) {
|
|
693
708
|
const type = String(p.type || "").trim();
|
|
@@ -725,6 +740,38 @@ function buildDefaultArgsForRequiredProps(props, usageFromPages = null, componen
|
|
|
725
740
|
added.add(name);
|
|
726
741
|
}
|
|
727
742
|
}
|
|
743
|
+
// TaskEstimateInput etc.: ensure task, estimate, value always have safe defaults (avoid .toString() on undefined)
|
|
744
|
+
if (componentName && /Task|Estimate|Input/i.test(componentName)) {
|
|
745
|
+
for (const key of ["task", "estimate", "value"]) {
|
|
746
|
+
if (added.has(key)) continue;
|
|
747
|
+
if (key === "task") argLines.push(` task: { id: "1", title: "Example", estimate: 0 },`);
|
|
748
|
+
else argLines.push(` ${key}: 0,`);
|
|
749
|
+
added.add(key);
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
// Component-specific extra args (COMPONENT_EXTRA_ARGS) — tüm olası proplar güvenli değer alsın
|
|
753
|
+
const extraLines = componentName && COMPONENT_EXTRA_ARGS[componentName];
|
|
754
|
+
if (extraLines) {
|
|
755
|
+
for (const line of extraLines) {
|
|
756
|
+
const keyMatch = line.match(/^\s*(\w+)\s*:/);
|
|
757
|
+
const key = keyMatch ? keyMatch[1] : null;
|
|
758
|
+
if (key && !added.has(key)) {
|
|
759
|
+
argLines.push(line);
|
|
760
|
+
added.add(key);
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
// COMPONENT_EXTRA_ARGS: props listesi boş olsa bile (örn. parse edilemeyen component) uygula
|
|
766
|
+
if (componentName && COMPONENT_EXTRA_ARGS[componentName]) {
|
|
767
|
+
for (const line of COMPONENT_EXTRA_ARGS[componentName]) {
|
|
768
|
+
const keyMatch = line.match(/^\s*(\w+)\s*:/);
|
|
769
|
+
const key = keyMatch ? keyMatch[1] : null;
|
|
770
|
+
if (key && !added.has(key)) {
|
|
771
|
+
argLines.push(line);
|
|
772
|
+
added.add(key);
|
|
773
|
+
}
|
|
774
|
+
}
|
|
728
775
|
}
|
|
729
776
|
for (const name of Object.keys(fromPages)) {
|
|
730
777
|
if (added.has(name)) continue;
|