mirror of
https://github.com/vercel-labs/json-render.git
synced 2026-10-02 12:00:58 +08:00
Compare commits
64
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
22f33fc1be | ||
|
|
f70a3e7734 | ||
|
|
8f11d980db | ||
|
|
1b39312de2 | ||
|
|
73f63f6210 | ||
|
|
362a307e10 | ||
|
|
9cf6069320 | ||
|
|
9bf70b2678 | ||
|
|
8110cd5490 | ||
|
|
923b7b6c3d | ||
|
|
b7139e385c | ||
|
|
3e47b054d1 | ||
|
|
6ca51f3293 | ||
|
|
fc454d4873 | ||
|
|
1d331c9de2 | ||
|
|
19c7452431 | ||
|
|
d3fb42f218 | ||
|
|
dcc147654f | ||
|
|
d99c378fae | ||
|
|
f48b2a0d05 | ||
|
|
39468c18e5 | ||
|
|
74d98e6172 | ||
|
|
3cfae9ea0e | ||
|
|
334ffa92c7 | ||
|
|
a27ab8d327 | ||
|
|
406da8a701 | ||
|
|
ea53a3b116 | ||
|
|
3b2b6e5b19 | ||
|
|
5620462f0c | ||
|
|
f973f0576a | ||
|
|
a9ef2831ce | ||
|
|
e0277c631f | ||
|
|
f6a7522754 | ||
|
|
ec1ad33687 | ||
|
|
0a2cfcbf32 | ||
|
|
fd83ec189c | ||
|
|
55710d9717 | ||
|
|
4e17f4aa35 | ||
|
|
048eb5e412 | ||
|
|
08f50fbd52 | ||
|
|
b9edf0f537 | ||
|
|
c761b2b0ba | ||
|
|
f61afe3287 | ||
|
|
b1cc53ff5c | ||
|
|
2f210af7dc | ||
|
|
0143297b6d | ||
|
|
926299a2f1 | ||
|
|
b42e740063 | ||
|
|
fd02356a5e | ||
|
|
1c140e6ac2 | ||
|
|
2f34bf2372 | ||
|
|
8d7f740854 | ||
|
|
023b01dfc2 | ||
|
|
dc81cabec5 | ||
|
|
b9f3f29729 | ||
|
|
3214d95520 | ||
|
|
2fbdbbbf14 | ||
|
|
a73267265e | ||
|
|
2b7a0fa686 | ||
|
|
26f84b15c7 | ||
|
|
651054aa5d | ||
|
|
81704f2b33 | ||
|
|
cd0098cbfd | ||
|
|
c0e8d8a390 |
@@ -4,146 +4,6 @@ export const metadata = { title: "Changelog" }
|
||||
|
||||
Notable changes and updates to json-render.
|
||||
|
||||
## v0.6.0
|
||||
|
||||
February 2026
|
||||
|
||||
### New: Chat Mode (Inline GenUI)
|
||||
|
||||
json-render now supports two generation modes: **Generate** (JSONL-only, the default) and **Chat** (text + JSONL inline). Chat mode lets the AI respond conversationally with embedded UI specs, ideal for chatbots and copilot experiences.
|
||||
|
||||
```typescript
|
||||
// Generate mode (default) — AI outputs only JSONL
|
||||
const prompt = catalog.prompt();
|
||||
|
||||
// Chat mode — AI outputs text + JSONL inline
|
||||
const chatPrompt = catalog.prompt({ mode: "chat" });
|
||||
```
|
||||
|
||||
On the server, `pipeJsonRender()` separates text from JSONL patches in a mixed stream:
|
||||
|
||||
```typescript
|
||||
import { pipeJsonRender } from "@json-render/core";
|
||||
import { createUIMessageStream, createUIMessageStreamResponse } from "ai";
|
||||
|
||||
const stream = createUIMessageStream({
|
||||
execute: async ({ writer }) => {
|
||||
writer.merge(pipeJsonRender(result.toUIMessageStream()));
|
||||
},
|
||||
});
|
||||
return createUIMessageStreamResponse({ stream });
|
||||
```
|
||||
|
||||
On the client, `useJsonRenderMessage` extracts the spec and text from message parts:
|
||||
|
||||
```tsx
|
||||
import { useJsonRenderMessage } from "@json-render/react";
|
||||
|
||||
function ChatMessage({ message }) {
|
||||
const { spec, text, hasSpec } = useJsonRenderMessage(message.parts);
|
||||
return (
|
||||
<div>
|
||||
{text && <Markdown>{text}</Markdown>}
|
||||
{hasSpec && <Renderer spec={spec} registry={registry} />}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
### New: AI SDK Integration
|
||||
|
||||
First-class Vercel AI SDK support with typed data parts and stream utilities.
|
||||
|
||||
- `SpecDataPart` type for `data-spec` stream parts (patch, flat, nested payloads)
|
||||
- `SPEC_DATA_PART` / `SPEC_DATA_PART_TYPE` constants for type-safe part filtering
|
||||
- `createJsonRenderTransform()` low-level TransformStream for custom pipelines
|
||||
- `createMixedStreamParser()` for parsing mixed text + JSONL streams
|
||||
|
||||
### New: Two-Way Binding
|
||||
|
||||
Props can now use `$bindState` and `$bindItem` expressions for two-way data binding. The renderer resolves bindings and passes a `bindings` map to components, enabling write-back to state without custom `valuePath` props.
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "Input",
|
||||
"props": { "label": "Email", "value": { "$bindState": "/form/email" } }
|
||||
}
|
||||
```
|
||||
|
||||
```tsx
|
||||
import { useBoundProp } from "@json-render/react";
|
||||
|
||||
Input: ({ props, bindings }) => {
|
||||
const [value, setValue] = useBoundProp<string>(props.value, bindings?.value);
|
||||
return <input value={value ?? ""} onChange={(e) => setValue(e.target.value)} />;
|
||||
}
|
||||
```
|
||||
|
||||
### New: Expression-Based Props and Visibility
|
||||
|
||||
All dynamic expressions now use structured `$state`, `$item`, and `$index` objects instead of string token rewriting. This is simpler, more explicit, and works for both props and visibility conditions.
|
||||
|
||||
**Props:**
|
||||
|
||||
```json
|
||||
{ "title": { "$state": "/user/name" } }
|
||||
{ "label": { "$item": "title" } }
|
||||
{ "position": { "$index": true } }
|
||||
```
|
||||
|
||||
**Visibility:**
|
||||
|
||||
```json
|
||||
{ "$state": "/isAdmin" }
|
||||
{ "$state": "/role", "eq": "admin" }
|
||||
[{ "$state": "/isAdmin" }, { "$state": "/feature" }]
|
||||
{ "$or": [{ "$state": "/roleA" }, { "$state": "/roleB" }] }
|
||||
{ "$item": "isActive" }
|
||||
{ "$index": true, "gt": 0 }
|
||||
```
|
||||
|
||||
Comparison operators: `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `not`.
|
||||
|
||||
### New: React Chat Hooks
|
||||
|
||||
- `useChatUI()` — full chat hook with message history, streaming, and spec extraction
|
||||
- `useJsonRenderMessage()` — extract spec + text from a message's parts array
|
||||
- `buildSpecFromParts()` / `getTextFromParts()` — utilities for working with AI SDK message parts
|
||||
- `useBoundProp()` — two-way binding hook for `$bindState` / `$bindItem`
|
||||
|
||||
### New: Chat Example
|
||||
|
||||
Full-featured chat example (`examples/chat`) with AI agent, tool calls (crypto, GitHub, Hacker News, weather, search), theme toggle, and streaming inline UI generation.
|
||||
|
||||
### Improved: Renderer Performance
|
||||
|
||||
- `ElementRenderer` is now `React.memo`'d for better performance with repeat lists
|
||||
- `emit` is always defined (never `undefined`)
|
||||
- Repeat scope passes the actual item object, eliminating string token rewriting
|
||||
|
||||
### Improved: Utilities
|
||||
|
||||
- `applySpecPatch()` — typed wrapper for applying a single patch to a Spec
|
||||
- `nestedToFlat()` — convert nested tree specs to flat format
|
||||
- `resolveBindings()` / `resolveActionParam()` — resolve binding paths and action params
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
- `{ $path }` and `{ path }` replaced by `{ $state }`, `{ $item }`, `{ $index }` in props
|
||||
- Visibility: `{ path }` -> `{ $state }`, `{ and/or/not }` -> `{ $and/$or }` with `not` as operator flag
|
||||
- `DynamicValue`: `{ path: string }` -> `{ $state: string }`
|
||||
- `repeat.path` -> `repeat.statePath`
|
||||
- Action params: `path` -> `statePath` in setState action
|
||||
- `actionHandlers` -> `handlers` on `JSONUIProvider` / `ActionProvider`
|
||||
- `AuthState` and `{ auth }` visibility conditions removed (model auth as regular state)
|
||||
- Legacy catalog API removed: `createCatalog`, `generateCatalogPrompt`, `generateSystemPrompt`
|
||||
- React exports removed: `createRendererFromCatalog`, `rewriteRepeatTokens`
|
||||
- Codegen: `traverseTree` -> `traverseSpec`
|
||||
|
||||
See the [Migration Guide](/docs/migration) for detailed upgrade instructions.
|
||||
|
||||
---
|
||||
|
||||
## v0.5.0
|
||||
|
||||
February 2026
|
||||
|
||||
@@ -2,7 +2,7 @@ export const metadata = { title: "Migration Guide" }
|
||||
|
||||
# Migration Guide
|
||||
|
||||
This guide covers breaking changes introduced in v0.6.0 and how to update your code.
|
||||
This guide covers breaking changes introduced in v0.5.0 and how to update your code.
|
||||
|
||||
## State Provider
|
||||
|
||||
|
||||
@@ -1,75 +1,5 @@
|
||||
# @json-render/codegen
|
||||
|
||||
## 0.6.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 06b8745: Chat mode (inline GenUI), AI SDK integration, two-way binding, and expression-based visibility/props.
|
||||
|
||||
### New: Chat Mode (Inline GenUI)
|
||||
|
||||
Two generation modes: **Generate** (JSONL-only, the default) and **Chat** (text + JSONL inline). Chat mode lets AI respond conversationally with embedded UI specs — ideal for chatbots and copilot experiences.
|
||||
- `catalog.prompt({ mode: "chat" })` generates a chat-aware system prompt
|
||||
- `pipeJsonRender()` server-side transform separates text from JSONL patches in a mixed stream
|
||||
- `createJsonRenderTransform()` low-level TransformStream for custom pipelines
|
||||
|
||||
### New: AI SDK Integration
|
||||
|
||||
First-class Vercel AI SDK support with typed data parts and stream utilities.
|
||||
- `SpecDataPart` type for `data-spec` stream parts (patch, flat, nested payloads)
|
||||
- `SPEC_DATA_PART` / `SPEC_DATA_PART_TYPE` constants for type-safe part filtering
|
||||
- `createMixedStreamParser()` for parsing mixed text + JSONL streams
|
||||
|
||||
### New: React Chat Hooks
|
||||
- `useChatUI()` — full chat hook with message history, streaming, and spec extraction
|
||||
- `useJsonRenderMessage()` — extract spec + text from a message's parts array
|
||||
- `buildSpecFromParts()` / `getTextFromParts()` — utilities for working with AI SDK message parts
|
||||
- `useBoundProp()` — two-way binding hook for `$bindState` / `$bindItem` expressions
|
||||
|
||||
### New: Two-Way Binding
|
||||
|
||||
Props can now use `$bindState` and `$bindItem` expressions for two-way data binding. The renderer resolves bindings and passes a `bindings` map to components, enabling write-back to state.
|
||||
|
||||
### New: Expression-Based Props and Visibility
|
||||
|
||||
Replaced string token rewriting with structured expression objects:
|
||||
- Props: `{ $state: "/path" }`, `{ $item: "field" }`, `{ $index: true }`
|
||||
- Visibility: `{ $state: "/path", eq: "value" }`, `{ $item: "active" }`, `{ $index: true, gt: 0 }`
|
||||
- Logic: `{ $and: [...] }`, `{ $or: [...] }`, and implicit AND via arrays
|
||||
- Comparison operators: `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `not`
|
||||
|
||||
### New: Utilities
|
||||
- `applySpecPatch()` — typed convenience wrapper for applying a single patch to a Spec
|
||||
- `nestedToFlat()` — convert nested tree specs to flat `{ root, elements }` format
|
||||
- `resolveBindings()` / `resolveActionParam()` — resolve binding paths and action params
|
||||
|
||||
### New: Chat Example
|
||||
|
||||
Full-featured chat example (`examples/chat`) with AI agent, tool calls (crypto, GitHub, Hacker News, weather, search), theme toggle, and streaming UI generation.
|
||||
|
||||
### Improved: Renderer
|
||||
- `ElementRenderer` is now `React.memo`'d for better performance in repeat lists
|
||||
- `emit` is always defined (never `undefined`) — no more optional chaining needed
|
||||
- Action params are resolved through `resolveActionParam` supporting `$item`, `$index`, `$state`
|
||||
- Repeat scope now passes the actual item object instead of requiring token rewriting
|
||||
|
||||
### Breaking Changes
|
||||
- **Expressions renamed**: `{ $path }` / `{ path }` replaced by `{ $state }`, `{ $item }`, `{ $index }`
|
||||
- **Visibility conditions**: `{ path }` → `{ $state }`, `{ and/or/not }` → `{ $and/$or }` with `not` as operator flag
|
||||
- **DynamicValue**: `{ path: string }` → `{ $state: string }`
|
||||
- **Repeat field**: `repeat.path` → `repeat.statePath`
|
||||
- **Action params**: `path` → `statePath` in setState action params
|
||||
- **Provider props**: `actionHandlers` → `handlers` on `JSONUIProvider`/`ActionProvider`
|
||||
- **Auth removed**: `AuthState` type and `{ auth }` visibility conditions removed — model auth as regular state
|
||||
- **Legacy catalog removed**: `createCatalog`, `generateCatalogPrompt`, `generateSystemPrompt`, `ComponentDefinition`, `CatalogConfig`, `SystemPromptOptions` removed
|
||||
- **React exports removed**: `createRendererFromCatalog`, `rewriteRepeatTokens`
|
||||
- **Codegen**: `traverseTree` → `traverseSpec`, `SpecVisitor` → `TreeVisitor`
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [06b8745]
|
||||
- @json-render/core@0.6.0
|
||||
|
||||
## 0.5.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@json-render/codegen",
|
||||
"version": "0.6.0",
|
||||
"version": "0.5.2",
|
||||
"license": "Apache-2.0",
|
||||
"description": "Utilities for generating code from json-render UI trees",
|
||||
"keywords": [
|
||||
|
||||
@@ -1,70 +1,5 @@
|
||||
# @json-render/core
|
||||
|
||||
## 0.6.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 06b8745: Chat mode (inline GenUI), AI SDK integration, two-way binding, and expression-based visibility/props.
|
||||
|
||||
### New: Chat Mode (Inline GenUI)
|
||||
|
||||
Two generation modes: **Generate** (JSONL-only, the default) and **Chat** (text + JSONL inline). Chat mode lets AI respond conversationally with embedded UI specs — ideal for chatbots and copilot experiences.
|
||||
- `catalog.prompt({ mode: "chat" })` generates a chat-aware system prompt
|
||||
- `pipeJsonRender()` server-side transform separates text from JSONL patches in a mixed stream
|
||||
- `createJsonRenderTransform()` low-level TransformStream for custom pipelines
|
||||
|
||||
### New: AI SDK Integration
|
||||
|
||||
First-class Vercel AI SDK support with typed data parts and stream utilities.
|
||||
- `SpecDataPart` type for `data-spec` stream parts (patch, flat, nested payloads)
|
||||
- `SPEC_DATA_PART` / `SPEC_DATA_PART_TYPE` constants for type-safe part filtering
|
||||
- `createMixedStreamParser()` for parsing mixed text + JSONL streams
|
||||
|
||||
### New: React Chat Hooks
|
||||
- `useChatUI()` — full chat hook with message history, streaming, and spec extraction
|
||||
- `useJsonRenderMessage()` — extract spec + text from a message's parts array
|
||||
- `buildSpecFromParts()` / `getTextFromParts()` — utilities for working with AI SDK message parts
|
||||
- `useBoundProp()` — two-way binding hook for `$bindState` / `$bindItem` expressions
|
||||
|
||||
### New: Two-Way Binding
|
||||
|
||||
Props can now use `$bindState` and `$bindItem` expressions for two-way data binding. The renderer resolves bindings and passes a `bindings` map to components, enabling write-back to state.
|
||||
|
||||
### New: Expression-Based Props and Visibility
|
||||
|
||||
Replaced string token rewriting with structured expression objects:
|
||||
- Props: `{ $state: "/path" }`, `{ $item: "field" }`, `{ $index: true }`
|
||||
- Visibility: `{ $state: "/path", eq: "value" }`, `{ $item: "active" }`, `{ $index: true, gt: 0 }`
|
||||
- Logic: `{ $and: [...] }`, `{ $or: [...] }`, and implicit AND via arrays
|
||||
- Comparison operators: `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `not`
|
||||
|
||||
### New: Utilities
|
||||
- `applySpecPatch()` — typed convenience wrapper for applying a single patch to a Spec
|
||||
- `nestedToFlat()` — convert nested tree specs to flat `{ root, elements }` format
|
||||
- `resolveBindings()` / `resolveActionParam()` — resolve binding paths and action params
|
||||
|
||||
### New: Chat Example
|
||||
|
||||
Full-featured chat example (`examples/chat`) with AI agent, tool calls (crypto, GitHub, Hacker News, weather, search), theme toggle, and streaming UI generation.
|
||||
|
||||
### Improved: Renderer
|
||||
- `ElementRenderer` is now `React.memo`'d for better performance in repeat lists
|
||||
- `emit` is always defined (never `undefined`) — no more optional chaining needed
|
||||
- Action params are resolved through `resolveActionParam` supporting `$item`, `$index`, `$state`
|
||||
- Repeat scope now passes the actual item object instead of requiring token rewriting
|
||||
|
||||
### Breaking Changes
|
||||
- **Expressions renamed**: `{ $path }` / `{ path }` replaced by `{ $state }`, `{ $item }`, `{ $index }`
|
||||
- **Visibility conditions**: `{ path }` → `{ $state }`, `{ and/or/not }` → `{ $and/$or }` with `not` as operator flag
|
||||
- **DynamicValue**: `{ path: string }` → `{ $state: string }`
|
||||
- **Repeat field**: `repeat.path` → `repeat.statePath`
|
||||
- **Action params**: `path` → `statePath` in setState action params
|
||||
- **Provider props**: `actionHandlers` → `handlers` on `JSONUIProvider`/`ActionProvider`
|
||||
- **Auth removed**: `AuthState` type and `{ auth }` visibility conditions removed — model auth as regular state
|
||||
- **Legacy catalog removed**: `createCatalog`, `generateCatalogPrompt`, `generateSystemPrompt`, `ComponentDefinition`, `CatalogConfig`, `SystemPromptOptions` removed
|
||||
- **React exports removed**: `createRendererFromCatalog`, `rewriteRepeatTokens`
|
||||
- **Codegen**: `traverseTree` → `traverseSpec`, `SpecVisitor` → `TreeVisitor`
|
||||
|
||||
## 0.5.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@json-render/core",
|
||||
"version": "0.6.0",
|
||||
"version": "0.5.2",
|
||||
"license": "Apache-2.0",
|
||||
"description": "JSON becomes real things. Define your catalog, register your components, let AI generate.",
|
||||
"keywords": [
|
||||
|
||||
@@ -1,75 +1,5 @@
|
||||
# @json-render/react-native
|
||||
|
||||
## 0.6.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 06b8745: Chat mode (inline GenUI), AI SDK integration, two-way binding, and expression-based visibility/props.
|
||||
|
||||
### New: Chat Mode (Inline GenUI)
|
||||
|
||||
Two generation modes: **Generate** (JSONL-only, the default) and **Chat** (text + JSONL inline). Chat mode lets AI respond conversationally with embedded UI specs — ideal for chatbots and copilot experiences.
|
||||
- `catalog.prompt({ mode: "chat" })` generates a chat-aware system prompt
|
||||
- `pipeJsonRender()` server-side transform separates text from JSONL patches in a mixed stream
|
||||
- `createJsonRenderTransform()` low-level TransformStream for custom pipelines
|
||||
|
||||
### New: AI SDK Integration
|
||||
|
||||
First-class Vercel AI SDK support with typed data parts and stream utilities.
|
||||
- `SpecDataPart` type for `data-spec` stream parts (patch, flat, nested payloads)
|
||||
- `SPEC_DATA_PART` / `SPEC_DATA_PART_TYPE` constants for type-safe part filtering
|
||||
- `createMixedStreamParser()` for parsing mixed text + JSONL streams
|
||||
|
||||
### New: React Chat Hooks
|
||||
- `useChatUI()` — full chat hook with message history, streaming, and spec extraction
|
||||
- `useJsonRenderMessage()` — extract spec + text from a message's parts array
|
||||
- `buildSpecFromParts()` / `getTextFromParts()` — utilities for working with AI SDK message parts
|
||||
- `useBoundProp()` — two-way binding hook for `$bindState` / `$bindItem` expressions
|
||||
|
||||
### New: Two-Way Binding
|
||||
|
||||
Props can now use `$bindState` and `$bindItem` expressions for two-way data binding. The renderer resolves bindings and passes a `bindings` map to components, enabling write-back to state.
|
||||
|
||||
### New: Expression-Based Props and Visibility
|
||||
|
||||
Replaced string token rewriting with structured expression objects:
|
||||
- Props: `{ $state: "/path" }`, `{ $item: "field" }`, `{ $index: true }`
|
||||
- Visibility: `{ $state: "/path", eq: "value" }`, `{ $item: "active" }`, `{ $index: true, gt: 0 }`
|
||||
- Logic: `{ $and: [...] }`, `{ $or: [...] }`, and implicit AND via arrays
|
||||
- Comparison operators: `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `not`
|
||||
|
||||
### New: Utilities
|
||||
- `applySpecPatch()` — typed convenience wrapper for applying a single patch to a Spec
|
||||
- `nestedToFlat()` — convert nested tree specs to flat `{ root, elements }` format
|
||||
- `resolveBindings()` / `resolveActionParam()` — resolve binding paths and action params
|
||||
|
||||
### New: Chat Example
|
||||
|
||||
Full-featured chat example (`examples/chat`) with AI agent, tool calls (crypto, GitHub, Hacker News, weather, search), theme toggle, and streaming UI generation.
|
||||
|
||||
### Improved: Renderer
|
||||
- `ElementRenderer` is now `React.memo`'d for better performance in repeat lists
|
||||
- `emit` is always defined (never `undefined`) — no more optional chaining needed
|
||||
- Action params are resolved through `resolveActionParam` supporting `$item`, `$index`, `$state`
|
||||
- Repeat scope now passes the actual item object instead of requiring token rewriting
|
||||
|
||||
### Breaking Changes
|
||||
- **Expressions renamed**: `{ $path }` / `{ path }` replaced by `{ $state }`, `{ $item }`, `{ $index }`
|
||||
- **Visibility conditions**: `{ path }` → `{ $state }`, `{ and/or/not }` → `{ $and/$or }` with `not` as operator flag
|
||||
- **DynamicValue**: `{ path: string }` → `{ $state: string }`
|
||||
- **Repeat field**: `repeat.path` → `repeat.statePath`
|
||||
- **Action params**: `path` → `statePath` in setState action params
|
||||
- **Provider props**: `actionHandlers` → `handlers` on `JSONUIProvider`/`ActionProvider`
|
||||
- **Auth removed**: `AuthState` type and `{ auth }` visibility conditions removed — model auth as regular state
|
||||
- **Legacy catalog removed**: `createCatalog`, `generateCatalogPrompt`, `generateSystemPrompt`, `ComponentDefinition`, `CatalogConfig`, `SystemPromptOptions` removed
|
||||
- **React exports removed**: `createRendererFromCatalog`, `rewriteRepeatTokens`
|
||||
- **Codegen**: `traverseTree` → `traverseSpec`, `SpecVisitor` → `TreeVisitor`
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [06b8745]
|
||||
- @json-render/core@0.6.0
|
||||
|
||||
## 0.5.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@json-render/react-native",
|
||||
"version": "0.6.0",
|
||||
"version": "0.5.2",
|
||||
"license": "Apache-2.0",
|
||||
"description": "React Native renderer for @json-render/core. JSON becomes React Native components.",
|
||||
"keywords": [
|
||||
|
||||
@@ -1,75 +1,5 @@
|
||||
# @json-render/react
|
||||
|
||||
## 0.6.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 06b8745: Chat mode (inline GenUI), AI SDK integration, two-way binding, and expression-based visibility/props.
|
||||
|
||||
### New: Chat Mode (Inline GenUI)
|
||||
|
||||
Two generation modes: **Generate** (JSONL-only, the default) and **Chat** (text + JSONL inline). Chat mode lets AI respond conversationally with embedded UI specs — ideal for chatbots and copilot experiences.
|
||||
- `catalog.prompt({ mode: "chat" })` generates a chat-aware system prompt
|
||||
- `pipeJsonRender()` server-side transform separates text from JSONL patches in a mixed stream
|
||||
- `createJsonRenderTransform()` low-level TransformStream for custom pipelines
|
||||
|
||||
### New: AI SDK Integration
|
||||
|
||||
First-class Vercel AI SDK support with typed data parts and stream utilities.
|
||||
- `SpecDataPart` type for `data-spec` stream parts (patch, flat, nested payloads)
|
||||
- `SPEC_DATA_PART` / `SPEC_DATA_PART_TYPE` constants for type-safe part filtering
|
||||
- `createMixedStreamParser()` for parsing mixed text + JSONL streams
|
||||
|
||||
### New: React Chat Hooks
|
||||
- `useChatUI()` — full chat hook with message history, streaming, and spec extraction
|
||||
- `useJsonRenderMessage()` — extract spec + text from a message's parts array
|
||||
- `buildSpecFromParts()` / `getTextFromParts()` — utilities for working with AI SDK message parts
|
||||
- `useBoundProp()` — two-way binding hook for `$bindState` / `$bindItem` expressions
|
||||
|
||||
### New: Two-Way Binding
|
||||
|
||||
Props can now use `$bindState` and `$bindItem` expressions for two-way data binding. The renderer resolves bindings and passes a `bindings` map to components, enabling write-back to state.
|
||||
|
||||
### New: Expression-Based Props and Visibility
|
||||
|
||||
Replaced string token rewriting with structured expression objects:
|
||||
- Props: `{ $state: "/path" }`, `{ $item: "field" }`, `{ $index: true }`
|
||||
- Visibility: `{ $state: "/path", eq: "value" }`, `{ $item: "active" }`, `{ $index: true, gt: 0 }`
|
||||
- Logic: `{ $and: [...] }`, `{ $or: [...] }`, and implicit AND via arrays
|
||||
- Comparison operators: `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `not`
|
||||
|
||||
### New: Utilities
|
||||
- `applySpecPatch()` — typed convenience wrapper for applying a single patch to a Spec
|
||||
- `nestedToFlat()` — convert nested tree specs to flat `{ root, elements }` format
|
||||
- `resolveBindings()` / `resolveActionParam()` — resolve binding paths and action params
|
||||
|
||||
### New: Chat Example
|
||||
|
||||
Full-featured chat example (`examples/chat`) with AI agent, tool calls (crypto, GitHub, Hacker News, weather, search), theme toggle, and streaming UI generation.
|
||||
|
||||
### Improved: Renderer
|
||||
- `ElementRenderer` is now `React.memo`'d for better performance in repeat lists
|
||||
- `emit` is always defined (never `undefined`) — no more optional chaining needed
|
||||
- Action params are resolved through `resolveActionParam` supporting `$item`, `$index`, `$state`
|
||||
- Repeat scope now passes the actual item object instead of requiring token rewriting
|
||||
|
||||
### Breaking Changes
|
||||
- **Expressions renamed**: `{ $path }` / `{ path }` replaced by `{ $state }`, `{ $item }`, `{ $index }`
|
||||
- **Visibility conditions**: `{ path }` → `{ $state }`, `{ and/or/not }` → `{ $and/$or }` with `not` as operator flag
|
||||
- **DynamicValue**: `{ path: string }` → `{ $state: string }`
|
||||
- **Repeat field**: `repeat.path` → `repeat.statePath`
|
||||
- **Action params**: `path` → `statePath` in setState action params
|
||||
- **Provider props**: `actionHandlers` → `handlers` on `JSONUIProvider`/`ActionProvider`
|
||||
- **Auth removed**: `AuthState` type and `{ auth }` visibility conditions removed — model auth as regular state
|
||||
- **Legacy catalog removed**: `createCatalog`, `generateCatalogPrompt`, `generateSystemPrompt`, `ComponentDefinition`, `CatalogConfig`, `SystemPromptOptions` removed
|
||||
- **React exports removed**: `createRendererFromCatalog`, `rewriteRepeatTokens`
|
||||
- **Codegen**: `traverseTree` → `traverseSpec`, `SpecVisitor` → `TreeVisitor`
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [06b8745]
|
||||
- @json-render/core@0.6.0
|
||||
|
||||
## 0.5.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@json-render/react",
|
||||
"version": "0.6.0",
|
||||
"version": "0.5.2",
|
||||
"license": "Apache-2.0",
|
||||
"description": "React renderer for @json-render/core. JSON becomes React components.",
|
||||
"keywords": [
|
||||
|
||||
@@ -1,75 +1,5 @@
|
||||
# @json-render/remotion
|
||||
|
||||
## 0.6.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- 06b8745: Chat mode (inline GenUI), AI SDK integration, two-way binding, and expression-based visibility/props.
|
||||
|
||||
### New: Chat Mode (Inline GenUI)
|
||||
|
||||
Two generation modes: **Generate** (JSONL-only, the default) and **Chat** (text + JSONL inline). Chat mode lets AI respond conversationally with embedded UI specs — ideal for chatbots and copilot experiences.
|
||||
- `catalog.prompt({ mode: "chat" })` generates a chat-aware system prompt
|
||||
- `pipeJsonRender()` server-side transform separates text from JSONL patches in a mixed stream
|
||||
- `createJsonRenderTransform()` low-level TransformStream for custom pipelines
|
||||
|
||||
### New: AI SDK Integration
|
||||
|
||||
First-class Vercel AI SDK support with typed data parts and stream utilities.
|
||||
- `SpecDataPart` type for `data-spec` stream parts (patch, flat, nested payloads)
|
||||
- `SPEC_DATA_PART` / `SPEC_DATA_PART_TYPE` constants for type-safe part filtering
|
||||
- `createMixedStreamParser()` for parsing mixed text + JSONL streams
|
||||
|
||||
### New: React Chat Hooks
|
||||
- `useChatUI()` — full chat hook with message history, streaming, and spec extraction
|
||||
- `useJsonRenderMessage()` — extract spec + text from a message's parts array
|
||||
- `buildSpecFromParts()` / `getTextFromParts()` — utilities for working with AI SDK message parts
|
||||
- `useBoundProp()` — two-way binding hook for `$bindState` / `$bindItem` expressions
|
||||
|
||||
### New: Two-Way Binding
|
||||
|
||||
Props can now use `$bindState` and `$bindItem` expressions for two-way data binding. The renderer resolves bindings and passes a `bindings` map to components, enabling write-back to state.
|
||||
|
||||
### New: Expression-Based Props and Visibility
|
||||
|
||||
Replaced string token rewriting with structured expression objects:
|
||||
- Props: `{ $state: "/path" }`, `{ $item: "field" }`, `{ $index: true }`
|
||||
- Visibility: `{ $state: "/path", eq: "value" }`, `{ $item: "active" }`, `{ $index: true, gt: 0 }`
|
||||
- Logic: `{ $and: [...] }`, `{ $or: [...] }`, and implicit AND via arrays
|
||||
- Comparison operators: `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `not`
|
||||
|
||||
### New: Utilities
|
||||
- `applySpecPatch()` — typed convenience wrapper for applying a single patch to a Spec
|
||||
- `nestedToFlat()` — convert nested tree specs to flat `{ root, elements }` format
|
||||
- `resolveBindings()` / `resolveActionParam()` — resolve binding paths and action params
|
||||
|
||||
### New: Chat Example
|
||||
|
||||
Full-featured chat example (`examples/chat`) with AI agent, tool calls (crypto, GitHub, Hacker News, weather, search), theme toggle, and streaming UI generation.
|
||||
|
||||
### Improved: Renderer
|
||||
- `ElementRenderer` is now `React.memo`'d for better performance in repeat lists
|
||||
- `emit` is always defined (never `undefined`) — no more optional chaining needed
|
||||
- Action params are resolved through `resolveActionParam` supporting `$item`, `$index`, `$state`
|
||||
- Repeat scope now passes the actual item object instead of requiring token rewriting
|
||||
|
||||
### Breaking Changes
|
||||
- **Expressions renamed**: `{ $path }` / `{ path }` replaced by `{ $state }`, `{ $item }`, `{ $index }`
|
||||
- **Visibility conditions**: `{ path }` → `{ $state }`, `{ and/or/not }` → `{ $and/$or }` with `not` as operator flag
|
||||
- **DynamicValue**: `{ path: string }` → `{ $state: string }`
|
||||
- **Repeat field**: `repeat.path` → `repeat.statePath`
|
||||
- **Action params**: `path` → `statePath` in setState action params
|
||||
- **Provider props**: `actionHandlers` → `handlers` on `JSONUIProvider`/`ActionProvider`
|
||||
- **Auth removed**: `AuthState` type and `{ auth }` visibility conditions removed — model auth as regular state
|
||||
- **Legacy catalog removed**: `createCatalog`, `generateCatalogPrompt`, `generateSystemPrompt`, `ComponentDefinition`, `CatalogConfig`, `SystemPromptOptions` removed
|
||||
- **React exports removed**: `createRendererFromCatalog`, `rewriteRepeatTokens`
|
||||
- **Codegen**: `traverseTree` → `traverseSpec`, `SpecVisitor` → `TreeVisitor`
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [06b8745]
|
||||
- @json-render/core@0.6.0
|
||||
|
||||
## 0.5.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@json-render/remotion",
|
||||
"version": "0.6.0",
|
||||
"version": "0.5.2",
|
||||
"license": "Apache-2.0",
|
||||
"description": "Remotion renderer for @json-render/core. JSON becomes video compositions.",
|
||||
"keywords": [
|
||||
|
||||
Reference in New Issue
Block a user