Commit Graph
298 Commits
Author SHA1 Message Date
ed6ed3f018 fix(editor): release scene singletons on Editor unmount (#214)
The spatial-grid manager, scene-store subscriptions, and the viewer
outliner's Object3D arrays are module-level singletons that previously
lived for the whole page lifetime. When an app unmounted the Editor
(e.g. navigating away from the 3D editor and back in an SPA host) they
retained references to the disposed Three.js scene graph, which caused
the app to freeze on re-entry as the stale data was replayed against a
fresh scene.

- initSpatialGridSync now returns the unsubscribe handle from its
  scene-store subscription so callers can detach it.
- initializeEditorRuntime becomes reversible: it wires up the spatial
  grid, space detection and SFX bus on mount and returns a teardown
  closure that detaches both store subscriptions, clears the spatial
  grid manager, and truncates the viewer outliner's selected/hovered
  arrays in place.
- The Editor component's runtime-init effect now returns that teardown,
  so the singletons are reset cleanly every time the Editor unmounts.
- initSFXBus is now idempotent via an internal guard so repeated
  Editor mounts do not stack duplicate mitt listeners.

Co-authored-by: Claude <noreply@anthropic.com>
2026-04-05 23:37:30 -04:00
PascalandGitHub 0bd0cab533 feat: stair system, scene graph utilities, read-only mode, viewer state improvements (#210)
Stair system (full stack):
- New StairNode + StairSegmentNode schemas with flights, landings, L/U-shapes
- StairSystem: geometry generation with throttled per-frame updates
- Stair tool, edit system, panels, tree node, and renderers
- Event bus types, scene registry, and command palette entries

Scene graph utilities:
- cloneLevelSubtree: deep-clone a level with remapped IDs
- forkSceneGraph: clone + strip scan/guide nodes for project forking

Core improvements:
- Read-only mode on scene store (blocks create/update/delete when locked)
- readOnly guards on node-actions and collection actions
- Upload store for scan/guide file upload handling

Viewer state:
- previewSelectedIds for box-select live preview
- hoverHighlightMode (default/delete) for delete-mode hover outline
2026-04-05 01:20:43 -04:00
Pascal f2f362eda9 release: @pascal-app/core@0.3.3 @pascal-app/viewer@0.3.3 2026-03-31 20:52:13 +00:00
Pascal e84e870248 release: @pascal-app/core@0.3.2 @pascal-app/viewer@0.3.2 2026-03-30 21:10:55 +00:00
Developer 0be6d84c98 refactor: 完善材质系统相关代码
- 修复 node-actions.ts 中 forEach 返回值 lint 警告
- 更新材质 schema 定义和渲染器
- wall-cutout.tsx 材质颜色保留修复
2026-03-30 20:29:29 +08:00
Developer 12b6292623 feat: add material system for all node types
- Add MaterialSchema with 10 presets (white, brick, concrete, wood, glass, metal, plaster, tile, marble, custom)
- Add material field to Wall, Slab, Door, Window, Ceiling, Roof, RoofSegment nodes
- Create MaterialPicker UI component with preset selection and custom properties
- Update all renderers to support material rendering with caching
- Add Material section to all node panels (WallPanel, SlabPanel, DoorPanel, WindowPanel, CeilingPanel, RoofPanel, RoofSegmentPanel)
- Update AGENTS.md with Material System documentation
2026-03-30 12:15:16 +08:00
Pascal 3474ee226d fix: use structuredClone to avoid shared references in cloneSceneGraph
The original implementation used spread ({ ...node }) which only shallow-copies.
Nested objects (asset, polygon, position tuples, metadata) would share references
between the original and cloned scene, meaning mutations to the clone could
corrupt the original.

Also removed resolveChildRefId helper — children arrays in the schema are always
string IDs, so the object-with-id handling was dead code.
2026-03-28 22:45:33 +00:00
Pascal 58676e5720 Merge remote-tracking branch 'origin/main' into feat/duplicate-project 2026-03-28 22:43:18 +00:00
github-actions[bot] f2a22bbc2b release: @pascal-app/core@0.3.1 @pascal-app/viewer@0.3.1 2026-03-26 19:52:23 +00:00
7d4c8b6bd4 fix: resolve state management issues and memory leaks (#152)
This commit fixes several issues in the core state management:

1. Fix deleteNodesAction recursive call issue
   - Previously, the function recursively called get().deleteNodes()
     inside the set() callback, which could cause state inconsistencies.
   - Now collects all descendant IDs first in a separate pass, then
     deletes them all in a single batch operation.

2. Fix memory leak in use-scene temporal tracking
   - Module-level variables (prevPastLength, prevFutureLength,
     prevNodesSnapshot) persisted across store re-creations.
   - Now cleared in unloadScene() to release stale node references.
   - Added clearTemporalTracking() helper function.

3. Remove unused variable in wall-system
   - Removed debug variable 'useFrameNb' that was declared but never used.

4. Fix requestAnimationFrame in updateNodesAction
   - Previously used RAF without cleanup, causing multiple queued
     callbacks when updates happened rapidly.
   - Now uses a single tracked RAF with cancellation support.

Co-authored-by: hobostay <hobostay@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 00:30:16 -04:00
John Doe 9a0950dd90 style: reorder imports 2026-03-26 00:24:45 -04:00
John Doe 8731da9afa fix: childern <> parent link 2026-03-25 23:43:25 -04:00
John Doeandfactory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> a87fe56d53 fix: clear collections in setScene and apply cloned collections in test button
- setScene now clears collections to avoid stale references
- Test clone button applies cloned collections after setScene

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-03-25 22:33:07 -04:00
John Doe de9eb6fa78 feat: add scene graph cloning utility 2026-03-25 22:05:07 -04:00
f06f2fa1b1 feat: 2D editing — floorplan panel, measurements, command palette (v0.3.0)
* sync: port 2D editing features from monorepo (v0.3.0)

## New Features

### Floorplan Panel (7.5K LOC)
- Full 2D editing interface with wall drawing, measurement, and unit display
- Interactive floorplan view with pan/zoom, grid snapping
- Wall thickness visualization, door/window placement
- Zone and slab polygon editing
- Guide image overlay support
- Metric/imperial unit toggle

### Command Palette Overhaul
- Complete rewrite with new command registry system
- Keyboard shortcuts UI with ShortcutToken component
- Editor-specific commands (floorplan, measurements, camera focus)
- Improved search and action organization

### Wall Measurements
- Real-time wall length labels in 3D view
- Metric/imperial conversion
- Wall measurement UI component

### Enhanced Tools
- Wall drafting utilities (grid snapping, validation)
- Node action menu for quick operations
- Improved polygon editing for zones/slabs/sites
- Roof segment panel for granular roof control

## Package Changes

### @pascal-app/core@0.3.0
- New wall-footprint.ts: 2D wall footprint calculation
- Wall mitering exports for floorplan view
- camera-controls:focus event
- Space detection undo pause/resume
- Mark sibling nodes dirty on deletion (miter recalc)

### @pascal-app/viewer@0.3.0
- ErrorBoundary component for robust item rendering
- Broken item fallback UI
- Wall renderer: mark dirty on mount
- Ground occluder: only lowest level punches through
- Unit state (metric/imperial) in viewer store

### @pascal-app/editor@0.1.0
- 48 file changes (16 new, 32 modified)
- New stores: useCommandRegistry, usePaletteViewRegistry
- Tree node drag-and-drop system
- Level selection utilities
- Enhanced scene graph operations

## Apps/Editor
- GeistPixelSquare font for pixel-perfect UI
- Blueprint icon asset
- Updated layout and globals for font support

## Security
- Zero AI imports or internal package refs
- All monorepo-specific code excluded
- Clean audit: no API keys or secrets

## Testing
- Security audit passed 
- All AI/internal code excluded 
- Version bumps applied 

79 files modified, 16 files added
~2600 insertions, ~1400 deletions

* fix: lint cleanup — suppress intentional dep warnings, fix missing dep, remove stale ignores

- Add biome-ignore for 3 intentional useEffect reset patterns (levelId, selectedGuide, selectedId)
- Fix actual missing dependency: currentBuildingId in handleSiteEditShortcutSelect callback
- Remove 3 stale biome-ignore comments in r3f.d.ts (rule not active)

Build and lint pass clean.

* fix: type errors — polygon area guards, selection cast, readonly keywords, door guard

- ceiling-panel, slab-panel, ceiling-tree-node, slab-tree-node, zone-tree-node:
  guard polygon[i]/polygon[j] array access before arithmetic (TS2532)
- scene.ts: introduce toViewerSelection() helper to cast persisted string IDs
  to branded template literal types expected by useViewer.setSelection (TS2345)
- door-panel: guard early return when node is undefined in setSegmentHeightRatio (TS18048)
- editor-commands: remove 'as const' from inline command object, keywords is mutable string[] (TS2322)

All type checks pass. Build and lint clean.

---------

Co-authored-by: Anton Pascal <anton-pascal@users.noreply.github.com>
2026-03-24 19:48:11 +00:00
github-actions[bot] 3791614a9d release: @pascal-app/core@0.2.0 @pascal-app/viewer@0.2.0 2026-03-21 03:21:20 +00:00
1d28e4208f sync: update core and viewer from monorepo (#143)
Major changes:
- Roof system rewrite with roof-segment support
- Scene store refactor
- Spatial grid improvements
- Item light system
- Post-processing and selection manager updates
- Perf monitor component

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 23:18:30 -04:00
wass08 f2501be2bf remove community 2026-03-13 09:07:46 +01:00
wass08 849baa0a0e default value 2026-03-06 13:08:24 +01:00
wass08 bc57afb8fa collections + unify color picker 2026-03-06 13:08:23 +01:00
wass08 54051b11fa item system controls 2026-03-06 13:08:21 +01:00
wass08 927ecba054 schema and interactive store 2026-03-06 13:06:33 +01:00
wass08 d79d54c4d8 evader for preset 2026-03-04 15:17:01 +01:00
wass08 23ed54cb6a thumbnail generation 2026-03-04 15:13:07 +01:00
5ecefbdc06 Feat/ux round 3 (#124)
* Tree: add isLast prop & draw connectors

Introduce an optional isLast prop across all site panel tree node components and TreeNode so children know when they're the last sibling. TreeNodeWrapper now renders vertical and horizontal connector lines (adjusted by depth and isLast) and keeps the toggle button clickable (z-index). Children are passed isLast when mapped, so the UI can stop the vertical line for final siblings. Also bump several deps in apps/editor package.json and update the lockfile accordingly.

* chore: clean up monorepo dependencies and update packages

Move app/library dependencies out of root package.json into their
respective workspaces. Root now only contains monorepo tooling
(turbo, biome, supabase CLI, typescript, portless, ultracite).

Updates:
- next 16.1.0 → 16.1.6
- drizzle-orm ^0.39.0 → ^0.45.1
- drizzle-kit ^0.30.0 → ^0.31.9
- drizzle-zod ^0.5.1 → ^0.8.3
- three-bvh-csg ^0.0.17 → ^0.0.18
- supabase 2.75.3 → 2.76.15
- typescript 5.9.2 → 5.9.3 (all workspaces)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Use semantic theme tokens and enable dark mode

Replace hardcoded zinc color classes with semantic design tokens (text-muted-foreground, text-foreground, border, bg-background, bg-border) across the action menu, camera controls, control modes, and view toggles for consistent theming. Update separators and borders to use bg-border/border-border. Add useEffect in the editor root to add/remove the 'dark' class on document.body and apply 'dark text-foreground' to the root container so the UI renders in dark mode; also import useEffect.

* Persistable sidebar width & resizer

Introduce a zustand store to persist sidebar width (key: `sidebar-preferences`) and track dragging state. Default width is 288px (18rem) and is clamped between 288 and 800px. Wire the store into SidebarProvider to drive the CSS variable for width and expose a data-dragging attribute. Add a SidebarResizer component that handles pointer events to resize the sidebar, toggles dragging state, updates cursor/user-select, and disables transitions while dragging. Small class and structure adjustments ensure the resizer is rendered and resizing behaves smoothly.

* Editor: floating action menu, selection/phase tweaks

Add a FloatingActionMenu (move/duplicate/delete) that attaches to selected 3D nodes and integrates with editor/viewer state; includes new cursor SVG and layout wrapper to use the custom cursor. Improve selection and phase behavior: auto-select first building+level on scene load (moved/centralized in project scene hook and editor init), add resolveBuildingId helper, and enhance SelectionManager to auto-switch between structure/furnish based on clicked nodes and to preserve building/level context when changing selection. Update sidebar tree node click handlers to switch phases for structural vs item nodes and stop hiding nodes by phase (keep tree items visible across phases). Add keyboard escape behavior to clear selections while keeping building/level context and reset selected reference. Misc: register unified event listeners for selection, position floating menu over objects using three.js Box3, and various small integration fixes.

* Add SceneLoader, loading states & editor fixes

Add a SceneLoader component and associated CSS loader styles and wire it into Editor, Viewer and page-level flows so a loading UI displays while project/scene data loads. Replace useLayoutEffect in editor page with a client-mounted useEffect guard to avoid hydration issues. Introduce isSceneLoading state and setter in the project store and set/clear it in useProjectScene; include sceneGraph when creating a new project and clear the scene beforehand.

Other changes: type-guard moving/duplicating logic in FloatingActionMenu and remove duplicated id on clones; refactor auto-selection logic for site/building/level and auto-select build/wall for empty levels in editor index and useProjectScene; optimize ZoneSystem to run per-frame (useFrame) and reduce unnecessary updates to visibility/label positions; add animated active background for layer toggle (motion) in site panel; add keyboard shortcuts to jump between levels (Ctrl/Cmd+ArrowUp/Down); simplify community-hub project-created handler to navigate straight to editor. These changes improve UX during load, enforce safer node operations, and optimize runtime rendering.

* Improve selection logic and refine UI components

Multiple editor and viewer updates:

- Selection: enhance selection-manager to support modifier (Meta/Ctrl) multi-select, compute next selection logic, track modifier keys, prevent grid deselect races, and add debug logs. Adapted selection handlers throughout scene/editor components to pass native events and modifier state.

- Sidebar / Site panel: refactor site panel to inline a LevelReferences UI (replacing the removed references dialog). Add upload flow for scan (.glb/.gltf) and guide images, handling file size/type checks, project asset upload/delete calls, and per-level reference lists. Add MultiSelectionBadge for showing/clearing multi-selection and animated expand/collapse for levels. Several tree-node components now use a shared handleTreeSelection helper and propagate click events properly.

- UI polish & icons: change dark theme color tokens for better contrast; increase button sizes and icon sizes across action menus; swap some lucide icons for image assets (rotate, topview, select, build, mesh, floorplan, level, etc.) and add new public icons.

- PascalRadio: replace popover with a framer-motion expandable panel, add outside-click handling, animated transitions, and minor UI tweaks.

- Other: minor viewer hook/selection-manager updates and tweaks to control modes and view toggles to support image icons and consistent sizing.

These changes improve multi-select reliability, user interactions in the sidebar, and overall visual polish with new icons and animations.

* Fix TypeScript build errors in selection-manager and scene-loader

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 22:09:40 -05:00
wass08 b114e60df7 fix hinge + materials 2026-02-25 14:50:17 +09:00
wass08 7608cad748 nice progress on doors 2026-02-25 14:05:32 +09:00
wass08 27e4afb757 draft custom door 2026-02-25 13:28:42 +09:00
wass08 c53f1f9679 ceiling system + reveal/hide 2026-02-25 08:59:04 +09:00
Wassim SAMADandGitHub 2182fe535d Merge pull request #116 from pascalorg/fix/community-feedback-pass-3
Fix/community feedback pass 3
2026-02-24 16:17:44 +09:00
Aymeric RabotandGitHub db05c86120 Add scene graph viewer and persist migration (#115)
Render an interactive Scene Graph in the Settings panel using @visual-json/react. Introduces SceneNode/SceneGraphNode types and buildSceneGraphValue to build a tree (handles missing nodes and cycles), and adds handlers to block drag/drop/context/delete mutations inside the viewer. Adds @visual-json/react to apps/editor package.json and updates the dev script to forbid .env.local and source the root .env instead. Also adds a persistence migration in use-scene to preserve existing nodes and rootNodeIds when the persist version changes.
2026-02-24 00:40:18 -05:00
wass08 20f5f7ab4a fix wall elevation with slab holes 2026-02-24 10:27:51 +09:00
wass08 3791739b5b mark nodes as dirty after deletion 2026-02-24 08:19:49 +09:00
wass08 5deb0b363e fix render priority for item-system 2026-02-24 07:47:03 +09:00
wass08 d15f601107 item scale 2026-02-23 10:59:42 +09:00
wass08 3894d7c8bf fixing system orders for ensuring level calculation comes last 2026-02-23 09:08:15 +09:00
wass08 16ba5bf9c6 fiix adjacent walls pushed up 2026-02-23 08:22:06 +09:00
wass08 4572c36da5 threejs version upgrade #91 2026-02-20 16:17:56 +09:00
Anton Pascal a6804343bc release: @pascal-app/core@0.1.13 @pascal-app/viewer@0.1.13 2026-02-18 21:55:39 +00:00
Anton Pascal f497d9123a fix: correct repository URLs for npm listings 2026-02-18 20:27:52 +00:00
wass08 e8fcc840d5 surface placement 2026-02-18 16:26:17 +09:00
wass08 c0676f684e item surfaces 2026-02-18 16:06:23 +09:00
wass08 a121460965 fix y position on items 2026-02-18 15:05:25 +09:00
wass08 47373eadef adjusting wall system + adding panel 2026-02-18 13:35:12 +09:00
wass08 be013d26e5 window panel 2026-02-18 13:14:55 +09:00
wass08 076faae7df window building 2026-02-18 10:41:12 +09:00
Anton Pascal ee30f17129 feat: rename properties to projects
- Rename all DB tables: properties → projects, properties_addresses → projects_addresses, properties_models → projects_models, property_likes → projects_likes
- Add projects_likes as proper Drizzle schema table (was SQL-only before)
- Rename ID prefixes: property_xxx → project_xxx
- Rename auth_sessions column: active_property_id → active_project_id
- Simplify project creation: address is now optional (no longer required to get started)
- Update all actions, stores, types, components, and routes
- Rename route: /editor/[propertyId] → /editor/[projectId]
- Add SQL migration for table/column/index/policy/function renames
- Update RPC functions: increment_project_views, get_project_like_count
- Update storage bucket reference: project-thumbnails
- All types/exports follow existing Drizzle patterns (pgTable, relations, zod schemas)
2026-02-17 20:40:52 +00:00
wass08 dd5f63df64 wall tool draft 2026-02-17 16:22:45 +09:00
wass08 13fd1848d1 polish catalog 2026-02-17 14:23:02 +09:00
wass08 d833245fbf esc key cancel tool 2026-02-17 12:29:00 +09:00