Merge branch 'master' into mrazator/delta-based-sync

This commit is contained in:
Marcel Mraz
2025-03-28 13:17:56 +01:00
582 changed files with 24885 additions and 15321 deletions

View File

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

View File

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

View File

@@ -1,7 +1,10 @@
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 { exportToSvg } from "../../utils/export";
import type { LibraryItem } from "../types";
export type SvgCache = Map<LibraryItem["id"], SVGSVGElement>;

View File

@@ -1,8 +1,9 @@
import { useEffect } from "react";
import { EVENT } from "../constants";
import { EVENT } from "@excalidraw/common";
export function useOutsideClick<T extends HTMLElement>(
ref: React.RefObject<T>,
ref: React.RefObject<T | null>,
/** if performance is of concern, memoize the callback */
callback: (event: Event) => void,
/**

View File

@@ -1,11 +1,12 @@
import { useEffect } from "react";
import { atom, useAtom } from "../editor-jotai";
import throttle from "lodash.throttle";
import { useEffect } from "react";
import { atom, useAtom } from "../editor-jotai";
const scrollPositionAtom = atom<number>(0);
export const useScrollPosition = <T extends HTMLElement>(
elementRef: React.RefObject<T>,
elementRef: React.RefObject<T | null>,
) => {
const [scrollPosition, setScrollPosition] = useAtom(scrollPositionAtom);