mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Fix the rest except scene and ShapeCache
This commit is contained in:
parent
79021f4b6b
commit
875450a0a1
30 changed files with 100 additions and 125 deletions
|
@ -1,9 +0,0 @@
|
|||
export * from "./src/binary-heap";
|
||||
export * from "./src/colors";
|
||||
export * from "./src/constants";
|
||||
export * from "./src/keys";
|
||||
export * from "./src/points";
|
||||
export * from "./src/promise-pool";
|
||||
export * from "./src/random";
|
||||
export * from "./src/url";
|
||||
export * from "./src/utils";
|
9
packages/common/src/index.ts
Normal file
9
packages/common/src/index.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
export * from "./binary-heap";
|
||||
export * from "./colors";
|
||||
export * from "./constants";
|
||||
export * from "./keys";
|
||||
export * from "./points";
|
||||
export * from "./promise-pool";
|
||||
export * from "./random";
|
||||
export * from "./url";
|
||||
export * from "./utils";
|
|
@ -3,7 +3,6 @@ import { isPointWithinBounds, pointFrom } from "@excalidraw/math";
|
|||
import {
|
||||
doLineSegmentsIntersect,
|
||||
elementsOverlappingBBox,
|
||||
getCommonBounds,
|
||||
} from "@excalidraw/utils";
|
||||
|
||||
import {
|
||||
|
@ -37,7 +36,7 @@ import type {
|
|||
|
||||
import type { ReadonlySetLike } from "@excalidraw/excalidraw/utility-types";
|
||||
|
||||
import { getElementLineSegments } from "./bounds";
|
||||
import { getElementLineSegments, getCommonBounds } from "./bounds";
|
||||
import { mutateElement } from "./mutateElement";
|
||||
import { getBoundTextElement, getContainerElement } from "./textElement";
|
||||
import { isFrameElement, isFrameLikeElement } from "./typeChecks";
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
import { isInvisiblySmallElement } from "./src/sizeHelpers";
|
||||
import { isLinearElementType } from "./src/typeChecks";
|
||||
import { isInvisiblySmallElement } from "./sizeHelpers";
|
||||
import { isLinearElementType } from "./typeChecks";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
NonDeletedExcalidrawElement,
|
||||
NonDeleted,
|
||||
} from "./src/types";
|
||||
} from "./types";
|
||||
|
||||
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";
|
||||
export * from "./bounds";
|
||||
export * from "./dragElements";
|
||||
export * from "./frame";
|
||||
export * from "./mutateElement";
|
||||
export * from "./newElement";
|
||||
export * from "./resizeElements";
|
||||
export * from "./resizeTest";
|
||||
export * from "./shapes";
|
||||
export * from "./showSelectedShapeActions";
|
||||
export * from "./textElement";
|
||||
export * from "./typeChecks";
|
||||
export * from "./transformHandles";
|
||||
export * from "./sizeHelpers";
|
||||
|
||||
/**
|
||||
* @deprecated unsafe, use hashElementsVersion instead
|
|
@ -44,11 +44,6 @@ import type {
|
|||
|
||||
import type { Mutable } from "@excalidraw/excalidraw/utility-types";
|
||||
|
||||
import {
|
||||
getElementAbsoluteCoords,
|
||||
getLockedLinearCursorAlignSize,
|
||||
} from "../index";
|
||||
|
||||
import {
|
||||
bindOrUnbindLinearElement,
|
||||
getHoveredElementForBinding,
|
||||
|
@ -64,6 +59,8 @@ import {
|
|||
isFixedPointBinding,
|
||||
} from "./typeChecks";
|
||||
|
||||
import { getElementAbsoluteCoords, getLockedLinearCursorAlignSize } from "./";
|
||||
|
||||
import type { Bounds } from "./bounds";
|
||||
import type {
|
||||
NonDeleted,
|
||||
|
|
|
@ -27,14 +27,14 @@ import type {
|
|||
Mutable,
|
||||
} from "@excalidraw/excalidraw/utility-types";
|
||||
|
||||
import { getElementAbsoluteCoords } from "../index";
|
||||
|
||||
import { getResizedElementAbsoluteCoords } from "./bounds";
|
||||
import { bumpVersion, newElementWith } from "./mutateElement";
|
||||
import { getBoundTextMaxWidth } from "./textElement";
|
||||
import { normalizeText, measureText } from "./textMeasurements";
|
||||
import { wrapText } from "./textWrapping";
|
||||
|
||||
import { getElementAbsoluteCoords } from ".";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawImageElement,
|
||||
|
|
|
@ -27,13 +27,13 @@ import {
|
|||
|
||||
import type { NormalizedZoomValue, Zoom } from "@excalidraw/excalidraw/types";
|
||||
|
||||
import { getElementAbsoluteCoords } from "../index";
|
||||
|
||||
import { shouldTestInside } from "./collision";
|
||||
import { LinearElementEditor } from "./linearElementEditor";
|
||||
import { getBoundTextElement } from "./textElement";
|
||||
import { ShapeCache } from "./scene/ShapeCache";
|
||||
|
||||
import { getElementAbsoluteCoords } from "./";
|
||||
|
||||
import type { Bounds } from "./bounds";
|
||||
import type {
|
||||
ElementsMap,
|
||||
|
|
|
@ -13,8 +13,6 @@ import type { AppState } from "@excalidraw/excalidraw/types";
|
|||
|
||||
import type { ExtractSetType } from "@excalidraw/excalidraw/utility-types";
|
||||
|
||||
import { isTextElement } from "../index";
|
||||
|
||||
import {
|
||||
resetOriginalContainerCache,
|
||||
updateOriginalContainerCache,
|
||||
|
@ -25,6 +23,8 @@ import { measureText } from "./textMeasurements";
|
|||
import { wrapText } from "./textWrapping";
|
||||
import { isBoundToContainer, isArrowElement } from "./typeChecks";
|
||||
|
||||
import { isTextElement } from "./";
|
||||
|
||||
import type { MaybeTransformHandleType } from "./transformHandles";
|
||||
import type {
|
||||
ElementsMap,
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
import { isImageElement } from "@excalidraw/element/typeChecks";
|
||||
|
||||
import type { ExcalidrawImageElement } from "@excalidraw/element/types";
|
||||
|
||||
import { ToolButton } from "../components/ToolButton";
|
||||
import { cropIcon } from "../components/icons";
|
||||
import { isImageElement } from "../element/typeChecks";
|
||||
import { t } from "../i18n";
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
|
||||
import { register } from "./register";
|
||||
|
||||
import type { ExcalidrawImageElement } from "../element/types";
|
||||
|
||||
export const actionToggleCropEditor = register({
|
||||
name: "cropEditor",
|
||||
label: "helpDialog.cropStart",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import clsx from "clsx";
|
||||
import React from "react";
|
||||
|
||||
import { composeEventHandlers } from "../utils";
|
||||
import { composeEventHandlers } from "@excalidraw/common";
|
||||
|
||||
import "./Button.scss";
|
||||
|
||||
|
|
|
@ -2,15 +2,18 @@ import React, { useEffect, useState } from "react";
|
|||
|
||||
import { EVENT } from "@excalidraw/common";
|
||||
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import {
|
||||
DEFAULT_ELEMENT_BACKGROUND_COLOR_INDEX,
|
||||
DEFAULT_ELEMENT_STROKE_COLOR_INDEX,
|
||||
} from "../../colors";
|
||||
KEYS,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import type { ColorPaletteCustom } from "@excalidraw/common";
|
||||
|
||||
import { useAtom } from "../../editor-jotai";
|
||||
import { t } from "../../i18n";
|
||||
import { KEYS } from "../../keys";
|
||||
|
||||
import { CustomColorList } from "./CustomColorList";
|
||||
import PickerColorList from "./PickerColorList";
|
||||
|
@ -25,7 +28,6 @@ import {
|
|||
import { colorPickerKeyNavHandler } from "./keyboardNavHandlers";
|
||||
|
||||
import type { ColorPickerType } from "./colorPickerUtils";
|
||||
import type { ColorPaletteCustom } from "../../colors";
|
||||
|
||||
interface PickerProps {
|
||||
color: string;
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import { MAX_CUSTOM_COLORS_USED_IN_CANVAS } from "@excalidraw/common";
|
||||
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import { MAX_CUSTOM_COLORS_USED_IN_CANVAS } from "../../colors";
|
||||
import { atom } from "../../editor-jotai";
|
||||
import type { ColorPickerColor, ColorPaletteCustom } from "@excalidraw/common";
|
||||
|
||||
import type { ColorPickerColor, ColorPaletteCustom } from "../../colors";
|
||||
import { atom } from "../../editor-jotai";
|
||||
|
||||
export const getColorNameAndShadeFromColor = ({
|
||||
palette,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import clsx from "clsx";
|
||||
|
||||
import { KEYS } from "../keys";
|
||||
import { KEYS } from "@excalidraw/common";
|
||||
|
||||
import { ToolButton } from "./ToolButton";
|
||||
import { handIcon } from "./icons";
|
||||
|
|
|
@ -6,6 +6,7 @@ import {
|
|||
EXPORT_IMAGE_TYPES,
|
||||
isFirefox,
|
||||
EXPORT_SCALES,
|
||||
cloneJSON,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
@ -25,7 +26,6 @@ import { useCopyStatus } from "../hooks/useCopiedIndicator";
|
|||
|
||||
import { t } from "../i18n";
|
||||
import { isSomeElementSelected } from "../scene";
|
||||
import { cloneJSON } from "../utils";
|
||||
|
||||
import { copyIcon, downloadIcon, helpIcon } from "./icons";
|
||||
import { Dialog } from "./Dialog";
|
||||
|
|
|
@ -6,14 +6,14 @@ import React, {
|
|||
useState,
|
||||
} from "react";
|
||||
|
||||
import { MIME_TYPES } from "@excalidraw/common";
|
||||
import { MIME_TYPES, arrayToMap } from "@excalidraw/common";
|
||||
|
||||
import { duplicateElements } from "@excalidraw/element/newElement";
|
||||
|
||||
import { serializeLibraryAsJSON } from "../data/json";
|
||||
import { duplicateElements } from "../element/newElement";
|
||||
import { useLibraryCache } from "../hooks/useLibraryItemSvg";
|
||||
import { useScrollPosition } from "../hooks/useScrollPosition";
|
||||
import { t } from "../i18n";
|
||||
import { arrayToMap } from "../utils";
|
||||
|
||||
import { LibraryMenuControlButtons } from "./LibraryMenuControlButtons";
|
||||
import { LibraryDropdownMenu } from "./LibraryMenuHeaderContent";
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import clsx from "clsx";
|
||||
import React, { useEffect, useRef } from "react";
|
||||
|
||||
import { EVENT } from "@excalidraw/common";
|
||||
import { EVENT, KEYS } from "@excalidraw/common";
|
||||
|
||||
import { useOutsideClick } from "../../hooks/useOutsideClick";
|
||||
import { useStable } from "../../hooks/useStable";
|
||||
import { KEYS } from "../../keys";
|
||||
import { useDevice } from "../App";
|
||||
import { Island } from "../Island";
|
||||
import Stack from "../Stack";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { KEYS } from "../keys";
|
||||
import { KEYS } from "@excalidraw/common";
|
||||
|
||||
import {
|
||||
SelectionIcon,
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import { exportToSvg } from "@excalidraw/utils/export";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import { COLOR_PALETTE } from "../colors";
|
||||
import { COLOR_PALETTE } from "@excalidraw/common";
|
||||
|
||||
import { atom, useAtom } from "../editor-jotai";
|
||||
|
||||
import type { LibraryItem } from "../types";
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
export * from "./src/angle";
|
||||
export * from "./src/curve";
|
||||
export * from "./src/line";
|
||||
export * from "./src/point";
|
||||
export * from "./src/polygon";
|
||||
export * from "./src/range";
|
||||
export * from "./src/rectangle";
|
||||
export * from "./src/segment";
|
||||
export * from "./src/triangle";
|
||||
export * from "./src/types";
|
||||
export * from "./src/vector";
|
||||
export * from "./src/utils";
|
12
packages/math/src/index.ts
Normal file
12
packages/math/src/index.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
export * from "./angle";
|
||||
export * from "./curve";
|
||||
export * from "./line";
|
||||
export * from "./point";
|
||||
export * from "./polygon";
|
||||
export * from "./range";
|
||||
export * from "./rectangle";
|
||||
export * from "./segment";
|
||||
export * from "./triangle";
|
||||
export * from "./types";
|
||||
export * from "./vector";
|
||||
export * from "./utils";
|
|
@ -11,13 +11,13 @@
|
|||
"jsx": "react-jsx",
|
||||
"emitDeclarationOnly": true,
|
||||
"paths": {
|
||||
"@excalidraw/common": ["./common/index.ts"],
|
||||
"@excalidraw/common": ["./common/src/index.ts"],
|
||||
"@excalidraw/common/*": ["./common/src/*"],
|
||||
"@excalidraw/element": ["./element/index.ts"],
|
||||
"@excalidraw/element": ["./element/src/index.ts"],
|
||||
"@excalidraw/element/*": ["./element/src/*"],
|
||||
"@excalidraw/excalidraw": ["./excalidraw/index.tsx"],
|
||||
"@excalidraw/excalidraw/*": ["./excalidraw/*"],
|
||||
"@excalidraw/math": ["./math/index.ts"],
|
||||
"@excalidraw/math": ["./math/src/index.ts"],
|
||||
"@excalidraw/math/*": ["./math/src/*"],
|
||||
"@excalidraw/utils": ["./utils/index.ts"],
|
||||
"@excalidraw/utils/*": ["./utils/*"]
|
||||
|
|
|
@ -4,7 +4,7 @@ import {
|
|||
copyTextToSystemClipboard,
|
||||
copyToClipboard,
|
||||
} from "@excalidraw/excalidraw/clipboard";
|
||||
import { MIME_TYPES } from "@excalidraw/excalidraw/constants";
|
||||
import { MIME_TYPES } from "@excalidraw/common";
|
||||
import { encodePngMetadata } from "@excalidraw/excalidraw/data/image";
|
||||
import { serializeAsJSON } from "@excalidraw/excalidraw/data/json";
|
||||
import { restore } from "@excalidraw/excalidraw/data/restore";
|
||||
|
@ -17,7 +17,7 @@ import type {
|
|||
ExcalidrawElement,
|
||||
ExcalidrawFrameLikeElement,
|
||||
NonDeleted,
|
||||
} from "@excalidraw/excalidraw/element/types";
|
||||
} from "@excalidraw/element/types";
|
||||
import type { AppState, BinaryFiles } from "@excalidraw/excalidraw/types";
|
||||
|
||||
export { MIME_TYPES };
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
* to pure shapes
|
||||
*/
|
||||
|
||||
import { getElementAbsoluteCoords } from "@excalidraw/excalidraw/element";
|
||||
import { invariant } from "@excalidraw/excalidraw/utils";
|
||||
import { getElementAbsoluteCoords } from "@excalidraw/element";
|
||||
import { invariant } from "@excalidraw/common";
|
||||
import {
|
||||
curve,
|
||||
lineSegment,
|
||||
|
@ -50,7 +50,7 @@ import type {
|
|||
ExcalidrawRectangleElement,
|
||||
ExcalidrawSelectionElement,
|
||||
ExcalidrawTextElement,
|
||||
} from "@excalidraw/excalidraw/element/types";
|
||||
} from "@excalidraw/element/types";
|
||||
import type { Curve, LineSegment, Polygon, Radians } from "@excalidraw/math";
|
||||
|
||||
import type { Drawable, Op } from "roughjs/bin/core";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export * from "./export";
|
||||
export * from "./withinBounds";
|
||||
export * from "./bbox";
|
||||
export { getCommonBounds } from "@excalidraw/excalidraw/element/bounds";
|
||||
export { getCommonBounds } from "@excalidraw/element/bounds";
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { getElementBounds } from "@excalidraw/excalidraw/element/bounds";
|
||||
import { arrayToMap } from "@excalidraw/common";
|
||||
import { getElementBounds } from "@excalidraw/element/bounds";
|
||||
import {
|
||||
isArrowElement,
|
||||
isExcalidrawElement,
|
||||
isFreeDrawElement,
|
||||
isLinearElement,
|
||||
isTextElement,
|
||||
} from "@excalidraw/excalidraw/element/typeChecks";
|
||||
import { arrayToMap } from "@excalidraw/excalidraw/utils";
|
||||
} from "@excalidraw/element/typeChecks";
|
||||
import {
|
||||
rangeIncludesValue,
|
||||
pointFrom,
|
||||
|
@ -14,13 +14,13 @@ import {
|
|||
rangeInclusive,
|
||||
} from "@excalidraw/math";
|
||||
|
||||
import type { Bounds } from "@excalidraw/excalidraw/element/bounds";
|
||||
import type { Bounds } from "@excalidraw/element/bounds";
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawFreeDrawElement,
|
||||
ExcalidrawLinearElement,
|
||||
NonDeletedExcalidrawElement,
|
||||
} from "@excalidraw/excalidraw/element/types";
|
||||
} from "@excalidraw/element/types";
|
||||
import type { LocalPoint } from "@excalidraw/math";
|
||||
|
||||
type Element = NonDeletedExcalidrawElement;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue