@pascal-app/core 1.0.0 → 1.0.3
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/capture/index.d.ts +2 -2
- package/dist/capture/index.js +2 -2
- package/dist/capture/schema.d.ts.map +1 -1
- package/dist/capture/schema.js +2 -0
- package/dist/capture/source.d.ts +1 -1
- package/dist/capture/source.js +1 -1
- package/dist/events/bus.d.ts +6 -3
- package/dist/events/bus.d.ts.map +1 -1
- package/dist/hooks/spatial-grid/floor-placed-elevation.d.ts +4 -4
- package/dist/hooks/spatial-grid/floor-placed-elevation.d.ts.map +1 -1
- package/dist/hooks/spatial-grid/floor-placed-elevation.js +7 -12
- package/dist/hooks/spatial-grid/floor-placed-footprints.d.ts +4 -0
- package/dist/hooks/spatial-grid/floor-placed-footprints.d.ts.map +1 -0
- package/dist/hooks/spatial-grid/floor-placed-footprints.js +7 -0
- package/dist/hooks/spatial-grid/spatial-grid-manager.d.ts +5 -8
- package/dist/hooks/spatial-grid/spatial-grid-manager.d.ts.map +1 -1
- package/dist/hooks/spatial-grid/spatial-grid-manager.js +23 -106
- package/dist/hooks/spatial-grid/spatial-grid-sync.d.ts +263 -84
- package/dist/hooks/spatial-grid/spatial-grid-sync.d.ts.map +1 -1
- package/dist/hooks/spatial-grid/spatial-grid-sync.js +77 -13
- package/dist/hooks/spatial-grid/support-host-patch.d.ts +1 -1
- package/dist/hooks/spatial-grid/support-host-patch.js +6 -6
- package/dist/hooks/spatial-grid/use-spatial-query.d.ts +1 -1
- package/dist/hooks/spatial-grid/use-spatial-query.js +1 -1
- package/dist/index.d.ts +77 -72
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +74 -69
- package/dist/lib/door-operation.d.ts +1 -1
- package/dist/lib/item-polygon-overlap.d.ts +6 -0
- package/dist/lib/item-polygon-overlap.d.ts.map +1 -0
- package/dist/lib/item-polygon-overlap.js +67 -0
- package/dist/lib/level-name.d.ts +1 -1
- package/dist/lib/measurement-geometry.d.ts +4 -4
- package/dist/lib/node-visibility.d.ts +12 -0
- package/dist/lib/node-visibility.d.ts.map +1 -0
- package/dist/lib/node-visibility.js +12 -0
- package/dist/lib/plan-footprint.d.ts +41 -0
- package/dist/lib/plan-footprint.d.ts.map +1 -0
- package/dist/lib/plan-footprint.js +58 -0
- package/dist/lib/room-topology-index.d.ts +1 -1
- package/dist/lib/room-topology-index.js +1 -1
- package/dist/lib/selection-proxy.d.ts +1 -1
- package/dist/lib/slab-polygon.d.ts +2 -2
- package/dist/lib/slab-polygon.js +2 -2
- package/dist/lib/space-detection.d.ts +1 -1
- package/dist/lib/space-detection.d.ts.map +1 -1
- package/dist/lib/space-detection.js +16 -11
- package/dist/lib/terrain-brush.d.ts +1 -1
- package/dist/lib/terrain-brush.js +1 -1
- package/dist/lib/terrain-codec.d.ts +2 -2
- package/dist/lib/terrain-codec.js +1 -1
- package/dist/lib/terrain-raycast.d.ts +1 -1
- package/dist/lib/terrain-raycast.js +1 -1
- package/dist/lib/terrain-source.d.ts +3 -3
- package/dist/lib/terrain-source.js +3 -3
- package/dist/lib/terrain-support.d.ts +1 -1
- package/dist/lib/terrain-support.js +3 -3
- package/dist/lib/unit-containment.d.ts +19 -0
- package/dist/lib/unit-containment.d.ts.map +1 -0
- package/dist/lib/unit-containment.js +158 -0
- package/dist/lib/unit-report.d.ts +19 -0
- package/dist/lib/unit-report.d.ts.map +1 -0
- package/dist/lib/unit-report.js +36 -0
- package/dist/lib/wall-distance.d.ts +2 -2
- package/dist/lib/wall-distance.js +1 -1
- package/dist/lib/zone-quantities.d.ts +1 -1
- package/dist/lib/zone-quantities.js +7 -7
- package/dist/material-library.d.ts +1 -1
- package/dist/material-library.js +1 -1
- package/dist/procedural-items/fixtures.d.ts +261 -0
- package/dist/procedural-items/fixtures.d.ts.map +1 -0
- package/dist/procedural-items/fixtures.js +349 -0
- package/dist/procedural-items/index.d.ts +10 -0
- package/dist/procedural-items/index.d.ts.map +1 -0
- package/dist/procedural-items/index.js +9 -0
- package/dist/procedural-items/integration.d.ts +92 -0
- package/dist/procedural-items/integration.d.ts.map +1 -0
- package/dist/procedural-items/integration.js +19 -0
- package/dist/procedural-items/library-colors.d.ts +56 -0
- package/dist/procedural-items/library-colors.d.ts.map +1 -0
- package/dist/procedural-items/library-colors.js +84 -0
- package/dist/procedural-items/materials.d.ts +5 -0
- package/dist/procedural-items/materials.d.ts.map +1 -0
- package/dist/procedural-items/materials.js +47 -0
- package/dist/procedural-items/node.d.ts +280 -0
- package/dist/procedural-items/node.d.ts.map +1 -0
- package/dist/procedural-items/node.js +71 -0
- package/dist/procedural-items/placement.d.ts +7 -0
- package/dist/procedural-items/placement.d.ts.map +1 -0
- package/dist/procedural-items/placement.js +48 -0
- package/dist/procedural-items/query.d.ts +51 -0
- package/dist/procedural-items/query.d.ts.map +1 -0
- package/dist/procedural-items/query.js +342 -0
- package/dist/procedural-items/recipe.d.ts +144 -0
- package/dist/procedural-items/recipe.d.ts.map +1 -0
- package/dist/procedural-items/recipe.js +372 -0
- package/dist/procedural-items/spatial.d.ts +19 -0
- package/dist/procedural-items/spatial.d.ts.map +1 -0
- package/dist/procedural-items/spatial.js +39 -0
- package/dist/registry/__bench__/relations-resolver.bench.js +2 -2
- package/dist/registry/handles.d.ts +40 -5
- package/dist/registry/handles.d.ts.map +1 -1
- package/dist/registry/index.d.ts +6 -6
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/index.js +4 -4
- package/dist/registry/registry.d.ts +1 -1
- package/dist/registry/relations-resolver.d.ts +2 -2
- package/dist/registry/relations-resolver.js +1 -1
- package/dist/registry/scene-api.d.ts +2 -2
- package/dist/registry/scene-api.js +2 -2
- package/dist/registry/subtree.d.ts +1 -1
- package/dist/registry/subtree.d.ts.map +1 -1
- package/dist/registry/subtree.js +8 -2
- package/dist/registry/types.d.ts +32 -10
- package/dist/registry/types.d.ts.map +1 -1
- package/dist/registry/use-registry-version.js +1 -1
- package/dist/registry/validate-relations.d.ts +4 -0
- package/dist/registry/validate-relations.d.ts.map +1 -0
- package/dist/registry/validate-relations.js +22 -0
- package/dist/schema/__bench__/node-parsers.bench.js +3 -3
- package/dist/schema/__fixtures__/node-fixtures.d.ts +1 -1
- package/dist/schema/__fixtures__/node-fixtures.d.ts.map +1 -1
- package/dist/schema/__fixtures__/node-fixtures.js +4 -2
- package/dist/schema/base.js +1 -1
- package/dist/schema/collections.d.ts +1 -1
- package/dist/schema/collections.js +1 -1
- package/dist/schema/compiled-node-parsers.d.ts +1 -1
- package/dist/schema/compiled-node-parsers.js +1 -1
- package/dist/schema/index.d.ts +74 -70
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +65 -61
- package/dist/schema/material.d.ts +1 -1
- package/dist/schema/material.js +1 -1
- package/dist/schema/nodes/automatic-downspout.d.ts +4 -4
- package/dist/schema/nodes/automatic-downspout.js +5 -5
- package/dist/schema/nodes/block.d.ts +3 -3
- package/dist/schema/nodes/block.d.ts.map +1 -1
- package/dist/schema/nodes/block.js +24 -12
- package/dist/schema/nodes/box-vent.js +2 -2
- 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 +8 -5
- package/dist/schema/nodes/cabinet.d.ts +4 -4
- package/dist/schema/nodes/cabinet.js +4 -4
- package/dist/schema/nodes/ceiling.d.ts +1 -1
- package/dist/schema/nodes/ceiling.js +5 -5
- package/dist/schema/nodes/chimney.js +2 -2
- package/dist/schema/nodes/column.d.ts +1 -0
- package/dist/schema/nodes/column.d.ts.map +1 -1
- package/dist/schema/nodes/column.js +3 -2
- package/dist/schema/nodes/construction-dimension.d.ts +3 -3
- package/dist/schema/nodes/construction-dimension.js +2 -2
- package/dist/schema/nodes/cupola.d.ts +1 -1
- package/dist/schema/nodes/cupola.js +2 -2
- package/dist/schema/nodes/curtain-wall.d.ts +129 -0
- package/dist/schema/nodes/curtain-wall.d.ts.map +1 -0
- package/dist/schema/nodes/curtain-wall.js +49 -0
- package/dist/schema/nodes/door.d.ts +2 -2
- package/dist/schema/nodes/door.js +2 -2
- package/dist/schema/nodes/dormer.d.ts +3 -3
- package/dist/schema/nodes/dormer.js +4 -4
- package/dist/schema/nodes/downspout.js +2 -2
- package/dist/schema/nodes/duct-fitting.js +1 -1
- package/dist/schema/nodes/duct-segment.js +2 -2
- package/dist/schema/nodes/duct-terminal.js +1 -1
- package/dist/schema/nodes/elevator.js +2 -2
- package/dist/schema/nodes/eyebrow-vent.js +2 -2
- package/dist/schema/nodes/fence.js +2 -2
- package/dist/schema/nodes/guide.js +2 -2
- package/dist/schema/nodes/gutter.d.ts +1 -1
- package/dist/schema/nodes/gutter.js +4 -4
- package/dist/schema/nodes/hvac-equipment.js +1 -1
- package/dist/schema/nodes/imported-mesh.d.ts +40 -0
- package/dist/schema/nodes/imported-mesh.d.ts.map +1 -0
- package/dist/schema/nodes/imported-mesh.js +27 -0
- package/dist/schema/nodes/item.d.ts +3 -3
- package/dist/schema/nodes/item.js +3 -3
- package/dist/schema/nodes/lean-to-extension.js +4 -4
- 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 +1 -1
- package/dist/schema/nodes/lineset.js +1 -1
- package/dist/schema/nodes/liquid-line.js +1 -1
- package/dist/schema/nodes/measurement.js +2 -2
- package/dist/schema/nodes/pipe-fitting.d.ts +1 -1
- package/dist/schema/nodes/pipe-fitting.js +1 -1
- package/dist/schema/nodes/pipe-segment.d.ts +1 -1
- package/dist/schema/nodes/pipe-segment.js +2 -2
- package/dist/schema/nodes/pipe-trap.d.ts +1 -1
- package/dist/schema/nodes/pipe-trap.js +1 -1
- package/dist/schema/nodes/ridge-vent.d.ts +1 -1
- package/dist/schema/nodes/ridge-vent.js +3 -3
- package/dist/schema/nodes/roof-segment-shape.d.ts +1 -1
- package/dist/schema/nodes/roof-segment-shape.js +1 -1
- package/dist/schema/nodes/roof-segment-walls.d.ts +1 -1
- package/dist/schema/nodes/roof-segment-walls.js +1 -1
- package/dist/schema/nodes/roof-segment.d.ts +2 -2
- package/dist/schema/nodes/roof-segment.js +2 -2
- package/dist/schema/nodes/roof.d.ts +1 -1
- package/dist/schema/nodes/roof.js +3 -3
- package/dist/schema/nodes/scan.js +3 -3
- package/dist/schema/nodes/shelf.d.ts +1 -1
- package/dist/schema/nodes/shelf.d.ts.map +1 -1
- package/dist/schema/nodes/shelf.js +3 -4
- package/dist/schema/nodes/site.js +2 -2
- package/dist/schema/nodes/skylight.d.ts +4 -4
- package/dist/schema/nodes/skylight.js +2 -2
- package/dist/schema/nodes/slab.js +3 -3
- package/dist/schema/nodes/solar-panel.js +3 -3
- package/dist/schema/nodes/spawn.js +1 -1
- package/dist/schema/nodes/stair-segment.js +2 -2
- package/dist/schema/nodes/stair.d.ts +1 -1
- package/dist/schema/nodes/stair.js +3 -3
- package/dist/schema/nodes/structural-grid.js +1 -1
- package/dist/schema/nodes/turbine-vent.d.ts +1 -1
- package/dist/schema/nodes/turbine-vent.js +2 -2
- package/dist/schema/nodes/unit.d.ts +33 -0
- package/dist/schema/nodes/unit.d.ts.map +1 -0
- package/dist/schema/nodes/unit.js +13 -0
- package/dist/schema/nodes/wall.d.ts +75 -2
- package/dist/schema/nodes/wall.d.ts.map +1 -1
- package/dist/schema/nodes/wall.js +10 -6
- package/dist/schema/nodes/window.js +2 -2
- package/dist/schema/nodes/zone.js +1 -1
- package/dist/schema/scene-material.js +2 -2
- package/dist/schema/types.d.ts +417 -22
- package/dist/schema/types.d.ts.map +1 -1
- package/dist/schema/types.js +56 -49
- package/dist/services/__fixtures__/hosting.d.ts +3 -0
- package/dist/services/__fixtures__/hosting.d.ts.map +1 -0
- package/dist/services/__fixtures__/hosting.js +9 -0
- package/dist/services/__fixtures__/shelf-surface-rows.d.ts +4 -0
- package/dist/services/__fixtures__/shelf-surface-rows.d.ts.map +1 -0
- package/dist/services/__fixtures__/shelf-surface-rows.js +18 -0
- package/dist/services/alignment-anchors.d.ts +6 -11
- package/dist/services/alignment-anchors.d.ts.map +1 -1
- package/dist/services/alignment-anchors.js +7 -34
- package/dist/services/drag-session.d.ts +4 -4
- package/dist/services/drag-session.js +1 -1
- package/dist/services/hosting.d.ts +5 -8
- package/dist/services/hosting.d.ts.map +1 -1
- package/dist/services/hosting.js +25 -18
- package/dist/services/index.d.ts +16 -13
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +16 -13
- package/dist/services/level-height.d.ts +2 -2
- package/dist/services/level-height.js +3 -3
- package/dist/services/movement.d.ts +3 -3
- package/dist/services/movement.js +2 -2
- package/dist/services/port-connectivity.d.ts +1 -1
- package/dist/services/port-connectivity.js +1 -1
- package/dist/services/riser-diagram.d.ts +1 -1
- package/dist/services/shelf-board.d.ts +5 -0
- package/dist/services/shelf-board.d.ts.map +1 -0
- package/dist/services/shelf-board.js +15 -0
- package/dist/services/snap.d.ts +3 -0
- package/dist/services/snap.d.ts.map +1 -1
- package/dist/services/snap.js +11 -0
- package/dist/services/storey.d.ts +2 -2
- package/dist/services/storey.js +2 -2
- package/dist/services/surface-hosting-procedural-parity.fixtures.d.ts +13 -0
- package/dist/services/surface-hosting-procedural-parity.fixtures.d.ts.map +1 -0
- package/dist/services/surface-hosting-procedural-parity.fixtures.js +4691 -0
- package/dist/services/surface-hosting-shelf-parity.fixtures.d.ts +1060 -0
- package/dist/services/surface-hosting-shelf-parity.fixtures.d.ts.map +1 -0
- package/dist/services/surface-hosting-shelf-parity.fixtures.js +3127 -0
- package/dist/services/surface-hosting.d.ts +92 -0
- package/dist/services/surface-hosting.d.ts.map +1 -0
- package/dist/services/surface-hosting.js +305 -0
- package/dist/services/surface-region.d.ts +8 -0
- package/dist/services/surface-region.d.ts.map +1 -0
- package/dist/services/surface-region.js +44 -0
- package/dist/services/system-graph.d.ts +2 -2
- package/dist/services/system-graph.js +2 -2
- package/dist/services/validate-dwv.d.ts +1 -1
- package/dist/services/validate-dwv.js +1 -1
- package/dist/store/actions/node-actions.d.ts +2 -2
- package/dist/store/actions/node-actions.d.ts.map +1 -1
- package/dist/store/actions/node-actions.js +50 -104
- package/dist/store/history-control.d.ts +3 -3
- package/dist/store/history-invalidation.d.ts +1 -1
- package/dist/store/history-invalidation.js +1 -1
- package/dist/store/use-interactive.d.ts +2 -2
- package/dist/store/use-live-terrain.d.ts +1 -1
- package/dist/store/use-scene.d.ts +4 -4
- package/dist/store/use-scene.d.ts.map +1 -1
- package/dist/store/use-scene.js +50 -32
- package/dist/systems/elevator/elevator-dispatch.d.ts +2 -2
- package/dist/systems/elevator/elevator-dispatch.js +1 -1
- package/dist/systems/elevator/elevator-geometry.d.ts +1 -1
- package/dist/systems/elevator/elevator-opening-sync.d.ts +1 -1
- package/dist/systems/elevator/elevator-opening-sync.js +2 -2
- package/dist/systems/elevator/elevator-opening-system.js +3 -3
- package/dist/systems/elevator/elevator-runtime.d.ts +3 -3
- package/dist/systems/elevator/elevator-runtime.js +3 -3
- package/dist/systems/elevator/elevator-service.d.ts +1 -1
- package/dist/systems/elevator/elevator-service.js +1 -1
- package/dist/systems/fence/fence-centerline.d.ts +2 -2
- package/dist/systems/fence/fence-centerline.js +2 -2
- package/dist/systems/fence/fence-spline.d.ts +2 -2
- package/dist/systems/roof/roof-elevation-system.js +3 -3
- package/dist/systems/roof/roof-elevation.d.ts +2 -2
- package/dist/systems/roof/roof-elevation.js +6 -6
- package/dist/systems/roof/roof-footprint.d.ts +1 -1
- package/dist/systems/roof/roof-footprint.js +3 -3
- package/dist/systems/slab/slab-placement.d.ts +1 -1
- package/dist/systems/slab/slab-support.d.ts +1 -1
- package/dist/systems/slab/slab-support.js +4 -4
- package/dist/systems/stair/stair-flight.d.ts +2 -2
- package/dist/systems/stair/stair-flight.js +2 -2
- package/dist/systems/stair/stair-footprint.d.ts +1 -1
- package/dist/systems/stair/stair-opening-preview.d.ts +248 -87
- package/dist/systems/stair/stair-opening-preview.d.ts.map +1 -1
- package/dist/systems/stair/stair-opening-preview.js +2 -2
- package/dist/systems/stair/stair-opening-sync.d.ts +1 -1
- package/dist/systems/stair/stair-opening-sync.js +6 -6
- package/dist/systems/stair/stair-opening-system.js +8 -8
- package/dist/systems/stair/stair-rise.d.ts +1 -1
- package/dist/systems/stair/stair-rise.js +3 -3
- package/dist/systems/wall/wall-curve.d.ts +2 -2
- package/dist/systems/wall/wall-footprint.d.ts +3 -3
- package/dist/systems/wall/wall-footprint.js +3 -3
- package/dist/systems/wall/wall-merge.d.ts +38 -0
- package/dist/systems/wall/wall-merge.d.ts.map +1 -0
- package/dist/systems/wall/wall-merge.js +240 -0
- package/dist/systems/wall/wall-mitering.d.ts +1 -1
- package/dist/systems/wall/wall-mitering.js +1 -1
- package/dist/systems/wall/wall-move.d.ts +1 -1
- package/dist/systems/wall/wall-operations.d.ts +28 -0
- package/dist/systems/wall/wall-operations.d.ts.map +1 -0
- package/dist/systems/wall/wall-operations.js +145 -0
- package/dist/systems/wall/wall-top.d.ts +1 -1
- package/dist/systems/wall/wall-topology.d.ts +9 -2
- package/dist/systems/wall/wall-topology.d.ts.map +1 -1
- package/dist/systems/wall/wall-topology.js +57 -9
- package/dist/utils/clone-scene-graph.d.ts +3 -3
- package/dist/utils/clone-scene-graph.d.ts.map +1 -1
- package/dist/utils/clone-scene-graph.js +9 -3
- package/dist/utils/scene-migrations.d.ts +3 -3
- package/dist/utils/scene-migrations.js +3 -3
- package/dist/utils/vertical-scene-migration.js +5 -5
- package/dist/validation/validate-build-json.d.ts +5 -2
- package/dist/validation/validate-build-json.d.ts.map +1 -1
- package/dist/validation/validate-build-json.js +57 -4
- package/package.json +15 -4
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import { parseRecipe } from './recipe.js';
|
|
2
|
+
const add = (...args) => ({ op: 'add', args });
|
|
3
|
+
const sub = (...args) => ({ op: 'sub', args });
|
|
4
|
+
const mul = (...args) => ({ op: 'mul', args });
|
|
5
|
+
const div = (...args) => ({ op: 'div', args });
|
|
6
|
+
const p = (id, label, value, min, max, step, extra = {}) => ({
|
|
7
|
+
id,
|
|
8
|
+
label,
|
|
9
|
+
default: value,
|
|
10
|
+
min,
|
|
11
|
+
max,
|
|
12
|
+
step,
|
|
13
|
+
unit: 'm',
|
|
14
|
+
...extra,
|
|
15
|
+
});
|
|
16
|
+
export const shelfRecipe = parseRecipe({
|
|
17
|
+
version: 1,
|
|
18
|
+
name: 'Everyday shelf',
|
|
19
|
+
description: 'An open timber bookcase with adjustable shelves and a contrasting back.',
|
|
20
|
+
parameters: [
|
|
21
|
+
p('width', 'Width', 1.2, 0.6, 2.4, 0.05, { axis: 'x' }),
|
|
22
|
+
p('height', 'Height', 1.8, 0.8, 2.5, 0.05, { axis: 'y' }),
|
|
23
|
+
p('depth', 'Depth', 0.4, 0.25, 0.7, 0.025, { axis: 'z' }),
|
|
24
|
+
p('rows', 'Shelves', 4, 2, 7, 1, { unit: 'count', part: 'shelves' }),
|
|
25
|
+
p('thickness', 'Board thickness', 0.03, 0.015, 0.06, 0.005, { part: 'frame' }),
|
|
26
|
+
],
|
|
27
|
+
slots: [
|
|
28
|
+
{ id: 'frame', label: 'Frame', color: '#b58a60' },
|
|
29
|
+
{ id: 'shelves', label: 'Shelves', color: '#d5b38d' },
|
|
30
|
+
{ id: 'back', label: 'Back', color: '#495b50' },
|
|
31
|
+
],
|
|
32
|
+
parts: [
|
|
33
|
+
{
|
|
34
|
+
id: 'frame',
|
|
35
|
+
label: 'Frame',
|
|
36
|
+
count: 2,
|
|
37
|
+
shapes: [
|
|
38
|
+
{
|
|
39
|
+
id: 'side',
|
|
40
|
+
primitive: 'box',
|
|
41
|
+
slot: 'frame',
|
|
42
|
+
size: ['thickness', 'height', 'depth'],
|
|
43
|
+
position: [mul(sub('index', 0.5), sub('width', 'thickness')), div('height', 2), 0],
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: 'shelves',
|
|
49
|
+
label: 'Shelves',
|
|
50
|
+
count: 'rows',
|
|
51
|
+
shapes: [
|
|
52
|
+
{
|
|
53
|
+
id: 'board',
|
|
54
|
+
primitive: 'box',
|
|
55
|
+
slot: 'shelves',
|
|
56
|
+
size: [sub('width', mul(2, 'thickness')), 'thickness', 'depth'],
|
|
57
|
+
position: [
|
|
58
|
+
0,
|
|
59
|
+
add(div('thickness', 2), mul('index', div(sub('height', 'thickness'), sub('rows', 1)))),
|
|
60
|
+
0,
|
|
61
|
+
],
|
|
62
|
+
support: true,
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: 'back',
|
|
68
|
+
label: 'Back panel',
|
|
69
|
+
count: 1,
|
|
70
|
+
shapes: [
|
|
71
|
+
{
|
|
72
|
+
id: 'panel',
|
|
73
|
+
primitive: 'box',
|
|
74
|
+
slot: 'back',
|
|
75
|
+
size: [sub('width', mul(2, 'thickness')), 'height', 0.012],
|
|
76
|
+
position: [0, div('height', 2), add(div('depth', -2), 0.006)],
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
constraints: [],
|
|
82
|
+
});
|
|
83
|
+
export const bedRecipe = parseRecipe({
|
|
84
|
+
version: 1,
|
|
85
|
+
name: 'Quiet bed',
|
|
86
|
+
description: 'An upholstered bed with a timber frame and independently adjustable pillows.',
|
|
87
|
+
parameters: [
|
|
88
|
+
p('width', 'Width', 1.6, 1, 2.2, 0.05, { axis: 'x' }),
|
|
89
|
+
p('length', 'Length', 2.1, 1.8, 2.5, 0.05, { axis: 'z' }),
|
|
90
|
+
p('headboard_height', 'Headboard height', 1.1, 0.75, 1.5, 0.05, {
|
|
91
|
+
axis: 'y',
|
|
92
|
+
part: 'headboard',
|
|
93
|
+
}),
|
|
94
|
+
p('frame_height', 'Frame height', 0.3, 0.2, 0.5, 0.025, { part: 'frame' }),
|
|
95
|
+
p('pillows', 'Pillow count', 2, 1, 3, 1, { unit: 'count', part: 'pillows' }),
|
|
96
|
+
p('pillow_depth', 'Pillow depth', 0.38, 0.25, 0.55, 0.025, { part: 'pillows' }),
|
|
97
|
+
],
|
|
98
|
+
slots: [
|
|
99
|
+
{ id: 'wood', label: 'Frame', color: '#875d42' },
|
|
100
|
+
{ id: 'fabric', label: 'Headboard', color: '#a8a08f' },
|
|
101
|
+
{ id: 'linen', label: 'Bedding', color: '#e8dfce' },
|
|
102
|
+
{ id: 'pillows', label: 'Pillows', color: '#a3b5a8' },
|
|
103
|
+
],
|
|
104
|
+
parts: [
|
|
105
|
+
{
|
|
106
|
+
id: 'frame',
|
|
107
|
+
label: 'Bed frame',
|
|
108
|
+
count: 1,
|
|
109
|
+
shapes: [
|
|
110
|
+
{
|
|
111
|
+
id: 'base',
|
|
112
|
+
primitive: 'roundedBox',
|
|
113
|
+
slot: 'wood',
|
|
114
|
+
size: ['width', 'frame_height', 'length'],
|
|
115
|
+
position: [0, div('frame_height', 2), 0],
|
|
116
|
+
radius: 0.035,
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
id: 'mattress',
|
|
122
|
+
label: 'Mattress',
|
|
123
|
+
count: 1,
|
|
124
|
+
shapes: [
|
|
125
|
+
{
|
|
126
|
+
id: 'mattress',
|
|
127
|
+
primitive: 'roundedBox',
|
|
128
|
+
slot: 'linen',
|
|
129
|
+
size: [sub('width', 0.08), 0.22, sub('length', 0.12)],
|
|
130
|
+
position: [0, add('frame_height', 0.11), 0.03],
|
|
131
|
+
radius: 0.08,
|
|
132
|
+
support: true,
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
id: 'headboard',
|
|
138
|
+
label: 'Headboard',
|
|
139
|
+
count: 1,
|
|
140
|
+
shapes: [
|
|
141
|
+
{
|
|
142
|
+
id: 'panel',
|
|
143
|
+
primitive: 'roundedBox',
|
|
144
|
+
slot: 'fabric',
|
|
145
|
+
size: [add('width', 0.04), 'headboard_height', 0.09],
|
|
146
|
+
position: [0, div('headboard_height', 2), div('length', -2)],
|
|
147
|
+
radius: 0.035,
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
id: 'pillows',
|
|
153
|
+
label: 'Pillows',
|
|
154
|
+
count: 'pillows',
|
|
155
|
+
shapes: [
|
|
156
|
+
{
|
|
157
|
+
id: 'pillow',
|
|
158
|
+
primitive: 'roundedBox',
|
|
159
|
+
slot: 'pillows',
|
|
160
|
+
size: [sub(div(sub('width', 0.16), 'pillows'), 0.04), 0.15, 'pillow_depth'],
|
|
161
|
+
position: [
|
|
162
|
+
mul(sub(add('index', 0.5), div('pillows', 2)), div(sub('width', 0.16), 'pillows')),
|
|
163
|
+
add('frame_height', 0.295),
|
|
164
|
+
add(div('length', -2), div('pillow_depth', 2), 0.16),
|
|
165
|
+
],
|
|
166
|
+
radius: 0.065,
|
|
167
|
+
},
|
|
168
|
+
],
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
constraints: [],
|
|
172
|
+
});
|
|
173
|
+
export const radiatorRecipe = parseRecipe({
|
|
174
|
+
version: 1,
|
|
175
|
+
name: 'Wall radiator',
|
|
176
|
+
description: 'A wall-mounted panel radiator with adjustable width, height and fins. The valve stays outside the nominal width.',
|
|
177
|
+
classification: {
|
|
178
|
+
category: 'radiator',
|
|
179
|
+
functionTags: ['heating'],
|
|
180
|
+
tags: ['radiator', 'wall-mounted'],
|
|
181
|
+
},
|
|
182
|
+
mounting: { attachTo: 'wall-side', reference: 'back' },
|
|
183
|
+
parameters: [
|
|
184
|
+
p('width', 'Panel width', 1.2, 0.6, 2, 0.05, { axis: 'x' }),
|
|
185
|
+
p('height', 'Panel height', 0.6, 0.3, 0.9, 0.05, { axis: 'y' }),
|
|
186
|
+
p('depth', 'Panel depth', 0.1, 0.06, 0.18, 0.01, { axis: 'z' }),
|
|
187
|
+
p('fins', 'Fins', 12, 4, 24, 1, { unit: 'count', part: 'panel' }),
|
|
188
|
+
],
|
|
189
|
+
slots: [
|
|
190
|
+
{ id: 'body', label: 'Painted metal', color: '#eeeae2' },
|
|
191
|
+
{ id: 'valve', label: 'Valve', color: '#a5adb5' },
|
|
192
|
+
],
|
|
193
|
+
surfaces: [
|
|
194
|
+
{
|
|
195
|
+
id: 'back',
|
|
196
|
+
label: 'Wall mounting face',
|
|
197
|
+
position: [0, div('height', 2), div('depth', -2)],
|
|
198
|
+
rotation: [-Math.PI / 2, 0, 0],
|
|
199
|
+
size: ['width', 'height'],
|
|
200
|
+
},
|
|
201
|
+
],
|
|
202
|
+
parts: [
|
|
203
|
+
{
|
|
204
|
+
id: 'panel',
|
|
205
|
+
label: 'Radiator fins',
|
|
206
|
+
count: 'fins',
|
|
207
|
+
shapes: [
|
|
208
|
+
{
|
|
209
|
+
id: 'fin',
|
|
210
|
+
primitive: 'roundedBox',
|
|
211
|
+
slot: 'body',
|
|
212
|
+
size: [sub(div('width', 'fins'), 0.008), 'height', 'depth'],
|
|
213
|
+
position: [
|
|
214
|
+
sub(mul(add('index', 0.5), div('width', 'fins')), div('width', 2)),
|
|
215
|
+
div('height', 2),
|
|
216
|
+
0,
|
|
217
|
+
],
|
|
218
|
+
radius: 0.006,
|
|
219
|
+
},
|
|
220
|
+
],
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
id: 'pipes',
|
|
224
|
+
label: 'Manifolds',
|
|
225
|
+
count: 2,
|
|
226
|
+
shapes: [
|
|
227
|
+
{
|
|
228
|
+
id: 'pipe',
|
|
229
|
+
primitive: 'cylinder',
|
|
230
|
+
slot: 'body',
|
|
231
|
+
size: [0.035, 'width', 0.035],
|
|
232
|
+
position: [0, add(0.055, mul('index', sub('height', 0.11))), 0],
|
|
233
|
+
rotation: [0, 0, Math.PI / 2],
|
|
234
|
+
},
|
|
235
|
+
],
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
id: 'valve',
|
|
239
|
+
label: 'Valve',
|
|
240
|
+
count: 1,
|
|
241
|
+
shapes: [
|
|
242
|
+
{
|
|
243
|
+
id: 'knob',
|
|
244
|
+
primitive: 'cylinder',
|
|
245
|
+
slot: 'valve',
|
|
246
|
+
size: [0.06, 0.08, 0.06],
|
|
247
|
+
position: [add(div('width', 2), 0.04), 0.08, 0],
|
|
248
|
+
rotation: [0, 0, Math.PI / 2],
|
|
249
|
+
},
|
|
250
|
+
],
|
|
251
|
+
},
|
|
252
|
+
],
|
|
253
|
+
constraints: [],
|
|
254
|
+
});
|
|
255
|
+
export const counterRecipe = parseRecipe({
|
|
256
|
+
version: 1,
|
|
257
|
+
name: 'Kitchen counter',
|
|
258
|
+
description: 'A floor-supported counter with a splashback and a named worktop for real items. Nearby walls do not host it.',
|
|
259
|
+
classification: { category: 'counter', functionTags: ['kitchen'], tags: ['counter', 'worktop'] },
|
|
260
|
+
parameters: [
|
|
261
|
+
p('width', 'Width', 1.6, 0.6, 2.8, 0.05, { axis: 'x' }),
|
|
262
|
+
p('height', 'Worktop height', 0.9, 0.7, 1.1, 0.025, { axis: 'y' }),
|
|
263
|
+
p('depth', 'Depth', 0.65, 0.35, 0.9, 0.025, { axis: 'z' }),
|
|
264
|
+
p('splashback', 'Splashback height', 0.2, 0.05, 0.4, 0.025, { part: 'splashback' }),
|
|
265
|
+
],
|
|
266
|
+
slots: [
|
|
267
|
+
{ id: 'cabinet', label: 'Cabinet', color: '#668579' },
|
|
268
|
+
{ id: 'stone', label: 'Worktop and splashback', color: '#ded8cb' },
|
|
269
|
+
],
|
|
270
|
+
surfaces: [
|
|
271
|
+
{
|
|
272
|
+
id: 'worktop',
|
|
273
|
+
label: 'Worktop',
|
|
274
|
+
position: [0, 'height', 0.025],
|
|
275
|
+
size: [sub('width', 0.04), sub('depth', 0.09)],
|
|
276
|
+
},
|
|
277
|
+
],
|
|
278
|
+
parts: [
|
|
279
|
+
{
|
|
280
|
+
id: 'cabinet',
|
|
281
|
+
label: 'Cabinet',
|
|
282
|
+
count: 1,
|
|
283
|
+
shapes: [
|
|
284
|
+
{
|
|
285
|
+
id: 'body',
|
|
286
|
+
primitive: 'box',
|
|
287
|
+
slot: 'cabinet',
|
|
288
|
+
size: [sub('width', 0.04), sub('height', 0.04), sub('depth', 0.04)],
|
|
289
|
+
position: [0, div(sub('height', 0.04), 2), 0],
|
|
290
|
+
},
|
|
291
|
+
],
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
id: 'worktop',
|
|
295
|
+
label: 'Worktop',
|
|
296
|
+
count: 1,
|
|
297
|
+
shapes: [
|
|
298
|
+
{
|
|
299
|
+
id: 'top',
|
|
300
|
+
primitive: 'box',
|
|
301
|
+
slot: 'stone',
|
|
302
|
+
size: ['width', 0.04, 'depth'],
|
|
303
|
+
position: [0, sub('height', 0.02), 0],
|
|
304
|
+
},
|
|
305
|
+
],
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
id: 'splashback',
|
|
309
|
+
label: 'Splashback',
|
|
310
|
+
count: 1,
|
|
311
|
+
shapes: [
|
|
312
|
+
{
|
|
313
|
+
id: 'back',
|
|
314
|
+
primitive: 'box',
|
|
315
|
+
slot: 'stone',
|
|
316
|
+
size: ['width', 'splashback', 0.025],
|
|
317
|
+
position: [0, add('height', div('splashback', 2)), add(div('depth', -2), 0.0125)],
|
|
318
|
+
},
|
|
319
|
+
],
|
|
320
|
+
},
|
|
321
|
+
],
|
|
322
|
+
constraints: [],
|
|
323
|
+
});
|
|
324
|
+
export const experimentBriefs = [
|
|
325
|
+
{
|
|
326
|
+
id: 'shelf_open',
|
|
327
|
+
prompt: 'Create a freestanding open oak bookcase, 1.2 m wide and 1.8 m tall, with adjustable width, height, depth and shelf count. Expose frame and shelf material slots and shelf support surfaces.',
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
id: 'shelf_asymmetric',
|
|
331
|
+
prompt: 'Create an asymmetric low bookcase with a wide open compartment on the left and a narrow stack of shelves on the right. Expose overall width, height, depth and right shelf count. Use contrasting frame and back colors.',
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
id: 'bed_timber',
|
|
335
|
+
prompt: 'Create a timber platform bed with a mattress, a headboard and two pillows. Expose bed width, length, headboard height, pillow count and pillow size. Pillows must remain above the mattress when resized. Separate frame, bedding and pillow material slots.',
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
id: 'bed_upholstered',
|
|
339
|
+
prompt: 'Create an upholstered bed with a tall rounded headboard, a low base, mattress and three pillows. Expose bed width, length, headboard height and pillow count. Include independently adjustable pillow depth and separate material slots.',
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
id: 'bench',
|
|
343
|
+
prompt: 'Create a park bench with a slatted timber seat, backrest and two metal supports. Expose width, seat height, depth and slat count. Changing width must preserve support thickness. Separate timber and metal slots.',
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
id: 'divider',
|
|
347
|
+
prompt: 'Create a freestanding room divider with repeated vertical timber slats on a base. Expose width, height, depth and slat count. Keep every slat above the ground and evenly distributed when resized. Separate slat and base slots.',
|
|
348
|
+
},
|
|
349
|
+
];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './fixtures.js';
|
|
2
|
+
export * from './integration.js';
|
|
3
|
+
export * from './library-colors.js';
|
|
4
|
+
export * from './materials.js';
|
|
5
|
+
export * from './node.js';
|
|
6
|
+
export * from './placement.js';
|
|
7
|
+
export * from './query.js';
|
|
8
|
+
export * from './recipe.js';
|
|
9
|
+
export * from './spatial.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/procedural-items/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,QAAQ,CAAA;AACtB,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './fixtures.js';
|
|
2
|
+
export * from './integration.js';
|
|
3
|
+
export * from './library-colors.js';
|
|
4
|
+
export * from './materials.js';
|
|
5
|
+
export * from './node.js';
|
|
6
|
+
export * from './placement.js';
|
|
7
|
+
export * from './query.js';
|
|
8
|
+
export * from './recipe.js';
|
|
9
|
+
export * from './spatial.js';
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { type QueryNodes } from './query.js';
|
|
2
|
+
import type { Recipe, Vec3 } from './recipe.js';
|
|
3
|
+
export declare function prepareProceduralPlacement(recipe: Recipe, nodes: QueryNodes, placement: {
|
|
4
|
+
parentId: string;
|
|
5
|
+
position: Vec3;
|
|
6
|
+
side?: 'front' | 'back';
|
|
7
|
+
}): {
|
|
8
|
+
object: "node";
|
|
9
|
+
parentId: string | null;
|
|
10
|
+
visible: boolean;
|
|
11
|
+
metadata: Record<string, unknown>;
|
|
12
|
+
id: `procedural-item_${string}`;
|
|
13
|
+
type: "procedural-item";
|
|
14
|
+
recipe: {
|
|
15
|
+
version: 1;
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
parameters: {
|
|
19
|
+
id: string;
|
|
20
|
+
label: string;
|
|
21
|
+
default: number;
|
|
22
|
+
min: number;
|
|
23
|
+
max: number;
|
|
24
|
+
step: number;
|
|
25
|
+
unit: "count" | "m" | "rad";
|
|
26
|
+
part?: string | undefined;
|
|
27
|
+
axis?: "x" | "y" | "z" | undefined;
|
|
28
|
+
}[];
|
|
29
|
+
slots: {
|
|
30
|
+
id: string;
|
|
31
|
+
label: string;
|
|
32
|
+
color: string;
|
|
33
|
+
finish?: "wood" | "glass" | "metal" | undefined;
|
|
34
|
+
}[];
|
|
35
|
+
parts: {
|
|
36
|
+
id: string;
|
|
37
|
+
label: string;
|
|
38
|
+
count: import("./recipe.js").Expr;
|
|
39
|
+
shapes: {
|
|
40
|
+
id: string;
|
|
41
|
+
primitive: "box" | "roundedBox" | "cylinder";
|
|
42
|
+
slot: string;
|
|
43
|
+
size: [import("./recipe.js").Expr, import("./recipe.js").Expr, import("./recipe.js").Expr];
|
|
44
|
+
position: [import("./recipe.js").Expr, import("./recipe.js").Expr, import("./recipe.js").Expr];
|
|
45
|
+
rotation?: [import("./recipe.js").Expr, import("./recipe.js").Expr, import("./recipe.js").Expr] | undefined;
|
|
46
|
+
radius?: import("./recipe.js").Expr | undefined;
|
|
47
|
+
support?: boolean | undefined;
|
|
48
|
+
}[];
|
|
49
|
+
}[];
|
|
50
|
+
constraints: {
|
|
51
|
+
left: import("./recipe.js").Expr;
|
|
52
|
+
relation: "lte" | "gte";
|
|
53
|
+
right: import("./recipe.js").Expr;
|
|
54
|
+
message: string;
|
|
55
|
+
}[];
|
|
56
|
+
classification?: {
|
|
57
|
+
category: string;
|
|
58
|
+
functionTags: string[];
|
|
59
|
+
tags: string[];
|
|
60
|
+
} | undefined;
|
|
61
|
+
mounting?: {
|
|
62
|
+
attachTo: "ceiling" | "wall-side";
|
|
63
|
+
reference: string;
|
|
64
|
+
} | undefined;
|
|
65
|
+
surfaces?: {
|
|
66
|
+
id: string;
|
|
67
|
+
label: string;
|
|
68
|
+
position: [import("./recipe.js").Expr, import("./recipe.js").Expr, import("./recipe.js").Expr];
|
|
69
|
+
size: [import("./recipe.js").Expr, import("./recipe.js").Expr];
|
|
70
|
+
part?: string | undefined;
|
|
71
|
+
rotation?: [import("./recipe.js").Expr, import("./recipe.js").Expr, import("./recipe.js").Expr] | undefined;
|
|
72
|
+
}[] | undefined;
|
|
73
|
+
};
|
|
74
|
+
parameters: Record<string, number>;
|
|
75
|
+
slots: Record<string, string>;
|
|
76
|
+
position: [number, number, number];
|
|
77
|
+
rotation: [number, number, number];
|
|
78
|
+
children: string[];
|
|
79
|
+
attachments: Record<string, string>;
|
|
80
|
+
name?: string | undefined;
|
|
81
|
+
camera?: {
|
|
82
|
+
position: [number, number, number];
|
|
83
|
+
target: [number, number, number];
|
|
84
|
+
mode: "perspective" | "orthographic";
|
|
85
|
+
fov?: number | undefined;
|
|
86
|
+
zoom?: number | undefined;
|
|
87
|
+
} | undefined;
|
|
88
|
+
wallId?: string | undefined;
|
|
89
|
+
side?: "front" | "back" | undefined;
|
|
90
|
+
supportSlabId?: string | undefined;
|
|
91
|
+
};
|
|
92
|
+
//# sourceMappingURL=integration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration.d.ts","sourceRoot":"","sources":["../../src/procedural-items/integration.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAA+B,MAAM,SAAS,CAAA;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAE5C,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,UAAU,EACjB,SAAS,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,IAAI,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBzE"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ProceduralItemNode } from './node.js';
|
|
2
|
+
import { validateProceduralRelations } from './query.js';
|
|
3
|
+
export function prepareProceduralPlacement(recipe, nodes, placement) {
|
|
4
|
+
const parent = nodes[placement.parentId];
|
|
5
|
+
const hostType = recipe.mounting?.attachTo === 'ceiling' ? 'ceiling' : recipe.mounting ? 'wall' : 'level';
|
|
6
|
+
if (!parent || parent.type !== hostType)
|
|
7
|
+
throw new Error(`Choose a ${hostType} for this design`);
|
|
8
|
+
const node = ProceduralItemNode.parse({
|
|
9
|
+
recipe,
|
|
10
|
+
name: recipe.name,
|
|
11
|
+
parentId: parent.id,
|
|
12
|
+
position: placement.position,
|
|
13
|
+
...(recipe.mounting?.attachTo === 'wall-side'
|
|
14
|
+
? { wallId: parent.id, side: placement.side ?? 'front' }
|
|
15
|
+
: {}),
|
|
16
|
+
});
|
|
17
|
+
validateProceduralRelations(node, { ...nodes, [node.id]: node });
|
|
18
|
+
return node;
|
|
19
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type MaterialCatalogItem } from '../material-library.js';
|
|
2
|
+
import type { ProceduralItemNode } from './node.js';
|
|
3
|
+
import type { Recipe } from './recipe.js';
|
|
4
|
+
type ProceduralFinish = NonNullable<Recipe['slots'][number]['finish']>;
|
|
5
|
+
export declare const FINISH_LIBRARY_REFS: {
|
|
6
|
+
readonly glass: readonly [{
|
|
7
|
+
readonly ref: "library:preset-glass";
|
|
8
|
+
readonly color: "#87ceeb";
|
|
9
|
+
}];
|
|
10
|
+
readonly metal: readonly [{
|
|
11
|
+
readonly ref: "library:metal-steel";
|
|
12
|
+
readonly color: "#636363";
|
|
13
|
+
}, {
|
|
14
|
+
readonly ref: "library:metal-chrome";
|
|
15
|
+
readonly color: "#c8ccce";
|
|
16
|
+
}, {
|
|
17
|
+
readonly ref: "library:metal-brass";
|
|
18
|
+
readonly color: "#b08d57";
|
|
19
|
+
}, {
|
|
20
|
+
readonly ref: "library:metal-copper";
|
|
21
|
+
readonly color: "#cc845b";
|
|
22
|
+
}, {
|
|
23
|
+
readonly ref: "library:metal-polished";
|
|
24
|
+
readonly color: "#f3f3f3";
|
|
25
|
+
}, {
|
|
26
|
+
readonly ref: "library:preset-metal";
|
|
27
|
+
readonly color: "#c7ccd2";
|
|
28
|
+
}];
|
|
29
|
+
readonly wood: readonly [{
|
|
30
|
+
readonly ref: "library:wood-finewood27";
|
|
31
|
+
readonly color: "#a77440";
|
|
32
|
+
}, {
|
|
33
|
+
readonly ref: "library:wood-woodplank48";
|
|
34
|
+
readonly color: "#88654c";
|
|
35
|
+
}, {
|
|
36
|
+
readonly ref: "library:wood-hungarianparquet2";
|
|
37
|
+
readonly color: "#663020";
|
|
38
|
+
}, {
|
|
39
|
+
readonly ref: "library:wood-squareparquet21";
|
|
40
|
+
readonly color: "#3e220d";
|
|
41
|
+
}];
|
|
42
|
+
};
|
|
43
|
+
export declare function proceduralFinishLibraryColor(ref: string): string | undefined;
|
|
44
|
+
export declare function resolveProceduralFinishRef(finish: ProceduralFinish, color: string): `library:${string}` | undefined;
|
|
45
|
+
export type LibraryColorMatch = {
|
|
46
|
+
ref: `library:${string}`;
|
|
47
|
+
color: string;
|
|
48
|
+
name: string;
|
|
49
|
+
distance: number;
|
|
50
|
+
};
|
|
51
|
+
export declare function nearestLibraryColorRef(hex: string, catalog?: readonly MaterialCatalogItem[]): LibraryColorMatch | null;
|
|
52
|
+
export declare function snapProceduralSlotsToLibrary(node: ProceduralItemNode, options?: {
|
|
53
|
+
keepOverrides: true;
|
|
54
|
+
}): ProceduralItemNode['slots'];
|
|
55
|
+
export {};
|
|
56
|
+
//# sourceMappingURL=library-colors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"library-colors.d.ts","sourceRoot":"","sources":["../../src/procedural-items/library-colors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAChF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAA;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEtC,KAAK,gBAAgB,GAAG,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAA;AAItE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmB/B,CAAA;AAED,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAI5E;AAED,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,gBAAgB,EACxB,KAAK,EAAE,MAAM,GACZ,WAAW,MAAM,EAAE,GAAG,SAAS,CAGjC;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,GAAG,EAAE,WAAW,MAAM,EAAE,CAAA;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAiCD,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,SAAS,mBAAmB,EAAqB,GACzD,iBAAiB,GAAG,IAAI,CAc1B;AAED,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,kBAAkB,EACxB,OAAO,GAAE;IAAE,aAAa,EAAE,IAAI,CAAA;CAA4B,GACzD,kBAAkB,CAAC,OAAO,CAAC,CAU7B"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { MATERIAL_CATALOG } from '../material-library.js';
|
|
2
|
+
// Textured tones average source WebP RGB pixels (wood) or decoded KTX2 mip 0 (metal)
|
|
3
|
+
// under apps/editor/public/material; flat finishes use their preset color.
|
|
4
|
+
export const FINISH_LIBRARY_REFS = {
|
|
5
|
+
glass: [{ ref: 'library:preset-glass', color: '#87ceeb' }],
|
|
6
|
+
metal: [
|
|
7
|
+
{ ref: 'library:metal-steel', color: '#636363' },
|
|
8
|
+
{ ref: 'library:metal-chrome', color: '#c8ccce' },
|
|
9
|
+
{ ref: 'library:metal-brass', color: '#b08d57' },
|
|
10
|
+
{ ref: 'library:metal-copper', color: '#cc845b' },
|
|
11
|
+
{ ref: 'library:metal-polished', color: '#f3f3f3' },
|
|
12
|
+
{ ref: 'library:preset-metal', color: '#c7ccd2' },
|
|
13
|
+
],
|
|
14
|
+
wood: [
|
|
15
|
+
{ ref: 'library:wood-finewood27', color: '#a77440' },
|
|
16
|
+
{ ref: 'library:wood-woodplank48', color: '#88654c' },
|
|
17
|
+
{ ref: 'library:wood-hungarianparquet2', color: '#663020' },
|
|
18
|
+
{ ref: 'library:wood-squareparquet21', color: '#3e220d' },
|
|
19
|
+
],
|
|
20
|
+
};
|
|
21
|
+
export function proceduralFinishLibraryColor(ref) {
|
|
22
|
+
return Object.values(FINISH_LIBRARY_REFS)
|
|
23
|
+
.flat()
|
|
24
|
+
.find((preset) => preset.ref === ref)?.color;
|
|
25
|
+
}
|
|
26
|
+
export function resolveProceduralFinishRef(finish, color) {
|
|
27
|
+
return nearestColor(color, FINISH_LIBRARY_REFS[finish])
|
|
28
|
+
?.ref;
|
|
29
|
+
}
|
|
30
|
+
function hexToLab(hex) {
|
|
31
|
+
if (!/^#[0-9a-f]{6}$/i.test(hex))
|
|
32
|
+
return null;
|
|
33
|
+
const linear = (offset) => {
|
|
34
|
+
const channel = Number.parseInt(hex.slice(offset, offset + 2), 16) / 255;
|
|
35
|
+
return channel <= 0.04045 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4;
|
|
36
|
+
};
|
|
37
|
+
const r = linear(1);
|
|
38
|
+
const g = linear(3);
|
|
39
|
+
const b = linear(5);
|
|
40
|
+
// sRGB uses D65; normalize XYZ by that white point before converting to Lab.
|
|
41
|
+
const f = (value) => value > (6 / 29) ** 3 ? Math.cbrt(value) : value / (3 * (6 / 29) ** 2) + 4 / 29;
|
|
42
|
+
const x = f((0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / 0.95047);
|
|
43
|
+
const y = f(0.2126729 * r + 0.7151522 * g + 0.072175 * b);
|
|
44
|
+
const z = f((0.0193339 * r + 0.119192 * g + 0.9503041 * b) / 1.08883);
|
|
45
|
+
return [116 * y - 16, 500 * (x - y), 200 * (y - z)];
|
|
46
|
+
}
|
|
47
|
+
function nearestColor(hex, candidates) {
|
|
48
|
+
const lab = hexToLab(hex);
|
|
49
|
+
if (!lab)
|
|
50
|
+
return null;
|
|
51
|
+
let nearest = null;
|
|
52
|
+
for (const entry of candidates) {
|
|
53
|
+
const candidate = hexToLab(entry.color);
|
|
54
|
+
if (!candidate)
|
|
55
|
+
continue;
|
|
56
|
+
const distance = Math.hypot(lab[0] - candidate[0], lab[1] - candidate[1], lab[2] - candidate[2]);
|
|
57
|
+
if (!nearest || distance < nearest.distance)
|
|
58
|
+
nearest = { ...entry, distance };
|
|
59
|
+
}
|
|
60
|
+
return nearest;
|
|
61
|
+
}
|
|
62
|
+
export function nearestLibraryColorRef(hex, catalog = MATERIAL_CATALOG) {
|
|
63
|
+
return nearestColor(hex, catalog
|
|
64
|
+
// Flat swatches are in `colors` and have no populated maps, including non-albedo maps.
|
|
65
|
+
.filter((entry) => entry.category === 'colors' && !Object.values(entry.preset.maps).some(Boolean))
|
|
66
|
+
.map((entry) => ({
|
|
67
|
+
ref: `library:${entry.id}`,
|
|
68
|
+
color: entry.preset.mapProperties.color,
|
|
69
|
+
name: entry.label,
|
|
70
|
+
})));
|
|
71
|
+
}
|
|
72
|
+
export function snapProceduralSlotsToLibrary(node, options = { keepOverrides: true }) {
|
|
73
|
+
const slots = { ...node.slots };
|
|
74
|
+
for (const slot of node.recipe.slots) {
|
|
75
|
+
if (options.keepOverrides && Object.hasOwn(node.slots, slot.id))
|
|
76
|
+
continue;
|
|
77
|
+
const ref = slot.finish
|
|
78
|
+
? resolveProceduralFinishRef(slot.finish, slot.color)
|
|
79
|
+
: nearestLibraryColorRef(slot.color)?.ref;
|
|
80
|
+
if (ref)
|
|
81
|
+
slots[slot.id] = ref;
|
|
82
|
+
}
|
|
83
|
+
return slots;
|
|
84
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { MaterialSchema } from '../schema/material.js';
|
|
2
|
+
import { type SceneMaterial } from '../schema/scene-material.js';
|
|
3
|
+
export declare function proceduralSlotColor(ref: string | undefined, fallback: string, materials: Record<string, SceneMaterial>): string;
|
|
4
|
+
export declare function setProceduralMaterial(nodeId: string, slotId: string, ref?: string, material?: MaterialSchema): void;
|
|
5
|
+
//# sourceMappingURL=materials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"materials.d.ts","sourceRoot":"","sources":["../../src/procedural-items/materials.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,EAEL,KAAK,aAAa,EAEnB,MAAM,0BAA0B,CAAA;AAOjC,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,UAUzC;AACD,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,GAAG,CAAC,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,cAAc,QA4B1B"}
|