repo
stringlengths
7
64
file_url
stringlengths
81
338
file_path
stringlengths
5
257
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:25:31
2026-01-05 01:50:38
truncated
bool
2 classes
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/elementLocking.test.tsx
packages/excalidraw/tests/elementLocking.test.tsx
import { KEYS } from "@excalidraw/common"; import { actionSelectAll } from "../actions"; import { t } from "../i18n"; import { Excalidraw } from "../index"; import { API } from "../tests/helpers/api"; import { Keyboard, Pointer, UI } from "../tests/helpers/ui"; import { render, unmountComponent } from "../tests/test-...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/fitToContent.test.tsx
packages/excalidraw/tests/fitToContent.test.tsx
import React from "react"; import { vi } from "vitest"; import { Excalidraw } from "../index"; import { API } from "./helpers/api"; import { act, render } from "./test-utils"; const { h } = window; const waitForNextAnimationFrame = () => { return act( () => new Promise((resolve) => { requestAnim...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/dragCreate.test.tsx
packages/excalidraw/tests/dragCreate.test.tsx
import React from "react"; import { vi } from "vitest"; import { KEYS, reseed } from "@excalidraw/common"; import type { ExcalidrawLinearElement } from "@excalidraw/element/types"; import { Excalidraw } from "../index"; import * as InteractiveScene from "../renderer/interactiveScene"; import * as StaticScene from "....
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/flip.test.tsx
packages/excalidraw/tests/flip.test.tsx
import { vi } from "vitest"; import { ROUNDNESS, KEYS, arrayToMap, cloneJSON } from "@excalidraw/common"; import { pointFrom, type Radians } from "@excalidraw/math"; import { getBoundTextElementPosition } from "@excalidraw/element"; import { getElementAbsoluteCoords } from "@excalidraw/element"; import { newLinearEl...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/image.test.tsx
packages/excalidraw/tests/image.test.tsx
import { randomId, reseed } from "@excalidraw/common"; import type { FileId } from "@excalidraw/element/types"; import * as blobModule from "../data/blob"; import * as filesystemModule from "../data/filesystem"; import { Excalidraw } from "../index"; import { createPasteEvent } from "../clipboard"; import { API } fr...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/test-utils.ts
packages/excalidraw/tests/test-utils.ts
import "pepjs"; import { act } from "@testing-library/react"; import { render, queries, waitFor, fireEvent, cleanup, } from "@testing-library/react"; import ansi from "ansicolor"; import { ORIG_ID, arrayToMap } from "@excalidraw/common"; import { getSelectedElements } from "@excalidraw/element"; import typ...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/move.test.tsx
packages/excalidraw/tests/move.test.tsx
import React from "react"; import { vi } from "vitest"; import { KEYS, reseed } from "@excalidraw/common"; import { bindBindingElement } from "@excalidraw/element"; import "@excalidraw/utils/test-utils"; import type { ExcalidrawArrowElement, NonDeleted, } from "@excalidraw/element/types"; import { Excalidraw } fr...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/tool.test.tsx
packages/excalidraw/tests/tool.test.tsx
import React from "react"; import { resolvablePromise } from "@excalidraw/common"; import { Excalidraw } from "../index"; import { Pointer } from "./helpers/ui"; import { act, render } from "./test-utils"; import type { ExcalidrawImperativeAPI } from "../types"; describe("setActiveTool()", () => { const h = wind...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/regressionTests.test.tsx
packages/excalidraw/tests/regressionTests.test.tsx
import React from "react"; import { vi } from "vitest"; import { FONT_FAMILY, CODES, KEYS, reseed, MQ_MIN_WIDTH_DESKTOP, } from "@excalidraw/common"; import { setDateTimeForTests } from "@excalidraw/common"; import type { ExcalidrawElement } from "@excalidraw/element/types"; import { Excalidraw } from ".....
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
true
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/search.test.tsx
packages/excalidraw/tests/search.test.tsx
import React from "react"; import { CANVAS_SEARCH_TAB, CLASSES, DEFAULT_SIDEBAR, KEYS, } from "@excalidraw/common"; import type { ExcalidrawFrameLikeElement, ExcalidrawTextElement, } from "@excalidraw/element/types"; import { Excalidraw } from "../index"; import { API } from "./helpers/api"; import { Ke...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/appState.test.tsx
packages/excalidraw/tests/appState.test.tsx
import React from "react"; import { EXPORT_DATA_TYPES, MIME_TYPES } from "@excalidraw/common"; import type { ExcalidrawTextElement } from "@excalidraw/element/types"; import { getDefaultAppState } from "../appState"; import { Excalidraw } from "../index"; import { API } from "./helpers/api"; import { Pointer, UI } ...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/clipboard.test.tsx
packages/excalidraw/tests/clipboard.test.tsx
import React from "react"; import { vi } from "vitest"; import { getLineHeightInPx } from "@excalidraw/element"; import { KEYS, arrayToMap, getLineHeight } from "@excalidraw/common"; import { getElementBounds } from "@excalidraw/element"; import { createPasteEvent, serializeAsClipboardJSON } from "../clipboard"; i...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/charts.test.tsx
packages/excalidraw/tests/charts.test.tsx
import { tryParseSpreadsheet } from "../charts"; describe("tryParseSpreadsheet", () => { it("works for numbers with comma in them", () => { const result = tryParseSpreadsheet( `Week Index${"\t"}Users Week 1${"\t"}814 Week 2${"\t"}10,301 Week 3${"\t"}4,264`, ); expect(result).toMatchSnapshot(); })...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/export.test.tsx
packages/excalidraw/tests/export.test.tsx
import React from "react"; 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/jso...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/colorInput.test.ts
packages/excalidraw/tests/colorInput.test.ts
import { normalizeInputColor } from "../components/ColorPicker/ColorInput"; describe("normalizeInputColor", () => { describe("hex colors", () => { it("returns hex color with hash as-is", () => { expect(normalizeInputColor("#ff0000")).toBe("#ff0000"); expect(normalizeInputColor("#FF0000")).toBe("#FF00...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/library.test.tsx
packages/excalidraw/tests/library.test.tsx
import { act, queryByTestId } from "@testing-library/react"; import React from "react"; import { vi } from "vitest"; import { MIME_TYPES, ORIG_ID } from "@excalidraw/common"; import { getCommonBoundingBox } from "@excalidraw/element"; import type { ExcalidrawGenericElement } from "@excalidraw/element/types"; import...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/rotate.test.tsx
packages/excalidraw/tests/rotate.test.tsx
import React from "react"; import { expect } from "vitest"; import { reseed } from "@excalidraw/common"; import { Excalidraw } from "../index"; import { UI } from "./helpers/ui"; import { render, unmountComponent } from "./test-utils"; unmountComponent(); beforeEach(() => { localStorage.clear(); reseed(7); });...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/lasso.test.tsx
packages/excalidraw/tests/lasso.test.tsx
/** * Test case: * * create a few random elements on canvas * creates a lasso path for each of these cases * - do not intersect / enclose at all * - intersects some, does not enclose/intersect the rest * - intersects and encloses some * - single linear element should be selected if lasso intersects/encloses it ...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
true
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/helpers/polyfills.ts
packages/excalidraw/tests/helpers/polyfills.ts
import { URL } from "node:url"; class ClipboardEvent { constructor( type: "paste" | "copy", eventInitDict: { clipboardData: DataTransfer; }, ) { return Object.assign( new Event("paste", { bubbles: true, cancelable: true, composed: true, }), { ...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/helpers/ui.ts
packages/excalidraw/tests/helpers/ui.ts
import { pointFrom, pointRotateRads } from "@excalidraw/math"; import { elementCenterPoint, getCommonBounds, getElementPointsCoords, } from "@excalidraw/element"; import { cropElement } from "@excalidraw/element"; import { getTransformHandles, getTransformHandlesFromCoords, OMIT_SIDES_FOR_FRAME, OMIT_SID...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/helpers/api.ts
packages/excalidraw/tests/helpers/api.ts
import fs from "fs"; import path from "path"; import util from "util"; import { pointFrom, type LocalPoint, type Radians } from "@excalidraw/math"; import { DEFAULT_VERTICAL_ALIGN, ROUNDNESS, assertNever } from "@excalidraw/common"; import { newArrowElement, newElement, newEmbeddableElement, newFrameElement,...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/helpers/constants.ts
packages/excalidraw/tests/helpers/constants.ts
export const INITIALIZED_IMAGE_PROPS = { type: "image", fileId: expect.any(String), x: expect.toBeNonNaNNumber(), y: expect.toBeNonNaNNumber(), };
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/helpers/colorize.ts
packages/excalidraw/tests/helpers/colorize.ts
export const yellow = (str: string) => `\u001b[33m${str}\u001b[0m`; export const red = (str: string) => `\u001b[31m${str}\u001b[0m`;
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/helpers/mocks.ts
packages/excalidraw/tests/helpers/mocks.ts
import * as MermaidToExcalidraw from "@excalidraw/mermaid-to-excalidraw"; import React from "react"; import { vi } from "vitest"; import type { parseMermaidToExcalidraw } from "@excalidraw/mermaid-to-excalidraw"; export const mockMermaidToExcalidraw = (opts: { parseMermaidToExcalidraw: typeof parseMermaidToExcalidr...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/fixtures/diagramFixture.ts
packages/excalidraw/tests/fixtures/diagramFixture.ts
import { VERSIONS } from "@excalidraw/common"; import { diamondFixture, ellipseFixture, rectangleFixture, } from "./elementFixture"; export const diagramFixture = { type: "excalidraw", version: VERSIONS.excalidraw, source: "https://excalidraw.com", elements: [diamondFixture, ellipseFixture, rectangleFix...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/fixtures/elementFixture.ts
packages/excalidraw/tests/fixtures/elementFixture.ts
import { DEFAULT_FONT_FAMILY } from "@excalidraw/common"; import type { Radians } from "@excalidraw/math"; import type { ExcalidrawElement } from "@excalidraw/element/types"; const elementBase: Omit<ExcalidrawElement, "type"> = { id: "vWrqOAfkind2qcm7LDAGZ", x: 414, y: 237, width: 214, height: 214, angle...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/fixtures/constants.ts
packages/excalidraw/tests/fixtures/constants.ts
export const DEER_IMAGE_DIMENSIONS = { width: 318, height: 335, }; export const SMILEY_IMAGE_DIMENSIONS = { width: 56, height: 77, };
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/scene/export.test.ts
packages/excalidraw/tests/scene/export.test.ts
import { exportToCanvas, exportToSvg } from "@excalidraw/utils"; import { applyDarkModeFilter, FONT_FAMILY, FRAME_STYLE, } from "@excalidraw/common"; import type { ExcalidrawTextElement, FractionalIndex, NonDeletedExcalidrawElement, } from "@excalidraw/element/types"; import { prepareElementsForExport } ...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/queries/toolQueries.ts
packages/excalidraw/tests/queries/toolQueries.ts
import { queries, buildQueries } from "@testing-library/react"; import { TOOL_TYPE } from "@excalidraw/common"; import type { ToolType } from "@excalidraw/excalidraw/types"; const _getAllByToolName = (container: HTMLElement, tool: ToolType | "lock") => { const toolTitle = tool === "lock" ? "lock" : TOOL_TYPE[tool]...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/queries/dom.ts
packages/excalidraw/tests/queries/dom.ts
import { waitFor } from "@testing-library/dom"; import { fireEvent } from "@testing-library/react"; import { stripIgnoredNodesFromErrorMessage, trimErrorStack, } from "../test-utils"; export const TEXT_EDITOR_SELECTOR = ".excalidraw-textEditorContainer > textarea"; export const getTextEditor = async ({ selec...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/data/reconcile.test.ts
packages/excalidraw/tests/data/reconcile.test.ts
import { syncInvalidIndices } from "@excalidraw/element"; import { randomInteger, cloneJSON } from "@excalidraw/common"; import type { ExcalidrawElement, OrderedExcalidrawElement, } from "@excalidraw/element/types"; import { reconcileElements } from "../../data/reconcile"; import type { RemoteExcalidrawElement ...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/data/restore.test.ts
packages/excalidraw/tests/data/restore.test.ts
import { pointFrom } from "@excalidraw/math"; import { vi } from "vitest"; import { DEFAULT_SIDEBAR, FONT_FAMILY, ROUNDNESS } from "@excalidraw/common"; import { newElementWith } from "@excalidraw/element"; import * as sizeHelpers from "@excalidraw/element"; import type { LocalPoint } from "@excalidraw/math"; impor...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/tests/packages/events.test.tsx
packages/excalidraw/tests/packages/events.test.tsx
import React from "react"; import { vi } from "vitest"; import { resolvablePromise } from "@excalidraw/common"; import { Excalidraw, CaptureUpdateAction } from "../../index"; import { API } from "../helpers/api"; import { Pointer } from "../helpers/ui"; import { render } from "../test-utils"; import type { Excalidra...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/hooks/useCallbackRefState.ts
packages/excalidraw/hooks/useCallbackRefState.ts
import { useCallback, useState } from "react"; export const useCallbackRefState = <T>() => { const [refValue, setRefValue] = useState<T | null>(null); const refCallback = useCallback((value: T | null) => setRefValue(value), []); return [refValue, refCallback] as const; };
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/hooks/useStable.ts
packages/excalidraw/hooks/useStable.ts
import { useRef } from "react"; export const useStable = <T extends Record<string, any>>(value: T) => { const ref = useRef<T>(value); Object.assign(ref.current, value); return ref.current; };
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/hooks/useStableCallback.ts
packages/excalidraw/hooks/useStableCallback.ts
import { useRef } from "react"; /** * Returns a stable function of the same type. */ export const useStableCallback = <T extends (...args: any[]) => any>( userFn: T, ) => { const stableRef = useRef<{ userFn: T; stableFn?: T }>({ userFn }); stableRef.current.userFn = userFn; if (!stableRef.current.stableFn) ...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/hooks/useTextEditorFocus.ts
packages/excalidraw/hooks/useTextEditorFocus.ts
import { useState, useCallback } from "react"; // Utility type for caret position export type CaretPosition = { start: number; end: number; }; // Utility function to get text editor element const getTextEditor = (): HTMLTextAreaElement | null => { return document.querySelector(".excalidraw-wysiwyg") as HTMLText...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/hooks/useOutsideClick.ts
packages/excalidraw/hooks/useOutsideClick.ts
import { useEffect } from "react"; import { EVENT } from "@excalidraw/common"; export function useOutsideClick<T extends HTMLElement>( ref: React.RefObject<T | null>, /** if performance is of concern, memoize the callback */ callback: (event: Event & { target: T }) => void, /** * Optional callback which is...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/hooks/useEmitter.ts
packages/excalidraw/hooks/useEmitter.ts
import { useEffect, useState } from "react"; import type { Emitter } from "@excalidraw/common"; export const useEmitter = <TEvent extends unknown>( emitter: Emitter<[TEvent]>, initialState: TEvent, ) => { const [event, setEvent] = useState<TEvent>(initialState); useEffect(() => { const unsubscribe = emit...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/hooks/useLibraryItemSvg.ts
packages/excalidraw/hooks/useLibraryItemSvg.ts
import { exportToSvg } from "@excalidraw/utils/export"; import { useEffect, useState } from "react"; import { COLOR_PALETTE } from "@excalidraw/common"; import { atom, useAtom } from "../editor-jotai"; import type { LibraryItem } from "../types"; export type SvgCache = Map<LibraryItem["id"], SVGSVGElement>; export...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/hooks/useCreatePortalContainer.ts
packages/excalidraw/hooks/useCreatePortalContainer.ts
import { useState, useLayoutEffect } from "react"; import { THEME } from "@excalidraw/common"; import { useEditorInterface, useExcalidrawContainer } from "../components/App"; import { useUIAppState } from "../context/ui-appState"; export const useCreatePortalContainer = (opts?: { className?: string; parentSelect...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/hooks/useCopiedIndicator.ts
packages/excalidraw/hooks/useCopiedIndicator.ts
import { useCallback, useRef, useState } from "react"; const TIMEOUT = 2000; export const useCopyStatus = () => { const [copyStatus, setCopyStatus] = useState<"success" | null>(null); const timeoutRef = useRef<number>(0); const onCopy = () => { clearTimeout(timeoutRef.current); setCopyStatus("success")...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/hooks/useTransition.ts
packages/excalidraw/hooks/useTransition.ts
import React, { useCallback } from "react"; /** noop polyfill for v17. Subset of API available */ function useTransitionPolyfill() { const startTransition = useCallback((callback: () => void) => callback(), []); return [false, startTransition] as const; } export const useTransition = React.useTransition || useTra...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/hooks/useScrollPosition.ts
packages/excalidraw/hooks/useScrollPosition.ts
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 | null>, ) => { const [scrollPosition, setScrollPosition]...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/Spinner.tsx
packages/excalidraw/components/Spinner.tsx
import React from "react"; import "./Spinner.scss"; const Spinner = ({ size = "1em", circleWidth = 8, synchronized = false, className = "", }: { size?: string | number; circleWidth?: number; synchronized?: boolean; className?: string; }) => { const mountTime = React.useRef(Date.now()); const mount...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/App.tsx
packages/excalidraw/components/App.tsx
import clsx from "clsx"; import throttle from "lodash.throttle"; import React, { useContext } from "react"; import { flushSync } from "react-dom"; import rough from "roughjs/bin/rough"; import { nanoid } from "nanoid"; import { clamp, pointFrom, pointDistance, vector, pointRotateRads, vectorScale, vector...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
true
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/CheckboxItem.tsx
packages/excalidraw/components/CheckboxItem.tsx
import clsx from "clsx"; import React from "react"; import { checkIcon } from "./icons"; import "./CheckboxItem.scss"; export const CheckboxItem: React.FC<{ checked: boolean; onChange: (checked: boolean, event: React.MouseEvent) => void; className?: string; children?: React.ReactNode; }> = ({ children, check...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/ContextMenu.tsx
packages/excalidraw/components/ContextMenu.tsx
import clsx from "clsx"; import React from "react"; import { getShortcutFromShortcutName } from "../actions/shortcuts"; import { t } from "../i18n"; import { useExcalidrawAppState, useExcalidrawElements } from "./App"; import { Popover } from "./Popover"; import "./ContextMenu.scss"; import type { ActionManager } ...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/LibraryMenuHeaderContent.tsx
packages/excalidraw/components/LibraryMenuHeaderContent.tsx
import clsx from "clsx"; import { useCallback, useState } from "react"; import { muteFSAbortError } from "@excalidraw/common"; import { useUIAppState } from "../context/ui-appState"; import { fileOpen } from "../data/filesystem"; import { saveLibraryAsJSON } from "../data/json"; import { libraryItemsAtom } from "../d...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/FixedSideContainer.tsx
packages/excalidraw/components/FixedSideContainer.tsx
import React from "react"; import clsx from "clsx"; import "./FixedSideContainer.scss"; type FixedSideContainerProps = { children: React.ReactNode; side: "top" | "left" | "right"; className?: string; }; export const FixedSideContainer = ({ children, side, className, }: FixedSideContainerProps) => ( <di...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/SearchMenu.tsx
packages/excalidraw/components/SearchMenu.tsx
import { round } from "@excalidraw/math"; import clsx from "clsx"; import debounce from "lodash.debounce"; import { Fragment, memo, useEffect, useMemo, useRef, useState } from "react"; import { CLASSES, EVENT, FONT_FAMILY, FRAME_STYLE, getLineHeight, } from "@excalidraw/common"; import { isElementCompletely...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/ProjectName.tsx
packages/excalidraw/components/ProjectName.tsx
import React, { useState } from "react"; import { focusNearestParent, KEYS } from "@excalidraw/common"; import { useExcalidrawContainer } from "./App"; import "./TextInput.scss"; import "./ProjectName.scss"; type Props = { value: string; onChange: (value: string) => void; label: string; ignoreFocus?: boolea...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/Section.tsx
packages/excalidraw/components/Section.tsx
import React from "react"; import { t } from "../i18n"; import { useExcalidrawContainer } from "./App"; export const Section: React.FC<{ heading: "canvasActions" | "selectedShapeActions" | "shapes"; children?: React.ReactNode | ((heading: React.ReactNode) => React.ReactNode); className?: string; }> = ({ headin...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/LayerUI.tsx
packages/excalidraw/components/LayerUI.tsx
import clsx from "clsx"; import React from "react"; import { CLASSES, DEFAULT_SIDEBAR, TOOL_TYPE, arrayToMap, capitalizeString, isShallowEqual, } from "@excalidraw/common"; import { mutateElement } from "@excalidraw/element"; import { showSelectedShapeActions } from "@excalidraw/element"; import { Shape...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/DefaultSidebar.test.tsx
packages/excalidraw/components/DefaultSidebar.test.tsx
import React from "react"; import { DEFAULT_SIDEBAR } from "@excalidraw/common"; import { DefaultSidebar } from "../index"; import { fireEvent, waitFor, withExcalidrawDimensions, } from "../tests/test-utils"; import { assertExcalidrawWithSidebar, assertSidebarDockButton, } from "./Sidebar/siderbar.test.hel...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/LibraryMenuControlButtons.tsx
packages/excalidraw/components/LibraryMenuControlButtons.tsx
import clsx from "clsx"; import LibraryMenuBrowseButton from "./LibraryMenuBrowseButton"; import type { ExcalidrawProps, UIAppState } from "../types"; export const LibraryMenuControlButtons = ({ libraryReturnUrl, theme, id, style, children, className, }: { libraryReturnUrl: ExcalidrawProps["libraryRetu...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/ImageExportDialog.tsx
packages/excalidraw/components/ImageExportDialog.tsx
import { exportToCanvas } from "@excalidraw/utils/export"; import React, { useEffect, useRef, useState } from "react"; import { DEFAULT_EXPORT_PADDING, EXPORT_IMAGE_TYPES, isFirefox, EXPORT_SCALES, cloneJSON, } from "@excalidraw/common"; import type { NonDeletedExcalidrawElement } from "@excalidraw/element/...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/LibraryMenuSection.tsx
packages/excalidraw/components/LibraryMenuSection.tsx
import React, { memo, useEffect, useState } from "react"; import type { ExcalidrawElement, NonDeleted } from "@excalidraw/element/types"; import { useTransition } from "../hooks/useTransition"; import { EmptyLibraryUnit, LibraryUnit } from "./LibraryUnit"; import type { SvgCache } from "../hooks/useLibraryItemSvg";...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/LibraryUnit.tsx
packages/excalidraw/components/LibraryUnit.tsx
import clsx from "clsx"; import { memo, useRef, useState } from "react"; import { useLibraryItemSvg } from "../hooks/useLibraryItemSvg"; import { useEditorInterface } from "./App"; import { CheckboxItem } from "./CheckboxItem"; import { PlusIcon } from "./icons"; import "./LibraryUnit.scss"; import type { LibraryIt...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/Toast.tsx
packages/excalidraw/components/Toast.tsx
import { useCallback, useEffect, useRef } from "react"; import { CloseIcon } from "./icons"; import { ToolButton } from "./ToolButton"; import "./Toast.scss"; import type { CSSProperties } from "react"; const DEFAULT_TOAST_TIMEOUT = 5000; export const Toast = ({ message, onClose, closable = false, // To pr...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/ElementCanvasButtons.tsx
packages/excalidraw/components/ElementCanvasButtons.tsx
import { sceneCoordsToViewportCoords } from "@excalidraw/common"; import { getElementAbsoluteCoords } from "@excalidraw/element"; import type { ElementsMap, NonDeletedExcalidrawElement, } from "@excalidraw/element/types"; import { useExcalidrawAppState } from "../components/App"; import "./ElementCanvasButtons.s...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/PropertiesPopover.tsx
packages/excalidraw/components/PropertiesPopover.tsx
import * as Popover from "@radix-ui/react-popover"; import clsx from "clsx"; import React, { type ReactNode } from "react"; import { isInteractive } from "@excalidraw/common"; import { useEditorInterface } from "./App"; import { Island } from "./Island"; interface PropertiesPopoverProps { className?: string; con...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/RadioSelection.tsx
packages/excalidraw/components/RadioSelection.tsx
import clsx from "clsx"; import { ButtonIcon } from "./ButtonIcon"; import type { JSX } from "react"; export const RadioSelection = <T extends Object>( props: { options: { value: T; text: string; icon: JSX.Element; testId?: string; /** if not supplied, defaults to value identity c...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/HandButton.tsx
packages/excalidraw/components/HandButton.tsx
import clsx from "clsx"; import { KEYS } from "@excalidraw/common"; import { ToolButton } from "./ToolButton"; import { handIcon } from "./icons"; import "./ToolIcon.scss"; type LockIconProps = { title?: string; name?: string; checked: boolean; onChange?(): void; isMobile?: boolean; }; export const HandB...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/UnlockPopup.tsx
packages/excalidraw/components/UnlockPopup.tsx
import { getCommonBounds, getElementsInGroup, selectGroupsFromGivenElements, } from "@excalidraw/element"; import { sceneCoordsToViewportCoords } from "@excalidraw/common"; import { flushSync } from "react-dom"; import { actionToggleElementLock } from "../actions"; import { t } from "../i18n"; import "./Unlock...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/MagicButton.tsx
packages/excalidraw/components/MagicButton.tsx
import clsx from "clsx"; import "./ToolIcon.scss"; import type { ToolButtonSize } from "./ToolButton"; import type { JSX } from "react"; const DEFAULT_SIZE: ToolButtonSize = "small"; export const ElementCanvasButton = (props: { title?: string; icon: JSX.Element; name?: string; checked: boolean; onChange?(...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/PasteChartDialog.tsx
packages/excalidraw/components/PasteChartDialog.tsx
import oc from "open-color"; import React, { useLayoutEffect, useRef, useState } from "react"; import type { ChartType } from "@excalidraw/element/types"; import { trackEvent } from "../analytics"; import { renderSpreadsheet } from "../charts"; import { t } from "../i18n"; import { exportToSvg } from "../scene/export...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/LibraryMenuBrowseButton.tsx
packages/excalidraw/components/LibraryMenuBrowseButton.tsx
import { VERSIONS } from "@excalidraw/common"; import { t } from "../i18n"; import type { ExcalidrawProps, UIAppState } from "../types"; const LibraryMenuBrowseButton = ({ theme, id, libraryReturnUrl, }: { libraryReturnUrl: ExcalidrawProps["libraryReturnUrl"]; theme: UIAppState["theme"]; id: string; }) =...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/Popover.tsx
packages/excalidraw/components/Popover.tsx
import React, { useLayoutEffect, useRef, useEffect } from "react"; import { unstable_batchedUpdates } from "react-dom"; import { KEYS, queryFocusableElements } from "@excalidraw/common"; import clsx from "clsx"; import "./Popover.scss"; type Props = { top?: number; left?: number; children?: React.ReactNode; ...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/Actions.tsx
packages/excalidraw/components/Actions.tsx
import clsx from "clsx"; import { useRef, useState } from "react"; import * as Popover from "@radix-ui/react-popover"; import { CLASSES, KEYS, capitalizeString, isTransparent, } from "@excalidraw/common"; import { shouldAllowVerticalAlign, suppportsHorizontalAlign, hasBoundTextElement, isElbowArrow, ...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
true
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/Switch.tsx
packages/excalidraw/components/Switch.tsx
import clsx from "clsx"; import "./Switch.scss"; export type SwitchProps = { name: string; checked: boolean; title?: string; onChange: (value: boolean) => void; disabled?: boolean; }; export const Switch = ({ title, name, checked, onChange, disabled = false, }: SwitchProps) => { return ( <d...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/Card.tsx
packages/excalidraw/components/Card.tsx
import OpenColor from "open-color"; import "./Card.scss"; export const Card: React.FC<{ color: keyof OpenColor | "primary"; children?: React.ReactNode; }> = ({ children, color }) => { return ( <div className="Card" style={{ ["--card-color" as any]: color === "primary" ? "var(--...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/HelpDialog.tsx
packages/excalidraw/components/HelpDialog.tsx
import React from "react"; import { isDarwin, isFirefox, isWindows } from "@excalidraw/common"; import { KEYS } from "@excalidraw/common"; import { getShortcutFromShortcutName } from "../actions/shortcuts"; import { probablySupportsClipboardBlob } from "../clipboard"; import { t } from "../i18n"; import { getShortcu...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/JSONExportDialog.tsx
packages/excalidraw/components/JSONExportDialog.tsx
import React from "react"; import { getFrame } from "@excalidraw/common"; import type { NonDeletedExcalidrawElement } from "@excalidraw/element/types"; import { actionSaveFileToDisk } from "../actions/actionExport"; import { trackEvent } from "../analytics"; import { nativeFileSystemSupported } from "../data/filesy...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/LaserPointerButton.tsx
packages/excalidraw/components/LaserPointerButton.tsx
import clsx from "clsx"; import "./ToolIcon.scss"; import { laserPointerToolIcon } from "./icons"; import type { ToolButtonSize } from "./ToolButton"; type LaserPointerIconProps = { title?: string; name?: string; checked: boolean; onChange?(): void; isMobile?: boolean; }; const DEFAULT_SIZE: ToolButtonSi...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/ToolPopover.tsx
packages/excalidraw/components/ToolPopover.tsx
import React, { useEffect, useState } from "react"; import clsx from "clsx"; import { capitalizeString } from "@excalidraw/common"; import * as Popover from "@radix-ui/react-popover"; import { trackEvent } from "../analytics"; import { ToolButton } from "./ToolButton"; import "./ToolPopover.scss"; import { useExc...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/RadioGroup.tsx
packages/excalidraw/components/RadioGroup.tsx
import clsx from "clsx"; import "./RadioGroup.scss"; export type RadioGroupChoice<T> = { value: T; label: React.ReactNode; ariaLabel?: string; }; export type RadioGroupProps<T> = { choices: RadioGroupChoice<T>[]; value: T; onChange: (value: T) => void; name: string; }; export const RadioGroup = functi...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/Island.tsx
packages/excalidraw/components/Island.tsx
import React from "react"; import clsx from "clsx"; import "./Island.scss"; type IslandProps = { children: React.ReactNode; padding?: number; className?: string | boolean; style?: object; }; export const Island = React.forwardRef<HTMLDivElement, IslandProps>( ({ children, padding, className, style }, ref) ...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/EyeDropper.tsx
packages/excalidraw/components/EyeDropper.tsx
import { useEffect, useRef } from "react"; import { createPortal } from "react-dom"; import { EVENT, KEYS, rgbToHex } from "@excalidraw/common"; import type { ExcalidrawElement } from "@excalidraw/element/types"; import { useUIAppState } from "../context/ui-appState"; import { atom } from "../editor-jotai"; import {...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/ExcalidrawLogo.tsx
packages/excalidraw/components/ExcalidrawLogo.tsx
import "./ExcalidrawLogo.scss"; const LogoIcon = () => ( <svg viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg" className="ExcalidrawLogo-icon" > <path d="M39.9 32.889a.326.326 0 0 0-.279-.056c-2.094-3.083-4.774-6-7.343-8.833l-.419-.472a.212.212 0 0 0-.056-.139.586.586 0 ...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/ButtonSeparator.tsx
packages/excalidraw/components/ButtonSeparator.tsx
export const ButtonSeparator = () => ( <div style={{ width: 1, height: "1rem", backgroundColor: "var(--default-border-color)", margin: "0 auto", }} /> );
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/Trans.test.tsx
packages/excalidraw/components/Trans.test.tsx
import { render } from "@testing-library/react"; import { EditorJotaiProvider } from "../editor-jotai"; import fallbackLangData from "../locales/en.json"; import Trans from "./Trans"; import type { TranslationKeys } from "../i18n"; describe("Test <Trans/>", () => { it("should translate the the strings correctly",...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/Dialog.tsx
packages/excalidraw/components/Dialog.tsx
import clsx from "clsx"; import React, { useEffect, useState } from "react"; import { KEYS, queryFocusableElements } from "@excalidraw/common"; import { useSetAtom } from "../editor-jotai"; import { useCallbackRefState } from "../hooks/useCallbackRefState"; import { t } from "../i18n"; import { useExcalidrawContai...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/ToolButton.tsx
packages/excalidraw/components/ToolButton.tsx
import clsx from "clsx"; import React, { useEffect, useRef, useState } from "react"; import { isPromiseLike } from "@excalidraw/common"; import type { PointerType } from "@excalidraw/element/types"; import { AbortError } from "../errors"; import "./ToolIcon.scss"; import Spinner from "./Spinner"; import { useExcal...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/DarkModeToggle.tsx
packages/excalidraw/components/DarkModeToggle.tsx
import { THEME } from "@excalidraw/common"; import type { Theme } from "@excalidraw/element/types"; import { t } from "../i18n"; import { ToolButton } from "./ToolButton"; import "./ToolIcon.scss"; // We chose to use only explicit toggle and not a third option for system value, // but this could be added in the fu...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/DialogActionButton.tsx
packages/excalidraw/components/DialogActionButton.tsx
import clsx from "clsx"; import Spinner from "./Spinner"; import "./DialogActionButton.scss"; import type { ReactNode } from "react"; interface DialogActionButtonProps { label: string; children?: ReactNode; actionType?: "primary" | "danger"; isLoading?: boolean; } const DialogActionButton = ({ label, o...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/Range.tsx
packages/excalidraw/components/Range.tsx
import React, { useEffect } from "react"; import { t } from "../i18n"; import "./Range.scss"; import type { AppClassProperties } from "../types"; export type RangeProps = { updateData: (value: number) => void; app: AppClassProperties; testId?: string; }; export const Range = ({ updateData, app, testId }: Ran...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/Trans.tsx
packages/excalidraw/components/Trans.tsx
import React from "react"; import { useI18n } from "../i18n"; import type { TranslationKeys } from "../i18n"; // Used for splitting i18nKey into tokens in Trans component // Example: // "Please <link>click {{location}}</link> to continue.".split(SPLIT_REGEX).filter(Boolean) // produces // ["Please ", "<link>", "clic...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/Ellipsify.tsx
packages/excalidraw/components/Ellipsify.tsx
export const Ellipsify = ({ children, ...rest }: { children: React.ReactNode } & React.HTMLAttributes<HTMLSpanElement>) => { return ( <span {...rest} style={{ textOverflow: "ellipsis", overflow: "hidden", whiteSpace: "nowrap", ...rest.style, }} > {ch...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/Paragraph.tsx
packages/excalidraw/components/Paragraph.tsx
export const Paragraph = (props: { children: React.ReactNode; style?: React.CSSProperties; }) => { return ( <p className="excalidraw__paragraph" style={props.style}> {props.children} </p> ); };
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/Modal.tsx
packages/excalidraw/components/Modal.tsx
import clsx from "clsx"; import { useRef } from "react"; import { createPortal } from "react-dom"; import { KEYS } from "@excalidraw/common"; import { useCreatePortalContainer } from "../hooks/useCreatePortalContainer"; import "./Modal.scss"; import type { AppState } from "../types"; export const Modal: React.FC<{...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/SVGLayer.tsx
packages/excalidraw/components/SVGLayer.tsx
import { useEffect, useRef } from "react"; import "./SVGLayer.scss"; import type { Trail } from "../animated-trail"; type SVGLayerProps = { trails: Trail[]; }; export const SVGLayer = ({ trails }: SVGLayerProps) => { const svgRef = useRef<SVGSVGElement | null>(null); useEffect(() => { if (svgRef.current)...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/ActiveConfirmDialog.tsx
packages/excalidraw/components/ActiveConfirmDialog.tsx
import { actionClearCanvas } from "../actions"; import { atom, useAtom } from "../editor-jotai"; import { t } from "../i18n"; import { useExcalidrawActionManager } from "./App"; import ConfirmDialog from "./ConfirmDialog"; export const activeConfirmDialogAtom = atom<"clearCanvas" | null>(null); export const ActiveCo...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/ConfirmDialog.tsx
packages/excalidraw/components/ConfirmDialog.tsx
import { flushSync } from "react-dom"; import { useSetAtom } from "../editor-jotai"; import { t } from "../i18n"; import { Dialog } from "./Dialog"; import DialogActionButton from "./DialogActionButton"; import { isLibraryMenuOpenAtom } from "./LibraryMenu"; import { useExcalidrawContainer, useExcalidrawSetAppState }...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/LoadingMessage.tsx
packages/excalidraw/components/LoadingMessage.tsx
import clsx from "clsx"; import { useState, useEffect } from "react"; import { THEME } from "@excalidraw/common"; import type { Theme } from "@excalidraw/element/types"; import { t } from "../i18n"; import Spinner from "./Spinner"; export const LoadingMessage: React.FC<{ delay?: number; theme?: Theme }> = ({ del...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/InlineIcon.tsx
packages/excalidraw/components/InlineIcon.tsx
export const InlineIcon = ({ className, icon, size = "1em", }: { className?: string; icon: React.ReactNode; size?: string; }) => { return ( <span className={className} style={{ width: size, height: "100%", margin: "0 0.5ex 0 0.5ex", display: "inline-flex", ...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/PenModeButton.tsx
packages/excalidraw/components/PenModeButton.tsx
import clsx from "clsx"; import "./ToolIcon.scss"; import { PenModeIcon } from "./icons"; import type { ToolButtonSize } from "./ToolButton"; type PenModeIconProps = { title?: string; name?: string; checked: boolean; onChange?(): void; zenModeEnabled?: boolean; isMobile?: boolean; penDetected: boolean...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/Button.tsx
packages/excalidraw/components/Button.tsx
import clsx from "clsx"; import React from "react"; import { composeEventHandlers } from "@excalidraw/common"; import "./Button.scss"; interface ButtonProps extends React.DetailedHTMLProps< React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement > { type?: "button" | "submit" | "reset"; onSe...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/ErrorDialog.tsx
packages/excalidraw/components/ErrorDialog.tsx
import React, { useState } from "react"; import { t } from "../i18n"; import { useExcalidrawContainer } from "./App"; import { Dialog } from "./Dialog"; export const ErrorDialog = ({ children, onClose, }: { children?: React.ReactNode; onClose?: () => void; }) => { const [modalIsShown, setModalIsShown] = us...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false
excalidraw/excalidraw
https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/excalidraw/components/DefaultSidebar.tsx
packages/excalidraw/components/DefaultSidebar.tsx
import clsx from "clsx"; import { CANVAS_SEARCH_TAB, DEFAULT_SIDEBAR, LIBRARY_SIDEBAR_TAB, composeEventHandlers, } from "@excalidraw/common"; import type { MarkOptional, Merge } from "@excalidraw/common/utility-types"; import { useTunnels } from "../context/tunnels"; import { useUIAppState } from "../context...
typescript
MIT
63e1148280163a36326b7efb5fdfeefebabdb3e4
2026-01-04T15:25:31.673879Z
false