@higinio/design-mcp 0.2.0 → 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/assets/bruma/design-doc.md +225 -33
- package/assets/bruma/framework.css +268 -51
- package/assets/bruma/styleguide.html +676 -168
- package/assets/bruma/tailwind.css +48 -6
- package/assets/bruma/tokens.css +61 -5
- package/assets/bruma/tokens.json +769 -25
- package/assets/celeste/design-doc.md +242 -40
- package/assets/celeste/framework.css +290 -62
- package/assets/celeste/styleguide.html +760 -178
- package/assets/celeste/tailwind.css +48 -6
- package/assets/celeste/tokens.css +67 -6
- package/assets/celeste/tokens.json +778 -26
- package/assets/nocturna/design-doc.md +346 -52
- package/assets/nocturna/framework.css +317 -108
- package/assets/nocturna/styleguide.html +809 -215
- package/assets/nocturna/tailwind.css +46 -3
- package/assets/nocturna/tokens.css +115 -6
- package/assets/nocturna/tokens.json +754 -21
- package/assets/salvia/design-doc.md +224 -31
- package/assets/salvia/framework.css +269 -51
- package/assets/salvia/styleguide.html +674 -168
- package/assets/salvia/tailwind.css +48 -6
- package/assets/salvia/tokens.css +61 -5
- package/assets/salvia/tokens.json +769 -25
- package/dist/server.js +1 -1
- package/dist/snippet.js +26 -17
- package/dist/tokens.js +42 -5
- package/package.json +32 -8
package/dist/server.js
CHANGED
|
@@ -14,7 +14,7 @@ function text(payload) {
|
|
|
14
14
|
return { content: [{ type: "text", text: body }] };
|
|
15
15
|
}
|
|
16
16
|
export function buildServer(store) {
|
|
17
|
-
const server = new McpServer({ name: "design-mcp", version: "0.2.
|
|
17
|
+
const server = new McpServer({ name: "design-mcp", version: "0.2.1" });
|
|
18
18
|
server.registerTool("list_design_systems", {
|
|
19
19
|
description: "Lista los sistemas de diseño disponibles con su metadata (filosofía, paleta, fuentes).",
|
|
20
20
|
inputSchema: {},
|
package/dist/snippet.js
CHANGED
|
@@ -1,45 +1,54 @@
|
|
|
1
1
|
const CSS = {
|
|
2
2
|
button: `.btn-primary {
|
|
3
|
-
background: var(--
|
|
4
|
-
color: var(--on-
|
|
3
|
+
background: var(--action-bg);
|
|
4
|
+
color: var(--text-on-action);
|
|
5
5
|
border: 1px solid transparent;
|
|
6
|
-
border-radius: var(--radius-md
|
|
7
|
-
|
|
6
|
+
border-radius: var(--radius-md);
|
|
7
|
+
min-height: var(--control-height-md);
|
|
8
|
+
padding: var(--button-padding-md);
|
|
8
9
|
font-family: var(--font-body);
|
|
9
10
|
}
|
|
10
|
-
.btn-primary:hover { background: var(--
|
|
11
|
+
.btn-primary:hover:not(:disabled) { background: var(--action-hover); }
|
|
12
|
+
.btn-primary:active:not(:disabled) { background: var(--action-active); }
|
|
13
|
+
.btn-primary:focus-visible { outline: 2px solid var(--focus-color); outline-offset: 2px; }
|
|
14
|
+
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }`,
|
|
11
15
|
card: `.card {
|
|
12
16
|
background: var(--surface);
|
|
13
17
|
border: 1px solid var(--border);
|
|
14
|
-
border-radius: var(--radius-lg
|
|
15
|
-
padding:
|
|
18
|
+
border-radius: var(--radius-lg);
|
|
19
|
+
padding: var(--card-padding);
|
|
16
20
|
color: var(--text-primary);
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
gap: var(--card-content-gap);
|
|
17
24
|
}`,
|
|
18
25
|
input: `.input {
|
|
19
26
|
background: var(--surface);
|
|
20
|
-
border: 1px solid var(--border);
|
|
21
|
-
border-radius: var(--radius-
|
|
22
|
-
|
|
27
|
+
border: 1px solid var(--control-border);
|
|
28
|
+
border-radius: var(--radius-sm);
|
|
29
|
+
min-height: var(--control-height-md);
|
|
30
|
+
padding: var(--space-3);
|
|
23
31
|
color: var(--text-primary);
|
|
24
32
|
}
|
|
25
|
-
.input
|
|
33
|
+
.input::placeholder { color: var(--placeholder); }
|
|
34
|
+
.input:focus-visible { outline: 2px solid var(--focus-color); outline-offset: 2px; }`,
|
|
26
35
|
};
|
|
27
36
|
const REACT = {
|
|
28
37
|
button: `export function Button({ children, ...props }) {
|
|
29
|
-
return <button
|
|
38
|
+
return <button type="button" {...props} className={['btn', 'btn--primary', props.className].filter(Boolean).join(' ')}>{children}</button>;
|
|
30
39
|
}`,
|
|
31
40
|
card: `export function Card({ children }) {
|
|
32
41
|
return <div className="card">{children}</div>;
|
|
33
42
|
}`,
|
|
34
|
-
input: `export function Input(props) {
|
|
35
|
-
return <input className=
|
|
43
|
+
input: `export function Input({ className, ...props }) {
|
|
44
|
+
return <input {...props} className={['input', className].filter(Boolean).join(' ')} />;
|
|
36
45
|
}`,
|
|
37
46
|
};
|
|
38
47
|
function tailwindFor(component) {
|
|
39
48
|
const map = {
|
|
40
|
-
button: `<button class="bg-[var(--
|
|
41
|
-
card: `<div class="bg-[var(--surface)] border border-[var(--border)] rounded-[
|
|
42
|
-
input: `<input class="bg-[var(--surface)] border border-[var(--border)] rounded-[
|
|
49
|
+
button: `<button type="button" class="bg-[var(--action-bg)] text-[var(--text-on-action)] rounded-[var(--radius-md)] min-h-[var(--control-height-md)] px-5 py-3 font-[family-name:var(--font-body)] hover:enabled:bg-[var(--action-hover)] active:enabled:bg-[var(--action-active)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--focus-color)] disabled:opacity-50">Acción</button>`,
|
|
50
|
+
card: `<div class="flex flex-col gap-[var(--card-content-gap)] bg-[var(--surface)] border border-[var(--border)] rounded-[var(--radius-lg)] p-[var(--card-padding)] text-[var(--text-primary)]">…</div>`,
|
|
51
|
+
input: `<label class="flex flex-col gap-[var(--field-gap)]">Correo<input type="email" autocomplete="email" class="block w-full bg-[var(--surface)] border border-[var(--control-border)] rounded-[var(--radius-sm)] min-h-[var(--control-height-md)] p-3 text-[var(--text-primary)] placeholder:text-[var(--placeholder)] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--focus-color)]" /></label>`,
|
|
43
52
|
};
|
|
44
53
|
return map[component] ?? `<div class="bg-[var(--surface)] text-[var(--text-primary)] p-4">${component}</div>`;
|
|
45
54
|
}
|
package/dist/tokens.js
CHANGED
|
@@ -1,6 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Serializa magnitudes y valores compuestos DTCG como valores CSS.
|
|
3
|
+
* @param value - Valor del token con sus unidades y componentes.
|
|
4
|
+
* @param type - Tipo efectivo, incluido el heredado del grupo.
|
|
5
|
+
* @returns Valor CSS; los objetos de tipos desconocidos conservan su JSON.
|
|
6
|
+
*/
|
|
7
|
+
function valueToString(value, type) {
|
|
8
|
+
if (Array.isArray(value)) {
|
|
9
|
+
if (type === "cubicBezier")
|
|
10
|
+
return `cubic-bezier(${value.join(", ")})`;
|
|
11
|
+
if (type === "fontFamily")
|
|
12
|
+
return value.map((font) => /^(serif|sans-serif|monospace|system-ui|ui-sans-serif|ui-serif|ui-monospace)$/.test(String(font)) ? font : JSON.stringify(font)).join(", ");
|
|
13
|
+
return value.map((item) => valueToString(item, type)).join(", ");
|
|
14
|
+
}
|
|
15
|
+
if (value && typeof value === "object") {
|
|
16
|
+
const obj = value;
|
|
17
|
+
if ("value" in obj && "unit" in obj)
|
|
18
|
+
return `${obj.value}${obj.unit}`;
|
|
19
|
+
if ("hex" in obj) {
|
|
20
|
+
if (typeof obj.alpha === "number" && obj.alpha < 1 && typeof obj.hex === "string") {
|
|
21
|
+
const hex = obj.hex.replace("#", "");
|
|
22
|
+
const rgb = [0, 2, 4].map((i) => parseInt(hex.slice(i, i + 2), 16));
|
|
23
|
+
return `rgba(${rgb.join(", ")}, ${obj.alpha})`;
|
|
24
|
+
}
|
|
25
|
+
return String(obj.hex);
|
|
26
|
+
}
|
|
27
|
+
if (type === "shadow") {
|
|
28
|
+
const dimensions = ["offsetX", "offsetY", "blur", "spread"].map((key) => valueToString(obj[key], "dimension"));
|
|
29
|
+
return `${obj.inset ? "inset " : ""}${dimensions.join(" ")} ${valueToString(obj.color, "color")}`;
|
|
30
|
+
}
|
|
31
|
+
return JSON.stringify(value);
|
|
4
32
|
}
|
|
5
33
|
return String(value);
|
|
6
34
|
}
|
|
@@ -15,7 +43,7 @@ export function parseDtcgTokens(json) {
|
|
|
15
43
|
if ("$value" in obj) {
|
|
16
44
|
out.push({
|
|
17
45
|
path: path.join("."),
|
|
18
|
-
value: valueToString(obj.$value),
|
|
46
|
+
value: valueToString(obj.$value, type),
|
|
19
47
|
type,
|
|
20
48
|
description: typeof obj.$description === "string" ? obj.$description : undefined,
|
|
21
49
|
});
|
|
@@ -28,7 +56,16 @@ export function parseDtcgTokens(json) {
|
|
|
28
56
|
}
|
|
29
57
|
};
|
|
30
58
|
walk(json, [], "unknown");
|
|
31
|
-
|
|
59
|
+
const index = new Map(out.map((token) => [token.path, token]));
|
|
60
|
+
const resolve = (path, seen = new Set()) => {
|
|
61
|
+
const token = index.get(path);
|
|
62
|
+
if (!token || seen.has(path))
|
|
63
|
+
return `{${path}}`;
|
|
64
|
+
const next = new Set(seen).add(path);
|
|
65
|
+
return token.value.replace(/\{([^{}]+)\}/g, (_, reference) => resolve(reference, next));
|
|
66
|
+
};
|
|
67
|
+
const resolved = out.map((token) => ({ ...token, value: resolve(token.path) }));
|
|
68
|
+
return resolved;
|
|
32
69
|
}
|
|
33
70
|
/** Extrae variables CSS `--nombre: valor;` del bloque :root canónico (ignora overrides de tema). */
|
|
34
71
|
export function parseCssAliases(css) {
|
package/package.json
CHANGED
|
@@ -1,18 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@higinio/design-mcp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "MCP server de los design systems de Higinio (Celeste Clásica, Nocturna Eléctrica, Salvia Serena y Bruma Lavanda).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"author": "Higinio Sosa",
|
|
8
|
-
"repository": {
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/HiginioSosa/Diseno-Higinio.git",
|
|
11
|
+
"directory": "mcp"
|
|
12
|
+
},
|
|
9
13
|
"homepage": "https://github.com/HiginioSosa/Diseno-Higinio#readme",
|
|
10
|
-
"bugs": {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/HiginioSosa/Diseno-Higinio/issues"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"mcp",
|
|
19
|
+
"design-system",
|
|
20
|
+
"design-tokens",
|
|
21
|
+
"celeste-clasica",
|
|
22
|
+
"nocturna-electrica",
|
|
23
|
+
"salvia-serena",
|
|
24
|
+
"bruma-lavanda"
|
|
25
|
+
],
|
|
26
|
+
"bin": {
|
|
27
|
+
"design-mcp": "dist/index.js",
|
|
28
|
+
"design-lint": "dist/cli.js"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist",
|
|
32
|
+
"assets"
|
|
33
|
+
],
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=20"
|
|
39
|
+
},
|
|
16
40
|
"scripts": {
|
|
17
41
|
"sync-assets": "tsx scripts/sync-assets.ts",
|
|
18
42
|
"build": "tsc",
|