@marianmeres/stuic 3.47.4 → 3.48.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/mcp.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import type { McpToolDefinition } from "jsr:@marianmeres/mcp-server/types";
2
+ export declare const tools: McpToolDefinition[];
package/dist/mcp.js ADDED
@@ -0,0 +1,69 @@
1
+ import { z } from "npm:zod";
2
+ import { generateThemeCss } from "./utils/design-tokens.js";
3
+ import { hexToOklch, hexToRgb } from "./utils/colors.js";
4
+ import { generateAvatarColors } from "./utils/avatar-colors.js";
5
+ export const tools = [
6
+ {
7
+ name: "generate-theme-css",
8
+ description: "Generate complete STUIC CSS custom properties from a theme schema. " +
9
+ "Accepts a ThemeSchema JSON with light (required) and dark (optional) TokenSchema objects. " +
10
+ "Each TokenSchema defines intent colors (primary, accent, destructive, warning, success) " +
11
+ "and role colors (background, muted, surface, foreground, border, input, ring). " +
12
+ "Auto-derives hover/active states from Tailwind shade scales and generates surface tints.",
13
+ params: {
14
+ schema: z
15
+ .string()
16
+ .describe("ThemeSchema as JSON string. Structure: " +
17
+ '{ "light": { "colors": { "intent": { "primary": { "DEFAULT": "var(--color-stone-800)", "foreground": "var(--color-white)" }, ... }, ' +
18
+ '"role": { "paired": { "background": { "DEFAULT": "...", "foreground": "..." }, ... }, ' +
19
+ '"single": { "foreground": "...", "border": "...", "input": "...", "ring": "..." } } } }, "dark": { ... } }'),
20
+ prefix: z
21
+ .string()
22
+ .default("stuic-")
23
+ .describe("CSS variable prefix (default: 'stuic-')"),
24
+ },
25
+ handler: async ({ schema, prefix }) => {
26
+ const parsed = JSON.parse(schema);
27
+ return generateThemeCss(parsed, prefix);
28
+ },
29
+ },
30
+ {
31
+ name: "hex-to-oklch",
32
+ description: "Convert a CSS HEX color to oklch() format. Useful for perceptually uniform color manipulation in modern CSS.",
33
+ params: {
34
+ hex: z
35
+ .string()
36
+ .describe('HEX color string, e.g. "#ff0000", "ff0000", "#f00"'),
37
+ },
38
+ handler: async ({ hex }) => {
39
+ return hexToOklch(hex);
40
+ },
41
+ },
42
+ {
43
+ name: "hex-to-rgb",
44
+ description: "Convert a CSS HEX color to RGB components. Returns JSON with r, g, b values (0-255).",
45
+ params: {
46
+ hex: z
47
+ .string()
48
+ .describe('HEX color string, e.g. "#ff0000", "ff0000", "#f00"'),
49
+ },
50
+ handler: async ({ hex }) => {
51
+ const rgb = hexToRgb(hex);
52
+ if (!rgb)
53
+ return "Error: Invalid HEX color format";
54
+ return JSON.stringify(rgb);
55
+ },
56
+ },
57
+ {
58
+ name: "generate-avatar-colors",
59
+ description: "Generate deterministic pastel background and contrasting text colors from any string identifier (user ID, email, name). Same input always produces the same harmonious color pair.",
60
+ params: {
61
+ source: z
62
+ .string()
63
+ .describe("String identifier to generate colors from (e.g. email, user ID)"),
64
+ },
65
+ handler: async ({ source }) => {
66
+ return JSON.stringify(generateAvatarColors(source));
67
+ },
68
+ },
69
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marianmeres/stuic",
3
- "version": "3.47.4",
3
+ "version": "3.48.0",
4
4
  "files": [
5
5
  "dist",
6
6
  "!dist/**/*.test.*",
@@ -56,7 +56,7 @@
56
56
  "prettier": "^3.8.1",
57
57
  "prettier-plugin-svelte": "^3.5.1",
58
58
  "publint": "^0.3.18",
59
- "svelte": "^5.53.11",
59
+ "svelte": "^5.53.12",
60
60
  "svelte-check": "^4.4.5",
61
61
  "tailwindcss": "^4.2.1",
62
62
  "tsx": "^4.21.0",