@mcp-native/react-native 0.0.1 → 0.0.2

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 CHANGED
@@ -1,5 +1,3 @@
1
1
  # @mcp-native/react-native
2
2
 
3
- Part of MCP Native a native UI runtime for Model Context Protocol applications.
4
-
5
- Early development.
3
+ Host-owned React Native rendering primitives for MCP Native.
@@ -0,0 +1,14 @@
1
+ import type { A2uiSurface } from "@mcp-native/a2ui";
2
+ export type NativeComponentName = "Button" | "Text" | "TextInput" | "View";
3
+ /**
4
+ * A serializable render plan. A React Native host maps these trusted component
5
+ * names to locally bundled components; the MCP server never supplies code.
6
+ */
7
+ export interface NativeElement {
8
+ readonly key: string;
9
+ readonly component: NativeComponentName;
10
+ readonly props: Readonly<Record<string, unknown>>;
11
+ readonly children?: readonly NativeElement[];
12
+ }
13
+ export declare function createNativeRenderPlan(surface: A2uiSurface): NativeElement;
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE9D,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;AAE3E;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,SAAS,EAAE,mBAAmB,CAAC;IACxC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAClD,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;CAC9C;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,WAAW,GAAG,aAAa,CAE1E"}
package/dist/index.js ADDED
@@ -0,0 +1,37 @@
1
+ export function createNativeRenderPlan(surface) {
2
+ return renderNode(surface.root);
3
+ }
4
+ function renderNode(node) {
5
+ switch (node.type) {
6
+ case "container":
7
+ return {
8
+ key: node.id,
9
+ component: "View",
10
+ props: {},
11
+ children: node.children.map(renderNode),
12
+ };
13
+ case "text":
14
+ return {
15
+ key: node.id,
16
+ component: "Text",
17
+ props: { children: node.text },
18
+ };
19
+ case "button":
20
+ return {
21
+ key: node.id,
22
+ component: "Button",
23
+ props: { title: node.label, action: node.action },
24
+ };
25
+ case "text-input":
26
+ return {
27
+ key: node.id,
28
+ component: "TextInput",
29
+ props: {
30
+ label: node.label,
31
+ ...(node.value === undefined ? {} : { value: node.value }),
32
+ ...(node.binding === undefined ? {} : { binding: node.binding }),
33
+ },
34
+ };
35
+ }
36
+ }
37
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,MAAM,UAAU,sBAAsB,CAAC,OAAoB;IACzD,OAAO,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC;AAED,SAAS,UAAU,CAAC,IAAc;IAChC,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,KAAK,WAAW;YACd,OAAO;gBACL,GAAG,EAAE,IAAI,CAAC,EAAE;gBACZ,SAAS,EAAE,MAAM;gBACjB,KAAK,EAAE,EAAE;gBACT,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC;aACxC,CAAC;QACJ,KAAK,MAAM;YACT,OAAO;gBACL,GAAG,EAAE,IAAI,CAAC,EAAE;gBACZ,SAAS,EAAE,MAAM;gBACjB,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,EAAE;aAC/B,CAAC;QACJ,KAAK,QAAQ;YACX,OAAO;gBACL,GAAG,EAAE,IAAI,CAAC,EAAE;gBACZ,SAAS,EAAE,QAAQ;gBACnB,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE;aAClD,CAAC;QACJ,KAAK,YAAY;YACf,OAAO;gBACL,GAAG,EAAE,IAAI,CAAC,EAAE;gBACZ,SAAS,EAAE,WAAW;gBACtB,KAAK,EAAE;oBACL,KAAK,EAAE,IAAI,CAAC,KAAK;oBACjB,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;oBAC1D,GAAG,CAAC,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;iBACjE;aACF,CAAC;IACN,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,12 +1,32 @@
1
1
  {
2
2
  "name": "@mcp-native/react-native",
3
- "version": "0.0.1",
4
- "main": "index.js",
5
- "scripts": {
6
- "test": "echo \"Error: no test specified\" && exit 1"
7
- },
8
- "keywords": [],
9
- "author": "",
3
+ "version": "0.0.2",
4
+ "description": "React Native renderer primitives for MCP Native.",
10
5
  "license": "MIT",
11
- "description": "MCP Native - react-native package"
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/pablospaniard/mcp-native.git",
9
+ "directory": "packages/react-native"
10
+ },
11
+ "files": [
12
+ "dist",
13
+ "README.md"
14
+ ],
15
+ "type": "module",
16
+ "sideEffects": false,
17
+ "main": "./dist/index.js",
18
+ "types": "./dist/index.d.ts",
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "import": "./dist/index.js"
23
+ }
24
+ },
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "dependencies": {
29
+ "@mcp-native/a2ui": "^0.0.2",
30
+ "@mcp-native/core": "^0.0.2"
31
+ }
12
32
  }
package/index.js DELETED
@@ -1 +0,0 @@
1
- module.exports = {};