Skip to content

Commit 5826f05

Browse files
committed
refactor: cleanup docs and refactor code generation, events and focus system
1 parent 837eb4e commit 5826f05

26 files changed

Lines changed: 1080 additions & 1419 deletions

AGENTS.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# PROJECT KNOWLEDGE BASE
22

3-
**Generated:** 2026-01-10 **Branch:** main **Commit:** 705a3f5
3+
**Generated:** 2026-01-10 12:08:15 **Branch:** main **Commit:** 0b279f8
44

55
## OVERVIEW
66

@@ -17,7 +17,7 @@ gpui-react/
1717
│ ├── core/ # FFI abstraction (RustLib, FFI state, bindings)
1818
│ ├── reconciler/ # React reconciler + FFI bindings + event router
1919
│ └── events/ # Event types, factory, router (10 files)
20-
├── demo/ # Demo apps (7 entry points)
20+
├── demo/ # Demo apps (3 subdirs: canvas, drawing-board, event)
2121
└── scripts/ # Build/release scripts
2222
```
2323

@@ -85,13 +85,10 @@ gpui-react/
8585

8686
```bash
8787
just native # Build Rust native library
88-
bun run demo # Basic demo
89-
bun run styled-demo # CSS styling demo
90-
bun run flex-demo # Flexbox layout demo
91-
bun run elements-demo # Element types demo
92-
bun run event-demo # Event handling demo
93-
bun run focus-demo # Focus/hover demo
94-
bun run src/reconciler/__tests__/element-store.test.ts # Run tests
88+
bun run event-demo # Event handling demo
89+
bun run drawing-demo # Drawing board demo
90+
bun run canvas-demo # Canvas element demo
91+
bun run test # Run element-store tests
9592
bun run format # Format all code (staged files)
9693
bun run format:ts # Format TypeScript only
9794
bun run format:rust # Format Rust only

CLAUD.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

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) 2026 fzdwx <likelovec@gmail.com>
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.

ROADMAP.md

Lines changed: 0 additions & 176 deletions
This file was deleted.

demo/drawing-board/app.tsx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,16 @@ interface Stroke {
1212
width: number;
1313
}
1414

15-
const COLORS = ["#000000", "#ff6b6b", "#4ecdc4", "#45b7d1", "#96ceb4", "#ffeaa7", "#dfe6e9", "#ffffff"];
15+
const COLORS = [
16+
"#000000",
17+
"#ff6b6b",
18+
"#4ecdc4",
19+
"#45b7d1",
20+
"#96ceb4",
21+
"#ffeaa7",
22+
"#dfe6e9",
23+
"#ffffff",
24+
];
1625
const BRUSH_SIZES = [2, 4, 8, 12, 20];
1726

1827
export function DrawingBoardApp() {
@@ -160,15 +169,19 @@ export function DrawingBoardApp() {
160169
backgroundColor: color,
161170
borderRadius: 4,
162171
border:
163-
selectedColor === color ? "3px solid #74b9ff" : "2px solid #636e72",
172+
selectedColor === color
173+
? "3px solid #74b9ff"
174+
: "2px solid #636e72",
164175
cursor: "pointer",
165176
}}
166177
/>
167178
))}
168179
</div>
169180

170181
{/* Brush Size */}
171-
<div style={{ display: "flex", flexDirection: "row", gap: 8, alignItems: "center" }}>
182+
<div
183+
style={{ display: "flex", flexDirection: "row", gap: 8, alignItems: "center" }}
184+
>
172185
<div style={{ color: "#b2bec3", fontSize: 12 }}>Brush:</div>
173186
{BRUSH_SIZES.map((size) => (
174187
<div

demo/event/app.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import {useState} from "react";
1+
import { useState } from "react";
22

33
export function EventApp() {
44
const [clickCount, setClickCount] = useState(0);
55
const [mouseState, setMouseState] = useState("idle");
6-
const [mousePos, setMousePos] = useState({x: 0, y: 0});
6+
const [mousePos, setMousePos] = useState({ x: 0, y: 0 });
77
const [lastKey, setLastKey] = useState("");
8-
const [scrollDelta, setScrollDelta] = useState({x: 0, y: 0});
8+
const [scrollDelta, setScrollDelta] = useState({ x: 0, y: 0 });
99

1010
return (
1111
<div
@@ -63,7 +63,9 @@ export function EventApp() {
6363
}}
6464
onMouseDown={() => setMouseState("down")}
6565
onMouseUp={() => setMouseState("up")}
66-
onMouseMove={(e) => setMousePos({x: Math.round(e.clientX), y: Math.round(e.clientY)})}
66+
onMouseMove={(e) =>
67+
setMousePos({ x: Math.round(e.clientX), y: Math.round(e.clientY) })
68+
}
6769
>
6870
<div>{"Mouse: " + mouseState}</div>
6971
<div>{"Position: " + mousePos.x + ", " + mousePos.y}</div>
@@ -101,7 +103,9 @@ export function EventApp() {
101103
alignItems: "center",
102104
justifyContent: "center",
103105
}}
104-
onWheel={(e) => setScrollDelta({x: Math.round(e.deltaX), y: Math.round(e.deltaY)})}
106+
onWheel={(e) =>
107+
setScrollDelta({ x: Math.round(e.deltaX), y: Math.round(e.deltaY) })
108+
}
105109
>
106110
{"Wheel: " + scrollDelta.x + ", " + scrollDelta.y}
107111
</div>

0 commit comments

Comments
 (0)