Ver Fonte

docs(readme): add Oivo-fork section — live demo + new components (Image src, Pressable, Lightbox, Modal)

Session-Id: 481d7b9c

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
root há 3 semanas atrás
pai
commit
baf2d38e3a
1 ficheiros alterados com 27 adições e 0 exclusões
  1. 27 0
      README.md

+ 27 - 0
README.md

@@ -1,3 +1,30 @@
+# json-render — Oivo fork
+
+A fork of [vercel-labs/json-render](https://github.com/vercel-labs/json-render) with real image support, two **self-contained** interactive components, and a live playground wired to the [ai.mm.mk](https://ai.mm.mk) gateway.
+
+**🔴 Live demo:** https://jsonrender-demo.oivo.com/playground — type a sentence (e.g. *"landing page for a coffee shop with a photo gallery and a sign-up button"*) and watch a UI build from the JSON spec.
+
+## What this fork adds
+
+- **`Image` takes a real `src`** — renders an actual `<img>` (object-cover) when given a URL; falls back to a placeholder otherwise. Galleries use `https://picsum.photos/seed/<word>/<w>/<h>`.
+- **`Pressable`** — a clickable container that wraps arbitrary children and emits a `press` event.
+- **`Lightbox`** — a self-contained photo gallery: thumbnail grid + fullscreen overlay with prev/next, keyboard nav, and click-outside/✕ close. Manages its own React state, so it works in the live preview without any `setState` action.
+- **`Modal`** — a self-contained modal: the element *is* the trigger button (`triggerLabel`) and renders its children inside a centered popup with Esc/backdrop/✕ close. Also fully self-stated — no `Dialog` + `setState` wiring.
+
+> Why "self-contained": the playground preview doesn't reliably drive `setState`-action → cross-component re-renders, so click-to-open interactions (lightbox, modal) are built as components with their own `useState` instead.
+
+**Key files**
+
+| What | Path |
+|------|------|
+| Component implementations | `apps/web/lib/render/registry.tsx` |
+| Component catalog (types + AI descriptions) | `apps/web/lib/render/catalog.ts` |
+| Generation route + prompt rules + gateway | `apps/web/app/api/generate/route.ts` |
+
+The generate route is pointed at the OpenAI-compatible **ai.mm.mk** gateway (default model `anthropic/claude-haiku-4.5`) via `AI_API_URL` / `AI_API_KEY` / `AI_GATEWAY_MODEL`.
+
+---
+
 # json-render
 
 **The Generative UI framework.**