@excalidraw/common 0.18.0-1b287a8ba → 0.18.0-214cd6e
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 +1777 -338
- 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/bounds.d.ts +10 -0
- package/dist/types/common/src/colors.d.ts +73 -39
- package/dist/types/common/src/constants.d.ts +51 -34
- 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 +3 -1
- package/dist/types/common/src/points.d.ts +1 -1
- package/dist/types/common/src/utility-types.d.ts +0 -1
- package/dist/types/common/src/utils.d.ts +48 -78
- package/dist/types/common/src/versionedSnapshotStore.d.ts +17 -0
- package/dist/types/element/src/Scene.d.ts +18 -10
- package/dist/types/element/src/align.d.ts +2 -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 +79 -51
- package/dist/types/element/src/bounds.d.ts +26 -19
- package/dist/types/element/src/bucketFill.d.ts +110 -0
- package/dist/types/element/src/collision.d.ts +7 -2
- package/dist/types/element/src/comparisons.d.ts +8 -7
- package/dist/types/element/src/convertToShape.d.ts +23 -0
- package/dist/types/element/src/delta.d.ts +16 -4
- package/dist/types/element/src/distribute.d.ts +3 -2
- package/dist/types/element/src/dragElements.d.ts +30 -3
- package/dist/types/element/src/duplicate.d.ts +7 -6
- package/dist/types/element/src/elbowArrow.d.ts +2 -0
- package/dist/types/element/src/embeddable.d.ts +2 -2
- package/dist/types/element/src/flowchart.d.ts +7 -7
- package/dist/types/element/src/fractionalIndex.d.ts +4 -4
- package/dist/types/element/src/frame.d.ts +16 -11
- package/dist/types/element/src/groups.d.ts +9 -9
- 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 +9 -4
- package/dist/types/element/src/linearElementEditor.d.ts +50 -31
- package/dist/types/element/src/mutateElement.d.ts +5 -1
- package/dist/types/element/src/newElement.d.ts +21 -6
- package/dist/types/element/src/positionElementsOnGrid.d.ts +2 -0
- package/dist/types/element/src/renderElement.d.ts +4 -10
- package/dist/types/element/src/resizeElements.d.ts +12 -12
- package/dist/types/element/src/resizeTest.d.ts +6 -5
- package/dist/types/element/src/selection.d.ts +14 -14
- package/dist/types/element/src/shape.d.ts +21 -8
- package/dist/types/element/src/sortElements.d.ts +10 -0
- package/dist/types/element/src/store.d.ts +6 -1
- package/dist/types/element/src/textElement.d.ts +15 -11
- 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 +29 -31
- package/dist/types/element/src/types.d.ts +27 -14
- package/dist/types/element/src/utils.d.ts +15 -6
- package/dist/types/element/src/zindex.d.ts +7 -1
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +206 -222
- package/dist/types/excalidraw/actions/actionAlign.d.ts +12 -13
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +122 -133
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +481 -1611
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +149 -904
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +59 -65
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +198 -217
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +165 -0
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +4 -6
- package/dist/types/excalidraw/actions/actionDuplicateSelection.d.ts +3 -4
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +66 -78
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +121 -132
- package/dist/types/excalidraw/actions/actionExport.d.ts +199 -1422
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +11 -395
- package/dist/types/excalidraw/actions/actionFlip.d.ts +2 -3
- package/dist/types/excalidraw/actions/actionFrame.d.ts +308 -547
- package/dist/types/excalidraw/actions/actionGroup.d.ts +132 -151
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +220 -230
- package/dist/types/excalidraw/actions/actionLink.d.ts +72 -78
- package/dist/types/excalidraw/actions/actionMenu.d.ts +61 -441
- package/dist/types/excalidraw/actions/actionNavigate.d.ts +18 -361
- package/dist/types/excalidraw/actions/actionProperties.d.ts +204 -2546
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +66 -76
- package/dist/types/excalidraw/actions/actionStyles.d.ts +59 -64
- package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +4 -4
- package/dist/types/excalidraw/actions/actionToggleArrowBinding.d.ts +181 -0
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +74 -81
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +181 -0
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +73 -79
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +62 -75
- package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +72 -78
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +73 -79
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +73 -79
- package/dist/types/excalidraw/actions/actionZindex.d.ts +8 -9
- package/dist/types/excalidraw/actions/index.d.ts +5 -3
- package/dist/types/excalidraw/actions/manager.d.ts +1 -0
- 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 +11 -7
- package/dist/types/excalidraw/{animated-trail.d.ts → animatedTrail.d.ts} +4 -3
- package/dist/types/excalidraw/appState.d.ts +51 -37
- 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 +59 -21
- package/dist/types/excalidraw/components/Actions.d.ts +32 -14
- package/dist/types/excalidraw/components/ActiveConfirmDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/App.arrowText.d.ts +104 -0
- package/dist/types/excalidraw/components/App.bucketFill.d.ts +48 -0
- package/dist/types/excalidraw/components/App.cursor.d.ts +38 -0
- package/dist/types/excalidraw/components/App.d.ts +480 -125
- package/dist/types/excalidraw/components/App.drawshape.d.ts +55 -0
- package/dist/types/excalidraw/components/App.flowchart.d.ts +21 -0
- package/dist/types/excalidraw/components/App.viewport.d.ts +73 -0
- 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 +9 -4
- 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 +10 -2
- package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +5 -2
- package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +8 -1
- package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -2
- package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +2 -2
- package/dist/types/excalidraw/components/ColorPicker/topPicksDnD.d.ts +31 -0
- package/dist/types/excalidraw/components/CommandPalette/CommandPalette.d.ts +1 -0
- package/dist/types/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +1 -2
- package/dist/types/excalidraw/components/CommandPalette/types.d.ts +2 -4
- package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +4 -4
- package/dist/types/excalidraw/components/CursorHint.d.ts +46 -0
- 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 +1 -2
- package/dist/types/excalidraw/components/ErrorDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/EyeDropper.d.ts +1 -2
- 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/{ToolButton.d.ts → IconButton.d.ts} +16 -19
- 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/Island.d.ts +7 -0
- package/dist/types/excalidraw/components/LaserPointerButton.d.ts +2 -4
- package/dist/types/excalidraw/components/LayerUI.d.ts +6 -2
- package/dist/types/excalidraw/components/LibraryMenu.d.ts +1 -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/LockButton.d.ts +3 -4
- package/dist/types/excalidraw/components/MagicButton.d.ts +0 -2
- package/dist/types/excalidraw/components/MobileMenu.d.ts +5 -7
- package/dist/types/excalidraw/components/MobileToolbar.d.ts +9 -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/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 +2 -3
- package/dist/types/excalidraw/components/PropertiesPopover.d.ts +2 -1
- package/dist/types/excalidraw/components/{ButtonIcon.d.ts → RadioButton.d.ts} +2 -5
- 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/SVGLayer.d.ts +1 -1
- package/dist/types/excalidraw/components/ScrollableList.d.ts +0 -1
- package/dist/types/excalidraw/components/SearchMenu.d.ts +1 -1
- package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +16 -22
- 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/Angle.d.ts +2 -2
- 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/Dimension.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/DragInput.d.ts +2 -3
- 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/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 +22 -0
- package/dist/types/excalidraw/components/Toolbar.d.ts +11 -0
- package/dist/types/excalidraw/components/Tools.d.ts +146 -0
- package/dist/types/excalidraw/components/Trans.d.ts +2 -2
- 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 +10 -4
- package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +1 -0
- package/dist/types/excalidraw/components/canvases/StaticCanvas.d.ts +1 -1
- 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/footer/Footer.d.ts +3 -1
- package/dist/types/excalidraw/components/hoc/withInternalFallback.d.ts +1 -1
- package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +3 -3
- package/dist/types/excalidraw/components/icons.d.ts +55 -22
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +24 -3
- package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +39 -35
- 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 +345 -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 +8 -9
- package/dist/types/excalidraw/data/json.d.ts +178 -3
- package/dist/types/excalidraw/data/library.d.ts +25 -10
- 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/drawShapeTrail.d.ts +16 -0
- package/dist/types/excalidraw/editor-jotai.d.ts +11 -11
- package/dist/types/excalidraw/eraser/index.d.ts +2 -3
- package/dist/types/excalidraw/errors.d.ts +14 -0
- package/dist/types/excalidraw/fonts/Fonts.d.ts +3 -2
- package/dist/types/excalidraw/hooks/useAppStateValue.d.ts +29 -0
- package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +2 -2
- 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/{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/renderer/animation.d.ts +16 -0
- package/dist/types/excalidraw/renderer/helpers.d.ts +6 -8
- package/dist/types/excalidraw/renderer/interactiveScene.d.ts +7 -15
- package/dist/types/excalidraw/renderer/staticScene.d.ts +4 -1
- package/dist/types/excalidraw/scene/Renderer.d.ts +429 -18
- package/dist/types/excalidraw/scene/export.d.ts +4 -4
- package/dist/types/excalidraw/scene/index.d.ts +2 -2
- package/dist/types/excalidraw/scene/types.d.ts +26 -8
- package/dist/types/excalidraw/shortcut.d.ts +1 -0
- package/dist/types/excalidraw/snapping.d.ts +12 -12
- 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 +559 -58
- package/dist/types/excalidraw/viewport.d.ts +275 -0
- package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +8 -5
- 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 +26 -2
- package/dist/types/math/src/range.d.ts +1 -3
- package/dist/types/math/src/segment.d.ts +10 -3
- package/dist/types/math/src/types.d.ts +25 -1
- package/dist/types/utils/src/export.d.ts +8 -8
- package/dist/types/utils/src/index.d.ts +1 -2
- package/dist/types/utils/src/shape.d.ts +6 -6
- package/package.json +7 -1
- package/dist/types/excalidraw/actions/actionEmbeddable.d.ts +0 -186
- 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 -16
- 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/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/shapes.d.ts +0 -62
- 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/cursor.d.ts +0 -5
- package/dist/types/excalidraw/data/reconcile.d.ts +0 -6
- package/dist/types/excalidraw/index.d.ts +0 -47
- package/dist/types/excalidraw/polyfill.d.ts +0 -2
- package/dist/types/excalidraw/scene/scroll.d.ts +0 -23
- 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/withinBounds.d.ts +0 -19
package/dist/dev/index.js
CHANGED
|
@@ -281,49 +281,48 @@ var BinaryHeap = class {
|
|
|
281
281
|
content = [];
|
|
282
282
|
sinkDown(idx) {
|
|
283
283
|
const node = this.content[idx];
|
|
284
|
+
const nodeScore = this.scoreFunction(node);
|
|
284
285
|
while (idx > 0) {
|
|
285
286
|
const parentN = (idx + 1 >> 1) - 1;
|
|
286
287
|
const parent = this.content[parentN];
|
|
287
|
-
if (
|
|
288
|
-
this.content[parentN] = node;
|
|
288
|
+
if (nodeScore < this.scoreFunction(parent)) {
|
|
289
289
|
this.content[idx] = parent;
|
|
290
290
|
idx = parentN;
|
|
291
291
|
} else {
|
|
292
292
|
break;
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
|
+
this.content[idx] = node;
|
|
295
296
|
}
|
|
296
297
|
bubbleUp(idx) {
|
|
297
298
|
const length = this.content.length;
|
|
298
299
|
const node = this.content[idx];
|
|
299
300
|
const score = this.scoreFunction(node);
|
|
300
301
|
while (true) {
|
|
301
|
-
const
|
|
302
|
-
const
|
|
303
|
-
let
|
|
304
|
-
let
|
|
302
|
+
const child1N = (idx + 1 << 1) - 1;
|
|
303
|
+
const child2N = child1N + 1;
|
|
304
|
+
let smallestIdx = idx;
|
|
305
|
+
let smallestScore = score;
|
|
305
306
|
if (child1N < length) {
|
|
306
|
-
const
|
|
307
|
-
child1Score
|
|
308
|
-
|
|
309
|
-
|
|
307
|
+
const child1Score = this.scoreFunction(this.content[child1N]);
|
|
308
|
+
if (child1Score < smallestScore) {
|
|
309
|
+
smallestIdx = child1N;
|
|
310
|
+
smallestScore = child1Score;
|
|
310
311
|
}
|
|
311
312
|
}
|
|
312
313
|
if (child2N < length) {
|
|
313
|
-
const
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
swap = child2N;
|
|
314
|
+
const child2Score = this.scoreFunction(this.content[child2N]);
|
|
315
|
+
if (child2Score < smallestScore) {
|
|
316
|
+
smallestIdx = child2N;
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
|
-
if (
|
|
320
|
-
this.content[idx] = this.content[swap];
|
|
321
|
-
this.content[swap] = node;
|
|
322
|
-
idx = swap;
|
|
323
|
-
} else {
|
|
319
|
+
if (smallestIdx === idx) {
|
|
324
320
|
break;
|
|
325
321
|
}
|
|
322
|
+
this.content[idx] = this.content[smallestIdx];
|
|
323
|
+
idx = smallestIdx;
|
|
326
324
|
}
|
|
325
|
+
this.content[idx] = node;
|
|
327
326
|
}
|
|
328
327
|
push(node) {
|
|
329
328
|
this.content.push(node);
|
|
@@ -364,173 +363,1095 @@ var BinaryHeap = class {
|
|
|
364
363
|
}
|
|
365
364
|
};
|
|
366
365
|
|
|
366
|
+
// src/bounds.ts
|
|
367
|
+
init_define_import_meta_env();
|
|
368
|
+
var isBounds = (box) => Array.isArray(box) && box.length === 4 && typeof box[0] === "number" && typeof box[1] === "number" && typeof box[2] === "number" && typeof box[3] === "number";
|
|
369
|
+
|
|
367
370
|
// src/colors.ts
|
|
368
371
|
init_define_import_meta_env();
|
|
369
372
|
|
|
370
|
-
// ../../node_modules/
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
"
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
"
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
"
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
"#
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
"
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
"
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
"#
|
|
523
|
-
|
|
524
|
-
"
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
373
|
+
// ../../node_modules/tinycolor2/esm/tinycolor.js
|
|
374
|
+
init_define_import_meta_env();
|
|
375
|
+
function _typeof(obj) {
|
|
376
|
+
"@babel/helpers - typeof";
|
|
377
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
|
|
378
|
+
return typeof obj2;
|
|
379
|
+
} : function(obj2) {
|
|
380
|
+
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
381
|
+
}, _typeof(obj);
|
|
382
|
+
}
|
|
383
|
+
var trimLeft = /^\s+/;
|
|
384
|
+
var trimRight = /\s+$/;
|
|
385
|
+
function tinycolor(color, opts) {
|
|
386
|
+
color = color ? color : "";
|
|
387
|
+
opts = opts || {};
|
|
388
|
+
if (color instanceof tinycolor) {
|
|
389
|
+
return color;
|
|
390
|
+
}
|
|
391
|
+
if (!(this instanceof tinycolor)) {
|
|
392
|
+
return new tinycolor(color, opts);
|
|
393
|
+
}
|
|
394
|
+
var rgb = inputToRGB(color);
|
|
395
|
+
this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts.format || rgb.format;
|
|
396
|
+
this._gradientType = opts.gradientType;
|
|
397
|
+
if (this._r < 1)
|
|
398
|
+
this._r = Math.round(this._r);
|
|
399
|
+
if (this._g < 1)
|
|
400
|
+
this._g = Math.round(this._g);
|
|
401
|
+
if (this._b < 1)
|
|
402
|
+
this._b = Math.round(this._b);
|
|
403
|
+
this._ok = rgb.ok;
|
|
404
|
+
}
|
|
405
|
+
tinycolor.prototype = {
|
|
406
|
+
isDark: function isDark() {
|
|
407
|
+
return this.getBrightness() < 128;
|
|
408
|
+
},
|
|
409
|
+
isLight: function isLight() {
|
|
410
|
+
return !this.isDark();
|
|
411
|
+
},
|
|
412
|
+
isValid: function isValid() {
|
|
413
|
+
return this._ok;
|
|
414
|
+
},
|
|
415
|
+
getOriginalInput: function getOriginalInput() {
|
|
416
|
+
return this._originalInput;
|
|
417
|
+
},
|
|
418
|
+
getFormat: function getFormat() {
|
|
419
|
+
return this._format;
|
|
420
|
+
},
|
|
421
|
+
getAlpha: function getAlpha() {
|
|
422
|
+
return this._a;
|
|
423
|
+
},
|
|
424
|
+
getBrightness: function getBrightness() {
|
|
425
|
+
var rgb = this.toRgb();
|
|
426
|
+
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
|
|
427
|
+
},
|
|
428
|
+
getLuminance: function getLuminance() {
|
|
429
|
+
var rgb = this.toRgb();
|
|
430
|
+
var RsRGB, GsRGB, BsRGB, R, G, B;
|
|
431
|
+
RsRGB = rgb.r / 255;
|
|
432
|
+
GsRGB = rgb.g / 255;
|
|
433
|
+
BsRGB = rgb.b / 255;
|
|
434
|
+
if (RsRGB <= 0.03928)
|
|
435
|
+
R = RsRGB / 12.92;
|
|
436
|
+
else
|
|
437
|
+
R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
|
|
438
|
+
if (GsRGB <= 0.03928)
|
|
439
|
+
G = GsRGB / 12.92;
|
|
440
|
+
else
|
|
441
|
+
G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
|
|
442
|
+
if (BsRGB <= 0.03928)
|
|
443
|
+
B = BsRGB / 12.92;
|
|
444
|
+
else
|
|
445
|
+
B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
|
|
446
|
+
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
|
|
447
|
+
},
|
|
448
|
+
setAlpha: function setAlpha(value) {
|
|
449
|
+
this._a = boundAlpha(value);
|
|
450
|
+
this._roundA = Math.round(100 * this._a) / 100;
|
|
451
|
+
return this;
|
|
452
|
+
},
|
|
453
|
+
toHsv: function toHsv() {
|
|
454
|
+
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
455
|
+
return {
|
|
456
|
+
h: hsv.h * 360,
|
|
457
|
+
s: hsv.s,
|
|
458
|
+
v: hsv.v,
|
|
459
|
+
a: this._a
|
|
460
|
+
};
|
|
461
|
+
},
|
|
462
|
+
toHsvString: function toHsvString() {
|
|
463
|
+
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
464
|
+
var h = Math.round(hsv.h * 360), s = Math.round(hsv.s * 100), v = Math.round(hsv.v * 100);
|
|
465
|
+
return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
|
|
466
|
+
},
|
|
467
|
+
toHsl: function toHsl() {
|
|
468
|
+
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
469
|
+
return {
|
|
470
|
+
h: hsl.h * 360,
|
|
471
|
+
s: hsl.s,
|
|
472
|
+
l: hsl.l,
|
|
473
|
+
a: this._a
|
|
474
|
+
};
|
|
475
|
+
},
|
|
476
|
+
toHslString: function toHslString() {
|
|
477
|
+
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
478
|
+
var h = Math.round(hsl.h * 360), s = Math.round(hsl.s * 100), l = Math.round(hsl.l * 100);
|
|
479
|
+
return this._a == 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")";
|
|
480
|
+
},
|
|
481
|
+
toHex: function toHex(allow3Char) {
|
|
482
|
+
return rgbToHex(this._r, this._g, this._b, allow3Char);
|
|
483
|
+
},
|
|
484
|
+
toHexString: function toHexString(allow3Char) {
|
|
485
|
+
return "#" + this.toHex(allow3Char);
|
|
486
|
+
},
|
|
487
|
+
toHex8: function toHex8(allow4Char) {
|
|
488
|
+
return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
|
|
489
|
+
},
|
|
490
|
+
toHex8String: function toHex8String(allow4Char) {
|
|
491
|
+
return "#" + this.toHex8(allow4Char);
|
|
492
|
+
},
|
|
493
|
+
toRgb: function toRgb() {
|
|
494
|
+
return {
|
|
495
|
+
r: Math.round(this._r),
|
|
496
|
+
g: Math.round(this._g),
|
|
497
|
+
b: Math.round(this._b),
|
|
498
|
+
a: this._a
|
|
499
|
+
};
|
|
500
|
+
},
|
|
501
|
+
toRgbString: function toRgbString() {
|
|
502
|
+
return this._a == 1 ? "rgb(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ")" : "rgba(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ", " + this._roundA + ")";
|
|
503
|
+
},
|
|
504
|
+
toPercentageRgb: function toPercentageRgb() {
|
|
505
|
+
return {
|
|
506
|
+
r: Math.round(bound01(this._r, 255) * 100) + "%",
|
|
507
|
+
g: Math.round(bound01(this._g, 255) * 100) + "%",
|
|
508
|
+
b: Math.round(bound01(this._b, 255) * 100) + "%",
|
|
509
|
+
a: this._a
|
|
510
|
+
};
|
|
511
|
+
},
|
|
512
|
+
toPercentageRgbString: function toPercentageRgbString() {
|
|
513
|
+
return this._a == 1 ? "rgb(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
|
|
514
|
+
},
|
|
515
|
+
toName: function toName() {
|
|
516
|
+
if (this._a === 0) {
|
|
517
|
+
return "transparent";
|
|
518
|
+
}
|
|
519
|
+
if (this._a < 1) {
|
|
520
|
+
return false;
|
|
521
|
+
}
|
|
522
|
+
return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
|
|
523
|
+
},
|
|
524
|
+
toFilter: function toFilter(secondColor) {
|
|
525
|
+
var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a);
|
|
526
|
+
var secondHex8String = hex8String;
|
|
527
|
+
var gradientType = this._gradientType ? "GradientType = 1, " : "";
|
|
528
|
+
if (secondColor) {
|
|
529
|
+
var s = tinycolor(secondColor);
|
|
530
|
+
secondHex8String = "#" + rgbaToArgbHex(s._r, s._g, s._b, s._a);
|
|
531
|
+
}
|
|
532
|
+
return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")";
|
|
533
|
+
},
|
|
534
|
+
toString: function toString(format) {
|
|
535
|
+
var formatSet = !!format;
|
|
536
|
+
format = format || this._format;
|
|
537
|
+
var formattedString = false;
|
|
538
|
+
var hasAlpha = this._a < 1 && this._a >= 0;
|
|
539
|
+
var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
|
|
540
|
+
if (needsAlphaFormat) {
|
|
541
|
+
if (format === "name" && this._a === 0) {
|
|
542
|
+
return this.toName();
|
|
543
|
+
}
|
|
544
|
+
return this.toRgbString();
|
|
545
|
+
}
|
|
546
|
+
if (format === "rgb") {
|
|
547
|
+
formattedString = this.toRgbString();
|
|
548
|
+
}
|
|
549
|
+
if (format === "prgb") {
|
|
550
|
+
formattedString = this.toPercentageRgbString();
|
|
551
|
+
}
|
|
552
|
+
if (format === "hex" || format === "hex6") {
|
|
553
|
+
formattedString = this.toHexString();
|
|
554
|
+
}
|
|
555
|
+
if (format === "hex3") {
|
|
556
|
+
formattedString = this.toHexString(true);
|
|
557
|
+
}
|
|
558
|
+
if (format === "hex4") {
|
|
559
|
+
formattedString = this.toHex8String(true);
|
|
560
|
+
}
|
|
561
|
+
if (format === "hex8") {
|
|
562
|
+
formattedString = this.toHex8String();
|
|
563
|
+
}
|
|
564
|
+
if (format === "name") {
|
|
565
|
+
formattedString = this.toName();
|
|
566
|
+
}
|
|
567
|
+
if (format === "hsl") {
|
|
568
|
+
formattedString = this.toHslString();
|
|
569
|
+
}
|
|
570
|
+
if (format === "hsv") {
|
|
571
|
+
formattedString = this.toHsvString();
|
|
572
|
+
}
|
|
573
|
+
return formattedString || this.toHexString();
|
|
574
|
+
},
|
|
575
|
+
clone: function clone() {
|
|
576
|
+
return tinycolor(this.toString());
|
|
577
|
+
},
|
|
578
|
+
_applyModification: function _applyModification(fn, args) {
|
|
579
|
+
var color = fn.apply(null, [this].concat([].slice.call(args)));
|
|
580
|
+
this._r = color._r;
|
|
581
|
+
this._g = color._g;
|
|
582
|
+
this._b = color._b;
|
|
583
|
+
this.setAlpha(color._a);
|
|
584
|
+
return this;
|
|
585
|
+
},
|
|
586
|
+
lighten: function lighten() {
|
|
587
|
+
return this._applyModification(_lighten, arguments);
|
|
588
|
+
},
|
|
589
|
+
brighten: function brighten() {
|
|
590
|
+
return this._applyModification(_brighten, arguments);
|
|
591
|
+
},
|
|
592
|
+
darken: function darken() {
|
|
593
|
+
return this._applyModification(_darken, arguments);
|
|
594
|
+
},
|
|
595
|
+
desaturate: function desaturate() {
|
|
596
|
+
return this._applyModification(_desaturate, arguments);
|
|
597
|
+
},
|
|
598
|
+
saturate: function saturate() {
|
|
599
|
+
return this._applyModification(_saturate, arguments);
|
|
600
|
+
},
|
|
601
|
+
greyscale: function greyscale() {
|
|
602
|
+
return this._applyModification(_greyscale, arguments);
|
|
603
|
+
},
|
|
604
|
+
spin: function spin() {
|
|
605
|
+
return this._applyModification(_spin, arguments);
|
|
606
|
+
},
|
|
607
|
+
_applyCombination: function _applyCombination(fn, args) {
|
|
608
|
+
return fn.apply(null, [this].concat([].slice.call(args)));
|
|
609
|
+
},
|
|
610
|
+
analogous: function analogous() {
|
|
611
|
+
return this._applyCombination(_analogous, arguments);
|
|
612
|
+
},
|
|
613
|
+
complement: function complement() {
|
|
614
|
+
return this._applyCombination(_complement, arguments);
|
|
615
|
+
},
|
|
616
|
+
monochromatic: function monochromatic() {
|
|
617
|
+
return this._applyCombination(_monochromatic, arguments);
|
|
618
|
+
},
|
|
619
|
+
splitcomplement: function splitcomplement() {
|
|
620
|
+
return this._applyCombination(_splitcomplement, arguments);
|
|
621
|
+
},
|
|
622
|
+
// Disabled until https://github.com/bgrins/TinyColor/issues/254
|
|
623
|
+
// polyad: function (number) {
|
|
624
|
+
// return this._applyCombination(polyad, [number]);
|
|
625
|
+
// },
|
|
626
|
+
triad: function triad() {
|
|
627
|
+
return this._applyCombination(polyad, [3]);
|
|
628
|
+
},
|
|
629
|
+
tetrad: function tetrad() {
|
|
630
|
+
return this._applyCombination(polyad, [4]);
|
|
631
|
+
}
|
|
632
|
+
};
|
|
633
|
+
tinycolor.fromRatio = function(color, opts) {
|
|
634
|
+
if (_typeof(color) == "object") {
|
|
635
|
+
var newColor = {};
|
|
636
|
+
for (var i in color) {
|
|
637
|
+
if (color.hasOwnProperty(i)) {
|
|
638
|
+
if (i === "a") {
|
|
639
|
+
newColor[i] = color[i];
|
|
640
|
+
} else {
|
|
641
|
+
newColor[i] = convertToPercentage(color[i]);
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
color = newColor;
|
|
646
|
+
}
|
|
647
|
+
return tinycolor(color, opts);
|
|
648
|
+
};
|
|
649
|
+
function inputToRGB(color) {
|
|
650
|
+
var rgb = {
|
|
651
|
+
r: 0,
|
|
652
|
+
g: 0,
|
|
653
|
+
b: 0
|
|
654
|
+
};
|
|
655
|
+
var a = 1;
|
|
656
|
+
var s = null;
|
|
657
|
+
var v = null;
|
|
658
|
+
var l = null;
|
|
659
|
+
var ok = false;
|
|
660
|
+
var format = false;
|
|
661
|
+
if (typeof color == "string") {
|
|
662
|
+
color = stringInputToObject(color);
|
|
663
|
+
}
|
|
664
|
+
if (_typeof(color) == "object") {
|
|
665
|
+
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
|
|
666
|
+
rgb = rgbToRgb(color.r, color.g, color.b);
|
|
667
|
+
ok = true;
|
|
668
|
+
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
|
|
669
|
+
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
|
|
670
|
+
s = convertToPercentage(color.s);
|
|
671
|
+
v = convertToPercentage(color.v);
|
|
672
|
+
rgb = hsvToRgb(color.h, s, v);
|
|
673
|
+
ok = true;
|
|
674
|
+
format = "hsv";
|
|
675
|
+
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
|
|
676
|
+
s = convertToPercentage(color.s);
|
|
677
|
+
l = convertToPercentage(color.l);
|
|
678
|
+
rgb = hslToRgb(color.h, s, l);
|
|
679
|
+
ok = true;
|
|
680
|
+
format = "hsl";
|
|
681
|
+
}
|
|
682
|
+
if (color.hasOwnProperty("a")) {
|
|
683
|
+
a = color.a;
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
a = boundAlpha(a);
|
|
687
|
+
return {
|
|
688
|
+
ok,
|
|
689
|
+
format: color.format || format,
|
|
690
|
+
r: Math.min(255, Math.max(rgb.r, 0)),
|
|
691
|
+
g: Math.min(255, Math.max(rgb.g, 0)),
|
|
692
|
+
b: Math.min(255, Math.max(rgb.b, 0)),
|
|
693
|
+
a
|
|
694
|
+
};
|
|
695
|
+
}
|
|
696
|
+
function rgbToRgb(r, g, b) {
|
|
697
|
+
return {
|
|
698
|
+
r: bound01(r, 255) * 255,
|
|
699
|
+
g: bound01(g, 255) * 255,
|
|
700
|
+
b: bound01(b, 255) * 255
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
function rgbToHsl(r, g, b) {
|
|
704
|
+
r = bound01(r, 255);
|
|
705
|
+
g = bound01(g, 255);
|
|
706
|
+
b = bound01(b, 255);
|
|
707
|
+
var max = Math.max(r, g, b), min = Math.min(r, g, b);
|
|
708
|
+
var h, s, l = (max + min) / 2;
|
|
709
|
+
if (max == min) {
|
|
710
|
+
h = s = 0;
|
|
711
|
+
} else {
|
|
712
|
+
var d = max - min;
|
|
713
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
714
|
+
switch (max) {
|
|
715
|
+
case r:
|
|
716
|
+
h = (g - b) / d + (g < b ? 6 : 0);
|
|
717
|
+
break;
|
|
718
|
+
case g:
|
|
719
|
+
h = (b - r) / d + 2;
|
|
720
|
+
break;
|
|
721
|
+
case b:
|
|
722
|
+
h = (r - g) / d + 4;
|
|
723
|
+
break;
|
|
724
|
+
}
|
|
725
|
+
h /= 6;
|
|
726
|
+
}
|
|
727
|
+
return {
|
|
728
|
+
h,
|
|
729
|
+
s,
|
|
730
|
+
l
|
|
731
|
+
};
|
|
732
|
+
}
|
|
733
|
+
function hslToRgb(h, s, l) {
|
|
734
|
+
var r, g, b;
|
|
735
|
+
h = bound01(h, 360);
|
|
736
|
+
s = bound01(s, 100);
|
|
737
|
+
l = bound01(l, 100);
|
|
738
|
+
function hue2rgb(p2, q2, t) {
|
|
739
|
+
if (t < 0)
|
|
740
|
+
t += 1;
|
|
741
|
+
if (t > 1)
|
|
742
|
+
t -= 1;
|
|
743
|
+
if (t < 1 / 6)
|
|
744
|
+
return p2 + (q2 - p2) * 6 * t;
|
|
745
|
+
if (t < 1 / 2)
|
|
746
|
+
return q2;
|
|
747
|
+
if (t < 2 / 3)
|
|
748
|
+
return p2 + (q2 - p2) * (2 / 3 - t) * 6;
|
|
749
|
+
return p2;
|
|
750
|
+
}
|
|
751
|
+
if (s === 0) {
|
|
752
|
+
r = g = b = l;
|
|
753
|
+
} else {
|
|
754
|
+
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
755
|
+
var p = 2 * l - q;
|
|
756
|
+
r = hue2rgb(p, q, h + 1 / 3);
|
|
757
|
+
g = hue2rgb(p, q, h);
|
|
758
|
+
b = hue2rgb(p, q, h - 1 / 3);
|
|
759
|
+
}
|
|
760
|
+
return {
|
|
761
|
+
r: r * 255,
|
|
762
|
+
g: g * 255,
|
|
763
|
+
b: b * 255
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
function rgbToHsv(r, g, b) {
|
|
767
|
+
r = bound01(r, 255);
|
|
768
|
+
g = bound01(g, 255);
|
|
769
|
+
b = bound01(b, 255);
|
|
770
|
+
var max = Math.max(r, g, b), min = Math.min(r, g, b);
|
|
771
|
+
var h, s, v = max;
|
|
772
|
+
var d = max - min;
|
|
773
|
+
s = max === 0 ? 0 : d / max;
|
|
774
|
+
if (max == min) {
|
|
775
|
+
h = 0;
|
|
776
|
+
} else {
|
|
777
|
+
switch (max) {
|
|
778
|
+
case r:
|
|
779
|
+
h = (g - b) / d + (g < b ? 6 : 0);
|
|
780
|
+
break;
|
|
781
|
+
case g:
|
|
782
|
+
h = (b - r) / d + 2;
|
|
783
|
+
break;
|
|
784
|
+
case b:
|
|
785
|
+
h = (r - g) / d + 4;
|
|
786
|
+
break;
|
|
787
|
+
}
|
|
788
|
+
h /= 6;
|
|
789
|
+
}
|
|
790
|
+
return {
|
|
791
|
+
h,
|
|
792
|
+
s,
|
|
793
|
+
v
|
|
794
|
+
};
|
|
795
|
+
}
|
|
796
|
+
function hsvToRgb(h, s, v) {
|
|
797
|
+
h = bound01(h, 360) * 6;
|
|
798
|
+
s = bound01(s, 100);
|
|
799
|
+
v = bound01(v, 100);
|
|
800
|
+
var i = Math.floor(h), f = h - i, p = v * (1 - s), q = v * (1 - f * s), t = v * (1 - (1 - f) * s), mod = i % 6, r = [v, q, p, p, t, v][mod], g = [t, v, v, q, p, p][mod], b = [p, p, t, v, v, q][mod];
|
|
801
|
+
return {
|
|
802
|
+
r: r * 255,
|
|
803
|
+
g: g * 255,
|
|
804
|
+
b: b * 255
|
|
805
|
+
};
|
|
806
|
+
}
|
|
807
|
+
function rgbToHex(r, g, b, allow3Char) {
|
|
808
|
+
var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
|
|
809
|
+
if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
|
|
810
|
+
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
|
|
811
|
+
}
|
|
812
|
+
return hex.join("");
|
|
813
|
+
}
|
|
814
|
+
function rgbaToHex(r, g, b, a, allow4Char) {
|
|
815
|
+
var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))];
|
|
816
|
+
if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) {
|
|
817
|
+
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
|
|
818
|
+
}
|
|
819
|
+
return hex.join("");
|
|
820
|
+
}
|
|
821
|
+
function rgbaToArgbHex(r, g, b, a) {
|
|
822
|
+
var hex = [pad2(convertDecimalToHex(a)), pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16))];
|
|
823
|
+
return hex.join("");
|
|
824
|
+
}
|
|
825
|
+
tinycolor.equals = function(color1, color2) {
|
|
826
|
+
if (!color1 || !color2)
|
|
827
|
+
return false;
|
|
828
|
+
return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
|
|
829
|
+
};
|
|
830
|
+
tinycolor.random = function() {
|
|
831
|
+
return tinycolor.fromRatio({
|
|
832
|
+
r: Math.random(),
|
|
833
|
+
g: Math.random(),
|
|
834
|
+
b: Math.random()
|
|
835
|
+
});
|
|
530
836
|
};
|
|
837
|
+
function _desaturate(color, amount) {
|
|
838
|
+
amount = amount === 0 ? 0 : amount || 10;
|
|
839
|
+
var hsl = tinycolor(color).toHsl();
|
|
840
|
+
hsl.s -= amount / 100;
|
|
841
|
+
hsl.s = clamp01(hsl.s);
|
|
842
|
+
return tinycolor(hsl);
|
|
843
|
+
}
|
|
844
|
+
function _saturate(color, amount) {
|
|
845
|
+
amount = amount === 0 ? 0 : amount || 10;
|
|
846
|
+
var hsl = tinycolor(color).toHsl();
|
|
847
|
+
hsl.s += amount / 100;
|
|
848
|
+
hsl.s = clamp01(hsl.s);
|
|
849
|
+
return tinycolor(hsl);
|
|
850
|
+
}
|
|
851
|
+
function _greyscale(color) {
|
|
852
|
+
return tinycolor(color).desaturate(100);
|
|
853
|
+
}
|
|
854
|
+
function _lighten(color, amount) {
|
|
855
|
+
amount = amount === 0 ? 0 : amount || 10;
|
|
856
|
+
var hsl = tinycolor(color).toHsl();
|
|
857
|
+
hsl.l += amount / 100;
|
|
858
|
+
hsl.l = clamp01(hsl.l);
|
|
859
|
+
return tinycolor(hsl);
|
|
860
|
+
}
|
|
861
|
+
function _brighten(color, amount) {
|
|
862
|
+
amount = amount === 0 ? 0 : amount || 10;
|
|
863
|
+
var rgb = tinycolor(color).toRgb();
|
|
864
|
+
rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
|
|
865
|
+
rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
|
|
866
|
+
rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
|
|
867
|
+
return tinycolor(rgb);
|
|
868
|
+
}
|
|
869
|
+
function _darken(color, amount) {
|
|
870
|
+
amount = amount === 0 ? 0 : amount || 10;
|
|
871
|
+
var hsl = tinycolor(color).toHsl();
|
|
872
|
+
hsl.l -= amount / 100;
|
|
873
|
+
hsl.l = clamp01(hsl.l);
|
|
874
|
+
return tinycolor(hsl);
|
|
875
|
+
}
|
|
876
|
+
function _spin(color, amount) {
|
|
877
|
+
var hsl = tinycolor(color).toHsl();
|
|
878
|
+
var hue = (hsl.h + amount) % 360;
|
|
879
|
+
hsl.h = hue < 0 ? 360 + hue : hue;
|
|
880
|
+
return tinycolor(hsl);
|
|
881
|
+
}
|
|
882
|
+
function _complement(color) {
|
|
883
|
+
var hsl = tinycolor(color).toHsl();
|
|
884
|
+
hsl.h = (hsl.h + 180) % 360;
|
|
885
|
+
return tinycolor(hsl);
|
|
886
|
+
}
|
|
887
|
+
function polyad(color, number) {
|
|
888
|
+
if (isNaN(number) || number <= 0) {
|
|
889
|
+
throw new Error("Argument to polyad must be a positive number");
|
|
890
|
+
}
|
|
891
|
+
var hsl = tinycolor(color).toHsl();
|
|
892
|
+
var result = [tinycolor(color)];
|
|
893
|
+
var step = 360 / number;
|
|
894
|
+
for (var i = 1; i < number; i++) {
|
|
895
|
+
result.push(tinycolor({
|
|
896
|
+
h: (hsl.h + i * step) % 360,
|
|
897
|
+
s: hsl.s,
|
|
898
|
+
l: hsl.l
|
|
899
|
+
}));
|
|
900
|
+
}
|
|
901
|
+
return result;
|
|
902
|
+
}
|
|
903
|
+
function _splitcomplement(color) {
|
|
904
|
+
var hsl = tinycolor(color).toHsl();
|
|
905
|
+
var h = hsl.h;
|
|
906
|
+
return [tinycolor(color), tinycolor({
|
|
907
|
+
h: (h + 72) % 360,
|
|
908
|
+
s: hsl.s,
|
|
909
|
+
l: hsl.l
|
|
910
|
+
}), tinycolor({
|
|
911
|
+
h: (h + 216) % 360,
|
|
912
|
+
s: hsl.s,
|
|
913
|
+
l: hsl.l
|
|
914
|
+
})];
|
|
915
|
+
}
|
|
916
|
+
function _analogous(color, results, slices) {
|
|
917
|
+
results = results || 6;
|
|
918
|
+
slices = slices || 30;
|
|
919
|
+
var hsl = tinycolor(color).toHsl();
|
|
920
|
+
var part = 360 / slices;
|
|
921
|
+
var ret = [tinycolor(color)];
|
|
922
|
+
for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
|
|
923
|
+
hsl.h = (hsl.h + part) % 360;
|
|
924
|
+
ret.push(tinycolor(hsl));
|
|
925
|
+
}
|
|
926
|
+
return ret;
|
|
927
|
+
}
|
|
928
|
+
function _monochromatic(color, results) {
|
|
929
|
+
results = results || 6;
|
|
930
|
+
var hsv = tinycolor(color).toHsv();
|
|
931
|
+
var h = hsv.h, s = hsv.s, v = hsv.v;
|
|
932
|
+
var ret = [];
|
|
933
|
+
var modification = 1 / results;
|
|
934
|
+
while (results--) {
|
|
935
|
+
ret.push(tinycolor({
|
|
936
|
+
h,
|
|
937
|
+
s,
|
|
938
|
+
v
|
|
939
|
+
}));
|
|
940
|
+
v = (v + modification) % 1;
|
|
941
|
+
}
|
|
942
|
+
return ret;
|
|
943
|
+
}
|
|
944
|
+
tinycolor.mix = function(color1, color2, amount) {
|
|
945
|
+
amount = amount === 0 ? 0 : amount || 50;
|
|
946
|
+
var rgb1 = tinycolor(color1).toRgb();
|
|
947
|
+
var rgb2 = tinycolor(color2).toRgb();
|
|
948
|
+
var p = amount / 100;
|
|
949
|
+
var rgba = {
|
|
950
|
+
r: (rgb2.r - rgb1.r) * p + rgb1.r,
|
|
951
|
+
g: (rgb2.g - rgb1.g) * p + rgb1.g,
|
|
952
|
+
b: (rgb2.b - rgb1.b) * p + rgb1.b,
|
|
953
|
+
a: (rgb2.a - rgb1.a) * p + rgb1.a
|
|
954
|
+
};
|
|
955
|
+
return tinycolor(rgba);
|
|
956
|
+
};
|
|
957
|
+
tinycolor.readability = function(color1, color2) {
|
|
958
|
+
var c1 = tinycolor(color1);
|
|
959
|
+
var c2 = tinycolor(color2);
|
|
960
|
+
return (Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) / (Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05);
|
|
961
|
+
};
|
|
962
|
+
tinycolor.isReadable = function(color1, color2, wcag2) {
|
|
963
|
+
var readability = tinycolor.readability(color1, color2);
|
|
964
|
+
var wcag2Parms, out;
|
|
965
|
+
out = false;
|
|
966
|
+
wcag2Parms = validateWCAG2Parms(wcag2);
|
|
967
|
+
switch (wcag2Parms.level + wcag2Parms.size) {
|
|
968
|
+
case "AAsmall":
|
|
969
|
+
case "AAAlarge":
|
|
970
|
+
out = readability >= 4.5;
|
|
971
|
+
break;
|
|
972
|
+
case "AAlarge":
|
|
973
|
+
out = readability >= 3;
|
|
974
|
+
break;
|
|
975
|
+
case "AAAsmall":
|
|
976
|
+
out = readability >= 7;
|
|
977
|
+
break;
|
|
978
|
+
}
|
|
979
|
+
return out;
|
|
980
|
+
};
|
|
981
|
+
tinycolor.mostReadable = function(baseColor, colorList, args) {
|
|
982
|
+
var bestColor = null;
|
|
983
|
+
var bestScore = 0;
|
|
984
|
+
var readability;
|
|
985
|
+
var includeFallbackColors, level, size;
|
|
986
|
+
args = args || {};
|
|
987
|
+
includeFallbackColors = args.includeFallbackColors;
|
|
988
|
+
level = args.level;
|
|
989
|
+
size = args.size;
|
|
990
|
+
for (var i = 0; i < colorList.length; i++) {
|
|
991
|
+
readability = tinycolor.readability(baseColor, colorList[i]);
|
|
992
|
+
if (readability > bestScore) {
|
|
993
|
+
bestScore = readability;
|
|
994
|
+
bestColor = tinycolor(colorList[i]);
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
if (tinycolor.isReadable(baseColor, bestColor, {
|
|
998
|
+
level,
|
|
999
|
+
size
|
|
1000
|
+
}) || !includeFallbackColors) {
|
|
1001
|
+
return bestColor;
|
|
1002
|
+
} else {
|
|
1003
|
+
args.includeFallbackColors = false;
|
|
1004
|
+
return tinycolor.mostReadable(baseColor, ["#fff", "#000"], args);
|
|
1005
|
+
}
|
|
1006
|
+
};
|
|
1007
|
+
var names = tinycolor.names = {
|
|
1008
|
+
aliceblue: "f0f8ff",
|
|
1009
|
+
antiquewhite: "faebd7",
|
|
1010
|
+
aqua: "0ff",
|
|
1011
|
+
aquamarine: "7fffd4",
|
|
1012
|
+
azure: "f0ffff",
|
|
1013
|
+
beige: "f5f5dc",
|
|
1014
|
+
bisque: "ffe4c4",
|
|
1015
|
+
black: "000",
|
|
1016
|
+
blanchedalmond: "ffebcd",
|
|
1017
|
+
blue: "00f",
|
|
1018
|
+
blueviolet: "8a2be2",
|
|
1019
|
+
brown: "a52a2a",
|
|
1020
|
+
burlywood: "deb887",
|
|
1021
|
+
burntsienna: "ea7e5d",
|
|
1022
|
+
cadetblue: "5f9ea0",
|
|
1023
|
+
chartreuse: "7fff00",
|
|
1024
|
+
chocolate: "d2691e",
|
|
1025
|
+
coral: "ff7f50",
|
|
1026
|
+
cornflowerblue: "6495ed",
|
|
1027
|
+
cornsilk: "fff8dc",
|
|
1028
|
+
crimson: "dc143c",
|
|
1029
|
+
cyan: "0ff",
|
|
1030
|
+
darkblue: "00008b",
|
|
1031
|
+
darkcyan: "008b8b",
|
|
1032
|
+
darkgoldenrod: "b8860b",
|
|
1033
|
+
darkgray: "a9a9a9",
|
|
1034
|
+
darkgreen: "006400",
|
|
1035
|
+
darkgrey: "a9a9a9",
|
|
1036
|
+
darkkhaki: "bdb76b",
|
|
1037
|
+
darkmagenta: "8b008b",
|
|
1038
|
+
darkolivegreen: "556b2f",
|
|
1039
|
+
darkorange: "ff8c00",
|
|
1040
|
+
darkorchid: "9932cc",
|
|
1041
|
+
darkred: "8b0000",
|
|
1042
|
+
darksalmon: "e9967a",
|
|
1043
|
+
darkseagreen: "8fbc8f",
|
|
1044
|
+
darkslateblue: "483d8b",
|
|
1045
|
+
darkslategray: "2f4f4f",
|
|
1046
|
+
darkslategrey: "2f4f4f",
|
|
1047
|
+
darkturquoise: "00ced1",
|
|
1048
|
+
darkviolet: "9400d3",
|
|
1049
|
+
deeppink: "ff1493",
|
|
1050
|
+
deepskyblue: "00bfff",
|
|
1051
|
+
dimgray: "696969",
|
|
1052
|
+
dimgrey: "696969",
|
|
1053
|
+
dodgerblue: "1e90ff",
|
|
1054
|
+
firebrick: "b22222",
|
|
1055
|
+
floralwhite: "fffaf0",
|
|
1056
|
+
forestgreen: "228b22",
|
|
1057
|
+
fuchsia: "f0f",
|
|
1058
|
+
gainsboro: "dcdcdc",
|
|
1059
|
+
ghostwhite: "f8f8ff",
|
|
1060
|
+
gold: "ffd700",
|
|
1061
|
+
goldenrod: "daa520",
|
|
1062
|
+
gray: "808080",
|
|
1063
|
+
green: "008000",
|
|
1064
|
+
greenyellow: "adff2f",
|
|
1065
|
+
grey: "808080",
|
|
1066
|
+
honeydew: "f0fff0",
|
|
1067
|
+
hotpink: "ff69b4",
|
|
1068
|
+
indianred: "cd5c5c",
|
|
1069
|
+
indigo: "4b0082",
|
|
1070
|
+
ivory: "fffff0",
|
|
1071
|
+
khaki: "f0e68c",
|
|
1072
|
+
lavender: "e6e6fa",
|
|
1073
|
+
lavenderblush: "fff0f5",
|
|
1074
|
+
lawngreen: "7cfc00",
|
|
1075
|
+
lemonchiffon: "fffacd",
|
|
1076
|
+
lightblue: "add8e6",
|
|
1077
|
+
lightcoral: "f08080",
|
|
1078
|
+
lightcyan: "e0ffff",
|
|
1079
|
+
lightgoldenrodyellow: "fafad2",
|
|
1080
|
+
lightgray: "d3d3d3",
|
|
1081
|
+
lightgreen: "90ee90",
|
|
1082
|
+
lightgrey: "d3d3d3",
|
|
1083
|
+
lightpink: "ffb6c1",
|
|
1084
|
+
lightsalmon: "ffa07a",
|
|
1085
|
+
lightseagreen: "20b2aa",
|
|
1086
|
+
lightskyblue: "87cefa",
|
|
1087
|
+
lightslategray: "789",
|
|
1088
|
+
lightslategrey: "789",
|
|
1089
|
+
lightsteelblue: "b0c4de",
|
|
1090
|
+
lightyellow: "ffffe0",
|
|
1091
|
+
lime: "0f0",
|
|
1092
|
+
limegreen: "32cd32",
|
|
1093
|
+
linen: "faf0e6",
|
|
1094
|
+
magenta: "f0f",
|
|
1095
|
+
maroon: "800000",
|
|
1096
|
+
mediumaquamarine: "66cdaa",
|
|
1097
|
+
mediumblue: "0000cd",
|
|
1098
|
+
mediumorchid: "ba55d3",
|
|
1099
|
+
mediumpurple: "9370db",
|
|
1100
|
+
mediumseagreen: "3cb371",
|
|
1101
|
+
mediumslateblue: "7b68ee",
|
|
1102
|
+
mediumspringgreen: "00fa9a",
|
|
1103
|
+
mediumturquoise: "48d1cc",
|
|
1104
|
+
mediumvioletred: "c71585",
|
|
1105
|
+
midnightblue: "191970",
|
|
1106
|
+
mintcream: "f5fffa",
|
|
1107
|
+
mistyrose: "ffe4e1",
|
|
1108
|
+
moccasin: "ffe4b5",
|
|
1109
|
+
navajowhite: "ffdead",
|
|
1110
|
+
navy: "000080",
|
|
1111
|
+
oldlace: "fdf5e6",
|
|
1112
|
+
olive: "808000",
|
|
1113
|
+
olivedrab: "6b8e23",
|
|
1114
|
+
orange: "ffa500",
|
|
1115
|
+
orangered: "ff4500",
|
|
1116
|
+
orchid: "da70d6",
|
|
1117
|
+
palegoldenrod: "eee8aa",
|
|
1118
|
+
palegreen: "98fb98",
|
|
1119
|
+
paleturquoise: "afeeee",
|
|
1120
|
+
palevioletred: "db7093",
|
|
1121
|
+
papayawhip: "ffefd5",
|
|
1122
|
+
peachpuff: "ffdab9",
|
|
1123
|
+
peru: "cd853f",
|
|
1124
|
+
pink: "ffc0cb",
|
|
1125
|
+
plum: "dda0dd",
|
|
1126
|
+
powderblue: "b0e0e6",
|
|
1127
|
+
purple: "800080",
|
|
1128
|
+
rebeccapurple: "663399",
|
|
1129
|
+
red: "f00",
|
|
1130
|
+
rosybrown: "bc8f8f",
|
|
1131
|
+
royalblue: "4169e1",
|
|
1132
|
+
saddlebrown: "8b4513",
|
|
1133
|
+
salmon: "fa8072",
|
|
1134
|
+
sandybrown: "f4a460",
|
|
1135
|
+
seagreen: "2e8b57",
|
|
1136
|
+
seashell: "fff5ee",
|
|
1137
|
+
sienna: "a0522d",
|
|
1138
|
+
silver: "c0c0c0",
|
|
1139
|
+
skyblue: "87ceeb",
|
|
1140
|
+
slateblue: "6a5acd",
|
|
1141
|
+
slategray: "708090",
|
|
1142
|
+
slategrey: "708090",
|
|
1143
|
+
snow: "fffafa",
|
|
1144
|
+
springgreen: "00ff7f",
|
|
1145
|
+
steelblue: "4682b4",
|
|
1146
|
+
tan: "d2b48c",
|
|
1147
|
+
teal: "008080",
|
|
1148
|
+
thistle: "d8bfd8",
|
|
1149
|
+
tomato: "ff6347",
|
|
1150
|
+
turquoise: "40e0d0",
|
|
1151
|
+
violet: "ee82ee",
|
|
1152
|
+
wheat: "f5deb3",
|
|
1153
|
+
white: "fff",
|
|
1154
|
+
whitesmoke: "f5f5f5",
|
|
1155
|
+
yellow: "ff0",
|
|
1156
|
+
yellowgreen: "9acd32"
|
|
1157
|
+
};
|
|
1158
|
+
var hexNames = tinycolor.hexNames = flip(names);
|
|
1159
|
+
function flip(o) {
|
|
1160
|
+
var flipped = {};
|
|
1161
|
+
for (var i in o) {
|
|
1162
|
+
if (o.hasOwnProperty(i)) {
|
|
1163
|
+
flipped[o[i]] = i;
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
return flipped;
|
|
1167
|
+
}
|
|
1168
|
+
function boundAlpha(a) {
|
|
1169
|
+
a = parseFloat(a);
|
|
1170
|
+
if (isNaN(a) || a < 0 || a > 1) {
|
|
1171
|
+
a = 1;
|
|
1172
|
+
}
|
|
1173
|
+
return a;
|
|
1174
|
+
}
|
|
1175
|
+
function bound01(n, max) {
|
|
1176
|
+
if (isOnePointZero(n))
|
|
1177
|
+
n = "100%";
|
|
1178
|
+
var processPercent = isPercentage(n);
|
|
1179
|
+
n = Math.min(max, Math.max(0, parseFloat(n)));
|
|
1180
|
+
if (processPercent) {
|
|
1181
|
+
n = parseInt(n * max, 10) / 100;
|
|
1182
|
+
}
|
|
1183
|
+
if (Math.abs(n - max) < 1e-6) {
|
|
1184
|
+
return 1;
|
|
1185
|
+
}
|
|
1186
|
+
return n % max / parseFloat(max);
|
|
1187
|
+
}
|
|
1188
|
+
function clamp01(val) {
|
|
1189
|
+
return Math.min(1, Math.max(0, val));
|
|
1190
|
+
}
|
|
1191
|
+
function parseIntFromHex(val) {
|
|
1192
|
+
return parseInt(val, 16);
|
|
1193
|
+
}
|
|
1194
|
+
function isOnePointZero(n) {
|
|
1195
|
+
return typeof n == "string" && n.indexOf(".") != -1 && parseFloat(n) === 1;
|
|
1196
|
+
}
|
|
1197
|
+
function isPercentage(n) {
|
|
1198
|
+
return typeof n === "string" && n.indexOf("%") != -1;
|
|
1199
|
+
}
|
|
1200
|
+
function pad2(c) {
|
|
1201
|
+
return c.length == 1 ? "0" + c : "" + c;
|
|
1202
|
+
}
|
|
1203
|
+
function convertToPercentage(n) {
|
|
1204
|
+
if (n <= 1) {
|
|
1205
|
+
n = n * 100 + "%";
|
|
1206
|
+
}
|
|
1207
|
+
return n;
|
|
1208
|
+
}
|
|
1209
|
+
function convertDecimalToHex(d) {
|
|
1210
|
+
return Math.round(parseFloat(d) * 255).toString(16);
|
|
1211
|
+
}
|
|
1212
|
+
function convertHexToDecimal(h) {
|
|
1213
|
+
return parseIntFromHex(h) / 255;
|
|
1214
|
+
}
|
|
1215
|
+
var matchers = function() {
|
|
1216
|
+
var CSS_INTEGER = "[-\\+]?\\d+%?";
|
|
1217
|
+
var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
|
|
1218
|
+
var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
|
|
1219
|
+
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
1220
|
+
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
1221
|
+
return {
|
|
1222
|
+
CSS_UNIT: new RegExp(CSS_UNIT),
|
|
1223
|
+
rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
|
|
1224
|
+
rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
|
|
1225
|
+
hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
|
|
1226
|
+
hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
|
|
1227
|
+
hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
|
|
1228
|
+
hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
|
|
1229
|
+
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
1230
|
+
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
1231
|
+
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
1232
|
+
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
|
|
1233
|
+
};
|
|
1234
|
+
}();
|
|
1235
|
+
function isValidCSSUnit(color) {
|
|
1236
|
+
return !!matchers.CSS_UNIT.exec(color);
|
|
1237
|
+
}
|
|
1238
|
+
function stringInputToObject(color) {
|
|
1239
|
+
color = color.replace(trimLeft, "").replace(trimRight, "").toLowerCase();
|
|
1240
|
+
var named = false;
|
|
1241
|
+
if (names[color]) {
|
|
1242
|
+
color = names[color];
|
|
1243
|
+
named = true;
|
|
1244
|
+
} else if (color == "transparent") {
|
|
1245
|
+
return {
|
|
1246
|
+
r: 0,
|
|
1247
|
+
g: 0,
|
|
1248
|
+
b: 0,
|
|
1249
|
+
a: 0,
|
|
1250
|
+
format: "name"
|
|
1251
|
+
};
|
|
1252
|
+
}
|
|
1253
|
+
var match;
|
|
1254
|
+
if (match = matchers.rgb.exec(color)) {
|
|
1255
|
+
return {
|
|
1256
|
+
r: match[1],
|
|
1257
|
+
g: match[2],
|
|
1258
|
+
b: match[3]
|
|
1259
|
+
};
|
|
1260
|
+
}
|
|
1261
|
+
if (match = matchers.rgba.exec(color)) {
|
|
1262
|
+
return {
|
|
1263
|
+
r: match[1],
|
|
1264
|
+
g: match[2],
|
|
1265
|
+
b: match[3],
|
|
1266
|
+
a: match[4]
|
|
1267
|
+
};
|
|
1268
|
+
}
|
|
1269
|
+
if (match = matchers.hsl.exec(color)) {
|
|
1270
|
+
return {
|
|
1271
|
+
h: match[1],
|
|
1272
|
+
s: match[2],
|
|
1273
|
+
l: match[3]
|
|
1274
|
+
};
|
|
1275
|
+
}
|
|
1276
|
+
if (match = matchers.hsla.exec(color)) {
|
|
1277
|
+
return {
|
|
1278
|
+
h: match[1],
|
|
1279
|
+
s: match[2],
|
|
1280
|
+
l: match[3],
|
|
1281
|
+
a: match[4]
|
|
1282
|
+
};
|
|
1283
|
+
}
|
|
1284
|
+
if (match = matchers.hsv.exec(color)) {
|
|
1285
|
+
return {
|
|
1286
|
+
h: match[1],
|
|
1287
|
+
s: match[2],
|
|
1288
|
+
v: match[3]
|
|
1289
|
+
};
|
|
1290
|
+
}
|
|
1291
|
+
if (match = matchers.hsva.exec(color)) {
|
|
1292
|
+
return {
|
|
1293
|
+
h: match[1],
|
|
1294
|
+
s: match[2],
|
|
1295
|
+
v: match[3],
|
|
1296
|
+
a: match[4]
|
|
1297
|
+
};
|
|
1298
|
+
}
|
|
1299
|
+
if (match = matchers.hex8.exec(color)) {
|
|
1300
|
+
return {
|
|
1301
|
+
r: parseIntFromHex(match[1]),
|
|
1302
|
+
g: parseIntFromHex(match[2]),
|
|
1303
|
+
b: parseIntFromHex(match[3]),
|
|
1304
|
+
a: convertHexToDecimal(match[4]),
|
|
1305
|
+
format: named ? "name" : "hex8"
|
|
1306
|
+
};
|
|
1307
|
+
}
|
|
1308
|
+
if (match = matchers.hex6.exec(color)) {
|
|
1309
|
+
return {
|
|
1310
|
+
r: parseIntFromHex(match[1]),
|
|
1311
|
+
g: parseIntFromHex(match[2]),
|
|
1312
|
+
b: parseIntFromHex(match[3]),
|
|
1313
|
+
format: named ? "name" : "hex"
|
|
1314
|
+
};
|
|
1315
|
+
}
|
|
1316
|
+
if (match = matchers.hex4.exec(color)) {
|
|
1317
|
+
return {
|
|
1318
|
+
r: parseIntFromHex(match[1] + "" + match[1]),
|
|
1319
|
+
g: parseIntFromHex(match[2] + "" + match[2]),
|
|
1320
|
+
b: parseIntFromHex(match[3] + "" + match[3]),
|
|
1321
|
+
a: convertHexToDecimal(match[4] + "" + match[4]),
|
|
1322
|
+
format: named ? "name" : "hex8"
|
|
1323
|
+
};
|
|
1324
|
+
}
|
|
1325
|
+
if (match = matchers.hex3.exec(color)) {
|
|
1326
|
+
return {
|
|
1327
|
+
r: parseIntFromHex(match[1] + "" + match[1]),
|
|
1328
|
+
g: parseIntFromHex(match[2] + "" + match[2]),
|
|
1329
|
+
b: parseIntFromHex(match[3] + "" + match[3]),
|
|
1330
|
+
format: named ? "name" : "hex"
|
|
1331
|
+
};
|
|
1332
|
+
}
|
|
1333
|
+
return false;
|
|
1334
|
+
}
|
|
1335
|
+
function validateWCAG2Parms(parms) {
|
|
1336
|
+
var level, size;
|
|
1337
|
+
parms = parms || {
|
|
1338
|
+
level: "AA",
|
|
1339
|
+
size: "small"
|
|
1340
|
+
};
|
|
1341
|
+
level = (parms.level || "AA").toUpperCase();
|
|
1342
|
+
size = (parms.size || "small").toLowerCase();
|
|
1343
|
+
if (level !== "AA" && level !== "AAA") {
|
|
1344
|
+
level = "AA";
|
|
1345
|
+
}
|
|
1346
|
+
if (size !== "small" && size !== "large") {
|
|
1347
|
+
size = "small";
|
|
1348
|
+
}
|
|
1349
|
+
return {
|
|
1350
|
+
level,
|
|
1351
|
+
size
|
|
1352
|
+
};
|
|
1353
|
+
}
|
|
531
1354
|
|
|
532
1355
|
// src/colors.ts
|
|
533
|
-
|
|
1356
|
+
import { clamp } from "@excalidraw/math";
|
|
1357
|
+
import { degreesToRadians } from "@excalidraw/math";
|
|
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;
|
|
1361
|
+
function cssHueRotate(red, green, blue, degrees) {
|
|
1362
|
+
const r = red / 255;
|
|
1363
|
+
const g = green / 255;
|
|
1364
|
+
const b = blue / 255;
|
|
1365
|
+
const a = degreesToRadians(degrees);
|
|
1366
|
+
const c = Math.cos(a);
|
|
1367
|
+
const s = Math.sin(a);
|
|
1368
|
+
const matrix = [
|
|
1369
|
+
0.213 + c * 0.787 - s * 0.213,
|
|
1370
|
+
0.715 - c * 0.715 - s * 0.715,
|
|
1371
|
+
0.072 - c * 0.072 + s * 0.928,
|
|
1372
|
+
0.213 - c * 0.213 + s * 0.143,
|
|
1373
|
+
0.715 + c * 0.285 + s * 0.14,
|
|
1374
|
+
0.072 - c * 0.072 - s * 0.283,
|
|
1375
|
+
0.213 - c * 0.213 - s * 0.787,
|
|
1376
|
+
0.715 - c * 0.715 + s * 0.715,
|
|
1377
|
+
0.072 + c * 0.928 + s * 0.072
|
|
1378
|
+
];
|
|
1379
|
+
const newR = r * matrix[0] + g * matrix[1] + b * matrix[2];
|
|
1380
|
+
const newG = r * matrix[3] + g * matrix[4] + b * matrix[5];
|
|
1381
|
+
const newB = r * matrix[6] + g * matrix[7] + b * matrix[8];
|
|
1382
|
+
return {
|
|
1383
|
+
r: Math.round(Math.max(0, Math.min(1, newR)) * 255),
|
|
1384
|
+
g: Math.round(Math.max(0, Math.min(1, newG)) * 255),
|
|
1385
|
+
b: Math.round(Math.max(0, Math.min(1, newB)) * 255)
|
|
1386
|
+
};
|
|
1387
|
+
}
|
|
1388
|
+
var cssInvert = (r, g, b, percent) => {
|
|
1389
|
+
const p = clamp(percent, 0, 100) / 100;
|
|
1390
|
+
const invertComponent = (color) => {
|
|
1391
|
+
const inverted = color * (1 - p) + (255 - color) * p;
|
|
1392
|
+
return Math.round(clamp(inverted, 0, 255));
|
|
1393
|
+
};
|
|
1394
|
+
const invertedR = invertComponent(r);
|
|
1395
|
+
const invertedG = invertComponent(g);
|
|
1396
|
+
const invertedB = invertComponent(b);
|
|
1397
|
+
return { r: invertedR, g: invertedG, b: invertedB };
|
|
1398
|
+
};
|
|
1399
|
+
var applyDarkModeFilter = (color, enable = true) => {
|
|
1400
|
+
if (!enable) {
|
|
1401
|
+
return color;
|
|
1402
|
+
}
|
|
1403
|
+
const cached = DARK_MODE_COLORS_CACHE?.get(color);
|
|
1404
|
+
if (cached) {
|
|
1405
|
+
return cached;
|
|
1406
|
+
}
|
|
1407
|
+
const tc = tinycolor(color);
|
|
1408
|
+
const alpha = tc.getAlpha();
|
|
1409
|
+
const rgb = tc.toRgb();
|
|
1410
|
+
const inverted = cssInvert(
|
|
1411
|
+
rgb.r,
|
|
1412
|
+
rgb.g,
|
|
1413
|
+
rgb.b,
|
|
1414
|
+
DARK_MODE_FILTER_INVERT_PERCENT
|
|
1415
|
+
);
|
|
1416
|
+
const rotated = cssHueRotate(
|
|
1417
|
+
inverted.r,
|
|
1418
|
+
inverted.g,
|
|
1419
|
+
inverted.b,
|
|
1420
|
+
DARK_MODE_FILTER_HUE_ROTATE_DEGREES
|
|
1421
|
+
);
|
|
1422
|
+
const result = rgbToHex2(rotated.r, rotated.g, rotated.b, alpha);
|
|
1423
|
+
if (DARK_MODE_COLORS_CACHE) {
|
|
1424
|
+
DARK_MODE_COLORS_CACHE.set(color, result);
|
|
1425
|
+
}
|
|
1426
|
+
return result;
|
|
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
|
+
};
|
|
534
1455
|
var pick = (source, keys) => {
|
|
535
1456
|
return keys.reduce((acc, key) => {
|
|
536
1457
|
if (key in source) {
|
|
@@ -544,28 +1465,24 @@ var COLORS_PER_ROW = 5;
|
|
|
544
1465
|
var DEFAULT_CHART_COLOR_INDEX = 4;
|
|
545
1466
|
var DEFAULT_ELEMENT_STROKE_COLOR_INDEX = 4;
|
|
546
1467
|
var DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX = 1;
|
|
547
|
-
var ELEMENTS_PALETTE_SHADE_INDEXES = [0, 2, 4, 6, 8];
|
|
548
|
-
var CANVAS_PALETTE_SHADE_INDEXES = [0, 1, 2, 3, 4];
|
|
549
|
-
var getSpecificColorShades = (color, indexArr) => {
|
|
550
|
-
return indexArr.map((index) => open_color_default[color][index]);
|
|
551
|
-
};
|
|
552
1468
|
var COLOR_PALETTE = {
|
|
553
1469
|
transparent: "transparent",
|
|
554
1470
|
black: "#1e1e1e",
|
|
555
1471
|
white: "#ffffff",
|
|
556
|
-
// open-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
1472
|
+
// open-color from https://github.com/yeun/open-color/blob/master/open-color.js
|
|
1473
|
+
// corresponds to indexes [0,2,4,6,8] (weights: 50, 200, 400, 600, 800)
|
|
1474
|
+
gray: ["#f8f9fa", "#e9ecef", "#ced4da", "#868e96", "#343a40"],
|
|
1475
|
+
red: ["#fff5f5", "#ffc9c9", "#ff8787", "#fa5252", "#e03131"],
|
|
1476
|
+
pink: ["#fff0f6", "#fcc2d7", "#f783ac", "#e64980", "#c2255c"],
|
|
1477
|
+
grape: ["#f8f0fc", "#eebefa", "#da77f2", "#be4bdb", "#9c36b5"],
|
|
1478
|
+
violet: ["#f3f0ff", "#d0bfff", "#9775fa", "#7950f2", "#6741d9"],
|
|
1479
|
+
blue: ["#e7f5ff", "#a5d8ff", "#4dabf7", "#228be6", "#1971c2"],
|
|
1480
|
+
cyan: ["#e3fafc", "#99e9f2", "#3bc9db", "#15aabf", "#0c8599"],
|
|
1481
|
+
teal: ["#e6fcf5", "#96f2d7", "#38d9a9", "#12b886", "#099268"],
|
|
1482
|
+
green: ["#ebfbee", "#b2f2bb", "#69db7c", "#40c057", "#2f9e44"],
|
|
1483
|
+
yellow: ["#fff9db", "#ffec99", "#ffd43b", "#fab005", "#f08c00"],
|
|
1484
|
+
orange: ["#fff4e6", "#ffd8a8", "#ffa94d", "#fd7e14", "#e8590c"],
|
|
1485
|
+
// radix bronze shades [3,5,7,9,11]
|
|
569
1486
|
bronze: ["#f8f1ee", "#eaddd7", "#d2bab0", "#a18072", "#846358"]
|
|
570
1487
|
};
|
|
571
1488
|
var COMMON_ELEMENT_SHADES = pick(COLOR_PALETTE, [
|
|
@@ -580,6 +1497,7 @@ var COMMON_ELEMENT_SHADES = pick(COLOR_PALETTE, [
|
|
|
580
1497
|
"orange",
|
|
581
1498
|
"red"
|
|
582
1499
|
]);
|
|
1500
|
+
var COLOR_TOP_PICKS_SLOTS = 5;
|
|
583
1501
|
var DEFAULT_ELEMENT_STROKE_PICKS = [
|
|
584
1502
|
COLOR_PALETTE.black,
|
|
585
1503
|
COLOR_PALETTE.red[DEFAULT_ELEMENT_STROKE_COLOR_INDEX],
|
|
@@ -594,6 +1512,13 @@ var DEFAULT_ELEMENT_BACKGROUND_PICKS = [
|
|
|
594
1512
|
COLOR_PALETTE.blue[DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX],
|
|
595
1513
|
COLOR_PALETTE.yellow[DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX]
|
|
596
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
|
+
];
|
|
597
1522
|
var DEFAULT_CANVAS_BACKGROUND_PICKS = [
|
|
598
1523
|
COLOR_PALETTE.white,
|
|
599
1524
|
// radix slate2
|
|
@@ -637,23 +1562,69 @@ var getAllColorsSpecificShade = (index) => [
|
|
|
637
1562
|
COLOR_PALETTE.orange[index],
|
|
638
1563
|
COLOR_PALETTE.red[index]
|
|
639
1564
|
];
|
|
640
|
-
var
|
|
1565
|
+
var rgbToHex2 = (r, g, b, a) => {
|
|
1566
|
+
const hex6 = `#${((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1)}`;
|
|
1567
|
+
if (a !== void 0 && a < 1) {
|
|
1568
|
+
const alphaHex = Math.round(a * 255).toString(16).padStart(2, "0");
|
|
1569
|
+
return `${hex6}${alphaHex}`;
|
|
1570
|
+
}
|
|
1571
|
+
return hex6;
|
|
1572
|
+
};
|
|
1573
|
+
var colorToHex = (color) => {
|
|
1574
|
+
const tc = tinycolor(color);
|
|
1575
|
+
if (!tc.isValid()) {
|
|
1576
|
+
return null;
|
|
1577
|
+
}
|
|
1578
|
+
const { r, g, b, a } = tc.toRgb();
|
|
1579
|
+
return rgbToHex2(r, g, b, a);
|
|
1580
|
+
};
|
|
1581
|
+
var isTransparent = (color) => {
|
|
1582
|
+
return tinycolor(color).getAlpha() === 0;
|
|
1583
|
+
};
|
|
1584
|
+
var isOpaqueColor = (color) => {
|
|
1585
|
+
return tinycolor(color).getAlpha() === 1;
|
|
1586
|
+
};
|
|
1587
|
+
var COLOR_OUTLINE_CONTRAST_THRESHOLD = 240;
|
|
1588
|
+
var calculateContrast = (r, g, b) => {
|
|
1589
|
+
const yiq = (r * 299 + g * 587 + b * 114) / 1e3;
|
|
1590
|
+
return yiq;
|
|
1591
|
+
};
|
|
1592
|
+
var isColorDark = (color, threshold = 160) => {
|
|
1593
|
+
if (!color) {
|
|
1594
|
+
return true;
|
|
1595
|
+
}
|
|
1596
|
+
if (isTransparent(color)) {
|
|
1597
|
+
return false;
|
|
1598
|
+
}
|
|
1599
|
+
const tc = tinycolor(color);
|
|
1600
|
+
if (!tc.isValid()) {
|
|
1601
|
+
return true;
|
|
1602
|
+
}
|
|
1603
|
+
const { r, g, b } = tc.toRgb();
|
|
1604
|
+
return calculateContrast(r, g, b) < threshold;
|
|
1605
|
+
};
|
|
1606
|
+
var normalizeInputColor = (color) => {
|
|
1607
|
+
color = color.trim();
|
|
1608
|
+
if (isTransparent(color)) {
|
|
1609
|
+
return color;
|
|
1610
|
+
}
|
|
1611
|
+
const tc = tinycolor(color);
|
|
1612
|
+
if (tc.isValid()) {
|
|
1613
|
+
if (["hex", "hex8"].includes(tc.getFormat()) && !color.startsWith("#")) {
|
|
1614
|
+
return `#${color}`;
|
|
1615
|
+
}
|
|
1616
|
+
return color;
|
|
1617
|
+
}
|
|
1618
|
+
return null;
|
|
1619
|
+
};
|
|
641
1620
|
|
|
642
1621
|
// src/constants.ts
|
|
643
1622
|
init_define_import_meta_env();
|
|
644
|
-
var isDarwin = /Mac|iPod|iPhone|iPad/.test(navigator.platform);
|
|
645
|
-
var isWindows = /^Win/.test(navigator.platform);
|
|
646
|
-
var isAndroid = /\b(android)\b/i.test(navigator.userAgent);
|
|
647
|
-
var isFirefox = typeof window !== "undefined" && "netscape" in window && navigator.userAgent.indexOf("rv:") > 1 && navigator.userAgent.indexOf("Gecko") > 1;
|
|
648
|
-
var isChrome = navigator.userAgent.indexOf("Chrome") !== -1;
|
|
649
|
-
var isSafari = !isChrome && navigator.userAgent.indexOf("Safari") !== -1;
|
|
650
|
-
var isIOS = /iPad|iPhone/.test(navigator.platform) || // iPadOS 13+
|
|
651
|
-
navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
|
652
|
-
var isBrave = () => navigator.brave?.isBrave?.name === "isBrave";
|
|
653
1623
|
var supportsResizeObserver = typeof window !== "undefined" && "ResizeObserver" in window;
|
|
654
1624
|
var APP_NAME = "Excalidraw";
|
|
655
1625
|
var TEXT_AUTOWRAP_THRESHOLD = 36;
|
|
656
1626
|
var DRAGGING_THRESHOLD = 10;
|
|
1627
|
+
var MINIMUM_ARROW_SIZE = 20;
|
|
657
1628
|
var LINE_CONFIRM_THRESHOLD = 8;
|
|
658
1629
|
var ELEMENT_SHIFT_TRANSLATE_AMOUNT = 5;
|
|
659
1630
|
var ELEMENT_TRANSLATE_AMOUNT = 1;
|
|
@@ -730,10 +1701,20 @@ var ENV = {
|
|
|
730
1701
|
PRODUCTION: "production"
|
|
731
1702
|
};
|
|
732
1703
|
var CLASSES = {
|
|
1704
|
+
SIDEBAR: "sidebar",
|
|
733
1705
|
SHAPE_ACTIONS_MENU: "App-menu__left",
|
|
734
1706
|
ZOOM_ACTIONS: "zoom-actions",
|
|
735
1707
|
SEARCH_MENU_INPUT_WRAPPER: "layer-ui__search-inputWrapper",
|
|
736
|
-
CONVERT_ELEMENT_TYPE_POPUP: "ConvertElementTypePopup"
|
|
1708
|
+
CONVERT_ELEMENT_TYPE_POPUP: "ConvertElementTypePopup",
|
|
1709
|
+
SHAPE_ACTIONS_THEME_SCOPE: "shape-actions-theme-scope",
|
|
1710
|
+
FRAME_NAME: "frame-name",
|
|
1711
|
+
DROPDOWN_MENU_EVENT_WRAPPER: "dropdown-menu-event-wrapper"
|
|
1712
|
+
};
|
|
1713
|
+
var FONT_SIZES = {
|
|
1714
|
+
sm: 16,
|
|
1715
|
+
md: 20,
|
|
1716
|
+
lg: 28,
|
|
1717
|
+
xl: 36
|
|
737
1718
|
};
|
|
738
1719
|
var CJK_HAND_DRAWN_FALLBACK_FONT = "Xiaolai";
|
|
739
1720
|
var WINDOWS_EMOJI_FALLBACK_FONT = "Segoe UI Emoji";
|
|
@@ -786,6 +1767,7 @@ var THEME = {
|
|
|
786
1767
|
LIGHT: "light",
|
|
787
1768
|
DARK: "dark"
|
|
788
1769
|
};
|
|
1770
|
+
var DARK_THEME_FILTER = "invert(93%) hue-rotate(180deg)";
|
|
789
1771
|
var FRAME_STYLE = {
|
|
790
1772
|
strokeColor: "#bbb",
|
|
791
1773
|
strokeWidth: 2,
|
|
@@ -828,13 +1810,20 @@ var IMAGE_MIME_TYPES = {
|
|
|
828
1810
|
avif: "image/avif",
|
|
829
1811
|
jfif: "image/jfif"
|
|
830
1812
|
};
|
|
831
|
-
var
|
|
1813
|
+
var STRING_MIME_TYPES = {
|
|
832
1814
|
text: "text/plain",
|
|
833
1815
|
html: "text/html",
|
|
834
1816
|
json: "application/json",
|
|
835
1817
|
// excalidraw data
|
|
836
1818
|
excalidraw: "application/vnd.excalidraw+json",
|
|
1819
|
+
excalidrawClipboard: "application/vnd.excalidraw.clipboard+json",
|
|
1820
|
+
// LEGACY: fully-qualified library JSON data
|
|
837
1821
|
excalidrawlib: "application/vnd.excalidrawlib+json",
|
|
1822
|
+
// list of excalidraw library item ids
|
|
1823
|
+
excalidrawlibIds: "application/vnd.excalidrawlib.ids+json"
|
|
1824
|
+
};
|
|
1825
|
+
var MIME_TYPES = {
|
|
1826
|
+
...STRING_MIME_TYPES,
|
|
838
1827
|
// image-encoded excalidraw data
|
|
839
1828
|
"excalidraw.svg": "image/svg+xml",
|
|
840
1829
|
"excalidraw.png": "image/png",
|
|
@@ -872,7 +1861,6 @@ var MAX_ZOOM = 30;
|
|
|
872
1861
|
var HYPERLINK_TOOLTIP_DELAY = 300;
|
|
873
1862
|
var IDLE_THRESHOLD = 6e4;
|
|
874
1863
|
var ACTIVE_THRESHOLD = 3e3;
|
|
875
|
-
var THEME_FILTER = "invert(93%) hue-rotate(180deg)";
|
|
876
1864
|
var URL_QUERY_KEYS = {
|
|
877
1865
|
addLibrary: "addLibrary"
|
|
878
1866
|
};
|
|
@@ -893,15 +1881,13 @@ var DEFAULT_UI_OPTIONS = {
|
|
|
893
1881
|
image: true
|
|
894
1882
|
}
|
|
895
1883
|
};
|
|
896
|
-
var MQ_MAX_WIDTH_PORTRAIT = 730;
|
|
897
|
-
var MQ_MAX_WIDTH_LANDSCAPE = 1e3;
|
|
898
|
-
var MQ_MAX_HEIGHT_LANDSCAPE = 500;
|
|
899
|
-
var MQ_RIGHT_SIDEBAR_MIN_WIDTH = 1229;
|
|
900
1884
|
var MAX_DECIMALS_FOR_SVG_EXPORT = 2;
|
|
901
1885
|
var EXPORT_SCALES = [1, 2, 3];
|
|
902
1886
|
var DEFAULT_EXPORT_PADDING = 10;
|
|
903
|
-
var
|
|
904
|
-
|
|
1887
|
+
var DEFAULT_IMAGE_OPTIONS = {
|
|
1888
|
+
maxWidthOrHeight: 1440,
|
|
1889
|
+
maxFileSizeBytes: 4 * 1024 * 1024
|
|
1890
|
+
};
|
|
905
1891
|
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
906
1892
|
var SVG_DOCUMENT_PREAMBLE = `<?xml version="1.0" standalone="no"?>
|
|
907
1893
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
@@ -925,6 +1911,7 @@ var TEXT_ALIGN = {
|
|
|
925
1911
|
RIGHT: "right"
|
|
926
1912
|
};
|
|
927
1913
|
var ELEMENT_READY_TO_ERASE_OPACITY = 20;
|
|
1914
|
+
var ELEMENT_PENDING_DRAW_SHAPE_OPACITY = 70;
|
|
928
1915
|
var DEFAULT_PROPORTIONAL_RADIUS = 0.25;
|
|
929
1916
|
var DEFAULT_ADAPTIVE_RADIUS = 32;
|
|
930
1917
|
var ROUNDNESS = {
|
|
@@ -948,16 +1935,34 @@ var ROUGHNESS = {
|
|
|
948
1935
|
artist: 1,
|
|
949
1936
|
cartoonist: 2
|
|
950
1937
|
};
|
|
1938
|
+
var STROKE_WIDTH_KEYS = [
|
|
1939
|
+
"thin",
|
|
1940
|
+
"medium",
|
|
1941
|
+
"bold"
|
|
1942
|
+
];
|
|
951
1943
|
var STROKE_WIDTH = {
|
|
952
1944
|
thin: 1,
|
|
1945
|
+
medium: 2,
|
|
1946
|
+
bold: 4,
|
|
1947
|
+
extraBold: 8
|
|
1948
|
+
// unused (may be introduced in the future)
|
|
1949
|
+
};
|
|
1950
|
+
var FREEDRAW_STROKE_WIDTH = {
|
|
1951
|
+
thin: 0.5,
|
|
1952
|
+
medium: 1,
|
|
953
1953
|
bold: 2,
|
|
954
1954
|
extraBold: 4
|
|
1955
|
+
// legacy (may be used again in the future)
|
|
955
1956
|
};
|
|
1957
|
+
var getStrokeWidthByKey = (elementType, strokeWidthKey) => {
|
|
1958
|
+
return elementType === "freedraw" ? FREEDRAW_STROKE_WIDTH[strokeWidthKey] : STROKE_WIDTH[strokeWidthKey];
|
|
1959
|
+
};
|
|
1960
|
+
var DEFAULT_ELEMENT_STROKE_WIDTH_KEY = "medium";
|
|
956
1961
|
var DEFAULT_ELEMENT_PROPS = {
|
|
957
1962
|
strokeColor: COLOR_PALETTE.black,
|
|
958
1963
|
backgroundColor: COLOR_PALETTE.transparent,
|
|
959
1964
|
fillStyle: "solid",
|
|
960
|
-
strokeWidth:
|
|
1965
|
+
strokeWidth: STROKE_WIDTH[DEFAULT_ELEMENT_STROKE_WIDTH_KEY],
|
|
961
1966
|
strokeStyle: "solid",
|
|
962
1967
|
roughness: ROUGHNESS.artist,
|
|
963
1968
|
opacity: 100,
|
|
@@ -990,7 +1995,9 @@ var TOOL_TYPE = {
|
|
|
990
1995
|
frame: "frame",
|
|
991
1996
|
magicframe: "magicframe",
|
|
992
1997
|
embeddable: "embeddable",
|
|
993
|
-
laser: "laser"
|
|
1998
|
+
laser: "laser",
|
|
1999
|
+
autoshape: "autoshape",
|
|
2000
|
+
bucketfill: "bucketfill"
|
|
994
2001
|
};
|
|
995
2002
|
var EDITOR_LS_KEYS = {
|
|
996
2003
|
OAI_API_KEY: "excalidraw-oai-api-key",
|
|
@@ -1016,6 +2023,13 @@ var UserIdleState = /* @__PURE__ */ ((UserIdleState2) => {
|
|
|
1016
2023
|
return UserIdleState2;
|
|
1017
2024
|
})(UserIdleState || {});
|
|
1018
2025
|
var LINE_POLYGON_POINT_MERGE_DISTANCE = 20;
|
|
2026
|
+
var DOUBLE_TAP_POSITION_THRESHOLD = 35;
|
|
2027
|
+
var BIND_MODE_TIMEOUT = 700;
|
|
2028
|
+
var MOBILE_ACTION_BUTTON_BG = {
|
|
2029
|
+
background: "var(--mobile-action-button-bg)"
|
|
2030
|
+
};
|
|
2031
|
+
var DEFAULT_STROKE_STREAMLINE = 0.5;
|
|
2032
|
+
var DEFAULT_STROKE_STREAMLINE_PRECISE = 0.2;
|
|
1019
2033
|
|
|
1020
2034
|
// src/font-metadata.ts
|
|
1021
2035
|
init_define_import_meta_env();
|
|
@@ -1171,6 +2185,133 @@ var Queue = class {
|
|
|
1171
2185
|
|
|
1172
2186
|
// src/keys.ts
|
|
1173
2187
|
init_define_import_meta_env();
|
|
2188
|
+
|
|
2189
|
+
// src/editorInterface.ts
|
|
2190
|
+
init_define_import_meta_env();
|
|
2191
|
+
var DESKTOP_UI_MODE_STORAGE_KEY = "excalidraw.desktopUIMode";
|
|
2192
|
+
var MQ_MAX_MOBILE = 599;
|
|
2193
|
+
var MQ_MAX_WIDTH_LANDSCAPE = 1e3;
|
|
2194
|
+
var MQ_MAX_HEIGHT_LANDSCAPE = 500;
|
|
2195
|
+
var MQ_MIN_TABLET = MQ_MAX_MOBILE + 1;
|
|
2196
|
+
var MQ_MAX_TABLET = 1180;
|
|
2197
|
+
var MQ_MIN_WIDTH_DESKTOP = 1440;
|
|
2198
|
+
var MQ_RIGHT_SIDEBAR_MIN_WIDTH = 1229;
|
|
2199
|
+
var isDarwin = /Mac|iPod|iPhone|iPad/.test(navigator.platform);
|
|
2200
|
+
var isWindows = /^Win/.test(navigator.platform);
|
|
2201
|
+
var isAndroid = /\b(android)\b/i.test(navigator.userAgent);
|
|
2202
|
+
var isFirefox = typeof window !== "undefined" && "netscape" in window && navigator.userAgent.indexOf("rv:") > 1 && navigator.userAgent.indexOf("Gecko") > 1;
|
|
2203
|
+
var isChrome = navigator.userAgent.indexOf("Chrome") !== -1;
|
|
2204
|
+
var isSafari = !isChrome && navigator.userAgent.indexOf("Safari") !== -1;
|
|
2205
|
+
var isIOS = /iPad|iPhone/i.test(navigator.platform) || // iPadOS 13+
|
|
2206
|
+
navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
|
2207
|
+
var isBrave = () => navigator.brave?.isBrave?.name === "isBrave";
|
|
2208
|
+
var isMobileBreakpoint = (width, height) => {
|
|
2209
|
+
return width <= MQ_MAX_MOBILE || height < MQ_MAX_HEIGHT_LANDSCAPE && width < MQ_MAX_WIDTH_LANDSCAPE;
|
|
2210
|
+
};
|
|
2211
|
+
var isTabletBreakpoint = (editorWidth, editorHeight) => {
|
|
2212
|
+
const minSide = Math.min(editorWidth, editorHeight);
|
|
2213
|
+
const maxSide = Math.max(editorWidth, editorHeight);
|
|
2214
|
+
return minSide >= MQ_MIN_TABLET && maxSide <= MQ_MAX_TABLET;
|
|
2215
|
+
};
|
|
2216
|
+
var isMobileOrTablet = () => {
|
|
2217
|
+
const ua = navigator.userAgent || "";
|
|
2218
|
+
const platform = navigator.platform || "";
|
|
2219
|
+
const uaData = navigator.userAgentData;
|
|
2220
|
+
if (uaData) {
|
|
2221
|
+
const plat = (uaData.platform || "").toLowerCase();
|
|
2222
|
+
const isDesktopOS = plat === "windows" || plat === "macos" || plat === "linux" || plat === "chrome os";
|
|
2223
|
+
if (uaData.mobile === true) {
|
|
2224
|
+
return true;
|
|
2225
|
+
}
|
|
2226
|
+
if (uaData.mobile === false && plat === "android") {
|
|
2227
|
+
const looksTouchTablet = matchMedia?.("(hover: none)").matches && matchMedia?.("(pointer: coarse)").matches;
|
|
2228
|
+
return looksTouchTablet;
|
|
2229
|
+
}
|
|
2230
|
+
if (isDesktopOS) {
|
|
2231
|
+
return false;
|
|
2232
|
+
}
|
|
2233
|
+
}
|
|
2234
|
+
if (isIOS) {
|
|
2235
|
+
return true;
|
|
2236
|
+
}
|
|
2237
|
+
if (isAndroid) {
|
|
2238
|
+
const isAndroidPhone = /Mobile/i.test(ua);
|
|
2239
|
+
const isAndroidTablet = !isAndroidPhone;
|
|
2240
|
+
if (isAndroidPhone || isAndroidTablet) {
|
|
2241
|
+
const looksTouchTablet = matchMedia?.("(hover: none)").matches && matchMedia?.("(pointer: coarse)").matches;
|
|
2242
|
+
return looksTouchTablet;
|
|
2243
|
+
}
|
|
2244
|
+
}
|
|
2245
|
+
const looksDesktopPlatform = /Win|Linux|CrOS|Mac/.test(platform) || /Windows NT|X11|CrOS|Macintosh/.test(ua);
|
|
2246
|
+
if (looksDesktopPlatform) {
|
|
2247
|
+
return false;
|
|
2248
|
+
}
|
|
2249
|
+
return false;
|
|
2250
|
+
};
|
|
2251
|
+
var getFormFactor = (editorWidth, editorHeight) => {
|
|
2252
|
+
if (isMobileBreakpoint(editorWidth, editorHeight)) {
|
|
2253
|
+
return "phone";
|
|
2254
|
+
}
|
|
2255
|
+
if (isTabletBreakpoint(editorWidth, editorHeight)) {
|
|
2256
|
+
return "tablet";
|
|
2257
|
+
}
|
|
2258
|
+
return "desktop";
|
|
2259
|
+
};
|
|
2260
|
+
var deriveStylesPanelMode = (editorInterface) => {
|
|
2261
|
+
if (editorInterface.formFactor === "phone") {
|
|
2262
|
+
return "mobile";
|
|
2263
|
+
}
|
|
2264
|
+
if (editorInterface.formFactor === "tablet") {
|
|
2265
|
+
return "compact";
|
|
2266
|
+
}
|
|
2267
|
+
return editorInterface.desktopUIMode;
|
|
2268
|
+
};
|
|
2269
|
+
var createUserAgentDescriptor = (userAgentString) => {
|
|
2270
|
+
const normalizedUA = userAgentString ?? "";
|
|
2271
|
+
let platform = "unknown";
|
|
2272
|
+
if (isIOS) {
|
|
2273
|
+
platform = "ios";
|
|
2274
|
+
} else if (isAndroid) {
|
|
2275
|
+
platform = "android";
|
|
2276
|
+
} else if (normalizedUA) {
|
|
2277
|
+
platform = "other";
|
|
2278
|
+
}
|
|
2279
|
+
return {
|
|
2280
|
+
isMobileDevice: isMobileOrTablet(),
|
|
2281
|
+
platform
|
|
2282
|
+
};
|
|
2283
|
+
};
|
|
2284
|
+
var loadDesktopUIModePreference = () => {
|
|
2285
|
+
if (typeof window === "undefined") {
|
|
2286
|
+
return null;
|
|
2287
|
+
}
|
|
2288
|
+
try {
|
|
2289
|
+
const stored = window.localStorage.getItem(DESKTOP_UI_MODE_STORAGE_KEY);
|
|
2290
|
+
if (stored === "compact" || stored === "full") {
|
|
2291
|
+
return stored;
|
|
2292
|
+
}
|
|
2293
|
+
} catch (error) {
|
|
2294
|
+
}
|
|
2295
|
+
return null;
|
|
2296
|
+
};
|
|
2297
|
+
var persistDesktopUIMode = (mode) => {
|
|
2298
|
+
if (typeof window === "undefined") {
|
|
2299
|
+
return;
|
|
2300
|
+
}
|
|
2301
|
+
try {
|
|
2302
|
+
window.localStorage.setItem(DESKTOP_UI_MODE_STORAGE_KEY, mode);
|
|
2303
|
+
} catch (error) {
|
|
2304
|
+
}
|
|
2305
|
+
};
|
|
2306
|
+
var setDesktopUIMode = (mode) => {
|
|
2307
|
+
if (mode !== "compact" && mode !== "full") {
|
|
2308
|
+
return;
|
|
2309
|
+
}
|
|
2310
|
+
persistDesktopUIMode(mode);
|
|
2311
|
+
return mode;
|
|
2312
|
+
};
|
|
2313
|
+
|
|
2314
|
+
// src/keys.ts
|
|
1174
2315
|
var CODES = {
|
|
1175
2316
|
EQUAL: "Equal",
|
|
1176
2317
|
MINUS: "Minus",
|
|
@@ -1218,6 +2359,7 @@ var KEYS = {
|
|
|
1218
2359
|
SUBTRACT: "-",
|
|
1219
2360
|
SLASH: "/",
|
|
1220
2361
|
A: "a",
|
|
2362
|
+
B: "b",
|
|
1221
2363
|
C: "c",
|
|
1222
2364
|
D: "d",
|
|
1223
2365
|
E: "e",
|
|
@@ -1269,6 +2411,7 @@ var shouldRotateWithDiscreteAngle = (event) => event.shiftKey;
|
|
|
1269
2411
|
// src/points.ts
|
|
1270
2412
|
init_define_import_meta_env();
|
|
1271
2413
|
import {
|
|
2414
|
+
pointFrom,
|
|
1272
2415
|
pointFromPair
|
|
1273
2416
|
} from "@excalidraw/math";
|
|
1274
2417
|
var getSizeFromPoints = (points) => {
|
|
@@ -1313,12 +2456,12 @@ var rescalePoints = (dimension, newSize, points, normalize) => {
|
|
|
1313
2456
|
};
|
|
1314
2457
|
var getGridPoint = (x, y, gridSize) => {
|
|
1315
2458
|
if (gridSize) {
|
|
1316
|
-
return
|
|
2459
|
+
return pointFrom(
|
|
1317
2460
|
Math.round(x / gridSize) * gridSize,
|
|
1318
2461
|
Math.round(y / gridSize) * gridSize
|
|
1319
|
-
|
|
2462
|
+
);
|
|
1320
2463
|
}
|
|
1321
|
-
return
|
|
2464
|
+
return pointFrom(x, y);
|
|
1322
2465
|
};
|
|
1323
2466
|
|
|
1324
2467
|
// src/promise-pool.ts
|
|
@@ -1409,14 +2552,25 @@ var getDateTime = () => {
|
|
|
1409
2552
|
return `${year}-${month}-${day}-${hr}${min}`;
|
|
1410
2553
|
};
|
|
1411
2554
|
var capitalizeString = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
|
1412
|
-
var
|
|
1413
|
-
var
|
|
1414
|
-
|
|
2555
|
+
var getTargetWindow = (target) => target?.ownerDocument?.defaultView ?? (typeof window === "undefined" ? null : window);
|
|
2556
|
+
var isToolIcon = (target) => {
|
|
2557
|
+
const targetWindow = getTargetWindow(target);
|
|
2558
|
+
return !!targetWindow && target instanceof targetWindow.HTMLElement && target.className.includes("ToolIcon");
|
|
2559
|
+
};
|
|
2560
|
+
var isInputLike = (target) => {
|
|
2561
|
+
const targetWindow = getTargetWindow(target);
|
|
2562
|
+
return !!targetWindow && (target instanceof targetWindow.HTMLElement && target.dataset.type === "wysiwyg" || target instanceof targetWindow.HTMLBRElement || // newline in wysiwyg
|
|
2563
|
+
target instanceof targetWindow.HTMLInputElement || target instanceof targetWindow.HTMLTextAreaElement || target instanceof targetWindow.HTMLSelectElement);
|
|
2564
|
+
};
|
|
1415
2565
|
var isInteractive = (target) => {
|
|
1416
|
-
|
|
2566
|
+
const targetWindow = getTargetWindow(target);
|
|
2567
|
+
return isInputLike(target) || !!targetWindow && target instanceof targetWindow.Element && !!target.closest("label, button");
|
|
2568
|
+
};
|
|
2569
|
+
var isWritableElement = (target) => {
|
|
2570
|
+
const targetWindow = getTargetWindow(target);
|
|
2571
|
+
return !!targetWindow && (target instanceof targetWindow.HTMLElement && target.dataset.type === "wysiwyg" || target instanceof targetWindow.HTMLBRElement || // newline in wysiwyg
|
|
2572
|
+
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);
|
|
1417
2573
|
};
|
|
1418
|
-
var isWritableElement = (target) => target instanceof HTMLElement && target.dataset.type === "wysiwyg" || target instanceof HTMLBRElement || // newline in wysiwyg
|
|
1419
|
-
target instanceof HTMLTextAreaElement || target instanceof HTMLInputElement && (target.type === "text" || target.type === "number" || target.type === "password");
|
|
1420
2574
|
var getFontFamilyString = ({
|
|
1421
2575
|
fontFamily
|
|
1422
2576
|
}) => {
|
|
@@ -1433,6 +2587,9 @@ var getFontString = ({
|
|
|
1433
2587
|
}) => {
|
|
1434
2588
|
return `${fontSize}px ${getFontFamilyString({ fontFamily })}`;
|
|
1435
2589
|
};
|
|
2590
|
+
var nextAnimationFrame = async (cb) => {
|
|
2591
|
+
requestAnimationFrame(() => requestAnimationFrame(cb));
|
|
2592
|
+
};
|
|
1436
2593
|
var debounce = (fn, timeout) => {
|
|
1437
2594
|
let handle = 0;
|
|
1438
2595
|
let lastArgs = null;
|
|
@@ -1458,32 +2615,23 @@ var debounce = (fn, timeout) => {
|
|
|
1458
2615
|
};
|
|
1459
2616
|
return ret;
|
|
1460
2617
|
};
|
|
1461
|
-
var throttleRAF = (fn
|
|
2618
|
+
var throttleRAF = (fn) => {
|
|
1462
2619
|
let timerId = null;
|
|
1463
2620
|
let lastArgs = null;
|
|
1464
|
-
|
|
1465
|
-
const scheduleFunc = (args) => {
|
|
2621
|
+
const scheduleFunc = () => {
|
|
1466
2622
|
timerId = window.requestAnimationFrame(() => {
|
|
1467
2623
|
timerId = null;
|
|
1468
|
-
|
|
2624
|
+
const args = lastArgs;
|
|
1469
2625
|
lastArgs = null;
|
|
1470
|
-
if (
|
|
1471
|
-
|
|
1472
|
-
lastArgsTrailing = null;
|
|
1473
|
-
scheduleFunc(lastArgs);
|
|
2626
|
+
if (args) {
|
|
2627
|
+
fn(...args);
|
|
1474
2628
|
}
|
|
1475
2629
|
});
|
|
1476
2630
|
};
|
|
1477
2631
|
const ret = (...args) => {
|
|
1478
|
-
if (isTestEnv()) {
|
|
1479
|
-
fn(...args);
|
|
1480
|
-
return;
|
|
1481
|
-
}
|
|
1482
2632
|
lastArgs = args;
|
|
1483
2633
|
if (timerId === null) {
|
|
1484
|
-
scheduleFunc(
|
|
1485
|
-
} else if (opts?.trailing) {
|
|
1486
|
-
lastArgsTrailing = args;
|
|
2634
|
+
scheduleFunc();
|
|
1487
2635
|
}
|
|
1488
2636
|
};
|
|
1489
2637
|
ret.flush = () => {
|
|
@@ -1492,12 +2640,12 @@ var throttleRAF = (fn, opts) => {
|
|
|
1492
2640
|
timerId = null;
|
|
1493
2641
|
}
|
|
1494
2642
|
if (lastArgs) {
|
|
1495
|
-
fn(...
|
|
1496
|
-
lastArgs =
|
|
2643
|
+
fn(...lastArgs);
|
|
2644
|
+
lastArgs = null;
|
|
1497
2645
|
}
|
|
1498
2646
|
};
|
|
1499
2647
|
ret.cancel = () => {
|
|
1500
|
-
lastArgs =
|
|
2648
|
+
lastArgs = null;
|
|
1501
2649
|
if (timerId !== null) {
|
|
1502
2650
|
cancelAnimationFrame(timerId);
|
|
1503
2651
|
timerId = null;
|
|
@@ -1508,67 +2656,6 @@ var throttleRAF = (fn, opts) => {
|
|
|
1508
2656
|
var easeOut = (k) => {
|
|
1509
2657
|
return 1 - Math.pow(1 - k, 4);
|
|
1510
2658
|
};
|
|
1511
|
-
var easeOutInterpolate = (from, to, progress) => {
|
|
1512
|
-
return (to - from) * easeOut(progress) + from;
|
|
1513
|
-
};
|
|
1514
|
-
var easeToValuesRAF = ({
|
|
1515
|
-
fromValues,
|
|
1516
|
-
toValues,
|
|
1517
|
-
onStep,
|
|
1518
|
-
duration = 250,
|
|
1519
|
-
interpolateValue,
|
|
1520
|
-
onStart,
|
|
1521
|
-
onEnd,
|
|
1522
|
-
onCancel
|
|
1523
|
-
}) => {
|
|
1524
|
-
let canceled = false;
|
|
1525
|
-
let frameId = 0;
|
|
1526
|
-
let startTime;
|
|
1527
|
-
function step(timestamp) {
|
|
1528
|
-
if (canceled) {
|
|
1529
|
-
return;
|
|
1530
|
-
}
|
|
1531
|
-
if (startTime === void 0) {
|
|
1532
|
-
startTime = timestamp;
|
|
1533
|
-
onStart?.();
|
|
1534
|
-
}
|
|
1535
|
-
const elapsed = Math.min(timestamp - startTime, duration);
|
|
1536
|
-
const factor = easeOut(elapsed / duration);
|
|
1537
|
-
const newValues = {};
|
|
1538
|
-
Object.keys(fromValues).forEach((key) => {
|
|
1539
|
-
const _key = key;
|
|
1540
|
-
const result = (toValues[_key] - fromValues[_key]) * factor + fromValues[_key];
|
|
1541
|
-
newValues[_key] = result;
|
|
1542
|
-
});
|
|
1543
|
-
onStep(newValues);
|
|
1544
|
-
if (elapsed < duration) {
|
|
1545
|
-
const progress = elapsed / duration;
|
|
1546
|
-
const newValues2 = {};
|
|
1547
|
-
Object.keys(fromValues).forEach((key) => {
|
|
1548
|
-
const _key = key;
|
|
1549
|
-
const startValue = fromValues[_key];
|
|
1550
|
-
const endValue = toValues[_key];
|
|
1551
|
-
let result;
|
|
1552
|
-
result = interpolateValue ? interpolateValue(startValue, endValue, progress, _key) : easeOutInterpolate(startValue, endValue, progress);
|
|
1553
|
-
if (result == null) {
|
|
1554
|
-
result = easeOutInterpolate(startValue, endValue, progress);
|
|
1555
|
-
}
|
|
1556
|
-
newValues2[_key] = result;
|
|
1557
|
-
});
|
|
1558
|
-
onStep(newValues2);
|
|
1559
|
-
frameId = window.requestAnimationFrame(step);
|
|
1560
|
-
} else {
|
|
1561
|
-
onStep(toValues);
|
|
1562
|
-
onEnd?.();
|
|
1563
|
-
}
|
|
1564
|
-
}
|
|
1565
|
-
frameId = window.requestAnimationFrame(step);
|
|
1566
|
-
return () => {
|
|
1567
|
-
onCancel?.();
|
|
1568
|
-
canceled = true;
|
|
1569
|
-
window.cancelAnimationFrame(frameId);
|
|
1570
|
-
};
|
|
1571
|
-
};
|
|
1572
2659
|
var chunk = (array, size) => {
|
|
1573
2660
|
if (!array.length || size < 1) {
|
|
1574
2661
|
return [];
|
|
@@ -1597,6 +2684,9 @@ var removeSelection = () => {
|
|
|
1597
2684
|
}
|
|
1598
2685
|
};
|
|
1599
2686
|
var distance = (x, y) => Math.abs(x - y);
|
|
2687
|
+
var isSelectionLikeTool = (type) => {
|
|
2688
|
+
return type === "selection" || type === "lasso";
|
|
2689
|
+
};
|
|
1600
2690
|
var updateActiveTool = (appState, data) => {
|
|
1601
2691
|
if (data.type === "custom") {
|
|
1602
2692
|
return {
|
|
@@ -1608,7 +2698,7 @@ var updateActiveTool = (appState, data) => {
|
|
|
1608
2698
|
}
|
|
1609
2699
|
return {
|
|
1610
2700
|
...appState.activeTool,
|
|
1611
|
-
lastActiveTool: data.
|
|
2701
|
+
lastActiveTool: data.lastActiveTool === void 0 ? appState.activeTool.lastActiveTool : data.lastActiveTool,
|
|
1612
2702
|
type: data.type,
|
|
1613
2703
|
customType: null,
|
|
1614
2704
|
locked: data.locked ?? appState.activeTool.locked,
|
|
@@ -1618,13 +2708,6 @@ var updateActiveTool = (appState, data) => {
|
|
|
1618
2708
|
var isFullScreen = () => document.fullscreenElement?.nodeName === "HTML";
|
|
1619
2709
|
var allowFullScreen = () => document.documentElement.requestFullscreen();
|
|
1620
2710
|
var exitFullScreen = () => document.exitFullscreen();
|
|
1621
|
-
var getShortcutKey = (shortcut) => {
|
|
1622
|
-
shortcut = shortcut.replace(/\bAlt\b/i, "Alt").replace(/\bShift\b/i, "Shift").replace(/\b(Enter|Return)\b/i, "Enter");
|
|
1623
|
-
if (isDarwin) {
|
|
1624
|
-
return shortcut.replace(/\bCtrlOrCmd\b/gi, "Cmd").replace(/\bAlt\b/i, "Option");
|
|
1625
|
-
}
|
|
1626
|
-
return shortcut.replace(/\bCtrlOrCmd\b/gi, "Ctrl");
|
|
1627
|
-
};
|
|
1628
2711
|
var viewportCoordsToSceneCoords = ({ clientX, clientY }, {
|
|
1629
2712
|
zoom,
|
|
1630
2713
|
offsetLeft,
|
|
@@ -1698,12 +2781,6 @@ var mapFind = (collection, iteratee) => {
|
|
|
1698
2781
|
}
|
|
1699
2782
|
return void 0;
|
|
1700
2783
|
};
|
|
1701
|
-
var isTransparent = (color) => {
|
|
1702
|
-
const isRGBTransparent = color.length === 5 && color.substr(4, 1) === "0";
|
|
1703
|
-
const isRRGGBBTransparent = color.length === 9 && color.substr(7, 2) === "00";
|
|
1704
|
-
return isRGBTransparent || isRRGGBBTransparent || color === COLOR_PALETTE.transparent;
|
|
1705
|
-
};
|
|
1706
|
-
var isBindingFallthroughEnabled = (el) => el.fillStyle !== "solid" || isTransparent(el.backgroundColor);
|
|
1707
2784
|
var resolvablePromise = () => {
|
|
1708
2785
|
let resolve;
|
|
1709
2786
|
let reject;
|
|
@@ -1748,19 +2825,21 @@ var supportsEmoji = () => {
|
|
|
1748
2825
|
return ctx.getImageData(offset, offset, 1, 1).data[0] !== 0;
|
|
1749
2826
|
};
|
|
1750
2827
|
var getNearestScrollableContainer = (element) => {
|
|
2828
|
+
const ownerDocument = element.ownerDocument;
|
|
2829
|
+
const ownerWindow = ownerDocument.defaultView ?? window;
|
|
1751
2830
|
let parent = element.parentElement;
|
|
1752
2831
|
while (parent) {
|
|
1753
|
-
if (parent ===
|
|
1754
|
-
return
|
|
2832
|
+
if (parent === ownerDocument.body) {
|
|
2833
|
+
return ownerDocument;
|
|
1755
2834
|
}
|
|
1756
|
-
const { overflowY } =
|
|
2835
|
+
const { overflowY } = ownerWindow.getComputedStyle(parent);
|
|
1757
2836
|
const hasScrollableContent = parent.scrollHeight > parent.clientHeight;
|
|
1758
2837
|
if (hasScrollableContent && (overflowY === "auto" || overflowY === "scroll" || overflowY === "overlay")) {
|
|
1759
2838
|
return parent;
|
|
1760
2839
|
}
|
|
1761
2840
|
parent = parent.parentElement;
|
|
1762
2841
|
}
|
|
1763
|
-
return
|
|
2842
|
+
return ownerDocument;
|
|
1764
2843
|
};
|
|
1765
2844
|
var focusNearestParent = (element) => {
|
|
1766
2845
|
let parent = element.parentElement;
|
|
@@ -2024,9 +3103,9 @@ function getSvgPathFromStroke(points, closed = true) {
|
|
|
2024
3103
|
var normalizeEOL = (str) => {
|
|
2025
3104
|
return str.replace(/\r?\n|\r/g, "\n");
|
|
2026
3105
|
};
|
|
2027
|
-
|
|
3106
|
+
function toBrandedType(value) {
|
|
2028
3107
|
return value;
|
|
2029
|
-
}
|
|
3108
|
+
}
|
|
2030
3109
|
var promiseTry = async (fn, ...args) => {
|
|
2031
3110
|
return new Promise((resolve) => {
|
|
2032
3111
|
resolve(fn(...args));
|
|
@@ -2066,6 +3145,41 @@ var reduceToCommonValue = (collection, getValue) => {
|
|
|
2066
3145
|
}
|
|
2067
3146
|
return commonValue;
|
|
2068
3147
|
};
|
|
3148
|
+
var FEATURE_FLAGS_STORAGE_KEY = "excalidraw-feature-flags";
|
|
3149
|
+
var DEFAULT_FEATURE_FLAGS = {
|
|
3150
|
+
COMPLEX_BINDINGS: false
|
|
3151
|
+
};
|
|
3152
|
+
var featureFlags = null;
|
|
3153
|
+
var getFeatureFlag = (flag) => {
|
|
3154
|
+
if (!featureFlags) {
|
|
3155
|
+
try {
|
|
3156
|
+
const serializedFlags = localStorage.getItem(FEATURE_FLAGS_STORAGE_KEY);
|
|
3157
|
+
if (serializedFlags) {
|
|
3158
|
+
const flags = JSON.parse(serializedFlags);
|
|
3159
|
+
featureFlags = flags ?? DEFAULT_FEATURE_FLAGS;
|
|
3160
|
+
}
|
|
3161
|
+
} catch {
|
|
3162
|
+
}
|
|
3163
|
+
}
|
|
3164
|
+
return (featureFlags || DEFAULT_FEATURE_FLAGS)[flag];
|
|
3165
|
+
};
|
|
3166
|
+
var setFeatureFlag = (flag, value) => {
|
|
3167
|
+
try {
|
|
3168
|
+
featureFlags = {
|
|
3169
|
+
...featureFlags || DEFAULT_FEATURE_FLAGS,
|
|
3170
|
+
[flag]: value
|
|
3171
|
+
};
|
|
3172
|
+
localStorage.setItem(
|
|
3173
|
+
FEATURE_FLAGS_STORAGE_KEY,
|
|
3174
|
+
JSON.stringify(featureFlags)
|
|
3175
|
+
);
|
|
3176
|
+
} catch (e) {
|
|
3177
|
+
console.error("unable to set feature flag", e);
|
|
3178
|
+
}
|
|
3179
|
+
};
|
|
3180
|
+
var oneOf = (needle, haystack) => {
|
|
3181
|
+
return haystack.includes(needle);
|
|
3182
|
+
};
|
|
2069
3183
|
|
|
2070
3184
|
// src/random.ts
|
|
2071
3185
|
var random = new Random(Date.now());
|
|
@@ -2139,6 +3253,298 @@ var Emitter = class {
|
|
|
2139
3253
|
this.subscribers = [];
|
|
2140
3254
|
}
|
|
2141
3255
|
};
|
|
3256
|
+
|
|
3257
|
+
// src/appEventBus.ts
|
|
3258
|
+
init_define_import_meta_env();
|
|
3259
|
+
var AppEventBus = class {
|
|
3260
|
+
constructor(behavior) {
|
|
3261
|
+
this.behavior = behavior;
|
|
3262
|
+
}
|
|
3263
|
+
emitters = /* @__PURE__ */ new Map();
|
|
3264
|
+
lastPayload = /* @__PURE__ */ new Map();
|
|
3265
|
+
emittedOnce = /* @__PURE__ */ new Set();
|
|
3266
|
+
getEmitter(name) {
|
|
3267
|
+
let emitter = this.emitters.get(name);
|
|
3268
|
+
if (!emitter) {
|
|
3269
|
+
emitter = new Emitter();
|
|
3270
|
+
this.emitters.set(name, emitter);
|
|
3271
|
+
}
|
|
3272
|
+
return emitter;
|
|
3273
|
+
}
|
|
3274
|
+
toPromiseValue(args) {
|
|
3275
|
+
return args.length === 1 ? args[0] : args;
|
|
3276
|
+
}
|
|
3277
|
+
on(name, callback) {
|
|
3278
|
+
const eventBehavior = this.behavior[name];
|
|
3279
|
+
const cachedPayload = this.lastPayload.get(name);
|
|
3280
|
+
if (callback) {
|
|
3281
|
+
if (eventBehavior.replay === "last" && cachedPayload) {
|
|
3282
|
+
queueMicrotask(() => callback(...cachedPayload));
|
|
3283
|
+
if (eventBehavior.cardinality === "once") {
|
|
3284
|
+
return () => {
|
|
3285
|
+
};
|
|
3286
|
+
}
|
|
3287
|
+
}
|
|
3288
|
+
return this.getEmitter(name).on(callback);
|
|
3289
|
+
}
|
|
3290
|
+
if (eventBehavior.cardinality !== "once" || eventBehavior.replay !== "last") {
|
|
3291
|
+
throw new Error(`Event "${String(name)}" requires a callback`);
|
|
3292
|
+
}
|
|
3293
|
+
if (cachedPayload) {
|
|
3294
|
+
return Promise.resolve(this.toPromiseValue(cachedPayload));
|
|
3295
|
+
}
|
|
3296
|
+
return new Promise((resolve) => {
|
|
3297
|
+
this.getEmitter(name).once((...args) => {
|
|
3298
|
+
resolve(this.toPromiseValue(args));
|
|
3299
|
+
});
|
|
3300
|
+
});
|
|
3301
|
+
}
|
|
3302
|
+
emit(name, ...args) {
|
|
3303
|
+
const eventBehavior = this.behavior[name];
|
|
3304
|
+
if (!isProdEnv()) {
|
|
3305
|
+
if (eventBehavior.cardinality === "once") {
|
|
3306
|
+
if (this.emittedOnce.has(name)) {
|
|
3307
|
+
throw new Error(`Event "${String(name)}" can only be emitted once`);
|
|
3308
|
+
}
|
|
3309
|
+
this.emittedOnce.add(name);
|
|
3310
|
+
}
|
|
3311
|
+
}
|
|
3312
|
+
if (eventBehavior.replay === "last") {
|
|
3313
|
+
this.lastPayload.set(name, args);
|
|
3314
|
+
}
|
|
3315
|
+
try {
|
|
3316
|
+
this.getEmitter(name).trigger(...args);
|
|
3317
|
+
} finally {
|
|
3318
|
+
if (eventBehavior.cardinality === "once") {
|
|
3319
|
+
this.getEmitter(name).clear();
|
|
3320
|
+
}
|
|
3321
|
+
}
|
|
3322
|
+
}
|
|
3323
|
+
clear() {
|
|
3324
|
+
this.lastPayload.clear();
|
|
3325
|
+
this.emittedOnce.clear();
|
|
3326
|
+
for (const emitter of this.emitters.values()) {
|
|
3327
|
+
emitter.clear();
|
|
3328
|
+
}
|
|
3329
|
+
this.emitters.clear();
|
|
3330
|
+
}
|
|
3331
|
+
};
|
|
3332
|
+
|
|
3333
|
+
// src/versionedSnapshotStore.ts
|
|
3334
|
+
init_define_import_meta_env();
|
|
3335
|
+
var VersionedSnapshotStore = class {
|
|
3336
|
+
constructor(initialValue, isEqual = Object.is) {
|
|
3337
|
+
this.isEqual = isEqual;
|
|
3338
|
+
this.value = initialValue;
|
|
3339
|
+
}
|
|
3340
|
+
version = 0;
|
|
3341
|
+
value;
|
|
3342
|
+
waiters = /* @__PURE__ */ new Set();
|
|
3343
|
+
subscribers = /* @__PURE__ */ new Set();
|
|
3344
|
+
getSnapshot() {
|
|
3345
|
+
return { version: this.version, value: this.value };
|
|
3346
|
+
}
|
|
3347
|
+
set(nextValue) {
|
|
3348
|
+
if (this.isEqual(this.value, nextValue)) {
|
|
3349
|
+
return false;
|
|
3350
|
+
}
|
|
3351
|
+
this.value = nextValue;
|
|
3352
|
+
this.version += 1;
|
|
3353
|
+
const snapshot = this.getSnapshot();
|
|
3354
|
+
for (const subscriber of this.subscribers) {
|
|
3355
|
+
subscriber(snapshot);
|
|
3356
|
+
}
|
|
3357
|
+
for (const waiter of this.waiters) {
|
|
3358
|
+
waiter(snapshot);
|
|
3359
|
+
}
|
|
3360
|
+
this.waiters.clear();
|
|
3361
|
+
return true;
|
|
3362
|
+
}
|
|
3363
|
+
update(updater) {
|
|
3364
|
+
return this.set(updater(this.value));
|
|
3365
|
+
}
|
|
3366
|
+
subscribe(subscriber) {
|
|
3367
|
+
this.subscribers.add(subscriber);
|
|
3368
|
+
return () => {
|
|
3369
|
+
this.subscribers.delete(subscriber);
|
|
3370
|
+
};
|
|
3371
|
+
}
|
|
3372
|
+
pull(sinceVersion = -1) {
|
|
3373
|
+
if (this.version !== sinceVersion) {
|
|
3374
|
+
return Promise.resolve(this.getSnapshot());
|
|
3375
|
+
}
|
|
3376
|
+
return new Promise((resolve) => {
|
|
3377
|
+
this.waiters.add(resolve);
|
|
3378
|
+
});
|
|
3379
|
+
}
|
|
3380
|
+
};
|
|
3381
|
+
|
|
3382
|
+
// debug.ts
|
|
3383
|
+
init_define_import_meta_env();
|
|
3384
|
+
var lessPrecise = (num, precision = 5) => parseFloat(num.toPrecision(precision));
|
|
3385
|
+
var getAvgFrameTime = (times) => lessPrecise(times.reduce((a, b) => a + b) / times.length);
|
|
3386
|
+
var Debug = class _Debug {
|
|
3387
|
+
static DEBUG_LOG_TIMES = true;
|
|
3388
|
+
static TIMES_AGGR = {};
|
|
3389
|
+
static TIMES_AVG = {};
|
|
3390
|
+
static LAST_DEBUG_LOG_CALL = 0;
|
|
3391
|
+
static DEBUG_LOG_INTERVAL_ID = null;
|
|
3392
|
+
static LAST_FRAME_TIMESTAMP = 0;
|
|
3393
|
+
static FRAME_COUNT = 0;
|
|
3394
|
+
static ANIMATION_FRAME_ID = null;
|
|
3395
|
+
static scheduleAnimationFrame = () => {
|
|
3396
|
+
if (_Debug.DEBUG_LOG_INTERVAL_ID !== null) {
|
|
3397
|
+
_Debug.ANIMATION_FRAME_ID = requestAnimationFrame((timestamp) => {
|
|
3398
|
+
if (_Debug.LAST_FRAME_TIMESTAMP !== timestamp) {
|
|
3399
|
+
_Debug.LAST_FRAME_TIMESTAMP = timestamp;
|
|
3400
|
+
_Debug.FRAME_COUNT++;
|
|
3401
|
+
}
|
|
3402
|
+
if (_Debug.DEBUG_LOG_INTERVAL_ID !== null) {
|
|
3403
|
+
_Debug.scheduleAnimationFrame();
|
|
3404
|
+
}
|
|
3405
|
+
});
|
|
3406
|
+
}
|
|
3407
|
+
};
|
|
3408
|
+
static setupInterval = () => {
|
|
3409
|
+
if (_Debug.DEBUG_LOG_INTERVAL_ID === null) {
|
|
3410
|
+
console.info("%c(starting perf recording)", "color: lime");
|
|
3411
|
+
_Debug.DEBUG_LOG_INTERVAL_ID = window.setInterval(_Debug.debugLogger, 1e3);
|
|
3412
|
+
_Debug.scheduleAnimationFrame();
|
|
3413
|
+
}
|
|
3414
|
+
_Debug.LAST_DEBUG_LOG_CALL = Date.now();
|
|
3415
|
+
};
|
|
3416
|
+
static debugLogger = () => {
|
|
3417
|
+
if (_Debug.DEBUG_LOG_TIMES) {
|
|
3418
|
+
for (const [name, { t, times }] of Object.entries(_Debug.TIMES_AGGR)) {
|
|
3419
|
+
if (times.length) {
|
|
3420
|
+
console.info(
|
|
3421
|
+
name,
|
|
3422
|
+
lessPrecise(times.reduce((a, b) => a + b)),
|
|
3423
|
+
times.sort((a, b) => a - b).map((x) => lessPrecise(x))
|
|
3424
|
+
);
|
|
3425
|
+
_Debug.TIMES_AGGR[name] = { t, times: [] };
|
|
3426
|
+
}
|
|
3427
|
+
}
|
|
3428
|
+
for (const [name, { t, times, avg }] of Object.entries(_Debug.TIMES_AVG)) {
|
|
3429
|
+
if (times.length) {
|
|
3430
|
+
const totalTime = times.reduce((a, b) => a + b);
|
|
3431
|
+
const avgFrameTime = lessPrecise(totalTime / _Debug.FRAME_COUNT);
|
|
3432
|
+
console.info(
|
|
3433
|
+
name,
|
|
3434
|
+
`- ${times.length} calls - ${avgFrameTime}ms/frame across ${_Debug.FRAME_COUNT} frames (${lessPrecise(
|
|
3435
|
+
avgFrameTime / 16.67 * 100,
|
|
3436
|
+
1
|
|
3437
|
+
)}% of frame budget)`
|
|
3438
|
+
);
|
|
3439
|
+
_Debug.TIMES_AVG[name] = {
|
|
3440
|
+
t,
|
|
3441
|
+
times: [],
|
|
3442
|
+
avg: avg != null ? getAvgFrameTime([avg, avgFrameTime]) : avgFrameTime
|
|
3443
|
+
};
|
|
3444
|
+
}
|
|
3445
|
+
}
|
|
3446
|
+
}
|
|
3447
|
+
_Debug.FRAME_COUNT = 0;
|
|
3448
|
+
if (Date.now() - _Debug.LAST_DEBUG_LOG_CALL > 600 && _Debug.DEBUG_LOG_INTERVAL_ID !== null) {
|
|
3449
|
+
console.info("%c(stopping perf recording)", "color: red");
|
|
3450
|
+
window.clearInterval(_Debug.DEBUG_LOG_INTERVAL_ID);
|
|
3451
|
+
window.cancelAnimationFrame(_Debug.ANIMATION_FRAME_ID);
|
|
3452
|
+
_Debug.ANIMATION_FRAME_ID = null;
|
|
3453
|
+
_Debug.FRAME_COUNT = 0;
|
|
3454
|
+
_Debug.LAST_FRAME_TIMESTAMP = 0;
|
|
3455
|
+
_Debug.DEBUG_LOG_INTERVAL_ID = null;
|
|
3456
|
+
_Debug.TIMES_AGGR = {};
|
|
3457
|
+
_Debug.TIMES_AVG = {};
|
|
3458
|
+
}
|
|
3459
|
+
};
|
|
3460
|
+
static logTime = (time, name = "default") => {
|
|
3461
|
+
_Debug.setupInterval();
|
|
3462
|
+
const now = performance.now();
|
|
3463
|
+
const { t, times } = _Debug.TIMES_AGGR[name] = _Debug.TIMES_AGGR[name] || {
|
|
3464
|
+
t: 0,
|
|
3465
|
+
times: []
|
|
3466
|
+
};
|
|
3467
|
+
if (t) {
|
|
3468
|
+
times.push(time != null ? time : now - t);
|
|
3469
|
+
}
|
|
3470
|
+
_Debug.TIMES_AGGR[name].t = now;
|
|
3471
|
+
};
|
|
3472
|
+
static logTimeAverage = (time, name = "default") => {
|
|
3473
|
+
_Debug.setupInterval();
|
|
3474
|
+
const now = performance.now();
|
|
3475
|
+
const { t, times } = _Debug.TIMES_AVG[name] = _Debug.TIMES_AVG[name] || {
|
|
3476
|
+
t: 0,
|
|
3477
|
+
times: []
|
|
3478
|
+
};
|
|
3479
|
+
if (t) {
|
|
3480
|
+
times.push(time != null ? time : now - t);
|
|
3481
|
+
}
|
|
3482
|
+
_Debug.TIMES_AVG[name].t = now;
|
|
3483
|
+
};
|
|
3484
|
+
static logWrapper = (type) => (fn, name = "default") => {
|
|
3485
|
+
return (...args) => {
|
|
3486
|
+
const t0 = performance.now();
|
|
3487
|
+
const ret = fn(...args);
|
|
3488
|
+
_Debug[type](performance.now() - t0, name);
|
|
3489
|
+
return ret;
|
|
3490
|
+
};
|
|
3491
|
+
};
|
|
3492
|
+
static logTimeWrap = _Debug.logWrapper("logTime");
|
|
3493
|
+
static logTimeAverageWrap = _Debug.logWrapper("logTimeAverage");
|
|
3494
|
+
static perfWrap = (fn, name = "default") => {
|
|
3495
|
+
return (...args) => {
|
|
3496
|
+
console.time(name);
|
|
3497
|
+
const ret = fn(...args);
|
|
3498
|
+
console.timeEnd(name);
|
|
3499
|
+
return ret;
|
|
3500
|
+
};
|
|
3501
|
+
};
|
|
3502
|
+
static CHANGED_CACHE = {};
|
|
3503
|
+
static logChanged(name, obj) {
|
|
3504
|
+
const prev = _Debug.CHANGED_CACHE[name];
|
|
3505
|
+
_Debug.CHANGED_CACHE[name] = obj;
|
|
3506
|
+
if (!prev) {
|
|
3507
|
+
return;
|
|
3508
|
+
}
|
|
3509
|
+
const allKeys = /* @__PURE__ */ new Set([...Object.keys(prev), ...Object.keys(obj)]);
|
|
3510
|
+
const changed = {};
|
|
3511
|
+
for (const key of allKeys) {
|
|
3512
|
+
const prevVal = prev[key];
|
|
3513
|
+
const nextVal = obj[key];
|
|
3514
|
+
if (!deepEqual(prevVal, nextVal)) {
|
|
3515
|
+
changed[key] = { prev: prevVal, next: nextVal };
|
|
3516
|
+
}
|
|
3517
|
+
}
|
|
3518
|
+
if (Object.keys(changed).length > 0) {
|
|
3519
|
+
console.info(`[${name}] changed:`, changed);
|
|
3520
|
+
}
|
|
3521
|
+
}
|
|
3522
|
+
};
|
|
3523
|
+
function deepEqual(a, b) {
|
|
3524
|
+
if (Object.is(a, b)) {
|
|
3525
|
+
return true;
|
|
3526
|
+
}
|
|
3527
|
+
if (a === null || b === null || typeof a !== "object" || typeof b !== "object") {
|
|
3528
|
+
return false;
|
|
3529
|
+
}
|
|
3530
|
+
if (Array.isArray(a) !== Array.isArray(b)) {
|
|
3531
|
+
return false;
|
|
3532
|
+
}
|
|
3533
|
+
const keysA = Object.keys(a);
|
|
3534
|
+
const keysB = Object.keys(b);
|
|
3535
|
+
if (keysA.length !== keysB.length) {
|
|
3536
|
+
return false;
|
|
3537
|
+
}
|
|
3538
|
+
for (const key of keysA) {
|
|
3539
|
+
if (!deepEqual(
|
|
3540
|
+
a[key],
|
|
3541
|
+
b[key]
|
|
3542
|
+
)) {
|
|
3543
|
+
return false;
|
|
3544
|
+
}
|
|
3545
|
+
}
|
|
3546
|
+
return true;
|
|
3547
|
+
}
|
|
2142
3548
|
export {
|
|
2143
3549
|
ACTIVE_THRESHOLD,
|
|
2144
3550
|
ALLOWED_PASTE_MIME_TYPES,
|
|
@@ -2146,10 +3552,12 @@ export {
|
|
|
2146
3552
|
ARROW_LABEL_FONT_SIZE_TO_MIN_WIDTH_RATIO,
|
|
2147
3553
|
ARROW_LABEL_WIDTH_FRACTION,
|
|
2148
3554
|
ARROW_TYPE,
|
|
3555
|
+
AppEventBus,
|
|
3556
|
+
BIND_MODE_TIMEOUT,
|
|
2149
3557
|
BOUND_TEXT_PADDING,
|
|
3558
|
+
BUCKET_FILL_BACKGROUND_PICKS,
|
|
2150
3559
|
BinaryHeap,
|
|
2151
3560
|
CANVAS_ONLY_ACTIONS,
|
|
2152
|
-
CANVAS_PALETTE_SHADE_INDEXES,
|
|
2153
3561
|
CANVAS_SEARCH_TAB,
|
|
2154
3562
|
CJK_HAND_DRAWN_FALLBACK_FONT,
|
|
2155
3563
|
CLASSES,
|
|
@@ -2158,9 +3566,11 @@ export {
|
|
|
2158
3566
|
COLOR_CHARCOAL_BLACK,
|
|
2159
3567
|
COLOR_OUTLINE_CONTRAST_THRESHOLD,
|
|
2160
3568
|
COLOR_PALETTE,
|
|
3569
|
+
COLOR_TOP_PICKS_SLOTS,
|
|
2161
3570
|
COLOR_VOICE_CALL,
|
|
2162
3571
|
COLOR_WHITE,
|
|
2163
3572
|
CURSOR_TYPE,
|
|
3573
|
+
DARK_THEME_FILTER,
|
|
2164
3574
|
DEFAULT_ADAPTIVE_RADIUS,
|
|
2165
3575
|
DEFAULT_CANVAS_BACKGROUND_PICKS,
|
|
2166
3576
|
DEFAULT_CHART_COLOR_INDEX,
|
|
@@ -2172,26 +3582,31 @@ export {
|
|
|
2172
3582
|
DEFAULT_ELEMENT_STROKE_COLOR_INDEX,
|
|
2173
3583
|
DEFAULT_ELEMENT_STROKE_COLOR_PALETTE,
|
|
2174
3584
|
DEFAULT_ELEMENT_STROKE_PICKS,
|
|
3585
|
+
DEFAULT_ELEMENT_STROKE_WIDTH_KEY,
|
|
2175
3586
|
DEFAULT_EXPORT_PADDING,
|
|
2176
3587
|
DEFAULT_FILENAME,
|
|
2177
3588
|
DEFAULT_FONT_FAMILY,
|
|
2178
3589
|
DEFAULT_FONT_SIZE,
|
|
2179
3590
|
DEFAULT_GRID_SIZE,
|
|
2180
3591
|
DEFAULT_GRID_STEP,
|
|
3592
|
+
DEFAULT_IMAGE_OPTIONS,
|
|
2181
3593
|
DEFAULT_LASER_COLOR,
|
|
2182
|
-
DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT,
|
|
2183
3594
|
DEFAULT_PROPORTIONAL_RADIUS,
|
|
2184
3595
|
DEFAULT_REDUCED_GLOBAL_ALPHA,
|
|
2185
3596
|
DEFAULT_SIDEBAR,
|
|
3597
|
+
DEFAULT_STROKE_STREAMLINE,
|
|
3598
|
+
DEFAULT_STROKE_STREAMLINE_PRECISE,
|
|
2186
3599
|
DEFAULT_TEXT_ALIGN,
|
|
2187
3600
|
DEFAULT_TRANSFORM_HANDLE_SPACING,
|
|
2188
3601
|
DEFAULT_UI_OPTIONS,
|
|
2189
3602
|
DEFAULT_VERSION,
|
|
2190
3603
|
DEFAULT_VERTICAL_ALIGN,
|
|
3604
|
+
DOUBLE_TAP_POSITION_THRESHOLD,
|
|
2191
3605
|
DRAGGING_THRESHOLD,
|
|
3606
|
+
Debug,
|
|
2192
3607
|
EDITOR_LS_KEYS,
|
|
2193
|
-
ELEMENTS_PALETTE_SHADE_INDEXES,
|
|
2194
3608
|
ELEMENT_LINK_KEY,
|
|
3609
|
+
ELEMENT_PENDING_DRAW_SHAPE_OPACITY,
|
|
2195
3610
|
ELEMENT_READY_TO_ERASE_OPACITY,
|
|
2196
3611
|
ELEMENT_SHIFT_TRANSLATE_AMOUNT,
|
|
2197
3612
|
ELEMENT_TRANSLATE_AMOUNT,
|
|
@@ -2207,7 +3622,9 @@ export {
|
|
|
2207
3622
|
FONT_FAMILY_FALLBACKS,
|
|
2208
3623
|
FONT_FAMILY_GENERIC_FALLBACKS,
|
|
2209
3624
|
FONT_METADATA,
|
|
3625
|
+
FONT_SIZES,
|
|
2210
3626
|
FRAME_STYLE,
|
|
3627
|
+
FREEDRAW_STROKE_WIDTH,
|
|
2211
3628
|
GOOGLE_FONTS_RANGES,
|
|
2212
3629
|
HYPERLINK_TOOLTIP_DELAY,
|
|
2213
3630
|
IDLE_THRESHOLD,
|
|
@@ -2220,18 +3637,22 @@ export {
|
|
|
2220
3637
|
LINE_CONFIRM_THRESHOLD,
|
|
2221
3638
|
LINE_POLYGON_POINT_MERGE_DISTANCE,
|
|
2222
3639
|
LOCAL_FONT_PROTOCOL,
|
|
2223
|
-
MAX_ALLOWED_FILE_BYTES,
|
|
2224
3640
|
MAX_CUSTOM_COLORS_USED_IN_CANVAS,
|
|
2225
3641
|
MAX_DECIMALS_FOR_SVG_EXPORT,
|
|
2226
3642
|
MAX_ZOOM,
|
|
2227
3643
|
MIME_TYPES,
|
|
3644
|
+
MINIMUM_ARROW_SIZE,
|
|
2228
3645
|
MIN_FONT_SIZE,
|
|
2229
3646
|
MIN_WIDTH_OR_HEIGHT,
|
|
2230
3647
|
MIN_ZOOM,
|
|
3648
|
+
MOBILE_ACTION_BUTTON_BG,
|
|
2231
3649
|
MONOSPACE_GENERIC_FONT,
|
|
2232
3650
|
MQ_MAX_HEIGHT_LANDSCAPE,
|
|
3651
|
+
MQ_MAX_MOBILE,
|
|
3652
|
+
MQ_MAX_TABLET,
|
|
2233
3653
|
MQ_MAX_WIDTH_LANDSCAPE,
|
|
2234
|
-
|
|
3654
|
+
MQ_MIN_TABLET,
|
|
3655
|
+
MQ_MIN_WIDTH_DESKTOP,
|
|
2235
3656
|
MQ_RIGHT_SIDEBAR_MIN_WIDTH,
|
|
2236
3657
|
ORIG_ID,
|
|
2237
3658
|
POINTER_BUTTON,
|
|
@@ -2245,7 +3666,9 @@ export {
|
|
|
2245
3666
|
SHIFT_LOCKING_ANGLE,
|
|
2246
3667
|
SIDE_RESIZING_THRESHOLD,
|
|
2247
3668
|
STATS_PANELS,
|
|
3669
|
+
STRING_MIME_TYPES,
|
|
2248
3670
|
STROKE_WIDTH,
|
|
3671
|
+
STROKE_WIDTH_KEYS,
|
|
2249
3672
|
SVG_DOCUMENT_PREAMBLE,
|
|
2250
3673
|
SVG_NS,
|
|
2251
3674
|
TAP_TWICE_TIMEOUT,
|
|
@@ -2253,7 +3676,6 @@ export {
|
|
|
2253
3676
|
TEXT_AUTOWRAP_THRESHOLD,
|
|
2254
3677
|
TEXT_TO_CENTER_SNAP_THRESHOLD,
|
|
2255
3678
|
THEME,
|
|
2256
|
-
THEME_FILTER,
|
|
2257
3679
|
TITLE_TIMEOUT,
|
|
2258
3680
|
TOOL_TYPE,
|
|
2259
3681
|
TOUCH_CTX_MENU_TIMEOUT,
|
|
@@ -2263,11 +3685,13 @@ export {
|
|
|
2263
3685
|
VERSIONS,
|
|
2264
3686
|
VERSION_TIMEOUT,
|
|
2265
3687
|
VERTICAL_ALIGN,
|
|
3688
|
+
VersionedSnapshotStore,
|
|
2266
3689
|
WINDOWS_EMOJI_FALLBACK_FONT,
|
|
2267
3690
|
YOUTUBE_STATES,
|
|
2268
3691
|
ZOOM_STEP,
|
|
2269
3692
|
addEventListener,
|
|
2270
3693
|
allowFullScreen,
|
|
3694
|
+
applyDarkModeFilter,
|
|
2271
3695
|
arrayToList,
|
|
2272
3696
|
arrayToMap,
|
|
2273
3697
|
arrayToMapWithIndex,
|
|
@@ -2278,11 +3702,13 @@ export {
|
|
|
2278
3702
|
castArray,
|
|
2279
3703
|
chunk,
|
|
2280
3704
|
cloneJSON,
|
|
3705
|
+
colorToHex,
|
|
2281
3706
|
composeEventHandlers,
|
|
3707
|
+
createUserAgentDescriptor,
|
|
2282
3708
|
debounce,
|
|
3709
|
+
deriveStylesPanelMode,
|
|
2283
3710
|
distance,
|
|
2284
3711
|
easeOut,
|
|
2285
|
-
easeToValuesRAF,
|
|
2286
3712
|
escapeDoubleQuotes,
|
|
2287
3713
|
exitFullScreen,
|
|
2288
3714
|
findIndex,
|
|
@@ -2291,18 +3717,19 @@ export {
|
|
|
2291
3717
|
getAllColorsSpecificShade,
|
|
2292
3718
|
getDateTime,
|
|
2293
3719
|
getExportSource,
|
|
3720
|
+
getFeatureFlag,
|
|
2294
3721
|
getFontFamilyFallbacks,
|
|
2295
3722
|
getFontFamilyString,
|
|
2296
3723
|
getFontString,
|
|
3724
|
+
getFormFactor,
|
|
2297
3725
|
getFrame,
|
|
2298
3726
|
getGenericFontFamilyFallback,
|
|
2299
3727
|
getGlobalCSSVariable,
|
|
2300
3728
|
getGridPoint,
|
|
2301
3729
|
getLineHeight,
|
|
2302
3730
|
getNearestScrollableContainer,
|
|
2303
|
-
getShortcutKey,
|
|
2304
3731
|
getSizeFromPoints,
|
|
2305
|
-
|
|
3732
|
+
getStrokeWidthByKey,
|
|
2306
3733
|
getSvgPathFromStroke,
|
|
2307
3734
|
getUpdatedTimestamp,
|
|
2308
3735
|
getVersion,
|
|
@@ -2311,9 +3738,10 @@ export {
|
|
|
2311
3738
|
isAndroid,
|
|
2312
3739
|
isAnyTrue,
|
|
2313
3740
|
isArrowKey,
|
|
2314
|
-
|
|
3741
|
+
isBounds,
|
|
2315
3742
|
isBrave,
|
|
2316
3743
|
isChrome,
|
|
3744
|
+
isColorDark,
|
|
2317
3745
|
isDarwin,
|
|
2318
3746
|
isDevEnv,
|
|
2319
3747
|
isFirefox,
|
|
@@ -2324,6 +3752,8 @@ export {
|
|
|
2324
3752
|
isLatinChar,
|
|
2325
3753
|
isLocalLink,
|
|
2326
3754
|
isMemberOf,
|
|
3755
|
+
isMobileBreakpoint,
|
|
3756
|
+
isOpaqueColor,
|
|
2327
3757
|
isPrimitive,
|
|
2328
3758
|
isProdEnv,
|
|
2329
3759
|
isPromiseLike,
|
|
@@ -2331,35 +3761,44 @@ export {
|
|
|
2331
3761
|
isReadonlyArray,
|
|
2332
3762
|
isRunningInIframe,
|
|
2333
3763
|
isSafari,
|
|
3764
|
+
isSelectionLikeTool,
|
|
2334
3765
|
isServerEnv,
|
|
2335
3766
|
isShallowEqual,
|
|
3767
|
+
isTabletBreakpoint,
|
|
2336
3768
|
isTestEnv,
|
|
2337
3769
|
isToolIcon,
|
|
2338
3770
|
isTransparent,
|
|
2339
3771
|
isWindows,
|
|
2340
3772
|
isWritableElement,
|
|
3773
|
+
loadDesktopUIModePreference,
|
|
2341
3774
|
mapFind,
|
|
2342
3775
|
matchKey,
|
|
2343
3776
|
memoize,
|
|
2344
3777
|
muteFSAbortError,
|
|
2345
3778
|
nFormatter,
|
|
3779
|
+
nextAnimationFrame,
|
|
2346
3780
|
normalizeEOL,
|
|
3781
|
+
normalizeInputColor,
|
|
2347
3782
|
normalizeLink,
|
|
3783
|
+
oneOf,
|
|
2348
3784
|
preventUnload,
|
|
2349
3785
|
promiseTry,
|
|
2350
3786
|
queryFocusableElements,
|
|
2351
3787
|
randomId,
|
|
2352
3788
|
randomInteger,
|
|
2353
3789
|
reduceToCommonValue,
|
|
3790
|
+
removeDarkModeFilter,
|
|
2354
3791
|
removeSelection,
|
|
2355
3792
|
rescalePoints,
|
|
2356
3793
|
reseed,
|
|
2357
3794
|
resolvablePromise,
|
|
2358
|
-
rgbToHex,
|
|
3795
|
+
rgbToHex2 as rgbToHex,
|
|
2359
3796
|
safelyParseJSON,
|
|
2360
3797
|
sceneCoordsToViewportCoords,
|
|
2361
3798
|
selectNode,
|
|
2362
3799
|
setDateTimeForTests,
|
|
3800
|
+
setDesktopUIMode,
|
|
3801
|
+
setFeatureFlag,
|
|
2363
3802
|
shouldMaintainAspectRatio,
|
|
2364
3803
|
shouldResizeFromCenter,
|
|
2365
3804
|
shouldRotateWithDiscreteAngle,
|