Skip to content

Commit d68508c

Browse files
committed
2 parents 0426668 + d40be3d commit d68508c

32 files changed

Lines changed: 2908 additions & 36 deletions

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ apps/site/.source
5858

5959
# Test artifacts
6060
test-screenshots
61+
test-results
62+
playwright-report
6163

6264
# Vite timestamp files
6365
*.timestamp-*.mjs

ROADMAP.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,26 +70,26 @@ ObjectUI is a universal Server-Driven UI (SDUI) engine built on React + Tailwind
7070
#### 1.1 Test System Enhancement (4 weeks)
7171
**Target:** 80%+ test coverage
7272

73-
- [ ] Add tests for all core modules (@object-ui/core)
74-
- [ ] Add tests for all components (@object-ui/components)
75-
- [ ] Add E2E test framework (Playwright)
73+
- [x] Add tests for all core modules (@object-ui/core)
74+
- [x] Add tests for all components (@object-ui/components)
75+
- [x] Add E2E test framework (Playwright)
7676
- [ ] Add performance benchmark suite
7777
- [ ] Visual regression tests (Storybook snapshot + Chromatic)
7878

7979
#### 1.2 Internationalization (i18n) Support (3 weeks)
8080
**Target:** 10+ languages, RTL layout
8181

82-
- [ ] Create @object-ui/i18n package
83-
- [ ] Integrate i18next library
84-
- [ ] Add translation support to all components
85-
- [ ] Provide 10+ language packs (zh, en, ja, ko, de, fr, es, pt, ru, ar)
86-
- [ ] RTL layout support
87-
- [ ] Date/currency formatting utilities
82+
- [x] Create @object-ui/i18n package
83+
- [x] Integrate i18next library
84+
- [x] Add translation support to all components
85+
- [x] Provide 10+ language packs (zh, en, ja, ko, de, fr, es, pt, ru, ar)
86+
- [x] RTL layout support
87+
- [x] Date/currency formatting utilities
8888

8989
#### 1.3 Documentation System Upgrade (2 weeks)
9090
**Target:** World-class documentation
9191

92-
- [ ] 5-minute quick start guide
92+
- [x] 5-minute quick start guide
9393
- [ ] Complete zero-to-deployment tutorial
9494
- [ ] Video tutorial series
9595
- [ ] Complete case studies (CRM, E-commerce, Analytics, Workflow)
@@ -98,6 +98,9 @@ ObjectUI is a universal Server-Driven UI (SDUI) engine built on React + Tailwind
9898
#### 1.4 Performance Optimization (3 weeks)
9999
**Target:** 50%+ performance improvement
100100

101+
- [x] Enhanced lazy loading with retry and error boundaries
102+
- [x] Plugin preloading utilities
103+
101104
**Performance Targets:**
102105
- First Contentful Paint: 800ms → 400ms
103106
- Largest Contentful Paint: 1.2s → 600ms

