mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Fix es & ts build
This commit is contained in:
parent
931d03d514
commit
fc225c5353
18 changed files with 73 additions and 54 deletions
|
@ -13,6 +13,8 @@ import {
|
|||
isLinearElement,
|
||||
} from "@excalidraw/element/typeChecks";
|
||||
|
||||
import type { Mutable } from "@excalidraw/excalidraw/utility-types";
|
||||
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
NonDeletedExcalidrawElement,
|
||||
|
@ -512,7 +514,10 @@ export const _generateElementShape = (
|
|||
|
||||
if (isPathALoop(element.points)) {
|
||||
// generate rough polygon to fill freedraw shape
|
||||
const simplifiedPoints = simplify(element.points, 0.75);
|
||||
const simplifiedPoints = simplify(
|
||||
element.points as Mutable<LocalPoint[]>,
|
||||
0.75,
|
||||
);
|
||||
shape = generator.curve(simplifiedPoints as [number, number][], {
|
||||
...generateRoughOptions(element),
|
||||
stroke: "none",
|
||||
|
|
|
@ -13,6 +13,7 @@ import {
|
|||
|
||||
import { getCurvePathOps } from "@excalidraw/utils/geometry/shape";
|
||||
import { generateRoughOptions } from "@excalidraw/element/Shape";
|
||||
import { ShapeCache } from "@excalidraw/element/ShapeCache";
|
||||
|
||||
import type {
|
||||
Degrees,
|
||||
|
|
|
@ -5,6 +5,8 @@ import {
|
|||
import { KEYS, invariant, toBrandedType } from "@excalidraw/common";
|
||||
import { aabbForElement } from "@excalidraw/element";
|
||||
|
||||
import { pointFrom, type LocalPoint } from "@excalidraw/math";
|
||||
|
||||
import type {
|
||||
AppState,
|
||||
PendingExcalidrawElements,
|
||||
|
|
|
@ -5,12 +5,13 @@ import {
|
|||
toBrandedType,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
// TODO_SEP: should be passed in or injected instead
|
||||
import Scene from "@excalidraw/excalidraw/scene/Scene";
|
||||
|
||||
import type { Radians } from "@excalidraw/math";
|
||||
|
||||
import type { Mutable } from "@excalidraw/excalidraw/utility-types";
|
||||
|
||||
import Scene from "../scene/Scene";
|
||||
|
||||
import { ShapeCache } from "./ShapeCache";
|
||||
|
||||
import { updateElbowArrowPoints } from "./elbowArrow";
|
||||
|
|
|
@ -38,7 +38,7 @@ import {
|
|||
import { getContainingFrame } from "@excalidraw/element/frame";
|
||||
import { getCornerRadius } from "@excalidraw/element/shapes";
|
||||
|
||||
// TODO: consider separating
|
||||
// TODO_SEP: consider separating
|
||||
import { getVerticalOffset } from "@excalidraw/excalidraw/fonts/FontMetadata";
|
||||
|
||||
import type {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import clsx from "clsx";
|
||||
import { useEffect, useRef } from "react";
|
||||
|
||||
import type { ColorPaletteCustom } from "@excalidraw/common";
|
||||
|
||||
import { useAtom } from "../../editor-jotai";
|
||||
import { t } from "../../i18n";
|
||||
|
||||
|
@ -11,7 +13,6 @@ import {
|
|||
getColorNameAndShadeFromColor,
|
||||
} from "./colorPickerUtils";
|
||||
|
||||
import type { ColorPaletteCustom } from "../../colors";
|
||||
import type { TranslationKeys } from "../../i18n";
|
||||
|
||||
interface PickerColorListProps {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import clsx from "clsx";
|
||||
import { useEffect, useRef } from "react";
|
||||
|
||||
import type { ColorPaletteCustom } from "@excalidraw/common";
|
||||
|
||||
import { useAtom } from "../../editor-jotai";
|
||||
import { t } from "../../i18n";
|
||||
|
||||
|
@ -10,8 +12,6 @@ import {
|
|||
getColorNameAndShadeFromColor,
|
||||
} from "./colorPickerUtils";
|
||||
|
||||
import type { ColorPaletteCustom } from "../../colors";
|
||||
|
||||
interface ShadeListProps {
|
||||
hex: string;
|
||||
onChange: (color: string) => void;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { isInGroup } from "@excalidraw/common";
|
||||
|
||||
import { isTextElement, redrawTextBoundingBox } from "@excalidraw/element";
|
||||
import { mutateElement } from "@excalidraw/element/mutateElement";
|
||||
import { getBoundTextElement } from "@excalidraw/element/textElement";
|
||||
|
@ -9,7 +11,6 @@ import type {
|
|||
NonDeletedSceneElementsMap,
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { isInGroup } from "../../groups";
|
||||
import { fontSizeIcon } from "../icons";
|
||||
|
||||
import StatsDragInput from "./DragInput";
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { isInGroup } from "@excalidraw/common";
|
||||
import { pointFrom, pointRotateRads } from "@excalidraw/math";
|
||||
|
||||
import {
|
||||
|
@ -21,11 +22,7 @@ import type {
|
|||
NonDeletedSceneElementsMap,
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import {
|
||||
getSelectedGroupIds,
|
||||
getElementsInGroup,
|
||||
isInGroup,
|
||||
} from "../../groups";
|
||||
import { getSelectedGroupIds, getElementsInGroup } from "../../groups";
|
||||
|
||||
import type Scene from "../../scene/Scene";
|
||||
import type { AppState } from "../../types";
|
||||
|
|
|
@ -8,7 +8,7 @@ import {
|
|||
useState,
|
||||
} from "react";
|
||||
|
||||
import { EVENT, HYPERLINK_TOOLTIP_DELAY } from "@excalidraw/common";
|
||||
import { EVENT, HYPERLINK_TOOLTIP_DELAY, KEYS } from "@excalidraw/common";
|
||||
|
||||
import { getElementAbsoluteCoords } from "@excalidraw/element/bounds";
|
||||
|
||||
|
|
1
packages/excalidraw/global.d.ts
vendored
1
packages/excalidraw/global.d.ts
vendored
|
@ -4,6 +4,7 @@ interface Window {
|
|||
EXCALIDRAW_ASSET_PATH: string | string[] | undefined;
|
||||
EXCALIDRAW_THROTTLE_RENDER: boolean | undefined;
|
||||
DEBUG_FRACTIONAL_INDICES: boolean | undefined;
|
||||
EXCALIDRAW_EXPORT_SOURCE: string;
|
||||
gtag: Function;
|
||||
sa_event: Function;
|
||||
fathom: { trackEvent: Function };
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { VERSIONS } from "../../constants";
|
||||
import { VERSIONS } from "@excalidraw/common";
|
||||
|
||||
import {
|
||||
diamondFixture,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { DEFAULT_FONT_FAMILY } from "@excalidraw/common";
|
||||
|
||||
import type { Radians } from "@excalidraw/math";
|
||||
|
||||
import { DEFAULT_FONT_FAMILY } from "../../constants";
|
||||
|
||||
import type { ExcalidrawElement } from "../../element/types";
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
const elementBase: Omit<ExcalidrawElement, "type"> = {
|
||||
id: "vWrqOAfkind2qcm7LDAGZ",
|
||||
|
|
|
@ -4,12 +4,10 @@ import util from "util";
|
|||
|
||||
import { pointFrom, type LocalPoint, type Radians } from "@excalidraw/math";
|
||||
|
||||
import { getDefaultAppState } from "../../appState";
|
||||
import { createTestHook } from "../../components/App";
|
||||
import { DEFAULT_VERTICAL_ALIGN, ROUNDNESS } from "../../constants";
|
||||
import { getMimeType } from "../../data/blob";
|
||||
import { newElement, newTextElement, newLinearElement } from "../../element";
|
||||
import { mutateElement } from "../../element/mutateElement";
|
||||
import { DEFAULT_VERTICAL_ALIGN, ROUNDNESS } from "@excalidraw/common";
|
||||
|
||||
import { newElement, newTextElement, newLinearElement } from "@excalidraw/element";
|
||||
import { mutateElement } from "@excalidraw/element/mutateElement";
|
||||
import {
|
||||
newArrowElement,
|
||||
newEmbeddableElement,
|
||||
|
@ -18,15 +16,12 @@ import {
|
|||
newIframeElement,
|
||||
newImageElement,
|
||||
newMagicFrameElement,
|
||||
} from "../../element/newElement";
|
||||
import { isLinearElementType } from "../../element/typeChecks";
|
||||
import { selectGroupsForSelectedElements } from "../../groups";
|
||||
import { getSelectedElements } from "../../scene/selection";
|
||||
import { assertNever } from "../../utils";
|
||||
import { GlobalTestState, createEvent, fireEvent, act } from "../test-utils";
|
||||
} from "@excalidraw/element/newElement";
|
||||
import { isLinearElementType } from "@excalidraw/element/typeChecks";
|
||||
|
||||
import { getSelectedElements } from "@excalidraw/excalidraw/scene/selection";
|
||||
import { assertNever } from "@excalidraw/common";
|
||||
|
||||
import type { Action } from "../../actions/types";
|
||||
import type App from "../../components/App";
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawGenericElement,
|
||||
|
@ -41,7 +36,16 @@ import type {
|
|||
ExcalidrawElbowArrowElement,
|
||||
ExcalidrawArrowElement,
|
||||
FixedSegment,
|
||||
} from "../../element/types";
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { selectGroupsForSelectedElements } from "../../groups";
|
||||
import { getMimeType } from "../../data/blob";
|
||||
import { createTestHook } from "../../components/App";
|
||||
import { getDefaultAppState } from "../../appState";
|
||||
import { GlobalTestState, createEvent, fireEvent, act } from "../test-utils";
|
||||
|
||||
import type { Action } from "../../actions/types";
|
||||
import type App from "../../components/App";
|
||||
import type { AppState } from "../../types";
|
||||
import type { Mutable } from "../../utility-types";
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { pointFrom, pointRotateRads } from "@excalidraw/math";
|
||||
|
||||
import type { GlobalPoint, LocalPoint, Radians } from "@excalidraw/math";
|
||||
|
||||
import { createTestHook } from "../../components/App";
|
||||
import { getCommonBounds, getElementPointsCoords } from "../../element/bounds";
|
||||
import { cropElement } from "../../element/cropElement";
|
||||
import { mutateElement } from "../../element/mutateElement";
|
||||
import {
|
||||
getCommonBounds,
|
||||
getElementPointsCoords,
|
||||
} from "@excalidraw/element/bounds";
|
||||
import { cropElement } from "@excalidraw/element/cropElement";
|
||||
import { mutateElement } from "@excalidraw/element/mutateElement";
|
||||
import {
|
||||
getTransformHandles,
|
||||
getTransformHandlesFromCoords,
|
||||
|
@ -13,21 +13,18 @@ import {
|
|||
OMIT_SIDES_FOR_MULTIPLE_ELEMENTS,
|
||||
type TransformHandle,
|
||||
type TransformHandleDirection,
|
||||
} from "../../element/transformHandles";
|
||||
} from "@excalidraw/element/transformHandles";
|
||||
import {
|
||||
isLinearElement,
|
||||
isFreeDrawElement,
|
||||
isTextElement,
|
||||
isFrameLikeElement,
|
||||
} from "../../element/typeChecks";
|
||||
import { KEYS } from "../../keys";
|
||||
import { arrayToMap } from "../../utils";
|
||||
import { getTextEditor } from "../queries/dom";
|
||||
import { act, fireEvent, GlobalTestState, screen } from "../test-utils";
|
||||
} from "@excalidraw/element/typeChecks";
|
||||
import { KEYS, arrayToMap } from "@excalidraw/common";
|
||||
|
||||
import { API } from "./api";
|
||||
import type { GlobalPoint, LocalPoint, Radians } from "@excalidraw/math";
|
||||
|
||||
import type { TransformHandleType } from "../../element/transformHandles";
|
||||
import type { TransformHandleType } from "@excalidraw/element/transformHandles";
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
ExcalidrawLinearElement,
|
||||
|
@ -39,7 +36,14 @@ import type {
|
|||
ExcalidrawTextContainer,
|
||||
ExcalidrawTextElementWithContainer,
|
||||
ExcalidrawImageElement,
|
||||
} from "../../element/types";
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { createTestHook } from "../../components/App";
|
||||
import { getTextEditor } from "../queries/dom";
|
||||
import { act, fireEvent, GlobalTestState, screen } from "../test-utils";
|
||||
|
||||
import { API } from "./api";
|
||||
|
||||
import type { ToolType } from "../../types";
|
||||
|
||||
// so that window.h is available when App.tsx is not imported as well.
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { queries, buildQueries } from "@testing-library/react";
|
||||
|
||||
import { TOOL_TYPE } from "../../constants";
|
||||
import { TOOL_TYPE } from "@excalidraw/common";
|
||||
|
||||
import type { ToolType } from "../../types";
|
||||
import type { ToolType } from "@excalidraw/excalidraw/types";
|
||||
|
||||
const _getAllByToolName = (container: HTMLElement, tool: ToolType | "lock") => {
|
||||
const toolTitle = tool === "lock" ? "lock" : TOOL_TYPE[tool];
|
||||
|
|
|
@ -9,10 +9,12 @@ import {
|
|||
} from "@testing-library/react";
|
||||
import ansi from "ansicolor";
|
||||
|
||||
import { ORIG_ID, arrayToMap } from "@excalidraw/common";
|
||||
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import { STORAGE_KEYS } from "../../../excalidraw-app/app_constants";
|
||||
import { ORIG_ID } from "../constants";
|
||||
import { getSelectedElements } from "../scene/selection";
|
||||
import { arrayToMap } from "../utils";
|
||||
|
||||
import { UI } from "./helpers/ui";
|
||||
import * as toolQueries from "./queries/toolQueries";
|
||||
|
@ -20,7 +22,7 @@ import * as toolQueries from "./queries/toolQueries";
|
|||
import type { RenderResult, RenderOptions } from "@testing-library/react";
|
||||
|
||||
import type { ImportedDataState } from "../data/types";
|
||||
import type { ExcalidrawElement } from "../element/types";
|
||||
|
||||
import type { AllPossibleKeys } from "../utility-types";
|
||||
|
||||
export { cleanup as unmountComponent };
|
||||
|
|
|
@ -5,7 +5,7 @@ import {
|
|||
type LocalPoint,
|
||||
} from "@excalidraw/math";
|
||||
|
||||
import type { Bounds } from "@excalidraw/excalidraw/element/bounds";
|
||||
import type { Bounds } from "@excalidraw/element/bounds";
|
||||
|
||||
export type LineSegment<P extends LocalPoint | GlobalPoint> = [P, P];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue