@uibot/design-md 0.12.0 → 0.14.0

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/dist/schema.d.ts CHANGED
@@ -25,6 +25,8 @@ export interface DesignMdFrontmatter {
25
25
  name?: string;
26
26
  /** Optional semver / document version from frontmatter. */
27
27
  version?: string;
28
+ /** One-line summary (DESIGN.md spec `description`). */
29
+ description?: string;
28
30
  }
29
31
  /** Split a markdown file into frontmatter YAML + body text. */
30
32
  export declare function splitFrontmatter(raw: string): {
package/dist/spec.d.ts ADDED
@@ -0,0 +1,46 @@
1
+ import type { DesignMd, DesignMdTokens } from "@uibot/contracts";
2
+ /**
3
+ * DESIGN.md standard used by UIBot: the Google Labs DESIGN.md format (alpha,
4
+ * https://github.com/google-labs-code/design.md) — YAML tokens in frontmatter and/or fenced
5
+ * ```yaml blocks, plus H2 sections in a fixed order — with two UIBot token extensions
6
+ * (`themes`, `forbidden`). Headings of the earlier formats still in use (the Stitch-derived
7
+ * 7-section project contract and the VoltAgent 9-section brand seeds) are accepted as aliases.
8
+ */
9
+ /** Canonical sections, in spec order. */
10
+ export declare const DESIGN_MD_SECTIONS: readonly ["Overview", "Colors", "Typography", "Layout", "Elevation & Depth", "Shapes", "Components", "Do's and Don'ts"];
11
+ export type DesignMdSection = (typeof DESIGN_MD_SECTIONS)[number];
12
+ export interface DesignMdLintIssue {
13
+ severity: "error" | "warning";
14
+ message: string;
15
+ path?: string;
16
+ }
17
+ /** Canonical name of a `##` heading, or undefined for an extra section. */
18
+ export declare function canonicalDesignMdSection(heading: string): DesignMdSection | undefined;
19
+ /**
20
+ * Token tree of a DESIGN.md (frontmatter plus fenced yaml blocks), or undefined when the file
21
+ * declares no token group. Values keep their authored form.
22
+ */
23
+ export declare function parseDesignMdTokens(raw: string): DesignMdTokens | undefined;
24
+ /**
25
+ * Lint a DESIGN.md against the spec. Errors: invalid YAML, a duplicate section heading, a top-level
26
+ * key declared twice (frontmatter and/or yaml blocks). Warnings: sections out of order, no
27
+ * `colors.primary` when colors are declared, invalid colors or dimensions, unknown component
28
+ * properties, references that do not resolve.
29
+ */
30
+ export declare function lintDesignMd(raw: string): DesignMdLintIssue[];
31
+ /** Prompt lines that state a file's tokens as a binding visual contract for generated UI. */
32
+ export declare function designTokensInstruction(tokens: DesignMdTokens): string;
33
+ export interface DesignContractViolation {
34
+ rule: "forbidden-color" | "forbidden-font" | "tokens-unused";
35
+ detail: string;
36
+ }
37
+ /**
38
+ * Check generated HTML against a DESIGN.md token contract: no forbidden color, no forbidden font
39
+ * as the only named family, and at least one declared color used through `var(--name)`.
40
+ */
41
+ export declare function checkHtmlAgainstDesign(html: string, tokens: DesignMdTokens): DesignContractViolation[];
42
+ /**
43
+ * Text of a guide for a generation prompt: its token contract (when it declares tokens, which live
44
+ * in frontmatter and so are not in the body) followed by the body.
45
+ */
46
+ export declare function designMdGuideText(entry: Pick<DesignMd, "body" | "tokens">): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uibot/design-md",
3
- "version": "0.12.0",
3
+ "version": "0.14.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -28,12 +28,12 @@
28
28
  "access": "public"
29
29
  },
30
30
  "dependencies": {
31
- "@uibot/contracts": "^0.12.0",
32
- "@uibot/plugin-sdk": "^0.12.0",
31
+ "@uibot/contracts": "^0.14.0",
32
+ "@uibot/plugin-sdk": "^0.14.0",
33
33
  "yaml": "2.9.1"
34
34
  },
35
35
  "devDependencies": {
36
- "@uibot/design-md-importer": "^0.12.0"
36
+ "@uibot/design-md-importer": "^0.14.0"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "rm -rf dist && bun build --minify ./src/index.ts --outdir ./dist --format esm --target bun && bun x tsc -p tsconfig.json",