@excalidraw/common 0.18.0-9ba0f5d → 0.18.0-a52cd20
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 +518 -105
- package/dist/dev/index.js.map +4 -4
- package/dist/prod/index.js +3 -3
- package/dist/types/common/debug.d.ts +21 -0
- package/dist/types/common/src/appEventBus.d.ts +27 -0
- package/dist/types/common/src/colors.d.ts +36 -14
- package/dist/types/common/src/constants.d.ts +70 -7
- package/dist/types/common/src/index.d.ts +3 -0
- package/dist/types/common/src/keys.d.ts +4 -0
- package/dist/types/common/src/points.d.ts +1 -1
- package/dist/types/common/src/random.d.ts +7 -0
- package/dist/types/common/src/utils.d.ts +10 -50
- package/dist/types/common/src/versionedSnapshotStore.d.ts +17 -0
- package/dist/types/element/src/Scene.d.ts +9 -5
- package/dist/types/element/src/align.d.ts +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 +37 -17
- package/dist/types/element/src/bounds.d.ts +23 -8
- package/dist/types/element/src/bucketFill.d.ts +110 -0
- package/dist/types/element/src/collision.d.ts +7 -3
- package/dist/types/element/src/comparisons.d.ts +8 -5
- package/dist/types/element/src/convertToShape.d.ts +23 -0
- package/dist/types/element/src/delta.d.ts +23 -1
- package/dist/types/element/src/distribute.d.ts +3 -2
- package/dist/types/element/src/dragElements.d.ts +27 -0
- package/dist/types/element/src/duplicate.d.ts +64 -3
- 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 +11 -7
- package/dist/types/element/src/fractionalIndex.d.ts +2 -2
- package/dist/types/element/src/frame.d.ts +11 -10
- package/dist/types/element/src/groups.d.ts +9 -9
- package/dist/types/element/src/index.d.ts +8 -1
- package/dist/types/element/src/linearElementEditor.d.ts +32 -10
- package/dist/types/element/src/mutateElement.d.ts +3 -1
- package/dist/types/element/src/newElement.d.ts +53 -3
- package/dist/types/element/src/renderElement.d.ts +21 -7
- package/dist/types/element/src/resizeElements.d.ts +2 -2
- package/dist/types/element/src/selection.d.ts +12 -8
- package/dist/types/element/src/shape.d.ts +28 -2
- package/dist/types/element/src/sizeHelpers.d.ts +6 -0
- package/dist/types/element/src/sortElements.d.ts +10 -0
- package/dist/types/element/src/stickyNote.d.ts +183 -0
- package/dist/types/element/src/textElement.d.ts +21 -10
- package/dist/types/element/src/textWrapping.d.ts +26 -0
- package/dist/types/element/src/transform.d.ts +26 -7
- package/dist/types/element/src/typeChecks.d.ts +29 -27
- package/dist/types/element/src/types.d.ts +48 -9
- package/dist/types/element/src/utils.d.ts +19 -6
- package/dist/types/element/src/zindex.d.ts +2 -2
- package/dist/types/excalidraw/actions/actionAddToLibrary.d.ts +125 -53
- package/dist/types/excalidraw/actions/actionAlign.d.ts +6 -6
- package/dist/types/excalidraw/actions/actionBoundText.d.ts +85 -37
- package/dist/types/excalidraw/actions/actionCanvas.d.ts +410 -1073
- package/dist/types/excalidraw/actions/actionClipboard.d.ts +84 -36
- package/dist/types/excalidraw/actions/actionCropEditor.d.ts +42 -18
- package/dist/types/excalidraw/actions/actionDeleteSelected.d.ts +131 -56
- package/dist/types/excalidraw/actions/actionDeselect.d.ts +182 -0
- package/dist/types/excalidraw/actions/actionDistribute.d.ts +2 -3
- package/dist/types/excalidraw/actions/actionElementLink.d.ts +38 -18
- package/dist/types/excalidraw/actions/actionElementLock.d.ts +85 -37
- package/dist/types/excalidraw/actions/actionExport.d.ts +171 -397
- package/dist/types/excalidraw/actions/actionFinalize.d.ts +1 -0
- package/dist/types/excalidraw/actions/actionFrame.d.ts +187 -236
- package/dist/types/excalidraw/actions/actionGroup.d.ts +100 -52
- package/dist/types/excalidraw/actions/actionLinearEditor.d.ts +99 -21
- package/dist/types/excalidraw/actions/actionLink.d.ts +43 -19
- package/dist/types/excalidraw/actions/actionMenu.d.ts +38 -18
- package/dist/types/excalidraw/actions/actionProperties.d.ts +120 -56
- package/dist/types/excalidraw/actions/actionSelectAll.d.ts +47 -23
- package/dist/types/excalidraw/actions/actionStyles.d.ts +43 -18
- package/dist/types/excalidraw/actions/actionTextAutoResize.d.ts +3 -3
- package/dist/types/excalidraw/actions/{actionEmbeddable.d.ts → actionToggleArrowBinding.d.ts} +57 -32
- package/dist/types/excalidraw/actions/actionToggleGridMode.d.ts +46 -23
- package/dist/types/excalidraw/actions/actionToggleMidpointSnapping.d.ts +195 -0
- package/dist/types/excalidraw/actions/actionToggleObjectsSnapMode.d.ts +43 -19
- package/dist/types/excalidraw/actions/actionToggleSearchMenu.d.ts +42 -23
- package/dist/types/excalidraw/actions/actionToggleShapeSwitch.d.ts +1 -1
- package/dist/types/excalidraw/actions/actionToggleStats.d.ts +43 -19
- package/dist/types/excalidraw/actions/actionToggleViewMode.d.ts +44 -20
- package/dist/types/excalidraw/actions/actionToggleZenMode.d.ts +43 -19
- package/dist/types/excalidraw/actions/colorTargets.d.ts +39 -0
- package/dist/types/excalidraw/actions/index.d.ts +4 -2
- package/dist/types/excalidraw/actions/manager.d.ts +1 -0
- package/dist/types/excalidraw/actions/shortcuts.d.ts +1 -1
- package/dist/types/excalidraw/actions/types.d.ts +8 -4
- package/dist/types/excalidraw/{animated-trail.d.ts → animatedTrail.d.ts} +4 -3
- package/dist/types/excalidraw/appState.d.ts +55 -29
- 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 +8 -9
- package/dist/types/excalidraw/components/Actions.d.ts +17 -12
- package/dist/types/excalidraw/components/ActiveConfirmDialog.d.ts +1 -1
- package/dist/types/excalidraw/components/App.arrowText.d.ts +70 -0
- package/dist/types/excalidraw/components/App.bucketFill.d.ts +48 -0
- package/dist/types/excalidraw/components/App.cursor.d.ts +38 -0
- package/dist/types/excalidraw/components/App.d.ts +604 -89
- package/dist/types/excalidraw/components/App.drawshape.d.ts +55 -0
- package/dist/types/excalidraw/components/App.duplicate.d.ts +51 -0
- package/dist/types/excalidraw/components/App.flowchart.d.ts +21 -0
- package/dist/types/excalidraw/components/App.pan.d.ts +62 -0
- package/dist/types/excalidraw/components/App.textTool.d.ts +140 -0
- package/dist/types/excalidraw/components/App.toolDrag.d.ts +63 -0
- package/dist/types/excalidraw/components/App.viewport.d.ts +113 -0
- package/dist/types/excalidraw/components/App.wheel.d.ts +26 -0
- package/dist/types/excalidraw/components/AppStateObserver.d.ts +37 -0
- package/dist/types/excalidraw/components/ColorPicker/ColorPicker.d.ts +9 -3
- package/dist/types/excalidraw/components/ColorPicker/CustomColorList.d.ts +3 -1
- package/dist/types/excalidraw/components/ColorPicker/Picker.d.ts +5 -1
- package/dist/types/excalidraw/components/ColorPicker/PickerColorList.d.ts +9 -2
- package/dist/types/excalidraw/components/ColorPicker/ShadeList.d.ts +4 -2
- package/dist/types/excalidraw/components/ColorPicker/TopPicks.d.ts +8 -1
- package/dist/types/excalidraw/components/ColorPicker/colorPickerUtils.d.ts +1 -1
- package/dist/types/excalidraw/components/ColorPicker/colorTopPicksDnD.d.ts +11 -0
- package/dist/types/excalidraw/components/ColorPicker/keyboardNavHandlers.d.ts +2 -1
- package/dist/types/excalidraw/components/CommandPalette/defaultCommandPaletteItems.d.ts +1 -2
- package/dist/types/excalidraw/components/CommandPalette/types.d.ts +1 -1
- package/dist/types/excalidraw/components/ConvertElementTypePopup.d.ts +2 -2
- package/dist/types/excalidraw/components/CursorHint.d.ts +46 -0
- package/dist/types/excalidraw/components/EyeDropper.d.ts +1 -1
- package/dist/types/excalidraw/components/FileDropOverlay.d.ts +2 -0
- package/dist/types/excalidraw/components/FontPicker/FontPicker.d.ts +4 -1
- package/dist/types/excalidraw/components/FontPicker/FontPickerList.d.ts +6 -1
- package/dist/types/excalidraw/components/FontPicker/fontTopPicksDnD.d.ts +12 -0
- package/dist/types/excalidraw/components/IconButton.d.ts +48 -0
- package/dist/types/excalidraw/components/IconPicker.d.ts +14 -9
- package/dist/types/excalidraw/components/Island.d.ts +7 -0
- package/dist/types/excalidraw/components/LaserPointerButton.d.ts +2 -4
- package/dist/types/excalidraw/components/LayerUI.d.ts +5 -2
- package/dist/types/excalidraw/components/LibraryMenu.d.ts +1 -1
- package/dist/types/excalidraw/components/LibraryMenuSection.d.ts +6 -2
- package/dist/types/excalidraw/components/LibraryUnit.d.ts +7 -2
- package/dist/types/excalidraw/components/LockButton.d.ts +3 -4
- package/dist/types/excalidraw/components/MagicButton.d.ts +0 -2
- package/dist/types/excalidraw/components/MobileMenu.d.ts +4 -4
- package/dist/types/excalidraw/components/MobileToolbar.d.ts +9 -0
- package/dist/types/excalidraw/components/OverwriteConfirm/OverwriteConfirmState.d.ts +1 -1
- package/dist/types/excalidraw/components/PasteChartDialog.d.ts +4 -5
- package/dist/types/excalidraw/components/PenModeButton.d.ts +2 -5
- package/dist/types/excalidraw/components/Popover.d.ts +1 -3
- package/dist/types/excalidraw/components/PropertiesPopover.d.ts +1 -1
- package/dist/types/excalidraw/components/{ButtonIcon.d.ts → RadioButton.d.ts} +2 -5
- package/dist/types/excalidraw/components/Range.d.ts +10 -4
- package/dist/types/excalidraw/components/SVGLayer.d.ts +1 -1
- package/dist/types/excalidraw/components/SearchMenu.d.ts +1 -1
- package/dist/types/excalidraw/components/Sidebar/Sidebar.d.ts +1 -1
- package/dist/types/excalidraw/components/Stats/Angle.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/Dimension.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/DragInput.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/MultiAngle.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/MultiDimension.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/MultiPosition.d.ts +2 -2
- package/dist/types/excalidraw/components/Stats/Position.d.ts +3 -3
- package/dist/types/excalidraw/components/Stats/utils.d.ts +1 -1
- package/dist/types/excalidraw/components/TTDDialog/Chat/ChatInterface.d.ts +2 -6
- package/dist/types/excalidraw/components/TTDDialog/Chat/TTDChatPanel.d.ts +2 -1
- package/dist/types/excalidraw/components/TTDDialog/CodeMirrorEditor.d.ts +11 -0
- package/dist/types/excalidraw/components/TTDDialog/TTDContext.d.ts +4 -4
- package/dist/types/excalidraw/components/TTDDialog/TTDDialog.d.ts +11 -7
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogInput.d.ts +3 -3
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogOutput.d.ts +4 -1
- package/dist/types/excalidraw/components/TTDDialog/TTDWelcomeMessage.d.ts +1 -0
- package/dist/types/excalidraw/components/TTDDialog/TextToDiagram.d.ts +2 -1
- package/dist/types/excalidraw/components/TTDDialog/mermaid-lang-lite.d.ts +2 -0
- package/dist/types/excalidraw/components/TTDDialog/types.d.ts +4 -0
- package/dist/types/excalidraw/components/TTDDialog/useTTDChatStorage.d.ts +3 -3
- package/dist/types/excalidraw/components/TTDDialog/utils/mermaidAutoFix.d.ts +1 -0
- package/dist/types/excalidraw/components/TTDDialog/utils/mermaidError.d.ts +10 -0
- package/dist/types/excalidraw/components/Toast.d.ts +8 -4
- package/dist/types/excalidraw/components/ToolPopover.d.ts +3 -6
- package/dist/types/excalidraw/components/Toolbar.d.ts +11 -0
- package/dist/types/excalidraw/components/Tools.d.ts +151 -0
- package/dist/types/excalidraw/components/Tooltip.d.ts +15 -1
- package/dist/types/excalidraw/components/TopPicksDnD/TopPicksContextMenu.d.ts +14 -0
- package/dist/types/excalidraw/components/TopPicksDnD/TopPicksTip.d.ts +11 -0
- package/dist/types/excalidraw/components/TopPicksDnD/topPicksDnD.d.ts +58 -0
- package/dist/types/excalidraw/components/UserList.d.ts +3 -2
- package/dist/types/excalidraw/components/ViewportStatusFrame/ViewportStatusFrame.d.ts +11 -0
- package/dist/types/excalidraw/components/canvases/InteractiveCanvas.d.ts +4 -1
- package/dist/types/excalidraw/components/canvases/NewElementCanvas.d.ts +3 -0
- package/dist/types/excalidraw/components/canvases/StaticCanvas.d.ts +1 -1
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenu.d.ts +30 -16
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuContent.d.ts +3 -2
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItem.d.ts +11 -12
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemCheckbox.d.ts +5 -0
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContent.d.ts +2 -1
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuItemContentRadio.d.ts +2 -1
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSub.d.ts +23 -0
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubContent.d.ts +8 -0
- package/dist/types/excalidraw/components/dropdownMenu/DropdownMenuSubTrigger.d.ts +12 -0
- package/dist/types/excalidraw/components/dropdownMenu/common.d.ts +1 -1
- package/dist/types/excalidraw/components/dropdownMenu/dropdownMenuUtils.d.ts +2 -0
- package/dist/types/excalidraw/components/footer/Footer.d.ts +3 -1
- package/dist/types/excalidraw/components/hyperlink/helpers.d.ts +2 -2
- package/dist/types/excalidraw/components/icons.d.ts +30 -10
- package/dist/types/excalidraw/components/main-menu/DefaultItems.d.ts +26 -3
- package/dist/types/excalidraw/components/main-menu/MainMenu.d.ts +23 -14
- package/dist/types/excalidraw/components/positionElementBesideCursor.d.ts +26 -0
- package/dist/types/excalidraw/components/shapeActionPredicates.d.ts +39 -0
- package/dist/types/excalidraw/data/blob.d.ts +221 -174
- package/dist/types/excalidraw/data/filesystem.d.ts +3 -5
- package/dist/types/excalidraw/data/index.d.ts +6 -7
- package/dist/types/excalidraw/data/json.d.ts +119 -87
- package/dist/types/excalidraw/data/library.d.ts +1 -1
- package/dist/types/excalidraw/data/resave.d.ts +7 -2
- package/dist/types/excalidraw/drawShapeTrail.d.ts +16 -0
- package/dist/types/excalidraw/eraser/index.d.ts +2 -3
- package/dist/types/excalidraw/fonts/Fonts.d.ts +3 -2
- package/dist/types/excalidraw/hooks/useAppStateValue.d.ts +29 -0
- package/dist/types/excalidraw/hooks/useLibraryItemSvg.d.ts +1 -1
- package/dist/types/excalidraw/hooks/useTextEditorFocus.d.ts +5 -5
- package/dist/types/excalidraw/{laser-trails.d.ts → laserTrails.d.ts} +5 -7
- package/dist/types/excalidraw/lasso/index.d.ts +2 -3
- package/dist/types/excalidraw/lasso/utils.d.ts +2 -0
- package/dist/types/excalidraw/renderOverrides.d.ts +9 -0
- package/dist/types/excalidraw/renderer/animation.d.ts +5 -1
- package/dist/types/excalidraw/renderer/helpers.d.ts +25 -0
- package/dist/types/excalidraw/renderer/interactiveScene.d.ts +2 -4
- package/dist/types/excalidraw/scene/Renderer.d.ts +489 -20
- package/dist/types/excalidraw/scene/export.d.ts +3 -3
- package/dist/types/excalidraw/scene/index.d.ts +2 -2
- package/dist/types/excalidraw/scene/types.d.ts +7 -4
- package/dist/types/excalidraw/snapping.d.ts +7 -7
- package/dist/types/excalidraw/textAutoResizeHandle.d.ts +15 -0
- package/dist/types/excalidraw/types.d.ts +619 -42
- package/dist/types/excalidraw/viewport.d.ts +302 -0
- package/dist/types/excalidraw/wysiwyg/textWysiwyg.d.ts +12 -3
- package/dist/types/fractional-indexing/src/index.d.ts +29 -0
- package/dist/types/laser-pointer/src/index.d.ts +2 -0
- package/dist/types/laser-pointer/src/math.d.ts +16 -0
- package/dist/types/laser-pointer/src/simplify.d.ts +2 -0
- package/dist/types/laser-pointer/src/state.d.ts +36 -0
- package/dist/types/math/src/constants.d.ts +0 -1
- package/dist/types/math/src/curve.d.ts +23 -13
- package/dist/types/math/src/index.d.ts +1 -0
- package/dist/types/math/src/pca.d.ts +79 -0
- package/dist/types/math/src/point.d.ts +8 -2
- package/dist/types/math/src/polygon.d.ts +25 -1
- package/dist/types/math/src/segment.d.ts +6 -0
- package/dist/types/math/src/types.d.ts +25 -1
- package/dist/types/utils/src/export.d.ts +4 -3
- package/dist/types/utils/src/index.d.ts +1 -2
- package/dist/types/utils/src/shape.d.ts +2 -2
- package/package.json +1 -1
- package/dist/types/excalidraw/animation-frame-handler.d.ts +0 -16
- package/dist/types/excalidraw/charts.d.ts +0 -27
- package/dist/types/excalidraw/components/DiagramToCodePlugin/DiagramToCodePlugin.d.ts +0 -4
- package/dist/types/excalidraw/components/ExcalidrawLogo.d.ts +0 -15
- package/dist/types/excalidraw/components/FollowMode/FollowMode.d.ts +0 -10
- package/dist/types/excalidraw/components/HandButton.d.ts +0 -10
- package/dist/types/excalidraw/components/InitializeApp.d.ts +0 -10
- package/dist/types/excalidraw/components/MobileToolBar.d.ts +0 -10
- package/dist/types/excalidraw/components/TTDDialog/TTDDialogTrigger.d.ts +0 -8
- package/dist/types/excalidraw/components/TTDDialog/utils/TTDStreamFetch.d.ts +0 -24
- package/dist/types/excalidraw/components/ToolButton.d.ts +0 -49
- package/dist/types/excalidraw/components/footer/FooterCenter.d.ts +0 -8
- package/dist/types/excalidraw/components/live-collaboration/LiveCollaborationTrigger.d.ts +0 -11
- package/dist/types/excalidraw/components/shapes.d.ts +0 -190
- package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Center.d.ts +0 -58
- package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.Hints.d.ts +0 -19
- package/dist/types/excalidraw/components/welcome-screen/WelcomeScreen.d.ts +0 -84
- package/dist/types/excalidraw/cursor.d.ts +0 -5
- package/dist/types/excalidraw/data/reconcile.d.ts +0 -7
- package/dist/types/excalidraw/index.d.ts +0 -46
- package/dist/types/excalidraw/polyfill.d.ts +0 -2
- package/dist/types/excalidraw/scene/scroll.d.ts +0 -18
- package/dist/types/excalidraw/scene/zoom.d.ts +0 -12
- package/dist/types/utils/src/bbox.d.ts +0 -9
- package/dist/types/utils/src/withinBounds.d.ts +0 -19
package/dist/dev/index.js
CHANGED
|
@@ -1356,6 +1356,8 @@ function validateWCAG2Parms(parms) {
|
|
|
1356
1356
|
import { clamp } from "@excalidraw/math";
|
|
1357
1357
|
import { degreesToRadians } from "@excalidraw/math";
|
|
1358
1358
|
var DARK_MODE_COLORS_CACHE = typeof window !== "undefined" ? /* @__PURE__ */ new Map() : null;
|
|
1359
|
+
var DARK_MODE_FILTER_INVERT_PERCENT = 93;
|
|
1360
|
+
var DARK_MODE_FILTER_HUE_ROTATE_DEGREES = 180;
|
|
1359
1361
|
function cssHueRotate(red, green, blue, degrees) {
|
|
1360
1362
|
const r = red / 255;
|
|
1361
1363
|
const g = green / 255;
|
|
@@ -1394,7 +1396,10 @@ var cssInvert = (r, g, b, percent) => {
|
|
|
1394
1396
|
const invertedB = invertComponent(b);
|
|
1395
1397
|
return { r: invertedR, g: invertedG, b: invertedB };
|
|
1396
1398
|
};
|
|
1397
|
-
var applyDarkModeFilter = (color) => {
|
|
1399
|
+
var applyDarkModeFilter = (color, enable = true) => {
|
|
1400
|
+
if (!enable) {
|
|
1401
|
+
return color;
|
|
1402
|
+
}
|
|
1398
1403
|
const cached = DARK_MODE_COLORS_CACHE?.get(color);
|
|
1399
1404
|
if (cached) {
|
|
1400
1405
|
return cached;
|
|
@@ -1402,12 +1407,17 @@ var applyDarkModeFilter = (color) => {
|
|
|
1402
1407
|
const tc = tinycolor(color);
|
|
1403
1408
|
const alpha = tc.getAlpha();
|
|
1404
1409
|
const rgb = tc.toRgb();
|
|
1405
|
-
const inverted = cssInvert(
|
|
1410
|
+
const inverted = cssInvert(
|
|
1411
|
+
rgb.r,
|
|
1412
|
+
rgb.g,
|
|
1413
|
+
rgb.b,
|
|
1414
|
+
DARK_MODE_FILTER_INVERT_PERCENT
|
|
1415
|
+
);
|
|
1406
1416
|
const rotated = cssHueRotate(
|
|
1407
1417
|
inverted.r,
|
|
1408
1418
|
inverted.g,
|
|
1409
1419
|
inverted.b,
|
|
1410
|
-
|
|
1420
|
+
DARK_MODE_FILTER_HUE_ROTATE_DEGREES
|
|
1411
1421
|
);
|
|
1412
1422
|
const result = rgbToHex2(rotated.r, rotated.g, rotated.b, alpha);
|
|
1413
1423
|
if (DARK_MODE_COLORS_CACHE) {
|
|
@@ -1415,6 +1425,33 @@ var applyDarkModeFilter = (color) => {
|
|
|
1415
1425
|
}
|
|
1416
1426
|
return result;
|
|
1417
1427
|
};
|
|
1428
|
+
var _reverseDarkModeInvert = (r, g, b) => {
|
|
1429
|
+
const p = DARK_MODE_FILTER_INVERT_PERCENT / 100;
|
|
1430
|
+
const denominator = 1 - 2 * p;
|
|
1431
|
+
const restore = (color) => Math.round(clamp((color - 255 * p) / denominator, 0, 255));
|
|
1432
|
+
return {
|
|
1433
|
+
r: restore(r),
|
|
1434
|
+
g: restore(g),
|
|
1435
|
+
b: restore(b)
|
|
1436
|
+
};
|
|
1437
|
+
};
|
|
1438
|
+
var removeDarkModeFilter = (color) => {
|
|
1439
|
+
const tc = tinycolor(color);
|
|
1440
|
+
const alpha = tc.getAlpha();
|
|
1441
|
+
const rgb = tc.toRgb();
|
|
1442
|
+
const rotatedBack = cssHueRotate(
|
|
1443
|
+
rgb.r,
|
|
1444
|
+
rgb.g,
|
|
1445
|
+
rgb.b,
|
|
1446
|
+
DARK_MODE_FILTER_HUE_ROTATE_DEGREES
|
|
1447
|
+
);
|
|
1448
|
+
const restored = _reverseDarkModeInvert(
|
|
1449
|
+
rotatedBack.r,
|
|
1450
|
+
rotatedBack.g,
|
|
1451
|
+
rotatedBack.b
|
|
1452
|
+
);
|
|
1453
|
+
return rgbToHex2(restored.r, restored.g, restored.b, alpha);
|
|
1454
|
+
};
|
|
1418
1455
|
var pick = (source, keys) => {
|
|
1419
1456
|
return keys.reduce((acc, key) => {
|
|
1420
1457
|
if (key in source) {
|
|
@@ -1460,6 +1497,7 @@ var COMMON_ELEMENT_SHADES = pick(COLOR_PALETTE, [
|
|
|
1460
1497
|
"orange",
|
|
1461
1498
|
"red"
|
|
1462
1499
|
]);
|
|
1500
|
+
var COLOR_TOP_PICKS_SLOTS = 5;
|
|
1463
1501
|
var DEFAULT_ELEMENT_STROKE_PICKS = [
|
|
1464
1502
|
COLOR_PALETTE.black,
|
|
1465
1503
|
COLOR_PALETTE.red[DEFAULT_ELEMENT_STROKE_COLOR_INDEX],
|
|
@@ -1474,6 +1512,22 @@ var DEFAULT_ELEMENT_BACKGROUND_PICKS = [
|
|
|
1474
1512
|
COLOR_PALETTE.blue[DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX],
|
|
1475
1513
|
COLOR_PALETTE.yellow[DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX]
|
|
1476
1514
|
];
|
|
1515
|
+
var BUCKET_FILL_BACKGROUND_PICKS = [
|
|
1516
|
+
COLOR_PALETTE.white,
|
|
1517
|
+
COLOR_PALETTE.red[DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX],
|
|
1518
|
+
COLOR_PALETTE.green[DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX],
|
|
1519
|
+
COLOR_PALETTE.blue[DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX],
|
|
1520
|
+
COLOR_PALETTE.yellow[DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX]
|
|
1521
|
+
];
|
|
1522
|
+
var DEFAULT_STICKY_NOTE_BG = "#ffdf6b";
|
|
1523
|
+
var STICKY_NOTE_STROKE_PICKS = DEFAULT_ELEMENT_STROKE_PICKS;
|
|
1524
|
+
var STICKY_NOTE_BACKGROUND_PICKS = [
|
|
1525
|
+
DEFAULT_STICKY_NOTE_BG,
|
|
1526
|
+
COLOR_PALETTE.pink[1],
|
|
1527
|
+
COLOR_PALETTE.green[1],
|
|
1528
|
+
COLOR_PALETTE.blue[1],
|
|
1529
|
+
COLOR_PALETTE.orange[1]
|
|
1530
|
+
];
|
|
1477
1531
|
var DEFAULT_CANVAS_BACKGROUND_PICKS = [
|
|
1478
1532
|
COLOR_PALETTE.white,
|
|
1479
1533
|
// radix slate2
|
|
@@ -1525,6 +1579,14 @@ var rgbToHex2 = (r, g, b, a) => {
|
|
|
1525
1579
|
}
|
|
1526
1580
|
return hex6;
|
|
1527
1581
|
};
|
|
1582
|
+
var setColorAlpha = (color, alpha) => {
|
|
1583
|
+
const tc = tinycolor(color);
|
|
1584
|
+
if (!tc.isValid()) {
|
|
1585
|
+
return color;
|
|
1586
|
+
}
|
|
1587
|
+
const { r, g, b } = tc.toRgb();
|
|
1588
|
+
return rgbToHex2(r, g, b, alpha);
|
|
1589
|
+
};
|
|
1528
1590
|
var colorToHex = (color) => {
|
|
1529
1591
|
const tc = tinycolor(color);
|
|
1530
1592
|
if (!tc.isValid()) {
|
|
@@ -1536,6 +1598,9 @@ var colorToHex = (color) => {
|
|
|
1536
1598
|
var isTransparent = (color) => {
|
|
1537
1599
|
return tinycolor(color).getAlpha() === 0;
|
|
1538
1600
|
};
|
|
1601
|
+
var isOpaqueColor = (color) => {
|
|
1602
|
+
return tinycolor(color).getAlpha() === 1;
|
|
1603
|
+
};
|
|
1539
1604
|
var COLOR_OUTLINE_CONTRAST_THRESHOLD = 240;
|
|
1540
1605
|
var calculateContrast = (r, g, b) => {
|
|
1541
1606
|
const yiq = (r * 299 + g * 587 + b * 114) / 1e3;
|
|
@@ -1562,7 +1627,7 @@ var normalizeInputColor = (color) => {
|
|
|
1562
1627
|
}
|
|
1563
1628
|
const tc = tinycolor(color);
|
|
1564
1629
|
if (tc.isValid()) {
|
|
1565
|
-
if (tc.getFormat()
|
|
1630
|
+
if (["hex", "hex8"].includes(tc.getFormat()) && !color.startsWith("#")) {
|
|
1566
1631
|
return `#${color}`;
|
|
1567
1632
|
}
|
|
1568
1633
|
return color;
|
|
@@ -1575,6 +1640,8 @@ init_define_import_meta_env();
|
|
|
1575
1640
|
var supportsResizeObserver = typeof window !== "undefined" && "ResizeObserver" in window;
|
|
1576
1641
|
var APP_NAME = "Excalidraw";
|
|
1577
1642
|
var TEXT_AUTOWRAP_THRESHOLD = 36;
|
|
1643
|
+
var TEXT_VIEWPORT_PADDING = 20;
|
|
1644
|
+
var TEXT_MAX_WRAP_WIDTH = 800;
|
|
1578
1645
|
var DRAGGING_THRESHOLD = 10;
|
|
1579
1646
|
var MINIMUM_ARROW_SIZE = 20;
|
|
1580
1647
|
var LINE_CONFIRM_THRESHOLD = 8;
|
|
@@ -1626,6 +1693,7 @@ var EVENT = /* @__PURE__ */ ((EVENT2) => {
|
|
|
1626
1693
|
EVENT2["POINTER_MOVE"] = "pointermove";
|
|
1627
1694
|
EVENT2["POINTER_DOWN"] = "pointerdown";
|
|
1628
1695
|
EVENT2["POINTER_UP"] = "pointerup";
|
|
1696
|
+
EVENT2["POINTER_CANCEL"] = "pointercancel";
|
|
1629
1697
|
EVENT2["STATE_CHANGE"] = "statechange";
|
|
1630
1698
|
EVENT2["WHEEL"] = "wheel";
|
|
1631
1699
|
EVENT2["TOUCH_START"] = "touchstart";
|
|
@@ -1659,7 +1727,8 @@ var CLASSES = {
|
|
|
1659
1727
|
SEARCH_MENU_INPUT_WRAPPER: "layer-ui__search-inputWrapper",
|
|
1660
1728
|
CONVERT_ELEMENT_TYPE_POPUP: "ConvertElementTypePopup",
|
|
1661
1729
|
SHAPE_ACTIONS_THEME_SCOPE: "shape-actions-theme-scope",
|
|
1662
|
-
FRAME_NAME: "frame-name"
|
|
1730
|
+
FRAME_NAME: "frame-name",
|
|
1731
|
+
DROPDOWN_MENU_EVENT_WRAPPER: "dropdown-menu-event-wrapper"
|
|
1663
1732
|
};
|
|
1664
1733
|
var FONT_SIZES = {
|
|
1665
1734
|
sm: 16,
|
|
@@ -1718,6 +1787,7 @@ var THEME = {
|
|
|
1718
1787
|
LIGHT: "light",
|
|
1719
1788
|
DARK: "dark"
|
|
1720
1789
|
};
|
|
1790
|
+
var DARK_THEME_FILTER = "invert(93%) hue-rotate(180deg)";
|
|
1721
1791
|
var FRAME_STYLE = {
|
|
1722
1792
|
strokeColor: "#bbb",
|
|
1723
1793
|
strokeWidth: 2,
|
|
@@ -1735,7 +1805,28 @@ var FRAME_STYLE = {
|
|
|
1735
1805
|
};
|
|
1736
1806
|
var MIN_FONT_SIZE = 1;
|
|
1737
1807
|
var DEFAULT_FONT_SIZE = 20;
|
|
1808
|
+
var STICKY_NOTE_MIN_FONT_SIZE = 16;
|
|
1809
|
+
var STICKY_NOTE_MAX_FONT_SIZE = 512;
|
|
1810
|
+
var STICKY_NOTE_FALLBACK_FONT_SIZE = 28;
|
|
1811
|
+
var STICKY_NOTE_FONT_STEP = 2;
|
|
1812
|
+
var STICKY_NOTE_PADDING = 16;
|
|
1813
|
+
var STICKY_NOTE_FOOTER = {
|
|
1814
|
+
height: 20,
|
|
1815
|
+
fontSize: 12,
|
|
1816
|
+
fontFamily: "Helvetica, Arial, sans-serif",
|
|
1817
|
+
baselineFromBottom: 14,
|
|
1818
|
+
opacity: 1,
|
|
1819
|
+
minBodyWidthForYear: 80
|
|
1820
|
+
};
|
|
1821
|
+
var STICKY_NOTE_BODY_INSET_Y = STICKY_NOTE_PADDING * 2 + STICKY_NOTE_FOOTER.height;
|
|
1822
|
+
var DEFAULT_STICKY_NOTE_SIZE = 250;
|
|
1823
|
+
var STICKY_NOTE_MIN_SIZE = 75;
|
|
1824
|
+
var STICKY_NOTE_SHADOW_OFFSET = 3;
|
|
1825
|
+
var STICKY_NOTE_SHADOW_OPACITY = 0.16;
|
|
1826
|
+
var STICKY_NOTE_EDGE_SHADOW_WIDTH = 0.5;
|
|
1827
|
+
var STICKY_NOTE_EDGE_SHADOW_OPACITY = 0.08;
|
|
1738
1828
|
var DEFAULT_FONT_FAMILY = FONT_FAMILY.Excalifont;
|
|
1829
|
+
var FONT_TOP_PICKS_SLOTS = 3;
|
|
1739
1830
|
var DEFAULT_TEXT_ALIGN = "left";
|
|
1740
1831
|
var DEFAULT_VERTICAL_ALIGN = "top";
|
|
1741
1832
|
var DEFAULT_VERSION = "{version}";
|
|
@@ -1766,6 +1857,7 @@ var STRING_MIME_TYPES = {
|
|
|
1766
1857
|
json: "application/json",
|
|
1767
1858
|
// excalidraw data
|
|
1768
1859
|
excalidraw: "application/vnd.excalidraw+json",
|
|
1860
|
+
excalidrawClipboard: "application/vnd.excalidraw.clipboard+json",
|
|
1769
1861
|
// LEGACY: fully-qualified library JSON data
|
|
1770
1862
|
excalidrawlib: "application/vnd.excalidrawlib+json",
|
|
1771
1863
|
// list of excalidraw library item ids
|
|
@@ -1804,9 +1896,13 @@ var TOUCH_CTX_MENU_TIMEOUT = 500;
|
|
|
1804
1896
|
var TITLE_TIMEOUT = 1e4;
|
|
1805
1897
|
var VERSION_TIMEOUT = 3e4;
|
|
1806
1898
|
var SCROLL_TIMEOUT = 100;
|
|
1899
|
+
var ZEN_MODE_TRANSITION_DURATION = 250;
|
|
1807
1900
|
var ZOOM_STEP = 0.1;
|
|
1808
1901
|
var MIN_ZOOM = 0.1;
|
|
1809
1902
|
var MAX_ZOOM = 30;
|
|
1903
|
+
var DEFAULT_ZOOM = Object.freeze({
|
|
1904
|
+
value: 1
|
|
1905
|
+
});
|
|
1810
1906
|
var HYPERLINK_TOOLTIP_DELAY = 300;
|
|
1811
1907
|
var IDLE_THRESHOLD = 6e4;
|
|
1812
1908
|
var ACTIVE_THRESHOLD = 3e3;
|
|
@@ -1833,8 +1929,10 @@ var DEFAULT_UI_OPTIONS = {
|
|
|
1833
1929
|
var MAX_DECIMALS_FOR_SVG_EXPORT = 2;
|
|
1834
1930
|
var EXPORT_SCALES = [1, 2, 3];
|
|
1835
1931
|
var DEFAULT_EXPORT_PADDING = 10;
|
|
1836
|
-
var
|
|
1837
|
-
|
|
1932
|
+
var DEFAULT_IMAGE_OPTIONS = {
|
|
1933
|
+
maxWidthOrHeight: 1440,
|
|
1934
|
+
maxFileSizeBytes: 4 * 1024 * 1024
|
|
1935
|
+
};
|
|
1838
1936
|
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
1839
1937
|
var SVG_DOCUMENT_PREAMBLE = `<?xml version="1.0" standalone="no"?>
|
|
1840
1938
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
@@ -1858,6 +1956,7 @@ var TEXT_ALIGN = {
|
|
|
1858
1956
|
RIGHT: "right"
|
|
1859
1957
|
};
|
|
1860
1958
|
var ELEMENT_READY_TO_ERASE_OPACITY = 20;
|
|
1959
|
+
var ELEMENT_PENDING_DRAW_SHAPE_OPACITY = 70;
|
|
1861
1960
|
var DEFAULT_PROPORTIONAL_RADIUS = 0.25;
|
|
1862
1961
|
var DEFAULT_ADAPTIVE_RADIUS = 32;
|
|
1863
1962
|
var ROUNDNESS = {
|
|
@@ -1881,16 +1980,34 @@ var ROUGHNESS = {
|
|
|
1881
1980
|
artist: 1,
|
|
1882
1981
|
cartoonist: 2
|
|
1883
1982
|
};
|
|
1983
|
+
var STROKE_WIDTH_KEYS = [
|
|
1984
|
+
"thin",
|
|
1985
|
+
"medium",
|
|
1986
|
+
"bold"
|
|
1987
|
+
];
|
|
1884
1988
|
var STROKE_WIDTH = {
|
|
1885
1989
|
thin: 1,
|
|
1990
|
+
medium: 2,
|
|
1991
|
+
bold: 4,
|
|
1992
|
+
extraBold: 8
|
|
1993
|
+
// unused (may be introduced in the future)
|
|
1994
|
+
};
|
|
1995
|
+
var FREEDRAW_STROKE_WIDTH = {
|
|
1996
|
+
thin: 0.5,
|
|
1997
|
+
medium: 1,
|
|
1886
1998
|
bold: 2,
|
|
1887
1999
|
extraBold: 4
|
|
2000
|
+
// legacy (may be used again in the future)
|
|
2001
|
+
};
|
|
2002
|
+
var getStrokeWidthByKey = (elementType, strokeWidthKey) => {
|
|
2003
|
+
return elementType === "freedraw" ? FREEDRAW_STROKE_WIDTH[strokeWidthKey] : STROKE_WIDTH[strokeWidthKey];
|
|
1888
2004
|
};
|
|
2005
|
+
var DEFAULT_ELEMENT_STROKE_WIDTH_KEY = "medium";
|
|
1889
2006
|
var DEFAULT_ELEMENT_PROPS = {
|
|
1890
2007
|
strokeColor: COLOR_PALETTE.black,
|
|
1891
2008
|
backgroundColor: COLOR_PALETTE.transparent,
|
|
1892
2009
|
fillStyle: "solid",
|
|
1893
|
-
strokeWidth:
|
|
2010
|
+
strokeWidth: STROKE_WIDTH[DEFAULT_ELEMENT_STROKE_WIDTH_KEY],
|
|
1894
2011
|
strokeStyle: "solid",
|
|
1895
2012
|
roughness: ROUGHNESS.artist,
|
|
1896
2013
|
opacity: 100,
|
|
@@ -1922,8 +2039,11 @@ var TOOL_TYPE = {
|
|
|
1922
2039
|
hand: "hand",
|
|
1923
2040
|
frame: "frame",
|
|
1924
2041
|
magicframe: "magicframe",
|
|
2042
|
+
stickynote: "stickynote",
|
|
1925
2043
|
embeddable: "embeddable",
|
|
1926
|
-
laser: "laser"
|
|
2044
|
+
laser: "laser",
|
|
2045
|
+
autoshape: "autoshape",
|
|
2046
|
+
bucketfill: "bucketfill"
|
|
1927
2047
|
};
|
|
1928
2048
|
var EDITOR_LS_KEYS = {
|
|
1929
2049
|
OAI_API_KEY: "excalidraw-oai-api-key",
|
|
@@ -1954,6 +2074,8 @@ var BIND_MODE_TIMEOUT = 700;
|
|
|
1954
2074
|
var MOBILE_ACTION_BUTTON_BG = {
|
|
1955
2075
|
background: "var(--mobile-action-button-bg)"
|
|
1956
2076
|
};
|
|
2077
|
+
var DEFAULT_STROKE_STREAMLINE = 0.5;
|
|
2078
|
+
var DEFAULT_STROKE_STREAMLINE_PRECISE = 0.2;
|
|
1957
2079
|
|
|
1958
2080
|
// src/font-metadata.ts
|
|
1959
2081
|
init_define_import_meta_env();
|
|
@@ -2283,6 +2405,7 @@ var KEYS = {
|
|
|
2283
2405
|
SUBTRACT: "-",
|
|
2284
2406
|
SLASH: "/",
|
|
2285
2407
|
A: "a",
|
|
2408
|
+
B: "b",
|
|
2286
2409
|
C: "c",
|
|
2287
2410
|
D: "d",
|
|
2288
2411
|
E: "e",
|
|
@@ -2291,6 +2414,7 @@ var KEYS = {
|
|
|
2291
2414
|
H: "h",
|
|
2292
2415
|
I: "i",
|
|
2293
2416
|
L: "l",
|
|
2417
|
+
N: "n",
|
|
2294
2418
|
O: "o",
|
|
2295
2419
|
P: "p",
|
|
2296
2420
|
Q: "q",
|
|
@@ -2334,6 +2458,7 @@ var shouldRotateWithDiscreteAngle = (event) => event.shiftKey;
|
|
|
2334
2458
|
// src/points.ts
|
|
2335
2459
|
init_define_import_meta_env();
|
|
2336
2460
|
import {
|
|
2461
|
+
pointFrom,
|
|
2337
2462
|
pointFromPair
|
|
2338
2463
|
} from "@excalidraw/math";
|
|
2339
2464
|
var getSizeFromPoints = (points) => {
|
|
@@ -2378,12 +2503,12 @@ var rescalePoints = (dimension, newSize, points, normalize) => {
|
|
|
2378
2503
|
};
|
|
2379
2504
|
var getGridPoint = (x, y, gridSize) => {
|
|
2380
2505
|
if (gridSize) {
|
|
2381
|
-
return
|
|
2506
|
+
return pointFrom(
|
|
2382
2507
|
Math.round(x / gridSize) * gridSize,
|
|
2383
2508
|
Math.round(y / gridSize) * gridSize
|
|
2384
|
-
|
|
2509
|
+
);
|
|
2385
2510
|
}
|
|
2386
|
-
return
|
|
2511
|
+
return pointFrom(x, y);
|
|
2387
2512
|
};
|
|
2388
2513
|
|
|
2389
2514
|
// src/promise-pool.ts
|
|
@@ -2474,14 +2599,25 @@ var getDateTime = () => {
|
|
|
2474
2599
|
return `${year}-${month}-${day}-${hr}${min}`;
|
|
2475
2600
|
};
|
|
2476
2601
|
var capitalizeString = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
|
2477
|
-
var
|
|
2478
|
-
var
|
|
2479
|
-
|
|
2602
|
+
var getTargetWindow = (target) => target?.ownerDocument?.defaultView ?? (typeof window === "undefined" ? null : window);
|
|
2603
|
+
var isToolIcon = (target) => {
|
|
2604
|
+
const targetWindow = getTargetWindow(target);
|
|
2605
|
+
return !!targetWindow && target instanceof targetWindow.HTMLElement && target.className.includes("ToolIcon");
|
|
2606
|
+
};
|
|
2607
|
+
var isInputLike = (target) => {
|
|
2608
|
+
const targetWindow = getTargetWindow(target);
|
|
2609
|
+
return !!targetWindow && (target instanceof targetWindow.HTMLElement && target.dataset.type === "wysiwyg" || target instanceof targetWindow.HTMLBRElement || // newline in wysiwyg
|
|
2610
|
+
target instanceof targetWindow.HTMLInputElement || target instanceof targetWindow.HTMLTextAreaElement || target instanceof targetWindow.HTMLSelectElement);
|
|
2611
|
+
};
|
|
2480
2612
|
var isInteractive = (target) => {
|
|
2481
|
-
|
|
2613
|
+
const targetWindow = getTargetWindow(target);
|
|
2614
|
+
return isInputLike(target) || !!targetWindow && target instanceof targetWindow.Element && !!target.closest("label, button");
|
|
2615
|
+
};
|
|
2616
|
+
var isWritableElement = (target) => {
|
|
2617
|
+
const targetWindow = getTargetWindow(target);
|
|
2618
|
+
return !!targetWindow && (target instanceof targetWindow.HTMLElement && target.dataset.type === "wysiwyg" || target instanceof targetWindow.HTMLBRElement || // newline in wysiwyg
|
|
2619
|
+
target instanceof targetWindow.HTMLTextAreaElement || target instanceof targetWindow.HTMLInputElement && (target.type === "text" || target.type === "number" || target.type === "password" || target.type === "search") || target instanceof targetWindow.HTMLElement && target.closest(".cm-editor") !== null);
|
|
2482
2620
|
};
|
|
2483
|
-
var isWritableElement = (target) => target instanceof HTMLElement && target.dataset.type === "wysiwyg" || target instanceof HTMLBRElement || // newline in wysiwyg
|
|
2484
|
-
target instanceof HTMLTextAreaElement || target instanceof HTMLInputElement && (target.type === "text" || target.type === "number" || target.type === "password" || target.type === "search");
|
|
2485
2621
|
var getFontFamilyString = ({
|
|
2486
2622
|
fontFamily
|
|
2487
2623
|
}) => {
|
|
@@ -2526,32 +2662,23 @@ var debounce = (fn, timeout) => {
|
|
|
2526
2662
|
};
|
|
2527
2663
|
return ret;
|
|
2528
2664
|
};
|
|
2529
|
-
var throttleRAF = (fn
|
|
2665
|
+
var throttleRAF = (fn) => {
|
|
2530
2666
|
let timerId = null;
|
|
2531
2667
|
let lastArgs = null;
|
|
2532
|
-
|
|
2533
|
-
const scheduleFunc = (args) => {
|
|
2668
|
+
const scheduleFunc = () => {
|
|
2534
2669
|
timerId = window.requestAnimationFrame(() => {
|
|
2535
2670
|
timerId = null;
|
|
2536
|
-
|
|
2671
|
+
const args = lastArgs;
|
|
2537
2672
|
lastArgs = null;
|
|
2538
|
-
if (
|
|
2539
|
-
|
|
2540
|
-
lastArgsTrailing = null;
|
|
2541
|
-
scheduleFunc(lastArgs);
|
|
2673
|
+
if (args) {
|
|
2674
|
+
fn(...args);
|
|
2542
2675
|
}
|
|
2543
2676
|
});
|
|
2544
2677
|
};
|
|
2545
2678
|
const ret = (...args) => {
|
|
2546
|
-
if (isTestEnv()) {
|
|
2547
|
-
fn(...args);
|
|
2548
|
-
return;
|
|
2549
|
-
}
|
|
2550
2679
|
lastArgs = args;
|
|
2551
2680
|
if (timerId === null) {
|
|
2552
|
-
scheduleFunc(
|
|
2553
|
-
} else if (opts?.trailing) {
|
|
2554
|
-
lastArgsTrailing = args;
|
|
2681
|
+
scheduleFunc();
|
|
2555
2682
|
}
|
|
2556
2683
|
};
|
|
2557
2684
|
ret.flush = () => {
|
|
@@ -2560,12 +2687,12 @@ var throttleRAF = (fn, opts) => {
|
|
|
2560
2687
|
timerId = null;
|
|
2561
2688
|
}
|
|
2562
2689
|
if (lastArgs) {
|
|
2563
|
-
fn(...
|
|
2564
|
-
lastArgs =
|
|
2690
|
+
fn(...lastArgs);
|
|
2691
|
+
lastArgs = null;
|
|
2565
2692
|
}
|
|
2566
2693
|
};
|
|
2567
2694
|
ret.cancel = () => {
|
|
2568
|
-
lastArgs =
|
|
2695
|
+
lastArgs = null;
|
|
2569
2696
|
if (timerId !== null) {
|
|
2570
2697
|
cancelAnimationFrame(timerId);
|
|
2571
2698
|
timerId = null;
|
|
@@ -2576,67 +2703,6 @@ var throttleRAF = (fn, opts) => {
|
|
|
2576
2703
|
var easeOut = (k) => {
|
|
2577
2704
|
return 1 - Math.pow(1 - k, 4);
|
|
2578
2705
|
};
|
|
2579
|
-
var easeOutInterpolate = (from, to, progress) => {
|
|
2580
|
-
return (to - from) * easeOut(progress) + from;
|
|
2581
|
-
};
|
|
2582
|
-
var easeToValuesRAF = ({
|
|
2583
|
-
fromValues,
|
|
2584
|
-
toValues,
|
|
2585
|
-
onStep,
|
|
2586
|
-
duration = 250,
|
|
2587
|
-
interpolateValue,
|
|
2588
|
-
onStart,
|
|
2589
|
-
onEnd,
|
|
2590
|
-
onCancel
|
|
2591
|
-
}) => {
|
|
2592
|
-
let canceled = false;
|
|
2593
|
-
let frameId = 0;
|
|
2594
|
-
let startTime;
|
|
2595
|
-
function step(timestamp) {
|
|
2596
|
-
if (canceled) {
|
|
2597
|
-
return;
|
|
2598
|
-
}
|
|
2599
|
-
if (startTime === void 0) {
|
|
2600
|
-
startTime = timestamp;
|
|
2601
|
-
onStart?.();
|
|
2602
|
-
}
|
|
2603
|
-
const elapsed = Math.min(timestamp - startTime, duration);
|
|
2604
|
-
const factor = easeOut(elapsed / duration);
|
|
2605
|
-
const newValues = {};
|
|
2606
|
-
Object.keys(fromValues).forEach((key) => {
|
|
2607
|
-
const _key = key;
|
|
2608
|
-
const result = (toValues[_key] - fromValues[_key]) * factor + fromValues[_key];
|
|
2609
|
-
newValues[_key] = result;
|
|
2610
|
-
});
|
|
2611
|
-
onStep(newValues);
|
|
2612
|
-
if (elapsed < duration) {
|
|
2613
|
-
const progress = elapsed / duration;
|
|
2614
|
-
const newValues2 = {};
|
|
2615
|
-
Object.keys(fromValues).forEach((key) => {
|
|
2616
|
-
const _key = key;
|
|
2617
|
-
const startValue = fromValues[_key];
|
|
2618
|
-
const endValue = toValues[_key];
|
|
2619
|
-
let result;
|
|
2620
|
-
result = interpolateValue ? interpolateValue(startValue, endValue, progress, _key) : easeOutInterpolate(startValue, endValue, progress);
|
|
2621
|
-
if (result == null) {
|
|
2622
|
-
result = easeOutInterpolate(startValue, endValue, progress);
|
|
2623
|
-
}
|
|
2624
|
-
newValues2[_key] = result;
|
|
2625
|
-
});
|
|
2626
|
-
onStep(newValues2);
|
|
2627
|
-
frameId = window.requestAnimationFrame(step);
|
|
2628
|
-
} else {
|
|
2629
|
-
onStep(toValues);
|
|
2630
|
-
onEnd?.();
|
|
2631
|
-
}
|
|
2632
|
-
}
|
|
2633
|
-
frameId = window.requestAnimationFrame(step);
|
|
2634
|
-
return () => {
|
|
2635
|
-
onCancel?.();
|
|
2636
|
-
canceled = true;
|
|
2637
|
-
window.cancelAnimationFrame(frameId);
|
|
2638
|
-
};
|
|
2639
|
-
};
|
|
2640
2706
|
var chunk = (array, size) => {
|
|
2641
2707
|
if (!array.length || size < 1) {
|
|
2642
2708
|
return [];
|
|
@@ -2679,7 +2745,7 @@ var updateActiveTool = (appState, data) => {
|
|
|
2679
2745
|
}
|
|
2680
2746
|
return {
|
|
2681
2747
|
...appState.activeTool,
|
|
2682
|
-
lastActiveTool: data.
|
|
2748
|
+
lastActiveTool: data.lastActiveTool === void 0 ? appState.activeTool.lastActiveTool : data.lastActiveTool,
|
|
2683
2749
|
type: data.type,
|
|
2684
2750
|
customType: null,
|
|
2685
2751
|
locked: data.locked ?? appState.activeTool.locked,
|
|
@@ -2716,6 +2782,8 @@ var RS_LTR_CHARS = "A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FF
|
|
|
2716
2782
|
var RS_RTL_CHARS = "\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC";
|
|
2717
2783
|
var RE_RTL_CHECK = new RegExp(`^[^${RS_LTR_CHARS}]*[${RS_RTL_CHARS}]`);
|
|
2718
2784
|
var isRTL = (text) => RE_RTL_CHECK.test(text);
|
|
2785
|
+
var RE_RTL_CHARS = new RegExp(`[${RS_RTL_CHARS}]`);
|
|
2786
|
+
var hasRTLChars = (text) => RE_RTL_CHARS.test(text);
|
|
2719
2787
|
var tupleToCoors = (xyTuple) => {
|
|
2720
2788
|
const [x, y] = xyTuple;
|
|
2721
2789
|
return { x, y };
|
|
@@ -2806,19 +2874,21 @@ var supportsEmoji = () => {
|
|
|
2806
2874
|
return ctx.getImageData(offset, offset, 1, 1).data[0] !== 0;
|
|
2807
2875
|
};
|
|
2808
2876
|
var getNearestScrollableContainer = (element) => {
|
|
2877
|
+
const ownerDocument = element.ownerDocument;
|
|
2878
|
+
const ownerWindow = ownerDocument.defaultView ?? window;
|
|
2809
2879
|
let parent = element.parentElement;
|
|
2810
2880
|
while (parent) {
|
|
2811
|
-
if (parent ===
|
|
2812
|
-
return
|
|
2881
|
+
if (parent === ownerDocument.body) {
|
|
2882
|
+
return ownerDocument;
|
|
2813
2883
|
}
|
|
2814
|
-
const { overflowY } =
|
|
2884
|
+
const { overflowY } = ownerWindow.getComputedStyle(parent);
|
|
2815
2885
|
const hasScrollableContent = parent.scrollHeight > parent.clientHeight;
|
|
2816
2886
|
if (hasScrollableContent && (overflowY === "auto" || overflowY === "scroll" || overflowY === "overlay")) {
|
|
2817
2887
|
return parent;
|
|
2818
2888
|
}
|
|
2819
2889
|
parent = parent.parentElement;
|
|
2820
2890
|
}
|
|
2821
|
-
return
|
|
2891
|
+
return ownerDocument;
|
|
2822
2892
|
};
|
|
2823
2893
|
var focusNearestParent = (element) => {
|
|
2824
2894
|
let parent = element.parentElement;
|
|
@@ -3156,6 +3226,9 @@ var setFeatureFlag = (flag, value) => {
|
|
|
3156
3226
|
console.error("unable to set feature flag", e);
|
|
3157
3227
|
}
|
|
3158
3228
|
};
|
|
3229
|
+
var oneOf = (needle, haystack) => {
|
|
3230
|
+
return haystack.includes(needle);
|
|
3231
|
+
};
|
|
3159
3232
|
|
|
3160
3233
|
// src/random.ts
|
|
3161
3234
|
var random = new Random(Date.now());
|
|
@@ -3166,6 +3239,16 @@ var reseed = (seed) => {
|
|
|
3166
3239
|
testIdBase = 0;
|
|
3167
3240
|
};
|
|
3168
3241
|
var randomId = () => isTestEnv() ? `id${testIdBase++}` : nanoid();
|
|
3242
|
+
var seededRandom = (seed) => {
|
|
3243
|
+
let value = seed >>> 0;
|
|
3244
|
+
return () => {
|
|
3245
|
+
value += 1831565813;
|
|
3246
|
+
let next = value;
|
|
3247
|
+
next = Math.imul(next ^ next >>> 15, next | 1);
|
|
3248
|
+
next ^= next + Math.imul(next ^ next >>> 7, next | 61);
|
|
3249
|
+
return ((next ^ next >>> 14) >>> 0) / 4294967296;
|
|
3250
|
+
};
|
|
3251
|
+
};
|
|
3169
3252
|
|
|
3170
3253
|
// src/url.ts
|
|
3171
3254
|
init_define_import_meta_env();
|
|
@@ -3229,6 +3312,298 @@ var Emitter = class {
|
|
|
3229
3312
|
this.subscribers = [];
|
|
3230
3313
|
}
|
|
3231
3314
|
};
|
|
3315
|
+
|
|
3316
|
+
// src/appEventBus.ts
|
|
3317
|
+
init_define_import_meta_env();
|
|
3318
|
+
var AppEventBus = class {
|
|
3319
|
+
constructor(behavior) {
|
|
3320
|
+
this.behavior = behavior;
|
|
3321
|
+
}
|
|
3322
|
+
emitters = /* @__PURE__ */ new Map();
|
|
3323
|
+
lastPayload = /* @__PURE__ */ new Map();
|
|
3324
|
+
emittedOnce = /* @__PURE__ */ new Set();
|
|
3325
|
+
getEmitter(name) {
|
|
3326
|
+
let emitter = this.emitters.get(name);
|
|
3327
|
+
if (!emitter) {
|
|
3328
|
+
emitter = new Emitter();
|
|
3329
|
+
this.emitters.set(name, emitter);
|
|
3330
|
+
}
|
|
3331
|
+
return emitter;
|
|
3332
|
+
}
|
|
3333
|
+
toPromiseValue(args) {
|
|
3334
|
+
return args.length === 1 ? args[0] : args;
|
|
3335
|
+
}
|
|
3336
|
+
on(name, callback) {
|
|
3337
|
+
const eventBehavior = this.behavior[name];
|
|
3338
|
+
const cachedPayload = this.lastPayload.get(name);
|
|
3339
|
+
if (callback) {
|
|
3340
|
+
if (eventBehavior.replay === "last" && cachedPayload) {
|
|
3341
|
+
queueMicrotask(() => callback(...cachedPayload));
|
|
3342
|
+
if (eventBehavior.cardinality === "once") {
|
|
3343
|
+
return () => {
|
|
3344
|
+
};
|
|
3345
|
+
}
|
|
3346
|
+
}
|
|
3347
|
+
return this.getEmitter(name).on(callback);
|
|
3348
|
+
}
|
|
3349
|
+
if (eventBehavior.cardinality !== "once" || eventBehavior.replay !== "last") {
|
|
3350
|
+
throw new Error(`Event "${String(name)}" requires a callback`);
|
|
3351
|
+
}
|
|
3352
|
+
if (cachedPayload) {
|
|
3353
|
+
return Promise.resolve(this.toPromiseValue(cachedPayload));
|
|
3354
|
+
}
|
|
3355
|
+
return new Promise((resolve) => {
|
|
3356
|
+
this.getEmitter(name).once((...args) => {
|
|
3357
|
+
resolve(this.toPromiseValue(args));
|
|
3358
|
+
});
|
|
3359
|
+
});
|
|
3360
|
+
}
|
|
3361
|
+
emit(name, ...args) {
|
|
3362
|
+
const eventBehavior = this.behavior[name];
|
|
3363
|
+
if (!isProdEnv()) {
|
|
3364
|
+
if (eventBehavior.cardinality === "once") {
|
|
3365
|
+
if (this.emittedOnce.has(name)) {
|
|
3366
|
+
throw new Error(`Event "${String(name)}" can only be emitted once`);
|
|
3367
|
+
}
|
|
3368
|
+
this.emittedOnce.add(name);
|
|
3369
|
+
}
|
|
3370
|
+
}
|
|
3371
|
+
if (eventBehavior.replay === "last") {
|
|
3372
|
+
this.lastPayload.set(name, args);
|
|
3373
|
+
}
|
|
3374
|
+
try {
|
|
3375
|
+
this.getEmitter(name).trigger(...args);
|
|
3376
|
+
} finally {
|
|
3377
|
+
if (eventBehavior.cardinality === "once") {
|
|
3378
|
+
this.getEmitter(name).clear();
|
|
3379
|
+
}
|
|
3380
|
+
}
|
|
3381
|
+
}
|
|
3382
|
+
clear() {
|
|
3383
|
+
this.lastPayload.clear();
|
|
3384
|
+
this.emittedOnce.clear();
|
|
3385
|
+
for (const emitter of this.emitters.values()) {
|
|
3386
|
+
emitter.clear();
|
|
3387
|
+
}
|
|
3388
|
+
this.emitters.clear();
|
|
3389
|
+
}
|
|
3390
|
+
};
|
|
3391
|
+
|
|
3392
|
+
// src/versionedSnapshotStore.ts
|
|
3393
|
+
init_define_import_meta_env();
|
|
3394
|
+
var VersionedSnapshotStore = class {
|
|
3395
|
+
constructor(initialValue, isEqual = Object.is) {
|
|
3396
|
+
this.isEqual = isEqual;
|
|
3397
|
+
this.value = initialValue;
|
|
3398
|
+
}
|
|
3399
|
+
version = 0;
|
|
3400
|
+
value;
|
|
3401
|
+
waiters = /* @__PURE__ */ new Set();
|
|
3402
|
+
subscribers = /* @__PURE__ */ new Set();
|
|
3403
|
+
getSnapshot() {
|
|
3404
|
+
return { version: this.version, value: this.value };
|
|
3405
|
+
}
|
|
3406
|
+
set(nextValue) {
|
|
3407
|
+
if (this.isEqual(this.value, nextValue)) {
|
|
3408
|
+
return false;
|
|
3409
|
+
}
|
|
3410
|
+
this.value = nextValue;
|
|
3411
|
+
this.version += 1;
|
|
3412
|
+
const snapshot = this.getSnapshot();
|
|
3413
|
+
for (const subscriber of this.subscribers) {
|
|
3414
|
+
subscriber(snapshot);
|
|
3415
|
+
}
|
|
3416
|
+
for (const waiter of this.waiters) {
|
|
3417
|
+
waiter(snapshot);
|
|
3418
|
+
}
|
|
3419
|
+
this.waiters.clear();
|
|
3420
|
+
return true;
|
|
3421
|
+
}
|
|
3422
|
+
update(updater) {
|
|
3423
|
+
return this.set(updater(this.value));
|
|
3424
|
+
}
|
|
3425
|
+
subscribe(subscriber) {
|
|
3426
|
+
this.subscribers.add(subscriber);
|
|
3427
|
+
return () => {
|
|
3428
|
+
this.subscribers.delete(subscriber);
|
|
3429
|
+
};
|
|
3430
|
+
}
|
|
3431
|
+
pull(sinceVersion = -1) {
|
|
3432
|
+
if (this.version !== sinceVersion) {
|
|
3433
|
+
return Promise.resolve(this.getSnapshot());
|
|
3434
|
+
}
|
|
3435
|
+
return new Promise((resolve) => {
|
|
3436
|
+
this.waiters.add(resolve);
|
|
3437
|
+
});
|
|
3438
|
+
}
|
|
3439
|
+
};
|
|
3440
|
+
|
|
3441
|
+
// debug.ts
|
|
3442
|
+
init_define_import_meta_env();
|
|
3443
|
+
var lessPrecise = (num, precision = 5) => parseFloat(num.toPrecision(precision));
|
|
3444
|
+
var getAvgFrameTime = (times) => lessPrecise(times.reduce((a, b) => a + b) / times.length);
|
|
3445
|
+
var Debug = class _Debug {
|
|
3446
|
+
static DEBUG_LOG_TIMES = true;
|
|
3447
|
+
static TIMES_AGGR = {};
|
|
3448
|
+
static TIMES_AVG = {};
|
|
3449
|
+
static LAST_DEBUG_LOG_CALL = 0;
|
|
3450
|
+
static DEBUG_LOG_INTERVAL_ID = null;
|
|
3451
|
+
static LAST_FRAME_TIMESTAMP = 0;
|
|
3452
|
+
static FRAME_COUNT = 0;
|
|
3453
|
+
static ANIMATION_FRAME_ID = null;
|
|
3454
|
+
static scheduleAnimationFrame = () => {
|
|
3455
|
+
if (_Debug.DEBUG_LOG_INTERVAL_ID !== null) {
|
|
3456
|
+
_Debug.ANIMATION_FRAME_ID = requestAnimationFrame((timestamp) => {
|
|
3457
|
+
if (_Debug.LAST_FRAME_TIMESTAMP !== timestamp) {
|
|
3458
|
+
_Debug.LAST_FRAME_TIMESTAMP = timestamp;
|
|
3459
|
+
_Debug.FRAME_COUNT++;
|
|
3460
|
+
}
|
|
3461
|
+
if (_Debug.DEBUG_LOG_INTERVAL_ID !== null) {
|
|
3462
|
+
_Debug.scheduleAnimationFrame();
|
|
3463
|
+
}
|
|
3464
|
+
});
|
|
3465
|
+
}
|
|
3466
|
+
};
|
|
3467
|
+
static setupInterval = () => {
|
|
3468
|
+
if (_Debug.DEBUG_LOG_INTERVAL_ID === null) {
|
|
3469
|
+
console.info("%c(starting perf recording)", "color: lime");
|
|
3470
|
+
_Debug.DEBUG_LOG_INTERVAL_ID = window.setInterval(_Debug.debugLogger, 1e3);
|
|
3471
|
+
_Debug.scheduleAnimationFrame();
|
|
3472
|
+
}
|
|
3473
|
+
_Debug.LAST_DEBUG_LOG_CALL = Date.now();
|
|
3474
|
+
};
|
|
3475
|
+
static debugLogger = () => {
|
|
3476
|
+
if (_Debug.DEBUG_LOG_TIMES) {
|
|
3477
|
+
for (const [name, { t, times }] of Object.entries(_Debug.TIMES_AGGR)) {
|
|
3478
|
+
if (times.length) {
|
|
3479
|
+
console.info(
|
|
3480
|
+
name,
|
|
3481
|
+
lessPrecise(times.reduce((a, b) => a + b)),
|
|
3482
|
+
times.sort((a, b) => a - b).map((x) => lessPrecise(x))
|
|
3483
|
+
);
|
|
3484
|
+
_Debug.TIMES_AGGR[name] = { t, times: [] };
|
|
3485
|
+
}
|
|
3486
|
+
}
|
|
3487
|
+
for (const [name, { t, times, avg }] of Object.entries(_Debug.TIMES_AVG)) {
|
|
3488
|
+
if (times.length) {
|
|
3489
|
+
const totalTime = times.reduce((a, b) => a + b);
|
|
3490
|
+
const avgFrameTime = lessPrecise(totalTime / _Debug.FRAME_COUNT);
|
|
3491
|
+
console.info(
|
|
3492
|
+
name,
|
|
3493
|
+
`- ${times.length} calls - ${avgFrameTime}ms/frame across ${_Debug.FRAME_COUNT} frames (${lessPrecise(
|
|
3494
|
+
avgFrameTime / 16.67 * 100,
|
|
3495
|
+
1
|
|
3496
|
+
)}% of frame budget)`
|
|
3497
|
+
);
|
|
3498
|
+
_Debug.TIMES_AVG[name] = {
|
|
3499
|
+
t,
|
|
3500
|
+
times: [],
|
|
3501
|
+
avg: avg != null ? getAvgFrameTime([avg, avgFrameTime]) : avgFrameTime
|
|
3502
|
+
};
|
|
3503
|
+
}
|
|
3504
|
+
}
|
|
3505
|
+
}
|
|
3506
|
+
_Debug.FRAME_COUNT = 0;
|
|
3507
|
+
if (Date.now() - _Debug.LAST_DEBUG_LOG_CALL > 600 && _Debug.DEBUG_LOG_INTERVAL_ID !== null) {
|
|
3508
|
+
console.info("%c(stopping perf recording)", "color: red");
|
|
3509
|
+
window.clearInterval(_Debug.DEBUG_LOG_INTERVAL_ID);
|
|
3510
|
+
window.cancelAnimationFrame(_Debug.ANIMATION_FRAME_ID);
|
|
3511
|
+
_Debug.ANIMATION_FRAME_ID = null;
|
|
3512
|
+
_Debug.FRAME_COUNT = 0;
|
|
3513
|
+
_Debug.LAST_FRAME_TIMESTAMP = 0;
|
|
3514
|
+
_Debug.DEBUG_LOG_INTERVAL_ID = null;
|
|
3515
|
+
_Debug.TIMES_AGGR = {};
|
|
3516
|
+
_Debug.TIMES_AVG = {};
|
|
3517
|
+
}
|
|
3518
|
+
};
|
|
3519
|
+
static logTime = (time, name = "default") => {
|
|
3520
|
+
_Debug.setupInterval();
|
|
3521
|
+
const now = performance.now();
|
|
3522
|
+
const { t, times } = _Debug.TIMES_AGGR[name] = _Debug.TIMES_AGGR[name] || {
|
|
3523
|
+
t: 0,
|
|
3524
|
+
times: []
|
|
3525
|
+
};
|
|
3526
|
+
if (t) {
|
|
3527
|
+
times.push(time != null ? time : now - t);
|
|
3528
|
+
}
|
|
3529
|
+
_Debug.TIMES_AGGR[name].t = now;
|
|
3530
|
+
};
|
|
3531
|
+
static logTimeAverage = (time, name = "default") => {
|
|
3532
|
+
_Debug.setupInterval();
|
|
3533
|
+
const now = performance.now();
|
|
3534
|
+
const { t, times } = _Debug.TIMES_AVG[name] = _Debug.TIMES_AVG[name] || {
|
|
3535
|
+
t: 0,
|
|
3536
|
+
times: []
|
|
3537
|
+
};
|
|
3538
|
+
if (t) {
|
|
3539
|
+
times.push(time != null ? time : now - t);
|
|
3540
|
+
}
|
|
3541
|
+
_Debug.TIMES_AVG[name].t = now;
|
|
3542
|
+
};
|
|
3543
|
+
static logWrapper = (type) => (fn, name = "default") => {
|
|
3544
|
+
return (...args) => {
|
|
3545
|
+
const t0 = performance.now();
|
|
3546
|
+
const ret = fn(...args);
|
|
3547
|
+
_Debug[type](performance.now() - t0, name);
|
|
3548
|
+
return ret;
|
|
3549
|
+
};
|
|
3550
|
+
};
|
|
3551
|
+
static logTimeWrap = _Debug.logWrapper("logTime");
|
|
3552
|
+
static logTimeAverageWrap = _Debug.logWrapper("logTimeAverage");
|
|
3553
|
+
static perfWrap = (fn, name = "default") => {
|
|
3554
|
+
return (...args) => {
|
|
3555
|
+
console.time(name);
|
|
3556
|
+
const ret = fn(...args);
|
|
3557
|
+
console.timeEnd(name);
|
|
3558
|
+
return ret;
|
|
3559
|
+
};
|
|
3560
|
+
};
|
|
3561
|
+
static CHANGED_CACHE = {};
|
|
3562
|
+
static logChanged(name, obj) {
|
|
3563
|
+
const prev = _Debug.CHANGED_CACHE[name];
|
|
3564
|
+
_Debug.CHANGED_CACHE[name] = obj;
|
|
3565
|
+
if (!prev) {
|
|
3566
|
+
return;
|
|
3567
|
+
}
|
|
3568
|
+
const allKeys = /* @__PURE__ */ new Set([...Object.keys(prev), ...Object.keys(obj)]);
|
|
3569
|
+
const changed = {};
|
|
3570
|
+
for (const key of allKeys) {
|
|
3571
|
+
const prevVal = prev[key];
|
|
3572
|
+
const nextVal = obj[key];
|
|
3573
|
+
if (!deepEqual(prevVal, nextVal)) {
|
|
3574
|
+
changed[key] = { prev: prevVal, next: nextVal };
|
|
3575
|
+
}
|
|
3576
|
+
}
|
|
3577
|
+
if (Object.keys(changed).length > 0) {
|
|
3578
|
+
console.info(`[${name}] changed:`, changed);
|
|
3579
|
+
}
|
|
3580
|
+
}
|
|
3581
|
+
};
|
|
3582
|
+
function deepEqual(a, b) {
|
|
3583
|
+
if (Object.is(a, b)) {
|
|
3584
|
+
return true;
|
|
3585
|
+
}
|
|
3586
|
+
if (a === null || b === null || typeof a !== "object" || typeof b !== "object") {
|
|
3587
|
+
return false;
|
|
3588
|
+
}
|
|
3589
|
+
if (Array.isArray(a) !== Array.isArray(b)) {
|
|
3590
|
+
return false;
|
|
3591
|
+
}
|
|
3592
|
+
const keysA = Object.keys(a);
|
|
3593
|
+
const keysB = Object.keys(b);
|
|
3594
|
+
if (keysA.length !== keysB.length) {
|
|
3595
|
+
return false;
|
|
3596
|
+
}
|
|
3597
|
+
for (const key of keysA) {
|
|
3598
|
+
if (!deepEqual(
|
|
3599
|
+
a[key],
|
|
3600
|
+
b[key]
|
|
3601
|
+
)) {
|
|
3602
|
+
return false;
|
|
3603
|
+
}
|
|
3604
|
+
}
|
|
3605
|
+
return true;
|
|
3606
|
+
}
|
|
3232
3607
|
export {
|
|
3233
3608
|
ACTIVE_THRESHOLD,
|
|
3234
3609
|
ALLOWED_PASTE_MIME_TYPES,
|
|
@@ -3236,8 +3611,10 @@ export {
|
|
|
3236
3611
|
ARROW_LABEL_FONT_SIZE_TO_MIN_WIDTH_RATIO,
|
|
3237
3612
|
ARROW_LABEL_WIDTH_FRACTION,
|
|
3238
3613
|
ARROW_TYPE,
|
|
3614
|
+
AppEventBus,
|
|
3239
3615
|
BIND_MODE_TIMEOUT,
|
|
3240
3616
|
BOUND_TEXT_PADDING,
|
|
3617
|
+
BUCKET_FILL_BACKGROUND_PICKS,
|
|
3241
3618
|
BinaryHeap,
|
|
3242
3619
|
CANVAS_ONLY_ACTIONS,
|
|
3243
3620
|
CANVAS_SEARCH_TAB,
|
|
@@ -3248,9 +3625,11 @@ export {
|
|
|
3248
3625
|
COLOR_CHARCOAL_BLACK,
|
|
3249
3626
|
COLOR_OUTLINE_CONTRAST_THRESHOLD,
|
|
3250
3627
|
COLOR_PALETTE,
|
|
3628
|
+
COLOR_TOP_PICKS_SLOTS,
|
|
3251
3629
|
COLOR_VOICE_CALL,
|
|
3252
3630
|
COLOR_WHITE,
|
|
3253
3631
|
CURSOR_TYPE,
|
|
3632
|
+
DARK_THEME_FILTER,
|
|
3254
3633
|
DEFAULT_ADAPTIVE_RADIUS,
|
|
3255
3634
|
DEFAULT_CANVAS_BACKGROUND_PICKS,
|
|
3256
3635
|
DEFAULT_CHART_COLOR_INDEX,
|
|
@@ -3262,26 +3641,34 @@ export {
|
|
|
3262
3641
|
DEFAULT_ELEMENT_STROKE_COLOR_INDEX,
|
|
3263
3642
|
DEFAULT_ELEMENT_STROKE_COLOR_PALETTE,
|
|
3264
3643
|
DEFAULT_ELEMENT_STROKE_PICKS,
|
|
3644
|
+
DEFAULT_ELEMENT_STROKE_WIDTH_KEY,
|
|
3265
3645
|
DEFAULT_EXPORT_PADDING,
|
|
3266
3646
|
DEFAULT_FILENAME,
|
|
3267
3647
|
DEFAULT_FONT_FAMILY,
|
|
3268
3648
|
DEFAULT_FONT_SIZE,
|
|
3269
3649
|
DEFAULT_GRID_SIZE,
|
|
3270
3650
|
DEFAULT_GRID_STEP,
|
|
3651
|
+
DEFAULT_IMAGE_OPTIONS,
|
|
3271
3652
|
DEFAULT_LASER_COLOR,
|
|
3272
|
-
DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT,
|
|
3273
3653
|
DEFAULT_PROPORTIONAL_RADIUS,
|
|
3274
3654
|
DEFAULT_REDUCED_GLOBAL_ALPHA,
|
|
3275
3655
|
DEFAULT_SIDEBAR,
|
|
3656
|
+
DEFAULT_STICKY_NOTE_BG,
|
|
3657
|
+
DEFAULT_STICKY_NOTE_SIZE,
|
|
3658
|
+
DEFAULT_STROKE_STREAMLINE,
|
|
3659
|
+
DEFAULT_STROKE_STREAMLINE_PRECISE,
|
|
3276
3660
|
DEFAULT_TEXT_ALIGN,
|
|
3277
3661
|
DEFAULT_TRANSFORM_HANDLE_SPACING,
|
|
3278
3662
|
DEFAULT_UI_OPTIONS,
|
|
3279
3663
|
DEFAULT_VERSION,
|
|
3280
3664
|
DEFAULT_VERTICAL_ALIGN,
|
|
3665
|
+
DEFAULT_ZOOM,
|
|
3281
3666
|
DOUBLE_TAP_POSITION_THRESHOLD,
|
|
3282
3667
|
DRAGGING_THRESHOLD,
|
|
3668
|
+
Debug,
|
|
3283
3669
|
EDITOR_LS_KEYS,
|
|
3284
3670
|
ELEMENT_LINK_KEY,
|
|
3671
|
+
ELEMENT_PENDING_DRAW_SHAPE_OPACITY,
|
|
3285
3672
|
ELEMENT_READY_TO_ERASE_OPACITY,
|
|
3286
3673
|
ELEMENT_SHIFT_TRANSLATE_AMOUNT,
|
|
3287
3674
|
ELEMENT_TRANSLATE_AMOUNT,
|
|
@@ -3298,7 +3685,9 @@ export {
|
|
|
3298
3685
|
FONT_FAMILY_GENERIC_FALLBACKS,
|
|
3299
3686
|
FONT_METADATA,
|
|
3300
3687
|
FONT_SIZES,
|
|
3688
|
+
FONT_TOP_PICKS_SLOTS,
|
|
3301
3689
|
FRAME_STYLE,
|
|
3690
|
+
FREEDRAW_STROKE_WIDTH,
|
|
3302
3691
|
GOOGLE_FONTS_RANGES,
|
|
3303
3692
|
HYPERLINK_TOOLTIP_DELAY,
|
|
3304
3693
|
IDLE_THRESHOLD,
|
|
@@ -3311,7 +3700,6 @@ export {
|
|
|
3311
3700
|
LINE_CONFIRM_THRESHOLD,
|
|
3312
3701
|
LINE_POLYGON_POINT_MERGE_DISTANCE,
|
|
3313
3702
|
LOCAL_FONT_PROTOCOL,
|
|
3314
|
-
MAX_ALLOWED_FILE_BYTES,
|
|
3315
3703
|
MAX_CUSTOM_COLORS_USED_IN_CANVAS,
|
|
3316
3704
|
MAX_DECIMALS_FOR_SVG_EXPORT,
|
|
3317
3705
|
MAX_ZOOM,
|
|
@@ -3341,14 +3729,31 @@ export {
|
|
|
3341
3729
|
SHIFT_LOCKING_ANGLE,
|
|
3342
3730
|
SIDE_RESIZING_THRESHOLD,
|
|
3343
3731
|
STATS_PANELS,
|
|
3732
|
+
STICKY_NOTE_BACKGROUND_PICKS,
|
|
3733
|
+
STICKY_NOTE_BODY_INSET_Y,
|
|
3734
|
+
STICKY_NOTE_EDGE_SHADOW_OPACITY,
|
|
3735
|
+
STICKY_NOTE_EDGE_SHADOW_WIDTH,
|
|
3736
|
+
STICKY_NOTE_FALLBACK_FONT_SIZE,
|
|
3737
|
+
STICKY_NOTE_FONT_STEP,
|
|
3738
|
+
STICKY_NOTE_FOOTER,
|
|
3739
|
+
STICKY_NOTE_MAX_FONT_SIZE,
|
|
3740
|
+
STICKY_NOTE_MIN_FONT_SIZE,
|
|
3741
|
+
STICKY_NOTE_MIN_SIZE,
|
|
3742
|
+
STICKY_NOTE_PADDING,
|
|
3743
|
+
STICKY_NOTE_SHADOW_OFFSET,
|
|
3744
|
+
STICKY_NOTE_SHADOW_OPACITY,
|
|
3745
|
+
STICKY_NOTE_STROKE_PICKS,
|
|
3344
3746
|
STRING_MIME_TYPES,
|
|
3345
3747
|
STROKE_WIDTH,
|
|
3748
|
+
STROKE_WIDTH_KEYS,
|
|
3346
3749
|
SVG_DOCUMENT_PREAMBLE,
|
|
3347
3750
|
SVG_NS,
|
|
3348
3751
|
TAP_TWICE_TIMEOUT,
|
|
3349
3752
|
TEXT_ALIGN,
|
|
3350
3753
|
TEXT_AUTOWRAP_THRESHOLD,
|
|
3754
|
+
TEXT_MAX_WRAP_WIDTH,
|
|
3351
3755
|
TEXT_TO_CENTER_SNAP_THRESHOLD,
|
|
3756
|
+
TEXT_VIEWPORT_PADDING,
|
|
3352
3757
|
THEME,
|
|
3353
3758
|
TITLE_TIMEOUT,
|
|
3354
3759
|
TOOL_TYPE,
|
|
@@ -3359,8 +3764,10 @@ export {
|
|
|
3359
3764
|
VERSIONS,
|
|
3360
3765
|
VERSION_TIMEOUT,
|
|
3361
3766
|
VERTICAL_ALIGN,
|
|
3767
|
+
VersionedSnapshotStore,
|
|
3362
3768
|
WINDOWS_EMOJI_FALLBACK_FONT,
|
|
3363
3769
|
YOUTUBE_STATES,
|
|
3770
|
+
ZEN_MODE_TRANSITION_DURATION,
|
|
3364
3771
|
ZOOM_STEP,
|
|
3365
3772
|
addEventListener,
|
|
3366
3773
|
allowFullScreen,
|
|
@@ -3382,7 +3789,6 @@ export {
|
|
|
3382
3789
|
deriveStylesPanelMode,
|
|
3383
3790
|
distance,
|
|
3384
3791
|
easeOut,
|
|
3385
|
-
easeToValuesRAF,
|
|
3386
3792
|
escapeDoubleQuotes,
|
|
3387
3793
|
exitFullScreen,
|
|
3388
3794
|
findIndex,
|
|
@@ -3403,10 +3809,12 @@ export {
|
|
|
3403
3809
|
getLineHeight,
|
|
3404
3810
|
getNearestScrollableContainer,
|
|
3405
3811
|
getSizeFromPoints,
|
|
3812
|
+
getStrokeWidthByKey,
|
|
3406
3813
|
getSvgPathFromStroke,
|
|
3407
3814
|
getUpdatedTimestamp,
|
|
3408
3815
|
getVersion,
|
|
3409
3816
|
getVerticalOffset,
|
|
3817
|
+
hasRTLChars,
|
|
3410
3818
|
invariant,
|
|
3411
3819
|
isAndroid,
|
|
3412
3820
|
isAnyTrue,
|
|
@@ -3426,6 +3834,7 @@ export {
|
|
|
3426
3834
|
isLocalLink,
|
|
3427
3835
|
isMemberOf,
|
|
3428
3836
|
isMobileBreakpoint,
|
|
3837
|
+
isOpaqueColor,
|
|
3429
3838
|
isPrimitive,
|
|
3430
3839
|
isProdEnv,
|
|
3431
3840
|
isPromiseLike,
|
|
@@ -3452,12 +3861,14 @@ export {
|
|
|
3452
3861
|
normalizeEOL,
|
|
3453
3862
|
normalizeInputColor,
|
|
3454
3863
|
normalizeLink,
|
|
3864
|
+
oneOf,
|
|
3455
3865
|
preventUnload,
|
|
3456
3866
|
promiseTry,
|
|
3457
3867
|
queryFocusableElements,
|
|
3458
3868
|
randomId,
|
|
3459
3869
|
randomInteger,
|
|
3460
3870
|
reduceToCommonValue,
|
|
3871
|
+
removeDarkModeFilter,
|
|
3461
3872
|
removeSelection,
|
|
3462
3873
|
rescalePoints,
|
|
3463
3874
|
reseed,
|
|
@@ -3465,7 +3876,9 @@ export {
|
|
|
3465
3876
|
rgbToHex2 as rgbToHex,
|
|
3466
3877
|
safelyParseJSON,
|
|
3467
3878
|
sceneCoordsToViewportCoords,
|
|
3879
|
+
seededRandom,
|
|
3468
3880
|
selectNode,
|
|
3881
|
+
setColorAlpha,
|
|
3469
3882
|
setDateTimeForTests,
|
|
3470
3883
|
setDesktopUIMode,
|
|
3471
3884
|
setFeatureFlag,
|