@pixpilot/formily-shadcn 1.14.1 → 1.14.3

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.
@@ -1,11 +1,11 @@
1
- import * as react1883 from "react";
2
- import * as _pixpilot_shadcn_ui289 from "@pixpilot/shadcn-ui";
1
+ import * as react1885 from "react";
2
+ import * as _pixpilot_shadcn_ui290 from "@pixpilot/shadcn-ui";
3
3
 
4
4
  //#region src/components/slider/Slider.d.ts
5
5
  /**
6
6
  * Formily-connected Slider component
7
7
  * Range input for selecting numeric values
8
8
  */
9
- declare const Slider$1: react1883.ForwardRefExoticComponent<Omit<Partial<_pixpilot_shadcn_ui289.SliderProps>, "ref"> & react1883.RefAttributes<unknown>>;
9
+ declare const Slider$1: react1885.ForwardRefExoticComponent<Omit<Partial<_pixpilot_shadcn_ui290.SliderProps>, "ref"> & react1885.RefAttributes<unknown>>;
10
10
  //#endregion
11
11
  export { Slider$1 as Slider };
@@ -1,7 +1,7 @@
1
- import * as react1885 from "react";
2
- import * as _pixpilot_shadcn_ui290 from "@pixpilot/shadcn-ui";
1
+ import * as react1887 from "react";
2
+ import * as _pixpilot_shadcn_ui291 from "@pixpilot/shadcn-ui";
3
3
 
4
4
  //#region src/components/slider/SliderInput.d.ts
5
- declare const SliderInput$1: react1885.ForwardRefExoticComponent<Omit<Partial<_pixpilot_shadcn_ui290.SliderInputProps>, "ref"> & react1885.RefAttributes<unknown>>;
5
+ declare const SliderInput$1: react1887.ForwardRefExoticComponent<Omit<Partial<_pixpilot_shadcn_ui291.SliderInputProps>, "ref"> & react1887.RefAttributes<unknown>>;
6
6
  //#endregion
7
7
  export { SliderInput$1 as SliderInput };
@@ -1,11 +1,11 @@
1
- import * as react1883 from "react";
2
- import * as _pixpilot_shadcn_ui289 from "@pixpilot/shadcn-ui";
1
+ import * as react1399 from "react";
2
+ import * as _pixpilot_shadcn_ui256 from "@pixpilot/shadcn-ui";
3
3
 
4
4
  //#region src/components/slider/SliderSelect.d.ts
5
5
  /**
6
6
  * Formily-connected SliderSelect component
7
7
  * Discrete slider that maps between provided options
8
8
  */
9
- declare const SliderSelect: react1883.ForwardRefExoticComponent<Omit<Partial<_pixpilot_shadcn_ui289.SliderSelectProps>, "ref"> & react1883.RefAttributes<unknown>>;
9
+ declare const SliderSelect: react1399.ForwardRefExoticComponent<Omit<Partial<_pixpilot_shadcn_ui256.SliderSelectProps>, "ref"> & react1399.RefAttributes<unknown>>;
10
10
  //#endregion
11
11
  export { SliderSelect };
@@ -1,11 +1,11 @@
1
- import * as react1887 from "react";
2
- import * as _pixpilot_shadcn_ui291 from "@pixpilot/shadcn-ui";
1
+ import * as react1883 from "react";
2
+ import * as _pixpilot_shadcn_ui289 from "@pixpilot/shadcn-ui";
3
3
 
4
4
  //#region src/components/slider/SliderSelect.d.ts
5
5
  /**
6
6
  * Formily-connected SliderSelect component
7
7
  * Discrete slider that maps between provided options
8
8
  */
9
- declare const SliderSelect$1: react1887.ForwardRefExoticComponent<Omit<Partial<_pixpilot_shadcn_ui291.SliderSelectProps>, "ref"> & react1887.RefAttributes<unknown>>;
9
+ declare const SliderSelect$1: react1883.ForwardRefExoticComponent<Omit<Partial<_pixpilot_shadcn_ui289.SliderSelectProps>, "ref"> & react1883.RefAttributes<unknown>>;
10
10
  //#endregion
11
11
  export { SliderSelect$1 as SliderSelect };
