@reekon-tools/boldr-cad 0.1.0 → 1.0.0

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 (547) hide show
  1. package/README.md +81 -9
  2. package/dist/app/edit.d.ts +12 -1
  3. package/dist/app/edit.js +96 -11
  4. package/dist/app/edit.js.map +1 -1
  5. package/dist/app/state.d.ts +31 -4
  6. package/dist/app/state.js +31 -2
  7. package/dist/app/state.js.map +1 -1
  8. package/dist/data/memory.d.ts +5 -0
  9. package/dist/data/memory.js +2 -2
  10. package/dist/data/memory.js.map +1 -1
  11. package/dist/data/provider.d.ts +19 -7
  12. package/dist/data/sync.d.ts +7 -2
  13. package/dist/data/sync.js +115 -64
  14. package/dist/data/sync.js.map +1 -1
  15. package/dist/editor/actions.d.ts +1 -2
  16. package/dist/editor/actions.js +391 -113
  17. package/dist/editor/actions.js.map +1 -1
  18. package/dist/editor/confirm.d.ts +23 -0
  19. package/dist/editor/confirm.js +35 -0
  20. package/dist/editor/confirm.js.map +1 -0
  21. package/dist/editor/elevation.d.ts +191 -90
  22. package/dist/editor/elevation.js +812 -616
  23. package/dist/editor/elevation.js.map +1 -1
  24. package/dist/editor/face.d.ts +73 -0
  25. package/dist/editor/face.js +269 -0
  26. package/dist/editor/face.js.map +1 -0
  27. package/dist/editor/files.d.ts +6 -0
  28. package/dist/editor/files.js +50 -4
  29. package/dist/editor/files.js.map +1 -1
  30. package/dist/editor/gestures.d.ts +18 -3
  31. package/dist/editor/gestures.js +145 -30
  32. package/dist/editor/gestures.js.map +1 -1
  33. package/dist/editor/keypad.d.ts +19 -4
  34. package/dist/editor/keypad.js +39 -9
  35. package/dist/editor/keypad.js.map +1 -1
  36. package/dist/editor/keys.js +36 -4
  37. package/dist/editor/keys.js.map +1 -1
  38. package/dist/editor/laser.d.ts +20 -4
  39. package/dist/editor/laser.js +104 -21
  40. package/dist/editor/laser.js.map +1 -1
  41. package/dist/editor/linkActions.d.ts +49 -0
  42. package/dist/editor/linkActions.js +210 -0
  43. package/dist/editor/linkActions.js.map +1 -0
  44. package/dist/editor/linkFollow.d.ts +2 -0
  45. package/dist/editor/linkFollow.js +53 -0
  46. package/dist/editor/linkFollow.js.map +1 -0
  47. package/dist/editor/linkWrite.d.ts +13 -0
  48. package/dist/editor/linkWrite.js +84 -0
  49. package/dist/editor/linkWrite.js.map +1 -0
  50. package/dist/editor/links.d.ts +84 -0
  51. package/dist/editor/links.js +130 -0
  52. package/dist/editor/links.js.map +1 -0
  53. package/dist/editor/markup.d.ts +29 -3
  54. package/dist/editor/markup.js +95 -10
  55. package/dist/editor/markup.js.map +1 -1
  56. package/dist/editor/mode.d.ts +40 -2
  57. package/dist/editor/mode.js +71 -4
  58. package/dist/editor/mode.js.map +1 -1
  59. package/dist/editor/ports.d.ts +36 -6
  60. package/dist/editor/ports.js +10 -1
  61. package/dist/editor/ports.js.map +1 -1
  62. package/dist/editor/project.d.ts +38 -6
  63. package/dist/editor/project.js +167 -27
  64. package/dist/editor/project.js.map +1 -1
  65. package/dist/editor/selection.d.ts +10 -0
  66. package/dist/editor/selection.js +62 -8
  67. package/dist/editor/selection.js.map +1 -1
  68. package/dist/editor/status.js +3 -0
  69. package/dist/editor/status.js.map +1 -1
  70. package/dist/editor/tooltips.d.ts +5 -0
  71. package/dist/editor/tooltips.js +48 -0
  72. package/dist/editor/tooltips.js.map +1 -0
  73. package/dist/editor/view3d.d.ts +17 -0
  74. package/dist/editor/view3d.js +135 -0
  75. package/dist/editor/view3d.js.map +1 -0
  76. package/dist/editor/view3dState.d.ts +39 -0
  77. package/dist/editor/view3dState.js +44 -0
  78. package/dist/editor/view3dState.js.map +1 -0
  79. package/dist/export/dxf.js +1 -1
  80. package/dist/export/dxf.js.map +1 -1
  81. package/dist/export/pdf.js +17 -12
  82. package/dist/export/pdf.js.map +1 -1
  83. package/dist/export/plan.d.ts +23 -6
  84. package/dist/export/plan.js +127 -44
  85. package/dist/export/plan.js.map +1 -1
  86. package/dist/index.d.ts +5 -0
  87. package/dist/index.js +2 -0
  88. package/dist/index.js.map +1 -1
  89. package/dist/model/constraints.js +15 -4
  90. package/dist/model/constraints.js.map +1 -1
  91. package/dist/model/demo.js +3 -3
  92. package/dist/model/demo.js.map +1 -1
  93. package/dist/model/elevation.d.ts +6 -9
  94. package/dist/model/elevation.js +5 -13
  95. package/dist/model/elevation.js.map +1 -1
  96. package/dist/model/faces.d.ts +58 -0
  97. package/dist/model/faces.js +197 -0
  98. package/dist/model/faces.js.map +1 -0
  99. package/dist/model/facesolve.d.ts +72 -0
  100. package/dist/model/facesolve.js +369 -0
  101. package/dist/model/facesolve.js.map +1 -0
  102. package/dist/model/history.d.ts +3 -2
  103. package/dist/model/history.js +17 -11
  104. package/dist/model/history.js.map +1 -1
  105. package/dist/model/images.d.ts +18 -0
  106. package/dist/model/images.js +26 -0
  107. package/dist/model/images.js.map +1 -0
  108. package/dist/model/links.d.ts +46 -0
  109. package/dist/model/links.js +73 -0
  110. package/dist/model/links.js.map +1 -0
  111. package/dist/model/markup.d.ts +46 -0
  112. package/dist/model/markup.js +71 -0
  113. package/dist/model/markup.js.map +1 -0
  114. package/dist/model/measurement.d.ts +11 -0
  115. package/dist/model/measurement.js +24 -0
  116. package/dist/model/measurement.js.map +1 -0
  117. package/dist/model/openings.d.ts +4 -0
  118. package/dist/model/openings.js +4 -0
  119. package/dist/model/openings.js.map +1 -1
  120. package/dist/model/planGeom.d.ts +72 -2
  121. package/dist/model/planGeom.js +184 -10
  122. package/dist/model/planGeom.js.map +1 -1
  123. package/dist/model/project.js +3 -2
  124. package/dist/model/project.js.map +1 -1
  125. package/dist/model/projectfile.js +2 -1
  126. package/dist/model/projectfile.js.map +1 -1
  127. package/dist/model/rooms.js +2 -2
  128. package/dist/model/rooms.js.map +1 -1
  129. package/dist/model/settings.d.ts +6 -0
  130. package/dist/model/settings.js +2 -2
  131. package/dist/model/settings.js.map +1 -1
  132. package/dist/model/sketch.d.ts +14 -0
  133. package/dist/model/sketch.js +143 -24
  134. package/dist/model/sketch.js.map +1 -1
  135. package/dist/model/smooth.d.ts +6 -0
  136. package/dist/model/smooth.js +52 -0
  137. package/dist/model/smooth.js.map +1 -0
  138. package/dist/model/store.d.ts +12 -0
  139. package/dist/model/store.js +35 -3
  140. package/dist/model/store.js.map +1 -1
  141. package/dist/model/types.d.ts +173 -8
  142. package/dist/model/wallfaces.d.ts +32 -0
  143. package/dist/model/wallfaces.js +133 -20
  144. package/dist/model/wallfaces.js.map +1 -1
  145. package/dist/model/wallshape.d.ts +15 -0
  146. package/dist/model/wallshape.js +89 -0
  147. package/dist/model/wallshape.js.map +1 -0
  148. package/dist/react/BottomBar.d.ts +9 -5
  149. package/dist/react/BottomBar.js +213 -24
  150. package/dist/react/BottomBar.js.map +1 -1
  151. package/dist/react/Buttons.d.ts +13 -2
  152. package/dist/react/Buttons.js +37 -5
  153. package/dist/react/Buttons.js.map +1 -1
  154. package/dist/react/CadEditor.d.ts +46 -3
  155. package/dist/react/CadEditor.js +77 -20
  156. package/dist/react/CadEditor.js.map +1 -1
  157. package/dist/react/ConfirmSheet.d.ts +4 -0
  158. package/dist/react/ConfirmSheet.js +31 -0
  159. package/dist/react/ConfirmSheet.js.map +1 -0
  160. package/dist/react/ConflictSheet.d.ts +2 -1
  161. package/dist/react/ConflictSheet.js +16 -8
  162. package/dist/react/ConflictSheet.js.map +1 -1
  163. package/dist/react/Drawer.d.ts +8 -2
  164. package/dist/react/Drawer.js +167 -38
  165. package/dist/react/Drawer.js.map +1 -1
  166. package/dist/react/Duck.d.ts +13 -0
  167. package/dist/react/Duck.js +45 -0
  168. package/dist/react/Duck.js.map +1 -0
  169. package/dist/react/Empty3D.d.ts +2 -0
  170. package/dist/react/Empty3D.js +39 -0
  171. package/dist/react/Empty3D.js.map +1 -0
  172. package/dist/react/FitScroll.d.ts +6 -0
  173. package/dist/react/FitScroll.js +14 -0
  174. package/dist/react/FitScroll.js.map +1 -0
  175. package/dist/react/Icon.native.d.ts +6 -0
  176. package/dist/react/Icon.native.js +4 -0
  177. package/dist/react/Icon.native.js.map +1 -1
  178. package/dist/react/Icon.web.d.ts +6 -0
  179. package/dist/react/Icon.web.js +4 -0
  180. package/dist/react/Icon.web.js.map +1 -1
  181. package/dist/react/KeypadSheet.d.ts +9 -2
  182. package/dist/react/KeypadSheet.js +174 -42
  183. package/dist/react/KeypadSheet.js.map +1 -1
  184. package/dist/react/LaserTray.js +8 -5
  185. package/dist/react/LaserTray.js.map +1 -1
  186. package/dist/react/MarkupPanel.d.ts +8 -0
  187. package/dist/react/MarkupPanel.js +67 -0
  188. package/dist/react/MarkupPanel.js.map +1 -0
  189. package/dist/react/PageThumb.native.d.ts +7 -2
  190. package/dist/react/PageThumb.native.js +19 -7
  191. package/dist/react/PageThumb.native.js.map +1 -1
  192. package/dist/react/PageThumb.web.d.ts +3 -2
  193. package/dist/react/PageThumb.web.js +4 -4
  194. package/dist/react/PageThumb.web.js.map +1 -1
  195. package/dist/react/PlanCanvas.native.d.ts +1 -1
  196. package/dist/react/PlanCanvas.native.js +134 -36
  197. package/dist/react/PlanCanvas.native.js.map +1 -1
  198. package/dist/react/PlanCanvas.web.js +16 -5
  199. package/dist/react/PlanCanvas.web.js.map +1 -1
  200. package/dist/react/Popovers.d.ts +12 -6
  201. package/dist/react/Popovers.js +53 -26
  202. package/dist/react/Popovers.js.map +1 -1
  203. package/dist/react/Rail.d.ts +24 -0
  204. package/dist/react/Rail.js +324 -34
  205. package/dist/react/Rail.js.map +1 -1
  206. package/dist/react/ShapeMenu.d.ts +7 -0
  207. package/dist/react/ShapeMenu.js +58 -0
  208. package/dist/react/ShapeMenu.js.map +1 -0
  209. package/dist/react/Sheet.d.ts +14 -4
  210. package/dist/react/Sheet.js +54 -9
  211. package/dist/react/Sheet.js.map +1 -1
  212. package/dist/react/Slider.d.ts +18 -0
  213. package/dist/react/Slider.js +27 -0
  214. package/dist/react/Slider.js.map +1 -0
  215. package/dist/react/Toast.js +14 -6
  216. package/dist/react/Toast.js.map +1 -1
  217. package/dist/react/ToolTip.d.ts +7 -0
  218. package/dist/react/ToolTip.js +43 -0
  219. package/dist/react/ToolTip.js.map +1 -0
  220. package/dist/react/TopBar.d.ts +6 -3
  221. package/dist/react/TopBar.js +48 -17
  222. package/dist/react/TopBar.js.map +1 -1
  223. package/dist/react/Tween.d.ts +7 -0
  224. package/dist/react/Tween.js +26 -0
  225. package/dist/react/Tween.js.map +1 -0
  226. package/dist/react/Tween.native.d.ts +6 -0
  227. package/dist/react/Tween.native.js +43 -0
  228. package/dist/react/Tween.native.js.map +1 -0
  229. package/dist/react/View3D.native.d.ts +4 -0
  230. package/dist/react/View3D.native.js +103 -0
  231. package/dist/react/View3D.native.js.map +1 -0
  232. package/dist/react/View3D.web.d.ts +4 -0
  233. package/dist/react/View3D.web.js +151 -0
  234. package/dist/react/View3D.web.js.map +1 -0
  235. package/dist/react/View3DHost.d.ts +143 -0
  236. package/dist/react/View3DHost.js +377 -0
  237. package/dist/react/View3DHost.js.map +1 -0
  238. package/dist/react/corners.d.ts +7 -0
  239. package/dist/react/corners.js +51 -0
  240. package/dist/react/corners.js.map +1 -0
  241. package/dist/react/easing.d.ts +15 -0
  242. package/dist/react/easing.js +10 -0
  243. package/dist/react/easing.js.map +1 -0
  244. package/dist/react/host.d.ts +7 -2
  245. package/dist/react/host.js +8 -3
  246. package/dist/react/host.js.map +1 -1
  247. package/dist/react/hostKeypad.d.ts +56 -0
  248. package/dist/react/hostKeypad.js +5 -0
  249. package/dist/react/hostKeypad.js.map +1 -0
  250. package/dist/react/motion.d.ts +77 -0
  251. package/dist/react/motion.js +173 -0
  252. package/dist/react/motion.js.map +1 -0
  253. package/dist/react/ports.js +90 -8
  254. package/dist/react/ports.js.map +1 -1
  255. package/dist/react/saving.d.ts +15 -0
  256. package/dist/react/saving.js +76 -0
  257. package/dist/react/saving.js.map +1 -0
  258. package/dist/react/store.d.ts +38 -1
  259. package/dist/react/store.js +31 -1
  260. package/dist/react/store.js.map +1 -1
  261. package/dist/react/theme.d.ts +10 -0
  262. package/dist/react/theme.js +8 -0
  263. package/dist/react/theme.js.map +1 -1
  264. package/dist/react/topRow.d.ts +22 -0
  265. package/dist/react/topRow.js +61 -0
  266. package/dist/react/topRow.js.map +1 -0
  267. package/dist/react/touch.d.ts +6 -0
  268. package/dist/react/touch.js +9 -0
  269. package/dist/react/touch.js.map +1 -0
  270. package/dist/render/ctx.d.ts +8 -0
  271. package/dist/render/draw.d.ts +33 -1
  272. package/dist/render/draw.js +593 -215
  273. package/dist/render/draw.js.map +1 -1
  274. package/dist/render/elevation.d.ts +65 -43
  275. package/dist/render/elevation.js +414 -140
  276. package/dist/render/elevation.js.map +1 -1
  277. package/dist/render/figmaIcons.d.ts +12 -0
  278. package/dist/render/figmaIcons.js +21 -0
  279. package/dist/render/figmaIcons.js.map +1 -0
  280. package/dist/render/hit.d.ts +22 -2
  281. package/dist/render/hit.js +168 -25
  282. package/dist/render/hit.js.map +1 -1
  283. package/dist/render/icons.js +69 -10
  284. package/dist/render/icons.js.map +1 -1
  285. package/dist/render/linkTile.d.ts +15 -0
  286. package/dist/render/linkTile.js +369 -0
  287. package/dist/render/linkTile.js.map +1 -0
  288. package/dist/render/markup.d.ts +11 -0
  289. package/dist/render/markup.js +112 -0
  290. package/dist/render/markup.js.map +1 -0
  291. package/dist/render/navigate.d.ts +88 -0
  292. package/dist/render/navigate.js +100 -0
  293. package/dist/render/navigate.js.map +1 -0
  294. package/dist/render/snap.d.ts +20 -1
  295. package/dist/render/snap.js +118 -25
  296. package/dist/render/snap.js.map +1 -1
  297. package/dist/render/squircle.d.ts +8 -0
  298. package/dist/render/squircle.js +71 -0
  299. package/dist/render/squircle.js.map +1 -0
  300. package/dist/render/view.d.ts +115 -2
  301. package/dist/render/view.js +244 -19
  302. package/dist/render/view.js.map +1 -1
  303. package/dist/skia/SkiaDrawCtx.d.ts +30 -2
  304. package/dist/skia/SkiaDrawCtx.js +198 -43
  305. package/dist/skia/SkiaDrawCtx.js.map +1 -1
  306. package/dist/skia/host.d.ts +18 -2
  307. package/dist/skia/host.js +46 -1
  308. package/dist/skia/host.js.map +1 -1
  309. package/dist/solver/equations.js +37 -2
  310. package/dist/solver/equations.js.map +1 -1
  311. package/dist/solver/gauss-newton.d.ts +17 -0
  312. package/dist/solver/gauss-newton.js +144 -36
  313. package/dist/solver/gauss-newton.js.map +1 -1
  314. package/dist/solver/linalg.d.ts +45 -2
  315. package/dist/solver/linalg.js +164 -10
  316. package/dist/solver/linalg.js.map +1 -1
  317. package/dist/solver/types.d.ts +5 -0
  318. package/dist/tools/annotate.d.ts +57 -1
  319. package/dist/tools/annotate.js +64 -43
  320. package/dist/tools/annotate.js.map +1 -1
  321. package/dist/tools/chamfer.d.ts +12 -0
  322. package/dist/tools/chamfer.js +114 -0
  323. package/dist/tools/chamfer.js.map +1 -0
  324. package/dist/tools/corner.d.ts +38 -0
  325. package/dist/tools/corner.js +99 -0
  326. package/dist/tools/corner.js.map +1 -0
  327. package/dist/tools/dim.d.ts +86 -9
  328. package/dist/tools/dim.js +581 -96
  329. package/dist/tools/dim.js.map +1 -1
  330. package/dist/tools/elevation.js +1 -1
  331. package/dist/tools/elevation.js.map +1 -1
  332. package/dist/tools/fillet.d.ts +9 -0
  333. package/dist/tools/fillet.js +86 -0
  334. package/dist/tools/fillet.js.map +1 -0
  335. package/dist/tools/freehand.d.ts +3 -2
  336. package/dist/tools/freehand.js +19 -12
  337. package/dist/tools/freehand.js.map +1 -1
  338. package/dist/tools/index.js +14 -4
  339. package/dist/tools/index.js.map +1 -1
  340. package/dist/tools/line.d.ts +8 -3
  341. package/dist/tools/line.js +66 -30
  342. package/dist/tools/line.js.map +1 -1
  343. package/dist/tools/modify.d.ts +13 -0
  344. package/dist/tools/modify.js +105 -25
  345. package/dist/tools/modify.js.map +1 -1
  346. package/dist/tools/openings.js +22 -15
  347. package/dist/tools/openings.js.map +1 -1
  348. package/dist/tools/registry.d.ts +8 -0
  349. package/dist/tools/registry.js +42 -2
  350. package/dist/tools/registry.js.map +1 -1
  351. package/dist/tools/select.d.ts +77 -3
  352. package/dist/tools/select.js +560 -74
  353. package/dist/tools/select.js.map +1 -1
  354. package/dist/tools/shapes.d.ts +14 -0
  355. package/dist/tools/shapes.js +154 -75
  356. package/dist/tools/shapes.js.map +1 -1
  357. package/dist/units/format.d.ts +10 -2
  358. package/dist/units/format.js +18 -3
  359. package/dist/units/format.js.map +1 -1
  360. package/dist/view3d/build.d.ts +35 -0
  361. package/dist/view3d/build.js +630 -0
  362. package/dist/view3d/build.js.map +1 -0
  363. package/dist/view3d/camera.d.ts +60 -0
  364. package/dist/view3d/camera.js +84 -0
  365. package/dist/view3d/camera.js.map +1 -0
  366. package/dist/view3d/fatLines.d.ts +11 -0
  367. package/dist/view3d/fatLines.js +83 -0
  368. package/dist/view3d/fatLines.js.map +1 -0
  369. package/dist/view3d/lines.d.ts +17 -0
  370. package/dist/view3d/lines.js +271 -0
  371. package/dist/view3d/lines.js.map +1 -0
  372. package/dist/view3d/mesh.d.ts +51 -0
  373. package/dist/view3d/mesh.js +101 -0
  374. package/dist/view3d/mesh.js.map +1 -0
  375. package/dist/view3d/poly.d.ts +16 -0
  376. package/dist/view3d/poly.js +109 -0
  377. package/dist/view3d/poly.js.map +1 -0
  378. package/dist/view3d/viewer.d.ts +86 -0
  379. package/dist/view3d/viewer.js +350 -0
  380. package/dist/view3d/viewer.js.map +1 -0
  381. package/package.json +15 -2
  382. package/src/app/edit.ts +83 -12
  383. package/src/app/main.ts +11 -5
  384. package/src/app/state.ts +38 -5
  385. package/src/data/memory.ts +2 -2
  386. package/src/data/provider.ts +15 -7
  387. package/src/data/sync.ts +87 -50
  388. package/src/editor/actions.ts +292 -83
  389. package/src/editor/confirm.ts +58 -0
  390. package/src/editor/elevation.ts +698 -478
  391. package/src/editor/face.ts +227 -0
  392. package/src/editor/files.ts +40 -4
  393. package/src/editor/gestures.ts +147 -31
  394. package/src/editor/keypad.ts +43 -11
  395. package/src/editor/keys.ts +25 -5
  396. package/src/editor/laser.ts +98 -20
  397. package/src/editor/linkActions.ts +194 -0
  398. package/src/editor/linkFollow.ts +43 -0
  399. package/src/editor/linkWrite.ts +77 -0
  400. package/src/editor/links.ts +181 -0
  401. package/src/editor/markup.ts +92 -8
  402. package/src/editor/mode.ts +83 -7
  403. package/src/editor/ports.ts +37 -6
  404. package/src/editor/project.ts +155 -26
  405. package/src/editor/selection.ts +54 -8
  406. package/src/editor/status.ts +2 -0
  407. package/src/editor/tooltips.ts +47 -0
  408. package/src/editor/view3d.ts +119 -0
  409. package/src/editor/view3dState.ts +61 -0
  410. package/src/export/dxf.ts +1 -1
  411. package/src/export/pdf.ts +15 -7
  412. package/src/export/plan.ts +119 -35
  413. package/src/index.ts +5 -0
  414. package/src/input/keyboard.ts +2 -4
  415. package/src/model/constraints.ts +13 -4
  416. package/src/model/demo.ts +3 -3
  417. package/src/model/elevation.ts +6 -16
  418. package/src/model/faces.ts +153 -0
  419. package/src/model/facesolve.ts +322 -0
  420. package/src/model/history.ts +19 -11
  421. package/src/model/images.ts +35 -0
  422. package/src/model/links.ts +77 -0
  423. package/src/model/markup.ts +80 -0
  424. package/src/model/measurement.ts +26 -0
  425. package/src/model/openings.ts +6 -0
  426. package/src/model/planGeom.ts +174 -8
  427. package/src/model/project.ts +3 -2
  428. package/src/model/projectfile.ts +2 -1
  429. package/src/model/rooms.ts +1 -1
  430. package/src/model/settings.ts +8 -2
  431. package/src/model/sketch.ts +101 -14
  432. package/src/model/smooth.ts +51 -0
  433. package/src/model/store.ts +35 -4
  434. package/src/model/types.ts +170 -8
  435. package/src/model/wallfaces.ts +126 -17
  436. package/src/model/wallshape.ts +97 -0
  437. package/src/react/BottomBar.tsx +263 -46
  438. package/src/react/Buttons.tsx +50 -9
  439. package/src/react/CadEditor.tsx +133 -30
  440. package/src/react/ConfirmSheet.tsx +38 -0
  441. package/src/react/ConflictSheet.tsx +19 -12
  442. package/src/react/Drawer.tsx +213 -110
  443. package/src/react/Duck.tsx +50 -0
  444. package/src/react/Empty3D.tsx +32 -0
  445. package/src/react/FitScroll.tsx +19 -0
  446. package/src/react/Icon.native.tsx +5 -0
  447. package/src/react/Icon.web.tsx +5 -0
  448. package/src/react/KeypadSheet.tsx +253 -60
  449. package/src/react/LaserTray.tsx +12 -8
  450. package/src/react/MarkupPanel.tsx +150 -0
  451. package/src/react/PageThumb.native.tsx +18 -7
  452. package/src/react/PageThumb.web.tsx +4 -4
  453. package/src/react/PlanCanvas.native.tsx +151 -34
  454. package/src/react/PlanCanvas.web.tsx +15 -5
  455. package/src/react/Popovers.tsx +116 -51
  456. package/src/react/Rail.tsx +360 -27
  457. package/src/react/ShapeMenu.tsx +66 -0
  458. package/src/react/Sheet.tsx +56 -11
  459. package/src/react/Slider.tsx +48 -0
  460. package/src/react/Toast.tsx +16 -9
  461. package/src/react/ToolTip.tsx +49 -0
  462. package/src/react/TopBar.tsx +97 -39
  463. package/src/react/Tween.native.tsx +36 -0
  464. package/src/react/Tween.tsx +24 -0
  465. package/src/react/View3D.native.tsx +131 -0
  466. package/src/react/View3D.web.tsx +131 -0
  467. package/src/react/View3DHost.ts +367 -0
  468. package/src/react/corners.ts +52 -0
  469. package/src/react/easing.ts +14 -0
  470. package/src/react/host.ts +8 -3
  471. package/src/react/hostKeypad.ts +66 -0
  472. package/src/react/motion.tsx +239 -0
  473. package/src/react/ports.ts +78 -9
  474. package/src/react/saving.ts +80 -0
  475. package/src/react/store.ts +35 -3
  476. package/src/react/theme.ts +8 -0
  477. package/src/react/topRow.ts +71 -0
  478. package/src/react/touch.ts +10 -0
  479. package/src/render/ctx.ts +8 -0
  480. package/src/render/draw.ts +437 -175
  481. package/src/render/elevation.ts +349 -143
  482. package/src/render/figmaIcons.ts +22 -0
  483. package/src/render/hit.ts +140 -21
  484. package/src/render/icons.ts +69 -10
  485. package/src/render/linkTile.ts +297 -0
  486. package/src/render/markup.ts +91 -0
  487. package/src/render/navigate.ts +114 -0
  488. package/src/render/snap.ts +105 -22
  489. package/src/render/squircle.ts +73 -0
  490. package/src/render/view.ts +255 -19
  491. package/src/skia/SkiaDrawCtx.ts +163 -41
  492. package/src/skia/host.ts +46 -1
  493. package/src/solver/equations.ts +37 -2
  494. package/src/solver/gauss-newton.ts +125 -28
  495. package/src/solver/linalg.ts +141 -5
  496. package/src/solver/types.ts +5 -0
  497. package/src/styles.css +91 -42
  498. package/src/tools/annotate.ts +58 -29
  499. package/src/tools/chamfer.ts +103 -0
  500. package/src/tools/corner.ts +99 -0
  501. package/src/tools/dim.ts +524 -92
  502. package/src/tools/elevation.ts +1 -1
  503. package/src/tools/fillet.ts +82 -0
  504. package/src/tools/freehand.ts +20 -16
  505. package/src/tools/index.ts +17 -4
  506. package/src/tools/line.ts +59 -23
  507. package/src/tools/modify.ts +86 -24
  508. package/src/tools/openings.ts +8 -13
  509. package/src/tools/registry.ts +27 -2
  510. package/src/tools/select.ts +424 -75
  511. package/src/tools/shapes.ts +119 -58
  512. package/src/ui/ctx.ts +2 -1
  513. package/src/ui/domPorts.ts +23 -4
  514. package/src/ui/drawer.ts +6 -26
  515. package/src/ui/elevation.ts +10 -101
  516. package/src/ui/keypad.ts +8 -14
  517. package/src/ui/laser.ts +2 -2
  518. package/src/ui/menu.ts +63 -17
  519. package/src/ui/noteinput.ts +3 -3
  520. package/src/ui/opacity.ts +108 -0
  521. package/src/ui/palette.ts +67 -12
  522. package/src/ui/rail.ts +21 -7
  523. package/src/ui/topbar.ts +4 -14
  524. package/src/units/format.ts +18 -3
  525. package/src/view3d/build.ts +607 -0
  526. package/src/view3d/camera.ts +113 -0
  527. package/src/view3d/fatLines.ts +83 -0
  528. package/src/view3d/lines.ts +258 -0
  529. package/src/view3d/mesh.ts +111 -0
  530. package/src/view3d/poly.ts +104 -0
  531. package/src/view3d/viewer.ts +348 -0
  532. package/dist/react/ElevCanvas.native.d.ts +0 -3
  533. package/dist/react/ElevCanvas.native.js +0 -58
  534. package/dist/react/ElevCanvas.native.js.map +0 -1
  535. package/dist/react/ElevCanvas.web.d.ts +0 -4
  536. package/dist/react/ElevCanvas.web.js +0 -44
  537. package/dist/react/ElevCanvas.web.js.map +0 -1
  538. package/dist/react/ElevationSheet.d.ts +0 -2
  539. package/dist/react/ElevationSheet.js +0 -38
  540. package/dist/react/ElevationSheet.js.map +0 -1
  541. package/dist/render/elevationView.d.ts +0 -3
  542. package/dist/render/elevationView.js +0 -100
  543. package/dist/render/elevationView.js.map +0 -1
  544. package/src/react/ElevCanvas.native.tsx +0 -68
  545. package/src/react/ElevCanvas.web.tsx +0 -42
  546. package/src/react/ElevationSheet.tsx +0 -88
  547. package/src/render/elevationView.ts +0 -73
