Skip to content

Commit 314c894

Browse files
committed
Revise UI framework documentation to improve structure and detail of page architecture and components
1 parent 754f818 commit 314c894

File tree

1 file changed

+75
-11
lines changed

1 file changed

+75
-11
lines changed

docs/guide/ui-framework.md

Lines changed: 75 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,74 @@
11
# Standard UI Components Reference
22

3-
This document defines the standard component library for `@objectos/ui`. These components are the reference implementations for the **View & Layout Specification**.
3+
This document defines the standard component library for `@objectos/ui`. These components are the reference implementations for the **View & Layout Specifications**.
44

5-
## 1. View Controller
5+
---
6+
7+
## 1. Page Architecture
8+
9+
The top-level system for composing screens from Widgets and Layouts. Driven by `*.page.yml`.
10+
11+
### `ObjectPage`
12+
The master controller for any URL-addressable page in the application.
13+
14+
- **Props**:
15+
- `pageId`: string (e.g., "dashboard-sales") - *The ID of the page definition to load.*
16+
- `context`: Record<string, any> - *Optional global variable to pass to widgets (e.g., `{ recordId: "123" }`)*.
17+
- **Behavior**:
18+
1. Loads `*.page.yml` from the Metadata Kernel.
19+
2. Resolves permissions (can the user see this page?).
20+
3. Injects the `PageContext` provider.
21+
4. Renders the appropriate **Layout** renderer.
22+
23+
### `DashboardLayout`
24+
**Implements:** `layout: dashboard` / `layout: grid`
25+
26+
A Responsive Grid Layout Engine (based on `react-grid-layout` or CSS Grid).
27+
28+
- **Features**:
29+
- **Grid System**: 12-column grid.
30+
- **Responsive**: Stacks widgets on mobile, respects `(x, y, w, h)` on desktop.
31+
- **Editable**: (Future) Allows dragging widgets to rearrange if user has "Customize Page" permission.
32+
33+
### `SingleColumnLayout`
34+
**Implements:** `layout: single_column` / `layout: list`
35+
36+
A simple stack layout, mostly used for Wiki-style pages or Mobile app views.
37+
38+
---
39+
40+
## 2. Page Components (Widgets)
41+
42+
These are the "Blocks" that live inside a Layout. In `*.page.yml`, these are the items in the `components` array.
43+
44+
### `WidgetMetric`
45+
**Type:** `metric`
46+
Displays a single KPI with trend indicator.
47+
- **Props**: `label`, `value` (expression or query), `trend`, `format`.
48+
- **UI**: A compact card (`Card`, `CardHeader`, `CardContent`).
49+
50+
### `WidgetChart`
51+
**Type:** `chart`
52+
Renders a visualization.
53+
- **Props**: `chart_id`.
54+
- **Behavior**: Use the `chart_id` to fetch the Chart definition (`*.chart.yml`), then renders the appropriate **Visualization Primitive** (see Section 7).
55+
56+
### `WidgetView`
57+
**Type:** `view`
58+
Embeds a full `ObjectView` inside a dashboard tile.
59+
- **Props**: `view_id` OR (`object`, `view`).
60+
- **Behavior**: Renders the `<ObjectView />` component (see Section 3) within a constrained container. Key difference: The toolbar might be simplified (e.g., no global search) to fit into a widget.
61+
62+
### `WidgetHtml`
63+
**Type:** `html` / `markdown`
64+
Renders static or dynamic content.
65+
- **Props**: `content` (HTML/Markdown string).
66+
67+
---
68+
69+
## 3. View Architecture
670

7-
The entry point for rendering any object view.
71+
The system for rendering Object Data Collections. Can appear standalone (as a full page) or inside a Widget.
872

973
### `ObjectView`
1074
The "Switchboard" component. It connects to the Metadata Registry, fetches the requested view definition (YAML), and renders the appropriate concrete View Component.
@@ -20,9 +84,9 @@ The "Switchboard" component. It connects to the Metadata Registry, fetches the r
2084

2185
---
2286

23-
## 2. Standard View Components
87+
## 4. View Component Library
2488

25-
These "Smart Components" implement the specific logic for each View Type defined in the spec.
89+
These "Smart Components" implement the specific logic for each View Type defined in `*.view.yml`.
2690

2791
### `ObjectGridView`
2892
**Implements:** `type: list`, `type: grid`
@@ -103,9 +167,9 @@ A full-featured editor for creating or updating records.
103167

104168
---
105169

106-
## 3. Structural Components
170+
## 5. Layout & Shell
107171

108-
Building blocks for the View layouts.
172+
Building blocks for the outer application shell and view wrappers.
109173

110174
### `ViewToolbar`
111175
The header bar rendered above any view.
@@ -124,7 +188,7 @@ A complex filter construction UI.
124188

125189
---
126190

127-
## 📝 4. Field Components
191+
## 6. Field System
128192

129193
The `Field` component is the factory that decides which specific widget to render inside Forms, Cells, and Cards.
130194

@@ -146,9 +210,9 @@ The `Field` component is the factory that decides which specific widget to rende
146210

147211
---
148212

149-
## 📊 5. Visualization Components
213+
## 7. Visualization Primitives
150214

151-
Standard charting for Dashboards (`*.page.yml`).
215+
Low-level charting components used by `WidgetChart`.
152216

153217
### `ChartAreaInteractive`
154218
Interactive area chart for trends.
@@ -161,7 +225,7 @@ Donut/Pie chart for part-to-whole analysis.
161225

162226
---
163227

164-
## 🎨 6. Design System Primitives
228+
## 8. UI Atoms
165229

166230
We strictly use **Tailwind CSS** and **Radix UI** (shadcn/ui) primitives.
167231

0 commit comments

Comments
 (0)