@uidbai/mcp-server 0.2.0 → 0.3.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/README.md +164 -62
- package/dist/cli.js +0 -0
- package/dist/core/local-fs.d.ts +174 -0
- package/dist/core/local-fs.d.ts.map +1 -0
- package/dist/core/local-fs.js +263 -0
- package/dist/core/local-fs.js.map +1 -0
- package/dist/templates/index.d.ts +22 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/index.js +19 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/templates/minimal.d.ts +9 -0
- package/dist/templates/minimal.d.ts.map +1 -0
- package/dist/templates/minimal.js +115 -0
- package/dist/templates/minimal.js.map +1 -0
- package/dist/templates/standard.d.ts +9 -0
- package/dist/templates/standard.d.ts.map +1 -0
- package/dist/templates/standard.js +527 -0
- package/dist/templates/standard.js.map +1 -0
- package/dist/tools/detect-pattern.d.ts +8 -5
- package/dist/tools/detect-pattern.d.ts.map +1 -1
- package/dist/tools/detect-pattern.js +151 -18
- package/dist/tools/detect-pattern.js.map +1 -1
- package/dist/tools/get-config.d.ts +1 -1
- package/dist/tools/get-config.d.ts.map +1 -1
- package/dist/tools/get-config.js +45 -10
- package/dist/tools/get-config.js.map +1 -1
- package/dist/tools/guide.d.ts +65 -0
- package/dist/tools/guide.d.ts.map +1 -0
- package/dist/tools/guide.js +304 -0
- package/dist/tools/guide.js.map +1 -0
- package/dist/tools/index.d.ts +4 -5
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +4 -5
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/init.d.ts +73 -0
- package/dist/tools/init.d.ts.map +1 -0
- package/dist/tools/init.js +149 -0
- package/dist/tools/init.js.map +1 -0
- package/dist/tools/list-components.d.ts +18 -3
- package/dist/tools/list-components.d.ts.map +1 -1
- package/dist/tools/list-components.js +86 -11
- package/dist/tools/list-components.js.map +1 -1
- package/dist/tools/list-patterns.d.ts +18 -3
- package/dist/tools/list-patterns.d.ts.map +1 -1
- package/dist/tools/list-patterns.js +85 -10
- package/dist/tools/list-patterns.js.map +1 -1
- package/dist/tools/registry.d.ts +1 -1
- package/dist/tools/registry.d.ts.map +1 -1
- package/dist/tools/registry.js +14 -15
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/status.d.ts +1 -1
- package/dist/tools/status.d.ts.map +1 -1
- package/dist/tools/status.js +54 -42
- package/dist/tools/status.js.map +1 -1
- package/dist/tools/submit-pattern.d.ts +13 -11
- package/dist/tools/submit-pattern.d.ts.map +1 -1
- package/dist/tools/submit-pattern.js +90 -19
- package/dist/tools/submit-pattern.js.map +1 -1
- package/dist/tools/update-config.d.ts +16 -8
- package/dist/tools/update-config.d.ts.map +1 -1
- package/dist/tools/update-config.js +93 -39
- package/dist/tools/update-config.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UIDB MCP Server - Local File System Operations
|
|
3
|
+
*
|
|
4
|
+
* Read/write operations for the local .uidb/ folder.
|
|
5
|
+
* This is the primary interface for the embedded design system architecture.
|
|
6
|
+
*/
|
|
7
|
+
import * as fs from "fs/promises";
|
|
8
|
+
import * as path from "path";
|
|
9
|
+
// ============================================================================
|
|
10
|
+
// Path Utilities
|
|
11
|
+
// ============================================================================
|
|
12
|
+
const UIDB_FOLDER = ".uidb";
|
|
13
|
+
/**
|
|
14
|
+
* Find the .uidb folder by searching up from the current directory
|
|
15
|
+
*/
|
|
16
|
+
export async function findUIDBRoot() {
|
|
17
|
+
let currentDir = process.cwd();
|
|
18
|
+
const root = path.parse(currentDir).root;
|
|
19
|
+
while (currentDir !== root) {
|
|
20
|
+
const uidbPath = path.join(currentDir, UIDB_FOLDER);
|
|
21
|
+
try {
|
|
22
|
+
const stat = await fs.stat(uidbPath);
|
|
23
|
+
if (stat.isDirectory()) {
|
|
24
|
+
return currentDir;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
// Directory doesn't exist, keep searching
|
|
29
|
+
}
|
|
30
|
+
currentDir = path.dirname(currentDir);
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Get the path to the .uidb folder
|
|
36
|
+
*/
|
|
37
|
+
export async function getUIDBPath() {
|
|
38
|
+
const root = await findUIDBRoot();
|
|
39
|
+
if (!root) {
|
|
40
|
+
throw new UIDBNotFoundError();
|
|
41
|
+
}
|
|
42
|
+
return path.join(root, UIDB_FOLDER);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Check if .uidb folder exists
|
|
46
|
+
*/
|
|
47
|
+
export async function uidbExists() {
|
|
48
|
+
const root = await findUIDBRoot();
|
|
49
|
+
return root !== null;
|
|
50
|
+
}
|
|
51
|
+
// ============================================================================
|
|
52
|
+
// Read Operations
|
|
53
|
+
// ============================================================================
|
|
54
|
+
/**
|
|
55
|
+
* Read and parse a JSON file from .uidb/
|
|
56
|
+
*/
|
|
57
|
+
async function readJSON(relativePath) {
|
|
58
|
+
const uidbPath = await getUIDBPath();
|
|
59
|
+
const filePath = path.join(uidbPath, relativePath);
|
|
60
|
+
try {
|
|
61
|
+
const content = await fs.readFile(filePath, "utf-8");
|
|
62
|
+
return JSON.parse(content);
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
if (error.code === "ENOENT") {
|
|
66
|
+
throw new FileNotFoundError(relativePath);
|
|
67
|
+
}
|
|
68
|
+
throw new ParseError(relativePath, error);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Read the manifest.json
|
|
73
|
+
*/
|
|
74
|
+
export async function readManifest() {
|
|
75
|
+
return readJSON("manifest.json");
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Read the config.json
|
|
79
|
+
*/
|
|
80
|
+
export async function readConfig() {
|
|
81
|
+
return readJSON("config.json");
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Read the components index
|
|
85
|
+
*/
|
|
86
|
+
export async function readComponentsIndex() {
|
|
87
|
+
return readJSON("components/_index.json");
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Read a specific component definition
|
|
91
|
+
*/
|
|
92
|
+
export async function readComponent(componentId) {
|
|
93
|
+
return readJSON(`components/${componentId}.json`);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Read the patterns index
|
|
97
|
+
*/
|
|
98
|
+
export async function readPatternsIndex() {
|
|
99
|
+
return readJSON("patterns/_index.json");
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Read a specific pattern definition
|
|
103
|
+
*/
|
|
104
|
+
export async function readPattern(patternId) {
|
|
105
|
+
return readJSON(`patterns/${patternId}.json`);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Read rules (a11y or constraints)
|
|
109
|
+
*/
|
|
110
|
+
export async function readRules(ruleType) {
|
|
111
|
+
return readJSON(`rules/${ruleType}.json`);
|
|
112
|
+
}
|
|
113
|
+
// ============================================================================
|
|
114
|
+
// Write Operations
|
|
115
|
+
// ============================================================================
|
|
116
|
+
/**
|
|
117
|
+
* Write a JSON file to .uidb/
|
|
118
|
+
*/
|
|
119
|
+
async function writeJSON(relativePath, data) {
|
|
120
|
+
const uidbPath = await getUIDBPath();
|
|
121
|
+
const filePath = path.join(uidbPath, relativePath);
|
|
122
|
+
// Ensure directory exists
|
|
123
|
+
const dir = path.dirname(filePath);
|
|
124
|
+
await fs.mkdir(dir, { recursive: true });
|
|
125
|
+
// Write file with pretty formatting
|
|
126
|
+
const content = JSON.stringify(data, null, 2);
|
|
127
|
+
await fs.writeFile(filePath, content, "utf-8");
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Update the config.json
|
|
131
|
+
*/
|
|
132
|
+
export async function writeConfig(config) {
|
|
133
|
+
// Update the updated_at in manifest
|
|
134
|
+
try {
|
|
135
|
+
const manifest = await readManifest();
|
|
136
|
+
manifest.updated_at = new Date().toISOString().split("T")[0];
|
|
137
|
+
await writeJSON("manifest.json", manifest);
|
|
138
|
+
}
|
|
139
|
+
catch {
|
|
140
|
+
// Manifest might not exist, that's okay
|
|
141
|
+
}
|
|
142
|
+
return writeJSON("config.json", config);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Update the components index
|
|
146
|
+
*/
|
|
147
|
+
export async function writeComponentsIndex(index) {
|
|
148
|
+
return writeJSON("components/_index.json", index);
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Write a component definition
|
|
152
|
+
*/
|
|
153
|
+
export async function writeComponent(componentId, component) {
|
|
154
|
+
return writeJSON(`components/${componentId}.json`, component);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Update the patterns index
|
|
158
|
+
*/
|
|
159
|
+
export async function writePatternsIndex(index) {
|
|
160
|
+
return writeJSON("patterns/_index.json", index);
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Write a pattern definition
|
|
164
|
+
*/
|
|
165
|
+
export async function writePattern(patternId, pattern) {
|
|
166
|
+
return writeJSON(`patterns/${patternId}.json`, pattern);
|
|
167
|
+
}
|
|
168
|
+
// ============================================================================
|
|
169
|
+
// Init Operations
|
|
170
|
+
// ============================================================================
|
|
171
|
+
/**
|
|
172
|
+
* Initialize a new .uidb folder with template files
|
|
173
|
+
*/
|
|
174
|
+
export async function initUIDB(projectRoot, files) {
|
|
175
|
+
const uidbPath = path.join(projectRoot, UIDB_FOLDER);
|
|
176
|
+
// Create .uidb directory
|
|
177
|
+
await fs.mkdir(uidbPath, { recursive: true });
|
|
178
|
+
// Write each file
|
|
179
|
+
for (const [relativePath, content] of Object.entries(files)) {
|
|
180
|
+
const filePath = path.join(uidbPath, relativePath);
|
|
181
|
+
const dir = path.dirname(filePath);
|
|
182
|
+
// Ensure directory exists
|
|
183
|
+
await fs.mkdir(dir, { recursive: true });
|
|
184
|
+
// Write content (string or JSON)
|
|
185
|
+
if (typeof content === "string") {
|
|
186
|
+
await fs.writeFile(filePath, content, "utf-8");
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
await fs.writeFile(filePath, JSON.stringify(content, null, 2), "utf-8");
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
// ============================================================================
|
|
194
|
+
// Error Classes
|
|
195
|
+
// ============================================================================
|
|
196
|
+
export class UIDBNotFoundError extends Error {
|
|
197
|
+
constructor() {
|
|
198
|
+
super("No .uidb folder found. Run uidb_init to initialize a design system.");
|
|
199
|
+
this.name = "UIDBNotFoundError";
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
export class FileNotFoundError extends Error {
|
|
203
|
+
constructor(filePath) {
|
|
204
|
+
super(`File not found in .uidb: ${filePath}`);
|
|
205
|
+
this.name = "FileNotFoundError";
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
export class ParseError extends Error {
|
|
209
|
+
constructor(filePath, cause) {
|
|
210
|
+
super(`Failed to parse ${filePath}: ${cause instanceof Error ? cause.message : "Unknown error"}`);
|
|
211
|
+
this.name = "ParseError";
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
// ============================================================================
|
|
215
|
+
// Helper Functions
|
|
216
|
+
// ============================================================================
|
|
217
|
+
/**
|
|
218
|
+
* Get a summary of the design system for guidance
|
|
219
|
+
*/
|
|
220
|
+
export async function getDesignSystemSummary() {
|
|
221
|
+
const [config, componentsIndex, patternsIndex] = await Promise.all([
|
|
222
|
+
readConfig(),
|
|
223
|
+
readComponentsIndex(),
|
|
224
|
+
readPatternsIndex(),
|
|
225
|
+
]);
|
|
226
|
+
return {
|
|
227
|
+
config,
|
|
228
|
+
components: componentsIndex.components,
|
|
229
|
+
patterns: patternsIndex.patterns,
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Find a component by name (case-insensitive)
|
|
234
|
+
*/
|
|
235
|
+
export async function findComponent(query) {
|
|
236
|
+
const index = await readComponentsIndex();
|
|
237
|
+
const entry = index.components.find((c) => c.id.toLowerCase() === query.toLowerCase() ||
|
|
238
|
+
c.name.toLowerCase() === query.toLowerCase());
|
|
239
|
+
if (!entry) {
|
|
240
|
+
return null;
|
|
241
|
+
}
|
|
242
|
+
return readComponent(entry.id);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Find components by category
|
|
246
|
+
*/
|
|
247
|
+
export async function findComponentsByCategory(category) {
|
|
248
|
+
const index = await readComponentsIndex();
|
|
249
|
+
return index.components.filter((c) => c.category.toLowerCase() === category.toLowerCase());
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Find a pattern by name (case-insensitive)
|
|
253
|
+
*/
|
|
254
|
+
export async function findPattern(query) {
|
|
255
|
+
const index = await readPatternsIndex();
|
|
256
|
+
const entry = index.patterns.find((p) => p.id.toLowerCase() === query.toLowerCase() ||
|
|
257
|
+
p.name.toLowerCase() === query.toLowerCase());
|
|
258
|
+
if (!entry) {
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
261
|
+
return readPattern(entry.id);
|
|
262
|
+
}
|
|
263
|
+
//# sourceMappingURL=local-fs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"local-fs.js","sourceRoot":"","sources":["../../src/core/local-fs.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAqF7B,+EAA+E;AAC/E,iBAAiB;AACjB,+EAA+E;AAE/E,MAAM,WAAW,GAAG,OAAO,CAAC;AAE5B;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY;IAChC,IAAI,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC/B,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,IAAI,C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emplate } from "./minimal.js";
|
|
7
|
+
import { standardTemplate } from "./standard.js";
|
|
8
|
+
export { minimalTemplate, standardTemplate };
|
|
9
|
+
export type TemplateType = "minimal" | "standard";
|
|
10
|
+
export interface TemplateConfig {
|
|
11
|
+
accentColor: string;
|
|
12
|
+
grayColor: string;
|
|
13
|
+
radius: string;
|
|
14
|
+
appearance: "light" | "dark";
|
|
15
|
+
}
|
|
16
|
+
export interface Template {
|
|
17
|
+
name: string;
|
|
18
|
+
description: string;
|
|
19
|
+
files: Record<string, object | string>;
|
|
20
|
+
}
|
|
21
|
+
export declare function getTemplate(type: TemplateType, config: TemplateConfig, projectName: string): Template;
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,CAAC;AAE7C,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,UAAU,CAAC;AAElD,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,OAAO,GAAG,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;CACxC;AAED,wBAAgB,WAAW,CACzB,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,cAAc,EACtB,WAAW,EAAE,MAAM,GAClB,QAAQ,CASV"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UIDB Templates
|
|
3
|
+
*
|
|
4
|
+
* Pre-configured .uidb/ folder contents for different starting points.
|
|
5
|
+
*/
|
|
6
|
+
import { minimalTemplate } from "./minimal.js";
|
|
7
|
+
import { standardTemplate } from "./standard.js";
|
|
8
|
+
export { minimalTemplate, standardTemplate };
|
|
9
|
+
export function getTemplate(type, config, projectName) {
|
|
10
|
+
switch (type) {
|
|
11
|
+
case "minimal":
|
|
12
|
+
return minimalTemplate(config, projectName);
|
|
13
|
+
case "standard":
|
|
14
|
+
return standardTemplate(config, projectName);
|
|
15
|
+
default:
|
|
16
|
+
return standardTemplate(config, projectName);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,CAAC;AAiB7C,MAAM,UAAU,WAAW,CACzB,IAAkB,EAClB,MAAsB,EACtB,WAAmB;IAEnB,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,SAAS;YACZ,OAAO,eAAe,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QAC9C,KAAK,UAAU;YACb,OAAO,gBAAgB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QAC/C;YACE,OAAO,gBAAgB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACjD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal Template
|
|
3
|
+
*
|
|
4
|
+
* Just the essentials: manifest, config, and component index.
|
|
5
|
+
* Use this when you want to build up your design system incrementally.
|
|
6
|
+
*/
|
|
7
|
+
import type { Template, TemplateConfig } from "./index.js";
|
|
8
|
+
export declare function minimalTemplate(config: TemplateConfig, projectName: string): Template;
|
|
9
|
+
//# sourceMappingURL=minimal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"minimal.d.ts","sourceRoot":"","sources":["../../src/templates/minimal.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE3D,wBAAgB,eAAe,CAC7B,MAAM,EAAE,cAAc,EACtB,WAAW,EAAE,MAAM,GAClB,QAAQ,CA8GV"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal Template
|
|
3
|
+
*
|
|
4
|
+
* Just the essentials: manifest, config, and component index.
|
|
5
|
+
* Use this when you want to build up your design system incrementally.
|
|
6
|
+
*/
|
|
7
|
+
export function minimalTemplate(config, projectName) {
|
|
8
|
+
const now = new Date().toISOString().split("T")[0];
|
|
9
|
+
return {
|
|
10
|
+
name: "minimal",
|
|
11
|
+
description: "Minimal setup with just config and component index",
|
|
12
|
+
files: {
|
|
13
|
+
"manifest.json": {
|
|
14
|
+
$schema: "https://uidb.ai/schemas/manifest.json",
|
|
15
|
+
version: "1.0.0",
|
|
16
|
+
name: projectName,
|
|
17
|
+
description: `Design system for ${projectName}`,
|
|
18
|
+
framework: {
|
|
19
|
+
name: "auto-detect",
|
|
20
|
+
ui_library: "radix-ui-themes",
|
|
21
|
+
},
|
|
22
|
+
created_at: now,
|
|
23
|
+
updated_at: now,
|
|
24
|
+
},
|
|
25
|
+
"config.json": {
|
|
26
|
+
$schema: "https://uidb.ai/schemas/config.json",
|
|
27
|
+
theme: {
|
|
28
|
+
accentColor: config.accentColor,
|
|
29
|
+
grayColor: config.grayColor,
|
|
30
|
+
radius: config.radius,
|
|
31
|
+
},
|
|
32
|
+
appearance: config.appearance,
|
|
33
|
+
scaling: "100%",
|
|
34
|
+
},
|
|
35
|
+
"components/_index.json": {
|
|
36
|
+
$schema: "https://uidb.ai/schemas/components-index.json",
|
|
37
|
+
components: [],
|
|
38
|
+
categories: {
|
|
39
|
+
interaction: "Interactive elements for user actions",
|
|
40
|
+
form: "Input and selection components for data entry",
|
|
41
|
+
layout: "Structural components for organizing content",
|
|
42
|
+
navigation: "Components for navigating between views",
|
|
43
|
+
overlay: "Components that appear above page content",
|
|
44
|
+
feedback: "Components for user feedback and messaging",
|
|
45
|
+
"data-display": "Components for displaying data and status",
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
"patterns/_index.json": {
|
|
49
|
+
$schema: "https://uidb.ai/schemas/patterns-index.json",
|
|
50
|
+
patterns: [],
|
|
51
|
+
categories: {
|
|
52
|
+
layout: "Structural patterns for organizing content",
|
|
53
|
+
forms: "Form layout and input patterns",
|
|
54
|
+
feedback: "User feedback and state patterns",
|
|
55
|
+
navigation: "Navigation and menu patterns",
|
|
56
|
+
"data-display": "Patterns for displaying data",
|
|
57
|
+
identity: "User identity and profile patterns",
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
"rules/a11y.json": {
|
|
61
|
+
$schema: "https://uidb.ai/schemas/a11y-rules.json",
|
|
62
|
+
wcag_level: "AA",
|
|
63
|
+
rules: {
|
|
64
|
+
color_contrast: {
|
|
65
|
+
requirement: "Text must have 4.5:1 contrast ratio against background",
|
|
66
|
+
},
|
|
67
|
+
focus_indicators: {
|
|
68
|
+
requirement: "All interactive elements must have visible focus indicators",
|
|
69
|
+
},
|
|
70
|
+
touch_targets: {
|
|
71
|
+
requirement: "Minimum 44x44px touch targets on mobile",
|
|
72
|
+
},
|
|
73
|
+
labels: {
|
|
74
|
+
form_inputs: "All inputs must have associated labels",
|
|
75
|
+
icon_buttons: "Icon-only buttons must have aria-label",
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
"rules/constraints.json": {
|
|
80
|
+
$schema: "https://uidb.ai/schemas/constraints.json",
|
|
81
|
+
semantic_colors: {
|
|
82
|
+
description: "Use semantic color names instead of raw colors",
|
|
83
|
+
mapping: {
|
|
84
|
+
primary_action: "accent",
|
|
85
|
+
secondary_action: "gray",
|
|
86
|
+
destructive: "red",
|
|
87
|
+
success: "green",
|
|
88
|
+
warning: "amber",
|
|
89
|
+
info: "blue",
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
"README.md": `# Design System - ${projectName}
|
|
94
|
+
|
|
95
|
+
This folder contains the design system for this project.
|
|
96
|
+
|
|
97
|
+
## Theme Config
|
|
98
|
+
|
|
99
|
+
Edit \`config.json\` to change colors and styling:
|
|
100
|
+
- \`accentColor\`: ${config.accentColor}
|
|
101
|
+
- \`grayColor\`: ${config.grayColor}
|
|
102
|
+
- \`radius\`: ${config.radius}
|
|
103
|
+
|
|
104
|
+
## Usage
|
|
105
|
+
|
|
106
|
+
Import the config in your root layout and pass to Radix Theme.
|
|
107
|
+
|
|
108
|
+
## Adding Components
|
|
109
|
+
|
|
110
|
+
As you build, add component definitions to \`components/\` and patterns to \`patterns/\`.
|
|
111
|
+
`,
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=minimal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"minimal.js","sourceRoot":"","sources":["../../src/templates/minimal.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,UAAU,eAAe,CAC7B,MAAsB,EACtB,WAAmB;IAEnB,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAEnD,OAAO;QACL,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,oDAAoD;QACjE,KAAK,EAAE;YACL,eAAe,EAAE;gBACf,OAAO,EAAE,uCAAuC;gBAChD,OAAO,EAAE,OAAO;gBA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EAAE;wBACb,WAAW,EAAE,yCAAyC;qBACvD;oBACD,MAAM,EAAE;wBACN,WAAW,EAAE,wCAAwC;wBACrD,YAAY,EAAE,wCAAwC;qBACvD;iBACF;aACF;YACD,wBAAwB,EAAE;gBACxB,OAAO,EAAE,0CAA0C;gBACnD,eAAe,EAAE;oBACf,WAAW,EAAE,gDAAgD;oBAC7D,OAAO,EAAE;wBACP,cAAc,EAAE,QAAQ;wBACxB,gBAAgB,EAAE,MAAM;wBACxB,WAAW,EAAE,KAAK;wBAClB,OAAO,EAAE,OAAO;wBAChB,OAAO,EAAE,OAAO;wBAChB,IAAI,EAAE,MAAM;qBACb;iBACF;aACF;YACD,WAAW,EAAE,qBAAqB,WAAW;;;;;;;qBAO9B,MAAM,CAAC,WAAW;mBACpB,MAAM,CAAC,SAAS;gBACnB,MAAM,CAAC,MAAM;;;;;;;;;CAS5B;SACI;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standard Template
|
|
3
|
+
*
|
|
4
|
+
* Full setup with all Radix UI Themes components and common patterns.
|
|
5
|
+
* Recommended for most projects.
|
|
6
|
+
*/
|
|
7
|
+
import type { Template, TemplateConfig } from "./index.js";
|
|
8
|
+
export declare function standardTemplate(config: TemplateConfig, projectName: string): Template;
|
|
9
|
+
//# sourceMappingURL=standard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"standard.d.ts","sourceRoot":"","sources":["../../src/templates/standard.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE3D,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,cAAc,EACtB,WAAW,EAAE,MAAM,GAClB,QAAQ,CA6CV"}
|