@june-ai/june-ui 0.1.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/CHANGELOG.md +22 -0
- package/README.md +66 -44
- package/dist/index.cjs +1089 -16
- package/dist/index.d.cts +250 -5
- package/dist/index.d.ts +250 -5
- package/dist/index.js +1075 -15
- package/dist/june.css +21 -0
- package/package.json +48 -11
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [Unreleased] (planned 0.2.0)
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- `JuneRenderer` and `@june-ai/june-ui/core` entry (no built-in library import).
|
|
7
|
+
- Theme support: `theme` ("light" | "dark" | "system"), `themeVars`, `className`, `style`;
|
|
8
|
+
`@june-ai/june-ui/styles.css`.
|
|
9
|
+
- Error boundary, `onJuneError` structured errors (`JuneError`), fallbacks, `resetKeys`.
|
|
10
|
+
- Streaming: `useJuneStream`, `consumeStream`, `fetchStream`, `sseToText`, abort + unmount cleanup.
|
|
11
|
+
- Actions: `defineJuneAction`, `actions` prop, schema validation, confirmation for sensitive actions.
|
|
12
|
+
- `createJuneLibrary` (validation, allow/deny lists) on top of OpenUI's `createLibrary`.
|
|
13
|
+
- All other OpenUI `Renderer` props are forwarded and typed from the installed OpenUI version.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
- `@openuidev/react-lang` is now a peer dependency (single shared parser); `zod`, `zustand`,
|
|
17
|
+
`@openuidev/react-headless` declared as peers.
|
|
18
|
+
- React peer range widened to `^18.3.1 || ^19.0.0`.
|
|
19
|
+
- `onAction` is typed with OpenUI's event type (handlers typed `(event: unknown) => void` still work).
|
|
20
|
+
|
|
21
|
+
### Compatibility
|
|
22
|
+
- `<JuneUI response isStreaming onAction onError />` from 0.1.0 works unchanged.
|
package/README.md
CHANGED
|
@@ -1,44 +1,66 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
1
|
+
# @june-ai/june-ui
|
|
2
|
+
|
|
3
|
+
React Generative UI SDK built on [OpenUI](https://github.com/thesysdev/openui). June adds streaming
|
|
4
|
+
helpers, themes, safe actions, error recovery, and library validation. OpenUI does all parsing and
|
|
5
|
+
rendering.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @june-ai/june-ui
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Import styles once in your app entry:
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import "@openuidev/react-ui/components.css"; // OpenUI built-in components
|
|
17
|
+
import "@june-ai/june-ui/styles.css"; // June theme variables
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
import { JuneUI } from "@june-ai/june-ui";
|
|
24
|
+
|
|
25
|
+
<JuneUI response={response} isStreaming={isStreaming} theme="system" onJuneError={console.error} />
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Streaming (works with any backend)
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
const stream = useJuneStream();
|
|
32
|
+
stream.startFetch("/api/generate", { method: "POST", body, sse: false }); // sse: true for SSE
|
|
33
|
+
<JuneUI response={stream.response} isStreaming={stream.isStreaming} />
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Custom library
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
import { createJuneLibrary } from "@june-ai/june-ui";
|
|
40
|
+
const library = createJuneLibrary({ root: "Stack", components: [Stack, Card] }); // module scope
|
|
41
|
+
<JuneUI library={library} response={response} />
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Actions
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
const actions = { submit: defineJuneAction({ schema, sensitive: true, handler }) };
|
|
48
|
+
<JuneUI actions={actions} confirmAction={({ name }) => window.confirm(name)} ... />
|
|
49
|
+
```
|
|
50
|
+
Model output never executes code. Only actions you registered by name can run, and sensitive
|
|
51
|
+
actions are denied unless confirmed.
|
|
52
|
+
|
|
53
|
+
### Lightweight entry
|
|
54
|
+
|
|
55
|
+
`@june-ai/june-ui/core` exports `JuneRenderer`, which requires your own `library` and does not
|
|
56
|
+
import OpenUI's built-in component library.
|
|
57
|
+
|
|
58
|
+
## OpenUI features
|
|
59
|
+
|
|
60
|
+
Tool providers, query loaders, state callbacks, and parse-result callbacks are forwarded to
|
|
61
|
+
OpenUI's `Renderer` as props. See OpenUI's docs for their behaviour. Never put API keys in the
|
|
62
|
+
browser; do tool/MCP calls in your backend.
|
|
63
|
+
|
|
64
|
+
## Requirements
|
|
65
|
+
|
|
66
|
+
React 18.3.1+ or 19, plus the OpenUI peer dependencies listed in package.json.
|