@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.
- package/README.md +81 -9
- 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 +5 -0
- package/dist/data/memory.js +2 -2
- package/dist/data/memory.js.map +1 -1
- package/dist/data/provider.d.ts +19 -7
- package/dist/data/sync.d.ts +7 -2
- package/dist/data/sync.js +115 -64
- 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 +19 -4
- package/dist/editor/keypad.js +39 -9
- 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 +36 -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 +167 -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 +5 -0
- 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 +46 -3
- package/dist/react/CadEditor.js +77 -20
- 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 +581 -96
- package/dist/tools/dim.js.map +1 -1
- package/dist/tools/elevation.js +1 -1
- 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 +22 -15
- 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 +10 -2
- package/dist/units/format.js +18 -3
- package/dist/units/format.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 +2 -2
- package/src/data/provider.ts +15 -7
- package/src/data/sync.ts +87 -50
- 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 +43 -11
- 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 +37 -6
- package/src/editor/project.ts +155 -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 +5 -0
- 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 +133 -30
- 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 +524 -92
- package/src/tools/elevation.ts +1 -1
- 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 +8 -13
- 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 +18 -3
- 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
package/dist/react/CadEditor.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useRef, useState } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { useColorScheme, useWindowDimensions, View } from 'react-native';
|
|
4
4
|
import { analyze } from '../app/edit';
|
|
5
5
|
import { ed } from '../app/state';
|
|
6
6
|
import { setPorts } from '../editor/ports';
|
|
@@ -12,50 +12,73 @@ import { setLengthFormatter } from '../units';
|
|
|
12
12
|
import { CANVAS_THEMES, setCanvasTheme } from '../render/theme';
|
|
13
13
|
import { requestDraw, setImageResolver } from '../render/view';
|
|
14
14
|
import { registerTools } from '../tools';
|
|
15
|
-
import { BottomBar,
|
|
15
|
+
import { BottomBar, SpokenHint } from './BottomBar';
|
|
16
16
|
import { ConflictSheet } from './ConflictSheet';
|
|
17
|
+
import { ConfirmSheet } from './ConfirmSheet';
|
|
18
|
+
import { confirmCancel, confirmOpen } from '../editor/confirm';
|
|
17
19
|
import { Drawer } from './Drawer';
|
|
18
|
-
import {
|
|
20
|
+
import { Duck } from './Duck';
|
|
21
|
+
import { elevOpen } from '../editor/elevation';
|
|
19
22
|
import { LaserTray } from './LaserTray';
|
|
20
|
-
import {
|
|
23
|
+
import { MarkupPanel } from './MarkupPanel';
|
|
24
|
+
import { Menu, NoteInput } from './Popovers';
|
|
21
25
|
import { KeypadSheet } from './KeypadSheet';
|
|
22
26
|
import { PlanCanvas } from './PlanCanvas';
|
|
27
|
+
import { View3D } from './View3D';
|
|
28
|
+
import { Empty3D } from './Empty3D';
|
|
29
|
+
import { is3d } from '../editor/view3dState';
|
|
23
30
|
import { reactPorts, setFileSaver } from './ports';
|
|
24
31
|
import { editorHost } from './host';
|
|
32
|
+
import { checkChanges, startManualSave, stopManualSave } from './saving';
|
|
25
33
|
import { PAGE_LOCK_ROOT, usePageLock } from './pageLock';
|
|
26
34
|
import { setSkiaFonts } from '../skia/fonts';
|
|
27
35
|
import { pickImage as pickImageInBrowser } from './files';
|
|
28
|
-
import { placeUnderlay } from '../editor/project';
|
|
36
|
+
import { placeUnderlay, restoreUnits } from '../editor/project';
|
|
37
|
+
import { keypadSpec } from '../editor/keypad';
|
|
29
38
|
import { Backdrop } from './Sheet';
|
|
30
|
-
import {
|
|
39
|
+
import { useEditorKey, ui } from './store';
|
|
31
40
|
import { Toast } from './Toast';
|
|
32
41
|
import { ModeTabs, TopBar } from './TopBar';
|
|
42
|
+
import { ToolTip } from './ToolTip';
|
|
33
43
|
import { Rail } from './Rail';
|
|
44
|
+
import { setHostKeypad } from './hostKeypad';
|
|
45
|
+
import { setLinksHost } from '../editor/links';
|
|
46
|
+
import { ShapeMenu } from './ShapeMenu';
|
|
34
47
|
import { PHONE_MAX } from './theme';
|
|
48
|
+
import { createSheet } from './corners';
|
|
35
49
|
/**
|
|
36
50
|
* The layout editor as a React Native component: the plan canvas with its chrome. One per screen: mounting starts a
|
|
37
51
|
* new editing session (the drawing, tools and selection start fresh), unmounting saves.
|
|
38
52
|
*/
|
|
39
|
-
export function CadEditor({ onBack, headerRight, pickImage = pickImageInBrowser, theme: hostTheme, sync, units, devTools = true, readOnly = false, fonts, saveFile }) {
|
|
53
|
+
export function CadEditor({ onBack, headerRight, pickImage = pickImageInBrowser, pickTextFile, theme: hostTheme, sync, units, devTools = true, readOnly = false, fonts, saveFile, manualSave, onSaveState, keypad, links, measurementList }) {
|
|
40
54
|
const system = useColorScheme();
|
|
41
55
|
// start the session before the canvas mounts (children's effects run before this component's)
|
|
42
56
|
useState(() => {
|
|
43
57
|
setPorts(reactPorts);
|
|
44
58
|
resetSession();
|
|
45
|
-
|
|
59
|
+
const manual = !!(manualSave && sync && !readOnly);
|
|
60
|
+
// read-only saves nothing; manual saving only notes the edits until Save (see saving.ts)
|
|
61
|
+
setPersistence(sync
|
|
62
|
+
? (readOnly ? { load: sync.persistence.load, save: () => true }
|
|
63
|
+
: manual ? { load: sync.persistence.load, save: () => { checkChanges(); return true; } }
|
|
64
|
+
: sync.persistence)
|
|
65
|
+
: null);
|
|
46
66
|
if (units) {
|
|
47
67
|
settings.unit = units.metric ? 'mm' : 'ftin';
|
|
48
68
|
if (units.denom)
|
|
49
69
|
settings.denom = units.denom;
|
|
50
70
|
}
|
|
51
|
-
setLengthFormatter(units ? units.format : null);
|
|
71
|
+
setLengthFormatter(units ? units.format : null, { unit: settings.unit, denom: settings.denom });
|
|
52
72
|
setSkiaFonts(fonts ?? null);
|
|
53
73
|
setFileSaver(saveFile ?? null);
|
|
54
74
|
setImageResolver(sync?.imageUrl ?? null);
|
|
55
75
|
registerTools();
|
|
56
76
|
ed.readOnly = readOnly;
|
|
57
77
|
load();
|
|
78
|
+
restoreUnits(); // the units the person picked last time, over the host's
|
|
58
79
|
analyze();
|
|
80
|
+
if (manual)
|
|
81
|
+
startManualSave(sync, onSaveState ?? null);
|
|
59
82
|
return null;
|
|
60
83
|
});
|
|
61
84
|
const closing = useRef(undefined);
|
|
@@ -64,26 +87,60 @@ export function CadEditor({ onBack, headerRight, pickImage = pickImageInBrowser,
|
|
|
64
87
|
setPorts(reactPorts);
|
|
65
88
|
editorHost.open = true;
|
|
66
89
|
return () => {
|
|
67
|
-
|
|
68
|
-
if (
|
|
69
|
-
|
|
70
|
-
if (
|
|
71
|
-
|
|
90
|
+
// saving as they draw: the last edits and the preview go now. Saving manually: unsaved edits are dropped.
|
|
91
|
+
if (!manualSave) {
|
|
92
|
+
saveNow();
|
|
93
|
+
if (sync && !readOnly && store.project) {
|
|
94
|
+
const t = renderThumbnail(store.project.pages[0]);
|
|
95
|
+
if (t)
|
|
96
|
+
sync.saveThumbnail(t);
|
|
97
|
+
}
|
|
72
98
|
}
|
|
73
99
|
// React's StrictMode unmounts and remounts at once: only let go of the drawing if it stays unmounted
|
|
74
|
-
closing.current = setTimeout(() => { editorHost.open = false; sync?.stop(); setPersistence(null); setLengthFormatter(null); setFileSaver(null); setSkiaFonts(null); setImageResolver(null); setPorts(null); }, 0);
|
|
100
|
+
closing.current = setTimeout(() => { editorHost.open = false; sync?.stop(); setPersistence(null); setLengthFormatter(null); setFileSaver(null); setSkiaFonts(null); setImageResolver(null); stopManualSave(); setPorts(null); }, 0);
|
|
75
101
|
};
|
|
76
102
|
}, []);
|
|
77
|
-
|
|
103
|
+
// (only what this level decides: which sheets are open, the wall view, the theme — each part of the interface
|
|
104
|
+
// follows the editor itself, see useEditorKey)
|
|
105
|
+
useEditorKey(() => [ui.keypad, keypadSpec()?.modeless ?? '', !!ui.conflict, confirmOpen(), elevOpen(), is3d(), settings.theme].join('|'));
|
|
78
106
|
usePageLock();
|
|
79
107
|
const theme = hostTheme ?? (settings.theme === 'system' ? (system === 'dark' ? 'dark' : 'light') : settings.theme);
|
|
80
108
|
// the canvases read their colors when they draw: set them before this render's children draw
|
|
81
109
|
setCanvasTheme(theme);
|
|
82
110
|
useEffect(() => { requestDraw(); }, [theme]);
|
|
83
111
|
const { width } = useWindowDimensions(), phone = width < PHONE_MAX, wide = width >= 900;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
112
|
+
// (asked about once the drawing's loaded: what it links to)
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
setLinksHost(links ?? null);
|
|
115
|
+
return () => setLinksHost(null);
|
|
116
|
+
}, [links]);
|
|
117
|
+
// (a phone asks with the host's keypad, when it has one)
|
|
118
|
+
useEffect(() => {
|
|
119
|
+
setHostKeypad(phone && keypad ? keypad : null);
|
|
120
|
+
return () => setHostKeypad(null);
|
|
121
|
+
}, [phone, keypad]);
|
|
122
|
+
// (a modeless keypad leaves the drawing live: no backdrop. On a tablet or a computer the drawing stays in reach
|
|
123
|
+
// around a sheet too — it pans and zooms, and a tap on it (or the chrome over it) closes the sheet: see
|
|
124
|
+
// editor/gestures.ts sheetUp. A phone's sheet covers most of it: there a backdrop closes it.)
|
|
125
|
+
const sheet = (ui.keypad && !keypadSpec()?.modeless) || !!ui.conflict || confirmOpen(), threeD = is3d();
|
|
126
|
+
// the 3D view: made as its tab first opens and kept, hidden, while it's left — coming back, it's there at once (made
|
|
127
|
+
// again each time, its GL context, renderer and shaders were a pause every time). Let go after a while away: on a
|
|
128
|
+
// device it holds its GL buffers (a phone's screen, four times over for antialiasing).
|
|
129
|
+
const [kept3d, setKept3d] = useState(false);
|
|
130
|
+
useEffect(() => {
|
|
131
|
+
if (threeD) {
|
|
132
|
+
setKept3d(true);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (!kept3d)
|
|
136
|
+
return;
|
|
137
|
+
const t = setTimeout(() => setKept3d(false), KEEP_3D_MS);
|
|
138
|
+
return () => clearTimeout(t);
|
|
139
|
+
}, [threeD, kept3d]);
|
|
140
|
+
return (_jsxs(View, { nativeID: PAGE_LOCK_ROOT, style: [s.root, { backgroundColor: CANVAS_THEMES[theme].bg }], children: [_jsx(PlanCanvas, {}), (threeD || kept3d) && _jsx(View3D, { theme: theme, active: threeD }), threeD && _jsx(Empty3D, {}), _jsxs(Duck, { active: phone, held: sheet && !phone, children: [_jsx(TopBar, { onBack: onBack, headerRight: headerRight, phone: phone, readOnly: readOnly }), !readOnly && !elevOpen() && _jsx(ModeTabs, { phone: phone }), !readOnly && _jsx(ToolTip, { phone: phone }), _jsx(SpokenHint, {}), !readOnly && !threeD && _jsx(Rail, { phone: phone, onAddImage: () => { pickImage().then(img => { if (img)
|
|
141
|
+
placeUnderlay(img.dataUrl, img.w, img.h); }); } }), !readOnly && _jsx(BottomBar, { phone: phone }), !threeD && _jsx(LaserTray, { phone: phone }), !threeD && _jsx(MarkupPanel, { phone: phone })] }), !readOnly && !elevOpen() && !threeD && _jsx(ShapeMenu, {}), _jsx(NoteInput, {}), _jsx(Menu, { themeChoice: !hostTheme, accountUnits: !!units, devTools: devTools, pickText: pickTextFile, readOnly: readOnly, phone: phone }), _jsx(Drawer, { phone: phone }), _jsx(Toast, { phone: phone }), sheet && phone && _jsx(Backdrop, { wide: wide, onClose: () => (ui.keypad ? reactPorts.closeKeypad() : confirmOpen() ? confirmCancel() : reactPorts.dismissConflict()) }), _jsx(KeypadSheet, { wide: wide, open: ui.keypad, measurementList: measurementList }), _jsx(ConflictSheet, { wide: wide, open: !!ui.conflict && !ui.keypad }), _jsx(ConfirmSheet, { wide: wide })] }));
|
|
87
142
|
}
|
|
88
|
-
|
|
143
|
+
/** How long the 3D view is kept after its tab is left (ms). */
|
|
144
|
+
const KEEP_3D_MS = 60_000;
|
|
145
|
+
const s = createSheet({ root: { flex: 1, overflow: 'hidden' } });
|
|
89
146
|
//# sourceMappingURL=CadEditor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CadEditor.js","sourceRoot":"","sources":["../../src/react/CadEditor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"CadEditor.js","sourceRoot":"","sources":["../../src/react/CadEditor.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,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W,EAAE,CAAC,SAAS,EAAE,YAAY,EAAE,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,GAAI,EACtI,KAAC,MAAM,IAAC,KAAK,EAAE,KAAK,GAAI,EACxB,KAAC,KAAK,IAAC,KAAK,EAAE,KAAK,GAAI,EACtB,KAAK,IAAI,KAAK,IAAI,KAAC,QAAQ,IAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC,GAAI,EAEnK,KAAC,WAAW,IAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,MAAM,EAAE,eAAe,EAAE,eAAe,GAAI,EAC9E,KAAC,aAAa,IAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,QAAQ,IAAI,CAAC,EAAE,CAAC,MAAM,GAAI,EAChE,KAAC,YAAY,IAAC,IAAI,EAAE,IAAI,GAAI,IACvB,CACR,CAAC;AACJ,CAAC;AAED,+DAA+D;AAC/D,MAAM,UAAU,GAAG,MAAM,CAAC;AAE1B,MAAM,CAAC,GAAG,WAAW,CAAC,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
3
|
+
import { Text, View } from 'react-native';
|
|
4
|
+
import { confirmChoose, confirmSeq, confirmSpec } from '../editor/confirm';
|
|
5
|
+
import { Pill } from './Buttons';
|
|
6
|
+
import { Sheet, useSheetMotion } from './Sheet';
|
|
7
|
+
import { ui, useEditorKey } from './store';
|
|
8
|
+
import { C, FONT } from './theme';
|
|
9
|
+
import { createSheet } from './corners';
|
|
10
|
+
/** A question before the editor does something past the drawing (editor/confirm.ts): its choices, as pills. */
|
|
11
|
+
export function ConfirmSheet({ wide }) {
|
|
12
|
+
useEditorKey(() => (confirmSpec() ? String(confirmSeq()) : ''));
|
|
13
|
+
// in and out as the other sheets come and go, still saying what it said as it goes
|
|
14
|
+
const now = confirmSpec(), last = useRef(now), { present, motion } = useSheetMotion(!!now, wide);
|
|
15
|
+
if (now)
|
|
16
|
+
last.current = now;
|
|
17
|
+
// (taps on the backdrop just after it opens are the opening tap's ghost)
|
|
18
|
+
const seq = now ? confirmSeq() : 0;
|
|
19
|
+
useEffect(() => { if (seq)
|
|
20
|
+
ui.sheetOpenedAt = Date.now(); }, [seq]);
|
|
21
|
+
const c = last.current;
|
|
22
|
+
if (!present || !c)
|
|
23
|
+
return null;
|
|
24
|
+
return (_jsxs(Sheet, { wide: wide, label: c.title, testID: now ? 'confirm' : undefined, motion: motion, live: !!now, children: [_jsx(Text, { style: s.title, children: c.title }), c.msg ? _jsx(Text, { style: s.msg, children: c.msg }) : null, _jsx(View, { style: s.actions, children: c.choices.map((ch, i) => (_jsx(Pill, { label: ch.label, kind: ch.kind ?? (i === 0 ? 'yellow' : 'grey'), testID: 'confirm-' + i, onPress: () => confirmChoose(i) }, i + ch.label))) })] }));
|
|
25
|
+
}
|
|
26
|
+
const s = createSheet({
|
|
27
|
+
title: { fontFamily: FONT, fontSize: 18, fontWeight: '600', color: '#fff', marginBottom: 6 },
|
|
28
|
+
msg: { fontFamily: FONT, fontSize: 14, lineHeight: 20, color: C.lg1, marginBottom: 12 },
|
|
29
|
+
actions: { flexDirection: 'row', gap: 10, marginTop: 6, flexWrap: 'wrap' },
|
|
30
|
+
});
|
|
31
|
+
//# s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UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,EAAE;IAC5F,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,GAAG,EAAE,YAAY,EAAE,EAAE,EAAE;IACvF,OAAO,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE;CAC3E,CAAC,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** What fights a new constraint: the culprits, each with Remove; hovering a row highlights it on the drawing. */
|
|
2
|
-
export declare function ConflictSheet({ wide }: {
|
|
2
|
+
export declare function ConflictSheet({ wide, open }: {
|
|
3
3
|
wide: boolean;
|
|
4
|
+
open: boolean;
|
|
4
5
|
}): import("react").JSX.Element | null;
|
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import { Text, View } from 'react-native';
|
|
3
4
|
import { conflictHover, conflictRemove } from '../editor/conflict';
|
|
4
5
|
import { Pill } from './Buttons';
|
|
5
6
|
import { reactPorts } from './ports';
|
|
6
|
-
import { Sheet } from './Sheet';
|
|
7
|
-
import { ui } from './store';
|
|
7
|
+
import { Sheet, useSheetMotion } from './Sheet';
|
|
8
|
+
import { editorVersion, ui, useEditorKey } from './store';
|
|
8
9
|
import { C, FONT } from './theme';
|
|
10
|
+
import { Tap } from './motion';
|
|
11
|
+
import { createSheet } from './corners';
|
|
9
12
|
/** What fights a new constraint: the culprits, each with Remove; hovering a row highlights it on the drawing. */
|
|
10
|
-
export function ConflictSheet({ wide }) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
export function ConflictSheet({ wide, open }) {
|
|
14
|
+
useEditorKey(() => (open ? String(editorVersion()) : ''));
|
|
15
|
+
// in from the side (a phone: up from the bottom) as the keypad comes, and out again still saying what it said
|
|
16
|
+
const now = open ? ui.conflict : null, last = useRef(now), { present, motion } = useSheetMotion(!!now, wide);
|
|
17
|
+
if (now)
|
|
18
|
+
last.current = now;
|
|
19
|
+
const cf = last.current;
|
|
20
|
+
if (!present || !cf)
|
|
13
21
|
return null;
|
|
14
|
-
return (_jsxs(Sheet, { wide: wide, label: "Constraint conflict", testID:
|
|
22
|
+
return (_jsxs(Sheet, { wide: wide, label: "Constraint conflict", testID: now ? 'cf' : undefined, motion: motion, live: !!now, children: [_jsx(Text, { style: s.title, children: cf.spec.title }), _jsx(Text, { style: s.msg, children: cf.spec.msg }), cf.rows.length === 0 && _jsx(Text, { style: s.msg, children: "Try a different value, or undo the last step." }), cf.rows.map(r => (_jsxs(Tap, { feel: "dim", onHoverIn: () => conflictHover(r.id), onHoverOut: () => conflictHover(null), style: s.item, children: [_jsx(Text, { style: s.itemText, children: r.label }), _jsx(Tap, { accessibilityRole: "button", accessibilityLabel: 'Remove ' + r.label, onPress: () => conflictRemove(r.id), children: _jsx(Text, { style: s.remove, children: "Remove" }) })] }, r.id))), _jsx(View, { style: s.actions, children: _jsx(Pill, { label: "Keep the drawing as is", onPress: () => reactPorts.dismissConflict() }) })] }));
|
|
15
23
|
}
|
|
16
|
-
const s =
|
|
24
|
+
const s = createSheet({
|
|
17
25
|
title: { fontFamily: FONT, fontSize: 18, fontWeight: '600', color: '#fff', marginBottom: 6 },
|
|
18
26
|
msg: { fontFamily: FONT, fontSize: 14, lineHeight: 20, color: C.lg1, marginBottom: 12 },
|
|
19
27
|
item: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', gap: 10, backgroundColor: C.g2, borderRadius: 10, paddingVertical: 10, paddingHorizontal: 12, marginBottom: 8 },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConflictSheet.js","sourceRoot":"","sources":["../../src/react/ConflictSheet.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ConflictSheet.js","sourceRoot":"","sources":["../../src/react/ConflictSheet.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,iHAAiH;AACjH,MAAM,UAAU,aAAa,CAAC,EAAE,IAAI,EAAE,IAAI,EAAoC;IAC5E,YAAY,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1D,8GAA8G;IAC9G,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,cAAc,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC7G,IAAI,GAAG;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AE,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE;CAC3E,CAAC,CAAC"}
|
package/dist/react/Drawer.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The project panel: pages and the spaces schedule. On a tablet or computer it slides in from the right; on a phone
|
|
3
|
+
* it's a bottom sheet the way BOLDR's are (a grey-1 sheet with a grey-4 handle over a dimmed drawing, closed by a drag
|
|
4
|
+
* down or a tap outside). Either way it slides back out when closed.
|
|
5
|
+
*/
|
|
6
|
+
export declare function Drawer({ phone }: {
|
|
7
|
+
phone?: boolean;
|
|
8
|
+
}): import("react").JSX.Element | null;
|
package/dist/react/Drawer.js
CHANGED
|
@@ -1,23 +1,127 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useRef, useState } from 'react';
|
|
3
|
-
import { Pressable, ScrollView, StyleSheet,
|
|
4
|
-
import { addPage,
|
|
5
|
-
import {
|
|
2
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
import { Animated, Easing, Keyboard, PanResponder, Platform, Pressable, ScrollView, StyleSheet, Text, TextInput, useWindowDimensions, View, } from 'react-native';
|
|
4
|
+
import { addPage, deletePage, deletePending, duplicatePage, focusSpace, renamePage, renameSpace, spaceSchedule, switchPage, } from '../editor/project';
|
|
5
|
+
import { ed } from '../app/state';
|
|
6
6
|
import { page, store } from '../model/store';
|
|
7
7
|
import { fmtArea, fmtLen } from '../units';
|
|
8
|
-
import { Icon } from './Icon';
|
|
8
|
+
import { Icon, RawSvg } from './Icon';
|
|
9
|
+
import { PLUS_SIZE, PLUS_SVG, TRASH_SIZE, TRASH_SVG } from '../render/figmaIcons';
|
|
9
10
|
import { PageThumb } from './PageThumb';
|
|
10
11
|
import { notify, ui, useEditorVersion } from './store';
|
|
11
12
|
import { C, FONT } from './theme';
|
|
12
|
-
|
|
13
|
+
import { EASE, Segmented, Tap } from './motion';
|
|
14
|
+
import { NATIVE } from './easing';
|
|
15
|
+
import { createSheet } from './corners';
|
|
16
|
+
/**
|
|
17
|
+
* The Pages frame's sizes, scaled to the panel: Figma draws it 515 wide, the panel's content is about 370 (K). Its
|
|
18
|
+
* tiles are 180 tall there, with the name in a band at their foot below the drawing.
|
|
19
|
+
*/
|
|
20
|
+
const K = 0.72, TILE_H = Math.round(180 * K), NAME_BAND = 34, THUMB_H = TILE_H - NAME_BAND - 2;
|
|
21
|
+
/** Pages and Spaces, tabs of one panel (Layers is a menu of its own in the top bar). */
|
|
22
|
+
const TABS = [['pages', 'Pages'], ['rooms', 'Spaces']];
|
|
13
23
|
const close = () => { ui.drawer = null; ui.renameRoom = null; notify(); };
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
24
|
+
/** Sliding in it eases to a stop; sliding out it gathers pace as it goes. */
|
|
25
|
+
const SLIDE_IN = 240, SLIDE_OUT = 200, EASE_OUT = Easing.bezier(0.4, 0, 1, 1);
|
|
26
|
+
/** A phone's sheet rises the way iOS's own sheets do: quick off the mark, a long soft landing. */
|
|
27
|
+
const SHEET_IN = 320, SHEET_EASE = Easing.bezier(0.32, 0.72, 0, 1), SHEET_OUT = 220;
|
|
28
|
+
/** Taps on the scrim right after the sheet opens are the opening tap's ghost click (touch screens): ignore them. */
|
|
29
|
+
const GHOST_MS = 450;
|
|
30
|
+
/** A drag down the sheet's top that closes it: this far, or a flick. */
|
|
31
|
+
const CLOSE_DRAG = 80, CLOSE_FLICK = 0.5;
|
|
32
|
+
/**
|
|
33
|
+
* The project panel: pages and the spaces schedule. On a tablet or computer it slides in from the right; on a phone
|
|
34
|
+
* it's a bottom sheet the way BOLDR's are (a grey-1 sheet with a grey-4 handle over a dimmed drawing, closed by a drag
|
|
35
|
+
* down or a tap outside). Either way it slides back out when closed.
|
|
36
|
+
*/
|
|
37
|
+
export function Drawer({ phone = false }) {
|
|
38
|
+
const version = useEditorVersion(), { width, height } = useWindowDimensions(), w = Math.min(400, width);
|
|
39
|
+
const open = !!ui.drawer;
|
|
40
|
+
// what it showed last stays while it slides away
|
|
41
|
+
const last = useRef('pages');
|
|
42
|
+
if (ui.drawer)
|
|
43
|
+
last.current = ui.drawer;
|
|
44
|
+
const [present, setPresent] = useState(open);
|
|
45
|
+
// the phone's sheet slides its own height (measured as it opens), not the screen's: from a screen's height away the
|
|
46
|
+
// first part of the slide happened below the screen, and what showed rushed by in a few frames. While it slides,
|
|
47
|
+
// what's costly in it (the pages' thumbnails) waits: `settled`
|
|
48
|
+
const [travel, setTravel] = useState(null), [settled, setSettled] = useState(open);
|
|
49
|
+
const measuring = phone && open && travel == null;
|
|
50
|
+
const x = useRef(new Animated.Value(open ? 0 : 1)).current;
|
|
51
|
+
// made once for its size, which only changes while it's still: a new one each render would detach the old, and a
|
|
52
|
+
// value with nothing attached stops its animation — the slide would end before it began
|
|
53
|
+
const slide = useMemo(() => x.interpolate({ inputRange: [0, 1], outputRange: [0, (phone ? travel ?? height : w) + 40] }), [x, w, height, phone, travel]);
|
|
54
|
+
const fade = useMemo(() => x.interpolate({ inputRange: [0, 1], outputRange: [1, 0] }), [x]);
|
|
55
|
+
// the phone's sheet: how far it's dragged down, when it opened, and how far the keyboard lifts it
|
|
56
|
+
const drag = useRef(new Animated.Value(0)).current, openedAt = useRef(0), sheet = useRef(null), [lift, setLift] = useState(0);
|
|
57
|
+
const dropped = useMemo(() => Animated.add(slide, drag), [slide, drag]);
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
if (open) {
|
|
60
|
+
setPresent(true);
|
|
61
|
+
openedAt.current = Date.now();
|
|
62
|
+
}
|
|
63
|
+
}, [open]);
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
// (a phone's sheet first lays out below the screen, so it knows how far to come)
|
|
66
|
+
if (measuring)
|
|
67
|
+
return;
|
|
68
|
+
// started on the next frame: a panel just put on screen is taken off and put back once more by React's strict
|
|
69
|
+
// mode as it mounts, and its animation stops when that leaves nothing attached to it
|
|
70
|
+
const frame = requestAnimationFrame(() => {
|
|
71
|
+
if (open) {
|
|
72
|
+
Animated.timing(x, { toValue: 0, duration: phone ? SHEET_IN : SLIDE_IN, easing: phone ? SHEET_EASE : EASE, useNativeDriver: NATIVE })
|
|
73
|
+
.start(({ finished }) => { if (finished)
|
|
74
|
+
setSettled(true); });
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
Animated.timing(x, { toValue: 1, duration: phone ? SHEET_OUT : SLIDE_OUT, easing: EASE_OUT, useNativeDriver: NATIVE })
|
|
78
|
+
// (the thumbnails stay as they slide away; they're held back again the next time it opens)
|
|
79
|
+
.start(({ finished }) => { if (finished) {
|
|
80
|
+
setPresent(false);
|
|
81
|
+
setTravel(null);
|
|
82
|
+
setSettled(false);
|
|
83
|
+
drag.setValue(0);
|
|
84
|
+
} });
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
return () => cancelAnimationFrame(frame);
|
|
88
|
+
}, [open, measuring, phone, x, drag]);
|
|
89
|
+
const pan = useMemo(() => {
|
|
90
|
+
const back = () => Animated.timing(drag, { toValue: 0, duration: SLIDE_IN, easing: EASE, useNativeDriver: NATIVE }).start();
|
|
91
|
+
return PanResponder.create({
|
|
92
|
+
// a drag down (not a tap on a tab, nor a sideways swipe) moves the sheet with the finger
|
|
93
|
+
onMoveShouldSetPanResponder: (_, g) => g.dy > 4 && Math.abs(g.dy) > Math.abs(g.dx),
|
|
94
|
+
onPanResponderMove: (_, g) => drag.setValue(Math.max(0, g.dy)),
|
|
95
|
+
onPanResponderRelease: (_, g) => { if (g.dy > CLOSE_DRAG || g.vy > CLOSE_FLICK)
|
|
96
|
+
close();
|
|
97
|
+
else
|
|
98
|
+
back(); },
|
|
99
|
+
onPanResponderTerminate: back,
|
|
100
|
+
});
|
|
101
|
+
}, [drag]);
|
|
102
|
+
// iOS doesn't resize the window for the keyboard (Android does): lift the sheet clear of it to rename a space
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
if (!phone || Platform.OS !== 'ios')
|
|
105
|
+
return;
|
|
106
|
+
const show = Keyboard.addListener('keyboardWillShow', e => {
|
|
107
|
+
sheet.current?.measureInWindow((_x, y, _w, h) => setLift(l => Math.max(0, y + h + l - e.endCoordinates.screenY)));
|
|
108
|
+
});
|
|
109
|
+
const hide = Keyboard.addListener('keyboardWillHide', () => setLift(0));
|
|
110
|
+
return () => { show.remove(); hide.remove(); };
|
|
111
|
+
}, [phone]);
|
|
112
|
+
if (!open && !present)
|
|
19
113
|
return null;
|
|
20
|
-
|
|
114
|
+
const tab = last.current;
|
|
115
|
+
const body = (_jsxs(ScrollView, { style: phone && s.sheetScroll, contentContainerStyle: s.body, keyboardShouldPersistTaps: "handled", children: [tab === 'pages' && _jsx(Pages, { version: version, thumbs: settled || !phone }), tab === 'rooms' && _jsx(Spaces, {})] }));
|
|
116
|
+
const tabs = (_jsx(Segmented, { role: "tab", value: tab, options: TABS, onPick: t => { ui.drawer = t; notify(); }, style: s.tabs, optionStyle: s.tab, textStyle: s.tabText, onText: C.dark, offText: C.lg1 }));
|
|
117
|
+
if (phone) {
|
|
118
|
+
return (_jsxs(_Fragment, { children: [_jsx(Animated.View, { pointerEvents: open ? 'auto' : 'none', style: [StyleSheet.absoluteFill, s.scrim, { opacity: fade }], children: _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: "Close panel", testID: "drawerScrim", style: StyleSheet.absoluteFill, onPress: () => { if (Date.now() - openedAt.current > GHOST_MS)
|
|
119
|
+
close(); } }) }), _jsxs(Animated.View, { ref: sheet, pointerEvents: open ? 'auto' : 'none', accessibilityLabel: "Project panel", accessibilityViewIsModal: true, testID: open ? 'drawer' : undefined, style: [s.sheet, { bottom: lift, transform: [{ translateY: dropped }] }],
|
|
120
|
+
// its height: how far it slides (taken while it's still — opening, or open and settled — never mid-slide)
|
|
121
|
+
onLayout: e => { const h = e.nativeEvent.layout.height; if (travel == null || (settled && open))
|
|
122
|
+
setTravel(t => (t != null && Math.abs(t - h) < 1 ? t : h)); }, children: [_jsxs(View, { ...pan.panHandlers, children: [_jsx(View, { style: s.handleWrap, children: _jsx(View, { style: [s.handle, { width: Math.round(width * 0.075) }] }) }), _jsx(View, { style: [s.head, s.sheetHead], children: tabs })] }), body] })] }));
|
|
123
|
+
}
|
|
124
|
+
return (_jsxs(Animated.View, { pointerEvents: open ? 'auto' : 'none', accessibilityLabel: "Project panel", testID: open ? 'drawer' : undefined, style: [s.drawer, { width: w, transform: [{ translateX: slide }] }], children: [_jsxs(View, { style: s.head, children: [tabs, _jsx(Tap, { accessibilityRole: "button", accessibilityLabel: "Close panel", onPress: close, style: s.close, children: _jsx(Icon, { name: "close" }) })] }), body] }));
|
|
21
125
|
}
|
|
22
126
|
/** A name field that commits when editing ends (and shows the latest name otherwise). */
|
|
23
127
|
function NameField({ value, onCommit, style, label, autoFocus, onFocus }) {
|
|
@@ -29,19 +133,20 @@ function NameField({ value, onCommit, style, label, autoFocus, onFocus }) {
|
|
|
29
133
|
return (_jsx(TextInput, { ref: ref, accessibilityLabel: label, value: text, onChangeText: setText, style: [s.field, style], selectTextOnFocus: autoFocus, onFocus: () => { editing.current = true; onFocus?.(); }, onBlur: () => { editing.current = false; if (text !== value)
|
|
30
134
|
onCommit(text); }, onSubmitEditing: () => ref.current?.blur() }));
|
|
31
135
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
136
|
+
/**
|
|
137
|
+
* The pages (Figma 2548:101990): the current page's name, then the pages — Duplicate and Delete for the current one
|
|
138
|
+
* (greyed out while it's the only page), + Page, and a tile for each, its drawing above its name, the current one
|
|
139
|
+
* ringed in yellow. A tablet's or a browser's
|
|
140
|
+
* side panel and a phone's bottom sheet show the same.
|
|
141
|
+
*/
|
|
142
|
+
function Pages({ version, thumbs }) {
|
|
143
|
+
const project = store.project, cur = page(), pending = deletePending();
|
|
144
|
+
// a project keeps at least one page: nothing to delete while there's only one
|
|
145
|
+
const lone = project.pages.length <= 1;
|
|
146
|
+
return (_jsxs(View, { style: s.cards, children: [_jsxs(View, { style: s.current, children: [_jsx(Text, { style: s.pcardLabel, children: "Current Page:" }), _jsx(NameField, { label: "Page name", value: cur.name, onCommit: renamePage, style: s.curName })] }), _jsxs(View, { style: s.pcard, children: [_jsxs(View, { style: s.pageBar, children: [_jsxs(View, { style: s.pageBarLeft, children: [_jsx(Tap, { accessibilityRole: "button", accessibilityLabel: "Duplicate", onPress: duplicatePage, style: [s.pill, s.pillGrey], children: _jsx(Text, { style: [s.pillText, { color: '#fff' }], children: "Duplicate" }) }), _jsxs(Tap, { accessibilityRole: "button", accessibilityLabel: pending ? 'Tap again to delete' : 'Delete page', accessibilityState: { disabled: lone }, disabled: lone, onPress: deletePage, style: [s.pill, s.pillRed, pending && s.pillArmed, lone && s.pillOff], children: [_jsx(View, { style: lone && s.iconOff, children: _jsx(RawSvg, { xml: TRASH_SVG, width: TRASH_SIZE.width * K, height: TRASH_SIZE.height * K }) }), pending && _jsx(Text, { style: [s.pillText, { color: '#fff' }], children: "Delete?" })] })] }), _jsxs(Tap, { accessibilityRole: "button", accessibilityLabel: "+ Page", onPress: addPage, style: [s.pill, s.pillYellow], children: [_jsx(RawSvg, { xml: PLUS_SVG, width: PLUS_SIZE.width * K, height: PLUS_SIZE.height * K }), _jsx(Text, { style: [s.pillText, { color: C.dark }], children: "Page" })] })] }), project.pages.map(p => {
|
|
147
|
+
const on = p.id === cur.id;
|
|
148
|
+
return (_jsxs(Tap, { accessibilityRole: "button", accessibilityLabel: p.name, accessibilityState: { selected: on }, onPress: () => switchPage(p.id), style: [s.tile, on && s.tileOn], testID: "pageTile", children: [thumbs ? _jsx(PageThumb, { page: p, version: on ? ed.editSeq : 0, height: THUMB_H }) : _jsx(View, { style: { height: THUMB_H } }), _jsx(Text, { numberOfLines: 1, style: s.tileName, children: p.name })] }, p.id));
|
|
149
|
+
})] })] }));
|
|
45
150
|
}
|
|
46
151
|
function Spaces() {
|
|
47
152
|
const sched = spaceSchedule();
|
|
@@ -49,24 +154,25 @@ function Spaces() {
|
|
|
49
154
|
return _jsx(Text, { style: s.empty, children: "No spaces on this page yet. Close a loop of walls or lines, or pick the Space tool and tap inside a closed shape." });
|
|
50
155
|
return (_jsxs(_Fragment, { children: [sched.rows.map(r => (_jsxs(View, { style: s.roomRow, children: [_jsx(NameField, { label: "Space name", value: r.name, onCommit: v => renameSpace(r.id, v), autoFocus: ui.renameRoom === r.id, onFocus: () => focusSpace(r.id), style: { fontSize: 14 } }), _jsxs(View, { style: s.nums, children: [_jsxs(Text, { style: s.num, children: [_jsx(Text, { style: s.numB, children: fmtArea(r.area) }), " floor"] }), _jsxs(Text, { style: s.num, children: [_jsx(Text, { style: s.numB, children: fmtLen(r.per) }), " perimeter"] })] })] }, r.id))), _jsxs(View, { style: s.row, children: [_jsxs(View, { style: { flex: 1 }, children: [_jsx(Text, { style: [s.rowText, { fontWeight: '700' }], children: "Total" }), _jsx(Text, { style: s.rowSub, children: "Measured to inside wall faces" })] }), _jsx(Text, { style: [s.rowText, { fontWeight: '700' }], children: fmtArea(sched.total) })] })] }));
|
|
51
156
|
}
|
|
52
|
-
const s =
|
|
53
|
-
|
|
157
|
+
const s = createSheet({
|
|
158
|
+
// (a hairline along its top and left: it doesn't run into the page's header, the same grey, above it)
|
|
159
|
+
drawer: { position: 'absolute', top: 0, right: 0, bottom: 0, backgroundColor: C.g1, borderTopWidth: 1, borderLeftWidth: 1, borderColor: C.g2, zIndex: 50, boxShadow: '-8px 0px 30px rgba(0, 0, 0, 0.3)' },
|
|
160
|
+
// BOLDR's bottom sheet (AnimatedBottomSheet, surface="card"): gorhom's 15 pt corners and handle, over a 50% scrim
|
|
161
|
+
scrim: { backgroundColor: 'rgba(0,0,0,0.5)', zIndex: 49 },
|
|
162
|
+
sheet: { position: 'absolute', left: 0, right: 0, maxHeight: '85%', backgroundColor: C.g1, borderTopLeftRadius: 15, borderTopRightRadius: 15, zIndex: 50 },
|
|
163
|
+
handleWrap: { padding: 10 },
|
|
164
|
+
handle: { alignSelf: 'center', height: 4, borderRadius: 4, backgroundColor: C.g4 },
|
|
165
|
+
sheetHead: { paddingTop: 0 },
|
|
166
|
+
// (as tall as what's in it, up to the sheet's limit, then it scrolls)
|
|
167
|
+
sheetScroll: { flexGrow: 0, flexShrink: 1 },
|
|
54
168
|
head: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', paddingTop: 16, paddingBottom: 10, paddingLeft: 16, paddingRight: 14, gap: 10 },
|
|
55
|
-
|
|
56
|
-
|
|
169
|
+
title: { fontFamily: FONT, fontSize: 17, fontWeight: '700', color: '#fff', paddingLeft: 2 },
|
|
170
|
+
tabs: { flexDirection: 'row', backgroundColor: C.dark, borderRadius: 999, padding: 3 },
|
|
171
|
+
tab: { paddingVertical: 8, paddingHorizontal: 14, borderRadius: 999 },
|
|
57
172
|
tabText: { fontFamily: FONT, fontSize: 13, fontWeight: '600', color: C.lg1 },
|
|
58
173
|
close: { width: 38, height: 38, borderRadius: 19, backgroundColor: C.g2, alignItems: 'center', justifyContent: 'center' },
|
|
59
174
|
body: { paddingTop: 6, paddingHorizontal: 16, paddingBottom: 30 },
|
|
60
175
|
field: { fontFamily: FONT, color: '#fff', fontWeight: '600', paddingVertical: 6, paddingHorizontal: 8, marginLeft: -8, borderRadius: 8, borderWidth: 1, borderColor: 'transparent' },
|
|
61
|
-
sec: { fontFamily: FONT, fontSize: 13, fontWeight: '600', color: C.g4, marginTop: 18, marginBottom: 8 },
|
|
62
|
-
buttons: { flexDirection: 'row', flexWrap: 'wrap', gap: 8, marginTop: 10 },
|
|
63
|
-
small: { height: 32, paddingHorizontal: 12, borderRadius: 16, backgroundColor: C.dark, justifyContent: 'center' },
|
|
64
|
-
smallText: { fontFamily: FONT, fontSize: 12.5, fontWeight: '600', color: C.lg2 },
|
|
65
|
-
space: { marginTop: 16, backgroundColor: C.g2, borderWidth: 1, borderColor: C.g3, borderRadius: 12, padding: 10 },
|
|
66
|
-
spaceHead: { flexDirection: 'row', alignItems: 'center', gap: 6, marginBottom: 8 },
|
|
67
|
-
grid: { flexDirection: 'row', flexWrap: 'wrap', gap: 8 },
|
|
68
|
-
card: { width: '48%', flexGrow: 1, backgroundColor: C.dark, borderRadius: 9, padding: 6, borderWidth: 2, borderColor: 'transparent', gap: 5 },
|
|
69
|
-
cardText: { fontFamily: FONT, fontSize: 12.5, fontWeight: '500', color: C.lg2, paddingHorizontal: 2 },
|
|
70
176
|
row: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', gap: 12, paddingVertical: 10, borderBottomWidth: 1, borderBottomColor: C.g2 },
|
|
71
177
|
rowText: { fontFamily: FONT, fontSize: 14, color: '#fff' },
|
|
72
178
|
rowSub: { fontFamily: FONT, fontSize: 12, color: C.g4, marginTop: 2 },
|
|
@@ -75,6 +181,29 @@ const s = StyleSheet.create({
|
|
|
75
181
|
nums: { flexDirection: 'row', gap: 16, marginTop: 2 },
|
|
76
182
|
num: { fontFamily: FONT, fontSize: 13, color: C.lg1 },
|
|
77
183
|
numB: { color: '#fff', fontWeight: '600' },
|
|
184
|
+
// the Pages frame (Figma 2548:101989), at K: two cards of grey-3-ringed #3A3B3C, 20 corners, 15 inside
|
|
185
|
+
cards: { gap: 20 * K },
|
|
186
|
+
pcard: { backgroundColor: C.card, borderWidth: 1, borderColor: C.g3, borderRadius: 20 * K, padding: 15 * K, gap: 15 * K },
|
|
187
|
+
pcardLabel: { fontFamily: FONT, fontSize: 18 * K, fontWeight: '600', color: C.g4 },
|
|
188
|
+
// the current page's name: its label over a dark field, 60 tall, editable in place — straight on the panel, no card
|
|
189
|
+
current: { gap: 15 * K },
|
|
190
|
+
curName: { fontSize: 21 * K, backgroundColor: C.dark, borderRadius: 15 * K, minHeight: 60 * K, paddingVertical: 0, paddingHorizontal: 15 * K, marginLeft: 0 },
|
|
191
|
+
pageBar: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', gap: 10 * K },
|
|
192
|
+
pageBarLeft: { flexDirection: 'row', alignItems: 'center', gap: 10 * K },
|
|
193
|
+
// 50-tall pills: Duplicate 125 wide, Delete 70, + Page 125
|
|
194
|
+
pill: { height: 50 * K, borderRadius: 100, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 10 * K, paddingHorizontal: 20 * K },
|
|
195
|
+
pillGrey: { backgroundColor: C.g3, minWidth: 125 * K },
|
|
196
|
+
pillRed: { backgroundColor: C.red, minWidth: 70 * K },
|
|
197
|
+
pillArmed: { paddingHorizontal: 15 * K },
|
|
198
|
+
// Delete with nothing to delete (the only page): grey-3 like Duplicate, its can faded
|
|
199
|
+
pillOff: { backgroundColor: C.g3 },
|
|
200
|
+
iconOff: { opacity: 0.45 },
|
|
201
|
+
pillYellow: { backgroundColor: C.yellow, minWidth: 125 * K },
|
|
202
|
+
pillText: { fontFamily: FONT, fontSize: 18 * K, fontWeight: '600' },
|
|
203
|
+
// a page: its drawing, its name at the foot; dark grey, ringed grey-3 (the current one 3 wide in yellow)
|
|
204
|
+
tile: { height: TILE_H, backgroundColor: C.dark, borderRadius: 10 * K, borderWidth: 1, borderColor: C.g3, overflow: 'hidden' },
|
|
205
|
+
tileOn: { borderWidth: 3, borderColor: C.yellow },
|
|
206
|
+
tileName: { fontFamily: FONT, fontSize: 18 * K, fontWeight: '600', color: '#fff', position: 'absolute', left: 15 * K, right: 15 * K, bottom: 15 * K - 2 },
|
|
78
207
|
empty: { fontFamily: FONT, color: C.g4, fontSize: 13, lineHeight: 20, paddingVertical: 8 },
|
|
79
208
|
});
|
|
80
209
|
//# sourceMappingURL=Drawer.js.map
|