page.mdx 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. export const metadata = { title: "Changelog" }
  2. # Changelog
  3. Notable changes and updates to json-render.
  4. ## v0.5.0
  5. February 2026
  6. ### New: @json-render/react-native
  7. Full React Native renderer with 25+ standard components, data binding, visibility, actions, and dynamic props. Build AI-generated native mobile UIs with the same catalog-driven approach as web.
  8. ```tsx
  9. import { defineCatalog } from "@json-render/core";
  10. import { schema } from "@json-render/react-native/schema";
  11. import {
  12. standardComponentDefinitions,
  13. standardActionDefinitions,
  14. } from "@json-render/react-native/catalog";
  15. import { defineRegistry, Renderer } from "@json-render/react-native";
  16. const catalog = defineCatalog(schema, {
  17. components: { ...standardComponentDefinitions },
  18. actions: standardActionDefinitions,
  19. });
  20. const { registry } = defineRegistry(catalog, { components: {} });
  21. <Renderer spec={spec} registry={registry} />
  22. ```
  23. Includes standard components for layout (Container, Row, Column, ScrollContainer, SafeArea, Pressable, Spacer, Divider), content (Heading, Paragraph, Label, Image, Avatar, Badge, Chip), input (Button, TextInput, Switch, Checkbox, Slider, SearchBar), feedback (Spinner, ProgressBar), and composite (Card, ListItem, Modal).
  24. ### New: Event System
  25. Components now use `emit` to fire named events instead of directly dispatching actions. The element's `on` field maps events to action bindings, decoupling component logic from action handling.
  26. ```tsx
  27. // Component emits a named event
  28. Button: ({ props, emit }) => (
  29. <button onClick={() => emit?.("press")}>{props.label}</button>
  30. ),
  31. // Element spec maps events to actions
  32. {
  33. "type": "Button",
  34. "props": { "label": "Submit" },
  35. "on": { "press": { "action": "submit", "params": { "formId": "main" } } }
  36. }
  37. ```
  38. ### New: Repeat/List Rendering
  39. Elements can now iterate over state arrays using the `repeat` field. Child elements use `$item` and `$index` tokens in `$path` expressions to reference the current item.
  40. ```json
  41. {
  42. "type": "Column",
  43. "repeat": { "path": "/posts", "key": "id" },
  44. "children": ["post-card"]
  45. }
  46. ```
  47. ```json
  48. {
  49. "type": "Card",
  50. "props": { "title": { "$path": "$item/title" } }
  51. }
  52. ```
  53. ### New: User Prompt Builder
  54. Build structured user prompts with optional spec refinement and state context:
  55. ```typescript
  56. import { buildUserPrompt } from "@json-render/core";
  57. // Fresh generation
  58. buildUserPrompt({ prompt: "create a todo app" });
  59. // Refinement (patch-only mode)
  60. buildUserPrompt({ prompt: "add a toggle", currentSpec: spec });
  61. // With runtime state
  62. buildUserPrompt({ prompt: "show data", state: { todos: [] } });
  63. ```
  64. ### New: Spec Validation
  65. Validate spec structure and auto-fix common issues:
  66. ```typescript
  67. import { validateSpec, autoFixSpec } from "@json-render/core";
  68. const { valid, issues } = validateSpec(spec, catalog);
  69. const fixed = autoFixSpec(spec);
  70. ```
  71. ### Improved: State Management
  72. `DataProvider` has been renamed to `StateProvider` with a clearer API. State is now a first-class part of specs. Elements can bind to state via `$path` expressions, and the built-in `setState` action updates state directly.
  73. ### Improved: AI Prompts
  74. Schema prompts now include streaming best practices, repeat/list examples, and state patching guidance. Schemas can also define `defaultRules` that are always included in generated prompts.
  75. ### Improved: Documentation
  76. - All documentation pages migrated to MDX
  77. - AI-powered documentation chat
  78. - Dynamic Open Graph images for all docs pages
  79. - Improved playground
  80. ### Breaking Changes
  81. - `DataProvider` renamed to `StateProvider`
  82. - `useData` renamed to `useStateStore`, `useDataValue` to `useStateValue`, `useDataBinding` to `useStateBinding`
  83. - `onAction` renamed to `emit` in component context
  84. - `DataModel` type renamed to `StateModel`
  85. - `Action` type renamed to `ActionBinding` (old name still available but deprecated)
  86. ---
  87. ## v0.4.0
  88. February 2026
  89. ### New: Custom Schema System
  90. Create custom output formats with `defineSchema`. Each renderer now defines its own schema, enabling completely different spec formats for different use cases.
  91. ```typescript
  92. import { defineSchema } from "@json-render/core";
  93. const mySchema = defineSchema((s) => ({
  94. spec: s.object({
  95. pages: s.array(s.object({
  96. title: s.string(),
  97. blocks: s.array(s.ref("catalog.blocks")),
  98. })),
  99. }),
  100. catalog: s.object({
  101. blocks: s.map({ props: s.zod(), description: s.string() }),
  102. }),
  103. }), {
  104. promptTemplate: myPromptTemplate,
  105. });
  106. ```
  107. ### New: Component Slots
  108. Components can now define which slots they accept. Use `["default"]` for regular children, or named slots like `["header", "footer"]` for more complex layouts.
  109. ```typescript
  110. const catalog = defineCatalog(schema, {
  111. components: {
  112. Card: {
  113. props: z.object({ title: z.string() }),
  114. slots: ["default"], // accepts children
  115. description: "A card container",
  116. },
  117. Layout: {
  118. props: z.object({}),
  119. slots: ["header", "content", "footer"], // named slots
  120. description: "Page layout with header, content, footer",
  121. },
  122. },
  123. });
  124. ```
  125. ### New: AI Prompt Generation
  126. Catalogs now generate AI system prompts automatically with `catalog.prompt()`. The prompt includes all component definitions, props schemas, and action descriptions - ensuring the AI only generates valid specs.
  127. ```typescript
  128. import { defineCatalog } from "@json-render/core";
  129. import { schema } from "@json-render/react/schema";
  130. const catalog = defineCatalog(schema, {
  131. components: { /* ... */ },
  132. actions: { /* ... */ },
  133. });
  134. // Generate system prompt for AI
  135. const systemPrompt = catalog.prompt();
  136. // Use with any AI SDK
  137. const result = await streamText({
  138. model: "claude-haiku-4.5",
  139. system: systemPrompt,
  140. prompt: userMessage,
  141. });
  142. ```
  143. ### New: @json-render/remotion
  144. Generate AI-powered videos with Remotion. Define video catalogs, stream timeline specs, and render with the Remotion Player.
  145. ```tsx
  146. import { Player } from "@remotion/player";
  147. import { Renderer, schema, standardComponentDefinitions } from "@json-render/remotion";
  148. const catalog = defineCatalog(schema, {
  149. components: standardComponentDefinitions,
  150. transitions: standardTransitionDefinitions,
  151. });
  152. <Player
  153. component={Renderer}
  154. inputProps={{ spec }}
  155. durationInFrames={spec.composition.durationInFrames}
  156. fps={spec.composition.fps}
  157. compositionWidth={spec.composition.width}
  158. compositionHeight={spec.composition.height}
  159. />
  160. ```
  161. Includes 10 standard video components (TitleCard, TypingText, SplitScreen, etc.), 7 transition types, and the ClipWrapper utility for custom components.
  162. ### New: SpecStream
  163. SpecStream is json-render's streaming format for progressively building specs from JSONL patches. The new compiler API makes it easy to process streaming AI responses.
  164. ```typescript
  165. import { createSpecStreamCompiler } from "@json-render/core";
  166. const compiler = createSpecStreamCompiler<MySpec>();
  167. // Process streaming chunks
  168. const { result, newPatches } = compiler.push(chunk);
  169. setSpec(result); // Update UI with partial result
  170. ```
  171. ### Improved: Dashboard Example
  172. The dashboard example is now a full-featured accounting dashboard with:
  173. - Persistent SQLite database with Drizzle ORM
  174. - RESTful API for customers, invoices, expenses, accounts
  175. - Draggable widget reordering
  176. - AI-powered widget generation with streaming
  177. - Real data binding to database records
  178. ### Improved: Documentation
  179. - Interactive playground for testing specs
  180. - New guides: Custom Schema, Streaming, Code Export
  181. - Full API reference for all packages
  182. - Integration guides: A2UI, AG-UI, Adaptive Cards, OpenAPI
  183. ### Breaking Changes
  184. - `UITree` type renamed to `Spec`
  185. - Schema is now imported from renderer packages (`@json-render/react`) not core
  186. - `defineCatalog` now requires a schema as first argument
  187. ---
  188. ## v0.3.0
  189. January 2026
  190. Internal release with codegen foundations.
  191. - Added `@json-render/codegen` package (spec traversal and JSX serialization)
  192. - Configurable AI model via environment variables
  193. - Documentation improvements and bug fixes
  194. *Note: Only @json-render/core was published to npm for this release.*
  195. ---
  196. ## v0.2.0
  197. January 2026
  198. Initial public release.
  199. - Core catalog and spec types
  200. - React renderer with contexts for data, actions, visibility
  201. - AI prompt generation from catalogs
  202. - Basic streaming support
  203. - Dashboard example application