@@ -0,0 +1,15 @@
1
+ import { meta } from "../components/form/mcp.js";
2
+
3
+ //#region src/generated/mcp-registry.ts
4
+ function withHtmlElementNote(comp) {
5
+ const htmlNote = comp.htmlElement != null && comp.htmlElement.length > 0 ? `Also supports all standard props of a native <${comp.htmlElement}> element (onClick, disabled, className, style, type, aria-*, data-*, etc.).` : "";
6
+ return {
7
+ ...comp,
8
+ notes: htmlNote.length > 0 ? [...comp.notes ?? [], htmlNote] : [...comp.notes ?? []]
9
+ };
10
+ }
11
+ /** Generated component metadata map keyed by public component name. */
12
+ const mcpRegistry = { "Form": withHtmlElementNote(meta) };
13
+
14
+ //#endregion
15
+ export { mcpRegistry };
@@ -0,0 +1,67 @@
1
+ import process from "node:process";
2
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
+ import { z } from "zod/v4";
5
+
6
+ //#region ../mcp/src/server.ts
7
+ const JSON_INDENT = 2;
8
+ function jsonToolResult(data) {
9
+ return {
10
+ content: [{
11
+ type: "text",
12
+ text: JSON.stringify(data, null, JSON_INDENT)
13
+ }],
14
+ structuredContent: data
15
+ };
16
+ }
17
+ function getComponentByName(registry, name) {
18
+ if (!Object.hasOwn(registry, name)) return;
19
+ return registry[name];
20
+ }
21
+ /** Creates an MCP server with generic component listing and detail tools. */
22
+ function createComponentMcpServer({ packageName, packageVersion, registry }) {
23
+ const components = Object.values(registry);
24
+ const server = new McpServer({
25
+ name: packageName,
26
+ version: packageVersion
27
+ });
28
+ server.registerTool("list_components", {
29
+ title: "List components",
30
+ description: `List registered ${packageName} components.`
31
+ }, async () => jsonToolResult({ components: components.map(({ name, category, description }) => ({
32
+ name,
33
+ category,
34
+ description
35
+ })) }));
36
+ server.registerTool("get_component_details", {
37
+ title: "Get component details",
38
+ description: `Get the full MCP metadata object for a registered ${packageName} component.`,
39
+ inputSchema: { name: z.string().min(1) }
40
+ }, async ({ name }) => {
41
+ const component = getComponentByName(registry, name);
42
+ if (!component) return {
43
+ content: [{
44
+ type: "text",
45
+ text: `Component "${name}" is not registered.`
46
+ }],
47
+ isError: true
48
+ };
49
+ return jsonToolResult({ component });
50
+ });
51
+ return server;
52
+ }
53
+ /** Starts the generic component MCP server over stdio for package bin entrypoints. */
54
+ async function startComponentMcpServer(options) {
55
+ try {
56
+ const server = createComponentMcpServer(options);
57
+ const transport = new StdioServerTransport();
58
+ await server.connect(transport);
59
+ } catch (error) {
60
+ const message = error instanceof Error ? error.message : String(error);
61
+ console.error(`Failed to start ${options.packageName} MCP server: ${message}`);
62
+ process.exit(1);
63
+ }
64
+ }
65
+
66
+ //#endregion
67
+ export { startComponentMcpServer };
@@ -0,0 +1,8 @@
1
+ //#region ../mcp/src/utils.ts
2
+ /** Preserves exact prop keys while validating a component's prop metadata shape. */
3
+ function defineProps(props) {
4
+ return props;
5
+ }
6
+
7
+ //#endregion
8
+ export { defineProps };
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env node
2
+ import { startComponentMcpServer } from "./mcp/src/server.js";
3
+ import { mcpRegistry } from "./generated/mcp-registry.js";
4
+ import process from "node:process";
5
+
6
+ //#region src/mcp-server.ts
7
+ startComponentMcpServer({
8
+ packageName: "@pixpilot/formily-shadcn",
9
+ packageVersion: "1.14.2",
10
+ registry: mcpRegistry
11
+ }).catch((error) => {
12
+ const message = error instanceof Error ? error.message : String(error);
13
+ process.stderr.write(`Failed to start @pixpilot/formily-shadcn MCP server: ${message}\n`);
14
+ process.exit(1);
15
+ });
16
+
17
+ //#endregion
18
+ export { };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pixpilot/formily-shadcn",
3
3
  "type": "module",
4
- "version": "1.14.1",
4
+ "version": "1.14.3",
5
5
  "description": "Formily integration for shadcn/ui components",
6
6
  "author": "m.doaie <m.doaie@hotmail.com>",
7
7
  "license": "MIT",
@@ -17,6 +17,9 @@
17
17
  "require": "./dist/index.cjs"
18
18
  }
19
19
  },
20
+ "bin": {
21
+ "formily-shadcn-mcp": "./dist/mcp-server.js"
22
+ },
20
23
  "files": [
21
24
  "dist"
22
25
  ],
@@ -39,13 +42,15 @@
39
42
  "@iconify-json/fa": "^1.2.2",
40
43
  "@iconify-json/mdi": "^1.2.3",
41
44
  "@iconify/react": "^6.0.2",
45
+ "@modelcontextprotocol/sdk": "^1.29.0",
42
46
  "@pixpilot/env": "^0.2.3",
43
47
  "@pixpilot/string": "^3.0.0",
44
48
  "json-schema-traverse": "^1.0.0",
45
49
  "lucide-react": "^0.562.0",
46
50
  "pretty-bytes": "^7.1.0",
47
- "@pixpilot/shadcn": "1.3.1",
48
- "@pixpilot/shadcn-ui": "1.36.0"
51
+ "zod": "^4.3.6",
52
+ "@pixpilot/shadcn": "1.4.0",
53
+ "@pixpilot/shadcn-ui": "1.38.0"
49
54
  },
50
55
  "devDependencies": {
51
56
  "@storybook/react": "^8.6.18",
@@ -57,9 +62,11 @@
57
62
  "react": "19.2.0",
58
63
  "react-dom": "19.2.0",
59
64
  "tsdown": "^0.15.12",
65
+ "tsx": "^4.21.0",
60
66
  "typescript": "^5.9.3",
61
- "@internal/prettier-config": "0.0.1",
62
67
  "@internal/eslint-config": "0.3.0",
68
+ "@internal/mcp": "0.0.0",
69
+ "@internal/prettier-config": "0.0.1",
63
70
  "@internal/tsconfig": "0.1.0",
64
71
  "@internal/tsdown-config": "0.1.0",
65
72
  "@internal/vitest-config": "0.1.0"
@@ -68,8 +75,9 @@
68
75
  "scripts": {
69
76
  "clean": "git clean -xdf .cache .turbo dist",
70
77
  "clean:all": "git clean -xdf .cache .turbo dist node_modules",
71
- "build": "tsdown",
78
+ "build": "pnpm run mcp:registry && tsdown",
72
79
  "build:watch": "tsdown --watch",
80
+ "mcp:registry": "tsx ../mcp/src/generate-mcp-registry-cli.ts",
73
81
  "test": "vitest --run --passWithNoTests",
74
82
  "test:watch": "vitest --watch",
75
83
  "test:ui": "vitest --ui",