@reekon-tools/boldr-cad 0.1.0 → 1.1.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.
- package/README.md +99 -16
- package/dist/app/edit.d.ts +12 -1
- package/dist/app/edit.js +96 -11
- package/dist/app/edit.js.map +1 -1
- package/dist/app/state.d.ts +31 -4
- package/dist/app/state.js +31 -2
- package/dist/app/state.js.map +1 -1
- package/dist/data/memory.d.ts +9 -1
- package/dist/data/memory.js +13 -8
- package/dist/data/memory.js.map +1 -1
- package/dist/data/provider.d.ts +30 -10
- package/dist/data/sync.d.ts +14 -3
- package/dist/data/sync.js +133 -66
- package/dist/data/sync.js.map +1 -1
- package/dist/editor/actions.d.ts +1 -2
- package/dist/editor/actions.js +391 -113
- package/dist/editor/actions.js.map +1 -1
- package/dist/editor/confirm.d.ts +23 -0
- package/dist/editor/confirm.js +35 -0
- package/dist/editor/confirm.js.map +1 -0
- package/dist/editor/elevation.d.ts +191 -90
- package/dist/editor/elevation.js +812 -616
- package/dist/editor/elevation.js.map +1 -1
- package/dist/editor/face.d.ts +73 -0
- package/dist/editor/face.js +269 -0
- package/dist/editor/face.js.map +1 -0
- package/dist/editor/files.d.ts +6 -0
- package/dist/editor/files.js +50 -4
- package/dist/editor/files.js.map +1 -1
- package/dist/editor/gestures.d.ts +18 -3
- package/dist/editor/gestures.js +145 -30
- package/dist/editor/gestures.js.map +1 -1
- package/dist/editor/keypad.d.ts +20 -5
- package/dist/editor/keypad.js +62 -15
- package/dist/editor/keypad.js.map +1 -1
- package/dist/editor/keys.js +36 -4
- package/dist/editor/keys.js.map +1 -1
- package/dist/editor/laser.d.ts +20 -4
- package/dist/editor/laser.js +104 -21
- package/dist/editor/laser.js.map +1 -1
- package/dist/editor/linkActions.d.ts +49 -0
- package/dist/editor/linkActions.js +210 -0
- package/dist/editor/linkActions.js.map +1 -0
- package/dist/editor/linkFollow.d.ts +2 -0
- package/dist/editor/linkFollow.js +53 -0
- package/dist/editor/linkFollow.js.map +1 -0
- package/dist/editor/linkWrite.d.ts +13 -0
- package/dist/editor/linkWrite.js +84 -0
- package/dist/editor/linkWrite.js.map +1 -0
- package/dist/editor/links.d.ts +84 -0
- package/dist/editor/links.js +130 -0
- package/dist/editor/links.js.map +1 -0
- package/dist/editor/markup.d.ts +29 -3
- package/dist/editor/markup.js +95 -10
- package/dist/editor/markup.js.map +1 -1
- package/dist/editor/mode.d.ts +40 -2
- package/dist/editor/mode.js +71 -4
- package/dist/editor/mode.js.map +1 -1
- package/dist/editor/ports.d.ts +38 -6
- package/dist/editor/ports.js +10 -1
- package/dist/editor/ports.js.map +1 -1
- package/dist/editor/project.d.ts +38 -6
- package/dist/editor/project.js +170 -27
- package/dist/editor/project.js.map +1 -1
- package/dist/editor/selection.d.ts +10 -0
- package/dist/editor/selection.js +62 -8
- package/dist/editor/selection.js.map +1 -1
- package/dist/editor/status.js +3 -0
- package/dist/editor/status.js.map +1 -1
- package/dist/editor/tooltips.d.ts +5 -0
- package/dist/editor/tooltips.js +48 -0
- package/dist/editor/tooltips.js.map +1 -0
- package/dist/editor/view3d.d.ts +17 -0
- package/dist/editor/view3d.js +135 -0
- package/dist/editor/view3d.js.map +1 -0
- package/dist/editor/view3dState.d.ts +39 -0
- package/dist/editor/view3dState.js +44 -0
- package/dist/editor/view3dState.js.map +1 -0
- package/dist/export/dxf.js +1 -1
- package/dist/export/dxf.js.map +1 -1
- package/dist/export/pdf.js +17 -12
- package/dist/export/pdf.js.map +1 -1
- package/dist/export/plan.d.ts +23 -6
- package/dist/export/plan.js +127 -44
- package/dist/export/plan.js.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/model/constraints.js +15 -4
- package/dist/model/constraints.js.map +1 -1
- package/dist/model/demo.js +3 -3
- package/dist/model/demo.js.map +1 -1
- package/dist/model/elevation.d.ts +6 -9
- package/dist/model/elevation.js +5 -13
- package/dist/model/elevation.js.map +1 -1
- package/dist/model/faces.d.ts +58 -0
- package/dist/model/faces.js +197 -0
- package/dist/model/faces.js.map +1 -0
- package/dist/model/facesolve.d.ts +72 -0
- package/dist/model/facesolve.js +369 -0
- package/dist/model/facesolve.js.map +1 -0
- package/dist/model/history.d.ts +3 -2
- package/dist/model/history.js +17 -11
- package/dist/model/history.js.map +1 -1
- package/dist/model/images.d.ts +18 -0
- package/dist/model/images.js +26 -0
- package/dist/model/images.js.map +1 -0
- package/dist/model/links.d.ts +46 -0
- package/dist/model/links.js +73 -0
- package/dist/model/links.js.map +1 -0
- package/dist/model/markup.d.ts +46 -0
- package/dist/model/markup.js +71 -0
- package/dist/model/markup.js.map +1 -0
- package/dist/model/measurement.d.ts +11 -0
- package/dist/model/measurement.js +24 -0
- package/dist/model/measurement.js.map +1 -0
- package/dist/model/openings.d.ts +4 -0
- package/dist/model/openings.js +4 -0
- package/dist/model/openings.js.map +1 -1
- package/dist/model/planGeom.d.ts +72 -2
- package/dist/model/planGeom.js +184 -10
- package/dist/model/planGeom.js.map +1 -1
- package/dist/model/project.js +3 -2
- package/dist/model/project.js.map +1 -1
- package/dist/model/projectfile.js +2 -1
- package/dist/model/projectfile.js.map +1 -1
- package/dist/model/rooms.js +2 -2
- package/dist/model/rooms.js.map +1 -1
- package/dist/model/settings.d.ts +6 -0
- package/dist/model/settings.js +2 -2
- package/dist/model/settings.js.map +1 -1
- package/dist/model/sketch.d.ts +14 -0
- package/dist/model/sketch.js +143 -24
- package/dist/model/sketch.js.map +1 -1
- package/dist/model/smooth.d.ts +6 -0
- package/dist/model/smooth.js +52 -0
- package/dist/model/smooth.js.map +1 -0
- package/dist/model/store.d.ts +12 -0
- package/dist/model/store.js +35 -3
- package/dist/model/store.js.map +1 -1
- package/dist/model/types.d.ts +173 -8
- package/dist/model/wallfaces.d.ts +32 -0
- package/dist/model/wallfaces.js +133 -20
- package/dist/model/wallfaces.js.map +1 -1
- package/dist/model/wallshape.d.ts +15 -0
- package/dist/model/wallshape.js +89 -0
- package/dist/model/wallshape.js.map +1 -0
- package/dist/react/BottomBar.d.ts +9 -5
- package/dist/react/BottomBar.js +213 -24
- package/dist/react/BottomBar.js.map +1 -1
- package/dist/react/Buttons.d.ts +13 -2
- package/dist/react/Buttons.js +37 -5
- package/dist/react/Buttons.js.map +1 -1
- package/dist/react/CadEditor.d.ts +54 -4
- package/dist/react/CadEditor.js +79 -21
- package/dist/react/CadEditor.js.map +1 -1
- package/dist/react/ConfirmSheet.d.ts +4 -0
- package/dist/react/ConfirmSheet.js +31 -0
- package/dist/react/ConfirmSheet.js.map +1 -0
- package/dist/react/ConflictSheet.d.ts +2 -1
- package/dist/react/ConflictSheet.js +16 -8
- package/dist/react/ConflictSheet.js.map +1 -1
- package/dist/react/Drawer.d.ts +8 -2
- package/dist/react/Drawer.js +167 -38
- package/dist/react/Drawer.js.map +1 -1
- package/dist/react/Duck.d.ts +13 -0
- package/dist/react/Duck.js +45 -0
- package/dist/react/Duck.js.map +1 -0
- package/dist/react/Empty3D.d.ts +2 -0
- package/dist/react/Empty3D.js +39 -0
- package/dist/react/Empty3D.js.map +1 -0
- package/dist/react/FitScroll.d.ts +6 -0
- package/dist/react/FitScroll.js +14 -0
- package/dist/react/FitScroll.js.map +1 -0
- package/dist/react/Icon.native.d.ts +6 -0
- package/dist/react/Icon.native.js +4 -0
- package/dist/react/Icon.native.js.map +1 -1
- package/dist/react/Icon.web.d.ts +6 -0
- package/dist/react/Icon.web.js +4 -0
- package/dist/react/Icon.web.js.map +1 -1
- package/dist/react/KeypadSheet.d.ts +9 -2
- package/dist/react/KeypadSheet.js +174 -42
- package/dist/react/KeypadSheet.js.map +1 -1
- package/dist/react/LaserTray.js +8 -5
- package/dist/react/LaserTray.js.map +1 -1
- package/dist/react/MarkupPanel.d.ts +8 -0
- package/dist/react/MarkupPanel.js +67 -0
- package/dist/react/MarkupPanel.js.map +1 -0
- package/dist/react/PageThumb.native.d.ts +7 -2
- package/dist/react/PageThumb.native.js +19 -7
- package/dist/react/PageThumb.native.js.map +1 -1
- package/dist/react/PageThumb.web.d.ts +3 -2
- package/dist/react/PageThumb.web.js +4 -4
- package/dist/react/PageThumb.web.js.map +1 -1
- package/dist/react/PlanCanvas.native.d.ts +1 -1
- package/dist/react/PlanCanvas.native.js +134 -36
- package/dist/react/PlanCanvas.native.js.map +1 -1
- package/dist/react/PlanCanvas.web.js +16 -5
- package/dist/react/PlanCanvas.web.js.map +1 -1
- package/dist/react/Popovers.d.ts +12 -6
- package/dist/react/Popovers.js +53 -26
- package/dist/react/Popovers.js.map +1 -1
- package/dist/react/Rail.d.ts +24 -0
- package/dist/react/Rail.js +324 -34
- package/dist/react/Rail.js.map +1 -1
- package/dist/react/ShapeMenu.d.ts +7 -0
- package/dist/react/ShapeMenu.js +58 -0
- package/dist/react/ShapeMenu.js.map +1 -0
- package/dist/react/Sheet.d.ts +14 -4
- package/dist/react/Sheet.js +54 -9
- package/dist/react/Sheet.js.map +1 -1
- package/dist/react/Slider.d.ts +18 -0
- package/dist/react/Slider.js +27 -0
- package/dist/react/Slider.js.map +1 -0
- package/dist/react/Toast.js +14 -6
- package/dist/react/Toast.js.map +1 -1
- package/dist/react/ToolTip.d.ts +7 -0
- package/dist/react/ToolTip.js +43 -0
- package/dist/react/ToolTip.js.map +1 -0
- package/dist/react/TopBar.d.ts +6 -3
- package/dist/react/TopBar.js +48 -17
- package/dist/react/TopBar.js.map +1 -1
- package/dist/react/Tween.d.ts +7 -0
- package/dist/react/Tween.js +26 -0
- package/dist/react/Tween.js.map +1 -0
- package/dist/react/Tween.native.d.ts +6 -0
- package/dist/react/Tween.native.js +43 -0
- package/dist/react/Tween.native.js.map +1 -0
- package/dist/react/View3D.native.d.ts +4 -0
- package/dist/react/View3D.native.js +103 -0
- package/dist/react/View3D.native.js.map +1 -0
- package/dist/react/View3D.web.d.ts +4 -0
- package/dist/react/View3D.web.js +151 -0
- package/dist/react/View3D.web.js.map +1 -0
- package/dist/react/View3DHost.d.ts +143 -0
- package/dist/react/View3DHost.js +377 -0
- package/dist/react/View3DHost.js.map +1 -0
- package/dist/react/corners.d.ts +7 -0
- package/dist/react/corners.js +51 -0
- package/dist/react/corners.js.map +1 -0
- package/dist/react/easing.d.ts +15 -0
- package/dist/react/easing.js +10 -0
- package/dist/react/easing.js.map +1 -0
- package/dist/react/host.d.ts +7 -2
- package/dist/react/host.js +8 -3
- package/dist/react/host.js.map +1 -1
- package/dist/react/hostKeypad.d.ts +56 -0
- package/dist/react/hostKeypad.js +5 -0
- package/dist/react/hostKeypad.js.map +1 -0
- package/dist/react/motion.d.ts +77 -0
- package/dist/react/motion.js +173 -0
- package/dist/react/motion.js.map +1 -0
- package/dist/react/ports.js +90 -8
- package/dist/react/ports.js.map +1 -1
- package/dist/react/saving.d.ts +15 -0
- package/dist/react/saving.js +76 -0
- package/dist/react/saving.js.map +1 -0
- package/dist/react/store.d.ts +38 -1
- package/dist/react/store.js +31 -1
- package/dist/react/store.js.map +1 -1
- package/dist/react/theme.d.ts +10 -0
- package/dist/react/theme.js +8 -0
- package/dist/react/theme.js.map +1 -1
- package/dist/react/topRow.d.ts +22 -0
- package/dist/react/topRow.js +61 -0
- package/dist/react/topRow.js.map +1 -0
- package/dist/react/touch.d.ts +6 -0
- package/dist/react/touch.js +9 -0
- package/dist/react/touch.js.map +1 -0
- package/dist/render/ctx.d.ts +8 -0
- package/dist/render/draw.d.ts +33 -1
- package/dist/render/draw.js +593 -215
- package/dist/render/draw.js.map +1 -1
- package/dist/render/elevation.d.ts +65 -43
- package/dist/render/elevation.js +414 -140
- package/dist/render/elevation.js.map +1 -1
- package/dist/render/figmaIcons.d.ts +12 -0
- package/dist/render/figmaIcons.js +21 -0
- package/dist/render/figmaIcons.js.map +1 -0
- package/dist/render/hit.d.ts +22 -2
- package/dist/render/hit.js +168 -25
- package/dist/render/hit.js.map +1 -1
- package/dist/render/icons.js +69 -10
- package/dist/render/icons.js.map +1 -1
- package/dist/render/linkTile.d.ts +15 -0
- package/dist/render/linkTile.js +369 -0
- package/dist/render/linkTile.js.map +1 -0
- package/dist/render/markup.d.ts +11 -0
- package/dist/render/markup.js +112 -0
- package/dist/render/markup.js.map +1 -0
- package/dist/render/navigate.d.ts +88 -0
- package/dist/render/navigate.js +100 -0
- package/dist/render/navigate.js.map +1 -0
- package/dist/render/snap.d.ts +20 -1
- package/dist/render/snap.js +118 -25
- package/dist/render/snap.js.map +1 -1
- package/dist/render/squircle.d.ts +8 -0
- package/dist/render/squircle.js +71 -0
- package/dist/render/squircle.js.map +1 -0
- package/dist/render/view.d.ts +115 -2
- package/dist/render/view.js +244 -19
- package/dist/render/view.js.map +1 -1
- package/dist/skia/SkiaDrawCtx.d.ts +30 -2
- package/dist/skia/SkiaDrawCtx.js +198 -43
- package/dist/skia/SkiaDrawCtx.js.map +1 -1
- package/dist/skia/host.d.ts +18 -2
- package/dist/skia/host.js +46 -1
- package/dist/skia/host.js.map +1 -1
- package/dist/solver/equations.js +37 -2
- package/dist/solver/equations.js.map +1 -1
- package/dist/solver/gauss-newton.d.ts +17 -0
- package/dist/solver/gauss-newton.js +144 -36
- package/dist/solver/gauss-newton.js.map +1 -1
- package/dist/solver/linalg.d.ts +45 -2
- package/dist/solver/linalg.js +164 -10
- package/dist/solver/linalg.js.map +1 -1
- package/dist/solver/types.d.ts +5 -0
- package/dist/tools/annotate.d.ts +57 -1
- package/dist/tools/annotate.js +64 -43
- package/dist/tools/annotate.js.map +1 -1
- package/dist/tools/chamfer.d.ts +12 -0
- package/dist/tools/chamfer.js +114 -0
- package/dist/tools/chamfer.js.map +1 -0
- package/dist/tools/corner.d.ts +38 -0
- package/dist/tools/corner.js +99 -0
- package/dist/tools/corner.js.map +1 -0
- package/dist/tools/dim.d.ts +86 -9
- package/dist/tools/dim.js +582 -97
- package/dist/tools/dim.js.map +1 -1
- package/dist/tools/elevation.js +5 -5
- package/dist/tools/elevation.js.map +1 -1
- package/dist/tools/fillet.d.ts +9 -0
- package/dist/tools/fillet.js +86 -0
- package/dist/tools/fillet.js.map +1 -0
- package/dist/tools/freehand.d.ts +3 -2
- package/dist/tools/freehand.js +19 -12
- package/dist/tools/freehand.js.map +1 -1
- package/dist/tools/index.js +14 -4
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/line.d.ts +8 -3
- package/dist/tools/line.js +66 -30
- package/dist/tools/line.js.map +1 -1
- package/dist/tools/modify.d.ts +13 -0
- package/dist/tools/modify.js +105 -25
- package/dist/tools/modify.js.map +1 -1
- package/dist/tools/openings.js +25 -18
- package/dist/tools/openings.js.map +1 -1
- package/dist/tools/registry.d.ts +8 -0
- package/dist/tools/registry.js +42 -2
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/select.d.ts +77 -3
- package/dist/tools/select.js +560 -74
- package/dist/tools/select.js.map +1 -1
- package/dist/tools/shapes.d.ts +14 -0
- package/dist/tools/shapes.js +154 -75
- package/dist/tools/shapes.js.map +1 -1
- package/dist/units/format.d.ts +11 -3
- package/dist/units/format.js +27 -6
- package/dist/units/format.js.map +1 -1
- package/dist/units/parse.d.ts +2 -1
- package/dist/units/parse.js +5 -4
- package/dist/units/parse.js.map +1 -1
- package/dist/units/prefs.d.ts +9 -1
- package/dist/units/prefs.js +6 -0
- package/dist/units/prefs.js.map +1 -1
- package/dist/view3d/build.d.ts +35 -0
- package/dist/view3d/build.js +630 -0
- package/dist/view3d/build.js.map +1 -0
- package/dist/view3d/camera.d.ts +60 -0
- package/dist/view3d/camera.js +84 -0
- package/dist/view3d/camera.js.map +1 -0
- package/dist/view3d/fatLines.d.ts +11 -0
- package/dist/view3d/fatLines.js +83 -0
- package/dist/view3d/fatLines.js.map +1 -0
- package/dist/view3d/lines.d.ts +17 -0
- package/dist/view3d/lines.js +271 -0
- package/dist/view3d/lines.js.map +1 -0
- package/dist/view3d/mesh.d.ts +51 -0
- package/dist/view3d/mesh.js +101 -0
- package/dist/view3d/mesh.js.map +1 -0
- package/dist/view3d/poly.d.ts +16 -0
- package/dist/view3d/poly.js +109 -0
- package/dist/view3d/poly.js.map +1 -0
- package/dist/view3d/viewer.d.ts +86 -0
- package/dist/view3d/viewer.js +350 -0
- package/dist/view3d/viewer.js.map +1 -0
- package/package.json +15 -2
- package/src/app/edit.ts +83 -12
- package/src/app/main.ts +11 -5
- package/src/app/state.ts +38 -5
- package/src/data/memory.ts +15 -10
- package/src/data/provider.ts +25 -10
- package/src/data/sync.ts +107 -53
- package/src/editor/actions.ts +292 -83
- package/src/editor/confirm.ts +58 -0
- package/src/editor/elevation.ts +698 -478
- package/src/editor/face.ts +227 -0
- package/src/editor/files.ts +40 -4
- package/src/editor/gestures.ts +147 -31
- package/src/editor/keypad.ts +67 -18
- package/src/editor/keys.ts +25 -5
- package/src/editor/laser.ts +98 -20
- package/src/editor/linkActions.ts +194 -0
- package/src/editor/linkFollow.ts +43 -0
- package/src/editor/linkWrite.ts +77 -0
- package/src/editor/links.ts +181 -0
- package/src/editor/markup.ts +92 -8
- package/src/editor/mode.ts +83 -7
- package/src/editor/ports.ts +39 -6
- package/src/editor/project.ts +157 -26
- package/src/editor/selection.ts +54 -8
- package/src/editor/status.ts +2 -0
- package/src/editor/tooltips.ts +47 -0
- package/src/editor/view3d.ts +119 -0
- package/src/editor/view3dState.ts +61 -0
- package/src/export/dxf.ts +1 -1
- package/src/export/pdf.ts +15 -7
- package/src/export/plan.ts +119 -35
- package/src/index.ts +7 -1
- package/src/input/keyboard.ts +2 -4
- package/src/model/constraints.ts +13 -4
- package/src/model/demo.ts +3 -3
- package/src/model/elevation.ts +6 -16
- package/src/model/faces.ts +153 -0
- package/src/model/facesolve.ts +322 -0
- package/src/model/history.ts +19 -11
- package/src/model/images.ts +35 -0
- package/src/model/links.ts +77 -0
- package/src/model/markup.ts +80 -0
- package/src/model/measurement.ts +26 -0
- package/src/model/openings.ts +6 -0
- package/src/model/planGeom.ts +174 -8
- package/src/model/project.ts +3 -2
- package/src/model/projectfile.ts +2 -1
- package/src/model/rooms.ts +1 -1
- package/src/model/settings.ts +8 -2
- package/src/model/sketch.ts +101 -14
- package/src/model/smooth.ts +51 -0
- package/src/model/store.ts +35 -4
- package/src/model/types.ts +170 -8
- package/src/model/wallfaces.ts +126 -17
- package/src/model/wallshape.ts +97 -0
- package/src/react/BottomBar.tsx +263 -46
- package/src/react/Buttons.tsx +50 -9
- package/src/react/CadEditor.tsx +142 -34
- package/src/react/ConfirmSheet.tsx +38 -0
- package/src/react/ConflictSheet.tsx +19 -12
- package/src/react/Drawer.tsx +213 -110
- package/src/react/Duck.tsx +50 -0
- package/src/react/Empty3D.tsx +32 -0
- package/src/react/FitScroll.tsx +19 -0
- package/src/react/Icon.native.tsx +5 -0
- package/src/react/Icon.web.tsx +5 -0
- package/src/react/KeypadSheet.tsx +253 -60
- package/src/react/LaserTray.tsx +12 -8
- package/src/react/MarkupPanel.tsx +150 -0
- package/src/react/PageThumb.native.tsx +18 -7
- package/src/react/PageThumb.web.tsx +4 -4
- package/src/react/PlanCanvas.native.tsx +151 -34
- package/src/react/PlanCanvas.web.tsx +15 -5
- package/src/react/Popovers.tsx +116 -51
- package/src/react/Rail.tsx +360 -27
- package/src/react/ShapeMenu.tsx +66 -0
- package/src/react/Sheet.tsx +56 -11
- package/src/react/Slider.tsx +48 -0
- package/src/react/Toast.tsx +16 -9
- package/src/react/ToolTip.tsx +49 -0
- package/src/react/TopBar.tsx +97 -39
- package/src/react/Tween.native.tsx +36 -0
- package/src/react/Tween.tsx +24 -0
- package/src/react/View3D.native.tsx +131 -0
- package/src/react/View3D.web.tsx +131 -0
- package/src/react/View3DHost.ts +367 -0
- package/src/react/corners.ts +52 -0
- package/src/react/easing.ts +14 -0
- package/src/react/host.ts +8 -3
- package/src/react/hostKeypad.ts +66 -0
- package/src/react/motion.tsx +239 -0
- package/src/react/ports.ts +78 -9
- package/src/react/saving.ts +80 -0
- package/src/react/store.ts +35 -3
- package/src/react/theme.ts +8 -0
- package/src/react/topRow.ts +71 -0
- package/src/react/touch.ts +10 -0
- package/src/render/ctx.ts +8 -0
- package/src/render/draw.ts +437 -175
- package/src/render/elevation.ts +349 -143
- package/src/render/figmaIcons.ts +22 -0
- package/src/render/hit.ts +140 -21
- package/src/render/icons.ts +69 -10
- package/src/render/linkTile.ts +297 -0
- package/src/render/markup.ts +91 -0
- package/src/render/navigate.ts +114 -0
- package/src/render/snap.ts +105 -22
- package/src/render/squircle.ts +73 -0
- package/src/render/view.ts +255 -19
- package/src/skia/SkiaDrawCtx.ts +163 -41
- package/src/skia/host.ts +46 -1
- package/src/solver/equations.ts +37 -2
- package/src/solver/gauss-newton.ts +125 -28
- package/src/solver/linalg.ts +141 -5
- package/src/solver/types.ts +5 -0
- package/src/styles.css +91 -42
- package/src/tools/annotate.ts +58 -29
- package/src/tools/chamfer.ts +103 -0
- package/src/tools/corner.ts +99 -0
- package/src/tools/dim.ts +525 -93
- package/src/tools/elevation.ts +5 -5
- package/src/tools/fillet.ts +82 -0
- package/src/tools/freehand.ts +20 -16
- package/src/tools/index.ts +17 -4
- package/src/tools/line.ts +59 -23
- package/src/tools/modify.ts +86 -24
- package/src/tools/openings.ts +11 -16
- package/src/tools/registry.ts +27 -2
- package/src/tools/select.ts +424 -75
- package/src/tools/shapes.ts +119 -58
- package/src/ui/ctx.ts +2 -1
- package/src/ui/domPorts.ts +23 -4
- package/src/ui/drawer.ts +6 -26
- package/src/ui/elevation.ts +10 -101
- package/src/ui/keypad.ts +8 -14
- package/src/ui/laser.ts +2 -2
- package/src/ui/menu.ts +63 -17
- package/src/ui/noteinput.ts +3 -3
- package/src/ui/opacity.ts +108 -0
- package/src/ui/palette.ts +67 -12
- package/src/ui/rail.ts +21 -7
- package/src/ui/topbar.ts +4 -14
- package/src/units/format.ts +24 -6
- package/src/units/parse.ts +4 -3
- package/src/units/prefs.ts +13 -1
- package/src/view3d/build.ts +607 -0
- package/src/view3d/camera.ts +113 -0
- package/src/view3d/fatLines.ts +83 -0
- package/src/view3d/lines.ts +258 -0
- package/src/view3d/mesh.ts +111 -0
- package/src/view3d/poly.ts +104 -0
- package/src/view3d/viewer.ts +348 -0
- package/dist/react/ElevCanvas.native.d.ts +0 -3
- package/dist/react/ElevCanvas.native.js +0 -58
- package/dist/react/ElevCanvas.native.js.map +0 -1
- package/dist/react/ElevCanvas.web.d.ts +0 -4
- package/dist/react/ElevCanvas.web.js +0 -44
- package/dist/react/ElevCanvas.web.js.map +0 -1
- package/dist/react/ElevationSheet.d.ts +0 -2
- package/dist/react/ElevationSheet.js +0 -38
- package/dist/react/ElevationSheet.js.map +0 -1
- package/dist/render/elevationView.d.ts +0 -3
- package/dist/render/elevationView.js +0 -100
- package/dist/render/elevationView.js.map +0 -1
- package/src/react/ElevCanvas.native.tsx +0 -68
- package/src/react/ElevCanvas.web.tsx +0 -42
- package/src/react/ElevationSheet.tsx +0 -88
- package/src/render/elevationView.ts +0 -73
|
@@ -1,98 +1,291 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useRef, useState, type ReactNode } from 'react';
|
|
2
|
+
import { FlatList, ScrollView, Text, View } from 'react-native';
|
|
3
|
+
import {
|
|
4
|
+
hostPicksMeasurements, measurementFits, offersJobMeasurements, pickJobMeasurement, watchJobMeasurements, type MeasurementKind,
|
|
5
|
+
} from '../editor/links';
|
|
6
|
+
import { fromUm, linkKey } from '../model/links';
|
|
7
|
+
import type { LinkTarget } from '../model/types';
|
|
8
|
+
import { fmtAng, fmtLen } from '../units';
|
|
3
9
|
import {
|
|
4
10
|
FRACTIONS, fractionRowShown, fractionText, keyLayout, keypadApply, keypadBackspace, keypadFresh, keypadInsert, keypadPreview,
|
|
5
|
-
|
|
11
|
+
keypadSpec, keypadText, keySpan, parenText,
|
|
6
12
|
} from '../editor/keypad';
|
|
7
|
-
import {
|
|
13
|
+
import { FitScroll } from './FitScroll';
|
|
14
|
+
import type { MeasurementList, MeasurementListPage } from './hostKeypad';
|
|
8
15
|
import { Icon } from './Icon';
|
|
9
16
|
import { reactPorts } from './ports';
|
|
10
|
-
import {
|
|
17
|
+
import { editorVersion, useEditorKey } from './store';
|
|
18
|
+
import { Sheet, useSheetMotion } from './Sheet';
|
|
11
19
|
import { C, FONT } from './theme';
|
|
20
|
+
import { Tap } from './motion';
|
|
21
|
+
import { createSheet } from './corners';
|
|
22
|
+
import { touchUI } from './touch';
|
|
12
23
|
|
|
13
24
|
const refresh = () => reactPorts.refresh('keypad');
|
|
14
25
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
26
|
+
|
|
27
|
+
/** The keys in rows of four columns (a wide key takes more). */
|
|
28
|
+
function rows(keys: string[], numeric?: boolean): string[][] {
|
|
29
|
+
const out: string[][] = [];
|
|
30
|
+
let row: string[] = [], n = 0;
|
|
31
|
+
for (const k of keys) {
|
|
32
|
+
row.push(k); n += keySpan(k, numeric);
|
|
33
|
+
if (n >= 4) { out.push(row); row = []; n = 0; }
|
|
34
|
+
}
|
|
35
|
+
if (row.length) out.push(row);
|
|
36
|
+
return out;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The fraction keypad (BOLDR's measurement keypad): the title with a close ✕, the value in a dark well, slate keys
|
|
41
|
+
* (digits; unit and symbol keys lighter; Del red), and a full-width Apply. Its state and rules are in editor/keypad.ts.
|
|
42
|
+
* No system keyboard.
|
|
43
|
+
*/
|
|
44
|
+
export function KeypadSheet({ wide, open, measurementList }: { wide: boolean; open: boolean; measurementList?: MeasurementList }) {
|
|
45
|
+
// (it follows every change while a value is typed)
|
|
46
|
+
useEditorKey(() => (open ? String(editorVersion()) : ''));
|
|
47
|
+
const spec = open ? keypadSpec() : null, shown = !!spec;
|
|
48
|
+
// in from the side (a phone: up from the bottom), and out again; what it showed last stays on it as it goes
|
|
49
|
+
const last = useRef<ReactNode>(null), { present, motion } = useSheetMotion(shown, wide);
|
|
50
|
+
if (!spec) {
|
|
51
|
+
if (!present || !last.current) return null;
|
|
52
|
+
return <Sheet wide={wide} label="Enter a value" motion={motion} live={false}>{last.current}</Sheet>;
|
|
53
|
+
}
|
|
54
|
+
last.current = <KeypadBody spec={spec} wide={wide} measurementList={measurementList} />;
|
|
55
|
+
return <Sheet wide={wide} label="Enter a value" testID="kp" motion={motion}>{last.current}</Sheet>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** How the keypad shows the job's measurements: a page to swipe to (or show, from Select from list). */
|
|
59
|
+
interface PagerHandle { show(page: number): void }
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* What's in the keypad: the title and ✕, the value, the extras and fractions, the keys, Apply — and, for a line's length
|
|
63
|
+
* or a dimension's angle, the job's measurements: a page to its right on a touch screen (swiped to, as BOLDR's own keypads
|
|
64
|
+
* do), Select from list on a desktop (the host's side drawer, or that page). It scrolls only where the screen's too short
|
|
65
|
+
* to hold it all (a small phone, a short window).
|
|
66
|
+
*/
|
|
67
|
+
function KeypadBody({ spec, wide, measurementList }: { spec: NonNullable<ReturnType<typeof keypadSpec>>; wide: boolean; measurementList?: MeasurementList }) {
|
|
68
|
+
const list = spec.measurements && offersJobMeasurements() ? spec.measurements : null;
|
|
69
|
+
const pager = useRef<PagerHandle | null>(null);
|
|
70
|
+
// a touch screen swipes to the keypad's own page of them; a desktop has Select from list — the host's side drawer,
|
|
71
|
+
// or (a host without one) that page
|
|
72
|
+
const touch = touchUI(), hostList = hostPicksMeasurements();
|
|
73
|
+
// (only into this keypad, while it's the one open: a host's list may answer late. The same function for as long as
|
|
74
|
+
// it's open, so a list the host draws needn't be drawn again as keys are typed.)
|
|
75
|
+
const pick = useCallback((t: LinkTarget) => { if (keypadSpec() === spec) spec.measurements?.pick(t); }, [spec]);
|
|
76
|
+
const selectFromList = list && !touch ? () => {
|
|
77
|
+
if (!hostList) { pager.current?.show(1); return; }
|
|
78
|
+
void pickJobMeasurement(list.kind).then(t => { if (t) pick(t); });
|
|
79
|
+
} : undefined;
|
|
80
|
+
const keys = <Keys spec={spec} wide={wide} selectFromList={selectFromList} />;
|
|
81
|
+
return (
|
|
82
|
+
<FitScroll>
|
|
83
|
+
{list && (touch || !hostList) ? <Pager ref={pager} kind={list.kind} pick={pick} measurementList={measurementList}>{keys}</Pager> : keys}
|
|
84
|
+
</FitScroll>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** The keypad's own page: its title and ✕ (and Select from list), the value, the choices and fractions, the keys, Apply. */
|
|
89
|
+
function Keys({ spec, wide, selectFromList }: { spec: NonNullable<ReturnType<typeof keypadSpec>>; wide: boolean; selectFromList?: () => void }) {
|
|
19
90
|
const text = keypadText(), prev = keypadPreview(), fresh = keypadFresh();
|
|
20
91
|
const type = (t: string) => { keypadInsert(t); refresh(); };
|
|
21
92
|
return (
|
|
22
|
-
|
|
23
|
-
<View style={s.
|
|
24
|
-
<
|
|
25
|
-
|
|
93
|
+
<>
|
|
94
|
+
<View style={s.head}>
|
|
95
|
+
<Tap accessibilityRole="button" accessibilityLabel="Cancel" testID="kpCancel" hitSlop={10} onPress={() => reactPorts.closeKeypad()} style={s.close}>
|
|
96
|
+
<Icon name="close" size={16} />
|
|
97
|
+
</Tap>
|
|
98
|
+
{/* (what it measures — a wall's inside edge, a driving dimension — isn't written beside the title: the choices
|
|
99
|
+
under the value say it. On a device a screen reader hears it after the title.) */}
|
|
100
|
+
<Text style={s.titleText} testID="kpTitle" numberOfLines={1} accessibilityHint={spec.sub || undefined}>{spec.title}</Text>
|
|
101
|
+
{selectFromList && (
|
|
102
|
+
<Tap accessibilityRole="button" accessibilityLabel="Select from list" testID="kpSelectList" onPress={selectFromList} style={s.selectList}>
|
|
103
|
+
<Text style={s.selectListText}>Select from list</Text>
|
|
104
|
+
</Tap>
|
|
105
|
+
)}
|
|
26
106
|
</View>
|
|
27
|
-
<View style={s.display}>
|
|
28
|
-
<Text style={[s.value, !text && { color: 'rgba(255,255,255,0.
|
|
29
|
-
<Text style={[s.prev, prev.bad && { color:
|
|
107
|
+
<View style={[s.display, !wide && s.displayPhone]}>
|
|
108
|
+
<Text style={[s.value, !wide && { fontSize: 30 }, !text && { color: 'rgba(255,255,255,0.4)' }, fresh && !!text && s.selected]} testID="kpIn" numberOfLines={1}>{text || '0'}</Text>
|
|
109
|
+
<Text style={[s.prev, prev.bad && { color: C.softRed }]} testID="kpPrev">{prev.text}</Text>
|
|
30
110
|
</View>
|
|
31
111
|
{spec.extras && (
|
|
112
|
+
// (the choices share the keypad's width: Figma 2639:93162)
|
|
32
113
|
<View style={s.extras}>
|
|
33
114
|
{spec.extras().map(x => (
|
|
34
|
-
<
|
|
35
|
-
style={[s.extra, x.on && { backgroundColor: '#fff' }]}>
|
|
36
|
-
<Text style={[s.extraText, x.on && { color: C.dark }, x.danger && { color: C.
|
|
37
|
-
</
|
|
115
|
+
<Tap key={x.label} accessibilityRole="button" accessibilityLabel={x.ariaLabel ?? x.label} onPress={() => { x.onPress(); refresh(); }}
|
|
116
|
+
style={[s.extra, x.on && { backgroundColor: '#fff', borderColor: '#fff' }]}>
|
|
117
|
+
<Text style={[s.extraText, x.on && { color: C.dark }, x.danger && { color: C.mutedRed }]} numberOfLines={1}>{x.label}</Text>
|
|
118
|
+
</Tap>
|
|
38
119
|
))}
|
|
39
120
|
</View>
|
|
40
121
|
)}
|
|
41
122
|
{fractionRowShown() && (
|
|
42
123
|
<View style={s.fr}>
|
|
43
124
|
{FRACTIONS.map(f => (
|
|
44
|
-
<
|
|
125
|
+
<Tap key={f} accessibilityRole="button" accessibilityLabel={f} onPress={() => type(fractionText(f))}
|
|
126
|
+
style={[s.frKey]}>
|
|
45
127
|
<Text style={s.frText}>{f}</Text>
|
|
46
|
-
</
|
|
128
|
+
</Tap>
|
|
47
129
|
))}
|
|
48
130
|
</View>
|
|
49
131
|
)}
|
|
50
132
|
<View style={s.keys}>
|
|
51
|
-
{keyLayout(spec.numeric).map(k => {
|
|
52
|
-
|
|
53
|
-
if (k === 'laser') {
|
|
54
|
-
const off = !laser.on || spec.laser === false;
|
|
133
|
+
{rows(keyLayout(spec.numeric), spec.numeric).map((row, r) => <View key={r} style={s.row}>{row.map(k => {
|
|
134
|
+
if (k === '⌫') {
|
|
55
135
|
return (
|
|
56
|
-
<
|
|
57
|
-
|
|
58
|
-
<
|
|
59
|
-
</
|
|
136
|
+
<Tap key={k} accessibilityRole="button" accessibilityLabel="Backspace" onPress={() => { keypadBackspace(); refresh(); }}
|
|
137
|
+
style={[s.key, !wide && s.keyPhone, s.del]}>
|
|
138
|
+
<Text style={s.delText}>Del</Text>
|
|
139
|
+
</Tap>
|
|
60
140
|
);
|
|
61
141
|
}
|
|
62
|
-
|
|
142
|
+
// digits slate; units and symbols a lighter slate
|
|
143
|
+
const sym = !/^\d$/.test(k), press = k === '( )' ? () => type(parenText()) : () => type(k);
|
|
63
144
|
return (
|
|
64
|
-
<
|
|
65
|
-
style={
|
|
66
|
-
<Text style={[s.keyText,
|
|
67
|
-
</
|
|
145
|
+
<Tap key={k} accessibilityRole="button" accessibilityLabel={k} onPress={press}
|
|
146
|
+
style={[s.key, !wide && s.keyPhone, sym && s.sym, keySpan(k, spec.numeric) === 3 && s.wide]}>
|
|
147
|
+
<Text style={[s.keyText, k === '.' && { fontWeight: '400' }]}>{k}</Text>
|
|
148
|
+
</Tap>
|
|
68
149
|
);
|
|
69
|
-
})}
|
|
150
|
+
})}</View>)}
|
|
70
151
|
</View>
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
<
|
|
74
|
-
</
|
|
75
|
-
|
|
152
|
+
<Tap accessibilityRole="button" accessibilityLabel="Apply" testID="kpDone" onPress={keypadApply}
|
|
153
|
+
style={[s.apply]}>
|
|
154
|
+
<Text style={s.applyText}>Apply</Text>
|
|
155
|
+
</Tap>
|
|
156
|
+
</>
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* The keys, and the job's measurements a page to their right — as BOLDR's own keypads have them (Skia annotation's plane
|
|
162
|
+
* dimension, MeasurementEntry): swiped between, with dots under them for the page it's on. The list's page is the keys'
|
|
163
|
+
* height, and is made only once it's first swiped toward (or shown): a keypad opened just to type asks the host for nothing.
|
|
164
|
+
* It's the host's list when it draws one (measurementList), and the editor's grid when it doesn't.
|
|
165
|
+
*/
|
|
166
|
+
const Pager = forwardRef<PagerHandle, { kind: MeasurementKind; pick: (t: LinkTarget) => void; measurementList?: MeasurementList; children: ReactNode }>(function Pager({ kind, pick, measurementList, children }, ref) {
|
|
167
|
+
const scroll = useRef<ScrollView>(null);
|
|
168
|
+
const [w, setW] = useState(0), [h, setH] = useState(0), [page, setPage] = useState(0), [listed, setListed] = useState(false);
|
|
169
|
+
const show = (p: number) => { if (p) setListed(true); scroll.current?.scrollTo({ x: p * w, animated: true }); };
|
|
170
|
+
useImperativeHandle(ref, () => ({ show }));
|
|
171
|
+
return (
|
|
172
|
+
<View onLayout={e => setW(Math.round(e.nativeEvent.layout.width))}>
|
|
173
|
+
{!w ? children : (
|
|
174
|
+
<>
|
|
175
|
+
<ScrollView ref={scroll} horizontal pagingEnabled showsHorizontalScrollIndicator={false} bounces={false} scrollEventThrottle={16}
|
|
176
|
+
onScroll={e => {
|
|
177
|
+
const x = e.nativeEvent.contentOffset.x;
|
|
178
|
+
if (x > 1 && !listed) setListed(true);
|
|
179
|
+
setPage(Math.round(x / w));
|
|
180
|
+
}}>
|
|
181
|
+
<View style={{ width: w }} onLayout={e => setH(e.nativeEvent.layout.height)}>{children}</View>
|
|
182
|
+
<View style={{ width: w, height: h }} testID="kpList">
|
|
183
|
+
{listed && (measurementList
|
|
184
|
+
? <HostList render={measurementList} kind={kind} pick={pick} width={w} height={h} />
|
|
185
|
+
: <MeasurementPage kind={kind} pick={pick} width={w} />)}
|
|
186
|
+
</View>
|
|
187
|
+
</ScrollView>
|
|
188
|
+
<View style={s.dots}>
|
|
189
|
+
{[0, 1].map(i => (
|
|
190
|
+
<Tap key={i} accessibilityRole="button" accessibilityLabel={i ? 'The job’s measurements' : 'The keys'} accessibilityState={{ selected: page === i }} aria-selected={page === i}
|
|
191
|
+
testID={'kpPage' + i} hitSlop={8} onPress={() => show(i)} style={[s.dot, page === i && s.dotOn]} />
|
|
192
|
+
))}
|
|
193
|
+
</View>
|
|
194
|
+
</>
|
|
195
|
+
)}
|
|
196
|
+
</View>
|
|
197
|
+
);
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* The host's own list on that page (measurementList), as a component of its own: whatever hooks the host's function
|
|
202
|
+
* uses belong to it rather than to the Pager (which mounts it only once swiped toward), and it's drawn again only when
|
|
203
|
+
* what it's given changes — not with every key typed.
|
|
204
|
+
*/
|
|
205
|
+
const HostList = memo(function HostList({ render, ...page }: MeasurementListPage & { render: MeasurementList }) {
|
|
206
|
+
return <>{render(page)}</>;
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
/** A measurement tile on the list's page: its width, the gap between, and how many to a row. */
|
|
210
|
+
const LIST_COLS = 3, LIST_GAP = 7, LIST_TILE_H = 70;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* The job's measurements (as the host lists them: CadLinks.measurements), those of the keypad's kind to pick — one
|
|
214
|
+
* picked sets the value from it, linked to it — and the others greyed out (a tap on one says why). Only what's in
|
|
215
|
+
* view is made: a job can have hundreds. For a host that doesn't draw its own list (measurementList).
|
|
216
|
+
*/
|
|
217
|
+
function MeasurementPage({ kind, pick, width }: { kind: MeasurementKind; pick: (t: LinkTarget) => void; width: number }) {
|
|
218
|
+
const [list, setList] = useState<LinkTarget[] | null>(null);
|
|
219
|
+
useEffect(() => watchJobMeasurements(setList), []);
|
|
220
|
+
const tileW = Math.floor((width - (LIST_COLS - 1) * LIST_GAP) / LIST_COLS);
|
|
221
|
+
return (
|
|
222
|
+
<View style={{ flex: 1 }}>
|
|
223
|
+
<Text style={s.listTitle}>Measurements in the job</Text>
|
|
224
|
+
{/* (nothing until the host has said: not "none" while it's still looking) */}
|
|
225
|
+
{list?.length === 0 && <Text style={s.listNone}>None in the job yet. Measure one with a connected tool, or type a value in.</Text>}
|
|
226
|
+
{!!list?.length && (
|
|
227
|
+
<FlatList data={list} numColumns={LIST_COLS} keyExtractor={linkKey} showsVerticalScrollIndicator={false} initialNumToRender={12}
|
|
228
|
+
columnWrapperStyle={{ gap: LIST_GAP }} contentContainerStyle={{ gap: LIST_GAP, paddingBottom: 2 }}
|
|
229
|
+
renderItem={({ item: t }) => {
|
|
230
|
+
const ok = measurementFits(t, kind);
|
|
231
|
+
const value = t.text ?? (t.value == null ? '—' : t.mkind === 'angle' ? fmtAng(t.value) : fmtLen(fromUm(t.value)));
|
|
232
|
+
return (
|
|
233
|
+
<Tap accessibilityRole="button" accessibilityState={{ disabled: !ok }}
|
|
234
|
+
accessibilityLabel={(t.name ?? 'Measurement') + ', ' + value + (t.groupName ? ', ' + t.groupName : '')}
|
|
235
|
+
testID={'kpMeasure-' + t.id} onPress={() => pick(t)} style={[s.listTile, { width: tileW }, !ok && s.listTileOff]}>
|
|
236
|
+
<Text style={s.listValue} numberOfLines={1}>{value}</Text>
|
|
237
|
+
<View>
|
|
238
|
+
<Text style={s.listName} numberOfLines={1}>{t.name ?? 'Measurement'}</Text>
|
|
239
|
+
{t.groupName ? <Text style={s.listGroup} numberOfLines={1}>{t.groupName}</Text> : null}
|
|
240
|
+
</View>
|
|
241
|
+
</Tap>
|
|
242
|
+
);
|
|
243
|
+
}} />
|
|
244
|
+
)}
|
|
245
|
+
</View>
|
|
76
246
|
);
|
|
77
247
|
}
|
|
78
248
|
|
|
79
|
-
const s =
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
249
|
+
const s = createSheet({
|
|
250
|
+
head: { flexDirection: 'row', alignItems: 'center', gap: 12, marginBottom: 12, minHeight: 30 },
|
|
251
|
+
close: { width: 20, height: 20, alignItems: 'center', justifyContent: 'center' },
|
|
252
|
+
titleText: { fontFamily: FONT, fontSize: 16, fontWeight: '600', color: '#fff', flex: 1 },
|
|
253
|
+
// Select from list: a yellow chip in the header's corner (Figma 2639:93162)
|
|
254
|
+
selectList: { height: 30, paddingHorizontal: 10.5, borderRadius: 7, backgroundColor: C.yellow, justifyContent: 'center' },
|
|
255
|
+
selectListText: { fontFamily: FONT, fontSize: 13, fontWeight: '500', color: C.dark },
|
|
256
|
+
display: { backgroundColor: C.dark, borderRadius: 12, minHeight: 80, alignItems: 'center', justifyContent: 'center', paddingVertical: 8, paddingHorizontal: 12, marginBottom: 12 },
|
|
257
|
+
value: { fontFamily: FONT, fontSize: 34, fontWeight: '700', color: '#fff', letterSpacing: -0.3, paddingHorizontal: 6, borderRadius: 6 },
|
|
258
|
+
selected: { backgroundColor: 'rgba(255,255,255,0.18)' },
|
|
259
|
+
prev: { fontFamily: FONT, fontSize: 13, color: C.lg1, minHeight: 16, fontWeight: '500', marginTop: 2 },
|
|
260
|
+
extras: { flexDirection: 'row', gap: 6, marginBottom: 10 },
|
|
261
|
+
extra: { flex: 1, minWidth: 0, height: 30, paddingHorizontal: 6, borderRadius: 7, backgroundColor: C.dark, borderWidth: 0.5, borderColor: C.g3, alignItems: 'center', justifyContent: 'center' },
|
|
262
|
+
extraText: { fontFamily: FONT, fontSize: 13, fontWeight: '500', color: '#fff' },
|
|
263
|
+
fr: { flexDirection: 'row', gap: 5, marginBottom: 7 },
|
|
264
|
+
frKey: { flex: 1, height: 32, borderRadius: 7, backgroundColor: C.key2, alignItems: 'center', justifyContent: 'center' },
|
|
265
|
+
frText: { fontFamily: FONT, fontSize: 12, fontWeight: '600', color: '#fff' },
|
|
266
|
+
keys: { gap: 7, marginBottom: 12 },
|
|
267
|
+
row: { flexDirection: 'row', gap: 7 },
|
|
268
|
+
key: { flexGrow: 1, flexBasis: 0, height: 50, borderRadius: 8, backgroundColor: C.key, alignItems: 'center', justifyContent: 'center', flexDirection: 'row', gap: 5 },
|
|
269
|
+
wide: { flexGrow: 3, flexBasis: 14 }, // three columns and the two gaps between them
|
|
270
|
+
// a phone's bottom sheet: a little more compact, to fit small screens
|
|
271
|
+
displayPhone: { minHeight: 70, marginBottom: 10 },
|
|
272
|
+
keyPhone: { height: 46 },
|
|
273
|
+
sym: { backgroundColor: C.key2 },
|
|
274
|
+
del: { backgroundColor: C.mutedRed },
|
|
275
|
+
keyText: { fontFamily: FONT, fontSize: 22, fontWeight: '700', color: '#fff' },
|
|
276
|
+
delText: { fontFamily: FONT, fontSize: 17, fontWeight: '500', color: '#fff' },
|
|
277
|
+
apply: { height: 46, borderRadius: 12, backgroundColor: C.yellow, alignItems: 'center', justifyContent: 'center' },
|
|
278
|
+
applyText: { fontFamily: FONT, fontSize: 16, fontWeight: '600', color: C.dark },
|
|
279
|
+
// the pages' dots: the one it's on yellow
|
|
280
|
+
dots: { flexDirection: 'row', justifyContent: 'center', gap: 8, marginTop: 10 },
|
|
281
|
+
dot: { width: 8, height: 8, borderRadius: 4, backgroundColor: C.g3 },
|
|
282
|
+
dotOn: { backgroundColor: C.yellow },
|
|
283
|
+
// the job's measurements: BOLDR's blue measurement tiles, three to a row
|
|
284
|
+
listTitle: { fontFamily: FONT, fontSize: 13, fontWeight: '600', color: '#fff', marginBottom: 10 },
|
|
285
|
+
listNone: { fontFamily: FONT, fontSize: 13, color: C.g4 },
|
|
286
|
+
listTile: { height: LIST_TILE_H, borderRadius: 10, backgroundColor: C.tile, paddingHorizontal: 9, paddingVertical: 7, justifyContent: 'space-between' },
|
|
287
|
+
listTileOff: { opacity: 0.4 },
|
|
288
|
+
listValue: { fontFamily: FONT, fontSize: 17, fontWeight: '700', color: '#fff' },
|
|
289
|
+
listName: { fontFamily: FONT, fontSize: 11, fontWeight: '600', color: '#fff' },
|
|
290
|
+
listGroup: { fontFamily: FONT, fontSize: 10, fontWeight: '500', color: C.lblue2 },
|
|
98
291
|
});
|
package/src/react/LaserTray.tsx
CHANGED
|
@@ -1,24 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Text, View } from 'react-native';
|
|
2
2
|
import { laser, useTrayReading } from '../editor/laser';
|
|
3
3
|
import { fmtLen } from '../units';
|
|
4
|
-
import { notify } from './store';
|
|
4
|
+
import { notify, useEditorKey } from './store';
|
|
5
5
|
import { C, FONT, shadow } from './theme';
|
|
6
|
+
import { Tap } from './motion';
|
|
7
|
+
import { createSheet } from './corners';
|
|
6
8
|
|
|
7
9
|
/** Readings that arrived with nothing to go to: tap one to put it on the selected line. */
|
|
8
10
|
export function LaserTray({ phone }: { phone: boolean }) {
|
|
11
|
+
useEditorKey(() => (laser.on ? [laser.external, ...laser.readings.map(r => r.id + ':' + fmtLen(r.v))].join('|') : ''));
|
|
9
12
|
if (!laser.on) return null;
|
|
10
13
|
return (
|
|
11
|
-
|
|
14
|
+
// (beside the rail on a tablet or computer, where the rail runs to the bottom of the screen)
|
|
15
|
+
<View style={[s.tray, phone ? { left: 12, bottom: 160 } : { left: 90, bottom: 92 }]} testID="tray">
|
|
12
16
|
<View style={s.head}>
|
|
13
17
|
<Text style={s.title}>Laser readings</Text>
|
|
14
|
-
{!laser.external && <
|
|
18
|
+
{!laser.external && <Tap accessibilityRole="button" onPress={() => { laser.on = false; laser.readings = []; notify(); }}><Text style={s.link}>Disconnect</Text></Tap>}
|
|
15
19
|
</View>
|
|
16
20
|
{laser.readings.length ? (
|
|
17
21
|
<View style={s.chips}>
|
|
18
22
|
{laser.readings.map(r => (
|
|
19
|
-
<
|
|
23
|
+
<Tap key={r.id} accessibilityRole="button" accessibilityLabel={'Reading ' + fmtLen(r.v) + '. Tap to put it on the selected line.'} onPress={() => useTrayReading(r.id)} style={s.chip}>
|
|
20
24
|
<Text style={s.chipText}>{fmtLen(r.v)}</Text>
|
|
21
|
-
</
|
|
25
|
+
</Tap>
|
|
22
26
|
))}
|
|
23
27
|
</View>
|
|
24
28
|
) : <Text style={s.help}>Select a wall and take a reading, or tap a reading here to put it on the selected line.</Text>}
|
|
@@ -26,8 +30,8 @@ export function LaserTray({ phone }: { phone: boolean }) {
|
|
|
26
30
|
);
|
|
27
31
|
}
|
|
28
32
|
|
|
29
|
-
const s =
|
|
30
|
-
tray: { position: 'absolute',
|
|
33
|
+
const s = createSheet({
|
|
34
|
+
tray: { position: 'absolute', zIndex: 23, backgroundColor: C.g1, borderRadius: 15, padding: 10, width: 250, ...shadow },
|
|
31
35
|
head: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', marginBottom: 8 },
|
|
32
36
|
title: { fontFamily: FONT, fontSize: 13, fontWeight: '600', color: C.lg2 },
|
|
33
37
|
link: { fontFamily: FONT, fontSize: 12, fontWeight: '600', color: C.lblue, padding: 4 },
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { Animated, Text, View } from 'react-native';
|
|
3
|
+
import { FitScroll } from './FitScroll';
|
|
4
|
+
import { ed } from '../app/state';
|
|
5
|
+
import {
|
|
6
|
+
markupTarget, NOTE_CAPS, NOTE_COLORS, NOTE_STYLES, NOTE_TEXT_SIZES, NOTE_WIDTHS, setNoteCap, setNoteColor, setNoteStyle, setNoteTextSize, setNoteWidth,
|
|
7
|
+
} from '../editor/markup';
|
|
8
|
+
import { fmtLen } from '../units';
|
|
9
|
+
import type { NoteStyle } from '../model/markup';
|
|
10
|
+
import type { NoteCap } from '../model/types';
|
|
11
|
+
import { Tap, usePopup } from './motion';
|
|
12
|
+
import { notify, ui, useEditorKey } from './store';
|
|
13
|
+
import { C, FONT, shadow } from './theme';
|
|
14
|
+
import { createSheet } from './corners';
|
|
15
|
+
|
|
16
|
+
const STYLE_LABEL: Record<NoteStyle, string> = { solid: 'Solid', dash: 'Dashed', dot: 'Dotted' };
|
|
17
|
+
const CAP_LABEL: Record<NoteCap, string> = { butt: 'Flat', round: 'Round', arrow: 'Arrow' };
|
|
18
|
+
|
|
19
|
+
/** A solid bar, three dashes or three dots. */
|
|
20
|
+
function StylePreview({ style }: { style: NoteStyle }) {
|
|
21
|
+
if (style === 'solid') return <View style={s.bar} />;
|
|
22
|
+
return (
|
|
23
|
+
<View style={s.previewRow}>
|
|
24
|
+
{[0, 1, 2].map(i => <View key={i} style={style === 'dash' ? s.dash : s.dot} />)}
|
|
25
|
+
</View>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** A flat bar, a rounded bar, or a shaft with an arrowhead (pointing back for the start). */
|
|
30
|
+
function CapPreview({ cap, start }: { cap: NoteCap; start?: boolean }) {
|
|
31
|
+
if (cap !== 'arrow') return <View style={[s.capBar, cap === 'round' && { borderRadius: 4 }]} />;
|
|
32
|
+
return (
|
|
33
|
+
<View style={[s.previewRow, { gap: 0 }, start && { flexDirection: 'row-reverse' }]}>
|
|
34
|
+
<View style={s.shaft} />
|
|
35
|
+
<View style={[s.head, start ? s.headLeft : s.headRight]} />
|
|
36
|
+
</View>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function Option({ label, on, onPress, tall, children }: { label: string; on: boolean; onPress: () => void; tall?: boolean; children: ReactNode }) {
|
|
41
|
+
return (
|
|
42
|
+
<Tap accessibilityRole="button" accessibilityLabel={label} accessibilityState={{ selected: on }} aria-pressed={on} onPress={() => { onPress(); notify(); }}
|
|
43
|
+
style={[s.opt, tall && s.optTall, on && s.optOn]}>
|
|
44
|
+
{children}
|
|
45
|
+
{tall ? <Text style={s.optText}>{label.replace(/^(Start|End): /, '')}</Text> : null}
|
|
46
|
+
</Tap>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The markup stroke panel, beside the rail (its color dot) — BOLDR's annotation set: color,
|
|
52
|
+
* width, solid / dashed / dotted, and the ends of a pen stroke or arrow. It changes the selected markup, or the look of
|
|
53
|
+
* the next markup drawn; it stays open while things are set, and closes on a tap on the drawing.
|
|
54
|
+
*/
|
|
55
|
+
export function MarkupPanel({ phone }: { phone: boolean }) {
|
|
56
|
+
useEditorKey(() => (ui.palette && ed.mode === 'annotate' ? JSON.stringify(markupTarget()) : ''));
|
|
57
|
+
// (it grows out from the rail, beside it)
|
|
58
|
+
const open = ui.palette && ed.mode === 'annotate', pop = usePopup(open, { x: -8 }, 'top left');
|
|
59
|
+
if (!pop.present) return null;
|
|
60
|
+
const t = markupTarget();
|
|
61
|
+
return (
|
|
62
|
+
<View style={[s.wrap, phone && { top: 162 }]} pointerEvents="box-none">
|
|
63
|
+
<Animated.View style={[s.panel, pop.style]} pointerEvents={open ? 'auto' : 'none'} testID={open ? 'palette' : undefined}>
|
|
64
|
+
<FitScroll contentContainerStyle={s.body}>
|
|
65
|
+
<Text style={s.label}>Color</Text>
|
|
66
|
+
<View style={s.swatches}>
|
|
67
|
+
{NOTE_COLORS.map(c => (
|
|
68
|
+
<Tap key={c} accessibilityRole="button" accessibilityLabel={'Color ' + c} accessibilityState={{ selected: c === t.color }} aria-pressed={c === t.color}
|
|
69
|
+
onPress={() => { setNoteColor(c); notify(); }}
|
|
70
|
+
style={[s.swatch, { backgroundColor: c }, c === t.color && s.swatchOn]} />
|
|
71
|
+
))}
|
|
72
|
+
</View>
|
|
73
|
+
{/* a note's letters, as tall on the drawing as this: they zoom with it */}
|
|
74
|
+
{t.textIn != null && (
|
|
75
|
+
<>
|
|
76
|
+
<Text style={s.label}>Text size</Text>
|
|
77
|
+
<View style={s.row}>
|
|
78
|
+
{NOTE_TEXT_SIZES.map(v => (
|
|
79
|
+
<Option key={v} label={'Text size ' + fmtLen(v)} on={Math.abs(t.textIn! - v) < 1e-6} onPress={() => setNoteTextSize(v)}>
|
|
80
|
+
<Text style={[s.sizeText, { fontSize: 9 + v }]}>A</Text>
|
|
81
|
+
</Option>
|
|
82
|
+
))}
|
|
83
|
+
</View>
|
|
84
|
+
</>
|
|
85
|
+
)}
|
|
86
|
+
{t.widthApplies && (
|
|
87
|
+
<>
|
|
88
|
+
<Text style={s.label}>Width</Text>
|
|
89
|
+
<View style={s.row}>
|
|
90
|
+
{NOTE_WIDTHS.map((w, i) => (
|
|
91
|
+
<Option key={w} label={'Width ' + w} on={t.width === w} onPress={() => setNoteWidth(w)}>
|
|
92
|
+
{/* the dots step by place, not value, so the thin end stays tellable apart */}
|
|
93
|
+
<View style={{ width: 4 + i * 2.5, height: 4 + i * 2.5, borderRadius: 10, backgroundColor: '#fff' }} />
|
|
94
|
+
</Option>
|
|
95
|
+
))}
|
|
96
|
+
</View>
|
|
97
|
+
</>
|
|
98
|
+
)}
|
|
99
|
+
<Text style={s.label}>Style</Text>
|
|
100
|
+
<View style={s.row}>
|
|
101
|
+
{NOTE_STYLES.map(st => (
|
|
102
|
+
<Option key={st} label={STYLE_LABEL[st]} tall on={t.style === st} onPress={() => setNoteStyle(st)}>
|
|
103
|
+
<StylePreview style={st} />
|
|
104
|
+
</Option>
|
|
105
|
+
))}
|
|
106
|
+
</View>
|
|
107
|
+
{t.ends && (['start', 'end'] as const).map(which => (
|
|
108
|
+
<View key={which} style={s.section}>
|
|
109
|
+
<Text style={s.label}>{which === 'start' ? 'Start' : 'End'}</Text>
|
|
110
|
+
<View style={s.row}>
|
|
111
|
+
{NOTE_CAPS.map(cap => (
|
|
112
|
+
<Option key={cap} label={(which === 'start' ? 'Start: ' : 'End: ') + CAP_LABEL[cap]} tall
|
|
113
|
+
on={(which === 'start' ? t.startCap : t.endCap) === cap} onPress={() => setNoteCap(which, cap)}>
|
|
114
|
+
<CapPreview cap={cap} start={which === 'start'} />
|
|
115
|
+
</Option>
|
|
116
|
+
))}
|
|
117
|
+
</View>
|
|
118
|
+
</View>
|
|
119
|
+
))}
|
|
120
|
+
</FitScroll>
|
|
121
|
+
</Animated.View>
|
|
122
|
+
</View>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const s = createSheet({
|
|
127
|
+
wrap: { position: 'absolute', left: 76, top: 112, bottom: 84, zIndex: 46, alignItems: 'flex-start' },
|
|
128
|
+
panel: { width: 264, maxHeight: '100%', backgroundColor: C.g1, borderRadius: 20, borderWidth: 1, borderColor: C.g2, ...shadow },
|
|
129
|
+
body: { padding: 12, gap: 8 },
|
|
130
|
+
section: { gap: 8 },
|
|
131
|
+
label: { fontFamily: FONT, fontSize: 11, fontWeight: '600', color: C.g4, textTransform: 'uppercase', letterSpacing: 0.5, marginTop: 2 },
|
|
132
|
+
swatches: { flexDirection: 'row', flexWrap: 'wrap', gap: 10 },
|
|
133
|
+
swatch: { width: 40, height: 32, borderRadius: 16, borderWidth: 2, borderColor: 'rgba(255,255,255,0.18)' },
|
|
134
|
+
swatchOn: { borderColor: '#fff', borderWidth: 3 },
|
|
135
|
+
row: { flexDirection: 'row', gap: 8, alignItems: 'center' },
|
|
136
|
+
opt: { flex: 1, height: 40, borderRadius: 12, alignItems: 'center', justifyContent: 'center', borderWidth: 1, borderColor: 'rgba(255,255,255,0.18)' },
|
|
137
|
+
optTall: { height: 48, gap: 5 },
|
|
138
|
+
optOn: { borderColor: '#fff', backgroundColor: C.blue },
|
|
139
|
+
sizeText: { fontFamily: FONT, fontWeight: '600', color: '#fff' },
|
|
140
|
+
optText: { fontFamily: FONT, fontSize: 10, fontWeight: '500', color: '#fff' },
|
|
141
|
+
bar: { width: 24, height: 5, backgroundColor: '#fff' },
|
|
142
|
+
previewRow: { flexDirection: 'row', alignItems: 'center', gap: 3 },
|
|
143
|
+
dash: { width: 6, height: 5, backgroundColor: '#fff' },
|
|
144
|
+
dot: { width: 5, height: 5, borderRadius: 3, backgroundColor: '#fff' },
|
|
145
|
+
capBar: { width: 22, height: 7, backgroundColor: '#fff' },
|
|
146
|
+
shaft: { width: 13, height: 5, backgroundColor: '#fff' },
|
|
147
|
+
head: { width: 0, height: 0, borderTopWidth: 6, borderBottomWidth: 6, borderTopColor: 'transparent', borderBottomColor: 'transparent' },
|
|
148
|
+
headRight: { borderLeftWidth: 9, borderLeftColor: '#fff' },
|
|
149
|
+
headLeft: { borderRightWidth: 9, borderRightColor: '#fff' },
|
|
150
|
+
});
|
|
@@ -1,18 +1,29 @@
|
|
|
1
1
|
import { Canvas, Picture } from '@shopify/react-native-skia';
|
|
2
|
-
import { useMemo, useState } from 'react';
|
|
2
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
3
3
|
import { View } from 'react-native';
|
|
4
4
|
import type { Page } from '../model/types';
|
|
5
5
|
import { paintThumb } from '../render/draw';
|
|
6
6
|
import { recordPicture } from '../skia/host';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
/** How long after an edit the page being drawn on has its thumbnail drawn again (not at each of a run of edits). */
|
|
9
|
+
const SETTLE_MS = 400;
|
|
9
10
|
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
/**
|
|
12
|
+
* A page's thumbnail in the project panel (recorded with Skia), `height` tall and as wide as its place. `version`: what
|
|
13
|
+
* it shows changed — drawn again once it has stopped changing for a moment, so drawing with the panel open (a tablet's
|
|
14
|
+
* stays open beside the drawing) doesn't draw the whole page a second time at every edit.
|
|
15
|
+
*/
|
|
16
|
+
export function PageThumb({ page, version, height: H = 84 }: { page: Page; version: number; height?: number }) {
|
|
17
|
+
const [w, setW] = useState(0), [shown, setShown] = useState(version);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (version === shown) return;
|
|
20
|
+
const t = setTimeout(() => setShown(version), SETTLE_MS);
|
|
21
|
+
return () => clearTimeout(t);
|
|
22
|
+
}, [version, shown]);
|
|
23
|
+
// (a page changed elsewhere and synced in has a new sketch: drawn again for that too)
|
|
24
|
+
const picture = useMemo(() => (w ? recordPicture(w, H, ctx => paintThumb(ctx, w, H, page)).picture : null), [page, page.sk, shown, w, H]);
|
|
14
25
|
return (
|
|
15
|
-
<View style={{ width: '100%', height: H,
|
|
26
|
+
<View style={{ width: '100%', height: H, overflow: 'hidden' }} onLayout={e => setW(e.nativeEvent.layout.width)}>
|
|
16
27
|
{picture && <Canvas style={{ flex: 1 }}><Picture picture={picture} /></Canvas>}
|
|
17
28
|
</View>
|
|
18
29
|
);
|
|
@@ -2,12 +2,12 @@ import { useEffect, useRef } from 'react';
|
|
|
2
2
|
import type { Page } from '../model/types';
|
|
3
3
|
import { drawThumb } from '../render/draw';
|
|
4
4
|
|
|
5
|
-
/** A page's thumbnail in the project panel (drawn with the browser canvas). */
|
|
6
|
-
export function PageThumb({ page, version }: { page: Page; version: number }) {
|
|
5
|
+
/** A page's thumbnail in the project panel (drawn with the browser canvas), `height` tall and as wide as its place. */
|
|
6
|
+
export function PageThumb({ page, version, height = 84 }: { page: Page; version: number; height?: number }) {
|
|
7
7
|
const ref = useRef<HTMLCanvasElement>(null);
|
|
8
8
|
useEffect(() => {
|
|
9
9
|
const id = requestAnimationFrame(() => { if (ref.current) drawThumb(ref.current, page); });
|
|
10
10
|
return () => cancelAnimationFrame(id);
|
|
11
|
-
}, [page, version]);
|
|
12
|
-
return <canvas ref={ref} style={{ width: '100%', height
|
|
11
|
+
}, [page, page.sk, version, height]);
|
|
12
|
+
return <canvas ref={ref} style={{ width: '100%', height, display: 'block' }} />;
|
|
13
13
|
}
|