@reqvire-org/ads 0.3.49 → 0.3.50
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/README.md +36 -6
- package/dist/active-clock.mjs +34 -0
- package/dist/assets.mjs +20 -2
- package/dist/boundaries.mjs +2 -0
- package/dist/browser-audit/layout-overflow.mjs +57 -0
- package/dist/browser-audit/layout-shift.mjs +32 -0
- package/dist/browser-audit/non-text-contrast.mjs +87 -0
- package/dist/browser-audit/worker.mjs +36 -7
- package/dist/browser-audit.mjs +198 -22
- package/dist/check.mjs +14 -1
- package/dist/cli.mjs +7 -4
- package/dist/component-contrast.mjs +138 -0
- package/dist/config.mjs +12 -6
- package/dist/finding-rules.mjs +11 -1
- package/dist/fonts-generated.mjs +85 -0
- package/dist/image-attributes.mjs +110 -0
- package/dist/init.mjs +2 -0
- package/dist/layout-widths.mjs +184 -0
- package/dist/mcp/context.mjs +1 -1
- package/dist/mcp/mutations.mjs +7 -5
- package/dist/mcp/preview-watch.mjs +9 -8
- package/dist/mcp/server.mjs +6 -4
- package/dist/preview-files.mjs +3 -0
- package/dist/project-boundary.mjs +23 -0
- package/dist/project-documents.mjs +2 -1
- package/dist/scenarios-compiler.mjs +23 -3
- package/dist/showcase/client.bundle.js +11 -11
- package/dist/showcase/icons.js +5 -5
- package/dist/showcase/style.css +1 -1
- package/dist/skills/ads-break-ui/SKILL.md +8 -0
- package/dist/skills/ads-break-ui/references/atomic-styles.md +2 -0
- package/dist/skills/ads-break-ui/references/design-data.md +39 -0
- package/dist/skills/ads-break-ui/references/drafts.md +1 -1
- package/dist/skills/ads-break-ui/references/guarded-editing.md +1 -1
- package/dist/skills/ads-break-ui/references/validation.md +9 -5
- package/dist/skills/ads-designer/SKILL.md +24 -4
- package/dist/skills/ads-designer/references/accessibility.md +30 -13
- package/dist/skills/ads-designer/references/atomic-styles.md +2 -0
- package/dist/skills/ads-designer/references/branding.md +10 -5
- package/dist/skills/ads-designer/references/cli.md +2 -1
- package/dist/skills/ads-designer/references/design-data.md +39 -0
- package/dist/skills/ads-designer/references/drafts.md +1 -1
- package/dist/skills/ads-designer/references/guarded-editing.md +1 -1
- package/dist/skills/ads-designer/references/mobile.md +3 -0
- package/dist/skills/ads-designer/references/performance.md +89 -0
- package/dist/skills/ads-designer/references/validation.md +9 -5
- package/dist/skills/ads-import/references/atomic-styles.md +2 -0
- package/dist/skills/ads-import/references/cli.md +2 -1
- package/dist/skills/ads-import/references/design-data.md +39 -0
- package/dist/skills/ads-import/references/drafts.md +1 -1
- package/dist/skills/ads-import/references/guarded-editing.md +1 -1
- package/dist/skills/ads-import/references/validation.md +9 -5
- package/dist/skills/ads-motion/references/atomic-styles.md +2 -0
- package/dist/skills/ads-motion/references/design-data.md +39 -0
- package/dist/skills/ads-motion/references/drafts.md +1 -1
- package/dist/skills/ads-motion/references/guarded-editing.md +1 -1
- package/dist/skills/ads-motion/references/validation.md +9 -5
- package/dist/skills/ads-port/references/atomic-styles.md +2 -0
- package/dist/skills/ads-port/references/cli.md +2 -1
- package/dist/skills/ads-port/references/design-data.md +39 -0
- package/dist/skills/ads-port/references/drafts.md +1 -1
- package/dist/skills/ads-port/references/guarded-editing.md +1 -1
- package/dist/skills/ads-port/references/validation.md +9 -5
- package/dist/starters/preact/ds.config.json +1 -0
- package/dist/starters/preact/package.json +1 -0
- package/dist/starters/react/ADS.md +1 -1
- package/dist/starters/react/README.md +14 -2
- package/dist/starters/react/design-system/components/Actions/Button/Button.tsx +1 -1
- package/dist/starters/react/design-system/components/Content/Image/Image.ads.fixture.ts +2 -0
- package/dist/starters/react/design-system/components/Content/Image/Image.ads.scenario.tsx +13 -0
- package/dist/starters/react/design-system/components/Content/Image/Image.tsx +48 -0
- package/dist/starters/react/design-system/components/Content/Image/README.md +20 -0
- package/dist/starters/react/design-system/components/Content/Logo/Logo.tsx +2 -2
- package/dist/starters/react/design-system/index.ts +1 -0
- package/dist/starters/react/design-system/tokens/Layout.ads.fixture.ts +16 -0
- package/dist/starters/react/design-system/tokens/spacing.css +18 -0
- package/dist/starters/react/ds.config.json +1 -0
- package/dist/starters/react/package-lock.json +47 -0
- package/dist/starters/react/package.json +2 -1
- package/dist/test-boundaries.mjs +30 -1
- package/dist/themes-generated.mjs +15 -4
- package/dist/token-quality.mjs +27 -17
- package/dist/units.mjs +2 -1
- package/dist/validation-checks.mjs +5 -4
- package/dist/validation.mjs +1 -1
- package/dist/verification/browser.mjs +28 -2
- package/dist/verification.mjs +5 -4
- package/docs/ADS.md +4 -1
- package/docs/ARCHITECTURE.md +13 -3
- package/docs/CHANGELOG.md +92 -12
- package/docs/GUIDE.md +208 -14
- package/docs/MCP.md +14 -10
- package/package.json +1 -1
package/dist/preview-files.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readdirSync } from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { isDraftFile } from "./draft-boundary.mjs";
|
|
4
|
+
import { createNestedProjectFilter } from "./project-boundary.mjs";
|
|
4
5
|
|
|
5
6
|
const metadata = new Set(["node_modules", ".git", ".ds", ".vite", "coverage"]);
|
|
6
7
|
const generated = new Set(["dist", "build", "target", "out", ".next", ".nuxt", ".svelte-kit", ".turbo"]);
|
|
@@ -14,8 +15,10 @@ export function createPreviewFileFilter({root, config}) {
|
|
|
14
15
|
const within = (parent, file) => parent === ""
|
|
15
16
|
? file !== ".." && !file.startsWith(`..${path.sep}`) && !path.isAbsolute(file)
|
|
16
17
|
: file === parent || file.startsWith(parent + path.sep);
|
|
18
|
+
const nested = createNestedProjectFilter({root, config});
|
|
17
19
|
return file => {
|
|
18
20
|
if (isDraftFile(file)) return true;
|
|
21
|
+
if (nested(file)) return true;
|
|
19
22
|
const relative = path.relative(root, path.resolve(file)), parts = relative.split(path.sep);
|
|
20
23
|
if (parts.some(name => metadata.has(name))) return true;
|
|
21
24
|
const key = canonical(relative);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
|
|
4
|
+
/** A folder with its own ds.config.json is a separate ADS project, whose tests, sources and
|
|
5
|
+
* previews belong to it. Every project-wide walk stops there. */
|
|
6
|
+
export const hasProjectConfig = directory => existsSync(path.join(directory, "ds.config.json"));
|
|
7
|
+
|
|
8
|
+
/** Whether a path is a nested project or inside one. The project's own root, design system and
|
|
9
|
+
* source folders never count, and neither does a folder on the way to them. */
|
|
10
|
+
export function createNestedProjectFilter({ root, config }) {
|
|
11
|
+
const own = [config.dsDir, config.sourceDir].map(directory => path.resolve(root, directory));
|
|
12
|
+
const onOwnPath = directory => own.some(target => target === directory || target.startsWith(directory + path.sep));
|
|
13
|
+
return file => {
|
|
14
|
+
const relative = path.relative(root, path.resolve(root, file));
|
|
15
|
+
if (!relative || relative.startsWith("..") || path.isAbsolute(relative)) return false;
|
|
16
|
+
let directory = root;
|
|
17
|
+
for (const part of relative.split(path.sep)) {
|
|
18
|
+
directory = path.join(directory, part);
|
|
19
|
+
if (!onOwnPath(directory) && hasProjectConfig(directory)) return true;
|
|
20
|
+
}
|
|
21
|
+
return false;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { existsSync, lstatSync, readdirSync } from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
import { hasProjectConfig } from "./project-boundary.mjs";
|
|
3
4
|
|
|
4
5
|
const rootNames = ["README.md", "ADS.md", "DS.md", "ARCHITECTURE.md", "Architecture.md", "GUIDE.md", "MCP.md", "CHANGELOG.md"];
|
|
5
6
|
const noticeStem = /^(?:CREDITS|LICEN[CS]ES?|NOTICES?|COPYING|COPYRIGHT)(?:[-_][A-Za-z0-9][A-Za-z0-9._-]*)?$/i;
|
|
@@ -33,7 +34,7 @@ export function projectDocumentFiles(root) {
|
|
|
33
34
|
for (const entry of readdirSync(directory, { withFileTypes: true })) {
|
|
34
35
|
if (entry.name.startsWith(".")) continue;
|
|
35
36
|
const file = `${relative}/${entry.name}`;
|
|
36
|
-
if (entry.isDirectory()) walk(file);
|
|
37
|
+
if (entry.isDirectory()) { if (!hasProjectConfig(path.join(root, file))) walk(file); }
|
|
37
38
|
else if (entry.isFile() && isProjectDocument(file)) files.push(file);
|
|
38
39
|
}
|
|
39
40
|
}
|
|
@@ -2,6 +2,7 @@ import { scopedPreviewFailure } from "./preview-failure.mjs";
|
|
|
2
2
|
import { createHash, randomUUID } from "node:crypto";
|
|
3
3
|
import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, watch, writeFileSync } from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
|
+
import { hasProjectConfig } from "./project-boundary.mjs";
|
|
5
6
|
import { isDraftPreviewWorkspace } from "./draft-workspace.mjs";
|
|
6
7
|
import { loadConfig, isInside } from "./config.mjs";
|
|
7
8
|
import { discoverScenarioRegistry, prepareScenarioRegistryTransfer, releaseScenarioRegistry } from "./scenario-registry.mjs";
|
|
@@ -185,6 +186,16 @@ export function preparePreviewCache(candidate, target) {
|
|
|
185
186
|
};
|
|
186
187
|
}
|
|
187
188
|
|
|
189
|
+
/** An accepted edit writes source before it can publish the graph it checked.
|
|
190
|
+
* The hold keeps a watching compiler from rebuilding that source in the gap.
|
|
191
|
+
* Its age bound lets a crashed process cost one delay, not a stuck preview. */
|
|
192
|
+
const publicationHold = root => path.join(root,".ds/preview-publication.hold"), publicationHoldMs = 15000;
|
|
193
|
+
export function holdLivePreview(root) {
|
|
194
|
+
const file=publicationHold(root);
|
|
195
|
+
mkdirSync(path.dirname(file),{recursive:true});writeFileSync(file,"");
|
|
196
|
+
return () => rmSync(file,{force:true});
|
|
197
|
+
}
|
|
198
|
+
|
|
188
199
|
export function promotePreviewCache(candidate,target) { const publish=preparePreviewCache(candidate,target);return publish?publish():false; }
|
|
189
200
|
|
|
190
201
|
/** Restore a complete verified graph without rediscovering semantic scenarios or
|
|
@@ -299,7 +310,7 @@ export async function runScenarioCompiler(directory, { watched = false, validate
|
|
|
299
310
|
for (const item of readdirSync(directory, { withFileTypes: true })) {
|
|
300
311
|
if (item.isSymbolicLink() || ["node_modules", ".ds", ".vite", "dist"].includes(item.name)) continue;
|
|
301
312
|
const file = path.join(directory, item.name);
|
|
302
|
-
if (item.isDirectory()) assets(file);
|
|
313
|
+
if (item.isDirectory()) { if (!hasProjectConfig(file)) assets(file); }
|
|
303
314
|
else if (/\.(?:css|svg|png|jpe?g|webp|gif|woff2?|ttf|otf)$/.test(file)) dependencies.add(file);
|
|
304
315
|
}
|
|
305
316
|
}
|
|
@@ -342,7 +353,7 @@ export async function runScenarioCompiler(directory, { watched = false, validate
|
|
|
342
353
|
for (const item of readdirSync(directory, { withFileTypes: true })) {
|
|
343
354
|
if (item.isSymbolicLink() || ["node_modules", ".ds", ".vite", "dist"].includes(item.name)) continue;
|
|
344
355
|
const file = path.join(directory, item.name);
|
|
345
|
-
if (item.isDirectory()) assets(file);
|
|
356
|
+
if (item.isDirectory()) { if (!hasProjectConfig(file)) assets(file); }
|
|
346
357
|
else if (/\.(?:css|svg|png|jpe?g|webp|gif|woff2?|ttf|otf)$/.test(file)) dependencies.add(file);
|
|
347
358
|
}
|
|
348
359
|
}
|
|
@@ -390,10 +401,19 @@ export async function runScenarioCompiler(directory, { watched = false, validate
|
|
|
390
401
|
return false;
|
|
391
402
|
}
|
|
392
403
|
}
|
|
404
|
+
async function publicationSettled() {
|
|
405
|
+
const file=publicationHold(root);
|
|
406
|
+
while(!stopped){
|
|
407
|
+
try{if(Date.now()-statSync(file).mtimeMs>=publicationHoldMs)return;}catch{return;}
|
|
408
|
+
await new Promise(resolve=>setTimeout(resolve,10));
|
|
409
|
+
}
|
|
410
|
+
}
|
|
393
411
|
// Visual feedback and verified publication have separate lifecycles. Edits
|
|
394
412
|
// replace the pending candidate immediately; verification has at most one run
|
|
395
413
|
// in flight and coalesces intervening edits instead of queuing every keystroke.
|
|
396
414
|
async function compileLiveGraph() {
|
|
415
|
+
await publicationSettled();
|
|
416
|
+
if (stopped) return;
|
|
397
417
|
cache.reload();
|
|
398
418
|
const sourceRevision = previewSourceRevision(options), stamp = cache.inputs();
|
|
399
419
|
const prepared=cache.registry(stamp);
|
|
@@ -426,7 +446,7 @@ export async function runScenarioCompiler(directory, { watched = false, validate
|
|
|
426
446
|
for (const item of readdirSync(directory, { withFileTypes: true })) {
|
|
427
447
|
if (item.isSymbolicLink() || ["node_modules", ".ds", ".vite", "dist"].includes(item.name)) continue;
|
|
428
448
|
const file = path.join(directory, item.name);
|
|
429
|
-
if (item.isDirectory()) assets(file);
|
|
449
|
+
if (item.isDirectory()) { if (!hasProjectConfig(file)) assets(file); }
|
|
430
450
|
else if (/\.(?:css|svg|png|jpe?g|webp|gif|woff2?|ttf|otf)$/.test(file)) candidate.dependencies.add(file);
|
|
431
451
|
}
|
|
432
452
|
}
|