@@ -0,0 +1,12 @@
1
+ import type { Sketch } from '../model/types';
2
+ /** The corner's two lines, if it can be cut off. */
3
+ export declare const chamferable: (sk: Sketch, pid: string) => boolean;
4
+ /** The most a corner can be cut back along each line. */
5
+ export declare function maxChamfer(sk: Sketch, pid: string): [number, number];
6
+ /** The Chamfer action: the keypad for the distance back from the corner (Unequal: one for each side), then the corner is cut off. */
7
+ export declare function chamferPrompt(pid: string): void;
8
+ /**
9
+ * Cut corner `pid` off: `d1` back along its first line, `d2` along its second (the same: an equal chamfer, held equal).
10
+ * Returns the cut's line id, or null (and says why) if it can't.
11
+ */
12
+ export declare function chamferCorner(pid: string, d1: number, d2?: number): string | null;
@@ -0,0 +1,114 @@
1
+ import { afterEdit, tryAddConstraint } from '../app/edit';
2
+ import { ed } from '../app/state';
3
+ import { dropHistory, pushHistory } from '../model/history';
4
+ import { addLine } from '../model/sketch';
5
+ import { replaceSK, SK } from '../model/store';
6
+ import { requestDraw } from '../render/view';
7
+ import { solver } from '../solver';
8
+ import { fmtLen } from '../units';
9
+ import { closeKeypad, openKeypad, toast, updateCtx } from '../editor/ports';
10
+ import { cornerAt, cutCorner } from './corner';
11
+ /*
12
+ Chamfer: cut a corner off straight. Both lines stop a distance back from the corner — the same on both sides
13
+ unless it's set as unequal — and a straight cut joins them (a wall of the same thickness between two walls). A
14
+ chamfer is measured from its corner, so the corner stays as a virtual sharp (dashed lines out to it): the distance
15
+ back along one side is a driving dimension, and "equal" holds the other side to it (or a second dimension, unequal).
16
+ */
17
+ /** The corner's two lines, if it can be cut off. */
18
+ export const chamferable = (sk, pid) => !!cornerAt(sk, pid);
19
+ /** The most a corner can be cut back along each line. */
20
+ export function maxChamfer(sk, pid) {
21
+ const k = cornerAt(sk, pid);
22
+ return k ? [k.len1, k.len2] : [0, 0];
23
+ }
24
+ /** Show which side a distance is along while it's entered (the line selected). */
25
+ function showSide(lid) { ed.sel = lid ? [{ type: 'line', id: lid }] : []; updateCtx(); requestDraw(); }
26
+ /** The Chamfer action: the keypad for the distance back from the corner (Unequal: one for each side), then the corner is cut off. */
27
+ export function chamferPrompt(pid) {
28
+ const sk = SK(), k = cornerAt(sk, pid);
29
+ if (!k) {
30
+ toast('Select a corner where two lines meet to cut it off.', { warn: true });
31
+ return;
32
+ }
33
+ const most = Math.min(k.len1, k.len2), start = Math.round(Math.min(6, most * 0.5) * 16) / 16;
34
+ openKeypad({
35
+ title: 'Chamfer', sub: 'Back from the corner along each side — up to ' + fmtLen(most), initial: fmtLen(start), selectAll: true, laser: true,
36
+ extras: () => [{ label: 'Unequal', ariaLabel: 'Unequal: a distance for each side', onPress: () => { closeKeypad(); unequal(pid); } }],
37
+ onDone: d => { chamferCorner(pid, d, d); },
38
+ });
39
+ }
40
+ /** Unequal: the distance along one side (selected while it's entered), then along the other. */
41
+ function unequal(pid) {
42
+ const k = cornerAt(SK(), pid);
43
+ if (!k)
44
+ return;
45
+ const back = ed.sel;
46
+ showSide(k.l1);
47
+ openKeypad({
48
+ title: 'Chamfer · first side', sub: 'Along the selected line — up to ' + fmtLen(k.len1), initial: fmtLen(Math.round(Math.min(6, k.len1 * 0.5) * 16) / 16), selectAll: true, laser: true,
49
+ onClose: () => { if (ed.sel.length === 1 && ed.sel[0].id === k.l1) {
50
+ ed.sel = back;
51
+ updateCtx();
52
+ requestDraw();
53
+ } },
54
+ onDone: d1 => {
55
+ showSide(k.l2);
56
+ openKeypad({
57
+ title: 'Chamfer · second side', sub: 'Along the selected line — up to ' + fmtLen(k.len2), initial: fmtLen(Math.round(Math.min(6, k.len2 * 0.5) * 16) / 16), selectAll: true, laser: true,
58
+ onClose: () => { if (ed.sel.length === 1 && ed.sel[0].id === k.l2) {
59
+ ed.sel = back;
60
+ updateCtx();
61
+ requestDraw();
62
+ } },
63
+ onDone: d2 => { chamferCorner(pid, d1, d2); },
64
+ });
65
+ },
66
+ });
67
+ }
68
+ /**
69
+ * Cut corner `pid` off: `d1` back along its first line, `d2` along its second (the same: an equal chamfer, held equal).
70
+ * Returns the cut's line id, or null (and says why) if it can't.
71
+ */
72
+ export function chamferCorner(pid, d1, d2 = d1) {
73
+ const sk = SK(), k = cornerAt(sk, pid);
74
+ if (!k) {
75
+ toast('Select a corner where two lines meet to cut it off.', { warn: true });
76
+ return null;
77
+ }
78
+ if (!(d1 > 0) || !(d2 > 0))
79
+ return null;
80
+ if (d1 >= k.len1 - 1e-6 || d2 >= k.len2 - 1e-6) {
81
+ const most = d1 === d2 ? fmtLen(Math.min(k.len1, k.len2)) : fmtLen(d1 >= k.len1 - 1e-6 ? k.len1 : k.len2);
82
+ toast('That’s more than this corner’s side: ' + most + ' at most.', { warn: true });
83
+ return null;
84
+ }
85
+ pushHistory();
86
+ const before = JSON.stringify(sk), L1 = sk.lines[k.l1], L2 = sk.lines[k.l2], wall = L1.kind === 'wall' && L2.kind === 'wall';
87
+ const cut = cutCorner(sk, k, d1, d2, (t1, t2) => {
88
+ const id = addLine(sk, t1, t2, { kind: wall ? 'wall' : 'line', constr: L1.constr && L2.constr, thick: wall ? L1.thick : undefined });
89
+ return id;
90
+ }, true);
91
+ const { c1, c2 } = cut.sharp;
92
+ // the distance back along the first side drives it; the second is equal to it, or its own
93
+ const cons = [
94
+ ...cut.cons,
95
+ { type: 'dist', a: cut.t1, b: pid, line: c1, value: d1, driving: true },
96
+ d1 === d2 ? { type: 'eq', l1: c1, l2: c2 } : { type: 'dist', a: cut.t2, b: pid, line: c2, value: d2, driving: true },
97
+ ];
98
+ for (const cn of cons)
99
+ tryAddConstraint(cn, { silent: true });
100
+ if (!solver.solve(sk).ok) {
101
+ replaceSK(JSON.parse(before));
102
+ dropHistory();
103
+ toast('That corner can’t be cut off with the constraints it has.', { warn: true });
104
+ afterEdit();
105
+ return null;
106
+ }
107
+ ed.sel = [{ type: 'line', id: cut.edge }];
108
+ afterEdit();
109
+ updateCtx();
110
+ requestDraw();
111
+ toast('Corner cut off: ' + (d1 === d2 ? fmtLen(d1) + ' each side' : fmtLen(d1) + ' × ' + fmtLen(d2)));
112
+ return cut.edge;
113
+ }
114
+ //# sourceMappingURL=chamfer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chamfer.js","sourceRoot":"","sources":["../../src/tools/chamfer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE/C;;;;;EAKE;AAEF,oDAAoD;AACpD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAAU,EAAE,GAAW,EAAW,EAAE,CAA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AAS,EAAE,CAAC;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IACD,EAAE,CAAC,GAAG,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IAC1C,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,CAAC;IAAC,WAAW,EAAE,CAAC;IAC3B,KAAK,CAAC,kBAAkB,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACtG,OAAO,GAAG,CAAC,IAAI,CAAC;AAClB,CAAC"}
@@ -0,0 +1,38 @@
1
+ import type { Constraint, Sketch, XY } from '../model/types';
2
+ /** A corner where two lines meet: the point, the two lines with their far ends, directions away from the corner and lengths, and the angle between them. */
3
+ export interface Corner {
4
+ pid: string;
5
+ P: XY;
6
+ l1: string;
7
+ l2: string;
8
+ q1: string;
9
+ q2: string;
10
+ u1: XY;
11
+ u2: XY;
12
+ len1: number;
13
+ len2: number;
14
+ /** the angle between the lines, radians (0 < th < π) */
15
+ th: number;
16
+ }
17
+ /** The corner at `pid`, if it can be cut back: two lines meet there, not in a straight line, neither of them a wall face's own edge. */
18
+ export declare function cornerAt(sk: Sketch, pid: string): Corner | null;
19
+ export interface Cut {
20
+ /** the new ends of the two lines */
21
+ t1: string;
22
+ t2: string;
23
+ /** what joins them */
24
+ edge: string;
25
+ /** the virtual sharp's dashed lines (new end → corner), when the corner is kept */
26
+ sharp: {
27
+ c1: string;
28
+ c2: string;
29
+ } | null;
30
+ /** constraints to add for the cut (the dashed lines staying on the lines' lines) */
31
+ cons: Constraint[];
32
+ }
33
+ /**
34
+ * Cut corner `k` back: line 1 stops `d1` short of it, line 2 `d2`, and `join(t1, t2)` makes what joins the new ends
35
+ * (returning its id). `keepSharp`: keep the corner as a virtual sharp even when nothing else hangs on it (a chamfer
36
+ * is measured from it). The caller has pushed history; it adds the returned constraints and its own, and solves.
37
+ */
38
+ export declare function cutCorner(sk: Sketch, k: Corner, d1: number, d2: number, join: (t1: string, t2: string) => string, keepSharp?: boolean): Cut;
@@ -0,0 +1,99 @@
1
+ import { cornerLines } from '../editor/selection';
2
+ import { hyp } from '../model/geom';
3
+ import { roomEdges } from '../model/rooms';
4
+ import { addLine, addPoint } from '../model/sketch';
5
+ /*
6
+ Cutting a corner back, for Fillet and Chamfer: where two lines (or walls) meet, each line stops a distance short of
7
+ the corner and something new joins the two ends (an arc, a straight cut). What hangs on the lines follows: doors
8
+ and windows keep their place, level/plumb moves to the new ends, a space around the corner takes the new edge.
9
+ Whatever was measured to the corner keeps its meaning: the corner stays as a "virtual sharp" — dashed lines from
10
+ the new ends out to where the two lines would meet.
11
+ */
12
+ const norm = (x, y) => { const L = hyp(x, y) || 1; return { x: x / L, y: y / L }; };
13
+ /** The corner at `pid`, if it can be cut back: two lines meet there, not in a straight line, neither of them a wall face's own edge. */
14
+ export function cornerAt(sk, pid) {
15
+ const pair = cornerLines(sk, pid), P = sk.points[pid];
16
+ if (!pair || !P || P.anchor || pair.some(id => sk.lines[id].anchor))
17
+ return null;
18
+ const [l1, l2] = pair, L1 = sk.lines[l1], L2 = sk.lines[l2];
19
+ const q1 = L1.a === pid ? L1.b : L1.a, q2 = L2.a === pid ? L2.b : L2.a, Q1 = sk.points[q1], Q2 = sk.points[q2];
20
+ const u1 = norm(Q1.x - P.x, Q1.y - P.y), u2 = norm(Q2.x - P.x, Q2.y - P.y);
21
+ const th = Math.acos(Math.max(-1, Math.min(1, u1.x * u2.x + u1.y * u2.y)));
22
+ if (!(th > 0.5 * Math.PI / 180 && th < 179.5 * Math.PI / 180))
23
+ return null;
24
+ return { pid, P, l1, l2, q1, q2, u1, u2, len1: hyp(Q1.x - P.x, Q1.y - P.y), len2: hyp(Q2.x - P.x, Q2.y - P.y), th };
25
+ }
26
+ /** Whether anything besides its two lines hangs on the corner (dimensions, constraints, curves, door/window dimensions, a cabinet). */
27
+ function cornerUsed(sk, k) {
28
+ const { pid, l1, l2 } = k;
29
+ return Object.values(sk.cons).some(cn => cn.a === pid || cn.b === pid || cn.p === pid || (cn.type === 'angle' && [cn.l1, cn.l2].includes(l1) && [cn.l1, cn.l2].includes(l2)))
30
+ || Object.values(sk.circles).some(ci => ci.c === pid) || Object.values(sk.arcs).some(a => [a.c, a.a, a.b].includes(pid))
31
+ || Object.values(sk.openings).some(o => (o.dims || []).some(dm => 'pt' in dm.ref && dm.ref.pt === pid))
32
+ || Object.values(sk.cabs ?? {}).some(cb => [cb.bl, cb.br, cb.tr, cb.tl].includes(pid));
33
+ }
34
+ /**
35
+ * Cut corner `k` back: line 1 stops `d1` short of it, line 2 `d2`, and `join(t1, t2)` makes what joins the new ends
36
+ * (returning its id). `keepSharp`: keep the corner as a virtual sharp even when nothing else hangs on it (a chamfer
37
+ * is measured from it). The caller has pushed history; it adds the returned constraints and its own, and solves.
38
+ */
39
+ export function cutCorner(sk, k, d1, d2, join, keepSharp = false) {
40
+ const { pid, P, l1, l2, q1, q2, u1, u2 } = k, L1 = sk.lines[l1], L2 = sk.lines[l2];
41
+ // the spaces around the corner, as they are now (their sides are found from the corner's lines)
42
+ const rooms = Object.entries(sk.rooms).map(([id, rm]) => ({ id, i: rm.loop.indexOf(pid), edges: rm.loop.includes(pid) ? roomEdges(sk, rm) : null })).filter(x => x.i >= 0 && x.edges);
43
+ const t1 = addPoint(sk, P.x + u1.x * d1, P.y + u1.y * d1), t2 = addPoint(sk, P.x + u2.x * d2, P.y + u2.y * d2);
44
+ // doors and windows keep their place along a line whose start moves
45
+ for (const o of Object.values(sk.openings)) {
46
+ if (o.line === l1 && L1.a === pid)
47
+ o.at -= d1;
48
+ if (o.line === l2 && L2.a === pid)
49
+ o.at -= d2;
50
+ }
51
+ // level/plumb on a line, set between the corner and its other end: between the new end and that end now
52
+ for (const cn of Object.values(sk.cons)) {
53
+ if (cn.type !== 'h' && cn.type !== 'v')
54
+ continue;
55
+ if ((cn.a === pid && cn.b === q1) || (cn.b === pid && cn.a === q1)) {
56
+ if (cn.a === pid)
57
+ cn.a = t1;
58
+ else
59
+ cn.b = t1;
60
+ }
61
+ else if ((cn.a === pid && cn.b === q2) || (cn.b === pid && cn.a === q2)) {
62
+ if (cn.a === pid)
63
+ cn.a = t2;
64
+ else
65
+ cn.b = t2;
66
+ }
67
+ }
68
+ if (L1.a === pid)
69
+ L1.a = t1;
70
+ else
71
+ L1.b = t1;
72
+ if (L2.a === pid)
73
+ L2.a = t2;
74
+ else
75
+ L2.b = t2;
76
+ const keep = keepSharp || cornerUsed(sk, k);
77
+ const edge = join(t1, t2), cons = [];
78
+ let sharp = null;
79
+ if (keep) {
80
+ const c1 = addLine(sk, t1, pid, { constr: true }), c2 = addLine(sk, t2, pid, { constr: true });
81
+ sharp = { c1, c2 };
82
+ cons.push({ type: 'col', l1, l2: c1 }, { type: 'col', l1: l2, l2: c2 });
83
+ // an angle at the corner is between the dashed lines now (they still meet there)
84
+ for (const cn of Object.values(sk.cons))
85
+ if (cn.type === 'angle' && [cn.l1, cn.l2].includes(l1) && [cn.l1, cn.l2].includes(l2)) {
86
+ cn.l1 = cn.l1 === l1 ? c1 : c2;
87
+ cn.l2 = cn.l2 === l2 ? c2 : c1;
88
+ }
89
+ }
90
+ // spaces: the corner becomes the two new ends, with the new edge between them
91
+ for (const rm of rooms) {
92
+ const room = sk.rooms[rm.id], i = rm.i, n = room.loop.length, edges = rm.edges;
93
+ const into = edges[(i - 1 + n) % n], tIn = into === l1 ? t1 : t2, tOut = into === l1 ? t2 : t1;
94
+ room.loop = [...room.loop.slice(0, i), tIn, tOut, ...room.loop.slice(i + 1)];
95
+ room.edges = [...edges.slice(0, i), edge, ...edges.slice(i)];
96
+ }
97
+ return { t1, t2, edge, sharp, cons };
98
+ }
99
+ //# sourceMappingURL=corner.js.map
@@ -0,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,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC7E,IAAI,CAAC,KAAK,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACvC,CAAC"}
@@ -1,8 +1,10 @@
1
- import type { XY } from '../model/types';
1
+ import type { Constraint, LinkTarget, Sketch, XY } from '../model/types';
2
2
  import type { PEv } from './registry';
