@pascal-app/core 0.7.0 → 0.9.1
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/dist/events/bus.d.ts +47 -18
- package/dist/events/bus.d.ts.map +1 -1
- package/dist/events/bus.js +1 -1
- package/dist/hooks/scene-registry/scene-registry.d.ts +6 -22
- package/dist/hooks/scene-registry/scene-registry.d.ts.map +1 -1
- package/dist/hooks/scene-registry/scene-registry.js +33 -26
- package/dist/hooks/spatial-grid/floor-placed-elevation.d.ts +14 -0
- package/dist/hooks/spatial-grid/floor-placed-elevation.d.ts.map +1 -0
- package/dist/hooks/spatial-grid/floor-placed-elevation.js +51 -0
- package/dist/hooks/spatial-grid/floor-placed-elevation.test.d.ts +2 -0
- package/dist/hooks/spatial-grid/floor-placed-elevation.test.d.ts.map +1 -0
- package/dist/hooks/spatial-grid/floor-placed-elevation.test.js +273 -0
- package/dist/hooks/spatial-grid/spatial-grid-manager.d.ts +13 -2
- package/dist/hooks/spatial-grid/spatial-grid-manager.d.ts.map +1 -1
- package/dist/hooks/spatial-grid/spatial-grid-manager.js +95 -9
- package/dist/hooks/spatial-grid/spatial-grid-sync.d.ts +28 -1
- package/dist/hooks/spatial-grid/spatial-grid-sync.d.ts.map +1 -1
- package/dist/hooks/spatial-grid/spatial-grid-sync.js +91 -18
- package/dist/index.d.ts +22 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -2
- package/dist/lib/polygon-geometry.d.ts.map +1 -1
- package/dist/lib/polygon-relations.d.ts +10 -0
- package/dist/lib/polygon-relations.d.ts.map +1 -0
- package/dist/lib/polygon-relations.js +73 -0
- package/dist/lib/space-detection-pause.test.d.ts +2 -0
- package/dist/lib/space-detection-pause.test.d.ts.map +1 -0
- package/dist/lib/space-detection-pause.test.js +42 -0
- package/dist/lib/space-detection.d.ts +30 -1
- package/dist/lib/space-detection.d.ts.map +1 -1
- package/dist/lib/space-detection.js +222 -41
- package/dist/lib/space-detection.test.d.ts +2 -0
- package/dist/lib/space-detection.test.d.ts.map +1 -0
- package/dist/lib/space-detection.test.js +77 -0
- package/dist/material-library.d.ts +1 -1
- package/dist/material-library.d.ts.map +1 -1
- package/dist/material-library.js +1957 -141
- package/dist/registry/__bench__/relations-resolver.bench.d.ts +15 -0
- package/dist/registry/__bench__/relations-resolver.bench.d.ts.map +1 -0
- package/dist/registry/__bench__/relations-resolver.bench.js +170 -0
- package/dist/registry/handles.d.ts +321 -0
- package/dist/registry/handles.d.ts.map +1 -0
- package/dist/registry/handles.js +24 -0
- package/dist/registry/index.d.ts +7 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/index.js +4 -0
- package/dist/registry/registry.d.ts +93 -0
- package/dist/registry/registry.d.ts.map +1 -0
- package/dist/registry/registry.js +201 -0
- package/dist/registry/registry.test.d.ts +2 -0
- package/dist/registry/registry.test.d.ts.map +1 -0
- package/dist/registry/registry.test.js +183 -0
- package/dist/registry/relations-resolver.d.ts +42 -0
- package/dist/registry/relations-resolver.d.ts.map +1 -0
- package/dist/registry/relations-resolver.js +77 -0
- package/dist/registry/relations-resolver.test.d.ts +2 -0
- package/dist/registry/relations-resolver.test.d.ts.map +1 -0
- package/dist/registry/relations-resolver.test.js +183 -0
- package/dist/registry/scene-api.d.ts +44 -0
- package/dist/registry/scene-api.d.ts.map +1 -0
- package/dist/registry/scene-api.js +111 -0
- package/dist/registry/scene-api.test.d.ts +2 -0
- package/dist/registry/scene-api.test.d.ts.map +1 -0
- package/dist/registry/scene-api.test.js +183 -0
- package/dist/registry/subtree.d.ts +67 -0
- package/dist/registry/subtree.d.ts.map +1 -0
- package/dist/registry/subtree.js +119 -0
- package/dist/registry/subtree.test.d.ts +2 -0
- package/dist/registry/subtree.test.d.ts.map +1 -0
- package/dist/registry/subtree.test.js +133 -0
- package/dist/registry/types.d.ts +1420 -0
- package/dist/registry/types.d.ts.map +1 -0
- package/dist/registry/types.js +1 -0
- package/dist/schema/asset-url.test.js +0 -4
- package/dist/schema/index.d.ts +17 -2
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +17 -3
- package/dist/schema/material.d.ts +12 -2
- package/dist/schema/material.d.ts.map +1 -1
- package/dist/schema/material.js +10 -0
- package/dist/schema/nodes/box-vent.d.ts +74 -0
- package/dist/schema/nodes/box-vent.d.ts.map +1 -0
- package/dist/schema/nodes/box-vent.js +63 -0
- package/dist/schema/nodes/building.d.ts +1 -1
- package/dist/schema/nodes/building.d.ts.map +1 -1
- package/dist/schema/nodes/building.js +3 -2
- package/dist/schema/nodes/ceiling.d.ts +3 -1
- package/dist/schema/nodes/ceiling.d.ts.map +1 -1
- package/dist/schema/nodes/ceiling.js +1 -1
- package/dist/schema/nodes/chimney.d.ts +158 -0
- package/dist/schema/nodes/chimney.d.ts.map +1 -0
- package/dist/schema/nodes/chimney.js +67 -0
- package/dist/schema/nodes/column.d.ts +598 -6
- package/dist/schema/nodes/column.d.ts.map +1 -1
- package/dist/schema/nodes/column.js +586 -6
- package/dist/schema/nodes/cupola.d.ts +66 -0
- package/dist/schema/nodes/cupola.d.ts.map +1 -0
- package/dist/schema/nodes/cupola.js +28 -0
- package/dist/schema/nodes/door.d.ts +1 -1
- package/dist/schema/nodes/dormer.d.ts +228 -0
- package/dist/schema/nodes/dormer.d.ts.map +1 -0
- package/dist/schema/nodes/dormer.js +119 -0
- package/dist/schema/nodes/downspout.d.ts +75 -0
- package/dist/schema/nodes/downspout.d.ts.map +1 -0
- package/dist/schema/nodes/downspout.js +63 -0
- package/dist/schema/nodes/elevator.d.ts +105 -0
- package/dist/schema/nodes/elevator.d.ts.map +1 -0
- package/dist/schema/nodes/elevator.js +54 -0
- package/dist/schema/nodes/eyebrow-vent.d.ts +68 -0
- package/dist/schema/nodes/eyebrow-vent.d.ts.map +1 -0
- package/dist/schema/nodes/eyebrow-vent.js +40 -0
- package/dist/schema/nodes/fence.d.ts +3 -2
- package/dist/schema/nodes/fence.d.ts.map +1 -1
- package/dist/schema/nodes/fence.js +4 -2
- package/dist/schema/nodes/gutter.d.ts +84 -0
- package/dist/schema/nodes/gutter.d.ts.map +1 -0
- package/dist/schema/nodes/gutter.js +76 -0
- package/dist/schema/nodes/item.d.ts +16 -0
- package/dist/schema/nodes/item.d.ts.map +1 -1
- package/dist/schema/nodes/item.js +21 -0
- package/dist/schema/nodes/level.d.ts +1 -1
- package/dist/schema/nodes/level.d.ts.map +1 -1
- package/dist/schema/nodes/level.js +2 -0
- package/dist/schema/nodes/ridge-vent.d.ts +67 -0
- package/dist/schema/nodes/ridge-vent.d.ts.map +1 -0
- package/dist/schema/nodes/ridge-vent.js +30 -0
- package/dist/schema/nodes/roof-segment.d.ts +198 -4
- package/dist/schema/nodes/roof-segment.d.ts.map +1 -1
- package/dist/schema/nodes/roof-segment.js +254 -3
- package/dist/schema/nodes/roof.d.ts +6 -6
- package/dist/schema/nodes/roof.d.ts.map +1 -1
- package/dist/schema/nodes/roof.js +9 -21
- package/dist/schema/nodes/shelf.d.ts +105 -0
- package/dist/schema/nodes/shelf.d.ts.map +1 -0
- package/dist/schema/nodes/shelf.js +84 -0
- package/dist/schema/nodes/site.d.ts +1 -116
- package/dist/schema/nodes/site.d.ts.map +1 -1
- package/dist/schema/nodes/site.js +2 -6
- package/dist/schema/nodes/skylight.d.ts +279 -0
- package/dist/schema/nodes/skylight.d.ts.map +1 -0
- package/dist/schema/nodes/skylight.js +152 -0
- package/dist/schema/nodes/slab.d.ts +3 -1
- package/dist/schema/nodes/slab.d.ts.map +1 -1
- package/dist/schema/nodes/slab.js +1 -1
- package/dist/schema/nodes/solar-panel.d.ts +117 -0
- package/dist/schema/nodes/solar-panel.d.ts.map +1 -0
- package/dist/schema/nodes/solar-panel.js +47 -0
- package/dist/schema/nodes/stair-segment.d.ts +1 -1
- package/dist/schema/nodes/stair.d.ts +6 -6
- package/dist/schema/nodes/stair.d.ts.map +1 -1
- package/dist/schema/nodes/stair.js +9 -7
- package/dist/schema/nodes/surface-hole-metadata.d.ts +2 -0
- package/dist/schema/nodes/surface-hole-metadata.d.ts.map +1 -1
- package/dist/schema/nodes/surface-hole-metadata.js +3 -1
- package/dist/schema/nodes/turbine-vent.d.ts +68 -0
- package/dist/schema/nodes/turbine-vent.d.ts.map +1 -0
- package/dist/schema/nodes/turbine-vent.js +41 -0
- package/dist/schema/nodes/wall.d.ts +3 -3
- package/dist/schema/nodes/window.d.ts +1 -1
- package/dist/schema/types.d.ts +1448 -236
- package/dist/schema/types.d.ts.map +1 -1
- package/dist/schema/types.js +26 -0
- package/dist/services/alignment-anchors.d.ts +100 -0
- package/dist/services/alignment-anchors.d.ts.map +1 -0
- package/dist/services/alignment-anchors.js +283 -0
- package/dist/services/alignment-anchors.test.d.ts +2 -0
- package/dist/services/alignment-anchors.test.d.ts.map +1 -0
- package/dist/services/alignment-anchors.test.js +383 -0
- package/dist/services/alignment.d.ts +126 -0
- package/dist/services/alignment.d.ts.map +1 -0
- package/dist/services/alignment.js +169 -0
- package/dist/services/alignment.test.d.ts +2 -0
- package/dist/services/alignment.test.d.ts.map +1 -0
- package/dist/services/alignment.test.js +92 -0
- package/dist/services/drag-session.d.ts +47 -0
- package/dist/services/drag-session.d.ts.map +1 -0
- package/dist/services/drag-session.js +100 -0
- package/dist/services/drag-session.test.d.ts +2 -0
- package/dist/services/drag-session.test.d.ts.map +1 -0
- package/dist/services/drag-session.test.js +219 -0
- package/dist/services/hosting.d.ts +80 -0
- package/dist/services/hosting.d.ts.map +1 -0
- package/dist/services/hosting.js +122 -0
- package/dist/services/hosting.test.d.ts +2 -0
- package/dist/services/hosting.test.d.ts.map +1 -0
- package/dist/services/hosting.test.js +199 -0
- package/dist/services/index.d.ts +7 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +6 -0
- package/dist/services/movement.d.ts +48 -0
- package/dist/services/movement.d.ts.map +1 -0
- package/dist/services/movement.js +65 -0
- package/dist/services/movement.test.d.ts +2 -0
- package/dist/services/movement.test.d.ts.map +1 -0
- package/dist/services/movement.test.js +133 -0
- package/dist/services/single-undo-dance.test.d.ts +2 -0
- package/dist/services/single-undo-dance.test.d.ts.map +1 -0
- package/dist/services/single-undo-dance.test.js +210 -0
- package/dist/services/snap.d.ts +72 -0
- package/dist/services/snap.d.ts.map +1 -0
- package/dist/services/snap.js +120 -0
- package/dist/services/snap.test.d.ts +2 -0
- package/dist/services/snap.test.d.ts.map +1 -0
- package/dist/services/snap.test.js +95 -0
- package/dist/solar-panel-presets.d.ts +17 -0
- package/dist/solar-panel-presets.d.ts.map +1 -0
- package/dist/solar-panel-presets.js +43 -0
- package/dist/store/actions/node-actions.d.ts +14 -2
- package/dist/store/actions/node-actions.d.ts.map +1 -1
- package/dist/store/actions/node-actions.js +499 -20
- package/dist/store/actions/node-mutation-sanitize.test.d.ts +2 -0
- package/dist/store/actions/node-mutation-sanitize.test.d.ts.map +1 -0
- package/dist/store/actions/node-mutation-sanitize.test.js +147 -0
- package/dist/store/actions/reparent.test.d.ts +2 -0
- package/dist/store/actions/reparent.test.d.ts.map +1 -0
- package/dist/store/actions/reparent.test.js +212 -0
- package/dist/store/use-interactive.d.ts +39 -0
- package/dist/store/use-interactive.d.ts.map +1 -1
- package/dist/store/use-interactive.js +75 -0
- package/dist/store/use-live-node-overrides.d.ts +22 -0
- package/dist/store/use-live-node-overrides.d.ts.map +1 -0
- package/dist/store/use-live-node-overrides.js +59 -0
- package/dist/store/use-scene-elevator-migration.test.d.ts +2 -0
- package/dist/store/use-scene-elevator-migration.test.d.ts.map +1 -0
- package/dist/store/use-scene-elevator-migration.test.js +109 -0
- package/dist/store/use-scene.d.ts +11 -0
- package/dist/store/use-scene.d.ts.map +1 -1
- package/dist/store/use-scene.js +207 -11
- package/dist/systems/elevator/elevator-dispatch.d.ts +12 -0
- package/dist/systems/elevator/elevator-dispatch.d.ts.map +1 -0
- package/dist/systems/elevator/elevator-dispatch.js +57 -0
- package/dist/systems/elevator/elevator-geometry.d.ts +15 -0
- package/dist/systems/elevator/elevator-geometry.d.ts.map +1 -0
- package/dist/systems/elevator/elevator-geometry.js +50 -0
- package/dist/systems/elevator/elevator-opening-sync.d.ts +6 -0
- package/dist/systems/elevator/elevator-opening-sync.d.ts.map +1 -0
- package/dist/systems/elevator/elevator-opening-sync.js +218 -0
- package/dist/systems/elevator/elevator-opening-sync.test.d.ts +2 -0
- package/dist/systems/elevator/elevator-opening-sync.test.d.ts.map +1 -0
- package/dist/systems/elevator/elevator-opening-sync.test.js +146 -0
- package/dist/systems/elevator/elevator-opening-system.d.ts +2 -0
- package/dist/systems/elevator/elevator-opening-system.d.ts.map +1 -0
- package/dist/systems/elevator/elevator-opening-system.js +48 -0
- package/dist/systems/elevator/elevator-runtime-system.d.ts +2 -0
- package/dist/systems/elevator/elevator-runtime-system.d.ts.map +1 -0
- package/dist/systems/elevator/elevator-runtime-system.js +8 -0
- package/dist/systems/elevator/elevator-runtime.d.ts +18 -0
- package/dist/systems/elevator/elevator-runtime.d.ts.map +1 -0
- package/dist/systems/elevator/elevator-runtime.js +225 -0
- package/dist/systems/elevator/elevator-runtime.test.d.ts +2 -0
- package/dist/systems/elevator/elevator-runtime.test.d.ts.map +1 -0
- package/dist/systems/elevator/elevator-runtime.test.js +64 -0
- package/dist/systems/elevator/elevator-service.d.ts +19 -0
- package/dist/systems/elevator/elevator-service.d.ts.map +1 -0
- package/dist/systems/elevator/elevator-service.js +111 -0
- package/dist/systems/stair/stair-footprint.d.ts +44 -0
- package/dist/systems/stair/stair-footprint.d.ts.map +1 -0
- package/dist/systems/stair/stair-footprint.js +168 -0
- package/dist/systems/stair/stair-opening-preview.d.ts +1777 -0
- package/dist/systems/stair/stair-opening-preview.d.ts.map +1 -0
- package/dist/systems/stair/stair-opening-preview.js +93 -0
- package/dist/systems/stair/stair-opening-preview.test.d.ts +2 -0
- package/dist/systems/stair/stair-opening-preview.test.d.ts.map +1 -0
- package/dist/systems/stair/stair-opening-preview.test.js +80 -0
- package/dist/systems/stair/stair-opening-sync.d.ts.map +1 -1
- package/dist/systems/stair/stair-opening-sync.js +183 -185
- package/dist/systems/stair/stair-opening-sync.test.js +385 -4
- package/dist/systems/stair/stair-opening-system.d.ts +2 -0
- package/dist/systems/stair/stair-opening-system.d.ts.map +1 -0
- package/dist/systems/stair/stair-opening-system.js +104 -0
- package/dist/systems/wall/wall-curve.d.ts +1 -1
- package/dist/systems/wall/wall-curve.d.ts.map +1 -1
- package/dist/systems/wall/wall-curve.js +1 -1
- package/dist/systems/wall/wall-mitering.d.ts.map +1 -1
- package/dist/systems/wall/wall-mitering.js +2 -6
- package/dist/systems/wall/wall-move.d.ts +48 -0
- package/dist/systems/wall/wall-move.d.ts.map +1 -0
- package/dist/systems/wall/wall-move.js +193 -0
- package/dist/utils/clone-scene-graph.d.ts +6 -4
- package/dist/utils/clone-scene-graph.d.ts.map +1 -1
- package/dist/utils/clone-scene-graph.js +6 -4
- package/dist/utils/clone-scene-graph.test.d.ts +2 -0
- package/dist/utils/clone-scene-graph.test.d.ts.map +1 -0
- package/dist/utils/clone-scene-graph.test.js +59 -0
- package/dist/validation/validate-build-json.d.ts +43 -0
- package/dist/validation/validate-build-json.d.ts.map +1 -0
- package/dist/validation/validate-build-json.js +227 -0
- package/package.json +11 -3
- package/dist/materials.d.ts +0 -10
- package/dist/materials.d.ts.map +0 -1
- package/dist/materials.js +0 -22
- package/dist/systems/ceiling/ceiling-system.d.ts +0 -8
- package/dist/systems/ceiling/ceiling-system.d.ts.map +0 -1
- package/dist/systems/ceiling/ceiling-system.js +0 -92
- package/dist/systems/door/door-system.d.ts +0 -2
- package/dist/systems/door/door-system.d.ts.map +0 -1
- package/dist/systems/door/door-system.js +0 -195
- package/dist/systems/fence/fence-system.d.ts +0 -2
- package/dist/systems/fence/fence-system.d.ts.map +0 -1
- package/dist/systems/fence/fence-system.js +0 -187
- package/dist/systems/item/item-system.d.ts +0 -2
- package/dist/systems/item/item-system.d.ts.map +0 -1
- package/dist/systems/item/item-system.js +0 -48
- package/dist/systems/roof/roof-system.d.ts +0 -16
- package/dist/systems/roof/roof-system.d.ts.map +0 -1
- package/dist/systems/roof/roof-system.js +0 -797
- package/dist/systems/slab/slab-system.d.ts +0 -8
- package/dist/systems/slab/slab-system.d.ts.map +0 -1
- package/dist/systems/slab/slab-system.js +0 -214
- package/dist/systems/stair/stair-system.d.ts +0 -2
- package/dist/systems/stair/stair-system.d.ts.map +0 -1
- package/dist/systems/stair/stair-system.js +0 -776
- package/dist/systems/wall/wall-system.d.ts +0 -12
- package/dist/systems/wall/wall-system.d.ts.map +0 -1
- package/dist/systems/wall/wall-system.js +0 -455
- package/dist/systems/window/window-system.d.ts +0 -2
- package/dist/systems/window/window-system.d.ts.map +0 -1
- package/dist/systems/window/window-system.js +0 -131
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bench harness for the relations cascade resolver.
|
|
3
|
+
*
|
|
4
|
+
* Phase 1 risk gate: at 5000 nodes the resolver step must stay under
|
|
5
|
+
* 2ms p95 per `cascadeDirty` invocation. Above that, the registry-driven
|
|
6
|
+
* dispatch will tank framerate during a corner drag in Phase 3.
|
|
7
|
+
*
|
|
8
|
+
* Run via:
|
|
9
|
+
* bun run packages/core/src/registry/__bench__/relations-resolver.bench.ts
|
|
10
|
+
*
|
|
11
|
+
* Output: JSON to stdout with { p50, p95, p99, mean, max, n } in milliseconds.
|
|
12
|
+
* Doubles as a regression gate — wire into CI when we have a baseline.
|
|
13
|
+
*/
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=relations-resolver.bench.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"relations-resolver.bench.d.ts","sourceRoot":"","sources":["../../../src/registry/__bench__/relations-resolver.bench.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bench harness for the relations cascade resolver.
|
|
3
|
+
*
|
|
4
|
+
* Phase 1 risk gate: at 5000 nodes the resolver step must stay under
|
|
5
|
+
* 2ms p95 per `cascadeDirty` invocation. Above that, the registry-driven
|
|
6
|
+
* dispatch will tank framerate during a corner drag in Phase 3.
|
|
7
|
+
*
|
|
8
|
+
* Run via:
|
|
9
|
+
* bun run packages/core/src/registry/__bench__/relations-resolver.bench.ts
|
|
10
|
+
*
|
|
11
|
+
* Output: JSON to stdout with { p50, p95, p99, mean, max, n } in milliseconds.
|
|
12
|
+
* Doubles as a regression gate — wire into CI when we have a baseline.
|
|
13
|
+
*/
|
|
14
|
+
import { z } from 'zod';
|
|
15
|
+
import { nodeRegistry, registerNode } from '../registry';
|
|
16
|
+
import { cascadeDirty } from '../relations-resolver';
|
|
17
|
+
const ID = (s) => s;
|
|
18
|
+
function makeDef(kind, relations) {
|
|
19
|
+
return {
|
|
20
|
+
kind,
|
|
21
|
+
schemaVersion: 1,
|
|
22
|
+
schema: z.object({ type: z.literal(kind) }),
|
|
23
|
+
category: 'utility',
|
|
24
|
+
defaults: () => ({}),
|
|
25
|
+
capabilities: {},
|
|
26
|
+
relations,
|
|
27
|
+
renderer: { kind: 'parametric', module: async () => ({ default: () => null }) },
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Builds a 5000-node fixture: a 50×100 grid of walls (so 5000 walls).
|
|
32
|
+
* Each wall hosts up to 2 doors and is bordered by ~4 slabs (in a sparse
|
|
33
|
+
* spatial index). Designed to stress hosts + affectsSpatial cascade
|
|
34
|
+
* simultaneously.
|
|
35
|
+
*
|
|
36
|
+
* Returns:
|
|
37
|
+
* - 5000 wall nodes
|
|
38
|
+
* - 8000 door nodes (children of walls)
|
|
39
|
+
* - 200 slab nodes (sparse; ~25 walls per slab)
|
|
40
|
+
*
|
|
41
|
+
* Total: ~13,200 nodes. The cascade starts from one wall and should mark
|
|
42
|
+
* its children (doors) + its spatial neighbors (slabs) dirty.
|
|
43
|
+
*/
|
|
44
|
+
function buildFixture() {
|
|
45
|
+
const nodes = {};
|
|
46
|
+
const wallToSlabIds = new Map();
|
|
47
|
+
for (let row = 0; row < 50; row++) {
|
|
48
|
+
for (let col = 0; col < 100; col++) {
|
|
49
|
+
const wallId = ID(`wall_r${row}c${col}`);
|
|
50
|
+
const childIds = [];
|
|
51
|
+
for (let d = 0; d < 2; d++) {
|
|
52
|
+
const doorId = ID(`door_r${row}c${col}d${d}`);
|
|
53
|
+
childIds.push(doorId);
|
|
54
|
+
nodes[doorId] = {
|
|
55
|
+
id: doorId,
|
|
56
|
+
type: 'door',
|
|
57
|
+
parentId: wallId,
|
|
58
|
+
visible: true,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
nodes[wallId] = {
|
|
62
|
+
id: wallId,
|
|
63
|
+
type: 'wall',
|
|
64
|
+
parentId: null,
|
|
65
|
+
visible: true,
|
|
66
|
+
children: childIds,
|
|
67
|
+
};
|
|
68
|
+
// Map this wall to its bordering slab (sparse: ~25 walls share a slab).
|
|
69
|
+
const slabRow = Math.floor(row / 5);
|
|
70
|
+
const slabCol = Math.floor(col / 5);
|
|
71
|
+
const slabId = ID(`slab_r${slabRow}c${slabCol}`);
|
|
72
|
+
const list = wallToSlabIds.get(wallId) ?? [];
|
|
73
|
+
list.push(slabId);
|
|
74
|
+
wallToSlabIds.set(wallId, list);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
for (let row = 0; row < 10; row++) {
|
|
78
|
+
for (let col = 0; col < 20; col++) {
|
|
79
|
+
const slabId = ID(`slab_r${row}c${col}`);
|
|
80
|
+
nodes[slabId] = {
|
|
81
|
+
id: slabId,
|
|
82
|
+
type: 'slab',
|
|
83
|
+
parentId: null,
|
|
84
|
+
visible: true,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return { nodes, wallToSlabIds };
|
|
89
|
+
}
|
|
90
|
+
function makeScene(nodes) {
|
|
91
|
+
return {
|
|
92
|
+
get: ((nid) => nodes[nid]),
|
|
93
|
+
nodes: () => nodes,
|
|
94
|
+
update: () => { },
|
|
95
|
+
upsert: () => ID(''),
|
|
96
|
+
delete: () => { },
|
|
97
|
+
restore: () => { },
|
|
98
|
+
restoreAll: () => { },
|
|
99
|
+
markDirty: () => { },
|
|
100
|
+
pauseHistory: () => { },
|
|
101
|
+
resumeHistory: () => { },
|
|
102
|
+
getSubtree: () => null,
|
|
103
|
+
cloneNodesInto: () => null,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function percentile(values, p) {
|
|
107
|
+
const sorted = [...values].sort((a, b) => a - b);
|
|
108
|
+
const idx = Math.min(sorted.length - 1, Math.floor((p / 100) * sorted.length));
|
|
109
|
+
return sorted[idx] ?? 0;
|
|
110
|
+
}
|
|
111
|
+
async function main() {
|
|
112
|
+
nodeRegistry._reset();
|
|
113
|
+
registerNode(makeDef('wall', { hosts: ['door'], affectsSpatial: ['slab'] }));
|
|
114
|
+
registerNode(makeDef('door'));
|
|
115
|
+
registerNode(makeDef('slab'));
|
|
116
|
+
const { nodes, wallToSlabIds } = buildFixture();
|
|
117
|
+
const scene = makeScene(nodes);
|
|
118
|
+
const spatialQuery = (node, kinds) => {
|
|
119
|
+
if (!kinds.includes('slab'))
|
|
120
|
+
return [];
|
|
121
|
+
return wallToSlabIds.get(node.id) ?? [];
|
|
122
|
+
};
|
|
123
|
+
const totalNodes = Object.keys(nodes).length;
|
|
124
|
+
const totalWalls = 50 * 100;
|
|
125
|
+
console.log(`[bench] fixture: ${totalNodes} nodes (${totalWalls} walls, 8000 doors, 200 slabs)`);
|
|
126
|
+
const iterations = 1000;
|
|
127
|
+
const samples = [];
|
|
128
|
+
// Warm-up — JIT, cache lines, etc.
|
|
129
|
+
for (let i = 0; i < 50; i++) {
|
|
130
|
+
cascadeDirty(ID(`wall_r${i % 50}c${i % 100}`), { scene, spatialQuery });
|
|
131
|
+
}
|
|
132
|
+
for (let i = 0; i < iterations; i++) {
|
|
133
|
+
const row = i % 50;
|
|
134
|
+
const col = i % 100;
|
|
135
|
+
const startId = ID(`wall_r${row}c${col}`);
|
|
136
|
+
const t0 = performance.now();
|
|
137
|
+
cascadeDirty(startId, { scene, spatialQuery });
|
|
138
|
+
const elapsed = performance.now() - t0;
|
|
139
|
+
samples.push(elapsed);
|
|
140
|
+
}
|
|
141
|
+
const mean = samples.reduce((acc, v) => acc + v, 0) / samples.length;
|
|
142
|
+
const max = Math.max(...samples);
|
|
143
|
+
const p50 = percentile(samples, 50);
|
|
144
|
+
const p95 = percentile(samples, 95);
|
|
145
|
+
const p99 = percentile(samples, 99);
|
|
146
|
+
const result = {
|
|
147
|
+
fixture: { totalNodes, walls: totalWalls, doors: 8000, slabs: 200 },
|
|
148
|
+
iterations,
|
|
149
|
+
p50_ms: Number(p50.toFixed(4)),
|
|
150
|
+
p95_ms: Number(p95.toFixed(4)),
|
|
151
|
+
p99_ms: Number(p99.toFixed(4)),
|
|
152
|
+
mean_ms: Number(mean.toFixed(4)),
|
|
153
|
+
max_ms: Number(max.toFixed(4)),
|
|
154
|
+
};
|
|
155
|
+
console.log(JSON.stringify(result, null, 2));
|
|
156
|
+
const target = 2.0;
|
|
157
|
+
if (p95 > target) {
|
|
158
|
+
console.error(`\n❌ p95 ${p95.toFixed(2)}ms exceeds Phase 1 gate of ${target}ms. ` +
|
|
159
|
+
`Phase 2 (column + shelf) can still proceed since their relations are empty, ` +
|
|
160
|
+
`but Phase 3 wall migration must add spatial-index-backed neighbor queries first.`);
|
|
161
|
+
process.exitCode = 1;
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
console.log(`\n✅ p95 ${p95.toFixed(3)}ms within Phase 1 gate of ${target}ms`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
main().catch((err) => {
|
|
168
|
+
console.error(err);
|
|
169
|
+
process.exitCode = 1;
|
|
170
|
+
});
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import type { AnyNode, AnyNodeId } from '../schema/types';
|
|
2
|
+
import type { SceneApi } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Editor-facing verbs that handle descriptors can invoke.
|
|
5
|
+
*
|
|
6
|
+
* Parallel to {@link SceneApi} but exposes EDITOR state mutations (move
|
|
7
|
+
* tools, endpoint dragging, etc.) instead of scene-data writes. Descriptors
|
|
8
|
+
* receive a concrete implementation from the editor at drag time — `core`
|
|
9
|
+
* only carries the interface so node definitions can call into editor
|
|
10
|
+
* affordances without importing the editor package.
|
|
11
|
+
*
|
|
12
|
+
* Minimal verb set today; grow it as new descriptor variants land
|
|
13
|
+
* (engageCurve for wall/fence curving, etc.).
|
|
14
|
+
*/
|
|
15
|
+
export type EditorApi = {
|
|
16
|
+
/**
|
|
17
|
+
* Hand the node to its registered move tool (the same path the floating
|
|
18
|
+
* menu's Move icon uses). Implementations clear any in-progress endpoint
|
|
19
|
+
* or curving state so the move starts from a clean slate.
|
|
20
|
+
*/
|
|
21
|
+
engageMove: (node: AnyNode) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Like {@link engageMove}, but for a press-drag gizmo: the move commits on
|
|
24
|
+
* pointer-release instead of waiting for a click, so the on-canvas move cross
|
|
25
|
+
* behaves as press-drag-release while still showing the placement preview.
|
|
26
|
+
*/
|
|
27
|
+
engageMoveDrag: (node: AnyNode) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Engage endpoint drag for kinds that own start / end anchors (walls,
|
|
30
|
+
* fences). No-ops for kinds without endpoints.
|
|
31
|
+
*/
|
|
32
|
+
engageEndpointMove: (node: AnyNode, endpoint: 'start' | 'end') => void;
|
|
33
|
+
};
|
|
34
|
+
export type HandlePortal = 'self' | 'parent' | 'grandparent';
|
|
35
|
+
export type HandleAxis = 'x' | 'y' | 'z';
|
|
36
|
+
export type HandleAnchor = 'center' | 'min' | 'max';
|
|
37
|
+
/** 3D position + rotation of the arrow in its portal target's local space. */
|
|
38
|
+
export type HandlePlacement<N> = {
|
|
39
|
+
/**
|
|
40
|
+
* `sceneApi` is supplied so descriptors that depend on cross-node state
|
|
41
|
+
* (elevator height resolving level entries, future cross-kind handles)
|
|
42
|
+
* can compute placement against the live scene. Existing descriptors
|
|
43
|
+
* that only need `node` can ignore the second argument.
|
|
44
|
+
*/
|
|
45
|
+
position: (node: N, sceneApi: SceneApi) => readonly [number, number, number];
|
|
46
|
+
/** Optional Y rotation (radians). Defaults to 0. */
|
|
47
|
+
rotationY?: (node: N, sceneApi: SceneApi) => number;
|
|
48
|
+
};
|
|
49
|
+
export type Cursor = 'ew-resize' | 'ns-resize' | 'move' | 'grab' | 'grabbing';
|
|
50
|
+
/**
|
|
51
|
+
* Visual decoration shown alongside a handle while the user is hovering
|
|
52
|
+
* or dragging it. Today: a thin horizontal ring at a node-local radius —
|
|
53
|
+
* the curved-stair width / inner-radius arrows use this to trace the
|
|
54
|
+
* outer rim / inner pillar so the user sees what the drag affects.
|
|
55
|
+
*
|
|
56
|
+
* Pure data: the editor's arrow renderer reads it and mounts the visual.
|
|
57
|
+
*/
|
|
58
|
+
export type HandleDecoration<N> = {
|
|
59
|
+
kind: 'ring';
|
|
60
|
+
/** Node-local radius of the ring (XZ plane). */
|
|
61
|
+
radius: (node: N) => number;
|
|
62
|
+
/** Node-local Y of the ring. Defaults to 0. */
|
|
63
|
+
y?: (node: N) => number;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Linear resize along a single local axis. Covers width / depth / height
|
|
67
|
+
* arrows whose visible behaviour is "drag the +axis edge, the dimension
|
|
68
|
+
* grows."
|
|
69
|
+
*
|
|
70
|
+
* `anchor` controls which side stays fixed:
|
|
71
|
+
* - 'center' : symmetric — both edges move ±delta (column width/depth).
|
|
72
|
+
* - 'min' : the -axis edge is fixed; drag the +axis edge by `delta`
|
|
73
|
+
* grows the value by `delta` (column height with origin at
|
|
74
|
+
* base; door height with bottom anchored).
|
|
75
|
+
* - 'max' : the +axis edge is fixed; drag the -axis edge.
|
|
76
|
+
*
|
|
77
|
+
* `apply(node, newValue)` returns the partial patch. Use it to write
|
|
78
|
+
* sibling fields too (e.g. door 'max' anchor re-centers `position[0]`).
|
|
79
|
+
*/
|
|
80
|
+
export type LinearResizeHandle<N> = {
|
|
81
|
+
kind: 'linear-resize';
|
|
82
|
+
/** Local axis. The arrow's chevron points along +axis. */
|
|
83
|
+
axis: HandleAxis;
|
|
84
|
+
anchor: HandleAnchor;
|
|
85
|
+
currentValue: (node: N) => number;
|
|
86
|
+
apply: (node: N, newValue: number, sceneApi: SceneApi) => Partial<N>;
|
|
87
|
+
/**
|
|
88
|
+
* Cross-node redirect. By default the drag's live override + the
|
|
89
|
+
* committed write both land on the SELECTED node. When this returns
|
|
90
|
+
* another node's id, the editor publishes the override to / commits on
|
|
91
|
+
* THAT node instead (and `apply` should return that node's patch).
|
|
92
|
+
* Used when a node's handle edits a value owned by a sibling — e.g. a
|
|
93
|
+
* downspout's side-move arrows slide its outlet, which lives on the
|
|
94
|
+
* host gutter (`gutter.outlets[].offset`). The selected node is still
|
|
95
|
+
* what `currentValue` / `apply` receive, so the descriptor can read
|
|
96
|
+
* the downspout to find its gutter + outlet.
|
|
97
|
+
*/
|
|
98
|
+
overrideTarget?: (node: N, sceneApi: SceneApi) => AnyNodeId | undefined;
|
|
99
|
+
min?: number | ((node: N, sceneApi: SceneApi) => number);
|
|
100
|
+
max?: number | ((node: N, sceneApi: SceneApi) => number);
|
|
101
|
+
/** Snap the resized scalar to the editor's active grid step before apply. */
|
|
102
|
+
gridSnap?: boolean;
|
|
103
|
+
placement: HandlePlacement<N>;
|
|
104
|
+
/**
|
|
105
|
+
* Dimension this handle steers (e.g. `'height'`). When set, the editor
|
|
106
|
+
* publishes it to `activeHandleDrag.label` for the duration of the drag
|
|
107
|
+
* so out-of-band overlays (the floating dimension pill) can react, and
|
|
108
|
+
* the handle's own in-world value chip is suppressed to avoid showing
|
|
109
|
+
* the same number twice. Leave unset for handles that keep their inline
|
|
110
|
+
* chip and don't drive any external overlay.
|
|
111
|
+
*/
|
|
112
|
+
measureLabel?: string;
|
|
113
|
+
/**
|
|
114
|
+
* Defaults to 'self' (arrow lives in the selected node's own mesh).
|
|
115
|
+
* 'parent' uses the parent mesh — used by doors/windows whose handles
|
|
116
|
+
* need to ride the wall's rotation.
|
|
117
|
+
*/
|
|
118
|
+
portal?: HandlePortal;
|
|
119
|
+
cursor?: Cursor;
|
|
120
|
+
/** Optional visual guide shown while the arrow is hovered or dragging. */
|
|
121
|
+
decoration?: HandleDecoration<N>;
|
|
122
|
+
/**
|
|
123
|
+
* Visual override. Defaults to the standard chevron arrow.
|
|
124
|
+
*
|
|
125
|
+
* `'tracker'` swaps the chevron for a dashed vertical leader + a small
|
|
126
|
+
* cube at `placement.position`. The leader runs from the floor (local
|
|
127
|
+
* y=0) up to the cube; the cube is the drag target and reuses the same
|
|
128
|
+
* linear-resize drag pipeline as the chevron. Intended for vertical
|
|
129
|
+
* height handles where the dashed leader makes the "this is the wall
|
|
130
|
+
* top" relationship readable at a glance — mirrors the `corner-picker`
|
|
131
|
+
* shape on `tap-action` handles but with a draggable cube instead of a
|
|
132
|
+
* one-tap hex disc. Use with `axis: 'y'`; horizontal axes will render
|
|
133
|
+
* the leader vertically and look wrong.
|
|
134
|
+
*/
|
|
135
|
+
shape?: 'arrow' | 'tracker';
|
|
136
|
+
/**
|
|
137
|
+
* Optional override for the bottom Y of the tracker leader. Defaults
|
|
138
|
+
* to 0 (floor of the rideObject's local frame). Use when the value
|
|
139
|
+
* being tracked spans a region that doesn't start at the floor — e.g.
|
|
140
|
+
* a chimney's body height runs from the roof deck up to the body top,
|
|
141
|
+
* so the leader should start at the deck plane and not climb through
|
|
142
|
+
* the roof shell below it. Only consulted when `shape === 'tracker'`.
|
|
143
|
+
*/
|
|
144
|
+
trackerBaseY?: (node: N, sceneApi: SceneApi) => number;
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* 1:1 outward growth — dragging the arrow outward by `delta` grows the
|
|
148
|
+
* value by `delta` (the visible edge follows the pointer). Use for radii
|
|
149
|
+
* and other fields where the conceptual model is "the +axis edge IS the
|
|
150
|
+
* thing being moved" rather than "the size IS being scaled."
|
|
151
|
+
*/
|
|
152
|
+
export type RadialResizeHandle<N> = {
|
|
153
|
+
kind: 'radial-resize';
|
|
154
|
+
axis: HandleAxis;
|
|
155
|
+
currentValue: (node: N) => number;
|
|
156
|
+
apply: (node: N, newValue: number, sceneApi: SceneApi) => Partial<N>;
|
|
157
|
+
min?: number | ((node: N, sceneApi: SceneApi) => number);
|
|
158
|
+
max?: number | ((node: N, sceneApi: SceneApi) => number);
|
|
159
|
+
placement: HandlePlacement<N>;
|
|
160
|
+
portal?: HandlePortal;
|
|
161
|
+
/** Optional visual guide shown while the arrow is hovered or dragging. */
|
|
162
|
+
decoration?: HandleDecoration<N>;
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* Curved / spiral stair sweep arrows. The renderer raycasts a horizontal
|
|
166
|
+
* plane through the arrow's Y and emits the angular delta (radians,
|
|
167
|
+
* signed, normalised to [-π, π]) around the node's local origin.
|
|
168
|
+
*
|
|
169
|
+
* Unlike the linear variants, `apply` receives the raw cursor delta
|
|
170
|
+
* (not a `newValue`) because sweep handles typically write multiple
|
|
171
|
+
* fields off the delta (`sweepAngle` AND `rotation` — re-orienting the
|
|
172
|
+
* arc so the opposite edge stays world-fixed). Descriptor-internal
|
|
173
|
+
* math handles the per-end sign and any clamping; the renderer stays
|
|
174
|
+
* out of it.
|
|
175
|
+
*/
|
|
176
|
+
export type ArcResizeHandle<N = any> = {
|
|
177
|
+
kind: 'arc-resize';
|
|
178
|
+
/**
|
|
179
|
+
* Marks the drag mode. Only 'angular' uses the polar plane renderer;
|
|
180
|
+
* 'radial' and 'vertical' degenerate to `linear-resize` (axis 'x' /
|
|
181
|
+
* 'y') so descriptors should prefer that for those cases.
|
|
182
|
+
*/
|
|
183
|
+
axis: 'angular';
|
|
184
|
+
/** Optional metadata for descriptors that bundle two handles per kind. */
|
|
185
|
+
end?: 'start' | 'end';
|
|
186
|
+
apply: (initialNode: N, delta: number, sceneApi: SceneApi) => Partial<N>;
|
|
187
|
+
placement: HandlePlacement<N>;
|
|
188
|
+
portal?: HandlePortal;
|
|
189
|
+
/** Optional visual guide shown while the arrow is hovered or dragging. */
|
|
190
|
+
decoration?: HandleDecoration<N>;
|
|
191
|
+
/**
|
|
192
|
+
* Visual override. Defaults to the standard chevron (used by the
|
|
193
|
+
* stair-sweep extend handles). 'rotate' renders a two-headed curved
|
|
194
|
+
* arrow icon, intended for whole-node rotation handles.
|
|
195
|
+
*/
|
|
196
|
+
shape?: 'chevron' | 'rotate';
|
|
197
|
+
/**
|
|
198
|
+
* Plane the angular drag is measured in:
|
|
199
|
+
* - 'horizontal' (default): cursor bearing around +Y — whole-node yaw
|
|
200
|
+
* (floor items, elevator, stair, roof-segment).
|
|
201
|
+
* - 'node-normal': cursor bearing around the node's local +Z axis, in
|
|
202
|
+
* the plane perpendicular to it — spins a wall-mounted item flat
|
|
203
|
+
* against its wall. The descriptor's `apply` writes the roll
|
|
204
|
+
* component (rotation[2]). The gizmo icon stands up into that plane.
|
|
205
|
+
*/
|
|
206
|
+
rotationPlane?: 'horizontal' | 'node-normal';
|
|
207
|
+
/**
|
|
208
|
+
* Pivot point for the angular drag, in the rideObject's local space.
|
|
209
|
+
* The renderer measures cursor angle (atan2 on the drag plane) around
|
|
210
|
+
* this point — descriptors that write `rotation` should anchor it to
|
|
211
|
+
* the node's visual center. Defaults to the rideObject's own origin,
|
|
212
|
+
* which is correct for nodes whose mesh origin coincides with the
|
|
213
|
+
* field they're rotating (roof-segment, elevator). Use this when the
|
|
214
|
+
* node's pose is baked into its geometry (chimney) so the mesh origin
|
|
215
|
+
* sits at the parent frame's origin rather than the rotating shape's
|
|
216
|
+
* center.
|
|
217
|
+
*/
|
|
218
|
+
rotationCenter?: (node: N, sceneApi: SceneApi) => readonly [number, number, number];
|
|
219
|
+
};
|
|
220
|
+
/**
|
|
221
|
+
* Wall / fence endpoint drag. Snapping and adjacency belong to the kind,
|
|
222
|
+
* so the descriptor declares the placement and hands the world-space
|
|
223
|
+
* pointer position back to `apply`. The kind can splice walls, snap to
|
|
224
|
+
* a grid, merge with a neighbour, etc., and returns the partial patch.
|
|
225
|
+
*/
|
|
226
|
+
export type EndpointMoveHandle<N> = {
|
|
227
|
+
kind: 'endpoint-move';
|
|
228
|
+
endpoint: 'start' | 'end';
|
|
229
|
+
placement: HandlePlacement<N>;
|
|
230
|
+
/** Called with the world-space hit on the ground plane. */
|
|
231
|
+
apply: (node: N, worldPoint: readonly [number, number, number], sceneApi: SceneApi) => Partial<N>;
|
|
232
|
+
portal?: HandlePortal;
|
|
233
|
+
};
|
|
234
|
+
/**
|
|
235
|
+
* Click-to-engage affordance. The descriptor doesn't drive a drag — its
|
|
236
|
+
* single job is to mount a click target at `placement` and dispatch a
|
|
237
|
+
* verb on the editor API when the user clicks. Used by wall side-move
|
|
238
|
+
* (engage move tool) and wall corner pickers (engage endpoint move).
|
|
239
|
+
*
|
|
240
|
+
* The renderer picks the visual from `shape`. Default `'arrow'` reuses
|
|
241
|
+
* the chevron shape every resize handle uses. `'corner-picker'` renders
|
|
242
|
+
* a dashed vertical leader + billboarded hex disc + ring, anchored at
|
|
243
|
+
* `placement.position` and extending up to `nodeHeight(node)`.
|
|
244
|
+
*/
|
|
245
|
+
export type TapActionHandle<N = any> = {
|
|
246
|
+
kind: 'tap-action';
|
|
247
|
+
placement: HandlePlacement<N>;
|
|
248
|
+
/**
|
|
249
|
+
* Dispatched on pointer-down. Use scene/editor APIs to read state +
|
|
250
|
+
* trigger the desired action.
|
|
251
|
+
*/
|
|
252
|
+
onActivate: (node: N, scene: SceneApi, editor: EditorApi) => void;
|
|
253
|
+
/**
|
|
254
|
+
* Visual override; defaults to the standard chevron arrow. `'move-cross'`
|
|
255
|
+
* reuses the 4-way move cross — a tap-to-engage grip that hands the node to
|
|
256
|
+
* its move tool (via `onActivate`) instead of running the generic translate
|
|
257
|
+
* drag, so the move tool's own preview / ticker feedback shows up.
|
|
258
|
+
*/
|
|
259
|
+
shape?: 'arrow' | 'corner-picker' | 'move-cross';
|
|
260
|
+
/**
|
|
261
|
+
* Required when `shape: 'corner-picker'` — controls the dashed leader's
|
|
262
|
+
* vertical extent. Pure callback so the descriptor doesn't need to
|
|
263
|
+
* import 3D libs.
|
|
264
|
+
*/
|
|
265
|
+
nodeHeight?: (node: N) => number;
|
|
266
|
+
/**
|
|
267
|
+
* `shape: 'move-cross'` only — tilts the flat cross to lie in the right
|
|
268
|
+
* plane. `'horizontal'` (default) leaves it flat on the floor; `'node-normal'`
|
|
269
|
+
* stands it up against the node's facing plane (a wall face).
|
|
270
|
+
*/
|
|
271
|
+
plane?: 'horizontal' | 'node-normal';
|
|
272
|
+
portal?: HandlePortal;
|
|
273
|
+
cursor?: Cursor;
|
|
274
|
+
};
|
|
275
|
+
/**
|
|
276
|
+
* Free ground-plane move. Drag the handle and the node slides across the
|
|
277
|
+
* horizontal plane at its base — the renderer raycasts that plane, converts
|
|
278
|
+
* the hit into the node's parent-local frame, and reports the new local XZ
|
|
279
|
+
* (optionally grid-snapped via `snapExtents`) to `apply`. Press-drag-release
|
|
280
|
+
* with the same live-override → commit-on-release flow as the resize / rotate
|
|
281
|
+
* handles. Rendered as a 4-way cross of double-headed arrows. Pure translation
|
|
282
|
+
* does not require geometry dirtying; renderers consume the live position
|
|
283
|
+
* override directly.
|
|
284
|
+
*/
|
|
285
|
+
export type TranslateHandle<N = any> = {
|
|
286
|
+
kind: 'translate';
|
|
287
|
+
placement: HandlePlacement<N>;
|
|
288
|
+
/**
|
|
289
|
+
* Plane the drag is constrained to (through the node origin):
|
|
290
|
+
* - 'horizontal' (default): the ground plane (world-up normal) — slide
|
|
291
|
+
* across the floor. The free axes are parent-local X / Z.
|
|
292
|
+
* - 'node-normal': the plane perpendicular to the node's local +Z axis
|
|
293
|
+
* (its facing direction) — slide across a wall face. The free axes are
|
|
294
|
+
* parent-local X / Y; depth (Z) stays pinned to the surface.
|
|
295
|
+
*/
|
|
296
|
+
plane?: 'horizontal' | 'node-normal';
|
|
297
|
+
/**
|
|
298
|
+
* `localPos` is the dragged-to position in the node's PARENT-local frame,
|
|
299
|
+
* with the two in-plane axes already grid-snapped (if `snapExtents` is set)
|
|
300
|
+
* and the off-plane axis pinned to its drag-start value. Return the patch
|
|
301
|
+
* that writes it to the node's position field.
|
|
302
|
+
*/
|
|
303
|
+
apply: (initialNode: N, localPos: readonly [number, number, number], sceneApi: SceneApi) => Partial<N>;
|
|
304
|
+
/**
|
|
305
|
+
* Optional grid-snap footprint for the two in-plane axes, in order
|
|
306
|
+
* `[alongX, alongOther]` — `alongOther` is Z for the 'horizontal' plane and
|
|
307
|
+
* Y for 'node-normal'. Used to align the node's edges to the grid (rotation-
|
|
308
|
+
* aware: swap the pair at 90°). Omit / return null for free movement.
|
|
309
|
+
* `sceneApi` is supplied for composite nodes whose footprint depends on
|
|
310
|
+
* children, such as straight stairs.
|
|
311
|
+
*/
|
|
312
|
+
snapExtents?: (node: N, sceneApi: SceneApi) => readonly [number, number] | null;
|
|
313
|
+
portal?: HandlePortal;
|
|
314
|
+
};
|
|
315
|
+
export type HandleDescriptor<N = any> = LinearResizeHandle<N> | RadialResizeHandle<N> | ArcResizeHandle<N> | EndpointMoveHandle<N> | TapActionHandle<N> | TranslateHandle<N>;
|
|
316
|
+
/**
|
|
317
|
+
* Static array, or a function for shape-dependent cases (column
|
|
318
|
+
* crossSection / supportStyle, stair-segment segmentType, etc.).
|
|
319
|
+
*/
|
|
320
|
+
export type HandleList<N> = HandleDescriptor<N>[] | ((node: N) => HandleDescriptor<N>[]);
|
|
321
|
+
//# sourceMappingURL=handles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handles.d.ts","sourceRoot":"","sources":["../../src/registry/handles.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC;;;;;;;;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AChB,CAAA;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,GAAG,GAAG,IAAI;IACrC,IAAI,EAAE,WAAW,CAAA;IACjB,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC,CAAA;IAC7B;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,YAAY,GAAG,aAAa,CAAA;IACpC;;;;;OAKG;IACH,KAAK,EAAE,CACL,WAAW,EAAE,CAAC,EACd,QAAQ,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAC3C,QAAQ,EAAE,QAAQ,KACf,OAAO,CAAC,CAAC,CAAC,CAAA;IACf;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,KAAK,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAA;IAC/E,MAAM,CAAC,EAAE,YAAY,CAAA;CACtB,CAAA;AAED,MAAM,MAAM,gBAAgB,CAAC,CAAC,GAAG,GAAG,IAChC,kBAAkB,CAAC,CAAC,CAAC,GACrB,kBAAkB,CAAC,CAAC,CAAC,GACrB,eAAe,CAAC,CAAC,CAAC,GAClB,kBAAkB,CAAC,CAAC,CAAC,GACrB,eAAe,CAAC,CAAC,CAAC,GAClB,eAAe,CAAC,CAAC,CAAC,CAAA;AAEtB;;;GAGG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,gBAAgB,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// In-world resize / move arrow descriptors. Each `NodeDefinition` may
|
|
2
|
+
// declare a `handles` list (or a `(node) => list` function for shape-
|
|
3
|
+
// dependent affordances). The editor mounts a single generic component
|
|
4
|
+
// that reads these descriptors and renders the arrows / drag logic — no
|
|
5
|
+
// per-kind handles file needed.
|
|
6
|
+
//
|
|
7
|
+
// Pure data + small per-descriptor callbacks: no Three.js, React, or
|
|
8
|
+
// editor imports here so this stays in core. The descriptors are
|
|
9
|
+
// evaluated by the editor at drag time (`apply` etc.) so the callbacks
|
|
10
|
+
// run in the editor's context — they see the live node and the scene
|
|
11
|
+
// API but otherwise do not import 3D libraries.
|
|
12
|
+
//
|
|
13
|
+
// Layered intentionally:
|
|
14
|
+
// - axis-resize : symmetric scaling around center (column W/D, height)
|
|
15
|
+
// - edge-resize : anchored on one edge, the other follows the pointer
|
|
16
|
+
// (door width: drag right edge, left edge stays)
|
|
17
|
+
// - vertical-resize: linear-resize specialised for world-Y (height arrow
|
|
18
|
+
// anchored at bottom; window top-edge anchored at
|
|
19
|
+
// bottom; window bottom-edge anchored at top)
|
|
20
|
+
// - radial-resize : 1:1 outward growth of a radial field (column radius)
|
|
21
|
+
// - arc-resize : curved/spiral stair sweep / inner-radius / rise
|
|
22
|
+
// - endpoint-move : wall / fence endpoint drag (snapping is bespoke,
|
|
23
|
+
// so it delegates to a kind-supplied callback)
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { ArcResizeHandle, Cursor, EditorApi, EndpointMoveHandle, HandleAnchor, HandleAxis, HandleDescriptor, HandleList, HandlePlacement, HandlePortal, LinearResizeHandle, RadialResizeHandle, TapActionHandle, TranslateHandle, } from './handles';
|
|
2
|
+
export { discoverPlugins, getHostRefFields, getSelectableKinds, isDrawnViaTool, isDrawnViaToolKind, isPresettable, isPresettableKind, isRegistryMovable, isRegistrySelectable, kindsWithFloorplanScope, loadPlugin, nodeRegistry, type PluginDiscovery, registerNode, setPluginDiscovery, } from './registry';
|
|
3
|
+
export { type CascadeContext, type ChildQuery, cascadeDirty, collectDescendants, type SpatialQuery, } from './relations-resolver';
|
|
4
|
+
export { createSceneApi, type SceneStoreLike } from './scene-api';
|
|
5
|
+
export { type CloneNodesIntoOptions, type CloneNodesIntoResult, cloneNodesInto, collectSubtree, type Subtree, } from './subtree';
|
|
6
|
+
export type { Affordance, AlignmentFootprint, AlignmentFootprintConfig, AnyNodeDefinition, AssetRef, Capabilities, CapabilityCtx, CuttableConfig, DragAction, EditorCtx, FloorPlacedConfig, FloorPlacedFootprint, FloorPlacedFootprintContext, FloorPlacedFootprintResolver, FloorPlacedFootprintsResolver, FloorplanAffordance, FloorplanAffordanceModifiers, FloorplanAffordancePoint, FloorplanAffordanceSession, FloorplanGeometry, FloorplanMoveTarget, FloorplanMoveTargetSession, FloorplanPalette, FloorplanPoint, FloorplanStyle, GeometryContext, HostableConfig, IconRef, Issue, KeyboardAction, KeyboardActions, LazyComponent, McpOverrides, Modifiers, MovableConfig, NodeCategory, NodeDefinition, NodeRegistry, PaintCapability, PaintEffectiveMaterialArgs, PaintPatchArgs, PaintPreviewArgs, PaintResolveArgs, ParamAction, ParametricDescriptor, ParamField, ParamGroup, Plugin, Presentation, Relations, RendererSource, RoofAccessoryConfig, RotatableConfig, ScalableConfig, SceneApi, SelectableConfig, SnapPointKind, SnappableConfig, SnapServicesLike, SurfacePoint, SurfaceQuery, SurfaceRole, SurfacesConfig, SystemContribution, ToolHint, Vec2, } from './types';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/registry/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,MAAM,EACN,SAAS,EACT,kBAAkB,EAClB,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,eAAe,GAChB,MAAM,WAAW,CAAA;AAClB,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,uBA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L,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { discoverPlugins, getHostRefFields, getSelectableKinds, isDrawnViaTool, isDrawnViaToolKind, isPresettable, isPresettableKind, isRegistryMovable, isRegistrySelectable, kindsWithFloorplanScope, loadPlugin, nodeRegistry, registerNode, setPluginDiscovery, } from './registry';
|
|
2
|
+
export { cascadeDirty, collectDescendants, } from './relations-resolver';
|
|
3
|
+
export { createSceneApi } from './scene-api';
|
|
4
|
+
export { cloneNodesInto, collectSubtree, } from './subtree';
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { AnyNodeDefinition, NodeRegistry, Plugin } from './types';
|
|
2
|
+
export declare const nodeRegistry: NodeRegistry & {
|
|
3
|
+
_register: (def: AnyNodeDefinition) => void;
|
|
4
|
+
_reset: () => void;
|
|
5
|
+
};
|
|
6
|
+
export declare function registerNode(def: AnyNodeDefinition): void;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the set of registered kinds whose definition declares the
|
|
9
|
+
* `selectable` capability. Callers that maintain hardcoded "selectable kinds"
|
|
10
|
+
* lists (SelectionManager, FloatingActionMenu) should concat this with their
|
|
11
|
+
* legacy entries instead of editing the hardcoded list per migration.
|
|
12
|
+
*
|
|
13
|
+
* Phase 6 deletes the hardcoded lists entirely and uses this function as the
|
|
14
|
+
* single source of truth. For now it's additive over the legacy lists so the
|
|
15
|
+
* existing kinds keep working unchanged.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getSelectableKinds(): string[];
|
|
18
|
+
/**
|
|
19
|
+
* Returns true when the kind is declared selectable in the registry. Use
|
|
20
|
+
* in expression chains like `if (node.type === 'wall' || isRegistrySelectable(node.type))`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function isRegistrySelectable(kind: string): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Kinds whose `def.floorplanScope` matches the requested scope. Used by
|
|
25
|
+
* `FloorplanRegistryLayer` to discover building-scoped kinds (e.g.
|
|
26
|
+
* elevator) without hardcoding kind names in the editor layer. `'level'`
|
|
27
|
+
* is the default, so `kindsWithFloorplanScope('level')` includes kinds
|
|
28
|
+
* that didn't set the field at all.
|
|
29
|
+
*/
|
|
30
|
+
export declare function kindsWithFloorplanScope(scope: 'level' | 'building'): string[];
|
|
31
|
+
/**
|
|
32
|
+
* Returns true when the kind is movable from a 2D floor-plan handle —
|
|
33
|
+
* either via `capabilities.movable`, an explicit
|
|
34
|
+
* `def.floorplanMoveTarget`, or an `affordanceTools.move` 3D mover that
|
|
35
|
+
* the floating action menu can engage. Replaces the kind-name ternary
|
|
36
|
+
* chain in `floating-action-menu.tsx`.
|
|
37
|
+
*/
|
|
38
|
+
export declare function isRegistryMovable(kind: string): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Whether the kind can be saved as a reusable preset. Default: an
|
|
41
|
+
* explicit `capabilities.presettable` boolean wins; otherwise the kind
|
|
42
|
+
* is presettable iff it declares `def.parametrics`. Read by host apps
|
|
43
|
+
* (community shell) to gate "save as preset" UI on a selection.
|
|
44
|
+
*/
|
|
45
|
+
export declare function isPresettable(def: AnyNodeDefinition): boolean;
|
|
46
|
+
export declare function isPresettableKind(kind: string): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Names of schema fields on `def` that are host references (`wallId`,
|
|
49
|
+
* `wallT`, etc.). Read by host apps at preset-save time to strip these
|
|
50
|
+
* from the stored payload — see `def.capabilities.hostRefFields` docs.
|
|
51
|
+
* Returns an empty array for kinds that don't declare any.
|
|
52
|
+
*/
|
|
53
|
+
export declare function getHostRefFields(def: AnyNodeDefinition): ReadonlyArray<string>;
|
|
54
|
+
/**
|
|
55
|
+
* Whether instances of this kind are created by drawing with a build tool
|
|
56
|
+
* (tool id === node `type`) rather than dropping a finished instance. Read
|
|
57
|
+
* by host apps to route preset placement of such kinds through
|
|
58
|
+
* `setToolDefaults(type, params)` + `setTool(type)` — see
|
|
59
|
+
* `def.capabilities.drawTool` docs.
|
|
60
|
+
*/
|
|
61
|
+
export declare function isDrawnViaTool(def: AnyNodeDefinition): boolean;
|
|
62
|
+
export declare function isDrawnViaToolKind(kind: string): boolean;
|
|
63
|
+
export declare function loadPlugin(plugin: Plugin): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* App-level plugin discovery hook. The bootstrap loads `builtinPlugin`
|
|
66
|
+
* unconditionally and then awaits this to pick up any extra plugins
|
|
67
|
+
* (third-party node packs, AI-authored bundles, user-installed kinds).
|
|
68
|
+
* Defaults to returning `[]` — apps that want external plugins call
|
|
69
|
+
* {@link setPluginDiscovery} before the bootstrap module runs.
|
|
70
|
+
*
|
|
71
|
+
* Kept async so a future loader can fetch over the network without
|
|
72
|
+
* changing the contract. See `wiki/editor-plugin-authoring.md` for the
|
|
73
|
+
* plugin author surface this enables.
|
|
74
|
+
*/
|
|
75
|
+
export type PluginDiscovery = () => Promise<Plugin[]>;
|
|
76
|
+
/**
|
|
77
|
+
* Replace the plugin discovery implementation. Call once at app startup
|
|
78
|
+
* before {@link discoverPlugins} is invoked (bootstrap order matters).
|
|
79
|
+
*
|
|
80
|
+
* The contract is intentionally minimal — just "return a list of
|
|
81
|
+
* plugins to load." The loader can be a static `import.meta.glob`, a
|
|
82
|
+
* `fetch` against a registry endpoint, a worker IPC, etc. Each returned
|
|
83
|
+
* plugin still goes through {@link loadPlugin} so the same API-version
|
|
84
|
+
* gate + duplicate-kind protection applies.
|
|
85
|
+
*/
|
|
86
|
+
export declare function setPluginDiscovery(fn: PluginDiscovery): void;
|
|
87
|
+
/**
|
|
88
|
+
* Run the active plugin discovery and return the discovered plugins.
|
|
89
|
+
* Bootstrap code is expected to call this after `loadPlugin(builtinPlugin)`
|
|
90
|
+
* and then `await loadPlugin(...)` each result in order.
|
|
91
|
+
*/
|
|
92
|
+
export declare function discoverPlugins(): Promise<Plugin[]>;
|
|
93
|
+
//# sourceMappingURL=registry.d.ts.map
|