дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-04 09:11:10 +02:00
Extends the 4px-grid spacing scale with --space-0-5 (2px), --space-1 (4px) and --space-1-5 (6px) and replaces the literal 2/4/6/8/12/16px gap, row-gap and column-gap values with the tokens; computed values are unchanged. src/styles/spacingScale.test.ts flags an on-scale literal gap. Co-authored-by: Mr0Bread <[email protected]>
19 рядки
682 B
TypeScript
19 рядки
682 B
TypeScript
import { globSync, readFileSync } from "node:fs";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
// `gap` takes the spacing scale in tokens.css; these literals have a token.
|
|
const SCALED = /(?:^|[;{\s])(?:row-|column-)?gap\s*:\s*[^;}]*\b(?:2|4|6|8|12|16)px\b/g;
|
|
|
|
describe("spacing scale", () => {
|
|
it("gap uses --space-* tokens for on-scale values", () => {
|
|
const offenders: string[] = [];
|
|
for (const file of globSync("src/**/*.css")) {
|
|
if (file.endsWith("styles/tokens.css")) continue;
|
|
for (const m of readFileSync(file, "utf8").matchAll(SCALED)) {
|
|
offenders.push(`${file}: ${m[0].trim()}`);
|
|
}
|
|
}
|
|
expect(offenders).toEqual([]);
|
|
});
|
|
});
|