## 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 { EmbedDefinition } from '@tldraw/tlschema';
import { EMPTY_ARRAY } from '@tldraw/state';
import { EventEmitter } from 'eventemitter3';
import { Expand } from '@tldraw/utils';
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 { 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 { SerializedSchema } from '@tldraw/store';
import { SerializedStore } from '@tldraw/store';
import { ShapeProps } from '@tldraw/tlschema';
import { Signal } from '@tldraw/state';
import { StoreSchema } from '@tldraw/store';
import { StoreSnapshot } from '@tldraw/store';
import { StyleProp } from '@tldraw/tlschema';
import { StylePropValue } from '@tldraw/tlschema';
import { TLArrowShape } from '@tldraw/tlschema';
import { TLArrowShapeArrowheadStyle } from '@tldraw/tlschema';
import { TLAsset } from '@tldraw/tlschema';
import { TLAssetId } from '@tldraw/tlschema';
import { TLAssetPartial } from '@tldraw/tlschema';
import { TLBaseShape } 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 { 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 { TLShapePropsMigrations } from '@tldraw/tlschema';
import { TLStore } from '@tldraw/tlschema';
import { TLStoreProps } from '@tldraw/tlschema';
import { TLUnknownShape } from '@tldraw/tlschema';
import { TLVideoAsset } from '@tldraw/tlschema';
import { track } from '@tldraw/state';
import { transact } from '@tldraw/state';
import { transaction } from '@tldraw/state';
import { UnknownRecord } from '@tldraw/store';
import { useComputed } from '@tldraw/state';
import { useQuickReactor } from '@tldraw/state';
import { useReactor } from '@tldraw/state';
import { useValue } from '@tldraw/state';
import { VecModel } from '@tldraw/tlschema';
import { whyAmIRunning } from '@tldraw/state';
// @public
export function angleDistance(fromAngle: number, toAngle: number, direction: number): number;
// @internal (undocumented)
export const ANIMATION_MEDIUM_MS = 320;
// @internal (undocumented)
export const ANIMATION_SHORT_MS = 80;
// @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;
radius: number;
start: Vec;
sweepFlag: number;
});
// (undocumented)
angleEnd: number;
// (undocumented)
angleStart: number;
// (undocumented)
_center: Vec;
// (undocumented)
end: Vec;
// (undocumented)
getVertices(): Vec[];
// (undocumented)
hitTestLineSegment(A: Vec, B: Vec): boolean;
// (undocumented)
length: number;
// (undocumented)
measure: number;
// (undocumented)
nearestPoint(point: Vec): Vec;
// (undocumented)
radius: number;
// (undocumented)
start: Vec;
}
// @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: () => (typeof Idle | typeof Pointing)[];
// (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)
onResize: TLOnResizeHandler;
}
// @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 Box {
constructor(x?: number, y?: number, w?: number, h?: number);
// (undocumented)
static AroundPoint(point: VecLike, n: number): Box;
// (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;
// @internal (undocumented)
export const CAMERA_SLIDE_FRICTION = 0.09;
// @public (undocumented)
export function canonicalizeRotation(a: number): number;
// @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)
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
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, ...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)
getVertices(): Vec[];
// (undocumented)
midPoint(): Vec;
// (undocumented)
nearestPoint(A: Vec): Vec;
}
// @public (undocumented)
export class CubicSpline2d extends Geometry2d {
constructor(config: Omit & {
points: Vec[];
});
// (undocumented)
getVertices(): Vec[];
// (undocumented)
hitTestLineSegment(A: Vec, B: Vec): boolean;
// (undocumented)
get length(): number;
// (undocumented)
_length?: number;
// (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 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 reconnectOnPing: DebugFlag;
readonly showFps: DebugFlag;
readonly throwToBlob: DebugFlag;
};
// @internal (undocumented)
export const DEFAULT_ANIMATION_OPTIONS: {
duration: number;
easing: (t: number) => number;
};
// @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 function DefaultSnapIndicator({ className, line, zoom }: TLSnapIndicatorProps): JSX_2.Element;
// @public (undocumented)
export function DefaultSpinner(): JSX_2.Element;
// @public (undocumented)
export const DefaultSvgDefs: () => null;
// @public (undocumented)
export const defaultUserPreferences: Readonly<{
animationSpeed: 0 | 1;
color: "#02B1CC" | "#11B3A3" | "#39B178" | "#55B467" | "#7B66DC" | "#9D5BD2" | "#BD54C6" | "#E34BA9" | "#EC5E41" | "#F04F88" | "#F2555A" | "#FF802B";
edgeScrollSpeed: 1;
isDarkMode: false;
isSnapMode: false;
isWrapMode: false;
locale: "ar" | "ca" | "cs" | "da" | "de" | "en" | "es" | "fa" | "fi" | "fr" | "gl" | "he" | "hi-in" | "hr" | "hu" | "it" | "ja" | "ko-kr" | "ku" | "my" | "ne" | "no" | "pl" | "pt-br" | "pt-pt" | "ro" | "ru" | "sl" | "sv" | "te" | "th" | "tr" | "uk" | "vi" | "zh-cn" | "zh-tw";
name: "New User";
}>;
// @public
export function degreesToRadians(d: number): number;
// @internal (undocumented)
export const DOUBLE_CLICK_DURATION = 450;
// @internal (undocumented)
export const DRAG_DISTANCE = 16;
// @public (undocumented)
export const EASINGS: {
readonly easeInCubic: (t: number) => number;
readonly easeInExpo: (t: number) => number;
readonly easeInOutCubic: (t: number) => number;
readonly easeInOutExpo: (t: number) => number;
readonly easeInOutQuad: (t: number) => number;
readonly easeInOutQuart: (t: number) => number;
readonly easeInOutQuint: (t: number) => number;
readonly easeInOutSine: (t: number) => number;
readonly easeInQuad: (t: number) => number;
readonly easeInQuart: (t: number) => number;
readonly easeInQuint: (t: number) => number;
readonly easeInSine: (t: number) => number;
readonly easeOutCubic: (t: number) => number;
readonly easeOutExpo: (t: number) => number;
readonly easeOutQuad: (t: number) => number;
readonly easeOutQuart: (t: number) => number;
readonly easeOutQuint: (t: number) => number;
readonly easeOutSine: (t: number) => number;
readonly linear: (t: number) => number;
};
// @public (undocumented)
export class Edge2d extends Geometry2d {
constructor(config: {
end: Vec;
start: Vec;
});
// (undocumented)
d: Vec;
// (undocumented)
end: Vec;
// (undocumented)
getVertices(): Vec[];
// (undocumented)
hitTestLineSegment(A: Vec, B: Vec, distance?: number): boolean;
// (undocumented)
get length(): number;
// (undocumented)
_length?: number;
// (undocumented)
midPoint(): Vec;
// (undocumented)
nearestPoint(point: Vec): Vec;
// (undocumented)
start: Vec;
// (undocumented)
u: Vec;
// (undocumented)
ul: number;
}
// @public (undocumented)
export class Editor extends EventEmitter {
constructor({ store, user, shapeUtils, tools, getContainer, initialState, inferDarkMode, }: TLEditorOptions);
addOpenMenu(id: string): this;
alignShapes(shapes: TLShape[] | TLShapeId[], operation: 'bottom' | 'center-horizontal' | 'center-vertical' | 'left' | 'right' | 'top'): this;
animateShape(partial: null | TLShapePartial | undefined, animationOptions?: TLAnimationOptions): this;
animateShapes(partials: (null | TLShapePartial | undefined)[], animationOptions?: Partial<{
duration: number;
easing: (t: number) => number;
}>): this;
animateToShape(shapeId: TLShapeId, opts?: TLAnimationOptions): this;
animateToUser(userId: string): this;
// @internal (undocumented)
annotateError(error: unknown, { origin, willCrashApp, tags, extras, }: {
extras?: Record;
origin: string;
tags?: Record;
willCrashApp: boolean;
}): this;
bail(): this;
bailToMark(id: string): this;
batch(fn: () => void): this;
bringForward(shapes: TLShape[] | TLShapeId[]): this;
bringToFront(shapes: TLShape[] | TLShapeId[]): this;
cancel(): this;
cancelDoubleClick(): void;
// @internal (undocumented)
capturedPointerId: null | number;
centerOnPoint(point: VecLike, animation?: TLAnimationOptions): this;
clearOpenMenus(): this;
// @internal
protected _clickManager: ClickManager;
complete(): this;
// @internal (undocumented)
crash(error: unknown): this;
createAssets(assets: TLAsset[]): this;
// @internal (undocumented)
createErrorAnnotations(origin: string, willCrashApp: 'unknown' | boolean): {
extras: {
activeStateNode?: string;
editingShape?: TLUnknownShape;
inputs?: Record;
selectedShapes?: TLUnknownShape[];
};
tags: {
origin: string;
willCrashApp: 'unknown' | boolean;
};
};
createPage(page: Partial): this;
createShape(shape: OptionalKeys, 'id'>): this;
createShapes(shapes: OptionalKeys, 'id'>[]): this;
deleteAssets(assets: TLAsset[] | TLAssetId[]): this;
deleteOpenMenu(id: string): this;
deletePage(page: TLPage | TLPageId): this;
deleteShape(id: TLShapeId): this;
// (undocumented)
deleteShape(shape: TLShape): this;
deleteShapes(ids: TLShapeId[]): this;
// (undocumented)
deleteShapes(shapes: TLShape[]): this;
deselect(...shapes: TLShape[] | TLShapeId[]): this;
dispatch: (info: TLEventInfo) => this;
readonly disposables: Set<() => void>;
dispose(): void;
distributeShapes(shapes: TLShape[] | TLShapeId[], operation: 'horizontal' | 'vertical'): this;
duplicatePage(page: TLPage | TLPageId, createId?: TLPageId): this;
duplicateShapes(shapes: TLShape[] | TLShapeId[], offset?: VecLike): this;
readonly environment: EnvironmentManager;
// @internal (undocumented)
externalAssetContentHandlers: {
[K in TLExternalAssetContent['type']]: {
[Key in K]: ((info: TLExternalAssetContent & {
type: Key;
}) => Promise) | null;
}[K];
};
// @internal (undocumented)
externalContentHandlers: {
[K in TLExternalContent['type']]: {
[Key in K]: ((info: TLExternalContent & {
type: Key;
}) => void) | null;
}[K];
};
findCommonAncestor(shapes: TLShape[] | TLShapeId[], predicate?: (shape: TLShape) => boolean): TLShapeId | undefined;
findShapeAncestor(shape: TLShape | TLShapeId, predicate: (parent: TLShape) => boolean): TLShape | undefined;
flipShapes(shapes: TLShape[] | TLShapeId[], operation: 'horizontal' | 'vertical'): this;
getAncestorPageId(shape?: TLShape | TLShapeId): TLPageId | undefined;
getArrowInfo(shape: TLArrowShape | TLShapeId): TLArrowInfo | undefined;
getArrowsBoundTo(shapeId: TLShapeId): {
arrowId: TLShapeId;
handleId: "end" | "start";
}[];
getAsset(asset: TLAsset | TLAssetId): TLAsset | undefined;
getAssetForExternalContent(info: TLExternalAssetContent): Promise;
getAssets(): (TLBookmarkAsset | TLImageAsset | TLVideoAsset)[];
getCamera(): TLCamera;
getCameraState(): "idle" | "moving";
getCanRedo(): boolean;
getCanUndo(): boolean;
getContainer: () => HTMLElement;
getContentFromCurrentPage(shapes: TLShape[] | TLShapeId[]): TLContent | undefined;
// @internal
getCrashingError(): unknown;
getCroppingShapeId(): null | TLShapeId;
getCulledShapes(): Set;
getCurrentPage(): TLPage;
getCurrentPageBounds(): Box | undefined;
getCurrentPageId(): TLPageId;
getCurrentPageRenderingShapesSorted(): TLShape[];
getCurrentPageShapeIds(): Set;
getCurrentPageShapes(): TLShape[];
getCurrentPageShapesSorted(): TLShape[];
getCurrentPageState(): TLInstancePageState;
getCurrentTool(): StateNode;
getCurrentToolId(): string;
getDocumentSettings(): TLDocument;
getDroppingOverShape(point: VecLike, droppingShapes?: TLShape[]): TLUnknownShape | undefined;
getEditingShape(): TLShape | undefined;
getEditingShapeId(): null | TLShapeId;
getErasingShapeIds(): TLShapeId[];
getErasingShapes(): NonNullable[];
getFocusedGroup(): TLShape | undefined;
getFocusedGroupId(): TLPageId | TLShapeId;
getHighestIndexForParent(parent: TLPage | TLParentId | TLShape): IndexKey;
getHintingShape(): NonNullable[];
getHintingShapeIds(): TLShapeId[];
getHoveredShape(): TLShape | undefined;
getHoveredShapeId(): null | TLShapeId;
getInitialMetaForShape(_shape: TLShape): JsonObject;
getInstanceState(): TLInstance;
getIsMenuOpen(): boolean;
getOnlySelectedShape(): null | TLShape;
getOnlySelectedShapeId(): null | TLShapeId;
getOpenMenus(): string[];
getOutermostSelectableShape(shape: TLShape | TLShapeId, filter?: (shape: TLShape) => boolean): TLShape;
getPage(page: TLPage | TLPageId): TLPage | undefined;
getPages(): TLPage[];
getPageShapeIds(page: TLPage | TLPageId): Set;
getPageStates(): TLInstancePageState[];
getPath(): string;
getPointInParentSpace(shape: TLShape | TLShapeId, point: VecLike): Vec;
getPointInShapeSpace(shape: TLShape | TLShapeId, point: VecLike): Vec;
getRenderingBounds(): Box;
getRenderingShapes(): {
backgroundIndex: number;
id: TLShapeId;
index: number;
opacity: number;
shape: TLShape;
util: ShapeUtil;
}[];
getSelectedShapeAtPoint(point: VecLike): TLShape | undefined;
getSelectedShapeIds(): TLShapeId[];
getSelectedShapes(): TLShape[];
getSelectionPageBounds(): Box | null;
getSelectionRotatedPageBounds(): Box | undefined;
getSelectionRotatedScreenBounds(): Box | undefined;
getSelectionRotation(): number;
getShape(shape: TLParentId | TLShape): T | undefined;
getShapeAncestors(shape: TLShape | TLShapeId, acc?: TLShape[]): TLShape[];
getShapeAndDescendantIds(ids: TLShapeId[]): Set;
getShapeAtPoint(point: VecLike, opts?: {
filter?: ((shape: TLShape) => boolean) | undefined;
hitFrameInside?: boolean | undefined;
hitInside?: boolean | undefined;
hitLabels?: boolean | undefined;
margin?: number | undefined;
renderingOnly?: boolean | undefined;
}): TLShape | undefined;
getShapeClipPath(shape: TLShape | TLShapeId): string | undefined;
getShapeGeometry(shape: TLShape | TLShapeId): T;
getShapeHandles(shape: T | T['id']): TLHandle[] | undefined;
getShapeIdsInsideBounds(bounds: Box): TLShapeId[];
getShapeLocalTransform(shape: TLShape | TLShapeId): Mat;
getShapeMask(shape: TLShape | TLShapeId): undefined | VecLike[];
getShapeMaskedPageBounds(shape: TLShape | TLShapeId): Box | undefined;
getShapePageBounds(shape: TLShape | TLShapeId): Box | undefined;
getShapePageTransform(shape: TLShape | TLShapeId): Mat;
getShapeParent(shape?: TLShape | TLShapeId): TLShape | undefined;
getShapeParentTransform(shape: TLShape | TLShapeId): Mat;
getShapesAtPoint(point: VecLike, opts?: {
hitInside?: boolean | undefined;
margin?: number | undefined;
}): TLShape[];
getShapesInsideBounds(bounds: Box): TLShape[];
// (undocumented)
getShapeStyleIfExists(shape: TLShape, style: StyleProp): T | undefined;
getShapeUtil(shape: S | TLShapePartial): ShapeUtil;
// (undocumented)
getShapeUtil(type: S['type']): ShapeUtil;
// (undocumented)
getShapeUtil(type: T extends ShapeUtil ? R['type'] : string): T;
getSharedOpacity(): SharedStyle;
getSharedStyles(): ReadonlySharedStyleMap;
getSortedChildIdsForParent(parent: TLPage | TLParentId | TLShape): TLShapeId[];
getStateDescendant(path: string): T | undefined;
getStyleForNextShape(style: StyleProp): T;
// @deprecated (undocumented)
getSvg(shapes: TLShape[] | TLShapeId[], opts?: Partial): Promise;
getSvgElement(shapes: TLShape[] | TLShapeId[], opts?: Partial): Promise<{
height: number;
svg: SVGSVGElement;
width: number;
} | undefined>;
getSvgString(shapes: TLShape[] | TLShapeId[], opts?: Partial): Promise<{
height: number;
svg: string;
width: number;
} | undefined>;
// @internal (undocumented)
getUnorderedRenderingShapes(useEditorState: boolean): {
backgroundIndex: number;
id: TLShapeId;
index: number;
opacity: number;
shape: TLShape;
util: ShapeUtil;
}[];
getViewportPageBounds(): Box;
getViewportPageCenter(): Vec;
getViewportScreenBounds(): Box;
getViewportScreenCenter(): Vec;
getZoomLevel(): number;
groupShapes(shapes: TLShape[] | TLShapeId[], groupId?: TLShapeId): this;
hasAncestor(shape: TLShape | TLShapeId | undefined, ancestorId: TLShapeId): boolean;
readonly history: HistoryManager;
inputs: {
buttons: Set;
keys: Set;
originScreenPoint: Vec;
originPagePoint: Vec;
currentScreenPoint: Vec;
currentPagePoint: Vec;
previousScreenPoint: Vec;
previousPagePoint: Vec;
pointerVelocity: Vec;
altKey: boolean;
ctrlKey: boolean;
isPen: boolean;
shiftKey: boolean;
isDragging: boolean;
isEditing: boolean;
isPanning: boolean;
isPinching: boolean;
isPointing: boolean;
};
interrupt(): this;
isIn(path: string): boolean;
isInAny(...paths: string[]): boolean;
isPointInShape(shape: TLShape | TLShapeId, point: VecLike, opts?: {
hitInside?: boolean | undefined;
margin?: number | undefined;
}): boolean;
isShapeInPage(shape: TLShape | TLShapeId, pageId?: TLPageId): boolean;
isShapeOfType(shape: TLUnknownShape, type: T['type']): shape is T;
// (undocumented)
isShapeOfType(shapeId: TLUnknownShape['id'], type: T['type']): shapeId is T['id'];
isShapeOrAncestorLocked(shape?: TLShape): boolean;
// (undocumented)
isShapeOrAncestorLocked(id?: TLShapeId): boolean;
mark(markId?: string, onUndo?: boolean, onRedo?: boolean): this;
moveShapesToPage(shapes: TLShape[] | TLShapeId[], pageId: TLPageId): this;
nudgeShapes(shapes: TLShape[] | TLShapeId[], offset: VecLike, historyOptions?: TLCommandHistoryOptions): this;
packShapes(shapes: TLShape[] | TLShapeId[], gap: number): this;
pageToScreen(point: VecLike): {
x: number;
y: number;
z: number;
};
pageToViewport(point: VecLike): {
x: number;
y: number;
z: number;
};
pan(offset: VecLike, animation?: TLAnimationOptions): this;
panZoomIntoView(ids: TLShapeId[], animation?: TLAnimationOptions): this;
popFocusedGroupId(): this;
putContentOntoCurrentPage(content: TLContent, options?: {
point?: VecLike;
preserveIds?: boolean;
preservePosition?: boolean;
select?: boolean;
}): this;
putExternalContent(info: TLExternalContent): Promise;
redo(): this;
registerExternalAssetHandler(type: T, handler: ((info: TLExternalAssetContent & {
type: T;
}) => Promise) | null): this;
registerExternalContentHandler(type: T, handler: ((info: T extends TLExternalContent['type'] ? TLExternalContent & {
type: T;
} : TLExternalContent) => void) | null): this;
renamePage(page: TLPage | TLPageId, name: string, historyOptions?: TLCommandHistoryOptions): this;
renderingBoundsMargin: number;
reparentShapes(shapes: TLShape[] | TLShapeId[], parentId: TLParentId, insertIndex?: IndexKey): this;
resetZoom(point?: Vec, animation?: TLAnimationOptions): this;
resizeShape(shape: TLShape | TLShapeId, scale: VecLike, options?: TLResizeShapeOptions): this;
readonly root: RootState;
rotateShapesBy(shapes: TLShape[] | TLShapeId[], delta: number): this;
screenToPage(point: VecLike): {
x: number;
y: number;
z: number;
};
readonly scribbles: ScribbleManager;
select(...shapes: TLShape[] | TLShapeId[]): this;
selectAll(): this;
selectNone(): this;
sendBackward(shapes: TLShape[] | TLShapeId[]): this;
sendToBack(shapes: TLShape[] | TLShapeId[]): this;
setCamera(point: VecLike, animation?: TLAnimationOptions): this;
setCroppingShape(shape: null | TLShape | TLShapeId): this;
setCurrentPage(page: TLPage | TLPageId, historyOptions?: TLCommandHistoryOptions): this;
setCurrentTool(id: string, info?: {}): this;
setCursor: (cursor: Partial) => this;
setEditingShape(shape: null | TLShape | TLShapeId): this;
setErasingShapes(shapes: TLShape[] | TLShapeId[]): this;
setFocusedGroup(shape: null | TLGroupShape | TLShapeId): this;
setHintingShapes(shapes: TLShape[] | TLShapeId[]): this;
setHoveredShape(shape: null | TLShape | TLShapeId): this;
setOpacityForNextShapes(opacity: number, historyOptions?: TLCommandHistoryOptions): this;
setOpacityForSelectedShapes(opacity: number, historyOptions?: TLCommandHistoryOptions): this;
setSelectedShapes(shapes: TLShape[] | TLShapeId[], historyOptions?: TLCommandHistoryOptions): this;
setStyleForNextShapes(style: StyleProp, value: T, historyOptions?: TLCommandHistoryOptions): this;
setStyleForSelectedShapes>(style: S, value: StylePropValue, historyOptions?: TLCommandHistoryOptions): this;
shapeUtils: {
readonly [K in string]?: ShapeUtil;
};
readonly sideEffects: SideEffectManager;
slideCamera(opts?: {
direction: VecLike;
friction: number;
speed: number;
speedThreshold?: number | undefined;
}): this;
readonly snaps: SnapManager;
stackShapes(shapes: TLShape[] | TLShapeId[], operation: 'horizontal' | 'vertical', gap: number): this;
startFollowingUser(userId: string): this;
stopCameraAnimation(): this;
stopFollowingUser(): this;
readonly store: TLStore;
stretchShapes(shapes: TLShape[] | TLShapeId[], operation: 'horizontal' | 'vertical'): this;
// (undocumented)
styleProps: {
[key: string]: Map, string>;
};
readonly textMeasure: TextManager;
toggleLock(shapes: TLShape[] | TLShapeId[]): this;
undo(): this;
ungroupShapes(ids: TLShapeId[]): this;
// (undocumented)
ungroupShapes(ids: TLShape[]): this;
updateAssets(assets: TLAssetPartial[]): this;
updateCurrentPageState(partial: Partial>, historyOptions?: TLCommandHistoryOptions): this;
updateDocumentSettings(settings: Partial): this;
updateInstanceState(partial: Partial>, historyOptions?: TLCommandHistoryOptions): this;
updatePage(partial: RequiredKeys, historyOptions?: TLCommandHistoryOptions): this;
// @internal
updateRenderingBounds(): this;
updateShape(partial: null | TLShapePartial | undefined, historyOptions?: TLCommandHistoryOptions): this;
updateShapes(partials: (null | TLShapePartial | undefined)[], historyOptions?: TLCommandHistoryOptions): this;
updateViewportScreenBounds(screenBounds: Box, center?: boolean): this;
readonly user: UserPreferencesManager;
visitDescendants(parent: TLPage | TLParentId | TLShape, visitor: (id: TLShapeId) => false | void): this;
zoomIn(point?: Vec, animation?: TLAnimationOptions): this;
zoomOut(point?: Vec, animation?: TLAnimationOptions): this;
zoomToBounds(bounds: Box, opts?: {
inset?: number;
targetZoom?: number;
} & TLAnimationOptions): this;
zoomToContent(opts?: TLAnimationOptions): this;
zoomToFit(animation?: TLAnimationOptions): this;
zoomToSelection(animation?: TLAnimationOptions): this;
}
// @internal (undocumented)
export const EditorContext: React_2.Context;
// @public (undocumented)
export class Ellipse2d extends Geometry2d {
constructor(config: Omit & {
height: number;
width: number;
});
// (undocumented)
config: Omit & {
height: number;
width: number;
};
// (undocumented)
get edges(): Edge2d[];
// (undocumented)
_edges?: Edge2d[];
// (undocumented)
getBounds(): Box;
// (undocumented)
getVertices(): any[];
// (undocumented)
h: number;
// (undocumented)
hitTestLineSegment(A: Vec, B: Vec): boolean;
// (undocumented)
nearestPoint(A: Vec): Vec;
// (undocumented)
w: number;
}
export { EMPTY_ARRAY }
// @public (undocumented)
export class ErrorBoundary extends React_3.Component>, TLErrorBoundaryState> {
// (undocumented)
componentDidCatch(error: unknown): void;
// (undocumented)
static getDerivedStateFromError(error: Error): {
error: Error;
};
// (undocumented)
render(): boolean | JSX_2.Element | Iterable | null | number | string | undefined;
// (undocumented)
state: TLErrorBoundaryState;
}
// @public (undocumented)
export function ErrorScreen({ children }: {
children: ReactNode;
}): JSX_2.Element;
// @public (undocumented)
export const EVENT_NAME_MAP: Record, keyof TLEventHandlers>;
// @internal (undocumented)
export function extractSessionStateFromLegacySnapshot(store: Record): null | TLSessionStateSnapshot;
// @internal (undocumented)
export const featureFlags: Record>;
// @public (undocumented)
export type GapsSnapIndicator = {
direction: 'horizontal' | 'vertical';
gaps: Array<{
endEdge: [VecLike, VecLike];
startEdge: [VecLike, VecLike];
}>;
id: string;
type: 'gaps';
};
// @public (undocumented)
export abstract class Geometry2d {
constructor(opts: Geometry2dOptions);
// (undocumented)
get area(): number;
// (undocumented)
get bounds(): Box;
// (undocumented)
get center(): Vec;
// (undocumented)
debugColor?: string;
// (undocumented)
distanceToLineSegment(A: Vec, B: Vec): number;
// (undocumented)
distanceToPoint(point: Vec, hitInside?: boolean): number;
// (undocumented)
getArea(): number;
// (undocumented)
getBounds(): Box;
// (undocumented)
abstract getVertices(): Vec[];
// (undocumented)
hitTestLineSegment(A: Vec, B: Vec, distance?: number): boolean;
// (undocumented)
hitTestPoint(point: Vec, margin?: number, hitInside?: boolean): boolean;
// (undocumented)
ignore?: boolean;
// (undocumented)
isClosed: boolean;
// (undocumented)
isFilled: boolean;
// (undocumented)
isLabel: boolean;
// (undocumented)
isPointInBounds(point: Vec, margin?: number): boolean;
// (undocumented)
abstract nearestPoint(point: Vec): Vec;
// (undocumented)
nearestPointOnLineSegment(A: Vec, B: Vec): Vec;
// (undocumented)
toSimpleSvgPath(): string;
// (undocumented)
get vertices(): Vec[];
}
// @public
export function getArcMeasure(A: number, B: number, sweepFlag: number, largeArcFlag: number): number;
// @public (undocumented)
export function getArrowTerminalsInArrowSpace(editor: Editor, shape: TLArrowShape): {
end: Vec;
start: Vec;
};
// @public (undocumented)
export function getCursor(cursor: TLCursorType, rotation?: number, color?: string): string;
// @public (undocumented)
export function getFreshUserPreferences(): TLUserPreferences;
// @public
export function getIncrementedName(name: string, others: string[]): string;
// @public (undocumented)
export function getPointerInfo(e: PointerEvent | React.PointerEvent): {
altKey: boolean;
button: number;
ctrlKey: boolean;
isPen: boolean;
point: {
x: number;
y: number;
z: number;
};
pointerId: number;
shiftKey: boolean;
};
// @public
export function getPointInArcT(mAB: number, A: number, B: number, P: number): number;
// @public
export function getPointOnCircle(center: VecLike, r: number, a: number): Vec;
// @public (undocumented)
export function getPolygonVertices(width: number, height: number, sides: number): Vec[];
// @internal (undocumented)
export function getRotationSnapshot({ editor }: {
editor: Editor;
}): null | TLRotationSnapshot;
// @public
export function getSvgPathFromPoints(points: VecLike[], closed?: boolean): string;
// @public (undocumented)
export function getUserPreferences(): TLUserPreferences;
// @public (undocumented)
export const GRID_STEPS: {
mid: number;
min: number;
step: number;
}[];
// @public (undocumented)
export class Group2d extends Geometry2d {
constructor(config: Omit & {
children: Geometry2d[];
});
// (undocumented)
children: Geometry2d[];
// (undocumented)
distanceToPoint(point: Vec, hitInside?: boolean): number;
// (undocumented)
getArea(): number;
// (undocumented)
getVertices(): Vec[];
// (undocumented)
hitTestLineSegment(A: Vec, B: Vec, zoom: number): boolean;
// (undocumented)
hitTestPoint(point: Vec, margin: number, hitInside: boolean): boolean;
// (undocumented)
ignoredChildren: Geometry2d[];
// (undocumented)
nearestPoint(point: Vec): Vec;
// (undocumented)
toSimpleSvgPath(): string;
}
// @public (undocumented)
export class GroupShapeUtil extends ShapeUtil {
// (undocumented)
canBind: () => boolean;
// (undocumented)
component(shape: TLGroupShape): JSX_2.Element | null;
// (undocumented)
getDefaultProps(): TLGroupShape['props'];
// (undocumented)
getGeometry(shape: TLGroupShape): Geometry2d;
// (undocumented)
hideSelectionBoundsFg: () => boolean;
// (undocumented)
indicator(shape: TLGroupShape): JSX_2.Element;
// (undocumented)
static migrations: TLShapePropsMigrations;
// (undocumented)
onChildrenChange: TLOnChildrenChangeHandler;
// (undocumented)
static props: ShapeProps;
// (undocumented)
static type: "group";
}
// @public (undocumented)
export const HALF_PI: number;
// @public
export interface HandleSnapGeometry {
getSelfSnapOutline?(handle: TLHandle): Geometry2d | null;
getSelfSnapPoints?(handle: TLHandle): VecModel[];
outline?: Geometry2d | null;
points?: VecModel[];
}
// @public
export function hardReset({ shouldReload }?: {
shouldReload?: boolean | undefined;
}): Promise;
// @public (undocumented)
export function hardResetEditor(): void;
// @internal (undocumented)
export const HASH_PATTERN_ZOOM_NAMES: Record;
// @public (undocumented)
export const HIT_TEST_MARGIN = 8;
// @public (undocumented)
export function HTMLContainer({ children, className, ...rest }: HTMLContainerProps): JSX_2.Element;
// @public (undocumented)
export type HTMLContainerProps = React_3.HTMLAttributes;
// @public
export function intersectCircleCircle(c1: VecLike, r1: number, c2: VecLike, r2: number): Vec[];
// @public
export function intersectCirclePolygon(c: VecLike, r: number, points: VecLike[]): null | VecLike[];
// @public
export function intersectCirclePolyline(c: VecLike, r: number, points: VecLike[]): null | VecLike[];
// @public
export function intersectLineSegmentCircle(a1: VecLike, a2: VecLike, c: VecLike, r: number): null | VecLike[];
// @public
export function intersectLineSegmentLineSegment(a1: VecLike, a2: VecLike, b1: VecLike, b2: VecLike): null | Vec;
// @public
export function intersectLineSegmentPolygon(a1: VecLike, a2: VecLike, points: VecLike[]): null | VecLike[];
// @public
export function intersectLineSegmentPolyline(a1: VecLike, a2: VecLike, points: VecLike[]): null | VecLike[];
// @public
export function intersectPolygonBounds(points: VecLike[], bounds: Box): null | VecLike[];
// @public
export function intersectPolygonPolygon(polygonA: VecLike[], polygonB: VecLike[]): null | VecLike[];
// @public
export const isSafeFloat: (n: number) => boolean;
// @public (undocumented)
export function linesIntersect(A: VecLike, B: VecLike, C: VecLike, D: VecLike): boolean;
// @public (undocumented)
export function LoadingScreen({ children }: {
children: ReactNode;
}): JSX_2.Element;
// @public
export function loadSessionStateSnapshotIntoStore(store: TLStore, snapshot: TLSessionStateSnapshot): void;
// @public (undocumented)
export function loopToHtmlElement(elm: Element): HTMLElement;
// @public (undocumented)
export class Mat {
constructor(a: number, b: number, c: number, d: number, e: number, f: number);
// (undocumented)
a: number;
// (undocumented)
static Absolute(m: MatLike): MatModel;
// (undocumented)
static applyToBounds(m: MatLike, box: Box): Box;
// (undocumented)
applyToPoint(point: VecLike): Vec;
// (undocumented)
static applyToPoint(m: MatLike, point: VecLike): Vec;
// (undocumented)
applyToPoints(points: VecLike[]): Vec[];
// (undocumented)
static applyToPoints(m: MatLike, points: VecLike[]): Vec[];
// (undocumented)
static applyToXY(m: MatLike, x: number, y: number): number[];
// (undocumented)
b: number;
// (undocumented)
c: number;
// (undocumented)
static Cast(m: MatLike): Mat;
// (undocumented)
clone(): Mat;
// (undocumented)
static Compose(...matrices: MatLike[]): Mat;
// (undocumented)
d: number;
// (undocumented)
static Decompose(m: MatLike): {
rotation: number;
scaleX: number;
scaleY: number;
x: number;
y: number;
};
// (undocumented)
decompose(): {
rotation: number;
scaleX: number;
scaleY: number;
x: number;
y: number;
};
// (undocumented)
decomposed(): {
rotation: number;
scaleX: number;
scaleY: number;
x: number;
y: number;
};
// (undocumented)
e: number;
// (undocumented)
equals(m: Mat | MatModel): boolean;
// (undocumented)
f: number;
// (undocumented)
static From(m: MatLike): Mat;
// (undocumented)
static Identity(): Mat;
// (undocumented)
identity(): this;
// (undocumented)
static Inverse(m: MatModel): MatModel;
// (undocumented)
invert(): this;
// (undocumented)
static Multiply(m1: MatModel, m2: MatModel): MatModel;
// (undocumented)
multiply(m: Mat | MatModel): this;
// (undocumented)
static Point(m: MatLike): Vec;
// (undocumented)
point(): Vec;
// (undocumented)
static Rotate(r: number, cx?: number, cy?: number): Mat;
// (undocumented)
rotate(r: number, cx?: number, cy?: number): Mat;
// (undocumented)
static Rotation(m: MatLike): number;
// (undocumented)
rotation(): number;
// (undocumented)
static Scale: {
(x: number, y: number, cx: number, cy: number): MatModel;
(x: number, y: number): MatModel;
};
// (undocumented)
scale(x: number, y: number): this;
// (undocumented)
setTo(model: MatModel): this;
// (undocumented)
static Smooth(m: MatLike, precision?: number): MatLike;
// (undocumented)
toCssString(): string;
// (undocumented)
static toCssString(m: MatLike): string;
// (undocumented)
static Translate(x: number, y: number): Mat;
// (undocumented)
translate(x: number, y: number): Mat;
}
// @public (undocumented)
export type MatLike = Mat | MatModel;
// @public (undocumented)
export interface MatModel {
// (undocumented)
a: number;
// (undocumented)
b: number;
// (undocumented)
c: number;
// (undocumented)
d: number;
// (undocumented)
e: number;
// (undocumented)
f: number;
}
// @internal (undocumented)
export const MAX_PAGES = 40;
// @internal (undocumented)
export const MAX_SHAPES_PER_PAGE = 2000;
// @internal (undocumented)
export const MAX_ZOOM = 8;
// @internal (undocumented)
export const MIN_ZOOM = 0.1;
// @public
export function moveCameraWhenCloseToEdge(editor: Editor): void;
// @internal (undocumented)
export const MULTI_CLICK_DURATION = 200;
// @internal (undocumented)
export function normalizeWheel(event: React.WheelEvent | WheelEvent): {
x: number;
y: number;
z: number;
};
// @public (undocumented)
export function openWindow(url: string, target?: string): void;
// @internal (undocumented)
export function OptionalErrorBoundary({ children, fallback, ...props }: Omit & {
fallback: TLErrorFallbackComponent;
}): JSX_2.Element;
// @public
export function perimeterOfEllipse(rx: number, ry: number): number;
// @public (undocumented)
export const PI: number;
// @public (undocumented)
export const PI2: number;
// @public (undocumented)
export class Point2d extends Geometry2d {
constructor(config: Omit & {
margin: number;
point: Vec;
});
// (undocumented)
getVertices(): Vec[];
// (undocumented)
hitTestLineSegment(A: Vec, B: Vec, margin: number): boolean;
// (undocumented)
nearestPoint(): Vec;
// (undocumented)
point: Vec;
}
// @public
export function pointInPolygon(A: VecLike, points: VecLike[]): boolean;
// @public (undocumented)
export type PointsSnapIndicator = {
id: string;
points: VecLike[];
type: 'points';
};
// @public (undocumented)
export class Polygon2d extends Polyline2d {
constructor(config: Omit & {
points: Vec[];
});
}
// @public (undocumented)
export function polygonIntersectsPolyline(polygon: VecLike[], polyline: VecLike[]): boolean;
// @public (undocumented)
export function polygonsIntersect(a: VecLike[], b: VecLike[]): boolean;
// @public (undocumented)
export class Polyline2d extends Geometry2d {
constructor(config: Omit & {
points: Vec[];
});
// (undocumented)
getVertices(): Vec[];
// (undocumented)
hitTestLineSegment(A: Vec, B: Vec, distance?: number): boolean;
// (undocumented)
get length(): number;
// (undocumented)
_length?: number;
// (undocumented)
nearestPoint(A: Vec): Vec;
// (undocumented)
points: Vec[];
// (undocumented)
get segments(): Edge2d[];
// (undocumented)
_segments?: Edge2d[];
}
// @public (undocumented)
export function precise(A: VecLike): string;
// @public
export function preventDefault(event: Event | React_2.BaseSyntheticEvent): void;
// @public
export function radiansToDegrees(r: number): number;
// @public
export function rangeIntersection(a0: number, a1: number, b0: number, b1: number): [number, number] | null;
export { react }
// @public
export class ReadonlySharedStyleMap {
// (undocumented)
[Symbol.iterator](): IterableIterator<[StyleProp, SharedStyle]>;
constructor(entries?: Iterable<[StyleProp, SharedStyle]>);
// (undocumented)
entries(): IterableIterator<[StyleProp, SharedStyle]>;
// (undocumented)
equals(other: ReadonlySharedStyleMap): boolean;
// (undocumented)
get(prop: StyleProp): SharedStyle | undefined;
// (undocumented)
getAsKnownValue(prop: StyleProp): T | undefined;
// (undocumented)
keys(): IterableIterator>;
// @internal (undocumented)
protected map: Map, SharedStyle>;
// (undocumented)
get size(): number;
// (undocumented)
values(): IterableIterator>;
}
// @public (undocumented)
export class Rectangle2d extends Polygon2d {
constructor(config: Omit & {
height: number;
width: number;
x?: number;
y?: number;
});
// (undocumented)
getBounds(): Box;
// (undocumented)
h: number;
// (undocumented)
w: number;
// (undocumented)
x: number;
// (undocumented)
y: number;
}
// @public (undocumented)
export function refreshPage(): void;
// @public (undocumented)
export function releasePointerCapture(element: Element, event: PointerEvent | React_2.PointerEvent): void;
// @public (undocumented)
export type RequiredKeys = Partial> & Pick;
// @public (undocumented)
export function resizeBox(shape: TLBaseBoxShape, info: {
handle: TLResizeHandle;
initialBounds: Box;
initialShape: TLBaseBoxShape;
mode: TLResizeMode;
newPoint: VecModel;
scaleX: number;
scaleY: number;
}, opts?: Partial<{
maxHeight: number;
maxWidth: number;
minHeight: number;
minWidth: number;
}>): {
props: {
h: number;
w: number;
};
x: number;
y: number;
};
// @public (undocumented)
export type ResizeBoxOptions = Partial<{
maxHeight: number;
maxWidth: number;
minHeight: number;
minWidth: number;
}>;
// @public (undocumented)
export const ROTATE_CORNER_TO_SELECTION_CORNER: {
readonly bottom_left_rotate: "bottom_left";
readonly bottom_right_rotate: "bottom_right";
readonly mobile_rotate: "top_left";
readonly top_left_rotate: "top_left";
readonly top_right_rotate: "top_right";
};
// @public (undocumented)
export type RotateCorner = 'bottom_left_rotate' | 'bottom_right_rotate' | 'mobile_rotate' | 'top_left_rotate' | 'top_right_rotate';
// @public (undocumented)
export function rotateSelectionHandle(handle: SelectionHandle, rotation: number): SelectionHandle;
// @public (undocumented)
export const runtime: {
hardReset: () => void;
openWindow: (url: string, target: string) => void;
refreshPage: () => void;
};
// @public (undocumented)
export type SelectionCorner = 'bottom_left' | 'bottom_right' | 'top_left' | 'top_right';
// @public (undocumented)
export type SelectionEdge = 'bottom' | 'left' | 'right' | 'top';
// @public (undocumented)
export type SelectionHandle = SelectionCorner | SelectionEdge;
// @public (undocumented)
export function setPointerCapture(element: Element, event: PointerEvent | React_2.PointerEvent): void;
// @public (undocumented)
export function setRuntimeOverrides(input: Partial): void;
// @public (undocumented)
export function setUserPreferences(user: TLUserPreferences): void;
// @public (undocumented)
export abstract class ShapeUtil {
constructor(editor: Editor);
// @internal
backgroundComponent?(shape: Shape): any;
canBind: (_shape: Shape, _otherShape?: K) => boolean;
canCrop: TLShapeUtilFlag;
canDropShapes(shape: Shape, shapes: TLShape[]): boolean;
canEdit: TLShapeUtilFlag;
canEditInReadOnly: TLShapeUtilFlag;
canReceiveNewChildrenOfType(shape: Shape, type: TLShape['type']): boolean;
canResize: TLShapeUtilFlag;
canScroll: TLShapeUtilFlag;
canSnap: TLShapeUtilFlag;
abstract component(shape: Shape): any;
// (undocumented)
editor: Editor;
// @internal (undocumented)
expandSelectionOutlinePx(shape: Shape): number;
getBoundsSnapGeometry(shape: Shape): BoundsSnapGeometry;
getCanvasSvgDefs(): TLShapeUtilCanvasSvgDef[];
abstract getDefaultProps(): Shape['props'];
abstract getGeometry(shape: Shape): Geometry2d;
getHandles?(shape: Shape): TLHandle[];
getHandleSnapGeometry(shape: Shape): HandleSnapGeometry;
hideResizeHandles: TLShapeUtilFlag;
hideRotateHandle: TLShapeUtilFlag;
hideSelectionBoundsBg: TLShapeUtilFlag;
hideSelectionBoundsFg: TLShapeUtilFlag;
abstract indicator(shape: Shape): any;
isAspectRatioLocked: TLShapeUtilFlag;
// (undocumented)
static migrations?: LegacyMigrations | TLShapePropsMigrations;
onBeforeCreate?: TLOnBeforeCreateHandler;
onBeforeUpdate?: TLOnBeforeUpdateHandler;
// @internal
onBindingChange?: TLOnBindingChangeHandler;
onChildrenChange?: TLOnChildrenChangeHandler;
onClick?: TLOnClickHandler;
onDoubleClick?: TLOnDoubleClickHandler;
onDoubleClickEdge?: TLOnDoubleClickHandler;
onDoubleClickHandle?: TLOnDoubleClickHandleHandler;
onDragShapesOut?: TLOnDragHandler;
onDragShapesOver?: TLOnDragHandler;
onDropShapesOver?: TLOnDragHandler;
onEditEnd?: TLOnEditEndHandler;
onHandleDrag?: TLOnHandleDragHandler;
onResize?: TLOnResizeHandler;
onResizeEnd?: TLOnResizeEndHandler;
onResizeStart?: TLOnResizeStartHandler;
onRotate?: TLOnRotateHandler;
onRotateEnd?: TLOnRotateEndHandler;
onRotateStart?: TLOnRotateStartHandler;
onTranslate?: TLOnTranslateHandler;
onTranslateEnd?: TLOnTranslateEndHandler;
onTranslateStart?: TLOnTranslateStartHandler;
// (undocumented)
static props?: ShapeProps;
// @internal
providesBackgroundForChildren(shape: Shape): boolean;
toBackgroundSvg?(shape: Shape, ctx: SvgExportContext): null | Promise | ReactElement;
toSvg?(shape: Shape, ctx: SvgExportContext): null | Promise | ReactElement;
static type: string;
}
// @public
export type SharedStyle = {
readonly type: 'mixed';
} | {
readonly type: 'shared';
readonly value: T;
};
// @internal (undocumented)
export class SharedStyleMap extends ReadonlySharedStyleMap {
// (undocumented)
applyValue(prop: StyleProp, value: T): void;
// (undocumented)
set(prop: StyleProp, value: SharedStyle): void;
}
// @public
export function shortAngleDist(a0: number, a1: number): number;
// @public
export class SideEffectManager void;
};
store: TLStore;
}> {
constructor(editor: CTX);
// (undocumented)
editor: CTX;
registerAfterChangeHandler(typeName: T, handler: TLAfterChangeHandler): () => void;
registerAfterCreateHandler(typeName: T, handler: TLAfterCreateHandler): () => void;
registerAfterDeleteHandler(typeName: T, handler: TLAfterDeleteHandler): () => void;
registerBatchCompleteHandler(handler: TLBatchCompleteHandler): () => void;
registerBeforeChangeHandler(typeName: T, handler: TLBeforeChangeHandler): () => void;
registerBeforeCreateHandler(typeName: T, handler: TLBeforeCreateHandler): () => void;
registerBeforeDeleteHandler(typeName: T, handler: TLBeforeDeleteHandler): () => void;
}
// @public (undocumented)
export const SIDES: readonly ["top", "right", "bottom", "left"];
export { Signal }
// @public (undocumented)
export const SIN: (x: number) => number;
// @public
export function snapAngle(r: number, segments: number): number;
// @public (undocumented)
export type SnapIndicator = GapsSnapIndicator | PointsSnapIndicator;
// @public (undocumented)
export class SnapManager {
constructor(editor: Editor);
// (undocumented)
clearIndicators(): void;
// (undocumented)
readonly editor: Editor;
// (undocumented)
getCurrentCommonAncestor(): TLShapeId | undefined;
// (undocumented)
getIndicators(): SnapIndicator[];
// (undocumented)
getSnappableShapes(): Set;
// (undocumented)
getSnapThreshold(): number;
// (undocumented)
readonly handles: HandleSnaps;
// (undocumented)
setIndicators(indicators: SnapIndicator[]): void;
// (undocumented)
readonly shapeBounds: BoundsSnaps;
}
// @public (undocumented)
export class Stadium2d extends Ellipse2d {
constructor(config: Omit & {
height: number;
width: number;
});
// (undocumented)
config: Omit & {
height: number;
width: number;
};
// (undocumented)
getVertices(): Vec[];
}
// @public (undocumented)
export abstract class StateNode implements Partial {
constructor(editor: Editor, parent?: StateNode);
// (undocumented)
static children?: () => TLStateNodeConstructor[];
// (undocumented)
children?: Record;
_currentToolIdMask: Atom;
// (undocumented)
editor: Editor;
// (undocumented)
enter: (info: any, from: string) => void;
// (undocumented)
exit: (info: any, from: string) => void;
getCurrent(): StateNode | undefined;
// (undocumented)
getCurrentToolIdMask(): string | undefined;
getIsActive(): boolean;
getPath(): string;
// (undocumented)
handleEvent: (info: Exclude) => void;
// (undocumented)
static id: string;
// (undocumented)
id: string;
// (undocumented)
static initial?: string;
// (undocumented)
initial?: string;
// (undocumented)
onCancel?: TLEventHandlers['onCancel'];
// (undocumented)
onComplete?: TLEventHandlers['onComplete'];
// (undocumented)
onDoubleClick?: TLEventHandlers['onDoubleClick'];
// (undocumented)
onEnter?: TLEnterEventHandler;
// (undocumented)
onExit?: TLExitEventHandler;
// (undocumented)
onInterrupt?: TLEventHandlers['onInterrupt'];
// (undocumented)
onKeyDown?: TLEventHandlers['onKeyDown'];
// (undocumented)
onKeyRepeat?: TLEventHandlers['onKeyRepeat'];
// (undocumented)
onKeyUp?: TLEventHandlers['onKeyUp'];
// (undocumented)
onLongPress?: TLEventHandlers['onLongPress'];
// (undocumented)
onMiddleClick?: TLEventHandlers['onMiddleClick'];
// (undocumented)
onPointerDown?: TLEventHandlers['onPointerDown'];
// (undocumented)
onPointerMove?: TLEventHandlers['onPointerMove'];
// (undocumented)
onPointerUp?: TLEventHandlers['onPointerUp'];
// (undocumented)
onQuadrupleClick?: TLEventHandlers['onQuadrupleClick'];
// (undocumented)
onRightClick?: TLEventHandlers['onRightClick'];
// (undocumented)
onTick?: TLEventHandlers['onTick'];
// (undocumented)
onTripleClick?: TLEventHandlers['onTripleClick'];
// (undocumented)
onWheel?: TLEventHandlers['onWheel'];
// (undocumented)
parent: StateNode;
// (undocumented)
_path: Computed;
// (undocumented)
setCurrentToolIdMask(id: string | undefined): void;
// (undocumented)
shapeType?: string;
transition: (id: string, info?: any) => this;
// (undocumented)
type: TLStateNodeType;
}
// @public (undocumented)
export const stopEventPropagation: (e: any) => any;
// @internal (undocumented)
export const SVG_PADDING = 32;
// @public (undocumented)
export function SVGContainer({ children, className, ...rest }: SVGContainerProps): JSX_2.Element;
// @public (undocumented)
export type SVGContainerProps = React_3.HTMLAttributes;
// @public (undocumented)
export interface SvgExportContext {
addExportDef(def: SvgExportDef): void;
readonly isDarkMode: boolean;
}
// @public (undocumented)
export interface SvgExportDef {
// (undocumented)
getElement: () => null | Promise | ReactElement;
// (undocumented)
key: string;
}
// @public
export const TAB_ID: string;
// @public (undocumented)
export type TLAfterChangeHandler = (prev: R, next: R, source: 'remote' | 'user') => void;
// @public (undocumented)
export type TLAfterCreateHandler = (record: R, source: 'remote' | 'user') => void;
// @public (undocumented)
export type TLAfterDeleteHandler = (record: R, source: 'remote' | 'user') => void;
// @public (undocumented)
export type TLAnimationOptions = Partial<{
duration: number;
easing: (t: number) => number;
}>;
// @public (undocumented)
export type TLAnyShapeUtilConstructor = TLShapeUtilConstructor;
// @public (undocumented)
export interface TLArcInfo {
// (undocumented)
center: VecLike;
// (undocumented)
largeArcFlag: number;
// (undocumented)
length: number;
// (undocumented)
radius: number;
// (undocumented)
size: number;
// (undocumented)
sweepFlag: number;
}
// @public (undocumented)
export type TLArrowInfo = {
bodyArc: TLArcInfo;
end: TLArrowPoint;
handleArc: TLArcInfo;
isStraight: false;
isValid: boolean;
middle: VecLike;
start: TLArrowPoint;
} | {
end: TLArrowPoint;
isStraight: true;
isValid: boolean;
length: number;
middle: VecLike;
start: TLArrowPoint;
};
// @public (undocumented)
export type TLArrowPoint = {
arrowhead: TLArrowShapeArrowheadStyle;
handle: VecLike;
point: VecLike;
};
// @public (undocumented)
export type TLBaseBoxShape = TLBaseShape;
// @public (undocumented)
export interface TLBaseEventInfo {
// (undocumented)
altKey: boolean;
// (undocumented)
ctrlKey: boolean;
// (undocumented)
shiftKey: boolean;
// (undocumented)
type: UiEventType;
}
// @public (undocumented)
export type TLBatchCompleteHandler = () => void;
// @public (undocumented)
export type TLBeforeChangeHandler = (prev: R, next: R, source: 'remote' | 'user') => R;
// @public (undocumented)
export type TLBeforeCreateHandler = (record: R, source: 'remote' | 'user') => R;
// @public (undocumented)
export type TLBeforeDeleteHandler = (record: R, source: 'remote' | 'user') => false | void;
// @public (undocumented)
export type TLBrushProps = {
brush: BoxModel;
className?: string;
color?: string;
opacity?: number;
};
// @public (undocumented)
export type TLCancelEvent = (info: TLCancelEventInfo) => void;
// @public (undocumented)
export type TLCancelEventInfo = {
name: 'cancel';
type: 'misc';
};
// @public (undocumented)
export type TLClickEvent = (info: TLClickEventInfo) => void;
// @public (undocumented)
export type TLClickEventInfo = TLBaseEventInfo & {
button: number;
name: TLCLickEventName;
phase: 'down' | 'settle' | 'up';
point: VecLike;
pointerId: number;
type: 'click';
} & TLPointerEventTarget;
// @public (undocumented)
export type TLCLickEventName = 'double_click' | 'quadruple_click' | 'triple_click';
// @public (undocumented)
export type TLCollaboratorHintProps = {
className?: string;
color: string;
opacity?: number;
point: VecModel;
viewport: Box;
zoom: number;
};
// @public (undocumented)
export type TLCommand = {
preservesRedoStack?: boolean;
data: Data;
name: Name;
type: 'command';
};
// @public (undocumented)
export type TLCommandHandler = {
squash?: (prevData: Data, nextData: Data) => Data;
do: (data: Data) => void;
redo?: (data: Data) => void;
undo: (data: Data) => void;
};
// @public (undocumented)
export type TLCommandHistoryOptions = Partial<{
preservesRedoStack: boolean;
squashing: boolean;
ephemeral: boolean;
}>;
// @public (undocumented)
export type TLCompleteEvent = (info: TLCompleteEventInfo) => void;
// @public (undocumented)
export type TLCompleteEventInfo = {
name: 'complete';
type: 'misc';
};
// @public (undocumented)
export interface TLContent {
// (undocumented)
assets: TLAsset[];
// (undocumented)
rootShapeIds: TLShapeId[];
// (undocumented)
schema: SerializedSchema;
// (undocumented)
shapes: TLShape[];
}
// @public (undocumented)
export type TLCursorProps = {
chatMessage: string;
className?: string;
color?: string;
name: null | string;
point: null | VecModel;
zoom: number;
};
// @public (undocumented)
export const TldrawEditor: React_2.NamedExoticComponent;
// @public
export interface TldrawEditorBaseProps {
autoFocus?: boolean;
children?: ReactNode;
className?: string;
components?: TLEditorComponents;
inferDarkMode?: boolean;
initialState?: string;
onMount?: TLOnMountHandler;
shapeUtils?: readonly TLAnyShapeUtilConstructor[];
tools?: readonly TLStateNodeConstructor[];
user?: TLUser;
}
// @public
export type TldrawEditorProps = Expand;
migrations?: readonly MigrationSequence[];
persistenceKey?: string;
sessionId?: string;
snapshot?: StoreSnapshot;
store?: undefined;
} | {
store: TLStore | TLStoreWithStatus;
})>;
// @public (undocumented)
export type TLEditorComponents = Partial<{
[K in keyof BaseEditorComponents]: BaseEditorComponents[K] | null;
} & ErrorComponents>;
// @public (undocumented)
export interface TLEditorOptions {
getContainer: () => HTMLElement;
inferDarkMode?: boolean;
initialState?: string;
shapeUtils: readonly TLShapeUtilConstructor[];
store: TLStore;
tools: readonly TLStateNodeConstructor[];
user?: TLUser;
}
// @public (undocumented)
export type TLEnterEventHandler = (info: any, from: string) => void;
// @public (undocumented)
export interface TLErrorBoundaryProps {
// (undocumented)
children: React_3.ReactNode;
// (undocumented)
fallback: TLErrorFallbackComponent;
// (undocumented)
onError?: ((error: unknown) => void) | null;
}
// @public (undocumented)
export interface TLEventHandlers {
// (undocumented)
onCancel: TLCancelEvent;
// (undocumented)
onComplete: TLCompleteEvent;
// (undocumented)
onDoubleClick: TLClickEvent;
// (undocumented)
onInterrupt: TLInterruptEvent;
// (undocumented)
onKeyDown: TLKeyboardEvent;
// (undocumented)
onKeyRepeat: TLKeyboardEvent;
// (undocumented)
onKeyUp: TLKeyboardEvent;
// (undocumented)
onLongPress: TLPointerEvent;
// (undocumented)
onMiddleClick: TLPointerEvent;
// (undocumented)
onPointerDown: TLPointerEvent;
// (undocumented)
onPointerMove: TLPointerEvent;
// (undocumented)
onPointerUp: TLPointerEvent;
// (undocumented)
onQuadrupleClick: TLClickEvent;
// (undocumented)
onRightClick: TLPointerEvent;
// (undocumented)
onTick: TLTickEvent;
// (undocumented)
onTripleClick: TLClickEvent;
// (undocumented)
onWheel: TLWheelEvent;
}
// @public (undocumented)
export type TLEventInfo = TLCancelEventInfo | TLClickEventInfo | TLCompleteEventInfo | TLInterruptEventInfo | TLKeyboardEventInfo | TLPinchEventInfo | TLPointerEventInfo | TLTickEventInfo | TLWheelEventInfo;
// @public (undocumented)
export interface TLEventMap {
// (undocumented)
'change-history': [{
markId?: string;
reason: 'bail';
} | {
reason: 'push' | 'redo' | 'undo';
}];
// (undocumented)
'mark-history': [{
id: string;
}];
// (undocumented)
'max-shapes': [{
count: number;
name: string;
pageId: TLPageId;
}];
// (undocumented)
'select-all-text': [{
shapeId: TLShapeId;
}];
// (undocumented)
'stop-camera-animation': [];
// (undocumented)
'stop-following': [];
// (undocumented)
change: [HistoryEntry];
// (undocumented)
crash: [{
error: unknown;
}];
// (undocumented)
event: [TLEventInfo];
// (undocumented)
frame: [number];
// (undocumented)
mount: [];
// (undocumented)
tick: [number];
// (undocumented)
update: [];
}
// @public (undocumented)
export type TLEventMapHandler = (...args: TLEventMap[T]) => void;
// @public (undocumented)
export type TLEventName = 'cancel' | 'complete' | 'interrupt' | 'tick' | 'wheel' | TLCLickEventName | TLKeyboardEventName | TLPinchEventName | TLPointerEventName;
// @public (undocumented)
export type TLExitEventHandler = (info: any, to: string) => void;
// @public (undocumented)
export type TLExternalAssetContent = {
file: File;
type: 'file';
} | {
type: 'url';
url: string;
};
// @public (undocumented)
export type TLExternalContent = {
point?: VecLike;
sources?: TLExternalContentSource[];
} & ({
embed: EmbedDefinition;
type: 'embed';
url: string;
} | {
files: File[];
ignoreParent: boolean;
type: 'files';
} | {
text: string;
type: 'svg-text';
} | {
text: string;
type: 'text';
} | {
type: 'url';
url: string;
});
// @public (undocumented)
export type TLExternalContentSource = {
data: any;
type: 'excalidraw';
} | {
data: null | string;
reason: string;
type: 'error';
} | {
data: string;
subtype: 'html' | 'json' | 'text' | 'url';
type: 'text';
} | {
data: TLContent;
type: 'tldraw';
};
// @public (undocumented)
export type TLGridProps = {
size: number;
x: number;
y: number;
z: number;
};
// @public (undocumented)
export type TLHandleProps = {
className?: string;
handle: TLHandle;
isCoarse: boolean;
shapeId: TLShapeId;
zoom: number;
};
// @public (undocumented)
export type TLHandlesProps = {
children: ReactNode;
};
// @public (undocumented)
export type TLHistoryEntry = TLCommand | TLHistoryMark;
// @public (undocumented)
export type TLHistoryMark = {
id: string;
onRedo: boolean;
onUndo: boolean;
type: 'STOP';
};
// @public (undocumented)
export type TLInterruptEvent = (info: TLInterruptEventInfo) => void;
// @public (undocumented)
export type TLInterruptEventInfo = {
name: 'interrupt';
type: 'misc';
};
// @public (undocumented)
export type TLKeyboardEvent = (info: TLKeyboardEventInfo) => void;
// @public (undocumented)
export type TLKeyboardEventInfo = TLBaseEventInfo & {
code: string;
key: string;
name: TLKeyboardEventName;
type: 'keyboard';
};
// @public (undocumented)
export type TLKeyboardEventName = 'key_down' | 'key_repeat' | 'key_up';
// @public (undocumented)
export type TLOnBeforeCreateHandler = (next: T) => T | void;
// @public (undocumented)
export type TLOnBeforeUpdateHandler = (prev: T, next: T) => T | void;
// @internal (undocumented)
export type TLOnBindingChangeHandler = (shape: T) => TLShapePartial | void;
// @public (undocumented)
export type TLOnChildrenChangeHandler = (shape: T) => TLShapePartial[] | void;
// @public (undocumented)
export type TLOnClickHandler = (shape: T) => TLShapePartial | void;
// @public (undocumented)
export type TLOnDoubleClickHandleHandler = (shape: T, handle: TLHandle) => TLShapePartial | void;
// @public (undocumented)
export type TLOnDoubleClickHandler = (shape: T) => TLShapePartial | void;
// @public (undocumented)
export type TLOnDragHandler = (shape: T, shapes: TLShape[]) => R;
// @public (undocumented)
export type TLOnEditEndHandler = (shape: T) => void;
// @public (undocumented)
export type TLOnHandleDragHandler = (shape: T, info: {
handle: TLHandle;
initial?: T | undefined;
isPrecise: boolean;
}) => TLShapePartial | void;
// @public
export type TLOnMountHandler = (editor: Editor) => (() => undefined | void) | undefined | void;
// @public (undocumented)
export type TLOnResizeEndHandler = TLEventChangeHandler;
// @public (undocumented)
export type TLOnResizeHandler = (shape: T, info: TLResizeInfo) => Omit, 'id' | 'type'> | undefined | void;
// @public (undocumented)
export type TLOnResizeStartHandler = TLEventStartHandler;
// @public (undocumented)
export type TLOnRotateEndHandler = TLEventChangeHandler;
// @public (undocumented)
export type TLOnRotateHandler = TLEventChangeHandler;
// @public (undocumented)
export type TLOnRotateStartHandler = TLEventStartHandler;
// @public (undocumented)
export type TLOnTranslateEndHandler = TLEventChangeHandler;
// @public (undocumented)
export type TLOnTranslateHandler = TLEventChangeHandler;
// @public (undocumented)
export type TLOnTranslateStartHandler = TLEventStartHandler;
// @public (undocumented)
export type TLPinchEvent = (info: TLPinchEventInfo) => void;
// @public (undocumented)
export type TLPinchEventInfo = TLBaseEventInfo & {
delta: VecModel;
name: TLPinchEventName;
point: VecModel;
type: 'pinch';
};
// @public (undocumented)
export type TLPinchEventName = 'pinch_end' | 'pinch_start' | 'pinch';
// @public (undocumented)
export type TLPointerEvent = (info: TLPointerEventInfo) => void;
// @public (undocumented)
export type TLPointerEventInfo = TLBaseEventInfo & {
button: number;
isPen: boolean;
name: TLPointerEventName;
point: VecLike;
pointerId: number;
type: 'pointer';
} & TLPointerEventTarget;
// @public (undocumented)
export type TLPointerEventName = 'long_press' | 'middle_click' | 'pointer_down' | 'pointer_move' | 'pointer_up' | 'right_click';
// @public (undocumented)
export type TLPointerEventTarget = {
handle: TLHandle;
shape: TLShape;
target: 'handle';
} | {
handle?: TLSelectionHandle;
shape?: undefined;
target: 'selection';
} | {
shape: TLShape;
target: 'shape';
} | {
shape?: undefined;
target: 'canvas';
};
// @public (undocumented)
export type TLResizeHandle = SelectionCorner | SelectionEdge;
// @public
export type TLResizeInfo = {
handle: TLResizeHandle;
initialBounds: Box;
initialShape: T;
mode: TLResizeMode;
newPoint: Vec;
scaleX: number;
scaleY: number;
};
// @public
export type TLResizeMode = 'resize_bounds' | 'scale_shape';
// @public (undocumented)
export type TLResizeShapeOptions = Partial<{
dragHandle: TLResizeHandle;
initialBounds: Box;
initialPageTransform: MatLike;
initialShape: TLShape;
mode: TLResizeMode;
scaleAxisRotation: number;
scaleOrigin: VecLike;
}>;
// @public
export type TLRotationSnapshot = {
initialCursorAngle: number;
initialSelectionRotation: number;
selectionPageCenter: Vec;
shapeSnapshots: {
initialPagePoint: Vec;
shape: TLShape;
}[];
};
// @public (undocumented)
export type TLScribbleProps = {
className?: string;
color?: string;
opacity?: number;
scribble: TLScribble;
zoom: number;
};
// @public (undocumented)
export type TLSelectionBackgroundProps = {
bounds: Box;
rotation: number;
};
// @public (undocumented)
export type TLSelectionForegroundProps = {
bounds: Box;
rotation: number;
};
// @public (undocumented)
export type TLSelectionHandle = RotateCorner | SelectionCorner | SelectionEdge;
// @public
export interface TLSessionStateSnapshot {
// (undocumented)
currentPageId: TLPageId;
// (undocumented)
exportBackground: boolean;
// (undocumented)
isDebugMode: boolean;
// (undocumented)
isFocusMode: boolean;
// (undocumented)
isGridMode: boolean;
// (undocumented)
isToolLocked: boolean;
// (undocumented)
pageStates: Array<{
camera: {
x: number;
y: number;
z: number;
};
focusedGroupId: null | TLShapeId;
pageId: TLPageId;
selectedShapeIds: TLShapeId[];
}>;
// (undocumented)
version: number;
}
// @public (undocumented)
export type TLShapeIndicatorProps = {
className?: string;
color?: string | undefined;
hidden?: boolean;
opacity?: number;
shapeId: TLShapeId;
};
// @public (undocumented)
export interface TLShapeUtilCanvasSvgDef {
// (undocumented)
component: React.ComponentType;
// (undocumented)
key: string;
}
// @public (undocumented)
export interface TLShapeUtilConstructor = ShapeUtil> {
// (undocumented)
new (editor: Editor): U;
// (undocumented)
migrations?: LegacyMigrations | MigrationSequence | TLShapePropsMigrations;
// (undocumented)
props?: ShapeProps