content/docs/guide/meta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"title": "Guide",
33
"pages": [
4+
"quick-start",
45
"architecture",
56
"schema-rendering",
67
"layout",

content/docs/guide/quick-start.md

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
---
2+
title: "Quick Start"
3+
description: "Get up and running with ObjectUI in 5 minutes - install, configure, and render your first server-driven UI"
4+
---
5+
6+
# Quick Start
7+
8+
Get up and running with ObjectUI in **5 minutes**. This guide walks you through installation, basic setup, and rendering your first server-driven UI.
9+
10+
## Prerequisites
11+
12+
- **Node.js** 20+
13+
- **pnpm** 9+ (recommended) or npm/yarn
14+
- Basic knowledge of **React** and **TypeScript**
15+
16+
## Step 1: Create a React Project
17+
18+
If you don't have an existing React project, create one with Vite:
19+
20+
```bash
21+
pnpm create vite my-app --template react-ts
22+
cd my-app
23+
```
24+
25+
## Step 2: Install ObjectUI
26+
27+
Install the core ObjectUI packages:
28+
29+
```bash
30+
pnpm add @object-ui/react @object-ui/core @object-ui/types @object-ui/components @object-ui/fields
31+
```
32+
33+
Install Tailwind CSS (required for styling):
34+
35+
```bash
36+
pnpm add -D tailwindcss @tailwindcss/vite
37+
```
38+
39+
## Step 3: Configure Tailwind CSS
40+
41+
Add Tailwind to your `vite.config.ts`:
42+
43+
```ts
44+
import { defineConfig } from 'vite';
45+
import react from '@vitejs/plugin-react';
46+
import tailwindcss from '@tailwindcss/vite';
47+
48+
export default defineConfig({
49+
plugins: [react(), tailwindcss()],
50+
});
51+
```
52+
53+
Add to your `src/index.css`:
54+
55+
```css
56+
@import "tailwindcss";
57+
```
58+
59+
## Step 4: Register Components
60+
61+
Create `src/setup.ts` to register the built-in components:
62+
63+
```ts
64+
import { Registry } from '@object-ui/core';
65+
import { registerAllComponents } from '@object-ui/components';
66+
import { registerAllFields } from '@object-ui/fields';
67+
68+
// Register the built-in component renderers
69+
registerAllComponents(Registry);
70+
registerAllFields(Registry);
71+
```
72+
73+
## Step 5: Render Your First UI
74+
75+
Replace `src/App.tsx` with:
76+
77+
```tsx
78+
import './setup';
79+
import { SchemaRenderer } from '@object-ui/react';
80+
81+
// Define your UI as JSON schema
82+
const schema = {
83+
type: 'form',
84+
fields: [
85+
{
86+
name: 'name',
87+
label: 'Full Name',
88+
type: 'string',
89+
required: true,
90+
},
91+
{
92+
name: 'email',
93+
label: 'Email Address',
94+
type: 'string',
95+
widget: 'email',
96+
},
97+
{
98+
name: 'role',
99+
label: 'Role',
100+
type: 'string',
101+
widget: 'select',
102+
options: [
103+
{ label: 'Admin', value: 'admin' },
104+
{ label: 'Editor', value: 'editor' },
105+
{ label: 'Viewer', value: 'viewer' },
106+
],
107+
},
108+
],
109+
submitLabel: 'Create User',
110+
};
111+
112+
function App() {
113+
return (
114+
<div className="max-w-md mx-auto p-8">
115+
<h1 className="text-2xl font-bold mb-6">ObjectUI Demo</h1>
116+
<SchemaRenderer
117+
schema={schema}
118+
onSubmit={(data) => {
119+
console.log('Form submitted:', data);
120+
alert(JSON.stringify(data, null, 2));
121+
}}
122+
/>
123+
</div>
124+
);
125+
}
126+
127+
export default App;
128+
```
129+
130+
## Step 6: Run the App
131+
132+
```bash
133+
pnpm dev
134+
```
135+
136+
Open [http://localhost:5173](http://localhost:5173) — you should see a fully functional form rendered from JSON!
137+
138+
## What Just Happened?
139+
140+
1. **JSON Schema** → You defined a form as a JSON object with fields, types, and labels
141+
2. **Registry** → Built-in components were registered to handle each schema type
142+
3. **SchemaRenderer** → Converted the JSON into interactive React components (Shadcn UI)
143+
4. **Zero UI Code** → No JSX needed for the form fields — it's all driven by data
144+
145+
## Next Steps
146+
147+
### Add a Data Table
148+
149+
```tsx
150+
const tableSchema = {
151+
type: 'crud',
152+
resource: 'users',
153+
columns: [
154+
{ name: 'name', label: 'Name' },
155+
{ name: 'email', label: 'Email' },
156+
{ name: 'role', label: 'Role' },
157+
],
158+
};
159+
```
160+
161+
### Add Internationalization
162+
163+
```bash
164+
pnpm add @object-ui/i18n
165+
```
166+
167+
```tsx
168+
import { I18nProvider } from '@object-ui/i18n';
169+
170+
function App() {
171+
return (
172+
<I18nProvider config={{ defaultLanguage: 'zh' }}>
173+
<SchemaRenderer schema={schema} />
174+
</I18nProvider>
175+
);
176+
}
177+
```
178+
179+
### Use Lazy Loading for Plugins
180+
181+
```tsx
182+
import { createLazyPlugin } from '@object-ui/react';
183+
184+
const ObjectGrid = createLazyPlugin(
185+
() => import('@object-ui/plugin-grid'),
186+
{ fallback: <div>Loading grid...</div> }
187+
);
188+
```
189+
190+
### Learn More
191+
192+
- [Architecture Overview](/docs/guide/architecture) — Understand how ObjectUI works
193+
- [Schema Rendering](/docs/guide/schema-rendering) — Deep dive into schema rendering
194+
- [Component Registry](/docs/guide/component-registry) — Customize and extend components
195+
- [Plugins](/docs/guide/plugins) — Add views like Grid, Kanban, Charts
196+
- [Fields Guide](/docs/guide/fields) — All 30+ field types

e2e/smoke.spec.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { test, expect } from '@playwright/test';
2+
3+
/**
4+
* Smoke test to verify the console app loads correctly.
5+
* This is a foundational E2E test that validates the basic app shell.
6+
*/
7+
test.describe('Console App', () => {
8+
test('should load the home page', async ({ page }) => {
9+
await page.goto('/');
10+
// Wait for the app to render
11+
await page.waitForLoadState('networkidle');
12+
// The page should have rendered something (not blank)
13+
const body = page.locator('body');
14+
await expect(body).not.toBeEmpty();
15+
});
16+
17+
test('should display the navigation sidebar', async ({ page }) => {
18+
await page.goto('/');
19+
await page.waitForLoadState('networkidle');
20+
// The app shell should contain a navigation area
21+
const nav = page.locator('nav').first();
22+
await expect(nav).toBeVisible();
23+
});
24+
25+
test('should have correct page title', async ({ page }) => {
26+
await page.goto('/');
27+
await expect(page).toHaveTitle(/.+/);
28+
});
29+
});

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@
6161
"changeset:version": "changeset version",
6262
"changeset:publish": "changeset publish",
6363
"pretest:coverage": "turbo run build --filter=@object-ui/types --filter=@object-ui/core --filter=@object-ui/react --filter=@object-ui/components --filter=@object-ui/fields --filter=@object-ui/layout --filter=@object-ui/plugin-kanban --filter=@object-ui/plugin-charts --filter=@object-ui/plugin-form --filter=@object-ui/plugin-grid --filter=@object-ui/plugin-dashboard",
64-
"test:compliance": "vitest run src/__tests__/compliance.test.tsx"
64+
"test:compliance": "vitest run src/__tests__/compliance.test.tsx",
65+
"test:e2e": "playwright test",
66+
"test:e2e:ui": "playwright test --ui"
6567
},
6668
"devDependencies": {
6769
"@changesets/cli": "^2.29.8",
@@ -99,6 +101,7 @@
99101
"jsdom": "^28.0.0",
100102
"msw": "^2.12.7",
101103
"msw-storybook-addon": "^2.0.6",
104+
"@playwright/test": "^1.58.2",
102105
"playwright": "^1.58.0",
103106
"prettier": "^3.8.1",
104107
"react": "19.2.4",

0 commit comments

Comments
 (0)