vibe-design-system 2.8.7 → 2.8.9
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/bin/init.js
CHANGED
|
@@ -27,7 +27,7 @@ import path from "path";
|
|
|
27
27
|
|
|
28
28
|
const config: StorybookConfig = {
|
|
29
29
|
stories: ["../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
|
|
30
|
-
addons: ["@storybook/addon-essentials"],
|
|
30
|
+
addons: ["@storybook/addon-essentials", "@storybook/addon-a11y"],
|
|
31
31
|
framework: {
|
|
32
32
|
name: "@storybook/react-vite",
|
|
33
33
|
options: {},
|
|
@@ -233,7 +233,7 @@ const config: StorybookConfig = {
|
|
|
233
233
|
"../src/**/*.stories.@(js|jsx|mjs|ts|tsx)",
|
|
234
234
|
"../app/**/*.stories.@(js|jsx|mjs|ts|tsx)",
|
|
235
235
|
],
|
|
236
|
-
addons: ["@storybook/addon-essentials"],
|
|
236
|
+
addons: ["@storybook/addon-essentials", "@storybook/addon-a11y"],
|
|
237
237
|
framework: {
|
|
238
238
|
name: "@storybook/nextjs",
|
|
239
239
|
options: {},
|
|
@@ -250,7 +250,7 @@ import path from "path";
|
|
|
250
250
|
|
|
251
251
|
const config: StorybookConfig = {
|
|
252
252
|
stories: ["../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
|
|
253
|
-
addons: ["@storybook/addon-essentials"],
|
|
253
|
+
addons: ["@storybook/addon-essentials", "@storybook/addon-a11y"],
|
|
254
254
|
framework: {
|
|
255
255
|
name: "@storybook/react-vite",
|
|
256
256
|
options: {},
|
|
@@ -340,6 +340,7 @@ function installStorybook(projectRoot, framework) {
|
|
|
340
340
|
`${fwPkg}@${STORYBOOK_VERSION}`,
|
|
341
341
|
`@storybook/react@${STORYBOOK_VERSION}`,
|
|
342
342
|
`@storybook/addon-essentials@${STORYBOOK_VERSION}`,
|
|
343
|
+
`@storybook/addon-a11y@${STORYBOOK_VERSION}`,
|
|
343
344
|
`@storybook/blocks@${STORYBOOK_VERSION}`,
|
|
344
345
|
...extraDeps,
|
|
345
346
|
],
|
package/package.json
CHANGED
|
@@ -1254,10 +1254,18 @@ function extractFoundations() {
|
|
|
1254
1254
|
}
|
|
1255
1255
|
}
|
|
1256
1256
|
|
|
1257
|
-
const bodyMatch = css.match(/body\s*\{[^}]*font-family:\s*([^;]+);/);
|
|
1257
|
+
const bodyMatch = css.match(/body\s*\{[^}]*font-family:\s*([^;]+);/s);
|
|
1258
1258
|
if (bodyMatch) typography.body = bodyMatch[1].trim();
|
|
1259
|
-
const monoMatch = css.match(/code,\s*pre,\s*\.font-mono\s*\{[^}]*font-family:\s*([^;]+);/);
|
|
1259
|
+
const monoMatch = css.match(/code,\s*pre,\s*\.font-mono\s*\{[^}]*font-family:\s*([^;]+);/s);
|
|
1260
1260
|
if (monoMatch) typography.mono = monoMatch[1].trim();
|
|
1261
|
+
// Tailwind v4: CSS custom properties for fonts (--font-sans, --font-mono, --font-weight-*)
|
|
1262
|
+
const fontVarRe = /--font([\w-]*):\s*([^;\n]+);/g;
|
|
1263
|
+
let fvm;
|
|
1264
|
+
while ((fvm = fontVarRe.exec(css)) !== null) {
|
|
1265
|
+
const key = `font${fvm[1]}`.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
1266
|
+
const val = fvm[2].trim();
|
|
1267
|
+
if (!typography[key]) typography[key] = val;
|
|
1268
|
+
}
|
|
1261
1269
|
}
|
|
1262
1270
|
} catch (_) {}
|
|
1263
1271
|
|
|
@@ -423,9 +423,32 @@ function injectProviderDecorators(projectRoot) {
|
|
|
423
423
|
}
|
|
424
424
|
}
|
|
425
425
|
|
|
426
|
+
/** Mevcut projelerde .storybook/main.ts'e @storybook/addon-a11y ekler (yoksa). */
|
|
427
|
+
function injectA11yAddon(projectRoot) {
|
|
428
|
+
const storybookDir = path.join(projectRoot, ".storybook");
|
|
429
|
+
const mainCandidates = ["main.ts", "main.js", "main.tsx", "main.jsx"];
|
|
430
|
+
const mainFile = mainCandidates.map((f) => path.join(storybookDir, f)).find((f) => fs.existsSync(f));
|
|
431
|
+
if (!mainFile) return;
|
|
432
|
+
let content = fs.readFileSync(mainFile, "utf-8");
|
|
433
|
+
if (content.includes("addon-a11y")) return; // already present
|
|
434
|
+
// Insert addon-a11y after addon-essentials (or any last addon in the addons array)
|
|
435
|
+
const updated = content.replace(
|
|
436
|
+
/(addons\s*:\s*\[)([\s\S]*?)(\])/,
|
|
437
|
+
(match, open, inner, close) => {
|
|
438
|
+
const trimmed = inner.trimEnd();
|
|
439
|
+
const comma = trimmed.endsWith(",") ? "" : ",";
|
|
440
|
+
return `${open}${trimmed}${comma}\n "@storybook/addon-a11y",\n ${close}`;
|
|
441
|
+
}
|
|
442
|
+
);
|
|
443
|
+
if (updated === content) return;
|
|
444
|
+
fs.writeFileSync(mainFile, updated, "utf-8");
|
|
445
|
+
console.log("[VDS] .storybook/main.ts: @storybook/addon-a11y eklendi.");
|
|
446
|
+
}
|
|
447
|
+
|
|
426
448
|
const isMain = process.argv[1] && path.resolve(process.argv[1]) === path.resolve(fileURLToPath(import.meta.url));
|
|
427
449
|
if (isMain) {
|
|
450
|
+
injectA11yAddon(PROJECT_ROOT);
|
|
428
451
|
injectProviderDecorators(PROJECT_ROOT);
|
|
429
452
|
}
|
|
430
453
|
|
|
431
|
-
export { collectProvidersAndWarnings, injectProviderDecorators, getPreviewPath };
|
|
454
|
+
export { collectProvidersAndWarnings, injectProviderDecorators, injectA11yAddon, getPreviewPath };
|