vibe-design-system 2.8.50 → 2.8.51
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
|
@@ -1603,7 +1603,15 @@ function buildProfileRenderLine(profile, RenderTarget, argsFallback) {
|
|
|
1603
1603
|
)},`;
|
|
1604
1604
|
case "SAFE":
|
|
1605
1605
|
return ` render: (args = {}) => ${suspense(`React.createElement(${RenderTarget}, args)`)},`;
|
|
1606
|
-
|
|
1606
|
+
case "VARIANT": {
|
|
1607
|
+
// Wrap in inline-block div to prevent vertical stretching caused by
|
|
1608
|
+
// global SidebarProvider/flex decorators or layout: "fullscreen" in preview.
|
|
1609
|
+
const argsParam = argsFallback ? "(args = {})" : "(args)";
|
|
1610
|
+
const propsArg = argsFallback ? `{ ...args${argsFallback} }` : "args";
|
|
1611
|
+
const inner = suspense(`React.createElement(${RenderTarget}, ${propsArg})`);
|
|
1612
|
+
return ` render: ${argsParam} => React.createElement('div', { style: { display: 'inline-block' } }, ${inner}),`;
|
|
1613
|
+
}
|
|
1614
|
+
default: { // CONFIGURED
|
|
1607
1615
|
const argsParam = argsFallback ? "(args = {})" : "(args)";
|
|
1608
1616
|
const propsArg = argsFallback ? `{ ...args${argsFallback} }` : "args";
|
|
1609
1617
|
return ` render: ${argsParam} => ${suspense(`React.createElement(${RenderTarget}, ${propsArg})`)},`;
|
|
@@ -1796,6 +1804,90 @@ function buildStoryFileContent(comp) {
|
|
|
1796
1804
|
return lines.join("\n");
|
|
1797
1805
|
}
|
|
1798
1806
|
|
|
1807
|
+
/**
|
|
1808
|
+
* Fallback grid system scanner — reads source files for Tailwind grid patterns
|
|
1809
|
+
* when scan.mjs didn't produce gridSystem data.
|
|
1810
|
+
*/
|
|
1811
|
+
function scanGridSystemFallback() {
|
|
1812
|
+
const srcDirs = [
|
|
1813
|
+
path.join(PROJECT_ROOT, "src"),
|
|
1814
|
+
path.join(PROJECT_ROOT, "client/src"),
|
|
1815
|
+
path.join(PROJECT_ROOT, "app"),
|
|
1816
|
+
];
|
|
1817
|
+
const breakpoints = {}; // { "md": { count, topFiles: [] }, ... }
|
|
1818
|
+
const gridCols = {}; // { "2": { count }, "3": { count }, ... }
|
|
1819
|
+
const gaps = {}; // { "4": { count }, "6": { count }, ... }
|
|
1820
|
+
const maxWidths = {}; // { "7xl": count, ... }
|
|
1821
|
+
let containerCount = 0;
|
|
1822
|
+
|
|
1823
|
+
const BP_NAMES = ["sm", "md", "lg", "xl", "2xl"];
|
|
1824
|
+
const bpRe = /\b(sm|md|lg|xl|2xl):/g;
|
|
1825
|
+
const colRe = /\bgrid-cols-(\w+)/g;
|
|
1826
|
+
const gapRe = /\bgap-(\w+)/g;
|
|
1827
|
+
const maxWRe = /\bmax-w-(\w+)/g;
|
|
1828
|
+
const containerRe = /\bcontainer\b/g;
|
|
1829
|
+
|
|
1830
|
+
function walkFiles(dir) {
|
|
1831
|
+
if (!fs.existsSync(dir)) return;
|
|
1832
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
1833
|
+
for (const entry of entries) {
|
|
1834
|
+
const full = path.join(dir, entry.name);
|
|
1835
|
+
if (entry.isDirectory()) {
|
|
1836
|
+
if (["node_modules", ".next", "dist", "build", ".storybook", "stories"].includes(entry.name)) continue;
|
|
1837
|
+
walkFiles(full);
|
|
1838
|
+
} else if (/\.(tsx|jsx|ts|js|css)$/.test(entry.name)) {
|
|
1839
|
+
try {
|
|
1840
|
+
const content = fs.readFileSync(full, "utf-8");
|
|
1841
|
+
const relFile = path.relative(PROJECT_ROOT, full).replace(/^(client\/)?src\//, "");
|
|
1842
|
+
const shortName = path.basename(relFile, path.extname(relFile));
|
|
1843
|
+
|
|
1844
|
+
// Breakpoints
|
|
1845
|
+
let m;
|
|
1846
|
+
while ((m = bpRe.exec(content)) !== null) {
|
|
1847
|
+
const bp = m[1];
|
|
1848
|
+
if (!breakpoints[bp]) breakpoints[bp] = { count: 0, topFiles: [] };
|
|
1849
|
+
breakpoints[bp].count++;
|
|
1850
|
+
if (!breakpoints[bp].topFiles.includes(shortName) && breakpoints[bp].topFiles.length < 5) {
|
|
1851
|
+
breakpoints[bp].topFiles.push(shortName);
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
|
|
1855
|
+
// Grid columns
|
|
1856
|
+
while ((m = colRe.exec(content)) !== null) {
|
|
1857
|
+
const col = m[1];
|
|
1858
|
+
if (!gridCols[col]) gridCols[col] = { count: 0 };
|
|
1859
|
+
gridCols[col].count++;
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1862
|
+
// Gaps
|
|
1863
|
+
while ((m = gapRe.exec(content)) !== null) {
|
|
1864
|
+
const gap = m[1];
|
|
1865
|
+
if (!gaps[gap]) gaps[gap] = { count: 0 };
|
|
1866
|
+
gaps[gap].count++;
|
|
1867
|
+
}
|
|
1868
|
+
|
|
1869
|
+
// Max widths
|
|
1870
|
+
while ((m = maxWRe.exec(content)) !== null) {
|
|
1871
|
+
const mw = m[1];
|
|
1872
|
+
if (!maxWidths[mw]) maxWidths[mw] = 0;
|
|
1873
|
+
maxWidths[mw]++;
|
|
1874
|
+
}
|
|
1875
|
+
|
|
1876
|
+
// Container
|
|
1877
|
+
const cMatches = content.match(containerRe);
|
|
1878
|
+
if (cMatches) containerCount += cMatches.length;
|
|
1879
|
+
|
|
1880
|
+
} catch { /* skip unreadable files */ }
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1884
|
+
|
|
1885
|
+
for (const dir of srcDirs) walkFiles(dir);
|
|
1886
|
+
|
|
1887
|
+
if (Object.keys(breakpoints).length === 0 && Object.keys(gridCols).length === 0) return null;
|
|
1888
|
+
return { breakpoints, gridCols, gaps, maxWidths, containerCount };
|
|
1889
|
+
}
|
|
1890
|
+
|
|
1799
1891
|
function writeFoundationsStories(foundations) {
|
|
1800
1892
|
const foundationsDir = path.join(STORIES_DIR, "foundations");
|
|
1801
1893
|
ensureDir(foundationsDir);
|
|
@@ -2275,7 +2367,11 @@ function writeFoundationsStories(foundations) {
|
|
|
2275
2367
|
console.log("[VDS] Wrote " + path.relative(PROJECT_ROOT, path.join(foundationsDir, "Icons.stories.tsx")));
|
|
2276
2368
|
}
|
|
2277
2369
|
|
|
2278
|
-
|
|
2370
|
+
// Fallback: if scan.mjs didn't produce gridSystem data, scan source files directly
|
|
2371
|
+
let gridSystem = foundations?.gridSystem || null;
|
|
2372
|
+
if (!gridSystem || (Object.keys(gridSystem.breakpoints || {}).length === 0 && Object.keys(gridSystem.gridCols || {}).length === 0)) {
|
|
2373
|
+
gridSystem = scanGridSystemFallback();
|
|
2374
|
+
}
|
|
2279
2375
|
if (gridSystem && (Object.keys(gridSystem.breakpoints || {}).length > 0 || Object.keys(gridSystem.gridCols || {}).length > 0)) {
|
|
2280
2376
|
const bpEntries = Object.entries(gridSystem.breakpoints || {});
|
|
2281
2377
|
const colEntries = Object.entries(gridSystem.gridCols || {});
|