Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
3731eb3
Add roof surface placement support for items
sudhir9297 May 18, 2026
ed53bc2
Merge branch 'main' of github.com:pascalorg/editor
sudhir9297 May 20, 2026
fd8e02c
Merge branch 'main' of github.com:pascalorg/editor
sudhir9297 May 20, 2026
7c1e383
fixed conflict
sudhir9297 May 20, 2026
b3377da
Merge branch 'main' of github.com:pascalorg/editor
sudhir9297 May 20, 2026
f177a65
Merge branch 'main' of github.com:pascalorg/editor
sudhir9297 May 22, 2026
9af7491
Merge branch 'main' of github.com:pascalorg/editor
sudhir9297 May 22, 2026
fd27524
Merge branch 'main' of github.com:pascalorg/editor
sudhir9297 May 27, 2026
b516298
Merge branch 'main' of github.com:pascalorg/editor
sudhir9297 May 28, 2026
ebfc8ce
Merge branch 'main' of github.com:pascalorg/editor
sudhir9297 Jun 3, 2026
b7b313b
Merge branch 'main' of github.com:pascalorg/editor
sudhir9297 Jun 4, 2026
b2ad645
Merge branch 'main' of github.com:pascalorg/editor
sudhir9297 Jun 4, 2026
bffdb4a
Merge branch 'main' of github.com:pascalorg/editor
sudhir9297 Jun 8, 2026
ee7b10c
Merge branch 'main' of github.com:pascalorg/editor
sudhir9297 Jun 9, 2026
7d4b474
Merge branch 'main' of github.com:pascalorg/editor
sudhir9297 Jun 10, 2026
3a3318c
Merge branch 'main' of github.com:pascalorg/editor
sudhir9297 Jun 13, 2026
26df69f
Merge branch 'main' of github.com:pascalorg/editor
sudhir9297 Jun 17, 2026
5376e07
Merge branch 'main' of github.com:pascalorg/editor
sudhir9297 Jun 22, 2026
d2204aa
Merge branch 'main' of github.com:pascalorg/editor
sudhir9297 Jun 23, 2026
f2a5186
Merge branch 'main' of github.com:pascalorg/editor
sudhir9297 Jun 29, 2026
5841052
Merge branch 'main' of github.com:pascalorg/editor
sudhir9297 Jul 1, 2026
a6acaa3
Merge branch 'main' of github.com:pascalorg/editor
sudhir9297 Jul 8, 2026
e0fec5b
Merge branch 'main' of github.com:pascalorg/editor
sudhir9297 Jul 10, 2026
7fa9276
Merge branch 'main' of github.com:pascalorg/editor
sudhir9297 Jul 13, 2026
c3ff9d6
Merge branch 'main' of github.com:pascalorg/editor
sudhir9297 Jul 14, 2026
00d84d5
Merge branch 'main' of github.com:pascalorg/editor
sudhir9297 Jul 19, 2026
2c2dabc
Merge branch 'main' of github.com:pascalorg/editor
sudhir9297 Jul 22, 2026
29f914f
Merge branch 'main' of github.com:pascalorg/editor
sudhir9297 Jul 22, 2026
1cbf910
Merge branch 'main' of github.com:pascalorg/editor
sudhir9297 Jul 23, 2026
8f59da7
Merge branch 'main' of github.com:pascalorg/editor
sudhir9297 Jul 24, 2026
650abd6
Merge branch 'main' of github.com:pascalorg/editor
sudhir9297 Jul 27, 2026
1f8dc8b
Merge branch 'main' of github.com:pascalorg/editor
sudhir9297 Jul 28, 2026
7c4b791
Merge branch 'main' of github.com:pascalorg/editor
sudhir9297 Jul 31, 2026
ef7184f
Merge branch 'main' of github.com:sudhir9297/editor; branch 'main' of…
sudhir9297 Aug 10, 2026
c92a376
Merge branch 'main' of github.com:pascalorg/editor
sudhir9297 Aug 12, 2026
a3bf49e
feat: add wall-hosted lean-to roof extensions
sudhir9297 Aug 13, 2026
fd57b5e
feat: refine lean-to roof extensions
sudhir9297 Aug 13, 2026
3e37918
fix: refine lean-to wall and eave junctions
sudhir9297 Aug 13, 2026
00dab89
feat: automate roof gutters and downspouts
sudhir9297 Aug 14, 2026
5880fd0
fix: address roof drainage review findings
sudhir9297 Aug 14, 2026
43b3722
fix: coordinate roof extensions with drainage
sudhir9297 Aug 14, 2026
d88622d
fix: complete lean-to extension controls
sudhir9297 Aug 14, 2026
b840058
fix: complete lean-to extension behavior
sudhir9297 Aug 14, 2026
9709342
fix: refine lean-to appearance and tree
sudhir9297 Aug 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 28 additions & 12 deletions apps/editor/components/build-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from '@pascal-app/editor'
import { useLiquidLineToolOptions } from '@pascal-app/nodes'
import Image from 'next/image'
import { useCallback, useEffect, useMemo, useRef } from 'react'
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import {
Tooltip,
TooltipContent,
Expand Down Expand Up @@ -90,6 +90,7 @@ function collectBuildTypes(floorplanMode: FloorplanMode): BuildType[] {
const extension = getFloorplanNodeExtension(definition)
if (
baseKinds.has(kind) ||
definition.presentation?.paletteGroup === 'roof-features' ||
!extension?.tool ||
!isFloorplanToolAvailableInMode(extension.availableModes, floorplanMode) ||
!presentation ||
Expand Down Expand Up @@ -171,13 +172,12 @@ type RoofFeature = { kind: string; label: string; iconSrc: string }
const ROOF_FEATURE_FALLBACK_ICON = '/icons/roof.webp'

/**
* Roof accessories surfaced under the Roof tile (a "Features" group). Unlike
* the community editor these aren't DB presets — each is a registry kind with
* `capabilities.roofAccessory`, enumerated from the registry at render time
* (it is populated by the app bootstrap — a module-scope const would race it)
* and activated like any structure tool (the kind's tool attaches it to the
* roof segment under the cursor). Label + icon come from the registry's
* `presentation`; non-url icons fall back to the roof icon.
* Roof accessories and extensions surfaced under the Roof tile. Unlike the
* community editor these aren't DB presets — each is a registry kind, either
* carrying `capabilities.roofAccessory` or explicitly classified as a roof
* extension. They are enumerated at render time because the registry is
* populated during app bootstrap. Label + icon come from `presentation`;
* non-url icons fall back to the roof icon.
*/
function activateRoofFeatureTool(kind: string): void {
const ed = useEditor.getState()
Expand Down Expand Up @@ -209,7 +209,15 @@ export function BuildTab() {
const floorplanMode = useFloorplanMode((s) => s.mode)
const follow = useLiquidLineToolOptions((s) => s.follow)
const toggleFollow = useLiquidLineToolOptions((s) => s.toggleFollow)
const buildTypes = useMemo(() => collectBuildTypes(floorplanMode), [floorplanMode])
const [registryReady, setRegistryReady] = useState(false)
const buildTypes = useMemo(
() => (registryReady ? collectBuildTypes(floorplanMode) : BASE_BUILD_TYPES),
[floorplanMode, registryReady],
)

useEffect(() => {
setRegistryReady(true)
}, [])

// The fitting / follow tools are armed from a segment's panel, not a grid
// tile — keep the segment tile lit so the panel (and the way back) stays
Expand All @@ -233,9 +241,15 @@ export function BuildTab() {
// Read at render time (not module scope): the registry is populated by the
// app bootstrap, so enumerating earlier would race it and see no kinds.
const roofFeatures = useMemo<RoofFeature[]>(() => {
if (!registryReady) return []
const features: RoofFeature[] = []
for (const [kind, def] of nodeRegistry.entries()) {
if (def.capabilities.roofAccessory === undefined) continue
if (
def.capabilities.roofAccessory === undefined &&
def.presentation?.paletteGroup !== 'roof-features'
) {
continue
}
// Door / window declare `roofAccessory` for the wall-face cut but
// already have their own Build tiles — listing them here too
// would duplicate the entry under Roof → Features.
Expand All @@ -248,7 +262,7 @@ export function BuildTab() {
})
}
return features
}, [])
}, [registryReady])

// Tile highlight derives from the single source of truth (the active tool /
// mode), never a separate local selection — so keyboard shortcuts and panel
Expand Down Expand Up @@ -352,7 +366,9 @@ export function BuildTab() {
(activeTool === 'roof' || isRoofFeatureActive) &&
roofFeatures.length > 0 ? (
<div className="flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto">
<div className="px-0.5 pt-1 font-medium text-muted-foreground text-xs">Features</div>
<div className="px-0.5 pt-1 font-medium text-muted-foreground text-xs">
Features & extensions
</div>
<TooltipProvider delayDuration={0} disableHoverableContent>
<div
className="grid gap-1.5"
Expand Down
Binary file added apps/editor/public/icons/lean-to-extension.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/core/src/events/bus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import type {
GutterNode,
HvacEquipmentNode,
ItemNode,
LeanToExtensionNode,
LevelNode,
LinesetNode,
LiquidLineNode,
Expand Down Expand Up @@ -97,6 +98,7 @@ export type BuildingEvent = NodeEvent<BuildingNode>
export type CabinetEvent = NodeEvent<CabinetNode>
export type CabinetModuleEvent = NodeEvent<CabinetModuleNode>
export type LevelEvent = NodeEvent<LevelNode>
export type LeanToExtensionEvent = NodeEvent<LeanToExtensionNode>
export type ZoneEvent = NodeEvent<ZoneNode>
export type ShelfEvent = NodeEvent<ShelfNode>
export type SlabEvent = NodeEvent<SlabNode>
Expand Down Expand Up @@ -298,6 +300,7 @@ type EditorEvents = GridEvents &
NodeEvents<'building', BuildingEvent> &
NodeEvents<'elevator', ElevatorEvent> &
NodeEvents<'level', LevelEvent> &
NodeEvents<'lean-to-extension', LeanToExtensionEvent> &
NodeEvents<'zone', ZoneEvent> &
NodeEvents<'slab', SlabEvent> &
NodeEvents<'shelf', ShelfEvent> &
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export type {
GuideEvent,
GutterEvent,
ItemEvent,
LeanToExtensionEvent,
LevelEvent,
MeasurementEvent,
NodeEvent,
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/registry/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ export type {
SurfaceRole,
SurfacesConfig,
SystemContribution,
ToolContributionProps,
ToolHint,
ToolHintChip,
Vec2,
Expand Down
57 changes: 56 additions & 1 deletion packages/core/src/registry/scene-api.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import type { AnyNode, AnyNodeId } from '../schema/types'
import { pauseSceneHistory, resumeSceneHistory } from '../store/history-control'
import {
activeSceneCommitNodeIds,
pauseSceneHistory,
resumeSceneHistory,
} from '../store/history-control'
import {
type CloneNodesIntoOptions,
collectSubtree,
Expand All @@ -20,10 +24,21 @@ export type SceneStoreLike = {
dirtyNodes: Set<AnyNodeId>
createNode: (node: AnyNode, parentId?: AnyNodeId) => void
createNodes?: (ops: { node: AnyNode; parentId?: AnyNodeId }[]) => void
applyNodeChanges?: (changes: {
create?: { node: AnyNode; parentId?: AnyNodeId }[]
update?: { id: AnyNodeId; data: Partial<AnyNode> }[]
delete?: AnyNodeId[]
}) => void
updateNode: (id: AnyNodeId, data: Partial<AnyNode>) => void
deleteNode: (id: AnyNodeId) => void
markDirty: (id: AnyNodeId) => void
}
subscribe?: (
listener: (
state: { nodes: Record<AnyNodeId, AnyNode> },
previous: { nodes: Record<AnyNodeId, AnyNode> },
) => void,
) => () => void
temporal: {
getState: () => { pause: () => void; resume: () => void }
}
Expand Down Expand Up @@ -71,6 +86,46 @@ export function createSceneApi(store: SceneStoreLike): SceneApi {
return node.id
},

createMany(ops) {
for (const op of ops) captureIfNeeded(op.node.id)
const batch = store.getState().createNodes
if (batch) batch(ops)
else for (const op of ops) this.upsert(op.node, op.parentId)
},

applyChanges(changes) {
for (const op of changes.create ?? []) captureIfNeeded(op.node.id)
for (const op of changes.update ?? []) captureIfNeeded(op.id)
for (const id of changes.delete ?? []) captureIfNeeded(id)
const batch = store.getState().applyNodeChanges
if (batch) {
batch(changes)
return
}
for (const op of changes.create ?? []) this.upsert(op.node, op.parentId)
for (const op of changes.update ?? []) this.update(op.id, op.data)
for (const id of changes.delete ?? []) this.delete(id)
},

subscribeNodes(listener) {
return (
store.subscribe?.((state, previous) => {
if (state.nodes === previous.nodes) return
const scopedIds = activeSceneCommitNodeIds()
const changedIds = new Set<AnyNodeId>(scopedIds)
if (!scopedIds) {
for (const id of Object.keys(state.nodes) as AnyNodeId[]) {
if (state.nodes[id] !== previous.nodes[id]) changedIds.add(id)
}
for (const id of Object.keys(previous.nodes) as AnyNodeId[]) {
if (!(id in state.nodes)) changedIds.add(id)
}
}
listener(state.nodes, previous.nodes, changedIds)
}) ?? (() => {})
)
},

delete(id) {
captureIfNeeded(id)
store.getState().deleteNode(id)
Expand Down
28 changes: 26 additions & 2 deletions packages/core/src/registry/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,8 @@ export type FloorplanAffordance<N> = {
initialPlanPoint: FloorplanAffordancePoint
/** Active editor grid step in meters. */
gridSnapStep: number
/** Injected mutation/read seam for kind-owned affordances. */
sceneApi?: SceneApi
}): FloorplanAffordanceSession
}

Expand Down Expand Up @@ -874,6 +876,7 @@ export type FloorplanMoveTargetSession = {
export type FloorplanMoveTarget<N> = (args: {
node: N
nodes: Record<AnyNodeId, AnyNode>
sceneApi?: SceneApi
}) => FloorplanMoveTargetSession

// ─── Plugin manifest ─────────────────────────────────────────────────
Expand Down Expand Up @@ -1246,7 +1249,7 @@ export type NodeDefinition<S extends ZodObject<any>> = {
*/
ports?: (node: z.infer<S>) => NodePort[]
system?: SystemContribution
tool?: LazyComponent
tool?: ToolLazyComponent
/**
* Stage-D drag-affordance components — one per kind-owned editor mode
* triggered by `useEditor` state. Component receives `{ node }` as its
Expand Down Expand Up @@ -1399,6 +1402,8 @@ export type Presentation = {
icon: IconRef
/** Tool palette section. Defaults to `category` when omitted. */
paletteSection?: 'site' | 'structure' | 'furnish'
/** Optional presentation-only subgroup used by palette surfaces. */
paletteGroup?: string
/** Sort key within a palette section; lower numbers come first. */
paletteOrder?: number
/** Set true for kinds that exist but should NOT appear in the palette
Expand All @@ -1424,6 +1429,12 @@ export type IconRef =
* boundary per icon. */
| { kind: 'component'; module: () => Promise<{ default: ComponentType }> }

export type ToolContributionProps = {
sceneApi: SceneApi
activeLevelId: AnyNodeId | null
selectNode: (nodeId: AnyNodeId) => void
}
export type ToolLazyComponent = () => Promise<{ default: ComponentType<ToolContributionProps> }>
export type LazyComponent = () => Promise<{ default: ComponentType }>

export type RendererSource<N> =
Expand Down Expand Up @@ -2134,7 +2145,7 @@ export type ParametricDescriptor<N> = {
* Direct store/MCP writes bypass it — keep real invariants in
* `invariants`.
*/
derive?: (next: N, patch: Partial<N>) => Partial<N>
derive?: (next: N, patch: Partial<N>, previous?: N) => Partial<N>
/**
* Cross-node companion to `derive`: after an inspector edit lands on
* this node, return patches for OTHER nodes that must follow to keep
Expand Down Expand Up @@ -2291,6 +2302,19 @@ export type SceneApi = {
nodes: () => Readonly<Record<AnyNodeId, AnyNode>>
update: (id: AnyNodeId, patch: Partial<AnyNode>) => void
upsert: (node: AnyNode, parentId?: AnyNodeId) => AnyNodeId
createMany?: (ops: { node: AnyNode; parentId?: AnyNodeId }[]) => void
applyChanges?: (changes: {
create?: { node: AnyNode; parentId?: AnyNodeId }[]
update?: { id: AnyNodeId; data: Partial<AnyNode> }[]
delete?: AnyNodeId[]
}) => void
subscribeNodes?: (
listener: (
nodes: Readonly<Record<AnyNodeId, AnyNode>>,
previous: Readonly<Record<AnyNodeId, AnyNode>>,
changedIds: ReadonlySet<AnyNodeId>,
) => void,
) => () => void
delete: (id: AnyNodeId) => void
restore: (id: AnyNodeId) => void
restoreAll: () => void
Expand Down
37 changes: 35 additions & 2 deletions packages/core/src/schema/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ export {
resolveMaterial,
TextureWrapMode,
} from './material'
export {
type AutoDownspoutPlacement,
type AutomaticDownspoutInput,
planAutomaticDownspouts,
resolveAutomaticDownspoutLength,
} from './nodes/automatic-downspout'
export { BoxVentNode } from './nodes/box-vent'
export { BuildingNode } from './nodes/building'
export { CabinetModuleNode, CabinetNode } from './nodes/cabinet'
Expand Down Expand Up @@ -86,7 +92,12 @@ export {
type DormerSurfaceMaterialSpec,
getEffectiveDormerSurfaceMaterial,
} from './nodes/dormer'
export { DownspoutNode } from './nodes/downspout'
export {
DownspoutNode,
defaultDownspoutMetadata,
isDefaultDownspoutNode,
usesAutomaticDownspoutLength,
} from './nodes/downspout'
export { DuctFittingNode } from './nodes/duct-fitting'
export { DuctSegmentNode } from './nodes/duct-segment'
export { DuctTerminalNode } from './nodes/duct-terminal'
Expand All @@ -99,7 +110,22 @@ export {
export { EyebrowVentNode } from './nodes/eyebrow-vent'
export { FenceBaseStyle, FenceNode, FenceStyle } from './nodes/fence'
export { GuideNode, GuideScaleReference } from './nodes/guide'
export { GutterNode, GutterOutlet } from './nodes/gutter'
export {
computeGutterEaveY,
createDefaultGuttersForSegment,
GUTTER_EAVE_TUCK_INWARD,
GUTTER_EAVE_TUCK_UP,
type GutterEaveSide,
type GutterEdgeExclusion,
GutterNode,
GutterOutlet,
type GutterRun,
getDefaultGutterSide,
getGutterRunsForSegment,
hasAutoGutterMetadata,
isAutoGutterEnabled,
isDefaultGutterNode,
} from './nodes/gutter'
export { HvacEquipmentNode } from './nodes/hvac-equipment'
export type {
AnimationEffect,
Expand All @@ -119,6 +145,13 @@ export {
isLowProfileItemSurface,
LOW_PROFILE_ITEM_SURFACE_MAX_HEIGHT,
} from './nodes/item'
export {
LeanToConnectionMode,
LeanToEndCondition,
LeanToExtensionNode,
LeanToResizeLock,
LeanToRoofEdge,
} from './nodes/lean-to-extension'
export { LevelNode } from './nodes/level'
export { LinesetNode } from './nodes/lineset'
export { LiquidLineNode } from './nodes/liquid-line'
Expand Down
Loading
Loading