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/math/global.d.ts | packages/math/global.d.ts | /// <reference types="vite/client" />
import "@excalidraw/excalidraw/global";
import "@excalidraw/excalidraw/css";
| typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/math/src/segment.ts | packages/math/src/segment.ts | import { line, linesIntersectAt } from "./line";
import {
isPoint,
pointCenter,
pointFromVector,
pointRotateRads,
} from "./point";
import { PRECISION } from "./utils";
import {
vectorAdd,
vectorCross,
vectorFromPoint,
vectorScale,
vectorSubtract,
} from "./vector";
import type { GlobalPoint, LineSeg... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/math/src/range.ts | packages/math/src/range.ts | import { toBrandedType } from "@excalidraw/common";
import type { InclusiveRange } from "./types";
/**
* Create an inclusive range from the two numbers provided.
*
* @param start Start of the range
* @param end End of the range
* @returns
*/
export function rangeInclusive(start: number, end: number): InclusiveR... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/math/src/line.ts | packages/math/src/line.ts | import { pointFrom } from "./point";
import type { GlobalPoint, Line, LocalPoint } from "./types";
/**
* Create a line from two points.
*
* @param points The two points lying on the line
* @returns The line on which the points lie
*/
export function line<P extends GlobalPoint | LocalPoint>(a: P, b: P): Line<P> {... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/math/src/utils.ts | packages/math/src/utils.ts | export const PRECISION = 10e-5;
export const clamp = (value: number, min: number, max: number) => {
return Math.min(Math.max(value, min), max);
};
export const round = (
value: number,
precision: number,
func: "round" | "floor" | "ceil" = "round",
) => {
const multiplier = Math.pow(10, precision);
return... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/math/src/ellipse.ts | packages/math/src/ellipse.ts | import {
pointFrom,
pointDistance,
pointFromVector,
pointsEqual,
} from "./point";
import { PRECISION } from "./utils";
import {
vector,
vectorAdd,
vectorDot,
vectorFromPoint,
vectorScale,
} from "./vector";
import type {
Ellipse,
GlobalPoint,
Line,
LineSegment,
LocalPoint,
} from "./types"... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/math/src/angle.ts | packages/math/src/angle.ts | import { PRECISION } from "./utils";
import type {
Degrees,
GlobalPoint,
LocalPoint,
PolarCoords,
Radians,
} from "./types";
export const normalizeRadians = (angle: Radians): Radians =>
angle < 0
? (((angle % (2 * Math.PI)) + 2 * Math.PI) as Radians)
: ((angle % (2 * Math.PI)) as Radians);
/**
*... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/math/src/polygon.ts | packages/math/src/polygon.ts | import { pointsEqual } from "./point";
import { lineSegment, pointOnLineSegment } from "./segment";
import { PRECISION } from "./utils";
import type { GlobalPoint, LocalPoint, Polygon } from "./types";
export function polygon<Point extends GlobalPoint | LocalPoint>(
...points: Point[]
) {
return polygonClose(poin... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/math/src/rectangle.ts | packages/math/src/rectangle.ts | import { pointFrom } from "./point";
import { lineSegment, lineSegmentIntersectionPoints } from "./segment";
import type { GlobalPoint, LineSegment, LocalPoint, Rectangle } from "./types";
export function rectangle<P extends GlobalPoint | LocalPoint>(
topLeft: P,
bottomRight: P,
): Rectangle<P> {
return [topLef... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/math/src/curve.ts | packages/math/src/curve.ts | import { isPoint, pointDistance, pointFrom, pointFromVector } from "./point";
import { vector, vectorNormal, vectorNormalize, vectorScale } from "./vector";
import { LegendreGaussN24CValues, LegendreGaussN24TValues } from "./constants";
import type { Curve, GlobalPoint, LineSegment, LocalPoint } from "./types";
/**
... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/math/src/triangle.ts | packages/math/src/triangle.ts | import type { GlobalPoint, LocalPoint, Triangle } from "./types";
// Types
/**
* Tests if a point lies inside a triangle. This function
* will return FALSE if the point lies exactly on the sides
* of the triangle.
*
* @param triangle The triangle to test the point for
* @param p The point to test whether is in ... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/math/src/point.ts | packages/math/src/point.ts | import { degreesToRadians } from "./angle";
import { PRECISION } from "./utils";
import { vectorFromPoint, vectorScale } from "./vector";
import type {
LocalPoint,
GlobalPoint,
Radians,
Degrees,
Vector,
} from "./types";
/**
* Create a properly typed Point instance from the X and Y coordinates.
*
* @para... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/math/src/constants.ts | packages/math/src/constants.ts | export const PRECISION = 10e-5;
// Legendre-Gauss abscissae (x values) and weights for n=24
// Refeerence: https://pomax.github.io/bezierinfo/legendre-gauss.html
export const LegendreGaussN24TValues = [
-0.0640568928626056260850430826247450385909,
0.0640568928626056260850430826247450385909,
-0.191118867473616309... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/math/src/types.ts | packages/math/src/types.ts | //
// Measurements
//
/**
* By definition one radian is the angle subtended at the centre
* of a circle by an arc that is equal in length to the radius.
*/
export type Radians = number & { _brand: "excalimath__radian" };
/**
* An angle measurement of a plane angle in which one full
* rotation is 360 degrees.
*/... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/math/src/index.ts | packages/math/src/index.ts | export * from "./angle";
export * from "./curve";
export * from "./ellipse";
export * from "./line";
export * from "./point";
export * from "./polygon";
export * from "./range";
export * from "./rectangle";
export * from "./segment";
export * from "./triangle";
export * from "./types";
export * from "./vector";
export ... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/math/src/vector.ts | packages/math/src/vector.ts | import type { GlobalPoint, LocalPoint, Vector } from "./types";
/**
* Create a vector from the x and y coordiante elements.
*
* @param x The X aspect of the vector
* @param y T Y aspect of the vector
* @returns The constructed vector with X and Y as the coordinates
*/
export function vector(
x: number,
y: nu... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/math/tests/line.test.ts | packages/math/tests/line.test.ts | import { line, linesIntersectAt } from "../src/line";
import { pointFrom } from "../src/point";
describe("line-line intersections", () => {
it("should correctly detect intersection at origin", () => {
expect(
linesIntersectAt(
line(pointFrom(-5, -5), pointFrom(5, 5)),
line(pointFrom(5, -5),... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/math/tests/point.test.ts | packages/math/tests/point.test.ts | import { pointFrom, pointRotateRads } from "../src/point";
import type { Radians } from "../src/types";
describe("rotate", () => {
it("should rotate over (x2, y2) and return the rotated coordinates for (x1, y1)", () => {
const x1 = 10;
const y1 = 20;
const x2 = 20;
const y2 = 30;
const angle = (... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/math/tests/range.test.ts | packages/math/tests/range.test.ts | import { rangeInclusive, rangeIntersection, rangesOverlap } from "../src/range";
describe("range overlap", () => {
const range1_4 = rangeInclusive(1, 4);
it("should overlap when range a contains range b", () => {
expect(rangesOverlap(range1_4, rangeInclusive(2, 3))).toBe(true);
expect(rangesOverlap(range1... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/math/tests/ellipse.test.ts | packages/math/tests/ellipse.test.ts | import {
ellipse,
ellipseSegmentInterceptPoints,
ellipseIncludesPoint,
ellipseTouchesPoint,
ellipseLineIntersectionPoints,
} from "../src/ellipse";
import { line } from "../src/line";
import { pointFrom } from "../src/point";
import { lineSegment } from "../src/segment";
import type { Ellipse, GlobalPoint } ... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/math/tests/segment.test.ts | packages/math/tests/segment.test.ts | import { pointFrom } from "../src/point";
import { lineSegment, lineSegmentIntersectionPoints } from "../src/segment";
describe("line-segment intersections", () => {
it("should correctly detect intersection", () => {
expect(
lineSegmentIntersectionPoints(
lineSegment(pointFrom(0, 0), pointFrom(5, 0... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/math/tests/vector.test.ts | packages/math/tests/vector.test.ts | import { isVector } from "../src/vector";
describe("Vector", () => {
test("isVector", () => {
expect(isVector([5, 5])).toBe(true);
expect(isVector([-5, -5])).toBe(true);
expect(isVector([5, 0.5])).toBe(true);
expect(isVector(null)).toBe(false);
expect(isVector(undefined)).toBe(false);
expect(... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/math/tests/curve.test.ts | packages/math/tests/curve.test.ts | import "@excalidraw/utils/test-utils";
import {
curve,
curveClosestPoint,
curveIntersectLineSegment,
curvePointDistance,
} from "../src/curve";
import { pointFrom } from "../src/point";
import { lineSegment } from "../src/segment";
describe("Math curve", () => {
describe("line segment intersection", () => {... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/global.d.ts | packages/element/global.d.ts | /// <reference types="vite/client" />
import "@excalidraw/excalidraw/global";
import "@excalidraw/excalidraw/css";
| typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/collision.ts | packages/element/src/collision.ts | import { invariant, isTransparent, type Bounds } from "@excalidraw/common";
import {
curveIntersectLineSegment,
isPointWithinBounds,
lineSegment,
lineSegmentIntersectionPoints,
pointFrom,
pointFromVector,
pointRotateRads,
pointsEqual,
vectorFromPoint,
vectorNormalize,
vectorScale,
} from "@excalid... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/textWrapping.ts | packages/element/src/textWrapping.ts | import { isDevEnv, isTestEnv } from "@excalidraw/common";
import { charWidth, getLineWidth } from "./textMeasurements";
import type { FontString } from "./types";
let cachedCjkRegex: RegExp | undefined;
let cachedLineBreakRegex: RegExp | undefined;
let cachedEmojiRegex: RegExp | undefined;
/**
* Test if a given te... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/align.ts | packages/element/src/align.ts | import type { AppState } from "@excalidraw/excalidraw/types";
import { updateBoundElements } from "./binding";
import { getCommonBoundingBox } from "./bounds";
import { getSelectedElementsByGroup } from "./groups";
import type { Scene } from "./Scene";
import type { BoundingBox } from "./bounds";
import type { Excal... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/elbowArrow.ts | packages/element/src/elbowArrow.ts | import {
clamp,
pointDistance,
pointFrom,
pointScaleFromOrigin,
pointsEqual,
pointTranslate,
vector,
vectorCross,
vectorFromPoint,
vectorScale,
type GlobalPoint,
type LocalPoint,
} from "@excalidraw/math";
import {
type Bounds,
BinaryHeap,
invariant,
isAnyTrue,
getSizeFromPoints,
is... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | true |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/textMeasurements.ts | packages/element/src/textMeasurements.ts | import {
BOUND_TEXT_PADDING,
DEFAULT_FONT_SIZE,
DEFAULT_FONT_FAMILY,
getFontString,
isTestEnv,
normalizeEOL,
} from "@excalidraw/common";
import type { FontString, ExcalidrawTextElement } from "./types";
export const measureText = (
text: string,
font: FontString,
lineHeight: ExcalidrawTextElement["... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/embeddable.ts | packages/element/src/embeddable.ts | import {
FONT_FAMILY,
VERTICAL_ALIGN,
escapeDoubleQuotes,
getFontString,
} from "@excalidraw/common";
import type { ExcalidrawProps } from "@excalidraw/excalidraw/types";
import type { MarkRequired } from "@excalidraw/common/utility-types";
import { newTextElement } from "./newElement";
import { wrapText } fr... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/transform.ts | packages/element/src/transform.ts | import { pointFrom, type LocalPoint } from "@excalidraw/math";
import {
DEFAULT_FONT_FAMILY,
DEFAULT_FONT_SIZE,
TEXT_ALIGN,
VERTICAL_ALIGN,
getSizeFromPoints,
randomId,
arrayToMap,
assertNever,
cloneJSON,
getFontString,
isDevEnv,
toBrandedType,
getLineHeight,
} from "@excalidraw/common";
imp... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/shape.ts | packages/element/src/shape.ts | import { simplify } from "points-on-curve";
import { getStroke } from "perfect-freehand";
import {
type GeometricShape,
getClosedCurveShape,
getCurveShape,
getEllipseShape,
getFreedrawShape,
getPolygonShape,
} from "@excalidraw/utils/shape";
import {
pointFrom,
pointDistance,
type LocalPoint,
poin... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/typeChecks.ts | packages/element/src/typeChecks.ts | import { ROUNDNESS, assertNever } from "@excalidraw/common";
import { pointsEqual } from "@excalidraw/math";
import type { ElementOrToolType } from "@excalidraw/excalidraw/types";
import type { MarkNonNullable } from "@excalidraw/common/utility-types";
import type {
ExcalidrawElement,
ExcalidrawTextElement,
E... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/Scene.ts | packages/element/src/Scene.ts | import throttle from "lodash.throttle";
import {
randomInteger,
arrayToMap,
toBrandedType,
isDevEnv,
isTestEnv,
toArray,
} from "@excalidraw/common";
import { isNonDeletedElement } from "@excalidraw/element";
import { isFrameLikeElement } from "@excalidraw/element";
import { getElementsInGroup } from "@exc... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/frame.ts | packages/element/src/frame.ts | import { arrayToMap } from "@excalidraw/common";
import { isPointWithinBounds, pointFrom } from "@excalidraw/math";
import { doLineSegmentsIntersect } from "@excalidraw/utils/bbox";
import { elementsOverlappingBBox } from "@excalidraw/utils/withinBounds";
import type {
AppClassProperties,
AppState,
StaticCanvasA... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/renderElement.ts | packages/element/src/renderElement.ts | import rough from "roughjs/bin/rough";
import {
type GlobalPoint,
isRightAngleRads,
lineSegment,
pointFrom,
pointRotateRads,
type Radians,
} from "@excalidraw/math";
import {
BOUND_TEXT_PADDING,
DEFAULT_REDUCED_GLOBAL_ALPHA,
ELEMENT_READY_TO_ERASE_OPACITY,
FRAME_STYLE,
MIME_TYPES,
THEME,
dis... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | true |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/textElement.ts | packages/element/src/textElement.ts | import {
ARROW_LABEL_FONT_SIZE_TO_MIN_WIDTH_RATIO,
ARROW_LABEL_WIDTH_FRACTION,
BOUND_TEXT_PADDING,
DEFAULT_FONT_SIZE,
TEXT_ALIGN,
VERTICAL_ALIGN,
getFontString,
isProdEnv,
invariant,
} from "@excalidraw/common";
import { pointFrom, pointRotateRads, type Radians } from "@excalidraw/math";
import type... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/sizeHelpers.ts | packages/element/src/sizeHelpers.ts | import {
SHIFT_LOCKING_ANGLE,
viewportCoordsToSceneCoords,
} from "@excalidraw/common";
import {
normalizeRadians,
radiansBetweenAngles,
radiansDifference,
type Radians,
} from "@excalidraw/math";
import { pointsEqual } from "@excalidraw/math";
import type { AppState, Offsets, Zoom } from "@excalidraw/exc... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/utils.ts | packages/element/src/utils.ts | import {
DEFAULT_ADAPTIVE_RADIUS,
DEFAULT_PROPORTIONAL_RADIUS,
invariant,
LINE_CONFIRM_THRESHOLD,
ROUNDNESS,
} from "@excalidraw/common";
import {
curve,
curveCatmullRomCubicApproxPoints,
curveOffsetPoints,
lineSegment,
lineSegmentIntersectionPoints,
pointDistance,
pointFrom,
pointFromArray,
... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/comparisons.ts | packages/element/src/comparisons.ts | import type { ElementOrToolType } from "@excalidraw/excalidraw/types";
export const hasBackground = (type: ElementOrToolType) =>
type === "rectangle" ||
type === "iframe" ||
type === "embeddable" ||
type === "ellipse" ||
type === "diamond" ||
type === "line" ||
type === "freedraw";
export const hasStrok... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/cropElement.ts | packages/element/src/cropElement.ts | import {
type Radians,
pointFrom,
pointCenter,
pointRotateRads,
vectorFromPoint,
vectorNormalize,
vectorSubtract,
vectorAdd,
vectorScale,
pointFromVector,
clamp,
isCloseTo,
} from "@excalidraw/math";
import { type Point } from "points-on-curve";
import {
elementCenterPoint,
getElementAbsolu... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/delta.ts | packages/element/src/delta.ts | import {
arrayToMap,
arrayToObject,
assertNever,
isDevEnv,
isShallowEqual,
isTestEnv,
randomInteger,
} from "@excalidraw/common";
import type {
ExcalidrawElement,
ExcalidrawFreeDrawElement,
ExcalidrawLinearElement,
ExcalidrawTextElement,
NonDeleted,
Ordered,
OrderedExcalidrawElement,
Scen... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | true |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/resizeTest.ts | packages/element/src/resizeTest.ts | import {
pointFrom,
pointOnLineSegment,
pointRotateRads,
type Radians,
} from "@excalidraw/math";
import {
SIDE_RESIZING_THRESHOLD,
type EditorInterface,
} from "@excalidraw/common";
import type { GlobalPoint, LineSegment, LocalPoint } from "@excalidraw/math";
import type { AppState, Zoom } from "@excali... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/showSelectedShapeActions.ts | packages/element/src/showSelectedShapeActions.ts | import type { UIAppState } from "@excalidraw/excalidraw/types";
import { getSelectedElements } from "./selection";
import type { NonDeletedExcalidrawElement } from "./types";
export const showSelectedShapeActions = (
appState: UIAppState,
elements: readonly NonDeletedExcalidrawElement[],
) =>
Boolean(
!app... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/bounds.ts | packages/element/src/bounds.ts | import rough from "roughjs/bin/rough";
import {
arrayToMap,
type Bounds,
invariant,
rescalePoints,
sizeOf,
} from "@excalidraw/common";
import {
degreesToRadians,
lineSegment,
pointDistance,
pointFrom,
pointFromArray,
pointRotateRads,
} from "@excalidraw/math";
import { getCurvePathOps } from "... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | true |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/distance.ts | packages/element/src/distance.ts | import {
curvePointDistance,
distanceToLineSegment,
pointRotateRads,
} from "@excalidraw/math";
import { ellipse, ellipseDistanceFromPoint } from "@excalidraw/math/ellipse";
import type { GlobalPoint, Radians } from "@excalidraw/math";
import {
deconstructDiamondElement,
deconstructLinearOrFreeDrawElement,... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/zindex.ts | packages/element/src/zindex.ts | import { arrayToMap, findIndex, findLastIndex } from "@excalidraw/common";
import type { AppState } from "@excalidraw/excalidraw/types";
import type { GlobalPoint } from "@excalidraw/math";
import { isFrameLikeElement, isTextElement } from "./typeChecks";
import { getElementsInGroup } from "./groups";
import { syncMo... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/elementLink.ts | packages/element/src/elementLink.ts | /**
* Create and link between shapes.
*/
import { ELEMENT_LINK_KEY, normalizeLink } from "@excalidraw/common";
import type { AppProps, AppState } from "@excalidraw/excalidraw/types";
import { elementsAreInSameGroup } from "./groups";
import type { ExcalidrawElement } from "./types";
export const defaultGetElemen... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/duplicate.ts | packages/element/src/duplicate.ts | import {
ORIG_ID,
randomId,
randomInteger,
arrayToMap,
castArray,
findLastIndex,
getUpdatedTimestamp,
isTestEnv,
} from "@excalidraw/common";
import type { Mutable } from "@excalidraw/common/utility-types";
import type { AppState } from "@excalidraw/excalidraw/types";
import {
getElementsInGroup,
... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/store.ts | packages/element/src/store.ts | import {
assertNever,
COLOR_PALETTE,
isDevEnv,
isTestEnv,
randomId,
Emitter,
toIterable,
} from "@excalidraw/common";
import type App from "@excalidraw/excalidraw/components/App";
import type { DTO, ValueOf } from "@excalidraw/common/utility-types";
import type { AppState, ObservedAppState } from "@exc... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/linearElementEditor.ts | packages/element/src/linearElementEditor.ts | import {
pointCenter,
pointFrom,
pointRotateRads,
pointsEqual,
type GlobalPoint,
type LocalPoint,
pointDistance,
vectorFromPoint,
curveLength,
curvePointAtLength,
lineSegment,
} from "@excalidraw/math";
import { getCurvePathOps } from "@excalidraw/utils/shape";
import {
DRAGGING_THRESHOLD,
K... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | true |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/transformHandles.ts | packages/element/src/transformHandles.ts | import {
DEFAULT_TRANSFORM_HANDLE_SPACING,
type EditorInterface,
} from "@excalidraw/common";
import { pointFrom, pointRotateRads } from "@excalidraw/math";
import type { Radians } from "@excalidraw/math";
import type {
InteractiveCanvasAppState,
Zoom,
} from "@excalidraw/excalidraw/types";
import type { Bou... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/flowchart.ts | packages/element/src/flowchart.ts | import { KEYS, invariant, toBrandedType } from "@excalidraw/common";
import { type GlobalPoint, pointFrom, type LocalPoint } from "@excalidraw/math";
import type {
AppState,
PendingExcalidrawElements,
} from "@excalidraw/excalidraw/types";
import { bindBindingElement } from "./binding";
import { updateElbowArrow... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/dragElements.ts | packages/element/src/dragElements.ts | import {
type Bounds,
TEXT_AUTOWRAP_THRESHOLD,
getGridPoint,
getFontString,
DRAGGING_THRESHOLD,
} from "@excalidraw/common";
import type {
AppState,
NormalizedZoomValue,
NullableGridSize,
PointerDownState,
} from "@excalidraw/excalidraw/types";
import type { NonDeletedExcalidrawElement } from "@exca... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/fractionalIndex.ts | packages/element/src/fractionalIndex.ts | import { generateNKeysBetween } from "fractional-indexing";
import { arrayToMap } from "@excalidraw/common";
import { mutateElement, newElementWith } from "./mutateElement";
import { getBoundTextElement } from "./textElement";
import { hasBoundTextElement } from "./typeChecks";
import type {
ElementsMap,
Excalid... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/binding.ts | packages/element/src/binding.ts | import {
KEYS,
arrayToMap,
getFeatureFlag,
invariant,
isTransparent,
} from "@excalidraw/common";
import {
PRECISION,
clamp,
lineSegment,
pointDistance,
pointDistanceSq,
pointFrom,
pointFromVector,
pointRotateRads,
vectorFromPoint,
vectorNormalize,
vectorScale,
type GlobalPoint,
} fro... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | true |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/mutateElement.ts | packages/element/src/mutateElement.ts | import {
getSizeFromPoints,
randomInteger,
getUpdatedTimestamp,
} from "@excalidraw/common";
import type { Radians } from "@excalidraw/math";
import type { Mutable } from "@excalidraw/common/utility-types";
import { ShapeCache } from "./shape";
import { updateElbowArrowPoints } from "./elbowArrow";
import { ... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/heading.ts | packages/element/src/heading.ts | import {
invariant,
isDevEnv,
isTestEnv,
type Bounds,
} from "@excalidraw/common";
import {
pointFrom,
pointFromVector,
pointRotateRads,
pointScaleFromOrigin,
pointsEqual,
triangleIncludesPoint,
vectorCross,
vectorFromPoint,
vectorScale,
} from "@excalidraw/math";
import type {
LocalPoint,... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/resizeElements.ts | packages/element/src/resizeElements.ts | import {
pointCenter,
normalizeRadians,
pointFrom,
pointRotateRads,
type Radians,
type LocalPoint,
} from "@excalidraw/math";
import {
MIN_FONT_SIZE,
SHIFT_LOCKING_ANGLE,
rescalePoints,
getFontString,
} from "@excalidraw/common";
import type { GlobalPoint } from "@excalidraw/math";
import type { ... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | true |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/selection.ts | packages/element/src/selection.ts | import { arrayToMap, isShallowEqual } from "@excalidraw/common";
import type {
AppState,
InteractiveCanvasAppState,
} from "@excalidraw/excalidraw/types";
import { getElementAbsoluteCoords, getElementBounds } from "./bounds";
import { isElementInViewport } from "./sizeHelpers";
import {
isBoundToContainer,
is... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/types.ts | packages/element/src/types.ts | import type { LocalPoint, Radians } from "@excalidraw/math";
import type {
FONT_FAMILY,
ROUNDNESS,
TEXT_ALIGN,
THEME,
VERTICAL_ALIGN,
} from "@excalidraw/common";
import type {
MakeBrand,
MarkNonNullable,
Merge,
ValueOf,
} from "@excalidraw/common/utility-types";
export type ChartType = "bar" | "li... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/positionElementsOnGrid.ts | packages/element/src/positionElementsOnGrid.ts | import { getCommonBounds } from "./bounds";
import { type ElementUpdate, newElementWith } from "./mutateElement";
import type { ExcalidrawElement } from "./types";
// TODO rewrite (mostly vibe-coded)
export const positionElementsOnGrid = <TElement extends ExcalidrawElement>(
elements: TElement[] | TElement[][],
c... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/newElement.ts | packages/element/src/newElement.ts | import {
DEFAULT_ELEMENT_PROPS,
DEFAULT_FONT_FAMILY,
DEFAULT_FONT_SIZE,
DEFAULT_TEXT_ALIGN,
DEFAULT_VERTICAL_ALIGN,
VERTICAL_ALIGN,
randomInteger,
randomId,
getFontString,
getUpdatedTimestamp,
getLineHeight,
} from "@excalidraw/common";
import type { Radians } from "@excalidraw/math";
import typ... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/sortElements.ts | packages/element/src/sortElements.ts | import { arrayToMapWithIndex } from "@excalidraw/common";
import type { ExcalidrawElement } from "./types";
const normalizeGroupElementOrder = (elements: readonly ExcalidrawElement[]) => {
const origElements: ExcalidrawElement[] = elements.slice();
const sortedElements = new Set<ExcalidrawElement>();
const ord... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/distribute.ts | packages/element/src/distribute.ts | import type { AppState } from "@excalidraw/excalidraw/types";
import { getCommonBoundingBox } from "./bounds";
import { newElementWith } from "./mutateElement";
import { getSelectedElementsByGroup } from "./groups";
import type { ElementsMap, ExcalidrawElement } from "./types";
export interface Distribution {
spa... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/index.ts | packages/element/src/index.ts | import { toIterable } from "@excalidraw/common";
import { isInvisiblySmallElement } from "./sizeHelpers";
import type {
ExcalidrawElement,
NonDeletedExcalidrawElement,
NonDeleted,
ElementsMapOrArray,
} from "./types";
/**
* @deprecated unsafe, use hashElementsVersion instead
*/
export const getSceneVersion... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/image.ts | packages/element/src/image.ts | // -----------------------------------------------------------------------------
// ExcalidrawImageElement & related helpers
// -----------------------------------------------------------------------------
import { MIME_TYPES, SVG_NS } from "@excalidraw/common";
import type {
AppClassProperties,
DataURL,
Binary... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/groups.ts | packages/element/src/groups.ts | import type {
AppClassProperties,
AppState,
InteractiveCanvasAppState,
} from "@excalidraw/excalidraw/types";
import type { Mutable } from "@excalidraw/common/utility-types";
import { getBoundTextElement } from "./textElement";
import { isBoundToContainer } from "./typeChecks";
import { makeNextSelectedElement... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/containerCache.ts | packages/element/src/containerCache.ts | import type { ExcalidrawTextContainer } from "./types";
export const originalContainerCache: {
[id: ExcalidrawTextContainer["id"]]:
| {
height: ExcalidrawTextContainer["height"];
}
| undefined;
} = {};
export const updateOriginalContainerCache = (
id: ExcalidrawTextContainer["id"],
height:... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/src/__tests__/transform.test.ts | packages/element/src/__tests__/transform.test.ts | import { pointFrom } from "@excalidraw/math";
import { vi } from "vitest";
import {
convertToExcalidrawElements,
type ExcalidrawElementSkeleton,
} from "../transform";
import type { ExcalidrawArrowElement } from "../types";
const opts = { regenerateIds: false };
describe("Test Transform", () => {
it("should g... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/tests/cropElement.test.tsx | packages/element/tests/cropElement.test.tsx | import React from "react";
import { vi } from "vitest";
import { KEYS, cloneJSON } from "@excalidraw/common";
import {
Excalidraw,
exportToCanvas,
exportToSvg,
} from "@excalidraw/excalidraw";
import {
actionFlipHorizontal,
actionFlipVertical,
} from "@excalidraw/excalidraw/actions";
import { API } from "@... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/tests/zindex.test.tsx | packages/element/tests/zindex.test.tsx | import { reseed } from "@excalidraw/common";
import {
actionSendBackward,
actionBringForward,
actionBringToFront,
actionSendToBack,
actionDuplicateSelection,
} from "@excalidraw/excalidraw/actions";
import { Excalidraw } from "@excalidraw/excalidraw";
import { API } from "@excalidraw/excalidraw/tests/helpe... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | true |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/tests/fractionalIndex.test.ts | packages/element/tests/fractionalIndex.test.ts | /* eslint-disable no-lone-blocks */
import { generateKeyBetween } from "fractional-indexing";
import { arrayToMap } from "@excalidraw/common";
import {
syncInvalidIndices,
syncMovedIndices,
validateFractionalIndices,
} from "@excalidraw/element";
import { deepCopyElement } from "@excalidraw/element";
import {... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/tests/distribute.test.tsx | packages/element/tests/distribute.test.tsx | import {
distributeHorizontally,
distributeVertically,
} from "@excalidraw/excalidraw/actions";
import { defaultLang, setLanguage } from "@excalidraw/excalidraw/i18n";
import { Excalidraw } from "@excalidraw/excalidraw";
import { API } from "@excalidraw/excalidraw/tests/helpers/api";
import { UI, Pointer, Keyboard... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/tests/typeChecks.test.ts | packages/element/tests/typeChecks.test.ts | import { API } from "@excalidraw/excalidraw/tests/helpers/api";
import { hasBoundTextElement } from "../src/typeChecks";
describe("Test TypeChecks", () => {
describe("Test hasBoundTextElement", () => {
it("should return true for text bindable containers with bound text", () => {
expect(
hasBoundTe... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/tests/textWrapping.test.ts | packages/element/tests/textWrapping.test.ts | import { wrapText, parseTokens } from "../src/textWrapping";
import type { FontString } from "../src/types";
describe("Test wrapText", () => {
// font is irrelevant as jsdom does not support FontFace API
// `measureText` width is mocked to return `text.length` by `jest-canvas-mock`
// https://github.com/hustcc/... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/tests/duplicate.test.tsx | packages/element/tests/duplicate.test.tsx | import { pointFrom } from "@excalidraw/math";
import {
FONT_FAMILY,
ORIG_ID,
ROUNDNESS,
isPrimitive,
} from "@excalidraw/common";
import { Excalidraw, mutateElement } from "@excalidraw/excalidraw";
import { actionDuplicateSelection } from "@excalidraw/excalidraw/actions";
import { API } from "@excalidraw/ex... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/tests/embeddable.test.ts | packages/element/tests/embeddable.test.ts | import { getEmbedLink } from "../src/embeddable";
describe("YouTube timestamp parsing", () => {
it("should parse YouTube URLs with timestamp in seconds", () => {
const testCases = [
{
url: "https://www.youtube.com/watch?v=dQw4w9WgXcQ&t=90",
expectedStart: 90,
},
{
url: "... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/tests/delta.test.tsx | packages/element/tests/delta.test.tsx | import { API } from "@excalidraw/excalidraw/tests/helpers/api";
import type { ObservedAppState } from "@excalidraw/excalidraw/types";
import type { LinearElementEditor } from "@excalidraw/element";
import type { SceneElementsMap } from "@excalidraw/element/types";
import { AppStateDelta, Delta, ElementsDelta } from "... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/tests/flowchart.test.tsx | packages/element/tests/flowchart.test.tsx | import { KEYS, reseed } from "@excalidraw/common";
import { Excalidraw } from "@excalidraw/excalidraw";
import { API } from "@excalidraw/excalidraw/tests/helpers/api";
import { UI, Keyboard, Pointer } from "@excalidraw/excalidraw/tests/helpers/ui";
import {
render,
unmountComponent,
} from "@excalidraw/excalidraw... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/tests/frame.test.tsx | packages/element/tests/frame.test.tsx | import {
convertToExcalidrawElements,
Excalidraw,
} from "@excalidraw/excalidraw";
import { API } from "@excalidraw/excalidraw/tests/helpers/api";
import { Keyboard, Pointer } from "@excalidraw/excalidraw/tests/helpers/ui";
import {
getCloneByOrigId,
render,
} from "@excalidraw/excalidraw/tests/test-utils";
i... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/tests/collision.test.tsx | packages/element/tests/collision.test.tsx | import { type GlobalPoint, type LocalPoint, pointFrom } from "@excalidraw/math";
import { Excalidraw } from "@excalidraw/excalidraw";
import { UI } from "@excalidraw/excalidraw/tests/helpers/ui";
import "@excalidraw/utils/test-utils";
import { render } from "@excalidraw/excalidraw/tests/test-utils";
import { hitElemen... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/tests/bounds.test.ts | packages/element/tests/bounds.test.ts | import { pointFrom } from "@excalidraw/math";
import { arrayToMap, ROUNDNESS } from "@excalidraw/common";
import type { LocalPoint } from "@excalidraw/math";
import { getElementAbsoluteCoords, getElementBounds } from "../src/bounds";
import type { ExcalidrawElement, ExcalidrawLinearElement } from "../src/types";
c... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/tests/resize.test.tsx | packages/element/tests/resize.test.tsx | import { pointFrom } from "@excalidraw/math";
import { Excalidraw } from "@excalidraw/excalidraw";
import {
type Bounds,
KEYS,
getSizeFromPoints,
reseed,
arrayToMap,
} from "@excalidraw/common";
import { API } from "@excalidraw/excalidraw/tests/helpers/api";
import { UI, Keyboard, Pointer } from "@excalidra... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | true |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/tests/elbowArrow.test.tsx | packages/element/tests/elbowArrow.test.tsx | import { ARROW_TYPE } from "@excalidraw/common";
import { pointFrom } from "@excalidraw/math";
import { Excalidraw } from "@excalidraw/excalidraw";
import { actionSelectAll } from "@excalidraw/excalidraw/actions";
import { actionDuplicateSelection } from "@excalidraw/excalidraw/actions/actionDuplicateSelection";
import... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/tests/linearElementEditor.test.tsx | packages/element/tests/linearElementEditor.test.tsx | import { pointCenter, pointFrom } from "@excalidraw/math";
import { act, queryByTestId, queryByText } from "@testing-library/react";
import { vi } from "vitest";
import {
ROUNDNESS,
VERTICAL_ALIGN,
KEYS,
reseed,
arrayToMap,
} from "@excalidraw/common";
import { Excalidraw } from "@excalidraw/excalidraw";
im... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | true |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/tests/textElement.test.ts | packages/element/tests/textElement.test.ts | import { getLineHeight } from "@excalidraw/common";
import { API } from "@excalidraw/excalidraw/tests/helpers/api";
import { FONT_FAMILY, TEXT_ALIGN, VERTICAL_ALIGN } from "@excalidraw/common";
import {
computeContainerDimensionForBoundText,
getContainerCoords,
getBoundTextMaxWidth,
getBoundTextMaxHeight,
c... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/tests/align.test.tsx | packages/element/tests/align.test.tsx | import { KEYS } from "@excalidraw/common";
import {
actionAlignVerticallyCentered,
actionAlignHorizontallyCentered,
actionGroup,
actionAlignTop,
actionAlignBottom,
actionAlignLeft,
actionAlignRight,
} from "@excalidraw/excalidraw/actions";
import { defaultLang, setLanguage } from "@excalidraw/excalidraw/... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | true |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/tests/sortElements.test.ts | packages/element/tests/sortElements.test.ts | import { API } from "@excalidraw/excalidraw/tests/helpers/api";
import { mutateElement } from "@excalidraw/element";
import { normalizeElementOrder } from "../src/sortElements";
import type { ExcalidrawElement } from "../src/types";
const { h } = window;
const assertOrder = (
elements: readonly ExcalidrawElement[... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/tests/binding.test.tsx | packages/element/tests/binding.test.tsx | import { KEYS, arrayToMap } from "@excalidraw/common";
import { pointFrom } from "@excalidraw/math";
import { actionWrapTextInContainer } from "@excalidraw/excalidraw/actions/actionBoundText";
import { Excalidraw, isLinearElement } from "@excalidraw/excalidraw";
import { API } from "@excalidraw/excalidraw/tests/hel... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/tests/selection.test.ts | packages/element/tests/selection.test.ts | import { makeNextSelectedElementIds } from "../src/selection";
describe("makeNextSelectedElementIds", () => {
const _makeNextSelectedElementIds = (
selectedElementIds: { [id: string]: true },
prevSelectedElementIds: { [id: string]: true },
expectUpdated: boolean,
) => {
const ret = makeNextSelected... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/element/tests/sizeHelpers.test.ts | packages/element/tests/sizeHelpers.test.ts | import { vi } from "vitest";
import { getPerfectElementSize } from "../src/sizeHelpers";
const EPSILON_DIGITS = 3;
// Needed so that we can mock the value of constants which is done in
// below tests. In Jest this wasn't needed as global override was possible
// but vite doesn't allow that hence we need to mock
vi.mo... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/utils/global.d.ts | packages/utils/global.d.ts | /// <reference types="vite/client" />
import "@excalidraw/excalidraw/global";
import "@excalidraw/excalidraw/css";
| typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/utils/src/shape.ts | packages/utils/src/shape.ts | /**
* this file defines pure geometric shapes
*
* for instance, a cubic bezier curve is specified by its four control points and
* an ellipse is defined by its center, angle, semi major axis and semi minor axis
* (but in semi-width and semi-height so it's more relevant to Excalidraw)
*
* the idea with pure shape... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/utils/src/bbox.ts | packages/utils/src/bbox.ts | import {
vectorCross,
vectorFromPoint,
type GlobalPoint,
type LocalPoint,
} from "@excalidraw/math";
import type { Bounds } from "@excalidraw/common";
export type LineSegment<P extends LocalPoint | GlobalPoint> = [P, P];
export function getBBox<P extends LocalPoint | GlobalPoint>(
line: LineSegment<P>,
): ... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/utils/src/export.ts | packages/utils/src/export.ts | import { MIME_TYPES } from "@excalidraw/common";
import { getDefaultAppState } from "@excalidraw/excalidraw/appState";
import {
copyBlobToClipboardAsPng,
copyTextToSystemClipboard,
copyToClipboard,
} from "@excalidraw/excalidraw/clipboard";
import { encodePngMetadata } from "@excalidraw/excalidraw/data/image";
im... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/utils/src/test-utils.ts | packages/utils/src/test-utils.ts | import { diffStringsUnified } from "jest-diff";
expect.extend({
toCloselyEqualPoints(received, expected, precision) {
if (!Array.isArray(received) || !Array.isArray(expected)) {
throw new Error("expected and received are not point arrays");
}
const COMPARE = 1 / precision === 0 ? 1 : Math.pow(10, ... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/utils/src/index.ts | packages/utils/src/index.ts | export * from "./export";
export * from "./withinBounds";
export * from "./bbox";
export { getCommonBounds } from "@excalidraw/element";
| typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/utils/src/withinBounds.ts | packages/utils/src/withinBounds.ts | import { arrayToMap, type Bounds } from "@excalidraw/common";
import { getElementBounds } from "@excalidraw/element";
import {
isArrowElement,
isExcalidrawElement,
isFreeDrawElement,
isLinearElement,
isTextElement,
} from "@excalidraw/element";
import {
rangeIncludesValue,
pointFrom,
pointRotateRads,
... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
excalidraw/excalidraw | https://github.com/excalidraw/excalidraw/blob/63e1148280163a36326b7efb5fdfeefebabdb3e4/packages/utils/tests/utils.unmocked.test.ts | packages/utils/tests/utils.unmocked.test.ts | import { decodePngMetadata } from "@excalidraw/excalidraw/data/image";
import { decodeSvgBase64Payload } from "@excalidraw/excalidraw/scene/export";
import { API } from "@excalidraw/excalidraw/tests/helpers/api";
import type { ImportedDataState } from "@excalidraw/excalidraw/data/types";
import * as utils from "../sr... | typescript | MIT | 63e1148280163a36326b7efb5fdfeefebabdb3e4 | 2026-01-04T15:25:31.673879Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.