Files
editor/packages/nodes/src/index.ts
T
Wassim SAMADandClaude Opus 4.7 9eced06f32 Phase 5 batch: door + window migrate to registry (always-on)
Both kinds share traits — hosted on walls, cuttable, animated open/
close state via a geometry system + animation system. Stage A
migration: register + wrap-export the legacy renderer + bundle both
per-kind systems. Pure geometry + floor-plan ports are later
milestones.

Files added (packages/nodes/src/door/, packages/nodes/src/window/):
 - schema.ts: re-export from core.
 - parametrics.ts: minimal — dimensions only. Door has 29 sliders +
   segmented controls + presets in its legacy panel; window has 15+
   sliders. Auto-inspector can't cover them at Stage A — legacy
   panel keeps rendering via panel-manager.tsx case fall-through.
   Stage E may extend parametrics or use parametrics.customPanel
   escape hatch.
 - definition.ts: capabilities (no `movable` — wall-bound drag is
   bespoke; capability-driven dispatch keeps legacy MoveDoorTool /
   MoveWindowTool), parametrics, renderer, system. defaults() uses
   `DoorNode.parse({...stub})` to leverage zod's schema-level
   `.default()` annotations — door has 40+ fields, window has 20+;
   listing them inline duplicates the schema.
 - renderer.tsx: wrap-export of legacy DoorRenderer / WindowRenderer
   (thin 33-36 lines each).
 - system.tsx: bundles each kind's TWO systems — DoorSystem +
   DoorAnimationSystem, WindowSystem + WindowAnimationSystem. Both
   per-kind systems mount via RegisteredSystems when the kind is
   registry-driven; `<LegacySystem kind="door|window">` wrappers
   around each individual system short-circuit.
 - index.ts: barrel.

Files changed:
 - packages/viewer/src/index.ts: new public exports for DoorRenderer,
   DoorSystem, DoorAnimationSystem, WindowRenderer, WindowSystem,
   WindowAnimationSystem.
 - packages/nodes/src/index.ts: appends doorDefinition + windowDefinition.
 - packages/editor/src/components/ui/panels/door-panel.tsx + window-
   panel.tsx: panel slider-drag fix recipe applied. Drop the
   subscribed `updateNode` action, drop the `node` dep from
   handleUpdate / previewDoorUpdate / commitDoorPreview useCallbacks.
   Use useScene.getState() inside. Door panel has 29 SliderControls,
   window 15+ — both at high risk of the Maximum update depth
   cascade without the fix.

Phase 5 progress: shelf , spawn , wall , fence , slab , ceiling ,
door , window . Eight kinds on the registry. Item / stair / roof /
zone / containers remain.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 15:10:17 -04:00

52 lines
2.1 KiB
TypeScript

import type { AnyNodeDefinition, Plugin } from '@pascal-app/core'
import { ceilingDefinition } from './ceiling'
import { doorDefinition } from './door'
import { fenceDefinition } from './fence'
import { shelfDefinition } from './shelf'
import { slabDefinition } from './slab'
import { spawnDefinition } from './spawn'
import { wallDefinition } from './wall'
import { windowDefinition } from './window'
/**
* Built-in plugin bundling every node kind shipped with the Pascal editor.
*
* Apps load this once at bootstrap (`loadPlugin(builtinPlugin)`) before
* mounting the viewer. New built-in nodes are added by creating a folder
* here under `src/<kind>/` and appending its `NodeDefinition` below.
*
* External plugins follow the exact same shape — same `Plugin` type, same
* `loadPlugin` call path. This is intentional: the API is stress-tested
* by built-ins before any third-party plugin lands.
*
* All four current kinds are registered unconditionally. Parity is
* verified by comparing against deployed production rather than an
* in-app env-var flag toggle. Legacy paths still exist in `viewer/` and
* `editor/` for kinds undergoing migration; they short-circuit via the
* Phase 0 `<LegacySystem>` wrapper + `NodeRenderer`'s registry-first
* dispatch. Phase 6 deletes the legacy paths.
*/
export const builtinPlugin: Plugin = {
id: 'pascal:core',
apiVersion: 1,
nodes: [
shelfDefinition as unknown as AnyNodeDefinition,
spawnDefinition as unknown as AnyNodeDefinition,
wallDefinition as unknown as AnyNodeDefinition,
fenceDefinition as unknown as AnyNodeDefinition,
slabDefinition as unknown as AnyNodeDefinition,
ceilingDefinition as unknown as AnyNodeDefinition,
doorDefinition as unknown as AnyNodeDefinition,
windowDefinition as unknown as AnyNodeDefinition,
],
}
export { ceilingDefinition } from './ceiling'
export { doorDefinition } from './door'
export { fenceDefinition } from './fence'
export { shelfDefinition } from './shelf'
export { slabDefinition } from './slab'
export { spawnDefinition } from './spawn'
export { wallDefinition } from './wall'
export { windowDefinition } from './window'