@emseepea/react 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/README.md +4 -32
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -16,38 +16,10 @@ import { ElicitationForm } from "@emseepea/react";
|
|
|
16
16
|
See the [React UI server example](../../examples/react-ui-server/README.md)
|
|
17
17
|
for the checked renderer in a working server.
|
|
18
18
|
|
|
19
|
-
## Render
|
|
19
|
+
## Render a result in a Model Context Protocol App
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
```tsx
|
|
26
|
-
import { ResultCard, useMcpApp, useMcpTheme } from "@emseepea/react";
|
|
27
|
-
import { useEffect } from "react";
|
|
28
|
-
|
|
29
|
-
const app = useMcpApp({ name: "Result", version: "1.0.0", parseResult });
|
|
30
|
-
<ResultCard view={toResultView(app.result)} headingLevel={2} />;
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
`useMcpApp` implements the standards-first MCP Apps initialization, host-context,
|
|
34
|
-
tool-result, cancellation, teardown, and `ui/message` lifecycle. Keep domain
|
|
35
|
-
result parsing and mapping in the adopter, and treat host messages as untrusted.
|
|
36
|
-
|
|
37
|
-
Use `useMcpTheme` when the app also runs outside an MCP host. A host theme wins;
|
|
38
|
-
otherwise the hook follows the browser colour scheme. The hook returns the value
|
|
39
|
-
without applying styles, attributes, or classes.
|
|
40
|
-
|
|
41
|
-
```tsx
|
|
42
|
-
const theme = useMcpTheme(app.hostContext.theme);
|
|
43
|
-
|
|
44
|
-
useEffect(() => {
|
|
45
|
-
document.documentElement.dataset.emseepeaTheme = theme;
|
|
46
|
-
}, [theme]);
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
For a self-contained resource that does not already use React, see the measured
|
|
50
|
-
[React and Svelte bundle guidance](../framework/README.md#choose-a-result-card-package).
|
|
51
|
-
When React is already present, this package avoids adding a second framework.
|
|
21
|
+
Follow [Render an accessible result card](https://emseepea.github.io/emseepea/result-cards/)
|
|
22
|
+
for the checked model, React renderer, Model Context Protocol Apps (MCP Apps)
|
|
23
|
+
lifecycle, and framework choice.
|
|
52
24
|
|
|
53
25
|
This package is open source under MIT and remains pre-alpha while its version is below 1.0.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@emseepea/react",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"test:built": "node --test test/*.test.mjs"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@emseepea/server": "0.11.
|
|
33
|
+
"@emseepea/server": "0.11.1"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"react": "^19.0.0",
|