@pascal-app/core 0.1.8 → 0.1.10
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 +76 -0
- package/package.json +3 -3
package/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# @pascal-app/core
|
|
2
|
+
|
|
3
|
+
Core library for Pascal 3D building editor.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @pascal-app/core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Peer Dependencies
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install react three @react-three/fiber @react-three/drei
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## What's Included
|
|
18
|
+
|
|
19
|
+
- **Node Schemas** - Zod schemas for all building primitives (walls, slabs, items, etc.)
|
|
20
|
+
- **Scene State** - Zustand store with IndexedDB persistence and undo/redo
|
|
21
|
+
- **Systems** - Geometry generation for walls, floors, ceilings, roofs
|
|
22
|
+
- **Scene Registry** - Fast lookup from node IDs to Three.js objects
|
|
23
|
+
- **Spatial Grid** - Collision detection and placement validation
|
|
24
|
+
- **Event Bus** - Typed event emitter for inter-component communication
|
|
25
|
+
- **Asset Storage** - IndexedDB-based file storage for user-uploaded assets
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import { useScene, WallNode, ItemNode } from '@pascal-app/core'
|
|
31
|
+
|
|
32
|
+
// Create a wall
|
|
33
|
+
const wall = WallNode.parse({
|
|
34
|
+
points: [[0, 0], [5, 0]],
|
|
35
|
+
height: 3,
|
|
36
|
+
thickness: 0.2,
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
useScene.getState().createNode(wall, parentLevelId)
|
|
40
|
+
|
|
41
|
+
// Subscribe to scene changes
|
|
42
|
+
function MyComponent() {
|
|
43
|
+
const nodes = useScene((state) => state.nodes)
|
|
44
|
+
const walls = Object.values(nodes).filter(n => n.type === 'wall')
|
|
45
|
+
|
|
46
|
+
return <div>Total walls: {walls.length}</div>
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Node Types
|
|
51
|
+
|
|
52
|
+
- `SiteNode` - Root container
|
|
53
|
+
- `BuildingNode` - Building within a site
|
|
54
|
+
- `LevelNode` - Floor level
|
|
55
|
+
- `WallNode` - Vertical wall with optional openings
|
|
56
|
+
- `SlabNode` - Floor slab
|
|
57
|
+
- `CeilingNode` - Ceiling surface
|
|
58
|
+
- `RoofNode` - Roof geometry
|
|
59
|
+
- `ZoneNode` - Spatial zone/room
|
|
60
|
+
- `ItemNode` - Furniture, fixtures, appliances
|
|
61
|
+
- `ScanNode` - 3D scan reference
|
|
62
|
+
- `GuideNode` - 2D guide image reference
|
|
63
|
+
|
|
64
|
+
## Systems
|
|
65
|
+
|
|
66
|
+
Systems process dirty nodes each frame to update geometry:
|
|
67
|
+
|
|
68
|
+
- `WallSystem` - Wall geometry with mitering and CSG cutouts
|
|
69
|
+
- `SlabSystem` - Floor polygon generation
|
|
70
|
+
- `CeilingSystem` - Ceiling geometry
|
|
71
|
+
- `RoofSystem` - Roof generation
|
|
72
|
+
- `ItemSystem` - Item positioning on walls/ceilings/floors
|
|
73
|
+
|
|
74
|
+
## License
|
|
75
|
+
|
|
76
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pascal-app/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "Core library for Pascal 3D building editor",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"README.md"
|
|
18
18
|
],
|
|
19
19
|
"scripts": {
|
|
20
|
-
"build": "tsc --
|
|
21
|
-
"dev": "tsc --
|
|
20
|
+
"build": "tsc --build",
|
|
21
|
+
"dev": "tsc --build --watch",
|
|
22
22
|
"prepublishOnly": "npm run build"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|