## API Report File for "@tldraw/editor"
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
///
import { Atom } from '@tldraw/state';
import { atom } from '@tldraw/state';
import { BoxModel } from '@tldraw/tlschema';
import { ComponentType } from 'react';
import { Computed } from '@tldraw/state';
import { computed } from '@tldraw/state';
import { Dispatch } from 'react';
import { EffectScheduler } from '@tldraw/state';
import { EmbedDefinition } from '@tldraw/tlschema';
import { EMPTY_ARRAY } from '@tldraw/state';
import EventEmitter from 'eventemitter3';
import { HistoryEntry } from '@tldraw/store';
import { IndexKey } from '@tldraw/utils';
import { JsonObject } from '@tldraw/utils';
import { JSX as JSX_2 } from 'react/jsx-runtime';
import { LegacyMigrations } from '@tldraw/store';
import { MigrationSequence } from '@tldraw/store';
import { NamedExoticComponent } from 'react';
import { PerformanceTracker } from '@tldraw/utils';
import { PointerEventHandler } from 'react';
import { react } from '@tldraw/state';
import { default as React_2 } from 'react';
import * as React_3 from 'react';
import { ReactElement } from 'react';
import { ReactNode } from 'react';
import { RecordProps } from '@tldraw/tlschema';
import { RecordsDiff } from '@tldraw/store';
import { SerializedSchema } from '@tldraw/store';
import { SerializedStore } from '@tldraw/store';
import { SetStateAction } from 'react';
import { Signal } from '@tldraw/state';
import { Store } from '@tldraw/store';
import { StoreSchema } from '@tldraw/store';
import { StoreSideEffects } from '@tldraw/store';
import { StyleProp } from '@tldraw/tlschema';
import { StylePropValue } from '@tldraw/tlschema';
import { Timers } from '@tldraw/utils';
import { TLAsset } from '@tldraw/tlschema';
import { TLAssetId } from '@tldraw/tlschema';
import { TLAssetPartial } from '@tldraw/tlschema';
import { TLAssetStore } from '@tldraw/tlschema';
import { TLBaseShape } from '@tldraw/tlschema';
import { TLBinding } from '@tldraw/tlschema';
import { TLBindingCreate } from '@tldraw/tlschema';
import { TLBindingId } from '@tldraw/tlschema';
import { TLBindingUpdate } from '@tldraw/tlschema';
import { TLBookmarkAsset } from '@tldraw/tlschema';
import { TLCamera } from '@tldraw/tlschema';
import { TLCursor } from '@tldraw/tlschema';
import { TLCursorType } from '@tldraw/tlschema';
import { TLDefaultHorizontalAlignStyle } from '@tldraw/tlschema';
import { TLDocument } from '@tldraw/tlschema';
import { TLGroupShape } from '@tldraw/tlschema';
import { TLHandle } from '@tldraw/tlschema';
import { TLImageAsset } from '@tldraw/tlschema';
import { TLInstance } from '@tldraw/tlschema';
import { TLInstancePageState } from '@tldraw/tlschema';
import { TLInstancePresence } from '@tldraw/tlschema';
import { TLPage } from '@tldraw/tlschema';
import { TLPageId } from '@tldraw/tlschema';
import { TLParentId } from '@tldraw/tlschema';
import { TLPropsMigrations } from '@tldraw/tlschema';
import { TLRecord } from '@tldraw/tlschema';
import { TLScribble } from '@tldraw/tlschema';
import { TLShape } from '@tldraw/tlschema';
import { TLShapeId } from '@tldraw/tlschema';
import { TLShapePartial } from '@tldraw/tlschema';
import { TLStore } from '@tldraw/tlschema';
import { TLStoreProps } from '@tldraw/tlschema';
import { TLStoreSnapshot } from '@tldraw/tlschema';
import { TLUnknownBinding } from '@tldraw/tlschema';
import { TLUnknownShape } from '@tldraw/tlschema';
import { TLVideoAsset } from '@tldraw/tlschema';
import { track } from '@tldraw/state-react';
import { transact } from '@tldraw/state';
import { transaction } from '@tldraw/state';
import { UnknownRecord } from '@tldraw/store';
import { useComputed } from '@tldraw/state-react';
import { useQuickReactor } from '@tldraw/state-react';
import { useReactor } from '@tldraw/state-react';
import { useStateTracking } from '@tldraw/state-react';
import { useValue } from '@tldraw/state-react';
import { VecModel } from '@tldraw/tlschema';
import { whyAmIRunning } from '@tldraw/state';
// @public
export function angleDistance(fromAngle: number, toAngle: number, direction: number): number;
// @internal (undocumented)
export function applyRotationToSnapshotShapes({ delta, editor, snapshot, stage, }: {
delta: number;
editor: Editor;
snapshot: TLRotationSnapshot;
stage: 'end' | 'one-off' | 'start' | 'update';
}): void;
// @public
export function approximately(a: number, b: number, precision?: number): boolean;
// @public (undocumented)
export class Arc2d extends Geometry2d {
constructor(config: Omit & {
center: Vec;
end: Vec;
largeArcFlag: number;
start: Vec;
sweepFlag: number;
});
// (undocumented)
angleEnd: number;
// (undocumented)
angleStart: number;
// (undocumented)
_center: Vec;
// (undocumented)
end: Vec;
// (undocumented)
getLength(): number;
// (undocumented)
getSvgPathData(first?: boolean): string;
// (undocumented)
getVertices(): Vec[];
// (undocumented)
hitTestLineSegment(A: Vec, B: Vec): boolean;
// (undocumented)
largeArcFlag: number;
// (undocumented)
measure: number;
// (undocumented)
nearestPoint(point: Vec): Vec;
// (undocumented)
radius: number;
// (undocumented)
start: Vec;
// (undocumented)
sweepFlag: number;
}
// @public
export function areAnglesCompatible(a: number, b: number): boolean;
export { Atom }
export { atom }
// @public (undocumented)
export function average(A: VecLike, B: VecLike): string;
// @public (undocumented)
export abstract class BaseBoxShapeTool extends StateNode {
// (undocumented)
static children: () => TLStateNodeConstructor[];
// (undocumented)
static id: string;
// (undocumented)
static initial: string;
// (undocumented)
onCreate?: (_shape: null | TLShape) => null | void;
// (undocumented)
abstract shapeType: string;
}
// @public (undocumented)
export abstract class BaseBoxShapeUtil extends ShapeUtil {
// (undocumented)
getGeometry(shape: Shape): Geometry2d;
// (undocumented)
getHandleSnapGeometry(shape: Shape): HandleSnapGeometry;
// (undocumented)
getInterpolatedProps(startShape: Shape, endShape: Shape, t: number): Shape['props'];
// (undocumented)
onResize: TLOnResizeHandler;
}
// @public
export interface BindingOnChangeOptions {
bindingAfter: Binding;
bindingBefore: Binding;
}
// @public
export interface BindingOnCreateOptions {
binding: Binding;
}
// @public
export interface BindingOnDeleteOptions {
binding: Binding;
}
// @public
export interface BindingOnShapeChangeOptions {
binding: Binding;
shapeAfter: TLShape;
shapeBefore: TLShape;
}
// @public
export interface BindingOnShapeDeleteOptions {
binding: Binding;
shape: TLShape;
}
// @public
export interface BindingOnShapeIsolateOptions {
binding: Binding;
removedShape: TLShape;
}
// @public (undocumented)
export abstract class BindingUtil {
constructor(editor: Editor);
// (undocumented)
editor: Editor;
abstract getDefaultProps(): Partial;
// (undocumented)
static migrations?: TLPropsMigrations;
onAfterChange?(options: BindingOnChangeOptions): void;
onAfterChangeFromShape?(options: BindingOnShapeChangeOptions): void;
onAfterChangeToShape?(options: BindingOnShapeChangeOptions): void;
onAfterCreate?(options: BindingOnCreateOptions): void;
onAfterDelete?(options: BindingOnDeleteOptions): void;
onBeforeChange?(options: BindingOnChangeOptions): Binding | void;
onBeforeCreate?(options: BindingOnCreateOptions): Binding | void;
onBeforeDelete?(options: BindingOnDeleteOptions): void;
onBeforeDeleteFromShape?(options: BindingOnShapeDeleteOptions): void;
onBeforeDeleteToShape?(options: BindingOnShapeDeleteOptions): void;
onBeforeIsolateFromShape?(options: BindingOnShapeIsolateOptions): void;
onBeforeIsolateToShape?(options: BindingOnShapeIsolateOptions): void;
onOperationComplete?(): void;
// (undocumented)
static props?: RecordProps;
static type: string;
}
// @public
export interface BoundsSnapGeometry {
points?: VecModel[];
}
// @public (undocumented)
export interface BoundsSnapPoint {
// (undocumented)
handle?: SelectionCorner;
// (undocumented)
id: string;
// (undocumented)
x: number;
// (undocumented)
y: number;
}
// @public (undocumented)
export class BoundsSnaps {
constructor(manager: SnapManager);
// (undocumented)
readonly editor: Editor;
// (undocumented)
getSnapPoints(shapeId: TLShapeId): BoundsSnapPoint[];
// (undocumented)
readonly manager: SnapManager;
// (undocumented)
snapResizeShapes({ initialSelectionPageBounds, dragDelta, handle: originalHandle, isAspectRatioLocked, isResizingFromCenter, }: {
dragDelta: Vec;
handle: SelectionCorner | SelectionEdge;
initialSelectionPageBounds: Box;
isAspectRatioLocked: boolean;
isResizingFromCenter: boolean;
}): SnapData;
// (undocumented)
snapTranslateShapes({ lockedAxis, initialSelectionPageBounds, initialSelectionSnapPoints, dragDelta, }: {
dragDelta: Vec;
initialSelectionPageBounds: Box;
initialSelectionSnapPoints: BoundsSnapPoint[];
lockedAxis: 'x' | 'y' | null;
}): SnapData;
}
// @public (undocumented)
export class Box {
constructor(x?: number, y?: number, w?: number, h?: number);
// (undocumented)
get aspectRatio(): number;
// (undocumented)
get center(): Vec;
set center(v: Vec);
// (undocumented)
clone(): Box;
// (undocumented)
static Collides: (A: Box, B: Box) => boolean;
// (undocumented)
collides(B: Box): boolean;
// (undocumented)
static Common: (boxes: Box[]) => Box;
// (undocumented)
static Contains: (A: Box, B: Box) => boolean;
// (undocumented)
contains(B: Box): boolean;
// (undocumented)
static ContainsPoint: (A: Box, B: VecLike, margin?: number) => boolean;
// (undocumented)
containsPoint(V: VecLike, margin?: number): boolean;
// (undocumented)
get corners(): Vec[];
// (undocumented)
get cornersAndCenter(): Vec[];
// (undocumented)
static Equals(a: Box | BoxModel, b: Box | BoxModel): boolean;
// (undocumented)
equals(other: Box | BoxModel): boolean;
// (undocumented)
static Expand(A: Box, B: Box): Box;
// (undocumented)
expand(A: Box): this;
// (undocumented)
static ExpandBy(A: Box, n: number): Box;
// (undocumented)
expandBy(n: number): this;
// (undocumented)
static From(box: BoxModel): Box;
// (undocumented)
static FromCenter(center: VecLike, size: VecLike): Box;
// (undocumented)
static FromPoints(points: VecLike[]): Box;
// (undocumented)
getHandlePoint(handle: SelectionCorner | SelectionEdge): Vec;
// (undocumented)
h: number;
// (undocumented)
get height(): number;
set height(n: number);
// (undocumented)
static Includes: (A: Box, B: Box) => boolean;
// (undocumented)
includes(B: Box): boolean;
// (undocumented)
get maxX(): number;
// (undocumented)
get maxY(): number;
// (undocumented)
get midX(): number;
// (undocumented)
get midY(): number;
// (undocumented)
get minX(): number;
set minX(n: number);
// (undocumented)
get minY(): number;
set minY(n: number);
// (undocumented)
get point(): Vec;
set point(val: Vec);
// (undocumented)
static Resize(box: Box, handle: SelectionCorner | SelectionEdge | string, dx: number, dy: number, isAspectRatioLocked?: boolean): {
box: Box;
scaleX: number;
scaleY: number;
};
// (undocumented)
resize(handle: SelectionCorner | SelectionEdge | string, dx: number, dy: number): void;
// (undocumented)
scale(n: number): this;
// (undocumented)
set(x?: number, y?: number, w?: number, h?: number): this;
// (undocumented)
setTo(B: Box): this;
// (undocumented)
static Sides: (A: Box, inset?: number) => Vec[][];
// (undocumented)
get sides(): Array<[Vec, Vec]>;
// (undocumented)
get size(): Vec;
// (undocumented)
snapToGrid(size: number): void;
// (undocumented)
toFixed(): this;
// (undocumented)
toJson(): BoxModel;
// (undocumented)
translate(delta: VecLike): this;
// (undocumented)
union(box: BoxModel): this;
// (undocumented)
w: number;
// (undocumented)
get width(): number;
set width(n: number);
// (undocumented)
x: number;
// (undocumented)
y: number;
// (undocumented)
static ZeroFix(other: Box | BoxModel): Box;
// (undocumented)
zeroFix(): this;
}
// @public (undocumented)
export type BoxLike = Box | BoxModel;
// @public (undocumented)
export function canonicalizeRotation(a: number): number;
// @public
export function centerOfCircleFromThreePoints(a: VecLike, b: VecLike, c: VecLike): Vec;
// @public (undocumented)
export class Circle2d extends Geometry2d {
constructor(config: Omit & {
isFilled: boolean;
radius: number;
x?: number;
y?: number;
});
// (undocumented)
_center: Vec;
// (undocumented)
config: Omit & {
isFilled: boolean;
radius: number;
x?: number;
y?: number;
};
// (undocumented)
getBounds(): Box;
// (undocumented)
getSvgPathData(): string;
// (undocumented)
getVertices(): Vec[];
// (undocumented)
hitTestLineSegment(A: Vec, B: Vec, distance?: number): boolean;
// (undocumented)
nearestPoint(point: Vec): Vec;
// (undocumented)
radius: number;
// (undocumented)
x: number;
// (undocumented)
y: number;
}
// @public
export function clamp(n: number, min: number): number;
// @public
export function clamp(n: number, min: number, max: number): number;
// @public
export function clampRadians(r: number): number;
// @public (undocumented)
export class ClickManager {
constructor(editor: Editor);
// @internal
cancelDoubleClickTimeout: () => void;
get clickState(): TLClickState | undefined;
// (undocumented)
editor: Editor;
// (undocumented)
handlePointerEvent: (info: TLPointerEventInfo) => TLClickEventInfo | TLPointerEventInfo;
// (undocumented)
lastPointerInfo: TLPointerEventInfo;
}
// @public
export function clockwiseAngleDist(a0: number, a1: number): number;
export { computed }
// @internal (undocumented)
export function ContainerProvider({ container, children, }: {
children: React.ReactNode;
container: HTMLDivElement;
}): JSX_2.Element;
// @public (undocumented)
export const coreShapes: readonly [typeof GroupShapeUtil];
// @public
export function counterClockwiseAngleDist(a0: number, a1: number): number;
// @public
export function createSessionStateSnapshotSignal(store: TLStore): Signal;
// @public
export function createTLStore({ initialData, defaultName, id, assets, onEditorMount, multiplayerStatus, ...rest }?: TLStoreOptions): TLStore;
// @public (undocumented)
export function createTLUser(opts?: {
derivePresenceState?: ((store: TLStore) => Signal) | undefined;
setUserPreferences?: ((userPreferences: TLUserPreferences) => void) | undefined;
userPreferences?: Signal | undefined;
}): TLUser;
// @public (undocumented)
export class CubicBezier2d extends Polyline2d {
constructor(config: Omit & {
cp1: Vec;
cp2: Vec;
end: Vec;
start: Vec;
});
// (undocumented)
a: Vec;
// (undocumented)
b: Vec;
// (undocumented)
c: Vec;
// (undocumented)
d: Vec;
// (undocumented)
static GetAtT(segment: CubicBezier2d, t: number): Vec;
// (undocumented)
getLength(precision?: number): number;
// (undocumented)
getSvgPathData(first?: boolean): string;
// (undocumented)
getVertices(): Vec[];
// (undocumented)
midPoint(): Vec;
// (undocumented)
nearestPoint(A: Vec): Vec;
}
// @public (undocumented)
export class CubicSpline2d extends Geometry2d {
constructor(config: Omit & {
points: Vec[];
});
// (undocumented)
getLength(): number;
// (undocumented)
getSvgPathData(): string;
// (undocumented)
getVertices(): Vec[];
// (undocumented)
hitTestLineSegment(A: Vec, B: Vec): boolean;
// (undocumented)
nearestPoint(A: Vec): Vec;
// (undocumented)
points: Vec[];
// (undocumented)
get segments(): CubicBezier2d[];
// (undocumented)
_segments?: CubicBezier2d[];
}
// @public (undocumented)
export function dataUrlToFile(url: string, filename: string, mimeType: string): Promise;
// @internal (undocumented)
export type DebugFlag = DebugFlagDef & Atom;
// @internal (undocumented)
export interface DebugFlagDef {
// (undocumented)
defaults: DebugFlagDefaults;
// (undocumented)
name: string;
// (undocumented)
shouldStoreForSession: boolean;
}
// @internal (undocumented)
export interface DebugFlagDefaults {
// (undocumented)
all: T;
// (undocumented)
development?: T;
// (undocumented)
production?: T;
// (undocumented)
staging?: T;
}
// @internal (undocumented)
export const debugFlags: {
readonly debugCursors: DebugFlag;
readonly debugGeometry: DebugFlag;
readonly debugSvg: DebugFlag;
readonly editOnType: DebugFlag;
readonly forceSrgb: DebugFlag;
readonly hideShapes: DebugFlag;
readonly logElementRemoves: DebugFlag;
readonly logPointerCaptures: DebugFlag;
readonly logPreventDefaults: DebugFlag;
readonly measurePerformance: DebugFlag;
readonly reconnectOnPing: DebugFlag;
readonly showFps: DebugFlag;
readonly throwToBlob: DebugFlag;
};
// @internal (undocumented)
export const DEFAULT_ANIMATION_OPTIONS: {
duration: number;
easing: (t: number) => number;
};
// @internal (undocumented)
export const DEFAULT_CAMERA_OPTIONS: TLCameraOptions;
// @public (undocumented)
export function DefaultBackground(): JSX_2.Element;
// @public (undocumented)
export const DefaultBrush: ({ brush, color, opacity, className }: TLBrushProps) => JSX_2.Element;
// @public (undocumented)
export function DefaultCanvas({ className }: TLCanvasComponentProps): JSX_2.Element;
// @public (undocumented)
export function DefaultCollaboratorHint({ className, zoom, point, color, viewport, opacity, }: TLCollaboratorHintProps): JSX_2.Element;
// @public (undocumented)
export const DefaultCursor: NamedExoticComponent;
// @public (undocumented)
export const DefaultErrorFallback: TLErrorFallbackComponent;
// @public (undocumented)
export function DefaultGrid({ x, y, z, size }: TLGridProps): JSX_2.Element;
// @public (undocumented)
export function DefaultHandle({ handle, isCoarse, className, zoom }: TLHandleProps): JSX_2.Element;
// @public (undocumented)
export const DefaultHandles: ({ children }: TLHandlesProps) => JSX_2.Element;
// @public (undocumented)
export function DefaultScribble({ scribble, zoom, color, opacity, className }: TLScribbleProps): JSX_2.Element | null;
// @public (undocumented)
export function DefaultSelectionBackground({ bounds, rotation }: TLSelectionBackgroundProps): JSX_2.Element;
// @public (undocumented)
export function DefaultSelectionForeground({ bounds, rotation }: TLSelectionForegroundProps): JSX_2.Element;
// @public (undocumented)
export const DefaultShapeIndicator: NamedExoticComponent;
// @public (undocumented)
export const DefaultShapeIndicators: NamedExoticComponent