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
b70dacbca6
commit
351fbed951
34 changed files with 91 additions and 78 deletions
|
@ -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";
|
||||
|
|
|
@ -390,9 +390,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";
|
||||
|
@ -422,9 +424,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,
|
||||
|
@ -446,7 +448,7 @@ import {
|
|||
SnapCache,
|
||||
isGridModeEnabled,
|
||||
} from "../snapping";
|
||||
import { convertToExcalidrawElements } from "../data/transform";
|
||||
import { convertToExcalidrawElements } from "../src/data/transform";
|
||||
import { Renderer } from "../scene/Renderer";
|
||||
import {
|
||||
setEraserCursor,
|
||||
|
@ -494,10 +496,10 @@ import type {
|
|||
} from "../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 "../src/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 "../hooks/useCopiedIndicator";
|
||||
|
||||
import { t } from "../i18n";
|
||||
|
|
|
@ -7,7 +7,7 @@ import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types";
|
|||
import { actionSaveFileToDisk } from "../src/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 "../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 "../hooks/useLibraryItemSvg";
|
||||
import { useScrollPosition } from "../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 "./src/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";
|
||||
|
|
|
@ -53,8 +53,13 @@ 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 "../src/data/encode";
|
||||
import { serializeAsJSON } from "../src/data/json";
|
||||
|
||||
import { Fonts } from "../fonts";
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import {
|
|||
pngIcon,
|
||||
svgIcon,
|
||||
} from "../../components/icons";
|
||||
import { exportCanvas, prepareElementsForExport } from "../../data/index";
|
||||
import { exportCanvas, prepareElementsForExport } from "../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 "../data";
|
||||
import { isImageFileHandle } from "../data/blob";
|
||||
import { nativeFileSystemSupported } from "../data/filesystem";
|
||||
import { resaveAsImageWithScene } from "../data/resave";
|
||||
|
||||
import { t } from "../../i18n";
|
||||
import { getSelectedElements, isSomeElementSelected } from "../../scene";
|
||||
|
|
|
@ -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 "../scene";
|
||||
import { decodeSvgBase64Payload } from "../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 "../scene";
|
||||
import { exportToCanvas, exportToSvg } from "../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 "../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 "../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 "../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;
|
|
@ -47,12 +47,12 @@ import type { Action } from "./src/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 "./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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue