@uibot/design-md-importer 0.0.0-stage → 0.2.1
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/importers/css-variables.d.ts +12 -0
- package/dist/importers/open-design-systems.d.ts +2 -0
- package/dist/importers/tailwind.d.ts +14 -0
- package/dist/importers/tokens-json.d.ts +16 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +61 -0
- package/dist/types.d.ts +29 -0
- package/package.json +40 -4
- package/README.md +0 -3
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ScanResult } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Scan `projectRoot/{src,styles,app}/**\/*.css` for global CSS custom
|
|
4
|
+
* properties declared in `:root { ... }` or `@theme { ... }` (Tailwind v4
|
|
5
|
+
* CSS-first) blocks. Variables are grouped into colors / spacing /
|
|
6
|
+
* typography / misc by name prefix.
|
|
7
|
+
*
|
|
8
|
+
* Does not execute or evaluate any CSS; regex-extracts the subset of
|
|
9
|
+
* declarations that are textually unambiguous. Conflicting variables (same
|
|
10
|
+
* name across files) keep the first-seen value.
|
|
11
|
+
*/
|
|
12
|
+
export declare function scanCssVariables(projectRoot: string): ScanResult;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ScanResult } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Scan the Tailwind config in `projectRoot` (`tailwind.config.{ts,js,mjs,cjs}`)
|
|
4
|
+
* and derive `DesignMd` entries from literal `theme.{colors,fontFamily,fontSize,spacing}`.
|
|
5
|
+
*
|
|
6
|
+
* Never executes user code: parses the config with `@babel/parser` and walks
|
|
7
|
+
* the AST looking for literal values only. Non-literal values (function
|
|
8
|
+
* references, `require()` calls, spread elements inside objects) are skipped
|
|
9
|
+
* and recorded in `errors` as `unsupported-expression`.
|
|
10
|
+
*
|
|
11
|
+
* Supports Tailwind v3 config files. Tailwind v4's CSS-first `@theme`
|
|
12
|
+
* declarations are handled by the `scanCssVariables` importer (Sprint 3).
|
|
13
|
+
*/
|
|
14
|
+
export declare function scanTailwindConfig(projectRoot: string): ScanResult;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ScanResult } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Scan `projectRoot` for design tokens JSON files (`tokens.json` and
|
|
4
|
+
* `design-tokens/**\/*.json`) and derive `DesignMd` entries grouped into
|
|
5
|
+
* colors / spacing / typography / misc.
|
|
6
|
+
*
|
|
7
|
+
* Supports both the Design Tokens Community Group format
|
|
8
|
+
* (`{ "color": { "brand": { "$value": "#...", "$type": "color" } } }`)
|
|
9
|
+
* and a flat JSON fallback (`{ "color": { "brand": "#..." } }`). Values
|
|
10
|
+
* are concatenated as strings; non-primitive `$value` entries are skipped.
|
|
11
|
+
*
|
|
12
|
+
* Priority when multiple files contribute to the same section: first-seen
|
|
13
|
+
* wins per token name. `tokens.json` is scanned before `design-tokens/*`
|
|
14
|
+
* to give the project root precedence.
|
|
15
|
+
*/
|
|
16
|
+
export declare function scanTokensJson(projectRoot: string): ScanResult;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ScanAutoDesignMdOptions, ScanResult } from "./types.js";
|
|
2
|
+
export type { ImporterError, ImporterKind, ScanAutoDesignMdOptions, ScanResult, } from "./types.js";
|
|
3
|
+
export { scanTailwindConfig } from "./importers/tailwind.js";
|
|
4
|
+
export { scanTokensJson } from "./importers/tokens-json.js";
|
|
5
|
+
export { scanCssVariables } from "./importers/css-variables.js";
|
|
6
|
+
export { scanOpenDesignSystems } from "./importers/open-design-systems.js";
|
|
7
|
+
/**
|
|
8
|
+
* Run all enabled static scanners against `projectRoot` and return a merged
|
|
9
|
+
* `ScanResult`. Entries are deduplicated by `id` with first-seen winning,
|
|
10
|
+
* respecting the order of the `enabled` list (default: `["tailwind",
|
|
11
|
+
* "tokens", "css"]`). Errors from every scanner are concatenated.
|
|
12
|
+
*
|
|
13
|
+
* The returned entries are intended to be fed into
|
|
14
|
+
* `DesignMdRegistry.addAll(entries, { layer: "auto" })` by the caller
|
|
15
|
+
* (typically `createUIBotStudioDesignMdScanHandler` or the control-plane
|
|
16
|
+
* bootstrap in `examples/minimal-runtime`). This function itself does not
|
|
17
|
+
* touch any registry or capability plumbing.
|
|
18
|
+
*/
|
|
19
|
+
export declare function scanAutoDesignMd(options: ScanAutoDesignMdOptions): ScanResult;
|