@pascal-app/nodes 1.0.0 → 1.0.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.
Files changed (154) hide show
  1. package/dist/box-vent/panel.js +4 -4
  2. package/dist/cabinet/appliance-layout.d.ts +26 -0
  3. package/dist/cabinet/appliance-layout.d.ts.map +1 -0
  4. package/dist/cabinet/appliance-layout.js +52 -0
  5. package/dist/cabinet/countertop-layout.d.ts +173 -0
  6. package/dist/cabinet/countertop-layout.d.ts.map +1 -0
  7. package/dist/cabinet/countertop-layout.js +80 -0
  8. package/dist/cabinet/definition.d.ts.map +1 -1
  9. package/dist/cabinet/definition.js +15 -8
  10. package/dist/cabinet/geometry/cooktop.d.ts.map +1 -1
  11. package/dist/cabinet/geometry/cooktop.js +2 -2
  12. package/dist/cabinet/geometry/run.d.ts.map +1 -1
  13. package/dist/cabinet/geometry/run.js +10 -71
  14. package/dist/cabinet/geometry/sink.d.ts +2 -12
  15. package/dist/cabinet/geometry/sink.d.ts.map +1 -1
  16. package/dist/cabinet/geometry/sink.js +8 -39
  17. package/dist/cabinet/hosted-resize.d.ts +8 -0
  18. package/dist/cabinet/hosted-resize.d.ts.map +1 -0
  19. package/dist/cabinet/hosted-resize.js +158 -0
  20. package/dist/cabinet/run-layout.d.ts +8 -1
  21. package/dist/cabinet/run-layout.d.ts.map +1 -1
  22. package/dist/cabinet/run-layout.js +22 -14
  23. package/dist/cabinet/run-ops.d.ts +3 -3
  24. package/dist/cabinet/run-ops.js +3 -3
  25. package/dist/cabinet/run-panel.d.ts +1 -1
  26. package/dist/cabinet/run-panel.d.ts.map +1 -1
  27. package/dist/cabinet/run-panel.js +16 -7
  28. package/dist/cabinet/surfaces.d.ts +4 -0
  29. package/dist/cabinet/surfaces.d.ts.map +1 -0
  30. package/dist/cabinet/surfaces.js +101 -0
  31. package/dist/cabinet/tree-structure.d.ts.map +1 -1
  32. package/dist/cabinet/tree-structure.js +10 -9
  33. package/dist/ceiling/definition.js +1 -1
  34. package/dist/ceiling/floorplan-affordances.d.ts +4 -4
  35. package/dist/ceiling/panel.js +1 -1
  36. package/dist/chimney/panel.js +9 -9
  37. package/dist/cupola/panel.js +1 -1
  38. package/dist/door/panel.js +12 -12
  39. package/dist/dormer/panel-position-section.js +2 -2
  40. package/dist/dormer/panel.js +1 -1
  41. package/dist/duct-segment/parametrics.d.ts.map +1 -1
  42. package/dist/duct-segment/parametrics.js +5 -1
  43. package/dist/duct-segment/tool.d.ts +1 -0
  44. package/dist/duct-segment/tool.d.ts.map +1 -1
  45. package/dist/duct-segment/tool.js +10 -8
  46. package/dist/eyebrow-vent/panel.js +1 -1
  47. package/dist/fence/inspector-editors.js +1 -1
  48. package/dist/imported-mesh/definition.d.ts +5 -0
  49. package/dist/imported-mesh/definition.d.ts.map +1 -0
  50. package/dist/imported-mesh/definition.js +38 -0
  51. package/dist/imported-mesh/floorplan.d.ts +4 -0
  52. package/dist/imported-mesh/floorplan.d.ts.map +1 -0
  53. package/dist/imported-mesh/floorplan.js +34 -0
  54. package/dist/imported-mesh/geometry.d.ts +5 -0
  55. package/dist/imported-mesh/geometry.d.ts.map +1 -0
  56. package/dist/imported-mesh/geometry.js +34 -0
  57. package/dist/imported-mesh/index.d.ts +4 -0
  58. package/dist/imported-mesh/index.d.ts.map +1 -0
  59. package/dist/imported-mesh/index.js +3 -0
  60. package/dist/imported-mesh/schema.d.ts +2 -0
  61. package/dist/imported-mesh/schema.d.ts.map +1 -0
  62. package/dist/imported-mesh/schema.js +1 -0
  63. package/dist/index.d.ts +2 -0
  64. package/dist/index.d.ts.map +1 -1
  65. package/dist/index.js +8 -0
  66. package/dist/item/floorplan-move.d.ts +9 -1
  67. package/dist/item/floorplan-move.d.ts.map +1 -1
  68. package/dist/item/floorplan-move.js +55 -2
  69. package/dist/item/floorplan.d.ts.map +1 -1
  70. package/dist/item/floorplan.js +11 -0
  71. package/dist/item/move-tool.js +1 -1
  72. package/dist/item/panel.js +1 -1
  73. package/dist/pipe-segment/parametrics.d.ts.map +1 -1
  74. package/dist/pipe-segment/parametrics.js +5 -1
  75. package/dist/procedural-item/definition.d.ts +4 -0
  76. package/dist/procedural-item/definition.d.ts.map +1 -0
  77. package/dist/procedural-item/definition.js +254 -0
  78. package/dist/procedural-item/geometry.d.ts +31 -0
  79. package/dist/procedural-item/geometry.d.ts.map +1 -0
  80. package/dist/procedural-item/geometry.js +88 -0
  81. package/dist/procedural-item/index.d.ts +3 -0
  82. package/dist/procedural-item/index.d.ts.map +1 -0
  83. package/dist/procedural-item/index.js +2 -0
  84. package/dist/procedural-item/move-session.d.ts +15 -0
  85. package/dist/procedural-item/move-session.d.ts.map +1 -0
  86. package/dist/procedural-item/move-session.js +197 -0
  87. package/dist/procedural-item/move-tool.d.ts +5 -0
  88. package/dist/procedural-item/move-tool.d.ts.map +1 -0
  89. package/dist/procedural-item/move-tool.js +193 -0
  90. package/dist/procedural-item/renderer.d.ts +5 -0
  91. package/dist/procedural-item/renderer.d.ts.map +1 -0
  92. package/dist/procedural-item/renderer.js +66 -0
  93. package/dist/ridge-vent/panel.js +4 -4
  94. package/dist/roof/panel.d.ts.map +1 -1
  95. package/dist/roof/panel.js +7 -5
  96. package/dist/roof-segment/panel.d.ts.map +1 -1
  97. package/dist/roof-segment/panel.js +5 -5
  98. package/dist/shared/automatic-run-end-cap.d.ts +1 -0
  99. package/dist/shared/automatic-run-end-cap.d.ts.map +1 -1
  100. package/dist/shared/automatic-run-end-cap.js +10 -0
  101. package/dist/shared/distribution-run-tool.d.ts +10 -0
  102. package/dist/shared/distribution-run-tool.d.ts.map +1 -1
  103. package/dist/shared/distribution-run-tool.js +56 -11
  104. package/dist/shared/panel-fields.d.ts +15 -0
  105. package/dist/shared/panel-fields.d.ts.map +1 -0
  106. package/dist/shared/panel-fields.js +31 -0
  107. package/dist/shared/resting-surface-plan.d.ts +3 -0
  108. package/dist/shared/resting-surface-plan.d.ts.map +1 -0
  109. package/dist/shared/resting-surface-plan.js +28 -0
  110. package/dist/shelf/definition.d.ts.map +1 -1
  111. package/dist/shelf/definition.js +2 -1
  112. package/dist/shelf/floorplan-affordances.d.ts.map +1 -1
  113. package/dist/shelf/floorplan-affordances.js +5 -3
  114. package/dist/shelf/floorplan-move.d.ts.map +1 -1
  115. package/dist/shelf/floorplan-move.js +3 -2
  116. package/dist/shelf/geometry.d.ts.map +1 -1
  117. package/dist/shelf/geometry.js +2 -10
  118. package/dist/skylight/panel.js +6 -6
  119. package/dist/slab/panel.js +1 -1
  120. package/dist/solar-panel/panel.js +2 -2
  121. package/dist/spawn/panel.js +1 -1
  122. package/dist/stair/panel.d.ts.map +1 -1
  123. package/dist/stair/panel.js +9 -7
  124. package/dist/stair-segment/panel.js +4 -4
  125. package/dist/turbine-vent/panel.js +1 -1
  126. package/dist/unit/definition.d.ts +10 -0
  127. package/dist/unit/definition.d.ts.map +1 -0
  128. package/dist/unit/definition.js +38 -0
  129. package/dist/unit/index.d.ts +2 -0
  130. package/dist/unit/index.d.ts.map +1 -0
  131. package/dist/unit/index.js +1 -0
  132. package/dist/unit/parametrics.d.ts +3 -0
  133. package/dist/unit/parametrics.d.ts.map +1 -0
  134. package/dist/unit/parametrics.js +4 -0
  135. package/dist/unit/schema.d.ts +2 -0
  136. package/dist/unit/schema.d.ts.map +1 -0
  137. package/dist/unit/schema.js +1 -0
  138. package/dist/unit/unit-panel.d.ts +5 -0
  139. package/dist/unit/unit-panel.d.ts.map +1 -0
  140. package/dist/unit/unit-panel.js +61 -0
  141. package/dist/window/panel.js +6 -6
  142. package/dist/zone/definition.d.ts.map +1 -1
  143. package/dist/zone/definition.js +7 -1
  144. package/dist/zone/floorplan.d.ts +1 -3
  145. package/dist/zone/floorplan.d.ts.map +1 -1
  146. package/dist/zone/floorplan.js +43 -28
  147. package/dist/zone/quantities-panel.d.ts.map +1 -1
  148. package/dist/zone/quantities-panel.js +33 -29
  149. package/dist/zone/renderer.d.ts.map +1 -1
  150. package/dist/zone/renderer.js +20 -6
  151. package/dist/zone/unit-membership.d.ts +12 -0
  152. package/dist/zone/unit-membership.d.ts.map +1 -0
  153. package/dist/zone/unit-membership.js +22 -0
  154. package/package.json +14 -8
