refactor: auto ordered imports (#9163)

This commit is contained in:
Marcel Mraz
2025-03-12 15:23:31 +01:00
committed by GitHub
parent 82b9a6b464
commit 21ffaf4d76
421 changed files with 3532 additions and 2763 deletions

View File

@@ -1,8 +1,7 @@
import type { StaticCanvasAppState, AppState } from "../types";
import { THEME, THEME_FILTER } from "../constants";
import type { StaticCanvasRenderConfig } from "../scene/types";
import { THEME, THEME_FILTER } from "../constants";
import type { StaticCanvasAppState, AppState } from "../types";
export const fillCircle = (
context: CanvasRenderingContext2D,

View File

@@ -1,48 +1,23 @@
import {
pointFrom,
type GlobalPoint,
type LocalPoint,
type Radians,
} from "@excalidraw/math";
import oc from "open-color";
import { getClientColor, renderRemoteCursors } from "../clients";
import {
DEFAULT_TRANSFORM_HANDLE_SPACING,
FRAME_STYLE,
THEME,
} from "../constants";
import {
getElementAbsoluteCoords,
getTransformHandlesFromCoords,
getTransformHandles,
getCommonBounds,
} from "../element";
import { roundRect } from "../renderer/roundRect";
import {
getScrollBars,
SCROLLBAR_COLOR,
SCROLLBAR_WIDTH,
} from "../scene/scrollbars";
import { renderSelectionElement } from "../renderer/renderElement";
import { getClientColor, renderRemoteCursors } from "../clients";
import {
isSelectedViaGroup,
getSelectedGroupIds,
getElementsInGroup,
selectGroupsFromGivenElements,
} from "../groups";
import type {
TransformHandles,
TransformHandleType,
} from "../element/transformHandles";
import {
getOmitSidesForDevice,
shouldShowBoundingBox,
} from "../element/transformHandles";
import { arrayToMap, invariant, throttleRAF } from "../utils";
import {
DEFAULT_TRANSFORM_HANDLE_SPACING,
FRAME_STYLE,
THEME,
} from "../constants";
import { type InteractiveCanvasAppState } from "../types";
import { renderSnaps } from "../renderer/renderSnaps";
import type {
SuggestedBinding,
SuggestedPointBinding,
} from "../element/binding";
import {
BINDING_HIGHLIGHT_OFFSET,
BINDING_HIGHLIGHT_THICKNESS,
@@ -50,11 +25,9 @@ import {
} from "../element/binding";
import { LinearElementEditor } from "../element/linearElementEditor";
import {
bootstrapCanvas,
fillCircle,
getNormalizedCanvasDimensions,
} from "./helpers";
import oc from "open-color";
getOmitSidesForDevice,
shouldShowBoundingBox,
} from "../element/transformHandles";
import {
isElbowArrow,
isFrameLikeElement,
@@ -62,6 +35,38 @@ import {
isLinearElement,
isTextElement,
} from "../element/typeChecks";
import {
isSelectedViaGroup,
getSelectedGroupIds,
getElementsInGroup,
selectGroupsFromGivenElements,
} from "../groups";
import { renderSelectionElement } from "../renderer/renderElement";
import { renderSnaps } from "../renderer/renderSnaps";
import { roundRect } from "../renderer/roundRect";
import {
getScrollBars,
SCROLLBAR_COLOR,
SCROLLBAR_WIDTH,
} from "../scene/scrollbars";
import { getCornerRadius } from "../shapes";
import { type InteractiveCanvasAppState } from "../types";
import { arrayToMap, invariant, throttleRAF } from "../utils";
import {
bootstrapCanvas,
fillCircle,
getNormalizedCanvasDimensions,
} from "./helpers";
import type {
SuggestedBinding,
SuggestedPointBinding,
} from "../element/binding";
import type {
TransformHandles,
TransformHandleType,
} from "../element/transformHandles";
import type {
ElementsMap,
ExcalidrawBindableElement,
@@ -78,13 +83,6 @@ import type {
InteractiveSceneRenderConfig,
RenderableElementsMap,
} from "../scene/types";
import {
pointFrom,
type GlobalPoint,
type LocalPoint,
type Radians,
} from "@excalidraw/math";
import { getCornerRadius } from "../shapes";
const renderElbowArrowMidPointHighlight = (
context: CanvasRenderingContext2D,

View File

@@ -1,3 +1,43 @@
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,
ELEMENT_READY_TO_ERASE_OPACITY,
FRAME_STYLE,
MIME_TYPES,
THEME,
} from "../constants";
import { getElementAbsoluteCoords } from "../element/bounds";
import { getUncroppedImageElement } from "../element/cropElement";
import { LinearElementEditor } from "../element/linearElementEditor";
import {
getBoundTextElement,
getContainerCoords,
getContainerElement,
getBoundTextMaxHeight,
getBoundTextMaxWidth,
} from "../element/textElement";
import { getLineHeightInPx } from "../element/textMeasurements";
import {
isTextElement,
isLinearElement,
isFreeDrawElement,
isInitializedImageElement,
isArrowElement,
hasBoundTextElement,
isMagicFrameElement,
isImageElement,
} from "../element/typeChecks";
import { getVerticalOffset } from "../fonts";
import { getContainingFrame } from "../frame";
import { ShapeCache } from "../scene/ShapeCache";
import { getCornerRadius } from "../shapes";
import { distance, getFontString, isRTL } from "../utils";
import type {
ExcalidrawElement,
ExcalidrawTextElement,
@@ -9,26 +49,11 @@ import type {
NonDeletedSceneElementsMap,
ElementsMap,
} from "../element/types";
import {
isTextElement,
isLinearElement,
isFreeDrawElement,
isInitializedImageElement,
isArrowElement,
hasBoundTextElement,
isMagicFrameElement,
isImageElement,
} from "../element/typeChecks";
import { getElementAbsoluteCoords } from "../element/bounds";
import type { RoughCanvas } from "roughjs/bin/canvas";
import type {
StaticCanvasRenderConfig,
RenderableElementsMap,
InteractiveCanvasRenderConfig,
} from "../scene/types";
import { distance, getFontString, isRTL } from "../utils";
import rough from "roughjs/bin/rough";
import type {
AppState,
StaticCanvasAppState,
@@ -37,33 +62,8 @@ import type {
ElementsPendingErasure,
PendingExcalidrawElements,
} from "../types";
import { getDefaultAppState } from "../appState";
import {
BOUND_TEXT_PADDING,
DEFAULT_REDUCED_GLOBAL_ALPHA,
ELEMENT_READY_TO_ERASE_OPACITY,
FRAME_STYLE,
MIME_TYPES,
THEME,
} from "../constants";
import type { StrokeOptions } from "perfect-freehand";
import { getStroke } from "perfect-freehand";
import {
getBoundTextElement,
getContainerCoords,
getContainerElement,
getBoundTextMaxHeight,
getBoundTextMaxWidth,
} from "../element/textElement";
import { LinearElementEditor } from "../element/linearElementEditor";
import { getContainingFrame } from "../frame";
import { ShapeCache } from "../scene/ShapeCache";
import { getVerticalOffset } from "../fonts";
import { isRightAngleRads } from "@excalidraw/math";
import { getCornerRadius } from "../shapes";
import { getUncroppedImageElement } from "../element/cropElement";
import { getLineHeightInPx } from "../element/textMeasurements";
import type { RoughCanvas } from "roughjs/bin/canvas";
// using a stronger invert (100% vs our regular 93%) and saturate
// as a temp hack to make images in dark theme look closer to original

View File

@@ -1,8 +1,10 @@
import type { NewElementSceneRenderConfig } from "../scene/types";
import { throttleRAF } from "../utils";
import { bootstrapCanvas, getNormalizedCanvasDimensions } from "./helpers";
import { renderElement } from "./renderElement";
import type { NewElementSceneRenderConfig } from "../scene/types";
const _renderNewElementScene = ({
canvas,
rc,

View File

@@ -1,5 +1,7 @@
import { pointFrom, type GlobalPoint, type LocalPoint } from "@excalidraw/math";
import { THEME } from "../constants";
import type { PointSnapLine, PointerSnapLine } from "../snapping";
import type { InteractiveCanvasAppState } from "../types";

View File

@@ -1,19 +1,28 @@
import {
EXTERNAL_LINK_IMG,
ELEMENT_LINK_IMG,
getLinkHandleFromCoords,
} from "../components/hyperlink/helpers";
import { FRAME_STYLE } from "../constants";
import { getElementAbsoluteCoords } from "../element";
import {
elementOverlapsWithFrame,
getTargetFrame,
shouldApplyFrameClip,
} from "../frame";
import { isElementLink } from "../element/elementLink";
import { createPlaceholderEmbeddableLabel } from "../element/embeddable";
import { getBoundTextElement } from "../element/textElement";
import {
isEmbeddableElement,
isIframeLikeElement,
isTextElement,
} from "../element/typeChecks";
import {
elementOverlapsWithFrame,
getTargetFrame,
shouldApplyFrameClip,
} from "../frame";
import { renderElement } from "../renderer/renderElement";
import { createPlaceholderEmbeddableLabel } from "../element/embeddable";
import type { StaticCanvasAppState, Zoom } from "../types";
import { throttleRAF } from "../utils";
import { bootstrapCanvas, getNormalizedCanvasDimensions } from "./helpers";
import type {
ElementsMap,
ExcalidrawFrameLikeElement,
@@ -23,15 +32,7 @@ import type {
StaticCanvasRenderConfig,
StaticSceneRenderConfig,
} from "../scene/types";
import {
EXTERNAL_LINK_IMG,
ELEMENT_LINK_IMG,
getLinkHandleFromCoords,
} from "../components/hyperlink/helpers";
import { bootstrapCanvas, getNormalizedCanvasDimensions } from "./helpers";
import { throttleRAF } from "../utils";
import { getBoundTextElement } from "../element/textElement";
import { isElementLink } from "../element/elementLink";
import type { StaticCanvasAppState, Zoom } from "../types";
const GridLineColor = {
Bold: "#dddddd",

View File

@@ -1,5 +1,3 @@
import type { Drawable } from "roughjs/bin/core";
import type { RoughSVG } from "roughjs/bin/svg";
import {
FRAME_STYLE,
MAX_DECIMALS_FOR_SVG_EXPORT,
@@ -8,6 +6,7 @@ import {
} from "../constants";
import { normalizeLink, toValidURL } from "../data/url";
import { getElementAbsoluteCoords, hashString } from "../element";
import { getUncroppedWidthAndHeight } from "../element/cropElement";
import {
createPlaceholderEmbeddableLabel,
getEmbedLink,
@@ -17,27 +16,30 @@ import {
getBoundTextElement,
getContainerElement,
} from "../element/textElement";
import { getLineHeightInPx } from "../element/textMeasurements";
import {
isArrowElement,
isIframeLikeElement,
isInitializedImageElement,
isTextElement,
} from "../element/typeChecks";
import { getVerticalOffset } from "../fonts";
import { getContainingFrame } from "../frame";
import { ShapeCache } from "../scene/ShapeCache";
import { getCornerRadius, isPathALoop } from "../shapes";
import { getFontFamilyString, isRTL, isTestEnv } from "../utils";
import { getFreeDrawSvgPath, IMAGE_INVERT_FILTER } from "./renderElement";
import type {
ExcalidrawElement,
ExcalidrawTextElementWithContainer,
NonDeletedExcalidrawElement,
} from "../element/types";
import { getContainingFrame } from "../frame";
import { ShapeCache } from "../scene/ShapeCache";
import type { RenderableElementsMap, SVGRenderConfig } from "../scene/types";
import type { AppState, BinaryFiles } from "../types";
import { getFontFamilyString, isRTL, isTestEnv } from "../utils";
import { getFreeDrawSvgPath, IMAGE_INVERT_FILTER } from "./renderElement";
import { getVerticalOffset } from "../fonts";
import { getCornerRadius, isPathALoop } from "../shapes";
import { getUncroppedWidthAndHeight } from "../element/cropElement";
import { getLineHeightInPx } from "../element/textMeasurements";
import type { Drawable } from "roughjs/bin/core";
import type { RoughSVG } from "roughjs/bin/svg";
const roughSVGDrawWithPrecision = (
rsvg: RoughSVG,