@unicom-cloud/ui 0.8.172 → 0.8.173
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.js +1 -1
- package/affix/constants.js +1 -1
- package/affix/context.js +1 -1
- package/affix/index.js +1 -1
- package/affix/style/index.js +1 -1
- package/alert/Alert.js +1 -1
- package/alert/constants.js +1 -1
- package/alert/context.js +1 -1
- package/alert/index.js +1 -1
- package/alert/style/index.js +1 -1
- package/anchor/Anchor.js +1 -1
- package/anchor/Link.js +1 -1
- package/anchor/constants.js +1 -1
- package/anchor/context.js +1 -1
- package/anchor/index.js +1 -1
- package/anchor/style/index.js +1 -1
- package/anchor/utils.js +1 -1
- package/animation/Animation.js +1 -1
- package/animation/constants.js +1 -1
- package/animation/context.js +1 -1
- package/animation/index.js +1 -1
- package/animation/style/index.js +1 -1
- package/app/App.js +1 -1
- package/app/constants.js +1 -1
- package/app/context.js +1 -1
- package/app/index.js +1 -1
- package/app/style/index.js +1 -1
- package/app/useApp.js +1 -1
- package/auto-complete/AutoComplete.js +1 -1
- package/auto-complete/constants.js +1 -1
- package/auto-complete/context.js +1 -1
- package/auto-complete/index.js +1 -1
- package/auto-complete/style/index.js +1 -1
- package/avatar/Avatar.js +1 -1
- package/avatar/Group.js +1 -1
- package/avatar/constants.js +1 -1
- package/avatar/context.js +1 -1
- package/avatar/index.js +1 -1
- package/avatar/style/index.js +1 -1
- package/back-top/BackTop.js +1 -1
- package/back-top/constants.js +1 -1
- package/back-top/context.js +1 -1
- package/back-top/index.js +1 -1
- package/back-top/style/index.js +1 -1
- package/badge/Badge.js +1 -1
- package/badge/Count.js +1 -1
- package/badge/constants.js +1 -1
- package/badge/context.js +1 -1
- package/badge/index.js +1 -1
- package/badge/style/index.js +1 -1
- package/badge/utils.js +1 -1
- package/border-beam/BorderBeam.js +1 -1
- package/border-beam/constants.js +1 -1
- package/border-beam/context.js +1 -1
- package/border-beam/index.js +1 -1
- package/border-beam/style/index.js +1 -1
- package/breadcrumb/Breadcrumb.js +1 -1
- package/breadcrumb/Item.js +1 -1
- package/breadcrumb/constants.js +1 -1
- package/breadcrumb/context.js +1 -1
- package/breadcrumb/index.js +1 -1
- package/breadcrumb/style/index.js +1 -1
- package/button/Button.js +1 -1
- package/button/Group.js +1 -1
- package/button/Toggle.js +1 -1
- package/button/constants.js +1 -1
- package/button/context.js +1 -1
- package/button/index.js +1 -1
- package/button/style/index.js +1 -1
- package/calendar/Calendar.js +1 -1
- package/calendar/Month.js +1 -1
- package/calendar/WeekList.js +1 -1
- package/calendar/Year.js +1 -1
- package/calendar/constants.js +1 -1
- package/calendar/context.js +1 -1
- package/calendar/header/Panel.js +1 -1
- package/calendar/header/index.js +1 -1
- package/calendar/hooks/useCellClassName.js +1 -1
- package/calendar/index.js +1 -1
- package/calendar/style/index.js +1 -1
- package/card/Card.js +1 -1
- package/card/Grid.js +1 -1
- package/card/Meta.js +1 -1
- package/card/constants.js +1 -1
- package/card/context.js +1 -1
- package/card/index.js +1 -1
- package/card/style/index.js +1 -1
- package/carousel/Arrow.js +1 -1
- package/carousel/Carousel.js +1 -1
- package/carousel/Indicator.js +1 -1
- package/carousel/constants.js +1 -1
- package/carousel/context.js +1 -1
- package/carousel/index.js +1 -1
- package/carousel/style/index.js +1 -1
- package/cascader/Cascader.js +1 -1
- package/cascader/base/node.js +1 -1
- package/cascader/base/store.js +1 -1
- package/cascader/constants.js +1 -1
- package/cascader/context.js +1 -1
- package/cascader/hooks/useRefCurrent.js +1 -1
- package/cascader/index.js +1 -1
- package/cascader/panel/List.js +1 -1
- package/cascader/panel/Option.js +1 -1
- package/cascader/panel/Search.js +1 -1
- package/cascader/style/index.js +1 -1
- package/cascader/utils.js +1 -1
- package/checkbox/Checkbox.js +1 -1
- package/checkbox/Group.js +1 -1
- package/checkbox/GroupBlock.js +1 -1
- package/checkbox/constants.js +1 -1
- package/checkbox/context.js +1 -1
- package/checkbox/index.js +1 -1
- package/checkbox/style/index.js +1 -1
- package/checkbox/useCheckbox.js +1 -1
- package/collapse/Collapse.js +1 -1
- package/collapse/Item.js +1 -1
- package/collapse/constants.js +1 -1
- package/collapse/context.js +1 -1
- package/collapse/index.js +1 -1
- package/collapse/style/index.js +1 -1
- package/collapse/utils.js +1 -1
- package/color-picker/ColorPicker.js +1 -1
- 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 +1 -1
- package/color-picker/colors.js +1 -1
- package/color-picker/constants.js +1 -1
- package/color-picker/context.js +1 -1
- package/color-picker/hooks/useColorPicker.js +1 -1
- package/color-picker/hooks/useControlBlock.js +1 -1
- package/color-picker/index.js +1 -1
- package/color-picker/interface.js +1 -1
- package/color-picker/style/index.js +1 -1
- package/color-picker/utils.js +1 -1
- package/comment/Comment.js +1 -1
- package/comment/constants.js +1 -1
- package/comment/context.js +1 -1
- package/comment/index.js +1 -1
- package/comment/style/index.js +1 -1
- package/config-provider/ConfigProvider.js +1 -1
- package/config-provider/constants.js +1 -1
- package/config-provider/context.js +1 -1
- package/config-provider/index.js +1 -1
- package/config-provider/initUI.js +1 -1
- package/config-provider/style/index.js +1 -1
- package/config-provider/useConfigProvider.js +1 -1
- package/config-provider/utils.js +1 -1
- package/constants/index.js +1 -1
- package/copy/Copy.js +1 -1
- package/copy/constants.js +1 -1
- package/copy/context.js +1 -1
- package/copy/index.js +1 -1
- package/copy/style/index.js +1 -1
- package/countdown/Countdown.js +1 -1
- package/countdown/constants.js +1 -1
- package/countdown/context.js +1 -1
- package/countdown/index.js +1 -1
- package/countdown/style/index.js +1 -1
- package/countdown/utils.js +1 -1
- package/date-picker/DatePicker.js +1 -1
- package/date-picker/Picker.js +1 -1
- package/date-picker/Range.js +1 -1
- package/date-picker/constants.js +1 -1
- package/date-picker/context.js +1 -1
- package/date-picker/hooks/useCellClassName.js +1 -1
- package/date-picker/index.js +1 -1
- package/date-picker/panel/Body.js +1 -1
- package/date-picker/panel/Footer.js +1 -1
- package/date-picker/panel/Header.js +1 -1
- package/date-picker/panel/Shortcut.js +1 -1
- package/date-picker/panel/WeekList.js +1 -1
- package/date-picker/panel/date/index.js +1 -1
- package/date-picker/panel/month/index.js +1 -1
- package/date-picker/panel/quarter/index.js +1 -1
- package/date-picker/panel/range/index.js +1 -1
- package/date-picker/panel/week/index.js +1 -1
- package/date-picker/panel/year/index.js +1 -1
- package/date-picker/style/index.js +1 -1
- package/date-picker/utils.js +1 -1
- package/descriptions/Descriptions.js +1 -1
- package/descriptions/constants.js +1 -1
- package/descriptions/context.js +1 -1
- package/descriptions/index.js +1 -1
- package/descriptions/style/index.js +1 -1
- package/details/Details.js +1 -1
- package/details/constants.js +1 -1
- package/details/context.js +1 -1
- package/details/index.js +1 -1
- package/details/style/index.js +1 -1
- package/development/Development.js +1 -1
- package/development/constants.js +1 -1
- package/development/context.js +1 -1
- package/development/index.js +1 -1
- package/development/style/index.js +1 -1
- package/divider/Divider.js +1 -1
- package/divider/constants.js +1 -1
- package/divider/context.js +1 -1
- package/divider/index.js +1 -1
- package/divider/style/index.js +1 -1
- package/draggable/Draggable.js +1 -1
- package/draggable/Item.js +1 -1
- package/draggable/constants.js +1 -1
- package/draggable/context.js +1 -1
- package/draggable/index.js +1 -1
- package/draggable/style/index.js +1 -1
- package/draw/Draw.js +13 -13
- package/draw/{core/actions → actions}/actionAddToLibrary.d.ts +109 -109
- package/draw/{core/actions → actions}/actionAddToLibrary.js +8 -8
- package/draw/{core/actions → actions}/actionAlign.d.ts +14 -14
- package/draw/{core/actions → actions}/actionAlign.js +13 -13
- package/draw/{core/actions → actions}/actionBoundText.d.ts +72 -72
- package/draw/{core/actions → actions}/actionBoundText.js +13 -13
- package/draw/{core/actions → actions}/actionCanvas.d.ts +420 -420
- package/draw/{core/actions → actions}/actionCanvas.js +32 -32
- package/draw/{core/actions → actions}/actionClipboard.d.ts +81 -81
- package/draw/{core/actions → actions}/actionClipboard.js +9 -9
- package/draw/{core/actions → actions}/actionCropEditor.d.ts +37 -37
- package/draw/{core/actions → actions}/actionCropEditor.js +6 -6
- package/draw/{core/actions → actions}/actionDeleteSelected.d.ts +97 -97
- package/draw/{core/actions → actions}/actionDeleteSelected.js +16 -16
- package/draw/{core/actions → actions}/actionDistribute.d.ts +4 -4
- package/draw/{core/actions → actions}/actionDistribute.js +13 -13
- package/draw/{core/actions → actions}/actionDuplicateSelection.d.ts +3 -3
- package/draw/{core/actions → actions}/actionDuplicateSelection.js +12 -12
- package/draw/{core/actions → actions}/actionElementLink.d.ts +45 -45
- package/draw/{core/actions → actions}/actionElementLink.js +11 -11
- package/draw/{core/actions → actions}/actionElementLock.d.ts +73 -73
- package/draw/{core/actions → actions}/actionElementLock.js +11 -11
- package/draw/{core/actions → actions}/actionEmbeddable.d.ts +38 -38
- package/draw/{core/actions → actions}/actionEmbeddable.js +5 -5
- package/draw/{core/actions → actions}/actionExport.d.ts +85 -85
- package/draw/{core/actions → actions}/actionExport.js +13 -13
- package/draw/{core/actions → actions}/actionFinalize.d.ts +3 -3
- package/draw/{core/actions → actions}/actionFinalize.js +16 -16
- package/draw/{core/actions → actions}/actionFlip.d.ts +4 -4
- package/draw/{core/actions → actions}/actionFlip.js +15 -15
- package/draw/{core/actions → actions}/actionFrame.d.ts +250 -250
- package/draw/{core/actions → actions}/actionFrame.js +14 -14
- package/draw/{core/actions → actions}/actionGroup.d.ts +65 -65
- package/draw/{core/actions → actions}/actionGroup.js +15 -15
- package/draw/{core/actions → actions}/actionHistory.d.ts +2 -2
- package/draw/{core/actions → actions}/actionHistory.js +9 -9
- package/draw/{core/actions → actions}/actionLinearEditor.d.ts +159 -159
- package/draw/{core/actions → actions}/actionLinearEditor.js +10 -10
- package/draw/{core/actions → actions}/actionMenu.d.ts +36 -36
- package/draw/{core/actions → actions}/actionMenu.js +6 -6
- package/draw/{core/actions → actions}/actionProperties.d.ts +62 -62
- package/draw/{core/actions → actions}/actionProperties.js +194 -194
- package/draw/{core/actions → actions}/actionSelectAll.d.ts +35 -35
- package/draw/{core/actions → actions}/actionSelectAll.js +10 -10
- package/draw/{core/actions → actions}/actionStyles.d.ts +40 -40
- package/draw/{core/actions → actions}/actionStyles.js +12 -12
- package/draw/actions/actionTextAutoResize.d.ts +17 -0
- package/draw/{core/actions → actions}/actionTextAutoResize.js +10 -10
- package/draw/{core/actions → actions}/actionToggleGridMode.d.ts +39 -39
- package/draw/{core/actions → actions}/actionToggleGridMode.js +6 -6
- package/draw/{core/actions → actions}/actionToggleObjectsSnapMode.d.ts +40 -40
- package/draw/{core/actions → actions}/actionToggleObjectsSnapMode.js +6 -6
- package/draw/{core/actions → actions}/actionToggleSearchMenu.d.ts +36 -36
- package/draw/{core/actions → actions}/actionToggleSearchMenu.js +6 -6
- package/draw/actions/actionToggleShapeSwitch.d.ts +19 -0
- package/draw/{core/actions → actions}/actionToggleStats.d.ts +38 -38
- package/draw/{core/actions → actions}/actionToggleStats.js +6 -6
- package/draw/{core/actions → actions}/actionToggleViewMode.d.ts +40 -40
- package/draw/{core/actions → actions}/actionToggleViewMode.js +6 -6
- package/draw/{core/actions → actions}/actionToggleZenMode.d.ts +40 -40
- package/draw/{core/actions → actions}/actionToggleZenMode.js +6 -6
- package/draw/{core/actions → actions}/actionZindex.d.ts +12 -12
- package/draw/{core/actions → actions}/actionZindex.js +9 -9
- package/draw/{core/actions → actions}/index.js +1 -1
- package/draw/{core/actions → actions}/manager.d.ts +2 -2
- package/draw/{core/actions → actions}/manager.js +4 -4
- package/draw/actions/register.js +6 -0
- package/draw/{core/actions → actions}/shortcuts.d.ts +1 -1
- package/draw/{core/actions → actions}/shortcuts.js +4 -4
- package/draw/{core/actions → actions}/types.d.ts +3 -3
- package/draw/{core/analytics.js → analytics.js} +4 -4
- package/draw/{core/animated-trail.d.ts → animated-trail.d.ts} +2 -2
- package/draw/{core/animated-trail.js → animated-trail.js} +7 -7
- package/draw/{core/animation-frame-handler.js → animation-frame-handler.js} +2 -2
- package/draw/{core/appState.d.ts → appState.d.ts} +15 -15
- package/draw/{core/appState.js → appState.js} +8 -8
- package/draw/{core/charts.d.ts → charts.d.ts} +1 -1
- package/draw/{core/charts.js → charts.js} +12 -12
- package/draw/{core/clients.d.ts → clients.d.ts} +1 -1
- package/draw/{core/clients.js → clients.js} +9 -6
- package/draw/{core/clipboard.d.ts → clipboard.d.ts} +5 -5
- package/draw/{core/clipboard.js → clipboard.js} +45 -45
- package/draw/common/binary-heap.js +1 -1
- package/draw/common/bounds.js +1 -1
- package/draw/common/colors.js +1 -1
- package/draw/common/constants.d.ts +1 -1
- package/draw/common/constants.js +4 -4
- package/draw/common/editorInterface.js +1 -1
- package/draw/common/emitter.js +1 -1
- package/draw/common/font-metadata.js +1 -1
- package/draw/common/index.js +1 -1
- package/draw/common/keys.js +1 -1
- package/draw/common/points.js +1 -1
- package/draw/common/promise-pool.js +1 -1
- package/draw/common/queue.js +1 -1
- package/draw/common/random.js +1 -1
- package/draw/common/url.js +2 -2
- package/draw/common/utils.js +1 -1
- package/draw/{core/components → components}/Actions.d.ts +2 -2
- package/draw/components/Actions.js +493 -0
- package/draw/{core/components → components}/ActiveConfirmDialog.js +4 -4
- package/draw/{core/components → components}/App.d.ts +18 -18
- package/draw/{core/components → components}/App.js +676 -676
- package/draw/{core/components → components}/BraveMeasureTextError.js +2 -2
- package/draw/{core/components → components}/ContextMenu.js +2 -2
- package/draw/{core/components → components}/ConvertElementTypePopup.d.ts +2 -2
- package/draw/{core/components → components}/ConvertElementTypePopup.js +37 -37
- package/draw/{core/components → components}/DarkModeToggle.d.ts +1 -1
- package/draw/{core/components → components}/DarkModeToggle.js +5 -5
- package/draw/{core/components → components}/ElementCanvasButtons.d.ts +1 -1
- package/draw/{core/components → components}/ElementCanvasButtons.js +6 -6
- package/draw/{core/components → components}/ElementLinkDialog.d.ts +3 -3
- package/draw/{core/components → components}/ElementLinkDialog.js +12 -12
- package/draw/{core/components → components}/Ellipsify.js +2 -2
- package/draw/{core/components → components}/ErrorDialog.js +3 -3
- package/draw/{core/components → components}/ExportDialog.d.ts +2 -2
- package/draw/{core/components → components}/ExportDialog.js +4 -4
- package/draw/{core/components → components}/EyeDropper.d.ts +1 -1
- package/draw/{core/components → components}/EyeDropper.js +7 -7
- package/draw/{core/components → components}/FixedSideContainer.js +2 -2
- package/draw/{core/components → components}/Footer.d.ts +2 -2
- package/draw/{core/components → components}/Footer.js +8 -8
- package/draw/{core/components → components}/HandButton.js +5 -5
- package/draw/{core/components → components}/HelpDialog.js +6 -6
- package/draw/{core/components → components}/HintViewer.d.ts +2 -2
- package/draw/{core/components → components}/HintViewer.js +17 -17
- package/draw/{core/components → components}/ImageExportDialog.d.ts +2 -2
- package/draw/{core/components → components}/ImageExportDialog.js +14 -14
- package/draw/{core/components → components}/InitializeApp.d.ts +1 -1
- package/draw/{core/components → components}/InitializeApp.js +2 -2
- package/draw/{core/components → components}/InlineIcon.js +2 -2
- package/draw/{core/components → components}/Island.js +2 -2
- package/draw/{core/components → components}/LaserPointerButton.js +2 -2
- package/draw/{core/components → components}/LayerUI.d.ts +2 -2
- package/draw/{core/components → components}/LayerUI.js +21 -21
- package/draw/{core/components → components}/LibraryMenu.js +14 -14
- package/draw/{core/components → components}/LibraryMenuItems.d.ts +1 -1
- package/draw/{core/components → components}/LibraryMenuItems.js +15 -15
- package/draw/{core/components → components}/LibraryMenuSection.d.ts +2 -2
- package/draw/{core/components → components}/LibraryMenuSection.js +3 -3
- package/draw/{core/components → components}/LibraryUnit.d.ts +1 -1
- package/draw/{core/components → components}/LibraryUnit.js +3 -3
- package/draw/{core/components → components}/LoadingMessage.d.ts +1 -1
- package/draw/{core/components → components}/LoadingMessage.js +3 -3
- package/draw/{core/components → components}/LockButton.js +4 -4
- package/draw/{core/components → components}/MagicButton.js +2 -2
- package/draw/{core/components → components}/PasteChartDialog.d.ts +1 -1
- package/draw/{core/components → components}/PasteChartDialog.js +3 -3
- package/draw/{core/components → components}/PenModeButton.js +2 -2
- package/draw/{core/components → components}/Popover.js +5 -5
- package/draw/{core/components → components}/ProjectName.js +5 -5
- package/draw/{core/components → components}/Range.d.ts +1 -1
- package/draw/{core/components → components}/Range.js +4 -4
- package/draw/{core/components → components}/SVGLayer.js +2 -2
- package/draw/{core/components → components}/SearchMenu.js +21 -21
- package/draw/{core/components → components}/Stack.js +1 -1
- package/draw/{core/components → components}/Toast.js +3 -3
- package/draw/{core/components → components}/Trans.js +2 -2
- package/draw/{core/components → components}/UnlockPopup.d.ts +1 -1
- package/draw/{core/components → components}/UnlockPopup.js +7 -7
- package/draw/{core/components → components}/canvases/InteractiveCanvas.d.ts +3 -3
- package/draw/{core/components → components}/canvases/InteractiveCanvas.js +5 -5
- package/draw/{core/components → components}/canvases/NewElementCanvas.d.ts +3 -3
- package/draw/{core/components → components}/canvases/NewElementCanvas.js +2 -2
- package/draw/{core/components → components}/canvases/StaticCanvas.d.ts +3 -3
- package/draw/{core/components → components}/canvases/StaticCanvas.js +4 -4
- package/draw/components/canvases/index.js +4 -0
- package/draw/{core/components → components}/context.d.ts +3 -3
- package/draw/{core/components → components}/context.js +4 -4
- package/draw/{core/components → components}/diagram-to-code-plugin/index.d.ts +1 -1
- package/draw/{core/components → components}/diagram-to-code-plugin/index.js +2 -2
- package/draw/{core/components → components}/hooks.d.ts +6 -6
- package/draw/{core/components → components}/hooks.js +4 -4
- package/draw/{core/components → components}/icons.d.ts +1 -1
- package/draw/{core/components → components}/icons.js +4 -4
- package/draw/{core/components → components}/main-menu/DefaultItems.d.ts +1 -1
- package/draw/{core/components → components}/main-menu/DefaultItems.js +4 -4
- package/draw/{core/components → components}/main-menu/MenuItem.js +4 -4
- package/draw/{core/components → components}/main-menu/common.js +5 -5
- package/draw/{core/components → components}/overwrite-confirm/State.js +3 -3
- package/draw/{core/components → components}/overwrite-confirm/index.js +7 -7
- package/draw/{core/components → components}/shapes.d.ts +1 -1
- package/draw/{core/components → components}/shapes.js +4 -4
- package/draw/{core/components → components}/stats/Angle.d.ts +3 -3
- package/draw/{core/components → components}/stats/Angle.js +8 -8
- package/draw/{core/components → components}/stats/CanvasGrid.d.ts +2 -2
- package/draw/{core/components → components}/stats/CanvasGrid.js +2 -2
- package/draw/{core/components → components}/stats/Collapsible.js +2 -2
- package/draw/{core/components → components}/stats/Dimension.d.ts +3 -3
- package/draw/{core/components → components}/stats/Dimension.js +10 -10
- package/draw/{core/components → components}/stats/DragInput.d.ts +3 -3
- package/draw/{core/components → components}/stats/DragInput.js +9 -9
- package/draw/{core/components → components}/stats/FontSize.d.ts +3 -3
- package/draw/{core/components → components}/stats/FontSize.js +5 -5
- package/draw/{core/components → components}/stats/MultiAngle.d.ts +3 -3
- package/draw/{core/components → components}/stats/MultiAngle.js +8 -8
- package/draw/{core/components → components}/stats/MultiDimension.d.ts +3 -3
- package/draw/{core/components → components}/stats/MultiDimension.js +13 -13
- package/draw/{core/components → components}/stats/MultiFontSize.d.ts +3 -3
- package/draw/{core/components → components}/stats/MultiFontSize.js +6 -6
- package/draw/{core/components → components}/stats/MultiPosition.d.ts +3 -3
- package/draw/{core/components → components}/stats/MultiPosition.js +7 -7
- package/draw/{core/components → components}/stats/Position.d.ts +3 -3
- package/draw/{core/components → components}/stats/Position.js +8 -8
- package/draw/{core/components → components}/stats/index.d.ts +2 -2
- package/draw/{core/components → components}/stats/index.js +12 -12
- package/draw/{core/components → components}/stats/utils.d.ts +3 -3
- package/draw/{core/components → components}/stats/utils.js +11 -11
- package/draw/constants.js +1 -1
- package/draw/{core/context → context}/tunnels.d.ts +9 -9
- package/draw/{core/context → context}/tunnels.js +6 -6
- package/draw/{core/context → context}/ui-appState.d.ts +1 -1
- package/draw/context/ui-appState.js +7 -0
- package/draw/context.js +1 -1
- package/draw/{core/cursor.d.ts → cursor.d.ts} +1 -1
- package/draw/{core/cursor.js → cursor.js} +4 -4
- package/draw/{core/data → data}/EditorLocalStorage.d.ts +2 -2
- package/draw/{core/data → data}/blob.d.ts +69 -69
- package/draw/{core/data → data}/blob.js +25 -25
- package/draw/{core/data → data}/encode.js +3 -3
- package/draw/data/encryption.js +4 -0
- package/draw/{core/data → data}/filesystem.d.ts +3 -3
- package/draw/{core/data → data}/filesystem.js +9 -9
- package/draw/{core/data → data}/image.js +7 -7
- package/draw/data/index.js +5 -0
- package/draw/{core/data → data}/json.d.ts +33 -33
- package/draw/{core/data → data}/json.js +4 -4
- package/draw/{core/data → data}/library.d.ts +3 -3
- package/draw/{core/data → data}/library.js +32 -32
- package/draw/{core/data → data}/reconcile.d.ts +3 -3
- package/draw/{core/data → data}/reconcile.js +6 -6
- package/draw/{core/data → data}/resave.d.ts +2 -2
- package/draw/{core/data → data}/resave.js +2 -2
- package/draw/{core/data → data}/restore.d.ts +3 -3
- package/draw/{core/data → data}/restore.js +49 -49
- package/draw/{core/data → data}/types.d.ts +3 -3
- package/draw/{core/data → data}/utils.d.ts +2 -2
- package/draw/{core/data → data}/utils.js +10 -10
- package/draw/{core/deburr.js → deburr.js} +2 -2
- package/draw/editor-jotai.d.ts +7 -0
- package/draw/editor-jotai.js +11 -0
- package/draw/element/Scene.js +1 -1
- package/draw/element/align.js +1 -1
- package/draw/element/arrows/focus.js +1 -1
- package/draw/element/arrows/helpers.js +1 -1
- package/draw/element/binding.js +1 -1
- package/draw/element/bounds.js +1 -1
- package/draw/element/collision.js +1 -1
- package/draw/element/comparisons.js +1 -1
- package/draw/element/containerCache.js +1 -1
- package/draw/element/cropElement.js +1 -1
- package/draw/element/delta.js +1 -1
- package/draw/element/distance.js +1 -1
- package/draw/element/distribute.js +1 -1
- package/draw/element/dragElements.js +1 -1
- package/draw/element/duplicate.js +1 -1
- package/draw/element/elbowArrow.js +1 -1
- package/draw/element/elementLink.js +1 -1
- package/draw/element/embeddable.js +1 -1
- package/draw/element/flowchart.js +1 -1
- package/draw/element/fractionalIndex.js +1 -1
- package/draw/element/frame.js +1 -1
- package/draw/element/groups.js +1 -1
- package/draw/element/heading.js +1 -1
- package/draw/element/image.js +1 -1
- package/draw/element/index.js +1 -1
- package/draw/element/is.js +1 -1
- package/draw/element/linearElementEditor.js +1 -1
- package/draw/element/mutateElement.js +1 -1
- package/draw/element/newElement.js +1 -1
- package/draw/element/positionElementsOnGrid.js +1 -1
- package/draw/element/renderElement.d.ts +1 -1
- package/draw/element/renderElement.js +1 -1
- package/draw/element/resizeElements.js +1 -1
- package/draw/element/resizeTest.js +1 -1
- package/draw/element/selection.js +1 -1
- package/draw/element/shape.d.ts +1 -1
- package/draw/element/shape.js +1 -1
- package/draw/element/showSelectedShapeActions.js +1 -1
- package/draw/element/sizeHelpers.js +1 -1
- package/draw/element/sortElements.js +1 -1
- package/draw/element/store.d.ts +1 -1
- package/draw/element/store.js +1 -1
- package/draw/element/textElement.js +1 -1
- package/draw/element/textMeasurements.js +1 -1
- package/draw/element/textWrapping.js +1 -1
- package/draw/element/transform.js +1 -1
- package/draw/element/transformHandles.js +1 -1
- package/draw/element/typeChecks.js +1 -1
- package/draw/element/utils.js +1 -1
- package/draw/element/zindex.js +1 -1
- package/draw/{core/eraser → eraser}/index.js +17 -17
- package/draw/errors.js +41 -0
- package/draw/{core/fonts → fonts}/DrawFontFace.js +2 -2
- package/draw/{core/fonts → fonts}/Fonts.d.ts +3 -3
- package/draw/{core/fonts → fonts}/Fonts.js +12 -12
- package/draw/fonts/index.js +3 -0
- package/draw/{core/gesture.d.ts → gesture.d.ts} +1 -1
- package/draw/{core/gesture.js → gesture.js} +2 -2
- package/draw/{core/history.d.ts → history.d.ts} +5 -5
- package/draw/{core/history.js → history.js} +7 -7
- package/draw/{core/hooks → hooks}/useCopiedIndicator.js +2 -2
- package/draw/{core/hooks → hooks}/useCreatePortalContainer.js +4 -4
- package/draw/{core/hooks → hooks}/useEmitter.d.ts +1 -1
- package/draw/{core/hooks → hooks}/useEmitter.js +2 -2
- package/draw/{core/hooks → hooks}/useLibraryItemSvg.d.ts +1 -1
- package/draw/{core/hooks → hooks}/useLibraryItemSvg.js +6 -6
- package/draw/{core/hooks → hooks}/useOutsideClick.js +4 -4
- package/draw/{core/hooks → hooks}/useScrollPosition.js +3 -3
- package/draw/{core/hooks → hooks}/useStable.js +2 -2
- package/draw/{core/hooks → hooks}/useTextEditorFocus.js +2 -2
- package/draw/{core/hooks → hooks}/useTransition.js +2 -2
- package/draw/{core/i18n.d.ts → i18n.d.ts} +1 -1
- package/draw/{core/i18n.js → i18n.js} +3 -3
- package/draw/index.d.ts +13 -13
- package/draw/index.js +48 -48
- package/draw/interface.d.ts +11 -11
- package/draw/{core/laser-trails.js → laser-trails.js} +5 -5
- package/draw/{core/lasso → lasso}/index.js +13 -13
- package/draw/{core/lasso → lasso}/utils.d.ts +2 -2
- package/draw/{core/lasso → lasso}/utils.js +10 -10
- package/draw/libs/browser-fs-access/directory-open.js +1 -1
- package/draw/libs/browser-fs-access/file-open.js +1 -1
- package/draw/libs/browser-fs-access/file-save.js +1 -1
- package/draw/libs/browser-fs-access/fs-access/directory-open.js +1 -1
- package/draw/libs/browser-fs-access/fs-access/file-open.js +1 -1
- package/draw/libs/browser-fs-access/fs-access/file-save.js +1 -1
- package/draw/libs/browser-fs-access/index.js +1 -1
- package/draw/libs/browser-fs-access/legacy/directory-open.js +1 -1
- package/draw/libs/browser-fs-access/legacy/file-open.js +1 -1
- package/draw/libs/browser-fs-access/legacy/file-save.js +1 -1
- package/draw/libs/browser-fs-access/supported.js +1 -1
- package/draw/libs/fractional-indexing/index.js +1 -1
- package/draw/libs/fuzzy/index.js +1 -1
- package/draw/libs/glur/index.js +1 -1
- package/draw/libs/glur/mono16.js +1 -1
- package/draw/libs/hachure-fill/index.js +1 -1
- package/draw/libs/image-blob-reduce/index.js +1 -1
- package/draw/libs/image-blob-reduce/lib/image_traverse.js +1 -1
- package/draw/libs/image-blob-reduce/lib/jpeg_plugins.js +1 -1
- package/draw/libs/image-blob-reduce/lib/utils.js +1 -1
- package/draw/libs/jotai/index.js +1 -1
- package/draw/libs/jotai/react/Provider.js +1 -1
- package/draw/libs/jotai/react/useAtom.js +1 -1
- package/draw/libs/jotai/react/useAtomValue.js +1 -1
- package/draw/libs/jotai/react/useSetAtom.js +1 -1
- package/draw/libs/jotai/react/utils/useAtomCallback.js +1 -1
- package/draw/libs/jotai/react/utils/useHydrateAtoms.js +1 -1
- package/draw/libs/jotai/react/utils/useReducerAtom.js +1 -1
- package/draw/libs/jotai/react/utils/useResetAtom.js +1 -1
- package/draw/libs/jotai/react/utils.js +1 -1
- package/draw/libs/jotai/react.js +1 -1
- package/draw/libs/jotai/utils.js +1 -1
- package/draw/libs/jotai/vanilla/atom.js +1 -1
- package/draw/libs/jotai/vanilla/internals.js +1 -1
- package/draw/libs/jotai/vanilla/store.js +1 -1
- package/draw/libs/jotai/vanilla/utils/atomFamily.js +1 -1
- package/draw/libs/jotai/vanilla/utils/atomWithStorage.js +1 -1
- package/draw/libs/jotai/vanilla/utils.js +1 -1
- package/draw/libs/jotai-scope/createIsolation.js +1 -1
- package/draw/libs/jotai-scope/index.js +1 -1
- package/draw/libs/jotai-scope/scope-provider/index.js +1 -1
- package/draw/libs/jotai-scope/scope-provider/scope.js +1 -1
- package/draw/libs/jotai-scope/utils.js +1 -1
- package/draw/libs/laser-pointer/index.js +1 -1
- package/draw/libs/laser-pointer/math.js +1 -1
- package/draw/libs/laser-pointer/simplify.js +1 -1
- package/draw/libs/laser-pointer/state.js +1 -1
- package/draw/libs/markdown-to-text/index.js +1 -1
- package/draw/libs/math/angle.js +1 -1
- package/draw/libs/math/constants.js +1 -1
- package/draw/libs/math/curve.js +1 -1
- package/draw/libs/math/ellipse.js +1 -1
- package/draw/libs/math/index.js +1 -1
- package/draw/libs/math/line.js +1 -1
- package/draw/libs/math/point.js +1 -1
- package/draw/libs/math/polygon.js +1 -1
- package/draw/libs/math/range.js +1 -1
- package/draw/libs/math/rectangle.js +1 -1
- package/draw/libs/math/segment.js +1 -1
- package/draw/libs/math/triangle.js +1 -1
- package/draw/libs/math/utils.js +1 -1
- package/draw/libs/math/vector.js +1 -1
- package/draw/libs/multimath/index.js +1 -1
- package/draw/libs/multimath/lib/wa_detect.js +1 -1
- package/draw/libs/nanoid/index.js +1 -1
- package/draw/libs/nanoid/url-alphabet/index.js +1 -1
- package/draw/libs/pako/index.js +1 -1
- package/draw/libs/path-data-parser/absolutize.js +1 -1
- package/draw/libs/path-data-parser/index.js +1 -1
- package/draw/libs/path-data-parser/normalize.js +1 -1
- package/draw/libs/path-data-parser/parser.js +1 -1
- package/draw/libs/perfect-freehand/getStroke.js +1 -1
- package/draw/libs/perfect-freehand/getStrokeOutlinePoints.js +1 -1
- package/draw/libs/perfect-freehand/getStrokePoints.js +1 -1
- package/draw/libs/perfect-freehand/getStrokeRadius.js +1 -1
- package/draw/libs/perfect-freehand/index.js +1 -1
- package/draw/libs/perfect-freehand/vec.js +1 -1
- package/draw/libs/pica/index.js +1 -1
- package/draw/libs/pica/lib/mathlib.js +1 -1
- package/draw/libs/pica/lib/mm_resize/convolve.js +1 -1
- package/draw/libs/pica/lib/mm_resize/convolve_wasm_base64.js +1 -1
- package/draw/libs/pica/lib/mm_resize/index.js +1 -1
- package/draw/libs/pica/lib/mm_resize/resize.js +1 -1
- package/draw/libs/pica/lib/mm_resize/resize_filter_gen.js +1 -1
- package/draw/libs/pica/lib/mm_resize/resize_wasm.js +1 -1
- package/draw/libs/pica/lib/mm_unsharp_mask/index.js +1 -1
- package/draw/libs/pica/lib/mm_unsharp_mask/unsharp_mask.js +1 -1
- package/draw/libs/pica/lib/mm_unsharp_mask/unsharp_mask_wasm.js +1 -1
- package/draw/libs/pica/lib/mm_unsharp_mask/unsharp_mask_wasm_base64.js +1 -1
- package/draw/libs/pica/lib/pool.js +1 -1
- package/draw/libs/pica/lib/tiler.js +1 -1
- package/draw/libs/pica/lib/utils.js +1 -1
- package/draw/libs/pica/lib/worker.js +1 -1
- package/draw/libs/png-chunk-text/decode.js +1 -1
- package/draw/libs/png-chunk-text/encode.js +1 -1
- package/draw/libs/png-chunk-text/index.js +1 -1
- package/draw/libs/png-chunks-encode/index.js +1 -1
- package/draw/libs/png-chunks-extract/index.js +1 -1
- package/draw/libs/points-on-curve/curve-to-bezier.js +1 -1
- package/draw/libs/points-on-curve/index.js +1 -1
- package/draw/libs/points-on-path/index.js +1 -1
- package/draw/libs/promise-pool/index.js +1 -1
- package/draw/libs/roughjs/canvas.js +1 -1
- package/draw/libs/roughjs/core.js +1 -1
- package/draw/libs/roughjs/fillers/dashed-filler.js +1 -1
- package/draw/libs/roughjs/fillers/dot-filler.js +1 -1
- package/draw/libs/roughjs/fillers/filler.js +1 -1
- package/draw/libs/roughjs/fillers/hachure-filler.js +1 -1
- package/draw/libs/roughjs/fillers/hatch-filler.js +1 -1
- package/draw/libs/roughjs/fillers/scan-line-hachure.js +1 -1
- package/draw/libs/roughjs/fillers/zigzag-filler.js +1 -1
- package/draw/libs/roughjs/fillers/zigzag-line-filler.js +1 -1
- package/draw/libs/roughjs/generator.js +1 -1
- package/draw/libs/roughjs/geometry.js +1 -1
- package/draw/libs/roughjs/index.js +1 -1
- package/draw/libs/roughjs/math.js +1 -1
- package/draw/libs/roughjs/renderer.js +1 -1
- package/draw/libs/roughjs/rough.js +1 -1
- package/draw/libs/roughjs/svg.js +1 -1
- package/draw/libs/sliced/index.js +1 -1
- package/draw/libs/webworkify/index.js +1 -1
- package/draw/mermaid.js +27 -0
- package/draw/polyfill.js +6 -0
- package/draw/{core/reactUtils.js → reactUtils.js} +4 -4
- package/draw/{core/renderer → renderer}/animation.js +2 -2
- package/draw/{core/renderer → renderer}/helpers.d.ts +1 -1
- package/draw/{core/renderer → renderer}/helpers.js +5 -5
- package/draw/{core/renderer → renderer}/interactiveScene.js +18 -18
- package/draw/{core/renderer → renderer}/renderNewElementScene.js +8 -8
- package/draw/{core/renderer → renderer}/renderSnaps.d.ts +1 -1
- package/draw/{core/renderer → renderer}/renderSnaps.js +6 -6
- package/draw/{core/renderer → renderer}/roundRect.js +2 -2
- package/draw/{core/renderer → renderer}/staticScene.d.ts +2 -2
- package/draw/{core/renderer → renderer}/staticScene.js +12 -12
- package/draw/{core/renderer → renderer}/staticSvgScene.d.ts +3 -3
- package/draw/{core/renderer → renderer}/staticSvgScene.js +19 -19
- package/draw/{core/scene → scene}/Renderer.d.ts +4 -4
- package/draw/{core/scene → scene}/Renderer.js +6 -6
- package/draw/{core/scene → scene}/export.d.ts +2 -2
- package/draw/{core/scene → scene}/export.js +52 -52
- package/draw/{core/scene → scene}/index.d.ts +1 -1
- package/draw/scene/index.js +7 -0
- package/draw/{core/scene → scene}/normalize.d.ts +1 -1
- package/draw/scene/normalize.js +10 -0
- package/draw/{core/scene → scene}/scroll.d.ts +2 -2
- package/draw/{core/scene → scene}/scroll.js +6 -6
- package/draw/{core/scene → scene}/scrollbars.d.ts +1 -1
- package/draw/{core/scene → scene}/scrollbars.js +5 -5
- package/draw/{core/scene → scene}/types.d.ts +7 -7
- package/draw/{core/scene → scene}/zoom.d.ts +1 -1
- package/draw/{core/scene → scene}/zoom.js +2 -2
- package/draw/{core/shortcut.js → shortcut.js} +4 -4
- package/draw/{core/snapping.d.ts → snapping.d.ts} +5 -5
- package/draw/{core/snapping.js → snapping.js} +14 -14
- package/draw/style/index.js +1 -1
- package/draw/utils/bbox.js +1 -1
- package/draw/utils/export.d.ts +1 -1
- package/draw/utils/export.js +7 -7
- package/draw/utils/index.js +2 -2
- package/draw/utils/shape.js +1 -1
- package/draw/utils/withinBounds.js +1 -1
- package/draw/workers.js +51 -0
- package/draw/{core/wysiwyg → wysiwyg}/textWysiwyg.d.ts +1 -1
- package/draw/{core/wysiwyg → wysiwyg}/textWysiwyg.js +16 -16
- package/drawer/Drawer.js +1 -1
- package/drawer/constants.js +1 -1
- package/drawer/context.js +1 -1
- package/drawer/index.js +1 -1
- package/drawer/style/index.js +1 -1
- package/drawer/use-drawer/Hook.js +1 -1
- package/drawer/use-drawer/index.js +1 -1
- package/dropdown/Button.js +1 -1
- package/dropdown/Dropdown.js +1 -1
- package/dropdown/constants.js +1 -1
- package/dropdown/context.js +1 -1
- package/dropdown/index.js +1 -1
- package/dropdown/style/index.js +1 -1
- package/empty/Empty.js +1 -1
- package/empty/constants.js +1 -1
- package/empty/context.js +1 -1
- package/empty/index.js +1 -1
- package/empty/style/index.js +1 -1
- package/flex/Flex.js +1 -1
- package/flex/constants.js +1 -1
- package/flex/context.js +1 -1
- package/flex/index.js +1 -1
- package/flex/style/index.js +1 -1
- package/form/Control.js +1 -1
- package/form/Form.js +1 -1
- package/form/Item.js +1 -1
- package/form/ItemLabel.js +1 -1
- package/form/ItemTip.js +1 -1
- package/form/LabelSymbol.js +1 -1
- package/form/List.js +1 -1
- package/form/Provider.js +1 -1
- package/form/constants.js +1 -1
- package/form/context.js +1 -1
- package/form/hooks/useForm.js +1 -1
- package/form/hooks/useFormContext.js +1 -1
- package/form/hooks/useFormState.js +1 -1
- package/form/hooks/useWatch.js +1 -1
- package/form/index.js +1 -1
- package/form/interface.js +1 -1
- package/form/promisify.js +1 -1
- package/form/store.js +1 -1
- package/form/style/index.js +1 -1
- package/form/utils.js +1 -1
- package/global-provider/GlobalProvider.js +1 -1
- package/global-provider/constants.js +1 -1
- package/global-provider/context.js +1 -1
- package/global-provider/index.js +1 -1
- package/global-provider/style/index.js +1 -1
- package/grid/Grid.js +1 -1
- package/grid/Item.js +1 -1
- package/grid/constants.js +1 -1
- package/grid/context.js +1 -1
- package/grid/index.js +1 -1
- package/grid/style/index.js +1 -1
- 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-throttle-fn-with-raf/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 +1 -1
- package/hooks/use-watermark/utils.js +1 -1
- package/hooks/use-window-size/index.js +1 -1
- package/hooks/useMountLifecycle.js +1 -1
- package/icon/Icon.js +1 -1
- package/icon/addIconFromCdn.js +1 -1
- package/icon/constants.js +1 -1
- package/icon/context.js +1 -1
- package/icon/index.js +1 -1
- package/icon/style/index.js +1 -1
- package/icon-hover/IconHover.js +1 -1
- package/icon-hover/constants.js +1 -1
- package/icon-hover/context.js +1 -1
- package/icon-hover/index.js +1 -1
- package/icon-hover/style/index.js +1 -1
- package/icons/file/File.js +1 -1
- package/icons/file/context.js +1 -1
- package/icons/file/index.js +1 -1
- package/icons/file/style/index.js +1 -1
- package/icons.js +1 -1
- package/image/Footer.js +1 -1
- package/image/Image.js +1 -1
- package/image/Preview.js +1 -1
- package/image/PreviewArrow.js +1 -1
- package/image/PreviewGroup.js +1 -1
- package/image/PreviewToolbar.js +1 -1
- package/image/TriggerForToolbar.js +1 -1
- package/image/constants.js +1 -1
- package/image/context.js +1 -1
- package/image/hooks/useImageStatus.js +1 -1
- package/image/hooks/useShowFooter.js +1 -1
- package/image/index.js +1 -1
- package/image/style/index.js +1 -1
- package/image/utils/getFixTranslate.js +1 -1
- package/image/utils/getScale.js +1 -1
- package/index.js +1 -1
- package/input/Button.js +1 -1
- package/input/Core.js +1 -1
- package/input/Group.js +1 -1
- package/input/Input.js +1 -1
- package/input/Password.js +1 -1
- package/input/Search.js +1 -1
- package/input/Textarea.js +1 -1
- package/input/autoSizeTextareaHeight.js +1 -1
- package/input/constants.js +1 -1
- package/input/context.js +1 -1
- package/input/index.js +1 -1
- package/input/style/index.js +1 -1
- package/input/useComposition.js +1 -1
- package/input/utils.js +1 -1
- package/input-number/InputNumber.js +1 -1
- package/input-number/constants.js +1 -1
- package/input-number/context.js +1 -1
- package/input-number/decimal.js +1 -1
- package/input-number/hooks/useSelectionRange.js +1 -1
- package/input-number/index.js +1 -1
- package/input-number/style/index.js +1 -1
- package/input-number/utils.js +1 -1
- package/input-tag/InputTag.js +1 -1
- package/input-tag/constants.js +1 -1
- package/input-tag/context.js +1 -1
- package/input-tag/hooks/useComputeAutoWidthDelay.js +1 -1
- package/input-tag/index.js +1 -1
- package/input-tag/style/index.js +1 -1
- package/layout/Content.js +1 -1
- package/layout/Footer.js +1 -1
- package/layout/Header.js +1 -1
- package/layout/Layout.js +1 -1
- package/layout/Sider.js +1 -1
- package/layout/constants.js +1 -1
- package/layout/context.js +1 -1
- package/layout/index.js +1 -1
- package/layout/style/index.js +1 -1
- package/link/Link.js +1 -1
- package/link/constants.js +1 -1
- package/link/context.js +1 -1
- package/link/index.js +1 -1
- package/link/style/index.js +1 -1
- package/liquid-fill/LiquidFill.js +1 -1
- package/liquid-fill/constants.js +1 -1
- package/liquid-fill/context.js +1 -1
- package/liquid-fill/index.js +1 -1
- package/liquid-fill/style/index.js +1 -1
- package/list/Item.js +1 -1
- package/list/List.js +1 -1
- package/list/Meta.js +1 -1
- package/list/constants.js +1 -1
- package/list/context.js +1 -1
- package/list/index.js +1 -1
- package/list/style/index.js +1 -1
- package/loading/Loading.js +1 -1
- package/loading/constants.js +1 -1
- package/loading/context.js +1 -1
- package/loading/index.js +1 -1
- package/loading/style/index.js +1 -1
- 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 +1 -1
- 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 +1 -1
- package/locale/zh-HK.js +1 -1
- package/locale/zh-TW.js +1 -1
- package/marquee/Marquee.js +1 -1
- package/marquee/constants.js +1 -1
- package/marquee/context.js +1 -1
- package/marquee/index.js +1 -1
- package/marquee/style/index.js +1 -1
- package/mask/Mask.js +1 -1
- package/mask/constants.js +1 -1
- package/mask/context.js +1 -1
- package/mask/index.js +1 -1
- package/mask/style/index.js +1 -1
- package/masonry/Item.js +1 -1
- package/masonry/Masonry.js +1 -1
- package/masonry/constants.js +1 -1
- package/masonry/context.js +1 -1
- 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.js +1 -1
- package/masonry/style/index.js +1 -1
- package/mentions/Mentions.js +1 -1
- package/mentions/constants.js +1 -1
- package/mentions/context.js +1 -1
- package/mentions/index.js +1 -1
- package/mentions/style/index.js +1 -1
- 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 +1 -1
- package/menu/OverflowWrap.js +1 -1
- package/menu/constants.js +1 -1
- package/menu/context.js +1 -1
- package/menu/index.js +1 -1
- package/menu/style/index.js +1 -1
- package/menu/sub-menu/Inline.js +1 -1
- package/menu/sub-menu/Pop.js +1 -1
- package/menu/sub-menu/index.js +1 -1
- package/menu/utils.js +1 -1
- package/message/Message.js +1 -1
- package/message/config.js +1 -1
- package/message/constants.js +1 -1
- package/message/context.js +1 -1
- package/message/hooks/useMessage.js +1 -1
- package/message/index.js +1 -1
- package/message/style/index.js +1 -1
- package/message/utils.js +1 -1
- package/modal/Modal.js +1 -1
- package/modal/config.js +1 -1
- package/modal/confirm.js +1 -1
- package/modal/constants.js +1 -1
- package/modal/context.js +1 -1
- package/modal/index.js +1 -1
- package/modal/style/index.js +1 -1
- package/modal/use-modal/Hook.js +1 -1
- package/modal/use-modal/index.js +1 -1
- package/modal/utils.js +1 -1
- package/notice/Notice.js +1 -1
- package/notice/config.js +1 -1
- package/notice/constants.js +1 -1
- package/notice/context.js +1 -1
- package/notice/index.js +1 -1
- package/notice/style/index.js +1 -1
- package/notice/utils.js +1 -1
- package/notice/withNotice.js +1 -1
- package/notification/Notification.js +1 -1
- package/notification/config.js +1 -1
- package/notification/constants.js +1 -1
- package/notification/context.js +1 -1
- package/notification/hooks/useNotification.js +1 -1
- package/notification/index.js +1 -1
- package/notification/style/index.js +1 -1
- package/notification/utils.js +1 -1
- package/overflow-ellipsis/Item.js +1 -1
- package/overflow-ellipsis/OverflowEllipsis.js +1 -1
- package/overflow-ellipsis/constants.js +1 -1
- package/overflow-ellipsis/context.js +1 -1
- package/overflow-ellipsis/index.js +1 -1
- package/overflow-ellipsis/style/index.js +1 -1
- package/package.json +1 -1
- package/page-header/PageHeader.js +1 -1
- package/page-header/constants.js +1 -1
- package/page-header/context.js +1 -1
- package/page-header/index.js +1 -1
- package/page-header/style/index.js +1 -1
- package/pagination/Item.js +1 -1
- package/pagination/Jumper.js +1 -1
- package/pagination/Pagination.js +1 -1
- package/pagination/PreNextButton.js +1 -1
- package/pagination/PreNextJump.js +1 -1
- package/pagination/SizeOption.js +1 -1
- package/pagination/constants.js +1 -1
- package/pagination/context.js +1 -1
- package/pagination/index.js +1 -1
- package/pagination/interface.js +1 -1
- package/pagination/style/index.js +1 -1
- package/pagination/utils.js +1 -1
- package/picker/Input.js +1 -1
- package/picker/InputRange.js +1 -1
- package/picker/constants.js +1 -1
- package/picker/context.js +1 -1
- package/picker/index.js +1 -1
- package/picker/style/index.js +1 -1
- package/popconfirm/Popconfirm.js +1 -1
- package/popconfirm/constants.js +1 -1
- package/popconfirm/context.js +1 -1
- package/popconfirm/index.js +1 -1
- package/popconfirm/style/index.js +1 -1
- package/popover/Popover.js +1 -1
- package/popover/constants.js +1 -1
- package/popover/context.js +1 -1
- package/popover/index.js +1 -1
- package/popover/style/index.js +1 -1
- package/portal/Portal.js +1 -1
- package/portal/constants.js +1 -1
- package/portal/context.js +1 -1
- package/portal/index.js +1 -1
- package/portal/style/index.js +1 -1
- package/progress/Circle.js +1 -1
- package/progress/Line.js +1 -1
- package/progress/Progress.js +1 -1
- package/progress/Step.js +1 -1
- package/progress/constants.js +1 -1
- package/progress/context.js +1 -1
- package/progress/index.js +1 -1
- package/progress/style/index.js +1 -1
- package/qr-code/QRCode.js +1 -1
- package/qr-code/constants.js +1 -1
- package/qr-code/context.js +1 -1
- package/qr-code/index.js +1 -1
- package/qr-code/src/index.js +1 -1
- package/qr-code/src/qrcodegen.js +1 -1
- package/qr-code/style/index.js +1 -1
- package/radio/Group.js +1 -1
- package/radio/GroupBlock.js +1 -1
- package/radio/Radio.js +1 -1
- package/radio/constants.js +1 -1
- package/radio/context.js +1 -1
- package/radio/index.js +1 -1
- package/radio/style/index.js +1 -1
- package/rate/Rate.js +1 -1
- package/rate/constants.js +1 -1
- package/rate/context.js +1 -1
- package/rate/index.js +1 -1
- package/rate/style/index.js +1 -1
- package/resize-box/ResizeBox.js +1 -1
- package/resize-box/ResizeTrigger.js +1 -1
- package/resize-box/Split.js +1 -1
- package/resize-box/SplitGroup.js +1 -1
- package/resize-box/constants.js +1 -1
- package/resize-box/context.js +1 -1
- package/resize-box/index.js +1 -1
- package/resize-box/style/index.js +1 -1
- package/result/403.js +1 -1
- package/result/404.js +1 -1
- package/result/500.js +1 -1
- package/result/Result.js +1 -1
- package/result/constants.js +1 -1
- package/result/context.js +1 -1
- package/result/index.js +1 -1
- package/result/style/index.js +1 -1
- package/rich-text/RichText.js +1 -1
- package/rich-text/Toolbar.js +1 -1
- package/rich-text/constants.js +1 -1
- package/rich-text/context.js +1 -1
- package/rich-text/index.js +1 -1
- package/rich-text/libs/blots/block.js +1 -1
- package/rich-text/libs/blots/break.js +1 -1
- package/rich-text/libs/blots/container.js +1 -1
- package/rich-text/libs/blots/cursor.js +1 -1
- package/rich-text/libs/blots/embed.js +1 -1
- package/rich-text/libs/blots/inline.js +1 -1
- package/rich-text/libs/blots/scroll.js +1 -1
- package/rich-text/libs/blots/text.js +1 -1
- package/rich-text/libs/core/composition.js +1 -1
- package/rich-text/libs/core/editor.js +1 -1
- package/rich-text/libs/core/emitter.js +1 -1
- package/rich-text/libs/core/logger.js +1 -1
- package/rich-text/libs/core/module.js +1 -1
- package/rich-text/libs/core/rich.js +1 -1
- package/rich-text/libs/core/selection.js +1 -1
- package/rich-text/libs/core/theme.js +1 -1
- package/rich-text/libs/core/utils/createRegistryWithFormats.js +1 -1
- package/rich-text/libs/core/utils/scrollRectIntoView.js +1 -1
- package/rich-text/libs/delta/AttributeMap.js +1 -1
- package/rich-text/libs/delta/Op.js +1 -1
- package/rich-text/libs/delta/OpIterator.js +1 -1
- package/rich-text/libs/delta/index.js +1 -1
- package/rich-text/libs/diff/index.js +1 -1
- package/rich-text/libs/formats/align.js +1 -1
- package/rich-text/libs/formats/background.js +1 -1
- package/rich-text/libs/formats/blockquote.js +1 -1
- package/rich-text/libs/formats/bold.js +1 -1
- package/rich-text/libs/formats/code.js +1 -1
- package/rich-text/libs/formats/color.js +1 -1
- package/rich-text/libs/formats/direction.js +1 -1
- package/rich-text/libs/formats/emoji.js +1 -1
- package/rich-text/libs/formats/font.js +1 -1
- package/rich-text/libs/formats/formula.js +1 -1
- package/rich-text/libs/formats/header.js +1 -1
- package/rich-text/libs/formats/hr.js +1 -1
- package/rich-text/libs/formats/image.js +1 -1
- package/rich-text/libs/formats/indent.js +1 -1
- package/rich-text/libs/formats/italic.js +1 -1
- package/rich-text/libs/formats/lineHeight.js +1 -1
- package/rich-text/libs/formats/link.js +1 -1
- package/rich-text/libs/formats/list.js +1 -1
- package/rich-text/libs/formats/script.js +1 -1
- package/rich-text/libs/formats/size.js +1 -1
- package/rich-text/libs/formats/strike.js +1 -1
- package/rich-text/libs/formats/table.js +1 -1
- package/rich-text/libs/formats/underline.js +1 -1
- package/rich-text/libs/formats/video.js +1 -1
- package/rich-text/libs/index.js +1 -1
- package/rich-text/libs/modules/clipboard.js +1 -1
- package/rich-text/libs/modules/history.js +1 -1
- package/rich-text/libs/modules/image-resize/index.js +1 -1
- package/rich-text/libs/modules/image-resize/modules/Base.js +1 -1
- package/rich-text/libs/modules/image-resize/modules/DisplaySize.js +1 -1
- package/rich-text/libs/modules/image-resize/modules/Resize.js +1 -1
- package/rich-text/libs/modules/image-resize/options.js +1 -1
- package/rich-text/libs/modules/input.js +1 -1
- package/rich-text/libs/modules/keyboard.js +1 -1
- package/rich-text/libs/modules/normalize-external-html/index.js +1 -1
- package/rich-text/libs/modules/normalize-external-html/normalizers/googleDocs.js +1 -1
- package/rich-text/libs/modules/normalize-external-html/normalizers/msWord.js +1 -1
- package/rich-text/libs/modules/table.js +1 -1
- package/rich-text/libs/modules/toolbar.js +1 -1
- package/rich-text/libs/modules/uiNode.js +1 -1
- package/rich-text/libs/modules/uploader.js +1 -1
- package/rich-text/libs/parchment/attributor/attributor.js +1 -1
- package/rich-text/libs/parchment/attributor/class.js +1 -1
- package/rich-text/libs/parchment/attributor/store.js +1 -1
- package/rich-text/libs/parchment/attributor/style.js +1 -1
- package/rich-text/libs/parchment/blot/abstract/container.js +1 -1
- package/rich-text/libs/parchment/blot/abstract/leaf.js +1 -1
- package/rich-text/libs/parchment/blot/abstract/parent.js +1 -1
- package/rich-text/libs/parchment/blot/abstract/shadow.js +1 -1
- package/rich-text/libs/parchment/blot/block.js +1 -1
- package/rich-text/libs/parchment/blot/embed.js +1 -1
- package/rich-text/libs/parchment/blot/inline.js +1 -1
- package/rich-text/libs/parchment/blot/scroll.js +1 -1
- package/rich-text/libs/parchment/blot/text.js +1 -1
- package/rich-text/libs/parchment/collection/linked-list.js +1 -1
- package/rich-text/libs/parchment/error.js +1 -1
- package/rich-text/libs/parchment/index.js +1 -1
- package/rich-text/libs/parchment/registry.js +1 -1
- package/rich-text/libs/parchment/scope.js +1 -1
- package/rich-text/style/index.js +1 -1
- package/router-error/RouterError.js +1 -1
- package/router-error/constants.js +1 -1
- package/router-error/context.js +1 -1
- package/router-error/index.js +1 -1
- package/router-error/style/index.js +1 -1
- package/row-col/Col.js +1 -1
- package/row-col/Row.js +1 -1
- package/row-col/constants.js +1 -1
- package/row-col/context.js +1 -1
- package/row-col/index.js +1 -1
- package/row-col/style/index.js +1 -1
- package/segmented/Segmented.js +1 -1
- package/segmented/constants.js +1 -1
- package/segmented/context.js +1 -1
- package/segmented/index.js +1 -1
- package/segmented/style/index.js +1 -1
- package/select/Option.js +1 -1
- package/select/OptionGroup.js +1 -1
- package/select/Select.js +1 -1
- package/select/constants.js +1 -1
- package/select/context.js +1 -1
- package/select/index.js +1 -1
- package/select/style/index.js +1 -1
- package/select/utils.js +1 -1
- package/select-view/Core.js +1 -1
- package/select-view/SelectView.js +1 -1
- package/select-view/constants.js +1 -1
- package/select-view/context.js +1 -1
- package/select-view/index.js +1 -1
- package/select-view/style/index.js +1 -1
- package/skeleton/Image.js +1 -1
- package/skeleton/Skeleton.js +1 -1
- package/skeleton/Text.js +1 -1
- package/skeleton/constants.js +1 -1
- package/skeleton/context.js +1 -1
- package/skeleton/index.js +1 -1
- package/skeleton/style/index.js +1 -1
- package/slider/Button.js +1 -1
- package/slider/Dot.js +1 -1
- package/slider/Input.js +1 -1
- package/slider/Mark.js +1 -1
- package/slider/Slider.js +1 -1
- package/slider/Tick.js +1 -1
- package/slider/constants.js +1 -1
- package/slider/context.js +1 -1
- package/slider/hooks/useInterval.js +1 -1
- package/slider/hooks/useLegalValue.js +1 -1
- package/slider/index.js +1 -1
- package/slider/style/index.js +1 -1
- package/slider/utils.js +1 -1
- package/space/Space.js +1 -1
- package/space/constants.js +1 -1
- package/space/context.js +1 -1
- package/space/index.js +1 -1
- package/space/style/index.js +1 -1
- package/speech-synthesis/SpeechSynthesis.js +1 -1
- package/speech-synthesis/constants.js +1 -1
- package/speech-synthesis/context.js +1 -1
- package/speech-synthesis/index.js +1 -1
- package/speech-synthesis/style/index.js +1 -1
- package/spin/DotLoading.js +1 -1
- package/spin/Spin.js +1 -1
- package/spin/constants.js +1 -1
- package/spin/context.js +1 -1
- package/spin/index.js +1 -1
- package/spin/style/index.js +1 -1
- package/splitter/Bar.js +1 -1
- package/splitter/Panel.js +1 -1
- package/splitter/Splitter.js +1 -1
- package/splitter/constants.js +1 -1
- package/splitter/context.js +1 -1
- 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.js +1 -1
- package/splitter/style/index.js +1 -1
- package/statistic/Statistic.js +1 -1
- package/statistic/constants.js +1 -1
- package/statistic/context.js +1 -1
- package/statistic/index.js +1 -1
- package/statistic/interface.js +1 -1
- package/statistic/style/index.js +1 -1
- package/steps/Item.js +1 -1
- package/steps/Steps.js +1 -1
- package/steps/constants.js +1 -1
- package/steps/context.js +1 -1
- package/steps/index.js +1 -1
- package/steps/style/index.js +1 -1
- package/style/constants.js +1 -1
- package/style.css +1 -1
- package/suspense-fallback-test/SuspenseFallbackTest.js +1 -1
- package/suspense-fallback-test/constants.js +1 -1
- package/suspense-fallback-test/context.js +1 -1
- package/suspense-fallback-test/index.js +1 -1
- package/suspense-fallback-test/style/index.js +1 -1
- package/switch/Switch.js +1 -1
- package/switch/constants.js +1 -1
- package/switch/context.js +1 -1
- package/switch/index.js +1 -1
- package/switch/style/index.js +1 -1
- package/table/ColGroup.js +1 -1
- package/table/Table.js +1 -1
- package/table/constants.js +1 -1
- package/table/context.js +1 -1
- package/table/hooks/useColumns.js +1 -1
- package/table/hooks/useComponent.js +1 -1
- package/table/hooks/useExpand.js +1 -1
- package/table/hooks/useRowSelection.js +1 -1
- package/table/hooks/useSorter.js +1 -1
- package/table/hooks/useStickyClassNames.js +1 -1
- package/table/hooks/useStickyOffsets.js +1 -1
- package/table/hooks/useThResizable.js +1 -1
- package/table/index.js +1 -1
- package/table/style/index.js +1 -1
- 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 +1 -1
- package/table/tbody/Td.js +1 -1
- package/table/tbody/Tr.js +7 -2
- package/table/tbody/index.js +1 -1
- package/table/tfoot/index.js +1 -1
- package/table/th-resizable/index.js +1 -1
- package/table/th-resizable/style/index.js +1 -1
- package/table/thead/Column.js +1 -1
- package/table/thead/index.js +1 -1
- package/table/utils.js +1 -1
- package/tabs/TabContent.js +1 -1
- package/tabs/TabPane.js +1 -1
- package/tabs/Tabs.js +1 -1
- package/tabs/constants.js +1 -1
- package/tabs/context.js +1 -1
- package/tabs/hooks/useDomSize.js +1 -1
- package/tabs/hooks/useHeaderScroll.js +1 -1
- package/tabs/index.js +1 -1
- package/tabs/style/index.js +1 -1
- package/tabs/tab-header/DropdownIcon.js +1 -1
- package/tabs/tab-header/TabInk.js +1 -1
- package/tabs/tab-header/TabNavIcon.js +1 -1
- package/tabs/tab-header/TabTitle.js +1 -1
- package/tabs/tab-header/index.js +1 -1
- package/tabs/utils.js +1 -1
- package/tag/Tag.js +1 -1
- package/tag/constants.js +1 -1
- package/tag/context.js +1 -1
- package/tag/index.js +1 -1
- package/tag/style/index.js +1 -1
- package/tag/utils.js +1 -1
- package/time-picker/Picker.js +1 -1
- package/time-picker/TimeColumn.js +1 -1
- package/time-picker/TimePicker.js +1 -1
- package/time-picker/TimePickerRange.js +1 -1
- package/time-picker/constants.js +1 -1
- package/time-picker/context.js +1 -1
- package/time-picker/index.js +1 -1
- package/time-picker/style/index.js +1 -1
- package/time-picker/utils.js +1 -1
- package/time-picker/withTimePicker.js +1 -1
- package/timeline/Item.js +1 -1
- package/timeline/Timeline.js +1 -1
- package/timeline/constants.js +1 -1
- package/timeline/context.js +1 -1
- package/timeline/index.js +1 -1
- package/timeline/style/index.js +1 -1
- package/timer/Timer.js +1 -1
- package/timer/constants.js +1 -1
- package/timer/context.js +1 -1
- package/timer/index.js +1 -1
- package/timer/style/index.js +1 -1
- package/toast/Toast.js +1 -1
- package/toast/constants.js +1 -1
- package/toast/context.js +1 -1
- package/toast/index.js +1 -1
- package/toast/style/index.js +1 -1
- package/tooltip/Tooltip.js +1 -1
- package/tooltip/constants.js +1 -1
- package/tooltip/context.js +1 -1
- package/tooltip/index.js +1 -1
- package/tooltip/style/index.js +1 -1
- package/tour/Tour.js +1 -1
- package/tour/constants.js +1 -1
- package/tour/context.js +1 -1
- package/tour/index.js +1 -1
- package/tour/style/index.js +1 -1
- package/tour/utils.js +1 -1
- package/transfer/Item.js +1 -1
- package/transfer/List.js +1 -1
- package/transfer/Transfer.js +1 -1
- package/transfer/constants.js +1 -1
- package/transfer/context.js +1 -1
- package/transfer/index.js +1 -1
- package/transfer/style/index.js +1 -1
- package/transition/constants.js +1 -1
- package/transition/context.js +1 -1
- package/transition/index.js +1 -1
- package/transition/style/index.js +1 -1
- package/tree/Animation.js +1 -1
- package/tree/Node.js +1 -1
- package/tree/NodeList.js +1 -1
- package/tree/Tree.js +1 -1
- package/tree/constants.js +1 -1
- package/tree/context.js +1 -1
- package/tree/index.js +1 -1
- package/tree/style/index.js +1 -1
- package/tree/utils.js +1 -1
- package/tree-select/List.js +1 -1
- package/tree-select/TreeSelect.js +1 -1
- package/tree-select/constants.js +1 -1
- package/tree-select/context.js +1 -1
- package/tree-select/hooks/useKeyCache.js +1 -1
- package/tree-select/hooks/useStateValue.js +1 -1
- package/tree-select/hooks/useTreeData.js +1 -1
- package/tree-select/index.js +1 -1
- package/tree-select/style/index.js +1 -1
- package/tree-select/utils.js +1 -1
- package/trigger/Trigger.js +1 -1
- package/trigger/constants.js +1 -1
- package/trigger/context.js +1 -1
- package/trigger/getPopupStyle.js +1 -1
- package/trigger/index.js +1 -1
- package/trigger/style/index.js +1 -1
- package/trigger/utils.js +1 -1
- package/typewriter/Typewriter.js +1 -1
- package/typewriter/constants.js +1 -1
- package/typewriter/context.js +1 -1
- package/typewriter/index.js +1 -1
- package/typewriter/style/index.js +1 -1
- package/typography/Base.js +1 -1
- package/typography/EditContent.js +1 -1
- package/typography/Ellipsis.js +1 -1
- 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 +1 -1
- package/typography/constants.js +1 -1
- package/typography/context.js +1 -1
- package/typography/hooks/useCssEllipsis.js +1 -1
- package/typography/hooks/useEllipsis.js +1 -1
- package/typography/index.js +1 -1
- package/typography/style/index.js +1 -1
- package/upload/TriggerNode.js +1 -1
- package/upload/Upload.js +1 -1
- package/upload/Uploader.js +1 -1
- package/upload/constants.js +1 -1
- package/upload/context.js +1 -1
- package/upload/index.js +1 -1
- package/upload/list/PictureItem.js +1 -1
- package/upload/list/TextItem.js +1 -1
- package/upload/list/UploadProgress.js +1 -1
- package/upload/list/index.js +1 -1
- package/upload/list/utils.js +1 -1
- package/upload/request.js +1 -1
- package/upload/style/index.js +1 -1
- 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.js +1 -1
- 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 +1 -1
- package/utils/document.js +1 -1
- 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.js +1 -1
- package/utils/intersectionObserver.js +1 -1
- package/utils/is.js +1 -1
- package/utils/keyboardCode.js +1 -1
- 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.js +1 -1
- 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 +1 -1
- package/utils/setPrimaryColor.js +1 -1
- package/utils/setTheme.js +1 -1
- package/utils/string.js +1 -1
- package/utils/style.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 +1 -1
- 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 +1 -1
- package/verification-code/constants.js +1 -1
- package/verification-code/context.js +1 -1
- package/verification-code/index.js +1 -1
- package/verification-code/style/index.js +1 -1
- package/version/index.js +6 -6
- package/virtual-list/Filler.js +1 -1
- package/virtual-list/VirtualList.js +1 -1
- package/virtual-list/constants.js +1 -1
- package/virtual-list/context.js +1 -1
- package/virtual-list/hooks/useCacheChildrenNodes.js +1 -1
- package/virtual-list/hooks/useComputeVirtualItemHeight.js +1 -1
- package/virtual-list/index.js +1 -1
- package/virtual-list/style/index.js +1 -1
- package/virtual-list/utils/algorithm.js +1 -1
- package/virtual-list/utils/item.js +1 -1
- package/watermark/Watermark.js +1 -1
- package/watermark/constants.js +1 -1
- package/watermark/context.js +1 -1
- package/watermark/index.js +1 -1
- package/watermark/style/index.js +1 -1
- package/draw/core/actions/actionTextAutoResize.d.ts +0 -17
- package/draw/core/actions/actionToggleShapeSwitch.d.ts +0 -19
- package/draw/core/actions/register.js +0 -6
- package/draw/core/components/Actions.js +0 -493
- package/draw/core/components/canvases/index.js +0 -4
- package/draw/core/context/ui-appState.js +0 -7
- package/draw/core/data/ai/types.d.ts +0 -242
- package/draw/core/data/encryption.js +0 -4
- package/draw/core/data/index.js +0 -5
- package/draw/core/editor-jotai.d.ts +0 -7
- package/draw/core/editor-jotai.js +0 -11
- package/draw/core/errors.js +0 -22
- package/draw/core/fonts/index.js +0 -3
- package/draw/core/polyfill.js +0 -6
- package/draw/core/scene/index.js +0 -7
- package/draw/core/scene/normalize.js +0 -10
- /package/{app → animation}/style/index.css +0 -0
- /package/draw/{core/actions → actions}/index.d.ts +0 -0
- /package/draw/{core/actions → actions}/register.d.ts +0 -0
- /package/draw/{core/analytics.d.ts → analytics.d.ts} +0 -0
- /package/draw/{core/animation-frame-handler.d.ts → animation-frame-handler.d.ts} +0 -0
- /package/draw/{core/components → components}/ActiveConfirmDialog.d.ts +0 -0
- /package/draw/{core/components → components}/BraveMeasureTextError.d.ts +0 -0
- /package/draw/{core/components → components}/ButtonIconCycle.d.ts +0 -0
- /package/draw/{core/components → components}/ButtonSeparator.d.ts +0 -0
- /package/draw/{core/components → components}/ContextMenu.d.ts +0 -0
- /package/draw/{core/components → components}/Ellipsify.d.ts +0 -0
- /package/draw/{core/components → components}/ErrorDialog.d.ts +0 -0
- /package/draw/{core/components → components}/FixedSideContainer.d.ts +0 -0
- /package/draw/{core/components → components}/HandButton.d.ts +0 -0
- /package/draw/{core/components → components}/HelpDialog.d.ts +0 -0
- /package/draw/{core/components → components}/InlineIcon.d.ts +0 -0
- /package/draw/{core/components → components}/Island.d.ts +0 -0
- /package/draw/{core/components → components}/LaserPointerButton.d.ts +0 -0
- /package/draw/{core/components → components}/LibraryMenu.d.ts +0 -0
- /package/draw/{core/components → components}/LinkButton.d.ts +0 -0
- /package/draw/{core/components → components}/LockButton.d.ts +0 -0
- /package/draw/{core/components → components}/MagicButton.d.ts +0 -0
- /package/draw/{core/components → components}/PenModeButton.d.ts +0 -0
- /package/draw/{core/components → components}/Popover.d.ts +0 -0
- /package/draw/{core/components → components}/ProjectName.d.ts +0 -0
- /package/draw/{core/components → components}/SVGLayer.d.ts +0 -0
- /package/draw/{core/components → components}/ScrollableList.d.ts +0 -0
- /package/draw/{core/components → components}/SearchMenu.d.ts +0 -0
- /package/draw/{core/components → components}/Stack.d.ts +0 -0
- /package/draw/{core/components → components}/Toast.d.ts +0 -0
- /package/draw/{core/components → components}/Tooltip.d.ts +0 -0
- /package/draw/{core/components → components}/Trans.d.ts +0 -0
- /package/draw/{core/components → components}/canvases/index.d.ts +0 -0
- /package/draw/{core/components → components}/hoc/withInternalFallback.d.ts +0 -0
- /package/draw/{core/components → components}/main-menu/MenuItem.d.ts +0 -0
- /package/draw/{core/components → components}/main-menu/common.d.ts +0 -0
- /package/draw/{core/components → components}/overwrite-confirm/State.d.ts +0 -0
- /package/draw/{core/components → components}/overwrite-confirm/index.d.ts +0 -0
- /package/draw/{core/components → components}/stats/Collapsible.d.ts +0 -0
- /package/draw/{core/data → data}/encode.d.ts +0 -0
- /package/draw/{core/data → data}/encryption.d.ts +0 -0
- /package/draw/{core/data → data}/image.d.ts +0 -0
- /package/draw/{core/data → data}/index.d.ts +0 -0
- /package/draw/{core/deburr.d.ts → deburr.d.ts} +0 -0
- /package/draw/{core/eraser → eraser}/index.d.ts +0 -0
- /package/draw/{core/errors.d.ts → errors.d.ts} +0 -0
- /package/draw/{core/fonts → fonts}/DrawFontFace.d.ts +0 -0
- /package/draw/{core/fonts → fonts}/index.d.ts +0 -0
- /package/draw/{core/hooks → hooks}/useCallbackRefState.d.ts +0 -0
- /package/draw/{core/hooks → hooks}/useCopiedIndicator.d.ts +0 -0
- /package/draw/{core/hooks → hooks}/useCreatePortalContainer.d.ts +0 -0
- /package/draw/{core/hooks → hooks}/useOutsideClick.d.ts +0 -0
- /package/draw/{core/hooks → hooks}/useScrollPosition.d.ts +0 -0
- /package/draw/{core/hooks → hooks}/useStable.d.ts +0 -0
- /package/draw/{core/hooks → hooks}/useStableCallback.d.ts +0 -0
- /package/draw/{core/hooks → hooks}/useTextEditorFocus.d.ts +0 -0
- /package/draw/{core/hooks → hooks}/useTransition.d.ts +0 -0
- /package/draw/{core/laser-trails.d.ts → laser-trails.d.ts} +0 -0
- /package/draw/{core/lasso → lasso}/index.d.ts +0 -0
- /package/draw/{core/locales → locales}/percentages.json.js +0 -0
- /package/draw/{core/locales → locales}/zh-CN.json.js +0 -0
- /package/draw/{core/mermaid.d.ts → mermaid.d.ts} +0 -0
- /package/draw/{core/polyfill.d.ts → polyfill.d.ts} +0 -0
- /package/draw/{core/reactUtils.d.ts → reactUtils.d.ts} +0 -0
- /package/draw/{core/renderer → renderer}/animation.d.ts +0 -0
- /package/draw/{core/renderer → renderer}/interactiveScene.d.ts +0 -0
- /package/draw/{core/renderer → renderer}/renderNewElementScene.d.ts +0 -0
- /package/draw/{core/renderer → renderer}/roundRect.d.ts +0 -0
- /package/draw/{core/shortcut.d.ts → shortcut.d.ts} +0 -0
- /package/draw/{core/workers.d.ts → workers.d.ts} +0 -0
|
@@ -1,75 +1,76 @@
|
|
|
1
|
-
/* 潘启宝 2026-06-
|
|
2
|
-
import { ConfigContext as e } from "
|
|
3
|
-
import { EMITTER_EVENT as t, emitter as n } from "
|
|
4
|
-
import r from "
|
|
5
|
-
import { clamp as i } from "
|
|
6
|
-
import { applyDarkModeFilter as a, isTransparent as o } from "
|
|
7
|
-
import {
|
|
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 "
|
|
9
|
-
import { Emitter as ge } from "
|
|
10
|
-
import { getLineHeight as _e } from "
|
|
11
|
-
import { CODES as ve, KEYS as x, isArrowKey as ye, shouldMaintainAspectRatio as be, shouldResizeFromCenter as xe, shouldRotateWithDiscreteAngle as Se } from "
|
|
12
|
-
import { vector as Ce, vectorDot as we, vectorFromPoint as Te, vectorNormalize as Ee, vectorSubtract as De } from "
|
|
13
|
-
import { pointDistance as Oe, pointFrom as S, pointRotateRads as ke } from "
|
|
14
|
-
import "
|
|
15
|
-
import { getGridPoint as C } from "
|
|
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 "
|
|
17
|
-
import { nanoid as Ze } from "
|
|
18
|
-
import { randomInteger as Qe } from "
|
|
19
|
-
import { normalizeLink as $e } from "
|
|
20
|
-
import "
|
|
21
|
-
import
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
58
|
-
import "
|
|
59
|
-
import {
|
|
60
|
-
import {
|
|
61
|
-
import
|
|
62
|
-
import { History as
|
|
63
|
-
import { AppContext as
|
|
64
|
-
import { editorJotaiStore as
|
|
65
|
-
import { defaultLang as
|
|
66
|
-
import { getNormalizedZoom as
|
|
67
|
-
import { calculateScrollCenter as
|
|
1
|
+
/* 潘启宝 2026-06-30 09:38:37 星期二 山东省济南市 */
|
|
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 { ARROW_TYPE as s, CLASSES as c, CURSOR_TYPE as l, DEFAULT_COLLISION_THRESHOLD as u, DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT as d, DEFAULT_REDUCED_GLOBAL_ALPHA as f, DEFAULT_TEXT_ALIGN as p, DRAW_APP_NAME as m, EVENT as h, FRAME_STYLE as g, IMAGE_MIME_TYPES as ee, MAX_ALLOWED_FILE_BYTES as te, MIME_TYPES as _, POINTER_BUTTON as v, POINTER_EVENTS as y, 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 { trackEvent as k } from "../analytics.js";
|
|
22
|
+
import { ActionManager as et } from "../actions/manager.js";
|
|
23
|
+
import { getDefaultAppState as tt, isEraserActive as A, isHandToolActive as nt } from "../appState.js";
|
|
24
|
+
import rt from "../libs/roughjs/rough.js";
|
|
25
|
+
import { hasBackground as it } from "../element/comparisons.js";
|
|
26
|
+
import { cropElement as at, getUncroppedWidthAndHeight as ot } from "../element/cropElement.js";
|
|
27
|
+
import { hasBoundTextElement as st, isArrowElement as ct, isBindableElement as lt, isBindingElement as j, isBindingElementType as ut, isBoundToContainer as dt, isElbowArrow as M, isEmbeddableElement as ft, isFlowchartNodeElement as pt, isFrameLikeElement as N, isIframeElement as mt, isIframeLikeElement as ht, isImageElement as P, isInitializedImageElement as gt, isLineElement as _t, isLinearElement as F, isLinearElementType as vt, isMagicFrameElement as yt, isSimpleArrow as bt, isTextBindableContainer as xt, isTextElement as I, isUsingAdaptiveRadius as St } from "../element/typeChecks.js";
|
|
28
|
+
import { excludeElementsInFramesFromSelection as Ct, getElementsWithinSelection as wt, getSelectedElements as Tt, getSelectionStateForElements as Et, isSomeElementSelected as Dt, makeNextSelectedElementIds as L } from "../element/selection.js";
|
|
29
|
+
import { getApproxMinLineHeight as Ot, getApproxMinLineWidth as kt, getLineHeightInPx as At, getMinTextElementWidth as jt, isMeasureTextSupported as Mt, measureText as Nt, normalizeText as Pt } from "../element/textMeasurements.js";
|
|
30
|
+
import { wrapText as Ft } from "../element/textWrapping.js";
|
|
31
|
+
import { getBoundTextElement as It, getContainerCenter as Lt, getContainerElement as Rt, isValidTextContainer as zt, redrawTextBoundingBox as Bt } from "../element/textElement.js";
|
|
32
|
+
import { editGroupForSelectedElement as Vt, getElementsInGroup as Ht, getSelectedGroupIdForElement as Ut, getSelectedGroupIds as Wt, isElementInGroup as Gt, isSelectedViaGroup as Kt, selectGroupsForSelectedElements as R } from "../element/groups.js";
|
|
33
|
+
import { mutateElement as qt, newElementWith as z } from "../element/mutateElement.js";
|
|
34
|
+
import { addElementsToFrame as Jt, elementOverlapsWithFrame as Yt, filterElementsEligibleAsFrameChildren as Xt, getContainingFrame as Zt, getElementsInNewFrame as Qt, getElementsInResizingFrame as $t, getElementsOverlappingFrame as en, getFrameChildren as tn, getFrameLikeTitle as nn, isCursorInFrame as rn, isElementInFrame as an, removeElementsFromFrame as on, replaceAllElementsInFrame as sn, updateFrameMembershipOfSelectedElements as cn } from "../element/frame.js";
|
|
35
|
+
import { getRenderOpacity as ln } from "../element/renderElement.js";
|
|
36
|
+
import { ShapeCache as un } from "../element/shape.js";
|
|
37
|
+
import { getCornerRadius as dn, isPathALoop as fn } from "../element/utils.js";
|
|
38
|
+
import { getHoveredElementForBinding as B, hitElementBoundText as pn, hitElementBoundingBox as mn, hitElementBoundingBoxOnly as hn, hitElementItself as gn, isPointInElement as _n } from "../element/collision.js";
|
|
39
|
+
import { bindOrUnbindBindingElement as vn, bindOrUnbindBindingElements as yn, calculateFixedPointForNonElbowArrowBinding as bn, fixBindingsAfterDeletion as xn, isBindingEnabled as Sn, maxBindingDistance_simple as Cn, shouldEnableBindingForPointerEvent as wn, updateBoundElements as Tn } from "../element/binding.js";
|
|
40
|
+
import { syncInvalidIndices as En, syncMovedIndices as Dn } from "../element/fractionalIndex.js";
|
|
41
|
+
import { LinearElementEditor as V } from "../element/linearElementEditor.js";
|
|
42
|
+
import { doBoundsIntersect as On, getCommonBounds as kn, getElementAbsoluteCoords as An, getElementBounds as jn, getVisibleSceneBounds as Mn } from "../element/bounds.js";
|
|
43
|
+
import { getNormalizedDimensions as Nn, isElementCompletelyInViewport as Pn, isElementInViewport as Fn, isInvisiblySmallElement as In } from "../element/sizeHelpers.js";
|
|
44
|
+
import { handleFocusPointDrag as Ln, handleFocusPointHover as Rn, handleFocusPointPointerDown as zn, handleFocusPointPointerUp as Bn } from "../element/arrows/focus.js";
|
|
45
|
+
import { maybeHandleArrowPointlikeDrag as Vn } from "../element/arrows/helpers.js";
|
|
46
|
+
import { isNonDeletedElement as Hn } from "../element/is.js";
|
|
47
|
+
import { Scene as Un } from "../element/Scene.js";
|
|
48
|
+
import { deepCopyElement as Wn, duplicateElements as Gn } from "../element/duplicate.js";
|
|
49
|
+
import { CaptureUpdateAction as H, Store as Kn, StoreDelta as qn, getObservedAppState as Jn } from "../element/store.js";
|
|
50
|
+
import { dragNewElement as Yn, dragSelectedElements as Xn, getDragOffsetXY as Zn } from "../element/dragElements.js";
|
|
51
|
+
import { isElementLink as Qn, parseElementLinkFromURL as $n } from "../element/elementLink.js";
|
|
52
|
+
import { newArrowElement as er, newElement as tr, newEmbeddableElement as nr, newFrameElement as rr, newFreeDrawElement as ir, newIframeElement as ar, newImageElement as or, newLinearElement as sr, newMagicFrameElement as cr, newTextElement as lr, refreshTextDimensions as ur } from "../element/newElement.js";
|
|
53
|
+
import { createSrcDoc as dr, embeddableURLValidator as fr, maybeParseEmbedSrc as pr } from "../element/embeddable.js";
|
|
54
|
+
import { FlowChartCreator as mr, FlowChartNavigator as hr, getLinkDirectionFromKey as gr } from "../element/flowchart.js";
|
|
55
|
+
import { getInitializedImageElements as _r, normalizeSVG as vr, updateImageCache as yr } from "../element/image.js";
|
|
56
|
+
import { positionElementsOnGrid as br } from "../element/positionElementsOnGrid.js";
|
|
57
|
+
import { getResizeArrowDirection as xr, getResizeOffsetXY as Sr, transformElements as Cr } from "../element/resizeElements.js";
|
|
58
|
+
import { hasBoundingBox as wr } from "../element/transformHandles.js";
|
|
59
|
+
import { getCursorForResizingElement as Tr, getElementWithTransformHandleType as Er, getTransformHandleTypeFromCoords as Dr } from "../element/resizeTest.js";
|
|
60
|
+
import { convertToDrawElements as Or } from "../element/transform.js";
|
|
61
|
+
import "../element/index.js";
|
|
62
|
+
import { History as kr } from "../history.js";
|
|
63
|
+
import { AppContext as Ar, AppPropsContext as jr, DrawActionManagerContext as Mr, DrawAppStateContext as Nr, DrawContainerContext as Pr, DrawElementsContext as Fr, DrawHistoryContext as Ir, DrawSetAppStateContext as Lr, EditorInterfaceContext as Rr, editorInterfaceContextDefaultValue as zr } from "./context.js";
|
|
64
|
+
import { editorJotaiStore as Br } from "../editor-jotai.js";
|
|
65
|
+
import { defaultLang as Vr, getLanguage as Hr, languages as Ur, setLanguage as Wr, t as U } from "../i18n.js";
|
|
66
|
+
import { getNormalizedZoom as Gr } from "../scene/normalize.js";
|
|
67
|
+
import { calculateScrollCenter as Kr } from "../scene/scroll.js";
|
|
68
68
|
import "../scene/index.js";
|
|
69
|
-
import { actions as
|
|
70
|
-
import { actionDeleteSelected as
|
|
71
|
-
import { getShortcutKey as
|
|
72
|
-
import { actionDuplicateSelection as
|
|
69
|
+
import { actions as qr } from "../actions/register.js";
|
|
70
|
+
import { actionDeleteSelected as Jr } from "../actions/actionDeleteSelected.js";
|
|
71
|
+
import { getShortcutKey as Yr } from "../shortcut.js";
|
|
72
|
+
import { actionDuplicateSelection as Xr } from "../actions/actionDuplicateSelection.js";
|
|
73
|
+
import { MagicIcon as Zr } from "./icons.js";
|
|
73
74
|
import { ImageSceneDataError as Qr } from "../errors.js";
|
|
74
75
|
import { fileOpen as $r } from "../data/filesystem.js";
|
|
75
76
|
import { Fonts as ei } from "../fonts/Fonts.js";
|
|
@@ -77,45 +78,44 @@ import "../fonts/index.js";
|
|
|
77
78
|
import { restoreAppState as ti, restoreElements as ni } from "../data/restore.js";
|
|
78
79
|
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
80
|
import { copyTextToSystemClipboard as gi, parseClipboard as _i, parseDataTransferEvent as vi } from "../clipboard.js";
|
|
80
|
-
import {
|
|
81
|
-
import {
|
|
82
|
-
import {
|
|
83
|
-
import {
|
|
84
|
-
import {
|
|
85
|
-
import {
|
|
86
|
-
import {
|
|
87
|
-
import { exportCanvas as ki } from "../data/utils.js";
|
|
81
|
+
import { actionSelectAll as yi } from "../actions/actionSelectAll.js";
|
|
82
|
+
import { actionBringForward as bi, actionBringToFront as xi, actionSendBackward as Si, actionSendToBack as Ci } from "../actions/actionZindex.js";
|
|
83
|
+
import { resetCursor as W, setCursor as G, setCursorForShape as K, setEraserCursor as wi } from "../cursor.js";
|
|
84
|
+
import { getStateForZoom as Ti } from "../scene/zoom.js";
|
|
85
|
+
import { actionToggleHandTool as Ei, zoomToFit as Di } from "../actions/actionCanvas.js";
|
|
86
|
+
import { actionFinalize as q } from "../actions/actionFinalize.js";
|
|
87
|
+
import { exportCanvas as Oi } from "../data/utils.js";
|
|
88
88
|
import "../data/index.js";
|
|
89
|
-
import { actionCopyStyles as
|
|
90
|
-
import { actionGroup as
|
|
91
|
-
import { actionAddToLibrary as
|
|
92
|
-
import { actionFlipHorizontal as
|
|
93
|
-
import { actionCopy as
|
|
94
|
-
import { actionToggleGridMode as
|
|
95
|
-
import { actionToggleObjectsSnapMode as
|
|
96
|
-
import { actionToggleZenMode as
|
|
97
|
-
import { actionBindText as
|
|
98
|
-
import { actionToggleElementLock as
|
|
99
|
-
import { actionToggleLinearEditor as
|
|
100
|
-
import { actionToggleStats as
|
|
101
|
-
import { actionToggleCropEditor as
|
|
89
|
+
import { actionCopyStyles as ki, actionPasteStyles as Ai } from "../actions/actionStyles.js";
|
|
90
|
+
import { actionGroup as ji, actionUngroup as Mi } from "../actions/actionGroup.js";
|
|
91
|
+
import { actionAddToLibrary as Ni } from "../actions/actionAddToLibrary.js";
|
|
92
|
+
import { actionFlipHorizontal as Pi, actionFlipVertical as Fi } from "../actions/actionFlip.js";
|
|
93
|
+
import { actionCopy as Ii, actionCopyAsPng as Li, actionCopyAsSvg as Ri, actionCut as zi, actionPaste as Bi, copyText as Vi } from "../actions/actionClipboard.js";
|
|
94
|
+
import { actionToggleGridMode as Hi } from "../actions/actionToggleGridMode.js";
|
|
95
|
+
import { actionToggleObjectsSnapMode as Ui } from "../actions/actionToggleObjectsSnapMode.js";
|
|
96
|
+
import { actionToggleZenMode as Wi } from "../actions/actionToggleZenMode.js";
|
|
97
|
+
import { actionBindText as Gi, actionUnbindText as Ki, actionWrapTextInContainer as qi } from "../actions/actionBoundText.js";
|
|
98
|
+
import { actionToggleElementLock as Ji, actionUnlockAllElements as Yi } from "../actions/actionElementLock.js";
|
|
99
|
+
import { actionToggleLinearEditor as Xi } from "../actions/actionLinearEditor.js";
|
|
100
|
+
import { actionToggleStats as Zi } from "../actions/actionToggleStats.js";
|
|
101
|
+
import { actionToggleCropEditor as Qi } from "../actions/actionCropEditor.js";
|
|
102
102
|
import "../actions/index.js";
|
|
103
|
-
import { actionCopyElementLink as
|
|
104
|
-
import { actionRemoveAllElementsFromFrame as
|
|
105
|
-
import { createRedoAction as
|
|
106
|
-
import { actionTextAutoResize as
|
|
107
|
-
import { actionToggleViewMode as
|
|
108
|
-
import { getShortcutFromShortcutName as
|
|
109
|
-
import { AnimationFrameHandler as
|
|
110
|
-
import
|
|
111
|
-
import { EraserTrail as
|
|
112
|
-
import { getCenter as
|
|
113
|
-
import { LaserTrails as
|
|
114
|
-
import { LassoTrail as
|
|
115
|
-
import { withBatchedUpdates as
|
|
116
|
-
import { Renderer as
|
|
117
|
-
import { isOverScrollBars as
|
|
118
|
-
import { SnapCache as
|
|
103
|
+
import { actionCopyElementLink as $i } from "../actions/actionElementLink.js";
|
|
104
|
+
import { actionRemoveAllElementsFromFrame as ea, actionSelectAllElementsInFrame as ta, actionWrapSelectionInFrame as na } from "../actions/actionFrame.js";
|
|
105
|
+
import { createRedoAction as ra, createUndoAction as ia } from "../actions/actionHistory.js";
|
|
106
|
+
import { actionTextAutoResize as aa } from "../actions/actionTextAutoResize.js";
|
|
107
|
+
import { actionToggleViewMode as oa } from "../actions/actionToggleViewMode.js";
|
|
108
|
+
import { getShortcutFromShortcutName as sa } from "../actions/shortcuts.js";
|
|
109
|
+
import { AnimationFrameHandler as ca } from "../animation-frame-handler.js";
|
|
110
|
+
import la, { distributeLibraryItemsOnSquareGrid as ua } from "../data/library.js";
|
|
111
|
+
import { EraserTrail as da } from "../eraser/index.js";
|
|
112
|
+
import { getCenter as fa, getDistance as pa } from "../gesture.js";
|
|
113
|
+
import { LaserTrails as ma } from "../laser-trails.js";
|
|
114
|
+
import { LassoTrail as ha } from "../lasso/index.js";
|
|
115
|
+
import { withBatchedUpdates as J, withBatchedUpdatesThrottled as ga } from "../reactUtils.js";
|
|
116
|
+
import { Renderer as _a } from "../scene/Renderer.js";
|
|
117
|
+
import { isOverScrollBars as va } from "../scene/scrollbars.js";
|
|
118
|
+
import { SnapCache as ya, 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
119
|
import { textWysiwyg as ka } from "../wysiwyg/textWysiwyg.js";
|
|
120
120
|
import { activeConfirmDialogAtom as Aa } from "./ActiveConfirmDialog.js";
|
|
121
121
|
import ja from "./BraveMeasureTextError.js";
|
|
@@ -144,7 +144,7 @@ import * as no from "@unicom-cloud/utils/ui-color";
|
|
|
144
144
|
import ro from "@unicom-cloud/utils/class-name";
|
|
145
145
|
import io from "@unicom-cloud/icons/IconUiFullscreen";
|
|
146
146
|
import ao from "lodash/isUndefined";
|
|
147
|
-
//#region components/pc/draw/
|
|
147
|
+
//#region components/pc/draw/components/App.tsx
|
|
148
148
|
var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
149
149
|
horizontal: null,
|
|
150
150
|
vertical: null
|
|
@@ -169,26 +169,26 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
169
169
|
#l;
|
|
170
170
|
#u;
|
|
171
171
|
constructor(t) {
|
|
172
|
-
super(t), this.interactiveCanvas = null, this.unmounted = !1, this.editorInterface =
|
|
172
|
+
super(t), this.interactiveCanvas = null, this.unmounted = !1, this.editorInterface = zr, this.#e = le(zr), 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
173
|
this.setToast(null);
|
|
174
|
-
}, this.#l = /* @__PURE__ */ new Set(), this.flowChartCreator = new
|
|
174
|
+
}, this.#l = /* @__PURE__ */ new Set(), this.flowChartCreator = new mr(), this.#u = new hr(), this.bindModeHandler = null, this.lastPointerDownEvent = null, this.lastPointerUpEvent = null, this.lastPointerMoveEvent = null, this.lastPointerMoveCoords = null, this.previousPointerMoveCoords = null, this.lastViewportPosition = {
|
|
175
175
|
x: 0,
|
|
176
176
|
y: 0
|
|
177
|
-
}, this.animationFrameHandler = new
|
|
178
|
-
let n =
|
|
177
|
+
}, this.animationFrameHandler = new ca(), this.laserTrails = new ma(this.animationFrameHandler, this), this.eraserTrail = new da(this.animationFrameHandler, this), this.lassoTrail = new ha(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 = Br.set(e, ...t);
|
|
179
179
|
return this.#se(), n;
|
|
180
180
|
}, this.#p = null, this.getEffectiveGridSize = () => wa(this) ? this.state.gridSize : null, this.#y = (e, t) => {
|
|
181
|
-
this.#o.set(e.id, t),
|
|
181
|
+
this.#o.set(e.id, t), un.delete(e);
|
|
182
182
|
}, this.#b = () => {
|
|
183
183
|
let e = /* @__PURE__ */ new Set(), t = !1;
|
|
184
184
|
this.scene.getNonDeletedElements().filter((n) => {
|
|
185
|
-
if (
|
|
185
|
+
if (ft(n)) {
|
|
186
186
|
if (e.add(n.id), !this.#o.has(n.id)) {
|
|
187
187
|
t = !0;
|
|
188
|
-
let e =
|
|
188
|
+
let e = fr(n.link, this.props.validateEmbeddable);
|
|
189
189
|
this.#y(n, e);
|
|
190
190
|
}
|
|
191
|
-
} else
|
|
191
|
+
} else mt(n) && e.add(n.id);
|
|
192
192
|
return !1;
|
|
193
193
|
}), t && this.scene.triggerUpdate(), this.#a.forEach((t, n) => {
|
|
194
194
|
e.has(n) || this.#a.delete(n);
|
|
@@ -225,9 +225,9 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
225
225
|
e && this.scene.mutateElement(e, { name: e.name?.trim?.() || null }), this.setState({ editingFrame: null });
|
|
226
226
|
}, this.#T = () => {
|
|
227
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 &&
|
|
228
|
+
let e = this.scene.getNonDeletedFramesLikes(), t = e.length > 0 && this.state.searchMatches?.focusedId && N(this.scene.getElement(this.state.searchMatches.focusedId)) ? this.state.searchMatches.matches.find((e) => e.focus) : null;
|
|
229
229
|
return e.map((e) => {
|
|
230
|
-
if (!
|
|
230
|
+
if (!Fn(e, this.canvas.width / window.devicePixelRatio, this.canvas.height / window.devicePixelRatio, {
|
|
231
231
|
offsetLeft: this.state.offsetLeft,
|
|
232
232
|
offsetTop: this.state.offsetTop,
|
|
233
233
|
scrollX: this.state.scrollX,
|
|
@@ -237,7 +237,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
237
237
|
let { x: n, y: r } = qe({
|
|
238
238
|
sceneX: e.x,
|
|
239
239
|
sceneY: e.y
|
|
240
|
-
}, this.state), i, o =
|
|
240
|
+
}, this.state), i, o = nn(e);
|
|
241
241
|
if (e.id === this.state.editingFrame) {
|
|
242
242
|
let t = o;
|
|
243
243
|
i = /* @__PURE__ */ X("input", {
|
|
@@ -275,7 +275,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
275
275
|
} else i = o;
|
|
276
276
|
return /* @__PURE__ */ X("div", {
|
|
277
277
|
id: this.#S(e),
|
|
278
|
-
className:
|
|
278
|
+
className: c.FRAME_NAME,
|
|
279
279
|
style: {
|
|
280
280
|
position: "absolute",
|
|
281
281
|
bottom: `${this.state.height + g.nameOffsetY - r + this.state.offsetTop}px`,
|
|
@@ -289,8 +289,8 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
289
289
|
overflow: e.id === this.state.editingFrame ? "visible" : "hidden",
|
|
290
290
|
whiteSpace: "nowrap",
|
|
291
291
|
textOverflow: "ellipsis",
|
|
292
|
-
cursor:
|
|
293
|
-
pointerEvents: this.state.viewModeEnabled ?
|
|
292
|
+
cursor: l.MOVE,
|
|
293
|
+
pointerEvents: this.state.viewModeEnabled ? y.disabled : y.enabled
|
|
294
294
|
},
|
|
295
295
|
onPointerDown: (e) => this.#Ne(e),
|
|
296
296
|
onWheel: (e) => this.#wt(e),
|
|
@@ -315,7 +315,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
315
315
|
newElementId: this.state.newElement?.id
|
|
316
316
|
});
|
|
317
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 =
|
|
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 = Br.get(Pa)?.type === "panel";
|
|
319
319
|
return /* @__PURE__ */ X(r, {
|
|
320
320
|
componentConfig: {
|
|
321
321
|
Trigger: { className: `${Za}-draw-trigger` },
|
|
@@ -330,7 +330,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
330
330
|
"draw--mobile": this.editorInterface.formFactor === "phone"
|
|
331
331
|
}, this.props.className),
|
|
332
332
|
style: {
|
|
333
|
-
"--ui-pointerEvents": u ?
|
|
333
|
+
"--ui-pointerEvents": u ? y.disabled : y.enabled,
|
|
334
334
|
"--right-sidebar-width": "302px",
|
|
335
335
|
...this.props.style
|
|
336
336
|
},
|
|
@@ -340,23 +340,23 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
340
340
|
onKeyDown: this.props.handleKeyboardGlobally ? void 0 : this.#le,
|
|
341
341
|
onPointerEnter: this.#E,
|
|
342
342
|
onPointerLeave: this.#E,
|
|
343
|
-
children: /* @__PURE__ */ X(e.Consumer, { children: (e) => /* @__PURE__ */ X(
|
|
343
|
+
children: /* @__PURE__ */ X(e.Consumer, { children: (e) => /* @__PURE__ */ X(Ar.Provider, {
|
|
344
344
|
value: this,
|
|
345
|
-
children: /* @__PURE__ */ X(
|
|
345
|
+
children: /* @__PURE__ */ X(jr.Provider, {
|
|
346
346
|
value: this.props,
|
|
347
|
-
children: /* @__PURE__ */ X(
|
|
347
|
+
children: /* @__PURE__ */ X(Pr.Provider, {
|
|
348
348
|
value: this.drawContainerValue,
|
|
349
|
-
children: /* @__PURE__ */ X(
|
|
349
|
+
children: /* @__PURE__ */ X(Rr.Provider, {
|
|
350
350
|
value: this.editorInterface,
|
|
351
|
-
children: /* @__PURE__ */ X(
|
|
351
|
+
children: /* @__PURE__ */ X(Lr.Provider, {
|
|
352
352
|
value: this.setAppState,
|
|
353
|
-
children: /* @__PURE__ */ X(
|
|
353
|
+
children: /* @__PURE__ */ X(Nr.Provider, {
|
|
354
354
|
value: this.state,
|
|
355
|
-
children: /* @__PURE__ */ X(
|
|
355
|
+
children: /* @__PURE__ */ X(Fr.Provider, {
|
|
356
356
|
value: this.scene.getNonDeletedElements(),
|
|
357
|
-
children: /* @__PURE__ */ $a(
|
|
357
|
+
children: /* @__PURE__ */ $a(Ir.Provider, {
|
|
358
358
|
value: this.#i,
|
|
359
|
-
children: [/* @__PURE__ */ $a(
|
|
359
|
+
children: [/* @__PURE__ */ $a(Mr.Provider, {
|
|
360
360
|
value: this.actionManager,
|
|
361
361
|
children: [
|
|
362
362
|
/* @__PURE__ */ X(Va, {
|
|
@@ -369,7 +369,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
369
369
|
onLockToggle: this.toggleLock,
|
|
370
370
|
onPenModeToggle: this.togglePenMode,
|
|
371
371
|
onHandToolToggle: this.onHandToolToggle,
|
|
372
|
-
langCode:
|
|
372
|
+
langCode: Hr().code,
|
|
373
373
|
renderTopLeftUI: i,
|
|
374
374
|
renderTopRightUI: n,
|
|
375
375
|
renderCustomStats: a,
|
|
@@ -390,21 +390,21 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
390
390
|
this.lassoTrail,
|
|
391
391
|
this.eraserTrail
|
|
392
392
|
] }),
|
|
393
|
-
this.props.aiEnabled !== !1 && t.length === 1 &&
|
|
393
|
+
this.props.aiEnabled !== !1 && t.length === 1 && yt(d) && /* @__PURE__ */ X(La, {
|
|
394
394
|
element: d,
|
|
395
395
|
elementsMap: s,
|
|
396
396
|
children: /* @__PURE__ */ X(Ha, {
|
|
397
|
-
title:
|
|
398
|
-
icon:
|
|
397
|
+
title: U("labels.convertToCode"),
|
|
398
|
+
icon: Zr,
|
|
399
399
|
checked: !1,
|
|
400
400
|
onChange: () => this.#k(d, "button")
|
|
401
401
|
})
|
|
402
402
|
}),
|
|
403
|
-
t.length === 1 &&
|
|
403
|
+
t.length === 1 && mt(d) && d.customData?.generationData?.status === "done" && /* @__PURE__ */ $a(La, {
|
|
404
404
|
element: d,
|
|
405
405
|
elementsMap: s,
|
|
406
406
|
children: [/* @__PURE__ */ X(Ha, {
|
|
407
|
-
title:
|
|
407
|
+
title: U("labels.copySource"),
|
|
408
408
|
icon: /* @__PURE__ */ X(to, {}),
|
|
409
409
|
checked: !1,
|
|
410
410
|
onChange: () => this.#A(d)
|
|
@@ -536,8 +536,8 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
536
536
|
files: null
|
|
537
537
|
});
|
|
538
538
|
}, this.onExportImage = async (e, t, n) => {
|
|
539
|
-
|
|
540
|
-
let r = await
|
|
539
|
+
k("export", e, "ui");
|
|
540
|
+
let r = await Oi(e, t, this.state, this.files, {
|
|
541
541
|
exportBackground: this.state.exportBackground,
|
|
542
542
|
name: this.getName(),
|
|
543
543
|
viewBackgroundColor: this.state.viewBackgroundColor,
|
|
@@ -556,19 +556,19 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
556
556
|
}), this.#D.set(e.id, t), this.#se();
|
|
557
557
|
}, this.plugins = {}, this.onMagicframeToolSelect = () => {
|
|
558
558
|
let e = this.scene.getSelectedElements({ selectedElementIds: this.state.selectedElementIds });
|
|
559
|
-
if (e.length === 0) this.setActiveTool({ type: b.magicframe }),
|
|
559
|
+
if (e.length === 0) this.setActiveTool({ type: b.magicframe }), k("ai", "tool-select (empty-selection)", "d2c");
|
|
560
560
|
else {
|
|
561
|
-
let t = e.length === 1 &&
|
|
562
|
-
if (!t && e.some((e) =>
|
|
561
|
+
let t = e.length === 1 && yt(e[0]) && e[0];
|
|
562
|
+
if (!t && e.some((e) => N(e) || e.frameId)) {
|
|
563
563
|
this.setActiveTool({ type: b.magicframe });
|
|
564
564
|
return;
|
|
565
565
|
}
|
|
566
|
-
|
|
566
|
+
k("ai", "tool-select (existing selection)", "d2c");
|
|
567
567
|
let n;
|
|
568
568
|
if (t) n = t;
|
|
569
569
|
else {
|
|
570
|
-
let [t, r, i, a] =
|
|
571
|
-
n =
|
|
570
|
+
let [t, r, i, a] = kn(e);
|
|
571
|
+
n = cr({
|
|
572
572
|
...g,
|
|
573
573
|
x: t - 50,
|
|
574
574
|
y: r - 50,
|
|
@@ -593,16 +593,16 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
593
593
|
...this.state,
|
|
594
594
|
currentItemStrokeColor: t
|
|
595
595
|
},
|
|
596
|
-
captureUpdate:
|
|
596
|
+
captureUpdate: H.IMMEDIATELY
|
|
597
597
|
}) : this.syncActionResult({
|
|
598
598
|
appState: {
|
|
599
599
|
...this.state,
|
|
600
600
|
currentItemBackgroundColor: t
|
|
601
601
|
},
|
|
602
|
-
captureUpdate:
|
|
602
|
+
captureUpdate: H.IMMEDIATELY
|
|
603
603
|
}) : this.updateScene({
|
|
604
|
-
elements: this.scene.getElementsIncludingDeleted().map((e) => this.state.selectedElementIds[e.id] ?
|
|
605
|
-
captureUpdate:
|
|
604
|
+
elements: this.scene.getElementsIncludingDeleted().map((e) => this.state.selectedElementIds[e.id] ? z(e, { [r ? "strokeColor" : "backgroundColor"]: t }) : e),
|
|
605
|
+
captureUpdate: H.IMMEDIATELY
|
|
606
606
|
});
|
|
607
607
|
},
|
|
608
608
|
keepOpenOnAlt: !1
|
|
@@ -614,14 +614,14 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
614
614
|
isEditing: !1
|
|
615
615
|
} });
|
|
616
616
|
});
|
|
617
|
-
}, this.syncActionResult =
|
|
617
|
+
}, this.syncActionResult = J((e) => {
|
|
618
618
|
if (this.unmounted || e === !1) return;
|
|
619
619
|
this.#r.scheduleAction(e.captureUpdate);
|
|
620
620
|
let t = !1, n = null;
|
|
621
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
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
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 &&
|
|
624
|
+
n?.id === e.id && n !== e && Hn(e) && I(e) && (n = e);
|
|
625
625
|
}), n?.isDeleted && (n = null), this.setState((t) => {
|
|
626
626
|
let c = e.appState || {};
|
|
627
627
|
return {
|
|
@@ -638,7 +638,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
638
638
|
}), t = !0;
|
|
639
639
|
}
|
|
640
640
|
t || this.scene.triggerUpdate();
|
|
641
|
-
}), this.#M =
|
|
641
|
+
}), this.#M = J(() => {
|
|
642
642
|
lo = !1, this.setState({ isBindingEnabled: !0 });
|
|
643
643
|
}), this.#N = () => {
|
|
644
644
|
this.#M();
|
|
@@ -648,9 +648,9 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
648
648
|
this.#i.clear();
|
|
649
649
|
}, this.#I = () => {
|
|
650
650
|
this.#r.clear();
|
|
651
|
-
}, this.#L =
|
|
651
|
+
}, this.#L = J((e) => {
|
|
652
652
|
this.scene.replaceAllElements([]), this.setState((t) => ({
|
|
653
|
-
...
|
|
653
|
+
...tt(),
|
|
654
654
|
isLoading: e?.resetLoadingState ? !1 : t.isLoading,
|
|
655
655
|
theme: this.state.theme
|
|
656
656
|
})), this.#I(), this.#F();
|
|
@@ -690,7 +690,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
690
690
|
toast: this.state.toast
|
|
691
691
|
}, e?.scrollToContent && (n = {
|
|
692
692
|
...n,
|
|
693
|
-
...
|
|
693
|
+
...Kr(t, {
|
|
694
694
|
...n,
|
|
695
695
|
width: this.state.width,
|
|
696
696
|
height: this.state.height,
|
|
@@ -701,10 +701,10 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
701
701
|
elements: t,
|
|
702
702
|
appState: n,
|
|
703
703
|
files: e?.files,
|
|
704
|
-
captureUpdate:
|
|
704
|
+
captureUpdate: H.NEVER
|
|
705
705
|
}), this.#H(), this.fonts.loadSceneFonts().then((e) => {
|
|
706
706
|
this.fonts.onLoaded(e);
|
|
707
|
-
}),
|
|
707
|
+
}), Qn(window.location.href) && this.scrollToContent(window.location.href, { animate: !1 });
|
|
708
708
|
}, this.#z = (e, t) => this.props.UIOptions.getFormFactor?.(e, t) ?? ue(e, t), this.refreshEditorInterface = () => {
|
|
709
709
|
let e = this.rootElement;
|
|
710
710
|
if (!e) return;
|
|
@@ -730,8 +730,8 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
730
730
|
}, this.#U = (e) => {
|
|
731
731
|
let { key: t, value: n } = e ?? {};
|
|
732
732
|
t !== "draw" && (n ? this.setState({ theme: re.DARK }) : this.setState({ theme: re.LIGHT }));
|
|
733
|
-
}, this.#W =
|
|
734
|
-
this.scene.getElementsIncludingDeleted().forEach((e) =>
|
|
733
|
+
}, this.#W = J(() => {
|
|
734
|
+
this.scene.getElementsIncludingDeleted().forEach((e) => un.delete(e)), this.refreshEditorInterface(), this.#Ot(), this.setState({});
|
|
735
735
|
}), this.#G = () => {
|
|
736
736
|
!document.fullscreenElement && this.state.activeEmbeddable?.state === "active" && this.setState({ activeEmbeddable: null });
|
|
737
737
|
}, this.#J = ({ atLeastOneVisibleElement: e, scrollBars: t, elementsMap: n }) => {
|
|
@@ -744,10 +744,10 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
744
744
|
offsetTop: e,
|
|
745
745
|
offsetLeft: t
|
|
746
746
|
});
|
|
747
|
-
}, 100), this.#X =
|
|
748
|
-
!this.rootElement?.contains?.(document.activeElement) || We(e.target) || (this.actionManager.executeAction(
|
|
749
|
-
}), this.#Z =
|
|
750
|
-
!this.rootElement?.contains?.(document.activeElement) || We(e.target) || (this.actionManager.executeAction(
|
|
747
|
+
}, 100), this.#X = J((e) => {
|
|
748
|
+
!this.rootElement?.contains?.(document.activeElement) || We(e.target) || (this.actionManager.executeAction(zi, "keyboard", e), e.preventDefault(), e.stopPropagation());
|
|
749
|
+
}), this.#Z = J((e) => {
|
|
750
|
+
!this.rootElement?.contains?.(document.activeElement) || We(e.target) || (this.actionManager.executeAction(Ii, "keyboard", e), e.preventDefault(), e.stopPropagation());
|
|
751
751
|
}), this.#$ = (e) => {
|
|
752
752
|
if (fe && e.preventDefault(), !oo) {
|
|
753
753
|
oo = !0, e.touches.length === 1 && (co = {
|
|
@@ -764,15 +764,15 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
764
764
|
})), oo = !1, clearTimeout(so);
|
|
765
765
|
}
|
|
766
766
|
e.touches.length === 2 && this.setState({
|
|
767
|
-
selectedElementIds:
|
|
767
|
+
selectedElementIds: L({}, this.state),
|
|
768
768
|
activeEmbeddable: null
|
|
769
769
|
});
|
|
770
770
|
}, this.#ee = (e) => {
|
|
771
771
|
this.#Ie(), e.touches.length > 0 ? this.setState({
|
|
772
772
|
previousSelectedElementIds: {},
|
|
773
|
-
selectedElementIds:
|
|
773
|
+
selectedElementIds: L(this.state.previousSelectedElementIds, this.state)
|
|
774
774
|
}) : $.pointers.clear();
|
|
775
|
-
}, this.pasteFromClipboard =
|
|
775
|
+
}, this.pasteFromClipboard = J(async (e) => {
|
|
776
776
|
let t = !!ho, n = document.activeElement, r = this.rootElement?.contains?.(n);
|
|
777
777
|
if (e && !r) return;
|
|
778
778
|
let i = document.elementFromPoint(this.lastViewportPosition.x, this.lastViewportPosition.y);
|
|
@@ -785,38 +785,38 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
785
785
|
}
|
|
786
786
|
await this.#te(s, o, t), this.setActiveTool({ type: this.state.preferredSelectionTool.type }, !0), e?.preventDefault?.();
|
|
787
787
|
}), this.addElementsFromPasteOrLibrary = (e) => {
|
|
788
|
-
let t = ni(e.elements, null, { deleteInvisibleElements: !0 }), [n, r, i, a] =
|
|
788
|
+
let t = ni(e.elements, null, { deleteInvisibleElements: !0 }), [n, r, i, a] = kn(t), o = Me(n, i) / 2, s = Me(r, a) / 2, { x: c, y: l } = O({
|
|
789
789
|
clientX: typeof e.position == "object" ? e.position.clientX : e.position === "cursor" ? this.lastViewportPosition.x : this.state.width / 2 + this.state.offsetLeft,
|
|
790
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 } =
|
|
791
|
+
}, this.state), [u, d] = C(c - o, l - s, this.getEffectiveGridSize()), { duplicatedElements: f } = Gn({
|
|
792
792
|
type: "everything",
|
|
793
|
-
elements: t.map((e) =>
|
|
793
|
+
elements: t.map((e) => z(e, {
|
|
794
794
|
x: e.x + u - n,
|
|
795
795
|
y: e.y + d - r
|
|
796
796
|
})),
|
|
797
797
|
randomizeSeed: !e.retainSeed
|
|
798
798
|
}), p = this.scene.getElementsIncludingDeleted(), m = [...p, ...f];
|
|
799
|
-
m = this.props.onDuplicate?.(m, p) || m,
|
|
799
|
+
m = this.props.onDuplicate?.(m, p) || m, Dn(m, Ae(f));
|
|
800
800
|
let h = this.#ke({
|
|
801
801
|
x: c,
|
|
802
802
|
y: l
|
|
803
803
|
});
|
|
804
804
|
if (h) {
|
|
805
|
-
let e =
|
|
806
|
-
|
|
805
|
+
let e = Xt(f, h);
|
|
806
|
+
Jt(m, e, h, this.state);
|
|
807
807
|
}
|
|
808
808
|
this.scene.replaceAllElements(m), f.forEach((e) => {
|
|
809
|
-
|
|
809
|
+
I(e) && dt(e) && Bt(e, Rt(e, this.scene.getElementsMapIncludingDeleted()), this.scene);
|
|
810
810
|
}), pe && ei.loadElementsFonts(f).then((e) => {
|
|
811
811
|
this.fonts.onLoaded(e);
|
|
812
812
|
}), e.files && this.#oe(e.files);
|
|
813
|
-
let g =
|
|
813
|
+
let g = Ct(f);
|
|
814
814
|
this.#r.scheduleCapture(), this.setState({
|
|
815
815
|
...this.state,
|
|
816
816
|
openSidebar: this.state.openSidebar && this.editorInterface.canFitSidebar ? this.state.openSidebar : null,
|
|
817
|
-
...
|
|
817
|
+
...R({
|
|
818
818
|
editingGroupId: null,
|
|
819
|
-
selectedElementIds: g.reduce((e, t) => (
|
|
819
|
+
selectedElementIds: g.reduce((e, t) => (dt(t) || (e[t.id] = !0), e), {})
|
|
820
820
|
}, this.scene.getNonDeletedElements(), this.state, this)
|
|
821
821
|
}, () => {
|
|
822
822
|
e.files && this.#ft();
|
|
@@ -829,7 +829,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
829
829
|
}, this.removePointer = (e) => {
|
|
830
830
|
Q && this.#Ie(), $.pointers.delete(e.pointerId);
|
|
831
831
|
}, this.toggleLock = (e = "ui") => {
|
|
832
|
-
this.state.activeTool.locked ||
|
|
832
|
+
this.state.activeTool.locked || k("toolbar", "toggleLock", `${e} (${this.editorInterface.formFactor === "phone" ? "mobile" : "desktop"})`), this.setState((e) => ({ activeTool: {
|
|
833
833
|
...e.activeTool,
|
|
834
834
|
...D(this.state, e.activeTool.locked ? { type: this.state.preferredSelectionTool.type } : e.activeTool),
|
|
835
835
|
locked: !e.activeTool.locked
|
|
@@ -850,23 +850,23 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
850
850
|
penDetected: !0
|
|
851
851
|
}));
|
|
852
852
|
}, this.onHandToolToggle = () => {
|
|
853
|
-
this.actionManager.executeAction(
|
|
853
|
+
this.actionManager.executeAction(Ei);
|
|
854
854
|
}, this.zoomCanvas = (e) => {
|
|
855
|
-
this.setState({ ...
|
|
855
|
+
this.setState({ ...Ti({
|
|
856
856
|
viewportX: this.state.width / 2 + this.state.offsetLeft,
|
|
857
857
|
viewportY: this.state.height / 2 + this.state.offsetTop,
|
|
858
|
-
nextZoom:
|
|
858
|
+
nextZoom: Gr(e)
|
|
859
859
|
}, this.state) });
|
|
860
860
|
}, this.#ie = null, this.scrollToContent = (e = this.scene.getNonDeletedElements(), t) => {
|
|
861
861
|
if (typeof e == "string") {
|
|
862
862
|
let n;
|
|
863
|
-
if (n =
|
|
863
|
+
if (n = Qn(e) ? $n(e) : e, n) {
|
|
864
864
|
let r = this.scene.getElementsFromId(n);
|
|
865
865
|
r?.length ? this.scrollToContent(r, {
|
|
866
866
|
fitToContent: t?.fitToContent ?? !0,
|
|
867
867
|
animate: t?.animate ?? !0
|
|
868
|
-
}) :
|
|
869
|
-
message:
|
|
868
|
+
}) : Qn(e) && this.setState({ toast: {
|
|
869
|
+
message: U("elementLink.notFound"),
|
|
870
870
|
duration: 3e3,
|
|
871
871
|
closable: !0
|
|
872
872
|
} });
|
|
@@ -876,7 +876,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
876
876
|
this.#ie?.();
|
|
877
877
|
let n = Array.isArray(e) ? e : [e], r = this.state.zoom, i = this.state.scrollX, a = this.state.scrollY;
|
|
878
878
|
if (t?.fitToContent || t?.fitToViewport) {
|
|
879
|
-
let { appState: e } =
|
|
879
|
+
let { appState: e } = Di({
|
|
880
880
|
canvasOffsets: t.canvasOffsets,
|
|
881
881
|
targetElements: n,
|
|
882
882
|
appState: this.state,
|
|
@@ -887,7 +887,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
887
887
|
});
|
|
888
888
|
r = e.zoom, i = e.scrollX, a = e.scrollY;
|
|
889
889
|
} else {
|
|
890
|
-
let e =
|
|
890
|
+
let e = Kr(n, this.state);
|
|
891
891
|
i = e.scrollX, a = e.scrollY;
|
|
892
892
|
}
|
|
893
893
|
if (t?.animate) {
|
|
@@ -940,27 +940,27 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
940
940
|
let e = await caches.open("web-share-target"), t = await e.match("shared-file");
|
|
941
941
|
if (t) {
|
|
942
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,
|
|
943
|
+
this.loadFileToCanvas(r, null), await e.delete("shared-file"), window.history.replaceState(null, m, window.location.pathname);
|
|
944
944
|
}
|
|
945
945
|
} catch (e) {
|
|
946
946
|
this.setState({ errorMessage: e.message });
|
|
947
947
|
}
|
|
948
|
-
}, this.addFiles =
|
|
948
|
+
}, this.addFiles = J((e) => {
|
|
949
949
|
let { addedFiles: t } = this.#oe(e);
|
|
950
950
|
this.#H(t), this.scene.triggerUpdate(), this.#ft();
|
|
951
951
|
}), this.#oe = (e, t = !1) => {
|
|
952
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 ===
|
|
954
|
-
let t = ci(
|
|
953
|
+
for (let e of i) if (!n[e.id] && (r[e.id] = e, n[e.id] = e, e.mimeType === _.svg)) try {
|
|
954
|
+
let t = ci(vr(ai(e.dataURL)), _.svg);
|
|
955
955
|
e.dataURL !== t && (e.version = (e.version ?? 1) + 1, e.dataURL = t);
|
|
956
956
|
} catch (e) {
|
|
957
957
|
console.error(e);
|
|
958
958
|
}
|
|
959
959
|
return this.files = n, { addedFiles: r };
|
|
960
|
-
}, this.updateScene =
|
|
960
|
+
}, this.updateScene = J((e) => {
|
|
961
961
|
let { elements: t, appState: n, collaborators: r, captureUpdate: i } = e;
|
|
962
962
|
if (i) {
|
|
963
|
-
let e = t || void 0, r = n ?
|
|
963
|
+
let e = t || void 0, r = n ? Jn({
|
|
964
964
|
...this.#r.snapshot.appState,
|
|
965
965
|
...n
|
|
966
966
|
}) : void 0;
|
|
@@ -972,8 +972,8 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
972
972
|
}
|
|
973
973
|
n && this.setState(n), t && this.scene.replaceAllElements(t), r && this.setState({ collaborators: r });
|
|
974
974
|
}), this.applyDeltas = (e, t) => {
|
|
975
|
-
let n =
|
|
976
|
-
return
|
|
975
|
+
let n = qn.squash(...e), r = { ...this.state }, i = new Map(this.scene.getElementsMapIncludingDeleted());
|
|
976
|
+
return qn.applyTo(n, i, r, t);
|
|
977
977
|
}, this.mutateElement = (e, t, n = !0) => this.scene.mutateElement(e, t, {
|
|
978
978
|
informMutation: n,
|
|
979
979
|
isDragging: !1
|
|
@@ -984,11 +984,11 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
984
984
|
r = ao(n) ? this.state.openSidebar?.name === e && this.state.openSidebar?.tab === t ? null : e : n ? e : null;
|
|
985
985
|
let i = r ? { name: r } : null;
|
|
986
986
|
return i && t && (i.tab = t), this.setState({ openSidebar: i }), !!r;
|
|
987
|
-
}, this.#ce =
|
|
987
|
+
}, this.#ce = J((e) => {
|
|
988
988
|
this.lastViewportPosition.x = e.clientX, this.lastViewportPosition.y = e.clientY;
|
|
989
989
|
}), this.getEditorUIOffsets = () => {
|
|
990
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
|
|
991
|
+
return Hr().rtl ? {
|
|
992
992
|
top: e + 16,
|
|
993
993
|
right: Math.max(this.state.width - (n?.left ?? this.state.width), 0) + 16,
|
|
994
994
|
bottom: 16,
|
|
@@ -999,7 +999,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
999
999
|
bottom: 16,
|
|
1000
1000
|
left: Math.max(n?.right ?? 0, 0) + 16
|
|
1001
1001
|
};
|
|
1002
|
-
}, this.#le =
|
|
1002
|
+
}, this.#le = J((e) => {
|
|
1003
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
1004
|
let r = t[n];
|
|
1005
1005
|
return typeof r == "function" ? r.bind(t) : n === "key" ? e.shiftKey ? t.key.toUpperCase() : t.key.toLowerCase() : r;
|
|
@@ -1008,16 +1008,16 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1008
1008
|
this.#De();
|
|
1009
1009
|
return;
|
|
1010
1010
|
}
|
|
1011
|
-
let t =
|
|
1012
|
-
if (t.length === 1 &&
|
|
1011
|
+
let t = Tt(this.scene.getNonDeletedElementsMap(), this.state);
|
|
1012
|
+
if (t.length === 1 && P(t[0]) && e.key === x.ENTER) {
|
|
1013
1013
|
this.#Ee(t[0]);
|
|
1014
1014
|
return;
|
|
1015
1015
|
}
|
|
1016
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?.(
|
|
1017
|
+
else if (e.key === x.TAB && (document.activeElement === this.rootElement || document.activeElement?.classList?.contains?.(c.CONVERT_ELEMENT_TYPE_POPUP))) {
|
|
1018
1018
|
e.preventDefault();
|
|
1019
1019
|
let n = Ia(t);
|
|
1020
|
-
|
|
1020
|
+
Br.get(Pa)?.type === "panel" && Fa(this, {
|
|
1021
1021
|
conversionType: n,
|
|
1022
1022
|
direction: e.shiftKey ? "left" : "right"
|
|
1023
1023
|
}) && this.#r.scheduleCapture(), n && this.updateEditorAtom(Pa, { type: "panel" });
|
|
@@ -1029,8 +1029,8 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1029
1029
|
let n = ye(e.key);
|
|
1030
1030
|
if (e[x.CTRL_OR_CMD] && n && !e.shiftKey) {
|
|
1031
1031
|
e.preventDefault();
|
|
1032
|
-
let t =
|
|
1033
|
-
t.length === 1 &&
|
|
1032
|
+
let t = Tt(this.scene.getNonDeletedElementsMap(), this.state);
|
|
1033
|
+
t.length === 1 && pt(t[0]) && this.flowChartCreator.createNodes(t[0], this.state, gr(e.key), this.scene), this.flowChartCreator.pendingNodes?.length && !Pn(this.flowChartCreator.pendingNodes, this.canvas.width / window.devicePixelRatio, this.canvas.height / window.devicePixelRatio, {
|
|
1034
1034
|
offsetLeft: this.state.offsetLeft,
|
|
1035
1035
|
offsetTop: this.state.offsetTop,
|
|
1036
1036
|
scrollX: this.state.scrollX,
|
|
@@ -1045,14 +1045,14 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1045
1045
|
return;
|
|
1046
1046
|
}
|
|
1047
1047
|
if (e.altKey) {
|
|
1048
|
-
let t =
|
|
1048
|
+
let t = Tt(this.scene.getNonDeletedElementsMap(), this.state);
|
|
1049
1049
|
if (t.length === 1 && n) {
|
|
1050
1050
|
e.preventDefault();
|
|
1051
|
-
let n = this.#u.exploreByDirection(t[0], this.scene.getNonDeletedElementsMap(),
|
|
1051
|
+
let n = this.#u.exploreByDirection(t[0], this.scene.getNonDeletedElementsMap(), gr(e.key));
|
|
1052
1052
|
if (n) {
|
|
1053
|
-
this.setState((e) => ({ selectedElementIds:
|
|
1053
|
+
this.setState((e) => ({ selectedElementIds: L({ [n]: !0 }, e) }));
|
|
1054
1054
|
let e = this.scene.getNonDeletedElementsMap().get(n);
|
|
1055
|
-
e && !
|
|
1055
|
+
e && !Pn([e], this.canvas.width / window.devicePixelRatio, this.canvas.height / window.devicePixelRatio, {
|
|
1056
1056
|
offsetLeft: this.state.offsetLeft,
|
|
1057
1057
|
offsetTop: this.state.offsetTop,
|
|
1058
1058
|
scrollX: this.state.scrollX,
|
|
@@ -1069,7 +1069,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1069
1069
|
}
|
|
1070
1070
|
}
|
|
1071
1071
|
if (e[x.CTRL_OR_CMD] && e.key === x.P && !e.shiftKey && !e.altKey) {
|
|
1072
|
-
this.setToast({ message:
|
|
1072
|
+
this.setToast({ message: U("commandPalette.shortcutHint", { shortcut: sa("commandPalette") }) }), e.preventDefault();
|
|
1073
1073
|
return;
|
|
1074
1074
|
}
|
|
1075
1075
|
if (e[x.CTRL_OR_CMD] && e.key.toLowerCase() === x.V && (ho = e.shiftKey, clearTimeout(go), go = window.setTimeout(() => {
|
|
@@ -1090,13 +1090,13 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1090
1090
|
let t = (e.shiftKey ? this.state.width : this.state.height) / this.state.zoom.value;
|
|
1091
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
1092
|
}
|
|
1093
|
-
if (this.state.openDialog?.name === "elementLinkSelector" || (e.key === x.ALT && (T("COMPLEX_BINDINGS") ? this.#d() :
|
|
1093
|
+
if (this.state.openDialog?.name === "elementLinkSelector" || (e.key === x.ALT && (T("COMPLEX_BINDINGS") ? this.#d() : Vn({
|
|
1094
1094
|
app: this,
|
|
1095
1095
|
event: e
|
|
1096
1096
|
})), this.actionManager.handleKeyDown(e)) || this.state.viewModeEnabled) return;
|
|
1097
1097
|
if (e[x.CTRL_OR_CMD] && this.state.isBindingEnabled && (T("COMPLEX_BINDINGS") && this.#f(), Z(() => {
|
|
1098
1098
|
this.setState({ isBindingEnabled: !1 });
|
|
1099
|
-
}),
|
|
1099
|
+
}), Vn({
|
|
1100
1100
|
app: this,
|
|
1101
1101
|
event: e
|
|
1102
1102
|
})), ye(e.key)) {
|
|
@@ -1105,7 +1105,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1105
1105
|
includeBoundTextElement: !0,
|
|
1106
1106
|
includeElementsInFrames: !0
|
|
1107
1107
|
}), n = /* @__PURE__ */ new Set();
|
|
1108
|
-
t.filter((e) =>
|
|
1108
|
+
t.filter((e) => j(e)).filter((e) => {
|
|
1109
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
1110
|
return n || r;
|
|
1111
1111
|
}).forEach((e) => n.add(e.id)), t = t.filter((e) => !n.has(e.id));
|
|
@@ -1117,38 +1117,38 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1117
1117
|
}, {
|
|
1118
1118
|
informMutation: !1,
|
|
1119
1119
|
isDragging: !1
|
|
1120
|
-
}),
|
|
1120
|
+
}), Tn(e, this.scene, { simultaneouslyUpdated: t });
|
|
1121
1121
|
}), this.scene.triggerUpdate(), e.preventDefault();
|
|
1122
1122
|
} else if (e.key === x.ENTER) {
|
|
1123
1123
|
let t = this.scene.getSelectedElements(this.state);
|
|
1124
1124
|
if (t.length === 1) {
|
|
1125
1125
|
let n = t[0];
|
|
1126
|
-
if (e[x.CTRL_OR_CMD] ||
|
|
1127
|
-
else if (
|
|
1126
|
+
if (e[x.CTRL_OR_CMD] || _t(n)) F(n) && (!this.state.selectedLinearElement?.isEditing || this.state.selectedLinearElement.elementId !== n.id) && (this.#r.scheduleCapture(), M(n) || this.actionManager.executeAction(Xi));
|
|
1127
|
+
else if (I(n) || zt(n)) {
|
|
1128
1128
|
let t;
|
|
1129
|
-
|
|
1130
|
-
let r =
|
|
1129
|
+
I(n) || (t = n);
|
|
1130
|
+
let r = Lt(n, this.state, this.scene.getNonDeletedElementsMap()), i = r.x, a = r.y;
|
|
1131
1131
|
this.#Te({
|
|
1132
1132
|
sceneX: i,
|
|
1133
1133
|
sceneY: a,
|
|
1134
1134
|
container: t
|
|
1135
1135
|
}), e.preventDefault();
|
|
1136
1136
|
return;
|
|
1137
|
-
} else
|
|
1137
|
+
} else N(n) && this.setState({ editingFrame: n.id });
|
|
1138
1138
|
}
|
|
1139
1139
|
} else if (!e.ctrlKey && !e.altKey && !e.metaKey && !this.state.newElement && !this.state.selectionElement && !this.state.selectedElementsAreBeingDragged) {
|
|
1140
1140
|
let t = za(e.key, this);
|
|
1141
|
-
t ? (this.state.activeTool.type !== t &&
|
|
1141
|
+
t ? (this.state.activeTool.type !== t && k("toolbar", t, `keyboard (${this.editorInterface.formFactor === "phone" ? "mobile" : "desktop"})`), t === "arrow" && this.state.activeTool.type === "arrow" && this.setState((e) => ({ currentItemArrowType: e.currentItemArrowType === s.sharp ? s.round : e.currentItemArrowType === s.round ? s.elbow : s.sharp })), this.setActiveTool({ type: t }), e.stopPropagation()) : e.key === x.Q && (this.toggleLock("keyboard"), e.stopPropagation());
|
|
1142
1142
|
}
|
|
1143
|
-
if (e.key === x.SPACE && $.pointers.size === 0 && (lo = !0,
|
|
1143
|
+
if (e.key === x.SPACE && $.pointers.size === 0 && (lo = !0, G(this.interactiveCanvas, l.GRAB), e.preventDefault()), (e.key === x.G || e.key === x.S) && !e.altKey && !e[x.CTRL_OR_CMD]) {
|
|
1144
1144
|
let t = this.scene.getSelectedElements(this.state);
|
|
1145
1145
|
if (this.state.activeTool.type === "selection" && !t.length) return;
|
|
1146
|
-
e.key === x.G && (
|
|
1146
|
+
e.key === x.G && (it(this.state.activeTool.type) || t.some((e) => it(e.type))) && (this.setState({ openPopup: "elementBackground" }), e.stopPropagation()), e.key === x.S && (this.setState({ openPopup: "elementStroke" }), e.stopPropagation());
|
|
1147
1147
|
}
|
|
1148
1148
|
if (!e[x.CTRL_OR_CMD] && e.shiftKey && e.key.toLowerCase() === x.F) {
|
|
1149
1149
|
let t = this.scene.getSelectedElements(this.state);
|
|
1150
1150
|
if (this.state.activeTool.type === "selection" && !t.length) return;
|
|
1151
|
-
(this.state.activeTool.type === "text" || t.find((e) =>
|
|
1151
|
+
(this.state.activeTool.type === "text" || t.find((e) => I(e) || It(e, this.scene.getNonDeletedElementsMap()))) && (e.preventDefault(), this.setState({ openPopup: "fontFamily" }));
|
|
1152
1152
|
}
|
|
1153
1153
|
if (e.key === x.K && !e.altKey && !e[x.CTRL_OR_CMD]) {
|
|
1154
1154
|
this.state.activeTool.type === "laser" ? this.setActiveTool({ type: this.state.preferredSelectionTool.type }) : this.setActiveTool({ type: "laser" });
|
|
@@ -1157,47 +1157,47 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1157
1157
|
e[x.CTRL_OR_CMD] && (e.key === x.BACKSPACE || e.key === x.DELETE) && this.updateEditorAtom(Aa, "clearCanvas");
|
|
1158
1158
|
let t = e.key.toLocaleLowerCase(), n = t === x.S && e.shiftKey, r = e.key === x.I || t === x.G && e.shiftKey;
|
|
1159
1159
|
(n || r) && this.#j({ type: n ? "stroke" : "background" });
|
|
1160
|
-
}), this.#ue =
|
|
1161
|
-
if (e.key === x.SPACE && (this.state.viewModeEnabled || this.state.openDialog?.name === "elementLinkSelector" ?
|
|
1162
|
-
selectedElementIds:
|
|
1160
|
+
}), this.#ue = J((e) => {
|
|
1161
|
+
if (e.key === x.SPACE && (this.state.viewModeEnabled || this.state.openDialog?.name === "elementLinkSelector" ? G(this.interactiveCanvas, l.GRAB) : Be(this.state.activeTool.type) ? W(this.interactiveCanvas) : (K(this.interactiveCanvas, this.state), this.setState({
|
|
1162
|
+
selectedElementIds: L({}, this.state),
|
|
1163
1163
|
selectedGroupIds: {},
|
|
1164
1164
|
editingGroupId: null,
|
|
1165
1165
|
activeEmbeddable: null
|
|
1166
|
-
})), lo = !1), e.key === x.ALT &&
|
|
1166
|
+
})), lo = !1), e.key === x.ALT && Vn({
|
|
1167
1167
|
app: this,
|
|
1168
1168
|
event: e
|
|
1169
|
-
}), (e.key === x.ALT && this.state.bindMode === "skip" || !e[x.CTRL_OR_CMD] && !
|
|
1169
|
+
}), (e.key === x.ALT && this.state.bindMode === "skip" || !e[x.CTRL_OR_CMD] && !Sn(this.state)) && (this.setState({ bindMode: "orbit" }), this.lastPointerMoveEvent && T("COMPLEX_BINDINGS"))) {
|
|
1170
1170
|
let e = O({
|
|
1171
1171
|
clientX: this.lastPointerMoveEvent.clientX,
|
|
1172
1172
|
clientY: this.lastPointerMoveEvent.clientY
|
|
1173
|
-
}, this.state), t =
|
|
1173
|
+
}, this.state), t = B(S(e.x, e.y), this.scene.getNonDeletedElements(), this.scene.getNonDeletedElementsMap());
|
|
1174
1174
|
if (this.state.selectedLinearElement) {
|
|
1175
|
-
let e =
|
|
1176
|
-
|
|
1175
|
+
let e = V.getElement(this.state.selectedLinearElement.elementId, this.scene.getNonDeletedElementsMap());
|
|
1176
|
+
j(e) && this.#m(e, t);
|
|
1177
1177
|
}
|
|
1178
1178
|
}
|
|
1179
1179
|
if (!e[x.CTRL_OR_CMD] && !this.state.isBindingEnabled && (Z(() => {
|
|
1180
1180
|
this.setState({ isBindingEnabled: !0 });
|
|
1181
|
-
}),
|
|
1181
|
+
}), Vn({
|
|
1182
1182
|
app: this,
|
|
1183
1183
|
event: e
|
|
1184
1184
|
})), ye(e.key)) {
|
|
1185
|
-
|
|
1185
|
+
yn(this.scene.getSelectedElements(this.state).filter(ct), this.scene, this.state);
|
|
1186
1186
|
let e = this.scene.getNonDeletedElementsMap();
|
|
1187
|
-
this.scene.getSelectedElements(this.state).filter(
|
|
1187
|
+
this.scene.getSelectedElements(this.state).filter(bt).forEach((t) => {
|
|
1188
1188
|
t.startBinding && this.scene.mutateElement(t, { startBinding: {
|
|
1189
1189
|
...t.startBinding,
|
|
1190
|
-
...
|
|
1190
|
+
...bn(t, e.get(t.startBinding.elementId), "start", e)
|
|
1191
1191
|
} }), t.endBinding && this.scene.mutateElement(t, { endBinding: {
|
|
1192
1192
|
...t.endBinding,
|
|
1193
|
-
...
|
|
1193
|
+
...bn(t, e.get(t.endBinding.elementId), "end", e)
|
|
1194
1194
|
} });
|
|
1195
1195
|
}), this.setState({ suggestedBinding: null });
|
|
1196
1196
|
}
|
|
1197
|
-
if (e.altKey || this.#u.isExploring && (this.#u.clear(), this.syncActionResult({ captureUpdate:
|
|
1197
|
+
if (e.altKey || this.#u.isExploring && (this.#u.clear(), this.syncActionResult({ captureUpdate: H.IMMEDIATELY })), !e[x.CTRL_OR_CMD] && this.flowChartCreator.isCreatingChart) {
|
|
1198
1198
|
this.flowChartCreator.pendingNodes?.length && this.scene.insertElements(this.flowChartCreator.pendingNodes);
|
|
1199
1199
|
let e = this.flowChartCreator.pendingNodes?.[0];
|
|
1200
|
-
e && (this.setState((t) => ({ selectedElementIds:
|
|
1200
|
+
e && (this.setState((t) => ({ selectedElementIds: L({ [e.id]: !0 }, t) })), Pn([e], this.canvas.width / window.devicePixelRatio, this.canvas.height / window.devicePixelRatio, {
|
|
1201
1201
|
offsetLeft: this.state.offsetLeft,
|
|
1202
1202
|
offsetTop: this.state.offsetTop,
|
|
1203
1203
|
scrollX: this.state.scrollX,
|
|
@@ -1207,7 +1207,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1207
1207
|
animate: !0,
|
|
1208
1208
|
duration: 300,
|
|
1209
1209
|
canvasOffsets: this.getEditorUIOffsets()
|
|
1210
|
-
})), this.flowChartCreator.clear(), this.syncActionResult({ captureUpdate:
|
|
1210
|
+
})), this.flowChartCreator.clear(), this.syncActionResult({ captureUpdate: H.IMMEDIATELY });
|
|
1211
1211
|
}
|
|
1212
1212
|
}), this.#de = (e) => this.props.UIOptions.tools?.[e] !== !1, this.setActiveTool = (e, t = !1) => {
|
|
1213
1213
|
if (!this.#de(e.type)) {
|
|
@@ -1215,10 +1215,10 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1215
1215
|
return;
|
|
1216
1216
|
}
|
|
1217
1217
|
let n = D(this.state, e);
|
|
1218
|
-
n.type === "hand" ?
|
|
1218
|
+
n.type === "hand" ? G(this.interactiveCanvas, l.GRAB) : lo || K(this.interactiveCanvas, {
|
|
1219
1219
|
...this.state,
|
|
1220
1220
|
activeTool: n
|
|
1221
|
-
}), Ue(document.activeElement) && this.focusContainer(),
|
|
1221
|
+
}), Ue(document.activeElement) && this.focusContainer(), vt(n.type) || this.setState({ suggestedBinding: null }), n.type === "image" && this.#lt(), this.setState((e) => {
|
|
1222
1222
|
let r = {
|
|
1223
1223
|
snapLines: e.snapLines.length ? [] : e.snapLines,
|
|
1224
1224
|
originSnapOffset: null,
|
|
@@ -1230,8 +1230,8 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1230
1230
|
...r,
|
|
1231
1231
|
activeTool: n,
|
|
1232
1232
|
...t ? {} : {
|
|
1233
|
-
selectedElementIds:
|
|
1234
|
-
selectedGroupIds:
|
|
1233
|
+
selectedElementIds: L({}, e),
|
|
1234
|
+
selectedGroupIds: L({}, e),
|
|
1235
1235
|
editingGroupId: null,
|
|
1236
1236
|
multiElement: null
|
|
1237
1237
|
}
|
|
@@ -1243,8 +1243,8 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1243
1243
|
...e,
|
|
1244
1244
|
...r,
|
|
1245
1245
|
activeTool: n,
|
|
1246
|
-
selectedElementIds:
|
|
1247
|
-
selectedGroupIds:
|
|
1246
|
+
selectedElementIds: L({}, e),
|
|
1247
|
+
selectedGroupIds: L({}, e),
|
|
1248
1248
|
editingGroupId: null,
|
|
1249
1249
|
multiElement: null
|
|
1250
1250
|
};
|
|
@@ -1252,38 +1252,38 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1252
1252
|
}, this.setOpenDialog = (e) => {
|
|
1253
1253
|
this.setState({ openDialog: e });
|
|
1254
1254
|
}, this.#fe = (e) => {
|
|
1255
|
-
|
|
1255
|
+
G(this.interactiveCanvas, e);
|
|
1256
1256
|
}, this.#pe = () => {
|
|
1257
|
-
|
|
1258
|
-
}, this.#me = () => $.pointers.size >= 2, this.getName = () => this.state.name || this.props.name || `${
|
|
1257
|
+
W(this.interactiveCanvas);
|
|
1258
|
+
}, this.#me = () => $.pointers.size >= 2, this.getName = () => this.state.name || this.props.name || `${U("labels.untitled")}-${Fe()}`, this.#he = J((e) => {
|
|
1259
1259
|
e.preventDefault(), this.#me() && this.setState({
|
|
1260
|
-
selectedElementIds:
|
|
1260
|
+
selectedElementIds: L({}, this.state),
|
|
1261
1261
|
activeEmbeddable: null
|
|
1262
1262
|
}), $.initialScale = this.state.zoom.value;
|
|
1263
|
-
}), this.#ge =
|
|
1263
|
+
}), this.#ge = J((e) => {
|
|
1264
1264
|
if (e.preventDefault(), this.#me()) return;
|
|
1265
1265
|
let t = $.initialScale;
|
|
1266
|
-
t && this.setState((n) => ({ ...
|
|
1266
|
+
t && this.setState((n) => ({ ...Ti({
|
|
1267
1267
|
viewportX: this.lastViewportPosition.x,
|
|
1268
1268
|
viewportY: this.lastViewportPosition.y,
|
|
1269
|
-
nextZoom:
|
|
1269
|
+
nextZoom: Gr(t * e.scale)
|
|
1270
1270
|
}, n) }));
|
|
1271
|
-
}), this.#_e =
|
|
1271
|
+
}), this.#_e = J((e) => {
|
|
1272
1272
|
e.preventDefault(), this.#me() && this.setState({
|
|
1273
1273
|
previousSelectedElementIds: {},
|
|
1274
|
-
selectedElementIds:
|
|
1274
|
+
selectedElementIds: L(this.state.previousSelectedElementIds, this.state)
|
|
1275
1275
|
}), $.initialScale = null;
|
|
1276
1276
|
}), this.#Te = ({ sceneX: e, sceneY: t, insertAtParentCenter: n = !0, container: r, autoEdit: i = !0 }) => {
|
|
1277
1277
|
let a = !1, o = n && this.#Tt(e, t, this.state, r);
|
|
1278
|
-
r && o && (
|
|
1278
|
+
r && o && (It(r, this.scene.getNonDeletedElementsMap()) || (a = !0));
|
|
1279
1279
|
let s = null, c = this.scene.getSelectedElements(this.state);
|
|
1280
|
-
s = c.length === 1 ?
|
|
1280
|
+
s = c.length === 1 ? I(c[0]) ? c[0] : r ? It(c[0], this.scene.getNonDeletedElementsMap()) : this.#be(e, t) : this.#be(e, t);
|
|
1281
1281
|
let l = s?.fontFamily || this.state.currentItemFontFamily, u = s?.lineHeight || _e(l), d = this.state.currentItemFontSize;
|
|
1282
|
-
if (!s && a && r && !
|
|
1283
|
-
let n =
|
|
1282
|
+
if (!s && a && r && !ct(r)) {
|
|
1283
|
+
let n = kt(Ie({
|
|
1284
1284
|
fontSize: d,
|
|
1285
1285
|
fontFamily: l
|
|
1286
|
-
}), u), i =
|
|
1286
|
+
}), u), i = Ot(d, u), a = Math.max(r.height, i), s = Math.max(r.width, n);
|
|
1287
1287
|
this.scene.mutateElement(r, {
|
|
1288
1288
|
height: a,
|
|
1289
1289
|
width: s
|
|
@@ -1292,7 +1292,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1292
1292
|
let f = this.#ke({
|
|
1293
1293
|
x: e,
|
|
1294
1294
|
y: t
|
|
1295
|
-
}), p = s ||
|
|
1295
|
+
}), p = s || lr({
|
|
1296
1296
|
x: o ? o.elementCenterX : e,
|
|
1297
1297
|
y: o ? o.elementCenterY : t,
|
|
1298
1298
|
strokeColor: this.state.currentItemStrokeColor,
|
|
@@ -1310,7 +1310,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1310
1310
|
containerId: a ? r?.id : void 0,
|
|
1311
1311
|
groupIds: r?.groupIds ?? [],
|
|
1312
1312
|
lineHeight: u,
|
|
1313
|
-
angle: r ?
|
|
1313
|
+
angle: r ? ct(r) ? 0 : r.angle : 0,
|
|
1314
1314
|
frameId: f ? f.id : null
|
|
1315
1315
|
});
|
|
1316
1316
|
if (!s && a && r && this.scene.mutateElement(r, { boundElements: (r.boundElements || []).concat({
|
|
@@ -1331,25 +1331,25 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1331
1331
|
}, this.#Oe = (e) => {
|
|
1332
1332
|
if (this.state.multiElement || this.state.activeTool.type !== this.state.preferredSelectionTool.type) return;
|
|
1333
1333
|
let t = this.scene.getSelectedElements(this.state), { x: n, y: r } = O(e, this.state);
|
|
1334
|
-
if (t.length === 1 &&
|
|
1334
|
+
if (t.length === 1 && F(t[0])) {
|
|
1335
1335
|
let i = t[0];
|
|
1336
|
-
if ((e[x.CTRL_OR_CMD] &&
|
|
1337
|
-
this.actionManager.executeAction(
|
|
1336
|
+
if ((e[x.CTRL_OR_CMD] && bt(i) || _t(i)) && (!this.state.selectedLinearElement?.isEditing || this.state.selectedLinearElement.elementId !== i.id)) {
|
|
1337
|
+
this.actionManager.executeAction(Xi);
|
|
1338
1338
|
return;
|
|
1339
|
-
} else if (this.state.selectedLinearElement &&
|
|
1340
|
-
let e =
|
|
1339
|
+
} else if (this.state.selectedLinearElement && M(t[0])) {
|
|
1340
|
+
let e = V.getSegmentMidpointHitCoords(this.state.selectedLinearElement, {
|
|
1341
1341
|
x: n,
|
|
1342
1342
|
y: r
|
|
1343
|
-
}, this.state, this.scene.getNonDeletedElementsMap()), i = e ?
|
|
1343
|
+
}, this.state, this.scene.getNonDeletedElementsMap()), i = e ? V.getSegmentMidPointIndex(this.state.selectedLinearElement, this.state, e, this.scene.getNonDeletedElementsMap()) : -1;
|
|
1344
1344
|
if (i && i > -1) {
|
|
1345
|
-
this.#r.scheduleCapture(),
|
|
1346
|
-
let a =
|
|
1345
|
+
this.#r.scheduleCapture(), V.deleteFixedSegment(t[0], this.scene, i);
|
|
1346
|
+
let a = V.getSegmentMidpointHitCoords({
|
|
1347
1347
|
...this.state.selectedLinearElement,
|
|
1348
1348
|
segmentMidPointHoveredCoords: null
|
|
1349
1349
|
}, {
|
|
1350
1350
|
x: n,
|
|
1351
1351
|
y: r
|
|
1352
|
-
}, this.state, this.scene.getNonDeletedElementsMap()), o = a ?
|
|
1352
|
+
}, this.state, this.scene.getNonDeletedElementsMap()), o = a ? V.getSegmentMidPointIndex(this.state.selectedLinearElement, this.state, a, this.scene.getNonDeletedElementsMap()) : null;
|
|
1353
1353
|
this.setState({ selectedLinearElement: {
|
|
1354
1354
|
...this.state.selectedLinearElement,
|
|
1355
1355
|
initialState: {
|
|
@@ -1364,18 +1364,18 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1364
1364
|
} });
|
|
1365
1365
|
return;
|
|
1366
1366
|
}
|
|
1367
|
-
} else if (this.state.selectedLinearElement?.isEditing && this.state.selectedLinearElement.elementId === i.id &&
|
|
1367
|
+
} else if (this.state.selectedLinearElement?.isEditing && this.state.selectedLinearElement.elementId === i.id && _t(i)) return;
|
|
1368
1368
|
}
|
|
1369
|
-
if (t.length === 1 &&
|
|
1369
|
+
if (t.length === 1 && P(t[0])) {
|
|
1370
1370
|
this.#Ee(t[0]);
|
|
1371
1371
|
return;
|
|
1372
1372
|
}
|
|
1373
|
-
if (
|
|
1374
|
-
let e = this.#xe(n, r), t = e &&
|
|
1373
|
+
if (W(this.interactiveCanvas), Wt(this.state).length > 0) {
|
|
1374
|
+
let e = this.#xe(n, r), t = e && Ut(e, this.state.selectedGroupIds);
|
|
1375
1375
|
if (t) {
|
|
1376
1376
|
this.#r.scheduleCapture(), this.setState((n) => ({
|
|
1377
1377
|
...n,
|
|
1378
|
-
...
|
|
1378
|
+
...R({
|
|
1379
1379
|
editingGroupId: t,
|
|
1380
1380
|
selectedElementIds: { [e.id]: !0 }
|
|
1381
1381
|
}, this.scene.getNonDeletedElements(), n, this)
|
|
@@ -1383,9 +1383,9 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1383
1383
|
return;
|
|
1384
1384
|
}
|
|
1385
1385
|
}
|
|
1386
|
-
if (
|
|
1386
|
+
if (W(this.interactiveCanvas), !e[x.CTRL_OR_CMD] && !this.state.viewModeEnabled) {
|
|
1387
1387
|
let t = this.#xe(n, r);
|
|
1388
|
-
if (
|
|
1388
|
+
if (ht(t)) {
|
|
1389
1389
|
this.setState({ activeEmbeddable: {
|
|
1390
1390
|
element: t,
|
|
1391
1391
|
state: "active"
|
|
@@ -1394,13 +1394,13 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1394
1394
|
}
|
|
1395
1395
|
if (!this.state.selectedLinearElement?.isEditing) {
|
|
1396
1396
|
let t = this.#we(n, r);
|
|
1397
|
-
if (t && (
|
|
1397
|
+
if (t && (st(t) || !o(t.backgroundColor) || gn({
|
|
1398
1398
|
point: S(n, r),
|
|
1399
1399
|
element: t,
|
|
1400
1400
|
elementsMap: this.scene.getNonDeletedElementsMap(),
|
|
1401
1401
|
threshold: this.getElementHitThreshold(t)
|
|
1402
1402
|
}))) {
|
|
1403
|
-
let e =
|
|
1403
|
+
let e = Lt(t, this.state, this.scene.getNonDeletedElementsMap());
|
|
1404
1404
|
n = e.x, r = e.y;
|
|
1405
1405
|
}
|
|
1406
1406
|
this.#Te({
|
|
@@ -1412,7 +1412,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1412
1412
|
}
|
|
1413
1413
|
}
|
|
1414
1414
|
}, this.#ke = (e) => {
|
|
1415
|
-
let t = this.scene.getNonDeletedElementsMap(), n = this.scene.getNonDeletedFramesLikes().filter((n) => !n.locked &&
|
|
1415
|
+
let t = this.scene.getNonDeletedElementsMap(), n = this.scene.getNonDeletedFramesLikes().filter((n) => !n.locked && rn(e, n, t));
|
|
1416
1416
|
return n.length ? n[n.length - 1] : null;
|
|
1417
1417
|
}, this.#Ae = (e) => {
|
|
1418
1418
|
this.#Et(e.clientX, e.clientY, this.state.cursorButton), this.lastPointerMoveEvent = e.nativeEvent;
|
|
@@ -1426,11 +1426,11 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1426
1426
|
});
|
|
1427
1427
|
let i = $.initialScale;
|
|
1428
1428
|
if ($.pointers.size === 2 && $.lastCenter && i && $.initialDistance) {
|
|
1429
|
-
let e =
|
|
1429
|
+
let e = fa($.pointers), t = e.x - $.lastCenter.x, n = e.y - $.lastCenter.y;
|
|
1430
1430
|
$.lastCenter = e;
|
|
1431
|
-
let r =
|
|
1431
|
+
let r = pa(Array.from($.pointers.values())), a = this.state.activeTool.type === "freedraw" && this.state.penMode ? 1 : r / $.initialDistance, o = a ? Gr(i * a) : this.state.zoom.value;
|
|
1432
1432
|
this.setState((r) => {
|
|
1433
|
-
let i =
|
|
1433
|
+
let i = Ti({
|
|
1434
1434
|
viewportX: e.x,
|
|
1435
1435
|
viewportY: e.y,
|
|
1436
1436
|
nextZoom: o
|
|
@@ -1443,9 +1443,9 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1443
1443
|
}), null;
|
|
1444
1444
|
}), this.#Dt();
|
|
1445
1445
|
} else $.lastCenter = $.initialDistance = $.initialScale = null;
|
|
1446
|
-
if (lo || uo || fo ||
|
|
1447
|
-
let a =
|
|
1448
|
-
if (!this.state.newElement && !this.state.selectionElement && !this.state.selectedElementsAreBeingDragged && !this.state.multiElement && (a ?
|
|
1446
|
+
if (lo || uo || fo || nt(this.state)) return;
|
|
1447
|
+
let a = va(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 ? W(this.interactiveCanvas) : K(this.interactiveCanvas, this.state)), !this.state.newElement && Ca(this.state.activeTool.type)) {
|
|
1449
1449
|
let { originOffset: t, snapLines: i } = xa(this.scene.getNonDeletedElements(), this, {
|
|
1450
1450
|
x: n,
|
|
1451
1451
|
y: r
|
|
@@ -1459,21 +1459,21 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1459
1459
|
});
|
|
1460
1460
|
} else !this.state.newElement && !this.state.selectedElementsAreBeingDragged && !this.state.selectionElement && this.setState((e) => e.snapLines.length ? { snapLines: [] } : null);
|
|
1461
1461
|
if (this.state.selectedLinearElement?.isEditing && !this.state.selectedLinearElement.isDragging) {
|
|
1462
|
-
let t = this.state.newElement ? null :
|
|
1462
|
+
let t = this.state.newElement ? null : V.handlePointerMoveInEditMode(e, n, r, this);
|
|
1463
1463
|
t && t !== this.state.selectedLinearElement && Z(() => {
|
|
1464
1464
|
this.setState({ selectedLinearElement: t });
|
|
1465
1465
|
});
|
|
1466
1466
|
}
|
|
1467
|
-
if (
|
|
1467
|
+
if (ut(this.state.activeTool.type)) {
|
|
1468
1468
|
let { newElement: e } = this.state;
|
|
1469
|
-
if (!e &&
|
|
1470
|
-
let e =
|
|
1469
|
+
if (!e && Sn(this.state)) {
|
|
1470
|
+
let e = B(S(n, r), this.scene.getNonDeletedElements(), this.scene.getNonDeletedElementsMap(), Cn(this.state.zoom));
|
|
1471
1471
|
e ? this.setState({ suggestedBinding: e }) : this.state.suggestedBinding && this.setState({ suggestedBinding: null });
|
|
1472
1472
|
}
|
|
1473
1473
|
}
|
|
1474
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:
|
|
1476
|
-
if (
|
|
1475
|
+
let { multiElement: t, selectedLinearElement: i } = this.state, { x: a, y: o, points: s } = t, c = s[s.length - 1], { lastCommittedPoint: u } = i;
|
|
1476
|
+
if (K(this.interactiveCanvas, this.state), c === u) ct(this.state.newElement) && Sn(this.state) && B(S(n, r), this.scene.getNonDeletedElements(), this.scene.getNonDeletedElementsMap(), Cn(this.state.zoom)) ? (this.actionManager.executeAction(q, "ui", {
|
|
1477
1477
|
event: e.nativeEvent,
|
|
1478
1478
|
sceneCoords: {
|
|
1479
1479
|
x: n,
|
|
@@ -1482,14 +1482,14 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1482
1482
|
}), this.setState({
|
|
1483
1483
|
suggestedBinding: null,
|
|
1484
1484
|
startBoundElement: null
|
|
1485
|
-
}), this.state.activeTool.locked || (
|
|
1485
|
+
}), this.state.activeTool.locked || (W(this.interactiveCanvas), this.setState((e) => ({
|
|
1486
1486
|
newElement: null,
|
|
1487
1487
|
activeTool: D(this.state, { type: this.state.preferredSelectionTool.type }),
|
|
1488
|
-
selectedElementIds:
|
|
1488
|
+
selectedElementIds: L({
|
|
1489
1489
|
...e.selectedElementIds,
|
|
1490
1490
|
[t.id]: !0
|
|
1491
1491
|
}, e),
|
|
1492
|
-
selectedLinearElement: new
|
|
1492
|
+
selectedLinearElement: new V(t, this.scene.getNonDeletedElementsMap())
|
|
1493
1493
|
})))) : Oe(S(n - a, r - o), c) >= 8 ? (this.scene.mutateElement(t, { points: [...s, S(n - a, r - o)] }, {
|
|
1494
1494
|
informMutation: !1,
|
|
1495
1495
|
isDragging: !1
|
|
@@ -1501,8 +1501,8 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1501
1501
|
...this.state.selectedLinearElement.initialState,
|
|
1502
1502
|
lastClickedPoint: t.points.length - 1
|
|
1503
1503
|
}
|
|
1504
|
-
} })) :
|
|
1505
|
-
else if (s.length > 2 &&
|
|
1504
|
+
} })) : G(this.interactiveCanvas, l.POINTER);
|
|
1505
|
+
else if (s.length > 2 && u && Oe(S(n - a, r - o), u) < 8) G(this.interactiveCanvas, l.POINTER), this.scene.mutateElement(t, { points: s.slice(0, -1) }, {
|
|
1506
1506
|
informMutation: !1,
|
|
1507
1507
|
isDragging: !1
|
|
1508
1508
|
}), this.setState({ selectedLinearElement: {
|
|
@@ -1515,81 +1515,81 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1515
1515
|
}
|
|
1516
1516
|
} });
|
|
1517
1517
|
else {
|
|
1518
|
-
|
|
1518
|
+
fn(s, this.state.zoom.value) && G(this.interactiveCanvas, l.POINTER);
|
|
1519
1519
|
let i = this.scene.getNonDeletedElementsMap();
|
|
1520
|
-
if (
|
|
1521
|
-
let e =
|
|
1520
|
+
if (bt(t)) {
|
|
1521
|
+
let e = B(S(n, r), this.scene.getNonDeletedElements(), i);
|
|
1522
1522
|
T("COMPLEX_BINDINGS") && this.#m(t, e);
|
|
1523
1523
|
}
|
|
1524
1524
|
E(this.state.selectedLinearElement, "Expected selectedLinearElement to be set to operate on a linear element");
|
|
1525
|
-
let a =
|
|
1525
|
+
let a = V.handlePointerMove(e.nativeEvent, this, n, r, this.state.selectedLinearElement);
|
|
1526
1526
|
a && this.setState(a);
|
|
1527
1527
|
}
|
|
1528
1528
|
return;
|
|
1529
1529
|
}
|
|
1530
1530
|
if (this.state.activeTool.type === "arrow") {
|
|
1531
|
-
let e =
|
|
1532
|
-
e && !
|
|
1531
|
+
let e = B(S(n, r), this.scene.getNonDeletedElements(), this.scene.getNonDeletedElementsMap(), Cn(this.state.zoom));
|
|
1532
|
+
e && !_n(S(n, r), e, this.scene.getNonDeletedElementsMap()) && this.setState({ suggestedBinding: e });
|
|
1533
1533
|
}
|
|
1534
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
1535
|
let o = this.scene.getNonDeletedElements(), s = this.scene.getSelectedElements(this.state);
|
|
1536
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 &&
|
|
1538
|
-
let t =
|
|
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 && M(s[0])) && !(F(s[0]) && (this.editorInterface.userAgent.isMobileDevice || s[0].points.length === 2))) {
|
|
1538
|
+
let t = Er(o, this.state, n, r, this.state.zoom, e.pointerType, this.scene.getNonDeletedElementsMap(), this.editorInterface);
|
|
1539
1539
|
if (t && t.transformHandleType) {
|
|
1540
|
-
|
|
1540
|
+
G(this.interactiveCanvas, Tr(t));
|
|
1541
1541
|
return;
|
|
1542
1542
|
}
|
|
1543
1543
|
}
|
|
1544
1544
|
} else if (s.length > 1 && !a && this.state.openDialog?.name !== "elementLinkSelector") {
|
|
1545
|
-
let t =
|
|
1545
|
+
let t = Dr(kn(s), n, r, this.state.zoom, e.pointerType, this.editorInterface);
|
|
1546
1546
|
if (t) {
|
|
1547
|
-
|
|
1547
|
+
G(this.interactiveCanvas, Tr({ transformHandleType: t }));
|
|
1548
1548
|
return;
|
|
1549
1549
|
}
|
|
1550
1550
|
}
|
|
1551
1551
|
let c = this.#xe(n, r, {
|
|
1552
1552
|
preferSelected: !0,
|
|
1553
1553
|
includeLockedElements: !0
|
|
1554
|
-
}),
|
|
1555
|
-
|
|
1556
|
-
element:
|
|
1554
|
+
}), u = null;
|
|
1555
|
+
u = c && c.locked ? null : c, !A(this.state) && (this.state.activeTool.type === "text" ? G(this.interactiveCanvas, I(u) ? l.TEXT : l.CROSSHAIR) : this.state.viewModeEnabled ? G(this.interactiveCanvas, l.GRAB) : this.state.openDialog?.name === "elementLinkSelector" || a || e[x.CTRL_OR_CMD] ? G(this.interactiveCanvas, l.AUTO) : (u || this.#We(t, s)) && !u?.locked && (u && ht(u) && this.#v(u, e, n, r) ? (G(this.interactiveCanvas, l.POINTER), this.setState({ activeEmbeddable: {
|
|
1556
|
+
element: u,
|
|
1557
1557
|
state: "hover"
|
|
1558
|
-
} })) : (!
|
|
1558
|
+
} })) : (!u || !M(u) || !(u.startBinding || u.endBinding)) && ((this.state.activeTool.type !== "lasso" || s.length > 0) && G(this.interactiveCanvas, l.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" && u ? this.setState((e) => ({ hoveredElementIds: Xe(e.hoveredElementIds, R({
|
|
1559
1559
|
editingGroupId: e.editingGroupId,
|
|
1560
|
-
selectedElementIds: { [
|
|
1561
|
-
}, this.scene.getNonDeletedElements(), e, this).selectedElementIds) })) : this.state.openDialog?.name === "elementLinkSelector" && !
|
|
1560
|
+
selectedElementIds: { [u.id]: !0 }
|
|
1561
|
+
}, this.scene.getNonDeletedElements(), e, this).selectedElementIds) })) : this.state.openDialog?.name === "elementLinkSelector" && !u && this.setState((e) => ({ hoveredElementIds: Xe(e.hoveredElementIds, {}) })));
|
|
1562
1562
|
}, this.#je = (e, t) => {
|
|
1563
1563
|
let n = this.eraserTrail.addPointToPath(t.x, t.y, e.altKey);
|
|
1564
1564
|
this.#l = new Set(n), this.#se();
|
|
1565
1565
|
}, this.#Me = (e) => {
|
|
1566
1566
|
mo = !0;
|
|
1567
1567
|
}, this.handleHoverSelectedLinearElement = (e, t, n) => {
|
|
1568
|
-
let r = this.scene.getNonDeletedElementsMap(), i =
|
|
1568
|
+
let r = this.scene.getNonDeletedElementsMap(), i = V.getElement(e.elementId, r);
|
|
1569
1569
|
if (i) if (this.state.selectedLinearElement) {
|
|
1570
1570
|
let a = -1, o = null;
|
|
1571
|
-
|
|
1571
|
+
gn({
|
|
1572
1572
|
point: S(t, n),
|
|
1573
1573
|
element: i,
|
|
1574
1574
|
elementsMap: r,
|
|
1575
1575
|
threshold: this.getElementHitThreshold(i)
|
|
1576
|
-
}) ? (a =
|
|
1576
|
+
}) ? (a = V.getPointIndexUnderCursor(i, r, this.state.zoom, t, n), o = V.getSegmentMidpointHitCoords(e, {
|
|
1577
1577
|
x: t,
|
|
1578
1578
|
y: n
|
|
1579
|
-
}, this.state, this.scene.getNonDeletedElementsMap()), (
|
|
1579
|
+
}, this.state, this.scene.getNonDeletedElementsMap()), (M(i) ? a === 0 || a === i.points.length - 1 : a >= 0) || o ? G(this.interactiveCanvas, l.POINTER) : this.#Ce(t, n, i) && (!M(i) || !(i.startBinding || i.endBinding)) && (this.state.activeTool.type !== "lasso" || Object.keys(this.state.selectedElementIds).length > 0) && G(this.interactiveCanvas, l.MOVE)) : this.#Ce(t, n, i) && (!M(i) || !(i.startBinding || i.endBinding)) && (this.state.activeTool.type !== "lasso" || Object.keys(this.state.selectedElementIds).length > 0) && G(this.interactiveCanvas, l.MOVE), this.state.selectedLinearElement.hoverPointIndex !== a && this.setState({ selectedLinearElement: {
|
|
1580
1580
|
...this.state.selectedLinearElement,
|
|
1581
1581
|
hoverPointIndex: a
|
|
1582
|
-
} }),
|
|
1582
|
+
} }), V.arePointsEqual(this.state.selectedLinearElement.segmentMidPointHoveredCoords, o) || this.setState({ selectedLinearElement: {
|
|
1583
1583
|
...this.state.selectedLinearElement,
|
|
1584
1584
|
segmentMidPointHoveredCoords: o
|
|
1585
1585
|
} });
|
|
1586
1586
|
let s = null, c = i;
|
|
1587
|
-
(c.startBinding || c.endBinding) && (s =
|
|
1587
|
+
(c.startBinding || c.endBinding) && (s = Rn(i, t, n, this.scene, this.state)), this.state.selectedLinearElement.hoveredFocusPointBinding !== s && this.setState({ selectedLinearElement: {
|
|
1588
1588
|
...this.state.selectedLinearElement,
|
|
1589
1589
|
isDragging: !1,
|
|
1590
1590
|
hoveredFocusPointBinding: s
|
|
1591
|
-
} }), s &&
|
|
1592
|
-
} else
|
|
1591
|
+
} }), s && G(this.interactiveCanvas, l.POINTER);
|
|
1592
|
+
} else G(this.interactiveCanvas, l.AUTO);
|
|
1593
1593
|
}, this.#Ne = (e) => {
|
|
1594
1594
|
let { x: t, y: n } = O(e, this.state);
|
|
1595
1595
|
this.lastPointerMoveCoords = {
|
|
@@ -1603,7 +1603,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1603
1603
|
...e,
|
|
1604
1604
|
focus: !1
|
|
1605
1605
|
}))
|
|
1606
|
-
} })), this.updateEditorAtom(Ba, null)),
|
|
1606
|
+
} })), this.updateEditorAtom(Ba, null)), Br.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
1607
|
let e = this.state.newElement;
|
|
1608
1608
|
this.updateScene({
|
|
1609
1609
|
...e.points.length < 10 ? { elements: this.scene.getElementsIncludingDeleted().filter((t) => t.id !== e.id) } : {},
|
|
@@ -1612,9 +1612,9 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1612
1612
|
editingTextElement: null,
|
|
1613
1613
|
startBoundElement: null,
|
|
1614
1614
|
suggestedBinding: null,
|
|
1615
|
-
selectedElementIds:
|
|
1615
|
+
selectedElementIds: L(Object.keys(this.state.selectedElementIds).filter((t) => t !== e.id).reduce((e, t) => (e[t] = this.state.selectedElementIds[t], e), {}), this.state)
|
|
1616
1616
|
},
|
|
1617
|
-
captureUpdate: this.state.openDialog?.name === "elementLinkSelector" ?
|
|
1617
|
+
captureUpdate: this.state.openDialog?.name === "elementLinkSelector" ? H.EVENTUALLY : H.NEVER
|
|
1618
1618
|
});
|
|
1619
1619
|
return;
|
|
1620
1620
|
}
|
|
@@ -1626,14 +1626,14 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1626
1626
|
if (this.setState({
|
|
1627
1627
|
lastPointerDownWith: e.pointerType,
|
|
1628
1628
|
cursorButton: "down"
|
|
1629
|
-
}), this.#Et(e.clientX, e.clientY, "down"), e.button ===
|
|
1629
|
+
}), this.#Et(e.clientX, e.clientY, "down"), e.button === v.ERASER && this.state.activeTool.type !== b.eraser) {
|
|
1630
1630
|
this.setState({ activeTool: D(this.state, {
|
|
1631
1631
|
type: b.eraser,
|
|
1632
1632
|
lastActiveToolBeforeEraser: this.state.activeTool
|
|
1633
1633
|
}) }, () => {
|
|
1634
1634
|
this.#Ne(e);
|
|
1635
1635
|
let t = () => {
|
|
1636
|
-
n(), r?.(),
|
|
1636
|
+
n(), r?.(), A(this.state) && this.setState({ activeTool: D(this.state, {
|
|
1637
1637
|
...this.state.activeTool.lastActiveTool || { type: b.selection },
|
|
1638
1638
|
lastActiveToolBeforeEraser: null
|
|
1639
1639
|
}) });
|
|
@@ -1644,7 +1644,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1644
1644
|
});
|
|
1645
1645
|
return;
|
|
1646
1646
|
}
|
|
1647
|
-
if (e.button !==
|
|
1647
|
+
if (e.button !== v.MAIN && e.button !== v.TOUCH && e.button !== v.ERASER || $.pointers.size > 1) return;
|
|
1648
1648
|
let a = this.#ze(e);
|
|
1649
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
1650
|
if (this.state.activeTool.type === "lasso") {
|
|
@@ -1659,24 +1659,24 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1659
1659
|
t && n.push(t);
|
|
1660
1660
|
});
|
|
1661
1661
|
let r = a.hit.element;
|
|
1662
|
-
if (
|
|
1662
|
+
if (N(r)) tn(n, r.id).forEach((e) => {
|
|
1663
1663
|
delete t[e.id];
|
|
1664
1664
|
});
|
|
1665
1665
|
else if (r.frameId) t[r.frameId] && delete t[r.id];
|
|
1666
1666
|
else {
|
|
1667
|
-
let e = r.groupIds, i = new Set(e.flatMap((e) =>
|
|
1667
|
+
let e = r.groupIds, i = new Set(e.flatMap((e) => Ht(this.scene.getNonDeletedElements(), e)).filter((e) => N(e)).map((e) => e.id));
|
|
1668
1668
|
i.size > 0 && n.forEach((e) => {
|
|
1669
|
-
e.frameId && i.has(e.frameId) && (delete t[e.id], e.groupIds.flatMap((e) =>
|
|
1669
|
+
e.frameId && i.has(e.frameId) && (delete t[e.id], e.groupIds.flatMap((e) => Ht(this.scene.getNonDeletedElements(), e)).forEach((e) => {
|
|
1670
1670
|
delete t[e.id];
|
|
1671
1671
|
}));
|
|
1672
1672
|
});
|
|
1673
1673
|
}
|
|
1674
|
-
return { ...
|
|
1674
|
+
return { ...R({
|
|
1675
1675
|
editingGroupId: e.editingGroupId,
|
|
1676
1676
|
selectedElementIds: t
|
|
1677
1677
|
}, this.scene.getNonDeletedElements(), e, this) };
|
|
1678
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" ?
|
|
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" ? K(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
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
1681
|
let o = this.#nt(a), s = this.#it(a), c = this.#et(a), l = this.#tt(a);
|
|
1682
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);
|
|
@@ -1693,7 +1693,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1693
1693
|
let i = e.timeStamp - (this.lastPointerDownEvent?.timeStamp ?? 0);
|
|
1694
1694
|
if (this.editorInterface.formFactor === "phone" && i < 300) {
|
|
1695
1695
|
let n = this.#xe(t.x, t.y);
|
|
1696
|
-
if (
|
|
1696
|
+
if (ht(n) && this.#v(n, e, t.x, t.y)) {
|
|
1697
1697
|
this.#_(n);
|
|
1698
1698
|
return;
|
|
1699
1699
|
}
|
|
@@ -1711,11 +1711,11 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1711
1711
|
}, this.#Le = (e) => {
|
|
1712
1712
|
vo?.(), this.missingPointerEventCleanupEmitter.trigger(e).clear();
|
|
1713
1713
|
}, this.handleCanvasPanUsingWheelOrSpaceDrag = (e) => {
|
|
1714
|
-
if (!($.pointers.size <= 1 && (e.button ===
|
|
1714
|
+
if (!($.pointers.size <= 1 && (e.button === v.WHEEL || e.button === v.MAIN && lo || nt(this.state) || this.state.viewModeEnabled))) return !1;
|
|
1715
1715
|
uo = !0, this.focusContainer(), this.state.editingTextElement || e.preventDefault();
|
|
1716
1716
|
let t = !1, n = ao(window) ? !1 : /Linux/.test(window.navigator.platform);
|
|
1717
|
-
|
|
1718
|
-
let { clientX: r, clientY: i } = e, a =
|
|
1717
|
+
G(this.interactiveCanvas, l.GRABBING);
|
|
1718
|
+
let { clientX: r, clientY: i } = e, a = ga((e) => {
|
|
1719
1719
|
let a = r - e.clientX, o = i - e.clientY;
|
|
1720
1720
|
if (r = e.clientX, i = e.clientY, n && !t && (Math.abs(a) > 1 || Math.abs(o) > 1)) {
|
|
1721
1721
|
t = !0;
|
|
@@ -1732,13 +1732,13 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1732
1732
|
scrollX: this.state.scrollX - a / this.state.zoom.value,
|
|
1733
1733
|
scrollY: this.state.scrollY - o / this.state.zoom.value
|
|
1734
1734
|
});
|
|
1735
|
-
}), o =
|
|
1736
|
-
vo = null, uo = !1, lo || (this.state.viewModeEnabled ?
|
|
1735
|
+
}), o = J(vo = () => {
|
|
1736
|
+
vo = null, uo = !1, lo || (this.state.viewModeEnabled ? G(this.interactiveCanvas, l.GRAB) : K(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
1737
|
});
|
|
1738
1738
|
return window.addEventListener(h.BLUR, o), window.addEventListener(h.POINTER_MOVE, a, { passive: !0 }), window.addEventListener(h.POINTER_UP, o), !0;
|
|
1739
1739
|
}, this.#Ve = () => {
|
|
1740
1740
|
Be(this.state.activeTool.type) || this.setState({
|
|
1741
|
-
selectedElementIds:
|
|
1741
|
+
selectedElementIds: L({}, this.state),
|
|
1742
1742
|
selectedGroupIds: {},
|
|
1743
1743
|
editingGroupId: null,
|
|
1744
1744
|
activeEmbeddable: null
|
|
@@ -1746,18 +1746,18 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1746
1746
|
}, this.#He = (e, t) => {
|
|
1747
1747
|
if (Be(this.state.activeTool.type)) {
|
|
1748
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 && !
|
|
1750
|
-
let r =
|
|
1749
|
+
if (i.length === 1 && !this.state.selectedLinearElement?.isEditing && !M(i[0]) && !(F(i[0]) && (this.editorInterface.userAgent.isMobileDevice || i[0].points.length === 2)) && !(this.state.selectedLinearElement && this.state.selectedLinearElement.hoverPointIndex !== -1)) {
|
|
1750
|
+
let r = Er(n, this.state, t.origin.x, t.origin.y, this.state.zoom, e.pointerType, this.scene.getNonDeletedElementsMap(), this.editorInterface);
|
|
1751
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 =
|
|
1753
|
-
if (t.resize.handleType) t.resize.isResizing = !0, t.resize.offset = Je(
|
|
1752
|
+
} else i.length > 1 && (t.resize.handleType = Dr(kn(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(Sr(t.resize.handleType, i, r, t.origin.x, t.origin.y)), i.length === 1 && F(i[0]) && i[0].points.length === 2 && (t.resize.arrowDirection = xr(t.resize.handleType, i[0]));
|
|
1754
1754
|
else {
|
|
1755
1755
|
if (this.state.selectedLinearElement) {
|
|
1756
|
-
let n = this.state.selectedLinearElement, r =
|
|
1756
|
+
let n = this.state.selectedLinearElement, r = V.handlePointerDown(e, this, this.#r, t.origin, n, this.scene);
|
|
1757
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 =
|
|
1759
|
-
if (a &&
|
|
1760
|
-
let { hitFocusPoint: e, pointerOffset: r } =
|
|
1758
|
+
let i = this.scene.getNonDeletedElementsMap(), a = V.getElement(n.elementId, i);
|
|
1759
|
+
if (a && j(a)) {
|
|
1760
|
+
let { hitFocusPoint: e, pointerOffset: r } = zn(a, t, i, this.state);
|
|
1761
1761
|
if (e) return this.setState({ selectedLinearElement: {
|
|
1762
1762
|
...n,
|
|
1763
1763
|
hoveredFocusPointBinding: e,
|
|
@@ -1774,18 +1774,18 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1774
1774
|
...e.selectedLinearElement,
|
|
1775
1775
|
isEditing: !!a && a.id === this.state.selectedLinearElement?.elementId
|
|
1776
1776
|
} : null,
|
|
1777
|
-
selectedElementIds: e.selectedLinearElement ?
|
|
1777
|
+
selectedElementIds: e.selectedLinearElement ? L({ [e.selectedLinearElement.elementId]: !0 }, this.state) : L({}, e)
|
|
1778
1778
|
}));
|
|
1779
1779
|
else if (a != null) {
|
|
1780
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
1781
|
type: "lasso",
|
|
1782
1782
|
fromSelection: !0
|
|
1783
1783
|
}), !1) : (this.state.selectedElementIds[a.id] || (t.hit.wasAddedToSelection = !0), this.setState((e) => ({
|
|
1784
|
-
...
|
|
1784
|
+
...Vt(e, a),
|
|
1785
1785
|
previousSelectedElementIds: this.state.selectedElementIds
|
|
1786
1786
|
})), !1);
|
|
1787
|
-
this.state.selectedElementIds[a.id] || (this.state.editingGroupId && !
|
|
1788
|
-
selectedElementIds:
|
|
1787
|
+
this.state.selectedElementIds[a.id] || (this.state.editingGroupId && !Gt(a, this.state.editingGroupId) && this.setState({
|
|
1788
|
+
selectedElementIds: L({}, this.state),
|
|
1789
1789
|
selectedGroupIds: {},
|
|
1790
1790
|
editingGroupId: null,
|
|
1791
1791
|
activeEmbeddable: null
|
|
@@ -1797,19 +1797,19 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1797
1797
|
if (Object.keys(e.selectedElementIds).forEach((e) => {
|
|
1798
1798
|
let t = this.scene.getElement(e);
|
|
1799
1799
|
t && n.push(t);
|
|
1800
|
-
}),
|
|
1800
|
+
}), N(a)) tn(n, a.id).forEach((e) => {
|
|
1801
1801
|
delete t[e.id];
|
|
1802
1802
|
});
|
|
1803
1803
|
else if (a.frameId) t[a.frameId] && delete t[a.id];
|
|
1804
1804
|
else {
|
|
1805
|
-
let e = a.groupIds, r = new Set(e.flatMap((e) =>
|
|
1805
|
+
let e = a.groupIds, r = new Set(e.flatMap((e) => Ht(this.scene.getNonDeletedElements(), e)).filter((e) => N(e)).map((e) => e.id));
|
|
1806
1806
|
r.size > 0 && n.forEach((e) => {
|
|
1807
|
-
e.frameId && r.has(e.frameId) && (delete t[e.id], e.groupIds.flatMap((e) =>
|
|
1807
|
+
e.frameId && r.has(e.frameId) && (delete t[e.id], e.groupIds.flatMap((e) => Ht(this.scene.getNonDeletedElements(), e)).forEach((e) => {
|
|
1808
1808
|
delete t[e.id];
|
|
1809
1809
|
}));
|
|
1810
1810
|
});
|
|
1811
1811
|
}
|
|
1812
|
-
return e.openDialog?.name === "elementLinkSelector" && (a.groupIds.some((t) => e.selectedGroupIds[t]) || (t = { [a.id]: !0 })), { ...
|
|
1812
|
+
return e.openDialog?.name === "elementLinkSelector" && (a.groupIds.some((t) => e.selectedGroupIds[t]) || (t = { [a.id]: !0 })), { ...R({
|
|
1813
1813
|
editingGroupId: e.editingGroupId,
|
|
1814
1814
|
selectedElementIds: t
|
|
1815
1815
|
}, this.scene.getNonDeletedElements(), e, this) };
|
|
@@ -1822,18 +1822,18 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1822
1822
|
}, this.#Ge = (e, t) => {
|
|
1823
1823
|
if (this.state.editingTextElement) return;
|
|
1824
1824
|
let n = t.origin.x, r = t.origin.y, i = this.#xe(n, r, { includeBoundTextElement: !0 }), a = this.#we(n, r);
|
|
1825
|
-
|
|
1825
|
+
st(i) && (a = i, n = i.x + i.width / 2, r = i.y + i.height / 2), this.#Te({
|
|
1826
1826
|
sceneX: n,
|
|
1827
1827
|
sceneY: r,
|
|
1828
1828
|
insertAtParentCenter: !e.altKey,
|
|
1829
1829
|
container: a,
|
|
1830
1830
|
autoEdit: !1
|
|
1831
|
-
}),
|
|
1831
|
+
}), W(this.interactiveCanvas), this.state.activeTool.locked || this.setState({ activeTool: D(this.state, { type: this.state.preferredSelectionTool.type }) });
|
|
1832
1832
|
}, this.#Ke = (e, t, n) => {
|
|
1833
1833
|
let [r, i] = C(n.origin.x, n.origin.y, null), a = this.#ke({
|
|
1834
1834
|
x: r,
|
|
1835
1835
|
y: i
|
|
1836
|
-
}), o = e.pressure === .5, s =
|
|
1836
|
+
}), o = e.pressure === .5, s = ir({
|
|
1837
1837
|
type: t,
|
|
1838
1838
|
x: r,
|
|
1839
1839
|
y: i,
|
|
@@ -1853,16 +1853,16 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1853
1853
|
});
|
|
1854
1854
|
this.scene.insertElement(s), this.setState((e) => {
|
|
1855
1855
|
let t = { ...e.selectedElementIds };
|
|
1856
|
-
return delete t[s.id], { selectedElementIds:
|
|
1856
|
+
return delete t[s.id], { selectedElementIds: L(t, e) };
|
|
1857
1857
|
});
|
|
1858
|
-
let c =
|
|
1858
|
+
let c = B(S(n.origin.x, n.origin.y), this.scene.getNonDeletedElements(), this.scene.getNonDeletedElementsMap());
|
|
1859
1859
|
this.setState({
|
|
1860
1860
|
newElement: s,
|
|
1861
1861
|
startBoundElement: c,
|
|
1862
1862
|
suggestedBinding: null
|
|
1863
1863
|
});
|
|
1864
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 =
|
|
1865
|
+
let [i, a] = C(e, t, this.lastPointerDownEvent?.[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()), o = ar({
|
|
1866
1866
|
type: "iframe",
|
|
1867
1867
|
x: i,
|
|
1868
1868
|
y: a,
|
|
@@ -1885,7 +1885,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1885
1885
|
let a = {
|
|
1886
1886
|
w: 560,
|
|
1887
1887
|
h: 840
|
|
1888
|
-
}, o =
|
|
1888
|
+
}, o = nr({
|
|
1889
1889
|
type: "embeddable",
|
|
1890
1890
|
x: r,
|
|
1891
1891
|
y: i,
|
|
@@ -1908,7 +1908,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1908
1908
|
x: r,
|
|
1909
1909
|
y: i
|
|
1910
1910
|
}) : null, o = 100 / this.state.zoom.value;
|
|
1911
|
-
return
|
|
1911
|
+
return or({
|
|
1912
1912
|
type: "image",
|
|
1913
1913
|
strokeColor: this.state.currentItemStrokeColor,
|
|
1914
1914
|
backgroundColor: this.state.currentItemBackgroundColor,
|
|
@@ -1930,7 +1930,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1930
1930
|
this.setState({ isBindingEnabled: !1 });
|
|
1931
1931
|
}), this.state.multiElement) {
|
|
1932
1932
|
let { multiElement: t, selectedLinearElement: r } = this.state;
|
|
1933
|
-
if (E(r, "selectedLinearElement is expected to be set"), t.type === "line" &&
|
|
1933
|
+
if (E(r, "selectedLinearElement is expected to be set"), t.type === "line" && fn(t.points, this.state.zoom.value)) {
|
|
1934
1934
|
Z(() => {
|
|
1935
1935
|
this.setState({ selectedLinearElement: {
|
|
1936
1936
|
...r,
|
|
@@ -1940,11 +1940,11 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1940
1940
|
lastClickedPoint: -1
|
|
1941
1941
|
}
|
|
1942
1942
|
} });
|
|
1943
|
-
}), this.actionManager.executeAction(
|
|
1943
|
+
}), this.actionManager.executeAction(q);
|
|
1944
1944
|
return;
|
|
1945
1945
|
}
|
|
1946
|
-
if (
|
|
1947
|
-
this.actionManager.executeAction(
|
|
1946
|
+
if (M(t) && t.points.length > 1) {
|
|
1947
|
+
this.actionManager.executeAction(q, "ui", {
|
|
1948
1948
|
event: e.nativeEvent,
|
|
1949
1949
|
sceneCoords: {
|
|
1950
1950
|
x: n.origin.x,
|
|
@@ -1953,9 +1953,9 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1953
1953
|
});
|
|
1954
1954
|
return;
|
|
1955
1955
|
}
|
|
1956
|
-
let { x: i, y: a } = t, { lastCommittedPoint: o } = r, s =
|
|
1957
|
-
if (
|
|
1958
|
-
this.actionManager.executeAction(
|
|
1956
|
+
let { x: i, y: a } = t, { lastCommittedPoint: o } = r, s = Sn(this.state) && B(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 (j(t) && s || t.points.length > 1 && o && Oe(S(n.origin.x - i, n.origin.y - a), o) < 8) {
|
|
1958
|
+
this.actionManager.executeAction(q, "ui", {
|
|
1959
1959
|
event: e.nativeEvent,
|
|
1960
1960
|
sceneCoords: {
|
|
1961
1961
|
x: n.origin.x,
|
|
@@ -1964,15 +1964,15 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1964
1964
|
});
|
|
1965
1965
|
return;
|
|
1966
1966
|
}
|
|
1967
|
-
this.setState((e) => ({ selectedElementIds:
|
|
1967
|
+
this.setState((e) => ({ selectedElementIds: L({
|
|
1968
1968
|
...e.selectedElementIds,
|
|
1969
1969
|
[t.id]: !0
|
|
1970
|
-
}, e) })),
|
|
1970
|
+
}, e) })), G(this.interactiveCanvas, l.POINTER);
|
|
1971
1971
|
} else {
|
|
1972
1972
|
let [r, i] = C(n.origin.x, n.origin.y, e[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()), a = this.#ke({
|
|
1973
1973
|
x: r,
|
|
1974
1974
|
y: i
|
|
1975
|
-
}), { currentItemStartArrowhead: o, currentItemEndArrowhead:
|
|
1975
|
+
}), { currentItemStartArrowhead: o, currentItemEndArrowhead: c } = this.state, [l, u] = t === "arrow" ? [o, c] : [null, null], d = t === "arrow" ? er({
|
|
1976
1976
|
type: t,
|
|
1977
1977
|
x: r,
|
|
1978
1978
|
y: i,
|
|
@@ -1983,14 +1983,14 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
1983
1983
|
strokeStyle: this.state.currentItemStrokeStyle,
|
|
1984
1984
|
roughness: this.state.currentItemRoughness,
|
|
1985
1985
|
opacity: this.state.currentItemOpacity,
|
|
1986
|
-
roundness: this.state.currentItemArrowType ===
|
|
1986
|
+
roundness: this.state.currentItemArrowType === s.round ? { type: ne.PROPORTIONAL_RADIUS } : null,
|
|
1987
1987
|
startArrowhead: l,
|
|
1988
1988
|
endArrowhead: u,
|
|
1989
1989
|
locked: !1,
|
|
1990
1990
|
frameId: a ? a.id : null,
|
|
1991
|
-
elbowed: this.state.currentItemArrowType ===
|
|
1992
|
-
fixedSegments: this.state.currentItemArrowType ===
|
|
1993
|
-
}) :
|
|
1991
|
+
elbowed: this.state.currentItemArrowType === s.elbow,
|
|
1992
|
+
fixedSegments: this.state.currentItemArrowType === s.elbow ? [] : null
|
|
1993
|
+
}) : sr({
|
|
1994
1994
|
type: t,
|
|
1995
1995
|
x: r,
|
|
1996
1996
|
y: i,
|
|
@@ -2004,8 +2004,8 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2004
2004
|
roundness: this.state.currentItemRoundness === "round" ? { type: ne.PROPORTIONAL_RADIUS } : null,
|
|
2005
2005
|
locked: !1,
|
|
2006
2006
|
frameId: a ? a.id : null
|
|
2007
|
-
}), f = S(n.origin.x, n.origin.y), p = this.scene.getNonDeletedElementsMap(), m =
|
|
2008
|
-
this.scene.mutateElement(d, { points: [S(0, 0), S(0, 0)] }), this.scene.insertElement(d),
|
|
2007
|
+
}), f = S(n.origin.x, n.origin.y), p = this.scene.getNonDeletedElementsMap(), m = Sn(this.state) ? B(f, this.scene.getNonDeletedElements(), p) : null;
|
|
2008
|
+
this.scene.mutateElement(d, { points: [S(0, 0), S(0, 0)] }), this.scene.insertElement(d), j(d) && vn(d, /* @__PURE__ */ new Map([[0, {
|
|
2009
2009
|
point: S(0, 0),
|
|
2010
2010
|
isDragging: !1
|
|
2011
2011
|
}]]), f[0], f[1], this.scene, this.state, {
|
|
@@ -2016,8 +2016,8 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2016
2016
|
}), Z(() => {
|
|
2017
2017
|
this.setState((e) => {
|
|
2018
2018
|
let t = null, r = e.selectedElementIds;
|
|
2019
|
-
if (
|
|
2020
|
-
t = new
|
|
2019
|
+
if (F(d)) {
|
|
2020
|
+
t = new V(d, this.scene.getNonDeletedElementsMap());
|
|
2021
2021
|
let e = d.points.length - 1;
|
|
2022
2022
|
t = {
|
|
2023
2023
|
...t,
|
|
@@ -2029,7 +2029,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2029
2029
|
}
|
|
2030
2030
|
};
|
|
2031
2031
|
}
|
|
2032
|
-
return r = this.state.activeTool.locked ? e.selectedElementIds :
|
|
2032
|
+
return r = this.state.activeTool.locked ? e.selectedElementIds : L({ [d.id]: !0 }, e), {
|
|
2033
2033
|
...e,
|
|
2034
2034
|
bindMode: "orbit",
|
|
2035
2035
|
newElement: d,
|
|
@@ -2039,7 +2039,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2039
2039
|
selectedLinearElement: t
|
|
2040
2040
|
};
|
|
2041
2041
|
});
|
|
2042
|
-
}),
|
|
2042
|
+
}), j(d) && T("COMPLEX_BINDINGS") && this.#m(d, m);
|
|
2043
2043
|
}
|
|
2044
2044
|
}, this.#Xe = (e, t) => {
|
|
2045
2045
|
let [n, r] = C(t.origin.x, t.origin.y, this.lastPointerDownEvent?.[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()), i = this.#ke({
|
|
@@ -2059,10 +2059,10 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2059
2059
|
locked: !1,
|
|
2060
2060
|
frameId: i ? i.id : null
|
|
2061
2061
|
}, o;
|
|
2062
|
-
o = e === "embeddable" ?
|
|
2062
|
+
o = e === "embeddable" ? nr({
|
|
2063
2063
|
type: "embeddable",
|
|
2064
2064
|
...a
|
|
2065
|
-
}) :
|
|
2065
|
+
}) : tr({
|
|
2066
2066
|
type: e,
|
|
2067
2067
|
...a
|
|
2068
2068
|
}), o.type === "selection" ? this.setState({ selectionElement: o }) : (this.scene.insertElement(o), this.setState({
|
|
@@ -2076,7 +2076,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2076
2076
|
opacity: this.state.currentItemOpacity,
|
|
2077
2077
|
locked: !1,
|
|
2078
2078
|
...g
|
|
2079
|
-
}, a = t === b.magicframe ?
|
|
2079
|
+
}, a = t === b.magicframe ? cr(i) : rr(i);
|
|
2080
2080
|
this.scene.insertElement(a), this.setState({
|
|
2081
2081
|
multiElement: null,
|
|
2082
2082
|
newElement: a
|
|
@@ -2087,41 +2087,41 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2087
2087
|
let e = !1;
|
|
2088
2088
|
this.#l.forEach((e) => {
|
|
2089
2089
|
let t = this.scene.getElement(e);
|
|
2090
|
-
if (
|
|
2090
|
+
if (j(t)) {
|
|
2091
2091
|
if (t.startBinding) {
|
|
2092
2092
|
let e = this.scene.getElement(t.startBinding.elementId);
|
|
2093
|
-
|
|
2093
|
+
qt(e, this.scene.getElementsMapIncludingDeleted(), { boundElements: e.boundElements.filter((e) => e.id !== t.id) });
|
|
2094
2094
|
}
|
|
2095
2095
|
if (t.endBinding) {
|
|
2096
2096
|
let e = this.scene.getElement(t.endBinding.elementId);
|
|
2097
|
-
|
|
2097
|
+
qt(e, this.scene.getElementsMapIncludingDeleted(), { boundElements: e.boundElements.filter((e) => e.id !== t.id) });
|
|
2098
2098
|
}
|
|
2099
|
-
} else
|
|
2099
|
+
} else lt(t) && t.boundElements?.forEach?.((e) => {
|
|
2100
2100
|
if (e.type === "arrow") {
|
|
2101
2101
|
let n = this.scene.getElement(e.id);
|
|
2102
|
-
n?.startBinding?.elementId === t.id &&
|
|
2102
|
+
n?.startBinding?.elementId === t.id && qt(n, this.scene.getElementsMapIncludingDeleted(), { startBinding: null }), n?.endBinding?.elementId === t.id && qt(n, this.scene.getElementsMapIncludingDeleted(), { endBinding: null });
|
|
2103
2103
|
}
|
|
2104
2104
|
});
|
|
2105
2105
|
});
|
|
2106
|
-
let t = this.scene.getElementsIncludingDeleted().map((t) => this.#l.has(t.id) || t.frameId && this.#l.has(t.frameId) ||
|
|
2106
|
+
let t = this.scene.getElementsIncludingDeleted().map((t) => this.#l.has(t.id) || t.frameId && this.#l.has(t.frameId) || dt(t) && this.#l.has(t.containerId) ? (e = !0, z(t, { isDeleted: !0 })) : t);
|
|
2107
2107
|
this.#l = /* @__PURE__ */ new Set(), e && (this.#r.scheduleCapture(), this.scene.replaceAllElements(t));
|
|
2108
2108
|
}, this.#st = async (e, t) => {
|
|
2109
|
-
if (!ui(t)) throw Error(
|
|
2109
|
+
if (!ui(t)) throw Error(U("errors.unsupportedFileType"));
|
|
2110
2110
|
let n = t.type;
|
|
2111
|
-
if (
|
|
2112
|
-
t = ii(
|
|
2111
|
+
if (G(this.interactiveCanvas, "wait"), n === _.svg) try {
|
|
2112
|
+
t = ii(vr(await t.text()), t.name);
|
|
2113
2113
|
} catch (e) {
|
|
2114
|
-
throw console.warn(e), Error(
|
|
2114
|
+
throw console.warn(e), Error(U("errors.svgImageInsertError"));
|
|
2115
2115
|
}
|
|
2116
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(
|
|
2117
|
+
if (!r) throw console.warn("Couldn't generate file id or the supplied `generateIdForFile` didn't resolve to one."), Error(U("errors.imageInsertError"));
|
|
2118
2118
|
if (!this.files[r]?.dataURL) {
|
|
2119
2119
|
try {
|
|
2120
|
-
t = await hi(t, { maxWidthOrHeight:
|
|
2120
|
+
t = await hi(t, { maxWidthOrHeight: d });
|
|
2121
2121
|
} catch (e) {
|
|
2122
2122
|
console.error("Error trying to resizing image file on insertion", e);
|
|
2123
2123
|
}
|
|
2124
|
-
if (t.size > 4194304) throw Error(
|
|
2124
|
+
if (t.size > 4194304) throw Error(U("errors.fileTooBig", { maxSize: `${Math.trunc(te / 1024 / 1024)}MB` }));
|
|
2125
2125
|
}
|
|
2126
2126
|
let i = this.files[r]?.dataURL || await si(t);
|
|
2127
2127
|
return new Promise(async (t, a) => {
|
|
@@ -2146,17 +2146,17 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2146
2146
|
}
|
|
2147
2147
|
t(a);
|
|
2148
2148
|
} catch (e) {
|
|
2149
|
-
console.error(e), a(Error(
|
|
2149
|
+
console.error(e), a(Error(U("errors.imageInsertError")));
|
|
2150
2150
|
}
|
|
2151
2151
|
});
|
|
2152
|
-
}, this.#ct = (e, t) =>
|
|
2152
|
+
}, this.#ct = (e, t) => z(this.scene.getElement(e.id) ?? e, { fileId: t }), this.#lt = async () => {
|
|
2153
2153
|
try {
|
|
2154
2154
|
let { x: e, y: t } = O({
|
|
2155
2155
|
clientX: this.state.width / 2 + this.state.offsetLeft,
|
|
2156
2156
|
clientY: this.state.height / 2 + this.state.offsetTop
|
|
2157
2157
|
}, this.state), n = await $r({
|
|
2158
2158
|
description: "Image",
|
|
2159
|
-
extensions: Object.keys(
|
|
2159
|
+
extensions: Object.keys(ee),
|
|
2160
2160
|
multiple: !0
|
|
2161
2161
|
});
|
|
2162
2162
|
this.#_t(n, e, t);
|
|
@@ -2165,7 +2165,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2165
2165
|
newElement: null,
|
|
2166
2166
|
activeTool: D(this.state, { type: this.state.preferredSelectionTool.type })
|
|
2167
2167
|
}, () => {
|
|
2168
|
-
this.actionManager.executeAction(
|
|
2168
|
+
this.actionManager.executeAction(q);
|
|
2169
2169
|
});
|
|
2170
2170
|
}
|
|
2171
2171
|
}, this.#ut = (e, t) => {
|
|
@@ -2178,31 +2178,31 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2178
2178
|
crop: null
|
|
2179
2179
|
};
|
|
2180
2180
|
}, this.#dt = async (e, t = this.files) => {
|
|
2181
|
-
let { updatedFiles: n, erroredFiles: r } = await
|
|
2181
|
+
let { updatedFiles: n, erroredFiles: r } = await yr({
|
|
2182
2182
|
imageCache: this.imageCache,
|
|
2183
2183
|
fileIds: e.map((e) => e.fileId),
|
|
2184
2184
|
files: t
|
|
2185
2185
|
});
|
|
2186
|
-
return r.size && (this.#r.scheduleAction(
|
|
2186
|
+
return r.size && (this.#r.scheduleAction(H.NEVER), this.scene.replaceAllElements(this.scene.getElementsIncludingDeleted().map((e) => gt(e) && r.has(e.fileId) ? z(e, { status: "error" }) : e))), {
|
|
2187
2187
|
updatedFiles: n,
|
|
2188
2188
|
erroredFiles: r
|
|
2189
2189
|
};
|
|
2190
|
-
}, this.#ft = async (e =
|
|
2190
|
+
}, this.#ft = async (e = _r(this.scene.getNonDeletedElements()), t = this.files) => {
|
|
2191
2191
|
let n = e.filter((e) => !e.isDeleted && !this.imageCache.has(e.fileId));
|
|
2192
2192
|
if (n.length) {
|
|
2193
2193
|
let { updatedFiles: e } = await this.#dt(n, t);
|
|
2194
|
-
if (e.size) for (let t of n) e.has(t.fileId) &&
|
|
2194
|
+
if (e.size) for (let t of n) e.has(t.fileId) && un.delete(t);
|
|
2195
2195
|
e.size && this.scene.triggerUpdate();
|
|
2196
2196
|
}
|
|
2197
2197
|
}, this.#pt = eo(() => {
|
|
2198
2198
|
this.#ft();
|
|
2199
2199
|
}, 500), this.#mt = (e) => {
|
|
2200
|
-
let t =
|
|
2200
|
+
let t = wn(e);
|
|
2201
2201
|
this.state.isBindingEnabled !== t && this.setState({ isBindingEnabled: t });
|
|
2202
2202
|
}, this.#gt = (e) => {
|
|
2203
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
2204
|
}, this.#_t = async (e, t, n) => {
|
|
2205
|
-
let r = 50 / this.state.zoom.value, i =
|
|
2205
|
+
let r = 50 / this.state.zoom.value, i = br(e.map(() => this.#qe({
|
|
2206
2206
|
sceneX: t,
|
|
2207
2207
|
sceneY: n
|
|
2208
2208
|
})), t, n, r);
|
|
@@ -2211,21 +2211,21 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2211
2211
|
try {
|
|
2212
2212
|
return await this.#st(t, await pi(e[n]));
|
|
2213
2213
|
} catch (e) {
|
|
2214
|
-
return this.setState({ errorMessage: e.message ||
|
|
2214
|
+
return this.setState({ errorMessage: e.message || U("errors.imageInsertError") }), z(t, { isDeleted: !0 });
|
|
2215
2215
|
}
|
|
2216
|
-
})), o = Ae(a), s =
|
|
2216
|
+
})), o = Ae(a), s = br(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
2217
|
this.updateScene({
|
|
2218
|
-
appState: { selectedElementIds:
|
|
2218
|
+
appState: { selectedElementIds: L(Object.fromEntries(s.map((e) => [e.id, !0])), this.state) },
|
|
2219
2219
|
elements: l,
|
|
2220
|
-
captureUpdate:
|
|
2220
|
+
captureUpdate: H.IMMEDIATELY
|
|
2221
2221
|
}), this.setState({}, () => {
|
|
2222
|
-
this.actionManager.executeAction(
|
|
2222
|
+
this.actionManager.executeAction(q);
|
|
2223
2223
|
});
|
|
2224
2224
|
}, this.#vt = async (e) => {
|
|
2225
2225
|
let { x: t, y: n } = O(e, this.state), r = await vi(e), i = r.getFiles();
|
|
2226
2226
|
if (i.length === 1) {
|
|
2227
2227
|
let { file: e, fileHandle: t } = i[0];
|
|
2228
|
-
if (e && (e.type ===
|
|
2228
|
+
if (e && (e.type === _.png || e.type === _.svg)) try {
|
|
2229
2229
|
let n = await di(e, this.state, this.scene.getElementsIncludingDeleted(), t);
|
|
2230
2230
|
this.syncActionResult({
|
|
2231
2231
|
...n,
|
|
@@ -2234,16 +2234,16 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2234
2234
|
isLoading: !1
|
|
2235
2235
|
},
|
|
2236
2236
|
replaceFiles: !0,
|
|
2237
|
-
captureUpdate:
|
|
2237
|
+
captureUpdate: H.IMMEDIATELY
|
|
2238
2238
|
});
|
|
2239
2239
|
return;
|
|
2240
2240
|
} catch (e) {
|
|
2241
|
-
if (e.name !== "EncodingError") throw Error(
|
|
2241
|
+
if (e.name !== "EncodingError") throw Error(U("alerts.couldNotLoadInvalidFile"), { cause: e });
|
|
2242
2242
|
}
|
|
2243
2243
|
}
|
|
2244
2244
|
let a = i.map((e) => e.file).filter((e) => ui(e));
|
|
2245
2245
|
if (a.length > 0 && this.#de("image")) return this.#_t(a, t, n);
|
|
2246
|
-
let o = r.getData(
|
|
2246
|
+
let o = r.getData(_.drawlibIds), s = r.getData(_.drawlib);
|
|
2247
2247
|
if (o || s) {
|
|
2248
2248
|
try {
|
|
2249
2249
|
let t = null;
|
|
@@ -2253,13 +2253,13 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2253
2253
|
} else s && (t = mi(s));
|
|
2254
2254
|
t?.length && (t = t.map((e) => ({
|
|
2255
2255
|
...e,
|
|
2256
|
-
elements:
|
|
2256
|
+
elements: Gn({
|
|
2257
2257
|
type: "everything",
|
|
2258
2258
|
elements: e.elements,
|
|
2259
2259
|
randomizeSeed: !0
|
|
2260
2260
|
}).duplicatedElements
|
|
2261
2261
|
})), this.addElementsFromPasteOrLibrary({
|
|
2262
|
-
elements:
|
|
2262
|
+
elements: ua(t),
|
|
2263
2263
|
position: e,
|
|
2264
2264
|
files: null
|
|
2265
2265
|
}));
|
|
@@ -2272,10 +2272,10 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2272
2272
|
let { file: e, fileHandle: t } = i[0];
|
|
2273
2273
|
e && await this.loadFileToCanvas(e, t);
|
|
2274
2274
|
}
|
|
2275
|
-
let c = r.findByType(
|
|
2275
|
+
let c = r.findByType(_.text);
|
|
2276
2276
|
if (c) {
|
|
2277
2277
|
let e = c.value;
|
|
2278
|
-
if (e &&
|
|
2278
|
+
if (e && fr(e, this.props.validateEmbeddable) && /^(http|https):\/\/[^\s/$.?#].[^\s]*$/.test(e)) {
|
|
2279
2279
|
let r = this.insertEmbeddableElement({
|
|
2280
2280
|
sceneX: t,
|
|
2281
2281
|
sceneY: n,
|
|
@@ -2295,19 +2295,19 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2295
2295
|
if (t && e.code === "IMAGE_NOT_CONTAINS_SCENE_DATA" && !this.#de("image")) {
|
|
2296
2296
|
this.setState({
|
|
2297
2297
|
isLoading: !1,
|
|
2298
|
-
errorMessage:
|
|
2298
|
+
errorMessage: U("errors.imageToolNotSupported")
|
|
2299
2299
|
});
|
|
2300
2300
|
return;
|
|
2301
2301
|
}
|
|
2302
|
-
let n =
|
|
2302
|
+
let n = U(t ? "alerts.cannotRestoreFromImage" : "alerts.couldNotLoadInvalidFile");
|
|
2303
2303
|
this.setState({
|
|
2304
2304
|
isLoading: !1,
|
|
2305
2305
|
errorMessage: n
|
|
2306
2306
|
});
|
|
2307
2307
|
}
|
|
2308
2308
|
if (!r) return;
|
|
2309
|
-
r.type ===
|
|
2310
|
-
action:
|
|
2309
|
+
r.type === _.draw ? (En(n.concat(r.data.elements)), this.#r.scheduleMicroAction({
|
|
2310
|
+
action: H.NEVER,
|
|
2311
2311
|
elements: n,
|
|
2312
2312
|
appState: void 0
|
|
2313
2313
|
}), this.setState({ isLoading: !0 }), this.syncActionResult({
|
|
@@ -2317,13 +2317,13 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2317
2317
|
isLoading: !1
|
|
2318
2318
|
},
|
|
2319
2319
|
replaceFiles: !0,
|
|
2320
|
-
captureUpdate:
|
|
2321
|
-
})) : r.type ===
|
|
2320
|
+
captureUpdate: H.IMMEDIATELY
|
|
2321
|
+
})) : r.type === _.drawlib && await this.library.updateLibrary({
|
|
2322
2322
|
libraryItems: e,
|
|
2323
2323
|
merge: !0,
|
|
2324
2324
|
openLibraryMenu: !0
|
|
2325
2325
|
}).catch((e) => {
|
|
2326
|
-
console.error(e), this.setState({ errorMessage:
|
|
2326
|
+
console.error(e), this.setState({ errorMessage: U("errors.importLibraryError") });
|
|
2327
2327
|
});
|
|
2328
2328
|
} catch (e) {
|
|
2329
2329
|
this.setState({
|
|
@@ -2332,7 +2332,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2332
2332
|
});
|
|
2333
2333
|
}
|
|
2334
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 !==
|
|
2335
|
+
if (e.preventDefault(), ("pointerType" in e.nativeEvent && e.nativeEvent.pointerType === "touch" || "pointerType" in e.nativeEvent && e.nativeEvent.pointerType === "pen" && e.button !== v.SECONDARY) && this.state.activeTool.type !== this.state.preferredSelectionTool.type) return;
|
|
2336
2336
|
let { x: t, y: n } = O(e, this.state), r = this.#xe(t, n, {
|
|
2337
2337
|
preferSelected: !0,
|
|
2338
2338
|
includeLockedElements: !0
|
|
@@ -2340,13 +2340,13 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2340
2340
|
x: t,
|
|
2341
2341
|
y: n
|
|
2342
2342
|
}, i), o = r || a ? "element" : "canvas", { top: s, left: c } = this.rootElement.getBoundingClientRect(), l = e.clientX - c, u = e.clientY - s;
|
|
2343
|
-
|
|
2343
|
+
k("contextMenu", "openContextMenu", o), this.setState({ ...r && !this.state.selectedElementIds[r.id] ? {
|
|
2344
2344
|
...this.state,
|
|
2345
|
-
...
|
|
2345
|
+
...R({
|
|
2346
2346
|
editingGroupId: this.state.editingGroupId,
|
|
2347
2347
|
selectedElementIds: { [r.id]: !0 }
|
|
2348
2348
|
}, this.scene.getNonDeletedElements(), this.state, this),
|
|
2349
|
-
selectedLinearElement:
|
|
2349
|
+
selectedLinearElement: F(r) ? new V(r, this.scene.getNonDeletedElementsMap()) : null
|
|
2350
2350
|
} : this.state }, () => {
|
|
2351
2351
|
this.setState({ contextMenu: {
|
|
2352
2352
|
top: u,
|
|
@@ -2357,7 +2357,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2357
2357
|
}, this.#bt = (e, t, n = !0) => {
|
|
2358
2358
|
let r = this.state.selectionElement, i = e.lastCoords;
|
|
2359
2359
|
if (r && e.boxSelection.hasOccurred && this.state.activeTool.type !== "eraser") {
|
|
2360
|
-
|
|
2360
|
+
Yn({
|
|
2361
2361
|
newElement: r,
|
|
2362
2362
|
elementType: this.state.activeTool.type,
|
|
2363
2363
|
originX: e.origin.x,
|
|
@@ -2376,7 +2376,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2376
2376
|
}
|
|
2377
2377
|
let a = this.state.newElement;
|
|
2378
2378
|
if (!a) return;
|
|
2379
|
-
let [o, s] = C(i.x, i.y, t[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()), c =
|
|
2379
|
+
let [o, s] = C(i.x, i.y, t[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()), c = gt(a) && this.imageCache.get(a.fileId)?.image, l = c && !(c instanceof Promise) ? c.width / c.height : null;
|
|
2380
2380
|
this.#Qe(t, [a]);
|
|
2381
2381
|
let { snapOffset: u, snapLines: d } = Da(a, this, t, {
|
|
2382
2382
|
x: e.originInGrid.x + (this.state.originSnapOffset?.x ?? 0),
|
|
@@ -2385,7 +2385,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2385
2385
|
x: o - e.originInGrid.x,
|
|
2386
2386
|
y: s - e.originInGrid.y
|
|
2387
2387
|
}, this.scene.getNonDeletedElementsMap());
|
|
2388
|
-
o += u.x, s += u.y, this.setState({ snapLines: d }),
|
|
2388
|
+
o += u.x, s += u.y, this.setState({ snapLines: d }), j(a) || Yn({
|
|
2389
2389
|
newElement: a,
|
|
2390
2390
|
elementType: this.state.activeTool.type,
|
|
2391
2391
|
originX: e.originInGrid.x,
|
|
@@ -2394,27 +2394,27 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2394
2394
|
y: s,
|
|
2395
2395
|
width: Me(e.originInGrid.x, o),
|
|
2396
2396
|
height: Me(e.originInGrid.y, s),
|
|
2397
|
-
shouldMaintainAspectRatio:
|
|
2397
|
+
shouldMaintainAspectRatio: P(a) ? !be(t) : be(t),
|
|
2398
2398
|
shouldResizeFromCenter: xe(t),
|
|
2399
2399
|
zoom: this.state.zoom.value,
|
|
2400
2400
|
scene: this.scene,
|
|
2401
2401
|
widthAspectRatio: l,
|
|
2402
2402
|
originOffset: this.state.originSnapOffset,
|
|
2403
2403
|
informMutation: n
|
|
2404
|
-
}), this.setState({ newElement: a }), (this.state.activeTool.type === b.frame || this.state.activeTool.type === b.magicframe) && this.setState({ elementsToHighlight:
|
|
2404
|
+
}), this.setState({ newElement: a }), (this.state.activeTool.type === b.frame || this.state.activeTool.type === b.magicframe) && this.setState({ elementsToHighlight: $t(this.scene.getNonDeletedElements(), a, this.state, this.scene.getNonDeletedElementsMap()) });
|
|
2405
2405
|
}, this.#xt = (e, t) => {
|
|
2406
2406
|
if (!this.state.croppingElementId) return !1;
|
|
2407
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 &&
|
|
2409
|
-
let s = e.originalElements.get(o.id), c =
|
|
2410
|
-
if (s &&
|
|
2408
|
+
if (n && o && P(o)) {
|
|
2409
|
+
let s = e.originalElements.get(o.id), c = gt(o) && this.imageCache.get(o.fileId)?.image;
|
|
2410
|
+
if (s && P(s) && c && !(c instanceof Promise)) {
|
|
2411
2411
|
let [l, u] = C(r.x, r.y, t[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()), d = {
|
|
2412
2412
|
x: l - e.originInGrid.x,
|
|
2413
2413
|
y: u - e.originInGrid.y
|
|
2414
2414
|
};
|
|
2415
2415
|
this.#Qe(t, [o]);
|
|
2416
2416
|
let { snapOffset: f, snapLines: p } = Oa([o], [s], this, t, d, n);
|
|
2417
|
-
this.scene.mutateElement(o,
|
|
2417
|
+
this.scene.mutateElement(o, at(o, this.scene.getNonDeletedElementsMap(), n, c.naturalWidth, c.naturalHeight, i + f.x, a + f.y, t.shiftKey ? s.width / s.height : void 0)), Tn(o, this.scene), this.setState({
|
|
2418
2418
|
isCropping: n && n !== "rotation",
|
|
2419
2419
|
snapLines: p
|
|
2420
2420
|
});
|
|
@@ -2423,8 +2423,8 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2423
2423
|
}
|
|
2424
2424
|
return !1;
|
|
2425
2425
|
}, this.#St = (e, t) => {
|
|
2426
|
-
let n = this.scene.getSelectedElements(this.state), r = n.filter((e) =>
|
|
2427
|
-
if (r.length > 0 && i === "rotation" || n.length === 1 &&
|
|
2426
|
+
let n = this.scene.getSelectedElements(this.state), r = n.filter((e) => N(e)), i = e.resize.handleType;
|
|
2427
|
+
if (r.length > 0 && i === "rotation" || n.length === 1 && M(n[0]) || this.state.croppingElementId) return !1;
|
|
2428
2428
|
this.setState({
|
|
2429
2429
|
isResizing: i && i !== "rotation",
|
|
2430
2430
|
isRotating: i === "rotation",
|
|
@@ -2432,7 +2432,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2432
2432
|
});
|
|
2433
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
2434
|
if (r.forEach((e) => {
|
|
2435
|
-
|
|
2435
|
+
tn(this.scene.getNonDeletedElements(), e.id).forEach((t) => {
|
|
2436
2436
|
c.set(e.id + t.id, {
|
|
2437
2437
|
x: t.x - e.x,
|
|
2438
2438
|
y: t.y - e.y
|
|
@@ -2444,89 +2444,89 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2444
2444
|
y: c - e.originInGrid.y
|
|
2445
2445
|
}, u = [...e.originalElements.values()];
|
|
2446
2446
|
this.#Qe(t, n);
|
|
2447
|
-
let { snapOffset: d, snapLines: f } = Oa(n,
|
|
2447
|
+
let { snapOffset: d, snapLines: f } = Oa(n, Tt(u, this.state), this, t, l, i);
|
|
2448
2448
|
o += d.x, s += d.y, this.setState({ snapLines: f });
|
|
2449
2449
|
}
|
|
2450
|
-
if (
|
|
2450
|
+
if (Cr(e.originalElements, i, n, this.scene, Se(t), xe(t), n.some((e) => P(e)) ? !be(t) : be(t), o, s, e.resize.center.x, e.resize.center.y)) {
|
|
2451
2451
|
let e = /* @__PURE__ */ new Set();
|
|
2452
2452
|
return r.forEach((t) => {
|
|
2453
|
-
|
|
2453
|
+
$t(this.scene.getNonDeletedElements(), t, this.state, this.scene.getNonDeletedElementsMap()).forEach((t) => e.add(t));
|
|
2454
2454
|
}), this.setState({ elementsToHighlight: [...e] }), !0;
|
|
2455
2455
|
}
|
|
2456
2456
|
return !1;
|
|
2457
2457
|
}, this.#Ct = (e) => {
|
|
2458
2458
|
let t = [];
|
|
2459
|
-
if (t.push(
|
|
2459
|
+
if (t.push(Li, Ri), e === "canvas") return this.state.viewModeEnabled ? [
|
|
2460
2460
|
...t,
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2461
|
+
Hi,
|
|
2462
|
+
Wi,
|
|
2463
|
+
oa,
|
|
2464
|
+
Zi
|
|
2465
2465
|
] : [
|
|
2466
|
-
|
|
2466
|
+
Bi,
|
|
2467
2467
|
Y,
|
|
2468
|
+
Li,
|
|
2468
2469
|
Ri,
|
|
2469
|
-
|
|
2470
|
-
Hi,
|
|
2470
|
+
Vi,
|
|
2471
2471
|
Y,
|
|
2472
|
-
|
|
2473
|
-
|
|
2472
|
+
yi,
|
|
2473
|
+
Yi,
|
|
2474
2474
|
Y,
|
|
2475
|
+
Hi,
|
|
2475
2476
|
Ui,
|
|
2476
2477
|
Wi,
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
Qi
|
|
2478
|
+
oa,
|
|
2479
|
+
Zi
|
|
2480
2480
|
];
|
|
2481
|
-
if (t.push(
|
|
2481
|
+
if (t.push(Vi), this.state.viewModeEnabled) return [Ii, ...t];
|
|
2482
2482
|
let n = this.editorInterface.formFactor === "desktop" ? [
|
|
2483
2483
|
Y,
|
|
2484
|
+
Si,
|
|
2485
|
+
bi,
|
|
2484
2486
|
Ci,
|
|
2485
|
-
xi
|
|
2486
|
-
wi,
|
|
2487
|
-
Si
|
|
2487
|
+
xi
|
|
2488
2488
|
] : [];
|
|
2489
2489
|
return [
|
|
2490
2490
|
Y,
|
|
2491
|
+
zi,
|
|
2492
|
+
Ii,
|
|
2491
2493
|
Bi,
|
|
2492
|
-
Li,
|
|
2493
|
-
Vi,
|
|
2494
2494
|
Y,
|
|
2495
|
-
na,
|
|
2496
2495
|
ta,
|
|
2497
|
-
|
|
2496
|
+
ea,
|
|
2497
|
+
na,
|
|
2498
2498
|
Y,
|
|
2499
|
-
|
|
2499
|
+
Qi,
|
|
2500
2500
|
Y,
|
|
2501
2501
|
...t,
|
|
2502
2502
|
Y,
|
|
2503
|
+
ki,
|
|
2503
2504
|
Ai,
|
|
2504
|
-
ji,
|
|
2505
2505
|
Y,
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
qi,
|
|
2506
|
+
ji,
|
|
2507
|
+
aa,
|
|
2509
2508
|
Ki,
|
|
2510
|
-
|
|
2511
|
-
|
|
2509
|
+
Gi,
|
|
2510
|
+
qi,
|
|
2511
|
+
Mi,
|
|
2512
2512
|
Y,
|
|
2513
|
-
|
|
2513
|
+
Ni,
|
|
2514
2514
|
...n,
|
|
2515
2515
|
Y,
|
|
2516
|
+
Pi,
|
|
2516
2517
|
Fi,
|
|
2517
|
-
Ii,
|
|
2518
2518
|
Y,
|
|
2519
|
-
|
|
2519
|
+
Xi,
|
|
2520
2520
|
Y,
|
|
2521
|
-
|
|
2521
|
+
$i,
|
|
2522
2522
|
Y,
|
|
2523
|
-
|
|
2524
|
-
|
|
2523
|
+
Xr,
|
|
2524
|
+
Ji,
|
|
2525
2525
|
Y,
|
|
2526
|
-
|
|
2526
|
+
Jr
|
|
2527
2527
|
];
|
|
2528
|
-
}, this.#wt =
|
|
2529
|
-
if (!(e.target instanceof HTMLCanvasElement || e.target instanceof HTMLTextAreaElement || e.target instanceof HTMLIFrameElement || e.target instanceof HTMLElement && e.target.classList.contains(
|
|
2528
|
+
}, this.#wt = J((e) => {
|
|
2529
|
+
if (!(e.target instanceof HTMLCanvasElement || e.target instanceof HTMLTextAreaElement || e.target instanceof HTMLIFrameElement || e.target instanceof HTMLElement && e.target.classList.contains(c.FRAME_NAME))) {
|
|
2530
2530
|
e[x.CTRL_OR_CMD] && e.preventDefault();
|
|
2531
2531
|
return;
|
|
2532
2532
|
}
|
|
@@ -2537,10 +2537,10 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2537
2537
|
r > t && (i = t * e);
|
|
2538
2538
|
let a = this.state.zoom.value - i / 100;
|
|
2539
2539
|
a += Math.log10(Math.max(1, this.state.zoom.value)) * -e * Math.min(1, r / 20), this.#ae((e) => ({
|
|
2540
|
-
...
|
|
2540
|
+
...Ti({
|
|
2541
2541
|
viewportX: this.lastViewportPosition.x,
|
|
2542
2542
|
viewportY: this.lastViewportPosition.y,
|
|
2543
|
-
nextZoom:
|
|
2543
|
+
nextZoom: Gr(a)
|
|
2544
2544
|
}, e),
|
|
2545
2545
|
shouldCacheIgnoreZoom: !0
|
|
2546
2546
|
})), this.#Dt();
|
|
@@ -2590,20 +2590,20 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2590
2590
|
}, this.refresh = () => {
|
|
2591
2591
|
this.setState({ ...this.#kt() });
|
|
2592
2592
|
}, this.watchState = () => {};
|
|
2593
|
-
let n =
|
|
2593
|
+
let n = tt(), { drawAPI: i, viewModeEnabled: u = !1, zenModeEnabled: f = !1, gridModeEnabled: p = !1, objectsSnapModeEnabled: oe = !1, theme: de = n.theme, name: Ce = `${U("labels.untitled")}-${Fe()}` } = t;
|
|
2594
2594
|
if (this.state = {
|
|
2595
2595
|
...n,
|
|
2596
2596
|
theme: de,
|
|
2597
2597
|
isLoading: !0,
|
|
2598
2598
|
...this.#kt(),
|
|
2599
|
-
viewModeEnabled:
|
|
2600
|
-
zenModeEnabled:
|
|
2599
|
+
viewModeEnabled: u,
|
|
2600
|
+
zenModeEnabled: f,
|
|
2601
2601
|
objectsSnapModeEnabled: oe,
|
|
2602
|
-
gridModeEnabled:
|
|
2602
|
+
gridModeEnabled: p ?? n.gridModeEnabled,
|
|
2603
2603
|
name: Ce,
|
|
2604
2604
|
width: window.innerWidth,
|
|
2605
2605
|
height: window.innerHeight
|
|
2606
|
-
}, this.refreshEditorInterface(), this.#e = le(this.editorInterface), this.id = Ze(), this.library = new
|
|
2606
|
+
}, this.refreshEditorInterface(), this.#e = le(this.editorInterface), this.id = Ze(), this.library = new la(this), this.actionManager = new et(this.syncActionResult, () => this.state, () => this.scene.getElementsIncludingDeleted(), this), this.scene = new Un(), this.canvas = document.createElement("canvas"), this.rc = rt.canvas(this.canvas), this.renderer = new _a(this.scene), this.visibleElements = [], this.#r = new Kn(this), this.fonts = new ei(this.scene), this.#i = new kr(this.#r), i) {
|
|
2607
2607
|
let e = {
|
|
2608
2608
|
updateScene: this.updateScene,
|
|
2609
2609
|
applyDeltas: this.applyDeltas,
|
|
@@ -2642,12 +2642,12 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2642
2642
|
this.drawContainerValue = {
|
|
2643
2643
|
container: this.rootElement,
|
|
2644
2644
|
id: this.id
|
|
2645
|
-
}, this.actionManager.registerAll(
|
|
2645
|
+
}, this.actionManager.registerAll(qr), this.actionManager.registerAction(ia(this.#i)), this.actionManager.registerAction(ra(this.#i));
|
|
2646
2646
|
}
|
|
2647
2647
|
#d() {
|
|
2648
2648
|
if (this.state.selectedLinearElement?.initialState && !this.state.selectedLinearElement.initialState.arrowStartIsInside) {
|
|
2649
2649
|
E(this.lastPointerMoveCoords, "Missing last pointer move coords when changing bind skip mode for arrow start");
|
|
2650
|
-
let e = this.scene.getNonDeletedElementsMap(), t =
|
|
2650
|
+
let e = this.scene.getNonDeletedElementsMap(), t = B(S(this.lastPointerMoveCoords.x, this.lastPointerMoveCoords.y), this.scene.getNonDeletedElements(), e), n = V.getElement(this.state.selectedLinearElement.elementId, e);
|
|
2651
2651
|
n?.startBinding && t?.id === n.startBinding.elementId && this.setState({ selectedLinearElement: {
|
|
2652
2652
|
...this.state.selectedLinearElement,
|
|
2653
2653
|
initialState: {
|
|
@@ -2661,7 +2661,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2661
2661
|
}), this.lastPointerMoveCoords && this.state.selectedLinearElement?.selectedPointsIndices && this.state.selectedLinearElement?.selectedPointsIndices?.length)) {
|
|
2662
2662
|
let { x: e, y: t } = this.lastPointerMoveCoords, n = this.lastPointerMoveEvent ?? this.lastPointerDownEvent?.nativeEvent;
|
|
2663
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 ?
|
|
2664
|
+
let r = e - this.state.selectedLinearElement.pointerOffset.x, i = t - this.state.selectedLinearElement.pointerOffset.y, a = this.state.multiElement ? V.handlePointerMove(n, this, r, i, this.state.selectedLinearElement) : V.handlePointDragging(n, this, r, i, this.state.selectedLinearElement);
|
|
2665
2665
|
a && this.setState(a);
|
|
2666
2666
|
}
|
|
2667
2667
|
}
|
|
@@ -2670,14 +2670,14 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2670
2670
|
}
|
|
2671
2671
|
#p;
|
|
2672
2672
|
#m(e, t) {
|
|
2673
|
-
if (e.isDeleted ||
|
|
2673
|
+
if (e.isDeleted || M(e)) return;
|
|
2674
2674
|
let n = () => {
|
|
2675
2675
|
if (this.bindModeHandler = null, E(this.lastPointerMoveCoords, "Expected lastPointerMoveCoords to be set"), !this.state.multiElement) {
|
|
2676
2676
|
if (!this.state.selectedLinearElement || !this.state.selectedLinearElement.selectedPointsIndices || !this.state.selectedLinearElement.selectedPointsIndices.length) return;
|
|
2677
2677
|
let t = this.state.selectedLinearElement.selectedPointsIndices.includes(0), n = this.state.selectedLinearElement.selectedPointsIndices.includes(e.points.length - 1);
|
|
2678
2678
|
if (!t && !n || t && n) return;
|
|
2679
2679
|
}
|
|
2680
|
-
let { x: t, y: n } = this.lastPointerMoveCoords, r =
|
|
2680
|
+
let { x: t, y: n } = this.lastPointerMoveCoords, r = B(S(t, n), this.scene.getNonDeletedElements(), this.scene.getNonDeletedElementsMap());
|
|
2681
2681
|
if (r && this.state.bindMode !== "skip") {
|
|
2682
2682
|
E(this.state.selectedLinearElement?.elementId === e.id, "The selectedLinearElement is expected to not change while a bind mode timeout is ticking");
|
|
2683
2683
|
let i = this.state.selectedLinearElement.initialState.arrowStartIsInside || e.startBinding?.elementId === r.id;
|
|
@@ -2695,13 +2695,13 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2695
2695
|
});
|
|
2696
2696
|
let a = this.lastPointerMoveEvent ?? this.lastPointerDownEvent?.nativeEvent;
|
|
2697
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 ?
|
|
2698
|
+
let o = t - this.state.selectedLinearElement.pointerOffset.x, s = n - this.state.selectedLinearElement.pointerOffset.y, c = this.state.multiElement ? V.handlePointerMove(a, this, o, s, this.state.selectedLinearElement) : V.handlePointDragging(a, this, o, s, this.state.selectedLinearElement);
|
|
2699
2699
|
c && this.setState(c);
|
|
2700
2700
|
}
|
|
2701
2701
|
}, r = !1;
|
|
2702
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 &&
|
|
2704
|
-
r = !!(c && l && o.id !== s.id &&
|
|
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 && jn(o, n), l = s && jn(s, n);
|
|
2704
|
+
r = !!(c && l && o.id !== s.id && On(c, l));
|
|
2705
2705
|
}
|
|
2706
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
2707
|
o && s && e[o]?.mode === "inside" && t?.id !== e[o]?.elementId && e[s]?.elementId !== e[o]?.elementId && this.scene.mutateElement(e, { [o]: {
|
|
@@ -2731,7 +2731,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2731
2731
|
newElement: null,
|
|
2732
2732
|
selectionElement: null
|
|
2733
2733
|
});
|
|
2734
|
-
}, 100), !
|
|
2734
|
+
}, 100), !mt(e) && this.#g(e)?.contentWindow);
|
|
2735
2735
|
}
|
|
2736
2736
|
#v(e, t, n, r) {
|
|
2737
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;
|
|
@@ -2740,14 +2740,14 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2740
2740
|
#b;
|
|
2741
2741
|
#x() {
|
|
2742
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) =>
|
|
2743
|
+
return /* @__PURE__ */ X(Qa, { children: this.scene.getNonDeletedElements().filter((e) => ft(e) && this.#o.get(e.id) === !0 || mt(e)).map((r) => {
|
|
2744
2744
|
let { x: i, y: a } = qe({
|
|
2745
2745
|
sceneX: r.x,
|
|
2746
2746
|
sceneY: r.y
|
|
2747
|
-
}, this.state), o =
|
|
2747
|
+
}, this.state), o = Fn(r, t, n, this.state, this.scene.getNonDeletedElementsMap()), s = this.#s.has(r.id);
|
|
2748
2748
|
if (o && !s && this.#s.add(r.id), !(o || s)) return null;
|
|
2749
2749
|
let c;
|
|
2750
|
-
if (
|
|
2750
|
+
if (mt(r)) {
|
|
2751
2751
|
c = null;
|
|
2752
2752
|
let e = (r.customData?.generationData ?? this.#D.get(r.id)) || {
|
|
2753
2753
|
status: "error",
|
|
@@ -2770,7 +2770,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2770
2770
|
h: r.height
|
|
2771
2771
|
},
|
|
2772
2772
|
type: "document",
|
|
2773
|
-
srcdoc: () =>
|
|
2773
|
+
srcdoc: () => dr(`
|
|
2774
2774
|
<style>
|
|
2775
2775
|
html, body {
|
|
2776
2776
|
width: 100%;
|
|
@@ -2852,7 +2852,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2852
2852
|
h: r.height
|
|
2853
2853
|
},
|
|
2854
2854
|
type: "document",
|
|
2855
|
-
srcdoc: () =>
|
|
2855
|
+
srcdoc: () => dr(`
|
|
2856
2856
|
<style>
|
|
2857
2857
|
html, body {
|
|
2858
2858
|
height: 100%;
|
|
@@ -2881,8 +2881,8 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2881
2881
|
style: {
|
|
2882
2882
|
transform: o ? `translate(${i - this.state.offsetLeft}px, ${a - this.state.offsetTop}px) scale(${e})` : "none",
|
|
2883
2883
|
display: o ? "block" : "none",
|
|
2884
|
-
opacity:
|
|
2885
|
-
"--embeddable-radius": `${
|
|
2884
|
+
opacity: ln(r, Zt(r, this.scene.getNonDeletedElementsMap()), this.#l, null, this.state.openDialog?.name === "elementLinkSelector" ? f : 1),
|
|
2885
|
+
"--embeddable-radius": `${dn(Math.min(r.width, r.height), r)}px`
|
|
2886
2886
|
},
|
|
2887
2887
|
children: /* @__PURE__ */ $a("div", {
|
|
2888
2888
|
className: "draw__embeddable-container__inner",
|
|
@@ -2890,15 +2890,15 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2890
2890
|
width: o ? `${r.width}px` : 0,
|
|
2891
2891
|
height: o ? `${r.height}px` : 0,
|
|
2892
2892
|
transform: o ? `rotate(${r.angle}rad)` : "none",
|
|
2893
|
-
pointerEvents: l ?
|
|
2893
|
+
pointerEvents: l ? y.enabled : y.disabled
|
|
2894
2894
|
},
|
|
2895
2895
|
children: [u && /* @__PURE__ */ X("div", {
|
|
2896
2896
|
className: "draw__embeddable-hint",
|
|
2897
|
-
children:
|
|
2897
|
+
children: U("buttons.embeddableInteractionButton")
|
|
2898
2898
|
}), /* @__PURE__ */ X("div", {
|
|
2899
2899
|
className: "draw__embeddable__outer",
|
|
2900
2900
|
style: { padding: `${r.strokeWidth}px` },
|
|
2901
|
-
children: (
|
|
2901
|
+
children: (ft(r) ? this.props.renderEmbeddable?.(r, this.state) : null) ?? /* @__PURE__ */ X("iframe", {
|
|
2902
2902
|
ref: (e) => this.#h(r, e),
|
|
2903
2903
|
className: "draw__embeddable",
|
|
2904
2904
|
srcDoc: c?.type === "document" ? c.srcdoc(this.state.theme) : void 0,
|
|
@@ -2935,9 +2935,9 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2935
2935
|
this.setState({ errorMessage: "No diagram to code plugin found" });
|
|
2936
2936
|
return;
|
|
2937
2937
|
}
|
|
2938
|
-
let r =
|
|
2938
|
+
let r = en(this.scene.getNonDeletedElements(), e).filter((e) => !yt(e));
|
|
2939
2939
|
if (!r.length) {
|
|
2940
|
-
t === "button" ? (this.setState({ errorMessage: "Cannot generate from an empty frame" }),
|
|
2940
|
+
t === "button" ? (this.setState({ errorMessage: "Cannot generate from an empty frame" }), k("ai", "generate (no-children)", "d2c")) : this.setActiveTool({ type: "magicframe" });
|
|
2941
2941
|
return;
|
|
2942
2942
|
}
|
|
2943
2943
|
let i = this.insertIframeElement({
|
|
@@ -2950,13 +2950,13 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2950
2950
|
this.#O({
|
|
2951
2951
|
frameElement: i,
|
|
2952
2952
|
data: { status: "pending" }
|
|
2953
|
-
}), this.setState({ selectedElementIds: { [i.id]: !0 } }),
|
|
2953
|
+
}), this.setState({ selectedElementIds: { [i.id]: !0 } }), k("ai", "generate (start)", "d2c");
|
|
2954
2954
|
try {
|
|
2955
2955
|
let { html: t } = await n({
|
|
2956
2956
|
frame: e,
|
|
2957
2957
|
children: r
|
|
2958
2958
|
});
|
|
2959
|
-
if (
|
|
2959
|
+
if (k("ai", "generate (success)", "d2c"), !t.trim()) {
|
|
2960
2960
|
this.#O({
|
|
2961
2961
|
frameElement: i,
|
|
2962
2962
|
data: {
|
|
@@ -2976,7 +2976,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
2976
2976
|
}
|
|
2977
2977
|
});
|
|
2978
2978
|
} catch (e) {
|
|
2979
|
-
|
|
2979
|
+
k("ai", "generate (failed)", "d2c"), this.#O({
|
|
2980
2980
|
frameElement: i,
|
|
2981
2981
|
data: {
|
|
2982
2982
|
status: "error",
|
|
@@ -3008,7 +3008,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3008
3008
|
#H(e) {
|
|
3009
3009
|
let t = e ?? this.files;
|
|
3010
3010
|
this.scene.getNonDeletedElements().forEach((e) => {
|
|
3011
|
-
|
|
3011
|
+
gt(e) && t[e.fileId] && (this.imageCache.delete(e.fileId), un.delete(e));
|
|
3012
3012
|
});
|
|
3013
3013
|
}
|
|
3014
3014
|
async componentDidMount() {
|
|
@@ -3045,11 +3045,11 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3045
3045
|
e(t);
|
|
3046
3046
|
}), this.scene.onUpdate(this.#se), this.#q(), this.props.autoFocus && this.rootElement && this.focusContainer(), oe && this.rootElement && (this.#n = new ResizeObserver(() => {
|
|
3047
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() && !
|
|
3048
|
+
}), this.#n?.observe?.(this.rootElement)), new URLSearchParams(window.location.search.slice(1)).has("web-share-target") ? this.restoreFileFromShare() : this.#Ot(this.#R), de() && !Mt() && this.setState({ errorMessage: /* @__PURE__ */ X(ja, {}) }), n.on(t.DARK_THEME, this.#U);
|
|
3049
3049
|
}
|
|
3050
3050
|
#U;
|
|
3051
3051
|
componentWillUnmount() {
|
|
3052
|
-
window.launchQueue?.setConsumer?.(() => {}), this.renderer.destroy(), this.scene.destroy(), this.scene = new
|
|
3052
|
+
window.launchQueue?.setConsumer?.(() => {}), this.renderer.destroy(), this.scene.destroy(), this.scene = new Un(), this.fonts = new ei(this.scene), this.renderer = new _a(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(), un.destroy(), ya.destroy(), clearTimeout(Q), Dt.clearCache(), R.clearCache(), Q = 0, document.documentElement.style.overscrollBehaviorX = "", n.off(t.DARK_THEME, this.#U);
|
|
3053
3053
|
}
|
|
3054
3054
|
#W;
|
|
3055
3055
|
#G;
|
|
@@ -3067,14 +3067,14 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3067
3067
|
componentDidUpdate(e, r) {
|
|
3068
3068
|
this.#b();
|
|
3069
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 &&
|
|
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 && A(this.state) && this.setState({ activeTool: D(this.state, { type: "selection" }) }), this.state.activeTool.type === "eraser" && r.theme !== this.state.theme && wi(this.interactiveCanvas, this.state.theme), e.langCode !== this.props.langCode && this.#At(), A(r) && !A(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
3071
|
key: "draw",
|
|
3072
3072
|
value: !0
|
|
3073
3073
|
}) : n.emit(t.DARK_THEME, {
|
|
3074
3074
|
key: "draw",
|
|
3075
3075
|
value: !1
|
|
3076
3076
|
})), this.state.selectedLinearElement?.isEditing && !this.state.selectedElementIds[this.state.selectedLinearElement.elementId] && setTimeout(() => {
|
|
3077
|
-
this.state.selectedLinearElement?.isEditing && this.actionManager.executeAction(
|
|
3077
|
+
this.state.selectedLinearElement?.isEditing && this.actionManager.executeAction(q);
|
|
3078
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
3079
|
}
|
|
3080
3080
|
#J;
|
|
@@ -3116,11 +3116,11 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3116
3116
|
t.startsWith("<svg") && t.endsWith("</svg>") && a.push(ii(t));
|
|
3117
3117
|
}
|
|
3118
3118
|
if (a.length > 0) {
|
|
3119
|
-
this.#de("image") ? await this.#_t(a, r, i) : this.setState({ errorMessage:
|
|
3119
|
+
this.#de("image") ? await this.#_t(a, r, i) : this.setState({ errorMessage: U("errors.imageToolNotSupported") });
|
|
3120
3120
|
return;
|
|
3121
3121
|
}
|
|
3122
3122
|
if (e.elements) {
|
|
3123
|
-
let t = e.programmaticAPI ?
|
|
3123
|
+
let t = e.programmaticAPI ? Or(e.elements) : e.elements;
|
|
3124
3124
|
this.addElementsFromPasteOrLibrary({
|
|
3125
3125
|
elements: t,
|
|
3126
3126
|
files: e.files || null,
|
|
@@ -3130,7 +3130,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3130
3130
|
return;
|
|
3131
3131
|
}
|
|
3132
3132
|
if (!e.text) return;
|
|
3133
|
-
let o = Ke(e.text).split(/\n+/).map((e) => e.trim()).filter(Boolean), s = o.map((e) =>
|
|
3133
|
+
let o = Ke(e.text).split(/\n+/).map((e) => e.trim()).filter(Boolean), s = o.map((e) => pr(e)).filter((e) => fr(e, this.props.validateEmbeddable) && /^(http|https):\/\/[^\s/$.?#].[^\s]*$/.test(e));
|
|
3134
3134
|
if (!n && s.length > 0 && s.length === o.length) {
|
|
3135
3135
|
let e = [];
|
|
3136
3136
|
for (let t of s) {
|
|
@@ -3153,7 +3153,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3153
3153
|
return { file: await ri(e) };
|
|
3154
3154
|
} catch (e) {
|
|
3155
3155
|
let t = e.message;
|
|
3156
|
-
return e.cause === "FETCH_ERROR" ? t =
|
|
3156
|
+
return e.cause === "FETCH_ERROR" ? t = U("errors.failedToFetchImage") : e.cause === "UNSUPPORTED" && (t = U("errors.unsupportedFileType")), { errorMessage: t };
|
|
3157
3157
|
}
|
|
3158
3158
|
})), a = i.filter((e) => !!e.file).map((e) => e.file);
|
|
3159
3159
|
await this.#_t(a, n, r);
|
|
@@ -3182,21 +3182,21 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3182
3182
|
text: e,
|
|
3183
3183
|
fontSize: this.state.currentItemFontSize,
|
|
3184
3184
|
fontFamily: this.state.currentItemFontFamily,
|
|
3185
|
-
textAlign:
|
|
3185
|
+
textAlign: p,
|
|
3186
3186
|
verticalAlign: "top",
|
|
3187
3187
|
locked: !1
|
|
3188
3188
|
}, a = Ie({
|
|
3189
3189
|
fontSize: i.fontSize,
|
|
3190
3190
|
fontFamily: i.fontFamily
|
|
3191
|
-
}), o = _e(i.fontFamily), [s, , c] =
|
|
3192
|
-
let s =
|
|
3191
|
+
}), o = _e(i.fontFamily), [s, , c] = Mn(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 = Pt(t).trim();
|
|
3193
3193
|
if (s.length) {
|
|
3194
3194
|
let t = this.#ke({
|
|
3195
3195
|
x: n,
|
|
3196
3196
|
y: u
|
|
3197
|
-
}), r =
|
|
3198
|
-
r = c ?
|
|
3199
|
-
let f = n - r.width / 2, p = u - r.height / 2, m =
|
|
3197
|
+
}), r = Nt(s, a, o), c = r.width > l, d = c ? Ft(s, a, l) : s;
|
|
3198
|
+
r = c ? Nt(d, a, o) : r;
|
|
3199
|
+
let f = n - r.width / 2, p = u - r.height / 2, m = lr({
|
|
3200
3200
|
...i,
|
|
3201
3201
|
x: f,
|
|
3202
3202
|
y: p,
|
|
@@ -3207,11 +3207,11 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3207
3207
|
frameId: t ? t.id : null
|
|
3208
3208
|
});
|
|
3209
3209
|
e.push(m), u += m.height + 10;
|
|
3210
|
-
} else d[r - 1]?.trim?.() && (u +=
|
|
3210
|
+
} else d[r - 1]?.trim?.() && (u += At(i.fontSize, o) + 10);
|
|
3211
3211
|
return e;
|
|
3212
3212
|
}, []);
|
|
3213
|
-
f.length !== 0 && (this.scene.insertElements(f), this.#r.scheduleCapture(), this.setState({ selectedElementIds:
|
|
3214
|
-
message:
|
|
3213
|
+
f.length !== 0 && (this.scene.insertElements(f), this.#r.scheduleCapture(), this.setState({ selectedElementIds: L(Object.fromEntries(f.map((e) => [e.id, !0])), this.state) }), !t && f.length > 1 && _o === !1 && this.editorInterface.formFactor !== "phone" && (this.setToast({
|
|
3214
|
+
message: U("toast.pasteAsSingleElement", { shortcut: Yr("CtrlOrCmd+Shift+V") }),
|
|
3215
3215
|
duration: 5e3
|
|
3216
3216
|
}), _o = !0));
|
|
3217
3217
|
}
|
|
@@ -3231,10 +3231,10 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3231
3231
|
#_e;
|
|
3232
3232
|
#ve(e, { isExistingElement: t = !1 }) {
|
|
3233
3233
|
let n = this.scene.getElementsMapIncludingDeleted(), r = (t, r) => {
|
|
3234
|
-
this.scene.replaceAllElements([...this.scene.getElementsIncludingDeleted().map((i) => i.id === e.id &&
|
|
3234
|
+
this.scene.replaceAllElements([...this.scene.getElementsIncludingDeleted().map((i) => i.id === e.id && I(i) ? z(i, {
|
|
3235
3235
|
originalText: t,
|
|
3236
3236
|
isDeleted: r ?? i.isDeleted,
|
|
3237
|
-
...
|
|
3237
|
+
...ur(i, Rt(i, n), n, t)
|
|
3238
3238
|
}) : i)]);
|
|
3239
3239
|
};
|
|
3240
3240
|
ka({
|
|
@@ -3247,26 +3247,26 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3247
3247
|
}, this.state);
|
|
3248
3248
|
return [n - this.state.offsetLeft, r - this.state.offsetTop];
|
|
3249
3249
|
},
|
|
3250
|
-
onChange:
|
|
3251
|
-
r(t, !1),
|
|
3250
|
+
onChange: J((t) => {
|
|
3251
|
+
r(t, !1), Hn(e) && Tn(e, this.scene);
|
|
3252
3252
|
}),
|
|
3253
|
-
onSubmit:
|
|
3253
|
+
onSubmit: J(({ viaKeyboard: n, nextOriginalText: i }) => {
|
|
3254
3254
|
let a = !i.trim();
|
|
3255
3255
|
if (r(i, a), !a && n) {
|
|
3256
3256
|
let t = e.containerId ? e.containerId : e.id;
|
|
3257
3257
|
Z(() => {
|
|
3258
|
-
this.setState((e) => ({ selectedElementIds:
|
|
3258
|
+
this.setState((e) => ({ selectedElementIds: L({
|
|
3259
3259
|
...e.selectedElementIds,
|
|
3260
3260
|
[t]: !0
|
|
3261
3261
|
}, e) }));
|
|
3262
3262
|
});
|
|
3263
3263
|
}
|
|
3264
|
-
a &&
|
|
3264
|
+
a && xn(this.scene.getNonDeletedElements(), [e]), (!a || t) && this.#r.scheduleCapture(), Z(() => {
|
|
3265
3265
|
this.setState({
|
|
3266
3266
|
newElement: null,
|
|
3267
3267
|
editingTextElement: null
|
|
3268
3268
|
});
|
|
3269
|
-
}), this.state.activeTool.locked &&
|
|
3269
|
+
}), this.state.activeTool.locked && K(this.interactiveCanvas, this.state), this.focusContainer();
|
|
3270
3270
|
}),
|
|
3271
3271
|
element: e,
|
|
3272
3272
|
drawContainer: this.rootElement,
|
|
@@ -3276,7 +3276,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3276
3276
|
}
|
|
3277
3277
|
#ye() {
|
|
3278
3278
|
this.setState({
|
|
3279
|
-
selectedElementIds:
|
|
3279
|
+
selectedElementIds: L({}, this.state),
|
|
3280
3280
|
selectedGroupIds: {},
|
|
3281
3281
|
editingGroupId: null,
|
|
3282
3282
|
activeEmbeddable: null
|
|
@@ -3284,7 +3284,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3284
3284
|
}
|
|
3285
3285
|
#be(e, t) {
|
|
3286
3286
|
let n = this.#xe(e, t, { includeBoundTextElement: !0 });
|
|
3287
|
-
return n &&
|
|
3287
|
+
return n && I(n) && !n.isDeleted ? n : null;
|
|
3288
3288
|
}
|
|
3289
3289
|
#xe(e, t, n) {
|
|
3290
3290
|
let r = [];
|
|
@@ -3296,46 +3296,46 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3296
3296
|
for (let e = r.length - 1; e > -1; e--) if (this.state.selectedElementIds[r[e].id]) return r[e];
|
|
3297
3297
|
}
|
|
3298
3298
|
let i = r[r.length - 1];
|
|
3299
|
-
return
|
|
3299
|
+
return gn({
|
|
3300
3300
|
point: S(e, t),
|
|
3301
3301
|
element: i,
|
|
3302
3302
|
threshold: this.getElementHitThreshold(i) / 2,
|
|
3303
3303
|
elementsMap: this.scene.getNonDeletedElementsMap(),
|
|
3304
|
-
frameNameBound:
|
|
3304
|
+
frameNameBound: N(i) ? this.frameNameBoundsCache.get(i) : null
|
|
3305
3305
|
}) ? i : r[r.length - 2];
|
|
3306
3306
|
}
|
|
3307
3307
|
return r.length === 1 ? r[0] : null;
|
|
3308
3308
|
}
|
|
3309
3309
|
#Se(e, t, n) {
|
|
3310
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 || !(
|
|
3312
|
-
let r =
|
|
3313
|
-
return r && this.state.frameRendering.enabled && this.state.frameRendering.clip ?
|
|
3311
|
+
return (n?.includeBoundTextElement && n?.includeLockedElements ? this.scene.getNonDeletedElements() : this.scene.getNonDeletedElements().filter((e) => (n?.includeLockedElements || !e.locked) && (n?.includeBoundTextElement || !(I(e) && e.containerId)))).filter((n) => this.#Ce(e, t, n)).filter((n) => {
|
|
3312
|
+
let r = Zt(n, i);
|
|
3313
|
+
return r && this.state.frameRendering.enabled && this.state.frameRendering.clip ? rn({
|
|
3314
3314
|
x: e,
|
|
3315
3315
|
y: t
|
|
3316
3316
|
}, r, i) : !0;
|
|
3317
|
-
}).filter((e) =>
|
|
3317
|
+
}).filter((e) => mt(e) ? (r.push(e), !1) : !0).concat(r);
|
|
3318
3318
|
}
|
|
3319
3319
|
getElementHitThreshold(e) {
|
|
3320
|
-
return Math.max(e.strokeWidth / 2 + .1, .85 * (
|
|
3320
|
+
return Math.max(e.strokeWidth / 2 + .1, .85 * (u / this.state.zoom.value));
|
|
3321
3321
|
}
|
|
3322
3322
|
#Ce(e, t, n, r = !0) {
|
|
3323
|
-
return r && this.state.selectedElementIds[n.id] &&
|
|
3323
|
+
return r && this.state.selectedElementIds[n.id] && wr([n], this.state, this.editorInterface) && mn(S(e, t), n, this.scene.getNonDeletedElementsMap(), this.getElementHitThreshold(n)) || pn(S(e, t), n, this.scene.getNonDeletedElementsMap()) ? !0 : gn({
|
|
3324
3324
|
point: S(e, t),
|
|
3325
3325
|
element: n,
|
|
3326
3326
|
threshold: this.getElementHitThreshold(n),
|
|
3327
3327
|
elementsMap: this.scene.getNonDeletedElementsMap(),
|
|
3328
|
-
frameNameBound:
|
|
3328
|
+
frameNameBound: N(n) ? this.frameNameBoundsCache.get(n) : null
|
|
3329
3329
|
});
|
|
3330
3330
|
}
|
|
3331
3331
|
#we(e, t) {
|
|
3332
3332
|
let n = this.scene.getNonDeletedElements(), r = this.scene.getSelectedElements(this.state);
|
|
3333
|
-
if (r.length === 1) return
|
|
3333
|
+
if (r.length === 1) return xt(r[0], !1) ? r[0] : null;
|
|
3334
3334
|
let i = null;
|
|
3335
3335
|
for (let r = n.length - 1; r >= 0; --r) {
|
|
3336
3336
|
if (n[r].isDeleted) continue;
|
|
3337
|
-
let [a, o, s, c] =
|
|
3338
|
-
if (
|
|
3337
|
+
let [a, o, s, c] = An(n[r], this.scene.getNonDeletedElementsMap());
|
|
3338
|
+
if (ct(n[r]) && gn({
|
|
3339
3339
|
point: S(e, t),
|
|
3340
3340
|
element: n[r],
|
|
3341
3341
|
elementsMap: this.scene.getNonDeletedElementsMap(),
|
|
@@ -3348,7 +3348,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3348
3348
|
break;
|
|
3349
3349
|
}
|
|
3350
3350
|
}
|
|
3351
|
-
return
|
|
3351
|
+
return xt(i, !1) ? i : null;
|
|
3352
3352
|
}
|
|
3353
3353
|
#Te;
|
|
3354
3354
|
#Ee;
|
|
@@ -3367,17 +3367,17 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3367
3367
|
$.pointers.set(e.pointerId, {
|
|
3368
3368
|
x: e.clientX,
|
|
3369
3369
|
y: e.clientY
|
|
3370
|
-
}), $.pointers.size === 2 && ($.lastCenter =
|
|
3370
|
+
}), $.pointers.size === 2 && ($.lastCenter = fa($.pointers), $.initialScale = this.state.zoom.value, $.initialDistance = pa(Array.from($.pointers.values())));
|
|
3371
3371
|
}
|
|
3372
3372
|
#ze(e) {
|
|
3373
|
-
let t = O(e, this.state), n = this.scene.getSelectedElements(this.state), [r, i, a, o] =
|
|
3373
|
+
let t = O(e, this.state), n = this.scene.getSelectedElements(this.state), [r, i, a, o] = kn(n), s = n.findIndex(M) === 0;
|
|
3374
3374
|
return {
|
|
3375
3375
|
origin: t,
|
|
3376
3376
|
withCmdOrCtrl: e[x.CTRL_OR_CMD],
|
|
3377
3377
|
originInGrid: Je(C(t.x, t.y, e[x.CTRL_OR_CMD] || s ? null : this.getEffectiveGridSize())),
|
|
3378
|
-
scrollbars:
|
|
3378
|
+
scrollbars: va(po, e.clientX - this.state.offsetLeft, e.clientY - this.state.offsetTop),
|
|
3379
3379
|
lastCoords: { ...t },
|
|
3380
|
-
originalElements: this.scene.getNonDeletedElements().reduce((e, t) => (e.set(t.id,
|
|
3380
|
+
originalElements: this.scene.getNonDeletedElements().reduce((e, t) => (e.set(t.id, Wn(t)), e), /* @__PURE__ */ new Map()),
|
|
3381
3381
|
resize: {
|
|
3382
3382
|
handleType: !1,
|
|
3383
3383
|
isResizing: !1,
|
|
@@ -3416,10 +3416,10 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3416
3416
|
#Be(e, t) {
|
|
3417
3417
|
if (!(t.scrollbars.isOverEither && !this.state.multiElement)) return !1;
|
|
3418
3418
|
fo = !0, t.lastCoords.x = e.clientX, t.lastCoords.y = e.clientY;
|
|
3419
|
-
let n =
|
|
3419
|
+
let n = ga((e) => {
|
|
3420
3420
|
e.target instanceof HTMLElement && this.#rt(e, t);
|
|
3421
|
-
}), r =
|
|
3422
|
-
vo = null, fo = !1,
|
|
3421
|
+
}), r = J(() => {
|
|
3422
|
+
vo = null, fo = !1, K(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
3423
|
});
|
|
3424
3424
|
return vo = r, window.addEventListener(h.POINTER_MOVE, n), window.addEventListener(h.POINTER_UP, r), !0;
|
|
3425
3425
|
}
|
|
@@ -3430,7 +3430,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3430
3430
|
}
|
|
3431
3431
|
#We(e, t) {
|
|
3432
3432
|
if (t.length < 2) return !1;
|
|
3433
|
-
let n = Math.max(
|
|
3433
|
+
let n = Math.max(u / this.state.zoom.value, 1), [r, i, a, o] = kn(t);
|
|
3434
3434
|
return e.x > r - n && e.x < a + n && e.y > i - n && e.y < o + n;
|
|
3435
3435
|
}
|
|
3436
3436
|
#Ge;
|
|
@@ -3438,7 +3438,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3438
3438
|
#qe;
|
|
3439
3439
|
#Je;
|
|
3440
3440
|
#Ye(e) {
|
|
3441
|
-
return this.state.currentItemRoundness === "round" ? { type:
|
|
3441
|
+
return this.state.currentItemRoundness === "round" ? { type: St(e) ? ne.ADAPTIVE_RADIUS : ne.PROPORTIONAL_RADIUS } : null;
|
|
3442
3442
|
}
|
|
3443
3443
|
#Xe;
|
|
3444
3444
|
#Ze;
|
|
@@ -3447,42 +3447,42 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3447
3447
|
event: e,
|
|
3448
3448
|
app: this,
|
|
3449
3449
|
selectedElements: t
|
|
3450
|
-
}) && (n || !
|
|
3450
|
+
}) && (n || !ya.getReferenceSnapPoints()) && ya.setReferenceSnapPoints(ba(this.scene.getNonDeletedElements(), t, this.state, this.scene.getNonDeletedElementsMap()));
|
|
3451
3451
|
}
|
|
3452
3452
|
#$e(e, t, n = !1) {
|
|
3453
3453
|
Ta({
|
|
3454
3454
|
event: e,
|
|
3455
3455
|
app: this,
|
|
3456
3456
|
selectedElements: t
|
|
3457
|
-
}) && (n || !
|
|
3457
|
+
}) && (n || !ya.getVisibleGaps()) && ya.setVisibleGaps(Sa(this.scene.getNonDeletedElements(), t, this.state, this.scene.getNonDeletedElementsMap()));
|
|
3458
3458
|
}
|
|
3459
3459
|
#et(e) {
|
|
3460
|
-
return
|
|
3460
|
+
return J((t) => {
|
|
3461
3461
|
this.#St(e, t) || this.#bt(e, t);
|
|
3462
3462
|
});
|
|
3463
3463
|
}
|
|
3464
3464
|
#tt(e) {
|
|
3465
|
-
return
|
|
3465
|
+
return J((t) => {
|
|
3466
3466
|
t.key === x.ALT && t.preventDefault(), !this.#St(e, t) && this.#bt(e, t);
|
|
3467
3467
|
});
|
|
3468
3468
|
}
|
|
3469
3469
|
#nt(e) {
|
|
3470
|
-
return
|
|
3470
|
+
return ga((t) => {
|
|
3471
3471
|
if (this.state.openDialog?.name === "elementLinkSelector") return;
|
|
3472
3472
|
let n = O(t, this.state);
|
|
3473
3473
|
if (this.state.activeLockedId && this.setState({ activeLockedId: null }), this.state.selectedLinearElement && this.state.selectedLinearElement.elbowed && this.state.selectedLinearElement.initialState.segmentMidpoint.index) {
|
|
3474
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
3475
|
if (i < 0) {
|
|
3476
|
-
let t =
|
|
3476
|
+
let t = V.getSegmentMidpointHitCoords({
|
|
3477
3477
|
...this.state.selectedLinearElement,
|
|
3478
3478
|
segmentMidPointHoveredCoords: null
|
|
3479
3479
|
}, {
|
|
3480
3480
|
x: e,
|
|
3481
3481
|
y: r
|
|
3482
3482
|
}, this.state, this.scene.getNonDeletedElementsMap());
|
|
3483
|
-
i = t ?
|
|
3483
|
+
i = t ? V.getSegmentMidPointIndex(this.state.selectedLinearElement, this.state, t, this.scene.getNonDeletedElementsMap()) : -1;
|
|
3484
3484
|
}
|
|
3485
|
-
let a =
|
|
3485
|
+
let a = V.moveFixedSegment(this.state.selectedLinearElement, i, e, r, this.scene);
|
|
3486
3486
|
this.setState({ selectedLinearElement: {
|
|
3487
3487
|
...this.state.selectedLinearElement,
|
|
3488
3488
|
isDragging: !0,
|
|
@@ -3492,8 +3492,8 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3492
3492
|
return;
|
|
3493
3493
|
}
|
|
3494
3494
|
let r = this.previousPointerMoveCoords ?? e.origin;
|
|
3495
|
-
if (this.previousPointerMoveCoords = n, e.drag.offset === null && (e.drag.offset = Je(
|
|
3496
|
-
if (
|
|
3495
|
+
if (this.previousPointerMoveCoords = n, e.drag.offset === null && (e.drag.offset = Je(Zn(this.scene.getSelectedElements(this.state), e.origin.x, e.origin.y))), !(t.target instanceof HTMLElement) || this.#rt(t, e)) return;
|
|
3496
|
+
if (A(this.state)) {
|
|
3497
3497
|
this.#je(t, n);
|
|
3498
3498
|
return;
|
|
3499
3499
|
}
|
|
@@ -3504,7 +3504,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3504
3504
|
if (this.state.selectedLinearElement) {
|
|
3505
3505
|
let r = this.state.selectedLinearElement;
|
|
3506
3506
|
if (r.draggedFocusPointBinding) {
|
|
3507
|
-
|
|
3507
|
+
Ln(r, s, n, this.scene, this.state, this.getEffectiveGridSize(), t.altKey), this.setState({ selectedLinearElement: {
|
|
3508
3508
|
...r,
|
|
3509
3509
|
isDragging: !1,
|
|
3510
3510
|
selectedPointsIndices: [],
|
|
@@ -3515,8 +3515,8 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3515
3515
|
} });
|
|
3516
3516
|
return;
|
|
3517
3517
|
}
|
|
3518
|
-
if (
|
|
3519
|
-
let e =
|
|
3518
|
+
if (V.shouldAddMidpoint(this.state.selectedLinearElement, n, this.state, s)) {
|
|
3519
|
+
let e = V.addMidpoint(this.state.selectedLinearElement, n, this, !t[x.CTRL_OR_CMD], this.scene);
|
|
3520
3520
|
if (!e) return;
|
|
3521
3521
|
Z(() => {
|
|
3522
3522
|
this.state.selectedLinearElement && this.setState({ selectedLinearElement: {
|
|
@@ -3529,14 +3529,14 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3529
3529
|
return;
|
|
3530
3530
|
} else if (r.initialState.segmentMidpoint.value !== null && !r.initialState.segmentMidpoint.added) return;
|
|
3531
3531
|
else if (r.initialState.lastClickedPoint > -1) {
|
|
3532
|
-
let i =
|
|
3532
|
+
let i = V.getElement(r.elementId, s);
|
|
3533
3533
|
if (i?.isDeleted) return;
|
|
3534
|
-
if (
|
|
3535
|
-
let e =
|
|
3534
|
+
if (j(i)) {
|
|
3535
|
+
let e = B(S(n.x, n.y), this.scene.getNonDeletedElements(), s);
|
|
3536
3536
|
T("COMPLEX_BINDINGS") && this.#m(i, e);
|
|
3537
3537
|
}
|
|
3538
3538
|
if (t.altKey && !this.state.selectedLinearElement?.initialState?.arrowStartIsInside && T("COMPLEX_BINDINGS") && this.#d(), r.initialState.lastClickedPoint === -1) return;
|
|
3539
|
-
let a =
|
|
3539
|
+
let a = V.handlePointDragging(t, this, n.x, n.y, r);
|
|
3540
3540
|
if (a) {
|
|
3541
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
3542
|
return;
|
|
@@ -3547,7 +3547,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3547
3547
|
if ((c || e.hit.hasHitCommonBoundingBoxOfSelectedElements) && !l && !e.drag.blockDragging) {
|
|
3548
3548
|
let a = this.scene.getSelectedElements(this.state);
|
|
3549
3549
|
if (a.length > 0 && a.every((e) => e.locked)) return;
|
|
3550
|
-
let o = a.find((e) =>
|
|
3550
|
+
let o = a.find((e) => N(e)), c = this.#ke(n), l = c && !o ? c : null;
|
|
3551
3551
|
if (this.state.frameToHighlight !== l && Z(() => {
|
|
3552
3552
|
this.setState({ frameToHighlight: l });
|
|
3553
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;
|
|
@@ -3562,24 +3562,24 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3562
3562
|
}
|
|
3563
3563
|
if (this.state.croppingElementId) {
|
|
3564
3564
|
let t = this.scene.getNonDeletedElementsMap().get(this.state.croppingElementId);
|
|
3565
|
-
if (t &&
|
|
3566
|
-
let e = t.crop, a =
|
|
3565
|
+
if (t && P(t) && t.crop !== null && e.hit.element === t) {
|
|
3566
|
+
let e = t.crop, a = gt(t) && this.imageCache.get(t.fileId)?.image;
|
|
3567
3567
|
if (a && !(a instanceof Promise)) {
|
|
3568
|
-
let o =
|
|
3568
|
+
let o = ot(t), c = Ce(n.x - r.x, n.y - r.y);
|
|
3569
3569
|
c[0] *= a.naturalWidth / o.width, c[1] *= a.naturalHeight / o.height;
|
|
3570
|
-
let [l, u, d, f, p, m] =
|
|
3570
|
+
let [l, u, d, f, p, m] = An(t, s), h = Te(ke(S(l, u), S(p, m), t.angle)), g = Te(ke(S(d, u), S(p, m), t.angle)), ee = Te(ke(S(l, f), S(p, m), t.angle)), te = Ee(De(g, h)), _ = Ee(De(ee, h)), v = Ce(we(c, te), we(c, _)), y = {
|
|
3571
3571
|
...e,
|
|
3572
|
-
x: i(e.x -
|
|
3573
|
-
y: i(e.y -
|
|
3572
|
+
x: i(e.x - v[0] * Math.sign(t.scale[0]), 0, a.naturalWidth - e.width),
|
|
3573
|
+
y: i(e.y - v[1] * Math.sign(t.scale[1]), 0, a.naturalHeight - e.height)
|
|
3574
3574
|
};
|
|
3575
|
-
this.scene.mutateElement(t, { crop:
|
|
3575
|
+
this.scene.mutateElement(t, { crop: y });
|
|
3576
3576
|
return;
|
|
3577
3577
|
}
|
|
3578
3578
|
}
|
|
3579
3579
|
}
|
|
3580
3580
|
this.#$e(t, a), this.#Qe(t, a);
|
|
3581
3581
|
let { snapOffset: u, snapLines: d } = Ea(c, o, this, t, this.scene.getNonDeletedElementsMap());
|
|
3582
|
-
if (this.setState({ snapLines: d }), this.state.editingFrame ||
|
|
3582
|
+
if (this.setState({ snapLines: d }), this.state.editingFrame || Xn(e, a, o, this.scene, u, t[x.CTRL_OR_CMD] ? null : this.getEffectiveGridSize()), this.setState({
|
|
3583
3583
|
selectedElementsAreBeingDragged: !0,
|
|
3584
3584
|
selectionElement: null
|
|
3585
3585
|
}), t.altKey && !e.hit.hasBeenDuplicated) {
|
|
@@ -3590,7 +3590,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3590
3590
|
includeElementsInFrames: !0
|
|
3591
3591
|
});
|
|
3592
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 } =
|
|
3593
|
+
let a = new Map(i.map((e) => [e.id, e])), { duplicatedElements: o, duplicateElementsMap: s, elementsWithDuplicates: c, origIdToDuplicateId: l } = Gn({
|
|
3594
3594
|
type: "in-place",
|
|
3595
3595
|
elements: n,
|
|
3596
3596
|
appState: this.state,
|
|
@@ -3602,18 +3602,18 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3602
3602
|
})
|
|
3603
3603
|
});
|
|
3604
3604
|
o.forEach((t) => {
|
|
3605
|
-
e.originalElements.set(t.id,
|
|
3605
|
+
e.originalElements.set(t.id, Wn(t));
|
|
3606
3606
|
});
|
|
3607
3607
|
let u = c.map((t) => {
|
|
3608
3608
|
if (a.has(t.id)) {
|
|
3609
3609
|
let n = e.originalElements.get(t.id);
|
|
3610
|
-
if (n) return
|
|
3610
|
+
if (n) return z(t, {
|
|
3611
3611
|
x: n.x,
|
|
3612
3612
|
y: n.y
|
|
3613
3613
|
});
|
|
3614
3614
|
}
|
|
3615
3615
|
return t;
|
|
3616
|
-
}), d = this.props.onDuplicate?.(u, n), f =
|
|
3616
|
+
}), d = this.props.onDuplicate?.(u, n), f = Dn(d || u, Ae(o));
|
|
3617
3617
|
Z(() => {
|
|
3618
3618
|
if (e.hit.element) {
|
|
3619
3619
|
let t = l.get(e.hit.element.id), n = t && s.get(t);
|
|
@@ -3622,8 +3622,8 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3622
3622
|
e.hit.allHitElements = e.hit.allHitElements.reduce((e, t) => {
|
|
3623
3623
|
let n = l.get(t.id), r = n && s.get(n);
|
|
3624
3624
|
return r && e.push(r), e;
|
|
3625
|
-
}, []), e.drag.origin = O(t, this.state), this.setState((e) => ({ ...
|
|
3626
|
-
|
|
3625
|
+
}, []), e.drag.origin = O(t, this.state), this.setState((e) => ({ ...Et(o, this.scene.getNonDeletedElements(), e) })), this.scene.replaceAllElements(f), i.forEach((e) => {
|
|
3626
|
+
lt(e) && e.boundElements?.some?.((e) => e.type === "arrow") && Tn(e, this.scene);
|
|
3627
3627
|
}), this.#$e(t, i, !0), this.#Qe(t, i, !0);
|
|
3628
3628
|
});
|
|
3629
3629
|
}
|
|
@@ -3655,12 +3655,12 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3655
3655
|
isDragging: !1
|
|
3656
3656
|
}), this.setState({ newElement: r });
|
|
3657
3657
|
}
|
|
3658
|
-
} else if (
|
|
3658
|
+
} else if (F(r) && !r.isDeleted) {
|
|
3659
3659
|
e.drag.hasOccurred = !0;
|
|
3660
3660
|
let n = r.points;
|
|
3661
3661
|
E(n.length > 1, "Do not create linear elements with less than 2 points");
|
|
3662
3662
|
let i = this.state.selectedLinearElement;
|
|
3663
|
-
i ||= (i = new
|
|
3663
|
+
i ||= (i = new V(r, this.scene.getNonDeletedElementsMap()), {
|
|
3664
3664
|
...i,
|
|
3665
3665
|
selectedPointsIndices: [1],
|
|
3666
3666
|
initialState: {
|
|
@@ -3669,21 +3669,21 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3669
3669
|
}
|
|
3670
3670
|
}), this.setState({
|
|
3671
3671
|
newElement: r,
|
|
3672
|
-
...
|
|
3672
|
+
...V.handlePointDragging(t, this, a, o, i)
|
|
3673
3673
|
});
|
|
3674
3674
|
} else e.lastCoords.x = n.x, e.lastCoords.y = n.y, this.#bt(e, t, !1);
|
|
3675
3675
|
}
|
|
3676
3676
|
if (this.state.activeTool.type === "selection") {
|
|
3677
3677
|
e.boxSelection.hasOccurred = !0;
|
|
3678
3678
|
let n = this.scene.getNonDeletedElements();
|
|
3679
|
-
if (this.state.selectedLinearElement?.isEditing)
|
|
3679
|
+
if (this.state.selectedLinearElement?.isEditing) V.handleBoxSelection(t, this.state, this.setState.bind(this), this.scene.getNonDeletedElementsMap());
|
|
3680
3680
|
else {
|
|
3681
3681
|
let r = !0;
|
|
3682
|
-
!t.shiftKey &&
|
|
3682
|
+
!t.shiftKey && Dt(n, this.state) && (e.withCmdOrCtrl && e.hit.element ? this.setState((t) => R({
|
|
3683
3683
|
...t,
|
|
3684
3684
|
selectedElementIds: { [e.hit.element.id]: !0 }
|
|
3685
3685
|
}, this.scene.getNonDeletedElements(), t, this)) : r = !1);
|
|
3686
|
-
let i = this.state.selectionElement ?
|
|
3686
|
+
let i = this.state.selectionElement ? wt(n, this.state.selectionElement, this.scene.getNonDeletedElementsMap(), !1) : [];
|
|
3687
3687
|
this.setState((t) => {
|
|
3688
3688
|
let n = {
|
|
3689
3689
|
...r && t.selectedElementIds,
|
|
@@ -3694,11 +3694,11 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3694
3694
|
selectedGroupIds: {},
|
|
3695
3695
|
editingGroupId: null
|
|
3696
3696
|
}, {
|
|
3697
|
-
...
|
|
3697
|
+
...R({
|
|
3698
3698
|
editingGroupId: t.editingGroupId,
|
|
3699
3699
|
selectedElementIds: n
|
|
3700
3700
|
}, this.scene.getNonDeletedElements(), t, this),
|
|
3701
|
-
selectedLinearElement: i.length === 1 &&
|
|
3701
|
+
selectedLinearElement: i.length === 1 && F(i[0]) ? new V(i[0], this.scene.getNonDeletedElementsMap()) : null
|
|
3702
3702
|
};
|
|
3703
3703
|
});
|
|
3704
3704
|
}
|
|
@@ -3717,10 +3717,10 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3717
3717
|
return !1;
|
|
3718
3718
|
}
|
|
3719
3719
|
#it(e) {
|
|
3720
|
-
return
|
|
3720
|
+
return J((t) => {
|
|
3721
3721
|
let n = this.scene.getNonDeletedElementsMap();
|
|
3722
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:
|
|
3723
|
+
let { newElement: r, resizingElement: i, croppingElementId: a, multiElement: o, activeTool: s, isResizing: c, isRotating: u, isCropping: d } = this.state;
|
|
3724
3724
|
this.setState((e) => ({
|
|
3725
3725
|
isResizing: !1,
|
|
3726
3726
|
isRotating: !1,
|
|
@@ -3732,7 +3732,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3732
3732
|
cursorButton: "up",
|
|
3733
3733
|
snapLines: Xe(e.snapLines, []),
|
|
3734
3734
|
originSnapOffset: null
|
|
3735
|
-
})), this.lassoTrail.endPath(), this.previousPointerMoveCoords = null,
|
|
3735
|
+
})), this.lassoTrail.endPath(), this.previousPointerMoveCoords = null, ya.setReferenceSnapPoints(null), ya.setVisibleGaps(null), this.#Et(t.clientX, t.clientY, "up");
|
|
3736
3736
|
let f = e.hit.allHitElements, p = O({
|
|
3737
3737
|
clientX: t.clientX,
|
|
3738
3738
|
clientY: t.clientY
|
|
@@ -3746,14 +3746,14 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3746
3746
|
bindMode: "orbit"
|
|
3747
3747
|
}), e.drag.hasOccurred && e.hit?.element?.id) {
|
|
3748
3748
|
let t = n.get(e.hit.element.id);
|
|
3749
|
-
|
|
3749
|
+
lt(t) && t.boundElements?.filter?.((e) => e.type === "arrow").map((e) => n.get(e.id)).filter((e) => M(e)).forEach((e) => {
|
|
3750
3750
|
e && this.scene.mutateElement(e, {});
|
|
3751
3751
|
});
|
|
3752
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(
|
|
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(q);
|
|
3754
3754
|
else {
|
|
3755
|
-
let e =
|
|
3756
|
-
this.actionManager.executeAction(
|
|
3755
|
+
let e = V.handlePointerUp(t, this.state.selectedLinearElement, this.state, this.scene);
|
|
3756
|
+
this.actionManager.executeAction(q, "ui", {
|
|
3757
3757
|
event: t,
|
|
3758
3758
|
sceneCoords: p
|
|
3759
3759
|
}), e !== this.state.selectedLinearElement && this.setState({
|
|
@@ -3763,19 +3763,19 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3763
3763
|
}
|
|
3764
3764
|
else if (this.state.selectedLinearElement) {
|
|
3765
3765
|
if (this.state.selectedLinearElement.elbowed) {
|
|
3766
|
-
let e =
|
|
3766
|
+
let e = V.getElement(this.state.selectedLinearElement.elementId, this.scene.getNonDeletedElementsMap());
|
|
3767
3767
|
e && this.scene.mutateElement(e, {});
|
|
3768
3768
|
}
|
|
3769
|
-
if (this.state.selectedLinearElement.draggedFocusPointBinding ? (
|
|
3769
|
+
if (this.state.selectedLinearElement.draggedFocusPointBinding ? (Bn(this.state.selectedLinearElement, this.scene), this.setState({ selectedLinearElement: {
|
|
3770
3770
|
...this.state.selectedLinearElement,
|
|
3771
3771
|
draggedFocusPointBinding: null
|
|
3772
3772
|
} })) : e.hit?.element?.id === this.state.selectedLinearElement.elementId ? this.state.selectedLinearElement.isDragging && (this.setState({ selectedLinearElement: {
|
|
3773
3773
|
...this.state.selectedLinearElement,
|
|
3774
3774
|
isDragging: !1
|
|
3775
|
-
} }), this.actionManager.executeAction(
|
|
3775
|
+
} }), this.actionManager.executeAction(q, "ui", {
|
|
3776
3776
|
event: t,
|
|
3777
3777
|
sceneCoords: p
|
|
3778
|
-
})) : this.scene.getSelectedElements(this.state).length > 1 && this.setState({ selectedLinearElement: null }), this.state.newElement && this.state.multiElement &&
|
|
3778
|
+
})) : this.scene.getSelectedElements(this.state).length > 1 && this.setState({ selectedLinearElement: null }), this.state.newElement && this.state.multiElement && F(this.state.newElement) && this.state.selectedLinearElement) {
|
|
3779
3779
|
let { multiElement: e } = this.state;
|
|
3780
3780
|
this.setState({ selectedLinearElement: {
|
|
3781
3781
|
...this.state.selectedLinearElement,
|
|
@@ -3790,10 +3790,10 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3790
3790
|
this.scene.mutateElement(r, {
|
|
3791
3791
|
points: [...n, S(i, a)],
|
|
3792
3792
|
pressures: o
|
|
3793
|
-
}), this.actionManager.executeAction(
|
|
3793
|
+
}), this.actionManager.executeAction(q);
|
|
3794
3794
|
return;
|
|
3795
3795
|
}
|
|
3796
|
-
if (
|
|
3796
|
+
if (F(r)) {
|
|
3797
3797
|
r.points.length > 1 && r.points[1][0] !== 0 && r.points[1][1] !== 0 && this.#r.scheduleCapture();
|
|
3798
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
3799
|
if ((!e.drag.hasOccurred || i < 20) && r && !o) if (this.editorInterface.isTouchScreen) {
|
|
@@ -3804,7 +3804,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3804
3804
|
}, {
|
|
3805
3805
|
informMutation: !1,
|
|
3806
3806
|
isDragging: !1
|
|
3807
|
-
}), this.actionManager.executeAction(
|
|
3807
|
+
}), this.actionManager.executeAction(q);
|
|
3808
3808
|
} else {
|
|
3809
3809
|
let e = n.x - r.x, t = n.y - r.y;
|
|
3810
3810
|
this.scene.mutateElement(r, { points: [r.points[0], S(e, t)] }, {
|
|
@@ -3815,43 +3815,43 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3815
3815
|
newElement: r
|
|
3816
3816
|
});
|
|
3817
3817
|
}
|
|
3818
|
-
else e.drag.hasOccurred && !o && (
|
|
3818
|
+
else e.drag.hasOccurred && !o && (F(r) && this.actionManager.executeAction(q, "ui", {
|
|
3819
3819
|
event: t,
|
|
3820
3820
|
sceneCoords: p
|
|
3821
3821
|
}), this.setState({
|
|
3822
3822
|
suggestedBinding: null,
|
|
3823
3823
|
startBoundElement: null
|
|
3824
|
-
}), s.locked ? this.setState((e) => ({ newElement: null })) : (
|
|
3824
|
+
}), s.locked ? this.setState((e) => ({ newElement: null })) : (W(this.interactiveCanvas), this.setState((e) => ({
|
|
3825
3825
|
newElement: null,
|
|
3826
3826
|
activeTool: D(this.state, { type: this.state.preferredSelectionTool.type }),
|
|
3827
|
-
selectedElementIds:
|
|
3827
|
+
selectedElementIds: L({
|
|
3828
3828
|
...e.selectedElementIds,
|
|
3829
3829
|
[r.id]: !0
|
|
3830
3830
|
}, e),
|
|
3831
|
-
selectedLinearElement: new
|
|
3831
|
+
selectedLinearElement: new V(r, this.scene.getNonDeletedElementsMap())
|
|
3832
3832
|
}))), this.scene.triggerUpdate());
|
|
3833
3833
|
return;
|
|
3834
3834
|
}
|
|
3835
|
-
if (
|
|
3836
|
-
let e =
|
|
3835
|
+
if (I(r)) {
|
|
3836
|
+
let e = jt(Ie({
|
|
3837
3837
|
fontSize: r.fontSize,
|
|
3838
3838
|
fontFamily: r.fontFamily
|
|
3839
3839
|
}), r.lineHeight);
|
|
3840
3840
|
r.width < e && this.scene.mutateElement(r, { autoResize: !0 }), this.#pe(), this.#ve(r, { isExistingElement: !0 });
|
|
3841
3841
|
}
|
|
3842
|
-
if (s.type !== "selection" && r &&
|
|
3842
|
+
if (s.type !== "selection" && r && In(r)) {
|
|
3843
3843
|
this.updateScene({
|
|
3844
3844
|
elements: this.scene.getElementsIncludingDeleted().filter((e) => e.id !== r.id),
|
|
3845
3845
|
appState: { newElement: null },
|
|
3846
|
-
captureUpdate:
|
|
3846
|
+
captureUpdate: H.NEVER
|
|
3847
3847
|
});
|
|
3848
3848
|
return;
|
|
3849
3849
|
}
|
|
3850
|
-
if (
|
|
3851
|
-
let e =
|
|
3852
|
-
this.scene.replaceAllElements(
|
|
3850
|
+
if (N(r)) {
|
|
3851
|
+
let e = Qt(this.scene.getElementsIncludingDeleted(), r, this.scene.getNonDeletedElementsMap());
|
|
3852
|
+
this.scene.replaceAllElements(Jt(this.scene.getElementsMapIncludingDeleted(), e, r, this.state));
|
|
3853
3853
|
}
|
|
3854
|
-
if (r && (this.scene.mutateElement(r,
|
|
3854
|
+
if (r && (this.scene.mutateElement(r, Nn(r), {
|
|
3855
3855
|
informMutation: !1,
|
|
3856
3856
|
isDragging: !1
|
|
3857
3857
|
}), this.scene.triggerUpdate()), e.drag.hasOccurred) {
|
|
@@ -3859,8 +3859,8 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3859
3859
|
if (this.state.selectedLinearElement && this.state.selectedLinearElement.isDragging) {
|
|
3860
3860
|
let e = this.scene.getElement(this.state.selectedLinearElement.elementId);
|
|
3861
3861
|
if (e?.frameId) {
|
|
3862
|
-
let t =
|
|
3863
|
-
t && e && (
|
|
3862
|
+
let t = Zt(e, n);
|
|
3863
|
+
t && e && (Yt(e, t, this.scene.getNonDeletedElementsMap()) || (this.scene.mutateElement(e, { groupIds: [] }), on([e], this.scene.getNonDeletedElementsMap()), this.scene.triggerUpdate()));
|
|
3864
3864
|
}
|
|
3865
3865
|
} else {
|
|
3866
3866
|
let t = this.#ke(e), n = this.scene.getSelectedElements(this.state), r = this.scene.getElementsMapIncludingDeleted(), i = (e) => {
|
|
@@ -3873,7 +3873,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3873
3873
|
});
|
|
3874
3874
|
}
|
|
3875
3875
|
r.forEach((e) => {
|
|
3876
|
-
e.groupIds.length &&
|
|
3876
|
+
e.groupIds.length && Ht(r, e.groupIds[e.groupIds.length - 1]).length < 2 && this.scene.mutateElement(e, { groupIds: [] }, {
|
|
3877
3877
|
informMutation: !1,
|
|
3878
3878
|
isDragging: !1
|
|
3879
3879
|
});
|
|
@@ -3881,37 +3881,37 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3881
3881
|
}
|
|
3882
3882
|
};
|
|
3883
3883
|
if (t && !this.state.selectedElementIds[t.id]) {
|
|
3884
|
-
let e = n.filter((e) => e.frameId !== t.id &&
|
|
3885
|
-
this.state.editingGroupId && i(e), r =
|
|
3886
|
-
} else t || this.state.editingGroupId && i(n.filter((e) => e.frameId && !
|
|
3887
|
-
r =
|
|
3884
|
+
let e = n.filter((e) => e.frameId !== t.id && an(e, r, this.state));
|
|
3885
|
+
this.state.editingGroupId && i(e), r = Jt(r, e, t, this.state);
|
|
3886
|
+
} else t || this.state.editingGroupId && i(n.filter((e) => e.frameId && !an(e, r, this.state)));
|
|
3887
|
+
r = cn(r, this.state, this), this.scene.replaceAllElements(r);
|
|
3888
3888
|
}
|
|
3889
3889
|
}
|
|
3890
|
-
if (i && this.#r.scheduleCapture(), i &&
|
|
3890
|
+
if (i && this.#r.scheduleCapture(), i && In(i) && this.updateScene({
|
|
3891
3891
|
elements: this.scene.getElementsIncludingDeleted().filter((e) => e.id !== i.id),
|
|
3892
|
-
captureUpdate:
|
|
3892
|
+
captureUpdate: H.NEVER
|
|
3893
3893
|
}), e.resize.isResizing) {
|
|
3894
|
-
let e =
|
|
3895
|
-
for (let r of t) e =
|
|
3894
|
+
let e = cn(this.scene.getElementsIncludingDeleted(), this.state, this), t = this.scene.getSelectedElements(this.state).filter((e) => N(e));
|
|
3895
|
+
for (let r of t) e = sn(e, $t(this.scene.getElementsIncludingDeleted(), r, this.state, n), r, this);
|
|
3896
3896
|
this.scene.replaceAllElements(e);
|
|
3897
3897
|
}
|
|
3898
3898
|
let m = e.hit.element;
|
|
3899
|
-
this.state.selectedLinearElement?.elementId !== m?.id &&
|
|
3900
|
-
let g = this.lastPointerDownEvent,
|
|
3901
|
-
if (
|
|
3902
|
-
if (this.eraserTrail.endPath(), Oe(S(g.clientX, g.clientY), S(
|
|
3899
|
+
this.state.selectedLinearElement?.elementId !== m?.id && F(m) && this.scene.getSelectedElements(this.state).length === 1 && this.setState({ selectedLinearElement: new V(m, this.scene.getNonDeletedElementsMap()) }), (!a || a && (!m && !d || m && m.id !== a)) && this.#De();
|
|
3900
|
+
let g = this.lastPointerDownEvent, ee = this.lastPointerUpEvent || this.lastPointerMoveEvent;
|
|
3901
|
+
if (A(this.state) && g && ee) {
|
|
3902
|
+
if (this.eraserTrail.endPath(), Oe(S(g.clientX, g.clientY), S(ee.clientX, ee.clientY)) === 0) {
|
|
3903
3903
|
let e = O({
|
|
3904
|
-
clientX:
|
|
3905
|
-
clientY:
|
|
3904
|
+
clientX: ee.clientX,
|
|
3905
|
+
clientY: ee.clientY
|
|
3906
3906
|
}, this.state);
|
|
3907
3907
|
this.#Se(e.x, e.y).forEach((e) => this.#l.add(e.id));
|
|
3908
3908
|
}
|
|
3909
3909
|
this.#ot();
|
|
3910
3910
|
return;
|
|
3911
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] ?
|
|
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] ? Kt(this.state, m) ? this.setState((e) => {
|
|
3913
3913
|
let t = { ...e.selectedElementIds };
|
|
3914
|
-
for (let e of m.groupIds.flatMap((e) =>
|
|
3914
|
+
for (let e of m.groupIds.flatMap((e) => Ht(this.scene.getNonDeletedElements(), e))) delete t[e.id];
|
|
3915
3915
|
return {
|
|
3916
3916
|
selectedGroupIds: {
|
|
3917
3917
|
...e.selectedElementIds,
|
|
@@ -3920,69 +3920,69 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3920
3920
|
...t
|
|
3921
3921
|
}), {})
|
|
3922
3922
|
},
|
|
3923
|
-
selectedElementIds:
|
|
3923
|
+
selectedElementIds: L(t, e)
|
|
3924
3924
|
};
|
|
3925
3925
|
}) : this.state.selectedLinearElement?.isDragging || this.setState((e) => {
|
|
3926
3926
|
let t = { ...e.selectedElementIds };
|
|
3927
3927
|
delete t[m.id];
|
|
3928
|
-
let n =
|
|
3928
|
+
let n = Tt(this.scene.getNonDeletedElements(), { selectedElementIds: t });
|
|
3929
3929
|
return {
|
|
3930
|
-
...
|
|
3930
|
+
...R({
|
|
3931
3931
|
editingGroupId: e.editingGroupId,
|
|
3932
3932
|
selectedElementIds: t
|
|
3933
3933
|
}, this.scene.getNonDeletedElements(), e, this),
|
|
3934
|
-
selectedLinearElement: n.length === 1 &&
|
|
3934
|
+
selectedLinearElement: n.length === 1 && F(n[0]) ? new V(n[0], this.scene.getNonDeletedElementsMap()) : e.selectedLinearElement
|
|
3935
3935
|
};
|
|
3936
3936
|
}) : m.frameId && this.state.selectedElementIds[m.frameId] ? this.setState((e) => {
|
|
3937
3937
|
let t = {
|
|
3938
3938
|
...e.selectedElementIds,
|
|
3939
3939
|
[m.id]: !0
|
|
3940
3940
|
};
|
|
3941
|
-
return delete t[m.frameId], (this.scene.getElement(m.frameId)?.groupIds ?? []).flatMap((e) =>
|
|
3941
|
+
return delete t[m.frameId], (this.scene.getElement(m.frameId)?.groupIds ?? []).flatMap((e) => Ht(this.scene.getNonDeletedElements(), e)).forEach((e) => {
|
|
3942
3942
|
delete t[e.id];
|
|
3943
|
-
}), { ...
|
|
3943
|
+
}), { ...R({
|
|
3944
3944
|
editingGroupId: e.editingGroupId,
|
|
3945
3945
|
selectedElementIds: t
|
|
3946
3946
|
}, this.scene.getNonDeletedElements(), e, this) };
|
|
3947
|
-
}) : this.setState((e) => ({ selectedElementIds:
|
|
3947
|
+
}) : this.setState((e) => ({ selectedElementIds: L({
|
|
3948
3948
|
...e.selectedElementIds,
|
|
3949
3949
|
[m.id]: !0
|
|
3950
3950
|
}, e) })) : this.setState((e) => ({
|
|
3951
|
-
...
|
|
3951
|
+
...R({
|
|
3952
3952
|
editingGroupId: e.editingGroupId,
|
|
3953
3953
|
selectedElementIds: { [m.id]: !0 }
|
|
3954
3954
|
}, this.scene.getNonDeletedElements(), e, this),
|
|
3955
|
-
selectedLinearElement:
|
|
3956
|
-
}))), this.state.activeTool.type !== "lasso" && !(m &&
|
|
3955
|
+
selectedLinearElement: F(m) && e.selectedLinearElement?.elementId !== m.id ? new V(m, this.scene.getNonDeletedElementsMap()) : e.selectedLinearElement
|
|
3956
|
+
}))), this.state.activeTool.type !== "lasso" && !(m && M(m)) && !e.drag.hasOccurred && !this.state.isResizing && (m && hn({
|
|
3957
3957
|
point: S(e.origin.x, e.origin.y),
|
|
3958
3958
|
element: m,
|
|
3959
3959
|
elementsMap: n,
|
|
3960
3960
|
threshold: this.getElementHitThreshold(m),
|
|
3961
|
-
frameNameBound:
|
|
3961
|
+
frameNameBound: N(m) ? this.frameNameBoundsCache.get(m) : null
|
|
3962
3962
|
}, n) || !m && e.hit.hasHitCommonBoundingBoxOfSelectedElements)) {
|
|
3963
|
-
this.state.selectedLinearElement?.isEditing ? this.actionManager.executeAction(
|
|
3964
|
-
selectedElementIds:
|
|
3963
|
+
this.state.selectedLinearElement?.isEditing ? this.actionManager.executeAction(Xi) : this.setState({
|
|
3964
|
+
selectedElementIds: L({}, this.state),
|
|
3965
3965
|
selectedGroupIds: {},
|
|
3966
3966
|
editingGroupId: null,
|
|
3967
3967
|
activeEmbeddable: null
|
|
3968
|
-
}),
|
|
3968
|
+
}), G(this.interactiveCanvas, l.AUTO);
|
|
3969
3969
|
return;
|
|
3970
3970
|
}
|
|
3971
|
-
if (!s.locked && s.type !== "freedraw" && r && this.setState((e) => ({ selectedElementIds:
|
|
3971
|
+
if (!s.locked && s.type !== "freedraw" && r && this.setState((e) => ({ selectedElementIds: L({
|
|
3972
3972
|
...e.selectedElementIds,
|
|
3973
3973
|
[r.id]: !0
|
|
3974
|
-
}, e) })), (s.type !== "selection" ||
|
|
3974
|
+
}, e) })), (s.type !== "selection" || Dt(this.scene.getNonDeletedElements(), this.state) || !Ve(this.state.previousSelectedElementIds, this.state.selectedElementIds)) && this.#r.scheduleCapture(), (e.drag.hasOccurred && !this.state.selectedLinearElement || c || u || d) && yn(this.scene.getSelectedElements(this.state).filter(ct), this.scene, this.state), s.type === "laser") {
|
|
3975
3975
|
this.laserTrails.endPath();
|
|
3976
3976
|
return;
|
|
3977
3977
|
}
|
|
3978
|
-
!s.locked && s.type !== "freedraw" && (s.type !== "lasso" || s.type === "lasso" && s.fromSelection) ? (
|
|
3978
|
+
!s.locked && s.type !== "freedraw" && (s.type !== "lasso" || s.type === "lasso" && s.fromSelection) ? (W(this.interactiveCanvas), this.setState({
|
|
3979
3979
|
newElement: null,
|
|
3980
3980
|
suggestedBinding: null,
|
|
3981
3981
|
activeTool: D(this.state, { type: this.state.preferredSelectionTool.type })
|
|
3982
3982
|
})) : this.setState({
|
|
3983
3983
|
newElement: null,
|
|
3984
3984
|
suggestedBinding: null
|
|
3985
|
-
}), m && this.lastPointerUpEvent && this.lastPointerDownEvent && this.lastPointerUpEvent.timeStamp - this.lastPointerDownEvent.timeStamp < 300 && $.pointers.size <= 1 &&
|
|
3985
|
+
}), m && this.lastPointerUpEvent && this.lastPointerDownEvent && this.lastPointerUpEvent.timeStamp - this.lastPointerDownEvent.timeStamp < 300 && $.pointers.size <= 1 && ht(m) && this.#v(m, this.lastPointerUpEvent, e.origin.x, e.origin.y) && this.#_(m);
|
|
3986
3986
|
});
|
|
3987
3987
|
}
|
|
3988
3988
|
#at;
|
|
@@ -3997,12 +3997,12 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
3997
3997
|
#mt;
|
|
3998
3998
|
#ht(e) {
|
|
3999
3999
|
this.setState((t) => ({
|
|
4000
|
-
selectedElementIds:
|
|
4000
|
+
selectedElementIds: L({}, t),
|
|
4001
4001
|
activeEmbeddable: null,
|
|
4002
4002
|
selectedGroupIds: {},
|
|
4003
|
-
editingGroupId: t.editingGroupId && e != null &&
|
|
4003
|
+
editingGroupId: t.editingGroupId && e != null && Gt(e, t.editingGroupId) ? t.editingGroupId : null
|
|
4004
4004
|
})), this.setState({
|
|
4005
|
-
selectedElementIds:
|
|
4005
|
+
selectedElementIds: L({}, this.state),
|
|
4006
4006
|
activeEmbeddable: null,
|
|
4007
4007
|
previousSelectedElementIds: this.state.selectedElementIds,
|
|
4008
4008
|
selectedLinearElement: null
|
|
@@ -4019,7 +4019,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
4019
4019
|
#wt;
|
|
4020
4020
|
#Tt(e, t, n, r) {
|
|
4021
4021
|
if (r) {
|
|
4022
|
-
let i = r.x + r.width / 2, a = r.y + r.height / 2, o =
|
|
4022
|
+
let i = r.x + r.width / 2, a = r.y + r.height / 2, o = Lt(r, n, this.scene.getNonDeletedElementsMap());
|
|
4023
4023
|
if (o && (i = o.x, a = o.y), Math.hypot(e - i, t - a) < 30) {
|
|
4024
4024
|
let { x: e, y: t } = qe({
|
|
4025
4025
|
sceneX: i,
|
|
@@ -4051,7 +4051,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
4051
4051
|
};
|
|
4052
4052
|
}
|
|
4053
4053
|
async #At() {
|
|
4054
|
-
await
|
|
4054
|
+
await Wr(Ur.find((e) => e.code === this.props.langCode) || Vr), this.setAppState({});
|
|
4055
4055
|
}
|
|
4056
4056
|
};
|
|
4057
4057
|
(He() || Re()) && (window.h = window.h || {}, Object.defineProperties(window.h, {
|
|
@@ -4061,7 +4061,7 @@ var oo = !1, so = 0, co = null, lo = !1, uo = !1, fo = !1, po = {
|
|
|
4061
4061
|
return this.app?.scene?.getElementsIncludingDeleted?.();
|
|
4062
4062
|
},
|
|
4063
4063
|
set(e) {
|
|
4064
|
-
return this.app?.scene?.replaceAllElements?.(
|
|
4064
|
+
return this.app?.scene?.replaceAllElements?.(En(e));
|
|
4065
4065
|
}
|
|
4066
4066
|
},
|
|
4067
4067
|
scene: {
|