mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Move data folder into src
This commit is contained in:
parent
6315848013
commit
ce8542c6f9
53 changed files with 130 additions and 124 deletions
|
@ -33,7 +33,7 @@ import {
|
|||
} from "@excalidraw/common";
|
||||
import polyfill from "@excalidraw/excalidraw/polyfill";
|
||||
import { useCallback, useEffect, useRef, useState } from "react";
|
||||
import { loadFromBlob } from "@excalidraw/excalidraw/data/blob";
|
||||
import { loadFromBlob } from "@excalidraw/excalidraw/src/data/blob";
|
||||
import { useCallbackRefState } from "@excalidraw/excalidraw/src/hooks/useCallbackRefState";
|
||||
import { t } from "@excalidraw/excalidraw/i18n";
|
||||
|
||||
|
@ -48,17 +48,20 @@ import {
|
|||
youtubeIcon,
|
||||
} from "@excalidraw/excalidraw/components/icons";
|
||||
import { isElementLink } from "@excalidraw/element/elementLink";
|
||||
import { restore, restoreAppState } from "@excalidraw/excalidraw/data/restore";
|
||||
import {
|
||||
restore,
|
||||
restoreAppState,
|
||||
} from "@excalidraw/excalidraw/src/data/restore";
|
||||
import { newElementWith } from "@excalidraw/element/mutateElement";
|
||||
import { isInitializedImageElement } from "@excalidraw/element/typeChecks";
|
||||
import clsx from "clsx";
|
||||
import {
|
||||
parseLibraryTokensFromUrl,
|
||||
useHandleLibrary,
|
||||
} from "@excalidraw/excalidraw/data/library";
|
||||
} from "@excalidraw/excalidraw/src/data/library";
|
||||
|
||||
import type { RemoteExcalidrawElement } from "@excalidraw/excalidraw/data/reconcile";
|
||||
import type { RestoredDataState } from "@excalidraw/excalidraw/data/restore";
|
||||
import type { RemoteExcalidrawElement } from "@excalidraw/excalidraw/src/data/reconcile";
|
||||
import type { RestoredDataState } from "@excalidraw/excalidraw/src/data/restore";
|
||||
import type {
|
||||
FileId,
|
||||
NonDeletedExcalidrawElement,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { base64urlToString } from "@excalidraw/excalidraw/data/encode";
|
||||
import { base64urlToString } from "@excalidraw/excalidraw/src/data/encode";
|
||||
import { ExcalidrawError } from "@excalidraw/excalidraw/errors";
|
||||
import { useLayoutEffect, useRef } from "react";
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import {
|
|||
resolvablePromise,
|
||||
throttleRAF,
|
||||
} from "@excalidraw/common";
|
||||
import { decryptData } from "@excalidraw/excalidraw/data/encryption";
|
||||
import { decryptData } from "@excalidraw/excalidraw/src/data/encryption";
|
||||
import { getVisibleSceneBounds } from "@excalidraw/element/bounds";
|
||||
import { newElementWith } from "@excalidraw/element/mutateElement";
|
||||
import {
|
||||
|
@ -35,8 +35,8 @@ import { PureComponent } from "react";
|
|||
import type {
|
||||
ReconciledExcalidrawElement,
|
||||
RemoteExcalidrawElement,
|
||||
} from "@excalidraw/excalidraw/data/reconcile";
|
||||
import type { ImportedDataState } from "@excalidraw/excalidraw/data/types";
|
||||
} from "@excalidraw/excalidraw/src/data/reconcile";
|
||||
import type { ImportedDataState } from "@excalidraw/excalidraw/src/data/types";
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
FileId,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { CaptureUpdateAction } from "@excalidraw/excalidraw";
|
||||
import { trackEvent } from "@excalidraw/excalidraw/analytics";
|
||||
import { encryptData } from "@excalidraw/excalidraw/data/encryption";
|
||||
import { encryptData } from "@excalidraw/excalidraw/src/data/encryption";
|
||||
import { newElementWith } from "@excalidraw/element/mutateElement";
|
||||
import throttle from "lodash.throttle";
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import {
|
|||
MIME_TYPES,
|
||||
TTDDialog,
|
||||
} from "@excalidraw/excalidraw";
|
||||
import { getDataURL } from "@excalidraw/excalidraw/data/blob";
|
||||
import { getDataURL } from "@excalidraw/excalidraw/src/data/blob";
|
||||
import { safelyParseJSON } from "@excalidraw/common";
|
||||
|
||||
import type { ExcalidrawImperativeAPI } from "@excalidraw/excalidraw/types";
|
||||
|
|
|
@ -10,8 +10,8 @@ import { MIME_TYPES, getFrame } from "@excalidraw/common";
|
|||
import {
|
||||
encryptData,
|
||||
generateEncryptionKey,
|
||||
} from "@excalidraw/excalidraw/data/encryption";
|
||||
import { serializeAsJSON } from "@excalidraw/excalidraw/data/json";
|
||||
} from "@excalidraw/excalidraw/src/data/encryption";
|
||||
import { serializeAsJSON } from "@excalidraw/excalidraw/src/data/json";
|
||||
import { isInitializedImageElement } from "@excalidraw/element/typeChecks";
|
||||
import { useI18n } from "@excalidraw/excalidraw/i18n";
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { CaptureUpdateAction } from "@excalidraw/excalidraw";
|
||||
import { compressData } from "@excalidraw/excalidraw/data/encode";
|
||||
import { compressData } from "@excalidraw/excalidraw/src/data/encode";
|
||||
import { newElementWith } from "@excalidraw/element/mutateElement";
|
||||
import { isInitializedImageElement } from "@excalidraw/element/typeChecks";
|
||||
import { t } from "@excalidraw/excalidraw/i18n";
|
||||
|
|
|
@ -27,8 +27,8 @@ import {
|
|||
get,
|
||||
} from "idb-keyval";
|
||||
|
||||
import type { LibraryPersistedData } from "@excalidraw/excalidraw/data/library";
|
||||
import type { ImportedDataState } from "@excalidraw/excalidraw/data/types";
|
||||
import type { LibraryPersistedData } from "@excalidraw/excalidraw/src/data/library";
|
||||
import type { ImportedDataState } from "@excalidraw/excalidraw/src/data/types";
|
||||
import type { ExcalidrawElement, FileId } from "@excalidraw/element/types";
|
||||
import type {
|
||||
AppState,
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { reconcileElements } from "@excalidraw/excalidraw";
|
||||
import { MIME_TYPES } from "@excalidraw/common";
|
||||
import { decompressData } from "@excalidraw/excalidraw/data/encode";
|
||||
import { decompressData } from "@excalidraw/excalidraw/src/data/encode";
|
||||
import {
|
||||
encryptData,
|
||||
decryptData,
|
||||
} from "@excalidraw/excalidraw/data/encryption";
|
||||
import { restoreElements } from "@excalidraw/excalidraw/data/restore";
|
||||
} from "@excalidraw/excalidraw/src/data/encryption";
|
||||
import { restoreElements } from "@excalidraw/excalidraw/src/data/restore";
|
||||
import { getSceneVersion } from "@excalidraw/element";
|
||||
import { initializeApp } from "firebase/app";
|
||||
import {
|
||||
|
@ -17,7 +17,7 @@ import {
|
|||
} from "firebase/firestore";
|
||||
import { getStorage, ref, uploadBytes } from "firebase/storage";
|
||||
|
||||
import type { RemoteExcalidrawElement } from "@excalidraw/excalidraw/data/reconcile";
|
||||
import type { RemoteExcalidrawElement } from "@excalidraw/excalidraw/src/data/reconcile";
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
FileId,
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
import {
|
||||
compressData,
|
||||
decompressData,
|
||||
} from "@excalidraw/excalidraw/data/encode";
|
||||
} from "@excalidraw/excalidraw/src/data/encode";
|
||||
import {
|
||||
decryptData,
|
||||
generateEncryptionKey,
|
||||
IV_LENGTH_BYTES,
|
||||
} from "@excalidraw/excalidraw/data/encryption";
|
||||
import { serializeAsJSON } from "@excalidraw/excalidraw/data/json";
|
||||
import { restore } from "@excalidraw/excalidraw/data/restore";
|
||||
} from "@excalidraw/excalidraw/src/data/encryption";
|
||||
import { serializeAsJSON } from "@excalidraw/excalidraw/src/data/json";
|
||||
import { restore } from "@excalidraw/excalidraw/src/data/restore";
|
||||
import { isInvisiblySmallElement } from "@excalidraw/element/sizeHelpers";
|
||||
import { isInitializedImageElement } from "@excalidraw/element/typeChecks";
|
||||
import { t } from "@excalidraw/excalidraw/i18n";
|
||||
import { bytesToHexString } from "@excalidraw/common";
|
||||
|
||||
import type { UserIdleState } from "@excalidraw/common";
|
||||
import type { ImportedDataState } from "@excalidraw/excalidraw/data/types";
|
||||
import type { ImportedDataState } from "@excalidraw/excalidraw/src/data/types";
|
||||
import type { SceneBounds } from "@excalidraw/element/bounds";
|
||||
import type {
|
||||
ExcalidrawElement,
|
||||
|
|
|
@ -12,7 +12,7 @@ import {
|
|||
readSystemClipboard,
|
||||
} from "../clipboard";
|
||||
import { DuplicateIcon, cutIcon, pngIcon, svgIcon } from "../components/icons";
|
||||
import { exportCanvas, prepareElementsForExport } from "../data/index";
|
||||
import { exportCanvas, prepareElementsForExport } from "../src/data/index";
|
||||
import { t } from "../i18n";
|
||||
|
||||
import { CaptureUpdateAction } from "../store";
|
||||
|
|
|
@ -16,10 +16,10 @@ import { ProjectName } from "../components/ProjectName";
|
|||
import { ToolButton } from "../components/ToolButton";
|
||||
import { Tooltip } from "../components/Tooltip";
|
||||
import { ExportIcon, questionCircle, saveAs } from "../components/icons";
|
||||
import { loadFromJSON, saveAsJSON } from "../data";
|
||||
import { isImageFileHandle } from "../data/blob";
|
||||
import { nativeFileSystemSupported } from "../data/filesystem";
|
||||
import { resaveAsImageWithScene } from "../data/resave";
|
||||
import { loadFromJSON, saveAsJSON } from "../src/data";
|
||||
import { isImageFileHandle } from "../src/data/blob";
|
||||
import { nativeFileSystemSupported } from "../src/data/filesystem";
|
||||
import { resaveAsImageWithScene } from "../src/data/resave";
|
||||
|
||||
import { t } from "../i18n";
|
||||
import { getSelectedElements, isSomeElementSelected } from "../src/scene";
|
||||
|
|
|
@ -22,7 +22,7 @@ import type {
|
|||
} from "@excalidraw/element/types";
|
||||
|
||||
import { ExcalidrawError } from "./errors";
|
||||
import { createFile, isSupportedImageFileType } from "./data/blob";
|
||||
import { createFile, isSupportedImageFileType } from "./src/data/blob";
|
||||
import { tryParseSpreadsheet, VALID_SPREADSHEET } from "./charts";
|
||||
|
||||
import type { Spreadsheet } from "./charts";
|
||||
|
|
|
@ -387,9 +387,11 @@ import {
|
|||
isHandToolActive,
|
||||
} from "../appState";
|
||||
import { copyTextToSystemClipboard, parseClipboard } from "../clipboard";
|
||||
import { exportCanvas, loadFromBlob } from "../data";
|
||||
import Library, { distributeLibraryItemsOnSquareGrid } from "../data/library";
|
||||
import { restore, restoreElements } from "../data/restore";
|
||||
import { exportCanvas, loadFromBlob } from "../src/data";
|
||||
import Library, {
|
||||
distributeLibraryItemsOnSquareGrid,
|
||||
} from "../src/data/library";
|
||||
import { restore, restoreElements } from "../src/data/restore";
|
||||
import { getCenter, getDistance } from "../gesture";
|
||||
import { History } from "../history";
|
||||
import { defaultLang, getLanguage, languages, setLanguage, t } from "../i18n";
|
||||
|
@ -419,9 +421,9 @@ import {
|
|||
parseLibraryJSON,
|
||||
resizeImageFile,
|
||||
SVGStringToFile,
|
||||
} from "../data/blob";
|
||||
} from "../src/data/blob";
|
||||
|
||||
import { fileOpen } from "../data/filesystem";
|
||||
import { fileOpen } from "../src/data/filesystem";
|
||||
import {
|
||||
showHyperlinkTooltip,
|
||||
hideHyperlinkToolip,
|
||||
|
@ -443,7 +445,7 @@ import {
|
|||
SnapCache,
|
||||
isGridModeEnabled,
|
||||
} from "../snapping";
|
||||
import { convertToExcalidrawElements } from "../data/transform";
|
||||
import { convertToExcalidrawElements } from "../src/data/transform";
|
||||
import { Renderer } from "../src/scene/Renderer";
|
||||
import {
|
||||
setEraserCursor,
|
||||
|
@ -491,10 +493,10 @@ import type {
|
|||
} from "../src/scene/types";
|
||||
|
||||
import type { PastedMixedContent } from "../clipboard";
|
||||
import type { ExportedElements } from "../data";
|
||||
import type { ExportedElements } from "../src/data";
|
||||
import type { ContextMenuItems } from "./ContextMenu";
|
||||
import type { FileSystemHandle } from "../data/filesystem";
|
||||
import type { ExcalidrawElementSkeleton } from "../data/transform";
|
||||
import type { FileSystemHandle } from "../src/data/filesystem";
|
||||
import type { ExcalidrawElementSkeleton } from "../src/data/transform";
|
||||
|
||||
import type {
|
||||
AppClassProperties,
|
||||
|
|
|
@ -19,9 +19,9 @@ import {
|
|||
actionChangeProjectName,
|
||||
} from "../actions/actionExport";
|
||||
import { probablySupportsClipboardBlob } from "../clipboard";
|
||||
import { prepareElementsForExport } from "../data";
|
||||
import { canvasToBlob } from "../data/blob";
|
||||
import { nativeFileSystemSupported } from "../data/filesystem";
|
||||
import { prepareElementsForExport } from "../src/data";
|
||||
import { canvasToBlob } from "../src/data/blob";
|
||||
import { nativeFileSystemSupported } from "../src/data/filesystem";
|
||||
import { useCopyStatus } from "../src/hooks/useCopiedIndicator";
|
||||
|
||||
import { t } from "../i18n";
|
||||
|
|
|
@ -7,7 +7,7 @@ import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
|||
import { actionSaveFileToDisk } from "../actions/actionExport";
|
||||
|
||||
import { trackEvent } from "../analytics";
|
||||
import { nativeFileSystemSupported } from "../data/filesystem";
|
||||
import { nativeFileSystemSupported } from "../src/data/filesystem";
|
||||
import { t } from "../i18n";
|
||||
|
||||
import { Card } from "./Card";
|
||||
|
|
|
@ -23,7 +23,7 @@ import { useUIAppState } from "../src/context/ui-appState";
|
|||
import {
|
||||
distributeLibraryItemsOnSquareGrid,
|
||||
libraryItemsAtom,
|
||||
} from "../data/library";
|
||||
} from "../src/data/library";
|
||||
import { atom, useAtom } from "../editor-jotai";
|
||||
import { t } from "../i18n";
|
||||
|
||||
|
@ -48,7 +48,7 @@ import type {
|
|||
UIAppState,
|
||||
AppClassProperties,
|
||||
} from "../types";
|
||||
import type Library from "../data/library";
|
||||
import type Library from "../src/data/library";
|
||||
|
||||
export const isLibraryMenuOpenAtom = atom(false);
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@ import { useCallback, useState } from "react";
|
|||
import { muteFSAbortError } from "@excalidraw/common";
|
||||
|
||||
import { useUIAppState } from "../src/context/ui-appState";
|
||||
import { fileOpen } from "../data/filesystem";
|
||||
import { saveLibraryAsJSON } from "../data/json";
|
||||
import { libraryItemsAtom } from "../data/library";
|
||||
import { fileOpen } from "../src/data/filesystem";
|
||||
import { saveLibraryAsJSON } from "../src/data/json";
|
||||
import { libraryItemsAtom } from "../src/data/library";
|
||||
import { useAtom } from "../editor-jotai";
|
||||
import { useLibraryCache } from "../src/hooks/useLibraryItemSvg";
|
||||
import { t } from "../i18n";
|
||||
|
@ -27,7 +27,7 @@ import {
|
|||
TrashIcon,
|
||||
} from "./icons";
|
||||
|
||||
import type Library from "../data/library";
|
||||
import type Library from "../src/data/library";
|
||||
import type { LibraryItem, LibraryItems, UIAppState } from "../types";
|
||||
|
||||
const getSelectedItems = (
|
||||
|
|
|
@ -10,7 +10,7 @@ import { MIME_TYPES, arrayToMap } from "@excalidraw/common";
|
|||
|
||||
import { duplicateElements } from "@excalidraw/element/duplicate";
|
||||
|
||||
import { serializeLibraryAsJSON } from "../data/json";
|
||||
import { serializeLibraryAsJSON } from "../src/data/json";
|
||||
import { useLibraryCache } from "../src/hooks/useLibraryItemSvg";
|
||||
import { useScrollPosition } from "../src/hooks/useScrollPosition";
|
||||
import { t } from "../i18n";
|
||||
|
|
|
@ -11,8 +11,8 @@ import {
|
|||
chunk,
|
||||
} from "@excalidraw/common";
|
||||
|
||||
import { EditorLocalStorage } from "../data/EditorLocalStorage";
|
||||
import { canvasToBlob, resizeImageFile } from "../data/blob";
|
||||
import { EditorLocalStorage } from "../src/data/EditorLocalStorage";
|
||||
import { canvasToBlob, resizeImageFile } from "../src/data/blob";
|
||||
import { t } from "../i18n";
|
||||
|
||||
import { Dialog } from "./Dialog";
|
||||
|
@ -24,7 +24,7 @@ import { CloseIcon } from "./icons";
|
|||
import "./PublishLibrary.scss";
|
||||
|
||||
import type { ReactNode } from "react";
|
||||
import type { ExportedLibraryData } from "../data/types";
|
||||
import type { ExportedLibraryData } from "../src/data/types";
|
||||
import type { LibraryItems, LibraryItem, UIAppState } from "../types";
|
||||
|
||||
interface PublishLibraryDataParams {
|
||||
|
|
|
@ -6,7 +6,7 @@ import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
|||
|
||||
import { useApp } from "../App";
|
||||
import { ArrowRightIcon } from "../icons";
|
||||
import { EditorLocalStorage } from "../../data/EditorLocalStorage";
|
||||
import { EditorLocalStorage } from "../../src/data/EditorLocalStorage";
|
||||
import { t } from "../../i18n";
|
||||
import Trans from "../Trans";
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ import type { MermaidToExcalidrawResult } from "@excalidraw/mermaid-to-excalidra
|
|||
|
||||
import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import { EditorLocalStorage } from "../../data/EditorLocalStorage";
|
||||
import { canvasToBlob } from "../../data/blob";
|
||||
import { EditorLocalStorage } from "../../src/data/EditorLocalStorage";
|
||||
import { canvasToBlob } from "../../src/data/blob";
|
||||
import { t } from "../../i18n";
|
||||
import { convertToExcalidrawElements, exportToCanvas } from "../../index";
|
||||
|
||||
|
|
|
@ -227,9 +227,9 @@ export {
|
|||
restoreAppState,
|
||||
restoreElements,
|
||||
restoreLibraryItems,
|
||||
} from "./data/restore";
|
||||
} from "./src/data/restore";
|
||||
|
||||
export { reconcileElements } from "./data/reconcile";
|
||||
export { reconcileElements } from "./src/data/reconcile";
|
||||
|
||||
export {
|
||||
exportToCanvas,
|
||||
|
@ -238,14 +238,14 @@ export {
|
|||
exportToClipboard,
|
||||
} from "@excalidraw/utils/export";
|
||||
|
||||
export { serializeAsJSON, serializeLibraryAsJSON } from "./data/json";
|
||||
export { serializeAsJSON, serializeLibraryAsJSON } from "./src/data/json";
|
||||
export {
|
||||
loadFromBlob,
|
||||
loadSceneOrLibraryFromBlob,
|
||||
loadLibraryFromBlob,
|
||||
} from "./data/blob";
|
||||
} from "./src/data/blob";
|
||||
export { getFreeDrawSvgPath } from "@excalidraw/element/renderElement";
|
||||
export { mergeLibraryItems, getLibraryItemsHash } from "./data/library";
|
||||
export { mergeLibraryItems, getLibraryItemsHash } from "./src/data/library";
|
||||
export { isLinearElement } from "@excalidraw/element/typeChecks";
|
||||
|
||||
export {
|
||||
|
@ -266,7 +266,10 @@ export {
|
|||
|
||||
export { CaptureUpdateAction } from "./store";
|
||||
|
||||
export { parseLibraryTokensFromUrl, useHandleLibrary } from "./data/library";
|
||||
export {
|
||||
parseLibraryTokensFromUrl,
|
||||
useHandleLibrary,
|
||||
} from "./src/data/library";
|
||||
|
||||
export {
|
||||
sceneCoordsToViewportCoords,
|
||||
|
@ -287,7 +290,7 @@ export { TTDDialog } from "./components/TTDDialog/TTDDialog";
|
|||
export { TTDDialogTrigger } from "./components/TTDDialog/TTDDialogTrigger";
|
||||
|
||||
export { zoomToFitBounds } from "./actions/actionCanvas";
|
||||
export { convertToExcalidrawElements } from "./data/transform";
|
||||
export { convertToExcalidrawElements } from "./src/data/transform";
|
||||
export {
|
||||
getCommonBounds,
|
||||
getVisibleSceneBounds,
|
||||
|
@ -300,7 +303,7 @@ export {
|
|||
} from "@excalidraw/utils/withinBounds";
|
||||
|
||||
export { DiagramToCodePlugin } from "./components/DiagramToCodePlugin/DiagramToCodePlugin";
|
||||
export { getDataURL } from "./data/blob";
|
||||
export { getDataURL } from "./src/data/blob";
|
||||
export { isElementLink } from "@excalidraw/element/elementLink";
|
||||
|
||||
export { setCustomTextMetricsProvider } from "@excalidraw/element/textMeasurements";
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { EDITOR_LS_KEYS } from "@excalidraw/common";
|
||||
|
||||
import type { JSONValue } from "../types";
|
||||
import type { JSONValue } from "../../types";
|
||||
|
||||
export class EditorLocalStorage {
|
||||
static has(key: typeof EDITOR_LS_KEYS[keyof typeof EDITOR_LS_KEYS]) {
|
|
@ -12,18 +12,18 @@ import { clearElementsForExport } from "@excalidraw/element";
|
|||
import type { ValueOf } from "@excalidraw/common/utility-types";
|
||||
import type { ExcalidrawElement, FileId } from "@excalidraw/element/types";
|
||||
|
||||
import { cleanAppStateForExport } from "../appState";
|
||||
import { cleanAppStateForExport } from "../../appState";
|
||||
|
||||
import { CanvasError, ImageSceneDataError } from "../errors";
|
||||
import { calculateScrollCenter } from "../src/scene";
|
||||
import { decodeSvgBase64Payload } from "../src/scene/export";
|
||||
import { CanvasError, ImageSceneDataError } from "../../errors";
|
||||
import { calculateScrollCenter } from "../scene";
|
||||
import { decodeSvgBase64Payload } from "../scene/export";
|
||||
|
||||
import { base64ToString, stringToBase64, toByteString } from "./encode";
|
||||
import { nativeFileSystemSupported } from "./filesystem";
|
||||
import { isValidExcalidrawData, isValidLibrary } from "./json";
|
||||
import { restore, restoreLibraryItems } from "./restore";
|
||||
|
||||
import type { AppState, DataURL, LibraryItem } from "../types";
|
||||
import type { AppState, DataURL, LibraryItem } from "../../types";
|
||||
|
||||
import type { FileSystemHandle } from "./filesystem";
|
||||
import type { ImportedLibraryData } from "./types";
|
|
@ -6,7 +6,7 @@ import {
|
|||
|
||||
import { EVENT, MIME_TYPES, debounce } from "@excalidraw/common";
|
||||
|
||||
import { AbortError } from "../errors";
|
||||
import { AbortError } from "../../errors";
|
||||
|
||||
import type { FileSystemHandle } from "browser-fs-access";
|
||||
|
|
@ -22,11 +22,11 @@ import type {
|
|||
import {
|
||||
copyBlobToClipboardAsPng,
|
||||
copyTextToSystemClipboard,
|
||||
} from "../clipboard";
|
||||
} from "../../clipboard";
|
||||
|
||||
import { t } from "../i18n";
|
||||
import { getSelectedElements, isSomeElementSelected } from "../src/scene";
|
||||
import { exportToCanvas, exportToSvg } from "../src/scene/export";
|
||||
import { t } from "../../i18n";
|
||||
import { getSelectedElements, isSomeElementSelected } from "../scene";
|
||||
import { exportToCanvas, exportToSvg } from "../scene/export";
|
||||
|
||||
import { canvasToBlob } from "./blob";
|
||||
import { fileSave } from "./filesystem";
|
||||
|
@ -34,8 +34,8 @@ import { serializeAsJSON } from "./json";
|
|||
|
||||
import type { FileSystemHandle } from "./filesystem";
|
||||
|
||||
import type { ExportType } from "../src/scene/types";
|
||||
import type { AppState, BinaryFiles } from "../types";
|
||||
import type { ExportType } from "../scene/types";
|
||||
import type { AppState, BinaryFiles } from "../../types";
|
||||
|
||||
export { loadFromBlob } from "./blob";
|
||||
export { loadFromJSON, saveAsJSON } from "./json";
|
|
@ -13,12 +13,15 @@ import {
|
|||
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import { cleanAppStateForExport, clearAppStateForDatabase } from "../appState";
|
||||
import {
|
||||
cleanAppStateForExport,
|
||||
clearAppStateForDatabase,
|
||||
} from "../../appState";
|
||||
|
||||
import { isImageFileHandle, loadFromBlob, normalizeFile } from "./blob";
|
||||
import { fileOpen, fileSave } from "./filesystem";
|
||||
|
||||
import type { AppState, BinaryFiles, LibraryItems } from "../types";
|
||||
import type { AppState, BinaryFiles, LibraryItems } from "../../types";
|
||||
import type {
|
||||
ExportedDataState,
|
||||
ImportedDataState,
|
|
@ -24,17 +24,17 @@ import type { ExcalidrawElement } from "@excalidraw/element/types";
|
|||
|
||||
import type { MaybePromise } from "@excalidraw/common/utility-types";
|
||||
|
||||
import { atom, editorJotaiStore } from "../editor-jotai";
|
||||
import { atom, editorJotaiStore } from "../../editor-jotai";
|
||||
|
||||
import { Emitter } from "../emitter";
|
||||
import { AbortError } from "../errors";
|
||||
import { libraryItemSvgsCache } from "../src/hooks/useLibraryItemSvg";
|
||||
import { t } from "../i18n";
|
||||
import { Emitter } from "../../emitter";
|
||||
import { AbortError } from "../../errors";
|
||||
import { libraryItemSvgsCache } from "../hooks/useLibraryItemSvg";
|
||||
import { t } from "../../i18n";
|
||||
|
||||
import { loadLibraryFromBlob } from "./blob";
|
||||
import { restoreLibraryItems } from "./restore";
|
||||
|
||||
import type App from "../components/App";
|
||||
import type App from "../../components/App";
|
||||
|
||||
import type {
|
||||
LibraryItems,
|
||||
|
@ -42,7 +42,7 @@ import type {
|
|||
ExcalidrawImperativeAPI,
|
||||
LibraryItemsSource,
|
||||
LibraryItems_anyVersion,
|
||||
} from "../types";
|
||||
} from "../../types";
|
||||
|
||||
/**
|
||||
* format: hostname or hostname/pathname
|
|
@ -12,7 +12,7 @@ import type { OrderedExcalidrawElement } from "@excalidraw/element/types";
|
|||
|
||||
import type { MakeBrand } from "@excalidraw/common/utility-types";
|
||||
|
||||
import type { AppState } from "../types";
|
||||
import type { AppState } from "../../types";
|
||||
|
||||
export type ReconciledExcalidrawElement = OrderedExcalidrawElement &
|
||||
MakeBrand<"ReconciledElement">;
|
|
@ -4,7 +4,7 @@ import { getFileHandleType, isImageFileHandleType } from "./blob";
|
|||
|
||||
import { exportCanvas, prepareElementsForExport } from ".";
|
||||
|
||||
import type { AppState, BinaryFiles } from "../types";
|
||||
import type { AppState, BinaryFiles } from "../../types";
|
||||
|
||||
export const resaveAsImageWithScene = async (
|
||||
elements: readonly ExcalidrawElement[],
|
|
@ -65,15 +65,15 @@ import type {
|
|||
|
||||
import type { MarkOptional, Mutable } from "@excalidraw/common/utility-types";
|
||||
|
||||
import { getDefaultAppState } from "../appState";
|
||||
import { getDefaultAppState } from "../../appState";
|
||||
|
||||
import {
|
||||
getNormalizedGridSize,
|
||||
getNormalizedGridStep,
|
||||
getNormalizedZoom,
|
||||
} from "../src/scene";
|
||||
} from "../scene";
|
||||
|
||||
import type { AppState, BinaryFiles, LibraryItem } from "../types";
|
||||
import type { AppState, BinaryFiles, LibraryItem } from "../../types";
|
||||
import type { ImportedDataState, LegacyAppState } from "./types";
|
||||
|
||||
type RestoredAppState = Omit<
|
|
@ -63,7 +63,7 @@ import type {
|
|||
|
||||
import type { MarkOptional } from "@excalidraw/common/utility-types";
|
||||
|
||||
import { getCommonBounds } from "..";
|
||||
import { getCommonBounds } from "../..";
|
||||
|
||||
export type ValidLinearElement = {
|
||||
type: "arrow" | "line";
|
|
@ -2,13 +2,13 @@ import type { VERSIONS } from "@excalidraw/common";
|
|||
|
||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||
|
||||
import type { cleanAppStateForExport } from "../appState";
|
||||
import type { cleanAppStateForExport } from "../../appState";
|
||||
import type {
|
||||
AppState,
|
||||
BinaryFiles,
|
||||
LibraryItems,
|
||||
LibraryItems_anyVersion,
|
||||
} from "../types";
|
||||
} from "../../types";
|
||||
|
||||
export interface ExportedDataState {
|
||||
type: string;
|
|
@ -53,13 +53,8 @@ import type {
|
|||
} from "@excalidraw/element/types";
|
||||
|
||||
import { getDefaultAppState } from "../../appState";
|
||||
import {
|
||||
base64ToString,
|
||||
decode,
|
||||
encode,
|
||||
stringToBase64,
|
||||
} from "../../data/encode";
|
||||
import { serializeAsJSON } from "../../data/json";
|
||||
import { base64ToString, decode, encode, stringToBase64 } from "../data/encode";
|
||||
import { serializeAsJSON } from "../data/json";
|
||||
|
||||
import { Fonts } from "../../fonts";
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@ import type {
|
|||
OrderedExcalidrawElement,
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { reconcileElements } from "../../data/reconcile";
|
||||
import { reconcileElements } from "../../src/data/reconcile";
|
||||
|
||||
import type { RemoteExcalidrawElement } from "../../data/reconcile";
|
||||
import type { RemoteExcalidrawElement } from "../../src/data/reconcile";
|
||||
|
||||
import type { AppState } from "../../types";
|
||||
|
||||
|
|
|
@ -15,10 +15,10 @@ import type {
|
|||
import type { NormalizedZoomValue } from "@excalidraw/excalidraw/types";
|
||||
|
||||
import { API } from "../helpers/api";
|
||||
import * as restore from "../../data/restore";
|
||||
import * as restore from "../../src/data/restore";
|
||||
import { getDefaultAppState } from "../../appState";
|
||||
|
||||
import type { ImportedDataState } from "../../data/types";
|
||||
import type { ImportedDataState } from "../../src/data/types";
|
||||
|
||||
describe("restoreElements", () => {
|
||||
const mockSizeHelper = vi.spyOn(sizeHelpers, "isInvisiblySmallElement");
|
||||
|
|
|
@ -5,9 +5,9 @@ import { SVG_NS } from "@excalidraw/common";
|
|||
import type { FileId } from "@excalidraw/element/types";
|
||||
|
||||
import { getDefaultAppState } from "../appState";
|
||||
import { getDataURL } from "../data/blob";
|
||||
import { encodePngMetadata } from "../data/image";
|
||||
import { serializeAsJSON } from "../data/json";
|
||||
import { getDataURL } from "../src/data/blob";
|
||||
import { encodePngMetadata } from "../src/data/image";
|
||||
import { serializeAsJSON } from "../src/data/json";
|
||||
import { Excalidraw } from "../index";
|
||||
import {
|
||||
decodeSvgBase64Payload,
|
||||
|
|
|
@ -24,7 +24,7 @@ import { createPasteEvent } from "../clipboard";
|
|||
import { Excalidraw } from "../index";
|
||||
|
||||
// Importing to spy on it and mock the implementation (mocking does not work with simple vi.mock for some reason)
|
||||
import * as blobModule from "../data/blob";
|
||||
import * as blobModule from "../src/data/blob";
|
||||
|
||||
import { API } from "./helpers/api";
|
||||
import { UI, Pointer, Keyboard } from "./helpers/ui";
|
||||
|
|
|
@ -42,7 +42,7 @@ import type {
|
|||
|
||||
import type { Mutable } from "@excalidraw/common/utility-types";
|
||||
|
||||
import { getMimeType } from "../../data/blob";
|
||||
import { getMimeType } from "../../src/data/blob";
|
||||
import { createTestHook } from "../../components/App";
|
||||
import { getDefaultAppState } from "../../appState";
|
||||
import { GlobalTestState, createEvent, fireEvent, act } from "../test-utils";
|
||||
|
|
|
@ -8,9 +8,9 @@ import { getCommonBoundingBox } from "@excalidraw/element/bounds";
|
|||
|
||||
import type { ExcalidrawGenericElement } from "@excalidraw/element/types";
|
||||
|
||||
import { parseLibraryJSON } from "../data/blob";
|
||||
import { serializeLibraryAsJSON } from "../data/json";
|
||||
import { distributeLibraryItemsOnSquareGrid } from "../data/library";
|
||||
import { parseLibraryJSON } from "../src/data/blob";
|
||||
import { serializeLibraryAsJSON } from "../src/data/json";
|
||||
import { distributeLibraryItemsOnSquareGrid } from "../src/data/library";
|
||||
import { Excalidraw } from "../index";
|
||||
|
||||
import { API } from "./helpers/api";
|
||||
|
|
|
@ -8,7 +8,7 @@ import type {
|
|||
NonDeletedExcalidrawElement,
|
||||
} from "@excalidraw/element/types";
|
||||
|
||||
import { prepareElementsForExport } from "../../data";
|
||||
import { prepareElementsForExport } from "../../src/data";
|
||||
import * as exportUtils from "../../src/scene/export";
|
||||
import {
|
||||
diamondFixture,
|
||||
|
|
|
@ -24,7 +24,7 @@ import * as toolQueries from "./queries/toolQueries";
|
|||
|
||||
import type { RenderResult, RenderOptions } from "@testing-library/react";
|
||||
|
||||
import type { ImportedDataState } from "../data/types";
|
||||
import type { ImportedDataState } from "../src/data/types";
|
||||
|
||||
export { cleanup as unmountComponent };
|
||||
|
||||
|
|
|
@ -47,12 +47,12 @@ 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 Library from "./src/data/library";
|
||||
import type { FileSystemHandle } from "./src/data/filesystem";
|
||||
import type { ContextMenuItems } from "./components/ContextMenu";
|
||||
import type { SnapLine } from "./snapping";
|
||||
import type { CaptureUpdateActionType } from "./store";
|
||||
import type { ImportedDataState } from "./data/types";
|
||||
import type { ImportedDataState } from "./src/data/types";
|
||||
|
||||
import type { Language } from "./i18n";
|
||||
import type { isOverScrollBars } from "./src/scene/scrollbars";
|
||||
|
|
|
@ -5,9 +5,9 @@ import {
|
|||
copyTextToSystemClipboard,
|
||||
copyToClipboard,
|
||||
} from "@excalidraw/excalidraw/clipboard";
|
||||
import { encodePngMetadata } from "@excalidraw/excalidraw/data/image";
|
||||
import { serializeAsJSON } from "@excalidraw/excalidraw/data/json";
|
||||
import { restore } from "@excalidraw/excalidraw/data/restore";
|
||||
import { encodePngMetadata } from "@excalidraw/excalidraw/src/data/image";
|
||||
import { serializeAsJSON } from "@excalidraw/excalidraw/src/data/json";
|
||||
import { restore } from "@excalidraw/excalidraw/src/data/restore";
|
||||
import {
|
||||
exportToCanvas as _exportToCanvas,
|
||||
exportToSvg as _exportToSvg,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { decodePngMetadata } from "@excalidraw/excalidraw/data/image";
|
||||
import { decodePngMetadata } from "@excalidraw/excalidraw/src/data/image";
|
||||
import { decodeSvgBase64Payload } from "@excalidraw/excalidraw/src/scene/export";
|
||||
import { API } from "@excalidraw/excalidraw/tests/helpers/api";
|
||||
|
||||
import type { ImportedDataState } from "@excalidraw/excalidraw/data/types";
|
||||
import type { ImportedDataState } from "@excalidraw/excalidraw/src/data/types";
|
||||
|
||||
import * as utils from "../src";
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue