Skip to content

Commit b0d9ab2

Browse files
committed
Merge branch 'main' into copilot/add-draggable-components-in-designer
2 parents e2aa9b8 + 0c94c51 commit b0d9ab2

61 files changed

Lines changed: 740 additions & 60 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/.copilot-instructions.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# Role & Vision
2+
You are the Lead Frontend Architect for **Object UI** (@object-ui), a next-generation, schema-driven rendering engine designed to replace legacy low-code frameworks.
3+
4+
**Your Mission:**
5+
Build a high-performance, headless, and modular UI engine that renders **ObjectQL** data definitions into modern user interfaces.
6+
7+
**The Trinity Context:**
8+
- **ObjectQL** (Protocol): Defines the Data Schema & Driver Interface.
9+
- **ObjectOS** (System): Handles Permissions, Triggers & Backend Logic.
10+
- **Object UI** (View): **YOU ARE HERE.** Handles JSON Rendering & Interaction.
11+
12+
---
13+
14+
# Tech Stack & Constraints
15+
16+
- **Core:** React 18+, TypeScript 5.0+ (Strict Mode).
17+
- **Build:** Vite (Library Mode), TurboRepo (Monorepo).
18+
- **Styling:** Tailwind CSS (Utility-first), `clsx` + `tailwind-merge` (via `cn()` utility).
19+
- **UI Base:** Shadcn UI (Radix UI primitives).
20+
- **State Management:** React Context / Zustand (for DataScope).
21+
- **Package Manager:** pnpm.
22+
23+
---
24+
25+
# Monorepo Structure & Responsibilities
26+
27+
You must strictly adhere to the module boundaries:
28+
29+
1. **`packages/core` (The Brain)**
30+
- **Content:** Pure TypeScript logic. `Registry`, `DataScope`, `Evaluator`, `Schema Definitions`.
31+
- **Rule:** NO React dependencies. NO UI code. This must run in Node.js if needed.
32+
- **Testing:** 100% Unit Test coverage via Vitest.
33+
34+
2. **`packages/react` (The Glue)**
35+
- **Content:** `SchemaRenderer` component, React Hooks (`useRenderer`, `useDataScope`).
36+
- **Rule:** Connects `core` logic to React lifecycle.
37+
38+
3. **`packages/components` (The Body)**
39+
- **Content:** The official standard UI implementation.
40+
- **Structure:**
41+
- `src/ui/*`: Raw Shadcn components (Base bricks).
42+
- `src/renderers/*`: ObjectUI wrappers that map Schema -> Shadcn.
43+
- **Rule:** Native Tailwind only. No external heavy libs (like AntD).
44+
45+
4. **`packages/plugins/*` (The Weapons)**
46+
- **Content:** Heavy integrations (AG Grid, DevExpress, Monaco).
47+
- **Rule:** Lazy loaded. Must implement the standard Renderer Interface.
48+
49+
---
50+
51+
# Coding Standards
52+
53+
## 1. Schema-First Development
54+
Always start by defining the Interface in `packages/core/src/types`.
55+
```typescript
56+
// Example: packages/core/src/types/components.ts
57+
export interface ButtonSchema extends BaseSchema {
58+
type: 'button';
59+
label: string;
60+
level?: 'primary' | 'secondary' | 'danger';
61+
actionType?: 'submit' | 'ajax' | 'dialog';
62+
}
63+
64+
2. Component Pattern
65+
When creating a new Renderer, follow this pattern:
66+
* Import the raw UI component from @/ui.
67+
* Import the Schema type from @object-ui/core.
68+
* Implement the Renderer to handle data binding and events.
69+
<!-- end list -->
70+
// packages/components/src/renderers/ButtonRenderer.tsx
71+
import React from 'react';
72+
import { Button } from '@/ui/button'; // Shadcn Base
73+
import { ButtonSchema } from '@object-ui/core';
74+
75+
export const ButtonRenderer: React.FC<{ schema: ButtonSchema; onClick: () => void }> = ({ schema, onClick }) => {
76+
// Map schema props to UI props
77+
const variantMap = { primary: 'default', secondary: 'outline', danger: 'destructive' };
78+
79+
return (
80+
<Button
81+
variant={variantMap[schema.level || 'primary']}
82+
className={schema.className}
83+
onClick={onClick}
84+
>
85+
{schema.label}
86+
</Button>
87+
);
88+
};
89+
90+
3. Styling Rules
91+
* Tailwind Only: Do not create .css or .module.css files.
92+
* Merge Classes: Always use cn(defaultClasses, schema.className) to allow user overrides.
93+
* Design System: Stick to Slate/Gray for neutrals, Blue/Primary for actions. Match the "Salesforce/Enterprise" aesthetic: clean, dense, professional.
94+
4. Data Scope & Expressions
95+
* If a string starts with ${ and ends with }, treat it as an expression.
96+
* Use the evalExpression(expression, dataScope) utility from core.
97+
* Do not use eval(). Use the safe evaluator provided in core.
98+
Workflow Instructions
99+
When asked to "Add a new component X":
100+
* Define the XSchema interface in packages/core.
101+
* Check if packages/components/src/ui/X exists (Shadcn base). If not, ask to generate it or use npx shadcn@latest add X.
102+
* Create packages/components/src/renderers/XRenderer.tsx.
103+
* Export it in packages/components/src/index.ts.
104+
* Register it in the Registry (if applicable).
105+
When asked to "Implement AG Grid":
106+
* Work strictly within packages/plugins/ag-grid.
107+
* Do NOT modify packages/components.
108+
* Ensure it implements the standard GridRenderer interface but uses ag-grid-react internally.
109+
When asked to "Fix a bug":
110+
* Check packages/core for logic errors first.
111+
* Check packages/components for rendering errors second.
112+
* Always write a regression test.
113+
Key Philosophy
114+
* "Low Code, High Control": We are building an engine, not just a library.
115+
* "Tailwind Native": If it's not Tailwind, it doesn't belong in the core components.
116+
* "One Protocol, Many Engines": The Schema is the source of truth. The Renderer is just one implementation.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 ObjectQL
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

docs/guide/installation.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,30 @@ Object UI is distributed as several packages:
1616

1717
| Package | Description | Required |
1818
|---------|-------------|----------|
19-
| `@object-ui/protocol` | Type definitions and schemas | Optional |
20-
| `@object-ui/engine` | Core logic and state management | Optional |
21-
| `@object-ui/react` | React integration and hooks | **Yes** |
22-
| `@object-ui/components` | UI component library | **Yes** |
23-
| `@object-ui/designer` | Visual designer (Q3 2026) | Optional |
19+
| `@object-ui/protocol` | Type definitions and schemas | Yes |
20+
| `@object-ui/renderer` | The core compiler that turns JSON into React | Yes |
21+
| `@object-ui/ui` | The visual component library (Shadcn extended) | Yes |
22+
| `@object-ui/designer` | Visual schema editor and builder | Optional |
2423

2524
## Basic Installation
2625

27-
For most projects, you only need two packages:
26+
To get started, install the core packages:
2827

2928
::: code-group
3029

3130
```bash [npm]
31+
npm install @object-ui/renderer @object-ui/ui @object-ui/protocol
32+
```
33+
34+
```bash [pnpm]
35+
pnpm add @object-ui/renderer @object-ui/ui @object-ui/protocol
36+
```
37+
38+
```bash [yarn]
39+
yarn add @object-ui/renderer @object-ui/ui @object-ui/protocol
40+
```
41+
42+
:::bash [npm]
3243
npm install @object-ui/react @object-ui/components
3344
```
3445

docs/index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ hero:
1414
link: /guide/introduction
1515
- theme: alt
1616
text: View Roadmap
17-
link: /roadmap
17+
link: /ROADMAP
1818
- theme: alt
1919
text: GitHub
2020
link: https://github.com/objectql/object-ui
@@ -28,9 +28,9 @@ features:
2828
title: Beautiful by Default
2929
details: Professional designs out of the box with Tailwind CSS and Shadcn/UI. Light/dark themes and full customization support.
3030

31-
- icon: 🔧
32-
title: Developer Friendly
33-
details: Full TypeScript support, standard React patterns, and complete control. Export to code anytime.
31+
- icon: �️
32+
title: Visual Designer
33+
details: Drag-and-drop editor to build UIs visually. Real-time preview, property panels, and instant JSON export.
3434

3535
- icon: 🚀
3636
title: Schema Driven

docs/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "object-ui-docs",
33
"version": "0.1.0",
44
"private": true,
5+
"license": "MIT",
56
"type": "module",
67
"scripts": {
78
"dev": "vitepress dev",

examples/awesome-components/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
"build": "rollup -c",
1919
"dev": "rollup -c -w",
2020
"prepublishOnly": "npm run build",
21-
"test": "vitest run",
22-
"lint": "eslint src --ext .ts,.tsx"
21+
"test": "echo 'No tests yet'",
22+
"lint": "echo 'No lint config'"
2323
},
2424

2525
"peerDependencies": {
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import js from '@eslint/js'
2+
import globals from 'globals'
3+
import reactHooks from 'eslint-plugin-react-hooks'
4+
import reactRefresh from 'eslint-plugin-react-refresh'
5+
import tseslint from 'typescript-eslint'
6+
import { defineConfig, globalIgnores } from 'eslint/config'
7+
8+
export default defineConfig([
9+
globalIgnores(['dist']),
10+
{
11+
files: ['**/*.{ts,tsx}'],
12+
extends: [
13+
js.configs.recommended,
14+
tseslint.configs.recommended,
15+
reactHooks.configs.flat.recommended,
16+
reactRefresh.configs.vite,
17+
],
18+
languageOptions: {
19+
ecmaVersion: 2020,
20+
globals: globals.browser,
21+
},
22+
},
23+
])

examples/designer-demo/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "@examples/designer-demo",
33
"private": true,
4+
"license": "MIT",
45
"version": "0.0.0",
56
"type": "module",
67
"scripts": {
@@ -18,6 +19,7 @@
1819
"react-dom": "^19.2.3"
1920
},
2021
"devDependencies": {
22+
"@eslint/js": "^9.39.1",
2123
"@types/node": "^24.10.1",
2224
"@types/react": "^19.2.3",
2325
"@types/react-dom": "^19.2.3",

examples/designer-demo/src/App.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// @ts-nocheck
21
import React, { useState } from 'react';
32
import { Designer } from '@object-ui/designer';
43
import type { SchemaNode } from '@object-ui/protocol';

examples/designer-demo/src/main.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// @ts-nocheck
21
import React from 'react'
32
import ReactDOM from 'react-dom/client'
43
import App from './App.tsx'

0 commit comments

Comments
 (0)