@ramme-io/kernel 5.0.1 → 6.0.0
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/README.md +87 -53
- package/dist/{AiGateway-DflFS1JW.js → AiGateway-DLGiTtyR.js} +1136 -931
- package/dist/index.es.js +6854 -6532
- package/dist/kernel/src/components/RammeInspector.d.ts +7 -1
- package/dist/kernel/src/components/RammeInspector.d.ts.map +1 -1
- package/dist/kernel/src/components/ThemeStudio.d.ts +116 -0
- package/dist/kernel/src/components/ThemeStudio.d.ts.map +1 -0
- package/dist/kernel/src/events/mockEventSource.d.ts +28 -0
- package/dist/kernel/src/events/mockEventSource.d.ts.map +1 -0
- package/dist/kernel/src/index.d.ts +2 -0
- package/dist/kernel/src/index.d.ts.map +1 -1
- package/dist/kernel/src/stores/useSettingsStore.d.ts +6 -0
- package/dist/kernel/src/stores/useSettingsStore.d.ts.map +1 -1
- package/dist/server.es.js +6 -6
- package/package.json +7 -4
package/README.md
CHANGED
|
@@ -4,61 +4,68 @@
|
|
|
4
4
|
|
|
5
5
|
**The core routing, rendering, and state engine for Ramme applications.**
|
|
6
6
|
|
|
7
|
-
The Kernel is the brain of every Ramme app. It
|
|
7
|
+
The Kernel is the brain of every Ramme app. It owns two rendering paths: a
|
|
8
|
+
**sitemap** you turn into routes with one call, and a **manifest** it renders
|
|
9
|
+
into pages without you writing components at all.
|
|
8
10
|
|
|
9
11
|
---
|
|
10
12
|
|
|
11
13
|
## Architecture
|
|
12
14
|
|
|
13
|
-
The Kernel operates on three core inputs:
|
|
14
|
-
|
|
15
15
|
### 1. The Manifest (`app.manifest.ts`)
|
|
16
16
|
|
|
17
|
-
The
|
|
17
|
+
The application specification. Its shape is `AppSpecification`, validated by
|
|
18
|
+
`AppSpecificationSchema` in `@ramme-io/shared` — `meta` and `config` are
|
|
19
|
+
required, and `pages` carries the manifest-rendered surface.
|
|
18
20
|
|
|
19
21
|
```typescript
|
|
20
22
|
// src/config/app.manifest.ts
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
import type { AppSpecification } from '@ramme-io/kernel';
|
|
24
|
+
|
|
25
|
+
export const appManifest: AppSpecification = {
|
|
26
|
+
meta: { name: 'My Ramme App', version: '1.0.0' },
|
|
27
|
+
config: { theme: 'midnight', mockMode: false },
|
|
28
|
+
domain: { signals: [], entities: [] },
|
|
29
|
+
pages: [],
|
|
26
30
|
};
|
|
27
31
|
```
|
|
28
32
|
|
|
29
|
-
### 2. The Sitemap (
|
|
33
|
+
### 2. The Sitemap (`*.sitemap.ts`)
|
|
30
34
|
|
|
31
|
-
The declarative routing and navigation structure
|
|
35
|
+
The declarative routing and navigation structure: an array of `SitemapEntry`.
|
|
36
|
+
`component` holds the **component itself**, not its name — the sitemap is
|
|
37
|
+
TypeScript, so a typo is a compile error rather than a blank page at runtime.
|
|
32
38
|
|
|
33
|
-
```
|
|
34
|
-
// src/
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
path: '/settings',
|
|
44
|
-
label: 'Settings',
|
|
45
|
-
icon: 'settings',
|
|
46
|
-
component: 'SettingsPage',
|
|
47
|
-
},
|
|
39
|
+
```tsx
|
|
40
|
+
// src/templates/dashboard/dashboard.sitemap.ts
|
|
41
|
+
import type { SitemapEntry } from '@ramme-io/kernel';
|
|
42
|
+
import DashboardPage from '../../features/dashboard/pages/DashboardPage';
|
|
43
|
+
import SettingsPage from '../../features/settings/pages/SettingsPage';
|
|
44
|
+
|
|
45
|
+
export const dashboardSitemap: SitemapEntry[] = [
|
|
46
|
+
{ id: 'home', path: '', title: 'Dashboard', icon: 'layout-dashboard', component: DashboardPage },
|
|
47
|
+
{ id: 'settings', path: 'settings', title: 'Settings', icon: 'settings', component: SettingsPage },
|
|
48
48
|
];
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
+
A sitemap lives next to the layout that serves it, not in one global file. Each
|
|
52
|
+
layout provides its own through `SitemapProvider`, which is what makes the
|
|
53
|
+
layouts swappable — see `products/ramme-marketing/src/templates/`.
|
|
54
|
+
|
|
51
55
|
### 3. The Component Registry (`component-registry.tsx`)
|
|
52
56
|
|
|
53
|
-
Maps
|
|
57
|
+
Maps **string** component names to React components. This is what renders the
|
|
58
|
+
*manifest*, not the sitemap: `DynamicBlock` resolves `block.type` through it, so
|
|
59
|
+
an AI-authored or user-authored manifest can name `'StatCard'` and get one.
|
|
54
60
|
|
|
55
61
|
```tsx
|
|
56
|
-
// src/
|
|
57
|
-
import {
|
|
62
|
+
// src/config/component-registry.tsx
|
|
63
|
+
import { AUTO_REGISTRY } from '@ramme-io/ui';
|
|
64
|
+
import { SmartTable } from '@ramme-io/kernel';
|
|
58
65
|
|
|
59
|
-
export const
|
|
60
|
-
|
|
61
|
-
|
|
66
|
+
export const COMPONENT_REGISTRY: Record<string, React.FC<any>> = {
|
|
67
|
+
...AUTO_REGISTRY, // every catalogued @ramme-io/ui component
|
|
68
|
+
SmartTable, // local data-connected blocks
|
|
62
69
|
};
|
|
63
70
|
```
|
|
64
71
|
|
|
@@ -66,46 +73,73 @@ export const componentRegistry: Record<string, React.LazyExoticComponent<any>> =
|
|
|
66
73
|
|
|
67
74
|
## How It Works
|
|
68
75
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
76
|
+
**Routing path** — `generateRoutes(sitemap)` walks the array recursively and
|
|
77
|
+
returns react-router `<Route>` elements, adding an index redirect from every
|
|
78
|
+
parent to its first child so a folder route is never blank. Your app renders the
|
|
79
|
+
result; the Kernel builds it.
|
|
80
|
+
|
|
81
|
+
**Manifest path** — `ManifestProvider` holds the `AppSpecification`.
|
|
82
|
+
`DynamicPage` looks a page up by id, and `DynamicBlock` hydrates each block:
|
|
83
|
+
resolving `block.type` through the registry, injecting live values from the
|
|
84
|
+
Signal engine for a `signalId`, and loading data for a `dataId`.
|
|
73
85
|
|
|
74
|
-
The
|
|
86
|
+
The two are independent. An app can use the sitemap alone and never touch
|
|
87
|
+
`pages`, which is what the products in this repo do.
|
|
75
88
|
|
|
76
89
|
---
|
|
77
90
|
|
|
78
91
|
## Integration
|
|
79
92
|
|
|
80
|
-
In a standard Ramme app (generated by `@ramme-io/create-app`), the Kernel is
|
|
93
|
+
In a standard Ramme app (generated by `@ramme-io/create-app`), the Kernel is
|
|
94
|
+
pre-wired. Mounting it manually — this is `products/ramme-marketing/src/main.tsx`,
|
|
95
|
+
trimmed:
|
|
81
96
|
|
|
82
97
|
```tsx
|
|
83
|
-
import {
|
|
98
|
+
import { BrowserRouter } from 'react-router-dom';
|
|
99
|
+
import { ThemeProvider, ToastProvider } from '@ramme-io/ui';
|
|
100
|
+
import { ManifestProvider, MqttProvider, AuthProvider } from '@ramme-io/kernel';
|
|
84
101
|
import { appManifest } from './config/app.manifest';
|
|
85
|
-
import
|
|
86
|
-
import { componentRegistry } from './core/component-registry';
|
|
102
|
+
import App from './App';
|
|
87
103
|
|
|
88
|
-
export default function
|
|
104
|
+
export default function Root() {
|
|
89
105
|
return (
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
106
|
+
// BrowserRouter must be outermost: providers below it use router hooks.
|
|
107
|
+
<BrowserRouter>
|
|
108
|
+
<ManifestProvider manifest={appManifest}>
|
|
109
|
+
<ThemeProvider appId="marketing" defaultTheme="light">
|
|
110
|
+
<ToastProvider>
|
|
111
|
+
<AuthProvider>
|
|
112
|
+
<MqttProvider>
|
|
113
|
+
<App />
|
|
114
|
+
</MqttProvider>
|
|
115
|
+
</AuthProvider>
|
|
116
|
+
</ToastProvider>
|
|
117
|
+
</ThemeProvider>
|
|
118
|
+
</ManifestProvider>
|
|
119
|
+
</BrowserRouter>
|
|
97
120
|
);
|
|
98
121
|
}
|
|
99
122
|
```
|
|
100
123
|
|
|
124
|
+
`ManifestProvider` takes only `manifest`. The sitemap and the registry are not
|
|
125
|
+
props — a layout provides its sitemap via `SitemapProvider`, and the registry is
|
|
126
|
+
passed to `DynamicBlock` at the point of rendering.
|
|
127
|
+
|
|
101
128
|
---
|
|
102
129
|
|
|
103
130
|
## Key Exports
|
|
104
131
|
|
|
105
|
-
- **`ManifestProvider`**
|
|
106
|
-
- **`
|
|
107
|
-
- **`
|
|
108
|
-
- **`
|
|
132
|
+
- **`ManifestProvider`** / **`useManifest()`** — holds and reads the `AppSpecification`.
|
|
133
|
+
- **`SitemapProvider`** / **`useSitemap()`** — the active layout's sitemap, for sidebars, breadcrumbs and titles.
|
|
134
|
+
- **`generateRoutes(sitemap)`** — sitemap array to react-router `<Route>` tree.
|
|
135
|
+
- **`useDynamicSitemap(staticSitemap)`** — merges manifest-authored pages into a static sitemap.
|
|
136
|
+
- **`DynamicPage`** / **`DynamicBlock`** — the manifest renderers.
|
|
137
|
+
- **`useDevice()`** — normalized telemetry from connected hardware.
|
|
138
|
+
- **`MqttProvider`** — MQTT device communication. Ably transport is not in the Kernel; `products/bodewell-web/src/lib/ablyClient.ts` owns it.
|
|
139
|
+
- **`AuthProvider`** / **`useAuth()`** / **`ProtectedRoute`** — authentication.
|
|
140
|
+
|
|
141
|
+
> `useTheme` is **not** exported here — it belongs to `@ramme-io/ui`. There is no
|
|
142
|
+
> `useNavigation`; navigation state comes from `useSitemap` and react-router.
|
|
109
143
|
|
|
110
144
|
---
|
|
111
145
|
|