mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Fix all but components & tests
This commit is contained in:
parent
e2c2218f62
commit
44837c9bde
103 changed files with 1284 additions and 1003 deletions
|
@ -7,71 +7,19 @@ import type {
|
|||
NonDeleted,
|
||||
} from "./src/types";
|
||||
|
||||
export {
|
||||
aabbForElement,
|
||||
getElementShape,
|
||||
pointInsideBounds,
|
||||
} from "./src/shapes";
|
||||
|
||||
export {
|
||||
newElement,
|
||||
newTextElement,
|
||||
refreshTextDimensions,
|
||||
newLinearElement,
|
||||
newArrowElement,
|
||||
newImageElement,
|
||||
duplicateElement,
|
||||
} from "./src/newElement";
|
||||
|
||||
export {
|
||||
getElementAbsoluteCoords,
|
||||
getElementBounds,
|
||||
getCommonBounds,
|
||||
getDiamondPoints,
|
||||
getArrowheadPoints,
|
||||
getClosestElementBounds,
|
||||
} from "./src/bounds";
|
||||
|
||||
export {
|
||||
OMIT_SIDES_FOR_MULTIPLE_ELEMENTS,
|
||||
getTransformHandlesFromCoords,
|
||||
getTransformHandles,
|
||||
} from "./src/transformHandles";
|
||||
|
||||
export {
|
||||
resizeTest,
|
||||
getCursorForResizingElement,
|
||||
getElementWithTransformHandleType,
|
||||
getTransformHandleTypeFromCoords,
|
||||
} from "./src/resizeTest";
|
||||
|
||||
export {
|
||||
transformElements,
|
||||
getResizeOffsetXY,
|
||||
getResizeArrowDirection,
|
||||
} from "./src/resizeElements";
|
||||
|
||||
export {
|
||||
dragSelectedElements,
|
||||
getDragOffsetXY,
|
||||
dragNewElement,
|
||||
} from "./src/dragElements";
|
||||
|
||||
export { isTextElement, isExcalidrawElement } from "./src/typeChecks";
|
||||
export { redrawTextBoundingBox, getTextFromElements } from "./src/textElement";
|
||||
|
||||
export {
|
||||
getPerfectElementSize,
|
||||
getLockedLinearCursorAlignSize,
|
||||
isInvisiblySmallElement,
|
||||
resizePerfectLineForNWHandler,
|
||||
getNormalizedDimensions,
|
||||
} from "./src/sizeHelpers";
|
||||
|
||||
export { showSelectedShapeActions } from "./src/showSelectedShapeActions";
|
||||
|
||||
export * from "./src/bounds";
|
||||
export * from "./src/dragElements";
|
||||
export * from "./src/frame";
|
||||
export * from "./src/mutateElement";
|
||||
export * from "./src/newElement";
|
||||
export * from "./src/resizeElements";
|
||||
export * from "./src/resizeTest";
|
||||
export * from "./src/shapes";
|
||||
export * from "./src/showSelectedShapeActions";
|
||||
export * from "./src/textElement";
|
||||
export * from "./src/typeChecks";
|
||||
export * from "./src/transformHandles";
|
||||
export * from "./src/sizeHelpers";
|
||||
|
||||
/**
|
||||
* @deprecated unsafe, use hashElementsVersion instead
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
import {
|
||||
DEFAULT_ADAPTIVE_RADIUS,
|
||||
DEFAULT_PROPORTIONAL_RADIUS,
|
||||
LINE_CONFIRM_THRESHOLD,
|
||||
ROUNDNESS,
|
||||
invariant,
|
||||
} from "@excalidraw/common";
|
||||
import {
|
||||
isPoint,
|
||||
pointFrom,
|
||||
|
@ -18,27 +25,22 @@ import {
|
|||
type GeometricShape,
|
||||
} from "@excalidraw/utils/geometry/shape";
|
||||
|
||||
import {
|
||||
DEFAULT_ADAPTIVE_RADIUS,
|
||||
DEFAULT_PROPORTIONAL_RADIUS,
|
||||
LINE_CONFIRM_THRESHOLD,
|
||||
ROUNDNESS,
|
||||
} from "./constants";
|
||||
import { getElementAbsoluteCoords } from "./element";
|
||||
import { shouldTestInside } from "./element/collision";
|
||||
import { LinearElementEditor } from "./element/linearElementEditor";
|
||||
import { getBoundTextElement } from "./element/textElement";
|
||||
import { ShapeCache } from "./scene/ShapeCache";
|
||||
import { invariant } from "./utils";
|
||||
import type { NormalizedZoomValue, Zoom } from "@excalidraw/excalidraw/types";
|
||||
|
||||
import type { Bounds } from "./element/bounds";
|
||||
import { getElementAbsoluteCoords } from "../index";
|
||||
|
||||
import { shouldTestInside } from "./collision";
|
||||
import { LinearElementEditor } from "./linearElementEditor";
|
||||
import { getBoundTextElement } from "./textElement";
|
||||
import { ShapeCache } from "./scene/ShapeCache";
|
||||
|
||||
import type { Bounds } from "./bounds";
|
||||
import type {
|
||||
ElementsMap,
|
||||
ExcalidrawElement,
|
||||
ExcalidrawLinearElement,
|
||||
NonDeleted,
|
||||
} from "./element/types";
|
||||
import type { NormalizedZoomValue, Zoom } from "./types";
|
||||
} from "./types";
|
||||
|
||||
/**
|
||||
* get the pure geometric shape of an excalidraw elementw
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { LIBRARY_DISABLED_TYPES } from "../constants";
|
||||
import { deepCopyElement } from "../element/newElement";
|
||||
import { LIBRARY_DISABLED_TYPES, randomId } from "@excalidraw/common";
|
||||
import { deepCopyElement } from "@excalidraw/element/newElement";
|
||||
|
||||
import { t } from "../i18n";
|
||||
import { randomId } from "../random";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
|
||||
import { register } from "./register";
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
import { getNonDeletedElements } from "@excalidraw/element";
|
||||
|
||||
import { isFrameLikeElement } from "@excalidraw/element/typeChecks";
|
||||
|
||||
import { updateFrameMembershipOfSelectedElements } from "@excalidraw/element/frame";
|
||||
|
||||
import { KEYS, arrayToMap, getShortcutKey } from "@excalidraw/common";
|
||||
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import { alignElements } from "../align";
|
||||
import { ToolButton } from "../components/ToolButton";
|
||||
import {
|
||||
|
@ -8,19 +18,15 @@ import {
|
|||
CenterHorizontallyIcon,
|
||||
CenterVerticallyIcon,
|
||||
} from "../components/icons";
|
||||
import { getNonDeletedElements } from "../element";
|
||||
import { isFrameLikeElement } from "../element/typeChecks";
|
||||
import { updateFrameMembershipOfSelectedElements } from "../frame";
|
||||
|
||||
import { t } from "../i18n";
|
||||
import { KEYS } from "../keys";
|
||||
|
||||
import { isSomeElementSelected } from "../scene";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
import { arrayToMap, getShortcutKey } from "../utils";
|
||||
|
||||
import { register } from "./register";
|
||||
|
||||
import type { Alignment } from "../align";
|
||||
import type { ExcalidrawElement } from "../element/types";
|
||||
import type { AppClassProperties, AppState, UIAppState } from "../types";
|
||||
|
||||
export const alignActionsPredicate = (
|
||||
|
|
|
@ -3,38 +3,44 @@ import {
|
|||
ROUNDNESS,
|
||||
TEXT_ALIGN,
|
||||
VERTICAL_ALIGN,
|
||||
} from "../constants";
|
||||
import { isTextElement, newElement } from "../element";
|
||||
arrayToMap,
|
||||
getFontString,
|
||||
} from "@excalidraw/common";
|
||||
import { isTextElement, newElement } from "@excalidraw/element";
|
||||
import {
|
||||
getOriginalContainerHeightFromCache,
|
||||
resetOriginalContainerCache,
|
||||
updateOriginalContainerCache,
|
||||
} from "../element/containerCache";
|
||||
import { mutateElement } from "../element/mutateElement";
|
||||
} from "@excalidraw/element/containerCache";
|
||||
|
||||
import {
|
||||
computeBoundTextPosition,
|
||||
computeContainerDimensionForBoundText,
|
||||
getBoundTextElement,
|
||||
redrawTextBoundingBox,
|
||||
} from "../element/textElement";
|
||||
import { measureText } from "../element/textMeasurements";
|
||||
} from "@excalidraw/element/textElement";
|
||||
|
||||
import {
|
||||
hasBoundTextElement,
|
||||
isTextBindableContainer,
|
||||
isUsingAdaptiveRadius,
|
||||
} from "../element/typeChecks";
|
||||
import { syncMovedIndices } from "../fractionalIndex";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
import { arrayToMap, getFontString } from "../utils";
|
||||
} from "@excalidraw/element/typeChecks";
|
||||
|
||||
import { register } from "./register";
|
||||
import { mutateElement } from "@excalidraw/element/mutateElement";
|
||||
import { measureText } from "@excalidraw/element/textMeasurements";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawLinearElement,
|
||||
ExcalidrawTextContainer,
|
||||
ExcalidrawTextElement,
|
||||
} from "../element/types";
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { syncMovedIndices } from "../fractionalIndex";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
|
||||
import { register } from "./register";
|
||||
|
||||
import type { AppState } from "../types";
|
||||
import type { Mutable } from "../utility-types";
|
||||
|
||||
|
|
|
@ -1,11 +1,31 @@
|
|||
import { clamp, roundToStep } from "@excalidraw/math";
|
||||
|
||||
import {
|
||||
DEFAULT_CANVAS_BACKGROUND_PICKS,
|
||||
CURSOR_TYPE,
|
||||
MAX_ZOOM,
|
||||
MIN_ZOOM,
|
||||
THEME,
|
||||
ZOOM_STEP,
|
||||
getShortcutKey,
|
||||
updateActiveTool,
|
||||
CODES,
|
||||
KEYS,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import { getCommonBounds, getNonDeletedElements } from "@excalidraw/element";
|
||||
|
||||
import { newElementWith } from "@excalidraw/element/mutateElement";
|
||||
|
||||
import type { SceneBounds } from "@excalidraw/element/bounds";
|
||||
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import {
|
||||
getDefaultAppState,
|
||||
isEraserActive,
|
||||
isHandToolActive,
|
||||
} from "../appState";
|
||||
import { DEFAULT_CANVAS_BACKGROUND_PICKS } from "../colors";
|
||||
import { ColorPicker } from "../components/ColorPicker/ColorPicker";
|
||||
import { ToolButton } from "../components/ToolButton";
|
||||
import { Tooltip } from "../components/Tooltip";
|
||||
|
@ -19,28 +39,16 @@ import {
|
|||
ZoomOutIcon,
|
||||
ZoomResetIcon,
|
||||
} from "../components/icons";
|
||||
import {
|
||||
CURSOR_TYPE,
|
||||
MAX_ZOOM,
|
||||
MIN_ZOOM,
|
||||
THEME,
|
||||
ZOOM_STEP,
|
||||
} from "../constants";
|
||||
import { setCursor } from "../cursor";
|
||||
import { getCommonBounds, getNonDeletedElements } from "../element";
|
||||
import { newElementWith } from "../element/mutateElement";
|
||||
|
||||
import { t } from "../i18n";
|
||||
import { CODES, KEYS } from "../keys";
|
||||
import { getNormalizedZoom } from "../scene";
|
||||
import { centerScrollOn } from "../scene/scroll";
|
||||
import { getStateForZoom } from "../scene/zoom";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
import { getShortcutKey, updateActiveTool } from "../utils";
|
||||
|
||||
import { register } from "./register";
|
||||
|
||||
import type { SceneBounds } from "../element/bounds";
|
||||
import type { ExcalidrawElement } from "../element/types";
|
||||
import type { AppState, Offsets } from "../types";
|
||||
|
||||
export const actionChangeViewBackgroundColor = register({
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
import { isTextElement } from "@excalidraw/element/typeChecks";
|
||||
import { getTextFromElements } from "@excalidraw/element/textElement";
|
||||
|
||||
import { CODES, KEYS, isFirefox } from "@excalidraw/common";
|
||||
|
||||
import {
|
||||
copyTextToSystemClipboard,
|
||||
copyToClipboard,
|
||||
|
@ -7,11 +12,9 @@ import {
|
|||
readSystemClipboard,
|
||||
} from "../clipboard";
|
||||
import { DuplicateIcon, cutIcon, pngIcon, svgIcon } from "../components/icons";
|
||||
import { isFirefox } from "../constants";
|
||||
import { exportCanvas, prepareElementsForExport } from "../data/index";
|
||||
import { getTextFromElements, isTextElement } from "../element";
|
||||
import { t } from "../i18n";
|
||||
import { CODES, KEYS } from "../keys";
|
||||
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
|
||||
import { actionDeleteSelected } from "./actionDeleteSelected";
|
||||
|
|
|
@ -1,26 +1,31 @@
|
|||
import { ToolButton } from "../components/ToolButton";
|
||||
import { TrashIcon } from "../components/icons";
|
||||
import { getNonDeletedElements } from "../element";
|
||||
import { fixBindingsAfterDeletion } from "../element/binding";
|
||||
import { LinearElementEditor } from "../element/linearElementEditor";
|
||||
import { mutateElement, newElementWith } from "../element/mutateElement";
|
||||
import { getContainerElement } from "../element/textElement";
|
||||
import { KEYS, updateActiveTool } from "@excalidraw/common";
|
||||
|
||||
import { getNonDeletedElements } from "@excalidraw/element";
|
||||
import { fixBindingsAfterDeletion } from "@excalidraw/element/binding";
|
||||
import { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
|
||||
import {
|
||||
mutateElement,
|
||||
newElementWith,
|
||||
} from "@excalidraw/element/mutateElement";
|
||||
import { getContainerElement } from "@excalidraw/element/textElement";
|
||||
import {
|
||||
isBoundToContainer,
|
||||
isElbowArrow,
|
||||
isFrameLikeElement,
|
||||
} from "../element/typeChecks";
|
||||
import { getFrameChildren } from "../frame";
|
||||
} from "@excalidraw/element/typeChecks";
|
||||
import { getFrameChildren } from "@excalidraw/element/frame";
|
||||
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import { getElementsInGroup, selectGroupsForSelectedElements } from "../groups";
|
||||
import { t } from "../i18n";
|
||||
import { KEYS } from "../keys";
|
||||
import { getSelectedElements, isSomeElementSelected } from "../scene";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
import { updateActiveTool } from "../utils";
|
||||
import { TrashIcon } from "../components/icons";
|
||||
import { ToolButton } from "../components/ToolButton";
|
||||
|
||||
import { register } from "./register";
|
||||
|
||||
import type { ExcalidrawElement } from "../element/types";
|
||||
import type { AppClassProperties, AppState } from "../types";
|
||||
|
||||
const deleteSelectedElements = (
|
||||
|
|
|
@ -1,22 +1,29 @@
|
|||
import { getNonDeletedElements } from "@excalidraw/element";
|
||||
|
||||
import { isFrameLikeElement } from "@excalidraw/element/typeChecks";
|
||||
|
||||
import { CODES, KEYS, arrayToMap, getShortcutKey } from "@excalidraw/common";
|
||||
|
||||
import { updateFrameMembershipOfSelectedElements } from "@excalidraw/element/frame";
|
||||
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import { ToolButton } from "../components/ToolButton";
|
||||
import {
|
||||
DistributeHorizontallyIcon,
|
||||
DistributeVerticallyIcon,
|
||||
} from "../components/icons";
|
||||
import { distributeElements } from "../distribute";
|
||||
import { getNonDeletedElements } from "../element";
|
||||
import { isFrameLikeElement } from "../element/typeChecks";
|
||||
import { updateFrameMembershipOfSelectedElements } from "../frame";
|
||||
|
||||
import { t } from "../i18n";
|
||||
import { CODES, KEYS } from "../keys";
|
||||
|
||||
import { isSomeElementSelected } from "../scene";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
import { arrayToMap, getShortcutKey } from "../utils";
|
||||
|
||||
import { register } from "./register";
|
||||
|
||||
import type { Distribution } from "../distribute";
|
||||
import type { ExcalidrawElement } from "../element/types";
|
||||
|
||||
import type { AppClassProperties, AppState } from "../types";
|
||||
|
||||
const enableActionGroup = (appState: AppState, app: AppClassProperties) => {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import React from "react";
|
||||
import { ORIG_ID } from "@excalidraw/common";
|
||||
|
||||
import { ORIG_ID } from "../constants";
|
||||
import { Excalidraw } from "../index";
|
||||
import { API } from "../tests/helpers/api";
|
||||
import {
|
||||
|
|
|
@ -1,49 +1,60 @@
|
|||
import { ToolButton } from "../components/ToolButton";
|
||||
import { DuplicateIcon } from "../components/icons";
|
||||
import { DEFAULT_GRID_SIZE } from "../constants";
|
||||
import { duplicateElement, getNonDeletedElements } from "../element";
|
||||
import { fixBindingsAfterDuplication } from "../element/binding";
|
||||
import {
|
||||
DEFAULT_GRID_SIZE,
|
||||
KEYS,
|
||||
arrayToMap,
|
||||
castArray,
|
||||
findLastIndex,
|
||||
getShortcutKey,
|
||||
invariant,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import { duplicateElement, getNonDeletedElements } from "@excalidraw/element";
|
||||
|
||||
import { fixBindingsAfterDuplication } from "@excalidraw/element/binding";
|
||||
|
||||
import {
|
||||
bindTextToShapeAfterDuplication,
|
||||
getBoundTextElement,
|
||||
getContainerElement,
|
||||
} from "../element/textElement";
|
||||
} from "@excalidraw/element/textElement";
|
||||
|
||||
import {
|
||||
hasBoundTextElement,
|
||||
isBoundToContainer,
|
||||
isFrameLikeElement,
|
||||
} from "../element/typeChecks";
|
||||
import { normalizeElementOrder } from "../element/sortElements";
|
||||
import { LinearElementEditor } from "../element/linearElementEditor";
|
||||
} from "@excalidraw/element/typeChecks";
|
||||
|
||||
import { normalizeElementOrder } from "@excalidraw/element/sortElements";
|
||||
|
||||
import { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
|
||||
|
||||
import {
|
||||
bindElementsToFramesAfterDuplication,
|
||||
getFrameChildren,
|
||||
} from "../frame";
|
||||
} from "@excalidraw/element/frame";
|
||||
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import { ToolButton } from "../components/ToolButton";
|
||||
import { DuplicateIcon } from "../components/icons";
|
||||
|
||||
import {
|
||||
selectGroupsForSelectedElements,
|
||||
getSelectedGroupForElement,
|
||||
getElementsInGroup,
|
||||
} from "../groups";
|
||||
import { t } from "../i18n";
|
||||
import { KEYS } from "../keys";
|
||||
import { isSomeElementSelected } from "../scene";
|
||||
import {
|
||||
excludeElementsInFramesFromSelection,
|
||||
getSelectedElements,
|
||||
} from "../scene/selection";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
import {
|
||||
arrayToMap,
|
||||
castArray,
|
||||
findLastIndex,
|
||||
getShortcutKey,
|
||||
invariant,
|
||||
} from "../utils";
|
||||
|
||||
import { register } from "./register";
|
||||
|
||||
import type { ActionResult } from "./types";
|
||||
import type { ExcalidrawElement } from "../element/types";
|
||||
|
||||
import type { AppState } from "../types";
|
||||
|
||||
export const actionDuplicateSelection = register({
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import { copyTextToSystemClipboard } from "../clipboard";
|
||||
import { copyIcon, elementLinkIcon } from "../components/icons";
|
||||
import {
|
||||
canCreateLinkFromElements,
|
||||
defaultGetElementLinkFromSelection,
|
||||
getLinkIdAndTypeFromSelection,
|
||||
} from "../element/elementLink";
|
||||
} from "@excalidraw/element/elementLink";
|
||||
|
||||
import { copyTextToSystemClipboard } from "../clipboard";
|
||||
import { copyIcon, elementLinkIcon } from "../components/icons";
|
||||
import { t } from "../i18n";
|
||||
import { getSelectedElements } from "../scene";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
import { KEYS, arrayToMap } from "@excalidraw/common";
|
||||
|
||||
import { newElementWith } from "@excalidraw/element/mutateElement";
|
||||
|
||||
import { isFrameLikeElement } from "@excalidraw/element/typeChecks";
|
||||
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import { LockedIcon, UnlockedIcon } from "../components/icons";
|
||||
import { newElementWith } from "../element/mutateElement";
|
||||
import { isFrameLikeElement } from "../element/typeChecks";
|
||||
import { KEYS } from "../keys";
|
||||
|
||||
import { getSelectedElements } from "../scene";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
import { arrayToMap } from "../utils";
|
||||
|
||||
import { register } from "./register";
|
||||
|
||||
import type { ExcalidrawElement } from "../element/types";
|
||||
|
||||
const shouldLock = (elements: readonly ExcalidrawElement[]) =>
|
||||
elements.every((el) => !el.locked);
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { updateActiveTool } from "@excalidraw/common";
|
||||
|
||||
import { setCursorForShape } from "../cursor";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
import { updateActiveTool } from "../utils";
|
||||
|
||||
import { register } from "./register";
|
||||
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
import {
|
||||
KEYS,
|
||||
DEFAULT_EXPORT_PADDING,
|
||||
EXPORT_SCALES,
|
||||
THEME,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import { getNonDeletedElements } from "@excalidraw/element";
|
||||
|
||||
import type { Theme } from "@excalidraw/element/types";
|
||||
|
||||
import { useDevice } from "../components/App";
|
||||
import { CheckboxItem } from "../components/CheckboxItem";
|
||||
import { DarkModeToggle } from "../components/DarkModeToggle";
|
||||
|
@ -5,14 +16,12 @@ import { ProjectName } from "../components/ProjectName";
|
|||
import { ToolButton } from "../components/ToolButton";
|
||||
import { Tooltip } from "../components/Tooltip";
|
||||
import { ExportIcon, questionCircle, saveAs } from "../components/icons";
|
||||
import { DEFAULT_EXPORT_PADDING, EXPORT_SCALES, THEME } from "../constants";
|
||||
import { loadFromJSON, saveAsJSON } from "../data";
|
||||
import { isImageFileHandle } from "../data/blob";
|
||||
import { nativeFileSystemSupported } from "../data/filesystem";
|
||||
import { resaveAsImageWithScene } from "../data/resave";
|
||||
import { getNonDeletedElements } from "../element";
|
||||
|
||||
import { t } from "../i18n";
|
||||
import { KEYS } from "../keys";
|
||||
import { getSelectedElements, isSomeElementSelected } from "../scene";
|
||||
import { getExportSize } from "../scene/export";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
|
@ -21,8 +30,6 @@ import "../components/ToolIcon.scss";
|
|||
|
||||
import { register } from "./register";
|
||||
|
||||
import type { Theme } from "../element/types";
|
||||
|
||||
export const actionChangeProjectName = register({
|
||||
name: "changeProjectName",
|
||||
label: "labels.fileTitle",
|
||||
|
|
|
@ -1,21 +1,25 @@
|
|||
import { pointFrom } from "@excalidraw/math";
|
||||
|
||||
import { ToolButton } from "../components/ToolButton";
|
||||
import { done } from "../components/icons";
|
||||
import { resetCursor } from "../cursor";
|
||||
import { isInvisiblySmallElement } from "../element";
|
||||
import { isInvisiblySmallElement } from "@excalidraw/element";
|
||||
import {
|
||||
maybeBindLinearElement,
|
||||
bindOrUnbindLinearElement,
|
||||
} from "../element/binding";
|
||||
import { LinearElementEditor } from "../element/linearElementEditor";
|
||||
import { mutateElement } from "../element/mutateElement";
|
||||
import { isBindingElement, isLinearElement } from "../element/typeChecks";
|
||||
} from "@excalidraw/element/binding";
|
||||
import { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
|
||||
import { mutateElement } from "@excalidraw/element/mutateElement";
|
||||
import {
|
||||
isBindingElement,
|
||||
isLinearElement,
|
||||
} from "@excalidraw/element/typeChecks";
|
||||
|
||||
import { KEYS, arrayToMap, updateActiveTool } from "@excalidraw/common";
|
||||
import { isPathALoop } from "@excalidraw/element/shapes";
|
||||
|
||||
import { t } from "../i18n";
|
||||
import { KEYS } from "../keys";
|
||||
import { isPathALoop } from "../shapes";
|
||||
import { resetCursor } from "../cursor";
|
||||
import { done } from "../components/icons";
|
||||
import { ToolButton } from "../components/ToolButton";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
import { arrayToMap, updateActiveTool } from "../utils";
|
||||
|
||||
import { register } from "./register";
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { pointFrom } from "@excalidraw/math";
|
||||
import React from "react";
|
||||
|
||||
import { Excalidraw } from "../index";
|
||||
import { API } from "../tests/helpers/api";
|
||||
|
|
|
@ -1,25 +1,22 @@
|
|||
import { flipHorizontal, flipVertical } from "../components/icons";
|
||||
import { getNonDeletedElements } from "../element";
|
||||
import { getNonDeletedElements } from "@excalidraw/element";
|
||||
import {
|
||||
bindOrUnbindLinearElements,
|
||||
isBindingEnabled,
|
||||
} from "../element/binding";
|
||||
import { getCommonBoundingBox } from "../element/bounds";
|
||||
import { mutateElement, newElementWith } from "../element/mutateElement";
|
||||
import { deepCopyElement } from "../element/newElement";
|
||||
import { resizeMultipleElements } from "../element/resizeElements";
|
||||
} from "@excalidraw/element/binding";
|
||||
import { getCommonBoundingBox } from "@excalidraw/element/bounds";
|
||||
import {
|
||||
mutateElement,
|
||||
newElementWith,
|
||||
} from "@excalidraw/element/mutateElement";
|
||||
import { deepCopyElement } from "@excalidraw/element/newElement";
|
||||
import { resizeMultipleElements } from "@excalidraw/element/resizeElements";
|
||||
import {
|
||||
isArrowElement,
|
||||
isElbowArrow,
|
||||
isLinearElement,
|
||||
} from "../element/typeChecks";
|
||||
import { updateFrameMembershipOfSelectedElements } from "../frame";
|
||||
import { CODES, KEYS } from "../keys";
|
||||
import { getSelectedElements } from "../scene";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
import { arrayToMap } from "../utils";
|
||||
|
||||
import { register } from "./register";
|
||||
} from "@excalidraw/element/typeChecks";
|
||||
import { updateFrameMembershipOfSelectedElements } from "@excalidraw/element/frame";
|
||||
import { CODES, KEYS, arrayToMap } from "@excalidraw/common";
|
||||
|
||||
import type {
|
||||
ExcalidrawArrowElement,
|
||||
|
@ -27,7 +24,15 @@ import type {
|
|||
ExcalidrawElement,
|
||||
NonDeleted,
|
||||
NonDeletedSceneElementsMap,
|
||||
} from "../element/types";
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { getSelectedElements } from "../scene";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
|
||||
import { flipHorizontal, flipVertical } from "../components/icons";
|
||||
|
||||
import { register } from "./register";
|
||||
|
||||
import type { AppClassProperties, AppState } from "../types";
|
||||
|
||||
export const actionFlipHorizontal = register({
|
||||
|
|
|
@ -1,20 +1,25 @@
|
|||
import { frameToolIcon } from "../components/icons";
|
||||
import { setCursorForShape } from "../cursor";
|
||||
import { getCommonBounds, getNonDeletedElements } from "../element";
|
||||
import { mutateElement } from "../element/mutateElement";
|
||||
import { newFrameElement } from "../element/newElement";
|
||||
import { isFrameLikeElement } from "../element/typeChecks";
|
||||
import { addElementsToFrame, removeAllElementsFromFrame } from "../frame";
|
||||
import { getFrameChildren } from "../frame";
|
||||
import { getCommonBounds, getNonDeletedElements } from "@excalidraw/element";
|
||||
import { mutateElement } from "@excalidraw/element/mutateElement";
|
||||
import { newFrameElement } from "@excalidraw/element/newElement";
|
||||
import { isFrameLikeElement } from "@excalidraw/element/typeChecks";
|
||||
import {
|
||||
addElementsToFrame,
|
||||
removeAllElementsFromFrame,
|
||||
} from "@excalidraw/element/frame";
|
||||
import { getFrameChildren } from "@excalidraw/element/frame";
|
||||
|
||||
import { KEYS, updateActiveTool } from "@excalidraw/common";
|
||||
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import { getElementsInGroup } from "../groups";
|
||||
import { KEYS } from "../keys";
|
||||
import { setCursorForShape } from "../cursor";
|
||||
import { frameToolIcon } from "../components/icons";
|
||||
import { getSelectedElements } from "../scene";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
import { updateActiveTool } from "../utils";
|
||||
|
||||
import { register } from "./register";
|
||||
|
||||
import type { ExcalidrawElement } from "../element/types";
|
||||
import type { AppClassProperties, AppState, UIAppState } from "../types";
|
||||
|
||||
const isSingleFrameSelected = (
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { ToolButton } from "../components/ToolButton";
|
||||
import { UngroupIcon, GroupIcon } from "../components/icons";
|
||||
import { getNonDeletedElements } from "../element";
|
||||
import { newElementWith } from "../element/mutateElement";
|
||||
import { isBoundToContainer } from "../element/typeChecks";
|
||||
import { syncMovedIndices } from "../fractionalIndex";
|
||||
import { getNonDeletedElements } from "@excalidraw/element";
|
||||
|
||||
import { newElementWith } from "@excalidraw/element/mutateElement";
|
||||
|
||||
import { isBoundToContainer } from "@excalidraw/element/typeChecks";
|
||||
|
||||
import {
|
||||
frameAndChildrenSelectedTogether,
|
||||
getElementsInResizingFrame,
|
||||
|
@ -12,7 +12,21 @@ import {
|
|||
groupByFrameLikes,
|
||||
removeElementsFromFrame,
|
||||
replaceAllElementsInFrame,
|
||||
} from "../frame";
|
||||
} from "@excalidraw/element/frame";
|
||||
|
||||
import { KEYS, randomId, arrayToMap, getShortcutKey } from "@excalidraw/common";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawTextElement,
|
||||
OrderedExcalidrawElement,
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { ToolButton } from "../components/ToolButton";
|
||||
import { UngroupIcon, GroupIcon } from "../components/icons";
|
||||
|
||||
import { syncMovedIndices } from "../fractionalIndex";
|
||||
|
||||
import {
|
||||
getSelectedGroupIds,
|
||||
selectGroup,
|
||||
|
@ -23,19 +37,12 @@ import {
|
|||
isElementInGroup,
|
||||
} from "../groups";
|
||||
import { t } from "../i18n";
|
||||
import { KEYS } from "../keys";
|
||||
import { randomId } from "../random";
|
||||
|
||||
import { isSomeElementSelected } from "../scene";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
import { arrayToMap, getShortcutKey } from "../utils";
|
||||
|
||||
import { register } from "./register";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawTextElement,
|
||||
OrderedExcalidrawElement,
|
||||
} from "../element/types";
|
||||
import type { AppClassProperties, AppState } from "../types";
|
||||
|
||||
const allElementsInSameGroup = (elements: readonly ExcalidrawElement[]) => {
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import { isWindows, KEYS, matchKey, arrayToMap } from "@excalidraw/common";
|
||||
|
||||
import type { SceneElementsMap } from "@excalidraw/element/types";
|
||||
|
||||
import { ToolButton } from "../components/ToolButton";
|
||||
import { UndoIcon, RedoIcon } from "../components/icons";
|
||||
import { isWindows } from "../constants";
|
||||
import { HistoryChangedEvent } from "../history";
|
||||
import { useEmitter } from "../hooks/useEmitter";
|
||||
import { t } from "../i18n";
|
||||
import { KEYS, matchKey } from "../keys";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
import { arrayToMap } from "../utils";
|
||||
|
||||
import type { SceneElementsMap } from "../element/types";
|
||||
import type { History } from "../history";
|
||||
import type { Store } from "../store";
|
||||
import type { AppClassProperties, AppState } from "../types";
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
import { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
|
||||
|
||||
import { isElbowArrow, isLinearElement } from "@excalidraw/element/typeChecks";
|
||||
|
||||
import type { ExcalidrawLinearElement } from "@excalidraw/element/types";
|
||||
|
||||
import { DEFAULT_CATEGORIES } from "../components/CommandPalette/CommandPalette";
|
||||
import { ToolButton } from "../components/ToolButton";
|
||||
import { lineEditorIcon } from "../components/icons";
|
||||
import { LinearElementEditor } from "../element/linearElementEditor";
|
||||
import { isElbowArrow, isLinearElement } from "../element/typeChecks";
|
||||
|
||||
import { t } from "../i18n";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
|
||||
import { register } from "./register";
|
||||
|
||||
import type { ExcalidrawLinearElement } from "../element/types";
|
||||
|
||||
export const actionToggleLinearEditor = register({
|
||||
name: "toggleLinearEditor",
|
||||
category: DEFAULT_CATEGORIES.elements,
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
import { isEmbeddableElement } from "@excalidraw/element/typeChecks";
|
||||
|
||||
import { KEYS, getShortcutKey } from "@excalidraw/common";
|
||||
|
||||
import { ToolButton } from "../components/ToolButton";
|
||||
import { getContextMenuLabel } from "../components/hyperlink/Hyperlink";
|
||||
import { LinkIcon } from "../components/icons";
|
||||
import { isEmbeddableElement } from "../element/typeChecks";
|
||||
import { t } from "../i18n";
|
||||
import { KEYS } from "../keys";
|
||||
|
||||
import { getSelectedElements } from "../scene";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
import { getShortcutKey } from "../utils";
|
||||
|
||||
import { register } from "./register";
|
||||
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
import { KEYS } from "@excalidraw/common";
|
||||
|
||||
import {
|
||||
showSelectedShapeActions,
|
||||
getNonDeletedElements,
|
||||
} from "@excalidraw/element";
|
||||
|
||||
import { ToolButton } from "../components/ToolButton";
|
||||
import { HamburgerMenuIcon, HelpIconThin, palette } from "../components/icons";
|
||||
import { showSelectedShapeActions, getNonDeletedElements } from "../element";
|
||||
import { t } from "../i18n";
|
||||
import { KEYS } from "../keys";
|
||||
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
|
||||
import { register } from "./register";
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
import { queryByTestId } from "@testing-library/react";
|
||||
import React from "react";
|
||||
|
||||
import { COLOR_PALETTE, DEFAULT_ELEMENT_BACKGROUND_PICKS } from "../colors";
|
||||
import { FONT_FAMILY, STROKE_WIDTH } from "../constants";
|
||||
import {
|
||||
COLOR_PALETTE,
|
||||
DEFAULT_ELEMENT_BACKGROUND_PICKS,
|
||||
FONT_FAMILY,
|
||||
STROKE_WIDTH,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import { Excalidraw } from "../index";
|
||||
import { API } from "../tests/helpers/api";
|
||||
import { UI } from "../tests/helpers/ui";
|
||||
|
|
|
@ -1,15 +1,72 @@
|
|||
import { pointFrom } from "@excalidraw/math";
|
||||
import { useEffect, useMemo, useRef, useState } from "react";
|
||||
|
||||
import type { LocalPoint } from "@excalidraw/math";
|
||||
|
||||
import { trackEvent } from "../analytics";
|
||||
import {
|
||||
DEFAULT_ELEMENT_BACKGROUND_COLOR_PALETTE,
|
||||
DEFAULT_ELEMENT_BACKGROUND_PICKS,
|
||||
DEFAULT_ELEMENT_STROKE_COLOR_PALETTE,
|
||||
DEFAULT_ELEMENT_STROKE_PICKS,
|
||||
} from "../colors";
|
||||
ARROW_TYPE,
|
||||
DEFAULT_FONT_FAMILY,
|
||||
DEFAULT_FONT_SIZE,
|
||||
FONT_FAMILY,
|
||||
ROUNDNESS,
|
||||
STROKE_WIDTH,
|
||||
VERTICAL_ALIGN,
|
||||
KEYS,
|
||||
randomInteger,
|
||||
arrayToMap,
|
||||
getFontFamilyString,
|
||||
getShortcutKey,
|
||||
tupleToCoors,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import {
|
||||
getNonDeletedElements,
|
||||
isTextElement,
|
||||
redrawTextBoundingBox,
|
||||
} from "@excalidraw/element";
|
||||
|
||||
import {
|
||||
bindLinearElement,
|
||||
bindPointToSnapToElementOutline,
|
||||
calculateFixedPointForElbowArrowBinding,
|
||||
getHoveredElementForBinding,
|
||||
updateBoundElements,
|
||||
} from "@excalidraw/element/binding";
|
||||
|
||||
import { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
|
||||
|
||||
import {
|
||||
mutateElement,
|
||||
newElementWith,
|
||||
} from "@excalidraw/element/mutateElement";
|
||||
|
||||
import { getBoundTextElement } from "@excalidraw/element/textElement";
|
||||
|
||||
import {
|
||||
isArrowElement,
|
||||
isBoundToContainer,
|
||||
isElbowArrow,
|
||||
isLinearElement,
|
||||
isUsingAdaptiveRadius,
|
||||
} from "@excalidraw/element/typeChecks";
|
||||
|
||||
import type { LocalPoint } from "@excalidraw/math";
|
||||
|
||||
import type {
|
||||
Arrowhead,
|
||||
ExcalidrawBindableElement,
|
||||
ExcalidrawElement,
|
||||
ExcalidrawLinearElement,
|
||||
ExcalidrawTextElement,
|
||||
FontFamilyValues,
|
||||
TextAlign,
|
||||
VerticalAlign,
|
||||
NonDeletedSceneElementsMap,
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { trackEvent } from "../analytics";
|
||||
import { ButtonIconSelect } from "../components/ButtonIconSelect";
|
||||
import { ColorPicker } from "../components/ColorPicker/ColorPicker";
|
||||
import { FontPicker } from "../components/FontPicker/FontPicker";
|
||||
|
@ -60,42 +117,10 @@ import {
|
|||
ArrowheadCrowfootOneIcon,
|
||||
ArrowheadCrowfootOneOrManyIcon,
|
||||
} from "../components/icons";
|
||||
import {
|
||||
ARROW_TYPE,
|
||||
DEFAULT_FONT_FAMILY,
|
||||
DEFAULT_FONT_SIZE,
|
||||
FONT_FAMILY,
|
||||
ROUNDNESS,
|
||||
STROKE_WIDTH,
|
||||
VERTICAL_ALIGN,
|
||||
} from "../constants";
|
||||
import {
|
||||
getNonDeletedElements,
|
||||
isTextElement,
|
||||
redrawTextBoundingBox,
|
||||
} from "../element";
|
||||
import {
|
||||
bindLinearElement,
|
||||
bindPointToSnapToElementOutline,
|
||||
calculateFixedPointForElbowArrowBinding,
|
||||
getHoveredElementForBinding,
|
||||
updateBoundElements,
|
||||
} from "../element/binding";
|
||||
import { LinearElementEditor } from "../element/linearElementEditor";
|
||||
import { mutateElement, newElementWith } from "../element/mutateElement";
|
||||
import { getBoundTextElement } from "../element/textElement";
|
||||
import {
|
||||
isArrowElement,
|
||||
isBoundToContainer,
|
||||
isElbowArrow,
|
||||
isLinearElement,
|
||||
isUsingAdaptiveRadius,
|
||||
} from "../element/typeChecks";
|
||||
|
||||
import { Fonts } from "../fonts";
|
||||
import { getLineHeight } from "../fonts/FontMetadata";
|
||||
import { getLanguage, t } from "../i18n";
|
||||
import { KEYS } from "../keys";
|
||||
import { randomInteger } from "../random";
|
||||
import {
|
||||
canHaveArrowheads,
|
||||
getCommonAttributeOfSelectedElements,
|
||||
|
@ -105,26 +130,9 @@ import {
|
|||
} from "../scene";
|
||||
import { hasStrokeColor } from "../scene/comparisons";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
import {
|
||||
arrayToMap,
|
||||
getFontFamilyString,
|
||||
getShortcutKey,
|
||||
tupleToCoors,
|
||||
} from "../utils";
|
||||
|
||||
import { register } from "./register";
|
||||
|
||||
import type {
|
||||
Arrowhead,
|
||||
ExcalidrawBindableElement,
|
||||
ExcalidrawElement,
|
||||
ExcalidrawLinearElement,
|
||||
ExcalidrawTextElement,
|
||||
FontFamilyValues,
|
||||
TextAlign,
|
||||
VerticalAlign,
|
||||
NonDeletedSceneElementsMap,
|
||||
} from "../element/types";
|
||||
import type { CaptureUpdateActionType } from "../store";
|
||||
import type { AppClassProperties, AppState, Primitive } from "../types";
|
||||
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
import { selectAllIcon } from "../components/icons";
|
||||
import { getNonDeletedElements, isTextElement } from "../element";
|
||||
import { LinearElementEditor } from "../element/linearElementEditor";
|
||||
import { isLinearElement } from "../element/typeChecks";
|
||||
import { getNonDeletedElements, isTextElement } from "@excalidraw/element";
|
||||
import { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
|
||||
import { isLinearElement } from "@excalidraw/element/typeChecks";
|
||||
|
||||
import { KEYS } from "@excalidraw/common";
|
||||
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import { selectGroupsForSelectedElements } from "../groups";
|
||||
import { KEYS } from "../keys";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
|
||||
import { register } from "./register";
|
||||
import { selectAllIcon } from "../components/icons";
|
||||
|
||||
import type { ExcalidrawElement } from "../element/types";
|
||||
import { register } from "./register";
|
||||
|
||||
export const actionSelectAll = register({
|
||||
name: "selectAll",
|
||||
|
|
|
@ -1,33 +1,40 @@
|
|||
import { paintIcon } from "../components/icons";
|
||||
import {
|
||||
DEFAULT_FONT_SIZE,
|
||||
DEFAULT_FONT_FAMILY,
|
||||
DEFAULT_TEXT_ALIGN,
|
||||
} from "../constants";
|
||||
CODES,
|
||||
KEYS,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import {
|
||||
isTextElement,
|
||||
isExcalidrawElement,
|
||||
redrawTextBoundingBox,
|
||||
} from "../element";
|
||||
import { newElementWith } from "../element/mutateElement";
|
||||
import { getBoundTextElement } from "../element/textElement";
|
||||
} from "@excalidraw/element";
|
||||
|
||||
import { newElementWith } from "@excalidraw/element/mutateElement";
|
||||
|
||||
import {
|
||||
hasBoundTextElement,
|
||||
canApplyRoundnessTypeToElement,
|
||||
getDefaultRoundnessTypeForElement,
|
||||
isFrameLikeElement,
|
||||
isArrowElement,
|
||||
} from "../element/typeChecks";
|
||||
} from "@excalidraw/element/typeChecks";
|
||||
|
||||
import { getBoundTextElement } from "@excalidraw/element/textElement";
|
||||
|
||||
import type { ExcalidrawTextElement } from "@excalidraw/element/types";
|
||||
|
||||
import { paintIcon } from "../components/icons";
|
||||
|
||||
import { getLineHeight } from "../fonts/FontMetadata";
|
||||
import { t } from "../i18n";
|
||||
import { CODES, KEYS } from "../keys";
|
||||
import { getSelectedElements } from "../scene";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
|
||||
import { register } from "./register";
|
||||
|
||||
import type { ExcalidrawTextElement } from "../element/types";
|
||||
|
||||
// `copiedStyles` is exported only for tests.
|
||||
export let copiedStyles: string = "{}";
|
||||
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
import { isTextElement } from "../element";
|
||||
import { newElementWith } from "../element/mutateElement";
|
||||
import { measureText } from "../element/textMeasurements";
|
||||
import { getFontString } from "@excalidraw/common";
|
||||
|
||||
import { isTextElement } from "@excalidraw/element";
|
||||
import { newElementWith } from "@excalidraw/element/mutateElement";
|
||||
import { measureText } from "@excalidraw/element/textMeasurements";
|
||||
|
||||
import { getSelectedElements } from "../scene";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
import { getFontString } from "../utils";
|
||||
|
||||
import { register } from "./register";
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { CODES, KEYS } from "@excalidraw/common";
|
||||
|
||||
import { gridIcon } from "../components/icons";
|
||||
import { CODES, KEYS } from "../keys";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
|
||||
import { register } from "./register";
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { CODES, KEYS } from "@excalidraw/common";
|
||||
|
||||
import { magnetIcon } from "../components/icons";
|
||||
import { CODES, KEYS } from "../keys";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
|
||||
import { register } from "./register";
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
import {
|
||||
KEYS,
|
||||
CANVAS_SEARCH_TAB,
|
||||
CLASSES,
|
||||
DEFAULT_SIDEBAR,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import { searchIcon } from "../components/icons";
|
||||
import { CANVAS_SEARCH_TAB, CLASSES, DEFAULT_SIDEBAR } from "../constants";
|
||||
import { KEYS } from "../keys";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
|
||||
import { register } from "./register";
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { CODES, KEYS } from "@excalidraw/common";
|
||||
|
||||
import { abacusIcon } from "../components/icons";
|
||||
import { CODES, KEYS } from "../keys";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
|
||||
import { register } from "./register";
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { CODES, KEYS } from "@excalidraw/common";
|
||||
|
||||
import { eyeIcon } from "../components/icons";
|
||||
import { CODES, KEYS } from "../keys";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
|
||||
import { register } from "./register";
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { CODES, KEYS } from "@excalidraw/common";
|
||||
|
||||
import { coffeeIcon } from "../components/icons";
|
||||
import { CODES, KEYS } from "../keys";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
|
||||
import { register } from "./register";
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
import { KEYS, CODES, getShortcutKey, isDarwin } from "@excalidraw/common";
|
||||
|
||||
import {
|
||||
BringForwardIcon,
|
||||
BringToFrontIcon,
|
||||
SendBackwardIcon,
|
||||
SendToBackIcon,
|
||||
} from "../components/icons";
|
||||
import { isDarwin } from "../constants";
|
||||
import { t } from "../i18n";
|
||||
import { KEYS, CODES } from "../keys";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
import { getShortcutKey } from "../utils";
|
||||
import {
|
||||
moveOneLeft,
|
||||
moveOneRight,
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
import React from "react";
|
||||
|
||||
import { trackEvent } from "../analytics";
|
||||
import { isPromiseLike } from "../utils";
|
||||
import { isPromiseLike } from "@excalidraw/common";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
OrderedExcalidrawElement,
|
||||
} from "../element/types";
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { trackEvent } from "../analytics";
|
||||
|
||||
import type { AppClassProperties, AppState } from "../types";
|
||||
import type {
|
||||
Action,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { isDarwin } from "../constants";
|
||||
import { isDarwin, getShortcutKey } from "@excalidraw/common";
|
||||
|
||||
import { t } from "../i18n";
|
||||
import { getShortcutKey } from "../utils";
|
||||
|
||||
import type { SubtypeOf } from "../utility-types";
|
||||
import type { ActionName } from "./types";
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import type {
|
||||
ExcalidrawElement,
|
||||
OrderedExcalidrawElement,
|
||||
} from "../element/types";
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import type { CaptureUpdateActionType } from "../store";
|
||||
import type {
|
||||
AppClassProperties,
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
import { updateBoundElements } from "./element/binding";
|
||||
import { getCommonBoundingBox } from "./element/bounds";
|
||||
import { mutateElement } from "./element/mutateElement";
|
||||
import { updateBoundElements } from "@excalidraw/element/binding";
|
||||
import { getCommonBoundingBox } from "@excalidraw/element/bounds";
|
||||
import { mutateElement } from "@excalidraw/element/mutateElement";
|
||||
|
||||
import type { BoundingBox } from "@excalidraw/element/bounds";
|
||||
import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import { getMaximumGroups } from "./groups";
|
||||
|
||||
import type { BoundingBox } from "./element/bounds";
|
||||
import type { ElementsMap, ExcalidrawElement } from "./element/types";
|
||||
import type Scene from "./scene/Scene";
|
||||
|
||||
export interface Alignment {
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
import { LaserPointer } from "@excalidraw/laser-pointer";
|
||||
|
||||
import type { LaserPointerOptions } from "@excalidraw/laser-pointer";
|
||||
import {
|
||||
SVG_NS,
|
||||
getSvgPathFromStroke,
|
||||
sceneCoordsToViewportCoords,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import { SVG_NS } from "./constants";
|
||||
import { getSvgPathFromStroke, sceneCoordsToViewportCoords } from "./utils";
|
||||
import type { LaserPointerOptions } from "@excalidraw/laser-pointer";
|
||||
|
||||
import type { AnimationFrameHandler } from "./animation-frame-handler";
|
||||
import type App from "./components/App";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { COLOR_PALETTE } from "./colors";
|
||||
import {
|
||||
COLOR_PALETTE,
|
||||
ARROW_TYPE,
|
||||
DEFAULT_ELEMENT_PROPS,
|
||||
DEFAULT_FONT_FAMILY,
|
||||
|
@ -10,7 +10,7 @@ import {
|
|||
STATS_PANELS,
|
||||
THEME,
|
||||
DEFAULT_GRID_STEP,
|
||||
} from "./constants";
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import type { AppState, NormalizedZoomValue } from "./types";
|
||||
|
||||
|
|
|
@ -1,36 +1,38 @@
|
|||
import { ENV } from "./constants";
|
||||
import {
|
||||
ENV,
|
||||
arrayToMap,
|
||||
arrayToObject,
|
||||
assertNever,
|
||||
isShallowEqual,
|
||||
toBrandedType,
|
||||
} from "@excalidraw/common";
|
||||
import {
|
||||
BoundElement,
|
||||
BindableElement,
|
||||
bindingProperties,
|
||||
updateBoundElements,
|
||||
} from "./element/binding";
|
||||
import { LinearElementEditor } from "./element/linearElementEditor";
|
||||
import { mutateElement, newElementWith } from "./element/mutateElement";
|
||||
} from "@excalidraw/element/binding";
|
||||
import { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
|
||||
import {
|
||||
mutateElement,
|
||||
newElementWith,
|
||||
} from "@excalidraw/element/mutateElement";
|
||||
import {
|
||||
getBoundTextElementId,
|
||||
redrawTextBoundingBox,
|
||||
} from "./element/textElement";
|
||||
} from "@excalidraw/element/textElement";
|
||||
import {
|
||||
hasBoundTextElement,
|
||||
isBindableElement,
|
||||
isBoundToContainer,
|
||||
isImageElement,
|
||||
isTextElement,
|
||||
} from "./element/typeChecks";
|
||||
import { orderByFractionalIndex, syncMovedIndices } from "./fractionalIndex";
|
||||
import { getNonDeletedGroupIds } from "./groups";
|
||||
import { getObservedAppState } from "./store";
|
||||
import {
|
||||
arrayToMap,
|
||||
arrayToObject,
|
||||
assertNever,
|
||||
isShallowEqual,
|
||||
toBrandedType,
|
||||
} from "./utils";
|
||||
} from "@excalidraw/element/typeChecks";
|
||||
|
||||
import type { BindableProp, BindingProp } from "@excalidraw/element/binding";
|
||||
|
||||
import type { ElementUpdate } from "@excalidraw/element/mutateElement";
|
||||
|
||||
import type { BindableProp, BindingProp } from "./element/binding";
|
||||
import type { ElementUpdate } from "./element/mutateElement";
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawImageElement,
|
||||
|
@ -40,7 +42,12 @@ import type {
|
|||
Ordered,
|
||||
OrderedExcalidrawElement,
|
||||
SceneElementsMap,
|
||||
} from "./element/types";
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { orderByFractionalIndex, syncMovedIndices } from "./fractionalIndex";
|
||||
import { getNonDeletedGroupIds } from "./groups";
|
||||
import { getObservedAppState } from "./store";
|
||||
|
||||
import type {
|
||||
AppState,
|
||||
ObservedAppState,
|
||||
|
|
|
@ -1,21 +1,23 @@
|
|||
import { pointFrom } from "@excalidraw/math";
|
||||
|
||||
import type { Radians } from "@excalidraw/math";
|
||||
|
||||
import {
|
||||
COLOR_PALETTE,
|
||||
DEFAULT_CHART_COLOR_INDEX,
|
||||
getAllColorsSpecificShade,
|
||||
} from "./colors";
|
||||
import {
|
||||
DEFAULT_FONT_FAMILY,
|
||||
DEFAULT_FONT_SIZE,
|
||||
VERTICAL_ALIGN,
|
||||
} from "./constants";
|
||||
import { newElement, newLinearElement, newTextElement } from "./element";
|
||||
import { randomId } from "./random";
|
||||
randomId,
|
||||
} from "@excalidraw/common";
|
||||
import {
|
||||
newElement,
|
||||
newLinearElement,
|
||||
newTextElement,
|
||||
} from "@excalidraw/element";
|
||||
|
||||
import type { NonDeletedExcalidrawElement } from "./element/types";
|
||||
import type { Radians } from "@excalidraw/math";
|
||||
|
||||
import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
export type ChartElements = readonly NonDeletedExcalidrawElement[];
|
||||
|
||||
|
|
|
@ -4,7 +4,8 @@ import {
|
|||
COLOR_WHITE,
|
||||
THEME,
|
||||
UserIdleState,
|
||||
} from "./constants";
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import { roundRect } from "./renderer/roundRect";
|
||||
|
||||
import type { InteractiveCanvasRenderConfig } from "./scene/types";
|
||||
|
|
|
@ -1,25 +1,32 @@
|
|||
import { tryParseSpreadsheet, VALID_SPREADSHEET } from "./charts";
|
||||
import {
|
||||
ALLOWED_PASTE_MIME_TYPES,
|
||||
EXPORT_DATA_TYPES,
|
||||
MIME_TYPES,
|
||||
} from "./constants";
|
||||
import { createFile, isSupportedImageFileType } from "./data/blob";
|
||||
import { mutateElement } from "./element/mutateElement";
|
||||
import { deepCopyElement } from "./element/newElement";
|
||||
arrayToMap,
|
||||
isMemberOf,
|
||||
isPromiseLike,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import { mutateElement } from "@excalidraw/element/mutateElement";
|
||||
import { deepCopyElement } from "@excalidraw/element/newElement";
|
||||
import {
|
||||
isFrameLikeElement,
|
||||
isInitializedImageElement,
|
||||
} from "./element/typeChecks";
|
||||
import { ExcalidrawError } from "./errors";
|
||||
import { getContainingFrame } from "./frame";
|
||||
import { arrayToMap, isMemberOf, isPromiseLike } from "./utils";
|
||||
} from "@excalidraw/element/typeChecks";
|
||||
|
||||
import { getContainingFrame } from "@excalidraw/element/frame";
|
||||
|
||||
import type { Spreadsheet } from "./charts";
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
NonDeletedExcalidrawElement,
|
||||
} from "./element/types";
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { ExcalidrawError } from "./errors";
|
||||
import { createFile, isSupportedImageFileType } from "./data/blob";
|
||||
import { tryParseSpreadsheet, VALID_SPREADSHEET } from "./charts";
|
||||
|
||||
import type { Spreadsheet } from "./charts";
|
||||
|
||||
import type { BinaryFiles } from "./types";
|
||||
|
||||
type ElementsClipboard = {
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
import clsx from "clsx";
|
||||
import throttle from "lodash.throttle";
|
||||
import { nanoid } from "nanoid";
|
||||
import React, { useContext } from "react";
|
||||
import { flushSync } from "react-dom";
|
||||
import rough from "roughjs/bin/rough";
|
||||
|
||||
import {
|
||||
clamp,
|
||||
pointFrom,
|
||||
|
@ -12,15 +19,284 @@ import {
|
|||
} from "@excalidraw/math";
|
||||
import { isPointInShape } from "@excalidraw/utils/collision";
|
||||
import { getSelectionBoxShape } from "@excalidraw/utils/geometry/shape";
|
||||
import clsx from "clsx";
|
||||
import throttle from "lodash.throttle";
|
||||
import { nanoid } from "nanoid";
|
||||
import React, { useContext } from "react";
|
||||
import { flushSync } from "react-dom";
|
||||
import rough from "roughjs/bin/rough";
|
||||
|
||||
import {
|
||||
COLOR_PALETTE,
|
||||
CODES,
|
||||
shouldResizeFromCenter,
|
||||
shouldMaintainAspectRatio,
|
||||
shouldRotateWithDiscreteAngle,
|
||||
isArrowKey,
|
||||
KEYS,
|
||||
APP_NAME,
|
||||
CURSOR_TYPE,
|
||||
DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT,
|
||||
DEFAULT_VERTICAL_ALIGN,
|
||||
DRAGGING_THRESHOLD,
|
||||
ELEMENT_SHIFT_TRANSLATE_AMOUNT,
|
||||
ELEMENT_TRANSLATE_AMOUNT,
|
||||
ENV,
|
||||
EVENT,
|
||||
FRAME_STYLE,
|
||||
IMAGE_MIME_TYPES,
|
||||
IMAGE_RENDER_TIMEOUT,
|
||||
isBrave,
|
||||
LINE_CONFIRM_THRESHOLD,
|
||||
MAX_ALLOWED_FILE_BYTES,
|
||||
MIME_TYPES,
|
||||
MQ_MAX_HEIGHT_LANDSCAPE,
|
||||
MQ_MAX_WIDTH_LANDSCAPE,
|
||||
MQ_MAX_WIDTH_PORTRAIT,
|
||||
MQ_RIGHT_SIDEBAR_MIN_WIDTH,
|
||||
POINTER_BUTTON,
|
||||
ROUNDNESS,
|
||||
SCROLL_TIMEOUT,
|
||||
TAP_TWICE_TIMEOUT,
|
||||
TEXT_TO_CENTER_SNAP_THRESHOLD,
|
||||
THEME,
|
||||
THEME_FILTER,
|
||||
TOUCH_CTX_MENU_TIMEOUT,
|
||||
VERTICAL_ALIGN,
|
||||
YOUTUBE_STATES,
|
||||
ZOOM_STEP,
|
||||
POINTER_EVENTS,
|
||||
TOOL_TYPE,
|
||||
isIOS,
|
||||
supportsResizeObserver,
|
||||
DEFAULT_COLLISION_THRESHOLD,
|
||||
DEFAULT_TEXT_ALIGN,
|
||||
ARROW_TYPE,
|
||||
DEFAULT_REDUCED_GLOBAL_ALPHA,
|
||||
isSafari,
|
||||
isLocalLink,
|
||||
normalizeLink,
|
||||
toValidURL,
|
||||
getGridPoint,
|
||||
type EXPORT_IMAGE_TYPES,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import {
|
||||
dragNewElement,
|
||||
dragSelectedElements,
|
||||
duplicateElement,
|
||||
getCommonBounds,
|
||||
getCursorForResizingElement,
|
||||
getDragOffsetXY,
|
||||
getElementWithTransformHandleType,
|
||||
getNormalizedDimensions,
|
||||
getResizeArrowDirection,
|
||||
getResizeOffsetXY,
|
||||
getLockedLinearCursorAlignSize,
|
||||
getTransformHandleTypeFromCoords,
|
||||
isInvisiblySmallElement,
|
||||
isNonDeletedElement,
|
||||
isTextElement,
|
||||
newElement,
|
||||
newLinearElement,
|
||||
newTextElement,
|
||||
newImageElement,
|
||||
transformElements,
|
||||
refreshTextDimensions,
|
||||
redrawTextBoundingBox,
|
||||
getElementAbsoluteCoords,
|
||||
} from "@excalidraw/element";
|
||||
|
||||
import {
|
||||
bindOrUnbindLinearElement,
|
||||
bindOrUnbindLinearElements,
|
||||
fixBindingsAfterDeletion,
|
||||
fixBindingsAfterDuplication,
|
||||
getHoveredElementForBinding,
|
||||
isBindingEnabled,
|
||||
isLinearElementSimpleAndAlreadyBound,
|
||||
maybeBindLinearElement,
|
||||
shouldEnableBindingForPointerEvent,
|
||||
updateBoundElements,
|
||||
getSuggestedBindingsForArrows,
|
||||
} from "@excalidraw/element/binding";
|
||||
|
||||
import { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
|
||||
|
||||
import {
|
||||
mutateElement,
|
||||
newElementWith,
|
||||
} from "@excalidraw/element/mutateElement";
|
||||
|
||||
import {
|
||||
deepCopyElement,
|
||||
duplicateElements,
|
||||
newFrameElement,
|
||||
newFreeDrawElement,
|
||||
newEmbeddableElement,
|
||||
newMagicFrameElement,
|
||||
newIframeElement,
|
||||
newArrowElement,
|
||||
} from "@excalidraw/element/newElement";
|
||||
|
||||
import {
|
||||
hasBoundTextElement,
|
||||
isArrowElement,
|
||||
isBindingElement,
|
||||
isBindingElementType,
|
||||
isBoundToContainer,
|
||||
isFrameLikeElement,
|
||||
isImageElement,
|
||||
isEmbeddableElement,
|
||||
isInitializedImageElement,
|
||||
isLinearElement,
|
||||
isLinearElementType,
|
||||
isUsingAdaptiveRadius,
|
||||
isIframeElement,
|
||||
isIframeLikeElement,
|
||||
isMagicFrameElement,
|
||||
isTextBindableContainer,
|
||||
isElbowArrow,
|
||||
isFlowchartNodeElement,
|
||||
isBindableElement,
|
||||
} from "@excalidraw/element/typeChecks";
|
||||
|
||||
import {
|
||||
isElementCompletelyInViewport,
|
||||
isElementInViewport,
|
||||
} from "@excalidraw/element/sizeHelpers";
|
||||
|
||||
import {
|
||||
getBoundTextShape,
|
||||
getCornerRadius,
|
||||
getElementShape,
|
||||
isPathALoop,
|
||||
} from "@excalidraw/element/shapes";
|
||||
|
||||
import {
|
||||
debounce,
|
||||
distance,
|
||||
getFontString,
|
||||
getNearestScrollableContainer,
|
||||
isInputLike,
|
||||
isToolIcon,
|
||||
isWritableElement,
|
||||
sceneCoordsToViewportCoords,
|
||||
tupleToCoors,
|
||||
viewportCoordsToSceneCoords,
|
||||
wrapEvent,
|
||||
updateObject,
|
||||
updateActiveTool,
|
||||
getShortcutKey,
|
||||
isTransparent,
|
||||
easeToValuesRAF,
|
||||
muteFSAbortError,
|
||||
isTestEnv,
|
||||
easeOut,
|
||||
updateStable,
|
||||
addEventListener,
|
||||
normalizeEOL,
|
||||
getDateTime,
|
||||
isShallowEqual,
|
||||
arrayToMap,
|
||||
} from "@excalidraw/common/utils";
|
||||
|
||||
import {
|
||||
createSrcDoc,
|
||||
embeddableURLValidator,
|
||||
maybeParseEmbedSrc,
|
||||
getEmbedLink,
|
||||
} from "@excalidraw/element/embeddable";
|
||||
|
||||
import {
|
||||
getInitializedImageElements,
|
||||
loadHTMLImageElement,
|
||||
normalizeSVG,
|
||||
updateImageCache as _updateImageCache,
|
||||
} from "@excalidraw/element/image";
|
||||
|
||||
import {
|
||||
bindTextToShapeAfterDuplication,
|
||||
getBoundTextElement,
|
||||
getContainerCenter,
|
||||
getContainerElement,
|
||||
isValidTextContainer,
|
||||
} from "@excalidraw/element/textElement";
|
||||
|
||||
import { shouldShowBoundingBox } from "@excalidraw/element/transformHandles";
|
||||
|
||||
import {
|
||||
getFrameChildren,
|
||||
isCursorInFrame,
|
||||
bindElementsToFramesAfterDuplication,
|
||||
addElementsToFrame,
|
||||
replaceAllElementsInFrame,
|
||||
removeElementsFromFrame,
|
||||
getElementsInResizingFrame,
|
||||
getElementsInNewFrame,
|
||||
getContainingFrame,
|
||||
elementOverlapsWithFrame,
|
||||
updateFrameMembershipOfSelectedElements,
|
||||
isElementInFrame,
|
||||
getFrameLikeTitle,
|
||||
getElementsOverlappingFrame,
|
||||
filterElementsEligibleAsFrameChildren,
|
||||
} from "@excalidraw/element/frame";
|
||||
|
||||
import {
|
||||
hitElementBoundText,
|
||||
hitElementBoundingBoxOnly,
|
||||
hitElementItself,
|
||||
} from "@excalidraw/element/collision";
|
||||
|
||||
import { getVisibleSceneBounds } from "@excalidraw/element/bounds";
|
||||
|
||||
import {
|
||||
FlowChartCreator,
|
||||
FlowChartNavigator,
|
||||
getLinkDirectionFromKey,
|
||||
} from "@excalidraw/element/flowchart";
|
||||
|
||||
import { cropElement } from "@excalidraw/element/cropElement";
|
||||
|
||||
import { wrapText } from "@excalidraw/element/textWrapping";
|
||||
|
||||
import {
|
||||
isElementLink,
|
||||
parseElementLinkFromURL,
|
||||
} from "@excalidraw/element/elementLink";
|
||||
|
||||
import {
|
||||
isMeasureTextSupported,
|
||||
normalizeText,
|
||||
measureText,
|
||||
getLineHeightInPx,
|
||||
getApproxMinLineWidth,
|
||||
getApproxMinLineHeight,
|
||||
getMinTextElementWidth,
|
||||
} from "@excalidraw/element/textMeasurements";
|
||||
|
||||
import type { LocalPoint, Radians } from "@excalidraw/math";
|
||||
|
||||
import type {
|
||||
ExcalidrawBindableElement,
|
||||
ExcalidrawElement,
|
||||
ExcalidrawFreeDrawElement,
|
||||
ExcalidrawGenericElement,
|
||||
ExcalidrawLinearElement,
|
||||
ExcalidrawTextElement,
|
||||
NonDeleted,
|
||||
InitializedExcalidrawImageElement,
|
||||
ExcalidrawImageElement,
|
||||
FileId,
|
||||
NonDeletedExcalidrawElement,
|
||||
ExcalidrawTextContainer,
|
||||
ExcalidrawFrameLikeElement,
|
||||
ExcalidrawMagicFrameElement,
|
||||
ExcalidrawIframeLikeElement,
|
||||
IframeData,
|
||||
ExcalidrawIframeElement,
|
||||
ExcalidrawEmbeddableElement,
|
||||
Ordered,
|
||||
MagicGenerationData,
|
||||
ExcalidrawNonSelectionElement,
|
||||
ExcalidrawArrowElement,
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import {
|
||||
actionAddToLibrary,
|
||||
actionBringForward,
|
||||
|
@ -77,123 +353,10 @@ import {
|
|||
isHandToolActive,
|
||||
} from "../appState";
|
||||
import { copyTextToSystemClipboard, parseClipboard } from "../clipboard";
|
||||
import {
|
||||
APP_NAME,
|
||||
CURSOR_TYPE,
|
||||
DEFAULT_MAX_IMAGE_WIDTH_OR_HEIGHT,
|
||||
DEFAULT_VERTICAL_ALIGN,
|
||||
DRAGGING_THRESHOLD,
|
||||
ELEMENT_SHIFT_TRANSLATE_AMOUNT,
|
||||
ELEMENT_TRANSLATE_AMOUNT,
|
||||
ENV,
|
||||
EVENT,
|
||||
FRAME_STYLE,
|
||||
IMAGE_MIME_TYPES,
|
||||
IMAGE_RENDER_TIMEOUT,
|
||||
isBrave,
|
||||
LINE_CONFIRM_THRESHOLD,
|
||||
MAX_ALLOWED_FILE_BYTES,
|
||||
MIME_TYPES,
|
||||
MQ_MAX_HEIGHT_LANDSCAPE,
|
||||
MQ_MAX_WIDTH_LANDSCAPE,
|
||||
MQ_MAX_WIDTH_PORTRAIT,
|
||||
MQ_RIGHT_SIDEBAR_MIN_WIDTH,
|
||||
POINTER_BUTTON,
|
||||
ROUNDNESS,
|
||||
SCROLL_TIMEOUT,
|
||||
TAP_TWICE_TIMEOUT,
|
||||
TEXT_TO_CENTER_SNAP_THRESHOLD,
|
||||
THEME,
|
||||
THEME_FILTER,
|
||||
TOUCH_CTX_MENU_TIMEOUT,
|
||||
VERTICAL_ALIGN,
|
||||
YOUTUBE_STATES,
|
||||
ZOOM_STEP,
|
||||
POINTER_EVENTS,
|
||||
TOOL_TYPE,
|
||||
isIOS,
|
||||
supportsResizeObserver,
|
||||
DEFAULT_COLLISION_THRESHOLD,
|
||||
DEFAULT_TEXT_ALIGN,
|
||||
ARROW_TYPE,
|
||||
DEFAULT_REDUCED_GLOBAL_ALPHA,
|
||||
isSafari,
|
||||
type EXPORT_IMAGE_TYPES,
|
||||
} from "../constants";
|
||||
import { exportCanvas, loadFromBlob } from "../data";
|
||||
import Library, { distributeLibraryItemsOnSquareGrid } from "../data/library";
|
||||
import { restore, restoreElements } from "../data/restore";
|
||||
import {
|
||||
dragNewElement,
|
||||
dragSelectedElements,
|
||||
duplicateElement,
|
||||
getCommonBounds,
|
||||
getCursorForResizingElement,
|
||||
getDragOffsetXY,
|
||||
getElementWithTransformHandleType,
|
||||
getNormalizedDimensions,
|
||||
getResizeArrowDirection,
|
||||
getResizeOffsetXY,
|
||||
getLockedLinearCursorAlignSize,
|
||||
getTransformHandleTypeFromCoords,
|
||||
isInvisiblySmallElement,
|
||||
isNonDeletedElement,
|
||||
isTextElement,
|
||||
newElement,
|
||||
newLinearElement,
|
||||
newTextElement,
|
||||
newImageElement,
|
||||
transformElements,
|
||||
refreshTextDimensions,
|
||||
redrawTextBoundingBox,
|
||||
getElementAbsoluteCoords,
|
||||
} from "../element";
|
||||
import {
|
||||
bindOrUnbindLinearElement,
|
||||
bindOrUnbindLinearElements,
|
||||
fixBindingsAfterDeletion,
|
||||
fixBindingsAfterDuplication,
|
||||
getHoveredElementForBinding,
|
||||
isBindingEnabled,
|
||||
isLinearElementSimpleAndAlreadyBound,
|
||||
maybeBindLinearElement,
|
||||
shouldEnableBindingForPointerEvent,
|
||||
updateBoundElements,
|
||||
getSuggestedBindingsForArrows,
|
||||
} from "../element/binding";
|
||||
import { LinearElementEditor } from "../element/linearElementEditor";
|
||||
import { mutateElement, newElementWith } from "../element/mutateElement";
|
||||
import {
|
||||
deepCopyElement,
|
||||
duplicateElements,
|
||||
newFrameElement,
|
||||
newFreeDrawElement,
|
||||
newEmbeddableElement,
|
||||
newMagicFrameElement,
|
||||
newIframeElement,
|
||||
newArrowElement,
|
||||
} from "../element/newElement";
|
||||
import {
|
||||
hasBoundTextElement,
|
||||
isArrowElement,
|
||||
isBindingElement,
|
||||
isBindingElementType,
|
||||
isBoundToContainer,
|
||||
isFrameLikeElement,
|
||||
isImageElement,
|
||||
isEmbeddableElement,
|
||||
isInitializedImageElement,
|
||||
isLinearElement,
|
||||
isLinearElementType,
|
||||
isUsingAdaptiveRadius,
|
||||
isIframeElement,
|
||||
isIframeLikeElement,
|
||||
isMagicFrameElement,
|
||||
isTextBindableContainer,
|
||||
isElbowArrow,
|
||||
isFlowchartNodeElement,
|
||||
isBindableElement,
|
||||
} from "../element/typeChecks";
|
||||
|
||||
import { getCenter, getDistance } from "../gesture";
|
||||
import {
|
||||
editGroupForSelectedElement,
|
||||
|
@ -206,18 +369,7 @@ import {
|
|||
} from "../groups";
|
||||
import { History } from "../history";
|
||||
import { defaultLang, getLanguage, languages, setLanguage, t } from "../i18n";
|
||||
import {
|
||||
CODES,
|
||||
shouldResizeFromCenter,
|
||||
shouldMaintainAspectRatio,
|
||||
shouldRotateWithDiscreteAngle,
|
||||
isArrowKey,
|
||||
KEYS,
|
||||
} from "../keys";
|
||||
import {
|
||||
isElementCompletelyInViewport,
|
||||
isElementInViewport,
|
||||
} from "../element/sizeHelpers";
|
||||
|
||||
import {
|
||||
calculateScrollCenter,
|
||||
getElementsWithinSelection,
|
||||
|
@ -228,46 +380,7 @@ import {
|
|||
} from "../scene";
|
||||
import Scene from "../scene/Scene";
|
||||
import { getStateForZoom } from "../scene/zoom";
|
||||
import {
|
||||
findShapeByKey,
|
||||
getBoundTextShape,
|
||||
getCornerRadius,
|
||||
getElementShape,
|
||||
isPathALoop,
|
||||
} from "../shapes";
|
||||
import {
|
||||
debounce,
|
||||
distance,
|
||||
getFontString,
|
||||
getNearestScrollableContainer,
|
||||
isInputLike,
|
||||
isToolIcon,
|
||||
isWritableElement,
|
||||
sceneCoordsToViewportCoords,
|
||||
tupleToCoors,
|
||||
viewportCoordsToSceneCoords,
|
||||
wrapEvent,
|
||||
updateObject,
|
||||
updateActiveTool,
|
||||
getShortcutKey,
|
||||
isTransparent,
|
||||
easeToValuesRAF,
|
||||
muteFSAbortError,
|
||||
isTestEnv,
|
||||
easeOut,
|
||||
updateStable,
|
||||
addEventListener,
|
||||
normalizeEOL,
|
||||
getDateTime,
|
||||
isShallowEqual,
|
||||
arrayToMap,
|
||||
} from "../utils";
|
||||
import {
|
||||
createSrcDoc,
|
||||
embeddableURLValidator,
|
||||
maybeParseEmbedSrc,
|
||||
getEmbedLink,
|
||||
} from "../element/embeddable";
|
||||
|
||||
import {
|
||||
dataURLToFile,
|
||||
dataURLToString,
|
||||
|
@ -284,46 +397,17 @@ import {
|
|||
resizeImageFile,
|
||||
SVGStringToFile,
|
||||
} from "../data/blob";
|
||||
import {
|
||||
getInitializedImageElements,
|
||||
loadHTMLImageElement,
|
||||
normalizeSVG,
|
||||
updateImageCache as _updateImageCache,
|
||||
} from "../element/image";
|
||||
|
||||
import { fileOpen } from "../data/filesystem";
|
||||
import {
|
||||
bindTextToShapeAfterDuplication,
|
||||
getBoundTextElement,
|
||||
getContainerCenter,
|
||||
getContainerElement,
|
||||
isValidTextContainer,
|
||||
} from "../element/textElement";
|
||||
|
||||
import {
|
||||
showHyperlinkTooltip,
|
||||
hideHyperlinkToolip,
|
||||
Hyperlink,
|
||||
} from "../components/hyperlink/Hyperlink";
|
||||
import { isLocalLink, normalizeLink, toValidURL } from "../data/url";
|
||||
import { shouldShowBoundingBox } from "../element/transformHandles";
|
||||
|
||||
import { Fonts } from "../fonts";
|
||||
import { getLineHeight } from "../fonts/FontMetadata";
|
||||
import {
|
||||
getFrameChildren,
|
||||
isCursorInFrame,
|
||||
bindElementsToFramesAfterDuplication,
|
||||
addElementsToFrame,
|
||||
replaceAllElementsInFrame,
|
||||
removeElementsFromFrame,
|
||||
getElementsInResizingFrame,
|
||||
getElementsInNewFrame,
|
||||
getContainingFrame,
|
||||
elementOverlapsWithFrame,
|
||||
updateFrameMembershipOfSelectedElements,
|
||||
isElementInFrame,
|
||||
getFrameLikeTitle,
|
||||
getElementsOverlappingFrame,
|
||||
filterElementsEligibleAsFrameChildren,
|
||||
} from "../frame";
|
||||
import {
|
||||
excludeElementsInFramesFromSelection,
|
||||
makeNextSelectedElementIds,
|
||||
|
@ -341,7 +425,6 @@ import {
|
|||
getReferenceSnapPoints,
|
||||
SnapCache,
|
||||
isGridModeEnabled,
|
||||
getGridPoint,
|
||||
} from "../snapping";
|
||||
import { convertToExcalidrawElements } from "../data/transform";
|
||||
import { Renderer } from "../scene/Renderer";
|
||||
|
@ -354,39 +437,16 @@ import {
|
|||
} from "../cursor";
|
||||
import { Emitter } from "../emitter";
|
||||
import { ElementCanvasButtons } from "../components/ElementCanvasButtons";
|
||||
import { COLOR_PALETTE } from "../colors";
|
||||
import { Store, CaptureUpdateAction } from "../store";
|
||||
import { AnimatedTrail } from "../animated-trail";
|
||||
import { LaserTrails } from "../laser-trails";
|
||||
import { withBatchedUpdates, withBatchedUpdatesThrottled } from "../reactUtils";
|
||||
import { getRenderOpacity } from "../renderer/renderElement";
|
||||
import {
|
||||
hitElementBoundText,
|
||||
hitElementBoundingBoxOnly,
|
||||
hitElementItself,
|
||||
} from "../element/collision";
|
||||
import { textWysiwyg } from "../wysiwyg/textWysiwyg";
|
||||
import { isOverScrollBars } from "../scene/scrollbars";
|
||||
import { syncInvalidIndices, syncMovedIndices } from "../fractionalIndex";
|
||||
import { getVisibleSceneBounds } from "../element/bounds";
|
||||
|
||||
import { isMaybeMermaidDefinition } from "../mermaid";
|
||||
import {
|
||||
FlowChartCreator,
|
||||
FlowChartNavigator,
|
||||
getLinkDirectionFromKey,
|
||||
} from "../element/flowchart";
|
||||
import { cropElement } from "../element/cropElement";
|
||||
import { wrapText } from "../element/textWrapping";
|
||||
import { isElementLink, parseElementLinkFromURL } from "../element/elementLink";
|
||||
import {
|
||||
isMeasureTextSupported,
|
||||
normalizeText,
|
||||
measureText,
|
||||
getLineHeightInPx,
|
||||
getApproxMinLineWidth,
|
||||
getApproxMinLineHeight,
|
||||
getMinTextElementWidth,
|
||||
} from "../element/textMeasurements";
|
||||
|
||||
import { activeConfirmDialogAtom } from "./ActiveConfirmDialog";
|
||||
import BraveMeasureTextError from "./BraveMeasureTextError";
|
||||
|
@ -407,40 +467,19 @@ import {
|
|||
import { MagicIcon, copyIcon, fullscreenIcon } from "./icons";
|
||||
import { Toast } from "./Toast";
|
||||
|
||||
import type { Action, ActionResult } from "../actions/types";
|
||||
import { findShapeByKey } from "./shapes";
|
||||
|
||||
import type {
|
||||
RenderInteractiveSceneCallback,
|
||||
ScrollBars,
|
||||
} from "../scene/types";
|
||||
|
||||
import type { PastedMixedContent } from "../clipboard";
|
||||
import type { ExportedElements } from "../data";
|
||||
import type { ContextMenuItems } from "./ContextMenu";
|
||||
import type { FileSystemHandle } from "../data/filesystem";
|
||||
import type { ExcalidrawElementSkeleton } from "../data/transform";
|
||||
import type {
|
||||
ExcalidrawBindableElement,
|
||||
ExcalidrawElement,
|
||||
ExcalidrawFreeDrawElement,
|
||||
ExcalidrawGenericElement,
|
||||
ExcalidrawLinearElement,
|
||||
ExcalidrawTextElement,
|
||||
NonDeleted,
|
||||
InitializedExcalidrawImageElement,
|
||||
ExcalidrawImageElement,
|
||||
FileId,
|
||||
NonDeletedExcalidrawElement,
|
||||
ExcalidrawTextContainer,
|
||||
ExcalidrawFrameLikeElement,
|
||||
ExcalidrawMagicFrameElement,
|
||||
ExcalidrawIframeLikeElement,
|
||||
IframeData,
|
||||
ExcalidrawIframeElement,
|
||||
ExcalidrawEmbeddableElement,
|
||||
Ordered,
|
||||
MagicGenerationData,
|
||||
ExcalidrawNonSelectionElement,
|
||||
ExcalidrawArrowElement,
|
||||
} from "../element/types";
|
||||
import type {
|
||||
RenderInteractiveSceneCallback,
|
||||
ScrollBars,
|
||||
} from "../scene/types";
|
||||
|
||||
import type {
|
||||
AppClassProperties,
|
||||
AppProps,
|
||||
|
@ -471,6 +510,7 @@ import type {
|
|||
} from "../types";
|
||||
import type { ValueOf } from "../utility-types";
|
||||
import type { RoughCanvas } from "roughjs/bin/canvas";
|
||||
import type { Action, ActionResult } from "../actions/types";
|
||||
|
||||
const AppContext = React.createContext<AppClassProperties>(null!);
|
||||
const AppPropsContext = React.createContext<AppProps>(null!);
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
import { useExcalidrawAppState } from "../components/App";
|
||||
import { sceneCoordsToViewportCoords } from "../utils";
|
||||
import { getElementAbsoluteCoords } from "../element";
|
||||
|
||||
import "./ElementCanvasButtons.scss";
|
||||
|
||||
import type { AppState } from "../types";
|
||||
import { sceneCoordsToViewportCoords } from "@excalidraw/common";
|
||||
import { getElementAbsoluteCoords } from "@excalidraw/element";
|
||||
|
||||
import type {
|
||||
ElementsMap,
|
||||
NonDeletedExcalidrawElement,
|
||||
} from "../element/types";
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { useExcalidrawAppState } from "../components/App";
|
||||
|
||||
import "./ElementCanvasButtons.scss";
|
||||
|
||||
import type { AppState } from "../types";
|
||||
|
||||
const CONTAINER_PADDING = 5;
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import OpenColor from "open-color";
|
||||
|
||||
import { CURSOR_TYPE, MIME_TYPES, THEME } from "@excalidraw/common";
|
||||
|
||||
import { isHandToolActive, isEraserActive } from "./appState";
|
||||
import { CURSOR_TYPE, MIME_TYPES, THEME } from "./constants";
|
||||
|
||||
import type { AppState, DataURL } from "./types";
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import type { EDITOR_LS_KEYS } from "../constants";
|
||||
import type { EDITOR_LS_KEYS } from "@excalidraw/common";
|
||||
|
||||
import type { JSONValue } from "../types";
|
||||
|
||||
export class EditorLocalStorage {
|
||||
|
|
|
@ -1,12 +1,21 @@
|
|||
import { nanoid } from "nanoid";
|
||||
|
||||
import {
|
||||
IMAGE_MIME_TYPES,
|
||||
MIME_TYPES,
|
||||
bytesToHexString,
|
||||
isPromiseLike,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import { clearElementsForExport } from "@excalidraw/element";
|
||||
|
||||
import type { ExcalidrawElement, FileId } from "@excalidraw/element/types";
|
||||
|
||||
import { cleanAppStateForExport } from "../appState";
|
||||
import { IMAGE_MIME_TYPES, MIME_TYPES } from "../constants";
|
||||
import { clearElementsForExport } from "../element";
|
||||
|
||||
import { CanvasError, ImageSceneDataError } from "../errors";
|
||||
import { calculateScrollCenter } from "../scene";
|
||||
import { decodeSvgBase64Payload } from "../scene/export";
|
||||
import { bytesToHexString, isPromiseLike } from "../utils";
|
||||
|
||||
import { base64ToString, stringToBase64, toByteString } from "./encode";
|
||||
import { nativeFileSystemSupported } from "./filesystem";
|
||||
|
@ -14,7 +23,7 @@ import { isValidExcalidrawData, isValidLibrary } from "./json";
|
|||
import { restore, restoreLibraryItems } from "./restore";
|
||||
|
||||
import type { FileSystemHandle } from "./filesystem";
|
||||
import type { ExcalidrawElement, FileId } from "../element/types";
|
||||
|
||||
import type { AppState, DataURL, LibraryItem } from "../types";
|
||||
import type { ValueOf } from "../utility-types";
|
||||
import type { ImportedLibraryData } from "./types";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { ENCRYPTION_KEY_BITS } from "../constants";
|
||||
import { ENCRYPTION_KEY_BITS } from "@excalidraw/common";
|
||||
|
||||
import { blobToArrayBuffer } from "./blob";
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@ import {
|
|||
supported as nativeFileSystemSupported,
|
||||
} from "browser-fs-access";
|
||||
|
||||
import { EVENT, MIME_TYPES } from "../constants";
|
||||
import { EVENT, MIME_TYPES, debounce } from "@excalidraw/common";
|
||||
|
||||
import { AbortError } from "../errors";
|
||||
import { debounce } from "../utils";
|
||||
|
||||
import type { FileSystemHandle } from "browser-fs-access";
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import tEXt from "png-chunk-text";
|
|||
import encodePng from "png-chunks-encode";
|
||||
import decodePng from "png-chunks-extract";
|
||||
|
||||
import { EXPORT_DATA_TYPES, MIME_TYPES } from "../constants";
|
||||
import { EXPORT_DATA_TYPES, MIME_TYPES } from "@excalidraw/common";
|
||||
|
||||
import { blobToArrayBuffer } from "./blob";
|
||||
import { encode, decode } from "./encode";
|
||||
|
|
|
@ -1,32 +1,39 @@
|
|||
import {
|
||||
copyBlobToClipboardAsPng,
|
||||
copyTextToSystemClipboard,
|
||||
} from "../clipboard";
|
||||
import {
|
||||
DEFAULT_EXPORT_PADDING,
|
||||
DEFAULT_FILENAME,
|
||||
IMAGE_MIME_TYPES,
|
||||
isFirefox,
|
||||
MIME_TYPES,
|
||||
} from "../constants";
|
||||
import { getNonDeletedElements } from "../element";
|
||||
import { isFrameLikeElement } from "../element/typeChecks";
|
||||
import { getElementsOverlappingFrame } from "../frame";
|
||||
cloneJSON,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import { getNonDeletedElements } from "@excalidraw/element";
|
||||
|
||||
import { isFrameLikeElement } from "@excalidraw/element/typeChecks";
|
||||
|
||||
import { getElementsOverlappingFrame } from "@excalidraw/element/frame";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawFrameLikeElement,
|
||||
NonDeletedExcalidrawElement,
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import {
|
||||
copyBlobToClipboardAsPng,
|
||||
copyTextToSystemClipboard,
|
||||
} from "../clipboard";
|
||||
|
||||
import { t } from "../i18n";
|
||||
import { getSelectedElements, isSomeElementSelected } from "../scene";
|
||||
import { exportToCanvas, exportToSvg } from "../scene/export";
|
||||
import { cloneJSON } from "../utils";
|
||||
|
||||
import { canvasToBlob } from "./blob";
|
||||
import { fileSave } from "./filesystem";
|
||||
import { serializeAsJSON } from "./json";
|
||||
|
||||
import type { FileSystemHandle } from "./filesystem";
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawFrameLikeElement,
|
||||
NonDeletedExcalidrawElement,
|
||||
} from "../element/types";
|
||||
|
||||
import type { ExportType } from "../scene/types";
|
||||
import type { AppState, BinaryFiles } from "../types";
|
||||
|
||||
|
|
|
@ -1,17 +1,23 @@
|
|||
import { cleanAppStateForExport, clearAppStateForDatabase } from "../appState";
|
||||
import {
|
||||
DEFAULT_FILENAME,
|
||||
EXPORT_DATA_TYPES,
|
||||
EXPORT_SOURCE,
|
||||
MIME_TYPES,
|
||||
VERSIONS,
|
||||
} from "../constants";
|
||||
import { clearElementsForDatabase, clearElementsForExport } from "../element";
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import {
|
||||
clearElementsForDatabase,
|
||||
clearElementsForExport,
|
||||
} from "@excalidraw/element";
|
||||
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import { cleanAppStateForExport, clearAppStateForDatabase } from "../appState";
|
||||
|
||||
import { isImageFileHandle, loadFromBlob, normalizeFile } from "./blob";
|
||||
import { fileOpen, fileSave } from "./filesystem";
|
||||
|
||||
import type { ExcalidrawElement } from "../element/types";
|
||||
import type { AppState, BinaryFiles, LibraryItems } from "../types";
|
||||
import type {
|
||||
ExportedDataState,
|
||||
|
|
|
@ -7,29 +7,33 @@ import {
|
|||
EVENT,
|
||||
DEFAULT_SIDEBAR,
|
||||
LIBRARY_SIDEBAR_TAB,
|
||||
} from "../constants";
|
||||
import { atom, editorJotaiStore } from "../editor-jotai";
|
||||
import { hashElementsVersion, hashString } from "../element";
|
||||
import { getCommonBoundingBox } from "../element/bounds";
|
||||
import { Emitter } from "../emitter";
|
||||
import { AbortError } from "../errors";
|
||||
import { libraryItemSvgsCache } from "../hooks/useLibraryItemSvg";
|
||||
import { t } from "../i18n";
|
||||
import { Queue } from "../queue";
|
||||
import {
|
||||
arrayToMap,
|
||||
cloneJSON,
|
||||
preventUnload,
|
||||
promiseTry,
|
||||
resolvablePromise,
|
||||
} from "../utils";
|
||||
toValidURL,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import { hashElementsVersion, hashString } from "@excalidraw/element";
|
||||
|
||||
import { getCommonBoundingBox } from "@excalidraw/element/bounds";
|
||||
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import { atom, editorJotaiStore } from "../editor-jotai";
|
||||
|
||||
import { Emitter } from "../emitter";
|
||||
import { AbortError } from "../errors";
|
||||
import { libraryItemSvgsCache } from "../hooks/useLibraryItemSvg";
|
||||
import { t } from "../i18n";
|
||||
import { Queue } from "../queue";
|
||||
|
||||
import { loadLibraryFromBlob } from "./blob";
|
||||
import { restoreLibraryItems } from "./restore";
|
||||
import { toValidURL } from "./url";
|
||||
|
||||
import type App from "../components/App";
|
||||
import type { ExcalidrawElement } from "../element/types";
|
||||
|
||||
import type {
|
||||
LibraryItems,
|
||||
LibraryItem,
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
import throttle from "lodash.throttle";
|
||||
|
||||
import { ENV } from "../constants";
|
||||
import { ENV, arrayToMap } from "@excalidraw/common";
|
||||
|
||||
import type { OrderedExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import {
|
||||
orderByFractionalIndex,
|
||||
syncInvalidIndices,
|
||||
validateFractionalIndices,
|
||||
} from "../fractionalIndex";
|
||||
import { arrayToMap } from "../utils";
|
||||
|
||||
import type { OrderedExcalidrawElement } from "../element/types";
|
||||
import type { AppState } from "../types";
|
||||
import type { MakeBrand } from "../utility-types";
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import { getFileHandleType, isImageFileHandleType } from "./blob";
|
||||
|
||||
import { exportCanvas, prepareElementsForExport } from ".";
|
||||
|
||||
import type { ExcalidrawElement } from "../element/types";
|
||||
import type { AppState, BinaryFiles } from "../types";
|
||||
|
||||
export const resaveAsImageWithScene = async (
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
import { isFiniteNumber, pointFrom } from "@excalidraw/math";
|
||||
|
||||
import type { LocalPoint, Radians } from "@excalidraw/math";
|
||||
|
||||
import { getDefaultAppState } from "../appState";
|
||||
import {
|
||||
DEFAULT_FONT_FAMILY,
|
||||
DEFAULT_TEXT_ALIGN,
|
||||
|
@ -13,22 +10,28 @@ import {
|
|||
DEFAULT_ELEMENT_PROPS,
|
||||
DEFAULT_GRID_SIZE,
|
||||
DEFAULT_GRID_STEP,
|
||||
} from "../constants";
|
||||
randomId,
|
||||
getUpdatedTimestamp,
|
||||
updateActiveTool,
|
||||
arrayToMap,
|
||||
getSizeFromPoints,
|
||||
normalizeLink,
|
||||
} from "@excalidraw/common";
|
||||
import {
|
||||
getNonDeletedElements,
|
||||
getNormalizedDimensions,
|
||||
isInvisiblySmallElement,
|
||||
refreshTextDimensions,
|
||||
} from "../element";
|
||||
import { normalizeFixedPoint } from "../element/binding";
|
||||
} from "@excalidraw/element";
|
||||
import { normalizeFixedPoint } from "@excalidraw/element/binding";
|
||||
import {
|
||||
updateElbowArrowPoints,
|
||||
validateElbowPoints,
|
||||
} from "../element/elbowArrow";
|
||||
import { LinearElementEditor } from "../element/linearElementEditor";
|
||||
import { bumpVersion } from "../element/mutateElement";
|
||||
import { getContainerElement } from "../element/textElement";
|
||||
import { detectLineHeight } from "../element/textMeasurements";
|
||||
} from "@excalidraw/element/elbowArrow";
|
||||
import { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
|
||||
import { bumpVersion } from "@excalidraw/element/mutateElement";
|
||||
import { getContainerElement } from "@excalidraw/element/textElement";
|
||||
import { detectLineHeight } from "@excalidraw/element/textMeasurements";
|
||||
import {
|
||||
isArrowElement,
|
||||
isElbowArrow,
|
||||
|
@ -36,20 +39,9 @@ import {
|
|||
isLinearElement,
|
||||
isTextElement,
|
||||
isUsingAdaptiveRadius,
|
||||
} from "../element/typeChecks";
|
||||
import { getLineHeight } from "../fonts/FontMetadata";
|
||||
import { syncInvalidIndices } from "../fractionalIndex";
|
||||
import { randomId } from "../random";
|
||||
import {
|
||||
getNormalizedGridSize,
|
||||
getNormalizedGridStep,
|
||||
getNormalizedZoom,
|
||||
} from "../scene";
|
||||
import { getUpdatedTimestamp, updateActiveTool } from "../utils";
|
||||
import { arrayToMap } from "../utils";
|
||||
import { getSizeFromPoints } from "../points";
|
||||
} from "@excalidraw/element/typeChecks";
|
||||
|
||||
import { normalizeLink } from "./url";
|
||||
import type { LocalPoint, Radians } from "@excalidraw/math";
|
||||
|
||||
import type {
|
||||
ExcalidrawArrowElement,
|
||||
|
@ -65,7 +57,18 @@ import type {
|
|||
OrderedExcalidrawElement,
|
||||
PointBinding,
|
||||
StrokeRoundness,
|
||||
} from "../element/types";
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { getDefaultAppState } from "../appState";
|
||||
|
||||
import { getLineHeight } from "../fonts/FontMetadata";
|
||||
import { syncInvalidIndices } from "../fractionalIndex";
|
||||
import {
|
||||
getNormalizedGridSize,
|
||||
getNormalizedGridStep,
|
||||
getNormalizedZoom,
|
||||
} from "../scene";
|
||||
|
||||
import type { AppState, BinaryFiles, LibraryItem } from "../types";
|
||||
import type { MarkOptional, Mutable } from "../utility-types";
|
||||
import type { ImportedDataState, LegacyAppState } from "./types";
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import { pointFrom } from "@excalidraw/math";
|
||||
import { vi } from "vitest";
|
||||
|
||||
import type { ExcalidrawArrowElement } from "@excalidraw/element/types";
|
||||
|
||||
import { convertToExcalidrawElements } from "./transform";
|
||||
|
||||
import type { ExcalidrawElementSkeleton } from "./transform";
|
||||
import type { ExcalidrawArrowElement } from "../element/types";
|
||||
|
||||
const opts = { regenerateIds: false };
|
||||
|
||||
|
|
|
@ -5,37 +5,37 @@ import {
|
|||
DEFAULT_FONT_SIZE,
|
||||
TEXT_ALIGN,
|
||||
VERTICAL_ALIGN,
|
||||
} from "../constants";
|
||||
import {
|
||||
getCommonBounds,
|
||||
newElement,
|
||||
newLinearElement,
|
||||
redrawTextBoundingBox,
|
||||
} from "../element";
|
||||
import { bindLinearElement } from "../element/binding";
|
||||
import {
|
||||
newArrowElement,
|
||||
newFrameElement,
|
||||
newImageElement,
|
||||
newMagicFrameElement,
|
||||
newTextElement,
|
||||
} from "../element/newElement";
|
||||
import { measureText, normalizeText } from "../element/textMeasurements";
|
||||
import { isArrowElement } from "../element/typeChecks";
|
||||
import { getLineHeight } from "../fonts/FontMetadata";
|
||||
import { syncInvalidIndices } from "../fractionalIndex";
|
||||
import { getSizeFromPoints } from "../points";
|
||||
import { randomId } from "../random";
|
||||
import {
|
||||
getSizeFromPoints,
|
||||
randomId,
|
||||
arrayToMap,
|
||||
assertNever,
|
||||
cloneJSON,
|
||||
getFontString,
|
||||
isDevEnv,
|
||||
toBrandedType,
|
||||
} from "../utils";
|
||||
} from "@excalidraw/common";
|
||||
import {
|
||||
getCommonBounds,
|
||||
newElement,
|
||||
newLinearElement,
|
||||
redrawTextBoundingBox,
|
||||
} from "@excalidraw/element";
|
||||
import { bindLinearElement } from "@excalidraw/element/binding";
|
||||
import {
|
||||
newArrowElement,
|
||||
newFrameElement,
|
||||
newImageElement,
|
||||
newMagicFrameElement,
|
||||
newTextElement,
|
||||
} from "@excalidraw/element/newElement";
|
||||
import {
|
||||
measureText,
|
||||
normalizeText,
|
||||
} from "@excalidraw/element/textMeasurements";
|
||||
import { isArrowElement } from "@excalidraw/element/typeChecks";
|
||||
|
||||
import type { ElementConstructorOpts } from "@excalidraw/element/newElement";
|
||||
|
||||
import type { ElementConstructorOpts } from "../element/newElement";
|
||||
import type {
|
||||
ElementsMap,
|
||||
ExcalidrawArrowElement,
|
||||
|
@ -55,7 +55,11 @@ import type {
|
|||
NonDeletedSceneElementsMap,
|
||||
TextAlign,
|
||||
VerticalAlign,
|
||||
} from "../element/types";
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { getLineHeight } from "../fonts/FontMetadata";
|
||||
import { syncInvalidIndices } from "../fractionalIndex";
|
||||
|
||||
import type { MarkOptional } from "../utility-types";
|
||||
|
||||
export type ValidLinearElement = {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import type { VERSIONS } from "@excalidraw/common";
|
||||
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import type { cleanAppStateForExport } from "../appState";
|
||||
import type { VERSIONS } from "../constants";
|
||||
import type { ExcalidrawElement } from "../element/types";
|
||||
import type {
|
||||
AppState,
|
||||
BinaryFiles,
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import { getCommonBoundingBox } from "./element/bounds";
|
||||
import { newElementWith } from "./element/mutateElement";
|
||||
import { getMaximumGroups } from "./groups";
|
||||
import { getCommonBoundingBox } from "@excalidraw/element/bounds";
|
||||
import { newElementWith } from "@excalidraw/element/mutateElement";
|
||||
|
||||
import type { ElementsMap, ExcalidrawElement } from "./element/types";
|
||||
import type { ElementsMap, ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import { getMaximumGroups } from "./groups";
|
||||
|
||||
export interface Distribution {
|
||||
space: "between";
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { promiseTry } from "@excalidraw/common";
|
||||
|
||||
import { subsetWoff2GlyphsByCodepoints } from "../subset/subset-main";
|
||||
import { promiseTry } from "../utils";
|
||||
|
||||
import { LOCAL_FONT_PROTOCOL } from "./FontMetadata";
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { FONT_FAMILY, FONT_FAMILY_FALLBACKS } from "@excalidraw/common";
|
||||
|
||||
import type {
|
||||
ExcalidrawTextElement,
|
||||
FontFamilyValues,
|
||||
|
@ -9,7 +11,6 @@ import {
|
|||
FontFamilyHeadingIcon,
|
||||
FontFamilyCodeIcon,
|
||||
} from "../components/icons";
|
||||
import { FONT_FAMILY, FONT_FAMILY_FALLBACKS } from "../constants";
|
||||
|
||||
import type { JSX } from "react";
|
||||
|
||||
|
|
|
@ -4,13 +4,20 @@ import {
|
|||
CJK_HAND_DRAWN_FALLBACK_FONT,
|
||||
WINDOWS_EMOJI_FALLBACK_FONT,
|
||||
getFontFamilyFallbacks,
|
||||
} from "../constants";
|
||||
import { isTextElement } from "../element";
|
||||
import { getContainerElement } from "../element/textElement";
|
||||
import { charWidth } from "../element/textMeasurements";
|
||||
import { containsCJK } from "../element/textWrapping";
|
||||
} from "@excalidraw/common";
|
||||
import { isTextElement } from "@excalidraw/element";
|
||||
import { getContainerElement } from "@excalidraw/element/textElement";
|
||||
import { charWidth } from "@excalidraw/element/textMeasurements";
|
||||
import { containsCJK } from "@excalidraw/element/textWrapping";
|
||||
|
||||
import { getFontString, PromisePool, promiseTry } from "@excalidraw/common";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawTextElement,
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { ShapeCache } from "../scene/ShapeCache";
|
||||
import { getFontString, PromisePool, promiseTry } from "../utils";
|
||||
|
||||
import { CascadiaFontFaces } from "./Cascadia";
|
||||
import { ComicShannsFontFaces } from "./ComicShanns";
|
||||
|
@ -25,11 +32,6 @@ import { NunitoFontFaces } from "./Nunito";
|
|||
import { VirgilFontFaces } from "./Virgil";
|
||||
import { XiaolaiFontFaces } from "./Xiaolai";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawTextElement,
|
||||
FontFamilyValues,
|
||||
} from "../element/types";
|
||||
import type Scene from "../scene/Scene";
|
||||
import type { ValueOf } from "../utility-types";
|
||||
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
import { generateNKeysBetween } from "fractional-indexing";
|
||||
|
||||
import { mutateElement } from "./element/mutateElement";
|
||||
import { getBoundTextElement } from "./element/textElement";
|
||||
import { hasBoundTextElement } from "./element/typeChecks";
|
||||
import { InvalidFractionalIndexError } from "./errors";
|
||||
import { arrayToMap } from "./utils";
|
||||
import { mutateElement } from "@excalidraw/element/mutateElement";
|
||||
import { getBoundTextElement } from "@excalidraw/element/textElement";
|
||||
import { hasBoundTextElement } from "@excalidraw/element/typeChecks";
|
||||
|
||||
import { arrayToMap } from "@excalidraw/common";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
FractionalIndex,
|
||||
OrderedExcalidrawElement,
|
||||
} from "./element/types";
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { InvalidFractionalIndexError } from "./errors";
|
||||
|
||||
/**
|
||||
* Envisioned relation between array order and fractional indices:
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import { API } from "./tests/helpers/api";
|
||||
import { Keyboard, Pointer } from "./tests/helpers/ui";
|
||||
import { getCloneByOrigId, render } from "./tests/test-utils";
|
||||
|
||||
import { convertToExcalidrawElements, Excalidraw } from "./index";
|
||||
|
||||
import type { ExcalidrawElement } from "./element/types";
|
||||
|
||||
const { h } = window;
|
||||
const mouse = new Pointer("mouse");
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import { getBoundTextElement } from "./element/textElement";
|
||||
import { getSelectedElements } from "./scene";
|
||||
import { makeNextSelectedElementIds } from "./scene/selection";
|
||||
import { getBoundTextElement } from "@excalidraw/element/textElement";
|
||||
|
||||
import type {
|
||||
GroupId,
|
||||
|
@ -9,7 +7,11 @@ import type {
|
|||
NonDeletedExcalidrawElement,
|
||||
ElementsMapOrArray,
|
||||
ElementsMap,
|
||||
} from "./element/types";
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { getSelectedElements } from "./scene";
|
||||
import { makeNextSelectedElementIds } from "./scene/selection";
|
||||
|
||||
import type {
|
||||
AppClassProperties,
|
||||
AppState,
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import type { SceneElementsMap } from "@excalidraw/element/types";
|
||||
|
||||
import { Emitter } from "./emitter";
|
||||
|
||||
import type { AppStateChange, ElementsChange } from "./change";
|
||||
import type { SceneElementsMap } from "./element/types";
|
||||
import type { Snapshot } from "./store";
|
||||
import type { AppState } from "./types";
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import { useState, useLayoutEffect } from "react";
|
||||
|
||||
import { THEME } from "@excalidraw/common";
|
||||
|
||||
import { useDevice, useExcalidrawContainer } from "../components/App";
|
||||
import { THEME } from "../constants";
|
||||
import { useUIAppState } from "../context/ui-appState";
|
||||
|
||||
export const useCreatePortalContainer = (opts?: {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { useEffect } from "react";
|
||||
|
||||
import { EVENT } from "../constants";
|
||||
import { EVENT } from "@excalidraw/common";
|
||||
|
||||
export function useOutsideClick<T extends HTMLElement>(
|
||||
ref: React.RefObject<T | null>,
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
import React, { useEffect } from "react";
|
||||
|
||||
import { DEFAULT_UI_OPTIONS, isShallowEqual } from "@excalidraw/common";
|
||||
|
||||
import App from "./components/App";
|
||||
import { InitializeApp } from "./components/InitializeApp";
|
||||
import Footer from "./components/footer/FooterCenter";
|
||||
import LiveCollaborationTrigger from "./components/live-collaboration/LiveCollaborationTrigger";
|
||||
import MainMenu from "./components/main-menu/MainMenu";
|
||||
import WelcomeScreen from "./components/welcome-screen/WelcomeScreen";
|
||||
import { DEFAULT_UI_OPTIONS } from "./constants";
|
||||
import { defaultLang } from "./i18n";
|
||||
import { EditorJotaiProvider, editorJotaiStore } from "./editor-jotai";
|
||||
import polyfill from "./polyfill";
|
||||
import { isShallowEqual } from "./utils";
|
||||
|
||||
import "./css/app.scss";
|
||||
import "./css/styles.scss";
|
||||
|
@ -218,7 +218,7 @@ export {
|
|||
isInvisiblySmallElement,
|
||||
getNonDeletedElements,
|
||||
getTextFromElements,
|
||||
} from "./element";
|
||||
} from "@excalidraw/element";
|
||||
export { defaultLang, useI18n, languages } from "./i18n";
|
||||
export {
|
||||
restore,
|
||||
|
@ -244,7 +244,7 @@ export {
|
|||
} from "./data/blob";
|
||||
export { getFreeDrawSvgPath } from "./renderer/renderElement";
|
||||
export { mergeLibraryItems, getLibraryItemsHash } from "./data/library";
|
||||
export { isLinearElement } from "./element/typeChecks";
|
||||
export { isLinearElement } from "@excalidraw/element/typeChecks";
|
||||
|
||||
export {
|
||||
FONT_FAMILY,
|
||||
|
@ -253,13 +253,14 @@ export {
|
|||
ROUNDNESS,
|
||||
DEFAULT_LASER_COLOR,
|
||||
UserIdleState,
|
||||
} from "./constants";
|
||||
normalizeLink,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
export {
|
||||
mutateElement,
|
||||
newElementWith,
|
||||
bumpVersion,
|
||||
} from "./element/mutateElement";
|
||||
} from "@excalidraw/element/mutateElement";
|
||||
|
||||
export { CaptureUpdateAction } from "./store";
|
||||
|
||||
|
@ -268,7 +269,7 @@ export { parseLibraryTokensFromUrl, useHandleLibrary } from "./data/library";
|
|||
export {
|
||||
sceneCoordsToViewportCoords,
|
||||
viewportCoordsToSceneCoords,
|
||||
} from "./utils";
|
||||
} from "@excalidraw/common";
|
||||
|
||||
export { Sidebar } from "./components/Sidebar/Sidebar";
|
||||
export { Button } from "./components/Button";
|
||||
|
@ -283,10 +284,12 @@ export { DefaultSidebar } from "./components/DefaultSidebar";
|
|||
export { TTDDialog } from "./components/TTDDialog/TTDDialog";
|
||||
export { TTDDialogTrigger } from "./components/TTDDialog/TTDDialogTrigger";
|
||||
|
||||
export { normalizeLink } from "./data/url";
|
||||
export { zoomToFitBounds } from "./actions/actionCanvas";
|
||||
export { convertToExcalidrawElements } from "./data/transform";
|
||||
export { getCommonBounds, getVisibleSceneBounds } from "./element/bounds";
|
||||
export {
|
||||
getCommonBounds,
|
||||
getVisibleSceneBounds,
|
||||
} from "@excalidraw/element/bounds";
|
||||
|
||||
export {
|
||||
elementsOverlappingBBox,
|
||||
|
@ -296,6 +299,6 @@ export {
|
|||
|
||||
export { DiagramToCodePlugin } from "./components/DiagramToCodePlugin/DiagramToCodePlugin";
|
||||
export { getDataURL } from "./data/blob";
|
||||
export { isElementLink } from "./element/elementLink";
|
||||
export { isElementLink } from "@excalidraw/element/elementLink";
|
||||
|
||||
export { setCustomTextMetricsProvider } from "./element/textMeasurements";
|
||||
export { setCustomTextMetricsProvider } from "@excalidraw/element/textMeasurements";
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { DEFAULT_LASER_COLOR, easeOut } from "@excalidraw/common";
|
||||
|
||||
import type { LaserPointerOptions } from "@excalidraw/laser-pointer";
|
||||
|
||||
import { AnimatedTrail } from "./animated-trail";
|
||||
import { getClientColor } from "./clients";
|
||||
import { DEFAULT_LASER_COLOR } from "./constants";
|
||||
import { easeOut } from "./utils";
|
||||
|
||||
import type { Trail } from "./animated-trail";
|
||||
import type { AnimationFrameHandler } from "./animation-frame-handler";
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import { promiseTry, resolvablePromise } from "./utils";
|
||||
import { promiseTry, resolvablePromise } from "@excalidraw/common";
|
||||
|
||||
import type { ResolvablePromise } from "@excalidraw/common";
|
||||
|
||||
import type { MaybePromise } from "./utility-types";
|
||||
import type { ResolvablePromise } from "./utils";
|
||||
|
||||
type Job<T, TArgs extends unknown[]> = (...args: TArgs) => MaybePromise<T>;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
import { version as ReactVersion } from "react";
|
||||
import { unstable_batchedUpdates } from "react-dom";
|
||||
|
||||
import { throttleRAF } from "./utils";
|
||||
import { throttleRAF } from "@excalidraw/common";
|
||||
|
||||
export const withBatchedUpdates = <
|
||||
TFunction extends ((event: any) => void) | (() => void),
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { THEME, THEME_FILTER } from "../constants";
|
||||
import { THEME, THEME_FILTER } from "@excalidraw/common";
|
||||
|
||||
import type { StaticCanvasRenderConfig } from "../scene/types";
|
||||
import type { StaticCanvasAppState, AppState } from "../types";
|
||||
|
|
|
@ -6,35 +6,62 @@ import {
|
|||
} from "@excalidraw/math";
|
||||
import oc from "open-color";
|
||||
|
||||
import { getClientColor, renderRemoteCursors } from "../clients";
|
||||
import {
|
||||
DEFAULT_TRANSFORM_HANDLE_SPACING,
|
||||
FRAME_STYLE,
|
||||
THEME,
|
||||
} from "../constants";
|
||||
arrayToMap,
|
||||
invariant,
|
||||
throttleRAF,
|
||||
} from "@excalidraw/common";
|
||||
import {
|
||||
getElementAbsoluteCoords,
|
||||
getTransformHandlesFromCoords,
|
||||
getTransformHandles,
|
||||
getCommonBounds,
|
||||
} from "../element";
|
||||
} from "@excalidraw/element";
|
||||
import {
|
||||
BINDING_HIGHLIGHT_OFFSET,
|
||||
BINDING_HIGHLIGHT_THICKNESS,
|
||||
maxBindingGap,
|
||||
} from "../element/binding";
|
||||
import { LinearElementEditor } from "../element/linearElementEditor";
|
||||
} from "@excalidraw/element/binding";
|
||||
import { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
|
||||
import {
|
||||
getOmitSidesForDevice,
|
||||
shouldShowBoundingBox,
|
||||
} from "../element/transformHandles";
|
||||
} from "@excalidraw/element/transformHandles";
|
||||
import {
|
||||
isElbowArrow,
|
||||
isFrameLikeElement,
|
||||
isImageElement,
|
||||
isLinearElement,
|
||||
isTextElement,
|
||||
} from "../element/typeChecks";
|
||||
} from "@excalidraw/element/typeChecks";
|
||||
|
||||
import { getCornerRadius } from "@excalidraw/element/shapes";
|
||||
|
||||
import type {
|
||||
SuggestedBinding,
|
||||
SuggestedPointBinding,
|
||||
} from "@excalidraw/element/binding";
|
||||
|
||||
import type {
|
||||
TransformHandles,
|
||||
TransformHandleType,
|
||||
} from "@excalidraw/element/transformHandles";
|
||||
|
||||
import type {
|
||||
ElementsMap,
|
||||
ExcalidrawBindableElement,
|
||||
ExcalidrawElement,
|
||||
ExcalidrawFrameLikeElement,
|
||||
ExcalidrawImageElement,
|
||||
ExcalidrawLinearElement,
|
||||
ExcalidrawTextElement,
|
||||
GroupId,
|
||||
NonDeleted,
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import {
|
||||
isSelectedViaGroup,
|
||||
getSelectedGroupIds,
|
||||
|
@ -49,9 +76,9 @@ import {
|
|||
SCROLLBAR_COLOR,
|
||||
SCROLLBAR_WIDTH,
|
||||
} from "../scene/scrollbars";
|
||||
import { getCornerRadius } from "../shapes";
|
||||
import { type InteractiveCanvasAppState } from "../types";
|
||||
import { arrayToMap, invariant, throttleRAF } from "../utils";
|
||||
|
||||
import { getClientColor, renderRemoteCursors } from "../clients";
|
||||
|
||||
import {
|
||||
bootstrapCanvas,
|
||||
|
@ -59,25 +86,6 @@ import {
|
|||
getNormalizedCanvasDimensions,
|
||||
} from "./helpers";
|
||||
|
||||
import type {
|
||||
SuggestedBinding,
|
||||
SuggestedPointBinding,
|
||||
} from "../element/binding";
|
||||
import type {
|
||||
TransformHandles,
|
||||
TransformHandleType,
|
||||
} from "../element/transformHandles";
|
||||
import type {
|
||||
ElementsMap,
|
||||
ExcalidrawBindableElement,
|
||||
ExcalidrawElement,
|
||||
ExcalidrawFrameLikeElement,
|
||||
ExcalidrawImageElement,
|
||||
ExcalidrawLinearElement,
|
||||
ExcalidrawTextElement,
|
||||
GroupId,
|
||||
NonDeleted,
|
||||
} from "../element/types";
|
||||
import type {
|
||||
InteractiveCanvasRenderConfig,
|
||||
InteractiveSceneRenderConfig,
|
||||
|
|
|
@ -2,7 +2,6 @@ import { isRightAngleRads } from "@excalidraw/math";
|
|||
import { getStroke } from "perfect-freehand";
|
||||
import rough from "roughjs/bin/rough";
|
||||
|
||||
import { getDefaultAppState } from "../appState";
|
||||
import {
|
||||
BOUND_TEXT_PADDING,
|
||||
DEFAULT_REDUCED_GLOBAL_ALPHA,
|
||||
|
@ -10,18 +9,21 @@ import {
|
|||
FRAME_STYLE,
|
||||
MIME_TYPES,
|
||||
THEME,
|
||||
} from "../constants";
|
||||
import { getElementAbsoluteCoords } from "../element/bounds";
|
||||
import { getUncroppedImageElement } from "../element/cropElement";
|
||||
import { LinearElementEditor } from "../element/linearElementEditor";
|
||||
distance,
|
||||
getFontString,
|
||||
isRTL,
|
||||
} from "@excalidraw/common";
|
||||
import { getElementAbsoluteCoords } from "@excalidraw/element/bounds";
|
||||
import { getUncroppedImageElement } from "@excalidraw/element/cropElement";
|
||||
import { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
|
||||
import {
|
||||
getBoundTextElement,
|
||||
getContainerCoords,
|
||||
getContainerElement,
|
||||
getBoundTextMaxHeight,
|
||||
getBoundTextMaxWidth,
|
||||
} from "../element/textElement";
|
||||
import { getLineHeightInPx } from "../element/textMeasurements";
|
||||
} from "@excalidraw/element/textElement";
|
||||
import { getLineHeightInPx } from "@excalidraw/element/textMeasurements";
|
||||
import {
|
||||
isTextElement,
|
||||
isLinearElement,
|
||||
|
@ -31,12 +33,9 @@ import {
|
|||
hasBoundTextElement,
|
||||
isMagicFrameElement,
|
||||
isImageElement,
|
||||
} from "../element/typeChecks";
|
||||
import { getVerticalOffset } from "../fonts/FontMetadata";
|
||||
import { getContainingFrame } from "../frame";
|
||||
import { ShapeCache } from "../scene/ShapeCache";
|
||||
import { getCornerRadius } from "../shapes";
|
||||
import { distance, getFontString, isRTL } from "../utils";
|
||||
} from "@excalidraw/element/typeChecks";
|
||||
import { getContainingFrame } from "@excalidraw/element/frame";
|
||||
import { getCornerRadius } from "@excalidraw/element/shapes";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
|
@ -48,7 +47,12 @@ import type {
|
|||
ExcalidrawFrameLikeElement,
|
||||
NonDeletedSceneElementsMap,
|
||||
ElementsMap,
|
||||
} from "../element/types";
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { getDefaultAppState } from "../appState";
|
||||
import { getVerticalOffset } from "../fonts/FontMetadata";
|
||||
import { ShapeCache } from "../scene/ShapeCache";
|
||||
|
||||
import type {
|
||||
StaticCanvasRenderConfig,
|
||||
RenderableElementsMap,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { throttleRAF } from "../utils";
|
||||
import { throttleRAF } from "@excalidraw/common";
|
||||
|
||||
import { bootstrapCanvas, getNormalizedCanvasDimensions } from "./helpers";
|
||||
import { renderElement } from "./renderElement";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { pointFrom, type GlobalPoint, type LocalPoint } from "@excalidraw/math";
|
||||
|
||||
import { THEME } from "../constants";
|
||||
import { THEME } from "@excalidraw/common";
|
||||
|
||||
import type { PointSnapLine, PointerSnapLine } from "../snapping";
|
||||
import type { InteractiveCanvasAppState } from "../types";
|
||||
|
|
|
@ -1,33 +1,34 @@
|
|||
import {
|
||||
EXTERNAL_LINK_IMG,
|
||||
ELEMENT_LINK_IMG,
|
||||
getLinkHandleFromCoords,
|
||||
} from "../components/hyperlink/helpers";
|
||||
import { FRAME_STYLE } from "../constants";
|
||||
import { getElementAbsoluteCoords } from "../element";
|
||||
import { isElementLink } from "../element/elementLink";
|
||||
import { createPlaceholderEmbeddableLabel } from "../element/embeddable";
|
||||
import { getBoundTextElement } from "../element/textElement";
|
||||
import { FRAME_STYLE, throttleRAF } from "@excalidraw/common";
|
||||
import { getElementAbsoluteCoords } from "@excalidraw/element";
|
||||
import { isElementLink } from "@excalidraw/element/elementLink";
|
||||
import { createPlaceholderEmbeddableLabel } from "@excalidraw/element/embeddable";
|
||||
import { getBoundTextElement } from "@excalidraw/element/textElement";
|
||||
import {
|
||||
isEmbeddableElement,
|
||||
isIframeLikeElement,
|
||||
isTextElement,
|
||||
} from "../element/typeChecks";
|
||||
} from "@excalidraw/element/typeChecks";
|
||||
import {
|
||||
elementOverlapsWithFrame,
|
||||
getTargetFrame,
|
||||
shouldApplyFrameClip,
|
||||
} from "../frame";
|
||||
import { renderElement } from "../renderer/renderElement";
|
||||
import { throttleRAF } from "../utils";
|
||||
|
||||
import { bootstrapCanvas, getNormalizedCanvasDimensions } from "./helpers";
|
||||
} from "@excalidraw/element/frame";
|
||||
|
||||
import type {
|
||||
ElementsMap,
|
||||
ExcalidrawFrameLikeElement,
|
||||
NonDeletedExcalidrawElement,
|
||||
} from "../element/types";
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import {
|
||||
EXTERNAL_LINK_IMG,
|
||||
ELEMENT_LINK_IMG,
|
||||
getLinkHandleFromCoords,
|
||||
} from "../components/hyperlink/helpers";
|
||||
import { renderElement } from "../renderer/renderElement";
|
||||
|
||||
import { bootstrapCanvas, getNormalizedCanvasDimensions } from "./helpers";
|
||||
|
||||
import type {
|
||||
StaticCanvasRenderConfig,
|
||||
StaticSceneRenderConfig,
|
||||
|
|
|
@ -3,39 +3,45 @@ import {
|
|||
MAX_DECIMALS_FOR_SVG_EXPORT,
|
||||
MIME_TYPES,
|
||||
SVG_NS,
|
||||
} from "../constants";
|
||||
import { normalizeLink, toValidURL } from "../data/url";
|
||||
import { getElementAbsoluteCoords, hashString } from "../element";
|
||||
import { getUncroppedWidthAndHeight } from "../element/cropElement";
|
||||
getFontFamilyString,
|
||||
isRTL,
|
||||
isTestEnv,
|
||||
} from "@excalidraw/common";
|
||||
import { normalizeLink, toValidURL } from "@excalidraw/common";
|
||||
import { getElementAbsoluteCoords, hashString } from "@excalidraw/element";
|
||||
import { getUncroppedWidthAndHeight } from "@excalidraw/element/cropElement";
|
||||
import {
|
||||
createPlaceholderEmbeddableLabel,
|
||||
getEmbedLink,
|
||||
} from "../element/embeddable";
|
||||
import { LinearElementEditor } from "../element/linearElementEditor";
|
||||
} from "@excalidraw/element/embeddable";
|
||||
import { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
|
||||
import {
|
||||
getBoundTextElement,
|
||||
getContainerElement,
|
||||
} from "../element/textElement";
|
||||
import { getLineHeightInPx } from "../element/textMeasurements";
|
||||
} from "@excalidraw/element/textElement";
|
||||
import { getLineHeightInPx } from "@excalidraw/element/textMeasurements";
|
||||
import {
|
||||
isArrowElement,
|
||||
isIframeLikeElement,
|
||||
isInitializedImageElement,
|
||||
isTextElement,
|
||||
} from "../element/typeChecks";
|
||||
import { getVerticalOffset } from "../fonts/FontMetadata";
|
||||
import { getContainingFrame } from "../frame";
|
||||
import { ShapeCache } from "../scene/ShapeCache";
|
||||
import { getCornerRadius, isPathALoop } from "../shapes";
|
||||
import { getFontFamilyString, isRTL, isTestEnv } from "../utils";
|
||||
} from "@excalidraw/element/typeChecks";
|
||||
|
||||
import { getFreeDrawSvgPath, IMAGE_INVERT_FILTER } from "./renderElement";
|
||||
import { getContainingFrame } from "@excalidraw/element/frame";
|
||||
|
||||
import { getCornerRadius, isPathALoop } from "@excalidraw/element/shapes";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawTextElementWithContainer,
|
||||
NonDeletedExcalidrawElement,
|
||||
} from "../element/types";
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { getVerticalOffset } from "../fonts/FontMetadata";
|
||||
import { ShapeCache } from "../scene/ShapeCache";
|
||||
|
||||
import { getFreeDrawSvgPath, IMAGE_INVERT_FILTER } from "./renderElement";
|
||||
|
||||
import type { RenderableElementsMap, SVGRenderConfig } from "../scene/types";
|
||||
import type { AppState, BinaryFiles } from "../types";
|
||||
import type { Drawable } from "roughjs/bin/core";
|
||||
|
|
|
@ -1,16 +1,20 @@
|
|||
import { isElementInViewport } from "../element/sizeHelpers";
|
||||
import { isImageElement } from "../element/typeChecks";
|
||||
import { renderInteractiveSceneThrottled } from "../renderer/interactiveScene";
|
||||
import { renderStaticSceneThrottled } from "../renderer/staticScene";
|
||||
import { memoize, toBrandedType } from "../utils";
|
||||
import { isElementInViewport } from "@excalidraw/element/sizeHelpers";
|
||||
import { isImageElement } from "@excalidraw/element/typeChecks";
|
||||
|
||||
import { memoize, toBrandedType } from "@excalidraw/common";
|
||||
|
||||
import type Scene from "./Scene";
|
||||
import type { RenderableElementsMap } from "./types";
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
NonDeletedElementsMap,
|
||||
NonDeletedExcalidrawElement,
|
||||
} from "../element/types";
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { renderInteractiveSceneThrottled } from "../renderer/interactiveScene";
|
||||
import { renderStaticSceneThrottled } from "../renderer/staticScene";
|
||||
|
||||
import type Scene from "./Scene";
|
||||
import type { RenderableElementsMap } from "./types";
|
||||
|
||||
import type { AppState } from "../types";
|
||||
|
||||
export class Renderer {
|
||||
|
|
|
@ -1,21 +1,14 @@
|
|||
import throttle from "lodash.throttle";
|
||||
|
||||
import { ENV } from "../constants";
|
||||
import { isNonDeletedElement } from "../element";
|
||||
import { isFrameLikeElement } from "../element/typeChecks";
|
||||
import {
|
||||
syncInvalidIndices,
|
||||
syncMovedIndices,
|
||||
validateFractionalIndices,
|
||||
} from "../fractionalIndex";
|
||||
import { getElementsInGroup } from "../groups";
|
||||
import { randomInteger } from "../random";
|
||||
import { arrayToMap } from "../utils";
|
||||
import { toBrandedType } from "../utils";
|
||||
import { ENV } from "@excalidraw/common";
|
||||
import { isNonDeletedElement } from "@excalidraw/element";
|
||||
import { isFrameLikeElement } from "@excalidraw/element/typeChecks";
|
||||
|
||||
import { getSelectedElements } from "./selection";
|
||||
import { randomInteger } from "@excalidraw/common";
|
||||
import { arrayToMap } from "@excalidraw/common";
|
||||
import { toBrandedType } from "@excalidraw/common";
|
||||
|
||||
import type { LinearElementEditor } from "../element/linearElementEditor";
|
||||
import type { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
NonDeletedExcalidrawElement,
|
||||
|
@ -26,7 +19,17 @@ import type {
|
|||
NonDeletedSceneElementsMap,
|
||||
OrderedExcalidrawElement,
|
||||
Ordered,
|
||||
} from "../element/types";
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { getElementsInGroup } from "../groups";
|
||||
import {
|
||||
syncInvalidIndices,
|
||||
syncMovedIndices,
|
||||
validateFractionalIndices,
|
||||
} from "../fractionalIndex";
|
||||
|
||||
import { getSelectedElements } from "./selection";
|
||||
|
||||
import type { AppState } from "../types";
|
||||
import type { Assert, SameType } from "../utility-types";
|
||||
|
||||
|
|
|
@ -1,21 +1,18 @@
|
|||
import { pointFrom, pointDistance, type LocalPoint } from "@excalidraw/math";
|
||||
import { simplify } from "points-on-curve";
|
||||
|
||||
import { ROUGHNESS } from "../constants";
|
||||
import { getDiamondPoints, getArrowheadPoints } from "../element";
|
||||
import { headingForPointIsHorizontal } from "../element/heading";
|
||||
import { ROUGHNESS, isTransparent, assertNever } from "@excalidraw/common";
|
||||
import { getDiamondPoints, getArrowheadPoints } from "@excalidraw/element";
|
||||
import { headingForPointIsHorizontal } from "@excalidraw/element/heading";
|
||||
import {
|
||||
isElbowArrow,
|
||||
isEmbeddableElement,
|
||||
isIframeElement,
|
||||
isIframeLikeElement,
|
||||
isLinearElement,
|
||||
} from "../element/typeChecks";
|
||||
import { generateFreeDrawShape } from "../renderer/renderElement";
|
||||
import { getCornerRadius, isPathALoop } from "../shapes";
|
||||
import { isTransparent, assertNever } from "../utils";
|
||||
} from "@excalidraw/element/typeChecks";
|
||||
|
||||
import { canChangeRoundness } from "./comparisons";
|
||||
import { getCornerRadius, isPathALoop } from "@excalidraw/element/shapes";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
|
@ -23,7 +20,12 @@ import type {
|
|||
ExcalidrawSelectionElement,
|
||||
ExcalidrawLinearElement,
|
||||
Arrowhead,
|
||||
} from "../element/types";
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { generateFreeDrawShape } from "../renderer/renderElement";
|
||||
|
||||
import { canChangeRoundness } from "./comparisons";
|
||||
|
||||
import type { EmbedsValidationStatus } from "../types";
|
||||
import type { ElementShapes } from "./types";
|
||||
import type { Drawable, Options } from "roughjs/bin/core";
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
import { RoughGenerator } from "roughjs/bin/generator";
|
||||
|
||||
import { COLOR_PALETTE } from "../colors";
|
||||
import { elementWithCanvasCache } from "../renderer/renderElement";
|
||||
|
||||
import { _generateElementShape } from "./Shape";
|
||||
import { COLOR_PALETTE } from "@excalidraw/common";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawSelectionElement,
|
||||
} from "../element/types";
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { elementWithCanvasCache } from "../renderer/renderElement";
|
||||
|
||||
import { _generateElementShape } from "./Shape";
|
||||
|
||||
import type { AppState, EmbedsValidationStatus } from "../types";
|
||||
import type { ElementShape, ElementShapes } from "./types";
|
||||
import type { Drawable } from "roughjs/bin/core";
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import rough from "roughjs/bin/rough";
|
||||
|
||||
import { getDefaultAppState } from "../appState";
|
||||
import {
|
||||
DEFAULT_EXPORT_PADDING,
|
||||
FRAME_STYLE,
|
||||
|
@ -10,39 +9,58 @@ import {
|
|||
THEME_FILTER,
|
||||
MIME_TYPES,
|
||||
EXPORT_DATA_TYPES,
|
||||
} from "../constants";
|
||||
import { base64ToString, decode, encode, stringToBase64 } from "../data/encode";
|
||||
import { serializeAsJSON } from "../data/json";
|
||||
import { newTextElement } from "../element";
|
||||
import { getCommonBounds, getElementAbsoluteCoords } from "../element/bounds";
|
||||
arrayToMap,
|
||||
distance,
|
||||
getFontString,
|
||||
toBrandedType,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import { newTextElement } from "@excalidraw/element";
|
||||
|
||||
import {
|
||||
getCommonBounds,
|
||||
getElementAbsoluteCoords,
|
||||
} from "@excalidraw/element/bounds";
|
||||
|
||||
import {
|
||||
getInitializedImageElements,
|
||||
updateImageCache,
|
||||
} from "../element/image";
|
||||
import { newElementWith } from "../element/mutateElement";
|
||||
import { isFrameLikeElement } from "../element/typeChecks";
|
||||
import { Fonts } from "../fonts";
|
||||
import { syncInvalidIndices } from "../fractionalIndex";
|
||||
} from "@excalidraw/element/image";
|
||||
|
||||
import { newElementWith } from "@excalidraw/element/mutateElement";
|
||||
|
||||
import { isFrameLikeElement } from "@excalidraw/element/typeChecks";
|
||||
|
||||
import {
|
||||
getElementsOverlappingFrame,
|
||||
getFrameLikeElements,
|
||||
getFrameLikeTitle,
|
||||
getRootElements,
|
||||
} from "../frame";
|
||||
import { renderStaticScene } from "../renderer/staticScene";
|
||||
import { renderSceneToSvg } from "../renderer/staticSvgScene";
|
||||
import { type Mutable } from "../utility-types";
|
||||
import { arrayToMap, distance, getFontString, toBrandedType } from "../utils";
|
||||
} from "@excalidraw/element/frame";
|
||||
|
||||
import type { Bounds } from "@excalidraw/element/bounds";
|
||||
|
||||
import type { RenderableElementsMap } from "./types";
|
||||
import type { Bounds } from "../element/bounds";
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawFrameLikeElement,
|
||||
ExcalidrawTextElement,
|
||||
NonDeletedExcalidrawElement,
|
||||
NonDeletedSceneElementsMap,
|
||||
} from "../element/types";
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { getDefaultAppState } from "../appState";
|
||||
import { base64ToString, decode, encode, stringToBase64 } from "../data/encode";
|
||||
import { serializeAsJSON } from "../data/json";
|
||||
|
||||
import { Fonts } from "../fonts";
|
||||
import { syncInvalidIndices } from "../fractionalIndex";
|
||||
|
||||
import { renderStaticScene } from "../renderer/staticScene";
|
||||
import { renderSceneToSvg } from "../renderer/staticSvgScene";
|
||||
import { type Mutable } from "../utility-types";
|
||||
|
||||
import type { RenderableElementsMap } from "./types";
|
||||
|
||||
import type { AppState, BinaryFiles } from "../types";
|
||||
|
||||
const truncateText = (element: ExcalidrawTextElement, maxWidth: number) => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { clamp, round } from "@excalidraw/math";
|
||||
import { MAX_ZOOM, MIN_ZOOM } from "@excalidraw/common";
|
||||
|
||||
import { MAX_ZOOM, MIN_ZOOM } from "../constants";
|
||||
import { clamp, round } from "@excalidraw/math";
|
||||
|
||||
import type { NormalizedZoomValue } from "../types";
|
||||
|
||||
|
|
|
@ -2,13 +2,14 @@ import {
|
|||
getCommonBounds,
|
||||
getClosestElementBounds,
|
||||
getVisibleElements,
|
||||
} from "../element";
|
||||
} from "@excalidraw/element";
|
||||
import {
|
||||
sceneCoordsToViewportCoords,
|
||||
viewportCoordsToSceneCoords,
|
||||
} from "../utils";
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import type { ExcalidrawElement } from "../element/types";
|
||||
import type { AppState, Offsets, PointerCoords, Zoom } from "../types";
|
||||
|
||||
const isOutsideViewPort = (appState: AppState, cords: Array<number>) => {
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
import { getCommonBounds } from "../element";
|
||||
import { getLanguage } from "../i18n";
|
||||
import { getGlobalCSSVariable } from "../utils";
|
||||
import { getCommonBounds } from "@excalidraw/element";
|
||||
|
||||
import { getGlobalCSSVariable } from "@excalidraw/common";
|
||||
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import { getLanguage } from "../i18n";
|
||||
|
||||
import type { ExcalidrawElement } from "../element/types";
|
||||
import type { InteractiveCanvasAppState } from "../types";
|
||||
import type { ScrollBars } from "./types";
|
||||
|
||||
|
|
|
@ -1,19 +1,26 @@
|
|||
import { getElementAbsoluteCoords, getElementBounds } from "../element";
|
||||
import { isElementInViewport } from "../element/sizeHelpers";
|
||||
import { isBoundToContainer, isFrameLikeElement } from "../element/typeChecks";
|
||||
import {
|
||||
getElementAbsoluteCoords,
|
||||
getElementBounds,
|
||||
} from "@excalidraw/element/bounds";
|
||||
import { isElementInViewport } from "@excalidraw/element/sizeHelpers";
|
||||
import {
|
||||
isBoundToContainer,
|
||||
isFrameLikeElement,
|
||||
} from "@excalidraw/element/typeChecks";
|
||||
import {
|
||||
elementOverlapsWithFrame,
|
||||
getContainingFrame,
|
||||
getFrameChildren,
|
||||
} from "../frame";
|
||||
import { isShallowEqual } from "../utils";
|
||||
} from "@excalidraw/element/frame";
|
||||
import { isShallowEqual } from "@excalidraw/common";
|
||||
|
||||
import type {
|
||||
ElementsMap,
|
||||
ElementsMapOrArray,
|
||||
ExcalidrawElement,
|
||||
NonDeletedExcalidrawElement,
|
||||
} from "../element/types";
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import type { AppState, InteractiveCanvasAppState } from "../types";
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import type { UserIdleState } from "../constants";
|
||||
import type { UserIdleState } from "@excalidraw/common";
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
NonDeletedElementsMap,
|
||||
NonDeletedExcalidrawElement,
|
||||
NonDeletedSceneElementsMap,
|
||||
} from "../element/types";
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import type {
|
||||
AppClassProperties,
|
||||
AppState,
|
||||
|
|
|
@ -7,34 +7,37 @@ import {
|
|||
type GlobalPoint,
|
||||
} from "@excalidraw/math";
|
||||
|
||||
import type { InclusiveRange } from "@excalidraw/math";
|
||||
|
||||
import { TOOL_TYPE } from "./constants";
|
||||
import { TOOL_TYPE, KEYS } from "@excalidraw/common";
|
||||
import {
|
||||
getCommonBounds,
|
||||
getDraggedElementsBounds,
|
||||
getElementAbsoluteCoords,
|
||||
} from "./element/bounds";
|
||||
import { isBoundToContainer, isFrameLikeElement } from "./element/typeChecks";
|
||||
} from "@excalidraw/element/bounds";
|
||||
import {
|
||||
isBoundToContainer,
|
||||
isFrameLikeElement,
|
||||
} from "@excalidraw/element/typeChecks";
|
||||
|
||||
import type { InclusiveRange } from "@excalidraw/math";
|
||||
|
||||
import type { Bounds } from "@excalidraw/element/bounds";
|
||||
import type { MaybeTransformHandleType } from "@excalidraw/element/transformHandles";
|
||||
import type {
|
||||
ElementsMap,
|
||||
ExcalidrawElement,
|
||||
NonDeletedExcalidrawElement,
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { getMaximumGroups } from "./groups";
|
||||
import { KEYS } from "./keys";
|
||||
import {
|
||||
getSelectedElements,
|
||||
getVisibleAndNonSelectedElements,
|
||||
} from "./scene/selection";
|
||||
|
||||
import type { Bounds } from "./element/bounds";
|
||||
import type { MaybeTransformHandleType } from "./element/transformHandles";
|
||||
import type {
|
||||
ElementsMap,
|
||||
ExcalidrawElement,
|
||||
NonDeletedExcalidrawElement,
|
||||
} from "./element/types";
|
||||
import type {
|
||||
AppClassProperties,
|
||||
AppState,
|
||||
KeyboardModifiersObject,
|
||||
NullableGridSize,
|
||||
} from "./types";
|
||||
|
||||
const SNAP_DISTANCE = 8;
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
import { ENV, isShallowEqual } from "@excalidraw/common";
|
||||
|
||||
import { deepCopyElement, newElementWith } from "@excalidraw/element";
|
||||
|
||||
import type { OrderedExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import { getDefaultAppState } from "./appState";
|
||||
import { AppStateChange, ElementsChange } from "./change";
|
||||
import { ENV } from "./constants";
|
||||
import { newElementWith } from "./element/mutateElement";
|
||||
import { deepCopyElement } from "./element/newElement";
|
||||
import { Emitter } from "./emitter";
|
||||
import { isShallowEqual } from "./utils";
|
||||
|
||||
import type { OrderedExcalidrawElement } from "./element/types";
|
||||
import { Emitter } from "./emitter";
|
||||
|
||||
import type { AppState, ObservedAppState } from "./types";
|
||||
import type { ValueOf } from "./utility-types";
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { isServerEnv, promiseTry } from "@excalidraw/common";
|
||||
|
||||
import { WorkerInTheMainChunkError, WorkerUrlNotDefinedError } from "../errors";
|
||||
import { isServerEnv, promiseTry } from "../utils";
|
||||
import { WorkerPool } from "../workers";
|
||||
|
||||
import type { Commands } from "./subset-shared.chunk";
|
||||
|
|
|
@ -1,19 +1,16 @@
|
|||
import type { Action } from "./actions/types";
|
||||
import type { Spreadsheet } from "./charts";
|
||||
import type { ClipboardData } from "./clipboard";
|
||||
import type App from "./components/App";
|
||||
import type Library from "./data/library";
|
||||
import type { FileSystemHandle } from "./data/filesystem";
|
||||
import type { IMAGE_MIME_TYPES, MIME_TYPES } from "./constants";
|
||||
import type { ContextMenuItems } from "./components/ContextMenu";
|
||||
import type { SnapLine } from "./snapping";
|
||||
import type { Merge, MaybePromise, ValueOf, MakeBrand } from "./utility-types";
|
||||
import type { CaptureUpdateActionType } from "./store";
|
||||
import type { UserIdleState } from "./constants";
|
||||
import type { ImportedDataState } from "./data/types";
|
||||
import type { SuggestedBinding } from "./element/binding";
|
||||
import type { LinearElementEditor } from "./element/linearElementEditor";
|
||||
import type { MaybeTransformHandleType } from "./element/transformHandles";
|
||||
import type {
|
||||
IMAGE_MIME_TYPES,
|
||||
UserIdleState,
|
||||
throttleRAF,
|
||||
MIME_TYPES,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import type { SuggestedBinding } from "@excalidraw/element/binding";
|
||||
|
||||
import type { LinearElementEditor } from "@excalidraw/element/linearElementEditor";
|
||||
|
||||
import type { MaybeTransformHandleType } from "@excalidraw/element/transformHandles";
|
||||
|
||||
import type {
|
||||
PointerType,
|
||||
ExcalidrawLinearElement,
|
||||
|
@ -37,10 +34,22 @@ import type {
|
|||
ExcalidrawIframeLikeElement,
|
||||
OrderedExcalidrawElement,
|
||||
ExcalidrawNonSelectionElement,
|
||||
} from "./element/types";
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import type { Action } from "./actions/types";
|
||||
import type { Spreadsheet } from "./charts";
|
||||
import type { ClipboardData } from "./clipboard";
|
||||
import type App from "./components/App";
|
||||
import type Library from "./data/library";
|
||||
import type { FileSystemHandle } from "./data/filesystem";
|
||||
import type { ContextMenuItems } from "./components/ContextMenu";
|
||||
import type { SnapLine } from "./snapping";
|
||||
import type { Merge, MaybePromise, ValueOf, MakeBrand } from "./utility-types";
|
||||
import type { CaptureUpdateActionType } from "./store";
|
||||
import type { ImportedDataState } from "./data/types";
|
||||
|
||||
import type { Language } from "./i18n";
|
||||
import type { isOverScrollBars } from "./scene/scrollbars";
|
||||
import type { throttleRAF } from "./utils";
|
||||
import type React from "react";
|
||||
import type { JSX } from "react";
|
||||
|
||||
|
|
|
@ -6,12 +6,12 @@ import {
|
|||
type LocalPoint,
|
||||
} from "@excalidraw/math";
|
||||
|
||||
import { isBounds } from "@excalidraw/element/typeChecks";
|
||||
|
||||
import type { Curve } from "@excalidraw/math";
|
||||
import type { LineSegment } from "@excalidraw/utils";
|
||||
|
||||
import { isBounds } from "./element/typeChecks";
|
||||
|
||||
import type { Bounds } from "./element/bounds";
|
||||
import type { Bounds } from "@excalidraw/element/bounds";
|
||||
|
||||
// The global data holder to collect the debug operations
|
||||
declare global {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { debounce } from "@excalidraw/common";
|
||||
|
||||
import { WorkerInTheMainChunkError, WorkerUrlNotDefinedError } from "./errors";
|
||||
import { debounce } from "./utils";
|
||||
|
||||
class IdleWorker {
|
||||
public instance: Worker;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue