@excalidraw/math 0.18.0-d2463f87d → 0.18.0-d9e8a33
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 +92 -65
- package/dist/dev/index.js.map +3 -3
- package/dist/prod/index.js +1 -1
- package/dist/types/common/debug.d.ts +21 -0
- package/dist/types/common/src/appEventBus.d.ts +27 -0
- package/dist/types/common/src/bounds.d.ts +10 -0
- package/dist/types/common/src/colors.d.ts +59 -39
- package/dist/types/common/src/constants.d.ts +38 -26
- package/dist/types/common/src/editorInterface.d.ts +34 -0
- package/dist/types/common/src/font-metadata.d.ts +1 -3
- package/dist/types/common/src/index.d.ts +5 -0
- package/dist/types/common/src/keys.d.ts +1 -1
- package/dist/types/common/src/utility-types.d.ts +0 -1
- package/dist/types/common/src/utils.d.ts +53 -41
- package/dist/types/common/src/versionedSnapshotStore.d.ts +17 -0
- package/dist/types/element/src/Scene.d.ts +11 -5
- package/dist/types/element/src/align.d.ts +2 -1
- package/dist/types/element/src/arrowheads.d.ts +3 -0
- package/dist/types/element/src/arrows/focus.d.ts +27 -0
- package/dist/types/element/src/arrows/helpers.d.ts +5 -0
- package/dist/types/element/src/binding.d.ts +67 -48
- package/dist/types/element/src/bounds.d.ts +8 -14
- package/dist/types/element/src/collision.d.ts +7 -2
- package/dist/types/element/src/comparisons.d.ts +7 -7
- package/dist/types/element/src/delta.d.ts +16 -4
- package/dist/types/element/src/distribute.d.ts +3 -1
- package/dist/types/element/src/dragElements.d.ts +3 -3
- package/dist/types/element/src/duplicate.d.ts +3 -3
- package/dist/types/element/src/elbowArrow.d.ts +2 -0
- package/dist/types/element/src/fractionalIndex.d.ts +2 -2
- package/dist/types/element/src/frame.d.ts +6 -2
- package/dist/types/element/src/groups.d.ts +1 -0
- package/dist/types/element/src/heading.d.ts +2 -1
- package/dist/types/element/src/image.d.ts +1 -11
- package/dist/types/element/src/index.d.ts +5 -3
- package/dist/types/element/src/linearElementEditor.d.ts +25 -23
- package/dist/types/element/src/mutateElement.d.ts +5 -1
- package/dist/types/element/src/newElement.d.ts +6 -6
- package/dist/types/element/src/positionElementsOnGrid.d.ts +2 -0
- package/dist/types/element/src/renderElement.d.ts +4 -7
- package/dist/types/element/src/resizeElements.d.ts +10 -10
- package/dist/types/element/src/resizeTest.d.ts +6 -5
- package/dist/types/element/src/selection.d.ts +10 -10
- package/dist/types/element/src/shape.d.ts +9 -8
- package/dist/types/element/src/store.d.ts +8 -2
- package/dist/types/element/src/textElement.d.ts +2 -2
- package/dist/types/element/src/textMeasurements.d.ts +1 -3
- package/dist/types/element/src/textWrapping.d.ts +26 -0
- package/dist/types/{excalidraw/data → element/src}/transform.d.ts +3 -3
- package/dist/types/element/src/transformHandles.d.ts +8 -27
- package/dist/types/element/src/typeChecks.d.ts +4 -7
- package/dist/types/element/src/types.d.ts +12 -13
- package/dist/types/element/src/utils.d.ts +9 -4
- package/dist/types/element/src/zindex.d.ts +7 -1
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +170 -210
- package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -7
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +94 -121
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +557 -902
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +125 -896
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +45 -59
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +151 -195
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +160 -0
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -3
- package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +3 -4
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +54 -74
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +92 -119
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +60 -74
- package/dist/types/excalidraw/actions/actionExport.d.ts +173 -1412
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +10 -395
- package/dist/types/excalidraw/actions/actionFlip.d.ts +2 -3
- package/dist/types/excalidraw/actions/actionFrame.d.ts +265 -356
- package/dist/types/excalidraw/actions/actionGroup.d.ts +97 -132
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +162 -183
- package/dist/types/excalidraw/actions/actionLink.d.ts +60 -74
- package/dist/types/excalidraw/actions/actionMenu.d.ts +49 -437
- package/dist/types/excalidraw/actions/actionNavigate.d.ts +18 -361
- package/dist/types/excalidraw/actions/actionProperties.d.ts +152 -2522
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +48 -66
- package/dist/types/excalidraw/actions/actionStyles.d.ts +45 -58
- package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +4 -4
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +173 -0
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +60 -74
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +173 -0
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +60 -74
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +48 -68
- package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +59 -73
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +60 -74
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +60 -74
- package/dist/types/excalidraw/actions/actionZindex.d.ts +8 -9
- package/dist/types/excalidraw/actions/index.d.ts +5 -2
- package/dist/types/excalidraw/actions/register.d.ts +2 -2
- package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
- package/dist/types/excalidraw/actions/types.d.ts +4 -4
- package/dist/types/excalidraw/appState.d.ts +29 -21
- package/dist/types/excalidraw/charts/charts.bar.d.ts +2 -0
- package/dist/types/excalidraw/charts/charts.constants.d.ts +48 -0
- package/dist/types/excalidraw/charts/charts.helpers.d.ts +32 -0
- package/dist/types/excalidraw/charts/charts.line.d.ts +2 -0
- package/dist/types/excalidraw/charts/charts.parse.d.ts +10 -0
- package/dist/types/excalidraw/charts/charts.radar.d.ts +2 -0
- package/dist/types/excalidraw/charts/charts.types.d.ts +18 -0
- package/dist/types/excalidraw/charts/index.d.ts +7 -0
- package/dist/types/excalidraw/clipboard.d.ts +57 -19
- package/dist/types/excalidraw/components/Actions.d.ts +21 -8
- package/dist/types/excalidraw/components/App.d.ts +118 -75
- package/dist/types/excalidraw/components/AppStateObserver.d.ts +37 -0
- package/dist/types/excalidraw/components/Card.d.ts +1 -3
- package/dist/types/excalidraw/components/ColorPicker/ColorInput.d.ts +2 -4
- package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +0 -1
- package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +2 -0
- package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +2 -1
- package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +2 -1
- package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +0 -1
- package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +0 -1
- package/dist/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +1 -0
- package/dist/types/excalidraw/components/CommandPalette/types.d.ts +2 -4
- package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +2 -2
- package/dist/types/excalidraw/components/DarkModeToggle.d.ts +1 -1
- package/dist/types/excalidraw/components/DefaultSidebar.d.ts +9 -13
- package/dist/types/excalidraw/components/ElementLinkDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/Ellipsify.d.ts +3 -0
- package/dist/types/excalidraw/components/ErrorDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/EyeDropper.d.ts +0 -1
- package/dist/types/excalidraw/components/FilledButton.d.ts +2 -1
- package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +2 -1
- package/dist/types/excalidraw/components/FontPicker/FontPickerTrigger.d.ts +3 -1
- package/dist/types/excalidraw/components/FontPicker/keyboardNavHandlers.d.ts +0 -1
- package/dist/types/excalidraw/components/HelpDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/HintViewer.d.ts +4 -3
- package/dist/types/excalidraw/components/IconPicker.d.ts +14 -9
- package/dist/types/excalidraw/components/InlineIcon.d.ts +3 -1
- package/dist/types/excalidraw/components/LayerUI.d.ts +2 -1
- package/dist/types/excalidraw/components/LibraryMenuControlButtons.d.ts +1 -1
- package/dist/types/excalidraw/components/LibraryMenuHeaderContent.d.ts +1 -2
- package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +1 -1
- package/dist/types/excalidraw/components/LibraryUnit.d.ts +2 -3
- package/dist/types/excalidraw/components/LoadingMessage.d.ts +0 -1
- package/dist/types/excalidraw/components/MobileMenu.d.ts +3 -5
- package/dist/types/excalidraw/components/MobileToolBar.d.ts +10 -0
- package/dist/types/excalidraw/components/Modal.d.ts +0 -1
- package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirm.d.ts +1 -1
- package/dist/types/excalidraw/components/PasteChartDialog.d.ts +4 -5
- package/dist/types/excalidraw/components/Popover.d.ts +2 -1
- package/dist/types/excalidraw/components/PropertiesPopover.d.ts +2 -1
- package/dist/types/excalidraw/components/RadioGroup.d.ts +0 -1
- package/dist/types/excalidraw/components/RadioSelection.d.ts +4 -4
- package/dist/types/excalidraw/components/Range.d.ts +10 -4
- package/dist/types/excalidraw/components/ScrollableList.d.ts +0 -1
- package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +15 -21
- package/dist/types/excalidraw/components/Sidebar/SidebarHeader.d.ts +1 -1
- package/dist/types/excalidraw/components/Sidebar/SidebarTab.d.ts +1 -2
- package/dist/types/excalidraw/components/Sidebar/SidebarTabTrigger.d.ts +1 -2
- package/dist/types/excalidraw/components/Sidebar/SidebarTabTriggers.d.ts +1 -2
- package/dist/types/excalidraw/components/Sidebar/SidebarTabs.d.ts +1 -2
- package/dist/types/excalidraw/components/Spinner.d.ts +4 -4
- package/dist/types/excalidraw/components/Stats/CanvasGrid.d.ts +0 -1
- package/dist/types/excalidraw/components/Stats/Collapsible.d.ts +0 -1
- package/dist/types/excalidraw/components/Stats/DragInput.d.ts +0 -1
- package/dist/types/excalidraw/components/Stats/index.d.ts +7 -8
- package/dist/types/excalidraw/components/Stats/utils.d.ts +1 -1
- package/dist/types/excalidraw/components/TTDDialog/Chat/ChatHistoryMenu.d.ts +15 -0
- package/dist/types/excalidraw/components/TTDDialog/Chat/ChatInterface.d.ts +23 -0
- package/dist/types/excalidraw/components/TTDDialog/Chat/ChatMessage.d.ts +14 -0
- package/dist/types/excalidraw/components/TTDDialog/Chat/TTDChatPanel.d.ts +27 -0
- package/dist/types/excalidraw/components/TTDDialog/Chat/index.d.ts +3 -0
- package/dist/types/excalidraw/components/TTDDialog/Chat/useChatAgent.d.ts +8 -0
- package/dist/types/excalidraw/components/TTDDialog/CodeMirrorEditor.d.ts +11 -0
- package/dist/types/excalidraw/components/TTDDialog/MermaidToExcalidraw.d.ts +3 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDContext.d.ts +13 -0
- package/dist/types/excalidraw/components/TTDDialog/TTDDialog.d.ts +12 -29
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +3 -3
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +5 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogPanel.d.ts +13 -9
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTab.d.ts +1 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTrigger.d.ts +1 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTabTriggers.d.ts +1 -2
- package/dist/types/excalidraw/components/TTDDialog/TTDPreviewPanel.d.ts +9 -0
- package/dist/types/excalidraw/components/TTDDialog/TTDWelcomeMessage.d.ts +1 -0
- package/dist/types/excalidraw/components/TTDDialog/TextToDiagram.d.ts +9 -0
- package/dist/types/excalidraw/components/TTDDialog/common.d.ts +16 -16
- package/dist/types/excalidraw/components/TTDDialog/hooks/useChatManagement.d.ts +13 -0
- package/dist/types/excalidraw/components/TTDDialog/hooks/useMermaidRenderer.d.ts +14 -0
- package/dist/types/excalidraw/components/TTDDialog/hooks/useTextGeneration.d.ts +7 -0
- package/dist/types/excalidraw/components/TTDDialog/mermaid-lang-lite.d.ts +2 -0
- package/dist/types/excalidraw/components/TTDDialog/types.d.ts +95 -0
- package/dist/types/excalidraw/components/TTDDialog/useTTDChatStorage.d.ts +22 -0
- package/dist/types/excalidraw/components/TTDDialog/utils/chat.d.ts +10 -0
- package/dist/types/excalidraw/components/TTDDialog/utils/mermaidAutoFix.d.ts +1 -0
- package/dist/types/excalidraw/components/TTDDialog/utils/mermaidError.d.ts +10 -0
- package/dist/types/excalidraw/components/TTDDialog/utils/mermaidValidation.d.ts +1 -0
- package/dist/types/excalidraw/components/TextField.d.ts +1 -0
- package/dist/types/excalidraw/components/Toast.d.ts +11 -7
- package/dist/types/excalidraw/components/ToolPopover.d.ts +25 -0
- package/dist/types/excalidraw/components/Trans.d.ts +2 -2
- package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +7 -3
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +47 -35
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +7 -5
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuGroup.d.ts +3 -3
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +13 -22
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCheckbox.d.ts +5 -0
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +5 -4
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +2 -2
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCustom.d.ts +2 -2
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemLink.d.ts +6 -6
- 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/DropdownMenuTrigger.d.ts +3 -4
- package/dist/types/excalidraw/components/dropdownMenu/common.d.ts +2 -2
- package/dist/types/excalidraw/components/dropdownMenu/dropdownMenuUtils.d.ts +2 -0
- package/dist/types/excalidraw/components/hoc/withInternalFallback.d.ts +1 -1
- package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +1 -1
- package/dist/types/excalidraw/components/icons.d.ts +49 -21
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +20 -2
- package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +39 -35
- package/dist/types/excalidraw/components/shapes.d.ts +202 -1
- package/dist/types/excalidraw/data/blob.d.ts +329 -12
- package/dist/types/excalidraw/data/encode.d.ts +4 -4
- package/dist/types/excalidraw/data/encryption.d.ts +5 -5
- package/dist/types/excalidraw/data/filesystem.d.ts +5 -7
- package/dist/types/excalidraw/data/index.d.ts +4 -5
- package/dist/types/excalidraw/data/json.d.ts +171 -4
- package/dist/types/excalidraw/data/library.d.ts +24 -9
- package/dist/types/excalidraw/data/resave.d.ts +7 -2
- package/dist/types/excalidraw/data/restore.d.ts +27 -7
- package/dist/types/excalidraw/data/types.d.ts +4 -1
- package/dist/types/excalidraw/editor-jotai.d.ts +11 -11
- package/dist/types/excalidraw/errors.d.ts +14 -0
- package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
- package/dist/types/excalidraw/hooks/useOutsideClick.d.ts +4 -3
- package/dist/types/excalidraw/hooks/useScrollPosition.d.ts +1 -2
- package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +14 -0
- package/dist/types/excalidraw/i18n.d.ts +2 -2
- package/dist/types/excalidraw/renderer/animation.d.ts +12 -0
- package/dist/types/excalidraw/renderer/helpers.d.ts +6 -8
- package/dist/types/excalidraw/renderer/interactiveScene.d.ts +8 -14
- package/dist/types/excalidraw/renderer/staticScene.d.ts +4 -1
- package/dist/types/excalidraw/scene/Renderer.d.ts +5 -2
- package/dist/types/excalidraw/scene/export.d.ts +2 -2
- package/dist/types/excalidraw/scene/scroll.d.ts +1 -6
- package/dist/types/excalidraw/scene/types.d.ts +22 -5
- package/dist/types/excalidraw/shortcut.d.ts +1 -0
- package/dist/types/excalidraw/snapping.d.ts +5 -5
- package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-bindings.d.ts +1 -1
- package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-loader.d.ts +1 -1
- package/dist/types/excalidraw/subset/harfbuzz/harfbuzz-wasm.d.ts +1 -1
- package/dist/types/excalidraw/subset/woff2/woff2-loader.d.ts +2 -2
- package/dist/types/excalidraw/subset/woff2/woff2-wasm.d.ts +1 -1
- package/dist/types/excalidraw/textAutoResizeHandle.d.ts +15 -0
- package/dist/types/excalidraw/types.d.ts +130 -38
- package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +7 -3
- package/dist/types/math/src/curve.d.ts +4 -1
- package/dist/types/math/src/point.d.ts +7 -2
- package/dist/types/math/src/polygon.d.ts +2 -2
- package/dist/types/math/src/range.d.ts +1 -3
- package/dist/types/math/src/segment.d.ts +4 -3
- package/dist/types/math/src/types.d.ts +25 -1
- package/dist/types/utils/src/bbox.d.ts +1 -1
- package/dist/types/utils/src/export.d.ts +5 -5
- package/dist/types/utils/src/shape.d.ts +6 -6
- package/dist/types/utils/src/withinBounds.d.ts +2 -2
- package/package.json +2 -2
- 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 -16
- package/dist/types/excalidraw/components/InitializeApp.d.ts +0 -10
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +0 -9
- package/dist/types/excalidraw/components/footer/FooterCenter.d.ts +0 -8
- package/dist/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +0 -10
- 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 -85
- package/dist/types/excalidraw/data/reconcile.d.ts +0 -6
- package/dist/types/excalidraw/index.d.ts +0 -46
- package/dist/types/excalidraw/polyfill.d.ts +0 -2
package/dist/prod/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var y=1e-4,ft=(t,n,o)=>Math.min(Math.max(t,n),o),dt=(t,n,o="round")=>{let e=Math.pow(10,n);return Math[o]((t+Number.EPSILON)*e)/e},gt=(t,n,o="round")=>{let e=1/n;return Math[o](t*e)/e},ht=(t,n)=>(t+n)/2,Lt=t=>typeof t=="number"&&Number.isFinite(t),yt=(t,n,o=1e-4)=>Math.abs(t-n)<o;var C=t=>t<0?t%(2*Math.PI)+2*Math.PI:t%(2*Math.PI),St=([t,n])=>[Math.hypot(t,n),C(Math.atan2(n,t))];function K(t){return t*Math.PI/180}function vt(t){return t*180/Math.PI}function It(t){return Math.abs(Math.sin(2*t))<1e-4}function Vt(t,n,o){return t=C(t),n=C(n),o=C(o),n<o?t>=n&&t<=o:t>=n||t<=o}function Ct(t,n){t=C(t),n=C(n);let o=t-n;return o<-Math.PI?o=o+2*Math.PI:o>Math.PI&&(o=o-2*Math.PI),Math.abs(o)}function L(t,n,o=0,e=0){return[t-o,n-e]}function h(t,n=[0,0],o,e=[0,1]){let r=L(t[0]-n[0],t[1]-n[1]);return o&&U(r)<o*o?e:r}function N(t,n){return t[0]*n[1]-n[0]*t[1]}function E(t,n){return t[0]*n[0]+t[1]*n[1]}function Et(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&!isNaN(t[0])&&typeof t[1]=="number"&&!isNaN(t[1])}function F(t,n){return[t[0]+n[0],t[1]+n[1]]}function D(t,n){return[t[0]-n[0],t[1]-n[1]]}function M(t,n){return L(t[0]*n,t[1]*n)}function U(t){return t[0]*t[0]+t[1]*t[1]}function ct(t){return Math.sqrt(U(t))}var T=t=>{let n=ct(t);return n===0?L(0,0):L(t[0]/n,t[1]/n)},O=t=>L(t[1],-t[0]);function p(t,n){return[t,n]}function Tt(t){return t.length===2?p(t[0],t[1]):void 0}function Ot(t){return t}function I(t,n=p(0,0)){return p(n[0]+t[0],n[1]+t[1])}function S(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&!isNaN(t[0])&&typeof t[1]=="number"&&!isNaN(t[1])}function A(t,n,o=1e-4){let e=Math.abs;return e(t[0]-n[0])<o&&e(t[1]-n[1])<o}function w([t,n],[o,e],r){return p((t-o)*Math.cos(r)-(n-e)*Math.sin(r)+o,(t-o)*Math.sin(r)+(n-e)*Math.cos(r)+e)}function zt(t,n,o){return w(t,n,K(o))}function lt(t,n=[0,0]){return p(t[0]+n[0],t[1]+n[1])}function z(t,n){return p((t[0]+n[0])/2,(t[1]+n[1])/2)}function _(t,n){return Math.hypot(n[0]-t[0],n[1]-t[1])}function Xt(t,n){let o=n[0]-t[0],e=n[1]-t[1];return o*o+e*e}var Yt=(t,n,o)=>lt(n,M(h(t,n),o)),jt=(t,n,o)=>n[0]<=Math.max(t[0],o[0])&&n[0]>=Math.min(t[0],o[0])&&n[1]<=Math.max(t[1],o[1])&&n[1]>=Math.min(t[1],o[1]);var X=[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Y=[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872];function tt(t,n,o,e){return[t,n,o,e]}function $(t,n,o,e=1e-6){return[(t(n+e,o)-t(n-e,o))/(2*e),(t(n,o+e)-t(n,o-e))/(2*e)]}function st(t,n,o,e=.001,r=10){let i=1/0,a=0;for(;i>=e;){if(a>=r)return null;let c=t(n,o),l=[$((f,d)=>t(f,d)[0],n,o),$((f,d)=>t(f,d)[1],n,o)],P=[[-c[0]],[-c[1]]],s=l[0][0]*l[1][1]-l[0][1]*l[1][0];if(s===0)return null;let u=[[l[1][1]/s,-l[0][1]/s],[-l[1][0]/s,l[0][0]/s]],m=[[u[0][0]*P[0][0]+u[0][1]*P[1][0]],[u[1][0]*P[0][0]+u[1][1]*P[1][0]]];n=n+m[0][0],o=o+m[1][0];let[x,b]=t(n,o);i=Math.max(Math.abs(x),Math.abs(b)),a+=1}return[n,o]}var R=(t,n)=>p((1-n)**3*t[0][0]+3*(1-n)**2*n*t[1][0]+3*(1-n)*n**2*t[2][0]+n**3*t[3][0],(1-n)**3*t[0][1]+3*(1-n)**2*n*t[1][1]+3*(1-n)*n**2*t[2][1]+n**3*t[3][1]);function Kt(t,n){let o=a=>p(n[0][0]+a*(n[1][0]-n[0][0]),n[0][1]+a*(n[1][1]-n[0][1])),e=[[.5,0],[.2,0],[.8,0]],r=([a,c])=>{let l=st((u,m)=>{let x=R(t,u),b=o(m);return[x[0]-b[0],x[1]-b[1]]},a,c);if(!l)return null;let[P,s]=l;return P<0||P>1||s<0||s>1?null:R(t,P)},i=r(e[0]);return i?[i]:(i=r(e[1]),i?[i]:(i=r(e[2]),i?[i]:[]))}function Pt(t,n,o=.001){let e=(P,s,u,m=o)=>{let x=P,b=s,f;for(;b-x>m;)f=(b+x)/2,u(f-m)<u(f+m)?b=f:x=f;return f},i=0;for(let P=1/0,s=0;s<30;s++){let u=_(n,R(t,s/30));u<P&&(P=u,i=s)}let a=Math.max((i-1)/30,0),c=Math.min((i+1)/30,1),l=e(a,c,P=>_(n,R(t,P)));return l?R(t,l):null}function Ut(t,n){let o=Pt(t,n);return o?_(n,o):0}function $t(t){return Array.isArray(t)&&t.length===4&&S(t[0])&&S(t[1])&&S(t[2])&&S(t[3])}function j([t,n,o,e],r){return L(-3*(1-r)*(1-r)*t[0]+3*(1-r)*(1-r)*n[0]-6*r*(1-r)*n[0]-3*r*r*o[0]+6*r*(1-r)*o[0]+3*r*r*e[0],-3*(1-r)*(1-r)*t[1]+3*(1-r)*(1-r)*n[1]-6*r*(1-r)*n[1]-3*r*r*o[1]+6*r*(1-r)*o[1]+3*r*r*e[1])}function tn(t,n=.5){if(t.length<2)return;let o=[];for(let e=0;e<t.length-1;e++){let r=t[e-1<0?0:e-1],i=t[e],a=t[e+1>=t.length?t.length-1:e+1],c=i[0]+(a[0]-r[0])*n/2,l=i[1]+(a[1]-r[1])*n/2;o.push([p(c,l),p(a[0],a[1])])}return o}function nn(t,n=.5){if(t.length<2)return;let o=[];for(let e=0;e<t.length-1;e++){let r=t[e-1<0?0:e-1],i=t[e],a=t[e+1>=t.length?t.length-1:e+1],c=t[e+2>=t.length?t.length-1:e+2],l=[(a[0]-r[0])*n,(a[1]-r[1])*n],P=[(c[0]-i[0])*n,(c[1]-i[1])*n],s=i[0]+l[0]/3,u=i[1]+l[1]/3,m=a[0]-P[0]/3,x=a[1]-P[1]/3;o.push(tt(p(i[0],i[1]),p(s,u),p(m,x),p(a[0],a[1])))}return o}function on([t,n,o,e],r,i=50){let a=[];for(let c=0;c<=i;c++){let l=c/i,P=tt(t,n,o,e),s=R(P,l),u=T(j(P,l)),m=O(u);a.push(I(M(m,r),s))}return a}function en(t,n,o,e,r=50){let i=[];for(let a=0;a<=r;a++){let c=a/r,l=1-c,P=p(l*l*t[0]+2*l*c*n[0]+c*c*o[0],l*l*t[1]+2*l*c*n[1]+c*c*o[1]),s=2*(1-c)*(n[0]-t[0])+2*c*(o[0]-n[0]),u=2*(1-c)*(n[1]-t[1])+2*c*(o[1]-n[1]),m=T(L(s,u)),x=O(m);i.push(I(M(x,e),P))}return i}function nt(t){let o=0;for(let e=0;e<24;e++){let r=.5*X[e]+.5,i=j(t,r),a=Math.sqrt(i[0]*i[0]+i[1]*i[1]);o+=Y[e]*a}return .5*o}function ut(t,n){if(n<=0)return 0;if(n>=1)return nt(t);let o=n/2,e=n/2,r=0;for(let i=0;i<24;i++){let a=o*X[i]+e,c=j(t,a),l=Math.sqrt(c[0]*c[0]+c[1]*c[1]);r+=Y[i]*l}return o*r}function rn(t,n){if(n<=0)return R(t,0);if(n>=1)return R(t,1);let o=nt(t),e=o*n,r=0,i=1,a=n,c=0,l=o*1e-4,P=20;for(let s=0;s<P&&(c=ut(t,a),!(Math.abs(c-e)<l));s++)c<e?r=a:i=a,a=(r+i)/2;return R(t,a)}function un(t,n,o){return{center:t,halfWidth:n,halfHeight:o}}var mn=(t,n)=>{let{center:o,halfWidth:e,halfHeight:r}=n,i=(t[0]-o[0])/e,a=(t[1]-o[1])/r;return i*i+a*a<=1},pn=(t,n,o=1e-4)=>mt(t,n)<=o,mt=(t,n)=>{let{halfWidth:o,halfHeight:e,center:r}=n,i=o,a=e,c=F(h(t),M(h(r),-1)),l=Math.abs(c[0]),P=Math.abs(c[1]),s=.707,u=.707;for(let b=0;b<3;b++){let f=i*s,d=a*u,G=(i*i-a*a)*s**3/i,V=(a*a-i*i)*u**3/a,it=f-G,at=d-V,W=l-G,H=P-V,Q=Math.hypot(at,it),J=Math.hypot(H,W);s=Math.min(1,Math.max(0,(W*Q/J+G)/i)),u=Math.min(1,Math.max(0,(H*Q/J+V)/a));let Z=Math.hypot(u,s);s/=Z,u/=Z}let[m,x]=[i*s*Math.sign(c[0]),a*u*Math.sign(c[1])];return _(I(c),p(m,x))};function xn(t,n){let o=t.halfWidth,e=t.halfHeight,r=h(n[1],n[0]),i=L(n[0][0]-t.center[0],n[0][1]-t.center[1]),a=L(r[0]/(o*o),r[1]/(e*e)),c=L(i[0]/(o*o),i[1]/(e*e)),l=E(r,a),P=E(r,c),s=E(i,c)-1,u=P*P-l*s,m=[];if(u>0){let x=(-P-Math.sqrt(u))/l,b=(-P+Math.sqrt(u))/l;0<=x&&x<=1&&m.push(p(n[0][0]+(n[1][0]-n[0][0])*x,n[0][1]+(n[1][1]-n[0][1])*x)),0<=b&&b<=1&&m.push(p(n[0][0]+(n[1][0]-n[0][0])*b,n[0][1]+(n[1][1]-n[0][1])*b))}else if(u===0){let x=-P/l;0<=x&&x<=1&&m.push(p(n[0][0]+(n[1][0]-n[0][0])*x,n[0][1]+(n[1][1]-n[0][1])*x))}return m}function bn({center:t,halfWidth:n,halfHeight:o},[e,r]){let[i,a]=t,c=e[0]-i,l=e[1]-a,P=r[0]-i,s=r[1]-a,u=Math.pow(P-c,2)/Math.pow(n,2)+Math.pow(s-l,2)/Math.pow(o,2),m=2*(c*(P-c)/Math.pow(n,2)+l*(s-l)/Math.pow(o,2)),x=Math.pow(c,2)/Math.pow(n,2)+Math.pow(l,2)/Math.pow(o,2)-1,b=(-m+Math.sqrt(Math.pow(m,2)-4*u*x))/(2*u),f=(-m-Math.sqrt(Math.pow(m,2)-4*u*x))/(2*u),d=[p(c+b*(P-c)+i,l+b*(s-l)+a),p(c+f*(P-c)+i,l+f*(s-l)+a)].filter(G=>!isNaN(G[0])&&!isNaN(G[1]));return d.length===2&&A(d[0],d[1])?[d[0]]:d}function k(t,n){return[t,n]}function ot(t,n){let o=t[1][1]-t[0][1],e=t[0][0]-t[1][0],r=n[1][1]-n[0][1],i=n[0][0]-n[1][0],a=o*i-r*e;if(a!==0){let c=o*t[0][0]+e*t[0][1],l=r*n[0][0]+i*n[0][1];return p((c*i-l*e)/a,(o*l-r*c)/a)}return null}function v(t,n){return[t,n]}var Sn=t=>Array.isArray(t)&&t.length===2&&S(t[0])&&S(t[0]),vn=(t,n,o)=>v(w(t[0],o||z(t[0],t[1]),n),w(t[1],o||z(t[0],t[1]),n)),In=(t,n)=>{let o=h(t[0]),e=h(t[1]),r=h(n[0]),i=h(n[1]),a=D(e,o),c=D(i,r),l=N(a,c);if(l===0)return null;let P=D(h(n[0]),h(t[0])),s=N(P,a)/l,u=N(P,c)/l;if(s===0)return null;let m=F(o,M(a,u));return u>=0&&u<1&&s>=0&&s<1?I(m):null},q=(t,n,o=1e-4)=>{let e=pt(t,n);return e===0?!0:e<o},pt=(t,n)=>{let[o,e]=t,[[r,i],[a,c]]=n,l=o-r,P=e-i,s=a-r,u=c-i,m=l*s+P*u,x=s*s+u*u,b=-1;x!==0&&(b=m/x);let f,d;b<0?(f=r,d=i):b>1?(f=a,d=c):(f=r+b*s,d=i+b*u);let G=o-f,V=e-d;return Math.sqrt(G*G+V*V)};function et(t,n,o){let e=ot(k(t[0],t[1]),k(n[0],n[1]));return!e||!q(e,n,o)||!q(e,t,o)?null:e}function Fn(...t){return rt(t)}function Dn(t){return rt(t)}var An=(t,n)=>{let o=t[0],e=t[1],r=!1;for(let i=0,a=n.length-1;i<n.length;a=i++){let c=n[i][0],l=n[i][1],P=n[a][0],s=n[a][1];(l>e&&s<=e||l<=e&&s>e)&&o<(P-c)*(e-l)/(s-l)+c&&(r=!r)}return r},wn=(t,n)=>{let[o,e]=t,r=0;for(let i=0;i<n.length;i++){let a=(i+1)%n.length,[c,l]=n[i],[P,s]=n[a];l<=e?s>e&&(P-c)*(e-l)-(o-c)*(s-l)>0&&r++:s<=e&&(P-c)*(e-l)-(o-c)*(s-l)<0&&r--}return r!==0},qn=(t,n,o=1e-4)=>{let e=!1;for(let r=0,i=n.length-1;r<i;r++)if(q(t,v(n[r],n[r+1]),o)){e=!0;break}return e};function rt(t){return xt(t)?t:[...t,t[0]]}function xt(t){return A(t[0],t[t.length-1])}import{toBrandedType as B}from"@excalidraw/common";function Xn(t,n){return B([t,n])}function Yn(t){return B(t)}var jn=([t,n],[o,e])=>t<=o?n>=o:t>=o?e>=t:!1,kn=([t,n],[o,e])=>{let r=Math.max(t,o),i=Math.min(n,e);return r<=i?B([r,i]):null},Bn=(t,[n,o])=>t>=n&&t<=o;function bt(t,n){return[t,n]}function Zn(t,n,o,e){return bt(p(t,n),p(o,e))}function Kn(t,n){return[v(t[0],p(t[1][0],t[0][1])),v(p(t[1][0],t[0][1]),t[1]),v(t[1],p(t[0][0],t[1][1])),v(p(t[0][0],t[1][1]),t[0])].map(o=>et(n,o)).filter(o=>!!o)}function Un(t,n){let[[o,e],[r,i]]=t,[[a,c],[l,P]]=n;return o<l&&r>a&&e<P&&i>c}function no([t,n,o],e){let r=(s,u,m)=>(s[0]-m[0])*(u[1]-m[1])-(u[0]-m[0])*(s[1]-m[1]),i=r(e,t,n),a=r(e,n,o),c=r(e,o,t),l=i<0||a<0||c<0,P=i>0||a>0||c>0;return!(l&&P)}export{y as PRECISION,ht as average,R as bezierEquation,St as cartesian2Polar,ft as clamp,tt as curve,nn as curveCatmullRomCubicApproxPoints,tn as curveCatmullRomQuadraticApproxPoints,Pt as curveClosestPoint,Kt as curveIntersectLineSegment,nt as curveLength,ut as curveLengthAtParameter,on as curveOffsetPoints,rn as curvePointAtLength,Ut as curvePointDistance,j as curveTangent,K as degreesToRadians,pt as distanceToLineSegment,un as ellipse,mt as ellipseDistanceFromPoint,mn as ellipseIncludesPoint,bn as ellipseLineIntersectionPoints,xn as ellipseSegmentInterceptPoints,pn as ellipseTouchesPoint,yt as isCloseTo,$t as isCurve,Lt as isFiniteNumber,Sn as isLineSegment,S as isPoint,jt as isPointWithinBounds,It as isRightAngleRads,Et as isVector,k as line,v as lineSegment,et as lineSegmentIntersectionPoints,vn as lineSegmentRotate,ot as linesIntersectAt,C as normalizeRadians,en as offsetPointsForQuadraticBezier,z as pointCenter,_ as pointDistance,Xt as pointDistanceSq,p as pointFrom,Tt as pointFromArray,Ot as pointFromPair,I as pointFromVector,q as pointOnLineSegment,qn as pointOnPolygon,zt as pointRotateDegs,w as pointRotateRads,Yt as pointScaleFromOrigin,lt as pointTranslate,A as pointsEqual,Fn as polygon,Dn as polygonFromPoints,An as polygonIncludesPoint,wn as polygonIncludesPointNonZero,Vt as radiansBetweenAngles,Ct as radiansDifference,vt as radiansToDegrees,Bn as rangeIncludesValue,Xn as rangeInclusive,Yn as rangeInclusiveFromPair,kn as rangeIntersection,jn as rangesOverlap,bt as rectangle,Zn as rectangleFromNumberSequence,Kn as rectangleIntersectLineSegment,Un as rectangleIntersectRectangle,dt as round,gt as roundToStep,In as segmentsIntersectAt,no as triangleIncludesPoint,L as vector,F as vectorAdd,N as vectorCross,E as vectorDot,h as vectorFromPoint,ct as vectorMagnitude,U as vectorMagnitudeSq,O as vectorNormal,T as vectorNormalize,M as vectorScale,D as vectorSubtract};
|
|
1
|
+
var M=1e-4,Lt=(t,n,o)=>Math.min(Math.max(t,n),o),gt=(t,n,o="round")=>{let e=Math.pow(10,n);return Math[o]((t+Number.EPSILON)*e)/e},ht=(t,n,o="round")=>{let e=1/n;return Math[o](t*e)/e},yt=(t,n)=>(t+n)/2,Gt=t=>typeof t=="number"&&Number.isFinite(t),Mt=(t,n,o=1e-4)=>Math.abs(t-n)<o;var v=t=>t<0?t%(2*Math.PI)+2*Math.PI:t%(2*Math.PI),Ct=([t,n])=>[Math.hypot(t,n),v(Math.atan2(n,t))];function et(t){return t*Math.PI/180}function _t(t){return t*180/Math.PI}function vt(t){return Math.abs(Math.sin(2*t))<1e-4}function Vt(t,n,o){return t=v(t),n=v(n),o=v(o),n<o?t>=n&&t<=o:t>=n||t<=o}function Nt(t,n){t=v(t),n=v(n);let o=t-n;return o<-Math.PI?o=o+2*Math.PI:o>Math.PI&&(o=o-2*Math.PI),Math.abs(o)}function y(t,n,o=0,e=0){return[t-o,n-e]}function h(t,n=[0,0],o,e=[0,1]){let r=y(t[0]-n[0],t[1]-n[1]);return o&&rt(r)<o*o?e:r}function z(t,n){return t[0]*n[1]-n[0]*t[1]}function O(t,n){return t[0]*n[0]+t[1]*n[1]}function Et(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&!isNaN(t[0])&&typeof t[1]=="number"&&!isNaN(t[1])}function X(t,n){return[t[0]+n[0],t[1]+n[1]]}function Y(t,n){return[t[0]-n[0],t[1]-n[1]]}function R(t,n){return y(t[0]*n,t[1]*n)}function rt(t){return t[0]*t[0]+t[1]*t[1]}function Pt(t){return Math.sqrt(rt(t))}var W=t=>{let n=Pt(t);return n===0?y(0,0):y(t[0]/n,t[1]/n)},H=t=>y(t[1],-t[0]);function x(t,n){return typeof t=="object"?[t.x,t.y]:[t,n]}function Ot(t){return t.length===2?x(t[0],t[1]):void 0}function Xt(t){return t}function _(t,n=x(0,0)){return x(n[0]+t[0],n[1]+t[1])}function S(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="number"&&!isNaN(t[0])&&typeof t[1]=="number"&&!isNaN(t[1])}function k(t,n,o=1e-4){let e=Math.abs;return e(t[0]-n[0])<o&&e(t[1]-n[1])<o}function j(t,n,o){if(!o)return t;let[e,r]=t,[i,a]=n;return x((e-i)*Math.cos(o)-(r-a)*Math.sin(o)+i,(e-i)*Math.sin(o)+(r-a)*Math.cos(o)+a)}function Yt(t,n,o){return j(t,n,et(o))}function ut(t,n=[0,0]){return x(t[0]+n[0],t[1]+n[1])}function Q(t,n){return x((t[0]+n[0])/2,(t[1]+n[1])/2)}function V(t,n){return Math.hypot(n[0]-t[0],n[1]-t[1])}function kt(t,n){let o=n[0]-t[0],e=n[1]-t[1];return o*o+e*e}var jt=(t,n,o)=>ut(n,R(h(t,n),o)),Bt=(t,n,o)=>n[0]<=Math.max(t[0],o[0])&&n[0]>=Math.min(t[0],o[0])&&n[1]<=Math.max(t[1],o[1])&&n[1]>=Math.min(t[1],o[1]);var J=[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Z=[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872];function it(t,n,o,e){return[t,n,o,e]}function mt(t,n,o,e,r=.001,i=10){let a=1/0,l=0;for(;a>=r;){if(l>=i)return null;let c=1-o,P=c*c,s=P*c,u=o*o,m=u*o,p=s*t[0][0]+3*P*o*t[1][0]+3*c*u*t[2][0]+m*t[3][0],b=s*t[0][1]+3*P*o*t[1][1]+3*c*u*t[2][1]+m*t[3][1],f=n[0][0]+e*(n[1][0]-n[0][0]),d=n[0][1]+e*(n[1][1]-n[0][1]),g=p-f,G=b-d;if(a=Math.abs(g)+Math.abs(G),a<r)break;let w=-3*P*t[0][0]+3*P*t[1][0]-6*c*o*t[1][0]-3*u*t[2][0]+6*c*o*t[2][0]+3*u*t[3][0],q=-3*P*t[0][1]+3*P*t[1][1]-6*c*o*t[1][1]-3*u*t[2][1]+6*c*o*t[2][1]+3*u*t[3][1],N=-(n[1][0]-n[0][0]),F=-(n[1][1]-n[0][1]),D=w*F-N*q;if(Math.abs(D)<1e-12)return null;let E=1/D,T=E*(F*-g-N*-G),st=E*(-q*-g+w*-G);o+=T,e+=st,l+=1}return[o,e]}var I=(t,n)=>x((1-n)**3*t[0][0]+3*(1-n)**2*n*t[1][0]+3*(1-n)*n**2*t[2][0]+n**3*t[3][0],(1-n)**3*t[0][1]+3*(1-n)**2*n*t[1][1]+3*(1-n)*n**2*t[2][1]+n**3*t[3][1]),K=[[.5,0],[.2,0],[.8,0]],U=([t,n],o,e,r=.01,i=4)=>{let a=mt(e,o,t,n,r,i);if(!a)return null;let[l,c]=a;return l<0||l>1||c<0||c>1?null:I(e,l)};function $t(t,n,o){let e=U(K[0],n,t,o?.tolerance,o?.iterLimit);return e?[e]:(e=U(K[1],n,t,o?.tolerance,o?.iterLimit),e?[e]:(e=U(K[2],n,t,o?.tolerance,o?.iterLimit),e?[e]:[]))}function xt(t,n,o=.001){let e=(P,s,u,m=o)=>{let p=P,b=s,f;for(;b-p>m;)f=(b+p)/2,u(f-m)<u(f+m)?b=f:p=f;return f},i=0;for(let P=1/0,s=0;s<30;s++){let u=V(n,I(t,s/30));u<P&&(P=u,i=s)}let a=Math.max((i-1)/30,0),l=Math.min((i+1)/30,1),c=e(a,l,P=>V(n,I(t,P)));return c?I(t,c):null}function tn(t,n){let o=xt(t,n);return o?V(n,o):0}function nn(t){return Array.isArray(t)&&t.length===4&&S(t[0])&&S(t[1])&&S(t[2])&&S(t[3])}function $([t,n,o,e],r){return y(-3*(1-r)*(1-r)*t[0]+3*(1-r)*(1-r)*n[0]-6*r*(1-r)*n[0]-3*r*r*o[0]+6*r*(1-r)*o[0]+3*r*r*e[0],-3*(1-r)*(1-r)*t[1]+3*(1-r)*(1-r)*n[1]-6*r*(1-r)*n[1]-3*r*r*o[1]+6*r*(1-r)*o[1]+3*r*r*e[1])}function on(t,n=.5){if(t.length<2)return;let o=[];for(let e=0;e<t.length-1;e++){let r=t[e-1<0?0:e-1],i=t[e],a=t[e+1>=t.length?t.length-1:e+1],l=i[0]+(a[0]-r[0])*n/2,c=i[1]+(a[1]-r[1])*n/2;o.push([x(l,c),x(a[0],a[1])])}return o}function en(t,n=.5){if(t.length<2)return;let o=[];for(let e=0;e<t.length-1;e++){let r=t[e-1<0?0:e-1],i=t[e],a=t[e+1>=t.length?t.length-1:e+1],l=t[e+2>=t.length?t.length-1:e+2],c=[(a[0]-r[0])*n,(a[1]-r[1])*n],P=[(l[0]-i[0])*n,(l[1]-i[1])*n],s=i[0]+c[0]/3,u=i[1]+c[1]/3,m=a[0]-P[0]/3,p=a[1]-P[1]/3;o.push(it(x(i[0],i[1]),x(s,u),x(m,p),x(a[0],a[1])))}return o}function rn([t,n,o,e],r,i=50){let a=[];for(let l=0;l<=i;l++){let c=l/i,P=it(t,n,o,e),s=I(P,c),u=W($(P,c)),m=H(u);a.push(_(R(m,r),s))}return a}function an(t,n,o,e,r=50){let i=[];for(let a=0;a<=r;a++){let l=a/r,c=1-l,P=x(c*c*t[0]+2*c*l*n[0]+l*l*o[0],c*c*t[1]+2*c*l*n[1]+l*l*o[1]),s=2*(1-l)*(n[0]-t[0])+2*l*(o[0]-n[0]),u=2*(1-l)*(n[1]-t[1])+2*l*(o[1]-n[1]),m=W(y(s,u)),p=H(m);i.push(_(R(p,e),P))}return i}function at(t){let o=0;for(let e=0;e<24;e++){let r=.5*J[e]+.5,i=$(t,r),a=Math.sqrt(i[0]*i[0]+i[1]*i[1]);o+=Z[e]*a}return .5*o}function pt(t,n){if(n<=0)return 0;if(n>=1)return at(t);let o=n/2,e=n/2,r=0;for(let i=0;i<24;i++){let a=o*J[i]+e,l=$(t,a),c=Math.sqrt(l[0]*l[0]+l[1]*l[1]);r+=Z[i]*c}return o*r}function ln(t,n){if(n<=0)return I(t,0);if(n>=1)return I(t,1);let o=at(t),e=o*n,r=0,i=1,a=n,l=0,c=o*1e-4,P=20;for(let s=0;s<P&&(l=pt(t,a),!(Math.abs(l-e)<c));s++)l<e?r=a:i=a,a=(r+i)/2;return I(t,a)}function xn(t,n,o){return{center:t,halfWidth:n,halfHeight:o}}var pn=(t,n)=>{let{center:o,halfWidth:e,halfHeight:r}=n,i=(t[0]-o[0])/e,a=(t[1]-o[1])/r;return i*i+a*a<=1},bn=(t,n,o=1e-4)=>bt(t,n)<=o,bt=(t,n)=>{let{halfWidth:o,halfHeight:e,center:r}=n,i=o,a=e,l=X(h(t),R(h(r),-1)),c=Math.abs(l[0]),P=Math.abs(l[1]),s=.707,u=.707;for(let b=0;b<3;b++){let f=i*s,d=a*u,g=(i*i-a*a)*s**3/i,G=(a*a-i*i)*u**3/a,w=f-g,q=d-G,N=c-g,F=P-G,D=Math.hypot(q,w),E=Math.hypot(F,N);s=Math.min(1,Math.max(0,(N*D/E+g)/i)),u=Math.min(1,Math.max(0,(F*D/E+G)/a));let T=Math.hypot(u,s);s/=T,u/=T}let[m,p]=[i*s*Math.sign(l[0]),a*u*Math.sign(l[1])];return V(_(l),x(m,p))};function fn(t,n){let o=t.halfWidth,e=t.halfHeight,r=h(n[1],n[0]),i=y(n[0][0]-t.center[0],n[0][1]-t.center[1]),a=y(r[0]/(o*o),r[1]/(e*e)),l=y(i[0]/(o*o),i[1]/(e*e)),c=O(r,a),P=O(r,l),s=O(i,l)-1,u=P*P-c*s,m=[];if(u>0){let p=(-P-Math.sqrt(u))/c,b=(-P+Math.sqrt(u))/c;0<=p&&p<=1&&m.push(x(n[0][0]+(n[1][0]-n[0][0])*p,n[0][1]+(n[1][1]-n[0][1])*p)),0<=b&&b<=1&&m.push(x(n[0][0]+(n[1][0]-n[0][0])*b,n[0][1]+(n[1][1]-n[0][1])*b))}else if(u===0){let p=-P/c;0<=p&&p<=1&&m.push(x(n[0][0]+(n[1][0]-n[0][0])*p,n[0][1]+(n[1][1]-n[0][1])*p))}return m}function dn({center:t,halfWidth:n,halfHeight:o},[e,r]){let[i,a]=t,l=e[0]-i,c=e[1]-a,P=r[0]-i,s=r[1]-a,u=Math.pow(P-l,2)/Math.pow(n,2)+Math.pow(s-c,2)/Math.pow(o,2),m=2*(l*(P-l)/Math.pow(n,2)+c*(s-c)/Math.pow(o,2)),p=Math.pow(l,2)/Math.pow(n,2)+Math.pow(c,2)/Math.pow(o,2)-1,b=(-m+Math.sqrt(Math.pow(m,2)-4*u*p))/(2*u),f=(-m-Math.sqrt(Math.pow(m,2)-4*u*p))/(2*u),d=[x(l+b*(P-l)+i,c+b*(s-c)+a),x(l+f*(P-l)+i,c+f*(s-c)+a)].filter(g=>!isNaN(g[0])&&!isNaN(g[1]));return d.length===2&&k(d[0],d[1])?[d[0]]:d}function tt(t,n){return[t,n]}function lt(t,n){let o=t[1][1]-t[0][1],e=t[0][0]-t[1][0],r=n[1][1]-n[0][1],i=n[0][0]-n[1][0],a=o*i-r*e;if(a!==0){let l=o*t[0][0]+e*t[0][1],c=r*n[0][0]+i*n[0][1];return x((l*i-c*e)/a,(o*c-r*l)/a)}return null}function C(t,n){return[t,n]}var Cn=t=>Array.isArray(t)&&t.length===2&&S(t[0])&&S(t[1]),_n=(t,n,o)=>C(j(t[0],o||Q(t[0],t[1]),n),j(t[1],o||Q(t[0],t[1]),n)),vn=(t,n)=>{let o=h(t[0]),e=h(t[1]),r=h(n[0]),i=h(n[1]),a=Y(e,o),l=Y(i,r),c=z(a,l);if(c===0)return null;let P=Y(h(n[0]),h(t[0])),s=z(P,a)/c,u=z(P,l)/c;if(s===0)return null;let m=X(o,R(a,u));return u>=0&&u<1&&s>=0&&s<1?_(m):null},B=(t,n,o=1e-4)=>{let e=A(t,n);return e===0?!0:e<o},A=(t,n)=>{let[o,e]=t,[[r,i],[a,l]]=n,c=o-r,P=e-i,s=a-r,u=l-i,m=c*s+P*u,p=s*s+u*u,b=-1;p!==0&&(b=m/p);let f,d;b<0?(f=r,d=i):b>1?(f=a,d=l):(f=r+b*s,d=i+b*u);let g=o-f,G=e-d;return Math.sqrt(g*g+G*G)};function nt(t,n,o){let e=lt(tt(t[0],t[1]),tt(n[0],n[1]));return!e||!B(e,n,o)||!B(e,t,o)?null:e}function Vn(t,n){return nt(t,n)?0:Math.min(A(t[0],n),A(t[1],n),A(n[0],t),A(n[1],t))}function wn(...t){return ct(t)}function qn(t){return ct(t)}var Tn=(t,n)=>{let o=t[0],e=t[1],r=!1;for(let i=0,a=n.length-1;i<n.length;a=i++){let l=n[i][0],c=n[i][1],P=n[a][0],s=n[a][1];(c>e&&s<=e||c<=e&&s>e)&&o<(P-l)*(e-c)/(s-c)+l&&(r=!r)}return r},zn=(t,n)=>{let[o,e]=t,r=0;for(let i=0;i<n.length;i++){let a=(i+1)%n.length,[l,c]=n[i],[P,s]=n[a];c<=e?s>e&&(P-l)*(e-c)-(o-l)*(s-c)>0&&r++:s<=e&&(P-l)*(e-c)-(o-l)*(s-c)<0&&r--}return r!==0},On=(t,n,o=1e-4)=>{let e=!1;for(let r=0,i=n.length-1;r<i;r++)if(B(t,C(n[r],n[r+1]),o)){e=!0;break}return e};function ct(t){return ft(t)?t:[...t,t[0]]}function ft(t){return k(t[0],t[t.length-1])}import{toBrandedType as ot}from"@excalidraw/common";function jn(t,n){return ot([t,n])}function Bn(t){return ot(t)}var Wn=([t,n],[o,e])=>t<=o?n>=o:t>=o?e>=t:!1,Hn=([t,n],[o,e])=>{let r=Math.max(t,o),i=Math.min(n,e);return r<=i?ot([r,i]):null},Qn=(t,[n,o])=>t>=n&&t<=o;function dt(t,n){return[t,n]}function $n(t,n,o,e){return dt(x(t,n),x(o,e))}function to(t,n){return[C(t[0],x(t[1][0],t[0][1])),C(x(t[1][0],t[0][1]),t[1]),C(t[1],x(t[0][0],t[1][1])),C(x(t[0][0],t[1][1]),t[0])].map(o=>nt(n,o)).filter(o=>!!o)}function no(t,n){let[[o,e],[r,i]]=t,[[a,l],[c,P]]=n;return o<c&&r>a&&e<P&&i>l}function ro([t,n,o],e){let r=(s,u,m)=>(s[0]-m[0])*(u[1]-m[1])-(u[0]-m[0])*(s[1]-m[1]),i=r(e,t,n),a=r(e,n,o),l=r(e,o,t),c=i<0||a<0||l<0,P=i>0||a>0||l>0;return!(c&&P)}export{M as PRECISION,yt as average,I as bezierEquation,Ct as cartesian2Polar,Lt as clamp,it as curve,en as curveCatmullRomCubicApproxPoints,on as curveCatmullRomQuadraticApproxPoints,xt as curveClosestPoint,$t as curveIntersectLineSegment,at as curveLength,pt as curveLengthAtParameter,rn as curveOffsetPoints,ln as curvePointAtLength,tn as curvePointDistance,$ as curveTangent,et as degreesToRadians,A as distanceToLineSegment,xn as ellipse,bt as ellipseDistanceFromPoint,pn as ellipseIncludesPoint,dn as ellipseLineIntersectionPoints,fn as ellipseSegmentInterceptPoints,bn as ellipseTouchesPoint,Mt as isCloseTo,nn as isCurve,Gt as isFiniteNumber,Cn as isLineSegment,S as isPoint,Bt as isPointWithinBounds,vt as isRightAngleRads,Et as isVector,tt as line,C as lineSegment,nt as lineSegmentIntersectionPoints,_n as lineSegmentRotate,Vn as lineSegmentsDistance,lt as linesIntersectAt,v as normalizeRadians,an as offsetPointsForQuadraticBezier,Q as pointCenter,V as pointDistance,kt as pointDistanceSq,x as pointFrom,Ot as pointFromArray,Xt as pointFromPair,_ as pointFromVector,B as pointOnLineSegment,On as pointOnPolygon,Yt as pointRotateDegs,j as pointRotateRads,jt as pointScaleFromOrigin,ut as pointTranslate,k as pointsEqual,wn as polygon,qn as polygonFromPoints,Tn as polygonIncludesPoint,zn as polygonIncludesPointNonZero,Vt as radiansBetweenAngles,Nt as radiansDifference,_t as radiansToDegrees,Qn as rangeIncludesValue,jn as rangeInclusive,Bn as rangeInclusiveFromPair,Hn as rangeIntersection,Wn as rangesOverlap,dt as rectangle,$n as rectangleFromNumberSequence,to as rectangleIntersectLineSegment,no as rectangleIntersectRectangle,gt as round,ht as roundToStep,vn as segmentsIntersectAt,ro as triangleIncludesPoint,y as vector,X as vectorAdd,z as vectorCross,O as vectorDot,h as vectorFromPoint,Pt as vectorMagnitude,rt as vectorMagnitudeSq,H as vectorNormal,W as vectorNormalize,R as vectorScale,Y as vectorSubtract};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare class Debug {
|
|
2
|
+
static DEBUG_LOG_TIMES: boolean;
|
|
3
|
+
private static TIMES_AGGR;
|
|
4
|
+
private static TIMES_AVG;
|
|
5
|
+
private static LAST_DEBUG_LOG_CALL;
|
|
6
|
+
private static DEBUG_LOG_INTERVAL_ID;
|
|
7
|
+
private static LAST_FRAME_TIMESTAMP;
|
|
8
|
+
private static FRAME_COUNT;
|
|
9
|
+
private static ANIMATION_FRAME_ID;
|
|
10
|
+
private static scheduleAnimationFrame;
|
|
11
|
+
private static setupInterval;
|
|
12
|
+
private static debugLogger;
|
|
13
|
+
static logTime: (time?: number, name?: string) => void;
|
|
14
|
+
static logTimeAverage: (time?: number, name?: string) => void;
|
|
15
|
+
private static logWrapper;
|
|
16
|
+
static logTimeWrap: <T extends any[], R>(fn: (...args: T) => R, name?: string) => (...args: T) => R;
|
|
17
|
+
static logTimeAverageWrap: <T extends any[], R>(fn: (...args: T) => R, name?: string) => (...args: T) => R;
|
|
18
|
+
static perfWrap: <T extends any[], R>(fn: (...args: T) => R, name?: string) => (...args: T) => R;
|
|
19
|
+
private static CHANGED_CACHE;
|
|
20
|
+
static logChanged(name: string, obj: Record<string, unknown>): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { UnsubscribeCallback } from "@excalidraw/excalidraw/types";
|
|
2
|
+
export type AppEventPayloadMap = Record<string, unknown[]>;
|
|
3
|
+
export type AppEventBehavior = {
|
|
4
|
+
cardinality: "once" | "many";
|
|
5
|
+
replay: "none" | "last";
|
|
6
|
+
};
|
|
7
|
+
export type AppEventBehaviorMap<Events extends AppEventPayloadMap> = {
|
|
8
|
+
[K in keyof Events]: AppEventBehavior;
|
|
9
|
+
};
|
|
10
|
+
type AwaitableAppEventKeys<Events extends AppEventPayloadMap, Behavior extends AppEventBehaviorMap<Events>> = {
|
|
11
|
+
[K in keyof Events]: Behavior[K]["cardinality"] extends "once" ? Behavior[K]["replay"] extends "last" ? K : never : never;
|
|
12
|
+
}[keyof Events];
|
|
13
|
+
type AppEventPromiseValue<Args extends any[]> = Args extends [infer Only] ? Only : Args;
|
|
14
|
+
export declare class AppEventBus<Events extends AppEventPayloadMap, Behavior extends AppEventBehaviorMap<Events>> {
|
|
15
|
+
private readonly behavior;
|
|
16
|
+
private readonly emitters;
|
|
17
|
+
private readonly lastPayload;
|
|
18
|
+
private readonly emittedOnce;
|
|
19
|
+
constructor(behavior: Behavior);
|
|
20
|
+
private getEmitter;
|
|
21
|
+
private toPromiseValue;
|
|
22
|
+
on<K extends keyof Events>(name: K, callback: (...args: Events[K]) => void): UnsubscribeCallback;
|
|
23
|
+
on<K extends AwaitableAppEventKeys<Events, Behavior>>(name: K): Promise<AppEventPromiseValue<Events[K]>>;
|
|
24
|
+
emit<K extends keyof Events>(name: K, ...args: Events[K]): void;
|
|
25
|
+
clear(): void;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import type { Merge } from "./utility-types";
|
|
3
|
-
export declare const COLOR_OUTLINE_CONTRAST_THRESHOLD = 240;
|
|
4
|
-
export type ColorPickerColor = Exclude<keyof oc, "indigo" | "lime"> | "transparent" | "bronze";
|
|
1
|
+
export declare const applyDarkModeFilter: (color: string) => string;
|
|
5
2
|
export type ColorTuple = readonly [string, string, string, string, string];
|
|
6
|
-
export type ColorPalette = Merge<Record<ColorPickerColor, ColorTuple>, {
|
|
7
|
-
black: "#1e1e1e";
|
|
8
|
-
white: "#ffffff";
|
|
9
|
-
transparent: "transparent";
|
|
10
|
-
}>;
|
|
11
3
|
export type ColorPaletteCustom = {
|
|
12
4
|
[key: string]: ColorTuple | string;
|
|
13
5
|
};
|
|
@@ -17,46 +9,74 @@ export declare const COLORS_PER_ROW = 5;
|
|
|
17
9
|
export declare const DEFAULT_CHART_COLOR_INDEX = 4;
|
|
18
10
|
export declare const DEFAULT_ELEMENT_STROKE_COLOR_INDEX = 4;
|
|
19
11
|
export declare const DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX = 1;
|
|
20
|
-
export declare const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
12
|
+
export declare const COLOR_PALETTE: {
|
|
13
|
+
readonly transparent: "transparent";
|
|
14
|
+
readonly black: "#1e1e1e";
|
|
15
|
+
readonly white: "#ffffff";
|
|
16
|
+
readonly gray: readonly ["#f8f9fa", "#e9ecef", "#ced4da", "#868e96", "#343a40"];
|
|
17
|
+
readonly red: readonly ["#fff5f5", "#ffc9c9", "#ff8787", "#fa5252", "#e03131"];
|
|
18
|
+
readonly pink: readonly ["#fff0f6", "#fcc2d7", "#f783ac", "#e64980", "#c2255c"];
|
|
19
|
+
readonly grape: readonly ["#f8f0fc", "#eebefa", "#da77f2", "#be4bdb", "#9c36b5"];
|
|
20
|
+
readonly violet: readonly ["#f3f0ff", "#d0bfff", "#9775fa", "#7950f2", "#6741d9"];
|
|
21
|
+
readonly blue: readonly ["#e7f5ff", "#a5d8ff", "#4dabf7", "#228be6", "#1971c2"];
|
|
22
|
+
readonly cyan: readonly ["#e3fafc", "#99e9f2", "#3bc9db", "#15aabf", "#0c8599"];
|
|
23
|
+
readonly teal: readonly ["#e6fcf5", "#96f2d7", "#38d9a9", "#12b886", "#099268"];
|
|
24
|
+
readonly green: readonly ["#ebfbee", "#b2f2bb", "#69db7c", "#40c057", "#2f9e44"];
|
|
25
|
+
readonly yellow: readonly ["#fff9db", "#ffec99", "#ffd43b", "#fab005", "#f08c00"];
|
|
26
|
+
readonly orange: readonly ["#fff4e6", "#ffd8a8", "#ffa94d", "#fd7e14", "#e8590c"];
|
|
27
|
+
readonly bronze: readonly ["#f8f1ee", "#eaddd7", "#d2bab0", "#a18072", "#846358"];
|
|
28
|
+
};
|
|
29
|
+
export type ColorPalette = typeof COLOR_PALETTE;
|
|
30
|
+
export type ColorPickerColor = keyof typeof COLOR_PALETTE;
|
|
24
31
|
export declare const DEFAULT_ELEMENT_STROKE_PICKS: ColorTuple;
|
|
25
32
|
export declare const DEFAULT_ELEMENT_BACKGROUND_PICKS: ColorTuple;
|
|
26
33
|
export declare const DEFAULT_CANVAS_BACKGROUND_PICKS: ColorTuple;
|
|
27
34
|
export declare const DEFAULT_ELEMENT_STROKE_COLOR_PALETTE: {
|
|
28
|
-
readonly
|
|
29
|
-
readonly
|
|
30
|
-
readonly
|
|
31
|
-
readonly
|
|
32
|
-
readonly
|
|
33
|
-
readonly
|
|
34
|
-
readonly teal:
|
|
35
|
-
readonly
|
|
36
|
-
readonly
|
|
37
|
-
readonly
|
|
35
|
+
readonly cyan: readonly ["#e3fafc", "#99e9f2", "#3bc9db", "#15aabf", "#0c8599"];
|
|
36
|
+
readonly blue: readonly ["#e7f5ff", "#a5d8ff", "#4dabf7", "#228be6", "#1971c2"];
|
|
37
|
+
readonly violet: readonly ["#f3f0ff", "#d0bfff", "#9775fa", "#7950f2", "#6741d9"];
|
|
38
|
+
readonly grape: readonly ["#f8f0fc", "#eebefa", "#da77f2", "#be4bdb", "#9c36b5"];
|
|
39
|
+
readonly pink: readonly ["#fff0f6", "#fcc2d7", "#f783ac", "#e64980", "#c2255c"];
|
|
40
|
+
readonly green: readonly ["#ebfbee", "#b2f2bb", "#69db7c", "#40c057", "#2f9e44"];
|
|
41
|
+
readonly teal: readonly ["#e6fcf5", "#96f2d7", "#38d9a9", "#12b886", "#099268"];
|
|
42
|
+
readonly yellow: readonly ["#fff9db", "#ffec99", "#ffd43b", "#fab005", "#f08c00"];
|
|
43
|
+
readonly orange: readonly ["#fff4e6", "#ffd8a8", "#ffa94d", "#fd7e14", "#e8590c"];
|
|
44
|
+
readonly red: readonly ["#fff5f5", "#ffc9c9", "#ff8787", "#fa5252", "#e03131"];
|
|
38
45
|
readonly transparent: "transparent";
|
|
39
46
|
readonly white: "#ffffff";
|
|
40
|
-
readonly gray:
|
|
47
|
+
readonly gray: readonly ["#f8f9fa", "#e9ecef", "#ced4da", "#868e96", "#343a40"];
|
|
41
48
|
readonly black: "#1e1e1e";
|
|
42
|
-
readonly bronze:
|
|
49
|
+
readonly bronze: readonly ["#f8f1ee", "#eaddd7", "#d2bab0", "#a18072", "#846358"];
|
|
43
50
|
};
|
|
44
51
|
export declare const DEFAULT_ELEMENT_BACKGROUND_COLOR_PALETTE: {
|
|
45
|
-
readonly
|
|
46
|
-
readonly
|
|
47
|
-
readonly
|
|
48
|
-
readonly
|
|
49
|
-
readonly
|
|
50
|
-
readonly
|
|
51
|
-
readonly teal:
|
|
52
|
-
readonly
|
|
53
|
-
readonly
|
|
54
|
-
readonly
|
|
52
|
+
readonly cyan: readonly ["#e3fafc", "#99e9f2", "#3bc9db", "#15aabf", "#0c8599"];
|
|
53
|
+
readonly blue: readonly ["#e7f5ff", "#a5d8ff", "#4dabf7", "#228be6", "#1971c2"];
|
|
54
|
+
readonly violet: readonly ["#f3f0ff", "#d0bfff", "#9775fa", "#7950f2", "#6741d9"];
|
|
55
|
+
readonly grape: readonly ["#f8f0fc", "#eebefa", "#da77f2", "#be4bdb", "#9c36b5"];
|
|
56
|
+
readonly pink: readonly ["#fff0f6", "#fcc2d7", "#f783ac", "#e64980", "#c2255c"];
|
|
57
|
+
readonly green: readonly ["#ebfbee", "#b2f2bb", "#69db7c", "#40c057", "#2f9e44"];
|
|
58
|
+
readonly teal: readonly ["#e6fcf5", "#96f2d7", "#38d9a9", "#12b886", "#099268"];
|
|
59
|
+
readonly yellow: readonly ["#fff9db", "#ffec99", "#ffd43b", "#fab005", "#f08c00"];
|
|
60
|
+
readonly orange: readonly ["#fff4e6", "#ffd8a8", "#ffa94d", "#fd7e14", "#e8590c"];
|
|
61
|
+
readonly red: readonly ["#fff5f5", "#ffc9c9", "#ff8787", "#fa5252", "#e03131"];
|
|
55
62
|
readonly transparent: "transparent";
|
|
56
63
|
readonly white: "#ffffff";
|
|
57
|
-
readonly gray:
|
|
64
|
+
readonly gray: readonly ["#f8f9fa", "#e9ecef", "#ced4da", "#868e96", "#343a40"];
|
|
58
65
|
readonly black: "#1e1e1e";
|
|
59
|
-
readonly bronze:
|
|
66
|
+
readonly bronze: readonly ["#f8f1ee", "#eaddd7", "#d2bab0", "#a18072", "#846358"];
|
|
60
67
|
};
|
|
61
|
-
export declare const getAllColorsSpecificShade: (index: 0 | 1 | 2 | 3 | 4) =>
|
|
62
|
-
export declare const rgbToHex: (r: number, g: number, b: number) => string;
|
|
68
|
+
export declare const getAllColorsSpecificShade: (index: 0 | 1 | 2 | 3 | 4) => ("#fff5f5" | "#ffc9c9" | "#ff8787" | "#fa5252" | "#e03131" | "#fff0f6" | "#fcc2d7" | "#f783ac" | "#e64980" | "#c2255c" | "#f8f0fc" | "#eebefa" | "#da77f2" | "#be4bdb" | "#9c36b5" | "#f3f0ff" | "#d0bfff" | "#9775fa" | "#7950f2" | "#6741d9" | "#e7f5ff" | "#a5d8ff" | "#4dabf7" | "#228be6" | "#1971c2" | "#e3fafc" | "#99e9f2" | "#3bc9db" | "#15aabf" | "#0c8599" | "#e6fcf5" | "#96f2d7" | "#38d9a9" | "#12b886" | "#099268" | "#ebfbee" | "#b2f2bb" | "#69db7c" | "#40c057" | "#2f9e44" | "#fff9db" | "#ffec99" | "#ffd43b" | "#fab005" | "#f08c00" | "#fff4e6" | "#ffd8a8" | "#ffa94d" | "#fd7e14" | "#e8590c")[];
|
|
69
|
+
export declare const rgbToHex: (r: number, g: number, b: number, a?: number) => string;
|
|
70
|
+
/**
|
|
71
|
+
* @returns #RRGGBB or #RRGGBBAA based on color containing non-opaque alpha,
|
|
72
|
+
* null if not valid color
|
|
73
|
+
*/
|
|
74
|
+
export declare const colorToHex: (color: string) => string | null;
|
|
75
|
+
export declare const isTransparent: (color: string) => boolean;
|
|
76
|
+
export declare const COLOR_OUTLINE_CONTRAST_THRESHOLD = 240;
|
|
77
|
+
export declare const isColorDark: (color: string, threshold?: number) => boolean;
|
|
78
|
+
/**
|
|
79
|
+
* tries to keep the input color as-is if it's valid, making minimal adjustments
|
|
80
|
+
* (trimming whitespace or adding `#` to hex colors)
|
|
81
|
+
*/
|
|
82
|
+
export declare const normalizeInputColor: (color: string) => string | null;
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
import type { ExcalidrawElement, FontFamilyValues } from "@excalidraw/element/types";
|
|
2
2
|
import type { AppProps, AppState } from "@excalidraw/excalidraw/types";
|
|
3
|
-
export declare const isDarwin: boolean;
|
|
4
|
-
export declare const isWindows: boolean;
|
|
5
|
-
export declare const isAndroid: boolean;
|
|
6
|
-
export declare const isFirefox: boolean;
|
|
7
|
-
export declare const isChrome: boolean;
|
|
8
|
-
export declare const isSafari: boolean;
|
|
9
|
-
export declare const isIOS: boolean;
|
|
10
|
-
export declare const isBrave: () => boolean;
|
|
11
3
|
export declare const supportsResizeObserver: boolean;
|
|
12
4
|
export declare const APP_NAME = "Excalidraw";
|
|
13
5
|
export declare const TEXT_AUTOWRAP_THRESHOLD = 36;
|
|
14
6
|
export declare const DRAGGING_THRESHOLD = 10;
|
|
7
|
+
export declare const MINIMUM_ARROW_SIZE = 20;
|
|
15
8
|
export declare const LINE_CONFIRM_THRESHOLD = 8;
|
|
16
9
|
export declare const ELEMENT_SHIFT_TRANSLATE_AMOUNT = 5;
|
|
17
10
|
export declare const ELEMENT_TRANSLATE_AMOUNT = 1;
|
|
@@ -85,10 +78,20 @@ export declare const ENV: {
|
|
|
85
78
|
PRODUCTION: string;
|
|
86
79
|
};
|
|
87
80
|
export declare const CLASSES: {
|
|
81
|
+
SIDEBAR: string;
|
|
88
82
|
SHAPE_ACTIONS_MENU: string;
|
|
89
83
|
ZOOM_ACTIONS: string;
|
|
90
84
|
SEARCH_MENU_INPUT_WRAPPER: string;
|
|
91
85
|
CONVERT_ELEMENT_TYPE_POPUP: string;
|
|
86
|
+
SHAPE_ACTIONS_THEME_SCOPE: string;
|
|
87
|
+
FRAME_NAME: string;
|
|
88
|
+
DROPDOWN_MENU_EVENT_WRAPPER: string;
|
|
89
|
+
};
|
|
90
|
+
export declare const FONT_SIZES: {
|
|
91
|
+
readonly sm: 16;
|
|
92
|
+
readonly md: 20;
|
|
93
|
+
readonly lg: 28;
|
|
94
|
+
readonly xl: 36;
|
|
92
95
|
};
|
|
93
96
|
export declare const CJK_HAND_DRAWN_FALLBACK_FONT = "Xiaolai";
|
|
94
97
|
export declare const WINDOWS_EMOJI_FALLBACK_FONT = "Segoe UI Emoji";
|
|
@@ -129,17 +132,15 @@ export declare const THEME: {
|
|
|
129
132
|
readonly LIGHT: "light";
|
|
130
133
|
readonly DARK: "dark";
|
|
131
134
|
};
|
|
135
|
+
export declare const DARK_THEME_FILTER = "invert(93%) hue-rotate(180deg)";
|
|
132
136
|
export declare const FRAME_STYLE: {
|
|
133
|
-
strokeColor:
|
|
134
|
-
strokeWidth:
|
|
135
|
-
strokeStyle:
|
|
136
|
-
fillStyle:
|
|
137
|
-
roughness:
|
|
138
|
-
roundness:
|
|
139
|
-
|
|
140
|
-
value?: number | undefined;
|
|
141
|
-
} | null;
|
|
142
|
-
backgroundColor: string;
|
|
137
|
+
strokeColor: ExcalidrawElement["strokeColor"];
|
|
138
|
+
strokeWidth: ExcalidrawElement["strokeWidth"];
|
|
139
|
+
strokeStyle: ExcalidrawElement["strokeStyle"];
|
|
140
|
+
fillStyle: ExcalidrawElement["fillStyle"];
|
|
141
|
+
roughness: ExcalidrawElement["roughness"];
|
|
142
|
+
roundness: ExcalidrawElement["roundness"];
|
|
143
|
+
backgroundColor: ExcalidrawElement["backgroundColor"];
|
|
143
144
|
radius: number;
|
|
144
145
|
nameOffsetY: number;
|
|
145
146
|
nameColorLightTheme: string;
|
|
@@ -174,6 +175,15 @@ export declare const IMAGE_MIME_TYPES: {
|
|
|
174
175
|
readonly avif: "image/avif";
|
|
175
176
|
readonly jfif: "image/jfif";
|
|
176
177
|
};
|
|
178
|
+
export declare const STRING_MIME_TYPES: {
|
|
179
|
+
readonly text: "text/plain";
|
|
180
|
+
readonly html: "text/html";
|
|
181
|
+
readonly json: "application/json";
|
|
182
|
+
readonly excalidraw: "application/vnd.excalidraw+json";
|
|
183
|
+
readonly excalidrawClipboard: "application/vnd.excalidraw.clipboard+json";
|
|
184
|
+
readonly excalidrawlib: "application/vnd.excalidrawlib+json";
|
|
185
|
+
readonly excalidrawlibIds: "application/vnd.excalidrawlib.ids+json";
|
|
186
|
+
};
|
|
177
187
|
export declare const MIME_TYPES: {
|
|
178
188
|
readonly svg: "image/svg+xml";
|
|
179
189
|
readonly png: "image/png";
|
|
@@ -184,14 +194,16 @@ export declare const MIME_TYPES: {
|
|
|
184
194
|
readonly ico: "image/x-icon";
|
|
185
195
|
readonly avif: "image/avif";
|
|
186
196
|
readonly jfif: "image/jfif";
|
|
197
|
+
readonly "excalidraw.svg": "image/svg+xml";
|
|
198
|
+
readonly "excalidraw.png": "image/png";
|
|
199
|
+
readonly binary: "application/octet-stream";
|
|
187
200
|
readonly text: "text/plain";
|
|
188
201
|
readonly html: "text/html";
|
|
189
202
|
readonly json: "application/json";
|
|
190
203
|
readonly excalidraw: "application/vnd.excalidraw+json";
|
|
204
|
+
readonly excalidrawClipboard: "application/vnd.excalidraw.clipboard+json";
|
|
191
205
|
readonly excalidrawlib: "application/vnd.excalidrawlib+json";
|
|
192
|
-
readonly
|
|
193
|
-
readonly "excalidraw.png": "image/png";
|
|
194
|
-
readonly binary: "application/octet-stream";
|
|
206
|
+
readonly excalidrawlibIds: "application/vnd.excalidrawlib.ids+json";
|
|
195
207
|
};
|
|
196
208
|
export declare const ALLOWED_PASTE_MIME_TYPES: readonly ["text/plain", "text/html", ...("image/svg+xml" | "image/png" | "image/jpeg" | "image/gif" | "image/webp" | "image/bmp" | "image/x-icon" | "image/avif" | "image/jfif")[]];
|
|
197
209
|
export declare const EXPORT_IMAGE_TYPES: {
|
|
@@ -218,7 +230,6 @@ export declare const MAX_ZOOM = 30;
|
|
|
218
230
|
export declare const HYPERLINK_TOOLTIP_DELAY = 300;
|
|
219
231
|
export declare const IDLE_THRESHOLD = 60000;
|
|
220
232
|
export declare const ACTIVE_THRESHOLD = 3000;
|
|
221
|
-
export declare const THEME_FILTER = "invert(93%) hue-rotate(180deg)";
|
|
222
233
|
export declare const URL_QUERY_KEYS: {
|
|
223
234
|
readonly addLibrary: "addLibrary";
|
|
224
235
|
};
|
|
@@ -226,10 +237,6 @@ export declare const URL_HASH_KEYS: {
|
|
|
226
237
|
readonly addLibrary: "addLibrary";
|
|
227
238
|
};
|
|
228
239
|
export declare const DEFAULT_UI_OPTIONS: AppProps["UIOptions"];
|
|
229
|
-
export declare const MQ_MAX_WIDTH_PORTRAIT = 730;
|
|
230
|
-
export declare const MQ_MAX_WIDTH_LANDSCAPE = 1000;
|
|
231
|
-
export declare const MQ_MAX_HEIGHT_LANDSCAPE = 500;
|
|
232
|
-
export declare const MQ_RIGHT_SIDEBAR_MIN_WIDTH = 1229;
|
|
233
240
|
export declare const MAX_DECIMALS_FOR_SVG_EXPORT = 2;
|
|
234
241
|
export declare const EXPORT_SCALES: number[];
|
|
235
242
|
export declare const DEFAULT_EXPORT_PADDING = 10;
|
|
@@ -341,3 +348,8 @@ export declare enum UserIdleState {
|
|
|
341
348
|
* the start and end points)
|
|
342
349
|
*/
|
|
343
350
|
export declare const LINE_POLYGON_POINT_MERGE_DISTANCE = 20;
|
|
351
|
+
export declare const DOUBLE_TAP_POSITION_THRESHOLD = 35;
|
|
352
|
+
export declare const BIND_MODE_TIMEOUT = 700;
|
|
353
|
+
export declare const MOBILE_ACTION_BUTTON_BG: {
|
|
354
|
+
readonly background: "var(--mobile-action-button-bg)";
|
|
355
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export type StylesPanelMode = "compact" | "full" | "mobile";
|
|
2
|
+
export type EditorInterface = Readonly<{
|
|
3
|
+
formFactor: "phone" | "tablet" | "desktop";
|
|
4
|
+
desktopUIMode: "compact" | "full";
|
|
5
|
+
userAgent: Readonly<{
|
|
6
|
+
isMobileDevice: boolean;
|
|
7
|
+
platform: "ios" | "android" | "other" | "unknown";
|
|
8
|
+
}>;
|
|
9
|
+
isTouchScreen: boolean;
|
|
10
|
+
canFitSidebar: boolean;
|
|
11
|
+
isLandscape: boolean;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const MQ_MAX_MOBILE = 599;
|
|
14
|
+
export declare const MQ_MAX_WIDTH_LANDSCAPE = 1000;
|
|
15
|
+
export declare const MQ_MAX_HEIGHT_LANDSCAPE = 500;
|
|
16
|
+
export declare const MQ_MIN_TABLET: number;
|
|
17
|
+
export declare const MQ_MAX_TABLET = 1180;
|
|
18
|
+
export declare const MQ_MIN_WIDTH_DESKTOP = 1440;
|
|
19
|
+
export declare const MQ_RIGHT_SIDEBAR_MIN_WIDTH = 1229;
|
|
20
|
+
export declare const isDarwin: boolean;
|
|
21
|
+
export declare const isWindows: boolean;
|
|
22
|
+
export declare const isAndroid: boolean;
|
|
23
|
+
export declare const isFirefox: boolean;
|
|
24
|
+
export declare const isChrome: boolean;
|
|
25
|
+
export declare const isSafari: boolean;
|
|
26
|
+
export declare const isIOS: boolean;
|
|
27
|
+
export declare const isBrave: () => boolean;
|
|
28
|
+
export declare const isMobileBreakpoint: (width: number, height: number) => boolean;
|
|
29
|
+
export declare const isTabletBreakpoint: (editorWidth: number, editorHeight: number) => boolean;
|
|
30
|
+
export declare const getFormFactor: (editorWidth: number, editorHeight: number) => EditorInterface["formFactor"];
|
|
31
|
+
export declare const deriveStylesPanelMode: (editorInterface: EditorInterface) => StylesPanelMode;
|
|
32
|
+
export declare const createUserAgentDescriptor: (userAgentString: string) => EditorInterface["userAgent"];
|
|
33
|
+
export declare const loadDesktopUIModePreference: () => "compact" | "full" | null;
|
|
34
|
+
export declare const setDesktopUIMode: (mode: EditorInterface["desktopUIMode"]) => "compact" | "full" | undefined;
|
|
@@ -43,6 +43,4 @@ export declare const getVerticalOffset: (fontFamily: ExcalidrawTextElement["font
|
|
|
43
43
|
/**
|
|
44
44
|
* Gets line height for a selected family.
|
|
45
45
|
*/
|
|
46
|
-
export declare const getLineHeight: (fontFamily: FontFamilyValues) =>
|
|
47
|
-
_brand: "unitlessLineHeight";
|
|
48
|
-
};
|
|
46
|
+
export declare const getLineHeight: (fontFamily: FontFamilyValues) => ExcalidrawTextElement["lineHeight"];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from "./binary-heap";
|
|
2
|
+
export * from "./bounds";
|
|
2
3
|
export * from "./colors";
|
|
3
4
|
export * from "./constants";
|
|
4
5
|
export * from "./font-metadata";
|
|
@@ -10,3 +11,7 @@ export * from "./random";
|
|
|
10
11
|
export * from "./url";
|
|
11
12
|
export * from "./utils";
|
|
12
13
|
export * from "./emitter";
|
|
14
|
+
export * from "./appEventBus";
|
|
15
|
+
export * from "./editorInterface";
|
|
16
|
+
export * from "./versionedSnapshotStore";
|
|
17
|
+
export { Debug } from "../debug";
|
|
@@ -183,7 +183,7 @@ export declare const isLatinChar: (key: string) => boolean;
|
|
|
183
183
|
* More details in https://github.com/excalidraw/excalidraw/pull/5944
|
|
184
184
|
*/
|
|
185
185
|
export declare const matchKey: (event: KeyboardEvent | React.KeyboardEvent<Element>, key: ValueOf<typeof KEYS>) => boolean;
|
|
186
|
-
export declare const isArrowKey: (key: string) =>
|
|
186
|
+
export declare const isArrowKey: (key: string) => key is "ArrowDown" | "ArrowLeft" | "ArrowRight" | "ArrowUp";
|
|
187
187
|
export declare const shouldResizeFromCenter: (event: MouseEvent | KeyboardEvent) => boolean;
|
|
188
188
|
export declare const shouldMaintainAspectRatio: (event: MouseEvent | KeyboardEvent) => boolean;
|
|
189
189
|
export declare const shouldRotateWithDiscreteAngle: (event: MouseEvent | KeyboardEvent | React.PointerEvent<HTMLCanvasElement>) => boolean;
|