@unicom-cloud/ui 0.8.167 → 0.8.169
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/.virtual/_rolldown/runtime.js +1 -1
- package/affix/Affix.d.ts +1 -3
- package/affix/Affix.js +67 -64
- package/affix/constants.js +2 -0
- package/affix/context.d.ts +3 -0
- package/affix/context.js +7 -0
- package/affix/index.d.ts +4 -3
- package/affix/index.js +9 -4
- package/affix/interface.d.ts +2 -2
- package/affix/style/index.css +1 -0
- package/affix/style/index.d.ts +1 -0
- package/affix/style/index.js +3 -0
- package/alert/Alert.js +58 -57
- package/alert/constants.js +2 -0
- package/alert/context.d.ts +3 -0
- package/alert/context.js +10 -0
- package/alert/index.d.ts +3 -0
- package/alert/index.js +9 -4
- package/alert/style/index.css +1 -0
- package/alert/style/index.d.ts +1 -0
- package/alert/style/index.js +3 -0
- package/anchor/Anchor.js +48 -55
- package/anchor/Link.js +2 -2
- package/anchor/constants.js +2 -0
- package/anchor/context.d.ts +3 -2
- package/anchor/context.js +12 -3
- package/anchor/index.d.ts +4 -1
- package/anchor/index.js +10 -7
- package/anchor/style/index.css +1 -0
- package/anchor/style/index.d.ts +2 -0
- package/anchor/style/index.js +4 -0
- package/anchor/utils.js +1 -1
- package/animation/Animation.js +18 -14
- package/animation/constants.js +2 -0
- package/animation/context.d.ts +3 -0
- package/animation/context.js +7 -0
- package/animation/index.d.ts +2 -0
- package/animation/index.js +10 -5
- package/animation/style/index.d.ts +1 -0
- package/animation/style/index.js +3 -0
- package/app/App.js +25 -27
- package/app/constants.js +2 -0
- package/app/context.d.ts +4 -3
- package/app/context.js +5 -4
- package/app/index.d.ts +2 -1
- package/app/index.js +9 -7
- package/app/style/index.css +1 -0
- package/app/style/index.d.ts +1 -0
- package/app/style/index.js +3 -0
- package/app/useApp.js +2 -2
- package/auto-complete/AutoComplete.js +58 -54
- package/auto-complete/constants.d.ts +0 -0
- package/auto-complete/constants.js +2 -0
- package/auto-complete/context.d.ts +3 -0
- package/auto-complete/context.js +7 -0
- package/auto-complete/index.d.ts +2 -0
- package/auto-complete/index.js +9 -6
- package/auto-complete/style/index.css +1 -0
- package/auto-complete/style/index.d.ts +3 -0
- package/auto-complete/style/index.js +5 -0
- package/avatar/Avatar.d.ts +1 -3
- package/avatar/Avatar.js +49 -53
- package/avatar/Group.js +3 -3
- package/avatar/constants.d.ts +0 -0
- package/avatar/constants.js +2 -0
- package/avatar/context.d.ts +3 -2
- package/avatar/context.js +7 -3
- package/avatar/index.d.ts +4 -4
- package/avatar/index.js +9 -7
- package/avatar/interface.d.ts +2 -2
- package/avatar/style/index.css +1 -0
- package/avatar/style/index.d.ts +2 -0
- package/avatar/style/index.js +4 -0
- package/back-top/BackTop.d.ts +1 -3
- package/back-top/BackTop.js +44 -44
- package/back-top/constants.d.ts +0 -0
- package/back-top/constants.js +2 -0
- package/back-top/context.d.ts +3 -0
- package/back-top/context.js +11 -0
- package/back-top/index.d.ts +3 -3
- package/back-top/index.js +9 -4
- package/back-top/interface.d.ts +2 -2
- package/back-top/style/index.css +1 -0
- package/back-top/style/index.d.ts +1 -0
- package/back-top/style/index.js +3 -0
- package/badge/Badge.js +84 -85
- package/badge/Count.js +2 -2
- package/badge/constants.d.ts +0 -0
- package/badge/constants.js +2 -0
- package/badge/context.d.ts +3 -0
- package/badge/context.js +11 -0
- package/badge/index.d.ts +2 -0
- package/badge/index.js +10 -7
- package/badge/style/index.css +1 -0
- package/badge/style/index.d.ts +1 -0
- package/badge/style/index.js +3 -0
- package/badge/utils.js +1 -1
- package/border-beam/BorderBeam.js +20 -17
- package/border-beam/constants.d.ts +0 -0
- package/border-beam/constants.js +2 -0
- package/border-beam/context.d.ts +3 -0
- package/border-beam/context.js +7 -0
- package/border-beam/index.d.ts +2 -0
- package/border-beam/index.js +12 -7
- package/border-beam/style/index.css +1 -0
- package/border-beam/style/index.d.ts +1 -0
- package/border-beam/style/index.js +3 -0
- package/breadcrumb/Breadcrumb.js +46 -44
- package/breadcrumb/Item.js +6 -6
- package/breadcrumb/constants.d.ts +0 -0
- package/breadcrumb/constants.js +2 -0
- package/breadcrumb/context.d.ts +2 -0
- package/breadcrumb/context.js +5 -4
- package/breadcrumb/index.d.ts +2 -0
- package/breadcrumb/index.js +9 -7
- package/breadcrumb/style/index.css +1 -0
- package/breadcrumb/style/index.d.ts +2 -0
- package/breadcrumb/style/index.js +4 -0
- package/button/Button.js +48 -49
- package/button/Group.js +1 -1
- package/button/Toggle.js +1 -1
- package/button/constants.d.ts +0 -0
- package/button/constants.js +2 -0
- package/button/context.d.ts +9 -0
- package/button/context.js +11 -0
- package/button/index.d.ts +8 -0
- package/button/index.js +11 -8
- package/button/style/index.css +1 -0
- package/button/style/index.d.ts +1 -0
- package/button/style/index.js +3 -0
- package/calendar/Calendar.js +92 -95
- package/calendar/Month.js +4 -4
- package/calendar/WeekList.js +1 -1
- package/calendar/Year.js +2 -2
- package/calendar/constants.d.ts +0 -0
- package/calendar/constants.js +2 -0
- package/calendar/context.d.ts +3 -0
- package/calendar/context.js +13 -0
- package/calendar/header/Panel.js +1 -1
- package/calendar/header/index.js +3 -3
- package/calendar/hooks/useCellClassName.js +34 -0
- package/calendar/index.d.ts +2 -0
- package/calendar/index.js +11 -8
- package/calendar/style/index.css +1 -0
- package/calendar/style/index.d.ts +3 -0
- package/calendar/style/index.js +5 -0
- package/card/Card.js +48 -48
- package/card/Grid.js +1 -1
- package/card/Meta.js +1 -1
- package/card/constants.d.ts +0 -0
- package/card/constants.js +2 -0
- package/card/context.d.ts +3 -0
- package/card/context.js +10 -0
- package/card/index.d.ts +2 -0
- package/card/index.js +7 -4
- package/card/style/index.css +1 -0
- package/card/style/index.d.ts +2 -0
- package/card/style/index.js +4 -0
- package/carousel/Arrow.js +1 -1
- package/carousel/Carousel.js +82 -87
- package/carousel/Indicator.js +1 -1
- package/carousel/constants.d.ts +0 -0
- package/carousel/constants.js +2 -0
- package/carousel/context.d.ts +3 -0
- package/carousel/context.js +16 -0
- package/carousel/index.d.ts +2 -0
- package/carousel/index.js +9 -4
- package/carousel/style/index.css +1 -0
- package/carousel/style/index.d.ts +1 -0
- package/carousel/style/index.js +3 -0
- package/cascader/Cascader.js +151 -155
- package/cascader/base/node.js +2 -2
- package/cascader/base/store.js +1 -1
- package/cascader/constants.d.ts +7 -0
- package/cascader/constants.js +13 -0
- package/cascader/context.d.ts +3 -0
- package/cascader/context.js +17 -0
- package/cascader/hooks/useRefCurrent.js +14 -0
- package/cascader/index.d.ts +2 -0
- package/cascader/index.js +9 -4
- package/cascader/panel/List.js +28 -28
- package/cascader/panel/Option.js +2 -2
- package/cascader/panel/Search.js +16 -16
- package/cascader/style/index.css +1 -0
- package/cascader/style/index.d.ts +5 -0
- package/cascader/style/index.js +7 -0
- package/cascader/utils.d.ts +0 -7
- package/cascader/utils.js +25 -32
- package/checkbox/Checkbox.js +17 -14
- package/checkbox/Group.js +4 -4
- package/checkbox/GroupBlock.js +3 -3
- package/checkbox/constants.d.ts +0 -0
- package/checkbox/constants.js +2 -0
- package/checkbox/context.d.ts +3 -0
- package/checkbox/context.js +3 -3
- package/checkbox/index.d.ts +2 -0
- package/checkbox/index.js +13 -11
- package/checkbox/style/index.css +1 -0
- package/checkbox/style/index.d.ts +1 -0
- package/checkbox/style/index.js +3 -0
- package/checkbox/useCheckbox.js +1 -1
- package/collapse/Collapse.js +45 -47
- package/collapse/Item.js +2 -2
- package/collapse/constants.d.ts +0 -0
- package/collapse/constants.js +2 -0
- package/collapse/context.d.ts +2 -0
- package/collapse/context.js +8 -3
- package/collapse/index.d.ts +2 -0
- package/collapse/index.js +9 -7
- package/collapse/style/index.css +1 -0
- package/collapse/style/index.d.ts +1 -0
- package/collapse/style/index.js +3 -0
- package/collapse/utils.js +1 -1
- package/color-picker/ColorPicker.js +79 -80
- package/color-picker/ControlBar.js +1 -1
- package/color-picker/InputAlpha.js +1 -1
- package/color-picker/InputHex.js +1 -1
- package/color-picker/InputRgb.js +1 -1
- package/color-picker/Mode.js +1 -1
- package/color-picker/Palette.js +1 -1
- package/color-picker/Panel.js +74 -74
- package/color-picker/colors.js +1 -1
- package/color-picker/constants.d.ts +0 -0
- package/color-picker/constants.js +2 -0
- package/color-picker/context.d.ts +3 -0
- package/color-picker/context.js +11 -0
- package/color-picker/hooks/useColorPicker.d.ts +1 -1
- package/color-picker/hooks/useColorPicker.js +1 -1
- package/color-picker/hooks/useControlBlock.js +1 -1
- package/color-picker/index.d.ts +2 -0
- package/color-picker/index.js +19 -16
- package/color-picker/interface.js +1 -1
- package/color-picker/style/index.css +1 -0
- package/color-picker/style/index.d.ts +3 -0
- package/color-picker/style/index.js +5 -0
- package/color-picker/utils.d.ts +1 -1
- package/color-picker/utils.js +1 -1
- package/comment/Comment.js +52 -48
- package/comment/constants.d.ts +0 -0
- package/comment/constants.js +2 -0
- package/comment/context.d.ts +3 -0
- package/comment/context.js +7 -0
- package/comment/index.d.ts +2 -0
- package/comment/index.js +9 -4
- package/comment/style/index.css +1 -0
- package/comment/style/index.d.ts +1 -0
- package/comment/style/index.js +3 -0
- package/config-provider/ConfigProvider.js +11 -11
- package/config-provider/constants.d.ts +0 -0
- package/config-provider/constants.js +2 -0
- package/config-provider/context.d.ts +21 -0
- package/config-provider/context.js +4 -4
- package/config-provider/index.d.ts +1 -0
- package/config-provider/index.js +2 -1
- package/config-provider/initUI.js +1 -1
- package/config-provider/interface.d.ts +6 -0
- package/config-provider/style/index.d.ts +1 -0
- package/config-provider/style/index.js +3 -0
- package/config-provider/useConfigProvider.js +2 -2
- package/config-provider/utils.js +2 -2
- package/constants/index.d.ts +2 -0
- package/constants/index.js +6 -0
- package/copy/Copy.d.ts +1 -1
- package/copy/Copy.js +37 -35
- package/copy/constants.d.ts +0 -0
- package/copy/constants.js +2 -0
- package/copy/context.d.ts +3 -0
- package/copy/context.js +7 -0
- package/copy/index.d.ts +2 -0
- package/copy/index.js +9 -4
- package/copy/style/index.css +1 -0
- package/copy/style/index.d.ts +2 -0
- package/copy/style/index.js +4 -0
- package/countdown/Countdown.js +43 -42
- package/countdown/constants.d.ts +0 -0
- package/countdown/constants.js +2 -0
- package/countdown/context.d.ts +3 -0
- package/countdown/context.js +10 -0
- package/countdown/index.d.ts +2 -0
- package/countdown/index.js +9 -4
- package/countdown/style/index.css +1 -0
- package/countdown/style/index.d.ts +2 -0
- package/countdown/style/index.js +4 -0
- package/countdown/utils.js +1 -1
- package/date-picker/DatePicker.d.ts +6 -5
- package/date-picker/DatePicker.js +5 -5
- package/date-picker/Picker.js +208 -211
- package/date-picker/Range.d.ts +3 -0
- package/date-picker/Range.js +404 -0
- package/date-picker/constants.d.ts +0 -0
- package/date-picker/constants.js +2 -0
- package/date-picker/context.d.ts +4 -2
- package/date-picker/context.js +9 -3
- package/date-picker/hooks/useCellClassName.js +53 -0
- package/date-picker/index.d.ts +4 -2
- package/date-picker/index.js +13 -18
- package/date-picker/panel/Body.js +2 -2
- package/date-picker/panel/Footer.js +4 -4
- package/date-picker/panel/Header.js +2 -2
- package/date-picker/panel/Shortcut.d.ts +1 -1
- package/date-picker/panel/Shortcut.js +2 -2
- package/date-picker/panel/WeekList.js +1 -1
- package/date-picker/panel/date/index.js +3 -3
- package/date-picker/panel/month/index.js +2 -2
- package/date-picker/panel/quarter/index.js +2 -2
- package/date-picker/panel/range/index.js +2 -2
- package/date-picker/panel/week/index.js +2 -2
- package/date-picker/panel/year/index.js +3 -3
- package/date-picker/style/index.css +1 -0
- package/date-picker/style/index.d.ts +6 -0
- package/date-picker/style/index.js +8 -0
- package/date-picker/utils.js +2 -2
- package/descriptions/Descriptions.js +83 -83
- package/descriptions/constants.d.ts +0 -0
- package/descriptions/constants.js +2 -0
- package/descriptions/context.d.ts +3 -0
- package/descriptions/context.js +11 -0
- package/descriptions/index.d.ts +2 -0
- package/descriptions/index.js +9 -4
- package/descriptions/style/index.css +1 -0
- package/descriptions/style/index.d.ts +1 -0
- package/descriptions/style/index.js +3 -0
- package/details/Details.js +57 -54
- package/details/constants.d.ts +0 -0
- package/details/constants.js +2 -0
- package/details/context.d.ts +3 -0
- package/details/context.js +7 -0
- package/details/index.d.ts +2 -0
- package/details/index.js +9 -4
- package/details/style/index.css +1 -0
- package/details/style/index.d.ts +1 -0
- package/details/style/index.js +3 -0
- package/development/Development.js +25 -20
- package/development/constants.d.ts +0 -0
- package/development/constants.js +2 -0
- package/development/context.d.ts +3 -0
- package/development/context.js +7 -0
- package/development/index.d.ts +2 -0
- package/development/index.js +9 -4
- package/development/style/index.css +1 -0
- package/development/style/index.d.ts +1 -0
- package/development/style/index.js +3 -0
- package/divider/Divider.js +34 -34
- package/divider/constants.d.ts +0 -0
- package/divider/constants.js +2 -0
- package/divider/context.d.ts +3 -0
- package/divider/context.js +10 -0
- package/divider/index.d.ts +2 -0
- package/divider/index.js +8 -5
- package/divider/style/index.css +1 -0
- package/divider/style/index.d.ts +1 -0
- package/divider/style/index.js +3 -0
- package/draggable/Draggable.js +27 -22
- package/draggable/Item.js +1 -1
- package/draggable/constants.d.ts +0 -0
- package/draggable/constants.js +2 -0
- package/draggable/context.d.ts +3 -0
- package/draggable/context.js +7 -0
- package/draggable/index.d.ts +2 -0
- package/draggable/index.js +9 -6
- package/draggable/style/index.css +1 -0
- package/draggable/style/index.d.ts +1 -0
- package/draggable/style/index.js +3 -0
- package/draw/Draw.d.ts +3 -1
- package/draw/Draw.js +102 -31
- package/draw/LICENSE +20 -0
- package/draw/common/binary-heap.d.ts +12 -0
- package/draw/common/binary-heap.js +52 -0
- package/draw/common/bounds.d.ts +10 -0
- package/draw/common/bounds.js +3 -0
- package/draw/common/colors.d.ts +21 -0
- package/draw/common/colors.js +109 -0
- package/draw/common/constants.d.ts +345 -0
- package/draw/common/constants.js +218 -0
- package/draw/common/editorInterface.d.ts +34 -0
- package/draw/common/editorInterface.js +39 -0
- package/draw/common/emitter.d.ts +16 -0
- package/draw/common/emitter.js +31 -0
- package/draw/common/font-metadata.d.ts +43 -0
- package/draw/common/font-metadata.js +94 -0
- package/draw/common/index.d.ts +14 -0
- package/draw/common/index.js +16 -0
- package/draw/common/keys.d.ts +187 -0
- package/draw/common/keys.js +87 -0
- package/draw/common/points.d.ts +9 -0
- package/draw/common/points.js +22 -0
- package/draw/common/promise-pool.d.ts +5 -0
- package/draw/common/promise-pool.js +24 -0
- package/draw/common/queue.d.ts +7 -0
- package/draw/common/queue.js +25 -0
- package/draw/common/random.d.ts +3 -0
- package/draw/common/random.js +9 -0
- package/draw/common/url.d.ts +7 -0
- package/draw/common/url.js +16 -0
- package/draw/common/utility-types.d.ts +37 -0
- package/draw/common/utils.d.ts +281 -0
- package/draw/common/utils.js +227 -0
- package/draw/constants.d.ts +1 -0
- package/draw/constants.js +6 -0
- package/draw/context.d.ts +3 -0
- package/draw/context.js +7 -0
- package/draw/core/actions/actionAddToLibrary.d.ts +467 -0
- package/draw/core/actions/actionAddToLibrary.js +50 -0
- package/draw/core/actions/actionAlign.d.ts +109 -0
- package/draw/core/actions/actionAlign.js +159 -0
- package/draw/core/actions/actionBoundText.d.ts +348 -0
- package/draw/core/actions/actionBoundText.js +160 -0
- package/draw/core/actions/actionCanvas.d.ts +2147 -0
- package/draw/core/actions/actionCanvas.js +332 -0
- package/draw/core/actions/actionClipboard.d.ts +387 -0
- package/draw/core/actions/actionClipboard.js +197 -0
- package/draw/core/actions/actionCropEditor.d.ts +168 -0
- package/draw/core/actions/actionCropEditor.js +48 -0
- package/draw/core/actions/actionDeleteSelected.d.ts +503 -0
- package/draw/core/actions/actionDeleteSelected.js +144 -0
- package/draw/core/actions/actionDistribute.d.ts +34 -0
- package/draw/core/actions/actionDistribute.js +68 -0
- package/draw/core/actions/actionDuplicateSelection.d.ts +17 -0
- package/draw/core/actions/actionDuplicateSelection.js +78 -0
- package/draw/core/actions/actionElementLink.d.ts +192 -0
- package/draw/core/actions/actionElementLink.js +79 -0
- package/draw/core/actions/actionElementLock.d.ts +335 -0
- package/draw/core/actions/actionElementLock.js +103 -0
- package/draw/core/actions/actionEmbeddable.d.ts +165 -0
- package/draw/core/actions/actionEmbeddable.js +29 -0
- package/draw/core/actions/actionExport.d.ts +341 -0
- package/draw/core/actions/actionExport.js +232 -0
- package/draw/core/actions/actionFinalize.d.ts +13 -0
- package/draw/core/actions/actionFinalize.js +143 -0
- package/draw/core/actions/actionFlip.d.ts +34 -0
- package/draw/core/actions/actionFlip.js +82 -0
- package/draw/core/actions/actionFrame.d.ts +1127 -0
- package/draw/core/actions/actionFrame.js +138 -0
- package/draw/core/actions/actionGroup.d.ts +338 -0
- package/draw/core/actions/actionGroup.js +130 -0
- package/draw/core/actions/actionHistory.d.ts +9 -0
- package/draw/core/actions/actionHistory.js +44 -0
- package/draw/core/actions/actionLinearEditor.d.ts +664 -0
- package/draw/core/actions/actionLinearEditor.js +104 -0
- package/draw/core/actions/actionMenu.d.ts +160 -0
- package/draw/core/actions/actionMenu.js +32 -0
- package/draw/core/actions/actionProperties.d.ts +384 -0
- package/draw/core/actions/actionProperties.js +792 -0
- package/draw/core/actions/actionSelectAll.d.ts +165 -0
- package/draw/core/actions/actionSelectAll.js +39 -0
- package/draw/core/actions/actionStyles.d.ts +183 -0
- package/draw/core/actions/actionStyles.js +93 -0
- package/draw/core/actions/actionTextAutoResize.d.ts +17 -0
- package/draw/core/actions/actionTextAutoResize.js +44 -0
- package/draw/core/actions/actionToggleGridMode.d.ts +171 -0
- package/draw/core/actions/actionToggleGridMode.js +37 -0
- package/draw/core/actions/actionToggleObjectsSnapMode.d.ts +169 -0
- package/draw/core/actions/actionToggleObjectsSnapMode.js +34 -0
- package/draw/core/actions/actionToggleSearchMenu.d.ts +164 -0
- package/draw/core/actions/actionToggleSearchMenu.js +45 -0
- package/draw/core/actions/actionToggleShapeSwitch.d.ts +19 -0
- package/draw/core/actions/actionToggleStats.d.ts +168 -0
- package/draw/core/actions/actionToggleStats.js +37 -0
- package/draw/core/actions/actionToggleViewMode.d.ts +169 -0
- package/draw/core/actions/actionToggleViewMode.js +34 -0
- package/draw/core/actions/actionToggleZenMode.d.ts +169 -0
- package/draw/core/actions/actionToggleZenMode.js +34 -0
- package/draw/core/actions/actionZindex.d.ts +74 -0
- package/draw/core/actions/actionZindex.js +107 -0
- package/draw/core/actions/index.d.ts +26 -0
- package/draw/core/actions/index.js +28 -0
- package/draw/core/actions/manager.d.ts +21 -0
- package/draw/core/actions/manager.js +64 -0
- package/draw/core/actions/register.d.ts +5 -0
- package/draw/core/actions/register.js +6 -0
- package/draw/core/actions/shortcuts.d.ts +4 -0
- package/draw/core/actions/shortcuts.js +58 -0
- package/draw/core/actions/types.d.ts +47 -0
- package/draw/core/analytics.d.ts +1 -0
- package/draw/core/analytics.js +19 -0
- package/draw/core/animated-trail.d.ts +32 -0
- package/draw/core/animated-trail.js +83 -0
- package/draw/core/animation-frame-handler.d.ts +11 -0
- package/draw/core/animation-frame-handler.js +51 -0
- package/draw/core/appState.d.ts +101 -0
- package/draw/core/appState.js +569 -0
- package/draw/core/charts.d.ts +27 -0
- package/draw/core/charts.js +263 -0
- package/draw/core/clients.d.ts +14 -0
- package/draw/core/clients.js +38 -0
- package/draw/core/clipboard.d.ts +107 -0
- package/draw/core/clipboard.js +250 -0
- package/draw/core/components/Actions.d.ts +28 -0
- package/draw/core/components/Actions.js +493 -0
- package/draw/core/components/ActiveConfirmDialog.d.ts +4 -0
- package/draw/core/components/ActiveConfirmDialog.js +32 -0
- package/draw/core/components/App.d.ts +363 -0
- package/draw/core/components/App.js +4076 -0
- package/draw/core/components/BraveMeasureTextError.d.ts +2 -0
- package/draw/core/components/BraveMeasureTextError.js +23 -0
- package/draw/core/components/ButtonIconCycle.d.ts +11 -0
- package/draw/core/components/ButtonSeparator.d.ts +1 -0
- package/draw/core/components/ContextMenu.d.ts +14 -0
- package/draw/core/components/ContextMenu.js +59 -0
- package/draw/core/components/ConvertElementTypePopup.d.ts +22 -0
- package/draw/core/components/ConvertElementTypePopup.js +318 -0
- package/draw/core/components/DarkModeToggle.d.ts +6 -0
- package/draw/core/components/DarkModeToggle.js +22 -0
- package/draw/core/components/DiagramToCodePlugin/index.d.ts +4 -0
- package/draw/core/components/DiagramToCodePlugin/index.js +13 -0
- package/draw/core/components/ElementCanvasButtons.d.ts +6 -0
- package/draw/core/components/ElementCanvasButtons.js +34 -0
- package/draw/core/components/ElementLinkDialog.d.ts +11 -0
- package/draw/core/components/ElementLinkDialog.js +112 -0
- package/draw/core/components/Ellipsify.d.ts +3 -0
- package/draw/core/components/Ellipsify.js +16 -0
- package/draw/core/components/ErrorDialog.d.ts +5 -0
- package/draw/core/components/ErrorDialog.js +36 -0
- package/draw/core/components/ExportDialog.d.ts +14 -0
- package/draw/core/components/ExportDialog.js +34 -0
- package/draw/core/components/EyeDropper.d.ts +25 -0
- package/draw/core/components/EyeDropper.js +84 -0
- package/draw/core/components/FixedSideContainer.d.ts +8 -0
- package/draw/core/components/FixedSideContainer.js +12 -0
- package/draw/core/components/Footer.d.ts +13 -0
- package/draw/core/components/Footer.js +118 -0
- package/draw/core/components/HandButton.d.ts +9 -0
- package/draw/core/components/HandButton.js +26 -0
- package/draw/core/components/HelpDialog.d.ts +2 -0
- package/draw/core/components/HelpDialog.js +407 -0
- package/draw/core/components/HintViewer.d.ts +10 -0
- package/draw/core/components/HintViewer.js +96 -0
- package/draw/core/components/ImageExportDialog.d.ts +14 -0
- package/draw/core/components/ImageExportDialog.js +243 -0
- package/draw/core/components/InitializeApp.d.ts +10 -0
- package/draw/core/components/InitializeApp.js +25 -0
- package/draw/core/components/InlineIcon.d.ts +5 -0
- package/draw/core/components/InlineIcon.js +19 -0
- package/draw/core/components/Island.d.ts +9 -0
- package/draw/core/components/Island.js +17 -0
- package/draw/core/components/LaserPointerButton.d.ts +9 -0
- package/draw/core/components/LaserPointerButton.js +24 -0
- package/draw/core/components/LayerUI.d.ts +30 -0
- package/draw/core/components/LayerUI.js +373 -0
- package/draw/core/components/LibraryMenu.d.ts +9 -0
- package/draw/core/components/LibraryMenu.js +133 -0
- package/draw/core/components/LibraryMenuItems.d.ts +14 -0
- package/draw/core/components/LibraryMenuItems.js +274 -0
- package/draw/core/components/LibraryMenuSection.d.ts +23 -0
- package/draw/core/components/LibraryMenuSection.js +37 -0
- package/draw/core/components/LibraryUnit.d.ts +13 -0
- package/draw/core/components/LibraryUnit.js +52 -0
- package/draw/core/components/LinkButton.d.ts +4 -0
- package/draw/core/components/LoadingMessage.d.ts +5 -0
- package/draw/core/components/LoadingMessage.js +32 -0
- package/draw/core/components/LockButton.d.ts +9 -0
- package/draw/core/components/LockButton.js +25 -0
- package/draw/core/components/MagicButton.d.ts +9 -0
- package/draw/core/components/MagicButton.js +22 -0
- package/draw/core/components/OverwriteConfirm/OverwriteConfirmState.d.ts +22 -0
- package/draw/core/components/OverwriteConfirm/OverwriteConfirmState.js +22 -0
- package/draw/core/components/OverwriteConfirm/index.d.ts +4 -0
- package/draw/core/components/OverwriteConfirm/index.js +94 -0
- package/draw/core/components/PasteChartDialog.d.ts +7 -0
- package/draw/core/components/PasteChartDialog.js +78 -0
- package/draw/core/components/PenModeButton.d.ts +11 -0
- package/draw/core/components/PenModeButton.js +23 -0
- package/draw/core/components/Popover.d.ts +15 -0
- package/draw/core/components/Popover.js +58 -0
- package/draw/core/components/ProjectName.d.ts +9 -0
- package/draw/core/components/ProjectName.js +39 -0
- package/draw/core/components/Range.d.ts +7 -0
- package/draw/core/components/Range.js +37 -0
- package/draw/core/components/SVGLayer.d.ts +6 -0
- package/draw/core/components/SVGLayer.js +19 -0
- package/draw/core/components/ScrollableList.d.ts +7 -0
- package/draw/core/components/SearchMenu.d.ts +4 -0
- package/draw/core/components/SearchMenu.js +381 -0
- package/draw/core/components/Stack.d.ts +14 -0
- package/draw/core/components/Stack.js +31 -0
- package/draw/core/components/Stats/Angle.d.ts +11 -0
- package/draw/core/components/Stats/Angle.js +45 -0
- package/draw/core/components/Stats/CanvasGrid.d.ts +10 -0
- package/draw/core/components/Stats/CanvasGrid.js +25 -0
- package/draw/core/components/Stats/Collapsible.d.ts +10 -0
- package/draw/core/components/Stats/Collapsible.js +26 -0
- package/draw/core/components/Stats/Dimension.d.ts +11 -0
- package/draw/core/components/Stats/Dimension.js +106 -0
- package/draw/core/components/Stats/DragInput.d.ts +43 -0
- package/draw/core/components/Stats/DragInput.js +133 -0
- package/draw/core/components/Stats/FontSize.d.ts +11 -0
- package/draw/core/components/Stats/FontSize.js +38 -0
- package/draw/core/components/Stats/MultiAngle.d.ts +11 -0
- package/draw/core/components/Stats/MultiAngle.js +53 -0
- package/draw/core/components/Stats/MultiDimension.d.ts +14 -0
- package/draw/core/components/Stats/MultiDimension.js +125 -0
- package/draw/core/components/Stats/MultiFontSize.d.ts +12 -0
- package/draw/core/components/Stats/MultiFontSize.js +51 -0
- package/draw/core/components/Stats/MultiPosition.d.ts +14 -0
- package/draw/core/components/Stats/MultiPosition.js +73 -0
- package/draw/core/components/Stats/Position.d.ts +12 -0
- package/draw/core/components/Stats/Position.js +67 -0
- package/draw/core/components/Stats/index.d.ts +34 -0
- package/draw/core/components/Stats/index.js +263 -0
- package/draw/core/components/Stats/utils.d.ts +19 -0
- package/draw/core/components/Stats/utils.js +67 -0
- package/draw/core/components/Toast.d.ts +6 -0
- package/draw/core/components/Toast.js +21 -0
- package/draw/core/components/Tooltip.d.ts +7 -0
- package/draw/core/components/Trans.d.ts +7 -0
- package/draw/core/components/Trans.js +33 -0
- package/draw/core/components/UnlockPopup.d.ts +7 -0
- package/draw/core/components/UnlockPopup.js +46 -0
- package/draw/core/components/canvases/InteractiveCanvas.d.ts +33 -0
- package/draw/core/components/canvases/InteractiveCanvas.js +119 -0
- package/draw/core/components/canvases/NewElementCanvas.d.ts +14 -0
- package/draw/core/components/canvases/NewElementCanvas.js +33 -0
- package/draw/core/components/canvases/StaticCanvas.d.ts +19 -0
- package/draw/core/components/canvases/StaticCanvas.js +64 -0
- package/draw/core/components/canvases/index.d.ts +3 -0
- package/draw/core/components/canvases/index.js +4 -0
- package/draw/core/components/context.d.ts +29 -0
- package/draw/core/components/context.js +43 -0
- package/draw/core/components/hoc/withInternalFallback.d.ts +4 -0
- package/draw/core/components/hooks.d.ts +23 -0
- package/draw/core/components/hooks.js +10 -0
- package/draw/core/components/icons.d.ts +62 -0
- package/draw/core/components/icons.js +584 -0
- package/draw/core/components/main-menu/DefaultItems.d.ts +38 -0
- package/draw/core/components/main-menu/DefaultItems.js +145 -0
- package/draw/core/components/main-menu/MenuItem.d.ts +24 -0
- package/draw/core/components/main-menu/MenuItem.js +55 -0
- package/draw/core/components/main-menu/common.d.ts +6 -0
- package/draw/core/components/main-menu/common.js +20 -0
- package/draw/core/components/shapes.d.ts +190 -0
- package/draw/core/components/shapes.js +96 -0
- package/draw/core/context/tunnels.d.ts +132 -0
- package/draw/core/context/tunnels.js +30 -0
- package/draw/core/context/ui-appState.d.ts +4 -0
- package/draw/core/context/ui-appState.js +7 -0
- package/draw/core/cursor.d.ts +5 -0
- package/draw/core/cursor.js +28 -0
- package/draw/core/data/EditorLocalStorage.d.ts +8 -0
- package/draw/core/data/ai/types.d.ts +242 -0
- package/draw/core/data/blob.d.ts +357 -0
- package/draw/core/data/blob.js +171 -0
- package/draw/core/data/encode.d.ts +55 -0
- package/draw/core/data/encode.js +38 -0
- package/draw/core/data/encryption.d.ts +9 -0
- package/draw/core/data/encryption.js +4 -0
- package/draw/core/data/filesystem.d.ts +21 -0
- package/draw/core/data/filesystem.js +44 -0
- package/draw/core/data/image.d.ts +9 -0
- package/draw/core/data/image.js +35 -0
- package/draw/core/data/index.d.ts +3 -0
- package/draw/core/data/index.js +5 -0
- package/draw/core/data/json.d.ts +168 -0
- package/draw/core/data/json.js +51 -0
- package/draw/core/data/library.d.ts +116 -0
- package/draw/core/data/library.js +279 -0
- package/draw/core/data/reconcile.d.ts +7 -0
- package/draw/core/data/reconcile.js +32 -0
- package/draw/core/data/resave.d.ts +5 -0
- package/draw/core/data/resave.js +23 -0
- package/draw/core/data/restore.d.ts +39 -0
- package/draw/core/data/restore.js +331 -0
- package/draw/core/data/types.d.ts +48 -0
- package/draw/core/data/utils.d.ts +20 -0
- package/draw/core/data/utils.js +84 -0
- package/draw/core/deburr.d.ts +1 -0
- package/draw/core/deburr.js +197 -0
- package/draw/core/editor-jotai.d.ts +7 -0
- package/draw/core/editor-jotai.js +11 -0
- package/draw/core/eraser/index.d.ts +10 -0
- package/draw/core/eraser/index.js +109 -0
- package/draw/core/errors.d.ts +43 -0
- package/draw/core/errors.js +22 -0
- package/draw/core/fonts/DrawFontFace.d.ts +8 -0
- package/draw/core/fonts/DrawFontFace.js +29 -0
- package/draw/core/fonts/Fonts.d.ts +42 -0
- package/draw/core/fonts/Fonts.js +100 -0
- package/draw/core/fonts/index.d.ts +1 -0
- package/draw/core/fonts/index.js +3 -0
- package/draw/core/gesture.d.ts +6 -0
- package/draw/core/gesture.js +12 -0
- package/draw/core/history.d.ts +46 -0
- package/draw/core/history.js +90 -0
- package/draw/core/hooks/useCallbackRefState.d.ts +1 -0
- package/draw/core/hooks/useCopiedIndicator.d.ts +5 -0
- package/draw/core/hooks/useCopiedIndicator.js +20 -0
- package/draw/core/hooks/useCreatePortalContainer.d.ts +4 -0
- package/draw/core/hooks/useCreatePortalContainer.js +28 -0
- package/draw/core/hooks/useEmitter.d.ts +2 -0
- package/draw/core/hooks/useEmitter.js +17 -0
- package/draw/core/hooks/useLibraryItemSvg.d.ts +11 -0
- package/draw/core/hooks/useLibraryItemSvg.js +52 -0
- package/draw/core/hooks/useOutsideClick.d.ts +21 -0
- package/draw/core/hooks/useOutsideClick.js +28 -0
- package/draw/core/hooks/useScrollPosition.d.ts +1 -0
- package/draw/core/hooks/useScrollPosition.js +23 -0
- package/draw/core/hooks/useStable.d.ts +1 -0
- package/draw/core/hooks/useStable.js +10 -0
- package/draw/core/hooks/useStableCallback.d.ts +4 -0
- package/draw/core/hooks/useTextEditorFocus.d.ts +14 -0
- package/draw/core/hooks/useTextEditorFocus.js +39 -0
- package/draw/core/hooks/useTransition.d.ts +2 -0
- package/draw/core/hooks/useTransition.js +10 -0
- package/draw/core/i18n.d.ts +24 -0
- package/draw/core/i18n.js +40 -0
- package/draw/core/laser-trails.d.ts +17 -0
- package/draw/core/laser-trails.js +60 -0
- package/draw/core/lasso/index.d.ts +11 -0
- package/draw/core/lasso/index.js +104 -0
- package/draw/core/lasso/utils.d.ts +13 -0
- package/draw/core/lasso/utils.js +41 -0
- package/draw/core/locales/percentages.json.js +62 -0
- package/draw/core/locales/zh-CN.json.js +704 -0
- package/draw/core/mermaid.d.ts +1 -0
- package/draw/core/polyfill.d.ts +2 -0
- package/draw/core/polyfill.js +6 -0
- package/draw/core/reactUtils.d.ts +14 -0
- package/draw/core/reactUtils.js +24 -0
- package/draw/core/renderer/animation.d.ts +10 -0
- package/draw/core/renderer/animation.js +43 -0
- package/draw/core/renderer/helpers.d.ts +16 -0
- package/draw/core/renderer/helpers.js +16 -0
- package/draw/core/renderer/interactiveScene.d.ts +14 -0
- package/draw/core/renderer/interactiveScene.js +392 -0
- package/draw/core/renderer/renderNewElementScene.d.ts +7 -0
- package/draw/core/renderer/renderNewElementScene.js +40 -0
- package/draw/core/renderer/renderSnaps.d.ts +2 -0
- package/draw/core/renderer/renderSnaps.js +39 -0
- package/draw/core/renderer/roundRect.d.ts +11 -0
- package/draw/core/renderer/roundRect.js +8 -0
- package/draw/core/renderer/staticScene.d.ts +14 -0
- package/draw/core/renderer/staticScene.js +106 -0
- package/draw/core/renderer/staticSvgScene.d.ts +5 -0
- package/draw/core/renderer/staticSvgScene.js +200 -0
- package/draw/core/scene/Renderer.d.ts +30 -0
- package/draw/core/scene/Renderer.js +55 -0
- package/draw/core/scene/export.d.ts +35 -0
- package/draw/core/scene/export.js +198 -0
- package/draw/core/scene/index.d.ts +3 -0
- package/draw/core/scene/index.js +7 -0
- package/draw/core/scene/normalize.d.ts +4 -0
- package/draw/core/scene/normalize.js +10 -0
- package/draw/core/scene/scroll.d.ts +18 -0
- package/draw/core/scene/scroll.js +52 -0
- package/draw/core/scene/scrollbars.d.ts +11 -0
- package/draw/core/scene/scrollbars.js +44 -0
- package/draw/core/scene/types.d.ts +138 -0
- package/draw/core/scene/zoom.d.ts +12 -0
- package/draw/core/scene/zoom.js +13 -0
- package/draw/core/shortcut.d.ts +1 -0
- package/draw/core/shortcut.js +9 -0
- package/draw/core/snapping.d.ts +109 -0
- package/draw/core/snapping.js +544 -0
- package/draw/core/workers.d.ts +28 -0
- package/draw/core/wysiwyg/textWysiwyg.d.ts +24 -0
- package/draw/core/wysiwyg/textWysiwyg.js +223 -0
- package/draw/element/Scene.d.ts +66 -0
- package/draw/element/Scene.js +157 -0
- package/draw/element/align.d.ts +8 -0
- package/draw/element/align.js +36 -0
- package/draw/element/arrows/focus.d.ts +27 -0
- package/draw/element/arrows/focus.js +142 -0
- package/draw/element/arrows/helpers.d.ts +6 -0
- package/draw/element/arrows/helpers.js +16 -0
- package/draw/element/binding.d.ts +128 -0
- package/draw/element/binding.js +550 -0
- package/draw/element/bounds.d.ts +79 -0
- package/draw/element/bounds.js +492 -0
- package/draw/element/collision.d.ts +37 -0
- package/draw/element/collision.js +179 -0
- package/draw/element/comparisons.d.ts +8 -0
- package/draw/element/comparisons.js +6 -0
- package/draw/element/containerCache.d.ts +11 -0
- package/draw/element/containerCache.js +11 -0
- package/draw/element/cropElement.d.ts +19 -0
- package/draw/element/cropElement.js +165 -0
- package/draw/element/delta.d.ts +166 -0
- package/draw/element/delta.js +544 -0
- package/draw/element/distance.d.ts +3 -0
- package/draw/element/distance.js +41 -0
- package/draw/element/distribute.d.ts +8 -0
- package/draw/element/distribute.js +53 -0
- package/draw/element/dragElements.d.ts +33 -0
- package/draw/element/dragElements.js +93 -0
- package/draw/element/duplicate.d.ts +63 -0
- package/draw/element/duplicate.js +107 -0
- package/draw/element/elbowArrow.d.ts +16 -0
- package/draw/element/elbowArrow.js +555 -0
- package/draw/element/elementLink.d.ts +13 -0
- package/draw/element/elementLink.js +50 -0
- package/draw/element/embeddable.d.ts +6 -0
- package/draw/element/embeddable.js +58 -0
- package/draw/element/flowchart.d.ts +22 -0
- package/draw/element/flowchart.js +246 -0
- package/draw/element/fractionalIndex.d.ts +57 -0
- package/draw/element/fractionalIndex.js +102 -0
- package/draw/element/frame.d.ts +74 -0
- package/draw/element/frame.js +194 -0
- package/draw/element/groups.d.ts +34 -0
- package/draw/element/groups.js +137 -0
- package/draw/element/heading.d.ts +16 -0
- package/draw/element/heading.js +38 -0
- package/draw/element/image.d.ts +22 -0
- package/draw/element/image.js +59 -0
- package/draw/element/index.d.ts +58 -0
- package/draw/element/index.js +65 -0
- package/draw/element/is.d.ts +2 -0
- package/draw/element/is.js +6 -0
- package/draw/element/linearElementEditor.d.ts +114 -0
- package/draw/element/linearElementEditor.js +602 -0
- package/draw/element/mutateElement.d.ts +23 -0
- package/draw/element/mutateElement.js +68 -0
- package/draw/element/newElement.d.ts +62 -0
- package/draw/element/newElement.js +165 -0
- package/draw/element/positionElementsOnGrid.d.ts +2 -0
- package/draw/element/positionElementsOnGrid.js +47 -0
- package/draw/element/renderElement.d.ts +25 -0
- package/draw/element/renderElement.js +235 -0
- package/draw/element/resizeElements.d.ts +32 -0
- package/draw/element/resizeElements.js +401 -0
- package/draw/element/resizeTest.d.ts +15 -0
- package/draw/element/resizeTest.js +93 -0
- package/draw/element/selection.d.ts +474 -0
- package/draw/element/selection.js +75 -0
- package/draw/element/shape.d.ts +41 -0
- package/draw/element/shape.js +366 -0
- package/draw/element/showSelectedShapeActions.d.ts +3 -0
- package/draw/element/showSelectedShapeActions.js +7 -0
- package/draw/element/sizeHelpers.d.ts +35 -0
- package/draw/element/sizeHelpers.js +74 -0
- package/draw/element/sortElements.d.ts +2 -0
- package/draw/element/sortElements.js +31 -0
- package/draw/element/store.d.ts +196 -0
- package/draw/element/store.js +332 -0
- package/draw/element/textElement.d.ts +40 -0
- package/draw/element/textElement.js +131 -0
- package/draw/element/textMeasurements.d.ts +39 -0
- package/draw/element/textMeasurements.js +66 -0
- package/draw/element/textWrapping.d.ts +13 -0
- package/draw/element/textWrapping.js +149 -0
- package/draw/element/transform.d.ts +81 -0
- package/draw/element/transform.js +288 -0
- package/draw/element/transformHandles.d.ts +35 -0
- package/draw/element/transformHandles.js +67 -0
- package/draw/element/typeChecks.d.ts +54 -0
- package/draw/element/typeChecks.js +30 -0
- package/draw/element/types.d.ts +291 -0
- package/draw/element/utils.d.ts +33 -0
- package/draw/element/utils.js +137 -0
- package/draw/element/visualdebug.d.ts +58 -0
- package/draw/element/zindex.d.ts +13 -0
- package/draw/element/zindex.js +149 -0
- package/draw/index.d.ts +48 -2
- package/draw/index.js +63 -4
- package/draw/interface.d.ts +707 -1
- package/draw/libs/browser-fs-access/directory-open.d.mts +5 -0
- package/draw/libs/browser-fs-access/directory-open.js +12 -0
- package/draw/libs/browser-fs-access/file-open.d.mts +5 -0
- package/draw/libs/browser-fs-access/file-open.js +12 -0
- package/draw/libs/browser-fs-access/file-save.d.mts +5 -0
- package/draw/libs/browser-fs-access/file-save.js +12 -0
- package/draw/libs/browser-fs-access/fs-access/directory-open.d.mts +8 -0
- package/draw/libs/browser-fs-access/fs-access/directory-open.js +25 -0
- package/draw/libs/browser-fs-access/fs-access/file-open.d.mts +2 -0
- package/draw/libs/browser-fs-access/fs-access/file-open.js +28 -0
- package/draw/libs/browser-fs-access/fs-access/file-save.d.mts +2 -0
- package/draw/libs/browser-fs-access/fs-access/file-save.js +31 -0
- package/draw/libs/browser-fs-access/index.d.ts +10 -0
- package/draw/libs/browser-fs-access/index.js +28 -0
- package/draw/libs/browser-fs-access/legacy/directory-open.d.mts +8 -0
- package/draw/libs/browser-fs-access/legacy/directory-open.js +18 -0
- package/draw/libs/browser-fs-access/legacy/file-open.d.mts +2 -0
- package/draw/libs/browser-fs-access/legacy/file-open.js +15 -0
- package/draw/libs/browser-fs-access/legacy/file-save.d.mts +2 -0
- package/draw/libs/browser-fs-access/legacy/file-save.js +31 -0
- package/draw/libs/browser-fs-access/supported.d.mts +22 -0
- package/draw/libs/browser-fs-access/supported.js +14 -0
- package/draw/libs/canvas-roundrect-polyfill/LICENSE +21 -0
- package/draw/libs/canvas-roundrect-polyfill/index.d.ts +2 -0
- package/draw/libs/canvas-roundrect-polyfill/index.js +74 -0
- package/draw/libs/fractional-indexing/index.d.ts +23 -0
- package/draw/libs/fractional-indexing/index.js +110 -0
- package/draw/libs/fuzzy/index.d.ts +10 -0
- package/draw/libs/fuzzy/index.js +40 -0
- package/draw/libs/glur/LICENSE +20 -0
- package/draw/libs/glur/index.d.ts +2 -0
- package/draw/libs/glur/index.js +37 -0
- package/draw/libs/glur/mono16.d.ts +2 -0
- package/draw/libs/glur/mono16.js +33 -0
- package/draw/libs/hachure-fill/index.d.ts +4 -0
- package/draw/libs/hachure-fill/index.js +79 -0
- package/draw/libs/image-blob-reduce/index.d.ts +36 -0
- package/draw/libs/image-blob-reduce/index.js +96 -0
- package/draw/libs/image-blob-reduce/lib/image_traverse.d.ts +6 -0
- package/draw/libs/image-blob-reduce/lib/image_traverse.js +212 -0
- package/draw/libs/image-blob-reduce/lib/jpeg_plugins.d.ts +11 -0
- package/draw/libs/image-blob-reduce/lib/jpeg_plugins.js +57 -0
- package/draw/libs/image-blob-reduce/lib/utils.d.ts +14 -0
- package/draw/libs/image-blob-reduce/lib/utils.js +21 -0
- package/draw/libs/jotai/index.d.ts +2 -0
- package/draw/libs/jotai/index.js +24 -0
- package/draw/libs/jotai/react/Provider.d.ts +16 -0
- package/draw/libs/jotai/react/Provider.js +16 -0
- package/draw/libs/jotai/react/useAtom.d.ts +13 -0
- package/draw/libs/jotai/react/useAtom.js +10 -0
- package/draw/libs/jotai/react/useAtomValue.d.ts +9 -0
- package/draw/libs/jotai/react/useAtomValue.js +73 -0
- package/draw/libs/jotai/react/useSetAtom.d.ts +7 -0
- package/draw/libs/jotai/react/useSetAtom.js +11 -0
- package/draw/libs/jotai/react/utils/useAtomCallback.d.ts +5 -0
- package/draw/libs/jotai/react/utils/useAtomCallback.js +4 -0
- package/draw/libs/jotai/react/utils/useHydrateAtoms.d.ts +14 -0
- package/draw/libs/jotai/react/utils/useHydrateAtoms.js +16 -0
- package/draw/libs/jotai/react/utils/useReducerAtom.d.ts +14 -0
- package/draw/libs/jotai/react/utils/useReducerAtom.js +4 -0
- package/draw/libs/jotai/react/utils/useResetAtom.d.ts +6 -0
- package/draw/libs/jotai/react/utils/useResetAtom.js +5 -0
- package/draw/libs/jotai/react/utils.d.ts +4 -0
- package/draw/libs/jotai/react/utils.js +6 -0
- package/draw/libs/jotai/react.d.ts +4 -0
- package/draw/libs/jotai/react.js +6 -0
- package/draw/libs/jotai/utils.d.ts +2 -0
- package/draw/libs/jotai/utils.js +6 -0
- package/draw/libs/jotai/vanilla/atom.d.ts +47 -0
- package/draw/libs/jotai/vanilla/atom.js +18 -0
- package/draw/libs/jotai/vanilla/internals.d.ts +165 -0
- package/draw/libs/jotai/vanilla/internals.js +303 -0
- package/draw/libs/jotai/vanilla/store.d.ts +5 -0
- package/draw/libs/jotai/vanilla/store.js +17 -0
- package/draw/libs/jotai/vanilla/typeUtils.d.ts +7 -0
- package/draw/libs/jotai/vanilla/utils/atomFamily.d.ts +55 -0
- package/draw/libs/jotai/vanilla/utils/atomFamily.js +3 -0
- package/draw/libs/jotai/vanilla/utils/atomWithDefault.d.ts +6 -0
- package/draw/libs/jotai/vanilla/utils/atomWithLazy.d.ts +2 -0
- package/draw/libs/jotai/vanilla/utils/atomWithObservable.d.ts +32 -0
- package/draw/libs/jotai/vanilla/utils/atomWithReducer.d.ts +3 -0
- package/draw/libs/jotai/vanilla/utils/atomWithRefresh.d.ts +6 -0
- package/draw/libs/jotai/vanilla/utils/atomWithReset.d.ts +8 -0
- package/draw/libs/jotai/vanilla/utils/atomWithStorage.d.ts +50 -0
- package/draw/libs/jotai/vanilla/utils/atomWithStorage.js +53 -0
- package/draw/libs/jotai/vanilla/utils/constants.d.ts +1 -0
- package/draw/libs/jotai/vanilla/utils/freezeAtom.d.ts +6 -0
- package/draw/libs/jotai/vanilla/utils/loadable.d.ts +33 -0
- package/draw/libs/jotai/vanilla/utils/selectAtom.d.ts +2 -0
- package/draw/libs/jotai/vanilla/utils/splitAtom.d.ts +16 -0
- package/draw/libs/jotai/vanilla/utils/unwrap.d.ts +5 -0
- package/draw/libs/jotai/vanilla/utils.d.ts +14 -0
- package/draw/libs/jotai/vanilla/utils.js +4 -0
- package/draw/libs/jotai/vanilla.d.ts +4 -0
- package/draw/libs/jotai-scope/ScopeProvider/index.d.ts +27 -0
- package/draw/libs/jotai-scope/ScopeProvider/index.js +47 -0
- package/draw/libs/jotai-scope/ScopeProvider/scope.d.ts +16 -0
- package/draw/libs/jotai-scope/ScopeProvider/scope.js +264 -0
- package/draw/libs/jotai-scope/createIsolation.d.ts +19 -0
- package/draw/libs/jotai-scope/createIsolation.js +50 -0
- package/draw/libs/jotai-scope/index.d.ts +3 -0
- package/draw/libs/jotai-scope/index.js +14 -0
- package/draw/libs/jotai-scope/types.d.ts +53 -0
- package/draw/libs/jotai-scope/utils.d.ts +6 -0
- package/draw/libs/jotai-scope/utils.js +12 -0
- package/draw/libs/laser-pointer/index.d.ts +2 -0
- package/draw/libs/laser-pointer/index.js +8 -0
- package/draw/libs/laser-pointer/math.d.ts +16 -0
- package/draw/libs/laser-pointer/math.js +72 -0
- package/draw/libs/laser-pointer/simplify.d.ts +2 -0
- package/draw/libs/laser-pointer/simplify.js +29 -0
- package/draw/libs/laser-pointer/state.d.ts +31 -0
- package/draw/libs/laser-pointer/state.js +155 -0
- package/draw/libs/markdown-to-text/index.d.ts +20 -0
- package/draw/libs/markdown-to-text/index.js +17 -0
- package/draw/libs/math/angle.d.ts +19 -0
- package/draw/libs/math/angle.js +24 -0
- package/draw/libs/math/constants.d.ts +3 -0
- package/draw/libs/math/constants.js +56 -0
- package/draw/libs/math/curve.d.ts +74 -0
- package/draw/libs/math/curve.js +126 -0
- package/draw/libs/math/ellipse.d.ts +44 -0
- package/draw/libs/math/ellipse.js +44 -0
- package/draw/libs/math/index.d.ts +13 -0
- package/draw/libs/math/index.js +105 -0
- package/draw/libs/math/line.d.ts +17 -0
- package/draw/libs/math/line.js +17 -0
- package/draw/libs/math/point.d.ts +122 -0
- package/draw/libs/math/point.js +48 -0
- package/draw/libs/math/polygon.d.ts +6 -0
- package/draw/libs/math/polygon.js +42 -0
- package/draw/libs/math/range.d.ts +42 -0
- package/draw/libs/math/range.js +17 -0
- package/draw/libs/math/rectangle.d.ts +5 -0
- package/draw/libs/math/rectangle.js +25 -0
- package/draw/libs/math/segment.d.ts +40 -0
- package/draw/libs/math/segment.js +38 -0
- package/draw/libs/math/triangle.d.ts +11 -0
- package/draw/libs/math/triangle.js +9 -0
- package/draw/libs/math/types.d.ts +106 -0
- package/draw/libs/math/utils.d.ts +7 -0
- package/draw/libs/math/utils.js +12 -0
- package/draw/libs/math/vector.d.ts +94 -0
- package/draw/libs/math/vector.js +41 -0
- package/draw/libs/multimath/index.d.ts +21 -0
- package/draw/libs/multimath/index.js +66 -0
- package/draw/libs/multimath/lib/base64decode.d.ts +1 -0
- package/draw/libs/multimath/lib/base64decode.js +8 -0
- package/draw/libs/multimath/lib/wa_detect.d.ts +1 -0
- package/draw/libs/multimath/lib/wa_detect.js +68 -0
- package/draw/libs/nanoid/index.d.ts +5 -0
- package/draw/libs/nanoid/index.js +23 -0
- package/draw/libs/nanoid/nanoid.d.ts +1 -0
- package/draw/libs/nanoid/url-alphabet/index.d.ts +1 -0
- package/draw/libs/nanoid/url-alphabet/index.js +6 -0
- package/draw/libs/pako/index.d.ts +323 -0
- package/draw/libs/pako/index.js +1445 -0
- package/draw/libs/path-data-parser/absolutize.d.ts +2 -0
- package/draw/libs/path-data-parser/absolutize.js +140 -0
- package/draw/libs/path-data-parser/index.d.ts +3 -0
- package/draw/libs/path-data-parser/index.js +15 -0
- package/draw/libs/path-data-parser/normalize.d.ts +2 -0
- package/draw/libs/path-data-parser/normalize.js +168 -0
- package/draw/libs/path-data-parser/parser.d.ts +6 -0
- package/draw/libs/path-data-parser/parser.js +90 -0
- package/draw/libs/perfect-freehand/getStroke.d.ts +20 -0
- package/draw/libs/perfect-freehand/getStroke.js +10 -0
- package/draw/libs/perfect-freehand/getStrokeOutlinePoints.d.ts +16 -0
- package/draw/libs/perfect-freehand/getStrokeOutlinePoints.js +73 -0
- package/draw/libs/perfect-freehand/getStrokePoints.d.ts +20 -0
- package/draw/libs/perfect-freehand/getStrokePoints.js +45 -0
- package/draw/libs/perfect-freehand/getStrokeRadius.d.ts +9 -0
- package/draw/libs/perfect-freehand/getStrokeRadius.js +8 -0
- package/draw/libs/perfect-freehand/index.d.ts +6 -0
- package/draw/libs/perfect-freehand/index.js +15 -0
- package/draw/libs/perfect-freehand/types.d.ts +42 -0
- package/draw/libs/perfect-freehand/vec.d.ts +117 -0
- package/draw/libs/perfect-freehand/vec.js +54 -0
- package/draw/libs/pica/index.d.ts +29 -0
- package/draw/libs/pica/index.js +250 -0
- package/draw/libs/pica/lib/mathlib.d.ts +10 -0
- package/draw/libs/pica/lib/mathlib.js +22 -0
- package/draw/libs/pica/lib/mm_resize/convolve.d.ts +11 -0
- package/draw/libs/pica/lib/mm_resize/convolve.js +51 -0
- package/draw/libs/pica/lib/mm_resize/convolve_wasm_base64.d.ts +2 -0
- package/draw/libs/pica/lib/mm_resize/convolve_wasm_base64.js +6 -0
- package/draw/libs/pica/lib/mm_resize/index.d.ts +11 -0
- package/draw/libs/pica/lib/mm_resize/index.js +14 -0
- package/draw/libs/pica/lib/mm_resize/resize.d.ts +1 -0
- package/draw/libs/pica/lib/mm_resize/resize.js +23 -0
- package/draw/libs/pica/lib/mm_resize/resize_filter_gen.d.ts +1 -0
- package/draw/libs/pica/lib/mm_resize/resize_filter_gen.js +24 -0
- package/draw/libs/pica/lib/mm_resize/resize_filter_info.d.ts +45 -0
- package/draw/libs/pica/lib/mm_resize/resize_filter_info.js +58 -0
- package/draw/libs/pica/lib/mm_resize/resize_wasm.d.ts +1 -0
- package/draw/libs/pica/lib/mm_resize/resize_wasm.js +46 -0
- package/draw/libs/pica/lib/mm_unsharp_mask/index.d.ts +10 -0
- package/draw/libs/pica/lib/mm_unsharp_mask/index.js +14 -0
- package/draw/libs/pica/lib/mm_unsharp_mask/unsharp_mask.d.ts +1 -0
- package/draw/libs/pica/lib/mm_unsharp_mask/unsharp_mask.js +19 -0
- package/draw/libs/pica/lib/mm_unsharp_mask/unsharp_mask_wasm.d.ts +1 -0
- package/draw/libs/pica/lib/mm_unsharp_mask/unsharp_mask_wasm.js +14 -0
- package/draw/libs/pica/lib/mm_unsharp_mask/unsharp_mask_wasm_base64.d.ts +2 -0
- package/draw/libs/pica/lib/mm_unsharp_mask/unsharp_mask_wasm_base64.js +6 -0
- package/draw/libs/pica/lib/pool.d.ts +14 -0
- package/draw/libs/pica/lib/pool.js +18 -0
- package/draw/libs/pica/lib/stepper.d.ts +1 -0
- package/draw/libs/pica/lib/stepper.js +15 -0
- package/draw/libs/pica/lib/tiler.d.ts +18 -0
- package/draw/libs/pica/lib/tiler.js +38 -0
- package/draw/libs/pica/lib/utils.d.ts +9 -0
- package/draw/libs/pica/lib/utils.js +91 -0
- package/draw/libs/pica/lib/worker.d.ts +1 -0
- package/draw/libs/pica/lib/worker.js +19 -0
- package/draw/libs/png-chunk-text/decode.d.ts +5 -0
- package/draw/libs/png-chunk-text/decode.js +18 -0
- package/draw/libs/png-chunk-text/encode.d.ts +5 -0
- package/draw/libs/png-chunk-text/encode.js +22 -0
- package/draw/libs/png-chunk-text/index.d.ts +8 -0
- package/draw/libs/png-chunk-text/index.js +16 -0
- package/draw/libs/png-chunks-encode/index.d.ts +2 -0
- package/draw/libs/png-chunks-encode/index.js +30 -0
- package/draw/libs/png-chunks-extract/index.d.ts +5 -0
- package/draw/libs/png-chunks-extract/index.js +39 -0
- package/draw/libs/points-on-curve/curve-to-bezier.d.ts +2 -0
- package/draw/libs/points-on-curve/curve-to-bezier.js +26 -0
- package/draw/libs/points-on-curve/index.d.ts +4 -0
- package/draw/libs/points-on-curve/index.js +73 -0
- package/draw/libs/points-on-path/index.d.ts +3 -0
- package/draw/libs/points-on-path/index.js +43 -0
- package/draw/libs/promise-pool/LICENSE +19 -0
- package/draw/libs/promise-pool/index.js +93 -0
- package/draw/libs/roughjs/canvas.d.ts +19 -0
- package/draw/libs/roughjs/canvas.js +95 -0
- package/draw/libs/roughjs/core.d.ts +85 -0
- package/draw/libs/roughjs/core.js +6 -0
- package/draw/libs/roughjs/fillers/dashed-filler.d.ts +8 -0
- package/draw/libs/roughjs/fillers/dashed-filler.js +32 -0
- package/draw/libs/roughjs/fillers/dot-filler.d.ts +8 -0
- package/draw/libs/roughjs/fillers/dot-filler.js +36 -0
- package/draw/libs/roughjs/fillers/filler-interface.d.ts +11 -0
- package/draw/libs/roughjs/fillers/filler.d.ts +3 -0
- package/draw/libs/roughjs/fillers/filler.js +36 -0
- package/draw/libs/roughjs/fillers/hachure-filler.d.ts +10 -0
- package/draw/libs/roughjs/fillers/hachure-filler.js +27 -0
- package/draw/libs/roughjs/fillers/hatch-filler.d.ts +6 -0
- package/draw/libs/roughjs/fillers/hatch-filler.js +12 -0
- package/draw/libs/roughjs/fillers/index.d.ts +9 -0
- package/draw/libs/roughjs/fillers/scan-line-hachure.d.ts +3 -0
- package/draw/libs/roughjs/fillers/scan-line-hachure.js +12 -0
- package/draw/libs/roughjs/fillers/zigzag-filler.d.ts +6 -0
- package/draw/libs/roughjs/fillers/zigzag-filler.js +20 -0
- package/draw/libs/roughjs/fillers/zigzag-line-filler.d.ts +8 -0
- package/draw/libs/roughjs/fillers/zigzag-line-filler.js +34 -0
- package/draw/libs/roughjs/generator.d.ts +19 -0
- package/draw/libs/roughjs/generator.js +204 -0
- package/draw/libs/roughjs/geometry.d.ts +9 -0
- package/draw/libs/roughjs/geometry.js +9 -0
- package/draw/libs/roughjs/index.d.ts +9 -0
- package/draw/libs/roughjs/index.js +54 -0
- package/draw/libs/roughjs/math.d.ts +6 -0
- package/draw/libs/roughjs/math.js +17 -0
- package/draw/libs/roughjs/renderer.d.ts +28 -0
- package/draw/libs/roughjs/renderer.js +336 -0
- package/draw/libs/roughjs/rough.d.ts +11 -0
- package/draw/libs/roughjs/rough.js +22 -0
- package/draw/libs/roughjs/svg.d.ts +20 -0
- package/draw/libs/roughjs/svg.js +84 -0
- package/draw/libs/sliced/index.d.ts +9 -0
- package/draw/libs/sliced/index.js +14 -0
- package/draw/libs/webworkify/index.d.ts +3 -0
- package/draw/libs/webworkify/index.js +18 -0
- package/draw/style/index.css +1 -0
- package/draw/style/index.d.ts +1 -0
- package/draw/style/index.js +3 -0
- package/draw/utils/bbox.d.ts +9 -0
- package/draw/utils/bbox.js +32 -0
- package/draw/utils/export.d.ts +36 -0
- package/draw/utils/export.js +77 -0
- package/draw/utils/index.d.ts +12 -0
- package/draw/utils/index.js +22 -0
- package/draw/utils/shape.d.ts +57 -0
- package/draw/utils/shape.js +81 -0
- package/draw/utils/withinBounds.d.ts +19 -0
- package/draw/utils/withinBounds.js +61 -0
- package/drawer/Drawer.js +95 -103
- package/drawer/constants.d.ts +4 -0
- package/drawer/constants.js +6 -0
- package/drawer/context.d.ts +3 -0
- package/drawer/context.js +19 -0
- package/drawer/index.d.ts +2 -0
- package/drawer/index.js +9 -6
- package/drawer/style/index.css +1 -0
- package/drawer/style/index.d.ts +2 -0
- package/drawer/style/index.js +4 -0
- package/drawer/use-drawer/Hook.js +11 -9
- package/drawer/use-drawer/index.js +1 -1
- package/dropdown/Button.d.ts +1 -1
- package/dropdown/Button.js +2 -2
- package/dropdown/Dropdown.js +55 -55
- package/dropdown/constants.d.ts +0 -0
- package/dropdown/constants.js +2 -0
- package/dropdown/context.d.ts +3 -0
- package/dropdown/context.js +11 -0
- package/dropdown/index.d.ts +3 -1
- package/dropdown/index.js +9 -6
- package/dropdown/style/index.css +1 -0
- package/dropdown/style/index.d.ts +3 -0
- package/dropdown/style/index.js +5 -0
- package/empty/Empty.js +22 -18
- package/empty/constants.d.ts +0 -0
- package/empty/constants.js +2 -0
- package/empty/context.d.ts +3 -0
- package/empty/context.js +7 -0
- package/empty/index.d.ts +2 -0
- package/empty/index.js +9 -4
- package/empty/style/index.css +1 -0
- package/empty/style/index.d.ts +1 -0
- package/empty/style/index.js +3 -0
- package/flex/Flex.js +24 -20
- package/flex/constants.d.ts +0 -0
- package/flex/constants.js +2 -0
- package/flex/context.d.ts +3 -0
- package/flex/context.js +7 -0
- package/flex/index.d.ts +2 -0
- package/flex/index.js +8 -5
- package/flex/style/index.d.ts +1 -0
- package/flex/style/index.js +3 -0
- package/form/Control.d.ts +31 -32
- package/form/Control.js +248 -200
- package/form/Form.js +78 -90
- package/form/Item.js +192 -0
- package/form/ItemLabel.js +48 -0
- package/form/ItemTip.js +41 -0
- package/form/LabelSymbol.js +20 -0
- package/form/List.js +83 -0
- package/form/Provider.js +29 -0
- package/form/constants.js +9 -0
- package/form/context.d.ts +3 -1
- package/form/context.js +19 -5
- package/form/hooks/useForm.js +56 -0
- package/form/hooks/useFormContext.js +34 -0
- package/form/hooks/useFormState.js +31 -0
- package/form/hooks/useWatch.js +34 -0
- package/form/index.d.ts +14 -12
- package/form/index.js +31 -29
- package/form/interface.js +1 -1
- package/form/promisify.js +1 -1
- package/form/store.d.ts +1 -1
- package/form/store.js +36 -36
- package/form/style/index.css +1 -0
- package/form/style/index.d.ts +2 -0
- package/form/style/index.js +4 -0
- package/form/utils.js +14 -14
- package/global-provider/GlobalProvider.js +1 -1
- package/global-provider/constants.d.ts +0 -0
- package/global-provider/constants.js +2 -0
- package/global-provider/context.js +1 -1
- package/global-provider/index.d.ts +1 -0
- package/global-provider/index.js +2 -1
- package/global-provider/style/index.d.ts +1 -0
- package/global-provider/style/index.js +3 -0
- package/grid/Grid.js +33 -34
- package/grid/Item.d.ts +1 -1
- package/grid/Item.js +3 -3
- package/grid/constants.d.ts +0 -0
- package/grid/constants.js +2 -0
- package/grid/context.d.ts +2 -0
- package/grid/context.js +8 -3
- package/grid/index.d.ts +4 -1
- package/grid/index.js +9 -7
- package/grid/style/index.css +1 -0
- package/grid/style/index.d.ts +1 -0
- package/grid/style/index.js +3 -0
- package/grid/utils.js +1 -1
- package/hooks/index.js +1 -1
- package/hooks/use-breakpoint/index.js +1 -1
- package/hooks/use-computed-state/index.js +1 -1
- package/hooks/use-controllable-value/index.js +1 -1
- package/hooks/use-create/index.js +1 -1
- package/hooks/use-creation/index.js +1 -1
- package/hooks/use-effect-event/index.js +1 -1
- package/hooks/use-event/index.js +1 -1
- package/hooks/use-event-listener/index.js +1 -1
- package/hooks/use-force-update/index.js +1 -1
- package/hooks/use-fullscreen/index.js +1 -1
- package/hooks/use-id/index.js +1 -1
- package/hooks/use-intersection-observer/index.js +1 -1
- package/hooks/use-intersection-observers/index.js +1 -1
- package/hooks/use-interval/index.js +1 -1
- package/hooks/use-is-first-render/index.js +1 -1
- package/hooks/use-isomorphic-layout-effect/index.js +1 -1
- package/hooks/use-keyboard-event/index.js +1 -1
- package/hooks/use-latest/index.js +1 -1
- package/hooks/use-listen-window-resize/index.js +1 -1
- package/hooks/use-media/index.js +1 -1
- package/hooks/use-memoized-fn/index.js +1 -1
- package/hooks/use-merge-props/index.js +1 -1
- package/hooks/use-move/index.js +1 -1
- package/hooks/use-mutation-observers/index.js +1 -1
- package/hooks/use-online-status/index.js +1 -1
- package/hooks/use-overflow-hidden/index.js +1 -1
- package/hooks/use-override-ref/index.js +1 -1
- package/hooks/use-persist-callback/index.js +1 -1
- package/hooks/use-prefers-color-scheme-dark/index.js +1 -1
- package/hooks/use-previous/index.js +1 -1
- package/hooks/use-refs/index.js +1 -1
- package/hooks/use-resize-observer/index.js +1 -1
- package/hooks/use-resize-observers/index.js +1 -1
- package/hooks/use-responsive-state/index.js +1 -1
- package/hooks/use-set-state/index.js +1 -1
- package/hooks/use-state-callback/index.js +1 -1
- package/hooks/use-state-with-promise/index.js +1 -1
- package/hooks/use-update-effect/index.js +1 -1
- package/hooks/use-update-layout-effect/index.js +1 -1
- package/hooks/use-verification-code/index.js +1 -1
- package/hooks/use-watch/index.js +1 -1
- package/hooks/use-watermark/index.js +18 -18
- package/hooks/use-watermark/utils.js +1 -1
- package/hooks/use-window-size/index.js +1 -1
- package/hooks/useUnmountOnExit.js +1 -1
- package/icon/Icon.d.ts +2 -4
- package/icon/Icon.js +22 -23
- package/icon/addIconFromCdn.js +1 -1
- package/icon/constants.d.ts +0 -0
- package/icon/constants.js +2 -0
- package/icon/context.d.ts +3 -0
- package/icon/context.js +11 -0
- package/icon/index.d.ts +12 -1
- package/icon/index.js +12 -9
- package/icon/style/index.css +1 -0
- package/icon/style/index.d.ts +1 -0
- package/icon/style/index.js +3 -0
- package/icon-hover/IconHover.js +26 -24
- package/icon-hover/constants.d.ts +0 -0
- package/icon-hover/constants.js +2 -0
- package/icon-hover/context.d.ts +3 -0
- package/icon-hover/context.js +7 -0
- package/icon-hover/index.d.ts +2 -0
- package/icon-hover/index.js +9 -4
- package/icon-hover/style/index.css +1 -0
- package/icon-hover/style/index.d.ts +1 -0
- package/icon-hover/style/index.js +3 -0
- package/icons/file/File.js +20 -16
- package/icons/file/constants.d.ts +0 -0
- package/icons/file/context.d.ts +3 -0
- package/icons/file/context.js +7 -0
- package/icons/file/index.d.ts +1 -0
- package/icons/file/index.js +3 -2
- package/icons/file/style/index.d.ts +0 -1
- package/icons/file/style/index.js +3 -0
- package/icons.js +1 -1
- package/image/Footer.d.ts +13 -0
- package/image/Footer.js +58 -0
- package/image/Image.js +66 -66
- package/image/Preview.js +371 -0
- package/image/PreviewArrow.js +30 -0
- package/image/PreviewGroup.js +112 -0
- package/image/PreviewToolbar.js +61 -0
- package/image/TriggerForToolbar.js +1 -1
- package/image/constants.d.ts +0 -0
- package/image/constants.js +2 -0
- package/image/context.d.ts +5 -1
- package/image/context.js +31 -5
- package/image/hooks/useImageStatus.js +18 -0
- package/image/hooks/useShowFooter.js +13 -0
- package/image/index.d.ts +6 -4
- package/image/index.js +11 -9
- package/image/style/index.css +1 -0
- package/image/style/index.d.ts +1 -0
- package/image/style/index.js +3 -0
- package/image/utils/getFixTranslate.js +1 -1
- package/image/utils/getScale.js +1 -1
- package/index.d.ts +0 -2
- package/index.js +485 -505
- package/input/Button.js +2 -2
- package/input/Core.js +8 -6
- package/input/Group.js +2 -2
- package/input/Input.js +52 -48
- package/input/Password.js +2 -2
- package/input/Search.js +2 -2
- package/input/Textarea.js +2 -2
- package/input/autoSizeTextareaHeight.js +1 -1
- package/input/constants.js +1 -1
- package/input/context.d.ts +3 -0
- package/input/context.js +7 -0
- package/input/index.d.ts +4 -0
- package/input/index.js +23 -24
- package/input/style/index.css +1 -0
- package/input/style/index.d.ts +2 -0
- package/input/style/index.js +4 -0
- package/input/useComposition.js +1 -1
- package/input/utils.js +1 -1
- package/input-number/InputNumber.js +56 -58
- package/input-number/constants.d.ts +0 -0
- package/input-number/constants.js +2 -0
- package/input-number/context.d.ts +3 -0
- package/input-number/context.js +13 -0
- package/input-number/decimal.js +1 -1
- package/input-number/hooks/useSelectionRange.js +25 -0
- package/input-number/index.d.ts +2 -0
- package/input-number/index.js +9 -4
- package/input-number/style/index.css +1 -0
- package/input-number/style/index.d.ts +2 -0
- package/input-number/style/index.js +4 -0
- package/input-number/utils.js +1 -1
- package/input-tag/InputTag.js +163 -159
- package/input-tag/constants.js +6 -0
- package/input-tag/context.d.ts +3 -0
- package/input-tag/context.js +7 -0
- package/input-tag/hooks/useComputeAutoWidthDelay.js +12 -0
- package/input-tag/index.d.ts +2 -0
- package/input-tag/index.js +9 -4
- package/input-tag/style/index.css +1 -0
- package/input-tag/style/index.d.ts +2 -0
- package/input-tag/style/index.js +4 -0
- package/layout/Content.js +1 -1
- package/layout/Footer.js +1 -1
- package/layout/Header.js +1 -1
- package/layout/Layout.js +24 -20
- package/layout/Sider.js +3 -3
- package/layout/constants.d.ts +0 -0
- package/layout/constants.js +2 -0
- package/layout/context.d.ts +3 -0
- package/layout/context.js +3 -3
- package/layout/index.d.ts +2 -0
- package/layout/index.js +15 -13
- package/layout/style/index.css +1 -0
- package/layout/style/index.d.ts +3 -0
- package/layout/style/index.js +5 -0
- package/link/Link.js +35 -32
- package/link/constants.d.ts +0 -0
- package/link/constants.js +2 -0
- package/link/context.d.ts +3 -0
- package/link/context.js +7 -0
- package/link/index.d.ts +2 -0
- package/link/index.js +9 -4
- package/link/style/index.css +1 -0
- package/link/style/index.d.ts +1 -0
- package/link/style/index.js +3 -0
- package/liquid-fill/LiquidFill.js +73 -87
- package/liquid-fill/constants.d.ts +0 -0
- package/liquid-fill/constants.js +2 -0
- package/liquid-fill/context.d.ts +3 -0
- package/liquid-fill/context.js +25 -0
- package/liquid-fill/index.d.ts +2 -0
- package/liquid-fill/index.js +9 -4
- package/liquid-fill/style/index.css +1 -0
- package/liquid-fill/style/index.d.ts +1 -0
- package/liquid-fill/style/index.js +3 -0
- package/list/Item.js +2 -2
- package/list/List.js +44 -46
- package/list/Meta.js +1 -1
- package/list/constants.d.ts +0 -0
- package/list/constants.js +2 -0
- package/list/context.d.ts +3 -0
- package/list/context.js +13 -0
- package/list/index.d.ts +2 -0
- package/list/index.js +7 -4
- package/list/style/index.css +1 -0
- package/list/style/index.d.ts +5 -0
- package/list/style/index.js +7 -0
- package/loading/Loading.js +40 -36
- package/loading/constants.d.ts +0 -0
- package/loading/constants.js +2 -0
- package/loading/context.d.ts +3 -0
- package/loading/context.js +7 -0
- package/loading/index.d.ts +2 -0
- package/loading/index.js +9 -4
- package/loading/style/index.d.ts +1 -0
- package/loading/style/index.js +3 -0
- package/locale/ar-EG.js +1 -1
- package/locale/de-DE.js +1 -1
- package/locale/default.js +1 -1
- package/locale/en-US.js +1 -1
- package/locale/es-ES.js +1 -1
- package/locale/fr-FR.js +1 -1
- package/locale/id-ID.js +1 -1
- package/locale/it-IT.js +1 -1
- package/locale/ja-JP.js +20 -20
- package/locale/ko-KR.js +1 -1
- package/locale/ms-MY.js +1 -1
- package/locale/pt-BR.js +1 -1
- package/locale/pt-PT.js +1 -1
- package/locale/ru-RU.js +1 -1
- package/locale/th-TH.js +1 -1
- package/locale/tr-TR.js +1 -1
- package/locale/vi-VN.js +1 -1
- package/locale/zh-CN.js +19 -19
- package/locale/zh-HK.js +20 -20
- package/locale/zh-TW.js +20 -20
- package/marquee/Marquee.js +44 -50
- package/marquee/constants.d.ts +0 -0
- package/marquee/constants.js +2 -0
- package/marquee/context.d.ts +3 -0
- package/marquee/context.js +16 -0
- package/marquee/index.d.ts +2 -0
- package/marquee/index.js +9 -4
- package/marquee/style/index.css +1 -0
- package/marquee/style/index.d.ts +1 -0
- package/marquee/style/index.js +3 -0
- package/mask/Mask.d.ts +1 -3
- package/mask/Mask.js +28 -29
- package/mask/constants.js +10 -0
- package/mask/context.d.ts +3 -0
- package/mask/context.js +11 -0
- package/mask/index.d.ts +3 -3
- package/mask/index.js +9 -4
- package/mask/interface.d.ts +2 -2
- package/mask/style/index.css +1 -0
- package/mask/style/index.d.ts +1 -0
- package/mask/style/index.js +3 -0
- package/masonry/Item.js +1 -1
- package/masonry/Masonry.js +57 -54
- package/masonry/constants.d.ts +0 -0
- package/masonry/constants.js +2 -0
- package/masonry/context.d.ts +3 -0
- package/masonry/context.js +7 -0
- package/masonry/hooks/useDelay.js +1 -1
- package/masonry/hooks/useGutter.js +1 -1
- package/masonry/hooks/usePositions.js +1 -1
- package/masonry/hooks/useRefs.js +1 -1
- package/masonry/index.d.ts +2 -0
- package/masonry/index.js +7 -4
- package/masonry/style/index.css +1 -0
- package/masonry/style/index.d.ts +1 -0
- package/masonry/style/index.js +3 -0
- package/mentions/Mentions.js +37 -39
- package/mentions/constants.d.ts +0 -0
- package/mentions/constants.js +2 -0
- package/mentions/context.d.ts +3 -0
- package/mentions/context.js +13 -0
- package/mentions/index.d.ts +2 -0
- package/mentions/index.js +9 -4
- package/mentions/style/index.css +1 -0
- package/mentions/style/index.d.ts +1 -0
- package/mentions/style/index.js +3 -0
- package/mentions/utils.js +1 -1
- package/menu/Indent.js +1 -1
- package/menu/Item.js +1 -1
- package/menu/ItemGroup.js +1 -1
- package/menu/Menu.js +75 -81
- package/menu/OverflowWrap.js +2 -2
- package/menu/constants.d.ts +0 -0
- package/menu/constants.js +2 -0
- package/menu/context.d.ts +3 -1
- package/menu/context.js +12 -3
- package/menu/index.d.ts +3 -1
- package/menu/index.js +14 -12
- package/menu/style/index.css +1 -0
- package/menu/style/index.d.ts +3 -0
- package/menu/style/index.js +5 -0
- package/menu/sub-menu/Inline.d.ts +2 -1
- package/menu/sub-menu/Inline.js +2 -2
- package/menu/sub-menu/Pop.d.ts +2 -1
- package/menu/sub-menu/Pop.js +3 -3
- package/menu/sub-menu/index.d.ts +1 -1
- package/menu/sub-menu/index.js +2 -2
- package/menu/utils.js +1 -1
- package/message/Message.js +76 -72
- package/message/config.js +1 -1
- package/message/constants.js +1 -1
- package/message/context.d.ts +3 -0
- package/message/context.js +7 -0
- package/message/hooks/useMessage.d.ts +4 -0
- package/message/hooks/useMessage.js +52 -0
- package/message/index.d.ts +3 -1
- package/message/index.js +9 -6
- package/message/interface.d.ts +3 -5
- package/message/style/index.css +1 -0
- package/message/style/index.d.ts +1 -0
- package/message/style/index.js +3 -0
- package/message/utils.js +1 -1
- package/modal/Modal.js +189 -207
- package/modal/config.js +1 -1
- package/modal/confirm.js +12 -12
- package/modal/constants.js +1 -1
- package/modal/context.d.ts +3 -0
- package/modal/context.js +17 -0
- package/modal/index.d.ts +2 -0
- package/modal/index.js +11 -8
- package/modal/interface.d.ts +3 -0
- package/modal/style/index.css +1 -0
- package/modal/style/index.d.ts +2 -0
- package/modal/style/index.js +4 -0
- package/modal/use-modal/Hook.js +11 -9
- package/modal/use-modal/index.js +1 -1
- package/modal/utils.js +1 -1
- package/notice/Notice.js +47 -49
- package/notice/config.js +1 -1
- package/notice/constants.js +1 -1
- package/notice/context.d.ts +3 -0
- package/notice/context.js +13 -0
- package/notice/index.d.ts +2 -0
- package/notice/index.js +10 -7
- package/notice/style/index.d.ts +1 -0
- package/notice/style/index.js +3 -0
- package/notice/utils.js +1 -1
- package/notice/withNotice.js +1 -1
- package/notification/Notification.js +77 -73
- package/notification/config.js +1 -1
- package/notification/constants.js +1 -1
- package/notification/context.d.ts +3 -0
- package/notification/context.js +7 -0
- package/notification/hooks/useNotification.d.ts +4 -0
- package/notification/hooks/useNotification.js +53 -0
- package/notification/index.d.ts +3 -1
- package/notification/index.js +9 -6
- package/notification/style/index.css +1 -0
- package/notification/style/index.d.ts +1 -0
- package/notification/style/index.js +3 -0
- package/notification/utils.js +1 -1
- package/overflow-ellipsis/Item.js +22 -0
- package/overflow-ellipsis/OverflowEllipsis.js +42 -37
- package/overflow-ellipsis/constants.d.ts +0 -0
- package/overflow-ellipsis/constants.js +2 -0
- package/overflow-ellipsis/context.d.ts +3 -0
- package/overflow-ellipsis/context.js +7 -0
- package/overflow-ellipsis/index.d.ts +4 -2
- package/overflow-ellipsis/index.js +10 -5
- package/overflow-ellipsis/style/index.css +1 -0
- package/overflow-ellipsis/style/index.d.ts +1 -0
- package/overflow-ellipsis/style/index.js +3 -0
- package/package.json +1 -1
- package/page-header/PageHeader.js +74 -70
- package/page-header/constants.d.ts +0 -0
- package/page-header/constants.js +2 -0
- package/page-header/context.d.ts +3 -0
- package/page-header/context.js +7 -0
- package/page-header/index.d.ts +2 -0
- package/page-header/index.js +9 -4
- package/page-header/style/index.css +1 -0
- package/page-header/style/index.d.ts +2 -0
- package/page-header/style/index.js +4 -0
- package/pagination/Item.js +2 -2
- package/pagination/Jumper.js +2 -2
- package/pagination/Pagination.js +98 -99
- package/pagination/PreNextButton.js +2 -2
- package/pagination/PreNextJump.js +2 -2
- package/pagination/SizeOption.js +3 -3
- package/pagination/constants.d.ts +0 -0
- package/pagination/constants.js +2 -0
- package/pagination/context.d.ts +3 -0
- package/pagination/context.js +11 -0
- package/pagination/index.d.ts +2 -0
- package/pagination/index.js +10 -5
- package/pagination/interface.js +1 -1
- package/pagination/style/index.css +1 -0
- package/pagination/style/index.d.ts +3 -0
- package/pagination/style/index.js +5 -0
- package/pagination/utils.js +1 -1
- package/picker/Input.js +1 -1
- package/picker/InputRange.js +1 -1
- package/picker/constants.d.ts +0 -0
- package/picker/constants.js +2 -0
- package/picker/context.d.ts +0 -0
- package/picker/context.js +2 -0
- package/picker/index.d.ts +1 -0
- package/picker/index.js +7 -6
- package/picker/style/index.css +1 -0
- package/picker/style/index.d.ts +1 -0
- package/picker/style/index.js +3 -0
- package/popconfirm/Popconfirm.js +40 -43
- package/popconfirm/constants.d.ts +0 -0
- package/popconfirm/constants.js +2 -0
- package/popconfirm/context.d.ts +3 -0
- package/popconfirm/context.js +16 -0
- package/popconfirm/index.d.ts +2 -0
- package/popconfirm/index.js +9 -4
- package/popconfirm/style/index.css +1 -0
- package/popconfirm/style/index.d.ts +4 -0
- package/popconfirm/style/index.js +6 -0
- package/popover/Popover.js +36 -37
- package/popover/constants.d.ts +0 -0
- package/popover/constants.js +2 -0
- package/popover/context.d.ts +3 -0
- package/popover/context.js +11 -0
- package/popover/index.d.ts +2 -0
- package/popover/index.js +9 -4
- package/popover/style/index.css +1 -0
- package/popover/style/index.d.ts +2 -0
- package/popover/style/index.js +4 -0
- package/portal/Portal.js +25 -23
- package/portal/constants.d.ts +0 -0
- package/portal/constants.js +2 -0
- package/portal/context.d.ts +3 -0
- package/portal/context.js +7 -0
- package/portal/index.d.ts +2 -0
- package/portal/index.js +9 -4
- package/portal/style/index.d.ts +1 -0
- package/portal/style/index.js +3 -0
- package/progress/Circle.js +102 -0
- package/progress/Line.js +74 -0
- package/progress/Progress.js +51 -54
- package/progress/Step.js +51 -0
- package/progress/constants.d.ts +0 -0
- package/progress/constants.js +2 -0
- package/progress/context.d.ts +3 -0
- package/progress/context.js +13 -0
- package/progress/index.d.ts +6 -31
- package/progress/index.js +12 -9
- package/progress/style/index.css +1 -0
- package/progress/style/index.d.ts +2 -0
- package/progress/style/index.js +4 -0
- package/qr-code/QRCode.js +31 -37
- package/qr-code/constants.d.ts +0 -0
- package/qr-code/constants.js +2 -0
- package/qr-code/context.d.ts +3 -0
- package/qr-code/context.js +17 -0
- package/qr-code/index.d.ts +2 -0
- package/qr-code/index.js +9 -6
- package/qr-code/src/index.js +1 -1
- package/qr-code/src/qrcodegen.js +1 -1
- package/qr-code/style/index.css +1 -0
- package/qr-code/style/index.d.ts +1 -0
- package/qr-code/style/index.js +3 -0
- package/radio/Group.js +3 -3
- package/radio/GroupBlock.js +3 -3
- package/radio/Radio.js +62 -59
- package/radio/constants.d.ts +0 -0
- package/radio/constants.js +2 -0
- package/radio/context.d.ts +3 -1
- package/radio/context.js +3 -3
- package/radio/index.d.ts +2 -0
- package/radio/index.js +12 -10
- package/radio/style/index.css +1 -0
- package/radio/style/index.d.ts +1 -0
- package/radio/style/index.js +3 -0
- package/rate/Rate.js +32 -33
- package/rate/constants.d.ts +0 -0
- package/rate/constants.js +2 -0
- package/rate/context.d.ts +3 -0
- package/rate/context.js +11 -0
- package/rate/index.d.ts +2 -0
- package/rate/index.js +9 -4
- package/rate/style/index.css +1 -0
- package/rate/style/index.d.ts +2 -0
- package/rate/style/index.js +4 -0
- package/resize-box/ResizeBox.js +75 -76
- package/resize-box/ResizeTrigger.js +1 -1
- package/resize-box/Split.js +13 -13
- package/resize-box/SplitGroup.js +14 -14
- package/resize-box/constants.d.ts +0 -0
- package/resize-box/constants.js +2 -0
- package/resize-box/context.d.ts +3 -0
- package/resize-box/context.js +12 -0
- package/resize-box/index.d.ts +2 -0
- package/resize-box/index.js +11 -8
- package/resize-box/style/index.css +1 -0
- package/resize-box/style/index.d.ts +1 -0
- package/resize-box/style/index.js +3 -0
- package/result/403.js +1 -1
- package/result/404.js +1 -1
- package/result/500.js +1 -1
- package/result/Result.js +57 -53
- package/result/constants.d.ts +0 -0
- package/result/constants.js +2 -0
- package/result/context.d.ts +3 -0
- package/result/context.js +7 -0
- package/result/index.d.ts +2 -0
- package/result/index.js +9 -4
- package/result/style/index.css +1 -0
- package/result/style/index.d.ts +1 -0
- package/result/style/index.js +3 -0
- package/rich-text/RichText.d.ts +1 -1
- package/rich-text/RichText.js +110 -106
- package/rich-text/Toolbar.d.ts +2 -1
- package/rich-text/Toolbar.js +234 -250
- package/rich-text/constants.js +7 -0
- package/rich-text/context.d.ts +3 -0
- package/rich-text/context.js +7 -0
- package/rich-text/index.d.ts +9 -7
- package/rich-text/index.js +25 -22
- package/rich-text/interface.d.ts +4 -2
- package/rich-text/libs/blots/block.js +115 -0
- package/rich-text/libs/blots/break.js +20 -0
- package/rich-text/libs/blots/container.js +8 -0
- package/rich-text/libs/blots/cursor.js +97 -0
- package/rich-text/libs/blots/embed.js +47 -0
- package/rich-text/libs/blots/inline.js +50 -0
- package/rich-text/libs/blots/scroll.js +249 -0
- package/rich-text/libs/blots/text.js +17 -0
- package/rich-text/libs/core/composition.js +38 -0
- package/rich-text/libs/core/editor.js +248 -0
- package/rich-text/libs/core/emitter.d.ts +38 -0
- package/rich-text/libs/core/emitter.js +47 -0
- package/rich-text/libs/core/logger.js +20 -0
- package/rich-text/libs/core/module.js +14 -0
- package/rich-text/libs/core/rich.d.ts +183 -0
- package/rich-text/libs/core/rich.js +369 -0
- package/rich-text/libs/core/selection.js +222 -0
- package/rich-text/libs/core/theme.js +32 -0
- package/rich-text/libs/core/utils/createRegistryWithFormats.js +29 -0
- package/rich-text/libs/core/utils/scrollRectIntoView.js +59 -0
- package/rich-text/libs/delta/AttributeMap.js +37 -0
- package/rich-text/libs/delta/Op.js +10 -0
- package/rich-text/libs/delta/OpIterator.js +45 -0
- package/rich-text/libs/delta/index.js +235 -0
- package/rich-text/libs/diff/index.js +285 -0
- package/rich-text/libs/formats/align.js +20 -0
- package/rich-text/libs/formats/background.js +11 -0
- package/rich-text/libs/formats/blockquote.js +16 -0
- package/rich-text/libs/formats/bold.js +25 -0
- package/rich-text/libs/formats/code.js +37 -0
- package/rich-text/libs/formats/color.js +16 -0
- package/rich-text/libs/formats/direction.js +15 -0
- package/rich-text/libs/formats/emoji.js +20 -0
- package/rich-text/libs/formats/font.js +51 -0
- package/rich-text/libs/formats/formula.js +35 -0
- package/rich-text/libs/formats/header.js +25 -0
- package/rich-text/libs/formats/hr.js +17 -0
- package/rich-text/libs/formats/image.js +46 -0
- package/rich-text/libs/formats/indent.js +38 -0
- package/rich-text/libs/formats/italic.js +16 -0
- package/rich-text/libs/formats/lineHeight.js +12 -0
- package/rich-text/libs/formats/link.js +47 -0
- package/rich-text/libs/formats/list.js +37 -0
- package/rich-text/libs/formats/script.js +23 -0
- package/rich-text/libs/formats/size.js +27 -0
- package/rich-text/libs/formats/strike.js +16 -0
- package/rich-text/libs/formats/table.js +134 -0
- package/rich-text/libs/formats/underline.js +16 -0
- package/rich-text/libs/formats/video.js +40 -0
- package/rich-text/libs/index.js +117 -0
- package/rich-text/libs/modules/clipboard.js +295 -0
- package/rich-text/libs/modules/history.js +119 -0
- package/rich-text/libs/modules/image-resize/index.js +80 -0
- package/rich-text/libs/modules/image-resize/modules/Base.js +14 -0
- package/rich-text/libs/modules/image-resize/modules/DisplaySize.js +41 -0
- package/rich-text/libs/modules/image-resize/modules/Resize.js +62 -0
- package/rich-text/libs/modules/image-resize/options.js +11 -0
- package/rich-text/libs/modules/input.js +54 -0
- package/rich-text/libs/modules/keyboard.js +423 -0
- package/rich-text/libs/modules/normalizeExternalHTML/index.js +12 -0
- package/rich-text/libs/modules/normalizeExternalHTML/normalizers/googleDocs.js +22 -0
- package/rich-text/libs/modules/normalizeExternalHTML/normalizers/msWord.js +39 -0
- package/rich-text/libs/modules/table.js +113 -0
- package/rich-text/libs/modules/toolbar copy.d.ts +0 -0
- package/rich-text/libs/modules/toolbar.js +18 -0
- package/rich-text/libs/modules/uiNode.js +52 -0
- package/rich-text/libs/modules/uploader.js +46 -0
- package/rich-text/libs/parchment/attributor/attributor.js +30 -0
- package/rich-text/libs/parchment/attributor/class.js +26 -0
- package/rich-text/libs/parchment/attributor/store.js +44 -0
- package/rich-text/libs/parchment/attributor/style.js +25 -0
- package/rich-text/libs/parchment/blot/abstract/container.js +32 -0
- package/rich-text/libs/parchment/blot/abstract/leaf.js +25 -0
- package/rich-text/libs/parchment/blot/abstract/parent.js +156 -0
- package/rich-text/libs/parchment/blot/abstract/shadow.js +78 -0
- package/rich-text/libs/parchment/blot/block.js +71 -0
- package/rich-text/libs/parchment/blot/embed.js +18 -0
- package/rich-text/libs/parchment/blot/inline.js +73 -0
- package/rich-text/libs/parchment/blot/scroll.js +100 -0
- package/rich-text/libs/parchment/blot/text.js +56 -0
- package/rich-text/libs/parchment/collection/linked-list.js +86 -0
- package/rich-text/libs/parchment/error.js +10 -0
- package/rich-text/libs/parchment/index.js +36 -0
- package/rich-text/libs/parchment/registry.js +56 -0
- package/rich-text/libs/parchment/scope.js +8 -0
- package/rich-text/style/index.css +1 -0
- package/rich-text/style/index.d.ts +1 -0
- package/rich-text/style/index.js +3 -0
- package/router-error/RouterError.d.ts +4 -0
- package/router-error/RouterError.js +82 -0
- package/router-error/constants.d.ts +0 -0
- package/router-error/constants.js +2 -0
- package/router-error/context.d.ts +3 -0
- package/router-error/context.js +7 -0
- package/router-error/index.d.ts +3 -1
- package/router-error/index.js +5 -75
- package/router-error/interface.d.ts +8 -0
- package/router-error/style/index.d.ts +0 -1
- package/router-error/style/index.js +1 -2
- package/row-col/Col.js +65 -96
- package/row-col/Row.js +36 -39
- package/row-col/constants.d.ts +1 -0
- package/row-col/constants.js +6 -0
- package/row-col/context.d.ts +5 -0
- package/row-col/context.js +8 -3
- package/row-col/index.d.ts +2 -0
- package/row-col/index.js +11 -9
- package/row-col/style/index.css +1 -0
- package/row-col/style/index.d.ts +1 -0
- package/row-col/style/index.js +3 -0
- package/segmented/Segmented.js +82 -89
- package/segmented/constants.d.ts +0 -0
- package/segmented/constants.js +2 -0
- package/segmented/context.d.ts +3 -0
- package/segmented/context.js +18 -0
- package/segmented/index.d.ts +2 -0
- package/segmented/index.js +9 -4
- package/segmented/style/index.css +1 -0
- package/segmented/style/index.d.ts +1 -0
- package/segmented/style/index.js +3 -0
- package/select/Option.js +1 -1
- package/select/OptionGroup.js +1 -1
- package/select/Select.js +195 -197
- package/select/constants.d.ts +0 -0
- package/select/constants.js +2 -0
- package/select/context.d.ts +3 -0
- package/select/context.js +13 -0
- package/select/index.d.ts +2 -0
- package/select/index.js +7 -4
- package/select/style/index.css +1 -0
- package/select/style/index.d.ts +5 -0
- package/select/style/index.js +7 -0
- package/select/utils.js +1 -1
- package/select-view/Core.js +3 -3
- package/select-view/SelectView.js +43 -39
- package/select-view/constants.d.ts +0 -0
- package/select-view/constants.js +2 -0
- package/select-view/context.d.ts +3 -0
- package/select-view/context.js +7 -0
- package/select-view/index.d.ts +2 -0
- package/select-view/index.js +10 -7
- package/select-view/style/index.d.ts +1 -0
- package/select-view/style/index.js +3 -0
- package/skeleton/Image.js +1 -1
- package/skeleton/Skeleton.js +42 -42
- package/skeleton/Text.d.ts +1 -1
- package/skeleton/Text.js +1 -1
- package/skeleton/constants.d.ts +0 -0
- package/skeleton/constants.js +2 -0
- package/skeleton/context.d.ts +3 -0
- package/skeleton/context.js +10 -0
- package/skeleton/index.d.ts +2 -0
- package/skeleton/index.js +11 -8
- package/skeleton/style/index.css +1 -0
- package/skeleton/style/index.d.ts +1 -0
- package/skeleton/style/index.js +3 -0
- package/slider/Button.js +7 -7
- package/slider/Dot.d.ts +1 -1
- package/slider/Dot.js +1 -1
- package/slider/Input.js +1 -1
- package/slider/Mark.d.ts +1 -1
- package/slider/Mark.js +1 -1
- package/slider/Slider.js +188 -189
- package/slider/Tick.d.ts +1 -1
- package/slider/Tick.js +1 -1
- package/slider/constants.d.ts +0 -0
- package/slider/constants.js +2 -0
- package/slider/context.d.ts +3 -0
- package/slider/context.js +11 -0
- package/slider/hooks/useInterval.js +94 -0
- package/slider/hooks/useLegalValue.js +58 -0
- package/slider/index.d.ts +2 -0
- package/slider/index.js +15 -12
- package/slider/style/index.css +1 -0
- package/slider/style/index.d.ts +4 -0
- package/slider/style/index.js +6 -0
- package/slider/utils.d.ts +1 -1
- package/slider/utils.js +1 -1
- package/space/Space.js +29 -29
- package/space/constants.d.ts +0 -0
- package/space/constants.js +2 -0
- package/space/context.d.ts +3 -0
- package/space/context.js +10 -0
- package/space/index.d.ts +2 -0
- package/space/index.js +8 -5
- package/space/style/index.d.ts +1 -0
- package/space/style/index.js +3 -0
- package/speech-synthesis/SpeechSynthesis.js +18 -10
- package/speech-synthesis/constants.d.ts +0 -0
- package/speech-synthesis/constants.js +2 -0
- package/speech-synthesis/context.d.ts +3 -0
- package/speech-synthesis/context.js +7 -0
- package/speech-synthesis/index.d.ts +2 -0
- package/speech-synthesis/index.js +9 -4
- package/speech-synthesis/style/index.d.ts +1 -0
- package/speech-synthesis/style/index.js +3 -0
- package/spin/DotLoading.js +1 -1
- package/spin/Spin.js +69 -65
- package/spin/constants.d.ts +0 -0
- package/spin/constants.js +2 -0
- package/spin/context.d.ts +3 -0
- package/spin/context.js +7 -0
- package/spin/index.d.ts +2 -0
- package/spin/index.js +9 -6
- package/spin/style/index.css +1 -0
- package/spin/style/index.d.ts +1 -0
- package/spin/style/index.js +3 -0
- package/splitter/Bar.js +97 -0
- package/splitter/Panel.js +5 -5
- package/splitter/Splitter.js +61 -58
- package/splitter/constants.d.ts +0 -0
- package/splitter/constants.js +2 -0
- package/splitter/context.d.ts +3 -0
- package/splitter/context.js +7 -0
- package/splitter/hooks/useItems.js +1 -1
- package/splitter/hooks/useResizable.js +1 -1
- package/splitter/hooks/useResize.js +1 -1
- package/splitter/hooks/useSizes.js +1 -1
- package/splitter/index.d.ts +2 -0
- package/splitter/index.js +9 -6
- package/splitter/style/index.css +1 -0
- package/splitter/style/index.d.ts +1 -0
- package/splitter/style/index.js +3 -0
- package/statistic/Statistic.js +32 -31
- package/statistic/constants.d.ts +0 -0
- package/statistic/constants.js +2 -0
- package/statistic/context.d.ts +3 -0
- package/statistic/context.js +10 -0
- package/statistic/index.d.ts +3 -0
- package/statistic/index.js +7 -4
- package/statistic/interface.js +1 -1
- package/statistic/style/index.css +1 -0
- package/statistic/style/index.d.ts +2 -0
- package/statistic/style/index.js +4 -0
- package/steps/Item.js +64 -0
- package/steps/Steps.js +39 -42
- package/steps/constants.d.ts +0 -0
- package/steps/constants.js +2 -0
- package/steps/context.d.ts +3 -0
- package/steps/context.js +13 -0
- package/steps/index.d.ts +4 -2
- package/steps/index.js +10 -7
- package/steps/style/index.css +1 -0
- package/steps/style/index.d.ts +1 -0
- package/steps/style/index.js +3 -0
- package/style/constants.d.ts +0 -0
- package/style/constants.js +2 -0
- package/style/constants.ts +0 -0
- package/style/global.less +24 -0
- package/style/index.less +1 -0
- package/style/variables-css.less +1079 -0
- package/style/variables.less +0 -1109
- package/style.css +1 -2
- package/suspense-fallback-test/SuspenseFallbackTest.js +1 -1
- package/suspense-fallback-test/constants.d.ts +0 -0
- package/suspense-fallback-test/constants.js +2 -0
- package/suspense-fallback-test/context.d.ts +0 -0
- package/suspense-fallback-test/context.js +2 -0
- package/suspense-fallback-test/index.d.ts +2 -0
- package/suspense-fallback-test/index.js +2 -1
- package/suspense-fallback-test/style/index.d.ts +1 -0
- package/suspense-fallback-test/style/index.js +3 -0
- package/switch/Switch.js +61 -59
- package/switch/constants.d.ts +0 -0
- package/switch/constants.js +2 -0
- package/switch/context.d.ts +3 -0
- package/switch/context.js +10 -0
- package/switch/index.d.ts +2 -0
- package/switch/index.js +7 -4
- package/switch/interface.d.ts +7 -0
- package/switch/style/index.css +1 -0
- package/switch/style/index.d.ts +1 -0
- package/switch/style/index.js +3 -0
- package/table/ColGroup.js +2 -2
- package/table/Table.js +250 -261
- package/table/constants.js +36 -0
- package/table/context.d.ts +2 -0
- package/table/context.js +15 -4
- package/table/hooks/useColumns.js +115 -0
- package/table/hooks/useComponent.js +27 -0
- package/table/hooks/useExpand.js +33 -0
- package/table/hooks/useRowSelection.js +73 -0
- package/table/hooks/useSorter.js +51 -0
- package/table/hooks/useStickyClassNames.js +25 -0
- package/table/hooks/useStickyOffsets.js +28 -0
- package/table/hooks/useThResizable.js +31 -0
- package/table/index.d.ts +11 -9
- package/table/index.js +37 -35
- package/table/style/index.css +1 -0
- package/table/style/index.d.ts +11 -0
- package/table/style/index.js +13 -0
- package/table/summary/Cell.js +1 -1
- package/table/summary/Row.js +1 -1
- package/table/summary/context.js +1 -1
- package/table/summary/index.js +1 -1
- package/table/tbody/DataRecordRenderer.js +3 -3
- package/table/tbody/Td.js +4 -4
- package/table/tbody/Tr.js +6 -6
- package/table/tbody/index.js +2 -2
- package/table/tfoot/index.js +1 -1
- package/table/th-resizable/index.js +8 -7
- package/table/th-resizable/style/index.css +1 -0
- package/table/th-resizable/style/index.d.ts +1 -0
- package/table/th-resizable/style/index.js +3 -0
- package/table/thead/Column.js +10 -10
- package/table/thead/index.js +4 -4
- package/table/utils.js +1 -1
- package/tabs/TabContent.js +23 -22
- package/tabs/TabPane.js +1 -1
- package/tabs/Tabs.js +80 -76
- package/tabs/constants.d.ts +1 -0
- package/tabs/constants.js +11 -0
- package/tabs/context.d.ts +5 -3
- package/tabs/context.js +12 -4
- package/tabs/hooks/useDomSize.js +23 -0
- package/tabs/hooks/useHeaderScroll.d.ts +13 -0
- package/tabs/hooks/useHeaderScroll.js +76 -0
- package/tabs/index.d.ts +4 -2
- package/tabs/index.js +13 -11
- package/tabs/interface.d.ts +1 -6
- package/tabs/style/index.css +1 -0
- package/tabs/style/index.d.ts +2 -0
- package/tabs/style/index.js +4 -0
- package/tabs/tab-header/DropdownIcon.js +34 -33
- package/tabs/tab-header/TabInk.js +16 -16
- package/tabs/tab-header/TabNavIcon.d.ts +2 -2
- package/tabs/tab-header/TabNavIcon.js +45 -44
- package/tabs/tab-header/TabTitle.d.ts +1 -1
- package/tabs/tab-header/TabTitle.js +1 -1
- package/tabs/tab-header/index.js +115 -117
- package/tabs/utils.d.ts +5 -1
- package/tabs/utils.js +12 -3
- package/tag/Tag.js +73 -70
- package/tag/constants.d.ts +0 -0
- package/tag/constants.js +2 -0
- package/tag/context.d.ts +3 -0
- package/tag/context.js +7 -0
- package/tag/index.d.ts +2 -0
- package/tag/index.js +10 -5
- package/tag/style/index.css +1 -0
- package/tag/style/index.d.ts +1 -0
- package/tag/style/index.js +3 -0
- package/tag/utils.js +1 -1
- package/time-picker/Picker.js +76 -79
- package/time-picker/TimeColumn.js +1 -1
- package/time-picker/TimePicker.js +69 -67
- package/time-picker/TimePickerRange.js +1 -1
- package/time-picker/constants.d.ts +0 -0
- package/time-picker/constants.js +2 -0
- package/time-picker/context.d.ts +3 -1
- package/time-picker/context.js +9 -3
- package/time-picker/index.d.ts +1 -0
- package/time-picker/index.js +10 -8
- package/time-picker/style/index.css +1 -0
- package/time-picker/style/index.d.ts +4 -0
- package/time-picker/style/index.js +6 -0
- package/time-picker/utils.js +1 -1
- package/time-picker/withTimePicker.js +1 -1
- package/timeline/Item.js +2 -2
- package/timeline/Timeline.js +33 -35
- package/timeline/constants.d.ts +0 -0
- package/timeline/constants.js +2 -0
- package/timeline/context.d.ts +3 -0
- package/timeline/context.js +13 -0
- package/timeline/index.d.ts +2 -0
- package/timeline/index.js +9 -6
- package/timeline/style/index.css +1 -0
- package/timeline/style/index.d.ts +1 -0
- package/timeline/style/index.js +3 -0
- package/timer/Timer.js +19 -15
- package/timer/constants.d.ts +0 -0
- package/timer/constants.js +2 -0
- package/timer/context.d.ts +3 -0
- package/timer/context.js +7 -0
- package/timer/index.d.ts +2 -0
- package/timer/index.js +9 -4
- package/timer/style/index.d.ts +1 -0
- package/timer/style/index.js +3 -0
- package/toast/Toast.d.ts +1 -0
- package/toast/Toast.js +1 -1
- package/toast/constants.d.ts +0 -0
- package/toast/constants.js +2 -0
- package/toast/context.d.ts +0 -0
- package/toast/context.js +2 -0
- package/toast/index.d.ts +2 -0
- package/toast/index.js +3 -2
- package/toast/style/index.d.ts +1 -0
- package/toast/style/index.js +3 -0
- package/tooltip/Tooltip.js +59 -62
- package/tooltip/constants.d.ts +0 -0
- package/tooltip/constants.js +2 -0
- package/tooltip/context.d.ts +3 -0
- package/tooltip/context.js +14 -0
- package/tooltip/index.d.ts +2 -0
- package/tooltip/index.js +9 -4
- package/tooltip/style/index.css +1 -0
- package/tooltip/style/index.d.ts +2 -0
- package/tooltip/style/index.js +4 -0
- package/tour/Tour.js +97 -105
- package/tour/constants.d.ts +0 -0
- package/tour/constants.js +2 -0
- package/tour/context.d.ts +3 -0
- package/tour/context.js +18 -0
- package/tour/index.d.ts +2 -0
- package/tour/index.js +9 -4
- package/tour/style/index.css +1 -0
- package/tour/style/index.d.ts +1 -0
- package/tour/style/index.js +3 -0
- package/transfer/Item.js +1 -1
- package/transfer/List.js +1 -1
- package/transfer/Transfer.js +77 -80
- package/transfer/constants.d.ts +0 -0
- package/transfer/constants.js +2 -0
- package/transfer/context.d.ts +3 -0
- package/transfer/context.js +14 -0
- package/transfer/index.d.ts +2 -0
- package/transfer/index.js +9 -4
- package/transfer/style/index.css +1 -0
- package/transfer/style/index.d.ts +5 -0
- package/transfer/style/index.js +7 -0
- package/transition/constants.d.ts +0 -0
- package/transition/constants.js +2 -0
- package/transition/context.d.ts +0 -0
- package/transition/context.js +2 -0
- package/transition/index.d.ts +1 -0
- package/transition/index.js +2 -1
- package/transition/style/index.d.ts +1 -0
- package/transition/style/index.js +3 -0
- package/tree/Animation.js +2 -2
- package/tree/Node.js +1 -1
- package/tree/NodeList.d.ts +1 -1
- package/tree/NodeList.js +1 -1
- package/tree/Tree.js +226 -240
- package/tree/constants.d.ts +10 -0
- package/tree/constants.js +16 -0
- package/tree/context.d.ts +2 -0
- package/tree/context.js +14 -4
- package/tree/index.d.ts +3 -1
- package/tree/index.js +15 -13
- package/tree/interface.d.ts +1 -1
- package/tree/style/index.css +1 -0
- package/tree/style/index.d.ts +2 -0
- package/tree/style/index.js +4 -0
- package/tree/utils.js +2 -2
- package/tree-select/List.js +1 -1
- package/tree-select/TreeSelect.js +135 -136
- package/tree-select/constants.d.ts +10 -0
- package/tree-select/constants.js +7 -0
- package/tree-select/context.d.ts +3 -0
- package/tree-select/context.js +13 -0
- package/tree-select/hooks/useKeyCache.js +49 -0
- package/tree-select/hooks/useStateValue.js +69 -0
- package/tree-select/hooks/useTreeData.js +15 -0
- package/tree-select/index.d.ts +2 -0
- package/tree-select/index.js +12 -9
- package/tree-select/style/index.css +1 -0
- package/tree-select/style/index.d.ts +4 -0
- package/tree-select/style/index.js +6 -0
- package/tree-select/utils.d.ts +0 -10
- package/tree-select/utils.js +3 -12
- package/trigger/Trigger.js +135 -154
- package/trigger/constants.d.ts +0 -0
- package/trigger/constants.js +2 -0
- package/trigger/context.d.ts +3 -0
- package/trigger/context.js +27 -0
- package/trigger/getPopupStyle.js +1 -1
- package/trigger/index.d.ts +2 -0
- package/trigger/index.js +10 -5
- package/trigger/style/index.css +1 -0
- package/trigger/style/index.d.ts +1 -0
- package/trigger/style/index.js +3 -0
- package/trigger/utils.js +1 -1
- package/typewriter/Typewriter.js +19 -16
- package/typewriter/constants.d.ts +0 -0
- package/typewriter/constants.js +2 -0
- package/typewriter/context.d.ts +3 -0
- package/typewriter/context.js +7 -0
- package/typewriter/index.d.ts +2 -0
- package/typewriter/index.js +9 -4
- package/typewriter/style/index.d.ts +1 -0
- package/typewriter/style/index.js +3 -0
- package/typography/Base.js +67 -62
- package/typography/EditContent.js +1 -1
- package/typography/Ellipsis.js +2 -2
- package/typography/Operations.js +1 -1
- package/typography/Paragraph.js +1 -1
- package/typography/Text.js +1 -1
- package/typography/Title.js +1 -1
- package/typography/Typography.js +21 -16
- package/typography/constants.d.ts +0 -0
- package/typography/constants.js +2 -0
- package/typography/context.d.ts +3 -0
- package/typography/context.js +7 -0
- package/typography/hooks/useCssEllipsis.d.ts +6 -0
- package/typography/hooks/useCssEllipsis.js +41 -0
- package/typography/hooks/useEllipsis.d.ts +21 -0
- package/typography/hooks/useEllipsis.js +149 -0
- package/typography/index.d.ts +4 -2
- package/typography/index.js +19 -16
- package/typography/style/index.css +1 -0
- package/typography/style/index.d.ts +4 -0
- package/typography/style/index.js +6 -0
- package/upload/TriggerNode.js +1 -1
- package/upload/Upload.js +48 -50
- package/upload/Uploader.js +2 -2
- package/upload/constants.js +11 -0
- package/upload/context.d.ts +3 -0
- package/upload/context.js +13 -0
- package/upload/index.d.ts +3 -1
- package/upload/index.js +14 -11
- package/upload/list/PictureItem.js +3 -3
- package/upload/list/TextItem.js +4 -4
- package/upload/list/UploadProgress.js +5 -5
- package/upload/list/index.js +2 -2
- package/upload/list/utils.js +1 -1
- package/upload/request.js +2 -2
- package/upload/style/index.css +1 -0
- package/upload/style/index.d.ts +5 -0
- package/upload/style/index.js +7 -0
- package/upload/utils.js +1 -1
- package/utils/callOrReturn.js +1 -1
- package/utils/callbackOriginRef.js +1 -1
- package/utils/caseName.js +1 -1
- package/utils/className.js +1 -1
- package/utils/constants.d.ts +5 -0
- package/utils/constants.js +24 -0
- package/utils/contextHolder.js +1 -1
- package/utils/copy.js +1 -1
- package/utils/createGlobalConfigFunction.js +1 -1
- package/utils/css.js +1 -1
- package/utils/date.js +1 -1
- package/utils/dayjs.js +2 -2
- package/utils/document.d.ts +1 -0
- package/utils/document.js +10 -0
- package/utils/dom.js +1 -1
- package/utils/emitter.js +1 -1
- package/utils/file.js +1 -1
- package/utils/fileRead.js +1 -1
- package/utils/fileToDataURL.js +1 -1
- package/utils/fillNBSP.js +1 -1
- package/utils/findRootElement.js +1 -1
- package/utils/findScrollParent.js +1 -1
- package/utils/getHighlightText.js +1 -1
- package/utils/getHotkeyHandler.js +1 -1
- package/utils/getScrollBarHeight.js +1 -1
- package/utils/getScrollBarSize.js +1 -1
- package/utils/getScrollBarWidth.js +1 -1
- package/utils/getStringLength.js +1 -1
- package/utils/include.js +1 -1
- package/utils/index.d.ts +1 -1
- package/utils/index.js +53 -53
- package/utils/intersectionObserver.js +1 -1
- package/utils/is.js +1 -1
- package/utils/keyboardCode.d.ts +3 -3
- package/utils/keyboardCode.js +4 -4
- package/utils/lodash.js +1 -1
- package/utils/math.js +1 -1
- package/utils/mergeProps.js +1 -1
- package/utils/mergedToString.js +1 -1
- package/utils/mutationObserver.js +1 -1
- package/utils/names.d.ts +1 -0
- package/utils/names.js +2 -2
- package/utils/object.js +1 -1
- package/utils/omit.js +1 -1
- package/utils/pad.js +1 -1
- package/utils/pick.js +1 -1
- package/utils/pinyin.js +1 -1
- package/utils/react19Adapter.js +1 -1
- package/utils/ref.js +1 -1
- package/utils/resizeObserver.js +1 -1
- package/utils/responsiveObserve.js +1 -1
- package/utils/saveAs.js +1 -1
- package/utils/screenfull.js +1 -1
- package/utils/scrollIntoViewIfNeeded.js +1 -1
- package/utils/setCreateRoot.js +1 -1
- package/utils/setDarkTheme.js +2 -2
- package/utils/setPrimaryColor.js +2 -2
- package/utils/setTheme.js +2 -2
- package/utils/string.d.ts +1 -1
- package/utils/string.js +2 -2
- package/utils/style.js +1 -1
- package/utils/throttleByRequestAnimationFrame.js +1 -1
- package/utils/tinycolor.js +1 -1
- package/utils/toArray.js +1 -1
- package/utils/tree.js +1 -1
- package/utils/tunnel.js +8 -2
- package/utils/tween.js +1 -1
- package/utils/uuid.js +1 -1
- package/utils/validate.js +1 -1
- package/utils/warning.js +1 -1
- package/verification-code/VerificationCode.js +51 -48
- package/verification-code/constants.d.ts +0 -0
- package/verification-code/constants.js +2 -0
- package/verification-code/context.d.ts +3 -0
- package/verification-code/context.js +7 -0
- package/verification-code/index.d.ts +2 -0
- package/verification-code/index.js +7 -4
- package/verification-code/style/index.css +1 -0
- package/verification-code/style/index.d.ts +2 -0
- package/verification-code/style/index.js +4 -0
- package/version/index.js +8 -8
- package/virtual-list/Filler.js +1 -1
- package/virtual-list/VirtualList.js +159 -154
- package/virtual-list/constants.js +7 -0
- package/virtual-list/context.d.ts +3 -0
- package/virtual-list/context.js +7 -0
- package/virtual-list/hooks/useCacheChildrenNodes.js +13 -0
- package/virtual-list/hooks/useComputeVirtualItemHeight.js +17 -0
- package/virtual-list/index.d.ts +2 -0
- package/virtual-list/index.js +9 -6
- package/virtual-list/style/index.d.ts +1 -0
- package/virtual-list/style/index.js +3 -0
- package/virtual-list/utils/algorithm.js +1 -1
- package/virtual-list/utils/item.js +1 -1
- package/watermark/Watermark.js +38 -34
- package/watermark/constants.d.ts +0 -0
- package/watermark/constants.js +2 -0
- package/watermark/context.d.ts +3 -0
- package/watermark/context.js +7 -0
- package/watermark/index.d.ts +2 -0
- package/watermark/index.js +7 -4
- package/watermark/style/index.d.ts +1 -0
- package/watermark/style/index.js +3 -0
- package/.vite/license.md +0 -3
- package/.vite/manifest.json +0 -8807
- package/calendar/hook/useCellClassName.js +0 -34
- package/cascader/hook/useRefCurrent.js +0 -14
- package/constant/index.d.ts +0 -3
- package/constant/index.js +0 -6
- package/date-picker/DatePickerRange.d.ts +0 -3
- package/date-picker/DatePickerRange.js +0 -404
- package/date-picker/hook/useCellClassName.js +0 -53
- package/draw/constant.js +0 -2
- package/form/FormControl.d.ts +0 -50
- package/form/FormControl.js +0 -256
- package/form/FormItem.js +0 -192
- package/form/FormItemLabel.js +0 -48
- package/form/FormItemTip.js +0 -41
- package/form/FormLabelSymbol.js +0 -20
- package/form/FormList.js +0 -83
- package/form/FormProvider.js +0 -29
- package/form/constant.js +0 -9
- package/form/hook/useForm.js +0 -56
- package/form/hook/useFormContext.js +0 -34
- package/form/hook/useFormState.js +0 -31
- package/form/hook/useWatch.js +0 -34
- package/image/ImageFooter.d.ts +0 -13
- package/image/ImageFooter.js +0 -58
- package/image/ImagePreview.js +0 -418
- package/image/ImagePreviewArrow.js +0 -30
- package/image/ImagePreviewGroup.js +0 -112
- package/image/ImagePreviewToolbar.js +0 -61
- package/image/hook/useImageStatus.js +0 -18
- package/image/hook/useShowFooter.js +0 -13
- package/input-number/useSelectionRange.js +0 -25
- package/input-tag/constant.js +0 -6
- package/input-tag/hook/useComputeAutoWidthDelay.js +0 -12
- package/mask/constant.js +0 -10
- package/message/useMessage.d.ts +0 -4
- package/message/useMessage.js +0 -52
- package/notification/useNotification.d.ts +0 -4
- package/notification/useNotification.js +0 -53
- package/overflow-ellipsis/OverflowItem.js +0 -22
- package/progress/CircleProgress.js +0 -102
- package/progress/LineProgess.js +0 -74
- package/progress/StepProgress.js +0 -51
- package/rich-text/constant.js +0 -7
- package/rich-text/lib/blots/block.js +0 -115
- package/rich-text/lib/blots/break.js +0 -20
- package/rich-text/lib/blots/container.js +0 -8
- package/rich-text/lib/blots/cursor.js +0 -97
- package/rich-text/lib/blots/embed.js +0 -47
- package/rich-text/lib/blots/inline.js +0 -50
- package/rich-text/lib/blots/scroll.js +0 -249
- package/rich-text/lib/blots/text.js +0 -17
- package/rich-text/lib/core/composition.js +0 -38
- package/rich-text/lib/core/editor.js +0 -248
- package/rich-text/lib/core/emitter.d.ts +0 -38
- package/rich-text/lib/core/emitter.js +0 -47
- package/rich-text/lib/core/logger.js +0 -20
- package/rich-text/lib/core/module.js +0 -14
- package/rich-text/lib/core/rich.d.ts +0 -183
- package/rich-text/lib/core/rich.js +0 -369
- package/rich-text/lib/core/selection.js +0 -222
- package/rich-text/lib/core/theme.js +0 -32
- package/rich-text/lib/core/utils/createRegistryWithFormats.js +0 -29
- package/rich-text/lib/core/utils/scrollRectIntoView.js +0 -59
- package/rich-text/lib/delta/AttributeMap.js +0 -37
- package/rich-text/lib/delta/Op.js +0 -10
- package/rich-text/lib/delta/OpIterator.js +0 -45
- package/rich-text/lib/delta/index.js +0 -235
- package/rich-text/lib/diff/index.js +0 -285
- package/rich-text/lib/formats/align.js +0 -20
- package/rich-text/lib/formats/background.js +0 -11
- package/rich-text/lib/formats/blockquote.js +0 -16
- package/rich-text/lib/formats/bold.js +0 -25
- package/rich-text/lib/formats/code.js +0 -37
- package/rich-text/lib/formats/color.js +0 -16
- package/rich-text/lib/formats/direction.js +0 -15
- package/rich-text/lib/formats/emoji.js +0 -20
- package/rich-text/lib/formats/font.js +0 -51
- package/rich-text/lib/formats/formula.js +0 -35
- package/rich-text/lib/formats/header.js +0 -25
- package/rich-text/lib/formats/hr.js +0 -17
- package/rich-text/lib/formats/image.js +0 -46
- package/rich-text/lib/formats/indent.js +0 -38
- package/rich-text/lib/formats/italic.js +0 -16
- package/rich-text/lib/formats/lineHeight.js +0 -12
- package/rich-text/lib/formats/link.js +0 -47
- package/rich-text/lib/formats/list.js +0 -37
- package/rich-text/lib/formats/script.js +0 -23
- package/rich-text/lib/formats/size.js +0 -27
- package/rich-text/lib/formats/strike.js +0 -16
- package/rich-text/lib/formats/table.js +0 -134
- package/rich-text/lib/formats/underline.js +0 -16
- package/rich-text/lib/formats/video.js +0 -40
- package/rich-text/lib/index.js +0 -117
- package/rich-text/lib/modules/clipboard.js +0 -295
- package/rich-text/lib/modules/history.js +0 -119
- package/rich-text/lib/modules/image-resize/index.js +0 -80
- package/rich-text/lib/modules/image-resize/modules/Base.js +0 -14
- package/rich-text/lib/modules/image-resize/modules/DisplaySize.js +0 -41
- package/rich-text/lib/modules/image-resize/modules/Resize.js +0 -62
- package/rich-text/lib/modules/image-resize/options.js +0 -11
- package/rich-text/lib/modules/input.js +0 -54
- package/rich-text/lib/modules/keyboard.js +0 -423
- package/rich-text/lib/modules/normalizeExternalHTML/index.js +0 -12
- package/rich-text/lib/modules/normalizeExternalHTML/normalizers/googleDocs.js +0 -22
- package/rich-text/lib/modules/normalizeExternalHTML/normalizers/msWord.js +0 -39
- package/rich-text/lib/modules/table.js +0 -113
- package/rich-text/lib/modules/toolbar.js +0 -18
- package/rich-text/lib/modules/uiNode.js +0 -52
- package/rich-text/lib/modules/uploader.js +0 -46
- package/rich-text/lib/parchment/attributor/attributor.js +0 -30
- package/rich-text/lib/parchment/attributor/class.js +0 -26
- package/rich-text/lib/parchment/attributor/store.js +0 -44
- package/rich-text/lib/parchment/attributor/style.js +0 -25
- package/rich-text/lib/parchment/blot/abstract/container.js +0 -32
- package/rich-text/lib/parchment/blot/abstract/leaf.js +0 -25
- package/rich-text/lib/parchment/blot/abstract/parent.js +0 -156
- package/rich-text/lib/parchment/blot/abstract/shadow.js +0 -78
- package/rich-text/lib/parchment/blot/block.js +0 -71
- package/rich-text/lib/parchment/blot/embed.js +0 -18
- package/rich-text/lib/parchment/blot/inline.js +0 -73
- package/rich-text/lib/parchment/blot/scroll.js +0 -100
- package/rich-text/lib/parchment/blot/text.js +0 -56
- package/rich-text/lib/parchment/collection/linked-list.js +0 -86
- package/rich-text/lib/parchment/error.js +0 -10
- package/rich-text/lib/parchment/index.js +0 -36
- package/rich-text/lib/parchment/registry.js +0 -56
- package/rich-text/lib/parchment/scope.js +0 -8
- package/row-col/Col-.d.ts +0 -4
- package/row-col/Col-.js +0 -65
- package/slider/hook/useInterval.js +0 -94
- package/slider/hook/useLegalValue.js +0 -58
- package/splitter/SplitBar.js +0 -97
- package/steps/Step.js +0 -64
- package/table/constant.js +0 -36
- package/table/hook/useColumns.js +0 -115
- package/table/hook/useComponent.js +0 -27
- package/table/hook/useExpand.js +0 -33
- package/table/hook/useRowSelection.js +0 -73
- package/table/hook/useSorter.js +0 -51
- package/table/hook/useStickyClassNames.js +0 -25
- package/table/hook/useStickyOffsets.js +0 -28
- package/table/hook/useThResizable.js +0 -31
- package/tabs/hook/useDomSize.js +0 -23
- package/tabs/hook/useHeaderScroll.d.ts +0 -12
- package/tabs/hook/useHeaderScroll.js +0 -75
- package/tree-select/hook/useKeyCache.js +0 -49
- package/tree-select/hook/useStateValue.js +0 -70
- package/tree-select/hook/useTreeData.js +0 -15
- package/typography/useCssEllipsis.d.ts +0 -6
- package/typography/useCssEllipsis.js +0 -41
- package/typography/useEllipsis.d.ts +0 -21
- package/typography/useEllipsis.js +0 -149
- package/upload/constant.js +0 -11
- package/utils/constant.d.ts +0 -5
- package/utils/constant.js +0 -24
- package/virtual-list/constant.js +0 -7
- package/virtual-list/hook/useCacheChildrenNodes.js +0 -13
- package/virtual-list/hook/useComputeVirtualItemHeight.js +0 -17
- /package/{draw/constant.d.ts → affix/constants.d.ts} +0 -0
- /package/{rich-text/lib/modules/toolbar copy.d.ts → alert/constants.d.ts} +0 -0
- /package/{rich-text/lib/themes/base.d.ts → anchor/constants.d.ts} +0 -0
- /package/{rich-text/lib/themes/pqb.d.ts → animation/constants.d.ts} +0 -0
- /package/{rich-text/lib/ui/tooltip.d.ts → app/constants.d.ts} +0 -0
- /package/calendar/{hook → hooks}/useCellClassName.d.ts +0 -0
- /package/cascader/{hook → hooks}/useRefCurrent.d.ts +0 -0
- /package/date-picker/{hook → hooks}/useCellClassName.d.ts +0 -0
- /package/form/{FormItem.d.ts → Item.d.ts} +0 -0
- /package/form/{FormItemLabel.d.ts → ItemLabel.d.ts} +0 -0
- /package/form/{FormItemTip.d.ts → ItemTip.d.ts} +0 -0
- /package/form/{FormLabelSymbol.d.ts → LabelSymbol.d.ts} +0 -0
- /package/form/{FormList.d.ts → List.d.ts} +0 -0
- /package/form/{FormProvider.d.ts → Provider.d.ts} +0 -0
- /package/form/{constant.d.ts → constants.d.ts} +0 -0
- /package/form/{hook → hooks}/useForm.d.ts +0 -0
- /package/form/{hook → hooks}/useFormContext.d.ts +0 -0
- /package/form/{hook → hooks}/useFormState.d.ts +0 -0
- /package/form/{hook → hooks}/useWatch.d.ts +0 -0
- /package/image/{ImagePreview.d.ts → Preview.d.ts} +0 -0
- /package/image/{ImagePreviewArrow.d.ts → PreviewArrow.d.ts} +0 -0
- /package/image/{ImagePreviewGroup.d.ts → PreviewGroup.d.ts} +0 -0
- /package/image/{ImagePreviewToolbar.d.ts → PreviewToolbar.d.ts} +0 -0
- /package/image/{hook → hooks}/useImageStatus.d.ts +0 -0
- /package/image/{hook → hooks}/useShowFooter.d.ts +0 -0
- /package/input-number/{useSelectionRange.d.ts → hooks/useSelectionRange.d.ts} +0 -0
- /package/input-tag/{constant.d.ts → constants.d.ts} +0 -0
- /package/input-tag/{hook → hooks}/useComputeAutoWidthDelay.d.ts +0 -0
- /package/mask/{constant.d.ts → constants.d.ts} +0 -0
- /package/overflow-ellipsis/{OverflowItem.d.ts → Item.d.ts} +0 -0
- /package/progress/{CircleProgress.d.ts → Circle.d.ts} +0 -0
- /package/progress/{LineProgess.d.ts → Line.d.ts} +0 -0
- /package/progress/{StepProgress.d.ts → Step.d.ts} +0 -0
- /package/rich-text/{constant.d.ts → constants.d.ts} +0 -0
- /package/rich-text/{lib → libs}/LICENSE +0 -0
- /package/rich-text/{lib → libs}/blots/block.d.ts +0 -0
- /package/rich-text/{lib → libs}/blots/break.d.ts +0 -0
- /package/rich-text/{lib → libs}/blots/container.d.ts +0 -0
- /package/rich-text/{lib → libs}/blots/cursor.d.ts +0 -0
- /package/rich-text/{lib → libs}/blots/embed.d.ts +0 -0
- /package/rich-text/{lib → libs}/blots/inline.d.ts +0 -0
- /package/rich-text/{lib → libs}/blots/scroll.d.ts +0 -0
- /package/rich-text/{lib → libs}/blots/text.d.ts +0 -0
- /package/rich-text/{lib → libs}/core/composition.d.ts +0 -0
- /package/rich-text/{lib → libs}/core/editor.d.ts +0 -0
- /package/rich-text/{lib → libs}/core/logger.d.ts +0 -0
- /package/rich-text/{lib → libs}/core/module.d.ts +0 -0
- /package/rich-text/{lib → libs}/core/selection.d.ts +0 -0
- /package/rich-text/{lib → libs}/core/theme.d.ts +0 -0
- /package/rich-text/{lib → libs}/core/utils/createRegistryWithFormats.d.ts +0 -0
- /package/rich-text/{lib → libs}/core/utils/scrollRectIntoView.d.ts +0 -0
- /package/rich-text/{lib → libs}/delta/AttributeMap.d.ts +0 -0
- /package/rich-text/{lib → libs}/delta/LICENSE +0 -0
- /package/rich-text/{lib → libs}/delta/Op.d.ts +0 -0
- /package/rich-text/{lib → libs}/delta/OpIterator.d.ts +0 -0
- /package/rich-text/{lib → libs}/delta/index.d.ts +0 -0
- /package/rich-text/{lib → libs}/diff/index.d.ts +0 -0
- /package/rich-text/{lib → libs}/formats/align.d.ts +0 -0
- /package/rich-text/{lib → libs}/formats/background.d.ts +0 -0
- /package/rich-text/{lib → libs}/formats/blockquote.d.ts +0 -0
- /package/rich-text/{lib → libs}/formats/bold.d.ts +0 -0
- /package/rich-text/{lib → libs}/formats/code.d.ts +0 -0
- /package/rich-text/{lib → libs}/formats/color.d.ts +0 -0
- /package/rich-text/{lib → libs}/formats/direction.d.ts +0 -0
- /package/rich-text/{lib → libs}/formats/emoji.d.ts +0 -0
- /package/rich-text/{lib → libs}/formats/font.d.ts +0 -0
- /package/rich-text/{lib → libs}/formats/formula.d.ts +0 -0
- /package/rich-text/{lib → libs}/formats/header.d.ts +0 -0
- /package/rich-text/{lib → libs}/formats/hr.d.ts +0 -0
- /package/rich-text/{lib → libs}/formats/image.d.ts +0 -0
- /package/rich-text/{lib → libs}/formats/indent.d.ts +0 -0
- /package/rich-text/{lib → libs}/formats/italic.d.ts +0 -0
- /package/rich-text/{lib → libs}/formats/liOl.d.ts +0 -0
- /package/rich-text/{lib → libs}/formats/liUl.d.ts +0 -0
- /package/rich-text/{lib → libs}/formats/lineHeight.d.ts +0 -0
- /package/rich-text/{lib → libs}/formats/link.d.ts +0 -0
- /package/rich-text/{lib → libs}/formats/list.d.ts +0 -0
- /package/rich-text/{lib → libs}/formats/script.d.ts +0 -0
- /package/rich-text/{lib → libs}/formats/size.d.ts +0 -0
- /package/rich-text/{lib → libs}/formats/strike.d.ts +0 -0
- /package/rich-text/{lib → libs}/formats/table.d.ts +0 -0
- /package/rich-text/{lib → libs}/formats/underline.d.ts +0 -0
- /package/rich-text/{lib → libs}/formats/video.d.ts +0 -0
- /package/rich-text/{lib → libs}/index.d.ts +0 -0
- /package/rich-text/{lib → libs}/modules/clipboard.d.ts +0 -0
- /package/rich-text/{lib → libs}/modules/history.d.ts +0 -0
- /package/rich-text/{lib → libs}/modules/image-resize/index.d.ts +0 -0
- /package/rich-text/{lib → libs}/modules/image-resize/modules/Base.d.ts +0 -0
- /package/rich-text/{lib → libs}/modules/image-resize/modules/DisplaySize.d.ts +0 -0
- /package/rich-text/{lib → libs}/modules/image-resize/modules/Resize.d.ts +0 -0
- /package/rich-text/{lib → libs}/modules/image-resize/options.d.ts +0 -0
- /package/rich-text/{lib → libs}/modules/input.d.ts +0 -0
- /package/rich-text/{lib → libs}/modules/keyboard.d.ts +0 -0
- /package/rich-text/{lib → libs}/modules/normalizeExternalHTML/index.d.ts +0 -0
- /package/rich-text/{lib → libs}/modules/normalizeExternalHTML/normalizers/googleDocs.d.ts +0 -0
- /package/rich-text/{lib → libs}/modules/normalizeExternalHTML/normalizers/msWord.d.ts +0 -0
- /package/rich-text/{lib → libs}/modules/table.d.ts +0 -0
- /package/rich-text/{lib → libs}/modules/tableEmbed.d.ts +0 -0
- /package/rich-text/{lib → libs}/modules/toolbar.d.ts +0 -0
- /package/rich-text/{lib → libs}/modules/uiNode.d.ts +0 -0
- /package/rich-text/{lib → libs}/modules/uploader.d.ts +0 -0
- /package/rich-text/{lib → libs}/parchment/LICENSE +0 -0
- /package/rich-text/{lib → libs}/parchment/attributor/attributor.d.ts +0 -0
- /package/rich-text/{lib → libs}/parchment/attributor/class.d.ts +0 -0
- /package/rich-text/{lib → libs}/parchment/attributor/store.d.ts +0 -0
- /package/rich-text/{lib → libs}/parchment/attributor/style.d.ts +0 -0
- /package/rich-text/{lib → libs}/parchment/blot/abstract/blot.d.ts +0 -0
- /package/rich-text/{lib → libs}/parchment/blot/abstract/container.d.ts +0 -0
- /package/rich-text/{lib → libs}/parchment/blot/abstract/leaf.d.ts +0 -0
- /package/rich-text/{lib → libs}/parchment/blot/abstract/parent.d.ts +0 -0
- /package/rich-text/{lib → libs}/parchment/blot/abstract/shadow.d.ts +0 -0
- /package/rich-text/{lib → libs}/parchment/blot/block.d.ts +0 -0
- /package/rich-text/{lib → libs}/parchment/blot/embed.d.ts +0 -0
- /package/rich-text/{lib → libs}/parchment/blot/inline.d.ts +0 -0
- /package/rich-text/{lib → libs}/parchment/blot/scroll.d.ts +0 -0
- /package/rich-text/{lib → libs}/parchment/blot/text.d.ts +0 -0
- /package/rich-text/{lib → libs}/parchment/collection/linked-list.d.ts +0 -0
- /package/rich-text/{lib → libs}/parchment/collection/linked-node.d.ts +0 -0
- /package/rich-text/{lib → libs}/parchment/error.d.ts +0 -0
- /package/rich-text/{lib → libs}/parchment/index.d.ts +0 -0
- /package/rich-text/{lib → libs}/parchment/registry.d.ts +0 -0
- /package/rich-text/{lib → libs}/parchment/scope.d.ts +0 -0
- /package/slider/{hook → hooks}/useInterval.d.ts +0 -0
- /package/slider/{hook → hooks}/useLegalValue.d.ts +0 -0
- /package/splitter/{SplitBar.d.ts → Bar.d.ts} +0 -0
- /package/steps/{Step.d.ts → Item.d.ts} +0 -0
- /package/table/{constant.d.ts → constants.d.ts} +0 -0
- /package/table/{hook → hooks}/useColumns.d.ts +0 -0
- /package/table/{hook → hooks}/useComponent.d.ts +0 -0
- /package/table/{hook → hooks}/useExpand.d.ts +0 -0
- /package/table/{hook → hooks}/useRowSelection.d.ts +0 -0
- /package/table/{hook → hooks}/useSorter.d.ts +0 -0
- /package/table/{hook → hooks}/useStickyClassNames.d.ts +0 -0
- /package/table/{hook → hooks}/useStickyOffsets.d.ts +0 -0
- /package/table/{hook → hooks}/useThResizable.d.ts +0 -0
- /package/tabs/{hook → hooks}/useDomSize.d.ts +0 -0
- /package/tree-select/{hook → hooks}/useKeyCache.d.ts +0 -0
- /package/tree-select/{hook → hooks}/useStateValue.d.ts +0 -0
- /package/tree-select/{hook → hooks}/useTreeData.d.ts +0 -0
- /package/upload/{constant.d.ts → constants.d.ts} +0 -0
- /package/virtual-list/{constant.d.ts → constants.d.ts} +0 -0
- /package/virtual-list/{hook → hooks}/useCacheChildrenNodes.d.ts +0 -0
- /package/virtual-list/{hook → hooks}/useComputeVirtualItemHeight.d.ts +0 -0
|
@@ -0,0 +1,4076 @@
|
|
|
1
|
+
/* 潘启宝 2026-06-25 08:58:50 星期四 山东省济南市 */
|
|
2
|
+
import { ConfigContext as e } from "../../../config-provider/context.js";
|
|
3
|
+
import { EMITTER_EVENT as t, emitter as n } from "../../../utils/emitter.js";
|
|
4
|
+
import r from "../../../config-provider/index.js";
|
|
5
|
+
import { clamp as i } from "../../libs/math/utils.js";
|
|
6
|
+
import { applyDarkModeFilter as a, isTransparent as o } from "../../common/colors.js";
|
|
7
|
+
import { APP_NAME as s, ARROW_TYPE as c, CLASSES as l, CURSOR_TYPE as u, DEFAULT_COLLISION_THRESHOLD as d, DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT as f, DEFAULT_REDUCED_GLOBAL_ALPHA as p, DEFAULT_TEXT_ALIGN as m, EVENT as h, FRAME_STYLE as g, IMAGE_MIME_TYPES as _, MAX_ALLOWED_FILE_BYTES as ee, MIME_TYPES as v, POINTER_BUTTON as y, POINTER_EVENTS as te, ROUNDNESS as ne, THEME as re, TOOL_TYPE as b, VERTICAL_ALIGN as ie, ZOOM_STEP as ae, supportsResizeObserver as oe } from "../../common/constants.js";
|
|
8
|
+
import { MQ_RIGHT_SIDEBAR_MIN_WIDTH as se, createUserAgentDescriptor as ce, deriveStylesPanelMode as le, getFormFactor as ue, isBrave as de, isIOS as fe, isSafari as pe, loadDesktopUIModePreference as me, setDesktopUIMode as he } from "../../common/editorInterface.js";
|
|
9
|
+
import { Emitter as ge } from "../../common/emitter.js";
|
|
10
|
+
import { getLineHeight as _e } from "../../common/font-metadata.js";
|
|
11
|
+
import { CODES as ve, KEYS as x, isArrowKey as ye, shouldMaintainAspectRatio as be, shouldResizeFromCenter as xe, shouldRotateWithDiscreteAngle as Se } from "../../common/keys.js";
|
|
12
|
+
import { vector as Ce, vectorDot as we, vectorFromPoint as Te, vectorNormalize as Ee, vectorSubtract as De } from "../../libs/math/vector.js";
|
|
13
|
+
import { pointDistance as Oe, pointFrom as S, pointRotateRads as ke } from "../../libs/math/point.js";
|
|
14
|
+
import "../../libs/math/index.js";
|
|
15
|
+
import { getGridPoint as C } from "../../common/points.js";
|
|
16
|
+
import { addEventListener as w, arrayToMap as Ae, debounce as je, distance as Me, easeOut as Ne, easeToValuesRAF as Pe, getDateTime as Fe, getFeatureFlag as T, getFontString as Ie, getNearestScrollableContainer as Le, invariant as E, isDevEnv as Re, isInputLike as ze, isSelectionLikeTool as Be, isShallowEqual as Ve, isTestEnv as He, isToolIcon as Ue, isWritableElement as We, muteFSAbortError as Ge, normalizeEOL as Ke, sceneCoordsToViewportCoords as qe, tupleToCoors as Je, updateActiveTool as D, updateObject as Ye, updateStable as Xe, viewportCoordsToSceneCoords as O } from "../../common/utils.js";
|
|
17
|
+
import { nanoid as Ze } from "../../libs/nanoid/index.js";
|
|
18
|
+
import { randomInteger as Qe } from "../../common/random.js";
|
|
19
|
+
import { normalizeLink as $e } from "../../common/url.js";
|
|
20
|
+
import "../../common/index.js";
|
|
21
|
+
import et from "../../libs/roughjs/rough.js";
|
|
22
|
+
import { hasBackground as tt } from "../../element/comparisons.js";
|
|
23
|
+
import { cropElement as nt, getUncroppedWidthAndHeight as rt } from "../../element/cropElement.js";
|
|
24
|
+
import { hasBoundTextElement as it, isArrowElement as at, isBindableElement as ot, isBindingElement as k, isBindingElementType as st, isBoundToContainer as ct, isElbowArrow as A, isEmbeddableElement as lt, isFlowchartNodeElement as ut, isFrameLikeElement as j, isIframeElement as dt, isIframeLikeElement as ft, isImageElement as M, isInitializedImageElement as pt, isLineElement as mt, isLinearElement as N, isLinearElementType as ht, isMagicFrameElement as gt, isSimpleArrow as _t, isTextBindableContainer as vt, isTextElement as P, isUsingAdaptiveRadius as yt } from "../../element/typeChecks.js";
|
|
25
|
+
import { excludeElementsInFramesFromSelection as bt, getElementsWithinSelection as xt, getSelectedElements as St, getSelectionStateForElements as Ct, isSomeElementSelected as wt, makeNextSelectedElementIds as F } from "../../element/selection.js";
|
|
26
|
+
import { getApproxMinLineHeight as Tt, getApproxMinLineWidth as Et, getLineHeightInPx as Dt, getMinTextElementWidth as Ot, isMeasureTextSupported as kt, measureText as At, normalizeText as jt } from "../../element/textMeasurements.js";
|
|
27
|
+
import { wrapText as Mt } from "../../element/textWrapping.js";
|
|
28
|
+
import { getBoundTextElement as Nt, getContainerCenter as Pt, getContainerElement as Ft, isValidTextContainer as It, redrawTextBoundingBox as Lt } from "../../element/textElement.js";
|
|
29
|
+
import { editGroupForSelectedElement as Rt, getElementsInGroup as zt, getSelectedGroupIdForElement as Bt, getSelectedGroupIds as Vt, isElementInGroup as Ht, isSelectedViaGroup as Ut, selectGroupsForSelectedElements as I } from "../../element/groups.js";
|
|
30
|
+
import { mutateElement as Wt, newElementWith as L } from "../../element/mutateElement.js";
|
|
31
|
+
import { addElementsToFrame as Gt, elementOverlapsWithFrame as Kt, filterElementsEligibleAsFrameChildren as qt, getContainingFrame as Jt, getElementsInNewFrame as Yt, getElementsInResizingFrame as Xt, getElementsOverlappingFrame as Zt, getFrameChildren as Qt, getFrameLikeTitle as $t, isCursorInFrame as en, isElementInFrame as tn, removeElementsFromFrame as nn, replaceAllElementsInFrame as rn, updateFrameMembershipOfSelectedElements as an } from "../../element/frame.js";
|
|
32
|
+
import { getRenderOpacity as on } from "../../element/renderElement.js";
|
|
33
|
+
import { ShapeCache as sn } from "../../element/shape.js";
|
|
34
|
+
import { getCornerRadius as cn, isPathALoop as ln } from "../../element/utils.js";
|
|
35
|
+
import { getHoveredElementForBinding as R, hitElementBoundText as un, hitElementBoundingBox as dn, hitElementBoundingBoxOnly as fn, hitElementItself as pn, isPointInElement as mn } from "../../element/collision.js";
|
|
36
|
+
import { bindOrUnbindBindingElement as hn, bindOrUnbindBindingElements as gn, calculateFixedPointForNonElbowArrowBinding as _n, fixBindingsAfterDeletion as vn, isBindingEnabled as yn, maxBindingDistance_simple as bn, shouldEnableBindingForPointerEvent as xn, updateBoundElements as Sn } from "../../element/binding.js";
|
|
37
|
+
import { syncInvalidIndices as Cn, syncMovedIndices as wn } from "../../element/fractionalIndex.js";
|
|
38
|
+
import { LinearElementEditor as z } from "../../element/linearElementEditor.js";
|
|
39
|
+
import { doBoundsIntersect as Tn, getCommonBounds as En, getElementAbsoluteCoords as Dn, getElementBounds as On, getVisibleSceneBounds as kn } from "../../element/bounds.js";
|
|
40
|
+
import { getNormalizedDimensions as An, isElementCompletelyInViewport as jn, isElementInViewport as Mn, isInvisiblySmallElement as Nn } from "../../element/sizeHelpers.js";
|
|
41
|
+
import { handleFocusPointDrag as Pn, handleFocusPointHover as Fn, handleFocusPointPointerDown as In, handleFocusPointPointerUp as Ln } from "../../element/arrows/focus.js";
|
|
42
|
+
import { maybeHandleArrowPointlikeDrag as Rn } from "../../element/arrows/helpers.js";
|
|
43
|
+
import { isNonDeletedElement as zn } from "../../element/is.js";
|
|
44
|
+
import { Scene as Bn } from "../../element/Scene.js";
|
|
45
|
+
import { deepCopyElement as Vn, duplicateElements as Hn } from "../../element/duplicate.js";
|
|
46
|
+
import { CaptureUpdateAction as B, Store as Un, StoreDelta as Wn, getObservedAppState as Gn } from "../../element/store.js";
|
|
47
|
+
import { dragNewElement as Kn, dragSelectedElements as qn, getDragOffsetXY as Jn } from "../../element/dragElements.js";
|
|
48
|
+
import { isElementLink as Yn, parseElementLinkFromURL as Xn } from "../../element/elementLink.js";
|
|
49
|
+
import { newArrowElement as Zn, newElement as Qn, newEmbeddableElement as $n, newFrameElement as er, newFreeDrawElement as tr, newIframeElement as nr, newImageElement as rr, newLinearElement as ir, newMagicFrameElement as ar, newTextElement as or, refreshTextDimensions as sr } from "../../element/newElement.js";
|
|
50
|
+
import { createSrcDoc as cr, embeddableURLValidator as lr, maybeParseEmbedSrc as ur } from "../../element/embeddable.js";
|
|
51
|
+
import { FlowChartCreator as dr, FlowChartNavigator as fr, getLinkDirectionFromKey as pr } from "../../element/flowchart.js";
|
|
52
|
+
import { getInitializedImageElements as mr, normalizeSVG as hr, updateImageCache as gr } from "../../element/image.js";
|
|
53
|
+
import { positionElementsOnGrid as _r } from "../../element/positionElementsOnGrid.js";
|
|
54
|
+
import { getResizeArrowDirection as vr, getResizeOffsetXY as yr, transformElements as br } from "../../element/resizeElements.js";
|
|
55
|
+
import { hasBoundingBox as xr } from "../../element/transformHandles.js";
|
|
56
|
+
import { getCursorForResizingElement as Sr, getElementWithTransformHandleType as Cr, getTransformHandleTypeFromCoords as wr } from "../../element/resizeTest.js";
|
|
57
|
+
import { convertToDrawElements as Tr } from "../../element/transform.js";
|
|
58
|
+
import "../../element/index.js";
|
|
59
|
+
import { trackEvent as V } from "../analytics.js";
|
|
60
|
+
import { ActionManager as Er } from "../actions/manager.js";
|
|
61
|
+
import { getDefaultAppState as Dr, isEraserActive as Or, isHandToolActive as kr } from "../appState.js";
|
|
62
|
+
import { History as Ar } from "../history.js";
|
|
63
|
+
import { AppContext as jr, AppPropsContext as Mr, DrawActionManagerContext as Nr, DrawAppStateContext as Pr, DrawContainerContext as Fr, DrawElementsContext as Ir, DrawHistoryContext as Lr, DrawSetAppStateContext as Rr, EditorInterfaceContext as zr, editorInterfaceContextInitialValue as Br } from "./context.js";
|
|
64
|
+
import { editorJotaiStore as Vr } from "../editor-jotai.js";
|
|
65
|
+
import { defaultLang as Hr, getLanguage as Ur, languages as Wr, setLanguage as Gr, t as H } from "../i18n.js";
|
|
66
|
+
import { getNormalizedZoom as Kr } from "../scene/normalize.js";
|
|
67
|
+
import { calculateScrollCenter as qr } from "../scene/scroll.js";
|
|
68
|
+
import "../scene/index.js";
|
|
69
|
+
import { actions as Jr } from "../actions/register.js";
|
|
70
|
+
import { actionDeleteSelected as Yr } from "../actions/actionDeleteSelected.js";
|
|
71
|
+
import { getShortcutKey as Xr } from "../shortcut.js";
|
|
72
|
+
import { actionDuplicateSelection as Zr } from "../actions/actionDuplicateSelection.js";
|
|
73
|
+
import { ImageSceneDataError as Qr } from "../errors.js";
|
|
74
|
+
import { fileOpen as $r } from "../data/filesystem.js";
|
|
75
|
+
import { Fonts as ei } from "../fonts/Fonts.js";
|
|
76
|
+
import "../fonts/index.js";
|
|
77
|
+
import { restoreAppState as ti, restoreElements as ni } from "../data/restore.js";
|
|
78
|
+
import { ImageURLToFile as ri, SVGStringToFile as ii, dataURLToString as ai, generateIdFromFile as oi, getDataURL as si, getDataURL_sync as ci, isImageFileHandle as li, isSupportedImageFile as ui, loadFromBlob as di, loadSceneOrLibraryFromBlob as fi, normalizeFile as pi, parseLibraryJSON as mi, resizeImageFile as hi } from "../data/blob.js";
|
|
79
|
+
import { copyTextToSystemClipboard as gi, parseClipboard as _i, parseDataTransferEvent as vi } from "../clipboard.js";
|
|
80
|
+
import { MagicIcon as yi } from "./icons.js";
|
|
81
|
+
import { actionSelectAll as bi } from "../actions/actionSelectAll.js";
|
|
82
|
+
import { actionBringForward as xi, actionBringToFront as Si, actionSendBackward as Ci, actionSendToBack as wi } from "../actions/actionZindex.js";
|
|
83
|
+
import { resetCursor as U, setCursor as W, setCursorForShape as G, setEraserCursor as Ti } from "../cursor.js";
|
|
84
|
+
import { getStateForZoom as Ei } from "../scene/zoom.js";
|
|
85
|
+
import { actionToggleHandTool as Di, zoomToFit as Oi } from "../actions/actionCanvas.js";
|
|
86
|
+
import { actionFinalize as K } from "../actions/actionFinalize.js";
|
|
87
|
+
import { exportCanvas as ki } from "../data/utils.js";
|
|
88
|
+
import "../data/index.js";
|
|
89
|
+
import { actionCopyStyles as Ai, actionPasteStyles as ji } from "../actions/actionStyles.js";
|
|
90
|
+
import { actionGroup as Mi, actionUngroup as Ni } from "../actions/actionGroup.js";
|
|
91
|
+
import { actionAddToLibrary as Pi } from "../actions/actionAddToLibrary.js";
|
|
92
|
+
import { actionFlipHorizontal as Fi, actionFlipVertical as Ii } from "../actions/actionFlip.js";
|
|
93
|
+
import { actionCopy as Li, actionCopyAsPng as Ri, actionCopyAsSvg as zi, actionCut as Bi, actionPaste as Vi, copyText as Hi } from "../actions/actionClipboard.js";
|
|
94
|
+
import { actionToggleGridMode as Ui } from "../actions/actionToggleGridMode.js";
|
|
95
|
+
import { actionToggleObjectsSnapMode as Wi } from "../actions/actionToggleObjectsSnapMode.js";
|
|
96
|
+
import { actionToggleZenMode as Gi } from "../actions/actionToggleZenMode.js";
|
|
97
|
+
import { actionBindText as Ki, actionUnbindText as qi, actionWrapTextInContainer as Ji } from "../actions/actionBoundText.js";
|
|
98
|
+
import { actionToggleElementLock as Yi, actionUnlockAllElements as Xi } from "../actions/actionElementLock.js";
|
|
99
|
+
import { actionToggleLinearEditor as Zi } from "../actions/actionLinearEditor.js";
|
|
100
|
+
import { actionToggleStats as Qi } from "../actions/actionToggleStats.js";
|
|
101
|
+
import { actionToggleCropEditor as $i } from "../actions/actionCropEditor.js";
|
|
102
|
+
import "../actions/index.js";
|
|
103
|
+
import { actionCopyElementLink as ea } from "../actions/actionElementLink.js";
|
|
104
|
+
import { actionRemoveAllElementsFromFrame as ta, actionSelectAllElementsInFrame as na, actionWrapSelectionInFrame as ra } from "../actions/actionFrame.js";
|
|
105
|
+
import { createRedoAction as ia, createUndoAction as aa } from "../actions/actionHistory.js";
|
|
106
|
+
import { actionTextAutoResize as oa } from "../actions/actionTextAutoResize.js";
|
|
107
|
+
import { actionToggleViewMode as sa } from "../actions/actionToggleViewMode.js";
|
|
108
|
+
import { getShortcutFromShortcutName as ca } from "../actions/shortcuts.js";
|
|
109
|
+
import { AnimationFrameHandler as la } from "../animation-frame-handler.js";
|
|
110
|
+
import ua, { distributeLibraryItemsOnSquareGrid as da } from "../data/library.js";
|
|
111
|
+
import { EraserTrail as fa } from "../eraser/index.js";
|
|
112
|
+
import { getCenter as pa, getDistance as ma } from "../gesture.js";
|
|
113
|
+
import { LaserTrails as ha } from "../laser-trails.js";
|
|
114
|
+
import { LassoTrail as ga } from "../lasso/index.js";
|
|
115
|
+
import { withBatchedUpdates as q, withBatchedUpdatesThrottled as _a } from "../reactUtils.js";
|
|
116
|
+
import { Renderer as va } from "../scene/Renderer.js";
|
|
117
|
+
import { isOverScrollBars as ya } from "../scene/scrollbars.js";
|
|
118
|
+
import { SnapCache as J, getReferenceSnapPoints as ba, getSnapLinesAtPointer as xa, getVisibleGaps as Sa, isActiveToolNonLinearSnappable as Ca, isGridModeEnabled as wa, isSnappingEnabled as Ta, snapDraggedElements as Ea, snapNewElement as Da, snapResizingElements as Oa } from "../snapping.js";
|
|
119
|
+
import { textWysiwyg as ka } from "../wysiwyg/textWysiwyg.js";
|
|
120
|
+
import { activeConfirmDialogAtom as Aa } from "./ActiveConfirmDialog.js";
|
|
121
|
+
import ja from "./BraveMeasureTextError.js";
|
|
122
|
+
import { CONTEXT_MENU_SEPARATOR as Y, ContextMenu as Ma } from "./ContextMenu.js";
|
|
123
|
+
import Na, { convertElementTypePopupAtom as Pa, convertElementTypes as Fa, getConversionTypeFromElements as Ia } from "./ConvertElementTypePopup.js";
|
|
124
|
+
import { ElementCanvasButtons as La } from "./ElementCanvasButtons.js";
|
|
125
|
+
import { activeEyeDropperAtom as Ra } from "./EyeDropper.js";
|
|
126
|
+
import { findShapeByKey as za } from "./shapes.js";
|
|
127
|
+
import { searchItemInFocusAtom as Ba } from "./SearchMenu.js";
|
|
128
|
+
import Va from "./LayerUI.js";
|
|
129
|
+
import { ElementCanvasButton as Ha } from "./MagicButton.js";
|
|
130
|
+
import { SVGLayer as Ua } from "./SVGLayer.js";
|
|
131
|
+
import { Toast as Wa } from "./Toast.js";
|
|
132
|
+
import Ga from "./UnlockPopup.js";
|
|
133
|
+
import Ka from "./canvases/InteractiveCanvas.js";
|
|
134
|
+
import qa from "./canvases/StaticCanvas.js";
|
|
135
|
+
import "./canvases/index.js";
|
|
136
|
+
import Ja from "./canvases/NewElementCanvas.js";
|
|
137
|
+
import Ya, { Component as Xa } from "react";
|
|
138
|
+
import { UI_PC_PREFIX as Za } from "@unicom-cloud/utils/constants/ui";
|
|
139
|
+
import { Fragment as Qa, jsx as X, jsxs as $a } from "react/jsx-runtime";
|
|
140
|
+
import eo from "lodash/throttle";
|
|
141
|
+
import { flushSync as Z } from "react-dom";
|
|
142
|
+
import to from "@unicom-cloud/icons/IconUiCopy";
|
|
143
|
+
import * as no from "@unicom-cloud/utils/ui-color";
|
|
144
|
+
import ro from "@unicom-cloud/utils/class-name";
|
|
145
|
+
import io from "@unicom-cloud/icons/IconUiFullscreen";
|
|
146
|
+
import ao from "lodash/isUndefined";
|
|
147
|
+
//#region components/pc/draw/core/components/App.tsx
|
|
148
|
+
var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
149
|
+
horizontal: null,
|
|
150
|
+
vertical: null
|
|
151
|
+
}, Q = 0, mo = !1, ho = !1, go = 0, _o = !1, vo = null, $ = {
|
|
152
|
+
pointers: /* @__PURE__ */ new Map(),
|
|
153
|
+
lastCenter: null,
|
|
154
|
+
initialDistance: null,
|
|
155
|
+
initialScale: null
|
|
156
|
+
}, yo = class yo extends Xa {
|
|
157
|
+
#e;
|
|
158
|
+
#t;
|
|
159
|
+
get rootElement() {
|
|
160
|
+
return this.getRootElement();
|
|
161
|
+
}
|
|
162
|
+
#n;
|
|
163
|
+
#r;
|
|
164
|
+
#i;
|
|
165
|
+
#a;
|
|
166
|
+
#o;
|
|
167
|
+
#s;
|
|
168
|
+
#c;
|
|
169
|
+
#l;
|
|
170
|
+
#u;
|
|
171
|
+
constructor(t) {
|
|
172
|
+
super(t), this.interactiveCanvas = null, this.unmounted = !1, this.editorInterface = Br, this.#e = le(Br), this.#t = Ya.createRef(), this.getRootElement = () => this.#t.current, this.files = {}, this.imageCache = /* @__PURE__ */ new Map(), this.#a = /* @__PURE__ */ new Map(), this.#o = /* @__PURE__ */ new Map(), this.#s = /* @__PURE__ */ new Set(), this.#c = () => {
|
|
173
|
+
this.setToast(null);
|
|
174
|
+
}, this.#l = /* @__PURE__ */ new Set(), this.flowChartCreator = new dr(), this.#u = new fr(), this.bindModeHandler = null, this.lastPointerDownEvent = null, this.lastPointerUpEvent = null, this.lastPointerMoveEvent = null, this.lastPointerMoveCoords = null, this.previousPointerMoveCoords = null, this.lastViewportPosition = {
|
|
175
|
+
x: 0,
|
|
176
|
+
y: 0
|
|
177
|
+
}, this.animationFrameHandler = new la(), this.laserTrails = new ha(this.animationFrameHandler, this), this.eraserTrail = new fa(this.animationFrameHandler, this), this.lassoTrail = new ga(this.animationFrameHandler, this), this.onChangeEmitter = new ge(), this.onPointerDownEmitter = new ge(), this.onPointerUpEmitter = new ge(), this.onScrollChangeEmitter = new ge(), this.missingPointerEventCleanupEmitter = new ge(), this.onRemoveEventListenersEmitter = new ge(), this.updateEditorAtom = (e, ...t) => {
|
|
178
|
+
let n = Vr.set(e, ...t);
|
|
179
|
+
return this.#se(), n;
|
|
180
|
+
}, this.#p = null, this.getEffectiveGridSize = () => wa(this) ? this.state.gridSize : null, this.#y = (e, t) => {
|
|
181
|
+
this.#o.set(e.id, t), sn.delete(e);
|
|
182
|
+
}, this.#b = () => {
|
|
183
|
+
let e = /* @__PURE__ */ new Set(), t = !1;
|
|
184
|
+
this.scene.getNonDeletedElements().filter((n) => {
|
|
185
|
+
if (lt(n)) {
|
|
186
|
+
if (e.add(n.id), !this.#o.has(n.id)) {
|
|
187
|
+
t = !0;
|
|
188
|
+
let e = lr(n.link, this.props.validateEmbeddable);
|
|
189
|
+
this.#y(n, e);
|
|
190
|
+
}
|
|
191
|
+
} else dt(n) && e.add(n.id);
|
|
192
|
+
return !1;
|
|
193
|
+
}), t && this.scene.triggerUpdate(), this.#a.forEach((t, n) => {
|
|
194
|
+
e.has(n) || this.#a.delete(n);
|
|
195
|
+
});
|
|
196
|
+
}, this.#S = (e) => `${this.id}-frame-name-${e.id}`, this.frameNameBoundsCache = {
|
|
197
|
+
get: (e) => {
|
|
198
|
+
let t = this.frameNameBoundsCache._cache.get(e.id);
|
|
199
|
+
if (!t || t.zoom !== this.state.zoom.value || t.versionNonce !== e.versionNonce) {
|
|
200
|
+
let n = document.getElementById(this.#S(e));
|
|
201
|
+
if (n) {
|
|
202
|
+
let r = n.getBoundingClientRect(), i = O({
|
|
203
|
+
clientX: r.x,
|
|
204
|
+
clientY: r.y
|
|
205
|
+
}, this.state), a = O({
|
|
206
|
+
clientX: r.right,
|
|
207
|
+
clientY: r.bottom
|
|
208
|
+
}, this.state);
|
|
209
|
+
return t = {
|
|
210
|
+
x: i.x,
|
|
211
|
+
y: i.y,
|
|
212
|
+
width: a.x - i.x,
|
|
213
|
+
height: a.y - i.y,
|
|
214
|
+
angle: 0,
|
|
215
|
+
zoom: this.state.zoom.value,
|
|
216
|
+
versionNonce: e.versionNonce
|
|
217
|
+
}, this.frameNameBoundsCache._cache.set(e.id, t), t;
|
|
218
|
+
}
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
221
|
+
return t;
|
|
222
|
+
},
|
|
223
|
+
_cache: /* @__PURE__ */ new Map()
|
|
224
|
+
}, this.#C = (e) => {
|
|
225
|
+
e && this.scene.mutateElement(e, { name: e.name?.trim?.() || null }), this.setState({ editingFrame: null });
|
|
226
|
+
}, this.#T = () => {
|
|
227
|
+
if (!this.state.frameRendering.enabled || !this.state.frameRendering.name) return this.state.editingFrame && this.#C(null), null;
|
|
228
|
+
let e = this.scene.getNonDeletedFramesLikes(), t = e.length > 0 && this.state.searchMatches?.focusedId && j(this.scene.getElement(this.state.searchMatches.focusedId)) ? this.state.searchMatches.matches.find((e) => e.focus) : null;
|
|
229
|
+
return e.map((e) => {
|
|
230
|
+
if (!Mn(e, this.canvas.width / window.devicePixelRatio, this.canvas.height / window.devicePixelRatio, {
|
|
231
|
+
offsetLeft: this.state.offsetLeft,
|
|
232
|
+
offsetTop: this.state.offsetTop,
|
|
233
|
+
scrollX: this.state.scrollX,
|
|
234
|
+
scrollY: this.state.scrollY,
|
|
235
|
+
zoom: this.state.zoom
|
|
236
|
+
}, this.scene.getNonDeletedElementsMap())) return this.state.editingFrame === e.id && this.#C(e), null;
|
|
237
|
+
let { x: n, y: r } = qe({
|
|
238
|
+
sceneX: e.x,
|
|
239
|
+
sceneY: e.y
|
|
240
|
+
}, this.state), i, o = $t(e);
|
|
241
|
+
if (e.id === this.state.editingFrame) {
|
|
242
|
+
let t = o;
|
|
243
|
+
i = /* @__PURE__ */ X("input", {
|
|
244
|
+
autoFocus: !0,
|
|
245
|
+
value: t,
|
|
246
|
+
onChange: (t) => {
|
|
247
|
+
this.scene.mutateElement(e, { name: t.target.value });
|
|
248
|
+
},
|
|
249
|
+
onFocus: (e) => e.target.select(),
|
|
250
|
+
onBlur: () => this.#C(e),
|
|
251
|
+
onKeyDown: (t) => {
|
|
252
|
+
(t.key === x.ESCAPE || t.key === x.ENTER) && this.#C(e);
|
|
253
|
+
},
|
|
254
|
+
style: {
|
|
255
|
+
background: this.#w ? a(this.state.viewBackgroundColor) : this.state.viewBackgroundColor,
|
|
256
|
+
zIndex: 2,
|
|
257
|
+
border: "none",
|
|
258
|
+
display: "block",
|
|
259
|
+
padding: "6px",
|
|
260
|
+
borderRadius: 4,
|
|
261
|
+
boxShadow: "inset 0 0 0 1px var(--color-primary)",
|
|
262
|
+
fontFamily: "Assistant",
|
|
263
|
+
fontSize: `${g.nameFontSize}px`,
|
|
264
|
+
transform: "translate(-6px, 6px)",
|
|
265
|
+
color: this.#w ? g.nameColorDarkTheme : g.nameColorLightTheme,
|
|
266
|
+
overflow: "hidden",
|
|
267
|
+
maxWidth: `${document.body.clientWidth - n - 6}px`
|
|
268
|
+
},
|
|
269
|
+
size: t.length + 1 || 1,
|
|
270
|
+
dir: "auto",
|
|
271
|
+
autoComplete: "off",
|
|
272
|
+
autoCapitalize: "off",
|
|
273
|
+
autoCorrect: "off"
|
|
274
|
+
});
|
|
275
|
+
} else i = o;
|
|
276
|
+
return /* @__PURE__ */ X("div", {
|
|
277
|
+
id: this.#S(e),
|
|
278
|
+
className: l.FRAME_NAME,
|
|
279
|
+
style: {
|
|
280
|
+
position: "absolute",
|
|
281
|
+
bottom: `${this.state.height + g.nameOffsetY - r + this.state.offsetTop}px`,
|
|
282
|
+
left: `${n - this.state.offsetLeft}px`,
|
|
283
|
+
zIndex: 2,
|
|
284
|
+
fontSize: g.nameFontSize,
|
|
285
|
+
color: this.#w ? g.nameColorDarkTheme : g.nameColorLightTheme,
|
|
286
|
+
lineHeight: g.nameLineHeight,
|
|
287
|
+
width: "max-content",
|
|
288
|
+
maxWidth: t?.id === e.id && t?.focus ? "none" : `${e.width * this.state.zoom.value}px`,
|
|
289
|
+
overflow: e.id === this.state.editingFrame ? "visible" : "hidden",
|
|
290
|
+
whiteSpace: "nowrap",
|
|
291
|
+
textOverflow: "ellipsis",
|
|
292
|
+
cursor: u.MOVE,
|
|
293
|
+
pointerEvents: this.state.viewModeEnabled ? te.disabled : te.enabled
|
|
294
|
+
},
|
|
295
|
+
onPointerDown: (e) => this.#Ne(e),
|
|
296
|
+
onWheel: (e) => this.#wt(e),
|
|
297
|
+
onContextMenu: this.#yt,
|
|
298
|
+
onDoubleClick: () => {
|
|
299
|
+
this.setState({ editingFrame: e.id });
|
|
300
|
+
},
|
|
301
|
+
children: i
|
|
302
|
+
}, e.id);
|
|
303
|
+
});
|
|
304
|
+
}, this.render = () => {
|
|
305
|
+
let t = this.scene.getSelectedElements(this.state), { renderTopRightUI: n, renderTopLeftUI: i, renderCustomStats: a } = this.props, o = this.scene.getSceneNonce(), { elementsMap: s, visibleElements: c } = this.renderer.getRenderableElements({
|
|
306
|
+
sceneNonce: o,
|
|
307
|
+
zoom: this.state.zoom,
|
|
308
|
+
offsetLeft: this.state.offsetLeft,
|
|
309
|
+
offsetTop: this.state.offsetTop,
|
|
310
|
+
scrollX: this.state.scrollX,
|
|
311
|
+
scrollY: this.state.scrollY,
|
|
312
|
+
height: this.state.height,
|
|
313
|
+
width: this.state.width,
|
|
314
|
+
editingTextElement: this.state.editingTextElement,
|
|
315
|
+
newElementId: this.state.newElement?.id
|
|
316
|
+
});
|
|
317
|
+
this.visibleElements = c;
|
|
318
|
+
let l = this.scene.getNonDeletedElementsMap(), u = "setPointerCapture" in HTMLElement.prototype ? !1 : this.state.selectionElement || this.state.newElement || this.state.selectedElementsAreBeingDragged || this.state.resizingElement || this.state.activeTool.type === "laser" && this.state.cursorButton === "down", d = t[0], f = Vr.get(Pa)?.type === "panel";
|
|
319
|
+
return /* @__PURE__ */ X(r, {
|
|
320
|
+
componentConfig: {
|
|
321
|
+
Trigger: { className: `${Za}-draw-trigger` },
|
|
322
|
+
Modal: { className: `${Za}-draw-modal` },
|
|
323
|
+
Drawer: { className: `${Za}-draw-drawer` },
|
|
324
|
+
Notice: { className: `${Za}-draw-notice` }
|
|
325
|
+
},
|
|
326
|
+
children: /* @__PURE__ */ X("div", {
|
|
327
|
+
translate: "no",
|
|
328
|
+
className: ro("draw draw-container notranslate", {
|
|
329
|
+
"draw--view-mode": this.state.viewModeEnabled || this.state.openDialog?.name === "elementLinkSelector",
|
|
330
|
+
"draw--mobile": this.editorInterface.formFactor === "phone"
|
|
331
|
+
}, this.props.className),
|
|
332
|
+
style: {
|
|
333
|
+
"--ui-pointerEvents": u ? te.disabled : te.enabled,
|
|
334
|
+
"--right-sidebar-width": "302px",
|
|
335
|
+
...this.props.style
|
|
336
|
+
},
|
|
337
|
+
ref: this.#t,
|
|
338
|
+
onDrop: this.#vt,
|
|
339
|
+
tabIndex: 0,
|
|
340
|
+
onKeyDown: this.props.handleKeyboardGlobally ? void 0 : this.#le,
|
|
341
|
+
onPointerEnter: this.#E,
|
|
342
|
+
onPointerLeave: this.#E,
|
|
343
|
+
children: /* @__PURE__ */ X(e.Consumer, { children: (e) => /* @__PURE__ */ X(jr.Provider, {
|
|
344
|
+
value: this,
|
|
345
|
+
children: /* @__PURE__ */ X(Mr.Provider, {
|
|
346
|
+
value: this.props,
|
|
347
|
+
children: /* @__PURE__ */ X(Fr.Provider, {
|
|
348
|
+
value: this.drawContainerValue,
|
|
349
|
+
children: /* @__PURE__ */ X(zr.Provider, {
|
|
350
|
+
value: this.editorInterface,
|
|
351
|
+
children: /* @__PURE__ */ X(Rr.Provider, {
|
|
352
|
+
value: this.setAppState,
|
|
353
|
+
children: /* @__PURE__ */ X(Pr.Provider, {
|
|
354
|
+
value: this.state,
|
|
355
|
+
children: /* @__PURE__ */ X(Ir.Provider, {
|
|
356
|
+
value: this.scene.getNonDeletedElements(),
|
|
357
|
+
children: /* @__PURE__ */ $a(Lr.Provider, {
|
|
358
|
+
value: this.#i,
|
|
359
|
+
children: [/* @__PURE__ */ $a(Nr.Provider, {
|
|
360
|
+
value: this.actionManager,
|
|
361
|
+
children: [
|
|
362
|
+
/* @__PURE__ */ X(Va, {
|
|
363
|
+
canvas: this.canvas,
|
|
364
|
+
appState: this.state,
|
|
365
|
+
files: this.files,
|
|
366
|
+
setAppState: this.setAppState,
|
|
367
|
+
actionManager: this.actionManager,
|
|
368
|
+
elements: this.scene.getNonDeletedElements(),
|
|
369
|
+
onLockToggle: this.toggleLock,
|
|
370
|
+
onPenModeToggle: this.togglePenMode,
|
|
371
|
+
onHandToolToggle: this.onHandToolToggle,
|
|
372
|
+
langCode: Ur().code,
|
|
373
|
+
renderTopLeftUI: i,
|
|
374
|
+
renderTopRightUI: n,
|
|
375
|
+
renderCustomStats: a,
|
|
376
|
+
showExitZenModeBtn: this.props?.zenModeEnabled === void 0 && this.state.zenModeEnabled,
|
|
377
|
+
UIOptions: this.props.UIOptions,
|
|
378
|
+
onExportImage: this.onExportImage,
|
|
379
|
+
renderWelcomeScreen: !this.state.isLoading && this.state.showWelcomeScreen && this.state.activeTool.type === this.state.preferredSelectionTool.type && !this.state.zenModeEnabled && !this.scene.getElementsIncludingDeleted().length,
|
|
380
|
+
app: this,
|
|
381
|
+
isCollaborating: this.props.isCollaborating,
|
|
382
|
+
generateLinkForSelection: this.props.generateLinkForSelection,
|
|
383
|
+
children: this.props.children
|
|
384
|
+
}),
|
|
385
|
+
/* @__PURE__ */ X("div", { className: "draw-textEditorContainer" }),
|
|
386
|
+
/* @__PURE__ */ X("div", { className: "draw-contextMenuContainer" }),
|
|
387
|
+
/* @__PURE__ */ X("div", { className: "draw-eye-dropper-container" }),
|
|
388
|
+
/* @__PURE__ */ X(Ua, { trails: [
|
|
389
|
+
this.laserTrails,
|
|
390
|
+
this.lassoTrail,
|
|
391
|
+
this.eraserTrail
|
|
392
|
+
] }),
|
|
393
|
+
this.props.aiEnabled !== !1 && t.length === 1 && gt(d) && /* @__PURE__ */ X(La, {
|
|
394
|
+
element: d,
|
|
395
|
+
elementsMap: s,
|
|
396
|
+
children: /* @__PURE__ */ X(Ha, {
|
|
397
|
+
title: H("labels.convertToCode"),
|
|
398
|
+
icon: yi,
|
|
399
|
+
checked: !1,
|
|
400
|
+
onChange: () => this.#k(d, "button")
|
|
401
|
+
})
|
|
402
|
+
}),
|
|
403
|
+
t.length === 1 && dt(d) && d.customData?.generationData?.status === "done" && /* @__PURE__ */ $a(La, {
|
|
404
|
+
element: d,
|
|
405
|
+
elementsMap: s,
|
|
406
|
+
children: [/* @__PURE__ */ X(Ha, {
|
|
407
|
+
title: H("labels.copySource"),
|
|
408
|
+
icon: /* @__PURE__ */ X(to, {}),
|
|
409
|
+
checked: !1,
|
|
410
|
+
onChange: () => this.#A(d)
|
|
411
|
+
}), /* @__PURE__ */ X(Ha, {
|
|
412
|
+
title: "Enter fullscreen",
|
|
413
|
+
icon: /* @__PURE__ */ X(io, {}),
|
|
414
|
+
checked: !1,
|
|
415
|
+
onChange: () => {
|
|
416
|
+
let e = this.#g(d);
|
|
417
|
+
if (e) try {
|
|
418
|
+
e.requestFullscreen(), this.setState({
|
|
419
|
+
activeEmbeddable: {
|
|
420
|
+
element: d,
|
|
421
|
+
state: "active"
|
|
422
|
+
},
|
|
423
|
+
selectedElementIds: { [d.id]: !0 },
|
|
424
|
+
newElement: null,
|
|
425
|
+
selectionElement: null
|
|
426
|
+
});
|
|
427
|
+
} catch (e) {
|
|
428
|
+
console.warn(e), this.setState({ errorMessage: "Couldn't enter fullscreen" });
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
})]
|
|
432
|
+
}),
|
|
433
|
+
this.state.toast !== null && /* @__PURE__ */ X(Wa, {
|
|
434
|
+
message: this.state.toast.message,
|
|
435
|
+
duration: this.state.toast.duration,
|
|
436
|
+
closable: this.state.toast.closable,
|
|
437
|
+
onClose: this.#c
|
|
438
|
+
}),
|
|
439
|
+
this.state.contextMenu && /* @__PURE__ */ X(Ma, {
|
|
440
|
+
items: this.state.contextMenu.items,
|
|
441
|
+
top: this.state.contextMenu.top,
|
|
442
|
+
left: this.state.contextMenu.left,
|
|
443
|
+
actionManager: this.actionManager,
|
|
444
|
+
onClose: (e) => {
|
|
445
|
+
this.setState({ contextMenu: null }, () => {
|
|
446
|
+
this.focusContainer(), e?.();
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
}),
|
|
450
|
+
/* @__PURE__ */ X(qa, {
|
|
451
|
+
canvas: this.canvas,
|
|
452
|
+
rc: this.rc,
|
|
453
|
+
elementsMap: s,
|
|
454
|
+
allElementsMap: l,
|
|
455
|
+
visibleElements: c,
|
|
456
|
+
sceneNonce: o,
|
|
457
|
+
selectionNonce: this.state.selectionElement?.versionNonce,
|
|
458
|
+
scale: window.devicePixelRatio,
|
|
459
|
+
appState: this.state,
|
|
460
|
+
renderConfig: {
|
|
461
|
+
imageCache: this.imageCache,
|
|
462
|
+
isExporting: !1,
|
|
463
|
+
renderGrid: wa(this),
|
|
464
|
+
canvasBackgroundColor: this.state.viewBackgroundColor,
|
|
465
|
+
embedsValidationStatus: this.#o,
|
|
466
|
+
elementsPendingErasure: this.#l,
|
|
467
|
+
pendingFlowchartNodes: this.flowChartCreator.pendingNodes,
|
|
468
|
+
theme: this.state.theme
|
|
469
|
+
}
|
|
470
|
+
}),
|
|
471
|
+
this.state.newElement && /* @__PURE__ */ X(Ja, {
|
|
472
|
+
appState: this.state,
|
|
473
|
+
scale: window.devicePixelRatio,
|
|
474
|
+
rc: this.rc,
|
|
475
|
+
elementsMap: s,
|
|
476
|
+
allElementsMap: l,
|
|
477
|
+
renderConfig: {
|
|
478
|
+
imageCache: this.imageCache,
|
|
479
|
+
isExporting: !1,
|
|
480
|
+
renderGrid: !1,
|
|
481
|
+
canvasBackgroundColor: this.state.viewBackgroundColor,
|
|
482
|
+
embedsValidationStatus: this.#o,
|
|
483
|
+
elementsPendingErasure: this.#l,
|
|
484
|
+
pendingFlowchartNodes: null,
|
|
485
|
+
theme: this.state.theme
|
|
486
|
+
}
|
|
487
|
+
}),
|
|
488
|
+
/* @__PURE__ */ X(Ka, {
|
|
489
|
+
app: this,
|
|
490
|
+
containerRef: this.#t,
|
|
491
|
+
canvas: this.interactiveCanvas,
|
|
492
|
+
elementsMap: s,
|
|
493
|
+
visibleElements: c,
|
|
494
|
+
allElementsMap: l,
|
|
495
|
+
selectedElements: t,
|
|
496
|
+
sceneNonce: o,
|
|
497
|
+
selectionNonce: this.state.selectionElement?.versionNonce,
|
|
498
|
+
scale: window.devicePixelRatio,
|
|
499
|
+
appState: this.state,
|
|
500
|
+
renderScrollbars: this.props.renderScrollbars === !0,
|
|
501
|
+
editorInterface: this.editorInterface,
|
|
502
|
+
renderInteractiveSceneCallback: this.#J,
|
|
503
|
+
handleCanvasRef: this.#gt,
|
|
504
|
+
onContextMenu: this.#yt,
|
|
505
|
+
onPointerMove: this.#Ae,
|
|
506
|
+
onPointerUp: this.#Pe,
|
|
507
|
+
onPointerCancel: this.removePointer,
|
|
508
|
+
onTouchMove: this.#Me,
|
|
509
|
+
onPointerDown: this.#Ne,
|
|
510
|
+
onDoubleClick: this.#Oe
|
|
511
|
+
}),
|
|
512
|
+
this.#T(),
|
|
513
|
+
this.state.activeLockedId && /* @__PURE__ */ X(Ga, {
|
|
514
|
+
app: this,
|
|
515
|
+
activeLockedId: this.state.activeLockedId
|
|
516
|
+
}),
|
|
517
|
+
f && /* @__PURE__ */ X(Na, { app: this })
|
|
518
|
+
]
|
|
519
|
+
}), this.#x()]
|
|
520
|
+
})
|
|
521
|
+
})
|
|
522
|
+
})
|
|
523
|
+
})
|
|
524
|
+
})
|
|
525
|
+
})
|
|
526
|
+
})
|
|
527
|
+
}) })
|
|
528
|
+
})
|
|
529
|
+
});
|
|
530
|
+
}, this.focusContainer = () => {
|
|
531
|
+
this.rootElement?.focus?.();
|
|
532
|
+
}, this.getSceneElementsIncludingDeleted = () => this.scene.getElementsIncludingDeleted(), this.getSceneElementsMapIncludingDeleted = () => this.scene.getElementsMapIncludingDeleted(), this.getSceneElements = () => this.scene.getNonDeletedElements(), this.onInsertElements = (e) => {
|
|
533
|
+
this.addElementsFromPasteOrLibrary({
|
|
534
|
+
elements: e,
|
|
535
|
+
position: "center",
|
|
536
|
+
files: null
|
|
537
|
+
});
|
|
538
|
+
}, this.onExportImage = async (e, t, n) => {
|
|
539
|
+
V("export", e, "ui");
|
|
540
|
+
let r = await ki(e, t, this.state, this.files, {
|
|
541
|
+
exportBackground: this.state.exportBackground,
|
|
542
|
+
name: this.getName(),
|
|
543
|
+
viewBackgroundColor: this.state.viewBackgroundColor,
|
|
544
|
+
exportingFrame: n.exportingFrame
|
|
545
|
+
}).catch(Ge).catch((e) => {
|
|
546
|
+
console.error(e), this.setState({ errorMessage: e.message });
|
|
547
|
+
});
|
|
548
|
+
this.state.exportEmbedScene && r && li(r) && this.setState({ fileHandle: r });
|
|
549
|
+
}, this.#D = /* @__PURE__ */ new Map(), this.#O = ({ frameElement: e, data: t }) => {
|
|
550
|
+
t.status === "pending" ? this.scene.mutateElement(e, { customData: { generationData: void 0 } }, {
|
|
551
|
+
informMutation: !1,
|
|
552
|
+
isDragging: !1
|
|
553
|
+
}) : this.scene.mutateElement(e, { customData: { generationData: t } }, {
|
|
554
|
+
informMutation: !1,
|
|
555
|
+
isDragging: !1
|
|
556
|
+
}), this.#D.set(e.id, t), this.#se();
|
|
557
|
+
}, this.plugins = {}, this.onMagicframeToolSelect = () => {
|
|
558
|
+
let e = this.scene.getSelectedElements({ selectedElementIds: this.state.selectedElementIds });
|
|
559
|
+
if (e.length === 0) this.setActiveTool({ type: b.magicframe }), V("ai", "tool-select (empty-selection)", "d2c");
|
|
560
|
+
else {
|
|
561
|
+
let t = e.length === 1 && gt(e[0]) && e[0];
|
|
562
|
+
if (!t && e.some((e) => j(e) || e.frameId)) {
|
|
563
|
+
this.setActiveTool({ type: b.magicframe });
|
|
564
|
+
return;
|
|
565
|
+
}
|
|
566
|
+
V("ai", "tool-select (existing selection)", "d2c");
|
|
567
|
+
let n;
|
|
568
|
+
if (t) n = t;
|
|
569
|
+
else {
|
|
570
|
+
let [t, r, i, a] = En(e);
|
|
571
|
+
n = ar({
|
|
572
|
+
...g,
|
|
573
|
+
x: t - 50,
|
|
574
|
+
y: r - 50,
|
|
575
|
+
width: i - t + 100,
|
|
576
|
+
height: a - r + 100,
|
|
577
|
+
opacity: 100,
|
|
578
|
+
locked: !1
|
|
579
|
+
}), this.scene.insertElement(n);
|
|
580
|
+
for (let t of e) this.scene.mutateElement(t, { frameId: n.id });
|
|
581
|
+
this.setState({ selectedElementIds: { [n.id]: !0 } });
|
|
582
|
+
}
|
|
583
|
+
this.#k(n, "upstream");
|
|
584
|
+
}
|
|
585
|
+
}, this.#j = ({ type: e }) => {
|
|
586
|
+
this.updateEditorAtom(Ra, {
|
|
587
|
+
swapPreviewOnAlt: !0,
|
|
588
|
+
colorPickerType: e === "stroke" ? "elementStroke" : "elementBackground",
|
|
589
|
+
onSelect: (t, n) => {
|
|
590
|
+
let r = e === "background" && n.altKey || e === "stroke" && !n.altKey;
|
|
591
|
+
!this.scene.getSelectedElements(this.state).length || this.state.activeTool.type !== "selection" ? r ? this.syncActionResult({
|
|
592
|
+
appState: {
|
|
593
|
+
...this.state,
|
|
594
|
+
currentItemStrokeColor: t
|
|
595
|
+
},
|
|
596
|
+
captureUpdate: B.IMMEDIATELY
|
|
597
|
+
}) : this.syncActionResult({
|
|
598
|
+
appState: {
|
|
599
|
+
...this.state,
|
|
600
|
+
currentItemBackgroundColor: t
|
|
601
|
+
},
|
|
602
|
+
captureUpdate: B.IMMEDIATELY
|
|
603
|
+
}) : this.updateScene({
|
|
604
|
+
elements: this.scene.getElementsIncludingDeleted().map((e) => this.state.selectedElementIds[e.id] ? L(e, { [r ? "strokeColor" : "backgroundColor"]: t }) : e),
|
|
605
|
+
captureUpdate: B.IMMEDIATELY
|
|
606
|
+
});
|
|
607
|
+
},
|
|
608
|
+
keepOpenOnAlt: !1
|
|
609
|
+
});
|
|
610
|
+
}, this.dismissLinearEditor = () => {
|
|
611
|
+
setTimeout(() => {
|
|
612
|
+
this.state.selectedLinearElement?.isEditing && this.setState({ selectedLinearElement: {
|
|
613
|
+
...this.state.selectedLinearElement,
|
|
614
|
+
isEditing: !1
|
|
615
|
+
} });
|
|
616
|
+
});
|
|
617
|
+
}, this.syncActionResult = q((e) => {
|
|
618
|
+
if (this.unmounted || e === !1) return;
|
|
619
|
+
this.#r.scheduleAction(e.captureUpdate);
|
|
620
|
+
let t = !1, n = null;
|
|
621
|
+
if (e.elements && (this.scene.replaceAllElements(e.elements), t = !0), e.files && (this.#oe(e.files, e.replaceFiles), this.#ft()), e.appState || n || this.state.contextMenu) {
|
|
622
|
+
let r = e?.appState?.viewModeEnabled || !1, i = e?.appState?.zenModeEnabled || !1, a = e?.appState?.theme || this.props.theme || re.LIGHT, o = e?.appState?.name ?? this.state.name, s = e?.appState?.errorMessage ?? this.state.errorMessage;
|
|
623
|
+
this.props.viewModeEnabled !== void 0 && (r = this.props.viewModeEnabled), this.props.zenModeEnabled !== void 0 && (i = this.props.zenModeEnabled), n = e.appState?.editingTextElement || null, e.elements && n && e.elements.forEach((e) => {
|
|
624
|
+
n?.id === e.id && n !== e && zn(e) && P(e) && (n = e);
|
|
625
|
+
}), n?.isDeleted && (n = null), this.setState((t) => {
|
|
626
|
+
let c = e.appState || {};
|
|
627
|
+
return {
|
|
628
|
+
...t,
|
|
629
|
+
...c,
|
|
630
|
+
contextMenu: null,
|
|
631
|
+
editingTextElement: n,
|
|
632
|
+
viewModeEnabled: r,
|
|
633
|
+
zenModeEnabled: i,
|
|
634
|
+
theme: a,
|
|
635
|
+
name: o,
|
|
636
|
+
errorMessage: s
|
|
637
|
+
};
|
|
638
|
+
}), t = !0;
|
|
639
|
+
}
|
|
640
|
+
t || this.scene.triggerUpdate();
|
|
641
|
+
}), this.#M = q(() => {
|
|
642
|
+
lo = !1, this.setState({ isBindingEnabled: !0 });
|
|
643
|
+
}), this.#N = () => {
|
|
644
|
+
this.#M();
|
|
645
|
+
}, this.#P = (e) => {
|
|
646
|
+
e.preventDefault();
|
|
647
|
+
}, this.#F = () => {
|
|
648
|
+
this.#i.clear();
|
|
649
|
+
}, this.#I = () => {
|
|
650
|
+
this.#r.clear();
|
|
651
|
+
}, this.#L = q((e) => {
|
|
652
|
+
this.scene.replaceAllElements([]), this.setState((t) => ({
|
|
653
|
+
...Dr(),
|
|
654
|
+
isLoading: e?.resetLoadingState ? !1 : t.isLoading,
|
|
655
|
+
theme: this.state.theme
|
|
656
|
+
})), this.#I(), this.#F();
|
|
657
|
+
}), this.#R = async () => {
|
|
658
|
+
"launchQueue" in window && "LaunchParams" in window && window.launchQueue.setConsumer(async (e) => {
|
|
659
|
+
if (!e.files.length) return;
|
|
660
|
+
let t = e.files[0], n = await t.getFile();
|
|
661
|
+
this.loadFileToCanvas(new File([n], n.name || "", { type: n.type }), t);
|
|
662
|
+
}), this.props.theme && this.setState({ theme: this.props.theme }), this.state.isLoading || this.setState({ isLoading: !0 });
|
|
663
|
+
let e = null;
|
|
664
|
+
try {
|
|
665
|
+
e = typeof this.props.initialData == "function" ? await this.props.initialData() || null : await this.props.initialData || null, e?.libraryItems && this.library.updateLibrary({
|
|
666
|
+
libraryItems: e.libraryItems,
|
|
667
|
+
merge: !0
|
|
668
|
+
}).catch((e) => {
|
|
669
|
+
console.error(e);
|
|
670
|
+
});
|
|
671
|
+
} catch (t) {
|
|
672
|
+
console.error(t), e = { appState: { errorMessage: t.message || "Encountered an error during importing or restoring scene data" } };
|
|
673
|
+
}
|
|
674
|
+
let t = ni(e?.elements, null, {
|
|
675
|
+
repairBindings: !0,
|
|
676
|
+
deleteInvisibleElements: !0
|
|
677
|
+
}), n = ti(e?.appState, null), r = n.activeTool;
|
|
678
|
+
n.preferredSelectionTool.initialized || (n.preferredSelectionTool = {
|
|
679
|
+
type: this.editorInterface.formFactor === "phone" ? "lasso" : "selection",
|
|
680
|
+
initialized: !0
|
|
681
|
+
}), n = {
|
|
682
|
+
...n,
|
|
683
|
+
theme: this.props.theme || n.theme,
|
|
684
|
+
openSidebar: n?.openSidebar || this.state.openSidebar,
|
|
685
|
+
activeTool: r.type === "image" || r.type === "lasso" || r.type === "selection" ? {
|
|
686
|
+
...r,
|
|
687
|
+
type: n.preferredSelectionTool.type
|
|
688
|
+
} : n.activeTool,
|
|
689
|
+
isLoading: !1,
|
|
690
|
+
toast: this.state.toast
|
|
691
|
+
}, e?.scrollToContent && (n = {
|
|
692
|
+
...n,
|
|
693
|
+
...qr(t, {
|
|
694
|
+
...n,
|
|
695
|
+
width: this.state.width,
|
|
696
|
+
height: this.state.height,
|
|
697
|
+
offsetTop: this.state.offsetTop,
|
|
698
|
+
offsetLeft: this.state.offsetLeft
|
|
699
|
+
})
|
|
700
|
+
}), this.#I(), this.#F(), this.syncActionResult({
|
|
701
|
+
elements: t,
|
|
702
|
+
appState: n,
|
|
703
|
+
files: e?.files,
|
|
704
|
+
captureUpdate: B.NEVER
|
|
705
|
+
}), this.#H(), this.fonts.loadSceneFonts().then((e) => {
|
|
706
|
+
this.fonts.onLoaded(e);
|
|
707
|
+
}), Yn(window.location.href) && this.scrollToContent(window.location.href, { animate: !1 });
|
|
708
|
+
}, this.#z = (e, t) => this.props.UIOptions.getFormFactor?.(e, t) ?? ue(e, t), this.refreshEditorInterface = () => {
|
|
709
|
+
let e = this.rootElement;
|
|
710
|
+
if (!e) return;
|
|
711
|
+
let { width: t, height: n } = e.getBoundingClientRect(), r = me(), i = ce(typeof navigator < "u" ? navigator.userAgent : ""), a = this.props.UIOptions.dockedSidebarBreakpoint == null ? se : this.props.UIOptions.dockedSidebarBreakpoint, o = Ye(this.editorInterface, {
|
|
712
|
+
desktopUIMode: r ?? this.editorInterface.desktopUIMode,
|
|
713
|
+
formFactor: this.#z(t, n),
|
|
714
|
+
userAgent: i,
|
|
715
|
+
canFitSidebar: t > a,
|
|
716
|
+
isLandscape: t > n
|
|
717
|
+
});
|
|
718
|
+
this.editorInterface = o, this.#B(o);
|
|
719
|
+
}, this.#B = (e) => {
|
|
720
|
+
let t = le(e);
|
|
721
|
+
if (t === this.#e) return;
|
|
722
|
+
let n = this.#e;
|
|
723
|
+
this.#e = t, n !== "full" && t === "full" && this.setState((e) => ({ preferredSelectionTool: {
|
|
724
|
+
type: "selection",
|
|
725
|
+
initialized: !0
|
|
726
|
+
} }));
|
|
727
|
+
}, this.#V = (e) => {
|
|
728
|
+
let t = he(e);
|
|
729
|
+
this.editorInterface = Ye(this.editorInterface, { desktopUIMode: t }), this.#B(this.editorInterface);
|
|
730
|
+
}, this.#U = (e) => {
|
|
731
|
+
let { key: t, value: n } = e ?? {};
|
|
732
|
+
t !== "draw" && (n ? this.setState({ theme: re.DARK }) : this.setState({ theme: re.LIGHT }));
|
|
733
|
+
}, this.#W = q(() => {
|
|
734
|
+
this.scene.getElementsIncludingDeleted().forEach((e) => sn.delete(e)), this.refreshEditorInterface(), this.#Ot(), this.setState({});
|
|
735
|
+
}), this.#G = () => {
|
|
736
|
+
!document.fullscreenElement && this.state.activeEmbeddable?.state === "active" && this.setState({ activeEmbeddable: null });
|
|
737
|
+
}, this.#J = ({ atLeastOneVisibleElement: e, scrollBars: t, elementsMap: n }) => {
|
|
738
|
+
t && (po = t);
|
|
739
|
+
let r = this.state.editingTextElement ? !1 : !e && n.size > 0;
|
|
740
|
+
this.state.scrolledOutside !== r && this.setState({ scrolledOutside: r }), this.#pt();
|
|
741
|
+
}, this.#Y = je(() => {
|
|
742
|
+
let { offsetTop: e, offsetLeft: t } = this.#kt();
|
|
743
|
+
this.setState((n) => n.offsetLeft === t && n.offsetTop === e ? null : {
|
|
744
|
+
offsetTop: e,
|
|
745
|
+
offsetLeft: t
|
|
746
|
+
});
|
|
747
|
+
}, 100), this.#X = q((e) => {
|
|
748
|
+
!this.rootElement?.contains?.(document.activeElement) || We(e.target) || (this.actionManager.executeAction(Bi, "keyboard", e), e.preventDefault(), e.stopPropagation());
|
|
749
|
+
}), this.#Z = q((e) => {
|
|
750
|
+
!this.rootElement?.contains?.(document.activeElement) || We(e.target) || (this.actionManager.executeAction(Li, "keyboard", e), e.preventDefault(), e.stopPropagation());
|
|
751
|
+
}), this.#$ = (e) => {
|
|
752
|
+
if (fe && e.preventDefault(), !oo) {
|
|
753
|
+
oo = !0, e.touches.length === 1 && (co = {
|
|
754
|
+
x: e.touches[0].clientX,
|
|
755
|
+
y: e.touches[0].clientY
|
|
756
|
+
}), clearTimeout(so), so = window.setTimeout(yo.#Q, 300);
|
|
757
|
+
return;
|
|
758
|
+
}
|
|
759
|
+
if (oo && e.touches.length === 1 && co) {
|
|
760
|
+
let t = e.touches[0];
|
|
761
|
+
Oe(S(t.clientX, t.clientY), S(co.x, co.y)) <= 35 && (this.lassoTrail.endPath(), this.#ye(), this.#Oe({
|
|
762
|
+
clientX: t.clientX,
|
|
763
|
+
clientY: t.clientY
|
|
764
|
+
})), oo = !1, clearTimeout(so);
|
|
765
|
+
}
|
|
766
|
+
e.touches.length === 2 && this.setState({
|
|
767
|
+
selectedElementIds: F({}, this.state),
|
|
768
|
+
activeEmbeddable: null
|
|
769
|
+
});
|
|
770
|
+
}, this.#ee = (e) => {
|
|
771
|
+
this.#Ie(), e.touches.length > 0 ? this.setState({
|
|
772
|
+
previousSelectedElementIds: {},
|
|
773
|
+
selectedElementIds: F(this.state.previousSelectedElementIds, this.state)
|
|
774
|
+
}) : $.pointers.clear();
|
|
775
|
+
}, this.pasteFromClipboard = q(async (e) => {
|
|
776
|
+
let t = !!ho, n = document.activeElement, r = this.rootElement?.contains?.(n);
|
|
777
|
+
if (e && !r) return;
|
|
778
|
+
let i = document.elementFromPoint(this.lastViewportPosition.x, this.lastViewportPosition.y);
|
|
779
|
+
if (e && (!(i instanceof HTMLCanvasElement) || We(n))) return;
|
|
780
|
+
let a = await vi(e), o = a.getFiles(), s = await _i(a, t);
|
|
781
|
+
if (this.props.onPaste) try {
|
|
782
|
+
if (await this.props.onPaste(s, e) === !1) return;
|
|
783
|
+
} catch (e) {
|
|
784
|
+
console.error(e);
|
|
785
|
+
}
|
|
786
|
+
await this.#te(s, o, t), this.setActiveTool({ type: this.state.preferredSelectionTool.type }, !0), e?.preventDefault?.();
|
|
787
|
+
}), this.addElementsFromPasteOrLibrary = (e) => {
|
|
788
|
+
let t = ni(e.elements, null, { deleteInvisibleElements: !0 }), [n, r, i, a] = En(t), o = Me(n, i) / 2, s = Me(r, a) / 2, { x: c, y: l } = O({
|
|
789
|
+
clientX: typeof e.position == "object" ? e.position.clientX : e.position === "cursor" ? this.lastViewportPosition.x : this.state.width / 2 + this.state.offsetLeft,
|
|
790
|
+
clientY: typeof e.position == "object" ? e.position.clientY : e.position === "cursor" ? this.lastViewportPosition.y : this.state.height / 2 + this.state.offsetTop
|
|
791
|
+
}, this.state), [u, d] = C(c - o, l - s, this.getEffectiveGridSize()), { duplicatedElements: f } = Hn({
|
|
792
|
+
type: "everything",
|
|
793
|
+
elements: t.map((e) => L(e, {
|
|
794
|
+
x: e.x + u - n,
|
|
795
|
+
y: e.y + d - r
|
|
796
|
+
})),
|
|
797
|
+
randomizeSeed: !e.retainSeed
|
|
798
|
+
}), p = this.scene.getElementsIncludingDeleted(), m = [...p, ...f];
|
|
799
|
+
m = this.props.onDuplicate?.(m, p) || m, wn(m, Ae(f));
|
|
800
|
+
let h = this.#ke({
|
|
801
|
+
x: c,
|
|
802
|
+
y: l
|
|
803
|
+
});
|
|
804
|
+
if (h) {
|
|
805
|
+
let e = qt(f, h);
|
|
806
|
+
Gt(m, e, h, this.state);
|
|
807
|
+
}
|
|
808
|
+
this.scene.replaceAllElements(m), f.forEach((e) => {
|
|
809
|
+
P(e) && ct(e) && Lt(e, Ft(e, this.scene.getElementsMapIncludingDeleted()), this.scene);
|
|
810
|
+
}), pe && ei.loadElementsFonts(f).then((e) => {
|
|
811
|
+
this.fonts.onLoaded(e);
|
|
812
|
+
}), e.files && this.#oe(e.files);
|
|
813
|
+
let g = bt(f);
|
|
814
|
+
this.#r.scheduleCapture(), this.setState({
|
|
815
|
+
...this.state,
|
|
816
|
+
openSidebar: this.state.openSidebar && this.editorInterface.canFitSidebar ? this.state.openSidebar : null,
|
|
817
|
+
...I({
|
|
818
|
+
editingGroupId: null,
|
|
819
|
+
selectedElementIds: g.reduce((e, t) => (ct(t) || (e[t.id] = !0), e), {})
|
|
820
|
+
}, this.scene.getNonDeletedElements(), this.state, this)
|
|
821
|
+
}, () => {
|
|
822
|
+
e.files && this.#ft();
|
|
823
|
+
}), this.setActiveTool({ type: this.state.preferredSelectionTool.type }, !0), e.fitToContent && this.scrollToContent(f, {
|
|
824
|
+
fitToContent: !0,
|
|
825
|
+
canvasOffsets: this.getEditorUIOffsets()
|
|
826
|
+
});
|
|
827
|
+
}, this.setAppState = (e, t) => {
|
|
828
|
+
this.setState(e, t);
|
|
829
|
+
}, this.removePointer = (e) => {
|
|
830
|
+
Q && this.#Ie(), $.pointers.delete(e.pointerId);
|
|
831
|
+
}, this.toggleLock = (e = "ui") => {
|
|
832
|
+
this.state.activeTool.locked || V("toolbar", "toggleLock", `${e} (${this.editorInterface.formFactor === "phone" ? "mobile" : "desktop"})`), this.setState((e) => ({ activeTool: {
|
|
833
|
+
...e.activeTool,
|
|
834
|
+
...D(this.state, e.activeTool.locked ? { type: this.state.preferredSelectionTool.type } : e.activeTool),
|
|
835
|
+
locked: !e.activeTool.locked
|
|
836
|
+
} }));
|
|
837
|
+
}, this.updateFrameRendering = (e) => {
|
|
838
|
+
this.setState((t) => {
|
|
839
|
+
let n = typeof e == "function" ? e(t.frameRendering) : e;
|
|
840
|
+
return { frameRendering: {
|
|
841
|
+
enabled: n?.enabled ?? t.frameRendering.enabled,
|
|
842
|
+
clip: n?.clip ?? t.frameRendering.clip,
|
|
843
|
+
name: n?.name ?? t.frameRendering.name,
|
|
844
|
+
outline: n?.outline ?? t.frameRendering.outline
|
|
845
|
+
} };
|
|
846
|
+
});
|
|
847
|
+
}, this.togglePenMode = (e) => {
|
|
848
|
+
this.setState((t) => ({
|
|
849
|
+
penMode: e ?? !t.penMode,
|
|
850
|
+
penDetected: !0
|
|
851
|
+
}));
|
|
852
|
+
}, this.onHandToolToggle = () => {
|
|
853
|
+
this.actionManager.executeAction(Di);
|
|
854
|
+
}, this.zoomCanvas = (e) => {
|
|
855
|
+
this.setState({ ...Ei({
|
|
856
|
+
viewportX: this.state.width / 2 + this.state.offsetLeft,
|
|
857
|
+
viewportY: this.state.height / 2 + this.state.offsetTop,
|
|
858
|
+
nextZoom: Kr(e)
|
|
859
|
+
}, this.state) });
|
|
860
|
+
}, this.#ie = null, this.scrollToContent = (e = this.scene.getNonDeletedElements(), t) => {
|
|
861
|
+
if (typeof e == "string") {
|
|
862
|
+
let n;
|
|
863
|
+
if (n = Yn(e) ? Xn(e) : e, n) {
|
|
864
|
+
let r = this.scene.getElementsFromId(n);
|
|
865
|
+
r?.length ? this.scrollToContent(r, {
|
|
866
|
+
fitToContent: t?.fitToContent ?? !0,
|
|
867
|
+
animate: t?.animate ?? !0
|
|
868
|
+
}) : Yn(e) && this.setState({ toast: {
|
|
869
|
+
message: H("elementLink.notFound"),
|
|
870
|
+
duration: 3e3,
|
|
871
|
+
closable: !0
|
|
872
|
+
} });
|
|
873
|
+
}
|
|
874
|
+
return;
|
|
875
|
+
}
|
|
876
|
+
this.#ie?.();
|
|
877
|
+
let n = Array.isArray(e) ? e : [e], r = this.state.zoom, i = this.state.scrollX, a = this.state.scrollY;
|
|
878
|
+
if (t?.fitToContent || t?.fitToViewport) {
|
|
879
|
+
let { appState: e } = Oi({
|
|
880
|
+
canvasOffsets: t.canvasOffsets,
|
|
881
|
+
targetElements: n,
|
|
882
|
+
appState: this.state,
|
|
883
|
+
fitToViewport: !!t?.fitToViewport,
|
|
884
|
+
viewportZoomFactor: t?.viewportZoomFactor,
|
|
885
|
+
minZoom: t?.minZoom,
|
|
886
|
+
maxZoom: t?.maxZoom
|
|
887
|
+
});
|
|
888
|
+
r = e.zoom, i = e.scrollX, a = e.scrollY;
|
|
889
|
+
} else {
|
|
890
|
+
let e = qr(n, this.state);
|
|
891
|
+
i = e.scrollX, a = e.scrollY;
|
|
892
|
+
}
|
|
893
|
+
if (t?.animate) {
|
|
894
|
+
let e = this.state.scrollX, n = this.state.scrollY, o = this.state.zoom.value, s = Pe({
|
|
895
|
+
fromValues: {
|
|
896
|
+
scrollX: e,
|
|
897
|
+
scrollY: n,
|
|
898
|
+
zoom: o
|
|
899
|
+
},
|
|
900
|
+
toValues: {
|
|
901
|
+
scrollX: i,
|
|
902
|
+
scrollY: a,
|
|
903
|
+
zoom: r.value
|
|
904
|
+
},
|
|
905
|
+
interpolateValue: (e, t, n, r) => {
|
|
906
|
+
if (r === "zoom") return e * (t / e) ** +Ne(n);
|
|
907
|
+
},
|
|
908
|
+
onStep: ({ scrollX: e, scrollY: t, zoom: n }) => {
|
|
909
|
+
this.setState({
|
|
910
|
+
scrollX: e,
|
|
911
|
+
scrollY: t,
|
|
912
|
+
zoom: { value: n }
|
|
913
|
+
});
|
|
914
|
+
},
|
|
915
|
+
onStart: () => {
|
|
916
|
+
this.setState({ shouldCacheIgnoreZoom: !0 });
|
|
917
|
+
},
|
|
918
|
+
onEnd: () => {
|
|
919
|
+
this.setState({ shouldCacheIgnoreZoom: !1 });
|
|
920
|
+
},
|
|
921
|
+
onCancel: () => {
|
|
922
|
+
this.setState({ shouldCacheIgnoreZoom: !1 });
|
|
923
|
+
},
|
|
924
|
+
duration: t?.duration ?? 500
|
|
925
|
+
});
|
|
926
|
+
this.#ie = () => {
|
|
927
|
+
s(), this.#ie = null;
|
|
928
|
+
};
|
|
929
|
+
} else this.setState({
|
|
930
|
+
scrollX: i,
|
|
931
|
+
scrollY: a,
|
|
932
|
+
zoom: r
|
|
933
|
+
});
|
|
934
|
+
}, this.#ae = (e) => {
|
|
935
|
+
this.#ie?.(), this.setState(e);
|
|
936
|
+
}, this.setToast = (e) => {
|
|
937
|
+
this.setState({ toast: e });
|
|
938
|
+
}, this.restoreFileFromShare = async () => {
|
|
939
|
+
try {
|
|
940
|
+
let e = await caches.open("web-share-target"), t = await e.match("shared-file");
|
|
941
|
+
if (t) {
|
|
942
|
+
let n = await t.blob(), r = new File([n], n.name || "", { type: n.type });
|
|
943
|
+
this.loadFileToCanvas(r, null), await e.delete("shared-file"), window.history.replaceState(null, s, window.location.pathname);
|
|
944
|
+
}
|
|
945
|
+
} catch (e) {
|
|
946
|
+
this.setState({ errorMessage: e.message });
|
|
947
|
+
}
|
|
948
|
+
}, this.addFiles = q((e) => {
|
|
949
|
+
let { addedFiles: t } = this.#oe(e);
|
|
950
|
+
this.#H(t), this.scene.triggerUpdate(), this.#ft();
|
|
951
|
+
}), this.#oe = (e, t = !1) => {
|
|
952
|
+
let n = t ? {} : { ...this.files }, r = {}, i = Array.isArray(e) ? e : Object.values(e);
|
|
953
|
+
for (let e of i) if (!n[e.id] && (r[e.id] = e, n[e.id] = e, e.mimeType === v.svg)) try {
|
|
954
|
+
let t = ci(hr(ai(e.dataURL)), v.svg);
|
|
955
|
+
e.dataURL !== t && (e.version = (e.version ?? 1) + 1, e.dataURL = t);
|
|
956
|
+
} catch (e) {
|
|
957
|
+
console.error(e);
|
|
958
|
+
}
|
|
959
|
+
return this.files = n, { addedFiles: r };
|
|
960
|
+
}, this.updateScene = q((e) => {
|
|
961
|
+
let { elements: t, appState: n, collaborators: r, captureUpdate: i } = e;
|
|
962
|
+
if (i) {
|
|
963
|
+
let e = t || void 0, r = n ? Gn({
|
|
964
|
+
...this.#r.snapshot.appState,
|
|
965
|
+
...n
|
|
966
|
+
}) : void 0;
|
|
967
|
+
this.#r.scheduleMicroAction({
|
|
968
|
+
action: i,
|
|
969
|
+
elements: e,
|
|
970
|
+
appState: r
|
|
971
|
+
});
|
|
972
|
+
}
|
|
973
|
+
n && this.setState(n), t && this.scene.replaceAllElements(t), r && this.setState({ collaborators: r });
|
|
974
|
+
}), this.applyDeltas = (e, t) => {
|
|
975
|
+
let n = Wn.squash(...e), r = { ...this.state }, i = new Map(this.scene.getElementsMapIncludingDeleted());
|
|
976
|
+
return Wn.applyTo(n, i, r, t);
|
|
977
|
+
}, this.mutateElement = (e, t, n = !0) => this.scene.mutateElement(e, t, {
|
|
978
|
+
informMutation: n,
|
|
979
|
+
isDragging: !1
|
|
980
|
+
}), this.#se = (e) => {
|
|
981
|
+
e === !0 ? this.scene.triggerUpdate() : this.setState({});
|
|
982
|
+
}, this.toggleSidebar = ({ name: e, tab: t, force: n }) => {
|
|
983
|
+
let r;
|
|
984
|
+
r = ao(n) ? this.state.openSidebar?.name === e && this.state.openSidebar?.tab === t ? null : e : n ? e : null;
|
|
985
|
+
let i = r ? { name: r } : null;
|
|
986
|
+
return i && t && (i.tab = t), this.setState({ openSidebar: i }), !!r;
|
|
987
|
+
}, this.#ce = q((e) => {
|
|
988
|
+
this.lastViewportPosition.x = e.clientX, this.lastViewportPosition.y = e.clientY;
|
|
989
|
+
}), this.getEditorUIOffsets = () => {
|
|
990
|
+
let e = this.rootElement?.querySelector?.(".App-toolbar")?.getBoundingClientRect?.()?.bottom ?? 0, t = this.rootElement?.querySelector?.(".sidebar")?.getBoundingClientRect?.(), n = this.rootElement?.querySelector?.(".App-menu__left")?.getBoundingClientRect?.();
|
|
991
|
+
return Ur().rtl ? {
|
|
992
|
+
top: e + 16,
|
|
993
|
+
right: Math.max(this.state.width - (n?.left ?? this.state.width), 0) + 16,
|
|
994
|
+
bottom: 16,
|
|
995
|
+
left: Math.max(t?.right ?? 0, 0) + 16
|
|
996
|
+
} : {
|
|
997
|
+
top: e + 16,
|
|
998
|
+
right: Math.max(this.state.width - (t?.left ?? this.state.width) + 16, 0),
|
|
999
|
+
bottom: 16,
|
|
1000
|
+
left: Math.max(n?.right ?? 0, 0) + 16
|
|
1001
|
+
};
|
|
1002
|
+
}, this.#le = q((e) => {
|
|
1003
|
+
if ("Proxy" in window && (!e.shiftKey && /^[A-Z]$/.test(e.key) || e.shiftKey && /^[a-z]$/.test(e.key)) && (e = new Proxy(e, { get(t, n) {
|
|
1004
|
+
let r = t[n];
|
|
1005
|
+
return typeof r == "function" ? r.bind(t) : n === "key" ? e.shiftKey ? t.key.toUpperCase() : t.key.toLowerCase() : r;
|
|
1006
|
+
} })), !ze(e.target)) {
|
|
1007
|
+
if ((e.key === x.ESCAPE || e.key === x.ENTER) && this.state.croppingElementId) {
|
|
1008
|
+
this.#De();
|
|
1009
|
+
return;
|
|
1010
|
+
}
|
|
1011
|
+
let t = St(this.scene.getNonDeletedElementsMap(), this.state);
|
|
1012
|
+
if (t.length === 1 && M(t[0]) && e.key === x.ENTER) {
|
|
1013
|
+
this.#Ee(t[0]);
|
|
1014
|
+
return;
|
|
1015
|
+
}
|
|
1016
|
+
if (e.key === x.ESCAPE) this.updateEditorAtom(Pa, null);
|
|
1017
|
+
else if (e.key === x.TAB && (document.activeElement === this.rootElement || document.activeElement?.classList?.contains?.(l.CONVERT_ELEMENT_TYPE_POPUP))) {
|
|
1018
|
+
e.preventDefault();
|
|
1019
|
+
let n = Ia(t);
|
|
1020
|
+
Vr.get(Pa)?.type === "panel" && Fa(this, {
|
|
1021
|
+
conversionType: n,
|
|
1022
|
+
direction: e.shiftKey ? "left" : "right"
|
|
1023
|
+
}) && this.#r.scheduleCapture(), n && this.updateEditorAtom(Pa, { type: "panel" });
|
|
1024
|
+
}
|
|
1025
|
+
if (e.key === x.ESCAPE && this.flowChartCreator.isCreatingChart) {
|
|
1026
|
+
this.flowChartCreator.clear(), this.#se(!0);
|
|
1027
|
+
return;
|
|
1028
|
+
}
|
|
1029
|
+
let n = ye(e.key);
|
|
1030
|
+
if (e[x.CTRL_OR_CMD] && n && !e.shiftKey) {
|
|
1031
|
+
e.preventDefault();
|
|
1032
|
+
let t = St(this.scene.getNonDeletedElementsMap(), this.state);
|
|
1033
|
+
t.length === 1 && ut(t[0]) && this.flowChartCreator.createNodes(t[0], this.state, pr(e.key), this.scene), this.flowChartCreator.pendingNodes?.length && !jn(this.flowChartCreator.pendingNodes, this.canvas.width / window.devicePixelRatio, this.canvas.height / window.devicePixelRatio, {
|
|
1034
|
+
offsetLeft: this.state.offsetLeft,
|
|
1035
|
+
offsetTop: this.state.offsetTop,
|
|
1036
|
+
scrollX: this.state.scrollX,
|
|
1037
|
+
scrollY: this.state.scrollY,
|
|
1038
|
+
zoom: this.state.zoom
|
|
1039
|
+
}, this.scene.getNonDeletedElementsMap(), this.getEditorUIOffsets()) && this.scrollToContent(this.flowChartCreator.pendingNodes, {
|
|
1040
|
+
animate: !0,
|
|
1041
|
+
duration: 300,
|
|
1042
|
+
fitToContent: !0,
|
|
1043
|
+
canvasOffsets: this.getEditorUIOffsets()
|
|
1044
|
+
});
|
|
1045
|
+
return;
|
|
1046
|
+
}
|
|
1047
|
+
if (e.altKey) {
|
|
1048
|
+
let t = St(this.scene.getNonDeletedElementsMap(), this.state);
|
|
1049
|
+
if (t.length === 1 && n) {
|
|
1050
|
+
e.preventDefault();
|
|
1051
|
+
let n = this.#u.exploreByDirection(t[0], this.scene.getNonDeletedElementsMap(), pr(e.key));
|
|
1052
|
+
if (n) {
|
|
1053
|
+
this.setState((e) => ({ selectedElementIds: F({ [n]: !0 }, e) }));
|
|
1054
|
+
let e = this.scene.getNonDeletedElementsMap().get(n);
|
|
1055
|
+
e && !jn([e], this.canvas.width / window.devicePixelRatio, this.canvas.height / window.devicePixelRatio, {
|
|
1056
|
+
offsetLeft: this.state.offsetLeft,
|
|
1057
|
+
offsetTop: this.state.offsetTop,
|
|
1058
|
+
scrollX: this.state.scrollX,
|
|
1059
|
+
scrollY: this.state.scrollY,
|
|
1060
|
+
zoom: this.state.zoom
|
|
1061
|
+
}, this.scene.getNonDeletedElementsMap(), this.getEditorUIOffsets()) && this.scrollToContent(e, {
|
|
1062
|
+
animate: !0,
|
|
1063
|
+
duration: 300,
|
|
1064
|
+
canvasOffsets: this.getEditorUIOffsets()
|
|
1065
|
+
});
|
|
1066
|
+
}
|
|
1067
|
+
return;
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
if (e[x.CTRL_OR_CMD] && e.key === x.P && !e.shiftKey && !e.altKey) {
|
|
1072
|
+
this.setToast({ message: H("commandPalette.shortcutHint", { shortcut: ca("commandPalette") }) }), e.preventDefault();
|
|
1073
|
+
return;
|
|
1074
|
+
}
|
|
1075
|
+
if (e[x.CTRL_OR_CMD] && e.key.toLowerCase() === x.V && (ho = e.shiftKey, clearTimeout(go), go = window.setTimeout(() => {
|
|
1076
|
+
ho = !1;
|
|
1077
|
+
}, 100)), e[x.CTRL_OR_CMD] && We(e.target) && (e.code === ve.MINUS || e.code === ve.EQUAL)) {
|
|
1078
|
+
e.preventDefault();
|
|
1079
|
+
return;
|
|
1080
|
+
}
|
|
1081
|
+
if (We(e.target) && e.key !== x.ESCAPE || ye(e.key) && ze(e.target)) return;
|
|
1082
|
+
if (e.key === x.QUESTION_MARK) {
|
|
1083
|
+
this.setState({ openDialog: { name: "help" } });
|
|
1084
|
+
return;
|
|
1085
|
+
} else if (e.key.toLowerCase() === x.E && e.shiftKey && e[x.CTRL_OR_CMD]) {
|
|
1086
|
+
e.preventDefault(), this.setState({ openDialog: { name: "imageExport" } });
|
|
1087
|
+
return;
|
|
1088
|
+
}
|
|
1089
|
+
if (e.key === x.PAGE_UP || e.key === x.PAGE_DOWN) {
|
|
1090
|
+
let t = (e.shiftKey ? this.state.width : this.state.height) / this.state.zoom.value;
|
|
1091
|
+
e.key === x.PAGE_DOWN && (t = -t), e.shiftKey ? this.#ae((e) => ({ scrollX: e.scrollX + t })) : this.#ae((e) => ({ scrollY: e.scrollY + t }));
|
|
1092
|
+
}
|
|
1093
|
+
if (this.state.openDialog?.name === "elementLinkSelector" || (e.key === x.ALT && (T("COMPLEX_BINDINGS") ? this.#d() : Rn({
|
|
1094
|
+
app: this,
|
|
1095
|
+
event: e
|
|
1096
|
+
})), this.actionManager.handleKeyDown(e)) || this.state.viewModeEnabled) return;
|
|
1097
|
+
if (e[x.CTRL_OR_CMD] && this.state.isBindingEnabled && (T("COMPLEX_BINDINGS") && this.#f(), Z(() => {
|
|
1098
|
+
this.setState({ isBindingEnabled: !1 });
|
|
1099
|
+
}), Rn({
|
|
1100
|
+
app: this,
|
|
1101
|
+
event: e
|
|
1102
|
+
})), ye(e.key)) {
|
|
1103
|
+
let t = this.scene.getSelectedElements({
|
|
1104
|
+
selectedElementIds: this.state.selectedElementIds,
|
|
1105
|
+
includeBoundTextElement: !0,
|
|
1106
|
+
includeElementsInFrames: !0
|
|
1107
|
+
}), n = /* @__PURE__ */ new Set();
|
|
1108
|
+
t.filter((e) => k(e)).filter((e) => {
|
|
1109
|
+
let n = e.startBinding && !t.some((t) => t.id === e.startBinding?.elementId), r = e.endBinding && !t.some((t) => t.id === e.endBinding?.elementId);
|
|
1110
|
+
return n || r;
|
|
1111
|
+
}).forEach((e) => n.add(e.id)), t = t.filter((e) => !n.has(e.id));
|
|
1112
|
+
let r = this.getEffectiveGridSize() && (e.shiftKey ? 1 : this.getEffectiveGridSize()) || (e.shiftKey ? 5 : 1), i = 0, a = 0;
|
|
1113
|
+
e.key === x.ARROW_LEFT ? i = -r : e.key === x.ARROW_RIGHT ? i = r : e.key === x.ARROW_UP ? a = -r : e.key === x.ARROW_DOWN && (a = r), t.forEach((e) => {
|
|
1114
|
+
this.scene.mutateElement(e, {
|
|
1115
|
+
x: e.x + i,
|
|
1116
|
+
y: e.y + a
|
|
1117
|
+
}, {
|
|
1118
|
+
informMutation: !1,
|
|
1119
|
+
isDragging: !1
|
|
1120
|
+
}), Sn(e, this.scene, { simultaneouslyUpdated: t });
|
|
1121
|
+
}), this.scene.triggerUpdate(), e.preventDefault();
|
|
1122
|
+
} else if (e.key === x.ENTER) {
|
|
1123
|
+
let t = this.scene.getSelectedElements(this.state);
|
|
1124
|
+
if (t.length === 1) {
|
|
1125
|
+
let n = t[0];
|
|
1126
|
+
if (e[x.CTRL_OR_CMD] || mt(n)) N(n) && (!this.state.selectedLinearElement?.isEditing || this.state.selectedLinearElement.elementId !== n.id) && (this.#r.scheduleCapture(), A(n) || this.actionManager.executeAction(Zi));
|
|
1127
|
+
else if (P(n) || It(n)) {
|
|
1128
|
+
let t;
|
|
1129
|
+
P(n) || (t = n);
|
|
1130
|
+
let r = Pt(n, this.state, this.scene.getNonDeletedElementsMap()), i = r.x, a = r.y;
|
|
1131
|
+
this.#Te({
|
|
1132
|
+
sceneX: i,
|
|
1133
|
+
sceneY: a,
|
|
1134
|
+
container: t
|
|
1135
|
+
}), e.preventDefault();
|
|
1136
|
+
return;
|
|
1137
|
+
} else j(n) && this.setState({ editingFrame: n.id });
|
|
1138
|
+
}
|
|
1139
|
+
} else if (!e.ctrlKey && !e.altKey && !e.metaKey && !this.state.newElement && !this.state.selectionElement && !this.state.selectedElementsAreBeingDragged) {
|
|
1140
|
+
let t = za(e.key, this);
|
|
1141
|
+
t ? (this.state.activeTool.type !== t && V("toolbar", t, `keyboard (${this.editorInterface.formFactor === "phone" ? "mobile" : "desktop"})`), t === "arrow" && this.state.activeTool.type === "arrow" && this.setState((e) => ({ currentItemArrowType: e.currentItemArrowType === c.sharp ? c.round : e.currentItemArrowType === c.round ? c.elbow : c.sharp })), this.setActiveTool({ type: t }), e.stopPropagation()) : e.key === x.Q && (this.toggleLock("keyboard"), e.stopPropagation());
|
|
1142
|
+
}
|
|
1143
|
+
if (e.key === x.SPACE && $.pointers.size === 0 && (lo = !0, W(this.interactiveCanvas, u.GRAB), e.preventDefault()), (e.key === x.G || e.key === x.S) && !e.altKey && !e[x.CTRL_OR_CMD]) {
|
|
1144
|
+
let t = this.scene.getSelectedElements(this.state);
|
|
1145
|
+
if (this.state.activeTool.type === "selection" && !t.length) return;
|
|
1146
|
+
e.key === x.G && (tt(this.state.activeTool.type) || t.some((e) => tt(e.type))) && (this.setState({ openPopup: "elementBackground" }), e.stopPropagation()), e.key === x.S && (this.setState({ openPopup: "elementStroke" }), e.stopPropagation());
|
|
1147
|
+
}
|
|
1148
|
+
if (!e[x.CTRL_OR_CMD] && e.shiftKey && e.key.toLowerCase() === x.F) {
|
|
1149
|
+
let t = this.scene.getSelectedElements(this.state);
|
|
1150
|
+
if (this.state.activeTool.type === "selection" && !t.length) return;
|
|
1151
|
+
(this.state.activeTool.type === "text" || t.find((e) => P(e) || Nt(e, this.scene.getNonDeletedElementsMap()))) && (e.preventDefault(), this.setState({ openPopup: "fontFamily" }));
|
|
1152
|
+
}
|
|
1153
|
+
if (e.key === x.K && !e.altKey && !e[x.CTRL_OR_CMD]) {
|
|
1154
|
+
this.state.activeTool.type === "laser" ? this.setActiveTool({ type: this.state.preferredSelectionTool.type }) : this.setActiveTool({ type: "laser" });
|
|
1155
|
+
return;
|
|
1156
|
+
}
|
|
1157
|
+
e[x.CTRL_OR_CMD] && (e.key === x.BACKSPACE || e.key === x.DELETE) && this.updateEditorAtom(Aa, "clearCanvas");
|
|
1158
|
+
let t = e.key.toLocaleLowerCase(), n = t === x.S && e.shiftKey, r = e.key === x.I || t === x.G && e.shiftKey;
|
|
1159
|
+
(n || r) && this.#j({ type: n ? "stroke" : "background" });
|
|
1160
|
+
}), this.#ue = q((e) => {
|
|
1161
|
+
if (e.key === x.SPACE && (this.state.viewModeEnabled || this.state.openDialog?.name === "elementLinkSelector" ? W(this.interactiveCanvas, u.GRAB) : Be(this.state.activeTool.type) ? U(this.interactiveCanvas) : (G(this.interactiveCanvas, this.state), this.setState({
|
|
1162
|
+
selectedElementIds: F({}, this.state),
|
|
1163
|
+
selectedGroupIds: {},
|
|
1164
|
+
editingGroupId: null,
|
|
1165
|
+
activeEmbeddable: null
|
|
1166
|
+
})), lo = !1), e.key === x.ALT && Rn({
|
|
1167
|
+
app: this,
|
|
1168
|
+
event: e
|
|
1169
|
+
}), (e.key === x.ALT && this.state.bindMode === "skip" || !e[x.CTRL_OR_CMD] && !yn(this.state)) && (this.setState({ bindMode: "orbit" }), this.lastPointerMoveEvent && T("COMPLEX_BINDINGS"))) {
|
|
1170
|
+
let e = O({
|
|
1171
|
+
clientX: this.lastPointerMoveEvent.clientX,
|
|
1172
|
+
clientY: this.lastPointerMoveEvent.clientY
|
|
1173
|
+
}, this.state), t = R(S(e.x, e.y), this.scene.getNonDeletedElements(), this.scene.getNonDeletedElementsMap());
|
|
1174
|
+
if (this.state.selectedLinearElement) {
|
|
1175
|
+
let e = z.getElement(this.state.selectedLinearElement.elementId, this.scene.getNonDeletedElementsMap());
|
|
1176
|
+
k(e) && this.#m(e, t);
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1179
|
+
if (!e[x.CTRL_OR_CMD] && !this.state.isBindingEnabled && (Z(() => {
|
|
1180
|
+
this.setState({ isBindingEnabled: !0 });
|
|
1181
|
+
}), Rn({
|
|
1182
|
+
app: this,
|
|
1183
|
+
event: e
|
|
1184
|
+
})), ye(e.key)) {
|
|
1185
|
+
gn(this.scene.getSelectedElements(this.state).filter(at), this.scene, this.state);
|
|
1186
|
+
let e = this.scene.getNonDeletedElementsMap();
|
|
1187
|
+
this.scene.getSelectedElements(this.state).filter(_t).forEach((t) => {
|
|
1188
|
+
t.startBinding && this.scene.mutateElement(t, { startBinding: {
|
|
1189
|
+
...t.startBinding,
|
|
1190
|
+
..._n(t, e.get(t.startBinding.elementId), "start", e)
|
|
1191
|
+
} }), t.endBinding && this.scene.mutateElement(t, { endBinding: {
|
|
1192
|
+
...t.endBinding,
|
|
1193
|
+
..._n(t, e.get(t.endBinding.elementId), "end", e)
|
|
1194
|
+
} });
|
|
1195
|
+
}), this.setState({ suggestedBinding: null });
|
|
1196
|
+
}
|
|
1197
|
+
if (e.altKey || this.#u.isExploring && (this.#u.clear(), this.syncActionResult({ captureUpdate: B.IMMEDIATELY })), !e[x.CTRL_OR_CMD] && this.flowChartCreator.isCreatingChart) {
|
|
1198
|
+
this.flowChartCreator.pendingNodes?.length && this.scene.insertElements(this.flowChartCreator.pendingNodes);
|
|
1199
|
+
let e = this.flowChartCreator.pendingNodes?.[0];
|
|
1200
|
+
e && (this.setState((t) => ({ selectedElementIds: F({ [e.id]: !0 }, t) })), jn([e], this.canvas.width / window.devicePixelRatio, this.canvas.height / window.devicePixelRatio, {
|
|
1201
|
+
offsetLeft: this.state.offsetLeft,
|
|
1202
|
+
offsetTop: this.state.offsetTop,
|
|
1203
|
+
scrollX: this.state.scrollX,
|
|
1204
|
+
scrollY: this.state.scrollY,
|
|
1205
|
+
zoom: this.state.zoom
|
|
1206
|
+
}, this.scene.getNonDeletedElementsMap(), this.getEditorUIOffsets()) || this.scrollToContent(e, {
|
|
1207
|
+
animate: !0,
|
|
1208
|
+
duration: 300,
|
|
1209
|
+
canvasOffsets: this.getEditorUIOffsets()
|
|
1210
|
+
})), this.flowChartCreator.clear(), this.syncActionResult({ captureUpdate: B.IMMEDIATELY });
|
|
1211
|
+
}
|
|
1212
|
+
}), this.#de = (e) => this.props.UIOptions.tools?.[e] !== !1, this.setActiveTool = (e, t = !1) => {
|
|
1213
|
+
if (!this.#de(e.type)) {
|
|
1214
|
+
console.warn(`"${e.type}" tool is disabled via "UIOptions.canvasActions.tools.${e.type}"`);
|
|
1215
|
+
return;
|
|
1216
|
+
}
|
|
1217
|
+
let n = D(this.state, e);
|
|
1218
|
+
n.type === "hand" ? W(this.interactiveCanvas, u.GRAB) : lo || G(this.interactiveCanvas, {
|
|
1219
|
+
...this.state,
|
|
1220
|
+
activeTool: n
|
|
1221
|
+
}), Ue(document.activeElement) && this.focusContainer(), ht(n.type) || this.setState({ suggestedBinding: null }), n.type === "image" && this.#lt(), this.setState((e) => {
|
|
1222
|
+
let r = {
|
|
1223
|
+
snapLines: e.snapLines.length ? [] : e.snapLines,
|
|
1224
|
+
originSnapOffset: null,
|
|
1225
|
+
activeEmbeddable: null,
|
|
1226
|
+
selectedLinearElement: Be(n.type) ? e.selectedLinearElement : null
|
|
1227
|
+
};
|
|
1228
|
+
return n.type === "freedraw" && this.#r.scheduleCapture(), n.type === "lasso" ? {
|
|
1229
|
+
...e,
|
|
1230
|
+
...r,
|
|
1231
|
+
activeTool: n,
|
|
1232
|
+
...t ? {} : {
|
|
1233
|
+
selectedElementIds: F({}, e),
|
|
1234
|
+
selectedGroupIds: F({}, e),
|
|
1235
|
+
editingGroupId: null,
|
|
1236
|
+
multiElement: null
|
|
1237
|
+
}
|
|
1238
|
+
} : n.type === "selection" ? {
|
|
1239
|
+
...e,
|
|
1240
|
+
...r,
|
|
1241
|
+
activeTool: n
|
|
1242
|
+
} : {
|
|
1243
|
+
...e,
|
|
1244
|
+
...r,
|
|
1245
|
+
activeTool: n,
|
|
1246
|
+
selectedElementIds: F({}, e),
|
|
1247
|
+
selectedGroupIds: F({}, e),
|
|
1248
|
+
editingGroupId: null,
|
|
1249
|
+
multiElement: null
|
|
1250
|
+
};
|
|
1251
|
+
});
|
|
1252
|
+
}, this.setOpenDialog = (e) => {
|
|
1253
|
+
this.setState({ openDialog: e });
|
|
1254
|
+
}, this.#fe = (e) => {
|
|
1255
|
+
W(this.interactiveCanvas, e);
|
|
1256
|
+
}, this.#pe = () => {
|
|
1257
|
+
U(this.interactiveCanvas);
|
|
1258
|
+
}, this.#me = () => $.pointers.size >= 2, this.getName = () => this.state.name || this.props.name || `${H("labels.untitled")}-${Fe()}`, this.#he = q((e) => {
|
|
1259
|
+
e.preventDefault(), this.#me() && this.setState({
|
|
1260
|
+
selectedElementIds: F({}, this.state),
|
|
1261
|
+
activeEmbeddable: null
|
|
1262
|
+
}), $.initialScale = this.state.zoom.value;
|
|
1263
|
+
}), this.#ge = q((e) => {
|
|
1264
|
+
if (e.preventDefault(), this.#me()) return;
|
|
1265
|
+
let t = $.initialScale;
|
|
1266
|
+
t && this.setState((n) => ({ ...Ei({
|
|
1267
|
+
viewportX: this.lastViewportPosition.x,
|
|
1268
|
+
viewportY: this.lastViewportPosition.y,
|
|
1269
|
+
nextZoom: Kr(t * e.scale)
|
|
1270
|
+
}, n) }));
|
|
1271
|
+
}), this.#_e = q((e) => {
|
|
1272
|
+
e.preventDefault(), this.#me() && this.setState({
|
|
1273
|
+
previousSelectedElementIds: {},
|
|
1274
|
+
selectedElementIds: F(this.state.previousSelectedElementIds, this.state)
|
|
1275
|
+
}), $.initialScale = null;
|
|
1276
|
+
}), this.#Te = ({ sceneX: e, sceneY: t, insertAtParentCenter: n = !0, container: r, autoEdit: i = !0 }) => {
|
|
1277
|
+
let a = !1, o = n && this.#Tt(e, t, this.state, r);
|
|
1278
|
+
r && o && (Nt(r, this.scene.getNonDeletedElementsMap()) || (a = !0));
|
|
1279
|
+
let s = null, c = this.scene.getSelectedElements(this.state);
|
|
1280
|
+
s = c.length === 1 ? P(c[0]) ? c[0] : r ? Nt(c[0], this.scene.getNonDeletedElementsMap()) : this.#be(e, t) : this.#be(e, t);
|
|
1281
|
+
let l = s?.fontFamily || this.state.currentItemFontFamily, u = s?.lineHeight || _e(l), d = this.state.currentItemFontSize;
|
|
1282
|
+
if (!s && a && r && !at(r)) {
|
|
1283
|
+
let n = Et(Ie({
|
|
1284
|
+
fontSize: d,
|
|
1285
|
+
fontFamily: l
|
|
1286
|
+
}), u), i = Tt(d, u), a = Math.max(r.height, i), s = Math.max(r.width, n);
|
|
1287
|
+
this.scene.mutateElement(r, {
|
|
1288
|
+
height: a,
|
|
1289
|
+
width: s
|
|
1290
|
+
}), e = r.x + s / 2, t = r.y + a / 2, o &&= this.#Tt(e, t, this.state, r);
|
|
1291
|
+
}
|
|
1292
|
+
let f = this.#ke({
|
|
1293
|
+
x: e,
|
|
1294
|
+
y: t
|
|
1295
|
+
}), p = s || or({
|
|
1296
|
+
x: o ? o.elementCenterX : e,
|
|
1297
|
+
y: o ? o.elementCenterY : t,
|
|
1298
|
+
strokeColor: this.state.currentItemStrokeColor,
|
|
1299
|
+
backgroundColor: this.state.currentItemBackgroundColor,
|
|
1300
|
+
fillStyle: this.state.currentItemFillStyle,
|
|
1301
|
+
strokeWidth: this.state.currentItemStrokeWidth,
|
|
1302
|
+
strokeStyle: this.state.currentItemStrokeStyle,
|
|
1303
|
+
roughness: this.state.currentItemRoughness,
|
|
1304
|
+
opacity: this.state.currentItemOpacity,
|
|
1305
|
+
text: "",
|
|
1306
|
+
fontSize: d,
|
|
1307
|
+
fontFamily: l,
|
|
1308
|
+
textAlign: o ? "center" : this.state.currentItemTextAlign,
|
|
1309
|
+
verticalAlign: o ? ie.MIDDLE : "top",
|
|
1310
|
+
containerId: a ? r?.id : void 0,
|
|
1311
|
+
groupIds: r?.groupIds ?? [],
|
|
1312
|
+
lineHeight: u,
|
|
1313
|
+
angle: r ? at(r) ? 0 : r.angle : 0,
|
|
1314
|
+
frameId: f ? f.id : null
|
|
1315
|
+
});
|
|
1316
|
+
if (!s && a && r && this.scene.mutateElement(r, { boundElements: (r.boundElements || []).concat({
|
|
1317
|
+
type: "text",
|
|
1318
|
+
id: p.id
|
|
1319
|
+
}) }), this.setState({ editingTextElement: p }), !s) if (r && a) {
|
|
1320
|
+
let e = this.scene.getElementIndex(r.id);
|
|
1321
|
+
this.scene.insertElementAtIndex(p, e + 1);
|
|
1322
|
+
} else this.scene.insertElement(p);
|
|
1323
|
+
i || s || r ? this.#ve(p, { isExistingElement: !!s }) : this.setState({
|
|
1324
|
+
newElement: p,
|
|
1325
|
+
multiElement: null
|
|
1326
|
+
});
|
|
1327
|
+
}, this.#Ee = (e) => {
|
|
1328
|
+
this.#r.scheduleCapture(), this.setState({ croppingElementId: e.id });
|
|
1329
|
+
}, this.#De = () => {
|
|
1330
|
+
this.state.croppingElementId && (this.#r.scheduleCapture(), this.setState({ croppingElementId: null }));
|
|
1331
|
+
}, this.#Oe = (e) => {
|
|
1332
|
+
if (this.state.multiElement || this.state.activeTool.type !== this.state.preferredSelectionTool.type) return;
|
|
1333
|
+
let t = this.scene.getSelectedElements(this.state), { x: n, y: r } = O(e, this.state);
|
|
1334
|
+
if (t.length === 1 && N(t[0])) {
|
|
1335
|
+
let i = t[0];
|
|
1336
|
+
if ((e[x.CTRL_OR_CMD] && _t(i) || mt(i)) && (!this.state.selectedLinearElement?.isEditing || this.state.selectedLinearElement.elementId !== i.id)) {
|
|
1337
|
+
this.actionManager.executeAction(Zi);
|
|
1338
|
+
return;
|
|
1339
|
+
} else if (this.state.selectedLinearElement && A(t[0])) {
|
|
1340
|
+
let e = z.getSegmentMidpointHitCoords(this.state.selectedLinearElement, {
|
|
1341
|
+
x: n,
|
|
1342
|
+
y: r
|
|
1343
|
+
}, this.state, this.scene.getNonDeletedElementsMap()), i = e ? z.getSegmentMidPointIndex(this.state.selectedLinearElement, this.state, e, this.scene.getNonDeletedElementsMap()) : -1;
|
|
1344
|
+
if (i && i > -1) {
|
|
1345
|
+
this.#r.scheduleCapture(), z.deleteFixedSegment(t[0], this.scene, i);
|
|
1346
|
+
let a = z.getSegmentMidpointHitCoords({
|
|
1347
|
+
...this.state.selectedLinearElement,
|
|
1348
|
+
segmentMidPointHoveredCoords: null
|
|
1349
|
+
}, {
|
|
1350
|
+
x: n,
|
|
1351
|
+
y: r
|
|
1352
|
+
}, this.state, this.scene.getNonDeletedElementsMap()), o = a ? z.getSegmentMidPointIndex(this.state.selectedLinearElement, this.state, a, this.scene.getNonDeletedElementsMap()) : null;
|
|
1353
|
+
this.setState({ selectedLinearElement: {
|
|
1354
|
+
...this.state.selectedLinearElement,
|
|
1355
|
+
initialState: {
|
|
1356
|
+
...this.state.selectedLinearElement.initialState,
|
|
1357
|
+
segmentMidpoint: {
|
|
1358
|
+
index: o,
|
|
1359
|
+
value: e,
|
|
1360
|
+
added: !1
|
|
1361
|
+
}
|
|
1362
|
+
},
|
|
1363
|
+
segmentMidPointHoveredCoords: a
|
|
1364
|
+
} });
|
|
1365
|
+
return;
|
|
1366
|
+
}
|
|
1367
|
+
} else if (this.state.selectedLinearElement?.isEditing && this.state.selectedLinearElement.elementId === i.id && mt(i)) return;
|
|
1368
|
+
}
|
|
1369
|
+
if (t.length === 1 && M(t[0])) {
|
|
1370
|
+
this.#Ee(t[0]);
|
|
1371
|
+
return;
|
|
1372
|
+
}
|
|
1373
|
+
if (U(this.interactiveCanvas), Vt(this.state).length > 0) {
|
|
1374
|
+
let e = this.#xe(n, r), t = e && Bt(e, this.state.selectedGroupIds);
|
|
1375
|
+
if (t) {
|
|
1376
|
+
this.#r.scheduleCapture(), this.setState((n) => ({
|
|
1377
|
+
...n,
|
|
1378
|
+
...I({
|
|
1379
|
+
editingGroupId: t,
|
|
1380
|
+
selectedElementIds: { [e.id]: !0 }
|
|
1381
|
+
}, this.scene.getNonDeletedElements(), n, this)
|
|
1382
|
+
}));
|
|
1383
|
+
return;
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
if (U(this.interactiveCanvas), !e[x.CTRL_OR_CMD] && !this.state.viewModeEnabled) {
|
|
1387
|
+
let t = this.#xe(n, r);
|
|
1388
|
+
if (ft(t)) {
|
|
1389
|
+
this.setState({ activeEmbeddable: {
|
|
1390
|
+
element: t,
|
|
1391
|
+
state: "active"
|
|
1392
|
+
} });
|
|
1393
|
+
return;
|
|
1394
|
+
}
|
|
1395
|
+
if (!this.state.selectedLinearElement?.isEditing) {
|
|
1396
|
+
let t = this.#we(n, r);
|
|
1397
|
+
if (t && (it(t) || !o(t.backgroundColor) || pn({
|
|
1398
|
+
point: S(n, r),
|
|
1399
|
+
element: t,
|
|
1400
|
+
elementsMap: this.scene.getNonDeletedElementsMap(),
|
|
1401
|
+
threshold: this.getElementHitThreshold(t)
|
|
1402
|
+
}))) {
|
|
1403
|
+
let e = Pt(t, this.state, this.scene.getNonDeletedElementsMap());
|
|
1404
|
+
n = e.x, r = e.y;
|
|
1405
|
+
}
|
|
1406
|
+
this.#Te({
|
|
1407
|
+
sceneX: n,
|
|
1408
|
+
sceneY: r,
|
|
1409
|
+
insertAtParentCenter: !e.altKey,
|
|
1410
|
+
container: t
|
|
1411
|
+
});
|
|
1412
|
+
}
|
|
1413
|
+
}
|
|
1414
|
+
}, this.#ke = (e) => {
|
|
1415
|
+
let t = this.scene.getNonDeletedElementsMap(), n = this.scene.getNonDeletedFramesLikes().filter((n) => !n.locked && en(e, n, t));
|
|
1416
|
+
return n.length ? n[n.length - 1] : null;
|
|
1417
|
+
}, this.#Ae = (e) => {
|
|
1418
|
+
this.#Et(e.clientX, e.clientY, this.state.cursorButton), this.lastPointerMoveEvent = e.nativeEvent;
|
|
1419
|
+
let t = O(e, this.state), { x: n, y: r } = t;
|
|
1420
|
+
this.lastPointerMoveCoords = {
|
|
1421
|
+
x: n,
|
|
1422
|
+
y: r
|
|
1423
|
+
}, $.pointers.has(e.pointerId) && $.pointers.set(e.pointerId, {
|
|
1424
|
+
x: e.clientX,
|
|
1425
|
+
y: e.clientY
|
|
1426
|
+
});
|
|
1427
|
+
let i = $.initialScale;
|
|
1428
|
+
if ($.pointers.size === 2 && $.lastCenter && i && $.initialDistance) {
|
|
1429
|
+
let e = pa($.pointers), t = e.x - $.lastCenter.x, n = e.y - $.lastCenter.y;
|
|
1430
|
+
$.lastCenter = e;
|
|
1431
|
+
let r = ma(Array.from($.pointers.values())), a = this.state.activeTool.type === "freedraw" && this.state.penMode ? 1 : r / $.initialDistance, o = a ? Kr(i * a) : this.state.zoom.value;
|
|
1432
|
+
this.setState((r) => {
|
|
1433
|
+
let i = Ei({
|
|
1434
|
+
viewportX: e.x,
|
|
1435
|
+
viewportY: e.y,
|
|
1436
|
+
nextZoom: o
|
|
1437
|
+
}, r);
|
|
1438
|
+
return this.#ae({
|
|
1439
|
+
zoom: i.zoom,
|
|
1440
|
+
scrollX: i.scrollX + t / o * 2,
|
|
1441
|
+
scrollY: i.scrollY + n / o * 2,
|
|
1442
|
+
shouldCacheIgnoreZoom: !0
|
|
1443
|
+
}), null;
|
|
1444
|
+
}), this.#Dt();
|
|
1445
|
+
} else $.lastCenter = $.initialDistance = $.initialScale = null;
|
|
1446
|
+
if (lo || uo || fo || kr(this.state)) return;
|
|
1447
|
+
let a = ya(po, e.clientX - this.state.offsetLeft, e.clientY - this.state.offsetTop).isOverEither;
|
|
1448
|
+
if (!this.state.newElement && !this.state.selectionElement && !this.state.selectedElementsAreBeingDragged && !this.state.multiElement && (a ? U(this.interactiveCanvas) : G(this.interactiveCanvas, this.state)), !this.state.newElement && Ca(this.state.activeTool.type)) {
|
|
1449
|
+
let { originOffset: t, snapLines: i } = xa(this.scene.getNonDeletedElements(), this, {
|
|
1450
|
+
x: n,
|
|
1451
|
+
y: r
|
|
1452
|
+
}, e, this.scene.getNonDeletedElementsMap());
|
|
1453
|
+
this.setState((e) => {
|
|
1454
|
+
let n = Xe(e.snapLines, i), r = e.originSnapOffset ? Xe(e.originSnapOffset, t) : t;
|
|
1455
|
+
return e.snapLines === n && e.originSnapOffset === r ? null : {
|
|
1456
|
+
snapLines: n,
|
|
1457
|
+
originSnapOffset: r
|
|
1458
|
+
};
|
|
1459
|
+
});
|
|
1460
|
+
} else !this.state.newElement && !this.state.selectedElementsAreBeingDragged && !this.state.selectionElement && this.setState((e) => e.snapLines.length ? { snapLines: [] } : null);
|
|
1461
|
+
if (this.state.selectedLinearElement?.isEditing && !this.state.selectedLinearElement.isDragging) {
|
|
1462
|
+
let t = this.state.newElement ? null : z.handlePointerMoveInEditMode(e, n, r, this);
|
|
1463
|
+
t && t !== this.state.selectedLinearElement && Z(() => {
|
|
1464
|
+
this.setState({ selectedLinearElement: t });
|
|
1465
|
+
});
|
|
1466
|
+
}
|
|
1467
|
+
if (st(this.state.activeTool.type)) {
|
|
1468
|
+
let { newElement: e } = this.state;
|
|
1469
|
+
if (!e && yn(this.state)) {
|
|
1470
|
+
let e = R(S(n, r), this.scene.getNonDeletedElements(), this.scene.getNonDeletedElementsMap(), bn(this.state.zoom));
|
|
1471
|
+
e ? this.setState({ suggestedBinding: e }) : this.state.suggestedBinding && this.setState({ suggestedBinding: null });
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
if (this.state.multiElement && this.state.selectedLinearElement) {
|
|
1475
|
+
let { multiElement: t, selectedLinearElement: i } = this.state, { x: a, y: o, points: s } = t, c = s[s.length - 1], { lastCommittedPoint: l } = i;
|
|
1476
|
+
if (G(this.interactiveCanvas, this.state), c === l) at(this.state.newElement) && yn(this.state) && R(S(n, r), this.scene.getNonDeletedElements(), this.scene.getNonDeletedElementsMap(), bn(this.state.zoom)) ? (this.actionManager.executeAction(K, "ui", {
|
|
1477
|
+
event: e.nativeEvent,
|
|
1478
|
+
sceneCoords: {
|
|
1479
|
+
x: n,
|
|
1480
|
+
y: r
|
|
1481
|
+
}
|
|
1482
|
+
}), this.setState({
|
|
1483
|
+
suggestedBinding: null,
|
|
1484
|
+
startBoundElement: null
|
|
1485
|
+
}), this.state.activeTool.locked || (U(this.interactiveCanvas), this.setState((e) => ({
|
|
1486
|
+
newElement: null,
|
|
1487
|
+
activeTool: D(this.state, { type: this.state.preferredSelectionTool.type }),
|
|
1488
|
+
selectedElementIds: F({
|
|
1489
|
+
...e.selectedElementIds,
|
|
1490
|
+
[t.id]: !0
|
|
1491
|
+
}, e),
|
|
1492
|
+
selectedLinearElement: new z(t, this.scene.getNonDeletedElementsMap())
|
|
1493
|
+
})))) : Oe(S(n - a, r - o), c) >= 8 ? (this.scene.mutateElement(t, { points: [...s, S(n - a, r - o)] }, {
|
|
1494
|
+
informMutation: !1,
|
|
1495
|
+
isDragging: !1
|
|
1496
|
+
}), E(this.state.selectedLinearElement?.initialState, "initialState must be set"), this.setState({ selectedLinearElement: {
|
|
1497
|
+
...this.state.selectedLinearElement,
|
|
1498
|
+
lastCommittedPoint: s[s.length - 1],
|
|
1499
|
+
selectedPointsIndices: [t.points.length - 1],
|
|
1500
|
+
initialState: {
|
|
1501
|
+
...this.state.selectedLinearElement.initialState,
|
|
1502
|
+
lastClickedPoint: t.points.length - 1
|
|
1503
|
+
}
|
|
1504
|
+
} })) : W(this.interactiveCanvas, u.POINTER);
|
|
1505
|
+
else if (s.length > 2 && l && Oe(S(n - a, r - o), l) < 8) W(this.interactiveCanvas, u.POINTER), this.scene.mutateElement(t, { points: s.slice(0, -1) }, {
|
|
1506
|
+
informMutation: !1,
|
|
1507
|
+
isDragging: !1
|
|
1508
|
+
}), this.setState({ selectedLinearElement: {
|
|
1509
|
+
...i,
|
|
1510
|
+
selectedPointsIndices: i.selectedPointsIndices?.includes?.(t.points.length) ? [...i.selectedPointsIndices.filter((e) => e !== t.points.length && e !== t.points.length - 1), t.points.length - 1] : i.selectedPointsIndices,
|
|
1511
|
+
lastCommittedPoint: t.points[t.points.length - 1],
|
|
1512
|
+
initialState: {
|
|
1513
|
+
...i.initialState,
|
|
1514
|
+
lastClickedPoint: t.points.length - 1
|
|
1515
|
+
}
|
|
1516
|
+
} });
|
|
1517
|
+
else {
|
|
1518
|
+
ln(s, this.state.zoom.value) && W(this.interactiveCanvas, u.POINTER);
|
|
1519
|
+
let i = this.scene.getNonDeletedElementsMap();
|
|
1520
|
+
if (_t(t)) {
|
|
1521
|
+
let e = R(S(n, r), this.scene.getNonDeletedElements(), i);
|
|
1522
|
+
T("COMPLEX_BINDINGS") && this.#m(t, e);
|
|
1523
|
+
}
|
|
1524
|
+
E(this.state.selectedLinearElement, "Expected selectedLinearElement to be set to operate on a linear element");
|
|
1525
|
+
let a = z.handlePointerMove(e.nativeEvent, this, n, r, this.state.selectedLinearElement);
|
|
1526
|
+
a && this.setState(a);
|
|
1527
|
+
}
|
|
1528
|
+
return;
|
|
1529
|
+
}
|
|
1530
|
+
if (this.state.activeTool.type === "arrow") {
|
|
1531
|
+
let e = R(S(n, r), this.scene.getNonDeletedElements(), this.scene.getNonDeletedElementsMap(), bn(this.state.zoom));
|
|
1532
|
+
e && !mn(S(n, r), e, this.scene.getNonDeletedElementsMap()) && this.setState({ suggestedBinding: e });
|
|
1533
|
+
}
|
|
1534
|
+
if (e.buttons || this.state.activeTool.type !== "selection" && this.state.activeTool.type !== "lasso" && this.state.activeTool.type !== "text" && this.state.activeTool.type !== "eraser") return;
|
|
1535
|
+
let o = this.scene.getNonDeletedElements(), s = this.scene.getSelectedElements(this.state);
|
|
1536
|
+
if (s.length === 1 && !a && !this.state.selectedLinearElement?.isEditing) {
|
|
1537
|
+
if (this.state.selectedLinearElement && this.handleHoverSelectedLinearElement(this.state.selectedLinearElement, n, r), (!this.state.selectedLinearElement || this.state.selectedLinearElement.hoverPointIndex === -1) && this.state.openDialog?.name !== "elementLinkSelector" && !(s.length === 1 && A(s[0])) && !(N(s[0]) && (this.editorInterface.userAgent.isMobileDevice || s[0].points.length === 2))) {
|
|
1538
|
+
let t = Cr(o, this.state, n, r, this.state.zoom, e.pointerType, this.scene.getNonDeletedElementsMap(), this.editorInterface);
|
|
1539
|
+
if (t && t.transformHandleType) {
|
|
1540
|
+
W(this.interactiveCanvas, Sr(t));
|
|
1541
|
+
return;
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
} else if (s.length > 1 && !a && this.state.openDialog?.name !== "elementLinkSelector") {
|
|
1545
|
+
let t = wr(En(s), n, r, this.state.zoom, e.pointerType, this.editorInterface);
|
|
1546
|
+
if (t) {
|
|
1547
|
+
W(this.interactiveCanvas, Sr({ transformHandleType: t }));
|
|
1548
|
+
return;
|
|
1549
|
+
}
|
|
1550
|
+
}
|
|
1551
|
+
let c = this.#xe(n, r, {
|
|
1552
|
+
preferSelected: !0,
|
|
1553
|
+
includeLockedElements: !0
|
|
1554
|
+
}), l = null;
|
|
1555
|
+
l = c && c.locked ? null : c, !Or(this.state) && (this.state.activeTool.type === "text" ? W(this.interactiveCanvas, P(l) ? u.TEXT : u.CROSSHAIR) : this.state.viewModeEnabled ? W(this.interactiveCanvas, u.GRAB) : this.state.openDialog?.name === "elementLinkSelector" || a || e[x.CTRL_OR_CMD] ? W(this.interactiveCanvas, u.AUTO) : (l || this.#We(t, s)) && !l?.locked && (l && ft(l) && this.#v(l, e, n, r) ? (W(this.interactiveCanvas, u.POINTER), this.setState({ activeEmbeddable: {
|
|
1556
|
+
element: l,
|
|
1557
|
+
state: "hover"
|
|
1558
|
+
} })) : (!l || !A(l) || !(l.startBinding || l.endBinding)) && ((this.state.activeTool.type !== "lasso" || s.length > 0) && W(this.interactiveCanvas, u.MOVE), this.state.activeEmbeddable?.state === "hover" && this.setState({ activeEmbeddable: null }))), this.state.selectedLinearElement && this.handleHoverSelectedLinearElement(this.state.selectedLinearElement, n, r), this.state.openDialog?.name === "elementLinkSelector" && l ? this.setState((e) => ({ hoveredElementIds: Xe(e.hoveredElementIds, I({
|
|
1559
|
+
editingGroupId: e.editingGroupId,
|
|
1560
|
+
selectedElementIds: { [l.id]: !0 }
|
|
1561
|
+
}, this.scene.getNonDeletedElements(), e, this).selectedElementIds) })) : this.state.openDialog?.name === "elementLinkSelector" && !l && this.setState((e) => ({ hoveredElementIds: Xe(e.hoveredElementIds, {}) })));
|
|
1562
|
+
}, this.#je = (e, t) => {
|
|
1563
|
+
let n = this.eraserTrail.addPointToPath(t.x, t.y, e.altKey);
|
|
1564
|
+
this.#l = new Set(n), this.#se();
|
|
1565
|
+
}, this.#Me = (e) => {
|
|
1566
|
+
mo = !0;
|
|
1567
|
+
}, this.handleHoverSelectedLinearElement = (e, t, n) => {
|
|
1568
|
+
let r = this.scene.getNonDeletedElementsMap(), i = z.getElement(e.elementId, r);
|
|
1569
|
+
if (i) if (this.state.selectedLinearElement) {
|
|
1570
|
+
let a = -1, o = null;
|
|
1571
|
+
pn({
|
|
1572
|
+
point: S(t, n),
|
|
1573
|
+
element: i,
|
|
1574
|
+
elementsMap: r,
|
|
1575
|
+
threshold: this.getElementHitThreshold(i)
|
|
1576
|
+
}) ? (a = z.getPointIndexUnderCursor(i, r, this.state.zoom, t, n), o = z.getSegmentMidpointHitCoords(e, {
|
|
1577
|
+
x: t,
|
|
1578
|
+
y: n
|
|
1579
|
+
}, this.state, this.scene.getNonDeletedElementsMap()), (A(i) ? a === 0 || a === i.points.length - 1 : a >= 0) || o ? W(this.interactiveCanvas, u.POINTER) : this.#Ce(t, n, i) && (!A(i) || !(i.startBinding || i.endBinding)) && (this.state.activeTool.type !== "lasso" || Object.keys(this.state.selectedElementIds).length > 0) && W(this.interactiveCanvas, u.MOVE)) : this.#Ce(t, n, i) && (!A(i) || !(i.startBinding || i.endBinding)) && (this.state.activeTool.type !== "lasso" || Object.keys(this.state.selectedElementIds).length > 0) && W(this.interactiveCanvas, u.MOVE), this.state.selectedLinearElement.hoverPointIndex !== a && this.setState({ selectedLinearElement: {
|
|
1580
|
+
...this.state.selectedLinearElement,
|
|
1581
|
+
hoverPointIndex: a
|
|
1582
|
+
} }), z.arePointsEqual(this.state.selectedLinearElement.segmentMidPointHoveredCoords, o) || this.setState({ selectedLinearElement: {
|
|
1583
|
+
...this.state.selectedLinearElement,
|
|
1584
|
+
segmentMidPointHoveredCoords: o
|
|
1585
|
+
} });
|
|
1586
|
+
let s = null, c = i;
|
|
1587
|
+
(c.startBinding || c.endBinding) && (s = Fn(i, t, n, this.scene, this.state)), this.state.selectedLinearElement.hoveredFocusPointBinding !== s && this.setState({ selectedLinearElement: {
|
|
1588
|
+
...this.state.selectedLinearElement,
|
|
1589
|
+
isDragging: !1,
|
|
1590
|
+
hoveredFocusPointBinding: s
|
|
1591
|
+
} }), s && W(this.interactiveCanvas, u.POINTER);
|
|
1592
|
+
} else W(this.interactiveCanvas, u.AUTO);
|
|
1593
|
+
}, this.#Ne = (e) => {
|
|
1594
|
+
let { x: t, y: n } = O(e, this.state);
|
|
1595
|
+
this.lastPointerMoveCoords = {
|
|
1596
|
+
x: t,
|
|
1597
|
+
y: n
|
|
1598
|
+
};
|
|
1599
|
+
let r = e.target;
|
|
1600
|
+
if (r.setPointerCapture && r.setPointerCapture(e.pointerId), this.#Le(e.nativeEvent), this.state.searchMatches && (this.setState((e) => ({ searchMatches: e.searchMatches && {
|
|
1601
|
+
focusedId: null,
|
|
1602
|
+
matches: e.searchMatches.matches.map((e) => ({
|
|
1603
|
+
...e,
|
|
1604
|
+
focus: !1
|
|
1605
|
+
}))
|
|
1606
|
+
} })), this.updateEditorAtom(Ba, null)), Vr.get(Pa) && this.updateEditorAtom(Pa, null), this.state.contextMenu && this.setState({ contextMenu: null }), this.state.snapLines && this.setAppState({ snapLines: [] }), this.state.openPopup && this.setState({ openPopup: null }), this.#Re(e), e.pointerType === "touch" && this.state.newElement && this.state.newElement.type === "freedraw") {
|
|
1607
|
+
let e = this.state.newElement;
|
|
1608
|
+
this.updateScene({
|
|
1609
|
+
...e.points.length < 10 ? { elements: this.scene.getElementsIncludingDeleted().filter((t) => t.id !== e.id) } : {},
|
|
1610
|
+
appState: {
|
|
1611
|
+
newElement: null,
|
|
1612
|
+
editingTextElement: null,
|
|
1613
|
+
startBoundElement: null,
|
|
1614
|
+
suggestedBinding: null,
|
|
1615
|
+
selectedElementIds: F(Object.keys(this.state.selectedElementIds).filter((t) => t !== e.id).reduce((e, t) => (e[t] = this.state.selectedElementIds[t], e), {}), this.state)
|
|
1616
|
+
},
|
|
1617
|
+
captureUpdate: this.state.openDialog?.name === "elementLinkSelector" ? B.EVENTUALLY : B.NEVER
|
|
1618
|
+
});
|
|
1619
|
+
return;
|
|
1620
|
+
}
|
|
1621
|
+
let i = document.getSelection();
|
|
1622
|
+
if (i?.anchorNode && i.removeAllRanges(), this.#Fe(e), !this.state.penDetected && e.pointerType === "pen" && this.setState((e) => ({
|
|
1623
|
+
penMode: !0,
|
|
1624
|
+
penDetected: !0
|
|
1625
|
+
})), !this.editorInterface.isTouchScreen && ["pen", "touch"].includes(e.pointerType) && (this.editorInterface = Ye(this.editorInterface, { isTouchScreen: !0 })), uo || (this.lastPointerDownEvent = e, this.handleCanvasPanUsingWheelOrSpaceDrag(e))) return;
|
|
1626
|
+
if (this.setState({
|
|
1627
|
+
lastPointerDownWith: e.pointerType,
|
|
1628
|
+
cursorButton: "down"
|
|
1629
|
+
}), this.#Et(e.clientX, e.clientY, "down"), e.button === y.ERASER && this.state.activeTool.type !== b.eraser) {
|
|
1630
|
+
this.setState({ activeTool: D(this.state, {
|
|
1631
|
+
type: b.eraser,
|
|
1632
|
+
lastActiveToolBeforeEraser: this.state.activeTool
|
|
1633
|
+
}) }, () => {
|
|
1634
|
+
this.#Ne(e);
|
|
1635
|
+
let t = () => {
|
|
1636
|
+
n(), r?.(), Or(this.state) && this.setState({ activeTool: D(this.state, {
|
|
1637
|
+
...this.state.activeTool.lastActiveTool || { type: b.selection },
|
|
1638
|
+
lastActiveToolBeforeEraser: null
|
|
1639
|
+
}) });
|
|
1640
|
+
}, n = w(window, h.POINTER_UP, t, { once: !0 }), r;
|
|
1641
|
+
requestAnimationFrame(() => {
|
|
1642
|
+
r = this.missingPointerEventCleanupEmitter.once(t);
|
|
1643
|
+
});
|
|
1644
|
+
});
|
|
1645
|
+
return;
|
|
1646
|
+
}
|
|
1647
|
+
if (e.button !== y.MAIN && e.button !== y.TOUCH && e.button !== y.ERASER || $.pointers.size > 1) return;
|
|
1648
|
+
let a = this.#ze(e);
|
|
1649
|
+
if (this.setState({ selectedElementsAreBeingDragged: !1 }), this.#Be(e, a) || (this.#Ve(), this.#mt(e), this.#He(e, a)) || !(!this.state.penMode || e.pointerType !== "touch" || this.state.activeTool.type === "selection" || this.state.activeTool.type === "lasso" || this.state.activeTool.type === "text" || this.state.activeTool.type === "image")) return;
|
|
1650
|
+
if (this.state.activeTool.type === "lasso") {
|
|
1651
|
+
let t = a.hit.element && this.#Ue(a.hit.element);
|
|
1652
|
+
!a.hit.hasHitCommonBoundingBoxOfSelectedElements && !a.resize.handleType && !t && (this.lassoTrail.startPath(a.origin.x, a.origin.y, e.shiftKey), a.drag.blockDragging = this.editorInterface.formFactor === "desktop"), this.editorInterface.formFactor !== "desktop" && a.hit.element && !t && (this.setState((e) => {
|
|
1653
|
+
let t = {
|
|
1654
|
+
...e.selectedElementIds,
|
|
1655
|
+
[a.hit.element.id]: !0
|
|
1656
|
+
}, n = [];
|
|
1657
|
+
Object.keys(e.selectedElementIds).forEach((e) => {
|
|
1658
|
+
let t = this.scene.getElement(e);
|
|
1659
|
+
t && n.push(t);
|
|
1660
|
+
});
|
|
1661
|
+
let r = a.hit.element;
|
|
1662
|
+
if (j(r)) Qt(n, r.id).forEach((e) => {
|
|
1663
|
+
delete t[e.id];
|
|
1664
|
+
});
|
|
1665
|
+
else if (r.frameId) t[r.frameId] && delete t[r.id];
|
|
1666
|
+
else {
|
|
1667
|
+
let e = r.groupIds, i = new Set(e.flatMap((e) => zt(this.scene.getNonDeletedElements(), e)).filter((e) => j(e)).map((e) => e.id));
|
|
1668
|
+
i.size > 0 && n.forEach((e) => {
|
|
1669
|
+
e.frameId && i.has(e.frameId) && (delete t[e.id], e.groupIds.flatMap((e) => zt(this.scene.getNonDeletedElements(), e)).forEach((e) => {
|
|
1670
|
+
delete t[e.id];
|
|
1671
|
+
}));
|
|
1672
|
+
});
|
|
1673
|
+
}
|
|
1674
|
+
return { ...I({
|
|
1675
|
+
editingGroupId: e.editingGroupId,
|
|
1676
|
+
selectedElementIds: t
|
|
1677
|
+
}, this.scene.getNonDeletedElements(), e, this) };
|
|
1678
|
+
}), a.hit.wasAddedToSelection = !0);
|
|
1679
|
+
} else this.state.activeTool.type === "text" ? this.#Ge(e, a) : this.state.activeTool.type === "arrow" || this.state.activeTool.type === "line" ? this.#Je(e, this.state.activeTool.type, a) : this.state.activeTool.type === "freedraw" ? this.#Ke(e, this.state.activeTool.type, a) : this.state.activeTool.type === "custom" ? G(this.interactiveCanvas, this.state) : this.state.activeTool.type === b.frame || this.state.activeTool.type === b.magicframe ? this.#Ze(a, this.state.activeTool.type) : this.state.activeTool.type === "laser" ? this.laserTrails.startPath(a.lastCoords.x, a.lastCoords.y) : this.state.activeTool.type !== "eraser" && this.state.activeTool.type !== "hand" && this.state.activeTool.type !== "image" && this.#Xe(this.state.activeTool.type, a);
|
|
1680
|
+
this.props?.onPointerDown?.(this.state.activeTool, a), this.onPointerDownEmitter.trigger(this.state.activeTool, a, e), this.state.activeTool.type === "eraser" && this.eraserTrail.startPath(a.lastCoords.x, a.lastCoords.y);
|
|
1681
|
+
let o = this.#nt(a), s = this.#it(a), c = this.#et(a), l = this.#tt(a);
|
|
1682
|
+
this.missingPointerEventCleanupEmitter.once((t) => s(t || e.nativeEvent)), (!this.state.viewModeEnabled || this.state.activeTool.type === "laser") && (window.addEventListener(h.POINTER_MOVE, o), window.addEventListener(h.POINTER_UP, s), window.addEventListener(h.KEYDOWN, c), window.addEventListener(h.KEYUP, l), a.eventListeners.onMove = o, a.eventListeners.onUp = s, a.eventListeners.onKeyUp = l, a.eventListeners.onKeyDown = c);
|
|
1683
|
+
}, this.#Pe = (e) => {
|
|
1684
|
+
T("COMPLEX_BINDINGS") && this.#f(), this.removePointer(e), this.lastPointerUpEvent = e;
|
|
1685
|
+
let t = O({
|
|
1686
|
+
clientX: e.clientX,
|
|
1687
|
+
clientY: e.clientY
|
|
1688
|
+
}, this.state), { x: n, y: r } = t;
|
|
1689
|
+
this.lastPointerMoveCoords = {
|
|
1690
|
+
x: n,
|
|
1691
|
+
y: r
|
|
1692
|
+
};
|
|
1693
|
+
let i = e.timeStamp - (this.lastPointerDownEvent?.timeStamp ?? 0);
|
|
1694
|
+
if (this.editorInterface.formFactor === "phone" && i < 300) {
|
|
1695
|
+
let n = this.#xe(t.x, t.y);
|
|
1696
|
+
if (ft(n) && this.#v(n, e, t.x, t.y)) {
|
|
1697
|
+
this.#_(n);
|
|
1698
|
+
return;
|
|
1699
|
+
}
|
|
1700
|
+
}
|
|
1701
|
+
this.editorInterface.isTouchScreen && this.#xe(t.x, t.y, { includeLockedElements: !0 }), this.state.viewModeEnabled && this.setState({
|
|
1702
|
+
activeEmbeddable: null,
|
|
1703
|
+
selectedElementIds: {}
|
|
1704
|
+
});
|
|
1705
|
+
}, this.#Fe = (e) => {
|
|
1706
|
+
e.pointerType === "touch" && (mo = !1, Q ? mo = !0 : Q = window.setTimeout(() => {
|
|
1707
|
+
Q = 0, mo || this.#yt(e);
|
|
1708
|
+
}, 500));
|
|
1709
|
+
}, this.#Ie = () => {
|
|
1710
|
+
clearTimeout(Q), Q = 0, mo = !1;
|
|
1711
|
+
}, this.#Le = (e) => {
|
|
1712
|
+
vo?.(), this.missingPointerEventCleanupEmitter.trigger(e).clear();
|
|
1713
|
+
}, this.handleCanvasPanUsingWheelOrSpaceDrag = (e) => {
|
|
1714
|
+
if (!($.pointers.size <= 1 && (e.button === y.WHEEL || e.button === y.MAIN && lo || kr(this.state) || this.state.viewModeEnabled))) return !1;
|
|
1715
|
+
uo = !0, this.focusContainer(), this.state.editingTextElement || e.preventDefault();
|
|
1716
|
+
let t = !1, n = ao(window) ? !1 : /Linux/.test(window.navigator.platform);
|
|
1717
|
+
W(this.interactiveCanvas, u.GRABBING);
|
|
1718
|
+
let { clientX: r, clientY: i } = e, a = _a((e) => {
|
|
1719
|
+
let a = r - e.clientX, o = i - e.clientY;
|
|
1720
|
+
if (r = e.clientX, i = e.clientY, n && !t && (Math.abs(a) > 1 || Math.abs(o) > 1)) {
|
|
1721
|
+
t = !0;
|
|
1722
|
+
let e = (t) => {
|
|
1723
|
+
document.body.removeEventListener(h.PASTE, e), t.stopPropagation();
|
|
1724
|
+
}, n = () => {
|
|
1725
|
+
setTimeout(() => {
|
|
1726
|
+
document.body.removeEventListener(h.PASTE, e), window.removeEventListener(h.POINTER_UP, n);
|
|
1727
|
+
}, 100);
|
|
1728
|
+
};
|
|
1729
|
+
document.body.addEventListener(h.PASTE, e), window.addEventListener(h.POINTER_UP, n);
|
|
1730
|
+
}
|
|
1731
|
+
this.#ae({
|
|
1732
|
+
scrollX: this.state.scrollX - a / this.state.zoom.value,
|
|
1733
|
+
scrollY: this.state.scrollY - o / this.state.zoom.value
|
|
1734
|
+
});
|
|
1735
|
+
}), o = q(vo = () => {
|
|
1736
|
+
vo = null, uo = !1, lo || (this.state.viewModeEnabled ? W(this.interactiveCanvas, u.GRAB) : G(this.interactiveCanvas, this.state)), this.setState({ cursorButton: "up" }), this.#Et(e.clientX, e.clientY, "up"), window.removeEventListener(h.POINTER_MOVE, a), window.removeEventListener(h.POINTER_UP, o), window.removeEventListener(h.BLUR, o), a.flush();
|
|
1737
|
+
});
|
|
1738
|
+
return window.addEventListener(h.BLUR, o), window.addEventListener(h.POINTER_MOVE, a, { passive: !0 }), window.addEventListener(h.POINTER_UP, o), !0;
|
|
1739
|
+
}, this.#Ve = () => {
|
|
1740
|
+
Be(this.state.activeTool.type) || this.setState({
|
|
1741
|
+
selectedElementIds: F({}, this.state),
|
|
1742
|
+
selectedGroupIds: {},
|
|
1743
|
+
editingGroupId: null,
|
|
1744
|
+
activeEmbeddable: null
|
|
1745
|
+
});
|
|
1746
|
+
}, this.#He = (e, t) => {
|
|
1747
|
+
if (Be(this.state.activeTool.type)) {
|
|
1748
|
+
let n = this.scene.getNonDeletedElements(), r = this.scene.getNonDeletedElementsMap(), i = this.scene.getSelectedElements(this.state);
|
|
1749
|
+
if (i.length === 1 && !this.state.selectedLinearElement?.isEditing && !A(i[0]) && !(N(i[0]) && (this.editorInterface.userAgent.isMobileDevice || i[0].points.length === 2)) && !(this.state.selectedLinearElement && this.state.selectedLinearElement.hoverPointIndex !== -1)) {
|
|
1750
|
+
let r = Cr(n, this.state, t.origin.x, t.origin.y, this.state.zoom, e.pointerType, this.scene.getNonDeletedElementsMap(), this.editorInterface);
|
|
1751
|
+
r != null && (r.transformHandleType === "rotation" ? (this.setState({ resizingElement: r.element }), t.resize.handleType = r.transformHandleType) : (this.state.croppingElementId || this.setState({ resizingElement: r.element }), t.resize.handleType = r.transformHandleType));
|
|
1752
|
+
} else i.length > 1 && (t.resize.handleType = wr(En(i), t.origin.x, t.origin.y, this.state.zoom, e.pointerType, this.editorInterface));
|
|
1753
|
+
if (t.resize.handleType) t.resize.isResizing = !0, t.resize.offset = Je(yr(t.resize.handleType, i, r, t.origin.x, t.origin.y)), i.length === 1 && N(i[0]) && i[0].points.length === 2 && (t.resize.arrowDirection = vr(t.resize.handleType, i[0]));
|
|
1754
|
+
else {
|
|
1755
|
+
if (this.state.selectedLinearElement) {
|
|
1756
|
+
let n = this.state.selectedLinearElement, r = z.handlePointerDown(e, this, this.#r, t.origin, n, this.scene);
|
|
1757
|
+
if (r.hitElement && (t.hit.element = r.hitElement), r.linearElementEditor && this.setState({ selectedLinearElement: r.linearElementEditor }), r.didAddPoint) return !0;
|
|
1758
|
+
let i = this.scene.getNonDeletedElementsMap(), a = z.getElement(n.elementId, i);
|
|
1759
|
+
if (a && k(a)) {
|
|
1760
|
+
let { hitFocusPoint: e, pointerOffset: r } = In(a, t, i, this.state);
|
|
1761
|
+
if (e) return this.setState({ selectedLinearElement: {
|
|
1762
|
+
...n,
|
|
1763
|
+
hoveredFocusPointBinding: e,
|
|
1764
|
+
draggedFocusPointBinding: e,
|
|
1765
|
+
pointerOffset: r
|
|
1766
|
+
} }), !1;
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1769
|
+
let n = this.#Se(t.origin.x, t.origin.y, { includeLockedElements: !0 }), r = n.filter((e) => !e.locked), i = this.#xe(t.origin.x, t.origin.y, { allHitElements: n });
|
|
1770
|
+
(!i || i.id !== this.state.activeLockedId) && this.setState({ activeLockedId: null }), i && i.locked && !r.some((e) => this.state.selectedElementIds[e.id]) ? t.hit.element = null : t.hit.element = t.hit.element ?? this.#xe(t.origin.x, t.origin.y), this.state.croppingElementId && t.hit.element?.id !== this.state.croppingElementId && this.#De(), t.hit.allHitElements = r;
|
|
1771
|
+
let a = t.hit.element, o = t.hit.allHitElements.some((e) => this.#Ue(e));
|
|
1772
|
+
if ((a === null || !o) && !e.shiftKey && !t.hit.hasHitCommonBoundingBoxOfSelectedElements && (!this.state.selectedLinearElement?.isEditing || a && a?.id !== this.state.selectedLinearElement?.elementId) && this.#ht(a), this.state.selectedLinearElement?.isEditing) this.setState((e) => ({
|
|
1773
|
+
selectedLinearElement: e.selectedLinearElement ? {
|
|
1774
|
+
...e.selectedLinearElement,
|
|
1775
|
+
isEditing: !!a && a.id === this.state.selectedLinearElement?.elementId
|
|
1776
|
+
} : null,
|
|
1777
|
+
selectedElementIds: e.selectedLinearElement ? F({ [e.selectedLinearElement.elementId]: !0 }, this.state) : F({}, e)
|
|
1778
|
+
}));
|
|
1779
|
+
else if (a != null) {
|
|
1780
|
+
if (e[x.CTRL_OR_CMD]) return e.altKey ? (this.state.openDialog?.name === "elementLinkSelector" && this.setOpenDialog(null), this.lassoTrail.startPath(t.origin.x, t.origin.y, e.shiftKey), this.setActiveTool({
|
|
1781
|
+
type: "lasso",
|
|
1782
|
+
fromSelection: !0
|
|
1783
|
+
}), !1) : (this.state.selectedElementIds[a.id] || (t.hit.wasAddedToSelection = !0), this.setState((e) => ({
|
|
1784
|
+
...Rt(e, a),
|
|
1785
|
+
previousSelectedElementIds: this.state.selectedElementIds
|
|
1786
|
+
})), !1);
|
|
1787
|
+
this.state.selectedElementIds[a.id] || (this.state.editingGroupId && !Ht(a, this.state.editingGroupId) && this.setState({
|
|
1788
|
+
selectedElementIds: F({}, this.state),
|
|
1789
|
+
selectedGroupIds: {},
|
|
1790
|
+
editingGroupId: null,
|
|
1791
|
+
activeEmbeddable: null
|
|
1792
|
+
}), !o && !t.hit.hasHitCommonBoundingBoxOfSelectedElements && (this.setState((e) => {
|
|
1793
|
+
let t = {
|
|
1794
|
+
...e.selectedElementIds,
|
|
1795
|
+
[a.id]: !0
|
|
1796
|
+
}, n = [];
|
|
1797
|
+
if (Object.keys(e.selectedElementIds).forEach((e) => {
|
|
1798
|
+
let t = this.scene.getElement(e);
|
|
1799
|
+
t && n.push(t);
|
|
1800
|
+
}), j(a)) Qt(n, a.id).forEach((e) => {
|
|
1801
|
+
delete t[e.id];
|
|
1802
|
+
});
|
|
1803
|
+
else if (a.frameId) t[a.frameId] && delete t[a.id];
|
|
1804
|
+
else {
|
|
1805
|
+
let e = a.groupIds, r = new Set(e.flatMap((e) => zt(this.scene.getNonDeletedElements(), e)).filter((e) => j(e)).map((e) => e.id));
|
|
1806
|
+
r.size > 0 && n.forEach((e) => {
|
|
1807
|
+
e.frameId && r.has(e.frameId) && (delete t[e.id], e.groupIds.flatMap((e) => zt(this.scene.getNonDeletedElements(), e)).forEach((e) => {
|
|
1808
|
+
delete t[e.id];
|
|
1809
|
+
}));
|
|
1810
|
+
});
|
|
1811
|
+
}
|
|
1812
|
+
return e.openDialog?.name === "elementLinkSelector" && (a.groupIds.some((t) => e.selectedGroupIds[t]) || (t = { [a.id]: !0 })), { ...I({
|
|
1813
|
+
editingGroupId: e.editingGroupId,
|
|
1814
|
+
selectedElementIds: t
|
|
1815
|
+
}, this.scene.getNonDeletedElements(), e, this) };
|
|
1816
|
+
}), t.hit.wasAddedToSelection = !0));
|
|
1817
|
+
}
|
|
1818
|
+
this.setState({ previousSelectedElementIds: this.state.selectedElementIds });
|
|
1819
|
+
}
|
|
1820
|
+
}
|
|
1821
|
+
return !1;
|
|
1822
|
+
}, this.#Ge = (e, t) => {
|
|
1823
|
+
if (this.state.editingTextElement) return;
|
|
1824
|
+
let n = t.origin.x, r = t.origin.y, i = this.#xe(n, r, { includeBoundTextElement: !0 }), a = this.#we(n, r);
|
|
1825
|
+
it(i) && (a = i, n = i.x + i.width / 2, r = i.y + i.height / 2), this.#Te({
|
|
1826
|
+
sceneX: n,
|
|
1827
|
+
sceneY: r,
|
|
1828
|
+
insertAtParentCenter: !e.altKey,
|
|
1829
|
+
container: a,
|
|
1830
|
+
autoEdit: !1
|
|
1831
|
+
}), U(this.interactiveCanvas), this.state.activeTool.locked || this.setState({ activeTool: D(this.state, { type: this.state.preferredSelectionTool.type }) });
|
|
1832
|
+
}, this.#Ke = (e, t, n) => {
|
|
1833
|
+
let [r, i] = C(n.origin.x, n.origin.y, null), a = this.#ke({
|
|
1834
|
+
x: r,
|
|
1835
|
+
y: i
|
|
1836
|
+
}), o = e.pressure === .5, s = tr({
|
|
1837
|
+
type: t,
|
|
1838
|
+
x: r,
|
|
1839
|
+
y: i,
|
|
1840
|
+
strokeColor: this.state.currentItemStrokeColor,
|
|
1841
|
+
backgroundColor: this.state.currentItemBackgroundColor,
|
|
1842
|
+
fillStyle: this.state.currentItemFillStyle,
|
|
1843
|
+
strokeWidth: this.state.currentItemStrokeWidth,
|
|
1844
|
+
strokeStyle: this.state.currentItemStrokeStyle,
|
|
1845
|
+
roughness: this.state.currentItemRoughness,
|
|
1846
|
+
opacity: this.state.currentItemOpacity,
|
|
1847
|
+
roundness: null,
|
|
1848
|
+
simulatePressure: o,
|
|
1849
|
+
locked: !1,
|
|
1850
|
+
frameId: a ? a.id : null,
|
|
1851
|
+
points: [S(0, 0)],
|
|
1852
|
+
pressures: o ? [] : [e.pressure]
|
|
1853
|
+
});
|
|
1854
|
+
this.scene.insertElement(s), this.setState((e) => {
|
|
1855
|
+
let t = { ...e.selectedElementIds };
|
|
1856
|
+
return delete t[s.id], { selectedElementIds: F(t, e) };
|
|
1857
|
+
});
|
|
1858
|
+
let c = R(S(n.origin.x, n.origin.y), this.scene.getNonDeletedElements(), this.scene.getNonDeletedElementsMap());
|
|
1859
|
+
this.setState({
|
|
1860
|
+
newElement: s,
|
|
1861
|
+
startBoundElement: c,
|
|
1862
|
+
suggestedBinding: null
|
|
1863
|
+
});
|
|
1864
|
+
}, this.insertIframeElement = ({ sceneX: e, sceneY: t, width: n, height: r }) => {
|
|
1865
|
+
let [i, a] = C(e, t, this.lastPointerDownEvent?.[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()), o = nr({
|
|
1866
|
+
type: "iframe",
|
|
1867
|
+
x: i,
|
|
1868
|
+
y: a,
|
|
1869
|
+
strokeColor: "transparent",
|
|
1870
|
+
backgroundColor: "transparent",
|
|
1871
|
+
fillStyle: this.state.currentItemFillStyle,
|
|
1872
|
+
strokeWidth: this.state.currentItemStrokeWidth,
|
|
1873
|
+
strokeStyle: this.state.currentItemStrokeStyle,
|
|
1874
|
+
roughness: this.state.currentItemRoughness,
|
|
1875
|
+
roundness: this.#Ye("iframe"),
|
|
1876
|
+
opacity: this.state.currentItemOpacity,
|
|
1877
|
+
locked: !1,
|
|
1878
|
+
width: n,
|
|
1879
|
+
height: r
|
|
1880
|
+
});
|
|
1881
|
+
return this.scene.insertElement(o), o;
|
|
1882
|
+
}, this.insertEmbeddableElement = ({ sceneX: e, sceneY: t, link: n }) => {
|
|
1883
|
+
let [r, i] = C(e, t, this.lastPointerDownEvent?.[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize());
|
|
1884
|
+
if (!n) return;
|
|
1885
|
+
let a = {
|
|
1886
|
+
w: 560,
|
|
1887
|
+
h: 840
|
|
1888
|
+
}, o = $n({
|
|
1889
|
+
type: "embeddable",
|
|
1890
|
+
x: r,
|
|
1891
|
+
y: i,
|
|
1892
|
+
strokeColor: "transparent",
|
|
1893
|
+
backgroundColor: "transparent",
|
|
1894
|
+
fillStyle: this.state.currentItemFillStyle,
|
|
1895
|
+
strokeWidth: this.state.currentItemStrokeWidth,
|
|
1896
|
+
strokeStyle: this.state.currentItemStrokeStyle,
|
|
1897
|
+
roughness: this.state.currentItemRoughness,
|
|
1898
|
+
roundness: this.#Ye("embeddable"),
|
|
1899
|
+
opacity: this.state.currentItemOpacity,
|
|
1900
|
+
locked: !1,
|
|
1901
|
+
width: a.w,
|
|
1902
|
+
height: a.h,
|
|
1903
|
+
link: n
|
|
1904
|
+
});
|
|
1905
|
+
return this.scene.insertElement(o), o;
|
|
1906
|
+
}, this.#qe = ({ sceneX: e, sceneY: t, addToFrameUnderCursor: n = !0 }) => {
|
|
1907
|
+
let [r, i] = C(e, t, this.lastPointerDownEvent?.[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()), a = n ? this.#ke({
|
|
1908
|
+
x: r,
|
|
1909
|
+
y: i
|
|
1910
|
+
}) : null, o = 100 / this.state.zoom.value;
|
|
1911
|
+
return rr({
|
|
1912
|
+
type: "image",
|
|
1913
|
+
strokeColor: this.state.currentItemStrokeColor,
|
|
1914
|
+
backgroundColor: this.state.currentItemBackgroundColor,
|
|
1915
|
+
fillStyle: this.state.currentItemFillStyle,
|
|
1916
|
+
strokeWidth: this.state.currentItemStrokeWidth,
|
|
1917
|
+
strokeStyle: this.state.currentItemStrokeStyle,
|
|
1918
|
+
roughness: this.state.currentItemRoughness,
|
|
1919
|
+
roundness: null,
|
|
1920
|
+
opacity: this.state.currentItemOpacity,
|
|
1921
|
+
locked: !1,
|
|
1922
|
+
frameId: a ? a.id : null,
|
|
1923
|
+
x: r - o / 2,
|
|
1924
|
+
y: i - o / 2,
|
|
1925
|
+
width: o,
|
|
1926
|
+
height: o
|
|
1927
|
+
});
|
|
1928
|
+
}, this.#Je = (e, t, n) => {
|
|
1929
|
+
if (e.ctrlKey && Z(() => {
|
|
1930
|
+
this.setState({ isBindingEnabled: !1 });
|
|
1931
|
+
}), this.state.multiElement) {
|
|
1932
|
+
let { multiElement: t, selectedLinearElement: r } = this.state;
|
|
1933
|
+
if (E(r, "selectedLinearElement is expected to be set"), t.type === "line" && ln(t.points, this.state.zoom.value)) {
|
|
1934
|
+
Z(() => {
|
|
1935
|
+
this.setState({ selectedLinearElement: {
|
|
1936
|
+
...r,
|
|
1937
|
+
lastCommittedPoint: t.points[t.points.length - 1],
|
|
1938
|
+
initialState: {
|
|
1939
|
+
...r.initialState,
|
|
1940
|
+
lastClickedPoint: -1
|
|
1941
|
+
}
|
|
1942
|
+
} });
|
|
1943
|
+
}), this.actionManager.executeAction(K);
|
|
1944
|
+
return;
|
|
1945
|
+
}
|
|
1946
|
+
if (A(t) && t.points.length > 1) {
|
|
1947
|
+
this.actionManager.executeAction(K, "ui", {
|
|
1948
|
+
event: e.nativeEvent,
|
|
1949
|
+
sceneCoords: {
|
|
1950
|
+
x: n.origin.x,
|
|
1951
|
+
y: n.origin.y
|
|
1952
|
+
}
|
|
1953
|
+
});
|
|
1954
|
+
return;
|
|
1955
|
+
}
|
|
1956
|
+
let { x: i, y: a } = t, { lastCommittedPoint: o } = r, s = yn(this.state) && R(S(this.lastPointerMoveCoords?.x ?? i + t.points[t.points.length - 1][0], this.lastPointerMoveCoords?.y ?? a + t.points[t.points.length - 1][1]), this.scene.getNonDeletedElements(), this.scene.getNonDeletedElementsMap());
|
|
1957
|
+
if (k(t) && s || t.points.length > 1 && o && Oe(S(n.origin.x - i, n.origin.y - a), o) < 8) {
|
|
1958
|
+
this.actionManager.executeAction(K, "ui", {
|
|
1959
|
+
event: e.nativeEvent,
|
|
1960
|
+
sceneCoords: {
|
|
1961
|
+
x: n.origin.x,
|
|
1962
|
+
y: n.origin.y
|
|
1963
|
+
}
|
|
1964
|
+
});
|
|
1965
|
+
return;
|
|
1966
|
+
}
|
|
1967
|
+
this.setState((e) => ({ selectedElementIds: F({
|
|
1968
|
+
...e.selectedElementIds,
|
|
1969
|
+
[t.id]: !0
|
|
1970
|
+
}, e) })), W(this.interactiveCanvas, u.POINTER);
|
|
1971
|
+
} else {
|
|
1972
|
+
let [r, i] = C(n.origin.x, n.origin.y, e[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()), a = this.#ke({
|
|
1973
|
+
x: r,
|
|
1974
|
+
y: i
|
|
1975
|
+
}), { currentItemStartArrowhead: o, currentItemEndArrowhead: s } = this.state, [l, u] = t === "arrow" ? [o, s] : [null, null], d = t === "arrow" ? Zn({
|
|
1976
|
+
type: t,
|
|
1977
|
+
x: r,
|
|
1978
|
+
y: i,
|
|
1979
|
+
strokeColor: this.state.currentItemStrokeColor,
|
|
1980
|
+
backgroundColor: this.state.currentItemBackgroundColor,
|
|
1981
|
+
fillStyle: this.state.currentItemFillStyle,
|
|
1982
|
+
strokeWidth: this.state.currentItemStrokeWidth,
|
|
1983
|
+
strokeStyle: this.state.currentItemStrokeStyle,
|
|
1984
|
+
roughness: this.state.currentItemRoughness,
|
|
1985
|
+
opacity: this.state.currentItemOpacity,
|
|
1986
|
+
roundness: this.state.currentItemArrowType === c.round ? { type: ne.PROPORTIONAL_RADIUS } : null,
|
|
1987
|
+
startArrowhead: l,
|
|
1988
|
+
endArrowhead: u,
|
|
1989
|
+
locked: !1,
|
|
1990
|
+
frameId: a ? a.id : null,
|
|
1991
|
+
elbowed: this.state.currentItemArrowType === c.elbow,
|
|
1992
|
+
fixedSegments: this.state.currentItemArrowType === c.elbow ? [] : null
|
|
1993
|
+
}) : ir({
|
|
1994
|
+
type: t,
|
|
1995
|
+
x: r,
|
|
1996
|
+
y: i,
|
|
1997
|
+
strokeColor: this.state.currentItemStrokeColor,
|
|
1998
|
+
backgroundColor: this.state.currentItemBackgroundColor,
|
|
1999
|
+
fillStyle: this.state.currentItemFillStyle,
|
|
2000
|
+
strokeWidth: this.state.currentItemStrokeWidth,
|
|
2001
|
+
strokeStyle: this.state.currentItemStrokeStyle,
|
|
2002
|
+
roughness: this.state.currentItemRoughness,
|
|
2003
|
+
opacity: this.state.currentItemOpacity,
|
|
2004
|
+
roundness: this.state.currentItemRoundness === "round" ? { type: ne.PROPORTIONAL_RADIUS } : null,
|
|
2005
|
+
locked: !1,
|
|
2006
|
+
frameId: a ? a.id : null
|
|
2007
|
+
}), f = S(n.origin.x, n.origin.y), p = this.scene.getNonDeletedElementsMap(), m = yn(this.state) ? R(f, this.scene.getNonDeletedElements(), p) : null;
|
|
2008
|
+
this.scene.mutateElement(d, { points: [S(0, 0), S(0, 0)] }), this.scene.insertElement(d), k(d) && hn(d, /* @__PURE__ */ new Map([[0, {
|
|
2009
|
+
point: S(0, 0),
|
|
2010
|
+
isDragging: !1
|
|
2011
|
+
}]]), f[0], f[1], this.scene, this.state, {
|
|
2012
|
+
newArrow: !0,
|
|
2013
|
+
altKey: e.altKey,
|
|
2014
|
+
initialBinding: !0,
|
|
2015
|
+
angleLocked: Se(e.nativeEvent)
|
|
2016
|
+
}), Z(() => {
|
|
2017
|
+
this.setState((e) => {
|
|
2018
|
+
let t = null, r = e.selectedElementIds;
|
|
2019
|
+
if (N(d)) {
|
|
2020
|
+
t = new z(d, this.scene.getNonDeletedElementsMap());
|
|
2021
|
+
let e = d.points.length - 1;
|
|
2022
|
+
t = {
|
|
2023
|
+
...t,
|
|
2024
|
+
selectedPointsIndices: [e],
|
|
2025
|
+
initialState: {
|
|
2026
|
+
...t.initialState,
|
|
2027
|
+
lastClickedPoint: e,
|
|
2028
|
+
origin: S(n.origin.x, n.origin.y)
|
|
2029
|
+
}
|
|
2030
|
+
};
|
|
2031
|
+
}
|
|
2032
|
+
return r = this.state.activeTool.locked ? e.selectedElementIds : F({ [d.id]: !0 }, e), {
|
|
2033
|
+
...e,
|
|
2034
|
+
bindMode: "orbit",
|
|
2035
|
+
newElement: d,
|
|
2036
|
+
startBoundElement: m,
|
|
2037
|
+
suggestedBinding: m || null,
|
|
2038
|
+
selectedElementIds: r,
|
|
2039
|
+
selectedLinearElement: t
|
|
2040
|
+
};
|
|
2041
|
+
});
|
|
2042
|
+
}), k(d) && T("COMPLEX_BINDINGS") && this.#m(d, m);
|
|
2043
|
+
}
|
|
2044
|
+
}, this.#Xe = (e, t) => {
|
|
2045
|
+
let [n, r] = C(t.origin.x, t.origin.y, this.lastPointerDownEvent?.[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()), i = this.#ke({
|
|
2046
|
+
x: n,
|
|
2047
|
+
y: r
|
|
2048
|
+
}), a = {
|
|
2049
|
+
x: n,
|
|
2050
|
+
y: r,
|
|
2051
|
+
strokeColor: this.state.currentItemStrokeColor,
|
|
2052
|
+
backgroundColor: this.state.currentItemBackgroundColor,
|
|
2053
|
+
fillStyle: this.state.currentItemFillStyle,
|
|
2054
|
+
strokeWidth: this.state.currentItemStrokeWidth,
|
|
2055
|
+
strokeStyle: this.state.currentItemStrokeStyle,
|
|
2056
|
+
roughness: this.state.currentItemRoughness,
|
|
2057
|
+
opacity: this.state.currentItemOpacity,
|
|
2058
|
+
roundness: this.#Ye(e),
|
|
2059
|
+
locked: !1,
|
|
2060
|
+
frameId: i ? i.id : null
|
|
2061
|
+
}, o;
|
|
2062
|
+
o = e === "embeddable" ? $n({
|
|
2063
|
+
type: "embeddable",
|
|
2064
|
+
...a
|
|
2065
|
+
}) : Qn({
|
|
2066
|
+
type: e,
|
|
2067
|
+
...a
|
|
2068
|
+
}), o.type === "selection" ? this.setState({ selectionElement: o }) : (this.scene.insertElement(o), this.setState({
|
|
2069
|
+
multiElement: null,
|
|
2070
|
+
newElement: o
|
|
2071
|
+
}));
|
|
2072
|
+
}, this.#Ze = (e, t) => {
|
|
2073
|
+
let [n, r] = C(e.origin.x, e.origin.y, this.lastPointerDownEvent?.[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()), i = {
|
|
2074
|
+
x: n,
|
|
2075
|
+
y: r,
|
|
2076
|
+
opacity: this.state.currentItemOpacity,
|
|
2077
|
+
locked: !1,
|
|
2078
|
+
...g
|
|
2079
|
+
}, a = t === b.magicframe ? ar(i) : er(i);
|
|
2080
|
+
this.scene.insertElement(a), this.setState({
|
|
2081
|
+
multiElement: null,
|
|
2082
|
+
newElement: a
|
|
2083
|
+
});
|
|
2084
|
+
}, this.#at = () => {
|
|
2085
|
+
this.#l = /* @__PURE__ */ new Set(), this.#se();
|
|
2086
|
+
}, this.#ot = () => {
|
|
2087
|
+
let e = !1;
|
|
2088
|
+
this.#l.forEach((e) => {
|
|
2089
|
+
let t = this.scene.getElement(e);
|
|
2090
|
+
if (k(t)) {
|
|
2091
|
+
if (t.startBinding) {
|
|
2092
|
+
let e = this.scene.getElement(t.startBinding.elementId);
|
|
2093
|
+
Wt(e, this.scene.getElementsMapIncludingDeleted(), { boundElements: e.boundElements.filter((e) => e.id !== t.id) });
|
|
2094
|
+
}
|
|
2095
|
+
if (t.endBinding) {
|
|
2096
|
+
let e = this.scene.getElement(t.endBinding.elementId);
|
|
2097
|
+
Wt(e, this.scene.getElementsMapIncludingDeleted(), { boundElements: e.boundElements.filter((e) => e.id !== t.id) });
|
|
2098
|
+
}
|
|
2099
|
+
} else ot(t) && t.boundElements?.forEach?.((e) => {
|
|
2100
|
+
if (e.type === "arrow") {
|
|
2101
|
+
let n = this.scene.getElement(e.id);
|
|
2102
|
+
n?.startBinding?.elementId === t.id && Wt(n, this.scene.getElementsMapIncludingDeleted(), { startBinding: null }), n?.endBinding?.elementId === t.id && Wt(n, this.scene.getElementsMapIncludingDeleted(), { endBinding: null });
|
|
2103
|
+
}
|
|
2104
|
+
});
|
|
2105
|
+
});
|
|
2106
|
+
let t = this.scene.getElementsIncludingDeleted().map((t) => this.#l.has(t.id) || t.frameId && this.#l.has(t.frameId) || ct(t) && this.#l.has(t.containerId) ? (e = !0, L(t, { isDeleted: !0 })) : t);
|
|
2107
|
+
this.#l = /* @__PURE__ */ new Set(), e && (this.#r.scheduleCapture(), this.scene.replaceAllElements(t));
|
|
2108
|
+
}, this.#st = async (e, t) => {
|
|
2109
|
+
if (!ui(t)) throw Error(H("errors.unsupportedFileType"));
|
|
2110
|
+
let n = t.type;
|
|
2111
|
+
if (W(this.interactiveCanvas, "wait"), n === v.svg) try {
|
|
2112
|
+
t = ii(hr(await t.text()), t.name);
|
|
2113
|
+
} catch (e) {
|
|
2114
|
+
throw console.warn(e), Error(H("errors.svgImageInsertError"));
|
|
2115
|
+
}
|
|
2116
|
+
let r = await (this.props.generateIdForFile?.(t) || oi(t));
|
|
2117
|
+
if (!r) throw console.warn("Couldn't generate file id or the supplied `generateIdForFile` didn't resolve to one."), Error(H("errors.imageInsertError"));
|
|
2118
|
+
if (!this.files[r]?.dataURL) {
|
|
2119
|
+
try {
|
|
2120
|
+
t = await hi(t, { maxWidthOrHeight: f });
|
|
2121
|
+
} catch (e) {
|
|
2122
|
+
console.error("Error trying to resizing image file on insertion", e);
|
|
2123
|
+
}
|
|
2124
|
+
if (t.size > 4194304) throw Error(H("errors.fileTooBig", { maxSize: `${Math.trunc(ee / 1024 / 1024)}MB` }));
|
|
2125
|
+
}
|
|
2126
|
+
let i = this.files[r]?.dataURL || await si(t);
|
|
2127
|
+
return new Promise(async (t, a) => {
|
|
2128
|
+
try {
|
|
2129
|
+
let a = this.#ct(e, r);
|
|
2130
|
+
if (this.#oe([{
|
|
2131
|
+
mimeType: n,
|
|
2132
|
+
id: r,
|
|
2133
|
+
dataURL: i,
|
|
2134
|
+
created: Date.now(),
|
|
2135
|
+
lastRetrieved: Date.now()
|
|
2136
|
+
}]), !this.imageCache.get(r)) {
|
|
2137
|
+
this.#ft();
|
|
2138
|
+
let { erroredFiles: e } = await this.#dt([a]);
|
|
2139
|
+
if (e.size) throw Error("Image cache update resulted with an error.");
|
|
2140
|
+
}
|
|
2141
|
+
let o = await this.imageCache.get(r)?.image;
|
|
2142
|
+
if (o && this.state.newElement?.id !== a.id) {
|
|
2143
|
+
a = this.#ct(e, r);
|
|
2144
|
+
let t = this.#ut(a, o);
|
|
2145
|
+
Object.assign(a, t);
|
|
2146
|
+
}
|
|
2147
|
+
t(a);
|
|
2148
|
+
} catch (e) {
|
|
2149
|
+
console.error(e), a(Error(H("errors.imageInsertError")));
|
|
2150
|
+
}
|
|
2151
|
+
});
|
|
2152
|
+
}, this.#ct = (e, t) => L(this.scene.getElement(e.id) ?? e, { fileId: t }), this.#lt = async () => {
|
|
2153
|
+
try {
|
|
2154
|
+
let { x: e, y: t } = O({
|
|
2155
|
+
clientX: this.state.width / 2 + this.state.offsetLeft,
|
|
2156
|
+
clientY: this.state.height / 2 + this.state.offsetTop
|
|
2157
|
+
}, this.state), n = await $r({
|
|
2158
|
+
description: "Image",
|
|
2159
|
+
extensions: Object.keys(_),
|
|
2160
|
+
multiple: !0
|
|
2161
|
+
});
|
|
2162
|
+
this.#_t(n, e, t);
|
|
2163
|
+
} catch (e) {
|
|
2164
|
+
e.name === "AbortError" ? console.warn(e) : console.error(e), this.setState({
|
|
2165
|
+
newElement: null,
|
|
2166
|
+
activeTool: D(this.state, { type: this.state.preferredSelectionTool.type })
|
|
2167
|
+
}, () => {
|
|
2168
|
+
this.actionManager.executeAction(K);
|
|
2169
|
+
});
|
|
2170
|
+
}
|
|
2171
|
+
}, this.#ut = (e, t) => {
|
|
2172
|
+
let n = Math.max(this.state.height - 120, 160), r = Math.min(n, Math.floor(this.state.height * .5) / this.state.zoom.value), i = Math.min(t.naturalHeight, r), a = i * (t.naturalWidth / t.naturalHeight);
|
|
2173
|
+
return {
|
|
2174
|
+
x: e.x + e.width / 2 - a / 2,
|
|
2175
|
+
y: e.y + e.height / 2 - i / 2,
|
|
2176
|
+
width: a,
|
|
2177
|
+
height: i,
|
|
2178
|
+
crop: null
|
|
2179
|
+
};
|
|
2180
|
+
}, this.#dt = async (e, t = this.files) => {
|
|
2181
|
+
let { updatedFiles: n, erroredFiles: r } = await gr({
|
|
2182
|
+
imageCache: this.imageCache,
|
|
2183
|
+
fileIds: e.map((e) => e.fileId),
|
|
2184
|
+
files: t
|
|
2185
|
+
});
|
|
2186
|
+
return r.size && (this.#r.scheduleAction(B.NEVER), this.scene.replaceAllElements(this.scene.getElementsIncludingDeleted().map((e) => pt(e) && r.has(e.fileId) ? L(e, { status: "error" }) : e))), {
|
|
2187
|
+
updatedFiles: n,
|
|
2188
|
+
erroredFiles: r
|
|
2189
|
+
};
|
|
2190
|
+
}, this.#ft = async (e = mr(this.scene.getNonDeletedElements()), t = this.files) => {
|
|
2191
|
+
let n = e.filter((e) => !e.isDeleted && !this.imageCache.has(e.fileId));
|
|
2192
|
+
if (n.length) {
|
|
2193
|
+
let { updatedFiles: e } = await this.#dt(n, t);
|
|
2194
|
+
if (e.size) for (let t of n) e.has(t.fileId) && sn.delete(t);
|
|
2195
|
+
e.size && this.scene.triggerUpdate();
|
|
2196
|
+
}
|
|
2197
|
+
}, this.#pt = eo(() => {
|
|
2198
|
+
this.#ft();
|
|
2199
|
+
}, 500), this.#mt = (e) => {
|
|
2200
|
+
let t = xn(e);
|
|
2201
|
+
this.state.isBindingEnabled !== t && this.setState({ isBindingEnabled: t });
|
|
2202
|
+
}, this.#gt = (e) => {
|
|
2203
|
+
e === null ? (this.interactiveCanvas?.removeEventListener?.(h.TOUCH_START, this.#$), this.interactiveCanvas?.removeEventListener?.(h.TOUCH_END, this.#ee)) : (this.interactiveCanvas = e, this.interactiveCanvas.addEventListener(h.TOUCH_START, this.#$, { passive: !1 }), this.interactiveCanvas.addEventListener(h.TOUCH_END, this.#ee));
|
|
2204
|
+
}, this.#_t = async (e, t, n) => {
|
|
2205
|
+
let r = 50 / this.state.zoom.value, i = _r(e.map(() => this.#qe({
|
|
2206
|
+
sceneX: t,
|
|
2207
|
+
sceneY: n
|
|
2208
|
+
})), t, n, r);
|
|
2209
|
+
i.forEach((e) => this.scene.insertElement(e));
|
|
2210
|
+
let a = await Promise.all(i.map(async (t, n) => {
|
|
2211
|
+
try {
|
|
2212
|
+
return await this.#st(t, await pi(e[n]));
|
|
2213
|
+
} catch (e) {
|
|
2214
|
+
return this.setState({ errorMessage: e.message || H("errors.imageInsertError") }), L(t, { isDeleted: !0 });
|
|
2215
|
+
}
|
|
2216
|
+
})), o = Ae(a), s = _r(a.filter((e) => !e.isDeleted), t, n, r), c = Ae(s), l = this.scene.getElementsIncludingDeleted().map((e) => c.get(e.id) ?? o.get(e.id) ?? e);
|
|
2217
|
+
this.updateScene({
|
|
2218
|
+
appState: { selectedElementIds: F(Object.fromEntries(s.map((e) => [e.id, !0])), this.state) },
|
|
2219
|
+
elements: l,
|
|
2220
|
+
captureUpdate: B.IMMEDIATELY
|
|
2221
|
+
}), this.setState({}, () => {
|
|
2222
|
+
this.actionManager.executeAction(K);
|
|
2223
|
+
});
|
|
2224
|
+
}, this.#vt = async (e) => {
|
|
2225
|
+
let { x: t, y: n } = O(e, this.state), r = await vi(e), i = r.getFiles();
|
|
2226
|
+
if (i.length === 1) {
|
|
2227
|
+
let { file: e, fileHandle: t } = i[0];
|
|
2228
|
+
if (e && (e.type === v.png || e.type === v.svg)) try {
|
|
2229
|
+
let n = await di(e, this.state, this.scene.getElementsIncludingDeleted(), t);
|
|
2230
|
+
this.syncActionResult({
|
|
2231
|
+
...n,
|
|
2232
|
+
appState: {
|
|
2233
|
+
...n.appState || this.state,
|
|
2234
|
+
isLoading: !1
|
|
2235
|
+
},
|
|
2236
|
+
replaceFiles: !0,
|
|
2237
|
+
captureUpdate: B.IMMEDIATELY
|
|
2238
|
+
});
|
|
2239
|
+
return;
|
|
2240
|
+
} catch (e) {
|
|
2241
|
+
if (e.name !== "EncodingError") throw Error(H("alerts.couldNotLoadInvalidFile"), { cause: e });
|
|
2242
|
+
}
|
|
2243
|
+
}
|
|
2244
|
+
let a = i.map((e) => e.file).filter((e) => ui(e));
|
|
2245
|
+
if (a.length > 0 && this.#de("image")) return this.#_t(a, t, n);
|
|
2246
|
+
let o = r.getData(v.drawlibIds), s = r.getData(v.drawlib);
|
|
2247
|
+
if (o || s) {
|
|
2248
|
+
try {
|
|
2249
|
+
let t = null;
|
|
2250
|
+
if (o) {
|
|
2251
|
+
let { itemIds: e } = JSON.parse(o);
|
|
2252
|
+
t = (await this.library.getLatestLibrary()).filter((t) => e.includes(t.id));
|
|
2253
|
+
} else s && (t = mi(s));
|
|
2254
|
+
t?.length && (t = t.map((e) => ({
|
|
2255
|
+
...e,
|
|
2256
|
+
elements: Hn({
|
|
2257
|
+
type: "everything",
|
|
2258
|
+
elements: e.elements,
|
|
2259
|
+
randomizeSeed: !0
|
|
2260
|
+
}).duplicatedElements
|
|
2261
|
+
})), this.addElementsFromPasteOrLibrary({
|
|
2262
|
+
elements: da(t),
|
|
2263
|
+
position: e,
|
|
2264
|
+
files: null
|
|
2265
|
+
}));
|
|
2266
|
+
} catch (e) {
|
|
2267
|
+
this.setState({ errorMessage: e.message });
|
|
2268
|
+
}
|
|
2269
|
+
return;
|
|
2270
|
+
}
|
|
2271
|
+
if (i.length > 0) {
|
|
2272
|
+
let { file: e, fileHandle: t } = i[0];
|
|
2273
|
+
e && await this.loadFileToCanvas(e, t);
|
|
2274
|
+
}
|
|
2275
|
+
let c = r.findByType(v.text);
|
|
2276
|
+
if (c) {
|
|
2277
|
+
let e = c.value;
|
|
2278
|
+
if (e && lr(e, this.props.validateEmbeddable) && /^(http|https):\/\/[^\s/$.?#].[^\s]*$/.test(e)) {
|
|
2279
|
+
let r = this.insertEmbeddableElement({
|
|
2280
|
+
sceneX: t,
|
|
2281
|
+
sceneY: n,
|
|
2282
|
+
link: $e(e)
|
|
2283
|
+
});
|
|
2284
|
+
r && (this.#r.scheduleCapture(), this.setState({ selectedElementIds: { [r.id]: !0 } }));
|
|
2285
|
+
}
|
|
2286
|
+
}
|
|
2287
|
+
}, this.loadFileToCanvas = async (e, t) => {
|
|
2288
|
+
e = await pi(e);
|
|
2289
|
+
try {
|
|
2290
|
+
let n = this.scene.getElementsIncludingDeleted(), r;
|
|
2291
|
+
try {
|
|
2292
|
+
r = await fi(e, this.state, n, t);
|
|
2293
|
+
} catch (e) {
|
|
2294
|
+
let t = e instanceof Qr;
|
|
2295
|
+
if (t && e.code === "IMAGE_NOT_CONTAINS_SCENE_DATA" && !this.#de("image")) {
|
|
2296
|
+
this.setState({
|
|
2297
|
+
isLoading: !1,
|
|
2298
|
+
errorMessage: H("errors.imageToolNotSupported")
|
|
2299
|
+
});
|
|
2300
|
+
return;
|
|
2301
|
+
}
|
|
2302
|
+
let n = H(t ? "alerts.cannotRestoreFromImage" : "alerts.couldNotLoadInvalidFile");
|
|
2303
|
+
this.setState({
|
|
2304
|
+
isLoading: !1,
|
|
2305
|
+
errorMessage: n
|
|
2306
|
+
});
|
|
2307
|
+
}
|
|
2308
|
+
if (!r) return;
|
|
2309
|
+
r.type === v.draw ? (Cn(n.concat(r.data.elements)), this.#r.scheduleMicroAction({
|
|
2310
|
+
action: B.NEVER,
|
|
2311
|
+
elements: n,
|
|
2312
|
+
appState: void 0
|
|
2313
|
+
}), this.setState({ isLoading: !0 }), this.syncActionResult({
|
|
2314
|
+
...r.data,
|
|
2315
|
+
appState: {
|
|
2316
|
+
...r.data.appState || this.state,
|
|
2317
|
+
isLoading: !1
|
|
2318
|
+
},
|
|
2319
|
+
replaceFiles: !0,
|
|
2320
|
+
captureUpdate: B.IMMEDIATELY
|
|
2321
|
+
})) : r.type === v.drawlib && await this.library.updateLibrary({
|
|
2322
|
+
libraryItems: e,
|
|
2323
|
+
merge: !0,
|
|
2324
|
+
openLibraryMenu: !0
|
|
2325
|
+
}).catch((e) => {
|
|
2326
|
+
console.error(e), this.setState({ errorMessage: H("errors.importLibraryError") });
|
|
2327
|
+
});
|
|
2328
|
+
} catch (e) {
|
|
2329
|
+
this.setState({
|
|
2330
|
+
isLoading: !1,
|
|
2331
|
+
errorMessage: e.message
|
|
2332
|
+
});
|
|
2333
|
+
}
|
|
2334
|
+
}, this.#yt = (e) => {
|
|
2335
|
+
if (e.preventDefault(), ("pointerType" in e.nativeEvent && e.nativeEvent.pointerType === "touch" || "pointerType" in e.nativeEvent && e.nativeEvent.pointerType === "pen" && e.button !== y.SECONDARY) && this.state.activeTool.type !== this.state.preferredSelectionTool.type) return;
|
|
2336
|
+
let { x: t, y: n } = O(e, this.state), r = this.#xe(t, n, {
|
|
2337
|
+
preferSelected: !0,
|
|
2338
|
+
includeLockedElements: !0
|
|
2339
|
+
}), i = this.scene.getSelectedElements(this.state), a = this.#We({
|
|
2340
|
+
x: t,
|
|
2341
|
+
y: n
|
|
2342
|
+
}, i), o = r || a ? "element" : "canvas", { top: s, left: c } = this.rootElement.getBoundingClientRect(), l = e.clientX - c, u = e.clientY - s;
|
|
2343
|
+
V("contextMenu", "openContextMenu", o), this.setState({ ...r && !this.state.selectedElementIds[r.id] ? {
|
|
2344
|
+
...this.state,
|
|
2345
|
+
...I({
|
|
2346
|
+
editingGroupId: this.state.editingGroupId,
|
|
2347
|
+
selectedElementIds: { [r.id]: !0 }
|
|
2348
|
+
}, this.scene.getNonDeletedElements(), this.state, this),
|
|
2349
|
+
selectedLinearElement: N(r) ? new z(r, this.scene.getNonDeletedElementsMap()) : null
|
|
2350
|
+
} : this.state }, () => {
|
|
2351
|
+
this.setState({ contextMenu: {
|
|
2352
|
+
top: u,
|
|
2353
|
+
left: l,
|
|
2354
|
+
items: this.#Ct(o)
|
|
2355
|
+
} });
|
|
2356
|
+
});
|
|
2357
|
+
}, this.#bt = (e, t, n = !0) => {
|
|
2358
|
+
let r = this.state.selectionElement, i = e.lastCoords;
|
|
2359
|
+
if (r && e.boxSelection.hasOccurred && this.state.activeTool.type !== "eraser") {
|
|
2360
|
+
Kn({
|
|
2361
|
+
newElement: r,
|
|
2362
|
+
elementType: this.state.activeTool.type,
|
|
2363
|
+
originX: e.origin.x,
|
|
2364
|
+
originY: e.origin.y,
|
|
2365
|
+
x: i.x,
|
|
2366
|
+
y: i.y,
|
|
2367
|
+
width: Me(e.origin.x, i.x),
|
|
2368
|
+
height: Me(e.origin.y, i.y),
|
|
2369
|
+
shouldMaintainAspectRatio: be(t),
|
|
2370
|
+
shouldResizeFromCenter: !1,
|
|
2371
|
+
scene: this.scene,
|
|
2372
|
+
zoom: this.state.zoom.value,
|
|
2373
|
+
informMutation: !1
|
|
2374
|
+
});
|
|
2375
|
+
return;
|
|
2376
|
+
}
|
|
2377
|
+
let a = this.state.newElement;
|
|
2378
|
+
if (!a) return;
|
|
2379
|
+
let [o, s] = C(i.x, i.y, t[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()), c = pt(a) && this.imageCache.get(a.fileId)?.image, l = c && !(c instanceof Promise) ? c.width / c.height : null;
|
|
2380
|
+
this.#Qe(t, [a]);
|
|
2381
|
+
let { snapOffset: u, snapLines: d } = Da(a, this, t, {
|
|
2382
|
+
x: e.originInGrid.x + (this.state.originSnapOffset?.x ?? 0),
|
|
2383
|
+
y: e.originInGrid.y + (this.state.originSnapOffset?.y ?? 0)
|
|
2384
|
+
}, {
|
|
2385
|
+
x: o - e.originInGrid.x,
|
|
2386
|
+
y: s - e.originInGrid.y
|
|
2387
|
+
}, this.scene.getNonDeletedElementsMap());
|
|
2388
|
+
o += u.x, s += u.y, this.setState({ snapLines: d }), k(a) || Kn({
|
|
2389
|
+
newElement: a,
|
|
2390
|
+
elementType: this.state.activeTool.type,
|
|
2391
|
+
originX: e.originInGrid.x,
|
|
2392
|
+
originY: e.originInGrid.y,
|
|
2393
|
+
x: o,
|
|
2394
|
+
y: s,
|
|
2395
|
+
width: Me(e.originInGrid.x, o),
|
|
2396
|
+
height: Me(e.originInGrid.y, s),
|
|
2397
|
+
shouldMaintainAspectRatio: M(a) ? !be(t) : be(t),
|
|
2398
|
+
shouldResizeFromCenter: xe(t),
|
|
2399
|
+
zoom: this.state.zoom.value,
|
|
2400
|
+
scene: this.scene,
|
|
2401
|
+
widthAspectRatio: l,
|
|
2402
|
+
originOffset: this.state.originSnapOffset,
|
|
2403
|
+
informMutation: n
|
|
2404
|
+
}), this.setState({ newElement: a }), (this.state.activeTool.type === b.frame || this.state.activeTool.type === b.magicframe) && this.setState({ elementsToHighlight: Xt(this.scene.getNonDeletedElements(), a, this.state, this.scene.getNonDeletedElementsMap()) });
|
|
2405
|
+
}, this.#xt = (e, t) => {
|
|
2406
|
+
if (!this.state.croppingElementId) return !1;
|
|
2407
|
+
let n = e.resize.handleType, r = e.lastCoords, [i, a] = C(r.x - e.resize.offset.x, r.y - e.resize.offset.y, t[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()), o = this.scene.getNonDeletedElementsMap().get(this.state.croppingElementId);
|
|
2408
|
+
if (n && o && M(o)) {
|
|
2409
|
+
let s = e.originalElements.get(o.id), c = pt(o) && this.imageCache.get(o.fileId)?.image;
|
|
2410
|
+
if (s && M(s) && c && !(c instanceof Promise)) {
|
|
2411
|
+
let [l, u] = C(r.x, r.y, t[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()), d = {
|
|
2412
|
+
x: l - e.originInGrid.x,
|
|
2413
|
+
y: u - e.originInGrid.y
|
|
2414
|
+
};
|
|
2415
|
+
this.#Qe(t, [o]);
|
|
2416
|
+
let { snapOffset: f, snapLines: p } = Oa([o], [s], this, t, d, n);
|
|
2417
|
+
this.scene.mutateElement(o, nt(o, this.scene.getNonDeletedElementsMap(), n, c.naturalWidth, c.naturalHeight, i + f.x, a + f.y, t.shiftKey ? s.width / s.height : void 0)), Sn(o, this.scene), this.setState({
|
|
2418
|
+
isCropping: n && n !== "rotation",
|
|
2419
|
+
snapLines: p
|
|
2420
|
+
});
|
|
2421
|
+
}
|
|
2422
|
+
return !0;
|
|
2423
|
+
}
|
|
2424
|
+
return !1;
|
|
2425
|
+
}, this.#St = (e, t) => {
|
|
2426
|
+
let n = this.scene.getSelectedElements(this.state), r = n.filter((e) => j(e)), i = e.resize.handleType;
|
|
2427
|
+
if (r.length > 0 && i === "rotation" || n.length === 1 && A(n[0]) || this.state.croppingElementId) return !1;
|
|
2428
|
+
this.setState({
|
|
2429
|
+
isResizing: i && i !== "rotation",
|
|
2430
|
+
isRotating: i === "rotation",
|
|
2431
|
+
activeEmbeddable: null
|
|
2432
|
+
});
|
|
2433
|
+
let a = e.lastCoords, [o, s] = C(a.x - e.resize.offset.x, a.y - e.resize.offset.y, t[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()), c = /* @__PURE__ */ new Map();
|
|
2434
|
+
if (r.forEach((e) => {
|
|
2435
|
+
Qt(this.scene.getNonDeletedElements(), e.id).forEach((t) => {
|
|
2436
|
+
c.set(e.id + t.id, {
|
|
2437
|
+
x: t.x - e.x,
|
|
2438
|
+
y: t.y - e.y
|
|
2439
|
+
});
|
|
2440
|
+
});
|
|
2441
|
+
}), !this.state.selectedElementsAreBeingDragged) {
|
|
2442
|
+
let [r, c] = C(a.x, a.y, t[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()), l = {
|
|
2443
|
+
x: r - e.originInGrid.x,
|
|
2444
|
+
y: c - e.originInGrid.y
|
|
2445
|
+
}, u = [...e.originalElements.values()];
|
|
2446
|
+
this.#Qe(t, n);
|
|
2447
|
+
let { snapOffset: d, snapLines: f } = Oa(n, St(u, this.state), this, t, l, i);
|
|
2448
|
+
o += d.x, s += d.y, this.setState({ snapLines: f });
|
|
2449
|
+
}
|
|
2450
|
+
if (br(e.originalElements, i, n, this.scene, Se(t), xe(t), n.some((e) => M(e)) ? !be(t) : be(t), o, s, e.resize.center.x, e.resize.center.y)) {
|
|
2451
|
+
let e = /* @__PURE__ */ new Set();
|
|
2452
|
+
return r.forEach((t) => {
|
|
2453
|
+
Xt(this.scene.getNonDeletedElements(), t, this.state, this.scene.getNonDeletedElementsMap()).forEach((t) => e.add(t));
|
|
2454
|
+
}), this.setState({ elementsToHighlight: [...e] }), !0;
|
|
2455
|
+
}
|
|
2456
|
+
return !1;
|
|
2457
|
+
}, this.#Ct = (e) => {
|
|
2458
|
+
let t = [];
|
|
2459
|
+
if (t.push(Ri, zi), e === "canvas") return this.state.viewModeEnabled ? [
|
|
2460
|
+
...t,
|
|
2461
|
+
Ui,
|
|
2462
|
+
Gi,
|
|
2463
|
+
sa,
|
|
2464
|
+
Qi
|
|
2465
|
+
] : [
|
|
2466
|
+
Vi,
|
|
2467
|
+
Y,
|
|
2468
|
+
Ri,
|
|
2469
|
+
zi,
|
|
2470
|
+
Hi,
|
|
2471
|
+
Y,
|
|
2472
|
+
bi,
|
|
2473
|
+
Xi,
|
|
2474
|
+
Y,
|
|
2475
|
+
Ui,
|
|
2476
|
+
Wi,
|
|
2477
|
+
Gi,
|
|
2478
|
+
sa,
|
|
2479
|
+
Qi
|
|
2480
|
+
];
|
|
2481
|
+
if (t.push(Hi), this.state.viewModeEnabled) return [Li, ...t];
|
|
2482
|
+
let n = this.editorInterface.formFactor === "desktop" ? [
|
|
2483
|
+
Y,
|
|
2484
|
+
Ci,
|
|
2485
|
+
xi,
|
|
2486
|
+
wi,
|
|
2487
|
+
Si
|
|
2488
|
+
] : [];
|
|
2489
|
+
return [
|
|
2490
|
+
Y,
|
|
2491
|
+
Bi,
|
|
2492
|
+
Li,
|
|
2493
|
+
Vi,
|
|
2494
|
+
Y,
|
|
2495
|
+
na,
|
|
2496
|
+
ta,
|
|
2497
|
+
ra,
|
|
2498
|
+
Y,
|
|
2499
|
+
$i,
|
|
2500
|
+
Y,
|
|
2501
|
+
...t,
|
|
2502
|
+
Y,
|
|
2503
|
+
Ai,
|
|
2504
|
+
ji,
|
|
2505
|
+
Y,
|
|
2506
|
+
Mi,
|
|
2507
|
+
oa,
|
|
2508
|
+
qi,
|
|
2509
|
+
Ki,
|
|
2510
|
+
Ji,
|
|
2511
|
+
Ni,
|
|
2512
|
+
Y,
|
|
2513
|
+
Pi,
|
|
2514
|
+
...n,
|
|
2515
|
+
Y,
|
|
2516
|
+
Fi,
|
|
2517
|
+
Ii,
|
|
2518
|
+
Y,
|
|
2519
|
+
Zi,
|
|
2520
|
+
Y,
|
|
2521
|
+
ea,
|
|
2522
|
+
Y,
|
|
2523
|
+
Zr,
|
|
2524
|
+
Yi,
|
|
2525
|
+
Y,
|
|
2526
|
+
Yr
|
|
2527
|
+
];
|
|
2528
|
+
}, this.#wt = q((e) => {
|
|
2529
|
+
if (!(e.target instanceof HTMLCanvasElement || e.target instanceof HTMLTextAreaElement || e.target instanceof HTMLIFrameElement || e.target instanceof HTMLElement && e.target.classList.contains(l.FRAME_NAME))) {
|
|
2530
|
+
e[x.CTRL_OR_CMD] && e.preventDefault();
|
|
2531
|
+
return;
|
|
2532
|
+
}
|
|
2533
|
+
if (e.preventDefault(), uo) return;
|
|
2534
|
+
let { deltaX: t, deltaY: n } = e;
|
|
2535
|
+
if (e.metaKey || e.ctrlKey) {
|
|
2536
|
+
let e = Math.sign(n), t = ae * 100, r = Math.abs(n), i = n;
|
|
2537
|
+
r > t && (i = t * e);
|
|
2538
|
+
let a = this.state.zoom.value - i / 100;
|
|
2539
|
+
a += Math.log10(Math.max(1, this.state.zoom.value)) * -e * Math.min(1, r / 20), this.#ae((e) => ({
|
|
2540
|
+
...Ei({
|
|
2541
|
+
viewportX: this.lastViewportPosition.x,
|
|
2542
|
+
viewportY: this.lastViewportPosition.y,
|
|
2543
|
+
nextZoom: Kr(a)
|
|
2544
|
+
}, e),
|
|
2545
|
+
shouldCacheIgnoreZoom: !0
|
|
2546
|
+
})), this.#Dt();
|
|
2547
|
+
return;
|
|
2548
|
+
}
|
|
2549
|
+
if (e.shiftKey) {
|
|
2550
|
+
this.#ae(({ zoom: e, scrollX: r }) => ({ scrollX: r - (n || t) / e.value }));
|
|
2551
|
+
return;
|
|
2552
|
+
}
|
|
2553
|
+
this.#ae(({ zoom: e, scrollX: r, scrollY: i }) => ({
|
|
2554
|
+
scrollX: r - t / e.value,
|
|
2555
|
+
scrollY: i - n / e.value
|
|
2556
|
+
}));
|
|
2557
|
+
}), this.#Et = (e, t, n) => {
|
|
2558
|
+
if (!e || !t) return;
|
|
2559
|
+
let { x: r, y: i } = O({
|
|
2560
|
+
clientX: e,
|
|
2561
|
+
clientY: t
|
|
2562
|
+
}, this.state), a = {
|
|
2563
|
+
x: r,
|
|
2564
|
+
y: i,
|
|
2565
|
+
tool: this.state.activeTool.type === "laser" ? "laser" : "pointer"
|
|
2566
|
+
};
|
|
2567
|
+
this.props.onPointerUpdate?.({
|
|
2568
|
+
pointer: a,
|
|
2569
|
+
button: n,
|
|
2570
|
+
pointersMap: $.pointers
|
|
2571
|
+
});
|
|
2572
|
+
}, this.#Dt = je(() => {
|
|
2573
|
+
this.unmounted || this.setState({ shouldCacheIgnoreZoom: !1 });
|
|
2574
|
+
}, 300), this.#Ot = (e) => {
|
|
2575
|
+
if (this.rootElement) {
|
|
2576
|
+
let { width: t, height: n, left: r, top: i } = this.rootElement.getBoundingClientRect(), { width: a, height: o, offsetTop: s, offsetLeft: c } = this.state;
|
|
2577
|
+
if (t === a && n === o && r === c && i === s) {
|
|
2578
|
+
e && e();
|
|
2579
|
+
return;
|
|
2580
|
+
}
|
|
2581
|
+
this.setState({
|
|
2582
|
+
width: t,
|
|
2583
|
+
height: n,
|
|
2584
|
+
offsetLeft: r,
|
|
2585
|
+
offsetTop: i
|
|
2586
|
+
}, () => {
|
|
2587
|
+
e && e();
|
|
2588
|
+
});
|
|
2589
|
+
}
|
|
2590
|
+
}, this.refresh = () => {
|
|
2591
|
+
this.setState({ ...this.#kt() });
|
|
2592
|
+
}, this.watchState = () => {};
|
|
2593
|
+
let n = Dr(), { drawAPI: i, viewModeEnabled: d = !1, zenModeEnabled: p = !1, gridModeEnabled: m = !1, objectsSnapModeEnabled: oe = !1, theme: de = n.theme, name: Ce = `${H("labels.untitled")}-${Fe()}` } = t;
|
|
2594
|
+
if (this.state = {
|
|
2595
|
+
...n,
|
|
2596
|
+
theme: de,
|
|
2597
|
+
isLoading: !0,
|
|
2598
|
+
...this.#kt(),
|
|
2599
|
+
viewModeEnabled: d,
|
|
2600
|
+
zenModeEnabled: p,
|
|
2601
|
+
objectsSnapModeEnabled: oe,
|
|
2602
|
+
gridModeEnabled: m ?? n.gridModeEnabled,
|
|
2603
|
+
name: Ce,
|
|
2604
|
+
width: window.innerWidth,
|
|
2605
|
+
height: window.innerHeight
|
|
2606
|
+
}, this.refreshEditorInterface(), this.#e = le(this.editorInterface), this.id = Ze(), this.library = new ua(this), this.actionManager = new Er(this.syncActionResult, () => this.state, () => this.scene.getElementsIncludingDeleted(), this), this.scene = new Bn(), this.canvas = document.createElement("canvas"), this.rc = et.canvas(this.canvas), this.renderer = new va(this.scene), this.visibleElements = [], this.#r = new Un(this), this.fonts = new ei(this.scene), this.#i = new Ar(this.#r), i) {
|
|
2607
|
+
let e = {
|
|
2608
|
+
updateScene: this.updateScene,
|
|
2609
|
+
applyDeltas: this.applyDeltas,
|
|
2610
|
+
mutateElement: this.mutateElement,
|
|
2611
|
+
updateLibrary: this.library.updateLibrary,
|
|
2612
|
+
addFiles: this.addFiles,
|
|
2613
|
+
resetScene: this.#L,
|
|
2614
|
+
getSceneElementsIncludingDeleted: this.getSceneElementsIncludingDeleted,
|
|
2615
|
+
getSceneElementsMapIncludingDeleted: this.getSceneElementsMapIncludingDeleted,
|
|
2616
|
+
history: { clear: this.#F },
|
|
2617
|
+
scrollToContent: this.scrollToContent,
|
|
2618
|
+
getSceneElements: this.getSceneElements,
|
|
2619
|
+
getAppState: () => this.state,
|
|
2620
|
+
getFiles: () => this.files,
|
|
2621
|
+
getName: this.getName,
|
|
2622
|
+
registerAction: (e) => {
|
|
2623
|
+
this.actionManager.registerAction(e);
|
|
2624
|
+
},
|
|
2625
|
+
refresh: this.refresh,
|
|
2626
|
+
setToast: this.setToast,
|
|
2627
|
+
id: this.id,
|
|
2628
|
+
setActiveTool: this.setActiveTool,
|
|
2629
|
+
setCursor: this.#fe,
|
|
2630
|
+
resetCursor: this.#pe,
|
|
2631
|
+
getEditorInterface: () => this.editorInterface,
|
|
2632
|
+
updateFrameRendering: this.updateFrameRendering,
|
|
2633
|
+
toggleSidebar: this.toggleSidebar,
|
|
2634
|
+
onChange: (e) => this.onChangeEmitter.on(e),
|
|
2635
|
+
onIncrement: (e) => this.#r.onStoreIncrementEmitter.on(e),
|
|
2636
|
+
onPointerDown: (e) => this.onPointerDownEmitter.on(e),
|
|
2637
|
+
onPointerUp: (e) => this.onPointerUpEmitter.on(e),
|
|
2638
|
+
onScrollChange: (e) => this.onScrollChangeEmitter.on(e)
|
|
2639
|
+
};
|
|
2640
|
+
typeof i == "function" ? i(e) : console.error("drawAPI should be a function!");
|
|
2641
|
+
}
|
|
2642
|
+
this.drawContainerValue = {
|
|
2643
|
+
container: this.rootElement,
|
|
2644
|
+
id: this.id
|
|
2645
|
+
}, this.actionManager.registerAll(Jr), this.actionManager.registerAction(aa(this.#i)), this.actionManager.registerAction(ia(this.#i));
|
|
2646
|
+
}
|
|
2647
|
+
#d() {
|
|
2648
|
+
if (this.state.selectedLinearElement?.initialState && !this.state.selectedLinearElement.initialState.arrowStartIsInside) {
|
|
2649
|
+
E(this.lastPointerMoveCoords, "Missing last pointer move coords when changing bind skip mode for arrow start");
|
|
2650
|
+
let e = this.scene.getNonDeletedElementsMap(), t = R(S(this.lastPointerMoveCoords.x, this.lastPointerMoveCoords.y), this.scene.getNonDeletedElements(), e), n = z.getElement(this.state.selectedLinearElement.elementId, e);
|
|
2651
|
+
n?.startBinding && t?.id === n.startBinding.elementId && this.setState({ selectedLinearElement: {
|
|
2652
|
+
...this.state.selectedLinearElement,
|
|
2653
|
+
initialState: {
|
|
2654
|
+
...this.state.selectedLinearElement.initialState,
|
|
2655
|
+
arrowStartIsInside: !0
|
|
2656
|
+
}
|
|
2657
|
+
} });
|
|
2658
|
+
}
|
|
2659
|
+
if (this.state.bindMode === "orbit" && (this.bindModeHandler &&= (clearTimeout(this.bindModeHandler), null), Z(() => {
|
|
2660
|
+
this.setState({ bindMode: "skip" });
|
|
2661
|
+
}), this.lastPointerMoveCoords && this.state.selectedLinearElement?.selectedPointsIndices && this.state.selectedLinearElement?.selectedPointsIndices?.length)) {
|
|
2662
|
+
let { x: e, y: t } = this.lastPointerMoveCoords, n = this.lastPointerMoveEvent ?? this.lastPointerDownEvent?.nativeEvent;
|
|
2663
|
+
E(n, "Last event must exist");
|
|
2664
|
+
let r = e - this.state.selectedLinearElement.pointerOffset.x, i = t - this.state.selectedLinearElement.pointerOffset.y, a = this.state.multiElement ? z.handlePointerMove(n, this, r, i, this.state.selectedLinearElement) : z.handlePointDragging(n, this, r, i, this.state.selectedLinearElement);
|
|
2665
|
+
a && this.setState(a);
|
|
2666
|
+
}
|
|
2667
|
+
}
|
|
2668
|
+
#f() {
|
|
2669
|
+
this.bindModeHandler &&= (clearTimeout(this.bindModeHandler), null), this.state.bindMode !== "orbit" && setTimeout(() => this.setState({ bindMode: "orbit" }));
|
|
2670
|
+
}
|
|
2671
|
+
#p;
|
|
2672
|
+
#m(e, t) {
|
|
2673
|
+
if (e.isDeleted || A(e)) return;
|
|
2674
|
+
let n = () => {
|
|
2675
|
+
if (this.bindModeHandler = null, E(this.lastPointerMoveCoords, "Expected lastPointerMoveCoords to be set"), !this.state.multiElement) {
|
|
2676
|
+
if (!this.state.selectedLinearElement || !this.state.selectedLinearElement.selectedPointsIndices || !this.state.selectedLinearElement.selectedPointsIndices.length) return;
|
|
2677
|
+
let t = this.state.selectedLinearElement.selectedPointsIndices.includes(0), n = this.state.selectedLinearElement.selectedPointsIndices.includes(e.points.length - 1);
|
|
2678
|
+
if (!t && !n || t && n) return;
|
|
2679
|
+
}
|
|
2680
|
+
let { x: t, y: n } = this.lastPointerMoveCoords, r = R(S(t, n), this.scene.getNonDeletedElements(), this.scene.getNonDeletedElementsMap());
|
|
2681
|
+
if (r && this.state.bindMode !== "skip") {
|
|
2682
|
+
E(this.state.selectedLinearElement?.elementId === e.id, "The selectedLinearElement is expected to not change while a bind mode timeout is ticking");
|
|
2683
|
+
let i = this.state.selectedLinearElement.initialState.arrowStartIsInside || e.startBinding?.elementId === r.id;
|
|
2684
|
+
Z(() => {
|
|
2685
|
+
E(this.state.selectedLinearElement, "this.state.selectedLinearElement must exist"), this.setState({
|
|
2686
|
+
bindMode: "inside",
|
|
2687
|
+
selectedLinearElement: {
|
|
2688
|
+
...this.state.selectedLinearElement,
|
|
2689
|
+
initialState: {
|
|
2690
|
+
...this.state.selectedLinearElement.initialState,
|
|
2691
|
+
arrowStartIsInside: i
|
|
2692
|
+
}
|
|
2693
|
+
}
|
|
2694
|
+
});
|
|
2695
|
+
});
|
|
2696
|
+
let a = this.lastPointerMoveEvent ?? this.lastPointerDownEvent?.nativeEvent;
|
|
2697
|
+
E(a, "Last event must exist");
|
|
2698
|
+
let o = t - this.state.selectedLinearElement.pointerOffset.x, s = n - this.state.selectedLinearElement.pointerOffset.y, c = this.state.multiElement ? z.handlePointerMove(a, this, o, s, this.state.selectedLinearElement) : z.handlePointDragging(a, this, o, s, this.state.selectedLinearElement);
|
|
2699
|
+
c && this.setState(c);
|
|
2700
|
+
}
|
|
2701
|
+
}, r = !1;
|
|
2702
|
+
if (this.state.selectedLinearElement?.selectedPointsIndices) {
|
|
2703
|
+
let n = this.scene.getNonDeletedElementsMap(), i = this.state.selectedLinearElement.selectedPointsIndices.includes(0), a = this.state.selectedLinearElement.selectedPointsIndices.includes(e.points.length - 1), o = i ? t : e.startBinding && n.get(e.startBinding.elementId), s = a ? t : e.endBinding && n.get(e.endBinding.elementId), c = o && On(o, n), l = s && On(s, n);
|
|
2704
|
+
r = !!(c && l && o.id !== s.id && Tn(c, l));
|
|
2705
|
+
}
|
|
2706
|
+
let i = this.state.selectedLinearElement?.selectedPointsIndices?.includes?.(0), a = this.state.selectedLinearElement?.selectedPointsIndices?.includes?.(e.points.length - 1), o = i ? "startBinding" : a ? "endBinding" : null, s = i ? "endBinding" : a ? "startBinding" : null, c = s && e[s]?.mode === "inside" && e[s]?.elementId === t?.id || o && e[o]?.mode === "inside" && t?.id === e[o]?.elementId;
|
|
2707
|
+
o && s && e[o]?.mode === "inside" && t?.id !== e[o]?.elementId && e[s]?.elementId !== e[o]?.elementId && this.scene.mutateElement(e, { [o]: {
|
|
2708
|
+
...e[o],
|
|
2709
|
+
mode: "orbit"
|
|
2710
|
+
} }, {
|
|
2711
|
+
informMutation: !1,
|
|
2712
|
+
isDragging: !0
|
|
2713
|
+
}), !t || this.#p && t.id !== this.#p.id ? (this.bindModeHandler &&= (clearTimeout(this.bindModeHandler), null), this.state.bindMode === "inside" && Z(() => {
|
|
2714
|
+
this.setState({ bindMode: "orbit" });
|
|
2715
|
+
}), this.#p = null) : !this.bindModeHandler && (!this.state.newElement || !e.startBinding || r) && !c && (this.bindModeHandler = setTimeout(n, 700)), this.#p = t;
|
|
2716
|
+
}
|
|
2717
|
+
#h(e, t) {
|
|
2718
|
+
t && this.#a.set(e.id, t);
|
|
2719
|
+
}
|
|
2720
|
+
#g(e) {
|
|
2721
|
+
return this.#a.get(e.id);
|
|
2722
|
+
}
|
|
2723
|
+
#_(e) {
|
|
2724
|
+
this.state.activeEmbeddable?.element === e && this.state.activeEmbeddable?.state === "active" || (setTimeout(() => {
|
|
2725
|
+
this.setState({
|
|
2726
|
+
activeEmbeddable: {
|
|
2727
|
+
element: e,
|
|
2728
|
+
state: "active"
|
|
2729
|
+
},
|
|
2730
|
+
selectedElementIds: { [e.id]: !0 },
|
|
2731
|
+
newElement: null,
|
|
2732
|
+
selectionElement: null
|
|
2733
|
+
});
|
|
2734
|
+
}, 100), !dt(e) && this.#g(e)?.contentWindow);
|
|
2735
|
+
}
|
|
2736
|
+
#v(e, t, n, r) {
|
|
2737
|
+
return e && !t.altKey && !t.shiftKey && !t.metaKey && !t.ctrlKey && (this.state.activeEmbeddable?.element !== e || this.state.activeEmbeddable?.state === "hover" || !this.state.activeEmbeddable) && n >= e.x + e.width / 3 && n <= e.x + 2 * e.width / 3 && r >= e.y + e.height / 3 && r <= e.y + 2 * e.height / 3;
|
|
2738
|
+
}
|
|
2739
|
+
#y;
|
|
2740
|
+
#b;
|
|
2741
|
+
#x() {
|
|
2742
|
+
let e = this.state.zoom.value, t = this.state.width, n = this.state.height;
|
|
2743
|
+
return /* @__PURE__ */ X(Qa, { children: this.scene.getNonDeletedElements().filter((e) => lt(e) && this.#o.get(e.id) === !0 || dt(e)).map((r) => {
|
|
2744
|
+
let { x: i, y: a } = qe({
|
|
2745
|
+
sceneX: r.x,
|
|
2746
|
+
sceneY: r.y
|
|
2747
|
+
}, this.state), o = Mn(r, t, n, this.state, this.scene.getNonDeletedElementsMap()), s = this.#s.has(r.id);
|
|
2748
|
+
if (o && !s && this.#s.add(r.id), !(o || s)) return null;
|
|
2749
|
+
let c;
|
|
2750
|
+
if (dt(r)) {
|
|
2751
|
+
c = null;
|
|
2752
|
+
let e = (r.customData?.generationData ?? this.#D.get(r.id)) || {
|
|
2753
|
+
status: "error",
|
|
2754
|
+
message: "No generation data",
|
|
2755
|
+
code: "ERR_NO_GENERATION_DATA"
|
|
2756
|
+
};
|
|
2757
|
+
if (e.status === "done") {
|
|
2758
|
+
let t = e.html;
|
|
2759
|
+
c = {
|
|
2760
|
+
intrinsicSize: {
|
|
2761
|
+
w: r.width,
|
|
2762
|
+
h: r.height
|
|
2763
|
+
},
|
|
2764
|
+
type: "document",
|
|
2765
|
+
srcdoc: () => t
|
|
2766
|
+
};
|
|
2767
|
+
} else if (e.status === "pending") c = {
|
|
2768
|
+
intrinsicSize: {
|
|
2769
|
+
w: r.width,
|
|
2770
|
+
h: r.height
|
|
2771
|
+
},
|
|
2772
|
+
type: "document",
|
|
2773
|
+
srcdoc: () => cr(`
|
|
2774
|
+
<style>
|
|
2775
|
+
html, body {
|
|
2776
|
+
width: 100%;
|
|
2777
|
+
height: 100%;
|
|
2778
|
+
color: ${this.#w ? "white" : "black"};
|
|
2779
|
+
}
|
|
2780
|
+
body {
|
|
2781
|
+
display: flex;
|
|
2782
|
+
align-items: center;
|
|
2783
|
+
justify-content: center;
|
|
2784
|
+
flex-direction: column;
|
|
2785
|
+
gap: 1rem;
|
|
2786
|
+
}
|
|
2787
|
+
|
|
2788
|
+
.Spinner {
|
|
2789
|
+
display: flex;
|
|
2790
|
+
align-items: center;
|
|
2791
|
+
justify-content: center;
|
|
2792
|
+
margin-left: auto;
|
|
2793
|
+
margin-right: auto;
|
|
2794
|
+
}
|
|
2795
|
+
|
|
2796
|
+
.Spinner svg {
|
|
2797
|
+
animation: rotate 1.6s linear infinite;
|
|
2798
|
+
transform-origin: center center;
|
|
2799
|
+
width: 40px;
|
|
2800
|
+
height: 40px;
|
|
2801
|
+
}
|
|
2802
|
+
|
|
2803
|
+
.Spinner circle {
|
|
2804
|
+
stroke: currentColor;
|
|
2805
|
+
animation: dash 1.6s linear 0s infinite;
|
|
2806
|
+
stroke-linecap: round;
|
|
2807
|
+
}
|
|
2808
|
+
|
|
2809
|
+
@keyframes rotate {
|
|
2810
|
+
100% {
|
|
2811
|
+
transform: rotate(360deg);
|
|
2812
|
+
}
|
|
2813
|
+
}
|
|
2814
|
+
|
|
2815
|
+
@keyframes dash {
|
|
2816
|
+
0% {
|
|
2817
|
+
stroke-dasharray: 1, 300;
|
|
2818
|
+
stroke-dashoffset: 0;
|
|
2819
|
+
}
|
|
2820
|
+
50% {
|
|
2821
|
+
stroke-dasharray: 150, 300;
|
|
2822
|
+
stroke-dashoffset: -200;
|
|
2823
|
+
}
|
|
2824
|
+
100% {
|
|
2825
|
+
stroke-dasharray: 1, 300;
|
|
2826
|
+
stroke-dashoffset: -280;
|
|
2827
|
+
}
|
|
2828
|
+
}
|
|
2829
|
+
</style>
|
|
2830
|
+
<div class="Spinner">
|
|
2831
|
+
<svg
|
|
2832
|
+
viewBox="0 0 100 100"
|
|
2833
|
+
>
|
|
2834
|
+
<circle
|
|
2835
|
+
cx="50"
|
|
2836
|
+
cy="50"
|
|
2837
|
+
r="46"
|
|
2838
|
+
stroke-width="8"
|
|
2839
|
+
fill="none"
|
|
2840
|
+
stroke-miter-limit="10"
|
|
2841
|
+
/>
|
|
2842
|
+
</svg>
|
|
2843
|
+
</div>
|
|
2844
|
+
<div>Generating...</div>
|
|
2845
|
+
`)
|
|
2846
|
+
};
|
|
2847
|
+
else {
|
|
2848
|
+
let t;
|
|
2849
|
+
t = e.code === "ERR_GENERATION_INTERRUPTED" ? "Generation was interrupted..." : e.message || "Generation failed", c = {
|
|
2850
|
+
intrinsicSize: {
|
|
2851
|
+
w: r.width,
|
|
2852
|
+
h: r.height
|
|
2853
|
+
},
|
|
2854
|
+
type: "document",
|
|
2855
|
+
srcdoc: () => cr(`
|
|
2856
|
+
<style>
|
|
2857
|
+
html, body {
|
|
2858
|
+
height: 100%;
|
|
2859
|
+
}
|
|
2860
|
+
body {
|
|
2861
|
+
display: flex;
|
|
2862
|
+
flex-direction: column;
|
|
2863
|
+
align-items: center;
|
|
2864
|
+
justify-content: center;
|
|
2865
|
+
color: ${no.red.value};
|
|
2866
|
+
}
|
|
2867
|
+
h1, h3 {
|
|
2868
|
+
margin-top: 0;
|
|
2869
|
+
margin-bottom: 0.5rem;
|
|
2870
|
+
}
|
|
2871
|
+
</style>
|
|
2872
|
+
<h1>Error!</h1>
|
|
2873
|
+
<h3>${t}</h3>
|
|
2874
|
+
`)
|
|
2875
|
+
};
|
|
2876
|
+
}
|
|
2877
|
+
}
|
|
2878
|
+
let l = this.state.activeEmbeddable?.element === r && this.state.activeEmbeddable?.state === "active", u = this.state.activeEmbeddable?.element === r && this.state.activeEmbeddable?.state === "hover";
|
|
2879
|
+
return /* @__PURE__ */ X("div", {
|
|
2880
|
+
className: ro("draw__embeddable-container", { "is-hovered": u }),
|
|
2881
|
+
style: {
|
|
2882
|
+
transform: o ? `translate(${i - this.state.offsetLeft}px, ${a - this.state.offsetTop}px) scale(${e})` : "none",
|
|
2883
|
+
display: o ? "block" : "none",
|
|
2884
|
+
opacity: on(r, Jt(r, this.scene.getNonDeletedElementsMap()), this.#l, null, this.state.openDialog?.name === "elementLinkSelector" ? p : 1),
|
|
2885
|
+
"--embeddable-radius": `${cn(Math.min(r.width, r.height), r)}px`
|
|
2886
|
+
},
|
|
2887
|
+
children: /* @__PURE__ */ $a("div", {
|
|
2888
|
+
className: "draw__embeddable-container__inner",
|
|
2889
|
+
style: {
|
|
2890
|
+
width: o ? `${r.width}px` : 0,
|
|
2891
|
+
height: o ? `${r.height}px` : 0,
|
|
2892
|
+
transform: o ? `rotate(${r.angle}rad)` : "none",
|
|
2893
|
+
pointerEvents: l ? te.enabled : te.disabled
|
|
2894
|
+
},
|
|
2895
|
+
children: [u && /* @__PURE__ */ X("div", {
|
|
2896
|
+
className: "draw__embeddable-hint",
|
|
2897
|
+
children: H("buttons.embeddableInteractionButton")
|
|
2898
|
+
}), /* @__PURE__ */ X("div", {
|
|
2899
|
+
className: "draw__embeddable__outer",
|
|
2900
|
+
style: { padding: `${r.strokeWidth}px` },
|
|
2901
|
+
children: (lt(r) ? this.props.renderEmbeddable?.(r, this.state) : null) ?? /* @__PURE__ */ X("iframe", {
|
|
2902
|
+
ref: (e) => this.#h(r, e),
|
|
2903
|
+
className: "draw__embeddable",
|
|
2904
|
+
srcDoc: c?.type === "document" ? c.srcdoc(this.state.theme) : void 0,
|
|
2905
|
+
src: c?.type === "document" ? void 0 : c?.link ?? "",
|
|
2906
|
+
scrolling: "no",
|
|
2907
|
+
referrerPolicy: "no-referrer-when-downgrade",
|
|
2908
|
+
title: "Draw Embedded Content",
|
|
2909
|
+
allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
|
|
2910
|
+
allowFullScreen: !0,
|
|
2911
|
+
sandbox: `${c?.sandbox?.allowSameOrigin ? "allow-same-origin" : ""} allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-presentation allow-downloads`
|
|
2912
|
+
})
|
|
2913
|
+
})]
|
|
2914
|
+
})
|
|
2915
|
+
}, r.id);
|
|
2916
|
+
}) });
|
|
2917
|
+
}
|
|
2918
|
+
#S;
|
|
2919
|
+
#C;
|
|
2920
|
+
get #w() {
|
|
2921
|
+
return this.state.theme === re.DARK;
|
|
2922
|
+
}
|
|
2923
|
+
#T;
|
|
2924
|
+
#E(e) {
|
|
2925
|
+
document.documentElement.style.overscrollBehaviorX = e.type === "pointerenter" ? "none" : "auto";
|
|
2926
|
+
}
|
|
2927
|
+
#D;
|
|
2928
|
+
#O;
|
|
2929
|
+
setPlugins(e) {
|
|
2930
|
+
Object.assign(this.plugins, e);
|
|
2931
|
+
}
|
|
2932
|
+
async #k(e, t) {
|
|
2933
|
+
let n = this.plugins.diagramToCode?.generate;
|
|
2934
|
+
if (!n) {
|
|
2935
|
+
this.setState({ errorMessage: "No diagram to code plugin found" });
|
|
2936
|
+
return;
|
|
2937
|
+
}
|
|
2938
|
+
let r = Zt(this.scene.getNonDeletedElements(), e).filter((e) => !gt(e));
|
|
2939
|
+
if (!r.length) {
|
|
2940
|
+
t === "button" ? (this.setState({ errorMessage: "Cannot generate from an empty frame" }), V("ai", "generate (no-children)", "d2c")) : this.setActiveTool({ type: "magicframe" });
|
|
2941
|
+
return;
|
|
2942
|
+
}
|
|
2943
|
+
let i = this.insertIframeElement({
|
|
2944
|
+
sceneX: e.x + e.width + 30,
|
|
2945
|
+
sceneY: e.y,
|
|
2946
|
+
width: e.width,
|
|
2947
|
+
height: e.height
|
|
2948
|
+
});
|
|
2949
|
+
if (i) {
|
|
2950
|
+
this.#O({
|
|
2951
|
+
frameElement: i,
|
|
2952
|
+
data: { status: "pending" }
|
|
2953
|
+
}), this.setState({ selectedElementIds: { [i.id]: !0 } }), V("ai", "generate (start)", "d2c");
|
|
2954
|
+
try {
|
|
2955
|
+
let { html: t } = await n({
|
|
2956
|
+
frame: e,
|
|
2957
|
+
children: r
|
|
2958
|
+
});
|
|
2959
|
+
if (V("ai", "generate (success)", "d2c"), !t.trim()) {
|
|
2960
|
+
this.#O({
|
|
2961
|
+
frameElement: i,
|
|
2962
|
+
data: {
|
|
2963
|
+
status: "error",
|
|
2964
|
+
code: "ERR_OAI",
|
|
2965
|
+
message: "Nothing genereated :("
|
|
2966
|
+
}
|
|
2967
|
+
});
|
|
2968
|
+
return;
|
|
2969
|
+
}
|
|
2970
|
+
let a = t.includes("<!DOCTYPE html>") && t.includes("</html>") ? t.slice(t.indexOf("<!DOCTYPE html>"), t.indexOf("</html>") + 7) : t;
|
|
2971
|
+
this.#O({
|
|
2972
|
+
frameElement: i,
|
|
2973
|
+
data: {
|
|
2974
|
+
status: "done",
|
|
2975
|
+
html: a
|
|
2976
|
+
}
|
|
2977
|
+
});
|
|
2978
|
+
} catch (e) {
|
|
2979
|
+
V("ai", "generate (failed)", "d2c"), this.#O({
|
|
2980
|
+
frameElement: i,
|
|
2981
|
+
data: {
|
|
2982
|
+
status: "error",
|
|
2983
|
+
code: "ERR_OAI",
|
|
2984
|
+
message: e.message || "Unknown error during generation"
|
|
2985
|
+
}
|
|
2986
|
+
});
|
|
2987
|
+
}
|
|
2988
|
+
}
|
|
2989
|
+
}
|
|
2990
|
+
#A(e) {
|
|
2991
|
+
e.customData?.generationData?.status === "done" && (gi(e.customData.generationData.html), this.setToast({
|
|
2992
|
+
message: "copied to clipboard",
|
|
2993
|
+
closable: !1,
|
|
2994
|
+
duration: 1500
|
|
2995
|
+
}));
|
|
2996
|
+
}
|
|
2997
|
+
#j;
|
|
2998
|
+
#M;
|
|
2999
|
+
#N;
|
|
3000
|
+
#P;
|
|
3001
|
+
#F;
|
|
3002
|
+
#I;
|
|
3003
|
+
#L;
|
|
3004
|
+
#R;
|
|
3005
|
+
#z;
|
|
3006
|
+
#B;
|
|
3007
|
+
#V;
|
|
3008
|
+
#H(e) {
|
|
3009
|
+
let t = e ?? this.files;
|
|
3010
|
+
this.scene.getNonDeletedElements().forEach((e) => {
|
|
3011
|
+
pt(e) && t[e.fileId] && (this.imageCache.delete(e.fileId), sn.delete(e));
|
|
3012
|
+
});
|
|
3013
|
+
}
|
|
3014
|
+
async componentDidMount() {
|
|
3015
|
+
this.unmounted = !1, this.drawContainerValue.container = this.rootElement, (He() || Re()) && (this.setState.bind(this), Object.defineProperties(window.h, {
|
|
3016
|
+
state: {
|
|
3017
|
+
configurable: !0,
|
|
3018
|
+
get: () => this.state
|
|
3019
|
+
},
|
|
3020
|
+
setState: {
|
|
3021
|
+
configurable: !0,
|
|
3022
|
+
value: (...e) => this.setState(...e)
|
|
3023
|
+
},
|
|
3024
|
+
app: {
|
|
3025
|
+
configurable: !0,
|
|
3026
|
+
value: this
|
|
3027
|
+
},
|
|
3028
|
+
history: {
|
|
3029
|
+
configurable: !0,
|
|
3030
|
+
value: this.#i
|
|
3031
|
+
},
|
|
3032
|
+
store: {
|
|
3033
|
+
configurable: !0,
|
|
3034
|
+
value: this.#r
|
|
3035
|
+
},
|
|
3036
|
+
fonts: {
|
|
3037
|
+
configurable: !0,
|
|
3038
|
+
value: this.fonts
|
|
3039
|
+
}
|
|
3040
|
+
})), this.#r.onDurableIncrementEmitter.on((e) => {
|
|
3041
|
+
this.#i.record(e.delta);
|
|
3042
|
+
});
|
|
3043
|
+
let { onIncrement: e } = this.props;
|
|
3044
|
+
e && this.#r.onStoreIncrementEmitter.on((t) => {
|
|
3045
|
+
e(t);
|
|
3046
|
+
}), this.scene.onUpdate(this.#se), this.#q(), this.props.autoFocus && this.rootElement && this.focusContainer(), oe && this.rootElement && (this.#n = new ResizeObserver(() => {
|
|
3047
|
+
this.refreshEditorInterface(), this.#Ot();
|
|
3048
|
+
}), this.#n?.observe?.(this.rootElement)), new URLSearchParams(window.location.search.slice(1)).has("web-share-target") ? this.restoreFileFromShare() : this.#Ot(this.#R), de() && !kt() && this.setState({ errorMessage: /* @__PURE__ */ X(ja, {}) }), n.on(t.DARK_THEME, this.#U);
|
|
3049
|
+
}
|
|
3050
|
+
#U;
|
|
3051
|
+
componentWillUnmount() {
|
|
3052
|
+
window.launchQueue?.setConsumer?.(() => {}), this.renderer.destroy(), this.scene.destroy(), this.scene = new Bn(), this.fonts = new ei(this.scene), this.renderer = new va(this.scene), this.files = {}, this.imageCache.clear(), this.#n?.disconnect?.(), this.unmounted = !0, this.#K(), this.library.destroy(), this.laserTrails.stop(), this.eraserTrail.stop(), this.onChangeEmitter.clear(), this.#r.onStoreIncrementEmitter.clear(), this.#r.onDurableIncrementEmitter.clear(), sn.destroy(), J.destroy(), clearTimeout(Q), wt.clearCache(), I.clearCache(), Q = 0, document.documentElement.style.overscrollBehaviorX = "", n.off(t.DARK_THEME, this.#U);
|
|
3053
|
+
}
|
|
3054
|
+
#W;
|
|
3055
|
+
#G;
|
|
3056
|
+
#K() {
|
|
3057
|
+
this.onRemoveEventListenersEmitter.trigger();
|
|
3058
|
+
}
|
|
3059
|
+
#q() {
|
|
3060
|
+
this.#K(), this.props.handleKeyboardGlobally && this.onRemoveEventListenersEmitter.once(w(document, h.KEYDOWN, this.#le, !1)), this.onRemoveEventListenersEmitter.once(w(this.rootElement, h.WHEEL, this.#wt, { passive: !1 }), w(document, h.POINTER_UP, this.removePointer, { passive: !1 }), w(document, h.COPY, this.#Z, { passive: !1 }), w(document, h.KEYUP, this.#ue, { passive: !0 }), w(document, h.POINTER_MOVE, this.#ce, { passive: !1 }), w(document.fonts, "loadingdone", (e) => {
|
|
3061
|
+
let t = e.fontfaces;
|
|
3062
|
+
this.fonts.onLoaded(t);
|
|
3063
|
+
}, { passive: !1 }), w(document, h.GESTURE_START, this.#he, !1), w(document, h.GESTURE_CHANGE, this.#ge, !1), w(document, h.GESTURE_END, this.#_e, !1), w(window, h.FOCUS, () => {
|
|
3064
|
+
this.#Le(null), this.#se(!0);
|
|
3065
|
+
}, { passive: !1 })), !this.state.viewModeEnabled && (this.onRemoveEventListenersEmitter.once(w(document, h.FULLSCREENCHANGE, this.#G, { passive: !1 }), w(document, h.PASTE, this.pasteFromClipboard, { passive: !1 }), w(document, h.CUT, this.#X, { passive: !1 }), w(window, h.RESIZE, this.#W, !1), w(window, h.UNLOAD, this.#N, !1), w(window, h.BLUR, this.#M, !1), w(this.rootElement, h.WHEEL, this.#wt, { passive: !1 }), w(this.rootElement, h.DRAG_OVER, this.#P, !1), w(this.rootElement, h.DROP, this.#P, !1)), this.props.detectScroll && this.onRemoveEventListenersEmitter.once(w(Le(this.rootElement), h.SCROLL, this.#Y, { passive: !1 })));
|
|
3066
|
+
}
|
|
3067
|
+
componentDidUpdate(e, r) {
|
|
3068
|
+
this.#b();
|
|
3069
|
+
let i = this.scene.getElementsIncludingDeleted(), a = this.scene.getElementsMapIncludingDeleted();
|
|
3070
|
+
!this.state.showWelcomeScreen && !i.length && this.setState({ showWelcomeScreen: !0 }), (r.zoom.value !== this.state.zoom.value || r.scrollX !== this.state.scrollX || r.scrollY !== this.state.scrollY) && (this.props?.onScrollChange?.(this.state.scrollX, this.state.scrollY, this.state.zoom), this.onScrollChangeEmitter.trigger(this.state.scrollX, this.state.scrollY, this.state.zoom)), Object.keys(this.state.selectedElementIds).length && Or(this.state) && this.setState({ activeTool: D(this.state, { type: "selection" }) }), this.state.activeTool.type === "eraser" && r.theme !== this.state.theme && Ti(this.interactiveCanvas, this.state.theme), e.langCode !== this.props.langCode && this.#At(), Or(r) && !Or(this.state) && this.eraserTrail.endPath(), e.viewModeEnabled !== this.props.viewModeEnabled && this.setState({ viewModeEnabled: !!this.props.viewModeEnabled }), r.viewModeEnabled !== this.state.viewModeEnabled && (this.#q(), this.#ye()), (r.openDialog?.name === "elementLinkSelector" || this.state.openDialog?.name === "elementLinkSelector") && r.openDialog?.name !== this.state.openDialog?.name && (this.#ye(), this.setState({ hoveredElementIds: {} })), e.zenModeEnabled !== this.props.zenModeEnabled && this.setState({ zenModeEnabled: !!this.props.zenModeEnabled }), e.theme !== this.props.theme && this.props.theme && this.setState({ theme: this.props.theme }), this.rootElement?.classList?.toggle?.("theme--dark", this.#w), r.theme === this.state.theme || (this.#w ? n.emit(t.DARK_THEME, {
|
|
3071
|
+
key: "draw",
|
|
3072
|
+
value: !0
|
|
3073
|
+
}) : n.emit(t.DARK_THEME, {
|
|
3074
|
+
key: "draw",
|
|
3075
|
+
value: !1
|
|
3076
|
+
})), this.state.selectedLinearElement?.isEditing && !this.state.selectedElementIds[this.state.selectedLinearElement.elementId] && setTimeout(() => {
|
|
3077
|
+
this.state.selectedLinearElement?.isEditing && this.actionManager.executeAction(K);
|
|
3078
|
+
}), this.state.editingTextElement?.isDeleted && this.setState({ editingTextElement: null }), this.#r.commit(a, this.state), this.state.isLoading || (this.props.onChange?.(i, this.state, this.files), this.onChangeEmitter.trigger(i, this.state, this.files));
|
|
3079
|
+
}
|
|
3080
|
+
#J;
|
|
3081
|
+
#Y;
|
|
3082
|
+
#X;
|
|
3083
|
+
#Z;
|
|
3084
|
+
static #Q() {
|
|
3085
|
+
oo = !1, co = null;
|
|
3086
|
+
}
|
|
3087
|
+
#$;
|
|
3088
|
+
#ee;
|
|
3089
|
+
async #te(e, t, n) {
|
|
3090
|
+
let { x: r, y: i } = O({
|
|
3091
|
+
clientX: this.lastViewportPosition.x,
|
|
3092
|
+
clientY: this.lastViewportPosition.y
|
|
3093
|
+
}, this.state);
|
|
3094
|
+
if (e.errorMessage) {
|
|
3095
|
+
this.setState({ errorMessage: e.errorMessage });
|
|
3096
|
+
return;
|
|
3097
|
+
}
|
|
3098
|
+
if (t.length === 0 && !n && e.mixedContent) {
|
|
3099
|
+
await this.#ne(e.mixedContent, {
|
|
3100
|
+
isPlainPaste: n,
|
|
3101
|
+
sceneX: r,
|
|
3102
|
+
sceneY: i
|
|
3103
|
+
});
|
|
3104
|
+
return;
|
|
3105
|
+
}
|
|
3106
|
+
if (e.spreadsheet && !n) {
|
|
3107
|
+
this.setState({ pasteDialog: {
|
|
3108
|
+
data: e.spreadsheet,
|
|
3109
|
+
shown: !0
|
|
3110
|
+
} });
|
|
3111
|
+
return;
|
|
3112
|
+
}
|
|
3113
|
+
let a = t.map((e) => e.file);
|
|
3114
|
+
if (a.length === 0 && e.text && !n) {
|
|
3115
|
+
let t = e.text.trim();
|
|
3116
|
+
t.startsWith("<svg") && t.endsWith("</svg>") && a.push(ii(t));
|
|
3117
|
+
}
|
|
3118
|
+
if (a.length > 0) {
|
|
3119
|
+
this.#de("image") ? await this.#_t(a, r, i) : this.setState({ errorMessage: H("errors.imageToolNotSupported") });
|
|
3120
|
+
return;
|
|
3121
|
+
}
|
|
3122
|
+
if (e.elements) {
|
|
3123
|
+
let t = e.programmaticAPI ? Tr(e.elements) : e.elements;
|
|
3124
|
+
this.addElementsFromPasteOrLibrary({
|
|
3125
|
+
elements: t,
|
|
3126
|
+
files: e.files || null,
|
|
3127
|
+
position: this.editorInterface.formFactor === "desktop" ? "cursor" : "center",
|
|
3128
|
+
retainSeed: n
|
|
3129
|
+
});
|
|
3130
|
+
return;
|
|
3131
|
+
}
|
|
3132
|
+
if (!e.text) return;
|
|
3133
|
+
let o = Ke(e.text).split(/\n+/).map((e) => e.trim()).filter(Boolean), s = o.map((e) => ur(e)).filter((e) => lr(e, this.props.validateEmbeddable) && /^(http|https):\/\/[^\s/$.?#].[^\s]*$/.test(e));
|
|
3134
|
+
if (!n && s.length > 0 && s.length === o.length) {
|
|
3135
|
+
let e = [];
|
|
3136
|
+
for (let t of s) {
|
|
3137
|
+
let n = e[e.length - 1], a = this.insertEmbeddableElement({
|
|
3138
|
+
sceneX: n ? n.x + n.width + 20 : r,
|
|
3139
|
+
sceneY: i,
|
|
3140
|
+
link: $e(t)
|
|
3141
|
+
});
|
|
3142
|
+
a && e.push(a);
|
|
3143
|
+
}
|
|
3144
|
+
e.length && (this.#r.scheduleCapture(), this.setState({ selectedElementIds: Object.fromEntries(e.map((e) => [e.id, !0])) }));
|
|
3145
|
+
return;
|
|
3146
|
+
}
|
|
3147
|
+
this.#re(e.text, n);
|
|
3148
|
+
}
|
|
3149
|
+
async #ne(e, { isPlainPaste: t, sceneX: n, sceneY: r }) {
|
|
3150
|
+
if (!t && e.some((e) => e.type === "imageUrl") && this.#de("image")) {
|
|
3151
|
+
let t = e.filter((e) => e.type === "imageUrl").map((e) => e.value), i = await Promise.all(t.map(async (e) => {
|
|
3152
|
+
try {
|
|
3153
|
+
return { file: await ri(e) };
|
|
3154
|
+
} catch (e) {
|
|
3155
|
+
let t = e.message;
|
|
3156
|
+
return e.cause === "FETCH_ERROR" ? t = H("errors.failedToFetchImage") : e.cause === "UNSUPPORTED" && (t = H("errors.unsupportedFileType")), { errorMessage: t };
|
|
3157
|
+
}
|
|
3158
|
+
})), a = i.filter((e) => !!e.file).map((e) => e.file);
|
|
3159
|
+
await this.#_t(a, n, r);
|
|
3160
|
+
let o = i.find((e) => !!e.errorMessage);
|
|
3161
|
+
o && o.errorMessage && this.setState({ errorMessage: o.errorMessage });
|
|
3162
|
+
} else {
|
|
3163
|
+
let n = e.filter((e) => e.type === "text");
|
|
3164
|
+
n.length && this.#re(n.map((e) => e.value).join("\n\n"), t);
|
|
3165
|
+
}
|
|
3166
|
+
}
|
|
3167
|
+
#re(e, t = !1) {
|
|
3168
|
+
let { x: n, y: r } = O({
|
|
3169
|
+
clientX: this.lastViewportPosition.x,
|
|
3170
|
+
clientY: this.lastViewportPosition.y
|
|
3171
|
+
}, this.state), i = {
|
|
3172
|
+
x: n,
|
|
3173
|
+
y: r,
|
|
3174
|
+
strokeColor: this.state.currentItemStrokeColor,
|
|
3175
|
+
backgroundColor: this.state.currentItemBackgroundColor,
|
|
3176
|
+
fillStyle: this.state.currentItemFillStyle,
|
|
3177
|
+
strokeWidth: this.state.currentItemStrokeWidth,
|
|
3178
|
+
strokeStyle: this.state.currentItemStrokeStyle,
|
|
3179
|
+
roundness: null,
|
|
3180
|
+
roughness: this.state.currentItemRoughness,
|
|
3181
|
+
opacity: this.state.currentItemOpacity,
|
|
3182
|
+
text: e,
|
|
3183
|
+
fontSize: this.state.currentItemFontSize,
|
|
3184
|
+
fontFamily: this.state.currentItemFontFamily,
|
|
3185
|
+
textAlign: m,
|
|
3186
|
+
verticalAlign: "top",
|
|
3187
|
+
locked: !1
|
|
3188
|
+
}, a = Ie({
|
|
3189
|
+
fontSize: i.fontSize,
|
|
3190
|
+
fontFamily: i.fontFamily
|
|
3191
|
+
}), o = _e(i.fontFamily), [s, , c] = kn(this.state), l = Math.max(Math.min((c - s) * .5, 800), 200), u = r, d = t ? [e] : e.split("\n"), f = d.reduce((e, t, r) => {
|
|
3192
|
+
let s = jt(t).trim();
|
|
3193
|
+
if (s.length) {
|
|
3194
|
+
let t = this.#ke({
|
|
3195
|
+
x: n,
|
|
3196
|
+
y: u
|
|
3197
|
+
}), r = At(s, a, o), c = r.width > l, d = c ? Mt(s, a, l) : s;
|
|
3198
|
+
r = c ? At(d, a, o) : r;
|
|
3199
|
+
let f = n - r.width / 2, p = u - r.height / 2, m = or({
|
|
3200
|
+
...i,
|
|
3201
|
+
x: f,
|
|
3202
|
+
y: p,
|
|
3203
|
+
text: d,
|
|
3204
|
+
originalText: s,
|
|
3205
|
+
lineHeight: o,
|
|
3206
|
+
autoResize: !c,
|
|
3207
|
+
frameId: t ? t.id : null
|
|
3208
|
+
});
|
|
3209
|
+
e.push(m), u += m.height + 10;
|
|
3210
|
+
} else d[r - 1]?.trim?.() && (u += Dt(i.fontSize, o) + 10);
|
|
3211
|
+
return e;
|
|
3212
|
+
}, []);
|
|
3213
|
+
f.length !== 0 && (this.scene.insertElements(f), this.#r.scheduleCapture(), this.setState({ selectedElementIds: F(Object.fromEntries(f.map((e) => [e.id, !0])), this.state) }), !t && f.length > 1 && _o === !1 && this.editorInterface.formFactor !== "phone" && (this.setToast({
|
|
3214
|
+
message: H("toast.pasteAsSingleElement", { shortcut: Xr("CtrlOrCmd+Shift+V") }),
|
|
3215
|
+
duration: 5e3
|
|
3216
|
+
}), _o = !0));
|
|
3217
|
+
}
|
|
3218
|
+
#ie;
|
|
3219
|
+
#ae;
|
|
3220
|
+
#oe;
|
|
3221
|
+
#se;
|
|
3222
|
+
#ce;
|
|
3223
|
+
#le;
|
|
3224
|
+
#ue;
|
|
3225
|
+
#de;
|
|
3226
|
+
#fe;
|
|
3227
|
+
#pe;
|
|
3228
|
+
#me;
|
|
3229
|
+
#he;
|
|
3230
|
+
#ge;
|
|
3231
|
+
#_e;
|
|
3232
|
+
#ve(e, { isExistingElement: t = !1 }) {
|
|
3233
|
+
let n = this.scene.getElementsMapIncludingDeleted(), r = (t, r) => {
|
|
3234
|
+
this.scene.replaceAllElements([...this.scene.getElementsIncludingDeleted().map((i) => i.id === e.id && P(i) ? L(i, {
|
|
3235
|
+
originalText: t,
|
|
3236
|
+
isDeleted: r ?? i.isDeleted,
|
|
3237
|
+
...sr(i, Ft(i, n), n, t)
|
|
3238
|
+
}) : i)]);
|
|
3239
|
+
};
|
|
3240
|
+
ka({
|
|
3241
|
+
id: e.id,
|
|
3242
|
+
canvas: this.canvas,
|
|
3243
|
+
getViewportCoords: (e, t) => {
|
|
3244
|
+
let { x: n, y: r } = qe({
|
|
3245
|
+
sceneX: e,
|
|
3246
|
+
sceneY: t
|
|
3247
|
+
}, this.state);
|
|
3248
|
+
return [n - this.state.offsetLeft, r - this.state.offsetTop];
|
|
3249
|
+
},
|
|
3250
|
+
onChange: q((t) => {
|
|
3251
|
+
r(t, !1), zn(e) && Sn(e, this.scene);
|
|
3252
|
+
}),
|
|
3253
|
+
onSubmit: q(({ viaKeyboard: n, nextOriginalText: i }) => {
|
|
3254
|
+
let a = !i.trim();
|
|
3255
|
+
if (r(i, a), !a && n) {
|
|
3256
|
+
let t = e.containerId ? e.containerId : e.id;
|
|
3257
|
+
Z(() => {
|
|
3258
|
+
this.setState((e) => ({ selectedElementIds: F({
|
|
3259
|
+
...e.selectedElementIds,
|
|
3260
|
+
[t]: !0
|
|
3261
|
+
}, e) }));
|
|
3262
|
+
});
|
|
3263
|
+
}
|
|
3264
|
+
a && vn(this.scene.getNonDeletedElements(), [e]), (!a || t) && this.#r.scheduleCapture(), Z(() => {
|
|
3265
|
+
this.setState({
|
|
3266
|
+
newElement: null,
|
|
3267
|
+
editingTextElement: null
|
|
3268
|
+
});
|
|
3269
|
+
}), this.state.activeTool.locked && G(this.interactiveCanvas, this.state), this.focusContainer();
|
|
3270
|
+
}),
|
|
3271
|
+
element: e,
|
|
3272
|
+
drawContainer: this.rootElement,
|
|
3273
|
+
app: this,
|
|
3274
|
+
autoSelect: !this.editorInterface.isTouchScreen
|
|
3275
|
+
}), this.#ye(), r(e.originalText, !1);
|
|
3276
|
+
}
|
|
3277
|
+
#ye() {
|
|
3278
|
+
this.setState({
|
|
3279
|
+
selectedElementIds: F({}, this.state),
|
|
3280
|
+
selectedGroupIds: {},
|
|
3281
|
+
editingGroupId: null,
|
|
3282
|
+
activeEmbeddable: null
|
|
3283
|
+
});
|
|
3284
|
+
}
|
|
3285
|
+
#be(e, t) {
|
|
3286
|
+
let n = this.#xe(e, t, { includeBoundTextElement: !0 });
|
|
3287
|
+
return n && P(n) && !n.isDeleted ? n : null;
|
|
3288
|
+
}
|
|
3289
|
+
#xe(e, t, n) {
|
|
3290
|
+
let r = [];
|
|
3291
|
+
if (r = n && "allHitElements" in n ? n?.allHitElements || [] : this.#Se(e, t, {
|
|
3292
|
+
includeBoundTextElement: n?.includeBoundTextElement,
|
|
3293
|
+
includeLockedElements: n?.includeLockedElements
|
|
3294
|
+
}), r.length > 1) {
|
|
3295
|
+
if (n?.preferSelected) {
|
|
3296
|
+
for (let e = r.length - 1; e > -1; e--) if (this.state.selectedElementIds[r[e].id]) return r[e];
|
|
3297
|
+
}
|
|
3298
|
+
let i = r[r.length - 1];
|
|
3299
|
+
return pn({
|
|
3300
|
+
point: S(e, t),
|
|
3301
|
+
element: i,
|
|
3302
|
+
threshold: this.getElementHitThreshold(i) / 2,
|
|
3303
|
+
elementsMap: this.scene.getNonDeletedElementsMap(),
|
|
3304
|
+
frameNameBound: j(i) ? this.frameNameBoundsCache.get(i) : null
|
|
3305
|
+
}) ? i : r[r.length - 2];
|
|
3306
|
+
}
|
|
3307
|
+
return r.length === 1 ? r[0] : null;
|
|
3308
|
+
}
|
|
3309
|
+
#Se(e, t, n) {
|
|
3310
|
+
let r = [], i = this.scene.getNonDeletedElementsMap();
|
|
3311
|
+
return (n?.includeBoundTextElement && n?.includeLockedElements ? this.scene.getNonDeletedElements() : this.scene.getNonDeletedElements().filter((e) => (n?.includeLockedElements || !e.locked) && (n?.includeBoundTextElement || !(P(e) && e.containerId)))).filter((n) => this.#Ce(e, t, n)).filter((n) => {
|
|
3312
|
+
let r = Jt(n, i);
|
|
3313
|
+
return r && this.state.frameRendering.enabled && this.state.frameRendering.clip ? en({
|
|
3314
|
+
x: e,
|
|
3315
|
+
y: t
|
|
3316
|
+
}, r, i) : !0;
|
|
3317
|
+
}).filter((e) => dt(e) ? (r.push(e), !1) : !0).concat(r);
|
|
3318
|
+
}
|
|
3319
|
+
getElementHitThreshold(e) {
|
|
3320
|
+
return Math.max(e.strokeWidth / 2 + .1, .85 * (d / this.state.zoom.value));
|
|
3321
|
+
}
|
|
3322
|
+
#Ce(e, t, n, r = !0) {
|
|
3323
|
+
return r && this.state.selectedElementIds[n.id] && xr([n], this.state, this.editorInterface) && dn(S(e, t), n, this.scene.getNonDeletedElementsMap(), this.getElementHitThreshold(n)) || un(S(e, t), n, this.scene.getNonDeletedElementsMap()) ? !0 : pn({
|
|
3324
|
+
point: S(e, t),
|
|
3325
|
+
element: n,
|
|
3326
|
+
threshold: this.getElementHitThreshold(n),
|
|
3327
|
+
elementsMap: this.scene.getNonDeletedElementsMap(),
|
|
3328
|
+
frameNameBound: j(n) ? this.frameNameBoundsCache.get(n) : null
|
|
3329
|
+
});
|
|
3330
|
+
}
|
|
3331
|
+
#we(e, t) {
|
|
3332
|
+
let n = this.scene.getNonDeletedElements(), r = this.scene.getSelectedElements(this.state);
|
|
3333
|
+
if (r.length === 1) return vt(r[0], !1) ? r[0] : null;
|
|
3334
|
+
let i = null;
|
|
3335
|
+
for (let r = n.length - 1; r >= 0; --r) {
|
|
3336
|
+
if (n[r].isDeleted) continue;
|
|
3337
|
+
let [a, o, s, c] = Dn(n[r], this.scene.getNonDeletedElementsMap());
|
|
3338
|
+
if (at(n[r]) && pn({
|
|
3339
|
+
point: S(e, t),
|
|
3340
|
+
element: n[r],
|
|
3341
|
+
elementsMap: this.scene.getNonDeletedElementsMap(),
|
|
3342
|
+
threshold: this.getElementHitThreshold(n[r])
|
|
3343
|
+
})) {
|
|
3344
|
+
i = n[r];
|
|
3345
|
+
break;
|
|
3346
|
+
} else if (a < e && e < s && o < t && t < c) {
|
|
3347
|
+
i = n[r];
|
|
3348
|
+
break;
|
|
3349
|
+
}
|
|
3350
|
+
}
|
|
3351
|
+
return vt(i, !1) ? i : null;
|
|
3352
|
+
}
|
|
3353
|
+
#Te;
|
|
3354
|
+
#Ee;
|
|
3355
|
+
#De;
|
|
3356
|
+
#Oe;
|
|
3357
|
+
#ke;
|
|
3358
|
+
#Ae;
|
|
3359
|
+
#je;
|
|
3360
|
+
#Me;
|
|
3361
|
+
#Ne;
|
|
3362
|
+
#Pe;
|
|
3363
|
+
#Fe;
|
|
3364
|
+
#Ie;
|
|
3365
|
+
#Le;
|
|
3366
|
+
#Re(e) {
|
|
3367
|
+
$.pointers.set(e.pointerId, {
|
|
3368
|
+
x: e.clientX,
|
|
3369
|
+
y: e.clientY
|
|
3370
|
+
}), $.pointers.size === 2 && ($.lastCenter = pa($.pointers), $.initialScale = this.state.zoom.value, $.initialDistance = ma(Array.from($.pointers.values())));
|
|
3371
|
+
}
|
|
3372
|
+
#ze(e) {
|
|
3373
|
+
let t = O(e, this.state), n = this.scene.getSelectedElements(this.state), [r, i, a, o] = En(n), s = n.findIndex(A) === 0;
|
|
3374
|
+
return {
|
|
3375
|
+
origin: t,
|
|
3376
|
+
withCmdOrCtrl: e[x.CTRL_OR_CMD],
|
|
3377
|
+
originInGrid: Je(C(t.x, t.y, e[x.CTRL_OR_CMD] || s ? null : this.getEffectiveGridSize())),
|
|
3378
|
+
scrollbars: ya(po, e.clientX - this.state.offsetLeft, e.clientY - this.state.offsetTop),
|
|
3379
|
+
lastCoords: { ...t },
|
|
3380
|
+
originalElements: this.scene.getNonDeletedElements().reduce((e, t) => (e.set(t.id, Vn(t)), e), /* @__PURE__ */ new Map()),
|
|
3381
|
+
resize: {
|
|
3382
|
+
handleType: !1,
|
|
3383
|
+
isResizing: !1,
|
|
3384
|
+
offset: {
|
|
3385
|
+
x: 0,
|
|
3386
|
+
y: 0
|
|
3387
|
+
},
|
|
3388
|
+
arrowDirection: "origin",
|
|
3389
|
+
center: {
|
|
3390
|
+
x: (a + r) / 2,
|
|
3391
|
+
y: (o + i) / 2
|
|
3392
|
+
}
|
|
3393
|
+
},
|
|
3394
|
+
hit: {
|
|
3395
|
+
element: null,
|
|
3396
|
+
allHitElements: [],
|
|
3397
|
+
wasAddedToSelection: !1,
|
|
3398
|
+
hasBeenDuplicated: !1,
|
|
3399
|
+
hasHitCommonBoundingBoxOfSelectedElements: this.#We(t, n)
|
|
3400
|
+
},
|
|
3401
|
+
drag: {
|
|
3402
|
+
hasOccurred: !1,
|
|
3403
|
+
offset: null,
|
|
3404
|
+
origin: { ...t },
|
|
3405
|
+
blockDragging: !1
|
|
3406
|
+
},
|
|
3407
|
+
eventListeners: {
|
|
3408
|
+
onMove: null,
|
|
3409
|
+
onUp: null,
|
|
3410
|
+
onKeyUp: null,
|
|
3411
|
+
onKeyDown: null
|
|
3412
|
+
},
|
|
3413
|
+
boxSelection: { hasOccurred: !1 }
|
|
3414
|
+
};
|
|
3415
|
+
}
|
|
3416
|
+
#Be(e, t) {
|
|
3417
|
+
if (!(t.scrollbars.isOverEither && !this.state.multiElement)) return !1;
|
|
3418
|
+
fo = !0, t.lastCoords.x = e.clientX, t.lastCoords.y = e.clientY;
|
|
3419
|
+
let n = _a((e) => {
|
|
3420
|
+
e.target instanceof HTMLElement && this.#rt(e, t);
|
|
3421
|
+
}), r = q(() => {
|
|
3422
|
+
vo = null, fo = !1, G(this.interactiveCanvas, this.state), this.setState({ cursorButton: "up" }), this.#Et(e.clientX, e.clientY, "up"), window.removeEventListener(h.POINTER_MOVE, n), window.removeEventListener(h.POINTER_UP, r), n.flush();
|
|
3423
|
+
});
|
|
3424
|
+
return vo = r, window.addEventListener(h.POINTER_MOVE, n), window.addEventListener(h.POINTER_UP, r), !0;
|
|
3425
|
+
}
|
|
3426
|
+
#Ve;
|
|
3427
|
+
#He;
|
|
3428
|
+
#Ue(e) {
|
|
3429
|
+
return e != null && this.state.selectedElementIds[e.id];
|
|
3430
|
+
}
|
|
3431
|
+
#We(e, t) {
|
|
3432
|
+
if (t.length < 2) return !1;
|
|
3433
|
+
let n = Math.max(d / this.state.zoom.value, 1), [r, i, a, o] = En(t);
|
|
3434
|
+
return e.x > r - n && e.x < a + n && e.y > i - n && e.y < o + n;
|
|
3435
|
+
}
|
|
3436
|
+
#Ge;
|
|
3437
|
+
#Ke;
|
|
3438
|
+
#qe;
|
|
3439
|
+
#Je;
|
|
3440
|
+
#Ye(e) {
|
|
3441
|
+
return this.state.currentItemRoundness === "round" ? { type: yt(e) ? ne.ADAPTIVE_RADIUS : ne.PROPORTIONAL_RADIUS } : null;
|
|
3442
|
+
}
|
|
3443
|
+
#Xe;
|
|
3444
|
+
#Ze;
|
|
3445
|
+
#Qe(e, t, n = !1) {
|
|
3446
|
+
Ta({
|
|
3447
|
+
event: e,
|
|
3448
|
+
app: this,
|
|
3449
|
+
selectedElements: t
|
|
3450
|
+
}) && (n || !J.getReferenceSnapPoints()) && J.setReferenceSnapPoints(ba(this.scene.getNonDeletedElements(), t, this.state, this.scene.getNonDeletedElementsMap()));
|
|
3451
|
+
}
|
|
3452
|
+
#$e(e, t, n = !1) {
|
|
3453
|
+
Ta({
|
|
3454
|
+
event: e,
|
|
3455
|
+
app: this,
|
|
3456
|
+
selectedElements: t
|
|
3457
|
+
}) && (n || !J.getVisibleGaps()) && J.setVisibleGaps(Sa(this.scene.getNonDeletedElements(), t, this.state, this.scene.getNonDeletedElementsMap()));
|
|
3458
|
+
}
|
|
3459
|
+
#et(e) {
|
|
3460
|
+
return q((t) => {
|
|
3461
|
+
this.#St(e, t) || this.#bt(e, t);
|
|
3462
|
+
});
|
|
3463
|
+
}
|
|
3464
|
+
#tt(e) {
|
|
3465
|
+
return q((t) => {
|
|
3466
|
+
t.key === x.ALT && t.preventDefault(), !this.#St(e, t) && this.#bt(e, t);
|
|
3467
|
+
});
|
|
3468
|
+
}
|
|
3469
|
+
#nt(e) {
|
|
3470
|
+
return _a((t) => {
|
|
3471
|
+
if (this.state.openDialog?.name === "elementLinkSelector") return;
|
|
3472
|
+
let n = O(t, this.state);
|
|
3473
|
+
if (this.state.activeLockedId && this.setState({ activeLockedId: null }), this.state.selectedLinearElement && this.state.selectedLinearElement.elbowed && this.state.selectedLinearElement.initialState.segmentMidpoint.index) {
|
|
3474
|
+
let [e, r] = C(n.x, n.y, t[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()), i = this.state.selectedLinearElement.initialState.segmentMidpoint.index;
|
|
3475
|
+
if (i < 0) {
|
|
3476
|
+
let t = z.getSegmentMidpointHitCoords({
|
|
3477
|
+
...this.state.selectedLinearElement,
|
|
3478
|
+
segmentMidPointHoveredCoords: null
|
|
3479
|
+
}, {
|
|
3480
|
+
x: e,
|
|
3481
|
+
y: r
|
|
3482
|
+
}, this.state, this.scene.getNonDeletedElementsMap());
|
|
3483
|
+
i = t ? z.getSegmentMidPointIndex(this.state.selectedLinearElement, this.state, t, this.scene.getNonDeletedElementsMap()) : -1;
|
|
3484
|
+
}
|
|
3485
|
+
let a = z.moveFixedSegment(this.state.selectedLinearElement, i, e, r, this.scene);
|
|
3486
|
+
this.setState({ selectedLinearElement: {
|
|
3487
|
+
...this.state.selectedLinearElement,
|
|
3488
|
+
isDragging: !0,
|
|
3489
|
+
segmentMidPointHoveredCoords: a.segmentMidPointHoveredCoords,
|
|
3490
|
+
initialState: a.initialState
|
|
3491
|
+
} });
|
|
3492
|
+
return;
|
|
3493
|
+
}
|
|
3494
|
+
let r = this.previousPointerMoveCoords ?? e.origin;
|
|
3495
|
+
if (this.previousPointerMoveCoords = n, e.drag.offset === null && (e.drag.offset = Je(Jn(this.scene.getSelectedElements(this.state), e.origin.x, e.origin.y))), !(t.target instanceof HTMLElement) || this.#rt(t, e)) return;
|
|
3496
|
+
if (Or(this.state)) {
|
|
3497
|
+
this.#je(t, n);
|
|
3498
|
+
return;
|
|
3499
|
+
}
|
|
3500
|
+
this.state.activeTool.type === "laser" && this.laserTrails.addPointToPath(n.x, n.y);
|
|
3501
|
+
let [a, o] = C(n.x, n.y, t[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize());
|
|
3502
|
+
if (e.resize.isResizing && (e.lastCoords.x = n.x, e.lastCoords.y = n.y, this.#xt(e, t) || this.#St(e, t))) return !0;
|
|
3503
|
+
let s = this.scene.getNonDeletedElementsMap();
|
|
3504
|
+
if (this.state.selectedLinearElement) {
|
|
3505
|
+
let r = this.state.selectedLinearElement;
|
|
3506
|
+
if (r.draggedFocusPointBinding) {
|
|
3507
|
+
Pn(r, s, n, this.scene, this.state, this.getEffectiveGridSize(), t.altKey), this.setState({ selectedLinearElement: {
|
|
3508
|
+
...r,
|
|
3509
|
+
isDragging: !1,
|
|
3510
|
+
selectedPointsIndices: [],
|
|
3511
|
+
initialState: {
|
|
3512
|
+
...r.initialState,
|
|
3513
|
+
lastClickedPoint: -1
|
|
3514
|
+
}
|
|
3515
|
+
} });
|
|
3516
|
+
return;
|
|
3517
|
+
}
|
|
3518
|
+
if (z.shouldAddMidpoint(this.state.selectedLinearElement, n, this.state, s)) {
|
|
3519
|
+
let e = z.addMidpoint(this.state.selectedLinearElement, n, this, !t[x.CTRL_OR_CMD], this.scene);
|
|
3520
|
+
if (!e) return;
|
|
3521
|
+
Z(() => {
|
|
3522
|
+
this.state.selectedLinearElement && this.setState({ selectedLinearElement: {
|
|
3523
|
+
...this.state.selectedLinearElement,
|
|
3524
|
+
initialState: e.pointerDownState,
|
|
3525
|
+
selectedPointsIndices: e.selectedPointsIndices,
|
|
3526
|
+
segmentMidPointHoveredCoords: null
|
|
3527
|
+
} });
|
|
3528
|
+
});
|
|
3529
|
+
return;
|
|
3530
|
+
} else if (r.initialState.segmentMidpoint.value !== null && !r.initialState.segmentMidpoint.added) return;
|
|
3531
|
+
else if (r.initialState.lastClickedPoint > -1) {
|
|
3532
|
+
let i = z.getElement(r.elementId, s);
|
|
3533
|
+
if (i?.isDeleted) return;
|
|
3534
|
+
if (k(i)) {
|
|
3535
|
+
let e = R(S(n.x, n.y), this.scene.getNonDeletedElements(), s);
|
|
3536
|
+
T("COMPLEX_BINDINGS") && this.#m(i, e);
|
|
3537
|
+
}
|
|
3538
|
+
if (t.altKey && !this.state.selectedLinearElement?.initialState?.arrowStartIsInside && T("COMPLEX_BINDINGS") && this.#d(), r.initialState.lastClickedPoint === -1) return;
|
|
3539
|
+
let a = z.handlePointDragging(t, this, n.x, n.y, r);
|
|
3540
|
+
if (a) {
|
|
3541
|
+
e.lastCoords.x = n.x, e.lastCoords.y = n.y, e.drag.hasOccurred = !0, (a.suggestedBinding !== this.state.suggestedBinding || !Ve(a.selectedLinearElement?.selectedPointsIndices ?? [], this.state.selectedLinearElement?.selectedPointsIndices ?? []) || a.selectedLinearElement?.hoverPointIndex !== this.state.selectedLinearElement?.hoverPointIndex || a.selectedLinearElement?.customLineAngle !== this.state.selectedLinearElement?.customLineAngle || this.state.selectedLinearElement.isDragging !== a.selectedLinearElement?.isDragging || this.state.selectedLinearElement?.initialState?.altFocusPoint !== a.selectedLinearElement?.initialState?.altFocusPoint) && this.setState(a);
|
|
3542
|
+
return;
|
|
3543
|
+
}
|
|
3544
|
+
}
|
|
3545
|
+
}
|
|
3546
|
+
let c = e.hit.allHitElements.some((e) => this.#Ue(e)), l = this.state.selectedLinearElement?.isEditing && t.shiftKey && this.state.selectedLinearElement.elementId === e.hit.element?.id;
|
|
3547
|
+
if ((c || e.hit.hasHitCommonBoundingBoxOfSelectedElements) && !l && !e.drag.blockDragging) {
|
|
3548
|
+
let a = this.scene.getSelectedElements(this.state);
|
|
3549
|
+
if (a.length > 0 && a.every((e) => e.locked)) return;
|
|
3550
|
+
let o = a.find((e) => j(e)), c = this.#ke(n), l = c && !o ? c : null;
|
|
3551
|
+
if (this.state.frameToHighlight !== l && Z(() => {
|
|
3552
|
+
this.setState({ frameToHighlight: l });
|
|
3553
|
+
}), e.drag.hasOccurred = !0, this.state.activeTool.type === "lasso" && this.lassoTrail.hasCurrentTrail && !(this.editorInterface.formFactor !== "desktop" && e.hit.element) && !this.state.activeTool.fromSelection) return;
|
|
3554
|
+
if (this.state.activeTool.type === "lasso" && a.length > 0 && e.drag.hasOccurred && !this.state.activeTool.fromSelection && this.lassoTrail.endPath(), a.length > 0 && !e.withCmdOrCtrl && !this.state.editingTextElement && this.state.activeEmbeddable?.state !== "active") {
|
|
3555
|
+
let o = {
|
|
3556
|
+
x: n.x - e.drag.origin.x,
|
|
3557
|
+
y: n.y - e.drag.origin.y
|
|
3558
|
+
}, c = [...e.originalElements.values()], l = t.shiftKey;
|
|
3559
|
+
if (l) {
|
|
3560
|
+
let e = Math.abs(o.x), t = Math.abs(o.y), n = l && e < t, r = l && e > t;
|
|
3561
|
+
n && (o.x = 0), r && (o.y = 0);
|
|
3562
|
+
}
|
|
3563
|
+
if (this.state.croppingElementId) {
|
|
3564
|
+
let t = this.scene.getNonDeletedElementsMap().get(this.state.croppingElementId);
|
|
3565
|
+
if (t && M(t) && t.crop !== null && e.hit.element === t) {
|
|
3566
|
+
let e = t.crop, a = pt(t) && this.imageCache.get(t.fileId)?.image;
|
|
3567
|
+
if (a && !(a instanceof Promise)) {
|
|
3568
|
+
let o = rt(t), c = Ce(n.x - r.x, n.y - r.y);
|
|
3569
|
+
c[0] *= a.naturalWidth / o.width, c[1] *= a.naturalHeight / o.height;
|
|
3570
|
+
let [l, u, d, f, p, m] = Dn(t, s), h = Te(ke(S(l, u), S(p, m), t.angle)), g = Te(ke(S(d, u), S(p, m), t.angle)), _ = Te(ke(S(l, f), S(p, m), t.angle)), ee = Ee(De(g, h)), v = Ee(De(_, h)), y = Ce(we(c, ee), we(c, v)), te = {
|
|
3571
|
+
...e,
|
|
3572
|
+
x: i(e.x - y[0] * Math.sign(t.scale[0]), 0, a.naturalWidth - e.width),
|
|
3573
|
+
y: i(e.y - y[1] * Math.sign(t.scale[1]), 0, a.naturalHeight - e.height)
|
|
3574
|
+
};
|
|
3575
|
+
this.scene.mutateElement(t, { crop: te });
|
|
3576
|
+
return;
|
|
3577
|
+
}
|
|
3578
|
+
}
|
|
3579
|
+
}
|
|
3580
|
+
this.#$e(t, a), this.#Qe(t, a);
|
|
3581
|
+
let { snapOffset: u, snapLines: d } = Ea(c, o, this, t, this.scene.getNonDeletedElementsMap());
|
|
3582
|
+
if (this.setState({ snapLines: d }), this.state.editingFrame || qn(e, a, o, this.scene, u, t[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()), this.setState({
|
|
3583
|
+
selectedElementsAreBeingDragged: !0,
|
|
3584
|
+
selectionElement: null
|
|
3585
|
+
}), t.altKey && !e.hit.hasBeenDuplicated) {
|
|
3586
|
+
e.hit.hasBeenDuplicated = !0;
|
|
3587
|
+
let n = this.scene.getElementsIncludingDeleted(), r = e.hit.element, i = this.scene.getSelectedElements({
|
|
3588
|
+
selectedElementIds: this.state.selectedElementIds,
|
|
3589
|
+
includeBoundTextElement: !0,
|
|
3590
|
+
includeElementsInFrames: !0
|
|
3591
|
+
});
|
|
3592
|
+
r && e.hit.wasAddedToSelection && !i.find((e) => e.id === r.id) && i.push(r);
|
|
3593
|
+
let a = new Map(i.map((e) => [e.id, e])), { duplicatedElements: o, duplicateElementsMap: s, elementsWithDuplicates: c, origIdToDuplicateId: l } = Hn({
|
|
3594
|
+
type: "in-place",
|
|
3595
|
+
elements: n,
|
|
3596
|
+
appState: this.state,
|
|
3597
|
+
randomizeSeed: !0,
|
|
3598
|
+
idsOfElementsToDuplicate: a,
|
|
3599
|
+
overrides: ({ duplicateElement: e, origElement: t }) => ({
|
|
3600
|
+
frameId: e.frameId ?? t.frameId,
|
|
3601
|
+
seed: Qe()
|
|
3602
|
+
})
|
|
3603
|
+
});
|
|
3604
|
+
o.forEach((t) => {
|
|
3605
|
+
e.originalElements.set(t.id, Vn(t));
|
|
3606
|
+
});
|
|
3607
|
+
let u = c.map((t) => {
|
|
3608
|
+
if (a.has(t.id)) {
|
|
3609
|
+
let n = e.originalElements.get(t.id);
|
|
3610
|
+
if (n) return L(t, {
|
|
3611
|
+
x: n.x,
|
|
3612
|
+
y: n.y
|
|
3613
|
+
});
|
|
3614
|
+
}
|
|
3615
|
+
return t;
|
|
3616
|
+
}), d = this.props.onDuplicate?.(u, n), f = wn(d || u, Ae(o));
|
|
3617
|
+
Z(() => {
|
|
3618
|
+
if (e.hit.element) {
|
|
3619
|
+
let t = l.get(e.hit.element.id), n = t && s.get(t);
|
|
3620
|
+
e.hit.element = n || null;
|
|
3621
|
+
}
|
|
3622
|
+
e.hit.allHitElements = e.hit.allHitElements.reduce((e, t) => {
|
|
3623
|
+
let n = l.get(t.id), r = n && s.get(n);
|
|
3624
|
+
return r && e.push(r), e;
|
|
3625
|
+
}, []), e.drag.origin = O(t, this.state), this.setState((e) => ({ ...Ct(o, this.scene.getNonDeletedElements(), e) })), this.scene.replaceAllElements(f), i.forEach((e) => {
|
|
3626
|
+
ot(e) && e.boundElements?.some?.((e) => e.type === "arrow") && Sn(e, this.scene);
|
|
3627
|
+
}), this.#$e(t, i, !0), this.#Qe(t, i, !0);
|
|
3628
|
+
});
|
|
3629
|
+
}
|
|
3630
|
+
return;
|
|
3631
|
+
}
|
|
3632
|
+
}
|
|
3633
|
+
if (this.state.selectionElement) {
|
|
3634
|
+
if (e.lastCoords.x = n.x, e.lastCoords.y = n.y, t.altKey) {
|
|
3635
|
+
this.setActiveTool({
|
|
3636
|
+
type: "lasso",
|
|
3637
|
+
fromSelection: !0
|
|
3638
|
+
}, t.shiftKey), this.lassoTrail.startPath(e.origin.x, e.origin.y, t.shiftKey), this.setAppState({ selectionElement: null });
|
|
3639
|
+
return;
|
|
3640
|
+
}
|
|
3641
|
+
this.#bt(e, t);
|
|
3642
|
+
} else if (this.state.activeTool.type === "lasso") !t.altKey && this.state.activeTool.fromSelection ? (this.setActiveTool({ type: "selection" }), this.#Xe("selection", e), e.lastCoords.x = n.x, e.lastCoords.y = n.y, this.#bt(e, t), this.lassoTrail.endPath()) : this.lassoTrail.addPointToPath(n.x, n.y, t.shiftKey);
|
|
3643
|
+
else {
|
|
3644
|
+
let r = this.state.newElement;
|
|
3645
|
+
if (!r) return;
|
|
3646
|
+
if (r.type === "freedraw") {
|
|
3647
|
+
let e = r.points, i = n.x - r.x, a = n.y - r.y, o = e.length > 0 && e[e.length - 1];
|
|
3648
|
+
if (!(o && o[0] === i && o[1] === a)) {
|
|
3649
|
+
let n = r.simulatePressure ? r.pressures : [...r.pressures, t.pressure];
|
|
3650
|
+
this.scene.mutateElement(r, {
|
|
3651
|
+
points: [...e, S(i, a)],
|
|
3652
|
+
pressures: n
|
|
3653
|
+
}, {
|
|
3654
|
+
informMutation: !1,
|
|
3655
|
+
isDragging: !1
|
|
3656
|
+
}), this.setState({ newElement: r });
|
|
3657
|
+
}
|
|
3658
|
+
} else if (N(r) && !r.isDeleted) {
|
|
3659
|
+
e.drag.hasOccurred = !0;
|
|
3660
|
+
let n = r.points;
|
|
3661
|
+
E(n.length > 1, "Do not create linear elements with less than 2 points");
|
|
3662
|
+
let i = this.state.selectedLinearElement;
|
|
3663
|
+
i ||= (i = new z(r, this.scene.getNonDeletedElementsMap()), {
|
|
3664
|
+
...i,
|
|
3665
|
+
selectedPointsIndices: [1],
|
|
3666
|
+
initialState: {
|
|
3667
|
+
...i.initialState,
|
|
3668
|
+
lastClickedPoint: 1
|
|
3669
|
+
}
|
|
3670
|
+
}), this.setState({
|
|
3671
|
+
newElement: r,
|
|
3672
|
+
...z.handlePointDragging(t, this, a, o, i)
|
|
3673
|
+
});
|
|
3674
|
+
} else e.lastCoords.x = n.x, e.lastCoords.y = n.y, this.#bt(e, t, !1);
|
|
3675
|
+
}
|
|
3676
|
+
if (this.state.activeTool.type === "selection") {
|
|
3677
|
+
e.boxSelection.hasOccurred = !0;
|
|
3678
|
+
let n = this.scene.getNonDeletedElements();
|
|
3679
|
+
if (this.state.selectedLinearElement?.isEditing) z.handleBoxSelection(t, this.state, this.setState.bind(this), this.scene.getNonDeletedElementsMap());
|
|
3680
|
+
else {
|
|
3681
|
+
let r = !0;
|
|
3682
|
+
!t.shiftKey && wt(n, this.state) && (e.withCmdOrCtrl && e.hit.element ? this.setState((t) => I({
|
|
3683
|
+
...t,
|
|
3684
|
+
selectedElementIds: { [e.hit.element.id]: !0 }
|
|
3685
|
+
}, this.scene.getNonDeletedElements(), t, this)) : r = !1);
|
|
3686
|
+
let i = this.state.selectionElement ? xt(n, this.state.selectionElement, this.scene.getNonDeletedElementsMap(), !1) : [];
|
|
3687
|
+
this.setState((t) => {
|
|
3688
|
+
let n = {
|
|
3689
|
+
...r && t.selectedElementIds,
|
|
3690
|
+
...i.reduce((e, t) => (e[t.id] = !0, e), {})
|
|
3691
|
+
};
|
|
3692
|
+
return e.hit.element && (i.length ? delete n[e.hit.element.id] : n[e.hit.element.id] = !0), t = r ? t : {
|
|
3693
|
+
...t,
|
|
3694
|
+
selectedGroupIds: {},
|
|
3695
|
+
editingGroupId: null
|
|
3696
|
+
}, {
|
|
3697
|
+
...I({
|
|
3698
|
+
editingGroupId: t.editingGroupId,
|
|
3699
|
+
selectedElementIds: n
|
|
3700
|
+
}, this.scene.getNonDeletedElements(), t, this),
|
|
3701
|
+
selectedLinearElement: i.length === 1 && N(i[0]) ? new z(i[0], this.scene.getNonDeletedElementsMap()) : null
|
|
3702
|
+
};
|
|
3703
|
+
});
|
|
3704
|
+
}
|
|
3705
|
+
}
|
|
3706
|
+
});
|
|
3707
|
+
}
|
|
3708
|
+
#rt(e, t) {
|
|
3709
|
+
if (t.scrollbars.isOverHorizontal) {
|
|
3710
|
+
let n = e.clientX, r = n - t.lastCoords.x;
|
|
3711
|
+
return this.#ae({ scrollX: this.state.scrollX - r * (po.horizontal?.deltaMultiplier || 1) / this.state.zoom.value }), t.lastCoords.x = n, !0;
|
|
3712
|
+
}
|
|
3713
|
+
if (t.scrollbars.isOverVertical) {
|
|
3714
|
+
let n = e.clientY, r = n - t.lastCoords.y;
|
|
3715
|
+
return this.#ae({ scrollY: this.state.scrollY - r * (po.vertical?.deltaMultiplier || 1) / this.state.zoom.value }), t.lastCoords.y = n, !0;
|
|
3716
|
+
}
|
|
3717
|
+
return !1;
|
|
3718
|
+
}
|
|
3719
|
+
#it(e) {
|
|
3720
|
+
return q((t) => {
|
|
3721
|
+
let n = this.scene.getNonDeletedElementsMap();
|
|
3722
|
+
this.removePointer(t), e.drag.blockDragging = !1, e.eventListeners.onMove && e.eventListeners.onMove.flush();
|
|
3723
|
+
let { newElement: r, resizingElement: i, croppingElementId: a, multiElement: o, activeTool: s, isResizing: c, isRotating: l, isCropping: d } = this.state;
|
|
3724
|
+
this.setState((e) => ({
|
|
3725
|
+
isResizing: !1,
|
|
3726
|
+
isRotating: !1,
|
|
3727
|
+
isCropping: !1,
|
|
3728
|
+
resizingElement: null,
|
|
3729
|
+
selectionElement: null,
|
|
3730
|
+
frameToHighlight: null,
|
|
3731
|
+
elementsToHighlight: null,
|
|
3732
|
+
cursorButton: "up",
|
|
3733
|
+
snapLines: Xe(e.snapLines, []),
|
|
3734
|
+
originSnapOffset: null
|
|
3735
|
+
})), this.lassoTrail.endPath(), this.previousPointerMoveCoords = null, J.setReferenceSnapPoints(null), J.setVisibleGaps(null), this.#Et(t.clientX, t.clientY, "up");
|
|
3736
|
+
let f = e.hit.allHitElements, p = O({
|
|
3737
|
+
clientX: t.clientX,
|
|
3738
|
+
clientY: t.clientY
|
|
3739
|
+
}, this.state);
|
|
3740
|
+
if (this.state.activeTool.type === "selection" && !e.boxSelection.hasOccurred && !e.resize.isResizing && !f.some((e) => this.state.selectedElementIds[e.id])) {
|
|
3741
|
+
let e = this.#xe(p.x, p.y, { includeLockedElements: !0 });
|
|
3742
|
+
this.#r.scheduleCapture(), e?.locked ? this.setState({ activeLockedId: e.groupIds.length > 0 ? e.groupIds.at(-1) || "" : e.id }) : this.setState({ activeLockedId: null });
|
|
3743
|
+
} else this.setState({ activeLockedId: null });
|
|
3744
|
+
if (T("COMPLEX_BINDINGS") && this.#f(), this.setState({
|
|
3745
|
+
selectedElementsAreBeingDragged: !1,
|
|
3746
|
+
bindMode: "orbit"
|
|
3747
|
+
}), e.drag.hasOccurred && e.hit?.element?.id) {
|
|
3748
|
+
let t = n.get(e.hit.element.id);
|
|
3749
|
+
ot(t) && t.boundElements?.filter?.((e) => e.type === "arrow").map((e) => n.get(e.id)).filter((e) => A(e)).forEach((e) => {
|
|
3750
|
+
e && this.scene.mutateElement(e, {});
|
|
3751
|
+
});
|
|
3752
|
+
}
|
|
3753
|
+
if (this.state.selectedLinearElement?.isEditing && !this.state.newElement && this.state.selectedLinearElement.draggedFocusPointBinding === null) if (!e.boxSelection.hasOccurred && e.hit?.element?.id !== this.state.selectedLinearElement.elementId && this.state.selectedLinearElement.draggedFocusPointBinding === null) this.actionManager.executeAction(K);
|
|
3754
|
+
else {
|
|
3755
|
+
let e = z.handlePointerUp(t, this.state.selectedLinearElement, this.state, this.scene);
|
|
3756
|
+
this.actionManager.executeAction(K, "ui", {
|
|
3757
|
+
event: t,
|
|
3758
|
+
sceneCoords: p
|
|
3759
|
+
}), e !== this.state.selectedLinearElement && this.setState({
|
|
3760
|
+
selectedLinearElement: e,
|
|
3761
|
+
suggestedBinding: null
|
|
3762
|
+
});
|
|
3763
|
+
}
|
|
3764
|
+
else if (this.state.selectedLinearElement) {
|
|
3765
|
+
if (this.state.selectedLinearElement.elbowed) {
|
|
3766
|
+
let e = z.getElement(this.state.selectedLinearElement.elementId, this.scene.getNonDeletedElementsMap());
|
|
3767
|
+
e && this.scene.mutateElement(e, {});
|
|
3768
|
+
}
|
|
3769
|
+
if (this.state.selectedLinearElement.draggedFocusPointBinding ? (Ln(this.state.selectedLinearElement, this.scene), this.setState({ selectedLinearElement: {
|
|
3770
|
+
...this.state.selectedLinearElement,
|
|
3771
|
+
draggedFocusPointBinding: null
|
|
3772
|
+
} })) : e.hit?.element?.id === this.state.selectedLinearElement.elementId ? this.state.selectedLinearElement.isDragging && (this.setState({ selectedLinearElement: {
|
|
3773
|
+
...this.state.selectedLinearElement,
|
|
3774
|
+
isDragging: !1
|
|
3775
|
+
} }), this.actionManager.executeAction(K, "ui", {
|
|
3776
|
+
event: t,
|
|
3777
|
+
sceneCoords: p
|
|
3778
|
+
})) : this.scene.getSelectedElements(this.state).length > 1 && this.setState({ selectedLinearElement: null }), this.state.newElement && this.state.multiElement && N(this.state.newElement) && this.state.selectedLinearElement) {
|
|
3779
|
+
let { multiElement: e } = this.state;
|
|
3780
|
+
this.setState({ selectedLinearElement: {
|
|
3781
|
+
...this.state.selectedLinearElement,
|
|
3782
|
+
lastCommittedPoint: e.points[e.points.length - 1]
|
|
3783
|
+
} });
|
|
3784
|
+
}
|
|
3785
|
+
}
|
|
3786
|
+
if (this.missingPointerEventCleanupEmitter.clear(), window.removeEventListener(h.POINTER_MOVE, e.eventListeners.onMove), window.removeEventListener(h.POINTER_UP, e.eventListeners.onUp), window.removeEventListener(h.KEYDOWN, e.eventListeners.onKeyDown), window.removeEventListener(h.KEYUP, e.eventListeners.onKeyUp), this.props?.onPointerUp?.(s, e), this.onPointerUpEmitter.trigger(this.state.activeTool, e, t), r?.type === "freedraw") {
|
|
3787
|
+
let e = O(t, this.state), n = r.points, i = e.x - r.x, a = e.y - r.y;
|
|
3788
|
+
i === n[0][0] && a === n[0][1] && (a += 1e-4, i += 1e-4);
|
|
3789
|
+
let o = r.simulatePressure ? [] : [...r.pressures, t.pressure];
|
|
3790
|
+
this.scene.mutateElement(r, {
|
|
3791
|
+
points: [...n, S(i, a)],
|
|
3792
|
+
pressures: o
|
|
3793
|
+
}), this.actionManager.executeAction(K);
|
|
3794
|
+
return;
|
|
3795
|
+
}
|
|
3796
|
+
if (N(r)) {
|
|
3797
|
+
r.points.length > 1 && r.points[1][0] !== 0 && r.points[1][1] !== 0 && this.#r.scheduleCapture();
|
|
3798
|
+
let n = O(t, this.state), i = Oe(S(n.x, n.y), S(e.origin.x, e.origin.y)) * this.state.zoom.value;
|
|
3799
|
+
if ((!e.drag.hasOccurred || i < 20) && r && !o) if (this.editorInterface.isTouchScreen) {
|
|
3800
|
+
let e = Math.min(this.state.width * .7 / this.state.zoom.value, 100);
|
|
3801
|
+
this.scene.mutateElement(r, {
|
|
3802
|
+
x: r.x - e / 2,
|
|
3803
|
+
points: [S(0, 0), S(e, 0)]
|
|
3804
|
+
}, {
|
|
3805
|
+
informMutation: !1,
|
|
3806
|
+
isDragging: !1
|
|
3807
|
+
}), this.actionManager.executeAction(K);
|
|
3808
|
+
} else {
|
|
3809
|
+
let e = n.x - r.x, t = n.y - r.y;
|
|
3810
|
+
this.scene.mutateElement(r, { points: [r.points[0], S(e, t)] }, {
|
|
3811
|
+
informMutation: !1,
|
|
3812
|
+
isDragging: !1
|
|
3813
|
+
}), this.setState({
|
|
3814
|
+
multiElement: r,
|
|
3815
|
+
newElement: r
|
|
3816
|
+
});
|
|
3817
|
+
}
|
|
3818
|
+
else e.drag.hasOccurred && !o && (N(r) && this.actionManager.executeAction(K, "ui", {
|
|
3819
|
+
event: t,
|
|
3820
|
+
sceneCoords: p
|
|
3821
|
+
}), this.setState({
|
|
3822
|
+
suggestedBinding: null,
|
|
3823
|
+
startBoundElement: null
|
|
3824
|
+
}), s.locked ? this.setState((e) => ({ newElement: null })) : (U(this.interactiveCanvas), this.setState((e) => ({
|
|
3825
|
+
newElement: null,
|
|
3826
|
+
activeTool: D(this.state, { type: this.state.preferredSelectionTool.type }),
|
|
3827
|
+
selectedElementIds: F({
|
|
3828
|
+
...e.selectedElementIds,
|
|
3829
|
+
[r.id]: !0
|
|
3830
|
+
}, e),
|
|
3831
|
+
selectedLinearElement: new z(r, this.scene.getNonDeletedElementsMap())
|
|
3832
|
+
}))), this.scene.triggerUpdate());
|
|
3833
|
+
return;
|
|
3834
|
+
}
|
|
3835
|
+
if (P(r)) {
|
|
3836
|
+
let e = Ot(Ie({
|
|
3837
|
+
fontSize: r.fontSize,
|
|
3838
|
+
fontFamily: r.fontFamily
|
|
3839
|
+
}), r.lineHeight);
|
|
3840
|
+
r.width < e && this.scene.mutateElement(r, { autoResize: !0 }), this.#pe(), this.#ve(r, { isExistingElement: !0 });
|
|
3841
|
+
}
|
|
3842
|
+
if (s.type !== "selection" && r && Nn(r)) {
|
|
3843
|
+
this.updateScene({
|
|
3844
|
+
elements: this.scene.getElementsIncludingDeleted().filter((e) => e.id !== r.id),
|
|
3845
|
+
appState: { newElement: null },
|
|
3846
|
+
captureUpdate: B.NEVER
|
|
3847
|
+
});
|
|
3848
|
+
return;
|
|
3849
|
+
}
|
|
3850
|
+
if (j(r)) {
|
|
3851
|
+
let e = Yt(this.scene.getElementsIncludingDeleted(), r, this.scene.getNonDeletedElementsMap());
|
|
3852
|
+
this.scene.replaceAllElements(Gt(this.scene.getElementsMapIncludingDeleted(), e, r, this.state));
|
|
3853
|
+
}
|
|
3854
|
+
if (r && (this.scene.mutateElement(r, An(r), {
|
|
3855
|
+
informMutation: !1,
|
|
3856
|
+
isDragging: !1
|
|
3857
|
+
}), this.scene.triggerUpdate()), e.drag.hasOccurred) {
|
|
3858
|
+
let e = O(t, this.state);
|
|
3859
|
+
if (this.state.selectedLinearElement && this.state.selectedLinearElement.isDragging) {
|
|
3860
|
+
let e = this.scene.getElement(this.state.selectedLinearElement.elementId);
|
|
3861
|
+
if (e?.frameId) {
|
|
3862
|
+
let t = Jt(e, n);
|
|
3863
|
+
t && e && (Kt(e, t, this.scene.getNonDeletedElementsMap()) || (this.scene.mutateElement(e, { groupIds: [] }), nn([e], this.scene.getNonDeletedElementsMap()), this.scene.triggerUpdate()));
|
|
3864
|
+
}
|
|
3865
|
+
} else {
|
|
3866
|
+
let t = this.#ke(e), n = this.scene.getSelectedElements(this.state), r = this.scene.getElementsMapIncludingDeleted(), i = (e) => {
|
|
3867
|
+
if (e.length > 0) {
|
|
3868
|
+
for (let t of e) {
|
|
3869
|
+
let e = t.groupIds.indexOf(this.state.editingGroupId);
|
|
3870
|
+
this.scene.mutateElement(t, { groupIds: t.groupIds.slice(0, e) }, {
|
|
3871
|
+
informMutation: !1,
|
|
3872
|
+
isDragging: !1
|
|
3873
|
+
});
|
|
3874
|
+
}
|
|
3875
|
+
r.forEach((e) => {
|
|
3876
|
+
e.groupIds.length && zt(r, e.groupIds[e.groupIds.length - 1]).length < 2 && this.scene.mutateElement(e, { groupIds: [] }, {
|
|
3877
|
+
informMutation: !1,
|
|
3878
|
+
isDragging: !1
|
|
3879
|
+
});
|
|
3880
|
+
}), this.setState({ editingGroupId: null });
|
|
3881
|
+
}
|
|
3882
|
+
};
|
|
3883
|
+
if (t && !this.state.selectedElementIds[t.id]) {
|
|
3884
|
+
let e = n.filter((e) => e.frameId !== t.id && tn(e, r, this.state));
|
|
3885
|
+
this.state.editingGroupId && i(e), r = Gt(r, e, t, this.state);
|
|
3886
|
+
} else t || this.state.editingGroupId && i(n.filter((e) => e.frameId && !tn(e, r, this.state)));
|
|
3887
|
+
r = an(r, this.state, this), this.scene.replaceAllElements(r);
|
|
3888
|
+
}
|
|
3889
|
+
}
|
|
3890
|
+
if (i && this.#r.scheduleCapture(), i && Nn(i) && this.updateScene({
|
|
3891
|
+
elements: this.scene.getElementsIncludingDeleted().filter((e) => e.id !== i.id),
|
|
3892
|
+
captureUpdate: B.NEVER
|
|
3893
|
+
}), e.resize.isResizing) {
|
|
3894
|
+
let e = an(this.scene.getElementsIncludingDeleted(), this.state, this), t = this.scene.getSelectedElements(this.state).filter((e) => j(e));
|
|
3895
|
+
for (let r of t) e = rn(e, Xt(this.scene.getElementsIncludingDeleted(), r, this.state, n), r, this);
|
|
3896
|
+
this.scene.replaceAllElements(e);
|
|
3897
|
+
}
|
|
3898
|
+
let m = e.hit.element;
|
|
3899
|
+
this.state.selectedLinearElement?.elementId !== m?.id && N(m) && this.scene.getSelectedElements(this.state).length === 1 && this.setState({ selectedLinearElement: new z(m, this.scene.getNonDeletedElementsMap()) }), (!a || a && (!m && !d || m && m.id !== a)) && this.#De();
|
|
3900
|
+
let g = this.lastPointerDownEvent, _ = this.lastPointerUpEvent || this.lastPointerMoveEvent;
|
|
3901
|
+
if (Or(this.state) && g && _) {
|
|
3902
|
+
if (this.eraserTrail.endPath(), Oe(S(g.clientX, g.clientY), S(_.clientX, _.clientY)) === 0) {
|
|
3903
|
+
let e = O({
|
|
3904
|
+
clientX: _.clientX,
|
|
3905
|
+
clientY: _.clientY
|
|
3906
|
+
}, this.state);
|
|
3907
|
+
this.#Se(e.x, e.y).forEach((e) => this.#l.add(e.id));
|
|
3908
|
+
}
|
|
3909
|
+
this.#ot();
|
|
3910
|
+
return;
|
|
3911
|
+
} else this.#l.size && this.#at();
|
|
3912
|
+
if (m && !e.drag.hasOccurred && !e.hit.wasAddedToSelection && (!this.state.selectedLinearElement?.isEditing || !e.boxSelection.hasOccurred) && this.state.activeTool.type !== "lasso" && (t.shiftKey && !this.state.selectedLinearElement?.isEditing ? this.state.selectedElementIds[m.id] ? Ut(this.state, m) ? this.setState((e) => {
|
|
3913
|
+
let t = { ...e.selectedElementIds };
|
|
3914
|
+
for (let e of m.groupIds.flatMap((e) => zt(this.scene.getNonDeletedElements(), e))) delete t[e.id];
|
|
3915
|
+
return {
|
|
3916
|
+
selectedGroupIds: {
|
|
3917
|
+
...e.selectedElementIds,
|
|
3918
|
+
...m.groupIds.map((e) => ({ [e]: !1 })).reduce((e, t) => ({
|
|
3919
|
+
...e,
|
|
3920
|
+
...t
|
|
3921
|
+
}), {})
|
|
3922
|
+
},
|
|
3923
|
+
selectedElementIds: F(t, e)
|
|
3924
|
+
};
|
|
3925
|
+
}) : this.state.selectedLinearElement?.isDragging || this.setState((e) => {
|
|
3926
|
+
let t = { ...e.selectedElementIds };
|
|
3927
|
+
delete t[m.id];
|
|
3928
|
+
let n = St(this.scene.getNonDeletedElements(), { selectedElementIds: t });
|
|
3929
|
+
return {
|
|
3930
|
+
...I({
|
|
3931
|
+
editingGroupId: e.editingGroupId,
|
|
3932
|
+
selectedElementIds: t
|
|
3933
|
+
}, this.scene.getNonDeletedElements(), e, this),
|
|
3934
|
+
selectedLinearElement: n.length === 1 && N(n[0]) ? new z(n[0], this.scene.getNonDeletedElementsMap()) : e.selectedLinearElement
|
|
3935
|
+
};
|
|
3936
|
+
}) : m.frameId && this.state.selectedElementIds[m.frameId] ? this.setState((e) => {
|
|
3937
|
+
let t = {
|
|
3938
|
+
...e.selectedElementIds,
|
|
3939
|
+
[m.id]: !0
|
|
3940
|
+
};
|
|
3941
|
+
return delete t[m.frameId], (this.scene.getElement(m.frameId)?.groupIds ?? []).flatMap((e) => zt(this.scene.getNonDeletedElements(), e)).forEach((e) => {
|
|
3942
|
+
delete t[e.id];
|
|
3943
|
+
}), { ...I({
|
|
3944
|
+
editingGroupId: e.editingGroupId,
|
|
3945
|
+
selectedElementIds: t
|
|
3946
|
+
}, this.scene.getNonDeletedElements(), e, this) };
|
|
3947
|
+
}) : this.setState((e) => ({ selectedElementIds: F({
|
|
3948
|
+
...e.selectedElementIds,
|
|
3949
|
+
[m.id]: !0
|
|
3950
|
+
}, e) })) : this.setState((e) => ({
|
|
3951
|
+
...I({
|
|
3952
|
+
editingGroupId: e.editingGroupId,
|
|
3953
|
+
selectedElementIds: { [m.id]: !0 }
|
|
3954
|
+
}, this.scene.getNonDeletedElements(), e, this),
|
|
3955
|
+
selectedLinearElement: N(m) && e.selectedLinearElement?.elementId !== m.id ? new z(m, this.scene.getNonDeletedElementsMap()) : e.selectedLinearElement
|
|
3956
|
+
}))), this.state.activeTool.type !== "lasso" && !(m && A(m)) && !e.drag.hasOccurred && !this.state.isResizing && (m && fn({
|
|
3957
|
+
point: S(e.origin.x, e.origin.y),
|
|
3958
|
+
element: m,
|
|
3959
|
+
elementsMap: n,
|
|
3960
|
+
threshold: this.getElementHitThreshold(m),
|
|
3961
|
+
frameNameBound: j(m) ? this.frameNameBoundsCache.get(m) : null
|
|
3962
|
+
}, n) || !m && e.hit.hasHitCommonBoundingBoxOfSelectedElements)) {
|
|
3963
|
+
this.state.selectedLinearElement?.isEditing ? this.actionManager.executeAction(Zi) : this.setState({
|
|
3964
|
+
selectedElementIds: F({}, this.state),
|
|
3965
|
+
selectedGroupIds: {},
|
|
3966
|
+
editingGroupId: null,
|
|
3967
|
+
activeEmbeddable: null
|
|
3968
|
+
}), W(this.interactiveCanvas, u.AUTO);
|
|
3969
|
+
return;
|
|
3970
|
+
}
|
|
3971
|
+
if (!s.locked && s.type !== "freedraw" && r && this.setState((e) => ({ selectedElementIds: F({
|
|
3972
|
+
...e.selectedElementIds,
|
|
3973
|
+
[r.id]: !0
|
|
3974
|
+
}, e) })), (s.type !== "selection" || wt(this.scene.getNonDeletedElements(), this.state) || !Ve(this.state.previousSelectedElementIds, this.state.selectedElementIds)) && this.#r.scheduleCapture(), (e.drag.hasOccurred && !this.state.selectedLinearElement || c || l || d) && gn(this.scene.getSelectedElements(this.state).filter(at), this.scene, this.state), s.type === "laser") {
|
|
3975
|
+
this.laserTrails.endPath();
|
|
3976
|
+
return;
|
|
3977
|
+
}
|
|
3978
|
+
!s.locked && s.type !== "freedraw" && (s.type !== "lasso" || s.type === "lasso" && s.fromSelection) ? (U(this.interactiveCanvas), this.setState({
|
|
3979
|
+
newElement: null,
|
|
3980
|
+
suggestedBinding: null,
|
|
3981
|
+
activeTool: D(this.state, { type: this.state.preferredSelectionTool.type })
|
|
3982
|
+
})) : this.setState({
|
|
3983
|
+
newElement: null,
|
|
3984
|
+
suggestedBinding: null
|
|
3985
|
+
}), m && this.lastPointerUpEvent && this.lastPointerDownEvent && this.lastPointerUpEvent.timeStamp - this.lastPointerDownEvent.timeStamp < 300 && $.pointers.size <= 1 && ft(m) && this.#v(m, this.lastPointerUpEvent, e.origin.x, e.origin.y) && this.#_(m);
|
|
3986
|
+
});
|
|
3987
|
+
}
|
|
3988
|
+
#at;
|
|
3989
|
+
#ot;
|
|
3990
|
+
#st;
|
|
3991
|
+
#ct;
|
|
3992
|
+
#lt;
|
|
3993
|
+
#ut;
|
|
3994
|
+
#dt;
|
|
3995
|
+
#ft;
|
|
3996
|
+
#pt;
|
|
3997
|
+
#mt;
|
|
3998
|
+
#ht(e) {
|
|
3999
|
+
this.setState((t) => ({
|
|
4000
|
+
selectedElementIds: F({}, t),
|
|
4001
|
+
activeEmbeddable: null,
|
|
4002
|
+
selectedGroupIds: {},
|
|
4003
|
+
editingGroupId: t.editingGroupId && e != null && Ht(e, t.editingGroupId) ? t.editingGroupId : null
|
|
4004
|
+
})), this.setState({
|
|
4005
|
+
selectedElementIds: F({}, this.state),
|
|
4006
|
+
activeEmbeddable: null,
|
|
4007
|
+
previousSelectedElementIds: this.state.selectedElementIds,
|
|
4008
|
+
selectedLinearElement: null
|
|
4009
|
+
});
|
|
4010
|
+
}
|
|
4011
|
+
#gt;
|
|
4012
|
+
#_t;
|
|
4013
|
+
#vt;
|
|
4014
|
+
#yt;
|
|
4015
|
+
#bt;
|
|
4016
|
+
#xt;
|
|
4017
|
+
#St;
|
|
4018
|
+
#Ct;
|
|
4019
|
+
#wt;
|
|
4020
|
+
#Tt(e, t, n, r) {
|
|
4021
|
+
if (r) {
|
|
4022
|
+
let i = r.x + r.width / 2, a = r.y + r.height / 2, o = Pt(r, n, this.scene.getNonDeletedElementsMap());
|
|
4023
|
+
if (o && (i = o.x, a = o.y), Math.hypot(e - i, t - a) < 30) {
|
|
4024
|
+
let { x: e, y: t } = qe({
|
|
4025
|
+
sceneX: i,
|
|
4026
|
+
sceneY: a
|
|
4027
|
+
}, n);
|
|
4028
|
+
return {
|
|
4029
|
+
viewportX: e,
|
|
4030
|
+
viewportY: t,
|
|
4031
|
+
elementCenterX: i,
|
|
4032
|
+
elementCenterY: a
|
|
4033
|
+
};
|
|
4034
|
+
}
|
|
4035
|
+
}
|
|
4036
|
+
}
|
|
4037
|
+
#Et;
|
|
4038
|
+
#Dt;
|
|
4039
|
+
#Ot;
|
|
4040
|
+
#kt() {
|
|
4041
|
+
if (this.rootElement) {
|
|
4042
|
+
let { left: e, top: t } = this.rootElement.getBoundingClientRect();
|
|
4043
|
+
return {
|
|
4044
|
+
offsetLeft: e,
|
|
4045
|
+
offsetTop: t
|
|
4046
|
+
};
|
|
4047
|
+
}
|
|
4048
|
+
return {
|
|
4049
|
+
offsetLeft: 0,
|
|
4050
|
+
offsetTop: 0
|
|
4051
|
+
};
|
|
4052
|
+
}
|
|
4053
|
+
async #At() {
|
|
4054
|
+
await Gr(Wr.find((e) => e.code === this.props.langCode) || Hr), this.setAppState({});
|
|
4055
|
+
}
|
|
4056
|
+
};
|
|
4057
|
+
(He() || Re()) && (window.h = window.h || {}, Object.defineProperties(window.h, {
|
|
4058
|
+
elements: {
|
|
4059
|
+
configurable: !0,
|
|
4060
|
+
get() {
|
|
4061
|
+
return this.app?.scene?.getElementsIncludingDeleted?.();
|
|
4062
|
+
},
|
|
4063
|
+
set(e) {
|
|
4064
|
+
return this.app?.scene?.replaceAllElements?.(Cn(e));
|
|
4065
|
+
}
|
|
4066
|
+
},
|
|
4067
|
+
scene: {
|
|
4068
|
+
configurable: !0,
|
|
4069
|
+
get() {
|
|
4070
|
+
return this.app?.scene;
|
|
4071
|
+
}
|
|
4072
|
+
}
|
|
4073
|
+
}));
|
|
4074
|
+
//#endregion
|
|
4075
|
+
export { yo as default };
|
|
4076
|
+
/* 独立思考,明辨是非 */
|