@reqvire-org/ads 0.3.43 → 0.3.45
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 +32 -10
- package/dist/assets.mjs +49 -3
- package/dist/brand-assets.mjs +174 -7
- package/dist/check.mjs +4 -2
- package/dist/cli.mjs +21 -9
- package/dist/config.mjs +60 -3
- package/dist/create.mjs +48 -0
- package/dist/image-size.mjs +28 -0
- package/dist/index.mjs +1 -0
- package/dist/init.mjs +2 -2
- package/dist/mcp/server.mjs +3 -1
- package/dist/mcp/skills.mjs +1 -1
- package/dist/preview-bun.mjs +4 -2
- package/dist/scenario-groups.mjs +2 -2
- package/dist/scenario-registry.mjs +3 -3
- package/dist/scenarios-compiler.mjs +1 -1
- package/dist/scenarios.mjs +4 -2
- package/dist/showcase/client.bundle.js +22 -22
- package/dist/showcase/draft-navigation.js +1 -1
- package/dist/showcase/index.html +1 -0
- package/dist/skills/ads-break-ui/SKILL.md +1 -1
- package/dist/skills/ads-designer/README.md +2 -2
- package/dist/skills/ads-designer/SKILL.md +44 -54
- package/dist/skills/ads-designer/references/branding.md +104 -0
- package/dist/skills/ads-designer/references/cli.md +5 -4
- package/dist/skills/ads-import/SKILL.md +1 -1
- package/dist/skills/ads-import/references/branding.md +13 -5
- package/dist/skills/ads-import/references/cli.md +5 -4
- package/dist/skills/ads-motion/SKILL.md +1 -1
- package/dist/skills/ads-port/SKILL.md +1 -1
- package/dist/skills/ads-port/references/cli.md +5 -4
- package/dist/{bootstrap-ds-preact → starters/preact}/ds.config.json +2 -1
- package/dist/{bootstrap-ds → starters/react}/ADS.md +2 -2
- package/dist/{bootstrap-ds → starters/react}/README.md +18 -22
- package/dist/starters/react/design-system/assets/brand/README.md +36 -0
- package/dist/starters/react/design-system/assets/brand/app-icon.svg +4 -0
- package/dist/starters/react/design-system/assets/brand/logo.dark.svg +6 -0
- package/dist/starters/react/design-system/assets/brand/logo.svg +6 -0
- package/dist/starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.fixture.ts +7 -0
- package/dist/starters/react/design-system/brand/Icons/AppIcon/AppIcon.ads.scenario.tsx +4 -0
- package/dist/starters/react/design-system/brand/Identity/Logo/Logo.ads.fixture.ts +7 -0
- package/dist/starters/react/design-system/brand/Identity/Logo/Logo.ads.scenario.tsx +4 -0
- package/dist/starters/react/design-system/components/Content/Logo/Logo.ads.fixture.ts +1 -0
- package/dist/starters/react/design-system/components/Content/Logo/Logo.ads.scenario.tsx +12 -0
- package/dist/starters/react/design-system/components/Content/Logo/Logo.tsx +41 -0
- package/dist/starters/react/design-system/components/Content/Logo/README.md +10 -0
- package/dist/{bootstrap-ds → starters/react}/design-system/index.ts +1 -0
- package/dist/starters/react/design-system/review/brand-preview/BrandPreview.tsx +115 -0
- package/dist/{bootstrap-ds → starters/react}/design-system/review/index.ts +1 -0
- package/dist/{skills/ads-designer/assets/bootstrap-ds → starters/react}/ds.config.json +2 -1
- package/dist/{bootstrap-ds → starters/react}/tsconfig.build.json +2 -1
- package/dist/task-cache.mjs +1 -1
- package/dist/token-fixtures.mjs +1 -1
- package/dist/units.mjs +6 -6
- package/dist/validation.mjs +1 -1
- package/docs/ADS.md +9 -6
- package/docs/ARCHITECTURE.md +1 -1
- package/docs/CHANGELOG.md +59 -12
- package/docs/GUIDE.md +61 -18
- package/package.json +3 -5
- package/dist/bootstrap-ds/design-system/assets/brand/README.md +0 -29
- package/dist/bootstrap-ds/ds.config.json +0 -19
- package/dist/skills/ads-designer/assets/bootstrap-ds/ADS.md +0 -258
- package/dist/skills/ads-designer/assets/bootstrap-ds/README.md +0 -120
- package/dist/skills/ads-designer/assets/bootstrap-ds/biome.css.json +0 -21
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/assets/brand/README.md +0 -29
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/assets/fonts/.gitkeep +0 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Actions/Button/Button.ads.fixture.ts +0 -1
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Actions/Button/Button.ads.scenario.tsx +0 -13
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Actions/Button/Button.tsx +0 -49
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Actions/Button/README.md +0 -12
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Forms/TextField/README.md +0 -14
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Forms/TextField/TextField.ads.fixture.ts +0 -6
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Forms/TextField/TextField.ads.scenario.tsx +0 -13
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/components/Forms/TextField/TextField.tsx +0 -57
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/composition/Search/SearchPage/README.md +0 -4
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/composition/Search/SearchPage/SearchPage.ads.fixture.ts +0 -7
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/composition/Search/SearchPage/SearchPage.ads.scenario.tsx +0 -16
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/controllers/.gitkeep +0 -0
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/index.ts +0 -7
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/patterns/Search/SearchBar/README.md +0 -12
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/patterns/Search/SearchBar/SearchBar.ads.fixture.ts +0 -1
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/patterns/Search/SearchBar/SearchBar.ads.scenario.tsx +0 -11
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/patterns/Search/SearchBar/SearchBar.tsx +0 -41
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/review/demo-frame/DemoFrame.tsx +0 -29
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/review/index.ts +0 -3
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/review/screen-frame/ScreenFrame.tsx +0 -34
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/review/token-preview/TokenPreview.tsx +0 -119
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/showcase/mcp/index.html +0 -1
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/showcase/mcp/main.tsx +0 -8
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/styles.css +0 -5
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/Color.ads.fixture.ts +0 -18
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/Color.ads.scenario.tsx +0 -4
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/SpaceTypeMotion.ads.fixture.ts +0 -36
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/SpaceTypeMotion.ads.scenario.tsx +0 -4
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/base.css +0 -30
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/colors.css +0 -29
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/elevation.css +0 -15
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/spacing.css +0 -15
- package/dist/skills/ads-designer/assets/bootstrap-ds/design-system/tokens/typography.css +0 -13
- package/dist/skills/ads-designer/assets/bootstrap-ds/gitignore.template +0 -8
- package/dist/skills/ads-designer/assets/bootstrap-ds/package-lock.json +0 -4660
- package/dist/skills/ads-designer/assets/bootstrap-ds/package.json +0 -42
- package/dist/skills/ads-designer/assets/bootstrap-ds/scripts/build-mcp-previews.mjs +0 -3
- package/dist/skills/ads-designer/assets/bootstrap-ds/src/vite-env.d.ts +0 -7
- package/dist/skills/ads-designer/assets/bootstrap-ds/tsconfig.build.json +0 -19
- package/dist/skills/ads-designer/assets/bootstrap-ds/tsconfig.json +0 -35
- package/dist/skills/ads-designer/assets/bootstrap-ds/vite.config.ts +0 -23
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/design-system/review/demo-frame/DemoFrame.tsx +0 -29
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/design-system/review/screen-frame/ScreenFrame.tsx +0 -34
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/design-system/review/token-preview/TokenPreview.tsx +0 -119
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/design-system/showcase/mcp/main.tsx +0 -6
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/ds.config.json +0 -19
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/package.json +0 -38
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/src/vite-env.d.ts +0 -7
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/tsconfig.json +0 -36
- package/dist/skills/ads-designer/assets/bootstrap-ds-preact/vite.config.ts +0 -23
- /package/dist/{bootstrap-ds-preact → starters/preact}/design-system/review/demo-frame/DemoFrame.tsx +0 -0
- /package/dist/{bootstrap-ds-preact → starters/preact}/design-system/review/screen-frame/ScreenFrame.tsx +0 -0
- /package/dist/{bootstrap-ds-preact → starters/preact}/design-system/review/token-preview/TokenPreview.tsx +0 -0
- /package/dist/{bootstrap-ds-preact → starters/preact}/design-system/showcase/mcp/main.tsx +0 -0
- /package/dist/{bootstrap-ds-preact → starters/preact}/package.json +0 -0
- /package/dist/{bootstrap-ds-preact → starters/preact}/src/vite-env.d.ts +0 -0
- /package/dist/{bootstrap-ds-preact → starters/preact}/tsconfig.json +0 -0
- /package/dist/{bootstrap-ds-preact → starters/preact}/vite.config.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/biome.css.json +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/assets/fonts/.gitkeep +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Actions/Button/Button.ads.fixture.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Actions/Button/Button.ads.scenario.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Actions/Button/Button.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Actions/Button/README.md +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Forms/TextField/README.md +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Forms/TextField/TextField.ads.fixture.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Forms/TextField/TextField.ads.scenario.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/components/Forms/TextField/TextField.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/composition/Search/SearchPage/README.md +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/composition/Search/SearchPage/SearchPage.ads.fixture.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/composition/Search/SearchPage/SearchPage.ads.scenario.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/controllers/.gitkeep +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/patterns/Search/SearchBar/README.md +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/patterns/Search/SearchBar/SearchBar.ads.fixture.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/patterns/Search/SearchBar/SearchBar.ads.scenario.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/patterns/Search/SearchBar/SearchBar.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/review/demo-frame/DemoFrame.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/review/screen-frame/ScreenFrame.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/review/token-preview/TokenPreview.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/showcase/mcp/index.html +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/showcase/mcp/main.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/styles.css +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/tokens/Color.ads.fixture.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/tokens/Color.ads.scenario.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/tokens/SpaceTypeMotion.ads.fixture.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/tokens/SpaceTypeMotion.ads.scenario.tsx +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/tokens/base.css +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/tokens/colors.css +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/tokens/elevation.css +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/tokens/spacing.css +0 -0
- /package/dist/{bootstrap-ds → starters/react}/design-system/tokens/typography.css +0 -0
- /package/dist/{bootstrap-ds → starters/react}/gitignore.template +0 -0
- /package/dist/{bootstrap-ds → starters/react}/package-lock.json +0 -0
- /package/dist/{bootstrap-ds → starters/react}/package.json +0 -0
- /package/dist/{bootstrap-ds → starters/react}/scripts/build-mcp-previews.mjs +0 -0
- /package/dist/{bootstrap-ds → starters/react}/src/vite-env.d.ts +0 -0
- /package/dist/{bootstrap-ds → starters/react}/tsconfig.json +0 -0
- /package/dist/{bootstrap-ds → starters/react}/vite.config.ts +0 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Pixel size of a PNG, JPEG or WebP from its header, without decoding; null for other data. */
|
|
2
|
+
export function imageSize(bytes) {
|
|
3
|
+
if (bytes.length >= 24 && bytes.readUInt32BE(0) === 0x89504e47 && bytes.toString("ascii", 12, 16) === "IHDR") {
|
|
4
|
+
return { width: bytes.readUInt32BE(16), height: bytes.readUInt32BE(20) };
|
|
5
|
+
}
|
|
6
|
+
if (bytes.length >= 4 && bytes[0] === 0xff && bytes[1] === 0xd8) {
|
|
7
|
+
// Walk the JPEG segments to the first start-of-frame marker.
|
|
8
|
+
for (let offset = 2; offset + 9 < bytes.length;) {
|
|
9
|
+
if (bytes[offset] !== 0xff) return null;
|
|
10
|
+
const marker = bytes[offset + 1];
|
|
11
|
+
if (marker >= 0xc0 && marker <= 0xcf && ![0xc4, 0xc8, 0xcc].includes(marker)) {
|
|
12
|
+
return { width: bytes.readUInt16BE(offset + 7), height: bytes.readUInt16BE(offset + 5) };
|
|
13
|
+
}
|
|
14
|
+
offset += 2 + bytes.readUInt16BE(offset + 2);
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
if (bytes.length >= 30 && bytes.toString("ascii", 0, 4) === "RIFF" && bytes.toString("ascii", 8, 12) === "WEBP") {
|
|
19
|
+
const chunk = bytes.toString("ascii", 12, 16);
|
|
20
|
+
if (chunk === "VP8 ") return { width: bytes.readUInt16LE(26) & 0x3fff, height: bytes.readUInt16LE(28) & 0x3fff };
|
|
21
|
+
if (chunk === "VP8L") {
|
|
22
|
+
const bits = bytes.readUInt32LE(21);
|
|
23
|
+
return { width: (bits & 0x3fff) + 1, height: ((bits >> 14) & 0x3fff) + 1 };
|
|
24
|
+
}
|
|
25
|
+
if (chunk === "VP8X") return { width: 1 + bytes.readUIntLE(24, 3), height: 1 + bytes.readUIntLE(27, 3) };
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}
|
package/dist/index.mjs
CHANGED
package/dist/init.mjs
CHANGED
|
@@ -7,10 +7,10 @@ import { foundationFiles } from "./token-policy.mjs";
|
|
|
7
7
|
import { assertFrameworkCompiler } from "./ui-framework.mjs";
|
|
8
8
|
|
|
9
9
|
const tool = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8"));
|
|
10
|
-
const starter = fileURLToPath(new URL("./
|
|
10
|
+
const starter = fileURLToPath(new URL("./starters/react/", import.meta.url));
|
|
11
11
|
/** A framework's starter file: Preact's overlay replaces the React starter's where they differ. */
|
|
12
12
|
const starterFile = (framework, relative) => {
|
|
13
|
-
const overlay = fileURLToPath(new URL(`./
|
|
13
|
+
const overlay = fileURLToPath(new URL(`./starters/${framework}/${relative}`, import.meta.url));
|
|
14
14
|
return framework !== "react" && existsSync(overlay) ? overlay : path.join(starter, relative);
|
|
15
15
|
};
|
|
16
16
|
|
package/dist/mcp/server.mjs
CHANGED
|
@@ -278,6 +278,7 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
|
|
|
278
278
|
...skills.skills.map(({ uri, frontmatter }) => ({ uri, name: frontmatter.name, description: frontmatter.description, mimeType: "text/markdown" })),
|
|
279
279
|
...documents.filter(document => promoted.has(document.uri)).sort((a, b) => Number(b.uri === context.publicEntryUri) - Number(a.uri === context.publicEntryUri)).map(({ file: _file, ...document }) => document),
|
|
280
280
|
{ uri: "ads://guides/tokens", name: "Shared Data and component variable boundaries", mimeType: "text/markdown" },
|
|
281
|
+
{ uri: "ads://guides/branding", name: "Brand artwork, icons, committed targets and glyph sets", mimeType: "text/markdown" },
|
|
281
282
|
{ uri: "ads://guides/reporting", name: "Report suspected ADS bugs and feature requests", mimeType: "text/markdown" },
|
|
282
283
|
{ uri: TOKENS_APP_URI, name: "Experimental token widget", mimeType: APP_MIME },
|
|
283
284
|
{ uri: SCENARIO_APP_URI, name: "Experimental scenario widget", mimeType: APP_MIME },
|
|
@@ -325,6 +326,7 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
|
|
|
325
326
|
if (uri === "ads://guides/validation") return { contents: [{ uri, mimeType: "text/markdown", text: readFileSync(new URL("../skills/ads-designer/references/validation.md", import.meta.url), "utf8") }] };
|
|
326
327
|
if (uri === "ads://guides/runtimes") return { contents: [{ uri, mimeType: "text/markdown", text: readFileSync(new URL("../skills/ads-designer/references/runtimes.md", import.meta.url), "utf8") }] };
|
|
327
328
|
if (uri === "ads://guides/evidence") return { contents: [{ uri, mimeType: "text/markdown", text: readFileSync(new URL("../skills/ads-designer/references/evidence.md", import.meta.url), "utf8") }] };
|
|
329
|
+
if (uri === "ads://guides/branding") return { contents: [{ uri, mimeType: "text/markdown", text: readFileSync(new URL("../skills/ads-designer/references/branding.md", import.meta.url), "utf8") }] };
|
|
328
330
|
if (uri === "ads://guides/tokens") return { contents: [{ uri, mimeType: "text/markdown", text: readFileSync(new URL("../skills/ads-designer/references/design-data.md", import.meta.url), "utf8") }] };
|
|
329
331
|
if (uri === "ads://guides/reporting") return { contents: [{ uri, mimeType: "text/markdown", text: readFileSync(new URL("../skills/ads-designer/references/reporting.md", import.meta.url), "utf8") }] };
|
|
330
332
|
if (uri === "ads://guides/atomic-styles") return { contents: [{ uri, mimeType: "text/markdown", text: readFileSync(new URL("../skills/ads-designer/references/atomic-styles.md", import.meta.url), "utf8") }] };
|
|
@@ -459,7 +461,7 @@ export function createAdsMcp(directory, { era = "legacy", skillDirectory, pollIn
|
|
|
459
461
|
const matches = (await getCatalog()).filter((item) => (!kind || item.kind === kind) && item.name.toLowerCase().includes(search.toLowerCase()));
|
|
460
462
|
return json({ total: matches.length, items: annotateDrafts(matches.slice(0, limit)), resourceUri: `${PROJECT_URI}/catalog` });
|
|
461
463
|
} },
|
|
462
|
-
{ name: "ads_scenarios", description: "Find an independently mountable token, component, pattern or composition preview. IDs derive from source filenames. Optional group labels are derived from folder names and searchable; group is discovery output, never scenario metadata. covers lists rendered public UI, exercises lists behavioral APIs and tokens lists the real token inputs. Use ads_show_scenario with an exact returned id. Showcase and MCP use this same registry.", schema: query.extend({ kind: z.enum(["tokens", "components", "patterns", "composition"]).optional(), offset: z.number().int().min(0).default(0) }), call: ({ query: search = "", limit, kind, offset }) => {
|
|
464
|
+
{ name: "ads_scenarios", description: "Find an independently mountable brand, token, component, pattern or composition preview. IDs derive from source filenames. Optional group labels are derived from folder names and searchable; group is discovery output, never scenario metadata. covers lists rendered public UI, exercises lists behavioral APIs and tokens lists the real token inputs. Use ads_show_scenario with an exact returned id. Showcase and MCP use this same registry.", schema: query.extend({ kind: z.enum(["brand", "tokens", "components", "patterns", "composition"]).optional(), offset: z.number().int().min(0).default(0) }), call: ({ query: search = "", limit, kind, offset }) => {
|
|
463
465
|
const registry = getRegistry();
|
|
464
466
|
const matches = registry.scenarios.filter(item => (!kind || item.kind === kind) && `${item.id} ${item.title} ${item.group ?? ""} ${item.covers.join(" ")} ${(item.exercises ?? []).join(" ")} ${item.tokens.join(" ")}`.toLowerCase().includes(search.toLowerCase()));
|
|
465
467
|
const report = builds(), states = new Map(report.previews.map(item => [item.id, item]));
|
package/dist/mcp/skills.mjs
CHANGED
|
@@ -31,7 +31,7 @@ export function createSkillStore(directory = fileURLToPath(new URL("../skills/",
|
|
|
31
31
|
directories.set(uri, children);
|
|
32
32
|
for (const entry of readdirSync(folder, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
33
33
|
if (entry.isSymbolicLink()) throw new Error(`Skills cannot contain symlinks: ${entry.name}`);
|
|
34
|
-
const name = entry.name
|
|
34
|
+
const name = entry.name;
|
|
35
35
|
const childUri = `${uri}/${encodeURIComponent(name)}`;
|
|
36
36
|
const file = path.join(folder, entry.name);
|
|
37
37
|
if (entry.isDirectory()) {
|
package/dist/preview-bun.mjs
CHANGED
|
@@ -165,13 +165,15 @@ export function createBunPreviewBuilder() {
|
|
|
165
165
|
return{name:"ads-bun-preview",setup(build){
|
|
166
166
|
build.onResolve({filter:/./},args=>{
|
|
167
167
|
if(/[?&]worker(?:[&=]|$)/.test(args.path)){const specifier=args.path.split("?")[0];return{path:resolve(specifier,args.importer),namespace:args.path.includes("url")?"ads-worker-url":"ads-worker"};}
|
|
168
|
-
|
|
168
|
+
// Bun shares one module per path across namespaces: a raw import keeps its own path, so
|
|
169
|
+
// the same file can be both a URL (a brand preview) and text (a component's geometry).
|
|
170
|
+
if(/[?&](?:url|raw|ads-asset)(?:[&=]|$)/.test(args.path)){const raw=/[?&]raw(?:[&=]|$)/.test(args.path),file=resolve(args.path.split("?")[0],args.importer);return{path:raw?`${file}?raw`:file,namespace:raw?"ads-raw":"ads-file"};}
|
|
169
171
|
const mapped=alias(args.path);if(mapped!==args.path)return{path:resolve(mapped,args.importer)};
|
|
170
172
|
if(args.path.endsWith(".css")&&resolve(args.path,args.importer||foundation)===foundation)return{path:foundation,namespace:"ads-foundation"};
|
|
171
173
|
});
|
|
172
174
|
build.onLoad({filter:/./,namespace:"ads-foundation"},()=>({contents:"export {};",loader:"js"}));
|
|
173
175
|
build.onLoad({filter:/./,namespace:"ads-file"},args=>{inputs.add(args.path);return{contents:readFileSync(args.path),loader:"file"};});
|
|
174
|
-
build.onLoad({filter:/./,namespace:"ads-raw"},args=>{inputs.add(
|
|
176
|
+
build.onLoad({filter:/./,namespace:"ads-raw"},args=>{const file=args.path.replace(/\?raw$/,"");inputs.add(file);return{contents:readFileSync(file,"utf8"),loader:"text"};});
|
|
175
177
|
for(const namespace of ["ads-worker","ads-worker-url"])build.onLoad({filter:/./,namespace},async args=>{
|
|
176
178
|
await args.defer();
|
|
177
179
|
const name=await worker(args.path,ancestors),url=JSON.stringify("./"+name);
|
package/dist/scenario-groups.mjs
CHANGED
|
@@ -10,7 +10,7 @@ export function scenarioGroupFingerprint(options, files) {
|
|
|
10
10
|
const directories = new Set();
|
|
11
11
|
for (const file of (files ?? sourceFiles(dsRoot)).filter(isScenarioFile)) {
|
|
12
12
|
const layer = path.relative(dsRoot, file).split(path.sep)[0];
|
|
13
|
-
if (!["components", "patterns", "composition"].includes(layer)) continue;
|
|
13
|
+
if (!["brand", "components", "patterns", "composition"].includes(layer)) continue;
|
|
14
14
|
const boundary = path.join(dsRoot, layer);
|
|
15
15
|
for (let directory = path.dirname(file); directory !== boundary && isInside(boundary, directory); directory = path.dirname(directory)) directories.add(directory);
|
|
16
16
|
}
|
|
@@ -33,7 +33,7 @@ export function createScenarioGroups({ dsRoot }) {
|
|
|
33
33
|
}
|
|
34
34
|
return (file, owner) => {
|
|
35
35
|
const relative = path.relative(dsRoot, file), layer = relative.split(path.sep)[0];
|
|
36
|
-
if (!["components", "patterns", "composition"].includes(layer)) return undefined;
|
|
36
|
+
if (!["brand", "components", "patterns", "composition"].includes(layer)) return undefined;
|
|
37
37
|
const boundary = path.join(dsRoot, layer);
|
|
38
38
|
let directory = owner ? path.join(dsRoot, owner) : path.dirname(file);
|
|
39
39
|
try { if (!statSync(directory).isDirectory()) directory = path.dirname(directory); }
|
|
@@ -27,7 +27,7 @@ const toolRevision = (() => {
|
|
|
27
27
|
function visit(directory) {
|
|
28
28
|
for (const entry of readdirSync(directory, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
29
29
|
const file = path.join(directory, entry.name);
|
|
30
|
-
if (entry.isDirectory() && !["skills", "
|
|
30
|
+
if (entry.isDirectory() && !["skills", "starters", "showcase"].includes(entry.name)) visit(file);
|
|
31
31
|
else if (entry.isFile() && /\.(?:mjs|js|cjs|json)$/.test(entry.name)) rows.push([path.relative(root, file), hash(readFileSync(file))]);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -37,9 +37,9 @@ const toolRevision = (() => {
|
|
|
37
37
|
|
|
38
38
|
function validRegistry(value, options) {
|
|
39
39
|
return value && Array.isArray(value.scenarios) && value.scenarios.length <= 10000
|
|
40
|
-
&& value.scenarios.every(item => typeof item?.id === "string" && /^(?:tokens|components|patterns|composition)\/[\w./-]+$/.test(item.id)
|
|
40
|
+
&& value.scenarios.every(item => typeof item?.id === "string" && /^(?:brand|tokens|components|patterns|composition)\/[\w./-]+$/.test(item.id)
|
|
41
41
|
&& path.posix.normalize(item.id) === item.id && typeof item.title === "string"
|
|
42
|
-
&& ["tokens", "components", "patterns", "composition"].includes(item.kind)
|
|
42
|
+
&& ["brand", "tokens", "components", "patterns", "composition"].includes(item.kind)
|
|
43
43
|
&& typeof item.file === "string" && isInside(options.dsRoot, path.resolve(options.root, item.file))
|
|
44
44
|
&& item.artifact === `.ds/scenarios/${item.id}/index.html` && Array.isArray(item.covers) && Array.isArray(item.tokens))
|
|
45
45
|
&& Array.isArray(value.diagnostics) && value.diagnostics.every(item => typeof item?.message === "string" && typeof item.rule === "string");
|
|
@@ -143,7 +143,7 @@ export function createPreviewCache(options, compilerFiles = []) {
|
|
|
143
143
|
recordProduction(stamp) { return recordCurrent(stamp, () => { value.production = { stamp, revision: value.graphRevision }; }); },
|
|
144
144
|
registry(stamp) {
|
|
145
145
|
if(value.validation!==stamp || value.graphInputs!==stamp || !Array.isArray(value.registry) || !value.registry.length || value.registry.length>1000)return null;
|
|
146
|
-
const valid=value.registry.every(entry=>typeof entry?.id==="string" && /^(?:tokens|components|patterns|composition)\/[\w./-]+$/.test(entry.id) && path.posix.normalize(entry.id)===entry.id
|
|
146
|
+
const valid=value.registry.every(entry=>typeof entry?.id==="string" && /^(?:brand|tokens|components|patterns|composition)\/[\w./-]+$/.test(entry.id) && path.posix.normalize(entry.id)===entry.id
|
|
147
147
|
&& typeof entry.file==="string" && isInside(options.dsRoot,path.resolve(root,entry.file))
|
|
148
148
|
&& entry.artifact===`.ds/scenarios/${entry.id}/index.html`);
|
|
149
149
|
return valid && reusableEntries(value.registry,value.graphRevision)?structuredClone(value.registry):null;
|
package/dist/scenarios.mjs
CHANGED
|
@@ -22,6 +22,8 @@ function literal(node, checker, seen = new Set()) {
|
|
|
22
22
|
if (!node || seen.has(node)) return undefined;
|
|
23
23
|
seen = new Set([...seen, node]);
|
|
24
24
|
if (node && ts.isStringLiteralLike(node)) return node.text;
|
|
25
|
+
if (node?.kind === ts.SyntaxKind.TrueKeyword) return true;
|
|
26
|
+
if (node?.kind === ts.SyntaxKind.FalseKeyword) return false;
|
|
25
27
|
if (node && ts.isArrayLiteralExpression(node)) return node.elements.map(item => literal(item, checker, seen));
|
|
26
28
|
if (node && ts.isObjectLiteralExpression(node)) return Object.fromEntries(node.properties.map((item) => ts.isPropertyAssignment(item) && item.name && (ts.isIdentifier(item.name) || ts.isStringLiteralLike(item.name)) ? [item.name.text, literal(item.initializer, checker, seen)] : ["invalid", undefined]));
|
|
27
29
|
if (checker && (ts.isIdentifier(node) || ts.isPropertyAccessExpression(node))) {
|
|
@@ -66,7 +68,7 @@ export function inspectScenarios(options, suppliedProgram) {
|
|
|
66
68
|
for (const file of files) {
|
|
67
69
|
const relative = path.relative(dsRoot, file).replaceAll("\\", "/");
|
|
68
70
|
let kind = isInside(path.join(dsRoot, options.config.tokenDir), file) ? "tokens" : relative.split("/")[0];
|
|
69
|
-
if (!["tokens", "components", "patterns", "composition"].includes(kind)) { report(file, "Scenarios live beside tokens/components/patterns or under composition/, not inside showcase pages."); continue; }
|
|
71
|
+
if (!["brand", "tokens", "components", "patterns", "composition"].includes(kind)) { report(file, "Scenarios live under brand/, beside tokens/components/patterns or under composition/, not inside showcase pages."); continue; }
|
|
70
72
|
let id = scenarioIdentity(file, dsRoot);
|
|
71
73
|
const source = program.getSourceFile(file);
|
|
72
74
|
if (!source) { report(file, "Cannot inspect scenario source."); continue; }
|
|
@@ -163,7 +165,7 @@ export function inspectScenarios(options, suppliedProgram) {
|
|
|
163
165
|
else exercises.push(name);
|
|
164
166
|
}
|
|
165
167
|
}
|
|
166
|
-
if (!["composition", "tokens"].includes(kind) && metadata.covers.some((name) => known.get(name).kind !== kind)) report(file, "Component scenarios cover primitives; pattern scenarios cover patterns. Use composition/ for larger interfaces.");
|
|
168
|
+
if (!["composition", "tokens", "brand"].includes(kind) && metadata.covers.some((name) => known.get(name).kind !== kind)) report(file, "Component scenarios cover primitives; pattern scenarios cover patterns. Use composition/ for larger interfaces.");
|
|
167
169
|
const tokens = [...new Set([...(metadata.tokens ?? []), ...(metadata.samples ?? []).map(sample => sample.token)])];
|
|
168
170
|
for (const name of tokens) if (!tokenNames.has(name)) diagnostics.push({ file: path.relative(root, file).replaceAll("\\", "/"), rule: "token-scenario-reference", line: 1, column: 1, message: `Scenario references undeclared token ${name}. Use a real token from its defining owner.` });
|
|
169
171
|
if (kind === "tokens") {
|