@excalidraw/common 0.18.0-9ba0f5d → 0.18.0-9fbeaed
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/dist/dev/index.js +550 -123
- package/dist/dev/index.js.map +4 -4
- package/dist/prod/index.js +3 -3
- package/dist/types/common/debug.d.ts +21 -0
- package/dist/types/common/src/appEventBus.d.ts +27 -0
- package/dist/types/common/src/colors.d.ts +36 -14
- package/dist/types/common/src/constants.d.ts +72 -7
- package/dist/types/common/src/index.d.ts +3 -0
- package/dist/types/common/src/keys.d.ts +6 -0
- package/dist/types/common/src/points.d.ts +1 -1
- package/dist/types/common/src/random.d.ts +7 -0
- package/dist/types/common/src/utils.d.ts +16 -50
- package/dist/types/common/src/versionedSnapshotStore.d.ts +17 -0
- package/dist/types/element/src/Scene.d.ts +9 -5
- package/dist/types/element/src/align.d.ts +5 -2
- package/dist/types/element/src/arrowEndpointText.d.ts +49 -0
- package/dist/types/element/src/arrowheads.d.ts +3 -0
- package/dist/types/element/src/arrows/focus.d.ts +30 -0
- package/dist/types/element/src/arrows/helpers.d.ts +5 -0
- package/dist/types/element/src/binding.d.ts +99 -17
- package/dist/types/element/src/bounds.d.ts +32 -9
- package/dist/types/element/src/bucketFill.d.ts +110 -0
- package/dist/types/element/src/collision.d.ts +20 -3
- package/dist/types/element/src/comparisons.d.ts +8 -5
- package/dist/types/element/src/convertToShape.d.ts +23 -0
- package/dist/types/element/src/cropElement.d.ts +36 -4
- package/dist/types/element/src/delta.d.ts +30 -2
- package/dist/types/element/src/distribute.d.ts +6 -2
- package/dist/types/element/src/dragElements.d.ts +34 -2
- package/dist/types/element/src/duplicate.d.ts +64 -3
- package/dist/types/element/src/elbowArrow.d.ts +7 -0
- package/dist/types/element/src/embeddable.d.ts +3 -2
- package/dist/types/element/src/flowchart.d.ts +9 -11
- package/dist/types/element/src/fractionalIndex.d.ts +2 -2
- package/dist/types/element/src/frame.d.ts +30 -11
- package/dist/types/element/src/groups.d.ts +10 -15
- package/dist/types/element/src/image.d.ts +5 -2
- package/dist/types/element/src/index.d.ts +10 -1
- package/dist/types/element/src/linearElementEditor.d.ts +36 -11
- package/dist/types/element/src/listMarker.d.ts +39 -0
- package/dist/types/element/src/mutateElement.d.ts +3 -1
- package/dist/types/element/src/newElement.d.ts +55 -3
- package/dist/types/element/src/renderElement.d.ts +31 -7
- package/dist/types/element/src/renderEnvironment.d.ts +66 -0
- package/dist/types/element/src/resizeElements.d.ts +14 -4
- package/dist/types/element/src/selection.d.ts +11 -13
- package/dist/types/element/src/shape.d.ts +30 -2
- package/dist/types/element/src/sizeHelpers.d.ts +6 -0
- package/dist/types/element/src/sortElements.d.ts +10 -0
- package/dist/types/element/src/stickyNote.d.ts +191 -0
- package/dist/types/element/src/textElement.d.ts +23 -11
- package/dist/types/element/src/textMeasurements.d.ts +15 -11
- package/dist/types/element/src/textWrapping.d.ts +28 -1
- package/dist/types/element/src/transform.d.ts +31 -8
- package/dist/types/element/src/typeChecks.d.ts +29 -27
- package/dist/types/element/src/types.d.ts +48 -9
- package/dist/types/element/src/utils.d.ts +19 -6
- package/dist/types/element/src/zindex.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +128 -53
- package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +87 -213
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +420 -1076
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +86 -36
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +43 -18
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +4 -513
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +183 -0
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -3
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +39 -18
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +87 -37
- package/dist/types/excalidraw/actions/actionExport.d.ts +175 -399
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionFrame.d.ts +157 -684
- package/dist/types/excalidraw/actions/actionGroup.d.ts +102 -52
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +100 -21
- package/dist/types/excalidraw/actions/actionLink.d.ts +44 -19
- package/dist/types/excalidraw/actions/actionMenu.d.ts +39 -18
- package/dist/types/excalidraw/actions/actionProperties.d.ts +122 -56
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +48 -23
- package/dist/types/excalidraw/actions/actionStyles.d.ts +44 -18
- package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +452 -6
- package/dist/types/excalidraw/actions/{actionEmbeddable.d.ts → actionToggleArrowBinding.d.ts} +58 -32
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +47 -23
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +196 -0
- package/dist/types/excalidraw/actions/actionToggleMinimap.d.ts +201 -0
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +44 -19
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +43 -23
- package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleShowHints.d.ts +198 -0
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +44 -19
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +45 -20
- package/dist/types/excalidraw/actions/actionToggleWrap.d.ts +12 -0
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +44 -19
- package/dist/types/excalidraw/actions/colorTargets.d.ts +39 -0
- package/dist/types/excalidraw/actions/index.d.ts +7 -2
- package/dist/types/excalidraw/actions/manager.d.ts +1 -0
- package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
- package/dist/types/excalidraw/actions/types.d.ts +8 -4
- package/dist/types/excalidraw/{animated-trail.d.ts → animatedTrail.d.ts} +4 -3
- package/dist/types/excalidraw/appState.d.ts +56 -29
- package/dist/types/excalidraw/charts/charts.bar.d.ts +3 -0
- package/dist/types/excalidraw/charts/charts.constants.d.ts +48 -0
- package/dist/types/excalidraw/charts/charts.helpers.d.ts +33 -0
- package/dist/types/excalidraw/charts/charts.line.d.ts +3 -0
- package/dist/types/excalidraw/charts/charts.parse.d.ts +10 -0
- package/dist/types/excalidraw/charts/charts.radar.d.ts +3 -0
- package/dist/types/excalidraw/charts/charts.types.d.ts +18 -0
- package/dist/types/excalidraw/charts/index.d.ts +8 -0
- package/dist/types/excalidraw/clipboard.d.ts +8 -9
- package/dist/types/excalidraw/components/Actions.d.ts +26 -13
- package/dist/types/excalidraw/components/ActiveConfirmDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/App.arrowText.d.ts +70 -0
- package/dist/types/excalidraw/components/App.bucketFill.d.ts +48 -0
- package/dist/types/excalidraw/components/App.clipboard.d.ts +31 -0
- package/dist/types/excalidraw/components/App.cursor.d.ts +38 -0
- package/dist/types/excalidraw/components/App.d.ts +376 -112
- package/dist/types/excalidraw/components/App.drawshape.d.ts +55 -0
- package/dist/types/excalidraw/components/App.duplicate.d.ts +101 -0
- package/dist/types/excalidraw/components/App.flowchart.d.ts +21 -0
- package/dist/types/excalidraw/components/App.host.d.ts +102 -0
- package/dist/types/excalidraw/components/App.modifiers.d.ts +38 -0
- package/dist/types/excalidraw/components/App.pan.d.ts +62 -0
- package/dist/types/excalidraw/components/App.selection.d.ts +265 -0
- package/dist/types/excalidraw/components/App.selectionTool.d.ts +94 -0
- package/dist/types/excalidraw/components/App.text.d.ts +197 -0
- package/dist/types/excalidraw/components/App.textTool.d.ts +140 -0
- package/dist/types/excalidraw/components/App.toolDrag.d.ts +63 -0
- package/dist/types/excalidraw/components/App.viewport.d.ts +133 -0
- package/dist/types/excalidraw/components/App.wheel.d.ts +30 -0
- package/dist/types/excalidraw/components/App.wrap.d.ts +39 -0
- package/dist/types/excalidraw/components/AppStateObserver.d.ts +37 -0
- package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +9 -3
- package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +3 -1
- package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +5 -1
- package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +9 -2
- package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +4 -2
- package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +8 -1
- package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -1
- package/dist/types/excalidraw/components/ColorPicker/colorTopPicksDnD.d.ts +11 -0
- package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +2 -1
- package/dist/types/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +1 -2
- package/dist/types/excalidraw/components/CommandPalette/types.d.ts +1 -1
- package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +4 -3
- package/dist/types/excalidraw/components/CursorHint.d.ts +46 -0
- package/dist/types/excalidraw/components/EyeDropper.d.ts +1 -1
- package/dist/types/excalidraw/components/FileDropOverlay.d.ts +2 -0
- package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +4 -1
- package/dist/types/excalidraw/components/FontPicker/FontPickerList.d.ts +6 -1
- package/dist/types/excalidraw/components/FontPicker/fontTopPicksDnD.d.ts +12 -0
- package/dist/types/excalidraw/components/IconButton.d.ts +48 -0
- package/dist/types/excalidraw/components/IconPicker.d.ts +14 -9
- package/dist/types/excalidraw/components/Island.d.ts +7 -0
- package/dist/types/excalidraw/components/LaserPointerButton.d.ts +2 -4
- package/dist/types/excalidraw/components/LayerUI.d.ts +5 -2
- package/dist/types/excalidraw/components/LibraryMenu.d.ts +1 -1
- package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +6 -2
- package/dist/types/excalidraw/components/LibraryUnit.d.ts +7 -2
- package/dist/types/excalidraw/components/LockButton.d.ts +3 -4
- package/dist/types/excalidraw/components/MagicButton.d.ts +0 -2
- package/dist/types/excalidraw/components/Minimap/Minimap.d.ts +15 -0
- package/dist/types/excalidraw/components/Minimap/MinimapAnnouncementDot.d.ts +10 -0
- package/dist/types/excalidraw/components/Minimap/minimap-controller.chunk.d.ts +90 -0
- package/dist/types/excalidraw/components/Minimap/minimap-shared.chunk.d.ts +122 -0
- package/dist/types/excalidraw/components/Minimap/minimap-worker.chunk.d.ts +12 -0
- package/dist/types/excalidraw/components/MobileMenu.d.ts +4 -4
- package/dist/types/excalidraw/components/MobileToolbar.d.ts +9 -0
- package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +1 -1
- package/dist/types/excalidraw/components/PasteChartDialog.d.ts +4 -5
- package/dist/types/excalidraw/components/PenModeButton.d.ts +2 -5
- package/dist/types/excalidraw/components/Popover.d.ts +1 -3
- package/dist/types/excalidraw/components/PropertiesPopover.d.ts +1 -1
- package/dist/types/excalidraw/components/{ButtonIcon.d.ts → RadioButton.d.ts} +2 -5
- package/dist/types/excalidraw/components/Range.d.ts +10 -4
- package/dist/types/excalidraw/components/SVGLayer.d.ts +1 -1
- package/dist/types/excalidraw/components/SearchMenu.d.ts +1 -1
- package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +1 -1
- package/dist/types/excalidraw/components/Stats/Angle.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/Dimension.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/DragInput.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/Position.d.ts +3 -3
- package/dist/types/excalidraw/components/Stats/utils.d.ts +4 -2
- package/dist/types/excalidraw/components/TTDDialog/Chat/ChatInterface.d.ts +2 -6
- package/dist/types/excalidraw/components/TTDDialog/Chat/TTDChatPanel.d.ts +2 -1
- package/dist/types/excalidraw/components/TTDDialog/CodeMirrorEditor.d.ts +11 -0
- package/dist/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +2 -1
- package/dist/types/excalidraw/components/TTDDialog/TTDContext.d.ts +4 -4
- package/dist/types/excalidraw/components/TTDDialog/TTDDialog.d.ts +11 -7
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +3 -3
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +8 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDPreviewPanel.d.ts +5 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDWelcomeMessage.d.ts +1 -0
- package/dist/types/excalidraw/components/TTDDialog/TextToDiagram.d.ts +3 -1
- package/dist/types/excalidraw/components/TTDDialog/common.d.ts +4 -1
- package/dist/types/excalidraw/components/TTDDialog/hooks/useTextGeneration.d.ts +3 -2
- package/dist/types/excalidraw/components/TTDDialog/mermaid-lang-lite.d.ts +2 -0
- package/dist/types/excalidraw/components/TTDDialog/types.d.ts +18 -1
- package/dist/types/excalidraw/components/TTDDialog/useTTDChatStorage.d.ts +3 -3
- package/dist/types/excalidraw/components/TTDDialog/utils/mermaidAutoFix.d.ts +1 -0
- package/dist/types/excalidraw/components/TTDDialog/utils/mermaidError.d.ts +26 -0
- package/dist/types/excalidraw/components/Toast.d.ts +8 -4
- package/dist/types/excalidraw/components/ToolPopover.d.ts +3 -6
- package/dist/types/excalidraw/components/Toolbar.d.ts +11 -0
- package/dist/types/excalidraw/components/Tools.d.ts +151 -0
- package/dist/types/excalidraw/components/Tooltip.d.ts +26 -2
- package/dist/types/excalidraw/components/TopPicksDnD/TopPicksContextMenu.d.ts +14 -0
- package/dist/types/excalidraw/components/TopPicksDnD/TopPicksTip.d.ts +11 -0
- package/dist/types/excalidraw/components/TopPicksDnD/topPicksDnD.d.ts +58 -0
- package/dist/types/excalidraw/components/UserList.d.ts +3 -2
- package/dist/types/excalidraw/components/ViewportStatusFrame/ViewportStatusFrame.d.ts +11 -0
- package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +6 -2
- package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +3 -0
- package/dist/types/excalidraw/components/canvases/StaticCanvas.d.ts +1 -1
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +30 -16
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +3 -2
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +11 -12
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCheckbox.d.ts +5 -0
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +2 -1
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +2 -1
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSub.d.ts +23 -0
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubContent.d.ts +8 -0
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubTrigger.d.ts +12 -0
- package/dist/types/excalidraw/components/dropdownMenu/common.d.ts +1 -1
- package/dist/types/excalidraw/components/dropdownMenu/dropdownMenuUtils.d.ts +2 -0
- package/dist/types/excalidraw/components/footer/Footer.d.ts +5 -1
- package/dist/types/excalidraw/components/hyperlink/Hyperlink.d.ts +3 -2
- package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +15 -4
- package/dist/types/excalidraw/components/icons.d.ts +31 -10
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +27 -3
- package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +23 -14
- package/dist/types/excalidraw/components/positionElementBesideCursor.d.ts +26 -0
- package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +39 -0
- package/dist/types/excalidraw/data/blob.d.ts +223 -174
- package/dist/types/excalidraw/data/filesystem.d.ts +3 -5
- package/dist/types/excalidraw/data/index.d.ts +9 -10
- package/dist/types/excalidraw/data/json.d.ts +120 -87
- package/dist/types/excalidraw/data/library.d.ts +1 -1
- package/dist/types/excalidraw/data/resave.d.ts +7 -2
- package/dist/types/excalidraw/drawShapeTrail.d.ts +16 -0
- package/dist/types/excalidraw/eraser/index.d.ts +2 -3
- package/dist/types/excalidraw/fonts/Fonts.d.ts +12 -8
- package/dist/types/excalidraw/history.d.ts +10 -4
- package/dist/types/excalidraw/hooks/useAppStateValue.d.ts +29 -0
- package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
- package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +5 -5
- package/dist/types/excalidraw/{laser-trails.d.ts → laserTrails.d.ts} +5 -7
- package/dist/types/excalidraw/lasso/index.d.ts +2 -3
- package/dist/types/excalidraw/lasso/utils.d.ts +2 -0
- package/dist/types/excalidraw/mermaid.d.ts +7 -0
- package/dist/types/excalidraw/reactUtils.d.ts +1 -1
- package/dist/types/excalidraw/renderOverrides.d.ts +9 -0
- package/dist/types/excalidraw/renderer/animation.d.ts +15 -4
- package/dist/types/excalidraw/renderer/helpers.d.ts +25 -0
- package/dist/types/excalidraw/renderer/interactiveScene.d.ts +2 -4
- package/dist/types/excalidraw/renderer/staticScene.d.ts +11 -6
- package/dist/types/excalidraw/scene/Renderer.d.ts +490 -21
- package/dist/types/excalidraw/scene/export.d.ts +344 -21
- package/dist/types/excalidraw/scene/index.d.ts +2 -2
- package/dist/types/excalidraw/scene/types.d.ts +30 -5
- package/dist/types/excalidraw/snapping.d.ts +7 -7
- package/dist/types/excalidraw/textAutoResizeHandle.d.ts +15 -0
- package/dist/types/excalidraw/types.d.ts +702 -44
- package/dist/types/excalidraw/viewport.d.ts +303 -0
- package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +17 -3
- package/dist/types/fractional-indexing/src/index.d.ts +29 -0
- package/dist/types/laser-pointer/src/index.d.ts +2 -0
- package/dist/types/laser-pointer/src/math.d.ts +16 -0
- package/dist/types/laser-pointer/src/simplify.d.ts +2 -0
- package/dist/types/laser-pointer/src/state.d.ts +36 -0
- package/dist/types/math/src/constants.d.ts +0 -1
- package/dist/types/math/src/curve.d.ts +23 -13
- package/dist/types/math/src/index.d.ts +1 -0
- package/dist/types/math/src/pca.d.ts +79 -0
- package/dist/types/math/src/point.d.ts +8 -2
- package/dist/types/math/src/polygon.d.ts +25 -1
- package/dist/types/math/src/segment.d.ts +6 -0
- package/dist/types/math/src/types.d.ts +25 -1
- package/dist/types/utils/src/index.d.ts +4 -3
- package/dist/types/utils/src/shape.d.ts +2 -2
- package/package.json +1 -1
- package/dist/types/excalidraw/animation-frame-handler.d.ts +0 -16
- package/dist/types/excalidraw/charts.d.ts +0 -27
- package/dist/types/excalidraw/components/DiagramToCodePlugin/DiagramToCodePlugin.d.ts +0 -4
- package/dist/types/excalidraw/components/ExcalidrawLogo.d.ts +0 -15
- package/dist/types/excalidraw/components/FollowMode/FollowMode.d.ts +0 -10
- package/dist/types/excalidraw/components/HandButton.d.ts +0 -10
- package/dist/types/excalidraw/components/InitializeApp.d.ts +0 -10
- package/dist/types/excalidraw/components/MobileToolBar.d.ts +0 -10
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +0 -8
- package/dist/types/excalidraw/components/TTDDialog/utils/TTDStreamFetch.d.ts +0 -24
- package/dist/types/excalidraw/components/ToolButton.d.ts +0 -49
- package/dist/types/excalidraw/components/footer/FooterCenter.d.ts +0 -8
- package/dist/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +0 -11
- package/dist/types/excalidraw/components/shapes.d.ts +0 -190
- package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Center.d.ts +0 -58
- package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Hints.d.ts +0 -19
- package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.d.ts +0 -84
- package/dist/types/excalidraw/cursor.d.ts +0 -5
- package/dist/types/excalidraw/data/reconcile.d.ts +0 -7
- package/dist/types/excalidraw/index.d.ts +0 -46
- package/dist/types/excalidraw/polyfill.d.ts +0 -2
- package/dist/types/excalidraw/scene/scroll.d.ts +0 -18
- package/dist/types/excalidraw/scene/zoom.d.ts +0 -12
- package/dist/types/utils/src/bbox.d.ts +0 -9
- package/dist/types/utils/src/export.d.ts +0 -35
- package/dist/types/utils/src/withinBounds.d.ts +0 -19
package/dist/dev/index.js
CHANGED
|
@@ -1356,6 +1356,8 @@ function validateWCAG2Parms(parms) {
|
|
|
1356
1356
|
import { clamp } from "@excalidraw/math";
|
|
1357
1357
|
import { degreesToRadians } from "@excalidraw/math";
|
|
1358
1358
|
var DARK_MODE_COLORS_CACHE = typeof window !== "undefined" ? /* @__PURE__ */ new Map() : null;
|
|
1359
|
+
var DARK_MODE_FILTER_INVERT_PERCENT = 93;
|
|
1360
|
+
var DARK_MODE_FILTER_HUE_ROTATE_DEGREES = 180;
|
|
1359
1361
|
function cssHueRotate(red, green, blue, degrees) {
|
|
1360
1362
|
const r = red / 255;
|
|
1361
1363
|
const g = green / 255;
|
|
@@ -1394,7 +1396,10 @@ var cssInvert = (r, g, b, percent) => {
|
|
|
1394
1396
|
const invertedB = invertComponent(b);
|
|
1395
1397
|
return { r: invertedR, g: invertedG, b: invertedB };
|
|
1396
1398
|
};
|
|
1397
|
-
var applyDarkModeFilter = (color) => {
|
|
1399
|
+
var applyDarkModeFilter = (color, enable = true) => {
|
|
1400
|
+
if (!enable) {
|
|
1401
|
+
return color;
|
|
1402
|
+
}
|
|
1398
1403
|
const cached = DARK_MODE_COLORS_CACHE?.get(color);
|
|
1399
1404
|
if (cached) {
|
|
1400
1405
|
return cached;
|
|
@@ -1402,12 +1407,17 @@ var applyDarkModeFilter = (color) => {
|
|
|
1402
1407
|
const tc = tinycolor(color);
|
|
1403
1408
|
const alpha = tc.getAlpha();
|
|
1404
1409
|
const rgb = tc.toRgb();
|
|
1405
|
-
const inverted = cssInvert(
|
|
1410
|
+
const inverted = cssInvert(
|
|
1411
|
+
rgb.r,
|
|
1412
|
+
rgb.g,
|
|
1413
|
+
rgb.b,
|
|
1414
|
+
DARK_MODE_FILTER_INVERT_PERCENT
|
|
1415
|
+
);
|
|
1406
1416
|
const rotated = cssHueRotate(
|
|
1407
1417
|
inverted.r,
|
|
1408
1418
|
inverted.g,
|
|
1409
1419
|
inverted.b,
|
|
1410
|
-
|
|
1420
|
+
DARK_MODE_FILTER_HUE_ROTATE_DEGREES
|
|
1411
1421
|
);
|
|
1412
1422
|
const result = rgbToHex2(rotated.r, rotated.g, rotated.b, alpha);
|
|
1413
1423
|
if (DARK_MODE_COLORS_CACHE) {
|
|
@@ -1415,6 +1425,33 @@ var applyDarkModeFilter = (color) => {
|
|
|
1415
1425
|
}
|
|
1416
1426
|
return result;
|
|
1417
1427
|
};
|
|
1428
|
+
var _reverseDarkModeInvert = (r, g, b) => {
|
|
1429
|
+
const p = DARK_MODE_FILTER_INVERT_PERCENT / 100;
|
|
1430
|
+
const denominator = 1 - 2 * p;
|
|
1431
|
+
const restore = (color) => Math.round(clamp((color - 255 * p) / denominator, 0, 255));
|
|
1432
|
+
return {
|
|
1433
|
+
r: restore(r),
|
|
1434
|
+
g: restore(g),
|
|
1435
|
+
b: restore(b)
|
|
1436
|
+
};
|
|
1437
|
+
};
|
|
1438
|
+
var removeDarkModeFilter = (color) => {
|
|
1439
|
+
const tc = tinycolor(color);
|
|
1440
|
+
const alpha = tc.getAlpha();
|
|
1441
|
+
const rgb = tc.toRgb();
|
|
1442
|
+
const rotatedBack = cssHueRotate(
|
|
1443
|
+
rgb.r,
|
|
1444
|
+
rgb.g,
|
|
1445
|
+
rgb.b,
|
|
1446
|
+
DARK_MODE_FILTER_HUE_ROTATE_DEGREES
|
|
1447
|
+
);
|
|
1448
|
+
const restored = _reverseDarkModeInvert(
|
|
1449
|
+
rotatedBack.r,
|
|
1450
|
+
rotatedBack.g,
|
|
1451
|
+
rotatedBack.b
|
|
1452
|
+
);
|
|
1453
|
+
return rgbToHex2(restored.r, restored.g, restored.b, alpha);
|
|
1454
|
+
};
|
|
1418
1455
|
var pick = (source, keys) => {
|
|
1419
1456
|
return keys.reduce((acc, key) => {
|
|
1420
1457
|
if (key in source) {
|
|
@@ -1460,6 +1497,7 @@ var COMMON_ELEMENT_SHADES = pick(COLOR_PALETTE, [
|
|
|
1460
1497
|
"orange",
|
|
1461
1498
|
"red"
|
|
1462
1499
|
]);
|
|
1500
|
+
var COLOR_TOP_PICKS_SLOTS = 5;
|
|
1463
1501
|
var DEFAULT_ELEMENT_STROKE_PICKS = [
|
|
1464
1502
|
COLOR_PALETTE.black,
|
|
1465
1503
|
COLOR_PALETTE.red[DEFAULT_ELEMENT_STROKE_COLOR_INDEX],
|
|
@@ -1474,6 +1512,22 @@ var DEFAULT_ELEMENT_BACKGROUND_PICKS = [
|
|
|
1474
1512
|
COLOR_PALETTE.blue[DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX],
|
|
1475
1513
|
COLOR_PALETTE.yellow[DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX]
|
|
1476
1514
|
];
|
|
1515
|
+
var BUCKET_FILL_BACKGROUND_PICKS = [
|
|
1516
|
+
COLOR_PALETTE.white,
|
|
1517
|
+
COLOR_PALETTE.red[DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX],
|
|
1518
|
+
COLOR_PALETTE.green[DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX],
|
|
1519
|
+
COLOR_PALETTE.blue[DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX],
|
|
1520
|
+
COLOR_PALETTE.yellow[DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX]
|
|
1521
|
+
];
|
|
1522
|
+
var DEFAULT_STICKY_NOTE_BG = "#ffdf6b";
|
|
1523
|
+
var STICKY_NOTE_STROKE_PICKS = DEFAULT_ELEMENT_STROKE_PICKS;
|
|
1524
|
+
var STICKY_NOTE_BACKGROUND_PICKS = [
|
|
1525
|
+
DEFAULT_STICKY_NOTE_BG,
|
|
1526
|
+
COLOR_PALETTE.pink[1],
|
|
1527
|
+
COLOR_PALETTE.green[1],
|
|
1528
|
+
COLOR_PALETTE.blue[1],
|
|
1529
|
+
COLOR_PALETTE.orange[1]
|
|
1530
|
+
];
|
|
1477
1531
|
var DEFAULT_CANVAS_BACKGROUND_PICKS = [
|
|
1478
1532
|
COLOR_PALETTE.white,
|
|
1479
1533
|
// radix slate2
|
|
@@ -1525,6 +1579,14 @@ var rgbToHex2 = (r, g, b, a) => {
|
|
|
1525
1579
|
}
|
|
1526
1580
|
return hex6;
|
|
1527
1581
|
};
|
|
1582
|
+
var setColorAlpha = (color, alpha) => {
|
|
1583
|
+
const tc = tinycolor(color);
|
|
1584
|
+
if (!tc.isValid()) {
|
|
1585
|
+
return color;
|
|
1586
|
+
}
|
|
1587
|
+
const { r, g, b } = tc.toRgb();
|
|
1588
|
+
return rgbToHex2(r, g, b, alpha);
|
|
1589
|
+
};
|
|
1528
1590
|
var colorToHex = (color) => {
|
|
1529
1591
|
const tc = tinycolor(color);
|
|
1530
1592
|
if (!tc.isValid()) {
|
|
@@ -1536,6 +1598,9 @@ var colorToHex = (color) => {
|
|
|
1536
1598
|
var isTransparent = (color) => {
|
|
1537
1599
|
return tinycolor(color).getAlpha() === 0;
|
|
1538
1600
|
};
|
|
1601
|
+
var isOpaqueColor = (color) => {
|
|
1602
|
+
return tinycolor(color).getAlpha() === 1;
|
|
1603
|
+
};
|
|
1539
1604
|
var COLOR_OUTLINE_CONTRAST_THRESHOLD = 240;
|
|
1540
1605
|
var calculateContrast = (r, g, b) => {
|
|
1541
1606
|
const yiq = (r * 299 + g * 587 + b * 114) / 1e3;
|
|
@@ -1562,7 +1627,7 @@ var normalizeInputColor = (color) => {
|
|
|
1562
1627
|
}
|
|
1563
1628
|
const tc = tinycolor(color);
|
|
1564
1629
|
if (tc.isValid()) {
|
|
1565
|
-
if (tc.getFormat()
|
|
1630
|
+
if (["hex", "hex8"].includes(tc.getFormat()) && !color.startsWith("#")) {
|
|
1566
1631
|
return `#${color}`;
|
|
1567
1632
|
}
|
|
1568
1633
|
return color;
|
|
@@ -1575,6 +1640,9 @@ init_define_import_meta_env();
|
|
|
1575
1640
|
var supportsResizeObserver = typeof window !== "undefined" && "ResizeObserver" in window;
|
|
1576
1641
|
var APP_NAME = "Excalidraw";
|
|
1577
1642
|
var TEXT_AUTOWRAP_THRESHOLD = 36;
|
|
1643
|
+
var TEXT_VIEWPORT_PADDING = 20;
|
|
1644
|
+
var TEXT_MAX_WRAP_WIDTH = 800;
|
|
1645
|
+
var TEXT_MAX_WRAP_WIDTH_ZOOMED_OUT = 2e3;
|
|
1578
1646
|
var DRAGGING_THRESHOLD = 10;
|
|
1579
1647
|
var MINIMUM_ARROW_SIZE = 20;
|
|
1580
1648
|
var LINE_CONFIRM_THRESHOLD = 8;
|
|
@@ -1626,6 +1694,7 @@ var EVENT = /* @__PURE__ */ ((EVENT2) => {
|
|
|
1626
1694
|
EVENT2["POINTER_MOVE"] = "pointermove";
|
|
1627
1695
|
EVENT2["POINTER_DOWN"] = "pointerdown";
|
|
1628
1696
|
EVENT2["POINTER_UP"] = "pointerup";
|
|
1697
|
+
EVENT2["POINTER_CANCEL"] = "pointercancel";
|
|
1629
1698
|
EVENT2["STATE_CHANGE"] = "statechange";
|
|
1630
1699
|
EVENT2["WHEEL"] = "wheel";
|
|
1631
1700
|
EVENT2["TOUCH_START"] = "touchstart";
|
|
@@ -1659,7 +1728,8 @@ var CLASSES = {
|
|
|
1659
1728
|
SEARCH_MENU_INPUT_WRAPPER: "layer-ui__search-inputWrapper",
|
|
1660
1729
|
CONVERT_ELEMENT_TYPE_POPUP: "ConvertElementTypePopup",
|
|
1661
1730
|
SHAPE_ACTIONS_THEME_SCOPE: "shape-actions-theme-scope",
|
|
1662
|
-
FRAME_NAME: "frame-name"
|
|
1731
|
+
FRAME_NAME: "frame-name",
|
|
1732
|
+
DROPDOWN_MENU_EVENT_WRAPPER: "dropdown-menu-event-wrapper"
|
|
1663
1733
|
};
|
|
1664
1734
|
var FONT_SIZES = {
|
|
1665
1735
|
sm: 16,
|
|
@@ -1718,6 +1788,7 @@ var THEME = {
|
|
|
1718
1788
|
LIGHT: "light",
|
|
1719
1789
|
DARK: "dark"
|
|
1720
1790
|
};
|
|
1791
|
+
var DARK_THEME_FILTER = "invert(93%) hue-rotate(180deg)";
|
|
1721
1792
|
var FRAME_STYLE = {
|
|
1722
1793
|
strokeColor: "#bbb",
|
|
1723
1794
|
strokeWidth: 2,
|
|
@@ -1735,7 +1806,28 @@ var FRAME_STYLE = {
|
|
|
1735
1806
|
};
|
|
1736
1807
|
var MIN_FONT_SIZE = 1;
|
|
1737
1808
|
var DEFAULT_FONT_SIZE = 20;
|
|
1809
|
+
var STICKY_NOTE_MIN_FONT_SIZE = 16;
|
|
1810
|
+
var STICKY_NOTE_MAX_FONT_SIZE = 512;
|
|
1811
|
+
var STICKY_NOTE_FALLBACK_FONT_SIZE = 28;
|
|
1812
|
+
var STICKY_NOTE_FONT_STEP = 2;
|
|
1813
|
+
var STICKY_NOTE_PADDING = 16;
|
|
1814
|
+
var STICKY_NOTE_FOOTER = {
|
|
1815
|
+
height: 20,
|
|
1816
|
+
fontSize: 12,
|
|
1817
|
+
fontFamily: "Helvetica, Arial, sans-serif",
|
|
1818
|
+
baselineFromBottom: 14,
|
|
1819
|
+
opacity: 1,
|
|
1820
|
+
minBodyWidthForYear: 80
|
|
1821
|
+
};
|
|
1822
|
+
var STICKY_NOTE_BODY_INSET_Y = STICKY_NOTE_PADDING * 2 + STICKY_NOTE_FOOTER.height;
|
|
1823
|
+
var DEFAULT_STICKY_NOTE_SIZE = 250;
|
|
1824
|
+
var STICKY_NOTE_MIN_SIZE = 75;
|
|
1825
|
+
var STICKY_NOTE_SHADOW_OFFSET = 3;
|
|
1826
|
+
var STICKY_NOTE_SHADOW_OPACITY = 0.16;
|
|
1827
|
+
var STICKY_NOTE_EDGE_SHADOW_WIDTH = 0.5;
|
|
1828
|
+
var STICKY_NOTE_EDGE_SHADOW_OPACITY = 0.08;
|
|
1738
1829
|
var DEFAULT_FONT_FAMILY = FONT_FAMILY.Excalifont;
|
|
1830
|
+
var FONT_TOP_PICKS_SLOTS = 3;
|
|
1739
1831
|
var DEFAULT_TEXT_ALIGN = "left";
|
|
1740
1832
|
var DEFAULT_VERTICAL_ALIGN = "top";
|
|
1741
1833
|
var DEFAULT_VERSION = "{version}";
|
|
@@ -1766,6 +1858,7 @@ var STRING_MIME_TYPES = {
|
|
|
1766
1858
|
json: "application/json",
|
|
1767
1859
|
// excalidraw data
|
|
1768
1860
|
excalidraw: "application/vnd.excalidraw+json",
|
|
1861
|
+
excalidrawClipboard: "application/vnd.excalidraw.clipboard+json",
|
|
1769
1862
|
// LEGACY: fully-qualified library JSON data
|
|
1770
1863
|
excalidrawlib: "application/vnd.excalidrawlib+json",
|
|
1771
1864
|
// list of excalidraw library item ids
|
|
@@ -1804,9 +1897,13 @@ var TOUCH_CTX_MENU_TIMEOUT = 500;
|
|
|
1804
1897
|
var TITLE_TIMEOUT = 1e4;
|
|
1805
1898
|
var VERSION_TIMEOUT = 3e4;
|
|
1806
1899
|
var SCROLL_TIMEOUT = 100;
|
|
1900
|
+
var ZEN_MODE_TRANSITION_DURATION = 250;
|
|
1807
1901
|
var ZOOM_STEP = 0.1;
|
|
1808
1902
|
var MIN_ZOOM = 0.1;
|
|
1809
1903
|
var MAX_ZOOM = 30;
|
|
1904
|
+
var DEFAULT_ZOOM = Object.freeze({
|
|
1905
|
+
value: 1
|
|
1906
|
+
});
|
|
1810
1907
|
var HYPERLINK_TOOLTIP_DELAY = 300;
|
|
1811
1908
|
var IDLE_THRESHOLD = 6e4;
|
|
1812
1909
|
var ACTIVE_THRESHOLD = 3e3;
|
|
@@ -1833,8 +1930,10 @@ var DEFAULT_UI_OPTIONS = {
|
|
|
1833
1930
|
var MAX_DECIMALS_FOR_SVG_EXPORT = 2;
|
|
1834
1931
|
var EXPORT_SCALES = [1, 2, 3];
|
|
1835
1932
|
var DEFAULT_EXPORT_PADDING = 10;
|
|
1836
|
-
var
|
|
1837
|
-
|
|
1933
|
+
var DEFAULT_IMAGE_OPTIONS = {
|
|
1934
|
+
maxWidthOrHeight: 1440,
|
|
1935
|
+
maxFileSizeBytes: 4 * 1024 * 1024
|
|
1936
|
+
};
|
|
1838
1937
|
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
1839
1938
|
var SVG_DOCUMENT_PREAMBLE = `<?xml version="1.0" standalone="no"?>
|
|
1840
1939
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
@@ -1858,6 +1957,7 @@ var TEXT_ALIGN = {
|
|
|
1858
1957
|
RIGHT: "right"
|
|
1859
1958
|
};
|
|
1860
1959
|
var ELEMENT_READY_TO_ERASE_OPACITY = 20;
|
|
1960
|
+
var ELEMENT_PENDING_DRAW_SHAPE_OPACITY = 70;
|
|
1861
1961
|
var DEFAULT_PROPORTIONAL_RADIUS = 0.25;
|
|
1862
1962
|
var DEFAULT_ADAPTIVE_RADIUS = 32;
|
|
1863
1963
|
var ROUNDNESS = {
|
|
@@ -1881,16 +1981,34 @@ var ROUGHNESS = {
|
|
|
1881
1981
|
artist: 1,
|
|
1882
1982
|
cartoonist: 2
|
|
1883
1983
|
};
|
|
1984
|
+
var STROKE_WIDTH_KEYS = [
|
|
1985
|
+
"thin",
|
|
1986
|
+
"medium",
|
|
1987
|
+
"bold"
|
|
1988
|
+
];
|
|
1884
1989
|
var STROKE_WIDTH = {
|
|
1885
1990
|
thin: 1,
|
|
1991
|
+
medium: 2,
|
|
1992
|
+
bold: 4,
|
|
1993
|
+
extraBold: 8
|
|
1994
|
+
// unused (may be introduced in the future)
|
|
1995
|
+
};
|
|
1996
|
+
var FREEDRAW_STROKE_WIDTH = {
|
|
1997
|
+
thin: 0.5,
|
|
1998
|
+
medium: 1,
|
|
1886
1999
|
bold: 2,
|
|
1887
2000
|
extraBold: 4
|
|
2001
|
+
// legacy (may be used again in the future)
|
|
2002
|
+
};
|
|
2003
|
+
var getStrokeWidthByKey = (elementType, strokeWidthKey) => {
|
|
2004
|
+
return elementType === "freedraw" ? FREEDRAW_STROKE_WIDTH[strokeWidthKey] : STROKE_WIDTH[strokeWidthKey];
|
|
1888
2005
|
};
|
|
2006
|
+
var DEFAULT_ELEMENT_STROKE_WIDTH_KEY = "medium";
|
|
1889
2007
|
var DEFAULT_ELEMENT_PROPS = {
|
|
1890
2008
|
strokeColor: COLOR_PALETTE.black,
|
|
1891
2009
|
backgroundColor: COLOR_PALETTE.transparent,
|
|
1892
2010
|
fillStyle: "solid",
|
|
1893
|
-
strokeWidth:
|
|
2011
|
+
strokeWidth: STROKE_WIDTH[DEFAULT_ELEMENT_STROKE_WIDTH_KEY],
|
|
1894
2012
|
strokeStyle: "solid",
|
|
1895
2013
|
roughness: ROUGHNESS.artist,
|
|
1896
2014
|
opacity: 100,
|
|
@@ -1922,14 +2040,19 @@ var TOOL_TYPE = {
|
|
|
1922
2040
|
hand: "hand",
|
|
1923
2041
|
frame: "frame",
|
|
1924
2042
|
magicframe: "magicframe",
|
|
2043
|
+
stickynote: "stickynote",
|
|
1925
2044
|
embeddable: "embeddable",
|
|
1926
|
-
laser: "laser"
|
|
2045
|
+
laser: "laser",
|
|
2046
|
+
autoshape: "autoshape",
|
|
2047
|
+
bucketfill: "bucketfill"
|
|
1927
2048
|
};
|
|
1928
2049
|
var EDITOR_LS_KEYS = {
|
|
1929
2050
|
OAI_API_KEY: "excalidraw-oai-api-key",
|
|
1930
2051
|
// legacy naming (non)scheme
|
|
1931
2052
|
MERMAID_TO_EXCALIDRAW: "mermaid-to-excalidraw",
|
|
1932
|
-
PUBLISH_LIBRARY: "publish-library-data"
|
|
2053
|
+
PUBLISH_LIBRARY: "publish-library-data",
|
|
2054
|
+
// TEMPORARY (see MinimapAnnouncementDot)
|
|
2055
|
+
MINIMAP_ANNOUNCEMENT_DISMISSED: "excalidraw-minimap-announcement-dismissed"
|
|
1933
2056
|
};
|
|
1934
2057
|
var DEFAULT_FILENAME = "Untitled";
|
|
1935
2058
|
var STATS_PANELS = { generalStats: 1, elementProperties: 2 };
|
|
@@ -1954,6 +2077,8 @@ var BIND_MODE_TIMEOUT = 700;
|
|
|
1954
2077
|
var MOBILE_ACTION_BUTTON_BG = {
|
|
1955
2078
|
background: "var(--mobile-action-button-bg)"
|
|
1956
2079
|
};
|
|
2080
|
+
var DEFAULT_STROKE_STREAMLINE = 0.5;
|
|
2081
|
+
var DEFAULT_STROKE_STREAMLINE_PRECISE = 0.2;
|
|
1957
2082
|
|
|
1958
2083
|
// src/font-metadata.ts
|
|
1959
2084
|
init_define_import_meta_env();
|
|
@@ -2120,15 +2245,18 @@ var MQ_MIN_TABLET = MQ_MAX_MOBILE + 1;
|
|
|
2120
2245
|
var MQ_MAX_TABLET = 1180;
|
|
2121
2246
|
var MQ_MIN_WIDTH_DESKTOP = 1440;
|
|
2122
2247
|
var MQ_RIGHT_SIDEBAR_MIN_WIDTH = 1229;
|
|
2123
|
-
var
|
|
2124
|
-
var
|
|
2125
|
-
var
|
|
2126
|
-
var
|
|
2127
|
-
var
|
|
2128
|
-
var
|
|
2129
|
-
var
|
|
2130
|
-
|
|
2131
|
-
var
|
|
2248
|
+
var ua = typeof navigator === "undefined" ? void 0 : navigator;
|
|
2249
|
+
var uaPlatform = ua?.platform ?? "";
|
|
2250
|
+
var uaString = ua?.userAgent ?? "";
|
|
2251
|
+
var isDarwin = /Mac|iPod|iPhone|iPad/.test(uaPlatform);
|
|
2252
|
+
var isWindows = /^Win/.test(uaPlatform);
|
|
2253
|
+
var isAndroid = /\b(android)\b/i.test(uaString);
|
|
2254
|
+
var isFirefox = typeof window !== "undefined" && "netscape" in window && uaString.indexOf("rv:") > 1 && uaString.indexOf("Gecko") > 1;
|
|
2255
|
+
var isChrome = uaString.indexOf("Chrome") !== -1;
|
|
2256
|
+
var isSafari = !isChrome && uaString.indexOf("Safari") !== -1;
|
|
2257
|
+
var isIOS = /iPad|iPhone/i.test(uaPlatform) || // iPadOS 13+
|
|
2258
|
+
uaString.includes("Mac") && typeof document !== "undefined" && "ontouchend" in document;
|
|
2259
|
+
var isBrave = () => ua?.brave?.isBrave?.name === "isBrave";
|
|
2132
2260
|
var isMobileBreakpoint = (width, height) => {
|
|
2133
2261
|
return width <= MQ_MAX_MOBILE || height < MQ_MAX_HEIGHT_LANDSCAPE && width < MQ_MAX_WIDTH_LANDSCAPE;
|
|
2134
2262
|
};
|
|
@@ -2138,7 +2266,7 @@ var isTabletBreakpoint = (editorWidth, editorHeight) => {
|
|
|
2138
2266
|
return minSide >= MQ_MIN_TABLET && maxSide <= MQ_MAX_TABLET;
|
|
2139
2267
|
};
|
|
2140
2268
|
var isMobileOrTablet = () => {
|
|
2141
|
-
const
|
|
2269
|
+
const ua2 = navigator.userAgent || "";
|
|
2142
2270
|
const platform = navigator.platform || "";
|
|
2143
2271
|
const uaData = navigator.userAgentData;
|
|
2144
2272
|
if (uaData) {
|
|
@@ -2159,14 +2287,14 @@ var isMobileOrTablet = () => {
|
|
|
2159
2287
|
return true;
|
|
2160
2288
|
}
|
|
2161
2289
|
if (isAndroid) {
|
|
2162
|
-
const isAndroidPhone = /Mobile/i.test(
|
|
2290
|
+
const isAndroidPhone = /Mobile/i.test(ua2);
|
|
2163
2291
|
const isAndroidTablet = !isAndroidPhone;
|
|
2164
2292
|
if (isAndroidPhone || isAndroidTablet) {
|
|
2165
2293
|
const looksTouchTablet = matchMedia?.("(hover: none)").matches && matchMedia?.("(pointer: coarse)").matches;
|
|
2166
2294
|
return looksTouchTablet;
|
|
2167
2295
|
}
|
|
2168
2296
|
}
|
|
2169
|
-
const looksDesktopPlatform = /Win|Linux|CrOS|Mac/.test(platform) || /Windows NT|X11|CrOS|Macintosh/.test(
|
|
2297
|
+
const looksDesktopPlatform = /Win|Linux|CrOS|Mac/.test(platform) || /Windows NT|X11|CrOS|Macintosh/.test(ua2);
|
|
2170
2298
|
if (looksDesktopPlatform) {
|
|
2171
2299
|
return false;
|
|
2172
2300
|
}
|
|
@@ -2258,7 +2386,8 @@ var CODES = {
|
|
|
2258
2386
|
Z: "KeyZ",
|
|
2259
2387
|
Y: "KeyY",
|
|
2260
2388
|
R: "KeyR",
|
|
2261
|
-
S: "KeyS"
|
|
2389
|
+
S: "KeyS",
|
|
2390
|
+
W: "KeyW"
|
|
2262
2391
|
};
|
|
2263
2392
|
var KEYS = {
|
|
2264
2393
|
ARROW_DOWN: "ArrowDown",
|
|
@@ -2283,6 +2412,7 @@ var KEYS = {
|
|
|
2283
2412
|
SUBTRACT: "-",
|
|
2284
2413
|
SLASH: "/",
|
|
2285
2414
|
A: "a",
|
|
2415
|
+
B: "b",
|
|
2286
2416
|
C: "c",
|
|
2287
2417
|
D: "d",
|
|
2288
2418
|
E: "e",
|
|
@@ -2291,6 +2421,7 @@ var KEYS = {
|
|
|
2291
2421
|
H: "h",
|
|
2292
2422
|
I: "i",
|
|
2293
2423
|
L: "l",
|
|
2424
|
+
N: "n",
|
|
2294
2425
|
O: "o",
|
|
2295
2426
|
P: "p",
|
|
2296
2427
|
Q: "q",
|
|
@@ -2316,7 +2447,8 @@ var KEYS = {
|
|
|
2316
2447
|
};
|
|
2317
2448
|
var KeyCodeMap = /* @__PURE__ */ new Map([
|
|
2318
2449
|
[KEYS.Z, CODES.Z],
|
|
2319
|
-
[KEYS.Y, CODES.Y]
|
|
2450
|
+
[KEYS.Y, CODES.Y],
|
|
2451
|
+
[KEYS.W, CODES.W]
|
|
2320
2452
|
]);
|
|
2321
2453
|
var isLatinChar = (key) => /^[a-z]$/.test(key.toLowerCase());
|
|
2322
2454
|
var matchKey = (event, key) => {
|
|
@@ -2334,6 +2466,7 @@ var shouldRotateWithDiscreteAngle = (event) => event.shiftKey;
|
|
|
2334
2466
|
// src/points.ts
|
|
2335
2467
|
init_define_import_meta_env();
|
|
2336
2468
|
import {
|
|
2469
|
+
pointFrom,
|
|
2337
2470
|
pointFromPair
|
|
2338
2471
|
} from "@excalidraw/math";
|
|
2339
2472
|
var getSizeFromPoints = (points) => {
|
|
@@ -2378,12 +2511,12 @@ var rescalePoints = (dimension, newSize, points, normalize) => {
|
|
|
2378
2511
|
};
|
|
2379
2512
|
var getGridPoint = (x, y, gridSize) => {
|
|
2380
2513
|
if (gridSize) {
|
|
2381
|
-
return
|
|
2514
|
+
return pointFrom(
|
|
2382
2515
|
Math.round(x / gridSize) * gridSize,
|
|
2383
2516
|
Math.round(y / gridSize) * gridSize
|
|
2384
|
-
|
|
2517
|
+
);
|
|
2385
2518
|
}
|
|
2386
|
-
return
|
|
2519
|
+
return pointFrom(x, y);
|
|
2387
2520
|
};
|
|
2388
2521
|
|
|
2389
2522
|
// src/promise-pool.ts
|
|
@@ -2474,14 +2607,28 @@ var getDateTime = () => {
|
|
|
2474
2607
|
return `${year}-${month}-${day}-${hr}${min}`;
|
|
2475
2608
|
};
|
|
2476
2609
|
var capitalizeString = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
|
2477
|
-
var
|
|
2478
|
-
|
|
2479
|
-
|
|
2610
|
+
var getTargetWindow = (target) => {
|
|
2611
|
+
const owner = target;
|
|
2612
|
+
return owner?.ownerDocument?.defaultView ?? owner?.defaultView ?? (typeof window === "undefined" ? null : window);
|
|
2613
|
+
};
|
|
2614
|
+
var isToolIcon = (target) => {
|
|
2615
|
+
const targetWindow = getTargetWindow(target);
|
|
2616
|
+
return !!targetWindow && target instanceof targetWindow.HTMLElement && target.className.includes("ToolIcon");
|
|
2617
|
+
};
|
|
2618
|
+
var isInputLike = (target) => {
|
|
2619
|
+
const targetWindow = getTargetWindow(target);
|
|
2620
|
+
return !!targetWindow && (target instanceof targetWindow.HTMLElement && target.dataset.type === "wysiwyg" || target instanceof targetWindow.HTMLBRElement || // newline in wysiwyg
|
|
2621
|
+
target instanceof targetWindow.HTMLInputElement || target instanceof targetWindow.HTMLTextAreaElement || target instanceof targetWindow.HTMLSelectElement);
|
|
2622
|
+
};
|
|
2480
2623
|
var isInteractive = (target) => {
|
|
2481
|
-
|
|
2624
|
+
const targetWindow = getTargetWindow(target);
|
|
2625
|
+
return isInputLike(target) || !!targetWindow && target instanceof targetWindow.Element && !!target.closest("label, button");
|
|
2626
|
+
};
|
|
2627
|
+
var isWritableElement = (target) => {
|
|
2628
|
+
const targetWindow = getTargetWindow(target);
|
|
2629
|
+
return !!targetWindow && (target instanceof targetWindow.HTMLElement && target.dataset.type === "wysiwyg" || target instanceof targetWindow.HTMLBRElement || // newline in wysiwyg
|
|
2630
|
+
target instanceof targetWindow.HTMLTextAreaElement || target instanceof targetWindow.HTMLInputElement && (target.type === "text" || target.type === "number" || target.type === "password" || target.type === "search") || target instanceof targetWindow.HTMLElement && target.closest(".cm-editor") !== null);
|
|
2482
2631
|
};
|
|
2483
|
-
var isWritableElement = (target) => target instanceof HTMLElement && target.dataset.type === "wysiwyg" || target instanceof HTMLBRElement || // newline in wysiwyg
|
|
2484
|
-
target instanceof HTMLTextAreaElement || target instanceof HTMLInputElement && (target.type === "text" || target.type === "number" || target.type === "password" || target.type === "search");
|
|
2485
2632
|
var getFontFamilyString = ({
|
|
2486
2633
|
fontFamily
|
|
2487
2634
|
}) => {
|
|
@@ -2526,48 +2673,40 @@ var debounce = (fn, timeout) => {
|
|
|
2526
2673
|
};
|
|
2527
2674
|
return ret;
|
|
2528
2675
|
};
|
|
2529
|
-
var throttleRAF = (fn,
|
|
2676
|
+
var throttleRAF = (fn, ownerWindow) => {
|
|
2530
2677
|
let timerId = null;
|
|
2531
2678
|
let lastArgs = null;
|
|
2532
|
-
|
|
2533
|
-
const scheduleFunc = (
|
|
2534
|
-
timerId =
|
|
2679
|
+
const getOwnerWindow = () => ownerWindow ?? window;
|
|
2680
|
+
const scheduleFunc = () => {
|
|
2681
|
+
timerId = getOwnerWindow().requestAnimationFrame(() => {
|
|
2535
2682
|
timerId = null;
|
|
2536
|
-
|
|
2683
|
+
const args = lastArgs;
|
|
2537
2684
|
lastArgs = null;
|
|
2538
|
-
if (
|
|
2539
|
-
|
|
2540
|
-
lastArgsTrailing = null;
|
|
2541
|
-
scheduleFunc(lastArgs);
|
|
2685
|
+
if (args) {
|
|
2686
|
+
fn(...args);
|
|
2542
2687
|
}
|
|
2543
2688
|
});
|
|
2544
2689
|
};
|
|
2545
2690
|
const ret = (...args) => {
|
|
2546
|
-
if (isTestEnv()) {
|
|
2547
|
-
fn(...args);
|
|
2548
|
-
return;
|
|
2549
|
-
}
|
|
2550
2691
|
lastArgs = args;
|
|
2551
2692
|
if (timerId === null) {
|
|
2552
|
-
scheduleFunc(
|
|
2553
|
-
} else if (opts?.trailing) {
|
|
2554
|
-
lastArgsTrailing = args;
|
|
2693
|
+
scheduleFunc();
|
|
2555
2694
|
}
|
|
2556
2695
|
};
|
|
2557
2696
|
ret.flush = () => {
|
|
2558
2697
|
if (timerId !== null) {
|
|
2559
|
-
cancelAnimationFrame(timerId);
|
|
2698
|
+
getOwnerWindow().cancelAnimationFrame(timerId);
|
|
2560
2699
|
timerId = null;
|
|
2561
2700
|
}
|
|
2562
2701
|
if (lastArgs) {
|
|
2563
|
-
fn(...
|
|
2564
|
-
lastArgs =
|
|
2702
|
+
fn(...lastArgs);
|
|
2703
|
+
lastArgs = null;
|
|
2565
2704
|
}
|
|
2566
2705
|
};
|
|
2567
2706
|
ret.cancel = () => {
|
|
2568
|
-
lastArgs =
|
|
2707
|
+
lastArgs = null;
|
|
2569
2708
|
if (timerId !== null) {
|
|
2570
|
-
cancelAnimationFrame(timerId);
|
|
2709
|
+
getOwnerWindow().cancelAnimationFrame(timerId);
|
|
2571
2710
|
timerId = null;
|
|
2572
2711
|
}
|
|
2573
2712
|
};
|
|
@@ -2576,67 +2715,6 @@ var throttleRAF = (fn, opts) => {
|
|
|
2576
2715
|
var easeOut = (k) => {
|
|
2577
2716
|
return 1 - Math.pow(1 - k, 4);
|
|
2578
2717
|
};
|
|
2579
|
-
var easeOutInterpolate = (from, to, progress) => {
|
|
2580
|
-
return (to - from) * easeOut(progress) + from;
|
|
2581
|
-
};
|
|
2582
|
-
var easeToValuesRAF = ({
|
|
2583
|
-
fromValues,
|
|
2584
|
-
toValues,
|
|
2585
|
-
onStep,
|
|
2586
|
-
duration = 250,
|
|
2587
|
-
interpolateValue,
|
|
2588
|
-
onStart,
|
|
2589
|
-
onEnd,
|
|
2590
|
-
onCancel
|
|
2591
|
-
}) => {
|
|
2592
|
-
let canceled = false;
|
|
2593
|
-
let frameId = 0;
|
|
2594
|
-
let startTime;
|
|
2595
|
-
function step(timestamp) {
|
|
2596
|
-
if (canceled) {
|
|
2597
|
-
return;
|
|
2598
|
-
}
|
|
2599
|
-
if (startTime === void 0) {
|
|
2600
|
-
startTime = timestamp;
|
|
2601
|
-
onStart?.();
|
|
2602
|
-
}
|
|
2603
|
-
const elapsed = Math.min(timestamp - startTime, duration);
|
|
2604
|
-
const factor = easeOut(elapsed / duration);
|
|
2605
|
-
const newValues = {};
|
|
2606
|
-
Object.keys(fromValues).forEach((key) => {
|
|
2607
|
-
const _key = key;
|
|
2608
|
-
const result = (toValues[_key] - fromValues[_key]) * factor + fromValues[_key];
|
|
2609
|
-
newValues[_key] = result;
|
|
2610
|
-
});
|
|
2611
|
-
onStep(newValues);
|
|
2612
|
-
if (elapsed < duration) {
|
|
2613
|
-
const progress = elapsed / duration;
|
|
2614
|
-
const newValues2 = {};
|
|
2615
|
-
Object.keys(fromValues).forEach((key) => {
|
|
2616
|
-
const _key = key;
|
|
2617
|
-
const startValue = fromValues[_key];
|
|
2618
|
-
const endValue = toValues[_key];
|
|
2619
|
-
let result;
|
|
2620
|
-
result = interpolateValue ? interpolateValue(startValue, endValue, progress, _key) : easeOutInterpolate(startValue, endValue, progress);
|
|
2621
|
-
if (result == null) {
|
|
2622
|
-
result = easeOutInterpolate(startValue, endValue, progress);
|
|
2623
|
-
}
|
|
2624
|
-
newValues2[_key] = result;
|
|
2625
|
-
});
|
|
2626
|
-
onStep(newValues2);
|
|
2627
|
-
frameId = window.requestAnimationFrame(step);
|
|
2628
|
-
} else {
|
|
2629
|
-
onStep(toValues);
|
|
2630
|
-
onEnd?.();
|
|
2631
|
-
}
|
|
2632
|
-
}
|
|
2633
|
-
frameId = window.requestAnimationFrame(step);
|
|
2634
|
-
return () => {
|
|
2635
|
-
onCancel?.();
|
|
2636
|
-
canceled = true;
|
|
2637
|
-
window.cancelAnimationFrame(frameId);
|
|
2638
|
-
};
|
|
2639
|
-
};
|
|
2640
2718
|
var chunk = (array, size) => {
|
|
2641
2719
|
if (!array.length || size < 1) {
|
|
2642
2720
|
return [];
|
|
@@ -2679,7 +2757,7 @@ var updateActiveTool = (appState, data) => {
|
|
|
2679
2757
|
}
|
|
2680
2758
|
return {
|
|
2681
2759
|
...appState.activeTool,
|
|
2682
|
-
lastActiveTool: data.
|
|
2760
|
+
lastActiveTool: data.lastActiveTool === void 0 ? appState.activeTool.lastActiveTool : data.lastActiveTool,
|
|
2683
2761
|
type: data.type,
|
|
2684
2762
|
customType: null,
|
|
2685
2763
|
locked: data.locked ?? appState.activeTool.locked,
|
|
@@ -2716,6 +2794,8 @@ var RS_LTR_CHARS = "A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FF
|
|
|
2716
2794
|
var RS_RTL_CHARS = "\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC";
|
|
2717
2795
|
var RE_RTL_CHECK = new RegExp(`^[^${RS_LTR_CHARS}]*[${RS_RTL_CHARS}]`);
|
|
2718
2796
|
var isRTL = (text) => RE_RTL_CHECK.test(text);
|
|
2797
|
+
var RE_RTL_CHARS = new RegExp(`[${RS_RTL_CHARS}]`);
|
|
2798
|
+
var hasRTLChars = (text) => RE_RTL_CHARS.test(text);
|
|
2719
2799
|
var tupleToCoors = (xyTuple) => {
|
|
2720
2800
|
const [x, y] = xyTuple;
|
|
2721
2801
|
return { x, y };
|
|
@@ -2806,19 +2886,21 @@ var supportsEmoji = () => {
|
|
|
2806
2886
|
return ctx.getImageData(offset, offset, 1, 1).data[0] !== 0;
|
|
2807
2887
|
};
|
|
2808
2888
|
var getNearestScrollableContainer = (element) => {
|
|
2889
|
+
const ownerDocument = element.ownerDocument;
|
|
2890
|
+
const ownerWindow = ownerDocument.defaultView ?? window;
|
|
2809
2891
|
let parent = element.parentElement;
|
|
2810
2892
|
while (parent) {
|
|
2811
|
-
if (parent ===
|
|
2812
|
-
return
|
|
2893
|
+
if (parent === ownerDocument.body) {
|
|
2894
|
+
return ownerDocument;
|
|
2813
2895
|
}
|
|
2814
|
-
const { overflowY } =
|
|
2896
|
+
const { overflowY } = ownerWindow.getComputedStyle(parent);
|
|
2815
2897
|
const hasScrollableContent = parent.scrollHeight > parent.clientHeight;
|
|
2816
2898
|
if (hasScrollableContent && (overflowY === "auto" || overflowY === "scroll" || overflowY === "overlay")) {
|
|
2817
2899
|
return parent;
|
|
2818
2900
|
}
|
|
2819
2901
|
parent = parent.parentElement;
|
|
2820
2902
|
}
|
|
2821
|
-
return
|
|
2903
|
+
return ownerDocument;
|
|
2822
2904
|
};
|
|
2823
2905
|
var focusNearestParent = (element) => {
|
|
2824
2906
|
let parent = element.parentElement;
|
|
@@ -3156,6 +3238,9 @@ var setFeatureFlag = (flag, value) => {
|
|
|
3156
3238
|
console.error("unable to set feature flag", e);
|
|
3157
3239
|
}
|
|
3158
3240
|
};
|
|
3241
|
+
var oneOf = (needle, haystack) => {
|
|
3242
|
+
return haystack.includes(needle);
|
|
3243
|
+
};
|
|
3159
3244
|
|
|
3160
3245
|
// src/random.ts
|
|
3161
3246
|
var random = new Random(Date.now());
|
|
@@ -3166,6 +3251,16 @@ var reseed = (seed) => {
|
|
|
3166
3251
|
testIdBase = 0;
|
|
3167
3252
|
};
|
|
3168
3253
|
var randomId = () => isTestEnv() ? `id${testIdBase++}` : nanoid();
|
|
3254
|
+
var seededRandom = (seed) => {
|
|
3255
|
+
let value = seed >>> 0;
|
|
3256
|
+
return () => {
|
|
3257
|
+
value += 1831565813;
|
|
3258
|
+
let next = value;
|
|
3259
|
+
next = Math.imul(next ^ next >>> 15, next | 1);
|
|
3260
|
+
next ^= next + Math.imul(next ^ next >>> 7, next | 61);
|
|
3261
|
+
return ((next ^ next >>> 14) >>> 0) / 4294967296;
|
|
3262
|
+
};
|
|
3263
|
+
};
|
|
3169
3264
|
|
|
3170
3265
|
// src/url.ts
|
|
3171
3266
|
init_define_import_meta_env();
|
|
@@ -3229,6 +3324,298 @@ var Emitter = class {
|
|
|
3229
3324
|
this.subscribers = [];
|
|
3230
3325
|
}
|
|
3231
3326
|
};
|
|
3327
|
+
|
|
3328
|
+
// src/appEventBus.ts
|
|
3329
|
+
init_define_import_meta_env();
|
|
3330
|
+
var AppEventBus = class {
|
|
3331
|
+
constructor(behavior) {
|
|
3332
|
+
this.behavior = behavior;
|
|
3333
|
+
}
|
|
3334
|
+
emitters = /* @__PURE__ */ new Map();
|
|
3335
|
+
lastPayload = /* @__PURE__ */ new Map();
|
|
3336
|
+
emittedOnce = /* @__PURE__ */ new Set();
|
|
3337
|
+
getEmitter(name) {
|
|
3338
|
+
let emitter = this.emitters.get(name);
|
|
3339
|
+
if (!emitter) {
|
|
3340
|
+
emitter = new Emitter();
|
|
3341
|
+
this.emitters.set(name, emitter);
|
|
3342
|
+
}
|
|
3343
|
+
return emitter;
|
|
3344
|
+
}
|
|
3345
|
+
toPromiseValue(args) {
|
|
3346
|
+
return args.length === 1 ? args[0] : args;
|
|
3347
|
+
}
|
|
3348
|
+
on(name, callback) {
|
|
3349
|
+
const eventBehavior = this.behavior[name];
|
|
3350
|
+
const cachedPayload = this.lastPayload.get(name);
|
|
3351
|
+
if (callback) {
|
|
3352
|
+
if (eventBehavior.replay === "last" && cachedPayload) {
|
|
3353
|
+
queueMicrotask(() => callback(...cachedPayload));
|
|
3354
|
+
if (eventBehavior.cardinality === "once") {
|
|
3355
|
+
return () => {
|
|
3356
|
+
};
|
|
3357
|
+
}
|
|
3358
|
+
}
|
|
3359
|
+
return this.getEmitter(name).on(callback);
|
|
3360
|
+
}
|
|
3361
|
+
if (eventBehavior.cardinality !== "once" || eventBehavior.replay !== "last") {
|
|
3362
|
+
throw new Error(`Event "${String(name)}" requires a callback`);
|
|
3363
|
+
}
|
|
3364
|
+
if (cachedPayload) {
|
|
3365
|
+
return Promise.resolve(this.toPromiseValue(cachedPayload));
|
|
3366
|
+
}
|
|
3367
|
+
return new Promise((resolve) => {
|
|
3368
|
+
this.getEmitter(name).once((...args) => {
|
|
3369
|
+
resolve(this.toPromiseValue(args));
|
|
3370
|
+
});
|
|
3371
|
+
});
|
|
3372
|
+
}
|
|
3373
|
+
emit(name, ...args) {
|
|
3374
|
+
const eventBehavior = this.behavior[name];
|
|
3375
|
+
if (!isProdEnv()) {
|
|
3376
|
+
if (eventBehavior.cardinality === "once") {
|
|
3377
|
+
if (this.emittedOnce.has(name)) {
|
|
3378
|
+
throw new Error(`Event "${String(name)}" can only be emitted once`);
|
|
3379
|
+
}
|
|
3380
|
+
this.emittedOnce.add(name);
|
|
3381
|
+
}
|
|
3382
|
+
}
|
|
3383
|
+
if (eventBehavior.replay === "last") {
|
|
3384
|
+
this.lastPayload.set(name, args);
|
|
3385
|
+
}
|
|
3386
|
+
try {
|
|
3387
|
+
this.getEmitter(name).trigger(...args);
|
|
3388
|
+
} finally {
|
|
3389
|
+
if (eventBehavior.cardinality === "once") {
|
|
3390
|
+
this.getEmitter(name).clear();
|
|
3391
|
+
}
|
|
3392
|
+
}
|
|
3393
|
+
}
|
|
3394
|
+
clear() {
|
|
3395
|
+
this.lastPayload.clear();
|
|
3396
|
+
this.emittedOnce.clear();
|
|
3397
|
+
for (const emitter of this.emitters.values()) {
|
|
3398
|
+
emitter.clear();
|
|
3399
|
+
}
|
|
3400
|
+
this.emitters.clear();
|
|
3401
|
+
}
|
|
3402
|
+
};
|
|
3403
|
+
|
|
3404
|
+
// src/versionedSnapshotStore.ts
|
|
3405
|
+
init_define_import_meta_env();
|
|
3406
|
+
var VersionedSnapshotStore = class {
|
|
3407
|
+
constructor(initialValue, isEqual = Object.is) {
|
|
3408
|
+
this.isEqual = isEqual;
|
|
3409
|
+
this.value = initialValue;
|
|
3410
|
+
}
|
|
3411
|
+
version = 0;
|
|
3412
|
+
value;
|
|
3413
|
+
waiters = /* @__PURE__ */ new Set();
|
|
3414
|
+
subscribers = /* @__PURE__ */ new Set();
|
|
3415
|
+
getSnapshot() {
|
|
3416
|
+
return { version: this.version, value: this.value };
|
|
3417
|
+
}
|
|
3418
|
+
set(nextValue) {
|
|
3419
|
+
if (this.isEqual(this.value, nextValue)) {
|
|
3420
|
+
return false;
|
|
3421
|
+
}
|
|
3422
|
+
this.value = nextValue;
|
|
3423
|
+
this.version += 1;
|
|
3424
|
+
const snapshot = this.getSnapshot();
|
|
3425
|
+
for (const subscriber of this.subscribers) {
|
|
3426
|
+
subscriber(snapshot);
|
|
3427
|
+
}
|
|
3428
|
+
for (const waiter of this.waiters) {
|
|
3429
|
+
waiter(snapshot);
|
|
3430
|
+
}
|
|
3431
|
+
this.waiters.clear();
|
|
3432
|
+
return true;
|
|
3433
|
+
}
|
|
3434
|
+
update(updater) {
|
|
3435
|
+
return this.set(updater(this.value));
|
|
3436
|
+
}
|
|
3437
|
+
subscribe(subscriber) {
|
|
3438
|
+
this.subscribers.add(subscriber);
|
|
3439
|
+
return () => {
|
|
3440
|
+
this.subscribers.delete(subscriber);
|
|
3441
|
+
};
|
|
3442
|
+
}
|
|
3443
|
+
pull(sinceVersion = -1) {
|
|
3444
|
+
if (this.version !== sinceVersion) {
|
|
3445
|
+
return Promise.resolve(this.getSnapshot());
|
|
3446
|
+
}
|
|
3447
|
+
return new Promise((resolve) => {
|
|
3448
|
+
this.waiters.add(resolve);
|
|
3449
|
+
});
|
|
3450
|
+
}
|
|
3451
|
+
};
|
|
3452
|
+
|
|
3453
|
+
// debug.ts
|
|
3454
|
+
init_define_import_meta_env();
|
|
3455
|
+
var lessPrecise = (num, precision = 5) => parseFloat(num.toPrecision(precision));
|
|
3456
|
+
var getAvgFrameTime = (times) => lessPrecise(times.reduce((a, b) => a + b) / times.length);
|
|
3457
|
+
var Debug = class _Debug {
|
|
3458
|
+
static DEBUG_LOG_TIMES = true;
|
|
3459
|
+
static TIMES_AGGR = {};
|
|
3460
|
+
static TIMES_AVG = {};
|
|
3461
|
+
static LAST_DEBUG_LOG_CALL = 0;
|
|
3462
|
+
static DEBUG_LOG_INTERVAL_ID = null;
|
|
3463
|
+
static LAST_FRAME_TIMESTAMP = 0;
|
|
3464
|
+
static FRAME_COUNT = 0;
|
|
3465
|
+
static ANIMATION_FRAME_ID = null;
|
|
3466
|
+
static scheduleAnimationFrame = () => {
|
|
3467
|
+
if (_Debug.DEBUG_LOG_INTERVAL_ID !== null) {
|
|
3468
|
+
_Debug.ANIMATION_FRAME_ID = requestAnimationFrame((timestamp) => {
|
|
3469
|
+
if (_Debug.LAST_FRAME_TIMESTAMP !== timestamp) {
|
|
3470
|
+
_Debug.LAST_FRAME_TIMESTAMP = timestamp;
|
|
3471
|
+
_Debug.FRAME_COUNT++;
|
|
3472
|
+
}
|
|
3473
|
+
if (_Debug.DEBUG_LOG_INTERVAL_ID !== null) {
|
|
3474
|
+
_Debug.scheduleAnimationFrame();
|
|
3475
|
+
}
|
|
3476
|
+
});
|
|
3477
|
+
}
|
|
3478
|
+
};
|
|
3479
|
+
static setupInterval = () => {
|
|
3480
|
+
if (_Debug.DEBUG_LOG_INTERVAL_ID === null) {
|
|
3481
|
+
console.info("%c(starting perf recording)", "color: lime");
|
|
3482
|
+
_Debug.DEBUG_LOG_INTERVAL_ID = window.setInterval(_Debug.debugLogger, 1e3);
|
|
3483
|
+
_Debug.scheduleAnimationFrame();
|
|
3484
|
+
}
|
|
3485
|
+
_Debug.LAST_DEBUG_LOG_CALL = Date.now();
|
|
3486
|
+
};
|
|
3487
|
+
static debugLogger = () => {
|
|
3488
|
+
if (_Debug.DEBUG_LOG_TIMES) {
|
|
3489
|
+
for (const [name, { t, times }] of Object.entries(_Debug.TIMES_AGGR)) {
|
|
3490
|
+
if (times.length) {
|
|
3491
|
+
console.info(
|
|
3492
|
+
name,
|
|
3493
|
+
lessPrecise(times.reduce((a, b) => a + b)),
|
|
3494
|
+
times.sort((a, b) => a - b).map((x) => lessPrecise(x))
|
|
3495
|
+
);
|
|
3496
|
+
_Debug.TIMES_AGGR[name] = { t, times: [] };
|
|
3497
|
+
}
|
|
3498
|
+
}
|
|
3499
|
+
for (const [name, { t, times, avg }] of Object.entries(_Debug.TIMES_AVG)) {
|
|
3500
|
+
if (times.length) {
|
|
3501
|
+
const totalTime = times.reduce((a, b) => a + b);
|
|
3502
|
+
const avgFrameTime = lessPrecise(totalTime / _Debug.FRAME_COUNT);
|
|
3503
|
+
console.info(
|
|
3504
|
+
name,
|
|
3505
|
+
`- ${times.length} calls - ${avgFrameTime}ms/frame across ${_Debug.FRAME_COUNT} frames (${lessPrecise(
|
|
3506
|
+
avgFrameTime / 16.67 * 100,
|
|
3507
|
+
1
|
|
3508
|
+
)}% of frame budget)`
|
|
3509
|
+
);
|
|
3510
|
+
_Debug.TIMES_AVG[name] = {
|
|
3511
|
+
t,
|
|
3512
|
+
times: [],
|
|
3513
|
+
avg: avg != null ? getAvgFrameTime([avg, avgFrameTime]) : avgFrameTime
|
|
3514
|
+
};
|
|
3515
|
+
}
|
|
3516
|
+
}
|
|
3517
|
+
}
|
|
3518
|
+
_Debug.FRAME_COUNT = 0;
|
|
3519
|
+
if (Date.now() - _Debug.LAST_DEBUG_LOG_CALL > 600 && _Debug.DEBUG_LOG_INTERVAL_ID !== null) {
|
|
3520
|
+
console.info("%c(stopping perf recording)", "color: red");
|
|
3521
|
+
window.clearInterval(_Debug.DEBUG_LOG_INTERVAL_ID);
|
|
3522
|
+
window.cancelAnimationFrame(_Debug.ANIMATION_FRAME_ID);
|
|
3523
|
+
_Debug.ANIMATION_FRAME_ID = null;
|
|
3524
|
+
_Debug.FRAME_COUNT = 0;
|
|
3525
|
+
_Debug.LAST_FRAME_TIMESTAMP = 0;
|
|
3526
|
+
_Debug.DEBUG_LOG_INTERVAL_ID = null;
|
|
3527
|
+
_Debug.TIMES_AGGR = {};
|
|
3528
|
+
_Debug.TIMES_AVG = {};
|
|
3529
|
+
}
|
|
3530
|
+
};
|
|
3531
|
+
static logTime = (time, name = "default") => {
|
|
3532
|
+
_Debug.setupInterval();
|
|
3533
|
+
const now = performance.now();
|
|
3534
|
+
const { t, times } = _Debug.TIMES_AGGR[name] = _Debug.TIMES_AGGR[name] || {
|
|
3535
|
+
t: 0,
|
|
3536
|
+
times: []
|
|
3537
|
+
};
|
|
3538
|
+
if (t) {
|
|
3539
|
+
times.push(time != null ? time : now - t);
|
|
3540
|
+
}
|
|
3541
|
+
_Debug.TIMES_AGGR[name].t = now;
|
|
3542
|
+
};
|
|
3543
|
+
static logTimeAverage = (time, name = "default") => {
|
|
3544
|
+
_Debug.setupInterval();
|
|
3545
|
+
const now = performance.now();
|
|
3546
|
+
const { t, times } = _Debug.TIMES_AVG[name] = _Debug.TIMES_AVG[name] || {
|
|
3547
|
+
t: 0,
|
|
3548
|
+
times: []
|
|
3549
|
+
};
|
|
3550
|
+
if (t) {
|
|
3551
|
+
times.push(time != null ? time : now - t);
|
|
3552
|
+
}
|
|
3553
|
+
_Debug.TIMES_AVG[name].t = now;
|
|
3554
|
+
};
|
|
3555
|
+
static logWrapper = (type) => (fn, name = "default") => {
|
|
3556
|
+
return (...args) => {
|
|
3557
|
+
const t0 = performance.now();
|
|
3558
|
+
const ret = fn(...args);
|
|
3559
|
+
_Debug[type](performance.now() - t0, name);
|
|
3560
|
+
return ret;
|
|
3561
|
+
};
|
|
3562
|
+
};
|
|
3563
|
+
static logTimeWrap = _Debug.logWrapper("logTime");
|
|
3564
|
+
static logTimeAverageWrap = _Debug.logWrapper("logTimeAverage");
|
|
3565
|
+
static perfWrap = (fn, name = "default") => {
|
|
3566
|
+
return (...args) => {
|
|
3567
|
+
console.time(name);
|
|
3568
|
+
const ret = fn(...args);
|
|
3569
|
+
console.timeEnd(name);
|
|
3570
|
+
return ret;
|
|
3571
|
+
};
|
|
3572
|
+
};
|
|
3573
|
+
static CHANGED_CACHE = {};
|
|
3574
|
+
static logChanged(name, obj) {
|
|
3575
|
+
const prev = _Debug.CHANGED_CACHE[name];
|
|
3576
|
+
_Debug.CHANGED_CACHE[name] = obj;
|
|
3577
|
+
if (!prev) {
|
|
3578
|
+
return;
|
|
3579
|
+
}
|
|
3580
|
+
const allKeys = /* @__PURE__ */ new Set([...Object.keys(prev), ...Object.keys(obj)]);
|
|
3581
|
+
const changed = {};
|
|
3582
|
+
for (const key of allKeys) {
|
|
3583
|
+
const prevVal = prev[key];
|
|
3584
|
+
const nextVal = obj[key];
|
|
3585
|
+
if (!deepEqual(prevVal, nextVal)) {
|
|
3586
|
+
changed[key] = { prev: prevVal, next: nextVal };
|
|
3587
|
+
}
|
|
3588
|
+
}
|
|
3589
|
+
if (Object.keys(changed).length > 0) {
|
|
3590
|
+
console.info(`[${name}] changed:`, changed);
|
|
3591
|
+
}
|
|
3592
|
+
}
|
|
3593
|
+
};
|
|
3594
|
+
function deepEqual(a, b) {
|
|
3595
|
+
if (Object.is(a, b)) {
|
|
3596
|
+
return true;
|
|
3597
|
+
}
|
|
3598
|
+
if (a === null || b === null || typeof a !== "object" || typeof b !== "object") {
|
|
3599
|
+
return false;
|
|
3600
|
+
}
|
|
3601
|
+
if (Array.isArray(a) !== Array.isArray(b)) {
|
|
3602
|
+
return false;
|
|
3603
|
+
}
|
|
3604
|
+
const keysA = Object.keys(a);
|
|
3605
|
+
const keysB = Object.keys(b);
|
|
3606
|
+
if (keysA.length !== keysB.length) {
|
|
3607
|
+
return false;
|
|
3608
|
+
}
|
|
3609
|
+
for (const key of keysA) {
|
|
3610
|
+
if (!deepEqual(
|
|
3611
|
+
a[key],
|
|
3612
|
+
b[key]
|
|
3613
|
+
)) {
|
|
3614
|
+
return false;
|
|
3615
|
+
}
|
|
3616
|
+
}
|
|
3617
|
+
return true;
|
|
3618
|
+
}
|
|
3232
3619
|
export {
|
|
3233
3620
|
ACTIVE_THRESHOLD,
|
|
3234
3621
|
ALLOWED_PASTE_MIME_TYPES,
|
|
@@ -3236,8 +3623,10 @@ export {
|
|
|
3236
3623
|
ARROW_LABEL_FONT_SIZE_TO_MIN_WIDTH_RATIO,
|
|
3237
3624
|
ARROW_LABEL_WIDTH_FRACTION,
|
|
3238
3625
|
ARROW_TYPE,
|
|
3626
|
+
AppEventBus,
|
|
3239
3627
|
BIND_MODE_TIMEOUT,
|
|
3240
3628
|
BOUND_TEXT_PADDING,
|
|
3629
|
+
BUCKET_FILL_BACKGROUND_PICKS,
|
|
3241
3630
|
BinaryHeap,
|
|
3242
3631
|
CANVAS_ONLY_ACTIONS,
|
|
3243
3632
|
CANVAS_SEARCH_TAB,
|
|
@@ -3248,9 +3637,11 @@ export {
|
|
|
3248
3637
|
COLOR_CHARCOAL_BLACK,
|
|
3249
3638
|
COLOR_OUTLINE_CONTRAST_THRESHOLD,
|
|
3250
3639
|
COLOR_PALETTE,
|
|
3640
|
+
COLOR_TOP_PICKS_SLOTS,
|
|
3251
3641
|
COLOR_VOICE_CALL,
|
|
3252
3642
|
COLOR_WHITE,
|
|
3253
3643
|
CURSOR_TYPE,
|
|
3644
|
+
DARK_THEME_FILTER,
|
|
3254
3645
|
DEFAULT_ADAPTIVE_RADIUS,
|
|
3255
3646
|
DEFAULT_CANVAS_BACKGROUND_PICKS,
|
|
3256
3647
|
DEFAULT_CHART_COLOR_INDEX,
|
|
@@ -3262,26 +3653,34 @@ export {
|
|
|
3262
3653
|
DEFAULT_ELEMENT_STROKE_COLOR_INDEX,
|
|
3263
3654
|
DEFAULT_ELEMENT_STROKE_COLOR_PALETTE,
|
|
3264
3655
|
DEFAULT_ELEMENT_STROKE_PICKS,
|
|
3656
|
+
DEFAULT_ELEMENT_STROKE_WIDTH_KEY,
|
|
3265
3657
|
DEFAULT_EXPORT_PADDING,
|
|
3266
3658
|
DEFAULT_FILENAME,
|
|
3267
3659
|
DEFAULT_FONT_FAMILY,
|
|
3268
3660
|
DEFAULT_FONT_SIZE,
|
|
3269
3661
|
DEFAULT_GRID_SIZE,
|
|
3270
3662
|
DEFAULT_GRID_STEP,
|
|
3663
|
+
DEFAULT_IMAGE_OPTIONS,
|
|
3271
3664
|
DEFAULT_LASER_COLOR,
|
|
3272
|
-
DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT,
|
|
3273
3665
|
DEFAULT_PROPORTIONAL_RADIUS,
|
|
3274
3666
|
DEFAULT_REDUCED_GLOBAL_ALPHA,
|
|
3275
3667
|
DEFAULT_SIDEBAR,
|
|
3668
|
+
DEFAULT_STICKY_NOTE_BG,
|
|
3669
|
+
DEFAULT_STICKY_NOTE_SIZE,
|
|
3670
|
+
DEFAULT_STROKE_STREAMLINE,
|
|
3671
|
+
DEFAULT_STROKE_STREAMLINE_PRECISE,
|
|
3276
3672
|
DEFAULT_TEXT_ALIGN,
|
|
3277
3673
|
DEFAULT_TRANSFORM_HANDLE_SPACING,
|
|
3278
3674
|
DEFAULT_UI_OPTIONS,
|
|
3279
3675
|
DEFAULT_VERSION,
|
|
3280
3676
|
DEFAULT_VERTICAL_ALIGN,
|
|
3677
|
+
DEFAULT_ZOOM,
|
|
3281
3678
|
DOUBLE_TAP_POSITION_THRESHOLD,
|
|
3282
3679
|
DRAGGING_THRESHOLD,
|
|
3680
|
+
Debug,
|
|
3283
3681
|
EDITOR_LS_KEYS,
|
|
3284
3682
|
ELEMENT_LINK_KEY,
|
|
3683
|
+
ELEMENT_PENDING_DRAW_SHAPE_OPACITY,
|
|
3285
3684
|
ELEMENT_READY_TO_ERASE_OPACITY,
|
|
3286
3685
|
ELEMENT_SHIFT_TRANSLATE_AMOUNT,
|
|
3287
3686
|
ELEMENT_TRANSLATE_AMOUNT,
|
|
@@ -3298,7 +3697,9 @@ export {
|
|
|
3298
3697
|
FONT_FAMILY_GENERIC_FALLBACKS,
|
|
3299
3698
|
FONT_METADATA,
|
|
3300
3699
|
FONT_SIZES,
|
|
3700
|
+
FONT_TOP_PICKS_SLOTS,
|
|
3301
3701
|
FRAME_STYLE,
|
|
3702
|
+
FREEDRAW_STROKE_WIDTH,
|
|
3302
3703
|
GOOGLE_FONTS_RANGES,
|
|
3303
3704
|
HYPERLINK_TOOLTIP_DELAY,
|
|
3304
3705
|
IDLE_THRESHOLD,
|
|
@@ -3311,7 +3712,6 @@ export {
|
|
|
3311
3712
|
LINE_CONFIRM_THRESHOLD,
|
|
3312
3713
|
LINE_POLYGON_POINT_MERGE_DISTANCE,
|
|
3313
3714
|
LOCAL_FONT_PROTOCOL,
|
|
3314
|
-
MAX_ALLOWED_FILE_BYTES,
|
|
3315
3715
|
MAX_CUSTOM_COLORS_USED_IN_CANVAS,
|
|
3316
3716
|
MAX_DECIMALS_FOR_SVG_EXPORT,
|
|
3317
3717
|
MAX_ZOOM,
|
|
@@ -3341,14 +3741,32 @@ export {
|
|
|
3341
3741
|
SHIFT_LOCKING_ANGLE,
|
|
3342
3742
|
SIDE_RESIZING_THRESHOLD,
|
|
3343
3743
|
STATS_PANELS,
|
|
3744
|
+
STICKY_NOTE_BACKGROUND_PICKS,
|
|
3745
|
+
STICKY_NOTE_BODY_INSET_Y,
|
|
3746
|
+
STICKY_NOTE_EDGE_SHADOW_OPACITY,
|
|
3747
|
+
STICKY_NOTE_EDGE_SHADOW_WIDTH,
|
|
3748
|
+
STICKY_NOTE_FALLBACK_FONT_SIZE,
|
|
3749
|
+
STICKY_NOTE_FONT_STEP,
|
|
3750
|
+
STICKY_NOTE_FOOTER,
|
|
3751
|
+
STICKY_NOTE_MAX_FONT_SIZE,
|
|
3752
|
+
STICKY_NOTE_MIN_FONT_SIZE,
|
|
3753
|
+
STICKY_NOTE_MIN_SIZE,
|
|
3754
|
+
STICKY_NOTE_PADDING,
|
|
3755
|
+
STICKY_NOTE_SHADOW_OFFSET,
|
|
3756
|
+
STICKY_NOTE_SHADOW_OPACITY,
|
|
3757
|
+
STICKY_NOTE_STROKE_PICKS,
|
|
3344
3758
|
STRING_MIME_TYPES,
|
|
3345
3759
|
STROKE_WIDTH,
|
|
3760
|
+
STROKE_WIDTH_KEYS,
|
|
3346
3761
|
SVG_DOCUMENT_PREAMBLE,
|
|
3347
3762
|
SVG_NS,
|
|
3348
3763
|
TAP_TWICE_TIMEOUT,
|
|
3349
3764
|
TEXT_ALIGN,
|
|
3350
3765
|
TEXT_AUTOWRAP_THRESHOLD,
|
|
3766
|
+
TEXT_MAX_WRAP_WIDTH,
|
|
3767
|
+
TEXT_MAX_WRAP_WIDTH_ZOOMED_OUT,
|
|
3351
3768
|
TEXT_TO_CENTER_SNAP_THRESHOLD,
|
|
3769
|
+
TEXT_VIEWPORT_PADDING,
|
|
3352
3770
|
THEME,
|
|
3353
3771
|
TITLE_TIMEOUT,
|
|
3354
3772
|
TOOL_TYPE,
|
|
@@ -3359,8 +3777,10 @@ export {
|
|
|
3359
3777
|
VERSIONS,
|
|
3360
3778
|
VERSION_TIMEOUT,
|
|
3361
3779
|
VERTICAL_ALIGN,
|
|
3780
|
+
VersionedSnapshotStore,
|
|
3362
3781
|
WINDOWS_EMOJI_FALLBACK_FONT,
|
|
3363
3782
|
YOUTUBE_STATES,
|
|
3783
|
+
ZEN_MODE_TRANSITION_DURATION,
|
|
3364
3784
|
ZOOM_STEP,
|
|
3365
3785
|
addEventListener,
|
|
3366
3786
|
allowFullScreen,
|
|
@@ -3382,7 +3802,6 @@ export {
|
|
|
3382
3802
|
deriveStylesPanelMode,
|
|
3383
3803
|
distance,
|
|
3384
3804
|
easeOut,
|
|
3385
|
-
easeToValuesRAF,
|
|
3386
3805
|
escapeDoubleQuotes,
|
|
3387
3806
|
exitFullScreen,
|
|
3388
3807
|
findIndex,
|
|
@@ -3403,10 +3822,13 @@ export {
|
|
|
3403
3822
|
getLineHeight,
|
|
3404
3823
|
getNearestScrollableContainer,
|
|
3405
3824
|
getSizeFromPoints,
|
|
3825
|
+
getStrokeWidthByKey,
|
|
3406
3826
|
getSvgPathFromStroke,
|
|
3827
|
+
getTargetWindow,
|
|
3407
3828
|
getUpdatedTimestamp,
|
|
3408
3829
|
getVersion,
|
|
3409
3830
|
getVerticalOffset,
|
|
3831
|
+
hasRTLChars,
|
|
3410
3832
|
invariant,
|
|
3411
3833
|
isAndroid,
|
|
3412
3834
|
isAnyTrue,
|
|
@@ -3426,6 +3848,7 @@ export {
|
|
|
3426
3848
|
isLocalLink,
|
|
3427
3849
|
isMemberOf,
|
|
3428
3850
|
isMobileBreakpoint,
|
|
3851
|
+
isOpaqueColor,
|
|
3429
3852
|
isPrimitive,
|
|
3430
3853
|
isProdEnv,
|
|
3431
3854
|
isPromiseLike,
|
|
@@ -3452,12 +3875,14 @@ export {
|
|
|
3452
3875
|
normalizeEOL,
|
|
3453
3876
|
normalizeInputColor,
|
|
3454
3877
|
normalizeLink,
|
|
3878
|
+
oneOf,
|
|
3455
3879
|
preventUnload,
|
|
3456
3880
|
promiseTry,
|
|
3457
3881
|
queryFocusableElements,
|
|
3458
3882
|
randomId,
|
|
3459
3883
|
randomInteger,
|
|
3460
3884
|
reduceToCommonValue,
|
|
3885
|
+
removeDarkModeFilter,
|
|
3461
3886
|
removeSelection,
|
|
3462
3887
|
rescalePoints,
|
|
3463
3888
|
reseed,
|
|
@@ -3465,7 +3890,9 @@ export {
|
|
|
3465
3890
|
rgbToHex2 as rgbToHex,
|
|
3466
3891
|
safelyParseJSON,
|
|
3467
3892
|
sceneCoordsToViewportCoords,
|
|
3893
|
+
seededRandom,
|
|
3468
3894
|
selectNode,
|
|
3895
|
+
setColorAlpha,
|
|
3469
3896
|
setDateTimeForTests,
|
|
3470
3897
|
setDesktopUIMode,
|
|
3471
3898
|
setFeatureFlag,
|