@ramme-io/kernel 2.0.0-alpha.4 → 2.1.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 ADDED
@@ -0,0 +1,122 @@
1
+ # @ramme-io/kernel
2
+
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
+
5
+ **The core routing, rendering, and state engine for Ramme applications.**
6
+
7
+ The Kernel is the brain of every Ramme app. It reads your declarative configuration files (`app.manifest.ts` and `sitemap.ts`), constructs the routing tree, and dynamically renders the correct components via the component registry — all without you writing a single line of routing code.
8
+
9
+ ---
10
+
11
+ ## Architecture
12
+
13
+ The Kernel operates on three core inputs:
14
+
15
+ ### 1. The Manifest (`app.manifest.ts`)
16
+
17
+ The global configuration for your application. Defines the app title, description, default theme, and high-level settings.
18
+
19
+ ```typescript
20
+ // src/config/app.manifest.ts
21
+ export const appManifest = {
22
+ name: 'My Ramme App',
23
+ description: 'A hardware-accelerated dashboard.',
24
+ theme: 'midnight',
25
+ version: '1.0.0',
26
+ };
27
+ ```
28
+
29
+ ### 2. The Sitemap (`sitemap.ts`)
30
+
31
+ The declarative routing and navigation structure. Each entry defines a page, its path, the component to render, and its position in the navigation hierarchy.
32
+
33
+ ```typescript
34
+ // src/config/sitemap.ts
35
+ export const sitemap = [
36
+ {
37
+ path: '/',
38
+ label: 'Dashboard',
39
+ icon: 'layout-dashboard',
40
+ component: 'DashboardPage',
41
+ },
42
+ {
43
+ path: '/settings',
44
+ label: 'Settings',
45
+ icon: 'settings',
46
+ component: 'SettingsPage',
47
+ },
48
+ ];
49
+ ```
50
+
51
+ ### 3. The Component Registry (`component-registry.tsx`)
52
+
53
+ Maps the string-based component names from the sitemap to actual React components. This is what allows the Kernel to dynamically render your pages without hardcoded imports in the router.
54
+
55
+ ```tsx
56
+ // src/core/component-registry.tsx
57
+ import { lazy } from 'react';
58
+
59
+ export const componentRegistry: Record<string, React.LazyExoticComponent<any>> = {
60
+ DashboardPage: lazy(() => import('../pages/DashboardPage')),
61
+ SettingsPage: lazy(() => import('../pages/SettingsPage')),
62
+ };
63
+ ```
64
+
65
+ ---
66
+
67
+ ## How It Works
68
+
69
+ 1. **Boot** — The Kernel reads `app.manifest.ts` and applies global settings (theme, metadata).
70
+ 2. **Parse** — It ingests `sitemap.ts` and constructs a routing tree from the declarative page definitions.
71
+ 3. **Resolve** — For each route, the Kernel looks up the `component` key in the component registry.
72
+ 4. **Render** — The resolved React component is lazy-loaded and rendered inside the application shell.
73
+
74
+ The developer never writes `<Route>` elements manually. The Kernel handles all routing, code-splitting, and navigation generation from the sitemap alone.
75
+
76
+ ---
77
+
78
+ ## Integration
79
+
80
+ In a standard Ramme app (generated by `@ramme-io/create-app`), the Kernel is pre-wired. If integrating manually:
81
+
82
+ ```tsx
83
+ import { ManifestProvider } from '@ramme-io/kernel';
84
+ import { appManifest } from './config/app.manifest';
85
+ import { sitemap } from './config/sitemap';
86
+ import { componentRegistry } from './core/component-registry';
87
+
88
+ export default function App() {
89
+ return (
90
+ <ManifestProvider
91
+ manifest={appManifest}
92
+ sitemap={sitemap}
93
+ registry={componentRegistry}
94
+ >
95
+ {/* The Kernel renders your app here */}
96
+ </ManifestProvider>
97
+ );
98
+ }
99
+ ```
100
+
101
+ ---
102
+
103
+ ## Key Exports
104
+
105
+ - **`ManifestProvider`** — The root context provider that hydrates the app with manifest and sitemap data.
106
+ - **`useManifest()`** — Hook to access the current app manifest from any component.
107
+ - **`useDevice()`** — Hook for consuming normalized telemetry data from connected hardware.
108
+ - **`MqttProvider`** — Context provider for real-time MQTT/Ably device communication.
109
+
110
+ ---
111
+
112
+ ## Documentation
113
+
114
+ For full documentation, visit [https://ramme.io/docs](https://ramme.io/docs).
115
+
116
+ ---
117
+
118
+ ## License
119
+
120
+ MIT License — Copyright © 2026 Ramme Framework.
121
+
122
+ See [LICENSE](LICENSE) for details.