3
3
  export declare const dimTool: {
4
+ /** angle: the first pick is a corner whose angle keypad is open (the next tap closes it) */
4
5
  st: {
5
6
  first: string | null;
7
+ angle: boolean;
6
8
  };
7
9
  reset(): void;
8
10
  busy(): boolean;
@@ -18,20 +20,95 @@ export declare const dimTool: {
18
20
  up(ev: PEv): void;
19
21
  hint(): "Print dimensions are labels for the crew — they never move the drawing. Tap a line or two points." | "Tap a corner or point to measure from. The door or window locks at that distance." | "Tap a line, a circle, or two points — door and window edges count as points. Then type the value." | "Tap a second point, a door or window edge, or a line for the offset distance.";
20
22
  };
21
- /** Tap on a line (or its + chip): open the keypad for its length, or edit the existing length. */
22
- export declare function dimLine(lid: string, print: boolean): void;
23
+ /**
24
+ * Tap on a line (or its + chip): open the keypad for its length, or edit the existing length. A wall's is measured on
25
+ * `side`, the edge picked — or, picked whole, on the side a space is on (the side it was tapped on, between two), and
26
+ * along its centerline where there's no space; the keypad can switch it.
27
+ */
28
+ export declare function dimLine(lid: string, print: boolean, side?: 1 | -1): void;
29
+ /** Why a measurement of the job can't drive a line the drawing already sets the length of. */
30
+ export declare const LENGTH_SET_ALREADY = "The drawing already sets that line\u2019s length. Free it first (make one of its dimensions a reference), then pick the measurement.";
31
+ /** Why a measurement of the job can't drive an angle the drawing already sets. */
32
+ export declare const ANGLE_SET_ALREADY = "The drawing already sets that angle. Free it first (make one of its dimensions a reference), then pick the measurement.";
33
+ /**
34
+ * Faces a dimension can be measured between. `face`: a wall's length on its face to the left of A → B (+1), the right
35
+ * (−1) or its centerline (0). `faces`: a distance between two walls ([the line it's square to, the wall its point is
36
+ * on — `l2`]) between the faces toward each other (+1), far faces (−1) or centerlines (0).
37
+ */
38
+ export interface FaceChoice {
39
+ /** what it's called in the keypad; `short`, in the bar (beside `icon`, which shows the face as the page has it) */
40
+ label?: string;
41
+ short?: string;
42
+ icon?: string;
43
+ face?: 0 | 1 | -1;
44
+ faces?: [number, number];
45
+ l2?: string;
46
+ }
47
+ /** The faces a dimension on walls can be measured on, as choices; none when it isn't on a wall. */
48
+ export declare function faceChoices(sk: Sketch, c: Constraint): FaceChoice[];
49
+ /** Whether a dimension is measured on the faces a choice says. */
50
+ export declare function onChoice(c: Constraint, ch: FaceChoice): boolean;
51
+ /** Measure a dimension on other faces of its walls, the drawing kept as it is: its number is what it measures there now. */
52
+ export declare function setDimFace(id: string, ch: FaceChoice): void;
53
+ /** From a wall's edge to a point: square to the wall, from that face. */
54
+ export declare function dimEdgePoint(lid: string, side: 1 | -1, p: string): void;
55
+ /**
56
+ * Two things picked, at least one a wall's edge: the distance between them — two edges of one wall, its thickness
57
+ * (`thickness` opens it); of two walls, face to face; an edge and a line, from that face; an edge and a point, from it.
58
+ */
59
+ export declare function dimEdges(items: {
60
+ type: string;
61
+ id: string;
62
+ }[], thickness: (lid: string) => void): void;
23
63
  export declare function dimPoints(a: string, b: string, print: boolean): void;
24
64
  /**
25
65
  * Dimension between two lines: their distance if they're parallel (measured square to them, and kept parallel),
26
- * otherwise the angle between them. An existing dimension between them is edited instead of stacking another.
66
+ * otherwise the angle between them. An existing dimension between them is edited instead of stacking another. Between
67
+ * walls it's measured on `sides`, the edges picked (+1 / −1: the face to the left / right of A → B; 0 its centerline) —
68
+ * or, picked whole, each wall's room side (see faceToward).
69
+ */
70
+ export declare function dimTwoLines(l1: string, l2: string, sides?: Record<string, 0 | 1 | -1>): void;
71
+ /**
72
+ * The distance from point `p` to line `lid`, square to it. On a wall it's measured from `faces[0]`, its face toward
73
+ * the point (+1), its far face (−1) or its centerline (0) — by default the face toward it where a space is against it;
74
+ * `faces[1]` is the same for wall `l2`, which the point is the end of (a distance between two walls). The keypad can
75
+ * switch them.
27
76
  */
28
- export declare function dimTwoLines(l1: string, l2: string): void;
29
77
  export declare function dimPointLine(p: string, lid: string, opts?: {
30
78
  keepParallel?: string;
31
79
  title?: string;
80
+ faces?: [number, number];
81
+ l2?: string;
32
82
  }): void;
33
- export declare function dimCurve(id: string): void;
34
- export declare function dimAngle(l1: string, l2: string): void;
35
- export declare function editDim(id: string): void;
36
- export declare function setDimValue(id: string, v: number): void;
83
+ /**
84
+ * A circle's or arc's diameter: its keypad, or its dimension's. A curved wall's is measured across `side`, the edge
85
+ * picked (+1 its outer face, −1 its inner) — or, picked whole, the side a space is on (the side it was tapped on,
86
+ * between two), and its centerline where there's no space; the keypad can switch it.
87
+ */
88
+ export declare function dimCurve(id: string, side?: 1 | -1): void;
89
+ /** A corner's angle (two lines meeting at `pid`): its angle dimension's keypad, or a new one's. False if it isn't a corner. */
90
+ export declare function cornerAngle(pid: string, done?: () => void, modeless?: boolean): boolean;
91
+ export declare function dimAngle(l1: string, l2: string, done?: () => void, modeless?: boolean): void;
92
+ /**
93
+ * The keypad for a dimension. One measured on walls can be switched to their other faces (or centerlines) there — to
94
+ * `pick` straight away — taken with the value on Apply.
95
+ */
96
+ export declare function editDim(id: string, done?: () => void, modeless?: boolean, pick?: FaceChoice): void;
97
+ /** Set a dimension's value — on the faces of its walls `face` says, when it's given (both, or neither). */
98
+ /** What else a new value for a dimension brings with it. */
99
+ export interface DimValueOpts {
100
+ /** the measurement of the job it's linked to from now on (null: it lets go of its link) */
101
+ link?: LinkTarget | null;
102
+ /** the host's record of the laser reading the value is from: kept on the dimension until it's saved to the group */
103
+ capture?: unknown;
104
+ /** the person has said to already: a linked one changes without asking */
105
+ asked?: boolean;
106
+ /** the job's own value coming in: no undo step of its own, and nothing shown if the drawing can't hold it */
107
+ quiet?: boolean;
108
+ }
109
+ /**
110
+ * Give dimension `id` value `v`, solving the drawing to it (or explaining why it can't). Whether it took — false too
111
+ * when the person is asked first, for a dimension linked to a measurement of the job (see editor/linkWrite.ts).
112
+ */
113
+ export declare function setDimValue(id: string, v: number, face?: FaceChoice, opts?: DimValueOpts): boolean;
37
114
  export declare function toggleRef(id: string): void;