@olonjs/react 0.2.2 → 0.2.4

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.
Files changed (2) hide show
  1. package/README.md +77 -0
  2. package/package.json +3 -3
package/README.md ADDED
@@ -0,0 +1,77 @@
1
+ # @olonjs/react
2
+
3
+ <p align="center">
4
+ <strong>React rendering bindings for the OlonJS engine.</strong><br />
5
+ JsonPagesEngine · PageRenderer / SectionRenderer · theme runtime · cloud save · Studio bridge.
6
+ </p>
7
+
8
+ <p align="center">
9
+ <a href="https://www.npmjs.com/package/@olonjs/react"><img src="https://img.shields.io/npm/v/@olonjs/react?color=blue&style=flat-square" alt="npm version"></a>
10
+ <a href="https://github.com/olonjs/npm-jpcore/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-green?style=flat-square" alt="license"></a>
11
+ </p>
12
+
13
+ **@olonjs/react** renders the OlonJS contract in React: it hosts the engine (`JsonPagesEngine`), renders pages and sections, publishes the theme chain, manages the Studio provider tree, and implements HotSave. It is a **binding**, not the contract — the contract stays in [`@olonjs/core`](../core).
14
+
15
+ ## Role in the Stack (ADR-0016)
16
+
17
+ - Depends on `@olonjs/core` (types, resolution, theme flattening).
18
+ - **Optionally** dynamic-loads `@olonjs/studio` for the `/admin` route — via a **single** allow-listed `import()` in `engine/StudioRoute.tsx`. No other studio import is permitted (enforced by `npm run test:boundary`).
19
+ - The visitor-only engine `OlonJSEngine` never references studio.
20
+
21
+ ## Install
22
+
23
+ ```bash
24
+ npm install @olonjs/react @olonjs/core
25
+ ```
26
+
27
+ Peer dependencies: `react@^19`, `react-dom@^19`, `react-router-dom@^6.29`, `@olonjs/studio@^0.2.3` (optional for visitor-only sites), `zod@^4.6.0`.
28
+
29
+ ## Quick Start
30
+
31
+ ```tsx
32
+ import { JsonPagesEngine } from '@olonjs/react';
33
+
34
+ export function App() {
35
+ return (
36
+ <JsonPagesEngine
37
+ config={{
38
+ tenantId: 'my-tenant',
39
+ registry, // { [SectionType]: React.FC } — MTRP keys
40
+ schemas, // Record<SectionType, ZodType> — Form Factory aggregate
41
+ pages, // Record<slug, PageConfig>
42
+ siteConfig, // shell instances (header/footer)
43
+ themeConfig, // theme.json payload
44
+ menuConfig, // menu.json payload (resolved by core)
45
+ addSection, // AddSectionConfig
46
+ // webmcp: { enabled: true, namespace, tools?, toolExecutors? } — JEB
47
+ }}
48
+ />
49
+ );
50
+ }
51
+ ```
52
+
53
+ Full bootstrap shape: **JEB** in [`specs/2.0/JEB_1.3.md`](../../specs/2.0/JEB_1.3.md).
54
+
55
+ ## API Surface
56
+
57
+ | Area | Exports (representative) | Role |
58
+ |---|---|---|
59
+ | `engine` | `JsonPagesEngine`, `OlonJSEngine` | Full engine (routes `/`, `/admin`, `/admin/preview`) and visitor-only engine |
60
+ | `rendering` | `PageRenderer`, `SectionRenderer` | Global shell (header/footer), section lookup + error boundary + Studio overlay markers |
61
+ | `theme` | `ThemeLoader`, theme-manager singleton | CSS-string injection + flattened `--theme-*` CSS vars (CIP layer 0) |
62
+ | `config` | `ConfigProvider`, `StudioProvider`, `IconRegistryContext`, `OlonFormsContext` | Provider tree consumed by pages, Studio, and form sections |
63
+ | `cloud` | `resolveCloudPolicy`, `createHotSaveHandler`, `readCloudEnvFromVite` | Cloud policy (local/live/static) + HotSave persistence |
64
+ | misc | `useStudio`, `DefaultNotFound` | Studio bridge hook, default 404 |
65
+
66
+ ## Architectural Laws (CIP v1.7)
67
+
68
+ - Theme chain is normative: `theme.json → runtime vars → tenant semantic bridge → section --local-* → JSX`. The package publishes layer 0 and enforces nothing about the tenant's own semantic naming.
69
+ - Views remain schema-blind; the package provides props (`data`, `settings`), never schema logic.
70
+
71
+ ## Versioning
72
+
73
+ Patch-only auto-numbering (`0.2.XXX`) by the gated `release:enterprise` pipeline. Peers are synced from [`@olonjs/stack`](../stack) at prepack time.
74
+
75
+ ## License
76
+
77
+ MIT — see [LICENSE](../../LICENSE).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olonjs/react",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/olonjs-react.umd.cjs",
@@ -43,7 +43,7 @@
43
43
  "react": "^19.0.0",
44
44
  "react-dom": "^19.0.0",
45
45
  "react-router-dom": "^6.29.0",
46
- "@olonjs/studio": "^0.2.2"
46
+ "@olonjs/studio": "^0.2.4"
47
47
  },
48
48
  "peerDependenciesMeta": {
49
49
  "@olonjs/studio": {
@@ -51,7 +51,7 @@
51
51
  }
52
52
  },
53
53
  "dependencies": {
54
- "@olonjs/core": "^2.0.2",
54
+ "@olonjs/core": "^2.0.4",
55
55
  "lucide-react": "^0.474.0"
56
56
  },
57
57
  "devDependencies": {