Move hooks folder into src

This commit is contained in:
Deepen Timalsina 2025-04-15 07:36:54 +05:45
parent 01304aac49
commit 80ba0d0d77
27 changed files with 30 additions and 30 deletions

View file

@ -34,7 +34,7 @@ import {
import polyfill from "@excalidraw/excalidraw/polyfill"; import polyfill from "@excalidraw/excalidraw/polyfill";
import { useCallback, useEffect, useRef, useState } from "react"; import { useCallback, useEffect, useRef, useState } from "react";
import { loadFromBlob } from "@excalidraw/excalidraw/data/blob"; import { loadFromBlob } from "@excalidraw/excalidraw/data/blob";
import { useCallbackRefState } from "@excalidraw/excalidraw/hooks/useCallbackRefState"; import { useCallbackRefState } from "@excalidraw/excalidraw/src/hooks/useCallbackRefState";
import { t } from "@excalidraw/excalidraw/i18n"; import { t } from "@excalidraw/excalidraw/i18n";
import { import {

View file

@ -13,7 +13,7 @@ import {
shareWindows, shareWindows,
} from "@excalidraw/excalidraw/components/icons"; } from "@excalidraw/excalidraw/components/icons";
import { useUIAppState } from "@excalidraw/excalidraw/context/ui-appState"; import { useUIAppState } from "@excalidraw/excalidraw/context/ui-appState";
import { useCopyStatus } from "@excalidraw/excalidraw/hooks/useCopiedIndicator"; import { useCopyStatus } from "@excalidraw/excalidraw/src/hooks/useCopiedIndicator";
import { useI18n } from "@excalidraw/excalidraw/i18n"; import { useI18n } from "@excalidraw/excalidraw/i18n";
import { KEYS, getFrame } from "@excalidraw/common"; import { KEYS, getFrame } from "@excalidraw/common";
import { useEffect, useRef, useState } from "react"; import { useEffect, useRef, useState } from "react";

View file

@ -5,7 +5,7 @@ import type { SceneElementsMap } from "@excalidraw/element/types";
import { ToolButton } from "../components/ToolButton"; import { ToolButton } from "../components/ToolButton";
import { UndoIcon, RedoIcon } from "../components/icons"; import { UndoIcon, RedoIcon } from "../components/icons";
import { HistoryChangedEvent } from "../history"; import { HistoryChangedEvent } from "../history";
import { useEmitter } from "../hooks/useEmitter"; import { useEmitter } from "../src/hooks/useEmitter";
import { t } from "../i18n"; import { t } from "../i18n";
import { CaptureUpdateAction } from "../store"; import { CaptureUpdateAction } from "../store";

View file

@ -53,9 +53,9 @@ import {
import { SHAPES } from "../shapes"; import { SHAPES } from "../shapes";
import { canChangeBackgroundColor, canChangeStrokeColor } from "../Actions"; import { canChangeBackgroundColor, canChangeStrokeColor } from "../Actions";
import { useStableCallback } from "../../hooks/useStableCallback"; import { useStableCallback } from "../../src/hooks/useStableCallback";
import { activeConfirmDialogAtom } from "../ActiveConfirmDialog"; import { activeConfirmDialogAtom } from "../ActiveConfirmDialog";
import { useStable } from "../../hooks/useStable"; import { useStable } from "../../src/hooks/useStable";
import * as defaultItems from "./defaultCommandPaletteItems"; import * as defaultItems from "./defaultCommandPaletteItems";

View file

@ -4,7 +4,7 @@ import React, { useEffect, useState } from "react";
import { KEYS, queryFocusableElements } from "@excalidraw/common"; import { KEYS, queryFocusableElements } from "@excalidraw/common";
import { useSetAtom } from "../editor-jotai"; import { useSetAtom } from "../editor-jotai";
import { useCallbackRefState } from "../hooks/useCallbackRefState"; import { useCallbackRefState } from "../src/hooks/useCallbackRefState";
import { t } from "../i18n"; import { t } from "../i18n";
import { import {

View file

@ -7,9 +7,9 @@ import type { ExcalidrawElement } from "@excalidraw/element/types";
import { useUIAppState } from "../context/ui-appState"; import { useUIAppState } from "../context/ui-appState";
import { atom } from "../editor-jotai"; import { atom } from "../editor-jotai";
import { useCreatePortalContainer } from "../hooks/useCreatePortalContainer"; import { useCreatePortalContainer } from "../src/hooks/useCreatePortalContainer";
import { useOutsideClick } from "../hooks/useOutsideClick"; import { useOutsideClick } from "../src/hooks/useOutsideClick";
import { useStable } from "../hooks/useStable"; import { useStable } from "../src/hooks/useStable";
import { getSelectedElements } from "../scene"; import { getSelectedElements } from "../scene";
import { useApp, useExcalidrawContainer, useExcalidrawElements } from "./App"; import { useApp, useExcalidrawContainer, useExcalidrawElements } from "./App";

View file

@ -22,7 +22,7 @@ import { probablySupportsClipboardBlob } from "../clipboard";
import { prepareElementsForExport } from "../data"; import { prepareElementsForExport } from "../data";
import { canvasToBlob } from "../data/blob"; import { canvasToBlob } from "../data/blob";
import { nativeFileSystemSupported } from "../data/filesystem"; import { nativeFileSystemSupported } from "../data/filesystem";
import { useCopyStatus } from "../hooks/useCopiedIndicator"; import { useCopyStatus } from "../src/hooks/useCopiedIndicator";
import { t } from "../i18n"; import { t } from "../i18n";
import { isSomeElementSelected } from "../scene"; import { isSomeElementSelected } from "../scene";

View file

@ -8,7 +8,7 @@ import { fileOpen } from "../data/filesystem";
import { saveLibraryAsJSON } from "../data/json"; import { saveLibraryAsJSON } from "../data/json";
import { libraryItemsAtom } from "../data/library"; import { libraryItemsAtom } from "../data/library";
import { useAtom } from "../editor-jotai"; import { useAtom } from "../editor-jotai";
import { useLibraryCache } from "../hooks/useLibraryItemSvg"; import { useLibraryCache } from "../src/hooks/useLibraryItemSvg";
import { t } from "../i18n"; import { t } from "../i18n";
import { useApp, useExcalidrawSetAppState } from "./App"; import { useApp, useExcalidrawSetAppState } from "./App";

View file

@ -11,8 +11,8 @@ import { MIME_TYPES, arrayToMap } from "@excalidraw/common";
import { duplicateElements } from "@excalidraw/element/duplicate"; import { duplicateElements } from "@excalidraw/element/duplicate";
import { serializeLibraryAsJSON } from "../data/json"; import { serializeLibraryAsJSON } from "../data/json";
import { useLibraryCache } from "../hooks/useLibraryItemSvg"; import { useLibraryCache } from "../src/hooks/useLibraryItemSvg";
import { useScrollPosition } from "../hooks/useScrollPosition"; import { useScrollPosition } from "../src/hooks/useScrollPosition";
import { t } from "../i18n"; import { t } from "../i18n";
import { LibraryMenuControlButtons } from "./LibraryMenuControlButtons"; import { LibraryMenuControlButtons } from "./LibraryMenuControlButtons";

View file

@ -2,11 +2,11 @@ import React, { memo, useEffect, useState } from "react";
import type { ExcalidrawElement, NonDeleted } from "@excalidraw/element/types"; import type { ExcalidrawElement, NonDeleted } from "@excalidraw/element/types";
import { useTransition } from "../hooks/useTransition"; import { useTransition } from "../src/hooks/useTransition";
import { EmptyLibraryUnit, LibraryUnit } from "./LibraryUnit"; import { EmptyLibraryUnit, LibraryUnit } from "./LibraryUnit";
import type { SvgCache } from "../hooks/useLibraryItemSvg"; import type { SvgCache } from "../src/hooks/useLibraryItemSvg";
import type { LibraryItem } from "../types"; import type { LibraryItem } from "../types";
import type { ReactNode } from "react"; import type { ReactNode } from "react";

View file

@ -1,7 +1,7 @@
import clsx from "clsx"; import clsx from "clsx";
import { memo, useEffect, useRef, useState } from "react"; import { memo, useEffect, useRef, useState } from "react";
import { useLibraryItemSvg } from "../hooks/useLibraryItemSvg"; import { useLibraryItemSvg } from "../src/hooks/useLibraryItemSvg";
import { useDevice } from "./App"; import { useDevice } from "./App";
import { CheckboxItem } from "./CheckboxItem"; import { CheckboxItem } from "./CheckboxItem";
@ -10,7 +10,7 @@ import { PlusIcon } from "./icons";
import "./LibraryUnit.scss"; import "./LibraryUnit.scss";
import type { LibraryItem } from "../types"; import type { LibraryItem } from "../types";
import type { SvgCache } from "../hooks/useLibraryItemSvg"; import type { SvgCache } from "../src/hooks/useLibraryItemSvg";
export const LibraryUnit = memo( export const LibraryUnit = memo(
({ ({

View file

@ -4,7 +4,7 @@ import { createPortal } from "react-dom";
import { KEYS } from "@excalidraw/common"; import { KEYS } from "@excalidraw/common";
import { useCreatePortalContainer } from "../hooks/useCreatePortalContainer"; import { useCreatePortalContainer } from "../src/hooks/useCreatePortalContainer";
import "./Modal.scss"; import "./Modal.scss";

View file

@ -23,7 +23,7 @@ import type { ExcalidrawTextElement } from "@excalidraw/element/types";
import { atom, useAtom } from "../editor-jotai"; import { atom, useAtom } from "../editor-jotai";
import { useStable } from "../hooks/useStable"; import { useStable } from "../src/hooks/useStable";
import { t } from "../i18n"; import { t } from "../i18n";
import { useApp, useExcalidrawSetAppState } from "./App"; import { useApp, useExcalidrawSetAppState } from "./App";

View file

@ -1,7 +1,7 @@
import { useRef, useState } from "react"; import { useRef, useState } from "react";
import { copyTextToSystemClipboard } from "../clipboard"; import { copyTextToSystemClipboard } from "../clipboard";
import { useCopyStatus } from "../hooks/useCopiedIndicator"; import { useCopyStatus } from "../src/hooks/useCopiedIndicator";
import { useI18n } from "../i18n"; import { useI18n } from "../i18n";
import { Dialog } from "./Dialog"; import { Dialog } from "./Dialog";

View file

@ -13,7 +13,7 @@ import { EVENT, isDevEnv, KEYS, updateObject } from "@excalidraw/common";
import { useUIAppState } from "../../context/ui-appState"; import { useUIAppState } from "../../context/ui-appState";
import { atom, useSetAtom } from "../../editor-jotai"; import { atom, useSetAtom } from "../../editor-jotai";
import { useOutsideClick } from "../../hooks/useOutsideClick"; import { useOutsideClick } from "../../src/hooks/useOutsideClick";
import { useDevice, useExcalidrawSetAppState } from "../App"; import { useDevice, useExcalidrawSetAppState } from "../App";
import { Island } from "../Island"; import { Island } from "../Island";

View file

@ -3,8 +3,8 @@ import React, { useEffect, useRef } from "react";
import { EVENT, KEYS } from "@excalidraw/common"; import { EVENT, KEYS } from "@excalidraw/common";
import { useOutsideClick } from "../../hooks/useOutsideClick"; import { useOutsideClick } from "../../src/hooks/useOutsideClick";
import { useStable } from "../../hooks/useStable"; import { useStable } from "../../src/hooks/useStable";
import { useDevice } from "../App"; import { useDevice } from "../App";
import { Island } from "../Island"; import { Island } from "../Island";
import Stack from "../Stack"; import Stack from "../Stack";

View file

@ -28,7 +28,7 @@ import { atom, editorJotaiStore } from "../editor-jotai";
import { Emitter } from "../emitter"; import { Emitter } from "../emitter";
import { AbortError } from "../errors"; import { AbortError } from "../errors";
import { libraryItemSvgsCache } from "../hooks/useLibraryItemSvg"; import { libraryItemSvgsCache } from "../src/hooks/useLibraryItemSvg";
import { t } from "../i18n"; import { t } from "../i18n";
import { loadLibraryFromBlob } from "./blob"; import { loadLibraryFromBlob } from "./blob";

View file

@ -2,8 +2,8 @@ import { useState, useLayoutEffect } from "react";
import { THEME } from "@excalidraw/common"; import { THEME } from "@excalidraw/common";
import { useDevice, useExcalidrawContainer } from "../components/App"; import { useDevice, useExcalidrawContainer } from "../../components/App";
import { useUIAppState } from "../context/ui-appState"; import { useUIAppState } from "../../context/ui-appState";
export const useCreatePortalContainer = (opts?: { export const useCreatePortalContainer = (opts?: {
className?: string; className?: string;

View file

@ -1,6 +1,6 @@
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import type { Emitter } from "../emitter"; import type { Emitter } from "../../emitter";
export const useEmitter = <TEvent extends unknown>( export const useEmitter = <TEvent extends unknown>(
emitter: Emitter<[TEvent]>, emitter: Emitter<[TEvent]>,

View file

@ -3,9 +3,9 @@ import { useEffect, useState } from "react";
import { COLOR_PALETTE } from "@excalidraw/common"; import { COLOR_PALETTE } from "@excalidraw/common";
import { atom, useAtom } from "../editor-jotai"; import { atom, useAtom } from "../../editor-jotai";
import type { LibraryItem } from "../types"; import type { LibraryItem } from "../../types";
export type SvgCache = Map<LibraryItem["id"], SVGSVGElement>; export type SvgCache = Map<LibraryItem["id"], SVGSVGElement>;

View file

@ -1,7 +1,7 @@
import throttle from "lodash.throttle"; import throttle from "lodash.throttle";
import { useEffect } from "react"; import { useEffect } from "react";
import { atom, useAtom } from "../editor-jotai"; import { atom, useAtom } from "../../editor-jotai";
const scrollPositionAtom = atom<number>(0); const scrollPositionAtom = atom<number>(0);