@@ -27,11 +27,6 @@ function isCabinetRun(node) {
27
27
  function isCabinetModule(node) {
28
28
  return node?.type === 'cabinet-module';
29
29
  }
30
- function cabinetModuleChildren(run, nodes) {
31
- return (run.children ?? [])
32
- .map((id) => nodes[id])
33
- .filter((child) => child?.type === 'cabinet-module');
34
- }
35
30
  function childIdsOf(node) {
36
31
  if (!node || typeof node !== 'object' || !('children' in node) || !Array.isArray(node.children)) {
37
32
  return [];
@@ -46,15 +41,19 @@ function resolveCabinetRunChildIds(run, nodes) {
46
41
  resolved.push(child.id);
47
42
  continue;
48
43
  }
49
- if (!isCabinetRun(child))
44
+ if (!isCabinetRun(child)) {
45
+ resolved.push(childId);
50
46
  continue;
47
+ }
51
48
  const link = cornerDerivedRunLink(child.metadata);
52
49
  if (link?.role === 'base-leg') {
53
50
  resolved.push(...resolveCabinetRunChildIds(child, nodes));
54
51
  continue;
55
52
  }
56
- if (link)
53
+ if (link) {
54
+ resolved.push(...resolveCabinetRunChildIds(child, nodes).filter((id) => !isCabinetModule(nodes[id])));
57
55
  continue;
56
+ }
58
57
  resolved.push(child.id);
59
58
  }
60
59
  return resolved;
@@ -92,11 +91,13 @@ export function cabinetTreeChildIds(node, nodes) {
92
91
  resolved.push(child.id);
93
92
  continue;
94
93
  }
95
- if (!isCabinetRun(child))
94
+ if (!isCabinetRun(child)) {
95
+ resolved.push(childId);
96
96
  continue;
97
+ }
97
98
  const link = cornerDerivedRunLink(child.metadata);
98
99
  if (link) {
99
- resolved.push(...cabinetModuleChildren(child, nodes).map((module) => module.id));
100
+ resolved.push(...resolveCabinetRunChildIds(child, nodes));
100
101
  continue;
101
102
  }
102
103
  resolved.push(child.id);
@@ -134,7 +134,7 @@ export const ceilingDefinition = {
134
134
  paint: ceilingPaint,
135
135
  },
136
136
  relations: {
137
- hosts: ['item'],
137
+ hosts: ['item', 'procedural-item'],
138
138
  cascadeDelete: 'descendants',
139
139
  },
140
140
  parametrics: ceilingParametrics,
@@ -5,7 +5,7 @@ export declare const ceilingMoveVertexAffordance: import("@pascal-app/core").Flo
5
5
  metadata: Record<string, unknown>;
6
6
  id: `ceiling_${string}`;
7
7
  type: "ceiling";
8
- children: `item_${string}`[];
8
+ children: (`item_${string}` | `procedural-item_${string}`)[];
9
9
  polygon: [number, number][];
10
10
  holes: [number, number][][];
11
11
  holeMetadata: {
@@ -50,7 +50,7 @@ export declare const ceilingAddVertexAffordance: import("@pascal-app/core").Floo
50
50
  metadata: Record<string, unknown>;
51
51
  id: `ceiling_${string}`;
52
52
  type: "ceiling";
53
- children: `item_${string}`[];
53
+ children: (`item_${string}` | `procedural-item_${string}`)[];
54
54
  polygon: [number, number][];
55
55
  holes: [number, number][][];
56
56
  holeMetadata: {
@@ -95,7 +95,7 @@ export declare const ceilingMoveEdgeAffordance: import("@pascal-app/core").Floor
95
95
  metadata: Record<string, unknown>;
96
96
  id: `ceiling_${string}`;
97
97
  type: "ceiling";
98
- children: `item_${string}`[];
98
+ children: (`item_${string}` | `procedural-item_${string}`)[];
99
99
  polygon: [number, number][];
100
100
  holes: [number, number][][];
101
101
  holeMetadata: {
@@ -140,7 +140,7 @@ export declare const ceilingDeleteVertexAffordance: import("@pascal-app/core").F
140
140
  metadata: Record<string, unknown>;
141
141
  id: `ceiling_${string}`;
142
142
  type: "ceiling";
143
- children: `item_${string}`[];
143
+ children: (`item_${string}` | `procedural-item_${string}`)[];
144
144
  polygon: [number, number][];
145
145
  holes: [number, number][][];
146
146
  holeMetadata: {
@@ -185,7 +185,7 @@ export function CeilingPanel() {
185
185
  return (_jsxs(PanelWrapper, { icon: "/icons/ceiling.webp", onClose: handleClose, title: node.name || 'Ceiling', width: 320, children: [_jsxs(PanelSection, { title: "Height", children: [_jsx(SegmentedControl, { onChange: handleTopModeChange, options: [
186
186
  { label: 'Follows level', value: 'storey' },
187
187
  { label: 'Custom height', value: 'custom' },
188
- ], value: isFollows ? 'storey' : 'custom' }), isFollows ? (_jsxs("div", { className: "px-1 text-[11px] text-muted-foreground", children: ["Currently ", formatLinearMeasurement(resolvedHeight, unit, metricNotation)] })) : (_jsx(SliderControl, { label: "Height", max: Math.min(1000, maxHeight), min: 0, onChange: handleHeightChange, precision: 3, step: 0.01, unit: "m", value: Math.round((node.height ?? resolvedHeight) * 1000) / 1000 })), _jsx("div", { className: "mt-2 grid grid-cols-3 gap-1.5 px-1 pb-1", children: heightPresets.map((preset) => {
188
+ ], value: isFollows ? 'storey' : 'custom' }), isFollows ? (_jsxs("div", { className: "px-1 text-[11px] text-muted-foreground", children: ["Currently ", formatLinearMeasurement(resolvedHeight, unit, metricNotation)] })) : (_jsx(SliderControl, { label: "Height", max: Math.min(1000, maxHeight), min: 0, onChange: handleHeightChange, precision: 3, step: 0.01, unit: "m", value: node.height ?? resolvedHeight })), _jsx("div", { className: "mt-2 grid grid-cols-3 gap-1.5 px-1 pb-1", children: heightPresets.map((preset) => {
189
189
  const fits = preset.height <= maxHeight;
190
190
  return (_jsx(ActionButton, { className: fits ? undefined : 'cursor-not-allowed opacity-40', disabled: !fits, label: preset.label, onClick: () => handleHeightChange(preset.height), title: fits
191
191
  ? undefined
@@ -283,7 +283,7 @@ export default function ChimneyPanel() {
283
283
  value: activePreset ?? '' }) }), _jsxs(PanelSection, { title: "Footprint", children: [_jsx(SegmentedControl, { onChange: (v) => handleUpdate({ bodyShape: v }), options: [
284
284
  { label: 'Square', value: 'square' },
285
285
  { label: 'Round', value: 'round' },
286
- ], value: node.bodyShape ?? 'square' }), _jsx(SliderControl, { label: (node.bodyShape ?? 'square') === 'round' ? 'Diameter' : 'Width', max: 1000, min: 0.2, onChange: (v) => previewProp({ width: v }), onCommit: (v) => commitProp({ width: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: Math.round(node.width * 100) / 100 }), (node.bodyShape ?? 'square') !== 'round' && (_jsx(SliderControl, { label: "Depth", max: 1000, min: 0.2, onChange: (v) => previewProp({ depth: v }), onCommit: (v) => commitProp({ depth: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: Math.round(node.depth * 100) / 100 })), _jsx(SliderControl, { label: "Hollow Depth", max: 3, min: 0, onChange: (v) => previewProp({ bodyHollowDepth: v }), onCommit: (v) => commitProp({ bodyHollowDepth: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: Math.round((node.bodyHollowDepth ?? 0.6) * 100) / 100 }), _jsx(SliderControl, { label: "Wall Thickness", max: 0.3, min: 0, onChange: (v) => previewProp({ bodyHollowMargin: v }), onCommit: (v) => commitProp({ bodyHollowMargin: v }), precision: 3, restoreOnCommit: false, step: 0.005, unit: "m", value: Math.round((node.bodyHollowMargin ?? 0.08) * 1000) / 1000 }), (node.bodyShape ?? 'square') !== 'round' && (_jsx(SliderControl, { label: "Corner Bevel", max: Math.max(0, Math.min(node.width, node.depth) / 2 - 0.005), min: 0, onChange: (v) => previewProp({ cornerBevel: v }), onCommit: (v) => commitProp({ cornerBevel: v }), precision: 3, restoreOnCommit: false, step: 0.005, unit: "m", value: Math.round((node.cornerBevel ?? 0) * 1000) / 1000 }))] }), _jsxs(PanelSection, { title: "Height", children: [_jsx(SliderControl, { label: "Above Ridge", max: 1000, min: 0.1, onChange: (v) => previewProp({ heightAboveRidge: v }), onCommit: (v) => commitProp({ heightAboveRidge: v }), precision: 2, restoreOnCommit: false, step: 0.1, unit: "m", value: Math.round(node.heightAboveRidge * 100) / 100 }), _jsx(SliderControl, { label: "Cutout Offset", max: 0.5, min: 0, onChange: (v) => previewProp({ cutoutOffset: v }), onCommit: (v) => commitProp({ cutoutOffset: v }), precision: 3, restoreOnCommit: false, step: 0.005, unit: "m", value: Math.round((node.cutoutOffset ?? 0) * 1000) / 1000 })] }), _jsxs(PanelSection, { title: "Position", children: [_jsx(SliderControl, { label: "X", max: Math.round(worldMaxX * 10) / 10, min: Math.round(worldMinX * 10) / 10, onChange: (newWorldX) => {
286
+ ], value: node.bodyShape ?? 'square' }), _jsx(SliderControl, { label: (node.bodyShape ?? 'square') === 'round' ? 'Diameter' : 'Width', max: 1000, min: 0.2, onChange: (v) => previewProp({ width: v }), onCommit: (v) => commitProp({ width: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: node.width }), (node.bodyShape ?? 'square') !== 'round' && (_jsx(SliderControl, { label: "Depth", max: 1000, min: 0.2, onChange: (v) => previewProp({ depth: v }), onCommit: (v) => commitProp({ depth: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: node.depth })), _jsx(SliderControl, { label: "Hollow Depth", max: 3, min: 0, onChange: (v) => previewProp({ bodyHollowDepth: v }), onCommit: (v) => commitProp({ bodyHollowDepth: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: node.bodyHollowDepth ?? 0.6 }), _jsx(SliderControl, { label: "Wall Thickness", max: 0.3, min: 0, onChange: (v) => previewProp({ bodyHollowMargin: v }), onCommit: (v) => commitProp({ bodyHollowMargin: v }), precision: 3, restoreOnCommit: false, step: 0.005, unit: "m", value: node.bodyHollowMargin ?? 0.08 }), (node.bodyShape ?? 'square') !== 'round' && (_jsx(SliderControl, { label: "Corner Bevel", max: Math.max(0, Math.min(node.width, node.depth) / 2 - 0.005), min: 0, onChange: (v) => previewProp({ cornerBevel: v }), onCommit: (v) => commitProp({ cornerBevel: v }), precision: 3, restoreOnCommit: false, step: 0.005, unit: "m", value: node.cornerBevel ?? 0 }))] }), _jsxs(PanelSection, { title: "Height", children: [_jsx(SliderControl, { label: "Above Ridge", max: 1000, min: 0.1, onChange: (v) => previewProp({ heightAboveRidge: v }), onCommit: (v) => commitProp({ heightAboveRidge: v }), precision: 2, restoreOnCommit: false, step: 0.1, unit: "m", value: node.heightAboveRidge }), _jsx(SliderControl, { label: "Cutout Offset", max: 0.5, min: 0, onChange: (v) => previewProp({ cutoutOffset: v }), onCommit: (v) => commitProp({ cutoutOffset: v }), precision: 3, restoreOnCommit: false, step: 0.005, unit: "m", value: node.cutoutOffset ?? 0 })] }), _jsxs(PanelSection, { title: "Position", children: [_jsx(SliderControl, { label: "X", max: Math.round(worldMaxX * 10) / 10, min: Math.round(worldMinX * 10) / 10, onChange: (newWorldX) => {
287
287
  // Live preview: keep the chimney parented to its current segment
288
288
  // and update its segment-local position so the visual matches the
289
289
  // dragged world X. Reparenting (if any) happens on commit.
@@ -291,12 +291,12 @@ export default function ChimneyPanel() {
291
291
  return;
292
292
  const local = worldToSegLocal(newWorldX, worldZ_now, segment);
293
293
  previewProp({ position: [local.localX, 0, local.localZ] });
294
- }, onCommit: (newWorldX) => commitWorldPosition(newWorldX, worldZ_now), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: Math.round(worldX_now * 100) / 100 }), _jsx(SliderControl, { label: "Z", max: Math.round(worldMaxZ * 10) / 10, min: Math.round(worldMinZ * 10) / 10, onChange: (newWorldZ) => {
294
+ }, onCommit: (newWorldX) => commitWorldPosition(newWorldX, worldZ_now), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: worldX_now }), _jsx(SliderControl, { label: "Z", max: Math.round(worldMaxZ * 10) / 10, min: Math.round(worldMinZ * 10) / 10, onChange: (newWorldZ) => {
295
295
  if (!segment)
296
296
  return;
297
297
  const local = worldToSegLocal(worldX_now, newWorldZ, segment);
298
298
  previewProp({ position: [local.localX, 0, local.localZ] });
299
- }, onCommit: (newWorldZ) => commitWorldPosition(worldX_now, newWorldZ), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: Math.round(worldZ_now * 100) / 100 }), _jsx(SliderControl, { label: "Rotation", max: 180, min: -180, onChange: (degrees) => {
299
+ }, onCommit: (newWorldZ) => commitWorldPosition(worldX_now, newWorldZ), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: worldZ_now }), _jsx(SliderControl, { label: "Rotation", max: 180, min: -180, onChange: (degrees) => {
300
300
  // World rotation → segment-local rotation for the current segment.
301
301
  const newWorldRot = (degrees * Math.PI) / 180;
302
302
  let ancestorWorldY = 0;
@@ -326,25 +326,25 @@ export default function ChimneyPanel() {
326
326
  { label: 'Sloped', value: 'sloped' },
327
327
  { label: 'Flat', value: 'flat' },
328
328
  { label: 'Stepped', value: 'stepped' },
329
- ], value: node.capShape ?? 'sloped' }), (node.capShape ?? 'sloped') !== 'none' && (_jsxs(_Fragment, { children: [_jsx(SliderControl, { label: "Overhang", max: 0.2, min: 0, onChange: (v) => previewProp({ capOverhang: v }), onCommit: (v) => commitProp({ capOverhang: v }), precision: 3, restoreOnCommit: false, step: 0.005, unit: "m", value: Math.round((node.capOverhang ?? 0.04) * 1000) / 1000 }), _jsx(SliderControl, { label: "Thickness", max: 0.3, min: 0.02, onChange: (v) => previewProp({ capThickness: v }), onCommit: (v) => commitProp({ capThickness: v }), precision: 3, restoreOnCommit: false, step: 0.005, unit: "m", value: Math.round((node.capThickness ?? 0.08) * 1000) / 1000 })] }))] })), chimneyType === 'shoulder' && (_jsxs(_Fragment, { children: [_jsx(SegmentedControl, { className: "mt-2", onChange: (v) => handleUpdate({ shoulderStyle: v }), options: [
329
+ ], value: node.capShape ?? 'sloped' }), (node.capShape ?? 'sloped') !== 'none' && (_jsxs(_Fragment, { children: [_jsx(SliderControl, { label: "Overhang", max: 0.2, min: 0, onChange: (v) => previewProp({ capOverhang: v }), onCommit: (v) => commitProp({ capOverhang: v }), precision: 3, restoreOnCommit: false, step: 0.005, unit: "m", value: node.capOverhang ?? 0.04 }), _jsx(SliderControl, { label: "Thickness", max: 0.3, min: 0.02, onChange: (v) => previewProp({ capThickness: v }), onCommit: (v) => commitProp({ capThickness: v }), precision: 3, restoreOnCommit: false, step: 0.005, unit: "m", value: node.capThickness ?? 0.08 })] }))] })), chimneyType === 'shoulder' && (_jsxs(_Fragment, { children: [_jsx(SegmentedControl, { className: "mt-2", onChange: (v) => handleUpdate({ shoulderStyle: v }), options: [
330
330
  { label: 'None', value: 'none' },
331
331
  { label: 'Tapered', value: 'tapered' },
332
332
  { label: 'Corbeled', value: 'corbeled' },
333
- ], value: node.shoulderStyle ?? 'none' }), (node.shoulderStyle ?? 'none') !== 'none' && (_jsxs(_Fragment, { children: [_jsx(SliderControl, { label: "Height", max: 3, min: 0.1, onChange: (v) => previewProp({ shoulderHeight: v }), onCommit: (v) => commitProp({ shoulderHeight: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: Math.round((node.shoulderHeight ?? 0.5) * 100) / 100 }), _jsx(SliderControl, { label: "Extent", max: 0.5, min: 0, onChange: (v) => previewProp({ shoulderExtent: v }), onCommit: (v) => commitProp({ shoulderExtent: v }), precision: 2, restoreOnCommit: false, step: 0.01, unit: "m", value: Math.round((node.shoulderExtent ?? 0.1) * 100) / 100 })] }))] })), chimneyType === 'flues' && (_jsxs(_Fragment, { children: [_jsx(SliderControl, { label: "Count", max: 4, min: 0, onChange: (v) => previewProp({ flueCount: Math.round(v) }), onCommit: (v) => commitProp({ flueCount: Math.round(v) }), precision: 0, restoreOnCommit: false, step: 1, unit: "", value: node.flueCount ?? 1 }), (node.flueCount ?? 1) > 0 && (_jsxs(_Fragment, { children: [_jsx(SegmentedControl, { onChange: (v) => handleUpdate({ flueShape: v }), options: [
333
+ ], value: node.shoulderStyle ?? 'none' }), (node.shoulderStyle ?? 'none') !== 'none' && (_jsxs(_Fragment, { children: [_jsx(SliderControl, { label: "Height", max: 3, min: 0.1, onChange: (v) => previewProp({ shoulderHeight: v }), onCommit: (v) => commitProp({ shoulderHeight: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: node.shoulderHeight ?? 0.5 }), _jsx(SliderControl, { label: "Extent", max: 0.5, min: 0, onChange: (v) => previewProp({ shoulderExtent: v }), onCommit: (v) => commitProp({ shoulderExtent: v }), precision: 2, restoreOnCommit: false, step: 0.01, unit: "m", value: node.shoulderExtent ?? 0.1 })] }))] })), chimneyType === 'flues' && (_jsxs(_Fragment, { children: [_jsx(SliderControl, { label: "Count", max: 4, min: 0, onChange: (v) => previewProp({ flueCount: Math.round(v) }), onCommit: (v) => commitProp({ flueCount: Math.round(v) }), precision: 0, restoreOnCommit: false, step: 1, unit: "", value: node.flueCount ?? 1 }), (node.flueCount ?? 1) > 0 && (_jsxs(_Fragment, { children: [_jsx(SegmentedControl, { onChange: (v) => handleUpdate({ flueShape: v }), options: [
334
334
  { label: 'Round', value: 'round' },
335
335
  { label: 'Square', value: 'square' },
336
- ], value: node.flueShape ?? 'round' }), _jsx(SliderControl, { label: "Diameter", max: Math.max(0.4, node.width), min: 0.05, onChange: (v) => previewProp({ flueDiameter: v }), onCommit: (v) => commitProp({ flueDiameter: v }), precision: 2, restoreOnCommit: false, step: 0.01, unit: "m", value: Math.round((node.flueDiameter ?? 0.22) * 100) / 100 }), _jsx(SliderControl, { label: "Height", max: 1.5, min: 0.05, onChange: (v) => previewProp({ flueHeight: v }), onCommit: (v) => commitProp({ flueHeight: v }), precision: 2, restoreOnCommit: false, step: 0.01, unit: "m", value: Math.round((node.flueHeight ?? 0.3) * 100) / 100 }), (node.flueCount ?? 1) > 1 && (_jsx(SliderControl, { label: "Spacing", max: 1, min: 0, onChange: (v) => previewProp({ flueSpacing: v }), onCommit: (v) => commitProp({ flueSpacing: v }), precision: 2, restoreOnCommit: false, step: 0.05, value: Math.round((node.flueSpacing ?? 1) * 100) / 100 })), _jsx(SliderControl, { label: "Wall Thickness", max: Math.max(0.1, (node.flueDiameter ?? 0.22) / 2 - 0.01), min: 0, onChange: (v) => previewProp({ flueWallThickness: v }), onCommit: (v) => commitProp({ flueWallThickness: v }), precision: 3, restoreOnCommit: false, step: 0.005, unit: "m", value: Math.round((node.flueWallThickness ?? 0.02) * 1000) / 1000 })] }))] })), chimneyType === 'bands' && (_jsxs(_Fragment, { children: [_jsx(SegmentedControl, { className: "mt-2", onChange: (v) => handleUpdate({ bandStyle: v }), options: [
336
+ ], value: node.flueShape ?? 'round' }), _jsx(SliderControl, { label: "Diameter", max: Math.max(0.4, node.width), min: 0.05, onChange: (v) => previewProp({ flueDiameter: v }), onCommit: (v) => commitProp({ flueDiameter: v }), precision: 2, restoreOnCommit: false, step: 0.01, unit: "m", value: node.flueDiameter ?? 0.22 }), _jsx(SliderControl, { label: "Height", max: 1.5, min: 0.05, onChange: (v) => previewProp({ flueHeight: v }), onCommit: (v) => commitProp({ flueHeight: v }), precision: 2, restoreOnCommit: false, step: 0.01, unit: "m", value: node.flueHeight ?? 0.3 }), (node.flueCount ?? 1) > 1 && (_jsx(SliderControl, { label: "Spacing", max: 1, min: 0, onChange: (v) => previewProp({ flueSpacing: v }), onCommit: (v) => commitProp({ flueSpacing: v }), precision: 2, restoreOnCommit: false, step: 0.05, value: Math.round((node.flueSpacing ?? 1) * 100) / 100 })), _jsx(SliderControl, { label: "Wall Thickness", max: Math.max(0.1, (node.flueDiameter ?? 0.22) / 2 - 0.01), min: 0, onChange: (v) => previewProp({ flueWallThickness: v }), onCommit: (v) => commitProp({ flueWallThickness: v }), precision: 3, restoreOnCommit: false, step: 0.005, unit: "m", value: node.flueWallThickness ?? 0.02 })] }))] })), chimneyType === 'bands' && (_jsxs(_Fragment, { children: [_jsx(SegmentedControl, { className: "mt-2", onChange: (v) => handleUpdate({ bandStyle: v }), options: [
337
337
  { label: 'None', value: 'none' },
338
338
  { label: 'Single', value: 'single' },
339
339
  { label: 'Double', value: 'double' },
340
- ], value: node.bandStyle ?? 'none' }), (node.bandStyle ?? 'none') !== 'none' && (_jsxs(_Fragment, { children: [_jsx(SliderControl, { label: "Thickness", max: 0.4, min: 0.02, onChange: (v) => previewProp({ bandHeight: v }), onCommit: (v) => commitProp({ bandHeight: v }), precision: 2, restoreOnCommit: false, step: 0.01, unit: "m", value: Math.round((node.bandHeight ?? 0.1) * 100) / 100 }), _jsx(SliderControl, { label: "Extent", max: 0.2, min: 0, onChange: (v) => previewProp({ bandExtent: v }), onCommit: (v) => commitProp({ bandExtent: v }), precision: 3, restoreOnCommit: false, step: 0.005, unit: "m", value: Math.round((node.bandExtent ?? 0.04) * 1000) / 1000 }), _jsx(SliderControl, { label: "Offset", max: 3, min: 0, onChange: (v) => previewProp({ bandOffset: v }), onCommit: (v) => commitProp({ bandOffset: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: Math.round((node.bandOffset ?? 0.4) * 100) / 100 })] }))] })), chimneyType === 'cricket' && (_jsxs(_Fragment, { children: [_jsx(SegmentedControl, { className: "mt-2", onChange: (v) => handleUpdate({ cricketStyle: v }), options: [
340
+ ], value: node.bandStyle ?? 'none' }), (node.bandStyle ?? 'none') !== 'none' && (_jsxs(_Fragment, { children: [_jsx(SliderControl, { label: "Thickness", max: 0.4, min: 0.02, onChange: (v) => previewProp({ bandHeight: v }), onCommit: (v) => commitProp({ bandHeight: v }), precision: 2, restoreOnCommit: false, step: 0.01, unit: "m", value: node.bandHeight ?? 0.1 }), _jsx(SliderControl, { label: "Extent", max: 0.2, min: 0, onChange: (v) => previewProp({ bandExtent: v }), onCommit: (v) => commitProp({ bandExtent: v }), precision: 3, restoreOnCommit: false, step: 0.005, unit: "m", value: node.bandExtent ?? 0.04 }), _jsx(SliderControl, { label: "Offset", max: 3, min: 0, onChange: (v) => previewProp({ bandOffset: v }), onCommit: (v) => commitProp({ bandOffset: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: node.bandOffset ?? 0.4 })] }))] })), chimneyType === 'cricket' && (_jsxs(_Fragment, { children: [_jsx(SegmentedControl, { className: "mt-2", onChange: (v) => handleUpdate({ cricketStyle: v }), options: [
341
341
  { label: 'None', value: 'none' },
342
342
  { label: 'Simple', value: 'simple' },
343
343
  ], value: node.cricketStyle ?? 'none' }), (node.cricketStyle ?? 'none') !== 'none' && (_jsxs(_Fragment, { children: [_jsx(SegmentedControl, { className: "mt-2", onChange: (v) => handleUpdate({ cricketSide: v }), options: [
344
344
  { label: 'Front', value: 'front' },
345
345
  { label: 'Back', value: 'back' },
346
- ], value: node.cricketSide ?? 'front' }), _jsx(SliderControl, { label: "Length", max: 2, min: 0.1, onChange: (v) => previewProp({ cricketLength: v }), onCommit: (v) => commitProp({ cricketLength: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: Math.round((node.cricketLength ?? 0.6) * 100) / 100 }), _jsx(SliderControl, { label: "Height", max: 1.5, min: 0.05, onChange: (v) => previewProp({ cricketHeight: v }), onCommit: (v) => commitProp({ cricketHeight: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: Math.round((node.cricketHeight ?? 0.4) * 100) / 100 })] }))] })), chimneyType === 'panels' && (_jsxs(_Fragment, { children: [_jsx(SegmentedControl, { className: "mt-2", onChange: (v) => handleUpdate({ panelStyle: v }), options: [
346
+ ], value: node.cricketSide ?? 'front' }), _jsx(SliderControl, { label: "Length", max: 2, min: 0.1, onChange: (v) => previewProp({ cricketLength: v }), onCommit: (v) => commitProp({ cricketLength: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: node.cricketLength ?? 0.6 }), _jsx(SliderControl, { label: "Height", max: 1.5, min: 0.05, onChange: (v) => previewProp({ cricketHeight: v }), onCommit: (v) => commitProp({ cricketHeight: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: node.cricketHeight ?? 0.4 })] }))] })), chimneyType === 'panels' && (_jsxs(_Fragment, { children: [_jsx(SegmentedControl, { className: "mt-2", onChange: (v) => handleUpdate({ panelStyle: v }), options: [
347
347
  { label: 'None', value: 'none' },
348
348
  { label: 'Rectangular', value: 'rectangular' },
349
- ], value: node.panelStyle ?? 'none' }), (node.panelStyle ?? 'none') !== 'none' && (_jsxs(_Fragment, { children: [_jsx(SliderControl, { label: "Depth", max: 0.15, min: 0.005, onChange: (v) => previewProp({ panelDepth: v }), onCommit: (v) => commitProp({ panelDepth: v }), precision: 3, restoreOnCommit: false, step: 0.005, unit: "m", value: Math.round((node.panelDepth ?? 0.03) * 1000) / 1000 }), _jsx(SliderControl, { label: "Height", max: 3, min: 0.1, onChange: (v) => previewProp({ panelHeight: v }), onCommit: (v) => commitProp({ panelHeight: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: Math.round((node.panelHeight ?? 0.8) * 100) / 100 }), _jsx(SliderControl, { label: "Top Offset", max: 2, min: 0, onChange: (v) => previewProp({ panelOffsetTop: v }), onCommit: (v) => commitProp({ panelOffsetTop: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: Math.round((node.panelOffsetTop ?? 0.15) * 100) / 100 }), _jsx(SliderControl, { label: "Side Margin", max: Math.max(0.5, node.width / 2 - 0.05), min: 0.02, onChange: (v) => previewProp({ panelMargin: v }), onCommit: (v) => commitProp({ panelMargin: v }), precision: 2, restoreOnCommit: false, step: 0.01, unit: "m", value: Math.round((node.panelMargin ?? 0.1) * 100) / 100 })] }))] }))] }), _jsx(PanelSection, { title: "Actions", children: _jsx(ActionGroup, { children: _jsx(ActionButton, { className: "hover:bg-red-500/20", icon: _jsx(Trash2, { className: "h-3.5 w-3.5 text-red-400" }), label: "Delete", onClick: handleDelete }) }) })] }));
349
+ ], value: node.panelStyle ?? 'none' }), (node.panelStyle ?? 'none') !== 'none' && (_jsxs(_Fragment, { children: [_jsx(SliderControl, { label: "Depth", max: 0.15, min: 0.005, onChange: (v) => previewProp({ panelDepth: v }), onCommit: (v) => commitProp({ panelDepth: v }), precision: 3, restoreOnCommit: false, step: 0.005, unit: "m", value: node.panelDepth ?? 0.03 }), _jsx(SliderControl, { label: "Height", max: 3, min: 0.1, onChange: (v) => previewProp({ panelHeight: v }), onCommit: (v) => commitProp({ panelHeight: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: node.panelHeight ?? 0.8 }), _jsx(SliderControl, { label: "Top Offset", max: 2, min: 0, onChange: (v) => previewProp({ panelOffsetTop: v }), onCommit: (v) => commitProp({ panelOffsetTop: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: node.panelOffsetTop ?? 0.15 }), _jsx(SliderControl, { label: "Side Margin", max: Math.max(0.5, node.width / 2 - 0.05), min: 0.02, onChange: (v) => previewProp({ panelMargin: v }), onCommit: (v) => commitProp({ panelMargin: v }), precision: 2, restoreOnCommit: false, step: 0.01, unit: "m", value: node.panelMargin ?? 0.1 })] }))] }))] }), _jsx(PanelSection, { title: "Actions", children: _jsx(ActionGroup, { children: _jsx(ActionButton, { className: "hover:bg-red-500/20", icon: _jsx(Trash2, { className: "h-3.5 w-3.5 text-red-400" }), label: "Delete", onClick: handleDelete }) }) })] }));
350
350
  }
@@ -102,5 +102,5 @@ export default function CupolaPanel() {
102
102
  ], value: node.roofStyle ?? 'dome' }), _jsx(SegmentedControl, { onChange: (v) => handleUpdate({ finial: v === 'on' }), options: [
103
103
  { label: 'Finial', value: 'on' },
104
104
  { label: 'No Finial', value: 'off' },
105
- ], value: (node.finial ?? true) ? 'on' : 'off' })] }), _jsxs(PanelSection, { title: "Dimensions", children: [_jsx(SliderControl, { label: "Width", max: 1000, min: 0.3, onChange: (v) => previewProp({ width: v }), onCommit: (v) => handleUpdate({ width: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: Math.round(node.width * 100) / 100 }), _jsx(SliderControl, { label: "Depth", max: 1000, min: 0.3, onChange: (v) => previewProp({ depth: v }), onCommit: (v) => handleUpdate({ depth: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: Math.round(node.depth * 100) / 100 }), _jsx(SliderControl, { label: "Height", max: 1000, min: 0.4, onChange: (v) => previewProp({ height: v }), onCommit: (v) => handleUpdate({ height: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: Math.round(node.height * 100) / 100 })] }), _jsxs(PanelSection, { title: "Position", children: [_jsx(SliderControl, { label: "X", max: Math.round(((segment?.width ?? 10) / 2) * 100) / 100, min: -Math.round(((segment?.width ?? 10) / 2) * 100) / 100, onChange: (v) => previewProp({ position: [v, node.position[1] ?? 0, node.position[2] ?? 0] }), onCommit: (v) => handleUpdate({ position: [v, node.position[1] ?? 0, node.position[2] ?? 0] }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: Math.round((node.position[0] ?? 0) * 100) / 100 }), _jsx(SliderControl, { label: "Y", max: Math.max((segment?.wallHeight ?? 3) + (segment ? getActiveRoofHeight(segment) : 3) + 2, (node.position[1] ?? 0) + 0.1), min: Math.min(0, (node.position[1] ?? 0) - 0.5), onChange: (v) => previewProp({ position: [node.position[0] ?? 0, v, node.position[2] ?? 0] }), onCommit: (v) => handleUpdate({ position: [node.position[0] ?? 0, v, node.position[2] ?? 0] }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: Math.round((node.position[1] ?? 0) * 100) / 100 }), _jsx(SliderControl, { label: "Z", max: Math.round(((segment?.depth ?? 10) / 2) * 100) / 100, min: -Math.round(((segment?.depth ?? 10) / 2) * 100) / 100, onChange: (v) => previewProp({ position: [node.position[0] ?? 0, node.position[1] ?? 0, v] }), onCommit: (v) => handleUpdate({ position: [node.position[0] ?? 0, node.position[1] ?? 0, v] }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: Math.round((node.position[2] ?? 0) * 100) / 100 }), _jsx(SliderControl, { label: "Rotation", max: 180, min: -180, onChange: (deg) => previewProp({ rotation: (deg * Math.PI) / 180 }), onCommit: (deg) => handleUpdate({ rotation: (deg * Math.PI) / 180 }), precision: 0, restoreOnCommit: false, step: 1, unit: "\u00B0", value: Math.round(((node.rotation ?? 0) * 180) / Math.PI) })] }), _jsx(PanelSection, { title: "Actions", children: _jsxs(ActionGroup, { children: [_jsx(ActionButton, { icon: _jsx(Move, { className: "h-3.5 w-3.5" }), label: "Move", onClick: handleMove }), _jsx(ActionButton, { icon: _jsx(Copy, { className: "h-3.5 w-3.5" }), label: "Duplicate", onClick: handleDuplicate }), _jsx(ActionButton, { className: "hover:bg-red-500/20", icon: _jsx(Trash2, { className: "h-3.5 w-3.5 text-red-400" }), label: "Delete", onClick: handleDelete })] }) })] }));
105
+ ], value: (node.finial ?? true) ? 'on' : 'off' })] }), _jsxs(PanelSection, { title: "Dimensions", children: [_jsx(SliderControl, { label: "Width", max: 1000, min: 0.3, onChange: (v) => previewProp({ width: v }), onCommit: (v) => handleUpdate({ width: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: node.width }), _jsx(SliderControl, { label: "Depth", max: 1000, min: 0.3, onChange: (v) => previewProp({ depth: v }), onCommit: (v) => handleUpdate({ depth: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: node.depth }), _jsx(SliderControl, { label: "Height", max: 1000, min: 0.4, onChange: (v) => previewProp({ height: v }), onCommit: (v) => handleUpdate({ height: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: node.height })] }), _jsxs(PanelSection, { title: "Position", children: [_jsx(SliderControl, { label: "X", max: Math.round(((segment?.width ?? 10) / 2) * 100) / 100, min: -Math.round(((segment?.width ?? 10) / 2) * 100) / 100, onChange: (v) => previewProp({ position: [v, node.position[1] ?? 0, node.position[2] ?? 0] }), onCommit: (v) => handleUpdate({ position: [v, node.position[1] ?? 0, node.position[2] ?? 0] }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: node.position[0] ?? 0 }), _jsx(SliderControl, { label: "Y", max: Math.max((segment?.wallHeight ?? 3) + (segment ? getActiveRoofHeight(segment) : 3) + 2, (node.position[1] ?? 0) + 0.1), min: Math.min(0, (node.position[1] ?? 0) - 0.5), onChange: (v) => previewProp({ position: [node.position[0] ?? 0, v, node.position[2] ?? 0] }), onCommit: (v) => handleUpdate({ position: [node.position[0] ?? 0, v, node.position[2] ?? 0] }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: node.position[1] ?? 0 }), _jsx(SliderControl, { label: "Z", max: Math.round(((segment?.depth ?? 10) / 2) * 100) / 100, min: -Math.round(((segment?.depth ?? 10) / 2) * 100) / 100, onChange: (v) => previewProp({ position: [node.position[0] ?? 0, node.position[1] ?? 0, v] }), onCommit: (v) => handleUpdate({ position: [node.position[0] ?? 0, node.position[1] ?? 0, v] }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: node.position[2] ?? 0 }), _jsx(SliderControl, { label: "Rotation", max: 180, min: -180, onChange: (deg) => previewProp({ rotation: (deg * Math.PI) / 180 }), onCommit: (deg) => handleUpdate({ rotation: (deg * Math.PI) / 180 }), precision: 0, restoreOnCommit: false, step: 1, unit: "\u00B0", value: Math.round(((node.rotation ?? 0) * 180) / Math.PI) })] }), _jsx(PanelSection, { title: "Actions", children: _jsxs(ActionGroup, { children: [_jsx(ActionButton, { icon: _jsx(Move, { className: "h-3.5 w-3.5" }), label: "Move", onClick: handleMove }), _jsx(ActionButton, { icon: _jsx(Copy, { className: "h-3.5 w-3.5" }), label: "Duplicate", onClick: handleDuplicate }), _jsx(ActionButton, { className: "hover:bg-red-500/20", icon: _jsx(Trash2, { className: "h-3.5 w-3.5 text-red-400" }), label: "Delete", onClick: handleDelete })] }) })] }));
106
106
  }
@@ -478,19 +478,19 @@ export default function DoorPanel() {
478
478
  ? 'border-orange-400/60 bg-orange-400/10 text-foreground'
479
479
  : 'border-border/50 bg-[#2C2C2E] text-muted-foreground hover:bg-[#3e3e3e] hover:text-foreground', !option.available &&
480
480
  'cursor-not-allowed opacity-45 hover:bg-[#2C2C2E] hover:text-muted-foreground'), disabled: !option.available, onClick: () => handleUpdate(getDoorTypeUpdates(option.value)), type: "button", children: [_jsx(DoorOpen, { className: "h-4 w-4 shrink-0" }), _jsx("span", { className: "truncate font-medium", children: option.label })] }, option.value));
481
- }) }))] }), _jsx(PanelSection, { title: "Documentation", children: _jsx(OpeningDocumentationFields, { constructionType: node.constructionType, dimensionReference: node.dimensionReference, finishOpeningHeight: node.finishOpeningHeight, finishOpeningWidth: node.finishOpeningWidth, mark: node.mark, masonryOpeningHeight: node.masonryOpeningHeight, masonryOpeningWidth: node.masonryOpeningWidth, onChange: handleUpdate, roughOpeningHeight: node.roughOpeningHeight, roughOpeningWidth: node.roughOpeningWidth }) }), _jsxs(PanelSection, { title: "Position", children: [_jsx(SliderControl, { label: _jsxs(_Fragment, { children: ["X", _jsx("sub", { className: "ml-[1px] text-[11px] opacity-70", children: "wall" })] }), max: 10, min: -10, onChange: (v) => handleUpdate({ position: [v, node.position[1], node.position[2]] }), precision: 2, step: 0.1, unit: "m", value: Math.round(node.position[0] * 100) / 100 }), showFlipSide && (_jsx("div", { className: "px-1 pt-2 pb-1", children: _jsx(ActionButton, { className: "w-full", icon: _jsx(FlipHorizontal2, { className: "h-4 w-4" }), label: "Flip Side", onClick: handleFlip }) }))] }), showFoldSection && (_jsxs(PanelSection, { title: "Fold", children: [_jsx("div", { className: "flex flex-col gap-2 px-1 pb-1", children: _jsxs("div", { className: "space-y-1", children: [_jsx("span", { className: "font-medium text-[10px] text-muted-foreground/80 uppercase tracking-wider", children: "Panels" }), _jsx(SegmentedControl, { onChange: (v) => handleUpdate({ leafCount: v === '2' ? 2 : 4 }), options: [
481
+ }) }))] }), _jsx(PanelSection, { title: "Documentation", children: _jsx(OpeningDocumentationFields, { constructionType: node.constructionType, dimensionReference: node.dimensionReference, finishOpeningHeight: node.finishOpeningHeight, finishOpeningWidth: node.finishOpeningWidth, mark: node.mark, masonryOpeningHeight: node.masonryOpeningHeight, masonryOpeningWidth: node.masonryOpeningWidth, onChange: handleUpdate, roughOpeningHeight: node.roughOpeningHeight, roughOpeningWidth: node.roughOpeningWidth }) }), _jsxs(PanelSection, { title: "Position", children: [_jsx(SliderControl, { label: _jsxs(_Fragment, { children: ["X", _jsx("sub", { className: "ml-[1px] text-[11px] opacity-70", children: "wall" })] }), max: 10, min: -10, onChange: (v) => handleUpdate({ position: [v, node.position[1], node.position[2]] }), precision: 2, step: 0.1, unit: "m", value: node.position[0] }), showFlipSide && (_jsx("div", { className: "px-1 pt-2 pb-1", children: _jsx(ActionButton, { className: "w-full", icon: _jsx(FlipHorizontal2, { className: "h-4 w-4" }), label: "Flip Side", onClick: handleFlip }) }))] }), showFoldSection && (_jsxs(PanelSection, { title: "Fold", children: [_jsx("div", { className: "flex flex-col gap-2 px-1 pb-1", children: _jsxs("div", { className: "space-y-1", children: [_jsx("span", { className: "font-medium text-[10px] text-muted-foreground/80 uppercase tracking-wider", children: "Panels" }), _jsx(SegmentedControl, { onChange: (v) => handleUpdate({ leafCount: v === '2' ? 2 : 4 }), options: [
482
482
  { label: '2', value: '2' },
483
483
  { label: '4', value: '4' },
484
484
  ], value: node.leafCount === 2 ? '2' : '4' })] }) }), _jsx(SliderControl, { label: "Open", max: 100, min: 0, onChange: (v) => handleUpdate({ operationState: v / 100 }), precision: 0, restoreOnCommit: false, step: 5, unit: "%", value: Math.round((node.operationState ?? 0) * 100) })] })), showSlideSection && (_jsxs(PanelSection, { title: "Slide", children: [_jsx("div", { className: "flex flex-col gap-2 px-1 pb-1", children: _jsxs("div", { className: "space-y-1", children: [_jsx("span", { className: "font-medium text-[10px] text-muted-foreground/80 uppercase tracking-wider", children: doorType === 'pocket' ? 'Pocket' : doorType === 'barn' ? 'Rail' : 'Panel' }), _jsx(SegmentedControl, { onChange: (v) => handleUpdate({ slideDirection: v }), options: [
485
485
  { label: 'Left', value: 'left' },
486
486
  { label: 'Right', value: 'right' },
487
- ], value: node.slideDirection ?? 'left' })] }) }), _jsx(SliderControl, { label: "Open", max: 100, min: 0, onChange: (v) => handleUpdate({ operationState: v / 100 }), precision: 0, restoreOnCommit: false, step: 5, unit: "%", value: Math.round((node.operationState ?? 0) * 100) })] })), showGarageSection && (_jsxs(PanelSection, { title: "Garage", children: [_jsx(SliderControl, { label: "Open", max: 100, min: 0, onChange: (v) => handleUpdate({ operationState: v / 100 }), precision: 0, restoreOnCommit: false, step: 5, unit: "%", value: Math.round((node.operationState ?? 0) * 100) }), isSectionalGarageDoor && (_jsx(SliderControl, { label: "Panels", max: 8, min: 3, onChange: (v) => handleUpdate({ garagePanelCount: Math.round(v) }), precision: 0, restoreOnCommit: false, step: 1, value: node.garagePanelCount ?? 4 }))] })), _jsxs(PanelSection, { title: "Dimensions", children: [_jsx(SliderControl, { label: "Width", max: maxDoorWidth, min: 0.5, onChange: (v) => handleUpdate({ width: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: Math.round(node.width * 100) / 100 }), _jsx(SliderControl, { label: "Height", max: 1000, min: 1.0, onChange: (v) => handleUpdate({
487
+ ], value: node.slideDirection ?? 'left' })] }) }), _jsx(SliderControl, { label: "Open", max: 100, min: 0, onChange: (v) => handleUpdate({ operationState: v / 100 }), precision: 0, restoreOnCommit: false, step: 5, unit: "%", value: Math.round((node.operationState ?? 0) * 100) })] })), showGarageSection && (_jsxs(PanelSection, { title: "Garage", children: [_jsx(SliderControl, { label: "Open", max: 100, min: 0, onChange: (v) => handleUpdate({ operationState: v / 100 }), precision: 0, restoreOnCommit: false, step: 5, unit: "%", value: Math.round((node.operationState ?? 0) * 100) }), isSectionalGarageDoor && (_jsx(SliderControl, { label: "Panels", max: 8, min: 3, onChange: (v) => handleUpdate({ garagePanelCount: Math.round(v) }), precision: 0, restoreOnCommit: false, step: 1, value: node.garagePanelCount ?? 4 }))] })), _jsxs(PanelSection, { title: "Dimensions", children: [_jsx(SliderControl, { label: "Width", max: maxDoorWidth, min: 0.5, onChange: (v) => handleUpdate({ width: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: node.width }), _jsx(SliderControl, { label: "Height", max: 1000, min: 1.0, onChange: (v) => handleUpdate({
488
488
  height: v,
489
489
  position: [node.position[0], v / 2, node.position[2]],
490
490
  // Keep the handle at the same relative height as the door resizes,
491
491
  // matching the height-resize arrow.
492
492
  handleHeight: scaleHandleHeight(node.handleHeight, node.height, v),
493
- }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: Math.round(node.height * 100) / 100 })] }), showDoorShapeSection && (_jsxs(PanelSection, { title: "Top Shape", children: [_jsx("div", { className: "flex flex-col gap-2 px-1 pb-1", children: _jsx(SegmentedControl, { onChange: (v) => handleUpdate({
493
+ }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: node.height })] }), showDoorShapeSection && (_jsxs(PanelSection, { title: "Top Shape", children: [_jsx("div", { className: "flex flex-col gap-2 px-1 pb-1", children: _jsx(SegmentedControl, { onChange: (v) => handleUpdate({
494
494
  openingShape: v,
495
495
  ...(v === 'rounded'
496
496
  ? {
@@ -508,10 +508,10 @@ export default function DoorPanel() {
508
508
  ], value: doorShape }) }), doorShape === 'rounded' && (_jsxs(_Fragment, { children: [_jsx("div", { className: "flex flex-col gap-2 px-1 pb-1", children: _jsx(SegmentedControl, { onChange: (v) => handleUpdate({ openingRadiusMode: v }), options: [
509
509
  { label: 'All', value: 'all' },
510
510
  { label: 'Individual', value: 'individual' },
511
- ], value: openingRadiusMode }) }), openingRadiusMode === 'all' ? (_jsx(SliderControl, { label: "Corner Radius", max: maxRoundedRadius, min: 0, onChange: (v) => previewDoorUpdate('cornerRadius', v), onCommit: (v) => commitDoorPreview('cornerRadius', v), precision: 2, step: 0.05, unit: "m", value: Math.round(cornerRadius * 100) / 100 })) : (_jsx(_Fragment, { children: [
511
+ ], value: openingRadiusMode }) }), openingRadiusMode === 'all' ? (_jsx(SliderControl, { label: "Corner Radius", max: maxRoundedRadius, min: 0, onChange: (v) => previewDoorUpdate('cornerRadius', v), onCommit: (v) => commitDoorPreview('cornerRadius', v), precision: 2, step: 0.05, unit: "m", value: cornerRadius })) : (_jsx(_Fragment, { children: [
512
512
  ['Top Left', 0],
513
513
  ['Top Right', 1],
514
- ].map(([label, index]) => (_jsx(SliderControl, { label: label, max: maxRoundedRadius, min: 0, onChange: (v) => setOpeningTopRadius(index, v), onCommit: (v) => setOpeningTopRadius(index, v, true), precision: 2, step: 0.05, unit: "m", value: Math.round((openingTopRadii[index] ?? 0) * 100) / 100 }, label))) })), _jsx(SliderControl, { label: "Reveal Radius", max: 0.08, min: 0, onChange: (v) => previewDoorUpdate('openingRevealRadius', v), onCommit: (v) => commitDoorPreview('openingRevealRadius', v), precision: 3, step: 0.005, unit: "m", value: Math.round(openingRevealRadius * 1000) / 1000 })] })), doorShape === 'arch' && (_jsx(SliderControl, { label: "Arch Height", max: node.height, min: 0.05, onChange: (v) => handleUpdate({ archHeight: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: Math.round(archHeight * 100) / 100 }))] })), showOpeningShapeSection && (_jsxs(PanelSection, { title: "Opening Shape", children: [_jsx("div", { className: "flex flex-col gap-2 px-1 pb-1", children: _jsx(SegmentedControl, { onChange: (v) => handleUpdate({
514
+ ].map(([label, index]) => (_jsx(SliderControl, { label: label, max: maxRoundedRadius, min: 0, onChange: (v) => setOpeningTopRadius(index, v), onCommit: (v) => setOpeningTopRadius(index, v, true), precision: 2, step: 0.05, unit: "m", value: openingTopRadii[index] ?? 0 }, label))) })), _jsx(SliderControl, { label: "Reveal Radius", max: 0.08, min: 0, onChange: (v) => previewDoorUpdate('openingRevealRadius', v), onCommit: (v) => commitDoorPreview('openingRevealRadius', v), precision: 3, step: 0.005, unit: "m", value: openingRevealRadius })] })), doorShape === 'arch' && (_jsx(SliderControl, { label: "Arch Height", max: node.height, min: 0.05, onChange: (v) => handleUpdate({ archHeight: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: archHeight }))] })), showOpeningShapeSection && (_jsxs(PanelSection, { title: "Opening Shape", children: [_jsx("div", { className: "flex flex-col gap-2 px-1 pb-1", children: _jsx(SegmentedControl, { onChange: (v) => handleUpdate({
515
515
  openingShape: v,
516
516
  ...(v === 'rounded'
517
517
  ? { openingRadiusMode, openingTopRadii, cornerRadius, openingRevealRadius }
@@ -524,19 +524,19 @@ export default function DoorPanel() {
524
524
  ], value: openingShape }) }), openingShape === 'rounded' && (_jsxs(_Fragment, { children: [_jsx("div", { className: "flex flex-col gap-2 px-1 pb-1", children: _jsx(SegmentedControl, { onChange: (v) => handleUpdate({ openingRadiusMode: v }), options: [
525
525
  { label: 'All', value: 'all' },
526
526
  { label: 'Individual', value: 'individual' },
527
- ], value: openingRadiusMode }) }), openingRadiusMode === 'all' ? (_jsx(SliderControl, { label: "Corner Radius", max: maxRoundedRadius, min: 0, onChange: (v) => previewDoorUpdate('cornerRadius', v), onCommit: (v) => commitDoorPreview('cornerRadius', v), precision: 2, step: 0.05, unit: "m", value: Math.round(cornerRadius * 100) / 100 })) : (_jsx(_Fragment, { children: [
527
+ ], value: openingRadiusMode }) }), openingRadiusMode === 'all' ? (_jsx(SliderControl, { label: "Corner Radius", max: maxRoundedRadius, min: 0, onChange: (v) => previewDoorUpdate('cornerRadius', v), onCommit: (v) => commitDoorPreview('cornerRadius', v), precision: 2, step: 0.05, unit: "m", value: cornerRadius })) : (_jsx(_Fragment, { children: [
528
528
  ['Top Left', 0],
529
529
  ['Top Right', 1],
530
- ].map(([label, index]) => (_jsx(SliderControl, { label: label, max: maxRoundedRadius, min: 0, onChange: (v) => setOpeningTopRadius(index, v), onCommit: (v) => setOpeningTopRadius(index, v, true), precision: 2, step: 0.05, unit: "m", value: Math.round((openingTopRadii[index] ?? 0) * 100) / 100 }, label))) })), _jsx(SliderControl, { label: "Reveal Radius", max: 0.08, min: 0, onChange: (v) => previewDoorUpdate('openingRevealRadius', v), onCommit: (v) => commitDoorPreview('openingRevealRadius', v), precision: 3, step: 0.005, unit: "m", value: Math.round(openingRevealRadius * 1000) / 1000 })] })), openingShape === 'arch' && (_jsx(SliderControl, { label: "Arch Height", max: node.height, min: 0.05, onChange: (v) => handleUpdate({ archHeight: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: Math.round(archHeight * 100) / 100 }))] })), !isCutoutOnly && (_jsxs(_Fragment, { children: [showFrameSection && (_jsxs(PanelSection, { title: "Frame", children: [_jsx(SliderControl, { label: "Thickness", max: 0.2, min: 0.01, onChange: (v) => handleUpdate({ frameThickness: v }), precision: 3, step: 0.01, unit: "m", value: Math.round(node.frameThickness * 1000) / 1000 }), _jsx(SliderControl, { label: "Depth", max: 0.3, min: 0.01, onChange: (v) => handleUpdate({ frameDepth: v }), precision: 3, step: 0.01, unit: "m", value: Math.round(node.frameDepth * 1000) / 1000 })] })), showContentPaddingSection && (_jsxs(PanelSection, { title: "Content Padding", children: [_jsx(SliderControl, { label: "Horizontal", max: 0.2, min: 0, onChange: (v) => handleUpdate({ contentPadding: [v, node.contentPadding[1]] }), precision: 3, step: 0.005, unit: "m", value: Math.round(node.contentPadding[0] * 1000) / 1000 }), _jsx(SliderControl, { label: "Vertical", max: 0.2, min: 0, onChange: (v) => handleUpdate({ contentPadding: [node.contentPadding[0], v] }), precision: 3, step: 0.005, unit: "m", value: Math.round(node.contentPadding[1] * 1000) / 1000 })] })), showSwingSection && (_jsx(PanelSection, { title: "Swing", children: _jsxs("div", { className: "flex flex-col gap-2 px-1 pb-1", children: [supportsHingeSide && (_jsxs("div", { className: "space-y-1", children: [_jsx("span", { className: "font-medium text-[10px] text-muted-foreground/80 uppercase tracking-wider", children: "Hinges Side" }), _jsx(SegmentedControl, { onChange: (v) => handleUpdate({ hingesSide: v }), options: [
530
+ ].map(([label, index]) => (_jsx(SliderControl, { label: label, max: maxRoundedRadius, min: 0, onChange: (v) => setOpeningTopRadius(index, v), onCommit: (v) => setOpeningTopRadius(index, v, true), precision: 2, step: 0.05, unit: "m", value: openingTopRadii[index] ?? 0 }, label))) })), _jsx(SliderControl, { label: "Reveal Radius", max: 0.08, min: 0, onChange: (v) => previewDoorUpdate('openingRevealRadius', v), onCommit: (v) => commitDoorPreview('openingRevealRadius', v), precision: 3, step: 0.005, unit: "m", value: openingRevealRadius })] })), openingShape === 'arch' && (_jsx(SliderControl, { label: "Arch Height", max: node.height, min: 0.05, onChange: (v) => handleUpdate({ archHeight: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: archHeight }))] })), !isCutoutOnly && (_jsxs(_Fragment, { children: [showFrameSection && (_jsxs(PanelSection, { title: "Frame", children: [_jsx(SliderControl, { label: "Thickness", max: 0.2, min: 0.01, onChange: (v) => handleUpdate({ frameThickness: v }), precision: 3, step: 0.01, unit: "m", value: node.frameThickness }), _jsx(SliderControl, { label: "Depth", max: 0.3, min: 0.01, onChange: (v) => handleUpdate({ frameDepth: v }), precision: 3, step: 0.01, unit: "m", value: node.frameDepth })] })), showContentPaddingSection && (_jsxs(PanelSection, { title: "Content Padding", children: [_jsx(SliderControl, { label: "Horizontal", max: 0.2, min: 0, onChange: (v) => handleUpdate({ contentPadding: [v, node.contentPadding[1]] }), precision: 3, step: 0.005, unit: "m", value: node.contentPadding[0] }), _jsx(SliderControl, { label: "Vertical", max: 0.2, min: 0, onChange: (v) => handleUpdate({ contentPadding: [node.contentPadding[0], v] }), precision: 3, step: 0.005, unit: "m", value: node.contentPadding[1] })] })), showSwingSection && (_jsx(PanelSection, { title: "Swing", children: _jsxs("div", { className: "flex flex-col gap-2 px-1 pb-1", children: [supportsHingeSide && (_jsxs("div", { className: "space-y-1", children: [_jsx("span", { className: "font-medium text-[10px] text-muted-foreground/80 uppercase tracking-wider", children: "Hinges Side" }), _jsx(SegmentedControl, { onChange: (v) => handleUpdate({ hingesSide: v }), options: [
531
531
  { label: 'Left', value: 'left' },
532
532
  { label: 'Right', value: 'right' },
533
533
  ], value: node.hingesSide })] })), _jsxs("div", { className: "space-y-1", children: [_jsx("span", { className: "font-medium text-[10px] text-muted-foreground/80 uppercase tracking-wider", children: "Direction" }), _jsx(SegmentedControl, { onChange: (v) => handleUpdate({ swingDirection: v }), options: [
534
534
  { label: 'Inward', value: 'inward' },
535
535
  { label: 'Outward', value: 'outward' },
536
- ], value: node.swingDirection })] })] }) })), showThresholdSection && (_jsxs(PanelSection, { title: "Threshold", children: [_jsx(ToggleControl, { checked: node.threshold, label: "Enable Threshold", onChange: (checked) => handleUpdate({ threshold: checked }) }), node.threshold && (_jsx("div", { className: "mt-1 flex flex-col gap-1", children: _jsx(SliderControl, { label: "Height", max: 0.1, min: 0.005, onChange: (v) => handleUpdate({ thresholdHeight: v }), precision: 3, step: 0.005, unit: "m", value: Math.round(node.thresholdHeight * 1000) / 1000 }) }))] })), showHandleSection && (_jsxs(PanelSection, { title: "Handle", children: [isSwingDoor && (_jsx(ToggleControl, { checked: node.handle, label: "Enable Handle", onChange: (checked) => handleUpdate({ handle: checked }) })), (node.handle || !isSwingDoor) && (_jsxs("div", { className: "mt-1 flex flex-col gap-1", children: [_jsx(SliderControl, { label: "Height", max: node.height - 0.1, min: 0.5, onChange: (v) => handleUpdate({ handleHeight: v }), precision: 2, step: 0.05, unit: "m", value: Math.round(node.handleHeight * 100) / 100 }), supportsHandleSide && (_jsxs("div", { className: "space-y-1", children: [_jsx("span", { className: "font-medium text-[10px] text-muted-foreground/80 uppercase tracking-wider", children: "Handle Side" }), _jsx(SegmentedControl, { onChange: (v) => handleUpdate({ handleSide: v }), options: [
536
+ ], value: node.swingDirection })] })] }) })), showThresholdSection && (_jsxs(PanelSection, { title: "Threshold", children: [_jsx(ToggleControl, { checked: node.threshold, label: "Enable Threshold", onChange: (checked) => handleUpdate({ threshold: checked }) }), node.threshold && (_jsx("div", { className: "mt-1 flex flex-col gap-1", children: _jsx(SliderControl, { label: "Height", max: 0.1, min: 0.005, onChange: (v) => handleUpdate({ thresholdHeight: v }), precision: 3, step: 0.005, unit: "m", value: node.thresholdHeight }) }))] })), showHandleSection && (_jsxs(PanelSection, { title: "Handle", children: [isSwingDoor && (_jsx(ToggleControl, { checked: node.handle, label: "Enable Handle", onChange: (checked) => handleUpdate({ handle: checked }) })), (node.handle || !isSwingDoor) && (_jsxs("div", { className: "mt-1 flex flex-col gap-1", children: [_jsx(SliderControl, { label: "Height", max: node.height - 0.1, min: 0.5, onChange: (v) => handleUpdate({ handleHeight: v }), precision: 2, step: 0.05, unit: "m", value: node.handleHeight }), supportsHandleSide && (_jsxs("div", { className: "space-y-1", children: [_jsx("span", { className: "font-medium text-[10px] text-muted-foreground/80 uppercase tracking-wider", children: "Handle Side" }), _jsx(SegmentedControl, { onChange: (v) => handleUpdate({ handleSide: v }), options: [
537
537
  { label: 'Left', value: 'left' },
538
538
  { label: 'Right', value: 'right' },
539
- ], value: node.handleSide })] }))] }))] })), showHardwareSection && (_jsxs(PanelSection, { title: "Hardware", children: [_jsx(ToggleControl, { checked: node.doorCloser, label: "Door Closer", onChange: (checked) => handleUpdate({ doorCloser: checked }) }), _jsx(ToggleControl, { checked: node.panicBar, label: "Panic Bar", onChange: (checked) => handleUpdate({ panicBar: checked }) }), node.panicBar && (_jsx("div", { className: "mt-1 flex flex-col gap-1", children: _jsx(SliderControl, { label: "Bar Height", max: node.height - 0.1, min: 0.5, onChange: (v) => handleUpdate({ panicBarHeight: v }), precision: 2, step: 0.05, unit: "m", value: Math.round(node.panicBarHeight * 100) / 100 }) }))] })), showSegmentsSection && (_jsxs(PanelSection, { title: "Segments", children: [node.segments.map((seg, i) => {
539
+ ], value: node.handleSide })] }))] }))] })), showHardwareSection && (_jsxs(PanelSection, { title: "Hardware", children: [_jsx(ToggleControl, { checked: node.doorCloser, label: "Door Closer", onChange: (checked) => handleUpdate({ doorCloser: checked }) }), _jsx(ToggleControl, { checked: node.panicBar, label: "Panic Bar", onChange: (checked) => handleUpdate({ panicBar: checked }) }), node.panicBar && (_jsx("div", { className: "mt-1 flex flex-col gap-1", children: _jsx(SliderControl, { label: "Bar Height", max: node.height - 0.1, min: 0.5, onChange: (v) => handleUpdate({ panicBarHeight: v }), precision: 2, step: 0.05, unit: "m", value: node.panicBarHeight }) }))] })), showSegmentsSection && (_jsxs(PanelSection, { title: "Segments", children: [node.segments.map((seg, i) => {
540
540
  const numCols = seg.columnRatios.length;
541
541
  const colSum = seg.columnRatios.reduce((a, b) => a + b, 0);
542
542
  const normCols = seg.columnRatios.map((r) => r / colSum);
@@ -554,13 +554,13 @@ export default function DoorPanel() {
554
554
  }, precision: 0, step: 1, value: numCols }), numCols > 1 && (_jsxs("div", { className: "mt-1 border-border/50 border-t pt-1", children: [normCols.map((ratio, ci) => (_jsx(SliderControl, { label: `C${ci + 1}`, max: 95, min: 5, onChange: (v) => setSegmentColumnRatio(i, ci, v / 100), precision: 1, step: 1, unit: "%", value: Math.round(ratio * 100 * 10) / 10 }, `c-${ci}`))), _jsx(SliderControl, { label: "Divider", max: 0.1, min: 0.005, onChange: (v) => {
555
555
  const updated = node.segments.map((s, idx) => idx === i ? { ...s, dividerThickness: v } : s);
556
556
  handleUpdate({ segments: updated });
557
- }, precision: 3, step: 0.005, unit: "m", value: Math.round(seg.dividerThickness * 1000) / 1000 })] })), seg.type === 'panel' && (_jsxs("div", { className: "mt-1 border-border/50 border-t pt-1", children: [_jsx(SliderControl, { label: "Inset", max: 0.1, min: 0, onChange: (v) => {
557
+ }, precision: 3, step: 0.005, unit: "m", value: seg.dividerThickness })] })), seg.type === 'panel' && (_jsxs("div", { className: "mt-1 border-border/50 border-t pt-1", children: [_jsx(SliderControl, { label: "Inset", max: 0.1, min: 0, onChange: (v) => {
558
558
  const updated = node.segments.map((s, idx) => idx === i ? { ...s, panelInset: v } : s);
559
559
  handleUpdate({ segments: updated });
560
- }, precision: 3, step: 0.005, unit: "m", value: Math.round(seg.panelInset * 1000) / 1000 }), _jsx(SliderControl, { label: "Depth", max: 0.1, min: 0, onChange: (v) => {
560
+ }, precision: 3, step: 0.005, unit: "m", value: seg.panelInset }), _jsx(SliderControl, { label: "Depth", max: 0.1, min: 0, onChange: (v) => {
561
561
  const updated = node.segments.map((s, idx) => idx === i ? { ...s, panelDepth: v } : s);
562
562
  handleUpdate({ segments: updated });
563
- }, precision: 3, step: 0.005, unit: "m", value: Math.round(seg.panelDepth * 1000) / 1000 })] }))] }, i));
563
+ }, precision: 3, step: 0.005, unit: "m", value: seg.panelDepth })] }))] }, i));
564
564
  }), _jsxs("div", { className: "flex gap-1.5 px-1 pt-1", children: [_jsx(ActionButton, { label: "+ Add Segment", onClick: () => {
565
565
  const updated = [
566
566
  ...node.segments,
@@ -141,12 +141,12 @@ export function DormerPositionSection({ node, segment, roof, selectedId, preview
141
141
  return;
142
142
  const local = worldToSegLocal(newWorldX, worldZ_now, segment);
143
143
  previewProp({ position: [local.localX, py ?? 0, local.localZ] });
144
- }, onCommit: (newWorldX) => commitWorldPosition(newWorldX, worldZ_now), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: Math.round(worldX_now * 100) / 100 }), _jsx(SliderControl, { label: "Z", max: Math.round(worldMaxZ * 10) / 10, min: Math.round(worldMinZ * 10) / 10, onChange: (newWorldZ) => {
144
+ }, onCommit: (newWorldX) => commitWorldPosition(newWorldX, worldZ_now), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: worldX_now }), _jsx(SliderControl, { label: "Z", max: Math.round(worldMaxZ * 10) / 10, min: Math.round(worldMinZ * 10) / 10, onChange: (newWorldZ) => {
145
145
  if (!segment)
146
146
  return;
147
147
  const local = worldToSegLocal(worldX_now, newWorldZ, segment);
148
148
  previewProp({ position: [local.localX, py ?? 0, local.localZ] });
149
- }, onCommit: (newWorldZ) => commitWorldPosition(worldX_now, newWorldZ), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: Math.round(worldZ_now * 100) / 100 }), _jsx(SliderControl, { label: "Rotation", max: 180, min: -180, onChange: (degrees) => {
149
+ }, onCommit: (newWorldZ) => commitWorldPosition(worldX_now, newWorldZ), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: worldZ_now }), _jsx(SliderControl, { label: "Rotation", max: 180, min: -180, onChange: (degrees) => {
150
150
  const newWorldRot = (degrees * Math.PI) / 180;
151
151
  let ancestorWorldY = 0;
152
152
  if (segment) {
@@ -202,7 +202,7 @@ export default function DormerPanel() {
202
202
  return (_jsx("button", { className: cn('flex min-h-10 items-center justify-center rounded-lg border px-2 py-2 text-center text-xs transition-colors', isSelected
203
203
  ? 'border-orange-400/60 bg-orange-400/10 text-foreground'
204
204
  : 'border-border/50 bg-[#2C2C2E] text-muted-foreground hover:bg-[#3e3e3e] hover:text-foreground'), onClick: () => setSection(option.value), type: "button", children: _jsx("span", { className: "truncate font-medium", children: option.label }) }, option.value));
205
- }) }) }), section === 'dormer' && (_jsxs(_Fragment, { children: [_jsxs(PanelSection, { title: "Dimensions", children: [_jsx(SliderControl, { label: "Width", max: 1000, min: 0.5, onChange: (v) => previewProp({ width: v }), onCommit: (v) => commitProp({ width: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: Math.round(node.width * 100) / 100 }), _jsx(SliderControl, { label: "Depth", max: 1000, min: 0.5, onChange: (v) => previewProp({ depth: v }), onCommit: (v) => commitProp({ depth: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: Math.round(node.depth * 100) / 100 }), _jsx(SliderControl, { label: "Wall Height", max: 1000, min: 0, onChange: (v) => previewProp({ height: v }), onCommit: (v) => commitProp({ height: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: Math.round(node.height * 100) / 100 }), _jsx(SliderControl, { label: node.roofType === 'shed' ? 'Pitch Rise' : 'Roof Height', max: 3, min: 0, onChange: (v) => previewProp({ roofHeight: v }), onCommit: (v) => commitProp({ roofHeight: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: Math.round(node.roofHeight * 100) / 100 })] }), _jsx(PanelSection, { title: "Roof Type", children: _jsx("div", { className: "grid grid-cols-3 gap-1.5 px-1 pt-1", children: ROOF_TYPE_OPTIONS.map((option) => {
205
+ }) }) }), section === 'dormer' && (_jsxs(_Fragment, { children: [_jsxs(PanelSection, { title: "Dimensions", children: [_jsx(SliderControl, { label: "Width", max: 1000, min: 0.5, onChange: (v) => previewProp({ width: v }), onCommit: (v) => commitProp({ width: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: node.width }), _jsx(SliderControl, { label: "Depth", max: 1000, min: 0.5, onChange: (v) => previewProp({ depth: v }), onCommit: (v) => commitProp({ depth: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: node.depth }), _jsx(SliderControl, { label: "Wall Height", max: 1000, min: 0, onChange: (v) => previewProp({ height: v }), onCommit: (v) => commitProp({ height: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: node.height }), _jsx(SliderControl, { label: node.roofType === 'shed' ? 'Pitch Rise' : 'Roof Height', max: 3, min: 0, onChange: (v) => previewProp({ roofHeight: v }), onCommit: (v) => commitProp({ roofHeight: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: node.roofHeight })] }), _jsx(PanelSection, { title: "Roof Type", children: _jsx("div", { className: "grid grid-cols-3 gap-1.5 px-1 pt-1", children: ROOF_TYPE_OPTIONS.map((option) => {
206
206
  const isSelected = node.roofType === option.value;
207
207
  return (_jsx("button", { className: cn('flex min-h-10 items-center justify-center rounded-lg border px-2 py-2 text-xs transition-colors', isSelected
208
208
  ? 'border-orange-400/60 bg-orange-400/10 text-foreground'
@@ -1 +1 @@
1
- {"version":3,"file":"parametrics.d.ts","sourceRoot":"","sources":["../../src/duct-segment/parametrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,oBAAoB,EAAY,MAAM,kBAAkB,CAAA;AAK5F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AA0E/C,eAAO,MAAM,sBAAsB,EAAE,oBAAoB,CAAC,eAAe,CA+IxE,CAAA"}
1
+ {"version":3,"file":"parametrics.d.ts","sourceRoot":"","sources":["../../src/duct-segment/parametrics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,oBAAoB,EAAY,MAAM,kBAAkB,CAAA;AAM5F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AA0E/C,eAAO,MAAM,sBAAsB,EAAE,oBAAoB,CAAC,eAAe,CAiJxE,CAAA"}
@@ -1,6 +1,7 @@
1
1
  import { useScene } from '@pascal-app/core';
2
2
  import { Vector3 } from 'three';
3
3
  import { getDuctFittingPorts } from '../duct-fitting/ports';
4
+ import { findAutomaticRunEndCapIds } from '../shared/automatic-run-end-cap';
4
5
  import { fittingDeletionPlansForRun } from '../shared/fitting-deletion-cleanup';
5
6
  import { rollToContinueAcrossElbow } from './geometry';
6
7
  /** A run endpoint sitting this close to a collar counts as mated. */
@@ -95,7 +96,10 @@ export const ductSegmentParametrics = {
95
96
  return out;
96
97
  },
97
98
  onDelete: (duct, nodes, _pendingDeleteIds, requestedDeleteIds) => fittingDeletionPlansForRun(duct, nodes, requestedDeleteIds, true).flatMap((plan) => plan.updates),
98
- onDeleteCascade: (duct, nodes, _pendingDeleteIds, requestedDeleteIds) => fittingDeletionPlansForRun(duct, nodes, requestedDeleteIds, false).flatMap((plan) => plan.deleteFitting ? [plan.fittingId, ...plan.cascadeDeleteIds] : []),
99
+ onDeleteCascade: (duct, nodes, _pendingDeleteIds, requestedDeleteIds) => [
100
+ ...findAutomaticRunEndCapIds(duct.id, nodes, 'duct-fitting'),
101
+ ...fittingDeletionPlansForRun(duct, nodes, requestedDeleteIds, false).flatMap((plan) => plan.deleteFitting ? [plan.fittingId, ...plan.cascadeDeleteIds] : []),
102
+ ],
99
103
  trailingSection: () => import('../shared/run-hanger-inspector'),
100
104
  groups: [
101
105
  {
@@ -8,6 +8,7 @@ type DraftProfile = {
8
8
  width: number;
9
9
  height: number;
10
10
  };
11
+ export declare function ductSurfaceClearanceM(profile: DraftProfile, wall?: boolean): number;
11
12
  /** The full set of nodes a drawn segment produces. The drawn `ducts`
12
13
  * (and any trunk `tails` from a tee / cross split) are previewed by the
13
14
  * duct ghost already; `fittings` are the auto-inserted elbow / tee /
@@ -1 +1 @@
1
- {"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../src/duct-segment/tool.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,eAAe,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAuBtF,OAAO,EAA2B,KAAK,gBAAgB,EAAE,MAAM,qCAAqC,CAAA;AAYpG,OAAO,EAKL,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,iBAAiB,CAAA;AA0IxB,qEAAqE;AACrE,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;IAChC,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAgDD;;;;;6BAK6B;AAC7B,KAAK,YAAY,GAAG;IAClB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,QAAQ,EAAE,eAAe,EAAE,CAAA;IAC3B,KAAK,EAAE,eAAe,EAAE,CAAA;IACxB,KAAK,EAAE,eAAe,EAAE,CAAA;IACxB,OAAO,EAAE;QAAE,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;KAAE,EAAE,CAAA;IACxD,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAA;CACxB,CAAA;AA4CD;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAC/B,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAC7B,SAAS,EAAE,SAAS,GAAG,IAAI,EAC3B,SAAS,EAAE,UAAU,GAAG,IAAI,EAC5B,OAAO,EAAE,SAAS,GAAG,IAAI,EACzB,OAAO,EAAE,UAAU,GAAG,IAAI,EAC1B,OAAO,EAAE,YAAY,EACrB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACxC,OAAO,CAAC,EAAE,gBAAgB,GAAG,IAAI,EACjC,WAAW,UAAQ,EACnB,YAAY,GAAE,OAAO,CAAC,eAAe,CAAM,EAC3C,WAAW,GAAE,QAAQ,GAAG,QAAmB,GAC1C,YAAY,GAAG,IAAI,CAsLrB;AAED,QAAA,MAAM,eAAe,0CA+QpB,CAAA;AAED,eAAe,eAAe,CAAA"}
1
+ {"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../src/duct-segment/tool.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,eAAe,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAuBtF,OAAO,EAA2B,KAAK,gBAAgB,EAAE,MAAM,qCAAqC,CAAA;AAYpG,OAAO,EAKL,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,iBAAiB,CAAA;AA2IxB,qEAAqE;AACrE,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;IAChC,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,YAAY,EAAE,IAAI,UAAQ,GAAG,MAAM,CAUjF;AAgDD;;;;;6BAK6B;AAC7B,KAAK,YAAY,GAAG;IAClB,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,QAAQ,EAAE,eAAe,EAAE,CAAA;IAC3B,KAAK,EAAE,eAAe,EAAE,CAAA;IACxB,KAAK,EAAE,eAAe,EAAE,CAAA;IACxB,OAAO,EAAE;QAAE,EAAE,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;KAAE,EAAE,CAAA;IACxD,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAA;CACxB,CAAA;AA4CD;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAC/B,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAC7B,SAAS,EAAE,SAAS,GAAG,IAAI,EAC3B,SAAS,EAAE,UAAU,GAAG,IAAI,EAC5B,OAAO,EAAE,SAAS,GAAG,IAAI,EACzB,OAAO,EAAE,UAAU,GAAG,IAAI,EAC1B,OAAO,EAAE,YAAY,EACrB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACxC,OAAO,CAAC,EAAE,gBAAgB,GAAG,IAAI,EACjC,WAAW,UAAQ,EACnB,YAAY,GAAE,OAAO,CAAC,eAAe,CAAM,EAC3C,WAAW,GAAE,QAAQ,GAAG,QAAmB,GAC1C,YAAY,GAAG,IAAI,CAsLrB;AAED,QAAA,MAAM,eAAe,0CAuQpB,CAAA;AAED,eAAe,eAAe,CAAA"}
@@ -56,6 +56,7 @@ import { rectSectionAxes, rollToContinueAcrossElbow } from './geometry';
56
56
  */
57
57
  const DUCT_DIAMETERS_IN = [4, 5, 6, 7, 8, 9, 10, 12, 14, 16, 18, 20];
58
58
  const BODY_SNAP_RADIUS_M = 0.35;
59
+ const DUCT_WALL_STANDOFF_M = 0.01;
59
60
  /** Angle step (radians) for the XZ angle lock — 45°. */
60
61
  /**
61
62
  * Cross-section roll for a new rect run leaving `port` along `newDir`,
@@ -134,6 +135,13 @@ function getConnectionPorts(levelId, nodes) {
134
135
  levelId: levelId ?? undefined,
135
136
  }).filter((port) => !isRunEndCapPort(port, nodes));
136
137
  }
138
+ export function ductSurfaceClearanceM(profile, wall = false) {
139
+ return (runSectionHalfSizeM(profile.shape === 'round'
140
+ ? profile.diameter
141
+ : wall
142
+ ? Math.max(profile.width, profile.height)
143
+ : profile.height) + (wall && profile.shape !== 'round' ? DUCT_WALL_STANDOFF_M : 0));
144
+ }
137
145
  /**
138
146
  * Profile to inherit when the segment start snaps onto `port` — joining
139
147
  * means continuing that thing: a rect trunk end keeps its W×H, a round
@@ -425,11 +433,7 @@ const DuctSegmentTool = () => {
425
433
  : null,
426
434
  getPorts: () => getConnectionPorts(activeLevelId, sceneApi.nodes()),
427
435
  findBody: (point) => findNearestRunBody3D(point, BODY_SNAP_RADIUS_M, { levelId: activeLevelId ?? undefined }),
428
- surfaceClearance: (surface) => surface
429
- ? runSectionHalfSizeM(profileRef.current.shape === 'round'
430
- ? profileRef.current.diameter
431
- : profileRef.current.height)
432
- : 0,
436
+ surfaceClearance: (surface) => surface ? ductSurfaceClearanceM(profileRef.current, surface.kind === 'wall') : 0,
433
437
  minimumSegmentLength: 0.08,
434
438
  inheritFromConnection: ({ port }) => {
435
439
  if (!port)
@@ -447,9 +451,7 @@ const DuctSegmentTool = () => {
447
451
  return null;
448
452
  const attachDuct = (node) => {
449
453
  const wallAttachment = surfaceTarget?.kind === 'wall'
450
- ? createRunWallAttachment(surfaceTarget.hostId, surfaceTarget.side, node.path[0], node.path.at(-1), surfaceTarget, profileRef.current.shape === 'round'
451
- ? runSectionHalfSizeM(profileRef.current.diameter)
452
- : runSectionHalfSizeM(profileRef.current.height))
454
+ ? createRunWallAttachment(surfaceTarget.hostId, surfaceTarget.side, node.path[0], node.path.at(-1), surfaceTarget, ductSurfaceClearanceM(profileRef.current, true))
453
455
  : undefined;
454
456
  return { ...node, wallAttachment };
455
457
  };
@@ -102,5 +102,5 @@ export default function EyebrowVentPanel() {
102
102
  { label: 'Scoop', value: 'scoop' },
103
103
  { label: 'Half-round', value: 'half-round' },
104
104
  { label: 'Slant-box', value: 'slant-box' },
105
- ], value: node.style ?? 'scoop' }), _jsx(SliderControl, { label: "Louvers", max: 8, min: 0, onChange: (v) => previewProp({ louverCount: Math.round(v) }), onCommit: (v) => handleUpdate({ louverCount: Math.round(v) }), precision: 0, restoreOnCommit: false, step: 1, value: node.louverCount ?? 3 }), node.style === 'slant-box' ? (_jsx(SliderControl, { label: "Back height", max: 1, min: 0.15, onChange: (v) => previewProp({ backRatio: v }), onCommit: (v) => handleUpdate({ backRatio: v }), precision: 2, restoreOnCommit: false, step: 0.05, value: Math.round((node.backRatio ?? 0.5) * 100) / 100 })) : null] }), _jsxs(PanelSection, { title: "Dimensions", children: [_jsx(SliderControl, { label: "Width", max: 1000, min: 0.4, onChange: (v) => previewProp({ width: v }), onCommit: (v) => handleUpdate({ width: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: Math.round(node.width * 100) / 100 }), _jsx(SliderControl, { label: "Depth", max: 1000, min: 0.2, onChange: (v) => previewProp({ depth: v }), onCommit: (v) => handleUpdate({ depth: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: Math.round(node.depth * 100) / 100 }), _jsx(SliderControl, { label: "Height", max: 1000, min: 0.08, onChange: (v) => previewProp({ height: v }), onCommit: (v) => handleUpdate({ height: v }), precision: 2, restoreOnCommit: false, step: 0.02, unit: "m", value: Math.round(node.height * 100) / 100 })] }), _jsxs(PanelSection, { title: "Position", children: [_jsx(SliderControl, { label: "X", max: Math.round(((segment?.width ?? 10) / 2) * 100) / 100, min: -Math.round(((segment?.width ?? 10) / 2) * 100) / 100, onChange: (v) => previewProp({ position: [v, node.position[1] ?? 0, node.position[2] ?? 0] }), onCommit: (v) => handleUpdate({ position: [v, node.position[1] ?? 0, node.position[2] ?? 0] }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: Math.round((node.position[0] ?? 0) * 100) / 100 }), _jsx(SliderControl, { label: "Y", max: Math.max((segment?.wallHeight ?? 3) + (segment ? getActiveRoofHeight(segment) : 3) + 2, (node.position[1] ?? 0) + 0.1), min: Math.min(0, (node.position[1] ?? 0) - 0.5), onChange: (v) => previewProp({ position: [node.position[0] ?? 0, v, node.position[2] ?? 0] }), onCommit: (v) => handleUpdate({ position: [node.position[0] ?? 0, v, node.position[2] ?? 0] }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: Math.round((node.position[1] ?? 0) * 100) / 100 }), _jsx(SliderControl, { label: "Z", max: Math.round(((segment?.depth ?? 10) / 2) * 100) / 100, min: -Math.round(((segment?.depth ?? 10) / 2) * 100) / 100, onChange: (v) => previewProp({ position: [node.position[0] ?? 0, node.position[1] ?? 0, v] }), onCommit: (v) => handleUpdate({ position: [node.position[0] ?? 0, node.position[1] ?? 0, v] }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: Math.round((node.position[2] ?? 0) * 100) / 100 }), _jsx(SliderControl, { label: "Rotation", max: 180, min: -180, onChange: (deg) => previewProp({ rotation: (deg * Math.PI) / 180 }), onCommit: (deg) => handleUpdate({ rotation: (deg * Math.PI) / 180 }), precision: 0, restoreOnCommit: false, step: 1, unit: "\u00B0", value: Math.round(((node.rotation ?? 0) * 180) / Math.PI) })] }), _jsx(PanelSection, { title: "Actions", children: _jsxs(ActionGroup, { children: [_jsx(ActionButton, { icon: _jsx(Move, { className: "h-3.5 w-3.5" }), label: "Move", onClick: handleMove }), _jsx(ActionButton, { icon: _jsx(Copy, { className: "h-3.5 w-3.5" }), label: "Duplicate", onClick: handleDuplicate }), _jsx(ActionButton, { className: "hover:bg-red-500/20", icon: _jsx(Trash2, { className: "h-3.5 w-3.5 text-red-400" }), label: "Delete", onClick: handleDelete })] }) })] }));
105
+ ], value: node.style ?? 'scoop' }), _jsx(SliderControl, { label: "Louvers", max: 8, min: 0, onChange: (v) => previewProp({ louverCount: Math.round(v) }), onCommit: (v) => handleUpdate({ louverCount: Math.round(v) }), precision: 0, restoreOnCommit: false, step: 1, value: node.louverCount ?? 3 }), node.style === 'slant-box' ? (_jsx(SliderControl, { label: "Back height", max: 1, min: 0.15, onChange: (v) => previewProp({ backRatio: v }), onCommit: (v) => handleUpdate({ backRatio: v }), precision: 2, restoreOnCommit: false, step: 0.05, value: Math.round((node.backRatio ?? 0.5) * 100) / 100 })) : null] }), _jsxs(PanelSection, { title: "Dimensions", children: [_jsx(SliderControl, { label: "Width", max: 1000, min: 0.4, onChange: (v) => previewProp({ width: v }), onCommit: (v) => handleUpdate({ width: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: node.width }), _jsx(SliderControl, { label: "Depth", max: 1000, min: 0.2, onChange: (v) => previewProp({ depth: v }), onCommit: (v) => handleUpdate({ depth: v }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: node.depth }), _jsx(SliderControl, { label: "Height", max: 1000, min: 0.08, onChange: (v) => previewProp({ height: v }), onCommit: (v) => handleUpdate({ height: v }), precision: 2, restoreOnCommit: false, step: 0.02, unit: "m", value: node.height })] }), _jsxs(PanelSection, { title: "Position", children: [_jsx(SliderControl, { label: "X", max: Math.round(((segment?.width ?? 10) / 2) * 100) / 100, min: -Math.round(((segment?.width ?? 10) / 2) * 100) / 100, onChange: (v) => previewProp({ position: [v, node.position[1] ?? 0, node.position[2] ?? 0] }), onCommit: (v) => handleUpdate({ position: [v, node.position[1] ?? 0, node.position[2] ?? 0] }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: node.position[0] ?? 0 }), _jsx(SliderControl, { label: "Y", max: Math.max((segment?.wallHeight ?? 3) + (segment ? getActiveRoofHeight(segment) : 3) + 2, (node.position[1] ?? 0) + 0.1), min: Math.min(0, (node.position[1] ?? 0) - 0.5), onChange: (v) => previewProp({ position: [node.position[0] ?? 0, v, node.position[2] ?? 0] }), onCommit: (v) => handleUpdate({ position: [node.position[0] ?? 0, v, node.position[2] ?? 0] }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: node.position[1] ?? 0 }), _jsx(SliderControl, { label: "Z", max: Math.round(((segment?.depth ?? 10) / 2) * 100) / 100, min: -Math.round(((segment?.depth ?? 10) / 2) * 100) / 100, onChange: (v) => previewProp({ position: [node.position[0] ?? 0, node.position[1] ?? 0, v] }), onCommit: (v) => handleUpdate({ position: [node.position[0] ?? 0, node.position[1] ?? 0, v] }), precision: 2, restoreOnCommit: false, step: 0.05, unit: "m", value: node.position[2] ?? 0 }), _jsx(SliderControl, { label: "Rotation", max: 180, min: -180, onChange: (deg) => previewProp({ rotation: (deg * Math.PI) / 180 }), onCommit: (deg) => handleUpdate({ rotation: (deg * Math.PI) / 180 }), precision: 0, restoreOnCommit: false, step: 1, unit: "\u00B0", value: Math.round(((node.rotation ?? 0) * 180) / Math.PI) })] }), _jsx(PanelSection, { title: "Actions", children: _jsxs(ActionGroup, { children: [_jsx(ActionButton, { icon: _jsx(Move, { className: "h-3.5 w-3.5" }), label: "Move", onClick: handleMove }), _jsx(ActionButton, { icon: _jsx(Copy, { className: "h-3.5 w-3.5" }), label: "Duplicate", onClick: handleDuplicate }), _jsx(ActionButton, { className: "hover:bg-red-500/20", icon: _jsx(Trash2, { className: "h-3.5 w-3.5 text-red-400" }), label: "Delete", onClick: handleDelete })] }) })] }));
106
106
  }
@@ -39,5 +39,5 @@ export function FenceLengthEditor({ node, onUpdate, }) {
39
39
  export function FenceCurveEditor({ node, onUpdate, }) {
40
40
  const curveOffset = getClampedWallCurveOffset(node);
41
41
  const maxCurveOffset = getMaxWallCurveOffset(node);
42
- return (_jsx(SliderControl, { label: "Curve", max: Math.max(0.01, maxCurveOffset), min: -Math.max(0.01, maxCurveOffset), onChange: (value) => onUpdate({ curveOffset: normalizeWallCurveOffset(node, value) }), precision: 2, step: 0.1, unit: "m", value: Math.round(curveOffset * 100) / 100 }));
42
+ return (_jsx(SliderControl, { label: "Curve", max: Math.max(0.01, maxCurveOffset), min: -Math.max(0.01, maxCurveOffset), onChange: (value) => onUpdate({ curveOffset: normalizeWallCurveOffset(node, value) }), precision: 2, step: 0.1, unit: "m", value: curveOffset }));
43
43
  }
@@ -0,0 +1,5 @@
1
+ import type { NodeDefinition } from '@pascal-app/core';
2
+ import { ImportedMeshNode } from './schema';
3
+ /** Format-neutral fallback for imported objects without a parametric node. */
4
+ export declare const importedMeshDefinition: NodeDefinition<typeof ImportedMeshNode>;
5
+ //# sourceMappingURL=definition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../src/imported-mesh/definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAGtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAE3C,8EAA8E;AAC9E,eAAO,MAAM,sBAAsB,EAAE,cAAc,CAAC,OAAO,gBAAgB,CAiC1E,CAAA"}
@@ -0,0 +1,38 @@
1
+ import { buildImportedMeshFloorplan } from './floorplan';
2
+ import { buildImportedMeshGeometry } from './geometry';
3
+ import { ImportedMeshNode } from './schema';
4
+ /** Format-neutral fallback for imported objects without a parametric node. */
5
+ export const importedMeshDefinition = {
6
+ kind: 'imported-mesh',
7
+ schemaVersion: 1,
8
+ schema: ImportedMeshNode,
9
+ category: 'structure',
10
+ snapProfile: 'item',
11
+ defaults: () => ({
12
+ object: 'node',
13
+ parentId: null,
14
+ visible: true,
15
+ metadata: {},
16
+ position: [0, 0, 0],
17
+ rotation: [0, 0, 0],
18
+ primitives: [],
19
+ }),
20
+ capabilities: {
21
+ selectable: { hitVolume: 'bbox' },
22
+ duplicable: true,
23
+ deletable: true,
24
+ presettable: false,
25
+ },
26
+ geometryKey: (node) => `${node.id}:${node.primitives.length}`,
27
+ geometry: buildImportedMeshGeometry,
28
+ floorplan: buildImportedMeshFloorplan,
29
+ presentation: {
30
+ label: 'Imported Mesh',
31
+ description: 'Geometry preserved from an imported model when no native Pascal shape exists.',
32
+ icon: { kind: 'url', src: '/icons/item.webp' },
33
+ hidden: true,
34
+ },
35
+ mcp: {
36
+ description: 'Imported triangle geometry with source identity and properties in metadata.',
37
+ },
38
+ };
@@ -0,0 +1,4 @@
1
+ import type { FloorplanGeometry, GeometryContext, ImportedMeshNode } from '@pascal-app/core';
2
+ /** A compact plan proxy for imported geometry, derived from its XZ bounds. */
3
+ export declare function buildImportedMeshFloorplan(node: ImportedMeshNode, ctx: GeometryContext): FloorplanGeometry | null;
4
+ //# sourceMappingURL=floorplan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"floorplan.d.ts","sourceRoot":"","sources":["../../src/imported-mesh/floorplan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EAEjB,eAAe,EACf,gBAAgB,EACjB,MAAM,kBAAkB,CAAA;AAEzB,8EAA8E;AAC9E,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,gBAAgB,EACtB,GAAG,EAAE,eAAe,GACnB,iBAAiB,GAAG,IAAI,CAgC1B"}